1import{_ as A}from"./Biv_AVvx.js";import{aA as D,aH as F,aI as K}from"./nY43Blyt.js";import{af as L,r as f,ax as l,aq as g,eI as C,eh as S,an as h,am as V,as as _,dw as E,ej as k,ag as u,dv as N,du as I,aw as O}from"./B9e58JgG.js";import"./BkELLDnV.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new i.Error().stack;o&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[o]="3a6ec5af-1551-4721-842c-994de826911d",i._sentryDebugIdIdentifier="sentry-dbid-3a6ec5af-1551-4721-842c-994de826911d")}catch{}})();const U={class:"page"},J=["href"],P={class:"name"},q=["src","alt"],G=L({__name:"tt",setup(i){const o=f(""),y=f([]),c=f(""),b=f([]);function $(){const s=c.value.toLowerCase().replace(/ +/g,"-");fetch(`https://tabletopia.com/games/${s}`).then(e=>e.text()).then(e=>new DOMParser().parseFromString(e,"text/html")).then(e=>{var a,t,r;const n=e.getElementsByTagName("h3");b.value=[];for(let d=0;d<n.length;d++){if(((a=n.item(d))==null?void 0:a.textContent)!=="Setups")continue;const w=n.item(d).nextElementSibling,m=w==null?void 0:w.getElementsByClassName("content-list-item");for(let x=0;x<m.length;x++){const v=(r=(t=m==null?void 0:m.item(x))==null?void 0:t.textContent)==null?void 0:r.trim();if(typeof v!="string")continue;const p=/(\d-?\d?) players?(?:, Eng)?\s*-?\s*(.*)/.exec(v.trim());if(!p)continue;const T=`${p[1]}players${p[2]?`-${p[2].toLowerCase().trim().replace(/ /g,"-")}`:""}`,B=`https://api.tabletopia.com/workshop/games/${s}/${T}/manifest/legacy`;b.value.push({name:v,url:B})}}}).catch(e=>F.popup("Failed to fetch games","tt.fetch-setups",e))}function j(){try{const s=JSON.parse(o.value);if(!Array.isArray(s.objects))throw new Error("No objects found");const e=[];s.objects.forEach(n=>{if(!Array.isArray(n.resources))return;const a=n.resources.filter(t=>{const r=t.url;return!(typeof r!="string"||r.endsWith(".obj"))});a.length!==0&&e.push({...n,images:a})}),y.value=e}catch(s){const e=s instanceof Error?s.message:"(Unknown Error)";K.error({text:`Error: ${e}`})}}return(s,e)=>{const n=A,a=D;return u(),l("div",U,[g(n,{modelValue:h(c),"onUpdate:modelValue":e[0]||(e[0]=t=>S(c)?c.value=t:null),label:"Game",onKeypress:C($,["enter"])},null,8,["modelValue"]),g(a,{onClick:$},{default:V(()=>e[2]||(e[2]=[N("Fetch Setups")])),_:1}),_("ul",null,[(u(!0),l(E,null,k(h(b),t=>(u(),l("li",{key:t.url},[_("a",{href:t.url,target:"tts"},I(t.name),9,J)]))),128))]),g(n,{modelValue:h(o),"onUpdate:modelValue":e[1]||(e[1]=t=>S(o)?o.value=t:null),label:"JSON",onKeypress:C(j,["enter"])},null,8,["modelValue"]),g(a,{onClick:j},{default:V(()=>e[3]||(e[3]=[N("Show Images")])),_:1}),_("div",null,[(u(!0),l(E,null,k(h(y),t=>(u(),l("div",{key:t.id},[_("p",P,I(t.type)+": "+I(t.name),1),(u(!0),l(E,null,k(t.images,r=>(u(),l("img",{key:r.id,src:r.url,alt:r.name},null,8,q))),128))]))),128))])])}}}),z=O(G,[["__scopeId","data-v-55a91448"]]);export{z as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.