handler-playable-sdk 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- import{b as ot}from"../chunk-5XZYWKIQ.mjs";import*as I from"three";async function $n(e,t={}){let n=()=>{let h=e.style.width||"",u=e.style.height||"",y=320,f=480,_=window.getComputedStyle(e),x=h||_.width,E=u||_.height;if(x&&x!=="auto"&&!x.includes("%")){let T=parseFloat(x);!isNaN(T)&&T>0&&isFinite(T)&&(y=T)}if(E&&E!=="auto"&&!E.includes("%")){let T=parseFloat(E);!isNaN(T)&&T>0&&isFinite(T)&&(f=T)}let S=e.clientWidth,w=e.clientHeight;if((y===320||y<=0||!isFinite(y))&&S&&S>0&&(y=S),(f===480||f<=0||!isFinite(f))&&w&&w>0&&(f=w),y<=0||f<=0||!isFinite(y)||!isFinite(f)){let T=e.getBoundingClientRect();T.width>0&&isFinite(T.width)&&(y=T.width),T.height>0&&isFinite(T.height)&&(f=T.height)}return(y<=0||!isFinite(y))&&(y=e.clientWidth||window.innerWidth||320),(f<=0||!isFinite(f))&&(f=e.clientHeight||window.innerHeight||480),console.log("[THREE-BASE] getSize result:",{width:y,height:f,styleWidth:h,styleHeight:u,effectiveWidth:x,effectiveHeight:E,computedWidth:_.width,computedHeight:_.height,clientWidth:S,clientHeight:w,boundingRect:e.getBoundingClientRect()}),{width:y,height:f}},i=e.style.width&&!e.style.width.includes("%"),a=e.style.height&&!e.style.height.includes("%");e.style.position=e.style.position||"relative",e.style.display=e.style.display||"flex",e.style.flexDirection=e.style.flexDirection||"column",e.style.alignItems=e.style.alignItems||"stretch",e.style.width=e.style.width||"100%",e.style.height=e.style.height||"100dvh",e.style.minHeight=e.style.minHeight||"100vh",e.style.maxWidth=e.style.maxWidth||"100%",e.style.maxHeight=e.style.maxHeight||"100%",e.style.boxSizing=e.style.boxSizing||"border-box",e.style.overflow=e.style.overflow||"hidden",t.background&&(e.style.background=t.background);let s=document.createElement("div");s.setAttribute("style",["position:relative","width:100%","height:100%","display:flex","align-items:center","justify-content:center",`background:${t.background||"transparent"}`,"color:var(--h-text, #f4f6ff)",'font-family:var(--h-font-main, "Inter", "Helvetica Neue", Arial, sans-serif)',"box-sizing:border-box"].join(";")),e.appendChild(s);let o=document.createElement("div");o.setAttribute("style",["position:absolute","inset:0","width:100%","height:100%","pointer-events:auto"].join(";")),s.appendChild(o);let l=new I.Scene,{width:d,height:m}=n(),r=new I.OrthographicCamera(-d/2,d/2,m/2,-m/2,.1,1e3);r.position.set(0,0,1),r.lookAt(0,0,0),r.updateMatrixWorld();let c=new I.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});c.setPixelRatio(window.devicePixelRatio||1),c.setSize(d,m),c.setClearColor(0,0),c.domElement.style.position="absolute",c.domElement.style.top="0",c.domElement.style.left="0",c.domElement.style.width="100%",c.domElement.style.height="100%",c.domElement.style.display="block",c.domElement.style.pointerEvents="auto",o.appendChild(c.domElement);let p=h=>{let u,y;if(typeof(h==null?void 0:h.width)=="number"&&h.width>0?u=h.width:u=n().width,typeof(h==null?void 0:h.height)=="number"&&h.height>0?y=h.height:y=n().height,u<=0||y<=0||!isFinite(u)||!isFinite(y)){console.warn("[THREE-BASE] Invalid size in applySize, using getSize fallback",{newWidth:u,newHeight:y,size:h});let f=n();u=f.width,y=f.height}console.log("[THREE-BASE] applySize:",{newWidth:u,newHeight:y,providedSize:h,containerSize:n()}),c.setSize(u,y),c.setPixelRatio(window.devicePixelRatio||1),r.left=-u/2,r.right=u/2,r.top=y/2,r.bottom=-y/2,r.updateProjectionMatrix()};requestAnimationFrame(()=>p());let g=!1;ot.on("pause",()=>{g=!0,document.querySelectorAll("audio").forEach(u=>u.pause())}),ot.on("resume",()=>{g=!1,document.querySelectorAll("audio").forEach(u=>{u.currentTime>0&&!u.ended&&u.play().catch(()=>{})})}),ot.on("resize",({payload:h})=>{p({width:h==null?void 0:h.width,height:h==null?void 0:h.height})}),window.addEventListener("resize",()=>p());let b=document.createElement("div");return b.setAttribute("style",["position:absolute","inset:0","display:flex","flex-direction:column","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(";")),s.appendChild(b),{scene:l,camera:r,renderer:c,overlay:b,applySize:p}}import*as v from"three";var rt=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}},lt=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 v.Mesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n instanceof v.Material&&(n.opacity=this.alpha,n.transparent=this.alpha<1)}):t.material instanceof v.Material&&(t.material.opacity=this.alpha,t.material.transparent=this.alpha<1)),this.tint!==null&&t instanceof v.Mesh&&t.material){let n=typeof this.tint=="string"?new v.Color(this.tint):new v.Color(this.tint);Array.isArray(t.material)?t.material.forEach(i=>{(i instanceof v.MeshBasicMaterial||i instanceof v.MeshStandardMaterial)&&i.color.copy(n)}):(t.material instanceof v.MeshBasicMaterial||t.material instanceof v.MeshStandardMaterial)&&t.material.color.copy(n)}}},ct=class{constructor(t,n,i,a){this.instanceId=t,this.objectConfig=n,this.threeObject=i,this._config=a,this.transform=new rt(a.transform),this.renderer=new lt(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)}},Tt=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 ct(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 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 N(e){let t=pt[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=pt[e];return t&&(n=t.weight)!=null?n:"400"}function An(e,t){pt[e]=t}function Ln(){return Object.keys(pt)}import*as U from"three";function Q(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 Dn(e,t,n){var Lt,Dt,Wt,kt,zt,Bt,Yt,Pt,Nt,Gt,Xt,qt,Vt,Zt,Jt,Kt,Qt,jt,Ot,It,Ut,te,ee,ne,ae,se,ie,oe,re,le,ce,pe,de,me,he,ue,ye,fe,ge,be,Te,xe,_e,Ee,we,Se,He,ve,Re,Ce,Me,Fe,$e,Ae,Le,De,We,ke,ze,Be,Ye,Pe;let i=e.objects.get("ui_endgame_1"),a=e.objects.get("ui_endgame_logo_1"),s=e.objects.get("ui_endgame_title_1"),o=e.objects.get("ui_endgame_subtitle_1"),l=e.objects.get("ui_endgame_footer_1"),d=e.objects.get("ui_endgame_cta_1"),m=e.objects.get("ui_endgame_cta_hint_1"),r=e.objects.get("ui_endgame_hand_1"),c=e.engine.runtime||{},p=((Lt=i==null?void 0:i.gameplay)==null?void 0:Lt.tuning)||{},g=(i==null?void 0:i.render)||{},b=(Dt=p.panel_width)!=null?Dt:320,h=(Wt=p.panel_height)!=null?Wt:400,u=(kt=p.panel_padding)!=null?kt:32,y=(zt=p.panel_radius)!=null?zt:24,f=g.background_color||p.panel_bg_color||"#1a0a0a",_=g.background_alpha!==void 0&&g.background_alpha!==null?g.background_alpha:(Bt=p.panel_bg_alpha)!=null?Bt:.98,x=g.border_color||p.panel_border_color||"#ffffff",E=(Yt=p.panel_border_width)!=null?Yt:2,S=(Pt=p.panel_border_alpha)!=null?Pt:.3,w=document.createElement("div");w.style.cssText=`
1
+ import{b as lt}from"../chunk-CK2F3FW4.mjs";import*as O from"three";var qe=(s=>(s[s.PHONE_TALL=0]="PHONE_TALL",s[s.TABLET=1]="TABLET",s[s.LANDSCAPE=2]="LANDSCAPE",s))(qe||{});function Et(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=Et(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 Et(t.width,t.height)}};async function Dn(e,t={}){let n=()=>{let p=e.style.width||"",f=e.style.height||"",h=320,g=480,E=window.getComputedStyle(e),x=p||E.width,_=f||E.height;if(x&&x!=="auto"&&!x.includes("%")){let T=parseFloat(x);!isNaN(T)&&T>0&&isFinite(T)&&(h=T)}if(_&&_!=="auto"&&!_.includes("%")){let T=parseFloat(_);!isNaN(T)&&T>0&&isFinite(T)&&(g=T)}let w=e.clientWidth,S=e.clientHeight;if((h===320||h<=0||!isFinite(h))&&w&&w>0&&(h=w),(g===480||g<=0||!isFinite(g))&&S&&S>0&&(g=S),h<=0||g<=0||!isFinite(h)||!isFinite(g)){let T=e.getBoundingClientRect();T.width>0&&isFinite(T.width)&&(h=T.width),T.height>0&&isFinite(T.height)&&(g=T.height)}return(h<=0||!isFinite(h))&&(h=e.clientWidth||window.innerWidth||320),(g<=0||!isFinite(g))&&(g=e.clientHeight||window.innerHeight||480),console.log("[THREE-BASE] getSize result:",{width:h,height:g,styleWidth:p,styleHeight:f,effectiveWidth:x,effectiveHeight:_,computedWidth:E.width,computedHeight:E.height,clientWidth:w,clientHeight:S,boundingRect:e.getBoundingClientRect()}),{width:h,height:g}},s=e.style.width&&!e.style.width.includes("%"),a=e.style.height&&!e.style.height.includes("%");e.style.position=e.style.position||"relative",e.style.display=e.style.display||"flex",e.style.flexDirection=e.style.flexDirection||"column",e.style.alignItems=e.style.alignItems||"stretch",e.style.width=e.style.width||"100%",e.style.height=e.style.height||"100dvh",e.style.minHeight=e.style.minHeight||"100vh",e.style.maxWidth=e.style.maxWidth||"100%",e.style.maxHeight=e.style.maxHeight||"100%",e.style.boxSizing=e.style.boxSizing||"border-box",e.style.overflow=e.style.overflow||"hidden",t.background&&(e.style.background=t.background);let i=document.createElement("div");i.setAttribute("style",["position:relative","width:100%","height:100%","display:flex","align-items:center","justify-content:center",`background:${t.background||"transparent"}`,"color:var(--h-text, #f4f6ff)",'font-family:var(--h-font-main, "Inter", "Helvetica Neue", Arial, sans-serif)',"box-sizing:border-box"].join(";")),e.appendChild(i);let o=document.createElement("div");o.setAttribute("style",["position:absolute","inset:0","width:100%","height:100%","pointer-events:auto"].join(";")),i.appendChild(o);let m=new O.Scene,{width:r,height:u}=n(),l=new O.PerspectiveCamera(55,r/u,.1,100);l.position.set(0,0,3.2),l.lookAt(0,0,0),l.updateMatrixWorld();let c=new O.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});c.setPixelRatio(window.devicePixelRatio||1),c.setSize(r,u),c.setClearColor(0,0),c.domElement.style.position="absolute",c.domElement.style.top="0",c.domElement.style.left="0",c.domElement.style.width="100%",c.domElement.style.height="100%",c.domElement.style.display="block",c.domElement.style.pointerEvents="auto",o.appendChild(c.domElement);let y=p=>{let f,h;if(typeof(p==null?void 0:p.width)=="number"&&p.width>0?f=p.width:f=n().width,typeof(p==null?void 0:p.height)=="number"&&p.height>0?h=p.height:h=n().height,f<=0||h<=0||!isFinite(f)||!isFinite(h)){console.warn("[THREE-BASE] Invalid size in applySize, using getSize fallback",{newWidth:f,newHeight:h,size:p});let g=n();f=g.width,h=g.height}console.log("[THREE-BASE] applySize:",{newWidth:f,newHeight:h,providedSize:p,containerSize:n()}),c.setSize(f,h),c.setPixelRatio(window.devicePixelRatio||1),l.aspect=f/h,l.updateProjectionMatrix()};requestAnimationFrame(()=>y());let d=!1;lt.on("pause",()=>{d=!0,document.querySelectorAll("audio").forEach(f=>f.pause())}),lt.on("resume",()=>{d=!1,document.querySelectorAll("audio").forEach(f=>{f.currentTime>0&&!f.ended&&f.play().catch(()=>{})})});let b=new nt(e,i);return lt.on("resize",({payload:p})=>{y({width:p==null?void 0:p.width,height:p==null?void 0:p.height}),b.updateLayout()}),window.addEventListener("resize",()=>{y(),b.updateLayout()}),{scene:m,camera:l,renderer:c,uiSystem:b,applySize:y}}import*as v from"three";var ct=class{constructor(t){var n,s;this.position=(t==null?void 0:t.position)||{x:0,y:0},this.scale=(n=t==null?void 0:t.scale)!=null?n:1,this.rotation=(s=t==null?void 0:t.rotation)!=null?s:0}update(t){t.position!==void 0&&(this.position={...t.position}),t.scale!==void 0&&(this.scale=t.scale),t.rotation!==void 0&&(this.rotation=t.rotation)}syncToThree(t){let n=t.position.z,s=n===0||!isFinite(n)?.5:n;t.position.set(this.position.x,this.position.y,s),t.scale.set(this.scale,this.scale,this.scale),t.rotation.z=this.rotation}},pt=class{constructor(t){var n,s,a,i;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=(a=t==null?void 0:t.visible)!=null?a:!0,this.tint=(i=t==null?void 0:t.tint)!=null?i: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 v.Mesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n instanceof v.Material&&(n.opacity=this.alpha,n.transparent=this.alpha<1)}):t.material instanceof v.Material&&(t.material.opacity=this.alpha,t.material.transparent=this.alpha<1)),this.tint!==null&&t instanceof v.Mesh&&t.material){let n=typeof this.tint=="string"?new v.Color(this.tint):new v.Color(this.tint);Array.isArray(t.material)?t.material.forEach(s=>{(s instanceof v.MeshBasicMaterial||s instanceof v.MeshStandardMaterial)&&s.color.copy(n)}):(t.material instanceof v.MeshBasicMaterial||t.material instanceof v.MeshStandardMaterial)&&t.material.color.copy(n)}}},mt=class{constructor(t,n,s,a){this.instanceId=t,this.objectConfig=n,this.threeObject=s,this._config=a,this.transform=new ct(a.transform),this.renderer=new pt(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)}},_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 a=new mt(t,s.object_config||t,n,s);return this.objects.set(t,a),a}get(t){return this.objects.get(t)}updateConfig(t){this.config=t;for(let[n,s]of this.objects.entries()){let a=t.objects.get(n);a&&s.updateConfig(a)}}getAll(){return Array.from(this.objects.values())}remove(t){this.objects.delete(t)}clear(){this.objects.clear()}};var dt={"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=dt[e];return t?t.family:(console.warn(`Font ID "${e}" not found in registry, using fallback`),"Arial, sans-serif")}function N(e){var n;let t=dt[e];return t&&(n=t.weight)!=null?n:"400"}function zn(e,t){dt[e]=t}function kn(){return Object.keys(dt)}import*as U from"three";function Q(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 Bn(e,t,n,s){var zt,kt,Bt,Pt,Yt,Nt,Gt,Xt,qt,Vt,Zt,Jt,Kt,Qt,jt,It,Ot,Ut,te,ee,ne,ae,se,ie,oe,re,le,ce,pe,me,de,ue,he,ye,fe,ge,Te,be,xe,Ee,_e,we,Se,He,ve,Ce,Re,Fe,Me,Ae,$e,Le,We,De,ze,ke,Be,Pe,Ye,Ne,Ge,Xe;let a=e.objects.get("ui_endgame_1"),i=e.objects.get("ui_endgame_logo_1"),o=e.objects.get("ui_endgame_title_1"),m=e.objects.get("ui_endgame_subtitle_1"),r=e.objects.get("ui_endgame_footer_1"),u=e.objects.get("ui_endgame_cta_1"),l=e.objects.get("ui_endgame_cta_hint_1"),c=e.objects.get("ui_endgame_hand_1"),y=e.engine.runtime||{},d=((zt=a==null?void 0:a.gameplay)==null?void 0:zt.tuning)||{},b=(a==null?void 0:a.render)||{},p=(kt=d.panel_width)!=null?kt:320,f=(Bt=d.panel_height)!=null?Bt:400,h=(Pt=d.panel_padding)!=null?Pt:32,g=(Yt=d.panel_radius)!=null?Yt:24,E=b.background_color||d.panel_bg_color||"#1a0a0a",x=b.background_alpha!==void 0&&b.background_alpha!==null?b.background_alpha:(Nt=d.panel_bg_alpha)!=null?Nt:.98,_=b.border_color||d.panel_border_color||"#ffffff",w=(Gt=d.panel_border_width)!=null?Gt:2,S=(Xt=d.panel_border_alpha)!=null?Xt:.3,T=document.createElement("div");T.style.cssText=`
2
2
  position: absolute;
3
- width: ${b}px;
4
- height: ${h}px;
5
- background: ${f};
6
- opacity: ${_};
7
- border: ${E}px solid ${x};
3
+ width: ${p}px;
4
+ height: ${f}px;
5
+ background: ${E};
6
+ opacity: ${x};
7
+ border: ${w}px solid ${_};
8
8
  border-opacity: ${S};
9
- border-radius: ${y}px;
9
+ border-radius: ${g}px;
10
10
  display: flex;
11
11
  flex-direction: column;
12
12
  align-items: center;
@@ -15,79 +15,82 @@ import{b as ot}from"../chunk-5XZYWKIQ.mjs";import*as I from"three";async functio
15
15
  opacity: 0;
16
16
  visibility: hidden;
17
17
  pointer-events: auto;
18
- `;let T=Q(w);T.element=w;let W=((Nt=a==null?void 0:a.gameplay)==null?void 0:Nt.tuning)||{},R=(a==null?void 0:a.transform)||{},M=(Gt=W.logo_size)!=null?Gt:56,D=(Xt=R.scale)!=null?Xt:1,k=(Vt=(qt=R.offset)==null?void 0:qt.y)!=null?Vt:-130,j=(Zt=W.logo_alpha)!=null?Zt:1,X=new U.SpriteMaterial({map:n||void 0,transparent:!0,alphaTest:.1}),H=new U.Sprite(X);H.position.set(0,k,0),H.material.opacity=0;let z=0,q=0;if(n&&(z=((Jt=n.image)==null?void 0:Jt.width)||100,q=((Kt=n.image)==null?void 0:Kt.height)||100),z>0&&q>0){let O=z/q,gt,bt;O>1?(gt=M,bt=M/O):(bt=M,gt=M*O);let Mn=gt/z*D,Fn=bt/q*D;H.scale.set(Mn,Fn,1)}else{let O=M/100*D;H.scale.set(O,O,1)}H.targetAlpha=j,H.baseScaleX=H.scale.x,H.baseScaleY=H.scale.y;let F=s==null?void 0:s.ui,B=((Qt=s==null?void 0:s.gameplay)==null?void 0:Qt.tuning)||{},Xe=(F==null?void 0:F.text)||"MISSION ACCOMPLISHED",xt=(F==null?void 0:F.font)||"brand.heading",qe=(F==null?void 0:F.fontSize)||24,Ve=(jt=F==null?void 0:F.letterSpacing)!=null?jt:1,nt=(Ot=s==null?void 0:s.render)==null?void 0:Ot.tint,Ze=typeof nt=="string"?nt:nt?`#${nt.toString(16).padStart(6,"0")}`:"#00FF88",Je=b-u*2-30,Ke=B.font_weight_override?B.font_weight_override:G(xt),V=document.createElement("div");V.textContent=Xe,V.style.cssText=`
19
- font-family: ${N(xt)};
20
- font-size: ${qe}px;
21
- font-weight: ${Ke};
22
- color: ${Ze};
18
+ left: 50%;
19
+ top: 50%;
20
+ z-index: 1000;
21
+ `,s.appendChild(T);let z=Q(T);z.element=T;let C=((qt=i==null?void 0:i.gameplay)==null?void 0:qt.tuning)||{},D=(i==null?void 0:i.transform)||{},F=(Vt=C.logo_size)!=null?Vt:56,W=(Zt=D.scale)!=null?Zt:1,j=(Kt=(Jt=D.offset)==null?void 0:Jt.y)!=null?Kt:-130,X=(Qt=C.logo_alpha)!=null?Qt:1,G=new U.SpriteMaterial({map:n||void 0,transparent:!0,alphaTest:.1}),H=new U.Sprite(G);H.position.set(0,j,0),H.material.opacity=0;let q=0,at=0;if(n&&(q=((jt=n.image)==null?void 0:jt.width)||100,at=((It=n.image)==null?void 0:It.height)||100),q>0&&at>0){let I=q/at,bt,xt;I>1?(bt=F,xt=F/I):(xt=F,bt=F*I);let Ln=bt/q*W,Wn=xt/at*W;H.scale.set(Ln,Wn,1)}else{let I=F/100*W;H.scale.set(I,I,1)}H.targetAlpha=X,H.baseScaleX=H.scale.x,H.baseScaleY=H.scale.y;let M=o==null?void 0:o.ui,k=((Ot=o==null?void 0:o.gameplay)==null?void 0:Ot.tuning)||{},Je=(M==null?void 0:M.text)||"MISSION ACCOMPLISHED",wt=(M==null?void 0:M.font)||"brand.heading",Ke=(M==null?void 0:M.fontSize)||24,Qe=(Ut=M==null?void 0:M.letterSpacing)!=null?Ut:1,st=(te=o==null?void 0:o.render)==null?void 0:te.tint,je=typeof st=="string"?st:st?`#${st.toString(16).padStart(6,"0")}`:"#00FF88",Ie=p-h*2-30,Oe=k.font_weight_override?k.font_weight_override:N(wt),V=document.createElement("div");V.textContent=Je,V.style.cssText=`
22
+ font-family: ${Y(wt)};
23
+ font-size: ${Ke}px;
24
+ font-weight: ${Oe};
25
+ color: ${je};
23
26
  text-align: center;
24
- letter-spacing: ${Ve}px;
25
- -webkit-text-stroke: ${(It=B.stroke_width)!=null?It:2}px ${B.stroke_color||"#000000"};
26
- text-shadow: ${(Ut=B.shadow_distance)!=null?Ut:4}px ${(te=B.shadow_distance)!=null?te:4}px ${(ee=B.shadow_blur)!=null?ee:8}px rgba(0,0,0,${(ne=B.shadow_alpha)!=null?ne:.9});
27
+ letter-spacing: ${Qe}px;
28
+ -webkit-text-stroke: ${(ee=k.stroke_width)!=null?ee:2}px ${k.stroke_color||"#000000"};
29
+ text-shadow: ${(ne=k.shadow_distance)!=null?ne:4}px ${(ae=k.shadow_distance)!=null?ae:4}px ${(se=k.shadow_blur)!=null?se:8}px rgba(0,0,0,${(ie=k.shadow_alpha)!=null?ie:.9});
27
30
  opacity: 0;
28
31
  position: absolute;
29
32
  transform: translate(-50%, -50%);
30
33
  white-space: nowrap;
31
- max-width: ${Je}px;
32
- `;let _t=(ae=p.title_offset_y)!=null?ae:30,Qe=_t+((se=B.animation_start_y_offset)!=null?se:-20);V.style.top=`${Qe}px`,V.style.left="50%";let Et=Q(V);Et.element=V,w.appendChild(V);let $=o==null?void 0:o.ui,wt=((ie=o==null?void 0:o.gameplay)==null?void 0:ie.tuning)||{},je=($==null?void 0:$.text)||"RESCUE COMPLETE",St=($==null?void 0:$.font)||"brand.body",Oe=($==null?void 0:$.fontSize)||11,Ie=(oe=$==null?void 0:$.letterSpacing)!=null?oe:.5,at=(re=o==null?void 0:o.render)==null?void 0:re.tint,Ue=typeof at=="string"?at:at?`#${at.toString(16).padStart(6,"0")}`:"#B0B0B0",Z=document.createElement("div");Z.textContent=je,Z.style.cssText=`
33
- font-family: ${N(St)};
34
- font-size: ${Oe}px;
35
- font-weight: ${G(St)};
36
- color: ${Ue};
34
+ max-width: ${Ie}px;
35
+ `;let St=(oe=d.title_offset_y)!=null?oe:30,Ue=St+((re=k.animation_start_y_offset)!=null?re:-20);V.style.top=`${Ue}px`,V.style.left="50%";let Ht=Q(V);Ht.element=V,T.appendChild(V);let A=m==null?void 0:m.ui,vt=((le=m==null?void 0:m.gameplay)==null?void 0:le.tuning)||{},tn=(A==null?void 0:A.text)||"RESCUE COMPLETE",Ct=(A==null?void 0:A.font)||"brand.body",en=(A==null?void 0:A.fontSize)||11,nn=(ce=A==null?void 0:A.letterSpacing)!=null?ce:.5,it=(pe=m==null?void 0:m.render)==null?void 0:pe.tint,an=typeof it=="string"?it:it?`#${it.toString(16).padStart(6,"0")}`:"#B0B0B0",Z=document.createElement("div");Z.textContent=tn,Z.style.cssText=`
36
+ font-family: ${Y(Ct)};
37
+ font-size: ${en}px;
38
+ font-weight: ${N(Ct)};
39
+ color: ${an};
37
40
  text-align: center;
38
- letter-spacing: ${Ie}px;
41
+ letter-spacing: ${nn}px;
39
42
  opacity: 0;
40
43
  position: absolute;
41
44
  transform: translate(-50%, -50%);
42
45
  white-space: nowrap;
43
- `;let tn=_t+20+((le=wt.animation_start_y_offset)!=null?le:-10);Z.style.top=`${tn}px`,Z.style.left="50%";let mt=Q(Z);mt.element=Z,mt.animationStartYOffset=(ce=wt.animation_start_y_offset)!=null?ce:-10,w.appendChild(Z);let Y=l==null?void 0:l.ui,Ht=((pe=l==null?void 0:l.gameplay)==null?void 0:pe.tuning)||{},en=(Y==null?void 0:Y.text)||((de=c.ui)==null?void 0:de.cta_hint)||"Continue the adventure!",vt=(Y==null?void 0:Y.font)||"brand.body",nn=(Y==null?void 0:Y.fontSize)||16,st=(me=l==null?void 0:l.render)==null?void 0:me.tint,an=typeof st=="string"?st:st?`#${st.toString(16).padStart(6,"0")}`:"#FFFFFF",sn=(he=Ht.max_width)!=null?he:b-u*2,on=(ue=Ht.line_height)!=null?ue:1.4,J=document.createElement("div");J.textContent=en,J.style.cssText=`
44
- font-family: ${N(vt)};
45
- font-size: ${nn}px;
46
- font-weight: ${G(vt)};
47
- color: ${an};
46
+ `;let sn=St+20+((me=vt.animation_start_y_offset)!=null?me:-10);Z.style.top=`${sn}px`,Z.style.left="50%";let ht=Q(Z);ht.element=Z,ht.animationStartYOffset=(de=vt.animation_start_y_offset)!=null?de:-10,T.appendChild(Z);let B=r==null?void 0:r.ui,Rt=((ue=r==null?void 0:r.gameplay)==null?void 0:ue.tuning)||{},on=(B==null?void 0:B.text)||((he=y.ui)==null?void 0:he.cta_hint)||"Continue the adventure!",Ft=(B==null?void 0:B.font)||"brand.body",rn=(B==null?void 0:B.fontSize)||16,ot=(ye=r==null?void 0:r.render)==null?void 0:ye.tint,ln=typeof ot=="string"?ot:ot?`#${ot.toString(16).padStart(6,"0")}`:"#FFFFFF",cn=(fe=Rt.max_width)!=null?fe:p-h*2,pn=(ge=Rt.line_height)!=null?ge:1.4,J=document.createElement("div");J.textContent=on,J.style.cssText=`
47
+ font-family: ${Y(Ft)};
48
+ font-size: ${rn}px;
49
+ font-weight: ${N(Ft)};
50
+ color: ${ln};
48
51
  text-align: center;
49
52
  opacity: 0;
50
53
  position: absolute;
51
54
  transform: translate(-50%, -50%);
52
- max-width: ${sn}px;
53
- line-height: ${on};
55
+ max-width: ${cn}px;
56
+ line-height: ${pn};
54
57
  word-wrap: break-word;
55
- `;let rn=(ye=p.footer_offset_y)!=null?ye:120;J.style.top=`${rn}px`,J.style.left="50%";let ht=Q(J);ht.element=J;let ln=((fe=l==null?void 0:l.render)==null?void 0:fe.alpha)!==void 0&&((ge=l==null?void 0:l.render)==null?void 0:ge.alpha)!==null?l.render.alpha:1;ht.targetAlpha=ln,w.appendChild(J);let P=((be=d==null?void 0:d.gameplay)==null?void 0:be.tuning)||{},A=d==null?void 0:d.ui,cn=(Te=P.button_width)!=null?Te:260,pn=(xe=P.button_height)!=null?xe:56,dn=(_e=P.button_radius)!=null?_e:16,mn=P.button_bg_color||((Ee=c.theme)==null?void 0:Ee.cta_background)||"#ffb43b",hn=(we=P.button_bg_alpha)!=null?we:1,un=P.button_border_color||"#ffffff",yn=(Se=P.button_border_width)!=null?Se:2,Qn=(He=P.button_border_alpha)!=null?He:.2,ut=(ve=p.cta_offset_y)!=null?ve:160,C=document.createElement("button");C.style.cssText=`
56
- width: ${cn}px;
57
- height: ${pn}px;
58
- background: ${mn};
59
- opacity: ${hn};
60
- border: ${yn}px solid ${un};
61
- border-radius: ${dn}px;
58
+ `;let mn=(Te=d.footer_offset_y)!=null?Te:120;J.style.top=`${mn}px`,J.style.left="50%";let yt=Q(J);yt.element=J;let dn=((be=r==null?void 0:r.render)==null?void 0:be.alpha)!==void 0&&((xe=r==null?void 0:r.render)==null?void 0:xe.alpha)!==null?r.render.alpha:1;yt.targetAlpha=dn,T.appendChild(J);let P=((Ee=u==null?void 0:u.gameplay)==null?void 0:Ee.tuning)||{},$=u==null?void 0:u.ui,un=(_e=P.button_width)!=null?_e:260,hn=(we=P.button_height)!=null?we:56,yn=(Se=P.button_radius)!=null?Se:16,fn=P.button_bg_color||((He=y.theme)==null?void 0:He.cta_background)||"#ffb43b",gn=(ve=P.button_bg_alpha)!=null?ve:1,Tn=P.button_border_color||"#ffffff",bn=(Ce=P.button_border_width)!=null?Ce:2,Un=(Re=P.button_border_alpha)!=null?Re:.2,ft=(Fe=d.cta_offset_y)!=null?Fe:160,R=document.createElement("button");R.style.cssText=`
59
+ width: ${un}px;
60
+ height: ${hn}px;
61
+ background: ${fn};
62
+ opacity: ${gn};
63
+ border: ${bn}px solid ${Tn};
64
+ border-radius: ${yn}px;
62
65
  cursor: pointer;
63
66
  opacity: 0;
64
67
  position: absolute;
65
68
  transform: translate(-50%, -50%);
66
69
  box-shadow: inset 0 0 1px rgba(0,0,0,0.15);
67
- `,C.style.top=`${ut}px`,C.style.left="50%";let Rt=Q(C);Rt.element=C,w.appendChild(C);let fn=(A==null?void 0:A.text)||((Re=c.ui)==null?void 0:Re.cta_label_end)||"DOWNLOAD",Ct=(A==null?void 0:A.font)||"brand.heading",gn=(A==null?void 0:A.fontSize)||20,bn=P.button_text_color||((Ce=c.theme)==null?void 0:Ce.cta_text)||"#1a0a0a";C.textContent=fn,C.style.fontFamily=N(Ct),C.style.fontSize=`${gn}px`,C.style.fontWeight=String(G(Ct)),C.style.color=bn,C.style.letterSpacing=`${(Me=A==null?void 0:A.letterSpacing)!=null?Me:1}px`;let Mt=Q(C);Mt.element=C;let L=m==null?void 0:m.ui,Ft=((Fe=m==null?void 0:m.gameplay)==null?void 0:Fe.tuning)||{},Tn=(L==null?void 0:L.text)||"Play the full game",$t=(L==null?void 0:L.font)||"brand.body",xn=(L==null?void 0:L.fontSize)||11,_n=($e=L==null?void 0:L.letterSpacing)!=null?$e:0,it=(Ae=m==null?void 0:m.render)==null?void 0:Ae.tint,En=typeof it=="string"?it:it?`#${it.toString(16).padStart(6,"0")}`:"#CCCCCC",K=document.createElement("div");K.textContent=Tn,K.style.cssText=`
68
- font-family: ${N($t)};
69
- font-size: ${xn}px;
70
- font-weight: ${G($t)};
71
- color: ${En};
70
+ `,R.style.top=`${ft}px`,R.style.left="50%";let Mt=Q(R);Mt.element=R,T.appendChild(R);let xn=($==null?void 0:$.text)||((Me=y.ui)==null?void 0:Me.cta_label_end)||"DOWNLOAD",At=($==null?void 0:$.font)||"brand.heading",En=($==null?void 0:$.fontSize)||20,_n=P.button_text_color||((Ae=y.theme)==null?void 0:Ae.cta_text)||"#1a0a0a";R.textContent=xn,R.style.fontFamily=Y(At),R.style.fontSize=`${En}px`,R.style.fontWeight=String(N(At)),R.style.color=_n,R.style.letterSpacing=`${($e=$==null?void 0:$.letterSpacing)!=null?$e:1}px`;let $t=Q(R);$t.element=R;let L=l==null?void 0:l.ui,Lt=((Le=l==null?void 0:l.gameplay)==null?void 0:Le.tuning)||{},wn=(L==null?void 0:L.text)||"Play the full game",Wt=(L==null?void 0:L.font)||"brand.body",Sn=(L==null?void 0:L.fontSize)||11,Hn=(We=L==null?void 0:L.letterSpacing)!=null?We:0,rt=(De=l==null?void 0:l.render)==null?void 0:De.tint,vn=typeof rt=="string"?rt:rt?`#${rt.toString(16).padStart(6,"0")}`:"#CCCCCC",K=document.createElement("div");K.textContent=wn,K.style.cssText=`
71
+ font-family: ${Y(Wt)};
72
+ font-size: ${Sn}px;
73
+ font-weight: ${N(Wt)};
74
+ color: ${vn};
72
75
  text-align: center;
73
- letter-spacing: ${_n}px;
76
+ letter-spacing: ${Hn}px;
74
77
  opacity: 0;
75
78
  position: absolute;
76
79
  transform: translate(-50%, -50%);
77
80
  white-space: nowrap;
78
- `;let wn=ut+35+((Le=Ft.animation_start_y_offset)!=null?Le:5);K.style.top=`${wn}px`,K.style.left="50%";let yt=Q(K);yt.element=K,yt.animationStartYOffset=(De=Ft.animation_start_y_offset)!=null?De:5,w.appendChild(K);let ft=((We=r==null?void 0:r.gameplay)==null?void 0:We.tuning)||{},Sn=(ke=ft.hand_offset_x)!=null?ke:50,Hn=(ze=ft.hand_offset_y)!=null?ze:50,vn=(Ye=(Be=r==null?void 0:r.transform)==null?void 0:Be.scale)!=null?Ye:.1875,Rn=(Pe=ft.hand_scale_multiplier)!=null?Pe:2.5,Cn=new U.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),et=new U.Sprite(Cn),At=vn*Rn*100;return et.scale.set(At,At,1),et.position.set(Sn,ut+Hn,0),et.material.opacity=0,et.visible=!1,{panel:T,logo:H,title:Et,subtitle:mt,footer:ht,ctaButton:Rt,ctaText:Mt,ctaHint:yt,hand:et}}function Wn(e,t,n){var S,w,T,W,R,M,D,k;let i=t.objects.get("ui_endgame_1"),a=((S=i==null?void 0:i.gameplay)==null?void 0:S.tuning)||{},s=(w=a.animation_duration_ms)!=null?w:800,o=(T=a.fade_in_duration_ms)!=null?T:600,l=(W=a.scale_animation_intensity)!=null?W:.1,d=(R=a.logo_animation_delay_ms)!=null?R:100,m=(M=a.title_animation_delay_ms)!=null?M:200,r=(D=a.footer_animation_delay_ms)!=null?D:300,c=(k=a.cta_animation_delay_ms)!=null?k:400,{panel:p,logo:g,title:b,subtitle:h,footer:u,ctaButton:y,ctaText:f,ctaHint:_}=e;p.visible=!0,p.element.style.visibility="visible";let x=Date.now(),E=()=>{let j=Date.now()-x,X=Math.min(j/o,1),H=1-Math.pow(1-X,3);p.alpha=H,p.element.style.opacity=H.toString();let z=1+l*(1-H);p.element.style.transform=`translate(-50%, -50%) scale(${z})`,X<1?requestAnimationFrame(E):(setTimeout(()=>kn(g,s,t),d),setTimeout(()=>{zn(b,s),setTimeout(()=>Bn(h,s),50)},m),setTimeout(()=>Yn(u,s),r),setTimeout(()=>{Pn(y,f,s),setTimeout(()=>Nn(_,s),50),n&&n()},c))};E()}function kn(e,t,n){var p,g,b,h,u;let i=n==null?void 0:n.objects.get("ui_endgame_logo_1"),s=(g=(((p=i==null?void 0:i.gameplay)==null?void 0:p.tuning)||{}).animation_start_scale)!=null?g:1.2,o=Date.now(),l=e.material.opacity,d=(b=e.targetAlpha)!=null?b:1,m=(h=e.baseScaleX)!=null?h:e.scale.x,r=(u=e.baseScaleY)!=null?u:e.scale.y,c=()=>{let y=Date.now()-o,f=Math.min(y/t,1),_=1-Math.pow(1-f,2);e.material.opacity=l+(d-l)*_;let x=s+(1-s)*_;e.scale.set(m*x,r*x,1),f<1&&requestAnimationFrame(c)};c()}function zn(e,t){let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=()=>{let o=Date.now()-n,l=Math.min(o/t,1),d=1-Math.pow(1-l,2);e.element.style.opacity=(i+(1-i)*d).toString(),e.element.style.top=`${a-20*(1-d)}px`,l<1&&requestAnimationFrame(s)};s()}function Bn(e,t){var l;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=a-((l=e.animationStartYOffset)!=null?l:-10),o=()=>{let d=Date.now()-n,m=Math.min(d/t,1),r=1-Math.pow(1-m,2);e.element.style.opacity=(i+(1-i)*r).toString(),e.element.style.top=`${a+(s-a)*r}px`,m<1&&requestAnimationFrame(o)};o()}function Yn(e,t){var o;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=(o=e.targetAlpha)!=null?o:1,s=()=>{let l=Date.now()-n,d=Math.min(l/t,1),m=1-Math.pow(1-d,2);e.element.style.opacity=(i+(a-i)*m).toString(),d<1&&requestAnimationFrame(s)};s()}function Pn(e,t,n){let i=Date.now(),a=parseFloat(e.element.style.opacity||"0"),s=()=>{let o=Date.now()-i,l=Math.min(o/n,1),d=1-Math.pow(1-l,2);e.element.style.opacity=(a+(1-a)*d).toString(),t.element.style.opacity=(a+(1-a)*d).toString(),e.element.style.transform=`translate(-50%, -50%) scale(${1+.1*(1-d)})`,l<1&&requestAnimationFrame(s)};s()}function Nn(e,t){var l;let n=Date.now(),i=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),s=a-((l=e.animationStartYOffset)!=null?l:5),o=()=>{let d=Date.now()-n,m=Math.min(d/t,1),r=1-Math.pow(1-m,2);e.element.style.opacity=(i+(1-i)*r).toString(),e.element.style.top=`${a+(s-a)*r}px`,m<1&&requestAnimationFrame(o)};o()}function Gn(e,t,n,i){var r,c,p,g;let a=n.objects.get("ui_endgame_hand_1"),s=((r=a==null?void 0:a.gameplay)==null?void 0:r.tuning)||{},o=(c=s.click_animation_duration_ms)!=null?c:600,l=(p=s.click_delay_ms)!=null?p:2e3,d=(g=s.click_repeat_delay_ms)!=null?g:3e3,m=()=>{var w,T;e.visible=!0,e.material.opacity=1;let b=e.position.x,h=e.position.y,u=(w=s.hand_offset_x)!=null?w:50,y=(T=s.hand_offset_y)!=null?T:50,f=t.element.getBoundingClientRect(),_=u,x=y,E=Date.now(),S=()=>{var H,z,q;let W=Date.now()-E,R=Math.min(W/o,1),M=R<.5?2*R*R:1-Math.pow(-2*R+2,2)/2;e.position.set(b+(_-b)*M,h+(x-h)*M,0);let D=(z=(H=a==null?void 0:a.transform)==null?void 0:H.scale)!=null?z:.1875,k=(q=s.hand_scale_multiplier)!=null?q:2.5,j=D*k*100,X=j+j*.2*Math.sin(R*Math.PI);e.scale.set(X,X,1),R<1?requestAnimationFrame(S):(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(b,h,0),m()},d)},500))};S()};setTimeout(m,l)}import*as dt from"three";function Xn(e,t,n){var c,p,g,b;let i=t.objects.get("hand_tutorial_1"),a=((c=i==null?void 0:i.gameplay)==null?void 0:c.tuning)||{},s=(i==null?void 0:i.render)||{},o=(i==null?void 0:i.transform)||{},l=new dt.SpriteMaterial({map:e||void 0,transparent:!0,alphaTest:.1}),d=new dt.Sprite(l);d.position.set(n.x,n.y,0),d.material.opacity=0;let m=(p=a.hand_scale_multiplier)!=null?p:2.5,r=(g=o.scale)!=null?g:.1875;return d.scale.set(r*m*100,r*m*100,1),d.renderOrder=(b=s.z_index)!=null?b:99999,d}function qn(e){var b,h,u,y,f,_,x,E,S;let t=e.objects.get("ui_tutorial_1"),n=t==null?void 0:t.ui,i=(t==null?void 0:t.render)||{},a=((b=e.engine.runtime)==null?void 0:b.ui_styles)||{},s=((h=e.engine.runtime)==null?void 0:h.ui)||{},o=(n==null?void 0:n.text)||s.tutorial_label||s.label_text||"CLEAN!",l=(n==null?void 0:n.font)||"brand.warning",d=(n==null?void 0:n.fontSize)||a.label_font_size||52,m=(y=n==null?void 0:n.letterSpacing)!=null?y:(u=a.label_letter_spacing)!=null?u:-1,r=(n==null?void 0:n.align)||"center",c=i.tint,p=typeof c=="string"?c:c?`#${c.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",g=document.createElement("div");return g.textContent=o,g.style.cssText=`
79
- font-family: ${N(l)};
80
- font-size: ${d}px;
81
- font-weight: ${G(l)};
82
- color: ${p};
83
- text-align: ${r};
84
- letter-spacing: ${m}px;
85
- text-shadow: ${(f=a.label_shadow_distance)!=null?f:2}px ${(_=a.label_shadow_distance)!=null?_:2}px ${(x=a.label_shadow_blur)!=null?x:4}px rgba(0,0,0,${(E=a.label_shadow_alpha)!=null?E:.8});
81
+ `;let Cn=ft+35+((ze=Lt.animation_start_y_offset)!=null?ze:5);K.style.top=`${Cn}px`,K.style.left="50%";let gt=Q(K);gt.element=K,gt.animationStartYOffset=(ke=Lt.animation_start_y_offset)!=null?ke:5,T.appendChild(K);let Tt=((Be=c==null?void 0:c.gameplay)==null?void 0:Be.tuning)||{},Rn=(Pe=Tt.hand_offset_x)!=null?Pe:50,Fn=(Ye=Tt.hand_offset_y)!=null?Ye:50,Mn=(Ge=(Ne=c==null?void 0:c.transform)==null?void 0:Ne.scale)!=null?Ge:.1875,An=(Xe=Tt.hand_scale_multiplier)!=null?Xe:2.5,$n=new U.SpriteMaterial({map:t||void 0,transparent:!0,alphaTest:.1}),et=new U.Sprite($n),Dt=Mn*An*100;return et.scale.set(Dt,Dt,1),et.position.set(Rn,ft+Fn,0),et.material.opacity=0,et.visible=!1,{panel:z,logo:H,title:Ht,subtitle:ht,footer:yt,ctaButton:Mt,ctaText:$t,ctaHint:gt,hand:et}}function Pn(e,t,n){var w,S,T,z,C,D,F,W;let s=t.objects.get("ui_endgame_1"),a=((w=s==null?void 0:s.gameplay)==null?void 0:w.tuning)||{},i=(S=a.animation_duration_ms)!=null?S:800,o=(T=a.fade_in_duration_ms)!=null?T:600,m=(z=a.scale_animation_intensity)!=null?z:.1,r=(C=a.logo_animation_delay_ms)!=null?C:100,u=(D=a.title_animation_delay_ms)!=null?D:200,l=(F=a.footer_animation_delay_ms)!=null?F:300,c=(W=a.cta_animation_delay_ms)!=null?W:400,{panel:y,logo:d,title:b,subtitle:p,footer:f,ctaButton:h,ctaText:g,ctaHint:E}=e;y.visible=!0,y.element.style.visibility="visible";let x=Date.now(),_=()=>{let j=Date.now()-x,X=Math.min(j/o,1),G=1-Math.pow(1-X,3);y.alpha=G,y.element.style.opacity=G.toString();let H=1+m*(1-G);y.element.style.transform=`translate(-50%, -50%) scale(${H})`,X<1?requestAnimationFrame(_):(setTimeout(()=>Yn(d,i,t),r),setTimeout(()=>{Nn(b,i),setTimeout(()=>Gn(p,i),50)},u),setTimeout(()=>Xn(f,i),l),setTimeout(()=>{qn(h,g,i),setTimeout(()=>Vn(E,i),50),n&&n()},c))};_()}function Yn(e,t,n){var y,d,b,p,f;let s=n==null?void 0:n.objects.get("ui_endgame_logo_1"),i=(d=(((y=s==null?void 0:s.gameplay)==null?void 0:y.tuning)||{}).animation_start_scale)!=null?d:1.2,o=Date.now(),m=e.material.opacity,r=(b=e.targetAlpha)!=null?b:1,u=(p=e.baseScaleX)!=null?p:e.scale.x,l=(f=e.baseScaleY)!=null?f:e.scale.y,c=()=>{let h=Date.now()-o,g=Math.min(h/t,1),E=1-Math.pow(1-g,2);e.material.opacity=m+(r-m)*E;let x=i+(1-i)*E;e.scale.set(u*x,l*x,1),g<1&&requestAnimationFrame(c)};c()}function Nn(e,t){let n=Date.now(),s=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),i=()=>{let o=Date.now()-n,m=Math.min(o/t,1),r=1-Math.pow(1-m,2);e.element.style.opacity=(s+(1-s)*r).toString(),e.element.style.top=`${a-20*(1-r)}px`,m<1&&requestAnimationFrame(i)};i()}function Gn(e,t){var m;let n=Date.now(),s=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),i=a-((m=e.animationStartYOffset)!=null?m:-10),o=()=>{let r=Date.now()-n,u=Math.min(r/t,1),l=1-Math.pow(1-u,2);e.element.style.opacity=(s+(1-s)*l).toString(),e.element.style.top=`${a+(i-a)*l}px`,u<1&&requestAnimationFrame(o)};o()}function Xn(e,t){var o;let n=Date.now(),s=parseFloat(e.element.style.opacity||"0"),a=(o=e.targetAlpha)!=null?o:1,i=()=>{let m=Date.now()-n,r=Math.min(m/t,1),u=1-Math.pow(1-r,2);e.element.style.opacity=(s+(a-s)*u).toString(),r<1&&requestAnimationFrame(i)};i()}function qn(e,t,n){let s=Date.now(),a=parseFloat(e.element.style.opacity||"0"),i=()=>{let o=Date.now()-s,m=Math.min(o/n,1),r=1-Math.pow(1-m,2);e.element.style.opacity=(a+(1-a)*r).toString(),t.element.style.opacity=(a+(1-a)*r).toString(),e.element.style.transform=`translate(-50%, -50%) scale(${1+.1*(1-r)})`,m<1&&requestAnimationFrame(i)};i()}function Vn(e,t){var m;let n=Date.now(),s=parseFloat(e.element.style.opacity||"0"),a=parseFloat(e.element.style.top||"0"),i=a-((m=e.animationStartYOffset)!=null?m:5),o=()=>{let r=Date.now()-n,u=Math.min(r/t,1),l=1-Math.pow(1-u,2);e.element.style.opacity=(s+(1-s)*l).toString(),e.element.style.top=`${a+(i-a)*l}px`,u<1&&requestAnimationFrame(o)};o()}function Zn(e,t,n,s){var l,c,y,d;let a=n.objects.get("ui_endgame_hand_1"),i=((l=a==null?void 0:a.gameplay)==null?void 0:l.tuning)||{},o=(c=i.click_animation_duration_ms)!=null?c:600,m=(y=i.click_delay_ms)!=null?y:2e3,r=(d=i.click_repeat_delay_ms)!=null?d:3e3,u=()=>{var S,T;e.visible=!0,e.material.opacity=1;let b=e.position.x,p=e.position.y,f=(S=i.hand_offset_x)!=null?S:50,h=(T=i.hand_offset_y)!=null?T:50,g=t.element.getBoundingClientRect(),E=f,x=h,_=Date.now(),w=()=>{var G,H,q;let z=Date.now()-_,C=Math.min(z/o,1),D=C<.5?2*C*C:1-Math.pow(-2*C+2,2)/2;e.position.set(b+(E-b)*D,p+(x-p)*D,0);let F=(H=(G=a==null?void 0:a.transform)==null?void 0:G.scale)!=null?H:.1875,W=(q=i.hand_scale_multiplier)!=null?q:2.5,j=F*W*100,X=j+j*.2*Math.sin(C*Math.PI);e.scale.set(X,X,1),C<1?requestAnimationFrame(w):(t.element.style.transform="translate(-50%, -50%) scale(0.95)",setTimeout(()=>{t.element.style.transform="translate(-50%, -50%) scale(1)",s()},100),setTimeout(()=>{e.material.opacity=0,setTimeout(()=>{e.position.set(b,p,0),u()},r)},500))};w()};setTimeout(u,m)}import*as ut from"three";function Jn(e,t,n){var c,y,d,b;let s=t.objects.get("hand_tutorial_1"),a=((c=s==null?void 0:s.gameplay)==null?void 0:c.tuning)||{},i=(s==null?void 0:s.render)||{},o=(s==null?void 0:s.transform)||{},m=new ut.SpriteMaterial({map:e||void 0,transparent:!0,alphaTest:.1}),r=new ut.Sprite(m);r.position.set(n.x,n.y,0),r.material.opacity=0;let u=(y=a.hand_scale_multiplier)!=null?y:2.5,l=(d=o.scale)!=null?d:.1875;return r.scale.set(l*u*100,l*u*100,1),r.renderOrder=(b=i.z_index)!=null?b:99999,r}function Kn(e){var b,p,f,h,g,E,x,_,w;let t=e.objects.get("ui_tutorial_1"),n=t==null?void 0:t.ui,s=(t==null?void 0:t.render)||{},a=((b=e.engine.runtime)==null?void 0:b.ui_styles)||{},i=((p=e.engine.runtime)==null?void 0:p.ui)||{},o=(n==null?void 0:n.text)||i.tutorial_label||i.label_text||"CLEAN!",m=(n==null?void 0:n.font)||"brand.warning",r=(n==null?void 0:n.fontSize)||a.label_font_size||52,u=(h=n==null?void 0:n.letterSpacing)!=null?h:(f=a.label_letter_spacing)!=null?f:-1,l=(n==null?void 0:n.align)||"center",c=s.tint,y=typeof c=="string"?c:c?`#${c.toString(16).padStart(6,"0")}`:a.label_fill||"#FFF1C1",d=document.createElement("div");return d.textContent=o,d.style.cssText=`
82
+ font-family: ${Y(m)};
83
+ font-size: ${r}px;
84
+ font-weight: ${N(m)};
85
+ color: ${y};
86
+ text-align: ${l};
87
+ letter-spacing: ${u}px;
88
+ text-shadow: ${(g=a.label_shadow_distance)!=null?g:2}px ${(E=a.label_shadow_distance)!=null?E:2}px ${(x=a.label_shadow_blur)!=null?x:4}px rgba(0,0,0,${(_=a.label_shadow_alpha)!=null?_:.8});
86
89
  -webkit-text-stroke: ${a.label_stroke||"#8B0000"} 2px;
87
- opacity: ${(S=i.alpha)!=null?S:0};
88
- visibility: ${i.visible!==!1?"visible":"hidden"};
90
+ opacity: ${(w=s.alpha)!=null?w:0};
91
+ visibility: ${s.visible!==!1?"visible":"hidden"};
89
92
  pointer-events: none;
90
93
  position: absolute;
91
94
  transform: translate(-50%, -50%);
92
95
  white-space: nowrap;
93
- `,g}function Vn(e,t,n,i,a){var d,m,r,c,p,g,b;let s=a.objects.get("hand_tutorial_1"),o=((d=s==null?void 0:s.gameplay)==null?void 0:d.tuning)||{},l=(s==null?void 0:s.transform)||{};if(!i){let h=(m=o.animation_duration)!=null?m:1.5,u=n%h/h,y=u<.5?2*u*u:-1+(4-2*u)*u,f=(r=o.x_offset)!=null?r:0,_=(c=o.y_offset)!=null?c:0,x=(p=o.animation_range)!=null?p:40,E=x*.7,S=x,w=t.x+f+E,T=t.y+_+S,W=w+E,R=T+S;e.position.set(w+(W-w)*y,T+(R-T)*y,0);let M=(g=l.scale)!=null?g:.1875,D=(b=o.hand_scale_multiplier)!=null?b:2.5,k=M*D*100;e.scale.set(k,k,1)}}import*as tt from"three";var Ne=new tt.TextureLoader;async function Ge(e,t,n=16777215,i=!1){try{let s=(globalThis.INLINE_ASSETS||{})[e];return await Ne.loadAsync(s||e)}catch{console.warn(`Asset missing: ${e}. Using placeholder.`);let s=document.createElement("canvas");s.width=64,s.height=64;let o=s.getContext("2d");return o&&(o.fillStyle=`#${n.toString(16).padStart(6,"0")}`,i?o.fillRect(0,0,30,60):(o.beginPath(),o.arc(32,32,30,0,Math.PI*2),o.fill(),o.fillRect(27,32,10,40))),new tt.CanvasTexture(s)}}async function Zn(e,t,n){var b,h,u,y;let a=(globalThis.INLINE_ASSETS||{})[e]||e,s;try{s=await Ne.loadAsync(a),console.log("[character] loaded sheet",{path:e,sourceUsed:a})}catch(f){let E=((n.gameplay.character_sheet||{}).fallback_color||"#ff00ff").replace("#","");s=await Ge(e,t,parseInt(E,16),!0),console.warn("[character] fallback loadAsset used",{path:e,err:f})}if(!s)return[];let o=n.gameplay.character_sheet||{},l=(b=o.cols)!=null?b:3,d=(h=o.rows)!=null?h:2,m=((u=s.image)==null?void 0:u.width)||0,r=((y=s.image)==null?void 0:y.height)||0,c=m/l,p=r/d;if(!Number.isFinite(c)||!Number.isFinite(p)||c<=0||p<=0)return[s];let g=[];for(let f=0;f<d;f++)for(let _=0;_<l;_++){let x=document.createElement("canvas");x.width=c,x.height=p;let E=x.getContext("2d");E&&s.image&&E.drawImage(s.image,_*c,f*p,c,p,0,0,c,p),g.push(new tt.CanvasTexture(x))}return g.length>2&&g.push(...g.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:g.length}),g}function Jn(e,t){var c,p,g,b;let n=t.gameplay.brush||{},i=t.theme.brush_color||"#ffffff",a=(c=n.radius)!=null?c:20,s=(p=n.inner_radius)!=null?p:15,o=(g=n.alpha)!=null?g:.8,l=(b=n.inner_alpha)!=null?b:.3,d=n.inner_color||"#ffffff",m=document.createElement("canvas");m.width=a*2,m.height=a*2;let r=m.getContext("2d");return r&&(r.clearRect(0,0,m.width,m.height),r.beginPath(),r.arc(a,a,a,0,Math.PI*2),r.fillStyle=i,r.globalAlpha=o,r.fill(),r.beginPath(),r.arc(a,a,s,0,Math.PI*2),r.fillStyle=d,r.globalAlpha=l,r.fill()),new tt.CanvasTexture(m)}export{ct as GameObject,Tt as GameObjectManager,lt as Renderer,rt as Transform,Gn as animateHandClick,Wn as animatePanelEntrance,Jn as createBrushTexture,Dn as createEndGamePanel,Xn as createHandTutorial,$n as createThreeBase,qn as createTutorialLabel,Ln as getRegisteredFontIds,Ge as loadAsset,Zn as loadCharacterFrames,An as registerFont,N as resolveFont,G as resolveFontWeight,Vn as updateHandAnimation};
96
+ `,d}function Qn(e,t,n,s,a){var r,u,l,c,y,d,b;let i=a.objects.get("hand_tutorial_1"),o=((r=i==null?void 0:i.gameplay)==null?void 0:r.tuning)||{},m=(i==null?void 0:i.transform)||{};if(!s){let p=(u=o.animation_duration)!=null?u:1.5,f=n%p/p,h=f<.5?2*f*f:-1+(4-2*f)*f,g=(l=o.x_offset)!=null?l:0,E=(c=o.y_offset)!=null?c:0,x=(y=o.animation_range)!=null?y:40,_=x*.7,w=x,S=t.x+g+_,T=t.y+E+w,z=S+_,C=T+w;e.position.set(S+(z-S)*h,T+(C-T)*h,0);let D=(d=m.scale)!=null?d:.1875,F=(b=o.hand_scale_multiplier)!=null?b:2.5,W=D*F*100;e.scale.set(W,W,1)}}import*as tt from"three";var Ve=new tt.TextureLoader;async function Ze(e,t,n=16777215,s=!1){try{let i=(globalThis.INLINE_ASSETS||{})[e];return await Ve.loadAsync(i||e)}catch{console.warn(`Asset missing: ${e}. Using placeholder.`);let i=document.createElement("canvas");i.width=64,i.height=64;let o=i.getContext("2d");return o&&(o.fillStyle=`#${n.toString(16).padStart(6,"0")}`,s?o.fillRect(0,0,30,60):(o.beginPath(),o.arc(32,32,30,0,Math.PI*2),o.fill(),o.fillRect(27,32,10,40))),new tt.CanvasTexture(i)}}async function jn(e,t,n){var b,p,f,h;let a=(globalThis.INLINE_ASSETS||{})[e]||e,i;try{i=await Ve.loadAsync(a),console.log("[character] loaded sheet",{path:e,sourceUsed:a})}catch(g){let _=((n.gameplay.character_sheet||{}).fallback_color||"#ff00ff").replace("#","");i=await Ze(e,t,parseInt(_,16),!0),console.warn("[character] fallback loadAsset used",{path:e,err:g})}if(!i)return[];let o=n.gameplay.character_sheet||{},m=(b=o.cols)!=null?b:3,r=(p=o.rows)!=null?p:2,u=((f=i.image)==null?void 0:f.width)||0,l=((h=i.image)==null?void 0:h.height)||0,c=u/m,y=l/r;if(!Number.isFinite(c)||!Number.isFinite(y)||c<=0||y<=0)return[i];let d=[];for(let g=0;g<r;g++)for(let E=0;E<m;E++){let x=document.createElement("canvas");x.width=c,x.height=y;let _=x.getContext("2d");_&&i.image&&_.drawImage(i.image,E*c,g*y,c,y,0,0,c,y),d.push(new tt.CanvasTexture(x))}return d.length>2&&d.push(...d.slice(1,-1).reverse()),console.log("[character] frames prepared",{count:d.length}),d}function In(e,t){var c,y,d,b;let n=t.gameplay.brush||{},s=t.theme.brush_color||"#ffffff",a=(c=n.radius)!=null?c:20,i=(y=n.inner_radius)!=null?y:15,o=(d=n.alpha)!=null?d:.8,m=(b=n.inner_alpha)!=null?b:.3,r=n.inner_color||"#ffffff",u=document.createElement("canvas");u.width=a*2,u.height=a*2;let l=u.getContext("2d");return l&&(l.clearRect(0,0,u.width,u.height),l.beginPath(),l.arc(a,a,a,0,Math.PI*2),l.fillStyle=s,l.globalAlpha=o,l.fill(),l.beginPath(),l.arc(a,a,i,0,Math.PI*2),l.fillStyle=r,l.globalAlpha=m,l.fill()),new tt.CanvasTexture(u)}export{qe as AspectClass,mt as GameObject,_t as GameObjectManager,pt as Renderer,nt as ResponsiveUISystem,ct as Transform,Zn as animateHandClick,Pn as animatePanelEntrance,In as createBrushTexture,Bn as createEndGamePanel,Jn as createHandTutorial,Dn as createThreeBase,Kn as createTutorialLabel,Et as getAspectClass,kn as getRegisteredFontIds,Ze as loadAsset,jn as loadCharacterFrames,zn as registerFont,Y as resolveFont,N as resolveFontWeight,Qn as updateHandAnimation};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handler-playable-sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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",