handler-playable-sdk 1.0.79 → 1.0.81

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-EH5WKDJS.js → chunk-XRNPUYEG.js} +5 -5
  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 +2 -2
  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=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let l=o.target.dataset.tab;l&&this.switchTab(l)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var ur={};mn(ur,{AssetCache:()=>re,AssetLoader:()=>Pe,AssetSystem:()=>li,AssetTextures:()=>Ie,Assets:()=>Ha,BaseSystem:()=>rt,GameEngine:()=>oi,GameObject:()=>Ot,GameObjectManager:()=>at,ObjectFactory:()=>ye,Renderer:()=>_t,RuntimeObjectRegistry:()=>ot,Transform:()=>jt,applyScreenAnchor:()=>Ft,basePixi:()=>za,clearResponsiveElements:()=>ia,createPixiBase:()=>si,getRegisteredFontIds:()=>ja,globalResponsiveMultipliers:()=>St,initAssetTextures:()=>Zt,initAssets:()=>Fa,layout:()=>aa,playLottieOverlay:()=>Oa,registerFont:()=>Ma,registerType:()=>Xt,resolveAnchorVec2:()=>Te,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 Le={};function zt(i,e,t=!1){Le[i]||(Le[i]=[]),Le[i].push({fn:e,once:t})}function di(i,e){if(Le[i]){if(!e){delete Le[i];return}Le[i]=Le[i].filter(t=>t.fn!==e)}}function $t(i,...e){let t=Le[i];if(t)for(let n of[...t])n.fn(...e),n.once&&di(i,n.fn)}function ee(i,e){zt(i,e,!0)}var $=null,ae=[],We=null;function wn(i){$=i,ae=[],We!==null&&(clearTimeout(We),We=null)}function xn(){var i,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(i=$==null?void 0:$.batchSize)!=null?i:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function yn(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(s){n&&console.warn("[handler.telemetry] fetch failed",s)}}function pi(i,e){let t=xn();if(e&&t.endpoint){if(ae.push(i),ae.length>t.maxQueue&&(ae=ae.slice(ae.length-t.maxQueue)),ae.length>=t.batchSize){vn();return}We===null&&(We=window.setTimeout(()=>{We=null,vn()},t.flushIntervalMs))}}async function vn(){let i=xn();if(!i.endpoint||ae.length===0)return;let e=ae.splice(0,i.batchSize);await yn(i.endpoint,{events:e},i.transport,i.debug),ae.length>0&&await yn(i.endpoint,{events:ae.splice(0,i.batchSize)},i.transport,i.debug)}function Sn(i){return Math.max(0,Math.min(1,i))}function Ka(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function wt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Xa(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function En(i,e,t){try{i[e]=t}catch{}}function Ja(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function Cn(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function An(i,e){let t=Ja(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function Ln(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=u=>{var p;i.add(u);let d=(p=e.get(u.target))!=null?p:new Set;d.add(u),e.set(u.target,d),n()},s=u=>{i.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(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,C=Sn(f),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let x=f-h;C=Sn(x)}let y=g.ease(C);g.yoyo&&h%2===1&&(y=1-y);for(let x of g.props)En(g.target,x.key,x.from+(x.to-x.from)*y);g.scaleFrom&&g.scaleTo&&Cn(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(f>=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),m=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),f=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=An(u,d);return{target:u,startMs:wt(),delayMs:m,durationMs:g,ease:f,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 f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:wt(),m=wt()-g;p.startMs+=m,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 m=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&En(u,g,m)}let p=An(u,d);p.to&&Cn(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,m=[],f=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:f(w)}),b},fromTo(h,y,w,x){return C({kind:"fromTo",target:h,vars:w,from:y,atMs:f(x)}),b},play(){var h,y;if(g)return b;g=!0,m=[];for(let w of d)w.kind==="fromTo"&&l.set(w.target,(h=w.from)!=null?h:{}),m.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 m)h.pause();return b},kill(){for(let h of m)h.kill();m=[],g=!1}};return u.paused||b.play(),b}};return l}function Tn(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=Ln()}catch{}}var kn={name:"handler-playable-sdk",version:"1.0.79",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++,Pn=te++,In=te++,Mn=te++,jn=te++,_n=te++,On=te++,Rn=te++,zn=te++,$n=te++,Dn=te++,Nn=te++,j=Qa;function Hn(){return j===Pn}function Fn(){return j===In}function Bn(){return j===Mn}function Gn(){return j===jn}function Ye(){return j===_n}function Ke(){return j===On}function Un(){return j===Rn}function qn(){return j===zn}function Vn(){return j===$n}function ui(){return j===Dn}function gi(){return j===Nn}function Wn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),j=Pn;return}catch{}else if(i==="dapi")try{dapi.isReady(),j=In;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(j=Mn)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(j=jn)}catch{}else if(e==="mintegral")window.gameReady&&(j=_n);else if(e==="tapjoy")window.TJ_API&&(j=On);else if(e==="tiktok")window.openAppStore&&(j=Rn);else if(e==="smadex")try{window.smxTracking&&(j=zn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(j=$n)}catch{}else e==="vungle"?j=Dn:(i==="nucleo"||e==="nucleo")&&(j=Nn)}var Dt=ci(require("lottie-web"),1),Yn=Dt.default;typeof window!="undefined"&&(window.lottie=Dt.default,window.__baseLottie=Dt.default);mi();function D(i,e){let t=(a,s)=>s===0?a:t(s,a%s),n=t(i,e);return`${i/n}:${e/n}`}var 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)}],Zn=[{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=[...Zn];var os=Zn[0];ce();var ta=require("pixi.js"),fe={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},Bt=[];function ls(i,e,t,n,a,s,r){Bt.push({element:i,originalScale:s,positionHelper:e,heightPercent:a}),e(i,t,n,a,s,r,!1)}function cs(){Bt.forEach(({element:i,originalScale:e,positionHelper:t,heightPercent:n})=>{let a=e*fe.scaleFactor;t(i,fe.width,fe.height,n,a,!0,!1)})}function ia(){Bt.length=0,console.log("[LAYOUT] Cleared all responsive elements")}function Ht(i,e){console.log(`[SCREEN] updateScreenState called: ${i}x${e}`),fe.width=i,fe.height=e,fe.scaleFactor=Math.min(i/fe.designWidth,1.15),St.scale=fe.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(i,e,t){let n=_[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${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(i,e){return typeof i=="number"&&Number.isFinite(i)?i:e}function Te(i,e={x:.5,y:.5}){var t;if(Array.isArray(i))return{x:Nt(i[0],e.x),y:Nt(i[1],e.y)};if(i&&typeof i=="object"){let n=i;return{x:Nt(n.x,e.x),y:Nt(n.y,e.y)}}if(typeof i=="string"){let n=i.trim().toLowerCase();return(t=us[n])!=null?t:e}return e}function De(i,e,t,n={}){var g,m,f,C,b,h;let a=Te(t),s=(g=n.inset)!=null?g:{},r=(m=n.padding)!=null?m:{x:0,y:0},o=((f=s.left)!=null?f: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,i-o-c),p=Math.max(0,e-l-u);return{x:o+d*a.x,y:l+p*a.y}}function Ne(i,e,t,n={}){var f,C,b,h,y,w;let a=(f=n.inset)!=null?f:{},s=(C=n.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,i-r-o),d=Math.max(0,e-c-l),p=Te(t,{x:.5,y:.5}),g=Math.min(Math.max(p.x,0),1),m=Math.min(Math.max(p.y,0),1);return{x:r+u*g,y:c+d*m}}function Ft(i,e,t,n={}){var u,d,p;if(!i)return;let a=n.positionRatio?Ne(e,t,n.positionRatio,{inset:n.inset,padding:n.screenPadding}):De(e,t,n.anchor,{inset:n.inset,padding:n.screenPadding}),s=(u=n.offset)!=null?u:{x:0,y:0},r=a.x+s.x,o=a.y+s.y;i.anchor&&n.renderAnchor&&i.anchor.set(n.renderAnchor.x,n.renderAnchor.y),se(i,r,o);let c=(d=n.scale)!=null?d:1,l=(p=n.scaleMultiplier)!=null?p:1;(n.scale!==void 0||n.scaleMultiplier!==void 0)&&de(i,c*l)}if(typeof window!="undefined"){let i=window.innerWidth,e=window.innerHeight,t=()=>{let n=window.innerWidth,a=window.innerHeight;(n!==i||a!==e)&&(i=n,e=a,Ht(n,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=na,window.positionAtTop=fs,window.positionAtCenter=ms,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(i,e,t=0){return i*e+t}function Ut(i,e,t=0){return i*(1-e)+t}function qt(i,e,t=0){return i*e+t}function Vt(i,e,t=0){return i*(1-e)+t}function ie(i,e=0){return i/2+e}function gs(i,e){return i*e}function hs(i,e,t,n){var r,o,c,l,u,d,p,g,m,f,C,b,h,y,w,x,P,L,B,R;let a=0,s=0;switch(n.type){case"top":a=ie(e,(o=(r=n.offset)==null?void 0:r.x)!=null?o:0),s=Gt(t,n.percent,(l=(c=n.offset)==null?void 0:c.y)!=null?l:0);break;case"bottom":a=ie(e,(d=(u=n.offset)==null?void 0:u.x)!=null?d:0),s=Ut(t,n.percent,(g=(p=n.offset)==null?void 0:p.y)!=null?g:0);break;case"left":a=qt(e,n.percent,(f=(m=n.offset)==null?void 0:m.x)!=null?f:0),s=ie(t,(b=(C=n.offset)==null?void 0:C.y)!=null?b:0);break;case"right":a=Vt(e,n.percent,(y=(h=n.offset)==null?void 0:h.x)!=null?y:0),s=ie(t,(x=(w=n.offset)==null?void 0:w.y)!=null?x:0);break;case"center":a=ie(e,(L=(P=n.offset)==null?void 0:P.x)!=null?L:0),s=ie(t,(R=(B=n.offset)==null?void 0:B.y)!=null?R:0);break}i.position?i.position.set(a,s):(i.x=a,i.y=s),n.scale!==void 0&&n.scale!==1&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(n.scale,n.scale):(i.scale.x=n.scale,i.scale.y=n.scale))}function na(i,e,t,n=.2,a=1,s=!0,r=!1){let o=gs(t,n),c=Ut(t,n/2);se(i,ie(e),c);let l=s?a*fe.scaleFactor:a;de(i,l),r&&!Bt.find(u=>u.element===i)&&ls(i,na,e,t,n,a,s)}function fs(i,e,t,n=.1,a=1){se(i,ie(e),Gt(t,n)),de(i,a)}function ms(i,e,t,n=0,a=0,s=1){se(i,ie(e,n),ie(t,a)),de(i,s)}function bs(i,e,t,n=.1,a=1){se(i,qt(e,n),ie(t)),de(i,a)}function ys(i,e,t,n=.1,a=1){se(i,Vt(e,n),ie(t)),de(i,a)}function vs(i,e,t,n=.05,a=.05,s=1){se(i,qt(e,a),Ut(t,n)),de(i,s)}function ws(i,e,t,n=.05,a=.05,s=1){se(i,Vt(e,a),Ut(t,n)),de(i,s)}function xs(i,e,t,n=.05,a=.05,s=1){se(i,qt(e,a),Gt(t,n)),de(i,s)}function Ss(i,e,t,n=.05,a=.05,s=1){se(i,Vt(e,a),Gt(t,n)),de(i,s)}function se(i,e,t){i&&i.position?typeof i.position.set=="function"?i.position.set(e,t):(i.position.x=e,i.position.y=t):i&&(i.x=e,i.y=t)}function de(i,e){e!==1&&i&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(e,e):i.scale.x!==void 0&&i.scale.y!==void 0&&(i.scale.x=e,i.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(i){return i&&$e[i]?JSON.parse(JSON.stringify($e[i])):JSON.parse(JSON.stringify(_))}function xt(i){Object.keys(i).forEach(e=>{let t=e;_[t]&&i[t]&&Object.assign(_[t],i[t])}),console.log("Config applied:",i)}function Cs(i,e){let t=i/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 i=window;i.configPresets=$e,i.resolveAnchorVec2=i.resolveAnchorVec2||Te,i.resolveScreenAnchorPoint=i.resolveScreenAnchorPoint||De,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||Ne}var K=null,ea=new Map;function aa(i,e,t,n,a,s={}){var Se,Ee,Ce,Ae,W,_e,lt,ct,dt,pt,ut,gt,ht,ft,mt,bt,F,Z,U,Q,Ue,Oe,Bi,Gi,Ui,qi,Vi,Wi,Yi,Ki,Xi,Ji,Zi,Qi,en,tn,nn,an,sn,rn,on,ln,cn,dn,pn,un,gn,hn,fn;let r=(Se=s.enableDebugLogs)!=null?Se:!1;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== STARTING LAYOUT CALCULATION ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Screen dimensions:",{width:n.width,height:n.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}=i;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=n.width,g=n.height;r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Base dimensions:",{baseWidth:p,baseHeight:g});let m=p*_.layout.screen_scale_x,f=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:m,height:f,midX:C}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Engine runtime:",b),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Layout config:",h));let y=f>m,w=(Ee=h.design_width_portrait)!=null?Ee:y?400:600,x=(Ce=h.design_height_portrait)!=null?Ce:y?600:400,P=Math.min(m/w,f/x);P=Math.min(P,1.15);let L=P*((Ae=_.engine.scale)!=null?Ae: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=(ft=q.anchor)!=null?ft:"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=(mt=q.position)!=null?mt:{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=i.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:Te(G)})}if(c&&c.alpha>0){let G=1+Math.sin(t*_.engine.label_pulse_speed)*_.engine.label_pulse_intensity,Y=(Bi=(Oe=O==null?void 0:O.transform)==null?void 0:Oe.scale)!=null?Bi: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 ne=l?e.objects.get("background_1"):null,je=!!ne&&(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:",(Gi=l.constructor)==null?void 0:Gi.name)),l.alpha=((qi=(Ui=b.background)==null?void 0:Ui.alpha)!=null?qi:.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:",ne);let G=(ne==null?void 0:ne.transform)||{};r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background transform:",G);let Y=G.offset||{x:0,y:0},N=((Wi=(Vi=b.background)==null?void 0:Vi.offset_y)!=null?Wi:0)+_.engine.background_offset_y,oe=(Yi=G.anchor)!=null?Yi:"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:Te(oe)}),r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background position after applyScreenAnchor:",{x:l.x,y:l.y,scaleX:(Ki=l.scale)==null?void 0:Ki.x,scaleY:(Xi=l.scale)==null?void 0:Xi.y,anchorX:(Ji=l.anchor)==null?void 0:Ji.x,anchorY:(Zi=l.anchor)==null?void 0:Zi.y,pivotX:(Qi=l.pivot)==null?void 0:Qi.x,pivotY:(en=l.pivot)==null?void 0:en.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(m/u.width,f/u.height),Ve=(nn=(tn=b.background)==null?void 0:tn.scale_multiplier)!=null?nn:1.05,vt=(an=G.scale)!=null?an: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(-m/2,-f/2,m,f).fill({color:1444375}));let q=`${p}x${g}`,I=ea.get(q),k={x:Number((sn=l.x)!=null?sn:0),y:Number((rn=l.y)!=null?rn:0),scaleX:Number((ln=(on=l.scale)==null?void 0:on.x)!=null?ln:1),scaleY:Number((dn=(cn=l.scale)==null?void 0:cn.y)!=null?dn:1),rotation:Number.isFinite(l.rotation)?l.rotation:void 0,anchorX:Number.isFinite((pn=l.anchor)==null?void 0:pn.x)?l.anchor.x:void 0,anchorY:Number.isFinite((un=l.anchor)==null?void 0:un.y)?l.anchor.y:void 0,pivotX:Number.isFinite((gn=l.pivot)==null?void 0:gn.x)?l.pivot.x:void 0,pivotY:Number.isFinite((hn=l.pivot)==null?void 0:hn.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)&&((fn=l.position)!=null&&fn.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(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Ls(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Ts(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function yi(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await 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(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Wt(i,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=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let s=a.getImageData(0,0,n.width,n.height),r=s.data,c=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(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],m=r[d+2],f=!1;for(let C of c)if(Math.sqrt(Math.pow(p-C.r,2)+Math.pow(g-C.g,2)+Math.pow(m-C.b,2))<e){f=!0;break}f&&(r[d+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var sa=require("@google/genai");async function vi(i,e,t=[],n={}){var a,s,r,o,c,l,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let h=t[b];if(!h.base64||!h.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${h.mimeType}`)}let d=new sa.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,h)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await d.models.generateContent({model:p,contents:g}),f="",C=(r=(s=(a=m.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(C)for(let b of C)b.text&&(f+=b.text);if(!f.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${f.length}`),f}catch(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(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new ra.GoogleGenAI({apiKey:i}),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(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Vs(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function Ws(i){return`
46
+ `,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let l=o.target.dataset.tab;l&&this.switchTab(l)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var ur={};mn(ur,{AssetCache:()=>re,AssetLoader:()=>Pe,AssetSystem:()=>li,AssetTextures:()=>Ie,Assets:()=>Ha,BaseSystem:()=>rt,GameEngine:()=>oi,GameObject:()=>Ot,GameObjectManager:()=>at,ObjectFactory:()=>ye,Renderer:()=>_t,RuntimeObjectRegistry:()=>ot,Transform:()=>jt,applyScreenAnchor:()=>Ft,basePixi:()=>za,clearResponsiveElements:()=>ia,createPixiBase:()=>si,getRegisteredFontIds:()=>ja,globalResponsiveMultipliers:()=>St,initAssetTextures:()=>Zt,initAssets:()=>Fa,layout:()=>aa,playLottieOverlay:()=>Oa,registerFont:()=>Ma,registerType:()=>Xt,resolveAnchorVec2:()=>Te,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 Le={};function zt(i,e,t=!1){Le[i]||(Le[i]=[]),Le[i].push({fn:e,once:t})}function di(i,e){if(Le[i]){if(!e){delete Le[i];return}Le[i]=Le[i].filter(t=>t.fn!==e)}}function $t(i,...e){let t=Le[i];if(t)for(let n of[...t])n.fn(...e),n.once&&di(i,n.fn)}function ee(i,e){zt(i,e,!0)}var $=null,ae=[],We=null;function wn(i){$=i,ae=[],We!==null&&(clearTimeout(We),We=null)}function xn(){var i,e,t;return{endpoint:($==null?void 0:$.endpoint)||"",transport:($==null?void 0:$.transport)||"beacon",batchSize:(i=$==null?void 0:$.batchSize)!=null?i:10,flushIntervalMs:(e=$==null?void 0:$.flushIntervalMs)!=null?e:300,maxQueue:(t=$==null?void 0:$.maxQueue)!=null?t:200,debug:!!($!=null&&$.debug)}}async function yn(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(s){n&&console.warn("[handler.telemetry] fetch failed",s)}}function pi(i,e){let t=xn();if(e&&t.endpoint){if(ae.push(i),ae.length>t.maxQueue&&(ae=ae.slice(ae.length-t.maxQueue)),ae.length>=t.batchSize){vn();return}We===null&&(We=window.setTimeout(()=>{We=null,vn()},t.flushIntervalMs))}}async function vn(){let i=xn();if(!i.endpoint||ae.length===0)return;let e=ae.splice(0,i.batchSize);await yn(i.endpoint,{events:e},i.transport,i.debug),ae.length>0&&await yn(i.endpoint,{events:ae.splice(0,i.batchSize)},i.transport,i.debug)}function Sn(i){return Math.max(0,Math.min(1,i))}function Ka(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function wt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Xa(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function En(i,e,t){try{i[e]=t}catch{}}function Ja(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function Cn(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function An(i,e){let t=Ja(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function Ln(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=u=>{var p;i.add(u);let d=(p=e.get(u.target))!=null?p:new Set;d.add(u),e.set(u.target,d),n()},s=u=>{i.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(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,C=Sn(f),b=g.repeat>=0?g.repeat+1:1,h=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let x=f-h;C=Sn(x)}let y=g.ease(C);g.yoyo&&h%2===1&&(y=1-y);for(let x of g.props)En(g.target,x.key,x.from+(x.to-x.from)*y);g.scaleFrom&&g.scaleTo&&Cn(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(f>=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),m=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),f=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=An(u,d);return{target:u,startMs:wt(),delayMs:m,durationMs:g,ease:f,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 f;if(!p.paused)return;let g=(f=p.pauseAtMs)!=null?f:wt(),m=wt()-g;p.startMs+=m,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 m=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&En(u,g,m)}let p=An(u,d);p.to&&Cn(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,m=[],f=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:f(w)}),b},fromTo(h,y,w,x){return C({kind:"fromTo",target:h,vars:w,from:y,atMs:f(x)}),b},play(){var h,y;if(g)return b;g=!0,m=[];for(let w of d)w.kind==="fromTo"&&l.set(w.target,(h=w.from)!=null?h:{}),m.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 m)h.pause();return b},kill(){for(let h of m)h.kill();m=[],g=!1}};return u.paused||b.play(),b}};return l}function Tn(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=Ln()}catch{}}var kn={name:"handler-playable-sdk",version:"1.0.81",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++,Pn=te++,In=te++,Mn=te++,jn=te++,_n=te++,On=te++,Rn=te++,zn=te++,$n=te++,Dn=te++,Nn=te++,j=Qa;function Hn(){return j===Pn}function Fn(){return j===In}function Bn(){return j===Mn}function Gn(){return j===jn}function Ye(){return j===_n}function Ke(){return j===On}function Un(){return j===Rn}function qn(){return j===zn}function Vn(){return j===$n}function ui(){return j===Dn}function gi(){return j===Nn}function Wn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),j=Pn;return}catch{}else if(i==="dapi")try{dapi.isReady(),j=In;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(j=Mn)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(j=jn)}catch{}else if(e==="mintegral")window.gameReady&&(j=_n);else if(e==="tapjoy")window.TJ_API&&(j=On);else if(e==="tiktok")window.openAppStore&&(j=Rn);else if(e==="smadex")try{window.smxTracking&&(j=zn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(j=$n)}catch{}else e==="vungle"?j=Dn:(i==="nucleo"||e==="nucleo")&&(j=Nn)}var Dt=ci(require("lottie-web"),1),Yn=Dt.default;typeof window!="undefined"&&(window.lottie=Dt.default,window.__baseLottie=Dt.default);mi();function D(i,e){let t=(a,s)=>s===0?a:t(s,a%s),n=t(i,e);return`${i/n}:${e/n}`}var 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)}],Zn=[{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=[...Zn];var os=Zn[0];ce();var ta=require("pixi.js"),fe={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},Bt=[];function ls(i,e,t,n,a,s,r){Bt.push({element:i,originalScale:s,positionHelper:e,heightPercent:a}),e(i,t,n,a,s,r,!1)}function cs(){Bt.forEach(({element:i,originalScale:e,positionHelper:t,heightPercent:n})=>{let a=e*fe.scaleFactor;t(i,fe.width,fe.height,n,a,!0,!1)})}function ia(){Bt.length=0,console.log("[LAYOUT] Cleared all responsive elements")}function Ht(i,e){console.log(`[SCREEN] updateScreenState called: ${i}x${e}`),fe.width=i,fe.height=e,fe.scaleFactor=Math.min(i/fe.designWidth,1.15),St.scale=fe.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(i,e,t){let n=_[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${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(i,e){return typeof i=="number"&&Number.isFinite(i)?i:e}function Te(i,e={x:.5,y:.5}){var t;if(Array.isArray(i))return{x:Nt(i[0],e.x),y:Nt(i[1],e.y)};if(i&&typeof i=="object"){let n=i;return{x:Nt(n.x,e.x),y:Nt(n.y,e.y)}}if(typeof i=="string"){let n=i.trim().toLowerCase();return(t=us[n])!=null?t:e}return e}function De(i,e,t,n={}){var g,m,f,C,b,h;let a=Te(t),s=(g=n.inset)!=null?g:{},r=(m=n.padding)!=null?m:{x:0,y:0},o=((f=s.left)!=null?f: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,i-o-c),p=Math.max(0,e-l-u);return{x:o+d*a.x,y:l+p*a.y}}function Ne(i,e,t,n={}){var f,C,b,h,y,w;let a=(f=n.inset)!=null?f:{},s=(C=n.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,i-r-o),d=Math.max(0,e-c-l),p=Te(t,{x:.5,y:.5}),g=Math.min(Math.max(p.x,0),1),m=Math.min(Math.max(p.y,0),1);return{x:r+u*g,y:c+d*m}}function Ft(i,e,t,n={}){var u,d,p;if(!i)return;let a=n.positionRatio?Ne(e,t,n.positionRatio,{inset:n.inset,padding:n.screenPadding}):De(e,t,n.anchor,{inset:n.inset,padding:n.screenPadding}),s=(u=n.offset)!=null?u:{x:0,y:0},r=a.x+s.x,o=a.y+s.y;i.anchor&&n.renderAnchor&&i.anchor.set(n.renderAnchor.x,n.renderAnchor.y),se(i,r,o);let c=(d=n.scale)!=null?d:1,l=(p=n.scaleMultiplier)!=null?p:1;(n.scale!==void 0||n.scaleMultiplier!==void 0)&&de(i,c*l)}if(typeof window!="undefined"){let i=window.innerWidth,e=window.innerHeight,t=()=>{let n=window.innerWidth,a=window.innerHeight;(n!==i||a!==e)&&(i=n,e=a,Ht(n,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=na,window.positionAtTop=fs,window.positionAtCenter=ms,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(i,e,t=0){return i*e+t}function Ut(i,e,t=0){return i*(1-e)+t}function qt(i,e,t=0){return i*e+t}function Vt(i,e,t=0){return i*(1-e)+t}function ie(i,e=0){return i/2+e}function gs(i,e){return i*e}function hs(i,e,t,n){var r,o,c,l,u,d,p,g,m,f,C,b,h,y,w,x,P,L,B,R;let a=0,s=0;switch(n.type){case"top":a=ie(e,(o=(r=n.offset)==null?void 0:r.x)!=null?o:0),s=Gt(t,n.percent,(l=(c=n.offset)==null?void 0:c.y)!=null?l:0);break;case"bottom":a=ie(e,(d=(u=n.offset)==null?void 0:u.x)!=null?d:0),s=Ut(t,n.percent,(g=(p=n.offset)==null?void 0:p.y)!=null?g:0);break;case"left":a=qt(e,n.percent,(f=(m=n.offset)==null?void 0:m.x)!=null?f:0),s=ie(t,(b=(C=n.offset)==null?void 0:C.y)!=null?b:0);break;case"right":a=Vt(e,n.percent,(y=(h=n.offset)==null?void 0:h.x)!=null?y:0),s=ie(t,(x=(w=n.offset)==null?void 0:w.y)!=null?x:0);break;case"center":a=ie(e,(L=(P=n.offset)==null?void 0:P.x)!=null?L:0),s=ie(t,(R=(B=n.offset)==null?void 0:B.y)!=null?R:0);break}i.position?i.position.set(a,s):(i.x=a,i.y=s),n.scale!==void 0&&n.scale!==1&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(n.scale,n.scale):(i.scale.x=n.scale,i.scale.y=n.scale))}function na(i,e,t,n=.2,a=1,s=!0,r=!1){let o=gs(t,n),c=Ut(t,n/2);se(i,ie(e),c);let l=s?a*fe.scaleFactor:a;de(i,l),r&&!Bt.find(u=>u.element===i)&&ls(i,na,e,t,n,a,s)}function fs(i,e,t,n=.1,a=1){se(i,ie(e),Gt(t,n)),de(i,a)}function ms(i,e,t,n=0,a=0,s=1){se(i,ie(e,n),ie(t,a)),de(i,s)}function bs(i,e,t,n=.1,a=1){se(i,qt(e,n),ie(t)),de(i,a)}function ys(i,e,t,n=.1,a=1){se(i,Vt(e,n),ie(t)),de(i,a)}function vs(i,e,t,n=.05,a=.05,s=1){se(i,qt(e,a),Ut(t,n)),de(i,s)}function ws(i,e,t,n=.05,a=.05,s=1){se(i,Vt(e,a),Ut(t,n)),de(i,s)}function xs(i,e,t,n=.05,a=.05,s=1){se(i,qt(e,a),Gt(t,n)),de(i,s)}function Ss(i,e,t,n=.05,a=.05,s=1){se(i,Vt(e,a),Gt(t,n)),de(i,s)}function se(i,e,t){i&&i.position?typeof i.position.set=="function"?i.position.set(e,t):(i.position.x=e,i.position.y=t):i&&(i.x=e,i.y=t)}function de(i,e){e!==1&&i&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(e,e):i.scale.x!==void 0&&i.scale.y!==void 0&&(i.scale.x=e,i.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(i){return i&&$e[i]?JSON.parse(JSON.stringify($e[i])):JSON.parse(JSON.stringify(_))}function xt(i){Object.keys(i).forEach(e=>{let t=e;_[t]&&i[t]&&Object.assign(_[t],i[t])}),console.log("Config applied:",i)}function Cs(i,e){let t=i/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 i=window;i.configPresets=$e,i.resolveAnchorVec2=i.resolveAnchorVec2||Te,i.resolveScreenAnchorPoint=i.resolveScreenAnchorPoint||De,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||Ne}var K=null,ea=new Map;function aa(i,e,t,n,a,s={}){var Se,Ee,Ce,Ae,W,_e,lt,ct,dt,pt,ut,gt,ht,ft,mt,bt,F,Z,U,Q,Ue,Oe,Bi,Gi,Ui,qi,Vi,Wi,Yi,Ki,Xi,Ji,Zi,Qi,en,tn,nn,an,sn,rn,on,ln,cn,dn,pn,un,gn,hn,fn;let r=(Se=s.enableDebugLogs)!=null?Se:!1;r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] ===== STARTING LAYOUT CALCULATION ====="),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Screen dimensions:",{width:n.width,height:n.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}=i;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=n.width,g=n.height;r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Base dimensions:",{baseWidth:p,baseHeight:g});let m=p*_.layout.screen_scale_x,f=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:m,height:f,midX:C}),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Engine runtime:",b),console.log("\u{1F3AF} [LAYOUT_DEBUGS] Layout config:",h));let y=f>m,w=(Ee=h.design_width_portrait)!=null?Ee:y?400:600,x=(Ce=h.design_height_portrait)!=null?Ce:y?600:400,P=Math.min(m/w,f/x);P=Math.min(P,1.15);let L=P*((Ae=_.engine.scale)!=null?Ae: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=(ft=q.anchor)!=null?ft:"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=(mt=q.position)!=null?mt:{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=i.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:Te(G)})}if(c&&c.alpha>0){let G=1+Math.sin(t*_.engine.label_pulse_speed)*_.engine.label_pulse_intensity,Y=(Bi=(Oe=O==null?void 0:O.transform)==null?void 0:Oe.scale)!=null?Bi: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 ne=l?e.objects.get("background_1"):null,je=!!ne&&(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:",(Gi=l.constructor)==null?void 0:Gi.name)),l.alpha=((qi=(Ui=b.background)==null?void 0:Ui.alpha)!=null?qi:.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:",ne);let G=(ne==null?void 0:ne.transform)||{};r&&console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background transform:",G);let Y=G.offset||{x:0,y:0},N=((Wi=(Vi=b.background)==null?void 0:Vi.offset_y)!=null?Wi:0)+_.engine.background_offset_y,oe=(Yi=G.anchor)!=null?Yi:"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:Te(oe)}),r&&(console.log("\u{1F3AF} [LAYOUT_DEBUGS] Background position after applyScreenAnchor:",{x:l.x,y:l.y,scaleX:(Ki=l.scale)==null?void 0:Ki.x,scaleY:(Xi=l.scale)==null?void 0:Xi.y,anchorX:(Ji=l.anchor)==null?void 0:Ji.x,anchorY:(Zi=l.anchor)==null?void 0:Zi.y,pivotX:(Qi=l.pivot)==null?void 0:Qi.x,pivotY:(en=l.pivot)==null?void 0:en.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(m/u.width,f/u.height),Ve=(nn=(tn=b.background)==null?void 0:tn.scale_multiplier)!=null?nn:1.05,vt=(an=G.scale)!=null?an: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(-m/2,-f/2,m,f).fill({color:1444375}));let q=`${p}x${g}`,I=ea.get(q),k={x:Number((sn=l.x)!=null?sn:0),y:Number((rn=l.y)!=null?rn:0),scaleX:Number((ln=(on=l.scale)==null?void 0:on.x)!=null?ln:1),scaleY:Number((dn=(cn=l.scale)==null?void 0:cn.y)!=null?dn:1),rotation:Number.isFinite(l.rotation)?l.rotation:void 0,anchorX:Number.isFinite((pn=l.anchor)==null?void 0:pn.x)?l.anchor.x:void 0,anchorY:Number.isFinite((un=l.anchor)==null?void 0:un.y)?l.anchor.y:void 0,pivotX:Number.isFinite((gn=l.pivot)==null?void 0:gn.x)?l.pivot.x:void 0,pivotY:Number.isFinite((hn=l.pivot)==null?void 0:hn.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)&&((fn=l.position)!=null&&fn.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(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Ls(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Ts(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function yi(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await 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(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Wt(i,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=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let s=a.getImageData(0,0,n.width,n.height),r=s.data,c=[{name:"top-left",offset:0},{name:"top-right",offset:(n.width-1)*4},{name:"bottom-left",offset:(n.height-1)*n.width*4},{name:"bottom-right",offset:((n.height-1)*n.width+(n.width-1))*4}].map(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],m=r[d+2],f=!1;for(let C of c)if(Math.sqrt(Math.pow(p-C.r,2)+Math.pow(g-C.g,2)+Math.pow(m-C.b,2))<e){f=!0;break}f&&(r[d+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var sa=require("@google/genai");async function vi(i,e,t=[],n={}){var a,s,r,o,c,l,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let h=t[b];if(!h.base64||!h.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${h.mimeType}`)}let d=new sa.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,h)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await d.models.generateContent({model:p,contents:g}),f="",C=(r=(s=(a=m.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(C)for(let b of C)b.text&&(f+=b.text);if(!f.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${f.length}`),f}catch(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(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new ra.GoogleGenAI({apiKey:i}),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(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Vs(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function Ws(i){return`
47
47
  Analyze these screenshots of a brand or game and extract its "Brand DNA".
48
48
 
49
49
  Provide a concise summary (2-3 sentences) covering:
@@ -1 +1 @@
1
- (function(_0x996fba,_0x35a95b){var a0_0x1256c2={_0x1a7733:0x14c,_0x26b58d:0x156,_0x404469:0x153,_0x5b6c02:')1Sg',_0x25f4f1:0xb7,_0x270044:0xce,_0x17ab9b:0xd2,_0x55ee14:'S5(l',_0x215967:0x13d,_0x41e5f6:0x13f,_0x59be32:0x134,_0x5ea4f3:'2Vyj',_0x5aabd1:0x143,_0x8c9ed4:0x14a,_0x32a0f6:0x13c,_0x3a8ebb:'8TLc',_0x1e6eb9:0x148,_0x168c69:0xc9,_0x142b27:0xc1,_0x47f05a:'AmCV',_0x203715:0x162,_0x29fc87:0x155,_0x500d52:0x150,_0x3c3f1:'(xe&',_0x3471db:0x15f,_0x164a91:0x145,_0x494b84:0x13e,_0x2bb851:'AmCV',_0x36c2d5:0x140,_0x9c9d20:0x1e3,_0xbab39d:'nOEY',_0x5388fe:0x1e6,_0x2118cd:0x1ec,_0x1c96b8:0x141,_0x491f10:'c)$)',_0x3bb4a3:0x143,_0x3d57b7:0xd3,_0xee4d54:0xcc,_0x491072:'S5(l',_0x3284ae:0xbb,_0x1ee818:0xc5,_0x35a197:'kogT'},a0_0x5ed20d={_0x36ceb5:0x281},a0_0x539800={_0x54f6e6:0x1df},a0_0xa12bd0={_0x7ccdbf:0x34};function _0x36a474(_0x397b70,_0x2b88f6,_0x4e6eff,_0x3cc6f2,_0x5b78bb){return a0_0x1a47(_0x3cc6f2-a0_0xa12bd0._0x7ccdbf,_0x5b78bb);}function _0xa2a94a(_0x1200a6,_0x42149f,_0x1ce77,_0x495c4f,_0x430efc){return a0_0x1a47(_0x42149f- -a0_0x539800._0x54f6e6,_0x495c4f);}var _0x37ab95=_0x996fba();function _0x476688(_0x4cd07a,_0x430a89,_0x18a9db,_0x17014a,_0x22b67d){return a0_0x1a47(_0x430a89- -a0_0x5ed20d._0x36ceb5,_0x18a9db);}while(!![]){try{var _0xef3c1b=parseInt(_0xa2a94a(-a0_0x1256c2._0x1a7733,-a0_0x1256c2._0x26b58d,-a0_0x1256c2._0x404469,a0_0x1256c2._0x5b6c02,-0x15a))/(0xf65+0x353+-0x12b7)+-parseInt(_0x36a474(a0_0x1256c2._0x25f4f1,a0_0x1256c2._0x270044,a0_0x1256c2._0x17ab9b,0xc4,a0_0x1256c2._0x55ee14))/(0x47*0x6d+0x215*-0x9+-0xb7c)*(-parseInt(_0xa2a94a(-a0_0x1256c2._0x215967,-a0_0x1256c2._0x41e5f6,-a0_0x1256c2._0x59be32,a0_0x1256c2._0x5ea4f3,-a0_0x1256c2._0x1a7733))/(0x643+-0x33e+-0x302))+parseInt(_0xa2a94a(-a0_0x1256c2._0x5aabd1,-a0_0x1256c2._0x8c9ed4,-a0_0x1256c2._0x32a0f6,a0_0x1256c2._0x3a8ebb,-a0_0x1256c2._0x1e6eb9))/(-0xfa5+-0x3b0+-0x27*-0x7f)*(-parseInt(_0x36a474(0xc4,a0_0x1256c2._0x168c69,a0_0x1256c2._0x142b27,a0_0x1256c2._0x270044,a0_0x1256c2._0x47f05a))/(0xb*-0x195+-0x5*-0x476+0x19*-0x32))+-parseInt(_0xa2a94a(-a0_0x1256c2._0x203715,-a0_0x1256c2._0x29fc87,-a0_0x1256c2._0x500d52,a0_0x1256c2._0x3c3f1,-a0_0x1256c2._0x3471db))/(0x57c+-0x3*0x813+0x12c3)+-parseInt(_0xa2a94a(-a0_0x1256c2._0x164a91,-a0_0x1256c2._0x494b84,-a0_0x1256c2._0x215967,a0_0x1256c2._0x2bb851,-a0_0x1256c2._0x36c2d5))/(0x2297+0x1*0x1d1b+-0x1539*0x3)*(-parseInt(_0x476688(-a0_0x1256c2._0x9c9d20,-0x1ee,a0_0x1256c2._0xbab39d,-a0_0x1256c2._0x5388fe,-a0_0x1256c2._0x2118cd))/(-0x5f7*0x3+0x1096*-0x2+0x3319))+-parseInt(_0xa2a94a(-0x13e,-a0_0x1256c2._0x1c96b8,-0x14c,a0_0x1256c2._0x491f10,-a0_0x1256c2._0x3bb4a3))/(-0xf71+0x2*-0x8e+-0x2*-0x84b)+-parseInt(_0x36a474(a0_0x1256c2._0x3d57b7,0xd7,a0_0x1256c2._0xee4d54,0xd3,a0_0x1256c2._0x491072))/(0x6fd*0x5+-0x1*0x669+-0x1c7e)*(parseInt(_0x36a474(a0_0x1256c2._0x3284ae,a0_0x1256c2._0x1ee818,0xbc,0xc5,a0_0x1256c2._0x35a197))/(-0x141*0x10+0x10*0x12e+0x23*0x9));if(_0xef3c1b===_0x35a95b)break;else _0x37ab95['push'](_0x37ab95['shift']());}catch(_0x156932){_0x37ab95['push'](_0x37ab95['shift']());}}}(a0_0x4ba1,-0x1c8ab0+-0xbd9a9*0x2+0x4*0x10ae8e));var a0_0x221b74=(function(){var _0x38bdce=!![];return function(_0x5a9f3c,_0x232b10){var a0_0x22e066={_0x4a36d7:0xd8,_0x3e215a:0xcc,_0x5ed5fd:0xd2},_0x41d595=_0x38bdce?function(){var a0_0x411a08={_0x28f604:0x165};function _0x38f2d8(_0x4e08b7,_0x312f15,_0xb3b9f0,_0x291cdb,_0x22b160){return a0_0x1a47(_0xb3b9f0- -a0_0x411a08._0x28f604,_0x4e08b7);}if(_0x232b10){var _0x1576c9=_0x232b10[_0x38f2d8('YEKm',-a0_0x22e066._0x4a36d7,-a0_0x22e066._0x3e215a,-0xda,-a0_0x22e066._0x5ed5fd)](_0x5a9f3c,arguments);return _0x232b10=null,_0x1576c9;}}:function(){};return _0x38bdce=![],_0x41d595;};}()),a0_0x32428c=a0_0x221b74(this,function(){var a0_0x5ba854={_0x428bc8:0x2ae,_0x24cb9d:0x2b0,_0x5d8a8c:'CI3!',_0x564cc0:0x2b4,_0x5188a7:'(xe&',_0x2a256d:0x2aa,_0x1c8ce9:'(xe&',_0x5e34a1:0x29a,_0x30b763:0x2a4,_0x25fdba:0x440,_0x4c4dbe:0x433,_0x377edd:'vx3E',_0x35b800:0x44d,_0x3df550:0x439,_0x5c6ed4:0x441,_0x27a009:0x438,_0x181688:0x443,_0x3976bb:0x29e,_0x511ff3:0x29f,_0x66e8c5:0x290,_0x522fcd:0x2a1,_0x2c6ea6:0x29c,_0x4e5dd5:'9a6#',_0x52b40e:0x295,_0x429b53:0x2af,_0x208400:0x2a9,_0x42d674:'kogT',_0x352dbb:0x2a8},a0_0x136bb6={_0x71d299:0x376},a0_0x57c7f2={_0x4f864f:0x3a5},_0x567a91={};function _0x323995(_0x478ec7,_0x22c6e7,_0x343fe3,_0x764bc,_0x3b1ab5){return a0_0x1a47(_0x478ec7-a0_0x57c7f2._0x4f864f,_0x343fe3);}function _0xf2a74b(_0x3a179b,_0x2bb984,_0x1d21dd,_0x3bf6da,_0x2dc977){return a0_0x1a47(_0x1d21dd-a0_0x136bb6._0x71d299,_0x3a179b);}_0x567a91[_0xffbc84(a0_0x5ba854._0x428bc8,a0_0x5ba854._0x24cb9d,a0_0x5ba854._0x5d8a8c,0x2a1,0x2a8)]=_0xffbc84(a0_0x5ba854._0x564cc0,0x2a9,a0_0x5ba854._0x5188a7,a0_0x5ba854._0x2a256d,0x2ac)+_0xffbc84(0x29a,0x295,a0_0x5ba854._0x1c8ce9,a0_0x5ba854._0x5e34a1,a0_0x5ba854._0x30b763)+'+$';var _0x3824d1=_0x567a91;function _0xffbc84(_0x3a2607,_0x383d7f,_0x4b6127,_0xa068c1,_0x55208e){return a0_0x1a47(_0x3a2607-0x212,_0x4b6127);}return a0_0x32428c[_0x323995(a0_0x5ba854._0x25fdba,a0_0x5ba854._0x4c4dbe,a0_0x5ba854._0x377edd,a0_0x5ba854._0x35b800,0x444)+_0x323995(a0_0x5ba854._0x3df550,a0_0x5ba854._0x5c6ed4,'rHVU',a0_0x5ba854._0x27a009,a0_0x5ba854._0x181688)]()['searc'+'h'](_0x3824d1[_0xffbc84(a0_0x5ba854._0x3976bb,a0_0x5ba854._0x511ff3,'9TFL',a0_0x5ba854._0x66e8c5,a0_0x5ba854._0x522fcd)])[_0xffbc84(0x2a0,a0_0x5ba854._0x2c6ea6,a0_0x5ba854._0x4e5dd5,0x2a9,a0_0x5ba854._0x52b40e)+'ing']()['const'+'ructo'+'r'](a0_0x32428c)[_0xffbc84(a0_0x5ba854._0x429b53,a0_0x5ba854._0x208400,a0_0x5ba854._0x42d674,0x2ba,a0_0x5ba854._0x352dbb)+'h'](_0x3824d1['kLWun']);});a0_0x32428c();import{A as a0_0x355c5a,B as a0_0x1f4b10,C as a0_0x334f6e,D as a0_0x4db777,b as a0_0xaa3fd6,c as a0_0x1e1478,d as a0_0x9f2feb,e as a0_0x3e38be,f as a0_0x1709e2,g as a0_0x53c16b,h as a0_0x53b48e,i as a0_0x1eea9b,j as a0_0xb9412b,k as a0_0x3a908b,l as a0_0x46eaa3,m as a0_0x4c5ab6,n as a0_0x5997ad,o as a0_0xe8f147,p as a0_0x2ee943,q as a0_0x90d2cd,r as a0_0x52e7ac,s as a0_0x920b,t as a0_0x1655bb,u as a0_0x46de95,v as a0_0x50d9a9,w as a0_0x229a13,x as a0_0x1b6e79,y as a0_0x4d016a,z as a0_0x2057b0}from'../chunk-EH5WKDJS.js';function a0_0x1a47(_0x181ac7,_0x1c98ad){_0x181ac7=_0x181ac7-(0x1*-0xb95+-0x1258+-0x45*-0x71);var _0x2b3092=a0_0x4ba1();var _0x1e9702=_0x2b3092[_0x181ac7];if(a0_0x1a47['KgfBxc']===undefined){var _0x1b9a51=function(_0x5c02f1){var _0x3b5d01='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x558e77='',_0x21de1b='',_0x44c1aa=_0x558e77+_0x1b9a51;for(var _0x43df29=0x236*0xb+0x2396+-0x3be8,_0x3661a6,_0x122005,_0x854cb5=0x1b98+-0x78e+0x1b*-0xbe;_0x122005=_0x5c02f1['charAt'](_0x854cb5++);~_0x122005&&(_0x3661a6=_0x43df29%(-0x2a*-0xa7+-0xe43+-0x1*0xd1f)?_0x3661a6*(0x6*-0x67c+0xfe7*0x2+0x75a*0x1)+_0x122005:_0x122005,_0x43df29++%(0x700*-0x2+0xb*-0x8e+-0xa0f*-0x2))?_0x558e77+=_0x44c1aa['charCodeAt'](_0x854cb5+(-0x1*-0x568+-0x364*0x5+-0x5cb*-0x2))-(0x36d*-0x1+-0x298*0x8+0x1837)!==0x1781+-0x1e2f*0x1+-0x3*-0x23a?String['fromCharCode'](0x29+-0x4e5*-0x3+-0x2c5*0x5&_0x3661a6>>(-(0x19+0x51*-0x1d+0x48b*0x2)*_0x43df29&-0xe+-0x16cb+0x16df)):_0x43df29:-0x1021*-0x2+0xf49+0x3*-0xfd9){_0x122005=_0x3b5d01['indexOf'](_0x122005);}for(var _0x3987c8=-0x17e5+-0x1f6c+0x3751,_0x29ee8e=_0x558e77['length'];_0x3987c8<_0x29ee8e;_0x3987c8++){_0x21de1b+='%'+('00'+_0x558e77['charCodeAt'](_0x3987c8)['toString'](-0x2*0xb6b+0x1108+0x5de))['slice'](-(0x1*0xdf+0x919+0x66*-0x19));}return decodeURIComponent(_0x21de1b);};var _0x4ae9d0=function(_0x360fec,_0x59e887){var _0x533688=[],_0xfd87d1=-0x1e5b+-0x4cf*0x3+0x1664*0x2,_0x41a245,_0x3952fe='';_0x360fec=_0x1b9a51(_0x360fec);var _0x4c511c;for(_0x4c511c=0x2*-0x6df+0x1d96*-0x1+0x2b54;_0x4c511c<-0xa3*0x1+-0x1fa8+0xb19*0x3;_0x4c511c++){_0x533688[_0x4c511c]=_0x4c511c;}for(_0x4c511c=-0x9*0x131+-0x1099+0x1b52;_0x4c511c<0x1*-0x3af+-0x1*-0x1381+-0x10f*0xe;_0x4c511c++){_0xfd87d1=(_0xfd87d1+_0x533688[_0x4c511c]+_0x59e887['charCodeAt'](_0x4c511c%_0x59e887['length']))%(0xfe4*0x2+-0x9*-0xc5+-0x25b5),_0x41a245=_0x533688[_0x4c511c],_0x533688[_0x4c511c]=_0x533688[_0xfd87d1],_0x533688[_0xfd87d1]=_0x41a245;}_0x4c511c=0x232a+-0x1*0xb9f+0x29*-0x93,_0xfd87d1=-0x1865+0x249d+-0x2*0x61c;for(var _0xbafd98=0x1d42+0x2102+0x2*-0x1f22;_0xbafd98<_0x360fec['length'];_0xbafd98++){_0x4c511c=(_0x4c511c+(0xbff+0xc59+-0x1857))%(-0x86e+-0x1b*-0x1+-0x4d*-0x1f),_0xfd87d1=(_0xfd87d1+_0x533688[_0x4c511c])%(-0x2575+0x134f+0x13*0x102),_0x41a245=_0x533688[_0x4c511c],_0x533688[_0x4c511c]=_0x533688[_0xfd87d1],_0x533688[_0xfd87d1]=_0x41a245,_0x3952fe+=String['fromCharCode'](_0x360fec['charCodeAt'](_0xbafd98)^_0x533688[(_0x533688[_0x4c511c]+_0x533688[_0xfd87d1])%(-0x203c+0x11d2+-0x7b5*-0x2)]);}return _0x3952fe;};a0_0x1a47['IsMiUJ']=_0x4ae9d0,a0_0x1a47['posCOk']={},a0_0x1a47['KgfBxc']=!![];}var _0x4b065b=_0x2b3092[0x10e2+0xe5+-0x29*0x6f],_0x1c7e33=_0x181ac7+_0x4b065b,_0x1a72e6=a0_0x1a47['posCOk'][_0x1c7e33];if(!_0x1a72e6){if(a0_0x1a47['SzXNNU']===undefined){var _0x19d8d6=function(_0x7341fb){this['wUKRde']=_0x7341fb,this['WwGITJ']=[0x79+0x4*0x688+-0x17*0x128,-0x328+-0x2428+0x9d4*0x4,0x1ee3*-0x1+0x258f+-0x6ac],this['heOdRS']=function(){return'newState';},this['mqNJgC']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['fBXNvJ']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x19d8d6['prototype']['cwuFmd']=function(){var _0x427ffc=new RegExp(this['mqNJgC']+this['fBXNvJ']),_0xf8e993=_0x427ffc['test'](this['heOdRS']['toString']())?--this['WwGITJ'][-0x162b+0x6*-0xb+0x13f*0x12]:--this['WwGITJ'][-0x13*-0x171+0x1*-0x2043+0x4e0];return this['NbpMHt'](_0xf8e993);},_0x19d8d6['prototype']['NbpMHt']=function(_0x3a558c){if(!Boolean(~_0x3a558c))return _0x3a558c;return this['cPiDWO'](this['wUKRde']);},_0x19d8d6['prototype']['cPiDWO']=function(_0x5a0a4d){for(var _0x1303c0=-0x1*0x2221+0x13*-0x1b0+0x4231*0x1,_0x1cd751=this['WwGITJ']['length'];_0x1303c0<_0x1cd751;_0x1303c0++){this['WwGITJ']['push'](Math['round'](Math['random']())),_0x1cd751=this['WwGITJ']['length'];}return _0x5a0a4d(this['WwGITJ'][-0x24e+0x643+-0x3f5]);},new _0x19d8d6(a0_0x1a47)['cwuFmd'](),a0_0x1a47['SzXNNU']=!![];}_0x1e9702=a0_0x1a47['IsMiUJ'](_0x1e9702,_0x1c98ad),a0_0x1a47['posCOk'][_0x1c7e33]=_0x1e9702;}else _0x1e9702=_0x1a72e6;return _0x1e9702;}import{a as a0_0x1ef96f,b as a0_0x175fd4,c as a0_0x2b30f0,d as a0_0x477e21,e as a0_0x31f991}from'../chunk-I5OOVR5U.js';import'../chunk-PW2FGMCO.js';function a0_0x4ba1(){var _0x470052=['W7m4kG','WPTnWPn1f0WScbK','WQyTqLqwWPDG','zmk/emoqcmkcWPBdQN3dGtxcSYa','WO8oWOFdKSoca37dMSoymSkg','W7RdNmk5rmkZ','ymo2zarIW4ZcJ8kGW6GJW40','W5fOwmoPcG','WPCbWOBcTcy','W6rvr3FdLq','cMe7WO1vyI94WOVcTCkUW6eG','dbhcReilWPCjFa','ymk/bahcVKhcKZLDW7uwlCkP','B8kgb00gW6RcHa','vmkeW6bjWR8','vCkhW6fmWR0','xSomBSoQW4ugzCoOzfNdRSo3gG','rmkuW7bvWQi8BLHktmkCWOD/','W4xdKsxdLKOJWOP3Ch3dPCohgq','W7ldJCoQn8kB','sshdHmoiyCkPW5G','WRFcSH1sna','WOBcSSoCpmkxbqPii8oNuMjS','d2NcLuWtWO4S','WQqefJxcGWNdQZyuk1joEW','gIvtk2fyqmoLW65KgSkJW5e','jmkIW5fvytXmz8o/Emogimo0WPO'];a0_0x4ba1=function(){return _0x470052;};return a0_0x4ba1();}import'../chunk-HVKF2KYL.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x1ef96f as AssetCache,a0_0x2b30f0 as AssetLoader,a0_0x46de95 as AssetSystem,a0_0x477e21 as AssetTextures,a0_0x920b as Assets,a0_0xe8f147 as BaseSystem,a0_0x5997ad as GameEngine,a0_0x3e38be as GameObject,a0_0x1709e2 as GameObjectManager,a0_0x4c5ab6 as ObjectFactory,a0_0x9f2feb as Renderer,a0_0x2ee943 as RuntimeObjectRegistry,a0_0x1e1478 as Transform,a0_0x1f4b10 as applyScreenAnchor,a0_0x90d2cd as basePixi,a0_0x229a13 as clearResponsiveElements,a0_0xaa3fd6 as createPixiBase,a0_0xb9412b as getRegisteredFontIds,a0_0x50d9a9 as globalResponsiveMultipliers,a0_0x31f991 as initAssetTextures,a0_0x1655bb as initAssets,a0_0x334f6e as layout,a0_0x46eaa3 as playLottieOverlay,a0_0x1eea9b as registerFont,a0_0x175fd4 as registerType,a0_0x4d016a as resolveAnchorVec2,a0_0x53c16b as resolveFont,a0_0x53b48e as resolveFontWeight,a0_0x2057b0 as resolveScreenAnchorPoint,a0_0x355c5a as resolveScreenRatioPoint,a0_0x4db777 as runInitSequence,a0_0x3a908b as setLottieInstance,a0_0x52e7ac as spawnSceneFromConfig,a0_0x1b6e79 as updateScreenState};
1
+ (function(_0x2706e8,_0x558837){var a0_0x15ede2={_0x156810:0x456,_0x2da795:'!pwb',_0x386550:0x437,_0x31b4c6:0x448,_0x27e29f:'RD90',_0x508a54:0x268,_0x34f96d:0x25a,_0x1b0e2:0x251,_0x42c9f7:0x250,_0x2e1a84:'Is^K',_0x52cf99:0x1e2,_0x133005:0x1e7,_0x19a706:0x1ed,_0x2970c1:0x1ee,_0x47d433:0x25c,_0x5d339b:0x254,_0x162202:0x24a,_0x13119c:0x25b,_0x1474d9:0x44e,_0x174c1d:0x44f,_0x5c81b9:0x445,_0x119077:0x441,_0x4bcc4e:'LOwb',_0x37159a:0x435,_0x22391e:0x443,_0xf3c74f:0x44b,_0x2799e9:'y**(',_0x4eeaa7:0x253,_0x222ab4:0x259,_0x208d8c:0x248,_0xe0d539:'Wyek',_0x4eed55:0x235,_0x4bb0a9:0x23f,_0x29da6d:0x235,_0x331b06:0x449,_0x5322a2:'Is^K',_0x25f9ea:0x440,_0x2db1ab:0x44b,_0x83a4b6:0x444,_0x31b501:0x452,_0x46a7b1:0x458,_0xc47dfa:'S!f$',_0x46aaef:0x1ea,_0x451961:0x1ec,_0x43c8ba:0x1fb,_0x1a3b1a:0x1f1},a0_0x32ff64={_0xb133fe:0x2ec},a0_0x302e3b={_0x3a01b2:0x13a};function _0x406b7d(_0xbee55c,_0x1c235a,_0x38417c,_0x4cc587,_0x21788b){return a0_0x4bf4(_0x4cc587-0x3af,_0x1c235a);}function _0xc5412d(_0x23dcb0,_0x57d857,_0x5387a1,_0x5b7c2e,_0x3ba574){return a0_0x4bf4(_0x57d857-a0_0x302e3b._0x3a01b2,_0x23dcb0);}var _0x234f5a=_0x2706e8();function _0x52d685(_0x4aff49,_0x2f9682,_0x35ab76,_0x55cb29,_0x55b762){return a0_0x4bf4(_0x35ab76- -a0_0x32ff64._0xb133fe,_0x4aff49);}while(!![]){try{var _0x3d1873=parseInt(_0x406b7d(a0_0x15ede2._0x156810,a0_0x15ede2._0x2da795,a0_0x15ede2._0x386550,a0_0x15ede2._0x31b4c6,0x454))/(-0x7*0x139+0x243*-0x1+0xa3*0x11)*(parseInt(_0x52d685(a0_0x15ede2._0x27e29f,-a0_0x15ede2._0x508a54,-a0_0x15ede2._0x34f96d,-a0_0x15ede2._0x1b0e2,-a0_0x15ede2._0x42c9f7))/(0x14aa+-0x1755+0x2ad))+parseInt(_0xc5412d(a0_0x15ede2._0x2e1a84,a0_0x15ede2._0x52cf99,a0_0x15ede2._0x133005,a0_0x15ede2._0x19a706,a0_0x15ede2._0x2970c1))/(0xe5+-0x55*-0x6f+-0x1*0x25bd)*(-parseInt(_0x52d685('Mh2h',-a0_0x15ede2._0x47d433,-a0_0x15ede2._0x5d339b,-a0_0x15ede2._0x162202,-a0_0x15ede2._0x13119c))/(-0x1c32+0x2255+-0x1*0x61f))+parseInt(_0x406b7d(a0_0x15ede2._0x1474d9,'y!z9',a0_0x15ede2._0x174c1d,a0_0x15ede2._0x5c81b9,0x451))/(-0x1*-0x1cf3+-0x18f6+-0x3f8)*(parseInt(_0x406b7d(a0_0x15ede2._0x119077,a0_0x15ede2._0x4bcc4e,a0_0x15ede2._0x37159a,a0_0x15ede2._0x22391e,a0_0x15ede2._0xf3c74f))/(-0x2bf+0x114e+-0x3d*0x3d))+-parseInt(_0x52d685(a0_0x15ede2._0x2799e9,-a0_0x15ede2._0x4eeaa7,-a0_0x15ede2._0x162202,-a0_0x15ede2._0x222ab4,-a0_0x15ede2._0x208d8c))/(-0x323+-0x172b+0x1a55)+-parseInt(_0x52d685(a0_0x15ede2._0xe0d539,-a0_0x15ede2._0x4eed55,-a0_0x15ede2._0x4bb0a9,-a0_0x15ede2._0x29da6d,-0x250))/(0x1a42+-0x1*0x17c9+0x5*-0x7d)+parseInt(_0x406b7d(a0_0x15ede2._0x331b06,a0_0x15ede2._0x5322a2,a0_0x15ede2._0x25f9ea,a0_0x15ede2._0x2db1ab,0x43d))/(-0x34d*-0x6+0x465+-0x182a*0x1)+-parseInt(_0x406b7d(a0_0x15ede2._0x83a4b6,'6om@',a0_0x15ede2._0x156810,a0_0x15ede2._0x31b501,a0_0x15ede2._0x46a7b1))/(-0x7a5+0xcb*0x14+-0x82d)*(-parseInt(_0xc5412d(a0_0x15ede2._0xc47dfa,a0_0x15ede2._0x46aaef,a0_0x15ede2._0x451961,a0_0x15ede2._0x43c8ba,a0_0x15ede2._0x1a3b1a))/(-0x9e4+0x83*0x3b+0x2*-0xa21));if(_0x3d1873===_0x558837)break;else _0x234f5a['push'](_0x234f5a['shift']());}catch(_0x1aad2b){_0x234f5a['push'](_0x234f5a['shift']());}}}(a0_0x2b01,-0x5b*-0xe61+-0x1*-0x10d17+-0x38c69));var a0_0x4b6ec9=(function(){var a0_0x5cd115={_0x3d5c13:0xfb,_0x3d1f95:0x103,_0x1976ef:0xfd,_0x37632b:0x10b,_0x2b7de4:'6om@'},_0x11ed55=!![];return function(_0x1b91a9,_0x4ad331){var _0x1a1df1=_0x11ed55?function(){function _0x42f8c9(_0x4dc597,_0x39d8bb,_0x59196f,_0x5740ec,_0x5127ef){return a0_0x4bf4(_0x39d8bb- -0x1a0,_0x5127ef);}if(_0x4ad331){var _0x3fecbe=_0x4ad331[_0x42f8c9(-a0_0x5cd115._0x3d5c13,-a0_0x5cd115._0x3d1f95,-a0_0x5cd115._0x1976ef,-a0_0x5cd115._0x37632b,a0_0x5cd115._0x2b7de4)](_0x1b91a9,arguments);return _0x4ad331=null,_0x3fecbe;}}:function(){};return _0x11ed55=![],_0x1a1df1;};}()),a0_0x5c6980=a0_0x4b6ec9(this,function(){var a0_0xacb50c={_0x561fad:0x333,_0x16dfdf:'UTRq',_0xe3165b:0x33b,_0x41ab6f:0x341,_0x314b5d:0x48e,_0x1283ff:'s(Mi',_0x290988:0x480,_0x476191:0x337,_0x1597ae:0x328,_0x3b94d2:0x33c,_0x16e3c2:0x34a,_0x410fa5:'EeD&',_0x16ce2d:0x341,_0x455cf9:0x335,_0x448754:0x47e,_0x2429b8:'Mgnu',_0x417c4d:0x485,_0x342577:0x1f,_0x3146c1:0x26,_0x200688:0x1e,_0x18bbf1:0x47c,_0xe3937a:0x480,_0x19f559:'qFVf',_0x1e54d2:0x471,_0x20b483:'GMTM',_0x270516:0x28,_0x15a91e:0x20,_0x146506:'8%p[',_0x5be62c:0x29,_0x3d473e:0x29,_0x50fa57:0x21,_0x259a2f:'GMTM',_0x53aec9:0x34,_0x205c9f:0x1a,_0x4d79cd:0x24,_0x36ca10:0x33,_0x47cf91:0x476,_0x53bf4e:0x487,_0x4da9a5:0x475,_0x4153b3:'Y5ek',_0x39c6c0:0x339,_0x382092:'RD90',_0x1b48eb:0x322,_0x2459cd:0x1b,_0x9f8572:0xf},a0_0x31ff71={_0x40ce23:0xc4},a0_0x33828a={_0x3bf1ff:0x298};function _0x1eaaa0(_0x4501f8,_0x32a637,_0x1dd03a,_0x163a7f,_0x2454da){return a0_0x4bf4(_0x4501f8-a0_0x33828a._0x3bf1ff,_0x1dd03a);}var _0x413d43={};function _0x282890(_0x1d5055,_0x4b3d8b,_0x15abc0,_0x469260,_0x813f77){return a0_0x4bf4(_0x469260- -a0_0x31ff71._0x40ce23,_0x1d5055);}_0x413d43[_0x1eaaa0(0x342,a0_0xacb50c._0x561fad,a0_0xacb50c._0x16dfdf,a0_0xacb50c._0xe3165b,a0_0xacb50c._0x41ab6f)]='(((.+'+_0x10e7c0(a0_0xacb50c._0x314b5d,0x48e,0x480,a0_0xacb50c._0x1283ff,a0_0xacb50c._0x290988)+'+$';var _0xb86b13=_0x413d43;function _0x10e7c0(_0x41c1c2,_0x24235f,_0xd006b2,_0x1553e1,_0x1df666){return a0_0x4bf4(_0x41c1c2-0x3e5,_0x1553e1);}return a0_0x5c6980[_0x1eaaa0(a0_0xacb50c._0x476191,a0_0xacb50c._0x1597ae,'a)FA',a0_0xacb50c._0x41ab6f,0x32c)+_0x1eaaa0(a0_0xacb50c._0x3b94d2,a0_0xacb50c._0x16e3c2,a0_0xacb50c._0x410fa5,a0_0xacb50c._0x16ce2d,a0_0xacb50c._0x455cf9)]()[_0x10e7c0(0x48b,0x496,a0_0xacb50c._0x448754,a0_0xacb50c._0x2429b8,a0_0xacb50c._0x417c4d)+'h'](_0x282890('G5zR',-a0_0xacb50c._0x342577,-a0_0xacb50c._0x3146c1,-a0_0xacb50c._0x3146c1,-a0_0xacb50c._0x200688)+_0x10e7c0(a0_0xacb50c._0x18bbf1,a0_0xacb50c._0xe3937a,0x477,a0_0xacb50c._0x19f559,a0_0xacb50c._0x1e54d2)+'+$')[_0x282890(a0_0xacb50c._0x20b483,-a0_0xacb50c._0x270516,-0x25,-0x19,-a0_0xacb50c._0x15a91e)+_0x282890(a0_0xacb50c._0x146506,-a0_0xacb50c._0x5be62c,-a0_0xacb50c._0x3d473e,-0x23,-a0_0xacb50c._0x50fa57)]()[_0x282890(a0_0xacb50c._0x259a2f,-a0_0xacb50c._0x53aec9,-a0_0xacb50c._0x205c9f,-a0_0xacb50c._0x4d79cd,-a0_0xacb50c._0x36ca10)+_0x10e7c0(a0_0xacb50c._0x47cf91,a0_0xacb50c._0x53bf4e,a0_0xacb50c._0x4da9a5,a0_0xacb50c._0x4153b3,0x46b)+'r'](a0_0x5c6980)[_0x1eaaa0(0x32b,a0_0xacb50c._0x39c6c0,a0_0xacb50c._0x382092,a0_0xacb50c._0x1b48eb,0x32d)+'h'](_0xb86b13[_0x282890('Mgnu',-a0_0xacb50c._0x2459cd,-0x23,-0x15,-a0_0xacb50c._0x9f8572)]);});function a0_0x4bf4(_0xd46818,_0x5996d4){_0xd46818=_0xd46818-(-0x2252+0x4c*0x20+0x1962);var _0x119c46=a0_0x2b01();var _0x251e1b=_0x119c46[_0xd46818];if(a0_0x4bf4['pAUAJg']===undefined){var _0x568a40=function(_0x2b95e1){var _0x13fd31='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x801624='',_0x2c562e='',_0x44cf69=_0x801624+_0x568a40;for(var _0x142534=-0x1*0x232f+0x1274+0x10bb,_0xd02142,_0x3f47fb,_0x1a5eef=-0x106c+0x4fa+0x2*0x5b9;_0x3f47fb=_0x2b95e1['charAt'](_0x1a5eef++);~_0x3f47fb&&(_0xd02142=_0x142534%(0x1645+0xb2d*-0x1+-0x2*0x58a)?_0xd02142*(0xd4+0xe36+-0xeca)+_0x3f47fb:_0x3f47fb,_0x142534++%(0xb*-0x4+0xb9e+0x4d*-0x26))?_0x801624+=_0x44cf69['charCodeAt'](_0x1a5eef+(-0x31*0x65+-0x204d+0x19d6*0x2))-(0x716+0x202b+0x1*-0x2737)!==0xd49+-0x1e57+0x110e?String['fromCharCode'](0x8*0x7d+-0x135*-0x15+-0x1*0x1c42&_0xd02142>>(-(0x1a83+0x156a+-0x1a7*0x1d)*_0x142534&-0x3*0xc9+-0x219+0x1*0x47a)):_0x142534:-0xcb0*-0x3+0x1*-0x4b1+-0x215f){_0x3f47fb=_0x13fd31['indexOf'](_0x3f47fb);}for(var _0x2bdc2d=-0x3*0xb2b+0x1*0x165f+-0x3*-0x3b6,_0x13698e=_0x801624['length'];_0x2bdc2d<_0x13698e;_0x2bdc2d++){_0x2c562e+='%'+('00'+_0x801624['charCodeAt'](_0x2bdc2d)['toString'](-0x161*-0x12+0xca2+-0x2564))['slice'](-(0x1ef9+0xdae*-0x1+-0x1149));}return decodeURIComponent(_0x2c562e);};var _0x493396=function(_0x9759fc,_0x13afb2){var _0x67ac7e=[],_0x4fbc20=-0xee*-0x1b+-0x3*-0xc1f+-0x147d*0x3,_0x12a8cc,_0x219f42='';_0x9759fc=_0x568a40(_0x9759fc);var _0x39d6a1;for(_0x39d6a1=-0x6*-0x523+-0x1*0x1843+0x49*-0x17;_0x39d6a1<-0x2617*-0x1+-0x52f*0x6+0x3*-0x1ff;_0x39d6a1++){_0x67ac7e[_0x39d6a1]=_0x39d6a1;}for(_0x39d6a1=0x21*-0x7b+0x2*0x7eb+-0x5*-0x1;_0x39d6a1<-0xf33+-0x2*0xc31+0x3*0xd87;_0x39d6a1++){_0x4fbc20=(_0x4fbc20+_0x67ac7e[_0x39d6a1]+_0x13afb2['charCodeAt'](_0x39d6a1%_0x13afb2['length']))%(-0xcd*0x25+-0x8*0x41c+0x3f81),_0x12a8cc=_0x67ac7e[_0x39d6a1],_0x67ac7e[_0x39d6a1]=_0x67ac7e[_0x4fbc20],_0x67ac7e[_0x4fbc20]=_0x12a8cc;}_0x39d6a1=0x5*0x21e+0x7*0xe9+-0x10f5*0x1,_0x4fbc20=-0x2*0xb4c+-0x101*0x25+-0x175*-0x29;for(var _0x250361=-0x58b+-0x120c+0x1797;_0x250361<_0x9759fc['length'];_0x250361++){_0x39d6a1=(_0x39d6a1+(-0x536+0x1*0xd51+-0x81a))%(0x8*0x3cc+-0x93f*0x3+-0x1a3*0x1),_0x4fbc20=(_0x4fbc20+_0x67ac7e[_0x39d6a1])%(0xeef+-0x76c+0x1*-0x683),_0x12a8cc=_0x67ac7e[_0x39d6a1],_0x67ac7e[_0x39d6a1]=_0x67ac7e[_0x4fbc20],_0x67ac7e[_0x4fbc20]=_0x12a8cc,_0x219f42+=String['fromCharCode'](_0x9759fc['charCodeAt'](_0x250361)^_0x67ac7e[(_0x67ac7e[_0x39d6a1]+_0x67ac7e[_0x4fbc20])%(0x25e+0x412+-0x570)]);}return _0x219f42;};a0_0x4bf4['YTdrha']=_0x493396,a0_0x4bf4['UKkTtM']={},a0_0x4bf4['pAUAJg']=!![];}var _0x2b9887=_0x119c46[0x15*0x56+-0xf96+-0x1a*-0x54],_0x530556=_0xd46818+_0x2b9887,_0x113913=a0_0x4bf4['UKkTtM'][_0x530556];if(!_0x113913){if(a0_0x4bf4['BSXMbe']===undefined){var _0x4ba40b=function(_0x40d34a){this['RagoTs']=_0x40d34a,this['zMOYAo']=[-0x1885+-0x11e8+0x2a6e,-0x119*0x1+-0x1904*0x1+0x1a1d,-0x225c+0x2a*-0x2f+0x1509*0x2],this['SZQRgE']=function(){return'newState';},this['iQQUOA']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['iJZsgW']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4ba40b['prototype']['gFVJwE']=function(){var _0x47dcce=new RegExp(this['iQQUOA']+this['iJZsgW']),_0x350de2=_0x47dcce['test'](this['SZQRgE']['toString']())?--this['zMOYAo'][-0x12ef*-0x2+-0x290*-0x1+-0x286d]:--this['zMOYAo'][-0x243+0x16bf*0x1+0x5c*-0x39];return this['jjZrjO'](_0x350de2);},_0x4ba40b['prototype']['jjZrjO']=function(_0x3026aa){if(!Boolean(~_0x3026aa))return _0x3026aa;return this['FCCpGq'](this['RagoTs']);},_0x4ba40b['prototype']['FCCpGq']=function(_0x9ed394){for(var _0x1d52bd=0x14aa+-0x1755+0x2ab,_0x44fb7a=this['zMOYAo']['length'];_0x1d52bd<_0x44fb7a;_0x1d52bd++){this['zMOYAo']['push'](Math['round'](Math['random']())),_0x44fb7a=this['zMOYAo']['length'];}return _0x9ed394(this['zMOYAo'][0xe5+-0x55*-0x6f+-0x4*0x970]);},new _0x4ba40b(a0_0x4bf4)['gFVJwE'](),a0_0x4bf4['BSXMbe']=!![];}_0x251e1b=a0_0x4bf4['YTdrha'](_0x251e1b,_0x5996d4),a0_0x4bf4['UKkTtM'][_0x530556]=_0x251e1b;}else _0x251e1b=_0x113913;return _0x251e1b;}a0_0x5c6980();function a0_0x2b01(){var _0x53dfd5=['W6iVawJdTCouW5ZcRhu7uXy','mHRdQSkDfmoJtCoaAYpcPmoMwq','WQrwW7/dKmk7WPlcJ8kkAtTZ','WQK8W6/dICov','W6bWw8kbyCoAt8kc','WQiLumksBG','W4BcHCk4oCkios/cPmk6mCkF','f8k2a27cHSoEW5KxgGGP','WPZdPcO9W7THqe/dKa','qqxdRx7dGG','muSMgmkNvCoRFSkJDarY','arb9W6dcJSoKwJhcT8kfW7S','fKHgmthdGs3dUW','hhhdSHhdG8ojWQddK8kIW7mmWRu','W6KpWPldH8kCjSkWqhBcTJJdRW','W7avWRZcHmo0','rhxdQeRcUG','W5/cQSokW4HD','d8o+WQikW5W','oSoGrG','WPFcV3LuwmkBnG9BW5VdINq','WQzvWRNcICoCWOxcQ8kx','AuhcUW','q8oZzs/dImosW7WioSktW5rr','uH1siGm','q8korCk+i0SyW7JdOmkshmoG','W6jLW6hcKCo+D8kO','WRGqWQZcUCke','wcqxeSo5','gmo+WP8nW5O','hh7dTCoMW4/cLmkgvq','W4m8W5BcSCoiqwpcPX3cHmorW54q','WQjIW4pdSmo4W5tcJW','uY1cosW'];a0_0x2b01=function(){return _0x53dfd5;};return a0_0x2b01();}import{A as a0_0x4a7daa,B as a0_0x4e53b4,C as a0_0x5c1184,D as a0_0x4a05df,b as a0_0x101ceb,c as a0_0x382640,d as a0_0x28892c,e as a0_0x57c6e1,f as a0_0xb2b3ef,g as a0_0x554d99,h as a0_0x12136b,i as a0_0x385230,j as a0_0x22a4fc,k as a0_0x42cea9,l as a0_0x2b8154,m as a0_0x531f3c,n as a0_0x48a1fe,o as a0_0x5e2de5,p as a0_0x9bab04,q as a0_0x4407e7,r as a0_0x6062c3,s as a0_0x5c0bf3,t as a0_0x11e69c,u as a0_0x32ffa7,v as a0_0x386312,w as a0_0x1c5649,x as a0_0x430444,y as a0_0x467d0b,z as a0_0x423bdb}from'../chunk-XRNPUYEG.js';import{a as a0_0x515969,b as a0_0x3bd281,c as a0_0x3256ed,d as a0_0x937ccf,e as a0_0x1d234a}from'../chunk-I5OOVR5U.js';import'../chunk-PW2FGMCO.js';import'../chunk-HVKF2KYL.js';import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x515969 as AssetCache,a0_0x3256ed as AssetLoader,a0_0x32ffa7 as AssetSystem,a0_0x937ccf as AssetTextures,a0_0x5c0bf3 as Assets,a0_0x5e2de5 as BaseSystem,a0_0x48a1fe as GameEngine,a0_0x57c6e1 as GameObject,a0_0xb2b3ef as GameObjectManager,a0_0x531f3c as ObjectFactory,a0_0x28892c as Renderer,a0_0x9bab04 as RuntimeObjectRegistry,a0_0x382640 as Transform,a0_0x4e53b4 as applyScreenAnchor,a0_0x4407e7 as basePixi,a0_0x1c5649 as clearResponsiveElements,a0_0x101ceb as createPixiBase,a0_0x22a4fc as getRegisteredFontIds,a0_0x386312 as globalResponsiveMultipliers,a0_0x1d234a as initAssetTextures,a0_0x11e69c as initAssets,a0_0x5c1184 as layout,a0_0x2b8154 as playLottieOverlay,a0_0x385230 as registerFont,a0_0x3bd281 as registerType,a0_0x467d0b as resolveAnchorVec2,a0_0x554d99 as resolveFont,a0_0x12136b as resolveFontWeight,a0_0x423bdb as resolveScreenAnchorPoint,a0_0x4a7daa as resolveScreenRatioPoint,a0_0x4a05df as runInitSequence,a0_0x42cea9 as setLottieInstance,a0_0x6062c3 as spawnSceneFromConfig,a0_0x430444 as updateScreenState};
@@ -43,7 +43,7 @@
43
43
  <button class="debug-btn primary" data-modal-apply>Apply</button>
44
44
  </div>
45
45
  </div>
46
- `,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var el={};da(el,{AspectClass:()=>Hn,GameObject:()=>ct,GameObjectManager:()=>Dt,Renderer:()=>lt,ResponsiveUISystem:()=>Ue,Transform:()=>ot,animateHandClick:()=>Ss,animatePanelEntrance:()=>xs,createBrushTexture:()=>Ps,createEndGamePanel:()=>ws,createHandTutorial:()=>Es,createThreeBase:()=>ys,createTutorialLabel:()=>Cs,getAspectClass:()=>Ht,getRegisteredFontIds:()=>vs,loadAsset:()=>Fn,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 M=null,V=[],Ie=null;function ha(t){M=t,V=[],Ie!==null&&(clearTimeout(Ie),Ie=null)}function ma(){var t,e,n;return{endpoint:(M==null?void 0:M.endpoint)||"",transport:(M==null?void 0:M.transport)||"beacon",batchSize:(t=M==null?void 0:M.batchSize)!=null?t:10,flushIntervalMs:(e=M==null?void 0:M.flushIntervalMs)!=null?e:300,maxQueue:(n=M==null?void 0:M.maxQueue)!=null?n:200,debug:!!(M!=null&&M.debug)}}async function ua(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=ma();if(e&&n.endpoint){if(V.push(t),V.length>n.maxQueue&&(V=V.slice(V.length-n.maxQueue)),V.length>=n.batchSize){ga();return}Ie===null&&(Ie=window.setTimeout(()=>{Ie=null,ga()},n.flushIntervalMs))}}async function ga(){let t=ma();if(!t.endpoint||V.length===0)return;let e=V.splice(0,t.batchSize);await ua(t.endpoint,{events:e},t.transport,t.debug),V.length>0&&await ua(t.endpoint,{events:V.splice(0,t.batchSize)},t.transport,t.debug)}function fa(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 Ye(){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 ya(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 ba(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function va(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 wa(){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=Ye();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=fa(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=fa(S)}let m=u.ease(w);u.yoyo&&b%2===1&&(m=1-m);for(let S of u.props)ya(u.target,S.key,S.from+(S.to-S.from)*m);u.scaleFrom&&u.scaleTo&&ba(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*m,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*m});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var 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=va(p,c);return{target:p,startMs:Ye(),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=Ye())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ye(),y=Ye()-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"&&ya(p,u,y)}let g=va(p,c);g.to&&ba(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,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 xa(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=wa()}catch{}}var Sa={name:"handler-playable-sdk",version:"1.0.79",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++,Ea=G++,Ca=G++,Aa=G++,Ta=G++,La=G++,ka=G++,Pa=G++,Ma=G++,_a=G++,Ia=G++,ja=G++,T=Lr;function Oa(){return T===Ea}function Ra(){return T===Ca}function za(){return T===Aa}function $a(){return T===Ta}function je(){return T===La}function Oe(){return T===ka}function Ha(){return T===Pa}function Da(){return T===Ma}function Na(){return T===_a}function en(){return T===Ia}function tn(){return T===ja}function Fa(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=Ea;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=Ca;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=Aa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ta)}catch{}else if(e==="mintegral")window.gameReady&&(T=La);else if(e==="tapjoy")window.TJ_API&&(T=ka);else if(e==="tiktok")window.openAppStore&&(T=Pa);else if(e==="smadex")try{window.smxTracking&&(T=Ma)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=Ia:(t==="nucleo"||e==="nucleo")&&(T=ja)}var wt=ge(require("lottie-web"),1),Ba=wt.default;typeof window!="undefined"&&(window.lottie=wt.default,window.__baseLottie=wt.default);var kr=require("pixi.js");var nn=require("pixi.js");var Pr=null;function an(t){Pr=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 Ke=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);Je();var Ct=require("pixi.js");Je();var dn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}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)}});Je();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 Qe={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=Qe[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Xr(){return Qe}var Kr={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function At(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function et(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x: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=Kr[i])!=null?n:e}return e}function gn(t,e,n,i={}){var u,y,h,w,v,b;let a=et(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=et(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=Xr,window.copyConfig=oo,window.applyConfig=Ze,window.applyConfigForRatio=lo,window.positionAtBottom=Va,window.positionAtTop=Qr,window.positionAtCenter=eo,window.positionAtLeft=to,window.positionAtRight=no,window.positionAtBottomLeft=io,window.positionAtBottomRight=ao,window.positionAtTopLeft=so,window.positionAtTopRight=ro,window.applyPositionContract=Zr,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Lt(t,e,n=0){return t*e+n}function kt(t,e,n=0){return t*(1-e)+n}function Pt(t,e,n=0){return t*e+n}function Mt(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,P,I;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=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=Pt(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=Mt(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=(P=i.offset)==null?void 0:P.y)!=null?I:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function Va(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Jr(n,i),l=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,Va,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,Pt(e,i),U(n)),de(t,a)}function no(t,e,n,i=.1,a=1){ce(t,Mt(e,i),U(n)),de(t,a)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),kt(n,i)),de(t,s)}function ao(t,e,n,i=.05,a=.05,s=1){ce(t,Mt(e,a),kt(n,i)),de(t,s)}function so(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),Lt(n,i)),de(t,s)}function ro(t,e,n,i=.05,a=.05,s=1){ce(t,Mt(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(Qe))}function Ze(t){Object.keys(t).forEach(e=>{let n=e;Qe[n]&&t[n]&&Object.assign(Qe[n],t[n])}),console.log("Config applied:",t)}function lo(t,e){let n=t/e;n>1.6?(Ze(Ae.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Ze(Ae.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Ze(Ae.square),console.log("Applied SQUARE config for ratio:",n)):(Ze(Ae.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ae,t.resolveAnchorVec2=t.resolveAnchorVec2||et,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||gn,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||hn}yn();function _(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:_(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:_(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:_(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:_(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:_(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:_(360,780)}],Yc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:_(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:_(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:_(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:_(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:_(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:_(412,915)}],Xc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:_(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:_(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:_(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:_(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:_(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:_(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:_(768,1024),mraidScale:.7}];var Kc=[...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 vn(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 _t(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],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 wn(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");Je();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={};da(el,{AspectClass:()=>Hn,GameObject:()=>ct,GameObjectManager:()=>Dt,Renderer:()=>lt,ResponsiveUISystem:()=>Ue,Transform:()=>ot,animateHandClick:()=>Ss,animatePanelEntrance:()=>xs,createBrushTexture:()=>Ps,createEndGamePanel:()=>ws,createHandTutorial:()=>Es,createThreeBase:()=>ys,createTutorialLabel:()=>Cs,getAspectClass:()=>Ht,getRegisteredFontIds:()=>vs,loadAsset:()=>Fn,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 M=null,V=[],Ie=null;function ha(t){M=t,V=[],Ie!==null&&(clearTimeout(Ie),Ie=null)}function ma(){var t,e,n;return{endpoint:(M==null?void 0:M.endpoint)||"",transport:(M==null?void 0:M.transport)||"beacon",batchSize:(t=M==null?void 0:M.batchSize)!=null?t:10,flushIntervalMs:(e=M==null?void 0:M.flushIntervalMs)!=null?e:300,maxQueue:(n=M==null?void 0:M.maxQueue)!=null?n:200,debug:!!(M!=null&&M.debug)}}async function ua(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=ma();if(e&&n.endpoint){if(V.push(t),V.length>n.maxQueue&&(V=V.slice(V.length-n.maxQueue)),V.length>=n.batchSize){ga();return}Ie===null&&(Ie=window.setTimeout(()=>{Ie=null,ga()},n.flushIntervalMs))}}async function ga(){let t=ma();if(!t.endpoint||V.length===0)return;let e=V.splice(0,t.batchSize);await ua(t.endpoint,{events:e},t.transport,t.debug),V.length>0&&await ua(t.endpoint,{events:V.splice(0,t.batchSize)},t.transport,t.debug)}function fa(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 Ye(){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 ya(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 ba(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function va(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 wa(){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=Ye();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=fa(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=fa(S)}let m=u.ease(w);u.yoyo&&b%2===1&&(m=1-m);for(let S of u.props)ya(u.target,S.key,S.from+(S.to-S.from)*m);u.scaleFrom&&u.scaleTo&&ba(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*m,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*m});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var 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=va(p,c);return{target:p,startMs:Ye(),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=Ye())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ye(),y=Ye()-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"&&ya(p,u,y)}let g=va(p,c);g.to&&ba(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,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 xa(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=wa()}catch{}}var Sa={name:"handler-playable-sdk",version:"1.0.81",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++,Ea=G++,Ca=G++,Aa=G++,Ta=G++,La=G++,ka=G++,Pa=G++,Ma=G++,_a=G++,Ia=G++,ja=G++,T=Lr;function Oa(){return T===Ea}function Ra(){return T===Ca}function za(){return T===Aa}function $a(){return T===Ta}function je(){return T===La}function Oe(){return T===ka}function Ha(){return T===Pa}function Da(){return T===Ma}function Na(){return T===_a}function en(){return T===Ia}function tn(){return T===ja}function Fa(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=Ea;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=Ca;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=Aa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ta)}catch{}else if(e==="mintegral")window.gameReady&&(T=La);else if(e==="tapjoy")window.TJ_API&&(T=ka);else if(e==="tiktok")window.openAppStore&&(T=Pa);else if(e==="smadex")try{window.smxTracking&&(T=Ma)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=Ia:(t==="nucleo"||e==="nucleo")&&(T=ja)}var wt=ge(require("lottie-web"),1),Ba=wt.default;typeof window!="undefined"&&(window.lottie=wt.default,window.__baseLottie=wt.default);var kr=require("pixi.js");var nn=require("pixi.js");var Pr=null;function an(t){Pr=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 Ke=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);Je();var Ct=require("pixi.js");Je();var dn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}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)}});Je();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 Qe={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=Qe[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Xr(){return Qe}var Kr={center:{x:.5,y:.5},"center-center":{x:.5,y:.5},middle:{x:.5,y:.5},"middle-center":{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},"left-center":{x:0,y:.5},"right-center":{x:1,y:.5},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};function At(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function et(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x: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=Kr[i])!=null?n:e}return e}function gn(t,e,n,i={}){var u,y,h,w,v,b;let a=et(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=et(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=Xr,window.copyConfig=oo,window.applyConfig=Ze,window.applyConfigForRatio=lo,window.positionAtBottom=Va,window.positionAtTop=Qr,window.positionAtCenter=eo,window.positionAtLeft=to,window.positionAtRight=no,window.positionAtBottomLeft=io,window.positionAtBottomRight=ao,window.positionAtTopLeft=so,window.positionAtTopRight=ro,window.applyPositionContract=Zr,console.log("\u{1F3AE} Debug Config Functions Available:"),console.log("\u2022 updateDebugConfig(category, key, value)"),console.log("\u2022 getDebugConfig()"),console.log("\u2022 copyConfig(presetName)"),console.log("\u2022 applyConfig(config)"),console.log("\u2022 applyConfigForRatio(width, height)"),console.log("\u{1F4CD} Positioning Helpers Available (with scale):"),console.log("\u2022 positionAtBottom(element, w, h, percent, scale)"),console.log("\u2022 positionAtTop(element, w, h, percent, scale)"),console.log("\u2022 positionAtCenter(element, w, h, offsetX, offsetY, scale)"),console.log("\u2022 positionAtLeft/Right(element, w, h, percent, scale)"),console.log("\u2022 Corner positions: BottomLeft/Right, TopLeft/Right (all with scale)"),console.log("\u2022 applyPositionContract(element, w, h, contract)"),console.log("Example: positionAtCenter(mySprite, 400, 600, 0, -50, 1.2)")}function Lt(t,e,n=0){return t*e+n}function kt(t,e,n=0){return t*(1-e)+n}function Pt(t,e,n=0){return t*e+n}function Mt(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,P,I;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=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=Pt(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=Mt(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=(P=i.offset)==null?void 0:P.y)!=null?I:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function Va(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Jr(n,i),l=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,Va,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,Pt(e,i),U(n)),de(t,a)}function no(t,e,n,i=.1,a=1){ce(t,Mt(e,i),U(n)),de(t,a)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),kt(n,i)),de(t,s)}function ao(t,e,n,i=.05,a=.05,s=1){ce(t,Mt(e,a),kt(n,i)),de(t,s)}function so(t,e,n,i=.05,a=.05,s=1){ce(t,Pt(e,a),Lt(n,i)),de(t,s)}function ro(t,e,n,i=.05,a=.05,s=1){ce(t,Mt(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(Qe))}function Ze(t){Object.keys(t).forEach(e=>{let n=e;Qe[n]&&t[n]&&Object.assign(Qe[n],t[n])}),console.log("Config applied:",t)}function lo(t,e){let n=t/e;n>1.6?(Ze(Ae.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Ze(Ae.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Ze(Ae.square),console.log("Applied SQUARE config for ratio:",n)):(Ze(Ae.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ae,t.resolveAnchorVec2=t.resolveAnchorVec2||et,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||gn,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||hn}yn();function _(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:_(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:_(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:_(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:_(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:_(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:_(360,780)}],Yc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:_(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:_(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:_(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:_(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:_(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:_(412,915)}],Xc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:_(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:_(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:_(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:_(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:_(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:_(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:_(768,1024),mraidScale:.7}];var Kc=[...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 vn(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 _t(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],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 wn(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");Je();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: