handler-playable-sdk 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-UVBNGLP3.mjs +17 -0
- package/dist/index.js +1 -17
- package/dist/index.mjs +1 -1
- package/dist/pixi/index.d.mts +111 -23
- package/dist/pixi/index.d.ts +111 -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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var u={};function I(e,t,n=!1){u[e]||(u[e]=[]),u[e].push({fn:t,once:n})}function V(e,t){if(u[e]){if(!t){delete u[e];return}u[e]=u[e].filter(n=>n.fn!==t)}}function P(e,...t){let n=u[e];if(n)for(let i of[...n])i.fn(...t),i.once&&V(e,i.fn)}function a(e,t){I(e,t,!0)}var R={name:"handler-playable-sdk",version:"0.2.7",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var s=0,Se=s++,Z=s++,ee=s++,te=s++,ne=s++,ie=s++,oe=s++,re=s++,ae=s++,se=s++,de=s++,le=s++,r=Se;function ce(){return r===Z}function ue(){return r===ee}function pe(){return r===te}function fe(){return r===ne}function g(){return r===ie}function y(){return r===oe}function me(){return r===re}function ge(){return r===ae}function ye(){return r===se}function H(){return r===de}function F(){return r===le}function we(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),r=Z;return}catch{}else if(e==="dapi")try{dapi.isReady(),r=ee;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(r=te)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(r=ne)}catch{}else if(t==="mintegral")window.gameReady&&(r=ie);else if(t==="tapjoy")window.TJ_API&&(r=oe);else if(t==="tiktok")window.openAppStore&&(r=re);else if(t==="smadex")try{window.smxTracking&&(r=ae)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(r=se)}catch{}else t==="vungle"?r=de:(e==="nucleo"||t==="nucleo")&&(r=le)}var Ee={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"},Ce=Math.random().toString(36).slice(2),w=null,A={...Ee},Ae="web_embed",De={},G=!1,E=!1,T=!1,ke=!1,B=1,W=0,z=!1,d=!1,N="",h=Math.floor(window.innerWidth),b=Math.floor(window.innerHeight),K=h>b,l=!1,k=!1,he=!1,be=!1,U=!1,j=null;function xe(){if(w)return w;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),w=e,e}function M(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Te(e,t){return{event_name:e,ts:Date.now(),session_id:Ce,deployment_id:A.deployment_id,variant_id:A.variant_id,export_profile_id:A.profile_id,instance_id:A.instance_id||"default",env:Ae==="mraid"?"mraid":"web",payload:t}}function o(e,t){let n=M(e),i=Te(n,t);P(n,i),n!==e&&P(e,i)}function O(){j&&(j(h,b),j=null)}function x(e){B=e,o("volume",e)}function _(e){e&&(ke=!0),!T&&(T=!0,o("pause"),x(0))}function S(e){!e&&ke||T&&(T=!1,o("resume"),x(B))}function f(e,t){h=Math.floor(e||window.innerWidth),b=Math.floor(t||window.innerHeight),K=h>b,o("resize",{width:h,height:b})}function Le(){if(ce())try{let e=mraid.getMaxSize();f(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?S():_()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();f(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();x(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&x(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),z=!0,mraid.isViewable()&&mraid.getState()!=="hidden")l=!0,o("boot"),o("view"),o("ready"),d=!0,O();else{let n=()=>{l=!0,o("boot"),o("view"),o("ready"),d=!0,O()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ie(){if(ue())try{let e=dapi.getScreenSize();f(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?S():_()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();f(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(x(t?1:0),dapi.addEventListener("audioVolumeChange",n=>x(n?1:0)),z=!0,dapi.isViewable())l=!0,o("boot"),o("view"),o("ready"),d=!0,O();else{let n=()=>{l=!0,o("boot"),o("view"),o("ready"),d=!0,O()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function _e(){let e=()=>{l||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(l=!0,o("boot"),o("view"),o("ready"),d=!0,O(),k&&(k=!1,p.start()))};window.addEventListener("resize",()=>f()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(S(),e()):_()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),z=!0}function Pe(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(he=!0),!(he&&t instanceof MouseEvent)&&(W+=1,o("interaction",W))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function Re(e){var i,c,v,C,J,D,q,L,$,X,Y,Q;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(y())(v=(c=window.TJ_API)==null?void 0:c.click)==null||v.call(c);else if(pe())(J=(C=window.FbPlayableAd)==null?void 0:C.onCTAClick)==null||J.call(C);else if(ye())(q=(D=window.ScPlayableAd)==null?void 0:D.onCTAClick)==null||q.call(D);else if(ge())try{($=(L=window.smxTracking)==null?void 0:L.redirect)==null||$.call(L)}catch(m){console.warn("Smadex redirect failed",m)}else if(fe()){let m=window.ExitApi;m&&typeof m.exit=="function"?m.exit(e||N||""):e&&window.open(e)}else g()?(X=window.install)==null||X.call(window):me()?(Y=window.openAppStore)==null||Y.call(window):H()?(Q=parent==null?void 0:parent.postMessage)==null||Q.call(parent,"download","*"):e&&window.open(e)}function je(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;a("view",()=>t(n.mraid_viewable)),a("start",()=>t(n.game_viewable)),a("engagement",()=>t(n.engagement));let i=()=>t(n.complete);a("complete",i),I("engagement",c=>{var v;((v=c==null?void 0:c.payload)==null?void 0:v.count)>3&&i()}),a("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;a("view",()=>t(n.Ad_Load_Start)),a("start",()=>t(n.Ad_Viewable)),a("engagement",()=>t(n.First_Engagement)),a("complete",()=>t(n.Gameplay_Complete)),a("cta_click",()=>t(n.DSP_Click)),a("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Me(){if(!y())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{p.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function ve(){var t,n,i;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),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function Ne(){g()&&(window.mintGameStart=()=>{S(!0),f()},window.mintGameClose=()=>{_(!0)})}function ze(){if(!F())return;let e=window.NUC;!e||!e.trigger||(p.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,N)}),p.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var p={init(e={},t){if(Ae=e.profile||"web_embed",De=e.consent||{},A={...Ee,...e.ids||{}},w=e.rootEl||w,N=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(j=t),o("init"),document.body.oncontextmenu=()=>!1,xe(),Ve(w),we(),Le(),Ie(),!z){if(document.readyState==="complete")_e();else if(!be){be=!0;let n=()=>{_e(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Pe(),je(),Me(),Ne(),ze(),console.log(`%c @handler/playable-sdk %c v${R.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;"),l&&!d&&(o("boot"),o("view"),o("ready"),k&&(k=!1,p.start()),d=!0),d=l},getRoot(){return xe()},get version(){return R.version||"0.0.0"},get maxWidth(){return h},get maxHeight(){return b},get isLandscape(){return K},get isReady(){return d},get isStarted(){return G},get isPaused(){return T},get isFinished(){return E},get volume(){return B},get interactions(){return W},on(e,t){I(M(e),t)},off(e,t){V(M(e),t)},start(){var e,t;if(!G){if(!l){k=!0;return}if(G=!0,o("start"),f(),g())_(),(e=window.gameReady)==null||e.call(window);else if(y()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:K?"landscape":"portrait",buildID:R.version||"dev"})}}},finish(){var e,t;E||(E=!0,o("complete"),g()?(e=window.gameEnd)==null||e.call(window):H()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):y()&&ve())},install(e){if(!E){E=!0,y()?(ve(),setTimeout(()=>p.install(e),300)):(o("complete"),setTimeout(()=>p.install(e),0));return}U||(U=!0,setTimeout(()=>U=!1,500),o("cta_click"),o("conversion"),Re(e||N))},emit(e,t){let n=M(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 i=Te(n,t);P(n,i)},retry(){var e,t,n;if(g())(e=window.gameRetry)==null||e.call(window);else if(F()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}o("engagement",{action:"retry"})},pause(){_(!0)},resume(){S(!0)},resize(e,t){f(e,t)}},Be=p;function Ve(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
2
|
+
(function(){
|
|
3
|
+
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
4
|
+
function unlock(){
|
|
5
|
+
if(window.AudioContext && AudioContext.prototype.resume){
|
|
6
|
+
if(!window.__handler_audio_ctx){
|
|
7
|
+
window.__handler_audio_ctx = new AudioContext();
|
|
8
|
+
}
|
|
9
|
+
if(window.__handler_audio_ctx.state === 'suspended'){
|
|
10
|
+
window.__handler_audio_ctx.resume();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
events.forEach(function(e){ document.removeEventListener(e, unlock); });
|
|
14
|
+
}
|
|
15
|
+
events.forEach(function(e){ document.addEventListener(e, unlock, false); });
|
|
16
|
+
})();
|
|
17
|
+
`,e.appendChild(t)}export{p as a,Be as b};
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
"use strict";var V=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Le=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})},Ie=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ce(t))!De.call(e,a)&&a!==n&&V(e,a,{get:()=>t[a],enumerable:!(i=Se(t,a))||i.enumerable});return e};var Pe=e=>Ie(V({},"__esModule",{value:!0}),e);var qe={};Le(qe,{Handler:()=>u,default:()=>Be});module.exports=Pe(qe);var p={};function I(e,t,n=!1){p[e]||(p[e]=[]),p[e].push({fn:t,once:n})}function H(e,t){if(p[e]){if(!t){delete p[e];return}p[e]=p[e].filter(n=>n.fn!==t)}}function P(e,...t){let n=p[e];if(n)for(let i of[...n])i.fn(...t),i.once&&H(e,i.fn)}function s(e,t){I(e,t,!0)}var R={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 d=0,Me=d++,ee=d++,te=d++,ne=d++,ie=d++,oe=d++,re=d++,ae=d++,se=d++,de=d++,le=d++,ce=d++,r=Me;function ue(){return r===ee}function pe(){return r===te}function fe(){return r===ne}function me(){return r===ie}function g(){return r===oe}function y(){return r===re}function ge(){return r===ae}function ye(){return r===se}function we(){return r===de}function F(){return r===le}function G(){return r===ce}function he(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),r=ee;return}catch{}else if(e==="dapi")try{dapi.isReady(),r=te;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(r=ne)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(r=ie)}catch{}else if(t==="mintegral")window.gameReady&&(r=oe);else if(t==="tapjoy")window.TJ_API&&(r=re);else if(t==="tiktok")window.openAppStore&&(r=ae);else if(t==="smadex")try{window.smxTracking&&(r=se)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(r=de)}catch{}else t==="vungle"?r=le:(e==="nucleo"||t==="nucleo")&&(r=ce)}var Ae={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"},je=Math.random().toString(36).slice(2),w=null,A={...Ae},ke="web_embed",Ne={},U=!1,E=!1,T=!1,Te=!1,J=1,K=0,z=!1,l=!1,N="",h=Math.floor(window.innerWidth),b=Math.floor(window.innerHeight),B=h>b,c=!1,k=!1,be=!1,_e=!1,W=!1,M=null;function ve(){if(w)return w;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),w=e,e}function j(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Oe(e,t){return{event_name:e,ts:Date.now(),session_id:je,deployment_id:A.deployment_id,variant_id:A.variant_id,export_profile_id:A.profile_id,instance_id:A.instance_id||"default",env:ke==="mraid"?"mraid":"web",payload:t}}function o(e,t){let n=j(e),i=Oe(n,t);P(n,i),n!==e&&P(e,i)}function O(){M&&(M(h,b),M=null)}function _(e){J=e,o("volume",e)}function v(e){e&&(Te=!0),!T&&(T=!0,o("pause"),_(0))}function S(e){!e&&Te||T&&(T=!1,o("resume"),_(J))}function f(e,t){h=Math.floor(e||window.innerWidth),b=Math.floor(t||window.innerHeight),B=h>b,o("resize",{width:h,height:b})}function ze(){if(ue())try{let e=mraid.getMaxSize();f(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?S():v()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();f(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();_(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&_(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),z=!0,mraid.isViewable()&&mraid.getState()!=="hidden")c=!0,o("boot"),o("view"),o("ready"),l=!0,O();else{let n=()=>{c=!0,o("boot"),o("view"),o("ready"),l=!0,O()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ve(){if(pe())try{let e=dapi.getScreenSize();f(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?S():v()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();f(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(_(t?1:0),dapi.addEventListener("audioVolumeChange",n=>_(n?1:0)),z=!0,dapi.isViewable())c=!0,o("boot"),o("view"),o("ready"),l=!0,O();else{let n=()=>{c=!0,o("boot"),o("view"),o("ready"),l=!0,O()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function xe(){let e=()=>{c||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(c=!0,o("boot"),o("view"),o("ready"),l=!0,O(),k&&(k=!1,u.start()))};window.addEventListener("resize",()=>f()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(S(),e()):v()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),z=!0}function He(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(be=!0),!(be&&t instanceof MouseEvent)&&(K+=1,o("interaction",K))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function Fe(e){var i,a,x,C,q,D,$,L,X,Y,Q,Z;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(y())(x=(a=window.TJ_API)==null?void 0:a.click)==null||x.call(a);else if(fe())(q=(C=window.FbPlayableAd)==null?void 0:C.onCTAClick)==null||q.call(C);else if(we())($=(D=window.ScPlayableAd)==null?void 0:D.onCTAClick)==null||$.call(D);else if(ye())try{(X=(L=window.smxTracking)==null?void 0:L.redirect)==null||X.call(L)}catch(m){console.warn("Smadex redirect failed",m)}else if(me()){let m=window.ExitApi;m&&typeof m.exit=="function"?m.exit(e||N||""):e&&window.open(e)}else g()?(Y=window.install)==null||Y.call(window):ge()?(Q=window.openAppStore)==null||Q.call(window):F()?(Z=parent==null?void 0:parent.postMessage)==null||Z.call(parent,"download","*"):e&&window.open(e)}function Ge(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;s("view",()=>t(n.mraid_viewable)),s("start",()=>t(n.game_viewable)),s("engagement",()=>t(n.engagement));let i=()=>t(n.complete);s("complete",i),I("engagement",a=>{var x;((x=a==null?void 0:a.payload)==null?void 0:x.count)>3&&i()}),s("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;s("view",()=>t(n.Ad_Load_Start)),s("start",()=>t(n.Ad_Viewable)),s("engagement",()=>t(n.First_Engagement)),s("complete",()=>t(n.Gameplay_Complete)),s("cta_click",()=>t(n.DSP_Click)),s("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Ue(){if(!y())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{u.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function Ee(){var t,n,i;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),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function We(){g()&&(window.mintGameStart=()=>{S(!0),f()},window.mintGameClose=()=>{v(!0)})}function Ke(){if(!G())return;let e=window.NUC;!e||!e.trigger||(u.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,N)}),u.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var u={init(e={},t){if(ke=e.profile||"web_embed",Ne=e.consent||{},A={...Ae,...e.ids||{}},w=e.rootEl||w,N=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(M=t),o("init"),document.body.oncontextmenu=()=>!1,ve(),Je(w),he(),ze(),Ve(),!z){if(document.readyState==="complete")xe();else if(!_e){_e=!0;let n=()=>{xe(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}He(),Ge(),Ue(),We(),Ke(),console.log(`%c @handler/playable-sdk %c v${R.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;"),c&&!l&&(o("boot"),o("view"),o("ready"),k&&(k=!1,u.start()),l=!0),l=c},getRoot(){return ve()},get version(){return R.version||"0.0.0"},get maxWidth(){return h},get maxHeight(){return b},get isLandscape(){return B},get isReady(){return l},get isStarted(){return U},get isPaused(){return T},get isFinished(){return E},get volume(){return J},get interactions(){return K},on(e,t){I(j(e),t)},off(e,t){H(j(e),t)},start(){var e,t;if(!U){if(!c){k=!0;return}if(U=!0,o("start"),f(),g())v(),(e=window.gameReady)==null||e.call(window);else if(y()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:B?"landscape":"portrait",buildID:R.version||"dev"})}}},finish(){var e,t;E||(E=!0,o("complete"),g()?(e=window.gameEnd)==null||e.call(window):F()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):y()&&Ee())},install(e){if(!E){E=!0,y()?(Ee(),setTimeout(()=>u.install(e),300)):(o("complete"),setTimeout(()=>u.install(e),0));return}W||(W=!0,setTimeout(()=>W=!1,500),o("cta_click"),o("conversion"),Fe(e||N))},emit(e,t){let n=j(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 i=Oe(n,t);P(n,i)},retry(){var e,t,n;if(g())(e=window.gameRetry)==null||e.call(window);else if(G()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}o("engagement",{action:"retry"})},pause(){v(!0)},resume(){S(!0)},resize(e,t){f(e,t)}},Be=u;function Je(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
2
|
-
(function(){
|
|
3
|
-
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
4
|
-
function unlock(){
|
|
5
|
-
if(window.AudioContext && AudioContext.prototype.resume){
|
|
6
|
-
if(!window.__handler_audio_ctx){
|
|
7
|
-
window.__handler_audio_ctx = new AudioContext();
|
|
8
|
-
}
|
|
9
|
-
if(window.__handler_audio_ctx.state === 'suspended'){
|
|
10
|
-
window.__handler_audio_ctx.resume();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
events.forEach(function(e){ document.removeEventListener(e, unlock); });
|
|
14
|
-
}
|
|
15
|
-
events.forEach(function(e){ document.addEventListener(e, unlock, false); });
|
|
16
|
-
})();
|
|
17
|
-
`,e.appendChild(t)}0&&(module.exports={Handler});
|
|
1
|
+
const a0_0x5baf15=a0_0x3db0;(function(_0x5557eb,_0x1808ab){const _0x1312ac=a0_0x3db0,_0x54a91f=_0x5557eb();while(!![]){try{const _0x5d99fc=parseInt(_0x1312ac(0x1bc))/0x1+-parseInt(_0x1312ac(0x1e6))/0x2+-parseInt(_0x1312ac(0x1c6))/0x3*(parseInt(_0x1312ac(0x263))/0x4)+-parseInt(_0x1312ac(0x26e))/0x5+-parseInt(_0x1312ac(0x220))/0x6+-parseInt(_0x1312ac(0x25f))/0x7+parseInt(_0x1312ac(0x1fd))/0x8;if(_0x5d99fc===_0x1808ab)break;else _0x54a91f['push'](_0x54a91f['shift']());}catch(_0x467b94){_0x54a91f['push'](_0x54a91f['shift']());}}}(a0_0x358c,0x37dbf));const a0_0x51b87a=(function(){let _0x15ce14=!![];return function(_0x2dbd77,_0x1d57b5){const _0x79970=_0x15ce14?function(){const _0x1b5fd0=a0_0x3db0;if(_0x1d57b5){const _0x93d6c8=_0x1d57b5[_0x1b5fd0(0x1b5)](_0x2dbd77,arguments);return _0x1d57b5=null,_0x93d6c8;}}:function(){};return _0x15ce14=![],_0x79970;};}()),a0_0x3fa554=a0_0x51b87a(this,function(){const _0x555f08=a0_0x3db0;return a0_0x3fa554['toString']()['search'](_0x555f08(0x1e5))[_0x555f08(0x23f)]()[_0x555f08(0x1b7)](a0_0x3fa554)[_0x555f08(0x1fb)]('(((.+)+)+)+$');});a0_0x3fa554();'use strict';var V=Object[a0_0x5baf15(0x25e)],Se=Object[a0_0x5baf15(0x1eb)],Ce=Object['getOwnPropertyNames'],De=Object[a0_0x5baf15(0x238)]['hasOwnProperty'],Le=(_0x2168de,_0x1a5022)=>{for(var _0x143d80 in _0x1a5022)V(_0x2168de,_0x143d80,{'get':_0x1a5022[_0x143d80],'enumerable':!0x0});},Ie=(_0x538657,_0x5783a8,_0x5bfadc,_0x57d390)=>{const _0x5edab2=a0_0x5baf15;if(_0x5783a8&&typeof _0x5783a8==_0x5edab2(0x1f6)||typeof _0x5783a8==_0x5edab2(0x25a)){for(let _0x3e52c2 of Ce(_0x5783a8))!De['call'](_0x538657,_0x3e52c2)&&_0x3e52c2!==_0x5bfadc&&V(_0x538657,_0x3e52c2,{'get':()=>_0x5783a8[_0x3e52c2],'enumerable':!(_0x57d390=Se(_0x5783a8,_0x3e52c2))||_0x57d390[_0x5edab2(0x24e)]});}return _0x538657;},Pe=_0x520d87=>Ie(V({},a0_0x5baf15(0x1ec),{'value':!0x0}),_0x520d87),qe={};Le(qe,{'Handler':()=>u,'default':()=>Be}),module[a0_0x5baf15(0x233)]=Pe(qe);var p={};function I(_0x3a7e9d,_0x457dc8,_0x575eaf=!0x1){const _0x9593f6=a0_0x5baf15;p[_0x3a7e9d]||(p[_0x3a7e9d]=[]),p[_0x3a7e9d][_0x9593f6(0x20c)]({'fn':_0x457dc8,'once':_0x575eaf});}function H(_0xda3e73,_0x173019){const _0x39f3bc=a0_0x5baf15;if(p[_0xda3e73]){if(!_0x173019){delete p[_0xda3e73];return;}p[_0xda3e73]=p[_0xda3e73][_0x39f3bc(0x213)](_0x5384fa=>_0x5384fa['fn']!==_0x173019);}}function P(_0x21d126,..._0x30cc7d){const _0x3a97df=a0_0x5baf15;let _0x1b5296=p[_0x21d126];if(_0x1b5296){for(let _0x3f3295 of[..._0x1b5296])_0x3f3295['fn'](..._0x30cc7d),_0x3f3295[_0x3a97df(0x20b)]&&H(_0x21d126,_0x3f3295['fn']);}}function s(_0x24bbab,_0x4bb7f8){I(_0x24bbab,_0x4bb7f8,!0x0);}var R={'name':a0_0x5baf15(0x1c7),'version':a0_0x5baf15(0x1f8),'description':a0_0x5baf15(0x1fe),'main':a0_0x5baf15(0x23d),'module':a0_0x5baf15(0x1da),'types':a0_0x5baf15(0x215),'exports':{'.':{'types':a0_0x5baf15(0x231),'import':a0_0x5baf15(0x1f4),'require':a0_0x5baf15(0x1dc)},'./pixi':{'types':a0_0x5baf15(0x260),'import':'./dist/pixi/index.mjs','require':a0_0x5baf15(0x1f5)},'./three':{'types':'./dist/three/index.d.ts','import':a0_0x5baf15(0x24b),'require':a0_0x5baf15(0x201)}},'scripts':{'build':'tsup\x20src/index.ts\x20src/pixi/index.ts\x20src/three/index.ts\x20--format\x20cjs,esm\x20--dts\x20--clean\x20--minify\x20--external\x20lottie-web\x20&&\x20npm\x20run\x20obfuscate','build:dev':'tsup\x20src/index.ts\x20src/pixi/index.ts\x20src/three/index.ts\x20--format\x20cjs,esm\x20--dts\x20--clean\x20--external\x20lottie-web','obfuscate':'javascript-obfuscator\x20dist/index.js\x20dist/index.mjs\x20dist/pixi/index.js\x20dist/pixi/index.mjs\x20dist/three/index.js\x20dist/three/index.mjs\x20--output\x20dist\x20--options-preset\x20high-obfuscation\x20--compact\x20true\x20--self-defending\x20true','lint':'eslint\x20\x27src/**/*.{ts,tsx}\x27','typecheck':a0_0x5baf15(0x1c5),'prepublishOnly':a0_0x5baf15(0x209),'publish:update':a0_0x5baf15(0x1f3),'publish:update:minor':a0_0x5baf15(0x26d),'publish:update:major':a0_0x5baf15(0x1df)},'author':a0_0x5baf15(0x261),'license':'MIT','publishConfig':{'access':'public'},'repository':{'type':a0_0x5baf15(0x22e),'url':a0_0x5baf15(0x1bf)},'files':[a0_0x5baf15(0x23e),'LICENSE',a0_0x5baf15(0x1d2)],'peerDependencies':{'lottie-web':a0_0x5baf15(0x22c),'pixi.js':a0_0x5baf15(0x272),'three':'^0.160.0'},'peerDependenciesMeta':{'pixi.js':{'optional':!0x0},'three':{'optional':!0x0},'lottie-web':{'optional':!0x0}},'devDependencies':{'@types/three':a0_0x5baf15(0x1f9),'eslint':a0_0x5baf15(0x1d1),'javascript-obfuscator':a0_0x5baf15(0x24c),'pixi.js':a0_0x5baf15(0x1f7),'three':a0_0x5baf15(0x1f9),'ts-node':'^10.9.2','tsup':'^8.4.0','typescript':a0_0x5baf15(0x1e9)}},d=0x0,je=d++,ee=d++,te=d++,ne=d++,ie=d++,oe=d++,re=d++,ae=d++,se=d++,de=d++,le=d++,ce=d++,r=je;function ue(){return r===ee;}function pe(){return r===te;}function fe(){return r===ne;}function me(){return r===ie;}function g(){return r===oe;}function y(){return r===re;}function ge(){return r===ae;}function a0_0x3db0(_0x2aed4d,_0x5b6bc8){_0x2aed4d=_0x2aed4d-0x1b5;const _0x348b64=a0_0x358c();let _0x3fa554=_0x348b64[_0x2aed4d];return _0x3fa554;}function ye(){return r===se;}function a0_0x358c(){const _0x50a0eb=['true','payload','Ad_Viewable','error','node\x20scripts/publish-and-update.js\x20patch','./dist/index.mjs','./dist/pixi/index.js','object','8.8.1','0.2.7','^0.160.0','getMaxSize','search','google','13167712TQGkPw','Handler\x20Playable\x20SDK\x20v0.1\x20with\x20contract-aligned\x20surface\x20(root\x20sandbox,\x20canonical\x20event\x20envelope).','adResized','web_embed','./dist/three/index.js','destinationUrl','FbPlayableAd','oncontextmenu','NUC','data-handler-root','default','random','npm\x20run\x20build','nucleo','once','push','touchstart','action:','innerHeight','0.0.0','First_Engagement','boot','filter','isViewable','dist/index.d.ts','tapjoy','INMOBI_DSPMACROS','smxTracking','facebook','interactive','getAudioVolume','profile','call','resize','setPlayableBuild','2605458ejHMPz','\x20must\x20be\x20canonical\x20or\x20namespaced\x20as\x20custom.<mechanic_id>.<event>','retry','getState','removeEventListener','volume','Smadex\x20redirect\x20failed','visible','openStoreUrl','ScPlayableAd','pause','addEventListener','^5.0.0','DAPI\x20hook\x20skipped','git','slice','script','./dist/index.d.ts','isReady','exports','visibilityState','none','sizeChange','viewableChange','prototype','MRAID\x20hook\x20skipped','onCTAClick','innerWidth','redirect','dist/index.js','dist','toString','hidden','height','postMessage','createElement','undefined','getScreenSize','mraid','dev','body','gameReady','ids','./dist/three/index.mjs','^5.1.0','forEach','enumerable','userAgent','complete','mintGameStart','readyState','finish','setAttribute','Tapjoy\x20skip\x20failed','DOMContentLoaded','mintegral','view','landscape','function','appendChild','type','TODO_variant_id','defineProperty','2187892KJsoOO','./dist/pixi/index.d.ts','Handler','width','234952ExtVZd','mintGameClose','conversion','background:\x20#e1e4e8;\x20color:\x20#333;\x20font-size:\x2014px;\x20padding:\x204px\x208px;\x20border-top-right-radius:\x204px;\x20border-bottom-right-radius:\x204px;','cta_click','TODO_deployment_id','inmobi','smadex','trigger','profile_id','node\x20scripts/publish-and-update.js\x20minor','1707875ZypTkY','floor','click','resume','^8.0.0','ExitApi','TODO_mechanic_id','apply','ready','constructor','Ad_Load_Start','setPlayableAPI','gameEnd','mousedown','30525JEMCSc','install','tiktok','https://github.com/HandlerAIGames/handler-playable-sdk.git','exit','vungle','dapi','instance_id','TJ_API','tsc\x20--noEmit','6SlamVj','handler-playable-sdk','textContent','version','snapchat','deployment_id','openAppStore','https://play.google.com/store','custom.','mraid_viewable','test','^8.57.1','README.md','includes','open','warn','download','start','div','visibilitychange','dist/index.mjs','engagement','./dist/index.js','Event\x20','startsWith','node\x20scripts/publish-and-update.js\x20major','objectiveComplete','interaction','TODO_export_id','\x0a\x20\x20\x20\x20(function(){\x0a\x20\x20\x20\x20\x20\x20var\x20events\x20=\x20[\x27touchstart\x27,\x27touchend\x27,\x27mousedown\x27,\x27keydown\x27];\x0a\x20\x20\x20\x20\x20\x20function\x20unlock(){\x0a\x20\x20\x20\x20\x20\x20\x20\x20if(window.AudioContext\x20&&\x20AudioContext.prototype.resume){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if(!window.__handler_audio_ctx){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20window.__handler_audio_ctx\x20=\x20new\x20AudioContext();\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if(window.__handler_audio_ctx.state\x20===\x20\x27suspended\x27){\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20window.__handler_audio_ctx.resume();\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20events.forEach(function(e){\x20document.removeEventListener(e,\x20unlock);\x20});\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20events.forEach(function(e){\x20document.addEventListener(e,\x20unlock,\x20false);\x20});\x0a\x20\x20\x20\x20})();\x0a\x20\x20','load','(((.+)+)+)+$','483680akCumG','handler-root','convert','^5.7.2','bigabid','getOwnPropertyDescriptor','__esModule','audioVolumeChange','Gameplay_Complete'];a0_0x358c=function(){return _0x50a0eb;};return a0_0x358c();}function we(){return r===de;}function F(){return r===le;}function G(){return r===ce;}function he(){const _0x3b7f7=a0_0x5baf15;let _0x5718cd=typeof AD_PROTOCOL!='undefined'?AD_PROTOCOL:_0x3b7f7(0x235),_0x577a0b=typeof AD_NETWORK!=_0x3b7f7(0x244)?AD_NETWORK:_0x3b7f7(0x200);if(_0x5718cd==='mraid')try{mraid[_0x3b7f7(0x223)](),r=ee;return;}catch{}else{if(_0x5718cd===_0x3b7f7(0x1c2))try{dapi[_0x3b7f7(0x232)](),r=te;return;}catch{}}if(_0x577a0b===_0x3b7f7(0x219))try{typeof FbPlayableAd!='undefined'&&(r=ne);}catch{}else{if(_0x577a0b===_0x3b7f7(0x1fc))try{typeof ExitApi!=_0x3b7f7(0x244)&&(r=ie);}catch{}else{if(_0x577a0b===_0x3b7f7(0x257))window[_0x3b7f7(0x249)]&&(r=oe);else{if(_0x577a0b===_0x3b7f7(0x216))window['TJ_API']&&(r=re);else{if(_0x577a0b===_0x3b7f7(0x1be))window[_0x3b7f7(0x1cc)]&&(r=ae);else{if(_0x577a0b===_0x3b7f7(0x26a))try{window[_0x3b7f7(0x218)]&&(r=se);}catch{}else{if(_0x577a0b===_0x3b7f7(0x1ca))try{window[_0x3b7f7(0x229)]&&(r=de);}catch{}else _0x577a0b===_0x3b7f7(0x1c1)?r=le:(_0x5718cd==='nucleo'||_0x577a0b===_0x3b7f7(0x20a))&&(r=ce);}}}}}}}var Ae={'mechanic_id':a0_0x5baf15(0x274),'variant_id':a0_0x5baf15(0x25d),'deployment_id':a0_0x5baf15(0x268),'export_id':a0_0x5baf15(0x1e2),'profile_id':'TODO_profile_id','instance_id':a0_0x5baf15(0x207)},Me=Math[a0_0x5baf15(0x208)]()['toString'](0x24)[a0_0x5baf15(0x22f)](0x2),w=null,A={...Ae},ke=a0_0x5baf15(0x200),Ne={},U=!0x1,E=!0x1,T=!0x1,Te=!0x1,J=0x1,K=0x0,z=!0x1,l=!0x1,N='',h=Math[a0_0x5baf15(0x26f)](window[a0_0x5baf15(0x23b)]),b=Math[a0_0x5baf15(0x26f)](window[a0_0x5baf15(0x20f)]),B=h>b,c=!0x1,k=!0x1,be=!0x1,xe=!0x1,W=!0x1,j=null;function _e(){const _0x2fb34a=a0_0x5baf15;if(w)return w;let _0x48bce1=document[_0x2fb34a(0x243)](_0x2fb34a(0x1d8));return _0x48bce1['id']=_0x2fb34a(0x1e7),_0x48bce1[_0x2fb34a(0x254)](_0x2fb34a(0x206),_0x2fb34a(0x1ef)),document['body']['appendChild'](_0x48bce1),w=_0x48bce1,_0x48bce1;}function M(_0x31d24f){const _0x595e11=a0_0x5baf15;switch(_0x31d24f){case'interaction':return _0x595e11(0x1db);case'finish':return'complete';case'install':return _0x595e11(0x267);default:return _0x31d24f;}}function Oe(_0x1c713d,_0x303a44){const _0x2a1057=a0_0x5baf15;return{'event_name':_0x1c713d,'ts':Date['now'](),'session_id':Me,'deployment_id':A[_0x2a1057(0x1cb)],'variant_id':A['variant_id'],'export_profile_id':A[_0x2a1057(0x26c)],'instance_id':A[_0x2a1057(0x1c3)]||'default','env':ke===_0x2a1057(0x246)?'mraid':'web','payload':_0x303a44};}function o(_0x1ee436,_0x3bb331){let _0x4f21a5=M(_0x1ee436),_0x4f0f3a=Oe(_0x4f21a5,_0x3bb331);P(_0x4f21a5,_0x4f0f3a),_0x4f21a5!==_0x1ee436&&P(_0x1ee436,_0x4f0f3a);}function O(){j&&(j(h,b),j=null);}function x(_0x433929){const _0x2a3cb5=a0_0x5baf15;J=_0x433929,o(_0x2a3cb5(0x225),_0x433929);}function _(_0x51451b){_0x51451b&&(Te=!0x0),!T&&(T=!0x0,o('pause'),x(0x0));}function S(_0x3818b1){const _0x82c247=a0_0x5baf15;!_0x3818b1&&Te||T&&(T=!0x1,o(_0x82c247(0x271)),x(J));}function f(_0x136394,_0x1da159){const _0x48cbfd=a0_0x5baf15;h=Math[_0x48cbfd(0x26f)](_0x136394||window[_0x48cbfd(0x23b)]),b=Math[_0x48cbfd(0x26f)](_0x1da159||window['innerHeight']),B=h>b,o(_0x48cbfd(0x21e),{'width':h,'height':b});}function ze(){const _0x17e236=a0_0x5baf15;if(ue())try{let _0x724243=mraid[_0x17e236(0x1fa)]();f(_0x724243[_0x17e236(0x262)],_0x724243[_0x17e236(0x241)]);let _0x2e6eb3=()=>{const _0x44c391=_0x17e236;mraid['isViewable']()&&mraid['getState']()!==_0x44c391(0x240)?S():_();};if(mraid[_0x17e236(0x22b)](_0x17e236(0x237),_0x2e6eb3),mraid[_0x17e236(0x22b)]('stateChange',_0x2e6eb3),mraid[_0x17e236(0x22b)](_0x17e236(0x236),()=>{const _0x2aef03=_0x17e236;let _0x12eb4a=mraid[_0x2aef03(0x1fa)]();f(_0x12eb4a[_0x2aef03(0x262)],_0x12eb4a[_0x2aef03(0x241)]);}),mraid[_0x17e236(0x21b)]){let _0x2be4c7=mraid[_0x17e236(0x21b)]();x(_0x2be4c7?0x1:0x0);}if(mraid['addEventListener'](_0x17e236(0x1ed),_0xa2f292=>{_0xa2f292!==null&&x(_0xa2f292>0x0?0x1:0x0);}),mraid[_0x17e236(0x22b)](_0x17e236(0x1f2),(_0x5f1408,_0x9d9413)=>{const _0x442323=_0x17e236;console[_0x442323(0x1d5)]('mraid\x20error:',_0x5f1408,_0x442323(0x20e),_0x9d9413);}),z=!0x0,mraid[_0x17e236(0x214)]()&&mraid['getState']()!=='hidden')c=!0x0,o(_0x17e236(0x212)),o(_0x17e236(0x258)),o('ready'),l=!0x0,O();else{let _0x523ee7=()=>{const _0x94599c=_0x17e236;c=!0x0,o(_0x94599c(0x212)),o('view'),o('ready'),l=!0x0,O();};mraid['addEventListener'](_0x17e236(0x1b6),_0x523ee7);}}catch(_0x2aec34){console[_0x17e236(0x1d5)](_0x17e236(0x239),_0x2aec34);}}function Ve(){const _0x2c894b=a0_0x5baf15;if(pe())try{let _0x8f80f0=dapi[_0x2c894b(0x245)]();f(_0x8f80f0[_0x2c894b(0x262)],_0x8f80f0[_0x2c894b(0x241)]),dapi[_0x2c894b(0x22b)]('viewableChange',_0x26a06a=>{const _0x3d120d=_0x2c894b;_0x26a06a[_0x3d120d(0x214)]?S():_();}),dapi[_0x2c894b(0x22b)](_0x2c894b(0x1ff),_0x399230=>{const _0x42df0b=_0x2c894b;let _0x24551d=dapi[_0x42df0b(0x245)]();f(_0x399230[_0x42df0b(0x262)]||_0x24551d['width'],_0x399230[_0x42df0b(0x241)]||_0x24551d[_0x42df0b(0x241)]);});let _0x3442d6=dapi['getAudioVolume']();if(x(_0x3442d6?0x1:0x0),dapi[_0x2c894b(0x22b)](_0x2c894b(0x1ed),_0x180dbc=>x(_0x180dbc?0x1:0x0)),z=!0x0,dapi['isViewable']())c=!0x0,o('boot'),o(_0x2c894b(0x258)),o(_0x2c894b(0x1b6)),l=!0x0,O();else{let _0x4cb379=()=>{const _0x19bea4=_0x2c894b;c=!0x0,o('boot'),o(_0x19bea4(0x258)),o('ready'),l=!0x0,O();};dapi[_0x2c894b(0x22b)]('ready',_0x4cb379);}}catch(_0x4f9b05){console[_0x2c894b(0x1d5)](_0x2c894b(0x22d),_0x4f9b05);}}function ve(){const _0x1b6059=a0_0x5baf15;let _0x30fde1=()=>{const _0x42b210=a0_0x3db0;c||document[_0x42b210(0x234)]===_0x42b210(0x227)&&(document[_0x42b210(0x252)]==='complete'||document['readyState']===_0x42b210(0x21a))&&(c=!0x0,o(_0x42b210(0x212)),o(_0x42b210(0x258)),o(_0x42b210(0x1b6)),l=!0x0,O(),k&&(k=!0x1,u['start']()));};window[_0x1b6059(0x22b)](_0x1b6059(0x21e),()=>f()),document['addEventListener'](_0x1b6059(0x1d9),()=>{const _0x57261b=_0x1b6059;document[_0x57261b(0x234)]===_0x57261b(0x227)?(S(),_0x30fde1()):_();}),document['readyState']===_0x1b6059(0x250)||document['readyState']==='interactive'?_0x30fde1():window['addEventListener'](_0x1b6059(0x1e4),_0x30fde1),z=!0x0;}function He(){const _0xc25483=a0_0x5baf15;let _0x49e39f=_0x5411e5=>{const _0x1a5081=a0_0x3db0;typeof TouchEvent!='undefined'&&_0x5411e5 instanceof TouchEvent&&(be=!0x0),!(be&&_0x5411e5 instanceof MouseEvent)&&(K+=0x1,o(_0x1a5081(0x1e1),K));};document['addEventListener'](_0xc25483(0x1bb),_0x49e39f),document[_0xc25483(0x22b)](_0xc25483(0x20d),_0x49e39f);}function Fe(_0x52fb75){const _0x1dd1e6=a0_0x5baf15;var _0xab7a41,_0xe6a9cf,_0x2e586f,_0x4cec05,_0x4543cd,_0x52481a,_0x2a6a5d,_0x3712b0,_0x4181ab,_0x1fa595,_0x4659b1,_0x3a5eb6;let _0xb3b6c0=typeof AD_PROTOCOL!=_0x1dd1e6(0x244)?AD_PROTOCOL:_0x1dd1e6(0x235);if((typeof AD_NETWORK!=_0x1dd1e6(0x244)?AD_NETWORK:_0x1dd1e6(0x200))===_0x1dd1e6(0x1fc))try{(_0xab7a41=window[_0x1dd1e6(0x273)])==null||_0xab7a41[_0x1dd1e6(0x1c0)]();return;}catch{}if(_0xb3b6c0===_0x1dd1e6(0x246)&&typeof mraid!=_0x1dd1e6(0x244))mraid[_0x1dd1e6(0x1d4)](_0x52fb75||'');else{if(_0xb3b6c0===_0x1dd1e6(0x1c2)&&typeof dapi!=_0x1dd1e6(0x244))dapi[_0x1dd1e6(0x228)]();else{if(y())(_0x2e586f=(_0xe6a9cf=window[_0x1dd1e6(0x1c4)])==null?void 0x0:_0xe6a9cf[_0x1dd1e6(0x270)])==null||_0x2e586f[_0x1dd1e6(0x21d)](_0xe6a9cf);else{if(fe())(_0x4543cd=(_0x4cec05=window[_0x1dd1e6(0x203)])==null?void 0x0:_0x4cec05[_0x1dd1e6(0x23a)])==null||_0x4543cd[_0x1dd1e6(0x21d)](_0x4cec05);else{if(we())(_0x2a6a5d=(_0x52481a=window[_0x1dd1e6(0x229)])==null?void 0x0:_0x52481a[_0x1dd1e6(0x23a)])==null||_0x2a6a5d['call'](_0x52481a);else{if(ye())try{(_0x4181ab=(_0x3712b0=window[_0x1dd1e6(0x218)])==null?void 0x0:_0x3712b0[_0x1dd1e6(0x23c)])==null||_0x4181ab[_0x1dd1e6(0x21d)](_0x3712b0);}catch(_0x2f1a63){console['warn'](_0x1dd1e6(0x226),_0x2f1a63);}else{if(me()){let _0x37aa32=window[_0x1dd1e6(0x273)];_0x37aa32&&typeof _0x37aa32['exit']==_0x1dd1e6(0x25a)?_0x37aa32[_0x1dd1e6(0x1c0)](_0x52fb75||N||''):_0x52fb75&&window[_0x1dd1e6(0x1d4)](_0x52fb75);}else g()?(_0x1fa595=window['install'])==null||_0x1fa595[_0x1dd1e6(0x21d)](window):ge()?(_0x4659b1=window[_0x1dd1e6(0x1cc)])==null||_0x4659b1[_0x1dd1e6(0x21d)](window):F()?(_0x3a5eb6=parent==null?void 0x0:parent[_0x1dd1e6(0x242)])==null||_0x3a5eb6['call'](parent,_0x1dd1e6(0x1d6),'*'):_0x52fb75&&window[_0x1dd1e6(0x1d4)](_0x52fb75);}}}}}}}function Ge(){const _0x509178=a0_0x5baf15;let _0x14fe11=typeof AD_NETWORK!='undefined'?AD_NETWORK:_0x509178(0x200),_0x490dd4=_0x258c92=>{if(!_0x258c92)return;let _0x3fe9f1=new Image();_0x3fe9f1['src']=_0x258c92;};if(_0x14fe11===_0x509178(0x1ea)){let _0x5ee9fc=window['BIGABID_BIDTIMEMACROS'];if(!_0x5ee9fc)return;s(_0x509178(0x258),()=>_0x490dd4(_0x5ee9fc[_0x509178(0x1cf)])),s('start',()=>_0x490dd4(_0x5ee9fc['game_viewable'])),s(_0x509178(0x1db),()=>_0x490dd4(_0x5ee9fc[_0x509178(0x1db)]));let _0x49e17e=()=>_0x490dd4(_0x5ee9fc[_0x509178(0x250)]);s('complete',_0x49e17e),I(_0x509178(0x1db),_0x1d86fc=>{const _0x4bfec9=_0x509178;var _0x1d6438;((_0x1d6438=_0x1d86fc==null?void 0x0:_0x1d86fc[_0x4bfec9(0x1f0)])==null?void 0x0:_0x1d6438['count'])>0x3&&_0x49e17e();}),s(_0x509178(0x267),()=>_0x490dd4(_0x5ee9fc[_0x509178(0x270)]));}else{if(_0x14fe11===_0x509178(0x269)){let _0x71f5af=window[_0x509178(0x217)];if(!_0x71f5af)return;s(_0x509178(0x258),()=>_0x490dd4(_0x71f5af[_0x509178(0x1b8)])),s('start',()=>_0x490dd4(_0x71f5af[_0x509178(0x1f1)])),s('engagement',()=>_0x490dd4(_0x71f5af[_0x509178(0x211)])),s('complete',()=>_0x490dd4(_0x71f5af[_0x509178(0x1ee)])),s('cta_click',()=>_0x490dd4(_0x71f5af['DSP_Click'])),s(_0x509178(0x1d7),()=>{const _0x4ce1ad=_0x509178;[0x5,0xa,0xf,0x14,0x19,0x1e][_0x4ce1ad(0x24d)](_0x5a2e95=>setTimeout(()=>_0x490dd4(_0x71f5af['Spent_'+_0x5a2e95+'_Seconds']),_0x5a2e95*0x3e8));});}}}function Ue(){const _0x3fe7b6=a0_0x5baf15;if(!y())return;let _0x813378=window[_0x3fe7b6(0x1c4)];_0x813378&&_0x813378[_0x3fe7b6(0x1b9)]&&_0x813378[_0x3fe7b6(0x1b9)]({'skipAd':()=>{const _0x1072d0=_0x3fe7b6;try{u[_0x1072d0(0x253)]();}catch(_0x4b2dc5){console[_0x1072d0(0x1d5)](_0x1072d0(0x255),_0x4b2dc5);}}});}function Ee(){const _0x41f662=a0_0x5baf15;var _0x3dcfdc,_0x7bd657,_0x46dacf;let _0x55eb21=window[_0x41f662(0x1c4)];(_0x3dcfdc=_0x55eb21==null?void 0x0:_0x55eb21[_0x41f662(0x1e0)])==null||_0x3dcfdc['call'](_0x55eb21),(_0x7bd657=_0x55eb21==null?void 0x0:_0x55eb21['playableFinished'])==null||_0x7bd657[_0x41f662(0x21d)](_0x55eb21),(_0x46dacf=_0x55eb21==null?void 0x0:_0x55eb21['gameplayFinished'])==null||_0x46dacf[_0x41f662(0x21d)](_0x55eb21);}function We(){const _0x15916c=a0_0x5baf15;g()&&(window[_0x15916c(0x251)]=()=>{S(!0x0),f();},window[_0x15916c(0x264)]=()=>{_(!0x0);});}function Ke(){const _0x2c7b8a=a0_0x5baf15;if(!G())return;let _0xeb897a=window[_0x2c7b8a(0x205)];!_0xeb897a||!_0xeb897a['trigger']||(u['on'](_0x2c7b8a(0x267),()=>{const _0x247531=_0x2c7b8a;var _0x4d9f23,_0x1755c4;return(_0x1755c4=(_0x4d9f23=_0xeb897a[_0x247531(0x26b)])[_0x247531(0x1e8)])==null?void 0x0:_0x1755c4[_0x247531(0x21d)](_0x4d9f23,N);}),u['on'](_0x2c7b8a(0x250),()=>{const _0x32f5a3=_0x2c7b8a;var _0x32f566,_0x2210e8;return(_0x2210e8=(_0x32f566=_0xeb897a[_0x32f5a3(0x26b)])['tryAgain'])==null?void 0x0:_0x2210e8[_0x32f5a3(0x21d)](_0x32f566);}));}var u={'init'(_0x3bb669={},_0x2e68ab){const _0x2e113d=a0_0x5baf15;if(ke=_0x3bb669[_0x2e113d(0x21c)]||'web_embed',Ne=_0x3bb669['consent']||{},A={...Ae,..._0x3bb669[_0x2e113d(0x24a)]||{}},w=_0x3bb669['rootEl']||w,N=_0x3bb669[_0x2e113d(0x202)]||(/android/i[_0x2e113d(0x1d0)](navigator[_0x2e113d(0x24f)])?_0x2e113d(0x1cd):'https://www.apple.com/app-store/'),_0x2e68ab&&(j=_0x2e68ab),o('init'),document[_0x2e113d(0x248)][_0x2e113d(0x204)]=()=>!0x1,_e(),Je(w),he(),ze(),Ve(),!z){if(document[_0x2e113d(0x252)]===_0x2e113d(0x250))ve();else{if(!xe){xe=!0x0;let _0x2bc38d=()=>{const _0x6e7a47=_0x2e113d;ve(),window[_0x6e7a47(0x224)](_0x6e7a47(0x1e4),_0x2bc38d),document['removeEventListener']('DOMContentLoaded',_0x2bc38d);};window['addEventListener'](_0x2e113d(0x1e4),_0x2bc38d),document[_0x2e113d(0x22b)](_0x2e113d(0x256),_0x2bc38d);}}}He(),Ge(),Ue(),We(),Ke(),console['log']('%c\x20@handler/playable-sdk\x20%c\x20v'+(R[_0x2e113d(0x1c9)]||_0x2e113d(0x210))+'\x20','background:\x20#007acc;\x20color:\x20#fff;\x20font-size:\x2014px;\x20padding:\x204px\x208px;\x20border-top-left-radius:\x204px;\x20border-bottom-left-radius:\x204px;',_0x2e113d(0x266)),c&&!l&&(o(_0x2e113d(0x212)),o(_0x2e113d(0x258)),o(_0x2e113d(0x1b6)),k&&(k=!0x1,u['start']()),l=!0x0),l=c;},'getRoot'(){return _e();},get 'version'(){const _0x1ce65b=a0_0x5baf15;return R[_0x1ce65b(0x1c9)]||_0x1ce65b(0x210);},get 'maxWidth'(){return h;},get 'maxHeight'(){return b;},get 'isLandscape'(){return B;},get 'isReady'(){return l;},get 'isStarted'(){return U;},get 'isPaused'(){return T;},get 'isFinished'(){return E;},get 'volume'(){return J;},get 'interactions'(){return K;},'on'(_0x1c8860,_0x6fe695){I(M(_0x1c8860),_0x6fe695);},'off'(_0x409373,_0x48804b){H(M(_0x409373),_0x48804b);},'start'(){const _0x172d44=a0_0x5baf15;var _0x4605b2,_0x3900ec;if(!U){if(!c){k=!0x0;return;}if(U=!0x0,o(_0x172d44(0x1d7)),f(),g())_(),(_0x4605b2=window[_0x172d44(0x249)])==null||_0x4605b2[_0x172d44(0x21d)](window);else{if(y()){let _0x271242=window[_0x172d44(0x1c4)];(_0x3900ec=_0x271242==null?void 0x0:_0x271242[_0x172d44(0x21f)])==null||_0x3900ec['call'](_0x271242,{'orientation':B?_0x172d44(0x259):'portrait','buildID':R[_0x172d44(0x1c9)]||_0x172d44(0x247)});}}}},'finish'(){const _0x4b3f9d=a0_0x5baf15;var _0x10e360,_0x52e5b0;E||(E=!0x0,o('complete'),g()?(_0x10e360=window[_0x4b3f9d(0x1ba)])==null||_0x10e360[_0x4b3f9d(0x21d)](window):F()?(_0x52e5b0=parent==null?void 0x0:parent[_0x4b3f9d(0x242)])==null||_0x52e5b0[_0x4b3f9d(0x21d)](parent,'complete','*'):y()&&Ee());},'install'(_0x3a12bf){const _0x8dda03=a0_0x5baf15;if(!E){E=!0x0,y()?(Ee(),setTimeout(()=>u[_0x8dda03(0x1bd)](_0x3a12bf),0x12c)):(o(_0x8dda03(0x250)),setTimeout(()=>u[_0x8dda03(0x1bd)](_0x3a12bf),0x0));return;}W||(W=!0x0,setTimeout(()=>W=!0x1,0x1f4),o(_0x8dda03(0x267)),o(_0x8dda03(0x265)),Fe(_0x3a12bf||N));},'emit'(_0x3184f6,_0x3b3aaf){const _0x23eb3c=a0_0x5baf15;let _0x2d5f96=M(_0x3184f6);if(![_0x23eb3c(0x258),'boot',_0x23eb3c(0x1d7),_0x23eb3c(0x1db),_0x23eb3c(0x250),_0x23eb3c(0x267),_0x23eb3c(0x265),'retry',_0x23eb3c(0x22a),_0x23eb3c(0x271),_0x23eb3c(0x21e),_0x23eb3c(0x225),_0x23eb3c(0x1f2)][_0x23eb3c(0x1d3)](_0x2d5f96)&&!_0x2d5f96[_0x23eb3c(0x1de)](_0x23eb3c(0x1ce)))throw new Error(_0x23eb3c(0x1dd)+_0x3184f6+_0x23eb3c(0x221));let _0x177147=Oe(_0x2d5f96,_0x3b3aaf);P(_0x2d5f96,_0x177147);},'retry'(){const _0x37850f=a0_0x5baf15;var _0x14d519,_0x5ac4f7,_0x4a674c;if(g())(_0x14d519=window['gameRetry'])==null||_0x14d519[_0x37850f(0x21d)](window);else{if(G()){let _0x4fab3c=window[_0x37850f(0x205)];(_0x4a674c=(_0x5ac4f7=_0x4fab3c==null?void 0x0:_0x4fab3c[_0x37850f(0x26b)])==null?void 0x0:_0x5ac4f7['tryAgain'])==null||_0x4a674c[_0x37850f(0x21d)](_0x5ac4f7);}}o('engagement',{'action':_0x37850f(0x222)});},'pause'(){_(!0x0);},'resume'(){S(!0x0);},'resize'(_0x1d86a7,_0x124b75){f(_0x1d86a7,_0x124b75);}},Be=u;function Je(_0xdcd32f){const _0x33be19=a0_0x5baf15;let _0x461aed=document[_0x33be19(0x243)](_0x33be19(0x230));_0x461aed[_0x33be19(0x25c)]='text/javascript',_0x461aed[_0x33be19(0x1c8)]=_0x33be19(0x1e3),_0xdcd32f[_0x33be19(0x25b)](_0x461aed);}0x0&&(module[a0_0x5baf15(0x233)]={'Handler':Handler});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-UVBNGLP3.mjs";export{a as Handler,b as default};
|
package/dist/pixi/index.d.mts
CHANGED
|
@@ -413,42 +413,130 @@ declare function createTutorialLabel(config: ObjectCentricConfig): Text;
|
|
|
413
413
|
declare function updateHandAnimation(hand: Sprite, baseCharacterPos: Point, time: number, isDragging: boolean, config: ObjectCentricConfig): void;
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
|
-
* Handler SDK -
|
|
416
|
+
* Handler SDK - Lottie Overlay Helper
|
|
417
417
|
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
418
|
+
* Manages Lottie animations as DOM overlays with config-driven positioning and styling.
|
|
419
|
+
* Student never touches DOM - this helper handles all overlay lifecycle.
|
|
420
|
+
*
|
|
421
|
+
* RULES:
|
|
422
|
+
* - Overlay creation/cleanup is SDK-controlled
|
|
423
|
+
* - Transform/render/effects params come from object config
|
|
424
|
+
* - Lottie JSON comes from Assets system (inline-safe)
|
|
425
|
+
* - Root sandbox discipline maintained
|
|
420
426
|
*
|
|
421
427
|
* DO NOT EDIT - Handler SDK Core
|
|
422
428
|
*/
|
|
423
429
|
|
|
430
|
+
type AnimationItem = any;
|
|
431
|
+
declare function setLottieInstance(instance: any): void;
|
|
424
432
|
/**
|
|
425
|
-
*
|
|
426
|
-
* Asset path comes from config.assets
|
|
433
|
+
* Play Lottie overlay animation
|
|
427
434
|
*
|
|
428
|
-
* @param
|
|
429
|
-
* @param
|
|
430
|
-
* @param
|
|
431
|
-
* @param
|
|
435
|
+
* @param objectId - Object instance ID (e.g., 'effects_confetti_1')
|
|
436
|
+
* @param root - Root HTML element (from Handler.getRoot())
|
|
437
|
+
* @param config - Object-centric configuration
|
|
438
|
+
* @param Assets - Assets proxy instance (for getting Lottie JSON)
|
|
439
|
+
* @returns Animation item and cleanup function
|
|
432
440
|
*/
|
|
433
|
-
declare function
|
|
441
|
+
declare function playLottieOverlay(objectId: string, root: HTMLElement, config: ObjectCentricConfig, Assets: any): {
|
|
442
|
+
animation: AnimationItem;
|
|
443
|
+
cleanup: () => void;
|
|
444
|
+
} | null;
|
|
445
|
+
|
|
434
446
|
/**
|
|
435
|
-
*
|
|
436
|
-
* Uses config.assets.character_sprite for path
|
|
437
|
-
* Character sheet dimensions come from config (cols: 3, rows: 2)
|
|
447
|
+
* Handler SDK - Object-Centric Asset Loader
|
|
438
448
|
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
449
|
+
* Asset loading system using object-centric approach.
|
|
450
|
+
* Assets are defined in object configs and loaded by object ID.
|
|
451
|
+
*
|
|
452
|
+
* RULES (LOCKED):
|
|
453
|
+
* - INLINE_ASSETS[objectId] key format (NOT path-based)
|
|
454
|
+
* - Cache key = objectId ONLY
|
|
455
|
+
* - SDK does NOT detect dev/build mode
|
|
456
|
+
* - Build mode injected via __BUILD_MODE__ flag
|
|
457
|
+
* - JSON assets are deep-frozen (immutable)
|
|
458
|
+
* - Dev mode: placeholder on missing
|
|
459
|
+
* - Publish mode: runtime throws (build-time must prevent this)
|
|
460
|
+
*
|
|
461
|
+
* DO NOT EDIT - Handler SDK Core
|
|
462
|
+
*/
|
|
463
|
+
type AssetDefinition = {
|
|
464
|
+
type: string;
|
|
465
|
+
path: string;
|
|
466
|
+
};
|
|
467
|
+
type TypeLoader = (path: string, inlineData: string | undefined, objectId: string, app: any) => Promise<any>;
|
|
468
|
+
declare function registerType(type: string, loader: TypeLoader): void;
|
|
469
|
+
declare class AssetLoader {
|
|
470
|
+
static load(objectId: string, assetDef: AssetDefinition, app: any): Promise<any>;
|
|
471
|
+
private static loadImage;
|
|
472
|
+
private static loadJSON;
|
|
473
|
+
private static handleFailure;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Handler SDK - Asset Cache
|
|
478
|
+
*
|
|
479
|
+
* Centralized cache for all asset data (textures, parsed JSON, inline data).
|
|
480
|
+
* Global, long-lived cache that survives scene resets for performance.
|
|
481
|
+
*
|
|
482
|
+
* RULE: NEVER cleared during normal runtime - only for testing/cleanup
|
|
483
|
+
*
|
|
484
|
+
* DO NOT EDIT - Handler SDK Core
|
|
485
|
+
*/
|
|
486
|
+
/**
|
|
487
|
+
* Global asset cache - stores decoded textures, parsed JSON, inline data
|
|
488
|
+
*
|
|
489
|
+
* Rules:
|
|
490
|
+
* - Global and long-lived
|
|
491
|
+
* - Survives scene resets
|
|
492
|
+
* - NEVER cleared during normal runtime
|
|
493
|
+
* - Only clear() for testing/cleanup scenarios
|
|
494
|
+
*/
|
|
495
|
+
declare class AssetCache {
|
|
496
|
+
private static store;
|
|
497
|
+
/**
|
|
498
|
+
* Get cached asset data by ID
|
|
499
|
+
*/
|
|
500
|
+
static get(id: string): any;
|
|
501
|
+
/**
|
|
502
|
+
* Set cached asset data by ID
|
|
503
|
+
*/
|
|
504
|
+
static set(id: string, data: any): void;
|
|
505
|
+
/**
|
|
506
|
+
* Check if asset is cached
|
|
507
|
+
*/
|
|
508
|
+
static has(id: string): boolean;
|
|
509
|
+
/**
|
|
510
|
+
* Clear cache (only for testing/cleanup - NOT used during normal runtime)
|
|
511
|
+
*/
|
|
512
|
+
static clear(): void;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Handler SDK - Object Factory
|
|
517
|
+
*
|
|
518
|
+
* Creates game objects from object configs with asset loading and transform application.
|
|
519
|
+
*
|
|
520
|
+
* DO NOT EDIT - Handler SDK Core
|
|
442
521
|
*/
|
|
443
|
-
|
|
522
|
+
|
|
444
523
|
/**
|
|
445
|
-
* Create
|
|
446
|
-
* Uses config.theme.brush_color for color
|
|
447
|
-
* Brush size comes from config.gameplay.brush
|
|
524
|
+
* Create a game object from object config
|
|
448
525
|
*
|
|
526
|
+
* @param objectId - Object instance ID (e.g., 'character_1')
|
|
527
|
+
* @param objectConfig - Object config from ObjectCentricConfig
|
|
449
528
|
* @param app - PixiJS application instance
|
|
450
|
-
* @
|
|
529
|
+
* @returns Ready-to-use game object (Sprite, Container, etc.)
|
|
451
530
|
*/
|
|
452
|
-
declare
|
|
531
|
+
declare class ObjectFactory {
|
|
532
|
+
/**
|
|
533
|
+
* Create game object from config
|
|
534
|
+
*/
|
|
535
|
+
static create(objectId: string, objectConfig: any, app: any): Promise<Container | Sprite | any>;
|
|
536
|
+
/**
|
|
537
|
+
* Apply transform from config to object
|
|
538
|
+
*/
|
|
539
|
+
private static applyTransform;
|
|
540
|
+
}
|
|
453
541
|
|
|
454
|
-
export { type EndGamePanelElements, GameObject, GameObjectManager, type ObjectCentricConfig, type PixiBaseContext, type PixiTheme, Renderer, Transform, animateHandClick, animatePanelEntrance,
|
|
542
|
+
export { AssetCache, type AssetDefinition, AssetLoader, type EndGamePanelElements, GameObject, GameObjectManager, type ObjectCentricConfig, ObjectFactory, type PixiBaseContext, type PixiTheme, Renderer, Transform, animateHandClick, animatePanelEntrance, createEndGamePanel, createHandTutorial, createPixiBase, createTutorialLabel, getRegisteredFontIds, playLottieOverlay, registerFont, registerType, resolveFont, resolveFontWeight, setLottieInstance, updateHandAnimation };
|
package/dist/pixi/index.d.ts
CHANGED
|
@@ -413,42 +413,130 @@ declare function createTutorialLabel(config: ObjectCentricConfig): Text;
|
|
|
413
413
|
declare function updateHandAnimation(hand: Sprite, baseCharacterPos: Point, time: number, isDragging: boolean, config: ObjectCentricConfig): void;
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
|
-
* Handler SDK -
|
|
416
|
+
* Handler SDK - Lottie Overlay Helper
|
|
417
417
|
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
418
|
+
* Manages Lottie animations as DOM overlays with config-driven positioning and styling.
|
|
419
|
+
* Student never touches DOM - this helper handles all overlay lifecycle.
|
|
420
|
+
*
|
|
421
|
+
* RULES:
|
|
422
|
+
* - Overlay creation/cleanup is SDK-controlled
|
|
423
|
+
* - Transform/render/effects params come from object config
|
|
424
|
+
* - Lottie JSON comes from Assets system (inline-safe)
|
|
425
|
+
* - Root sandbox discipline maintained
|
|
420
426
|
*
|
|
421
427
|
* DO NOT EDIT - Handler SDK Core
|
|
422
428
|
*/
|
|
423
429
|
|
|
430
|
+
type AnimationItem = any;
|
|
431
|
+
declare function setLottieInstance(instance: any): void;
|
|
424
432
|
/**
|
|
425
|
-
*
|
|
426
|
-
* Asset path comes from config.assets
|
|
433
|
+
* Play Lottie overlay animation
|
|
427
434
|
*
|
|
428
|
-
* @param
|
|
429
|
-
* @param
|
|
430
|
-
* @param
|
|
431
|
-
* @param
|
|
435
|
+
* @param objectId - Object instance ID (e.g., 'effects_confetti_1')
|
|
436
|
+
* @param root - Root HTML element (from Handler.getRoot())
|
|
437
|
+
* @param config - Object-centric configuration
|
|
438
|
+
* @param Assets - Assets proxy instance (for getting Lottie JSON)
|
|
439
|
+
* @returns Animation item and cleanup function
|
|
432
440
|
*/
|
|
433
|
-
declare function
|
|
441
|
+
declare function playLottieOverlay(objectId: string, root: HTMLElement, config: ObjectCentricConfig, Assets: any): {
|
|
442
|
+
animation: AnimationItem;
|
|
443
|
+
cleanup: () => void;
|
|
444
|
+
} | null;
|
|
445
|
+
|
|
434
446
|
/**
|
|
435
|
-
*
|
|
436
|
-
* Uses config.assets.character_sprite for path
|
|
437
|
-
* Character sheet dimensions come from config (cols: 3, rows: 2)
|
|
447
|
+
* Handler SDK - Object-Centric Asset Loader
|
|
438
448
|
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
449
|
+
* Asset loading system using object-centric approach.
|
|
450
|
+
* Assets are defined in object configs and loaded by object ID.
|
|
451
|
+
*
|
|
452
|
+
* RULES (LOCKED):
|
|
453
|
+
* - INLINE_ASSETS[objectId] key format (NOT path-based)
|
|
454
|
+
* - Cache key = objectId ONLY
|
|
455
|
+
* - SDK does NOT detect dev/build mode
|
|
456
|
+
* - Build mode injected via __BUILD_MODE__ flag
|
|
457
|
+
* - JSON assets are deep-frozen (immutable)
|
|
458
|
+
* - Dev mode: placeholder on missing
|
|
459
|
+
* - Publish mode: runtime throws (build-time must prevent this)
|
|
460
|
+
*
|
|
461
|
+
* DO NOT EDIT - Handler SDK Core
|
|
462
|
+
*/
|
|
463
|
+
type AssetDefinition = {
|
|
464
|
+
type: string;
|
|
465
|
+
path: string;
|
|
466
|
+
};
|
|
467
|
+
type TypeLoader = (path: string, inlineData: string | undefined, objectId: string, app: any) => Promise<any>;
|
|
468
|
+
declare function registerType(type: string, loader: TypeLoader): void;
|
|
469
|
+
declare class AssetLoader {
|
|
470
|
+
static load(objectId: string, assetDef: AssetDefinition, app: any): Promise<any>;
|
|
471
|
+
private static loadImage;
|
|
472
|
+
private static loadJSON;
|
|
473
|
+
private static handleFailure;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Handler SDK - Asset Cache
|
|
478
|
+
*
|
|
479
|
+
* Centralized cache for all asset data (textures, parsed JSON, inline data).
|
|
480
|
+
* Global, long-lived cache that survives scene resets for performance.
|
|
481
|
+
*
|
|
482
|
+
* RULE: NEVER cleared during normal runtime - only for testing/cleanup
|
|
483
|
+
*
|
|
484
|
+
* DO NOT EDIT - Handler SDK Core
|
|
485
|
+
*/
|
|
486
|
+
/**
|
|
487
|
+
* Global asset cache - stores decoded textures, parsed JSON, inline data
|
|
488
|
+
*
|
|
489
|
+
* Rules:
|
|
490
|
+
* - Global and long-lived
|
|
491
|
+
* - Survives scene resets
|
|
492
|
+
* - NEVER cleared during normal runtime
|
|
493
|
+
* - Only clear() for testing/cleanup scenarios
|
|
494
|
+
*/
|
|
495
|
+
declare class AssetCache {
|
|
496
|
+
private static store;
|
|
497
|
+
/**
|
|
498
|
+
* Get cached asset data by ID
|
|
499
|
+
*/
|
|
500
|
+
static get(id: string): any;
|
|
501
|
+
/**
|
|
502
|
+
* Set cached asset data by ID
|
|
503
|
+
*/
|
|
504
|
+
static set(id: string, data: any): void;
|
|
505
|
+
/**
|
|
506
|
+
* Check if asset is cached
|
|
507
|
+
*/
|
|
508
|
+
static has(id: string): boolean;
|
|
509
|
+
/**
|
|
510
|
+
* Clear cache (only for testing/cleanup - NOT used during normal runtime)
|
|
511
|
+
*/
|
|
512
|
+
static clear(): void;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Handler SDK - Object Factory
|
|
517
|
+
*
|
|
518
|
+
* Creates game objects from object configs with asset loading and transform application.
|
|
519
|
+
*
|
|
520
|
+
* DO NOT EDIT - Handler SDK Core
|
|
442
521
|
*/
|
|
443
|
-
|
|
522
|
+
|
|
444
523
|
/**
|
|
445
|
-
* Create
|
|
446
|
-
* Uses config.theme.brush_color for color
|
|
447
|
-
* Brush size comes from config.gameplay.brush
|
|
524
|
+
* Create a game object from object config
|
|
448
525
|
*
|
|
526
|
+
* @param objectId - Object instance ID (e.g., 'character_1')
|
|
527
|
+
* @param objectConfig - Object config from ObjectCentricConfig
|
|
449
528
|
* @param app - PixiJS application instance
|
|
450
|
-
* @
|
|
529
|
+
* @returns Ready-to-use game object (Sprite, Container, etc.)
|
|
451
530
|
*/
|
|
452
|
-
declare
|
|
531
|
+
declare class ObjectFactory {
|
|
532
|
+
/**
|
|
533
|
+
* Create game object from config
|
|
534
|
+
*/
|
|
535
|
+
static create(objectId: string, objectConfig: any, app: any): Promise<Container | Sprite | any>;
|
|
536
|
+
/**
|
|
537
|
+
* Apply transform from config to object
|
|
538
|
+
*/
|
|
539
|
+
private static applyTransform;
|
|
540
|
+
}
|
|
453
541
|
|
|
454
|
-
export { type EndGamePanelElements, GameObject, GameObjectManager, type ObjectCentricConfig, type PixiBaseContext, type PixiTheme, Renderer, Transform, animateHandClick, animatePanelEntrance,
|
|
542
|
+
export { AssetCache, type AssetDefinition, AssetLoader, type EndGamePanelElements, GameObject, GameObjectManager, type ObjectCentricConfig, ObjectFactory, type PixiBaseContext, type PixiTheme, Renderer, Transform, animateHandClick, animatePanelEntrance, createEndGamePanel, createHandTutorial, createPixiBase, createTutorialLabel, getRegisteredFontIds, playLottieOverlay, registerFont, registerType, resolveFont, resolveFontWeight, setLottieInstance, updateHandAnimation };
|
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 nt=Object.defineProperty;var ai=Object.getOwnPropertyDescriptor;var ii=Object.getOwnPropertyNames;var si=Object.prototype.hasOwnProperty;var oi=(t,e)=>{for(var n in e)nt(t,n,{get:e[n],enumerable:!0})},ri=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ii(e))!si.call(t,s)&&s!==n&&nt(t,s,{get:()=>e[s],enumerable:!(a=ai(e,s))||a.enumerable});return t};var li=t=>ri(nt({},"__esModule",{value:!0}),t);var Pi={};oi(Pi,{AssetCache:()=>X,AssetLoader:()=>we,GameObject:()=>De,GameObjectManager:()=>Xe,ObjectFactory:()=>Qe,Renderer:()=>Me,Transform:()=>Le,animateHandClick:()=>fa,animatePanelEntrance:()=>pa,createEndGamePanel:()=>ua,createHandTutorial:()=>ha,createPixiBase:()=>la,createTutorialLabel:()=>ma,getRegisteredFontIds:()=>da,playLottieOverlay:()=>_a,registerFont:()=>ca,registerType:()=>je,resolveFont:()=>V,resolveFontWeight:()=>q,setLottieInstance:()=>ga,updateHandAnimation:()=>ya});module.exports=li(Pi);var ra=require("pixi.js");var ne={};function ze(t,e,n=!1){ne[t]||(ne[t]=[]),ne[t].push({fn:e,once:n})}function at(t,e){if(ne[t]){if(!e){delete ne[t];return}ne[t]=ne[t].filter(n=>n.fn!==e)}}function He(t,...e){let n=ne[t];if(n)for(let a of[...n])a.fn(...e),a.once&&at(t,a.fn)}function z(t,e){ze(t,e,!0)}var We={name:"handler-playable-sdk",version:"0.2.7",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var H=0,di=H++,kn=H++,Fn=H++,In=H++,Rn=H++,Nn=H++,Bn=H++,$n=H++,zn=H++,Hn=H++,Wn=H++,Yn=H++,_=di;function Gn(){return _===kn}function Jn(){return _===Fn}function Vn(){return _===In}function qn(){return _===Rn}function ue(){return _===Nn}function pe(){return _===Bn}function Xn(){return _===$n}function Un(){return _===zn}function Kn(){return _===Hn}function it(){return _===Wn}function st(){return _===Yn}function jn(){let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(t==="mraid")try{mraid.getState(),_=kn;return}catch{}else if(t==="dapi")try{dapi.isReady(),_=Fn;return}catch{}if(e==="facebook")try{typeof FbPlayableAd!="undefined"&&(_=In)}catch{}else if(e==="google")try{typeof ExitApi!="undefined"&&(_=Rn)}catch{}else if(e==="mintegral")window.gameReady&&(_=Nn);else if(e==="tapjoy")window.TJ_API&&(_=Bn);else if(e==="tiktok")window.openAppStore&&(_=$n);else if(e==="smadex")try{window.smxTracking&&(_=zn)}catch{}else if(e==="snapchat")try{window.ScPlayableAd&&(_=Hn)}catch{}else e==="vungle"?_=Wn:(t==="nucleo"||e==="nucleo")&&(_=Yn)}var aa={mechanic_id:"TODO_mechanic_id",variant_id:"TODO_variant_id",deployment_id:"TODO_deployment_id",export_id:"TODO_export_id",profile_id:"TODO_profile_id",instance_id:"default"},ui=Math.random().toString(36).slice(2),fe=null,Se={...aa},ia="web_embed",pi={},ot=!1,xe=!1,Ae=!1,sa=!1,dt=1,lt=0,Ve=!1,Q=!1,Je="",he=Math.floor(window.innerWidth),me=Math.floor(window.innerHeight),ct=he>me,Z=!1,Te=!1,Qn=!1,Zn=!1,rt=!1,Ye=null;function ea(){if(fe)return fe;let t=document.createElement("div");return t.id="handler-root",t.setAttribute("data-handler-root","true"),document.body.appendChild(t),fe=t,t}function Ge(t){switch(t){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return t}}function oa(t,e){return{event_name:t,ts:Date.now(),session_id:ui,deployment_id:Se.deployment_id,variant_id:Se.variant_id,export_profile_id:Se.profile_id,instance_id:Se.instance_id||"default",env:ia==="mraid"?"mraid":"web",payload:e}}function y(t,e){let n=Ge(t),a=oa(n,e);He(n,a),n!==t&&He(t,a)}function ve(){Ye&&(Ye(he,me),Ye=null)}function ye(t){dt=t,y("volume",t)}function ge(t){t&&(sa=!0),!Ae&&(Ae=!0,y("pause"),ye(0))}function Ee(t){!t&&sa||Ae&&(Ae=!1,y("resume"),ye(dt))}function ie(t,e){he=Math.floor(t||window.innerWidth),me=Math.floor(e||window.innerHeight),ct=he>me,y("resize",{width:he,height:me})}function fi(){if(Gn())try{let t=mraid.getMaxSize();ie(t.width,t.height);let e=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Ee():ge()};if(mraid.addEventListener("viewableChange",e),mraid.addEventListener("stateChange",e),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();ie(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();ye(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&ye(n>0?1:0)}),mraid.addEventListener("error",(n,a)=>{console.warn("mraid error:",n,"action:",a)}),Ve=!0,mraid.isViewable()&&mraid.getState()!=="hidden")Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve();else{let n=()=>{Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve()};mraid.addEventListener("ready",n)}}catch(t){console.warn("MRAID hook skipped",t)}}function hi(){if(Jn())try{let t=dapi.getScreenSize();ie(t.width,t.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Ee():ge()}),dapi.addEventListener("adResized",n=>{let a=dapi.getScreenSize();ie(n.width||a.width,n.height||a.height)});let e=dapi.getAudioVolume();if(ye(e?1:0),dapi.addEventListener("audioVolumeChange",n=>ye(n?1:0)),Ve=!0,dapi.isViewable())Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve();else{let n=()=>{Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve()};dapi.addEventListener("ready",n)}}catch(t){console.warn("DAPI hook skipped",t)}}function ta(){let t=()=>{Z||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(Z=!0,y("boot"),y("view"),y("ready"),Q=!0,ve(),Te&&(Te=!1,ae.start()))};window.addEventListener("resize",()=>ie()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Ee(),t()):ge()}),document.readyState==="complete"||document.readyState==="interactive"?t():window.addEventListener("load",t),Ve=!0}function mi(){let t=e=>{typeof TouchEvent!="undefined"&&e instanceof TouchEvent&&(Qn=!0),!(Qn&&e instanceof MouseEvent)&&(lt+=1,y("interaction",lt))};document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)}function yi(t){var a,s,i,o,r,c,l,p,f,u,d,m;let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(a=window.ExitApi)==null||a.exit();return}catch{}if(e==="mraid"&&typeof mraid!="undefined")mraid.open(t||"");else if(e==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(pe())(i=(s=window.TJ_API)==null?void 0:s.click)==null||i.call(s);else if(Vn())(r=(o=window.FbPlayableAd)==null?void 0:o.onCTAClick)==null||r.call(o);else if(Kn())(l=(c=window.ScPlayableAd)==null?void 0:c.onCTAClick)==null||l.call(c);else if(Un())try{(f=(p=window.smxTracking)==null?void 0:p.redirect)==null||f.call(p)}catch(h){console.warn("Smadex redirect failed",h)}else if(qn()){let h=window.ExitApi;h&&typeof h.exit=="function"?h.exit(t||Je||""):t&&window.open(t)}else ue()?(u=window.install)==null||u.call(window):Xn()?(d=window.openAppStore)==null||d.call(window):it()?(m=parent==null?void 0:parent.postMessage)==null||m.call(parent,"download","*"):t&&window.open(t)}function gi(){let t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",e=n=>{if(!n)return;let a=new Image;a.src=n};if(t==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;z("view",()=>e(n.mraid_viewable)),z("start",()=>e(n.game_viewable)),z("engagement",()=>e(n.engagement));let a=()=>e(n.complete);z("complete",a),ze("engagement",s=>{var i;((i=s==null?void 0:s.payload)==null?void 0:i.count)>3&&a()}),z("cta_click",()=>e(n.click))}else if(t==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;z("view",()=>e(n.Ad_Load_Start)),z("start",()=>e(n.Ad_Viewable)),z("engagement",()=>e(n.First_Engagement)),z("complete",()=>e(n.Gameplay_Complete)),z("cta_click",()=>e(n.DSP_Click)),z("start",()=>{[5,10,15,20,25,30].forEach(a=>setTimeout(()=>e(n[`Spent_${a}_Seconds`]),a*1e3))})}}function _i(){if(!pe())return;let t=window.TJ_API;t&&t.setPlayableAPI&&t.setPlayableAPI({skipAd:()=>{try{ae.finish()}catch(e){console.warn("Tapjoy skip failed",e)}}})}function na(){var e,n,a;let t=window.TJ_API;(e=t==null?void 0:t.objectiveComplete)==null||e.call(t),(n=t==null?void 0:t.playableFinished)==null||n.call(t),(a=t==null?void 0:t.gameplayFinished)==null||a.call(t)}function wi(){ue()&&(window.mintGameStart=()=>{Ee(!0),ie()},window.mintGameClose=()=>{ge(!0)})}function bi(){if(!st())return;let t=window.NUC;!t||!t.trigger||(ae.on("cta_click",()=>{var e,n;return(n=(e=t.trigger).convert)==null?void 0:n.call(e,Je)}),ae.on("complete",()=>{var e,n;return(n=(e=t.trigger).tryAgain)==null?void 0:n.call(e)}))}var ae={init(t={},e){if(ia=t.profile||"web_embed",pi=t.consent||{},Se={...aa,...t.ids||{}},fe=t.rootEl||fe,Je=t.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),e&&(Ye=e),y("init"),document.body.oncontextmenu=()=>!1,ea(),xi(fe),jn(),fi(),hi(),!Ve){if(document.readyState==="complete")ta();else if(!Zn){Zn=!0;let n=()=>{ta(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}mi(),gi(),_i(),wi(),bi(),console.log(`%c @handler/playable-sdk %c v${We.version||"0.0.0"} `,"background: #007acc; color: #fff; font-size: 14px; padding: 4px 8px; border-top-left-radius: 4px; border-bottom-left-radius: 4px;","background: #e1e4e8; color: #333; font-size: 14px; padding: 4px 8px; border-top-right-radius: 4px; border-bottom-right-radius: 4px;"),Z&&!Q&&(y("boot"),y("view"),y("ready"),Te&&(Te=!1,ae.start()),Q=!0),Q=Z},getRoot(){return ea()},get version(){return We.version||"0.0.0"},get maxWidth(){return he},get maxHeight(){return me},get isLandscape(){return ct},get isReady(){return Q},get isStarted(){return ot},get isPaused(){return Ae},get isFinished(){return xe},get volume(){return dt},get interactions(){return lt},on(t,e){ze(Ge(t),e)},off(t,e){at(Ge(t),e)},start(){var t,e;if(!ot){if(!Z){Te=!0;return}if(ot=!0,y("start"),ie(),ue())ge(),(t=window.gameReady)==null||t.call(window);else if(pe()){let n=window.TJ_API;(e=n==null?void 0:n.setPlayableBuild)==null||e.call(n,{orientation:ct?"landscape":"portrait",buildID:We.version||"dev"})}}},finish(){var t,e;xe||(xe=!0,y("complete"),ue()?(t=window.gameEnd)==null||t.call(window):it()?(e=parent==null?void 0:parent.postMessage)==null||e.call(parent,"complete","*"):pe()&&na())},install(t){if(!xe){xe=!0,pe()?(na(),setTimeout(()=>ae.install(t),300)):(y("complete"),setTimeout(()=>ae.install(t),0));return}rt||(rt=!0,setTimeout(()=>rt=!1,500),y("cta_click"),y("conversion"),yi(t||Je))},emit(t,e){let n=Ge(t);if(!["view","boot","start","engagement","complete","cta_click","conversion","retry","pause","resume","resize","volume","error"].includes(n)&&!n.startsWith("custom."))throw new Error(`Event ${t} must be canonical or namespaced as custom.<mechanic_id>.<event>`);let a=oa(n,e);He(n,a)},retry(){var t,e,n;if(ue())(t=window.gameRetry)==null||t.call(window);else if(st()){let a=window.NUC;(n=(e=a==null?void 0:a.trigger)==null?void 0:e.tryAgain)==null||n.call(e)}y("engagement",{action:"retry"})},pause(){ge(!0)},resume(){Ee(!0)},resize(t,e){ie(t,e)}},qe=ae;function xi(t){let e=document.createElement("script");e.type="text/javascript",e.textContent=`
|
|
2
2
|
(function(){
|
|
3
3
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
4
4
|
function unlock(){
|
|
@@ -14,4 +14,14 @@
|
|
|
14
14
|
}
|
|
15
15
|
events.forEach(function(e){ document.addEventListener(e, unlock, false); });
|
|
16
16
|
})();
|
|
17
|
-
`,e.appendChild(t)}async function 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 la(t,e={}){let n=new ra.Application;await n.init({resizeTo:t,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let a=i=>{var c,l,p,f,u,d;let o=(p=(l=(c=i==null?void 0:i.width)!=null?c:t.clientWidth)!=null?l:window.innerWidth)!=null?p:320,r=(d=(u=(f=i==null?void 0:i.height)!=null?f:t.clientHeight)!=null?u:window.innerHeight)!=null?d:480;n.renderer.resize(o,r)};t.innerHTML="",t.style.position="relative",t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="stretch",t.style.width="100%",t.style.height="100dvh",t.style.minHeight="100vh",t.style.maxWidth="100%",t.style.maxHeight="100%",t.style.boxSizing="border-box",t.style.overflow="hidden",e.background&&(t.style.background=e.background),t.appendChild(n.canvas);let s=document.createElement("div");return s.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),t.appendChild(s),qe.on("pause",()=>{n.ticker.stop(),document.querySelectorAll("audio").forEach(o=>o.pause())}),qe.on("resume",()=>{n.ticker.start(),document.querySelectorAll("audio").forEach(o=>{o.currentTime>0&&!o.ended&&o.play().catch(()=>{})})}),qe.on("resize",({payload:i})=>{a({width:i==null?void 0:i.width,height:i==null?void 0:i.height})}),window.addEventListener("resize",()=>a()),requestAnimationFrame(()=>a()),{app:n,stage:n.stage,overlay:s,applySize:a}}var Le=class{constructor(e){var n,a;this.position=(e==null?void 0:e.position)||{x:0,y:0},this.scale=(n=e==null?void 0:e.scale)!=null?n:1,this.rotation=(a=e==null?void 0:e.rotation)!=null?a:0}update(e){e.position!==void 0&&(this.position={...e.position}),e.scale!==void 0&&(this.scale=e.scale),e.rotation!==void 0&&(this.rotation=e.rotation)}syncToPixi(e){e.position.set(this.position.x,this.position.y),e.scale.set(this.scale),e.rotation=this.rotation}},Me=class{constructor(e){var n,a,s,i;this.z_index=(n=e==null?void 0:e.z_index)!=null?n:0,this.alpha=(a=e==null?void 0:e.alpha)!=null?a:1,this.visible=(s=e==null?void 0:e.visible)!=null?s:!0,this.tint=(i=e==null?void 0:e.tint)!=null?i:null}update(e){e.z_index!==void 0&&(this.z_index=e.z_index),e.alpha!==void 0&&(this.alpha=e.alpha),e.visible!==void 0&&(this.visible=e.visible),e.tint!==void 0&&(this.tint=e.tint)}syncToPixi(e){e.zIndex=this.z_index,e.alpha=this.alpha,e.visible=this.visible,this.tint!==null&&"tint"in e&&(e.tint=this.tint)}},De=class{constructor(e,n,a,s){this.instanceId=e,this.objectConfig=n,this.pixiObject=a,this._config=s,this.transform=new Le(s.transform),this.renderer=new Me(s.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject)}updateConfig(e){this._config=e,e.transform&&this.transform.update(e.transform),e.render&&this.renderer.update(e.render),this.sync()}getComponent(e){return this._config[e]}getPosition(){return{...this.transform.position}}setPosition(e,n){this.transform.position={x:e,y:n},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(e){this.renderer.alpha=e,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(e){this.renderer.visible=e,this.renderer.syncToPixi(this.pixiObject)}},Xe=class{constructor(e){this.objects=new Map;this.config=e}create(e,n){let a=this.config.objects.get(e);if(!a)throw new Error(`Object config not found: ${e}`);let s=new De(e,a.object_config||e,n,a);return this.objects.set(e,s),s}get(e){return this.objects.get(e)}updateConfig(e){this.config=e;for(let[n,a]of this.objects.entries()){let s=e.objects.get(n);s&&a.updateConfig(s)}}getAll(){return Array.from(this.objects.values())}remove(e){this.objects.delete(e)}clear(){this.objects.clear()}};var Ue={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function V(t){let e=Ue[t];return e?e.family:(console.warn(`Font ID "${t}" not found in registry, using fallback`),"Arial, sans-serif")}function q(t){var n;let e=Ue[t];return e&&(n=e.weight)!=null?n:"400"}function ca(t,e){Ue[t]=e}function da(){return Object.keys(Ue)}var x=require("pixi.js");function ua(t,e,n){var At,vt,Et,Lt,Mt,Dt,Ot,Ct,Pt,kt,Ft,It,Rt,Nt,Bt,$t,zt,Ht,Wt,Yt,Gt,Jt,Vt,qt,Xt,Ut,Kt,jt,Qt,Zt,en,tn,nn,an,sn,on,rn,ln,cn,dn,un,pn,fn,hn,mn,yn,gn,_n,wn,bn,xn,Sn,Tn,An,vn,En,Ln,Mn,Dn,On;let a=t.objects.get("ui_endgame_1"),s=t.objects.get("ui_endgame_logo_1"),i=t.objects.get("ui_endgame_title_1"),o=t.objects.get("ui_endgame_subtitle_1"),r=t.objects.get("ui_endgame_footer_1"),c=t.objects.get("ui_endgame_cta_1"),l=t.objects.get("ui_endgame_cta_hint_1"),p=t.objects.get("ui_endgame_hand_1"),f=t.engine.runtime||{},u=new x.Container;u.alpha=0,u.visible=!1;let d=((At=a==null?void 0:a.gameplay)==null?void 0:At.tuning)||{},m=(a==null?void 0:a.render)||{},h=(vt=d.panel_width)!=null?vt:320,g=(Et=d.panel_height)!=null?Et:400,b=(Lt=d.panel_padding)!=null?Lt:32,w=(Mt=d.panel_radius)!=null?Mt:24,S=m.background_color||d.panel_bg_color||"#1a0a0a",T=m.background_alpha!==void 0&&m.background_alpha!==null?m.background_alpha:(Dt=d.panel_bg_alpha)!=null?Dt:.98,E=m.border_color||d.panel_border_color||"#ffffff",L=(Ot=d.panel_border_width)!=null?Ot:2,A=(Ct=d.panel_border_alpha)!=null?Ct:.3,v=new x.Graphics;v.roundRect(-h/2,-g/2,h,g,w);let M=S.replace("#","");v.fill({color:parseInt(M,16),alpha:T});let k=E.replace("#","");v.stroke({color:parseInt(k,16),width:L,alpha:A});let D=new x.Graphics;D.roundRect(-h/2+2,-g/2+2,h-4,g-4,w-2),D.stroke({color:16777215,width:1,alpha:.1}),v.addChild(D),u.addChild(v);let F=((Pt=s==null?void 0:s.gameplay)==null?void 0:Pt.tuning)||{},W=(s==null?void 0:s.transform)||{},O=(kt=F.logo_size)!=null?kt:56,I=(Ft=W.scale)!=null?Ft:1,Y=(Rt=(It=W.offset)==null?void 0:It.y)!=null?Rt:-130,Pe=(Nt=F.logo_alpha)!=null?Nt:1,C=new x.Sprite(n||x.Texture.EMPTY);C.anchor.set(.5);let oe=0,re=0;if(n&&n!==x.Texture.EMPTY){let P=n.frame,j=n.baseTexture;P&&P.width&&P.height?(oe=P.width,re=P.height):j&&j.width&&j.height?(oe=j.width,re=j.height):n.width&&n.height&&(oe=n.width,re=n.height)}if(oe>0&&re>0){let P=oe/re,j,tt;P>1?(j=O,tt=O/P):(tt=O,j=O*P);let Cn=j/oe,Pn=tt/re;Cn*=I,Pn*=I,C.scale.set(Cn,Pn)}else{let P=O/100*I;C.scale.set(P)}C.position.set(0,Y),C.alpha=0,C.visible=!0,C.targetAlpha=Pe,C.baseScaleX=C.scale.x,C.baseScaleY=C.scale.y,u.addChild(C);let R=i==null?void 0:i.ui,G=((Bt=i==null?void 0:i.gameplay)==null?void 0:Bt.tuning)||{},ba=(R==null?void 0:R.text)||"MISSION ACCOMPLISHED",ft=(R==null?void 0:R.font)||"brand.heading",xa=(R==null?void 0:R.fontSize)||24,Sa=($t=R==null?void 0:R.letterSpacing)!=null?$t:1,ke=(zt=i==null?void 0:i.render)==null?void 0:zt.tint,Ta=typeof ke=="string"?ke:ke?`#${ke.toString(16).padStart(6,"0")}`:"#00FF88",ht=h-b*2-30,Aa=G.font_weight_override?G.font_weight_override:q(ft),te=new x.Text({text:ba,style:{fontFamily:V(ft),fontSize:xa,fontWeight:Aa,fill:Ta,align:"center",letterSpacing:Sa,wordWrap:!1,stroke:{color:G.stroke_color||"#000000",width:(Ht=G.stroke_width)!=null?Ht:2},dropShadow:{color:G.shadow_color||"#000000",alpha:(Wt=G.shadow_alpha)!=null?Wt:.9,angle:(Yt=G.shadow_angle)!=null?Yt:0,blur:(Gt=G.shadow_blur)!=null?Gt:8,distance:(Jt=G.shadow_distance)!=null?Jt:4}}});if(te.width>ht){let P=ht/te.width;te.scale.set(P)}te.anchor.set(.5);let mt=(Vt=d.title_offset_y)!=null?Vt:30,va=mt+((qt=G.animation_start_y_offset)!=null?qt:-20);te.position.set(0,va),te.alpha=0,u.addChild(te);let N=o==null?void 0:o.ui,yt=((Xt=o==null?void 0:o.gameplay)==null?void 0:Xt.tuning)||{},Ea=(N==null?void 0:N.text)||"RESCUE COMPLETE",gt=(N==null?void 0:N.font)||"brand.body",La=(N==null?void 0:N.fontSize)||11,Ma=(Ut=N==null?void 0:N.letterSpacing)!=null?Ut:.5,Fe=(Kt=o==null?void 0:o.render)==null?void 0:Kt.tint,Da=typeof Fe=="string"?Fe:Fe?`#${Fe.toString(16).padStart(6,"0")}`:"#B0B0B0",le=new x.Text({text:Ea,style:{fontFamily:V(gt),fontSize:La,fontWeight:q(gt),fill:Da,align:"center",letterSpacing:Ma}});le.anchor.set(.5);let Oa=mt+20+((jt=yt.animation_start_y_offset)!=null?jt:-10);le.position.set(0,Oa),le.alpha=0,le.animationStartYOffset=(Qt=yt.animation_start_y_offset)!=null?Qt:-10,u.addChild(le);let U=r==null?void 0:r.ui,_t=((Zt=r==null?void 0:r.gameplay)==null?void 0:Zt.tuning)||{},Ca=(U==null?void 0:U.text)||((en=f.ui)==null?void 0:en.cta_hint)||"Continue the adventure!",wt=(U==null?void 0:U.font)||"brand.body",Pa=(U==null?void 0:U.fontSize)||16,Ie=(tn=r==null?void 0:r.render)==null?void 0:tn.tint,ka=typeof Ie=="string"?Ie:Ie?`#${Ie.toString(16).padStart(6,"0")}`:"#FFFFFF",Fa=(nn=_t.max_width)!=null?nn:h-b*2,Ia=(an=_t.line_height)!=null?an:1.4,ce=new x.Text({text:Ca,style:{fontFamily:V(wt),fontSize:Pa,fontWeight:q(wt),fill:ka,align:"center",wordWrap:!0,wordWrapWidth:Fa,lineHeight:Ia}});ce.anchor.set(.5);let Ra=(sn=d.footer_offset_y)!=null?sn:120;ce.position.set(0,Ra);let Na=((on=r==null?void 0:r.render)==null?void 0:on.alpha)!==void 0&&((rn=r==null?void 0:r.render)==null?void 0:rn.alpha)!==null?r.render.alpha:1;ce.alpha=0,ce.targetAlpha=Na,u.addChild(ce);let K=((ln=c==null?void 0:c.gameplay)==null?void 0:ln.tuning)||{},B=c==null?void 0:c.ui,Re=(cn=K.button_width)!=null?cn:260,Ne=(dn=K.button_height)!=null?dn:56,bt=(un=K.button_radius)!=null?un:16,Ba=K.button_bg_color||((pn=f.theme)==null?void 0:pn.cta_background)||"#ffb43b",$a=(fn=K.button_bg_alpha)!=null?fn:1,za=K.button_border_color||"#ffffff",Ha=(hn=K.button_border_width)!=null?hn:2,Wa=(mn=K.button_border_alpha)!=null?mn:.2,Be=(yn=d.cta_offset_y)!=null?yn:160,J=new x.Graphics;J.roundRect(-Re/2,-Ne/2,Re,Ne,bt);let Ya=Ba.replace("#","");J.fill({color:parseInt(Ya,16),alpha:$a});let Ga=za.replace("#","");J.stroke({color:parseInt(Ga,16),width:Ha,alpha:Wa});let Ze=new x.Graphics;Ze.roundRect(-Re/2+2,-Ne/2+2,Re-4,Ne-4,bt-2),Ze.stroke({color:0,width:1,alpha:.15}),J.addChild(Ze),J.position.set(0,Be),J.alpha=0,J.eventMode="static",J.cursor="pointer",u.addChild(J);let Ja=(B==null?void 0:B.text)||((gn=f.ui)==null?void 0:gn.cta_label_end)||"DOWNLOAD",xt=(B==null?void 0:B.font)||"brand.heading",Va=(B==null?void 0:B.fontSize)||20,qa=K.button_text_color||((_n=f.theme)==null?void 0:_n.cta_text)||"#1a0a0a",be=new x.Text({text:Ja,style:{fontFamily:V(xt),fontSize:Va,fontWeight:q(xt),fill:qa,align:"center",letterSpacing:(wn=B==null?void 0:B.letterSpacing)!=null?wn:1}});be.anchor.set(.5),be.position.set(0,Be),be.alpha=0,u.addChild(be);let $=l==null?void 0:l.ui,St=((bn=l==null?void 0:l.gameplay)==null?void 0:bn.tuning)||{},Xa=($==null?void 0:$.text)||"Play the full game",Tt=($==null?void 0:$.font)||"brand.body",Ua=($==null?void 0:$.fontSize)||11,Ka=(xn=$==null?void 0:$.letterSpacing)!=null?xn:0,$e=(Sn=l==null?void 0:l.render)==null?void 0:Sn.tint,ja=typeof $e=="string"?$e:$e?`#${$e.toString(16).padStart(6,"0")}`:"#CCCCCC",de=new x.Text({text:Xa,style:{fontFamily:V(Tt),fontSize:Ua,fontWeight:q(Tt),fill:ja,align:"center",letterSpacing:Ka}});de.anchor.set(.5);let Qa=Be+35+((Tn=St.animation_start_y_offset)!=null?Tn:5);de.position.set(0,Qa),de.alpha=0,de.animationStartYOffset=(An=St.animation_start_y_offset)!=null?An:5,u.addChild(de);let et=((vn=p==null?void 0:p.gameplay)==null?void 0:vn.tuning)||{},Za=(En=et.hand_offset_x)!=null?En:50,ei=(Ln=et.hand_offset_y)!=null?Ln:50,ti=(Dn=(Mn=p==null?void 0:p.transform)==null?void 0:Mn.scale)!=null?Dn:.1875,ni=(On=et.hand_scale_multiplier)!=null?On:2.5,se=new x.Sprite(e||x.Texture.EMPTY);return se.anchor.set(.5),se.scale.set(ti*ni),se.position.set(Za,Be+ei),se.alpha=0,se.visible=!1,u.addChild(se),{panel:u,logo:C,title:te,subtitle:le,footer:ce,ctaButton:J,ctaText:be,ctaHint:de,hand:se}}function pa(t,e,n){var L,A,v,M,k,D,F,W;let a=e.objects.get("ui_endgame_1"),s=((L=a==null?void 0:a.gameplay)==null?void 0:L.tuning)||{},i=(A=s.animation_duration_ms)!=null?A:800,o=(v=s.fade_in_duration_ms)!=null?v:600,r=(M=s.scale_animation_intensity)!=null?M:.1,c=(k=s.logo_animation_delay_ms)!=null?k:100,l=(D=s.title_animation_delay_ms)!=null?D:200,p=(F=s.footer_animation_delay_ms)!=null?F:300,f=(W=s.cta_animation_delay_ms)!=null?W:400,{panel:u,logo:d,title:m,subtitle:h,footer:g,ctaButton:b,ctaText:w,ctaHint:S}=t;u.visible=!0;let T=Date.now(),E=()=>{let O=Date.now()-T,I=Math.min(O/o,1),Y=1-Math.pow(1-I,3);u.alpha=Y,u.scale.set(1+r*(1-Y)),I<1?requestAnimationFrame(E):(setTimeout(()=>Si(d,i,e),c),setTimeout(()=>{Ti(m,i),setTimeout(()=>Ai(h,i),50)},l),setTimeout(()=>vi(g,i),p),setTimeout(()=>{Ei(b,w,i),setTimeout(()=>Li(S,i),50),n&&n()},f))};E()}function Si(t,e,n){var u,d,m,h,g;let a=n==null?void 0:n.objects.get("ui_endgame_logo_1"),i=(d=(((u=a==null?void 0:a.gameplay)==null?void 0:u.tuning)||{}).animation_start_scale)!=null?d:1.2,o=Date.now(),r=t.alpha,c=(m=t.targetAlpha)!=null?m:1,l=(h=t.baseScaleX)!=null?h:t.scale.x,p=(g=t.baseScaleY)!=null?g:t.scale.y,f=()=>{let b=Date.now()-o,w=Math.min(b/e,1),S=1-Math.pow(1-w,2);t.alpha=r+(c-r)*S;let T=i+(1-i)*S;t.scale.set(l*T,p*T),w<1&&requestAnimationFrame(f)};f()}function Ti(t,e){let n=Date.now(),a=t.alpha,s=t.y,i=()=>{let o=Date.now()-n,r=Math.min(o/e,1),c=1-Math.pow(1-r,2);t.alpha=a+(1-a)*c,t.y=s-20*(1-c),r<1&&requestAnimationFrame(i)};i()}function Ai(t,e){var r;let n=Date.now(),a=t.alpha,s=t.position.y,i=s-((r=t.animationStartYOffset)!=null?r:-10),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),p=1-Math.pow(1-l,2);t.alpha=a+(1-a)*p,t.position.y=s+(i-s)*p,l<1&&requestAnimationFrame(o)};o()}function vi(t,e){var o;let n=Date.now(),a=t.alpha,s=(o=t.targetAlpha)!=null?o:1,i=()=>{let r=Date.now()-n,c=Math.min(r/e,1),l=1-Math.pow(1-c,2);t.alpha=a+(s-a)*l,c<1&&requestAnimationFrame(i)};i()}function Ei(t,e,n){let a=Date.now(),s=t.alpha,i=()=>{let o=Date.now()-a,r=Math.min(o/n,1),c=1-Math.pow(1-r,2);t.alpha=s+(1-s)*c,e.alpha=s+(1-s)*c,t.scale.set(1+.1*(1-c)),r<1&&requestAnimationFrame(i)};i()}function Li(t,e){var r;let n=Date.now(),a=t.alpha,s=t.position.y,i=s-((r=t.animationStartYOffset)!=null?r:5),o=()=>{let c=Date.now()-n,l=Math.min(c/e,1),p=1-Math.pow(1-l,2);t.alpha=a+(1-a)*p,t.position.y=s+(i-s)*p,l<1&&requestAnimationFrame(o)};o()}function fa(t,e,n,a){var p,f,u,d;let s=n.objects.get("ui_endgame_hand_1"),i=((p=s==null?void 0:s.gameplay)==null?void 0:p.tuning)||{},o=(f=i.click_animation_duration_ms)!=null?f:600,r=(u=i.click_delay_ms)!=null?u:2e3,c=(d=i.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var L,A;t.visible=!0,t.alpha=1;let m=t.x,h=t.y,g=(L=i.hand_offset_x)!=null?L:50,b=(A=i.hand_offset_y)!=null?A:50,w=e.x+g,S=e.y+b,T=Date.now(),E=()=>{var O,I,Y;let v=Date.now()-T,M=Math.min(v/o,1),k=M<.5?2*M*M:1-Math.pow(-2*M+2,2)/2;t.x=m+(w-m)*k,t.y=h+(S-h)*k;let D=(I=(O=s==null?void 0:s.transform)==null?void 0:O.scale)!=null?I:.1875,F=(Y=i.hand_scale_multiplier)!=null?Y:2.5,W=D*F;t.scale.set(W+W*.2*Math.sin(M*Math.PI)),M<1?requestAnimationFrame(E):(e.scale.set(.95),setTimeout(()=>{e.scale.set(1),a()},100),setTimeout(()=>{t.alpha=0,setTimeout(()=>{t.x=m,t.y=h,l()},c)},500))};E()};setTimeout(l,r)}var Ke=require("pixi.js");function ha(t,e,n){var p,f,u,d;let a=e.objects.get("hand_tutorial_1"),s=((p=a==null?void 0:a.gameplay)==null?void 0:p.tuning)||{},i=(a==null?void 0:a.render)||{},o=(a==null?void 0:a.transform)||{},r=new Ke.Sprite(t);r.anchor.set(.5),r.alpha=0;let c=(f=s.hand_scale_multiplier)!=null?f:2.5,l=(u=o.scale)!=null?u:.1875;return r.scale.set(l*c),r.zIndex=(d=i.z_index)!=null?d:99999,r}function ma(t){var m,h,g,b,w,S,T,E,L,A;let e=t.objects.get("ui_tutorial_1"),n=e==null?void 0:e.ui,a=(e==null?void 0:e.render)||{},s=((m=t.engine.runtime)==null?void 0:m.ui_styles)||{},i=((h=t.engine.runtime)==null?void 0:h.ui)||{},o=(n==null?void 0:n.text)||i.tutorial_label||i.label_text||"CLEAN!",r=(n==null?void 0:n.font)||"brand.warning",c=(n==null?void 0:n.fontSize)||s.label_font_size||52,l=(b=n==null?void 0:n.letterSpacing)!=null?b:(g=s.label_letter_spacing)!=null?g:-1,p=(n==null?void 0:n.align)||"center",f=a.tint,u=typeof f=="string"?f:f?`#${f.toString(16).padStart(6,"0")}`:s.label_fill||"#FFF1C1",d=new Ke.Text({text:o,style:{fontFamily:V(r),fontSize:c,fontWeight:q(r),fill:u,align:p,letterSpacing:l,stroke:{color:s.label_stroke||"#8B0000",width:2},dropShadow:{color:s.label_shadow_color||"#000000",alpha:(w=s.label_shadow_alpha)!=null?w:.8,angle:(S=s.label_shadow_angle)!=null?S:0,blur:(T=s.label_shadow_blur)!=null?T:4,distance:(E=s.label_shadow_distance)!=null?E:2}}});return d.anchor.set(.5,0),d.alpha=(L=a.alpha)!=null?L:0,d.visible=(A=a.visible)!=null?A:!0,d}function ya(t,e,n,a,s){var c,l,p,f,u,d,m;let i=s.objects.get("hand_tutorial_1"),o=((c=i==null?void 0:i.gameplay)==null?void 0:c.tuning)||{},r=(i==null?void 0:i.transform)||{};if(!a){let h=(l=o.animation_duration)!=null?l:1.5,g=n%h/h,b=g<.5?2*g*g:-1+(4-2*g)*g,w=(p=o.x_offset)!=null?p:0,S=(f=o.y_offset)!=null?f:0,T=(u=o.animation_range)!=null?u:40,E=T*.7,L=T,A=e.x+w+E,v=e.y+S+L,M=A+E,k=v+L;t.x=A+(M-A)*b,t.y=v+(k-v)*b;let D=(d=r.scale)!=null?d:.1875,F=(m=o.hand_scale_multiplier)!=null?m:2.5;t.scale.set(D*F)}}var Oe=null;function Mi(){return Oe||(typeof window!="undefined"&&window.lottie?Oe=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),Oe=null)),Oe}function ga(t){Oe=t}function _a(t,e,n,a){var E,L,A,v,M,k,D,F,W,O,I,Y,Pe;let s=n.objects.get(t);if(!s)return console.warn(`[LottieOverlay] Object config not found: ${t}`),null;let i=((E=s.effects)==null?void 0:E.lottie)||{},o=s.transform||{},r=s.render||{};if(i.enabled===!1||r.visible===!1)return null;let c=a[t];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${t}`),null;let l=Mi();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${t}`),null;let p=(L=i.width)!=null?L:300,f=(A=i.height)!=null?A:300,u=(v=o.scale)!=null?v:1,d=(k=(M=o.position)==null?void 0:M.x)!=null?k:0,m=(F=(D=o.position)==null?void 0:D.y)!=null?F:0,h=(W=o.rotation)!=null?W:0,g=(O=r.z_index)!=null?O:100,b=(I=r.alpha)!=null?I:1,w=document.createElement("div");w.style.cssText=`
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: calc(50% + ${m}px);
|
|
20
|
+
left: calc(50% + ${d}px);
|
|
21
|
+
transform: translate(-50%, -50%) scale(${u}) rotate(${h}deg);
|
|
22
|
+
width: ${p}px;
|
|
23
|
+
height: ${f}px;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
z-index: ${g};
|
|
26
|
+
opacity: ${b};
|
|
27
|
+
`,e.appendChild(w);let S=l.loadAnimation({container:w,renderer:i.renderer||"svg",loop:(Y=i.loop)!=null?Y:!1,autoplay:(Pe=i.autoplay)!=null?Pe:!0,animationData:c});i.speed!==void 0&&S.setSpeed(i.speed);let T=()=>{S.destroy(),w.parentNode&&w.parentNode.removeChild(w)};return i.loop||S.addEventListener("complete",T),{animation:S,cleanup:T}}var ee=require("pixi.js");var X=class{static get(e){var n;return(n=this.store.get(e))==null?void 0:n.data}static set(e,n){this.store.set(e,{data:n})}static has(e){return this.store.has(e)}static clear(){this.store.clear()}};X.store=new Map;var Di=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] MODULE LOADED - __BUILD_MODE__: ${Di}`);var _e={},ut=null;async function Oi(){if(console.log(`[AssetLoader] getInlineAssets() called - __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`),Object.keys(_e).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(_e)),_e;if(!ut){let e=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",e),ut=(async()=>{try{try{let i=await import(e+"?t="+Date.now());if(i.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(i.INLINE_ASSETS)),i.INLINE_ASSETS}catch(i){console.warn("[AssetLoader] ES module import failed, trying text parse:",i)}let n=await fetch(e);if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);let a=await n.text();console.log("[AssetLoader] Received JS code, length:",a.length);let s=a.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(s)try{let i=s[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let o=new Function("return "+i)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(o)),o}catch(i){return console.warn("[AssetLoader] Failed to parse inline assets:",i),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",a.substring(0,500)),{}}catch(n){return console.warn("[AssetLoader] Failed to load inline assets:",n),{}}})()}return _e=await ut,console.log("[AssetLoader] Final inline assets cache:",Object.keys(_e)),_e}var wa=new Map;function pt(t){return t===null||typeof t!="object"||(Object.freeze(t),Object.values(t).forEach(e=>pt(e))),t}function Ci(t=64,e=64,n=16711680){let a=document.createElement("canvas");a.width=t,a.height=e;let s=a.getContext("2d");return s.fillStyle=`#${n.toString(16).padStart(6,"0")}`,s.fillRect(0,0,t,e),s.strokeStyle="#000",s.strokeRect(0,0,t,e),s.fillStyle="#fff",s.font="10px sans-serif",s.textAlign="center",s.fillText("MISSING",t/2,e/2),ee.Texture.from(a)}function je(t,e){wa.set(t,e)}var we=class{static async load(e,n,a){let s=X.get(e);if(s!==void 0)return s;let i=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] Loading asset: ${e}, type: ${n.type}, __BUILD_MODE__: ${i}`);let r=(await Oi())[e];if(console.log("[AssetLoader] Inline data for",e,":",r?"FOUND":"NOT FOUND"),i==="publish"&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!r))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${e}, path: ${n.path}`);let c=wa.get(n.type);if(c)try{let l=await c(n.path,r,e,a);return X.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}try{let l;switch(n.type){case"image":l=await this.loadImage(n.path,r);break;case"json":l=await this.loadJSON(n.path,r),l=pt(l);break;default:throw new Error(`Unknown asset type: ${n.type}`)}return X.set(e,l),l}catch(l){return this.handleFailure(e,n.type,l)}}static async loadImage(e,n){let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=a==="publish";if(console.log(`[AssetLoader] loadImage - __BUILD_MODE__: ${a}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${e}`);if(!n.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${n.substring(0,50)}...`);try{return await ee.Assets.load(n)}catch(i){throw console.error("[AssetLoader] Failed to load texture from data URI:",i),i}}if(n&&n.startsWith("data:"))try{return await ee.Assets.load(n)}catch(i){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",i),await ee.Assets.load(e)}return await ee.Assets.load(e)}static async loadJSON(e,n){let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=a==="publish";if(console.log(`[AssetLoader] loadJSON - __BUILD_MODE__: ${a}, isPublishMode: ${s}, inlineData: ${n?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!n)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${e}`);if(n.startsWith("data:")){let o=atob(n.split(",")[1]);return JSON.parse(o)}return JSON.parse(n)}if(n){if(n.startsWith("data:")){let o=atob(n.split(",")[1]);return JSON.parse(o)}return JSON.parse(n)}let i=await fetch(e);if(!i.ok)throw new Error(`JSON fetch failed: ${e}`);return i.json()}static handleFailure(e,n,a){if(typeof __BUILD_MODE__!="undefined"&&__BUILD_MODE__==="dev"){let i=n==="image"?Ci():pt({__placeholder:!0,type:n});return X.set(e,i),i}throw a}};je("image",async(t,e)=>{let n=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",a=n==="publish";if(console.log(`[AssetLoader] registerType('image') - __BUILD_MODE__: ${n}, isPublishMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);return ee.Assets.load(e)}return ee.Assets.load(e||t)});je("json",async(t,e)=>{let n=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",a=n==="publish";if(console.log(`[AssetLoader] registerType('json') - __BUILD_MODE__: ${n}, isPublishMode: ${a}, inlineData: ${e?"EXISTS":"MISSING"}`),a){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e)}if(e)return e.startsWith("data:")?JSON.parse(atob(e.split(",")[1])):JSON.parse(e);let s=await fetch(t);if(!s.ok)throw new Error(`JSON fetch failed: ${t}`);return s.json()});var Ce=require("pixi.js");var Qe=class{static async create(e,n,a){var c,l,p,f,u,d;console.log(`[ObjectFactory] create() called for: ${e}, __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`);let i=(c=n==null?void 0:n.render)==null?void 0:c.asset;if(!i){console.log(`[ObjectFactory] No asset definition for: ${e}, returning empty container`);let m=new Ce.Container;return this.applyTransform(m,n==null?void 0:n.transform),m}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${e}, type: ${i.type}, path: ${i.path}`);let o=await we.load(e,i,a);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${e}, rawAsset type: ${(l=o==null?void 0:o.constructor)==null?void 0:l.name}`);let r;if(i.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",o,"for object:",e),r=new Ce.Sprite(o),console.log("[ObjectFactory] Created object:",r,"type:",(p=r==null?void 0:r.constructor)==null?void 0:p.name),this.applyTransform(r,n==null?void 0:n.transform);else if(i.type==="json")if(console.log("[ObjectFactory] JSON asset for",e,"rawAsset type:",(f=o==null?void 0:o.constructor)==null?void 0:f.name,o),o&&(((u=o.constructor)==null?void 0:u.name)==="Container"||o instanceof Ce.Container)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let m=[i.path,`/assets/${i.path}`,`assets/${i.path}`,`../assets/${i.path}`],h=!1;for(let g of m)try{let b=await fetch(g);if(b.ok){r=await b.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",g,"type:",(d=r==null?void 0:r.constructor)==null?void 0:d.name),h=!0;break}}catch{continue}h||(console.error("[ObjectFactory] Failed to reload JSON from any path"),r=o)}else r=o;else r=o,r&&typeof r=="object"&&("x"in r||"position"in r)&&this.applyTransform(r,n==null?void 0:n.transform);return r}static applyTransform(e,n){var a,s,i,o;!n||!e||(n.position&&("x"in e&&"y"in e?(e.x=(a=n.position.x)!=null?a:0,e.y=(s=n.position.y)!=null?s:0):"position"in e&&e.position&&e.position.set((i=n.position.x)!=null?i:0,(o=n.position.y)!=null?o:0)),n.scale!==void 0&&"scale"in e&&e.scale&&(typeof e.scale=="object"&&"set"in e.scale?e.scale.set(n.scale):e.scale=n.scale),n.rotation!==void 0&&"rotation"in e&&(e.rotation=n.rotation),n.anchor&&"anchor"in e&&e.anchor&&Array.isArray(n.anchor)&&("set"in e.anchor?e.anchor.set(n.anchor[0],n.anchor[1]):(e.anchor.x=n.anchor[0],e.anchor.y=n.anchor[1])))}};0&&(module.exports={AssetCache,AssetLoader,GameObject,GameObjectManager,ObjectFactory,Renderer,Transform,animateHandClick,animatePanelEntrance,createEndGamePanel,createHandTutorial,createPixiBase,createTutorialLabel,getRegisteredFontIds,playLottieOverlay,registerFont,registerType,resolveFont,resolveFontWeight,setLottieInstance,updateHandAnimation});
|
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 ft}from"../chunk-UVBNGLP3.mjs";import{Application as Bn}from"pixi.js";async function Nn(n,t={}){let e=new Bn;await e.init({resizeTo:n,autoDensity:!0,resolution:window.devicePixelRatio||1,antialias:!0,backgroundAlpha:0});let o=a=>{var c,l,u,h,p,d;let r=(u=(l=(c=a==null?void 0:a.width)!=null?c:n.clientWidth)!=null?l:window.innerWidth)!=null?u:320,i=(d=(p=(h=a==null?void 0:a.height)!=null?h:n.clientHeight)!=null?p:window.innerHeight)!=null?d:480;e.renderer.resize(r,i)};n.innerHTML="",n.style.position="relative",n.style.display="flex",n.style.flexDirection="column",n.style.alignItems="stretch",n.style.width="100%",n.style.height="100dvh",n.style.minHeight="100vh",n.style.maxWidth="100%",n.style.maxHeight="100%",n.style.boxSizing="border-box",n.style.overflow="hidden",t.background&&(n.style.background=t.background),n.appendChild(e.canvas);let s=document.createElement("div");return s.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","align-items:center","justify-content:flex-start","gap:12px","pointer-events:none","font-family:Arial,sans-serif","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),n.appendChild(s),ft.on("pause",()=>{e.ticker.stop(),document.querySelectorAll("audio").forEach(r=>r.pause())}),ft.on("resume",()=>{e.ticker.start(),document.querySelectorAll("audio").forEach(r=>{r.currentTime>0&&!r.ended&&r.play().catch(()=>{})})}),ft.on("resize",({payload:a})=>{o({width:a==null?void 0:a.width,height:a==null?void 0:a.height})}),window.addEventListener("resize",()=>o()),requestAnimationFrame(()=>o()),{app:e,stage:e.stage,overlay:s,applySize:o}}var yt=class{constructor(t){var e,o;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(e=t==null?void 0:t.scale)!=null?e:1,this.rotation=(o=t==null?void 0:t.rotation)!=null?o:0}update(t){t.position!==void 0&&(this.position={...t.position}),t.scale!==void 0&&(this.scale=t.scale),t.rotation!==void 0&&(this.rotation=t.rotation)}syncToPixi(t){t.position.set(this.position.x,this.position.y),t.scale.set(this.scale),t.rotation=this.rotation}},mt=class{constructor(t){var e,o,s,a;this.z_index=(e=t==null?void 0:t.z_index)!=null?e:0,this.alpha=(o=t==null?void 0:t.alpha)!=null?o:1,this.visible=(s=t==null?void 0:t.visible)!=null?s:!0,this.tint=(a=t==null?void 0:t.tint)!=null?a:null}update(t){t.z_index!==void 0&&(this.z_index=t.z_index),t.alpha!==void 0&&(this.alpha=t.alpha),t.visible!==void 0&&(this.visible=t.visible),t.tint!==void 0&&(this.tint=t.tint)}syncToPixi(t){t.zIndex=this.z_index,t.alpha=this.alpha,t.visible=this.visible,this.tint!==null&&"tint"in t&&(t.tint=this.tint)}},_t=class{constructor(t,e,o,s){this.instanceId=t,this.objectConfig=e,this.pixiObject=o,this._config=s,this.transform=new yt(s.transform),this.renderer=new mt(s.render),this.sync()}sync(){this.transform.syncToPixi(this.pixiObject),this.renderer.syncToPixi(this.pixiObject)}updateConfig(t){this._config=t,t.transform&&this.transform.update(t.transform),t.render&&this.renderer.update(t.render),this.sync()}getComponent(t){return this._config[t]}getPosition(){return{...this.transform.position}}setPosition(t,e){this.transform.position={x:t,y:e},this.transform.syncToPixi(this.pixiObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToPixi(this.pixiObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToPixi(this.pixiObject)}},Tt=class{constructor(t){this.objects=new Map;this.config=t}create(t,e){let o=this.config.objects.get(t);if(!o)throw new Error(`Object config not found: ${t}`);let s=new _t(t,o.object_config||t,e,o);return this.objects.set(t,s),s}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[e,o]of this.objects.entries()){let s=t.objects.get(e);s&&o.updateConfig(s)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var gt={"brand.primary":{family:"Arial, sans-serif",weight:"400"},"brand.warning":{family:"Arial Black, Arial, sans-serif",weight:"900"},"brand.heading":{family:"Arial Black, Arial, sans-serif",weight:"800"},"brand.body":{family:"Arial, sans-serif",weight:"400"}};function J(n){let t=gt[n];return t?t.family:(console.warn(`Font ID "${n}" not found in registry, using fallback`),"Arial, sans-serif")}function G(n){var e;let t=gt[n];return t&&(e=t.weight)!=null?e:"400"}function kn(n,t){gt[n]=t}function Rn(){return Object.keys(gt)}import{Container as In,Graphics as xt,Text as at,Sprite as Ve,Texture as At}from"pixi.js";function Yn(n,t,e){var Yt,zt,Ht,Wt,Jt,Gt,Xt,qt,Vt,Ut,Kt,Qt,Zt,jt,te,ee,ne,ae,se,oe,ie,re,le,ce,de,pe,ue,he,fe,ye,me,_e,ge,xe,be,we,Se,Te,Ae,Le,Ee,Me,ve,De,Ce,Oe,Fe,Pe,$e,Be,Ne,ke,Re,Ie,Ye,ze,He,We,Je,Ge;let o=n.objects.get("ui_endgame_1"),s=n.objects.get("ui_endgame_logo_1"),a=n.objects.get("ui_endgame_title_1"),r=n.objects.get("ui_endgame_subtitle_1"),i=n.objects.get("ui_endgame_footer_1"),c=n.objects.get("ui_endgame_cta_1"),l=n.objects.get("ui_endgame_cta_hint_1"),u=n.objects.get("ui_endgame_hand_1"),h=n.engine.runtime||{},p=new In;p.alpha=0,p.visible=!1;let d=((Yt=o==null?void 0:o.gameplay)==null?void 0:Yt.tuning)||{},f=(o==null?void 0:o.render)||{},y=(zt=d.panel_width)!=null?zt:320,m=(Ht=d.panel_height)!=null?Ht:400,g=(Wt=d.panel_padding)!=null?Wt:32,_=(Jt=d.panel_radius)!=null?Jt:24,x=f.background_color||d.panel_bg_color||"#1a0a0a",b=f.background_alpha!==void 0&&f.background_alpha!==null?f.background_alpha:(Gt=d.panel_bg_alpha)!=null?Gt:.98,T=f.border_color||d.panel_border_color||"#ffffff",A=(Xt=d.panel_border_width)!=null?Xt:2,w=(qt=d.panel_border_alpha)!=null?qt:.3,S=new xt;S.roundRect(-y/2,-m/2,y,m,_);let L=x.replace("#","");S.fill({color:parseInt(L,16),alpha:b});let C=T.replace("#","");S.stroke({color:parseInt(C,16),width:A,alpha:w});let E=new xt;E.roundRect(-y/2+2,-m/2+2,y-4,m-4,_-2),E.stroke({color:16777215,width:1,alpha:.1}),S.addChild(E),p.addChild(S);let O=((Vt=s==null?void 0:s.gameplay)==null?void 0:Vt.tuning)||{},k=(s==null?void 0:s.transform)||{},M=(Ut=O.logo_size)!=null?Ut:56,F=(Kt=k.scale)!=null?Kt:1,R=(Zt=(Qt=k.offset)==null?void 0:Qt.y)!=null?Zt:-130,it=(jt=O.logo_alpha)!=null?jt:1,v=new Ve(e||At.EMPTY);v.anchor.set(.5);let U=0,K=0;if(e&&e!==At.EMPTY){let D=e.frame,W=e.baseTexture;D&&D.width&&D.height?(U=D.width,K=D.height):W&&W.width&&W.height?(U=W.width,K=W.height):e.width&&e.height&&(U=e.width,K=e.height)}if(U>0&&K>0){let D=U/K,W,St;D>1?(W=M,St=M/D):(St=M,W=M*D);let Xe=W/U,qe=St/K;Xe*=F,qe*=F,v.scale.set(Xe,qe)}else{let D=M/100*F;v.scale.set(D)}v.position.set(0,R),v.alpha=0,v.visible=!0,v.targetAlpha=it,v.baseScaleX=v.scale.x,v.baseScaleY=v.scale.y,p.addChild(v);let P=a==null?void 0:a.ui,I=((te=a==null?void 0:a.gameplay)==null?void 0:te.tuning)||{},Qe=(P==null?void 0:P.text)||"MISSION ACCOMPLISHED",Dt=(P==null?void 0:P.font)||"brand.heading",Ze=(P==null?void 0:P.fontSize)||24,je=(ee=P==null?void 0:P.letterSpacing)!=null?ee:1,rt=(ne=a==null?void 0:a.render)==null?void 0:ne.tint,tn=typeof rt=="string"?rt:rt?`#${rt.toString(16).padStart(6,"0")}`:"#00FF88",Ct=y-g*2-30,en=I.font_weight_override?I.font_weight_override:G(Dt),q=new at({text:Qe,style:{fontFamily:J(Dt),fontSize:Ze,fontWeight:en,fill:tn,align:"center",letterSpacing:je,wordWrap:!1,stroke:{color:I.stroke_color||"#000000",width:(ae=I.stroke_width)!=null?ae:2},dropShadow:{color:I.shadow_color||"#000000",alpha:(se=I.shadow_alpha)!=null?se:.9,angle:(oe=I.shadow_angle)!=null?oe:0,blur:(ie=I.shadow_blur)!=null?ie:8,distance:(re=I.shadow_distance)!=null?re:4}}});if(q.width>Ct){let D=Ct/q.width;q.scale.set(D)}q.anchor.set(.5);let Ot=(le=d.title_offset_y)!=null?le:30,nn=Ot+((ce=I.animation_start_y_offset)!=null?ce:-20);q.position.set(0,nn),q.alpha=0,p.addChild(q);let $=r==null?void 0:r.ui,Ft=((de=r==null?void 0:r.gameplay)==null?void 0:de.tuning)||{},an=($==null?void 0:$.text)||"RESCUE COMPLETE",Pt=($==null?void 0:$.font)||"brand.body",sn=($==null?void 0:$.fontSize)||11,on=(pe=$==null?void 0:$.letterSpacing)!=null?pe:.5,lt=(ue=r==null?void 0:r.render)==null?void 0:ue.tint,rn=typeof lt=="string"?lt:lt?`#${lt.toString(16).padStart(6,"0")}`:"#B0B0B0",Q=new at({text:an,style:{fontFamily:J(Pt),fontSize:sn,fontWeight:G(Pt),fill:rn,align:"center",letterSpacing:on}});Q.anchor.set(.5);let ln=Ot+20+((he=Ft.animation_start_y_offset)!=null?he:-10);Q.position.set(0,ln),Q.alpha=0,Q.animationStartYOffset=(fe=Ft.animation_start_y_offset)!=null?fe:-10,p.addChild(Q);let z=i==null?void 0:i.ui,$t=((ye=i==null?void 0:i.gameplay)==null?void 0:ye.tuning)||{},cn=(z==null?void 0:z.text)||((me=h.ui)==null?void 0:me.cta_hint)||"Continue the adventure!",Bt=(z==null?void 0:z.font)||"brand.body",dn=(z==null?void 0:z.fontSize)||16,ct=(_e=i==null?void 0:i.render)==null?void 0:_e.tint,pn=typeof ct=="string"?ct:ct?`#${ct.toString(16).padStart(6,"0")}`:"#FFFFFF",un=(ge=$t.max_width)!=null?ge:y-g*2,hn=(xe=$t.line_height)!=null?xe:1.4,Z=new at({text:cn,style:{fontFamily:J(Bt),fontSize:dn,fontWeight:G(Bt),fill:pn,align:"center",wordWrap:!0,wordWrapWidth:un,lineHeight:hn}});Z.anchor.set(.5);let fn=(be=d.footer_offset_y)!=null?be:120;Z.position.set(0,fn);let yn=((we=i==null?void 0:i.render)==null?void 0:we.alpha)!==void 0&&((Se=i==null?void 0:i.render)==null?void 0:Se.alpha)!==null?i.render.alpha:1;Z.alpha=0,Z.targetAlpha=yn,p.addChild(Z);let H=((Te=c==null?void 0:c.gameplay)==null?void 0:Te.tuning)||{},B=c==null?void 0:c.ui,dt=(Ae=H.button_width)!=null?Ae:260,pt=(Le=H.button_height)!=null?Le:56,Nt=(Ee=H.button_radius)!=null?Ee:16,mn=H.button_bg_color||((Me=h.theme)==null?void 0:Me.cta_background)||"#ffb43b",_n=(ve=H.button_bg_alpha)!=null?ve:1,gn=H.button_border_color||"#ffffff",xn=(De=H.button_border_width)!=null?De:2,bn=(Ce=H.button_border_alpha)!=null?Ce:.2,ut=(Oe=d.cta_offset_y)!=null?Oe:160,Y=new xt;Y.roundRect(-dt/2,-pt/2,dt,pt,Nt);let wn=mn.replace("#","");Y.fill({color:parseInt(wn,16),alpha:_n});let Sn=gn.replace("#","");Y.stroke({color:parseInt(Sn,16),width:xn,alpha:bn});let bt=new xt;bt.roundRect(-dt/2+2,-pt/2+2,dt-4,pt-4,Nt-2),bt.stroke({color:0,width:1,alpha:.15}),Y.addChild(bt),Y.position.set(0,ut),Y.alpha=0,Y.eventMode="static",Y.cursor="pointer",p.addChild(Y);let Tn=(B==null?void 0:B.text)||((Fe=h.ui)==null?void 0:Fe.cta_label_end)||"DOWNLOAD",kt=(B==null?void 0:B.font)||"brand.heading",An=(B==null?void 0:B.fontSize)||20,Ln=H.button_text_color||((Pe=h.theme)==null?void 0:Pe.cta_text)||"#1a0a0a",nt=new at({text:Tn,style:{fontFamily:J(kt),fontSize:An,fontWeight:G(kt),fill:Ln,align:"center",letterSpacing:($e=B==null?void 0:B.letterSpacing)!=null?$e:1}});nt.anchor.set(.5),nt.position.set(0,ut),nt.alpha=0,p.addChild(nt);let N=l==null?void 0:l.ui,Rt=((Be=l==null?void 0:l.gameplay)==null?void 0:Be.tuning)||{},En=(N==null?void 0:N.text)||"Play the full game",It=(N==null?void 0:N.font)||"brand.body",Mn=(N==null?void 0:N.fontSize)||11,vn=(Ne=N==null?void 0:N.letterSpacing)!=null?Ne:0,ht=(ke=l==null?void 0:l.render)==null?void 0:ke.tint,Dn=typeof ht=="string"?ht:ht?`#${ht.toString(16).padStart(6,"0")}`:"#CCCCCC",j=new at({text:En,style:{fontFamily:J(It),fontSize:Mn,fontWeight:G(It),fill:Dn,align:"center",letterSpacing:vn}});j.anchor.set(.5);let Cn=ut+35+((Re=Rt.animation_start_y_offset)!=null?Re:5);j.position.set(0,Cn),j.alpha=0,j.animationStartYOffset=(Ie=Rt.animation_start_y_offset)!=null?Ie:5,p.addChild(j);let wt=((Ye=u==null?void 0:u.gameplay)==null?void 0:Ye.tuning)||{},On=(ze=wt.hand_offset_x)!=null?ze:50,Fn=(He=wt.hand_offset_y)!=null?He:50,Pn=(Je=(We=u==null?void 0:u.transform)==null?void 0:We.scale)!=null?Je:.1875,$n=(Ge=wt.hand_scale_multiplier)!=null?Ge:2.5,V=new Ve(t||At.EMPTY);return V.anchor.set(.5),V.scale.set(Pn*$n),V.position.set(On,ut+Fn),V.alpha=0,V.visible=!1,p.addChild(V),{panel:p,logo:v,title:q,subtitle:Q,footer:Z,ctaButton:Y,ctaText:nt,ctaHint:j,hand:V}}function zn(n,t,e){var A,w,S,L,C,E,O,k;let o=t.objects.get("ui_endgame_1"),s=((A=o==null?void 0:o.gameplay)==null?void 0:A.tuning)||{},a=(w=s.animation_duration_ms)!=null?w:800,r=(S=s.fade_in_duration_ms)!=null?S:600,i=(L=s.scale_animation_intensity)!=null?L:.1,c=(C=s.logo_animation_delay_ms)!=null?C:100,l=(E=s.title_animation_delay_ms)!=null?E:200,u=(O=s.footer_animation_delay_ms)!=null?O:300,h=(k=s.cta_animation_delay_ms)!=null?k:400,{panel:p,logo:d,title:f,subtitle:y,footer:m,ctaButton:g,ctaText:_,ctaHint:x}=n;p.visible=!0;let b=Date.now(),T=()=>{let M=Date.now()-b,F=Math.min(M/r,1),R=1-Math.pow(1-F,3);p.alpha=R,p.scale.set(1+i*(1-R)),F<1?requestAnimationFrame(T):(setTimeout(()=>Hn(d,a,t),c),setTimeout(()=>{Wn(f,a),setTimeout(()=>Jn(y,a),50)},l),setTimeout(()=>Gn(m,a),u),setTimeout(()=>{Xn(g,_,a),setTimeout(()=>qn(x,a),50),e&&e()},h))};T()}function Hn(n,t,e){var p,d,f,y,m;let o=e==null?void 0:e.objects.get("ui_endgame_logo_1"),a=(d=(((p=o==null?void 0:o.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?d:1.2,r=Date.now(),i=n.alpha,c=(f=n.targetAlpha)!=null?f:1,l=(y=n.baseScaleX)!=null?y:n.scale.x,u=(m=n.baseScaleY)!=null?m:n.scale.y,h=()=>{let g=Date.now()-r,_=Math.min(g/t,1),x=1-Math.pow(1-_,2);n.alpha=i+(c-i)*x;let b=a+(1-a)*x;n.scale.set(l*b,u*b),_<1&&requestAnimationFrame(h)};h()}function Wn(n,t){let e=Date.now(),o=n.alpha,s=n.y,a=()=>{let r=Date.now()-e,i=Math.min(r/t,1),c=1-Math.pow(1-i,2);n.alpha=o+(1-o)*c,n.y=s-20*(1-c),i<1&&requestAnimationFrame(a)};a()}function Jn(n,t){var i;let e=Date.now(),o=n.alpha,s=n.position.y,a=s-((i=n.animationStartYOffset)!=null?i:-10),r=()=>{let c=Date.now()-e,l=Math.min(c/t,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=s+(a-s)*u,l<1&&requestAnimationFrame(r)};r()}function Gn(n,t){var r;let e=Date.now(),o=n.alpha,s=(r=n.targetAlpha)!=null?r:1,a=()=>{let i=Date.now()-e,c=Math.min(i/t,1),l=1-Math.pow(1-c,2);n.alpha=o+(s-o)*l,c<1&&requestAnimationFrame(a)};a()}function Xn(n,t,e){let o=Date.now(),s=n.alpha,a=()=>{let r=Date.now()-o,i=Math.min(r/e,1),c=1-Math.pow(1-i,2);n.alpha=s+(1-s)*c,t.alpha=s+(1-s)*c,n.scale.set(1+.1*(1-c)),i<1&&requestAnimationFrame(a)};a()}function qn(n,t){var i;let e=Date.now(),o=n.alpha,s=n.position.y,a=s-((i=n.animationStartYOffset)!=null?i:5),r=()=>{let c=Date.now()-e,l=Math.min(c/t,1),u=1-Math.pow(1-l,2);n.alpha=o+(1-o)*u,n.position.y=s+(a-s)*u,l<1&&requestAnimationFrame(r)};r()}function Vn(n,t,e,o){var u,h,p,d;let s=e.objects.get("ui_endgame_hand_1"),a=((u=s==null?void 0:s.gameplay)==null?void 0:u.tuning)||{},r=(h=a.click_animation_duration_ms)!=null?h:600,i=(p=a.click_delay_ms)!=null?p:2e3,c=(d=a.click_repeat_delay_ms)!=null?d:3e3,l=()=>{var A,w;n.visible=!0,n.alpha=1;let f=n.x,y=n.y,m=(A=a.hand_offset_x)!=null?A:50,g=(w=a.hand_offset_y)!=null?w:50,_=t.x+m,x=t.y+g,b=Date.now(),T=()=>{var M,F,R;let S=Date.now()-b,L=Math.min(S/r,1),C=L<.5?2*L*L:1-Math.pow(-2*L+2,2)/2;n.x=f+(_-f)*C,n.y=y+(x-y)*C;let E=(F=(M=s==null?void 0:s.transform)==null?void 0:M.scale)!=null?F:.1875,O=(R=a.hand_scale_multiplier)!=null?R:2.5,k=E*O;n.scale.set(k+k*.2*Math.sin(L*Math.PI)),L<1?requestAnimationFrame(T):(t.scale.set(.95),setTimeout(()=>{t.scale.set(1),o()},100),setTimeout(()=>{n.alpha=0,setTimeout(()=>{n.x=f,n.y=y,l()},c)},500))};T()};setTimeout(l,i)}import{Sprite as Un,Text as Kn}from"pixi.js";function Qn(n,t,e){var u,h,p,d;let o=t.objects.get("hand_tutorial_1"),s=((u=o==null?void 0:o.gameplay)==null?void 0:u.tuning)||{},a=(o==null?void 0:o.render)||{},r=(o==null?void 0:o.transform)||{},i=new Un(n);i.anchor.set(.5),i.alpha=0;let c=(h=s.hand_scale_multiplier)!=null?h:2.5,l=(p=r.scale)!=null?p:.1875;return i.scale.set(l*c),i.zIndex=(d=a.z_index)!=null?d:99999,i}function Zn(n){var f,y,m,g,_,x,b,T,A,w;let t=n.objects.get("ui_tutorial_1"),e=t==null?void 0:t.ui,o=(t==null?void 0:t.render)||{},s=((f=n.engine.runtime)==null?void 0:f.ui_styles)||{},a=((y=n.engine.runtime)==null?void 0:y.ui)||{},r=(e==null?void 0:e.text)||a.tutorial_label||a.label_text||"CLEAN!",i=(e==null?void 0:e.font)||"brand.warning",c=(e==null?void 0:e.fontSize)||s.label_font_size||52,l=(g=e==null?void 0:e.letterSpacing)!=null?g:(m=s.label_letter_spacing)!=null?m:-1,u=(e==null?void 0:e.align)||"center",h=o.tint,p=typeof h=="string"?h:h?`#${h.toString(16).padStart(6,"0")}`:s.label_fill||"#FFF1C1",d=new Kn({text:r,style:{fontFamily:J(i),fontSize:c,fontWeight:G(i),fill:p,align:u,letterSpacing:l,stroke:{color:s.label_stroke||"#8B0000",width:2},dropShadow:{color:s.label_shadow_color||"#000000",alpha:(_=s.label_shadow_alpha)!=null?_:.8,angle:(x=s.label_shadow_angle)!=null?x:0,blur:(b=s.label_shadow_blur)!=null?b:4,distance:(T=s.label_shadow_distance)!=null?T:2}}});return d.anchor.set(.5,0),d.alpha=(A=o.alpha)!=null?A:0,d.visible=(w=o.visible)!=null?w:!0,d}function jn(n,t,e,o,s){var c,l,u,h,p,d,f;let a=s.objects.get("hand_tutorial_1"),r=((c=a==null?void 0:a.gameplay)==null?void 0:c.tuning)||{},i=(a==null?void 0:a.transform)||{};if(!o){let y=(l=r.animation_duration)!=null?l:1.5,m=e%y/y,g=m<.5?2*m*m:-1+(4-2*m)*m,_=(u=r.x_offset)!=null?u:0,x=(h=r.y_offset)!=null?h:0,b=(p=r.animation_range)!=null?p:40,T=b*.7,A=b,w=t.x+_+T,S=t.y+x+A,L=w+T,C=S+A;n.x=w+(L-w)*g,n.y=S+(C-S)*g;let E=(d=i.scale)!=null?d:.1875,O=(f=r.hand_scale_multiplier)!=null?f:2.5;n.scale.set(E*O)}}var st=null;function ta(){return st||(typeof window!="undefined"&&window.lottie?st=window.lottie:(console.warn("[LottieOverlay] lottie-web is not available globally. Make sure it is loaded before using Lottie animations."),st=null)),st}function ea(n){st=n}function na(n,t,e,o){var T,A,w,S,L,C,E,O,k,M,F,R,it;let s=e.objects.get(n);if(!s)return console.warn(`[LottieOverlay] Object config not found: ${n}`),null;let a=((T=s.effects)==null?void 0:T.lottie)||{},r=s.transform||{},i=s.render||{};if(a.enabled===!1||i.visible===!1)return null;let c=o[n];if(!c||typeof c!="object")return console.warn(`[LottieOverlay] Asset data not found or invalid for: ${n}`),null;let l=ta();if(!l)return console.warn(`[LottieOverlay] lottie-web is not available. Cannot play animation: ${n}`),null;let u=(A=a.width)!=null?A:300,h=(w=a.height)!=null?w:300,p=(S=r.scale)!=null?S:1,d=(C=(L=r.position)==null?void 0:L.x)!=null?C:0,f=(O=(E=r.position)==null?void 0:E.y)!=null?O:0,y=(k=r.rotation)!=null?k:0,m=(M=i.z_index)!=null?M:100,g=(F=i.alpha)!=null?F:1,_=document.createElement("div");_.style.cssText=`
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: calc(50% + ${f}px);
|
|
4
|
+
left: calc(50% + ${d}px);
|
|
5
|
+
transform: translate(-50%, -50%) scale(${p}) rotate(${y}deg);
|
|
6
|
+
width: ${u}px;
|
|
7
|
+
height: ${h}px;
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
z-index: ${m};
|
|
10
|
+
opacity: ${g};
|
|
11
|
+
`,t.appendChild(_);let x=l.loadAnimation({container:_,renderer:a.renderer||"svg",loop:(R=a.loop)!=null?R:!1,autoplay:(it=a.autoplay)!=null?it:!0,animationData:c});a.speed!==void 0&&x.setSpeed(a.speed);let b=()=>{x.destroy(),_.parentNode&&_.parentNode.removeChild(_)};return a.loop||x.addEventListener("complete",b),{animation:x,cleanup:b}}import{Assets as et,Texture as aa}from"pixi.js";var X=class{static get(t){var e;return(e=this.store.get(t))==null?void 0:e.data}static set(t,e){this.store.set(t,{data:e})}static has(t){return this.store.has(t)}static clear(){this.store.clear()}};X.store=new Map;var sa=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] MODULE LOADED - __BUILD_MODE__: ${sa}`);var tt={},Lt=null;async function oa(){if(console.log(`[AssetLoader] getInlineAssets() called - __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`),Object.keys(tt).length>0)return console.log("[AssetLoader] Returning cached inline assets:",Object.keys(tt)),tt;if(!Lt){let t=typeof window!="undefined"?new URL("inline-assets.js",window.location.href).href:"./inline-assets.js";console.log("[AssetLoader] Loading inline assets from:",t),Lt=(async()=>{try{try{let a=await import(t+"?t="+Date.now());if(a.INLINE_ASSETS)return console.log("[AssetLoader] Loaded INLINE_ASSETS via ES module:",Object.keys(a.INLINE_ASSETS)),a.INLINE_ASSETS}catch(a){console.warn("[AssetLoader] ES module import failed, trying text parse:",a)}let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);let o=await e.text();console.log("[AssetLoader] Received JS code, length:",o.length);let s=o.match(/export\s+const\s+INLINE_ASSETS\s*=\s*({[\s\S]*?});?\s*$/m);if(s)try{let a=s[1];console.log("[AssetLoader] Found INLINE_ASSETS export, parsing...");let r=new Function("return "+a)();return console.log("[AssetLoader] Parsed inline assets:",Object.keys(r)),r}catch(a){return console.warn("[AssetLoader] Failed to parse inline assets:",a),{}}else return console.warn("[AssetLoader] INLINE_ASSETS export not found in response"),console.log("[AssetLoader] JS code preview:",o.substring(0,500)),{}}catch(e){return console.warn("[AssetLoader] Failed to load inline assets:",e),{}}})()}return tt=await Lt,console.log("[AssetLoader] Final inline assets cache:",Object.keys(tt)),tt}var Ue=new Map;function Et(n){return n===null||typeof n!="object"||(Object.freeze(n),Object.values(n).forEach(t=>Et(t))),n}function ia(n=64,t=64,e=16711680){let o=document.createElement("canvas");o.width=n,o.height=t;let s=o.getContext("2d");return s.fillStyle=`#${e.toString(16).padStart(6,"0")}`,s.fillRect(0,0,n,t),s.strokeStyle="#000",s.strokeRect(0,0,n,t),s.fillStyle="#fff",s.font="10px sans-serif",s.textAlign="center",s.fillText("MISSING",n/2,t/2),aa.from(o)}function Mt(n,t){Ue.set(n,t)}var ot=class{static async load(t,e,o){let s=X.get(t);if(s!==void 0)return s;let a=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined";console.log(`[AssetLoader] Loading asset: ${t}, type: ${e.type}, __BUILD_MODE__: ${a}`);let i=(await oa())[t];if(console.log("[AssetLoader] Inline data for",t,":",i?"FOUND":"NOT FOUND"),a==="publish"&&(console.log("[AssetLoader] \u26A0\uFE0F PUBLISH MODE DETECTED - inline assets are MANDATORY"),!i))throw new Error(`[AssetLoader] PUBLISH MODE: Inline asset required but NOT FOUND for object: ${t}, path: ${e.path}`);let c=Ue.get(e.type);if(c)try{let l=await c(e.path,i,t,o);return X.set(t,l),l}catch(l){return this.handleFailure(t,e.type,l)}try{let l;switch(e.type){case"image":l=await this.loadImage(e.path,i);break;case"json":l=await this.loadJSON(e.path,i),l=Et(l);break;default:throw new Error(`Unknown asset type: ${e.type}`)}return X.set(t,l),l}catch(l){return this.handleFailure(t,e.type,l)}}static async loadImage(t,e){let o=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=o==="publish";if(console.log(`[AssetLoader] loadImage - __BUILD_MODE__: ${o}, isPublishMode: ${s}, inlineData: ${e?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for object. Path: ${t}`);if(!e.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${e.substring(0,50)}...`);try{return await et.load(e)}catch(a){throw console.error("[AssetLoader] Failed to load texture from data URI:",a),a}}if(e&&e.startsWith("data:"))try{return await et.load(e)}catch(a){return console.error("[AssetLoader] Failed to load texture from data URI, falling back to path:",a),await et.load(t)}return await et.load(t)}static async loadJSON(t,e){let o=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",s=o==="publish";if(console.log(`[AssetLoader] loadJSON - __BUILD_MODE__: ${o}, isPublishMode: ${s}, inlineData: ${e?"EXISTS":"MISSING"}`),s){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!e)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${t}`);if(e.startsWith("data:")){let r=atob(e.split(",")[1]);return JSON.parse(r)}return JSON.parse(e)}if(e){if(e.startsWith("data:")){let r=atob(e.split(",")[1]);return JSON.parse(r)}return JSON.parse(e)}let a=await fetch(t);if(!a.ok)throw new Error(`JSON fetch failed: ${t}`);return a.json()}static handleFailure(t,e,o){if(typeof __BUILD_MODE__!="undefined"&&__BUILD_MODE__==="dev"){let a=e==="image"?ia():Et({__placeholder:!0,type:e});return X.set(t,a),a}throw o}};Mt("image",async(n,t)=>{let e=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",o=e==="publish";if(console.log(`[AssetLoader] registerType('image') - __BUILD_MODE__: ${e}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),o){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${n}`);if(!t.startsWith("data:"))throw new Error(`[AssetLoader] Publish mode: inline asset must be data URI, got: ${t.substring(0,50)}...`);return et.load(t)}return et.load(t||n)});Mt("json",async(n,t)=>{let e=typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined",o=e==="publish";if(console.log(`[AssetLoader] registerType('json') - __BUILD_MODE__: ${e}, isPublishMode: ${o}, inlineData: ${t?"EXISTS":"MISSING"}`),o){if(console.log("[AssetLoader] PUBLISH MODE ACTIVATED - inline assets are MANDATORY"),!t)throw new Error(`[AssetLoader] Publish mode: inline asset required but not found for path: ${n}`);return t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t)}if(t)return t.startsWith("data:")?JSON.parse(atob(t.split(",")[1])):JSON.parse(t);let s=await fetch(n);if(!s.ok)throw new Error(`JSON fetch failed: ${n}`);return s.json()});import{Sprite as ra,Container as Ke}from"pixi.js";var vt=class{static async create(t,e,o){var c,l,u,h,p,d;console.log(`[ObjectFactory] create() called for: ${t}, __BUILD_MODE__: ${typeof __BUILD_MODE__!="undefined"?__BUILD_MODE__:"undefined"}`);let a=(c=e==null?void 0:e.render)==null?void 0:c.asset;if(!a){console.log(`[ObjectFactory] No asset definition for: ${t}, returning empty container`);let f=new Ke;return this.applyTransform(f,e==null?void 0:e.transform),f}console.log(`[ObjectFactory] Calling AssetLoader.load() for: ${t}, type: ${a.type}, path: ${a.path}`);let r=await ot.load(t,a,o);console.log(`[ObjectFactory] AssetLoader.load() completed for: ${t}, rawAsset type: ${(l=r==null?void 0:r.constructor)==null?void 0:l.name}`);let i;if(a.type==="image")console.log("[ObjectFactory] Creating Sprite from texture:",r,"for object:",t),i=new ra(r),console.log("[ObjectFactory] Created object:",i,"type:",(u=i==null?void 0:i.constructor)==null?void 0:u.name),this.applyTransform(i,e==null?void 0:e.transform);else if(a.type==="json")if(console.log("[ObjectFactory] JSON asset for",t,"rawAsset type:",(h=r==null?void 0:r.constructor)==null?void 0:h.name,r),r&&(((p=r.constructor)==null?void 0:p.name)==="Container"||r instanceof Ke)){console.warn("[ObjectFactory] JSON asset is Container (from cache), reloading JSON directly");let f=[a.path,`/assets/${a.path}`,`assets/${a.path}`,`../assets/${a.path}`],y=!1;for(let m of f)try{let g=await fetch(m);if(g.ok){i=await g.json(),console.log("[ObjectFactory] Reloaded JSON directly from:",m,"type:",(d=i==null?void 0:i.constructor)==null?void 0:d.name),y=!0;break}}catch{continue}y||(console.error("[ObjectFactory] Failed to reload JSON from any path"),i=r)}else i=r;else i=r,i&&typeof i=="object"&&("x"in i||"position"in i)&&this.applyTransform(i,e==null?void 0:e.transform);return i}static applyTransform(t,e){var o,s,a,r;!e||!t||(e.position&&("x"in t&&"y"in t?(t.x=(o=e.position.x)!=null?o:0,t.y=(s=e.position.y)!=null?s:0):"position"in t&&t.position&&t.position.set((a=e.position.x)!=null?a:0,(r=e.position.y)!=null?r:0)),e.scale!==void 0&&"scale"in t&&t.scale&&(typeof t.scale=="object"&&"set"in t.scale?t.scale.set(e.scale):t.scale=e.scale),e.rotation!==void 0&&"rotation"in t&&(t.rotation=e.rotation),e.anchor&&"anchor"in t&&t.anchor&&Array.isArray(e.anchor)&&("set"in t.anchor?t.anchor.set(e.anchor[0],e.anchor[1]):(t.anchor.x=e.anchor[0],t.anchor.y=e.anchor[1])))}};export{X as AssetCache,ot as AssetLoader,_t as GameObject,Tt as GameObjectManager,vt as ObjectFactory,mt as Renderer,yt as Transform,Vn as animateHandClick,zn as animatePanelEntrance,Yn as createEndGamePanel,Qn as createHandTutorial,Nn as createPixiBase,Zn as createTutorialLabel,Rn as getRegisteredFontIds,na as playLottieOverlay,kn as registerFont,Mt as registerType,J as resolveFont,G as resolveFontWeight,ea as setLottieInstance,jn as updateHandAnimation};
|
package/dist/three/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ga=Object.create;var Pe=Object.defineProperty;var ba=Object.getOwnPropertyDescriptor;var wa=Object.getOwnPropertyNames;var Ea=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty;var _a=(e,t)=>{for(var n in t)Pe(e,n,{get:t[n],enumerable:!0})},In=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wa(t))!xa.call(e,a)&&a!==n&&Pe(e,a,{get:()=>t[a],enumerable:!(i=ba(t,a))||i.enumerable});return e};var we=(e,t,n)=>(n=e!=null?ga(Ea(e)):{},In(t||!e||!e.__esModule?Pe(n,"default",{value:e,enumerable:!0}):n,e)),Ta=e=>In(Pe({},"__esModule",{value:!0}),e);var Ya={};_a(Ya,{AspectClass:()=>ut,GameObject:()=>Ce,GameObjectManager:()=>Ve,Renderer:()=>Ae,ResponsiveUISystem:()=>fe,Transform:()=>Re,animateHandClick:()=>_i,animatePanelEntrance:()=>xi,createBrushTexture:()=>Hi,createEndGamePanel:()=>Ei,createHandTutorial:()=>Ti,createThreeBase:()=>gi,createTutorialLabel:()=>vi,getAspectClass:()=>Ge,getRegisteredFontIds:()=>wi,loadAsset:()=>yt,loadCharacterFrames:()=>Ci,registerFont:()=>bi,resolveFont:()=>j,resolveFontWeight:()=>G,updateHandAnimation:()=>Si});module.exports=Ta(Ya);var O=we(require("three"));var Z={};function We(e,t,n=!1){Z[e]||(Z[e]=[]),Z[e].push({fn:t,once:n})}function st(e,t){if(Z[e]){if(!t){delete Z[e];return}Z[e]=Z[e].filter(n=>n.fn!==t)}}function ze(e,...t){let n=Z[e];if(n)for(let i of[...n])i.fn(...t),i.once&&st(e,i.fn)}function z(e,t){We(e,t,!0)}var Be={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 B=0,Sa=B++,Yn=B++,jn=B++,Gn=B++,Vn=B++,qn=B++,Xn=B++,Kn=B++,Jn=B++,Zn=B++,Qn=B++,Un=B++,v=Sa;function ei(){return v===Yn}function ti(){return v===jn}function ni(){return v===Gn}function ii(){return v===Vn}function le(){return v===qn}function ce(){return v===Xn}function ai(){return v===Kn}function si(){return v===Jn}function oi(){return v===Zn}function ot(){return v===Qn}function rt(){return v===Un}function ri(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),v=Yn;return}catch{}else if(e==="dapi")try{dapi.isReady(),v=jn;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(v=Gn)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(v=Vn)}catch{}else if(t==="mintegral")window.gameReady&&(v=qn);else if(t==="tapjoy")window.TJ_API&&(v=Xn);else if(t==="tiktok")window.openAppStore&&(v=Kn);else if(t==="smadex")try{window.smxTracking&&(v=Jn)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(v=Zn)}catch{}else t==="vungle"?v=Qn:(e==="nucleo"||t==="nucleo")&&(v=Un)}var ui={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"},Ra=Math.random().toString(36).slice(2),de=null,xe={...ui},hi="web_embed",Aa={},lt=!1,Ee=!1,Te=!1,fi=!1,mt=1,dt=0,Ye=!1,K=!1,Ie="",pe=Math.floor(window.innerWidth),me=Math.floor(window.innerHeight),pt=pe>me,J=!1,_e=!1,li=!1,ci=!1,ct=!1,Ne=null;function di(){if(de)return de;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),de=e,e}function Oe(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function yi(e,t){return{event_name:e,ts:Date.now(),session_id:Ra,deployment_id:xe.deployment_id,variant_id:xe.variant_id,export_profile_id:xe.profile_id,instance_id:xe.instance_id||"default",env:hi==="mraid"?"mraid":"web",payload:t}}function w(e,t){let n=Oe(e),i=yi(n,t);ze(n,i),n!==e&&ze(e,i)}function ve(){Ne&&(Ne(pe,me),Ne=null)}function ue(e){mt=e,w("volume",e)}function he(e){e&&(fi=!0),!Te&&(Te=!0,w("pause"),ue(0))}function Se(e){!e&&fi||Te&&(Te=!1,w("resume"),ue(mt))}function U(e,t){pe=Math.floor(e||window.innerWidth),me=Math.floor(t||window.innerHeight),pt=pe>me,w("resize",{width:pe,height:me})}function Ca(){if(ei())try{let e=mraid.getMaxSize();U(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Se():he()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();U(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();ue(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&ue(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),Ye=!0,mraid.isViewable()&&mraid.getState()!=="hidden")J=!0,w("boot"),w("view"),w("ready"),K=!0,ve();else{let n=()=>{J=!0,w("boot"),w("view"),w("ready"),K=!0,ve()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ha(){if(ti())try{let e=dapi.getScreenSize();U(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Se():he()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();U(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(ue(t?1:0),dapi.addEventListener("audioVolumeChange",n=>ue(n?1:0)),Ye=!0,dapi.isViewable())J=!0,w("boot"),w("view"),w("ready"),K=!0,ve();else{let n=()=>{J=!0,w("boot"),w("view"),w("ready"),K=!0,ve()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function pi(){let e=()=>{J||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(J=!0,w("boot"),w("view"),w("ready"),K=!0,ve(),_e&&(_e=!1,Q.start()))};window.addEventListener("resize",()=>U()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Se(),e()):he()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),Ye=!0}function Ma(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(li=!0),!(li&&t instanceof MouseEvent)&&(dt+=1,w("interaction",dt))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function La(e){var i,a,s,r,u,l,m,p,y,f,h,g;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(ce())(s=(a=window.TJ_API)==null?void 0:a.click)==null||s.call(a);else if(ni())(u=(r=window.FbPlayableAd)==null?void 0:r.onCTAClick)==null||u.call(r);else if(oi())(m=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||m.call(l);else if(si())try{(y=(p=window.smxTracking)==null?void 0:p.redirect)==null||y.call(p)}catch(o){console.warn("Smadex redirect failed",o)}else if(ii()){let o=window.ExitApi;o&&typeof o.exit=="function"?o.exit(e||Ie||""):e&&window.open(e)}else le()?(f=window.install)==null||f.call(window):ai()?(h=window.openAppStore)==null||h.call(window):ot()?(g=parent==null?void 0:parent.postMessage)==null||g.call(parent,"download","*"):e&&window.open(e)}function ka(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;z("view",()=>t(n.mraid_viewable)),z("start",()=>t(n.game_viewable)),z("engagement",()=>t(n.engagement));let i=()=>t(n.complete);z("complete",i),We("engagement",a=>{var s;((s=a==null?void 0:a.payload)==null?void 0:s.count)>3&&i()}),z("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;z("view",()=>t(n.Ad_Load_Start)),z("start",()=>t(n.Ad_Viewable)),z("engagement",()=>t(n.First_Engagement)),z("complete",()=>t(n.Gameplay_Complete)),z("cta_click",()=>t(n.DSP_Click)),z("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Fa(){if(!ce())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{Q.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function mi(){var t,n,i;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),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function Da(){le()&&(window.mintGameStart=()=>{Se(!0),U()},window.mintGameClose=()=>{he(!0)})}function $a(){if(!rt())return;let e=window.NUC;!e||!e.trigger||(Q.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,Ie)}),Q.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var Q={init(e={},t){if(hi=e.profile||"web_embed",Aa=e.consent||{},xe={...ui,...e.ids||{}},de=e.rootEl||de,Ie=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(Ne=t),w("init"),document.body.oncontextmenu=()=>!1,di(),Pa(de),ri(),Ca(),Ha(),!Ye){if(document.readyState==="complete")pi();else if(!ci){ci=!0;let n=()=>{pi(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Ma(),ka(),Fa(),Da(),$a(),console.log(`%c @handler/playable-sdk %c v${Be.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;"),J&&!K&&(w("boot"),w("view"),w("ready"),_e&&(_e=!1,Q.start()),K=!0),K=J},getRoot(){return di()},get version(){return Be.version||"0.0.0"},get maxWidth(){return pe},get maxHeight(){return me},get isLandscape(){return pt},get isReady(){return K},get isStarted(){return lt},get isPaused(){return Te},get isFinished(){return Ee},get volume(){return mt},get interactions(){return dt},on(e,t){We(Oe(e),t)},off(e,t){st(Oe(e),t)},start(){var e,t;if(!lt){if(!J){_e=!0;return}if(lt=!0,w("start"),U(),le())he(),(e=window.gameReady)==null||e.call(window);else if(ce()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:pt?"landscape":"portrait",buildID:Be.version||"dev"})}}},finish(){var e,t;Ee||(Ee=!0,w("complete"),le()?(e=window.gameEnd)==null||e.call(window):ot()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):ce()&&mi())},install(e){if(!Ee){Ee=!0,ce()?(mi(),setTimeout(()=>Q.install(e),300)):(w("complete"),setTimeout(()=>Q.install(e),0));return}ct||(ct=!0,setTimeout(()=>ct=!1,500),w("cta_click"),w("conversion"),La(e||Ie))},emit(e,t){let n=Oe(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 i=yi(n,t);ze(n,i)},retry(){var e,t,n;if(le())(e=window.gameRetry)==null||e.call(window);else if(rt()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}w("engagement",{action:"retry"})},pause(){he(!0)},resume(){Se(!0)},resize(e,t){U(e,t)}},je=Q;function Pa(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
1
|
+
"use strict";var ga=Object.create;var Pe=Object.defineProperty;var ba=Object.getOwnPropertyDescriptor;var wa=Object.getOwnPropertyNames;var Ea=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty;var _a=(e,t)=>{for(var n in t)Pe(e,n,{get:t[n],enumerable:!0})},jn=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wa(t))!xa.call(e,a)&&a!==n&&Pe(e,a,{get:()=>t[a],enumerable:!(i=ba(t,a))||i.enumerable});return e};var we=(e,t,n)=>(n=e!=null?ga(Ea(e)):{},jn(t||!e||!e.__esModule?Pe(n,"default",{value:e,enumerable:!0}):n,e)),Ta=e=>jn(Pe({},"__esModule",{value:!0}),e);var Ia={};_a(Ia,{AspectClass:()=>ut,GameObject:()=>Ce,GameObjectManager:()=>Ve,Renderer:()=>Ae,ResponsiveUISystem:()=>fe,Transform:()=>Re,animateHandClick:()=>_i,animatePanelEntrance:()=>xi,createBrushTexture:()=>Hi,createEndGamePanel:()=>Ei,createHandTutorial:()=>Ti,createThreeBase:()=>gi,createTutorialLabel:()=>vi,getAspectClass:()=>Ge,getRegisteredFontIds:()=>wi,loadAsset:()=>yt,loadCharacterFrames:()=>Ci,registerFont:()=>bi,resolveFont:()=>Y,resolveFontWeight:()=>G,updateHandAnimation:()=>Si});module.exports=Ta(Ia);var O=we(require("three"));var Z={};function We(e,t,n=!1){Z[e]||(Z[e]=[]),Z[e].push({fn:t,once:n})}function st(e,t){if(Z[e]){if(!t){delete Z[e];return}Z[e]=Z[e].filter(n=>n.fn!==t)}}function ze(e,...t){let n=Z[e];if(n)for(let i of[...n])i.fn(...t),i.once&&st(e,i.fn)}function z(e,t){We(e,t,!0)}var Be={name:"handler-playable-sdk",version:"0.2.7",description:"Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",main:"dist/index.js",module:"dist/index.mjs",types:"dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.js"},"./pixi":{types:"./dist/pixi/index.d.ts",import:"./dist/pixi/index.mjs",require:"./dist/pixi/index.js"},"./three":{types:"./dist/three/index.d.ts",import:"./dist/three/index.mjs",require:"./dist/three/index.js"}},scripts:{build:"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify --external lottie-web && npm run obfuscate","build:dev":"tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",obfuscate:"javascript-obfuscator dist/index.js dist/index.mjs dist/pixi/index.js dist/pixi/index.mjs dist/three/index.js dist/three/index.mjs --output dist --options-preset high-obfuscation --compact true --self-defending true",lint:"eslint 'src/**/*.{ts,tsx}'",typecheck:"tsc --noEmit",prepublishOnly:"npm run build","publish:update":"node scripts/publish-and-update.js patch","publish:update:minor":"node scripts/publish-and-update.js minor","publish:update:major":"node scripts/publish-and-update.js major"},author:"Handler",license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/HandlerAIGames/handler-playable-sdk.git"},files:["dist","LICENSE","README.md"],peerDependencies:{"lottie-web":"^5.0.0","pixi.js":"^8.0.0",three:"^0.160.0"},peerDependenciesMeta:{"pixi.js":{optional:!0},three:{optional:!0},"lottie-web":{optional:!0}},devDependencies:{"@types/three":"^0.160.0",eslint:"^8.57.1","javascript-obfuscator":"^5.1.0","pixi.js":"8.8.1",three:"^0.160.0","ts-node":"^10.9.2",tsup:"^8.4.0",typescript:"^5.7.2"}};var B=0,Sa=B++,In=B++,Yn=B++,Gn=B++,Vn=B++,qn=B++,Xn=B++,Kn=B++,Jn=B++,Zn=B++,Qn=B++,Un=B++,v=Sa;function ei(){return v===In}function ti(){return v===Yn}function ni(){return v===Gn}function ii(){return v===Vn}function le(){return v===qn}function ce(){return v===Xn}function ai(){return v===Kn}function si(){return v===Jn}function oi(){return v===Zn}function ot(){return v===Qn}function rt(){return v===Un}function ri(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),v=In;return}catch{}else if(e==="dapi")try{dapi.isReady(),v=Yn;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(v=Gn)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(v=Vn)}catch{}else if(t==="mintegral")window.gameReady&&(v=qn);else if(t==="tapjoy")window.TJ_API&&(v=Xn);else if(t==="tiktok")window.openAppStore&&(v=Kn);else if(t==="smadex")try{window.smxTracking&&(v=Jn)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(v=Zn)}catch{}else t==="vungle"?v=Qn:(e==="nucleo"||t==="nucleo")&&(v=Un)}var ui={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"},Ra=Math.random().toString(36).slice(2),de=null,xe={...ui},hi="web_embed",Aa={},lt=!1,Ee=!1,Te=!1,fi=!1,mt=1,dt=0,Ie=!1,K=!1,je="",pe=Math.floor(window.innerWidth),me=Math.floor(window.innerHeight),pt=pe>me,J=!1,_e=!1,li=!1,ci=!1,ct=!1,Ne=null;function di(){if(de)return de;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),de=e,e}function Oe(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function yi(e,t){return{event_name:e,ts:Date.now(),session_id:Ra,deployment_id:xe.deployment_id,variant_id:xe.variant_id,export_profile_id:xe.profile_id,instance_id:xe.instance_id||"default",env:hi==="mraid"?"mraid":"web",payload:t}}function w(e,t){let n=Oe(e),i=yi(n,t);ze(n,i),n!==e&&ze(e,i)}function ve(){Ne&&(Ne(pe,me),Ne=null)}function ue(e){mt=e,w("volume",e)}function he(e){e&&(fi=!0),!Te&&(Te=!0,w("pause"),ue(0))}function Se(e){!e&&fi||Te&&(Te=!1,w("resume"),ue(mt))}function U(e,t){pe=Math.floor(e||window.innerWidth),me=Math.floor(t||window.innerHeight),pt=pe>me,w("resize",{width:pe,height:me})}function Ca(){if(ei())try{let e=mraid.getMaxSize();U(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?Se():he()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();U(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();ue(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&ue(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),Ie=!0,mraid.isViewable()&&mraid.getState()!=="hidden")J=!0,w("boot"),w("view"),w("ready"),K=!0,ve();else{let n=()=>{J=!0,w("boot"),w("view"),w("ready"),K=!0,ve()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ha(){if(ti())try{let e=dapi.getScreenSize();U(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?Se():he()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();U(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(ue(t?1:0),dapi.addEventListener("audioVolumeChange",n=>ue(n?1:0)),Ie=!0,dapi.isViewable())J=!0,w("boot"),w("view"),w("ready"),K=!0,ve();else{let n=()=>{J=!0,w("boot"),w("view"),w("ready"),K=!0,ve()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function pi(){let e=()=>{J||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(J=!0,w("boot"),w("view"),w("ready"),K=!0,ve(),_e&&(_e=!1,Q.start()))};window.addEventListener("resize",()=>U()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(Se(),e()):he()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),Ie=!0}function Ma(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(li=!0),!(li&&t instanceof MouseEvent)&&(dt+=1,w("interaction",dt))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function La(e){var i,a,s,r,u,l,m,p,y,f,h,g;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(ce())(s=(a=window.TJ_API)==null?void 0:a.click)==null||s.call(a);else if(ni())(u=(r=window.FbPlayableAd)==null?void 0:r.onCTAClick)==null||u.call(r);else if(oi())(m=(l=window.ScPlayableAd)==null?void 0:l.onCTAClick)==null||m.call(l);else if(si())try{(y=(p=window.smxTracking)==null?void 0:p.redirect)==null||y.call(p)}catch(o){console.warn("Smadex redirect failed",o)}else if(ii()){let o=window.ExitApi;o&&typeof o.exit=="function"?o.exit(e||je||""):e&&window.open(e)}else le()?(f=window.install)==null||f.call(window):ai()?(h=window.openAppStore)==null||h.call(window):ot()?(g=parent==null?void 0:parent.postMessage)==null||g.call(parent,"download","*"):e&&window.open(e)}function ka(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;z("view",()=>t(n.mraid_viewable)),z("start",()=>t(n.game_viewable)),z("engagement",()=>t(n.engagement));let i=()=>t(n.complete);z("complete",i),We("engagement",a=>{var s;((s=a==null?void 0:a.payload)==null?void 0:s.count)>3&&i()}),z("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;z("view",()=>t(n.Ad_Load_Start)),z("start",()=>t(n.Ad_Viewable)),z("engagement",()=>t(n.First_Engagement)),z("complete",()=>t(n.Gameplay_Complete)),z("cta_click",()=>t(n.DSP_Click)),z("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function Fa(){if(!ce())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{Q.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function mi(){var t,n,i;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),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function Da(){le()&&(window.mintGameStart=()=>{Se(!0),U()},window.mintGameClose=()=>{he(!0)})}function $a(){if(!rt())return;let e=window.NUC;!e||!e.trigger||(Q.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,je)}),Q.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var Q={init(e={},t){if(hi=e.profile||"web_embed",Aa=e.consent||{},xe={...ui,...e.ids||{}},de=e.rootEl||de,je=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(Ne=t),w("init"),document.body.oncontextmenu=()=>!1,di(),Pa(de),ri(),Ca(),Ha(),!Ie){if(document.readyState==="complete")pi();else if(!ci){ci=!0;let n=()=>{pi(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Ma(),ka(),Fa(),Da(),$a(),console.log(`%c @handler/playable-sdk %c v${Be.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;"),J&&!K&&(w("boot"),w("view"),w("ready"),_e&&(_e=!1,Q.start()),K=!0),K=J},getRoot(){return di()},get version(){return Be.version||"0.0.0"},get maxWidth(){return pe},get maxHeight(){return me},get isLandscape(){return pt},get isReady(){return K},get isStarted(){return lt},get isPaused(){return Te},get isFinished(){return Ee},get volume(){return mt},get interactions(){return dt},on(e,t){We(Oe(e),t)},off(e,t){st(Oe(e),t)},start(){var e,t;if(!lt){if(!J){_e=!0;return}if(lt=!0,w("start"),U(),le())he(),(e=window.gameReady)==null||e.call(window);else if(ce()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:pt?"landscape":"portrait",buildID:Be.version||"dev"})}}},finish(){var e,t;Ee||(Ee=!0,w("complete"),le()?(e=window.gameEnd)==null||e.call(window):ot()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):ce()&&mi())},install(e){if(!Ee){Ee=!0,ce()?(mi(),setTimeout(()=>Q.install(e),300)):(w("complete"),setTimeout(()=>Q.install(e),0));return}ct||(ct=!0,setTimeout(()=>ct=!1,500),w("cta_click"),w("conversion"),La(e||je))},emit(e,t){let n=Oe(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 i=yi(n,t);ze(n,i)},retry(){var e,t,n;if(le())(e=window.gameRetry)==null||e.call(window);else if(rt()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}w("engagement",{action:"retry"})},pause(){he(!0)},resume(){Se(!0)},resize(e,t){U(e,t)}},Ye=Q;function Pa(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
2
2
|
(function(){
|
|
3
3
|
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
4
4
|
function unlock(){
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
overflow: hidden !important;
|
|
38
38
|
`,e.appendChild(r);let u=document.createElement("div");u.setAttribute("style",["position:absolute","inset:0","width:100%","height:100%","min-width:100%","min-height:100%","max-width:100%","max-height:100%","pointer-events:auto","box-sizing:border-box","margin:0","padding:0","overflow:hidden"].join(";")),r.appendChild(u);let l=new O.Scene,{width:m,height:p}=n(),y=new O.AmbientLight(16777215,.6);l.add(y);let f=new O.DirectionalLight(16777215,.8);f.position.set(5,5,5),f.castShadow=!1,l.add(f);let h=new O.DirectionalLight(16777215,.3);h.position.set(-5,0,5),l.add(h);let g=new O.PerspectiveCamera(55,m/p,.1,100);g.position.set(0,0,3.2),g.lookAt(0,0,0),g.updateMatrixWorld();let o=new O.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});o.setPixelRatio(window.devicePixelRatio||1),o.setSize(m,p),o.setClearColor(0,0),o.domElement.style.position="absolute",o.domElement.style.top="0",o.domElement.style.left="0",o.domElement.style.right="0",o.domElement.style.bottom="0",o.domElement.style.width="100%",o.domElement.style.height="100%",o.domElement.style.minWidth="100%",o.domElement.style.minHeight="100%",o.domElement.style.maxWidth="100%",o.domElement.style.maxHeight="100%",o.domElement.style.display="block",o.domElement.style.pointerEvents="auto",o.domElement.style.margin="0",o.domElement.style.padding="0",o.domElement.style.boxSizing="border-box",u.appendChild(o.domElement);let E=d=>{var A;let c=e.getBoundingClientRect(),b=window.getComputedStyle(e);console.log("[THREE-BASE] applySize called:",{providedSize:d,rootRect:{width:c.width,height:c.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleSize:{width:e.style.width,height:e.style.height},computedStyle:{width:b.width,height:b.height,transform:b.transform,scale:b.scale},rendererCurrentSize:{width:o.domElement.width,height:o.domElement.height},rendererStyleSize:{width:o.domElement.style.width,height:o.domElement.style.height},stackTrace:(A=new Error().stack)==null?void 0:A.split(`
|
|
39
39
|
`).slice(1,4).join(`
|
|
40
|
-
`)});let _=c.width,S=c.height;if((_<=0||!isFinite(_))&&(console.warn("[THREE-BASE] Invalid boundingRect.width, using clientWidth fallback",{boundingRectWidth:c.width,clientWidth:e.clientWidth}),_=e.clientWidth||window.innerWidth||320),(S<=0||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid boundingRect.height, using clientHeight fallback",{boundingRectHeight:c.height,clientHeight:e.clientHeight}),S=e.clientHeight||window.innerHeight||480),typeof(d==null?void 0:d.width)=="number"&&d.width>0){let L=Math.abs(d.width-c.width),H=c.width*.1;L>H?console.warn("[THREE-BASE] Provided width ignored (too different from container):",{provided:d.width,container:c.width,difference:L,tolerance:H,willUse:"container size (boundingRect)"}):(_=d.width,console.log("[THREE-BASE] Using provided width (within tolerance):",{provided:d.width,container:c.width}))}if(typeof(d==null?void 0:d.height)=="number"&&d.height>0){let L=Math.abs(d.height-c.height),H=c.height*.1;L>H?console.warn("[THREE-BASE] Provided height ignored (too different from container):",{provided:d.height,container:c.height,difference:L,tolerance:H,willUse:"container size (boundingRect)"}):(S=d.height,console.log("[THREE-BASE] Using provided height (within tolerance):",{provided:d.height,container:c.height}))}(_<=0||S<=0||!isFinite(_)||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid size in applySize, using fallback",{newWidth:_,newHeight:S,size:d,rootRect:c}),_=c.width||e.clientWidth||320,S=c.height||e.clientHeight||480);let C=Math.floor(_),F=Math.floor(S);console.log("[THREE-BASE] applySize setting renderer size:",{finalWidth:C,finalHeight:F,aspectRatio:C/F,beforeRendererSize:{width:o.domElement.width,height:o.domElement.height},beforeRendererStyle:{width:o.domElement.style.width,height:o.domElement.style.height}}),o.setSize(C,F),o.setPixelRatio(window.devicePixelRatio||1),g.aspect=C/F,g.updateProjectionMatrix();let R=e.getBoundingClientRect();console.log("[THREE-BASE] applySize after setting:",{rendererSize:{width:o.domElement.width,height:o.domElement.height},rendererStyle:{width:o.domElement.style.width,height:o.domElement.style.height},containerRect:{width:R.width,height:R.height},cameraAspect:g.aspect,matches:{width:Math.abs(o.domElement.width-R.width)<1,height:Math.abs(o.domElement.height-R.height)<1},sizeDifference:{width:o.domElement.width-R.width,height:o.domElement.height-R.height}})};requestAnimationFrame(()=>{requestAnimationFrame(()=>{E()})});let T=!1;
|
|
40
|
+
`)});let _=c.width,S=c.height;if((_<=0||!isFinite(_))&&(console.warn("[THREE-BASE] Invalid boundingRect.width, using clientWidth fallback",{boundingRectWidth:c.width,clientWidth:e.clientWidth}),_=e.clientWidth||window.innerWidth||320),(S<=0||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid boundingRect.height, using clientHeight fallback",{boundingRectHeight:c.height,clientHeight:e.clientHeight}),S=e.clientHeight||window.innerHeight||480),typeof(d==null?void 0:d.width)=="number"&&d.width>0){let L=Math.abs(d.width-c.width),H=c.width*.1;L>H?console.warn("[THREE-BASE] Provided width ignored (too different from container):",{provided:d.width,container:c.width,difference:L,tolerance:H,willUse:"container size (boundingRect)"}):(_=d.width,console.log("[THREE-BASE] Using provided width (within tolerance):",{provided:d.width,container:c.width}))}if(typeof(d==null?void 0:d.height)=="number"&&d.height>0){let L=Math.abs(d.height-c.height),H=c.height*.1;L>H?console.warn("[THREE-BASE] Provided height ignored (too different from container):",{provided:d.height,container:c.height,difference:L,tolerance:H,willUse:"container size (boundingRect)"}):(S=d.height,console.log("[THREE-BASE] Using provided height (within tolerance):",{provided:d.height,container:c.height}))}(_<=0||S<=0||!isFinite(_)||!isFinite(S))&&(console.warn("[THREE-BASE] Invalid size in applySize, using fallback",{newWidth:_,newHeight:S,size:d,rootRect:c}),_=c.width||e.clientWidth||320,S=c.height||e.clientHeight||480);let C=Math.floor(_),F=Math.floor(S);console.log("[THREE-BASE] applySize setting renderer size:",{finalWidth:C,finalHeight:F,aspectRatio:C/F,beforeRendererSize:{width:o.domElement.width,height:o.domElement.height},beforeRendererStyle:{width:o.domElement.style.width,height:o.domElement.style.height}}),o.setSize(C,F),o.setPixelRatio(window.devicePixelRatio||1),g.aspect=C/F,g.updateProjectionMatrix();let R=e.getBoundingClientRect();console.log("[THREE-BASE] applySize after setting:",{rendererSize:{width:o.domElement.width,height:o.domElement.height},rendererStyle:{width:o.domElement.style.width,height:o.domElement.style.height},containerRect:{width:R.width,height:R.height},cameraAspect:g.aspect,matches:{width:Math.abs(o.domElement.width-R.width)<1,height:Math.abs(o.domElement.height-R.height)<1},sizeDifference:{width:o.domElement.width-R.width,height:o.domElement.height-R.height}})};requestAnimationFrame(()=>{requestAnimationFrame(()=>{E()})});let T=!1;Ye.on("pause",()=>{T=!0,document.querySelectorAll("audio").forEach(c=>c.pause())}),Ye.on("resume",()=>{T=!1,document.querySelectorAll("audio").forEach(c=>{c.currentTime>0&&!c.ended&&c.play().catch(()=>{})})});let x=new fe(e,r);return Ye.on("resize",({payload:d})=>{console.log("[THREE-BASE] Handler resize event received:",{payload:d,timestamp:Date.now(),rootRect:e.getBoundingClientRect()}),E({width:d==null?void 0:d.width,height:d==null?void 0:d.height}),x.updateLayout()}),window.addEventListener("resize",()=>{console.log("[THREE-BASE] Window resize event received:",{timestamp:Date.now(),windowSize:{width:window.innerWidth,height:window.innerHeight},rootRect:e.getBoundingClientRect()}),E(),x.updateLayout()}),{scene:l,camera:g,renderer:o,uiSystem:x,applySize:E}}var k=we(require("three")),Re=class{constructor(t){var n,i;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=(i=t==null?void 0:t.rotation)!=null?i: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)}syncToThree(t){let n=t.position.z,i=n===0||!isFinite(n)?.5:n;t.position.set(this.position.x,this.position.y,i),t.scale.set(this.scale,this.scale,this.scale),t.rotation.z=this.rotation}},Ae=class{constructor(t){var n,i,a,s;this.z_index=(n=t==null?void 0:t.z_index)!=null?n:0,this.alpha=(i=t==null?void 0:t.alpha)!=null?i:1,this.visible=(a=t==null?void 0:t.visible)!=null?a:!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)}syncToThree(t){if(t.renderOrder=this.z_index,t.visible=this.visible,t instanceof k.Mesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n instanceof k.Material&&(n.opacity=this.alpha,n.transparent=this.alpha<1)}):t.material instanceof k.Material&&(t.material.opacity=this.alpha,t.material.transparent=this.alpha<1)),this.tint!==null&&t instanceof k.Mesh&&t.material){let n=typeof this.tint=="string"?new k.Color(this.tint):new k.Color(this.tint);Array.isArray(t.material)?t.material.forEach(i=>{(i instanceof k.MeshBasicMaterial||i instanceof k.MeshStandardMaterial)&&i.color.copy(n)}):(t.material instanceof k.MeshBasicMaterial||t.material instanceof k.MeshStandardMaterial)&&t.material.color.copy(n)}}},Ce=class{constructor(t,n,i,a){this.instanceId=t,this.objectConfig=n,this.threeObject=i,this._config=a,this.transform=new Re(a.transform),this.renderer=new Ae(a.render),this.sync()}sync(){this.transform.syncToThree(this.threeObject),this.renderer.syncToThree(this.threeObject)}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.syncToThree(this.threeObject)}getAlpha(){return this.renderer.alpha}setAlpha(t){this.renderer.alpha=t,this.renderer.syncToThree(this.threeObject)}getVisible(){return this.renderer.visible}setVisible(t){this.renderer.visible=t,this.renderer.syncToThree(this.threeObject)}},Ve=class{constructor(t){this.objects=new Map;this.config=t}create(t,n){let i=this.config.objects.get(t);if(!i)throw new Error(`Object config not found: ${t}`);let a=new Ce(t,i.object_config||t,n,i);return this.objects.set(t,a),a}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[n,i]of this.objects.entries()){let a=t.objects.get(n);a&&i.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var qe={"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 Y(e){let t=qe[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function G(e){var n;let t=qe[e];return t&&(n=t.weight)!=null?n:"400"}function bi(e,t){qe[e]=t}function wi(){return Object.keys(qe)}var ye=we(require("three"));function se(e){return{element:e,get alpha(){return parseFloat(e.style.opacity||"1")},set alpha(t){e.style.opacity=t.toString()},get visible(){return e.style.display!=="none"},set visible(t){e.style.display=t?"":"none"},position:{set(t,n){e.style.left=`${t}px`,e.style.top=`${n}px`},get x(){return parseFloat(e.style.left||"0")},get y(){return parseFloat(e.style.top||"0")}},scale:{set(t,n){e.style.transform=`scale(${t})`},get x(){let t=e.style.transform.match(/scale\(([^)]+)\)/);return t?parseFloat(t[1]):1}}}}function Ei(e,t,n,i){var kt,Ft,Dt,$t,Pt,Wt,zt,Bt,Nt,Ot,jt,It,Yt,Gt,Vt,qt,Xt,Kt,Jt,Zt,Qt,Ut,en,tn,nn,an,sn,on,rn,ln,cn,dn,pn,mn,un,hn,fn,yn,gn,bn,wn,En,xn,_n,Tn,vn,Sn,Rn,An,Cn,Hn,Mn,Ln,kn,Fn,Dn,$n,Pn,Wn,zn,Bn,Nn,On;let a=e.objects.get("ui_endgame_1"),s=e.objects.get("ui_endgame_logo_1"),r=e.objects.get("ui_endgame_title_1"),u=e.objects.get("ui_endgame_subtitle_1"),l=e.objects.get("ui_endgame_footer_1"),m=e.objects.get("ui_endgame_cta_1"),p=e.objects.get("ui_endgame_cta_hint_1"),y=e.objects.get("ui_endgame_hand_1"),f=e.engine.runtime||{},h=((kt=a==null?void 0:a.gameplay)==null?void 0:kt.tuning)||{},g=(a==null?void 0:a.render)||{},o=i.getBoundingClientRect(),E=o.width>0?o.width*.9:320,T=o.height>0?o.height*.85:400,x=Math.min((Ft=h.panel_width)!=null?Ft:320,E),d=Math.min((Dt=h.panel_height)!=null?Dt:400,T),c=($t=h.panel_padding)!=null?$t:32,b=(Pt=h.panel_radius)!=null?Pt:24,_=g.background_color||h.panel_bg_color||"#1a0a0a",S=g.background_alpha!==void 0&&g.background_alpha!==null?g.background_alpha:(Wt=h.panel_bg_alpha)!=null?Wt:.98,C=g.border_color||h.panel_border_color||"#ffffff",F=(zt=h.panel_border_width)!=null?zt:2,R=(Bt=h.panel_border_alpha)!=null?Bt:.3,A=document.createElement("div");A.style.cssText=`
|
|
41
41
|
position: absolute;
|
|
42
42
|
width: ${x}px;
|
|
43
43
|
height: ${d}px;
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
z-index: 1000;
|
|
57
57
|
box-sizing: border-box;
|
|
58
58
|
padding: ${c}px;
|
|
59
|
-
`,i.appendChild(A);let L=se(A);L.element=A;let H=((Nt=s==null?void 0:s.gameplay)==null?void 0:Nt.tuning)||{},ee=(s==null?void 0:s.transform)||{},N=(Ot=H.logo_size)!=null?Ot:56,
|
|
60
|
-
font-family: ${
|
|
59
|
+
`,i.appendChild(A);let L=se(A);L.element=A;let H=((Nt=s==null?void 0:s.gameplay)==null?void 0:Nt.tuning)||{},ee=(s==null?void 0:s.transform)||{},N=(Ot=H.logo_size)!=null?Ot:56,j=(jt=ee.scale)!=null?jt:1,oe=(Yt=(It=ee.offset)==null?void 0:It.y)!=null?Yt:-130,He=(Gt=H.logo_alpha)!=null?Gt:1,Mi=new ye.SpriteMaterial({map:n||void 0,transparent:!0,alphaTest:.1}),I=new ye.Sprite(Mi);I.position.set(0,oe,0),I.material.opacity=0;let Me=0,Le=0;if(n&&(Me=((Vt=n.image)==null?void 0:Vt.width)||100,Le=((qt=n.image)==null?void 0:qt.height)||100),Me>0&&Le>0){let re=Me/Le,it,at;re>1?(it=N,at=N/re):(at=N,it=N*re);let fa=it/Me*j,ya=at/Le*j;I.scale.set(fa,ya,1)}else{let re=N/100*j;I.scale.set(re,re,1)}I.targetAlpha=He,I.baseScaleX=I.scale.x,I.baseScaleY=I.scale.y;let D=r==null?void 0:r.ui,V=((Xt=r==null?void 0:r.gameplay)==null?void 0:Xt.tuning)||{},Li=(D==null?void 0:D.text)||"MISSION ACCOMPLISHED",gt=(D==null?void 0:D.font)||"brand.heading",Ke=(D==null?void 0:D.fontSize)||24,ki=(Kt=D==null?void 0:D.letterSpacing)!=null?Kt:1,ke=(Jt=r==null?void 0:r.render)==null?void 0:Jt.tint,Fi=typeof ke=="string"?ke:ke?`#${ke.toString(16).padStart(6,"0")}`:"#00FF88",Di=x-c*2-30,$i=V.font_weight_override?V.font_weight_override:G(gt),te=document.createElement("div");te.textContent=Li,te.style.cssText=`
|
|
60
|
+
font-family: ${Y(gt)};
|
|
61
61
|
font-size: ${Ke}px;
|
|
62
62
|
font-weight: ${$i};
|
|
63
63
|
color: ${Fi};
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
white-space: nowrap;
|
|
72
72
|
max-width: ${Di}px;
|
|
73
73
|
`;let bt=c+30,Pi=((nn=h.title_offset_y)!=null?nn:bt+Ke/2)+((an=V.animation_start_y_offset)!=null?an:-20);te.style.top=`${Pi}px`,te.style.left="50%";let wt=se(te);wt.element=te,A.appendChild(te);let $=u==null?void 0:u.ui,Et=((sn=u==null?void 0:u.gameplay)==null?void 0:sn.tuning)||{},Wi=($==null?void 0:$.text)||"RESCUE COMPLETE",xt=($==null?void 0:$.font)||"brand.body",Je=($==null?void 0:$.fontSize)||11,zi=(on=$==null?void 0:$.letterSpacing)!=null?on:.5,Fe=(rn=u==null?void 0:u.render)==null?void 0:rn.tint,Bi=typeof Fe=="string"?Fe:Fe?`#${Fe.toString(16).padStart(6,"0")}`:"#B0B0B0",ne=document.createElement("div");ne.textContent=Wi,ne.style.cssText=`
|
|
74
|
-
font-family: ${
|
|
74
|
+
font-family: ${Y(xt)};
|
|
75
75
|
font-size: ${Je}px;
|
|
76
76
|
font-weight: ${G(xt)};
|
|
77
77
|
color: ${Bi};
|
|
@@ -81,17 +81,17 @@
|
|
|
81
81
|
position: absolute;
|
|
82
82
|
transform: translate(-50%, -50%);
|
|
83
83
|
white-space: nowrap;
|
|
84
|
-
`;let _t=bt+Ke+15,Ni=((ln=h.subtitle_offset_y)!=null?ln:_t+Je/2)+((cn=Et.animation_start_y_offset)!=null?cn:-10);ne.style.top=`${Ni}px`,ne.style.left="50%";let Ze=se(ne);Ze.element=ne,Ze.animationStartYOffset=(dn=Et.animation_start_y_offset)!=null?dn:-10,A.appendChild(ne);let q=l==null?void 0:l.ui,Tt=((pn=l==null?void 0:l.gameplay)==null?void 0:pn.tuning)||{},Oi=(q==null?void 0:q.text)||((mn=f.ui)==null?void 0:mn.cta_hint)||"Continue the adventure!",vt=(q==null?void 0:q.font)||"brand.body",St=(q==null?void 0:q.fontSize)||16,De=(un=l==null?void 0:l.render)==null?void 0:un.tint,
|
|
85
|
-
font-family: ${
|
|
84
|
+
`;let _t=bt+Ke+15,Ni=((ln=h.subtitle_offset_y)!=null?ln:_t+Je/2)+((cn=Et.animation_start_y_offset)!=null?cn:-10);ne.style.top=`${Ni}px`,ne.style.left="50%";let Ze=se(ne);Ze.element=ne,Ze.animationStartYOffset=(dn=Et.animation_start_y_offset)!=null?dn:-10,A.appendChild(ne);let q=l==null?void 0:l.ui,Tt=((pn=l==null?void 0:l.gameplay)==null?void 0:pn.tuning)||{},Oi=(q==null?void 0:q.text)||((mn=f.ui)==null?void 0:mn.cta_hint)||"Continue the adventure!",vt=(q==null?void 0:q.font)||"brand.body",St=(q==null?void 0:q.fontSize)||16,De=(un=l==null?void 0:l.render)==null?void 0:un.tint,ji=typeof De=="string"?De:De?`#${De.toString(16).padStart(6,"0")}`:"#FFFFFF",Ii=(hn=Tt.max_width)!=null?hn:x-c*2,Yi=(fn=Tt.line_height)!=null?fn:1.4,ie=document.createElement("div");ie.textContent=Oi,ie.style.cssText=`
|
|
85
|
+
font-family: ${Y(vt)};
|
|
86
86
|
font-size: ${St}px;
|
|
87
87
|
font-weight: ${G(vt)};
|
|
88
|
-
color: ${
|
|
88
|
+
color: ${ji};
|
|
89
89
|
text-align: center;
|
|
90
90
|
opacity: 0;
|
|
91
91
|
position: absolute;
|
|
92
92
|
transform: translate(-50%, -50%);
|
|
93
|
-
max-width: ${
|
|
94
|
-
line-height: ${
|
|
93
|
+
max-width: ${Ii}px;
|
|
94
|
+
line-height: ${Yi};
|
|
95
95
|
word-wrap: break-word;
|
|
96
96
|
`;let Gi=_t+Je+30,Vi=(yn=h.footer_offset_y)!=null?yn:Gi+St/2;ie.style.top=`${Vi}px`,ie.style.left="50%";let Qe=se(ie);Qe.element=ie;let qi=((gn=l==null?void 0:l.render)==null?void 0:gn.alpha)!==void 0&&((bn=l==null?void 0:l.render)==null?void 0:bn.alpha)!==null?l.render.alpha:1;Qe.targetAlpha=qi,A.appendChild(ie);let X=((wn=m==null?void 0:m.gameplay)==null?void 0:wn.tuning)||{},P=m==null?void 0:m.ui,Xi=(En=X.button_width)!=null?En:260,Rt=(xn=X.button_height)!=null?xn:56,Ki=(_n=X.button_radius)!=null?_n:16,Ji=X.button_bg_color||((Tn=f.theme)==null?void 0:Tn.cta_background)||"#ffb43b",Zi=(vn=X.button_bg_alpha)!=null?vn:1,Qi=X.button_border_color||"#ffffff",Ui=(Sn=X.button_border_width)!=null?Sn:2,Va=(Rn=X.button_border_alpha)!=null?Rn:.2,Ue=(An=h.cta_offset_y)!=null?An:d*.7,M=document.createElement("button");M.style.cssText=`
|
|
97
97
|
width: ${Xi}px;
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
position: absolute;
|
|
106
106
|
transform: translate(-50%, -50%);
|
|
107
107
|
box-shadow: inset 0 0 1px rgba(0,0,0,0.15);
|
|
108
|
-
`,M.style.top=`${Ue}px`,M.style.left="50%";let et=se(M);et.element=M,et.addEventListener=M.addEventListener.bind(M),A.appendChild(M);let ea=(P==null?void 0:P.text)||((Cn=f.ui)==null?void 0:Cn.cta_label_end)||"DOWNLOAD",At=(P==null?void 0:P.font)||"brand.heading",ta=(P==null?void 0:P.fontSize)||20,na=X.button_text_color||((Hn=f.theme)==null?void 0:Hn.cta_text)||"#1a0a0a";M.textContent=ea,M.style.fontFamily=
|
|
109
|
-
font-family: ${
|
|
108
|
+
`,M.style.top=`${Ue}px`,M.style.left="50%";let et=se(M);et.element=M,et.addEventListener=M.addEventListener.bind(M),A.appendChild(M);let ea=(P==null?void 0:P.text)||((Cn=f.ui)==null?void 0:Cn.cta_label_end)||"DOWNLOAD",At=(P==null?void 0:P.font)||"brand.heading",ta=(P==null?void 0:P.fontSize)||20,na=X.button_text_color||((Hn=f.theme)==null?void 0:Hn.cta_text)||"#1a0a0a";M.textContent=ea,M.style.fontFamily=Y(At),M.style.fontSize=`${ta}px`,M.style.fontWeight=String(G(At)),M.style.color=na,M.style.letterSpacing=`${(Mn=P==null?void 0:P.letterSpacing)!=null?Mn:1}px`;let Ct=se(M);Ct.element=M;let W=p==null?void 0:p.ui,Ht=((Ln=p==null?void 0:p.gameplay)==null?void 0:Ln.tuning)||{},ia=(W==null?void 0:W.text)||"Play the full game",Mt=(W==null?void 0:W.font)||"brand.body",aa=(W==null?void 0:W.fontSize)||11,sa=(kn=W==null?void 0:W.letterSpacing)!=null?kn:0,$e=(Fn=p==null?void 0:p.render)==null?void 0:Fn.tint,oa=typeof $e=="string"?$e:$e?`#${$e.toString(16).padStart(6,"0")}`:"#CCCCCC",ae=document.createElement("div");ae.textContent=ia,ae.style.cssText=`
|
|
109
|
+
font-family: ${Y(Mt)};
|
|
110
110
|
font-size: ${aa}px;
|
|
111
111
|
font-weight: ${G(Mt)};
|
|
112
112
|
color: ${oa};
|
|
@@ -116,8 +116,8 @@
|
|
|
116
116
|
position: absolute;
|
|
117
117
|
transform: translate(-50%, -50%);
|
|
118
118
|
white-space: nowrap;
|
|
119
|
-
`;let ra=Ue+Rt/2+20,la=d-c-10,ca=Math.min(ra+((Dn=Ht.animation_start_y_offset)!=null?Dn:5),la);ae.style.top=`${ca}px`,ae.style.left="50%";let tt=se(ae);tt.element=ae,tt.animationStartYOffset=($n=Ht.animation_start_y_offset)!=null?$n:5,A.appendChild(ae);let nt=((Pn=y==null?void 0:y.gameplay)==null?void 0:Pn.tuning)||{},da=(Wn=nt.hand_offset_x)!=null?Wn:50,pa=(zn=nt.hand_offset_y)!=null?zn:50,ma=(Nn=(Bn=y==null?void 0:y.transform)==null?void 0:Bn.scale)!=null?Nn:.1875,ua=(On=nt.hand_scale_multiplier)!=null?On:2.5,ha=new ye.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),be=new ye.Sprite(ha),Lt=ma*ua*100;return be.scale.set(Lt,Lt,1),be.position.set(da,Ue+pa,0),be.material.opacity=0,be.visible=!1,{panel:L,logo:
|
|
120
|
-
font-family: ${
|
|
119
|
+
`;let ra=Ue+Rt/2+20,la=d-c-10,ca=Math.min(ra+((Dn=Ht.animation_start_y_offset)!=null?Dn:5),la);ae.style.top=`${ca}px`,ae.style.left="50%";let tt=se(ae);tt.element=ae,tt.animationStartYOffset=($n=Ht.animation_start_y_offset)!=null?$n:5,A.appendChild(ae);let nt=((Pn=y==null?void 0:y.gameplay)==null?void 0:Pn.tuning)||{},da=(Wn=nt.hand_offset_x)!=null?Wn:50,pa=(zn=nt.hand_offset_y)!=null?zn:50,ma=(Nn=(Bn=y==null?void 0:y.transform)==null?void 0:Bn.scale)!=null?Nn:.1875,ua=(On=nt.hand_scale_multiplier)!=null?On:2.5,ha=new ye.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),be=new ye.Sprite(ha),Lt=ma*ua*100;return be.scale.set(Lt,Lt,1),be.position.set(da,Ue+pa,0),be.material.opacity=0,be.visible=!1,{panel:L,logo:I,title:wt,subtitle:Ze,footer:Qe,ctaButton:et,ctaText:Ct,ctaHint:tt,hand:be}}function xi(e,t,n){var _,S,C,F,R,A,L,H;let i=t.objects.get("ui_endgame_1"),a=((_=i==null?void 0:i.gameplay)==null?void 0:_.tuning)||{},s=(S=a.animation_duration_ms)!=null?S:800,r=(C=a.fade_in_duration_ms)!=null?C:600,u=(F=a.scale_animation_intensity)!=null?F:.1,l=(R=a.logo_animation_delay_ms)!=null?R:100,m=(A=a.title_animation_delay_ms)!=null?A:200,p=(L=a.footer_animation_delay_ms)!=null?L:300,y=(H=a.cta_animation_delay_ms)!=null?H:400,{panel:f,logo:h,title:g,subtitle:o,footer:E,ctaButton:T,ctaText:x,ctaHint:d}=e;f.visible=!0,f.element.style.visibility="visible";let c=Date.now(),b=()=>{let ee=Date.now()-c,N=Math.min(ee/r,1),j=1-Math.pow(1-N,3);f.alpha=j,f.element.style.opacity=j.toString();let oe=1+u*(1-j);f.element.style.transform=`translate(-50%, -50%) scale(${oe})`,N<1?requestAnimationFrame(b):(setTimeout(()=>Wa(h,s,t),l),setTimeout(()=>{za(g,s),setTimeout(()=>Ba(o,s),50)},m),setTimeout(()=>Na(E,s),p),setTimeout(()=>{Oa(T,x,s),setTimeout(()=>ja(d,s),50),n&&n()},y))};b()}function Wa(e,t,n){var f,h,g,o,E;let i=n==null?void 0:n.objects.get("ui_endgame_logo_1"),s=(h=(((f=i==null?void 0:i.gameplay)==null?void 0:f.tuning)||{}).animation_start_scale)!=null?h:1.2,r=Date.now(),u=e.material.opacity,l=(g=e.targetAlpha)!=null?g:1,m=(o=e.baseScaleX)!=null?o:e.scale.x,p=(E=e.baseScaleY)!=null?E:e.scale.y,y=()=>{let T=Date.now()-r,x=Math.min(T/t,1),d=1-Math.pow(1-x,2);e.material.opacity=u+(l-u)*d;let c=s+(1-s)*d;e.scale.set(m*c,p*c,1),x<1&&requestAnimationFrame(y)};y()}function za(e,t){let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=()=>{let r=Date.now()-n,u=Math.min(r/t,1),l=1-Math.pow(1-u,2);e.element.style.opacity=(i+(1-i)*l).toString(),e.element.style.top=`${a-20*(1-l)}px`,u<1&&requestAnimationFrame(s)};s()}function Ba(e,t){var u;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=a-((u=e.animationStartYOffset)!=null?u:-10),r=()=>{let l=Date.now()-n,m=Math.min(l/t,1),p=1-Math.pow(1-m,2);e.element.style.opacity=(i+(1-i)*p).toString(),e.element.style.top=`${a+(s-a)*p}px`,m<1&&requestAnimationFrame(r)};r()}function Na(e,t){var r;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=(r=e.targetAlpha)!=null?r:1,s=()=>{let u=Date.now()-n,l=Math.min(u/t,1),m=1-Math.pow(1-l,2);e.element.style.opacity=(i+(a-i)*m).toString(),l<1&&requestAnimationFrame(s)};s()}function Oa(e,t,n){let i=Date.now(),a=parseFloat(e.element.style.opacity||"0"),s=()=>{let r=Date.now()-i,u=Math.min(r/n,1),l=1-Math.pow(1-u,2);e.element.style.opacity=(a+(1-a)*l).toString(),t.element.style.opacity=(a+(1-a)*l).toString(),e.element.style.transform=`translate(-50%, -50%) scale(${1+.1*(1-l)})`,u<1&&requestAnimationFrame(s)};s()}function ja(e,t){var u;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=a-((u=e.animationStartYOffset)!=null?u:5),r=()=>{let l=Date.now()-n,m=Math.min(l/t,1),p=1-Math.pow(1-m,2);e.element.style.opacity=(i+(1-i)*p).toString(),e.element.style.top=`${a+(s-a)*p}px`,m<1&&requestAnimationFrame(r)};r()}function _i(e,t,n,i){var p,y,f,h;let a=n.objects.get("ui_endgame_hand_1"),s=((p=a==null?void 0:a.gameplay)==null?void 0:p.tuning)||{},r=(y=s.click_animation_duration_ms)!=null?y:600,u=(f=s.click_delay_ms)!=null?f:2e3,l=(h=s.click_repeat_delay_ms)!=null?h:3e3,m=()=>{var S,C;e.visible=!0,e.material.opacity=1;let g=e.position.x,o=e.position.y,E=(S=s.hand_offset_x)!=null?S:50,T=(C=s.hand_offset_y)!=null?C:50,x=t.element.getBoundingClientRect(),d=E,c=T,b=Date.now(),_=()=>{var j,oe,He;let F=Date.now()-b,R=Math.min(F/r,1),A=R<.5?2*R*R:1-Math.pow(-2*R+2,2)/2;e.position.set(g+(d-g)*A,o+(c-o)*A,0);let L=(oe=(j=a==null?void 0:a.transform)==null?void 0:j.scale)!=null?oe:.1875,H=(He=s.hand_scale_multiplier)!=null?He:2.5,ee=L*H*100,N=ee+ee*.2*Math.sin(R*Math.PI);e.scale.set(N,N,1),R<1?requestAnimationFrame(_):(t.element.style.transform="translate(-50%, -50%) scale(0.95)",setTimeout(()=>{t.element.style.transform="translate(-50%, -50%) scale(1)",i()},100),setTimeout(()=>{e.material.opacity=0,setTimeout(()=>{e.position.set(g,o,0),m()},l)},500))};_()};setTimeout(m,u)}var Xe=we(require("three"));function Ti(e,t,n){var h,g,o,E,T,x,d;let i=t.objects.get("hand_tutorial_1"),a=((h=i==null?void 0:i.gameplay)==null?void 0:h.tuning)||{},s=(i==null?void 0:i.render)||{},r=(i==null?void 0:i.transform)||{},u=new Xe.SpriteMaterial({map:e||void 0,transparent:!0,alphaTest:.1}),l=new Xe.Sprite(u),m=r.position||{},p=(g=m==null?void 0:m.z)!=null?g:0;l.position.set(n.x+((o=m==null?void 0:m.x)!=null?o:0),n.y+((E=m==null?void 0:m.y)!=null?E:0),p),l.material.opacity=s.alpha!==void 0&&s.alpha!==null?s.alpha:0,l.visible=s.visible!==void 0&&s.visible!==null?s.visible:!1;let y=(T=a.hand_scale_multiplier)!=null?T:2.5,f=(x=r.scale)!=null?x:.1875;return l.scale.set(f*y*100,f*y*100,1),l.renderOrder=(d=s.z_index)!=null?d:99999,l}function vi(e){var g,o,E,T,x,d,c,b,_;let t=e.objects.get("ui_tutorial_1"),n=t==null?void 0:t.ui,i=(t==null?void 0:t.render)||{},a=((g=e.engine.runtime)==null?void 0:g.ui_styles)||{},s=((o=e.engine.runtime)==null?void 0:o.ui)||{},r=(n==null?void 0:n.text)||s.tutorial_label||s.label_text||"CLEAN!",u=(n==null?void 0:n.font)||"brand.warning",l=(n==null?void 0:n.fontSize)||a.label_font_size||52,m=(T=n==null?void 0:n.letterSpacing)!=null?T:(E=a.label_letter_spacing)!=null?E:-1,p=(n==null?void 0:n.align)||"center",y=i.tint,f=typeof y=="string"?y:y?`#${y.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",h=document.createElement("div");return h.textContent=r,h.style.cssText=`
|
|
120
|
+
font-family: ${Y(u)};
|
|
121
121
|
font-size: ${l}px;
|
|
122
122
|
font-weight: ${G(u)};
|
|
123
123
|
color: ${f};
|
package/dist/three/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as dt}from"../chunk-
|
|
1
|
+
import{b as dt}from"../chunk-UVBNGLP3.mjs";import*as D from"three";var tn=(a=>(a[a.PHONE_TALL=0]="PHONE_TALL",a[a.TABLET=1]="TABLET",a[a.LANDSCAPE=2]="LANDSCAPE",a))(tn||{});function Rt(e,t){let n=e/t;return n<=.62?0:n<=.85?1:2}var nt=class{constructor(t,n){this.root=t,this.stage=n,this.uiFrame=document.createElement("div"),this.uiFrame.style.position="absolute",this.uiFrame.style.top="0",this.uiFrame.style.bottom="0",this.uiFrame.style.left="50%",this.uiFrame.style.transform="translateX(-50%)",this.uiFrame.style.width="100%",this.uiFrame.style.maxWidth="420px",this.uiFrame.style.pointerEvents="none",this.stage.appendChild(this.uiFrame),this.uiContainer=document.createElement("div"),this.uiContainer.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","justify-content:flex-start","gap:12px","pointer-events:none","padding:20px 16px","padding-bottom:clamp(24px, 6vh, 96px)","box-sizing:border-box","z-index:2"].join(";")),this.uiFrame.appendChild(this.uiContainer),this.updateLayout()}getUIFrame(){return this.uiFrame}getUIContainer(){return this.uiContainer}updateLayout(){let t=this.stage.getBoundingClientRect(),n=Rt(t.width,t.height);n===0?this.uiFrame.style.maxWidth="420px":n===1?this.uiFrame.style.maxWidth="520px":this.uiFrame.style.maxWidth="640px"}getAspectClass(){let t=this.stage.getBoundingClientRect();return Rt(t.width,t.height)}};async function Vn(e,t={}){let n=()=>{let d=e.getBoundingClientRect(),r=Math.floor(d.width),E=Math.floor(d.height);return(r<=0||!isFinite(r)||r!==r)&&(r=e.clientWidth||window.innerWidth||320),(E<=0||!isFinite(E)||E!==E)&&(E=e.clientHeight||window.innerHeight||480),(r<=0||!isFinite(r)||r!==r)&&(r=320),(E<=0||!isFinite(E)||E!==E)&&(E=480),console.log("[THREE-BASE] getSize result:",{width:r,height:E,boundingRect:{width:d.width,height:d.height},clientSize:{width:e.clientWidth,height:e.clientHeight},styleWidth:e.style.width,styleHeight:e.style.height,note:"Using boundingRect as primary source (actual rendered size)"}),{width:r,height:E}},a=e.style.width&&!e.style.width.includes("%"),i=e.style.height&&!e.style.height.includes("%");e.style.position||(e.style.position="relative"),e.style.display||(e.style.display="block"),e.style.width=e.style.width||"100%",e.style.height=e.style.height||"100%",e.style.minWidth="100%",e.style.minHeight="100%",e.style.maxWidth="100%",e.style.maxHeight="100%",e.style.boxSizing="border-box",e.style.overflow="hidden",e.style.margin="0",e.style.padding="0",e.style.border="none";let s=t.background||"linear-gradient(160deg, #0d1020, #0f1c2f)";e.style.setProperty("background",s,"important"),e.style.setProperty("background-size","cover","important"),e.style.setProperty("background-position","center","important"),e.style.setProperty("background-repeat","no-repeat","important");let l=document.createElement("div");l.style.cssText=`
|
|
2
2
|
position: absolute !important;
|
|
3
3
|
inset: 0 !important;
|
|
4
4
|
width: 100% !important;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "handler-playable-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Handler Playable SDK v0.1 with contract-aligned surface (root sandbox, canonical event envelope).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --minify",
|
|
26
|
+
"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",
|
|
27
|
+
"build:dev": "tsup src/index.ts src/pixi/index.ts src/three/index.ts --format cjs,esm --dts --clean --external lottie-web",
|
|
28
|
+
"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",
|
|
27
29
|
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
28
30
|
"typecheck": "tsc --noEmit",
|
|
29
31
|
"prepublishOnly": "npm run build",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"README.md"
|
|
47
49
|
],
|
|
48
50
|
"peerDependencies": {
|
|
51
|
+
"lottie-web": "^5.0.0",
|
|
49
52
|
"pixi.js": "^8.0.0",
|
|
50
53
|
"three": "^0.160.0"
|
|
51
54
|
},
|
|
@@ -55,12 +58,16 @@
|
|
|
55
58
|
},
|
|
56
59
|
"three": {
|
|
57
60
|
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"lottie-web": {
|
|
63
|
+
"optional": true
|
|
58
64
|
}
|
|
59
65
|
},
|
|
60
66
|
"devDependencies": {
|
|
61
67
|
"@types/three": "^0.160.0",
|
|
62
68
|
"eslint": "^8.57.1",
|
|
63
|
-
"
|
|
69
|
+
"javascript-obfuscator": "^5.1.0",
|
|
70
|
+
"pixi.js": "8.8.1",
|
|
64
71
|
"three": "^0.160.0",
|
|
65
72
|
"ts-node": "^10.9.2",
|
|
66
73
|
"tsup": "^8.4.0",
|
package/dist/chunk-AOCUS265.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var u={};function I(e,t,n=!1){u[e]||(u[e]=[]),u[e].push({fn:t,once:n})}function V(e,t){if(u[e]){if(!t){delete u[e];return}u[e]=u[e].filter(n=>n.fn!==t)}}function P(e,...t){let n=u[e];if(n)for(let i of[...n])i.fn(...t),i.once&&V(e,i.fn)}function a(e,t){I(e,t,!0)}var R={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 s=0,Se=s++,Z=s++,ee=s++,te=s++,ne=s++,ie=s++,oe=s++,re=s++,ae=s++,se=s++,de=s++,le=s++,r=Se;function ce(){return r===Z}function ue(){return r===ee}function pe(){return r===te}function fe(){return r===ne}function g(){return r===ie}function y(){return r===oe}function me(){return r===re}function ge(){return r===ae}function ye(){return r===se}function H(){return r===de}function F(){return r===le}function we(){let e=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none",t=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed";if(e==="mraid")try{mraid.getState(),r=Z;return}catch{}else if(e==="dapi")try{dapi.isReady(),r=ee;return}catch{}if(t==="facebook")try{typeof FbPlayableAd!="undefined"&&(r=te)}catch{}else if(t==="google")try{typeof ExitApi!="undefined"&&(r=ne)}catch{}else if(t==="mintegral")window.gameReady&&(r=ie);else if(t==="tapjoy")window.TJ_API&&(r=oe);else if(t==="tiktok")window.openAppStore&&(r=re);else if(t==="smadex")try{window.smxTracking&&(r=ae)}catch{}else if(t==="snapchat")try{window.ScPlayableAd&&(r=se)}catch{}else t==="vungle"?r=de:(e==="nucleo"||t==="nucleo")&&(r=le)}var Ee={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"},Ce=Math.random().toString(36).slice(2),w=null,A={...Ee},Ae="web_embed",De={},G=!1,E=!1,T=!1,ke=!1,B=1,W=0,z=!1,d=!1,N="",h=Math.floor(window.innerWidth),b=Math.floor(window.innerHeight),K=h>b,l=!1,k=!1,he=!1,be=!1,U=!1,M=null;function _e(){if(w)return w;let e=document.createElement("div");return e.id="handler-root",e.setAttribute("data-handler-root","true"),document.body.appendChild(e),w=e,e}function j(e){switch(e){case"interaction":return"engagement";case"finish":return"complete";case"install":return"cta_click";default:return e}}function Te(e,t){return{event_name:e,ts:Date.now(),session_id:Ce,deployment_id:A.deployment_id,variant_id:A.variant_id,export_profile_id:A.profile_id,instance_id:A.instance_id||"default",env:Ae==="mraid"?"mraid":"web",payload:t}}function o(e,t){let n=j(e),i=Te(n,t);P(n,i),n!==e&&P(e,i)}function O(){M&&(M(h,b),M=null)}function _(e){B=e,o("volume",e)}function v(e){e&&(ke=!0),!T&&(T=!0,o("pause"),_(0))}function S(e){!e&&ke||T&&(T=!1,o("resume"),_(B))}function f(e,t){h=Math.floor(e||window.innerWidth),b=Math.floor(t||window.innerHeight),K=h>b,o("resize",{width:h,height:b})}function Le(){if(ce())try{let e=mraid.getMaxSize();f(e.width,e.height);let t=()=>{mraid.isViewable()&&mraid.getState()!=="hidden"?S():v()};if(mraid.addEventListener("viewableChange",t),mraid.addEventListener("stateChange",t),mraid.addEventListener("sizeChange",()=>{let n=mraid.getMaxSize();f(n.width,n.height)}),mraid.getAudioVolume){let n=mraid.getAudioVolume();_(n?1:0)}if(mraid.addEventListener("audioVolumeChange",n=>{n!==null&&_(n>0?1:0)}),mraid.addEventListener("error",(n,i)=>{console.warn("mraid error:",n,"action:",i)}),z=!0,mraid.isViewable()&&mraid.getState()!=="hidden")l=!0,o("boot"),o("view"),o("ready"),d=!0,O();else{let n=()=>{l=!0,o("boot"),o("view"),o("ready"),d=!0,O()};mraid.addEventListener("ready",n)}}catch(e){console.warn("MRAID hook skipped",e)}}function Ie(){if(ue())try{let e=dapi.getScreenSize();f(e.width,e.height),dapi.addEventListener("viewableChange",n=>{n.isViewable?S():v()}),dapi.addEventListener("adResized",n=>{let i=dapi.getScreenSize();f(n.width||i.width,n.height||i.height)});let t=dapi.getAudioVolume();if(_(t?1:0),dapi.addEventListener("audioVolumeChange",n=>_(n?1:0)),z=!0,dapi.isViewable())l=!0,o("boot"),o("view"),o("ready"),d=!0,O();else{let n=()=>{l=!0,o("boot"),o("view"),o("ready"),d=!0,O()};dapi.addEventListener("ready",n)}}catch(e){console.warn("DAPI hook skipped",e)}}function ve(){let e=()=>{l||document.visibilityState==="visible"&&(document.readyState==="complete"||document.readyState==="interactive")&&(l=!0,o("boot"),o("view"),o("ready"),d=!0,O(),k&&(k=!1,p.start()))};window.addEventListener("resize",()=>f()),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?(S(),e()):v()}),document.readyState==="complete"||document.readyState==="interactive"?e():window.addEventListener("load",e),z=!0}function Pe(){let e=t=>{typeof TouchEvent!="undefined"&&t instanceof TouchEvent&&(he=!0),!(he&&t instanceof MouseEvent)&&(W+=1,o("interaction",W))};document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)}function Re(e){var i,c,x,C,J,D,q,L,$,X,Y,Q;let t=typeof AD_PROTOCOL!="undefined"?AD_PROTOCOL:"none";if((typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed")==="google")try{(i=window.ExitApi)==null||i.exit();return}catch{}if(t==="mraid"&&typeof mraid!="undefined")mraid.open(e||"");else if(t==="dapi"&&typeof dapi!="undefined")dapi.openStoreUrl();else if(y())(x=(c=window.TJ_API)==null?void 0:c.click)==null||x.call(c);else if(pe())(J=(C=window.FbPlayableAd)==null?void 0:C.onCTAClick)==null||J.call(C);else if(ye())(q=(D=window.ScPlayableAd)==null?void 0:D.onCTAClick)==null||q.call(D);else if(ge())try{($=(L=window.smxTracking)==null?void 0:L.redirect)==null||$.call(L)}catch(m){console.warn("Smadex redirect failed",m)}else if(fe()){let m=window.ExitApi;m&&typeof m.exit=="function"?m.exit(e||N||""):e&&window.open(e)}else g()?(X=window.install)==null||X.call(window):me()?(Y=window.openAppStore)==null||Y.call(window):H()?(Q=parent==null?void 0:parent.postMessage)==null||Q.call(parent,"download","*"):e&&window.open(e)}function Me(){let e=typeof AD_NETWORK!="undefined"?AD_NETWORK:"web_embed",t=n=>{if(!n)return;let i=new Image;i.src=n};if(e==="bigabid"){let n=window.BIGABID_BIDTIMEMACROS;if(!n)return;a("view",()=>t(n.mraid_viewable)),a("start",()=>t(n.game_viewable)),a("engagement",()=>t(n.engagement));let i=()=>t(n.complete);a("complete",i),I("engagement",c=>{var x;((x=c==null?void 0:c.payload)==null?void 0:x.count)>3&&i()}),a("cta_click",()=>t(n.click))}else if(e==="inmobi"){let n=window.INMOBI_DSPMACROS;if(!n)return;a("view",()=>t(n.Ad_Load_Start)),a("start",()=>t(n.Ad_Viewable)),a("engagement",()=>t(n.First_Engagement)),a("complete",()=>t(n.Gameplay_Complete)),a("cta_click",()=>t(n.DSP_Click)),a("start",()=>{[5,10,15,20,25,30].forEach(i=>setTimeout(()=>t(n[`Spent_${i}_Seconds`]),i*1e3))})}}function je(){if(!y())return;let e=window.TJ_API;e&&e.setPlayableAPI&&e.setPlayableAPI({skipAd:()=>{try{p.finish()}catch(t){console.warn("Tapjoy skip failed",t)}}})}function xe(){var t,n,i;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),(i=e==null?void 0:e.gameplayFinished)==null||i.call(e)}function Ne(){g()&&(window.mintGameStart=()=>{S(!0),f()},window.mintGameClose=()=>{v(!0)})}function ze(){if(!F())return;let e=window.NUC;!e||!e.trigger||(p.on("cta_click",()=>{var t,n;return(n=(t=e.trigger).convert)==null?void 0:n.call(t,N)}),p.on("complete",()=>{var t,n;return(n=(t=e.trigger).tryAgain)==null?void 0:n.call(t)}))}var p={init(e={},t){if(Ae=e.profile||"web_embed",De=e.consent||{},A={...Ee,...e.ids||{}},w=e.rootEl||w,N=e.destinationUrl||(/android/i.test(navigator.userAgent)?"https://play.google.com/store":"https://www.apple.com/app-store/"),t&&(M=t),o("init"),document.body.oncontextmenu=()=>!1,_e(),Ve(w),we(),Le(),Ie(),!z){if(document.readyState==="complete")ve();else if(!be){be=!0;let n=()=>{ve(),window.removeEventListener("load",n),document.removeEventListener("DOMContentLoaded",n)};window.addEventListener("load",n),document.addEventListener("DOMContentLoaded",n)}}Pe(),Me(),je(),Ne(),ze(),console.log(`%c @handler/playable-sdk %c v${R.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;"),l&&!d&&(o("boot"),o("view"),o("ready"),k&&(k=!1,p.start()),d=!0),d=l},getRoot(){return _e()},get version(){return R.version||"0.0.0"},get maxWidth(){return h},get maxHeight(){return b},get isLandscape(){return K},get isReady(){return d},get isStarted(){return G},get isPaused(){return T},get isFinished(){return E},get volume(){return B},get interactions(){return W},on(e,t){I(j(e),t)},off(e,t){V(j(e),t)},start(){var e,t;if(!G){if(!l){k=!0;return}if(G=!0,o("start"),f(),g())v(),(e=window.gameReady)==null||e.call(window);else if(y()){let n=window.TJ_API;(t=n==null?void 0:n.setPlayableBuild)==null||t.call(n,{orientation:K?"landscape":"portrait",buildID:R.version||"dev"})}}},finish(){var e,t;E||(E=!0,o("complete"),g()?(e=window.gameEnd)==null||e.call(window):H()?(t=parent==null?void 0:parent.postMessage)==null||t.call(parent,"complete","*"):y()&&xe())},install(e){if(!E){E=!0,y()?(xe(),setTimeout(()=>p.install(e),300)):(o("complete"),setTimeout(()=>p.install(e),0));return}U||(U=!0,setTimeout(()=>U=!1,500),o("cta_click"),o("conversion"),Re(e||N))},emit(e,t){let n=j(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 i=Te(n,t);P(n,i)},retry(){var e,t,n;if(g())(e=window.gameRetry)==null||e.call(window);else if(F()){let i=window.NUC;(n=(t=i==null?void 0:i.trigger)==null?void 0:t.tryAgain)==null||n.call(t)}o("engagement",{action:"retry"})},pause(){v(!0)},resume(){S(!0)},resize(e,t){f(e,t)}},Be=p;function Ve(e){let t=document.createElement("script");t.type="text/javascript",t.textContent=`
|
|
2
|
-
(function(){
|
|
3
|
-
var events = ['touchstart','touchend','mousedown','keydown'];
|
|
4
|
-
function unlock(){
|
|
5
|
-
if(window.AudioContext && AudioContext.prototype.resume){
|
|
6
|
-
if(!window.__handler_audio_ctx){
|
|
7
|
-
window.__handler_audio_ctx = new AudioContext();
|
|
8
|
-
}
|
|
9
|
-
if(window.__handler_audio_ctx.state === 'suspended'){
|
|
10
|
-
window.__handler_audio_ctx.resume();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
events.forEach(function(e){ document.removeEventListener(e, unlock); });
|
|
14
|
-
}
|
|
15
|
-
events.forEach(function(e){ document.addEventListener(e, unlock, false); });
|
|
16
|
-
})();
|
|
17
|
-
`,e.appendChild(t)}export{p as a,Be as b};
|