handler-playable-sdk 0.2.4 → 0.2.7

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.
@@ -1,4 +1,4 @@
1
- "use strict";var $e=Object.defineProperty;var Za=Object.getOwnPropertyDescriptor;var Ua=Object.getOwnPropertyNames;var ei=Object.prototype.hasOwnProperty;var ti=(e,t)=>{for(var n in t)$e(e,n,{get:t[n],enumerable:!0})},ni=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ua(t))!ei.call(e,i)&&i!==n&&$e(e,i,{get:()=>t[i],enumerable:!(a=Za(t,i))||a.enumerable});return e};var ai=e=>ni($e({},"__esModule",{value:!0}),e);var Ci={};ti(Ci,{GameObject:()=>Se,GameObjectManager:()=>je,Renderer:()=>Ae,Transform:()=>Ce,animateHandClick:()=>sa,animatePanelEntrance:()=>ia,createBrushTexture:()=>fa,createEndGamePanel:()=>aa,createHandTutorial:()=>oa,createPixiBase:()=>ea,createTutorialLabel:()=>ra,getRegisteredFontIds:()=>na,loadAsset:()=>ua,loadCharacterFrames:()=>pa,registerFont:()=>ta,resolveFont:()=>I,resolveFontWeight:()=>G,updateHandAnimation:()=>la});module.exports=ai(Ci);var Un=require("pixi.js");var ee={};function Le(e,t,n=!1){ee[e]||(ee[e]=[]),ee[e].push({fn:t,once:n})}function Ke(e,t){if(ee[e]){if(!t){delete ee[e];return}ee[e]=ee[e].filter(n=>n.fn!==t)}}function ze(e,...t){let n=ee[e];if(n)for(let a of[...n])a.fn(...t),a.once&&Ke(e,a.fn)}function H(e,t){Le(e,t,!0)}var He={name:"handler-playable-sdk",version:"0.2.4",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","pixi.js":"^8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var O=0,si=O++,An=O++,Sn=O++,En=O++,kn=O++,Pn=O++,Dn=O++,Fn=O++,Mn=O++,Rn=O++,Ln=O++,zn=O++,_=si;function Hn(){return _===An}function On(){return _===Sn}function Wn(){return _===En}function Yn(){return _===kn}function de(){return _===Pn}function ue(){return _===Dn}function Nn(){return _===Fn}function Bn(){return _===Mn}function jn(){return _===Rn}function Je(){return _===Ln}function Qe(){return _===zn}function In(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),_=An;return}catch{}else if(e==="dapi")try{dapi.isReady(),_=Sn;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(_=En)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(_=kn)}catch{}else if(t==="mintegral")window.gameReady&&(_=Pn);else if(t==="tapjoy")window.TJ_API&&(_=Dn);else if(t==="tiktok")window.openAppStore&&(_=Fn);else if(t==="smadex")try{window.smxTracking&&(_=Mn)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(_=Rn)}catch{}else t==="vungle"?_=Ln:(e==="nucleo"||t==="nucleo")&&(_=zn)}var Kn={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},oi=Math.random().toString(36).slice(2),pe=null,be={...Kn},Jn="web_embed",ri={},Ze=!1,_e=!1,xe=!1,Qn=!1,nt=1,et=0,Ne=!1,J=!1,Ye="",fe=Math.floor(window.innerWidth),me=Math.floor(window.innerHeight),tt=fe>me,Q=!1,we=!1,Gn=!1,Vn=!1,Ue=!1,Oe=null;function qn(){if(pe)return pe;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),pe=e,e}function We(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Zn(e,t){return{event_name:e,ts:Date.now(),session_id:oi,deployment_id:be.deployment_id,variant_id:be.variant_id,export_profile_id:be.profile_id,instance_id:be.instance_id||"default",env:Jn==="mraid"?"mraid":"web",payload:t}}function y(e,t){let n=We(e),a=Zn(n,t);ze(n,a),n!==e&&ze(e,a)}function Te(){Oe&&(Oe(fe,me),Oe=null)}function he(e){nt=e,y("volume",e)}function ye(e){e&&(Qn=!0),!xe&&(xe=!0,y("pause"),he(0))}function ve(e){!e&&Qn||xe&&(xe=!1,y("resume"),he(nt))}function ne(e,t){fe=Math.floor(e||window.innerWidth),me=Math.floor(t||window.innerHeight),tt=fe>me,y("resize",{width:fe,height:me})}function li(){if(Hn())try{let e=mraid.getMaxSize();ne(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?ve():ye()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();ne(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();he(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&he(n>0?1:0)}),mraid.addEventListener("error",(n,a)=>{console.warn("mraid error:",n,"action:",a)}),Ne=!0,mraid.isViewable()&&mraid.getState()!=="hidden")Q=!0,y("boot"),y("view"),y("ready"),J=!0,Te();else{let n=()=>{Q=!0,y("boot"),y("view"),y("ready"),J=!0,Te()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function ci(){if(On())try{let e=dapi.getScreenSize();ne(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?ve():ye()}),dapi.addEventListener("adResized",n=>{let a=dapi.getScreenSize();ne(n.width||a.width,n.height||a.height)});let t=dapi.getAudioVolume();if(he(t?1:0),dapi.addEventListener("audioVolumeChange",n=>he(n?1:0)),Ne=!0,dapi.isViewable())Q=!0,y("boot"),y("view"),y("ready"),J=!0,Te();else{let n=()=>{Q=!0,y("boot"),y("view"),y("ready"),J=!0,Te()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function Xn(){let e=()=>{Q||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(Q=!0,y("boot"),y("view"),y("ready"),J=!0,Te(),we&&(we=!1,te.start()))};window.addEventListener("resize",()=>ne()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(ve(),e()):ye()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),Ne=!0}function di(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(Gn=!0),!(Gn&&t instanceof MouseEvent)&&(et+=1,y("interaction",et))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function ui(e){var a,i,s,o,r,l,d,p,f,u,c,h;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(a=window.ExitApi)==null||a.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(ue())(s=(i=window.TJ_API)==null?void 0:i.click)==null||s.call(i);else if(Wn())(r=(o=window.FbPlayableAd)==null?void 0:o.onCTAClick)==null||r.call(o);else if(jn())(d=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||d.call(l);else if(Bn())try{(f=(p=window.smxTracking)==null?void 0:p.redirect)==null||f.call(p)}catch(m){console.warn("Smadex redirect failed",m)}else if(Yn()){let m=window.ExitApi;m&&typeof m.exit=="function"?m.exit(e||Ye||""):e&&window.open(e)}else de()?(u=window.install)==null||u.call(window):Nn()?(c=window.openAppStore)==null||c.call(window):Je()?(h=parent==null?void 0:parent.postMessage)==null||h.call(parent,"download","*"):e&&window.open(e)}function pi(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let a=new Image;a.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;H("view",()=>t(n.mraid_viewable)),H("start",()=>t(n.game_viewable)),H("engagement",()=>t(n.engagement));let a=()=>t(n.complete);H("complete",a),Le("engagement",i=>{var s;((s=i==null?void 0:i.payload)==null?void 0:s.count)>3&&a()}),H("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;H("view",()=>t(n.Ad_Load_Start)),H("start",()=>t(n.Ad_Viewable)),H("engagement",()=>t(n.First_Engagement)),H("complete",()=>t(n.Gameplay_Complete)),H("cta_click",()=>t(n.DSP_Click)),H("start",()=>{[5,10,15,20,25,30].forEach(a=>setTimeout(()=>t(n[`Spent_${a}_Seconds`]),a*1e3))})}}function fi(){if(!ue())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{te.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function $n(){var t,n,a;let e=window.TJ_API;(t=e==null?void 0:e.objectiveComplete)==null||t.call(e),(n=e==null?void 0:e.playableFinished)==null||n.call(e),(a=e==null?void 0:e.gameplayFinished)==null||a.call(e)}function mi(){de()&&(window.mintGameStart=()=>{ve(!0),ne()},window.mintGameClose=()=>{ye(!0)})}function hi(){if(!Qe())return;let e=window.NUC;!e||!e.trigger||(te.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,Ye)}),te.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var te={init(e={},t){if(Jn=e.profile||"web_embed",ri=e.consent||{},be={...Kn,...e.ids||{}},pe=e.rootEl||pe,Ye=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(Oe=t),y("init"),document.body.oncontextmenu=()=>!1,qn(),yi(pe),In(),li(),ci(),!Ne){if(document.readyState==="complete")Xn();else if(!Vn){Vn=!0;let n=()=>{Xn(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}di(),pi(),fi(),mi(),hi(),console.log(`%c @handler/playable-sdk %c v${He.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),Q&&!J&&(y("boot"),y("view"),y("ready"),we&&(we=!1,te.start()),J=!0),J=Q},getRoot(){return qn()},get version(){return He.version||"0.0.0"},get maxWidth(){return fe},get maxHeight(){return me},get isLandscape(){return tt},get isReady(){return J},get isStarted(){return Ze},get isPaused(){return xe},get isFinished(){return _e},get volume(){return nt},get interactions(){return et},on(e,t){Le(We(e),t)},off(e,t){Ke(We(e),t)},start(){var e,t;if(!Ze){if(!Q){we=!0;return}if(Ze=!0,y("start"),ne(),de())ye(),(e=window.gameReady)==null||e.call(window);else if(ue()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:tt?"landscape":"portrait",buildID:He.version||"dev"})}}},finish(){var e,t;_e||(_e=!0,y("complete"),de()?(e=window.gameEnd)==null||e.call(window):Je()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):ue()&&$n())},install(e){if(!_e){_e=!0,ue()?($n(),setTimeout(()=>te.install(e),300)):(y("complete"),setTimeout(()=>te.install(e),0));return}Ue||(Ue=!0,setTimeout(()=>Ue=!1,500),y("cta_click"),y("conversion"),ui(e||Ye))},emit(e,t){let n=We(e);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${e} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let a=Zn(n,t);ze(n,a)},retry(){var e,t,n;if(de())(e=window.gameRetry)==null||e.call(window);else if(Qe()){let a=window.NUC;(n=(t=a==null?void 0:a.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}y("engagement",{action:"retry"})},pause(){ye(!0)},resume(){ve(!0)},resize(e,t){ne(e,t)}},Be=te;function yi(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
1
+ "use strict";var nt=Object.defineProperty;var ai=Object.getOwnPropertyDescriptor;var ii=Object.getOwnPropertyNames;var si=Object.prototype.hasOwnProperty;var oi=(t,e)=>{for(var n in e)nt(t,n,{get:e[n],enumerable:!0})},ri=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ii(e))!si.call(t,s)&&s!==n&&nt(t,s,{get:()=>e[s],enumerable:!(a=ai(e,s))||a.enumerable});return t};var li=t=>ri(nt({},"__esModule",{value:!0}),t);var Pi={};oi(Pi,{AssetCache:()=>X,AssetLoader:()=>we,GameObject:()=>De,GameObjectManager:()=>Xe,ObjectFactory:()=>Qe,Renderer:()=>Me,Transform:()=>Le,animateHandClick:()=>fa,animatePanelEntrance:()=>pa,createEndGamePanel:()=>ua,createHandTutorial:()=>ha,createPixiBase:()=>la,createTutorialLabel:()=>ma,getRegisteredFontIds:()=>da,playLottieOverlay:()=>_a,registerFont:()=>ca,registerType:()=>je,resolveFont:()=>V,resolveFontWeight:()=>q,setLottieInstance:()=>ga,updateHandAnimation:()=>ya});module.exports=li(Pi);var ra=require("pixi.js");var ne={};function ze(t,e,n=!1){ne[t]||(ne[t]=[]),ne[t].push({fn:e,once:n})}function at(t,e){if(ne[t]){if(!e){delete ne[t];return}ne[t]=ne[t].filter(n=>n.fn!==e)}}function He(t,...e){let n=ne[t];if(n)for(let a of[...n])a.fn(...e),a.once&&at(t,a.fn)}function z(t,e){ze(t,e,!0)}var We={name:"handler-playable-sdk",version:"0.2.7",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var H=0,di=H++,kn=H++,Fn=H++,In=H++,Rn=H++,Nn=H++,Bn=H++,$n=H++,zn=H++,Hn=H++,Wn=H++,Yn=H++,_=di;function Gn(){return _===kn}function Jn(){return _===Fn}function Vn(){return _===In}function qn(){return _===Rn}function ue(){return _===Nn}function pe(){return _===Bn}function Xn(){return _===$n}function Un(){return _===zn}function Kn(){return _===Hn}function it(){return _===Wn}function st(){return _===Yn}function jn(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),_=kn;return}catch{}else if(t==="dapi")try{dapi.isReady(),_=Fn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(_=In)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(_=Rn)}catch{}else if(e==="mintegral")window.gameReady&&(_=Nn);else if(e==="tapjoy")window.TJ_API&&(_=Bn);else if(e==="tiktok")window.openAppStore&&(_=$n);else if(e==="smadex")try{window.smxTracking&&(_=zn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(_=Hn)}catch{}else e==="vungle"?_=Wn:(t==="nucleo"||e==="nucleo")&&(_=Yn)}var aa={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},ui=Math.random().toString(36).slice(2),fe=null,Se={...aa},ia="web_embed",pi={},ot=!1,xe=!1,Ae=!1,sa=!1,dt=1,lt=0,Ve=!1,Q=!1,Je="",he=Math.floor(window.innerWidth),me=Math.floor(window.innerHeight),ct=he>me,Z=!1,Te=!1,Qn=!1,Zn=!1,rt=!1,Ye=null;function ea(){if(fe)return fe;let t=document.createElement("div");return t.id="handler-root",t.setAttribute("data-handler-root","true"),document.body.appendChild(t),fe=t,t}function Ge(t){switch(t){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return t}}function oa(t,e){return{event_name:t,ts:Date.now(),session_id:ui,deployment_id:Se.deployment_id,variant_id:Se.variant_id,export_profile_id:Se.profile_id,instance_id:Se.instance_id||"default",env:ia==="mraid"?"mraid":"web",payload:e}}function y(t,e){let n=Ge(t),a=oa(n,e);He(n,a),n!==t&&He(t,a)}function ve(){Ye&&(Ye(he,me),Ye=null)}function ye(t){dt=t,y("volume",t)}function ge(t){t&&(sa=!0),!Ae&&(Ae=!0,y("pause"),ye(0))}function Ee(t){!t&&sa||Ae&&(Ae=!1,y("resume"),ye(dt))}function ie(t,e){he=Math.floor(t||window.innerWidth),me=Math.floor(e||window.innerHeight),ct=he>me,y("resize",{width:he,height:me})}function fi(){if(Gn())try{let t=mraid.getMaxSize();ie(t.width,t.height);let e=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Ee():ge()};if(mraid.addEventListener("viewableChange",e),mraid.addEventListener("stateChange",e),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();ie(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();ye(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&ye(n>0?1:0)}),mraid.addEventListener("error",(n,a)=>{console.warn("mraid error:",n,"action:",a)}),Ve=!0,mraid.isViewable()&&mraid.getState()!=="hidden")Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve();else{let n=()=>{Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve()};mraid.addEventListener("ready",n)}}catch(t){console.warn("MRAID hook skipped",t)}}function hi(){if(Jn())try{let t=dapi.getScreenSize();ie(t.width,t.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Ee():ge()}),dapi.addEventListener("adResized",n=>{let a=dapi.getScreenSize();ie(n.width||a.width,n.height||a.height)});let e=dapi.getAudioVolume();if(ye(e?1:0),dapi.addEventListener("audioVolumeChange",n=>ye(n?1:0)),Ve=!0,dapi.isViewable())Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve();else{let n=()=>{Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve()};dapi.addEventListener("ready",n)}}catch(t){console.warn("DAPI hook skipped",t)}}function ta(){let t=()=>{Z||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve(),Te&&(Te=!1,ae.start()))};window.addEventListener("resize",()=>ie()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Ee(),t()):ge()}),document.readyState==="complete"||document.readyState==="interactive"?t():window.addEventListener("load",t),Ve=!0}function mi(){let t=e=>{typeof TouchEvent!="undefined"&&e instanceof TouchEvent&&(Qn=!0),!(Qn&&e instanceof MouseEvent)&&(lt+=1,y("interaction",lt))};document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)}function yi(t){var a,s,i,o,r,c,l,p,f,u,d,m;let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(a=window.ExitApi)==null||a.exit();return}catch{}if(e==="mraid"&&typeof mraid!="undefined")mraid.open(t||"");else if(e==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(pe())(i=(s=window.TJ_API)==null?void 0:s.click)==null||i.call(s);else if(Vn())(r=(o=window.FbPlayableAd)==null?void 0:o.onCTAClick)==null||r.call(o);else if(Kn())(l=(c=window.ScPlayableAd)==null?void 0:c.onCTAClick)==null||l.call(c);else if(Un())try{(f=(p=window.smxTracking)==null?void 0:p.redirect)==null||f.call(p)}catch(h){console.warn("Smadex redirect failed",h)}else if(qn()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(t||Je||""):t&&window.open(t)}else ue()?(u=window.install)==null||u.call(window):Xn()?(d=window.openAppStore)==null||d.call(window):it()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):t&&window.open(t)}function gi(){let t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",e=n=>{if(!n)return;let a=new Image;a.src=n};if(t==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;z("view",()=>e(n.mraid_viewable)),z("start",()=>e(n.game_viewable)),z("engagement",()=>e(n.engagement));let a=()=>e(n.complete);z("complete",a),ze("engagement",s=>{var i;((i=s==null?void 0:s.payload)==null?void 0:i.count)>3&&a()}),z("cta_click",()=>e(n.click))}else if(t==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;z("view",()=>e(n.Ad_Load_Start)),z("start",()=>e(n.Ad_Viewable)),z("engagement",()=>e(n.First_Engagement)),z("complete",()=>e(n.Gameplay_Complete)),z("cta_click",()=>e(n.DSP_Click)),z("start",()=>{[5,10,15,20,25,30].forEach(a=>setTimeout(()=>e(n[`Spent_${a}_Seconds`]),a*1e3))})}}function _i(){if(!pe())return;let t=window.TJ_API;t&&t.setPlayableAPI&&t.setPlayableAPI({skipAd:()=>{try{ae.finish()}catch(e){console.warn("Tapjoy skip failed",e)}}})}function na(){var e,n,a;let t=window.TJ_API;(e=t==null?void 0:t.objectiveComplete)==null||e.call(t),(n=t==null?void 0:t.playableFinished)==null||n.call(t),(a=t==null?void 0:t.gameplayFinished)==null||a.call(t)}function wi(){ue()&&(window.mintGameStart=()=>{Ee(!0),ie()},window.mintGameClose=()=>{ge(!0)})}function bi(){if(!st())return;let t=window.NUC;!t||!t.trigger||(ae.on("cta_click",()=>{var e,n;return(n=(e=t.trigger).convert)==null?void 0:n.call(e,Je)}),ae.on("complete",()=>{var e,n;return(n=(e=t.trigger).tryAgain)==null?void 0:n.call(e)}))}var ae={init(t={},e){if(ia=t.profile||"web_embed",pi=t.consent||{},Se={...aa,...t.ids||{}},fe=t.rootEl||fe,Je=t.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),e&&(Ye=e),y("init"),document.body.oncontextmenu=()=>!1,ea(),xi(fe),jn(),fi(),hi(),!Ve){if(document.readyState==="complete")ta();else if(!Zn){Zn=!0;let n=()=>{ta(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}mi(),gi(),_i(),wi(),bi(),console.log(`%c @handler/playable-sdk %c v${We.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),Z&&!Q&&(y("boot"),y("view"),y("ready"),Te&&(Te=!1,ae.start()),Q=!0),Q=Z},getRoot(){return ea()},get version(){return We.version||"0.0.0"},get maxWidth(){return he},get maxHeight(){return me},get isLandscape(){return ct},get isReady(){return Q},get isStarted(){return ot},get isPaused(){return Ae},get isFinished(){return xe},get volume(){return dt},get interactions(){return lt},on(t,e){ze(Ge(t),e)},off(t,e){at(Ge(t),e)},start(){var t,e;if(!ot){if(!Z){Te=!0;return}if(ot=!0,y("start"),ie(),ue())ge(),(t=window.gameReady)==null||t.call(window);else if(pe()){let n=window.TJ_API;(e=n==null?void 0:n.setPlayableBuild)==null||e.call(n,{orientation:ct?"landscape":"portrait",buildID:We.version||"dev"})}}},finish(){var t,e;xe||(xe=!0,y("complete"),ue()?(t=window.gameEnd)==null||t.call(window):it()?(e=parent==null?void 0:parent.postMessage)==null||e.call(parent,"complete","*"):pe()&&na())},install(t){if(!xe){xe=!0,pe()?(na(),setTimeout(()=>ae.install(t),300)):(y("complete"),setTimeout(()=>ae.install(t),0));return}rt||(rt=!0,setTimeout(()=>rt=!1,500),y("cta_click"),y("conversion"),yi(t||Je))},emit(t,e){let n=Ge(t);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${t} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let a=oa(n,e);He(n,a)},retry(){var t,e,n;if(ue())(t=window.gameRetry)==null||t.call(window);else if(st()){let a=window.NUC;(n=(e=a==null?void 0:a.trigger)==null?void 0:e.tryAgain)==null||n.call(e)}y("engagement",{action:"retry"})},pause(){ge(!0)},resume(){Ee(!0)},resize(t,e){ie(t,e)}},qe=ae;function xi(t){let e=document.createElement("script");e.type="text/javascript",e.textContent=`
2
2
  (function(){
3
3
  var events = ['touchstart','touchend','mousedown','keydown'];
4
4
  function unlock(){
@@ -14,4 +14,14 @@
14
14
  }
15
15
  events.forEach(function(e){ document.addEventListener(e, unlock, false); });
16
16
  })();
17
- `,e.appendChild(t)}async function ea(e,t={}){let n=new Un.Application;await n.init({resizeTo:e,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let a=s=>{var l,d,p,f,u,c;let o=(p=(d=(l=s==null?void 0:s.width)!=null?l:e.clientWidth)!=null?d:window.innerWidth)!=null?p:320,r=(c=(u=(f=s==null?void 0:s.height)!=null?f:e.clientHeight)!=null?u:window.innerHeight)!=null?c:480;n.renderer.resize(o,r)};e.innerHTML="",e.style.position="relative",e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="stretch",e.style.width="100%",e.style.height="100dvh",e.style.minHeight="100vh",e.style.maxWidth="100%",e.style.maxHeight="100%",e.style.boxSizing="border-box",e.style.overflow="hidden",t.background&&(e.style.background=t.background),e.appendChild(n.canvas);let i=document.createElement("div");return i.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),e.appendChild(i),Be.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),Be.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),Be.on("resize",({payload:s})=>{a({width:s==null?void 0:s.width,height:s==null?void 0:s.height})}),window.addEventListener("resize",()=>a()),requestAnimationFrame(()=>a()),{app:n,stage:n.stage,overlay:i,applySize:a}}var Ce=class{constructor(t){var n,a;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(n=t==null?void 0:t.scale)!=null?n:1,this.rotation=(a=t==null?void 0:t.rotation)!=null?a:0}update(t){t.position!==void 0&&(this.position={...t.position}),t.scale!==void 0&&(this.scale=t.scale),t.rotation!==void 0&&(this.rotation=t.rotation)}syncToPixi(t){t.position.set(this.position.x,this.position.y),t.scale.set(this.scale),t.rotation=this.rotation}},Ae=class{constructor(t){var n,a,i,s;this.z_index=(n=t==null?void 0:t.z_index)!=null?n:0,this.alpha=(a=t==null?void 0:t.alpha)!=null?a:1,this.visible=(i=t==null?void 0:t.visible)!=null?i:!0,this.tint=(s=t==null?void 0:t.tint)!=null?s:null}update(t){t.z_index!==void 0&&(this.z_index=t.z_index),t.alpha!==void 0&&(this.alpha=t.alpha),t.visible!==void 0&&(this.visible=t.visible),t.tint!==void 0&&(this.tint=t.tint)}syncToPixi(t){t.zIndex=this.z_index,t.alpha=this.alpha,t.visible=this.visible,this.tint!==null&&"tint"in t&&(t.tint=this.tint)}},Se=class{constructor(t,n,a,i){this.instanceId=t,this.objectConfig=n,this.pixiObject=a,this._config=i,this.transform=new Ce(i.transform),this.renderer=new Ae(i.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject)}updateConfig(t){this._config=t,t.transform&&this.transform.update(t.transform),t.render&&this.renderer.update(t.render),this.sync()}getComponent(t){return this._config[t]}getPosition(){return{...this.transform.position}}setPosition(t,n){this.transform.position={x:t,y:n},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToPixi(this.pixiObject)}},je=class{constructor(t){this.objects=new Map;this.config=t}create(t,n){let a=this.config.objects.get(t);if(!a)throw new Error(`Object config not found: ${t}`);let i=new Se(t,a.object_config||t,n,a);return this.objects.set(t,i),i}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[n,a]of this.objects.entries()){let i=t.objects.get(n);i&&a.updateConfig(i)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var Ie={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function I(e){let t=Ie[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function G(e){var n;let t=Ie[e];return t&&(n=t.weight)!=null?n:"400"}function ta(e,t){Ie[e]=t}function na(){return Object.keys(Ie)}var w=require("pixi.js");function aa(e,t,n){var yt,gt,_t,bt,wt,xt,Tt,vt,Ct,At,St,Et,kt,Pt,Dt,Ft,Mt,Rt,Lt,zt,Ht,Ot,Wt,Yt,Nt,Bt,jt,It,Gt,Vt,qt,Xt,$t,Kt,Jt,Qt,Zt,Ut,en,tn,nn,an,sn,on,rn,ln,cn,dn,un,pn,fn,mn,hn,yn,gn,_n,bn,wn,xn,Tn;let a=e.objects.get("ui_endgame_1"),i=e.objects.get("ui_endgame_logo_1"),s=e.objects.get("ui_endgame_title_1"),o=e.objects.get("ui_endgame_subtitle_1"),r=e.objects.get("ui_endgame_footer_1"),l=e.objects.get("ui_endgame_cta_1"),d=e.objects.get("ui_endgame_cta_hint_1"),p=e.objects.get("ui_endgame_hand_1"),f=e.engine.runtime||{},u=new w.Container;u.alpha=0,u.visible=!1;let c=((yt=a==null?void 0:a.gameplay)==null?void 0:yt.tuning)||{},h=(a==null?void 0:a.render)||{},m=(gt=c.panel_width)!=null?gt:320,g=(_t=c.panel_height)!=null?_t:400,x=(bt=c.panel_padding)!=null?bt:32,T=(wt=c.panel_radius)!=null?wt:24,S=h.background_color||c.panel_bg_color||"#1a0a0a",v=h.background_alpha!==void 0&&h.background_alpha!==null?h.background_alpha:(xt=c.panel_bg_alpha)!=null?xt:.98,E=h.border_color||c.panel_border_color||"#ffffff",k=(Tt=c.panel_border_width)!=null?Tt:2,C=(vt=c.panel_border_alpha)!=null?vt:.3,A=new w.Graphics;A.roundRect(-m/2,-g/2,m,g,T);let b=S.replace("#","");A.fill({color:parseInt(b,16),alpha:v});let P=E.replace("#","");A.stroke({color:parseInt(P,16),width:k,alpha:C});let Y=new w.Graphics;Y.roundRect(-m/2+2,-g/2+2,m-4,g-4,T-2),Y.stroke({color:16777215,width:1,alpha:.1}),A.addChild(Y),u.addChild(A);let V=((Ct=i==null?void 0:i.gameplay)==null?void 0:Ct.tuning)||{},Z=(i==null?void 0:i.transform)||{},N=(At=V.logo_size)!=null?At:56,q=(St=Z.scale)!=null?St:1,ae=(kt=(Et=Z.offset)==null?void 0:Et.y)!=null?kt:-130,ma=(Pt=V.logo_alpha)!=null?Pt:1,D=new w.Sprite(n||w.Texture.EMPTY);D.anchor.set(.5);let se=0,oe=0;if(n&&n!==w.Texture.EMPTY){let F=n.frame,K=n.baseTexture;F&&F.width&&F.height?(se=F.width,oe=F.height):K&&K.width&&K.height?(se=K.width,oe=K.height):n.width&&n.height&&(se=n.width,oe=n.height)}if(se>0&&oe>0){let F=se/oe,K,Xe;F>1?(K=N,Xe=N/F):(Xe=N,K=N*F);let vn=K/se,Cn=Xe/oe;vn*=q,Cn*=q,D.scale.set(vn,Cn)}else{let F=N/100*q;D.scale.set(F)}D.position.set(0,ae),D.alpha=0,D.visible=!0,D.targetAlpha=ma,D.baseScaleX=D.scale.x,D.baseScaleY=D.scale.y,u.addChild(D);let M=s==null?void 0:s.ui,B=((Dt=s==null?void 0:s.gameplay)==null?void 0:Dt.tuning)||{},ha=(M==null?void 0:M.text)||"MISSION ACCOMPLISHED",st=(M==null?void 0:M.font)||"brand.heading",ya=(M==null?void 0:M.fontSize)||24,ga=(Ft=M==null?void 0:M.letterSpacing)!=null?Ft:1,Ee=(Mt=s==null?void 0:s.render)==null?void 0:Mt.tint,_a=typeof Ee=="string"?Ee:Ee?`#${Ee.toString(16).padStart(6,"0")}`:"#00FF88",ot=m-x*2-30,ba=B.font_weight_override?B.font_weight_override:G(st),U=new w.Text({text:ha,style:{fontFamily:I(st),fontSize:ya,fontWeight:ba,fill:_a,align:"center",letterSpacing:ga,wordWrap:!1,stroke:{color:B.stroke_color||"#000000",width:(Rt=B.stroke_width)!=null?Rt:2},dropShadow:{color:B.shadow_color||"#000000",alpha:(Lt=B.shadow_alpha)!=null?Lt:.9,angle:(zt=B.shadow_angle)!=null?zt:0,blur:(Ht=B.shadow_blur)!=null?Ht:8,distance:(Ot=B.shadow_distance)!=null?Ot:4}}});if(U.width>ot){let F=ot/U.width;U.scale.set(F)}U.anchor.set(.5);let rt=(Wt=c.title_offset_y)!=null?Wt:30,wa=rt+((Yt=B.animation_start_y_offset)!=null?Yt:-20);U.position.set(0,wa),U.alpha=0,u.addChild(U);let R=o==null?void 0:o.ui,lt=((Nt=o==null?void 0:o.gameplay)==null?void 0:Nt.tuning)||{},xa=(R==null?void 0:R.text)||"RESCUE COMPLETE",ct=(R==null?void 0:R.font)||"brand.body",Ta=(R==null?void 0:R.fontSize)||11,va=(Bt=R==null?void 0:R.letterSpacing)!=null?Bt:.5,ke=(jt=o==null?void 0:o.render)==null?void 0:jt.tint,Ca=typeof ke=="string"?ke:ke?`#${ke.toString(16).padStart(6,"0")}`:"#B0B0B0",re=new w.Text({text:xa,style:{fontFamily:I(ct),fontSize:Ta,fontWeight:G(ct),fill:Ca,align:"center",letterSpacing:va}});re.anchor.set(.5);let Aa=rt+20+((It=lt.animation_start_y_offset)!=null?It:-10);re.position.set(0,Aa),re.alpha=0,re.animationStartYOffset=(Gt=lt.animation_start_y_offset)!=null?Gt:-10,u.addChild(re);let X=r==null?void 0:r.ui,dt=((Vt=r==null?void 0:r.gameplay)==null?void 0:Vt.tuning)||{},Sa=(X==null?void 0:X.text)||((qt=f.ui)==null?void 0:qt.cta_hint)||"Continue the adventure!",ut=(X==null?void 0:X.font)||"brand.body",Ea=(X==null?void 0:X.fontSize)||16,Pe=(Xt=r==null?void 0:r.render)==null?void 0:Xt.tint,ka=typeof Pe=="string"?Pe:Pe?`#${Pe.toString(16).padStart(6,"0")}`:"#FFFFFF",Pa=($t=dt.max_width)!=null?$t:m-x*2,Da=(Kt=dt.line_height)!=null?Kt:1.4,le=new w.Text({text:Sa,style:{fontFamily:I(ut),fontSize:Ea,fontWeight:G(ut),fill:ka,align:"center",wordWrap:!0,wordWrapWidth:Pa,lineHeight:Da}});le.anchor.set(.5);let Fa=(Jt=c.footer_offset_y)!=null?Jt:120;le.position.set(0,Fa);let Ma=((Qt=r==null?void 0:r.render)==null?void 0:Qt.alpha)!==void 0&&((Zt=r==null?void 0:r.render)==null?void 0:Zt.alpha)!==null?r.render.alpha:1;le.alpha=0,le.targetAlpha=Ma,u.addChild(le);let $=((Ut=l==null?void 0:l.gameplay)==null?void 0:Ut.tuning)||{},L=l==null?void 0:l.ui,De=(en=$.button_width)!=null?en:260,Fe=(tn=$.button_height)!=null?tn:56,pt=(nn=$.button_radius)!=null?nn:16,Ra=$.button_bg_color||((an=f.theme)==null?void 0:an.cta_background)||"#ffb43b",La=(sn=$.button_bg_alpha)!=null?sn:1,za=$.button_border_color||"#ffffff",Ha=(on=$.button_border_width)!=null?on:2,Oa=(rn=$.button_border_alpha)!=null?rn:.2,Me=(ln=c.cta_offset_y)!=null?ln:160,j=new w.Graphics;j.roundRect(-De/2,-Fe/2,De,Fe,pt);let Wa=Ra.replace("#","");j.fill({color:parseInt(Wa,16),alpha:La});let Ya=za.replace("#","");j.stroke({color:parseInt(Ya,16),width:Ha,alpha:Oa});let Ve=new w.Graphics;Ve.roundRect(-De/2+2,-Fe/2+2,De-4,Fe-4,pt-2),Ve.stroke({color:0,width:1,alpha:.15}),j.addChild(Ve),j.position.set(0,Me),j.alpha=0,j.eventMode="static",j.cursor="pointer",u.addChild(j);let Na=(L==null?void 0:L.text)||((cn=f.ui)==null?void 0:cn.cta_label_end)||"DOWNLOAD",ft=(L==null?void 0:L.font)||"brand.heading",Ba=(L==null?void 0:L.fontSize)||20,ja=$.button_text_color||((dn=f.theme)==null?void 0:dn.cta_text)||"#1a0a0a",ge=new w.Text({text:Na,style:{fontFamily:I(ft),fontSize:Ba,fontWeight:G(ft),fill:ja,align:"center",letterSpacing:(un=L==null?void 0:L.letterSpacing)!=null?un:1}});ge.anchor.set(.5),ge.position.set(0,Me),ge.alpha=0,u.addChild(ge);let z=d==null?void 0:d.ui,mt=((pn=d==null?void 0:d.gameplay)==null?void 0:pn.tuning)||{},Ia=(z==null?void 0:z.text)||"Play the full game",ht=(z==null?void 0:z.font)||"brand.body",Ga=(z==null?void 0:z.fontSize)||11,Va=(fn=z==null?void 0:z.letterSpacing)!=null?fn:0,Re=(mn=d==null?void 0:d.render)==null?void 0:mn.tint,qa=typeof Re=="string"?Re:Re?`#${Re.toString(16).padStart(6,"0")}`:"#CCCCCC",ce=new w.Text({text:Ia,style:{fontFamily:I(ht),fontSize:Ga,fontWeight:G(ht),fill:qa,align:"center",letterSpacing:Va}});ce.anchor.set(.5);let Xa=Me+35+((hn=mt.animation_start_y_offset)!=null?hn:5);ce.position.set(0,Xa),ce.alpha=0,ce.animationStartYOffset=(yn=mt.animation_start_y_offset)!=null?yn:5,u.addChild(ce);let qe=((gn=p==null?void 0:p.gameplay)==null?void 0:gn.tuning)||{},$a=(_n=qe.hand_offset_x)!=null?_n:50,Ka=(bn=qe.hand_offset_y)!=null?bn:50,Ja=(xn=(wn=p==null?void 0:p.transform)==null?void 0:wn.scale)!=null?xn:.1875,Qa=(Tn=qe.hand_scale_multiplier)!=null?Tn:2.5,ie=new w.Sprite(t||w.Texture.EMPTY);return ie.anchor.set(.5),ie.scale.set(Ja*Qa),ie.position.set($a,Me+Ka),ie.alpha=0,ie.visible=!1,u.addChild(ie),{panel:u,logo:D,title:U,subtitle:re,footer:le,ctaButton:j,ctaText:ge,ctaHint:ce,hand:ie}}function ia(e,t,n){var k,C,A,b,P,Y,V,Z;let a=t.objects.get("ui_endgame_1"),i=((k=a==null?void 0:a.gameplay)==null?void 0:k.tuning)||{},s=(C=i.animation_duration_ms)!=null?C:800,o=(A=i.fade_in_duration_ms)!=null?A:600,r=(b=i.scale_animation_intensity)!=null?b:.1,l=(P=i.logo_animation_delay_ms)!=null?P:100,d=(Y=i.title_animation_delay_ms)!=null?Y:200,p=(V=i.footer_animation_delay_ms)!=null?V:300,f=(Z=i.cta_animation_delay_ms)!=null?Z:400,{panel:u,logo:c,title:h,subtitle:m,footer:g,ctaButton:x,ctaText:T,ctaHint:S}=e;u.visible=!0;let v=Date.now(),E=()=>{let N=Date.now()-v,q=Math.min(N/o,1),ae=1-Math.pow(1-q,3);u.alpha=ae,u.scale.set(1+r*(1-ae)),q<1?requestAnimationFrame(E):(setTimeout(()=>gi(c,s,t),l),setTimeout(()=>{_i(h,s),setTimeout(()=>bi(m,s),50)},d),setTimeout(()=>wi(g,s),p),setTimeout(()=>{xi(x,T,s),setTimeout(()=>Ti(S,s),50),n&&n()},f))};E()}function gi(e,t,n){var u,c,h,m,g;let a=n==null?void 0:n.objects.get("ui_endgame_logo_1"),s=(c=(((u=a==null?void 0:a.gameplay)==null?void 0:u.tuning)||{}).animation_start_scale)!=null?c:1.2,o=Date.now(),r=e.alpha,l=(h=e.targetAlpha)!=null?h:1,d=(m=e.baseScaleX)!=null?m:e.scale.x,p=(g=e.baseScaleY)!=null?g:e.scale.y,f=()=>{let x=Date.now()-o,T=Math.min(x/t,1),S=1-Math.pow(1-T,2);e.alpha=r+(l-r)*S;let v=s+(1-s)*S;e.scale.set(d*v,p*v),T<1&&requestAnimationFrame(f)};f()}function _i(e,t){let n=Date.now(),a=e.alpha,i=e.y,s=()=>{let o=Date.now()-n,r=Math.min(o/t,1),l=1-Math.pow(1-r,2);e.alpha=a+(1-a)*l,e.y=i-20*(1-l),r<1&&requestAnimationFrame(s)};s()}function bi(e,t){var r;let n=Date.now(),a=e.alpha,i=e.position.y,s=i-((r=e.animationStartYOffset)!=null?r:-10),o=()=>{let l=Date.now()-n,d=Math.min(l/t,1),p=1-Math.pow(1-d,2);e.alpha=a+(1-a)*p,e.position.y=i+(s-i)*p,d<1&&requestAnimationFrame(o)};o()}function wi(e,t){var o;let n=Date.now(),a=e.alpha,i=(o=e.targetAlpha)!=null?o:1,s=()=>{let r=Date.now()-n,l=Math.min(r/t,1),d=1-Math.pow(1-l,2);e.alpha=a+(i-a)*d,l<1&&requestAnimationFrame(s)};s()}function xi(e,t,n){let a=Date.now(),i=e.alpha,s=()=>{let o=Date.now()-a,r=Math.min(o/n,1),l=1-Math.pow(1-r,2);e.alpha=i+(1-i)*l,t.alpha=i+(1-i)*l,e.scale.set(1+.1*(1-l)),r<1&&requestAnimationFrame(s)};s()}function Ti(e,t){var r;let n=Date.now(),a=e.alpha,i=e.position.y,s=i-((r=e.animationStartYOffset)!=null?r:5),o=()=>{let l=Date.now()-n,d=Math.min(l/t,1),p=1-Math.pow(1-d,2);e.alpha=a+(1-a)*p,e.position.y=i+(s-i)*p,d<1&&requestAnimationFrame(o)};o()}function sa(e,t,n,a){var p,f,u,c;let i=n.objects.get("ui_endgame_hand_1"),s=((p=i==null?void 0:i.gameplay)==null?void 0:p.tuning)||{},o=(f=s.click_animation_duration_ms)!=null?f:600,r=(u=s.click_delay_ms)!=null?u:2e3,l=(c=s.click_repeat_delay_ms)!=null?c:3e3,d=()=>{var k,C;e.visible=!0,e.alpha=1;let h=e.x,m=e.y,g=(k=s.hand_offset_x)!=null?k:50,x=(C=s.hand_offset_y)!=null?C:50,T=t.x+g,S=t.y+x,v=Date.now(),E=()=>{var N,q,ae;let A=Date.now()-v,b=Math.min(A/o,1),P=b<.5?2*b*b:1-Math.pow(-2*b+2,2)/2;e.x=h+(T-h)*P,e.y=m+(S-m)*P;let Y=(q=(N=i==null?void 0:i.transform)==null?void 0:N.scale)!=null?q:.1875,V=(ae=s.hand_scale_multiplier)!=null?ae:2.5,Z=Y*V;e.scale.set(Z+Z*.2*Math.sin(b*Math.PI)),b<1?requestAnimationFrame(E):(t.scale.set(.95),setTimeout(()=>{t.scale.set(1),a()},100),setTimeout(()=>{e.alpha=0,setTimeout(()=>{e.x=h,e.y=m,d()},l)},500))};E()};setTimeout(d,r)}var Ge=require("pixi.js");function oa(e,t,n){var p,f,u,c;let a=t.objects.get("hand_tutorial_1"),i=((p=a==null?void 0:a.gameplay)==null?void 0:p.tuning)||{},s=(a==null?void 0:a.render)||{},o=(a==null?void 0:a.transform)||{},r=new Ge.Sprite(e);r.anchor.set(.5),r.alpha=0;let l=(f=i.hand_scale_multiplier)!=null?f:2.5,d=(u=o.scale)!=null?u:.1875;return r.scale.set(d*l),r.zIndex=(c=s.z_index)!=null?c:99999,r}function ra(e){var h,m,g,x,T,S,v,E,k,C;let t=e.objects.get("ui_tutorial_1"),n=t==null?void 0:t.ui,a=(t==null?void 0:t.render)||{},i=((h=e.engine.runtime)==null?void 0:h.ui_styles)||{},s=((m=e.engine.runtime)==null?void 0:m.ui)||{},o=(n==null?void 0:n.text)||s.tutorial_label||s.label_text||"CLEAN!",r=(n==null?void 0:n.font)||"brand.warning",l=(n==null?void 0:n.fontSize)||i.label_font_size||52,d=(x=n==null?void 0:n.letterSpacing)!=null?x:(g=i.label_letter_spacing)!=null?g:-1,p=(n==null?void 0:n.align)||"center",f=a.tint,u=typeof f=="string"?f:f?`#${f.toString(16).padStart(6,"0")}`:i.label_fill||"#FFF1C1",c=new Ge.Text({text:o,style:{fontFamily:I(r),fontSize:l,fontWeight:G(r),fill:u,align:p,letterSpacing:d,stroke:{color:i.label_stroke||"#8B0000",width:2},dropShadow:{color:i.label_shadow_color||"#000000",alpha:(T=i.label_shadow_alpha)!=null?T:.8,angle:(S=i.label_shadow_angle)!=null?S:0,blur:(v=i.label_shadow_blur)!=null?v:4,distance:(E=i.label_shadow_distance)!=null?E:2}}});return c.anchor.set(.5,0),c.alpha=(k=a.alpha)!=null?k:0,c.visible=(C=a.visible)!=null?C:!0,c}function la(e,t,n,a,i){var l,d,p,f,u,c,h;let s=i.objects.get("hand_tutorial_1"),o=((l=s==null?void 0:s.gameplay)==null?void 0:l.tuning)||{},r=(s==null?void 0:s.transform)||{};if(!a){let m=(d=o.animation_duration)!=null?d:1.5,g=n%m/m,x=g<.5?2*g*g:-1+(4-2*g)*g,T=(p=o.x_offset)!=null?p:0,S=(f=o.y_offset)!=null?f:0,v=(u=o.animation_range)!=null?u:40,E=v*.7,k=v,C=t.x+T+E,A=t.y+S+k,b=C+E,P=A+k;e.x=C+(b-C)*x,e.y=A+(P-A)*x;let Y=(c=r.scale)!=null?c:.1875,V=(h=o.hand_scale_multiplier)!=null?h:2.5;e.scale.set(Y*V)}}var W=require("pixi.js"),at=null,it=null;async function ca(){if(at)return at;if(!it){let n=(()=>{if(typeof window!="undefined")try{return new URL("inline-assets.js",window.location.href).href}catch{return"./inline-assets.js"}return"./inline-assets.js"})();it=new Function("path","return import(path)")(n).then(a=>a.INLINE_ASSETS||{}).catch(a=>(console.warn("[assets] Failed to load inline-assets.js:",a),{}))}let e=await it;return at=e||{},e||{}}function vi(e,t){if(!e)return;let n=t[e];if(n)return n;let a=e.split("?")[0].split("#")[0];if(a!==e&&t[a])return t[a];let i=a.split("/").pop();if(i&&t[i])return t[i];let s=a.replace(/^\.?\/*/,"");if(s!==a&&t[s])return t[s]}function da(e,t){let n=vi(e,t);if(!n)throw new Error(`[assets] inline asset not found: ${e}`);return n}async function ua(e,t,n=16777215,a=!1){let i=await ca(),s=da(e,i);try{return await W.Assets.load(s)}catch{throw new Error(`[assets] inline asset failed to load: ${e}`)}}async function pa(e,t,n){var m,g,x,T,S,v,E,k,C,A;let a=await ca(),i=da(e,a),s;try{s=await W.Assets.load(i),console.log("[character] loaded sheet",{path:e,sourceUsed:i})}catch{throw new Error(`[assets] inline character sheet failed to load: ${e}`)}let o=s.source||s.baseTexture||s;o&&"valid"in o&&o.valid===!1&&typeof o.once=="function"&&await new Promise(b=>o.once("loaded",b));let r=n.gameplay.character_sheet||{},l=(m=r.cols)!=null?m:3,d=(g=r.rows)!=null?g:2,p=(v=(S=(x=o==null?void 0:o.width)!=null?x:o==null?void 0:o.pixelWidth)!=null?S:(T=o==null?void 0:o.baseTexture)==null?void 0:T.width)!=null?v:s.width,f=(A=(C=(E=o==null?void 0:o.height)!=null?E:o==null?void 0:o.pixelHeight)!=null?C:(k=o==null?void 0:o.baseTexture)==null?void 0:k.height)!=null?A:s.height,u=p/l,c=f/d;if(!Number.isFinite(u)||!Number.isFinite(c)||u<=0||c<=0||!o)return[s];let h=[];for(let b=0;b<d;b++)for(let P=0;P<l;P++)h.push(new W.Texture({source:o,frame:new W.Rectangle(P*u,b*c,u,c)}));return h.length>2&&h.push(...h.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:h.length}),h}function fa(e,t){var p,f,u,c;let n=t.gameplay.brush||{},a=new W.Color(t.theme.brush_color||"#ffffff").toNumber(),i=(p=n.radius)!=null?p:20,s=(f=n.inner_radius)!=null?f:15,o=(u=n.alpha)!=null?u:.8,r=(c=n.inner_alpha)!=null?c:.3,l=n.inner_color||"#ffffff",d=new W.Graphics;return d.circle(0,0,i).fill({color:a,alpha:o}),d.circle(0,0,s).fill({color:new W.Color(l).toNumber(),alpha:r}),e.renderer.generateTexture(d)}0&&(module.exports={GameObject,GameObjectManager,Renderer,Transform,animateHandClick,animatePanelEntrance,createBrushTexture,createEndGamePanel,createHandTutorial,createPixiBase,createTutorialLabel,getRegisteredFontIds,loadAsset,loadCharacterFrames,registerFont,resolveFont,resolveFontWeight,updateHandAnimation});
17
+ `,t.appendChild(e)}async function la(t,e={}){let n=new ra.Application;await n.init({resizeTo:t,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let a=i=>{var c,l,p,f,u,d;let o=(p=(l=(c=i==null?void 0:i.width)!=null?c:t.clientWidth)!=null?l:window.innerWidth)!=null?p:320,r=(d=(u=(f=i==null?void 0:i.height)!=null?f:t.clientHeight)!=null?u:window.innerHeight)!=null?d:480;n.renderer.resize(o,r)};t.innerHTML="",t.style.position="relative",t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="stretch",t.style.width="100%",t.style.height="100dvh",t.style.minHeight="100vh",t.style.maxWidth="100%",t.style.maxHeight="100%",t.style.boxSizing="border-box",t.style.overflow="hidden",e.background&&(t.style.background=e.background),t.appendChild(n.canvas);let s=document.createElement("div");return s.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),t.appendChild(s),qe.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),qe.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),qe.on("resize",({payload:i})=>{a({width:i==null?void 0:i.width,height:i==null?void 0:i.height})}),window.addEventListener("resize",()=>a()),requestAnimationFrame(()=>a()),{app:n,stage:n.stage,overlay:s,applySize:a}}var Le=class{constructor(e){var n,a;this.position=(e==null?void 0:e.position)||{x:0,y:0},this.scale=(n=e==null?void 0:e.scale)!=null?n:1,this.rotation=(a=e==null?void 0:e.rotation)!=null?a:0}update(e){e.position!==void 0&&(this.position={...e.position}),e.scale!==void 0&&(this.scale=e.scale),e.rotation!==void 0&&(this.rotation=e.rotation)}syncToPixi(e){e.position.set(this.position.x,this.position.y),e.scale.set(this.scale),e.rotation=this.rotation}},Me=class{constructor(e){var n,a,s,i;this.z_index=(n=e==null?void 0:e.z_index)!=null?n:0,this.alpha=(a=e==null?void 0:e.alpha)!=null?a:1,this.visible=(s=e==null?void 0:e.visible)!=null?s:!0,this.tint=(i=e==null?void 0:e.tint)!=null?i:null}update(e){e.z_index!==void 0&&(this.z_index=e.z_index),e.alpha!==void 0&&(this.alpha=e.alpha),e.visible!==void 0&&(this.visible=e.visible),e.tint!==void 0&&(this.tint=e.tint)}syncToPixi(e){e.zIndex=this.z_index,e.alpha=this.alpha,e.visible=this.visible,this.tint!==null&&"tint"in e&&(e.tint=this.tint)}},De=class{constructor(e,n,a,s){this.instanceId=e,this.objectConfig=n,this.pixiObject=a,this._config=s,this.transform=new Le(s.transform),this.renderer=new Me(s.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject)}updateConfig(e){this._config=e,e.transform&&this.transform.update(e.transform),e.render&&this.renderer.update(e.render),this.sync()}getComponent(e){return this._config[e]}getPosition(){return{...this.transform.position}}setPosition(e,n){this.transform.position={x:e,y:n},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(e){this.renderer.alpha=e,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(e){this.renderer.visible=e,this.renderer.syncToPixi(this.pixiObject)}},Xe=class{constructor(e){this.objects=new Map;this.config=e}create(e,n){let a=this.config.objects.get(e);if(!a)throw new Error(`Object config not found: ${e}`);let s=new De(e,a.object_config||e,n,a);return this.objects.set(e,s),s}get(e){return this.objects.get(e)}updateConfig(e){this.config=e;for(let[n,a]of this.objects.entries()){let s=e.objects.get(n);s&&a.updateConfig(s)}}getAll(){return Array.from(this.objects.values())}remove(e){this.objects.delete(e)}clear(){this.objects.clear()}};var Ue={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function V(t){let e=Ue[t];return e?e.family:(console.warn(`Font ID "${t}" not found in registry, using fallback`),"Arial, sans-serif")}function q(t){var n;let e=Ue[t];return e&&(n=e.weight)!=null?n:"400"}function ca(t,e){Ue[t]=e}function da(){return Object.keys(Ue)}var x=require("pixi.js");function ua(t,e,n){var At,vt,Et,Lt,Mt,Dt,Ot,Ct,Pt,kt,Ft,It,Rt,Nt,Bt,$t,zt,Ht,Wt,Yt,Gt,Jt,Vt,qt,Xt,Ut,Kt,jt,Qt,Zt,en,tn,nn,an,sn,on,rn,ln,cn,dn,un,pn,fn,hn,mn,yn,gn,_n,wn,bn,xn,Sn,Tn,An,vn,En,Ln,Mn,Dn,On;let a=t.objects.get("ui_endgame_1"),s=t.objects.get("ui_endgame_logo_1"),i=t.objects.get("ui_endgame_title_1"),o=t.objects.get("ui_endgame_subtitle_1"),r=t.objects.get("ui_endgame_footer_1"),c=t.objects.get("ui_endgame_cta_1"),l=t.objects.get("ui_endgame_cta_hint_1"),p=t.objects.get("ui_endgame_hand_1"),f=t.engine.runtime||{},u=new x.Container;u.alpha=0,u.visible=!1;let d=((At=a==null?void 0:a.gameplay)==null?void 0:At.tuning)||{},m=(a==null?void 0:a.render)||{},h=(vt=d.panel_width)!=null?vt:320,g=(Et=d.panel_height)!=null?Et:400,b=(Lt=d.panel_padding)!=null?Lt:32,w=(Mt=d.panel_radius)!=null?Mt:24,S=m.background_color||d.panel_bg_color||"#1a0a0a",T=m.background_alpha!==void 0&&m.background_alpha!==null?m.background_alpha:(Dt=d.panel_bg_alpha)!=null?Dt:.98,E=m.border_color||d.panel_border_color||"#ffffff",L=(Ot=d.panel_border_width)!=null?Ot:2,A=(Ct=d.panel_border_alpha)!=null?Ct:.3,v=new x.Graphics;v.roundRect(-h/2,-g/2,h,g,w);let M=S.replace("#","");v.fill({color:parseInt(M,16),alpha:T});let k=E.replace("#","");v.stroke({color:parseInt(k,16),width:L,alpha:A});let D=new x.Graphics;D.roundRect(-h/2+2,-g/2+2,h-4,g-4,w-2),D.stroke({color:16777215,width:1,alpha:.1}),v.addChild(D),u.addChild(v);let F=((Pt=s==null?void 0:s.gameplay)==null?void 0:Pt.tuning)||{},W=(s==null?void 0:s.transform)||{},O=(kt=F.logo_size)!=null?kt:56,I=(Ft=W.scale)!=null?Ft:1,Y=(Rt=(It=W.offset)==null?void 0:It.y)!=null?Rt:-130,Pe=(Nt=F.logo_alpha)!=null?Nt:1,C=new x.Sprite(n||x.Texture.EMPTY);C.anchor.set(.5);let oe=0,re=0;if(n&&n!==x.Texture.EMPTY){let P=n.frame,j=n.baseTexture;P&&P.width&&P.height?(oe=P.width,re=P.height):j&&j.width&&j.height?(oe=j.width,re=j.height):n.width&&n.height&&(oe=n.width,re=n.height)}if(oe>0&&re>0){let P=oe/re,j,tt;P>1?(j=O,tt=O/P):(tt=O,j=O*P);let Cn=j/oe,Pn=tt/re;Cn*=I,Pn*=I,C.scale.set(Cn,Pn)}else{let P=O/100*I;C.scale.set(P)}C.position.set(0,Y),C.alpha=0,C.visible=!0,C.targetAlpha=Pe,C.baseScaleX=C.scale.x,C.baseScaleY=C.scale.y,u.addChild(C);let R=i==null?void 0:i.ui,G=((Bt=i==null?void 0:i.gameplay)==null?void 0:Bt.tuning)||{},ba=(R==null?void 0:R.text)||"MISSION ACCOMPLISHED",ft=(R==null?void 0:R.font)||"brand.heading",xa=(R==null?void 0:R.fontSize)||24,Sa=($t=R==null?void 0:R.letterSpacing)!=null?$t:1,ke=(zt=i==null?void 0:i.render)==null?void 0:zt.tint,Ta=typeof ke=="string"?ke:ke?`#${ke.toString(16).padStart(6,"0")}`:"#00FF88",ht=h-b*2-30,Aa=G.font_weight_override?G.font_weight_override:q(ft),te=new x.Text({text:ba,style:{fontFamily:V(ft),fontSize:xa,fontWeight:Aa,fill:Ta,align:"center",letterSpacing:Sa,wordWrap:!1,stroke:{color:G.stroke_color||"#000000",width:(Ht=G.stroke_width)!=null?Ht:2},dropShadow:{color:G.shadow_color||"#000000",alpha:(Wt=G.shadow_alpha)!=null?Wt:.9,angle:(Yt=G.shadow_angle)!=null?Yt:0,blur:(Gt=G.shadow_blur)!=null?Gt:8,distance:(Jt=G.shadow_distance)!=null?Jt:4}}});if(te.width>ht){let P=ht/te.width;te.scale.set(P)}te.anchor.set(.5);let mt=(Vt=d.title_offset_y)!=null?Vt:30,va=mt+((qt=G.animation_start_y_offset)!=null?qt:-20);te.position.set(0,va),te.alpha=0,u.addChild(te);let N=o==null?void 0:o.ui,yt=((Xt=o==null?void 0:o.gameplay)==null?void 0:Xt.tuning)||{},Ea=(N==null?void 0:N.text)||"RESCUE COMPLETE",gt=(N==null?void 0:N.font)||"brand.body",La=(N==null?void 0:N.fontSize)||11,Ma=(Ut=N==null?void 0:N.letterSpacing)!=null?Ut:.5,Fe=(Kt=o==null?void 0:o.render)==null?void 0:Kt.tint,Da=typeof Fe=="string"?Fe:Fe?`#${Fe.toString(16).padStart(6,"0")}`:"#B0B0B0",le=new x.Text({text:Ea,style:{fontFamily:V(gt),fontSize:La,fontWeight:q(gt),fill:Da,align:"center",letterSpacing:Ma}});le.anchor.set(.5);let Oa=mt+20+((jt=yt.animation_start_y_offset)!=null?jt:-10);le.position.set(0,Oa),le.alpha=0,le.animationStartYOffset=(Qt=yt.animation_start_y_offset)!=null?Qt:-10,u.addChild(le);let U=r==null?void 0:r.ui,_t=((Zt=r==null?void 0:r.gameplay)==null?void 0:Zt.tuning)||{},Ca=(U==null?void 0:U.text)||((en=f.ui)==null?void 0:en.cta_hint)||"Continue the adventure!",wt=(U==null?void 0:U.font)||"brand.body",Pa=(U==null?void 0:U.fontSize)||16,Ie=(tn=r==null?void 0:r.render)==null?void 0:tn.tint,ka=typeof Ie=="string"?Ie:Ie?`#${Ie.toString(16).padStart(6,"0")}`:"#FFFFFF",Fa=(nn=_t.max_width)!=null?nn:h-b*2,Ia=(an=_t.line_height)!=null?an:1.4,ce=new x.Text({text:Ca,style:{fontFamily:V(wt),fontSize:Pa,fontWeight:q(wt),fill:ka,align:"center",wordWrap:!0,wordWrapWidth:Fa,lineHeight:Ia}});ce.anchor.set(.5);let Ra=(sn=d.footer_offset_y)!=null?sn:120;ce.position.set(0,Ra);let Na=((on=r==null?void 0:r.render)==null?void 0:on.alpha)!==void 0&&((rn=r==null?void 0:r.render)==null?void 0:rn.alpha)!==null?r.render.alpha:1;ce.alpha=0,ce.targetAlpha=Na,u.addChild(ce);let K=((ln=c==null?void 0:c.gameplay)==null?void 0:ln.tuning)||{},B=c==null?void 0:c.ui,Re=(cn=K.button_width)!=null?cn:260,Ne=(dn=K.button_height)!=null?dn:56,bt=(un=K.button_radius)!=null?un:16,Ba=K.button_bg_color||((pn=f.theme)==null?void 0:pn.cta_background)||"#ffb43b",$a=(fn=K.button_bg_alpha)!=null?fn:1,za=K.button_border_color||"#ffffff",Ha=(hn=K.button_border_width)!=null?hn:2,Wa=(mn=K.button_border_alpha)!=null?mn:.2,Be=(yn=d.cta_offset_y)!=null?yn:160,J=new x.Graphics;J.roundRect(-Re/2,-Ne/2,Re,Ne,bt);let Ya=Ba.replace("#","");J.fill({color:parseInt(Ya,16),alpha:$a});let Ga=za.replace("#","");J.stroke({color:parseInt(Ga,16),width:Ha,alpha:Wa});let Ze=new x.Graphics;Ze.roundRect(-Re/2+2,-Ne/2+2,Re-4,Ne-4,bt-2),Ze.stroke({color:0,width:1,alpha:.15}),J.addChild(Ze),J.position.set(0,Be),J.alpha=0,J.eventMode="static",J.cursor="pointer",u.addChild(J);let Ja=(B==null?void 0:B.text)||((gn=f.ui)==null?void 0:gn.cta_label_end)||"DOWNLOAD",xt=(B==null?void 0:B.font)||"brand.heading",Va=(B==null?void 0:B.fontSize)||20,qa=K.button_text_color||((_n=f.theme)==null?void 0:_n.cta_text)||"#1a0a0a",be=new x.Text({text:Ja,style:{fontFamily:V(xt),fontSize:Va,fontWeight:q(xt),fill:qa,align:"center",letterSpacing:(wn=B==null?void 0:B.letterSpacing)!=null?wn:1}});be.anchor.set(.5),be.position.set(0,Be),be.alpha=0,u.addChild(be);let $=l==null?void 0:l.ui,St=((bn=l==null?void 0:l.gameplay)==null?void 0:bn.tuning)||{},Xa=($==null?void 0:$.text)||"Play the full game",Tt=($==null?void 0:$.font)||"brand.body",Ua=($==null?void 0:$.fontSize)||11,Ka=(xn=$==null?void 0:$.letterSpacing)!=null?xn:0,$e=(Sn=l==null?void 0:l.render)==null?void 0:Sn.tint,ja=typeof $e=="string"?$e:$e?`#${$e.toString(16).padStart(6,"0")}`:"#CCCCCC",de=new x.Text({text:Xa,style:{fontFamily:V(Tt),fontSize:Ua,fontWeight:q(Tt),fill:ja,align:"center",letterSpacing:Ka}});de.anchor.set(.5);let Qa=Be+35+((Tn=St.animation_start_y_offset)!=null?Tn:5);de.position.set(0,Qa),de.alpha=0,de.animationStartYOffset=(An=St.animation_start_y_offset)!=null?An:5,u.addChild(de);let et=((vn=p==null?void 0:p.gameplay)==null?void 0:vn.tuning)||{},Za=(En=et.hand_offset_x)!=null?En:50,ei=(Ln=et.hand_offset_y)!=null?Ln:50,ti=(Dn=(Mn=p==null?void 0:p.transform)==null?void 0:Mn.scale)!=null?Dn:.1875,ni=(On=et.hand_scale_multiplier)!=null?On:2.5,se=new x.Sprite(e||x.Texture.EMPTY);return se.anchor.set(.5),se.scale.set(ti*ni),se.position.set(Za,Be+ei),se.alpha=0,se.visible=!1,u.addChild(se),{panel:u,logo:C,title:te,subtitle:le,footer:ce,ctaButton:J,ctaText:be,ctaHint:de,hand:se}}function pa(t,e,n){var L,A,v,M,k,D,F,W;let a=e.objects.get("ui_endgame_1"),s=((L=a==null?void 0:a.gameplay)==null?void 0:L.tuning)||{},i=(A=s.animation_duration_ms)!=null?A:800,o=(v=s.fade_in_duration_ms)!=null?v:600,r=(M=s.scale_animation_intensity)!=null?M:.1,c=(k=s.logo_animation_delay_ms)!=null?k:100,l=(D=s.title_animation_delay_ms)!=null?D:200,p=(F=s.footer_animation_delay_ms)!=null?F:300,f=(W=s.cta_animation_delay_ms)!=null?W:400,{panel:u,logo:d,title:m,subtitle:h,footer:g,ctaButton:b,ctaText:w,ctaHint:S}=t;u.visible=!0;let T=Date.now(),E=()=>{let O=Date.now()-T,I=Math.min(O/o,1),Y=1-Math.pow(1-I,3);u.alpha=Y,u.scale.set(1+r*(1-Y)),I<1?requestAnimationFrame(E):(setTimeout(()=>Si(d,i,e),c),setTimeout(()=>{Ti(m,i),setTimeout(()=>Ai(h,i),50)},l),setTimeout(()=>vi(g,i),p),setTimeout(()=>{Ei(b,w,i),setTimeout(()=>Li(S,i),50),n&&n()},f))};E()}function Si(t,e,n){var u,d,m,h,g;let a=n==null?void 0:n.objects.get("ui_endgame_logo_1"),i=(d=(((u=a==null?void 0:a.gameplay)==null?void 0:u.tuning)||{}).animation_start_scale)!=null?d:1.2,o=Date.now(),r=t.alpha,c=(m=t.targetAlpha)!=null?m:1,l=(h=t.baseScaleX)!=null?h:t.scale.x,p=(g=t.baseScaleY)!=null?g:t.scale.y,f=()=>{let b=Date.now()-o,w=Math.min(b/e,1),S=1-Math.pow(1-w,2);t.alpha=r+(c-r)*S;let T=i+(1-i)*S;t.scale.set(l*T,p*T),w<1&&requestAnimationFrame(f)};f()}function Ti(t,e){let n=Date.now(),a=t.alpha,s=t.y,i=()=>{let o=Date.now()-n,r=Math.min(o/e,1),c=1-Math.pow(1-r,2);t.alpha=a+(1-a)*c,t.y=s-20*(1-c),r<1&&requestAnimationFrame(i)};i()}function Ai(t,e){var r;let n=Date.now(),a=t.alpha,s=t.position.y,i=s-((r=t.animationStartYOffset)!=null?r:-10),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),p=1-Math.pow(1-l,2);t.alpha=a+(1-a)*p,t.position.y=s+(i-s)*p,l<1&&requestAnimationFrame(o)};o()}function vi(t,e){var o;let n=Date.now(),a=t.alpha,s=(o=t.targetAlpha)!=null?o:1,i=()=>{let r=Date.now()-n,c=Math.min(r/e,1),l=1-Math.pow(1-c,2);t.alpha=a+(s-a)*l,c<1&&requestAnimationFrame(i)};i()}function Ei(t,e,n){let a=Date.now(),s=t.alpha,i=()=>{let o=Date.now()-a,r=Math.min(o/n,1),c=1-Math.pow(1-r,2);t.alpha=s+(1-s)*c,e.alpha=s+(1-s)*c,t.scale.set(1+.1*(1-c)),r<1&&requestAnimationFrame(i)};i()}function Li(t,e){var r;let n=Date.now(),a=t.alpha,s=t.position.y,i=s-((r=t.animationStartYOffset)!=null?r:5),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),p=1-Math.pow(1-l,2);t.alpha=a+(1-a)*p,t.position.y=s+(i-s)*p,l<1&&requestAnimationFrame(o)};o()}function fa(t,e,n,a){var p,f,u,d;let s=n.objects.get("ui_endgame_hand_1"),i=((p=s==null?void 0:s.gameplay)==null?void 0:p.tuning)||{},o=(f=i.click_animation_duration_ms)!=null?f:600,r=(u=i.click_delay_ms)!=null?u:2e3,c=(d=i.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var L,A;t.visible=!0,t.alpha=1;let m=t.x,h=t.y,g=(L=i.hand_offset_x)!=null?L:50,b=(A=i.hand_offset_y)!=null?A:50,w=e.x+g,S=e.y+b,T=Date.now(),E=()=>{var O,I,Y;let v=Date.now()-T,M=Math.min(v/o,1),k=M<.5?2*M*M:1-Math.pow(-2*M+2,2)/2;t.x=m+(w-m)*k,t.y=h+(S-h)*k;let D=(I=(O=s==null?void 0:s.transform)==null?void 0:O.scale)!=null?I:.1875,F=(Y=i.hand_scale_multiplier)!=null?Y:2.5,W=D*F;t.scale.set(W+W*.2*Math.sin(M*Math.PI)),M<1?requestAnimationFrame(E):(e.scale.set(.95),setTimeout(()=>{e.scale.set(1),a()},100),setTimeout(()=>{t.alpha=0,setTimeout(()=>{t.x=m,t.y=h,l()},c)},500))};E()};setTimeout(l,r)}var Ke=require("pixi.js");function ha(t,e,n){var p,f,u,d;let a=e.objects.get("hand_tutorial_1"),s=((p=a==null?void 0:a.gameplay)==null?void 0:p.tuning)||{},i=(a==null?void 0:a.render)||{},o=(a==null?void 0:a.transform)||{},r=new Ke.Sprite(t);r.anchor.set(.5),r.alpha=0;let c=(f=s.hand_scale_multiplier)!=null?f:2.5,l=(u=o.scale)!=null?u:.1875;return r.scale.set(l*c),r.zIndex=(d=i.z_index)!=null?d:99999,r}function ma(t){var m,h,g,b,w,S,T,E,L,A;let e=t.objects.get("ui_tutorial_1"),n=e==null?void 0:e.ui,a=(e==null?void 0:e.render)||{},s=((m=t.engine.runtime)==null?void 0:m.ui_styles)||{},i=((h=t.engine.runtime)==null?void 0:h.ui)||{},o=(n==null?void 0:n.text)||i.tutorial_label||i.label_text||"CLEAN!",r=(n==null?void 0:n.font)||"brand.warning",c=(n==null?void 0:n.fontSize)||s.label_font_size||52,l=(b=n==null?void 0:n.letterSpacing)!=null?b:(g=s.label_letter_spacing)!=null?g:-1,p=(n==null?void 0:n.align)||"center",f=a.tint,u=typeof f=="string"?f:f?`#${f.toString(16).padStart(6,"0")}`:s.label_fill||"#FFF1C1",d=new Ke.Text({text:o,style:{fontFamily:V(r),fontSize:c,fontWeight:q(r),fill:u,align:p,letterSpacing:l,stroke:{color:s.label_stroke||"#8B0000",width:2},dropShadow:{color:s.label_shadow_color||"#000000",alpha:(w=s.label_shadow_alpha)!=null?w:.8,angle:(S=s.label_shadow_angle)!=null?S:0,blur:(T=s.label_shadow_blur)!=null?T:4,distance:(E=s.label_shadow_distance)!=null?E:2}}});return d.anchor.set(.5,0),d.alpha=(L=a.alpha)!=null?L:0,d.visible=(A=a.visible)!=null?A:!0,d}function ya(t,e,n,a,s){var c,l,p,f,u,d,m;let i=s.objects.get("hand_tutorial_1"),o=((c=i==null?void 0:i.gameplay)==null?void 0:c.tuning)||{},r=(i==null?void 0:i.transform)||{};if(!a){let h=(l=o.animation_duration)!=null?l:1.5,g=n%h/h,b=g<.5?2*g*g:-1+(4-2*g)*g,w=(p=o.x_offset)!=null?p:0,S=(f=o.y_offset)!=null?f:0,T=(u=o.animation_range)!=null?u:40,E=T*.7,L=T,A=e.x+w+E,v=e.y+S+L,M=A+E,k=v+L;t.x=A+(M-A)*b,t.y=v+(k-v)*b;let D=(d=r.scale)!=null?d:.1875,F=(m=o.hand_scale_multiplier)!=null?m:2.5;t.scale.set(D*F)}}var Oe=null;function Mi(){return Oe||(typeof window!="undefined"&&window.lottie?Oe=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),Oe=null)),Oe}function ga(t){Oe=t}function _a(t,e,n,a){var E,L,A,v,M,k,D,F,W,O,I,Y,Pe;let s=n.objects.get(t);if(!s)return console.warn(`[LottieOverlay] Object config not found: ${t}`),null;let i=((E=s.effects)==null?void 0:E.lottie)||{},o=s.transform||{},r=s.render||{};if(i.enabled===!1||r.visible===!1)return null;let c=a[t];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${t}`),null;let l=Mi();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${t}`),null;let p=(L=i.width)!=null?L:300,f=(A=i.height)!=null?A:300,u=(v=o.scale)!=null?v:1,d=(k=(M=o.position)==null?void 0:M.x)!=null?k:0,m=(F=(D=o.position)==null?void 0:D.y)!=null?F:0,h=(W=o.rotation)!=null?W:0,g=(O=r.z_index)!=null?O:100,b=(I=r.alpha)!=null?I:1,w=document.createElement("div");w.style.cssText=`
18
+ position: absolute;
19
+ top: calc(50% + ${m}px);
20
+ left: calc(50% + ${d}px);
21
+ transform: translate(-50%, -50%) scale(${u}) rotate(${h}deg);
22
+ width: ${p}px;
23
+ height: ${f}px;
24
+ pointer-events: none;
25
+ z-index: ${g};
26
+ opacity: ${b};
27
+ `,e.appendChild(w);let S=l.loadAnimation({container:w,renderer:i.renderer||"svg",loop:(Y=i.loop)!=null?Y:!1,autoplay:(Pe=i.autoplay)!=null?Pe:!0,animationData:c});i.speed!==void 0&&S.setSpeed(i.speed);let T=()=>{S.destroy(),w.parentNode&&w.parentNode.removeChild(w)};return i.loop||S.addEventListener("complete",T),{animation:S,cleanup:T}}var ee=require("pixi.js");var X=class{static get(e){var n;return(n=this.store.get(e))==null?void 0:n.data}static set(e,n){this.store.set(e,{data:n})}static has(e){return this.store.has(e)}static clear(){this.store.clear()}};X.store=new Map;var Di=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] MODULE LOADED - __BUILD_MODE__: ${Di}`);var _e={},ut=null;async function Oi(){if(console.log(`[AssetLoader] getInlineAssets() called - __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`),Object.keys(_e).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(_e)),_e;if(!ut){let e=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",e),ut=(async()=>{try{try{let i=await import(e+"?t="+Date.now());if(i.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(i.INLINE_ASSETS)),i.INLINE_ASSETS}catch(i){console.warn("[AssetLoader] ES module import failed, trying text parse:",i)}let n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);let a=await n.text();console.log("[AssetLoader] Received JS code, length:",a.length);let s=a.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(s)try{let i=s[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let o=new Function("return "+i)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(o)),o}catch(i){return console.warn("[AssetLoader] Failed to parse inline assets:",i),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",a.substring(0,500)),{}}catch(n){return console.warn("[AssetLoader] Failed to load inline assets:",n),{}}})()}return _e=await ut,console.log("[AssetLoader] Final inline assets cache:",Object.keys(_e)),_e}var wa=new Map;function pt(t){return t===null||typeof t!="object"||(Object.freeze(t),Object.values(t).forEach(e=>pt(e))),t}function Ci(t=64,e=64,n=16711680){let a=document.createElement("canvas");a.width=t,a.height=e;let s=a.getContext("2d");return s.fillStyle=`#${n.toString(16).padStart(6,"0")}`,s.fillRect(0,0,t,e),s.strokeStyle="#000",s.strokeRect(0,0,t,e),s.fillStyle="#fff",s.font="10px sans-serif",s.textAlign="center",s.fillText("MISSING",t/2,e/2),ee.Texture.from(a)}function je(t,e){wa.set(t,e)}var we=class{static async load(e,n,a){let s=X.get(e);if(s!==void 0)return s;let i=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] Loading asset: ${e}, type: ${n.type}, __BUILD_MODE__: ${i}`);let r=(await Oi())[e];if(console.log("[AssetLoader] Inline data for",e,":",r?"FOUND":"NOT FOUND"),i==="publish"&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!r))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${e}, path: ${n.path}`);let c=wa.get(n.type);if(c)try{let l=await c(n.path,r,e,a);return X.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}try{let l;switch(n.type){case"image":l=await this.loadImage(n.path,r);break;case"json":l=await this.loadJSON(n.path,r),l=pt(l);break;default:throw new Error(`Unknown asset type: ${n.type}`)}return X.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}}static async loadImage(e,n){let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=a==="publish";if(console.log(`[AssetLoader] loadImage - __BUILD_MODE__: ${a}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${e}`);if(!n.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${n.substring(0,50)}...`);try{return await ee.Assets.load(n)}catch(i){throw console.error("[AssetLoader] Failed to load texture from data URI:",i),i}}if(n&&n.startsWith("data:"))try{return await ee.Assets.load(n)}catch(i){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",i),await ee.Assets.load(e)}return await ee.Assets.load(e)}static async loadJSON(e,n){let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=a==="publish";if(console.log(`[AssetLoader] loadJSON - __BUILD_MODE__: ${a}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);if(n.startsWith("data:")){let o=atob(n.split(",")[1]);return JSON.parse(o)}return JSON.parse(n)}if(n){if(n.startsWith("data:")){let o=atob(n.split(",")[1]);return JSON.parse(o)}return JSON.parse(n)}let i=await fetch(e);if(!i.ok)throw new Error(`JSON fetch failed: ${e}`);return i.json()}static handleFailure(e,n,a){if(typeof __BUILD_MODE__!="undefined"&&__BUILD_MODE__==="dev"){let i=n==="image"?Ci():pt({__placeholder:!0,type:n});return X.set(e,i),i}throw a}};je("image",async(t,e)=>{let n=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",a=n==="publish";if(console.log(`[AssetLoader] registerType('image') - __BUILD_MODE__: ${n}, isPublishMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);return ee.Assets.load(e)}return ee.Assets.load(e||t)});je("json",async(t,e)=>{let n=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",a=n==="publish";if(console.log(`[AssetLoader] registerType('json') - __BUILD_MODE__: ${n}, isPublishMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e)}if(e)return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e);let s=await fetch(t);if(!s.ok)throw new Error(`JSON fetch failed: ${t}`);return s.json()});var Ce=require("pixi.js");var Qe=class{static async create(e,n,a){var c,l,p,f,u,d;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`);let i=(c=n==null?void 0:n.render)==null?void 0:c.asset;if(!i){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let m=new Ce.Container;return this.applyTransform(m,n==null?void 0:n.transform),m}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, type: ${i.type}, path: ${i.path}`);let o=await we.load(e,i,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(l=o==null?void 0:o.constructor)==null?void 0:l.name}`);let r;if(i.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),r=new Ce.Sprite(o),console.log("[ObjectFactory] Created object:",r,"type:",(p=r==null?void 0:r.constructor)==null?void 0:p.name),this.applyTransform(r,n==null?void 0:n.transform);else if(i.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name,o),o&&(((u=o.constructor)==null?void 0:u.name)==="Container"||o instanceof Ce.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let m=[i.path,`/assets/${i.path}`,`assets/${i.path}`,`../assets/${i.path}`],h=!1;for(let g of m)try{let b=await fetch(g);if(b.ok){r=await b.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",g,"type:",(d=r==null?void 0:r.constructor)==null?void 0:d.name),h=!0;break}}catch{continue}h||(console.error("[ObjectFactory] Failed to reload JSON from any path"),r=o)}else r=o;else r=o,r&&typeof r=="object"&&("x"in r||"position"in r)&&this.applyTransform(r,n==null?void 0:n.transform);return r}static applyTransform(e,n){var a,s,i,o;!n||!e||(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((i=n.position.x)!=null?i:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&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])))}};0&&(module.exports={AssetCache,AssetLoader,GameObject,GameObjectManager,ObjectFactory,Renderer,Transform,animateHandClick,animatePanelEntrance,createEndGamePanel,createHandTutorial,createPixiBase,createTutorialLabel,getRegisteredFontIds,playLottieOverlay,registerFont,registerType,resolveFont,resolveFontWeight,setLottieInstance,updateHandAnimation});
@@ -1 +1,11 @@
1
- import{b as lt}from"../chunk-SXCFRUYM.mjs";import{Application as Dn}from"pixi.js";async function Yn(e,t={}){let n=new Dn;await n.init({resizeTo:e,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let s=a=>{var c,d,p,u,h,l;let o=(p=(d=(c=a==null?void 0:a.width)!=null?c:e.clientWidth)!=null?d:window.innerWidth)!=null?p:320,r=(l=(h=(u=a==null?void 0:a.height)!=null?u:e.clientHeight)!=null?h:window.innerHeight)!=null?l:480;n.renderer.resize(o,r)};e.innerHTML="",e.style.position="relative",e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="stretch",e.style.width="100%",e.style.height="100dvh",e.style.minHeight="100vh",e.style.maxWidth="100%",e.style.maxHeight="100%",e.style.boxSizing="border-box",e.style.overflow="hidden",t.background&&(e.style.background=t.background),e.appendChild(n.canvas);let i=document.createElement("div");return i.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),e.appendChild(i),lt.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),lt.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),lt.on("resize",({payload:a})=>{s({width:a==null?void 0:a.width,height:a==null?void 0:a.height})}),window.addEventListener("resize",()=>s()),requestAnimationFrame(()=>s()),{app:n,stage:n.stage,overlay:i,applySize:s}}var ct=class{constructor(t){var n,s;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(n=t==null?void 0:t.scale)!=null?n:1,this.rotation=(s=t==null?void 0:t.rotation)!=null?s:0}update(t){t.position!==void 0&&(this.position={...t.position}),t.scale!==void 0&&(this.scale=t.scale),t.rotation!==void 0&&(this.rotation=t.rotation)}syncToPixi(t){t.position.set(this.position.x,this.position.y),t.scale.set(this.scale),t.rotation=this.rotation}},dt=class{constructor(t){var n,s,i,a;this.z_index=(n=t==null?void 0:t.z_index)!=null?n:0,this.alpha=(s=t==null?void 0:t.alpha)!=null?s:1,this.visible=(i=t==null?void 0:t.visible)!=null?i:!0,this.tint=(a=t==null?void 0:t.tint)!=null?a:null}update(t){t.z_index!==void 0&&(this.z_index=t.z_index),t.alpha!==void 0&&(this.alpha=t.alpha),t.visible!==void 0&&(this.visible=t.visible),t.tint!==void 0&&(this.tint=t.tint)}syncToPixi(t){t.zIndex=this.z_index,t.alpha=this.alpha,t.visible=this.visible,this.tint!==null&&"tint"in t&&(t.tint=this.tint)}},ht=class{constructor(t,n,s,i){this.instanceId=t,this.objectConfig=n,this.pixiObject=s,this._config=i,this.transform=new ct(i.transform),this.renderer=new dt(i.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject)}updateConfig(t){this._config=t,t.transform&&this.transform.update(t.transform),t.render&&this.renderer.update(t.render),this.sync()}getComponent(t){return this._config[t]}getPosition(){return{...this.transform.position}}setPosition(t,n){this.transform.position={x:t,y:n},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToPixi(this.pixiObject)}},gt=class{constructor(t){this.objects=new Map;this.config=t}create(t,n){let s=this.config.objects.get(t);if(!s)throw new Error(`Object config not found: ${t}`);let i=new ht(t,s.object_config||t,n,s);return this.objects.set(t,i),i}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[n,s]of this.objects.entries()){let i=t.objects.get(n);i&&s.updateConfig(i)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var pt={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function X(e){let t=pt[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function N(e){var n;let t=pt[e];return t&&(n=t.weight)!=null?n:"400"}function kn(e,t){pt[e]=t}function zn(){return Object.keys(pt)}import{Container as Mn,Graphics as ut,Text as tt,Sprite as Ge,Texture as _t}from"pixi.js";function Hn(e,t,n){var kt,zt,Mt,Ht,Wt,Rt,Bt,Lt,Gt,qt,Xt,Nt,$t,jt,Vt,Jt,Kt,Qt,Zt,Ot,It,Ut,te,ee,ne,ae,se,ie,oe,re,le,ce,de,he,pe,ue,me,fe,ye,ge,_e,be,xe,we,Te,Ce,Se,Ae,ve,Fe,Pe,Ee,De,Ye,ke,ze,Me,He,We,Re;let s=e.objects.get("ui_endgame_1"),i=e.objects.get("ui_endgame_logo_1"),a=e.objects.get("ui_endgame_title_1"),o=e.objects.get("ui_endgame_subtitle_1"),r=e.objects.get("ui_endgame_footer_1"),c=e.objects.get("ui_endgame_cta_1"),d=e.objects.get("ui_endgame_cta_hint_1"),p=e.objects.get("ui_endgame_hand_1"),u=e.engine.runtime||{},h=new Mn;h.alpha=0,h.visible=!1;let l=((kt=s==null?void 0:s.gameplay)==null?void 0:kt.tuning)||{},m=(s==null?void 0:s.render)||{},f=(zt=l.panel_width)!=null?zt:320,y=(Mt=l.panel_height)!=null?Mt:400,_=(Ht=l.panel_padding)!=null?Ht:32,b=(Wt=l.panel_radius)!=null?Wt:24,C=m.background_color||l.panel_bg_color||"#1a0a0a",x=m.background_alpha!==void 0&&m.background_alpha!==null?m.background_alpha:(Rt=l.panel_bg_alpha)!=null?Rt:.98,S=m.border_color||l.panel_border_color||"#ffffff",A=(Bt=l.panel_border_width)!=null?Bt:2,w=(Lt=l.panel_border_alpha)!=null?Lt:.3,T=new ut;T.roundRect(-f/2,-y/2,f,y,b);let g=C.replace("#","");T.fill({color:parseInt(g,16),alpha:x});let v=S.replace("#","");T.stroke({color:parseInt(v,16),width:A,alpha:w});let z=new ut;z.roundRect(-f/2+2,-y/2+2,f-4,y-4,b-2),z.stroke({color:16777215,width:1,alpha:.1}),T.addChild(z),h.addChild(T);let R=((Gt=i==null?void 0:i.gameplay)==null?void 0:Gt.tuning)||{},$=(i==null?void 0:i.transform)||{},M=(qt=R.logo_size)!=null?qt:56,B=(Xt=$.scale)!=null?Xt:1,V=($t=(Nt=$.offset)==null?void 0:Nt.y)!=null?$t:-130,je=(jt=R.logo_alpha)!=null?jt:1,F=new Ge(n||_t.EMPTY);F.anchor.set(.5);let K=0,Q=0;if(n&&n!==_t.EMPTY){let P=n.frame,q=n.baseTexture;P&&P.width&&P.height?(K=P.width,Q=P.height):q&&q.width&&q.height?(K=q.width,Q=q.height):n.width&&n.height&&(K=n.width,Q=n.height)}if(K>0&&Q>0){let P=K/Q,q,yt;P>1?(q=M,yt=M/P):(yt=M,q=M*P);let Be=q/K,Le=yt/Q;Be*=B,Le*=B,F.scale.set(Be,Le)}else{let P=M/100*B;F.scale.set(P)}F.position.set(0,V),F.alpha=0,F.visible=!0,F.targetAlpha=je,F.baseScaleX=F.scale.x,F.baseScaleY=F.scale.y,h.addChild(F);let E=a==null?void 0:a.ui,H=((Vt=a==null?void 0:a.gameplay)==null?void 0:Vt.tuning)||{},Ve=(E==null?void 0:E.text)||"MISSION ACCOMPLISHED",wt=(E==null?void 0:E.font)||"brand.heading",Je=(E==null?void 0:E.fontSize)||24,Ke=(Jt=E==null?void 0:E.letterSpacing)!=null?Jt:1,et=(Kt=a==null?void 0:a.render)==null?void 0:Kt.tint,Qe=typeof et=="string"?et:et?`#${et.toString(16).padStart(6,"0")}`:"#00FF88",Tt=f-_*2-30,Ze=H.font_weight_override?H.font_weight_override:N(wt),j=new tt({text:Ve,style:{fontFamily:X(wt),fontSize:Je,fontWeight:Ze,fill:Qe,align:"center",letterSpacing:Ke,wordWrap:!1,stroke:{color:H.stroke_color||"#000000",width:(Qt=H.stroke_width)!=null?Qt:2},dropShadow:{color:H.shadow_color||"#000000",alpha:(Zt=H.shadow_alpha)!=null?Zt:.9,angle:(Ot=H.shadow_angle)!=null?Ot:0,blur:(It=H.shadow_blur)!=null?It:8,distance:(Ut=H.shadow_distance)!=null?Ut:4}}});if(j.width>Tt){let P=Tt/j.width;j.scale.set(P)}j.anchor.set(.5);let Ct=(te=l.title_offset_y)!=null?te:30,Oe=Ct+((ee=H.animation_start_y_offset)!=null?ee:-20);j.position.set(0,Oe),j.alpha=0,h.addChild(j);let D=o==null?void 0:o.ui,St=((ne=o==null?void 0:o.gameplay)==null?void 0:ne.tuning)||{},Ie=(D==null?void 0:D.text)||"RESCUE COMPLETE",At=(D==null?void 0:D.font)||"brand.body",Ue=(D==null?void 0:D.fontSize)||11,tn=(ae=D==null?void 0:D.letterSpacing)!=null?ae:.5,nt=(se=o==null?void 0:o.render)==null?void 0:se.tint,en=typeof nt=="string"?nt:nt?`#${nt.toString(16).padStart(6,"0")}`:"#B0B0B0",Z=new tt({text:Ie,style:{fontFamily:X(At),fontSize:Ue,fontWeight:N(At),fill:en,align:"center",letterSpacing:tn}});Z.anchor.set(.5);let nn=Ct+20+((ie=St.animation_start_y_offset)!=null?ie:-10);Z.position.set(0,nn),Z.alpha=0,Z.animationStartYOffset=(oe=St.animation_start_y_offset)!=null?oe:-10,h.addChild(Z);let L=r==null?void 0:r.ui,vt=((re=r==null?void 0:r.gameplay)==null?void 0:re.tuning)||{},an=(L==null?void 0:L.text)||((le=u.ui)==null?void 0:le.cta_hint)||"Continue the adventure!",Ft=(L==null?void 0:L.font)||"brand.body",sn=(L==null?void 0:L.fontSize)||16,at=(ce=r==null?void 0:r.render)==null?void 0:ce.tint,on=typeof at=="string"?at:at?`#${at.toString(16).padStart(6,"0")}`:"#FFFFFF",rn=(de=vt.max_width)!=null?de:f-_*2,ln=(he=vt.line_height)!=null?he:1.4,O=new tt({text:an,style:{fontFamily:X(Ft),fontSize:sn,fontWeight:N(Ft),fill:on,align:"center",wordWrap:!0,wordWrapWidth:rn,lineHeight:ln}});O.anchor.set(.5);let cn=(pe=l.footer_offset_y)!=null?pe:120;O.position.set(0,cn);let dn=((ue=r==null?void 0:r.render)==null?void 0:ue.alpha)!==void 0&&((me=r==null?void 0:r.render)==null?void 0:me.alpha)!==null?r.render.alpha:1;O.alpha=0,O.targetAlpha=dn,h.addChild(O);let G=((fe=c==null?void 0:c.gameplay)==null?void 0:fe.tuning)||{},Y=c==null?void 0:c.ui,st=(ye=G.button_width)!=null?ye:260,it=(ge=G.button_height)!=null?ge:56,Pt=(_e=G.button_radius)!=null?_e:16,hn=G.button_bg_color||((be=u.theme)==null?void 0:be.cta_background)||"#ffb43b",pn=(xe=G.button_bg_alpha)!=null?xe:1,un=G.button_border_color||"#ffffff",mn=(we=G.button_border_width)!=null?we:2,fn=(Te=G.button_border_alpha)!=null?Te:.2,ot=(Ce=l.cta_offset_y)!=null?Ce:160,W=new ut;W.roundRect(-st/2,-it/2,st,it,Pt);let yn=hn.replace("#","");W.fill({color:parseInt(yn,16),alpha:pn});let gn=un.replace("#","");W.stroke({color:parseInt(gn,16),width:mn,alpha:fn});let mt=new ut;mt.roundRect(-st/2+2,-it/2+2,st-4,it-4,Pt-2),mt.stroke({color:0,width:1,alpha:.15}),W.addChild(mt),W.position.set(0,ot),W.alpha=0,W.eventMode="static",W.cursor="pointer",h.addChild(W);let _n=(Y==null?void 0:Y.text)||((Se=u.ui)==null?void 0:Se.cta_label_end)||"DOWNLOAD",Et=(Y==null?void 0:Y.font)||"brand.heading",bn=(Y==null?void 0:Y.fontSize)||20,xn=G.button_text_color||((Ae=u.theme)==null?void 0:Ae.cta_text)||"#1a0a0a",U=new tt({text:_n,style:{fontFamily:X(Et),fontSize:bn,fontWeight:N(Et),fill:xn,align:"center",letterSpacing:(ve=Y==null?void 0:Y.letterSpacing)!=null?ve:1}});U.anchor.set(.5),U.position.set(0,ot),U.alpha=0,h.addChild(U);let k=d==null?void 0:d.ui,Dt=((Fe=d==null?void 0:d.gameplay)==null?void 0:Fe.tuning)||{},wn=(k==null?void 0:k.text)||"Play the full game",Yt=(k==null?void 0:k.font)||"brand.body",Tn=(k==null?void 0:k.fontSize)||11,Cn=(Pe=k==null?void 0:k.letterSpacing)!=null?Pe:0,rt=(Ee=d==null?void 0:d.render)==null?void 0:Ee.tint,Sn=typeof rt=="string"?rt:rt?`#${rt.toString(16).padStart(6,"0")}`:"#CCCCCC",I=new tt({text:wn,style:{fontFamily:X(Yt),fontSize:Tn,fontWeight:N(Yt),fill:Sn,align:"center",letterSpacing:Cn}});I.anchor.set(.5);let An=ot+35+((De=Dt.animation_start_y_offset)!=null?De:5);I.position.set(0,An),I.alpha=0,I.animationStartYOffset=(Ye=Dt.animation_start_y_offset)!=null?Ye:5,h.addChild(I);let ft=((ke=p==null?void 0:p.gameplay)==null?void 0:ke.tuning)||{},vn=(ze=ft.hand_offset_x)!=null?ze:50,Fn=(Me=ft.hand_offset_y)!=null?Me:50,Pn=(We=(He=p==null?void 0:p.transform)==null?void 0:He.scale)!=null?We:.1875,En=(Re=ft.hand_scale_multiplier)!=null?Re:2.5,J=new Ge(t||_t.EMPTY);return J.anchor.set(.5),J.scale.set(Pn*En),J.position.set(vn,ot+Fn),J.alpha=0,J.visible=!1,h.addChild(J),{panel:h,logo:F,title:j,subtitle:Z,footer:O,ctaButton:W,ctaText:U,ctaHint:I,hand:J}}function Wn(e,t,n){var A,w,T,g,v,z,R,$;let s=t.objects.get("ui_endgame_1"),i=((A=s==null?void 0:s.gameplay)==null?void 0:A.tuning)||{},a=(w=i.animation_duration_ms)!=null?w:800,o=(T=i.fade_in_duration_ms)!=null?T:600,r=(g=i.scale_animation_intensity)!=null?g:.1,c=(v=i.logo_animation_delay_ms)!=null?v:100,d=(z=i.title_animation_delay_ms)!=null?z:200,p=(R=i.footer_animation_delay_ms)!=null?R:300,u=($=i.cta_animation_delay_ms)!=null?$:400,{panel:h,logo:l,title:m,subtitle:f,footer:y,ctaButton:_,ctaText:b,ctaHint:C}=e;h.visible=!0;let x=Date.now(),S=()=>{let M=Date.now()-x,B=Math.min(M/o,1),V=1-Math.pow(1-B,3);h.alpha=V,h.scale.set(1+r*(1-V)),B<1?requestAnimationFrame(S):(setTimeout(()=>Rn(l,a,t),c),setTimeout(()=>{Bn(m,a),setTimeout(()=>Ln(f,a),50)},d),setTimeout(()=>Gn(y,a),p),setTimeout(()=>{qn(_,b,a),setTimeout(()=>Xn(C,a),50),n&&n()},u))};S()}function Rn(e,t,n){var h,l,m,f,y;let s=n==null?void 0:n.objects.get("ui_endgame_logo_1"),a=(l=(((h=s==null?void 0:s.gameplay)==null?void 0:h.tuning)||{}).animation_start_scale)!=null?l:1.2,o=Date.now(),r=e.alpha,c=(m=e.targetAlpha)!=null?m:1,d=(f=e.baseScaleX)!=null?f:e.scale.x,p=(y=e.baseScaleY)!=null?y:e.scale.y,u=()=>{let _=Date.now()-o,b=Math.min(_/t,1),C=1-Math.pow(1-b,2);e.alpha=r+(c-r)*C;let x=a+(1-a)*C;e.scale.set(d*x,p*x),b<1&&requestAnimationFrame(u)};u()}function Bn(e,t){let n=Date.now(),s=e.alpha,i=e.y,a=()=>{let o=Date.now()-n,r=Math.min(o/t,1),c=1-Math.pow(1-r,2);e.alpha=s+(1-s)*c,e.y=i-20*(1-c),r<1&&requestAnimationFrame(a)};a()}function Ln(e,t){var r;let n=Date.now(),s=e.alpha,i=e.position.y,a=i-((r=e.animationStartYOffset)!=null?r:-10),o=()=>{let c=Date.now()-n,d=Math.min(c/t,1),p=1-Math.pow(1-d,2);e.alpha=s+(1-s)*p,e.position.y=i+(a-i)*p,d<1&&requestAnimationFrame(o)};o()}function Gn(e,t){var o;let n=Date.now(),s=e.alpha,i=(o=e.targetAlpha)!=null?o:1,a=()=>{let r=Date.now()-n,c=Math.min(r/t,1),d=1-Math.pow(1-c,2);e.alpha=s+(i-s)*d,c<1&&requestAnimationFrame(a)};a()}function qn(e,t,n){let s=Date.now(),i=e.alpha,a=()=>{let o=Date.now()-s,r=Math.min(o/n,1),c=1-Math.pow(1-r,2);e.alpha=i+(1-i)*c,t.alpha=i+(1-i)*c,e.scale.set(1+.1*(1-c)),r<1&&requestAnimationFrame(a)};a()}function Xn(e,t){var r;let n=Date.now(),s=e.alpha,i=e.position.y,a=i-((r=e.animationStartYOffset)!=null?r:5),o=()=>{let c=Date.now()-n,d=Math.min(c/t,1),p=1-Math.pow(1-d,2);e.alpha=s+(1-s)*p,e.position.y=i+(a-i)*p,d<1&&requestAnimationFrame(o)};o()}function Nn(e,t,n,s){var p,u,h,l;let i=n.objects.get("ui_endgame_hand_1"),a=((p=i==null?void 0:i.gameplay)==null?void 0:p.tuning)||{},o=(u=a.click_animation_duration_ms)!=null?u:600,r=(h=a.click_delay_ms)!=null?h:2e3,c=(l=a.click_repeat_delay_ms)!=null?l:3e3,d=()=>{var A,w;e.visible=!0,e.alpha=1;let m=e.x,f=e.y,y=(A=a.hand_offset_x)!=null?A:50,_=(w=a.hand_offset_y)!=null?w:50,b=t.x+y,C=t.y+_,x=Date.now(),S=()=>{var M,B,V;let T=Date.now()-x,g=Math.min(T/o,1),v=g<.5?2*g*g:1-Math.pow(-2*g+2,2)/2;e.x=m+(b-m)*v,e.y=f+(C-f)*v;let z=(B=(M=i==null?void 0:i.transform)==null?void 0:M.scale)!=null?B:.1875,R=(V=a.hand_scale_multiplier)!=null?V:2.5,$=z*R;e.scale.set($+$*.2*Math.sin(g*Math.PI)),g<1?requestAnimationFrame(S):(t.scale.set(.95),setTimeout(()=>{t.scale.set(1),s()},100),setTimeout(()=>{e.alpha=0,setTimeout(()=>{e.x=m,e.y=f,d()},c)},500))};S()};setTimeout(d,r)}import{Sprite as $n,Text as jn}from"pixi.js";function Vn(e,t,n){var p,u,h,l;let s=t.objects.get("hand_tutorial_1"),i=((p=s==null?void 0:s.gameplay)==null?void 0:p.tuning)||{},a=(s==null?void 0:s.render)||{},o=(s==null?void 0:s.transform)||{},r=new $n(e);r.anchor.set(.5),r.alpha=0;let c=(u=i.hand_scale_multiplier)!=null?u:2.5,d=(h=o.scale)!=null?h:.1875;return r.scale.set(d*c),r.zIndex=(l=a.z_index)!=null?l:99999,r}function Jn(e){var m,f,y,_,b,C,x,S,A,w;let t=e.objects.get("ui_tutorial_1"),n=t==null?void 0:t.ui,s=(t==null?void 0:t.render)||{},i=((m=e.engine.runtime)==null?void 0:m.ui_styles)||{},a=((f=e.engine.runtime)==null?void 0:f.ui)||{},o=(n==null?void 0:n.text)||a.tutorial_label||a.label_text||"CLEAN!",r=(n==null?void 0:n.font)||"brand.warning",c=(n==null?void 0:n.fontSize)||i.label_font_size||52,d=(_=n==null?void 0:n.letterSpacing)!=null?_:(y=i.label_letter_spacing)!=null?y:-1,p=(n==null?void 0:n.align)||"center",u=s.tint,h=typeof u=="string"?u:u?`#${u.toString(16).padStart(6,"0")}`:i.label_fill||"#FFF1C1",l=new jn({text:o,style:{fontFamily:X(r),fontSize:c,fontWeight:N(r),fill:h,align:p,letterSpacing:d,stroke:{color:i.label_stroke||"#8B0000",width:2},dropShadow:{color:i.label_shadow_color||"#000000",alpha:(b=i.label_shadow_alpha)!=null?b:.8,angle:(C=i.label_shadow_angle)!=null?C:0,blur:(x=i.label_shadow_blur)!=null?x:4,distance:(S=i.label_shadow_distance)!=null?S:2}}});return l.anchor.set(.5,0),l.alpha=(A=s.alpha)!=null?A:0,l.visible=(w=s.visible)!=null?w:!0,l}function Kn(e,t,n,s,i){var c,d,p,u,h,l,m;let a=i.objects.get("hand_tutorial_1"),o=((c=a==null?void 0:a.gameplay)==null?void 0:c.tuning)||{},r=(a==null?void 0:a.transform)||{};if(!s){let f=(d=o.animation_duration)!=null?d:1.5,y=n%f/f,_=y<.5?2*y*y:-1+(4-2*y)*y,b=(p=o.x_offset)!=null?p:0,C=(u=o.y_offset)!=null?u:0,x=(h=o.animation_range)!=null?h:40,S=x*.7,A=x,w=t.x+b+S,T=t.y+C+A,g=w+S,v=T+A;e.x=w+(g-w)*_,e.y=T+(v-T)*_;let z=(l=r.scale)!=null?l:.1875,R=(m=o.hand_scale_multiplier)!=null?m:2.5;e.scale.set(z*R)}}import{Graphics as Qn,Assets as Xe,Texture as Zn,Rectangle as On,Color as qe}from"pixi.js";var bt=null,xt=null;async function Ne(){if(bt)return bt;if(!xt){let n=(()=>{if(typeof window!="undefined")try{return new URL("inline-assets.js",window.location.href).href}catch{return"./inline-assets.js"}return"./inline-assets.js"})();xt=new Function("path","return import(path)")(n).then(s=>s.INLINE_ASSETS||{}).catch(s=>(console.warn("[assets] Failed to load inline-assets.js:",s),{}))}let e=await xt;return bt=e||{},e||{}}function In(e,t){if(!e)return;let n=t[e];if(n)return n;let s=e.split("?")[0].split("#")[0];if(s!==e&&t[s])return t[s];let i=s.split("/").pop();if(i&&t[i])return t[i];let a=s.replace(/^\.?\/*/,"");if(a!==s&&t[a])return t[a]}function $e(e,t){let n=In(e,t);if(!n)throw new Error(`[assets] inline asset not found: ${e}`);return n}async function Un(e,t,n=16777215,s=!1){let i=await Ne(),a=$e(e,i);try{return await Xe.load(a)}catch{throw new Error(`[assets] inline asset failed to load: ${e}`)}}async function ta(e,t,n){var f,y,_,b,C,x,S,A,w,T;let s=await Ne(),i=$e(e,s),a;try{a=await Xe.load(i),console.log("[character] loaded sheet",{path:e,sourceUsed:i})}catch{throw new Error(`[assets] inline character sheet failed to load: ${e}`)}let o=a.source||a.baseTexture||a;o&&"valid"in o&&o.valid===!1&&typeof o.once=="function"&&await new Promise(g=>o.once("loaded",g));let r=n.gameplay.character_sheet||{},c=(f=r.cols)!=null?f:3,d=(y=r.rows)!=null?y:2,p=(x=(C=(_=o==null?void 0:o.width)!=null?_:o==null?void 0:o.pixelWidth)!=null?C:(b=o==null?void 0:o.baseTexture)==null?void 0:b.width)!=null?x:a.width,u=(T=(w=(S=o==null?void 0:o.height)!=null?S:o==null?void 0:o.pixelHeight)!=null?w:(A=o==null?void 0:o.baseTexture)==null?void 0:A.height)!=null?T:a.height,h=p/c,l=u/d;if(!Number.isFinite(h)||!Number.isFinite(l)||h<=0||l<=0||!o)return[a];let m=[];for(let g=0;g<d;g++)for(let v=0;v<c;v++)m.push(new Zn({source:o,frame:new On(v*h,g*l,h,l)}));return m.length>2&&m.push(...m.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:m.length}),m}function ea(e,t){var p,u,h,l;let n=t.gameplay.brush||{},s=new qe(t.theme.brush_color||"#ffffff").toNumber(),i=(p=n.radius)!=null?p:20,a=(u=n.inner_radius)!=null?u:15,o=(h=n.alpha)!=null?h:.8,r=(l=n.inner_alpha)!=null?l:.3,c=n.inner_color||"#ffffff",d=new Qn;return d.circle(0,0,i).fill({color:s,alpha:o}),d.circle(0,0,a).fill({color:new qe(c).toNumber(),alpha:r}),e.renderer.generateTexture(d)}export{ht as GameObject,gt as GameObjectManager,dt as Renderer,ct as Transform,Nn as animateHandClick,Wn as animatePanelEntrance,ea as createBrushTexture,Hn as createEndGamePanel,Vn as createHandTutorial,Yn as createPixiBase,Jn as createTutorialLabel,zn as getRegisteredFontIds,Un as loadAsset,ta as loadCharacterFrames,kn as registerFont,X as resolveFont,N as resolveFontWeight,Kn as updateHandAnimation};
1
+ import{b as ft}from"../chunk-UVBNGLP3.mjs";import{Application as Bn}from"pixi.js";async function Nn(n,t={}){let e=new Bn;await e.init({resizeTo:n,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let o=a=>{var c,l,u,h,p,d;let r=(u=(l=(c=a==null?void 0:a.width)!=null?c:n.clientWidth)!=null?l:window.innerWidth)!=null?u:320,i=(d=(p=(h=a==null?void 0:a.height)!=null?h:n.clientHeight)!=null?p:window.innerHeight)!=null?d:480;e.renderer.resize(r,i)};n.innerHTML="",n.style.position="relative",n.style.display="flex",n.style.flexDirection="column",n.style.alignItems="stretch",n.style.width="100%",n.style.height="100dvh",n.style.minHeight="100vh",n.style.maxWidth="100%",n.style.maxHeight="100%",n.style.boxSizing="border-box",n.style.overflow="hidden",t.background&&(n.style.background=t.background),n.appendChild(e.canvas);let s=document.createElement("div");return s.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),n.appendChild(s),ft.on("pause",()=>{e.ticker.stop(),document.querySelectorAll("audio").forEach(r=>r.pause())}),ft.on("resume",()=>{e.ticker.start(),document.querySelectorAll("audio").forEach(r=>{r.currentTime>0&&!r.ended&&r.play().catch(()=>{})})}),ft.on("resize",({payload:a})=>{o({width:a==null?void 0:a.width,height:a==null?void 0:a.height})}),window.addEventListener("resize",()=>o()),requestAnimationFrame(()=>o()),{app:e,stage:e.stage,overlay:s,applySize:o}}var yt=class{constructor(t){var e,o;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(e=t==null?void 0:t.scale)!=null?e:1,this.rotation=(o=t==null?void 0:t.rotation)!=null?o:0}update(t){t.position!==void 0&&(this.position={...t.position}),t.scale!==void 0&&(this.scale=t.scale),t.rotation!==void 0&&(this.rotation=t.rotation)}syncToPixi(t){t.position.set(this.position.x,this.position.y),t.scale.set(this.scale),t.rotation=this.rotation}},mt=class{constructor(t){var e,o,s,a;this.z_index=(e=t==null?void 0:t.z_index)!=null?e:0,this.alpha=(o=t==null?void 0:t.alpha)!=null?o:1,this.visible=(s=t==null?void 0:t.visible)!=null?s:!0,this.tint=(a=t==null?void 0:t.tint)!=null?a:null}update(t){t.z_index!==void 0&&(this.z_index=t.z_index),t.alpha!==void 0&&(this.alpha=t.alpha),t.visible!==void 0&&(this.visible=t.visible),t.tint!==void 0&&(this.tint=t.tint)}syncToPixi(t){t.zIndex=this.z_index,t.alpha=this.alpha,t.visible=this.visible,this.tint!==null&&"tint"in t&&(t.tint=this.tint)}},_t=class{constructor(t,e,o,s){this.instanceId=t,this.objectConfig=e,this.pixiObject=o,this._config=s,this.transform=new yt(s.transform),this.renderer=new mt(s.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject)}updateConfig(t){this._config=t,t.transform&&this.transform.update(t.transform),t.render&&this.renderer.update(t.render),this.sync()}getComponent(t){return this._config[t]}getPosition(){return{...this.transform.position}}setPosition(t,e){this.transform.position={x:t,y:e},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToPixi(this.pixiObject)}},Tt=class{constructor(t){this.objects=new Map;this.config=t}create(t,e){let o=this.config.objects.get(t);if(!o)throw new Error(`Object config not found: ${t}`);let s=new _t(t,o.object_config||t,e,o);return this.objects.set(t,s),s}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[e,o]of this.objects.entries()){let s=t.objects.get(e);s&&o.updateConfig(s)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var gt={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function J(n){let t=gt[n];return t?t.family:(console.warn(`Font ID "${n}" not found in registry, using fallback`),"Arial, sans-serif")}function G(n){var e;let t=gt[n];return t&&(e=t.weight)!=null?e:"400"}function kn(n,t){gt[n]=t}function Rn(){return Object.keys(gt)}import{Container as In,Graphics as xt,Text as at,Sprite as Ve,Texture as At}from"pixi.js";function Yn(n,t,e){var Yt,zt,Ht,Wt,Jt,Gt,Xt,qt,Vt,Ut,Kt,Qt,Zt,jt,te,ee,ne,ae,se,oe,ie,re,le,ce,de,pe,ue,he,fe,ye,me,_e,ge,xe,be,we,Se,Te,Ae,Le,Ee,Me,ve,De,Ce,Oe,Fe,Pe,$e,Be,Ne,ke,Re,Ie,Ye,ze,He,We,Je,Ge;let o=n.objects.get("ui_endgame_1"),s=n.objects.get("ui_endgame_logo_1"),a=n.objects.get("ui_endgame_title_1"),r=n.objects.get("ui_endgame_subtitle_1"),i=n.objects.get("ui_endgame_footer_1"),c=n.objects.get("ui_endgame_cta_1"),l=n.objects.get("ui_endgame_cta_hint_1"),u=n.objects.get("ui_endgame_hand_1"),h=n.engine.runtime||{},p=new In;p.alpha=0,p.visible=!1;let d=((Yt=o==null?void 0:o.gameplay)==null?void 0:Yt.tuning)||{},f=(o==null?void 0:o.render)||{},y=(zt=d.panel_width)!=null?zt:320,m=(Ht=d.panel_height)!=null?Ht:400,g=(Wt=d.panel_padding)!=null?Wt:32,_=(Jt=d.panel_radius)!=null?Jt:24,x=f.background_color||d.panel_bg_color||"#1a0a0a",b=f.background_alpha!==void 0&&f.background_alpha!==null?f.background_alpha:(Gt=d.panel_bg_alpha)!=null?Gt:.98,T=f.border_color||d.panel_border_color||"#ffffff",A=(Xt=d.panel_border_width)!=null?Xt:2,w=(qt=d.panel_border_alpha)!=null?qt:.3,S=new xt;S.roundRect(-y/2,-m/2,y,m,_);let L=x.replace("#","");S.fill({color:parseInt(L,16),alpha:b});let C=T.replace("#","");S.stroke({color:parseInt(C,16),width:A,alpha:w});let E=new xt;E.roundRect(-y/2+2,-m/2+2,y-4,m-4,_-2),E.stroke({color:16777215,width:1,alpha:.1}),S.addChild(E),p.addChild(S);let O=((Vt=s==null?void 0:s.gameplay)==null?void 0:Vt.tuning)||{},k=(s==null?void 0:s.transform)||{},M=(Ut=O.logo_size)!=null?Ut:56,F=(Kt=k.scale)!=null?Kt:1,R=(Zt=(Qt=k.offset)==null?void 0:Qt.y)!=null?Zt:-130,it=(jt=O.logo_alpha)!=null?jt:1,v=new Ve(e||At.EMPTY);v.anchor.set(.5);let U=0,K=0;if(e&&e!==At.EMPTY){let D=e.frame,W=e.baseTexture;D&&D.width&&D.height?(U=D.width,K=D.height):W&&W.width&&W.height?(U=W.width,K=W.height):e.width&&e.height&&(U=e.width,K=e.height)}if(U>0&&K>0){let D=U/K,W,St;D>1?(W=M,St=M/D):(St=M,W=M*D);let Xe=W/U,qe=St/K;Xe*=F,qe*=F,v.scale.set(Xe,qe)}else{let D=M/100*F;v.scale.set(D)}v.position.set(0,R),v.alpha=0,v.visible=!0,v.targetAlpha=it,v.baseScaleX=v.scale.x,v.baseScaleY=v.scale.y,p.addChild(v);let P=a==null?void 0:a.ui,I=((te=a==null?void 0:a.gameplay)==null?void 0:te.tuning)||{},Qe=(P==null?void 0:P.text)||"MISSION ACCOMPLISHED",Dt=(P==null?void 0:P.font)||"brand.heading",Ze=(P==null?void 0:P.fontSize)||24,je=(ee=P==null?void 0:P.letterSpacing)!=null?ee:1,rt=(ne=a==null?void 0:a.render)==null?void 0:ne.tint,tn=typeof rt=="string"?rt:rt?`#${rt.toString(16).padStart(6,"0")}`:"#00FF88",Ct=y-g*2-30,en=I.font_weight_override?I.font_weight_override:G(Dt),q=new at({text:Qe,style:{fontFamily:J(Dt),fontSize:Ze,fontWeight:en,fill:tn,align:"center",letterSpacing:je,wordWrap:!1,stroke:{color:I.stroke_color||"#000000",width:(ae=I.stroke_width)!=null?ae:2},dropShadow:{color:I.shadow_color||"#000000",alpha:(se=I.shadow_alpha)!=null?se:.9,angle:(oe=I.shadow_angle)!=null?oe:0,blur:(ie=I.shadow_blur)!=null?ie:8,distance:(re=I.shadow_distance)!=null?re:4}}});if(q.width>Ct){let D=Ct/q.width;q.scale.set(D)}q.anchor.set(.5);let Ot=(le=d.title_offset_y)!=null?le:30,nn=Ot+((ce=I.animation_start_y_offset)!=null?ce:-20);q.position.set(0,nn),q.alpha=0,p.addChild(q);let $=r==null?void 0:r.ui,Ft=((de=r==null?void 0:r.gameplay)==null?void 0:de.tuning)||{},an=($==null?void 0:$.text)||"RESCUE COMPLETE",Pt=($==null?void 0:$.font)||"brand.body",sn=($==null?void 0:$.fontSize)||11,on=(pe=$==null?void 0:$.letterSpacing)!=null?pe:.5,lt=(ue=r==null?void 0:r.render)==null?void 0:ue.tint,rn=typeof lt=="string"?lt:lt?`#${lt.toString(16).padStart(6,"0")}`:"#B0B0B0",Q=new at({text:an,style:{fontFamily:J(Pt),fontSize:sn,fontWeight:G(Pt),fill:rn,align:"center",letterSpacing:on}});Q.anchor.set(.5);let ln=Ot+20+((he=Ft.animation_start_y_offset)!=null?he:-10);Q.position.set(0,ln),Q.alpha=0,Q.animationStartYOffset=(fe=Ft.animation_start_y_offset)!=null?fe:-10,p.addChild(Q);let z=i==null?void 0:i.ui,$t=((ye=i==null?void 0:i.gameplay)==null?void 0:ye.tuning)||{},cn=(z==null?void 0:z.text)||((me=h.ui)==null?void 0:me.cta_hint)||"Continue the adventure!",Bt=(z==null?void 0:z.font)||"brand.body",dn=(z==null?void 0:z.fontSize)||16,ct=(_e=i==null?void 0:i.render)==null?void 0:_e.tint,pn=typeof ct=="string"?ct:ct?`#${ct.toString(16).padStart(6,"0")}`:"#FFFFFF",un=(ge=$t.max_width)!=null?ge:y-g*2,hn=(xe=$t.line_height)!=null?xe:1.4,Z=new at({text:cn,style:{fontFamily:J(Bt),fontSize:dn,fontWeight:G(Bt),fill:pn,align:"center",wordWrap:!0,wordWrapWidth:un,lineHeight:hn}});Z.anchor.set(.5);let fn=(be=d.footer_offset_y)!=null?be:120;Z.position.set(0,fn);let yn=((we=i==null?void 0:i.render)==null?void 0:we.alpha)!==void 0&&((Se=i==null?void 0:i.render)==null?void 0:Se.alpha)!==null?i.render.alpha:1;Z.alpha=0,Z.targetAlpha=yn,p.addChild(Z);let H=((Te=c==null?void 0:c.gameplay)==null?void 0:Te.tuning)||{},B=c==null?void 0:c.ui,dt=(Ae=H.button_width)!=null?Ae:260,pt=(Le=H.button_height)!=null?Le:56,Nt=(Ee=H.button_radius)!=null?Ee:16,mn=H.button_bg_color||((Me=h.theme)==null?void 0:Me.cta_background)||"#ffb43b",_n=(ve=H.button_bg_alpha)!=null?ve:1,gn=H.button_border_color||"#ffffff",xn=(De=H.button_border_width)!=null?De:2,bn=(Ce=H.button_border_alpha)!=null?Ce:.2,ut=(Oe=d.cta_offset_y)!=null?Oe:160,Y=new xt;Y.roundRect(-dt/2,-pt/2,dt,pt,Nt);let wn=mn.replace("#","");Y.fill({color:parseInt(wn,16),alpha:_n});let Sn=gn.replace("#","");Y.stroke({color:parseInt(Sn,16),width:xn,alpha:bn});let bt=new xt;bt.roundRect(-dt/2+2,-pt/2+2,dt-4,pt-4,Nt-2),bt.stroke({color:0,width:1,alpha:.15}),Y.addChild(bt),Y.position.set(0,ut),Y.alpha=0,Y.eventMode="static",Y.cursor="pointer",p.addChild(Y);let Tn=(B==null?void 0:B.text)||((Fe=h.ui)==null?void 0:Fe.cta_label_end)||"DOWNLOAD",kt=(B==null?void 0:B.font)||"brand.heading",An=(B==null?void 0:B.fontSize)||20,Ln=H.button_text_color||((Pe=h.theme)==null?void 0:Pe.cta_text)||"#1a0a0a",nt=new at({text:Tn,style:{fontFamily:J(kt),fontSize:An,fontWeight:G(kt),fill:Ln,align:"center",letterSpacing:($e=B==null?void 0:B.letterSpacing)!=null?$e:1}});nt.anchor.set(.5),nt.position.set(0,ut),nt.alpha=0,p.addChild(nt);let N=l==null?void 0:l.ui,Rt=((Be=l==null?void 0:l.gameplay)==null?void 0:Be.tuning)||{},En=(N==null?void 0:N.text)||"Play the full game",It=(N==null?void 0:N.font)||"brand.body",Mn=(N==null?void 0:N.fontSize)||11,vn=(Ne=N==null?void 0:N.letterSpacing)!=null?Ne:0,ht=(ke=l==null?void 0:l.render)==null?void 0:ke.tint,Dn=typeof ht=="string"?ht:ht?`#${ht.toString(16).padStart(6,"0")}`:"#CCCCCC",j=new at({text:En,style:{fontFamily:J(It),fontSize:Mn,fontWeight:G(It),fill:Dn,align:"center",letterSpacing:vn}});j.anchor.set(.5);let Cn=ut+35+((Re=Rt.animation_start_y_offset)!=null?Re:5);j.position.set(0,Cn),j.alpha=0,j.animationStartYOffset=(Ie=Rt.animation_start_y_offset)!=null?Ie:5,p.addChild(j);let wt=((Ye=u==null?void 0:u.gameplay)==null?void 0:Ye.tuning)||{},On=(ze=wt.hand_offset_x)!=null?ze:50,Fn=(He=wt.hand_offset_y)!=null?He:50,Pn=(Je=(We=u==null?void 0:u.transform)==null?void 0:We.scale)!=null?Je:.1875,$n=(Ge=wt.hand_scale_multiplier)!=null?Ge:2.5,V=new Ve(t||At.EMPTY);return V.anchor.set(.5),V.scale.set(Pn*$n),V.position.set(On,ut+Fn),V.alpha=0,V.visible=!1,p.addChild(V),{panel:p,logo:v,title:q,subtitle:Q,footer:Z,ctaButton:Y,ctaText:nt,ctaHint:j,hand:V}}function zn(n,t,e){var A,w,S,L,C,E,O,k;let o=t.objects.get("ui_endgame_1"),s=((A=o==null?void 0:o.gameplay)==null?void 0:A.tuning)||{},a=(w=s.animation_duration_ms)!=null?w:800,r=(S=s.fade_in_duration_ms)!=null?S:600,i=(L=s.scale_animation_intensity)!=null?L:.1,c=(C=s.logo_animation_delay_ms)!=null?C:100,l=(E=s.title_animation_delay_ms)!=null?E:200,u=(O=s.footer_animation_delay_ms)!=null?O:300,h=(k=s.cta_animation_delay_ms)!=null?k:400,{panel:p,logo:d,title:f,subtitle:y,footer:m,ctaButton:g,ctaText:_,ctaHint:x}=n;p.visible=!0;let b=Date.now(),T=()=>{let M=Date.now()-b,F=Math.min(M/r,1),R=1-Math.pow(1-F,3);p.alpha=R,p.scale.set(1+i*(1-R)),F<1?requestAnimationFrame(T):(setTimeout(()=>Hn(d,a,t),c),setTimeout(()=>{Wn(f,a),setTimeout(()=>Jn(y,a),50)},l),setTimeout(()=>Gn(m,a),u),setTimeout(()=>{Xn(g,_,a),setTimeout(()=>qn(x,a),50),e&&e()},h))};T()}function Hn(n,t,e){var p,d,f,y,m;let o=e==null?void 0:e.objects.get("ui_endgame_logo_1"),a=(d=(((p=o==null?void 0:o.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?d:1.2,r=Date.now(),i=n.alpha,c=(f=n.targetAlpha)!=null?f:1,l=(y=n.baseScaleX)!=null?y:n.scale.x,u=(m=n.baseScaleY)!=null?m:n.scale.y,h=()=>{let g=Date.now()-r,_=Math.min(g/t,1),x=1-Math.pow(1-_,2);n.alpha=i+(c-i)*x;let b=a+(1-a)*x;n.scale.set(l*b,u*b),_<1&&requestAnimationFrame(h)};h()}function Wn(n,t){let e=Date.now(),o=n.alpha,s=n.y,a=()=>{let r=Date.now()-e,i=Math.min(r/t,1),c=1-Math.pow(1-i,2);n.alpha=o+(1-o)*c,n.y=s-20*(1-c),i<1&&requestAnimationFrame(a)};a()}function Jn(n,t){var i;let e=Date.now(),o=n.alpha,s=n.position.y,a=s-((i=n.animationStartYOffset)!=null?i:-10),r=()=>{let c=Date.now()-e,l=Math.min(c/t,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=s+(a-s)*u,l<1&&requestAnimationFrame(r)};r()}function Gn(n,t){var r;let e=Date.now(),o=n.alpha,s=(r=n.targetAlpha)!=null?r:1,a=()=>{let i=Date.now()-e,c=Math.min(i/t,1),l=1-Math.pow(1-c,2);n.alpha=o+(s-o)*l,c<1&&requestAnimationFrame(a)};a()}function Xn(n,t,e){let o=Date.now(),s=n.alpha,a=()=>{let r=Date.now()-o,i=Math.min(r/e,1),c=1-Math.pow(1-i,2);n.alpha=s+(1-s)*c,t.alpha=s+(1-s)*c,n.scale.set(1+.1*(1-c)),i<1&&requestAnimationFrame(a)};a()}function qn(n,t){var i;let e=Date.now(),o=n.alpha,s=n.position.y,a=s-((i=n.animationStartYOffset)!=null?i:5),r=()=>{let c=Date.now()-e,l=Math.min(c/t,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=s+(a-s)*u,l<1&&requestAnimationFrame(r)};r()}function Vn(n,t,e,o){var u,h,p,d;let s=e.objects.get("ui_endgame_hand_1"),a=((u=s==null?void 0:s.gameplay)==null?void 0:u.tuning)||{},r=(h=a.click_animation_duration_ms)!=null?h:600,i=(p=a.click_delay_ms)!=null?p:2e3,c=(d=a.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var A,w;n.visible=!0,n.alpha=1;let f=n.x,y=n.y,m=(A=a.hand_offset_x)!=null?A:50,g=(w=a.hand_offset_y)!=null?w:50,_=t.x+m,x=t.y+g,b=Date.now(),T=()=>{var M,F,R;let S=Date.now()-b,L=Math.min(S/r,1),C=L<.5?2*L*L:1-Math.pow(-2*L+2,2)/2;n.x=f+(_-f)*C,n.y=y+(x-y)*C;let E=(F=(M=s==null?void 0:s.transform)==null?void 0:M.scale)!=null?F:.1875,O=(R=a.hand_scale_multiplier)!=null?R:2.5,k=E*O;n.scale.set(k+k*.2*Math.sin(L*Math.PI)),L<1?requestAnimationFrame(T):(t.scale.set(.95),setTimeout(()=>{t.scale.set(1),o()},100),setTimeout(()=>{n.alpha=0,setTimeout(()=>{n.x=f,n.y=y,l()},c)},500))};T()};setTimeout(l,i)}import{Sprite as Un,Text as Kn}from"pixi.js";function Qn(n,t,e){var u,h,p,d;let o=t.objects.get("hand_tutorial_1"),s=((u=o==null?void 0:o.gameplay)==null?void 0:u.tuning)||{},a=(o==null?void 0:o.render)||{},r=(o==null?void 0:o.transform)||{},i=new Un(n);i.anchor.set(.5),i.alpha=0;let c=(h=s.hand_scale_multiplier)!=null?h:2.5,l=(p=r.scale)!=null?p:.1875;return i.scale.set(l*c),i.zIndex=(d=a.z_index)!=null?d:99999,i}function Zn(n){var f,y,m,g,_,x,b,T,A,w;let t=n.objects.get("ui_tutorial_1"),e=t==null?void 0:t.ui,o=(t==null?void 0:t.render)||{},s=((f=n.engine.runtime)==null?void 0:f.ui_styles)||{},a=((y=n.engine.runtime)==null?void 0:y.ui)||{},r=(e==null?void 0:e.text)||a.tutorial_label||a.label_text||"CLEAN!",i=(e==null?void 0:e.font)||"brand.warning",c=(e==null?void 0:e.fontSize)||s.label_font_size||52,l=(g=e==null?void 0:e.letterSpacing)!=null?g:(m=s.label_letter_spacing)!=null?m:-1,u=(e==null?void 0:e.align)||"center",h=o.tint,p=typeof h=="string"?h:h?`#${h.toString(16).padStart(6,"0")}`:s.label_fill||"#FFF1C1",d=new Kn({text:r,style:{fontFamily:J(i),fontSize:c,fontWeight:G(i),fill:p,align:u,letterSpacing:l,stroke:{color:s.label_stroke||"#8B0000",width:2},dropShadow:{color:s.label_shadow_color||"#000000",alpha:(_=s.label_shadow_alpha)!=null?_:.8,angle:(x=s.label_shadow_angle)!=null?x:0,blur:(b=s.label_shadow_blur)!=null?b:4,distance:(T=s.label_shadow_distance)!=null?T:2}}});return d.anchor.set(.5,0),d.alpha=(A=o.alpha)!=null?A:0,d.visible=(w=o.visible)!=null?w:!0,d}function jn(n,t,e,o,s){var c,l,u,h,p,d,f;let a=s.objects.get("hand_tutorial_1"),r=((c=a==null?void 0:a.gameplay)==null?void 0:c.tuning)||{},i=(a==null?void 0:a.transform)||{};if(!o){let y=(l=r.animation_duration)!=null?l:1.5,m=e%y/y,g=m<.5?2*m*m:-1+(4-2*m)*m,_=(u=r.x_offset)!=null?u:0,x=(h=r.y_offset)!=null?h:0,b=(p=r.animation_range)!=null?p:40,T=b*.7,A=b,w=t.x+_+T,S=t.y+x+A,L=w+T,C=S+A;n.x=w+(L-w)*g,n.y=S+(C-S)*g;let E=(d=i.scale)!=null?d:.1875,O=(f=r.hand_scale_multiplier)!=null?f:2.5;n.scale.set(E*O)}}var st=null;function ta(){return st||(typeof window!="undefined"&&window.lottie?st=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),st=null)),st}function ea(n){st=n}function na(n,t,e,o){var T,A,w,S,L,C,E,O,k,M,F,R,it;let s=e.objects.get(n);if(!s)return console.warn(`[LottieOverlay] Object config not found: ${n}`),null;let a=((T=s.effects)==null?void 0:T.lottie)||{},r=s.transform||{},i=s.render||{};if(a.enabled===!1||i.visible===!1)return null;let c=o[n];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${n}`),null;let l=ta();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${n}`),null;let u=(A=a.width)!=null?A:300,h=(w=a.height)!=null?w:300,p=(S=r.scale)!=null?S:1,d=(C=(L=r.position)==null?void 0:L.x)!=null?C:0,f=(O=(E=r.position)==null?void 0:E.y)!=null?O:0,y=(k=r.rotation)!=null?k:0,m=(M=i.z_index)!=null?M:100,g=(F=i.alpha)!=null?F:1,_=document.createElement("div");_.style.cssText=`
2
+ position: absolute;
3
+ top: calc(50% + ${f}px);
4
+ left: calc(50% + ${d}px);
5
+ transform: translate(-50%, -50%) scale(${p}) rotate(${y}deg);
6
+ width: ${u}px;
7
+ height: ${h}px;
8
+ pointer-events: none;
9
+ z-index: ${m};
10
+ opacity: ${g};
11
+ `,t.appendChild(_);let x=l.loadAnimation({container:_,renderer:a.renderer||"svg",loop:(R=a.loop)!=null?R:!1,autoplay:(it=a.autoplay)!=null?it:!0,animationData:c});a.speed!==void 0&&x.setSpeed(a.speed);let b=()=>{x.destroy(),_.parentNode&&_.parentNode.removeChild(_)};return a.loop||x.addEventListener("complete",b),{animation:x,cleanup:b}}import{Assets as et,Texture as aa}from"pixi.js";var X=class{static get(t){var e;return(e=this.store.get(t))==null?void 0:e.data}static set(t,e){this.store.set(t,{data:e})}static has(t){return this.store.has(t)}static clear(){this.store.clear()}};X.store=new Map;var sa=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] MODULE LOADED - __BUILD_MODE__: ${sa}`);var tt={},Lt=null;async function oa(){if(console.log(`[AssetLoader] getInlineAssets() called - __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`),Object.keys(tt).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(tt)),tt;if(!Lt){let t=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",t),Lt=(async()=>{try{try{let a=await import(t+"?t="+Date.now());if(a.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(a.INLINE_ASSETS)),a.INLINE_ASSETS}catch(a){console.warn("[AssetLoader] ES module import failed, trying text parse:",a)}let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);let o=await e.text();console.log("[AssetLoader] Received JS code, length:",o.length);let s=o.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(s)try{let a=s[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let r=new Function("return "+a)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(r)),r}catch(a){return console.warn("[AssetLoader] Failed to parse inline assets:",a),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",o.substring(0,500)),{}}catch(e){return console.warn("[AssetLoader] Failed to load inline assets:",e),{}}})()}return tt=await Lt,console.log("[AssetLoader] Final inline assets cache:",Object.keys(tt)),tt}var Ue=new Map;function Et(n){return n===null||typeof n!="object"||(Object.freeze(n),Object.values(n).forEach(t=>Et(t))),n}function ia(n=64,t=64,e=16711680){let o=document.createElement("canvas");o.width=n,o.height=t;let s=o.getContext("2d");return s.fillStyle=`#${e.toString(16).padStart(6,"0")}`,s.fillRect(0,0,n,t),s.strokeStyle="#000",s.strokeRect(0,0,n,t),s.fillStyle="#fff",s.font="10px sans-serif",s.textAlign="center",s.fillText("MISSING",n/2,t/2),aa.from(o)}function Mt(n,t){Ue.set(n,t)}var ot=class{static async load(t,e,o){let s=X.get(t);if(s!==void 0)return s;let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] Loading asset: ${t}, type: ${e.type}, __BUILD_MODE__: ${a}`);let i=(await oa())[t];if(console.log("[AssetLoader] Inline data for",t,":",i?"FOUND":"NOT FOUND"),a==="publish"&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!i))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${t}, path: ${e.path}`);let c=Ue.get(e.type);if(c)try{let l=await c(e.path,i,t,o);return X.set(t,l),l}catch(l){return this.handleFailure(t,e.type,l)}try{let l;switch(e.type){case"image":l=await this.loadImage(e.path,i);break;case"json":l=await this.loadJSON(e.path,i),l=Et(l);break;default:throw new Error(`Unknown asset type: ${e.type}`)}return X.set(t,l),l}catch(l){return this.handleFailure(t,e.type,l)}}static async loadImage(t,e){let o=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=o==="publish";if(console.log(`[AssetLoader] loadImage - __BUILD_MODE__: ${o}, isPublishMode: ${s}, inlineData: ${e?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${t}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);try{return await et.load(e)}catch(a){throw console.error("[AssetLoader] Failed to load texture from data URI:",a),a}}if(e&&e.startsWith("data:"))try{return await et.load(e)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await et.load(t)}return await et.load(t)}static async loadJSON(t,e){let o=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=o==="publish";if(console.log(`[AssetLoader] loadJSON - __BUILD_MODE__: ${o}, isPublishMode: ${s}, inlineData: ${e?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(e.startsWith("data:")){let r=atob(e.split(",")[1]);return JSON.parse(r)}return JSON.parse(e)}if(e){if(e.startsWith("data:")){let r=atob(e.split(",")[1]);return JSON.parse(r)}return JSON.parse(e)}let a=await fetch(t);if(!a.ok)throw new Error(`JSON fetch failed: ${t}`);return a.json()}static handleFailure(t,e,o){if(typeof __BUILD_MODE__!="undefined"&&__BUILD_MODE__==="dev"){let a=e==="image"?ia():Et({__placeholder:!0,type:e});return X.set(t,a),a}throw o}};Mt("image",async(n,t)=>{let e=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",o=e==="publish";if(console.log(`[AssetLoader] registerType('image') - __BUILD_MODE__: ${e}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),o){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${n}`);if(!t.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${t.substring(0,50)}...`);return et.load(t)}return et.load(t||n)});Mt("json",async(n,t)=>{let e=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",o=e==="publish";if(console.log(`[AssetLoader] registerType('json') - __BUILD_MODE__: ${e}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),o){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${n}`);return t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t)}if(t)return t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t);let s=await fetch(n);if(!s.ok)throw new Error(`JSON fetch failed: ${n}`);return s.json()});import{Sprite as ra,Container as Ke}from"pixi.js";var vt=class{static async create(t,e,o){var c,l,u,h,p,d;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`);let a=(c=e==null?void 0:e.render)==null?void 0:c.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let f=new Ke;return this.applyTransform(f,e==null?void 0:e.transform),f}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, type: ${a.type}, path: ${a.path}`);let r=await ot.load(t,a,o);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(l=r==null?void 0:r.constructor)==null?void 0:l.name}`);let i;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",t),i=new ra(r),console.log("[ObjectFactory] Created object:",i,"type:",(u=i==null?void 0:i.constructor)==null?void 0:u.name),this.applyTransform(i,e==null?void 0:e.transform);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(h=r==null?void 0:r.constructor)==null?void 0:h.name,r),r&&(((p=r.constructor)==null?void 0:p.name)==="Container"||r instanceof Ke)){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}`],y=!1;for(let m of f)try{let g=await fetch(m);if(g.ok){i=await g.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",m,"type:",(d=i==null?void 0:i.constructor)==null?void 0:d.name),y=!0;break}}catch{continue}y||(console.error("[ObjectFactory] Failed to reload JSON from any path"),i=r)}else i=r;else i=r,i&&typeof i=="object"&&("x"in i||"position"in i)&&this.applyTransform(i,e==null?void 0:e.transform);return i}static applyTransform(t,e){var o,s,a,r;!e||!t||(e.position&&("x"in t&&"y"in t?(t.x=(o=e.position.x)!=null?o:0,t.y=(s=e.position.y)!=null?s:0):"position"in t&&t.position&&t.position.set((a=e.position.x)!=null?a:0,(r=e.position.y)!=null?r:0)),e.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(e.scale):t.scale=e.scale),e.rotation!==void 0&&"rotation"in t&&(t.rotation=e.rotation),e.anchor&&"anchor"in t&&t.anchor&&Array.isArray(e.anchor)&&("set"in t.anchor?t.anchor.set(e.anchor[0],e.anchor[1]):(t.anchor.x=e.anchor[0],t.anchor.y=e.anchor[1])))}};export{X as AssetCache,ot as AssetLoader,_t as GameObject,Tt as GameObjectManager,vt as ObjectFactory,mt as Renderer,yt as Transform,Vn as animateHandClick,zn as animatePanelEntrance,Yn as createEndGamePanel,Qn as createHandTutorial,Nn as createPixiBase,Zn as createTutorialLabel,Rn as getRegisteredFontIds,na as playLottieOverlay,kn as registerFont,Mt as registerType,J as resolveFont,G as resolveFontWeight,ea as setLottieInstance,jn as updateHandAnimation};