handler-playable-sdk 1.0.58 → 1.0.59

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.
Files changed (39) hide show
  1. package/dist/{chunk-HALG3T22.js → chunk-KMXVYHSV.js} +82 -82
  2. package/dist/cli/brand-dna.mjs +1 -1
  3. package/dist/cli/canva-import.mjs +1 -1
  4. package/dist/cli/cleanup-assets.mjs +1 -1
  5. package/dist/cli/fix-scales.mjs +1 -1
  6. package/dist/cli/index.js +1 -1
  7. package/dist/cli/screen-helper.mjs +1 -1
  8. package/dist/cli/setup-library.mjs +1 -1
  9. package/dist/cli/student-helper/add-logic.mjs +1 -1
  10. package/dist/cli/student-helper/add-object.mjs +1 -1
  11. package/dist/cli/student-helper/arg-parsing.mjs +1 -1
  12. package/dist/cli/student-helper/asset-registry.mjs +1 -1
  13. package/dist/cli/student-helper/bullet-system.mjs +1 -1
  14. package/dist/cli/student-helper/collectable-system.mjs +1 -1
  15. package/dist/cli/student-helper/constants.mjs +1 -1
  16. package/dist/cli/student-helper/drag-snap-couples.mjs +1 -1
  17. package/dist/cli/student-helper/endgame-screen.mjs +1 -1
  18. package/dist/cli/student-helper/fs-io.mjs +1 -1
  19. package/dist/cli/student-helper/logic-defaults.mjs +1 -1
  20. package/dist/cli/student-helper/print-help.mjs +1 -1
  21. package/dist/cli/student-helper/prompts.mjs +1 -1
  22. package/dist/cli/student-helper/scratch-card.mjs +1 -1
  23. package/dist/cli/student-helper/screen-utils.mjs +1 -1
  24. package/dist/cli/student-helper/snippets.mjs +1 -1
  25. package/dist/cli/student-helper/start-screen.mjs +1 -1
  26. package/dist/cli/student-helper/swerve-collect.mjs +1 -1
  27. package/dist/cli/student-helper/tap-destroy.mjs +1 -1
  28. package/dist/cli/student-helper/template-packs.mjs +1 -1
  29. package/dist/cli/student-helper.mjs +1 -1
  30. package/dist/cli/sync-screens.mjs +1 -1
  31. package/dist/cli/validate-assets.mjs +1 -1
  32. package/dist/cli/validate.mjs +1 -1
  33. package/dist/index.cjs +3 -3
  34. package/dist/index.js +1 -1
  35. package/dist/pixi/index.cjs +1 -1
  36. package/dist/pixi/index.js +1 -1
  37. package/dist/three/index.cjs +1 -1
  38. package/dist/three/index.js +1 -1
  39. package/package.json +1 -1
