handler-playable-sdk 0.2.5 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-U4PCKCX6.mjs +17 -0
- package/dist/index.js +1 -17
- package/dist/index.mjs +1 -1
- package/dist/pixi/index.d.mts +134 -23
- package/dist/pixi/index.d.ts +134 -23
- package/dist/pixi/index.js +12 -2
- package/dist/pixi/index.mjs +11 -1
- package/dist/three/index.js +14 -14
- package/dist/three/index.mjs +1 -1
- package/package.json +10 -3
- package/dist/chunk-AOCUS265.mjs +0 -17
package/dist/pixi/index.js
CHANGED
|
@@ -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 Ai={};ti(Ai,{GameObject:()=>Ee,GameObjectManager:()=>Be,Renderer:()=>Ce,Transform:()=>Se,animateHandClick:()=>oa,animatePanelEntrance:()=>sa,createBrushTexture:()=>ma,createEndGamePanel:()=>ia,createHandTutorial:()=>ra,createPixiBase:()=>ta,createTutorialLabel:()=>la,getRegisteredFontIds:()=>aa,loadAsset:()=>pa,loadCharacterFrames:()=>fa,registerFont:()=>na,resolveFont:()=>K,resolveFontWeight:()=>X,updateHandAnimation:()=>ca});module.exports=ai(Ai);var ea=require("pixi.js");var ne={};function ze(e,t,n=!1){ne[e]||(ne[e]=[]),ne[e].push({fn:t,once:n})}function Je(e,t){if(ne[e]){if(!t){delete ne[e];return}ne[e]=ne[e].filter(n=>n.fn!==t)}}function Oe(e,...t){let n=ne[e];if(n)for(let a of[...n])a.fn(...t),a.once&&Je(e,a.fn)}function N(e,t){ze(e,t,!0)}var He={name:"handler-playable-sdk",version:"0.2.5",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 Y=0,si=Y++,Cn=Y++,En=Y++,kn=Y++,Pn=Y++,Dn=Y++,Fn=Y++,Mn=Y++,Ln=Y++,Rn=Y++,zn=Y++,On=Y++,_=si;function Hn(){return _===Cn}function Wn(){return _===En}function In(){return _===kn}function Nn(){return _===Pn}function ue(){return _===Dn}function pe(){return _===Fn}function Yn(){return _===Mn}function jn(){return _===Ln}function Bn(){return _===Rn}function Qe(){return _===zn}function Ze(){return _===On}function Gn(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),_=Cn;return}catch{}else if(e==="dapi")try{dapi.isReady(),_=En;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(_=kn)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(_=Pn)}catch{}else if(t==="mintegral")window.gameReady&&(_=Dn);else if(t==="tapjoy")window.TJ_API&&(_=Fn);else if(t==="tiktok")window.openAppStore&&(_=Mn);else if(t==="smadex")try{window.smxTracking&&(_=Ln)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(_=Rn)}catch{}else t==="vungle"?_=zn:(e==="nucleo"||t==="nucleo")&&(_=On)}var Jn={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),fe=null,we={...Jn},Qn="web_embed",ri={},Ue=!1,be=!1,ve=!1,Zn=!1,at=1,tt=0,Ye=!1,Z=!1,Ne="",me=Math.floor(window.innerWidth),he=Math.floor(window.innerHeight),nt=me>he,U=!1,xe=!1,Vn=!1,qn=!1,et=!1,We=null;function Kn(){if(fe)return fe;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),fe=e,e}function Ie(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Un(e,t){return{event_name:e,ts:Date.now(),session_id:oi,deployment_id:we.deployment_id,variant_id:we.variant_id,export_profile_id:we.profile_id,instance_id:we.instance_id||"default",env:Qn==="mraid"?"mraid":"web",payload:t}}function y(e,t){let n=Ie(e),a=Un(n,t);Oe(n,a),n!==e&&Oe(e,a)}function Te(){We&&(We(me,he),We=null)}function ye(e){at=e,y("volume",e)}function ge(e){e&&(Zn=!0),!ve&&(ve=!0,y("pause"),ye(0))}function Ae(e){!e&&Zn||ve&&(ve=!1,y("resume"),ye(at))}function ie(e,t){me=Math.floor(e||window.innerWidth),he=Math.floor(t||window.innerHeight),nt=me>he,y("resize",{width:me,height:he})}function li(){if(Hn())try{let e=mraid.getMaxSize();ie(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Ae():ge()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),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)}),Ye=!0,mraid.isViewable()&&mraid.getState()!=="hidden")U=!0,y("boot"),y("view"),y("ready"),Z=!0,Te();else{let n=()=>{U=!0,y("boot"),y("view"),y("ready"),Z=!0,Te()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function ci(){if(Wn())try{let e=dapi.getScreenSize();ie(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Ae():ge()}),dapi.addEventListener("adResized",n=>{let a=dapi.getScreenSize();ie(n.width||a.width,n.height||a.height)});let t=dapi.getAudioVolume();if(ye(t?1:0),dapi.addEventListener("audioVolumeChange",n=>ye(n?1:0)),Ye=!0,dapi.isViewable())U=!0,y("boot"),y("view"),y("ready"),Z=!0,Te();else{let n=()=>{U=!0,y("boot"),y("view"),y("ready"),Z=!0,Te()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function Xn(){let e=()=>{U||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(U=!0,y("boot"),y("view"),y("ready"),Z=!0,Te(),xe&&(xe=!1,ae.start()))};window.addEventListener("resize",()=>ie()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Ae(),e()):ge()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),Ye=!0}function di(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(Vn=!0),!(Vn&&t instanceof MouseEvent)&&(tt+=1,y("interaction",tt))};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(pe())(s=(i=window.TJ_API)==null?void 0:i.click)==null||s.call(i);else if(In())(r=(o=window.FbPlayableAd)==null?void 0:o.onCTAClick)==null||r.call(o);else if(Bn())(d=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||d.call(l);else if(jn())try{(f=(p=window.smxTracking)==null?void 0:p.redirect)==null||f.call(p)}catch(m){console.warn("Smadex redirect failed",m)}else if(Nn()){let m=window.ExitApi;m&&typeof m.exit=="function"?m.exit(e||Ne||""):e&&window.open(e)}else ue()?(u=window.install)==null||u.call(window):Yn()?(c=window.openAppStore)==null||c.call(window):Qe()?(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;N("view",()=>t(n.mraid_viewable)),N("start",()=>t(n.game_viewable)),N("engagement",()=>t(n.engagement));let a=()=>t(n.complete);N("complete",a),ze("engagement",i=>{var s;((s=i==null?void 0:i.payload)==null?void 0:s.count)>3&&a()}),N("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;N("view",()=>t(n.Ad_Load_Start)),N("start",()=>t(n.Ad_Viewable)),N("engagement",()=>t(n.First_Engagement)),N("complete",()=>t(n.Gameplay_Complete)),N("cta_click",()=>t(n.DSP_Click)),N("start",()=>{[5,10,15,20,25,30].forEach(a=>setTimeout(()=>t(n[`Spent_${a}_Seconds`]),a*1e3))})}}function fi(){if(!pe())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{ae.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(){ue()&&(window.mintGameStart=()=>{Ae(!0),ie()},window.mintGameClose=()=>{ge(!0)})}function hi(){if(!Ze())return;let e=window.NUC;!e||!e.trigger||(ae.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,Ne)}),ae.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var ae={init(e={},t){if(Qn=e.profile||"web_embed",ri=e.consent||{},we={...Jn,...e.ids||{}},fe=e.rootEl||fe,Ne=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(We=t),y("init"),document.body.oncontextmenu=()=>!1,Kn(),yi(fe),Gn(),li(),ci(),!Ye){if(document.readyState==="complete")Xn();else if(!qn){qn=!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;"),U&&!Z&&(y("boot"),y("view"),y("ready"),xe&&(xe=!1,ae.start()),Z=!0),Z=U},getRoot(){return Kn()},get version(){return He.version||"0.0.0"},get maxWidth(){return me},get maxHeight(){return he},get isLandscape(){return nt},get isReady(){return Z},get isStarted(){return Ue},get isPaused(){return ve},get isFinished(){return be},get volume(){return at},get interactions(){return tt},on(e,t){ze(Ie(e),t)},off(e,t){Je(Ie(e),t)},start(){var e,t;if(!Ue){if(!U){xe=!0;return}if(Ue=!0,y("start"),ie(),ue())ge(),(e=window.gameReady)==null||e.call(window);else if(pe()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:nt?"landscape":"portrait",buildID:He.version||"dev"})}}},finish(){var e,t;be||(be=!0,y("complete"),ue()?(e=window.gameEnd)==null||e.call(window):Qe()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):pe()&&$n())},install(e){if(!be){be=!0,pe()?($n(),setTimeout(()=>ae.install(e),300)):(y("complete"),setTimeout(()=>ae.install(e),0));return}et||(et=!0,setTimeout(()=>et=!1,500),y("cta_click"),y("conversion"),ui(e||Ne))},emit(e,t){let n=Ie(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=Un(n,t);Oe(n,a)},retry(){var e,t,n;if(ue())(e=window.gameRetry)==null||e.call(window);else if(Ze()){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(){ge(!0)},resume(){Ae(!0)},resize(e,t){ie(e,t)}},je=ae;function yi(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
1
|
+
"use strict";var lt=Object.defineProperty;var di=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var pi=Object.prototype.hasOwnProperty;var fi=(t,e)=>{for(var n in e)lt(t,n,{get:e[n],enumerable:!0})},hi=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ui(e))!pi.call(t,a)&&a!==n&<(t,a,{get:()=>e[a],enumerable:!(s=di(e,a))||s.enumerable});return t};var mi=t=>hi(lt({},"__esModule",{value:!0}),t);var Wi={};fi(Wi,{AssetCache:()=>Q,AssetLoader:()=>Te,GameObject:()=>Ne,GameObjectManager:()=>Ue,ObjectFactory:()=>st,Renderer:()=>De,Transform:()=>Pe,animateHandClick:()=>bs,animatePanelEntrance:()=>_s,createEndGamePanel:()=>gs,createHandTutorial:()=>ws,createPixiBase:()=>hs,createTutorialLabel:()=>xs,getRegisteredFontIds:()=>ys,playLottieOverlay:()=>Ts,registerFont:()=>ms,registerType:()=>nt,resolveFont:()=>X,resolveFontWeight:()=>K,setLottieInstance:()=>As,updateHandAnimation:()=>Ss});module.exports=mi(Wi);var fs=require("pixi.js");var re={};function Ge(t,e,n=!1){re[t]||(re[t]=[]),re[t].push({fn:e,once:n})}function ct(t,e){if(re[t]){if(!e){delete re[t];return}re[t]=re[t].filter(n=>n.fn!==e)}}function Je(t,...e){let n=re[t];if(n)for(let s of[...n])s.fn(...e),s.once&&ct(t,s.fn)}function q(t,e){Ge(t,e,!0)}var je={name:"handler-playable-sdk",version:"0.3.1",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 G=0,gi=G++,Bn=G++,zn=G++,Hn=G++,Wn=G++,Yn=G++,qn=G++,Gn=G++,Jn=G++,jn=G++,Vn=G++,Xn=G++,S=gi;function Kn(){return S===Bn}function Qn(){return S===zn}function Zn(){return S===Hn}function Un(){return S===Wn}function ge(){return S===Yn}function _e(){return S===qn}function es(){return S===Gn}function ts(){return S===Jn}function ns(){return S===jn}function dt(){return S===Vn}function ut(){return S===Xn}function ss(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),S=Bn;return}catch{}else if(t==="dapi")try{dapi.isReady(),S=zn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(S=Hn)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(S=Wn)}catch{}else if(e==="mintegral")window.gameReady&&(S=Yn);else if(e==="tapjoy")window.TJ_API&&(S=qn);else if(e==="tiktok")window.openAppStore&&(S=Gn);else if(e==="smadex")try{window.smxTracking&&(S=Jn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(S=jn)}catch{}else e==="vungle"?S=Vn:(t==="nucleo"||e==="nucleo")&&(S=Xn)}var cs={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"},_i=Math.random().toString(36).slice(2),be=null,Le={...cs},ds="web_embed",bi={},pt=!1,Ee=!1,Oe=!1,us=!1,yt=1,ht=0,Qe=!1,ne=!1,Ke="",we=Math.floor(window.innerWidth),xe=Math.floor(window.innerHeight),mt=we>xe,se=!1,Me=!1,is=!1,as=!1,ft=!1,Ve=null;function os(){if(be)return be;let t=document.createElement("div");return t.id="handler-root",t.setAttribute("data-handler-root","true"),document.body.appendChild(t),be=t,t}function Xe(t){switch(t){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return t}}function ps(t,e){return{event_name:t,ts:Date.now(),session_id:_i,deployment_id:Le.deployment_id,variant_id:Le.variant_id,export_profile_id:Le.profile_id,instance_id:Le.instance_id||"default",env:ds==="mraid"?"mraid":"web",payload:e}}function y(t,e){let n=Xe(t),s=ps(n,e);Je(n,s),n!==t&&Je(t,s)}function Ce(){Ve&&(Ve(we,xe),Ve=null)}function Se(t){yt=t,y("volume",t)}function Ae(t){t&&(us=!0),!Oe&&(Oe=!0,y("pause"),Se(0))}function ke(t){!t&&us||Oe&&(Oe=!1,y("resume"),Se(yt))}function ce(t,e){we=Math.floor(t||window.innerWidth),xe=Math.floor(e||window.innerHeight),mt=we>xe,y("resize",{width:we,height:xe})}function wi(){if(Kn())try{let t=mraid.getMaxSize();ce(t.width,t.height);let e=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?ke():Ae()};if(mraid.addEventListener("viewableChange",e),mraid.addEventListener("stateChange",e),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();ce(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();Se(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&Se(n>0?1:0)}),mraid.addEventListener("error",(n,s)=>{console.warn("mraid error:",n,"action:",s)}),Qe=!0,mraid.isViewable()&&mraid.getState()!=="hidden")se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce();else{let n=()=>{se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce()};mraid.addEventListener("ready",n)}}catch(t){console.warn("MRAID hook skipped",t)}}function xi(){if(Qn())try{let t=dapi.getScreenSize();ce(t.width,t.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?ke():Ae()}),dapi.addEventListener("adResized",n=>{let s=dapi.getScreenSize();ce(n.width||s.width,n.height||s.height)});let e=dapi.getAudioVolume();if(Se(e?1:0),dapi.addEventListener("audioVolumeChange",n=>Se(n?1:0)),Qe=!0,dapi.isViewable())se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce();else{let n=()=>{se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce()};dapi.addEventListener("ready",n)}}catch(t){console.warn("DAPI hook skipped",t)}}function rs(){let t=()=>{se||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(se=!0,y("boot"),y("view"),y("ready"),ne=!0,Ce(),Me&&(Me=!1,le.start()))};window.addEventListener("resize",()=>ce()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(ke(),t()):Ae()}),document.readyState==="complete"||document.readyState==="interactive"?t():window.addEventListener("load",t),Qe=!0}function Si(){let t=e=>{typeof TouchEvent!="undefined"&&e instanceof TouchEvent&&(is=!0),!(is&&e instanceof MouseEvent)&&(ht+=1,y("interaction",ht))};document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)}function Ai(t){var s,a,i,o,r,c,l,u,h,p,d,m;let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(s=window.ExitApi)==null||s.exit();return}catch{}if(e==="mraid"&&typeof mraid!="undefined")mraid.open(t||"");else if(e==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(_e())(i=(a=window.TJ_API)==null?void 0:a.click)==null||i.call(a);else if(Zn())(r=(o=window.FbPlayableAd)==null?void 0:o.onCTAClick)==null||r.call(o);else if(ns())(l=(c=window.ScPlayableAd)==null?void 0:c.onCTAClick)==null||l.call(c);else if(ts())try{(h=(u=window.smxTracking)==null?void 0:u.redirect)==null||h.call(u)}catch(f){console.warn("Smadex redirect failed",f)}else if(Un()){let f=window.ExitApi;f&&typeof f.exit=="function"?f.exit(t||Ke||""):t&&window.open(t)}else ge()?(p=window.install)==null||p.call(window):es()?(d=window.openAppStore)==null||d.call(window):dt()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):t&&window.open(t)}function Ti(){let t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",e=n=>{if(!n)return;let s=new Image;s.src=n};if(t==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;q("view",()=>e(n.mraid_viewable)),q("start",()=>e(n.game_viewable)),q("engagement",()=>e(n.engagement));let s=()=>e(n.complete);q("complete",s),Ge("engagement",a=>{var i;((i=a==null?void 0:a.payload)==null?void 0:i.count)>3&&s()}),q("cta_click",()=>e(n.click))}else if(t==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;q("view",()=>e(n.Ad_Load_Start)),q("start",()=>e(n.Ad_Viewable)),q("engagement",()=>e(n.First_Engagement)),q("complete",()=>e(n.Gameplay_Complete)),q("cta_click",()=>e(n.DSP_Click)),q("start",()=>{[5,10,15,20,25,30].forEach(s=>setTimeout(()=>e(n[`Spent_${s}_Seconds`]),s*1e3))})}}function vi(){if(!_e())return;let t=window.TJ_API;t&&t.setPlayableAPI&&t.setPlayableAPI({skipAd:()=>{try{le.finish()}catch(e){console.warn("Tapjoy skip failed",e)}}})}function ls(){var e,n,s;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),(s=t==null?void 0:t.gameplayFinished)==null||s.call(t)}function Ei(){ge()&&(window.mintGameStart=()=>{ke(!0),ce()},window.mintGameClose=()=>{Ae(!0)})}function Li(){if(!ut())return;let t=window.NUC;!t||!t.trigger||(le.on("cta_click",()=>{var e,n;return(n=(e=t.trigger).convert)==null?void 0:n.call(e,Ke)}),le.on("complete",()=>{var e,n;return(n=(e=t.trigger).tryAgain)==null?void 0:n.call(e)}))}var le={init(t={},e){if(ds=t.profile||"web_embed",bi=t.consent||{},Le={...cs,...t.ids||{}},be=t.rootEl||be,Ke=t.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),e&&(Ve=e),y("init"),document.body.oncontextmenu=()=>!1,os(),Mi(be),ss(),wi(),xi(),!Qe){if(document.readyState==="complete")rs();else if(!as){as=!0;let n=()=>{rs(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Si(),Ti(),vi(),Ei(),Li(),console.log(`%c @handler/playable-sdk %c v${je.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;"),se&&!ne&&(y("boot"),y("view"),y("ready"),Me&&(Me=!1,le.start()),ne=!0),ne=se},getRoot(){return os()},get version(){return je.version||"0.0.0"},get maxWidth(){return we},get maxHeight(){return xe},get isLandscape(){return mt},get isReady(){return ne},get isStarted(){return pt},get isPaused(){return Oe},get isFinished(){return Ee},get volume(){return yt},get interactions(){return ht},on(t,e){Ge(Xe(t),e)},off(t,e){ct(Xe(t),e)},start(){var t,e;if(!pt){if(!se){Me=!0;return}if(pt=!0,y("start"),ce(),ge())Ae(),(t=window.gameReady)==null||t.call(window);else if(_e()){let n=window.TJ_API;(e=n==null?void 0:n.setPlayableBuild)==null||e.call(n,{orientation:mt?"landscape":"portrait",buildID:je.version||"dev"})}}},finish(){var t,e;Ee||(Ee=!0,y("complete"),ge()?(t=window.gameEnd)==null||t.call(window):dt()?(e=parent==null?void 0:parent.postMessage)==null||e.call(parent,"complete","*"):_e()&&ls())},install(t){if(!Ee){Ee=!0,_e()?(ls(),setTimeout(()=>le.install(t),300)):(y("complete"),setTimeout(()=>le.install(t),0));return}ft||(ft=!0,setTimeout(()=>ft=!1,500),y("cta_click"),y("conversion"),Ai(t||Ke))},emit(t,e){let n=Xe(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 s=ps(n,e);Je(n,s)},retry(){var t,e,n;if(ge())(t=window.gameRetry)==null||t.call(window);else if(ut()){let s=window.NUC;(n=(e=s==null?void 0:s.trigger)==null?void 0:e.tryAgain)==null||n.call(e)}y("engagement",{action:"retry"})},pause(){Ae(!0)},resume(){ke(!0)},resize(t,e){ce(t,e)}},Ze=le;function Mi(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 ta(e,t={}){let n=new ea.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),je.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),je.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),je.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 Se=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}},Ce=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)}},Ee=class{constructor(t,n,a,i){this.instanceId=t,this.objectConfig=n,this.pixiObject=a,this._config=i,this.transform=new Se(i.transform),this.renderer=new Ce(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)}},Be=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 Ee(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 Ge={"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 K(e){let t=Ge[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function X(e){var n;let t=Ge[e];return t&&(n=t.weight)!=null?n:"400"}function na(e,t){Ge[e]=t}function aa(){return Object.keys(Ge)}var b=require("pixi.js");function ia(e,t,n){var gt,_t,bt,wt,xt,vt,Tt,At,St,Ct,Et,kt,Pt,Dt,Ft,Mt,Lt,Rt,zt,Ot,Ht,Wt,It,Nt,Yt,jt,Bt,Gt,Vt,qt,Kt,Xt,$t,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,vn,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 b.Container;u.alpha=0,u.visible=!1;let c=((gt=a==null?void 0:a.gameplay)==null?void 0:gt.tuning)||{},h=(a==null?void 0:a.render)||{},m=(_t=c.panel_width)!=null?_t:320,g=(bt=c.panel_height)!=null?bt:400,x=(wt=c.panel_padding)!=null?wt:32,v=(xt=c.panel_radius)!=null?xt:24,w=h.background_color||c.panel_bg_color||"#1a0a0a",T=h.background_alpha!==void 0&&h.background_alpha!==null?h.background_alpha:(vt=c.panel_bg_alpha)!=null?vt:.98,E=h.border_color||c.panel_border_color||"#ffffff",k=(Tt=c.panel_border_width)!=null?Tt:2,A=(At=c.panel_border_alpha)!=null?At:.3,S=new b.Graphics;S.roundRect(-m/2,-g/2,m,g,v);let P=w.replace("#","");S.fill({color:parseInt(P,16),alpha:T});let L=E.replace("#","");S.stroke({color:parseInt(L,16),width:k,alpha:A});let D=new b.Graphics;D.roundRect(-m/2+2,-g/2+2,m-4,g-4,v-2),D.stroke({color:16777215,width:1,alpha:.1}),S.addChild(D),u.addChild(S);let R=((St=i==null?void 0:i.gameplay)==null?void 0:St.tuning)||{},B=(i==null?void 0:i.transform)||{},F=(Ct=R.logo_size)!=null?Ct:56,z=(Et=B.scale)!=null?Et:1,G=(Pt=(kt=B.offset)==null?void 0:kt.y)!=null?Pt:-130,ee=(Dt=R.logo_alpha)!=null?Dt:1,C=new b.Sprite(n||b.Texture.EMPTY);C.anchor.set(.5);let oe=0,re=0;if(n&&n!==b.Texture.EMPTY){let M=n.frame,Q=n.baseTexture;M&&M.width&&M.height?(oe=M.width,re=M.height):Q&&Q.width&&Q.height?(oe=Q.width,re=Q.height):n.width&&n.height&&(oe=n.width,re=n.height)}if(oe>0&&re>0){let M=oe/re,Q,Xe;M>1?(Q=F,Xe=F/M):(Xe=F,Q=F*M);let An=Q/oe,Sn=Xe/re;An*=z,Sn*=z,C.scale.set(An,Sn)}else{let M=F/100*z;C.scale.set(M)}C.position.set(0,G),C.alpha=0,C.visible=!0,C.targetAlpha=ee,C.baseScaleX=C.scale.x,C.baseScaleY=C.scale.y,u.addChild(C);let O=s==null?void 0:s.ui,V=((Ft=s==null?void 0:s.gameplay)==null?void 0:Ft.tuning)||{},ha=(O==null?void 0:O.text)||"MISSION ACCOMPLISHED",ot=(O==null?void 0:O.font)||"brand.heading",ya=(O==null?void 0:O.fontSize)||24,ga=(Mt=O==null?void 0:O.letterSpacing)!=null?Mt:1,ke=(Lt=s==null?void 0:s.render)==null?void 0:Lt.tint,_a=typeof ke=="string"?ke:ke?`#${ke.toString(16).padStart(6,"0")}`:"#00FF88",rt=m-x*2-30,ba=V.font_weight_override?V.font_weight_override:X(ot),te=new b.Text({text:ha,style:{fontFamily:K(ot),fontSize:ya,fontWeight:ba,fill:_a,align:"center",letterSpacing:ga,wordWrap:!1,stroke:{color:V.stroke_color||"#000000",width:(Rt=V.stroke_width)!=null?Rt:2},dropShadow:{color:V.shadow_color||"#000000",alpha:(zt=V.shadow_alpha)!=null?zt:.9,angle:(Ot=V.shadow_angle)!=null?Ot:0,blur:(Ht=V.shadow_blur)!=null?Ht:8,distance:(Wt=V.shadow_distance)!=null?Wt:4}}});if(te.width>rt){let M=rt/te.width;te.scale.set(M)}te.anchor.set(.5);let lt=(It=c.title_offset_y)!=null?It:30,wa=lt+((Nt=V.animation_start_y_offset)!=null?Nt:-20);te.position.set(0,wa),te.alpha=0,u.addChild(te);let H=o==null?void 0:o.ui,ct=((Yt=o==null?void 0:o.gameplay)==null?void 0:Yt.tuning)||{},xa=(H==null?void 0:H.text)||"RESCUE COMPLETE",dt=(H==null?void 0:H.font)||"brand.body",va=(H==null?void 0:H.fontSize)||11,Ta=(jt=H==null?void 0:H.letterSpacing)!=null?jt:.5,Pe=(Bt=o==null?void 0:o.render)==null?void 0:Bt.tint,Aa=typeof Pe=="string"?Pe:Pe?`#${Pe.toString(16).padStart(6,"0")}`:"#B0B0B0",le=new b.Text({text:xa,style:{fontFamily:K(dt),fontSize:va,fontWeight:X(dt),fill:Aa,align:"center",letterSpacing:Ta}});le.anchor.set(.5);let Sa=lt+20+((Gt=ct.animation_start_y_offset)!=null?Gt:-10);le.position.set(0,Sa),le.alpha=0,le.animationStartYOffset=(Vt=ct.animation_start_y_offset)!=null?Vt:-10,u.addChild(le);let $=r==null?void 0:r.ui,ut=((qt=r==null?void 0:r.gameplay)==null?void 0:qt.tuning)||{},Ca=($==null?void 0:$.text)||((Kt=f.ui)==null?void 0:Kt.cta_hint)||"Continue the adventure!",pt=($==null?void 0:$.font)||"brand.body",Ea=($==null?void 0:$.fontSize)||16,De=(Xt=r==null?void 0:r.render)==null?void 0:Xt.tint,ka=typeof De=="string"?De:De?`#${De.toString(16).padStart(6,"0")}`:"#FFFFFF",Pa=($t=ut.max_width)!=null?$t:m-x*2,Da=(Jt=ut.line_height)!=null?Jt:1.4,ce=new b.Text({text:Ca,style:{fontFamily:K(pt),fontSize:Ea,fontWeight:X(pt),fill:ka,align:"center",wordWrap:!0,wordWrapWidth:Pa,lineHeight:Da}});ce.anchor.set(.5);let Fa=(Qt=c.footer_offset_y)!=null?Qt:120;ce.position.set(0,Fa);let Ma=((Zt=r==null?void 0:r.render)==null?void 0:Zt.alpha)!==void 0&&((Ut=r==null?void 0:r.render)==null?void 0:Ut.alpha)!==null?r.render.alpha:1;ce.alpha=0,ce.targetAlpha=Ma,u.addChild(ce);let J=((en=l==null?void 0:l.gameplay)==null?void 0:en.tuning)||{},W=l==null?void 0:l.ui,Fe=(tn=J.button_width)!=null?tn:260,Me=(nn=J.button_height)!=null?nn:56,ft=(an=J.button_radius)!=null?an:16,La=J.button_bg_color||((sn=f.theme)==null?void 0:sn.cta_background)||"#ffb43b",Ra=(on=J.button_bg_alpha)!=null?on:1,za=J.button_border_color||"#ffffff",Oa=(rn=J.button_border_width)!=null?rn:2,Ha=(ln=J.button_border_alpha)!=null?ln:.2,Le=(cn=c.cta_offset_y)!=null?cn:160,q=new b.Graphics;q.roundRect(-Fe/2,-Me/2,Fe,Me,ft);let Wa=La.replace("#","");q.fill({color:parseInt(Wa,16),alpha:Ra});let Ia=za.replace("#","");q.stroke({color:parseInt(Ia,16),width:Oa,alpha:Ha});let qe=new b.Graphics;qe.roundRect(-Fe/2+2,-Me/2+2,Fe-4,Me-4,ft-2),qe.stroke({color:0,width:1,alpha:.15}),q.addChild(qe),q.position.set(0,Le),q.alpha=0,q.eventMode="static",q.cursor="pointer",u.addChild(q);let Na=(W==null?void 0:W.text)||((dn=f.ui)==null?void 0:dn.cta_label_end)||"DOWNLOAD",mt=(W==null?void 0:W.font)||"brand.heading",Ya=(W==null?void 0:W.fontSize)||20,ja=J.button_text_color||((un=f.theme)==null?void 0:un.cta_text)||"#1a0a0a",_e=new b.Text({text:Na,style:{fontFamily:K(mt),fontSize:Ya,fontWeight:X(mt),fill:ja,align:"center",letterSpacing:(pn=W==null?void 0:W.letterSpacing)!=null?pn:1}});_e.anchor.set(.5),_e.position.set(0,Le),_e.alpha=0,u.addChild(_e);let I=d==null?void 0:d.ui,ht=((fn=d==null?void 0:d.gameplay)==null?void 0:fn.tuning)||{},Ba=(I==null?void 0:I.text)||"Play the full game",yt=(I==null?void 0:I.font)||"brand.body",Ga=(I==null?void 0:I.fontSize)||11,Va=(mn=I==null?void 0:I.letterSpacing)!=null?mn:0,Re=(hn=d==null?void 0:d.render)==null?void 0:hn.tint,qa=typeof Re=="string"?Re:Re?`#${Re.toString(16).padStart(6,"0")}`:"#CCCCCC",de=new b.Text({text:Ba,style:{fontFamily:K(yt),fontSize:Ga,fontWeight:X(yt),fill:qa,align:"center",letterSpacing:Va}});de.anchor.set(.5);let Ka=Le+35+((yn=ht.animation_start_y_offset)!=null?yn:5);de.position.set(0,Ka),de.alpha=0,de.animationStartYOffset=(gn=ht.animation_start_y_offset)!=null?gn:5,u.addChild(de);let Ke=((_n=p==null?void 0:p.gameplay)==null?void 0:_n.tuning)||{},Xa=(bn=Ke.hand_offset_x)!=null?bn:50,$a=(wn=Ke.hand_offset_y)!=null?wn:50,Ja=(vn=(xn=p==null?void 0:p.transform)==null?void 0:xn.scale)!=null?vn:.1875,Qa=(Tn=Ke.hand_scale_multiplier)!=null?Tn:2.5,se=new b.Sprite(t||b.Texture.EMPTY);return se.anchor.set(.5),se.scale.set(Ja*Qa),se.position.set(Xa,Le+$a),se.alpha=0,se.visible=!1,u.addChild(se),{panel:u,logo:C,title:te,subtitle:le,footer:ce,ctaButton:q,ctaText:_e,ctaHint:de,hand:se}}function sa(e,t,n){var k,A,S,P,L,D,R,B;let a=t.objects.get("ui_endgame_1"),i=((k=a==null?void 0:a.gameplay)==null?void 0:k.tuning)||{},s=(A=i.animation_duration_ms)!=null?A:800,o=(S=i.fade_in_duration_ms)!=null?S:600,r=(P=i.scale_animation_intensity)!=null?P:.1,l=(L=i.logo_animation_delay_ms)!=null?L:100,d=(D=i.title_animation_delay_ms)!=null?D:200,p=(R=i.footer_animation_delay_ms)!=null?R:300,f=(B=i.cta_animation_delay_ms)!=null?B:400,{panel:u,logo:c,title:h,subtitle:m,footer:g,ctaButton:x,ctaText:v,ctaHint:w}=e;u.visible=!0;let T=Date.now(),E=()=>{let F=Date.now()-T,z=Math.min(F/o,1),G=1-Math.pow(1-z,3);u.alpha=G,u.scale.set(1+r*(1-G)),z<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,v,s),setTimeout(()=>vi(w,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,v=Math.min(x/t,1),w=1-Math.pow(1-v,2);e.alpha=r+(l-r)*w;let T=s+(1-s)*w;e.scale.set(d*T,p*T),v<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 vi(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 oa(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,A;e.visible=!0,e.alpha=1;let h=e.x,m=e.y,g=(k=s.hand_offset_x)!=null?k:50,x=(A=s.hand_offset_y)!=null?A:50,v=t.x+g,w=t.y+x,T=Date.now(),E=()=>{var F,z,G;let S=Date.now()-T,P=Math.min(S/o,1),L=P<.5?2*P*P:1-Math.pow(-2*P+2,2)/2;e.x=h+(v-h)*L,e.y=m+(w-m)*L;let D=(z=(F=i==null?void 0:i.transform)==null?void 0:F.scale)!=null?z:.1875,R=(G=s.hand_scale_multiplier)!=null?G:2.5,B=D*R;e.scale.set(B+B*.2*Math.sin(P*Math.PI)),P<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 Ve=require("pixi.js");function ra(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 Ve.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 la(e){var h,m,g,x,v,w,T,E,k,A;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 Ve.Text({text:o,style:{fontFamily:K(r),fontSize:l,fontWeight:X(r),fill:u,align:p,letterSpacing:d,stroke:{color:i.label_stroke||"#8B0000",width:2},dropShadow:{color:i.label_shadow_color||"#000000",alpha:(v=i.label_shadow_alpha)!=null?v:.8,angle:(w=i.label_shadow_angle)!=null?w:0,blur:(T=i.label_shadow_blur)!=null?T: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=(A=a.visible)!=null?A:!0,c}function ca(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,v=(p=o.x_offset)!=null?p:0,w=(f=o.y_offset)!=null?f:0,T=(u=o.animation_range)!=null?u:40,E=T*.7,k=T,A=t.x+v+E,S=t.y+w+k,P=A+E,L=S+k;e.x=A+(P-A)*x,e.y=S+(L-S)*x;let D=(c=r.scale)!=null?c:.1875,R=(h=o.hand_scale_multiplier)!=null?h:2.5;e.scale.set(D*R)}}var j=require("pixi.js"),it=null,st=null;async function da(){if(it)return it;if(!st){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"})();st=new Function("path","return import(path)")(n).then(a=>a?a.INLINE_ASSETS?a.INLINE_ASSETS:(console.warn("[assets] Module does not have INLINE_ASSETS export. Module keys:",Object.keys(a)),{}):(console.warn("[assets] Module import returned undefined"),{})).catch(a=>(console.warn("[assets] Failed to load inline-assets.js:",a),{}))}let e=await st;return it=e||{},e||{}}function Ti(e,t){if(!e)return;let n=t[e];if(n)return console.log("[assets] resolveInlineAsset: direct match",{path:e}),n;let a=e.split("?")[0].split("#")[0];if(a!==e&&t[a])return console.log("[assets] resolveInlineAsset: trimmed match",{path:e,trimmed:a}),t[a];let i=a.split("/").pop();if(i&&t[i])return console.log("[assets] resolveInlineAsset: filename match",{path:e,filename:i}),t[i];let s=a.replace(/^\.?\/*/,"");if(s!==a&&t[s])return console.log("[assets] resolveInlineAsset: normalized match",{path:e,normalized:s}),t[s];console.warn("[assets] resolveInlineAsset: no match found",{path:e,trimmed:a,filename:i,normalized:s,availableKeys:Object.keys(t).slice(0,10)})}function ua(e,t){let n=Ti(e,t);if(!n)throw new Error(`[assets] inline asset not found: ${e}`);return n}async function pa(e,t,n=16777215,a=!1){let i=await da(),s=ua(e,i);console.log("[assets] loadAsset",{path:e,resolvedSource:(s==null?void 0:s.substring(0,50))+"...",hasInlineMap:!!i,inlineMapKeys:Object.keys(i).length});try{let o=await j.Assets.load(s);return console.log("[assets] loadAsset success",{path:e,textureWidth:o.width,textureHeight:o.height}),o}catch(o){throw console.error("[assets] loadAsset failed",{path:e,source:s,error:o}),new Error(`[assets] inline asset failed to load: ${e}`)}}async function fa(e,t,n){var m,g,x,v,w,T,E,k,A,S,P,L,D,R,B,F,z,G;let a=await da(),i=ua(e,a),s;try{s=await j.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(ee=>o.once("loaded",ee));let r=((m=n==null?void 0:n.gameplay)==null?void 0:m.character_sheet)||((v=(x=(g=n==null?void 0:n.engine)==null?void 0:g.runtime)==null?void 0:x.gameplay)==null?void 0:v.character_sheet)||((k=(E=(T=(w=n==null?void 0:n.objects)==null?void 0:w.get)==null?void 0:T.call(w,"character_1"))==null?void 0:E.gameplay)==null?void 0:k.character_sheet)||{},l=(A=r.cols)!=null?A:3,d=(S=r.rows)!=null?S:2,p=(R=(D=(P=o==null?void 0:o.width)!=null?P:o==null?void 0:o.pixelWidth)!=null?D:(L=o==null?void 0:o.baseTexture)==null?void 0:L.width)!=null?R:s.width,f=(G=(z=(B=o==null?void 0:o.height)!=null?B:o==null?void 0:o.pixelHeight)!=null?z:(F=o==null?void 0:o.baseTexture)==null?void 0:F.height)!=null?G: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 ee=0;ee<d;ee++)for(let C=0;C<l;C++)h.push(new j.Texture({source:o,frame:new j.Rectangle(C*u,ee*c,u,c)}));return h.length>2&&h.push(...h.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:h.length}),h}function ma(e,t){var p,f,u,c;let n=t.gameplay.brush||{},a=new j.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 j.Graphics;return d.circle(0,0,i).fill({color:a,alpha:o}),d.circle(0,0,s).fill({color:new j.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 hs(t,e={}){let n=new fs.Application;await n.init({resizeTo:t,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let s=i=>{var c,l,u,h,p,d;if(!n.renderer)return;let o=(u=(l=(c=i==null?void 0:i.width)!=null?c:t.clientWidth)!=null?l:window.innerWidth)!=null?u:320,r=(d=(p=(h=i==null?void 0:i.height)!=null?h:t.clientHeight)!=null?p: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 a=document.createElement("div");return a.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(a),Ze.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),Ze.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),Ze.on("resize",({payload:i})=>{s({width:i==null?void 0:i.width,height:i==null?void 0:i.height})}),window.addEventListener("resize",()=>s()),requestAnimationFrame(()=>s()),{app:n,stage:n.stage,overlay:a,applySize:s}}var Pe=class{constructor(e){var n,s;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=(s=e==null?void 0:e.rotation)!=null?s: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}},De=class{constructor(e){var n,s,a,i;this.z_index=(n=e==null?void 0:e.z_index)!=null?n:0,this.alpha=(s=e==null?void 0:e.alpha)!=null?s:1,this.visible=(a=e==null?void 0:e.visible)!=null?a:!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)}},Ne=class{constructor(e,n,s,a){this.instanceId=e,this.objectConfig=n,this.pixiObject=s,this._config=a,this.transform=new Pe(a.transform),this.renderer=new De(a.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject),this.applyAnchor(),this.applyEffectsScale()}updateConfig(e){this._config=e,e.transform&&this.transform.update(e.transform),e.render&&this.renderer.update(e.render),this.sync()}applyAnchor(){var a,i,o,r;if(!this.pixiObject||!("anchor"in this.pixiObject)||!this.pixiObject.anchor)return;let e=(i=(a=this._config)==null?void 0:a.render)==null?void 0:i.anchor,n=(r=(o=this._config)==null?void 0:o.transform)==null?void 0:r.anchor,s=e&&typeof e=="object"?e:n&&typeof n=="object"?n:null;s&&typeof s.x=="number"&&typeof s.y=="number"&&this.pixiObject.anchor.set(s.x,s.y)}applyEffectsScale(){var i,o,r;if(!((i=this.pixiObject)!=null&&i.scale))return;let e=(o=this._config)==null?void 0:o.effects,n=typeof(e==null?void 0:e.scale_x)=="number"?e.scale_x:1,s=typeof(e==null?void 0:e.scale_y)=="number"?e.scale_y:1;if(n===1&&s===1)return;let a=(r=this.transform.scale)!=null?r:1;typeof this.pixiObject.scale.set=="function"?this.pixiObject.scale.set(a*n,a*s):(this.pixiObject.scale.x=a*n,this.pixiObject.scale.y=a*s)}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)}},Ue=class{constructor(e){this.objects=new Map;this.config=e}create(e,n){let s=this.config.objects.get(e);if(!s)throw new Error(`Object config not found: ${e}`);let a=new Ne(e,s.object_config||e,n,s);return this.objects.set(e,a),a}get(e){return this.objects.get(e)}updateConfig(e){this.config=e;for(let[n,s]of this.objects.entries()){let a=e.objects.get(n);a&&s.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(e){this.objects.delete(e)}clear(){this.objects.clear()}};var et={"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(t){let e=et[t];return e?e.family:(console.warn(`Font ID "${t}" not found in registry, using fallback`),"Arial, sans-serif")}function K(t){var n;let e=et[t];return e&&(n=e.weight)!=null?n:"400"}function ms(t,e){et[t]=e}function ys(){return Object.keys(et)}var A=require("pixi.js");function gs(t,e,n){var Ct,kt,Pt,Dt,Nt,It,Ft,$t,Rt,Bt,zt,Ht,Wt,Yt,qt,Gt,Jt,jt,Vt,Xt,Kt,Qt,Zt,Ut,en,tn,nn,sn,an,on,rn,ln,cn,dn,un,pn,fn,hn,mn,yn,gn,_n,bn,wn,xn,Sn,An,Tn,vn,En,Ln,Mn,On,Cn,kn,Pn,Dn,Nn,In,Fn;let s=t.objects.get("ui_endgame_1"),a=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"),u=t.objects.get("ui_endgame_hand_1"),h=t.engine.runtime||{},p=new A.Container;p.alpha=0,p.visible=!1;let d=((Ct=s==null?void 0:s.gameplay)==null?void 0:Ct.tuning)||{},m=(s==null?void 0:s.render)||{},f=(kt=d.panel_width)!=null?kt:320,g=(Pt=d.panel_height)!=null?Pt:400,L=(Dt=d.panel_padding)!=null?Dt:32,w=(Nt=d.panel_radius)!=null?Nt:24,T=m.background_color||d.panel_bg_color||"#1a0a0a",E=m.background_alpha!==void 0&&m.background_alpha!==null?m.background_alpha:(It=d.panel_bg_alpha)!=null?It:.98,M=m.border_color||d.panel_border_color||"#ffffff",O=(Ft=d.panel_border_width)!=null?Ft:2,C=($t=d.panel_border_alpha)!=null?$t:.3,v=new A.Graphics;v.roundRect(-f/2,-g/2,f,g,w);let _=T.replace("#","");v.fill({color:parseInt(_,16),alpha:E});let x=M.replace("#","");v.stroke({color:parseInt(x,16),width:O,alpha:C});let D=new A.Graphics;D.roundRect(-f/2+2,-g/2+2,f-4,g-4,w-2),D.stroke({color:16777215,width:1,alpha:.1}),v.addChild(D),p.addChild(v);let B=((Rt=a==null?void 0:a.gameplay)==null?void 0:Rt.tuning)||{},F=(a==null?void 0:a.transform)||{},P=(Bt=B.logo_size)!=null?Bt:56,N=(zt=F.scale)!=null?zt:1,$=(Wt=(Ht=F.offset)==null?void 0:Ht.y)!=null?Wt:-130,ue=(Yt=B.logo_alpha)!=null?Yt:1,k=new A.Sprite(n||A.Texture.EMPTY);k.anchor.set(.5);let J=0,j=0;if(n&&n!==A.Texture.EMPTY){let R=n.frame,te=n.baseTexture;R&&R.width&&R.height?(J=R.width,j=R.height):te&&te.width&&te.height?(J=te.width,j=te.height):n.width&&n.height&&(J=n.width,j=n.height)}if(J>0&&j>0){let R=J/j,te,rt;R>1?(te=P,rt=P/R):(rt=P,te=P*R);let $n=te/J,Rn=rt/j;$n*=N,Rn*=N,k.scale.set($n,Rn)}else{let R=P/100*N;k.scale.set(R)}k.position.set(0,$),k.alpha=0,k.visible=!0,k.targetAlpha=ue,k.baseScaleX=k.scale.x,k.baseScaleY=k.scale.y,p.addChild(k);let I=i==null?void 0:i.ui,z=((qt=i==null?void 0:i.gameplay)==null?void 0:qt.tuning)||{},it=(I==null?void 0:I.text)||"MISSION ACCOMPLISHED",$e=(I==null?void 0:I.font)||"brand.heading",Ms=(I==null?void 0:I.fontSize)||24,Os=(Gt=I==null?void 0:I.letterSpacing)!=null?Gt:1,Re=(Jt=i==null?void 0:i.render)==null?void 0:Jt.tint,Cs=typeof Re=="string"?Re:Re?`#${Re.toString(16).padStart(6,"0")}`:"#00FF88",wt=f-L*2-30,ks=z.font_weight_override?z.font_weight_override:K($e),oe=new A.Text({text:it,style:{fontFamily:X($e),fontSize:Ms,fontWeight:ks,fill:Cs,align:"center",letterSpacing:Os,wordWrap:!1,stroke:{color:z.stroke_color||"#000000",width:(jt=z.stroke_width)!=null?jt:2},dropShadow:{color:z.shadow_color||"#000000",alpha:(Vt=z.shadow_alpha)!=null?Vt:.9,angle:(Xt=z.shadow_angle)!=null?Xt:0,blur:(Kt=z.shadow_blur)!=null?Kt:8,distance:(Qt=z.shadow_distance)!=null?Qt:4}}});if(oe.width>wt){let R=wt/oe.width;oe.scale.set(R)}oe.anchor.set(.5);let xt=(Zt=d.title_offset_y)!=null?Zt:30,Ps=xt+((Ut=z.animation_start_y_offset)!=null?Ut:-20);oe.position.set(0,Ps),oe.alpha=0,p.addChild(oe);let H=o==null?void 0:o.ui,St=((en=o==null?void 0:o.gameplay)==null?void 0:en.tuning)||{},Ds=(H==null?void 0:H.text)||"RESCUE COMPLETE",At=(H==null?void 0:H.font)||"brand.body",Ns=(H==null?void 0:H.fontSize)||11,Is=(tn=H==null?void 0:H.letterSpacing)!=null?tn:.5,Be=(nn=o==null?void 0:o.render)==null?void 0:nn.tint,Fs=typeof Be=="string"?Be:Be?`#${Be.toString(16).padStart(6,"0")}`:"#B0B0B0",he=new A.Text({text:Ds,style:{fontFamily:X(At),fontSize:Ns,fontWeight:K(At),fill:Fs,align:"center",letterSpacing:Is}});he.anchor.set(.5);let $s=xt+20+((sn=St.animation_start_y_offset)!=null?sn:-10);he.position.set(0,$s),he.alpha=0,he.animationStartYOffset=(an=St.animation_start_y_offset)!=null?an:-10,p.addChild(he);let U=r==null?void 0:r.ui,Tt=((on=r==null?void 0:r.gameplay)==null?void 0:on.tuning)||{},Rs=(U==null?void 0:U.text)||((rn=h.ui)==null?void 0:rn.cta_hint)||"Continue the adventure!",vt=(U==null?void 0:U.font)||"brand.body",Bs=(U==null?void 0:U.fontSize)||16,ze=(ln=r==null?void 0:r.render)==null?void 0:ln.tint,zs=typeof ze=="string"?ze:ze?`#${ze.toString(16).padStart(6,"0")}`:"#FFFFFF",Hs=(cn=Tt.max_width)!=null?cn:f-L*2,Ws=(dn=Tt.line_height)!=null?dn:1.4,me=new A.Text({text:Rs,style:{fontFamily:X(vt),fontSize:Bs,fontWeight:K(vt),fill:zs,align:"center",wordWrap:!0,wordWrapWidth:Hs,lineHeight:Ws}});me.anchor.set(.5);let Ys=(un=d.footer_offset_y)!=null?un:120;me.position.set(0,Ys);let qs=((pn=r==null?void 0:r.render)==null?void 0:pn.alpha)!==void 0&&((fn=r==null?void 0:r.render)==null?void 0:fn.alpha)!==null?r.render.alpha:1;me.alpha=0,me.targetAlpha=qs,p.addChild(me);let ee=((hn=c==null?void 0:c.gameplay)==null?void 0:hn.tuning)||{},W=c==null?void 0:c.ui,He=(mn=ee.button_width)!=null?mn:260,We=(yn=ee.button_height)!=null?yn:56,Et=(gn=ee.button_radius)!=null?gn:16,Gs=ee.button_bg_color||((_n=h.theme)==null?void 0:_n.cta_background)||"#ffb43b",Js=(bn=ee.button_bg_alpha)!=null?bn:1,js=ee.button_border_color||"#ffffff",Vs=(wn=ee.button_border_width)!=null?wn:2,Xs=(xn=ee.button_border_alpha)!=null?xn:.2,Ye=(Sn=d.cta_offset_y)!=null?Sn:160,V=new A.Graphics;V.roundRect(-He/2,-We/2,He,We,Et);let Ks=Gs.replace("#","");V.fill({color:parseInt(Ks,16),alpha:Js});let Qs=js.replace("#","");V.stroke({color:parseInt(Qs,16),width:Vs,alpha:Xs});let at=new A.Graphics;at.roundRect(-He/2+2,-We/2+2,He-4,We-4,Et-2),at.stroke({color:0,width:1,alpha:.15}),V.addChild(at),V.position.set(0,Ye),V.alpha=0,V.eventMode="static",V.cursor="pointer",p.addChild(V);let Zs=(W==null?void 0:W.text)||((An=h.ui)==null?void 0:An.cta_label_end)||"DOWNLOAD",Lt=(W==null?void 0:W.font)||"brand.heading",Us=(W==null?void 0:W.fontSize)||20,ei=ee.button_text_color||((Tn=h.theme)==null?void 0:Tn.cta_text)||"#1a0a0a",ve=new A.Text({text:Zs,style:{fontFamily:X(Lt),fontSize:Us,fontWeight:K(Lt),fill:ei,align:"center",letterSpacing:(vn=W==null?void 0:W.letterSpacing)!=null?vn:1}});ve.anchor.set(.5),ve.position.set(0,Ye),ve.alpha=0,p.addChild(ve);let Y=l==null?void 0:l.ui,Mt=((En=l==null?void 0:l.gameplay)==null?void 0:En.tuning)||{},ti=(Y==null?void 0:Y.text)||"Play the full game",Ot=(Y==null?void 0:Y.font)||"brand.body",ni=(Y==null?void 0:Y.fontSize)||11,si=(Ln=Y==null?void 0:Y.letterSpacing)!=null?Ln:0,qe=(Mn=l==null?void 0:l.render)==null?void 0:Mn.tint,ii=typeof qe=="string"?qe:qe?`#${qe.toString(16).padStart(6,"0")}`:"#CCCCCC",ye=new A.Text({text:ti,style:{fontFamily:X(Ot),fontSize:ni,fontWeight:K(Ot),fill:ii,align:"center",letterSpacing:si}});ye.anchor.set(.5);let ai=Ye+35+((On=Mt.animation_start_y_offset)!=null?On:5);ye.position.set(0,ai),ye.alpha=0,ye.animationStartYOffset=(Cn=Mt.animation_start_y_offset)!=null?Cn:5,p.addChild(ye);let ot=((kn=u==null?void 0:u.gameplay)==null?void 0:kn.tuning)||{},oi=(Pn=ot.hand_offset_x)!=null?Pn:50,ri=(Dn=ot.hand_offset_y)!=null?Dn:50,li=(In=(Nn=u==null?void 0:u.transform)==null?void 0:Nn.scale)!=null?In:.1875,ci=(Fn=ot.hand_scale_multiplier)!=null?Fn:2.5,pe=new A.Sprite(e||A.Texture.EMPTY);return pe.anchor.set(.5),pe.scale.set(li*ci),pe.position.set(oi,Ye+ri),pe.alpha=0,pe.visible=!1,p.addChild(pe),{panel:p,logo:k,title:oe,subtitle:he,footer:me,ctaButton:V,ctaText:ve,ctaHint:ye,hand:pe}}function _s(t,e,n){var O,C,v,_,x,D,B,F;let s=e.objects.get("ui_endgame_1"),a=((O=s==null?void 0:s.gameplay)==null?void 0:O.tuning)||{},i=(C=a.animation_duration_ms)!=null?C:800,o=(v=a.fade_in_duration_ms)!=null?v:600,r=(_=a.scale_animation_intensity)!=null?_:.1,c=(x=a.logo_animation_delay_ms)!=null?x:100,l=(D=a.title_animation_delay_ms)!=null?D:200,u=(B=a.footer_animation_delay_ms)!=null?B:300,h=(F=a.cta_animation_delay_ms)!=null?F:400,{panel:p,logo:d,title:m,subtitle:f,footer:g,ctaButton:L,ctaText:w,ctaHint:T}=t;p.visible=!0;let E=Date.now(),M=()=>{let P=Date.now()-E,N=Math.min(P/o,1),$=1-Math.pow(1-N,3);p.alpha=$,p.scale.set(1+r*(1-$)),N<1?requestAnimationFrame(M):(setTimeout(()=>Oi(d,i,e),c),setTimeout(()=>{Ci(m,i),setTimeout(()=>ki(f,i),50)},l),setTimeout(()=>Pi(g,i),u),setTimeout(()=>{Di(L,w,i),setTimeout(()=>Ni(T,i),50),n&&n()},h))};M()}function Oi(t,e,n){var p,d,m,f,g;let s=n==null?void 0:n.objects.get("ui_endgame_logo_1"),i=(d=(((p=s==null?void 0:s.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?d:1.2,o=Date.now(),r=t.alpha,c=(m=t.targetAlpha)!=null?m:1,l=(f=t.baseScaleX)!=null?f:t.scale.x,u=(g=t.baseScaleY)!=null?g:t.scale.y,h=()=>{let L=Date.now()-o,w=Math.min(L/e,1),T=1-Math.pow(1-w,2);t.alpha=r+(c-r)*T;let E=i+(1-i)*T;t.scale.set(l*E,u*E),w<1&&requestAnimationFrame(h)};h()}function Ci(t,e){let n=Date.now(),s=t.alpha,a=t.y,i=()=>{let o=Date.now()-n,r=Math.min(o/e,1),c=1-Math.pow(1-r,2);t.alpha=s+(1-s)*c,t.y=a-20*(1-c),r<1&&requestAnimationFrame(i)};i()}function ki(t,e){var r;let n=Date.now(),s=t.alpha,a=t.position.y,i=a-((r=t.animationStartYOffset)!=null?r:-10),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),u=1-Math.pow(1-l,2);t.alpha=s+(1-s)*u,t.position.y=a+(i-a)*u,l<1&&requestAnimationFrame(o)};o()}function Pi(t,e){var o;let n=Date.now(),s=t.alpha,a=(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=s+(a-s)*l,c<1&&requestAnimationFrame(i)};i()}function Di(t,e,n){let s=Date.now(),a=t.alpha,i=()=>{let o=Date.now()-s,r=Math.min(o/n,1),c=1-Math.pow(1-r,2);t.alpha=a+(1-a)*c,e.alpha=a+(1-a)*c,t.scale.set(1+.1*(1-c)),r<1&&requestAnimationFrame(i)};i()}function Ni(t,e){var r;let n=Date.now(),s=t.alpha,a=t.position.y,i=a-((r=t.animationStartYOffset)!=null?r:5),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),u=1-Math.pow(1-l,2);t.alpha=s+(1-s)*u,t.position.y=a+(i-a)*u,l<1&&requestAnimationFrame(o)};o()}function bs(t,e,n,s){var u,h,p,d;let a=n.objects.get("ui_endgame_hand_1"),i=((u=a==null?void 0:a.gameplay)==null?void 0:u.tuning)||{},o=(h=i.click_animation_duration_ms)!=null?h:600,r=(p=i.click_delay_ms)!=null?p:2e3,c=(d=i.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var O,C;t.visible=!0,t.alpha=1;let m=t.x,f=t.y,g=(O=i.hand_offset_x)!=null?O:50,L=(C=i.hand_offset_y)!=null?C:50,w=e.x+g,T=e.y+L,E=Date.now(),M=()=>{var P,N,$;let v=Date.now()-E,_=Math.min(v/o,1),x=_<.5?2*_*_:1-Math.pow(-2*_+2,2)/2;t.x=m+(w-m)*x,t.y=f+(T-f)*x;let D=(N=(P=a==null?void 0:a.transform)==null?void 0:P.scale)!=null?N:.1875,B=($=i.hand_scale_multiplier)!=null?$:2.5,F=D*B;t.scale.set(F+F*.2*Math.sin(_*Math.PI)),_<1?requestAnimationFrame(M):(e.scale.set(.95),setTimeout(()=>{e.scale.set(1),s()},100),setTimeout(()=>{t.alpha=0,setTimeout(()=>{t.x=m,t.y=f,l()},c)},500))};M()};setTimeout(l,r)}var tt=require("pixi.js");function ws(t,e,n){var h,p,d,m;let s=e.objects.get("hand_tutorial_1")||e.objects.get("hand_1")||Array.from(e.objects.values()).find(f=>{var g;return((g=f==null?void 0:f.identity)==null?void 0:g.id)==="hand.tutorial"}),a=((h=s==null?void 0:s.gameplay)==null?void 0:h.tuning)||{},i=(s==null?void 0:s.render)||{},o=(s==null?void 0:s.transform)||{},r=new tt.Sprite(t),c=i==null?void 0:i.anchor;c&&typeof c.x=="number"&&typeof c.y=="number"?r.anchor.set(c.x,c.y):r.anchor.set(.5),r.alpha=0;let l=(p=a.hand_scale_multiplier)!=null?p:2.5,u=(d=o.scale)!=null?d:.1875;return r.scale.set(u*l),r.zIndex=(m=i.z_index)!=null?m:99999,r}function xs(t){var f,g,L,w,T,E,M,O,C,v;let e=t.objects.get("ui_tutorial_1")||t.objects.get("label_1")||Array.from(t.objects.values()).find(_=>{var x;return["ui.tutorial","label.warning"].includes((x=_==null?void 0:_.identity)==null?void 0:x.id)}),n=e==null?void 0:e.ui,s=(e==null?void 0:e.render)||{},a=((f=t.engine.runtime)==null?void 0:f.ui_styles)||{},i=((g=t.engine.runtime)==null?void 0:g.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)||a.label_font_size||52,l=(w=n==null?void 0:n.letterSpacing)!=null?w:(L=a.label_letter_spacing)!=null?L:-1,u=(n==null?void 0:n.align)||"center",h=s.tint,p=typeof h=="string"?h:h?`#${h.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",d=new tt.Text({text:o,style:{fontFamily:X(r),fontSize:c,fontWeight:K(r),fill:p,align:u,letterSpacing:l,stroke:{color:a.label_stroke||"#8B0000",width:2},dropShadow:{color:a.label_shadow_color||"#000000",alpha:(T=a.label_shadow_alpha)!=null?T:.8,angle:(E=a.label_shadow_angle)!=null?E:0,blur:(M=a.label_shadow_blur)!=null?M:4,distance:(O=a.label_shadow_distance)!=null?O:2}}}),m=s==null?void 0:s.anchor;return m&&typeof m.x=="number"&&typeof m.y=="number"?d.anchor.set(m.x,m.y):d.anchor.set(.5,.5),d.alpha=(C=s.alpha)!=null?C:0,d.visible=(v=s.visible)!=null?v:!0,d}function Ss(t,e,n,s,a){var c,l,u,h,p,d,m,f,g,L,w,T,E,M,O,C,v;let i=a.objects.get("hand_tutorial_1")||a.objects.get("hand_1")||Array.from(a.objects.values()).find(_=>{var x;return((x=_==null?void 0:_.identity)==null?void 0:x.id)==="hand.tutorial"}),o=((c=i==null?void 0:i.gameplay)==null?void 0:c.tuning)||{},r=(i==null?void 0:i.transform)||{};if(!s){let _=(l=o.animation_duration)!=null?l:1.5,x=n%_/_,D=x<.5?2*x*x:-1+(4-2*x)*x,B=(m=(d=(p=(u=r.position)==null?void 0:u.x)!=null?p:(h=r.offset)==null?void 0:h.x)!=null?d:o.start_x_offset)!=null?m:0,F=(T=(w=(L=(f=r.position)==null?void 0:f.y)!=null?L:(g=r.offset)==null?void 0:g.y)!=null?w:o.start_y_offset)!=null?T:0,P=(E=o.x_offset)!=null?E:0,N=(M=o.y_offset)!=null?M:0,$=(O=o.animation_range)!=null?O:40,ue=$*.7,k=$,J=e.x+B+P+ue,j=e.y+F+N+k,I=J+ue,z=j+k;t.x=J+(I-J)*D,t.y=j+(z-j)*D;let it=(C=r.scale)!=null?C:.1875,$e=(v=o.hand_scale_multiplier)!=null?v:2.5;t.scale.set(it*$e)}}var Ie=null;function Ii(){return Ie||(typeof window!="undefined"&&window.lottie?Ie=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),Ie=null)),Ie}function As(t){Ie=t}function Ts(t,e,n,s){var M,O,C,v,_,x,D,B,F,P,N,$,ue;let a=n.objects.get(t);if(!a)return console.warn(`[LottieOverlay] Object config not found: ${t}`),null;let i=((M=a.effects)==null?void 0:M.lottie)||{},o=a.transform||{},r=a.render||{};if(i.enabled===!1||r.visible===!1)return null;let c=s[t];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${t}`),null;let l=Ii();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${t}`),null;let u=(O=i.width)!=null?O:300,h=(C=i.height)!=null?C:300,p=(v=o.scale)!=null?v:1,d=(x=(_=o.position)==null?void 0:_.x)!=null?x:0,m=(B=(D=o.position)==null?void 0:D.y)!=null?B:0,f=(F=o.rotation)!=null?F:0,g=(P=r.z_index)!=null?P:100,L=(N=r.alpha)!=null?N: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(${p}) rotate(${f}deg);
|
|
22
|
+
width: ${u}px;
|
|
23
|
+
height: ${h}px;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
z-index: ${g};
|
|
26
|
+
opacity: ${L};
|
|
27
|
+
`,e.appendChild(w);let T=l.loadAnimation({container:w,renderer:i.renderer||"svg",loop:($=i.loop)!=null?$:!1,autoplay:(ue=i.autoplay)!=null?ue:!0,animationData:c});i.speed!==void 0&&T.setSpeed(i.speed);let E=()=>{T.destroy(),w.parentNode&&w.parentNode.removeChild(w)};return i.loop||T.addEventListener("complete",E),{animation:T,cleanup:E}}var ae=require("pixi.js");var Q=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()}};Q.store=new Map;function Fi(){var t,e;try{let n=typeof window!="undefined"&&(document.querySelector('script[src*="inline-assets.js"]')||((e=(t=document.querySelector("script"))==null?void 0:t.textContent)==null?void 0:e.includes("inline-assets.js"))||window.INLINE_ASSETS),s=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(n&&!s)}catch{return!1}}async function $i(){try{if(typeof window!="undefined"){let t=await fetch("./build-settings.json");if(t.ok){let e=await t.json();return console.log("[AssetLoader] Loaded build settings:",e),e}}}catch{}return null}function Ri(){try{if(typeof window!="undefined"){let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);return console.log("[AssetLoader] Loaded build settings (sync):",e),e}}}catch{}return null}var vs=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Es=Fi(),fe=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,b=Es?"publish":vs,Z=fe==null?void 0:fe.assetsInlined;fe!=null&&fe.buildMode&&(b=fe.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${b}`));var de=Ri();de!=null&&de.buildMode&&(b=de.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${b}`));(de==null?void 0:de.assetsInlined)!==void 0&&(Z=de.assetsInlined);$i().then(t=>{t!=null&&t.buildMode&&t.buildMode!==b&&(b=t.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${b}`)),(t==null?void 0:t.assetsInlined)!==void 0&&(Z=t.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${vs}, Runtime: ${Es?"publish":"dev"}, Effective: ${b}`);var ie={},gt=null;async function Bi(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${b}`),Object.keys(ie).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(ie)),ie;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),ie={...window.INLINE_ASSETS},ie;if(!(b==="publish"&&Z!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),ie;if(!gt){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),gt=(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 s=await n.text();console.log("[AssetLoader] Received JS code, length:",s.length);let a=s.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(a)try{let i=a[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:",s.substring(0,500)),{}}catch(n){return console.warn("[AssetLoader] Failed to load inline assets:",n),{}}})()}return ie=await gt,console.log("[AssetLoader] Final inline assets cache:",Object.keys(ie)),ie}var Ls=new Map;function _t(t){return t===null||typeof t!="object"||(Object.freeze(t),Object.values(t).forEach(e=>_t(e))),t}function zi(t=64,e=64,n=16711680){let s=document.createElement("canvas");s.width=t,s.height=e;let a=s.getContext("2d");return a.fillStyle=`#${n.toString(16).padStart(6,"0")}`,a.fillRect(0,0,t,e),a.strokeStyle="#000",a.strokeRect(0,0,t,e),a.fillStyle="#fff",a.font="10px sans-serif",a.textAlign="center",a.fillText("MISSING",t/2,e/2),ae.Texture.from(s)}function nt(t,e){Ls.set(t,e)}var Te=class{static async load(e,n,s){let a=Q.get(e);if(a!==void 0)return a;console.log(`[AssetLoader] Loading asset: ${e}, type: ${n.type}, Effective mode: ${b}`),console.log(`[AssetLoader] Window defined: ${typeof window!="undefined"}, INLINE_ASSETS exists: ${!!(typeof window!="undefined"&&window.INLINE_ASSETS)}, keys: ${typeof window!="undefined"&&window.INLINE_ASSETS?Object.keys(window.INLINE_ASSETS).length:"N/A"}`);let i=await Bi(),o=i[e];if(!o&&n.path){let l=n.path.split("/");if(l.length>=2){let u=l[l.length-1].split(".")[0],h=l[0],p=[`${u}.layer`,`${u}.player`,`${u}.tutorial`,`effects.${u}`,`ui.endgame.${u}`,u];for(let d of p)if(i[d]){o=i[d],console.log(`[AssetLoader] Found inline data for ${e} using derived key: ${d}`);break}}}if(console.log("[AssetLoader] Inline data for",e,":",o?"FOUND":"NOT FOUND"),b==="publish"&&Z!==!1&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!o))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${e}, path: ${n.path}`);let c=Ls.get(n.type);if(c)try{let l=await c(n.path,o,e,s);return Q.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,o);break;case"json":l=await this.loadJSON(n.path,o),l=_t(l);break;default:throw new Error(`Unknown asset type: ${n.type}`)}return Q.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}}static async loadImage(e,n){let s=b==="publish",a=s&&Z!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${b}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),a){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 ae.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 ae.Assets.load(n)}catch(i){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",i),await ae.Assets.load(e)}return await ae.Assets.load(e)}static async loadJSON(e,n){let s=b==="publish",a=s&&Z!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${b}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),a){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,s){if(b==="dev"){let i=n==="image"?zi():_t({__placeholder:!0,type:n});return Q.set(e,i),i}throw s}};nt("image",async(t,e)=>{let n=b==="publish",s=n&&Z!==!1,a=b==="brand",i=n&&Z===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${b}, isPublishMode: ${n}, isBrandMode: ${a}, 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:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);return ae.Assets.load(e)}let o=t;return(a||i)&&t&&!t.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(o=t,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${t}" as-is`)):(o=`assets/${t}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${t}" -> "${o}"`))),ae.Assets.load(e||o)});nt("json",async(t,e)=>{let n=b==="publish",s=n&&Z!==!1,a=b==="brand",i=n&&Z===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${b}, isPublishMode: ${n}, isBrandMode: ${a}, 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}`);return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e)}let o=t;if((a||i)&&t&&!t.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(o=t,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${t}" as-is`)):(o=`assets/${t}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${t}" -> "${o}"`))),e)return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e);let r=await fetch(o);if(!r.ok)throw new Error(`JSON fetch failed: ${t}`);return r.json()});var Fe=require("pixi.js");var Hi=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",bt=Hi;if(typeof window!="undefined")try{let t=new XMLHttpRequest;if(t.open("GET","./build-settings.json",!1),t.send(),t.status===200&&t.responseText){let e=JSON.parse(t.responseText);e!=null&&e.buildMode&&(bt=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${bt}`))}}catch{}var st=class{static async create(e,n,s){var r,c,l,u,h,p;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${bt}`);let a=(r=n==null?void 0:n.render)==null?void 0:r.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let d=new Fe.Container;return this.applyTransform(d,n==null?void 0:n.transform),d}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, type: ${a.type}, path: ${a.path}`);let i=await Te.load(e,a,s);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(c=i==null?void 0:i.constructor)==null?void 0:c.name}`);let o;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",i,"for object:",e),o=new Fe.Sprite(i),console.log("[ObjectFactory] Created object:",o,"type:",(l=o==null?void 0:o.constructor)==null?void 0:l.name),this.applyTransform(o,n==null?void 0:n.transform);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=i==null?void 0:i.constructor)==null?void 0:u.name,i),i&&(((h=i.constructor)==null?void 0:h.name)==="Container"||i instanceof Fe.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let d=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],m=!1;for(let f of d)try{let g=await fetch(f);if(g.ok){o=await g.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",f,"type:",(p=o==null?void 0:o.constructor)==null?void 0:p.name),m=!0;break}}catch{continue}m||(console.error("[ObjectFactory] Failed to reload JSON from any path"),o=i)}else o=i;else o=i,o&&typeof o=="object"&&("x"in o||"position"in o)&&this.applyTransform(o,n==null?void 0:n.transform);return o}static applyTransform(e,n){var s,a,i,o;!n||!e||(n.position&&("x"in e&&"y"in e?(e.x=(s=n.position.x)!=null?s:0,e.y=(a=n.position.y)!=null?a: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});
|
package/dist/pixi/index.mjs
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
import{b as ct}from"../chunk-AOCUS265.mjs";import{Application as kn}from"pixi.js";async function Mn(e,t={}){let n=new kn;await n.init({resizeTo:e,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let s=a=>{var c,d,u,p,h,l;let o=(u=(d=(c=a==null?void 0:a.width)!=null?c:e.clientWidth)!=null?d:window.innerWidth)!=null?u:320,r=(l=(h=(p=a==null?void 0:a.height)!=null?p: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),ct.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),ct.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),ct.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 dt=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}},ht=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)}},ut=class{constructor(t,n,s,i){this.instanceId=t,this.objectConfig=n,this.pixiObject=s,this._config=i,this.transform=new dt(i.transform),this.renderer=new ht(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)}},_t=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 ut(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 $(e){let t=pt[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function j(e){var n;let t=pt[e];return t&&(n=t.weight)!=null?n:"400"}function Dn(e,t){pt[e]=t}function zn(){return Object.keys(pt)}import{Container as Yn,Graphics as mt,Text as et,Sprite as Ne,Texture as bt}from"pixi.js";function Hn(e,t,n){var zt,Yt,Ht,Wt,Rt,Bt,Lt,Gt,Nt,qt,Xt,$t,jt,Kt,Vt,Jt,Qt,Zt,It,Ot,Ut,te,ee,ne,ae,se,ie,oe,re,le,ce,de,he,ue,pe,me,fe,ye,ge,_e,be,xe,we,Te,Se,Ce,Ae,ve,Fe,Pe,Ee,ke,Me,De,ze,Ye,He,We,Re,Be;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"),u=e.objects.get("ui_endgame_hand_1"),p=e.engine.runtime||{},h=new Yn;h.alpha=0,h.visible=!1;let l=((zt=s==null?void 0:s.gameplay)==null?void 0:zt.tuning)||{},m=(s==null?void 0:s.render)||{},f=(Yt=l.panel_width)!=null?Yt:320,y=(Ht=l.panel_height)!=null?Ht:400,_=(Wt=l.panel_padding)!=null?Wt:32,b=(Rt=l.panel_radius)!=null?Rt:24,g=m.background_color||l.panel_bg_color||"#1a0a0a",x=m.background_alpha!==void 0&&m.background_alpha!==null?m.background_alpha:(Bt=l.panel_bg_alpha)!=null?Bt:.98,C=m.border_color||l.panel_border_color||"#ffffff",A=(Lt=l.panel_border_width)!=null?Lt:2,w=(Gt=l.panel_border_alpha)!=null?Gt:.3,T=new mt;T.roundRect(-f/2,-y/2,f,y,b);let v=g.replace("#","");T.fill({color:parseInt(v,16),alpha:x});let k=C.replace("#","");T.stroke({color:parseInt(k,16),width:A,alpha:w});let F=new mt;F.roundRect(-f/2+2,-y/2+2,f-4,y-4,b-2),F.stroke({color:16777215,width:1,alpha:.1}),T.addChild(F),h.addChild(T);let M=((Nt=i==null?void 0:i.gameplay)==null?void 0:Nt.tuning)||{},R=(i==null?void 0:i.transform)||{},P=(qt=M.logo_size)!=null?qt:56,D=(Xt=R.scale)!=null?Xt:1,B=(jt=($t=R.offset)==null?void 0:$t.y)!=null?jt:-130,K=(Kt=M.logo_alpha)!=null?Kt:1,S=new Ne(n||bt.EMPTY);S.anchor.set(.5);let Q=0,Z=0;if(n&&n!==bt.EMPTY){let E=n.frame,X=n.baseTexture;E&&E.width&&E.height?(Q=E.width,Z=E.height):X&&X.width&&X.height?(Q=X.width,Z=X.height):n.width&&n.height&&(Q=n.width,Z=n.height)}if(Q>0&&Z>0){let E=Q/Z,X,gt;E>1?(X=P,gt=P/E):(gt=P,X=P*E);let Le=X/Q,Ge=gt/Z;Le*=D,Ge*=D,S.scale.set(Le,Ge)}else{let E=P/100*D;S.scale.set(E)}S.position.set(0,B),S.alpha=0,S.visible=!0,S.targetAlpha=K,S.baseScaleX=S.scale.x,S.baseScaleY=S.scale.y,h.addChild(S);let z=a==null?void 0:a.ui,L=((Vt=a==null?void 0:a.gameplay)==null?void 0:Vt.tuning)||{},Ke=(z==null?void 0:z.text)||"MISSION ACCOMPLISHED",Tt=(z==null?void 0:z.font)||"brand.heading",Ve=(z==null?void 0:z.fontSize)||24,Je=(Jt=z==null?void 0:z.letterSpacing)!=null?Jt:1,nt=(Qt=a==null?void 0:a.render)==null?void 0:Qt.tint,Qe=typeof nt=="string"?nt:nt?`#${nt.toString(16).padStart(6,"0")}`:"#00FF88",St=f-_*2-30,Ze=L.font_weight_override?L.font_weight_override:j(Tt),V=new et({text:Ke,style:{fontFamily:$(Tt),fontSize:Ve,fontWeight:Ze,fill:Qe,align:"center",letterSpacing:Je,wordWrap:!1,stroke:{color:L.stroke_color||"#000000",width:(Zt=L.stroke_width)!=null?Zt:2},dropShadow:{color:L.shadow_color||"#000000",alpha:(It=L.shadow_alpha)!=null?It:.9,angle:(Ot=L.shadow_angle)!=null?Ot:0,blur:(Ut=L.shadow_blur)!=null?Ut:8,distance:(te=L.shadow_distance)!=null?te:4}}});if(V.width>St){let E=St/V.width;V.scale.set(E)}V.anchor.set(.5);let Ct=(ee=l.title_offset_y)!=null?ee:30,Ie=Ct+((ne=L.animation_start_y_offset)!=null?ne:-20);V.position.set(0,Ie),V.alpha=0,h.addChild(V);let Y=o==null?void 0:o.ui,At=((ae=o==null?void 0:o.gameplay)==null?void 0:ae.tuning)||{},Oe=(Y==null?void 0:Y.text)||"RESCUE COMPLETE",vt=(Y==null?void 0:Y.font)||"brand.body",Ue=(Y==null?void 0:Y.fontSize)||11,tn=(se=Y==null?void 0:Y.letterSpacing)!=null?se:.5,at=(ie=o==null?void 0:o.render)==null?void 0:ie.tint,en=typeof at=="string"?at:at?`#${at.toString(16).padStart(6,"0")}`:"#B0B0B0",I=new et({text:Oe,style:{fontFamily:$(vt),fontSize:Ue,fontWeight:j(vt),fill:en,align:"center",letterSpacing:tn}});I.anchor.set(.5);let nn=Ct+20+((oe=At.animation_start_y_offset)!=null?oe:-10);I.position.set(0,nn),I.alpha=0,I.animationStartYOffset=(re=At.animation_start_y_offset)!=null?re:-10,h.addChild(I);let N=r==null?void 0:r.ui,Ft=((le=r==null?void 0:r.gameplay)==null?void 0:le.tuning)||{},an=(N==null?void 0:N.text)||((ce=p.ui)==null?void 0:ce.cta_hint)||"Continue the adventure!",Pt=(N==null?void 0:N.font)||"brand.body",sn=(N==null?void 0:N.fontSize)||16,st=(de=r==null?void 0:r.render)==null?void 0:de.tint,on=typeof st=="string"?st:st?`#${st.toString(16).padStart(6,"0")}`:"#FFFFFF",rn=(he=Ft.max_width)!=null?he:f-_*2,ln=(ue=Ft.line_height)!=null?ue:1.4,O=new et({text:an,style:{fontFamily:$(Pt),fontSize:sn,fontWeight:j(Pt),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=((me=r==null?void 0:r.render)==null?void 0:me.alpha)!==void 0&&((fe=r==null?void 0:r.render)==null?void 0:fe.alpha)!==null?r.render.alpha:1;O.alpha=0,O.targetAlpha=dn,h.addChild(O);let q=((ye=c==null?void 0:c.gameplay)==null?void 0:ye.tuning)||{},H=c==null?void 0:c.ui,it=(ge=q.button_width)!=null?ge:260,ot=(_e=q.button_height)!=null?_e:56,Et=(be=q.button_radius)!=null?be:16,hn=q.button_bg_color||((xe=p.theme)==null?void 0:xe.cta_background)||"#ffb43b",un=(we=q.button_bg_alpha)!=null?we:1,pn=q.button_border_color||"#ffffff",mn=(Te=q.button_border_width)!=null?Te:2,fn=(Se=q.button_border_alpha)!=null?Se:.2,rt=(Ce=l.cta_offset_y)!=null?Ce:160,G=new mt;G.roundRect(-it/2,-ot/2,it,ot,Et);let yn=hn.replace("#","");G.fill({color:parseInt(yn,16),alpha:un});let gn=pn.replace("#","");G.stroke({color:parseInt(gn,16),width:mn,alpha:fn});let ft=new mt;ft.roundRect(-it/2+2,-ot/2+2,it-4,ot-4,Et-2),ft.stroke({color:0,width:1,alpha:.15}),G.addChild(ft),G.position.set(0,rt),G.alpha=0,G.eventMode="static",G.cursor="pointer",h.addChild(G);let _n=(H==null?void 0:H.text)||((Ae=p.ui)==null?void 0:Ae.cta_label_end)||"DOWNLOAD",kt=(H==null?void 0:H.font)||"brand.heading",bn=(H==null?void 0:H.fontSize)||20,xn=q.button_text_color||((ve=p.theme)==null?void 0:ve.cta_text)||"#1a0a0a",tt=new et({text:_n,style:{fontFamily:$(kt),fontSize:bn,fontWeight:j(kt),fill:xn,align:"center",letterSpacing:(Fe=H==null?void 0:H.letterSpacing)!=null?Fe:1}});tt.anchor.set(.5),tt.position.set(0,rt),tt.alpha=0,h.addChild(tt);let W=d==null?void 0:d.ui,Mt=((Pe=d==null?void 0:d.gameplay)==null?void 0:Pe.tuning)||{},wn=(W==null?void 0:W.text)||"Play the full game",Dt=(W==null?void 0:W.font)||"brand.body",Tn=(W==null?void 0:W.fontSize)||11,Sn=(Ee=W==null?void 0:W.letterSpacing)!=null?Ee:0,lt=(ke=d==null?void 0:d.render)==null?void 0:ke.tint,Cn=typeof lt=="string"?lt:lt?`#${lt.toString(16).padStart(6,"0")}`:"#CCCCCC",U=new et({text:wn,style:{fontFamily:$(Dt),fontSize:Tn,fontWeight:j(Dt),fill:Cn,align:"center",letterSpacing:Sn}});U.anchor.set(.5);let An=rt+35+((Me=Mt.animation_start_y_offset)!=null?Me:5);U.position.set(0,An),U.alpha=0,U.animationStartYOffset=(De=Mt.animation_start_y_offset)!=null?De:5,h.addChild(U);let yt=((ze=u==null?void 0:u.gameplay)==null?void 0:ze.tuning)||{},vn=(Ye=yt.hand_offset_x)!=null?Ye:50,Fn=(He=yt.hand_offset_y)!=null?He:50,Pn=(Re=(We=u==null?void 0:u.transform)==null?void 0:We.scale)!=null?Re:.1875,En=(Be=yt.hand_scale_multiplier)!=null?Be:2.5,J=new Ne(t||bt.EMPTY);return J.anchor.set(.5),J.scale.set(Pn*En),J.position.set(vn,rt+Fn),J.alpha=0,J.visible=!1,h.addChild(J),{panel:h,logo:S,title:V,subtitle:I,footer:O,ctaButton:G,ctaText:tt,ctaHint:U,hand:J}}function Wn(e,t,n){var A,w,T,v,k,F,M,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=(v=i.scale_animation_intensity)!=null?v:.1,c=(k=i.logo_animation_delay_ms)!=null?k:100,d=(F=i.title_animation_delay_ms)!=null?F:200,u=(M=i.footer_animation_delay_ms)!=null?M:300,p=(R=i.cta_animation_delay_ms)!=null?R:400,{panel:h,logo:l,title:m,subtitle:f,footer:y,ctaButton:_,ctaText:b,ctaHint:g}=e;h.visible=!0;let x=Date.now(),C=()=>{let P=Date.now()-x,D=Math.min(P/o,1),B=1-Math.pow(1-D,3);h.alpha=B,h.scale.set(1+r*(1-B)),D<1?requestAnimationFrame(C):(setTimeout(()=>Rn(l,a,t),c),setTimeout(()=>{Bn(m,a),setTimeout(()=>Ln(f,a),50)},d),setTimeout(()=>Gn(y,a),u),setTimeout(()=>{Nn(_,b,a),setTimeout(()=>qn(g,a),50),n&&n()},p))};C()}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,u=(y=e.baseScaleY)!=null?y:e.scale.y,p=()=>{let _=Date.now()-o,b=Math.min(_/t,1),g=1-Math.pow(1-b,2);e.alpha=r+(c-r)*g;let x=a+(1-a)*g;e.scale.set(d*x,u*x),b<1&&requestAnimationFrame(p)};p()}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),u=1-Math.pow(1-d,2);e.alpha=s+(1-s)*u,e.position.y=i+(a-i)*u,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 Nn(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 qn(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),u=1-Math.pow(1-d,2);e.alpha=s+(1-s)*u,e.position.y=i+(a-i)*u,d<1&&requestAnimationFrame(o)};o()}function Xn(e,t,n,s){var u,p,h,l;let i=n.objects.get("ui_endgame_hand_1"),a=((u=i==null?void 0:i.gameplay)==null?void 0:u.tuning)||{},o=(p=a.click_animation_duration_ms)!=null?p: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,g=t.y+_,x=Date.now(),C=()=>{var P,D,B;let T=Date.now()-x,v=Math.min(T/o,1),k=v<.5?2*v*v:1-Math.pow(-2*v+2,2)/2;e.x=m+(b-m)*k,e.y=f+(g-f)*k;let F=(D=(P=i==null?void 0:i.transform)==null?void 0:P.scale)!=null?D:.1875,M=(B=a.hand_scale_multiplier)!=null?B:2.5,R=F*M;e.scale.set(R+R*.2*Math.sin(v*Math.PI)),v<1?requestAnimationFrame(C):(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))};C()};setTimeout(d,r)}import{Sprite as $n,Text as jn}from"pixi.js";function Kn(e,t,n){var u,p,h,l;let s=t.objects.get("hand_tutorial_1"),i=((u=s==null?void 0:s.gameplay)==null?void 0:u.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=(p=i.hand_scale_multiplier)!=null?p: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 Vn(e){var m,f,y,_,b,g,x,C,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,u=(n==null?void 0:n.align)||"center",p=s.tint,h=typeof p=="string"?p:p?`#${p.toString(16).padStart(6,"0")}`:i.label_fill||"#FFF1C1",l=new jn({text:o,style:{fontFamily:$(r),fontSize:c,fontWeight:j(r),fill:h,align:u,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:(g=i.label_shadow_angle)!=null?g:0,blur:(x=i.label_shadow_blur)!=null?x:4,distance:(C=i.label_shadow_distance)!=null?C: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 Jn(e,t,n,s,i){var c,d,u,p,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=(u=o.x_offset)!=null?u:0,g=(p=o.y_offset)!=null?p:0,x=(h=o.animation_range)!=null?h:40,C=x*.7,A=x,w=t.x+b+C,T=t.y+g+A,v=w+C,k=T+A;e.x=w+(v-w)*_,e.y=T+(k-T)*_;let F=(l=r.scale)!=null?l:.1875,M=(m=o.hand_scale_multiplier)!=null?m:2.5;e.scale.set(F*M)}}import{Graphics as Qn,Assets as Xe,Texture as Zn,Rectangle as In,Color as qe}from"pixi.js";var xt=null,wt=null;async function $e(){if(xt)return xt;if(!wt){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"})();wt=new Function("path","return import(path)")(n).then(s=>s?s.INLINE_ASSETS?s.INLINE_ASSETS:(console.warn("[assets] Module does not have INLINE_ASSETS export. Module keys:",Object.keys(s)),{}):(console.warn("[assets] Module import returned undefined"),{})).catch(s=>(console.warn("[assets] Failed to load inline-assets.js:",s),{}))}let e=await wt;return xt=e||{},e||{}}function On(e,t){if(!e)return;let n=t[e];if(n)return console.log("[assets] resolveInlineAsset: direct match",{path:e}),n;let s=e.split("?")[0].split("#")[0];if(s!==e&&t[s])return console.log("[assets] resolveInlineAsset: trimmed match",{path:e,trimmed:s}),t[s];let i=s.split("/").pop();if(i&&t[i])return console.log("[assets] resolveInlineAsset: filename match",{path:e,filename:i}),t[i];let a=s.replace(/^\.?\/*/,"");if(a!==s&&t[a])return console.log("[assets] resolveInlineAsset: normalized match",{path:e,normalized:a}),t[a];console.warn("[assets] resolveInlineAsset: no match found",{path:e,trimmed:s,filename:i,normalized:a,availableKeys:Object.keys(t).slice(0,10)})}function je(e,t){let n=On(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 $e(),a=je(e,i);console.log("[assets] loadAsset",{path:e,resolvedSource:(a==null?void 0:a.substring(0,50))+"...",hasInlineMap:!!i,inlineMapKeys:Object.keys(i).length});try{let o=await Xe.load(a);return console.log("[assets] loadAsset success",{path:e,textureWidth:o.width,textureHeight:o.height}),o}catch(o){throw console.error("[assets] loadAsset failed",{path:e,source:a,error:o}),new Error(`[assets] inline asset failed to load: ${e}`)}}async function ta(e,t,n){var f,y,_,b,g,x,C,A,w,T,v,k,F,M,R,P,D,B;let s=await $e(),i=je(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(K=>o.once("loaded",K));let r=((f=n==null?void 0:n.gameplay)==null?void 0:f.character_sheet)||((b=(_=(y=n==null?void 0:n.engine)==null?void 0:y.runtime)==null?void 0:_.gameplay)==null?void 0:b.character_sheet)||((A=(C=(x=(g=n==null?void 0:n.objects)==null?void 0:g.get)==null?void 0:x.call(g,"character_1"))==null?void 0:C.gameplay)==null?void 0:A.character_sheet)||{},c=(w=r.cols)!=null?w:3,d=(T=r.rows)!=null?T:2,u=(M=(F=(v=o==null?void 0:o.width)!=null?v:o==null?void 0:o.pixelWidth)!=null?F:(k=o==null?void 0:o.baseTexture)==null?void 0:k.width)!=null?M:a.width,p=(B=(D=(R=o==null?void 0:o.height)!=null?R:o==null?void 0:o.pixelHeight)!=null?D:(P=o==null?void 0:o.baseTexture)==null?void 0:P.height)!=null?B:a.height,h=u/c,l=p/d;if(!Number.isFinite(h)||!Number.isFinite(l)||h<=0||l<=0||!o)return[a];let m=[];for(let K=0;K<d;K++)for(let S=0;S<c;S++)m.push(new Zn({source:o,frame:new In(S*h,K*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 u,p,h,l;let n=t.gameplay.brush||{},s=new qe(t.theme.brush_color||"#ffffff").toNumber(),i=(u=n.radius)!=null?u:20,a=(p=n.inner_radius)!=null?p: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{ut as GameObject,_t as GameObjectManager,ht as Renderer,dt as Transform,Xn as animateHandClick,Wn as animatePanelEntrance,ea as createBrushTexture,Hn as createEndGamePanel,Kn as createHandTutorial,Mn as createPixiBase,Vn as createTutorialLabel,zn as getRegisteredFontIds,Un as loadAsset,ta as loadCharacterFrames,Dn as registerFont,$ as resolveFont,j as resolveFontWeight,Jn as updateHandAnimation};
|
|
1
|
+
import{b as be}from"../chunk-U4PCKCX6.mjs";import{Application as Wn}from"pixi.js";async function Hn(n,e={}){let t=new Wn;await t.init({resizeTo:n,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let o=s=>{var c,l,u,f,p,d;if(!t.renderer)return;let i=(u=(l=(c=s==null?void 0:s.width)!=null?c:n.clientWidth)!=null?l:window.innerWidth)!=null?u:320,r=(d=(p=(f=s==null?void 0:s.height)!=null?f:n.clientHeight)!=null?p:window.innerHeight)!=null?d:480;t.renderer.resize(i,r)};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",e.background&&(n.style.background=e.background),n.appendChild(t.canvas);let a=document.createElement("div");return a.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(a),be.on("pause",()=>{t.ticker.stop(),document.querySelectorAll("audio").forEach(i=>i.pause())}),be.on("resume",()=>{t.ticker.start(),document.querySelectorAll("audio").forEach(i=>{i.currentTime>0&&!i.ended&&i.play().catch(()=>{})})}),be.on("resize",({payload:s})=>{o({width:s==null?void 0:s.width,height:s==null?void 0:s.height})}),window.addEventListener("resize",()=>o()),requestAnimationFrame(()=>o()),{app:t,stage:t.stage,overlay:a,applySize:o}}var xe=class{constructor(e){var t,o;this.position=(e==null?void 0:e.position)||{x:0,y:0},this.scale=(t=e==null?void 0:e.scale)!=null?t:1,this.rotation=(o=e==null?void 0:e.rotation)!=null?o: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}},we=class{constructor(e){var t,o,a,s;this.z_index=(t=e==null?void 0:e.z_index)!=null?t:0,this.alpha=(o=e==null?void 0:e.alpha)!=null?o:1,this.visible=(a=e==null?void 0:e.visible)!=null?a:!0,this.tint=(s=e==null?void 0:e.tint)!=null?s: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)}},Se=class{constructor(e,t,o,a){this.instanceId=e,this.objectConfig=t,this.pixiObject=o,this._config=a,this.transform=new xe(a.transform),this.renderer=new we(a.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject),this.applyAnchor(),this.applyEffectsScale()}updateConfig(e){this._config=e,e.transform&&this.transform.update(e.transform),e.render&&this.renderer.update(e.render),this.sync()}applyAnchor(){var a,s,i,r;if(!this.pixiObject||!("anchor"in this.pixiObject)||!this.pixiObject.anchor)return;let e=(s=(a=this._config)==null?void 0:a.render)==null?void 0:s.anchor,t=(r=(i=this._config)==null?void 0:i.transform)==null?void 0:r.anchor,o=e&&typeof e=="object"?e:t&&typeof t=="object"?t:null;o&&typeof o.x=="number"&&typeof o.y=="number"&&this.pixiObject.anchor.set(o.x,o.y)}applyEffectsScale(){var s,i,r;if(!((s=this.pixiObject)!=null&&s.scale))return;let e=(i=this._config)==null?void 0:i.effects,t=typeof(e==null?void 0:e.scale_x)=="number"?e.scale_x:1,o=typeof(e==null?void 0:e.scale_y)=="number"?e.scale_y:1;if(t===1&&o===1)return;let a=(r=this.transform.scale)!=null?r:1;typeof this.pixiObject.scale.set=="function"?this.pixiObject.scale.set(a*t,a*o):(this.pixiObject.scale.x=a*t,this.pixiObject.scale.y=a*o)}getComponent(e){return this._config[e]}getPosition(){return{...this.transform.position}}setPosition(e,t){this.transform.position={x:e,y:t},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)}},$e=class{constructor(e){this.objects=new Map;this.config=e}create(e,t){let o=this.config.objects.get(e);if(!o)throw new Error(`Object config not found: ${e}`);let a=new Se(e,o.object_config||e,t,o);return this.objects.set(e,a),a}get(e){return this.objects.get(e)}updateConfig(e){this.config=e;for(let[t,o]of this.objects.entries()){let a=e.objects.get(t);a&&o.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(e){this.objects.delete(e)}clear(){this.objects.clear()}};var Ae={"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(n){let e=Ae[n];return e?e.family:(console.warn(`Font ID "${n}" not found in registry, using fallback`),"Arial, sans-serif")}function K(n){var t;let e=Ae[n];return e&&(t=e.weight)!=null?t:"400"}function qn(n,e){Ae[n]=e}function Gn(){return Object.keys(Ae)}import{Container as Jn,Graphics as Te,Text as le,Sprite as en,Texture as Fe}from"pixi.js";function Xn(n,e,t){var Je,Xe,Ve,Ke,Qe,Ze,je,Ue,et,tt,nt,st,at,ot,it,rt,lt,ct,dt,ut,pt,ft,ht,yt,mt,gt,_t,bt,xt,wt,St,At,Tt,Et,Lt,vt,Mt,$t,Ft,Nt,Ct,Ot,Pt,Bt,kt,Dt,It,Rt,Yt,zt,Wt,Ht,qt,Gt,Jt,Xt,Vt,Kt,Qt,Zt;let o=n.objects.get("ui_endgame_1"),a=n.objects.get("ui_endgame_logo_1"),s=n.objects.get("ui_endgame_title_1"),i=n.objects.get("ui_endgame_subtitle_1"),r=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"),f=n.engine.runtime||{},p=new Jn;p.alpha=0,p.visible=!1;let d=((Je=o==null?void 0:o.gameplay)==null?void 0:Je.tuning)||{},h=(o==null?void 0:o.render)||{},y=(Xe=d.panel_width)!=null?Xe:320,m=(Ve=d.panel_height)!=null?Ve:400,T=(Ke=d.panel_padding)!=null?Ke:32,b=(Qe=d.panel_radius)!=null?Qe:24,w=h.background_color||d.panel_bg_color||"#1a0a0a",A=h.background_alpha!==void 0&&h.background_alpha!==null?h.background_alpha:(Ze=d.panel_bg_alpha)!=null?Ze:.98,E=h.border_color||d.panel_border_color||"#ffffff",L=(je=d.panel_border_width)!=null?je:2,v=(Ue=d.panel_border_alpha)!=null?Ue:.3,S=new Te;S.roundRect(-y/2,-m/2,y,m,b);let g=w.replace("#","");S.fill({color:parseInt(g,16),alpha:A});let x=E.replace("#","");S.stroke({color:parseInt(x,16),width:L,alpha:v});let F=new Te;F.roundRect(-y/2+2,-m/2+2,y-4,m-4,b-2),F.stroke({color:16777215,width:1,alpha:.1}),S.addChild(F),p.addChild(S);let k=((et=a==null?void 0:a.gameplay)==null?void 0:et.tuning)||{},O=(a==null?void 0:a.transform)||{},$=(tt=k.logo_size)!=null?tt:56,N=(nt=O.scale)!=null?nt:1,P=(at=(st=O.offset)==null?void 0:st.y)!=null?at:-130,ee=(ot=k.logo_alpha)!=null?ot:1,M=new en(t||Fe.EMPTY);M.anchor.set(.5);let z=0,W=0;if(t&&t!==Fe.EMPTY){let B=t.frame,X=t.baseTexture;B&&B.width&&B.height?(z=B.width,W=B.height):X&&X.width&&X.height?(z=X.width,W=X.height):t.width&&t.height&&(z=t.width,W=t.height)}if(z>0&&W>0){let B=z/W,X,Me;B>1?(X=$,Me=$/B):(Me=$,X=$*B);let jt=X/z,Ut=Me/W;jt*=N,Ut*=N,M.scale.set(jt,Ut)}else{let B=$/100*N;M.scale.set(B)}M.position.set(0,P),M.alpha=0,M.visible=!0,M.targetAlpha=ee,M.baseScaleX=M.scale.x,M.baseScaleY=M.scale.y,p.addChild(M);let C=s==null?void 0:s.ui,D=((it=s==null?void 0:s.gameplay)==null?void 0:it.tuning)||{},Ee=(C==null?void 0:C.text)||"MISSION ACCOMPLISHED",ue=(C==null?void 0:C.font)||"brand.heading",on=(C==null?void 0:C.fontSize)||24,rn=(rt=C==null?void 0:C.letterSpacing)!=null?rt:1,pe=(lt=s==null?void 0:s.render)==null?void 0:lt.tint,ln=typeof pe=="string"?pe:pe?`#${pe.toString(16).padStart(6,"0")}`:"#00FF88",ke=y-T*2-30,cn=D.font_weight_override?D.font_weight_override:K(ue),j=new le({text:Ee,style:{fontFamily:V(ue),fontSize:on,fontWeight:cn,fill:ln,align:"center",letterSpacing:rn,wordWrap:!1,stroke:{color:D.stroke_color||"#000000",width:(ct=D.stroke_width)!=null?ct:2},dropShadow:{color:D.shadow_color||"#000000",alpha:(dt=D.shadow_alpha)!=null?dt:.9,angle:(ut=D.shadow_angle)!=null?ut:0,blur:(pt=D.shadow_blur)!=null?pt:8,distance:(ft=D.shadow_distance)!=null?ft:4}}});if(j.width>ke){let B=ke/j.width;j.scale.set(B)}j.anchor.set(.5);let De=(ht=d.title_offset_y)!=null?ht:30,dn=De+((yt=D.animation_start_y_offset)!=null?yt:-20);j.position.set(0,dn),j.alpha=0,p.addChild(j);let I=i==null?void 0:i.ui,Ie=((mt=i==null?void 0:i.gameplay)==null?void 0:mt.tuning)||{},un=(I==null?void 0:I.text)||"RESCUE COMPLETE",Re=(I==null?void 0:I.font)||"brand.body",pn=(I==null?void 0:I.fontSize)||11,fn=(gt=I==null?void 0:I.letterSpacing)!=null?gt:.5,fe=(_t=i==null?void 0:i.render)==null?void 0:_t.tint,hn=typeof fe=="string"?fe:fe?`#${fe.toString(16).padStart(6,"0")}`:"#B0B0B0",se=new le({text:un,style:{fontFamily:V(Re),fontSize:pn,fontWeight:K(Re),fill:hn,align:"center",letterSpacing:fn}});se.anchor.set(.5);let yn=De+20+((bt=Ie.animation_start_y_offset)!=null?bt:-10);se.position.set(0,yn),se.alpha=0,se.animationStartYOffset=(xt=Ie.animation_start_y_offset)!=null?xt:-10,p.addChild(se);let G=r==null?void 0:r.ui,Ye=((wt=r==null?void 0:r.gameplay)==null?void 0:wt.tuning)||{},mn=(G==null?void 0:G.text)||((St=f.ui)==null?void 0:St.cta_hint)||"Continue the adventure!",ze=(G==null?void 0:G.font)||"brand.body",gn=(G==null?void 0:G.fontSize)||16,he=(At=r==null?void 0:r.render)==null?void 0:At.tint,_n=typeof he=="string"?he:he?`#${he.toString(16).padStart(6,"0")}`:"#FFFFFF",bn=(Tt=Ye.max_width)!=null?Tt:y-T*2,xn=(Et=Ye.line_height)!=null?Et:1.4,ae=new le({text:mn,style:{fontFamily:V(ze),fontSize:gn,fontWeight:K(ze),fill:_n,align:"center",wordWrap:!0,wordWrapWidth:bn,lineHeight:xn}});ae.anchor.set(.5);let wn=(Lt=d.footer_offset_y)!=null?Lt:120;ae.position.set(0,wn);let Sn=((vt=r==null?void 0:r.render)==null?void 0:vt.alpha)!==void 0&&((Mt=r==null?void 0:r.render)==null?void 0:Mt.alpha)!==null?r.render.alpha:1;ae.alpha=0,ae.targetAlpha=Sn,p.addChild(ae);let J=(($t=c==null?void 0:c.gameplay)==null?void 0:$t.tuning)||{},R=c==null?void 0:c.ui,ye=(Ft=J.button_width)!=null?Ft:260,me=(Nt=J.button_height)!=null?Nt:56,We=(Ct=J.button_radius)!=null?Ct:16,An=J.button_bg_color||((Ot=f.theme)==null?void 0:Ot.cta_background)||"#ffb43b",Tn=(Pt=J.button_bg_alpha)!=null?Pt:1,En=J.button_border_color||"#ffffff",Ln=(Bt=J.button_border_width)!=null?Bt:2,vn=(kt=J.button_border_alpha)!=null?kt:.2,ge=(Dt=d.cta_offset_y)!=null?Dt:160,H=new Te;H.roundRect(-ye/2,-me/2,ye,me,We);let Mn=An.replace("#","");H.fill({color:parseInt(Mn,16),alpha:Tn});let $n=En.replace("#","");H.stroke({color:parseInt($n,16),width:Ln,alpha:vn});let Le=new Te;Le.roundRect(-ye/2+2,-me/2+2,ye-4,me-4,We-2),Le.stroke({color:0,width:1,alpha:.15}),H.addChild(Le),H.position.set(0,ge),H.alpha=0,H.eventMode="static",H.cursor="pointer",p.addChild(H);let Fn=(R==null?void 0:R.text)||((It=f.ui)==null?void 0:It.cta_label_end)||"DOWNLOAD",He=(R==null?void 0:R.font)||"brand.heading",Nn=(R==null?void 0:R.fontSize)||20,Cn=J.button_text_color||((Rt=f.theme)==null?void 0:Rt.cta_text)||"#1a0a0a",re=new le({text:Fn,style:{fontFamily:V(He),fontSize:Nn,fontWeight:K(He),fill:Cn,align:"center",letterSpacing:(Yt=R==null?void 0:R.letterSpacing)!=null?Yt:1}});re.anchor.set(.5),re.position.set(0,ge),re.alpha=0,p.addChild(re);let Y=l==null?void 0:l.ui,qe=((zt=l==null?void 0:l.gameplay)==null?void 0:zt.tuning)||{},On=(Y==null?void 0:Y.text)||"Play the full game",Ge=(Y==null?void 0:Y.font)||"brand.body",Pn=(Y==null?void 0:Y.fontSize)||11,Bn=(Wt=Y==null?void 0:Y.letterSpacing)!=null?Wt:0,_e=(Ht=l==null?void 0:l.render)==null?void 0:Ht.tint,kn=typeof _e=="string"?_e:_e?`#${_e.toString(16).padStart(6,"0")}`:"#CCCCCC",oe=new le({text:On,style:{fontFamily:V(Ge),fontSize:Pn,fontWeight:K(Ge),fill:kn,align:"center",letterSpacing:Bn}});oe.anchor.set(.5);let Dn=ge+35+((qt=qe.animation_start_y_offset)!=null?qt:5);oe.position.set(0,Dn),oe.alpha=0,oe.animationStartYOffset=(Gt=qe.animation_start_y_offset)!=null?Gt:5,p.addChild(oe);let ve=((Jt=u==null?void 0:u.gameplay)==null?void 0:Jt.tuning)||{},In=(Xt=ve.hand_offset_x)!=null?Xt:50,Rn=(Vt=ve.hand_offset_y)!=null?Vt:50,Yn=(Qt=(Kt=u==null?void 0:u.transform)==null?void 0:Kt.scale)!=null?Qt:.1875,zn=(Zt=ve.hand_scale_multiplier)!=null?Zt:2.5,te=new en(e||Fe.EMPTY);return te.anchor.set(.5),te.scale.set(Yn*zn),te.position.set(In,ge+Rn),te.alpha=0,te.visible=!1,p.addChild(te),{panel:p,logo:M,title:j,subtitle:se,footer:ae,ctaButton:H,ctaText:re,ctaHint:oe,hand:te}}function Vn(n,e,t){var L,v,S,g,x,F,k,O;let o=e.objects.get("ui_endgame_1"),a=((L=o==null?void 0:o.gameplay)==null?void 0:L.tuning)||{},s=(v=a.animation_duration_ms)!=null?v:800,i=(S=a.fade_in_duration_ms)!=null?S:600,r=(g=a.scale_animation_intensity)!=null?g:.1,c=(x=a.logo_animation_delay_ms)!=null?x:100,l=(F=a.title_animation_delay_ms)!=null?F:200,u=(k=a.footer_animation_delay_ms)!=null?k:300,f=(O=a.cta_animation_delay_ms)!=null?O:400,{panel:p,logo:d,title:h,subtitle:y,footer:m,ctaButton:T,ctaText:b,ctaHint:w}=n;p.visible=!0;let A=Date.now(),E=()=>{let $=Date.now()-A,N=Math.min($/i,1),P=1-Math.pow(1-N,3);p.alpha=P,p.scale.set(1+r*(1-P)),N<1?requestAnimationFrame(E):(setTimeout(()=>Kn(d,s,e),c),setTimeout(()=>{Qn(h,s),setTimeout(()=>Zn(y,s),50)},l),setTimeout(()=>jn(m,s),u),setTimeout(()=>{Un(T,b,s),setTimeout(()=>es(w,s),50),t&&t()},f))};E()}function Kn(n,e,t){var p,d,h,y,m;let o=t==null?void 0:t.objects.get("ui_endgame_logo_1"),s=(d=(((p=o==null?void 0:o.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?d:1.2,i=Date.now(),r=n.alpha,c=(h=n.targetAlpha)!=null?h:1,l=(y=n.baseScaleX)!=null?y:n.scale.x,u=(m=n.baseScaleY)!=null?m:n.scale.y,f=()=>{let T=Date.now()-i,b=Math.min(T/e,1),w=1-Math.pow(1-b,2);n.alpha=r+(c-r)*w;let A=s+(1-s)*w;n.scale.set(l*A,u*A),b<1&&requestAnimationFrame(f)};f()}function Qn(n,e){let t=Date.now(),o=n.alpha,a=n.y,s=()=>{let i=Date.now()-t,r=Math.min(i/e,1),c=1-Math.pow(1-r,2);n.alpha=o+(1-o)*c,n.y=a-20*(1-c),r<1&&requestAnimationFrame(s)};s()}function Zn(n,e){var r;let t=Date.now(),o=n.alpha,a=n.position.y,s=a-((r=n.animationStartYOffset)!=null?r:-10),i=()=>{let c=Date.now()-t,l=Math.min(c/e,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=a+(s-a)*u,l<1&&requestAnimationFrame(i)};i()}function jn(n,e){var i;let t=Date.now(),o=n.alpha,a=(i=n.targetAlpha)!=null?i:1,s=()=>{let r=Date.now()-t,c=Math.min(r/e,1),l=1-Math.pow(1-c,2);n.alpha=o+(a-o)*l,c<1&&requestAnimationFrame(s)};s()}function Un(n,e,t){let o=Date.now(),a=n.alpha,s=()=>{let i=Date.now()-o,r=Math.min(i/t,1),c=1-Math.pow(1-r,2);n.alpha=a+(1-a)*c,e.alpha=a+(1-a)*c,n.scale.set(1+.1*(1-c)),r<1&&requestAnimationFrame(s)};s()}function es(n,e){var r;let t=Date.now(),o=n.alpha,a=n.position.y,s=a-((r=n.animationStartYOffset)!=null?r:5),i=()=>{let c=Date.now()-t,l=Math.min(c/e,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=a+(s-a)*u,l<1&&requestAnimationFrame(i)};i()}function ts(n,e,t,o){var u,f,p,d;let a=t.objects.get("ui_endgame_hand_1"),s=((u=a==null?void 0:a.gameplay)==null?void 0:u.tuning)||{},i=(f=s.click_animation_duration_ms)!=null?f:600,r=(p=s.click_delay_ms)!=null?p:2e3,c=(d=s.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var L,v;n.visible=!0,n.alpha=1;let h=n.x,y=n.y,m=(L=s.hand_offset_x)!=null?L:50,T=(v=s.hand_offset_y)!=null?v:50,b=e.x+m,w=e.y+T,A=Date.now(),E=()=>{var $,N,P;let S=Date.now()-A,g=Math.min(S/i,1),x=g<.5?2*g*g:1-Math.pow(-2*g+2,2)/2;n.x=h+(b-h)*x,n.y=y+(w-y)*x;let F=(N=($=a==null?void 0:a.transform)==null?void 0:$.scale)!=null?N:.1875,k=(P=s.hand_scale_multiplier)!=null?P:2.5,O=F*k;n.scale.set(O+O*.2*Math.sin(g*Math.PI)),g<1?requestAnimationFrame(E):(e.scale.set(.95),setTimeout(()=>{e.scale.set(1),o()},100),setTimeout(()=>{n.alpha=0,setTimeout(()=>{n.x=h,n.y=y,l()},c)},500))};E()};setTimeout(l,r)}import{Sprite as ns,Text as ss}from"pixi.js";function as(n,e,t){var f,p,d,h;let o=e.objects.get("hand_tutorial_1")||e.objects.get("hand_1")||Array.from(e.objects.values()).find(y=>{var m;return((m=y==null?void 0:y.identity)==null?void 0:m.id)==="hand.tutorial"}),a=((f=o==null?void 0:o.gameplay)==null?void 0:f.tuning)||{},s=(o==null?void 0:o.render)||{},i=(o==null?void 0:o.transform)||{},r=new ns(n),c=s==null?void 0:s.anchor;c&&typeof c.x=="number"&&typeof c.y=="number"?r.anchor.set(c.x,c.y):r.anchor.set(.5),r.alpha=0;let l=(p=a.hand_scale_multiplier)!=null?p:2.5,u=(d=i.scale)!=null?d:.1875;return r.scale.set(u*l),r.zIndex=(h=s.z_index)!=null?h:99999,r}function os(n){var y,m,T,b,w,A,E,L,v,S;let e=n.objects.get("ui_tutorial_1")||n.objects.get("label_1")||Array.from(n.objects.values()).find(g=>{var x;return["ui.tutorial","label.warning"].includes((x=g==null?void 0:g.identity)==null?void 0:x.id)}),t=e==null?void 0:e.ui,o=(e==null?void 0:e.render)||{},a=((y=n.engine.runtime)==null?void 0:y.ui_styles)||{},s=((m=n.engine.runtime)==null?void 0:m.ui)||{},i=(t==null?void 0:t.text)||s.tutorial_label||s.label_text||"CLEAN!",r=(t==null?void 0:t.font)||"brand.warning",c=(t==null?void 0:t.fontSize)||a.label_font_size||52,l=(b=t==null?void 0:t.letterSpacing)!=null?b:(T=a.label_letter_spacing)!=null?T:-1,u=(t==null?void 0:t.align)||"center",f=o.tint,p=typeof f=="string"?f:f?`#${f.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",d=new ss({text:i,style:{fontFamily:V(r),fontSize:c,fontWeight:K(r),fill:p,align:u,letterSpacing:l,stroke:{color:a.label_stroke||"#8B0000",width:2},dropShadow:{color:a.label_shadow_color||"#000000",alpha:(w=a.label_shadow_alpha)!=null?w:.8,angle:(A=a.label_shadow_angle)!=null?A:0,blur:(E=a.label_shadow_blur)!=null?E:4,distance:(L=a.label_shadow_distance)!=null?L:2}}}),h=o==null?void 0:o.anchor;return h&&typeof h.x=="number"&&typeof h.y=="number"?d.anchor.set(h.x,h.y):d.anchor.set(.5,.5),d.alpha=(v=o.alpha)!=null?v:0,d.visible=(S=o.visible)!=null?S:!0,d}function is(n,e,t,o,a){var c,l,u,f,p,d,h,y,m,T,b,w,A,E,L,v,S;let s=a.objects.get("hand_tutorial_1")||a.objects.get("hand_1")||Array.from(a.objects.values()).find(g=>{var x;return((x=g==null?void 0:g.identity)==null?void 0:x.id)==="hand.tutorial"}),i=((c=s==null?void 0:s.gameplay)==null?void 0:c.tuning)||{},r=(s==null?void 0:s.transform)||{};if(!o){let g=(l=i.animation_duration)!=null?l:1.5,x=t%g/g,F=x<.5?2*x*x:-1+(4-2*x)*x,k=(h=(d=(p=(u=r.position)==null?void 0:u.x)!=null?p:(f=r.offset)==null?void 0:f.x)!=null?d:i.start_x_offset)!=null?h:0,O=(w=(b=(T=(y=r.position)==null?void 0:y.y)!=null?T:(m=r.offset)==null?void 0:m.y)!=null?b:i.start_y_offset)!=null?w:0,$=(A=i.x_offset)!=null?A:0,N=(E=i.y_offset)!=null?E:0,P=(L=i.animation_range)!=null?L:40,ee=P*.7,M=P,z=e.x+k+$+ee,W=e.y+O+N+M,C=z+ee,D=W+M;n.x=z+(C-z)*F,n.y=W+(D-W)*F;let Ee=(v=r.scale)!=null?v:.1875,ue=(S=i.hand_scale_multiplier)!=null?S:2.5;n.scale.set(Ee*ue)}}var ce=null;function rs(){return ce||(typeof window!="undefined"&&window.lottie?ce=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),ce=null)),ce}function ls(n){ce=n}function cs(n,e,t,o){var E,L,v,S,g,x,F,k,O,$,N,P,ee;let a=t.objects.get(n);if(!a)return console.warn(`[LottieOverlay] Object config not found: ${n}`),null;let s=((E=a.effects)==null?void 0:E.lottie)||{},i=a.transform||{},r=a.render||{};if(s.enabled===!1||r.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=rs();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${n}`),null;let u=(L=s.width)!=null?L:300,f=(v=s.height)!=null?v:300,p=(S=i.scale)!=null?S:1,d=(x=(g=i.position)==null?void 0:g.x)!=null?x:0,h=(k=(F=i.position)==null?void 0:F.y)!=null?k:0,y=(O=i.rotation)!=null?O:0,m=($=r.z_index)!=null?$:100,T=(N=r.alpha)!=null?N:1,b=document.createElement("div");b.style.cssText=`
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: calc(50% + ${h}px);
|
|
4
|
+
left: calc(50% + ${d}px);
|
|
5
|
+
transform: translate(-50%, -50%) scale(${p}) rotate(${y}deg);
|
|
6
|
+
width: ${u}px;
|
|
7
|
+
height: ${f}px;
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
z-index: ${m};
|
|
10
|
+
opacity: ${T};
|
|
11
|
+
`,e.appendChild(b);let w=l.loadAnimation({container:b,renderer:s.renderer||"svg",loop:(P=s.loop)!=null?P:!1,autoplay:(ee=s.autoplay)!=null?ee:!0,animationData:c});s.speed!==void 0&&w.setSpeed(s.speed);let A=()=>{w.destroy(),b.parentNode&&b.parentNode.removeChild(b)};return s.loop||w.addEventListener("complete",A),{animation:w,cleanup:A}}import{Assets as ie,Texture as ds}from"pixi.js";var Q=class{static get(e){var t;return(t=this.store.get(e))==null?void 0:t.data}static set(e,t){this.store.set(e,{data:t})}static has(e){return this.store.has(e)}static clear(){this.store.clear()}};Q.store=new Map;function us(){var n,e;try{let t=typeof window!="undefined"&&(document.querySelector('script[src*="inline-assets.js"]')||((e=(n=document.querySelector("script"))==null?void 0:n.textContent)==null?void 0:e.includes("inline-assets.js"))||window.INLINE_ASSETS),o=typeof window!="undefined"&&document.querySelector('link[href*="assets/"], script[src*="assets/"]');return!!(t&&!o)}catch{return!1}}async function ps(){try{if(typeof window!="undefined"){let n=await fetch("./build-settings.json");if(n.ok){let e=await n.json();return console.log("[AssetLoader] Loaded build settings:",e),e}}}catch{}return null}function fs(){try{if(typeof window!="undefined"){let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);return console.log("[AssetLoader] Loaded build settings (sync):",e),e}}}catch{}return null}var tn=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",nn=us(),ne=typeof window!="undefined"?window.__BUILD_SETTINGS__:null,_=nn?"publish":tn,q=ne==null?void 0:ne.assetsInlined;ne!=null&&ne.buildMode&&(_=ne.buildMode,console.log(`[AssetLoader] Build mode overridden by inline settings: ${_}`));var U=fs();U!=null&&U.buildMode&&(_=U.buildMode,console.log(`[AssetLoader] Build mode overridden by sync settings: ${_}`));(U==null?void 0:U.assetsInlined)!==void 0&&(q=U.assetsInlined);ps().then(n=>{n!=null&&n.buildMode&&n.buildMode!==_&&(_=n.buildMode,console.log(`[AssetLoader] Build mode overridden by settings: ${_}`)),(n==null?void 0:n.assetsInlined)!==void 0&&(q=n.assetsInlined)}).catch(()=>{});console.log(`[AssetLoader] MODULE LOADED - Compile: ${tn}, Runtime: ${nn?"publish":"dev"}, Effective: ${_}`);var Z={},Ne=null;async function hs(){if(console.log(`[AssetLoader] getInlineAssets() called - Effective mode: ${_}`),Object.keys(Z).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(Z)),Z;if(typeof window!="undefined"&&window.INLINE_ASSETS)return console.log("[AssetLoader] Using pre-loaded INLINE_ASSETS from window:",Object.keys(window.INLINE_ASSETS)),Z={...window.INLINE_ASSETS},Z;if(!(_==="publish"&&q!==!1))return console.log("[AssetLoader] Inline assets disabled for this build mode."),Z;if(!Ne){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),Ne=(async()=>{try{try{let s=await import(e+"?t="+Date.now());if(s.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(s.INLINE_ASSETS)),s.INLINE_ASSETS}catch(s){console.warn("[AssetLoader] ES module import failed, trying text parse:",s)}let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);let o=await t.text();console.log("[AssetLoader] Received JS code, length:",o.length);let a=o.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(a)try{let s=a[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let i=new Function("return "+s)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(i)),i}catch(s){return console.warn("[AssetLoader] Failed to parse inline assets:",s),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",o.substring(0,500)),{}}catch(t){return console.warn("[AssetLoader] Failed to load inline assets:",t),{}}})()}return Z=await Ne,console.log("[AssetLoader] Final inline assets cache:",Object.keys(Z)),Z}var sn=new Map;function Ce(n){return n===null||typeof n!="object"||(Object.freeze(n),Object.values(n).forEach(e=>Ce(e))),n}function ys(n=64,e=64,t=16711680){let o=document.createElement("canvas");o.width=n,o.height=e;let a=o.getContext("2d");return a.fillStyle=`#${t.toString(16).padStart(6,"0")}`,a.fillRect(0,0,n,e),a.strokeStyle="#000",a.strokeRect(0,0,n,e),a.fillStyle="#fff",a.font="10px sans-serif",a.textAlign="center",a.fillText("MISSING",n/2,e/2),ds.from(o)}function Oe(n,e){sn.set(n,e)}var de=class{static async load(e,t,o){let a=Q.get(e);if(a!==void 0)return a;console.log(`[AssetLoader] Loading asset: ${e}, type: ${t.type}, Effective mode: ${_}`),console.log(`[AssetLoader] Window defined: ${typeof window!="undefined"}, INLINE_ASSETS exists: ${!!(typeof window!="undefined"&&window.INLINE_ASSETS)}, keys: ${typeof window!="undefined"&&window.INLINE_ASSETS?Object.keys(window.INLINE_ASSETS).length:"N/A"}`);let s=await hs(),i=s[e];if(!i&&t.path){let l=t.path.split("/");if(l.length>=2){let u=l[l.length-1].split(".")[0],f=l[0],p=[`${u}.layer`,`${u}.player`,`${u}.tutorial`,`effects.${u}`,`ui.endgame.${u}`,u];for(let d of p)if(s[d]){i=s[d],console.log(`[AssetLoader] Found inline data for ${e} using derived key: ${d}`);break}}}if(console.log("[AssetLoader] Inline data for",e,":",i?"FOUND":"NOT FOUND"),_==="publish"&&q!==!1&&(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: ${e}, path: ${t.path}`);let c=sn.get(t.type);if(c)try{let l=await c(t.path,i,e,o);return Q.set(e,l),l}catch(l){return this.handleFailure(e,t.type,l)}try{let l;switch(t.type){case"image":l=await this.loadImage(t.path,i);break;case"json":l=await this.loadJSON(t.path,i),l=Ce(l);break;default:throw new Error(`Unknown asset type: ${t.type}`)}return Q.set(e,l),l}catch(l){return this.handleFailure(e,t.type,l)}}static async loadImage(e,t){let o=_==="publish",a=o&&q!==!1;if(console.log(`[AssetLoader] loadImage - Effective mode: ${_}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),a){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 object. Path: ${e}`);if(!t.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${t.substring(0,50)}...`);try{return await ie.load(t)}catch(s){throw console.error("[AssetLoader] Failed to load texture from data URI:",s),s}}if(t&&t.startsWith("data:"))try{return await ie.load(t)}catch(s){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",s),await ie.load(e)}return await ie.load(e)}static async loadJSON(e,t){let o=_==="publish",a=o&&q!==!1;if(console.log(`[AssetLoader] loadJSON - Effective mode: ${_}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),a){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: ${e}`);if(t.startsWith("data:")){let i=atob(t.split(",")[1]);return JSON.parse(i)}return JSON.parse(t)}if(t){if(t.startsWith("data:")){let i=atob(t.split(",")[1]);return JSON.parse(i)}return JSON.parse(t)}let s=await fetch(e);if(!s.ok)throw new Error(`JSON fetch failed: ${e}`);return s.json()}static handleFailure(e,t,o){if(_==="dev"){let s=t==="image"?ys():Ce({__placeholder:!0,type:t});return Q.set(e,s),s}throw o}};Oe("image",async(n,e)=>{let t=_==="publish",o=t&&q!==!1,a=_==="brand",s=t&&q===!1;if(console.log(`[AssetLoader] registerType('image') - Effective mode: ${_}, isPublishMode: ${t}, isBrandMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),o){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: ${n}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);return ie.load(e)}let i=n;return(a||s)&&n&&!n.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(i=n,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${n}" as-is`)):(i=`assets/${n}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${n}" -> "${i}"`))),ie.load(e||i)});Oe("json",async(n,e)=>{let t=_==="publish",o=t&&q!==!1,a=_==="brand",s=t&&q===!1;if(console.log(`[AssetLoader] registerType('json') - Effective mode: ${_}, isPublishMode: ${t}, isBrandMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),o){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: ${n}`);return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e)}let i=n;if((a||s)&&n&&!n.startsWith("assets/")&&(typeof window!="undefined"&&!document.querySelector('link[href*="assets/"], script[src*="assets/"]')&&!document.querySelector('link[href*="configs/"], script[src*="configs/"]')?(i=n,console.log(`[AssetLoader] BRAND MODE: flattened build, using path "${n}" as-is`)):(i=`assets/${n}`,console.log(`[AssetLoader] BRAND MODE: transformed path "${n}" -> "${i}"`))),e)return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e);let r=await fetch(i);if(!r.ok)throw new Error(`JSON fetch failed: ${n}`);return r.json()});import{Sprite as ms,Container as an}from"pixi.js";var gs=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",Pe=gs;if(typeof window!="undefined")try{let n=new XMLHttpRequest;if(n.open("GET","./build-settings.json",!1),n.send(),n.status===200&&n.responseText){let e=JSON.parse(n.responseText);e!=null&&e.buildMode&&(Pe=e.buildMode,console.log(`[ObjectFactory] Build mode overridden by settings: ${Pe}`))}}catch{}var Be=class{static async create(e,t,o){var r,c,l,u,f,p;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${Pe}`);let a=(r=t==null?void 0:t.render)==null?void 0:r.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let d=new an;return this.applyTransform(d,t==null?void 0:t.transform),d}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, type: ${a.type}, path: ${a.path}`);let s=await de.load(e,a,o);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(c=s==null?void 0:s.constructor)==null?void 0:c.name}`);let i;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",s,"for object:",e),i=new ms(s),console.log("[ObjectFactory] Created object:",i,"type:",(l=i==null?void 0:i.constructor)==null?void 0:l.name),this.applyTransform(i,t==null?void 0:t.transform);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(u=s==null?void 0:s.constructor)==null?void 0:u.name,s),s&&(((f=s.constructor)==null?void 0:f.name)==="Container"||s instanceof an)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let d=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],h=!1;for(let y of d)try{let m=await fetch(y);if(m.ok){i=await m.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",y,"type:",(p=i==null?void 0:i.constructor)==null?void 0:p.name),h=!0;break}}catch{continue}h||(console.error("[ObjectFactory] Failed to reload JSON from any path"),i=s)}else i=s;else i=s,i&&typeof i=="object"&&("x"in i||"position"in i)&&this.applyTransform(i,t==null?void 0:t.transform);return i}static applyTransform(e,t){var o,a,s,i;!t||!e||(t.position&&("x"in e&&"y"in e?(e.x=(o=t.position.x)!=null?o:0,e.y=(a=t.position.y)!=null?a:0):"position"in e&&e.position&&e.position.set((s=t.position.x)!=null?s:0,(i=t.position.y)!=null?i:0)),t.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(t.scale):e.scale=t.scale),t.rotation!==void 0&&"rotation"in e&&(e.rotation=t.rotation),t.anchor&&"anchor"in e&&e.anchor&&Array.isArray(t.anchor)&&("set"in e.anchor?e.anchor.set(t.anchor[0],t.anchor[1]):(e.anchor.x=t.anchor[0],e.anchor.y=t.anchor[1])))}};export{Q as AssetCache,de as AssetLoader,Se as GameObject,$e as GameObjectManager,Be as ObjectFactory,we as Renderer,xe as Transform,ts as animateHandClick,Vn as animatePanelEntrance,Xn as createEndGamePanel,as as createHandTutorial,Hn as createPixiBase,os as createTutorialLabel,Gn as getRegisteredFontIds,cs as playLottieOverlay,qn as registerFont,Oe as registerType,V as resolveFont,K as resolveFontWeight,ls as setLottieInstance,is as updateHandAnimation};
|