import{logger as e}from"../../logger/index.mjs";const t=async t=>{let n={headers:{"User-Agent":`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36`}};try{let r=await fetch(t,n);if(!r.ok)return e.error(`Failed to fetch URL ${t}: ${r.status} ${r.statusText}`),!1;let i=await r.text(),a=/['"]?name['"]?\s*:\s*['"]Intlayer['"]/i;if(a.test(i))return!0;let o=/(?:src|href)=\s*['"]?([^'"\s>]+(?:\.js|\.mjs|\.cjs)(?:\?[^'"\s>]*)?)['"]?/gi,s=[];for(let e of i.matchAll(o))e[1]&&s.push(e[1]);for(let e of i.matchAll(/import\s*\(?\s*['"]?([^'"\s>]+\.(?:js|mjs|cjs)[^'"\s>]*)['"]?\s*\)?/gi))e[1]&&s.push(e[1]);let c=/['"]([^'"\s>]+(?:\.js|\.mjs|\.cjs)(?:\?[^'"\s>]*)?)['"]/gi;for(let e of i.matchAll(c))e[1]&&s.push(e[1]);let l=Array.from(new Set(s)),u=new Set;for(let r=0;r<l.length&&r<50;r++){let i=l[r];try{let e=new URL(i,t).toString();if(u.has(e))continue;u.add(e);let r=await fetch(e,n);if(!r.ok)continue;let o=await r.text();if(a.test(o))return!0;for(let e of o.matchAll(c)){let t=e[1];t&&!l.includes(t)&&l.push(t)}}catch(n){e.debug(`Error fetching script ${i} for ${t}:`,n)}}}catch(n){e.error(`Error verifying bundle for ${t}:`,n)}return!1};export{t as verifyIntlayerBundle};
//# sourceMappingURL=showcaseVerifyBundle.service.mjs.map