handler-playable-sdk 0.4.2 → 0.4.32

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/index.cjs CHANGED
@@ -43,7 +43,7 @@
43
43
  <button class="debug-btn primary" data-modal-apply>Apply</button>
44
44
  </div>
45
45
  </div>
46
- `,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var pl={};ft(pl,{COLORS:()=>ce,ConfigWatcher:()=>ze,DebugPanel:()=>Ot,DefaultReloadStrategy:()=>St,Handler:()=>ie,PlayableLoadingScreen:()=>Ui,PreviewShell:()=>Ni,STROKE_WIDTH:()=>mo,THEME:()=>bo,applyConfigOverride:()=>Se,applyConfigOverrides:()=>Ce,applyConfigsToDisk:()=>ri,applyDefaults:()=>$e,baseLottie:()=>rn,bootstrap:()=>el,clearConfigOverrides:()=>se,clearConfigOverridesForObject:()=>xr,configOverrideManager:()=>wr,createPreviewShell:()=>pa,deepClone:()=>G,default:()=>Oe,defaultPreset:()=>ui,deviceGroups:()=>Mn,devicePresets:()=>Pn,diffConfigs:()=>Sn,exportConfigsAsJSON:()=>De,getConfigOverrides:()=>Y,getConfigStateSummary:()=>ai,getOverrideMode:()=>wt,getPresetById:()=>He,getPresetsByCategory:()=>Os,loadAllObjectConfigs:()=>li,loadComponentSchemas:()=>si,loadEngineConfig:()=>ci,loadGamePromptConfig:()=>wn,loadObjectCentricConfig:()=>be,loadObjectConfig:()=>Te,loadSceneConfig:()=>di,rehydrateObject:()=>Cn,removeConfigOverride:()=>ni,resetToApplied:()=>Et,resetToOriginal:()=>oi,setBootstrapDependencies:()=>Zs,setOverrideMode:()=>yn,setupHotReload:()=>kn,setupLiveEditBridge:()=>Bi,toLegacyFormat:()=>En,validateObjectConfig:()=>Ze});module.exports=zo(pl);var we={};function Ut(n,e,t=!1){we[n]||(we[n]=[]),we[n].push({fn:e,once:t})}function en(n,e){if(we[n]){if(!e){delete we[n];return}we[n]=we[n].filter(t=>t.fn!==e)}}function Gt(n,...e){let t=we[n];if(t)for(let i of[...t])i.fn(...e),i.once&&en(n,i.fn)}function X(n,e){Ut(n,e,!0)}var F=null,ee=[],We=null;function Pa(n){F=n,ee=[],We!==null&&(clearTimeout(We),We=null)}function Ma(){var n,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(n=F==null?void 0:F.batchSize)!=null?n:10,flushIntervalMs:(e=F==null?void 0:F.flushIntervalMs)!=null?e:300,maxQueue:(t=F==null?void 0:F.maxQueue)!=null?t:200,debug:!!(F!=null&&F.debug)}}async function ka(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function tn(n,e){let t=Ma();if(e&&t.endpoint){if(ee.push(n),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){_a();return}We===null&&(We=window.setTimeout(()=>{We=null,_a()},t.flushIntervalMs))}}async function _a(){let n=Ma();if(!n.endpoint||ee.length===0)return;let e=ee.splice(0,n.batchSize);await ka(n.endpoint,{events:e},n.transport,n.debug),ee.length>0&&await ka(n.endpoint,{events:ee.splice(0,n.batchSize)},n.transport,n.debug)}function Oa(n){return Math.max(0,Math.min(1,n))}function Ho(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ht(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function No(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function Ia(n,e,t){try{n[e]=t}catch{}}function Bo(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ja(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function Ra(n,e){let t=Bo(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function Da(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),n.size>0&&i()})},a=d=>{var u;n.add(d);let p=(u=e.get(d.target))!=null?u:new Set;p.add(d),e.set(d.target,p),i()},r=d=>{n.delete(d);let p=e.get(d.target);p&&(p.delete(d),p.size===0&&e.delete(d.target))},o=d=>{d.killed||(d.killed=!0,r(d))},s=()=>{var p,u;let d=ht();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=d-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,h=Oa(f),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let w=f-y;h=Oa(w)}let v=g.ease(h);g.yoyo&&y%2===1&&(v=1-v);for(let w of g.props)Ia(g.target,w.key,w.from+(w.to-w.from)*v);g.scaleFrom&&g.scaleTo&&ja(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(p=g.onUpdate)==null||p.call(g)}catch{}if(f>=b){o(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(d,p,u)=>{var w;let g=Math.max(0,(typeof p.duration=="number"?p.duration:.5)*1e3),m=Math.max(0,(typeof p.delay=="number"?p.delay:0)*1e3+((w=u==null?void 0:u.delayMsOverride)!=null?w:0)),f=Ho(p.ease),h=typeof p.repeat=="number"?Math.max(0,p.repeat|0):0,b=p.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(p)){if(y.has(E))continue;let C=p[E];typeof C=="number"&&v.push({key:E,from:No(d,E),to:C})}let x=Ra(d,p);return{target:d,startMs:ht(),delayMs:m,durationMs:g,ease:f,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:h,yoyo:b,onUpdate:typeof p.onUpdate=="function"?p.onUpdate:void 0,onComplete:typeof p.onComplete=="function"?p.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,p){let u=l(d,p);return a(u),{kill:()=>o(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=ht())},resume:()=>{var f;if(!u.paused)return;let g=(f=u.pauseAtMs)!=null?f:ht(),m=ht()-g;u.startMs+=m,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(d,p,u){return c.set(d,p),c.to(d,u)},set(d,p){if(!d||!p)return;for(let g of Object.keys(p)){let m=p[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Ia(d,g,m)}let u=Ra(d,p);u.to&&ja(d,u.to)},killTweensOf(d){let p=e.get(d);if(p)for(let u of Array.from(p))o(u)},timeline(d={}){let p=[],u=0,g=!1,m=[],f=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?u+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):u},h=y=>{p.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+v)},b={to(y,v,x){return h({kind:"to",target:y,vars:v,atMs:f(x)}),b},fromTo(y,v,x,w){return h({kind:"fromTo",target:y,vars:x,from:v,atMs:f(w)}),b},play(){var y,v;if(g)return b;g=!0,m=[];for(let x of p)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),m.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 m)y.pause();return b},kill(){for(let y of m)y.kill();m=[],g=!1}};return d.paused||b.play(),b}};return c}function $a(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=Da()}catch{}}var za={name:"handler-playable-sdk",version:"0.4.2",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",jszip:"^3.10.1",sharp:"^0.34.5"}};var J=0,Uo=J++,Ha=J++,Na=J++,Ba=J++,Fa=J++,Ua=J++,Ga=J++,qa=J++,Va=J++,Wa=J++,Ya=J++,Ka=J++,N=Uo;function Xa(){return N===Ha}function Ja(){return N===Na}function Za(){return N===Ba}function Qa(){return N===Fa}function Ye(){return N===Ua}function Ke(){return N===Ga}function er(){return N===qa}function tr(){return N===Va}function ir(){return N===Wa}function nn(){return N===Ya}function an(){return N===Ka}function nr(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),N=Ha;return}catch{}else if(n==="dapi")try{dapi.isReady(),N=Na;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=Ba)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(N=Fa)}catch{}else if(e==="mintegral")window.gameReady&&(N=Ua);else if(e==="tapjoy")window.TJ_API&&(N=Ga);else if(e==="tiktok")window.openAppStore&&(N=qa);else if(e==="smadex")try{window.smxTracking&&(N=Va)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(N=Wa)}catch{}else e==="vungle"?N=Ya:(n==="nucleo"||e==="nucleo")&&(N=Ka)}var qt=Ve(require("lottie-web"),1),rn=qt.default;typeof window!="undefined"&&(window.lottie=qt.default,window.__baseLottie=qt.default);var Go=require("pixi.js");var on=require("pixi.js");var qo=null;function sn(n){qo=n}Vt();ln();var mt=require("pixi.js");Vt();var Jo=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",un=Jo;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(un=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${un}`))}}catch{}function Zo(n){var t,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(n);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(n))return{x:(t=n[0])!=null?t:.5,y:(i=n[1])!=null?i:.5};if(n&&typeof n=="object"&&"x"in n&&"y"in n)return{x:(a=n.x)!=null?a:.5,y:(r=n.y)!=null?r:.5};if(typeof n=="string"){let s=n.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,t,i){var l,c,d,p,u,g,m;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${un}`);let a=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let f=new mt.Container;return this.applyTransform(f,t==null?void 0:t.transform,t),f}let r=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await je.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(d=o==null?void 0:o.constructor)==null?void 0:d.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new mt.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name),this.applyTransform(s,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name,o),o&&(((g=o.constructor)==null?void 0:g.name)==="Container"||o instanceof mt.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let f=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],h=!1;for(let b of f)try{let y=await fetch(b);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=s==null?void 0:s.constructor)==null?void 0:m.name),h=!0;break}}catch{continue}h||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,t==null?void 0:t.transform,t);return s}static applyTransform(e,t,i){var a,r,o,s;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(r=t.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=t.position.x)!=null?o:0,(s=t.position.y)!=null?s:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=Zo(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var bt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var ts=Ve(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=ts);Xe();var Wt=require("pixi.js");Xe();var hn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new bt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(t.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(t);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let i=await Ae.create(e,t,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},is=new hn,ns=new Proxy(is,{get(n,e){if(e in n&&typeof n[e]=="function")return n[e].bind(n);if(n.get(e))return n.get(e)}});Xe();var cr=require("pixi.js"),fe={width:400,height:600,designWidth:400,scaleFactor:1},Kt={scale:1,position:1},bn=[];function rs(n,e,t,i,a,r,o){bn.push({element:n,originalScale:r,positionHelper:e,heightPercent:a}),e(n,t,i,a,r,o,!1)}function os(){bn.forEach(({element:n,originalScale:e,positionHelper:t,heightPercent:i})=>{let a=e*fe.scaleFactor;t(n,fe.width,fe.height,i,a,!0,!1)})}function mn(n,e){console.log(`[SCREEN] updateScreenState called: ${n}x${e}`),fe.width=n,fe.height=e,fe.scaleFactor=Math.min(n/fe.designWidth,1.15),Kt.scale=fe.scaleFactor,Kt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Kt.scale.toFixed(3)}`),os()}var vt={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 ss(n,e,t){let i=vt[n];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${n}.${e} = ${t}`))}function ls(){return vt}var cs={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 Yt(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Xt(n,e={x:.5,y:.5}){var t;if(Array.isArray(n))return{x:Yt(n[0],e.x),y:Yt(n[1],e.y)};if(n&&typeof n=="object"){let i=n;return{x:Yt(i.x,e.x),y:Yt(i.y,e.y)}}if(typeof n=="string"){let i=n.trim().toLowerCase();return(t=cs[i])!=null?t:e}return e}function dr(n,e,t,i={}){var g,m,f,h,b,y;let a=Xt(t),r=(g=i.inset)!=null?g:{},o=(m=i.padding)!=null?m:{x:0,y:0},s=((f=r.left)!=null?f:0)+o.x,l=((h=r.right)!=null?h:0)+o.x,c=((b=r.top)!=null?b:0)+o.y,d=((y=r.bottom)!=null?y:0)+o.y,p=Math.max(0,n-s-l),u=Math.max(0,e-c-d);return{x:s+p*a.x,y:c+u*a.y}}function pr(n,e,t,i={}){var f,h,b,y,v,x;let a=(f=i.inset)!=null?f:{},r=(h=i.padding)!=null?h:{x:0,y:0},o=((b=a.left)!=null?b:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((v=a.top)!=null?v:0)+r.y,c=((x=a.bottom)!=null?x:0)+r.y,d=Math.max(0,n-o-s),p=Math.max(0,e-l-c),u=Xt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),m=Math.min(Math.max(u.y,0),1);return{x:o+d*g,y:l+p*m}}if(typeof window!="undefined"){let n=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==n||a!==e)&&(n=i,e=a,mn(i,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),mn(window.innerWidth,window.innerHeight),window.updateDebugConfig=ss,window.getDebugConfig=ls,window.copyConfig=xs,window.applyConfig=yt,window.applyConfigForRatio=ws,window.positionAtBottom=ur,window.positionAtTop=us,window.positionAtCenter=gs,window.positionAtLeft=fs,window.positionAtRight=hs,window.positionAtBottomLeft=ms,window.positionAtBottomRight=bs,window.positionAtTopLeft=ys,window.positionAtTopRight=vs,window.applyPositionContract=ps,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 Jt(n,e,t=0){return n*e+t}function Zt(n,e,t=0){return n*(1-e)+t}function Qt(n,e,t=0){return n*e+t}function ei(n,e,t=0){return n*(1-e)+t}function Z(n,e=0){return n/2+e}function ds(n,e){return n*e}function ps(n,e,t,i){var o,s,l,c,d,p,u,g,m,f,h,b,y,v,x,w,E,C,A,M;let a=0,r=0;switch(i.type){case"top":a=Z(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Jt(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=Z(e,(p=(d=i.offset)==null?void 0:d.x)!=null?p:0),r=Zt(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Qt(e,i.percent,(f=(m=i.offset)==null?void 0:m.x)!=null?f:0),r=Z(t,(b=(h=i.offset)==null?void 0:h.y)!=null?b:0);break;case"right":a=ei(e,i.percent,(v=(y=i.offset)==null?void 0:y.x)!=null?v:0),r=Z(t,(w=(x=i.offset)==null?void 0:x.y)!=null?w:0);break;case"center":a=Z(e,(C=(E=i.offset)==null?void 0:E.x)!=null?C:0),r=Z(t,(M=(A=i.offset)==null?void 0:A.y)!=null?M:0);break}n.position?n.position.set(a,r):(n.x=a,n.y=r),i.scale!==void 0&&i.scale!==1&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(i.scale,i.scale):(n.scale.x=i.scale,n.scale.y=i.scale))}function ur(n,e,t,i=.2,a=1,r=!0,o=!1){let s=ds(t,i),l=Zt(t,i/2);he(n,Z(e),l);let c=r?a*fe.scaleFactor:a;me(n,c),o&&!bn.find(d=>d.element===n)&&rs(n,ur,e,t,i,a,r)}function us(n,e,t,i=.1,a=1){he(n,Z(e),Jt(t,i)),me(n,a)}function gs(n,e,t,i=0,a=0,r=1){he(n,Z(e,i),Z(t,a)),me(n,r)}function fs(n,e,t,i=.1,a=1){he(n,Qt(e,i),Z(t)),me(n,a)}function hs(n,e,t,i=.1,a=1){he(n,ei(e,i),Z(t)),me(n,a)}function ms(n,e,t,i=.05,a=.05,r=1){he(n,Qt(e,a),Zt(t,i)),me(n,r)}function bs(n,e,t,i=.05,a=.05,r=1){he(n,ei(e,a),Zt(t,i)),me(n,r)}function ys(n,e,t,i=.05,a=.05,r=1){he(n,Qt(e,a),Jt(t,i)),me(n,r)}function vs(n,e,t,i=.05,a=.05,r=1){he(n,ei(e,a),Jt(t,i)),me(n,r)}function he(n,e,t){n&&n.position?typeof n.position.set=="function"?n.position.set(e,t):(n.position.x=e,n.position.y=t):n&&(n.x=e,n.y=t)}function me(n,e){e!==1&&n&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(e,e):n.scale.x!==void 0&&n.scale.y!==void 0&&(n.scale.x=e,n.scale.y=e))}var Re={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 xs(n){return n&&Re[n]?JSON.parse(JSON.stringify(Re[n])):JSON.parse(JSON.stringify(vt))}function yt(n){Object.keys(n).forEach(e=>{let t=e;vt[t]&&n[t]&&Object.assign(vt[t],n[t])}),console.log("Config applied:",n)}function ws(n,e){let t=n/e;t>1.6?(yt(Re.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(yt(Re.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(yt(Re.square),console.log("Applied SQUARE config for ratio:",t)):(yt(Re.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let n=window;n.configPresets=Re,n.resolveAnchorVec2=n.resolveAnchorVec2||Xt,n.resolveScreenAnchorPoint=n.resolveScreenAnchorPoint||dr,n.resolveScreenRatioPoint=n.resolveScreenRatioPoint||pr}pi();function U(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var Hc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:U(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:U(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:U(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:U(360,780)}],Nc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:U(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:U(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:U(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:U(412,915)}],Bc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:U(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:U(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:U(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:U(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:U(800,1280)}],_n=[{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:U(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:U(768,1024),mraidScale:.7}];var Pn=[..._n],Mn=[{category:"playable",label:"Playable Ad",devices:_n}],ui=_n[0];function He(n){return Pn.find(e=>e.id===n)||ui}function Os(n){return Pn.filter(e=>e.category===n)}var gi=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`
46
+ `,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var pl={};ft(pl,{COLORS:()=>ce,ConfigWatcher:()=>ze,DebugPanel:()=>Ot,DefaultReloadStrategy:()=>St,Handler:()=>ie,PlayableLoadingScreen:()=>Ui,PreviewShell:()=>Ni,STROKE_WIDTH:()=>mo,THEME:()=>bo,applyConfigOverride:()=>Se,applyConfigOverrides:()=>Ce,applyConfigsToDisk:()=>ri,applyDefaults:()=>$e,baseLottie:()=>rn,bootstrap:()=>el,clearConfigOverrides:()=>se,clearConfigOverridesForObject:()=>xr,configOverrideManager:()=>wr,createPreviewShell:()=>pa,deepClone:()=>G,default:()=>Oe,defaultPreset:()=>ui,deviceGroups:()=>Mn,devicePresets:()=>Pn,diffConfigs:()=>Sn,exportConfigsAsJSON:()=>De,getConfigOverrides:()=>Y,getConfigStateSummary:()=>ai,getOverrideMode:()=>wt,getPresetById:()=>He,getPresetsByCategory:()=>Os,loadAllObjectConfigs:()=>li,loadComponentSchemas:()=>si,loadEngineConfig:()=>ci,loadGamePromptConfig:()=>wn,loadObjectCentricConfig:()=>be,loadObjectConfig:()=>Te,loadSceneConfig:()=>di,rehydrateObject:()=>Cn,removeConfigOverride:()=>ni,resetToApplied:()=>Et,resetToOriginal:()=>oi,setBootstrapDependencies:()=>Zs,setOverrideMode:()=>yn,setupHotReload:()=>kn,setupLiveEditBridge:()=>Bi,toLegacyFormat:()=>En,validateObjectConfig:()=>Ze});module.exports=zo(pl);var we={};function Ut(n,e,t=!1){we[n]||(we[n]=[]),we[n].push({fn:e,once:t})}function en(n,e){if(we[n]){if(!e){delete we[n];return}we[n]=we[n].filter(t=>t.fn!==e)}}function Gt(n,...e){let t=we[n];if(t)for(let i of[...t])i.fn(...e),i.once&&en(n,i.fn)}function X(n,e){Ut(n,e,!0)}var F=null,ee=[],We=null;function Pa(n){F=n,ee=[],We!==null&&(clearTimeout(We),We=null)}function Ma(){var n,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(n=F==null?void 0:F.batchSize)!=null?n:10,flushIntervalMs:(e=F==null?void 0:F.flushIntervalMs)!=null?e:300,maxQueue:(t=F==null?void 0:F.maxQueue)!=null?t:200,debug:!!(F!=null&&F.debug)}}async function ka(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(r){i&&console.warn("[handler.telemetry] fetch failed",r)}}function tn(n,e){let t=Ma();if(e&&t.endpoint){if(ee.push(n),ee.length>t.maxQueue&&(ee=ee.slice(ee.length-t.maxQueue)),ee.length>=t.batchSize){_a();return}We===null&&(We=window.setTimeout(()=>{We=null,_a()},t.flushIntervalMs))}}async function _a(){let n=Ma();if(!n.endpoint||ee.length===0)return;let e=ee.splice(0,n.batchSize);await ka(n.endpoint,{events:e},n.transport,n.debug),ee.length>0&&await ka(n.endpoint,{events:ee.splice(0,n.batchSize)},n.transport,n.debug)}function Oa(n){return Math.max(0,Math.min(1,n))}function Ho(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function ht(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function No(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function Ia(n,e,t){try{n[e]=t}catch{}}function Bo(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ja(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function Ra(n,e){let t=Bo(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function Da(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),n.size>0&&i()})},a=d=>{var u;n.add(d);let p=(u=e.get(d.target))!=null?u:new Set;p.add(d),e.set(d.target,p),i()},r=d=>{n.delete(d);let p=e.get(d.target);p&&(p.delete(d),p.size===0&&e.delete(d.target))},o=d=>{d.killed||(d.killed=!0,r(d))},s=()=>{var p,u;let d=ht();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=d-g.startMs-g.delayMs;if(m<0)continue;let f=g.durationMs>0?m/g.durationMs:1,h=Oa(f),b=g.repeat>=0?g.repeat+1:1,y=g.repeat>0?Math.min(Math.floor(f),b-1):0;if(g.repeat>0&&f>=1){let w=f-y;h=Oa(w)}let v=g.ease(h);g.yoyo&&y%2===1&&(v=1-v);for(let w of g.props)Ia(g.target,w.key,w.from+(w.to-w.from)*v);g.scaleFrom&&g.scaleTo&&ja(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*v,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*v});try{(p=g.onUpdate)==null||p.call(g)}catch{}if(f>=b){o(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(d,p,u)=>{var w;let g=Math.max(0,(typeof p.duration=="number"?p.duration:.5)*1e3),m=Math.max(0,(typeof p.delay=="number"?p.delay:0)*1e3+((w=u==null?void 0:u.delayMsOverride)!=null?w:0)),f=Ho(p.ease),h=typeof p.repeat=="number"?Math.max(0,p.repeat|0):0,b=p.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let E of Object.keys(p)){if(y.has(E))continue;let C=p[E];typeof C=="number"&&v.push({key:E,from:No(d,E),to:C})}let x=Ra(d,p);return{target:d,startMs:ht(),delayMs:m,durationMs:g,ease:f,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:h,yoyo:b,onUpdate:typeof p.onUpdate=="function"?p.onUpdate:void 0,onComplete:typeof p.onComplete=="function"?p.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(d,p){let u=l(d,p);return a(u),{kill:()=>o(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=ht())},resume:()=>{var f;if(!u.paused)return;let g=(f=u.pauseAtMs)!=null?f:ht(),m=ht()-g;u.startMs+=m,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(d,p,u){return c.set(d,p),c.to(d,u)},set(d,p){if(!d||!p)return;for(let g of Object.keys(p)){let m=p[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Ia(d,g,m)}let u=Ra(d,p);u.to&&ja(d,u.to)},killTweensOf(d){let p=e.get(d);if(p)for(let u of Array.from(p))o(u)},timeline(d={}){let p=[],u=0,g=!1,m=[],f=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let v=typeof y=="string"?y.trim():"";return v.startsWith("+=")?u+Math.max(0,Number(v.slice(2))*1e3||0):v?Math.max(0,Number(v)*1e3||0):u},h=y=>{p.push(y);let v=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);u=Math.max(u,y.atMs+v)},b={to(y,v,x){return h({kind:"to",target:y,vars:v,atMs:f(x)}),b},fromTo(y,v,x,w){return h({kind:"fromTo",target:y,vars:x,from:v,atMs:f(w)}),b},play(){var y,v;if(g)return b;g=!0,m=[];for(let x of p)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),m.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 m)y.pause();return b},kill(){for(let y of m)y.kill();m=[],g=!1}};return d.paused||b.play(),b}};return c}function $a(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=Da()}catch{}}var za={name:"handler-playable-sdk",version:"0.4.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",jszip:"^3.10.1",sharp:"^0.34.5"}};var J=0,Uo=J++,Ha=J++,Na=J++,Ba=J++,Fa=J++,Ua=J++,Ga=J++,qa=J++,Va=J++,Wa=J++,Ya=J++,Ka=J++,N=Uo;function Xa(){return N===Ha}function Ja(){return N===Na}function Za(){return N===Ba}function Qa(){return N===Fa}function Ye(){return N===Ua}function Ke(){return N===Ga}function er(){return N===qa}function tr(){return N===Va}function ir(){return N===Wa}function nn(){return N===Ya}function an(){return N===Ka}function nr(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),N=Ha;return}catch{}else if(n==="dapi")try{dapi.isReady(),N=Na;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(N=Ba)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(N=Fa)}catch{}else if(e==="mintegral")window.gameReady&&(N=Ua);else if(e==="tapjoy")window.TJ_API&&(N=Ga);else if(e==="tiktok")window.openAppStore&&(N=qa);else if(e==="smadex")try{window.smxTracking&&(N=Va)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(N=Wa)}catch{}else e==="vungle"?N=Ya:(n==="nucleo"||e==="nucleo")&&(N=Ka)}var qt=Ve(require("lottie-web"),1),rn=qt.default;typeof window!="undefined"&&(window.lottie=qt.default,window.__baseLottie=qt.default);var Go=require("pixi.js");var on=require("pixi.js");var qo=null;function sn(n){qo=n}Vt();ln();var mt=require("pixi.js");Vt();var Jo=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",un=Jo;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(un=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${un}`))}}catch{}function Zo(n){var t,i,a,r,o;if(typeof window!="undefined"&&window.resolveAnchorVec2)return window.resolveAnchorVec2(n);let e={center:{x:.5,y:.5},"top-left":{x:0,y:0},"top-center":{x:.5,y:0},"top-right":{x:1,y:0},"center-left":{x:0,y:.5},"center-right":{x:1,y:.5},"bottom-left":{x:0,y:1},"bottom-center":{x:.5,y:1},"bottom-right":{x:1,y:1},left:{x:0,y:.5},right:{x:1,y:.5},top:{x:.5,y:0},bottom:{x:.5,y:1}};if(Array.isArray(n))return{x:(t=n[0])!=null?t:.5,y:(i=n[1])!=null?i:.5};if(n&&typeof n=="object"&&"x"in n&&"y"in n)return{x:(a=n.x)!=null?a:.5,y:(r=n.y)!=null?r:.5};if(typeof n=="string"){let s=n.trim().toLowerCase();return(o=e[s])!=null?o:{x:.5,y:.5}}return null}var Ae=class{static async create(e,t,i){var l,c,d,p,u,g,m;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${un}`);let a=(l=t==null?void 0:t.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let f=new mt.Container;return this.applyTransform(f,t==null?void 0:t.transform,t),f}let r=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${r}, type: ${a.type}, path: ${a.path}`);let o=await je.load(e,a,i,r);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(d=o==null?void 0:o.constructor)==null?void 0:d.name}`);let s;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),s=new mt.Sprite(o),console.log("[ObjectFactory] Created object:",s,"type:",(p=s==null?void 0:s.constructor)==null?void 0:p.name),this.applyTransform(s,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=o==null?void 0:o.constructor)==null?void 0:u.name,o),o&&(((g=o.constructor)==null?void 0:g.name)==="Container"||o instanceof mt.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let f=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],h=!1;for(let b of f)try{let y=await fetch(b);if(y.ok){s=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(m=s==null?void 0:s.constructor)==null?void 0:m.name),h=!0;break}}catch{continue}h||(console.error("[ObjectFactory] Failed to reload JSON from any path"),s=o)}else s=o;else s=o,s&&typeof s=="object"&&("x"in s||"position"in s)&&this.applyTransform(s,t==null?void 0:t.transform,t);return s}static applyTransform(e,t,i){var a,r,o,s;if(!(!t||!e)&&(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(r=t.position.y)!=null?r:0):"position"in e&&e.position&&e.position.set((o=t.position.x)!=null?o:0,(s=t.position.y)!=null?s:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor)){let l=Zo(t.anchor);l&&("set"in e.anchor?e.anchor.set(l.x,l.y):(e.anchor.x=l.x,e.anchor.y=l.y))}}};var bt=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var ts=Ve(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=ts);Xe();var Wt=require("pixi.js");Xe();var hn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new bt}init(e,t){this.registry.init(e),this.app=t}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let t=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(t.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async r=>{var s;let o=this.registry.get(r);if(!o){console.warn("[Assets] No config found for object:",r);return}try{let l=await Ae.create(r,o,this.app);this.instanceCache.set(r,l),console.log("[Assets] Loaded object:",r,(s=l==null?void 0:l.constructor)==null?void 0:s.name)}catch(l){console.error("[Assets] Failed to load object:",r,l)}})))};return this.readyPromise=(async()=>{await i(t);let a=this.registry.getAllIds().filter(r=>!this.instanceCache.has(r));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let t=this.registry.get(e);if(t){let i=await Ae.create(e,t,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},is=new hn,ns=new Proxy(is,{get(n,e){if(e in n&&typeof n[e]=="function")return n[e].bind(n);if(n.get(e))return n.get(e)}});Xe();var cr=require("pixi.js"),fe={width:400,height:600,designWidth:400,scaleFactor:1},Kt={scale:1,position:1},bn=[];function rs(n,e,t,i,a,r,o){bn.push({element:n,originalScale:r,positionHelper:e,heightPercent:a}),e(n,t,i,a,r,o,!1)}function os(){bn.forEach(({element:n,originalScale:e,positionHelper:t,heightPercent:i})=>{let a=e*fe.scaleFactor;t(n,fe.width,fe.height,i,a,!0,!1)})}function mn(n,e){console.log(`[SCREEN] updateScreenState called: ${n}x${e}`),fe.width=n,fe.height=e,fe.scaleFactor=Math.min(n/fe.designWidth,1.15),Kt.scale=fe.scaleFactor,Kt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Kt.scale.toFixed(3)}`),os()}var vt={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 ss(n,e,t){let i=vt[n];i&&i[e]!==void 0&&(i[e]=t,console.log(`Updated ${n}.${e} = ${t}`))}function ls(){return vt}var cs={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 Yt(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}function Xt(n,e={x:.5,y:.5}){var t;if(Array.isArray(n))return{x:Yt(n[0],e.x),y:Yt(n[1],e.y)};if(n&&typeof n=="object"){let i=n;return{x:Yt(i.x,e.x),y:Yt(i.y,e.y)}}if(typeof n=="string"){let i=n.trim().toLowerCase();return(t=cs[i])!=null?t:e}return e}function dr(n,e,t,i={}){var g,m,f,h,b,y;let a=Xt(t),r=(g=i.inset)!=null?g:{},o=(m=i.padding)!=null?m:{x:0,y:0},s=((f=r.left)!=null?f:0)+o.x,l=((h=r.right)!=null?h:0)+o.x,c=((b=r.top)!=null?b:0)+o.y,d=((y=r.bottom)!=null?y:0)+o.y,p=Math.max(0,n-s-l),u=Math.max(0,e-c-d);return{x:s+p*a.x,y:c+u*a.y}}function pr(n,e,t,i={}){var f,h,b,y,v,x;let a=(f=i.inset)!=null?f:{},r=(h=i.padding)!=null?h:{x:0,y:0},o=((b=a.left)!=null?b:0)+r.x,s=((y=a.right)!=null?y:0)+r.x,l=((v=a.top)!=null?v:0)+r.y,c=((x=a.bottom)!=null?x:0)+r.y,d=Math.max(0,n-o-s),p=Math.max(0,e-l-c),u=Xt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),m=Math.min(Math.max(u.y,0),1);return{x:o+d*g,y:l+p*m}}if(typeof window!="undefined"){let n=window.innerWidth,e=window.innerHeight,t=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==n||a!==e)&&(n=i,e=a,mn(i,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),mn(window.innerWidth,window.innerHeight),window.updateDebugConfig=ss,window.getDebugConfig=ls,window.copyConfig=xs,window.applyConfig=yt,window.applyConfigForRatio=ws,window.positionAtBottom=ur,window.positionAtTop=us,window.positionAtCenter=gs,window.positionAtLeft=fs,window.positionAtRight=hs,window.positionAtBottomLeft=ms,window.positionAtBottomRight=bs,window.positionAtTopLeft=ys,window.positionAtTopRight=vs,window.applyPositionContract=ps,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 Jt(n,e,t=0){return n*e+t}function Zt(n,e,t=0){return n*(1-e)+t}function Qt(n,e,t=0){return n*e+t}function ei(n,e,t=0){return n*(1-e)+t}function Z(n,e=0){return n/2+e}function ds(n,e){return n*e}function ps(n,e,t,i){var o,s,l,c,d,p,u,g,m,f,h,b,y,v,x,w,E,C,A,M;let a=0,r=0;switch(i.type){case"top":a=Z(e,(s=(o=i.offset)==null?void 0:o.x)!=null?s:0),r=Jt(t,i.percent,(c=(l=i.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=Z(e,(p=(d=i.offset)==null?void 0:d.x)!=null?p:0),r=Zt(t,i.percent,(g=(u=i.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Qt(e,i.percent,(f=(m=i.offset)==null?void 0:m.x)!=null?f:0),r=Z(t,(b=(h=i.offset)==null?void 0:h.y)!=null?b:0);break;case"right":a=ei(e,i.percent,(v=(y=i.offset)==null?void 0:y.x)!=null?v:0),r=Z(t,(w=(x=i.offset)==null?void 0:x.y)!=null?w:0);break;case"center":a=Z(e,(C=(E=i.offset)==null?void 0:E.x)!=null?C:0),r=Z(t,(M=(A=i.offset)==null?void 0:A.y)!=null?M:0);break}n.position?n.position.set(a,r):(n.x=a,n.y=r),i.scale!==void 0&&i.scale!==1&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(i.scale,i.scale):(n.scale.x=i.scale,n.scale.y=i.scale))}function ur(n,e,t,i=.2,a=1,r=!0,o=!1){let s=ds(t,i),l=Zt(t,i/2);he(n,Z(e),l);let c=r?a*fe.scaleFactor:a;me(n,c),o&&!bn.find(d=>d.element===n)&&rs(n,ur,e,t,i,a,r)}function us(n,e,t,i=.1,a=1){he(n,Z(e),Jt(t,i)),me(n,a)}function gs(n,e,t,i=0,a=0,r=1){he(n,Z(e,i),Z(t,a)),me(n,r)}function fs(n,e,t,i=.1,a=1){he(n,Qt(e,i),Z(t)),me(n,a)}function hs(n,e,t,i=.1,a=1){he(n,ei(e,i),Z(t)),me(n,a)}function ms(n,e,t,i=.05,a=.05,r=1){he(n,Qt(e,a),Zt(t,i)),me(n,r)}function bs(n,e,t,i=.05,a=.05,r=1){he(n,ei(e,a),Zt(t,i)),me(n,r)}function ys(n,e,t,i=.05,a=.05,r=1){he(n,Qt(e,a),Jt(t,i)),me(n,r)}function vs(n,e,t,i=.05,a=.05,r=1){he(n,ei(e,a),Jt(t,i)),me(n,r)}function he(n,e,t){n&&n.position?typeof n.position.set=="function"?n.position.set(e,t):(n.position.x=e,n.position.y=t):n&&(n.x=e,n.y=t)}function me(n,e){e!==1&&n&&n.scale&&(typeof n.scale.set=="function"?n.scale.set(e,e):n.scale.x!==void 0&&n.scale.y!==void 0&&(n.scale.x=e,n.scale.y=e))}var Re={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 xs(n){return n&&Re[n]?JSON.parse(JSON.stringify(Re[n])):JSON.parse(JSON.stringify(vt))}function yt(n){Object.keys(n).forEach(e=>{let t=e;vt[t]&&n[t]&&Object.assign(vt[t],n[t])}),console.log("Config applied:",n)}function ws(n,e){let t=n/e;t>1.6?(yt(Re.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(yt(Re.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(yt(Re.square),console.log("Applied SQUARE config for ratio:",t)):(yt(Re.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let n=window;n.configPresets=Re,n.resolveAnchorVec2=n.resolveAnchorVec2||Xt,n.resolveScreenAnchorPoint=n.resolveScreenAnchorPoint||dr,n.resolveScreenRatioPoint=n.resolveScreenRatioPoint||pr}pi();function U(n,e){let t=(a,r)=>r===0?a:t(r,a%r),i=t(n,e);return`${n/i}:${e/i}`}var Hc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:U(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:U(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:U(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:U(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:U(360,780)}],Nc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:U(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:U(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:U(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:U(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:U(412,915)}],Bc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:U(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:U(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:U(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:U(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:U(800,1280)}],_n=[{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:U(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:U(768,1024),mraidScale:.7}];var Pn=[..._n],Mn=[{category:"playable",label:"Playable Ad",devices:_n}],ui=_n[0];function He(n){return Pn.find(e=>e.id===n)||ui}function Os(n){return Pn.filter(e=>e.category===n)}var gi=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
47
  <div class="scene-panel scene-objects panel-accent-teal" data-panel="scene-objects">
48
48
  <div class="scene-panel-header" data-panel-handle>
49
49
  <div class="panel-title">
@@ -967,7 +967,7 @@ Generate the requested asset matching the brand style.${n.needsTransparency?" Ba
967
967
  `}initialize(e,t){var y,v,x,w,E,C,A,M,B,P,T,I,O,D,j,$;this.options=t,this.root=e.querySelector('[data-panel="loading-screen"]');let a=(()=>{var k;let S=window.getEditableEngineConfig;if(typeof S=="function"){let _=S();return(k=_==null?void 0:_.loading)!=null?k:{}}return{}})(),r=(y=this.root)==null?void 0:y.querySelector("#loading-screen-type");r&&(r.value=a.type==="image"?"image":"color",r.addEventListener("change",()=>{var S,k;(k=(S=this.options)==null?void 0:S.onUpdateLoading)==null||k.call(S,{type:r.value}),this.updateFieldVisibility(r.value)}));let o=(v=this.root)==null?void 0:v.querySelector("#loading-background-color");o&&(o.value=a.background_color||"#160a17",o.addEventListener("input",()=>{var S,k;(k=(S=this.options)==null?void 0:S.onUpdateLoading)==null||k.call(S,{background_color:o.value})}));let s=(x=this.root)==null?void 0:x.querySelector("#loading-overlay-alpha"),l=(w=this.root)==null?void 0:w.querySelector("#loading-overlay-alpha-value");s&&(s.value=String((E=a.overlay_alpha)!=null?E:1),l&&(l.textContent=Number(s.value).toFixed(2)),s.addEventListener("input",()=>{var k,_;let S=Number(s.value);l&&(l.textContent=S.toFixed(2)),(_=(k=this.options)==null?void 0:k.onUpdateLoading)==null||_.call(k,{overlay_alpha:S})}));let c=(C=this.root)==null?void 0:C.querySelector("#loading-text");c&&(c.value=a.text||"",c.addEventListener("input",()=>{var S,k;(k=(S=this.options)==null?void 0:S.onUpdateLoading)==null||k.call(S,{text:c.value})}));let d=(A=this.root)==null?void 0:A.querySelector("#loading-text-scale"),p=(M=this.root)==null?void 0:M.querySelector("#loading-text-scale-value");d&&(d.value=String((B=a.text_scale)!=null?B:.6),p&&(p.textContent=Number(d.value).toFixed(2)),d.addEventListener("input",()=>{var k,_;let S=Number(d.value);p&&(p.textContent=S.toFixed(2)),(_=(k=this.options)==null?void 0:k.onUpdateLoading)==null||_.call(k,{text_scale:S})}));let u=(P=this.root)==null?void 0:P.querySelector("#loading-enabled");u&&(u.checked=a.enabled!==!1,u.addEventListener("change",()=>{var S,k;(k=(S=this.options)==null?void 0:S.onUpdateLoading)==null||k.call(S,{enabled:u.checked})}));let g=(T=this.root)==null?void 0:T.querySelector("#loading-blur-enabled");g&&(g.checked=a.blur_enabled!==!1,g.addEventListener("change",()=>{var S,k;(k=(S=this.options)==null?void 0:S.onUpdateLoading)==null||k.call(S,{blur_enabled:g.checked})}));let m=(I=this.root)==null?void 0:I.querySelector("#loading-blur-strength"),f=(O=this.root)==null?void 0:O.querySelector("#loading-blur-strength-value");m&&(m.value=String((D=a.blur_strength)!=null?D:8),f&&(f.textContent=m.value),m.addEventListener("input",()=>{var S,k;f&&(f.textContent=m.value),(k=(S=this.options)==null?void 0:S.onUpdateLoading)==null||k.call(S,{blur_strength:Number(m.value)})}));let h=(j=this.root)==null?void 0:j.querySelector("#loading-show-btn"),b=($=this.root)==null?void 0:$.querySelector("#loading-hide-btn");h==null||h.addEventListener("click",()=>{var S,k;(k=(S=this.options)==null?void 0:S.onShowLoadingScreen)==null||k.call(S)}),b==null||b.addEventListener("click",()=>{var S,k;(k=(S=this.options)==null?void 0:S.onHideLoadingScreen)==null||k.call(S)}),this.updateFieldVisibility(a.type==="image"?"image":"color")}updateFieldVisibility(e){var a,r;let t=(a=this.root)==null?void 0:a.querySelector("#loading-color-field"),i=(r=this.root)==null?void 0:r.querySelector("#loading-alpha-field");e==="image"?(t&&(t.style.display="none"),i&&(i.style.display="none")):(t&&(t.style.display=""),i&&(i.style.display=""))}refresh(){}};var Tt=require("pixi.js");Xe();K();async function Fr(n,e,t){var i,a;console.log("[LIBRARY] applyAssetChange called with:",e,t);try{let r=Date.now(),s=`/${`raw/library/${e}/${t}`}?t=${r}`;console.log("[LIBRARY] Loading texture from:",s);let l=await Tt.Assets.load(s);if(!l){console.error("[LIBRARY] Failed to load texture:",s);return}let c=window.CustomAssets,d=Object.keys(c||{}).filter(u=>{let g=e.replace(/s$/,"");return u.startsWith(g)||u.includes(g)});for(let u of d)oe[u]=l,console.log("[LIBRARY] \u2705 Updated AssetTextures."+u),(i=c[u])!=null&&i.texture&&(c[u].texture=l,console.log("[LIBRARY] \u2705 Updated CustomAssets."+u+".texture"));let p=window.gameObjectManager;if(p)for(let u of d){let g=p.get(u);if(g){let m=((a=g.getDisplayObject)==null?void 0:a.call(g))||g.pixiObject||g;m!=null&&m.texture&&(m.texture=l,console.log("[LIBRARY] \u2705 Applied to display object:",u))}}}catch(r){console.error("[LIBRARY] Error applying asset change:",r)}}async function Ur(n,e){var t,i,a;console.log("[LIBRARY] resetAsset called for:",e);try{let r=window.getEditableAssets,o=typeof r=="function"?r():null,s=(t=o==null?void 0:o.slots)==null?void 0:t.find(h=>h.category===e),l=s==null?void 0:s.defaultAsset;if(!l){console.warn("[LIBRARY] Could not find default asset for:",e);return}let c=Date.now(),d=`/raw/${l}?t=${c}`;console.log("[LIBRARY] Loading default texture from:",d);let p=await Tt.Assets.load(d);if(!p){console.error("[LIBRARY] Failed to load default texture:",d);return}let u=window.CustomAssets,g=e.replace(/s$/,""),m=Object.keys(u||{}).filter(h=>h.startsWith(g)||h.includes(g));for(let h of m)oe[h]=p,console.log("[LIBRARY] \u2705 Reset AssetTextures."+h),(i=u[h])!=null&&i.texture&&(u[h].texture=p,console.log("[LIBRARY] \u2705 Reset CustomAssets."+h+" to default"));let f=window.gameObjectManager;if(f)for(let h of m){let b=f.get(h);if(b){let y=((a=b.getDisplayObject)==null?void 0:a.call(b))||b.pixiObject||b;y!=null&&y.texture&&(y.texture=p,console.log("[LIBRARY] \u2705 Reset display object:",h))}}}catch(r){console.error("[LIBRARY] Error resetting asset:",r)}}async function Gr(n,e,t,i){var a,r,o,s,l,c,d,p,u,g,m,f,h,b,y;console.log("[LIBRARY] applySlotAsset:",{objectId:e,assetFilename:t,category:i});try{let v=e.startsWith("json.")?e.replace("json.",""):e;console.log("[LIBRARY] Asset key:",v);let x=Date.now(),w=`/raw/library/${i}/${t}?t=${x}`;console.log("[LIBRARY] Loading texture from:",w);let E=await Tt.Assets.load(w);if(!E){console.error("[LIBRARY] Failed to load texture:",w);return}console.log("[LIBRARY] \u2705 Texture loaded"),oe[v]=E,console.log("[LIBRARY] \u2705 Updated AssetTextures."+v);let C=window.CustomAssets;C!=null&&C[v]&&(C[v].texture=E,console.log("[LIBRARY] \u2705 Updated legacy CustomAssets."+v));let A=window.gameObjectManager;if(console.log("[LIBRARY] gameObjectManager exists?",!!A),A){let B=Array.from(((a=A.keys)==null?void 0:a.call(A))||[]).slice(0,10);console.log("[LIBRARY] Available gameObject keys (first 10):",B);let P=A.get(v);if(console.log("[LIBRARY] gameObject for "+v+"?",!!P),P){let T=((r=P.getDisplayObject)==null?void 0:r.call(P))||P.pixiObject||P.pixi||P,I=(o=T==null?void 0:T.constructor)==null?void 0:o.name;if(console.log("[LIBRARY] displayObject:",T),console.log("[LIBRARY] displayObject type:",I),console.log("[LIBRARY] has texture?",!!(T!=null&&T.texture)),T!=null&&T.texture)T.texture=E,console.log("[LIBRARY] \u2705 Applied to display object:",v);else if(I==="Text"){console.log("[LIBRARY] \u{1F504} Converting Text to Sprite...");let{Sprite:O}=await import("pixi.js"),D=T.parent,j=(l=(s=D==null?void 0:D.getChildIndex)==null?void 0:s.call(D,T))!=null?l:0,$={x:T.x,y:T.y},S={x:(d=(c=T.anchor)==null?void 0:c.x)!=null?d:.5,y:(u=(p=T.anchor)==null?void 0:p.y)!=null?u:.5},k={x:(m=(g=T.scale)==null?void 0:g.x)!=null?m:1,y:(h=(f=T.scale)==null?void 0:f.y)!=null?h:1},_=(b=T.alpha)!=null?b:1,q=(y=T.visible)!=null?y:!0,V=new O(E);V.anchor.set(S.x,S.y),V.position.set($.x,$.y),V.scale.set(k.x,k.y),V.alpha=_,V.visible=q,D&&(D.removeChild(T),D.addChildAt(V,j),console.log("[LIBRARY] \u2705 Replaced Text with Sprite in parent")),P.pixiObject&&(P.pixiObject=V),P.pixi&&(P.pixi=V),console.log("[LIBRARY] \u2705 Text \u2192 Sprite conversion complete")}else if(T!=null&&T.children){let O=T.children.find(D=>D.texture);O?(O.texture=E,console.log("[LIBRARY] \u2705 Applied to child sprite")):console.warn("[LIBRARY] \u26A0\uFE0F No texture found in displayObject or children")}}}let M=`raw/library/${i}/${t}`;Se({objectId:v,path:"render.asset.path",value:M}),console.log("[LIBRARY] \u2705 Staged config override for:",v,"path:",M)}catch(v){console.error("[LIBRARY] Error applying slot asset:",v)}}async function qr(n,e,t,i){var a;console.log("[LIBRARY] resetSlotAsset:",{objectId:e,defaultAsset:t,category:i});try{let r=e.startsWith("json.")?e.replace("json.",""):e,o=Date.now(),s=`/raw/${t}?t=${o}`;console.log("[LIBRARY] Loading default texture from:",s);let l=await Tt.Assets.load(s);if(!l){console.error("[LIBRARY] Failed to load default texture:",s);return}oe[r]=l,console.log("[LIBRARY] \u2705 Reset AssetTextures."+r);let c=window.CustomAssets;c!=null&&c[r]&&(c[r].texture=l,console.log("[LIBRARY] \u2705 Reset CustomAssets."+r+" to default"));let d=window.gameObjectManager;if(d){let p=d.get(r);if(p){let u=((a=p.getDisplayObject)==null?void 0:a.call(p))||p.pixiObject||p;u!=null&&u.texture&&(u.texture=l,console.log("[LIBRARY] \u2705 Reset display object:",r))}}Se({objectId:r,path:"render.asset.path",value:t}),console.log("[LIBRARY] \u2705 Reset config override for:",r)}catch(r){console.error("[LIBRARY] Error resetting slot asset:",r)}}var _t=require("pixi.js");var zn=require("pixi.js"),ke=()=>window.debugConfig||{},Vr=()=>window.resolveAnchorVec2||(n=>({x:.5,y:.5})),Wr=()=>window.resolveScreenAnchorPoint||(()=>new zn.Point),Yr=()=>window.resolveScreenRatioPoint||(()=>new zn.Point);function Kr(n){Ii(n)&&(n.objectDebugRaf||(n.objectDebugRaf=window.requestAnimationFrame(()=>ji(n))))}function Xr(n){n.objectDebugRaf&&(window.cancelAnimationFrame(n.objectDebugRaf),n.objectDebugRaf=null),kt(n)}function Ii(n){return n.isDebugOpen}function ji(n){var r,o,s;if(!Ii(n)){n.objectDebugRaf=null;return}n.objectDebugRaf=window.requestAnimationFrame(()=>ji(n));let e=Hn(n);if(!e){Lt(n,null),kt(n);return}let t=Nn(n,e);if(!t){Lt(n,null),kt(n);return}let i=new _t.Point;(r=t.getGlobalPosition)==null||r.call(t,i);let a=Bn(n,t);Lt(n,{instanceId:e,worldX:i.x,worldY:i.y,configX:(o=a==null?void 0:a.x)!=null?o:null,configY:(s=a==null?void 0:a.y)!=null?s:null}),n.highlightObject?qn(n,t):Wn(n),n.highlightAnchor&&a?Vn(n,a):Yn(n)}function Hn(n){var a;let e=n.selectedObjectId;if(!e)return null;let t=window.__editableObjectInstances,i=(a=t==null?void 0:t.get)==null?void 0:a.call(t,e);return Array.isArray(i)&&i.length>0?i[0]:e}function Nn(n,e){var a,r;let t=window.gameObjectManager,i=(a=t==null?void 0:t.get)==null?void 0:a.call(t,e);return i?((r=i.getDisplayObject)==null?void 0:r.call(i))||i.pixiObject||i:null}function Pt(n){let e=n.selectedObjectId;if(!e)return null;let t=window.getEditableObjectConfig;return typeof t!="function"?null:t(e)}function Bn(n,e){var o,s;let t=Pt(n);if(!t)return null;let i=(o=t.transform)!=null?o:{},a=Fn(n);if(!a)return null;if(i.position_ratio!=null)return Yr()(a.width,a.height,i.position_ratio);let r=(s=i.anchor)!=null?s:"center";return Wr()(a.width,a.height,r)}function Fn(n){var r;let e=(r=n.container)==null?void 0:r.querySelector(".game-container"),t=Number(e==null?void 0:e.dataset.screenWidth),i=Number(e==null?void 0:e.dataset.screenHeight);if(Number.isFinite(t)&&t>0&&Number.isFinite(i)&&i>0)return{width:t,height:i};let a=window.gameApp;return a!=null&&a.renderer?{width:a.renderer.width,height:a.renderer.height}:null}function Un(n){let e=window.gameApp;return e!=null&&e.stage?(n.objectBoundsGfx&&n.objectBoundsGfx.parent!==e.stage&&(n.objectBoundsGfx.destroy(),n.objectBoundsGfx=null),n.objectBoundsGfx||(n.objectBoundsGfx=new _t.Graphics,n.objectBoundsGfx.zIndex=999999,e.stage.addChild(n.objectBoundsGfx)),n.objectBoundsGfx):null}function Gn(n){let e=window.gameApp;return e!=null&&e.stage?(n.objectAnchorGfx&&n.objectAnchorGfx.parent!==e.stage&&(n.objectAnchorGfx.destroy(),n.objectAnchorGfx=null),n.objectAnchorGfx||(n.objectAnchorGfx=new _t.Graphics,n.objectAnchorGfx.zIndex=1e6,e.stage.addChild(n.objectAnchorGfx)),n.objectAnchorGfx):null}function qn(n,e){var a;let t=Un(n);if(!t)return;let i=(a=e.getBounds)==null?void 0:a.call(e);i&&(t.clear(),t.rect(i.x,i.y,i.width,i.height).stroke({width:2,color:16726832,alpha:.9}))}function Vn(n,e){let t=Gn(n);if(!t)return;let i=6;t.clear(),t.moveTo(e.x-i,e.y),t.lineTo(e.x+i,e.y),t.moveTo(e.x,e.y-i),t.lineTo(e.x,e.y+i),t.stroke({width:2,color:3066993,alpha:.9})}function Wn(n){n.objectBoundsGfx&&n.objectBoundsGfx.clear()}function Yn(n){n.objectAnchorGfx&&n.objectAnchorGfx.clear()}function kt(n){n.objectBoundsGfx&&(n.objectBoundsGfx.destroy(),n.objectBoundsGfx=null),n.objectAnchorGfx&&(n.objectAnchorGfx.destroy(),n.objectAnchorGfx=null)}function Lt(n,e){n.sceneToolsPanel.updateInfo(e?{instanceId:e.instanceId,worldX:e.worldX,worldY:e.worldY,anchorX:e.configX,anchorY:e.configY}:null)}function Jr(n,e){return e.split(".").reduce((t,i)=>t?t[i]:void 0,n)}function Zr(n,e,t){var o;let i=e.split("."),a=i.pop(),r=n;for(let s of i)r[s]=(o=r[s])!=null?o:{},r=r[s];r[a]=t}function Kn(n){var i,a,r,o,s;if(!n)return!1;if((i=n.transform)!=null&&i.offset)return!0;let e=((r=(a=n.identity)==null?void 0:a.category)!=null?r:"").toString().toLowerCase(),t=((s=(o=n.identity)==null?void 0:o.id)!=null?s:"").toString().toLowerCase();return e.includes("ui")||t.startsWith("ui")||t.includes("label")}function Di(n){let e=ke();e.layout&&(e.layout.scale_multiplier=1,e.layout.position_offset={x:0,y:0},e.layout.debug_rect_visible=!0,e.layout.debug_rect_color=16711680,e.layout.debug_rect_thickness=4),e.engine&&(e.engine.scale=1,e.engine.background_scale=1.05,e.engine.label_pulse_speed=3,e.engine.label_pulse_intensity=.03),e.physics&&(e.physics.rope_length=420),window.location.reload()}function Qr(n){window.location.reload()}function $i(n){let e=JSON.stringify(ke(),null,2);navigator.clipboard.writeText(e).then(()=>{alert("Debug config copied to clipboard!")}).catch(()=>{console.log(e),alert("Config logged to console (clipboard not available)")})}async function eo(n,e){var t,i,a;if(!(!n.configViewer||!n.container))try{let r=window.getEditableObjectConfig,o=typeof r=="function"?r(e):null;if(!o){let{loadObjectCentricConfig:s,loadObjectConfig:l}=await Promise.resolve().then(()=>(pi(),Cr)),p=(((t=(await s("scene.main")).scene)==null?void 0:t.objects)||[]).find(g=>g.object_config===e||g.instance_id===e);if(!p)return;let u=await l(p.object_config);console.log("[PREVIEW] Loaded object config (fallback)",e,u),Ri(n,u),(i=n.configViewer)==null||i.style.setProperty("display","block");return}console.log("[PREVIEW] Loaded object config",e,o),Ri(n,o),(a=n.configViewer)==null||a.style.setProperty("display","block");return}catch(r){console.error("[DEBUG] Failed to load object config:",r)}}function Ri(n,e){var p,u,g,m,f,h,b,y,v,x;if(!n.container)return;let t=n.container.querySelector("#config-pos-x"),i=n.container.querySelector("#config-pos-y"),a=n.container.querySelector("#config-scale"),r=n.container.querySelector("#config-anchor-x"),o=n.container.querySelector("#config-anchor-y"),l=Kn(e)?(p=e.transform)==null?void 0:p.offset:(u=e.transform)==null?void 0:u.position;t&&(t.value=String((g=l==null?void 0:l.x)!=null?g:0)),i&&(i.value=String((m=l==null?void 0:l.y)!=null?m:0)),a&&(a.value=String((h=(f=e.transform)==null?void 0:f.scale)!=null?h:1));let c=(x=(v=(b=e.transform)==null?void 0:b.anchor)!=null?v:(y=e.render)==null?void 0:y.anchor)!=null?x:{x:.5,y:.5},d=Vr()(c);r&&(r.value=String(d.x)),o&&(o.value=String(d.y))}function to(n){var l,c,d,p,u,g,m,f,h,b;let e=n.selectedObjectId;if(!e||!n.container)return;let t=(c=(l=n.container.querySelector("#config-pos-x"))==null?void 0:l.value)!=null?c:"0",i=(p=(d=n.container.querySelector("#config-pos-y"))==null?void 0:d.value)!=null?p:"0",a=(g=(u=n.container.querySelector("#config-scale"))==null?void 0:u.value)!=null?g:"1",r=(f=(m=n.container.querySelector("#config-anchor-x"))==null?void 0:m.value)!=null?f:"0.5",o=(b=(h=n.container.querySelector("#config-anchor-y"))==null?void 0:h.value)!=null?b:"0.5",s=`${e}:
968
968
  position: (${t}, ${i})
969
969
  scale: ${a}
970
- anchor: (${r}, ${o})`;navigator.clipboard.writeText(s).then(()=>console.log("[DEBUG] Config values copied to clipboard")).catch(y=>console.error("[DEBUG] Failed to copy config values:",y))}async function Xn(n,e){var p,u,g,m,f,h,b,y,v,x,w;if(console.log("[INSPECTOR] \u{1F527} applyObjectConfig called"),!n.container)return;let t=n.selectedObjectId;if(!t){console.warn("[PREVIEW] Apply object config clicked with no selection");return}let i=Number((u=(p=n.container.querySelector("#config-pos-x"))==null?void 0:p.value)!=null?u:0),a=Number((m=(g=n.container.querySelector("#config-pos-y"))==null?void 0:g.value)!=null?m:0),r=Number((h=(f=n.container.querySelector("#config-scale"))==null?void 0:f.value)!=null?h:1),o=Number((y=(b=n.container.querySelector("#config-anchor-x"))==null?void 0:b.value)!=null?y:.5),s=Number((x=(v=n.container.querySelector("#config-anchor-y"))==null?void 0:v.value)!=null?x:.5);console.log("[INSPECTOR] Applying config for:",t,{posX:i,posY:a,scale:r,anchorX:o,anchorY:s});let{applyConfigOverride:l}=await Promise.resolve().then(()=>(K(),Je));l({objectId:t,path:"transform.position",value:{x:i,y:a}},{silent:e==null?void 0:e.silent}),l({objectId:t,path:"transform.scale",value:r},{silent:e==null?void 0:e.silent}),l({objectId:t,path:"transform.anchor",value:{x:o,y:s}},{silent:e==null?void 0:e.silent});let c=Pt(n);Kn(c)&&l({objectId:t,path:"transform.offset",value:{x:i,y:a}},{silent:!0}),console.log("[INSPECTOR] Calling applyEditableObjectConfig...");let d=window.applyEditableObjectConfig;if(typeof d=="function"){let E=(w=window.getEditableObjectConfig)==null?void 0:w.call(window,t);E?(console.log("[INSPECTOR] \u2705 Calling applyEditableObjectConfig for:",t),d(t,E)):console.warn("[INSPECTOR] \u26A0\uFE0F No config found for:",t)}else console.warn("[INSPECTOR] \u26A0\uFE0F applyEditableObjectConfig not available")}async function io(n,e,t){let{applyConfigOverride:i}=await Promise.resolve().then(()=>(K(),Je));Object.entries(e.assets).forEach(([l,c])=>{i({path:`assets.${l}`,value:c},{silent:!0})}),Object.entries(e.runtime.theme).forEach(([l,c])=>{i({path:`runtime.theme.${l}`,value:c},{silent:!0})}),Object.entries(e.runtime.ui).forEach(([l,c])=>{i({path:`runtime.ui.${l}`,value:c},{silent:!0})}),Object.entries(e.runtime.fonts).forEach(([l,c])=>{i({path:`runtime.fonts.${l}`,value:c},{silent:!0})}),Object.entries(e.runtime.audio).forEach(([l,c])=>{i({path:`runtime.audio.${l}`,value:c},{silent:!0})});let a=window.applyEditableEngineConfig;if(typeof a=="function"){let l={theme:e.runtime.theme,fonts:e.runtime.fonts,audio:e.runtime.audio},c={};Object.entries(e.runtime.ui).forEach(([d,p])=>{var u;if(d)if(d.includes(".")){let g=d.split("."),m=c;for(let f=0;f<g.length-1;f++){let h=g[f];m[h]=(u=m[h])!=null?u:{},m=m[h]}m[g[g.length-1]]=p}else c[d]=p}),l.ui=c,a({runtime:l,assets:e.assets})}let r=Object.values(e.assets).some(l=>/^(blob:|data:)/.test(l)),o=(t==null?void 0:t.source)!=="auto"&&!r,s=window.__previewShell;o&&(s!=null&&s.refresh)&&s.refresh()}function no(n){n.selectedObjectId&&(n.objectAutoApplyTimer&&window.clearTimeout(n.objectAutoApplyTimer),n.objectAutoApplyTimer=window.setTimeout(()=>{n.objectAutoApplyTimer=null,Xn(n,{silent:!0})},150))}var Gs=3e3;function Mt(n,e,t){let i=t!=null?t:n.offsetParent;if(!i)return;e.style.cursor="move";let a=!1,r=0,o=0,s=c=>{if(!a)return;let d=i.getBoundingClientRect(),p=c.clientX-d.left-r,u=c.clientY-d.top-o;n.style.left=`${p}px`,n.style.top=`${u}px`},l=()=>{a&&(a=!1,n.classList.remove("dragging"),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l))};e.addEventListener("pointerdown",c=>{if(c.button!==0)return;let d=c.target;if(d!=null&&d.closest("button, input, select, textarea"))return;c.preventDefault();let p=n.getBoundingClientRect(),u=i.getBoundingClientRect();r=c.clientX-p.left,o=c.clientY-p.top,n.style.left=`${p.left-u.left}px`,n.style.top=`${p.top-u.top}px`,n.style.right="auto",n.style.bottom="auto",n.style.zIndex=String(++Gs),a=!0,n.classList.add("dragging"),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l)})}function Jn(n,e,t,i=280,a=200){e.style.cursor="nwse-resize";let r=0,o=0,s=0,l=0,c=!1,d=u=>{if(!c)return;let g=u.clientX-s,m=u.clientY-l,f=Math.max(i,r+g),h=Math.max(a,o+m);n.style.width=`${f}px`,n.style.height=`${h}px`,t==null||t(f,h)},p=()=>{c&&(c=!1,window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",p))};e.addEventListener("pointerdown",u=>{if(u.button!==0)return;u.preventDefault(),u.stopPropagation();let g=n.getBoundingClientRect();r=g.width,o=g.height,s=u.clientX,l=u.clientY,c=!0,window.addEventListener("pointermove",d),window.addEventListener("pointerup",p)})}function Zn(n,e){var f,h,b,y;let t=(b=(h=(f=n.container)==null?void 0:f.querySelector("#debug-overlay"))!=null?h:n.debugOverlay)!=null?b:e.offsetParent;if(!t||(y=n.container)!=null&&y.classList.contains("layout-fixed"))return;let i=t.getBoundingClientRect(),a=e.getBoundingClientRect(),r=12,o=Math.max(250,Math.floor(i.width-r*2)),s=Math.max(200,Math.floor(i.height-r*2));a.width>o&&(e.style.width=`${o}px`),a.height>s&&(e.style.height=`${s}px`);let l=e.getBoundingClientRect(),c=l.left-i.left,d=l.top-i.top,p=Math.max(r,i.width-l.width-r),u=Math.max(r,i.height-l.height-r),g=Math.min(Math.max(c,r),p),m=Math.min(Math.max(d,r),u);e.style.left=`${Math.round(g)}px`,e.style.top=`${Math.round(m)}px`,e.style.right="auto",e.style.bottom="auto"}function Ne(n){var i;if(!n.container)return;let e=n.container.querySelector("#debug-workbench");if(!e)return;if(Zn(n,e),(i=n.container)!=null&&i.classList.contains("layout-fixed")){let a=localStorage.getItem("preview_workbench_state"),r={activeTab:n.activeTab};if(a)try{r={...JSON.parse(a),activeTab:n.activeTab}}catch{}localStorage.setItem("preview_workbench_state",JSON.stringify(r));return}let t={activeTab:n.activeTab,width:e.style.width,height:e.style.height,left:e.style.left,top:e.style.top};localStorage.setItem("preview_workbench_state",JSON.stringify(t))}function zi(n){try{let e=localStorage.getItem("preview_workbench_state");if(!e)return;let t=JSON.parse(e);t.activeTab&&(n.activeTab=t.activeTab),window.requestAnimationFrame(()=>{var a;let i=(a=n.container)==null?void 0:a.querySelector("#debug-workbench");i&&(t.width&&(i.style.width=t.width),t.height&&(i.style.height=t.height),t.left&&(i.style.left=t.left,i.style.right="auto"),t.top&&(i.style.top=t.top,i.style.bottom="auto"),Zn(n,i))})}catch(e){console.warn("[PREVIEW] Failed to load workbench state",e)}}function Qn(n,e){let t=e.getBoundingClientRect();(t.left<0||t.top<0||t.right>window.innerWidth||t.bottom>window.innerHeight)&&(console.warn("[Workbench] Workbench positioned outside viewport, repositioning..."),e.style.left="16px",e.style.top="72px",e.style.right="auto",e.style.bottom="auto",Zn(n,e),Ne(n))}function ao(n){var a,r,o;if(!n.container)return;let e=n.container,t=e.querySelector("#debug-toggle");t||console.warn("[PREVIEW] Debug toggle not found in DOM"),t==null||t.addEventListener("click",()=>{var s;console.log("[PREVIEW] Debug toggle clicked"),(s=n.toggleDebug)==null||s.call(n)}),(a=e.querySelector("#debug-close"))==null||a.addEventListener("click",()=>{var s;return(s=n.toggleDebug)==null?void 0:s.call(n,!1)}),(r=e.querySelector("#debug-reset"))==null||r.addEventListener("click",()=>Di(n)),(o=e.querySelector("#debug-export"))==null||o.addEventListener("click",()=>$i(n)),e.querySelectorAll(".workbench-tab").forEach(s=>{s.addEventListener("click",()=>{let l=s.dataset.tab;n.activeTab=l,ea(n),Ne(n)})}),ia(n,e),ta(n,e)}function ea(n){if(!n.container)return;let e=n.container;e.querySelectorAll(".workbench-tab").forEach(a=>{let r=a.dataset.tab;a.classList.toggle("active",r===n.activeTab)}),e.querySelectorAll(".workbench-tab-panel").forEach(a=>{let r=a.dataset.tabPanel;a.classList.toggle("active",r===n.activeTab)})}function ta(n,e){te(n,e,"debug-layout-scale","layout.scale_multiplier","#debug-layout-scale-value"),te(n,e,"debug-layout-offset-x","layout.position_offset.x","#debug-layout-offset-x-value"),te(n,e,"debug-layout-offset-y","layout.position_offset.y","#debug-layout-offset-y-value"),te(n,e,"debug-rect-thickness","layout.debug_rect_thickness","#debug-rect-thickness-value"),te(n,e,"debug-engine-scale","engine.scale","#debug-engine-scale-value"),te(n,e,"debug-background-scale","engine.background_scale","#debug-background-scale-value"),te(n,e,"debug-label-pulse-speed","engine.label_pulse_speed","#debug-label-pulse-speed-value"),te(n,e,"debug-label-pulse-intensity","engine.label_pulse_intensity","#debug-label-pulse-intensity-value"),te(n,e,"debug-rope-length","physics.rope_length","#debug-rope-length-value");let t=e.querySelector("#debug-rect-visible");t==null||t.addEventListener("change",()=>{let a=ke();a.layout&&(a.layout.debug_rect_visible=!!t.checked)});let i=e.querySelector("#debug-rect-color");i==null||i.addEventListener("input",()=>{let a=i.value.replace("#",""),r=parseInt(a,16),o=ke();o.layout&&(o.layout.debug_rect_color=Number.isFinite(r)?r:16711680)})}function ro(n){if(!n.container||!n.debugOverlay)return;let e=n.container.querySelector("#debug-workbench"),t=n.container.querySelector("#workbench-handle"),i=n.container.querySelector("#workbench-resize");e&&t&&(!e.style.left&&!e.style.right&&!e.style.top&&!e.style.bottom&&(e.style.right="16px",e.style.top="72px"),Mt(e,t,n.debugOverlay),t.addEventListener("pointerup",()=>{setTimeout(()=>{Ne(n),Qn(n,e)},10)}));let a=n.container.querySelector('[data-panel="scene-objects"]'),r=a==null?void 0:a.querySelector("[data-panel-handle]"),o=a==null?void 0:a.querySelector("[data-panel-resize-v]");a&&r&&(!a.style.left&&!a.style.right&&!a.style.top&&!a.style.bottom&&(a.style.left="16px",a.style.top="72px"),Mt(a,r,n.debugOverlay),r.addEventListener("pointerup",()=>{setTimeout(()=>{Qn(n,a)},10)})),a&&o&&Jn(a,o);let s=n.container.querySelector('[data-panel="scene-tools-corner"]'),l=s==null?void 0:s.querySelector("[data-panel-handle]");s&&l&&Mt(s,l,n.debugOverlay);let c=n.container.querySelector('[data-panel="nudge-panel"]'),d=c==null?void 0:c.querySelector("[data-panel-handle]");c&&d&&Mt(c,d,n.debugOverlay),e&&i&&Jn(e,i,()=>Ne(n)),zi(n)}function ia(n,e){Array.from(e.querySelectorAll("[data-panel-toggle]")).forEach(i=>{i.addEventListener("click",()=>{let a=i.closest(".scene-panel");a&&a.classList.toggle("collapsed")})})}function te(n,e,t,i,a){let r=e.querySelector(`#${t}`),o=e.querySelector(a);if(!r||!o)return;let s=Jr(ke(),i);typeof s=="number"&&(r.value=String(s),o.textContent=String(s)),r.addEventListener("input",()=>{let l=Number(r.value);o.textContent=String(l),Zr(ke(),i,l)})}K();var Hi=class{constructor(){this.container=null;this.currentVersion=null;this.availableVersions=[];this.isDevelopmentMode=!1}async initialize(e){this.container=e,this.isDevelopmentMode=typeof window!="undefined"&&document.querySelector('script[type="module"][src*="/@vite/"]')!==null,await this.loadVersionsList(),window.addEventListener("config:changed",()=>{this.refreshPanel()}),this.refreshPanel()}render(){let e=ai(),{hasChanges:t,overrideCount:i,overrides:a}=e,r={};for(let l of a){let c=l.objectId||"Engine";r[c]||(r[c]=[]),r[c].push(l)}let o=localStorage.getItem("handler_last_applied"),s=o?new Date(parseInt(o)).toLocaleString():"Never";return`
970
+ anchor: (${r}, ${o})`;navigator.clipboard.writeText(s).then(()=>console.log("[DEBUG] Config values copied to clipboard")).catch(y=>console.error("[DEBUG] Failed to copy config values:",y))}async function Xn(n,e){var p,u,g,m,f,h,b,y,v,x,w;if(console.log("[INSPECTOR] \u{1F527} applyObjectConfig called"),!n.container)return;let t=n.selectedObjectId;if(!t){console.warn("[PREVIEW] Apply object config clicked with no selection");return}let i=Number((u=(p=n.container.querySelector("#config-pos-x"))==null?void 0:p.value)!=null?u:0),a=Number((m=(g=n.container.querySelector("#config-pos-y"))==null?void 0:g.value)!=null?m:0),r=Number((h=(f=n.container.querySelector("#config-scale"))==null?void 0:f.value)!=null?h:1),o=Number((y=(b=n.container.querySelector("#config-anchor-x"))==null?void 0:b.value)!=null?y:.5),s=Number((x=(v=n.container.querySelector("#config-anchor-y"))==null?void 0:v.value)!=null?x:.5);console.log("[INSPECTOR] Applying config for:",t,{posX:i,posY:a,scale:r,anchorX:o,anchorY:s});let{applyConfigOverride:l}=await Promise.resolve().then(()=>(K(),Je));l({objectId:t,path:"transform.position",value:{x:i,y:a}},{silent:e==null?void 0:e.silent}),l({objectId:t,path:"transform.scale",value:r},{silent:e==null?void 0:e.silent}),l({objectId:t,path:"transform.anchor",value:{x:o,y:s}},{silent:e==null?void 0:e.silent});let c=Pt(n);Kn(c)&&l({objectId:t,path:"transform.offset",value:{x:i,y:a}},{silent:!0}),console.log("[INSPECTOR] Calling applyEditableObjectConfig...");let d=window.applyEditableObjectConfig;if(typeof d=="function"){let E=(w=window.getEditableObjectConfig)==null?void 0:w.call(window,t);E?(console.log("[INSPECTOR] \u2705 Calling applyEditableObjectConfig for:",t),d(t,E)):console.warn("[INSPECTOR] \u26A0\uFE0F No config found for:",t)}else console.warn("[INSPECTOR] \u26A0\uFE0F applyEditableObjectConfig not available")}async function io(n,e,t){let{applyConfigOverride:i}=await Promise.resolve().then(()=>(K(),Je));Object.entries(e.assets).forEach(([l,c])=>{i({path:`assets.${l}`,value:c},{silent:!0})}),Object.entries(e.runtime.theme).forEach(([l,c])=>{i({path:`runtime.theme.${l}`,value:c},{silent:!0})}),Object.entries(e.runtime.ui).forEach(([l,c])=>{i({path:`runtime.ui.${l}`,value:c},{silent:!0})}),Object.entries(e.runtime.fonts).forEach(([l,c])=>{i({path:`runtime.fonts.${l}`,value:c},{silent:!0})}),Object.entries(e.runtime.audio).forEach(([l,c])=>{i({path:`runtime.audio.${l}`,value:c},{silent:!0})});let a=window.applyEditableEngineConfig;if(typeof a=="function"){let l={theme:e.runtime.theme,fonts:e.runtime.fonts,audio:e.runtime.audio},c={};Object.entries(e.runtime.ui).forEach(([d,p])=>{var u;if(d)if(d.includes(".")){let g=d.split("."),m=c;for(let f=0;f<g.length-1;f++){let h=g[f];m[h]=(u=m[h])!=null?u:{},m=m[h]}m[g[g.length-1]]=p}else c[d]=p}),l.ui=c,a({runtime:l,assets:e.assets})}let r=Object.values(e.assets).some(l=>/^(blob:|data:)/.test(l)),o=(t==null?void 0:t.source)!=="auto"&&!r,s=window.__previewShell;o&&(s!=null&&s.refresh)&&s.refresh()}function no(n){n.selectedObjectId&&(n.objectAutoApplyTimer&&window.clearTimeout(n.objectAutoApplyTimer),n.objectAutoApplyTimer=window.setTimeout(()=>{n.objectAutoApplyTimer=null,Xn(n,{silent:!0})},150))}var Gs=3e3;function Mt(n,e,t){let i=t!=null?t:n.offsetParent;if(!i)return;e.style.cursor="move";let a=!1,r=0,o=0,s=c=>{if(!a)return;let d=i.getBoundingClientRect(),p=c.clientX-d.left-r,u=c.clientY-d.top-o;n.style.left=`${p}px`,n.style.top=`${u}px`},l=()=>{a&&(a=!1,n.classList.remove("dragging"),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l))};e.addEventListener("pointerdown",c=>{if(c.button!==0)return;let d=c.target;if(d!=null&&d.closest("button, input, select, textarea"))return;c.preventDefault();let p=n.getBoundingClientRect(),u=i.getBoundingClientRect();r=c.clientX-p.left,o=c.clientY-p.top,n.style.left=`${p.left-u.left}px`,n.style.top=`${p.top-u.top}px`,n.style.right="auto",n.style.bottom="auto",n.style.zIndex=String(++Gs),a=!0,n.classList.add("dragging"),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l)})}function Jn(n,e,t,i=280,a=200){e.style.cursor="nwse-resize";let r=0,o=0,s=0,l=0,c=!1,d=u=>{if(!c)return;let g=u.clientX-s,m=u.clientY-l,f=Math.max(i,r+g),h=Math.max(a,o+m);n.style.width=`${f}px`,n.style.height=`${h}px`,t==null||t(f,h)},p=()=>{c&&(c=!1,window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",p))};e.addEventListener("pointerdown",u=>{if(u.button!==0)return;u.preventDefault(),u.stopPropagation();let g=n.getBoundingClientRect();r=g.width,o=g.height,s=u.clientX,l=u.clientY,c=!0,window.addEventListener("pointermove",d),window.addEventListener("pointerup",p)})}function Zn(n,e){var f,h,b,y;let t=(b=(h=(f=n.container)==null?void 0:f.querySelector("#debug-overlay"))!=null?h:n.debugOverlay)!=null?b:e.offsetParent;if(!t||(y=n.container)!=null&&y.classList.contains("layout-fixed"))return;let i=t.getBoundingClientRect(),a=e.getBoundingClientRect(),r=12,o=Math.max(250,Math.floor(i.width-r*2)),s=Math.max(200,Math.floor(i.height-r*2));a.width>o&&(e.style.width=`${o}px`),a.height>s&&(e.style.height=`${s}px`);let l=e.getBoundingClientRect(),c=l.left-i.left,d=l.top-i.top,p=Math.max(r,i.width-l.width-r),u=Math.max(r,i.height-l.height-r),g=Math.min(Math.max(c,r),p),m=Math.min(Math.max(d,r),u);e.style.left=`${Math.round(g)}px`,e.style.top=`${Math.round(m)}px`,e.style.right="auto",e.style.bottom="auto"}function Ne(n){var i;if(!n.container)return;let e=n.container.querySelector("#debug-workbench");if(!e)return;if(Zn(n,e),(i=n.container)!=null&&i.classList.contains("layout-fixed")){let a=localStorage.getItem("preview_workbench_state"),r={activeTab:n.activeTab};if(a)try{r={...JSON.parse(a),activeTab:n.activeTab}}catch{}localStorage.setItem("preview_workbench_state",JSON.stringify(r));return}let t={activeTab:n.activeTab,width:e.style.width,height:e.style.height,left:e.style.left,top:e.style.top};localStorage.setItem("preview_workbench_state",JSON.stringify(t))}function zi(n){try{let e=localStorage.getItem("preview_workbench_state");if(!e)return;let t=JSON.parse(e);t.activeTab&&(n.activeTab=t.activeTab),window.requestAnimationFrame(()=>{var a;let i=(a=n.container)==null?void 0:a.querySelector("#debug-workbench");i&&(t.width&&(i.style.width=t.width),t.height&&(i.style.height=t.height),t.left&&(i.style.left=t.left,i.style.right="auto"),t.top&&(i.style.top=t.top,i.style.bottom="auto"),Zn(n,i))})}catch(e){console.warn("[PREVIEW] Failed to load workbench state",e)}}function Qn(n,e){let t=e.getBoundingClientRect();(t.left<0||t.top<0||t.right>window.innerWidth||t.bottom>window.innerHeight)&&(console.warn("[Workbench] Workbench positioned outside viewport, repositioning..."),e.style.left="16px",e.style.top="72px",e.style.right="auto",e.style.bottom="auto",Zn(n,e),Ne(n))}function ao(n){var a,r,o;if(!n.container)return;let e=n.container,t=e.querySelector("#debug-toggle");t||console.warn("[PREVIEW] Debug toggle not found in DOM"),t==null||t.addEventListener("click",()=>{var s;console.log("[PREVIEW] Debug toggle clicked"),(s=n.toggleDebug)==null||s.call(n)}),(a=e.querySelector("#debug-close"))==null||a.addEventListener("click",()=>{var s;return(s=n.toggleDebug)==null?void 0:s.call(n,!1)}),(r=e.querySelector("#debug-reset"))==null||r.addEventListener("click",()=>Di(n)),(o=e.querySelector("#debug-export"))==null||o.addEventListener("click",()=>$i(n)),e.querySelectorAll(".workbench-tab").forEach(s=>{s.addEventListener("click",()=>{let l=s.dataset.tab;n.activeTab=l,ea(n),Ne(n)})}),ia(n,e),ta(n,e)}function ea(n){if(!n.container)return;let e=n.container;e.querySelectorAll(".workbench-tab").forEach(a=>{let r=a.dataset.tab;a.classList.toggle("active",r===n.activeTab)}),e.querySelectorAll(".workbench-tab-panel").forEach(a=>{let r=a.dataset.tabPanel;a.classList.toggle("active",r===n.activeTab)})}function ta(n,e){te(n,e,"debug-layout-scale","layout.scale_multiplier","#debug-layout-scale-value"),te(n,e,"debug-layout-offset-x","layout.position_offset.x","#debug-layout-offset-x-value"),te(n,e,"debug-layout-offset-y","layout.position_offset.y","#debug-layout-offset-y-value"),te(n,e,"debug-rect-thickness","layout.debug_rect_thickness","#debug-rect-thickness-value"),te(n,e,"debug-engine-scale","engine.scale","#debug-engine-scale-value"),te(n,e,"debug-background-scale","engine.background_scale","#debug-background-scale-value"),te(n,e,"debug-label-pulse-speed","engine.label_pulse_speed","#debug-label-pulse-speed-value"),te(n,e,"debug-label-pulse-intensity","engine.label_pulse_intensity","#debug-label-pulse-intensity-value"),te(n,e,"debug-rope-length","physics.rope_length","#debug-rope-length-value");let t=e.querySelector("#debug-rect-visible");t==null||t.addEventListener("change",()=>{let a=ke();a.layout&&(a.layout.debug_rect_visible=!!t.checked)});let i=e.querySelector("#debug-rect-color");i==null||i.addEventListener("input",()=>{let a=i.value.replace("#",""),r=parseInt(a,16),o=ke();o.layout&&(o.layout.debug_rect_color=Number.isFinite(r)?r:16711680)})}function ro(n){if(!n.container||!n.debugOverlay)return;let e=n.container.querySelector("#debug-workbench"),t=n.container.querySelector("#workbench-handle"),i=n.container.querySelector("#workbench-resize");e&&t&&(!e.style.left&&!e.style.right&&!e.style.top&&!e.style.bottom&&(e.style.right="16px",e.style.top="72px"),Mt(e,t,n.debugOverlay),t.addEventListener("pointerup",()=>{setTimeout(()=>{Ne(n),Qn(n,e)},10)}));let a=n.container.querySelector('[data-panel="scene-objects"]'),r=a==null?void 0:a.querySelector("[data-panel-handle]"),o=a==null?void 0:a.querySelector("[data-panel-resize-v]");a&&r&&(!a.style.left&&!a.style.right&&!a.style.top&&!a.style.bottom&&(a.style.left="16px",a.style.top="72px"),Mt(a,r,n.debugOverlay),r.addEventListener("pointerup",()=>{setTimeout(()=>{Qn(n,a)},10)})),a&&o&&Jn(a,o);let s=n.container.querySelector('[data-panel="scene-tools-corner"]'),l=s==null?void 0:s.querySelector("[data-panel-handle]"),c=n.container.querySelector(".preview-main");s&&l&&c&&Mt(s,l,c);let d=n.container.querySelector('[data-panel="nudge-panel"]'),p=d==null?void 0:d.querySelector("[data-panel-handle]");d&&p&&c&&Mt(d,p,c),e&&i&&Jn(e,i,()=>Ne(n)),zi(n)}function ia(n,e){Array.from(e.querySelectorAll("[data-panel-toggle]")).forEach(i=>{i.addEventListener("click",()=>{let a=i.closest(".scene-panel");a&&a.classList.toggle("collapsed")})})}function te(n,e,t,i,a){let r=e.querySelector(`#${t}`),o=e.querySelector(a);if(!r||!o)return;let s=Jr(ke(),i);typeof s=="number"&&(r.value=String(s),o.textContent=String(s)),r.addEventListener("input",()=>{let l=Number(r.value);o.textContent=String(l),Zr(ke(),i,l)})}K();var Hi=class{constructor(){this.container=null;this.currentVersion=null;this.availableVersions=[];this.isDevelopmentMode=!1}async initialize(e){this.container=e,this.isDevelopmentMode=typeof window!="undefined"&&document.querySelector('script[type="module"][src*="/@vite/"]')!==null,await this.loadVersionsList(),window.addEventListener("config:changed",()=>{this.refreshPanel()}),this.refreshPanel()}render(){let e=ai(),{hasChanges:t,overrideCount:i,overrides:a}=e,r={};for(let l of a){let c=l.objectId||"Engine";r[c]||(r[c]=[]),r[c].push(l)}let o=localStorage.getItem("handler_last_applied"),s=o?new Date(parseInt(o)).toLocaleString():"Never";return`
971
971
  <div class="config-persistence-panel">
972
972
  <div class="persistence-status-bar ${t?"has-changes":"no-changes"}">
973
973
  ${t?`
@@ -1120,7 +1120,7 @@ This will DIRECTLY MODIFY your base configuration files WITHOUT creating a snaps
1120
1120
 
1121
1121
  This cannot be undone unless you have git commits or backups.
1122
1122
 
1123
- Are you absolutely sure?`))try{let t=De(),i={};for(let[r,o]of Object.entries(t.objects)){let s=o,l=r;/^(json\.|ui\.|effects\.|engine\.)/.test(l)||(l=`json.${r}`),s&&typeof s=="object"&&(s.identity||(s.identity={}),s.identity.id=l),i[`objects/${l}.json`]=s}t.engine&&(t.engine.runtime&&(i["engine/engine.runtime.json"]=t.engine.runtime),t.engine.assets&&(i["engine/engine.assets.json"]=t.engine.assets),t.engine.splash&&(i["engine/engine.splash.json"]=t.engine.splash),t.engine.loading&&(i["engine/engine.loading.json"]=t.engine.loading),t.engine.start&&(i["engine/engine.start.json"]=t.engine.start),t.engine.tutorial&&(i["engine/engine.tutorial.json"]=t.engine.tutorial),t.engine.endgame&&(i["engine/engine.endgame.json"]=t.engine.endgame),!t.engine.runtime&&!t.engine.assets&&(i["engine/engine.json"]=t.engine));for(let[r,o]of Object.entries(t.scenes)){let s=r.startsWith("scene.")?r:`scene.${r}`;i[`scenes/${s}.json`]=o}let a=await fetch("/api/apply-direct",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configs:i,assets:{}})});if(!a.ok){let r=await a.json();throw new Error(r.error||"Direct apply failed")}se(),this.showSuccessNotification(),this.refreshPanel()}catch(t){console.error("[ConfigPersistence] Direct apply failed:",t),alert(`\u274C Direct apply failed: ${t.message}`)}}};var Ot=class{constructor(){this.debugOverlay=null;this.isDebugOpen=!1;this.selectedObjectId=null;this.configViewer=null;this.container=null;this.objectAutoApplyTimer=null;this.objectDebugRaf=null;this.objectBoundsGfx=null;this.objectAnchorGfx=null;this.highlightObject=!1;this.highlightAnchor=!1;this.activeTab="hierarchy";this.sceneObjectsPanel=new gi;this.sceneToolsPanel=new fi;this.nudgePanel=new hi;this.inspectorPanel=new Li;this.libraryPanel=new Ct;this.libraryPanelDocked=new Ct;this.brandVisionPanel=new Pi;this.customizeSettingsPanel=new Mi;this.configPersistencePanel=new Hi;this.loadingScreenPanel=new Oi}applyAssetChange(e,t){return Fr(this,e,t)}resetAsset(e){return Ur(this,e)}applySlotAsset(e,t,i){return Gr(this,e,t,i)}resetSlotAsset(e,t,i){return qr(this,e,t,i)}startObjectVisuals(){return Kr(this)}stopObjectVisuals(){return Xr(this)}shouldRunObjectVisuals(){return Ii(this)}updateObjectVisuals(){return ji(this)}getSelectedInstanceId(){return Hn(this)}getDisplayObjectById(e){return Nn(this,e)}getSelectedObjectConfig(){return Pt(this)}getConfigAnchorWorldPoint(e){return Bn(this,e)}getScreenSize(){return Fn(this)}ensureBoundsGfx(){return Un(this)}ensureAnchorGfx(){return Gn(this)}drawBounds(e){return qn(this,e)}drawAnchor(e){return Vn(this,e)}clearBounds(){return Wn(this)}clearAnchor(){return Yn(this)}clearObjectVisuals(){return kt(this)}updateObjectInfo(e){return Lt(this,e)}resetDebugConfig(){return Di(this)}applyDebugConfig(){return Qr(this)}exportDebugConfig(){return $i(this)}loadObjectConfig(e){return eo(this,e)}fillConfigViewer(e){return Ri(this,e)}copyConfigValues(){return to(this)}applyObjectConfig(e){return Xn(this,e)}applyCustomizeSettings(e,t){return io(this,e,t)}scheduleObjectAutoApply(){return no(this)}setupDebugEventListeners(){return ao(this)}setupDebugInputListeners(e){return ta(this,e)}setupPanelLayout(){return ro(this)}setupCollapsiblePanels(e){return ia(this,e)}setupRangeInput(e,t,i,a){return te(this,e,t,i,a)}updateWorkbenchTabs(){return ea(this)}saveWorkbenchState(){return Ne(this)}loadWorkbenchState(){return zi(this)}initialize(e){var o;this.container=e,this.debugOverlay=e.querySelector(".debug-overlay"),this.configViewer=e.querySelector("#config-viewer");try{let s=localStorage.getItem("preview_workbench_state");if(s){let l=JSON.parse(s);l.activeTab&&(this.activeTab=l.activeTab)}}catch(s){console.warn("[PREVIEW] Failed to load workbench tab state",s)}this.sceneObjectsPanel.initialize(e,{onSelect:s=>this.handleObjectSelect(s)}),this.libraryPanel.initialize(e,{onApply:(s,l,c)=>this.applySlotAsset(s,l,c),onReset:(s,l,c)=>this.resetSlotAsset(s,l,c)});let t=e.querySelector("#dock-library-content");t&&(t.innerHTML=this.libraryPanelDocked.render(),this.libraryPanelDocked.initialize(e,{onApply:(s,l,c)=>this.applySlotAsset(s,l,c),onReset:(s,l,c)=>this.resetSlotAsset(s,l,c)})),this.inspectorPanel.initialize(e,{onPropertyChange:(s,l,c)=>{console.log("[Inspector] Property changed:",s,l,c)}}),this.brandVisionPanel.initialize(e,()=>{this.toggleDebug(!1);let s="/dashboard";window.location.pathname!==s&&(window.location.href=s)}),this.customizeSettingsPanel.initialize(e,{onApply:(s,l)=>this.applyCustomizeSettings(s,l)});let i=e.querySelector("#scene-tools-container");i&&(i.innerHTML=this.sceneToolsPanel.render());let a=e.querySelector("#nudge-panel-container");a&&(a.innerHTML=this.nudgePanel.render()),this.sceneToolsPanel.initialize(i||e,{onHighlightObject:s=>{this.highlightObject=s,s?this.selectedObjectId&&this.startObjectVisuals():this.stopObjectVisuals()},onHighlightAnchor:s=>{this.highlightAnchor=s,s?this.selectedObjectId&&this.startObjectVisuals():this.stopObjectVisuals()},onNudge:(s,l)=>this.nudgeSelectedObject(s,l),onShowSplash:()=>{let s=window;typeof s.__previewShowSplash=="function"&&s.__previewShowSplash()},onUpdateSplash:s=>{let l=window;typeof l.applyEditableEngineConfig=="function"&&l.applyEditableEngineConfig({splash:s})}}),this.nudgePanel.initialize(a||e,{onNudge:async(s,l)=>{var f,h,b,y,v,x;if(!this.selectedObjectId)return;let c=this.getSelectedObjectConfig();if(!c)return;let d=(f=c.transform)==null?void 0:f.position,p=((h=d==null?void 0:d.x)!=null?h:0)+s,u=((b=d==null?void 0:d.y)!=null?b:0)+l,{applyConfigOverride:g}=await Promise.resolve().then(()=>(K(),Je));g({objectId:this.selectedObjectId,path:"transform.position",value:{x:p,y:u}},{silent:!0,emitEvent:!0});let m=window.applyEditableObjectConfig;if(typeof m=="function"){let w=window.__editableConfig,E=(x=(v=(y=w==null?void 0:w.objects)==null?void 0:y.get)==null?void 0:v.call(y,this.selectedObjectId))!=null?x:c;await m(this.selectedObjectId,E)}window.dispatchEvent(new CustomEvent("inspector:refresh"))},onScale:async s=>{var g,m,f,h,b;if(!this.selectedObjectId)return;let l=this.getSelectedObjectConfig();if(!l)return;let c=(m=(g=l.transform)==null?void 0:g.scale)!=null?m:1,d=Math.max(.1,c+s),{applyConfigOverride:p}=await Promise.resolve().then(()=>(K(),Je));p({objectId:this.selectedObjectId,path:"transform.scale",value:d},{silent:!0,emitEvent:!0});let u=window.applyEditableObjectConfig;if(typeof u=="function"){let y=window.__editableConfig,v=(b=(h=(f=y==null?void 0:y.objects)==null?void 0:f.get)==null?void 0:h.call(f,this.selectedObjectId))!=null?b:l;await u(this.selectedObjectId,v)}window.dispatchEvent(new CustomEvent("inspector:refresh"))}});let r=i==null?void 0:i.querySelector("#debug-nudge-enabled");r==null||r.addEventListener("change",()=>{r.checked?this.nudgePanel.show():this.nudgePanel.hide()}),this.configPersistencePanel.initialize(e),this.loadingScreenPanel.initialize(e,{onShowLoadingScreen:()=>{let s=window;typeof s.__previewShowLoading=="function"?s.__previewShowLoading():console.warn("[DEBUG] __previewShowLoading not available")},onHideLoadingScreen:()=>{let s=window;typeof s.__previewHideLoading=="function"?s.__previewHideLoading():console.warn("[DEBUG] __previewHideLoading not available")},onUpdateLoading:s=>{let l=window;typeof l.applyEditableEngineConfig=="function"&&l.applyEditableEngineConfig({loading:s}),typeof l.__previewUpdateLoading=="function"?l.__previewUpdateLoading(s):console.warn("[DEBUG] __previewUpdateLoading not available")}}),window.__openAiEditor=(s,l,c,d)=>{this.customizeSettingsPanel.openAiEditor(s,l,c,d)},this.setupPanelLayout(),this.updateWorkbenchTabs(),window.__debugContext=this,window.__updateWorkbenchTabs=()=>this.updateWorkbenchTabs(),this.isDebugOpen=!0,(o=this.debugOverlay)==null||o.classList.remove("hidden"),this.updateDebugBadge(),this.sceneObjectsPanel.refreshObjects(),window.__previewSelectObject=s=>this.selectObject(s),window.addEventListener("config:changed",s=>{var l,c;((l=s.detail)==null?void 0:l.action)!=="remove"&&((c=s.detail)==null?void 0:c.action)!=="clear_object"&&this.highlightChangesTab()}),window.applyAssetToSlot=(s,l,c)=>this.applySlotAsset(s,l,c),window.refreshAssetLibrary=()=>this.libraryPanel.refresh(),window.reRenderAssetLibrary=()=>this.libraryPanel.reRender(),window.getEngineSplashConfig=()=>{var l;let s=window.getActiveConfig;if(typeof s=="function"){let c=s();return((l=c==null?void 0:c.engine)==null?void 0:l.splash)||null}return null},window.addAssetToRegistry=(s,l)=>{let c=window.getEditableAssets;if(typeof c=="function"){let d=c();if(d!=null&&d.libraryAssets&&(d.libraryAssets[s]||(d.libraryAssets[s]=[]),!d.libraryAssets[s].some(u=>u.filename===l))){let u=l.replace(/\.(png|jpg|jpeg)$/i,"").replace(/_/g," ");d.libraryAssets[s].unshift({filename:l,displayName:u}),console.log(`[DEBUG] Added ${l} to registry category ${s}`)}}},window.__highlightLibrarySlot=(s,l)=>{this.libraryPanel.highlightSlot(s,l)}}selectObject(e){this.handleObjectSelect(e),this.activeTab!=="inspector"&&this.activeTab!=="ai"&&this.setActiveTab("inspector")}setActiveTab(e){this.activeTab=e,this.updateWorkbenchTabs(),this.saveWorkbenchState()}highlightChangesTab(){var t;let e=(t=this.container)==null?void 0:t.querySelector('[data-tab="changes"]');e&&e.classList.add("has-pending-changes")}getDebugOverlayHTML(){return`
1123
+ Are you absolutely sure?`))try{let t=De(),i={};for(let[r,o]of Object.entries(t.objects)){let s=o,l=r;/^(json\.|ui\.|effects\.|engine\.)/.test(l)||(l=`json.${r}`),s&&typeof s=="object"&&(s.identity||(s.identity={}),s.identity.id=l),i[`objects/${l}.json`]=s}t.engine&&(t.engine.runtime&&(i["engine/engine.runtime.json"]=t.engine.runtime),t.engine.assets&&(i["engine/engine.assets.json"]=t.engine.assets),t.engine.splash&&(i["engine/engine.splash.json"]=t.engine.splash),t.engine.loading&&(i["engine/engine.loading.json"]=t.engine.loading),t.engine.start&&(i["engine/engine.start.json"]=t.engine.start),t.engine.tutorial&&(i["engine/engine.tutorial.json"]=t.engine.tutorial),t.engine.endgame&&(i["engine/engine.endgame.json"]=t.engine.endgame),!t.engine.runtime&&!t.engine.assets&&(i["engine/engine.json"]=t.engine));for(let[r,o]of Object.entries(t.scenes)){let s=r.startsWith("scene.")?r:`scene.${r}`;i[`scenes/${s}.json`]=o}let a=await fetch("/api/apply-direct",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configs:i,assets:{}})});if(!a.ok){let r=await a.json();throw new Error(r.error||"Direct apply failed")}se(),this.showSuccessNotification(),this.refreshPanel()}catch(t){console.error("[ConfigPersistence] Direct apply failed:",t),alert(`\u274C Direct apply failed: ${t.message}`)}}};var Ot=class{constructor(){this.debugOverlay=null;this.isDebugOpen=!1;this.selectedObjectId=null;this.configViewer=null;this.container=null;this.objectAutoApplyTimer=null;this.objectDebugRaf=null;this.objectBoundsGfx=null;this.objectAnchorGfx=null;this.highlightObject=!1;this.highlightAnchor=!1;this.activeTab="hierarchy";this.sceneObjectsPanel=new gi;this.sceneToolsPanel=new fi;this.nudgePanel=new hi;this.inspectorPanel=new Li;this.libraryPanel=new Ct;this.libraryPanelDocked=new Ct;this.brandVisionPanel=new Pi;this.customizeSettingsPanel=new Mi;this.configPersistencePanel=new Hi;this.loadingScreenPanel=new Oi}applyAssetChange(e,t){return Fr(this,e,t)}resetAsset(e){return Ur(this,e)}applySlotAsset(e,t,i){return Gr(this,e,t,i)}resetSlotAsset(e,t,i){return qr(this,e,t,i)}startObjectVisuals(){return Kr(this)}stopObjectVisuals(){return Xr(this)}shouldRunObjectVisuals(){return Ii(this)}updateObjectVisuals(){return ji(this)}getSelectedInstanceId(){return Hn(this)}getDisplayObjectById(e){return Nn(this,e)}getSelectedObjectConfig(){return Pt(this)}getConfigAnchorWorldPoint(e){return Bn(this,e)}getScreenSize(){return Fn(this)}ensureBoundsGfx(){return Un(this)}ensureAnchorGfx(){return Gn(this)}drawBounds(e){return qn(this,e)}drawAnchor(e){return Vn(this,e)}clearBounds(){return Wn(this)}clearAnchor(){return Yn(this)}clearObjectVisuals(){return kt(this)}updateObjectInfo(e){return Lt(this,e)}resetDebugConfig(){return Di(this)}applyDebugConfig(){return Qr(this)}exportDebugConfig(){return $i(this)}loadObjectConfig(e){return eo(this,e)}fillConfigViewer(e){return Ri(this,e)}copyConfigValues(){return to(this)}applyObjectConfig(e){return Xn(this,e)}applyCustomizeSettings(e,t){return io(this,e,t)}scheduleObjectAutoApply(){return no(this)}setupDebugEventListeners(){return ao(this)}setupDebugInputListeners(e){return ta(this,e)}setupPanelLayout(){return ro(this)}setupCollapsiblePanels(e){return ia(this,e)}setupRangeInput(e,t,i,a){return te(this,e,t,i,a)}updateWorkbenchTabs(){return ea(this)}saveWorkbenchState(){return Ne(this)}loadWorkbenchState(){return zi(this)}initialize(e){var o;this.container=e,this.debugOverlay=e.querySelector(".debug-overlay"),this.configViewer=e.querySelector("#config-viewer");try{let s=localStorage.getItem("preview_workbench_state");if(s){let l=JSON.parse(s);l.activeTab&&(this.activeTab=l.activeTab)}}catch(s){console.warn("[PREVIEW] Failed to load workbench tab state",s)}this.sceneObjectsPanel.initialize(e,{onSelect:s=>this.handleObjectSelect(s)}),this.libraryPanel.initialize(e,{onApply:(s,l,c)=>this.applySlotAsset(s,l,c),onReset:(s,l,c)=>this.resetSlotAsset(s,l,c)});let t=e.querySelector("#dock-library-content");t&&(t.innerHTML=this.libraryPanelDocked.render(),this.libraryPanelDocked.initialize(t,{onApply:(s,l,c)=>this.applySlotAsset(s,l,c),onReset:(s,l,c)=>this.resetSlotAsset(s,l,c)})),this.inspectorPanel.initialize(e,{onPropertyChange:(s,l,c)=>{console.log("[Inspector] Property changed:",s,l,c)}}),this.brandVisionPanel.initialize(e,()=>{this.toggleDebug(!1);let s="/dashboard";window.location.pathname!==s&&(window.location.href=s)}),this.customizeSettingsPanel.initialize(e,{onApply:(s,l)=>this.applyCustomizeSettings(s,l)});let i=e.querySelector("#scene-tools-container");i&&(i.innerHTML=this.sceneToolsPanel.render());let a=e.querySelector("#nudge-panel-container");a&&(a.innerHTML=this.nudgePanel.render()),this.sceneToolsPanel.initialize(i||e,{onHighlightObject:s=>{this.highlightObject=s,s?this.selectedObjectId&&this.startObjectVisuals():this.stopObjectVisuals()},onHighlightAnchor:s=>{this.highlightAnchor=s,s?this.selectedObjectId&&this.startObjectVisuals():this.stopObjectVisuals()},onNudge:(s,l)=>this.nudgeSelectedObject(s,l),onShowSplash:()=>{let s=window;typeof s.__previewShowSplash=="function"&&s.__previewShowSplash()},onUpdateSplash:s=>{let l=window;typeof l.applyEditableEngineConfig=="function"&&l.applyEditableEngineConfig({splash:s})}}),this.nudgePanel.initialize(a||e,{onNudge:async(s,l)=>{var f,h,b,y,v,x;if(!this.selectedObjectId)return;let c=this.getSelectedObjectConfig();if(!c)return;let d=(f=c.transform)==null?void 0:f.position,p=((h=d==null?void 0:d.x)!=null?h:0)+s,u=((b=d==null?void 0:d.y)!=null?b:0)+l,{applyConfigOverride:g}=await Promise.resolve().then(()=>(K(),Je));g({objectId:this.selectedObjectId,path:"transform.position",value:{x:p,y:u}},{silent:!0,emitEvent:!0});let m=window.applyEditableObjectConfig;if(typeof m=="function"){let w=window.__editableConfig,E=(x=(v=(y=w==null?void 0:w.objects)==null?void 0:y.get)==null?void 0:v.call(y,this.selectedObjectId))!=null?x:c;await m(this.selectedObjectId,E)}window.dispatchEvent(new CustomEvent("inspector:refresh"))},onScale:async s=>{var g,m,f,h,b;if(!this.selectedObjectId)return;let l=this.getSelectedObjectConfig();if(!l)return;let c=(m=(g=l.transform)==null?void 0:g.scale)!=null?m:1,d=Math.max(.1,c+s),{applyConfigOverride:p}=await Promise.resolve().then(()=>(K(),Je));p({objectId:this.selectedObjectId,path:"transform.scale",value:d},{silent:!0,emitEvent:!0});let u=window.applyEditableObjectConfig;if(typeof u=="function"){let y=window.__editableConfig,v=(b=(h=(f=y==null?void 0:y.objects)==null?void 0:f.get)==null?void 0:h.call(f,this.selectedObjectId))!=null?b:l;await u(this.selectedObjectId,v)}window.dispatchEvent(new CustomEvent("inspector:refresh"))}});let r=i==null?void 0:i.querySelector("#debug-nudge-enabled");r==null||r.addEventListener("change",()=>{r.checked?this.nudgePanel.show():this.nudgePanel.hide()}),this.configPersistencePanel.initialize(e),this.loadingScreenPanel.initialize(e,{onShowLoadingScreen:()=>{let s=window;typeof s.__previewShowLoading=="function"?s.__previewShowLoading():console.warn("[DEBUG] __previewShowLoading not available")},onHideLoadingScreen:()=>{let s=window;typeof s.__previewHideLoading=="function"?s.__previewHideLoading():console.warn("[DEBUG] __previewHideLoading not available")},onUpdateLoading:s=>{let l=window;typeof l.applyEditableEngineConfig=="function"&&l.applyEditableEngineConfig({loading:s}),typeof l.__previewUpdateLoading=="function"?l.__previewUpdateLoading(s):console.warn("[DEBUG] __previewUpdateLoading not available")}}),window.__openAiEditor=(s,l,c,d)=>{this.customizeSettingsPanel.openAiEditor(s,l,c,d)},this.setupPanelLayout(),this.updateWorkbenchTabs(),window.__debugContext=this,window.__updateWorkbenchTabs=()=>this.updateWorkbenchTabs(),this.isDebugOpen=!0,(o=this.debugOverlay)==null||o.classList.remove("hidden"),this.updateDebugBadge(),this.sceneObjectsPanel.refreshObjects(),window.__previewSelectObject=s=>this.selectObject(s),window.addEventListener("config:changed",s=>{var l,c;((l=s.detail)==null?void 0:l.action)!=="remove"&&((c=s.detail)==null?void 0:c.action)!=="clear_object"&&this.highlightChangesTab()}),window.applyAssetToSlot=(s,l,c)=>this.applySlotAsset(s,l,c),window.refreshAssetLibrary=()=>this.libraryPanel.refresh(),window.reRenderAssetLibrary=()=>this.libraryPanel.reRender(),window.getEngineSplashConfig=()=>{var l;let s=window.getActiveConfig;if(typeof s=="function"){let c=s();return((l=c==null?void 0:c.engine)==null?void 0:l.splash)||null}return null},window.addAssetToRegistry=(s,l)=>{let c=window.getEditableAssets;if(typeof c=="function"){let d=c();if(d!=null&&d.libraryAssets&&(d.libraryAssets[s]||(d.libraryAssets[s]=[]),!d.libraryAssets[s].some(u=>u.filename===l))){let u=l.replace(/\.(png|jpg|jpeg)$/i,"").replace(/_/g," ");d.libraryAssets[s].unshift({filename:l,displayName:u}),console.log(`[DEBUG] Added ${l} to registry category ${s}`)}}},window.__highlightLibrarySlot=(s,l)=>{this.libraryPanel.highlightSlot(s,l)}}selectObject(e){this.handleObjectSelect(e),this.activeTab!=="inspector"&&this.activeTab!=="ai"&&this.setActiveTab("inspector")}setActiveTab(e){this.activeTab=e,this.updateWorkbenchTabs(),this.saveWorkbenchState()}highlightChangesTab(){var t;let e=(t=this.container)==null?void 0:t.querySelector('[data-tab="changes"]');e&&e.classList.add("has-pending-changes")}getDebugOverlayHTML(){return`
1124
1124
  <div class="debug-overlay hidden" id="debug-overlay">
1125
1125
  <div class="debug-workbench" id="debug-workbench">
1126
1126
  <div class="workbench-header" id="workbench-handle">
@@ -1493,6 +1493,7 @@ Style guidelines: ${i.summary}`;this.promptInput.value=a,this.currentPrompt=a}}c
1493
1493
  ${((t=this.debugPanel)==null?void 0:t.getDebugOverlayHTML())||""}
1494
1494
 
1495
1495
  <div class="bottom-dock" id="bottom-dock">
1496
+ <div class="bottom-dock-resize-handle" id="bottom-dock-resize"></div>
1496
1497
  <div class="bottom-dock-header">
1497
1498
  <div class="bottom-dock-tabs">
1498
1499
  <button class="bottom-dock-tab active" data-dock-tab="library">Library</button>
@@ -1506,7 +1507,6 @@ Style guidelines: ${i.summary}`;this.promptInput.value=a,this.currentPrompt=a}}c
1506
1507
  <div class="bottom-dock-panel active" data-dock-panel="library" id="dock-library-content"></div>
1507
1508
  <div class="bottom-dock-panel" data-dock-panel="console" id="dock-console-content"></div>
1508
1509
  </div>
1509
- <div class="bottom-dock-resize-handle" id="bottom-dock-resize"></div>
1510
1510
  </div>
1511
1511
 
1512
1512
  </div>
package/dist/index.css CHANGED
@@ -2967,7 +2967,7 @@
2967
2967
 
2968
2968
  .bottom-dock-resize-handle {
2969
2969
  position: absolute;
2970
- bottom: 0;
2970
+ top: 0;
2971
2971
  left: 0;
2972
2972
  right: 0;
2973
2973
  height: 4px;
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-XGJ2QPBX.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-JXBG6UFL.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};
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-SCQFSOPI.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-JXBG6UFL.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};
@@ -43,7 +43,7 @@
43
43
  <button class="debug-btn primary" data-modal-apply>Apply</button>
44
44
  </div>
45
45
  </div>
46
- `,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Hr={};Vi(Hr,{AssetCache:()=>Q,AssetLoader:()=>fe,AssetSystem:()=>It,AssetTextures:()=>he,Assets:()=>pa,BaseSystem:()=>He,GameEngine:()=>Ot,GameObject:()=>st,GameObjectManager:()=>$e,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>Ne,Transform:()=>rt,applyScreenAnchor:()=>Dt,basePixi:()=>sa,clearResponsiveElements:()=>ga,createPixiBase:()=>Pt,getRegisteredFontIds:()=>na,globalResponsiveMultipliers:()=>ct,initAssetTextures:()=>At,initAssets:()=>ua,layout:()=>ha,playLottieOverlay:()=>ra,registerFont:()=>ia,registerType:()=>wt,resolveAnchorVec2:()=>Ce,resolveFont:()=>ea,resolveFontWeight:()=>ta,resolveScreenAnchorPoint:()=>Be,resolveScreenRatioPoint:()=>Fe,runInitSequence:()=>ma,setLottieInstance:()=>St,spawnSceneFromConfig:()=>ca,updateScreenState:()=>Rt});module.exports=Ea(Hr);var Qn=require("pixi.js");var pe={};function mt(i,e,t=!1){pe[i]||(pe[i]=[]),pe[i].push({fn:e,once:t})}function Gt(i,e){if(pe[i]){if(!e){delete pe[i];return}pe[i]=pe[i].filter(t=>t.fn!==e)}}function bt(i,...e){let t=pe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&Gt(i,n.fn)}function q(i,e){mt(i,e,!0)}var D=null,Y=[],Te=null;function Xi(i){D=i,Y=[],Te!==null&&(clearTimeout(Te),Te=null)}function Ji(){var i,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(i=D==null?void 0:D.batchSize)!=null?i:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Yi(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(r){n&&console.warn("[handler.telemetry] fetch failed",r)}}function qt(i,e){let t=Ji();if(e&&t.endpoint){if(Y.push(i),Y.length>t.maxQueue&&(Y=Y.slice(Y.length-t.maxQueue)),Y.length>=t.batchSize){Ki();return}Te===null&&(Te=window.setTimeout(()=>{Te=null,Ki()},t.flushIntervalMs))}}async function Ki(){let i=Ji();if(!i.endpoint||Y.length===0)return;let e=Y.splice(0,i.batchSize);await Yi(i.endpoint,{events:e},i.transport,i.debug),Y.length>0&&await Yi(i.endpoint,{events:Y.splice(0,i.batchSize)},i.transport,i.debug)}function Zi(i){return Math.max(0,Math.min(1,i))}function Aa(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sa(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Qi(i,e,t){try{i[e]=t}catch{}}function Ca(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function en(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function tn(i,e){let t=Ca(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function nn(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),i.size>0&&n()})},a=u=>{var p;i.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),n()},r=u=>{i.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},o=u=>{u.killed||(u.killed=!0,r(u))},s=()=>{var l,p;let u=Ke();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,A=Zi(h),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let y=h-f;A=Zi(y)}let x=g.ease(A);g.yoyo&&f%2===1&&(x=1-x);for(let y of g.props)Qi(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&en(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(h>=b){o(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),h=Aa(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let I of Object.keys(l)){if(f.has(I))continue;let R=l[I];typeof R=="number"&&x.push({key:I,from:Sa(u,I),to:R})}let w=tn(u,l);return{target:u,startMs:Ke(),delayMs:m,durationMs:g,ease:h,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>o(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ke())},resume:()=>{var h;if(!p.paused)return;let g=(h=p.pauseAtMs)!=null?h:Ke(),m=Ke()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Qi(u,g,m)}let p=tn(u,l);p.to&&en(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))o(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],h=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let x=typeof f=="string"?f.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=f=>{l.push(f);let x=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+x)},b={to(f,x,w){return A({kind:"to",target:f,vars:x,atMs:h(w)}),b},fromTo(f,x,w,y){return A({kind:"fromTo",target:f,vars:w,from:x,atMs:h(y)}),b},play(){var f,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(f=w.from)!=null?f:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let f of m)f.pause();return b},kill(){for(let f of m)f.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function an(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=nn()}catch{}}var rn={name:"handler-playable-sdk",version:"0.4.2",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",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,La=V++,on=V++,sn=V++,ln=V++,cn=V++,dn=V++,pn=V++,un=V++,gn=V++,fn=V++,hn=V++,mn=V++,M=La;function bn(){return M===on}function yn(){return M===sn}function vn(){return M===ln}function xn(){return M===cn}function Le(){return M===dn}function ke(){return M===pn}function wn(){return M===un}function En(){return M===gn}function An(){return M===fn}function Vt(){return M===hn}function Wt(){return M===mn}function Sn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),M=on;return}catch{}else if(i==="dapi")try{dapi.isReady(),M=sn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(M=ln)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(M=cn)}catch{}else if(e==="mintegral")window.gameReady&&(M=dn);else if(e==="tapjoy")window.TJ_API&&(M=pn);else if(e==="tiktok")window.openAppStore&&(M=un);else if(e==="smadex")try{window.smxTracking&&(M=gn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(M=fn)}catch{}else e==="vungle"?M=hn:(i==="nucleo"||e==="nucleo")&&(M=mn)}var yt=ht(require("lottie-web"),1),Cn=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);Xt();function $(i,e){let t=(a,r)=>r===0?a:t(r,a%r),n=t(i,e);return`${i/n}:${e/n}`}var vo=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],xo=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],wo=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Eo=[..._n];var Ra=_n[0];ue();var Ba=ht(require("jszip"),1);function za(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Ha(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Na(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function Jt(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await za(a),o=await Na(r),s=Ha(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(t=o==null?void 0:o.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function vt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let r=a.getImageData(0,0,n.width,n.height),o=r.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(l=>({r:o[l.offset],g:o[l.offset+1],b:o[l.offset+2]})),c=0;for(let l=0;l<o.length;l+=4){let p=o[l],g=o[l+1],m=o[l+2],h=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){h=!0;break}h&&(o[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var Pn=require("@google/genai");async function Zt(i,e,t=[],n={}){var a,r,o,s,d,c,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let l=new Pn.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),h="",A=(o=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(A)for(let b of A)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(l){throw console.error("[Gemini] API error:",l),(s=l.message)!=null&&s.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=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Mn=require("@google/genai");async function xt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Mn.GoogleGenAI({apiKey:i}),r=[{text:e}];t.length>0&&t.forEach((s,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let d=s.inlineData.data,c=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");Xe();ue();var $n=require("pixi.js");var Ya=require("pixi.js");ue();function tr(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function ir(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function nr(i){return`
46
+ `,this.modal=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(o=>{o.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(o=>{o.addEventListener("click",s=>{let c=s.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let r=this.modal.querySelector("[data-modal-apply]");r==null||r.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",o=>{o.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Hr={};Vi(Hr,{AssetCache:()=>Q,AssetLoader:()=>fe,AssetSystem:()=>It,AssetTextures:()=>he,Assets:()=>pa,BaseSystem:()=>He,GameEngine:()=>Ot,GameObject:()=>st,GameObjectManager:()=>$e,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>Ne,Transform:()=>rt,applyScreenAnchor:()=>Dt,basePixi:()=>sa,clearResponsiveElements:()=>ga,createPixiBase:()=>Pt,getRegisteredFontIds:()=>na,globalResponsiveMultipliers:()=>ct,initAssetTextures:()=>At,initAssets:()=>ua,layout:()=>ha,playLottieOverlay:()=>ra,registerFont:()=>ia,registerType:()=>wt,resolveAnchorVec2:()=>Ce,resolveFont:()=>ea,resolveFontWeight:()=>ta,resolveScreenAnchorPoint:()=>Be,resolveScreenRatioPoint:()=>Fe,runInitSequence:()=>ma,setLottieInstance:()=>St,spawnSceneFromConfig:()=>ca,updateScreenState:()=>Rt});module.exports=Ea(Hr);var Qn=require("pixi.js");var pe={};function mt(i,e,t=!1){pe[i]||(pe[i]=[]),pe[i].push({fn:e,once:t})}function Gt(i,e){if(pe[i]){if(!e){delete pe[i];return}pe[i]=pe[i].filter(t=>t.fn!==e)}}function bt(i,...e){let t=pe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&Gt(i,n.fn)}function q(i,e){mt(i,e,!0)}var D=null,Y=[],Te=null;function Xi(i){D=i,Y=[],Te!==null&&(clearTimeout(Te),Te=null)}function Ji(){var i,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(i=D==null?void 0:D.batchSize)!=null?i:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Yi(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let r=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",r,e);return}catch(r){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",r)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(r){n&&console.warn("[handler.telemetry] fetch failed",r)}}function qt(i,e){let t=Ji();if(e&&t.endpoint){if(Y.push(i),Y.length>t.maxQueue&&(Y=Y.slice(Y.length-t.maxQueue)),Y.length>=t.batchSize){Ki();return}Te===null&&(Te=window.setTimeout(()=>{Te=null,Ki()},t.flushIntervalMs))}}async function Ki(){let i=Ji();if(!i.endpoint||Y.length===0)return;let e=Y.splice(0,i.batchSize);await Yi(i.endpoint,{events:e},i.transport,i.debug),Y.length>0&&await Yi(i.endpoint,{events:Y.splice(0,i.batchSize)},i.transport,i.debug)}function Zi(i){return Math.max(0,Math.min(1,i))}function Aa(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Ke(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sa(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Qi(i,e,t){try{i[e]=t}catch{}}function Ca(i){let e=i==null?void 0:i.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,n=typeof e.y=="number"?e.y:1;return{x:t,y:n}}function en(i,e){let t=i==null?void 0:i.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function tn(i,e){let t=Ca(i);if(!t)return{from:null,to:null};let n=null,a=null;return typeof e.scale=="number"?(n=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(n=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(n=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),n===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:n!=null?n:t.x,y:a!=null?a:t.y}}}function nn(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,s(),i.size>0&&n()})},a=u=>{var p;i.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),n()},r=u=>{i.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},o=u=>{u.killed||(u.killed=!0,r(u))},s=()=>{var l,p;let u=Ke();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,A=Zi(h),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let y=h-f;A=Zi(y)}let x=g.ease(A);g.yoyo&&f%2===1&&(x=1-x);for(let y of g.props)Qi(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&en(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(h>=b){o(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),h=Aa(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let I of Object.keys(l)){if(f.has(I))continue;let R=l[I];typeof R=="number"&&x.push({key:I,from:Sa(u,I),to:R})}let w=tn(u,l);return{target:u,startMs:Ke(),delayMs:m,durationMs:g,ease:h,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>o(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Ke())},resume:()=>{var h;if(!p.paused)return;let g=(h=p.pauseAtMs)!=null?h:Ke(),m=Ke()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&Qi(u,g,m)}let p=tn(u,l);p.to&&en(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))o(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],h=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let x=typeof f=="string"?f.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=f=>{l.push(f);let x=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+x)},b={to(f,x,w){return A({kind:"to",target:f,vars:x,atMs:h(w)}),b},fromTo(f,x,w,y){return A({kind:"fromTo",target:f,vars:w,from:x,atMs:h(y)}),b},play(){var f,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(f=w.from)!=null?f:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let f of m)f.pause();return b},kill(){for(let f of m)f.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function an(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=nn()}catch{}}var rn={name:"handler-playable-sdk",version:"0.4.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",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,La=V++,on=V++,sn=V++,ln=V++,cn=V++,dn=V++,pn=V++,un=V++,gn=V++,fn=V++,hn=V++,mn=V++,M=La;function bn(){return M===on}function yn(){return M===sn}function vn(){return M===ln}function xn(){return M===cn}function Le(){return M===dn}function ke(){return M===pn}function wn(){return M===un}function En(){return M===gn}function An(){return M===fn}function Vt(){return M===hn}function Wt(){return M===mn}function Sn(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),M=on;return}catch{}else if(i==="dapi")try{dapi.isReady(),M=sn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(M=ln)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(M=cn)}catch{}else if(e==="mintegral")window.gameReady&&(M=dn);else if(e==="tapjoy")window.TJ_API&&(M=pn);else if(e==="tiktok")window.openAppStore&&(M=un);else if(e==="smadex")try{window.smxTracking&&(M=gn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(M=fn)}catch{}else e==="vungle"?M=hn:(i==="nucleo"||e==="nucleo")&&(M=mn)}var yt=ht(require("lottie-web"),1),Cn=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);Xt();function $(i,e){let t=(a,r)=>r===0?a:t(r,a%r),n=t(i,e);return`${i/n}:${e/n}`}var vo=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],xo=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],wo=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],_n=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Eo=[..._n];var Ra=_n[0];ue();var Ba=ht(require("jszip"),1);function za(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function Ha(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}async function Na(i){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=i})}async function Jt(i){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",i);let n=await fetch(i);if(!n.ok)return console.warn("[ImageUtils] Fetch failed with status:",n.status,i),null;let a=await n.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let r=await za(a),o=await Na(r),s=Ha(r);return console.log("[ImageUtils] Success resolution:",o==null?void 0:o.width,"x",o==null?void 0:o.height,"mime:",s.mimeType),{base64:s.base64,mimeType:s.mimeType,dataUrl:r,width:(e=o==null?void 0:o.width)!=null?e:0,height:(t=o==null?void 0:o.height)!=null?t:0}}catch(n){return console.error("[ImageUtils] Error fetching image data:",n),null}}async function vt(i,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=i}),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),i;a.drawImage(t,0,0);let r=a.getImageData(0,0,n.width,n.height),o=r.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(l=>({r:o[l.offset],g:o[l.offset+1],b:o[l.offset+2]})),c=0;for(let l=0;l<o.length;l+=4){let p=o[l],g=o[l+1],m=o[l+2],h=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){h=!0;break}h&&(o[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(r,0,0),n.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),i}}var Pn=require("@google/genai");async function Zt(i,e,t=[],n={}){var a,r,o,s,d,c,u;try{if(!(i!=null&&i.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let l=new Pn.GoogleGenAI({apiKey:i}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),h="",A=(o=(r=(a=m.candidates)==null?void 0:a[0])==null?void 0:r.content)==null?void 0:o.parts;if(A)for(let b of A)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(l){throw console.error("[Gemini] API error:",l),(s=l.message)!=null&&s.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=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Mn=require("@google/genai");async function xt(i,e,t=[],n={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Mn.GoogleGenAI({apiKey:i}),r=[{text:e}];t.length>0&&t.forEach((s,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),r.push({inlineData:{mimeType:s.mimeType,data:s.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let o=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:r});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!o.candidates||!o.candidates[0]||!o.candidates[0].content||!o.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let s of o.candidates[0].content.parts)if(s.text)console.log(s.text);else if(s.inlineData){let d=s.inlineData.data,c=s.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Wa=require("pixi.js");Xe();ue();var $n=require("pixi.js");var Ya=require("pixi.js");ue();function tr(i){return new Promise((e,t)=>{let n=new FileReader;n.onerror=()=>t(new Error("FileReader failed")),n.onload=()=>e(String(n.result||"")),n.readAsDataURL(i)})}function ir(i){var a;let[e,t]=i.split(","),n=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=n==null?void 0:n[1])!=null?a:"image/png"}}function nr(i){return`
47
47
  Analyze these screenshots of a brand or game and extract its "Brand DNA".
48
48
 
49
49
  Provide a concise summary (2-3 sentences) covering:
@@ -2967,7 +2967,7 @@
2967
2967
 
2968
2968
  .bottom-dock-resize-handle {
2969
2969
  position: absolute;
2970
- bottom: 0;
2970
+ top: 0;
2971
2971
  left: 0;
2972
2972
  right: 0;
2973
2973
  height: 4px;
@@ -1 +1 @@
1
- (function(_0x57dfd5,_0x2e0d9c){var a0_0x3fd1eb={_0x15e329:'b2dX',_0x8c1641:0x29d,_0x3bfe07:0x2af,_0x2aebd3:0x28e,_0x2bf506:0x29c,_0x3113e7:0x11f,_0x2f91d2:0x11f,_0x5b5686:0x12f,_0x4e08ea:'5$Xf',_0x369d32:0x29f,_0x2aaa6e:0x295,_0x18276f:0x489,_0x55d2e7:0x47f,_0x3e7811:0x47e,_0x5ba29:'uFE1',_0x250131:0x28c,_0x1aa824:0x29d,_0x2247d2:0x295,_0x240dd5:'or!R',_0x150b97:0x2b0,_0x141750:0x2a5,_0x51fdb5:'qtFy',_0x3f0fb9:0x127,_0x2bd8af:0x116,_0x246ea1:0x108,_0x3b47e0:'qXYz',_0x60282f:0x48f,_0x4e5b13:0x4a6,_0x1772cc:0x4a5,_0x3884d3:0x497,_0x10ee28:'*vT5',_0x1c2c56:0x285,_0x5b13df:'HezZ',_0x4b9cb9:0x2a3,_0xfbd5f3:0x2ad,_0xa83d5:0x29b,_0x5e2bc7:'VvFx',_0xf4c44a:0x2a4,_0x3f71fa:0x296,_0x5f1be9:0x2a6,_0x4fc40e:0x11f,_0x2a9ebe:0x123,_0x568017:'l9Io',_0xf8c6f0:0x474,_0x19ee33:0x47a,_0x183e78:0x48b,_0x13981b:0x486},a0_0x6e3d48={_0x3acd5e:0x308};function _0x3ddcd0(_0x31e05b,_0x391c43,_0x38258b,_0x3bf12e,_0x387a64){return a0_0x3505(_0x387a64-0x2a2,_0x31e05b);}var _0x4b26b7=_0x57dfd5();function _0x10e6ab(_0x1210eb,_0x34edcd,_0x5348b1,_0x1712e5,_0x1d24db){return a0_0x3505(_0x34edcd-0xb3,_0x1210eb);}function _0x3974a4(_0x4d5d1,_0x130949,_0x9b6c0c,_0x15ba53,_0x48dd92){return a0_0x3505(_0x9b6c0c- -a0_0x6e3d48._0x3acd5e,_0x4d5d1);}while(!![]){try{var _0x22690e=parseInt(_0x10e6ab(a0_0x3fd1eb._0x15e329,a0_0x3fd1eb._0x8c1641,a0_0x3fd1eb._0x3bfe07,a0_0x3fd1eb._0x2aebd3,a0_0x3fd1eb._0x2bf506))/(0x1804+0xc42+0x5*-0x741)*(parseInt(_0x3974a4('f1TL',-a0_0x3fd1eb._0x3113e7,-a0_0x3fd1eb._0x2f91d2,-a0_0x3fd1eb._0x5b5686,-0x11e))/(-0x139c+-0x2c*-0x4f+0x60a))+parseInt(_0x10e6ab(a0_0x3fd1eb._0x4e08ea,a0_0x3fd1eb._0x369d32,a0_0x3fd1eb._0x2aaa6e,0x2a3,0x2a7))/(0x53*-0x68+-0xd4*-0x9+0x1a47)*(parseInt(_0x3ddcd0('jWoB',a0_0x3fd1eb._0x18276f,a0_0x3fd1eb._0x55d2e7,a0_0x3fd1eb._0x3e7811,0x48d))/(0x6d9*0x4+0x1e60+0x16*-0x2a0))+-parseInt(_0x10e6ab(a0_0x3fd1eb._0x5ba29,a0_0x3fd1eb._0x250131,a0_0x3fd1eb._0x1aa824,a0_0x3fd1eb._0x2247d2,0x28a))/(-0xd3*-0x29+0xc64+-0x26e*0x13)*(parseInt(_0x10e6ab(a0_0x3fd1eb._0x240dd5,0x2ae,0x2a3,a0_0x3fd1eb._0x150b97,a0_0x3fd1eb._0x141750))/(0x13f5+-0x76*-0x47+0x3d*-0xdd))+parseInt(_0x3974a4(a0_0x3fd1eb._0x51fdb5,-a0_0x3fd1eb._0x3f0fb9,-a0_0x3fd1eb._0x2bd8af,-a0_0x3fd1eb._0x246ea1,-0x110))/(-0x370+0x1*0x1e3d+0x95*-0x2e)*(parseInt(_0x3ddcd0(a0_0x3fd1eb._0x3b47e0,a0_0x3fd1eb._0x60282f,a0_0x3fd1eb._0x4e5b13,a0_0x3fd1eb._0x1772cc,a0_0x3fd1eb._0x3884d3))/(-0xbbc+-0x2190+0x2d54*0x1))+-parseInt(_0x10e6ab(a0_0x3fd1eb._0x10ee28,a0_0x3fd1eb._0x2247d2,0x288,a0_0x3fd1eb._0x1c2c56,a0_0x3fd1eb._0x2aebd3))/(-0x2063*-0x1+0xfe3+-0x303d)*(parseInt(_0x10e6ab(a0_0x3fd1eb._0x5b13df,a0_0x3fd1eb._0x4b9cb9,a0_0x3fd1eb._0xfbd5f3,a0_0x3fd1eb._0xa83d5,a0_0x3fd1eb._0xa83d5))/(-0x60f+0x1*-0x1825+0x1e3e))+-parseInt(_0x10e6ab(a0_0x3fd1eb._0x5e2bc7,a0_0x3fd1eb._0xf4c44a,0x2b3,a0_0x3fd1eb._0x3f71fa,a0_0x3fd1eb._0x5f1be9))/(0x1122+-0x8*0x15d+-0x1*0x62f)*(parseInt(_0x3974a4('^^0Y',-a0_0x3fd1eb._0x4fc40e,-0x12a,-a0_0x3fd1eb._0x5b5686,-a0_0x3fd1eb._0x2a9ebe))/(-0x32*0xb+0x3c5+0x1*-0x193))+parseInt(_0x3ddcd0(a0_0x3fd1eb._0x568017,a0_0x3fd1eb._0xf8c6f0,a0_0x3fd1eb._0x19ee33,a0_0x3fd1eb._0x183e78,a0_0x3fd1eb._0x13981b))/(-0x1b04+-0x7*-0x2+0x1b03);if(_0x22690e===_0x2e0d9c)break;else _0x4b26b7['push'](_0x4b26b7['shift']());}catch(_0x20971e){_0x4b26b7['push'](_0x4b26b7['shift']());}}}(a0_0x31f3,0x28*-0x35f3+0x3*-0x2b255+0x1530eb*0x1));var a0_0x10bcb2=(function(){var a0_0x63b3e6={_0x41ba2d:0x410,_0x424788:0x404,_0x1742b3:0x3fe},_0x473926=!![];return function(_0x48e853,_0x1de98c){var _0x4dd025=_0x473926?function(){function _0x478084(_0x181145,_0x77bf4c,_0x56fe6a,_0xc0b5ae,_0x4baf80){return a0_0x3505(_0x56fe6a-0x204,_0x4baf80);}if(_0x1de98c){var _0x1ebc4e=_0x1de98c[_0x478084(a0_0x63b3e6._0x41ba2d,a0_0x63b3e6._0x424788,a0_0x63b3e6._0x1742b3,0x40f,'l9Io')](_0x48e853,arguments);return _0x1de98c=null,_0x1ebc4e;}}:function(){};return _0x473926=![],_0x4dd025;};}()),a0_0xd5ed91=a0_0x10bcb2(this,function(){var a0_0x5b2185={_0x1d22b5:0x67,_0xd18178:0x6d,_0x59ec21:0x68,_0x16ea99:0x66,_0x4ef4db:'hZmj',_0x4c5c31:0x117,_0x161607:0x107,_0x501389:0x10c,_0x5e266b:'$vPI',_0x3f7a0b:0xde,_0x2b16b0:0xef,_0x2bd10c:0xfb,_0x57db9c:0xe0,_0x16d337:0xf9,_0x547c76:0xee,_0x392bbb:0x5c,_0x2c5c80:0x5f,_0x50319b:0x69,_0x13f310:0x78,_0x14361c:'g^io',_0x59b0b4:'H7WU',_0x289089:0x1cd,_0x9817bb:0x1d6,_0x38b7f3:0x47,_0x421119:0x52,_0x2de291:0x57,_0x4c4701:0x50,_0x16219b:0x43,_0x2074b6:'5$Xf',_0x2c36a4:0xf8,_0x315491:0xf0,_0x43a304:0xed,_0xdcc5bb:0x6e,_0x2fb4b0:0x6b,_0x566e90:'lHwg',_0x3068f9:0x64,_0x38a522:0x6e,_0x6855ef:'*vT5',_0x1d3a2a:0x60,_0x11719e:0x61,_0x588d81:0x5b,_0x4b6f85:'WQHj',_0x55a16c:0x63,_0x3fc4f1:0x51,_0xcd3c09:0x53,_0x4218e2:'no(g'},a0_0x12e442={_0x155723:0x1},a0_0x195a7e={_0xf104fa:0x249},a0_0x1b4324={_0x3a628c:0x2e6};function _0x45bd07(_0x2b3184,_0x46bfdf,_0x123238,_0x3cb962,_0x51a6de){return a0_0x3505(_0x123238- -a0_0x1b4324._0x3a628c,_0x2b3184);}function _0x40cf39(_0xb913bb,_0x32fe04,_0x48a31b,_0x419aea,_0x5b0f98){return a0_0x3505(_0x48a31b- -a0_0x195a7e._0xf104fa,_0x5b0f98);}var _0x2576dd={};function _0x6106e8(_0x430919,_0x57218e,_0x5a2d84,_0x3ceb08,_0x547ec1){return a0_0x3505(_0x3ceb08- -a0_0x12e442._0x155723,_0x430919);}_0x2576dd[_0x40cf39(-a0_0x5b2185._0x1d22b5,-a0_0x5b2185._0xd18178,-a0_0x5b2185._0x59ec21,-a0_0x5b2185._0x16ea99,'p8B7')]=_0x45bd07(a0_0x5b2185._0x4ef4db,-a0_0x5b2185._0x4c5c31,-a0_0x5b2185._0x161607,-a0_0x5b2185._0x501389,-0xf6)+_0x45bd07(a0_0x5b2185._0x5e266b,-a0_0x5b2185._0x3f7a0b,-a0_0x5b2185._0x2b16b0,-a0_0x5b2185._0x2bd10c,-a0_0x5b2185._0x57db9c)+'+$';var _0x1a477e=_0x2576dd;return a0_0xd5ed91['toStr'+_0x45bd07(')qHu',-a0_0x5b2185._0x16d337,-a0_0x5b2185._0x547c76,-a0_0x5b2185._0x2b16b0,-0xf2)]()[_0x40cf39(-a0_0x5b2185._0x392bbb,-a0_0x5b2185._0x2c5c80,-a0_0x5b2185._0x50319b,-a0_0x5b2185._0x13f310,a0_0x5b2185._0x14361c)+'h'](_0x6106e8(a0_0x5b2185._0x59b0b4,a0_0x5b2185._0x289089,a0_0x5b2185._0x9817bb,0x1dc,0x1ca)+_0x40cf39(-a0_0x5b2185._0x38b7f3,-0x61,-a0_0x5b2185._0x421119,-0x45,'$vPI')+'+$')[_0x40cf39(-0x5d,-a0_0x5b2185._0x2de291,-a0_0x5b2185._0x4c4701,-a0_0x5b2185._0x16219b,a0_0x5b2185._0x2074b6)+_0x45bd07('qu(W',-0xea,-a0_0x5b2185._0x2c36a4,-a0_0x5b2185._0x315491,-a0_0x5b2185._0x43a304)]()[_0x40cf39(-a0_0x5b2185._0xdcc5bb,-a0_0x5b2185._0xdcc5bb,-0x63,-a0_0x5b2185._0x2fb4b0,a0_0x5b2185._0x566e90)+_0x40cf39(-a0_0x5b2185._0x16ea99,-a0_0x5b2185._0x3068f9,-a0_0x5b2185._0x38a522,-0x5e,a0_0x5b2185._0x6855ef)+'r'](a0_0xd5ed91)[_0x40cf39(-0x64,-a0_0x5b2185._0x1d3a2a,-a0_0x5b2185._0x11719e,-a0_0x5b2185._0x588d81,a0_0x5b2185._0x4b6f85)+'h'](_0x1a477e[_0x40cf39(-a0_0x5b2185._0x55a16c,-a0_0x5b2185._0x3fc4f1,-a0_0x5b2185._0xcd3c09,-0x53,a0_0x5b2185._0x4218e2)]);});function a0_0x31f3(){var _0x2c4332=['qSkfymo4WR0','DCkvWRJcRmkil2tdI8k1','ymkVoZlcUa','e8o1uvTyWRb5W6zu','WQ8bavRdHNTFyMtcNq','iKNdIxWeW7jrBG','WQpcR8oEz8oJWPpdJmoaW71+bWe','W5/cKCoPW6JdPGVdHeq','WPeUWRO','W79/W4qvemklCKZdKmoeW7BcN8kS','W73cHCk8WOmybbddSCkTWQBdGW','W6eGW4KJW6BcSM/dSG','DCkwWRddOSoxku7dN8kjWRyE','WQdcRmorySoIW4pdPSotW5f/oG','W4lcTrNdQmoCjbNdPCkV','WRulW4ZcICkLWP3dTSoypW','qmoNdCoNWQu','WPRcSCoWW7CM','W5pcNg0','W6xdSSk6imkL','W5WmzCkOqq','W592WR0EDmoQWO3cHSo7W5XnwCoD','WPddPSkTo8kkW65QWPVcH2pcVmo/W4G','WOhdLSoaW4/dTann','WR03FmkplCkwp3bZiSktW4W','pKVcOmkPWPW','W59+WR9Og8kxW5dcQSoH','lIdcRmkYWQi','WQmcf8owefxcQmo5pfxdMxW','W7pcU8k0WRZdSa','zSoiaevc','W6ijW7CtWP4','EqRdUSkeWPFcIqJcSCkm','fSoyn8kZW7hcO8kLWPSHWPXeW5i','WO5eiCo0dd0LfSkkW64dWRja','W5pdNrhdVCoqW7FdHa'];a0_0x31f3=function(){return _0x2c4332;};return a0_0x31f3();}a0_0xd5ed91();import{A as a0_0x3c8e20,B as a0_0x223a4c,C as a0_0x46088a,D as a0_0x285988,b as a0_0xd90e3c,c as a0_0x244285,d as a0_0x18ed36,e as a0_0x5bdd57,f as a0_0x417b0d,g as a0_0x381bfd,h as a0_0x21a879,i as a0_0x5e4037,j as a0_0x579d9e,k as a0_0x3dde2e,l as a0_0x5daa03,m as a0_0x5f0b5d,n as a0_0x5d49f9,o as a0_0x221ed8,p as a0_0x5555bd,q as a0_0x122c50,r as a0_0xce3344,s as a0_0x5435f6,t as a0_0x4369a6,u as a0_0x319583,v as a0_0x569471,w as a0_0x374a08,x as a0_0x2637ed,y as a0_0x2fe867,z as a0_0x10dc67}from'../chunk-XGJ2QPBX.js';import{a as a0_0x17c1c1,b as a0_0x2128b2,c as a0_0x1e896d,d as a0_0x3f548f,e as a0_0x289005}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';function a0_0x3505(_0x673bc9,_0x1aa7bf){_0x673bc9=_0x673bc9-(-0x5ba*-0x3+0x15f0+-0x2546);var _0x457841=a0_0x31f3();var _0x4cffb3=_0x457841[_0x673bc9];if(a0_0x3505['jcZUaR']===undefined){var _0x3ea6b8=function(_0x17c14c){var _0x40428d='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xf6edeb='',_0x4ef188='',_0x18e10e=_0xf6edeb+_0x3ea6b8;for(var _0xdb2bb5=-0x245b+-0x357+0x27b2,_0x688b06,_0x38c8a3,_0x4a26f7=0x204b+0x2*0xa07+0x3459*-0x1;_0x38c8a3=_0x17c14c['charAt'](_0x4a26f7++);~_0x38c8a3&&(_0x688b06=_0xdb2bb5%(0xae5+-0x1f77+0x1496)?_0x688b06*(0x2549+-0x2bf+-0x5b7*0x6)+_0x38c8a3:_0x38c8a3,_0xdb2bb5++%(-0x1334+0xb19*-0x3+0x3*0x1181))?_0xf6edeb+=_0x18e10e['charCodeAt'](_0x4a26f7+(-0xb83+-0x1*-0x198e+-0xe01))-(-0x242e+0x53b*-0x3+0x61*0x89)!==-0x2538+0x855+0x1ce3?String['fromCharCode'](-0x345*-0x3+-0xaf7*-0x1+-0x13c7&_0x688b06>>(-(-0x19c*-0x3+-0x6b3+-0x25*-0xd)*_0xdb2bb5&-0x27e+-0xc6a+0xeee)):_0xdb2bb5:-0x376+0x12aa+-0xf34){_0x38c8a3=_0x40428d['indexOf'](_0x38c8a3);}for(var _0x475219=-0x2c*-0xe2+0x1*0x19ce+-0x40a6,_0x500b27=_0xf6edeb['length'];_0x475219<_0x500b27;_0x475219++){_0x4ef188+='%'+('00'+_0xf6edeb['charCodeAt'](_0x475219)['toString'](-0x1ed4*0x1+0x26a8+-0x7*0x11c))['slice'](-(-0x10d2*0x2+0x2397+-0x1f1));}return decodeURIComponent(_0x4ef188);};var _0x3d7a8b=function(_0xd8a2ad,_0xf507bc){var _0x511f0f=[],_0x54c2ea=-0x24ba+0x7*0xb2+0x1fdc,_0x55a6b7,_0x480b95='';_0xd8a2ad=_0x3ea6b8(_0xd8a2ad);var _0x1ae497;for(_0x1ae497=0x124f+-0x603+-0xc4c;_0x1ae497<-0x29*-0xe2+0x74a*0x2+0x31c6*-0x1;_0x1ae497++){_0x511f0f[_0x1ae497]=_0x1ae497;}for(_0x1ae497=0x26cd+-0x779*-0x5+-0x4c2a;_0x1ae497<0x77b*0x4+-0x3*-0x563+-0xf07*0x3;_0x1ae497++){_0x54c2ea=(_0x54c2ea+_0x511f0f[_0x1ae497]+_0xf507bc['charCodeAt'](_0x1ae497%_0xf507bc['length']))%(-0x139c+-0x3*0x3f8+0x821*0x4),_0x55a6b7=_0x511f0f[_0x1ae497],_0x511f0f[_0x1ae497]=_0x511f0f[_0x54c2ea],_0x511f0f[_0x54c2ea]=_0x55a6b7;}_0x1ae497=-0xe90+0x18af+-0xa1f,_0x54c2ea=-0x152b*0x1+-0x1343*-0x1+0x1e8;for(var _0x3c708e=0x18d9*0x1+-0x1*-0x1b7f+0x29e*-0x14;_0x3c708e<_0xd8a2ad['length'];_0x3c708e++){_0x1ae497=(_0x1ae497+(-0x3*-0x4e9+-0x9ee+0x4*-0x133))%(0x1*0x39e+0x2fc*-0x2+-0x27*-0x16),_0x54c2ea=(_0x54c2ea+_0x511f0f[_0x1ae497])%(-0x723+0x1034+0x1*-0x811),_0x55a6b7=_0x511f0f[_0x1ae497],_0x511f0f[_0x1ae497]=_0x511f0f[_0x54c2ea],_0x511f0f[_0x54c2ea]=_0x55a6b7,_0x480b95+=String['fromCharCode'](_0xd8a2ad['charCodeAt'](_0x3c708e)^_0x511f0f[(_0x511f0f[_0x1ae497]+_0x511f0f[_0x54c2ea])%(-0x1c65+-0x43f*0x9+-0x21ce*-0x2)]);}return _0x480b95;};a0_0x3505['LwzLVz']=_0x3d7a8b,a0_0x3505['gTITUF']={},a0_0x3505['jcZUaR']=!![];}var _0x24b0d3=_0x457841[0x1*-0x24cf+0x822+0x1cad],_0x86d46e=_0x673bc9+_0x24b0d3,_0x3bda72=a0_0x3505['gTITUF'][_0x86d46e];if(!_0x3bda72){if(a0_0x3505['BylDJp']===undefined){var _0x39f5e1=function(_0x58eeb6){this['xMwLcc']=_0x58eeb6,this['aHKBUT']=[0x5d*-0xc+0x96*0x41+-0x61*0x59,0x1b13+0x73d*-0x4+0x1e1,-0x182f+-0x116e+0x299d*0x1],this['bOFYdF']=function(){return'newState';},this['EBamzL']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['hGzDlT']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x39f5e1['prototype']['KTJyTb']=function(){var _0x3ecf59=new RegExp(this['EBamzL']+this['hGzDlT']),_0x503150=_0x3ecf59['test'](this['bOFYdF']['toString']())?--this['aHKBUT'][-0x2282+-0x123*-0x21+0x10*-0x30]:--this['aHKBUT'][-0x1*-0x1e18+-0x1f28*0x1+0x110];return this['vwZBQR'](_0x503150);},_0x39f5e1['prototype']['vwZBQR']=function(_0xe2f9ad){if(!Boolean(~_0xe2f9ad))return _0xe2f9ad;return this['XNqzGI'](this['xMwLcc']);},_0x39f5e1['prototype']['XNqzGI']=function(_0x10ede5){for(var _0x5bd09a=0x83b+0x3*0x63e+-0x1af5,_0xf7c6e8=this['aHKBUT']['length'];_0x5bd09a<_0xf7c6e8;_0x5bd09a++){this['aHKBUT']['push'](Math['round'](Math['random']())),_0xf7c6e8=this['aHKBUT']['length'];}return _0x10ede5(this['aHKBUT'][-0x466*0x5+-0x13d9+0x29d7]);},new _0x39f5e1(a0_0x3505)['KTJyTb'](),a0_0x3505['BylDJp']=!![];}_0x4cffb3=a0_0x3505['LwzLVz'](_0x4cffb3,_0x1aa7bf),a0_0x3505['gTITUF'][_0x86d46e]=_0x4cffb3;}else _0x4cffb3=_0x3bda72;return _0x4cffb3;}import'../chunk-E6WJCS24.js';import'../chunk-JXBG6UFL.js';export{a0_0x17c1c1 as AssetCache,a0_0x1e896d as AssetLoader,a0_0x319583 as AssetSystem,a0_0x3f548f as AssetTextures,a0_0x5435f6 as Assets,a0_0x221ed8 as BaseSystem,a0_0x5d49f9 as GameEngine,a0_0x5bdd57 as GameObject,a0_0x417b0d as GameObjectManager,a0_0x5f0b5d as ObjectFactory,a0_0x18ed36 as Renderer,a0_0x5555bd as RuntimeObjectRegistry,a0_0x244285 as Transform,a0_0x223a4c as applyScreenAnchor,a0_0x122c50 as basePixi,a0_0x374a08 as clearResponsiveElements,a0_0xd90e3c as createPixiBase,a0_0x579d9e as getRegisteredFontIds,a0_0x569471 as globalResponsiveMultipliers,a0_0x289005 as initAssetTextures,a0_0x4369a6 as initAssets,a0_0x46088a as layout,a0_0x5daa03 as playLottieOverlay,a0_0x5e4037 as registerFont,a0_0x2128b2 as registerType,a0_0x2fe867 as resolveAnchorVec2,a0_0x381bfd as resolveFont,a0_0x21a879 as resolveFontWeight,a0_0x10dc67 as resolveScreenAnchorPoint,a0_0x3c8e20 as resolveScreenRatioPoint,a0_0x285988 as runInitSequence,a0_0x3dde2e as setLottieInstance,a0_0xce3344 as spawnSceneFromConfig,a0_0x2637ed as updateScreenState};
1
+ (function(_0x20ecd0,_0x3fc3ac){var a0_0x1b56ad={_0x5279d4:0x312,_0x4004f9:0x31a,_0x18eb2f:'MTNs',_0x52842f:0x30d,_0x3bf12b:0x326,_0x35bcb7:0x314,_0x6479ba:'HX4v',_0x7813ce:0x31e,_0xfdd385:0x30e,_0x20e48f:0x324,_0x2c83ae:0x31b,_0x27272a:'ba!Q',_0x270728:0x31d,_0x4d34a7:0x317,_0x5ce23f:0x318,_0x28bcce:0x31d,_0x59fe2b:'Bfhb',_0x191fed:0x31b,_0x1a5b78:0x31e,_0x5859b7:0x341,_0x50313d:0x34b,_0x2e3dca:0x347,_0x555779:0x340,_0x545eb7:'Cy[U',_0x1643a8:0x109,_0x1abf19:0xfd,_0x5c9ca6:0x10a,_0x6512c7:0xfd,_0x5a7731:'b[7m',_0x418c38:0x323,_0x4beb27:'wPJq',_0x52f4c2:0x314,_0x3b110d:0x31f,_0x28b6fd:0x345,_0x117a21:0x346,_0x227a70:0x34f,_0x370d43:0x35e,_0x55b1b6:0x35b,_0x18dbee:0x348,_0x50e937:0x350,_0x3fd6a5:0x346,_0x1208ea:0x313,_0x1aeea0:0x2fd,_0x5e5d11:0x31b,_0x5613d1:0x311,_0x48bbf2:'eZYY',_0x3c9eca:0x304,_0x5e20ef:0x310,_0x207a93:'TdJg',_0x2a58f0:0x319,_0x4e3e50:0x306},a0_0xf65577={_0x35a83e:0x26b},a0_0xcfac5d={_0x2e279a:0x231},_0x5739df=_0x20ecd0();function _0x486fcf(_0x1cb657,_0xbd2c7d,_0x120acf,_0x115ffc,_0x41a6c6){return a0_0x5f4e(_0xbd2c7d-a0_0xcfac5d._0x2e279a,_0x120acf);}function _0x3a5663(_0x4ea23f,_0x492630,_0x44061b,_0x187460,_0x53ffa6){return a0_0x5f4e(_0x44061b-a0_0xf65577._0x35a83e,_0x53ffa6);}function _0x403f8b(_0x4bdac3,_0x3235a7,_0x5a02b7,_0x28ab62,_0x451965){return a0_0x5f4e(_0x4bdac3-0x22,_0x451965);}while(!![]){try{var _0x204e44=parseInt(_0x486fcf(a0_0x1b56ad._0x5279d4,a0_0x1b56ad._0x4004f9,a0_0x1b56ad._0x18eb2f,a0_0x1b56ad._0x52842f,a0_0x1b56ad._0x3bf12b))/(-0x214*-0x1+-0x1d*-0xf3+-0x1d9a)*(-parseInt(_0x486fcf(0x30c,a0_0x1b56ad._0x35bcb7,a0_0x1b56ad._0x6479ba,a0_0x1b56ad._0x7813ce,a0_0x1b56ad._0xfdd385))/(-0x730+-0x151c+0x1c4e))+parseInt(_0x486fcf(a0_0x1b56ad._0x20e48f,a0_0x1b56ad._0x2c83ae,a0_0x1b56ad._0x27272a,a0_0x1b56ad._0x270728,a0_0x1b56ad._0x4d34a7))/(0x35*0x27+0xaa0+-0x12b0)*(parseInt(_0x486fcf(a0_0x1b56ad._0x5ce23f,a0_0x1b56ad._0x28bcce,a0_0x1b56ad._0x59fe2b,a0_0x1b56ad._0x191fed,a0_0x1b56ad._0x1a5b78))/(-0x1091*-0x1+0x46b+-0x14f8))+-parseInt(_0x3a5663(a0_0x1b56ad._0x5859b7,a0_0x1b56ad._0x50313d,a0_0x1b56ad._0x2e3dca,a0_0x1b56ad._0x555779,a0_0x1b56ad._0x545eb7))/(-0x339+-0x4af*0x5+-0x69*-0x41)+-parseInt(_0x403f8b(a0_0x1b56ad._0x1643a8,a0_0x1b56ad._0x1abf19,a0_0x1b56ad._0x5c9ca6,a0_0x1b56ad._0x6512c7,a0_0x1b56ad._0x5a7731))/(-0x6*-0x673+0x1*-0x11ef+-0x14bd)*(-parseInt(_0x486fcf(0x31d,a0_0x1b56ad._0x418c38,a0_0x1b56ad._0x4beb27,a0_0x1b56ad._0x52f4c2,a0_0x1b56ad._0x3b110d))/(-0x108+0x6a2+-0x593))+-parseInt(_0x3a5663(a0_0x1b56ad._0x28b6fd,a0_0x1b56ad._0x117a21,a0_0x1b56ad._0x227a70,a0_0x1b56ad._0x370d43,'RwF3'))/(0x6f9+0x9*0x9d+-0xc76)+-parseInt(_0x3a5663(a0_0x1b56ad._0x55b1b6,a0_0x1b56ad._0x18dbee,a0_0x1b56ad._0x50e937,a0_0x1b56ad._0x3fd6a5,'s89c'))/(0x124f*0x1+0x10*-0x18d+0x68a*0x1)*(-parseInt(_0x486fcf(a0_0x1b56ad._0x1208ea,0x308,'Vq!F',a0_0x1b56ad._0x1aeea0,0x305))/(-0x6d2+-0xb90+-0x20c*-0x9))+-parseInt(_0x486fcf(a0_0x1b56ad._0x5e5d11,a0_0x1b56ad._0x5613d1,a0_0x1b56ad._0x48bbf2,0x307,a0_0x1b56ad._0x1208ea))/(0xb63+0x2b4*0x4+0x4*-0x58a)*(parseInt(_0x486fcf(a0_0x1b56ad._0x3c9eca,a0_0x1b56ad._0x5e20ef,a0_0x1b56ad._0x207a93,a0_0x1b56ad._0x2a58f0,a0_0x1b56ad._0x4e3e50))/(-0x1de7*-0x1+0x1de5+-0x3bc0));if(_0x204e44===_0x3fc3ac)break;else _0x5739df['push'](_0x5739df['shift']());}catch(_0x260780){_0x5739df['push'](_0x5739df['shift']());}}}(a0_0xe757,-0x167e51*-0x1+-0x44901+-0x2*0x27031));var a0_0x40e29c=(function(){var a0_0x56f725={_0x30cb82:0x3a5,_0x1dd8a8:0x3a4,_0x1a6909:'[DCF',_0x2b66ea:0x3b2,_0x2826f8:0x3ae},_0x4c5f22=!![];return function(_0x3d26d1,_0x429a00){var _0x5aa737=_0x4c5f22?function(){function _0x5bc9f3(_0x4cb20a,_0x3541c0,_0x1d0adc,_0x3c8874,_0x1c5135){return a0_0x5f4e(_0x1c5135-0x2d6,_0x1d0adc);}if(_0x429a00){var _0x4b2839=_0x429a00[_0x5bc9f3(a0_0x56f725._0x30cb82,a0_0x56f725._0x1dd8a8,a0_0x56f725._0x1a6909,a0_0x56f725._0x2b66ea,a0_0x56f725._0x2826f8)](_0x3d26d1,arguments);return _0x429a00=null,_0x4b2839;}}:function(){};return _0x4c5f22=![],_0x5aa737;};}()),a0_0x4a3717=a0_0x40e29c(this,function(){var a0_0x89e122={_0x24990f:0x14b,_0x2c7d8a:'Bfhb',_0x416aa3:0x142,_0x2c5f5f:0x3a8,_0x2e395f:'Rv)b',_0x12c13f:0x3ad,_0x2ba9da:0x3a6,_0x3f10cd:0xcf,_0x40b55a:0xd9,_0x490b77:0xd0,_0x595d0a:'MB4n',_0x2ae5d6:0xe1,_0x1b323e:0xd6,_0x5e5e33:0xdc,_0x38c2f9:0xd1,_0x3b02e6:'UrmN',_0x408d8a:0xd8,_0x57a0ff:0x3b9,_0x29ae01:'Jdi9',_0x3b17b1:0x3c4,_0x1dcf34:0x3b7,_0xa48f0d:0x3b9,_0xa01276:0xe9,_0x258b42:0xe7,_0x479a2c:0xf7,_0x5f4f3a:0x3be,_0x54d107:'MTNs',_0x2a7857:0x3c4,_0x1cf644:0xd0,_0x128cfa:0xd4,_0x1874c9:0xd5,_0x33121a:'1#a0',_0x2ac8f8:0xdd,_0x580ebf:0xc9,_0x5a286f:0xd8,_0x395877:0xe0,_0x6e7094:0xd2,_0x170f48:0xea},a0_0x3409dc={_0x5315bb:0x65},_0x4478e6={};function _0x44cd2c(_0xbdbc2e,_0xd7df5c,_0x319c50,_0x3b8dcd,_0x178d72){return a0_0x5f4e(_0xbdbc2e-0x2cb,_0xd7df5c);}_0x4478e6[_0x2990df(a0_0x89e122._0x24990f,a0_0x89e122._0x2c7d8a,a0_0x89e122._0x416aa3,a0_0x89e122._0x24990f,0x158)]='(((.+'+')+)+)'+'+$';var _0x96e218=_0x4478e6;function _0x2990df(_0x4e2ab6,_0x5424b1,_0x529ff7,_0xa94e00,_0x38e24d){return a0_0x5f4e(_0xa94e00-a0_0x3409dc._0x5315bb,_0x5424b1);}function _0x4aff2a(_0x1bc3b0,_0x53e569,_0x3fa762,_0x1bc0a3,_0x2cb9eb){return a0_0x5f4e(_0x53e569- -0x2,_0x1bc0a3);}return a0_0x4a3717[_0x44cd2c(a0_0x89e122._0x2c5f5f,a0_0x89e122._0x2e395f,a0_0x89e122._0x12c13f,a0_0x89e122._0x2ba9da,0x3b5)+_0x4aff2a(a0_0x89e122._0x3f10cd,a0_0x89e122._0x40b55a,a0_0x89e122._0x490b77,a0_0x89e122._0x595d0a,a0_0x89e122._0x2ae5d6)]()[_0x4aff2a(a0_0x89e122._0x1b323e,a0_0x89e122._0x5e5e33,a0_0x89e122._0x38c2f9,a0_0x89e122._0x3b02e6,a0_0x89e122._0x408d8a)+'h'](_0x96e218['MLWYl'])[_0x44cd2c(a0_0x89e122._0x57a0ff,a0_0x89e122._0x29ae01,a0_0x89e122._0x3b17b1,a0_0x89e122._0x1dcf34,a0_0x89e122._0xa48f0d)+'ing']()[_0x4aff2a(0xeb,a0_0x89e122._0xa01276,a0_0x89e122._0x258b42,'bWnH',a0_0x89e122._0x479a2c)+_0x44cd2c(a0_0x89e122._0x5f4f3a,a0_0x89e122._0x54d107,0x3bc,a0_0x89e122._0x2a7857,0x3b4)+'r'](a0_0x4a3717)[_0x4aff2a(a0_0x89e122._0x1cf644,a0_0x89e122._0x128cfa,a0_0x89e122._0x1874c9,a0_0x89e122._0x33121a,a0_0x89e122._0x2ac8f8)+'h'](_0x4aff2a(a0_0x89e122._0x580ebf,a0_0x89e122._0x5a286f,a0_0x89e122._0x3f10cd,'Bfhb',0xd8)+_0x4aff2a(0xeb,a0_0x89e122._0x395877,a0_0x89e122._0x6e7094,'RwF3',a0_0x89e122._0x170f48)+'+$');});a0_0x4a3717();import{A as a0_0x2e50c4,B as a0_0x40a941,C as a0_0x50c8a1,D as a0_0x3ad18f,b as a0_0x5bf746,c as a0_0x22c317,d as a0_0x1c419c,e as a0_0x388edc,f as a0_0x1e2173,g as a0_0x28f416,h as a0_0x27251c,i as a0_0x4ab06a,j as a0_0x4242c7,k as a0_0x303d6a,l as a0_0x2130bc,m as a0_0x4eebfe,n as a0_0x1a9191,o as a0_0x10bb14,p as a0_0xb004bd,q as a0_0x505044,r as a0_0x34c41b,s as a0_0x285c9a,t as a0_0x42a64e,u as a0_0x5c630a,v as a0_0x1a5b7a,w as a0_0x447e1a,x as a0_0x22f351,y as a0_0x5ded0c,z as a0_0xb4f0ac}from'../chunk-SCQFSOPI.js';import{a as a0_0x2713df,b as a0_0x18fee5,c as a0_0x3bec71,d as a0_0x28227c,e as a0_0x1f24b6}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';function a0_0x5f4e(_0x18d31e,_0x26ea3a){_0x18d31e=_0x18d31e-(0x57*-0x32+-0x23ad*-0x1+-0x3*0x5f3);var _0x15ed1d=a0_0xe757();var _0x1c24e6=_0x15ed1d[_0x18d31e];if(a0_0x5f4e['PHMKCC']===undefined){var _0x131688=function(_0x4d278e){var _0x2d3604='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xe88eab='',_0x43e86f='',_0x351419=_0xe88eab+_0x131688;for(var _0x4a550b=-0x209*0x7+0x1eba+-0x107b,_0x11531f,_0x113f57,_0x1821f6=0x16e0*0x1+0x1f20+-0x3600;_0x113f57=_0x4d278e['charAt'](_0x1821f6++);~_0x113f57&&(_0x11531f=_0x4a550b%(0x13c9+-0x1a51+0x68c)?_0x11531f*(0xaf6+0x26d0+-0x3*0x1082)+_0x113f57:_0x113f57,_0x4a550b++%(0xa*-0x359+0x6*0x4a7+0x33*0x1c))?_0xe88eab+=_0x351419['charCodeAt'](_0x1821f6+(-0xe36+-0x3f1*-0x1+-0x1*-0xa4f))-(-0x15*-0x79+-0x18dd+0xefa)!==0x1c1d*0x1+-0x13*-0xe+0x1b7*-0x11?String['fromCharCode'](-0x10cb+-0x14c0*-0x1+-0x2f6&_0x11531f>>(-(0x15b2+0x195e+0x2f0e*-0x1)*_0x4a550b&-0x1*-0x1961+-0xac7+-0xe94)):_0x4a550b:-0x8a7+0x3f2+-0x5*-0xf1){_0x113f57=_0x2d3604['indexOf'](_0x113f57);}for(var _0x2bc11a=-0x1*-0x17a4+-0x11*-0x4a+-0x1c8e,_0x131af0=_0xe88eab['length'];_0x2bc11a<_0x131af0;_0x2bc11a++){_0x43e86f+='%'+('00'+_0xe88eab['charCodeAt'](_0x2bc11a)['toString'](0x16dc+-0x20f9+0x5*0x209))['slice'](-(0x216e+0x1*0x2539+-0x46a5));}return decodeURIComponent(_0x43e86f);};var _0x360d76=function(_0xaeddf5,_0x5e14e0){var _0x74552d=[],_0x38715b=0xde8+-0xd*-0x216+-0x2906,_0x13e947,_0x5eea7a='';_0xaeddf5=_0x131688(_0xaeddf5);var _0x19ccc1;for(_0x19ccc1=0x744+-0xe63+0x1*0x71f;_0x19ccc1<-0x4*-0x1d+-0xbe1+0xc6d;_0x19ccc1++){_0x74552d[_0x19ccc1]=_0x19ccc1;}for(_0x19ccc1=0x1abb+0x429*0x1+-0x1ee4;_0x19ccc1<-0x886*-0x2+-0xa70+-0x59c;_0x19ccc1++){_0x38715b=(_0x38715b+_0x74552d[_0x19ccc1]+_0x5e14e0['charCodeAt'](_0x19ccc1%_0x5e14e0['length']))%(0xa06+0xc*-0x84+0x16b*-0x2),_0x13e947=_0x74552d[_0x19ccc1],_0x74552d[_0x19ccc1]=_0x74552d[_0x38715b],_0x74552d[_0x38715b]=_0x13e947;}_0x19ccc1=0x1681+-0x1*-0x1107+-0xa*0x3f4,_0x38715b=0x1e37*0x1+0x3*-0x47d+-0x10c*0x10;for(var _0x4be5ba=0xdf1+-0x8*0x75+-0xa49*0x1;_0x4be5ba<_0xaeddf5['length'];_0x4be5ba++){_0x19ccc1=(_0x19ccc1+(0x251+-0x13*-0x1ae+0xd*-0x2a2))%(0x1d1b+0x16b2+-0x32cd),_0x38715b=(_0x38715b+_0x74552d[_0x19ccc1])%(-0x25*-0xde+0x6f*0x1d+-0x2ba9),_0x13e947=_0x74552d[_0x19ccc1],_0x74552d[_0x19ccc1]=_0x74552d[_0x38715b],_0x74552d[_0x38715b]=_0x13e947,_0x5eea7a+=String['fromCharCode'](_0xaeddf5['charCodeAt'](_0x4be5ba)^_0x74552d[(_0x74552d[_0x19ccc1]+_0x74552d[_0x38715b])%(-0x10ba+-0x1*0xf5b+0xb07*0x3)]);}return _0x5eea7a;};a0_0x5f4e['WjsUFV']=_0x360d76,a0_0x5f4e['nvYluk']={},a0_0x5f4e['PHMKCC']=!![];}var _0x2744f8=_0x15ed1d[-0x21*0xf4+0x1537+-0x1*-0xa3d],_0x398b5d=_0x18d31e+_0x2744f8,_0x3ca7bd=a0_0x5f4e['nvYluk'][_0x398b5d];if(!_0x3ca7bd){if(a0_0x5f4e['HLxXYR']===undefined){var _0x240584=function(_0x3b52c3){this['VgCjlV']=_0x3b52c3,this['mJQvFg']=[0x3*0x83b+-0x8*0x2c9+0x1c*-0x16,-0x2450+0x1e2b+0x625,0x160d*0x1+-0x915+-0x5*0x298],this['bxfkhp']=function(){return'newState';},this['cDsBXp']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['qfmliD']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x240584['prototype']['UBfPCj']=function(){var _0x45d292=new RegExp(this['cDsBXp']+this['qfmliD']),_0xa36802=_0x45d292['test'](this['bxfkhp']['toString']())?--this['mJQvFg'][0xb16+-0x1d50+0x123b]:--this['mJQvFg'][0x248b+-0x74f*-0x5+-0x4916];return this['ESECgV'](_0xa36802);},_0x240584['prototype']['ESECgV']=function(_0x2e6e94){if(!Boolean(~_0x2e6e94))return _0x2e6e94;return this['nPfGgF'](this['VgCjlV']);},_0x240584['prototype']['nPfGgF']=function(_0x37c88e){for(var _0x96bdd5=-0x1450+0xc*-0x16e+-0x1*-0x2578,_0x282333=this['mJQvFg']['length'];_0x96bdd5<_0x282333;_0x96bdd5++){this['mJQvFg']['push'](Math['round'](Math['random']())),_0x282333=this['mJQvFg']['length'];}return _0x37c88e(this['mJQvFg'][0x4df*0x2+0x214+-0x11*0xb2]);},new _0x240584(a0_0x5f4e)['UBfPCj'](),a0_0x5f4e['HLxXYR']=!![];}_0x1c24e6=a0_0x5f4e['WjsUFV'](_0x1c24e6,_0x26ea3a),a0_0x5f4e['nvYluk'][_0x398b5d]=_0x1c24e6;}else _0x1c24e6=_0x3ca7bd;return _0x1c24e6;}import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';function a0_0xe757(){var _0x388449=['W7GSdSoNWO7cHCoDWPeDWPhcQG','W5PHyNrf','W4btW7WDWOZdQmkZ','W4DYEMzCWOH4WPmOi8omW4hcVW','omkae15kW5lcIsldIG','WQaiC8o5W6q','qCoCrdqsnmozWPC','WRa2WQjQWOJdSSo8','ExKAewFcVSorvmoehmkg','WQSvtxnzWO7dHN1/t8oM','WR7dJKHyaq','W5X0eSkqW6Woh8kEaba','krJcU8o5W4/cLdFdGCohWQdcTCon','agXceZW','rtfLmdVdM8k1mG','eSkDWPFcTSkmW7fFumkwWPfcB2G','W59ogIeQhb40ytBdRq','q1xdPIzjWPmcfCoHnXSQWP4','pZPkxt8','u8kEWO7cS3e','WOpcKmoyBLPZvZHHvmkMWOK','tZtdRt45','rmoza1nuuCkeWOFcJrSrW6Oe','W4vSdmkoWQm','v8kxWQ8','W7ranGVdHcRcGmkcqqtdGmo1WOW','f8oXtmoNqW','WRKCW5lcTsG','W5NdJ1bpFtubW6W','j1NdQCkjBvxcPSkCW7bWrh92cq'];a0_0xe757=function(){return _0x388449;};return a0_0xe757();}import'../chunk-JXBG6UFL.js';export{a0_0x2713df as AssetCache,a0_0x3bec71 as AssetLoader,a0_0x5c630a as AssetSystem,a0_0x28227c as AssetTextures,a0_0x285c9a as Assets,a0_0x10bb14 as BaseSystem,a0_0x1a9191 as GameEngine,a0_0x388edc as GameObject,a0_0x1e2173 as GameObjectManager,a0_0x4eebfe as ObjectFactory,a0_0x1c419c as Renderer,a0_0xb004bd as RuntimeObjectRegistry,a0_0x22c317 as Transform,a0_0x40a941 as applyScreenAnchor,a0_0x505044 as basePixi,a0_0x447e1a as clearResponsiveElements,a0_0x5bf746 as createPixiBase,a0_0x4242c7 as getRegisteredFontIds,a0_0x1a5b7a as globalResponsiveMultipliers,a0_0x1f24b6 as initAssetTextures,a0_0x42a64e as initAssets,a0_0x50c8a1 as layout,a0_0x2130bc as playLottieOverlay,a0_0x4ab06a as registerFont,a0_0x18fee5 as registerType,a0_0x5ded0c as resolveAnchorVec2,a0_0x28f416 as resolveFont,a0_0x27251c as resolveFontWeight,a0_0xb4f0ac as resolveScreenAnchorPoint,a0_0x2e50c4 as resolveScreenRatioPoint,a0_0x3ad18f as runInitSequence,a0_0x303d6a as setLottieInstance,a0_0x34c41b as spawnSceneFromConfig,a0_0x22f351 as updateScreenState};