handler-playable-sdk 0.3.32 → 0.3.33
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.
- package/dist/{chunk-UAQZO7QB.js → chunk-JCCU6XJF.js} +1 -1
- package/dist/cli/brand-dna.mjs +1 -1
- package/dist/cli/canva-import.mjs +1 -1
- package/dist/cli/cleanup-assets.mjs +1 -1
- package/dist/cli/fix-scales.mjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/screen-helper.mjs +1 -1
- package/dist/cli/setup-library.mjs +1 -1
- package/dist/cli/student-helper.mjs +1 -1
- package/dist/cli/sync-screens.mjs +1 -1
- package/dist/cli/validate-assets.mjs +1 -1
- package/dist/cli/validate.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +1 -1
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +1 -1
- package/dist/three/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
|
-
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 l0={};an(l0,{COLORS:()=>We,ConfigWatcher:()=>Ht,DebugPanel:()=>rr,DefaultReloadStrategy:()=>bn,Handler:()=>Pe,PlayableLoadingScreen:()=>ss,PreviewShell:()=>ns,STROKE_WIDTH:()=>jg,THEME:()=>Dg,applyConfigOverride:()=>bt,applyConfigOverrides:()=>yt,applyConfigsToDisk:()=>hn,applyDefaults:()=>$t,baseLottie:()=>ws,bootstrap:()=>Zw,clearConfigOverrides:()=>vt,clearConfigOverridesForObject:()=>Ed,configOverrideManager:()=>Sd,createPreviewShell:()=>hc,deepClone:()=>ne,default:()=>zt,defaultPreset:()=>Nr,deviceGroups:()=>Vs,devicePresets:()=>Ws,diffConfigs:()=>Fs,exportConfigsAsJSON:()=>fn,getConfigOverrides:()=>de,getConfigStateSummary:()=>Or,getOverrideMode:()=>pn,getPresetById:()=>Ut,getPresetsByCategory:()=>Xm,loadAllObjectConfigs:()=>Rr,loadComponentSchemas:()=>Pr,loadEngineConfig:()=>jr,loadGamePromptConfig:()=>zs,loadObjectCentricConfig:()=>et,loadObjectConfig:()=>xt,loadSceneConfig:()=>Dr,rehydrateObject:()=>$s,removeConfigOverride:()=>Lr,resetToApplied:()=>gn,resetToOriginal:()=>Ir,setBootstrapDependencies:()=>Kw,setOverrideMode:()=>Rs,setupHotReload:()=>qs,setupLiveEditBridge:()=>rs,toLegacyFormat:()=>Ns,validateObjectConfig:()=>gi});module.exports=nm(l0);var ht={};function gr(e,t,i=!1){ht[e]||(ht[e]=[]),ht[e].push({fn:t,once:i})}function bs(e,t){if(ht[e]){if(!t){delete ht[e];return}ht[e]=ht[e].filter(i=>i.fn!==t)}}function mr(e,...t){let i=ht[e];if(i)for(let n of[...i])n.fn(...t),n.once&&bs(e,n.fn)}function be(e,t){gr(e,t,!0)}var ee=null,Ce=[],ui=null;function Pc(e){ee=e,Ce=[],ui!==null&&(clearTimeout(ui),ui=null)}function Rc(){var e,t,i;return{endpoint:(ee==null?void 0:ee.endpoint)||"",transport:(ee==null?void 0:ee.transport)||"beacon",batchSize:(e=ee==null?void 0:ee.batchSize)!=null?e:10,flushIntervalMs:(t=ee==null?void 0:ee.flushIntervalMs)!=null?t:300,maxQueue:(i=ee==null?void 0:ee.maxQueue)!=null?i:200,debug:!!(ee!=null&&ee.debug)}}async function Ic(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function ys(e,t){let i=Rc();if(t&&i.endpoint){if(Ce.push(e),Ce.length>i.maxQueue&&(Ce=Ce.slice(Ce.length-i.maxQueue)),Ce.length>=i.batchSize){Mc();return}ui===null&&(ui=window.setTimeout(()=>{ui=null,Mc()},i.flushIntervalMs))}}async function Mc(){let e=Rc();if(!e.endpoint||Ce.length===0)return;let t=Ce.splice(0,e.batchSize);await Ic(e.endpoint,{events:t},e.transport,e.debug),Ce.length>0&&await Ic(e.endpoint,{events:Ce.splice(0,e.batchSize)},e.transport,e.debug)}function jc(e){return Math.max(0,Math.min(1,e))}function rm(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function sn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function am(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function Dc(e,t,i){try{e[t]=i}catch{}}function sm(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function zc(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Nc(e,t){let i=sm(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function Bc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=d=>{var p;e.add(d);let u=(p=t.get(d.target))!=null?p:new Set;u.add(d),t.set(d.target,u),n()},a=d=>{e.delete(d);let u=t.get(d.target);u&&(u.delete(d),u.size===0&&t.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},o=()=>{var u,p;let d=sn();for(let f of Array.from(e)){if(f.killed||f.paused)continue;let g=d-f.startMs-f.delayMs;if(g<0)continue;let h=f.durationMs>0?g/f.durationMs:1,m=jc(h),b=f.repeat>=0?f.repeat+1:1,y=f.repeat>0?Math.min(Math.floor(h),b-1):0;if(f.repeat>0&&h>=1){let w=h-y;m=jc(w)}let v=f.ease(m);f.yoyo&&y%2===1&&(v=1-v);for(let w of f.props)Dc(f.target,w.key,w.from+(w.to-w.from)*v);f.scaleFrom&&f.scaleTo&&zc(f.target,{x:f.scaleFrom.x+(f.scaleTo.x-f.scaleFrom.x)*v,y:f.scaleFrom.y+(f.scaleTo.y-f.scaleFrom.y)*v});try{(u=f.onUpdate)==null||u.call(f)}catch{}if(h>=b){s(f);try{(p=f.onComplete)==null||p.call(f)}catch{}}}},l=(d,u,p)=>{var w;let f=Math.max(0,(typeof u.duration=="number"?u.duration:.5)*1e3),g=Math.max(0,(typeof u.delay=="number"?u.delay:0)*1e3+((w=p==null?void 0:p.delayMsOverride)!=null?w:0)),h=rm(u.ease),m=typeof u.repeat=="number"?Math.max(0,u.repeat|0):0,b=u.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(u)){if(y.has(E))continue;let A=u[E];typeof A=="number"&&v.push({key:E,from:am(d,E),to:A})}let x=Nc(d,u);return{target:d,startMs:sn(),delayMs:g,durationMs:f,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:m,yoyo:b,onUpdate:typeof u.onUpdate=="function"?u.onUpdate:void 0,onComplete:typeof u.onComplete=="function"?u.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,u){let p=l(d,u);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=sn())},resume:()=>{var h;if(!p.paused)return;let f=(h=p.pauseAtMs)!=null?h:sn(),g=sn()-f;p.startMs+=g,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(d,u,p){return c.set(d,u),c.to(d,p)},set(d,u){if(!d||!u)return;for(let f of Object.keys(u)){let g=u[f];f==="scale"||f==="scaleX"||f==="scaleY"||typeof g=="number"&&Dc(d,f,g)}let p=Nc(d,u);p.to&&zc(d,p.to)},killTweensOf(d){let u=t.get(d);if(u)for(let p of Array.from(u))s(p)},timeline(d={}){let u=[],p=0,f=!1,g=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},m=y=>{u.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);p=Math.max(p,y.atMs+v)},b={to(y,v,x){return m({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,w){return m({kind:"fromTo",target:y,vars:x,from:v,atMs:h(w)}),b},play(){var y,v;if(f)return b;f=!0,g=[];for(let x of u)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),g.push(c.to(x.target,{...x.vars,delay:x.atMs/1e3+((v=x.vars.delay)!=null?v:0)}));return b},pause(){for(let y of g)y.pause();return b},kill(){for(let y of g)y.kill();g=[],f=!1}};return d.paused||b.play(),b}};return c}function Fc(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=Bc()}catch{}}var $c={name:"handler-playable-sdk",version:"0.3.32",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 && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",sharp:"^0.34.5"}};var ye=0,lm=ye++,Hc=ye++,Uc=ye++,qc=ye++,Gc=ye++,Wc=ye++,Vc=ye++,Yc=ye++,Kc=ye++,Xc=ye++,Zc=ye++,Jc=ye++,K=lm;function Qc(){return K===Hc}function ed(){return K===Uc}function td(){return K===qc}function id(){return K===Gc}function pi(){return K===Wc}function fi(){return K===Vc}function nd(){return K===Yc}function rd(){return K===Kc}function ad(){return K===Xc}function vs(){return K===Zc}function xs(){return K===Jc}function sd(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),K=Hc;return}catch{}else if(e==="dapi")try{dapi.isReady(),K=Uc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(K=qc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(K=Gc)}catch{}else if(t==="mintegral")window.gameReady&&(K=Wc);else if(t==="tapjoy")window.TJ_API&&(K=Vc);else if(t==="tiktok")window.openAppStore&&(K=Yc);else if(t==="smadex")try{window.smxTracking&&(K=Kc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(K=Xc)}catch{}else t==="vungle"?K=Zc:(e==="nucleo"||t==="nucleo")&&(K=Jc)}var br=di(require("lottie-web"),1),ws=br.default;typeof window!="undefined"&&(window.lottie=br.default,window.__baseLottie=br.default);var cm=require("pixi.js");var _s=require("pixi.js");var dm=null;function Es(e){dm=e}yr();Ss();var on=require("pixi.js");yr();var mm=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",ks=mm;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(ks=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${ks}`))}}catch{}var mt=class{static async create(t,i,n){var l,c,d,u,p,f,g;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${ks}`);let r=(l=i==null?void 0:i.render)==null?void 0:l.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new on.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(c=i==null?void 0:i.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await Bt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(d=s==null?void 0:s.constructor)==null?void 0:d.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new on.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name),this.applyTransform(o,i==null?void 0:i.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((f=s.constructor)==null?void 0:f.name)==="Container"||s instanceof on.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],m=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(g=o==null?void 0:o.constructor)==null?void 0:g.name),m=!0;break}}catch{continue}m||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=s)}else o=s;else o=s,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,i==null?void 0:i.transform);return o}static applyTransform(t,i){var n,r,a,s;!i||!t||(i.position&&("x"in t&&"y"in t?(t.x=(n=i.position.x)!=null?n:0,t.y=(r=i.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=i.position.x)!=null?a:0,(s=i.position.y)!=null?s:0)),i.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(i.scale):t.scale=i.scale),i.rotation!==void 0&&"rotation"in t&&(t.rotation=i.rotation),i.anchor&&"anchor"in t&&t.anchor&&Array.isArray(i.anchor)&&("set"in t.anchor?t.anchor.set(i.anchor[0],i.anchor[1]):(t.anchor.x=i.anchor[0],t.anchor.y=i.anchor[1])))}};var ln=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var vm=di(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=vm);hi();var vr=require("pixi.js");hi();var Is=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new ln}init(t,i){this.registry.init(t),this.app=i}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let i=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(i.length===0)return;let n=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let l=await mt.create(a,s,this.app);this.instanceCache.set(a,l),console.log("[Assets] Loaded object:",a,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",a,l)}})))};return this.readyPromise=(async()=>{await n(i);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await n(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let i=this.registry.get(t);if(i){let n=await mt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},xm=new Is,wm=new Proxy(xm,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});hi();var pd=require("pixi.js"),Ze={width:400,height:600,designWidth:400,scaleFactor:1},wr={scale:1,position:1},Ps=[];function Em(e,t,i,n,r,a,s){Ps.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function Sm(){Ps.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Ze.scaleFactor;i(e,Ze.width,Ze.height,n,r,!0,!1)})}function Ms(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Ze.width=e,Ze.height=t,Ze.scaleFactor=Math.min(e/Ze.designWidth,1.15),wr.scale=Ze.scaleFactor,wr.position=1,console.log(`[SCREEN] Global multipliers - scale: ${wr.scale.toFixed(3)}`),Sm()}var dn={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 Am(e,t,i){let n=dn[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function Cm(){return dn}var Tm={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 xr(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function _r(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:xr(e[0],t.x),y:xr(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:xr(n.x,t.x),y:xr(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=Tm[n])!=null?i:t}return t}function fd(e,t,i,n={}){var f,g,h,m,b,y;let r=_r(i),a=(f=n.inset)!=null?f:{},s=(g=n.padding)!=null?g:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,l=((m=a.right)!=null?m:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,u=Math.max(0,e-o-l),p=Math.max(0,t-c-d);return{x:o+u*r.x,y:c+p*r.y}}function hd(e,t,i,n={}){var h,m,b,y,v,x;let r=(h=n.inset)!=null?h:{},a=(m=n.padding)!=null?m:{x:0,y:0},s=((b=r.left)!=null?b:0)+a.x,o=((y=r.right)!=null?y:0)+a.x,l=((v=r.top)!=null?v:0)+a.y,c=((x=r.bottom)!=null?x:0)+a.y,d=Math.max(0,e-s-o),u=Math.max(0,t-l-c),p=_r(i,{x:.5,y:.5}),f=Math.min(Math.max(p.x,0),1),g=Math.min(Math.max(p.y,0),1);return{x:s+d*f,y:l+u*g}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,i=()=>{let n=window.innerWidth,r=window.innerHeight;(n!==e||r!==t)&&(e=n,t=r,Ms(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Ms(window.innerWidth,window.innerHeight),window.updateDebugConfig=Am,window.getDebugConfig=Cm,window.copyConfig=Nm,window.applyConfig=cn,window.applyConfigForRatio=Bm,window.positionAtBottom=gd,window.positionAtTop=Om,window.positionAtCenter=Im,window.positionAtLeft=Mm,window.positionAtRight=Pm,window.positionAtBottomLeft=Rm,window.positionAtBottomRight=jm,window.positionAtTopLeft=Dm,window.positionAtTopRight=zm,window.applyPositionContract=Lm,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 Er(e,t,i=0){return e*t+i}function Sr(e,t,i=0){return e*(1-t)+i}function Ar(e,t,i=0){return e*t+i}function Cr(e,t,i=0){return e*(1-t)+i}function ve(e,t=0){return e/2+t}function km(e,t){return e*t}function Lm(e,t,i,n){var s,o,l,c,d,u,p,f,g,h,m,b,y,v,x,w,E,A,_,T;let r=0,a=0;switch(n.type){case"top":r=ve(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=Er(i,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":r=ve(t,(u=(d=n.offset)==null?void 0:d.x)!=null?u:0),a=Sr(i,n.percent,(f=(p=n.offset)==null?void 0:p.y)!=null?f:0);break;case"left":r=Ar(t,n.percent,(h=(g=n.offset)==null?void 0:g.x)!=null?h:0),a=ve(i,(b=(m=n.offset)==null?void 0:m.y)!=null?b:0);break;case"right":r=Cr(t,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),a=ve(i,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":r=ve(t,(A=(E=n.offset)==null?void 0:E.x)!=null?A:0),a=ve(i,(T=(_=n.offset)==null?void 0:_.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function gd(e,t,i,n=.2,r=1,a=!0,s=!1){let o=km(i,n),l=Sr(i,n/2);Je(e,ve(t),l);let c=a?r*Ze.scaleFactor:r;Qe(e,c),s&&!Ps.find(d=>d.element===e)&&Em(e,gd,t,i,n,r,a)}function Om(e,t,i,n=.1,r=1){Je(e,ve(t),Er(i,n)),Qe(e,r)}function Im(e,t,i,n=0,r=0,a=1){Je(e,ve(t,n),ve(i,r)),Qe(e,a)}function Mm(e,t,i,n=.1,r=1){Je(e,Ar(t,n),ve(i)),Qe(e,r)}function Pm(e,t,i,n=.1,r=1){Je(e,Cr(t,n),ve(i)),Qe(e,r)}function Rm(e,t,i,n=.05,r=.05,a=1){Je(e,Ar(t,r),Sr(i,n)),Qe(e,a)}function jm(e,t,i,n=.05,r=.05,a=1){Je(e,Cr(t,r),Sr(i,n)),Qe(e,a)}function Dm(e,t,i,n=.05,r=.05,a=1){Je(e,Ar(t,r),Er(i,n)),Qe(e,a)}function zm(e,t,i,n=.05,r=.05,a=1){Je(e,Cr(t,r),Er(i,n)),Qe(e,a)}function Je(e,t,i){e&&e.position?typeof e.position.set=="function"?e.position.set(t,i):(e.position.x=t,e.position.y=i):e&&(e.x=t,e.y=i)}function Qe(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Ft={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 Nm(e){return e&&Ft[e]?JSON.parse(JSON.stringify(Ft[e])):JSON.parse(JSON.stringify(dn))}function cn(e){Object.keys(e).forEach(t=>{let i=t;dn[i]&&e[i]&&Object.assign(dn[i],e[i])}),console.log("Config applied:",e)}function Bm(e,t){let i=e/t;i>1.6?(cn(Ft.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(cn(Ft.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(cn(Ft.square),console.log("Applied SQUARE config for ratio:",i)):(cn(Ft.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Ft,e.resolveAnchorVec2=e.resolveAnchorVec2||_r,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||fd,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||hd}zr();function te(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var D_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:te(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:te(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:te(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:te(360,780)}],z_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:te(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:te(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:te(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:te(412,915)}],N_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:te(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:te(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:te(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:te(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:te(800,1280)}],Gs=[{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:te(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:te(768,1024),mraidScale:.7}];var Ws=[...Gs],Vs=[{category:"playable",label:"Playable Ad",devices:Gs}],Nr=Gs[0];function Ut(e){return Ws.find(t=>t.id===e)||Nr}function Xm(e){return Ws.filter(t=>t.category===e)}var Br=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
|
|
47
|
+
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 l0={};an(l0,{COLORS:()=>We,ConfigWatcher:()=>Ht,DebugPanel:()=>rr,DefaultReloadStrategy:()=>bn,Handler:()=>Pe,PlayableLoadingScreen:()=>ss,PreviewShell:()=>ns,STROKE_WIDTH:()=>jg,THEME:()=>Dg,applyConfigOverride:()=>bt,applyConfigOverrides:()=>yt,applyConfigsToDisk:()=>hn,applyDefaults:()=>$t,baseLottie:()=>ws,bootstrap:()=>Zw,clearConfigOverrides:()=>vt,clearConfigOverridesForObject:()=>Ed,configOverrideManager:()=>Sd,createPreviewShell:()=>hc,deepClone:()=>ne,default:()=>zt,defaultPreset:()=>Nr,deviceGroups:()=>Vs,devicePresets:()=>Ws,diffConfigs:()=>Fs,exportConfigsAsJSON:()=>fn,getConfigOverrides:()=>de,getConfigStateSummary:()=>Or,getOverrideMode:()=>pn,getPresetById:()=>Ut,getPresetsByCategory:()=>Xm,loadAllObjectConfigs:()=>Rr,loadComponentSchemas:()=>Pr,loadEngineConfig:()=>jr,loadGamePromptConfig:()=>zs,loadObjectCentricConfig:()=>et,loadObjectConfig:()=>xt,loadSceneConfig:()=>Dr,rehydrateObject:()=>$s,removeConfigOverride:()=>Lr,resetToApplied:()=>gn,resetToOriginal:()=>Ir,setBootstrapDependencies:()=>Kw,setOverrideMode:()=>Rs,setupHotReload:()=>qs,setupLiveEditBridge:()=>rs,toLegacyFormat:()=>Ns,validateObjectConfig:()=>gi});module.exports=nm(l0);var ht={};function gr(e,t,i=!1){ht[e]||(ht[e]=[]),ht[e].push({fn:t,once:i})}function bs(e,t){if(ht[e]){if(!t){delete ht[e];return}ht[e]=ht[e].filter(i=>i.fn!==t)}}function mr(e,...t){let i=ht[e];if(i)for(let n of[...i])n.fn(...t),n.once&&bs(e,n.fn)}function be(e,t){gr(e,t,!0)}var ee=null,Ce=[],ui=null;function Pc(e){ee=e,Ce=[],ui!==null&&(clearTimeout(ui),ui=null)}function Rc(){var e,t,i;return{endpoint:(ee==null?void 0:ee.endpoint)||"",transport:(ee==null?void 0:ee.transport)||"beacon",batchSize:(e=ee==null?void 0:ee.batchSize)!=null?e:10,flushIntervalMs:(t=ee==null?void 0:ee.flushIntervalMs)!=null?t:300,maxQueue:(i=ee==null?void 0:ee.maxQueue)!=null?i:200,debug:!!(ee!=null&&ee.debug)}}async function Ic(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function ys(e,t){let i=Rc();if(t&&i.endpoint){if(Ce.push(e),Ce.length>i.maxQueue&&(Ce=Ce.slice(Ce.length-i.maxQueue)),Ce.length>=i.batchSize){Mc();return}ui===null&&(ui=window.setTimeout(()=>{ui=null,Mc()},i.flushIntervalMs))}}async function Mc(){let e=Rc();if(!e.endpoint||Ce.length===0)return;let t=Ce.splice(0,e.batchSize);await Ic(e.endpoint,{events:t},e.transport,e.debug),Ce.length>0&&await Ic(e.endpoint,{events:Ce.splice(0,e.batchSize)},e.transport,e.debug)}function jc(e){return Math.max(0,Math.min(1,e))}function rm(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function sn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function am(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function Dc(e,t,i){try{e[t]=i}catch{}}function sm(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function zc(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function Nc(e,t){let i=sm(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function Bc(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=d=>{var p;e.add(d);let u=(p=t.get(d.target))!=null?p:new Set;u.add(d),t.set(d.target,u),n()},a=d=>{e.delete(d);let u=t.get(d.target);u&&(u.delete(d),u.size===0&&t.delete(d.target))},s=d=>{d.killed||(d.killed=!0,a(d))},o=()=>{var u,p;let d=sn();for(let f of Array.from(e)){if(f.killed||f.paused)continue;let g=d-f.startMs-f.delayMs;if(g<0)continue;let h=f.durationMs>0?g/f.durationMs:1,m=jc(h),b=f.repeat>=0?f.repeat+1:1,y=f.repeat>0?Math.min(Math.floor(h),b-1):0;if(f.repeat>0&&h>=1){let w=h-y;m=jc(w)}let v=f.ease(m);f.yoyo&&y%2===1&&(v=1-v);for(let w of f.props)Dc(f.target,w.key,w.from+(w.to-w.from)*v);f.scaleFrom&&f.scaleTo&&zc(f.target,{x:f.scaleFrom.x+(f.scaleTo.x-f.scaleFrom.x)*v,y:f.scaleFrom.y+(f.scaleTo.y-f.scaleFrom.y)*v});try{(u=f.onUpdate)==null||u.call(f)}catch{}if(h>=b){s(f);try{(p=f.onComplete)==null||p.call(f)}catch{}}}},l=(d,u,p)=>{var w;let f=Math.max(0,(typeof u.duration=="number"?u.duration:.5)*1e3),g=Math.max(0,(typeof u.delay=="number"?u.delay:0)*1e3+((w=p==null?void 0:p.delayMsOverride)!=null?w:0)),h=rm(u.ease),m=typeof u.repeat=="number"?Math.max(0,u.repeat|0):0,b=u.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(u)){if(y.has(E))continue;let A=u[E];typeof A=="number"&&v.push({key:E,from:am(d,E),to:A})}let x=Nc(d,u);return{target:d,startMs:sn(),delayMs:g,durationMs:f,ease:h,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:m,yoyo:b,onUpdate:typeof u.onUpdate=="function"?u.onUpdate:void 0,onComplete:typeof u.onComplete=="function"?u.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,u){let p=l(d,u);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=sn())},resume:()=>{var h;if(!p.paused)return;let f=(h=p.pauseAtMs)!=null?h:sn(),g=sn()-f;p.startMs+=g,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(d,u,p){return c.set(d,u),c.to(d,p)},set(d,u){if(!d||!u)return;for(let f of Object.keys(u)){let g=u[f];f==="scale"||f==="scaleX"||f==="scaleY"||typeof g=="number"&&Dc(d,f,g)}let p=Nc(d,u);p.to&&zc(d,p.to)},killTweensOf(d){let u=t.get(d);if(u)for(let p of Array.from(u))s(p)},timeline(d={}){let u=[],p=0,f=!1,g=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?p+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):p},m=y=>{u.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);p=Math.max(p,y.atMs+v)},b={to(y,v,x){return m({kind:"to",target:y,vars:v,atMs:h(x)}),b},fromTo(y,v,x,w){return m({kind:"fromTo",target:y,vars:x,from:v,atMs:h(w)}),b},play(){var y,v;if(f)return b;f=!0,g=[];for(let x of u)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),g.push(c.to(x.target,{...x.vars,delay:x.atMs/1e3+((v=x.vars.delay)!=null?v:0)}));return b},pause(){for(let y of g)y.pause();return b},kill(){for(let y of g)y.kill();g=[],f=!1}};return d.paused||b.play(),b}};return c}function Fc(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=Bc()}catch{}}var $c={name:"handler-playable-sdk",version:"0.3.33",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 && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",sharp:"^0.34.5"}};var ye=0,lm=ye++,Hc=ye++,Uc=ye++,qc=ye++,Gc=ye++,Wc=ye++,Vc=ye++,Yc=ye++,Kc=ye++,Xc=ye++,Zc=ye++,Jc=ye++,K=lm;function Qc(){return K===Hc}function ed(){return K===Uc}function td(){return K===qc}function id(){return K===Gc}function pi(){return K===Wc}function fi(){return K===Vc}function nd(){return K===Yc}function rd(){return K===Kc}function ad(){return K===Xc}function vs(){return K===Zc}function xs(){return K===Jc}function sd(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),K=Hc;return}catch{}else if(e==="dapi")try{dapi.isReady(),K=Uc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(K=qc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(K=Gc)}catch{}else if(t==="mintegral")window.gameReady&&(K=Wc);else if(t==="tapjoy")window.TJ_API&&(K=Vc);else if(t==="tiktok")window.openAppStore&&(K=Yc);else if(t==="smadex")try{window.smxTracking&&(K=Kc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(K=Xc)}catch{}else t==="vungle"?K=Zc:(e==="nucleo"||t==="nucleo")&&(K=Jc)}var br=di(require("lottie-web"),1),ws=br.default;typeof window!="undefined"&&(window.lottie=br.default,window.__baseLottie=br.default);var cm=require("pixi.js");var _s=require("pixi.js");var dm=null;function Es(e){dm=e}yr();Ss();var on=require("pixi.js");yr();var mm=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",ks=mm;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(ks=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${ks}`))}}catch{}var mt=class{static async create(t,i,n){var l,c,d,u,p,f,g;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${ks}`);let r=(l=i==null?void 0:i.render)==null?void 0:l.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new on.Container;return this.applyTransform(h,i==null?void 0:i.transform),h}let a=(c=i==null?void 0:i.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await Bt.load(t,r,n,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(d=s==null?void 0:s.constructor)==null?void 0:d.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new on.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name),this.applyTransform(o,i==null?void 0:i.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((f=s.constructor)==null?void 0:f.name)==="Container"||s instanceof on.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],m=!1;for(let b of h)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(g=o==null?void 0:o.constructor)==null?void 0:g.name),m=!0;break}}catch{continue}m||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=s)}else o=s;else o=s,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,i==null?void 0:i.transform);return o}static applyTransform(t,i){var n,r,a,s;!i||!t||(i.position&&("x"in t&&"y"in t?(t.x=(n=i.position.x)!=null?n:0,t.y=(r=i.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=i.position.x)!=null?a:0,(s=i.position.y)!=null?s:0)),i.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(i.scale):t.scale=i.scale),i.rotation!==void 0&&"rotation"in t&&(t.rotation=i.rotation),i.anchor&&"anchor"in t&&t.anchor&&Array.isArray(i.anchor)&&("set"in t.anchor?t.anchor.set(i.anchor[0],i.anchor[1]):(t.anchor.x=i.anchor[0],t.anchor.y=i.anchor[1])))}};var ln=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var vm=di(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=vm);hi();var vr=require("pixi.js");hi();var Is=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new ln}init(t,i){this.registry.init(t),this.app=i}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let i=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(i.length===0)return;let n=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let l=await mt.create(a,s,this.app);this.instanceCache.set(a,l),console.log("[Assets] Loaded object:",a,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",a,l)}})))};return this.readyPromise=(async()=>{await n(i);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await n(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let i=this.registry.get(t);if(i){let n=await mt.create(t,i,this.app);this.instanceCache.set(t,n)}}get(t){return this.instanceCache.get(t)}},xm=new Is,wm=new Proxy(xm,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});hi();var pd=require("pixi.js"),Ze={width:400,height:600,designWidth:400,scaleFactor:1},wr={scale:1,position:1},Ps=[];function Em(e,t,i,n,r,a,s){Ps.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,i,n,r,a,s,!1)}function Sm(){Ps.forEach(({element:e,originalScale:t,positionHelper:i,heightPercent:n})=>{let r=t*Ze.scaleFactor;i(e,Ze.width,Ze.height,n,r,!0,!1)})}function Ms(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Ze.width=e,Ze.height=t,Ze.scaleFactor=Math.min(e/Ze.designWidth,1.15),wr.scale=Ze.scaleFactor,wr.position=1,console.log(`[SCREEN] Global multipliers - scale: ${wr.scale.toFixed(3)}`),Sm()}var dn={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 Am(e,t,i){let n=dn[e];n&&n[t]!==void 0&&(n[t]=i,console.log(`Updated ${e}.${t} = ${i}`))}function Cm(){return dn}var Tm={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 xr(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function _r(e,t={x:.5,y:.5}){var i;if(Array.isArray(e))return{x:xr(e[0],t.x),y:xr(e[1],t.y)};if(e&&typeof e=="object"){let n=e;return{x:xr(n.x,t.x),y:xr(n.y,t.y)}}if(typeof e=="string"){let n=e.trim().toLowerCase();return(i=Tm[n])!=null?i:t}return t}function fd(e,t,i,n={}){var f,g,h,m,b,y;let r=_r(i),a=(f=n.inset)!=null?f:{},s=(g=n.padding)!=null?g:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,l=((m=a.right)!=null?m:0)+s.x,c=((b=a.top)!=null?b:0)+s.y,d=((y=a.bottom)!=null?y:0)+s.y,u=Math.max(0,e-o-l),p=Math.max(0,t-c-d);return{x:o+u*r.x,y:c+p*r.y}}function hd(e,t,i,n={}){var h,m,b,y,v,x;let r=(h=n.inset)!=null?h:{},a=(m=n.padding)!=null?m:{x:0,y:0},s=((b=r.left)!=null?b:0)+a.x,o=((y=r.right)!=null?y:0)+a.x,l=((v=r.top)!=null?v:0)+a.y,c=((x=r.bottom)!=null?x:0)+a.y,d=Math.max(0,e-s-o),u=Math.max(0,t-l-c),p=_r(i,{x:.5,y:.5}),f=Math.min(Math.max(p.x,0),1),g=Math.min(Math.max(p.y,0),1);return{x:s+d*f,y:l+u*g}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,i=()=>{let n=window.innerWidth,r=window.innerHeight;(n!==e||r!==t)&&(e=n,t=r,Ms(n,r))};window.addEventListener("resize",i),window.addEventListener("orientationchange",()=>{setTimeout(i,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",i),window.mraid.addEventListener("sizeChange",i)),Ms(window.innerWidth,window.innerHeight),window.updateDebugConfig=Am,window.getDebugConfig=Cm,window.copyConfig=Nm,window.applyConfig=cn,window.applyConfigForRatio=Bm,window.positionAtBottom=gd,window.positionAtTop=Om,window.positionAtCenter=Im,window.positionAtLeft=Mm,window.positionAtRight=Pm,window.positionAtBottomLeft=Rm,window.positionAtBottomRight=jm,window.positionAtTopLeft=Dm,window.positionAtTopRight=zm,window.applyPositionContract=Lm,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 Er(e,t,i=0){return e*t+i}function Sr(e,t,i=0){return e*(1-t)+i}function Ar(e,t,i=0){return e*t+i}function Cr(e,t,i=0){return e*(1-t)+i}function ve(e,t=0){return e/2+t}function km(e,t){return e*t}function Lm(e,t,i,n){var s,o,l,c,d,u,p,f,g,h,m,b,y,v,x,w,E,A,_,T;let r=0,a=0;switch(n.type){case"top":r=ve(t,(o=(s=n.offset)==null?void 0:s.x)!=null?o:0),a=Er(i,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":r=ve(t,(u=(d=n.offset)==null?void 0:d.x)!=null?u:0),a=Sr(i,n.percent,(f=(p=n.offset)==null?void 0:p.y)!=null?f:0);break;case"left":r=Ar(t,n.percent,(h=(g=n.offset)==null?void 0:g.x)!=null?h:0),a=ve(i,(b=(m=n.offset)==null?void 0:m.y)!=null?b:0);break;case"right":r=Cr(t,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),a=ve(i,(w=(x=n.offset)==null?void 0:x.y)!=null?w:0);break;case"center":r=ve(t,(A=(E=n.offset)==null?void 0:E.x)!=null?A:0),a=ve(i,(T=(_=n.offset)==null?void 0:_.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),n.scale!==void 0&&n.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(n.scale,n.scale):(e.scale.x=n.scale,e.scale.y=n.scale))}function gd(e,t,i,n=.2,r=1,a=!0,s=!1){let o=km(i,n),l=Sr(i,n/2);Je(e,ve(t),l);let c=a?r*Ze.scaleFactor:r;Qe(e,c),s&&!Ps.find(d=>d.element===e)&&Em(e,gd,t,i,n,r,a)}function Om(e,t,i,n=.1,r=1){Je(e,ve(t),Er(i,n)),Qe(e,r)}function Im(e,t,i,n=0,r=0,a=1){Je(e,ve(t,n),ve(i,r)),Qe(e,a)}function Mm(e,t,i,n=.1,r=1){Je(e,Ar(t,n),ve(i)),Qe(e,r)}function Pm(e,t,i,n=.1,r=1){Je(e,Cr(t,n),ve(i)),Qe(e,r)}function Rm(e,t,i,n=.05,r=.05,a=1){Je(e,Ar(t,r),Sr(i,n)),Qe(e,a)}function jm(e,t,i,n=.05,r=.05,a=1){Je(e,Cr(t,r),Sr(i,n)),Qe(e,a)}function Dm(e,t,i,n=.05,r=.05,a=1){Je(e,Ar(t,r),Er(i,n)),Qe(e,a)}function zm(e,t,i,n=.05,r=.05,a=1){Je(e,Cr(t,r),Er(i,n)),Qe(e,a)}function Je(e,t,i){e&&e.position?typeof e.position.set=="function"?e.position.set(t,i):(e.position.x=t,e.position.y=i):e&&(e.x=t,e.y=i)}function Qe(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Ft={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 Nm(e){return e&&Ft[e]?JSON.parse(JSON.stringify(Ft[e])):JSON.parse(JSON.stringify(dn))}function cn(e){Object.keys(e).forEach(t=>{let i=t;dn[i]&&e[i]&&Object.assign(dn[i],e[i])}),console.log("Config applied:",e)}function Bm(e,t){let i=e/t;i>1.6?(cn(Ft.wide),console.log("Applied WIDE config for ratio:",i)):i<.7?(cn(Ft.tall),console.log("Applied TALL config for ratio:",i)):i>.8&&i<1.2?(cn(Ft.square),console.log("Applied SQUARE config for ratio:",i)):(cn(Ft.default),console.log("Applied DEFAULT config for ratio:",i))}if(typeof window!="undefined"){let e=window;e.configPresets=Ft,e.resolveAnchorVec2=e.resolveAnchorVec2||_r,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||fd,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||hd}zr();function te(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var D_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:te(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:te(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:te(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:te(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:te(360,780)}],z_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:te(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:te(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:te(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:te(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:te(412,915)}],N_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:te(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:te(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:te(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:te(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:te(800,1280)}],Gs=[{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:te(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:te(768,1024),mraidScale:.7}];var Ws=[...Gs],Vs=[{category:"playable",label:"Playable Ad",devices:Gs}],Nr=Gs[0];function Ut(e){return Ws.find(t=>t.id===e)||Nr}function Xm(e){return Ws.filter(t=>t.category===e)}var Br=class{constructor(){this.root=null;this.listContainer=null;this.searchInput=null;this.selectedId=null;this.options=null;this.retryTimer=null;this.screenFilter="all"}getScreenFilterStorageKey(){return`handler_preview_screen_filter::${typeof window!="undefined"&&window.__HANDLER_PROJECT_ID||"default"}`}render(){return`
|
|
48
48
|
<div class="scene-panel scene-objects panel-accent-teal" data-panel="scene-objects" style="left:16px; top:72px;">
|
|
49
49
|
<div class="scene-panel-header" data-panel-handle>
|
|
50
50
|
<div class="panel-title">
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-
|
|
1
|
+
import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-JCCU6XJF.js";import"./chunk-I5OOVR5U.js";import{a as q,b as r,c as s,d as t,e as u,f as v,g as w,h as x,i as y,j as z,k as A,l as B,m as C,n as D,o as E}from"./chunk-LV4HGC5G.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p}from"./chunk-ZLL42OOV.js";import"./chunk-E6WJCS24.js";import"./chunk-Q7FPWOA3.js";export{Q as COLORS,B as ConfigWatcher,K as DebugPanel,A as DefaultReloadStrategy,U as Handler,T as PlayableLoadingScreen,L as PreviewShell,R as STROKE_WIDTH,S as THEME,d as applyConfigOverride,e as applyConfigOverrides,n as applyConfigsToDisk,x as applyDefaults,a as baseLottie,P as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,M as createPreviewShell,k as deepClone,V as default,H as defaultPreset,G as deviceGroups,F as devicePresets,C as diffConfigs,l as exportConfigsAsJSON,i as getConfigOverrides,m as getConfigStateSummary,b as getOverrideMode,I as getPresetById,J as getPresetsByCategory,s as loadAllObjectConfigs,q as loadComponentSchemas,t as loadEngineConfig,u as loadGamePromptConfig,y as loadObjectCentricConfig,r as loadObjectConfig,v as loadSceneConfig,D as rehydrateObject,h as removeConfigOverride,o as resetToApplied,p as resetToOriginal,O as setBootstrapDependencies,c as setOverrideMode,E as setupHotReload,N as setupLiveEditBridge,z as toLegacyFormat,w as validateObjectConfig};
|
package/dist/pixi/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
|
-
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.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 r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 $v={};rl($v,{AssetCache:()=>Be,AssetLoader:()=>xt,AssetSystem:()=>Qr,AssetTextures:()=>wt,Assets:()=>jf,BaseSystem:()=>Oi,GameEngine:()=>Jr,GameObject:()=>Dn,GameObjectManager:()=>ki,ObjectFactory:()=>_t,Renderer:()=>jn,RuntimeObjectRegistry:()=>Ii,Transform:()=>Rn,applyScreenAnchor:()=>ia,basePixi:()=>If,clearResponsiveElements:()=>zf,createPixiBase:()=>Xr,getRegisteredFontIds:()=>Tf,globalResponsiveMultipliers:()=>Nn,initAssetTextures:()=>Ur,initAssets:()=>Df,layout:()=>Bf,playLottieOverlay:()=>Lf,registerFont:()=>Cf,registerType:()=>$r,resolveAnchorVec2:()=>Bn,resolveFont:()=>Sf,resolveFontWeight:()=>Af,resolveScreenAnchorPoint:()=>Mi,resolveScreenRatioPoint:()=>Pi,runInitSequence:()=>Ff,setLottieInstance:()=>qr,spawnSceneFromConfig:()=>Pf,updateScreenState:()=>ta});module.exports=Wf($v);var Ef=require("pixi.js");var st={};function Gn(e,t,i=!1){st[e]||(st[e]=[]),st[e].push({fn:t,once:i})}function ca(e,t){if(st[e]){if(!t){delete st[e];return}st[e]=st[e].filter(i=>i.fn!==t)}}function Wn(e,...t){let i=st[e];if(i)for(let n of[...i])n.fn(...t),n.once&&ca(e,n.fn)}function ge(e,t){Gn(e,t,!0)}var X=null,Ee=[],qt=null;function ll(e){X=e,Ee=[],qt!==null&&(clearTimeout(qt),qt=null)}function cl(){var e,t,i;return{endpoint:(X==null?void 0:X.endpoint)||"",transport:(X==null?void 0:X.transport)||"beacon",batchSize:(e=X==null?void 0:X.batchSize)!=null?e:10,flushIntervalMs:(t=X==null?void 0:X.flushIntervalMs)!=null?t:300,maxQueue:(i=X==null?void 0:X.maxQueue)!=null?i:200,debug:!!(X!=null&&X.debug)}}async function sl(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function da(e,t){let i=cl();if(t&&i.endpoint){if(Ee.push(e),Ee.length>i.maxQueue&&(Ee=Ee.slice(Ee.length-i.maxQueue)),Ee.length>=i.batchSize){ol();return}qt===null&&(qt=window.setTimeout(()=>{qt=null,ol()},i.flushIntervalMs))}}async function ol(){let e=cl();if(!e.endpoint||Ee.length===0)return;let t=Ee.splice(0,e.batchSize);await sl(e.endpoint,{events:t},e.transport,e.debug),Ee.length>0&&await sl(e.endpoint,{events:Ee.splice(0,e.batchSize)},e.transport,e.debug)}function dl(e){return Math.max(0,Math.min(1,e))}function Vf(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function Hi(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Yf(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function ul(e,t,i){try{e[t]=i}catch{}}function Kf(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function pl(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function fl(e,t){let i=Kf(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function hl(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=c=>{var u;e.add(c);let f=(u=t.get(c.target))!=null?u:new Set;f.add(c),t.set(c.target,f),n()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,u;let c=Hi();for(let p of Array.from(e)){if(p.killed||p.paused)continue;let v=c-p.startMs-p.delayMs;if(v<0)continue;let m=p.durationMs>0?v/p.durationMs:1,w=dl(m),g=p.repeat>=0?p.repeat+1:1,h=p.repeat>0?Math.min(Math.floor(m),g-1):0;if(p.repeat>0&&m>=1){let b=m-h;w=dl(b)}let x=p.ease(w);p.yoyo&&h%2===1&&(x=1-x);for(let b of p.props)ul(p.target,b.key,b.from+(b.to-b.from)*x);p.scaleFrom&&p.scaleTo&&pl(p.target,{x:p.scaleFrom.x+(p.scaleTo.x-p.scaleFrom.x)*x,y:p.scaleFrom.y+(p.scaleTo.y-p.scaleFrom.y)*x});try{(f=p.onUpdate)==null||f.call(p)}catch{}if(m>=g){s(p);try{(u=p.onComplete)==null||u.call(p)}catch{}}}},d=(c,f,u)=>{var b;let p=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((b=u==null?void 0:u.delayMsOverride)!=null?b:0)),m=Vf(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,g=f.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let C of Object.keys(f)){if(h.has(C))continue;let S=f[C];typeof S=="number"&&x.push({key:C,from:Yf(c,C),to:S})}let y=fl(c,f);return{target:c,startMs:Hi(),delayMs:v,durationMs:p,ease:m,props:x,scaleFrom:y.from,scaleTo:y.to,repeat:w,yoyo:g,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let u=d(c,f);return r(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=Hi())},resume:()=>{var m;if(!u.paused)return;let p=(m=u.pauseAtMs)!=null?m:Hi(),v=Hi()-p;u.startMs+=v,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(c,f,u){return l.set(c,f),l.to(c,u)},set(c,f){if(!c||!f)return;for(let p of Object.keys(f)){let v=f[p];p==="scale"||p==="scaleX"||p==="scaleY"||typeof v=="number"&&ul(c,p,v)}let u=fl(c,f);u.to&&pl(c,u.to)},killTweensOf(c){let f=t.get(c);if(f)for(let u of Array.from(f))s(u)},timeline(c={}){let f=[],u=0,p=!1,v=[],m=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let x=typeof h=="string"?h.trim():"";return x.startsWith("+=")?u+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):u},w=h=>{f.push(h);let x=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);u=Math.max(u,h.atMs+x)},g={to(h,x,y){return w({kind:"to",target:h,vars:x,atMs:m(y)}),g},fromTo(h,x,y,b){return w({kind:"fromTo",target:h,vars:y,from:x,atMs:m(b)}),g},play(){var h,x;if(p)return g;p=!0,v=[];for(let y of f)y.kind==="fromTo"&&l.set(y.target,(h=y.from)!=null?h:{}),v.push(l.to(y.target,{...y.vars,delay:y.atMs/1e3+((x=y.vars.delay)!=null?x:0)}));return g},pause(){for(let h of v)h.pause();return g},kill(){for(let h of v)h.kill();v=[],p=!1}};return c.paused||g.play(),g}};return l}function gl(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=hl()}catch{}}var ml={name:"handler-playable-sdk",version:"0.3.32",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 && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",sharp:"^0.34.5"}};var me=0,Zf=me++,bl=me++,yl=me++,vl=me++,xl=me++,wl=me++,_l=me++,El=me++,Sl=me++,Al=me++,Cl=me++,Tl=me++,q=Zf;function kl(){return q===bl}function Ll(){return q===yl}function Ol(){return q===vl}function Il(){return q===xl}function Gt(){return q===wl}function Wt(){return q===_l}function Ml(){return q===El}function Pl(){return q===Sl}function Rl(){return q===Al}function ua(){return q===Cl}function pa(){return q===Tl}function jl(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),q=bl;return}catch{}else if(e==="dapi")try{dapi.isReady(),q=yl;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(q=vl)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(q=xl)}catch{}else if(t==="mintegral")window.gameReady&&(q=wl);else if(t==="tapjoy")window.TJ_API&&(q=_l);else if(t==="tiktok")window.openAppStore&&(q=El);else if(t==="smadex")try{window.smxTracking&&(q=Sl)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(q=Al)}catch{}else t==="vungle"?q=Cl:(e==="nucleo"||t==="nucleo")&&(q=Tl)}var Vn=qn(require("lottie-web"),1),Dl=Vn.default;typeof window!="undefined"&&(window.lottie=Vn.default,window.__baseLottie=Vn.default);ga();function Z(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var xx=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:Z(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:Z(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:Z(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:Z(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:Z(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:Z(360,780)}],wx=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:Z(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:Z(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:Z(412,915)}],_x=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:Z(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:Z(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:Z(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:Z(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:Z(800,1280)}],Fl=[{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:Z(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:Z(768,1024),mraidScale:.7}];var Ex=[...Fl];var ah=Fl[0];ot();var qy=qn(Jp(),1);function $y(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function Hy(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}async function Uy(e){return await new Promise(t=>{let i=new Image;i.onload=()=>t({width:i.naturalWidth||i.width,height:i.naturalHeight||i.height}),i.onerror=()=>t(null),i.src=e})}async function ao(e){var t,i;try{console.log("[ImageUtils] Fetching image data from URL:",e);let n=await fetch(e);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,e),null;let r=await n.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await $y(r),s=await Uy(a),o=Hy(a);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(i=s==null?void 0:s.height)!=null?i:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Br(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((f,u)=>{let p=new Image;p.onload=()=>f(p),p.onerror=()=>u(new Error("Failed to load image")),p.src=e}),n=document.createElement("canvas");n.width=i.width,n.height=i.height;let r=n.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(i,0,0);let a=r.getImageData(0,0,n.width,n.height),s=a.data,d=[{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(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let u=s[f],p=s[f+1],v=s[f+2],m=!1;for(let w of d)if(Math.sqrt(Math.pow(u-w.r,2)+Math.pow(p-w.g,2)+Math.pow(v-w.b,2))<t){m=!0;break}m&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),n.toDataURL("image/png")}catch(i){return console.error("[ImageUtils] Error removing background:",i),e}}var Qp=require("@google/genai");async function so(e,t,i=[],n={}){var r,a,s,o,d,l,c;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let g=0;g<i.length;g++){let h=i[g];if(!h.base64||!h.mimeType)throw new Error(`Image ${g+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${g+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${g+1} has invalid MIME type: ${h.mimeType}`)}let f=new Qp.GoogleGenAI({apiKey:e}),u="gemini-2.5-flash",p=[t];i.length>0&&i.forEach((g,h)=>{p.push({inlineData:{data:g.base64,mimeType:g.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${g.mimeType}, size: ${Math.round(g.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:u,contents:p}),m="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let g of w)g.text&&(m+=g.text);if(!m.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${m.length}`),m}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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."):(d=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var ef=require("@google/genai");async function Fr(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new ef.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),a.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}var Xy=require("pixi.js");An();ot();var of=require("pixi.js");var Zy=require("pixi.js");ot();function rv(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function av(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}function sv(e){return`
|
|
47
|
+
`,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.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 r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let i=window.__openAiEditor;if(typeof i!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";t==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,i(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 $v={};rl($v,{AssetCache:()=>Be,AssetLoader:()=>xt,AssetSystem:()=>Qr,AssetTextures:()=>wt,Assets:()=>jf,BaseSystem:()=>Oi,GameEngine:()=>Jr,GameObject:()=>Dn,GameObjectManager:()=>ki,ObjectFactory:()=>_t,Renderer:()=>jn,RuntimeObjectRegistry:()=>Ii,Transform:()=>Rn,applyScreenAnchor:()=>ia,basePixi:()=>If,clearResponsiveElements:()=>zf,createPixiBase:()=>Xr,getRegisteredFontIds:()=>Tf,globalResponsiveMultipliers:()=>Nn,initAssetTextures:()=>Ur,initAssets:()=>Df,layout:()=>Bf,playLottieOverlay:()=>Lf,registerFont:()=>Cf,registerType:()=>$r,resolveAnchorVec2:()=>Bn,resolveFont:()=>Sf,resolveFontWeight:()=>Af,resolveScreenAnchorPoint:()=>Mi,resolveScreenRatioPoint:()=>Pi,runInitSequence:()=>Ff,setLottieInstance:()=>qr,spawnSceneFromConfig:()=>Pf,updateScreenState:()=>ta});module.exports=Wf($v);var Ef=require("pixi.js");var st={};function Gn(e,t,i=!1){st[e]||(st[e]=[]),st[e].push({fn:t,once:i})}function ca(e,t){if(st[e]){if(!t){delete st[e];return}st[e]=st[e].filter(i=>i.fn!==t)}}function Wn(e,...t){let i=st[e];if(i)for(let n of[...i])n.fn(...t),n.once&&ca(e,n.fn)}function ge(e,t){Gn(e,t,!0)}var X=null,Ee=[],qt=null;function ll(e){X=e,Ee=[],qt!==null&&(clearTimeout(qt),qt=null)}function cl(){var e,t,i;return{endpoint:(X==null?void 0:X.endpoint)||"",transport:(X==null?void 0:X.transport)||"beacon",batchSize:(e=X==null?void 0:X.batchSize)!=null?e:10,flushIntervalMs:(t=X==null?void 0:X.flushIntervalMs)!=null?t:300,maxQueue:(i=X==null?void 0:X.maxQueue)!=null?i:200,debug:!!(X!=null&&X.debug)}}async function sl(e,t,i,n){let r=JSON.stringify(t);if(i==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",t)}catch(a){n&&console.warn("[handler.telemetry] fetch failed",a)}}function da(e,t){let i=cl();if(t&&i.endpoint){if(Ee.push(e),Ee.length>i.maxQueue&&(Ee=Ee.slice(Ee.length-i.maxQueue)),Ee.length>=i.batchSize){ol();return}qt===null&&(qt=window.setTimeout(()=>{qt=null,ol()},i.flushIntervalMs))}}async function ol(){let e=cl();if(!e.endpoint||Ee.length===0)return;let t=Ee.splice(0,e.batchSize);await sl(e.endpoint,{events:t},e.transport,e.debug),Ee.length>0&&await sl(e.endpoint,{events:Ee.splice(0,e.batchSize)},e.transport,e.debug)}function dl(e){return Math.max(0,Math.min(1,e))}function Vf(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return i=>i;if(t==="sine.inOut")return i=>.5-Math.cos(Math.PI*i)/2;if(t==="power2.out"||t==="easeOutQuad")return i=>1-(1-i)*(1-i);if(t.startsWith("back.out")){let i=t.match(/back\.out\(([\d.]+)\)/),n=i?Number(i[1]):1.8;return r=>1+(n+1)*Math.pow(r-1,3)+n*Math.pow(r-1,2)}return i=>1-(1-i)*(1-i)}function Hi(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Yf(e,t){let i=e==null?void 0:e[t];return typeof i=="number"?i:0}function ul(e,t,i){try{e[t]=i}catch{}}function Kf(e){let t=e==null?void 0:e.scale;if(!t)return null;let i=typeof t.x=="number"?t.x:1,n=typeof t.y=="number"?t.y:1;return{x:i,y:n}}function pl(e,t){let i=e==null?void 0:e.scale;if(i)try{typeof i.set=="function"?i.set(t.x,t.y):(typeof i.x=="number"&&(i.x=t.x),typeof i.y=="number"&&(i.y=t.y))}catch{}}function fl(e,t){let i=Kf(e);if(!i)return{from:null,to:null};let n=null,r=null;return typeof t.scale=="number"?(n=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(n=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(n=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),n===null&&r===null?{from:null,to:null}:{from:{x:i.x,y:i.y},to:{x:n!=null?n:i.x,y:r!=null?r:i.y}}}function hl(){let e=new Set,t=new WeakMap,i=null,n=()=>{if(i!=null)return;i=requestAnimationFrame(()=>{i=null,o(),e.size>0&&n()})},r=c=>{var u;e.add(c);let f=(u=t.get(c.target))!=null?u:new Set;f.add(c),t.set(c.target,f),n()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,u;let c=Hi();for(let p of Array.from(e)){if(p.killed||p.paused)continue;let v=c-p.startMs-p.delayMs;if(v<0)continue;let m=p.durationMs>0?v/p.durationMs:1,w=dl(m),g=p.repeat>=0?p.repeat+1:1,h=p.repeat>0?Math.min(Math.floor(m),g-1):0;if(p.repeat>0&&m>=1){let b=m-h;w=dl(b)}let x=p.ease(w);p.yoyo&&h%2===1&&(x=1-x);for(let b of p.props)ul(p.target,b.key,b.from+(b.to-b.from)*x);p.scaleFrom&&p.scaleTo&&pl(p.target,{x:p.scaleFrom.x+(p.scaleTo.x-p.scaleFrom.x)*x,y:p.scaleFrom.y+(p.scaleTo.y-p.scaleFrom.y)*x});try{(f=p.onUpdate)==null||f.call(p)}catch{}if(m>=g){s(p);try{(u=p.onComplete)==null||u.call(p)}catch{}}}},d=(c,f,u)=>{var b;let p=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((b=u==null?void 0:u.delayMsOverride)!=null?b:0)),m=Vf(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,g=f.yoyo===!0,h=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let C of Object.keys(f)){if(h.has(C))continue;let S=f[C];typeof S=="number"&&x.push({key:C,from:Yf(c,C),to:S})}let y=fl(c,f);return{target:c,startMs:Hi(),delayMs:v,durationMs:p,ease:m,props:x,scaleFrom:y.from,scaleTo:y.to,repeat:w,yoyo:g,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let u=d(c,f);return r(u),{kill:()=>s(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=Hi())},resume:()=>{var m;if(!u.paused)return;let p=(m=u.pauseAtMs)!=null?m:Hi(),v=Hi()-p;u.startMs+=v,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(c,f,u){return l.set(c,f),l.to(c,u)},set(c,f){if(!c||!f)return;for(let p of Object.keys(f)){let v=f[p];p==="scale"||p==="scaleX"||p==="scaleY"||typeof v=="number"&&ul(c,p,v)}let u=fl(c,f);u.to&&pl(c,u.to)},killTweensOf(c){let f=t.get(c);if(f)for(let u of Array.from(f))s(u)},timeline(c={}){let f=[],u=0,p=!1,v=[],m=h=>{if(typeof h=="number")return Math.max(0,h*1e3);let x=typeof h=="string"?h.trim():"";return x.startsWith("+=")?u+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):u},w=h=>{f.push(h);let x=Math.max(0,(typeof h.vars.duration=="number"?h.vars.duration:.5)*1e3);u=Math.max(u,h.atMs+x)},g={to(h,x,y){return w({kind:"to",target:h,vars:x,atMs:m(y)}),g},fromTo(h,x,y,b){return w({kind:"fromTo",target:h,vars:y,from:x,atMs:m(b)}),g},play(){var h,x;if(p)return g;p=!0,v=[];for(let y of f)y.kind==="fromTo"&&l.set(y.target,(h=y.from)!=null?h:{}),v.push(l.to(y.target,{...y.vars,delay:y.atMs/1e3+((x=y.vars.delay)!=null?x:0)}));return g},pause(){for(let h of v)h.pause();return g},kill(){for(let h of v)h.kill();v=[],p=!1}};return c.paused||g.play(),g}};return l}function gl(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=hl()}catch{}}var ml={name:"handler-playable-sdk",version:"0.3.33",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 && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",sharp:"^0.34.5"}};var me=0,Zf=me++,bl=me++,yl=me++,vl=me++,xl=me++,wl=me++,_l=me++,El=me++,Sl=me++,Al=me++,Cl=me++,Tl=me++,q=Zf;function kl(){return q===bl}function Ll(){return q===yl}function Ol(){return q===vl}function Il(){return q===xl}function Gt(){return q===wl}function Wt(){return q===_l}function Ml(){return q===El}function Pl(){return q===Sl}function Rl(){return q===Al}function ua(){return q===Cl}function pa(){return q===Tl}function jl(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),q=bl;return}catch{}else if(e==="dapi")try{dapi.isReady(),q=yl;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(q=vl)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(q=xl)}catch{}else if(t==="mintegral")window.gameReady&&(q=wl);else if(t==="tapjoy")window.TJ_API&&(q=_l);else if(t==="tiktok")window.openAppStore&&(q=El);else if(t==="smadex")try{window.smxTracking&&(q=Sl)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(q=Al)}catch{}else t==="vungle"?q=Cl:(e==="nucleo"||t==="nucleo")&&(q=Tl)}var Vn=qn(require("lottie-web"),1),Dl=Vn.default;typeof window!="undefined"&&(window.lottie=Vn.default,window.__baseLottie=Vn.default);ga();function Z(e,t){let i=(r,a)=>a===0?r:i(a,r%a),n=i(e,t);return`${e/n}:${t/n}`}var xx=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:Z(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:Z(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:Z(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:Z(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:Z(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:Z(360,780)}],wx=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:Z(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:Z(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:Z(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:Z(412,915)}],_x=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:Z(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:Z(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:Z(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:Z(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:Z(800,1280)}],Fl=[{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:Z(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:Z(768,1024),mraidScale:.7}];var Ex=[...Fl];var ah=Fl[0];ot();var qy=qn(Jp(),1);function $y(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function Hy(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}async function Uy(e){return await new Promise(t=>{let i=new Image;i.onload=()=>t({width:i.naturalWidth||i.width,height:i.naturalHeight||i.height}),i.onerror=()=>t(null),i.src=e})}async function ao(e){var t,i;try{console.log("[ImageUtils] Fetching image data from URL:",e);let n=await fetch(e);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,e),null;let r=await n.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await $y(r),s=await Uy(a),o=Hy(a);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(i=s==null?void 0:s.height)!=null?i:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function Br(e,t=30){try{console.log("[ImageUtils] Removing background color...");let i=await new Promise((f,u)=>{let p=new Image;p.onload=()=>f(p),p.onerror=()=>u(new Error("Failed to load image")),p.src=e}),n=document.createElement("canvas");n.width=i.width,n.height=i.height;let r=n.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(i,0,0);let a=r.getImageData(0,0,n.width,n.height),s=a.data,d=[{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(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let u=s[f],p=s[f+1],v=s[f+2],m=!1;for(let w of d)if(Math.sqrt(Math.pow(u-w.r,2)+Math.pow(p-w.g,2)+Math.pow(v-w.b,2))<t){m=!0;break}m&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),n.toDataURL("image/png")}catch(i){return console.error("[ImageUtils] Error removing background:",i),e}}var Qp=require("@google/genai");async function so(e,t,i=[],n={}){var r,a,s,o,d,l,c;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let g=0;g<i.length;g++){let h=i[g];if(!h.base64||!h.mimeType)throw new Error(`Image ${g+1} is missing required data`);if(h.base64.length<1e3&&console.warn(`Image ${g+1} data appears very small, may be corrupted`),!h.mimeType.startsWith("image/"))throw new Error(`Image ${g+1} has invalid MIME type: ${h.mimeType}`)}let f=new Qp.GoogleGenAI({apiKey:e}),u="gemini-2.5-flash",p=[t];i.length>0&&i.forEach((g,h)=>{p.push({inlineData:{data:g.base64,mimeType:g.mimeType}}),console.log(`[Gemini] Added image ${h+1}: ${g.mimeType}, size: ${Math.round(g.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${i.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:u,contents:p}),m="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let g of w)g.text&&(m+=g.text);if(!m.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${m.length}`),m}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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."):(d=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var ef=require("@google/genai");async function Fr(e,t,i=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new ef.GoogleGenAI({apiKey:e}),a=[{text:t}];i.length>0&&i.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),a.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}var Xy=require("pixi.js");An();ot();var of=require("pixi.js");var Zy=require("pixi.js");ot();function rv(e){return new Promise((t,i)=>{let n=new FileReader;n.onerror=()=>i(new Error("FileReader failed")),n.onload=()=>t(String(n.result||"")),n.readAsDataURL(e)})}function av(e){var r;let[t,i]=e.split(","),n=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:i!=null?i:"",mimeType:(r=n==null?void 0:n[1])!=null?r:"image/png"}}function sv(e){return`
|
|
48
48
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
49
49
|
|
|
50
50
|
Provide a concise summary (2-3 sentences) covering:
|
package/dist/pixi/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a0_0x770f(_0x335d36,_0x4e8802){_0x335d36=_0x335d36-(0x1cf2+0x85e+-0x23a8);var _0x3e0d33=a0_0x2f8c();var _0x3905b0=_0x3e0d33[_0x335d36];if(a0_0x770f['gNTylH']===undefined){var _0x4c46fc=function(_0x449727){var _0x462cf3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x19860c='',_0x492a20='',_0x51fe07=_0x19860c+_0x4c46fc;for(var _0x3a2f71=-0x2*0xf+-0x20fa+0x2118,_0x3ccf4d,_0x2c0216,_0x23cfff=0x55*-0x26+-0x25*-0x55+0x1*0x55;_0x2c0216=_0x449727['charAt'](_0x23cfff++);~_0x2c0216&&(_0x3ccf4d=_0x3a2f71%(0x1b19+0xe4c+0x1*-0x2961)?_0x3ccf4d*(0x1f9a+-0x1*0x1c99+-0x2c1)+_0x2c0216:_0x2c0216,_0x3a2f71++%(-0x2503+-0x218a+0x4691))?_0x19860c+=_0x51fe07['charCodeAt'](_0x23cfff+(-0x242+-0x23f5+0x2641))-(0x1175+-0x1cc7+-0x2*-0x5ae)!==-0x30c+-0x1a20+-0x1*-0x1d2c?String['fromCharCode'](0x1fd*-0x10+-0x1*-0x1198+-0x30b*-0x5&_0x3ccf4d>>(-(-0x28*0x31+-0x178f+0x1*0x1f39)*_0x3a2f71&-0x655*-0x1+-0x2596+0x1f47)):_0x3a2f71:0x1911+0x91*-0x18+-0xb*0x10b){_0x2c0216=_0x462cf3['indexOf'](_0x2c0216);}for(var _0x54a4c0=-0x6a5+0x1*0xca+0x5db*0x1,_0x2e286f=_0x19860c['length'];_0x54a4c0<_0x2e286f;_0x54a4c0++){_0x492a20+='%'+('00'+_0x19860c['charCodeAt'](_0x54a4c0)['toString'](0x7c6+0xb*0x7a+-0xcf4))['slice'](-(0x117f+0x186b+-0x29e8));}return decodeURIComponent(_0x492a20);};var _0x29071a=function(_0x5ee3d7,_0xd8834f){var _0x1a3bba=[],_0x41e64a=0x198f+0x2*-0xb59+-0x2dd,_0x123851,_0x2a803e='';_0x5ee3d7=_0x4c46fc(_0x5ee3d7);var _0x9ccb08;for(_0x9ccb08=0x2176+0x17b5+-0x392b;_0x9ccb08<0x1*0x1cb7+0x40c+-0x1fc3;_0x9ccb08++){_0x1a3bba[_0x9ccb08]=_0x9ccb08;}for(_0x9ccb08=0x9*0x1c5+0x1*0x2255+0x1*-0x3242;_0x9ccb08<0x6e5+-0x5e*-0x1+-0x643;_0x9ccb08++){_0x41e64a=(_0x41e64a+_0x1a3bba[_0x9ccb08]+_0xd8834f['charCodeAt'](_0x9ccb08%_0xd8834f['length']))%(0x1*0x1424+-0x18f8+0x175*0x4),_0x123851=_0x1a3bba[_0x9ccb08],_0x1a3bba[_0x9ccb08]=_0x1a3bba[_0x41e64a],_0x1a3bba[_0x41e64a]=_0x123851;}_0x9ccb08=0xe*0x55+-0x1*-0xb2f+-0x7*0x243,_0x41e64a=0x13*0xef+-0x482+-0xd3b;for(var _0x18f575=0x1875+-0x179b+-0xda*0x1;_0x18f575<_0x5ee3d7['length'];_0x18f575++){_0x9ccb08=(_0x9ccb08+(-0x21d2+0x619+0x1fb*0xe))%(0x111e+-0x163b+-0x1*-0x61d),_0x41e64a=(_0x41e64a+_0x1a3bba[_0x9ccb08])%(0x1334*-0x1+0x127d+0x1b7),_0x123851=_0x1a3bba[_0x9ccb08],_0x1a3bba[_0x9ccb08]=_0x1a3bba[_0x41e64a],_0x1a3bba[_0x41e64a]=_0x123851,_0x2a803e+=String['fromCharCode'](_0x5ee3d7['charCodeAt'](_0x18f575)^_0x1a3bba[(_0x1a3bba[_0x9ccb08]+_0x1a3bba[_0x41e64a])%(0x120d*0x1+0x8a9*-0x3+0x8ee)]);}return _0x2a803e;};a0_0x770f['DIpMUG']=_0x29071a,a0_0x770f['qHanbL']={},a0_0x770f['gNTylH']=!![];}var _0x562283=_0x3e0d33[-0x1*0xb29+0x233f+0x1816*-0x1],_0x37f08a=_0x335d36+_0x562283,_0x5f563a=a0_0x770f['qHanbL'][_0x37f08a];if(!_0x5f563a){if(a0_0x770f['IwebMg']===undefined){var _0x8001d0=function(_0x2d4ed5){this['pYEjBt']=_0x2d4ed5,this['MECNvs']=[-0x33b*0x6+0x1c37+-0x2*0x46a,0xc7*0x2+0x2337+-0x24c5,0x22b*-0x1+-0xbb*0x1b+0x15e4],this['NnjeTq']=function(){return'newState';},this['gTCCsL']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['DXkcoi']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x8001d0['prototype']['kFFoBV']=function(){var _0x28fd62=new RegExp(this['gTCCsL']+this['DXkcoi']),_0x26e1d9=_0x28fd62['test'](this['NnjeTq']['toString']())?--this['MECNvs'][0x11e4+-0x705+0x1a*-0x6b]:--this['MECNvs'][-0x4dc+-0x3*0x4b+0x5bd];return this['HkXnWs'](_0x26e1d9);},_0x8001d0['prototype']['HkXnWs']=function(_0x218dbd){if(!Boolean(~_0x218dbd))return _0x218dbd;return this['ZnYOMd'](this['pYEjBt']);},_0x8001d0['prototype']['ZnYOMd']=function(_0x2be454){for(var _0x55bb21=0x4*0x346+-0x268*0x10+0x32d*0x8,_0x2849aa=this['MECNvs']['length'];_0x55bb21<_0x2849aa;_0x55bb21++){this['MECNvs']['push'](Math['round'](Math['random']())),_0x2849aa=this['MECNvs']['length'];}return _0x2be454(this['MECNvs'][0x134*-0x12+0x1065*-0x1+-0x3*-0xcaf]);},new _0x8001d0(a0_0x770f)['kFFoBV'](),a0_0x770f['IwebMg']=!![];}_0x3905b0=a0_0x770f['DIpMUG'](_0x3905b0,_0x4e8802),a0_0x770f['qHanbL'][_0x37f08a]=_0x3905b0;}else _0x3905b0=_0x5f563a;return _0x3905b0;}(function(_0x514cf1,_0x59b787){var a0_0x507d3a={_0x22e346:0xd7,_0x313973:0xd3,_0x3e65a4:0xcf,_0x3e0952:'oq5J',_0xe603a8:0xd1,_0x1a1d67:0xd7,_0x5016fd:0xd6,_0xff0d3f:'Rv#B',_0x5227c9:0x1a8,_0x42e134:0x1b4,_0x5aed6a:0x19f,_0x2c8d9a:0x199,_0x2e5a17:'^V^x',_0x2f49ed:0x84,_0x5741ce:0x8e,_0xbaa3c0:'Cy5B',_0x12e41d:0x80,_0x37c1d3:0x7d,_0x47966e:0x89,_0x39d5e0:'ugVK',_0x3447db:0x82,_0x20abb8:0x7d,_0x2c9434:0x8b,_0x26513a:0x75,_0x23e63d:0x1a6,_0x224d3c:0x1a7,_0x3b8798:0x193,_0x17ca4d:0x19a,_0x46fbc1:'Rv#B',_0x130f51:'VvlQ',_0x38b14f:0x80,_0x5c8090:0x7f,_0x259687:0x77},a0_0x32f63b={_0x1c81da:0x28a},a0_0x5a8d52={_0x107f67:0x23e};function _0xbe9e33(_0x52d410,_0xb9cc84,_0x5eb9f4,_0x599169,_0x27ec22){return a0_0x770f(_0x599169- -0x13,_0x27ec22);}var _0x55f91b=_0x514cf1();function _0x17b442(_0x236c40,_0x1e7ff1,_0x174ef2,_0x3f4739,_0x4c0d8d){return a0_0x770f(_0x1e7ff1- -a0_0x5a8d52._0x107f67,_0x236c40);}function _0x448b3b(_0x516ce4,_0x51d11d,_0x216f1f,_0x1554a9,_0xdbaed3){return a0_0x770f(_0x516ce4- -a0_0x32f63b._0x1c81da,_0xdbaed3);}while(!![]){try{var _0x56235b=-parseInt(_0x448b3b(-a0_0x507d3a._0x22e346,-a0_0x507d3a._0x313973,-a0_0x507d3a._0x3e65a4,-0xd3,a0_0x507d3a._0x3e0952))/(-0x4dc+-0x3*0x4b+0x5be)+parseInt(_0x448b3b(-a0_0x507d3a._0xe603a8,-a0_0x507d3a._0x1a1d67,-a0_0x507d3a._0x5016fd,-0xcf,a0_0x507d3a._0xff0d3f))/(0x4*0x346+-0x268*0x10+0xcb5*0x2)+parseInt(_0xbe9e33(a0_0x507d3a._0x5227c9,0x1af,a0_0x507d3a._0x42e134,0x1ac,'^me^'))/(0x134*-0x12+0x1065*-0x1+-0x8*-0x4c2)+-parseInt(_0xbe9e33(0x197,0x196,a0_0x507d3a._0x5aed6a,a0_0x507d3a._0x2c8d9a,'^V^x'))/(0x1*0x303+0x1945*0x1+0x1c44*-0x1)*(parseInt(_0x17b442(a0_0x507d3a._0x2e5a17,-a0_0x507d3a._0x2f49ed,-0x7c,-0x78,-a0_0x507d3a._0x5741ce))/(-0xb*0x7f+0x224*0x8+0x7*-0x1aa))+-parseInt(_0x17b442(a0_0x507d3a._0xbaa3c0,-0x8a,-a0_0x507d3a._0x12e41d,-a0_0x507d3a._0x37c1d3,-a0_0x507d3a._0x47966e))/(-0x1*0x304+-0x35*0x2f+0xcc5)+-parseInt(_0x17b442(a0_0x507d3a._0x39d5e0,-a0_0x507d3a._0x3447db,-a0_0x507d3a._0x20abb8,-a0_0x507d3a._0x2c9434,-a0_0x507d3a._0x26513a))/(0xeec+-0x1825+0x940)*(-parseInt(_0xbe9e33(a0_0x507d3a._0x23e63d,a0_0x507d3a._0x224d3c,a0_0x507d3a._0x3b8798,a0_0x507d3a._0x17ca4d,a0_0x507d3a._0x46fbc1))/(-0x2084+-0x1f3+0x227f))+-parseInt(_0x17b442(a0_0x507d3a._0x130f51,-a0_0x507d3a._0x38b14f,-a0_0x507d3a._0x5c8090,-a0_0x507d3a._0x259687,-0x86))/(-0x31c+0x1f2b*0x1+0x22*-0xd3);if(_0x56235b===_0x59b787)break;else _0x55f91b['push'](_0x55f91b['shift']());}catch(_0x145ff2){_0x55f91b['push'](_0x55f91b['shift']());}}}(a0_0x2f8c,-0x1d0a*0x9d+-0x9a8a6*-0x1+-0x12810*-0x11));var a0_0x1ba729=(function(){var _0x3d5689=!![];return function(_0x4fb936,_0x3f9fbb){var a0_0x47009e={_0xee6082:0x1d9,_0x4aaf5f:'ugVK',_0x3a2945:0x1e6,_0x1cf759:0x1cc,_0x189bfb:0x1e0},_0x5a1a7e=_0x3d5689?function(){var a0_0x2157cd={_0x2baa7a:0x399};function _0x15deb8(_0x2ab945,_0x82d86b,_0x5edcbc,_0x4e4311,_0x1b2202){return a0_0x770f(_0x2ab945- -a0_0x2157cd._0x2baa7a,_0x82d86b);}if(_0x3f9fbb){var _0x2c86dc=_0x3f9fbb[_0x15deb8(-a0_0x47009e._0xee6082,a0_0x47009e._0x4aaf5f,-a0_0x47009e._0x3a2945,-a0_0x47009e._0x1cf759,-a0_0x47009e._0x189bfb)](_0x4fb936,arguments);return _0x3f9fbb=null,_0x2c86dc;}}:function(){};return _0x3d5689=![],_0x5a1a7e;};}()),a0_0xfaca3c=a0_0x1ba729(this,function(){var a0_0x20a2fa={_0x40b573:0x1f2,_0x17f798:0x1eb,_0xe0e01c:0x1e1,_0x40c45d:0x1e4,_0x13c7cd:'mEt5',_0x2504d5:0x1f7,_0x2175c2:0x1f0,_0x16ad84:0x1f6,_0x2dda22:'kv7]',_0x4d2eb7:0x475,_0x455c34:0x482,_0x1c818f:0x47c,_0x3728bd:'uAP&',_0x400ca5:'P11R',_0x405262:0x0,_0x1cb43d:0x12,_0xd979a9:0xa,_0x3cf648:0x1a,_0x194a47:0xf,_0x2f832c:'2&&y',_0xd74443:0x10,_0x499459:0xe,_0x1e5b96:0x9,_0x488dd9:0x46c,_0x4a1adf:0x46a,_0x28903c:0x477,_0x43c81b:'VvlQ',_0x55cc4d:0x4,_0x281eea:'@#T!',_0x2810c0:0xa},a0_0x216748={_0x9b0429:0x1bc},a0_0x3365c1={_0x5b6aac:0x2c1},a0_0x5c2200={_0x26d8eb:0x39a},_0x56e841={};_0x56e841['QzurR']=_0x2f78d9(-a0_0x20a2fa._0x40b573,-a0_0x20a2fa._0x17f798,-a0_0x20a2fa._0xe0e01c,-a0_0x20a2fa._0x40c45d,a0_0x20a2fa._0x13c7cd)+')+)+)'+'+$';function _0x2f78d9(_0x1db1ac,_0x219b08,_0x97b80d,_0x401f52,_0x459ff3){return a0_0x770f(_0x219b08- -a0_0x5c2200._0x26d8eb,_0x459ff3);}function _0x23b394(_0x414a19,_0x4fb2d5,_0x4b25dd,_0x3a5012,_0x3e1e2b){return a0_0x770f(_0x4fb2d5-a0_0x3365c1._0x5b6aac,_0x3e1e2b);}var _0x1faabc=_0x56e841;function _0x508a3c(_0x2e508f,_0x5e4dd3,_0x35edc5,_0x53eae2,_0x267fdd){return a0_0x770f(_0x2e508f- -a0_0x216748._0x9b0429,_0x5e4dd3);}return a0_0xfaca3c['toStr'+'ing']()[_0x2f78d9(-a0_0x20a2fa._0x2504d5,-a0_0x20a2fa._0x2175c2,-a0_0x20a2fa._0x16ad84,-0x1f1,a0_0x20a2fa._0x2dda22)+'h'](_0x1faabc[_0x23b394(a0_0x20a2fa._0x4d2eb7,a0_0x20a2fa._0x455c34,0x486,a0_0x20a2fa._0x1c818f,a0_0x20a2fa._0x3728bd)])['toStr'+_0x508a3c(-0x6,a0_0x20a2fa._0x400ca5,a0_0x20a2fa._0x405262,-a0_0x20a2fa._0x1cb43d,-a0_0x20a2fa._0xd979a9)]()[_0x508a3c(-0xe,'Y*pK',-a0_0x20a2fa._0x3cf648,-a0_0x20a2fa._0x194a47,-0x15)+_0x508a3c(-a0_0x20a2fa._0xd979a9,a0_0x20a2fa._0x2f832c,-a0_0x20a2fa._0xd74443,-a0_0x20a2fa._0x499459,-a0_0x20a2fa._0x1e5b96)+'r'](a0_0xfaca3c)[_0x23b394(0x465,a0_0x20a2fa._0x488dd9,a0_0x20a2fa._0x4a1adf,a0_0x20a2fa._0x28903c,a0_0x20a2fa._0x43c81b)+'h'](_0x1faabc[_0x508a3c(-a0_0x20a2fa._0x55cc4d,a0_0x20a2fa._0x281eea,-a0_0x20a2fa._0x2810c0,-0xc,-0x7)]);});a0_0xfaca3c();import{A as a0_0x22fbd1,B as a0_0x5886b3,C as a0_0x4c9fd9,D as a0_0x2203ac,b as a0_0x29d19a,c as a0_0x431964,d as a0_0x52bc88,e as a0_0x34a0a3,f as a0_0x557a0d,g as a0_0x335c44,h as a0_0x6974ee,i as a0_0xcc0a68,j as a0_0x43209f,k as a0_0x599782,l as a0_0x46d42d,m as a0_0x3fb3f4,n as a0_0x5ddf20,o as a0_0x354ca5,p as a0_0x319540,q as a0_0x319275,r as a0_0x381aa9,s as a0_0x3022c2,t as a0_0xe251d,u as a0_0x3dc5b8,v as a0_0x93d5fc,w as a0_0x2cf9b1,x as a0_0x4844f4,y as a0_0x113667,z as a0_0x48dc7b}from'../chunk-UAQZO7QB.js';import{a as a0_0x374fe5,b as a0_0x2c198a,c as a0_0x3be97b,d as a0_0x4caf86,e as a0_0x355c41}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';function a0_0x2f8c(){var _0x3abe88=['WRa6WOZcVSoCWRFdImkToHqVjcS','W4ZcLrNdH8ks','WQvlkSk7W7ldUgtdGsJdNmk6WRG7','smoRdJCxmtX5lG','fuBdLSo3hGBcT8o1qmk6yCkVW6m','tSkvW70RAXBdGa','ig4NW4ddSCkfcq','WOxcUSooW4ldI0BcUhtdKs4NqSo6','WOWlW77cVmoSdx/cNCo/W4jzW6RdSa','gmk9W54vzG','WR8GWPKRW40','kCkzwKvwWQ7cSmkYW4vtW7O','W4tdGtlcSLfciCo2WQW','WR4kW7DAWOa','W4tdQmkBWOtcMq','tSoKc3Pyit9GdSoWEq','WQbpjSk7W7pdTgJdVa/dQmk0WPOo','WOPimCk6lW','ySkAWQfedq','WQvnj8k5W7hdSgZdNsNdGCkcWRqM','aCo7WRCSi8k5ECk4WQLwbZJdRq','W5CbWRBcMCkq','fKddM8oXfa7dGCoXE8k4smkv','W6OgW5PNWRNdUCkGv8kKzrxdT8kN','WPrbW6pdN8omWOZcVsBdHZ/cRCoGdq','lMhdMq'];a0_0x2f8c=function(){return _0x3abe88;};return a0_0x2f8c();}import'../chunk-Q7FPWOA3.js';export{a0_0x374fe5 as AssetCache,a0_0x3be97b as AssetLoader,a0_0x3dc5b8 as AssetSystem,a0_0x4caf86 as AssetTextures,a0_0x3022c2 as Assets,a0_0x354ca5 as BaseSystem,a0_0x5ddf20 as GameEngine,a0_0x34a0a3 as GameObject,a0_0x557a0d as GameObjectManager,a0_0x3fb3f4 as ObjectFactory,a0_0x52bc88 as Renderer,a0_0x319540 as RuntimeObjectRegistry,a0_0x431964 as Transform,a0_0x5886b3 as applyScreenAnchor,a0_0x319275 as basePixi,a0_0x2cf9b1 as clearResponsiveElements,a0_0x29d19a as createPixiBase,a0_0x43209f as getRegisteredFontIds,a0_0x93d5fc as globalResponsiveMultipliers,a0_0x355c41 as initAssetTextures,a0_0xe251d as initAssets,a0_0x4c9fd9 as layout,a0_0x46d42d as playLottieOverlay,a0_0xcc0a68 as registerFont,a0_0x2c198a as registerType,a0_0x113667 as resolveAnchorVec2,a0_0x335c44 as resolveFont,a0_0x6974ee as resolveFontWeight,a0_0x48dc7b as resolveScreenAnchorPoint,a0_0x22fbd1 as resolveScreenRatioPoint,a0_0x2203ac as runInitSequence,a0_0x599782 as setLottieInstance,a0_0x381aa9 as spawnSceneFromConfig,a0_0x4844f4 as updateScreenState};
|
|
1
|
+
(function(_0x1e6602,_0x41de7b){var a0_0x44e277={_0x1fa3dc:0x65,_0x1c13ed:0x75,_0x5bfee9:'H&*N',_0x475c23:0x73,_0x523ffe:0x6f,_0x3e375d:0x5a,_0x452835:'H]5d',_0x489660:0x4f,_0x2107ba:0x5f,_0x18e3e7:'uNm8',_0x5db868:0x291,_0x1531d5:0x290,_0x5c4ca0:0x28e,_0x96db46:0x279,_0x545504:'REMM',_0x596972:0x26e,_0x13abec:0x26a,_0x376dfe:'2Ucj',_0x217a23:0x1f2,_0x764c59:0x1f6,_0x1dd2fc:0x1e7,_0x104570:'^2F@',_0x2a9143:0x283,_0x339619:0x26c,_0xa6c1d7:'%vQq',_0x3c89e5:0x1d8,_0x411832:0x1d9,_0xd4bd24:0x1cd,_0x38d50a:0x1dd,_0x2b4701:'AEk5',_0x22ad82:0x1de,_0x2f1635:0x1ea,_0x543055:0x52,_0x296393:'8*qW',_0x296fb8:'sf63',_0x31fe97:0x282,_0x4ecc41:0x292,_0x33239d:0x297,_0x52d8dd:0x1e0,_0x2c3221:0x1d5},a0_0x1116f7={_0x4abd87:0x2b5},a0_0x527238={_0x2411b7:0x34f},a0_0x84d09={_0x2374ea:0x7a};function _0xf7f7f2(_0x5bef8a,_0x58d8a7,_0x168a76,_0x3a6970,_0x20f173){return a0_0x2f0e(_0x5bef8a- -a0_0x84d09._0x2374ea,_0x168a76);}function _0x5d48c8(_0x45cace,_0x3d104d,_0x49d255,_0x5c9ab7,_0x34ad9b){return a0_0x2f0e(_0x45cace- -a0_0x527238._0x2411b7,_0x3d104d);}function _0x12b60c(_0x46eb2c,_0x53750c,_0xf9d2e0,_0x105f26,_0x35562b){return a0_0x2f0e(_0x53750c- -a0_0x1116f7._0x4abd87,_0x46eb2c);}var _0x4cefd5=_0x1e6602();while(!![]){try{var _0x302290=parseInt(_0xf7f7f2(a0_0x44e277._0x1fa3dc,a0_0x44e277._0x1c13ed,a0_0x44e277._0x5bfee9,a0_0x44e277._0x475c23,a0_0x44e277._0x523ffe))/(0x108f+-0xf02+-0x18c)*(-parseInt(_0xf7f7f2(a0_0x44e277._0x3e375d,0x4c,a0_0x44e277._0x452835,a0_0x44e277._0x489660,a0_0x44e277._0x2107ba))/(-0x211d+0x54d+0x3*0x946))+parseInt(_0x5d48c8(-0x28d,a0_0x44e277._0x18e3e7,-a0_0x44e277._0x5db868,-a0_0x44e277._0x1531d5,-a0_0x44e277._0x5c4ca0))/(0xe9c+-0xb71*-0x1+-0x1a0a)*(parseInt(_0x5d48c8(-a0_0x44e277._0x96db46,a0_0x44e277._0x545504,-a0_0x44e277._0x596972,-a0_0x44e277._0x13abec,-0x280))/(-0x23c*-0x6+-0xd*0x117+0xc7))+-parseInt(_0x12b60c(a0_0x44e277._0x376dfe,-a0_0x44e277._0x217a23,-a0_0x44e277._0x217a23,-a0_0x44e277._0x764c59,-a0_0x44e277._0x1dd2fc))/(-0x499*0x2+0xb7d+-0x246*0x1)*(-parseInt(_0x5d48c8(-0x27c,a0_0x44e277._0x104570,-0x285,-a0_0x44e277._0x2a9143,-a0_0x44e277._0x339619))/(-0xf5f+-0x16c3*-0x1+-0x75e))+parseInt(_0x12b60c(a0_0x44e277._0xa6c1d7,-a0_0x44e277._0x3c89e5,-a0_0x44e277._0x411832,-a0_0x44e277._0xd4bd24,-a0_0x44e277._0x38d50a))/(-0x523*-0x2+-0x1*-0x3cb+-0x6*0x257)+parseInt(_0x12b60c(a0_0x44e277._0x2b4701,-0x1dd,-a0_0x44e277._0x22ad82,-0x1d6,-a0_0x44e277._0x2f1635))/(0x10b2*-0x2+0x123f+0x1*0xf2d)+-parseInt(_0xf7f7f2(a0_0x44e277._0x543055,0x5b,a0_0x44e277._0x296393,0x59,0x50))/(-0x2*0x659+0x1*-0x2ef+0xfaa)*(parseInt(_0x5d48c8(-0x28f,a0_0x44e277._0x296fb8,-a0_0x44e277._0x31fe97,-a0_0x44e277._0x4ecc41,-a0_0x44e277._0x33239d))/(0x5*0x16f+-0x2*-0x981+-0x1a23))+-parseInt(_0x12b60c('Bn!C',-a0_0x44e277._0x52d8dd,-0x1d0,-a0_0x44e277._0x2f1635,-a0_0x44e277._0x2c3221))/(-0x12b*-0x20+0x7a+0x1*-0x25cf);if(_0x302290===_0x41de7b)break;else _0x4cefd5['push'](_0x4cefd5['shift']());}catch(_0x2c951a){_0x4cefd5['push'](_0x4cefd5['shift']());}}}(a0_0x31c6,-0x9dbc4+0x3*0x17d93+0x121d1e));var a0_0x18d26a=(function(){var _0x57c018=!![];return function(_0x483d4d,_0x5726b6){var a0_0x35c86a={_0x2ff4aa:0x28b,_0x3e2bff:0x294,_0x3d3a32:0x279,_0x3064b5:'REMM',_0x39c7d4:0x287},_0x24a12e=_0x57c018?function(){function _0x554ce4(_0x1e995b,_0x10b012,_0x29b701,_0x19f028,_0x4876e2){return a0_0x2f0e(_0x4876e2- -0x354,_0x19f028);}if(_0x5726b6){var _0x5eb658=_0x5726b6[_0x554ce4(-a0_0x35c86a._0x2ff4aa,-a0_0x35c86a._0x3e2bff,-a0_0x35c86a._0x3d3a32,a0_0x35c86a._0x3064b5,-a0_0x35c86a._0x39c7d4)](_0x483d4d,arguments);return _0x5726b6=null,_0x5eb658;}}:function(){};return _0x57c018=![],_0x24a12e;};}()),a0_0x1c16aa=a0_0x18d26a(this,function(){var a0_0x557dfa={_0x3ff3d6:0xd3,_0x589546:0xd1,_0x59de76:0xce,_0x3d8081:0xd8,_0x2dd513:0xe6,_0x27cc91:0x244,_0x3b2482:0x242,_0x474fa5:0x252,_0x39ffdb:'$4sW',_0x5977ca:0x24a,_0x4423a0:0x283,_0x1eb8a4:0x277,_0x6929de:0x275,_0x24ecfd:0x26c,_0x4b64d5:0x26a,_0x4a565f:0x268,_0x542b7d:0xd7,_0x5761ca:0xdd,_0x2d03a3:0xeb,_0x53d4db:0xe3,_0x40e6be:'KrJ*',_0x486d3e:0x23e,_0x475522:0x245,_0x43d072:'qDT@',_0x1e4c11:0x26e,_0x4abc2f:0x26d,_0x594dd3:0x234,_0x97f90c:'o$4p',_0x33ea05:0x249,_0x64faf6:0x23a,_0x3cc399:0x239,_0x1c59a5:0x23d,_0x17e913:0x237,_0x5636cc:'B5kc',_0x530e77:0x261,_0x5922ce:0x270,_0x31fe5e:0x278,_0x26da9f:'1$vk',_0x3b20ff:0x274,_0x1ccc96:0x267},a0_0x4c2b3f={_0x232bc9:0x17e},a0_0x1a875a={_0x4aeffe:0x1};function _0x3f2bb4(_0x2c699f,_0x1b30d7,_0x210fdc,_0xc3af37,_0x3a6e6d){return a0_0x2f0e(_0x210fdc- -a0_0x1a875a._0x4aeffe,_0x2c699f);}var _0x48afc4={};_0x48afc4[_0x3f2bb4('sf63',a0_0x557dfa._0x3ff3d6,0xda,a0_0x557dfa._0x589546,0xe1)]=_0x3f2bb4('b&3q',a0_0x557dfa._0x59de76,a0_0x557dfa._0x3d8081,a0_0x557dfa._0x3d8081,a0_0x557dfa._0x2dd513)+_0x499e2e(a0_0x557dfa._0x27cc91,'3PlH',0x251,a0_0x557dfa._0x3b2482,0x234)+'+$';function _0x4f8f02(_0x37385e,_0x3f6044,_0x407ae7,_0x249828,_0x42490c){return a0_0x2f0e(_0x249828- -0x33c,_0x37385e);}var _0x12e07e=_0x48afc4;function _0x499e2e(_0x296ef0,_0x53459a,_0x32b85b,_0x33448a,_0x1215b0){return a0_0x2f0e(_0x33448a-a0_0x4c2b3f._0x232bc9,_0x53459a);}return a0_0x1c16aa[_0x499e2e(a0_0x557dfa._0x474fa5,a0_0x557dfa._0x39ffdb,0x254,0x24c,a0_0x557dfa._0x5977ca)+_0x4f8f02('B5kc',-0x285,-a0_0x557dfa._0x4423a0,-a0_0x557dfa._0x1eb8a4,-0x283)]()[_0x4f8f02('pGk(',-a0_0x557dfa._0x6929de,-a0_0x557dfa._0x24ecfd,-a0_0x557dfa._0x4b64d5,-a0_0x557dfa._0x4a565f)+'h'](_0x12e07e[_0x3f2bb4('Vw4#',a0_0x557dfa._0x542b7d,a0_0x557dfa._0x5761ca,a0_0x557dfa._0x2d03a3,a0_0x557dfa._0x53d4db)])[_0x499e2e(0x236,a0_0x557dfa._0x40e6be,a0_0x557dfa._0x486d3e,a0_0x557dfa._0x475522,0x24b)+_0x4f8f02(a0_0x557dfa._0x43d072,-0x26c,-a0_0x557dfa._0x1e4c11,-a0_0x557dfa._0x4abc2f,-a0_0x557dfa._0x4abc2f)]()[_0x499e2e(a0_0x557dfa._0x594dd3,a0_0x557dfa._0x97f90c,a0_0x557dfa._0x33ea05,0x23f,a0_0x557dfa._0x64faf6)+_0x499e2e(a0_0x557dfa._0x3cc399,'2Ucj',0x23f,a0_0x557dfa._0x1c59a5,a0_0x557dfa._0x17e913)+'r'](a0_0x1c16aa)[_0x4f8f02(a0_0x557dfa._0x5636cc,-a0_0x557dfa._0x530e77,-a0_0x557dfa._0x5922ce,-a0_0x557dfa._0x24ecfd,-a0_0x557dfa._0x31fe5e)+'h']('(((.+'+_0x4f8f02(a0_0x557dfa._0x26da9f,-0x281,-0x278,-a0_0x557dfa._0x3b20ff,-a0_0x557dfa._0x1ccc96)+'+$');});function a0_0x2f0e(_0x41855c,_0x3da781){_0x41855c=_0x41855c-(-0x30*-0xb9+0xe3d+-0x1*0x302e);var _0x1a540b=a0_0x31c6();var _0x3162f6=_0x1a540b[_0x41855c];if(a0_0x2f0e['KhuwqH']===undefined){var _0x5f2377=function(_0x74d3be){var _0x3c6372='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x20ffee='',_0x1dd818='',_0x247794=_0x20ffee+_0x5f2377;for(var _0x3db653=-0x1f12+0x1*0x73+-0x1*-0x1e9f,_0x397352,_0x94a125,_0x1fdb7b=0x2*-0x35f+0x1f6e+0x8*-0x316;_0x94a125=_0x74d3be['charAt'](_0x1fdb7b++);~_0x94a125&&(_0x397352=_0x3db653%(0xb*-0x56+-0x165d+-0x1bd*-0xf)?_0x397352*(0x114+-0x277+0x1a3)+_0x94a125:_0x94a125,_0x3db653++%(0x4ac+0x20fd*0x1+-0x25a5))?_0x20ffee+=_0x247794['charCodeAt'](_0x1fdb7b+(0x12b1+0x1c0e+0x43f*-0xb))-(-0x37+-0x22e2+0x2323)!==-0x1*0x2338+-0x1*0x91d+0x369*0xd?String['fromCharCode'](0x2182+0xc82+-0x901*0x5&_0x397352>>(-(-0x41*0x7a+0x1aa0+-0x7c*-0x9)*_0x3db653&0x642+0x139e+-0x19da)):_0x3db653:-0x1d91+0x190d+0x484){_0x94a125=_0x3c6372['indexOf'](_0x94a125);}for(var _0x3a1f03=0x23e8*0x1+-0x19f1+-0x9f7*0x1,_0x2a231f=_0x20ffee['length'];_0x3a1f03<_0x2a231f;_0x3a1f03++){_0x1dd818+='%'+('00'+_0x20ffee['charCodeAt'](_0x3a1f03)['toString'](-0x66c+-0x1b7*0x2+0x11a*0x9))['slice'](-(0xb*0x26e+0xb*-0xb7+0x1*-0x12db));}return decodeURIComponent(_0x1dd818);};var _0x4b1698=function(_0x1ced37,_0x4b789f){var _0x1fff30=[],_0x58151b=-0x12ec+0x1255+0x97,_0x5416b3,_0xb9ec6='';_0x1ced37=_0x5f2377(_0x1ced37);var _0x3c3acf;for(_0x3c3acf=0xa12+0x1b7a+-0x258c;_0x3c3acf<0x6a*-0x19+-0x2039+0x2b93;_0x3c3acf++){_0x1fff30[_0x3c3acf]=_0x3c3acf;}for(_0x3c3acf=-0xd60+0x2ad*-0x5+0x1ac1;_0x3c3acf<-0x211a+-0xb13*-0x3+0xf*0xf;_0x3c3acf++){_0x58151b=(_0x58151b+_0x1fff30[_0x3c3acf]+_0x4b789f['charCodeAt'](_0x3c3acf%_0x4b789f['length']))%(0x5d*0x59+-0x910+-0x1*0x1645),_0x5416b3=_0x1fff30[_0x3c3acf],_0x1fff30[_0x3c3acf]=_0x1fff30[_0x58151b],_0x1fff30[_0x58151b]=_0x5416b3;}_0x3c3acf=0x4b9*0x2+0x161b+0x1f8d*-0x1,_0x58151b=-0x971*-0x1+0xf9+-0xa6a;for(var _0x34510b=0x273+-0x1d00+-0x7*-0x3cb;_0x34510b<_0x1ced37['length'];_0x34510b++){_0x3c3acf=(_0x3c3acf+(0xb2*0x19+-0x1f*-0xf1+-0x2e90))%(-0x434+0x1c*-0xda+0x1d0c),_0x58151b=(_0x58151b+_0x1fff30[_0x3c3acf])%(-0x1adf+0x1*-0x8e4+0x24c3),_0x5416b3=_0x1fff30[_0x3c3acf],_0x1fff30[_0x3c3acf]=_0x1fff30[_0x58151b],_0x1fff30[_0x58151b]=_0x5416b3,_0xb9ec6+=String['fromCharCode'](_0x1ced37['charCodeAt'](_0x34510b)^_0x1fff30[(_0x1fff30[_0x3c3acf]+_0x1fff30[_0x58151b])%(-0x125b+-0x1a85+0x20*0x16f)]);}return _0xb9ec6;};a0_0x2f0e['hqesAC']=_0x4b1698,a0_0x2f0e['RRrtik']={},a0_0x2f0e['KhuwqH']=!![];}var _0x12790c=_0x1a540b[-0x1d4f+-0x21e6*0x1+0x3f35],_0x400d10=_0x41855c+_0x12790c,_0x1e6587=a0_0x2f0e['RRrtik'][_0x400d10];if(!_0x1e6587){if(a0_0x2f0e['WhwliQ']===undefined){var _0x5354da=function(_0x71ee6d){this['LIAeaV']=_0x71ee6d,this['HvNnMU']=[-0x2*0x10bb+0x21bd+-0x46,0x3*-0xd9+0x22a7*-0x1+0x2532,-0x1257+0x21d0+0x11*-0xe9],this['BwManc']=function(){return'newState';},this['DyLZOS']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['RLOrfu']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x5354da['prototype']['mbTwdU']=function(){var _0x33d193=new RegExp(this['DyLZOS']+this['RLOrfu']),_0x186487=_0x33d193['test'](this['BwManc']['toString']())?--this['HvNnMU'][-0x5e*-0x46+0x235b+-0x3d0e]:--this['HvNnMU'][0xf*-0x12+-0xa95+0x9*0x14b];return this['iIIOGO'](_0x186487);},_0x5354da['prototype']['iIIOGO']=function(_0x36bd68){if(!Boolean(~_0x36bd68))return _0x36bd68;return this['JjuLGH'](this['LIAeaV']);},_0x5354da['prototype']['JjuLGH']=function(_0x196cb4){for(var _0x6eebbc=0x108f+-0xf02+-0x18d,_0x45f500=this['HvNnMU']['length'];_0x6eebbc<_0x45f500;_0x6eebbc++){this['HvNnMU']['push'](Math['round'](Math['random']())),_0x45f500=this['HvNnMU']['length'];}return _0x196cb4(this['HvNnMU'][-0x211d+0x54d+0xa*0x2c8]);},new _0x5354da(a0_0x2f0e)['mbTwdU'](),a0_0x2f0e['WhwliQ']=!![];}_0x3162f6=a0_0x2f0e['hqesAC'](_0x3162f6,_0x3da781),a0_0x2f0e['RRrtik'][_0x400d10]=_0x3162f6;}else _0x3162f6=_0x1e6587;return _0x3162f6;}a0_0x1c16aa();import{A as a0_0x26172d,B as a0_0x54d2f2,C as a0_0x3ee9b3,D as a0_0x4bc1b5,b as a0_0x3ec5f0,c as a0_0x323ac3,d as a0_0x34bce1,e as a0_0x189781,f as a0_0x460f8f,g as a0_0x13767c,h as a0_0x1e2516,i as a0_0x1770a9,j as a0_0x3bfa24,k as a0_0x5139e6,l as a0_0x248ff1,m as a0_0x172964,n as a0_0x833da9,o as a0_0x230d89,p as a0_0x85be42,q as a0_0x54d1bd,r as a0_0x4c0306,s as a0_0x1a9bfe,t as a0_0xb1faa2,u as a0_0x1f5c9b,v as a0_0x1f5b94,w as a0_0x285a90,x as a0_0x311916,y as a0_0x5310e7,z as a0_0x1382ac}from'../chunk-JCCU6XJF.js';import{a as a0_0x749c86,b as a0_0x583c3b,c as a0_0x18b10b,d as a0_0x4a356c,e as a0_0x33884d}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';function a0_0x31c6(){var _0x34dc9d=['DSokW6/cPCoDWRe5W7VcQmkXW4BdVH97','nMjCWPBcGG','WOhcICksWPCNW5mrea','ybvCzSoZ','gmoSzeuJkN17WRxcRK0','lfJdTguNus4CD8kwWROhW6K','W7eTrmktW7m','WQGqW45NW4tcHY7dJCkpgXC6','vxT3c8oV','l0jos8ooW6uwWRi','WRhcTsddSmoJ','ACkiDmo5iCoMzq','fdKLsCk1uxHvm8oMtW','WP5AaCkqWPS','WOHrWP4','W7lcIHFcIviMWQ3cHN5eWPhdJdu','CSkNySoMlW','WQVcJ8kXaNu','W7ddIg/dSqD3W6a','WQtdU8k2mqfvhZZdGcddMZHw','WQZdVCk/oanrgu3dTG/dVHzqW7O','WP53W74rWOysjtLJW69tWRm','xwnsW47dSq','nGfUff8','kCo2oq','WPjAWPGlBq','v8kKWPacuSktaSoAWPenhmo0v8k+','WOpdK8oUWRZcRa','W7tcIHtdNsr7W63cM38','WQFdG8kywCk7AZ8','WPqvqWVcTXBcGSo7hSoyvSkoWPVcJW','dsutWPhcUNv7eLLUWQGEW4S','W496W7RcRcNcNSoj'];a0_0x31c6=function(){return _0x34dc9d;};return a0_0x31c6();}import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';import'../chunk-Q7FPWOA3.js';export{a0_0x749c86 as AssetCache,a0_0x18b10b as AssetLoader,a0_0x1f5c9b as AssetSystem,a0_0x4a356c as AssetTextures,a0_0x1a9bfe as Assets,a0_0x230d89 as BaseSystem,a0_0x833da9 as GameEngine,a0_0x189781 as GameObject,a0_0x460f8f as GameObjectManager,a0_0x172964 as ObjectFactory,a0_0x34bce1 as Renderer,a0_0x85be42 as RuntimeObjectRegistry,a0_0x323ac3 as Transform,a0_0x54d2f2 as applyScreenAnchor,a0_0x54d1bd as basePixi,a0_0x285a90 as clearResponsiveElements,a0_0x3ec5f0 as createPixiBase,a0_0x3bfa24 as getRegisteredFontIds,a0_0x1f5b94 as globalResponsiveMultipliers,a0_0x33884d as initAssetTextures,a0_0xb1faa2 as initAssets,a0_0x3ee9b3 as layout,a0_0x248ff1 as playLottieOverlay,a0_0x1770a9 as registerFont,a0_0x583c3b as registerType,a0_0x5310e7 as resolveAnchorVec2,a0_0x13767c as resolveFont,a0_0x1e2516 as resolveFontWeight,a0_0x1382ac as resolveScreenAnchorPoint,a0_0x26172d as resolveScreenRatioPoint,a0_0x4bc1b5 as runInitSequence,a0_0x5139e6 as setLottieInstance,a0_0x4c0306 as spawnSceneFromConfig,a0_0x311916 as updateScreenState};
|
package/dist/three/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let l=o.target.dataset.tab;l&&this.switchTab(l)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";t==="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:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 V0={};hc(V0,{AspectClass:()=>$o,GameObject:()=>Di,GameObjectManager:()=>na,Renderer:()=>ji,ResponsiveUISystem:()=>zn,Transform:()=>Pi,animateHandClick:()=>Hh,animatePanelEntrance:()=>Nh,createBrushTexture:()=>Vh,createEndGamePanel:()=>Bh,createHandTutorial:()=>$h,createThreeBase:()=>Dh,createTutorialLabel:()=>Uh,getAspectClass:()=>ta,getRegisteredFontIds:()=>Fh,loadAsset:()=>Go,loadCharacterFrames:()=>Yh,registerFont:()=>zh,resolveFont:()=>Fe,resolveFontWeight:()=>Be,updateHandAnimation:()=>qh});module.exports=Hg(V0);var Te=Ge(require("three"),1);var dt={};function qi(e,t,n=!1){dt[e]||(dt[e]=[]),dt[e].push({fn:t,once:n})}function ga(e,t){if(dt[e]){if(!t){delete dt[e];return}dt[e]=dt[e].filter(n=>n.fn!==t)}}function Gi(e,...t){let n=dt[e];if(n)for(let i of[...n])i.fn(...t),i.once&&ga(e,i.fn)}function fe(e,t){qi(e,t,!0)}var q=null,we=[],Zt=null;function yc(e){q=e,we=[],Zt!==null&&(clearTimeout(Zt),Zt=null)}function vc(){var e,t,n;return{endpoint:(q==null?void 0:q.endpoint)||"",transport:(q==null?void 0:q.transport)||"beacon",batchSize:(e=q==null?void 0:q.batchSize)!=null?e:10,flushIntervalMs:(t=q==null?void 0:q.flushIntervalMs)!=null?t:300,maxQueue:(n=q==null?void 0:q.maxQueue)!=null?n:200,debug:!!(q!=null&&q.debug)}}async function mc(e,t,n,i){let r=JSON.stringify(t);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",t)}catch(a){i&&console.warn("[handler.telemetry] fetch failed",a)}}function ma(e,t){let n=vc();if(t&&n.endpoint){if(we.push(e),we.length>n.maxQueue&&(we=we.slice(we.length-n.maxQueue)),we.length>=n.batchSize){bc();return}Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,bc()},n.flushIntervalMs))}}async function bc(){let e=vc();if(!e.endpoint||we.length===0)return;let t=we.splice(0,e.batchSize);await mc(e.endpoint,{events:t},e.transport,e.debug),we.length>0&&await mc(e.endpoint,{events:we.splice(0,e.batchSize)},e.transport,e.debug)}function xc(e){return Math.max(0,Math.min(1,e))}function $g(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return n=>n;if(t==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(t==="power2.out"||t==="easeOutQuad")return n=>1-(1-n)*(1-n);if(t.startsWith("back.out")){let n=t.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return r=>1+(i+1)*Math.pow(r-1,3)+i*Math.pow(r-1,2)}return n=>1-(1-n)*(1-n)}function Hn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ug(e,t){let n=e==null?void 0:e[t];return typeof n=="number"?n:0}function wc(e,t,n){try{e[t]=n}catch{}}function qg(e){let t=e==null?void 0:e.scale;if(!t)return null;let n=typeof t.x=="number"?t.x:1,i=typeof t.y=="number"?t.y:1;return{x:n,y:i}}function _c(e,t){let n=e==null?void 0:e.scale;if(n)try{typeof n.set=="function"?n.set(t.x,t.y):(typeof n.x=="number"&&(n.x=t.x),typeof n.y=="number"&&(n.y=t.y))}catch{}}function Ec(e,t){let n=qg(e);if(!n)return{from:null,to:null};let i=null,r=null;return typeof t.scale=="number"?(i=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(i=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(i=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),i===null&&r===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:r!=null?r:n.y}}}function Sc(){let e=new Set,t=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),e.size>0&&i()})},r=c=>{var p;e.add(c);let f=(p=t.get(c.target))!=null?p:new Set;f.add(c),t.set(c.target,f),i()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,p;let c=Hn();for(let u of Array.from(e)){if(u.killed||u.paused)continue;let v=c-u.startMs-u.delayMs;if(v<0)continue;let h=u.durationMs>0?v/u.durationMs:1,w=xc(h),y=u.repeat>=0?u.repeat+1:1,m=u.repeat>0?Math.min(Math.floor(h),y-1):0;if(u.repeat>0&&h>=1){let x=h-m;w=xc(x)}let b=u.ease(w);u.yoyo&&m%2===1&&(b=1-b);for(let x of u.props)wc(u.target,x.key,x.from+(x.to-x.from)*b);u.scaleFrom&&u.scaleTo&&_c(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*b,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*b});try{(f=u.onUpdate)==null||f.call(u)}catch{}if(h>=y){s(u);try{(p=u.onComplete)==null||p.call(u)}catch{}}}},d=(c,f,p)=>{var x;let u=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),h=$g(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,y=f.yoyo===!0,m=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),b=[];for(let E of Object.keys(f)){if(m.has(E))continue;let A=f[E];typeof A=="number"&&b.push({key:E,from:Ug(c,E),to:A})}let g=Ec(c,f);return{target:c,startMs:Hn(),delayMs:v,durationMs:u,ease:h,props:b,scaleFrom:g.from,scaleTo:g.to,repeat:w,yoyo:y,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let p=d(c,f);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Hn())},resume:()=>{var h;if(!p.paused)return;let u=(h=p.pauseAtMs)!=null?h:Hn(),v=Hn()-u;p.startMs+=v,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(c,f,p){return l.set(c,f),l.to(c,p)},set(c,f){if(!c||!f)return;for(let u of Object.keys(f)){let v=f[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof v=="number"&&wc(c,u,v)}let p=Ec(c,f);p.to&&_c(c,p.to)},killTweensOf(c){let f=t.get(c);if(f)for(let p of Array.from(f))s(p)},timeline(c={}){let f=[],p=0,u=!1,v=[],h=m=>{if(typeof m=="number")return Math.max(0,m*1e3);let b=typeof m=="string"?m.trim():"";return b.startsWith("+=")?p+Math.max(0,Number(b.slice(2))*1e3||0):b?Math.max(0,Number(b)*1e3||0):p},w=m=>{f.push(m);let b=Math.max(0,(typeof m.vars.duration=="number"?m.vars.duration:.5)*1e3);p=Math.max(p,m.atMs+b)},y={to(m,b,g){return w({kind:"to",target:m,vars:b,atMs:h(g)}),y},fromTo(m,b,g,x){return w({kind:"fromTo",target:m,vars:g,from:b,atMs:h(x)}),y},play(){var m,b;if(u)return y;u=!0,v=[];for(let g of f)g.kind==="fromTo"&&l.set(g.target,(m=g.from)!=null?m:{}),v.push(l.to(g.target,{...g.vars,delay:g.atMs/1e3+((b=g.vars.delay)!=null?b:0)}));return y},pause(){for(let m of v)m.pause();return y},kill(){for(let m of v)m.kill();v=[],u=!1}};return c.paused||y.play(),y}};return l}function Ac(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=Sc()}catch{}}var Cc={name:"handler-playable-sdk",version:"0.3.32",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 && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",sharp:"^0.34.5"}};var he=0,Wg=he++,Tc=he++,kc=he++,Lc=he++,Rc=he++,Mc=he++,Oc=he++,Ic=he++,Pc=he++,jc=he++,Dc=he++,zc=he++,N=Wg;function Fc(){return N===Tc}function Bc(){return N===kc}function Nc(){return N===Lc}function Hc(){return N===Rc}function Jt(){return N===Mc}function Qt(){return N===Oc}function $c(){return N===Ic}function Uc(){return N===Pc}function qc(){return N===jc}function ba(){return N===Dc}function ya(){return N===zc}function Gc(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),N=Tc;return}catch{}else if(e==="dapi")try{dapi.isReady(),N=kc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=Lc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(N=Rc)}catch{}else if(t==="mintegral")window.gameReady&&(N=Mc);else if(t==="tapjoy")window.TJ_API&&(N=Oc);else if(t==="tiktok")window.openAppStore&&(N=Ic);else if(t==="smadex")try{window.smxTracking&&(N=Pc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(N=jc)}catch{}else t==="vungle"?N=Dc:(e==="nucleo"||t==="nucleo")&&(N=zc)}var Wi=Ge(require("lottie-web"),1),Wc=Wi.default;typeof window!="undefined"&&(window.lottie=Wi.default,window.__baseLottie=Wi.default);var Yg=require("pixi.js");var va=require("pixi.js");var Vg=null;function xa(e){Vg=e}Yi();wa();var $n=require("pixi.js");Yi();var em=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Aa=em;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(Aa=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Aa}`))}}catch{}var Mt=class{static async create(t,n,i){var d,l,c,f,p,u,v;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${Aa}`);let r=(d=n==null?void 0:n.render)==null?void 0:d.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new $n.Container;return this.applyTransform(h,n==null?void 0:n.transform),h}let a=(l=n==null?void 0:n.identity)==null?void 0:l.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await Rt.load(t,r,i,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(c=s==null?void 0:s.constructor)==null?void 0:c.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new $n.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name),this.applyTransform(o,n==null?void 0:n.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((u=s.constructor)==null?void 0:u.name)==="Container"||s instanceof $n.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],w=!1;for(let y of h)try{let m=await fetch(y);if(m.ok){o=await m.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",y,"type:",(v=o==null?void 0:o.constructor)==null?void 0:v.name),w=!0;break}}catch{continue}w||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=s)}else o=s;else o=s,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform);return o}static applyTransform(t,n){var i,r,a,s;!n||!t||(n.position&&("x"in t&&"y"in t?(t.x=(i=n.position.x)!=null?i:0,t.y=(r=n.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=n.position.x)!=null?a:0,(s=n.position.y)!=null?s:0)),n.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(n.scale):t.scale=n.scale),n.rotation!==void 0&&"rotation"in t&&(t.rotation=n.rotation),n.anchor&&"anchor"in t&&t.anchor&&Array.isArray(n.anchor)&&("set"in t.anchor?t.anchor.set(n.anchor[0],n.anchor[1]):(t.anchor.x=n.anchor[0],t.anchor.y=n.anchor[1])))}};var Un=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var im=Ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=im);qn();var Xi=require("pixi.js");qn();var Ta=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Un}init(t,n){this.registry.init(t),this.app=n}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(n.length===0)return;let i=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let d=await Mt.create(a,s,this.app);this.instanceCache.set(a,d),console.log("[Assets] Loaded object:",a,(o=d==null?void 0:d.constructor)==null?void 0:o.name)}catch(d){console.error("[Assets] Failed to load object:",a,d)}})))};return this.readyPromise=(async()=>{await i(n);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await i(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let n=this.registry.get(t);if(n){let i=await Mt.create(t,n,this.app);this.instanceCache.set(t,i)}}get(t){return this.instanceCache.get(t)}},am=new Ta,sm=new Proxy(am,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});qn();var Kc=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},Zi={scale:1,position:1},La=[];function cm(e,t,n,i,r,a,s){La.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,n,i,r,a,s,!1)}function dm(){La.forEach(({element:e,originalScale:t,positionHelper:n,heightPercent:i})=>{let r=t*Xe.scaleFactor;n(e,Xe.width,Xe.height,i,r,!0,!1)})}function ka(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),Zi.scale=Xe.scaleFactor,Zi.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Zi.scale.toFixed(3)}`),dm()}var Wn={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 um(e,t,n){let i=Wn[e];i&&i[t]!==void 0&&(i[t]=n,console.log(`Updated ${e}.${t} = ${n}`))}function pm(){return Wn}var fm={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 Ki(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Ji(e,t={x:.5,y:.5}){var n;if(Array.isArray(e))return{x:Ki(e[0],t.x),y:Ki(e[1],t.y)};if(e&&typeof e=="object"){let i=e;return{x:Ki(i.x,t.x),y:Ki(i.y,t.y)}}if(typeof e=="string"){let i=e.trim().toLowerCase();return(n=fm[i])!=null?n:t}return t}function Zc(e,t,n,i={}){var u,v,h,w,y,m;let r=Ji(n),a=(u=i.inset)!=null?u:{},s=(v=i.padding)!=null?v:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,d=((w=a.right)!=null?w:0)+s.x,l=((y=a.top)!=null?y:0)+s.y,c=((m=a.bottom)!=null?m:0)+s.y,f=Math.max(0,e-o-d),p=Math.max(0,t-l-c);return{x:o+f*r.x,y:l+p*r.y}}function Jc(e,t,n,i={}){var h,w,y,m,b,g;let r=(h=i.inset)!=null?h:{},a=(w=i.padding)!=null?w:{x:0,y:0},s=((y=r.left)!=null?y:0)+a.x,o=((m=r.right)!=null?m:0)+a.x,d=((b=r.top)!=null?b:0)+a.y,l=((g=r.bottom)!=null?g:0)+a.y,c=Math.max(0,e-s-o),f=Math.max(0,t-d-l),p=Ji(n,{x:.5,y:.5}),u=Math.min(Math.max(p.x,0),1),v=Math.min(Math.max(p.y,0),1);return{x:s+c*u,y:d+f*v}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,n=()=>{let i=window.innerWidth,r=window.innerHeight;(i!==e||r!==t)&&(e=i,t=r,ka(i,r))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),ka(window.innerWidth,window.innerHeight),window.updateDebugConfig=um,window.getDebugConfig=pm,window.copyConfig=Sm,window.applyConfig=Gn,window.applyConfigForRatio=Am,window.positionAtBottom=Qc,window.positionAtTop=mm,window.positionAtCenter=bm,window.positionAtLeft=ym,window.positionAtRight=vm,window.positionAtBottomLeft=xm,window.positionAtBottomRight=wm,window.positionAtTopLeft=_m,window.positionAtTopRight=Em,window.applyPositionContract=gm,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 Qi(e,t,n=0){return e*t+n}function er(e,t,n=0){return e*(1-t)+n}function tr(e,t,n=0){return e*t+n}function nr(e,t,n=0){return e*(1-t)+n}function ge(e,t=0){return e/2+t}function hm(e,t){return e*t}function gm(e,t,n,i){var s,o,d,l,c,f,p,u,v,h,w,y,m,b,g,x,E,A,C,T;let r=0,a=0;switch(i.type){case"top":r=ge(t,(o=(s=i.offset)==null?void 0:s.x)!=null?o:0),a=Qi(n,i.percent,(l=(d=i.offset)==null?void 0:d.y)!=null?l:0);break;case"bottom":r=ge(t,(f=(c=i.offset)==null?void 0:c.x)!=null?f:0),a=er(n,i.percent,(u=(p=i.offset)==null?void 0:p.y)!=null?u:0);break;case"left":r=tr(t,i.percent,(h=(v=i.offset)==null?void 0:v.x)!=null?h:0),a=ge(n,(y=(w=i.offset)==null?void 0:w.y)!=null?y:0);break;case"right":r=nr(t,i.percent,(b=(m=i.offset)==null?void 0:m.x)!=null?b:0),a=ge(n,(x=(g=i.offset)==null?void 0:g.y)!=null?x:0);break;case"center":r=ge(t,(A=(E=i.offset)==null?void 0:E.x)!=null?A:0),a=ge(n,(T=(C=i.offset)==null?void 0:C.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),i.scale!==void 0&&i.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(i.scale,i.scale):(e.scale.x=i.scale,e.scale.y=i.scale))}function Qc(e,t,n,i=.2,r=1,a=!0,s=!1){let o=hm(n,i),d=er(n,i/2);Ke(e,ge(t),d);let l=a?r*Xe.scaleFactor:r;Ze(e,l),s&&!La.find(c=>c.element===e)&&cm(e,Qc,t,n,i,r,a)}function mm(e,t,n,i=.1,r=1){Ke(e,ge(t),Qi(n,i)),Ze(e,r)}function bm(e,t,n,i=0,r=0,a=1){Ke(e,ge(t,i),ge(n,r)),Ze(e,a)}function ym(e,t,n,i=.1,r=1){Ke(e,tr(t,i),ge(n)),Ze(e,r)}function vm(e,t,n,i=.1,r=1){Ke(e,nr(t,i),ge(n)),Ze(e,r)}function xm(e,t,n,i=.05,r=.05,a=1){Ke(e,tr(t,r),er(n,i)),Ze(e,a)}function wm(e,t,n,i=.05,r=.05,a=1){Ke(e,nr(t,r),er(n,i)),Ze(e,a)}function _m(e,t,n,i=.05,r=.05,a=1){Ke(e,tr(t,r),Qi(n,i)),Ze(e,a)}function Em(e,t,n,i=.05,r=.05,a=1){Ke(e,nr(t,r),Qi(n,i)),Ze(e,a)}function Ke(e,t,n){e&&e.position?typeof e.position.set=="function"?e.position.set(t,n):(e.position.x=t,e.position.y=n):e&&(e.x=t,e.y=n)}function Ze(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Ot={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 Sm(e){return e&&Ot[e]?JSON.parse(JSON.stringify(Ot[e])):JSON.parse(JSON.stringify(Wn))}function Gn(e){Object.keys(e).forEach(t=>{let n=t;Wn[n]&&e[n]&&Object.assign(Wn[n],e[n])}),console.log("Config applied:",e)}function Am(e,t){let n=e/t;n>1.6?(Gn(Ot.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Gn(Ot.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Gn(Ot.square),console.log("Applied SQUARE config for ratio:",n)):(Gn(Ot.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let e=window;e.configPresets=Ot,e.resolveAnchorVec2=e.resolveAnchorVec2||Ji,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Zc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||Jc}Oa();function G(e,t){let n=(r,a)=>a===0?r:n(a,r%a),i=n(e,t);return`${e/i}:${t/i}`}var N_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:G(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:G(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:G(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:G(360,780)}],H_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:G(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:G(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:G(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:G(412,915)}],$_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:G(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:G(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:G(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:G(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:G(800,1280)}],id=[{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:G(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:G(768,1024),mraidScale:.7}];var U_=[...id];var Im=id[0];pt();var y0=Ge(mh(),1);function g0(e){return new Promise((t,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>t(String(i.result||"")),i.readAsDataURL(e)})}function m0(e){var r;let[t,n]=e.split(","),i=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(r=i==null?void 0:i[1])!=null?r:"image/png"}}async function b0(e){return await new Promise(t=>{let n=new Image;n.onload=()=>t({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>t(null),n.src=e})}async function Eo(e){var t,n;try{console.log("[ImageUtils] Fetching image data from URL:",e);let i=await fetch(e);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,e),null;let r=await i.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await g0(r),s=await b0(a),o=m0(a);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(n=s==null?void 0:s.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Vr(e,t=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((f,p)=>{let u=new Image;u.onload=()=>f(u),u.onerror=()=>p(new Error("Failed to load image")),u.src=e}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let r=i.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(n,0,0);let a=r.getImageData(0,0,i.width,i.height),s=a.data,d=[{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(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let p=s[f],u=s[f+1],v=s[f+2],h=!1;for(let w of d)if(Math.sqrt(Math.pow(p-w.r,2)+Math.pow(u-w.g,2)+Math.pow(v-w.b,2))<t){h=!0;break}h&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),e}}var bh=require("@google/genai");async function So(e,t,n=[],i={}){var r,a,s,o,d,l,c;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let y=0;y<n.length;y++){let m=n[y];if(!m.base64||!m.mimeType)throw new Error(`Image ${y+1} is missing required data`);if(m.base64.length<1e3&&console.warn(`Image ${y+1} data appears very small, may be corrupted`),!m.mimeType.startsWith("image/"))throw new Error(`Image ${y+1} has invalid MIME type: ${m.mimeType}`)}let f=new bh.GoogleGenAI({apiKey:e}),p="gemini-2.5-flash",u=[t];n.length>0&&n.forEach((y,m)=>{u.push({inlineData:{data:y.base64,mimeType:y.mimeType}}),console.log(`[Gemini] Added image ${m+1}: ${y.mimeType}, size: ${Math.round(y.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:p,contents:u}),h="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let y of w)y.text&&(h+=y.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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."):(d=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var yh=require("@google/genai");async function Xr(e,t,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new yh.GoogleGenAI({apiKey:e}),a=[{text:t}];n.length>0&&n.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),a.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}var v0=require("pixi.js");qn();pt();var xh=require("pixi.js");var x0=require("pixi.js");pt();function T0(e){return new Promise((t,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>t(String(i.result||"")),i.readAsDataURL(e)})}function k0(e){var r;let[t,n]=e.split(","),i=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(r=i==null?void 0:i[1])!=null?r:"image/png"}}function L0(e){return`
|
|
47
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(s=>{s.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(s=>{s.addEventListener("click",o=>{let l=o.target.dataset.tab;l&&this.switchTab(l)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let r=this.modal.querySelector("[data-ai-edit]");r==null||r.addEventListener("click",()=>{this.openAiEditor("edit")});let a=this.modal.querySelector("[data-modal-apply]");a==null||a.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",s=>{s.target===this.modal&&this.close()})}switchTab(t){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab")===t)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(r=>{r.classList.toggle("active",r.getAttribute("data-tab-panel")===t)})}openAiEditor(t){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";t==="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:r=>{this.onApplyCallback&&this.onApplyCallback(r),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 V0={};hc(V0,{AspectClass:()=>$o,GameObject:()=>Di,GameObjectManager:()=>na,Renderer:()=>ji,ResponsiveUISystem:()=>zn,Transform:()=>Pi,animateHandClick:()=>Hh,animatePanelEntrance:()=>Nh,createBrushTexture:()=>Vh,createEndGamePanel:()=>Bh,createHandTutorial:()=>$h,createThreeBase:()=>Dh,createTutorialLabel:()=>Uh,getAspectClass:()=>ta,getRegisteredFontIds:()=>Fh,loadAsset:()=>Go,loadCharacterFrames:()=>Yh,registerFont:()=>zh,resolveFont:()=>Fe,resolveFontWeight:()=>Be,updateHandAnimation:()=>qh});module.exports=Hg(V0);var Te=Ge(require("three"),1);var dt={};function qi(e,t,n=!1){dt[e]||(dt[e]=[]),dt[e].push({fn:t,once:n})}function ga(e,t){if(dt[e]){if(!t){delete dt[e];return}dt[e]=dt[e].filter(n=>n.fn!==t)}}function Gi(e,...t){let n=dt[e];if(n)for(let i of[...n])i.fn(...t),i.once&&ga(e,i.fn)}function fe(e,t){qi(e,t,!0)}var q=null,we=[],Zt=null;function yc(e){q=e,we=[],Zt!==null&&(clearTimeout(Zt),Zt=null)}function vc(){var e,t,n;return{endpoint:(q==null?void 0:q.endpoint)||"",transport:(q==null?void 0:q.transport)||"beacon",batchSize:(e=q==null?void 0:q.batchSize)!=null?e:10,flushIntervalMs:(t=q==null?void 0:q.flushIntervalMs)!=null?t:300,maxQueue:(n=q==null?void 0:q.maxQueue)!=null?n:200,debug:!!(q!=null&&q.debug)}}async function mc(e,t,n,i){let r=JSON.stringify(t);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let a=navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",a,t);return}catch(a){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",a)}try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",t)}catch(a){i&&console.warn("[handler.telemetry] fetch failed",a)}}function ma(e,t){let n=vc();if(t&&n.endpoint){if(we.push(e),we.length>n.maxQueue&&(we=we.slice(we.length-n.maxQueue)),we.length>=n.batchSize){bc();return}Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,bc()},n.flushIntervalMs))}}async function bc(){let e=vc();if(!e.endpoint||we.length===0)return;let t=we.splice(0,e.batchSize);await mc(e.endpoint,{events:t},e.transport,e.debug),we.length>0&&await mc(e.endpoint,{events:we.splice(0,e.batchSize)},e.transport,e.debug)}function xc(e){return Math.max(0,Math.min(1,e))}function $g(e){let t=String(e!=null?e:"power2.out");if(t==="linear")return n=>n;if(t==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(t==="power2.out"||t==="easeOutQuad")return n=>1-(1-n)*(1-n);if(t.startsWith("back.out")){let n=t.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return r=>1+(i+1)*Math.pow(r-1,3)+i*Math.pow(r-1,2)}return n=>1-(1-n)*(1-n)}function Hn(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Ug(e,t){let n=e==null?void 0:e[t];return typeof n=="number"?n:0}function wc(e,t,n){try{e[t]=n}catch{}}function qg(e){let t=e==null?void 0:e.scale;if(!t)return null;let n=typeof t.x=="number"?t.x:1,i=typeof t.y=="number"?t.y:1;return{x:n,y:i}}function _c(e,t){let n=e==null?void 0:e.scale;if(n)try{typeof n.set=="function"?n.set(t.x,t.y):(typeof n.x=="number"&&(n.x=t.x),typeof n.y=="number"&&(n.y=t.y))}catch{}}function Ec(e,t){let n=qg(e);if(!n)return{from:null,to:null};let i=null,r=null;return typeof t.scale=="number"?(i=t.scale,r=t.scale):t.scale&&typeof t.scale=="object"&&(typeof t.scale.x=="number"&&(i=t.scale.x),typeof t.scale.y=="number"&&(r=t.scale.y)),typeof t.scaleX=="number"&&(i=t.scaleX),typeof t.scaleY=="number"&&(r=t.scaleY),i===null&&r===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:r!=null?r:n.y}}}function Sc(){let e=new Set,t=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),e.size>0&&i()})},r=c=>{var p;e.add(c);let f=(p=t.get(c.target))!=null?p:new Set;f.add(c),t.set(c.target,f),i()},a=c=>{e.delete(c);let f=t.get(c.target);f&&(f.delete(c),f.size===0&&t.delete(c.target))},s=c=>{c.killed||(c.killed=!0,a(c))},o=()=>{var f,p;let c=Hn();for(let u of Array.from(e)){if(u.killed||u.paused)continue;let v=c-u.startMs-u.delayMs;if(v<0)continue;let h=u.durationMs>0?v/u.durationMs:1,w=xc(h),y=u.repeat>=0?u.repeat+1:1,m=u.repeat>0?Math.min(Math.floor(h),y-1):0;if(u.repeat>0&&h>=1){let x=h-m;w=xc(x)}let b=u.ease(w);u.yoyo&&m%2===1&&(b=1-b);for(let x of u.props)wc(u.target,x.key,x.from+(x.to-x.from)*b);u.scaleFrom&&u.scaleTo&&_c(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*b,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*b});try{(f=u.onUpdate)==null||f.call(u)}catch{}if(h>=y){s(u);try{(p=u.onComplete)==null||p.call(u)}catch{}}}},d=(c,f,p)=>{var x;let u=Math.max(0,(typeof f.duration=="number"?f.duration:.5)*1e3),v=Math.max(0,(typeof f.delay=="number"?f.delay:0)*1e3+((x=p==null?void 0:p.delayMsOverride)!=null?x:0)),h=$g(f.ease),w=typeof f.repeat=="number"?Math.max(0,f.repeat|0):0,y=f.yoyo===!0,m=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),b=[];for(let E of Object.keys(f)){if(m.has(E))continue;let A=f[E];typeof A=="number"&&b.push({key:E,from:Ug(c,E),to:A})}let g=Ec(c,f);return{target:c,startMs:Hn(),delayMs:v,durationMs:u,ease:h,props:b,scaleFrom:g.from,scaleTo:g.to,repeat:w,yoyo:y,onUpdate:typeof f.onUpdate=="function"?f.onUpdate:void 0,onComplete:typeof f.onComplete=="function"?f.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},l={to(c,f){let p=d(c,f);return r(p),{kill:()=>s(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Hn())},resume:()=>{var h;if(!p.paused)return;let u=(h=p.pauseAtMs)!=null?h:Hn(),v=Hn()-u;p.startMs+=v,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(c,f,p){return l.set(c,f),l.to(c,p)},set(c,f){if(!c||!f)return;for(let u of Object.keys(f)){let v=f[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof v=="number"&&wc(c,u,v)}let p=Ec(c,f);p.to&&_c(c,p.to)},killTweensOf(c){let f=t.get(c);if(f)for(let p of Array.from(f))s(p)},timeline(c={}){let f=[],p=0,u=!1,v=[],h=m=>{if(typeof m=="number")return Math.max(0,m*1e3);let b=typeof m=="string"?m.trim():"";return b.startsWith("+=")?p+Math.max(0,Number(b.slice(2))*1e3||0):b?Math.max(0,Number(b)*1e3||0):p},w=m=>{f.push(m);let b=Math.max(0,(typeof m.vars.duration=="number"?m.vars.duration:.5)*1e3);p=Math.max(p,m.atMs+b)},y={to(m,b,g){return w({kind:"to",target:m,vars:b,atMs:h(g)}),y},fromTo(m,b,g,x){return w({kind:"fromTo",target:m,vars:g,from:b,atMs:h(x)}),y},play(){var m,b;if(u)return y;u=!0,v=[];for(let g of f)g.kind==="fromTo"&&l.set(g.target,(m=g.from)!=null?m:{}),v.push(l.to(g.target,{...g.vars,delay:g.atMs/1e3+((b=g.vars.delay)!=null?b:0)}));return y},pause(){for(let m of v)m.pause();return y},kill(){for(let m of v)m.kill();v=[],u=!1}};return c.paused||y.play(),y}};return l}function Ac(){if(typeof window=="undefined")return;let e=window;if(!e.gsap)try{e.gsap=Sc()}catch{}}var Cc={name:"handler-playable-sdk",version:"0.3.33",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 && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",sharp:"^0.34.5"}};var he=0,Wg=he++,Tc=he++,kc=he++,Lc=he++,Rc=he++,Mc=he++,Oc=he++,Ic=he++,Pc=he++,jc=he++,Dc=he++,zc=he++,N=Wg;function Fc(){return N===Tc}function Bc(){return N===kc}function Nc(){return N===Lc}function Hc(){return N===Rc}function Jt(){return N===Mc}function Qt(){return N===Oc}function $c(){return N===Ic}function Uc(){return N===Pc}function qc(){return N===jc}function ba(){return N===Dc}function ya(){return N===zc}function Gc(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),N=Tc;return}catch{}else if(e==="dapi")try{dapi.isReady(),N=kc;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=Lc)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(N=Rc)}catch{}else if(t==="mintegral")window.gameReady&&(N=Mc);else if(t==="tapjoy")window.TJ_API&&(N=Oc);else if(t==="tiktok")window.openAppStore&&(N=Ic);else if(t==="smadex")try{window.smxTracking&&(N=Pc)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(N=jc)}catch{}else t==="vungle"?N=Dc:(e==="nucleo"||t==="nucleo")&&(N=zc)}var Wi=Ge(require("lottie-web"),1),Wc=Wi.default;typeof window!="undefined"&&(window.lottie=Wi.default,window.__baseLottie=Wi.default);var Yg=require("pixi.js");var va=require("pixi.js");var Vg=null;function xa(e){Vg=e}Yi();wa();var $n=require("pixi.js");Yi();var em=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Aa=em;if(typeof window!="undefined")try{let e=new XMLHttpRequest;if(e.open("GET","./build-settings.json",!1),e.send(),e.status===200&&e.responseText){let t=JSON.parse(e.responseText);t!=null&&t.buildMode&&(Aa=t.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Aa}`))}}catch{}var Mt=class{static async create(t,n,i){var d,l,c,f,p,u,v;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${Aa}`);let r=(d=n==null?void 0:n.render)==null?void 0:d.asset;if(!r){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let h=new $n.Container;return this.applyTransform(h,n==null?void 0:n.transform),h}let a=(l=n==null?void 0:n.identity)==null?void 0:l.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, configId: ${a}, type: ${r.type}, path: ${r.path}`);let s=await Rt.load(t,r,i,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(c=s==null?void 0:s.constructor)==null?void 0:c.name}`);let o;if(r.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",t),o=new $n.Sprite(s),console.log("[ObjectFactory] Created object:",o,"type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name),this.applyTransform(o,n==null?void 0:n.transform);else if(r.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name,s),s&&(((u=s.constructor)==null?void 0:u.name)==="Container"||s instanceof $n.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[r.path,`/assets/${r.path}`,`assets/${r.path}`,`../assets/${r.path}`],w=!1;for(let y of h)try{let m=await fetch(y);if(m.ok){o=await m.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",y,"type:",(v=o==null?void 0:o.constructor)==null?void 0:v.name),w=!0;break}}catch{continue}w||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=s)}else o=s;else o=s,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform);return o}static applyTransform(t,n){var i,r,a,s;!n||!t||(n.position&&("x"in t&&"y"in t?(t.x=(i=n.position.x)!=null?i:0,t.y=(r=n.position.y)!=null?r:0):"position"in t&&t.position&&t.position.set((a=n.position.x)!=null?a:0,(s=n.position.y)!=null?s:0)),n.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(n.scale):t.scale=n.scale),n.rotation!==void 0&&"rotation"in t&&(t.rotation=n.rotation),n.anchor&&"anchor"in t&&t.anchor&&Array.isArray(n.anchor)&&("set"in t.anchor?t.anchor.set(n.anchor[0],n.anchor[1]):(t.anchor.x=n.anchor[0],t.anchor.y=n.anchor[1])))}};var Un=class{constructor(){this.config=null}init(t){this.config=t}get(t){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(t)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(t){return this.config?this.config.objects.has(t):!1}};var im=Ge(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=im);qn();var Xi=require("pixi.js");qn();var Ta=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Un}init(t,n){this.registry.init(t),this.app=n}updateConfig(t){this.registry.init(t),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));if(n.length===0)return;let i=async r=>{r.length&&(console.log("[Assets] Loading objects:",r),await Promise.all(r.map(async a=>{var o;let s=this.registry.get(a);if(!s){console.warn("[Assets] No config found for object:",a);return}try{let d=await Mt.create(a,s,this.app);this.instanceCache.set(a,d),console.log("[Assets] Loaded object:",a,(o=d==null?void 0:d.constructor)==null?void 0:o.name)}catch(d){console.error("[Assets] Failed to load object:",a,d)}})))};return this.readyPromise=(async()=>{await i(n);let r=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));r.length>0&&(console.warn("[Assets] Retrying missing assets:",r),await i(r)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(t){let n=this.registry.get(t);if(n){let i=await Mt.create(t,n,this.app);this.instanceCache.set(t,i)}}get(t){return this.instanceCache.get(t)}},am=new Ta,sm=new Proxy(am,{get(e,t){if(t in e&&typeof e[t]=="function")return e[t].bind(e);if(e.get(t))return e.get(t)}});qn();var Kc=require("pixi.js"),Xe={width:400,height:600,designWidth:400,scaleFactor:1},Zi={scale:1,position:1},La=[];function cm(e,t,n,i,r,a,s){La.push({element:e,originalScale:a,positionHelper:t,heightPercent:r}),t(e,n,i,r,a,s,!1)}function dm(){La.forEach(({element:e,originalScale:t,positionHelper:n,heightPercent:i})=>{let r=t*Xe.scaleFactor;n(e,Xe.width,Xe.height,i,r,!0,!1)})}function ka(e,t){console.log(`[SCREEN] updateScreenState called: ${e}x${t}`),Xe.width=e,Xe.height=t,Xe.scaleFactor=Math.min(e/Xe.designWidth,1.15),Zi.scale=Xe.scaleFactor,Zi.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Zi.scale.toFixed(3)}`),dm()}var Wn={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 um(e,t,n){let i=Wn[e];i&&i[t]!==void 0&&(i[t]=n,console.log(`Updated ${e}.${t} = ${n}`))}function pm(){return Wn}var fm={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 Ki(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Ji(e,t={x:.5,y:.5}){var n;if(Array.isArray(e))return{x:Ki(e[0],t.x),y:Ki(e[1],t.y)};if(e&&typeof e=="object"){let i=e;return{x:Ki(i.x,t.x),y:Ki(i.y,t.y)}}if(typeof e=="string"){let i=e.trim().toLowerCase();return(n=fm[i])!=null?n:t}return t}function Zc(e,t,n,i={}){var u,v,h,w,y,m;let r=Ji(n),a=(u=i.inset)!=null?u:{},s=(v=i.padding)!=null?v:{x:0,y:0},o=((h=a.left)!=null?h:0)+s.x,d=((w=a.right)!=null?w:0)+s.x,l=((y=a.top)!=null?y:0)+s.y,c=((m=a.bottom)!=null?m:0)+s.y,f=Math.max(0,e-o-d),p=Math.max(0,t-l-c);return{x:o+f*r.x,y:l+p*r.y}}function Jc(e,t,n,i={}){var h,w,y,m,b,g;let r=(h=i.inset)!=null?h:{},a=(w=i.padding)!=null?w:{x:0,y:0},s=((y=r.left)!=null?y:0)+a.x,o=((m=r.right)!=null?m:0)+a.x,d=((b=r.top)!=null?b:0)+a.y,l=((g=r.bottom)!=null?g:0)+a.y,c=Math.max(0,e-s-o),f=Math.max(0,t-d-l),p=Ji(n,{x:.5,y:.5}),u=Math.min(Math.max(p.x,0),1),v=Math.min(Math.max(p.y,0),1);return{x:s+c*u,y:d+f*v}}if(typeof window!="undefined"){let e=window.innerWidth,t=window.innerHeight,n=()=>{let i=window.innerWidth,r=window.innerHeight;(i!==e||r!==t)&&(e=i,t=r,ka(i,r))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),ka(window.innerWidth,window.innerHeight),window.updateDebugConfig=um,window.getDebugConfig=pm,window.copyConfig=Sm,window.applyConfig=Gn,window.applyConfigForRatio=Am,window.positionAtBottom=Qc,window.positionAtTop=mm,window.positionAtCenter=bm,window.positionAtLeft=ym,window.positionAtRight=vm,window.positionAtBottomLeft=xm,window.positionAtBottomRight=wm,window.positionAtTopLeft=_m,window.positionAtTopRight=Em,window.applyPositionContract=gm,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 Qi(e,t,n=0){return e*t+n}function er(e,t,n=0){return e*(1-t)+n}function tr(e,t,n=0){return e*t+n}function nr(e,t,n=0){return e*(1-t)+n}function ge(e,t=0){return e/2+t}function hm(e,t){return e*t}function gm(e,t,n,i){var s,o,d,l,c,f,p,u,v,h,w,y,m,b,g,x,E,A,C,T;let r=0,a=0;switch(i.type){case"top":r=ge(t,(o=(s=i.offset)==null?void 0:s.x)!=null?o:0),a=Qi(n,i.percent,(l=(d=i.offset)==null?void 0:d.y)!=null?l:0);break;case"bottom":r=ge(t,(f=(c=i.offset)==null?void 0:c.x)!=null?f:0),a=er(n,i.percent,(u=(p=i.offset)==null?void 0:p.y)!=null?u:0);break;case"left":r=tr(t,i.percent,(h=(v=i.offset)==null?void 0:v.x)!=null?h:0),a=ge(n,(y=(w=i.offset)==null?void 0:w.y)!=null?y:0);break;case"right":r=nr(t,i.percent,(b=(m=i.offset)==null?void 0:m.x)!=null?b:0),a=ge(n,(x=(g=i.offset)==null?void 0:g.y)!=null?x:0);break;case"center":r=ge(t,(A=(E=i.offset)==null?void 0:E.x)!=null?A:0),a=ge(n,(T=(C=i.offset)==null?void 0:C.y)!=null?T:0);break}e.position?e.position.set(r,a):(e.x=r,e.y=a),i.scale!==void 0&&i.scale!==1&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(i.scale,i.scale):(e.scale.x=i.scale,e.scale.y=i.scale))}function Qc(e,t,n,i=.2,r=1,a=!0,s=!1){let o=hm(n,i),d=er(n,i/2);Ke(e,ge(t),d);let l=a?r*Xe.scaleFactor:r;Ze(e,l),s&&!La.find(c=>c.element===e)&&cm(e,Qc,t,n,i,r,a)}function mm(e,t,n,i=.1,r=1){Ke(e,ge(t),Qi(n,i)),Ze(e,r)}function bm(e,t,n,i=0,r=0,a=1){Ke(e,ge(t,i),ge(n,r)),Ze(e,a)}function ym(e,t,n,i=.1,r=1){Ke(e,tr(t,i),ge(n)),Ze(e,r)}function vm(e,t,n,i=.1,r=1){Ke(e,nr(t,i),ge(n)),Ze(e,r)}function xm(e,t,n,i=.05,r=.05,a=1){Ke(e,tr(t,r),er(n,i)),Ze(e,a)}function wm(e,t,n,i=.05,r=.05,a=1){Ke(e,nr(t,r),er(n,i)),Ze(e,a)}function _m(e,t,n,i=.05,r=.05,a=1){Ke(e,tr(t,r),Qi(n,i)),Ze(e,a)}function Em(e,t,n,i=.05,r=.05,a=1){Ke(e,nr(t,r),Qi(n,i)),Ze(e,a)}function Ke(e,t,n){e&&e.position?typeof e.position.set=="function"?e.position.set(t,n):(e.position.x=t,e.position.y=n):e&&(e.x=t,e.y=n)}function Ze(e,t){t!==1&&e&&e.scale&&(typeof e.scale.set=="function"?e.scale.set(t,t):e.scale.x!==void 0&&e.scale.y!==void 0&&(e.scale.x=t,e.scale.y=t))}var Ot={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 Sm(e){return e&&Ot[e]?JSON.parse(JSON.stringify(Ot[e])):JSON.parse(JSON.stringify(Wn))}function Gn(e){Object.keys(e).forEach(t=>{let n=t;Wn[n]&&e[n]&&Object.assign(Wn[n],e[n])}),console.log("Config applied:",e)}function Am(e,t){let n=e/t;n>1.6?(Gn(Ot.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Gn(Ot.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Gn(Ot.square),console.log("Applied SQUARE config for ratio:",n)):(Gn(Ot.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let e=window;e.configPresets=Ot,e.resolveAnchorVec2=e.resolveAnchorVec2||Ji,e.resolveScreenAnchorPoint=e.resolveScreenAnchorPoint||Zc,e.resolveScreenRatioPoint=e.resolveScreenRatioPoint||Jc}Oa();function G(e,t){let n=(r,a)=>a===0?r:n(a,r%a),i=n(e,t);return`${e/i}:${t/i}`}var N_=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:G(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:G(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:G(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:G(360,780)}],H_=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:G(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:G(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:G(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:G(412,915)}],$_=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:G(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:G(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:G(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:G(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:G(800,1280)}],id=[{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:G(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:G(768,1024),mraidScale:.7}];var U_=[...id];var Im=id[0];pt();var y0=Ge(mh(),1);function g0(e){return new Promise((t,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>t(String(i.result||"")),i.readAsDataURL(e)})}function m0(e){var r;let[t,n]=e.split(","),i=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(r=i==null?void 0:i[1])!=null?r:"image/png"}}async function b0(e){return await new Promise(t=>{let n=new Image;n.onload=()=>t({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>t(null),n.src=e})}async function Eo(e){var t,n;try{console.log("[ImageUtils] Fetching image data from URL:",e);let i=await fetch(e);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,e),null;let r=await i.blob();console.log("[ImageUtils] Blob received, size:",r.size,"type:",r.type);let a=await g0(r),s=await b0(a),o=m0(a);return console.log("[ImageUtils] Success resolution:",s==null?void 0:s.width,"x",s==null?void 0:s.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:a,width:(t=s==null?void 0:s.width)!=null?t:0,height:(n=s==null?void 0:s.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Vr(e,t=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((f,p)=>{let u=new Image;u.onload=()=>f(u),u.onerror=()=>p(new Error("Failed to load image")),u.src=e}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let r=i.getContext("2d");if(!r)return console.error("[ImageUtils] Failed to get canvas context"),e;r.drawImage(n,0,0);let a=r.getImageData(0,0,i.width,i.height),s=a.data,d=[{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(f=>({r:s[f.offset],g:s[f.offset+1],b:s[f.offset+2]})),l=0;for(let f=0;f<s.length;f+=4){let p=s[f],u=s[f+1],v=s[f+2],h=!1;for(let w of d)if(Math.sqrt(Math.pow(p-w.r,2)+Math.pow(u-w.g,2)+Math.pow(v-w.b,2))<t){h=!0;break}h&&(s[f+3]=0,l++)}return console.log(`[ImageUtils] Removed background from ${l} pixels (4-corner sampling, tolerance: ${t})`),r.putImageData(a,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),e}}var bh=require("@google/genai");async function So(e,t,n=[],i={}){var r,a,s,o,d,l,c;try{if(!(e!=null&&e.trim()))throw new Error("Gemini API key is required");if(!(t!=null&&t.trim()))throw new Error("Prompt is required");for(let y=0;y<n.length;y++){let m=n[y];if(!m.base64||!m.mimeType)throw new Error(`Image ${y+1} is missing required data`);if(m.base64.length<1e3&&console.warn(`Image ${y+1} data appears very small, may be corrupted`),!m.mimeType.startsWith("image/"))throw new Error(`Image ${y+1} has invalid MIME type: ${m.mimeType}`)}let f=new bh.GoogleGenAI({apiKey:e}),p="gemini-2.5-flash",u=[t];n.length>0&&n.forEach((y,m)=>{u.push({inlineData:{data:y.base64,mimeType:y.mimeType}}),console.log(`[Gemini] Added image ${m+1}: ${y.mimeType}, size: ${Math.round(y.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${t.length}`);let v=await f.models.generateContent({model:p,contents:u}),h="",w=(s=(a=(r=v.candidates)==null?void 0:r[0])==null?void 0:a.content)==null?void 0:s.parts;if(w)for(let y of w)y.text&&(h+=y.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(f){throw console.error("[Gemini] API error:",f),(o=f.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."):(d=f.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(l=f.message)!=null&&l.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(c=f.message)!=null&&c.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):f}}var yh=require("@google/genai");async function Xr(e,t,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let r=new yh.GoogleGenAI({apiKey:e}),a=[{text:t}];n.length>0&&n.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),a.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let s=await r.models.generateContent({model:"gemini-2.5-flash-image",contents:a});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!s.candidates||!s.candidates[0]||!s.candidates[0].content||!s.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of s.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,l=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${l};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(r){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(r,Object.getOwnPropertyNames(r),2)),r}}var v0=require("pixi.js");qn();pt();var xh=require("pixi.js");var x0=require("pixi.js");pt();function T0(e){return new Promise((t,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>t(String(i.result||"")),i.readAsDataURL(e)})}function k0(e){var r;let[t,n]=e.split(","),i=t==null?void 0:t.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(r=i==null?void 0:i[1])!=null?r:"image/png"}}function L0(e){return`
|
|
48
48
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
49
49
|
|
|
50
50
|
Provide a concise summary (2-3 sentences) covering:
|