handler-playable-sdk 0.3.38 → 0.3.40

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=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var cl={};ut(cl,{COLORS:()=>le,ConfigWatcher:()=>$e,DebugPanel:()=>Mt,DefaultReloadStrategy:()=>St,Handler:()=>ne,PlayableLoadingScreen:()=>Gn,PreviewShell:()=>Hn,STROKE_WIDTH:()=>fr,THEME:()=>hr,applyConfigOverride:()=>Ae,applyConfigOverrides:()=>Se,applyConfigsToDisk:()=>wt,applyDefaults:()=>De,baseLottie:()=>ai,bootstrap:()=>Zo,clearConfigOverrides:()=>Ce,clearConfigOverridesForObject:()=>ms,configOverrideManager:()=>bs,createPreviewShell:()=>oa,deepClone:()=>U,default:()=>Oe,defaultPreset:()=>pn,deviceGroups:()=>Mi,devicePresets:()=>Pi,diffConfigs:()=>Ai,exportConfigsAsJSON:()=>xt,getConfigOverrides:()=>Y,getConfigStateSummary:()=>nn,getOverrideMode:()=>vt,getPresetById:()=>ze,getPresetsByCategory:()=>Mo,loadAllObjectConfigs:()=>on,loadComponentSchemas:()=>rn,loadEngineConfig:()=>ln,loadGamePromptConfig:()=>xi,loadObjectCentricConfig:()=>me,loadObjectConfig:()=>Le,loadSceneConfig:()=>cn,rehydrateObject:()=>Si,removeConfigOverride:()=>tn,resetToApplied:()=>Et,resetToOriginal:()=>an,setBootstrapDependencies:()=>Xo,setOverrideMode:()=>bi,setupHotReload:()=>Ti,setupLiveEditBridge:()=>Bn,toLegacyFormat:()=>wi,validateObjectConfig:()=>Xe});module.exports=Dr(cl);var xe={};function Bt(i,e,t=!1){xe[i]||(xe[i]=[]),xe[i].push({fn:e,once:t})}function ei(i,e){if(xe[i]){if(!e){delete xe[i];return}xe[i]=xe[i].filter(t=>t.fn!==e)}}function Ft(i,...e){let t=xe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&ei(i,n.fn)}function K(i,e){Bt(i,e,!0)}var F=null,Q=[],Ve=null;function La(i){F=i,Q=[],Ve!==null&&(clearTimeout(Ve),Ve=null)}function Ta(){var i,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(i=F==null?void 0:F.batchSize)!=null?i: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 Sa(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(s){n&&console.warn("[handler.telemetry] fetch failed",s)}}function ti(i,e){let t=Ta();if(e&&t.endpoint){if(Q.push(i),Q.length>t.maxQueue&&(Q=Q.slice(Q.length-t.maxQueue)),Q.length>=t.batchSize){Ca();return}Ve===null&&(Ve=window.setTimeout(()=>{Ve=null,Ca()},t.flushIntervalMs))}}async function Ca(){let i=Ta();if(!i.endpoint||Q.length===0)return;let e=Q.splice(0,i.batchSize);await Sa(i.endpoint,{events:e},i.transport,i.debug),Q.length>0&&await Sa(i.endpoint,{events:Q.splice(0,i.batchSize)},i.transport,i.debug)}function _a(i){return Math.max(0,Math.min(1,i))}function $r(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function gt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function zr(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Pa(i,e,t){try{i[e]=t}catch{}}function Nr(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 Ma(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 ka(i,e){let t=Nr(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 Oa(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=p=>{var u;i.add(p);let d=(u=e.get(p.target))!=null?u:new Set;d.add(p),e.set(p.target,d),n()},s=p=>{i.delete(p);let d=e.get(p.target);d&&(d.delete(p),d.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var d,u;let p=gt();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let h=p-g.startMs-g.delayMs;if(h<0)continue;let f=g.durationMs>0?h/g.durationMs:1,m=_a(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 E=f-y;m=_a(E)}let v=g.ease(m);g.yoyo&&y%2===1&&(v=1-v);for(let E of g.props)Pa(g.target,E.key,E.from+(E.to-E.from)*v);g.scaleFrom&&g.scaleTo&&Ma(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{(d=g.onUpdate)==null||d.call(g)}catch{}if(f>=b){r(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(p,d,u)=>{var E;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),h=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((E=u==null?void 0:u.delayMsOverride)!=null?E:0)),f=$r(d.ease),m=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let w of Object.keys(d)){if(y.has(w))continue;let T=d[w];typeof T=="number"&&v.push({key:w,from:zr(p,w),to:T})}let x=ka(p,d);return{target:p,startMs:gt(),delayMs:h,durationMs:g,ease:f,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:m,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(p,d){let u=l(p,d);return a(u),{kill:()=>r(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=gt())},resume:()=>{var f;if(!u.paused)return;let g=(f=u.pauseAtMs)!=null?f:gt(),h=gt()-g;u.startMs+=h,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(p,d,u){return c.set(p,d),c.to(p,u)},set(p,d){if(!p||!d)return;for(let g of Object.keys(d)){let h=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&Pa(p,g,h)}let u=ka(p,d);u.to&&Ma(p,u.to)},killTweensOf(p){let d=e.get(p);if(d)for(let u of Array.from(d))r(u)},timeline(p={}){let d=[],u=0,g=!1,h=[],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},m=y=>{d.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 m({kind:"to",target:y,vars:v,atMs:f(x)}),b},fromTo(y,v,x,E){return m({kind:"fromTo",target:y,vars:x,from:v,atMs:f(E)}),b},play(){var y,v;if(g)return b;g=!0,h=[];for(let x of d)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),h.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 h)y.pause();return b},kill(){for(let y of h)y.kill();h=[],g=!1}};return p.paused||b.play(),b}};return c}function Ia(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=Oa()}catch{}}var Ra={name:"handler-playable-sdk",version:"0.3.38",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 X=0,Br=X++,ja=X++,Da=X++,$a=X++,za=X++,Na=X++,Ha=X++,Ba=X++,Fa=X++,Ga=X++,Ua=X++,qa=X++,H=Br;function Va(){return H===ja}function Wa(){return H===Da}function Ya(){return H===$a}function Ka(){return H===za}function We(){return H===Na}function Ye(){return H===Ha}function Xa(){return H===Ba}function Ja(){return H===Fa}function Za(){return H===Ga}function ni(){return H===Ua}function ii(){return H===qa}function Qa(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),H=ja;return}catch{}else if(i==="dapi")try{dapi.isReady(),H=Da;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=$a)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(H=za)}catch{}else if(e==="mintegral")window.gameReady&&(H=Na);else if(e==="tapjoy")window.TJ_API&&(H=Ha);else if(e==="tiktok")window.openAppStore&&(H=Ba);else if(e==="smadex")try{window.smxTracking&&(H=Fa)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(H=Ga)}catch{}else e==="vungle"?H=Ua:(i==="nucleo"||e==="nucleo")&&(H=qa)}var Gt=qe(require("lottie-web"),1),ai=Gt.default;typeof window!="undefined"&&(window.lottie=Gt.default,window.__baseLottie=Gt.default);var Fr=require("pixi.js");var si=require("pixi.js");var Gr=null;function ri(i){Gr=i}Ut();oi();var ft=require("pixi.js");Ut();var Kr=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",pi=Kr;if(typeof window!="undefined")try{let i=new XMLHttpRequest;if(i.open("GET","./build-settings.json",!1),i.send(),i.status===200&&i.responseText){let e=JSON.parse(i.responseText);e!=null&&e.buildMode&&(pi=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${pi}`))}}catch{}var Ee=class{static async create(e,t,n){var l,c,p,d,u,g,h;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${pi}`);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 ft.Container;return this.applyTransform(f,t==null?void 0:t.transform,t),f}let s=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Re.load(e,a,n,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new ft.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(d=o==null?void 0:o.constructor)==null?void 0:d.name),this.applyTransform(o,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=r==null?void 0:r.constructor)==null?void 0:u.name,r),r&&(((g=r.constructor)==null?void 0:g.name)==="Container"||r instanceof ft.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}`],m=!1;for(let b of f)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(h=o==null?void 0:o.constructor)==null?void 0:h.name),m=!0;break}}catch{continue}m||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,t==null?void 0:t.transform,t);return o}static applyTransform(e,t,n){var a,s,r,o,l;if(!(!t||!e)){if(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(s=t.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=t.position.x)!=null?r:0,(o=t.position.y)!=null?o:0)),t.scale!==void 0){let c=(l=n==null?void 0:n.identity)==null?void 0:l.category,p=c==="ui"||c==="environment"?.2:1,d=t.scale*p;"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(d):e.scale=d)}t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor&&Array.isArray(t.anchor)&&("set"in e.anchor?e.anchor.set(t.anchor[0],t.anchor[1]):(e.anchor.x=t.anchor[0],e.anchor.y=t.anchor[1]))}}};var ht=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 Zr=qe(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Zr);Ke();var qt=require("pixi.js");Ke();var fi=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new ht}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 n=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ee.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await n(t);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await n(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 n=await Ee.create(e,t,this.app);this.instanceCache.set(e,n)}}get(e){return this.instanceCache.get(e)}},Qr=new fi,eo=new Proxy(Qr,{get(i,e){if(e in i&&typeof i[e]=="function")return i[e].bind(i);if(i.get(e))return i.get(e)}});Ke();var ss=require("pixi.js"),ge={width:400,height:600,designWidth:400,scaleFactor:1},Wt={scale:1,position:1},mi=[];function no(i,e,t,n,a,s,r){mi.push({element:i,originalScale:s,positionHelper:e,heightPercent:a}),e(i,t,n,a,s,r,!1)}function io(){mi.forEach(({element:i,originalScale:e,positionHelper:t,heightPercent:n})=>{let a=e*ge.scaleFactor;t(i,ge.width,ge.height,n,a,!0,!1)})}function hi(i,e){console.log(`[SCREEN] updateScreenState called: ${i}x${e}`),ge.width=i,ge.height=e,ge.scaleFactor=Math.min(i/ge.designWidth,1.15),Wt.scale=ge.scaleFactor,Wt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Wt.scale.toFixed(3)}`),io()}var bt={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 ao(i,e,t){let n=bt[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${e} = ${t}`))}function so(){return bt}var ro={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 Vt(i,e){return typeof i=="number"&&Number.isFinite(i)?i:e}function Yt(i,e={x:.5,y:.5}){var t;if(Array.isArray(i))return{x:Vt(i[0],e.x),y:Vt(i[1],e.y)};if(i&&typeof i=="object"){let n=i;return{x:Vt(n.x,e.x),y:Vt(n.y,e.y)}}if(typeof i=="string"){let n=i.trim().toLowerCase();return(t=ro[n])!=null?t:e}return e}function rs(i,e,t,n={}){var g,h,f,m,b,y;let a=Yt(t),s=(g=n.inset)!=null?g:{},r=(h=n.padding)!=null?h:{x:0,y:0},o=((f=s.left)!=null?f:0)+r.x,l=((m=s.right)!=null?m:0)+r.x,c=((b=s.top)!=null?b:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,d=Math.max(0,i-o-l),u=Math.max(0,e-c-p);return{x:o+d*a.x,y:c+u*a.y}}function os(i,e,t,n={}){var f,m,b,y,v,x;let a=(f=n.inset)!=null?f:{},s=(m=n.padding)!=null?m:{x:0,y:0},r=((b=a.left)!=null?b:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((v=a.top)!=null?v:0)+s.y,c=((x=a.bottom)!=null?x:0)+s.y,p=Math.max(0,i-r-o),d=Math.max(0,e-l-c),u=Yt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),h=Math.min(Math.max(u.y,0),1);return{x:r+p*g,y:l+d*h}}if(typeof window!="undefined"){let i=window.innerWidth,e=window.innerHeight,t=()=>{let n=window.innerWidth,a=window.innerHeight;(n!==i||a!==e)&&(i=n,e=a,hi(n,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),hi(window.innerWidth,window.innerHeight),window.updateDebugConfig=ao,window.getDebugConfig=so,window.copyConfig=yo,window.applyConfig=mt,window.applyConfigForRatio=vo,window.positionAtBottom=ls,window.positionAtTop=co,window.positionAtCenter=po,window.positionAtLeft=uo,window.positionAtRight=go,window.positionAtBottomLeft=fo,window.positionAtBottomRight=ho,window.positionAtTopLeft=mo,window.positionAtTopRight=bo,window.applyPositionContract=lo,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 Kt(i,e,t=0){return i*e+t}function Xt(i,e,t=0){return i*(1-e)+t}function Jt(i,e,t=0){return i*e+t}function Zt(i,e,t=0){return i*(1-e)+t}function J(i,e=0){return i/2+e}function oo(i,e){return i*e}function lo(i,e,t,n){var r,o,l,c,p,d,u,g,h,f,m,b,y,v,x,E,w,T,S,O;let a=0,s=0;switch(n.type){case"top":a=J(e,(o=(r=n.offset)==null?void 0:r.x)!=null?o:0),s=Kt(t,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=J(e,(d=(p=n.offset)==null?void 0:p.x)!=null?d:0),s=Xt(t,n.percent,(g=(u=n.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Jt(e,n.percent,(f=(h=n.offset)==null?void 0:h.x)!=null?f:0),s=J(t,(b=(m=n.offset)==null?void 0:m.y)!=null?b:0);break;case"right":a=Zt(e,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),s=J(t,(E=(x=n.offset)==null?void 0:x.y)!=null?E:0);break;case"center":a=J(e,(T=(w=n.offset)==null?void 0:w.x)!=null?T:0),s=J(t,(O=(S=n.offset)==null?void 0:S.y)!=null?O:0);break}i.position?i.position.set(a,s):(i.x=a,i.y=s),n.scale!==void 0&&n.scale!==1&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(n.scale,n.scale):(i.scale.x=n.scale,i.scale.y=n.scale))}function ls(i,e,t,n=.2,a=1,s=!0,r=!1){let o=oo(t,n),l=Xt(t,n/2);fe(i,J(e),l);let c=s?a*ge.scaleFactor:a;he(i,c),r&&!mi.find(p=>p.element===i)&&no(i,ls,e,t,n,a,s)}function co(i,e,t,n=.1,a=1){fe(i,J(e),Kt(t,n)),he(i,a)}function po(i,e,t,n=0,a=0,s=1){fe(i,J(e,n),J(t,a)),he(i,s)}function uo(i,e,t,n=.1,a=1){fe(i,Jt(e,n),J(t)),he(i,a)}function go(i,e,t,n=.1,a=1){fe(i,Zt(e,n),J(t)),he(i,a)}function fo(i,e,t,n=.05,a=.05,s=1){fe(i,Jt(e,a),Xt(t,n)),he(i,s)}function ho(i,e,t,n=.05,a=.05,s=1){fe(i,Zt(e,a),Xt(t,n)),he(i,s)}function mo(i,e,t,n=.05,a=.05,s=1){fe(i,Jt(e,a),Kt(t,n)),he(i,s)}function bo(i,e,t,n=.05,a=.05,s=1){fe(i,Zt(e,a),Kt(t,n)),he(i,s)}function fe(i,e,t){i&&i.position?typeof i.position.set=="function"?i.position.set(e,t):(i.position.x=e,i.position.y=t):i&&(i.x=e,i.y=t)}function he(i,e){e!==1&&i&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(e,e):i.scale.x!==void 0&&i.scale.y!==void 0&&(i.scale.x=e,i.scale.y=e))}var je={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 yo(i){return i&&je[i]?JSON.parse(JSON.stringify(je[i])):JSON.parse(JSON.stringify(bt))}function mt(i){Object.keys(i).forEach(e=>{let t=e;bt[t]&&i[t]&&Object.assign(bt[t],i[t])}),console.log("Config applied:",i)}function vo(i,e){let t=i/e;t>1.6?(mt(je.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(mt(je.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(mt(je.square),console.log("Applied SQUARE config for ratio:",t)):(mt(je.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let i=window;i.configPresets=je,i.resolveAnchorVec2=i.resolveAnchorVec2||Yt,i.resolveScreenAnchorPoint=i.resolveScreenAnchorPoint||rs,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||os}dn();function G(i,e){let t=(a,s)=>s===0?a:t(s,a%s),n=t(i,e);return`${i/n}:${e/n}`}var $c=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:G(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:G(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:G(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:G(360,780)}],zc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:G(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:G(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:G(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:G(412,915)}],Nc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:G(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:G(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:G(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:G(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:G(800,1280)}],_i=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:G(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:G(768,1024),mraidScale:.7}];var Pi=[..._i],Mi=[{category:"playable",label:"Playable Ad",devices:_i}],pn=_i[0];function ze(i){return Pi.find(e=>e.id===i)||pn}function Mo(i){return Pi.filter(e=>e.category===i)}var un=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=n}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let n=this.modal.querySelector("[data-ai-generate]");n==null||n.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let n="";e==="edit"&&this.currentAsset?n=`Edit this image: ${this.currentObjectId}`:n=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",n,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var cl={};ut(cl,{COLORS:()=>le,ConfigWatcher:()=>$e,DebugPanel:()=>Mt,DefaultReloadStrategy:()=>St,Handler:()=>ne,PlayableLoadingScreen:()=>Gn,PreviewShell:()=>Hn,STROKE_WIDTH:()=>fr,THEME:()=>hr,applyConfigOverride:()=>Ae,applyConfigOverrides:()=>Se,applyConfigsToDisk:()=>wt,applyDefaults:()=>De,baseLottie:()=>ai,bootstrap:()=>Zo,clearConfigOverrides:()=>Ce,clearConfigOverridesForObject:()=>ms,configOverrideManager:()=>bs,createPreviewShell:()=>oa,deepClone:()=>U,default:()=>Oe,defaultPreset:()=>pn,deviceGroups:()=>Mi,devicePresets:()=>Pi,diffConfigs:()=>Ai,exportConfigsAsJSON:()=>xt,getConfigOverrides:()=>Y,getConfigStateSummary:()=>nn,getOverrideMode:()=>vt,getPresetById:()=>ze,getPresetsByCategory:()=>Mo,loadAllObjectConfigs:()=>on,loadComponentSchemas:()=>rn,loadEngineConfig:()=>ln,loadGamePromptConfig:()=>xi,loadObjectCentricConfig:()=>me,loadObjectConfig:()=>Le,loadSceneConfig:()=>cn,rehydrateObject:()=>Si,removeConfigOverride:()=>tn,resetToApplied:()=>Et,resetToOriginal:()=>an,setBootstrapDependencies:()=>Xo,setOverrideMode:()=>bi,setupHotReload:()=>Ti,setupLiveEditBridge:()=>Bn,toLegacyFormat:()=>wi,validateObjectConfig:()=>Xe});module.exports=Dr(cl);var xe={};function Bt(i,e,t=!1){xe[i]||(xe[i]=[]),xe[i].push({fn:e,once:t})}function ei(i,e){if(xe[i]){if(!e){delete xe[i];return}xe[i]=xe[i].filter(t=>t.fn!==e)}}function Ft(i,...e){let t=xe[i];if(t)for(let n of[...t])n.fn(...e),n.once&&ei(i,n.fn)}function K(i,e){Bt(i,e,!0)}var F=null,Q=[],Ve=null;function La(i){F=i,Q=[],Ve!==null&&(clearTimeout(Ve),Ve=null)}function Ta(){var i,e,t;return{endpoint:(F==null?void 0:F.endpoint)||"",transport:(F==null?void 0:F.transport)||"beacon",batchSize:(i=F==null?void 0:F.batchSize)!=null?i: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 Sa(i,e,t,n){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(i,new Blob([a],{type:"application/json"}));n&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){n&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),n&&console.log("[handler.telemetry] fetch",e)}catch(s){n&&console.warn("[handler.telemetry] fetch failed",s)}}function ti(i,e){let t=Ta();if(e&&t.endpoint){if(Q.push(i),Q.length>t.maxQueue&&(Q=Q.slice(Q.length-t.maxQueue)),Q.length>=t.batchSize){Ca();return}Ve===null&&(Ve=window.setTimeout(()=>{Ve=null,Ca()},t.flushIntervalMs))}}async function Ca(){let i=Ta();if(!i.endpoint||Q.length===0)return;let e=Q.splice(0,i.batchSize);await Sa(i.endpoint,{events:e},i.transport,i.debug),Q.length>0&&await Sa(i.endpoint,{events:Q.splice(0,i.batchSize)},i.transport,i.debug)}function _a(i){return Math.max(0,Math.min(1,i))}function $r(i){let e=String(i!=null?i:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),n=t?Number(t[1]):1.8;return a=>1+(n+1)*Math.pow(a-1,3)+n*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function gt(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function zr(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Pa(i,e,t){try{i[e]=t}catch{}}function Nr(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 Ma(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 ka(i,e){let t=Nr(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 Oa(){let i=new Set,e=new WeakMap,t=null,n=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),i.size>0&&n()})},a=p=>{var u;i.add(p);let d=(u=e.get(p.target))!=null?u:new Set;d.add(p),e.set(p.target,d),n()},s=p=>{i.delete(p);let d=e.get(p.target);d&&(d.delete(p),d.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var d,u;let p=gt();for(let g of Array.from(i)){if(g.killed||g.paused)continue;let h=p-g.startMs-g.delayMs;if(h<0)continue;let f=g.durationMs>0?h/g.durationMs:1,m=_a(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 E=f-y;m=_a(E)}let v=g.ease(m);g.yoyo&&y%2===1&&(v=1-v);for(let E of g.props)Pa(g.target,E.key,E.from+(E.to-E.from)*v);g.scaleFrom&&g.scaleTo&&Ma(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{(d=g.onUpdate)==null||d.call(g)}catch{}if(f>=b){r(g);try{(u=g.onComplete)==null||u.call(g)}catch{}}}},l=(p,d,u)=>{var E;let g=Math.max(0,(typeof d.duration=="number"?d.duration:.5)*1e3),h=Math.max(0,(typeof d.delay=="number"?d.delay:0)*1e3+((E=u==null?void 0:u.delayMsOverride)!=null?E:0)),f=$r(d.ease),m=typeof d.repeat=="number"?Math.max(0,d.repeat|0):0,b=d.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),v=[];for(let w of Object.keys(d)){if(y.has(w))continue;let T=d[w];typeof T=="number"&&v.push({key:w,from:zr(p,w),to:T})}let x=ka(p,d);return{target:p,startMs:gt(),delayMs:h,durationMs:g,ease:f,props:v,scaleFrom:x.from,scaleTo:x.to,repeat:m,yoyo:b,onUpdate:typeof d.onUpdate=="function"?d.onUpdate:void 0,onComplete:typeof d.onComplete=="function"?d.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(p,d){let u=l(p,d);return a(u),{kill:()=>r(u),pause:()=>{u.paused||(u.paused=!0,u.pauseAtMs=gt())},resume:()=>{var f;if(!u.paused)return;let g=(f=u.pauseAtMs)!=null?f:gt(),h=gt()-g;u.startMs+=h,u.paused=!1,u.pauseAtMs=null},isActive:()=>!u.killed&&!u.paused}},fromTo(p,d,u){return c.set(p,d),c.to(p,u)},set(p,d){if(!p||!d)return;for(let g of Object.keys(d)){let h=d[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof h=="number"&&Pa(p,g,h)}let u=ka(p,d);u.to&&Ma(p,u.to)},killTweensOf(p){let d=e.get(p);if(d)for(let u of Array.from(d))r(u)},timeline(p={}){let d=[],u=0,g=!1,h=[],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},m=y=>{d.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 m({kind:"to",target:y,vars:v,atMs:f(x)}),b},fromTo(y,v,x,E){return m({kind:"fromTo",target:y,vars:x,from:v,atMs:f(E)}),b},play(){var y,v;if(g)return b;g=!0,h=[];for(let x of d)x.kind==="fromTo"&&c.set(x.target,(y=x.from)!=null?y:{}),h.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 h)y.pause();return b},kill(){for(let y of h)y.kill();h=[],g=!1}};return p.paused||b.play(),b}};return c}function Ia(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=Oa()}catch{}}var Ra={name:"handler-playable-sdk",version:"0.3.40",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 X=0,Br=X++,ja=X++,Da=X++,$a=X++,za=X++,Na=X++,Ha=X++,Ba=X++,Fa=X++,Ga=X++,Ua=X++,qa=X++,H=Br;function Va(){return H===ja}function Wa(){return H===Da}function Ya(){return H===$a}function Ka(){return H===za}function We(){return H===Na}function Ye(){return H===Ha}function Xa(){return H===Ba}function Ja(){return H===Fa}function Za(){return H===Ga}function ni(){return H===Ua}function ii(){return H===qa}function Qa(){let i=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(i==="mraid")try{mraid.getState(),H=ja;return}catch{}else if(i==="dapi")try{dapi.isReady(),H=Da;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=$a)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(H=za)}catch{}else if(e==="mintegral")window.gameReady&&(H=Na);else if(e==="tapjoy")window.TJ_API&&(H=Ha);else if(e==="tiktok")window.openAppStore&&(H=Ba);else if(e==="smadex")try{window.smxTracking&&(H=Fa)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(H=Ga)}catch{}else e==="vungle"?H=Ua:(i==="nucleo"||e==="nucleo")&&(H=qa)}var Gt=qe(require("lottie-web"),1),ai=Gt.default;typeof window!="undefined"&&(window.lottie=Gt.default,window.__baseLottie=Gt.default);var Fr=require("pixi.js");var si=require("pixi.js");var Gr=null;function ri(i){Gr=i}Ut();oi();var ft=require("pixi.js");Ut();var Kr=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",pi=Kr;if(typeof window!="undefined")try{let i=new XMLHttpRequest;if(i.open("GET","./build-settings.json",!1),i.send(),i.status===200&&i.responseText){let e=JSON.parse(i.responseText);e!=null&&e.buildMode&&(pi=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${pi}`))}}catch{}var Ee=class{static async create(e,t,n){var l,c,p,d,u,g,h;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${pi}`);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 ft.Container;return this.applyTransform(f,t==null?void 0:t.transform,t),f}let s=(c=t==null?void 0:t.identity)==null?void 0:c.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Re.load(e,a,n,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new ft.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(d=o==null?void 0:o.constructor)==null?void 0:d.name),this.applyTransform(o,t==null?void 0:t.transform,t);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=r==null?void 0:r.constructor)==null?void 0:u.name,r),r&&(((g=r.constructor)==null?void 0:g.name)==="Container"||r instanceof ft.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}`],m=!1;for(let b of f)try{let y=await fetch(b);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",b,"type:",(h=o==null?void 0:o.constructor)==null?void 0:h.name),m=!0;break}}catch{continue}m||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,t==null?void 0:t.transform,t);return o}static applyTransform(e,t,n){var a,s,r,o;!t||!e||(t.position&&("x"in e&&"y"in e?(e.x=(a=t.position.x)!=null?a:0,e.y=(s=t.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=t.position.x)!=null?r:0,(o=t.position.y)!=null?o: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&&Array.isArray(t.anchor)&&("set"in e.anchor?e.anchor.set(t.anchor[0],t.anchor[1]):(e.anchor.x=t.anchor[0],e.anchor.y=t.anchor[1])))}};var ht=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 Zr=qe(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=Zr);Ke();var qt=require("pixi.js");Ke();var fi=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new ht}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 n=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ee.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await n(t);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await n(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 n=await Ee.create(e,t,this.app);this.instanceCache.set(e,n)}}get(e){return this.instanceCache.get(e)}},Qr=new fi,eo=new Proxy(Qr,{get(i,e){if(e in i&&typeof i[e]=="function")return i[e].bind(i);if(i.get(e))return i.get(e)}});Ke();var ss=require("pixi.js"),ge={width:400,height:600,designWidth:400,scaleFactor:1},Wt={scale:1,position:1},mi=[];function no(i,e,t,n,a,s,r){mi.push({element:i,originalScale:s,positionHelper:e,heightPercent:a}),e(i,t,n,a,s,r,!1)}function io(){mi.forEach(({element:i,originalScale:e,positionHelper:t,heightPercent:n})=>{let a=e*ge.scaleFactor;t(i,ge.width,ge.height,n,a,!0,!1)})}function hi(i,e){console.log(`[SCREEN] updateScreenState called: ${i}x${e}`),ge.width=i,ge.height=e,ge.scaleFactor=Math.min(i/ge.designWidth,1.15),Wt.scale=ge.scaleFactor,Wt.position=1,console.log(`[SCREEN] Global multipliers - scale: ${Wt.scale.toFixed(3)}`),io()}var bt={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 ao(i,e,t){let n=bt[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${e} = ${t}`))}function so(){return bt}var ro={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 Vt(i,e){return typeof i=="number"&&Number.isFinite(i)?i:e}function Yt(i,e={x:.5,y:.5}){var t;if(Array.isArray(i))return{x:Vt(i[0],e.x),y:Vt(i[1],e.y)};if(i&&typeof i=="object"){let n=i;return{x:Vt(n.x,e.x),y:Vt(n.y,e.y)}}if(typeof i=="string"){let n=i.trim().toLowerCase();return(t=ro[n])!=null?t:e}return e}function rs(i,e,t,n={}){var g,h,f,m,b,y;let a=Yt(t),s=(g=n.inset)!=null?g:{},r=(h=n.padding)!=null?h:{x:0,y:0},o=((f=s.left)!=null?f:0)+r.x,l=((m=s.right)!=null?m:0)+r.x,c=((b=s.top)!=null?b:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,d=Math.max(0,i-o-l),u=Math.max(0,e-c-p);return{x:o+d*a.x,y:c+u*a.y}}function os(i,e,t,n={}){var f,m,b,y,v,x;let a=(f=n.inset)!=null?f:{},s=(m=n.padding)!=null?m:{x:0,y:0},r=((b=a.left)!=null?b:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((v=a.top)!=null?v:0)+s.y,c=((x=a.bottom)!=null?x:0)+s.y,p=Math.max(0,i-r-o),d=Math.max(0,e-l-c),u=Yt(t,{x:.5,y:.5}),g=Math.min(Math.max(u.x,0),1),h=Math.min(Math.max(u.y,0),1);return{x:r+p*g,y:l+d*h}}if(typeof window!="undefined"){let i=window.innerWidth,e=window.innerHeight,t=()=>{let n=window.innerWidth,a=window.innerHeight;(n!==i||a!==e)&&(i=n,e=a,hi(n,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),hi(window.innerWidth,window.innerHeight),window.updateDebugConfig=ao,window.getDebugConfig=so,window.copyConfig=yo,window.applyConfig=mt,window.applyConfigForRatio=vo,window.positionAtBottom=ls,window.positionAtTop=co,window.positionAtCenter=po,window.positionAtLeft=uo,window.positionAtRight=go,window.positionAtBottomLeft=fo,window.positionAtBottomRight=ho,window.positionAtTopLeft=mo,window.positionAtTopRight=bo,window.applyPositionContract=lo,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 Kt(i,e,t=0){return i*e+t}function Xt(i,e,t=0){return i*(1-e)+t}function Jt(i,e,t=0){return i*e+t}function Zt(i,e,t=0){return i*(1-e)+t}function J(i,e=0){return i/2+e}function oo(i,e){return i*e}function lo(i,e,t,n){var r,o,l,c,p,d,u,g,h,f,m,b,y,v,x,E,w,T,S,O;let a=0,s=0;switch(n.type){case"top":a=J(e,(o=(r=n.offset)==null?void 0:r.x)!=null?o:0),s=Kt(t,n.percent,(c=(l=n.offset)==null?void 0:l.y)!=null?c:0);break;case"bottom":a=J(e,(d=(p=n.offset)==null?void 0:p.x)!=null?d:0),s=Xt(t,n.percent,(g=(u=n.offset)==null?void 0:u.y)!=null?g:0);break;case"left":a=Jt(e,n.percent,(f=(h=n.offset)==null?void 0:h.x)!=null?f:0),s=J(t,(b=(m=n.offset)==null?void 0:m.y)!=null?b:0);break;case"right":a=Zt(e,n.percent,(v=(y=n.offset)==null?void 0:y.x)!=null?v:0),s=J(t,(E=(x=n.offset)==null?void 0:x.y)!=null?E:0);break;case"center":a=J(e,(T=(w=n.offset)==null?void 0:w.x)!=null?T:0),s=J(t,(O=(S=n.offset)==null?void 0:S.y)!=null?O:0);break}i.position?i.position.set(a,s):(i.x=a,i.y=s),n.scale!==void 0&&n.scale!==1&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(n.scale,n.scale):(i.scale.x=n.scale,i.scale.y=n.scale))}function ls(i,e,t,n=.2,a=1,s=!0,r=!1){let o=oo(t,n),l=Xt(t,n/2);fe(i,J(e),l);let c=s?a*ge.scaleFactor:a;he(i,c),r&&!mi.find(p=>p.element===i)&&no(i,ls,e,t,n,a,s)}function co(i,e,t,n=.1,a=1){fe(i,J(e),Kt(t,n)),he(i,a)}function po(i,e,t,n=0,a=0,s=1){fe(i,J(e,n),J(t,a)),he(i,s)}function uo(i,e,t,n=.1,a=1){fe(i,Jt(e,n),J(t)),he(i,a)}function go(i,e,t,n=.1,a=1){fe(i,Zt(e,n),J(t)),he(i,a)}function fo(i,e,t,n=.05,a=.05,s=1){fe(i,Jt(e,a),Xt(t,n)),he(i,s)}function ho(i,e,t,n=.05,a=.05,s=1){fe(i,Zt(e,a),Xt(t,n)),he(i,s)}function mo(i,e,t,n=.05,a=.05,s=1){fe(i,Jt(e,a),Kt(t,n)),he(i,s)}function bo(i,e,t,n=.05,a=.05,s=1){fe(i,Zt(e,a),Kt(t,n)),he(i,s)}function fe(i,e,t){i&&i.position?typeof i.position.set=="function"?i.position.set(e,t):(i.position.x=e,i.position.y=t):i&&(i.x=e,i.y=t)}function he(i,e){e!==1&&i&&i.scale&&(typeof i.scale.set=="function"?i.scale.set(e,e):i.scale.x!==void 0&&i.scale.y!==void 0&&(i.scale.x=e,i.scale.y=e))}var je={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 yo(i){return i&&je[i]?JSON.parse(JSON.stringify(je[i])):JSON.parse(JSON.stringify(bt))}function mt(i){Object.keys(i).forEach(e=>{let t=e;bt[t]&&i[t]&&Object.assign(bt[t],i[t])}),console.log("Config applied:",i)}function vo(i,e){let t=i/e;t>1.6?(mt(je.wide),console.log("Applied WIDE config for ratio:",t)):t<.7?(mt(je.tall),console.log("Applied TALL config for ratio:",t)):t>.8&&t<1.2?(mt(je.square),console.log("Applied SQUARE config for ratio:",t)):(mt(je.default),console.log("Applied DEFAULT config for ratio:",t))}if(typeof window!="undefined"){let i=window;i.configPresets=je,i.resolveAnchorVec2=i.resolveAnchorVec2||Yt,i.resolveScreenAnchorPoint=i.resolveScreenAnchorPoint||rs,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||os}dn();function G(i,e){let t=(a,s)=>s===0?a:t(s,a%s),n=t(i,e);return`${i/n}:${e/n}`}var $c=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:G(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:G(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:G(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:G(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:G(360,780)}],zc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:G(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:G(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:G(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:G(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:G(412,915)}],Nc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:G(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:G(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:G(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:G(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:G(800,1280)}],_i=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:G(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:G(768,1024),mraidScale:.7}];var Pi=[..._i],Mi=[{category:"playable",label:"Playable Ad",devices:_i}],pn=_i[0];function ze(i){return Pi.find(e=>e.id===i)||pn}function Mo(i){return Pi.filter(e=>e.category===i)}var un=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" style="left:16px; top:72px;">
48
48
  <div class="scene-panel-header" data-panel-handle>
49
49
  <div class="panel-title">
@@ -1079,7 +1079,7 @@ This will DIRECTLY MODIFY your base configuration files WITHOUT creating a snaps
1079
1079
 
1080
1080
  This cannot be undone unless you have git commits or backups.
1081
1081
 
1082
- Are you absolutely sure?`))try{let t=xt(),n={};for(let[s,r]of Object.entries(t.objects)){let o=r,l=s;/^(json\.|ui\.|effects\.|engine\.)/.test(l)||(l=`json.${s}`),o&&typeof o=="object"&&(o.identity||(o.identity={}),o.identity.id=l),n[`objects/${l}.json`]=o}t.engine&&(t.engine.runtime&&(n["engine/engine.runtime.json"]=t.engine.runtime),t.engine.assets&&(n["engine/engine.assets.json"]=t.engine.assets),t.engine.splash&&(n["engine/engine.splash.json"]=t.engine.splash),t.engine.loading&&(n["engine/engine.loading.json"]=t.engine.loading),t.engine.start&&(n["engine/engine.start.json"]=t.engine.start),t.engine.tutorial&&(n["engine/engine.tutorial.json"]=t.engine.tutorial),t.engine.endgame&&(n["engine/engine.endgame.json"]=t.engine.endgame),!t.engine.runtime&&!t.engine.assets&&(n["engine/engine.json"]=t.engine));for(let[s,r]of Object.entries(t.scenes)){let o=s.startsWith("scene.")?s:`scene.${s}`;n[`scenes/${o}.json`]=r}let a=await fetch("/api/apply-direct",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configs:n,assets:{}})});if(!a.ok){let s=await a.json();throw new Error(s.error||"Direct apply failed")}Ce(),this.showSuccessNotification(),this.refreshPanel()}catch(t){console.error("[ConfigPersistence] Direct apply failed:",t),alert(`\u274C Direct apply failed: ${t.message}`)}}};var Mt=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 un;this.sceneToolsPanel=new fn;this.inspectorPanel=new Tn;this.libraryPanel=new hn;this.brandVisionPanel=new Mn;this.customizeSettingsPanel=new kn;this.configPersistencePanel=new Nn;this.loadingScreenPanel=new On}applyAssetChange(e,t){return Hs(this,e,t)}resetAsset(e){return Bs(this,e)}applySlotAsset(e,t,n){return Fs(this,e,t,n)}resetSlotAsset(e,t,n){return Gs(this,e,t,n)}startObjectVisuals(){return Ws(this)}stopObjectVisuals(){return Ys(this)}shouldRunObjectVisuals(){return In(this)}updateObjectVisuals(){return Rn(this)}getSelectedInstanceId(){return $i(this)}getDisplayObjectById(e){return zi(this,e)}getSelectedObjectConfig(){return Pt(this)}getConfigAnchorWorldPoint(e){return Ni(this,e)}getScreenSize(){return Hi(this)}ensureBoundsGfx(){return Bi(this)}ensureAnchorGfx(){return Fi(this)}drawBounds(e){return Gi(this,e)}drawAnchor(e){return Ui(this,e)}clearBounds(){return qi(this)}clearAnchor(){return Vi(this)}clearObjectVisuals(){return Tt(this)}updateObjectInfo(e){return Lt(this,e)}resetDebugConfig(){return Dn(this)}applyDebugConfig(){return Js(this)}exportDebugConfig(){return $n(this)}loadObjectConfig(e){return Zs(this,e)}fillConfigViewer(e){return jn(this,e)}copyConfigValues(){return Qs(this)}applyObjectConfig(e){return Yi(this,e)}applyCustomizeSettings(e,t){return er(this,e,t)}scheduleObjectAutoApply(){return tr(this)}setupDebugEventListeners(){return ir(this)}setupDebugInputListeners(e){return Ji(this,e)}setupPanelLayout(){return ar(this)}setupCollapsiblePanels(e){return Zi(this,e)}setupRangeInput(e,t,n,a){return te(this,e,t,n,a)}updateWorkbenchTabs(){return Xi(this)}saveWorkbenchState(){return Ne(this)}loadWorkbenchState(){return zn(this)}initialize(e){var t;this.container=e,this.debugOverlay=e.querySelector(".debug-overlay"),this.configViewer=e.querySelector("#config-viewer");try{let n=localStorage.getItem("preview_workbench_state");if(n){let a=JSON.parse(n);a.activeTab&&(this.activeTab=a.activeTab)}}catch(n){console.warn("[PREVIEW] Failed to load workbench tab state",n)}this.sceneObjectsPanel.initialize(e,{onSelect:n=>this.handleObjectSelect(n)}),this.libraryPanel.initialize(e,{onApply:(n,a,s)=>this.applySlotAsset(n,a,s),onReset:(n,a,s)=>this.resetSlotAsset(n,a,s)}),this.inspectorPanel.initialize(e,{onPropertyChange:(n,a,s)=>{console.log("[Inspector] Property changed:",n,a,s)}}),this.brandVisionPanel.initialize(e,()=>{this.toggleDebug(!1);let n="/dashboard";window.location.pathname!==n&&(window.location.href=n)}),this.customizeSettingsPanel.initialize(e,{onApply:(n,a)=>this.applyCustomizeSettings(n,a)}),this.sceneToolsPanel.initialize(e,{onHighlightObject:n=>{this.highlightObject=n,n?this.selectedObjectId&&this.startObjectVisuals():this.stopObjectVisuals()},onHighlightAnchor:n=>{this.highlightAnchor=n,n?this.selectedObjectId&&this.startObjectVisuals():this.stopObjectVisuals()},onNudge:(n,a)=>this.nudgeSelectedObject(n,a),onShowSplash:()=>{let n=window;typeof n.__previewShowSplash=="function"&&n.__previewShowSplash()},onUpdateSplash:n=>{let a=window;typeof a.applyEditableEngineConfig=="function"&&a.applyEditableEngineConfig({splash:n})}}),this.configPersistencePanel.initialize(e),this.loadingScreenPanel.initialize(e,{onShowLoadingScreen:()=>{let n=window;typeof n.__previewShowLoading=="function"?n.__previewShowLoading():console.warn("[DEBUG] __previewShowLoading not available")},onHideLoadingScreen:()=>{let n=window;typeof n.__previewHideLoading=="function"?n.__previewHideLoading():console.warn("[DEBUG] __previewHideLoading not available")},onUpdateLoading:n=>{let a=window;typeof a.applyEditableEngineConfig=="function"&&a.applyEditableEngineConfig({loading:n}),typeof a.__previewUpdateLoading=="function"?a.__previewUpdateLoading(n):console.warn("[DEBUG] __previewUpdateLoading not available")}}),window.__openAiEditor=(n,a,s,r)=>{this.customizeSettingsPanel.openAiEditor(n,a,s,r)},this.setupPanelLayout(),this.updateWorkbenchTabs(),window.__debugContext=this,window.__updateWorkbenchTabs=()=>this.updateWorkbenchTabs(),this.isDebugOpen=!0,(t=this.debugOverlay)==null||t.classList.remove("hidden"),this.updateDebugBadge(),this.sceneObjectsPanel.refreshObjects(),window.__previewSelectObject=n=>this.selectObject(n),window.addEventListener("config:changed",n=>{var a,s;((a=n.detail)==null?void 0:a.action)!=="remove"&&((s=n.detail)==null?void 0:s.action)!=="clear_object"&&this.highlightChangesTab()}),window.applyAssetToSlot=(n,a,s)=>this.applySlotAsset(n,a,s),window.refreshAssetLibrary=()=>this.libraryPanel.refresh(),window.reRenderAssetLibrary=()=>this.libraryPanel.reRender(),window.getEngineSplashConfig=()=>{var a;let n=window.getActiveConfig;if(typeof n=="function"){let s=n();return((a=s==null?void 0:s.engine)==null?void 0:a.splash)||null}return null},window.addAssetToRegistry=(n,a)=>{let s=window.getEditableAssets;if(typeof s=="function"){let r=s();if(r!=null&&r.libraryAssets&&(r.libraryAssets[n]||(r.libraryAssets[n]=[]),!r.libraryAssets[n].some(l=>l.filename===a))){let l=a.replace(/\.(png|jpg|jpeg)$/i,"").replace(/_/g," ");r.libraryAssets[n].unshift({filename:a,displayName:l}),console.log(`[DEBUG] Added ${a} to registry category ${n}`)}}}}selectObject(e){this.handleObjectSelect(e),this.activeTab!=="inspector"&&(this.activeTab="inspector",this.updateWorkbenchTabs())}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`
1082
+ Are you absolutely sure?`))try{let t=xt(),n={};for(let[s,r]of Object.entries(t.objects)){let o=r,l=s;/^(json\.|ui\.|effects\.|engine\.)/.test(l)||(l=`json.${s}`),o&&typeof o=="object"&&(o.identity||(o.identity={}),o.identity.id=l),n[`objects/${l}.json`]=o}t.engine&&(t.engine.runtime&&(n["engine/engine.runtime.json"]=t.engine.runtime),t.engine.assets&&(n["engine/engine.assets.json"]=t.engine.assets),t.engine.splash&&(n["engine/engine.splash.json"]=t.engine.splash),t.engine.loading&&(n["engine/engine.loading.json"]=t.engine.loading),t.engine.start&&(n["engine/engine.start.json"]=t.engine.start),t.engine.tutorial&&(n["engine/engine.tutorial.json"]=t.engine.tutorial),t.engine.endgame&&(n["engine/engine.endgame.json"]=t.engine.endgame),!t.engine.runtime&&!t.engine.assets&&(n["engine/engine.json"]=t.engine));for(let[s,r]of Object.entries(t.scenes)){let o=s.startsWith("scene.")?s:`scene.${s}`;n[`scenes/${o}.json`]=r}let a=await fetch("/api/apply-direct",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({configs:n,assets:{}})});if(!a.ok){let s=await a.json();throw new Error(s.error||"Direct apply failed")}Ce(),this.showSuccessNotification(),this.refreshPanel()}catch(t){console.error("[ConfigPersistence] Direct apply failed:",t),alert(`\u274C Direct apply failed: ${t.message}`)}}};var Mt=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 un;this.sceneToolsPanel=new fn;this.inspectorPanel=new Tn;this.libraryPanel=new hn;this.brandVisionPanel=new Mn;this.customizeSettingsPanel=new kn;this.configPersistencePanel=new Nn;this.loadingScreenPanel=new On}applyAssetChange(e,t){return Hs(this,e,t)}resetAsset(e){return Bs(this,e)}applySlotAsset(e,t,n){return Fs(this,e,t,n)}resetSlotAsset(e,t,n){return Gs(this,e,t,n)}startObjectVisuals(){return Ws(this)}stopObjectVisuals(){return Ys(this)}shouldRunObjectVisuals(){return In(this)}updateObjectVisuals(){return Rn(this)}getSelectedInstanceId(){return $i(this)}getDisplayObjectById(e){return zi(this,e)}getSelectedObjectConfig(){return Pt(this)}getConfigAnchorWorldPoint(e){return Ni(this,e)}getScreenSize(){return Hi(this)}ensureBoundsGfx(){return Bi(this)}ensureAnchorGfx(){return Fi(this)}drawBounds(e){return Gi(this,e)}drawAnchor(e){return Ui(this,e)}clearBounds(){return qi(this)}clearAnchor(){return Vi(this)}clearObjectVisuals(){return Tt(this)}updateObjectInfo(e){return Lt(this,e)}resetDebugConfig(){return Dn(this)}applyDebugConfig(){return Js(this)}exportDebugConfig(){return $n(this)}loadObjectConfig(e){return Zs(this,e)}fillConfigViewer(e){return jn(this,e)}copyConfigValues(){return Qs(this)}applyObjectConfig(e){return Yi(this,e)}applyCustomizeSettings(e,t){return er(this,e,t)}scheduleObjectAutoApply(){return tr(this)}setupDebugEventListeners(){return ir(this)}setupDebugInputListeners(e){return Ji(this,e)}setupPanelLayout(){return ar(this)}setupCollapsiblePanels(e){return Zi(this,e)}setupRangeInput(e,t,n,a){return te(this,e,t,n,a)}updateWorkbenchTabs(){return Xi(this)}saveWorkbenchState(){return Ne(this)}loadWorkbenchState(){return zn(this)}initialize(e){var n;this.container=e,this.debugOverlay=e.querySelector(".debug-overlay"),this.configViewer=e.querySelector("#config-viewer");try{let a=localStorage.getItem("preview_workbench_state");if(a){let s=JSON.parse(a);s.activeTab&&(this.activeTab=s.activeTab)}}catch(a){console.warn("[PREVIEW] Failed to load workbench tab state",a)}this.sceneObjectsPanel.initialize(e,{onSelect:a=>this.handleObjectSelect(a)}),this.libraryPanel.initialize(e,{onApply:(a,s,r)=>this.applySlotAsset(a,s,r),onReset:(a,s,r)=>this.resetSlotAsset(a,s,r)}),this.inspectorPanel.initialize(e,{onPropertyChange:(a,s,r)=>{console.log("[Inspector] Property changed:",a,s,r)}}),this.brandVisionPanel.initialize(e,()=>{this.toggleDebug(!1);let a="/dashboard";window.location.pathname!==a&&(window.location.href=a)}),this.customizeSettingsPanel.initialize(e,{onApply:(a,s)=>this.applyCustomizeSettings(a,s)});let t=e.querySelector("#scene-tools-container");t&&(t.innerHTML=this.sceneToolsPanel.render()),this.sceneToolsPanel.initialize(t||e,{onHighlightObject:a=>{this.highlightObject=a,a?this.selectedObjectId&&this.startObjectVisuals():this.stopObjectVisuals()},onHighlightAnchor:a=>{this.highlightAnchor=a,a?this.selectedObjectId&&this.startObjectVisuals():this.stopObjectVisuals()},onNudge:(a,s)=>this.nudgeSelectedObject(a,s),onShowSplash:()=>{let a=window;typeof a.__previewShowSplash=="function"&&a.__previewShowSplash()},onUpdateSplash:a=>{let s=window;typeof s.applyEditableEngineConfig=="function"&&s.applyEditableEngineConfig({splash:a})}}),this.configPersistencePanel.initialize(e),this.loadingScreenPanel.initialize(e,{onShowLoadingScreen:()=>{let a=window;typeof a.__previewShowLoading=="function"?a.__previewShowLoading():console.warn("[DEBUG] __previewShowLoading not available")},onHideLoadingScreen:()=>{let a=window;typeof a.__previewHideLoading=="function"?a.__previewHideLoading():console.warn("[DEBUG] __previewHideLoading not available")},onUpdateLoading:a=>{let s=window;typeof s.applyEditableEngineConfig=="function"&&s.applyEditableEngineConfig({loading:a}),typeof s.__previewUpdateLoading=="function"?s.__previewUpdateLoading(a):console.warn("[DEBUG] __previewUpdateLoading not available")}}),window.__openAiEditor=(a,s,r,o)=>{this.customizeSettingsPanel.openAiEditor(a,s,r,o)},this.setupPanelLayout(),this.updateWorkbenchTabs(),window.__debugContext=this,window.__updateWorkbenchTabs=()=>this.updateWorkbenchTabs(),this.isDebugOpen=!0,(n=this.debugOverlay)==null||n.classList.remove("hidden"),this.updateDebugBadge(),this.sceneObjectsPanel.refreshObjects(),window.__previewSelectObject=a=>this.selectObject(a),window.addEventListener("config:changed",a=>{var s,r;((s=a.detail)==null?void 0:s.action)!=="remove"&&((r=a.detail)==null?void 0:r.action)!=="clear_object"&&this.highlightChangesTab()}),window.applyAssetToSlot=(a,s,r)=>this.applySlotAsset(a,s,r),window.refreshAssetLibrary=()=>this.libraryPanel.refresh(),window.reRenderAssetLibrary=()=>this.libraryPanel.reRender(),window.getEngineSplashConfig=()=>{var s;let a=window.getActiveConfig;if(typeof a=="function"){let r=a();return((s=r==null?void 0:r.engine)==null?void 0:s.splash)||null}return null},window.addAssetToRegistry=(a,s)=>{let r=window.getEditableAssets;if(typeof r=="function"){let o=r();if(o!=null&&o.libraryAssets&&(o.libraryAssets[a]||(o.libraryAssets[a]=[]),!o.libraryAssets[a].some(c=>c.filename===s))){let c=s.replace(/\.(png|jpg|jpeg)$/i,"").replace(/_/g," ");o.libraryAssets[a].unshift({filename:s,displayName:c}),console.log(`[DEBUG] Added ${s} to registry category ${a}`)}}}}selectObject(e){this.handleObjectSelect(e),this.activeTab!=="inspector"&&(this.activeTab="inspector",this.updateWorkbenchTabs())}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`
1083
1083
  <div class="debug-overlay hidden" id="debug-overlay">
1084
1084
  <div class="debug-workbench" id="debug-workbench">
1085
1085
  <div class="workbench-header" id="workbench-handle">
@@ -1121,9 +1121,6 @@ Are you absolutely sure?`))try{let t=xt(),n={};for(let[s,r]of Object.entries(t.o
1121
1121
 
1122
1122
  <!-- Standalone Hierarchy Panel -->
1123
1123
  ${this.sceneObjectsPanel.render()}
1124
-
1125
- <!-- Standalone Scene Tools Corner Panel -->
1126
- ${this.sceneToolsPanel.render()}
1127
1124
  </div>
1128
1125
  `}refresh(){this.isDebugOpen&&(this.sceneObjectsPanel.refreshObjects(),this.libraryPanel.refresh(),this.brandVisionPanel.refresh(),this.selectedObjectId&&this.handleObjectSelect(this.selectedObjectId))}toggleDebug(e){var t;this.isDebugOpen=e!=null?e:!this.isDebugOpen,(t=this.debugOverlay)==null||t.classList.toggle("hidden",!this.isDebugOpen),this.updateDebugBadge(),this.isDebugOpen?this.refresh():this.stopObjectVisuals()}updateDebugBadge(){if(!this.container)return;let e=this.container.querySelector("#debug-badge");e&&e.classList.toggle("active",this.isDebugOpen)}handleObjectSelect(e){this.selectedObjectId=e,this.sceneObjectsPanel.setSelected(e),this.inspectorPanel.loadObject(e),this.loadObjectConfig(e),this.startObjectVisuals()}nudgeSelectedObject(e,t){var d,u,g,h,f,m,b,y,v;if(!this.container||!this.selectedObjectId)return;let a=this.sceneToolsPanel.getNudgeStep(),s=this.container.querySelector("#config-pos-x"),r=this.container.querySelector("#config-pos-y"),o=Number((d=s==null?void 0:s.value)!=null?d:0),l=Number((u=r==null?void 0:r.value)!=null?u:0);if(!Number.isFinite(o)||!Number.isFinite(l)){let x=this.getSelectedObjectConfig();o=(f=(h=(g=x==null?void 0:x.transform)==null?void 0:g.position)==null?void 0:h.x)!=null?f:0,l=(y=(b=(m=x==null?void 0:x.transform)==null?void 0:m.position)==null?void 0:b.y)!=null?y:0}let c=o+e*a,p=l+t*a;s&&(s.value=String(c)),r&&(r.value=String(p)),(v=this.configViewer)==null||v.style.setProperty("display","block"),this.scheduleObjectAutoApply()}};function Go(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 Uo(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 qo(i){return`
1129
1126
  Analyze these screenshots of a brand or game and extract its "Brand DNA".
@@ -1430,6 +1427,9 @@ Style guidelines: ${n.summary}`;this.promptInput.value=a,this.currentPrompt=a}}c
1430
1427
  </button>
1431
1428
  </div>
1432
1429
 
1430
+ <!-- Scene Tools Panel (rendered here, initialized by debug panel) -->
1431
+ <div id="scene-tools-container"></div>
1432
+
1433
1433
  ${((t=this.debugPanel)==null?void 0:t.getDebugOverlayHTML())||""}
1434
1434
 
1435
1435
  <div class="console-panel closed">
@@ -1443,7 +1443,7 @@ Style guidelines: ${n.summary}`;this.promptInput.value=a,this.currentPrompt=a}}c
1443
1443
  <div class="console-messages" id="console-messages"></div>
1444
1444
  </div>
1445
1445
  </div>
1446
- `,this.setupEventListeners(e),e}setupEventListeners(e){var a,s,r,o,l,c,p,d,u,g;let t=e.querySelector("#device-select");t==null||t.addEventListener("change",h=>{if(this.viewMode==="compare")return;let f=h.target.value;this.setDevice(f)}),Array.from(e.querySelectorAll("[data-view-toggle]")).forEach(h=>{h.addEventListener("click",()=>{let f=h.dataset.viewToggle;f&&this.setViewMode(f)})}),(a=e.querySelector("#rotate-btn"))==null||a.addEventListener("click",()=>this.toggleRotation()),(s=e.querySelector("#zoom-in-btn"))==null||s.addEventListener("click",()=>this.adjustUserZoom(.1)),(r=e.querySelector("#zoom-out-btn"))==null||r.addEventListener("click",()=>this.adjustUserZoom(-.1)),(o=e.querySelector("#refresh-btn"))==null||o.addEventListener("click",()=>this.refresh()),(l=e.querySelector("#console-toggle"))==null||l.addEventListener("click",()=>this.toggleConsole()),(c=e.querySelector("#console-close"))==null||c.addEventListener("click",()=>this.toggleConsole(!1)),(p=e.querySelector("#console-clear"))==null||p.addEventListener("click",()=>this.clearConsole()),(d=e.querySelector("#corner-zoom-in-btn"))==null||d.addEventListener("click",()=>this.adjustUserZoom(.1)),(u=e.querySelector("#corner-zoom-out-btn"))==null||u.addEventListener("click",()=>this.adjustUserZoom(-.1)),(g=e.querySelector("#corner-grab-btn"))==null||g.addEventListener("click",()=>{this.frameDragger.style.cursor="grab",setTimeout(()=>{this.isSpaceKeyPressed||(this.frameDragger.style.cursor="")},1e3)})}applyDeviceFrameStyles(){Object.assign(this.frameDragger.style,{display:"flex",justifyContent:"center",alignItems:"center",transform:"translate(0px, 0px)",touchAction:"none"}),Object.assign(this.frameWrapper.style,{display:"flex",justifyContent:"center",alignItems:"center",transformOrigin:"center center",transition:"transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)",boxShadow:"0 20px 50px rgba(0,0,0,0.5)",borderRadius:"0px",willChange:"transform"}),Object.assign(this.deviceFrame.style,{overflow:"hidden",position:"relative",borderRadius:"0px"}),Object.assign(this.gameContainer.style,{position:"relative",overflow:"hidden",minWidth:"0px",minHeight:"0px"})}setupObserversAndListeners(){this.resizeObserver=new ResizeObserver(()=>{this.resizeListenersDisabled||!this.gameReady||this.scheduleFit()}),this.resizeObserver.observe(this.previewContainer),window.addEventListener("resize",this.onWindowResize,{passive:!0})}scheduleFit(){this.rafFitHandle&&cancelAnimationFrame(this.rafFitHandle),this.rafFitHandle=requestAnimationFrame(()=>{this.rafFitHandle=null,this.fitToScreen()})}applyPresetDimensions(){let e=this.getEffectivePreset(),t=`${e.width}px`,n=`${e.height}px`;this.deviceFrame.style.width=t,this.deviceFrame.style.height=n,this.gameContainer.style.width=t,this.gameContainer.style.height=n,this.gameContainer.style.maxWidth=t,this.gameContainer.style.maxHeight=n,this.gameContainer.style.minWidth=t,this.gameContainer.style.minHeight=n,this.gameContainer.dataset.screenWidth=String(e.width),this.gameContainer.dataset.screenHeight=String(e.height),this.container.style.setProperty("--preview-screen-width",String(e.width)),this.container.style.setProperty("--preview-screen-height",String(e.height))}fitToScreen(e){if(!this.previewContainer)return;let t=this.getEffectivePreset(),n=this.getFitBounds(),a=Math.max(0,n.width),s=Math.max(0,n.height);if(a<=0||s<=0)return;this.applyPresetDimensions(),this.viewMode==="compare"&&this.applyCompareDimensions();let r=a/t.width,o=s/t.height;if(this.autoScale=Math.max(.01,Math.min(r,o)),!this.hasInitialFit){this.hasInitialFit=!0;let l=.6;this.userScaleMultiplier=l/this.autoScale}e!=null&&e.keepVisibleScale&&e.keepVisibleScale>0&&(this.userScaleMultiplier=e.keepVisibleScale/this.autoScale),this.applyTransform(),this.viewMode==="compare"&&this.fitCompareGhosts(),this.emitScreenChange()}applyTransform(){let e=this.autoScale*this.userScaleMultiplier;this.frameWrapper.style.transform=`scale(${e})`;let t=this.container.querySelector("#zoom-label");t&&(t.textContent=`${Math.round(e*100)}%`)}applyFrameDrag(){this.frameDragger.style.transform=`translate(${this.frameDragOffsetX}px, ${this.frameDragOffsetY}px)`}setupFrameDragging(){this.frameDragger.addEventListener("pointerdown",e=>{let t=!this.gameContainer.contains(e.target);!this.isSpaceKeyPressed&&!t||e.button===0&&(e.preventDefault(),this.frameDragActive=!0,this.frameDragStartX=e.clientX,this.frameDragStartY=e.clientY,this.frameDragOriginX=this.frameDragOffsetX,this.frameDragOriginY=this.frameDragOffsetY,window.addEventListener("pointermove",this.onFrameDragMove),window.addEventListener("pointerup",this.onFrameDragEnd))})}setupSpaceKeyListener(){window.addEventListener("keydown",e=>{e.code==="Space"&&!this.isInputFocused()&&(this.isSpaceKeyPressed||(this.isSpaceKeyPressed=!0,this.updateDragCursor(),e.preventDefault()))}),window.addEventListener("keyup",e=>{e.code==="Space"&&(this.isSpaceKeyPressed=!1,this.updateDragCursor(),this.frameDragActive&&this.onFrameDragEnd())}),window.addEventListener("blur",()=>{this.isSpaceKeyPressed=!1,this.updateDragCursor(),this.frameDragActive&&this.onFrameDragEnd()})}isInputFocused(){let e=document.activeElement;if(!e)return!1;let t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"||e.isContentEditable}updateDragCursor(){this.isSpaceKeyPressed?(this.frameDragger.style.cursor="grab",this.frameDragActive&&(this.frameDragger.style.cursor="grabbing")):this.frameDragger.style.cursor=""}adjustUserZoom(e){this.userScaleMultiplier=Math.max(.1,Math.min(6,this.userScaleMultiplier+e)),this.applyTransform(),this.emitScreenChange()}toggleRotation(){var t,n;if(this.viewMode==="compare")return;let e=this.autoScale*this.userScaleMultiplier;this.isLandscape=!this.isLandscape,this.applyPresetDimensions(),this.fitToScreen({keepVisibleScale:e}),(n=(t=this.options).onDeviceChange)==null||n.call(t,this.getEffectivePreset()),this.emitScreenChange()}emitScreenChange(){if(!this.gameReady)return;let e=this.getEffectivePreset(),t={width:e.width,height:e.height,dpr:Math.max(1,Math.floor(window.devicePixelRatio||1)),presetId:e.id,isLandscape:this.isLandscape};if(window.dispatchEvent(new CustomEvent("handler-preview:screen",{detail:t})),this.viewMode==="compare"&&this.refreshCompareSnapshots(),this.isInitialized&&this.isMounted&&this.gameReady){let n=window.gameApp;if(!(n!=null&&n.renderer))return;this.ignoreNextWindowResize=!0,window.dispatchEvent(new Event("resize"))}}safeStringify(e){var n;let t=new WeakSet;try{return JSON.stringify(e,(a,s)=>{if(typeof s=="object"&&s!==null){if(t.has(s))return"[Circular]";t.add(s)}return s},2)}catch{try{if(e&&((n=e.constructor)!=null&&n.name))return`[object ${e.constructor.name}]`}catch{}return String(e)}}setupConsoleInterceptor(){let e=console.log.bind(console),t=console.warn.bind(console),n=console.error.bind(console),a=console.info.bind(console),s=(r,...o)=>{let l=o.map(p=>typeof p=="object"?this.safeStringify(p):String(p)).join(" ");this.consoleMessages.push({type:r,message:l,timestamp:new Date}),this.appendConsoleMessage(this.consoleMessages[this.consoleMessages.length-1]);let c=this.container.querySelector("#console-badge");if(c){let p=this.consoleMessages.filter(d=>d.type==="error").length;c.textContent=p>0?`${p}!`:"0",c.classList.toggle("has-errors",p>0)}};console.log=(...r)=>{e(...r),s("log",...r)},console.warn=(...r)=>{t(...r),s("warn",...r)},console.error=(...r)=>{n(...r),s("error",...r)},console.info=(...r)=>{a(...r),s("info",...r)}}appendConsoleMessage(e){let t=this.container.querySelector("#console-messages");if(!t)return;let n=document.createElement("div");n.className=`console-msg type-${e.type}`;let a=e.timestamp.toLocaleTimeString();n.innerHTML=`<span class="time">${this.escapeHtml(a)}</span> <pre>${this.escapeHtml(e.message)}</pre>`,t.appendChild(n),t.scrollTop=t.scrollHeight}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}toggleConsole(e){var t;this.isConsoleOpen=e!=null?e:!this.isConsoleOpen,(t=this.consolePanel)==null||t.classList.toggle("closed",!this.isConsoleOpen)}clearConsole(){this.consoleMessages=[];let e=this.container.querySelector("#console-messages");e&&(e.innerHTML="");let t=this.container.querySelector("#console-badge");t&&(t.textContent="0")}setupCompareViewports(){Array.from(this.container.querySelectorAll("[data-viewport]")).forEach(t=>{let n=t.dataset.viewport;if(!n)return;let a=this.comparePresets.find(d=>d.id===n);if(!a)return;let s=t.querySelector("[data-compare-slot]"),r=t.querySelector("[data-compare-ghost]"),o=t.querySelector("[data-compare-wrapper]"),l=t.querySelector("[data-compare-frame]"),c=t.querySelector("[data-compare-snapshot]"),p=t.querySelector("[data-compare-focus]");!s||!r||!o||!l||(t.addEventListener("click",d=>{let u=d.target;if(u!=null&&u.closest("[data-compare-focus]")){d.preventDefault(),this.activateCompareViewport(n);return}t.classList.contains("is-active")||this.activateCompareViewport(n)}),this.compareViewports.set(n,{preset:a,root:t,slot:s,ghost:r,wrapper:o,frame:l,canvas:c,focus:p}))})}setViewMode(e){if(this.viewMode===e)return;this.viewMode=e,this.container.classList.toggle("compare-mode",e==="compare"),this.singleStage.classList.toggle("hidden",e!=="single"),this.compareStage.classList.toggle("hidden",e!=="compare");let t=this.container.querySelector("#device-select");t&&(t.disabled=e==="compare");let n=this.container.querySelector("#rotate-btn");if(n&&(n.disabled=e==="compare"),this.updateViewToggleUI(),e==="compare"){this.lastSinglePresetId=this.currentPreset.id,this.activateCompareViewport(this.activeCompareId),this.refreshCompareSnapshots(),this.startCompareSnapshots();return}this.stopCompareSnapshots(),this.singleStage.appendChild(this.frameDragger),this.setDevice(this.lastSinglePresetId,{suppressCallback:!0}),this.fitToScreen()}updateViewToggleUI(){Array.from(this.container.querySelectorAll("[data-view-toggle]")).forEach(t=>{t.classList.toggle("active",t.dataset.viewToggle===this.viewMode)})}activateCompareViewport(e){var s,r;let t=this.compareViewports.get(e);if(!t)return;let n=this.autoScale*this.userScaleMultiplier,a=this.activeCompareId;a&&a!==e&&this.captureCompareSnapshot(a),this.activeCompareId=e,this.currentPreset=t.preset,this.isLandscape=!1,t.slot.appendChild(this.frameDragger),this.frameDragOffsetX=0,this.frameDragOffsetY=0,this.applyFrameDrag(),this.compareViewports.forEach((o,l)=>{o.root.classList.toggle("is-active",l===e),o.ghost.classList.toggle("hidden",l===e),o.focus&&(o.focus.textContent=l===e?"Live":"Focus")}),this.applyPresetDimensions(),this.applyCompareDimensions(),this.fitToScreen({keepVisibleScale:n}),(r=(s=this.options).onDeviceChange)==null||r.call(s,this.getEffectivePreset())}applyCompareDimensions(){this.compareViewports.forEach(e=>{let t=e.preset,n=`${t.width}px`,a=`${t.height}px`;e.frame.style.width=n,e.frame.style.height=a,e.canvas&&(e.canvas.width=t.width,e.canvas.height=t.height)})}fitCompareGhosts(){this.compareViewports.forEach(e=>{let t=e.root.querySelector(".compare-body");if(!t)return;let n=Math.max(0,t.clientWidth-24),a=Math.max(0,t.clientHeight-24);if(n<=0||a<=0)return;let s=n/e.preset.width,r=a/e.preset.height,o=Math.max(.01,Math.min(s,r));e.wrapper.style.transform=`scale(${o})`})}captureCompareSnapshot(e){let t=this.compareViewports.get(e);if(!(t!=null&&t.canvas))return;let n=this.gameContainer.querySelector("canvas");if(!n)return;let a=t.canvas.getContext("2d");if(!a)return;let s=t.canvas.width,r=t.canvas.height,o=Math.min(s/n.width,r/n.height),l=n.width*o,c=n.height*o,p=(s-l)/2,d=(r-c)/2;a.clearRect(0,0,s,r),a.drawImage(n,p,d,l,c)}refreshCompareSnapshots(){this.compareViewports.forEach((e,t)=>{t!==this.activeCompareId&&this.captureCompareSnapshot(t)})}startCompareSnapshots(){this.compareSnapshotTimer||(this.compareSnapshotTimer=window.setInterval(()=>{this.viewMode==="compare"&&this.refreshCompareSnapshots()},500))}stopCompareSnapshots(){this.compareSnapshotTimer&&(window.clearInterval(this.compareSnapshotTimer),this.compareSnapshotTimer=null)}getFitBounds(){if(this.viewMode!=="compare")return{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40};let e=this.compareViewports.get(this.activeCompareId),t=e==null?void 0:e.root.querySelector(".compare-body");return t?{width:t.clientWidth-24,height:t.clientHeight-24}:{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40}}mustQuery(e){let t=this.container.querySelector(e);if(!t)throw new Error(`PreviewShell missing element: ${e}`);return t}};function oa(i={}){let e=new Hn(i);return typeof window!="undefined"&&(window.__previewShell=e),e.mount(),e}ee();function la(i){try{if(i&&typeof i.keys=="function")return Array.from(i.keys())}catch{}return[]}function or(i){var e;return i?((e=i.getDisplayObject)==null?void 0:e.call(i))||i.pixiObject||i:null}function Wo(i,e){if(!i||!(e!=null&&e.interaction))return;let t=e.interaction,n=t.enabled!==!1&&(t.draggable===!0||t.clickable===!0);i.eventMode=n?"static":"none",i.interactive=n,n&&(i.cursor=t.draggable?"move":"pointer")}function lr(i,e){var l,c,p,d,u,g;if(!i||!e)return;let t=e.transform||{};Wo(i,e);let n=t.position||{},a=t.offset||{},s=(typeof n.x=="number"?n.x:0)+(typeof a.x=="number"?a.x:0),r=(typeof n.y=="number"?n.y:0)+(typeof a.y=="number"?a.y:0);if((l=i.position)!=null&&l.set?i.position.set(s,r):(typeof i.x=="number"&&(i.x=s),typeof i.y=="number"&&(i.y=r)),typeof t.scale=="number"){let h=(c=e==null?void 0:e.identity)==null?void 0:c.category,f=h==="ui"||h==="environment"?.2:1,m=t.scale*f;(p=i.scale)!=null&&p.set?i.scale.set(m):i.scale&&(i.scale.x=m,i.scale.y=m)}let o=(u=t.anchor)!=null?u:(d=e.render)==null?void 0:d.anchor;o&&((g=i.anchor)!=null&&g.set)&&typeof o.x=="number"&&typeof o.y=="number"&&i.anchor.set(o.x,o.y)}function cr(i){if(typeof window=="undefined")return;let e=i==null?void 0:i.objects,t=la(e),n=s=>{try{let r=window.__HANDLER_ACTIVE_SCREEN;if(!r||r==="all")return s;let o=window.__HANDLER_SCREEN_INDEX,l=o==null?void 0:o.instanceToScreen;return l?s.filter(c=>l[c]===r):s}catch{return s}};window.__editableObjectConfigs=e;let a=new Map;t.forEach(s=>a.set(s,[s])),window.__editableObjectInstances=a,window.refreshEditableConfigIndex=()=>cr(window.__editableConfig),window.getEditableObjectList=()=>{var s;return n(la((s=window.__editableConfig)==null?void 0:s.objects))},window.getEditableObjectListAll=()=>{var s;return la((s=window.__editableConfig)==null?void 0:s.objects)},window.getEditableObjectConfig=s=>{var p,d,u,g,h;let r=(g=(u=(d=(p=window.__editableConfig)==null?void 0:p.objects)==null?void 0:d.get)==null?void 0:u.call(d,s))!=null?g:null,o=window.__HANDLER_ACTIVE_SCREEN;if(!o||o==="all")return r;let l=window.__HANDLER_SCREEN_INDEX,c=(h=l==null?void 0:l.instanceToScreen)==null?void 0:h[s];return c&&c===o?r:null},window.getEditableEngineConfig=()=>{let s=window.__editableConfig;if(console.log("[BRIDGE] getEditableEngineConfig called, cfg present:",!!s),!s)return null;if(s.engine&&s.objects instanceof Map){console.log("[BRIDGE] Detected ObjectCentricConfig, flattening...");let r={...s.engine,objects:s.objects,scene:s.scene};return console.log("[BRIDGE] Returned assets:",Object.keys(r.assets||{})),r}return s}}function Yo(){if(typeof window=="undefined")return;let i=t=>{let n=String(t||"").trim();return n?/^(data:|blob:|https?:)/.test(n)||n.startsWith("/")?n:`/${n.replace(/^\.\//,"")}`:""},e=async(t,n)=>{var s,r,o;let a=i(n);if(a)try{let[{Assets:l},{AssetTextures:c}]=await Promise.all([import("pixi.js"),Promise.resolve().then(()=>(Ke(),as))]),p=Date.now(),d=/^(data:|blob:)/.test(a)?a:a+(a.includes("?")?`&t=${p}`:`?t=${p}`),u=await l.load(d);if(!u)return;c[t]=u;let g=window.CustomAssets;(s=g==null?void 0:g[t])!=null&&s.texture&&(g[t].texture=u);let h=window.gameObjectManager,f=(r=h==null?void 0:h.get)==null?void 0:r.call(h,t);if(f){let m=((o=f.getDisplayObject)==null?void 0:o.call(f))||f.pixiObject||f.pixi||f;if(m!=null&&m.texture)m.texture=u;else if(m!=null&&m.children){let b=m.children.find(y=>y==null?void 0:y.texture);b!=null&&b.texture&&(b.texture=u)}}}catch(l){console.warn("[LIVE-EDIT] Failed to reload Pixi texture for",t,l)}};window.applyLiveEditOverrides=t=>{try{let n=Y();Array.isArray(n)&&n.length&&(window.__editableConfig=t,Se(n,{silent:!0,persist:!1}))}catch{}},window.applyEngineOverrides=t=>{try{let n=Y();Array.isArray(n)&&n.length&&(window.__editableConfig=t,Se(n,{silent:!0,persist:!1}))}catch{}},window.applyEditableEngineConfig=t=>{let n=window.__editableConfig;if(!(n!=null&&n.engine))return;let a=[];if(t.runtime)for(let[s,r]of Object.entries(t.runtime))a.push({path:`runtime.${s}`,value:r});if(t.assets)for(let[s,r]of Object.entries(t.assets))a.push({path:`assets.${s}`,value:r}),typeof r=="string"&&e(s,r);if(t.splash)for(let[s,r]of Object.entries(t.splash))a.push({path:`splash.${s}`,value:r});if(t.loading)for(let[s,r]of Object.entries(t.loading))a.push({path:`loading.${s}`,value:r});if(t.start)for(let[s,r]of Object.entries(t.start))a.push({path:`start.${s}`,value:r});a.length&&Se(a,{silent:!0,persist:!0,emitEvent:!0})}}function Bn(i){let{getConfig:e,gameObjectManager:t,onObjectConfigApplied:n}=i;t&&(t.onObjectRebuildRequired=async(s,r)=>{console.log(`[LIVE-EDIT] \u{1F3D7}\uFE0F Rebuilding object ${s} due to type change...`);let o=t.get(s),l=o==null?void 0:o.pixiObject,c=l==null?void 0:l.parent,p=c==null?void 0:c.children.indexOf(l);o?t.remove(s):l&&l.destroy();let d=window.gameApp,u=await Ee.create(s,r,d);c&&(p!==void 0&&p!==-1?c.addChildAt(u,p):c.addChild(u));let g=t.create(s,u);return console.log(`[LIVE-EDIT] \u2705 Rebuild complete for ${s}`),g}),typeof window!="undefined"&&(Yo(),window.applyEditableObjectConfig=(s,r)=>{var o,l,c;console.log("[LIVE-EDIT] \u{1F504} applyEditableObjectConfig called for:",s);try{let p=window.__editableConfig;(o=p==null?void 0:p.objects)!=null&&o.set&&(p.objects.set(s,r),console.log("[LIVE-EDIT] \u2705 Updated config in __editableConfig"));let d=(l=t==null?void 0:t.get)==null?void 0:l.call(t,s);if(console.log("[LIVE-EDIT] gameObject found?",!!d),d&&(console.log("[LIVE-EDIT] gameObject type:",(c=d.constructor)==null?void 0:c.name),console.log("[LIVE-EDIT] has updateConfig?",typeof d.updateConfig=="function"),console.log("[LIVE-EDIT] has onConfigUpdate?",typeof d.onConfigUpdate=="function")),d&&typeof d.updateConfig=="function")console.log("[LIVE-EDIT] \u2705 Calling updateConfig()"),d.updateConfig(r);else if(d&&typeof d.onConfigUpdate=="function")console.log("[LIVE-EDIT] \u2705 Calling onConfigUpdate()"),d.onConfigUpdate();else{console.log("[LIVE-EDIT] \u26A0\uFE0F No updateConfig or onConfigUpdate, applying transform directly");let u=or(d);lr(u,r)}}catch(p){console.error("[LIVE-EDIT] \u274C Error in applyEditableObjectConfig:",p)}});let a={async applyObjectConfig(s,r){var p,d;console.log("[BRIDGE] \u{1F504} applyObjectConfig called for:",s);let o=e();(p=o==null?void 0:o.objects)!=null&&p.set&&(o.objects.set(s,r),console.log("[BRIDGE] \u2705 Updated config"));let l=(d=t==null?void 0:t.get)==null?void 0:d.call(t,s);if(console.log("[BRIDGE] gameObject found?",!!l),l&&(console.log("[BRIDGE] has updateConfig?",typeof l.updateConfig=="function"),console.log("[BRIDGE] has onConfigUpdate?",typeof l.onConfigUpdate=="function")),l&&typeof l.updateConfig=="function")console.log("[BRIDGE] \u2705 Calling updateConfig()"),l.updateConfig(r);else if(l&&typeof l.onConfigUpdate=="function")console.log("[BRIDGE] \u2705 Calling onConfigUpdate()"),l.onConfigUpdate();else{console.log("[BRIDGE] \u26A0\uFE0F Applying transform directly");let u=or(l);lr(u,r)}let c=[s];n==null||n(s,r,c)},rebuildIndexes(){let s=e();typeof window!="undefined"&&(window.__editableConfig=s,cr(s))}};return a.rebuildIndexes(),a}ee();var ur=qe(require("lottie-web"),1);ri(ai);typeof window!="undefined"&&!window.lottie&&(window.lottie=ur.default);var tt=null,Ko=async()=>{if(!tt){let i=typeof window!="undefined"?window.INLINE_ASSETS:null,e=(i==null?void 0:i["handler.config"])||(i==null?void 0:i["handler.config.json"]);if(e)try{if(e.startsWith("data:")){let n=atob(e.split(",")[1]);tt=JSON.parse(n)}else tt=JSON.parse(e);return tt}catch(n){console.warn("[CONFIG] Failed to parse inline handler.config.json:",n)}tt=await(await fetch("./handler.config.json")).json()}return tt},ua,Ot,gr,nt,da,pa;function Xo(i){ua=i.initGame,Ot=i.CustomAssets,gr=i.updateScreenState,nt=i.globalResponsiveMultipliers,da=i.layout,pa=i.clearResponsiveElements}var Fn="web_embed",kt="https://example.com",dr={profile_id:Fn},Pe=null,oe=null,ca={width:0,height:0},Jo=!0,Zo=async()=>{var c,p,d,u;document.title="Handler Pixi Game";let i=await Ko();dr={...i.ids||{},profile_id:Fn},kt=i.destination_url||((p=(c=i.export_profiles)==null?void 0:c[Fn])==null?void 0:p.destination_url)||kt,Oe.init({ids:dr,profile:Fn,destinationUrl:kt});let e=Oe.getRoot();if(typeof __PREVIEW_SHELL__!="undefined"&&__PREVIEW_SHELL__){console.log("[BOOTSTRAP] Initializing Preview Shell..."),oe=oa({onDeviceChange:h=>{console.log(`[PREVIEW] Device switched to ${h.width}x${h.height}, restarting game...`),pr()},onRefresh:pr});let g=oe.getGameContainer();g&&(e=g),window.addEventListener("handler-preview:screen",h=>{var v,x,E,w,T,S,O,B,M,C,I;let f=window.gameApp,m=window.gameObjectManager,{width:b,height:y}=h.detail;if(ca.width=b,ca.height=y,gr(b,y),!(!f||!f.renderer)){m&&o(f,m);try{f.renderer.resize(b,y);let k=f.view;k&&(k.style.width="100%",k.style.height="100%",k.style.display="block")}catch(k){console.warn("[SCREEN] Error resizing renderer:",k);return}if(t&&m&&da)try{let k=(v=window.__mainContainer)!=null?v:f.stage,D=(O=(S=(w=window.__tutorialLabel)!=null?w:(E=(x=m.get("label_1"))==null?void 0:x.getDisplayObject)==null?void 0:E.call(x))!=null?S:(T=m.get("label_1"))==null?void 0:T.pixiObject)!=null?O:m.get("label_1"),R=m.get("background_1"),$=(I=(C=(M=window.__background)!=null?M:(B=R==null?void 0:R.getDisplayObject)==null?void 0:B.call(R))!=null?C:R==null?void 0:R.pixiObject)!=null?I:R;if(k){let A=k===f.stage;da({mainContainer:k,label:D,background:$,backgroundTexture:($==null?void 0:$.texture)||null,app:f},t,0,ca,m,{skipMainContainerTransform:A})}}catch(k){console.warn("[SCREEN] Error in layout:",k)}}})}let t=await me("scene.main");window.__editableConfig=t,r(),window.__editableConfigBaseline||(window.__editableConfigBaseline=U(t),console.log("[BOOTSTRAP] Frozen config baseline for persistence")),(u=(d=t.engine.runtime)==null?void 0:d.layout)!=null&&u.design_width_portrait||(console.warn("[BOOTSTRAP] Config layout missing, retrying..."),await new Promise(g=>setTimeout(g,100)),t=await me("scene.main"));let n=await ua(e,t,kt,oe);Pe=n.app;let a=n.gameObjectManager;window.gameApp=Pe,window.gameObjectManager=a;try{window.__liveEditBridge=Bn({getConfig:()=>window.__editableConfig,gameObjectManager:a,assets:Ot})}catch(g){console.warn("[BOOTSTRAP] Failed to initialize live-edit bridge",g)}oe&&oe.notifyGameLoaded();let s=window.__debugScale;s&&typeof s=="number"&&(nt.scale=s,console.log(`[DEBUG] Applied persisted debug scale: ${s}`)),o(Pe,a);async function r(){try{let g=async y=>{let v=y.startsWith("/")?y:`/${y}`,x=await fetch(v,{cache:"no-cache"});if(!x.ok)return null;let E=await x.text();try{return JSON.parse(E)}catch{return null}},h=await g("configs/flow/app.flow.json");if(!h||typeof h!="object")return;let f=h.screens;if(!f||typeof f!="object")return;let m={},b={};for(let[y,v]of Object.entries(f)){let x=v==null?void 0:v.source;if(typeof x!="string")continue;let E=await g(x),w=E==null?void 0:E.elements;if(!Array.isArray(w))continue;let T=w.map(S=>S==null?void 0:S.instance_id).filter(S=>typeof S=="string");m[y]=T;for(let S of T)b[S]||(b[S]=y)}window.__HANDLER_APP_FLOW=h,window.__HANDLER_SCREEN_INDEX={screenToInstances:m,instanceToScreen:b},window.dispatchEvent(new CustomEvent("handler:screen-index-loaded"))}catch{}}function o(g,h){if(Jo){console.log("[RESPONSIVE] Skipping global scaling; using config-driven layout");return}if(console.log("[RESPONSIVE] ===== APPLYING GLOBAL RESPONSIVE SCALING ====="),console.log(`[RESPONSIVE] Scale multiplier: ${nt.scale.toFixed(3)}`),g.stage){let m=function(b,y=0){if(!b||!b.children)return;let v=" ".repeat(y);b.children.forEach((x,E)=>{if(x&&x.zIndex===9999){console.log(`${v}[RESPONSIVE] Skipping debug border (zIndex 9999)`);return}if(x&&x.scale){let w=x.scale.x||1,T=x.scale.y||1;x.__originalScale||(x.__originalScale={x:w,y:T},console.log(`${v}[RESPONSIVE] Stored original scale for child[${E}]: ${w.toFixed(3)}, ${T.toFixed(3)}`));let S=x.__originalScale.x*nt.scale,O=x.__originalScale.y*nt.scale;typeof x.scale.set=="function"?x.scale.set(S,O):(x.scale.x=S,x.scale.y=O),console.log(`${v}[RESPONSIVE] Child[${E}] scale: ${w.toFixed(3)}\u2192${x.scale.x.toFixed(3)} (type: ${x.constructor.name})`),m(x,y+1)}else x&&console.log(`${v}[RESPONSIVE] Child[${E}] has no scale (type: ${x.constructor.name})`)})};var f=m;console.log("[RESPONSIVE] Applying scale to PIXI stage children"),m(g.stage)}else console.warn("[RESPONSIVE] No app.stage found!");console.log("[REDDEBUG] Debug border left unscaled (fixed boundaries)"),console.log("[RESPONSIVE] ===== GLOBAL RESPONSIVE SCALING COMPLETE =====")}function l(g){if(g!==void 0){nt.scale=g,console.log(`[RESPONSIVE] Updated global scale multiplier to: ${g.toFixed(3)}`);let h=window.gameApp,f=window.gameObjectManager;h&&f?(o(h,f),h.renderer&&(h.renderer.render(h.stage),console.log("[RESPONSIVE] Forced PIXI renderer update"))):console.warn(`[RESPONSIVE] No gameApp (${!!h}) or gameObjectManager (${!!f}) found in window for live update`)}}window.updateGlobalResponsiveMultipliers=l,Oe.start()},pr=async()=>{var e,t,n,a;console.log("[PREVIEW] Restarting game in 1 seconds...");let i=(e=window.gameObjectManager)==null?void 0:e.get("character_1");if(i){let s=((t=i.getDisplayObject)==null?void 0:t.call(i))||i;s&&s.scale&&console.log(`[CHARACTER] Before restart - Current scale - x: ${((n=s.scale.x)!=null?n:1).toFixed(3)}, y: ${((a=s.scale.y)!=null?a:1).toFixed(3)}`)}if(oe){oe.notifyGameDestroyed();try{pa&&pa()}catch(s){console.warn("Failed to clear responsive elements",s)}setTimeout(()=>{console.log("[PREVIEW] Executing restart...");let s=oe.getGameContainer(),r=window.gameObjectManager;if(r&&typeof r.clear=="function"&&(console.log("[PREVIEW] Clearing old GameObjectManager tickers..."),r.clear()),Pe){try{Pe.destroy(!0,{children:!0,texture:!1})}catch(o){console.warn("[PREVIEW] Destroy warning:",o)}Pe=null}window.gameApp=null,window.gameObjectManager=null,s&&(s.innerHTML="");try{typeof Ot.resetScene=="function"&&Ot.resetScene()}catch(o){console.warn("Asset reset failed",o)}setTimeout(()=>{me("scene.main").then(o=>{window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=U(o)),ua(s,o,kt).then(l=>{Pe=l.app,window.gameApp=Pe,window.gameObjectManager=l.gameObjectManager;try{window.__liveEditBridge=Bn({getConfig:()=>window.__editableConfig,gameObjectManager:window.gameObjectManager,assets:Ot})}catch(c){console.warn("[BOOTSTRAP] Failed to re-initialize live-edit bridge",c)}oe&&oe.notifyGameLoaded(),console.log("[PREVIEW] Game restarted successfully");try{Oe.start()}catch{}})})},100)},1e3)}};dn();ee();var le={background:"#F6F3EF",ink:"#1E1E1E",secondaryText:"#8E8A84",primaryAccent:"#E38A5A",secondaryAccent:"#C9A28C",statusGreen:"#5F8F6B"},fr=1.25,hr={fontFamily:"Inter, system-ui, sans-serif"};var Gn=class{constructor(e={}){this.currentProgress=0;var t;this.currentProgress=(t=e.progress)!=null?t:0,this.container=this.createContainer()}createContainer(){let e=document.createElement("div");e.className="handler-loading-screen",e.style.cssText=`
1446
+ `,this.setupEventListeners(e),e}setupEventListeners(e){var a,s,r,o,l,c,p,d,u,g;let t=e.querySelector("#device-select");t==null||t.addEventListener("change",h=>{if(this.viewMode==="compare")return;let f=h.target.value;this.setDevice(f)}),Array.from(e.querySelectorAll("[data-view-toggle]")).forEach(h=>{h.addEventListener("click",()=>{let f=h.dataset.viewToggle;f&&this.setViewMode(f)})}),(a=e.querySelector("#rotate-btn"))==null||a.addEventListener("click",()=>this.toggleRotation()),(s=e.querySelector("#zoom-in-btn"))==null||s.addEventListener("click",()=>this.adjustUserZoom(.1)),(r=e.querySelector("#zoom-out-btn"))==null||r.addEventListener("click",()=>this.adjustUserZoom(-.1)),(o=e.querySelector("#refresh-btn"))==null||o.addEventListener("click",()=>this.refresh()),(l=e.querySelector("#console-toggle"))==null||l.addEventListener("click",()=>this.toggleConsole()),(c=e.querySelector("#console-close"))==null||c.addEventListener("click",()=>this.toggleConsole(!1)),(p=e.querySelector("#console-clear"))==null||p.addEventListener("click",()=>this.clearConsole()),(d=e.querySelector("#corner-zoom-in-btn"))==null||d.addEventListener("click",()=>this.adjustUserZoom(.1)),(u=e.querySelector("#corner-zoom-out-btn"))==null||u.addEventListener("click",()=>this.adjustUserZoom(-.1)),(g=e.querySelector("#corner-grab-btn"))==null||g.addEventListener("click",()=>{this.frameDragger.style.cursor="grab",setTimeout(()=>{this.isSpaceKeyPressed||(this.frameDragger.style.cursor="")},1e3)})}applyDeviceFrameStyles(){Object.assign(this.frameDragger.style,{display:"flex",justifyContent:"center",alignItems:"center",transform:"translate(0px, 0px)",touchAction:"none"}),Object.assign(this.frameWrapper.style,{display:"flex",justifyContent:"center",alignItems:"center",transformOrigin:"center center",transition:"transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)",boxShadow:"0 20px 50px rgba(0,0,0,0.5)",borderRadius:"0px",willChange:"transform"}),Object.assign(this.deviceFrame.style,{overflow:"hidden",position:"relative",borderRadius:"0px"}),Object.assign(this.gameContainer.style,{position:"relative",overflow:"hidden",minWidth:"0px",minHeight:"0px"})}setupObserversAndListeners(){this.resizeObserver=new ResizeObserver(()=>{this.resizeListenersDisabled||!this.gameReady||this.scheduleFit()}),this.resizeObserver.observe(this.previewContainer),window.addEventListener("resize",this.onWindowResize,{passive:!0})}scheduleFit(){this.rafFitHandle&&cancelAnimationFrame(this.rafFitHandle),this.rafFitHandle=requestAnimationFrame(()=>{this.rafFitHandle=null,this.fitToScreen()})}applyPresetDimensions(){let e=this.getEffectivePreset(),t=`${e.width}px`,n=`${e.height}px`;this.deviceFrame.style.width=t,this.deviceFrame.style.height=n,this.gameContainer.style.width=t,this.gameContainer.style.height=n,this.gameContainer.style.maxWidth=t,this.gameContainer.style.maxHeight=n,this.gameContainer.style.minWidth=t,this.gameContainer.style.minHeight=n,this.gameContainer.dataset.screenWidth=String(e.width),this.gameContainer.dataset.screenHeight=String(e.height),this.container.style.setProperty("--preview-screen-width",String(e.width)),this.container.style.setProperty("--preview-screen-height",String(e.height))}fitToScreen(e){if(!this.previewContainer)return;let t=this.getEffectivePreset(),n=this.getFitBounds(),a=Math.max(0,n.width),s=Math.max(0,n.height);if(a<=0||s<=0)return;this.applyPresetDimensions(),this.viewMode==="compare"&&this.applyCompareDimensions();let r=a/t.width,o=s/t.height;if(this.autoScale=Math.max(.01,Math.min(r,o)),!this.hasInitialFit){this.hasInitialFit=!0;let l=.6;this.userScaleMultiplier=l/this.autoScale}e!=null&&e.keepVisibleScale&&e.keepVisibleScale>0&&(this.userScaleMultiplier=e.keepVisibleScale/this.autoScale),this.applyTransform(),this.viewMode==="compare"&&this.fitCompareGhosts(),this.emitScreenChange()}applyTransform(){let e=this.autoScale*this.userScaleMultiplier;this.frameWrapper.style.transform=`scale(${e})`;let t=this.container.querySelector("#zoom-label");t&&(t.textContent=`${Math.round(e*100)}%`)}applyFrameDrag(){this.frameDragger.style.transform=`translate(${this.frameDragOffsetX}px, ${this.frameDragOffsetY}px)`}setupFrameDragging(){this.frameDragger.addEventListener("pointerdown",e=>{let t=!this.gameContainer.contains(e.target);!this.isSpaceKeyPressed&&!t||e.button===0&&(e.preventDefault(),this.frameDragActive=!0,this.frameDragStartX=e.clientX,this.frameDragStartY=e.clientY,this.frameDragOriginX=this.frameDragOffsetX,this.frameDragOriginY=this.frameDragOffsetY,window.addEventListener("pointermove",this.onFrameDragMove),window.addEventListener("pointerup",this.onFrameDragEnd))})}setupSpaceKeyListener(){window.addEventListener("keydown",e=>{e.code==="Space"&&!this.isInputFocused()&&(this.isSpaceKeyPressed||(this.isSpaceKeyPressed=!0,this.updateDragCursor(),e.preventDefault()))}),window.addEventListener("keyup",e=>{e.code==="Space"&&(this.isSpaceKeyPressed=!1,this.updateDragCursor(),this.frameDragActive&&this.onFrameDragEnd())}),window.addEventListener("blur",()=>{this.isSpaceKeyPressed=!1,this.updateDragCursor(),this.frameDragActive&&this.onFrameDragEnd()})}isInputFocused(){let e=document.activeElement;if(!e)return!1;let t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"||e.isContentEditable}updateDragCursor(){this.isSpaceKeyPressed?(this.frameDragger.style.cursor="grab",this.frameDragActive&&(this.frameDragger.style.cursor="grabbing")):this.frameDragger.style.cursor=""}adjustUserZoom(e){this.userScaleMultiplier=Math.max(.1,Math.min(6,this.userScaleMultiplier+e)),this.applyTransform(),this.emitScreenChange()}toggleRotation(){var t,n;if(this.viewMode==="compare")return;let e=this.autoScale*this.userScaleMultiplier;this.isLandscape=!this.isLandscape,this.applyPresetDimensions(),this.fitToScreen({keepVisibleScale:e}),(n=(t=this.options).onDeviceChange)==null||n.call(t,this.getEffectivePreset()),this.emitScreenChange()}emitScreenChange(){if(!this.gameReady)return;let e=this.getEffectivePreset(),t={width:e.width,height:e.height,dpr:Math.max(1,Math.floor(window.devicePixelRatio||1)),presetId:e.id,isLandscape:this.isLandscape};if(window.dispatchEvent(new CustomEvent("handler-preview:screen",{detail:t})),this.viewMode==="compare"&&this.refreshCompareSnapshots(),this.isInitialized&&this.isMounted&&this.gameReady){let n=window.gameApp;if(!(n!=null&&n.renderer))return;this.ignoreNextWindowResize=!0,window.dispatchEvent(new Event("resize"))}}safeStringify(e){var n;let t=new WeakSet;try{return JSON.stringify(e,(a,s)=>{if(typeof s=="object"&&s!==null){if(t.has(s))return"[Circular]";t.add(s)}return s},2)}catch{try{if(e&&((n=e.constructor)!=null&&n.name))return`[object ${e.constructor.name}]`}catch{}return String(e)}}setupConsoleInterceptor(){let e=console.log.bind(console),t=console.warn.bind(console),n=console.error.bind(console),a=console.info.bind(console),s=(r,...o)=>{let l=o.map(p=>typeof p=="object"?this.safeStringify(p):String(p)).join(" ");this.consoleMessages.push({type:r,message:l,timestamp:new Date}),this.appendConsoleMessage(this.consoleMessages[this.consoleMessages.length-1]);let c=this.container.querySelector("#console-badge");if(c){let p=this.consoleMessages.filter(d=>d.type==="error").length;c.textContent=p>0?`${p}!`:"0",c.classList.toggle("has-errors",p>0)}};console.log=(...r)=>{e(...r),s("log",...r)},console.warn=(...r)=>{t(...r),s("warn",...r)},console.error=(...r)=>{n(...r),s("error",...r)},console.info=(...r)=>{a(...r),s("info",...r)}}appendConsoleMessage(e){let t=this.container.querySelector("#console-messages");if(!t)return;let n=document.createElement("div");n.className=`console-msg type-${e.type}`;let a=e.timestamp.toLocaleTimeString();n.innerHTML=`<span class="time">${this.escapeHtml(a)}</span> <pre>${this.escapeHtml(e.message)}</pre>`,t.appendChild(n),t.scrollTop=t.scrollHeight}escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}toggleConsole(e){var t;this.isConsoleOpen=e!=null?e:!this.isConsoleOpen,(t=this.consolePanel)==null||t.classList.toggle("closed",!this.isConsoleOpen)}clearConsole(){this.consoleMessages=[];let e=this.container.querySelector("#console-messages");e&&(e.innerHTML="");let t=this.container.querySelector("#console-badge");t&&(t.textContent="0")}setupCompareViewports(){Array.from(this.container.querySelectorAll("[data-viewport]")).forEach(t=>{let n=t.dataset.viewport;if(!n)return;let a=this.comparePresets.find(d=>d.id===n);if(!a)return;let s=t.querySelector("[data-compare-slot]"),r=t.querySelector("[data-compare-ghost]"),o=t.querySelector("[data-compare-wrapper]"),l=t.querySelector("[data-compare-frame]"),c=t.querySelector("[data-compare-snapshot]"),p=t.querySelector("[data-compare-focus]");!s||!r||!o||!l||(t.addEventListener("click",d=>{let u=d.target;if(u!=null&&u.closest("[data-compare-focus]")){d.preventDefault(),this.activateCompareViewport(n);return}t.classList.contains("is-active")||this.activateCompareViewport(n)}),this.compareViewports.set(n,{preset:a,root:t,slot:s,ghost:r,wrapper:o,frame:l,canvas:c,focus:p}))})}setViewMode(e){if(this.viewMode===e)return;this.viewMode=e,this.container.classList.toggle("compare-mode",e==="compare"),this.singleStage.classList.toggle("hidden",e!=="single"),this.compareStage.classList.toggle("hidden",e!=="compare");let t=this.container.querySelector("#device-select");t&&(t.disabled=e==="compare");let n=this.container.querySelector("#rotate-btn");if(n&&(n.disabled=e==="compare"),this.updateViewToggleUI(),e==="compare"){this.lastSinglePresetId=this.currentPreset.id,this.activateCompareViewport(this.activeCompareId),this.refreshCompareSnapshots(),this.startCompareSnapshots();return}this.stopCompareSnapshots(),this.singleStage.appendChild(this.frameDragger),this.setDevice(this.lastSinglePresetId,{suppressCallback:!0}),this.fitToScreen()}updateViewToggleUI(){Array.from(this.container.querySelectorAll("[data-view-toggle]")).forEach(t=>{t.classList.toggle("active",t.dataset.viewToggle===this.viewMode)})}activateCompareViewport(e){var s,r;let t=this.compareViewports.get(e);if(!t)return;let n=this.autoScale*this.userScaleMultiplier,a=this.activeCompareId;a&&a!==e&&this.captureCompareSnapshot(a),this.activeCompareId=e,this.currentPreset=t.preset,this.isLandscape=!1,t.slot.appendChild(this.frameDragger),this.frameDragOffsetX=0,this.frameDragOffsetY=0,this.applyFrameDrag(),this.compareViewports.forEach((o,l)=>{o.root.classList.toggle("is-active",l===e),o.ghost.classList.toggle("hidden",l===e),o.focus&&(o.focus.textContent=l===e?"Live":"Focus")}),this.applyPresetDimensions(),this.applyCompareDimensions(),this.fitToScreen({keepVisibleScale:n}),(r=(s=this.options).onDeviceChange)==null||r.call(s,this.getEffectivePreset())}applyCompareDimensions(){this.compareViewports.forEach(e=>{let t=e.preset,n=`${t.width}px`,a=`${t.height}px`;e.frame.style.width=n,e.frame.style.height=a,e.canvas&&(e.canvas.width=t.width,e.canvas.height=t.height)})}fitCompareGhosts(){this.compareViewports.forEach(e=>{let t=e.root.querySelector(".compare-body");if(!t)return;let n=Math.max(0,t.clientWidth-24),a=Math.max(0,t.clientHeight-24);if(n<=0||a<=0)return;let s=n/e.preset.width,r=a/e.preset.height,o=Math.max(.01,Math.min(s,r));e.wrapper.style.transform=`scale(${o})`})}captureCompareSnapshot(e){let t=this.compareViewports.get(e);if(!(t!=null&&t.canvas))return;let n=this.gameContainer.querySelector("canvas");if(!n)return;let a=t.canvas.getContext("2d");if(!a)return;let s=t.canvas.width,r=t.canvas.height,o=Math.min(s/n.width,r/n.height),l=n.width*o,c=n.height*o,p=(s-l)/2,d=(r-c)/2;a.clearRect(0,0,s,r),a.drawImage(n,p,d,l,c)}refreshCompareSnapshots(){this.compareViewports.forEach((e,t)=>{t!==this.activeCompareId&&this.captureCompareSnapshot(t)})}startCompareSnapshots(){this.compareSnapshotTimer||(this.compareSnapshotTimer=window.setInterval(()=>{this.viewMode==="compare"&&this.refreshCompareSnapshots()},500))}stopCompareSnapshots(){this.compareSnapshotTimer&&(window.clearInterval(this.compareSnapshotTimer),this.compareSnapshotTimer=null)}getFitBounds(){if(this.viewMode!=="compare")return{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40};let e=this.compareViewports.get(this.activeCompareId),t=e==null?void 0:e.root.querySelector(".compare-body");return t?{width:t.clientWidth-24,height:t.clientHeight-24}:{width:this.previewContainer.clientWidth-40,height:this.previewContainer.clientHeight-40}}mustQuery(e){let t=this.container.querySelector(e);if(!t)throw new Error(`PreviewShell missing element: ${e}`);return t}};function oa(i={}){let e=new Hn(i);return typeof window!="undefined"&&(window.__previewShell=e),e.mount(),e}ee();function la(i){try{if(i&&typeof i.keys=="function")return Array.from(i.keys())}catch{}return[]}function or(i){var e;return i?((e=i.getDisplayObject)==null?void 0:e.call(i))||i.pixiObject||i:null}function Wo(i,e){if(!i||!(e!=null&&e.interaction))return;let t=e.interaction,n=t.enabled!==!1&&(t.draggable===!0||t.clickable===!0);i.eventMode=n?"static":"none",i.interactive=n,n&&(i.cursor=t.draggable?"move":"pointer")}function lr(i,e){var l,c,p,d,u;if(!i||!e)return;let t=e.transform||{};Wo(i,e);let n=t.position||{},a=t.offset||{},s=(typeof n.x=="number"?n.x:0)+(typeof a.x=="number"?a.x:0),r=(typeof n.y=="number"?n.y:0)+(typeof a.y=="number"?a.y:0);(l=i.position)!=null&&l.set?i.position.set(s,r):(typeof i.x=="number"&&(i.x=s),typeof i.y=="number"&&(i.y=r)),typeof t.scale=="number"&&((c=i.scale)!=null&&c.set?i.scale.set(t.scale):i.scale&&(i.scale.x=t.scale,i.scale.y=t.scale));let o=(d=t.anchor)!=null?d:(p=e.render)==null?void 0:p.anchor;o&&((u=i.anchor)!=null&&u.set)&&typeof o.x=="number"&&typeof o.y=="number"&&i.anchor.set(o.x,o.y)}function cr(i){if(typeof window=="undefined")return;let e=i==null?void 0:i.objects,t=la(e),n=s=>{try{let r=window.__HANDLER_ACTIVE_SCREEN;if(!r||r==="all")return s;let o=window.__HANDLER_SCREEN_INDEX,l=o==null?void 0:o.instanceToScreen;return l?s.filter(c=>l[c]===r):s}catch{return s}};window.__editableObjectConfigs=e;let a=new Map;t.forEach(s=>a.set(s,[s])),window.__editableObjectInstances=a,window.refreshEditableConfigIndex=()=>cr(window.__editableConfig),window.getEditableObjectList=()=>{var s;return n(la((s=window.__editableConfig)==null?void 0:s.objects))},window.getEditableObjectListAll=()=>{var s;return la((s=window.__editableConfig)==null?void 0:s.objects)},window.getEditableObjectConfig=s=>{var p,d,u,g,h;let r=(g=(u=(d=(p=window.__editableConfig)==null?void 0:p.objects)==null?void 0:d.get)==null?void 0:u.call(d,s))!=null?g:null,o=window.__HANDLER_ACTIVE_SCREEN;if(!o||o==="all")return r;let l=window.__HANDLER_SCREEN_INDEX,c=(h=l==null?void 0:l.instanceToScreen)==null?void 0:h[s];return c&&c===o?r:null},window.getEditableEngineConfig=()=>{let s=window.__editableConfig;if(console.log("[BRIDGE] getEditableEngineConfig called, cfg present:",!!s),!s)return null;if(s.engine&&s.objects instanceof Map){console.log("[BRIDGE] Detected ObjectCentricConfig, flattening...");let r={...s.engine,objects:s.objects,scene:s.scene};return console.log("[BRIDGE] Returned assets:",Object.keys(r.assets||{})),r}return s}}function Yo(){if(typeof window=="undefined")return;let i=t=>{let n=String(t||"").trim();return n?/^(data:|blob:|https?:)/.test(n)||n.startsWith("/")?n:`/${n.replace(/^\.\//,"")}`:""},e=async(t,n)=>{var s,r,o;let a=i(n);if(a)try{let[{Assets:l},{AssetTextures:c}]=await Promise.all([import("pixi.js"),Promise.resolve().then(()=>(Ke(),as))]),p=Date.now(),d=/^(data:|blob:)/.test(a)?a:a+(a.includes("?")?`&t=${p}`:`?t=${p}`),u=await l.load(d);if(!u)return;c[t]=u;let g=window.CustomAssets;(s=g==null?void 0:g[t])!=null&&s.texture&&(g[t].texture=u);let h=window.gameObjectManager,f=(r=h==null?void 0:h.get)==null?void 0:r.call(h,t);if(f){let m=((o=f.getDisplayObject)==null?void 0:o.call(f))||f.pixiObject||f.pixi||f;if(m!=null&&m.texture)m.texture=u;else if(m!=null&&m.children){let b=m.children.find(y=>y==null?void 0:y.texture);b!=null&&b.texture&&(b.texture=u)}}}catch(l){console.warn("[LIVE-EDIT] Failed to reload Pixi texture for",t,l)}};window.applyLiveEditOverrides=t=>{try{let n=Y();Array.isArray(n)&&n.length&&(window.__editableConfig=t,Se(n,{silent:!0,persist:!1}))}catch{}},window.applyEngineOverrides=t=>{try{let n=Y();Array.isArray(n)&&n.length&&(window.__editableConfig=t,Se(n,{silent:!0,persist:!1}))}catch{}},window.applyEditableEngineConfig=t=>{let n=window.__editableConfig;if(!(n!=null&&n.engine))return;let a=[];if(t.runtime)for(let[s,r]of Object.entries(t.runtime))a.push({path:`runtime.${s}`,value:r});if(t.assets)for(let[s,r]of Object.entries(t.assets))a.push({path:`assets.${s}`,value:r}),typeof r=="string"&&e(s,r);if(t.splash)for(let[s,r]of Object.entries(t.splash))a.push({path:`splash.${s}`,value:r});if(t.loading)for(let[s,r]of Object.entries(t.loading))a.push({path:`loading.${s}`,value:r});if(t.start)for(let[s,r]of Object.entries(t.start))a.push({path:`start.${s}`,value:r});a.length&&Se(a,{silent:!0,persist:!0,emitEvent:!0})}}function Bn(i){let{getConfig:e,gameObjectManager:t,onObjectConfigApplied:n}=i;t&&(t.onObjectRebuildRequired=async(s,r)=>{console.log(`[LIVE-EDIT] \u{1F3D7}\uFE0F Rebuilding object ${s} due to type change...`);let o=t.get(s),l=o==null?void 0:o.pixiObject,c=l==null?void 0:l.parent,p=c==null?void 0:c.children.indexOf(l);o?t.remove(s):l&&l.destroy();let d=window.gameApp,u=await Ee.create(s,r,d);c&&(p!==void 0&&p!==-1?c.addChildAt(u,p):c.addChild(u));let g=t.create(s,u);return console.log(`[LIVE-EDIT] \u2705 Rebuild complete for ${s}`),g}),typeof window!="undefined"&&(Yo(),window.applyEditableObjectConfig=(s,r)=>{var o,l,c;console.log("[LIVE-EDIT] \u{1F504} applyEditableObjectConfig called for:",s);try{let p=window.__editableConfig;(o=p==null?void 0:p.objects)!=null&&o.set&&(p.objects.set(s,r),console.log("[LIVE-EDIT] \u2705 Updated config in __editableConfig"));let d=(l=t==null?void 0:t.get)==null?void 0:l.call(t,s);if(console.log("[LIVE-EDIT] gameObject found?",!!d),d&&(console.log("[LIVE-EDIT] gameObject type:",(c=d.constructor)==null?void 0:c.name),console.log("[LIVE-EDIT] has updateConfig?",typeof d.updateConfig=="function"),console.log("[LIVE-EDIT] has onConfigUpdate?",typeof d.onConfigUpdate=="function")),d&&typeof d.updateConfig=="function")console.log("[LIVE-EDIT] \u2705 Calling updateConfig()"),d.updateConfig(r);else if(d&&typeof d.onConfigUpdate=="function")console.log("[LIVE-EDIT] \u2705 Calling onConfigUpdate()"),d.onConfigUpdate();else{console.log("[LIVE-EDIT] \u26A0\uFE0F No updateConfig or onConfigUpdate, applying transform directly");let u=or(d);lr(u,r)}}catch(p){console.error("[LIVE-EDIT] \u274C Error in applyEditableObjectConfig:",p)}});let a={async applyObjectConfig(s,r){var p,d;console.log("[BRIDGE] \u{1F504} applyObjectConfig called for:",s);let o=e();(p=o==null?void 0:o.objects)!=null&&p.set&&(o.objects.set(s,r),console.log("[BRIDGE] \u2705 Updated config"));let l=(d=t==null?void 0:t.get)==null?void 0:d.call(t,s);if(console.log("[BRIDGE] gameObject found?",!!l),l&&(console.log("[BRIDGE] has updateConfig?",typeof l.updateConfig=="function"),console.log("[BRIDGE] has onConfigUpdate?",typeof l.onConfigUpdate=="function")),l&&typeof l.updateConfig=="function")console.log("[BRIDGE] \u2705 Calling updateConfig()"),l.updateConfig(r);else if(l&&typeof l.onConfigUpdate=="function")console.log("[BRIDGE] \u2705 Calling onConfigUpdate()"),l.onConfigUpdate();else{console.log("[BRIDGE] \u26A0\uFE0F Applying transform directly");let u=or(l);lr(u,r)}let c=[s];n==null||n(s,r,c)},rebuildIndexes(){let s=e();typeof window!="undefined"&&(window.__editableConfig=s,cr(s))}};return a.rebuildIndexes(),a}ee();var ur=qe(require("lottie-web"),1);ri(ai);typeof window!="undefined"&&!window.lottie&&(window.lottie=ur.default);var tt=null,Ko=async()=>{if(!tt){let i=typeof window!="undefined"?window.INLINE_ASSETS:null,e=(i==null?void 0:i["handler.config"])||(i==null?void 0:i["handler.config.json"]);if(e)try{if(e.startsWith("data:")){let n=atob(e.split(",")[1]);tt=JSON.parse(n)}else tt=JSON.parse(e);return tt}catch(n){console.warn("[CONFIG] Failed to parse inline handler.config.json:",n)}tt=await(await fetch("./handler.config.json")).json()}return tt},ua,Ot,gr,nt,da,pa;function Xo(i){ua=i.initGame,Ot=i.CustomAssets,gr=i.updateScreenState,nt=i.globalResponsiveMultipliers,da=i.layout,pa=i.clearResponsiveElements}var Fn="web_embed",kt="https://example.com",dr={profile_id:Fn},Pe=null,oe=null,ca={width:0,height:0},Jo=!0,Zo=async()=>{var c,p,d,u;document.title="Handler Pixi Game";let i=await Ko();dr={...i.ids||{},profile_id:Fn},kt=i.destination_url||((p=(c=i.export_profiles)==null?void 0:c[Fn])==null?void 0:p.destination_url)||kt,Oe.init({ids:dr,profile:Fn,destinationUrl:kt});let e=Oe.getRoot();if(typeof __PREVIEW_SHELL__!="undefined"&&__PREVIEW_SHELL__){console.log("[BOOTSTRAP] Initializing Preview Shell..."),oe=oa({onDeviceChange:h=>{console.log(`[PREVIEW] Device switched to ${h.width}x${h.height}, restarting game...`),pr()},onRefresh:pr});let g=oe.getGameContainer();g&&(e=g),window.addEventListener("handler-preview:screen",h=>{var v,x,E,w,T,S,O,B,M,C,I;let f=window.gameApp,m=window.gameObjectManager,{width:b,height:y}=h.detail;if(ca.width=b,ca.height=y,gr(b,y),!(!f||!f.renderer)){m&&o(f,m);try{f.renderer.resize(b,y);let k=f.view;k&&(k.style.width="100%",k.style.height="100%",k.style.display="block")}catch(k){console.warn("[SCREEN] Error resizing renderer:",k);return}if(t&&m&&da)try{let k=(v=window.__mainContainer)!=null?v:f.stage,D=(O=(S=(w=window.__tutorialLabel)!=null?w:(E=(x=m.get("label_1"))==null?void 0:x.getDisplayObject)==null?void 0:E.call(x))!=null?S:(T=m.get("label_1"))==null?void 0:T.pixiObject)!=null?O:m.get("label_1"),R=m.get("background_1"),$=(I=(C=(M=window.__background)!=null?M:(B=R==null?void 0:R.getDisplayObject)==null?void 0:B.call(R))!=null?C:R==null?void 0:R.pixiObject)!=null?I:R;if(k){let A=k===f.stage;da({mainContainer:k,label:D,background:$,backgroundTexture:($==null?void 0:$.texture)||null,app:f},t,0,ca,m,{skipMainContainerTransform:A})}}catch(k){console.warn("[SCREEN] Error in layout:",k)}}})}let t=await me("scene.main");window.__editableConfig=t,r(),window.__editableConfigBaseline||(window.__editableConfigBaseline=U(t),console.log("[BOOTSTRAP] Frozen config baseline for persistence")),(u=(d=t.engine.runtime)==null?void 0:d.layout)!=null&&u.design_width_portrait||(console.warn("[BOOTSTRAP] Config layout missing, retrying..."),await new Promise(g=>setTimeout(g,100)),t=await me("scene.main"));let n=await ua(e,t,kt,oe);Pe=n.app;let a=n.gameObjectManager;window.gameApp=Pe,window.gameObjectManager=a;try{window.__liveEditBridge=Bn({getConfig:()=>window.__editableConfig,gameObjectManager:a,assets:Ot})}catch(g){console.warn("[BOOTSTRAP] Failed to initialize live-edit bridge",g)}oe&&oe.notifyGameLoaded();let s=window.__debugScale;s&&typeof s=="number"&&(nt.scale=s,console.log(`[DEBUG] Applied persisted debug scale: ${s}`)),o(Pe,a);async function r(){try{let g=async y=>{let v=y.startsWith("/")?y:`/${y}`,x=await fetch(v,{cache:"no-cache"});if(!x.ok)return null;let E=await x.text();try{return JSON.parse(E)}catch{return null}},h=await g("configs/flow/app.flow.json");if(!h||typeof h!="object")return;let f=h.screens;if(!f||typeof f!="object")return;let m={},b={};for(let[y,v]of Object.entries(f)){let x=v==null?void 0:v.source;if(typeof x!="string")continue;let E=await g(x),w=E==null?void 0:E.elements;if(!Array.isArray(w))continue;let T=w.map(S=>S==null?void 0:S.instance_id).filter(S=>typeof S=="string");m[y]=T;for(let S of T)b[S]||(b[S]=y)}window.__HANDLER_APP_FLOW=h,window.__HANDLER_SCREEN_INDEX={screenToInstances:m,instanceToScreen:b},window.dispatchEvent(new CustomEvent("handler:screen-index-loaded"))}catch{}}function o(g,h){if(Jo){console.log("[RESPONSIVE] Skipping global scaling; using config-driven layout");return}if(console.log("[RESPONSIVE] ===== APPLYING GLOBAL RESPONSIVE SCALING ====="),console.log(`[RESPONSIVE] Scale multiplier: ${nt.scale.toFixed(3)}`),g.stage){let m=function(b,y=0){if(!b||!b.children)return;let v=" ".repeat(y);b.children.forEach((x,E)=>{if(x&&x.zIndex===9999){console.log(`${v}[RESPONSIVE] Skipping debug border (zIndex 9999)`);return}if(x&&x.scale){let w=x.scale.x||1,T=x.scale.y||1;x.__originalScale||(x.__originalScale={x:w,y:T},console.log(`${v}[RESPONSIVE] Stored original scale for child[${E}]: ${w.toFixed(3)}, ${T.toFixed(3)}`));let S=x.__originalScale.x*nt.scale,O=x.__originalScale.y*nt.scale;typeof x.scale.set=="function"?x.scale.set(S,O):(x.scale.x=S,x.scale.y=O),console.log(`${v}[RESPONSIVE] Child[${E}] scale: ${w.toFixed(3)}\u2192${x.scale.x.toFixed(3)} (type: ${x.constructor.name})`),m(x,y+1)}else x&&console.log(`${v}[RESPONSIVE] Child[${E}] has no scale (type: ${x.constructor.name})`)})};var f=m;console.log("[RESPONSIVE] Applying scale to PIXI stage children"),m(g.stage)}else console.warn("[RESPONSIVE] No app.stage found!");console.log("[REDDEBUG] Debug border left unscaled (fixed boundaries)"),console.log("[RESPONSIVE] ===== GLOBAL RESPONSIVE SCALING COMPLETE =====")}function l(g){if(g!==void 0){nt.scale=g,console.log(`[RESPONSIVE] Updated global scale multiplier to: ${g.toFixed(3)}`);let h=window.gameApp,f=window.gameObjectManager;h&&f?(o(h,f),h.renderer&&(h.renderer.render(h.stage),console.log("[RESPONSIVE] Forced PIXI renderer update"))):console.warn(`[RESPONSIVE] No gameApp (${!!h}) or gameObjectManager (${!!f}) found in window for live update`)}}window.updateGlobalResponsiveMultipliers=l,Oe.start()},pr=async()=>{var e,t,n,a;console.log("[PREVIEW] Restarting game in 1 seconds...");let i=(e=window.gameObjectManager)==null?void 0:e.get("character_1");if(i){let s=((t=i.getDisplayObject)==null?void 0:t.call(i))||i;s&&s.scale&&console.log(`[CHARACTER] Before restart - Current scale - x: ${((n=s.scale.x)!=null?n:1).toFixed(3)}, y: ${((a=s.scale.y)!=null?a:1).toFixed(3)}`)}if(oe){oe.notifyGameDestroyed();try{pa&&pa()}catch(s){console.warn("Failed to clear responsive elements",s)}setTimeout(()=>{console.log("[PREVIEW] Executing restart...");let s=oe.getGameContainer(),r=window.gameObjectManager;if(r&&typeof r.clear=="function"&&(console.log("[PREVIEW] Clearing old GameObjectManager tickers..."),r.clear()),Pe){try{Pe.destroy(!0,{children:!0,texture:!1})}catch(o){console.warn("[PREVIEW] Destroy warning:",o)}Pe=null}window.gameApp=null,window.gameObjectManager=null,s&&(s.innerHTML="");try{typeof Ot.resetScene=="function"&&Ot.resetScene()}catch(o){console.warn("Asset reset failed",o)}setTimeout(()=>{me("scene.main").then(o=>{window.__editableConfig=o,window.__editableConfigBaseline||(window.__editableConfigBaseline=U(o)),ua(s,o,kt).then(l=>{Pe=l.app,window.gameApp=Pe,window.gameObjectManager=l.gameObjectManager;try{window.__liveEditBridge=Bn({getConfig:()=>window.__editableConfig,gameObjectManager:window.gameObjectManager,assets:Ot})}catch(c){console.warn("[BOOTSTRAP] Failed to re-initialize live-edit bridge",c)}oe&&oe.notifyGameLoaded(),console.log("[PREVIEW] Game restarted successfully");try{Oe.start()}catch{}})})},100)},1e3)}};dn();ee();var le={background:"#F6F3EF",ink:"#1E1E1E",secondaryText:"#8E8A84",primaryAccent:"#E38A5A",secondaryAccent:"#C9A28C",statusGreen:"#5F8F6B"},fr=1.25,hr={fontFamily:"Inter, system-ui, sans-serif"};var Gn=class{constructor(e={}){this.currentProgress=0;var t;this.currentProgress=(t=e.progress)!=null?t:0,this.container=this.createContainer()}createContainer(){let e=document.createElement("div");e.className="handler-loading-screen",e.style.cssText=`
1447
1447
  position: fixed;
1448
1448
  inset: 0;
1449
1449
  display: flex;
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-RWZ2NPID.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-6OPDY4ZF.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};