@@ -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 l=o.target.dataset.tab;l&&this.switchTab(l)})});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 t=window.__openAiEditor;if(typeof t!="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}`,t(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 ur={};mi(ur,{AssetCache:()=>re,AssetLoader:()=>Pe,AssetSystem:()=>cn,AssetTextures:()=>Ie,Assets:()=>Ha,BaseSystem:()=>rt,GameEngine:()=>ln,GameObject:()=>Ot,GameObjectManager:()=>at,ObjectFactory:()=>ve,Renderer:()=>_t,RuntimeObjectRegistry:()=>ot,Transform:()=>jt,applyScreenAnchor:()=>Ft,basePixi:()=>za,clearResponsiveElements:()=>na,createPixiBase:()=>rn,getRegisteredFontIds:()=>ja,globalResponsiveMultipliers:()=>St,initAssetTextures:()=>Zt,initAssets:()=>Fa,layout:()=>aa,playLottieOverlay:()=>Oa,registerFont:()=>Ma,registerType:()=>Xt,resolveAnchorVec2:()=>fe,resolveFont:()=>Pa,resolveFontWeight:()=>Ia,resolveScreenAnchorPoint:()=>De,resolveScreenRatioPoint:()=>Ne,runInitSequence:()=>Ba,setLottieInstance:()=>Qt,spawnSceneFromConfig:()=>Da,updateScreenState:()=>Ht});module.exports=Ya(ur);var ka=require("pixi.js");var Te={};function zt(n,e,t=!1){Te[n]||(Te[n]=[]),Te[n].push({fn:e,once:t})}function pn(n,e){if(Te[n]){if(!e){delete Te[n];return}Te[n]=Te[n].filter(t=>t.fn!==e)}}function $t(n,...e){let t=Te[n];if(t)for(let i of[...t])i.fn(...e),i.once&&pn(n,i.fn)}function ee(n,e){zt(n,e,!0)}var $=null,ae=[],We=null;function vi(n){$=n,ae=[],We!==null&&(clearTimeout(We),We=null)}function wi(){var n,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(n=$==null?void 0:$.batchSize)!=null?n:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function bi(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(n,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(n,{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 un(n,e){let t=wi();if(e&&t.endpoint){if(ae.push(n),ae.length>t.maxQueue&&(ae=ae.slice(ae.length-t.maxQueue)),ae.length>=t.batchSize){yi();return}We===null&&(We=window.setTimeout(()=>{We=null,yi()},t.flushIntervalMs))}}async function yi(){let n=wi();if(!n.endpoint||ae.length===0)return;let e=ae.splice(0,n.batchSize);await bi(n.endpoint,{events:e},n.transport,n.debug),ae.length>0&&await bi(n.endpoint,{events:ae.splice(0,n.batchSize)},n.transport,n.debug)}function xi(n){return Math.max(0,Math.min(1,n))}function Ka(n){let e=String(n!=null?n:"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.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function wt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Xa(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function Si(n,e,t){try{n[e]=t}catch{}}function Ja(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function Ei(n,e){let t=n==null?void 0:n.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 Ci(n,e){let t=Ja(n);if(!t)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:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function Ai(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let d=(p=e.get(u.target))!=null?p:new Set;d.add(u),e.set(u.target,d),i()},s=u=>{n.delete(u);let d=e.get(u.target);d&&(d.delete(u),d.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var d,p;let u=wt();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let f=u-g.startMs-g.delayMs;if(f<0)continue;let m=g.durationMs>0?f/g.durationMs:1,C=xi(m),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(m),b-1):0;if(g.repeat>0&&m>=1){let x=m-h;C=xi(x)}let y=g.ease(C);g.yoyo&&h%2===1&&(y=1-y);for(let x of g.props)Si(g.target,x.key,x.from+(x.to-x.from)*y);g.scaleFrom&&g.scaleTo&&Ei(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*y,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*y});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(m>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},c=(u,d,p)=>{var x;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),f=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),m=Ka(d.ease),C=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),y=[];for(let P of Object.keys(d)){if(h.has(P))continue;let L=d[P];typeof L=="number"&&y.push({key:P,from:Xa(u,P),to:L})}let w=Ci(u,d);return{target:u,startMs:wt(),delayMs:f,durationMs:g,ease:m,props:y,scaleFrom:w.from,scaleTo:w.to,repeat:C,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(u,d){let p=c(u,d);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=wt())},resume:()=>{var m;if(!p.paused)return;let g=(m=p.pauseAtMs)!=null?m:wt(),f=wt()-g;p.startMs+=f,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,d,p){return l.set(u,d),l.to(u,p)},set(u,d){if(!u||!d)return;for(let g of Object.keys(d)){let f=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof f=="number"&&Si(u,g,f)}let p=Ci(u,d);p.to&&Ei(u,p.to)},killTweensOf(u){let d=e.get(u);if(d)for(let p of Array.from(d))r(p)},timeline(u={}){let d=[],p=0,g=!1,f=[],m=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let y=typeof h=="string"?h.trim():"";return y.startsWith("+=")?p+Math.max(0,Number(y.slice(2))*1e3||0):y?Math.max(0,Number(y)*1e3||0):p},C=h=>{d.push(h);let y=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+y)},b={to(h,y,w){return C({kind:"to",target:h,vars:y,atMs:m(w)}),b},fromTo(h,y,w,x){return C({kind:"fromTo",target:h,vars:w,from:y,atMs:m(x)}),b},play(){var h,y;if(g)return b;g=!0,f=[];for(let w of d)w.kind==="fromTo"&&l.set(w.target,(h=w.from)!=null?h:{}),f.push(l.to(w.target,{...w.vars,delay:w.atMs/1e3+((y=w.vars.delay)!=null?y:0)}));return b},pause(){for(let h of f)h.pause();return b},kill(){for(let h of f)h.kill();f=[],g=!1}};return u.paused||b.play(),b}};return l}function Li(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=Ai()}catch{}}var Ti={name:"handler-playable-sdk",version:"1.0.58",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/ && mkdir -p dist/cli/student-helper && cp src/cli/student-helper/*.mjs dist/cli/student-helper/ && chmod +x dist/cli/*.mjs dist/cli/student-helper/*.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 dist/cli/student-helper/*.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 te=0,Qa=te++,ki=te++,Pi=te++,Ii=te++,Mi=te++,ji=te++,_i=te++,Oi=te++,Ri=te++,zi=te++,$i=te++,Di=te++,j=Qa;function Ni(){return j===ki}function Hi(){return j===Pi}function Fi(){return j===Ii}function Bi(){return j===Mi}function Ye(){return j===ji}function Ke(){return j===_i}function Gi(){return j===Oi}function Ui(){return j===Ri}function qi(){return j===zi}function gn(){return j===$i}function hn(){return j===Di}function Vi(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),j=ki;return}catch{}else if(n==="dapi")try{dapi.isReady(),j=Pi;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(j=Ii)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(j=Mi)}catch{}else if(e==="mintegral")window.gameReady&&(j=ji);else if(e==="tapjoy")window.TJ_API&&(j=_i);else if(e==="tiktok")window.openAppStore&&(j=Oi);else if(e==="smadex")try{window.smxTracking&&(j=Ri)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(j=zi)}catch{}else e==="vungle"?j=$i:(n==="nucleo"||e==="nucleo")&&(j=Di)}var Dt=dn(require("lottie-web"),1),Wi=Dt.default;typeof window!="undefined"&&(window.lottie=Dt.default,window.__baseLottie=Dt.default);bn();function D(n,e){let t=(a,s)=>s===0?a:t(s,a%s),i=t(n,e);return`${n/i}:${e/i}`}var qr=[{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)}],Vr=[{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)}],Wr=[{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)}],Ji=[{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 Yr=[...Ji];var os=Ji[0];ce();var ta=require("pixi.js"),me={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},Bt=[];function ls(n,e,t,i,a,s,r){Bt.push({element:n,originalScale:s,positionHelper:e,heightPercent:a}),e(n,t,i,a,s,r,!1)}function cs(){Bt.forEach(({element:n,originalScale:e,positionHelper:t,heightPercent:i})=>{let a=e*me.scaleFactor;t(n,me.width,me.height,i,a,!0,!1)})}function na(){Bt.length=0,console.log("[LAYOUT] Cleared all responsive elements")}function Ht(n,e){console.log(`[SCREEN] updateScreenState called: ${n}x${e}`),me.width=n,me.height=e,me.scaleFactor=Math.min(n/me.designWidth,1.15),St.scale=me.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),cs()}var _={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 ds(n,e,t){let i=_[n];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${n}.${e} = ${t}`))}function ps(){return _}var us={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 Nt(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function fe(n,e={x:.5,y:.5}){var t;if(Array.isArray(n))return{x:Nt(n[0],e.x),y:Nt(n[1],e.y)};if(n&&typeof n=="object"){let i=n;return{x:Nt(i.x,e.x),y:Nt(i.y,e.y)}}if(typeof n=="string"){let i=n.trim().toLowerCase();return(t=us[i])!=null?t:e}return e}function De(n,e,t,i={}){var g,f,m,C,b,h;let a=fe(t),s=(g=i.inset)!=null?g:{},r=(f=i.padding)!=null?f:{x:0,y:0},o=((m=s.left)!=null?m:0)+r.x,c=((C=s.right)!=null?C:0)+r.x,l=((b=s.top)!=null?b:0)+r.y,u=((h=s.bottom)!=null?h:0)+r.y,d=Math.max(0,n-o-c),p=Math.max(0,e-l-u);return{x:o+d*a.x,y:l+p*a.y}}function Ne(n,e,t,i={}){var m,C,b,h,y,w;let a=(m=i.inset)!=null?m:{},s=(C=i.padding)!=null?C:{x:0,y:0},r=((b=a.left)!=null?b:0)+s.x,o=((h=a.right)!=null?h:0)+s.x,c=((y=a.top)!=null?y:0)+s.y,l=((w=a.bottom)!=null?w:0)+s.y,u=Math.max(0,n-r-o),d=Math.max(0,e-c-l),p=fe(t,{x:.5,y:.5}),g=Math.min(Math.max(p.x,0),1),f=Math.min(Math.max(p.y,0),1);return{x:r+u*g,y:c+d*f}}function Ft(n,e,t,i={}){var u,d,p;if(!n)return;let a=i.positionRatio?Ne(e,t,i.positionRatio,{inset:i.inset,padding:i.screenPadding}):De(e,t,i.anchor,{inset:i.inset,padding:i.screenPadding}),s=(u=i.offset)!=null?u:{x:0,y:0},r=a.x+s.x,o=a.y+s.y;n.anchor&&i.renderAnchor&&n.anchor.set(i.renderAnchor.x,i.renderAnchor.y),se(n,r,o);let c=(d=i.scale)!=null?d:1,l=(p=i.scaleMultiplier)!=null?p:1;(i.scale!==void 0||i.scaleMultiplier!==void 0)&&de(n,c*l)}if(typeof window!="undefined"){let n=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==n||a!==e)&&(n=i,e=a,Ht(i,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),Ht(window.innerWidth,window.innerHeight),window.updateDebugConfig=ds,window.getDebugConfig=ps,window.copyConfig=Es,window.applyConfig=xt,window.applyConfigForRatio=Cs,window.positionAtBottom=ia,window.positionAtTop=ms,window.positionAtCenter=fs,window.positionAtLeft=bs,window.positionAtRight=ys,window.positionAtBottomLeft=vs,window.positionAtBottomRight=ws,window.positionAtTopLeft=xs,window.positionAtTopRight=Ss,window.applyPositionContract=hs,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 Gt(n,e,t=0){return n*e+t}function Ut(n,e,t=0){return n*(1-e)+t}function qt(n,e,t=0){return n*e+t}function Vt(n,e,t=0){return n*(1-e)+t}function ne(n,e=0){return n/2+e}function gs(n,e){return n*e}function hs(n,e,t,i){var r,o,c,l,u,d,p,g,f,m,C,b,h,y,w,x,P,L,B,R;let a=0,s=0;switch(i.type){case"top":a=ne(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Gt(t,i.percent,(l=(c=i.offset)==null?void 0:c.y)!=null?l:0);break;case"bottom":a=ne(e,(d=(u=i.offset)==null?void 0:u.x)!=null?d:0),s=Ut(t,i.percent,(g=(p=i.offset)==null?void 0:p.y)!=null?g:0);break;case"left":a=qt(e,i.percent,(m=(f=i.offset)==null?void 0:f.x)!=null?m:0),s=ne(t,(b=(C=i.offset)==null?void 0:C.y)!=null?b:0);break;case"right":a=Vt(e,i.percent,(y=(h=i.offset)==null?void 0:h.x)!=null?y:0),s=ne(t,(x=(w=i.offset)==null?void 0:w.y)!=null?x:0);break;case"center":a=ne(e,(L=(P=i.offset)==null?void 0:P.x)!=null?L:0),s=ne(t,(R=(B=i.offset)==null?void 0:B.y)!=null?R:0);break}n.position?n.position.set(a,s):(n.x=a,n.y=s),i.scale!==void 0&&i.scale!==1&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(i.scale,i.scale):(n.scale.x=i.scale,n.scale.y=i.scale))}function ia(n,e,t,i=.2,a=1,s=!0,r=!1){let o=gs(t,i),c=Ut(t,i/2);se(n,ne(e),c);let l=s?a*me.scaleFactor:a;de(n,l),r&&!Bt.find(u=>u.element===n)&&ls(n,ia,e,t,i,a,s)}function ms(n,e,t,i=.1,a=1){se(n,ne(e),Gt(t,i)),de(n,a)}function fs(n,e,t,i=0,a=0,s=1){se(n,ne(e,i),ne(t,a)),de(n,s)}function bs(n,e,t,i=.1,a=1){se(n,qt(e,i),ne(t)),de(n,a)}function ys(n,e,t,i=.1,a=1){se(n,Vt(e,i),ne(t)),de(n,a)}function vs(n,e,t,i=.05,a=.05,s=1){se(n,qt(e,a),Ut(t,i)),de(n,s)}function ws(n,e,t,i=.05,a=.05,s=1){se(n,Vt(e,a),Ut(t,i)),de(n,s)}function xs(n,e,t,i=.05,a=.05,s=1){se(n,qt(e,a),Gt(t,i)),de(n,s)}function Ss(n,e,t,i=.05,a=.05,s=1){se(n,Vt(e,a),Gt(t,i)),de(n,s)}function se(n,e,t){n&&n.position?typeof n.position.set=="function"?n.position.set(e,t):(n.position.x=e,n.position.y=t):n&&(n.x=e,n.y=t)}function de(n,e){e!==1&&n&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(e,e):n.scale.x!==void 0&&n.scale.y!==void 0&&(n.scale.x=e,n.scale.y=e))}var $e={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 Es(n){return n&&$e[n]?JSON.parse(JSON.stringify($e[n])):JSON.parse(JSON.stringify(_))}function xt(n){Object.keys(n).forEach(e=>{let t=e;_[t]&&n[t]&&Object.assign(_[t],n[t])}),console.log("Config applied:",n)}function Cs(n,e){let t=n/e;t>1.6?(xt($e.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(xt($e.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(xt($e.square),console.log("Applied SQUARE config for ratio:",t)):(xt($e.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let n=window;n.configPresets=$e,n.resolveAnchorVec2=n.resolveAnchorVec2||fe,n.resolveScreenAnchorPoint=n.resolveScreenAnchorPoint||De,n.resolveScreenRatioPoint=n.resolveScreenRatioPoint||Ne}var K=null,ea=new Map;function aa(n,e,t,i,a,s={}){var Ee,Ce,Ae,Le,W,_e,lt,ct,dt,pt,ut,gt,ht,mt,ft,bt,F,Z,U,Q,Ue,Oe,Bn,Gn,Un,qn,Vn,Wn,Yn,Kn,Xn,Jn,Zn,Qn,ei,ti,ni,ii,ai,si,ri,oi,li,ci,di,pi,ui,gi,hi;let r=(Ee=s.enableDebugLogs)!=null?Ee:!1;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== STARTING LAYOUT CALCULATION ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Screen dimensions:",{width:i.width,height:i.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Time:",t),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Options:",s));let{mainContainer:o,label:c,background:l,backgroundTexture:u,app:d}=n;if(!d||!d.renderer){r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] \u274C No app or renderer, skipping layout");return}r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] App renderer dimensions:",{width:d.renderer.width,height:d.renderer.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] App screen dimensions:",{width:d.screen.width,height:d.screen.height}));let p=i.width,g=i.height;r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Base dimensions:",{baseWidth:p,baseHeight:g});let f=p*_.layout.screen_scale_x,m=g*_.layout.screen_scale_y,C=p/2,b=e.engine.runtime||{},h=b.layout||{};r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug config:",{screen_scale_x:_.layout.screen_scale_x,screen_scale_y:_.layout.screen_scale_y}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Calculated dimensions:",{width:f,height:m,midX:C}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Engine runtime:",b),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Layout config:",h));let y=m>f,w=(Ce=h.design_width_portrait)!=null?Ce:y?400:600,x=(Ae=h.design_height_portrait)!=null?Ae:y?600:400,P=Math.min(f/w,m/x);P=Math.min(P,1.15);let L=P*((Le=_.engine.scale)!=null?Le:1),B=(W=s.skipMainContainerTransform)!=null?W:!1;!B&&o&&o.scale&&(typeof o.scale.set=="function"?o.scale.set(L):(o.scale.x=L,o.scale.y=L));let R=(_e=h.main_container_anchor)!=null?_e:"center",H=(lt=h.main_container_position_ratio)!=null?lt:{x:.5,y:.5},z=(ct=h.main_container_offset)!=null?ct:{x:0,y:0},T=h.main_container_position_ratio?Ne(p,g,H):De(p,g,R),E=T.x+z.x+_.layout.position_offset.x,S=T.y+z.y+_.layout.position_offset.y;if(!B&&o&&o.position&&(typeof o.position.set=="function"?o.position.set(E,S):(o.position.x=E,o.position.y=S)),a&&(o!=null&&o.toLocal)){let G=g>p,Y=(dt=h.design_width_portrait)!=null?dt:G?320:480,N=(pt=h.design_height_portrait)!=null?pt:G?480:320;for(let[oe,le]of e.objects.entries()){let q=le==null?void 0:le.transform;if(!q||((ut=q.position_mode)!=null?ut:"static")!=="static")continue;let k=(gt=a.get)==null?void 0:gt.call(a,oe),yt=((ht=k==null?void 0:k.getDisplayObject)==null?void 0:ht.call(k))||(k==null?void 0:k.pixiObject)||k;if(!yt||yt.parent!==o)continue;let ge=(mt=q.anchor)!=null?mt:"bottom-left";ge==="bottom-left"&&q.anchor==null&&console.log("[DEBUG FALLBACK] LayoutManager transform.anchor \u2192 bottom-left");let qe=q.position_ratio!=null?Ne(Y,N,q.position_ratio):De(Y,N,ge),Ve=(ft=q.position)!=null?ft:{x:0,y:0},vt=qe.x-Y/2+Ve.x,Re=qe.y-N/2+Ve.y;typeof(k==null?void 0:k.setPosition)=="function"?k.setPosition(vt,Re):(se(yt,vt,Re),(bt=k==null?void 0:k.transform)!=null&&bt.position&&(k.transform.position.x=vt,k.transform.position.y=Re))}}let A=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,J=((A==null?void 0:A.buildMode)||(typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"dev"))==="dev";if(_.layout.debug_rect_visible&&J){(!K||K.parent!==d.stage)&&(K==null||K.destroy(),K=new ta.Graphics,K.zIndex=9999,d.stage.addChild(K)),K.clear();let G=_.layout.debug_rect_scale_x,Y=_.layout.debug_rect_scale_y,N=(p-4)*G,oe=(g-4)*Y,le=(p-N)/2,q=(g-oe)/2;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== DEBUG RECT POSITIONING ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect calculations:",{baseWidth:p,baseHeight:g,rectW:N,rectH:oe,offsetX:le,offsetY:q}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect final position:",{x:2+le,y:2+q,width:N,height:oe})),K.rect(2+le,2+q,N,oe).stroke({width:_.layout.debug_rect_thickness,color:_.layout.debug_rect_color})}else K&&(K.destroy(),K=null);let O=((F=n.label)==null?void 0:F.config)||e.objects.get("label_1")||e.objects.get("ui_tutorial_1");if(c&&c.position&&O){let G=(U=(Z=O==null?void 0:O.transform)==null?void 0:Z.anchor)!=null?U:"center",Y=(Q=O==null?void 0:O.transform)==null?void 0:Q.position_ratio,N=((Ue=O==null?void 0:O.transform)==null?void 0:Ue.offset)||{x:0,y:0};Ft(c,p,g,{anchor:G,positionRatio:Y,offset:{x:N.x*L,y:N.y*L},renderAnchor:fe(G)})}if(c&&c.alpha>0){let G=1+Math.sin(t*_.engine.label_pulse_speed)*_.engine.label_pulse_intensity,Y=(Bn=(Oe=O==null?void 0:O.transform)==null?void 0:Oe.scale)!=null?Bn:1,N=G*L*Y;c.scale&&(typeof c.scale.set=="function"?c.scale.set(N):(c.scale.x=N,c.scale.y=N))}r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== BACKGROUND POSITIONING =====");let ie=l?e.objects.get("background_1"):null,je=!!ie&&(l==null?void 0:l.parent)===o;if(l&&!je){r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background object exists:",!!l),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background type:",(Gn=l.constructor)==null?void 0:Gn.name)),l.alpha=((qn=(Un=b.background)==null?void 0:Un.alpha)!=null?qn:.98)*_.engine.background_alpha,r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background alpha set to:",l.alpha),r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background config:",ie);let G=(ie==null?void 0:ie.transform)||{};r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background transform:",G);let Y=G.offset||{x:0,y:0},N=((Wn=(Vn=b.background)==null?void 0:Vn.offset_y)!=null?Wn:0)+_.engine.background_offset_y,oe=(Yn=G.anchor)!=null?Yn:"center",le=G.position_ratio;if(r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background positioning params:",{bgOffset:Y,bgRuntimeOffsetY:N,bgScreenAnchor:oe,bgPositionRatio:le,baseWidth:p,baseHeight:g,finalScale:L}),Ft(l,p,g,{anchor:oe,positionRatio:le,offset:{x:Y.x*L,y:Y.y*L+N},renderAnchor:fe(oe)}),r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background position after applyScreenAnchor:",{x:l.x,y:l.y,scaleX:(Kn=l.scale)==null?void 0:Kn.x,scaleY:(Xn=l.scale)==null?void 0:Xn.y,anchorX:(Jn=l.anchor)==null?void 0:Jn.x,anchorY:(Zn=l.anchor)==null?void 0:Zn.y,pivotX:(Qn=l.pivot)==null?void 0:Qn.x,pivotY:(ei=l.pivot)==null?void 0:ei.y,width:l.width,height:l.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background texture dimensions:",{textureWidth:u==null?void 0:u.width,textureHeight:u==null?void 0:u.height})),u){let qe=Math.max(f/u.width,m/u.height),Ve=(ni=(ti=b.background)==null?void 0:ti.scale_multiplier)!=null?ni:1.05,vt=(ii=G.scale)!=null?ii:1,Re=qe*Ve*_.engine.background_scale*vt;l.scale&&(typeof l.scale.set=="function"?l.scale.set(Re):(l.scale.x=Re,l.scale.y=Re))}else l&&typeof l.clear=="function"&&(l.clear(),l.rect(-f/2,-m/2,f,m).fill({color:1444375}));let q=`${p}x${g}`,I=ea.get(q),k={x:Number((ai=l.x)!=null?ai:0),y:Number((si=l.y)!=null?si:0),scaleX:Number((oi=(ri=l.scale)==null?void 0:ri.x)!=null?oi:1),scaleY:Number((ci=(li=l.scale)==null?void 0:li.y)!=null?ci:1),rotation:Number.isFinite(l.rotation)?l.rotation:void 0,anchorX:Number.isFinite((di=l.anchor)==null?void 0:di.x)?l.anchor.x:void 0,anchorY:Number.isFinite((pi=l.anchor)==null?void 0:pi.y)?l.anchor.y:void 0,pivotX:Number.isFinite((ui=l.pivot)==null?void 0:ui.x)?l.pivot.x:void 0,pivotY:Number.isFinite((gi=l.pivot)==null?void 0:gi.y)?l.pivot.y:void 0},yt=Number.isFinite(k.x)&&Number.isFinite(k.y)&&Number.isFinite(k.scaleX)&&Number.isFinite(k.scaleY),ge=k;if(I){let qe=Math.hypot(k.x-I.x,k.y-I.y),Ve=Math.max(p,g)*.5;(!yt||qe>Ve)&&((hi=l.position)!=null&&hi.set?l.position.set(I.x,I.y):(l.x=I.x,l.y=I.y),l.scale&&(typeof l.scale.set=="function"?l.scale.set(I.scaleX,I.scaleY):(l.scale.x=I.scaleX,l.scale.y=I.scaleY)),Number.isFinite(I.rotation)&&typeof l.rotation=="number"&&(l.rotation=I.rotation),l.anchor&&Number.isFinite(I.anchorX)&&Number.isFinite(I.anchorY)&&l.anchor.set(I.anchorX,I.anchorY),l.pivot&&Number.isFinite(I.pivotX)&&Number.isFinite(I.pivotY)&&l.pivot.set(I.pivotX,I.pivotY),ge=I)}Number.isFinite(ge.x)&&Number.isFinite(ge.y)&&Number.isFinite(ge.scaleX)&&Number.isFinite(ge.scaleY)&&ea.set(q,ge)}}function As(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Ls(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Ts(n){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=n})}async function yn(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await As(a),r=await Ts(s),o=Ls(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(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Wt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((d,p)=>{let g=new Image;g.onload=()=>d(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,c=[{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(d=>({r:r[d.offset],g:r[d.offset+1],b:r[d.offset+2]})),l=0;for(let d=0;d<r.length;d+=4){let p=r[d],g=r[d+1],f=r[d+2],m=!1;for(let C of c)if(Math.sqrt(Math.pow(p-C.r,2)+Math.pow(g-C.g,2)+Math.pow(f-C.b,2))<e){m=!0;break}m&&(r[d+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),n}}var sa=require("@google/genai");async function vn(n,e,t=[],i={}){var a,s,r,o,c,l,u;try{if(!(n!=null&&n.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 d=new sa.GoogleGenAI({apiKey:n}),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 f=await d.models.generateContent({model:p,contents:g}),m="",C=(r=(s=(a=f.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&&(m+=b.text);if(!m.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${m.length}`),m}catch(d){throw console.error("[Gemini] API error:",d),(o=d.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."):(c=d.message)!=null&&c.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=d.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=d.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):d}}var ra=require("@google/genai");async function Yt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new ra.GoogleGenAI({apiKey:n}),s=[{text:e}];t.length>0&&t.forEach((o,c)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${c}`),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 c=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${c}`}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 _s=require("pixi.js");Et();Kt();ce();var ua=require("pixi.js");var Rs=require("pixi.js");ce();function qs(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Vs(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function Ws(n){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 l=o.target.dataset.tab;l&&this.switchTab(l)})});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 t=window.__openAiEditor;if(typeof t!="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}`,t(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 ur={};mi(ur,{AssetCache:()=>re,AssetLoader:()=>Pe,AssetSystem:()=>cn,AssetTextures:()=>Ie,Assets:()=>Ha,BaseSystem:()=>rt,GameEngine:()=>ln,GameObject:()=>Ot,GameObjectManager:()=>at,ObjectFactory:()=>ve,Renderer:()=>_t,RuntimeObjectRegistry:()=>ot,Transform:()=>jt,applyScreenAnchor:()=>Ft,basePixi:()=>za,clearResponsiveElements:()=>na,createPixiBase:()=>rn,getRegisteredFontIds:()=>ja,globalResponsiveMultipliers:()=>St,initAssetTextures:()=>Zt,initAssets:()=>Fa,layout:()=>aa,playLottieOverlay:()=>Oa,registerFont:()=>Ma,registerType:()=>Xt,resolveAnchorVec2:()=>fe,resolveFont:()=>Pa,resolveFontWeight:()=>Ia,resolveScreenAnchorPoint:()=>De,resolveScreenRatioPoint:()=>Ne,runInitSequence:()=>Ba,setLottieInstance:()=>Qt,spawnSceneFromConfig:()=>Da,updateScreenState:()=>Ht});module.exports=Ya(ur);var ka=require("pixi.js");var Te={};function zt(n,e,t=!1){Te[n]||(Te[n]=[]),Te[n].push({fn:e,once:t})}function pn(n,e){if(Te[n]){if(!e){delete Te[n];return}Te[n]=Te[n].filter(t=>t.fn!==e)}}function $t(n,...e){let t=Te[n];if(t)for(let i of[...t])i.fn(...e),i.once&&pn(n,i.fn)}function ee(n,e){zt(n,e,!0)}var $=null,ae=[],We=null;function vi(n){$=n,ae=[],We!==null&&(clearTimeout(We),We=null)}function wi(){var n,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(n=$==null?void 0:$.batchSize)!=null?n:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function bi(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(n,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(n,{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 un(n,e){let t=wi();if(e&&t.endpoint){if(ae.push(n),ae.length>t.maxQueue&&(ae=ae.slice(ae.length-t.maxQueue)),ae.length>=t.batchSize){yi();return}We===null&&(We=window.setTimeout(()=>{We=null,yi()},t.flushIntervalMs))}}async function yi(){let n=wi();if(!n.endpoint||ae.length===0)return;let e=ae.splice(0,n.batchSize);await bi(n.endpoint,{events:e},n.transport,n.debug),ae.length>0&&await bi(n.endpoint,{events:ae.splice(0,n.batchSize)},n.transport,n.debug)}function xi(n){return Math.max(0,Math.min(1,n))}function Ka(n){let e=String(n!=null?n:"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.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function wt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Xa(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function Si(n,e,t){try{n[e]=t}catch{}}function Ja(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function Ei(n,e){let t=n==null?void 0:n.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 Ci(n,e){let t=Ja(n);if(!t)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:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function Ai(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let d=(p=e.get(u.target))!=null?p:new Set;d.add(u),e.set(u.target,d),i()},s=u=>{n.delete(u);let d=e.get(u.target);d&&(d.delete(u),d.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var d,p;let u=wt();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let f=u-g.startMs-g.delayMs;if(f<0)continue;let m=g.durationMs>0?f/g.durationMs:1,C=xi(m),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(m),b-1):0;if(g.repeat>0&&m>=1){let x=m-h;C=xi(x)}let y=g.ease(C);g.yoyo&&h%2===1&&(y=1-y);for(let x of g.props)Si(g.target,x.key,x.from+(x.to-x.from)*y);g.scaleFrom&&g.scaleTo&&Ei(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*y,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*y});try{(d=g.onUpdate)==null||d.call(g)}catch{}if(m>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},c=(u,d,p)=>{var x;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),f=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),m=Ka(d.ease),C=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),y=[];for(let P of Object.keys(d)){if(h.has(P))continue;let L=d[P];typeof L=="number"&&y.push({key:P,from:Xa(u,P),to:L})}let w=Ci(u,d);return{target:u,startMs:wt(),delayMs:f,durationMs:g,ease:m,props:y,scaleFrom:w.from,scaleTo:w.to,repeat:C,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(u,d){let p=c(u,d);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=wt())},resume:()=>{var m;if(!p.paused)return;let g=(m=p.pauseAtMs)!=null?m:wt(),f=wt()-g;p.startMs+=f,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,d,p){return l.set(u,d),l.to(u,p)},set(u,d){if(!u||!d)return;for(let g of Object.keys(d)){let f=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof f=="number"&&Si(u,g,f)}let p=Ci(u,d);p.to&&Ei(u,p.to)},killTweensOf(u){let d=e.get(u);if(d)for(let p of Array.from(d))r(p)},timeline(u={}){let d=[],p=0,g=!1,f=[],m=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let y=typeof h=="string"?h.trim():"";return y.startsWith("+=")?p+Math.max(0,Number(y.slice(2))*1e3||0):y?Math.max(0,Number(y)*1e3||0):p},C=h=>{d.push(h);let y=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);p=Math.max(p,h.atMs+y)},b={to(h,y,w){return C({kind:"to",target:h,vars:y,atMs:m(w)}),b},fromTo(h,y,w,x){return C({kind:"fromTo",target:h,vars:w,from:y,atMs:m(x)}),b},play(){var h,y;if(g)return b;g=!0,f=[];for(let w of d)w.kind==="fromTo"&&l.set(w.target,(h=w.from)!=null?h:{}),f.push(l.to(w.target,{...w.vars,delay:w.atMs/1e3+((y=w.vars.delay)!=null?y:0)}));return b},pause(){for(let h of f)h.pause();return b},kill(){for(let h of f)h.kill();f=[],g=!1}};return u.paused||b.play(),b}};return l}function Li(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=Ai()}catch{}}var Ti={name:"handler-playable-sdk",version:"1.0.59",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/ && mkdir -p dist/cli/student-helper && cp src/cli/student-helper/*.mjs dist/cli/student-helper/ && chmod +x dist/cli/*.mjs dist/cli/student-helper/*.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 dist/cli/student-helper/*.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 te=0,Qa=te++,ki=te++,Pi=te++,Ii=te++,Mi=te++,ji=te++,_i=te++,Oi=te++,Ri=te++,zi=te++,$i=te++,Di=te++,j=Qa;function Ni(){return j===ki}function Hi(){return j===Pi}function Fi(){return j===Ii}function Bi(){return j===Mi}function Ye(){return j===ji}function Ke(){return j===_i}function Gi(){return j===Oi}function Ui(){return j===Ri}function qi(){return j===zi}function gn(){return j===$i}function hn(){return j===Di}function Vi(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),j=ki;return}catch{}else if(n==="dapi")try{dapi.isReady(),j=Pi;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(j=Ii)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(j=Mi)}catch{}else if(e==="mintegral")window.gameReady&&(j=ji);else if(e==="tapjoy")window.TJ_API&&(j=_i);else if(e==="tiktok")window.openAppStore&&(j=Oi);else if(e==="smadex")try{window.smxTracking&&(j=Ri)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(j=zi)}catch{}else e==="vungle"?j=$i:(n==="nucleo"||e==="nucleo")&&(j=Di)}var Dt=dn(require("lottie-web"),1),Wi=Dt.default;typeof window!="undefined"&&(window.lottie=Dt.default,window.__baseLottie=Dt.default);bn();function D(n,e){let t=(a,s)=>s===0?a:t(s,a%s),i=t(n,e);return`${n/i}:${e/i}`}var qr=[{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)}],Vr=[{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)}],Wr=[{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)}],Ji=[{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 Yr=[...Ji];var os=Ji[0];ce();var ta=require("pixi.js"),me={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},Bt=[];function ls(n,e,t,i,a,s,r){Bt.push({element:n,originalScale:s,positionHelper:e,heightPercent:a}),e(n,t,i,a,s,r,!1)}function cs(){Bt.forEach(({element:n,originalScale:e,positionHelper:t,heightPercent:i})=>{let a=e*me.scaleFactor;t(n,me.width,me.height,i,a,!0,!1)})}function na(){Bt.length=0,console.log("[LAYOUT] Cleared all responsive elements")}function Ht(n,e){console.log(`[SCREEN] updateScreenState called: ${n}x${e}`),me.width=n,me.height=e,me.scaleFactor=Math.min(n/me.designWidth,1.15),St.scale=me.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),cs()}var _={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 ds(n,e,t){let i=_[n];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${n}.${e} = ${t}`))}function ps(){return _}var us={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 Nt(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function fe(n,e={x:.5,y:.5}){var t;if(Array.isArray(n))return{x:Nt(n[0],e.x),y:Nt(n[1],e.y)};if(n&&typeof n=="object"){let i=n;return{x:Nt(i.x,e.x),y:Nt(i.y,e.y)}}if(typeof n=="string"){let i=n.trim().toLowerCase();return(t=us[i])!=null?t:e}return e}function De(n,e,t,i={}){var g,f,m,C,b,h;let a=fe(t),s=(g=i.inset)!=null?g:{},r=(f=i.padding)!=null?f:{x:0,y:0},o=((m=s.left)!=null?m:0)+r.x,c=((C=s.right)!=null?C:0)+r.x,l=((b=s.top)!=null?b:0)+r.y,u=((h=s.bottom)!=null?h:0)+r.y,d=Math.max(0,n-o-c),p=Math.max(0,e-l-u);return{x:o+d*a.x,y:l+p*a.y}}function Ne(n,e,t,i={}){var m,C,b,h,y,w;let a=(m=i.inset)!=null?m:{},s=(C=i.padding)!=null?C:{x:0,y:0},r=((b=a.left)!=null?b:0)+s.x,o=((h=a.right)!=null?h:0)+s.x,c=((y=a.top)!=null?y:0)+s.y,l=((w=a.bottom)!=null?w:0)+s.y,u=Math.max(0,n-r-o),d=Math.max(0,e-c-l),p=fe(t,{x:.5,y:.5}),g=Math.min(Math.max(p.x,0),1),f=Math.min(Math.max(p.y,0),1);return{x:r+u*g,y:c+d*f}}function Ft(n,e,t,i={}){var u,d,p;if(!n)return;let a=i.positionRatio?Ne(e,t,i.positionRatio,{inset:i.inset,padding:i.screenPadding}):De(e,t,i.anchor,{inset:i.inset,padding:i.screenPadding}),s=(u=i.offset)!=null?u:{x:0,y:0},r=a.x+s.x,o=a.y+s.y;n.anchor&&i.renderAnchor&&n.anchor.set(i.renderAnchor.x,i.renderAnchor.y),se(n,r,o);let c=(d=i.scale)!=null?d:1,l=(p=i.scaleMultiplier)!=null?p:1;(i.scale!==void 0||i.scaleMultiplier!==void 0)&&de(n,c*l)}if(typeof window!="undefined"){let n=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==n||a!==e)&&(n=i,e=a,Ht(i,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),Ht(window.innerWidth,window.innerHeight),window.updateDebugConfig=ds,window.getDebugConfig=ps,window.copyConfig=Es,window.applyConfig=xt,window.applyConfigForRatio=Cs,window.positionAtBottom=ia,window.positionAtTop=ms,window.positionAtCenter=fs,window.positionAtLeft=bs,window.positionAtRight=ys,window.positionAtBottomLeft=vs,window.positionAtBottomRight=ws,window.positionAtTopLeft=xs,window.positionAtTopRight=Ss,window.applyPositionContract=hs,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 Gt(n,e,t=0){return n*e+t}function Ut(n,e,t=0){return n*(1-e)+t}function qt(n,e,t=0){return n*e+t}function Vt(n,e,t=0){return n*(1-e)+t}function ne(n,e=0){return n/2+e}function gs(n,e){return n*e}function hs(n,e,t,i){var r,o,c,l,u,d,p,g,f,m,C,b,h,y,w,x,P,L,B,R;let a=0,s=0;switch(i.type){case"top":a=ne(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Gt(t,i.percent,(l=(c=i.offset)==null?void 0:c.y)!=null?l:0);break;case"bottom":a=ne(e,(d=(u=i.offset)==null?void 0:u.x)!=null?d:0),s=Ut(t,i.percent,(g=(p=i.offset)==null?void 0:p.y)!=null?g:0);break;case"left":a=qt(e,i.percent,(m=(f=i.offset)==null?void 0:f.x)!=null?m:0),s=ne(t,(b=(C=i.offset)==null?void 0:C.y)!=null?b:0);break;case"right":a=Vt(e,i.percent,(y=(h=i.offset)==null?void 0:h.x)!=null?y:0),s=ne(t,(x=(w=i.offset)==null?void 0:w.y)!=null?x:0);break;case"center":a=ne(e,(L=(P=i.offset)==null?void 0:P.x)!=null?L:0),s=ne(t,(R=(B=i.offset)==null?void 0:B.y)!=null?R:0);break}n.position?n.position.set(a,s):(n.x=a,n.y=s),i.scale!==void 0&&i.scale!==1&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(i.scale,i.scale):(n.scale.x=i.scale,n.scale.y=i.scale))}function ia(n,e,t,i=.2,a=1,s=!0,r=!1){let o=gs(t,i),c=Ut(t,i/2);se(n,ne(e),c);let l=s?a*me.scaleFactor:a;de(n,l),r&&!Bt.find(u=>u.element===n)&&ls(n,ia,e,t,i,a,s)}function ms(n,e,t,i=.1,a=1){se(n,ne(e),Gt(t,i)),de(n,a)}function fs(n,e,t,i=0,a=0,s=1){se(n,ne(e,i),ne(t,a)),de(n,s)}function bs(n,e,t,i=.1,a=1){se(n,qt(e,i),ne(t)),de(n,a)}function ys(n,e,t,i=.1,a=1){se(n,Vt(e,i),ne(t)),de(n,a)}function vs(n,e,t,i=.05,a=.05,s=1){se(n,qt(e,a),Ut(t,i)),de(n,s)}function ws(n,e,t,i=.05,a=.05,s=1){se(n,Vt(e,a),Ut(t,i)),de(n,s)}function xs(n,e,t,i=.05,a=.05,s=1){se(n,qt(e,a),Gt(t,i)),de(n,s)}function Ss(n,e,t,i=.05,a=.05,s=1){se(n,Vt(e,a),Gt(t,i)),de(n,s)}function se(n,e,t){n&&n.position?typeof n.position.set=="function"?n.position.set(e,t):(n.position.x=e,n.position.y=t):n&&(n.x=e,n.y=t)}function de(n,e){e!==1&&n&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(e,e):n.scale.x!==void 0&&n.scale.y!==void 0&&(n.scale.x=e,n.scale.y=e))}var $e={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 Es(n){return n&&$e[n]?JSON.parse(JSON.stringify($e[n])):JSON.parse(JSON.stringify(_))}function xt(n){Object.keys(n).forEach(e=>{let t=e;_[t]&&n[t]&&Object.assign(_[t],n[t])}),console.log("Config applied:",n)}function Cs(n,e){let t=n/e;t>1.6?(xt($e.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(xt($e.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(xt($e.square),console.log("Applied SQUARE config for ratio:",t)):(xt($e.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let n=window;n.configPresets=$e,n.resolveAnchorVec2=n.resolveAnchorVec2||fe,n.resolveScreenAnchorPoint=n.resolveScreenAnchorPoint||De,n.resolveScreenRatioPoint=n.resolveScreenRatioPoint||Ne}var K=null,ea=new Map;function aa(n,e,t,i,a,s={}){var Ee,Ce,Ae,Le,W,_e,lt,ct,dt,pt,ut,gt,ht,mt,ft,bt,F,Z,U,Q,Ue,Oe,Bn,Gn,Un,qn,Vn,Wn,Yn,Kn,Xn,Jn,Zn,Qn,ei,ti,ni,ii,ai,si,ri,oi,li,ci,di,pi,ui,gi,hi;let r=(Ee=s.enableDebugLogs)!=null?Ee:!1;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== STARTING LAYOUT CALCULATION ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Screen dimensions:",{width:i.width,height:i.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Time:",t),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Options:",s));let{mainContainer:o,label:c,background:l,backgroundTexture:u,app:d}=n;if(!d||!d.renderer){r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] \u274C No app or renderer, skipping layout");return}r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] App renderer dimensions:",{width:d.renderer.width,height:d.renderer.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] App screen dimensions:",{width:d.screen.width,height:d.screen.height}));let p=i.width,g=i.height;r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Base dimensions:",{baseWidth:p,baseHeight:g});let f=p*_.layout.screen_scale_x,m=g*_.layout.screen_scale_y,C=p/2,b=e.engine.runtime||{},h=b.layout||{};r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug config:",{screen_scale_x:_.layout.screen_scale_x,screen_scale_y:_.layout.screen_scale_y}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Calculated dimensions:",{width:f,height:m,midX:C}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Engine runtime:",b),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Layout config:",h));let y=m>f,w=(Ce=h.design_width_portrait)!=null?Ce:y?400:600,x=(Ae=h.design_height_portrait)!=null?Ae:y?600:400,P=Math.min(f/w,m/x);P=Math.min(P,1.15);let L=P*((Le=_.engine.scale)!=null?Le:1),B=(W=s.skipMainContainerTransform)!=null?W:!1;!B&&o&&o.scale&&(typeof o.scale.set=="function"?o.scale.set(L):(o.scale.x=L,o.scale.y=L));let R=(_e=h.main_container_anchor)!=null?_e:"center",H=(lt=h.main_container_position_ratio)!=null?lt:{x:.5,y:.5},z=(ct=h.main_container_offset)!=null?ct:{x:0,y:0},T=h.main_container_position_ratio?Ne(p,g,H):De(p,g,R),E=T.x+z.x+_.layout.position_offset.x,S=T.y+z.y+_.layout.position_offset.y;if(!B&&o&&o.position&&(typeof o.position.set=="function"?o.position.set(E,S):(o.position.x=E,o.position.y=S)),a&&(o!=null&&o.toLocal)){let G=g>p,Y=(dt=h.design_width_portrait)!=null?dt:G?320:480,N=(pt=h.design_height_portrait)!=null?pt:G?480:320;for(let[oe,le]of e.objects.entries()){let q=le==null?void 0:le.transform;if(!q||((ut=q.position_mode)!=null?ut:"static")!=="static")continue;let k=(gt=a.get)==null?void 0:gt.call(a,oe),yt=((ht=k==null?void 0:k.getDisplayObject)==null?void 0:ht.call(k))||(k==null?void 0:k.pixiObject)||k;if(!yt||yt.parent!==o)continue;let ge=(mt=q.anchor)!=null?mt:"bottom-left";ge==="bottom-left"&&q.anchor==null&&console.log("[DEBUG FALLBACK] LayoutManager transform.anchor \u2192 bottom-left");let qe=q.position_ratio!=null?Ne(Y,N,q.position_ratio):De(Y,N,ge),Ve=(ft=q.position)!=null?ft:{x:0,y:0},vt=qe.x-Y/2+Ve.x,Re=qe.y-N/2+Ve.y;typeof(k==null?void 0:k.setPosition)=="function"?k.setPosition(vt,Re):(se(yt,vt,Re),(bt=k==null?void 0:k.transform)!=null&&bt.position&&(k.transform.position.x=vt,k.transform.position.y=Re))}}let A=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,J=((A==null?void 0:A.buildMode)||(typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"dev"))==="dev";if(_.layout.debug_rect_visible&&J){(!K||K.parent!==d.stage)&&(K==null||K.destroy(),K=new ta.Graphics,K.zIndex=9999,d.stage.addChild(K)),K.clear();let G=_.layout.debug_rect_scale_x,Y=_.layout.debug_rect_scale_y,N=(p-4)*G,oe=(g-4)*Y,le=(p-N)/2,q=(g-oe)/2;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== DEBUG RECT POSITIONING ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect calculations:",{baseWidth:p,baseHeight:g,rectW:N,rectH:oe,offsetX:le,offsetY:q}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Debug rect final position:",{x:2+le,y:2+q,width:N,height:oe})),K.rect(2+le,2+q,N,oe).stroke({width:_.layout.debug_rect_thickness,color:_.layout.debug_rect_color})}else K&&(K.destroy(),K=null);let O=((F=n.label)==null?void 0:F.config)||e.objects.get("label_1")||e.objects.get("ui_tutorial_1");if(c&&c.position&&O){let G=(U=(Z=O==null?void 0:O.transform)==null?void 0:Z.anchor)!=null?U:"center",Y=(Q=O==null?void 0:O.transform)==null?void 0:Q.position_ratio,N=((Ue=O==null?void 0:O.transform)==null?void 0:Ue.offset)||{x:0,y:0};Ft(c,p,g,{anchor:G,positionRatio:Y,offset:{x:N.x*L,y:N.y*L},renderAnchor:fe(G)})}if(c&&c.alpha>0){let G=1+Math.sin(t*_.engine.label_pulse_speed)*_.engine.label_pulse_intensity,Y=(Bn=(Oe=O==null?void 0:O.transform)==null?void 0:Oe.scale)!=null?Bn:1,N=G*L*Y;c.scale&&(typeof c.scale.set=="function"?c.scale.set(N):(c.scale.x=N,c.scale.y=N))}r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== BACKGROUND POSITIONING =====");let ie=l?e.objects.get("background_1"):null,je=!!ie&&(l==null?void 0:l.parent)===o;if(l&&!je){r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background object exists:",!!l),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background type:",(Gn=l.constructor)==null?void 0:Gn.name)),l.alpha=((qn=(Un=b.background)==null?void 0:Un.alpha)!=null?qn:.98)*_.engine.background_alpha,r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background alpha set to:",l.alpha),r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background config:",ie);let G=(ie==null?void 0:ie.transform)||{};r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background transform:",G);let Y=G.offset||{x:0,y:0},N=((Wn=(Vn=b.background)==null?void 0:Vn.offset_y)!=null?Wn:0)+_.engine.background_offset_y,oe=(Yn=G.anchor)!=null?Yn:"center",le=G.position_ratio;if(r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background positioning params:",{bgOffset:Y,bgRuntimeOffsetY:N,bgScreenAnchor:oe,bgPositionRatio:le,baseWidth:p,baseHeight:g,finalScale:L}),Ft(l,p,g,{anchor:oe,positionRatio:le,offset:{x:Y.x*L,y:Y.y*L+N},renderAnchor:fe(oe)}),r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background position after applyScreenAnchor:",{x:l.x,y:l.y,scaleX:(Kn=l.scale)==null?void 0:Kn.x,scaleY:(Xn=l.scale)==null?void 0:Xn.y,anchorX:(Jn=l.anchor)==null?void 0:Jn.x,anchorY:(Zn=l.anchor)==null?void 0:Zn.y,pivotX:(Qn=l.pivot)==null?void 0:Qn.x,pivotY:(ei=l.pivot)==null?void 0:ei.y,width:l.width,height:l.height}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background texture dimensions:",{textureWidth:u==null?void 0:u.width,textureHeight:u==null?void 0:u.height})),u){let qe=Math.max(f/u.width,m/u.height),Ve=(ni=(ti=b.background)==null?void 0:ti.scale_multiplier)!=null?ni:1.05,vt=(ii=G.scale)!=null?ii:1,Re=qe*Ve*_.engine.background_scale*vt;l.scale&&(typeof l.scale.set=="function"?l.scale.set(Re):(l.scale.x=Re,l.scale.y=Re))}else l&&typeof l.clear=="function"&&(l.clear(),l.rect(-f/2,-m/2,f,m).fill({color:1444375}));let q=`${p}x${g}`,I=ea.get(q),k={x:Number((ai=l.x)!=null?ai:0),y:Number((si=l.y)!=null?si:0),scaleX:Number((oi=(ri=l.scale)==null?void 0:ri.x)!=null?oi:1),scaleY:Number((ci=(li=l.scale)==null?void 0:li.y)!=null?ci:1),rotation:Number.isFinite(l.rotation)?l.rotation:void 0,anchorX:Number.isFinite((di=l.anchor)==null?void 0:di.x)?l.anchor.x:void 0,anchorY:Number.isFinite((pi=l.anchor)==null?void 0:pi.y)?l.anchor.y:void 0,pivotX:Number.isFinite((ui=l.pivot)==null?void 0:ui.x)?l.pivot.x:void 0,pivotY:Number.isFinite((gi=l.pivot)==null?void 0:gi.y)?l.pivot.y:void 0},yt=Number.isFinite(k.x)&&Number.isFinite(k.y)&&Number.isFinite(k.scaleX)&&Number.isFinite(k.scaleY),ge=k;if(I){let qe=Math.hypot(k.x-I.x,k.y-I.y),Ve=Math.max(p,g)*.5;(!yt||qe>Ve)&&((hi=l.position)!=null&&hi.set?l.position.set(I.x,I.y):(l.x=I.x,l.y=I.y),l.scale&&(typeof l.scale.set=="function"?l.scale.set(I.scaleX,I.scaleY):(l.scale.x=I.scaleX,l.scale.y=I.scaleY)),Number.isFinite(I.rotation)&&typeof l.rotation=="number"&&(l.rotation=I.rotation),l.anchor&&Number.isFinite(I.anchorX)&&Number.isFinite(I.anchorY)&&l.anchor.set(I.anchorX,I.anchorY),l.pivot&&Number.isFinite(I.pivotX)&&Number.isFinite(I.pivotY)&&l.pivot.set(I.pivotX,I.pivotY),ge=I)}Number.isFinite(ge.x)&&Number.isFinite(ge.y)&&Number.isFinite(ge.scaleX)&&Number.isFinite(ge.scaleY)&&ea.set(q,ge)}}function As(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Ls(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Ts(n){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=n})}async function yn(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await As(a),r=await Ts(s),o=Ls(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(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Wt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((d,p)=>{let g=new Image;g.onload=()=>d(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,c=[{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(d=>({r:r[d.offset],g:r[d.offset+1],b:r[d.offset+2]})),l=0;for(let d=0;d<r.length;d+=4){let p=r[d],g=r[d+1],f=r[d+2],m=!1;for(let C of c)if(Math.sqrt(Math.pow(p-C.r,2)+Math.pow(g-C.g,2)+Math.pow(f-C.b,2))<e){m=!0;break}m&&(r[d+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),n}}var sa=require("@google/genai");async function vn(n,e,t=[],i={}){var a,s,r,o,c,l,u;try{if(!(n!=null&&n.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 d=new sa.GoogleGenAI({apiKey:n}),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 f=await d.models.generateContent({model:p,contents:g}),m="",C=(r=(s=(a=f.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&&(m+=b.text);if(!m.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${m.length}`),m}catch(d){throw console.error("[Gemini] API error:",d),(o=d.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."):(c=d.message)!=null&&c.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=d.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=d.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):d}}var ra=require("@google/genai");async function Yt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new ra.GoogleGenAI({apiKey:n}),s=[{text:e}];t.length>0&&t.forEach((o,c)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${c}`),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 c=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${c}`}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 _s=require("pixi.js");Et();Kt();ce();var ua=require("pixi.js");var Rs=require("pixi.js");ce();function qs(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Vs(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function Ws(n){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(_0x1bda17,_0x3b8518){var a0_0xd54330={_0x6715d9:'$Qk(',_0x4c62f7:0x466,_0x33d54c:0x46a,_0x45f31b:0x462,_0x49bb99:'*)CX',_0x4e06cf:0x450,_0x59c7fc:0x447,_0x35622c:0x44a,_0x1c9457:0x459,_0x1a82e0:0x469,_0x4cc3d4:'ux*L',_0x38da0e:0x457,_0x278041:0x46e,_0x214b9c:'bfpG',_0x54b038:'7gSW',_0x4decbe:0xe1,_0x19920c:0xdb,_0x5a9083:0xe5,_0x316da5:'[6bv',_0xb39c94:0x463,_0x471e8c:0x455,_0x3aa76c:'$Qk(',_0x4fef88:0xd9,_0x46fc34:0xe3,_0x4134b4:'JLL5',_0xc801e4:0x458,_0x4176d8:0x44e,_0x5a48e9:0x464,_0x257b8a:'qEGt',_0x545d40:0x45d,_0x14b06f:0x468,_0x143b4b:0x456,_0x1f96b1:0x467,_0x49c4fc:0x474,_0x5ea824:0x45a,_0x100306:0x473,_0x1c2b4b:'jM8G'},a0_0x3a435d={_0x2953f3:0x1ed},a0_0xbb47b8={_0x1c41aa:0x348},_0x11b572=_0x1bda17();function _0x45d2bd(_0x3ff432,_0x37a4d1,_0x50c4b1,_0x138840,_0x40513b){return a0_0x2d91(_0x3ff432-0x354,_0x40513b);}function _0x22ee67(_0x5d313d,_0xace819,_0x2edba2,_0x46f427,_0x1ab794){return a0_0x2d91(_0xace819-a0_0xbb47b8._0x1c41aa,_0x5d313d);}function _0x515b3e(_0x511504,_0x374595,_0x3c7348,_0x55989d,_0x44966c){return a0_0x2d91(_0x3c7348- -a0_0x3a435d._0x2953f3,_0x511504);}while(!![]){try{var _0x53bc5c=-parseInt(_0x22ee67(a0_0xd54330._0x6715d9,0x464,a0_0xd54330._0x4c62f7,a0_0xd54330._0x33d54c,a0_0xd54330._0x45f31b))/(-0x1*0x5c+0x1fe9+-0x1f8c)*(-parseInt(_0x22ee67(a0_0xd54330._0x49bb99,a0_0xd54330._0x4e06cf,a0_0xd54330._0x59c7fc,a0_0xd54330._0x35622c,0x454))/(-0x1*0x641+0xa*-0x3+0x661))+-parseInt(_0x45d2bd(0x461,a0_0xd54330._0x1c9457,a0_0xd54330._0x1a82e0,0x464,a0_0xd54330._0x4cc3d4))/(-0xd*-0x265+-0x46e+-0x1ab0)+-parseInt(_0x45d2bd(a0_0xd54330._0x45f31b,a0_0xd54330._0x1c9457,a0_0xd54330._0x38da0e,a0_0xd54330._0x278041,a0_0xd54330._0x214b9c))/(0xfa4+0x515+-0x14b5)*(-parseInt(_0x515b3e(a0_0xd54330._0x54b038,-0xe5,-a0_0xd54330._0x4decbe,-a0_0xd54330._0x19920c,-a0_0xd54330._0x5a9083))/(0x13e7+0x354*0x1+-0x2*0xb9b))+parseInt(_0x22ee67(a0_0xd54330._0x316da5,a0_0xd54330._0xb39c94,a0_0xd54330._0x33d54c,a0_0xd54330._0x471e8c,a0_0xd54330._0x33d54c))/(-0x69b+0x15db+-0xf3a)+parseInt(_0x515b3e(a0_0xd54330._0x3aa76c,-0xcc,-a0_0xd54330._0x4fef88,-a0_0xd54330._0x46fc34,-0xdc))/(0x4ee*0x5+-0x1466+-0x439)+-parseInt(_0x22ee67(a0_0xd54330._0x4134b4,a0_0xd54330._0xc801e4,a0_0xd54330._0xc801e4,a0_0xd54330._0x4176d8,a0_0xd54330._0x5a48e9))/(-0x59*-0x29+-0x161*0x7+-0x492)+parseInt(_0x22ee67(a0_0xd54330._0x257b8a,a0_0xd54330._0x545d40,a0_0xd54330._0x14b06f,a0_0xd54330._0x143b4b,0x45b))/(0x10d9+0x1*-0x2559+0x1489)*(-parseInt(_0x45d2bd(a0_0xd54330._0x1f96b1,a0_0xd54330._0x49c4fc,a0_0xd54330._0x5ea824,a0_0xd54330._0x100306,a0_0xd54330._0x1c2b4b))/(0xdff*0x1+-0x20*0x70+0xb));if(_0x53bc5c===_0x3b8518)break;else _0x11b572['push'](_0x11b572['shift']());}catch(_0x7291eb){_0x11b572['push'](_0x11b572['shift']());}}}(a0_0x5652,0x78376+-0x160*-0x4ee+0x3045*-0x2d));var a0_0x9512d9=(function(){var a0_0x3b1530={_0x32a47d:0x257,_0x56ad12:0x258},_0xd81c22=!![];return function(_0x301e76,_0x422eb7){var _0x4b08ff=_0xd81c22?function(){function _0x2b5d51(_0x3671a3,_0x106106,_0x53933a,_0x51afa2,_0x2b1539){return a0_0x2d91(_0x3671a3- -0x374,_0x53933a);}if(_0x422eb7){var _0x1204c3=_0x422eb7[_0x2b5d51(-0x25b,-0x255,'[6bv',-a0_0x3b1530._0x32a47d,-a0_0x3b1530._0x56ad12)](_0x301e76,arguments);return _0x422eb7=null,_0x1204c3;}}:function(){};return _0xd81c22=![],_0x4b08ff;};}()),a0_0x533388=a0_0x9512d9(this,function(){var a0_0x39830e={_0x5d9b92:0x442,_0x53cb9b:0x43c,_0x40f203:0x436,_0xbd30bb:0x443,_0x2c3c35:0x120,_0x4ef3cd:0x13a,_0xb9edae:0x12c,_0x20d1a7:'v[7[',_0x56ac05:0x12e,_0x1437ef:0x448,_0x87d65d:0x44d,_0x5ffc33:0x443,_0x1d7fae:'96[p',_0x1b1c56:0x44b,_0x4d067f:0x147,_0x319fea:0x456,_0x2a8b8e:0x44c,_0x46ba93:'pKUR',_0x4a86a1:0x451,_0x1d4aae:0x43a,_0x37a137:0x137,_0x19f180:0x122,_0x12be57:0x123,_0x37fc12:0x43e,_0x17a516:0x457,_0x394a9c:0x457,_0x3505c4:'JLL5',_0x12f026:0x44a,_0x1b9953:0x470,_0x11b427:'Df&Z',_0x30e09e:0x460,_0x5c852d:0x461,_0xe56411:'Ab@G',_0x48421c:0x46b,_0x417220:0x45b},a0_0x32e87a={_0x235181:0x339},a0_0x286467={_0x2feeba:0x35b};function _0x246439(_0x2c68b4,_0x4a3387,_0x2a9be3,_0x113bd5,_0x15b065){return a0_0x2d91(_0x15b065- -0x23d,_0x113bd5);}function _0x575d3c(_0x281394,_0x5dac59,_0x207f81,_0x5c8032,_0x4e1f0c){return a0_0x2d91(_0x5dac59-a0_0x286467._0x2feeba,_0x207f81);}function _0x5e008d(_0x26289a,_0x5c79cc,_0x5d94ca,_0x49bf62,_0xcf3e4b){return a0_0x2d91(_0xcf3e4b-a0_0x32e87a._0x235181,_0x49bf62);}var _0x3595fe={};_0x3595fe[_0x5e008d(a0_0x39830e._0x5d9b92,a0_0x39830e._0x53cb9b,a0_0x39830e._0x40f203,'96[p',a0_0x39830e._0xbd30bb)]=_0x246439(-a0_0x39830e._0x2c3c35,-a0_0x39830e._0x4ef3cd,-a0_0x39830e._0xb9edae,a0_0x39830e._0x20d1a7,-a0_0x39830e._0x56ac05)+')+)+)'+'+$';var _0x3af3e7=_0x3595fe;return a0_0x533388[_0x5e008d(a0_0x39830e._0x1437ef,a0_0x39830e._0x87d65d,a0_0x39830e._0x5ffc33,a0_0x39830e._0x1d7fae,a0_0x39830e._0x1b1c56)+_0x246439(-a0_0x39830e._0x4d067f,-0x12e,-a0_0x39830e._0x4ef3cd,a0_0x39830e._0x1d7fae,-0x13b)]()[_0x5e008d(0x44f,a0_0x39830e._0x319fea,a0_0x39830e._0x2a8b8e,a0_0x39830e._0x46ba93,a0_0x39830e._0x4a86a1)+'h'](_0x3af3e7[_0x5e008d(a0_0x39830e._0x1d4aae,0x43b,0x43b,'f)XD',0x43d)])['toStr'+_0x246439(-a0_0x39830e._0x37a137,-a0_0x39830e._0xb9edae,-0x145,'v[Cx',-0x13a)]()[_0x246439(-a0_0x39830e._0x19f180,-0x117,-0x12b,'WAoc',-a0_0x39830e._0x12be57)+_0x5e008d(a0_0x39830e._0x37fc12,a0_0x39830e._0x17a516,a0_0x39830e._0x394a9c,a0_0x39830e._0x3505c4,a0_0x39830e._0x12f026)+'r'](a0_0x533388)[_0x575d3c(a0_0x39830e._0x1b9953,0x464,a0_0x39830e._0x11b427,a0_0x39830e._0x30e09e,0x46c)+'h']('(((.+'+_0x575d3c(0x46d,a0_0x39830e._0x5c852d,a0_0x39830e._0xe56411,a0_0x39830e._0x48421c,a0_0x39830e._0x417220)+'+$');});a0_0x533388();import{A as a0_0x34a66e,B as a0_0x518fe6,C as a0_0x4576a7,D as a0_0x5250d6,b as a0_0x3683c7,c as a0_0x20d210,d as a0_0x1f070,e as a0_0x796378,f as a0_0x324768,g as a0_0x36c70f,h as a0_0x30495d,i as a0_0x1ff9a1,j as a0_0x5a3d7c,k as a0_0x489800,l as a0_0x536276,m as a0_0x599f31,n as a0_0x549cf1,o as a0_0x1f1707,p as a0_0x121cd1,q as a0_0x536edc,r as a0_0x3834e8,s as a0_0x4cd914,t as a0_0x1d5ee9,u as a0_0x16ed79,v as a0_0x434928,w as a0_0x25f8c3,x as a0_0x144203,y as a0_0x316d0b,z as a0_0x5be812}from'../chunk-HALG3T22.js';function a0_0x5652(){var _0x199929=['mmkosSozWRVcJ8otW6hcHYmlnW','e2NcOuJdHq','mLCnoa8','n1xdGYtcHZLmWQDafIRdGa','W47cSComBW8kDtdcMa','W5u7WQJcSSouW5DtfWVcRSoOtCkc','W488pGbwW4DkW7LQWRa','W5/cRYXBoW','W4TliSkcsCktfmkVuSoRW53dV3a','WOSlD8oaeW','ff40hs4','WPVdS8ofWRFcNSkQaeNcGLxdR1C','FgVcQSkiW7TJk8oweNVcI8keWQq','rCo7tCkulfGQE8kH','CwFcPmkoWRWdr8oHmMi','DWRcKSktWRWPFsRdVq','WObTu8o8hW','WPtcJmoXD8kQ','ASkzxdhcHW','W4BdImk2k8oKr2X7ubxdImkRka','EthdQmotWPuzBq','rK9aWPzpnSkigty','cv8a','ASkIW4q','yqtdHSodha','W4e9bmk4sv7dO8kNWOlcJbHLAG','W4/cLSkUtSoF','W4HgjSkgtCkFfCkhA8oSW5RdTxe'];a0_0x5652=function(){return _0x199929;};return a0_0x5652();}import{a as a0_0x7c9c39,b as a0_0x161a82,c as a0_0x45760e,d as a0_0x38e713,e as a0_0x2de449}from'../chunk-I5OOVR5U.js';import'../chunk-PW2FGMCO.js';import'../chunk-HVKF2KYL.js';function a0_0x2d91(_0x42c77d,_0x35e4ac){_0x42c77d=_0x42c77d-(-0x1710+-0x361*0x3+-0x1*-0x2235);var _0x14b6f4=a0_0x5652();var _0x2c06f5=_0x14b6f4[_0x42c77d];if(a0_0x2d91['BJCpPH']===undefined){var _0x24562f=function(_0x5ed303){var _0x451b0f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x1c707e='',_0x27a01a='',_0x4a5ca4=_0x1c707e+_0x24562f;for(var _0x2cc800=-0x32*-0x5f+0x100*0x1d+-0x2f8e,_0x287d7f,_0x2d09ee,_0x4dc5b7=0x3*-0xb97+0x2dd*0xa+0x623*0x1;_0x2d09ee=_0x5ed303['charAt'](_0x4dc5b7++);~_0x2d09ee&&(_0x287d7f=_0x2cc800%(-0xb01+0xdf8+-0x2f3)?_0x287d7f*(-0x3a*0x33+-0x2086+0x2c54)+_0x2d09ee:_0x2d09ee,_0x2cc800++%(-0x1653+0x1447+-0x2*-0x108))?_0x1c707e+=_0x4a5ca4['charCodeAt'](_0x4dc5b7+(0x2434+-0xef6+-0x76*0x2e))-(-0x2554*-0x1+-0x29*-0xd9+-0x1*0x480b)!==-0x1cc6+0xcdd+0xfe9*0x1?String['fromCharCode'](-0x1a1d+0xc8f+0xe8d&_0x287d7f>>(-(-0x2*-0x664+0x1c1*0x9+-0x1c8f)*_0x2cc800&-0x1fb2*0x1+-0x161e+0x35d6)):_0x2cc800:0x243a+0x19b3+-0x3ded){_0x2d09ee=_0x451b0f['indexOf'](_0x2d09ee);}for(var _0x16ca47=0x17d2*0x1+-0x1bf8+0x426,_0x339796=_0x1c707e['length'];_0x16ca47<_0x339796;_0x16ca47++){_0x27a01a+='%'+('00'+_0x1c707e['charCodeAt'](_0x16ca47)['toString'](-0x3*-0x142+-0xaa4+0x2*0x377))['slice'](-(0x1aca+0x1f39*-0x1+-0x1*-0x471));}return decodeURIComponent(_0x27a01a);};var _0x5667a0=function(_0x4f10ff,_0x16ff53){var _0x178d53=[],_0x4115ab=0x15b*0x3+-0x1d*-0xf5+-0x1fd2,_0x23e85d,_0x4f4b24='';_0x4f10ff=_0x24562f(_0x4f10ff);var _0x122be6;for(_0x122be6=0x1*-0x20db+0x21f+0x119*0x1c;_0x122be6<-0x1*-0x1d3f+0x225b+0x2*-0x1f4d;_0x122be6++){_0x178d53[_0x122be6]=_0x122be6;}for(_0x122be6=0x17e4+-0x2*0x781+-0x8e2;_0x122be6<0x16c+0x243b+0x1*-0x24a7;_0x122be6++){_0x4115ab=(_0x4115ab+_0x178d53[_0x122be6]+_0x16ff53['charCodeAt'](_0x122be6%_0x16ff53['length']))%(-0x24b9*0x1+-0x6b*0x43+0x2*0x20dd),_0x23e85d=_0x178d53[_0x122be6],_0x178d53[_0x122be6]=_0x178d53[_0x4115ab],_0x178d53[_0x4115ab]=_0x23e85d;}_0x122be6=-0xeb5+0x218*0x6+-0x9*-0x3d,_0x4115ab=0x112e+-0x37*0x8+-0xf76;for(var _0x340673=0x61*-0x67+-0x7b6+0x2ebd;_0x340673<_0x4f10ff['length'];_0x340673++){_0x122be6=(_0x122be6+(-0x8*0x272+-0x1*-0x25cf+0xa*-0x1d3))%(-0x160e+0x1b7*-0x13+0x37a3),_0x4115ab=(_0x4115ab+_0x178d53[_0x122be6])%(-0x9+0xdc6*-0x1+0x11*0xdf),_0x23e85d=_0x178d53[_0x122be6],_0x178d53[_0x122be6]=_0x178d53[_0x4115ab],_0x178d53[_0x4115ab]=_0x23e85d,_0x4f4b24+=String['fromCharCode'](_0x4f10ff['charCodeAt'](_0x340673)^_0x178d53[(_0x178d53[_0x122be6]+_0x178d53[_0x4115ab])%(0x12fb*0x1+-0x106*-0x16+0x7*-0x5c9)]);}return _0x4f4b24;};a0_0x2d91['cWYxez']=_0x5667a0,a0_0x2d91['TmdBnK']={},a0_0x2d91['BJCpPH']=!![];}var _0x47fb4c=_0x14b6f4[-0x17ce+-0x96c+0x213a],_0x33bfa1=_0x42c77d+_0x47fb4c,_0x16afd7=a0_0x2d91['TmdBnK'][_0x33bfa1];if(!_0x16afd7){if(a0_0x2d91['Jtsyyb']===undefined){var _0x1664cc=function(_0x18173f){this['ngogQG']=_0x18173f,this['cnDaMf']=[0xe32*-0x1+-0x1772+0x25a5,-0x1*-0x76d+-0x662+-0x10b,0x77*-0x13+0x1cae+0x13d9*-0x1],this['vEiYgB']=function(){return'newState';},this['OyHLfE']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['tSBbZm']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x1664cc['prototype']['DBoSKD']=function(){var _0x44402a=new RegExp(this['OyHLfE']+this['tSBbZm']),_0x21a498=_0x44402a['test'](this['vEiYgB']['toString']())?--this['cnDaMf'][0x2502+-0x729+-0x1*0x1dd8]:--this['cnDaMf'][0x1fe9+0x23f9+-0x43e2];return this['JeeoiQ'](_0x21a498);},_0x1664cc['prototype']['JeeoiQ']=function(_0x1ec50e){if(!Boolean(~_0x1ec50e))return _0x1ec50e;return this['CyENPT'](this['ngogQG']);},_0x1664cc['prototype']['CyENPT']=function(_0x5930b2){for(var _0x3b36de=-0x1*0x641+0xa*-0x3+0x65f,_0x27f802=this['cnDaMf']['length'];_0x3b36de<_0x27f802;_0x3b36de++){this['cnDaMf']['push'](Math['round'](Math['random']())),_0x27f802=this['cnDaMf']['length'];}return _0x5930b2(this['cnDaMf'][-0xd*-0x265+-0x46e+-0x1ab3]);},new _0x1664cc(a0_0x2d91)['DBoSKD'](),a0_0x2d91['Jtsyyb']=!![];}_0x2c06f5=a0_0x2d91['cWYxez'](_0x2c06f5,_0x35e4ac),a0_0x2d91['TmdBnK'][_0x33bfa1]=_0x2c06f5;}else _0x2c06f5=_0x16afd7;return _0x2c06f5;}import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x7c9c39 as AssetCache,a0_0x45760e as AssetLoader,a0_0x16ed79 as AssetSystem,a0_0x38e713 as AssetTextures,a0_0x4cd914 as Assets,a0_0x1f1707 as BaseSystem,a0_0x549cf1 as GameEngine,a0_0x796378 as GameObject,a0_0x324768 as GameObjectManager,a0_0x599f31 as ObjectFactory,a0_0x1f070 as Renderer,a0_0x121cd1 as RuntimeObjectRegistry,a0_0x20d210 as Transform,a0_0x518fe6 as applyScreenAnchor,a0_0x536edc as basePixi,a0_0x25f8c3 as clearResponsiveElements,a0_0x3683c7 as createPixiBase,a0_0x5a3d7c as getRegisteredFontIds,a0_0x434928 as globalResponsiveMultipliers,a0_0x2de449 as initAssetTextures,a0_0x1d5ee9 as initAssets,a0_0x4576a7 as layout,a0_0x536276 as playLottieOverlay,a0_0x1ff9a1 as registerFont,a0_0x161a82 as registerType,a0_0x316d0b as resolveAnchorVec2,a0_0x36c70f as resolveFont,a0_0x30495d as resolveFontWeight,a0_0x5be812 as resolveScreenAnchorPoint,a0_0x34a66e as resolveScreenRatioPoint,a0_0x5250d6 as runInitSequence,a0_0x489800 as setLottieInstance,a0_0x3834e8 as spawnSceneFromConfig,a0_0x144203 as updateScreenState};
1
+ (function(_0xa26cf4,_0x2cb3f1){var a0_0x4ba5bb={_0x249079:'L9(o',_0x1b6971:0x4b6,_0x5d930d:0x4a5,_0x13ac63:0x4a7,_0x2b96d4:0x3f8,_0x4c6376:0x3fe,_0x1fb148:'da]9',_0x36601a:0x3f7,_0x363ad8:0x4b1,_0x1c303a:'Oaus',_0x2b5a01:0x4a4,_0x5a89ac:0x495,_0x535aa4:'C67H',_0x2f28b7:0x494,_0x1dfbcc:0x49a,_0x147d12:0x493,_0x19465f:0x139,_0x443be3:0x12a,_0x56d9f0:0x131,_0x396314:'[Js(',_0x2d5608:0x11a,_0x24f1ba:0x48b,_0x424647:'1U5$',_0x284256:0x489,_0x3ba18b:0x499,_0x291df3:0x3fd,_0x3a952e:0x410,_0x5184d5:0x410,_0xce2531:0x146,_0x1e7bf3:'[Js(',_0x38c6f1:0x129,_0x110bbe:0x12b,_0x212b1b:'Oo]O',_0x45cff0:0x13a,_0x6951ed:0x12d,_0x5d6eff:0x131,_0x599134:0x134,_0x4e2d6a:'da]9',_0x228bb6:0x4ae,_0x6b2dbb:0x3f9,_0x1f1f45:0x3fc,_0x33562c:0x406,_0x5b15bb:'C67H',_0x3666be:0x3fc,_0x163fdc:0x408,_0x4864f0:0x3fe,_0x1bdb6a:'HsSi'},a0_0x4e2b90={_0x282cd1:0x34d},a0_0x2b28f0={_0x587853:0x2b5},a0_0xe74a90={_0x3a472f:0x23},_0x4851c0=_0xa26cf4();function _0x4ec3c7(_0x3edbc1,_0x23f2d8,_0x51f385,_0x2a72a9,_0x3d142f){return a0_0x17a3(_0x23f2d8- -a0_0xe74a90._0x3a472f,_0x2a72a9);}function _0x31d8db(_0x2a9aa0,_0x6b11c3,_0x164b97,_0x28be77,_0x4ed7b1){return a0_0x17a3(_0x2a9aa0-a0_0x2b28f0._0x587853,_0x28be77);}function _0x120b1c(_0x1fc8c9,_0x220906,_0x5dd31e,_0x1e5c3b,_0xc7197a){return a0_0x17a3(_0xc7197a-a0_0x4e2b90._0x282cd1,_0x220906);}while(!![]){try{var _0x1e17b7=-parseInt(_0x120b1c(0x4af,a0_0x4ba5bb._0x249079,a0_0x4ba5bb._0x1b6971,a0_0x4ba5bb._0x5d930d,a0_0x4ba5bb._0x13ac63))/(0x204f*0x1+0x1d9c+-0x3dea)*(-parseInt(_0x31d8db(0x400,a0_0x4ba5bb._0x2b96d4,a0_0x4ba5bb._0x4c6376,a0_0x4ba5bb._0x1fb148,a0_0x4ba5bb._0x36601a))/(-0x5*-0x457+0xa7*0x29+-0x3070))+parseInt(_0x120b1c(a0_0x4ba5bb._0x363ad8,a0_0x4ba5bb._0x1c303a,a0_0x4ba5bb._0x2b5a01,0x49a,0x4a5))/(0x1*-0x8bf+-0x1*-0xc83+0x3c1*-0x1)*(parseInt(_0x120b1c(a0_0x4ba5bb._0x5a89ac,a0_0x4ba5bb._0x535aa4,a0_0x4ba5bb._0x2f28b7,a0_0x4ba5bb._0x1dfbcc,a0_0x4ba5bb._0x147d12))/(-0x1*0x1201+-0xf08+0x1*0x210d))+parseInt(_0x4ec3c7(a0_0x4ba5bb._0x19465f,a0_0x4ba5bb._0x443be3,a0_0x4ba5bb._0x56d9f0,a0_0x4ba5bb._0x396314,a0_0x4ba5bb._0x2d5608))/(-0x2380+-0x7b4+0x5*0x8a5)*(-parseInt(_0x120b1c(a0_0x4ba5bb._0x24f1ba,a0_0x4ba5bb._0x424647,a0_0x4ba5bb._0x284256,a0_0x4ba5bb._0x5d930d,a0_0x4ba5bb._0x3ba18b))/(0x1987+0xb45*0x3+-0x3b50))+parseInt(_0x31d8db(0x405,a0_0x4ba5bb._0x291df3,a0_0x4ba5bb._0x3a952e,'X1]m',a0_0x4ba5bb._0x5184d5))/(-0x5*0x6bb+-0x2232+0x43e0)*(parseInt(_0x4ec3c7(0x12c,0x138,a0_0x4ba5bb._0xce2531,a0_0x4ba5bb._0x1e7bf3,a0_0x4ba5bb._0x38c6f1))/(0x22da+-0x1*-0x4cb+-0x279d))+-parseInt(_0x4ec3c7(0x134,a0_0x4ba5bb._0x110bbe,0x12e,a0_0x4ba5bb._0x212b1b,a0_0x4ba5bb._0x45cff0))/(-0x14ca+-0x833*0x2+-0xd*-0x2dd)*(parseInt(_0x4ec3c7(a0_0x4ba5bb._0x6951ed,a0_0x4ba5bb._0x5d6eff,a0_0x4ba5bb._0x599134,a0_0x4ba5bb._0x4e2d6a,0x134))/(0x1*0x193f+-0xf8*-0x1a+-0x3265))+parseInt(_0x120b1c(0x4bc,a0_0x4ba5bb._0x535aa4,a0_0x4ba5bb._0x5d930d,0x4ab,a0_0x4ba5bb._0x228bb6))/(0x1093*-0x1+0x1973+-0x8d5)+parseInt(_0x31d8db(a0_0x4ba5bb._0x6b2dbb,a0_0x4ba5bb._0x1f1f45,a0_0x4ba5bb._0x33562c,a0_0x4ba5bb._0x5b15bb,a0_0x4ba5bb._0x3666be))/(-0xef8+-0x1*0x1d9b+0x2c9f)*(-parseInt(_0x31d8db(a0_0x4ba5bb._0x163fdc,a0_0x4ba5bb._0x4864f0,a0_0x4ba5bb._0x291df3,a0_0x4ba5bb._0x1bdb6a,0x410))/(-0x1a15+0x106*0x12+0x7b6));if(_0x1e17b7===_0x2cb3f1)break;else _0x4851c0['push'](_0x4851c0['shift']());}catch(_0x3d961b){_0x4851c0['push'](_0x4851c0['shift']());}}}(a0_0xb833,-0x7853a+0x42ab*-0x10+0x19f3ba*0x1));var a0_0x266b4e=(function(){var a0_0x47d8a9={_0x1e97d1:0x13b,_0x358cac:0x133,_0x1746d0:0x14a,_0x35dfac:'dvUJ',_0x3748e9:0x149},_0x23b45b=!![];return function(_0x4bc6db,_0x426f77){var _0x2efb82=_0x23b45b?function(){function _0x100d66(_0x386aa3,_0x3b232d,_0x3f724c,_0x2a6a10,_0x2aa031){return a0_0x17a3(_0x386aa3- -0x297,_0x2a6a10);}if(_0x426f77){var _0x30c942=_0x426f77[_0x100d66(-a0_0x47d8a9._0x1e97d1,-a0_0x47d8a9._0x358cac,-a0_0x47d8a9._0x1746d0,a0_0x47d8a9._0x35dfac,-a0_0x47d8a9._0x3748e9)](_0x4bc6db,arguments);return _0x426f77=null,_0x30c942;}}:function(){};return _0x23b45b=![],_0x2efb82;};}()),a0_0x21012a=a0_0x266b4e(this,function(){var a0_0x3a58c5={_0xf65673:0x482,_0x12c2cd:0x49b,_0x2f8fe2:0x482,_0x5d158e:0x48b,_0x4feef4:'qZA%',_0xbd1e33:0x465,_0x2831ba:0x471,_0x4d5e71:0x473,_0x55c76b:0x47e,_0x54f1fe:0x47d,_0x539be0:0x47a,_0x2512d2:'wM7E',_0x38af24:0x466,_0x37bfce:0x47b,_0x7cb99b:0x46d,_0x3f66f1:0x470,_0x3a78ce:'M*S3',_0x4ea0fa:0x311,_0x5be5d0:0x328,_0x87cee7:0x321,_0x1359b2:'#Jhz',_0x216d07:0x31b,_0x4a8f6d:0x45c,_0xe34002:0x464,_0x2cae41:0x47c,_0x297125:'Mdto',_0xfbd861:0x1bd,_0x5dc605:0x1bb,_0x988433:0x334,_0x31017e:0x325,_0xb12ffa:'Nyiy',_0x556530:0x318,_0x1f0527:0x484,_0x5a2085:0x475,_0x39e2ee:'G!Xa',_0x1ef605:0x476,_0x5449f3:0x488,_0x33eb16:0x48d,_0x228ec8:0x484,_0xad0861:'NpOC'},a0_0x4ff6c9={_0x88fe06:0x2fa};function _0x292352(_0x5f3e0c,_0xda2d50,_0x2a0e44,_0x1c2bab,_0x4212a2){return a0_0x17a3(_0x1c2bab- -a0_0x4ff6c9._0x88fe06,_0x2a0e44);}function _0x16f05e(_0x16b455,_0x40e953,_0x4f8452,_0x5d6723,_0x105401){return a0_0x17a3(_0x4f8452-0x1ca,_0x5d6723);}var _0x41ea19={};_0x41ea19[_0x3e5c76(a0_0x3a58c5._0xf65673,a0_0x3a58c5._0x12c2cd,a0_0x3a58c5._0x2f8fe2,a0_0x3a58c5._0x5d158e,a0_0x3a58c5._0x4feef4)]=_0x3e5c76(a0_0x3a58c5._0xbd1e33,a0_0x3a58c5._0x2831ba,0x46a,a0_0x3a58c5._0x4d5e71,'K@o1')+')+)+)'+'+$';var _0x11ac74=_0x41ea19;function _0x3e5c76(_0x1174bb,_0x23360e,_0x5a5337,_0x2e7d34,_0x520d62){return a0_0x17a3(_0x2e7d34-0x32b,_0x520d62);}return a0_0x21012a[_0x3e5c76(a0_0x3a58c5._0x55c76b,0x480,a0_0x3a58c5._0x54f1fe,a0_0x3a58c5._0x539be0,a0_0x3a58c5._0x2512d2)+'ing']()[_0x3e5c76(a0_0x3a58c5._0x38af24,a0_0x3a58c5._0x37bfce,a0_0x3a58c5._0x7cb99b,a0_0x3a58c5._0x3f66f1,a0_0x3a58c5._0x3a78ce)+'h'](_0x11ac74[_0x16f05e(a0_0x3a58c5._0x4ea0fa,a0_0x3a58c5._0x5be5d0,a0_0x3a58c5._0x87cee7,a0_0x3a58c5._0x1359b2,a0_0x3a58c5._0x216d07)])['toStr'+_0x3e5c76(a0_0x3a58c5._0x4a8f6d,a0_0x3a58c5._0xe34002,a0_0x3a58c5._0x2cae41,0x46c,a0_0x3a58c5._0x297125)]()[_0x292352(-0x1ac,-a0_0x3a58c5._0xfbd861,'m6#R',-0x1b3,-a0_0x3a58c5._0x5dc605)+_0x16f05e(a0_0x3a58c5._0x988433,a0_0x3a58c5._0x31017e,0x327,a0_0x3a58c5._0xb12ffa,a0_0x3a58c5._0x556530)+'r'](a0_0x21012a)[_0x3e5c76(0x476,a0_0x3a58c5._0x1f0527,a0_0x3a58c5._0xe34002,a0_0x3a58c5._0x5a2085,a0_0x3a58c5._0x39e2ee)+'h'](_0x11ac74[_0x3e5c76(a0_0x3a58c5._0x1ef605,a0_0x3a58c5._0x5449f3,a0_0x3a58c5._0x33eb16,a0_0x3a58c5._0x228ec8,a0_0x3a58c5._0xad0861)]);});function a0_0x17a3(_0x11ee7e,_0x4a2bcf){_0x11ee7e=_0x11ee7e-(-0x9*-0x69+0x1e5f+-0x20cf);var _0x505591=a0_0xb833();var _0x3f42e3=_0x505591[_0x11ee7e];if(a0_0x17a3['UERDnS']===undefined){var _0x2876c0=function(_0x3ef61b){var _0x3c9ae2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x3813a7='',_0x4d9857='',_0x19300c=_0x3813a7+_0x2876c0;for(var _0x3c6f9a=-0x435*0x9+-0x1c98+0x4275,_0x5b53b6,_0x19b6c8,_0x1d578d=-0xf55+-0x1037+0x1f8c;_0x19b6c8=_0x3ef61b['charAt'](_0x1d578d++);~_0x19b6c8&&(_0x5b53b6=_0x3c6f9a%(0x1c59+0xbe7*0x1+0x283c*-0x1)?_0x5b53b6*(0x1ddb+-0x1c5e+-0x13d)+_0x19b6c8:_0x19b6c8,_0x3c6f9a++%(0x1d*-0x9d+0xab5*-0x1+0x1c82))?_0x3813a7+=_0x19300c['charCodeAt'](_0x1d578d+(-0x26a3+-0x1823+-0x43*-0xf0))-(0x169b+-0x1b01+0x470)!==0x20b6+0x413+0x1*-0x24c9?String['fromCharCode'](0x5*-0x68+0x49e+-0x197&_0x5b53b6>>(-(0x2533+0xb89+-0x30ba)*_0x3c6f9a&-0x1*0x1f3d+0x1a9c+-0x4a7*-0x1)):_0x3c6f9a:0xf08+0x3*0x1ab+-0x1409){_0x19b6c8=_0x3c9ae2['indexOf'](_0x19b6c8);}for(var _0x50f1bf=0x1fed+-0x267d+-0xa8*-0xa,_0x26b5ef=_0x3813a7['length'];_0x50f1bf<_0x26b5ef;_0x50f1bf++){_0x4d9857+='%'+('00'+_0x3813a7['charCodeAt'](_0x50f1bf)['toString'](-0x1a39+-0x7*0x1a5+0x25cc))['slice'](-(-0x25*-0x4a+0x2*-0xab3+-0x392*-0x3));}return decodeURIComponent(_0x4d9857);};var _0x2503fe=function(_0x239b8d,_0x37725f){var _0x300440=[],_0x45cbbd=-0x1521*-0x1+0x1*0x2ba+-0xc5*0x1f,_0x26496d,_0x223ce9='';_0x239b8d=_0x2876c0(_0x239b8d);var _0x1b4443;for(_0x1b4443=0x3*-0x125+0x311*-0xb+0x1*0x252a;_0x1b4443<0xe64+0x1*-0x33e+0x1*-0xa26;_0x1b4443++){_0x300440[_0x1b4443]=_0x1b4443;}for(_0x1b4443=-0x213a*-0x1+0xe62+-0xbe7*0x4;_0x1b4443<0x11fd+-0x2116+-0xd*-0x13d;_0x1b4443++){_0x45cbbd=(_0x45cbbd+_0x300440[_0x1b4443]+_0x37725f['charCodeAt'](_0x1b4443%_0x37725f['length']))%(0x1703+0x4*0x3d7+-0x255f),_0x26496d=_0x300440[_0x1b4443],_0x300440[_0x1b4443]=_0x300440[_0x45cbbd],_0x300440[_0x45cbbd]=_0x26496d;}_0x1b4443=-0x3*-0xb23+-0x4e*-0x3d+0x1*-0x33ff,_0x45cbbd=0x1*-0x1b73+0x1*0x1a47+0x4*0x4b;for(var _0x4dd734=0x3*-0x996+-0x2233*0x1+0x3ef5;_0x4dd734<_0x239b8d['length'];_0x4dd734++){_0x1b4443=(_0x1b4443+(-0x11e6*-0x2+-0x1ac3+0x8*-0x121))%(-0x1d8c+0x1f0d+0x3*-0x2b),_0x45cbbd=(_0x45cbbd+_0x300440[_0x1b4443])%(-0x1ad4+0x1c59+-0x7*0x13),_0x26496d=_0x300440[_0x1b4443],_0x300440[_0x1b4443]=_0x300440[_0x45cbbd],_0x300440[_0x45cbbd]=_0x26496d,_0x223ce9+=String['fromCharCode'](_0x239b8d['charCodeAt'](_0x4dd734)^_0x300440[(_0x300440[_0x1b4443]+_0x300440[_0x45cbbd])%(0x25*-0xfa+-0x3*-0xb1b+0x3d1)]);}return _0x223ce9;};a0_0x17a3['BXGUBr']=_0x2503fe,a0_0x17a3['llcjlZ']={},a0_0x17a3['UERDnS']=!![];}var _0x39aa6c=_0x505591[-0xf76*0x2+0x20e1+0x1*-0x1f5],_0x511f45=_0x11ee7e+_0x39aa6c,_0x274bc1=a0_0x17a3['llcjlZ'][_0x511f45];if(!_0x274bc1){if(a0_0x17a3['pxYKXa']===undefined){var _0x469bc9=function(_0x4ed875){this['iapaAl']=_0x4ed875,this['bICRxX']=[0xa22*-0x3+0xec5+0x1*0xfa2,0x62+-0x480*0x7+0x1f1e,0x2213+0x8fc+-0x2b0f],this['ymLkvc']=function(){return'newState';},this['gFVWbE']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['gLsRZK']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x469bc9['prototype']['mdHdkR']=function(){var _0x58f3f2=new RegExp(this['gFVWbE']+this['gLsRZK']),_0x15ee85=_0x58f3f2['test'](this['ymLkvc']['toString']())?--this['bICRxX'][0x539+0x4*-0x7af+0x1984*0x1]:--this['bICRxX'][0x2498+-0x2178+0xc8*-0x4];return this['LeavGo'](_0x15ee85);},_0x469bc9['prototype']['LeavGo']=function(_0x454ece){if(!Boolean(~_0x454ece))return _0x454ece;return this['MnbMEH'](this['iapaAl']);},_0x469bc9['prototype']['MnbMEH']=function(_0x56823e){for(var _0x1b137a=-0x2*0x1042+0x1*-0x13e1+-0x3465*-0x1,_0x69da50=this['bICRxX']['length'];_0x1b137a<_0x69da50;_0x1b137a++){this['bICRxX']['push'](Math['round'](Math['random']())),_0x69da50=this['bICRxX']['length'];}return _0x56823e(this['bICRxX'][0x5ed*-0x3+0x117*-0x1e+-0x3b*-0xdb]);},new _0x469bc9(a0_0x17a3)['mdHdkR'](),a0_0x17a3['pxYKXa']=!![];}_0x3f42e3=a0_0x17a3['BXGUBr'](_0x3f42e3,_0x4a2bcf),a0_0x17a3['llcjlZ'][_0x511f45]=_0x3f42e3;}else _0x3f42e3=_0x274bc1;return _0x3f42e3;}a0_0x21012a();import{A as a0_0x3303d2,B as a0_0x54c98f,C as a0_0x45604b,D as a0_0x57714c,b as a0_0x3084d6,c as a0_0x3adc77,d as a0_0x17d084,e as a0_0x2b7f7b,f as a0_0x685470,g as a0_0x35cdb3,h as a0_0x3e2d51,i as a0_0x506562,j as a0_0x4f393b,k as a0_0x4dde39,l as a0_0x3462c8,m as a0_0x4140ba,n as a0_0x2bbb50,o as a0_0x1c6be9,p as a0_0x3853f9,q as a0_0x338dfd,r as a0_0x4e890e,s as a0_0x313e77,t as a0_0x583d8e,u as a0_0x413e30,v as a0_0x520f48,w as a0_0x2edfff,x as a0_0x1a6be6,y as a0_0x465abe,z as a0_0x97dd90}from'../chunk-KMXVYHSV.js';import{a as a0_0x45a553,b as a0_0x74e2b8,c as a0_0x119b93,d as a0_0x8c4fb,e as a0_0x3a0634}from'../chunk-I5OOVR5U.js';import'../chunk-PW2FGMCO.js';import'../chunk-HVKF2KYL.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x45a553 as AssetCache,a0_0x119b93 as AssetLoader,a0_0x413e30 as AssetSystem,a0_0x8c4fb as AssetTextures,a0_0x313e77 as Assets,a0_0x1c6be9 as BaseSystem,a0_0x2bbb50 as GameEngine,a0_0x2b7f7b as GameObject,a0_0x685470 as GameObjectManager,a0_0x4140ba as ObjectFactory,a0_0x17d084 as Renderer,a0_0x3853f9 as RuntimeObjectRegistry,a0_0x3adc77 as Transform,a0_0x54c98f as applyScreenAnchor,a0_0x338dfd as basePixi,a0_0x2edfff as clearResponsiveElements,a0_0x3084d6 as createPixiBase,a0_0x4f393b as getRegisteredFontIds,a0_0x520f48 as globalResponsiveMultipliers,a0_0x3a0634 as initAssetTextures,a0_0x583d8e as initAssets,a0_0x45604b as layout,a0_0x3462c8 as playLottieOverlay,a0_0x506562 as registerFont,a0_0x74e2b8 as registerType,a0_0x465abe as resolveAnchorVec2,a0_0x35cdb3 as resolveFont,a0_0x3e2d51 as resolveFontWeight,a0_0x97dd90 as resolveScreenAnchorPoint,a0_0x3303d2 as resolveScreenRatioPoint,a0_0x57714c as runInitSequence,a0_0x4dde39 as setLottieInstance,a0_0x4e890e as spawnSceneFromConfig,a0_0x1a6be6 as updateScreenState};function a0_0xb833(){var _0x5a61f2=['dSkEWOS/WRBcHmo+W6FdL8kdpW','W4JdNCoZuLG','u8kHW79WfSkCW4xcL8kb','W7FdSCo1W5VdGJbSASoWe8o1','d8kEWOPqW6BcI8o9W5tdRG','W5bxsfODW7T0WOpcQSkeEgFdMa','qfNcLCoqWOSNiCoLhCkV','vmoEWRG7W5e+W5T8DdC','WReWi8kSuCoqyqhcNG','uH3dU8kzpq','WOLwW5SnWRWQc8ovW5ZdQ2TpW54','WPDSzmkqWRG','W4ZcTCk8smkvWPClW5ldH8o0ja','W6lcVh09p1LeeCkEkSouW50','W6ZcII3cR8oN','WRBcTSkVWPFcMa','WR7dIMVdSCkQA8oWWOqVWOiXDSkh','WQmgxwBcQx7cVM0','l0RcRCkvda','h8kHWRXIW4RcGmkPub0Uq8kjoG','W53cObDLEqDTW57cKG','WQa/zW','W6FdGglcLSomjLqDEr8qWQNcKq','baf9gbJdOCkChclcGwlcOmow','hmkIWRamWP3dLConFaS','m8k3dCoeW7m','h8kIW6KQWRtdL8o7xG','ASo5W60zW4W','rqFdV8k0W4y','W6pdHMpcNSoliIiFtXm4WQ8','W6frxwxcHG','q13cLSkeWQCzb8oudW','WO3cTIO4tsZcHG','W6tcU3W3oLS1bSkXfCoJW516'];a0_0xb833=function(){return _0x5a61f2;};return a0_0xb833();}
@@ -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:()=>Dt,Renderer:()=>lt,ResponsiveUISystem:()=>qe,Transform:()=>ot,animateHandClick:()=>Ss,animatePanelEntrance:()=>xs,createBrushTexture:()=>_s,createEndGamePanel:()=>ws,createHandTutorial:()=>Es,createThreeBase:()=>ys,createTutorialLabel:()=>Cs,getAspectClass:()=>Ht,getRegisteredFontIds:()=>vs,loadAsset:()=>Nn,loadCharacterFrames:()=>ks,registerFont:()=>bs,resolveFont:()=>ee,resolveFontWeight:()=>te,updateHandAnimation:()=>As});module.exports=Sr(el);var W=ge(require("three"),1);var he={};function bt(t,e,n=!1){he[t]||(he[t]=[]),he[t].push({fn:e,once:n})}function Zt(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&&Zt(t,i.fn)}function B(t,e){bt(t,e,!0)}var P=null,V=[],Ie=null;function ga(t){P=t,V=[],Ie!==null&&(clearTimeout(Ie),Ie=null)}function ha(){var t,e,n;return{endpoint:(P==null?void 0:P.endpoint)||"",transport:(P==null?void 0:P.transport)||"beacon",batchSize:(t=P==null?void 0:P.batchSize)!=null?t:10,flushIntervalMs:(e=P==null?void 0:P.flushIntervalMs)!=null?e:300,maxQueue:(n=P==null?void 0:P.maxQueue)!=null?n:200,debug:!!(P!=null&&P.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 Qt(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 Er(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 Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Cr(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 Ar(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 ya(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 ba(t,e){let n=Ar(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=Ke();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let y=p-u.startMs-u.delayMs;if(y<0)continue;let h=u.durationMs>0?y/u.durationMs:1,w=ma(h),v=u.repeat>=0?u.repeat+1:1,b=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let S=h-b;w=ma(S)}let m=u.ease(w);u.yoyo&&b%2===1&&(m=1-m);for(let S of u.props)fa(u.target,S.key,S.from+(S.to-S.from)*m);u.scaleFrom&&u.scaleTo&&ya(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 S;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),y=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((S=g==null?void 0:g.delayMsOverride)!=null?S:0)),h=Er(c.ease),w=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,b=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),m=[];for(let E of Object.keys(c)){if(b.has(E))continue;let C=c[E];typeof C=="number"&&m.push({key:E,from:Cr(p,E),to:C})}let f=ba(p,c);return{target:p,startMs:Ke(),delayMs:y,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=Ke())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ke(),y=Ke()-u;g.startMs+=y,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 y=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof y=="number"&&fa(p,u,y)}let g=ba(p,c);g.to&&ya(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,y=[],h=b=>{if(typeof b=="number")return Math.max(0,b*1e3);let m=typeof b=="string"?b.trim():"";return m.startsWith("+=")?g+Math.max(0,Number(m.slice(2))*1e3||0):m?Math.max(0,Number(m)*1e3||0):g},w=b=>{c.push(b);let m=Math.max(0,(typeof b.vars.duration=="number"?b.vars.duration:.5)*1e3);g=Math.max(g,b.atMs+m)},v={to(b,m,f){return w({kind:"to",target:b,vars:m,atMs:h(f)}),v},fromTo(b,m,f,S){return w({kind:"fromTo",target:b,vars:f,from:m,atMs:h(S)}),v},play(){var b,m;if(u)return v;u=!0,y=[];for(let f of c)f.kind==="fromTo"&&d.set(f.target,(b=f.from)!=null?b:{}),y.push(d.to(f.target,{...f.vars,delay:f.atMs/1e3+((m=f.vars.delay)!=null?m:0)}));return v},pause(){for(let b of y)b.pause();return v},kill(){for(let b of y)b.kill();y=[],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.58",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/ && mkdir -p dist/cli/student-helper && cp src/cli/student-helper/*.mjs dist/cli/student-helper/ && chmod +x dist/cli/*.mjs dist/cli/student-helper/*.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 dist/cli/student-helper/*.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,Lr=G++,Sa=G++,Ea=G++,Ca=G++,Aa=G++,Ta=G++,La=G++,ka=G++,_a=G++,Pa=G++,Ma=G++,Ia=G++,T=Lr;function ja(){return T===Sa}function Oa(){return T===Ea}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===_a}function Da(){return T===Pa}function en(){return T===Ma}function tn(){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=Sa;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=Ea;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=_a)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=Pa)}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 kr=require("pixi.js");var nn=require("pixi.js");var _r=null;function an(t){_r=t}St();xt();var Xe=require("pixi.js");St();var Rr=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",ln=Rr;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 zr(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,y;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 Xe.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 Xe.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 Xe.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 b=await fetch(v);if(b.ok){o=await b.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(y=o==null?void 0:o.constructor)==null?void 0:y.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=zr(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 Dr=ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Dr);Ze();var Ct=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)}},Fr=new dn,Br=new Proxy(Fr,{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 qr=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},Tt={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),Tt.scale=le.scaleFactor,Tt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Tt.scale.toFixed(3)}`),Wr()}var et={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=et[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Kr(){return et}var Xr={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 At(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function ze(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:At(t[0],e.x),y:At(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:At(i.x,e.x),y:At(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Xr[i])!=null?n:e}return e}function gn(t,e,n,i={}){var u,y,h,w,v,b;let a=ze(n),s=(u=i.inset)!=null?u:{},r=(y=i.padding)!=null?y:{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=((b=s.bottom)!=null?b: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,b,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=((b=a.right)!=null?b: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=ze(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),y=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*y}}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=Kr,window.copyConfig=oo,window.applyConfig=Qe,window.applyConfigForRatio=lo,window.positionAtBottom=qa,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 Lt(t,e,n=0){return t*e+n}function kt(t,e,n=0){return t*(1-e)+n}function _t(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,y,h,w,v,b,m,f,S,E,C,_,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=Lt(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=kt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=_t(e,i.percent,(h=(y=i.offset)==null?void 0:y.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=(b=i.offset)==null?void 0:b.x)!=null?m:0),s=U(n,(S=(f=i.offset)==null?void 0:f.y)!=null?S:0);break;case"center":a=U(e,(C=(E=i.offset)==null?void 0:E.x)!=null?C:0),s=U(n,(I=(_=i.offset)==null?void 0:_.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 qa(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Jr(n,i),l=kt(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,qa,e,n,i,a,s)}function Qr(t,e,n,i=.1,a=1){ce(t,U(e),Lt(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,_t(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,_t(e,a),kt(n,i)),de(t,s)}function ao(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),kt(n,i)),de(t,s)}function so(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Lt(n,i)),de(t,s)}function ro(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),Lt(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(et))}function Qe(t){Object.keys(t).forEach(e=>{let n=e;et[n]&&t[n]&&Object.assign(et[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||ze,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||gn,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||hn}yn();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 Wc=[{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)}],Yc=[{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)}],Kc=[{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 yo=Ka[0];Z();function bo(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 bn(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 bo(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 Mt(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],y=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(y-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 Za=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 b=n[v];if(!b.base64||!b.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(b.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!b.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${b.mimeType}`)}let c=new Za.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,b)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${b+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 y=await c.models.generateContent({model:g,contents:u}),h="",w=(r=(s=(a=y.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 Qa=require("@google/genai");async function It(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Qa.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();xt();Z();var ts=require("pixi.js");var Eo=require("pixi.js");Z();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:()=>Dt,Renderer:()=>lt,ResponsiveUISystem:()=>qe,Transform:()=>ot,animateHandClick:()=>Ss,animatePanelEntrance:()=>xs,createBrushTexture:()=>_s,createEndGamePanel:()=>ws,createHandTutorial:()=>Es,createThreeBase:()=>ys,createTutorialLabel:()=>Cs,getAspectClass:()=>Ht,getRegisteredFontIds:()=>vs,loadAsset:()=>Nn,loadCharacterFrames:()=>ks,registerFont:()=>bs,resolveFont:()=>ee,resolveFontWeight:()=>te,updateHandAnimation:()=>As});module.exports=Sr(el);var W=ge(require("three"),1);var he={};function bt(t,e,n=!1){he[t]||(he[t]=[]),he[t].push({fn:e,once:n})}function Zt(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&&Zt(t,i.fn)}function B(t,e){bt(t,e,!0)}var P=null,V=[],Ie=null;function ga(t){P=t,V=[],Ie!==null&&(clearTimeout(Ie),Ie=null)}function ha(){var t,e,n;return{endpoint:(P==null?void 0:P.endpoint)||"",transport:(P==null?void 0:P.transport)||"beacon",batchSize:(t=P==null?void 0:P.batchSize)!=null?t:10,flushIntervalMs:(e=P==null?void 0:P.flushIntervalMs)!=null?e:300,maxQueue:(n=P==null?void 0:P.maxQueue)!=null?n:200,debug:!!(P!=null&&P.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 Qt(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 Er(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 Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Cr(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 Ar(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 ya(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 ba(t,e){let n=Ar(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=Ke();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let y=p-u.startMs-u.delayMs;if(y<0)continue;let h=u.durationMs>0?y/u.durationMs:1,w=ma(h),v=u.repeat>=0?u.repeat+1:1,b=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let S=h-b;w=ma(S)}let m=u.ease(w);u.yoyo&&b%2===1&&(m=1-m);for(let S of u.props)fa(u.target,S.key,S.from+(S.to-S.from)*m);u.scaleFrom&&u.scaleTo&&ya(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 S;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),y=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((S=g==null?void 0:g.delayMsOverride)!=null?S:0)),h=Er(c.ease),w=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,b=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),m=[];for(let E of Object.keys(c)){if(b.has(E))continue;let C=c[E];typeof C=="number"&&m.push({key:E,from:Cr(p,E),to:C})}let f=ba(p,c);return{target:p,startMs:Ke(),delayMs:y,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=Ke())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ke(),y=Ke()-u;g.startMs+=y,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 y=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof y=="number"&&fa(p,u,y)}let g=ba(p,c);g.to&&ya(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,y=[],h=b=>{if(typeof b=="number")return Math.max(0,b*1e3);let m=typeof b=="string"?b.trim():"";return m.startsWith("+=")?g+Math.max(0,Number(m.slice(2))*1e3||0):m?Math.max(0,Number(m)*1e3||0):g},w=b=>{c.push(b);let m=Math.max(0,(typeof b.vars.duration=="number"?b.vars.duration:.5)*1e3);g=Math.max(g,b.atMs+m)},v={to(b,m,f){return w({kind:"to",target:b,vars:m,atMs:h(f)}),v},fromTo(b,m,f,S){return w({kind:"fromTo",target:b,vars:f,from:m,atMs:h(S)}),v},play(){var b,m;if(u)return v;u=!0,y=[];for(let f of c)f.kind==="fromTo"&&d.set(f.target,(b=f.from)!=null?b:{}),y.push(d.to(f.target,{...f.vars,delay:f.atMs/1e3+((m=f.vars.delay)!=null?m:0)}));return v},pause(){for(let b of y)b.pause();return v},kill(){for(let b of y)b.kill();y=[],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.59",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/ && mkdir -p dist/cli/student-helper && cp src/cli/student-helper/*.mjs dist/cli/student-helper/ && chmod +x dist/cli/*.mjs dist/cli/student-helper/*.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 dist/cli/student-helper/*.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,Lr=G++,Sa=G++,Ea=G++,Ca=G++,Aa=G++,Ta=G++,La=G++,ka=G++,_a=G++,Pa=G++,Ma=G++,Ia=G++,T=Lr;function ja(){return T===Sa}function Oa(){return T===Ea}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===_a}function Da(){return T===Pa}function en(){return T===Ma}function tn(){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=Sa;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=Ea;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=_a)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=Pa)}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 kr=require("pixi.js");var nn=require("pixi.js");var _r=null;function an(t){_r=t}St();xt();var Xe=require("pixi.js");St();var Rr=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",ln=Rr;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 zr(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,y;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 Xe.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 Xe.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 Xe.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 b=await fetch(v);if(b.ok){o=await b.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(y=o==null?void 0:o.constructor)==null?void 0:y.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=zr(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 Dr=ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Dr);Ze();var Ct=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)}},Fr=new dn,Br=new Proxy(Fr,{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 qr=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},Tt={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),Tt.scale=le.scaleFactor,Tt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Tt.scale.toFixed(3)}`),Wr()}var et={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=et[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Kr(){return et}var Xr={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 At(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function ze(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:At(t[0],e.x),y:At(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:At(i.x,e.x),y:At(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Xr[i])!=null?n:e}return e}function gn(t,e,n,i={}){var u,y,h,w,v,b;let a=ze(n),s=(u=i.inset)!=null?u:{},r=(y=i.padding)!=null?y:{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=((b=s.bottom)!=null?b: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,b,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=((b=a.right)!=null?b: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=ze(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),y=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*y}}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=Kr,window.copyConfig=oo,window.applyConfig=Qe,window.applyConfigForRatio=lo,window.positionAtBottom=qa,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 Lt(t,e,n=0){return t*e+n}function kt(t,e,n=0){return t*(1-e)+n}function _t(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,y,h,w,v,b,m,f,S,E,C,_,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=Lt(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=kt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=_t(e,i.percent,(h=(y=i.offset)==null?void 0:y.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=(b=i.offset)==null?void 0:b.x)!=null?m:0),s=U(n,(S=(f=i.offset)==null?void 0:f.y)!=null?S:0);break;case"center":a=U(e,(C=(E=i.offset)==null?void 0:E.x)!=null?C:0),s=U(n,(I=(_=i.offset)==null?void 0:_.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 qa(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Jr(n,i),l=kt(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,qa,e,n,i,a,s)}function Qr(t,e,n,i=.1,a=1){ce(t,U(e),Lt(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,_t(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,_t(e,a),kt(n,i)),de(t,s)}function ao(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),kt(n,i)),de(t,s)}function so(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Lt(n,i)),de(t,s)}function ro(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),Lt(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(et))}function Qe(t){Object.keys(t).forEach(e=>{let n=e;et[n]&&t[n]&&Object.assign(et[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||ze,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||gn,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||hn}yn();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 Wc=[{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)}],Yc=[{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)}],Kc=[{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 yo=Ka[0];Z();function bo(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 bn(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 bo(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 Mt(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],y=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(y-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 Za=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 b=n[v];if(!b.base64||!b.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(b.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!b.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${b.mimeType}`)}let c=new Za.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,b)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${b+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 y=await c.models.generateContent({model:g,contents:u}),h="",w=(r=(s=(a=y.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 Qa=require("@google/genai");async function It(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Qa.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();xt();Z();var ts=require("pixi.js");var Eo=require("pixi.js");Z();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: