handler-playable-sdk 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@
43
43
  <button class="debug-btn primary" data-modal-apply>Apply</button>
44
44
  </div>
45
45
  </div>
46
- `,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Gs={};Wi(Gs,{AssetCache:()=>se,AssetLoader:()=>Le,AssetSystem:()=>ai,AssetTextures:()=>Te,Assets:()=>ba,BaseSystem:()=>tt,GameEngine:()=>ni,GameObject:()=>Tt,GameObjectManager:()=>Qe,ObjectFactory:()=>ue,Renderer:()=>Lt,RuntimeObjectRegistry:()=>it,Transform:()=>At,applyScreenAnchor:()=>Bt,basePixi:()=>ga,clearResponsiveElements:()=>Gn,createPixiBase:()=>ti,getRegisteredFontIds:()=>ca,globalResponsiveMultipliers:()=>bt,initAssetTextures:()=>Ht,initAssets:()=>ya,layout:()=>qn,playLottieOverlay:()=>pa,registerFont:()=>la,registerType:()=>$t,resolveAnchorVec2:()=>ke,resolveFont:()=>ra,resolveFontWeight:()=>oa,resolveScreenAnchorPoint:()=>$e,resolveScreenRatioPoint:()=>De,runInitSequence:()=>va,setLottieInstance:()=>Kt,spawnSceneFromConfig:()=>fa,updateScreenState:()=>Ft});module.exports=Aa(Gs);var sa=require("pixi.js");var Ce={};function jt(i,e,t=!1){Ce[i]||(Ce[i]=[]),Ce[i].push({fn:e,once:t})}function oi(i,e){if(Ce[i]){if(!e){delete Ce[i];return}Ce[i]=Ce[i].filter(t=>t.fn!==e)}}function _t(i,...e){let t=Ce[i];if(t)for(let n of[...t])n.fn(...e),n.once&&oi(i,n.fn)}function J(i,e){jt(i,e,!0)}var $=null,ee=[],Be=null;function Ji(i){$=i,ee=[],Be!==null&&(clearTimeout(Be),Be=null)}function Zi(){var i,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(i=$==null?void 0:$.batchSize)!=null?i:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function Ki(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(s){n&&console.warn("[handler.telemetry] fetch failed",s)}}function li(i,e){let t=Zi();if(e&&t.endpoint){if(ee.push(i),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){Xi();return}Be===null&&(Be=window.setTimeout(()=>{Be=null,Xi()},t.flushIntervalMs))}}async function Xi(){let i=Zi();if(!i.endpoint||ee.length===0)return;let e=ee.splice(0,i.batchSize);await Ki(i.endpoint,{events:e},i.transport,i.debug),ee.length>0&&await Ki(i.endpoint,{events:ee.splice(0,i.batchSize)},i.transport,i.debug)}function Qi(i){return Math.max(0,Math.min(1,i))}function La(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function gt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ta(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function en(i,e,t){try{i[e]=t}catch{}}function ka(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function tn(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function nn(i,e){let t=ka(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function an(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=u=>{var p;i.add(u);let c=(p=e.get(u.target))!=null?p:new Set;c.add(u),e.set(u.target,c),n()},s=u=>{i.delete(u);let c=e.get(u.target);c&&(c.delete(u),c.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var c,p;let u=gt();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,C=Qi(f),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let y=f-h;C=Qi(y)}let v=g.ease(C);g.yoyo&&h%2===1&&(v=1-v);for(let y of g.props)en(g.target,y.key,y.from+(y.to-y.from)*v);g.scaleFrom&&g.scaleTo&&tn(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(c=g.onUpdate)==null||c.call(g)}catch{}if(f>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},l=(u,c,p)=>{var y;let g=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),m=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),f=La(c.ease),C=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,b=c.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let P of Object.keys(c)){if(h.has(P))continue;let j=c[P];typeof j=="number"&&v.push({key:P,from:Ta(u,P),to:j})}let w=nn(u,c);return{target:u,startMs:gt(),delayMs:m,durationMs:g,ease:f,props:v,scaleFrom:w.from,scaleTo:w.to,repeat:C,yoyo:b,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(u,c){let p=l(u,c);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=gt())},resume:()=>{var f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:gt(),m=gt()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,c,p){return d.set(u,c),d.to(u,p)},set(u,c){if(!u||!c)return;for(let g of Object.keys(c)){let m=c[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&en(u,g,m)}let p=nn(u,c);p.to&&tn(u,p.to)},killTweensOf(u){let c=e.get(u);if(c)for(let p of Array.from(c))r(p)},timeline(u={}){let c=[],p=0,g=!1,m=[],f=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let v=typeof h=="string"?h.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},C=h=>{c.push(h);let v=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+v)},b={to(h,v,w){return C({kind:"to",target:h,vars:v,atMs:f(w)}),b},fromTo(h,v,w,y){return C({kind:"fromTo",target:h,vars:w,from:v,atMs:f(y)}),b},play(){var h,v;if(g)return b;g=!0,m=[];for(let w of c)w.kind==="fromTo"&&d.set(w.target,(h=w.from)!=null?h:{}),m.push(d.to(w.target,{...w.vars,delay:w.atMs/1e3+((v=w.vars.delay)!=null?v:0)}));return b},pause(){for(let h of m)h.pause();return b},kill(){for(let h of m)h.kill();m=[],g=!1}};return u.paused||b.play(),b}};return d}function sn(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=an()}catch{}}var rn={name:"handler-playable-sdk",version:"1.0.6",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var Z=0,Ia=Z++,on=Z++,ln=Z++,cn=Z++,dn=Z++,pn=Z++,un=Z++,gn=Z++,hn=Z++,fn=Z++,mn=Z++,bn=Z++,O=Ia;function yn(){return O===on}function vn(){return O===ln}function wn(){return O===cn}function xn(){return O===dn}function Ge(){return O===pn}function Ue(){return O===un}function Sn(){return O===gn}function En(){return O===hn}function Cn(){return O===fn}function ci(){return O===mn}function di(){return O===bn}function An(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),O=on;return}catch{}else if(i==="dapi")try{dapi.isReady(),O=ln;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(O=cn)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(O=dn)}catch{}else if(e==="mintegral")window.gameReady&&(O=pn);else if(e==="tapjoy")window.TJ_API&&(O=un);else if(e==="tiktok")window.openAppStore&&(O=gn);else if(e==="smadex")try{window.smxTracking&&(O=hn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(O=fn)}catch{}else e==="vungle"?O=mn:(i==="nucleo"||e==="nucleo")&&(O=bn)}var Ot=ri(require("lottie-web"),1),Ln=Ot.default;typeof window!="undefined"&&(window.lottie=Ot.default,window.__baseLottie=Ot.default);gi();function D(i,e){let t=(a,s)=>s===0?a:t(s,a%s),n=t(i,e);return`${i/n}:${e/n}`}var Sr=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:D(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:D(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:D(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:D(360,780)}],Er=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:D(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:D(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:D(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:D(412,915)}],Cr=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:D(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:D(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:D(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:D(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:D(800,1280)}],In=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:D(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:D(768,1024),mraidScale:.7}];var Ar=[...In];var Da=In[0];ae();function Ha(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Na(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Fa(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function hi(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await Ha(a),r=await Fa(s),o=Na(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(t=r==null?void 0:r.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Rt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((c,p)=>{let g=new Image;g.onload=()=>c(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let s=a.getImageData(0,0,n.width,n.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let p=r[c],g=r[c+1],m=r[c+2],f=!1;for(let C of l)if(Math.sqrt(Math.pow(p-C.r,2)+Math.pow(g-C.g,2)+Math.pow(m-C.b,2))<e){f=!0;break}f&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var _n=require("@google/genai");async function fi(i,e,t=[],n={}){var a,s,r,o,l,d,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let h=t[b];if(!h.base64||!h.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${h.mimeType}`)}let c=new _n.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,h)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await c.models.generateContent({model:p,contents:g}),f="",C=(r=(s=(a=m.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(C)for(let b of C)b.text&&(f+=b.text);if(!f.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${f.length}`),f}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=c.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var On=require("@google/genai");async function zt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new On.GoogleGenAI({apiKey:i}),s=[{text:e}];t.length>0&&t.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");ht();ae();var Nn=require("pixi.js");var Ka=require("pixi.js");ae();function ss(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function rs(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function os(i){return`
46
+ `,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Gs={};Wi(Gs,{AssetCache:()=>se,AssetLoader:()=>Le,AssetSystem:()=>ai,AssetTextures:()=>Te,Assets:()=>ba,BaseSystem:()=>tt,GameEngine:()=>ni,GameObject:()=>Tt,GameObjectManager:()=>Qe,ObjectFactory:()=>ue,Renderer:()=>Lt,RuntimeObjectRegistry:()=>it,Transform:()=>At,applyScreenAnchor:()=>Bt,basePixi:()=>ga,clearResponsiveElements:()=>Gn,createPixiBase:()=>ti,getRegisteredFontIds:()=>ca,globalResponsiveMultipliers:()=>bt,initAssetTextures:()=>Ht,initAssets:()=>ya,layout:()=>qn,playLottieOverlay:()=>pa,registerFont:()=>la,registerType:()=>$t,resolveAnchorVec2:()=>ke,resolveFont:()=>ra,resolveFontWeight:()=>oa,resolveScreenAnchorPoint:()=>$e,resolveScreenRatioPoint:()=>De,runInitSequence:()=>va,setLottieInstance:()=>Kt,spawnSceneFromConfig:()=>fa,updateScreenState:()=>Ft});module.exports=Aa(Gs);var sa=require("pixi.js");var Ce={};function jt(i,e,t=!1){Ce[i]||(Ce[i]=[]),Ce[i].push({fn:e,once:t})}function oi(i,e){if(Ce[i]){if(!e){delete Ce[i];return}Ce[i]=Ce[i].filter(t=>t.fn!==e)}}function _t(i,...e){let t=Ce[i];if(t)for(let n of[...t])n.fn(...e),n.once&&oi(i,n.fn)}function J(i,e){jt(i,e,!0)}var $=null,ee=[],Be=null;function Ji(i){$=i,ee=[],Be!==null&&(clearTimeout(Be),Be=null)}function Zi(){var i,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(i=$==null?void 0:$.batchSize)!=null?i:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function Ki(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(s){n&&console.warn("[handler.telemetry] fetch failed",s)}}function li(i,e){let t=Zi();if(e&&t.endpoint){if(ee.push(i),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){Xi();return}Be===null&&(Be=window.setTimeout(()=>{Be=null,Xi()},t.flushIntervalMs))}}async function Xi(){let i=Zi();if(!i.endpoint||ee.length===0)return;let e=ee.splice(0,i.batchSize);await Ki(i.endpoint,{events:e},i.transport,i.debug),ee.length>0&&await Ki(i.endpoint,{events:ee.splice(0,i.batchSize)},i.transport,i.debug)}function Qi(i){return Math.max(0,Math.min(1,i))}function La(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function gt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ta(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function en(i,e,t){try{i[e]=t}catch{}}function ka(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function tn(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function nn(i,e){let t=ka(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function an(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=u=>{var p;i.add(u);let c=(p=e.get(u.target))!=null?p:new Set;c.add(u),e.set(u.target,c),n()},s=u=>{i.delete(u);let c=e.get(u.target);c&&(c.delete(u),c.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var c,p;let u=gt();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,C=Qi(f),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let y=f-h;C=Qi(y)}let v=g.ease(C);g.yoyo&&h%2===1&&(v=1-v);for(let y of g.props)en(g.target,y.key,y.from+(y.to-y.from)*v);g.scaleFrom&&g.scaleTo&&tn(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(c=g.onUpdate)==null||c.call(g)}catch{}if(f>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},l=(u,c,p)=>{var y;let g=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),m=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),f=La(c.ease),C=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,b=c.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let P of Object.keys(c)){if(h.has(P))continue;let j=c[P];typeof j=="number"&&v.push({key:P,from:Ta(u,P),to:j})}let w=nn(u,c);return{target:u,startMs:gt(),delayMs:m,durationMs:g,ease:f,props:v,scaleFrom:w.from,scaleTo:w.to,repeat:C,yoyo:b,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(u,c){let p=l(u,c);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=gt())},resume:()=>{var f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:gt(),m=gt()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,c,p){return d.set(u,c),d.to(u,p)},set(u,c){if(!u||!c)return;for(let g of Object.keys(c)){let m=c[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&en(u,g,m)}let p=nn(u,c);p.to&&tn(u,p.to)},killTweensOf(u){let c=e.get(u);if(c)for(let p of Array.from(c))r(p)},timeline(u={}){let c=[],p=0,g=!1,m=[],f=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let v=typeof h=="string"?h.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},C=h=>{c.push(h);let v=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+v)},b={to(h,v,w){return C({kind:"to",target:h,vars:v,atMs:f(w)}),b},fromTo(h,v,w,y){return C({kind:"fromTo",target:h,vars:w,from:v,atMs:f(y)}),b},play(){var h,v;if(g)return b;g=!0,m=[];for(let w of c)w.kind==="fromTo"&&d.set(w.target,(h=w.from)!=null?h:{}),m.push(d.to(w.target,{...w.vars,delay:w.atMs/1e3+((v=w.vars.delay)!=null?v:0)}));return b},pause(){for(let h of m)h.pause();return b},kill(){for(let h of m)h.kill();m=[],g=!1}};return u.paused||b.play(),b}};return d}function sn(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=an()}catch{}}var rn={name:"handler-playable-sdk",version:"1.0.8",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var Z=0,Ia=Z++,on=Z++,ln=Z++,cn=Z++,dn=Z++,pn=Z++,un=Z++,gn=Z++,hn=Z++,fn=Z++,mn=Z++,bn=Z++,O=Ia;function yn(){return O===on}function vn(){return O===ln}function wn(){return O===cn}function xn(){return O===dn}function Ge(){return O===pn}function Ue(){return O===un}function Sn(){return O===gn}function En(){return O===hn}function Cn(){return O===fn}function ci(){return O===mn}function di(){return O===bn}function An(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),O=on;return}catch{}else if(i==="dapi")try{dapi.isReady(),O=ln;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(O=cn)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(O=dn)}catch{}else if(e==="mintegral")window.gameReady&&(O=pn);else if(e==="tapjoy")window.TJ_API&&(O=un);else if(e==="tiktok")window.openAppStore&&(O=gn);else if(e==="smadex")try{window.smxTracking&&(O=hn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(O=fn)}catch{}else e==="vungle"?O=mn:(i==="nucleo"||e==="nucleo")&&(O=bn)}var Ot=ri(require("lottie-web"),1),Ln=Ot.default;typeof window!="undefined"&&(window.lottie=Ot.default,window.__baseLottie=Ot.default);gi();function D(i,e){let t=(a,s)=>s===0?a:t(s,a%s),n=t(i,e);return`${i/n}:${e/n}`}var Sr=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:D(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:D(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:D(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:D(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:D(360,780)}],Er=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:D(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:D(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:D(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:D(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:D(412,915)}],Cr=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:D(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:D(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:D(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:D(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:D(800,1280)}],In=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:D(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:D(768,1024),mraidScale:.7}];var Ar=[...In];var Da=In[0];ae();function Ha(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Na(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Fa(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function hi(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await Ha(a),r=await Fa(s),o=Na(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(t=r==null?void 0:r.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Rt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((c,p)=>{let g=new Image;g.onload=()=>c(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let s=a.getImageData(0,0,n.width,n.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let p=r[c],g=r[c+1],m=r[c+2],f=!1;for(let C of l)if(Math.sqrt(Math.pow(p-C.r,2)+Math.pow(g-C.g,2)+Math.pow(m-C.b,2))<e){f=!0;break}f&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var _n=require("@google/genai");async function fi(i,e,t=[],n={}){var a,s,r,o,l,d,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let h=t[b];if(!h.base64||!h.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${h.mimeType}`)}let c=new _n.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,h)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await c.models.generateContent({model:p,contents:g}),f="",C=(r=(s=(a=m.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(C)for(let b of C)b.text&&(f+=b.text);if(!f.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${f.length}`),f}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=c.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var On=require("@google/genai");async function zt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new On.GoogleGenAI({apiKey:i}),s=[{text:e}];t.length>0&&t.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");ht();ae();var Nn=require("pixi.js");var Ka=require("pixi.js");ae();function ss(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function rs(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function os(i){return`
47
47
  Analyze these screenshots of a brand or game and extract its "Brand DNA".
48
48
 
49
49
  Provide a concise summary (2-3 sentences) covering:
@@ -1 +1 @@
1
- (function(_0x297e0f,_0x48f9f7){var a0_0x5e2a1a={_0x1f1493:0x2d0,_0x41077e:'Y67H',_0xfe6ad4:0x2d6,_0x5f2a4d:0x2d3,_0x1108c5:0x2d7,_0x2d604f:'WV9D',_0x5e2f1b:'CY(r',_0x3820a6:0x1d7,_0x46ef79:0x1e5,_0xbbb2f3:0x1e6,_0x139b5e:0x1e7,_0x546fdc:0x2b6,_0x2cf0ee:0x2ca,_0x427639:0x2cf,_0x5e3dc4:0x2c5,_0x53798d:0x2d5,_0x4b1ea1:0x2d6,_0xe0df69:'LUUf',_0xe30218:0x2dc,_0x4e8147:'Osmt',_0x3d3f84:0x1c8,_0x1499db:0x1de,_0x55dbf5:0x246,_0x204502:0x251,_0x5e8698:0x256,_0x19bfc8:0x251,_0xdd1b34:'T!wq',_0x226c75:0x2d7,_0x589a0b:0x2cc,_0x43afd5:0x2c9,_0x31f569:0x2d4,_0x7d05b1:'hS([',_0x4884b0:0x1c2,_0x3154a2:0x1d0,_0x3c85b6:0x22f,_0xe80f5c:0x248,_0x416331:0x239,_0x522b3b:0x239,_0x26f214:'wvlT',_0x5dcc21:0x2cd,_0x21a618:0x2c6,_0x3953b6:'k1bE',_0xc7dd97:0x2bf,_0x1de9e3:0x2d4,_0x8e444d:0x2c1,_0x479554:'&gLk',_0x3277c4:0x2c4},a0_0x3e59eb={_0x31104f:0x31e},a0_0x57d41e={_0xa93cc:0x2a9};function _0x570478(_0x1d2879,_0x191ee0,_0x3dbcd2,_0x444979,_0x4526a0){return a0_0x3630(_0x191ee0- -a0_0x57d41e._0xa93cc,_0x1d2879);}function _0x9e31f3(_0x3e8b81,_0x439741,_0xb33b0d,_0x36b1d0,_0x69d045){return a0_0x3630(_0x69d045-0x1f6,_0x36b1d0);}var _0x1e4206=_0x297e0f();function _0x3c1d9e(_0x49a717,_0x189510,_0x49bbbb,_0x5c3d6e,_0x46f65a){return a0_0x3630(_0x5c3d6e- -a0_0x3e59eb._0x31104f,_0x46f65a);}while(!![]){try{var _0x5a189f=-parseInt(_0x9e31f3(0x2e1,a0_0x5e2a1a._0x1f1493,0x2e1,a0_0x5e2a1a._0x41077e,a0_0x5e2a1a._0xfe6ad4))/(-0x95*0x2e+0x1*-0x1bcc+0x3693)*(-parseInt(_0x9e31f3(a0_0x5e2a1a._0x5f2a4d,0x2d0,a0_0x5e2a1a._0x1108c5,a0_0x5e2a1a._0x2d604f,0x2e1))/(-0x11ab+-0x5*-0x275+0x564))+-parseInt(_0x570478(a0_0x5e2a1a._0x5e2f1b,-a0_0x5e2a1a._0x3820a6,-a0_0x5e2a1a._0x46ef79,-a0_0x5e2a1a._0xbbb2f3,-a0_0x5e2a1a._0x139b5e))/(-0x70c+-0x2f*0xc+0x1*0x943)*(parseInt(_0x9e31f3(a0_0x5e2a1a._0x546fdc,a0_0x5e2a1a._0x2cf0ee,a0_0x5e2a1a._0x427639,'a4EV',a0_0x5e2a1a._0x5e3dc4))/(0x1*-0x1789+-0xe2c+0x14d*0x1d))+parseInt(_0x9e31f3(a0_0x5e2a1a._0x53798d,0x2d5,a0_0x5e2a1a._0x4b1ea1,a0_0x5e2a1a._0xe0df69,a0_0x5e2a1a._0xe30218))/(-0x1de6+0x4*0x223+-0x155f*-0x1)*(-parseInt(_0x570478(a0_0x5e2a1a._0x4e8147,-0x1d9,-a0_0x5e2a1a._0x3d3f84,-0x1cb,-a0_0x5e2a1a._0x1499db))/(0x3*0x50c+0x2*-0xbcf+0x880))+-parseInt(_0x3c1d9e(-a0_0x5e2a1a._0x55dbf5,-a0_0x5e2a1a._0x204502,-a0_0x5e2a1a._0x5e8698,-a0_0x5e2a1a._0x19bfc8,a0_0x5e2a1a._0xdd1b34))/(-0x1b4f+-0x61*-0x1+0x1af5)+-parseInt(_0x9e31f3(a0_0x5e2a1a._0x226c75,a0_0x5e2a1a._0x589a0b,a0_0x5e2a1a._0x43afd5,'d1Ay',a0_0x5e2a1a._0x31f569))/(0x61d+-0x24df*-0x1+-0x2af4)+parseInt(_0x570478(a0_0x5e2a1a._0x7d05b1,-a0_0x5e2a1a._0x4884b0,-0x1c5,-a0_0x5e2a1a._0x3d3f84,-a0_0x5e2a1a._0x3154a2))/(0x157a+-0xb56+-0xa1b)*(parseInt(_0x3c1d9e(-a0_0x5e2a1a._0x3c85b6,-a0_0x5e2a1a._0xe80f5c,-a0_0x5e2a1a._0x416331,-a0_0x5e2a1a._0x522b3b,a0_0x5e2a1a._0x26f214))/(0x1743+-0x289*-0xb+-0x331c))+-parseInt(_0x9e31f3(a0_0x5e2a1a._0x5dcc21,a0_0x5e2a1a._0x21a618,0x2c2,a0_0x5e2a1a._0x3953b6,0x2d2))/(-0x4*0x7a7+-0x1*-0x25b1+-0x70a)*(-parseInt(_0x9e31f3(a0_0x5e2a1a._0xc7dd97,a0_0x5e2a1a._0x1de9e3,a0_0x5e2a1a._0x8e444d,a0_0x5e2a1a._0x479554,a0_0x5e2a1a._0x3277c4))/(-0x2*0xb9b+0xb08+0xa*0x139));if(_0x5a189f===_0x48f9f7)break;else _0x1e4206['push'](_0x1e4206['shift']());}catch(_0x18f6e9){_0x1e4206['push'](_0x1e4206['shift']());}}}(a0_0x510a,-0x1128cd+0x6875e+0x140315));var a0_0x150817=(function(){var _0x1697a5=!![];return function(_0x1cf477,_0x4dbbff){var _0x1c6b3f=_0x1697a5?function(){if(_0x4dbbff){var _0x57f6ff=_0x4dbbff['apply'](_0x1cf477,arguments);return _0x4dbbff=null,_0x57f6ff;}}:function(){};return _0x1697a5=![],_0x1c6b3f;};}()),a0_0x1dc304=a0_0x150817(this,function(){var a0_0x7d23c9={_0x447091:'GXUS',_0x11a600:0x31b,_0x3d61f8:0x30d,_0x2f5b1c:0x31a,_0x11ff0e:0x10f,_0x582059:0x10d,_0x396c3b:0x10e,_0x13b1b3:0x107,_0x10e932:'r1p9',_0x485346:0x466,_0x2eb0fb:0x46d,_0x48d330:0x458,_0x2651d6:0x31e,_0x1dd6d0:'&gLk',_0x57500c:0x31e,_0x58da85:0x31c,_0x40d39f:'wvlT',_0xc529f7:0x315,_0x4fbac6:0x30f,_0x3ffedc:0x324,_0x418180:'%SVu',_0x4d4d4b:0x316,_0x49f108:'Osmt',_0x5b5a35:0x467,_0x58af8c:0x46e,_0x5db9e2:0x466,_0x47745a:0x471,_0x372236:0x311,_0x2eeb96:0x322,_0x3100bf:'d1Ay',_0x1766ba:0x31c,_0x4378a8:0x322,_0x25773b:0xfe,_0x32b8e6:0xfb,_0xf95ba3:0xfd,_0x279283:'i^iX'},a0_0x1cc044={_0x52f70d:0x1e4},_0x3159ad={};function _0x4d5ac3(_0x19892d,_0x56d4c1,_0x5563fa,_0x34e92f,_0x4e7c66){return a0_0x3630(_0x5563fa- -a0_0x1cc044._0x52f70d,_0x4e7c66);}function _0x3e1021(_0x597232,_0x11fe11,_0x4edb03,_0x4a15d3,_0x4b69d8){return a0_0x3630(_0x11fe11-0x37e,_0x597232);}_0x3159ad[_0x3140a1(0x314,a0_0x7d23c9._0x447091,a0_0x7d23c9._0x11a600,a0_0x7d23c9._0x3d61f8,a0_0x7d23c9._0x2f5b1c)]=_0x4d5ac3(-a0_0x7d23c9._0x11ff0e,-a0_0x7d23c9._0x582059,-a0_0x7d23c9._0x396c3b,-a0_0x7d23c9._0x13b1b3,'M]IU')+_0x3e1021(a0_0x7d23c9._0x10e932,a0_0x7d23c9._0x485346,a0_0x7d23c9._0x2eb0fb,a0_0x7d23c9._0x48d330,0x470)+'+$';function _0x3140a1(_0x2940d1,_0x1ebdfb,_0x3b250b,_0x48320e,_0x5098a1){return a0_0x3630(_0x3b250b-0x238,_0x1ebdfb);}var _0x3f617a=_0x3159ad;return a0_0x1dc304[_0x3140a1(a0_0x7d23c9._0x2651d6,a0_0x7d23c9._0x1dd6d0,0x312,0x301,a0_0x7d23c9._0x57500c)+'ing']()['searc'+'h'](_0x3140a1(a0_0x7d23c9._0x58da85,a0_0x7d23c9._0x40d39f,a0_0x7d23c9._0xc529f7,a0_0x7d23c9._0x4fbac6,a0_0x7d23c9._0x3ffedc)+')+)+)'+'+$')['toStr'+_0x3140a1(0x317,a0_0x7d23c9._0x418180,0x309,0x30a,a0_0x7d23c9._0x4d4d4b)]()[_0x3e1021(a0_0x7d23c9._0x49f108,a0_0x7d23c9._0x5b5a35,a0_0x7d23c9._0x58af8c,a0_0x7d23c9._0x5db9e2,a0_0x7d23c9._0x47745a)+_0x3140a1(0x31f,'Y67H',a0_0x7d23c9._0x2f5b1c,a0_0x7d23c9._0x372236,0x314)+'r'](a0_0x1dc304)[_0x3140a1(a0_0x7d23c9._0x2eeb96,a0_0x7d23c9._0x3100bf,a0_0x7d23c9._0x1766ba,a0_0x7d23c9._0x4378a8,a0_0x7d23c9._0x3ffedc)+'h'](_0x3f617a[_0x4d5ac3(-a0_0x7d23c9._0x25773b,-a0_0x7d23c9._0x32b8e6,-0xfa,-a0_0x7d23c9._0xf95ba3,a0_0x7d23c9._0x279283)]);});a0_0x1dc304();function a0_0x3630(_0x12f676,_0x1e647f){_0x12f676=_0x12f676-(-0x13*0x15+0x5+0x1*0x257);var _0x3364f2=a0_0x510a();var _0x340331=_0x3364f2[_0x12f676];if(a0_0x3630['rvpJzc']===undefined){var _0xeba1bc=function(_0x1e997a){var _0x5633cc='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x4286a9='',_0x3d5fa8='',_0x44df8a=_0x4286a9+_0xeba1bc;for(var _0x422b39=-0xaec+-0x175f+0x224b,_0x12dd09,_0x4a4416,_0x357f34=-0x11f0*0x1+0x1c15*0x1+-0xa25*0x1;_0x4a4416=_0x1e997a['charAt'](_0x357f34++);~_0x4a4416&&(_0x12dd09=_0x422b39%(-0x1369*-0x1+0x1*-0x260+0x1*-0x1105)?_0x12dd09*(0x8fb*-0x3+0xd5*0x1b+0x4ba)+_0x4a4416:_0x4a4416,_0x422b39++%(-0x2c7*0x9+-0xa*0x2ce+-0x350f*-0x1))?_0x4286a9+=_0x44df8a['charCodeAt'](_0x357f34+(0x116*0x5+-0x238e+0x1e2a))-(-0x1*0x2657+0x4*0x271+0x1c9d)!==0xebb+-0x23a7+0x19c*0xd?String['fromCharCode'](-0x1d3b*-0x1+0xdc8+0xa81*-0x4&_0x12dd09>>(-(-0x2237*0x1+-0x1*-0x446+0x2b9*0xb)*_0x422b39&0x2*0xdb4+-0x1da9+0x247)):_0x422b39:-0xa0c+0x14*-0x18b+0x28e8){_0x4a4416=_0x5633cc['indexOf'](_0x4a4416);}for(var _0x40e26d=-0x25e+-0x20+-0x1d*-0x16,_0x3bb3d3=_0x4286a9['length'];_0x40e26d<_0x3bb3d3;_0x40e26d++){_0x3d5fa8+='%'+('00'+_0x4286a9['charCodeAt'](_0x40e26d)['toString'](0x71*-0x3b+0xc*-0x262+0x36b3))['slice'](-(0x56e+0x2d7*-0xd+0x1f7f*0x1));}return decodeURIComponent(_0x3d5fa8);};var _0x3a1e72=function(_0xf8a7ec,_0xe5b9c9){var _0x30264f=[],_0x16c56b=0x1*-0x1369+0xf*-0x275+0x4*0xe11,_0x5c29fa,_0x81f5a5='';_0xf8a7ec=_0xeba1bc(_0xf8a7ec);var _0x2efbc3;for(_0x2efbc3=0x515*0x1+0x1a6*-0x1+-0x36f;_0x2efbc3<-0x312+0x1d98*0x1+-0x1986;_0x2efbc3++){_0x30264f[_0x2efbc3]=_0x2efbc3;}for(_0x2efbc3=-0x26a3+-0x1eb5*0x1+-0x13d*-0x38;_0x2efbc3<-0xf59+0x1*0x189e+0x1*-0x845;_0x2efbc3++){_0x16c56b=(_0x16c56b+_0x30264f[_0x2efbc3]+_0xe5b9c9['charCodeAt'](_0x2efbc3%_0xe5b9c9['length']))%(0x2593+-0x1751+-0xd42),_0x5c29fa=_0x30264f[_0x2efbc3],_0x30264f[_0x2efbc3]=_0x30264f[_0x16c56b],_0x30264f[_0x16c56b]=_0x5c29fa;}_0x2efbc3=0x120e+-0x22*-0x113+0x4*-0xda5,_0x16c56b=0x32*-0x24+-0x1c6*0x1+0x467*0x2;for(var _0x372624=-0x2*-0x1215+-0x8*-0x209+0x62*-0x89;_0x372624<_0xf8a7ec['length'];_0x372624++){_0x2efbc3=(_0x2efbc3+(0x33b*-0x7+0x1f17+0x1*-0x879))%(0x4*-0x97+0x1*0x38f+0x11*-0x3),_0x16c56b=(_0x16c56b+_0x30264f[_0x2efbc3])%(-0xce1+0x181f+-0x3*0x36a),_0x5c29fa=_0x30264f[_0x2efbc3],_0x30264f[_0x2efbc3]=_0x30264f[_0x16c56b],_0x30264f[_0x16c56b]=_0x5c29fa,_0x81f5a5+=String['fromCharCode'](_0xf8a7ec['charCodeAt'](_0x372624)^_0x30264f[(_0x30264f[_0x2efbc3]+_0x30264f[_0x16c56b])%(-0x26e0+0x86c+0x16e*0x16)]);}return _0x81f5a5;};a0_0x3630['yqhZaA']=_0x3a1e72,a0_0x3630['OkMKsL']={},a0_0x3630['rvpJzc']=!![];}var _0x30deb5=_0x3364f2[-0x5*-0x4dc+0x1c0*-0x4+-0x114c],_0x526e8a=_0x12f676+_0x30deb5,_0xb32ba3=a0_0x3630['OkMKsL'][_0x526e8a];if(!_0xb32ba3){if(a0_0x3630['nWWOrf']===undefined){var _0x5cb11c=function(_0x28c603){this['uLvNoI']=_0x28c603,this['RrwmCN']=[-0xf7*-0x13+0x214c+-0x33a0,-0x74b*-0x1+0x628*0x4+0x1*-0x1feb,-0x165b*-0x1+-0x1bd7+0x57c],this['csYXsL']=function(){return'newState';},this['HMIpNA']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['ihoBll']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x5cb11c['prototype']['LDtDie']=function(){var _0x51600c=new RegExp(this['HMIpNA']+this['ihoBll']),_0xa711d7=_0x51600c['test'](this['csYXsL']['toString']())?--this['RrwmCN'][0x2210+0x1*0x151f+0x3f1*-0xe]:--this['RrwmCN'][0xa30+-0x95*0x2e+0x1*0x1096];return this['vrFYJL'](_0xa711d7);},_0x5cb11c['prototype']['vrFYJL']=function(_0x2f1e13){if(!Boolean(~_0x2f1e13))return _0x2f1e13;return this['paPnVw'](this['uLvNoI']);},_0x5cb11c['prototype']['paPnVw']=function(_0x49e613){for(var _0x21dae3=-0x2*0xa1f+-0x1*0x11ab+0x25e9,_0x19ff02=this['RrwmCN']['length'];_0x21dae3<_0x19ff02;_0x21dae3++){this['RrwmCN']['push'](Math['round'](Math['random']())),_0x19ff02=this['RrwmCN']['length'];}return _0x49e613(this['RrwmCN'][-0x70c+-0x2f*0xc+0x4*0x250]);},new _0x5cb11c(a0_0x3630)['LDtDie'](),a0_0x3630['nWWOrf']=!![];}_0x340331=a0_0x3630['yqhZaA'](_0x340331,_0x1e647f),a0_0x3630['OkMKsL'][_0x526e8a]=_0x340331;}else _0x340331=_0xb32ba3;return _0x340331;}function a0_0x510a(){var _0x536eac=['nvfX','fs0+WRBcSvCWiSoj','WPLJuSkdkKnFiCkhCZugWP4','gxmBlbicWP1rWOi','tu/dOKhdQmkAbW','A2vDhcK','mZWyrCkcW5ddICkfva','WRJdVuddV0qQyLOWWPfP','nt1NzSkcW5ddVCkv','W77cOYFcUq4','n8kYW57cQtJdHCk+oxldHMBdHq','WOZcVNFdSCoLW4uox8oAWQxcHSo9jq','W58VWPFcQHq','W5ZcHKHSBcnPW5pdRCkMW4ZdKNO','g3eyF3f2WRLGWOn5tCkb','WQFcJdXZW4FcJ8kI','W7BcRuLylCo1W6m2W4LxW4m','W6dcUaHEW6m','WPZdUColWODM','WPFdKbaSpW','W4yYWO3cThNdRMpcTmo4sa','uSkiWReYW5NcKtGW','q8oSWRXBW6HKnmkxW6ivW6O','gSoyWO7dKGS','WOlcMIa2W78','kurYWO3dRG','Cf3dSubzk2hdL8k7WRRcNJG','CmknW6VdJdZcKZddQmokbZ7dVqq','dSoOBmkDW5a6g8kbk8ka','bmoLaGVcHCkAtmoHW6/cNmo5gSou','WRVdUulcRY0RDey5','WPNcTSoFyZmWv8kSW6hdKNe','W5ldGNT0WRNcOGbltSkBdLa'];a0_0x510a=function(){return _0x536eac;};return a0_0x510a();}import{A as a0_0x365126,B as a0_0x2a0abf,C as a0_0xe11dcb,D as a0_0x39f838,b as a0_0x4a8efc,c as a0_0x341c20,d as a0_0x5512ba,e as a0_0x17ff28,f as a0_0x2b5114,g as a0_0x59838c,h as a0_0x39da8e,i as a0_0x3b6682,j as a0_0x3a7296,k as a0_0x3e1ddd,l as a0_0x39ffd4,m as a0_0x35e3d9,n as a0_0x2dad4d,o as a0_0x5c5a8e,p as a0_0x5f292b,q as a0_0x460b8a,r as a0_0x555339,s as a0_0x40ad9b,t as a0_0x2bf127,u as a0_0x53cf07,v as a0_0x1ca713,w as a0_0x5abc69,x as a0_0x5b9a53,y as a0_0x632708,z as a0_0x87ee7}from'../chunk-E7F4FEN4.js';import{a as a0_0xa35e6a,b as a0_0x24563b,c as a0_0x3e9e33,d as a0_0xbccb42,e as a0_0x497da1}from'../chunk-I5OOVR5U.js';import'../chunk-PW2FGMCO.js';import'../chunk-HVKF2KYL.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0xa35e6a as AssetCache,a0_0x3e9e33 as AssetLoader,a0_0x53cf07 as AssetSystem,a0_0xbccb42 as AssetTextures,a0_0x40ad9b as Assets,a0_0x5c5a8e as BaseSystem,a0_0x2dad4d as GameEngine,a0_0x17ff28 as GameObject,a0_0x2b5114 as GameObjectManager,a0_0x35e3d9 as ObjectFactory,a0_0x5512ba as Renderer,a0_0x5f292b as RuntimeObjectRegistry,a0_0x341c20 as Transform,a0_0x2a0abf as applyScreenAnchor,a0_0x460b8a as basePixi,a0_0x5abc69 as clearResponsiveElements,a0_0x4a8efc as createPixiBase,a0_0x3a7296 as getRegisteredFontIds,a0_0x1ca713 as globalResponsiveMultipliers,a0_0x497da1 as initAssetTextures,a0_0x2bf127 as initAssets,a0_0xe11dcb as layout,a0_0x39ffd4 as playLottieOverlay,a0_0x3b6682 as registerFont,a0_0x24563b as registerType,a0_0x632708 as resolveAnchorVec2,a0_0x59838c as resolveFont,a0_0x39da8e as resolveFontWeight,a0_0x87ee7 as resolveScreenAnchorPoint,a0_0x365126 as resolveScreenRatioPoint,a0_0x39f838 as runInitSequence,a0_0x3e1ddd as setLottieInstance,a0_0x555339 as spawnSceneFromConfig,a0_0x5b9a53 as updateScreenState};
1
+ (function(_0x33deaf,_0x259cc1){var a0_0x568400={_0x37ce9f:'TG55',_0x3b2acb:0x230,_0x26f083:0x228,_0x134ad2:0x23a,_0x2eeef5:0x22b,_0x4a6b4f:'9nyD',_0x2f9946:0x219,_0x2f4f4b:0x215,_0x40d851:'!06s',_0x4dc447:0x226,_0x7f6fd2:0x222,_0x4ac485:0x229,_0x11f3be:'Ma]P',_0x381192:0x222,_0x234fa2:0x214,_0x199649:0x21c,_0x5a72df:0x55c,_0x2e66c9:0x55a,_0x484675:0x568,_0x4e7361:0x561,_0x91bb01:'E%e@',_0x4b3961:0x545,_0x4517fb:0x546,_0xcf7889:0x537,_0x11547f:'J[Xl',_0x6b6b14:0x234,_0xba04b4:0x227,_0x4a082e:0x22a,_0x22e70e:0x554,_0x10998d:0x54c,_0x572df4:0x548,_0x233ddd:'J[Xl',_0x40c6af:'M^cZ',_0x19e13a:0x4a6,_0xfb42d:0x4ba,_0x43a78e:0x4b4,_0x22efe5:0x559,_0x1b4cfb:'H(u('},a0_0x28a00a={_0x3d6207:0x39c},a0_0x563b5d={_0x10512b:0x2ff};function _0x38c4d8(_0x50b6a2,_0x49256b,_0x52721f,_0x5405b6,_0x449994){return a0_0x21a0(_0x52721f- -0x3e0,_0x49256b);}function _0x3b6add(_0x4f87ba,_0x176f4d,_0x4beb7f,_0x55192d,_0x4d8e27){return a0_0x21a0(_0x4d8e27-a0_0x563b5d._0x10512b,_0x4f87ba);}function _0x3af02e(_0x48b685,_0x270b7c,_0x6c1cd4,_0x1ffff5,_0x20f644){return a0_0x21a0(_0x48b685-a0_0x28a00a._0x3d6207,_0x20f644);}var _0x2037fc=_0x33deaf();while(!![]){try{var _0x563a44=parseInt(_0x38c4d8(-0x229,a0_0x568400._0x37ce9f,-a0_0x568400._0x3b2acb,-a0_0x568400._0x26f083,-a0_0x568400._0x134ad2))/(-0x935*0x1+-0x2b*-0x6b+-0x8c3)+-parseInt(_0x38c4d8(-a0_0x568400._0x2eeef5,a0_0x568400._0x4a6b4f,-0x21f,-a0_0x568400._0x2f9946,-a0_0x568400._0x2f4f4b))/(-0x599*-0x2+0xa4d*-0x2+-0x96a*-0x1)+-parseInt(_0x38c4d8(-0x232,a0_0x568400._0x40d851,-a0_0x568400._0x4dc447,-a0_0x568400._0x7f6fd2,-a0_0x568400._0x4ac485))/(-0x12d4+-0x7ff*-0x1+-0x2b6*-0x4)*(parseInt(_0x38c4d8(-0x219,a0_0x568400._0x11f3be,-a0_0x568400._0x381192,-a0_0x568400._0x234fa2,-a0_0x568400._0x199649))/(-0xc0b*0x1+-0x119b*0x1+0x1daa))+-parseInt(_0x3af02e(a0_0x568400._0x5a72df,a0_0x568400._0x2e66c9,a0_0x568400._0x484675,a0_0x568400._0x4e7361,a0_0x568400._0x91bb01))/(0x914+-0xc*-0x1d+-0xa6b)*(parseInt(_0x3af02e(a0_0x568400._0x4b3961,0x538,a0_0x568400._0x4517fb,a0_0x568400._0xcf7889,'LXSW'))/(0x2f*0x38+-0x1c7f+0xcb*0x17))+-parseInt(_0x38c4d8(-0x22a,a0_0x568400._0x11547f,-a0_0x568400._0x6b6b14,-a0_0x568400._0xba04b4,-a0_0x568400._0x4a082e))/(0x1594+0x31*-0x31+-0x52*0x26)+parseInt(_0x3af02e(a0_0x568400._0x22e70e,a0_0x568400._0x10998d,a0_0x568400._0x10998d,a0_0x568400._0x572df4,a0_0x568400._0x233ddd))/(-0x2595+0xa5+0x24f8)+-parseInt(_0x3b6add(a0_0x568400._0x40c6af,0x4b0,a0_0x568400._0x19e13a,a0_0x568400._0xfb42d,a0_0x568400._0x43a78e))/(0x51e+-0x25a+-0x2bb*0x1)*(-parseInt(_0x3af02e(0x54f,0x542,a0_0x568400._0x22efe5,0x557,a0_0x568400._0x1b4cfb))/(0x3*0x637+0x1*0x26e6+-0x3981));if(_0x563a44===_0x259cc1)break;else _0x2037fc['push'](_0x2037fc['shift']());}catch(_0x1558e8){_0x2037fc['push'](_0x2037fc['shift']());}}}(a0_0x4664,-0x4a964+-0xa2a*0x107+0x178814));var a0_0x4379ac=(function(){var a0_0x4189cd={_0x220bad:0x551,_0x26ddb6:0x55b},_0x276b4d=!![];return function(_0x3a01bb,_0x1fb514){var a0_0x4b0e65={_0x116a73:0x3a2},_0x53017e=_0x276b4d?function(){function _0x10867c(_0x300d7a,_0x5482c5,_0x29b6fe,_0x41d9cf,_0x331df9){return a0_0x21a0(_0x41d9cf-a0_0x4b0e65._0x116a73,_0x5482c5);}if(_0x1fb514){var _0x5b186b=_0x1fb514[_0x10867c(0x540,'LXSW',a0_0x4189cd._0x220bad,0x54d,a0_0x4189cd._0x26ddb6)](_0x3a01bb,arguments);return _0x1fb514=null,_0x5b186b;}}:function(){};return _0x276b4d=![],_0x53017e;};}()),a0_0x3f382c=a0_0x4379ac(this,function(){var a0_0x4d8ff6={_0x363f66:0x42,_0x13aed5:0x39,_0x4e443a:'J[Xl',_0x18e411:0x71,_0x51ea96:0x72,_0x40c29f:0x7f,_0xba9f8f:0x6f,_0x4ed20d:0xf8,_0x194a2e:0xf7,_0x56b9d7:0x107,_0x53b248:0x38,_0x2ca78b:'mUT#',_0x24d3b8:0x36,_0x34144b:0x101,_0x4a66f3:0xf6,_0x1860d6:0xfa,_0x3834c1:0xf5,_0x2260bb:'t^gh',_0x137ce4:0x5a,_0x82ddd:0x52,_0xa72f8b:'4&2m',_0x863a6d:0x3b,_0x514099:0x41,_0x25445e:0x29,_0xbbb593:'@zk#',_0x473b8b:0x36,_0x2fc931:0x32,_0x5b63af:'!06s',_0x49ccdc:0x36,_0x5264ce:0x34,_0x46ef24:0x42,_0x2f7a35:0xef,_0x10691b:0xeb,_0x5c58da:'Ql%P'},a0_0x146802={_0xf86660:0x152},a0_0x3c6968={_0x3385d3:0x17e},_0x545760={};_0x545760[_0x4ff6cf(0x40,'9nyD',a0_0x4d8ff6._0x363f66,a0_0x4d8ff6._0x13aed5,0x43)]=_0x5ae6f5(a0_0x4d8ff6._0x4e443a,a0_0x4d8ff6._0x18e411,a0_0x4d8ff6._0x51ea96,a0_0x4d8ff6._0x40c29f,a0_0x4d8ff6._0xba9f8f)+')+)+)'+'+$';function _0x4ff6cf(_0x110541,_0x4b6645,_0x295a54,_0x51ca5b,_0x46c870){return a0_0x21a0(_0x51ca5b- -a0_0x3c6968._0x3385d3,_0x4b6645);}function _0x121d59(_0x3f0fcc,_0x19fb02,_0x23a91e,_0x40be73,_0x3c2a9d){return a0_0x21a0(_0x23a91e- -0xc3,_0x3c2a9d);}function _0x5ae6f5(_0x59d205,_0x2271ec,_0x277abe,_0x98a57c,_0x34adb6){return a0_0x21a0(_0x2271ec- -a0_0x146802._0xf86660,_0x59d205);}var _0x39d2cd=_0x545760;return a0_0x3f382c[_0x121d59(a0_0x4d8ff6._0x4ed20d,a0_0x4d8ff6._0x194a2e,0xff,a0_0x4d8ff6._0x56b9d7,'2rjq')+_0x4ff6cf(a0_0x4d8ff6._0x53b248,a0_0x4d8ff6._0x2ca78b,0x46,0x38,a0_0x4d8ff6._0x24d3b8)]()[_0x121d59(a0_0x4d8ff6._0x34144b,a0_0x4d8ff6._0x4a66f3,a0_0x4d8ff6._0x1860d6,a0_0x4d8ff6._0x3834c1,a0_0x4d8ff6._0x2260bb)+'h'](_0x39d2cd[_0x5ae6f5('Kl2!',0x5d,0x5a,a0_0x4d8ff6._0x137ce4,a0_0x4d8ff6._0x82ddd)])[_0x4ff6cf(0x38,a0_0x4d8ff6._0xa72f8b,a0_0x4d8ff6._0x13aed5,a0_0x4d8ff6._0x863a6d,a0_0x4d8ff6._0x514099)+_0x4ff6cf(a0_0x4d8ff6._0x25445e,a0_0x4d8ff6._0xbbb593,0x2e,a0_0x4d8ff6._0x473b8b,0x42)]()['const'+'ructo'+'r'](a0_0x3f382c)[_0x4ff6cf(a0_0x4d8ff6._0x2fc931,a0_0x4d8ff6._0x5b63af,a0_0x4d8ff6._0x49ccdc,a0_0x4d8ff6._0x5264ce,a0_0x4d8ff6._0x46ef24)+'h'](_0x39d2cd[_0x121d59(a0_0x4d8ff6._0x4ed20d,a0_0x4d8ff6._0x2f7a35,a0_0x4d8ff6._0x10691b,0xf6,a0_0x4d8ff6._0x5c58da)]);});a0_0x3f382c();function a0_0x21a0(_0x20fde2,_0x1a336b){_0x20fde2=_0x20fde2-(-0xa03+0x4*-0x5bf+-0x4*-0x8aa);var _0x55f6d6=a0_0x4664();var _0x24f429=_0x55f6d6[_0x20fde2];if(a0_0x21a0['GyfPps']===undefined){var _0x594192=function(_0xd4b3ea){var _0x56f14e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x1af2dd='',_0x14b408='',_0x3c3c92=_0x1af2dd+_0x594192;for(var _0xce8c66=0x10f*-0x10+0x2*-0x1c6+0x147c,_0x3bbc3a,_0x467337,_0x210d5c=0x2372*0x1+0x1d2d+0x47*-0xe9;_0x467337=_0xd4b3ea['charAt'](_0x210d5c++);~_0x467337&&(_0x3bbc3a=_0xce8c66%(0x1b78+-0xae3+-0x1091)?_0x3bbc3a*(-0x1d64+-0x166f+0x3413)+_0x467337:_0x467337,_0xce8c66++%(0x153b+-0x115c*0x2+0xd81))?_0x1af2dd+=_0x3c3c92['charCodeAt'](_0x210d5c+(-0x1d*0xa7+0x1681*-0x1+0x2976))-(0x7f0+-0xa*-0x14d+-0x14e8)!==0x903+-0x92d*-0x1+0x61*-0x30?String['fromCharCode'](0xc7c+-0x5f0+-0x1d*0x31&_0x3bbc3a>>(-(-0x267b+-0x96+0x2713)*_0xce8c66&-0x20d7+0xfab*0x1+-0x1*-0x1132)):_0xce8c66:-0x14*0x124+0xfa6+0x395*0x2){_0x467337=_0x56f14e['indexOf'](_0x467337);}for(var _0x58e0d7=-0x4*0x36d+0x1f4c+-0x233*0x8,_0x50ca6e=_0x1af2dd['length'];_0x58e0d7<_0x50ca6e;_0x58e0d7++){_0x14b408+='%'+('00'+_0x1af2dd['charCodeAt'](_0x58e0d7)['toString'](0x648+-0x1be*-0x13+0x13a9*-0x2))['slice'](-(-0x1*0x59f+0x7*-0x4e8+0x27f9));}return decodeURIComponent(_0x14b408);};var _0x315986=function(_0x4a05f0,_0x243d41){var _0x3d96fd=[],_0x3f2d79=0x11de+-0x26cd+-0xe9*-0x17,_0x4a8ad4,_0x3f7ced='';_0x4a05f0=_0x594192(_0x4a05f0);var _0x1090ec;for(_0x1090ec=0xe9*0x22+-0x1*0x1c27+-0x2cb;_0x1090ec<-0x1*0x189+0x11b*0x1+-0x16e*-0x1;_0x1090ec++){_0x3d96fd[_0x1090ec]=_0x1090ec;}for(_0x1090ec=0x1*-0xef7+-0x1ef+0x10e6;_0x1090ec<-0x266*0x1+-0xe3a+0x11a0;_0x1090ec++){_0x3f2d79=(_0x3f2d79+_0x3d96fd[_0x1090ec]+_0x243d41['charCodeAt'](_0x1090ec%_0x243d41['length']))%(-0x6f1+-0x1f*0x110+0x82d*0x5),_0x4a8ad4=_0x3d96fd[_0x1090ec],_0x3d96fd[_0x1090ec]=_0x3d96fd[_0x3f2d79],_0x3d96fd[_0x3f2d79]=_0x4a8ad4;}_0x1090ec=0x1f*0xf8+0x84e+-0x2656,_0x3f2d79=-0x9*0x3e+-0x19e0+-0x2*-0xe07;for(var _0x1d1ef1=0x1635+-0x1547+-0x77*0x2;_0x1d1ef1<_0x4a05f0['length'];_0x1d1ef1++){_0x1090ec=(_0x1090ec+(0x8*-0x1a6+0x2350+-0x7*0x329))%(-0xac7+-0x1*0x19f9+0x25c0),_0x3f2d79=(_0x3f2d79+_0x3d96fd[_0x1090ec])%(-0x1abc+0x1*-0x10e1+0x2c9d),_0x4a8ad4=_0x3d96fd[_0x1090ec],_0x3d96fd[_0x1090ec]=_0x3d96fd[_0x3f2d79],_0x3d96fd[_0x3f2d79]=_0x4a8ad4,_0x3f7ced+=String['fromCharCode'](_0x4a05f0['charCodeAt'](_0x1d1ef1)^_0x3d96fd[(_0x3d96fd[_0x1090ec]+_0x3d96fd[_0x3f2d79])%(0xf6b*-0x1+-0x2030+-0x17*-0x21d)]);}return _0x3f7ced;};a0_0x21a0['JVSwWe']=_0x315986,a0_0x21a0['SUMpEI']={},a0_0x21a0['GyfPps']=!![];}var _0xfe0fd9=_0x55f6d6[-0x2b*-0xf+0x11de*-0x1+0xf59],_0x28135c=_0x20fde2+_0xfe0fd9,_0x3ac4de=a0_0x21a0['SUMpEI'][_0x28135c];if(!_0x3ac4de){if(a0_0x21a0['QMyheh']===undefined){var _0x30791b=function(_0x4bbfc0){this['zCPFQJ']=_0x4bbfc0,this['IoYEyA']=[0x3*-0x16d+0x1e9b+-0x1a53,0x2217+0x15c4+-0x37db*0x1,0x17fc+-0x14*-0x112+0x46*-0xa6],this['OpjBAn']=function(){return'newState';},this['wzkhMA']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['lTSTFM']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x30791b['prototype']['XLyflA']=function(){var _0x15fb72=new RegExp(this['wzkhMA']+this['lTSTFM']),_0x26add7=_0x15fb72['test'](this['OpjBAn']['toString']())?--this['IoYEyA'][-0x2*-0x1102+-0x2*-0x5dd+-0x2dbd*0x1]:--this['IoYEyA'][-0x935*0x1+-0x2b*-0x6b+-0x8c4];return this['GmJkvN'](_0x26add7);},_0x30791b['prototype']['GmJkvN']=function(_0x35eede){if(!Boolean(~_0x35eede))return _0x35eede;return this['teJQgQ'](this['zCPFQJ']);},_0x30791b['prototype']['teJQgQ']=function(_0x2cd139){for(var _0x250bf0=-0x599*-0x2+0xa4d*-0x2+-0x968*-0x1,_0xaf9353=this['IoYEyA']['length'];_0x250bf0<_0xaf9353;_0x250bf0++){this['IoYEyA']['push'](Math['round'](Math['random']())),_0xaf9353=this['IoYEyA']['length'];}return _0x2cd139(this['IoYEyA'][-0x12d4+-0x7ff*-0x1+-0x3b*-0x2f]);},new _0x30791b(a0_0x21a0)['XLyflA'](),a0_0x21a0['QMyheh']=!![];}_0x24f429=a0_0x21a0['JVSwWe'](_0x24f429,_0x1a336b),a0_0x21a0['SUMpEI'][_0x28135c]=_0x24f429;}else _0x24f429=_0x3ac4de;return _0x24f429;}import{A as a0_0x5464f,B as a0_0x126a43,C as a0_0x12c0bf,D as a0_0x3a292c,b as a0_0x111c59,c as a0_0x55759e,d as a0_0xd53616,e as a0_0x59da35,f as a0_0x4bf41f,g as a0_0x2ff429,h as a0_0x2f4a15,i as a0_0x18800e,j as a0_0x2dd127,k as a0_0x31098d,l as a0_0x3d7937,m as a0_0x24d66b,n as a0_0x433099,o as a0_0x55c29a,p as a0_0x35c1b6,q as a0_0x3fc026,r as a0_0x1d6c81,s as a0_0x2d54af,t as a0_0x387a74,u as a0_0x3a540d,v as a0_0xaec34e,w as a0_0x70c34,x as a0_0x2cc23e,y as a0_0x1e5330,z as a0_0x38068a}from'../chunk-KSV5LSLN.js';import{a as a0_0x18bbfb,b as a0_0x889832,c as a0_0x218e6a,d as a0_0x2736f3,e as a0_0x77d53c}from'../chunk-I5OOVR5U.js';import'../chunk-PW2FGMCO.js';function a0_0x4664(){var _0x5779b8=['gCksW50XWQTMWPOGkw/dImkT','gmouWOnTW6qyWQW','WQxdSMqSaa','W5WWEKyhWOvCk8oKmG','W5ykbSkUW4XNWRFcQbFcLtO5','WRNdPNCAW5xcHSoUW7jwWQZcM8kt','nby2CspcHmkBW7uHFqxdQa','AHvRWR4F','oSkOEfrM','WOGRW5ldNSornwG','aCkIW4L1W4XxW5VdU8kmW7xdO8k+W58','W58jW7BdL8oq','j8kXyKT7dwxcO33cNLz5WRG','mSoqWPHIm8o8W48zW4zta8kxqa','rmkBWR7dS2K','WO9ItdSF','W5ZcQh/cQaj1W7xcQGZcKhldTW','mb8abCk3W4ddKW','DWj5W7xdOa','WPFcPeD3WQ5zxhO','sc1X','W6DenSk0zSkwfSk3W5FcV0Hija','BYmZ','u1vLb28','i8k0AeT1cgxcJudcKvf5WQq','W7evWQWIWR0','nXvXW6JdTw7dIa'];a0_0x4664=function(){return _0x5779b8;};return a0_0x4664();}import'../chunk-HVKF2KYL.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x18bbfb as AssetCache,a0_0x218e6a as AssetLoader,a0_0x3a540d as AssetSystem,a0_0x2736f3 as AssetTextures,a0_0x2d54af as Assets,a0_0x55c29a as BaseSystem,a0_0x433099 as GameEngine,a0_0x59da35 as GameObject,a0_0x4bf41f as GameObjectManager,a0_0x24d66b as ObjectFactory,a0_0xd53616 as Renderer,a0_0x35c1b6 as RuntimeObjectRegistry,a0_0x55759e as Transform,a0_0x126a43 as applyScreenAnchor,a0_0x3fc026 as basePixi,a0_0x70c34 as clearResponsiveElements,a0_0x111c59 as createPixiBase,a0_0x2dd127 as getRegisteredFontIds,a0_0xaec34e as globalResponsiveMultipliers,a0_0x77d53c as initAssetTextures,a0_0x387a74 as initAssets,a0_0x12c0bf as layout,a0_0x3d7937 as playLottieOverlay,a0_0x18800e as registerFont,a0_0x889832 as registerType,a0_0x1e5330 as resolveAnchorVec2,a0_0x2ff429 as resolveFont,a0_0x2f4a15 as resolveFontWeight,a0_0x38068a as resolveScreenAnchorPoint,a0_0x5464f as resolveScreenRatioPoint,a0_0x3a292c as runInitSequence,a0_0x31098d as setLottieInstance,a0_0x1d6c81 as spawnSceneFromConfig,a0_0x2cc23e as updateScreenState};
@@ -43,7 +43,7 @@
43
43
  <button class="debug-btn primary" data-modal-apply>Apply</button>
44
44
  </div>
45
45
  </div>
46
- `,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var el={};ca(el,{AspectClass:()=>$n,GameObject:()=>ct,GameObjectManager:()=>Ht,Renderer:()=>lt,ResponsiveUISystem:()=>qe,Transform:()=>ot,animateHandClick:()=>Ss,animatePanelEntrance:()=>Es,createBrushTexture:()=>_s,createEndGamePanel:()=>xs,createHandTutorial:()=>Cs,createThreeBase:()=>ys,createTutorialLabel:()=>As,getAspectClass:()=>$t,getRegisteredFontIds:()=>ws,loadAsset:()=>Nn,loadCharacterFrames:()=>Ps,registerFont:()=>vs,resolveFont:()=>Q,resolveFontWeight:()=>ee,updateHandAnimation:()=>Ts});module.exports=Sr(el);var W=ge(require("three"),1);var he={};function yt(t,e,n=!1){he[t]||(he[t]=[]),he[t].push({fn:e,once:n})}function Jt(t,e){if(he[t]){if(!e){delete he[t];return}he[t]=he[t].filter(n=>n.fn!==e)}}function vt(t,...e){let n=he[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Jt(t,i.fn)}function B(t,e){yt(t,e,!0)}var _=null,V=[],Ie=null;function ga(t){_=t,V=[],Ie!==null&&(clearTimeout(Ie),Ie=null)}function ha(){var t,e,n;return{endpoint:(_==null?void 0:_.endpoint)||"",transport:(_==null?void 0:_.transport)||"beacon",batchSize:(t=_==null?void 0:_.batchSize)!=null?t:10,flushIntervalMs:(e=_==null?void 0:_.flushIntervalMs)!=null?e:300,maxQueue:(n=_==null?void 0:_.maxQueue)!=null?n:200,debug:!!(_!=null&&_.debug)}}async function pa(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Zt(t,e){let n=ha();if(e&&n.endpoint){if(V.push(t),V.length>n.maxQueue&&(V=V.slice(V.length-n.maxQueue)),V.length>=n.batchSize){ua();return}Ie===null&&(Ie=window.setTimeout(()=>{Ie=null,ua()},n.flushIntervalMs))}}async function ua(){let t=ha();if(!t.endpoint||V.length===0)return;let e=V.splice(0,t.batchSize);await pa(t.endpoint,{events:e},t.transport,t.debug),V.length>0&&await pa(t.endpoint,{events:V.splice(0,t.batchSize)},t.transport,t.debug)}function ma(t){return Math.max(0,Math.min(1,t))}function Cr(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Xe(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ar(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function fa(t,e,n){try{t[e]=n}catch{}}function Tr(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ba(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function ya(t,e){let n=Tr(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function va(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=Xe();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,w=ma(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;w=ma(E)}let m=u.ease(w);u.yoyo&&y%2===1&&(m=1-m);for(let E of u.props)fa(u.target,E.key,E.from+(E.to-E.from)*m);u.scaleFrom&&u.scaleTo&&ba(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*m,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*m});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Cr(c.ease),w=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),m=[];for(let S of Object.keys(c)){if(y.has(S))continue;let C=c[S];typeof C=="number"&&m.push({key:S,from:Ar(p,S),to:C})}let f=ya(p,c);return{target:p,startMs:Xe(),delayMs:b,durationMs:u,ease:h,props:m,scaleFrom:f.from,scaleTo:f.to,repeat:w,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Xe())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Xe(),b=Xe()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&fa(p,u,b)}let g=ya(p,c);g.to&&ba(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let m=typeof y=="string"?y.trim():"";return m.startsWith("+=")?g+Math.max(0,Number(m.slice(2))*1e3||0):m?Math.max(0,Number(m)*1e3||0):g},w=y=>{c.push(y);let m=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+m)},v={to(y,m,f){return w({kind:"to",target:y,vars:m,atMs:h(f)}),v},fromTo(y,m,f,E){return w({kind:"fromTo",target:y,vars:f,from:m,atMs:h(E)}),v},play(){var y,m;if(u)return v;u=!0,b=[];for(let f of c)f.kind==="fromTo"&&d.set(f.target,(y=f.from)!=null?y:{}),b.push(d.to(f.target,{...f.vars,delay:f.atMs/1e3+((m=f.vars.delay)!=null?m:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function wa(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=va()}catch{}}var xa={name:"handler-playable-sdk",version:"1.0.6",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var G=0,kr=G++,Ea=G++,Sa=G++,Ca=G++,Aa=G++,Ta=G++,La=G++,ka=G++,Pa=G++,_a=G++,Ma=G++,Ia=G++,T=kr;function ja(){return T===Ea}function Oa(){return T===Sa}function Ra(){return T===Ca}function za(){return T===Aa}function je(){return T===Ta}function Oe(){return T===La}function $a(){return T===ka}function Ha(){return T===Pa}function Da(){return T===_a}function Qt(){return T===Ma}function en(){return T===Ia}function Na(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=Ea;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=Sa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=Ca)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Aa)}catch{}else if(e==="mintegral")window.gameReady&&(T=Ta);else if(e==="tapjoy")window.TJ_API&&(T=La);else if(e==="tiktok")window.openAppStore&&(T=ka);else if(e==="smadex")try{window.smxTracking&&(T=Pa)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=Ma:(t==="nucleo"||e==="nucleo")&&(T=Ia)}var wt=ge(require("lottie-web"),1),Fa=wt.default;typeof window!="undefined"&&(window.lottie=wt.default,window.__baseLottie=wt.default);var Pr=require("pixi.js");var tn=require("pixi.js");var _r=null;function nn(t){_r=t}xt();an();var Ke=require("pixi.js");xt();var zr=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",ln=zr;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(ln=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${ln}`))}}catch{}function $r(t){var n,i,a,s,r;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(t);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(t))return{x:(n=t[0])!=null?n:.5,y:(i=t[1])!=null?i:.5};if(t&&typeof t=="object"&&"x"in t&&"y"in t)return{x:(a=t.x)!=null?a:.5,y:(s=t.y)!=null?s:.5};if(typeof t=="string"){let o=t.trim().toLowerCase();return(r=e[o])!=null?r:{x:.5,y:.5}}return null}var fe=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${ln}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ke.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Ce.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ke.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r instanceof Ke.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],w=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),w=!0;break}}catch{continue}w||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o;if(!(!n||!e)&&(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor)){let l=$r(n.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var Je=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Nr=ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Nr);Ze();var St=require("pixi.js");Ze();var dn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Je}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await fe.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await fe.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Br=new dn,Gr=new Proxy(Br,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Ze();var qa=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},At={scale:1,position:1},un=[];function Vr(t,e,n,i,a,s,r){un.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function Wr(){un.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function pn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),At.scale=le.scaleFactor,At.position=1,console.log(`[SCREEN] Global multipliers - scale: ${At.scale.toFixed(3)}`),Wr()}var ze={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}};function Yr(t,e,n){let i=ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Xr(){return ze}var Kr={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function Ct(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function et(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Ct(t[0],e.x),y:Ct(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Ct(i.x,e.x),y:Ct(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Kr[i])!=null?n:e}return e}function gn(t,e,n,i={}){var u,b,h,w,v,y;let a=et(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((w=s.right)!=null?w:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function hn(t,e,n,i={}){var h,w,v,y,m,f;let a=(h=i.inset)!=null?h:{},s=(w=i.padding)!=null?w:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((m=a.top)!=null?m:0)+s.y,d=((f=a.bottom)!=null?f:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=et(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,pn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),pn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Yr,window.getDebugConfig=Xr,window.copyConfig=oo,window.applyConfig=Qe,window.applyConfigForRatio=lo,window.positionAtBottom=Va,window.positionAtTop=Qr,window.positionAtCenter=eo,window.positionAtLeft=to,window.positionAtRight=no,window.positionAtBottomLeft=io,window.positionAtBottomRight=ao,window.positionAtTopLeft=so,window.positionAtTopRight=ro,window.applyPositionContract=Zr,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Tt(t,e,n=0){return t*e+n}function Lt(t,e,n=0){return t*(1-e)+n}function kt(t,e,n=0){return t*e+n}function Pt(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Jr(t,e){return t*e}function Zr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,w,v,y,m,f,E,S,C,P,I;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Tt(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),s=Lt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=kt(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),s=U(n,(v=(w=i.offset)==null?void 0:w.y)!=null?v:0);break;case"right":a=Pt(e,i.percent,(m=(y=i.offset)==null?void 0:y.x)!=null?m:0),s=U(n,(E=(f=i.offset)==null?void 0:f.y)!=null?E:0);break;case"center":a=U(e,(C=(S=i.offset)==null?void 0:S.x)!=null?C:0),s=U(n,(I=(P=i.offset)==null?void 0:P.y)!=null?I:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function Va(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Jr(n,i),l=Lt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!un.find(p=>p.element===t)&&Vr(t,Va,e,n,i,a,s)}function Qr(t,e,n,i=.1,a=1){ce(t,U(e),Tt(n,i)),de(t,a)}function eo(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function to(t,e,n,i=.1,a=1){ce(t,kt(e,i),U(n)),de(t,a)}function no(t,e,n,i=.1,a=1){ce(t,Pt(e,i),U(n)),de(t,a)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,kt(e,a),Lt(n,i)),de(t,s)}function ao(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),Lt(n,i)),de(t,s)}function so(t,e,n,i=.05,a=.05,s=1){ce(t,kt(e,a),Tt(n,i)),de(t,s)}function ro(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),Tt(n,i)),de(t,s)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ae={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function oo(t){return t&&Ae[t]?JSON.parse(JSON.stringify(Ae[t])):JSON.parse(JSON.stringify(ze))}function Qe(t){Object.keys(t).forEach(e=>{let n=e;ze[n]&&t[n]&&Object.assign(ze[n],t[n])}),console.log("Config applied:",t)}function lo(t,e){let n=t/e;n>1.6?(Qe(Ae.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Qe(Ae.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Qe(Ae.square),console.log("Applied SQUARE config for ratio:",n)):(Qe(Ae.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ae,t.resolveAnchorVec2=t.resolveAnchorVec2||et,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||gn,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||hn}bn();function M(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Vc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:M(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:M(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:M(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:M(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:M(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:M(360,780)}],Wc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:M(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:M(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:M(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:M(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:M(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:M(412,915)}],Yc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:M(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:M(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:M(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:M(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:M(800,1280)}],Ka=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:M(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:M(768,1024),mraidScale:.7}];var Xc=[...Ka];var bo=Ka[0];J();function yo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function vo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function wo(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function yn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await yo(a),r=await wo(s),o=vo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function _t(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let w of l)if(Math.sqrt(Math.pow(g-w.r,2)+Math.pow(u-w.g,2)+Math.pow(b-w.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Qa=require("@google/genai");async function vn(t,e,n=[],i={}){var a,s,r,o,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Qa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",w=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(w)for(let v of w)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var es=require("@google/genai");async function Mt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new es.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var xo=require("pixi.js");Ze();J();var ns=require("pixi.js");var So=require("pixi.js");J();function jo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Oo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function Ro(t){return`
46
+ `,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var el={};ca(el,{AspectClass:()=>$n,GameObject:()=>ct,GameObjectManager:()=>Ht,Renderer:()=>lt,ResponsiveUISystem:()=>qe,Transform:()=>ot,animateHandClick:()=>Ss,animatePanelEntrance:()=>Es,createBrushTexture:()=>_s,createEndGamePanel:()=>xs,createHandTutorial:()=>Cs,createThreeBase:()=>ys,createTutorialLabel:()=>As,getAspectClass:()=>$t,getRegisteredFontIds:()=>ws,loadAsset:()=>Nn,loadCharacterFrames:()=>Ps,registerFont:()=>vs,resolveFont:()=>Q,resolveFontWeight:()=>ee,updateHandAnimation:()=>Ts});module.exports=Sr(el);var W=ge(require("three"),1);var he={};function yt(t,e,n=!1){he[t]||(he[t]=[]),he[t].push({fn:e,once:n})}function Jt(t,e){if(he[t]){if(!e){delete he[t];return}he[t]=he[t].filter(n=>n.fn!==e)}}function vt(t,...e){let n=he[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Jt(t,i.fn)}function B(t,e){yt(t,e,!0)}var _=null,V=[],Ie=null;function ga(t){_=t,V=[],Ie!==null&&(clearTimeout(Ie),Ie=null)}function ha(){var t,e,n;return{endpoint:(_==null?void 0:_.endpoint)||"",transport:(_==null?void 0:_.transport)||"beacon",batchSize:(t=_==null?void 0:_.batchSize)!=null?t:10,flushIntervalMs:(e=_==null?void 0:_.flushIntervalMs)!=null?e:300,maxQueue:(n=_==null?void 0:_.maxQueue)!=null?n:200,debug:!!(_!=null&&_.debug)}}async function pa(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Zt(t,e){let n=ha();if(e&&n.endpoint){if(V.push(t),V.length>n.maxQueue&&(V=V.slice(V.length-n.maxQueue)),V.length>=n.batchSize){ua();return}Ie===null&&(Ie=window.setTimeout(()=>{Ie=null,ua()},n.flushIntervalMs))}}async function ua(){let t=ha();if(!t.endpoint||V.length===0)return;let e=V.splice(0,t.batchSize);await pa(t.endpoint,{events:e},t.transport,t.debug),V.length>0&&await pa(t.endpoint,{events:V.splice(0,t.batchSize)},t.transport,t.debug)}function ma(t){return Math.max(0,Math.min(1,t))}function Cr(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Xe(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ar(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function fa(t,e,n){try{t[e]=n}catch{}}function Tr(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ba(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function ya(t,e){let n=Tr(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function va(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=Xe();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,w=ma(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;w=ma(E)}let m=u.ease(w);u.yoyo&&y%2===1&&(m=1-m);for(let E of u.props)fa(u.target,E.key,E.from+(E.to-E.from)*m);u.scaleFrom&&u.scaleTo&&ba(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*m,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*m});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Cr(c.ease),w=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),m=[];for(let S of Object.keys(c)){if(y.has(S))continue;let C=c[S];typeof C=="number"&&m.push({key:S,from:Ar(p,S),to:C})}let f=ya(p,c);return{target:p,startMs:Xe(),delayMs:b,durationMs:u,ease:h,props:m,scaleFrom:f.from,scaleTo:f.to,repeat:w,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Xe())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Xe(),b=Xe()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&fa(p,u,b)}let g=ya(p,c);g.to&&ba(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let m=typeof y=="string"?y.trim():"";return m.startsWith("+=")?g+Math.max(0,Number(m.slice(2))*1e3||0):m?Math.max(0,Number(m)*1e3||0):g},w=y=>{c.push(y);let m=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+m)},v={to(y,m,f){return w({kind:"to",target:y,vars:m,atMs:h(f)}),v},fromTo(y,m,f,E){return w({kind:"fromTo",target:y,vars:f,from:m,atMs:h(E)}),v},play(){var y,m;if(u)return v;u=!0,b=[];for(let f of c)f.kind==="fromTo"&&d.set(f.target,(y=f.from)!=null?y:{}),b.push(d.to(f.target,{...f.vars,delay:f.atMs/1e3+((m=f.vars.delay)!=null?m:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function wa(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=va()}catch{}}var xa={name:"handler-playable-sdk",version:"1.0.8",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web --external jszip && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var G=0,kr=G++,Ea=G++,Sa=G++,Ca=G++,Aa=G++,Ta=G++,La=G++,ka=G++,Pa=G++,_a=G++,Ma=G++,Ia=G++,T=kr;function ja(){return T===Ea}function Oa(){return T===Sa}function Ra(){return T===Ca}function za(){return T===Aa}function je(){return T===Ta}function Oe(){return T===La}function $a(){return T===ka}function Ha(){return T===Pa}function Da(){return T===_a}function Qt(){return T===Ma}function en(){return T===Ia}function Na(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=Ea;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=Sa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=Ca)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Aa)}catch{}else if(e==="mintegral")window.gameReady&&(T=Ta);else if(e==="tapjoy")window.TJ_API&&(T=La);else if(e==="tiktok")window.openAppStore&&(T=ka);else if(e==="smadex")try{window.smxTracking&&(T=Pa)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=Ma:(t==="nucleo"||e==="nucleo")&&(T=Ia)}var wt=ge(require("lottie-web"),1),Fa=wt.default;typeof window!="undefined"&&(window.lottie=wt.default,window.__baseLottie=wt.default);var Pr=require("pixi.js");var tn=require("pixi.js");var _r=null;function nn(t){_r=t}xt();an();var Ke=require("pixi.js");xt();var zr=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",ln=zr;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(ln=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${ln}`))}}catch{}function $r(t){var n,i,a,s,r;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(t);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(t))return{x:(n=t[0])!=null?n:.5,y:(i=t[1])!=null?i:.5};if(t&&typeof t=="object"&&"x"in t&&"y"in t)return{x:(a=t.x)!=null?a:.5,y:(s=t.y)!=null?s:.5};if(typeof t=="string"){let o=t.trim().toLowerCase();return(r=e[o])!=null?r:{x:.5,y:.5}}return null}var fe=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${ln}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ke.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Ce.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ke.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r instanceof Ke.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],w=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),w=!0;break}}catch{continue}w||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o;if(!(!n||!e)&&(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor)){let l=$r(n.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var Je=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var Nr=ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Nr);Ze();var St=require("pixi.js");Ze();var dn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Je}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await fe.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await fe.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},Br=new dn,Gr=new Proxy(Br,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Ze();var qa=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},At={scale:1,position:1},un=[];function Vr(t,e,n,i,a,s,r){un.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function Wr(){un.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function pn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),At.scale=le.scaleFactor,At.position=1,console.log(`[SCREEN] Global multipliers - scale: ${At.scale.toFixed(3)}`),Wr()}var ze={layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}};function Yr(t,e,n){let i=ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Xr(){return ze}var Kr={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function Ct(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function et(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Ct(t[0],e.x),y:Ct(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Ct(i.x,e.x),y:Ct(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Kr[i])!=null?n:e}return e}function gn(t,e,n,i={}){var u,b,h,w,v,y;let a=et(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((w=s.right)!=null?w:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function hn(t,e,n,i={}){var h,w,v,y,m,f;let a=(h=i.inset)!=null?h:{},s=(w=i.padding)!=null?w:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((m=a.top)!=null?m:0)+s.y,d=((f=a.bottom)!=null?f:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=et(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,pn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),pn(window.innerWidth,window.innerHeight),window.updateDebugConfig=Yr,window.getDebugConfig=Xr,window.copyConfig=oo,window.applyConfig=Qe,window.applyConfigForRatio=lo,window.positionAtBottom=Va,window.positionAtTop=Qr,window.positionAtCenter=eo,window.positionAtLeft=to,window.positionAtRight=no,window.positionAtBottomLeft=io,window.positionAtBottomRight=ao,window.positionAtTopLeft=so,window.positionAtTopRight=ro,window.applyPositionContract=Zr,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Tt(t,e,n=0){return t*e+n}function Lt(t,e,n=0){return t*(1-e)+n}function kt(t,e,n=0){return t*e+n}function Pt(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Jr(t,e){return t*e}function Zr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,w,v,y,m,f,E,S,C,P,I;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Tt(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),s=Lt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=kt(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),s=U(n,(v=(w=i.offset)==null?void 0:w.y)!=null?v:0);break;case"right":a=Pt(e,i.percent,(m=(y=i.offset)==null?void 0:y.x)!=null?m:0),s=U(n,(E=(f=i.offset)==null?void 0:f.y)!=null?E:0);break;case"center":a=U(e,(C=(S=i.offset)==null?void 0:S.x)!=null?C:0),s=U(n,(I=(P=i.offset)==null?void 0:P.y)!=null?I:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function Va(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Jr(n,i),l=Lt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!un.find(p=>p.element===t)&&Vr(t,Va,e,n,i,a,s)}function Qr(t,e,n,i=.1,a=1){ce(t,U(e),Tt(n,i)),de(t,a)}function eo(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function to(t,e,n,i=.1,a=1){ce(t,kt(e,i),U(n)),de(t,a)}function no(t,e,n,i=.1,a=1){ce(t,Pt(e,i),U(n)),de(t,a)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,kt(e,a),Lt(n,i)),de(t,s)}function ao(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),Lt(n,i)),de(t,s)}function so(t,e,n,i=.05,a=.05,s=1){ce(t,kt(e,a),Tt(n,i)),de(t,s)}function ro(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),Tt(n,i)),de(t,s)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ae={default:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1,screen_scale_y:1},engine:{scale:1,background_scale:1.05,background_offset_y:0,background_alpha:.98,label_pulse_speed:3,label_pulse_intensity:.03}},wide:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.9,screen_scale_y:1.1},engine:{scale:1,background_scale:1.1,background_offset_y:0,background_alpha:.95,label_pulse_speed:3,label_pulse_intensity:.03}},square:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:.85,screen_scale_y:.85},engine:{scale:1,background_scale:1,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}},tall:{layout:{scale_multiplier:1,position_offset:{x:0,y:0},debug_rect_visible:!0,debug_rect_color:16711680,debug_rect_thickness:4,debug_rect_scale_x:1,debug_rect_scale_y:1,screen_scale_x:1.1,screen_scale_y:.9},engine:{scale:1,background_scale:.95,background_offset_y:0,background_alpha:1,label_pulse_speed:3,label_pulse_intensity:.03}}};function oo(t){return t&&Ae[t]?JSON.parse(JSON.stringify(Ae[t])):JSON.parse(JSON.stringify(ze))}function Qe(t){Object.keys(t).forEach(e=>{let n=e;ze[n]&&t[n]&&Object.assign(ze[n],t[n])}),console.log("Config applied:",t)}function lo(t,e){let n=t/e;n>1.6?(Qe(Ae.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Qe(Ae.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Qe(Ae.square),console.log("Applied SQUARE config for ratio:",n)):(Qe(Ae.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ae,t.resolveAnchorVec2=t.resolveAnchorVec2||et,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||gn,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||hn}bn();function M(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Vc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:M(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:M(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:M(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:M(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:M(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:M(360,780)}],Wc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:M(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:M(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:M(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:M(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:M(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:M(412,915)}],Yc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:M(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:M(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:M(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:M(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:M(800,1280)}],Ka=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:M(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:M(768,1024),mraidScale:.7}];var Xc=[...Ka];var bo=Ka[0];J();function yo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function vo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function wo(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function yn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await yo(a),r=await wo(s),o=vo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function _t(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let w of l)if(Math.sqrt(Math.pow(g-w.r,2)+Math.pow(u-w.g,2)+Math.pow(b-w.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Qa=require("@google/genai");async function vn(t,e,n=[],i={}){var a,s,r,o,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Qa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",w=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(w)for(let v of w)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var es=require("@google/genai");async function Mt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new es.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var xo=require("pixi.js");Ze();J();var ns=require("pixi.js");var So=require("pixi.js");J();function jo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Oo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function Ro(t){return`
47
47
  Analyze these screenshots of a brand or game and extract its "Brand DNA".
48
48
 
49
49
  Provide a concise summary (2-3 sentences) covering: