handler-playable-sdk 0.3.35 → 0.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OZZRT3XI.js → chunk-DSJ7EQPG.js} +1 -1
- package/dist/cli/brand-dna.mjs +1 -1
- package/dist/cli/canva-import.mjs +1 -1
- package/dist/cli/cleanup-assets.mjs +1 -1
- package/dist/cli/fix-scales.mjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/screen-helper.mjs +1 -1
- package/dist/cli/setup-library.mjs +1 -1
- package/dist/cli/student-helper.mjs +1 -1
- package/dist/cli/sync-screens.mjs +1 -1
- package/dist/cli/validate-assets.mjs +1 -1
- package/dist/cli/validate.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/pixi/index.cjs +1 -1
- package/dist/pixi/index.js +1 -1
- package/dist/three/index.cjs +1 -1
- package/dist/three/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -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 pl={};qe(pl,{COLORS:()=>ce,ConfigWatcher:()=>$e,DebugPanel:()=>Mt,DefaultReloadStrategy:()=>St,Handler:()=>ne,PlayableLoadingScreen:()=>Fn,PreviewShell:()=>Nn,STROKE_WIDTH:()=>br,THEME:()=>yr,applyConfigOverride:()=>Ae,applyConfigOverrides:()=>Se,applyConfigsToDisk:()=>wt,applyDefaults:()=>De,baseLottie:()=>ii,bootstrap:()=>el,clearConfigOverrides:()=>Ce,clearConfigOverridesForObject:()=>vs,configOverrideManager:()=>xs,createPreviewShell:()=>ca,deepClone:()=>U,default:()=>Oe,defaultPreset:()=>pn,deviceGroups:()=>Pi,devicePresets:()=>_i,diffConfigs:()=>Ei,exportConfigsAsJSON:()=>xt,getConfigOverrides:()=>Y,getConfigStateSummary:()=>nn,getOverrideMode:()=>vt,getPresetById:()=>ze,getPresetsByCategory:()=>Oo,loadAllObjectConfigs:()=>on,loadComponentSchemas:()=>rn,loadEngineConfig:()=>ln,loadGamePromptConfig:()=>vi,loadObjectCentricConfig:()=>me,loadObjectConfig:()=>Le,loadSceneConfig:()=>cn,rehydrateObject:()=>Ai,removeConfigOverride:()=>tn,resetToApplied:()=>Et,resetToOriginal:()=>an,setBootstrapDependencies:()=>Zo,setOverrideMode:()=>mi,setupHotReload:()=>Li,setupLiveEditBridge:()=>Hn,toLegacyFormat:()=>xi,validateObjectConfig:()=>Je});module.exports=La(pl);var xe={};function Bt(i,e,t=!1){xe[i]||(xe[i]=[]),xe[i].push({fn:e,once:t})}function Qn(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&&Qn(i,n.fn)}function K(i,e){Bt(i,e,!0)}var F=null,Q=[],We=null;function Pa(i){F=i,Q=[],We!==null&&(clearTimeout(We),We=null)}function Ma(){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 Ta(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 ei(i,e){let t=Ma();if(e&&t.endpoint){if(Q.push(i),Q.length>t.maxQueue&&(Q=Q.slice(Q.length-t.maxQueue)),Q.length>=t.batchSize){_a();return}We===null&&(We=window.setTimeout(()=>{We=null,_a()},t.flushIntervalMs))}}async function _a(){let i=Ma();if(!i.endpoint||Q.length===0)return;let e=Q.splice(0,i.batchSize);await Ta(i.endpoint,{events:e},i.transport,i.debug),Q.length>0&&await Ta(i.endpoint,{events:Q.splice(0,i.batchSize)},i.transport,i.debug)}function ka(i){return Math.max(0,Math.min(1,i))}function Nr(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 Hr(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Oa(i,e,t){try{i[e]=t}catch{}}function Br(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 Ia(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 Ra(i,e){let t=Br(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 ja(){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=ka(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=ka(E)}let v=g.ease(m);g.yoyo&&y%2===1&&(v=1-v);for(let E of g.props)Oa(g.target,E.key,E.from+(E.to-E.from)*v);g.scaleFrom&&g.scaleTo&&Ia(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=Nr(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:Hr(p,w),to:T})}let x=Ra(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"&&Oa(p,g,h)}let u=Ra(p,d);u.to&&Ia(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 Da(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=ja()}catch{}}var $a={name:"handler-playable-sdk",version:"0.3.35",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,Gr=X++,za=X++,Na=X++,Ha=X++,Ba=X++,Fa=X++,Ga=X++,Ua=X++,qa=X++,Va=X++,Wa=X++,Ya=X++,H=Gr;function Ka(){return H===za}function Xa(){return H===Na}function Ja(){return H===Ha}function Za(){return H===Ba}function Ye(){return H===Fa}function Ke(){return H===Ga}function Qa(){return H===Ua}function es(){return H===qa}function ts(){return H===Va}function ti(){return H===Wa}function ni(){return H===Ya}function ns(){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=za;return}catch{}else if(i==="dapi")try{dapi.isReady(),H=Na;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=Ha)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(H=Ba)}catch{}else if(e==="mintegral")window.gameReady&&(H=Fa);else if(e==="tapjoy")window.TJ_API&&(H=Ga);else if(e==="tiktok")window.openAppStore&&(H=Ua);else if(e==="smadex")try{window.smxTracking&&(H=qa)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(H=Va)}catch{}else e==="vungle"?H=Wa:(i==="nucleo"||e==="nucleo")&&(H=Ya)}var Gt=Ve(require("lottie-web"),1),ii=Gt.default;typeof window!="undefined"&&(window.lottie=Gt.default,window.__baseLottie=Gt.default);var Ur=require("pixi.js");var ai=require("pixi.js");var qr=null;function si(i){qr=i}Ut();ri();var ft=require("pixi.js");Ut();var Jr=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",di=Jr;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&&(di=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${di}`))}}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__: ${di}`);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 eo=Ve(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=eo);Xe();var qt=require("pixi.js");Xe();var gi=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)}},to=new gi,no=new Proxy(to,{get(i,e){if(e in i&&typeof i[e]=="function")return i[e].bind(i);if(i.get(e))return i.get(e)}});Xe();var ls=require("pixi.js"),ge={width:400,height:600,designWidth:400,scaleFactor:1},Wt={scale:1,position:1},hi=[];function ao(i,e,t,n,a,s,r){hi.push({element:i,originalScale:s,positionHelper:e,heightPercent:a}),e(i,t,n,a,s,r,!1)}function so(){hi.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 fi(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)}`),so()}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 ro(i,e,t){let n=bt[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${e} = ${t}`))}function oo(){return bt}var lo={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=lo[n])!=null?t:e}return e}function cs(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 ds(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,fi(n,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),fi(window.innerWidth,window.innerHeight),window.updateDebugConfig=ro,window.getDebugConfig=oo,window.copyConfig=xo,window.applyConfig=mt,window.applyConfigForRatio=wo,window.positionAtBottom=ps,window.positionAtTop=uo,window.positionAtCenter=go,window.positionAtLeft=fo,window.positionAtRight=ho,window.positionAtBottomLeft=mo,window.positionAtBottomRight=bo,window.positionAtTopLeft=yo,window.positionAtTopRight=vo,window.applyPositionContract=po,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 co(i,e){return i*e}function po(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 ps(i,e,t,n=.2,a=1,s=!0,r=!1){let o=co(t,n),l=Xt(t,n/2);fe(i,J(e),l);let c=s?a*ge.scaleFactor:a;he(i,c),r&&!hi.find(p=>p.element===i)&&ao(i,ps,e,t,n,a,s)}function uo(i,e,t,n=.1,a=1){fe(i,J(e),Kt(t,n)),he(i,a)}function go(i,e,t,n=0,a=0,s=1){fe(i,J(e,n),J(t,a)),he(i,s)}function fo(i,e,t,n=.1,a=1){fe(i,Jt(e,n),J(t)),he(i,a)}function ho(i,e,t,n=.1,a=1){fe(i,Zt(e,n),J(t)),he(i,a)}function mo(i,e,t,n=.05,a=.05,s=1){fe(i,Jt(e,a),Xt(t,n)),he(i,s)}function bo(i,e,t,n=.05,a=.05,s=1){fe(i,Zt(e,a),Xt(t,n)),he(i,s)}function yo(i,e,t,n=.05,a=.05,s=1){fe(i,Jt(e,a),Kt(t,n)),he(i,s)}function vo(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 xo(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 wo(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||cs,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||ds}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 Nc=[{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)}],Hc=[{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)}],Bc=[{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)}],Ti=[{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 _i=[...Ti],Pi=[{category:"playable",label:"Playable Ad",devices:Ti}],pn=Ti[0];function ze(i){return _i.find(e=>e.id===i)||pn}function Oo(i){return _i.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 pl={};qe(pl,{COLORS:()=>ce,ConfigWatcher:()=>$e,DebugPanel:()=>Mt,DefaultReloadStrategy:()=>St,Handler:()=>ne,PlayableLoadingScreen:()=>Fn,PreviewShell:()=>Nn,STROKE_WIDTH:()=>br,THEME:()=>yr,applyConfigOverride:()=>Ae,applyConfigOverrides:()=>Se,applyConfigsToDisk:()=>wt,applyDefaults:()=>De,baseLottie:()=>ii,bootstrap:()=>el,clearConfigOverrides:()=>Ce,clearConfigOverridesForObject:()=>vs,configOverrideManager:()=>xs,createPreviewShell:()=>ca,deepClone:()=>U,default:()=>Oe,defaultPreset:()=>pn,deviceGroups:()=>Pi,devicePresets:()=>_i,diffConfigs:()=>Ei,exportConfigsAsJSON:()=>xt,getConfigOverrides:()=>Y,getConfigStateSummary:()=>nn,getOverrideMode:()=>vt,getPresetById:()=>ze,getPresetsByCategory:()=>Oo,loadAllObjectConfigs:()=>on,loadComponentSchemas:()=>rn,loadEngineConfig:()=>ln,loadGamePromptConfig:()=>vi,loadObjectCentricConfig:()=>me,loadObjectConfig:()=>Le,loadSceneConfig:()=>cn,rehydrateObject:()=>Ai,removeConfigOverride:()=>tn,resetToApplied:()=>Et,resetToOriginal:()=>an,setBootstrapDependencies:()=>Zo,setOverrideMode:()=>mi,setupHotReload:()=>Li,setupLiveEditBridge:()=>Hn,toLegacyFormat:()=>xi,validateObjectConfig:()=>Je});module.exports=La(pl);var xe={};function Bt(i,e,t=!1){xe[i]||(xe[i]=[]),xe[i].push({fn:e,once:t})}function Qn(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&&Qn(i,n.fn)}function K(i,e){Bt(i,e,!0)}var F=null,Q=[],We=null;function Pa(i){F=i,Q=[],We!==null&&(clearTimeout(We),We=null)}function Ma(){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 Ta(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 ei(i,e){let t=Ma();if(e&&t.endpoint){if(Q.push(i),Q.length>t.maxQueue&&(Q=Q.slice(Q.length-t.maxQueue)),Q.length>=t.batchSize){_a();return}We===null&&(We=window.setTimeout(()=>{We=null,_a()},t.flushIntervalMs))}}async function _a(){let i=Ma();if(!i.endpoint||Q.length===0)return;let e=Q.splice(0,i.batchSize);await Ta(i.endpoint,{events:e},i.transport,i.debug),Q.length>0&&await Ta(i.endpoint,{events:Q.splice(0,i.batchSize)},i.transport,i.debug)}function ka(i){return Math.max(0,Math.min(1,i))}function Nr(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 Hr(i,e){let t=i==null?void 0:i[e];return typeof t=="number"?t:0}function Oa(i,e,t){try{i[e]=t}catch{}}function Br(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 Ia(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 Ra(i,e){let t=Br(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 ja(){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=ka(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=ka(E)}let v=g.ease(m);g.yoyo&&y%2===1&&(v=1-v);for(let E of g.props)Oa(g.target,E.key,E.from+(E.to-E.from)*v);g.scaleFrom&&g.scaleTo&&Ia(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=Nr(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:Hr(p,w),to:T})}let x=Ra(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"&&Oa(p,g,h)}let u=Ra(p,d);u.to&&Ia(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 Da(){if(typeof window=="undefined")return;let i=window;if(!i.gsap)try{i.gsap=ja()}catch{}}var $a={name:"handler-playable-sdk",version:"0.3.36",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,Gr=X++,za=X++,Na=X++,Ha=X++,Ba=X++,Fa=X++,Ga=X++,Ua=X++,qa=X++,Va=X++,Wa=X++,Ya=X++,H=Gr;function Ka(){return H===za}function Xa(){return H===Na}function Ja(){return H===Ha}function Za(){return H===Ba}function Ye(){return H===Fa}function Ke(){return H===Ga}function Qa(){return H===Ua}function es(){return H===qa}function ts(){return H===Va}function ti(){return H===Wa}function ni(){return H===Ya}function ns(){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=za;return}catch{}else if(i==="dapi")try{dapi.isReady(),H=Na;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(H=Ha)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(H=Ba)}catch{}else if(e==="mintegral")window.gameReady&&(H=Fa);else if(e==="tapjoy")window.TJ_API&&(H=Ga);else if(e==="tiktok")window.openAppStore&&(H=Ua);else if(e==="smadex")try{window.smxTracking&&(H=qa)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(H=Va)}catch{}else e==="vungle"?H=Wa:(i==="nucleo"||e==="nucleo")&&(H=Ya)}var Gt=Ve(require("lottie-web"),1),ii=Gt.default;typeof window!="undefined"&&(window.lottie=Gt.default,window.__baseLottie=Gt.default);var Ur=require("pixi.js");var ai=require("pixi.js");var qr=null;function si(i){qr=i}Ut();ri();var ft=require("pixi.js");Ut();var Jr=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",di=Jr;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&&(di=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${di}`))}}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__: ${di}`);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 eo=Ve(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=eo);Xe();var qt=require("pixi.js");Xe();var gi=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)}},to=new gi,no=new Proxy(to,{get(i,e){if(e in i&&typeof i[e]=="function")return i[e].bind(i);if(i.get(e))return i.get(e)}});Xe();var ls=require("pixi.js"),ge={width:400,height:600,designWidth:400,scaleFactor:1},Wt={scale:1,position:1},hi=[];function ao(i,e,t,n,a,s,r){hi.push({element:i,originalScale:s,positionHelper:e,heightPercent:a}),e(i,t,n,a,s,r,!1)}function so(){hi.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 fi(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)}`),so()}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 ro(i,e,t){let n=bt[i];n&&n[e]!==void 0&&(n[e]=t,console.log(`Updated ${i}.${e} = ${t}`))}function oo(){return bt}var lo={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=lo[n])!=null?t:e}return e}function cs(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 ds(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,fi(n,a))};window.addEventListener("resize",t),window.addEventListener("orientationchange",()=>{setTimeout(t,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",t),window.mraid.addEventListener("sizeChange",t)),fi(window.innerWidth,window.innerHeight),window.updateDebugConfig=ro,window.getDebugConfig=oo,window.copyConfig=xo,window.applyConfig=mt,window.applyConfigForRatio=wo,window.positionAtBottom=ps,window.positionAtTop=uo,window.positionAtCenter=go,window.positionAtLeft=fo,window.positionAtRight=ho,window.positionAtBottomLeft=mo,window.positionAtBottomRight=bo,window.positionAtTopLeft=yo,window.positionAtTopRight=vo,window.applyPositionContract=po,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 co(i,e){return i*e}function po(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 ps(i,e,t,n=.2,a=1,s=!0,r=!1){let o=co(t,n),l=Xt(t,n/2);fe(i,J(e),l);let c=s?a*ge.scaleFactor:a;he(i,c),r&&!hi.find(p=>p.element===i)&&ao(i,ps,e,t,n,a,s)}function uo(i,e,t,n=.1,a=1){fe(i,J(e),Kt(t,n)),he(i,a)}function go(i,e,t,n=0,a=0,s=1){fe(i,J(e,n),J(t,a)),he(i,s)}function fo(i,e,t,n=.1,a=1){fe(i,Jt(e,n),J(t)),he(i,a)}function ho(i,e,t,n=.1,a=1){fe(i,Zt(e,n),J(t)),he(i,a)}function mo(i,e,t,n=.05,a=.05,s=1){fe(i,Jt(e,a),Xt(t,n)),he(i,s)}function bo(i,e,t,n=.05,a=.05,s=1){fe(i,Zt(e,a),Xt(t,n)),he(i,s)}function yo(i,e,t,n=.05,a=.05,s=1){fe(i,Jt(e,a),Kt(t,n)),he(i,s)}function vo(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 xo(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 wo(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||cs,i.resolveScreenRatioPoint=i.resolveScreenRatioPoint||ds}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 Nc=[{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)}],Hc=[{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)}],Bc=[{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)}],Ti=[{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 _i=[...Ti],Pi=[{category:"playable",label:"Playable Ad",devices:Ti}],pn=Ti[0];function ze(i){return _i.find(e=>e.id===i)||pn}function Oo(i){return _i.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">
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-
|
|
1
|
+
import{E as F,F as G,G as H,H as I,I as J,J as K,K as L,L as M,M as N,N as O,O as P,P as Q,Q as R,R as S,S as T,T as U,U as V,a}from"./chunk-DSJ7EQPG.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-ZFQCFKYD.js";export{Q as COLORS,B as ConfigWatcher,K as DebugPanel,A as DefaultReloadStrategy,U as Handler,T as PlayableLoadingScreen,L as PreviewShell,R as STROKE_WIDTH,S as THEME,d as applyConfigOverride,e as applyConfigOverrides,n as applyConfigsToDisk,x as applyDefaults,a as baseLottie,P as bootstrap,f as clearConfigOverrides,g as clearConfigOverridesForObject,j as configOverrideManager,M as createPreviewShell,k as deepClone,V as default,H as defaultPreset,G as deviceGroups,F as devicePresets,C as diffConfigs,l as exportConfigsAsJSON,i as getConfigOverrides,m as getConfigStateSummary,b as getOverrideMode,I as getPresetById,J as getPresetsByCategory,s as loadAllObjectConfigs,q as loadComponentSchemas,t as loadEngineConfig,u as loadGamePromptConfig,y as loadObjectCentricConfig,r as loadObjectConfig,v as loadSceneConfig,D as rehydrateObject,h as removeConfigOverride,o as resetToApplied,p as resetToOriginal,O as setBootstrapDependencies,c as setOverrideMode,E as setupHotReload,N as setupLiveEditBridge,z as toLegacyFormat,w as validateObjectConfig};
|
package/dist/pixi/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Fs={};Xn(Fs,{AssetCache:()=>te,AssetLoader:()=>fe,AssetSystem:()=>Rt,AssetTextures:()=>he,Assets:()=>ha,BaseSystem:()=>ze,GameEngine:()=>It,GameObject:()=>lt,GameObjectManager:()=>De,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>Ne,Transform:()=>rt,applyScreenAnchor:()=>$t,basePixi:()=>pa,clearResponsiveElements:()=>ba,createPixiBase:()=>kt,getRegisteredFontIds:()=>oa,globalResponsiveMultipliers:()=>dt,initAssetTextures:()=>St,initAssets:()=>ma,layout:()=>va,playLottieOverlay:()=>ca,registerFont:()=>ra,registerType:()=>Et,resolveAnchorVec2:()=>pt,resolveFont:()=>aa,resolveFontWeight:()=>sa,resolveScreenAnchorPoint:()=>He,resolveScreenRatioPoint:()=>Be,runInitSequence:()=>xa,setLottieInstance:()=>Ct,spawnSceneFromConfig:()=>ga,updateScreenState:()=>Dt});module.exports=La(Fs);var ia=require("pixi.js");var pe={};function bt(n,e,t=!1){pe[n]||(pe[n]=[]),pe[n].push({fn:e,once:t})}function Ut(n,e){if(pe[n]){if(!e){delete pe[n];return}pe[n]=pe[n].filter(t=>t.fn!==e)}}function yt(n,...e){let t=pe[n];if(t)for(let i of[...t])i.fn(...e),i.once&&Ut(n,i.fn)}function q(n,e){bt(n,e,!0)}var D=null,K=[],Ce=null;function ei(n){D=n,K=[],Ce!==null&&(clearTimeout(Ce),Ce=null)}function ti(){var n,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(n=D==null?void 0:D.batchSize)!=null?n:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Zn(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function qt(n,e){let t=ti();if(e&&t.endpoint){if(K.push(n),K.length>t.maxQueue&&(K=K.slice(K.length-t.maxQueue)),K.length>=t.batchSize){Qn();return}Ce===null&&(Ce=window.setTimeout(()=>{Ce=null,Qn()},t.flushIntervalMs))}}async function Qn(){let n=ti();if(!n.endpoint||K.length===0)return;let e=K.splice(0,n.batchSize);await Zn(n.endpoint,{events:e},n.transport,n.debug),K.length>0&&await Zn(n.endpoint,{events:K.splice(0,n.batchSize)},n.transport,n.debug)}function ni(n){return Math.max(0,Math.min(1,n))}function Ta(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Xe(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function _a(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function ii(n,e,t){try{n[e]=t}catch{}}function Pa(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ai(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function si(n,e){let t=Pa(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function ri(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),i()},s=u=>{n.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var l,p;let u=Xe();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,A=ni(h),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let y=h-f;A=ni(y)}let x=g.ease(A);g.yoyo&&f%2===1&&(x=1-x);for(let y of g.props)ii(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&ai(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(h>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),h=Ta(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let O of Object.keys(l)){if(f.has(O))continue;let j=l[O];typeof j=="number"&&x.push({key:O,from:_a(u,O),to:j})}let w=si(u,l);return{target:u,startMs:Xe(),delayMs:m,durationMs:g,ease:h,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Xe())},resume:()=>{var h;if(!p.paused)return;let g=(h=p.pauseAtMs)!=null?h:Xe(),m=Xe()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&ii(u,g,m)}let p=si(u,l);p.to&&ai(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))r(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],h=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let x=typeof f=="string"?f.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=f=>{l.push(f);let x=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+x)},b={to(f,x,w){return A({kind:"to",target:f,vars:x,atMs:h(w)}),b},fromTo(f,x,w,y){return A({kind:"fromTo",target:f,vars:w,from:x,atMs:h(y)}),b},play(){var f,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(f=w.from)!=null?f:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let f of m)f.pause();return b},kill(){for(let f of m)f.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function oi(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=ri()}catch{}}var li={name:"handler-playable-sdk",version:"0.3.35",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,ka=V++,ci=V++,di=V++,pi=V++,ui=V++,gi=V++,fi=V++,hi=V++,mi=V++,bi=V++,yi=V++,vi=V++,M=ka;function xi(){return M===ci}function wi(){return M===di}function Ei(){return M===pi}function Ai(){return M===ui}function Le(){return M===gi}function Te(){return M===fi}function Si(){return M===hi}function Ci(){return M===mi}function Li(){return M===bi}function Vt(){return M===yi}function Wt(){return M===vi}function Ti(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),M=ci;return}catch{}else if(n==="dapi")try{dapi.isReady(),M=di;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(M=pi)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(M=ui)}catch{}else if(e==="mintegral")window.gameReady&&(M=gi);else if(e==="tapjoy")window.TJ_API&&(M=fi);else if(e==="tiktok")window.openAppStore&&(M=hi);else if(e==="smadex")try{window.smxTracking&&(M=mi)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(M=bi)}catch{}else e==="vungle"?M=yi:(n==="nucleo"||e==="nucleo")&&(M=vi)}var vt=mt(require("lottie-web"),1),_i=vt.default;typeof window!="undefined"&&(window.lottie=vt.default,window.__baseLottie=vt.default);Xt();function $(n,e){let t=(a,s)=>s===0?a:t(s,a%s),i=t(n,e);return`${n/i}:${e/i}`}var wr=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],Er=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],Ar=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],Oi=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Sr=[...Oi];var Na=Oi[0];ue();var qa=mt(require("jszip"),1);function Fa(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Ga(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Ua(n){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=n})}async function Jt(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await Fa(a),r=await Ua(s),o=Ga(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(t=r==null?void 0:r.height)!=null?t:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function xt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(l=>({r:r[l.offset],g:r[l.offset+1],b:r[l.offset+2]})),c=0;for(let l=0;l<r.length;l+=4){let p=r[l],g=r[l+1],m=r[l+2],h=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){h=!0;break}h&&(r[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),n}}var Ii=require("@google/genai");async function Zt(n,e,t=[],i={}){var a,s,r,o,d,c,u;try{if(!(n!=null&&n.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let l=new Ii.GoogleGenAI({apiKey:n}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),h="",A=(r=(s=(a=m.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(A)for(let b of A)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(l){throw console.error("[Gemini] API error:",l),(o=l.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Ri=require("@google/genai");async function wt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ri.GoogleGenAI({apiKey:n}),s=[{text:e}];t.length>0&&t.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,c=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Ja=require("pixi.js");Je();ue();var Hi=require("pixi.js");var Za=require("pixi.js");Bi();ue();function ss(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function rs(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function os(n){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let c=o.target.dataset.tab;c&&this.switchTab(c)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let t=window.__openAiEditor;if(typeof t!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,t(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Fs={};Xn(Fs,{AssetCache:()=>te,AssetLoader:()=>fe,AssetSystem:()=>Rt,AssetTextures:()=>he,Assets:()=>ha,BaseSystem:()=>ze,GameEngine:()=>It,GameObject:()=>lt,GameObjectManager:()=>De,ObjectFactory:()=>me,Renderer:()=>ot,RuntimeObjectRegistry:()=>Ne,Transform:()=>rt,applyScreenAnchor:()=>$t,basePixi:()=>pa,clearResponsiveElements:()=>ba,createPixiBase:()=>kt,getRegisteredFontIds:()=>oa,globalResponsiveMultipliers:()=>dt,initAssetTextures:()=>St,initAssets:()=>ma,layout:()=>va,playLottieOverlay:()=>ca,registerFont:()=>ra,registerType:()=>Et,resolveAnchorVec2:()=>pt,resolveFont:()=>aa,resolveFontWeight:()=>sa,resolveScreenAnchorPoint:()=>He,resolveScreenRatioPoint:()=>Be,runInitSequence:()=>xa,setLottieInstance:()=>Ct,spawnSceneFromConfig:()=>ga,updateScreenState:()=>Dt});module.exports=La(Fs);var ia=require("pixi.js");var pe={};function bt(n,e,t=!1){pe[n]||(pe[n]=[]),pe[n].push({fn:e,once:t})}function Ut(n,e){if(pe[n]){if(!e){delete pe[n];return}pe[n]=pe[n].filter(t=>t.fn!==e)}}function yt(n,...e){let t=pe[n];if(t)for(let i of[...t])i.fn(...e),i.once&&Ut(n,i.fn)}function q(n,e){bt(n,e,!0)}var D=null,K=[],Ce=null;function ei(n){D=n,K=[],Ce!==null&&(clearTimeout(Ce),Ce=null)}function ti(){var n,e,t;return{endpoint:(D==null?void 0:D.endpoint)||"",transport:(D==null?void 0:D.transport)||"beacon",batchSize:(n=D==null?void 0:D.batchSize)!=null?n:10,flushIntervalMs:(e=D==null?void 0:D.flushIntervalMs)!=null?e:300,maxQueue:(t=D==null?void 0:D.maxQueue)!=null?t:200,debug:!!(D!=null&&D.debug)}}async function Zn(n,e,t,i){let a=JSON.stringify(e);if(t==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(n,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function qt(n,e){let t=ti();if(e&&t.endpoint){if(K.push(n),K.length>t.maxQueue&&(K=K.slice(K.length-t.maxQueue)),K.length>=t.batchSize){Qn();return}Ce===null&&(Ce=window.setTimeout(()=>{Ce=null,Qn()},t.flushIntervalMs))}}async function Qn(){let n=ti();if(!n.endpoint||K.length===0)return;let e=K.splice(0,n.batchSize);await Zn(n.endpoint,{events:e},n.transport,n.debug),K.length>0&&await Zn(n.endpoint,{events:K.splice(0,n.batchSize)},n.transport,n.debug)}function ni(n){return Math.max(0,Math.min(1,n))}function Ta(n){let e=String(n!=null?n:"power2.out");if(e==="linear")return t=>t;if(e==="sine.inOut")return t=>.5-Math.cos(Math.PI*t)/2;if(e==="power2.out"||e==="easeOutQuad")return t=>1-(1-t)*(1-t);if(e.startsWith("back.out")){let t=e.match(/back\.out\(([\d.]+)\)/),i=t?Number(t[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return t=>1-(1-t)*(1-t)}function Xe(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function _a(n,e){let t=n==null?void 0:n[e];return typeof t=="number"?t:0}function ii(n,e,t){try{n[e]=t}catch{}}function Pa(n){let e=n==null?void 0:n.scale;if(!e)return null;let t=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:t,y:i}}function ai(n,e){let t=n==null?void 0:n.scale;if(t)try{typeof t.set=="function"?t.set(e.x,e.y):(typeof t.x=="number"&&(t.x=e.x),typeof t.y=="number"&&(t.y=e.y))}catch{}}function si(n,e){let t=Pa(n);if(!t)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:t.x,y:t.y},to:{x:i!=null?i:t.x,y:a!=null?a:t.y}}}function ri(){let n=new Set,e=new WeakMap,t=null,i=()=>{if(t!=null)return;t=requestAnimationFrame(()=>{t=null,o(),n.size>0&&i()})},a=u=>{var p;n.add(u);let l=(p=e.get(u.target))!=null?p:new Set;l.add(u),e.set(u.target,l),i()},s=u=>{n.delete(u);let l=e.get(u.target);l&&(l.delete(u),l.size===0&&e.delete(u.target))},r=u=>{u.killed||(u.killed=!0,s(u))},o=()=>{var l,p;let u=Xe();for(let g of Array.from(n)){if(g.killed||g.paused)continue;let m=u-g.startMs-g.delayMs;if(m<0)continue;let h=g.durationMs>0?m/g.durationMs:1,A=ni(h),b=g.repeat>=0?g.repeat+1:1,f=g.repeat>0?Math.min(Math.floor(h),b-1):0;if(g.repeat>0&&h>=1){let y=h-f;A=ni(y)}let x=g.ease(A);g.yoyo&&f%2===1&&(x=1-x);for(let y of g.props)ii(g.target,y.key,y.from+(y.to-y.from)*x);g.scaleFrom&&g.scaleTo&&ai(g.target,{x:g.scaleFrom.x+(g.scaleTo.x-g.scaleFrom.x)*x,y:g.scaleFrom.y+(g.scaleTo.y-g.scaleFrom.y)*x});try{(l=g.onUpdate)==null||l.call(g)}catch{}if(h>=b){r(g);try{(p=g.onComplete)==null||p.call(g)}catch{}}}},d=(u,l,p)=>{var y;let g=Math.max(0,(typeof l.duration=="number"?l.duration:.5)*1e3),m=Math.max(0,(typeof l.delay=="number"?l.delay:0)*1e3+((y=p==null?void 0:p.delayMsOverride)!=null?y:0)),h=Ta(l.ease),A=typeof l.repeat=="number"?Math.max(0,l.repeat|0):0,b=l.yoyo===!0,f=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),x=[];for(let O of Object.keys(l)){if(f.has(O))continue;let j=l[O];typeof j=="number"&&x.push({key:O,from:_a(u,O),to:j})}let w=si(u,l);return{target:u,startMs:Xe(),delayMs:m,durationMs:g,ease:h,props:x,scaleFrom:w.from,scaleTo:w.to,repeat:A,yoyo:b,onUpdate:typeof l.onUpdate=="function"?l.onUpdate:void 0,onComplete:typeof l.onComplete=="function"?l.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},c={to(u,l){let p=d(u,l);return a(p),{kill:()=>r(p),pause:()=>{p.paused||(p.paused=!0,p.pauseAtMs=Xe())},resume:()=>{var h;if(!p.paused)return;let g=(h=p.pauseAtMs)!=null?h:Xe(),m=Xe()-g;p.startMs+=m,p.paused=!1,p.pauseAtMs=null},isActive:()=>!p.killed&&!p.paused}},fromTo(u,l,p){return c.set(u,l),c.to(u,p)},set(u,l){if(!u||!l)return;for(let g of Object.keys(l)){let m=l[g];g==="scale"||g==="scaleX"||g==="scaleY"||typeof m=="number"&&ii(u,g,m)}let p=si(u,l);p.to&&ai(u,p.to)},killTweensOf(u){let l=e.get(u);if(l)for(let p of Array.from(l))r(p)},timeline(u={}){let l=[],p=0,g=!1,m=[],h=f=>{if(typeof f=="number")return Math.max(0,f*1e3);let x=typeof f=="string"?f.trim():"";return x.startsWith("+=")?p+Math.max(0,Number(x.slice(2))*1e3||0):x?Math.max(0,Number(x)*1e3||0):p},A=f=>{l.push(f);let x=Math.max(0,(typeof f.vars.duration=="number"?f.vars.duration:.5)*1e3);p=Math.max(p,f.atMs+x)},b={to(f,x,w){return A({kind:"to",target:f,vars:x,atMs:h(w)}),b},fromTo(f,x,w,y){return A({kind:"fromTo",target:f,vars:w,from:x,atMs:h(y)}),b},play(){var f,x;if(g)return b;g=!0,m=[];for(let w of l)w.kind==="fromTo"&&c.set(w.target,(f=w.from)!=null?f:{}),m.push(c.to(w.target,{...w.vars,delay:w.atMs/1e3+((x=w.vars.delay)!=null?x:0)}));return b},pause(){for(let f of m)f.pause();return b},kill(){for(let f of m)f.kill();m=[],g=!1}};return u.paused||b.play(),b}};return c}function oi(){if(typeof window=="undefined")return;let n=window;if(!n.gsap)try{n.gsap=ri()}catch{}}var li={name:"handler-playable-sdk",version:"0.3.36",type:"module",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.cjs",module:"dist/index.js",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.js",require:"./dist/pixi/index.cjs"},"./pixi/index.css":{import:"./dist/pixi/index.css",require:"./dist/pixi/index.css"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.js",require:"./dist/three/index.cjs"},"./cli":{types:"./dist/cli/index.d.ts",import:"./dist/cli/index.js",require:"./dist/cli/index.cjs"}},bin:{"handler-student-helper":"./bin/student-helper.mjs","handler-validate":"./bin/validate.mjs","handler-sync-screens":"./bin/sync-screens.mjs","handler-brand-dna":"./bin/brand-dna.mjs","handler-setup-library":"./bin/setup-library.mjs","handler-screen-helper":"./bin/screen-helper.mjs"},scripts:{prebuild:"python3 src/preview/build-css.py",build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli && npm run obfuscate && npm run postbuild",postbuild:"python3 src/preview/copy-css-to-dist.py","postbuild-cli":"cp src/cli/*.mjs dist/cli/ && chmod +x dist/cli/*.mjs && chmod +x bin/*.mjs","create-mjs-symlinks":"cd dist && ln -sf index.js index.mjs && cd pixi && ln -sf index.js index.mjs && cd ../three && ln -sf index.js index.mjs","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts src/cli/index.ts --format cjs,esm --dts --clean --external lottie-web && npm run create-mjs-symlinks && npm run postbuild-cli",obfuscate:"javascript-obfuscator dist/pixi/index.js --output dist/pixi/index.js --config obfuscator.config.json && javascript-obfuscator dist/three/index.js --output dist/three/index.js --config obfuscator.config.json && javascript-obfuscator dist/cli/index.js --output dist/cli/index.js --config obfuscator.config.json && npm run obfuscate-cli","obfuscate-cli":'for file in dist/cli/*.mjs; do javascript-obfuscator "$file" --output "$file" --config obfuscator.config.json; done',lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.cjs patch","publish:update:minor":"node scripts/publish-and-update.cjs minor","publish:update:major":"node scripts/publish-and-update.cjs major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","bin","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.182.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.182.0",eslint:"^9.39.2","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.182.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2","typescript-eslint":"^8.53.0"},dependencies:{"@google/genai":"^1.35.0","@google/generative-ai":"^0.24.1",jszip:"^3.10.1",sharp:"^0.34.5"}};var V=0,ka=V++,ci=V++,di=V++,pi=V++,ui=V++,gi=V++,fi=V++,hi=V++,mi=V++,bi=V++,yi=V++,vi=V++,M=ka;function xi(){return M===ci}function wi(){return M===di}function Ei(){return M===pi}function Ai(){return M===ui}function Le(){return M===gi}function Te(){return M===fi}function Si(){return M===hi}function Ci(){return M===mi}function Li(){return M===bi}function Vt(){return M===yi}function Wt(){return M===vi}function Ti(){let n=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(n==="mraid")try{mraid.getState(),M=ci;return}catch{}else if(n==="dapi")try{dapi.isReady(),M=di;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(M=pi)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(M=ui)}catch{}else if(e==="mintegral")window.gameReady&&(M=gi);else if(e==="tapjoy")window.TJ_API&&(M=fi);else if(e==="tiktok")window.openAppStore&&(M=hi);else if(e==="smadex")try{window.smxTracking&&(M=mi)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(M=bi)}catch{}else e==="vungle"?M=yi:(n==="nucleo"||e==="nucleo")&&(M=vi)}var vt=mt(require("lottie-web"),1),_i=vt.default;typeof window!="undefined"&&(window.lottie=vt.default,window.__baseLottie=vt.default);Xt();function $(n,e){let t=(a,s)=>s===0?a:t(s,a%s),i=t(n,e);return`${n/i}:${e/i}`}var wr=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:$(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:$(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:$(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:$(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:$(360,780)}],Er=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:$(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:$(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:$(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:$(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:$(412,915)}],Ar=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:$(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:$(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:$(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:$(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:$(800,1280)}],Oi=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:$(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:$(768,1024),mraidScale:.7}];var Sr=[...Oi];var Na=Oi[0];ue();var qa=mt(require("jszip"),1);function Fa(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function Ga(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function Ua(n){return await new Promise(e=>{let t=new Image;t.onload=()=>e({width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}),t.onerror=()=>e(null),t.src=n})}async function Jt(n){var e,t;try{console.log("[ImageUtils] Fetching image data from URL:",n);let i=await fetch(n);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,n),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await Fa(a),r=await Ua(s),o=Ga(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(t=r==null?void 0:r.height)!=null?t:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function xt(n,e=30){try{console.log("[ImageUtils] Removing background color...");let t=await new Promise((l,p)=>{let g=new Image;g.onload=()=>l(g),g.onerror=()=>p(new Error("Failed to load image")),g.src=n}),i=document.createElement("canvas");i.width=t.width,i.height=t.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),n;a.drawImage(t,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,d=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(l=>({r:r[l.offset],g:r[l.offset+1],b:r[l.offset+2]})),c=0;for(let l=0;l<r.length;l+=4){let p=r[l],g=r[l+1],m=r[l+2],h=!1;for(let A of d)if(Math.sqrt(Math.pow(p-A.r,2)+Math.pow(g-A.g,2)+Math.pow(m-A.b,2))<e){h=!0;break}h&&(r[l+3]=0,c++)}return console.log(`[ImageUtils] Removed background from ${c} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(t){return console.error("[ImageUtils] Error removing background:",t),n}}var Ii=require("@google/genai");async function Zt(n,e,t=[],i={}){var a,s,r,o,d,c,u;try{if(!(n!=null&&n.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let b=0;b<t.length;b++){let f=t[b];if(!f.base64||!f.mimeType)throw new Error(`Image ${b+1} is missing required data`);if(f.base64.length<1e3&&console.warn(`Image ${b+1} data appears very small, may be corrupted`),!f.mimeType.startsWith("image/"))throw new Error(`Image ${b+1} has invalid MIME type: ${f.mimeType}`)}let l=new Ii.GoogleGenAI({apiKey:n}),p="gemini-2.5-flash",g=[e];t.length>0&&t.forEach((b,f)=>{g.push({inlineData:{data:b.base64,mimeType:b.mimeType}}),console.log(`[Gemini] Added image ${f+1}: ${b.mimeType}, size: ${Math.round(b.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${t.length} images and prompt length: ${e.length}`);let m=await l.models.generateContent({model:p,contents:g}),h="",A=(r=(s=(a=m.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(A)for(let b of A)b.text&&(h+=b.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(l){throw console.error("[Gemini] API error:",l),(o=l.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(d=l.message)!=null&&d.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(c=l.message)!=null&&c.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(u=l.message)!=null&&u.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):l}}var Ri=require("@google/genai");async function wt(n,e,t=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ri.GoogleGenAI({apiKey:n}),s=[{text:e}];t.length>0&&t.forEach((o,d)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${d}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let d=o.inlineData.data,c=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${c};base64,${d}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var Ja=require("pixi.js");Je();ue();var Hi=require("pixi.js");var Za=require("pixi.js");Bi();ue();function ss(n){return new Promise((e,t)=>{let i=new FileReader;i.onerror=()=>t(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(n)})}function rs(n){var a;let[e,t]=n.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:t!=null?t:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function os(n){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|
package/dist/pixi/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2a5357,_0x15e461){var a0_0x1f6382={_0x4944c9:0x16c,_0x54a67e:0x15c,_0x2689eb:'QiAX',_0x30942e:0x165,_0x20114e:0x184,_0x2a8d5f:'a08R',_0x16ba60:0x179,_0x10b0d6:0x182,_0x6a503d:0x191,_0x5a6246:'0R[*',_0x3f3eb4:0x173,_0x54cd1b:0x175,_0x50fca7:0x16f,_0x5455b3:0x3e2,_0x5b42b0:0x3d7,_0x21a000:0x3e1,_0x4f070f:'47CL',_0x352ef7:0x2b1,_0x3fc271:'w66]',_0x5c86f1:0x2bd,_0x4a903d:0x2b0,_0x43a624:0x163,_0xd8ee0f:0x178,_0x223d32:'RFOE',_0x14b194:0x17b,_0x298a39:0x17d,_0x18d907:0x172,_0xc1c82e:0x16b,_0x125445:0x16e,_0x5b4a7b:0x15e,_0x51303d:'qJ8N',_0x4d7ea7:0x15b,_0x4e9e3a:0x3db,_0x1683d8:0x3d9,_0x15d41b:0x3c9,_0x1ac5f8:0x3de,_0x3aa457:0x17c,_0x5c88ab:0x17a,_0x4b1396:'a08R',_0x517676:0x182,_0x4e3649:0x3e7,_0x25b6fe:0x3db,_0xa48825:'xiWv'},a0_0x30318f={_0x3ebf99:0x1fa},a0_0x96ab3f={_0x3c02e3:0x231};function _0x49302a(_0x1268bf,_0x1f15dd,_0x5a63df,_0x3ecade,_0x497309){return a0_0x2e75(_0x1268bf- -a0_0x96ab3f._0x3c02e3,_0x3ecade);}function _0x45d8c8(_0x293764,_0x447631,_0x4aeacd,_0x5c61f4,_0x2de010){return a0_0x2e75(_0x447631-0x31e,_0x2de010);}var _0x12d3ac=_0x2a5357();function _0x56d78d(_0xee0cd4,_0x2293ad,_0x24bda4,_0x22b6fd,_0x3bc430){return a0_0x2e75(_0x24bda4-a0_0x30318f._0x3ebf99,_0x2293ad);}while(!![]){try{var _0x1ae40c=-parseInt(_0x49302a(-a0_0x1f6382._0x4944c9,-a0_0x1f6382._0x54a67e,-0x177,a0_0x1f6382._0x2689eb,-a0_0x1f6382._0x30942e))/(-0x4b8+0x34*-0x56+0x1b5*0xd)+-parseInt(_0x49302a(-0x17e,-a0_0x1f6382._0x20114e,-0x183,a0_0x1f6382._0x2a8d5f,-a0_0x1f6382._0x16ba60))/(0x21ef+0xc5*0x12+0x3*-0xfed)+parseInt(_0x49302a(-a0_0x1f6382._0x10b0d6,-a0_0x1f6382._0x6a503d,-a0_0x1f6382._0x10b0d6,a0_0x1f6382._0x5a6246,-0x18e))/(-0xfb*0x19+-0x4*-0x153+0x133a)*(parseInt(_0x49302a(-a0_0x1f6382._0x3f3eb4,-a0_0x1f6382._0x54cd1b,-0x16a,'ah#U',-a0_0x1f6382._0x50fca7))/(-0xa3*-0x35+-0x1*0x192a+-0x891))+parseInt(_0x45d8c8(0x3e6,a0_0x1f6382._0x5455b3,a0_0x1f6382._0x5b42b0,a0_0x1f6382._0x21a000,a0_0x1f6382._0x4f070f))/(0x218e+-0x10*0x23a+-0x1*-0x217)*(-parseInt(_0x56d78d(a0_0x1f6382._0x352ef7,a0_0x1f6382._0x3fc271,a0_0x1f6382._0x5c86f1,0x2b6,a0_0x1f6382._0x4a903d))/(0x9*-0x397+-0x2be*-0x4+0x155d))+parseInt(_0x49302a(-0x170,-a0_0x1f6382._0x43a624,-a0_0x1f6382._0xd8ee0f,a0_0x1f6382._0x223d32,-a0_0x1f6382._0x14b194))/(0x385+-0x133+-0x24b)*(parseInt(_0x49302a(-0x171,-0x17e,-a0_0x1f6382._0x298a39,'O1Uk',-a0_0x1f6382._0x18d907))/(0x1584+-0x6eb+-0xe91))+parseInt(_0x49302a(-a0_0x1f6382._0xc1c82e,-a0_0x1f6382._0x125445,-a0_0x1f6382._0x5b4a7b,a0_0x1f6382._0x51303d,-a0_0x1f6382._0x4d7ea7))/(0x25*-0x109+0x8*-0xc5+0x2c7e)*(-parseInt(_0x45d8c8(a0_0x1f6382._0x4e9e3a,a0_0x1f6382._0x1683d8,a0_0x1f6382._0x15d41b,a0_0x1f6382._0x1ac5f8,'erLl'))/(0xf6*-0x9+-0x2*-0xc23+0x23*-0x72))+-parseInt(_0x49302a(-a0_0x1f6382._0x3aa457,-a0_0x1f6382._0x5c88ab,-0x184,a0_0x1f6382._0x4b1396,-a0_0x1f6382._0x517676))/(0x167*0x19+0x2507+-0x1*0x480b)*(-parseInt(_0x45d8c8(0x3ef,a0_0x1f6382._0x4e3649,a0_0x1f6382._0x25b6fe,0x3f0,a0_0x1f6382._0xa48825))/(0x8c*0x2b+0x21b3+0x392b*-0x1));if(_0x1ae40c===_0x15e461)break;else _0x12d3ac['push'](_0x12d3ac['shift']());}catch(_0x4bca08){_0x12d3ac['push'](_0x12d3ac['shift']());}}}(a0_0x5caa,0x8463b+0x1*0x58ff0+0x55c*-0x13f));var a0_0x48f68b=(function(){var a0_0x3f6ff4={_0x3629c7:0x229,_0x31f69a:0x22f,_0x443f05:'UVId',_0x53cc68:0x234},_0x3397f5=!![];return function(_0x3c701b,_0x5626ca){var a0_0x581b1c={_0x53add6:0x2fc},_0x5ee264=_0x3397f5?function(){function _0x1c84fb(_0x3676f5,_0x3f421e,_0x5f3610,_0x4a75c2,_0x10a709){return a0_0x2e75(_0x4a75c2- -a0_0x581b1c._0x53add6,_0x5f3610);}if(_0x5626ca){var _0x1480d9=_0x5626ca[_0x1c84fb(-a0_0x3f6ff4._0x3629c7,-a0_0x3f6ff4._0x31f69a,a0_0x3f6ff4._0x443f05,-a0_0x3f6ff4._0x53cc68,-0x22f)](_0x3c701b,arguments);return _0x5626ca=null,_0x1480d9;}}:function(){};return _0x3397f5=![],_0x5ee264;};}()),a0_0x4acdfb=a0_0x48f68b(this,function(){var a0_0x2c5677={_0xab4801:0x23,_0x5db6bd:0x22,_0x1e99f9:0xf,_0x40491e:0x1d,_0x11a22c:'ah#U',_0x406d13:0x27f,_0x801508:0x279,_0xde0658:0x260,_0x5e7aa9:'0!Wd',_0x591315:0x274,_0x4a76df:0x27e,_0x4f0e8b:'OEV0',_0x13295b:0x283,_0x56e7c1:0x287,_0x4b0941:'ysgE',_0x5571c7:0x287,_0x41f99b:0x285,_0x653d18:0x28b,_0x5917fd:0x284,_0x236277:0x28a,_0x188197:0x282,_0x4d5581:0x277,_0x56d6f6:'v%t@',_0x3efd05:0x30,_0x3eb4de:0x24,_0x462249:0x27,_0x409698:0x2b,_0x36553e:0x18,_0x2c8831:0x20,_0xc63190:0x262,_0x182c97:0x270,_0x4a0272:0x278},a0_0x368703={_0x1d3d0f:0x1c5},a0_0x1c4297={_0x374ab2:0x28d},_0x33b2e5={};function _0x4c9901(_0x5beb1b,_0x1be2ac,_0x328814,_0x29b664,_0x1236c2){return a0_0x2e75(_0x1be2ac-a0_0x1c4297._0x374ab2,_0x328814);}function _0x3bfa19(_0x2253d8,_0x39873c,_0x2d5c9d,_0x4ee305,_0x160cee){return a0_0x2e75(_0x4ee305- -0xd7,_0x160cee);}_0x33b2e5[_0x3bfa19(-a0_0x2c5677._0xab4801,-a0_0x2c5677._0x5db6bd,-a0_0x2c5677._0x1e99f9,-a0_0x2c5677._0x40491e,a0_0x2c5677._0x11a22c)]=_0x7e1a58(a0_0x2c5677._0x406d13,a0_0x2c5677._0x801508,0x26f,a0_0x2c5677._0xde0658,a0_0x2c5677._0x5e7aa9)+')+)+)'+'+$';function _0x7e1a58(_0x410886,_0x2aa8e1,_0x3e6650,_0x2eec3f,_0x454788){return a0_0x2e75(_0x3e6650-a0_0x368703._0x1d3d0f,_0x454788);}var _0x56b9b5=_0x33b2e5;return a0_0x4acdfb[_0x7e1a58(a0_0x2c5677._0x591315,0x26f,a0_0x2c5677._0x4a76df,0x289,a0_0x2c5677._0x4f0e8b)+_0x7e1a58(a0_0x2c5677._0x13295b,0x27d,0x281,a0_0x2c5677._0x56e7c1,a0_0x2c5677._0x4b0941)]()['searc'+'h'](_0x56b9b5['fYffs'])[_0x7e1a58(a0_0x2c5677._0x5571c7,a0_0x2c5677._0x41f99b,0x287,a0_0x2c5677._0x653d18,'erLl')+_0x7e1a58(a0_0x2c5677._0x5917fd,a0_0x2c5677._0x236277,a0_0x2c5677._0x188197,a0_0x2c5677._0x4d5581,a0_0x2c5677._0x56d6f6)]()['const'+_0x3bfa19(-a0_0x2c5677._0x3efd05,-a0_0x2c5677._0x3eb4de,-a0_0x2c5677._0x462249,-a0_0x2c5677._0x409698,'RFOE')+'r'](a0_0x4acdfb)[_0x3bfa19(-0x1a,-a0_0x2c5677._0x36553e,-0x16,-a0_0x2c5677._0x2c8831,'X5(^')+'h'](_0x56b9b5[_0x7e1a58(0x27d,a0_0x2c5677._0xc63190,a0_0x2c5677._0x182c97,a0_0x2c5677._0x4a0272,'ysgE')]);});a0_0x4acdfb();import{A as a0_0x41b59e,B as a0_0x21f2dd,C as a0_0x15bc04,D as a0_0x165aee,b as a0_0x56ed58,c as a0_0x73a588,d as a0_0x134f8a,e as a0_0x22b80c,f as a0_0x532dec,g as a0_0x2f6b4f,h as a0_0x445331,i as a0_0x15c7a1,j as a0_0x4411c1,k as a0_0x1f1fe5,l as a0_0x130841,m as a0_0x68a279,n as a0_0x390fe6,o as a0_0x1a8c50,p as a0_0x410074,q as a0_0x17b573,r as a0_0x20fa4c,s as a0_0x45aab0,t as a0_0x2309e0,u as a0_0x1e5940,v as a0_0x561a90,w as a0_0x23c920,x as a0_0x179c21,y as a0_0x426af0,z as a0_0x6f3aa5}from'../chunk-OZZRT3XI.js';import{a as a0_0x34b683,b as a0_0x46a0bb,c as a0_0x5406e8,d as a0_0x3bbc47,e as a0_0x46034a}from'../chunk-I5OOVR5U.js';import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';import'../chunk-E6WJCS24.js';function a0_0x2e75(_0x58128a,_0x46074e){_0x58128a=_0x58128a-(-0x527+-0xfc2+0x1593*0x1);var _0x4b48cc=a0_0x5caa();var _0x54f6d3=_0x4b48cc[_0x58128a];if(a0_0x2e75['msYpzU']===undefined){var _0x591a51=function(_0x367ce3){var _0x37e1c8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x11c5fd='',_0x3627da='',_0x4d5eee=_0x11c5fd+_0x591a51;for(var _0x15c4d7=-0x102+-0x2b6+-0x2*-0x1dc,_0x4c4961,_0x212822,_0x28559f=-0x1*-0x236+-0x35*0x9e+-0x7a0*-0x4;_0x212822=_0x367ce3['charAt'](_0x28559f++);~_0x212822&&(_0x4c4961=_0x15c4d7%(-0x5*-0x2dd+-0xf*-0x47+-0x1276)?_0x4c4961*(0x1338+0x2369+-0x3661)+_0x212822:_0x212822,_0x15c4d7++%(-0x18+0x11c3*-0x2+0x23a2))?_0x11c5fd+=_0x4d5eee['charCodeAt'](_0x28559f+(0x170b+0xc30+-0x63*0x5b))-(-0x1385+-0x2a5*0x8+0x28b7)!==-0x102b+-0x1370+0x239b*0x1?String['fromCharCode'](-0x112*-0x1d+0x19b9+0x1be2*-0x2&_0x4c4961>>(-(-0x194f*0x1+0x34+0x191d)*_0x15c4d7&-0xb2*0x5+0x2*0xdbd+-0x17fa)):_0x15c4d7:0x39a+-0xa75*0x1+-0x9*-0xc3){_0x212822=_0x37e1c8['indexOf'](_0x212822);}for(var _0x58dfca=0x4fe+-0x2e6+0x4*-0x86,_0x10f94e=_0x11c5fd['length'];_0x58dfca<_0x10f94e;_0x58dfca++){_0x3627da+='%'+('00'+_0x11c5fd['charCodeAt'](_0x58dfca)['toString'](-0x1ff6+-0x1*-0x1645+0x9c1))['slice'](-(-0x1e17+0x24d5+-0x6bc));}return decodeURIComponent(_0x3627da);};var _0x4b4fbf=function(_0x469529,_0x151ed7){var _0x31bcf8=[],_0x2972fd=-0x1*-0x7d7+-0x23*0x103+0x1b92,_0x2f79e7,_0x58a503='';_0x469529=_0x591a51(_0x469529);var _0x4350f0;for(_0x4350f0=-0x14c2+0x2026+-0xb64;_0x4350f0<-0x745*-0x4+-0x4*0xe+-0x1bdc;_0x4350f0++){_0x31bcf8[_0x4350f0]=_0x4350f0;}for(_0x4350f0=-0x21b7+-0x3d7*-0x2+0x1a09;_0x4350f0<0x1202+-0x1*0xa5d+-0x6a5;_0x4350f0++){_0x2972fd=(_0x2972fd+_0x31bcf8[_0x4350f0]+_0x151ed7['charCodeAt'](_0x4350f0%_0x151ed7['length']))%(0x8*0x1eb+0xc*-0x2c8+0x3*0x658),_0x2f79e7=_0x31bcf8[_0x4350f0],_0x31bcf8[_0x4350f0]=_0x31bcf8[_0x2972fd],_0x31bcf8[_0x2972fd]=_0x2f79e7;}_0x4350f0=-0x266*0xf+-0x1f83*-0x1+0x477,_0x2972fd=-0x82*0x3e+-0x195*0x3+0x243b;for(var _0x1504fc=0x173a*-0x1+0x705*0x3+0x5*0x6f;_0x1504fc<_0x469529['length'];_0x1504fc++){_0x4350f0=(_0x4350f0+(0x1c45+0x22f0+-0x3f34))%(0xcb3+0x161*0x7+0x2*-0xaad),_0x2972fd=(_0x2972fd+_0x31bcf8[_0x4350f0])%(-0x353*0xb+-0x1*-0x8ff+0xe49*0x2),_0x2f79e7=_0x31bcf8[_0x4350f0],_0x31bcf8[_0x4350f0]=_0x31bcf8[_0x2972fd],_0x31bcf8[_0x2972fd]=_0x2f79e7,_0x58a503+=String['fromCharCode'](_0x469529['charCodeAt'](_0x1504fc)^_0x31bcf8[(_0x31bcf8[_0x4350f0]+_0x31bcf8[_0x2972fd])%(0x4*0x30c+-0x1*-0x2528+-0x3058)]);}return _0x58a503;};a0_0x2e75['faekHz']=_0x4b4fbf,a0_0x2e75['zCrYgA']={},a0_0x2e75['msYpzU']=!![];}var _0x409813=_0x4b48cc[0x71b+-0x3cb+-0x8*0x6a],_0xaa5306=_0x58128a+_0x409813,_0x35156a=a0_0x2e75['zCrYgA'][_0xaa5306];if(!_0x35156a){if(a0_0x2e75['VpmYIO']===undefined){var _0x38dee6=function(_0x252d41){this['FUCuml']=_0x252d41,this['Vhgorg']=[0x1d3a+-0x1*-0x24f5+-0x422e,0x1*-0x16c5+-0x13*-0x1c1+-0xa8e,-0x16c2+-0x2*0x6f2+0x24a6],this['raaiGa']=function(){return'newState';},this['foIBqy']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['LAGBqv']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x38dee6['prototype']['JuChSv']=function(){var _0x3a6910=new RegExp(this['foIBqy']+this['LAGBqv']),_0x23d5b4=_0x3a6910['test'](this['raaiGa']['toString']())?--this['Vhgorg'][0x8fb+0x133+-0xa2d]:--this['Vhgorg'][-0x322*0x2+-0x250*-0x7+-0x14*0x7f];return this['GLIsCS'](_0x23d5b4);},_0x38dee6['prototype']['GLIsCS']=function(_0x841d02){if(!Boolean(~_0x841d02))return _0x841d02;return this['EkYvAy'](this['FUCuml']);},_0x38dee6['prototype']['EkYvAy']=function(_0x3d13eb){for(var _0x339e6e=-0x8e*0x1c+-0xdcf+-0x431*-0x7,_0x438463=this['Vhgorg']['length'];_0x339e6e<_0x438463;_0x339e6e++){this['Vhgorg']['push'](Math['round'](Math['random']())),_0x438463=this['Vhgorg']['length'];}return _0x3d13eb(this['Vhgorg'][-0x1*-0x1e2c+-0x213+-0x1c19]);},new _0x38dee6(a0_0x2e75)['JuChSv'](),a0_0x2e75['VpmYIO']=!![];}_0x54f6d3=a0_0x2e75['faekHz'](_0x54f6d3,_0x46074e),a0_0x2e75['zCrYgA'][_0xaa5306]=_0x54f6d3;}else _0x54f6d3=_0x35156a;return _0x54f6d3;}import'../chunk-ZFQCFKYD.js';function a0_0x5caa(){var _0x3f2ca0=['W4xcVCkkW6Om','dCkUd8omW6K','fmkHWRerpG','W5bMhLhdIWXMqNK','W7S5u2RdP8kEWRaHsq','i2pcH1i7oKD9WP7dSmk1','WRfZW43cHCorW6/cVW','W74/vb7cVSozWQqyAYH0tG','WRaDWOJdTSoWWQ3cNISueG','DrTrWRJcLxBcLZXFWOq8WPy','WQnKW6NdQSkdn8ocWQfUWOXI','DrPxW4tdIZdcTYPX','W73cGmohWP4VW4XzxJ8','sSk4ySoZka','W7lcNZxcRsWTcmkXW5ZdPmkHWOK','W7j3W4NcPmoG','WPpcSN/dVfS','ECkkW5fPkvnOCmoP','aSkzdG','jGNcJG','W4FdNc/dG3JdICowWPVcTq','W6jAW5FdPCkuW5DCWR/dSu8wose','WQG3WRnwW7hdQJ9bWQJcULldISoU','uCk/WOuWeSoQW44','oCosWRjRea','WOBcImk7wv7cQXBcHqZcJ8kY','wmkZWQJcQ8o4qSkcfqet','W7rbW5CHvvbhc3r8W5b0','WQnKW6ldQ8koumo3WP51WPr+WOy','jMBcGfi4AZvHWRtdMCkzlSoF','WPPviCk0W7G','W4zmb2RdPeJcUbhcH8k0WQ7dHYS'];a0_0x5caa=function(){return _0x3f2ca0;};return a0_0x5caa();}export{a0_0x34b683 as AssetCache,a0_0x5406e8 as AssetLoader,a0_0x1e5940 as AssetSystem,a0_0x3bbc47 as AssetTextures,a0_0x45aab0 as Assets,a0_0x1a8c50 as BaseSystem,a0_0x390fe6 as GameEngine,a0_0x22b80c as GameObject,a0_0x532dec as GameObjectManager,a0_0x68a279 as ObjectFactory,a0_0x134f8a as Renderer,a0_0x410074 as RuntimeObjectRegistry,a0_0x73a588 as Transform,a0_0x21f2dd as applyScreenAnchor,a0_0x17b573 as basePixi,a0_0x23c920 as clearResponsiveElements,a0_0x56ed58 as createPixiBase,a0_0x4411c1 as getRegisteredFontIds,a0_0x561a90 as globalResponsiveMultipliers,a0_0x46034a as initAssetTextures,a0_0x2309e0 as initAssets,a0_0x15bc04 as layout,a0_0x130841 as playLottieOverlay,a0_0x15c7a1 as registerFont,a0_0x46a0bb as registerType,a0_0x426af0 as resolveAnchorVec2,a0_0x2f6b4f as resolveFont,a0_0x445331 as resolveFontWeight,a0_0x6f3aa5 as resolveScreenAnchorPoint,a0_0x41b59e as resolveScreenRatioPoint,a0_0x165aee as runInitSequence,a0_0x1f1fe5 as setLottieInstance,a0_0x20fa4c as spawnSceneFromConfig,a0_0x179c21 as updateScreenState};
|
|
1
|
+
(function(_0xd84836,_0x52ffad){var a0_0x37dbde={_0xcdcd45:0x38a,_0x24b7d2:0x374,_0x2c64d1:0x38e,_0x55edba:'YqUF',_0x31693b:0x380,_0x35a48b:'c&Ee',_0x1d922d:0x99,_0x30095c:0xb4,_0x4c8403:0xa3,_0x33f077:0x36f,_0xce2143:0x370,_0x317bf2:'W7#X',_0x3dc135:'KEt#',_0x374764:0x9a,_0xe634de:0x90,_0x19a8b4:0x95,_0x3afb4a:0x8a,_0x190f53:0x384,_0x2418c2:0x377,_0x1bfb3b:0x1a8,_0x39ce74:'7Ftp',_0x1d702e:0x1b1,_0x1db302:0x1b0,_0x5da813:0x1a5,_0x3f18fb:0x194,_0x2d8d9c:'PH!&',_0x59bcde:0x19c,_0x34cb1b:0x198,_0x3d18c7:0x19b,_0x6242b8:'YqUF',_0x33d915:0x1a4,_0x4e0b04:0x1ad,_0x407feb:0x19c,_0x25dc8b:']#16',_0x76a5cf:0x1a0,_0x25967d:0x19c,_0x5a2a47:0x193,_0x154019:0x37c,_0x45ee5d:0x373,_0x5ec79e:0x379,_0x28a47e:0x38f,_0x3f6c58:0x38c,_0x51e8b7:'6lfi',_0x426d62:0x381},a0_0x259221={_0x5308f9:0x13d};function _0xf845e9(_0x2a9d15,_0x5a74b7,_0x17e5af,_0x270668,_0xc8e238){return a0_0x1ba2(_0xc8e238-0x1a1,_0x270668);}function _0x1858e9(_0x8934da,_0x2c7c94,_0x351d52,_0x49fde,_0x49ec8f){return a0_0x1ba2(_0x49fde- -a0_0x259221._0x5308f9,_0x8934da);}function _0x25dda9(_0x518ee2,_0x5e6545,_0x463fb0,_0x27894d,_0x3366e0){return a0_0x1ba2(_0x463fb0- -0x35,_0x5e6545);}var _0x225596=_0xd84836();while(!![]){try{var _0x3b24c4=parseInt(_0xf845e9(a0_0x37dbde._0xcdcd45,a0_0x37dbde._0x24b7d2,a0_0x37dbde._0x2c64d1,a0_0x37dbde._0x55edba,a0_0x37dbde._0x31693b))/(0x97b*-0x3+0xcd3*-0x1+-0x2945*-0x1)*(parseInt(_0x1858e9(a0_0x37dbde._0x35a48b,a0_0x37dbde._0x1d922d,a0_0x37dbde._0x30095c,0xa7,a0_0x37dbde._0x4c8403))/(-0x26*0x1+-0x8e*-0x32+-0x1b94))+-parseInt(_0xf845e9(a0_0x37dbde._0x33f077,a0_0x37dbde._0xce2143,a0_0x37dbde._0x33f077,a0_0x37dbde._0x317bf2,0x378))/(0xd2d*0x2+0x163*-0x7+0x10a2*-0x1)*(-parseInt(_0x1858e9(a0_0x37dbde._0x3dc135,a0_0x37dbde._0x374764,a0_0x37dbde._0xe634de,a0_0x37dbde._0x19a8b4,a0_0x37dbde._0x3afb4a))/(-0x110*-0x2+0x1*0x292+-0x4ae*0x1))+-parseInt(_0xf845e9(a0_0x37dbde._0x190f53,a0_0x37dbde._0x190f53,0x372,a0_0x37dbde._0x3dc135,a0_0x37dbde._0x2418c2))/(-0x20be+-0x1c60+0x8d*0x6f)*(parseInt(_0x25dda9(a0_0x37dbde._0x1bfb3b,a0_0x37dbde._0x39ce74,a0_0x37dbde._0x1d702e,a0_0x37dbde._0x1db302,a0_0x37dbde._0x5da813))/(0x22de+-0x2f*0xa3+-0x4eb))+-parseInt(_0x25dda9(a0_0x37dbde._0x3f18fb,a0_0x37dbde._0x2d8d9c,a0_0x37dbde._0x59bcde,a0_0x37dbde._0x34cb1b,a0_0x37dbde._0x3d18c7))/(0x6f1*-0x2+-0x44*0x91+0x346d)+-parseInt(_0x25dda9(0x19f,a0_0x37dbde._0x6242b8,a0_0x37dbde._0x33d915,a0_0x37dbde._0x4e0b04,a0_0x37dbde._0x407feb))/(0x6da+0x883*0x2+0x6d*-0x38)*(parseInt(_0x25dda9(0x197,a0_0x37dbde._0x25dc8b,a0_0x37dbde._0x76a5cf,a0_0x37dbde._0x25967d,a0_0x37dbde._0x5a2a47))/(0x92b+-0x4cd*-0x7+-0x2abd))+parseInt(_0xf845e9(a0_0x37dbde._0x154019,a0_0x37dbde._0x45ee5d,0x371,'Ft@W',a0_0x37dbde._0x5ec79e))/(0x470*0x6+-0x2*-0x5ba+0x9*-0x43a)+parseInt(_0xf845e9(0x38c,a0_0x37dbde._0x28a47e,a0_0x37dbde._0x3f6c58,a0_0x37dbde._0x51e8b7,a0_0x37dbde._0x426d62))/(-0x10ec+-0x131d+-0x905*-0x4);if(_0x3b24c4===_0x52ffad)break;else _0x225596['push'](_0x225596['shift']());}catch(_0x3a53bf){_0x225596['push'](_0x225596['shift']());}}}(a0_0x3b1a,0x68c*-0x85+-0x22f*0x24a+0xb4037));var a0_0x306090=(function(){var a0_0x45b395={_0x3273a8:'Efdm',_0x2fc401:0x33a,_0x5a585d:0x338,_0xba45ce:0x338,_0x549fd5:0x32d},_0x3bbfcc=!![];return function(_0x17b8f0,_0x594cb3){var _0x428a65=_0x3bbfcc?function(){var a0_0x55ab1a={_0x34c0d3:0x159};function _0x39fc1f(_0x576a3a,_0x2048d2,_0x1a30ac,_0x32a026,_0xadcb54){return a0_0x1ba2(_0xadcb54-a0_0x55ab1a._0x34c0d3,_0x576a3a);}if(_0x594cb3){var _0x218464=_0x594cb3[_0x39fc1f(a0_0x45b395._0x3273a8,a0_0x45b395._0x2fc401,a0_0x45b395._0x5a585d,a0_0x45b395._0xba45ce,a0_0x45b395._0x549fd5)](_0x17b8f0,arguments);return _0x594cb3=null,_0x218464;}}:function(){};return _0x3bbfcc=![],_0x428a65;};}()),a0_0x404ca6=a0_0x306090(this,function(){var a0_0xe086f8={_0x1eed0c:'PH!&',_0x381fcd:0x13e,_0x93dfee:0x13f,_0x59dba7:0x139,_0x114e20:'VCDj',_0x13fedb:0x12e,_0x35d23c:0x12d,_0x948f1e:0x132,_0x3cff68:'U*t[',_0x852d1e:0x11f,_0x4dc3df:0x53,_0x39f9a6:0x46,_0x1d9e33:0x4f,_0x12be1f:0x50,_0x568f93:'W7#X',_0x1ee64a:0x124,_0x42ae7a:0x13b,_0x4d51c1:0x131,_0x3a209c:0x57,_0x3a830b:0x60,_0xdda6a4:'(nl)',_0x4886d3:'1w%$',_0x39586b:0x12a,_0x59c37b:0x12c,_0x48d720:0x125,_0x99cb75:0xc9,_0x373562:0xba,_0x376d1c:0xc5},a0_0x2821dc={_0x4a3d5a:0x120},a0_0x19c37e={_0x177b8e:0x18f},_0x1348a2={};function _0x69fe6d(_0x20e45c,_0x660729,_0x1e2723,_0x787b4b,_0x597e18){return a0_0x1ba2(_0x1e2723- -a0_0x19c37e._0x177b8e,_0x597e18);}_0x1348a2[_0x38cc27(a0_0xe086f8._0x1eed0c,0x13c,a0_0xe086f8._0x381fcd,a0_0xe086f8._0x93dfee,a0_0xe086f8._0x59dba7)]='(((.+'+')+)+)'+'+$';function _0x38cc27(_0x3c8d75,_0x236612,_0x4b5f2c,_0x24ec44,_0x21e5d2){return a0_0x1ba2(_0x21e5d2- -0xaa,_0x3c8d75);}var _0xcd59ca=_0x1348a2;function _0x207882(_0x494ec2,_0xc77b50,_0x158487,_0x3c8eb5,_0xa62b59){return a0_0x1ba2(_0x158487- -a0_0x2821dc._0x4a3d5a,_0x3c8eb5);}return a0_0x404ca6[_0x38cc27(a0_0xe086f8._0x114e20,a0_0xe086f8._0x13fedb,a0_0xe086f8._0x35d23c,a0_0xe086f8._0x948f1e,0x130)+_0x38cc27(a0_0xe086f8._0x3cff68,0x12a,0x12e,a0_0xe086f8._0x852d1e,0x129)]()[_0x69fe6d(a0_0xe086f8._0x4dc3df,a0_0xe086f8._0x39f9a6,a0_0xe086f8._0x1d9e33,a0_0xe086f8._0x12be1f,a0_0xe086f8._0x568f93)+'h'](_0xcd59ca['wFANq'])[_0x38cc27('!4P(',a0_0xe086f8._0x1ee64a,a0_0xe086f8._0x42ae7a,0x13d,a0_0xe086f8._0x4d51c1)+_0x69fe6d(a0_0xe086f8._0x3a209c,a0_0xe086f8._0x3a830b,0x53,a0_0xe086f8._0x1d9e33,a0_0xe086f8._0xdda6a4)]()['const'+'ructo'+'r'](a0_0x404ca6)[_0x38cc27(a0_0xe086f8._0x4886d3,a0_0xe086f8._0x39586b,a0_0xe086f8._0x39586b,a0_0xe086f8._0x59c37b,a0_0xe086f8._0x48d720)+'h'](_0xcd59ca[_0x207882(a0_0xe086f8._0x99cb75,a0_0xe086f8._0x373562,a0_0xe086f8._0x376d1c,'laW5',a0_0xe086f8._0x376d1c)]);});a0_0x404ca6();import{A as a0_0x3de84e,B as a0_0x29900b,C as a0_0x12930b,D as a0_0x5c848d,b as a0_0x37c06c,c as a0_0x31fa3c,d as a0_0x2d4e27,e as a0_0x4870d7,f as a0_0x3bf734,g as a0_0x362493,h as a0_0x29ec42,i as a0_0x45e5bf,j as a0_0x39e6ea,k as a0_0xbeb25,l as a0_0x4c9345,m as a0_0x32fef5,n as a0_0x69e91a,o as a0_0x484a5a,p as a0_0x288601,q as a0_0x1ac1a1,r as a0_0x9d6f69,s as a0_0x4aaa1c,t as a0_0x303308,u as a0_0x317de2,v as a0_0x143ee8,w as a0_0x1d317b,x as a0_0x453fb7,y as a0_0x52cdec,z as a0_0x458b9f}from'../chunk-DSJ7EQPG.js';import{a as a0_0x854f32,b as a0_0x4bffba,c as a0_0x1242fc,d as a0_0x5e23d1,e as a0_0x36fb5c}from'../chunk-I5OOVR5U.js';function a0_0x3b1a(){var _0x2ae39c=['W4ZdUCkHW6ZdJq','W47cHSkHWQOyW6hcHCozW5ZdUSkQDCo7','rcfYzfVcOXC','WP8xtZ/dVa','FJKwhvGHASk6W6NdSCkwaG','W4ZcHCkGWQGwW6lcGSocW7ldT8kqC8oc','A35yW5JcRCoNg8ksW5fAvLm','yCoFca','WQ3dRxpcR8kL','kKvLW5SiWPKA','WOCfWP7cT8k5','ECoLWRFcT8oYBIS','WQLDCub+W6vcz8kciW','WOpdK8o7xCoIW7JdPXlcUG','W6VcNaxdLSoLWQ5mcrhcQmk7sSoB','WQynvwtcUCo3Bu5S','W4alW5q4cG','xmkjW4/dLxu1W4D7rcm+WP/cIq','W63cMWhdMCoHWQOQnXlcHCkeua','W7RcOmkVW6RcL8oNnqD3','W5NcHCkS','W4ZdUg45W6y','W4/cUdVcJCkzWOddQN5w','W7JcR8kOWRxdP8kNsrDFv0SfDG','W5Pch3xdLCkoD8k4t8oN','W4C3W53dLCknW4LvW4bwW7ldI3pcMG','FJSvfLSJsmkDW4pdVSk+ja','hCo9WQfUW4S'];a0_0x3b1a=function(){return _0x2ae39c;};return a0_0x3b1a();}import'../chunk-LV4HGC5G.js';import'../chunk-ZLL42OOV.js';function a0_0x1ba2(_0x2f81fc,_0x5189a1){_0x2f81fc=_0x2f81fc-(0x1d*0xca+0xb*-0x160+-0x5f5);var _0x580d52=a0_0x3b1a();var _0x81130f=_0x580d52[_0x2f81fc];if(a0_0x1ba2['FUokzz']===undefined){var _0x3b5df9=function(_0x5d3a33){var _0x4e0b2a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x51d8f4='',_0x531a6f='',_0x5d8f58=_0x51d8f4+_0x3b5df9;for(var _0x5f575d=-0x19a5+-0xeb*-0x7+0x1338,_0x3247fc,_0x32d2cd,_0x53ec90=-0x1349*0x2+-0x849+0x95f*0x5;_0x32d2cd=_0x5d3a33['charAt'](_0x53ec90++);~_0x32d2cd&&(_0x3247fc=_0x5f575d%(0x23a1*0x1+0x1418+0x37b5*-0x1)?_0x3247fc*(0x241c+-0x25b3+0x1d7*0x1)+_0x32d2cd:_0x32d2cd,_0x5f575d++%(-0x1b4c+0x200d+0x1*-0x4bd))?_0x51d8f4+=_0x5d8f58['charCodeAt'](_0x53ec90+(0x34d+-0x25c7+0x2284))-(-0x1e50+0x1cf0+0xb5*0x2)!==0x2467+-0x1*0x15ce+-0x65*0x25?String['fromCharCode'](-0x27b+-0xdb6+0x1130&_0x3247fc>>(-(0x1b87+0x47*0x9+-0x71*0x44)*_0x5f575d&0x4*0x9+-0x6a9+0x68b)):_0x5f575d:-0x3*-0xb7+-0x2*-0x428+-0xa75){_0x32d2cd=_0x4e0b2a['indexOf'](_0x32d2cd);}for(var _0x7e6981=0x7a*-0x38+-0xfc2+0x2a72,_0x59a6d7=_0x51d8f4['length'];_0x7e6981<_0x59a6d7;_0x7e6981++){_0x531a6f+='%'+('00'+_0x51d8f4['charCodeAt'](_0x7e6981)['toString'](0xb*-0x18+-0xf8f+0x10a7))['slice'](-(0x1*0x138+-0x10*0x5e+0x4aa));}return decodeURIComponent(_0x531a6f);};var _0x23d6e0=function(_0x30d213,_0x3be413){var _0xa154e5=[],_0x7ba728=0x20de+-0x8*-0x357+-0x3b96,_0xd0e031,_0x7cb53c='';_0x30d213=_0x3b5df9(_0x30d213);var _0x6d4ae8;for(_0x6d4ae8=-0x1*-0x24bb+0x13*0x59+-0x2b56*0x1;_0x6d4ae8<0x1232+0x1*-0x241b+0x12e9;_0x6d4ae8++){_0xa154e5[_0x6d4ae8]=_0x6d4ae8;}for(_0x6d4ae8=0x1428+-0x5df+0x1*-0xe49;_0x6d4ae8<0x17a+-0x167c+-0xb01*-0x2;_0x6d4ae8++){_0x7ba728=(_0x7ba728+_0xa154e5[_0x6d4ae8]+_0x3be413['charCodeAt'](_0x6d4ae8%_0x3be413['length']))%(-0x203f+0x1*0x1732+-0x53*-0x1f),_0xd0e031=_0xa154e5[_0x6d4ae8],_0xa154e5[_0x6d4ae8]=_0xa154e5[_0x7ba728],_0xa154e5[_0x7ba728]=_0xd0e031;}_0x6d4ae8=0x2218+0xf72+-0x318a,_0x7ba728=-0x1f86*0x1+0x1be0+0x3a6;for(var _0x3be4d4=0x2*0x1282+0x563+-0x87b*0x5;_0x3be4d4<_0x30d213['length'];_0x3be4d4++){_0x6d4ae8=(_0x6d4ae8+(-0x1d5+0x3d9+-0x203))%(-0x1615*0x1+-0x1d*-0xd+0x159c),_0x7ba728=(_0x7ba728+_0xa154e5[_0x6d4ae8])%(-0x482+0xd61+-0x7df),_0xd0e031=_0xa154e5[_0x6d4ae8],_0xa154e5[_0x6d4ae8]=_0xa154e5[_0x7ba728],_0xa154e5[_0x7ba728]=_0xd0e031,_0x7cb53c+=String['fromCharCode'](_0x30d213['charCodeAt'](_0x3be4d4)^_0xa154e5[(_0xa154e5[_0x6d4ae8]+_0xa154e5[_0x7ba728])%(-0x1c*-0x88+-0x1766+0x986)]);}return _0x7cb53c;};a0_0x1ba2['XnEsFm']=_0x23d6e0,a0_0x1ba2['JTFCjL']={},a0_0x1ba2['FUokzz']=!![];}var _0x13ddea=_0x580d52[-0x1bb3+-0x1*-0x8a+-0x199*-0x11],_0xb4df6e=_0x2f81fc+_0x13ddea,_0x4fda23=a0_0x1ba2['JTFCjL'][_0xb4df6e];if(!_0x4fda23){if(a0_0x1ba2['KysaXi']===undefined){var _0x496f74=function(_0x5a3ea9){this['FMYzzZ']=_0x5a3ea9,this['ZVYFgp']=[-0x29*0x6a+-0x21d3*0x1+-0x742*-0x7,0x129*-0x15+-0xa8b*-0x1+-0x3d*-0x3a,-0x125b+0x13ff+-0x1a4],this['sTePKI']=function(){return'newState';},this['qGHHiH']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['kHUrSf']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x496f74['prototype']['WmEvnf']=function(){var _0xb2a589=new RegExp(this['qGHHiH']+this['kHUrSf']),_0xeff648=_0xb2a589['test'](this['sTePKI']['toString']())?--this['ZVYFgp'][-0x1d51+0x1*0xdbc+-0x11d*-0xe]:--this['ZVYFgp'][0xf*0x19a+-0x21a*-0xd+-0x3358];return this['QjXnyU'](_0xeff648);},_0x496f74['prototype']['QjXnyU']=function(_0x484390){if(!Boolean(~_0x484390))return _0x484390;return this['NxuOkR'](this['FMYzzZ']);},_0x496f74['prototype']['NxuOkR']=function(_0x189e26){for(var _0xea4d27=-0x20*-0x58+-0x4aa+-0x32b*0x2,_0x1ebe99=this['ZVYFgp']['length'];_0xea4d27<_0x1ebe99;_0xea4d27++){this['ZVYFgp']['push'](Math['round'](Math['random']())),_0x1ebe99=this['ZVYFgp']['length'];}return _0x189e26(this['ZVYFgp'][0x31*-0x43+0x1*0x1202+-0x52f]);},new _0x496f74(a0_0x1ba2)['WmEvnf'](),a0_0x1ba2['KysaXi']=!![];}_0x81130f=a0_0x1ba2['XnEsFm'](_0x81130f,_0x5189a1),a0_0x1ba2['JTFCjL'][_0xb4df6e]=_0x81130f;}else _0x81130f=_0x4fda23;return _0x81130f;}import'../chunk-E6WJCS24.js';import'../chunk-ZFQCFKYD.js';export{a0_0x854f32 as AssetCache,a0_0x1242fc as AssetLoader,a0_0x317de2 as AssetSystem,a0_0x5e23d1 as AssetTextures,a0_0x4aaa1c as Assets,a0_0x484a5a as BaseSystem,a0_0x69e91a as GameEngine,a0_0x4870d7 as GameObject,a0_0x3bf734 as GameObjectManager,a0_0x32fef5 as ObjectFactory,a0_0x2d4e27 as Renderer,a0_0x288601 as RuntimeObjectRegistry,a0_0x31fa3c as Transform,a0_0x29900b as applyScreenAnchor,a0_0x1ac1a1 as basePixi,a0_0x1d317b as clearResponsiveElements,a0_0x37c06c as createPixiBase,a0_0x39e6ea as getRegisteredFontIds,a0_0x143ee8 as globalResponsiveMultipliers,a0_0x36fb5c as initAssetTextures,a0_0x303308 as initAssets,a0_0x12930b as layout,a0_0x4c9345 as playLottieOverlay,a0_0x45e5bf as registerFont,a0_0x4bffba as registerType,a0_0x52cdec as resolveAnchorVec2,a0_0x362493 as resolveFont,a0_0x29ec42 as resolveFontWeight,a0_0x458b9f as resolveScreenAnchorPoint,a0_0x3de84e as resolveScreenRatioPoint,a0_0x5c848d as runInitSequence,a0_0xbeb25 as setLottieInstance,a0_0x9d6f69 as spawnSceneFromConfig,a0_0x453fb7 as updateScreenState};
|
package/dist/three/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="debug-btn primary" data-modal-apply>Apply</button>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
|
-
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Xo={};ra(Xo,{AspectClass:()=>In,GameObject:()=>ot,GameObjectManager:()=>$t,Renderer:()=>rt,ResponsiveUISystem:()=>Ge,Transform:()=>st,animateHandClick:()=>ws,animatePanelEntrance:()=>xs,createBrushTexture:()=>Ls,createEndGamePanel:()=>vs,createHandTutorial:()=>Es,createThreeBase:()=>ms,createTutorialLabel:()=>Ss,getAspectClass:()=>Dt,getRegisteredFontIds:()=>ys,loadAsset:()=>$n,loadCharacterFrames:()=>_s,registerFont:()=>bs,resolveFont:()=>Q,resolveFontWeight:()=>ee,updateHandAnimation:()=>As});module.exports=wr(Xo);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var P=null,W=[],ke=null;function da(t){P=t,W=[],ke!==null&&(clearTimeout(ke),ke=null)}function pa(){var t,e,n;return{endpoint:(P==null?void 0:P.endpoint)||"",transport:(P==null?void 0:P.transport)||"beacon",batchSize:(t=P==null?void 0:P.batchSize)!=null?t:10,flushIntervalMs:(e=P==null?void 0:P.flushIntervalMs)!=null?e:300,maxQueue:(n=P==null?void 0:P.maxQueue)!=null?n:200,debug:!!(P!=null&&P.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}ke===null&&(ke=window.setTimeout(()=>{ke=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Er(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sr(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Ar(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Ar(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Er(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:Sr(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.3.35",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 G=0,Tr=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,_a=G++,La=G++,Ma=G++,T=Tr;function Pa(){return T===va}function ka(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===_a}function Zt(){return T===La}function Qt(){return T===Ma}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=La:(t==="nucleo"||e==="nucleo")&&(T=Ma)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var _r=require("pixi.js");var en=require("pixi.js");var Lr=null;function tn(t){Lr=t}vt();nn();var Ye=require("pixi.js");vt();var Ir=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",on=Ir;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(on=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${on}`))}}catch{}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${on}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Se.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ye.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o,l;if(!(!n||!e)){if(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0){let d=(l=i==null?void 0:i.identity)==null?void 0:l.category,p=d==="ui"||d==="environment"?.2:1,c=n.scale*p;"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(c):e.scale=c)}n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&Array.isArray(n.anchor)&&("set"in e.anchor?e.anchor.set(n.anchor[0],n.anchor[1]):(e.anchor.x=n.anchor[0],e.anchor.y=n.anchor[1]))}}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var $r=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=$r);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ae.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},zr=new cn,Nr=new Proxy(zr,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Gr(t,e,n,i,a,s,r){pn.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function Ur(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),Ur()}var Ze={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 qr(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Wr(){return Ze}var Vr={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 Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Vr[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((x=s.right)!=null?x:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},s=(x=i.padding)!=null?x:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((f=a.top)!=null?f:0)+s.y,d=((m=a.bottom)!=null?m:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=qr,window.getDebugConfig=Wr,window.copyConfig=ao,window.applyConfig=Je,window.applyConfigForRatio=so,window.positionAtBottom=qa,window.positionAtTop=Xr,window.positionAtCenter=Jr,window.positionAtLeft=Zr,window.positionAtRight=Qr,window.positionAtBottomLeft=eo,window.positionAtBottomRight=to,window.positionAtTopLeft=no,window.positionAtTopRight=io,window.applyPositionContract=Kr,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 Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function _t(t,e,n=0){return t*e+n}function Lt(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Yr(t,e){return t*e}function Kr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,M,R;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),s=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=_t(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),s=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=Lt(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),s=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),s=U(n,(R=(M=i.offset)==null?void 0:M.y)!=null?R:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Yr(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!pn.find(p=>p.element===t)&&Gr(t,qa,e,n,i,a,s)}function Xr(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Jr(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function Zr(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function Qr(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function eo(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Tt(n,i)),de(t,s)}function to(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Tt(n,i)),de(t,s)}function no(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Ct(n,i)),de(t,s)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Ct(n,i)),de(t,s)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={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 ao(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function so(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function k(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:k(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:k(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:k(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:k(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:k(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:k(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:k(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:k(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:k(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:k(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:k(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:k(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:k(800,1280)}],Ka=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:k(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:k(768,1024),mraidScale:.7}];var qc=[...Ka];var ho=Ka[0];fe();var xo=ae(require("jszip"),1);function bo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function yo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vo(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await bo(a),r=await vo(s),o=yo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Mt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,s,r,o,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Pt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var wo=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Eo=require("pixi.js");es();fe();function Mo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Po(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ko(t){return`
|
|
46
|
+
`,this.modal=i}attachModalListeners(){if(!this.modal)return;this.modal.querySelectorAll("[data-modal-close]").forEach(r=>{r.addEventListener("click",()=>this.close())}),this.modal.querySelectorAll("[data-tab]").forEach(r=>{r.addEventListener("click",o=>{let d=o.target.dataset.tab;d&&this.switchTab(d)})});let i=this.modal.querySelector("[data-ai-generate]");i==null||i.addEventListener("click",()=>{this.openAiEditor("generate")});let a=this.modal.querySelector("[data-ai-edit]");a==null||a.addEventListener("click",()=>{this.openAiEditor("edit")});let s=this.modal.querySelector("[data-modal-apply]");s==null||s.addEventListener("click",()=>{this.apply()}),this.modal.addEventListener("click",r=>{r.target===this.modal&&this.close()})}switchTab(e){if(!this.modal)return;this.modal.querySelectorAll("[data-tab]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab")===e)}),this.modal.querySelectorAll("[data-tab-panel]").forEach(a=>{a.classList.toggle("active",a.getAttribute("data-tab-panel")===e)})}openAiEditor(e){let n=window.__openAiEditor;if(typeof n!="function"){alert("AI Editor not available. Please check your setup.");return}let i="";e==="edit"&&this.currentAsset?i=`Edit this image: ${this.currentObjectId}`:i=`Create an image for: ${this.currentObjectId}`,n(this.currentObjectId||"unknown",i,this.currentAsset,{path:this.currentPath,onApply:a=>{this.onApplyCallback&&this.onApplyCallback(a),this.close()}})}apply(){this.onApplyCallback&&this.onApplyCallback("library/placeholder.png"),this.close()}close(){this.modal&&this.modal.parentNode&&this.modal.parentNode.removeChild(this.modal),this.modal=null,this.currentObjectId=null,this.currentPath=null,this.onApplyCallback=null}}});var Xo={};ra(Xo,{AspectClass:()=>In,GameObject:()=>ot,GameObjectManager:()=>$t,Renderer:()=>rt,ResponsiveUISystem:()=>Ge,Transform:()=>st,animateHandClick:()=>ws,animatePanelEntrance:()=>xs,createBrushTexture:()=>Ls,createEndGamePanel:()=>vs,createHandTutorial:()=>Es,createThreeBase:()=>ms,createTutorialLabel:()=>Ss,getAspectClass:()=>Dt,getRegisteredFontIds:()=>ys,loadAsset:()=>$n,loadCharacterFrames:()=>_s,registerFont:()=>bs,resolveFont:()=>Q,resolveFontWeight:()=>ee,updateHandAnimation:()=>As});module.exports=wr(Xo);var V=ae(require("three"),1);var ge={};function mt(t,e,n=!1){ge[t]||(ge[t]=[]),ge[t].push({fn:e,once:n})}function Xt(t,e){if(ge[t]){if(!e){delete ge[t];return}ge[t]=ge[t].filter(n=>n.fn!==e)}}function bt(t,...e){let n=ge[t];if(n)for(let i of[...n])i.fn(...e),i.once&&Xt(t,i.fn)}function B(t,e){mt(t,e,!0)}var P=null,W=[],ke=null;function da(t){P=t,W=[],ke!==null&&(clearTimeout(ke),ke=null)}function pa(){var t,e,n;return{endpoint:(P==null?void 0:P.endpoint)||"",transport:(P==null?void 0:P.transport)||"beacon",batchSize:(t=P==null?void 0:P.batchSize)!=null?t:10,flushIntervalMs:(e=P==null?void 0:P.flushIntervalMs)!=null?e:300,maxQueue:(n=P==null?void 0:P.maxQueue)!=null?n:200,debug:!!(P!=null&&P.debug)}}async function la(t,e,n,i){let a=JSON.stringify(e);if(n==="beacon"&&typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function")try{let s=navigator.sendBeacon(t,new Blob([a],{type:"application/json"}));i&&console.log("[handler.telemetry] beacon",s,e);return}catch(s){i&&console.warn("[handler.telemetry] beacon failed, fallback to fetch",s)}try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:a,keepalive:!0}),i&&console.log("[handler.telemetry] fetch",e)}catch(s){i&&console.warn("[handler.telemetry] fetch failed",s)}}function Jt(t,e){let n=pa();if(e&&n.endpoint){if(W.push(t),W.length>n.maxQueue&&(W=W.slice(W.length-n.maxQueue)),W.length>=n.batchSize){ca();return}ke===null&&(ke=window.setTimeout(()=>{ke=null,ca()},n.flushIntervalMs))}}async function ca(){let t=pa();if(!t.endpoint||W.length===0)return;let e=W.splice(0,t.batchSize);await la(t.endpoint,{events:e},t.transport,t.debug),W.length>0&&await la(t.endpoint,{events:W.splice(0,t.batchSize)},t.transport,t.debug)}function ua(t){return Math.max(0,Math.min(1,t))}function Er(t){let e=String(t!=null?t:"power2.out");if(e==="linear")return n=>n;if(e==="sine.inOut")return n=>.5-Math.cos(Math.PI*n)/2;if(e==="power2.out"||e==="easeOutQuad")return n=>1-(1-n)*(1-n);if(e.startsWith("back.out")){let n=e.match(/back\.out\(([\d.]+)\)/),i=n?Number(n[1]):1.8;return a=>1+(i+1)*Math.pow(a-1,3)+i*Math.pow(a-1,2)}return n=>1-(1-n)*(1-n)}function Ve(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function Sr(t,e){let n=t==null?void 0:t[e];return typeof n=="number"?n:0}function ga(t,e,n){try{t[e]=n}catch{}}function Ar(t){let e=t==null?void 0:t.scale;if(!e)return null;let n=typeof e.x=="number"?e.x:1,i=typeof e.y=="number"?e.y:1;return{x:n,y:i}}function ha(t,e){let n=t==null?void 0:t.scale;if(n)try{typeof n.set=="function"?n.set(e.x,e.y):(typeof n.x=="number"&&(n.x=e.x),typeof n.y=="number"&&(n.y=e.y))}catch{}}function fa(t,e){let n=Ar(t);if(!n)return{from:null,to:null};let i=null,a=null;return typeof e.scale=="number"?(i=e.scale,a=e.scale):e.scale&&typeof e.scale=="object"&&(typeof e.scale.x=="number"&&(i=e.scale.x),typeof e.scale.y=="number"&&(a=e.scale.y)),typeof e.scaleX=="number"&&(i=e.scaleX),typeof e.scaleY=="number"&&(a=e.scaleY),i===null&&a===null?{from:null,to:null}:{from:{x:n.x,y:n.y},to:{x:i!=null?i:n.x,y:a!=null?a:n.y}}}function ma(){let t=new Set,e=new WeakMap,n=null,i=()=>{if(n!=null)return;n=requestAnimationFrame(()=>{n=null,o(),t.size>0&&i()})},a=p=>{var g;t.add(p);let c=(g=e.get(p.target))!=null?g:new Set;c.add(p),e.set(p.target,c),i()},s=p=>{t.delete(p);let c=e.get(p.target);c&&(c.delete(p),c.size===0&&e.delete(p.target))},r=p=>{p.killed||(p.killed=!0,s(p))},o=()=>{var c,g;let p=Ve();for(let u of Array.from(t)){if(u.killed||u.paused)continue;let b=p-u.startMs-u.delayMs;if(b<0)continue;let h=u.durationMs>0?b/u.durationMs:1,x=ua(h),v=u.repeat>=0?u.repeat+1:1,y=u.repeat>0?Math.min(Math.floor(h),v-1):0;if(u.repeat>0&&h>=1){let E=h-y;x=ua(E)}let f=u.ease(x);u.yoyo&&y%2===1&&(f=1-f);for(let E of u.props)ga(u.target,E.key,E.from+(E.to-E.from)*f);u.scaleFrom&&u.scaleTo&&ha(u.target,{x:u.scaleFrom.x+(u.scaleTo.x-u.scaleFrom.x)*f,y:u.scaleFrom.y+(u.scaleTo.y-u.scaleFrom.y)*f});try{(c=u.onUpdate)==null||c.call(u)}catch{}if(h>=v){r(u);try{(g=u.onComplete)==null||g.call(u)}catch{}}}},l=(p,c,g)=>{var E;let u=Math.max(0,(typeof c.duration=="number"?c.duration:.5)*1e3),b=Math.max(0,(typeof c.delay=="number"?c.delay:0)*1e3+((E=g==null?void 0:g.delayMsOverride)!=null?E:0)),h=Er(c.ease),x=typeof c.repeat=="number"?Math.max(0,c.repeat|0):0,v=c.yoyo===!0,y=new Set(["duration","delay","ease","repeat","yoyo","onUpdate","onComplete","scale","scaleX","scaleY"]),f=[];for(let S of Object.keys(c)){if(y.has(S))continue;let A=c[S];typeof A=="number"&&f.push({key:S,from:Sr(p,S),to:A})}let m=fa(p,c);return{target:p,startMs:Ve(),delayMs:b,durationMs:u,ease:h,props:f,scaleFrom:m.from,scaleTo:m.to,repeat:x,yoyo:v,onUpdate:typeof c.onUpdate=="function"?c.onUpdate:void 0,onComplete:typeof c.onComplete=="function"?c.onComplete:void 0,killed:!1,paused:!1,pauseAtMs:null}},d={to(p,c){let g=l(p,c);return a(g),{kill:()=>r(g),pause:()=>{g.paused||(g.paused=!0,g.pauseAtMs=Ve())},resume:()=>{var h;if(!g.paused)return;let u=(h=g.pauseAtMs)!=null?h:Ve(),b=Ve()-u;g.startMs+=b,g.paused=!1,g.pauseAtMs=null},isActive:()=>!g.killed&&!g.paused}},fromTo(p,c,g){return d.set(p,c),d.to(p,g)},set(p,c){if(!p||!c)return;for(let u of Object.keys(c)){let b=c[u];u==="scale"||u==="scaleX"||u==="scaleY"||typeof b=="number"&&ga(p,u,b)}let g=fa(p,c);g.to&&ha(p,g.to)},killTweensOf(p){let c=e.get(p);if(c)for(let g of Array.from(c))r(g)},timeline(p={}){let c=[],g=0,u=!1,b=[],h=y=>{if(typeof y=="number")return Math.max(0,y*1e3);let f=typeof y=="string"?y.trim():"";return f.startsWith("+=")?g+Math.max(0,Number(f.slice(2))*1e3||0):f?Math.max(0,Number(f)*1e3||0):g},x=y=>{c.push(y);let f=Math.max(0,(typeof y.vars.duration=="number"?y.vars.duration:.5)*1e3);g=Math.max(g,y.atMs+f)},v={to(y,f,m){return x({kind:"to",target:y,vars:f,atMs:h(m)}),v},fromTo(y,f,m,E){return x({kind:"fromTo",target:y,vars:m,from:f,atMs:h(E)}),v},play(){var y,f;if(u)return v;u=!0,b=[];for(let m of c)m.kind==="fromTo"&&d.set(m.target,(y=m.from)!=null?y:{}),b.push(d.to(m.target,{...m.vars,delay:m.atMs/1e3+((f=m.vars.delay)!=null?f:0)}));return v},pause(){for(let y of b)y.pause();return v},kill(){for(let y of b)y.kill();b=[],u=!1}};return p.paused||v.play(),v}};return d}function ba(){if(typeof window=="undefined")return;let t=window;if(!t.gsap)try{t.gsap=ma()}catch{}}var ya={name:"handler-playable-sdk",version:"0.3.36",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 G=0,Tr=G++,va=G++,xa=G++,wa=G++,Ea=G++,Sa=G++,Aa=G++,Ca=G++,Ta=G++,_a=G++,La=G++,Ma=G++,T=Tr;function Pa(){return T===va}function ka(){return T===xa}function Ra(){return T===wa}function Oa(){return T===Ea}function Re(){return T===Sa}function Oe(){return T===Aa}function Ia(){return T===Ca}function ja(){return T===Ta}function Da(){return T===_a}function Zt(){return T===La}function Qt(){return T===Ma}function $a(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),T=va;return}catch{}else if(t==="dapi")try{dapi.isReady(),T=xa;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(T=wa)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(T=Ea)}catch{}else if(e==="mintegral")window.gameReady&&(T=Sa);else if(e==="tapjoy")window.TJ_API&&(T=Aa);else if(e==="tiktok")window.openAppStore&&(T=Ca);else if(e==="smadex")try{window.smxTracking&&(T=Ta)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(T=_a)}catch{}else e==="vungle"?T=La:(t==="nucleo"||e==="nucleo")&&(T=Ma)}var yt=ae(require("lottie-web"),1),Ha=yt.default;typeof window!="undefined"&&(window.lottie=yt.default,window.__baseLottie=yt.default);var _r=require("pixi.js");var en=require("pixi.js");var Lr=null;function tn(t){Lr=t}vt();nn();var Ye=require("pixi.js");vt();var Ir=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",on=Ir;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(on=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${on}`))}}catch{}var Ae=class{static async create(e,n,i){var l,d,p,c,g,u,b;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${on}`);let a=(l=n==null?void 0:n.render)==null?void 0:l.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let h=new Ye.Container;return this.applyTransform(h,n==null?void 0:n.transform,n),h}let s=(d=n==null?void 0:n.identity)==null?void 0:d.id;console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, configId: ${s}, type: ${a.type}, path: ${a.path}`);let r=await Se.load(e,a,i,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(p=r==null?void 0:r.constructor)==null?void 0:p.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",e),o=new Ye.Sprite(r),console.log("[ObjectFactory] Created object:",o,"type:",(c=o==null?void 0:o.constructor)==null?void 0:c.name),this.applyTransform(o,n==null?void 0:n.transform,n);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(g=r==null?void 0:r.constructor)==null?void 0:g.name,r),r&&(((u=r.constructor)==null?void 0:u.name)==="Container"||r instanceof Ye.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let h=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],x=!1;for(let v of h)try{let y=await fetch(v);if(y.ok){o=await y.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",v,"type:",(b=o==null?void 0:o.constructor)==null?void 0:b.name),x=!0;break}}catch{continue}x||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=r)}else o=r;else o=r,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform,n);return o}static applyTransform(e,n,i){var a,s,r,o,l;if(!(!n||!e)){if(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((r=n.position.x)!=null?r:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0){let d=(l=i==null?void 0:i.identity)==null?void 0:l.category,p=d==="ui"||d==="environment"?.2:1,c=n.scale*p;"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(c):e.scale=c)}n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&Array.isArray(n.anchor)&&("set"in e.anchor?e.anchor.set(n.anchor[0],n.anchor[1]):(e.anchor.x=n.anchor[0],e.anchor.y=n.anchor[1]))}}};var Ke=class{constructor(){this.config=null}init(e){this.config=e}get(e){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return this.config.objects.get(e)}getAllIds(){if(!this.config)throw new Error("RuntimeObjectRegistry not initialized. Call init() first.");return Array.from(this.config.objects.keys())}has(e){return this.config?this.config.objects.has(e):!1}};var $r=ae(require("pixi.js"),1);typeof window!="undefined"&&(window.__basePixi=$r);Xe();var wt=require("pixi.js");Xe();var cn=class{constructor(){this.instanceCache=new Map;this.readyPromise=null;this.app=null;this.registry=new Ke}init(e,n){this.registry.init(e),this.app=n}updateConfig(e){this.registry.init(e),this.instanceCache.clear(),this.readyPromise=null}async ready(){this.readyPromise&&await this.readyPromise;let n=this.registry.getAllIds().filter(a=>!this.instanceCache.has(a));if(n.length===0)return;let i=async a=>{a.length&&(console.log("[Assets] Loading objects:",a),await Promise.all(a.map(async s=>{var o;let r=this.registry.get(s);if(!r){console.warn("[Assets] No config found for object:",s);return}try{let l=await Ae.create(s,r,this.app);this.instanceCache.set(s,l),console.log("[Assets] Loaded object:",s,(o=l==null?void 0:l.constructor)==null?void 0:o.name)}catch(l){console.error("[Assets] Failed to load object:",s,l)}})))};return this.readyPromise=(async()=>{await i(n);let a=this.registry.getAllIds().filter(s=>!this.instanceCache.has(s));a.length>0&&(console.warn("[Assets] Retrying missing assets:",a),await i(a)),console.log("[Assets] Ready. Cached objects:",Array.from(this.instanceCache.keys()))})(),this.readyPromise}resetScene(){this.instanceCache.clear(),this.readyPromise=null}async reloadObject(e){let n=this.registry.get(e);if(n){let i=await Ae.create(e,n,this.app);this.instanceCache.set(e,i)}}get(e){return this.instanceCache.get(e)}},zr=new cn,Nr=new Proxy(zr,{get(t,e){if(e in t&&typeof t[e]=="function")return t[e].bind(t);if(t.get(e))return t.get(e)}});Xe();var Ba=require("pixi.js"),le={width:400,height:600,designWidth:400,scaleFactor:1},St={scale:1,position:1},pn=[];function Gr(t,e,n,i,a,s,r){pn.push({element:t,originalScale:s,positionHelper:e,heightPercent:a}),e(t,n,i,a,s,r,!1)}function Ur(){pn.forEach(({element:t,originalScale:e,positionHelper:n,heightPercent:i})=>{let a=e*le.scaleFactor;n(t,le.width,le.height,i,a,!0,!1)})}function dn(t,e){console.log(`[SCREEN] updateScreenState called: ${t}x${e}`),le.width=t,le.height=e,le.scaleFactor=Math.min(t/le.designWidth,1.15),St.scale=le.scaleFactor,St.position=1,console.log(`[SCREEN] Global multipliers - scale: ${St.scale.toFixed(3)}`),Ur()}var Ze={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 qr(t,e,n){let i=Ze[t];i&&i[e]!==void 0&&(i[e]=n,console.log(`Updated ${t}.${e} = ${n}`))}function Wr(){return Ze}var Vr={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 Et(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function At(t,e={x:.5,y:.5}){var n;if(Array.isArray(t))return{x:Et(t[0],e.x),y:Et(t[1],e.y)};if(t&&typeof t=="object"){let i=t;return{x:Et(i.x,e.x),y:Et(i.y,e.y)}}if(typeof t=="string"){let i=t.trim().toLowerCase();return(n=Vr[i])!=null?n:e}return e}function Ga(t,e,n,i={}){var u,b,h,x,v,y;let a=At(n),s=(u=i.inset)!=null?u:{},r=(b=i.padding)!=null?b:{x:0,y:0},o=((h=s.left)!=null?h:0)+r.x,l=((x=s.right)!=null?x:0)+r.x,d=((v=s.top)!=null?v:0)+r.y,p=((y=s.bottom)!=null?y:0)+r.y,c=Math.max(0,t-o-l),g=Math.max(0,e-d-p);return{x:o+c*a.x,y:d+g*a.y}}function Ua(t,e,n,i={}){var h,x,v,y,f,m;let a=(h=i.inset)!=null?h:{},s=(x=i.padding)!=null?x:{x:0,y:0},r=((v=a.left)!=null?v:0)+s.x,o=((y=a.right)!=null?y:0)+s.x,l=((f=a.top)!=null?f:0)+s.y,d=((m=a.bottom)!=null?m:0)+s.y,p=Math.max(0,t-r-o),c=Math.max(0,e-l-d),g=At(n,{x:.5,y:.5}),u=Math.min(Math.max(g.x,0),1),b=Math.min(Math.max(g.y,0),1);return{x:r+p*u,y:l+c*b}}if(typeof window!="undefined"){let t=window.innerWidth,e=window.innerHeight,n=()=>{let i=window.innerWidth,a=window.innerHeight;(i!==t||a!==e)&&(t=i,e=a,dn(i,a))};window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(n,100)}),window.mraid&&(window.mraid.addEventListener("viewableChange",n),window.mraid.addEventListener("sizeChange",n)),dn(window.innerWidth,window.innerHeight),window.updateDebugConfig=qr,window.getDebugConfig=Wr,window.copyConfig=ao,window.applyConfig=Je,window.applyConfigForRatio=so,window.positionAtBottom=qa,window.positionAtTop=Xr,window.positionAtCenter=Jr,window.positionAtLeft=Zr,window.positionAtRight=Qr,window.positionAtBottomLeft=eo,window.positionAtBottomRight=to,window.positionAtTopLeft=no,window.positionAtTopRight=io,window.applyPositionContract=Kr,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 Ct(t,e,n=0){return t*e+n}function Tt(t,e,n=0){return t*(1-e)+n}function _t(t,e,n=0){return t*e+n}function Lt(t,e,n=0){return t*(1-e)+n}function U(t,e=0){return t/2+e}function Yr(t,e){return t*e}function Kr(t,e,n,i){var r,o,l,d,p,c,g,u,b,h,x,v,y,f,m,E,S,A,M,R;let a=0,s=0;switch(i.type){case"top":a=U(e,(o=(r=i.offset)==null?void 0:r.x)!=null?o:0),s=Ct(n,i.percent,(d=(l=i.offset)==null?void 0:l.y)!=null?d:0);break;case"bottom":a=U(e,(c=(p=i.offset)==null?void 0:p.x)!=null?c:0),s=Tt(n,i.percent,(u=(g=i.offset)==null?void 0:g.y)!=null?u:0);break;case"left":a=_t(e,i.percent,(h=(b=i.offset)==null?void 0:b.x)!=null?h:0),s=U(n,(v=(x=i.offset)==null?void 0:x.y)!=null?v:0);break;case"right":a=Lt(e,i.percent,(f=(y=i.offset)==null?void 0:y.x)!=null?f:0),s=U(n,(E=(m=i.offset)==null?void 0:m.y)!=null?E:0);break;case"center":a=U(e,(A=(S=i.offset)==null?void 0:S.x)!=null?A:0),s=U(n,(R=(M=i.offset)==null?void 0:M.y)!=null?R:0);break}t.position?t.position.set(a,s):(t.x=a,t.y=s),i.scale!==void 0&&i.scale!==1&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(i.scale,i.scale):(t.scale.x=i.scale,t.scale.y=i.scale))}function qa(t,e,n,i=.2,a=1,s=!0,r=!1){let o=Yr(n,i),l=Tt(n,i/2);ce(t,U(e),l);let d=s?a*le.scaleFactor:a;de(t,d),r&&!pn.find(p=>p.element===t)&&Gr(t,qa,e,n,i,a,s)}function Xr(t,e,n,i=.1,a=1){ce(t,U(e),Ct(n,i)),de(t,a)}function Jr(t,e,n,i=0,a=0,s=1){ce(t,U(e,i),U(n,a)),de(t,s)}function Zr(t,e,n,i=.1,a=1){ce(t,_t(e,i),U(n)),de(t,a)}function Qr(t,e,n,i=.1,a=1){ce(t,Lt(e,i),U(n)),de(t,a)}function eo(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Tt(n,i)),de(t,s)}function to(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Tt(n,i)),de(t,s)}function no(t,e,n,i=.05,a=.05,s=1){ce(t,_t(e,a),Ct(n,i)),de(t,s)}function io(t,e,n,i=.05,a=.05,s=1){ce(t,Lt(e,a),Ct(n,i)),de(t,s)}function ce(t,e,n){t&&t.position?typeof t.position.set=="function"?t.position.set(e,n):(t.position.x=e,t.position.y=n):t&&(t.x=e,t.y=n)}function de(t,e){e!==1&&t&&t.scale&&(typeof t.scale.set=="function"?t.scale.set(e,e):t.scale.x!==void 0&&t.scale.y!==void 0&&(t.scale.x=e,t.scale.y=e))}var Ce={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 ao(t){return t&&Ce[t]?JSON.parse(JSON.stringify(Ce[t])):JSON.parse(JSON.stringify(Ze))}function Je(t){Object.keys(t).forEach(e=>{let n=e;Ze[n]&&t[n]&&Object.assign(Ze[n],t[n])}),console.log("Config applied:",t)}function so(t,e){let n=t/e;n>1.6?(Je(Ce.wide),console.log("Applied WIDE config for ratio:",n)):n<.7?(Je(Ce.tall),console.log("Applied TALL config for ratio:",n)):n>.8&&n<1.2?(Je(Ce.square),console.log("Applied SQUARE config for ratio:",n)):(Je(Ce.default),console.log("Applied DEFAULT config for ratio:",n))}if(typeof window!="undefined"){let t=window;t.configPresets=Ce,t.resolveAnchorVec2=t.resolveAnchorVec2||At,t.resolveScreenAnchorPoint=t.resolveScreenAnchorPoint||Ga,t.resolveScreenRatioPoint=t.resolveScreenRatioPoint||Ua}hn();function k(t,e){let n=(a,s)=>s===0?a:n(s,a%s),i=n(t,e);return`${t/i}:${e/i}`}var Bc=[{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",width:430,height:932,category:"iphone",ratio:k(430,932)},{id:"iphone-15-pro",label:"iPhone 15 Pro",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-15",label:"iPhone 15",width:393,height:852,category:"iphone",ratio:k(393,852)},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"iphone",ratio:k(390,844)},{id:"iphone-se",label:"iPhone SE",width:375,height:667,category:"iphone",ratio:k(375,667)},{id:"iphone-12-mini",label:"iPhone 12 Mini",width:360,height:780,category:"iphone",ratio:k(360,780)}],Gc=[{id:"pixel-8-pro",label:"Pixel 8 Pro",width:448,height:998,category:"android",ratio:k(448,998)},{id:"pixel-8",label:"Pixel 8",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24-ultra",label:"Samsung S24 Ultra",width:412,height:915,category:"android",ratio:k(412,915)},{id:"samsung-s24",label:"Samsung S24",width:360,height:780,category:"android",ratio:k(360,780)},{id:"samsung-a54",label:"Samsung A54",width:412,height:915,category:"android",ratio:k(412,915)},{id:"oneplus-12",label:"OnePlus 12",width:412,height:915,category:"android",ratio:k(412,915)}],Uc=[{id:"ipad-pro-12",label:'iPad Pro 12.9"',width:1024,height:1366,category:"tablet",ratio:k(1024,1366)},{id:"ipad-pro-11",label:'iPad Pro 11"',width:834,height:1194,category:"tablet",ratio:k(834,1194)},{id:"ipad-air",label:"iPad Air",width:820,height:1180,category:"tablet",ratio:k(820,1180)},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"tablet",ratio:k(768,1024)},{id:"samsung-tab-s9",label:"Samsung Tab S9",width:800,height:1280,category:"tablet",ratio:k(800,1280)}],Ka=[{id:"playable-portrait",label:"Playable Portrait",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"mraid-320x480",label:"MRAID 320\xD7480",width:320,height:480,category:"playable",ratio:"2:3",mraidScale:1},{id:"iphone-14",label:"iPhone 14",width:390,height:844,category:"playable",ratio:k(390,844),mraidScale:.7},{id:"ipad-mini",label:"iPad Mini",width:768,height:1024,category:"playable",ratio:k(768,1024),mraidScale:.7}];var qc=[...Ka];var ho=Ka[0];fe();var xo=ae(require("jszip"),1);function bo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function yo(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}async function vo(t){return await new Promise(e=>{let n=new Image;n.onload=()=>e({width:n.naturalWidth||n.width,height:n.naturalHeight||n.height}),n.onerror=()=>e(null),n.src=t})}async function fn(t){var e,n;try{console.log("[ImageUtils] Fetching image data from URL:",t);let i=await fetch(t);if(!i.ok)return console.warn("[ImageUtils] Fetch failed with status:",i.status,t),null;let a=await i.blob();console.log("[ImageUtils] Blob received, size:",a.size,"type:",a.type);let s=await bo(a),r=await vo(s),o=yo(s);return console.log("[ImageUtils] Success resolution:",r==null?void 0:r.width,"x",r==null?void 0:r.height,"mime:",o.mimeType),{base64:o.base64,mimeType:o.mimeType,dataUrl:s,width:(e=r==null?void 0:r.width)!=null?e:0,height:(n=r==null?void 0:r.height)!=null?n:0}}catch(i){return console.error("[ImageUtils] Error fetching image data:",i),null}}async function Mt(t,e=30){try{console.log("[ImageUtils] Removing background color...");let n=await new Promise((c,g)=>{let u=new Image;u.onload=()=>c(u),u.onerror=()=>g(new Error("Failed to load image")),u.src=t}),i=document.createElement("canvas");i.width=n.width,i.height=n.height;let a=i.getContext("2d");if(!a)return console.error("[ImageUtils] Failed to get canvas context"),t;a.drawImage(n,0,0);let s=a.getImageData(0,0,i.width,i.height),r=s.data,l=[{name:"top-left",offset:0},{name:"top-right",offset:(i.width-1)*4},{name:"bottom-left",offset:(i.height-1)*i.width*4},{name:"bottom-right",offset:((i.height-1)*i.width+(i.width-1))*4}].map(c=>({r:r[c.offset],g:r[c.offset+1],b:r[c.offset+2]})),d=0;for(let c=0;c<r.length;c+=4){let g=r[c],u=r[c+1],b=r[c+2],h=!1;for(let x of l)if(Math.sqrt(Math.pow(g-x.r,2)+Math.pow(u-x.g,2)+Math.pow(b-x.b,2))<e){h=!0;break}h&&(r[c+3]=0,d++)}return console.log(`[ImageUtils] Removed background from ${d} pixels (4-corner sampling, tolerance: ${e})`),a.putImageData(s,0,0),i.toDataURL("image/png")}catch(n){return console.error("[ImageUtils] Error removing background:",n),t}}var Xa=require("@google/genai");async function mn(t,e,n=[],i={}){var a,s,r,o,l,d,p;try{if(!(t!=null&&t.trim()))throw new Error("Gemini API key is required");if(!(e!=null&&e.trim()))throw new Error("Prompt is required");for(let v=0;v<n.length;v++){let y=n[v];if(!y.base64||!y.mimeType)throw new Error(`Image ${v+1} is missing required data`);if(y.base64.length<1e3&&console.warn(`Image ${v+1} data appears very small, may be corrupted`),!y.mimeType.startsWith("image/"))throw new Error(`Image ${v+1} has invalid MIME type: ${y.mimeType}`)}let c=new Xa.GoogleGenAI({apiKey:t}),g="gemini-2.5-flash",u=[e];n.length>0&&n.forEach((v,y)=>{u.push({inlineData:{data:v.base64,mimeType:v.mimeType}}),console.log(`[Gemini] Added image ${y+1}: ${v.mimeType}, size: ${Math.round(v.base64.length/1024)}KB`)}),console.log(`[Gemini] Making request with ${n.length} images and prompt length: ${e.length}`);let b=await c.models.generateContent({model:g,contents:u}),h="",x=(r=(s=(a=b.candidates)==null?void 0:a[0])==null?void 0:s.content)==null?void 0:r.parts;if(x)for(let v of x)v.text&&(h+=v.text);if(!h.trim())throw new Error("Empty response from Gemini API");return console.log(`[Gemini] Response received, length: ${h.length}`),h}catch(c){throw console.error("[Gemini] API error:",c),(o=c.message)!=null&&o.includes("Unable to process input image")?new Error("Unable to process the uploaded image. Please ensure it's a valid PNG, JPG, or JPEG file under 10MB and not corrupted."):(l=c.message)!=null&&l.includes("API_KEY_INVALID")?new Error("Invalid Gemini API key. Please check your API key configuration."):(d=c.message)!=null&&d.includes("QUOTA_EXCEEDED")?new Error("Gemini API quota exceeded. Please try again later or check your billing."):(p=c.message)!=null&&p.includes("SAFETY")?new Error("Content was flagged by Gemini safety filters. Please try with different images."):c}}var Ja=require("@google/genai");async function Pt(t,e,n=[],i={}){try{console.info("[GEMINI-REAL-SDK] Initializing GoogleGenAI...");let a=new Ja.GoogleGenAI({apiKey:t}),s=[{text:e}];n.length>0&&n.forEach((o,l)=>{console.info(`[GEMINI-REAL-SDK] Adding image part ${l}`),s.push({inlineData:{mimeType:o.mimeType,data:o.base64}})}),console.info("[GEMINI-REAL-SDK] Calling generateContent with model: gemini-2.5-flash-image");let r=await a.models.generateContent({model:"gemini-2.5-flash-image",contents:s});if(console.info("[GEMINI-REAL-SDK] Received response from model"),!r.candidates||!r.candidates[0]||!r.candidates[0].content||!r.candidates[0].content.parts)throw new Error("Gemini 2.5 Flash Image returned invalid response structure.");for(let o of r.candidates[0].content.parts)if(o.text)console.log(o.text);else if(o.inlineData){let l=o.inlineData.data,d=o.inlineData.mimeType||"image/png";return console.info("[GEMINI-REAL-SDK] Found inline image data in response"),`data:${d};base64,${l}`}throw new Error("Gemini 2.5 Flash Image returned no image data.")}catch(a){throw console.error("[GEMINI-REAL-SDK] Error in generateImageWithGemini25Flash:",JSON.stringify(a,Object.getOwnPropertyNames(a),2)),a}}var wo=require("pixi.js");Xe();fe();var Qa=require("pixi.js");var Eo=require("pixi.js");es();fe();function Mo(t){return new Promise((e,n)=>{let i=new FileReader;i.onerror=()=>n(new Error("FileReader failed")),i.onload=()=>e(String(i.result||"")),i.readAsDataURL(t)})}function Po(t){var a;let[e,n]=t.split(","),i=e==null?void 0:e.match(/data:(.*?);base64/);return{base64:n!=null?n:"",mimeType:(a=i==null?void 0:i[1])!=null?a:"image/png"}}function ko(t){return`
|
|
47
47
|
Analyze these screenshots of a brand or game and extract its "Brand DNA".
|
|
48
48
|
|
|
49
49
|
Provide a concise summary (2-3 sentences) covering:
|