@tora-editor/tora 0.1.0 → 0.2.0
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/README.md +108 -58
- package/assets/free-audio/arcade-pop/audio/loss.wav +0 -0
- package/assets/free-audio/arcade-pop/audio/reward.wav +0 -0
- package/assets/free-audio/arcade-pop/audio/win.wav +0 -0
- package/assets/free-audio/arcade-pop/source/INFO.txt +11 -11
- package/assets/kenney-food-starter/License.txt +28 -0
- package/assets/kenney-food-starter/burger.glb +0 -0
- package/assets/kenney-food-starter/frying-pan.glb +0 -0
- package/assets/kenney-food-starter/plan.json +61 -0
- package/assets/kenney-food-starter/plate.glb +0 -0
- package/assets/kenney-food-starter/pot.glb +0 -0
- package/assets/kenney-harvest/audio/victory.wav +0 -0
- package/assets/kenney-harvest/source/music-jingles/OGG/jingles_NES/jingles_NES03.ogg +0 -0
- package/assets/kenney-harvest/source/music-jingles/OGG/jingles_PIZZA/jingles_PIZZA03.ogg +0 -0
- package/assets/kenney-harvest/source/music-jingles/license.txt +14 -0
- package/bin/tora.mjs +77 -9
- package/crates/packer/trusted/native-3d-meta.json +3 -2
- package/crates/packer/trusted/native-3d.js +181 -181
- package/crates/packer/trusted/native-meta.json +2 -2
- package/crates/packer/trusted/native.js +5 -5
- package/crates/packer/trusted/release-manifest.json +17 -17
- package/crates/packer/trusted/review-runtime-meta.json +3 -2
- package/crates/packer/trusted/review-runtime.js +182 -182
- package/docs/TORA_AGENT_SETUP.md +24 -13
- package/docs/TORA_CREATION_API.md +29 -12
- package/docs/reference/CORE_AUTHORING.md +2 -1
- package/docs/reference/PLAYABLE_STARTERS.md +20 -0
- package/docs/reference/packs/3d.md +9 -3
- package/network-rules/mintegral-appgrowth-single-html.json +10 -10
- package/package.json +6 -6
- package/packages/creative-project/project-v21.schema.json +264 -8
- package/scripts/lean/editor/review-editor.css +10 -0
- package/scripts/lean/editor/review-editor.js +117 -1
- package/scripts/lean/native/agent-tools.mjs +7 -7
- package/scripts/lean/native/api.mjs +16 -5
- package/scripts/lean/native/asset-catalog.mjs +7 -6
- package/scripts/lean/native/asset-lineage.mjs +54 -0
- package/scripts/lean/native/asset-prep.mjs +173 -40
- package/scripts/lean/native/assets.mjs +107 -11
- package/scripts/lean/native/author-expansion-proofs.mjs +2 -99
- package/scripts/lean/native/author-fps.mjs +545 -0
- package/scripts/lean/native/author-primitive-proofs.mjs +5 -4
- package/scripts/lean/native/build-cache.mjs +2 -2
- package/scripts/lean/native/cc0-inputs.mjs +24 -0
- package/scripts/lean/native/cc0-staging.mjs +28 -8
- package/scripts/lean/native/check-harvest-outcome-audio.mjs +7 -8
- package/scripts/lean/native/check-salvage.mjs +8 -5
- package/scripts/lean/native/compiler.mjs +9 -3
- package/scripts/lean/native/contracts.mjs +11 -8
- package/scripts/lean/native/creative-qa.mjs +305 -122
- package/scripts/lean/native/demos.mjs +47 -3
- package/scripts/lean/native/document.mjs +36 -10
- package/scripts/lean/native/export-budget.mjs +75 -0
- package/scripts/lean/native/glb-loader.mjs +468 -0
- package/scripts/lean/native/intake-creator-tools.mjs +83 -30
- package/scripts/lean/native/local-bundle.mjs +5 -3
- package/scripts/lean/native/mcp-server.mjs +33 -46
- package/scripts/lean/native/media-validate.mjs +124 -0
- package/scripts/lean/native/native-bin.mjs +3 -3
- package/scripts/lean/native/outcome-playthrough.mjs +97 -0
- package/scripts/lean/native/prepare-fps-assets.mjs +330 -0
- package/scripts/lean/native/project-bundle.mjs +3 -3
- package/scripts/lean/native/remote-cc0-fetcher.mjs +403 -197
- package/scripts/lean/native/review-agent-tools.mjs +2 -2
- package/scripts/lean/native/review.mjs +3 -0
- package/scripts/lean/native/runtime.mjs +242 -56
- package/scripts/lean/native/schema.mjs +7 -5
- package/scripts/lean/native/service.mjs +159 -32
- package/scripts/lean/native/stage-3d.mjs +343 -40
- package/scripts/lean/native/starters.mjs +436 -0
- package/scripts/lean/native/verify.mjs +1 -1
- package/scripts/lean/native/win-cues.mjs +96 -0
- package/skills/tora-playables/SKILL.md +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var ToraNative=(()=>{var Ba=Object.defineProperty;var hf=Object.getOwnPropertyDescriptor;var yf=Object.getOwnPropertyNames;var pf=Object.prototype.hasOwnProperty;var mf=(e,t)=>{for(var n in t)Ba(e,n,{get:t[n],enumerable:!0})},gf=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of yf(t))!pf.call(e,l)&&l!==n&&Ba(e,l,{get:()=>t[l],enumerable:!(a=hf(t,l))||a.enumerable});return e};var If=e=>gf(Ba({},"__esModule",{value:!0}),e);var qf={};mf(qf,{computeSafeArea:()=>eo,createNetworkBridge:()=>bl,layoutStandardText:()=>wl,mountNative:()=>Jf});var Oo=function(e,t){if(!e)throw Error(t)},tn=function(){return[1,0,0,1,0,0]};function Wa(e){return Oo(Array.isArray(e)&&e.length===6&&e.every(Number.isFinite),"E_SCENE_MATRIX"),e}function ri(e,t){return Wa(e),Wa(t),[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Xt(e){Wa(e);var t=e[0]*e[3]-e[1]*e[2];return Oo(Math.abs(t)>1e-12,"E_SCENE_SINGULAR_TRANSFORM"),[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]}var Da=function(){return Da=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Da.apply(this,arguments)},nn=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Dn=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},La=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Vo(e){var t=e.rows,n=e.columns,a=e.seed,l=e.slots,i=e.paint,u=e.onEvent,s=l.map(function(X){return X.group}),E=Dn([],nn(new Set(s)),!1),f=Dn([],nn(s),!1),b=a,k="idle",z=0,re,U,Y=[],oe=[],_=0,ee=0,h=0,V,Te,Ce=function(X,ve){return X*n+ve},xe=function(X){return Math.floor(X/n)},Le=function(X){return X%n},Z=function(){return b=Math.imul(b,1664525)+1013904223>>>0,b/4294967296};function ue(X){for(var ve=new Set,Ve=0;Ve<t;Ve++)for(var ce=0;ce<n;ce++){var Se=Ce(Ve,ce),$e=X[Se];if(ce+2<n&&$e===X[Se+1]&&$e===X[Se+2])for(var Xe=0;Xe<3;Xe++)ve.add(Se+Xe);if(Ve+2<t&&$e===X[Se+n]&&$e===X[Se+n*2])for(var Xe=0;Xe<3;Xe++)ve.add(Se+n*Xe)}return Dn([],nn(ve),!1)}function ie(X,ve){var Ve;if(f[X]===f[ve])return!1;var ce=Dn([],nn(f),!1);return Ve=nn([ce[ve],ce[X]],2),ce[X]=Ve[0],ce[ve]=Ve[1],ue(ce).some(function(Se){return Se===X||Se===ve})}function ye(){for(var X=[],ve=0;ve<f.length;ve++)Le(ve)+1<n&&ie(ve,ve+1)&&X.push({from:l[ve].id,to:l[ve+1].id}),xe(ve)+1<t&&ie(ve,ve+n)&&X.push({from:l[ve].id,to:l[ve+n].id});return X}function R(){for(var X=0;X<64;X++){f=[];for(var ve=function(ce){var Se=E.filter(function($e){return!(Le(ce)>=2&&f[ce-1]===$e&&f[ce-2]===$e)&&!(xe(ce)>=2&&f[ce-n]===$e&&f[ce-n*2]===$e)});f.push(Se[Math.floor(Z()*Se.length)])},Ve=0;Ve<l.length;Ve++)ve(Ve);if(ye().length)return}f=l.map(function(ce,Se){return E[(xe(Se)*2+Le(Se))%3]}),f[0]=E[0],f[1]=E[1],f[2]=E[0],f[n+1]=E[0]}function x(){for(var X=0;X<l.length;X++)i(X,f[X],{})}function $(){b=a,f=Dn([],nn(s),!1),k="idle",z=0,re=void 0,U=void 0,Y=[],oe=[],_=0,ee=0,h=0,V=void 0,Te=void 0,(ue(f).length||!ye().length)&&R(),x()}function D(X,ve){if(k!=="idle")return!1;var Ve=l.findIndex(function(Se){return Se.id===X}),ce=l.findIndex(function(Se){return Se.id===ve});return Ve<0||ce<0||Math.abs(xe(Ve)-xe(ce))+Math.abs(Le(Ve)-Le(ce))!==1?!1:(re=void 0,V=void 0,x(),U=[Ve,ce],k="swap",z=0,!0)}function fe(X){if(k==="idle"){if(re===X){re=void 0;return}if(!(re&&D(re,X)))return re=X,re}}function J(){Y=ue(f),h+=Y.length,Te={group:f[Y[0]],from:l[Y[0]].id,count:Y.length},u("matchClear"),k="clear",z=0}function Q(){var X=new Set(Y),ve=Dn([],nn(f),!1);oe=[];for(var Ve=0;Ve<n;Ve++){for(var ce=[],Se=t-1;Se>=0;Se--)X.has(Ce(Se,Ve))||ce.push(Ce(Se,Ve));for(var $e=0,Se=t-1;Se>=0;Se--){var Xe=Ce(Se,Ve),fr=ce[t-1-Se];fr!==void 0?(ve[Xe]=f[fr],oe.push({cell:Xe,from:fr,offsetRows:0})):(ve[Xe]=E[Math.floor(Z()*E.length)],oe.push({cell:Xe,from:Xe,offsetRows:-(Se+1+$e++)}))}}f=ve,k="fall",z=0}function j(){if(ue(f).length&&_<3){_++,J();return}(ue(f).length||!ye().length)&&R(),x(),k="idle",z=0,U=void 0,Y=[],oe=[],ee++,u("validMatch")}function me(X){var ve,Ve,ce,Se,$e,Xe,fr;if(k==="idle"){if(V){V.elapsed+=X;var Pr=1+.065*Math.sin(Math.min(1,V.elapsed/.8)*Math.PI*4),Or=function(Zt){i(l.findIndex(function($t){return $t.id===Zt}),f[l.findIndex(function($t){return $t.id===Zt})],{scale:Pr})};try{for(var Vr=La(V.ids),Tr=Vr.next();!Tr.done;Tr=Vr.next()){var pn=Tr.value;Or(pn)}}catch(Zt){ve={error:Zt}}finally{try{Tr&&!Tr.done&&(Ve=Vr.return)&&Ve.call(Vr)}finally{if(ve)throw ve.error}}V.elapsed>=.8&&(V=void 0,x())}return}if(z+=X,k==="swap"||k==="reverse"){var Ke=Math.min(1,z/.14),bt=Ke*Ke*(3-2*Ke),Ge=nn(U,2),Ut=Ge[0],_r=Ge[1];if(i(Ut,f[Ut],{from:_r,progress:k==="swap"?bt:1-bt}),i(_r,f[_r],{from:Ut,progress:k==="swap"?bt:1-bt}),Ke<1)return;if(k==="reverse"){x(),k="idle",U=void 0,u("invalidMatch");return}if(!ie(Ut,_r)){k="reverse",z=0;return}ce=nn([f[_r],f[Ut]],2),f[Ut]=ce[0],f[_r]=ce[1],x(),J();return}if(k==="clear"){var Pt=Math.min(1,z/.18),Pr=Pt<.22?1+Pt*.45:Math.max(.05,1.1*(1-Pt)/.78);try{for(var mn=La(Y),wt=mn.next();!wt.done;wt=mn.next()){var zt=wt.value;i(zt,f[zt],{scale:Pr,opacity:1-Pt})}}catch($t){Se={error:$t}}finally{try{wt&&!wt.done&&($e=mn.return)&&$e.call(mn)}finally{if(Se)throw Se.error}}Pt===1&&Q();return}var Yt=Math.min(1,z/.25),Gt=1-Math.pow(1-Yt,3);try{for(var vt=La(oe),at=vt.next();!at.done;at=vt.next()){var Lr=at.value;i(Lr.cell,f[Lr.cell],{from:Lr.from,offsetRows:Lr.offsetRows,progress:1-Gt})}}catch(Zt){Xe={error:Zt}}finally{try{at&&!at.done&&(fr=vt.return)&&fr.call(vt)}finally{if(Xe)throw Xe.error}}Yt===1&&j()}function le(){if(k==="idle"){re=void 0;var X=ye()[0];X&&(V={ids:[X.from,X.to],elapsed:0})}}function Ie(){var X;return{phase:k,busy:k!=="idle",selected:re!=null?re:null,moves:ee,cleared:h,groups:Dn([],nn(f),!1),legalMoves:k==="idle"?ye():[],hint:(X=V==null?void 0:V.ids)!==null&&X!==void 0?X:[],lastMatch:Te?Da({},Te):null}}return{reset:$,select:fe,swap:D,tick:me,showHint:le,snapshot:Ie,cancelSelection:function(){re=void 0,V&&(V=void 0,x())}}}var _i=function(){return _i=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},_i.apply(this,arguments)},No=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},xf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},zo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Bo(){var e=new Map,t=new Map,n=function(l){var i,u,s=t.get(l);s!==void 0&&((i=e.get(s))===null||i===void 0||i.delete(l),((u=e.get(s))===null||u===void 0?void 0:u.size)===0&&e.delete(s)),t.delete(l)},a=function(l,i){n(l),i!=null&&(e.has(i)||e.set(i,new Set),e.get(i).add(l),t.set(l,i))};return{occupants:e,itemZone:t,release:n,place:a,clear:function(){e.clear(),t.clear()},items:function(l){var i;return xf([],No((i=e.get(l))!==null&&i!==void 0?i:[]),!1).sort()},zoneOf:function(l){return t.get(l)},snapshot:function(){return{itemZone:Object.fromEntries(t)}}}}function ea(e){var t,n,a=e.itemId,l=e.tag,i=l===void 0?"":l,u=e.zones,s=e.occupancy,E=u.filter(function(U){var Y,oe,_;return U.id!==a&&(((oe=(Y=U.acceptTags)===null||Y===void 0?void 0:Y.length)!==null&&oe!==void 0?oe:0)===0||((_=U.acceptTags)===null||_===void 0?void 0:_.includes(i)))});E.sort(function(U,Y){return Number(Y.itemTarget)-Number(U.itemTarget)||Y.paintOrder-U.paintOrder||U.distance-Y.distance||U.id.localeCompare(Y.id)});try{for(var f=zo(E),b=f.next();!b.done;b=f.next()){var k=b.value,z=s.items(k.id).filter(function(U){return U!==a}),re=k.capacity>0&&z.length>=k.capacity;return k.snapMode==="reject"?{kind:"reject",zone:k,occupantId:z[0]}:re?k.onOccupied==="emit"?{kind:"emit",zone:k,occupantId:z[0]}:k.onOccupied==="swap"&&z.length?{kind:"swap",zone:k,occupantId:z[0]}:{kind:"reject",zone:k,occupantId:z[0]}:{kind:"accept",zone:k}}}catch(U){t={error:U}}finally{try{b&&!b.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return null}function Wo(e,t,n,a,l,i){if(n===void 0&&(n=28),a===void 0&&(a=-1/0),l===void 0&&(l=0),i===void 0&&(i=80),l-a<i)return null;var u=t.x-e.x,s=t.y-e.y;return Math.max(Math.abs(u),Math.abs(s))<n?null:Math.abs(u)>Math.abs(s)?u<0?"left":"right":s<0?"up":"down"}function Lo(e,t){var n=t,a=1;return{tick:function(l){return e.pingPong?(n+=a*e.ratePerSecond*l,n>=e.max?(n=e.max,a=-1):n<=e.min&&(n=e.min,a=1)):n=Math.max(e.min,Math.min(e.max,n+e.ratePerSecond*l)),n}}}function Do(){var e=new Map;return{to:function(t,n,a,l,i){l===void 0&&(l=.18),e.set(t,{from:_i({},n),to:_i({},a),seconds:Math.max(.02,l),elapsed:0,onDone:i})},cancel:function(t){e.delete(t)},clear:function(){e.clear()},tick:function(t,n){var a,l,i;try{for(var u=zo(e),s=u.next();!s.done;s=u.next()){var E=No(s.value,2),f=E[0],b=E[1];b.elapsed+=t;var k=Math.min(1,b.elapsed/b.seconds),z=1-Math.pow(1-k,3);n(f,{x:b.from.x+(b.to.x-b.from.x)*z,y:b.from.y+(b.to.y-b.from.y)*z}),k===1&&(e.delete(f),(i=b.onDone)===null||i===void 0||i.call(b))}}catch(re){a={error:re}}finally{try{s&&!s.done&&(l=u.return)&&l.call(u)}finally{if(a)throw a.error}}}}}function Ha(e,t,n,a){n===void 0&&(n=56),a===void 0&&(a=.12);var l=Math.max(1,n),i=t.x-e.x,u=t.y-e.y,s=Math.hypot(i,u),E=Math.min(s,l),f=E/l,b=s>1e-6?i/s:0,k=s>1e-6?u/s:0,z=e.x+b*E,re=e.y+k*E;if(f<=a)return{nx:0,ny:0,magnitude:0,angle:0,knobX:z,knobY:re};var U=(f-a)/Math.max(1e-6,1-a);return{nx:b*U,ny:k*U,magnitude:U,angle:Math.atan2(k,b)*180/Math.PI,knobX:z,knobY:re}}var Fa=function(){return Fa=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Fa.apply(this,arguments)},Ho=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Fo(e){var t,n,a=2166136261;try{for(var l=Ho(String(e)),i=l.next();!i.done;i=l.next()){var u=i.value;a^=u.codePointAt(0),a=Math.imul(a,16777619)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return a>>>0||1}function bf(e){var t=e>>>0||1,n=t;return{next:function(){return n=Math.imul(n,1664525)+1013904223>>>0,n/4294967296},between:function(a,l,i){if(i===void 0&&(i=!1),i){var u=Math.ceil(a),s=Math.floor(l);return s<u?u:Math.min(s,u+Math.floor((s-u+1)*this.next()))}return a+(l-a)*this.next()},reset:function(){n=t}}}function Xo(e,t,n,a,l){var i,u;a===void 0&&(a=0);var s=null,E=1/0;try{for(var f=Ho(t),b=f.next();!b.done;b=f.next()){var k=b.value;if(!(k.id===l||k.team!==n)){var z=Math.hypot(k.x-e.x,k.y-e.y);a>0&&z>a||(z<E||z===E&&k.id<(s==null?void 0:s.id))&&(s=k,E=z)}}}catch(re){i={error:re}}finally{try{b&&!b.done&&(u=f.return)&&u.call(f)}finally{if(i)throw i.error}}return s}function Uo(e,t,n){var a=((t-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI;return e+Math.max(-n,Math.min(n,a))}function Yo(e){var t=bf(e),n=new Map,a=new Map;return{rng:t,states:n,headings:a,reset:function(){t.reset(),n.clear(),a.clear()},initialize:function(l,i){var u;return n.has(l)||n.set(l,{hp:i.hp,maxHp:i.maxHp,value:i.value,tag:(u=i.tag)!==null&&u!==void 0?u:"",team:i.team}),n.get(l)},remove:function(l){n.delete(l),a.delete(l)},snapshot:function(l){var i=n.get(l);return i?Fa({},i):void 0}}}function Go(e,t){var n,a,l,i,u=t===void 0?{}:t,s=u.width,E=u.height,f=u.onProgress,b=f===void 0?function(){}:f,k=u.onComplete,z=k===void 0?function(){}:k,re=u.canvasFactory,U=u.source,Y=e,oe=Y.gridSize,_=new Uint8Array(oe*oe),ee=0,h=!1,V=-1,Te=!1,Ce=Math.max(1,s),xe=Math.max(1,E),Le=Math.min(1,512/Math.max(Ce,xe)),Z=(n=re==null?void 0:re())!==null&&n!==void 0?n:!((a=globalThis.document)===null||a===void 0)&&a.createElement?globalThis.document.createElement("canvas"):void 0;Z&&(Z.width=Math.max(1,Math.round(Ce*Le)),Z.height=Math.max(1,Math.round(xe*Le)));var ue=(l=Z==null?void 0:Z.getContext)===null||l===void 0?void 0:l.call(Z,"2d"),ie=(i=Y.maskColor)!==null&&i!==void 0?i:"#dceeff",ye=function(){return!!(U&&U.complete&&U.naturalWidth>0)},R=function(){ue&&(ue.globalCompositeOperation="source-over",ue.clearRect(0,0,Z.width,Z.height),Y.mode==="erase"&&(ye()?(ue.drawImage(U,0,0,Z.width,Z.height),Te=!0):(ue.fillStyle=ie,ue.fillRect(0,0,Z.width,Z.height),Te=!1)))};R();var x=function(){if(!h){var D=Math.round(ee/_.length*100),fe=Math.min(100,D);fe!==V&&(V=fe,b(fe)),fe>=Y.targetPercent&&(h=!0,z(fe))}},$=function(D,fe){for(var J=Math.max(0,Math.min(oe-1,Math.floor(D/Ce*oe))),Q=Math.max(0,Math.min(oe-1,Math.floor(fe/xe*oe))),j=Math.max(0,Math.ceil(Y.brushRadiusPx/Ce*oe)),me=Math.max(0,Math.ceil(Y.brushRadiusPx/xe*oe)),le=Math.max(0,Q-me);le<=Math.min(oe-1,Q+me);le++)for(var Ie=Math.max(0,J-j);Ie<=Math.min(oe-1,J+j);Ie++)if(!(Math.hypot((Ie+.5)/oe*Ce-D,(le+.5)/oe*xe-fe)>Y.brushRadiusPx)){var X=le*oe+Ie;_[X]||(_[X]=1,ee++)}ue&&(ue.save(),ue.scale(Le,Le),ue.globalCompositeOperation=Y.mode==="erase"?"destination-out":"source-over",ue.fillStyle=ie,ue.beginPath(),ue.arc(D,fe,Y.brushRadiusPx,0,Math.PI*2),ue.fill(),Y.mode==="reveal"&&U&&(ue.globalCompositeOperation="source-in",ue.drawImage(U,0,0,Ce,xe)),ue.restore()),x()};return{canvas:Z,stampSegment:function(D,fe){for(var J=Math.hypot(fe.x-D.x,fe.y-D.y),Q=Math.max(1,Math.ceil(J/Math.max(1,Y.brushRadiusPx*.45))),j=0;j<=Q;j++)$(D.x+(fe.x-D.x)*j/Q,D.y+(fe.y-D.y)*j/Q)},reset:function(){_.fill(0),ee=0,h=!1,V=-1,R(),x()},get progress(){return Math.round(ee/_.length*100)},render:function(D){Y.mode==="erase"&&ee===0&&!Te&&ye()&&R(),Z?D.drawImage(Z,0,0,Z.width,Z.height,0,0,s,E):Y.mode==="erase"&&this.progress<100&&(D.save(),D.globalAlpha=1-this.progress/100,D.fillStyle=ie,D.fillRect(0,0,s,E),D.restore())}}}var Hn=function(){return Hn=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Hn.apply(this,arguments)},wf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Xa(e,t,n,a){var l=function(b,k,z){return(k.x-b.x)*(z.y-b.y)-(k.y-b.y)*(z.x-b.x)},i=l(e,t,n),u=l(e,t,a),s=l(n,a,e),E=l(n,a,t),f=1e-8;return Math.abs(i)<f&&Math.abs(u)<f&&Math.abs(s)<f&&Math.abs(E)<f?Math.max(Math.min(e.x,t.x),Math.min(n.x,a.x))<=Math.min(Math.max(e.x,t.x),Math.max(n.x,a.x))+f&&Math.max(Math.min(e.y,t.y),Math.min(n.y,a.y))<=Math.min(Math.max(e.y,t.y),Math.max(n.y,a.y))+f:i>0!=u>0&&s>0!=E>0}function Zo(e,t){for(var n=!1,a=0,l=t.length-1;a<t.length;l=a++){var i=t[a],u=t[l];i.y>e.y!=u.y>e.y&&e.x<(u.x-i.x)*(e.y-i.y)/(u.y-i.y)+i.x&&(n=!n)}return n}function $o(e,t,n){if(n.length>=3&&(Zo(e,n)||Zo(t,n)))return!0;for(var a=0;a<n.length;a++)if(Xa(e,t,n[a],n[(a+1)%n.length]))return!0;return!1}function Ko(e){var t=e,n=[],a=null,l=0,i=function(u){return Hn(Hn({},u),{points:u.points.map(function(s){return Hn({},s)})})};return{begin:function(u){var s={id:++l,points:[Hn({},u)],age:0,hitIds:new Set};return a=s,n.push(s),n.length>t.maxStrokes&&n.shift(),s},add:function(u){if(!a||a.points.length>=t.maxPoints)return!1;var s=a.points[a.points.length-1];return Math.hypot(u.x-s.x,u.y-s.y)<t.minSegmentPx?!1:(a.points.push(Hn({},u)),!0)},end:function(){var u=a;return a=null,u?i(u):void 0},cancel:function(){a&&(n=n.filter(function(u){return u!==a})),a=null},clear:function(){a=null,n=[]},tick:function(u){var s,E;try{for(var f=wf(n),b=f.next();!b.done;b=f.next()){var k=b.value;k.age+=u}}catch(z){s={error:z}}finally{try{b&&!b.done&&(E=f.return)&&E.call(f)}finally{if(s)throw s.error}}n=n.filter(function(z){return z===a||z.age<.18||t.mode!=="slice-blade"})},get active(){return a},get strokes(){return n}}}function Qo(e,t){for(var n=[],a=1;a<e.points.length;a++){var l=e.points[a-1],i=e.points[a],u=Math.hypot(i.x-l.x,i.y-l.y);u<.001||n.push({id:"stroke-".concat(e.id,"-").concat(a),strokeId:e.id,mode:"static",shape:"box",x:(l.x+i.x)/2,y:(l.y+i.y)/2,width:u,height:Math.max(2,t),angle:Math.atan2(i.y-l.y,i.x-l.x),restitution:.8})}return n}var wi=function(){return wi=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},wi.apply(this,arguments)},rl=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Pn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Mf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},hn=function(e,t){return Math.hypot(e,t)},Jo=function(e,t,n){return Math.max(t,Math.min(n,e))},Fn=function(e){return Math.max(1,Math.min(e.width,e.height)/2)};function qo(e){var t,n,a=Math.cos((t=e.angle)!==null&&t!==void 0?t:0),l=Math.sin((n=e.angle)!==null&&n!==void 0?n:0),i=e.width/2,u=e.height/2;return[[-i,-u],[i,-u],[i,u],[-i,u]].map(function(s){var E=rl(s,2),f=E[0],b=E[1];return{x:e.x+f*a-b*l,y:e.y+f*l+b*a}})}function Sf(e,t){var n,a,l,i,u,s,E,f,b,k,z=qo(e),re=qo(t),U=[(E=e.angle)!==null&&E!==void 0?E:0,((f=e.angle)!==null&&f!==void 0?f:0)+Math.PI/2,(b=t.angle)!==null&&b!==void 0?b:0,((k=t.angle)!==null&&k!==void 0?k:0)+Math.PI/2],Y=1/0,oe=1,_=0;try{for(var ee=Pn(U),h=ee.next();!h.done;h=ee.next()){var V=h.value,Te=Math.cos(V),Ce=Math.sin(V),xe=1/0,Le=-1/0,Z=1/0,ue=-1/0;try{for(var ie=(l=void 0,Pn(z)),ye=ie.next();!ye.done;ye=ie.next()){var R=ye.value,x=R.x*Te+R.y*Ce;x<xe&&(xe=x),x>Le&&(Le=x)}}catch(J){l={error:J}}finally{try{ye&&!ye.done&&(i=ie.return)&&i.call(ie)}finally{if(l)throw l.error}}try{for(var $=(u=void 0,Pn(re)),D=$.next();!D.done;D=$.next()){var R=D.value,x=R.x*Te+R.y*Ce;x<Z&&(Z=x),x>ue&&(ue=x)}}catch(J){u={error:J}}finally{try{D&&!D.done&&(s=$.return)&&s.call($)}finally{if(u)throw u.error}}var fe=Math.min(Le,ue)-Math.max(xe,Z);if(fe<=0)return null;fe<Y&&(Y=fe,oe=Te,_=Ce)}}catch(J){n={error:J}}finally{try{h&&!h.done&&(a=ee.return)&&a.call(ee)}finally{if(n)throw n.error}}return(e.x-t.x)*oe+(e.y-t.y)*_<0&&(oe=-oe,_=-_),{nx:oe,ny:_,penetration:Y}}function jo(e,t){var n,a,l,i=Fn(e),u=-((n=t.angle)!==null&&n!==void 0?n:0),s=Math.cos(u),E=Math.sin(u),f=e.x-t.x,b=e.y-t.y,k=f*s-b*E,z=f*E+b*s,re=t.width/2,U=t.height/2,Y=Jo(k,-re,re),oe=Jo(z,-U,U),_=k-Y,ee=z-oe,h=hn(_,ee),V;if(h>=i)return null;if(h<1e-4){var Te=[{d:re-Math.abs(k),x:k>=0?1:-1,y:0},{d:U-Math.abs(z),x:0,y:z>=0?1:-1}].sort(function(Le,Z){return Le.d-Z.d});_=Te[0].x,ee=Te[0].y,V=i+Te[0].d}else _/=h,ee/=h,V=i-h;var Ce=Math.cos((a=t.angle)!==null&&a!==void 0?a:0),xe=Math.sin((l=t.angle)!==null&&l!==void 0?l:0);return{nx:_*Ce-ee*xe,ny:_*xe+ee*Ce,penetration:V}}function _o(e,t){var n;return!!(e.ignoreGroup&&e.ignoreGroup!=="none"&&(e.ignoreGroup==="all"||e.ignoreGroup===((n=t.collisionGroup)!==null&&n!==void 0?n:"all")))}function el(e,t,n){var a,l,i,u,s,E;if(!(e.captured||t.captured||_o(e,t)||_o(t,e))){var f=e.x-t.x,b=e.y-t.y,k;if(e.shape==="circle"&&t.shape==="circle"){var z=hn(f,b),re=Fn(e)+Fn(t)-z;if(re<=0)return;k=re,z>1e-4?(f/=z,b/=z):(f=1,b=0)}else if(e.shape==="circle"&&t.shape==="box"){var U=jo(e,t);if(!U)return;f=U.nx,b=U.ny,k=U.penetration}else if(e.shape==="box"&&t.shape==="circle"){var U=jo(t,e);if(!U)return;f=-U.nx,b=-U.ny,k=U.penetration}else if(e.shape==="box"&&t.shape==="box"){var U=Sf(e,t);if(!U)return;f=U.nx,b=U.ny,k=U.penetration}else return;var Y=e.mode==="dynamic"?1/((a=e.mass)!==null&&a!==void 0?a:1):0,oe=t.mode==="dynamic"?1/((l=t.mass)!==null&&l!==void 0?l:1):0,_=Y+oe;if(_){e.x+=f*k*Y/_,e.y+=b*k*Y/_,t.mode==="dynamic"&&(t.x-=f*k*oe/_,t.y-=b*k*oe/_);var ee=e.vx-((i=t.vx)!==null&&i!==void 0?i:0),h=e.vy-((u=t.vy)!==null&&u!==void 0?u:0),V=ee*f+h*b;if(!(V>=0)){var Te=Math.max((s=e.restitution)!==null&&s!==void 0?s:0,(E=t.restitution)!==null&&E!==void 0?E:0),Ce=-(1+Te)*V/_;e.vx+=f*Ce*Y,e.vy+=b*Ce*Y,t.mode==="dynamic"&&(t.vx-=f*Ce*oe,t.vy-=b*Ce*oe),e.atRest=!1,e.restElapsed=0,t.mode==="dynamic"&&(t.atRest=!1,t.restElapsed=0),Math.abs(V)>4&&(n("bodyBounce",e,t,{speed:Math.abs(V)}),t.mode==="dynamic"&&n("bodyBounce",t,e,{speed:Math.abs(V)}))}}}}function kf(e,t,n,a){var l,i;if(!(e.mode!=="dynamic"||e.captured))try{for(var u=Pn(t),s=u.next();!s.done;s=u.next()){var E=s.value,f=E.x-e.x,b=E.y-e.y,k=hn(f,b);if(!(k>=E.radius*2.5)){if(k>E.radius&&k>.001&&E.pullStrength>0){var z=E.pullStrength*(1-k/(E.radius*2.5));e.vx+=f/k*z*n,e.vy+=b/k*z*n}if(k<E.radius&&hn(e.vx,e.vy)<=E.maxCaptureSpeed){e.captured=!0,e.atRest=!0,e.vx=E.stopBody?0:e.vx,e.vy=E.stopBody?0:e.vy,E.stopBody&&(e.x=E.x,e.y=E.y),a("zoneCapture",e,E,{});return}}}}catch(re){l={error:re}}finally{try{s&&!s.done&&(i=u.return)&&i.call(u)}finally{if(l)throw l.error}}}function Cf(e,t){var n,a,l,i,u,s,E=function(z){if(z.broken)return"continue";var re=t.find(function(xe){return xe.id===z.bodyId}),U=t.find(function(xe){return xe.id===z.anchorId});if(!re||re.mode!=="dynamic")return"continue";var Y=(i=(l=U==null?void 0:U.x)!==null&&l!==void 0?l:z.x)!==null&&i!==void 0?i:0,oe=(s=(u=U==null?void 0:U.y)!==null&&u!==void 0?u:z.y)!==null&&s!==void 0?s:0,_=re.x-Y,ee=re.y-oe,h=hn(_,ee);if(h<=z.lengthPx||h<1e-4)return"continue";var V=_/h,Te=ee/h;re.x=Y+V*z.lengthPx,re.y=oe+Te*z.lengthPx;var Ce=re.vx*V+re.vy*Te;Ce>0&&(re.vx-=V*Ce,re.vy-=Te*Ce)};try{for(var f=Pn(e),b=f.next();!b.done;b=f.next()){var k=b.value;E(k)}}catch(z){n={error:z}}finally{try{b&&!b.done&&(a=f.return)&&a.call(f)}finally{if(n)throw n.error}}}function Ua(e){for(var t,n,a,l,i,u,s,E,f,b,k,z=e.bodies,re=e.zones,U=re===void 0?[]:re,Y=e.joints,oe=Y===void 0?[]:Y,_=e.bounds,ee=e.dt,h=e.onEvent,V=h===void 0?function(){}:h,Te=z.filter(function(ce){return ce.mode==="dynamic"&&!ce.captured}),Ce=Te.reduce(function(ce,Se){return Math.max(ce,hn(Se.vx,Se.vy))},0),xe=Te.reduce(function(ce,Se){return Math.min(ce,Fn(Se))},24),Le=Math.min(16,Math.max(1,Math.ceil(Ce*ee/(xe*.45)))),Z=ee/Le,ue=0;ue<Le;ue++){try{for(var ie=(t=void 0,Pn(Te)),ye=ie.next();!ye.done;ye=ie.next()){var R=ye.value;R.vy+=((s=R.gravity)!==null&&s!==void 0?s:0)*Z;var x=hn(R.vx,R.vy);if(x>R.maxSpeed){var $=R.maxSpeed/x;R.vx*=$,R.vy*=$,x=R.maxSpeed}R.x+=R.vx*Z,R.y+=R.vy*Z;var D=Math.max(0,x-((E=R.friction)!==null&&E!==void 0?E:0)*Z),fe=Math.exp(-((f=R.linearDamping)!==null&&f!==void 0?f:0)*Z);if(x>1e-4){var J=D/x*fe;R.vx*=J,R.vy*=J}R.spinToRotation&&(R.angle=((b=R.angle)!==null&&b!==void 0?b:0)+hn(R.vx,R.vy)*Z/Fn(R)*(R.vx<0?-1:1))}}catch(ce){t={error:ce}}finally{try{ye&&!ye.done&&(n=ie.return)&&n.call(ie)}finally{if(t)throw t.error}}for(var Q=0;Q<Te.length;Q++){var R=Te[Q];try{for(var j=(a=void 0,Pn(z)),me=j.next();!me.done;me=j.next()){var le=me.value;le.id!==R.id&&le.mode!=="dynamic"&&el(R,le,V)}}catch(Se){a={error:Se}}finally{try{me&&!me.done&&(l=j.return)&&l.call(j)}finally{if(a)throw a.error}}for(var le=Q+1;le<Te.length;le++)el(Te[le],R,V);var Ie=R.shape==="box"?R.width/2:Fn(R),X=R.shape==="box"?R.height/2:Fn(R);R.wallBounce?(R.x-Ie<_.left&&(R.x=_.left+Ie,R.vx<0&&(V("bodyBounce",R,null,{speed:Math.abs(R.vx)}),R.vx=-R.vx*R.restitution)),R.x+Ie>_.right&&(R.x=_.right-Ie,R.vx>0&&(V("bodyBounce",R,null,{speed:Math.abs(R.vx)}),R.vx=-R.vx*R.restitution)),R.y-X<_.top&&(R.y=_.top+X,R.vy<0&&(V("bodyBounce",R,null,{speed:Math.abs(R.vy)}),R.vy=-R.vy*R.restitution)),R.y+X>_.bottom&&(R.y=_.bottom-X,R.vy>0&&(V("bodyBounce",R,null,{speed:Math.abs(R.vy)}),R.vy=-R.vy*R.restitution))):!R.exited&&(R.x+Ie<_.left||R.x-Ie>_.right||R.y+X<_.top||R.y-X>_.bottom)&&(R.exited=!0,V("boundaryExit",R,null,{})),kf(R,U,Z,V)}Cf(oe,z)}try{for(var ve=Pn(Te),Ve=ve.next();!Ve.done;Ve=ve.next()){var R=Ve.value,x=hn(R.vx,R.vy);x<R.restSpeed&&!R.captured?(R.restElapsed=((k=R.restElapsed)!==null&&k!==void 0?k:0)+ee,R.restElapsed>=R.restDelaySeconds&&!R.atRest&&(R.atRest=!0,R.vx=0,R.vy=0,V("bodyRest",R,null,{}))):x>=R.restSpeed&&(R.restElapsed=0,R.atRest=!1)}}catch(ce){i={error:ce}}finally{try{Ve&&!Ve.done&&(u=ve.return)&&u.call(ve)}finally{if(i)throw i.error}}}function tl(e){for(var t=e.body,n=e.bodies,a=e.zones,l=a===void 0?[]:a,i=e.bounds,u=e.dots,s=u===void 0?8:u,E=e.bounces,f=E===void 0?1:E,b=function(h){return wi({},h)},k=b(t),z=n.filter(function(h){return h.id!==t.id}).map(b),re=Mf([k],rl(z),!1),U=[],Y=0,oe=!1,_=function(h,V,Te,Ce){h==="bodyBounce"&&Ce.sourceId===t.id&&Y++,h==="zoneCapture"&&Ce.sourceId===t.id&&(oe=!0)},ee=0;ee<90&&U.length<s&&!oe&&Y<=f;ee++)Ua({bodies:re,zones:l,bounds:i,dt:1/60,onEvent:function(h,V,Te,Ce){return _(h,V,Te,wi(wi({},Ce),{sourceId:V.id}))}}),ee%Math.max(1,Math.floor(90/s))===0&&U.push({x:k.x,y:k.y});return U}var yn=function(){return yn=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},yn.apply(this,arguments)},Vt=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Nt=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Mi=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},nl=function(e,t,n){return Math.max(t,Math.min(n,e))},Tn=function(e,t){return Math.hypot(t.x-e.x,t.y-e.y)};function il(e){var t=e.id,n=e.nodes,a=e.edges,l=e.gates,i=l===void 0?[]:l,u=e.onEvent,s=u===void 0?function(){}:u,E=new Map(n.map(function(x){return[x.id,yn({},x)]})),f=new Map(a.map(function(x){return[x.id,yn({speedScale:1,enabled:!0,bidirectional:!1,cost:0},x)]})),b=new Map(i.map(function(x){return[x.id,yn({},x)]})),k=new Map,z=k,re=0,U=0,Y=function(x){return E.get(x)},oe=function(x){return Nt([],Vt(b.values()),!1).find(function($){return $.parameters.nodeId===x})},_=function(x){var $=x.parameters;if($.mode==="open")return!0;if($.mode==="closed")return!1;var D=$.openSeconds+$.closedSeconds,fe=(re+$.phaseOffsetSeconds)%D;return fe<$.openSeconds},ee=function(x){return Nt([],Vt(f.values()),!1).filter(function($){return $.enabled&&($.from===x||$.bidirectional&&$.to===x)}).sort(function($,D){return $.id<D.id?-1:$.id>D.id?1:0})},h=function(x,$){return Nt([],Vt(f.values()),!1).find(function(D){return D.enabled&&(D.from===x&&D.to===$||D.bidirectional&&D.from===$&&D.to===x)})};function V(x,$){var D,fe,J,Q;if(x===$)return[x];for(var j=new Map([[x,0]]),me=new Map,le=new Set([x]);le.size;){var Ie=Nt([],Vt(le),!1).sort(function(Vr,Tr){return j.get(Vr)-j.get(Tr)||(Vr<Tr?-1:Vr>Tr?1:0)})[0];if(le.delete(Ie),Ie===$)break;try{for(var X=(D=void 0,Mi(ee(Ie))),ve=X.next();!ve.done;ve=X.next()){var Ve=ve.value,ce=Ve.from===Ie?Ve.to:Ve.from,Se=oe(ce),$e=Y(ce),Xe=Se?Se.parameters.holdSeconds*90+(_(Se)?0:Se.parameters.closedSeconds*90):0,fr=j.get(Ie)+Tn(Y(Ie),$e)/Ve.speedScale+Ve.cost+((J=$e.cost)!==null&&J!==void 0?J:0)+Xe;fr>=((Q=j.get(ce))!==null&&Q!==void 0?Q:1/0)||(j.set(ce,fr),me.set(ce,Ie),le.add(ce))}}catch(Vr){D={error:Vr}}finally{try{ve&&!ve.done&&(fe=X.return)&&fe.call(X)}finally{if(D)throw D.error}}}if(!j.has($))return[];for(var Pr=[$],Or=$;Or!==x;)Or=me.get(Or),Pr.unshift(Or);return Pr}function Te(x){var $,D=x.route.length>=2&&x.segment<x.route.length-1;if(!D){var fe=($=x.route[Math.min(x.segment,x.route.length-1)])!==null&&$!==void 0?$:x.startNode,J=V(fe,x.target);x.route=J.length?J:[fe],x.segment=0,x.distance=0,x.arrived=!1,x.active=x.route.length>=2;return}var Q=x.route[x.segment],j=x.route[x.segment+1],me=Tn(Y(Q),Y(j));if(x.arrived||x.distance>=me-1e-4){var J=V(j,x.target);x.route=J.length?J:[j],x.segment=0,x.distance=0,x.arrived=!1,x.active=x.route.length>=2;return}var le=V(j,x.target);x.route=le.length?Nt([Q],Vt(le),!1):[Q,j],x.segment=0}function Ce(x){var $,D=V(x.startNode,x.targetNode),fe=Y(x.startNode),J=D.length>=2?Y(D[1]):fe,Q=D.length>=2?Math.atan2(J.y-fe.y,J.x-fe.x):0,j=Math.floor((Q%(Math.PI*2)+Math.PI*2+1e-6)%(Math.PI*2)/(Math.PI/2))%4,me=yn(yn({},x),{loop:($=x.loop)!==null&&$!==void 0?$:"none",originNode:x.startNode,destinationNode:x.targetNode,target:x.targetNode,networkId:t,route:D.length?D:[x.startNode],segment:0,distance:0,x:fe.x,y:fe.y,heading:Q,frame:[0,1,2,3][j],flipX:Math.cos(Q)<0,hold:0,arrived:!1,active:x.active&&D.length>=2,blockedTicks:0,blockedEmitted:!1,speedMultiplier:1});return k.set(me.id,me),me}function xe(x){if(Le("pathArrive",x,x.target),x.loop==="none"){x.active=!1;return}var $=x.target,D=x.loop==="ping-pong"?$===x.destinationNode?x.originNode:x.destinationNode:$===x.originNode?x.destinationNode:x.originNode;x.startNode=$,x.target=D,x.route=V($,D),x.segment=0,x.distance=0,x.arrived=!1,x.route.length<2&&(x.active=!1)}function Le(x,$,D){s(x,{componentId:$.id,nodeId:D})}function Z(x,$){var D,fe,J=x.route[x.segment+1],Q=oe(J);if(Q&&!_(Q)){x.blockedTicks++,x.blockedTicks>=30&&!x.blockedEmitted&&(x.blockedEmitted=!0,Le("pathBlocked",x,J));return}if(!x.arrived){if(x.arrived=!0,x.segment+1===x.route.length-1){J===x.target?xe(x):(x.active=!1,x.blockedEmitted||(x.blockedEmitted=!0,Le("pathBlocked",x,J)));return}x.hold=Math.max((D=Y(J).holdSeconds)!==null&&D!==void 0?D:0,(fe=Q==null?void 0:Q.parameters.holdSeconds)!==null&&fe!==void 0?fe:0)}if(x.hold>0){x.hold=Math.max(0,x.hold-$),x.blockedTicks++,x.blockedTicks>=30&&!x.blockedEmitted&&(x.blockedEmitted=!0,Le("pathBlocked",x,J));return}x.segment++,x.distance=0,x.arrived=!1,x.blockedTicks=0,x.blockedEmitted=!1}function ue(x,$){var D,fe;if(x.spacing<=0)return $;var J=x.route[x.segment],Q=x.route[x.segment+1],j=Tn(Y(J),Y(Q)),me=j-x.distance,le=$;try{for(var Ie=Mi(z.values()),X=Ie.next();!X.done;X=Ie.next()){var ve=X.value;if(!(ve.id===x.id||!ve.active||ve.route.length<2||ve.segment>=ve.route.length-1)){var Ve=ve.route[ve.segment],ce=ve.route[ve.segment+1],Se=1/0;if(Ve===J&&ce===Q&&(ve.distance>x.distance||ve.distance===x.distance&&ve.id<x.id))Se=ve.distance-x.distance;else if(Ve===Q)Se=me+ve.distance;else if(ce===Q&&Ve!==J){var $e=Tn(Y(Ve),Y(ce))-ve.distance;$e<x.spacing&&($e<me||$e===me&&ve.id<x.id)&&(Se=me)}Se<1/0&&(le=Math.min(le,Math.max(0,Se-x.spacing)))}}}catch(Xe){D={error:Xe}}finally{try{X&&!X.done&&(fe=Ie.return)&&fe.call(Ie)}finally{if(D)throw D.error}}return le}function ie(x){var $=Y(x.route[x.segment]),D=Y(x.route[x.segment+1]),fe=Tn($,D),J=nl(x.distance/Math.max(1e-4,fe),0,1),Q=$.x+(D.x-$.x)*J,j=$.y+(D.y-$.y)*J,me=Math.atan2(D.y-$.y,D.x-$.x),le=Math.min(x.cornerRadius,fe/3),Ie=x.route[x.segment+2];if(le>0&&Ie){var X=Y(Ie),ve=Tn(D,X),Ve=Math.min(le,ve/3);if(x.distance>fe-le){var ce={x:D.x-(D.x-$.x)/fe*le,y:D.y-(D.y-$.y)/fe*le},Se={x:D.x+(X.x-D.x)/ve*Ve,y:D.y+(X.y-D.y)/ve*Ve},$e=nl((x.distance-(fe-le))/(le*2),0,.5),Xe=1-$e;Q=Xe*Xe*ce.x+2*Xe*$e*D.x+$e*$e*Se.x,j=Xe*Xe*ce.y+2*Xe*$e*D.y+$e*$e*Se.y;var fr=2*Xe*(D.x-ce.x)+2*$e*(Se.x-D.x),Pr=2*Xe*(D.y-ce.y)+2*$e*(Se.y-D.y);Math.abs(fr)+Math.abs(Pr)>.001&&(me=Math.atan2(Pr,fr))}}return{x:Q,y:j,heading:me}}function ye(x){var $,D,fe,J;re+=x,U++;var Q=Nt([],Vt(k.values()),!1).sort(function(Ke,bt){return Ke.id<bt.id?-1:Ke.id>bt.id?1:0}),j=Q.length?U%Q.length:0,me=Nt(Nt([],Vt(Q.slice(j)),!1),Vt(Q.slice(0,j)),!1);try{for(var le=Mi(me),Ie=le.next();!Ie.done;Ie=le.next()){var X=Ie.value;if(!(!X.active||X.route.length<2||X.segment>=X.route.length-1)){var ve=X.route[X.segment],Ve=X.route[X.segment+1],ce=Tn(Y(ve),Y(Ve));if(!(X.distance>=ce-1e-4&&(Z(X,x),!X.active||X.route.length<2||X.segment>=X.route.length-1))){var Se=X.route[X.segment],$e=X.route[X.segment+1],Xe=Tn(Y(Se),Y($e)),fr=Xe-X.distance,Pr=(J=(fe=h(Se,$e))===null||fe===void 0?void 0:fe.speedScale)!==null&&J!==void 0?J:1,Or=Math.min(fr,X.speed*Pr*Math.max(0,X.speedMultiplier)*x),Vr=ue(X,Or);Vr<=1e-4?(X.blockedTicks++,X.blockedTicks>=30&&!X.blockedEmitted&&(X.blockedEmitted=!0,Le("pathBlocked",X,$e))):(X.distance+=Vr,X.blockedTicks=0,X.blockedEmitted=!1);var Tr=ie(X);X.x=Tr.x,X.y=Tr.y,X.heading=Tr.heading;var pn=Math.floor((X.heading%(Math.PI*2)+Math.PI*2+1e-6)%(Math.PI*2)/(Math.PI/2))%4;X.frame=[0,1,2,3][pn],X.flipX=Math.cos(X.heading)<0}}}}catch(Ke){$={error:Ke}}finally{try{Ie&&!Ie.done&&(D=le.return)&&D.call(le)}finally{if($)throw $.error}}}function R(){return{id:t,nodeCount:E.size,edgeCount:f.size,activeAgents:Nt([],Vt(k.values()),!1).filter(function(x){return x.active}).length,queuedAgents:Nt([],Vt(k.values()),!1).filter(function(x){return x.active&&x.blockedTicks>0}).length,agents:Nt([],Vt(k.values()),!1).map(function(x){var $;return{id:x.id,x:x.x,y:x.y,heading:x.heading,frame:($=x.frame)!==null&&$!==void 0?$:0,flipX:!!x.flipX,active:x.active,targetNode:x.target,route:Nt([],Vt(x.route),!1),segment:x.segment,distance:x.distance,blocked:x.blockedTicks>0}})}}return{addAgent:Ce,removeAgent:function(x){return k.delete(x)},getAgent:function(x){return k.get(x)},setTarget:function(x,$){var D=k.get(x);return!D||!Y($)?!1:(D.target=$,D.destinationNode=$,D.active=!0,Te(D),!0)},setEdge:function(x,$,D){var fe,J,Q=f.get(x);if(!Q)return!1;Q.enabled=$,D!==void 0&&(Q.cost=D);try{for(var j=Mi(k.values()),me=j.next();!me.done;me=j.next()){var le=me.value;Te(le)}}catch(Ie){fe={error:Ie}}finally{try{me&&!me.done&&(J=j.return)&&J.call(j)}finally{if(fe)throw fe.error}}return!0},setGate:function(x,$,D){var fe,J,Q=b.get(x);if(!Q)return!1;Q.parameters=yn(yn({},Q.parameters),{mode:$,holdSeconds:D});try{for(var j=Mi(k.values()),me=j.next();!me.done;me=j.next()){var le=me.value;Te(le)}}catch(Ie){fe={error:Ie}}finally{try{me&&!me.done&&(J=j.return)&&J.call(j)}finally{if(fe)throw fe.error}}return!0},tick:ye,snapshot:R}}var Si=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ra=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},ta=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},na={A:["01110","10001","10001","11111","10001","10001","10001"],B:["11110","10001","10001","11110","10001","10001","11110"],C:["01111","10000","10000","10000","10000","10000","01111"],D:["11110","10001","10001","10001","10001","10001","11110"],E:["11111","10000","10000","11110","10000","10000","11111"],F:["11111","10000","10000","11110","10000","10000","10000"],G:["01111","10000","10000","10111","10001","10001","01111"],H:["10001","10001","10001","11111","10001","10001","10001"],I:["11111","00100","00100","00100","00100","00100","11111"],J:["00111","00010","00010","00010","10010","10010","01100"],K:["10001","10010","10100","11000","10100","10010","10001"],L:["10000","10000","10000","10000","10000","10000","11111"],M:["10001","11011","10101","10101","10001","10001","10001"],N:["10001","11001","10101","10011","10001","10001","10001"],O:["01110","10001","10001","10001","10001","10001","01110"],P:["11110","10001","10001","11110","10000","10000","10000"],Q:["01110","10001","10001","10001","10101","10010","01101"],R:["11110","10001","10001","11110","10100","10010","10001"],S:["01111","10000","10000","01110","00001","00001","11110"],T:["11111","00100","00100","00100","00100","00100","00100"],U:["10001","10001","10001","10001","10001","10001","01110"],V:["10001","10001","10001","10001","10001","01010","00100"],W:["10001","10001","10001","10101","10101","10101","01010"],X:["10001","10001","01010","00100","01010","10001","10001"],Y:["10001","10001","01010","00100","00100","00100","00100"],Z:["11111","00001","00010","00100","01000","10000","11111"],0:["01110","10001","10011","10101","11001","10001","01110"],1:["00100","01100","00100","00100","00100","00100","01110"],2:["01110","10001","00001","00010","00100","01000","11111"],3:["11110","00001","00001","01110","00001","00001","11110"],4:["00010","00110","01010","10010","11111","00010","00010"],5:["11111","10000","10000","11110","00001","00001","11110"],6:["01110","10000","10000","11110","10001","10001","01110"],7:["11111","00001","00010","00100","01000","01000","01000"],8:["01110","10001","10001","01110","10001","10001","01110"],9:["01110","10001","10001","01111","00001","00001","01110"],"!":["00100","00100","00100","00100","00100","00000","00100"],"?":["01110","10001","00001","00010","00100","00000","00100"],".":["00000","00000","00000","00000","00000","00110","00110"],",":["00000","00000","00000","00000","00110","00110","00100"],":":["00000","00110","00110","00000","00110","00110","00000"],"+":["00000","00100","00100","11111","00100","00100","00000"],"-":["00000","00000","00000","11111","00000","00000","00000"],"/":["00001","00010","00010","00100","01000","01000","10000"],"'":["00100","00100","00000","00000","00000","00000","00000"]," ":["000","000","000","000","000","000","000"]},ki=function(e){var t,n,a,l,i=0;try{for(var u=Si(e),s=u.next();!s.done;s=u.next()){var E=s.value;i+=((l=(a=na[E])===null||a===void 0?void 0:a[0].length)!==null&&l!==void 0?l:5)+1}}catch(f){t={error:f}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return Math.max(0,i-1)},Ef=function(e,t){var n,a,l=[],i="";try{for(var u=Si(e),s=u.next();!s.done;s=u.next()){var E=s.value;i&&ki(i+E)>t&&(l.push(i),i=""),i+=E}}catch(f){n={error:f}}finally{try{s&&!s.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}return i&&l.push(i),l};function Pf(e,t,n){var a,l,i,u,s;n===void 0&&(n=1);var E=Math.max(1,Math.floor(t/Math.max(1,n))),f=[];try{for(var b=Si(String(e).toUpperCase().split(`
|
|
2
|
-
`)),k=
|
|
3
|
-
`):
|
|
4
|
-
`&&!na[U]}))),!1),f,b=u;b>=s;b--){var k=Tf(e,t,b,l),z=k.renderedWidth>l,re=k.allLines.length>16||k.renderedHeight>i;if(f={lines:k.lines,scale:b,fontSize:b*8,renderedWidth:k.renderedWidth,renderedHeight:k.renderedHeight,overflowsWidth:z,overflowsHeight:re,unsupportedChars:E},t.autoFit===!1||!z&&!re)break}return f}function ol(e,t,n){var a,l=Ya(t,n),i=l.lines,u=l.scale,s=al(n),E=Math.max(0,n.width-2*s.x),f=Math.max(0,n.height-2*s.y),b=Math.round(l.fontSize*((a=n.lineHeight)!==null&&a!==void 0?a:1.2)),k=s.y+(f-l.renderedHeight)/2;return e.fillStyle=n.color,i.forEach(function(z,re){var U,Y,oe,_=ki(z)*u,ee=n.align==="left"?s.x:n.align==="right"?n.width-_-s.x:s.x+(E-_)/2,h=ee;try{for(var V=Si(z),Te=V.next();!Te.done;Te=V.next()){var Ce=Te.value,xe=(oe=na[Ce])!==null&&oe!==void 0?oe:na["?"];xe.forEach(function(Le,Z){for(var ue=0;ue<Le.length;ue++)Le[ue]==="1"&&e.fillRect(Math.round(h+ue*u),Math.round(k+re*b+Z*u),u,u)}),h+=(xe[0].length+1)*u}}catch(Le){U={error:Le}}finally{try{Te&&!Te.done&&(Y=V.return)&&Y.call(V)}finally{if(U)throw U.error}}}),l}var an=function(){return an=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},an.apply(this,arguments)},Za=Math.PI*2,kr=function(e,t){return((Math.imul(e+1,2654435769)^Math.imul(t,2246822507))>>>0)/4294967296};function $a(e,t,n){var a,l,i=[e.color,e.color2,e.color3].filter(Boolean),u=((a=e.spread)!==null&&a!==void 0?a:360)*Math.PI/180,s=((l=e.direction)!==null&&l!==void 0?l:-90)*Math.PI/180;return Array.from({length:e.count},function(E,f){var b,k,z=s+((f+.2+kr(f,1)*.6)/e.count-.5)*u,re=e.speed*(.42+.65*kr(f,2));return an(an({},t),{clipId:n,shape:"pixel-confetti",age:-.12*kr(f,3),vx:Math.cos(z)*re,vy:Math.sin(z)*re,gravity:(b=e.gravity)!==null&&b!==void 0?b:250,life:((k=e.lifetime)!==null&&k!==void 0?k:.7)*(.6+.4*kr(f,4)),color:i[f%i.length],size:3+Math.floor(3*kr(f,5)),angle:Za*kr(f,6),spin:(kr(f,7)-.5)*12})})}function ll(e){var t=Math.min(12,Math.ceil(Math.sqrt(e.count))),n=Math.ceil(e.count/t),a=e.speed;return $a(e).map(function(l,i){return an(an({},l),{screen:!0,x:(i%t+.15+.7*kr(i,8))/t,y:(Math.floor(i/t)+.15+.7*kr(i,9))/n,vx:a*(kr(i,10)-.5)*.7,vy:a*(.3+.5*kr(i,11)),size:l.size+1})})}var aa=function(e,t){return(e%t+t)%t};function fl(e,t,n){var a=t.x,l=t.y,i=t.vx,u=t.vy,s=t.age,E=t.life,f=t.gravity,b=t.size,k=t.angle,z=t.spin,re=t.color;if(!(s<0)){var U=i*s,Y=u*s+f*s*s/2,oe=Math.round(n?n.x+aa(a*n.width+U,n.width):a+U),_=Math.round(n?n.y+aa(l*n.height+Y,n.height):l+Y),ee=Math.round((k+z*s)/(Math.PI/4))&3;if(e.globalAlpha*=Math.min(1,(E-s)*4),e.fillStyle="#3c293388",ee===0)e.fillRect(oe-b+1,_+1,b*2+1,b+1);else if(ee===2)e.fillRect(oe+1,_-b+1,b+1,b*2+1);else for(var h=-1;h<=1;h++)e.fillRect(oe+h*b+1,_+h*b*(ee===1?1:-1)+1,b+1,b+1);if(e.fillStyle=re,ee===0)e.fillRect(oe-b,_,b*2,b);else if(ee===2)e.fillRect(oe,_-b,b,b*2);else for(var h=-1;h<=1;h++)e.fillRect(oe+h*b,_+h*b*(ee===1?1:-1),b,b)}}function Ka(e,t,n){var a,l,i=[e.color,e.color2,e.color3,"#ff6b6b","#4ecdc4","#fff3b0"].filter(Boolean),u=((a=e.spread)!==null&&a!==void 0?a:360)*Math.PI/180,s=((l=e.direction)!==null&&l!==void 0?l:-90)*Math.PI/180;return Array.from({length:e.count},function(E,f){var b,k,z=s+((f+.2+kr(f,11)*.6)/e.count-.5)*u,re=e.speed*(.45+.65*kr(f,12));return an(an({},t),{clipId:n,shape:"confetti",age:-.15*kr(f,13),vx:Math.cos(z)*re,vy:Math.sin(z)*re,gravity:(b=e.gravity)!==null&&b!==void 0?b:140,life:((k=e.lifetime)!==null&&k!==void 0?k:2.6)*(.75+.35*kr(f,14)),color:i[f%i.length],size:5+Math.floor(5*kr(f,15)),kind:f%5===0?"star":"ribbon",angle:Za*kr(f,16),spin:(kr(f,17)-.5)*5.5,flutter:1.6+2.2*kr(f,18),phase:Za*kr(f,19)})})}function dl(e){var t=Math.min(14,Math.ceil(Math.sqrt(e.count))),n=Math.ceil(e.count/t),a=e.speed;return Ka(e,{x:0,y:0}).map(function(l,i){var u;return an(an({},l),{screen:!0,x:(i%t+.12+.76*kr(i,20))/t,y:(Math.floor(i/t)+.08+.84*kr(i,21))/n,vx:a*(kr(i,22)-.5)*.65,vy:a*(.38+.55*kr(i,23)),gravity:Math.min((u=e.gravity)!==null&&u!==void 0?u:90,90)})})}function ul(e,t,n){var a=t.x,l=t.y,i=t.vx,u=t.vy,s=t.age,E=t.life,f=t.gravity,b=t.size,k=t.angle,z=t.spin,re=t.flutter,U=t.phase,Y=t.color,oe=t.kind;if(!(s<0)){var _=Math.sin(s*re+U)*14,ee=i*s+_,h=u*s+f*s*s/2,V=n?n.x+aa(a*n.width+ee,n.width):a+ee,Te=n?n.y+aa(l*n.height+h,n.height):l+h,Ce=Math.min(1,s*2.8,(E-s)*2.2);if(!(Ce<=0)){e.save(),e.globalAlpha*=Ce,e.translate(V,Te),e.rotate(k+z*s);var xe=Math.cos(s*re*1.4+U);if(e.scale(1,Math.max(.22,Math.abs(xe))),e.fillStyle=Y,oe==="star"){var Le=b*.85;e.beginPath();for(var Z=0;Z<8;Z++){var ue=Z%2===0?Le:Le*.38,ie=Z*Math.PI/4;Z===0?e.moveTo(Math.cos(ie)*ue,Math.sin(ie)*ue):e.lineTo(Math.cos(ie)*ue,Math.sin(ie)*ue)}e.closePath(),e.fill()}else e.fillRect(-b*.7,-b*.34,b*1.4,b*.68),e.fillStyle="#ffffff55",e.fillRect(-b*.7,-b*.34,b*1.4,b*.2);e.restore()}}}function vl(e,t,n,a,l){var i=t.width,u=t.height;if(!(i<=0||u<=0)){var s=Math.min(3,Math.floor(Math.min(i,u)/8));if(!s){e.fillStyle=n,e.fillRect(0,0,i,u);return}var E=a?s*2:0,f=u-(a?s:s*3),b=l>=0?.5+.5*Math.sin(l*4):0;t.enabled&&!a&&l>=0&&(e.save(),e.shadowColor="#ffd05a99",e.shadowBlur=8+b*9,e.fillStyle=n,e.fillRect(s,E+s,i-2*s,u-E-2*s),e.restore()),e.fillStyle=t.stroke,e.fillRect(s,0,i-2*s,u),e.fillRect(0,s,i,u-2*s),e.fillStyle=n,e.fillRect(s,E+s,i-2*s,u-E-2*s),e.fillStyle="#431d1380",e.fillRect(s,f,i-2*s,u-s-f),e.fillStyle=t.enabled?"#fff4be":"#ffffff55",e.fillRect(2*s,E+s,i-4*s,a?s:s*2),e.fillStyle="#ffffff55",e.fillRect(s,E+3*s,s,Math.max(0,f-E-3*s)),e.fillStyle="#521b2444",e.fillRect(i-2*s,E+3*s,s,Math.max(0,f-E-3*s));var k=l>=0?l%1.9:-1,z=(k-.1)/.55;if(t.enabled&&!a&&z>=0&&z<1){e.save(),e.beginPath(),e.rect(2*s,E+3*s,i-4*s,Math.max(0,f-E-3*s)),e.clip();for(var re=Math.floor(((i+14*s)*z-6*s)/s)*s,U=E+3*s,Y=0;U<f;U+=s,Y++){var oe=re-Math.floor(Y/2)*s;e.fillStyle="#fff4be44",e.fillRect(oe-2*s,U,9*s,s),e.fillStyle="#fffef0aa",e.fillRect(oe,U,4*s,s)}e.restore()}if(t.enabled&&!a&&l>=0){var _=Math.max(0,Math.sin(l*4.2)),ee=Math.max(0,Math.sin(l*4.2+2.2)),h=function(V,Te,Ce){if(!(Ce<.25)){e.save(),e.globalAlpha*=Ce*.95,e.fillStyle="#fffef4";var xe=Ce>.65?s*2:s;e.fillRect(Math.round(V-xe),Math.round(Te-s/2),xe*2+s,s),e.fillRect(Math.round(V-s/2),Math.round(Te-xe),s,xe*2+s),e.restore()}};h(5*s,E+4*s,_),h(i-6*s,E+5*s,ee)}}}function ia(e,t,n,a,l,i){var u=Math.max(0,Math.min(i,a/2,l/2));e.beginPath(),typeof e.roundRect=="function"?e.roundRect(t,n,a,l,u):(e.moveTo(t+u,n),e.arcTo(t+a,n,t+a,n+l,u),e.arcTo(t+a,n+l,t,n+l,u),e.arcTo(t,n+l,t,n,u),e.arcTo(t,n,t+a,n,u),e.closePath())}function Ga(e,t,n,a,l){if(!(l<=.02||a<=.5)){e.save(),e.translate(t,n),e.globalAlpha*=l,e.fillStyle="#fffef0",e.beginPath();for(var i=0;i<8;i++){var u=i%2===0?a:a*.24,s=i*Math.PI/4;i===0?e.moveTo(Math.cos(s)*u,Math.sin(s)*u):e.lineTo(Math.cos(s)*u,Math.sin(s)*u)}e.closePath(),e.fill(),e.restore()}}function sl(e,t,n,a,l){var i,u,s,E=t.width,f=t.height;if(!(E<=0||f<=0)){var b=Math.min((i=t.radius)!==null&&i!==void 0?i:16,E/2,f/2),k=a?2:6,z=a?3:0,re=l>=0?.5-.5*Math.cos(l*2.4):0;t.enabled&&!a&&l>=0&&(e.save(),e.shadowColor="#ffd23f99",e.shadowBlur=10+re*12,ia(e,0,z,E,f-z,b),e.fillStyle=n,e.fill(),e.restore()),e.save(),ia(e,0,z+2,E,Math.max(4,f-z-2),b),e.fillStyle="#0e2830",e.fill(),e.restore(),e.save(),ia(e,0,z,E,Math.max(4,f-k),b),e.fillStyle=n,e.fill(),e.clip();var U=(u=e.createLinearGradient)===null||u===void 0?void 0:u.call(e,0,z,0,f-k);if(U!=null&&U.addColorStop&&(U.addColorStop(0,"#ffffffa8"),U.addColorStop(.42,"#ffffff26"),U.addColorStop(.45,"#00000000"),U.addColorStop(1,"#00000024"),e.fillStyle=U,e.fillRect(0,z,E,f-k)),e.fillStyle="#fffef0bb",e.fillRect(b*.55,z+3,Math.max(0,E-b*1.1),3),t.enabled&&!a&&l>=0){var Y=(l%2.4-.15)/.95;if(Y>0&&Y<1){var oe=Y*Y*(3-2*Y),_=Math.sin(Y*Math.PI),ee=-E*.36+E*1.72*oe;e.save(),e.globalAlpha*=_,e.translate(ee,z),e.transform(1,0,-.36,1,0,0);var h=(s=e.createLinearGradient)===null||s===void 0?void 0:s.call(e,-48,0,48,0);h!=null&&h.addColorStop?(h.addColorStop(0,"#ffffff00"),h.addColorStop(.32,"#ffffff48"),h.addColorStop(.5,"#fffef8cc"),h.addColorStop(.68,"#ffffff48"),h.addColorStop(1,"#ffffff00"),e.fillStyle=h,e.fillRect(-48,0,96,f)):(e.fillStyle="#fffef8a8",e.fillRect(-14,0,28,f)),e.restore()}}if(e.restore(),t.strokeWidth&&(e.save(),ia(e,0,z,E,Math.max(4,f-k),b),e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,e.stroke(),e.restore()),t.enabled&&!a&&l>=0){var V=Math.max(0,Math.sin(l*2.4)),Te=V*V,Ce=Math.max(0,Math.sin(l*2.4+2.1)),xe=Ce*Ce,Le=Math.max(0,Math.sin(l*2.4+4.2)),Z=Le*Le;Ga(e,E*.12,z+9,4+Te*6,Te*.92),Ga(e,E*.88,z+10,3.8+xe*5.5,xe*.9),Ga(e,E*.76,Math.max(z+14,f-k-8),3+Z*4.2,Z*.8)}}}function oa(e){if(/\s/.test(e)||e.length>512)return!1;var t=/^https:\/\/play\.google\.com\/store\/apps\/details\?id=[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*){1,9}$/,n=/^https:\/\/apps\.apple\.com\/([a-z]{2}\/)?app\/([a-zA-Z0-9-]+\/)?id[1-9][0-9]{5,19}$/;return t.test(e)&&!/id=example\.|[.=]placeholder(\.|$)|id=com\.example(\.|$)/.test(e)||n.test(e)}var Ci=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ei=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Qa=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function cl(e){var t,n,a;e===void 0&&(e={});var l=(t=e.timeoutMs)!==null&&t!==void 0?t:5e3,i=(n=e.pollMs)!==null&&n!==void 0?n:25;if(![l,i].every(function(J){return Number.isFinite(J)&&J>=1&&J<=6e4}))throw Error("Invalid Unity host deadline/poll interval");var u=(a=e.getHost)!==null&&a!==void 0?a:(function(){return window.mraid}),s=new Set,E=new Set,f=[],b={},k=!1,z=!1,re=!1,U=!1,Y=!1,oe=!1,_,ee,h,V,Te,Ce,xe=function(){return re||U};function Le(){var J,Q,j;clearTimeout(Te),clearTimeout(Ce);try{for(var me=Ci(f.splice(0)),le=me.next();!le.done;le=me.next()){var Ie=Ei(le.value,2),X=Ie[0],ve=Ie[1];try{(j=b.mraid)===null||j===void 0||j.removeEventListener(X,ve)}catch{}}}catch(Ve){J={error:Ve}}finally{try{le&&!le.done&&(Q=me.return)&&Q.call(me)}finally{if(J)throw J.error}}}function Z(J){V==null||V(J instanceof Error?J:Error(String(J))),h=void 0,V=void 0}function ue(J){var Q,j;if(!xe()){var me=k;if(re=!0,k=!1,z=!1,Le(),Z(J),me)try{for(var le=Ci(Qa([],Ei(E),!1)),Ie=le.next();!Ie.done;Ie=le.next()){var X=Ie.value;X()}}catch(ve){Q={error:ve}}finally{try{Ie&&!Ie.done&&(j=le.return)&&j.call(le)}finally{if(Q)throw Q.error}}s.clear(),E.clear()}}function ie(J,Q){return f.push([J,Q]),b.mraid.addEventListener(J,Q),ye(J,Q)}function ye(J,Q){if(xe()){try{b.mraid.removeEventListener(J,Q)}catch{}return!1}return!0}function R(J){var Q,j;if(!xe()){if(typeof J!="boolean"){ue(Error("Invalid Unity viewability event"));return}if(!k){_=J;return}if(z!==J){z=J;try{for(var me=Ci(Qa([],Ei(s),!1)),le=me.next();!le.done;le=me.next()){var Ie=le.value;if(xe())break;Ie(z)}}catch(X){Q={error:X}}finally{try{le&&!le.done&&(j=me.return)&&j.call(me)}finally{if(Q)throw Q.error}}}}}var x=function(J){J==="hidden"&&ue(Error("Unity host closed"))},$=function(){var J;k&&!xe()&&((J=e.onResize)===null||J===void 0||J.call(e))};function D(){var J,Q,j,me;if(!(!Y||k||oe||xe())){oe=!0;try{var le=b.mraid.getState();if(xe()||le==="loading")return;if(le==="hidden")throw Error("Unity host closed before ready");if(!["default","expanded","resized"].includes(le))throw Error("Invalid Unity host state");var Ie=b.mraid.getVersion();if(xe())return;if(Ie!=="3.0")throw Error("Unity Ads UA requires MRAID 3.0");try{for(var X=Ci([["viewableChange",R],["stateChange",x],["sizeChange",$]]),ve=X.next();!ve.done;ve=X.next()){var Ve=Ei(ve.value,2),ce=Ve[0],Se=Ve[1];if(!ie(ce,Se))return}}catch(Or){J={error:Or}}finally{try{ve&&!ve.done&&(Q=X.return)&&Q.call(X)}finally{if(J)throw J.error}}var $e=b.mraid.isViewable();if(xe())return;if(typeof $e!="boolean")throw Error("Invalid Unity initial viewability");z=_!=null?_:$e,k=!0,clearTimeout(Te),clearTimeout(Ce),h==null||h(),h=void 0,V=void 0;try{for(var Xe=Ci(Qa([],Ei(s),!1)),fr=Xe.next();!fr.done;fr=Xe.next()){var Pr=fr.value;if(xe())break;Pr(z)}}catch(Or){j={error:Or}}finally{try{fr&&!fr.done&&(me=Xe.return)&&me.call(Xe)}finally{if(j)throw j.error}}}catch(Or){ue(Or)}finally{oe=!1}}}function fe(){if(!xe())try{var J=u();if(xe())return;if(!J){Ce=setTimeout(fe,i);return}if(b.mraid=J,f.push(["ready",D]),b.mraid.addEventListener("ready",D),!ye("ready",D))return;Y=!0,D()}catch(Q){ue(Q)}}return{init:function(){return ee||(ee=new Promise(function(J,Q){h=J,V=Q}),xe()?(Z(Error("Unity bridge destroyed")),ee):(Te=setTimeout(function(){return ue(Error("Unity MRAID readiness timed out"))},l),fe(),ee))},isReady:function(){return k&&!xe()},isVisible:function(){return k&&z&&!xe()},isClosed:xe,onVisibilityChanged:function(J){return xe()||s.add(J),function(){return s.delete(J)}},onClosed:function(J){return xe()||E.add(J),function(){return E.delete(J)}},openStore:function(J){if(!k||!z||xe()||!oa(J))throw Error("Unity store request not permitted");b.mraid.open(J)},destroy:function(){U||(U=!0,k=!1,z=!1,Le(),Z(Error("Unity bridge destroyed")),s.clear(),E.clear())}}}var ti=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ni=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Ja=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function hl(e){var t;e===void 0&&(e={});var n=(t=e.getHost)!==null&&t!==void 0?t:(function(){return window.mraid}),a,l=!1,i=!1,u=!1,s=!1,E=!1,f,b,k,z,re,U=new Set,Y=new Set,oe=[];function _(){var ie,ye;clearTimeout(z),clearTimeout(re);try{for(var R=ti(oe.splice(0)),x=R.next();!x.done;x=R.next()){var $=ni(x.value,2),D=$[0],fe=$[1];try{a==null||a.removeEventListener(D,fe)}catch{}}}catch(J){ie={error:J}}finally{try{x&&!x.done&&(ye=R.return)&&ye.call(R)}finally{if(ie)throw ie.error}}}function ee(ie,ye){if(oe.push([ie,ye]),a.addEventListener(ie,ye),u||s){try{a.removeEventListener(ie,ye)}catch{}return!1}return!0}function h(ie){var ye=ie instanceof Error?ie:Error(String(ie));k==null||k(ye),b=void 0,k=void 0}function V(ie,ye){var R,x;if(!(u||s)&&(u=!0,l=!1,i=!1,_(),h(ie),ye))try{for(var $=ti(Ja([],ni(Y),!1)),D=$.next();!D.done;D=$.next()){var fe=D.value;fe()}}catch(J){R={error:J}}finally{try{D&&!D.done&&(x=$.return)&&x.call($)}finally{if(R)throw R.error}}}function Te(){var ie,ye,R,x;if(!(!E||l||u||s))try{var $=a.getState();if(u||s||$==="loading")return;if($==="hidden"){V(Error("MRAID closed before ready"),!0);return}if(!["default","expanded","resized"].includes($))throw Error("Invalid MRAID state");try{for(var D=ti([["viewableChange",xe],["stateChange",Le],["sizeChange",Z]]),fe=D.next();!fe.done;fe=D.next()){var J=ni(fe.value,2),Q=J[0],j=J[1];if(!ee(Q,j))return}}catch(X){ie={error:X}}finally{try{fe&&!fe.done&&(ye=D.return)&&ye.call(D)}finally{if(ie)throw ie.error}}var me=a.isViewable();if(u||s)return;if(typeof me!="boolean")throw Error("Invalid MRAID viewability");i=me,l=!0,clearTimeout(z),clearTimeout(re),b==null||b(),b=void 0,k=void 0;try{for(var le=ti(Ja([],ni(U),!1)),Ie=le.next();!Ie.done;Ie=le.next()){var j=Ie.value;j(i)}}catch(X){R={error:X}}finally{try{Ie&&!Ie.done&&(x=le.return)&&x.call(le)}finally{if(R)throw R.error}}}catch(X){V(X,l)}}var Ce=function(){return Te()},xe=function(ie){var ye,R;if(!(!l||u||s)){if(typeof ie!="boolean"){V(Error("Invalid MRAID visibility event"),!0);return}i=ie;try{for(var x=ti(Ja([],ni(U),!1)),$=x.next();!$.done;$=x.next()){var D=$.value;D(i)}}catch(fe){ye={error:fe}}finally{try{$&&!$.done&&(R=x.return)&&R.call(x)}finally{if(ye)throw ye.error}}}},Le=function(ie){ie==="hidden"&&V(Error("MRAID closed"),!0)},Z=function(){var ie;l&&!u&&!s&&((ie=e.onResize)===null||ie===void 0||ie.call(e))};function ue(){var ie,ye,R;if(!(u||s))try{if(a=n(),u||s)return;if(!a){re=setTimeout(ue,(R=e.pollMs)!==null&&R!==void 0?R:50);return}if(![a.getState,a.isViewable,a.addEventListener,a.removeEventListener,a.open].every(function(Q){return typeof Q=="function"}))throw Error("Incomplete MRAID 2 interface");try{for(var x=ti([["ready",Ce]]),$=x.next();!$.done;$=x.next()){var D=ni($.value,2),fe=D[0],J=D[1];if(!ee(fe,J))return}}catch(Q){ie={error:Q}}finally{try{$&&!$.done&&(ye=x.return)&&ye.call(x)}finally{if(ie)throw ie.error}}E=!0,Te()}catch(Q){V(Q,!1)}}return{init:function(){var ie;return f||(f=new Promise(function(ye,R){b=ye,k=R}),u||s?(h(Error("MRAID bridge destroyed")),f):(z=setTimeout(function(){return V(Error("MRAID readiness timed out"),!1)},(ie=e.timeoutMs)!==null&&ie!==void 0?ie:5e3),ue(),f))},isReady:function(){return l&&!u&&!s},isVisible:function(){return i&&l&&!u&&!s},isClosed:function(){return u||s},onVisibilityChanged:function(ie){return!u&&!s&&U.add(ie),function(){return U.delete(ie)}},onClosed:function(ie){return!u&&!s&&Y.add(ie),function(){return Y.delete(ie)}},openStore:function(ie){if(!l||!i||u||s||!oa(ie))throw Error("MRAID store request not permitted");a.open(ie)},destroy:function(){s||(s=!0,l=!1,i=!1,_(),h(Error("MRAID bridge destroyed")),U.clear(),Y.clear())}}}var Xn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Un=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Pi=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function yl(e){e===void 0&&(e={});var t=new Set,n=new Set,a=new Set,l=[],i,u=!1,s=!1,E=!1,f=!1,b,k,z,re,U,Y=function(){return E||f};function oe(){var Z,ue;clearTimeout(re),clearTimeout(U);try{for(var ie=Xn(l.splice(0)),ye=ie.next();!ye.done;ye=ie.next()){var R=Un(ye.value,2),x=R[0],$=R[1];try{i==null||i.removeEventListener(x,$)}catch{}}}catch(D){Z={error:D}}finally{try{ye&&!ye.done&&(ue=ie.return)&&ue.call(ie)}finally{if(Z)throw Z.error}}}function _(Z){var ue,ie;if(!Y()){E=!0,u=!1,s=!1,oe(),z==null||z(Z instanceof Error?Z:Error(String(Z))),k=void 0,z=void 0;try{for(var ye=Xn(Pi([],Un(n),!1)),R=ye.next();!R.done;R=ye.next()){var x=R.value;x()}}catch($){ue={error:$}}finally{try{R&&!R.done&&(ie=ye.return)&&ie.call(ye)}finally{if(ue)throw ue.error}}}}var ee=function(Z){if(!(typeof Z!="number"||!Number.isFinite(Z)||Z<0))return Math.min(1,Z>1?Z/100:Z)},h=function(Z){if(typeof Z=="boolean")return Z;if(Z&&typeof Z=="object"&&typeof Z.isViewable=="boolean")return Z.isViewable},V=function(){var Z,ue,ie,ye,R,x;if(!(u||Y()||!i||((R=i.isReady)===null||R===void 0?void 0:R.call(i))===!1))try{s=i.isViewable();var $=(x=i.getAudioVolume)===null||x===void 0?void 0:x.call(i),D=$===void 0?void 0:ee($);if(typeof s!="boolean"||$!==void 0&&D===void 0)throw Error("Invalid DAPI initial state");if(u=!0,clearTimeout(re),clearTimeout(U),k==null||k(),k=void 0,z=void 0,D!==void 0)try{for(var fe=Xn(Pi([],Un(a),!1)),J=fe.next();!J.done;J=fe.next()){var Q=J.value;Q(D)}}catch(le){Z={error:le}}finally{try{J&&!J.done&&(ue=fe.return)&&ue.call(fe)}finally{if(Z)throw Z.error}}try{for(var j=Xn(Pi([],Un(t),!1)),me=j.next();!me.done;me=j.next()){var Q=me.value;Q(s)}}catch(le){ie={error:le}}finally{try{me&&!me.done&&(ye=j.return)&&ye.call(j)}finally{if(ie)throw ie.error}}}catch(le){_(le)}},Te=function(Z){var ue,ie;if(!Y()){var ye=h(Z);if(ye===void 0){_(Error("Invalid DAPI visibility"));return}s=ye;try{for(var R=Xn(Pi([],Un(t),!1)),x=R.next();!x.done;x=R.next()){var $=x.value;$(ye)}}catch(D){ue={error:D}}finally{try{x&&!x.done&&(ie=R.return)&&ie.call(R)}finally{if(ue)throw ue.error}}}},Ce=function(Z){var ue,ie;if(!Y()){var ye=ee(Z);if(ye===void 0){_(Error("Invalid DAPI volume"));return}try{for(var R=Xn(Pi([],Un(a),!1)),x=R.next();!x.done;x=R.next()){var $=x.value;$(ye)}}catch(D){ue={error:D}}finally{try{x&&!x.done&&(ie=R.return)&&ie.call(R)}finally{if(ue)throw ue.error}}}},xe=function(){var Z;u&&!Y()&&((Z=e.onResize)===null||Z===void 0||Z.call(e))};function Le(){var Z,ue,ie;if(!Y()){if(i=window.dapi,!i){U=setTimeout(Le,(ie=e.pollMs)!==null&&ie!==void 0?ie:25);return}try{try{for(var ye=Xn([["ready",V],["viewableChange",Te],["audioVolumeChange",Ce],["adResized",xe]]),R=ye.next();!R.done;R=ye.next()){var x=Un(R.value,2),$=x[0],D=x[1];l.push([$,D]),i.addEventListener($,D)}}catch(fe){Z={error:fe}}finally{try{R&&!R.done&&(ue=ye.return)&&ue.call(ye)}finally{if(Z)throw Z.error}}V()}catch(fe){_(fe)}}}return{init:function(){var Z;return b||(b=new Promise(function(ue,ie){k=ue,z=ie}),Y()?(z==null||z(Error("DAPI bridge closed")),b):(re=setTimeout(function(){return _(Error("DAPI readiness timed out"))},(Z=e.timeoutMs)!==null&&Z!==void 0?Z:5e3),Le(),b))},isReady:function(){return u&&!Y()},isVisible:function(){return u&&s&&!Y()},isClosed:Y,onVisibilityChanged:function(Z){return Y()||t.add(Z),function(){return t.delete(Z)}},onClosed:function(Z){return Y()||n.add(Z),function(){return n.delete(Z)}},onVolumeChanged:function(Z){return Y()||a.add(Z),function(){return a.delete(Z)}},openStore:function(){if(!u||!s||Y()||typeof(i==null?void 0:i.openStoreUrl)!="function")throw Error("DAPI store host unavailable");i.openStoreUrl()},destroy:function(){f||(f=!0,u=!1,s=!1,oe(),z==null||z(Error("DAPI bridge destroyed")),t.clear(),n.clear(),a.clear())}}}var Af=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Rf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Of=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Vf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Nf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function pl(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,u;if(!a){n=document.visibilityState!=="hidden";try{for(var s=Nf(Vf([],Of(e),!1)),E=s.next();!E.done;E=s.next()){var f=E.value;f(n)}}catch(b){i={error:b}}finally{try{E&&!E.done&&(u=s.return)&&u.call(s)}finally{if(i)throw i.error}}}};return{init:function(){return Af(this,void 0,void 0,function(){return Rf(this,function(i){switch(i.label){case 0:if(a)throw Error("Meta bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(u){return document.addEventListener("DOMContentLoaded",function(){return u()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("Meta bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i=window.FbPlayableAd;if(!t||!n||a||typeof(i==null?void 0:i.onCTAClick)!="function")throw Error("Meta CTA host unavailable");i.onCTAClick()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var zf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Bf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Wf=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Lf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Df=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function ml(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,u;if(!a){n=document.visibilityState!=="hidden";try{for(var s=Df(Lf([],Wf(e),!1)),E=s.next();!E.done;E=s.next()){var f=E.value;f(n)}}catch(b){i={error:b}}finally{try{E&&!E.done&&(u=s.return)&&u.call(s)}finally{if(i)throw i.error}}}};return{init:function(){return zf(this,void 0,void 0,function(){return Bf(this,function(i){switch(i.label){case 0:if(a)throw Error("Google Ads bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(u){return document.addEventListener("DOMContentLoaded",function(){return u()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("Google Ads bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i=window.ExitApi;if(!t||!n||a||typeof(i==null?void 0:i.exit)!="function")throw Error("Google ExitApi unavailable");i.exit()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var Hf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Ff=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},qa=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},ja=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},_a=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function gl(){var e=window,t=new Set,n=new Set,a=e.gameStart,l=e.gameClose,i=!1,u=!1,s=!1,E=!1,f=function(){var k,z;if(!(s||E)){var re=!u||!i;if(i=!0,u=!0,re)try{for(var U=_a(ja([],qa(t),!1)),Y=U.next();!Y.done;Y=U.next()){var oe=Y.value;oe(!0)}}catch(_){k={error:_}}finally{try{Y&&!Y.done&&(z=U.return)&&z.call(U)}finally{if(k)throw k.error}}}},b=function(){var k,z,re,U;if(!(s||E)){i=!1,u=!1,s=!0;try{for(var Y=_a(ja([],qa(t),!1)),oe=Y.next();!oe.done;oe=Y.next()){var _=oe.value;_(!1)}}catch(V){k={error:V}}finally{try{oe&&!oe.done&&(z=Y.return)&&z.call(Y)}finally{if(k)throw k.error}}try{for(var ee=_a(ja([],qa(n),!1)),h=ee.next();!h.done;h=ee.next()){var _=h.value;_()}}catch(V){re={error:V}}finally{try{h&&!h.done&&(U=ee.return)&&U.call(ee)}finally{if(re)throw re.error}}}};return e.gameStart=f,e.gameClose=b,{init:function(){return Hf(this,void 0,void 0,function(){return Ff(this,function(k){if(s||E)throw Error("Mintegral bridge closed");if(typeof e.gameReady!="function")throw Error("Mintegral gameReady host unavailable");return e.gameReady(),[2]})})},isReady:function(){return i&&!s&&!E},isVisible:function(){return i&&u&&!s&&!E},isClosed:function(){return s||E},onVisibilityChanged:function(k){return!s&&!E&&t.add(k),function(){return t.delete(k)}},onClosed:function(k){return!s&&!E&&n.add(k),function(){return n.delete(k)}},notifyGameEnd:function(){var k;!s&&!E&&((k=e.gameEnd)===null||k===void 0||k.call(e))},notifyGameRetry:function(){var k;!s&&!E&&((k=e.gameRetry)===null||k===void 0||k.call(e))},openStore:function(){if(!i||!u||s||E||typeof e.install!="function")throw Error("Mintegral install host unavailable");e.install()},destroy:function(){E||(E=!0,i=!1,u=!1,e.gameStart===f&&(a?e.gameStart=a:delete e.gameStart),e.gameClose===b&&(l?e.gameClose=l:delete e.gameClose),t.clear(),n.clear())}}}var Xf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Uf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Yf=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},Gf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Zf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Il(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,u;if(!a){n=document.visibilityState!=="hidden";try{for(var s=Zf(Gf([],Yf(e),!1)),E=s.next();!E.done;E=s.next()){var f=E.value;f(n)}}catch(b){i={error:b}}finally{try{E&&!E.done&&(u=s.return)&&u.call(s)}finally{if(i)throw i.error}}}};return{init:function(){return Xf(this,void 0,void 0,function(){return Uf(this,function(i){switch(i.label){case 0:if(a)throw Error("TikTok bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(u){return document.addEventListener("DOMContentLoaded",function(){return u()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("TikTok bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i,u,s=window,E=typeof s.openAppStore=="function"?s.openAppStore.bind(s):(u=(i=s.playableSDK)===null||i===void 0?void 0:i.openAppStore)===null||u===void 0?void 0:u.bind(s.playableSDK);if(!t||!n||a||!E)throw Error("TikTok store host unavailable");E()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var ge=function(){return ge=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},ge.apply(this,arguments)},$f=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function s(b){try{f(a.next(b))}catch(k){u(k)}}function E(b){try{f(a.throw(b))}catch(k){u(k)}}function f(b){b.done?i(b.value):l(b.value).then(s,E)}f((a=a.apply(e,t||[])).next())})},Kf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(b){return E([f,b])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;u&&(u=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(b){f=[6,b],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},K=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],u;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(s){u={error:s}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(u)throw u.error}}return i},ae=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},q=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function bl(e){if(e!=="standalone"){if(e==="unity-ads-ua-playable")return cl();if(e==="applovin-growth-playable")return hl();if(e==="ironsource-levelplay-playable")return yl();if(e==="meta-audience-playable")return pl();if(e==="google-ads-app-playable")return ml();if(e==="mintegral-appgrowth-zip")return gl();if(e==="tiktok-ads-playable")return Il();throw Error("E_NATIVE_TARGET")}}function eo(e){var t=[{id:"sdk-top-left",left:0,top:0,right:Math.min(48,e.width),bottom:Math.min(48,e.height)},{id:"sdk-top-right",left:Math.max(0,e.width-56),top:0,right:e.width,bottom:Math.min(56,e.height)},{id:"sdk-bottom-left",left:0,top:Math.max(0,e.height-28),right:Math.min(48,e.width),bottom:e.height}];return{left:Math.min(48,e.width),top:Math.min(56,e.height),right:Math.max(0,e.width-56),bottom:Math.max(0,e.height-28),zones:t}}function la(e,t){var n,a,l=(a=(n=e.measureText)===null||n===void 0?void 0:n.call(e,t))===null||a===void 0?void 0:a.width,i=/(\d+(?:\.\d+)?)px/.exec(e.font||"");return Number.isFinite(l)?l:ae([],K(t),!1).length*(i?Number(i[1]):16)*.6}function xl(e,t,n,a){var l,i,u,s,E,f,b;e.font=n.fontWeight+" "+a+"px "+n.fontFamily;var k=Math.max(0,n.width-2*((b=n.padding)!==null&&b!==void 0?b:4)),z=[];try{for(var re=q(String(t).split(`
|
|
5
|
-
`)),U=re.next();!U.done;U=re.next()){var Y=U.value;if(n.wrap===!1){z.push(Y);continue}var oe=Y.trim()?Y.trim().split(/\s+/):[""],_=void 0;try{for(var ee=(u=void 0,q(oe)),h=ee.next();!h.done;h=ee.next()){var V=h.value,Te=_?_+" "+V:V;if(la(e,Te)<=k){_=Te;continue}if(_&&z.push(_),la(e,V)<=k){_=V;continue}var Ce="";try{for(var xe=(E=void 0,q(V)),Le=xe.next();!Le.done;Le=xe.next()){var Z=Le.value;Ce&&la(e,Ce+Z)>k?(z.push(Ce),Ce=Z):Ce+=Z}}catch(ue){E={error:ue}}finally{try{Le&&!Le.done&&(f=xe.return)&&f.call(xe)}finally{if(E)throw E.error}}_=Ce}}catch(ue){u={error:ue}}finally{try{h&&!h.done&&(s=ee.return)&&s.call(ee)}finally{if(u)throw u.error}}z.push(_)}}catch(ue){l={error:ue}}finally{try{U&&!U.done&&(i=re.return)&&i.call(re)}finally{if(l)throw l.error}}return z}function wl(e,t,n){var a,l,i=(a=n.padding)!==null&&a!==void 0?a:4,u=Math.max(0,n.width-2*i),s=Math.max(0,n.height-2*i),E=Math.min(n.fontSize,(l=n.minFontSize)!==null&&l!==void 0?l:12),f=n.fontSize,b=xl(e,t,n,f),k,z=function(){var re;e.font=n.fontWeight+" "+f+"px "+n.fontFamily;var U=Math.max.apply(Math,ae([0],K(b.map(function(ee){return la(e,ee)})),!1)),Y=f*((re=n.lineHeight)!==null&&re!==void 0?re:1.2),oe=b.length>16;oe&&(b=b.slice(0,16));var _=b.length*Y;return{lines:b,fontSize:f,scale:f/n.fontSize,renderedWidth:U,renderedHeight:_,availableWidth:u,availableHeight:s,padding:i,lineHeight:Y,overflowsWidth:U>u+.01,overflowsHeight:oe||_>s+.01,unsupportedChars:[]}};if(k=z(),n.autoFit!==!1)for(;(k.overflowsWidth||k.overflowsHeight)&&f>E;)f=Math.max(E,f-1),b=xl(e,t,n,f),k=z();return k}function Qf(e,t,n){var a=wl(e,t,n),l=a.padding;e.fillStyle=n.color,e.font=n.fontWeight+" "+a.fontSize+"px "+n.fontFamily,e.textAlign=n.align,e.textBaseline="middle";var i=n.align==="left"?l:n.align==="right"?n.width-l:n.width/2,u=(n.height-a.renderedHeight)/2;return a.lines.forEach(function(s,E){return e.fillText(s,i,u+(E+.5)*a.lineHeight)}),a}function Jf(e,t,n){var a,l,i,u,s,E,f=n===void 0?{}:n,b=f.edit,k=b===void 0?!1:b,z=f.sceneId,re=z===void 0?e.base.startScene:z,U=f.onSelect,Y=U===void 0?function(){}:U,oe=f.network,_=oe===void 0?"standalone":oe,ee=bl(_),h=t.getContext("2d"),V=new Map(e.components.map(function(r){return[r.id,r]})),Te=new Map(e.assets.map(function(r){return[r.id,r]})),Ce=new Map,xe=new Map(e.events.map(function(r){return[r.id,r]})),Le=new Map(e.gameplay.filter(function(r){return r.kind==="responsive-layout"}).map(function(r){return[r.componentId,r.parameters]})),Z=(i=globalThis.matchMedia)===null||i===void 0?void 0:i.call(globalThis,"(prefers-reduced-motion: reduce)"),ue,ie=new Map,ye=ie;function R(){var r=Le.size>0&&t.clientWidth>t.clientHeight;return{width:r?Math.max(e.base.width,e.base.height):e.base.width,height:r?Math.min(e.base.width,e.base.height):e.base.height,landscape:r}}function x(){ue!==R().landscape&&(Jt(),rt())}try{for(var $=q(e.assets),D=$.next();!D.done;D=$.next()){var fe=D.value;if(fe.mime.startsWith("image/")){var J=new Image;J.src="data:"+fe.mime+";base64,"+fe.data,Ce.set(fe.id,J)}}}catch(r){a={error:r}}finally{try{D&&!D.done&&(l=$.return)&&l.call($)}finally{if(a)throw a.error}}var Q=re,j={},me=[],le=[],Ie=[],X=[],ve=new Set,Ve=new Map,ce=0,Se=0,$e=0,Xe=0,fr=0,Pr=!1,Or=0,Vr=0,Tr=!1,pn=[],Ke,bt,Ge,Ut,_r,Pt,mn,wt,zt,Yt=[],Gt,vt=[],at=[],Lr,Zt=0,$t=!1,ii=0,gn=_==="standalone",ai=_==="standalone",Yn=_==="standalone",An=!1,Ti=!1,Qe=new Map,Rn=new Map,Ir=new Map,oi=new Map,In=new Set,ro=new Map,Gn=new Set,Zn=new Map,Ai=new Map,fa=new Map,da=new Map,xn=new Map,Bt=new Map,li=0,ua=0,Dr,et,va=1,sa,Mt=new Map,to=new Map,Tt=new Map,Kt=new Map,On=new Map,Vn=new Map,Ri=new Map,Ar=Bo(),$n=Do(),Oi=new Map,Vi=new Map,Wt=Yo(Fo(e.projectId)),Kn=new Map,on=new Map,Nn=new Map,Ni=new Set,ln=new Map,Fe,Ml=1,Sl=1,xr,bn,fi={x:0,y:0},Xr,Qt=[],wn=[],ze=function(r){var o;return(o=Ir.get(r))!==null&&o!==void 0?o:V.get(r)},St=function(r,o){return e.gameplay.find(function(y){return y.kind===r&&y.componentId===o})},di=function(){var r,o;li++,Gn.clear(),Zn.clear(),fa.clear(),da.clear();try{for(var y=q(In),d=y.next();!d.done;d=y.next()){var v=d.value;try{v.stop()}catch{}}}catch(p){r={error:p}}finally{try{d&&!d.done&&(o=y.return)&&o.call(y)}finally{if(r)throw r.error}}In.clear(),Ai.clear()},no=function(r){var o,y;if(!Fe||r!==void 0&&Fe.pointerId!==r)return!1;var d=Fe.pointerId;Fe.behavior.parameters.powerVariableId&&(j[Fe.behavior.parameters.powerVariableId]=0),Fe=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,d)&&((y=t.releasePointerCapture)===null||y===void 0||y.call(t,d))}catch{}return!0},ca=function(r){var o=r.behavior.parameters;o.axisXVariableId&&(j[o.axisXVariableId]=r.nx),o.axisYVariableId&&(j[o.axisYVariableId]=r.ny),o.magnitudeVariableId&&(j[o.magnitudeVariableId]=r.magnitude),o.angleVariableId&&r.magnitude>0&&(j[o.angleVariableId]=r.angle)},ha=function(r,o){var y,d,v,p;o===void 0&&(o=!1);try{for(var c=q(ln.values()),w=c.next();!w.done;w=c.next()){var m=w.value;if(!(m.pointerId===null||r!==void 0&&m.pointerId!==r)){var S=m.pointerId;m.pointerId=null,m.nx=0,m.ny=0,m.magnitude=0,m.knobX=m.origin.x,m.knobY=m.origin.y,ca(m);try{!((v=t.hasPointerCapture)===null||v===void 0)&&v.call(t,S)&&((p=t.releasePointerCapture)===null||p===void 0||p.call(t,S))}catch{}o&&er(lt("joystickEnd",m.c))}}}catch(I){y={error:I}}finally{try{w&&!w.done&&(d=c.return)&&d.call(c)}finally{if(y)throw y.error}}},zi=function(r,o){var y,d;if(o===void 0&&(o=!0),!Ge||r!==void 0&&Ge.pointerId!==r)return!1;var v=Ge,p=v.pointerId;if(Ge=void 0,bn=void 0,o){var c=ze(v.targetId);c&&v.b.parameters.snapBack&&(qt(c,v.origin.x,v.origin.y),v.originZone&&Ar.place(c.id,v.originZone))}try{!((y=t.hasPointerCapture)===null||y===void 0)&&y.call(t,p)&&((d=t.releasePointerCapture)===null||d===void 0||d.call(t,p))}catch{}return!0},ya=function(r){var o,y;(Gt==null?void 0:Gt.pointerId)===r.pointerId&&(Gt=void 0);try{for(var d=q(xn.values()),v=d.next();!v.done;v=d.next()){var p=v.value;p.pointerId===r.pointerId&&p.held&&(p.held=!1,p.releasedAt=ce)}}catch(w){o={error:w}}finally{try{v&&!v.done&&(y=d.return)&&y.call(d)}finally{if(o)throw o.error}}var c=zi(r.pointerId);return Pt===r.pointerId?(_r=void 0,Pt=void 0,!0):c},Bi=function(r){var o,y,d,v,p,c,w,m;if(r){Ge&&((w=Ir.get(Ge.targetId))===null||w===void 0?void 0:w.instanceId)===r&&zi(void 0,!1),Fe&&((m=Ir.get(Fe.targetId))===null||m===void 0?void 0:m.instanceId)===r&&no();var S=[];Ar.release(r),$n.cancel(r),Kn.delete(r),Nn.delete(r),Wt.remove(r),me=me.filter(function(F){return F.id!==r});try{for(var I=q(Ir),C=I.next();!C.done;C=I.next()){var M=K(C.value,2),g=M[0],P=M[1];if(P.instanceId===r){S.push(g),Ar.release(g),$n.cancel(g),Ir.delete(g),Qe.delete(g),oi.delete(g),Tt.delete(g),On.delete(g),Vn.delete(g);try{for(var A=(d=void 0,q(Kt.values())),T=A.next();!T.done;T=A.next()){var N=T.value;N.removeAgent(g)}}catch(F){d={error:F}}finally{try{T&&!T.done&&(v=A.return)&&v.call(A)}finally{if(d)throw d.error}}try{for(var W=(p=void 0,q(Rn.keys())),B=W.next();!B.done;B=W.next()){var O=B.value;O.endsWith(":"+g)&&Rn.delete(O)}}catch(F){p={error:F}}finally{try{B&&!B.done&&(c=W.return)&&c.call(W)}finally{if(p)throw p.error}}}}}catch(F){o={error:F}}finally{try{C&&!C.done&&(y=I.return)&&y.call(I)}finally{if(o)throw o.error}}Ie=Ie.filter(function(F){return!S.includes(F.targetId)})}},Qn=function(r){for(;r;){if(r.prototype)return r.id;r=ze(r.parentId)}},kl=function(){var r,o,y;return{viewport:R(),components:Object.fromEntries(ae([],K(Qe),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,ge(ge({},c),{parameters:ge({},c.parameters)})]})),mode:k?"edit":"play",scene:Q,variables:ge({},j),time:ce,instances:me.map(function(d){return ge({id:d.id,prototypeId:d.prototypeId,x:d.transform[4],y:d.transform[5]},Wt.snapshot(d.id))}),particles:le.length,animations:Ie.length,contacts:ve.size,spriteFrames:Object.fromEntries(ae([],K(oi),!1).map(function(d){var v,p=K(d,2),c=p[0],w=p[1];return[c,(v=w.frame)!==null&&v!==void 0?v:0]})),input:{dragging:!!Ge,pointerId:(o=(r=Ge==null?void 0:Ge.pointerId)!==null&&r!==void 0?r:xr==null?void 0:xr.pointerId)!==null&&o!==void 0?o:null,pressed:_r!=null?_r:null,holding:!!(xr!=null&&xr.holds.length),occupancy:Ar.snapshot(),joysticks:Object.fromEntries(ae([],K(ln),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,{active:c.pointerId!==null,x:c.nx,y:c.ny,magnitude:c.magnitude,angle:c.angle}]}))},feedback:{presses:xn.size,floatingTexts:vt.length,flashes:at.length,shaking:!!Lr,tutorialHands:ii},match:{boards:Object.fromEntries(ae([],K(Mt),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,c.snapshot()]})),selected:Dr!=null?Dr:null,cells:ae([],K(Bt),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return ge({id:p},c)})},physics:Ol(),paths:Object.fromEntries(ae([],K(Kt),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,c.snapshot()]})),canvas:{masks:Object.fromEntries(ae([],K(Kn),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,{progress:c.progress}]})),strokes:Object.fromEntries(ae([],K(on),!1).map(function(d){var v=K(d,2),p=v[0],c=v[1];return[p,c.strokes.length]})),walls:Qt.length,joints:wn.filter(function(d){return!d.broken}).length},audio:{state:(y=Ke==null?void 0:Ke.state)!==null&&y!==void 0?y:"locked",voices:In.size,blocked:ua},network:{target:_,ready:ai,visible:Yn,started:gn,closed:An,hostVolume:va},diagnostics:ae([],K(pn),!1)}},Jn=function(){return!k&&!Pr&&!document.hidden&&ai&&Yn&&gn&&!An},Jt=function(){var r,o,y,d;Gt=void 0,no(),ha(),zi(),xr=void 0,bn=void 0,Xr=void 0;try{for(var v=q(on.values()),p=v.next();!p.done;p=v.next()){var c=p.value;c.cancel()}}catch(I){r={error:I}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(r)throw r.error}}$n.clear(),et=void 0;try{for(var w=q(Mt.values()),m=w.next();!m.done;m=w.next()){var S=m.value;S.cancelSelection()}}catch(I){y={error:I}}finally{try{m&&!m.done&&(d=w.return)&&d.call(w)}finally{if(y)throw y.error}}Mt.size&&(Dr=void 0),_r=void 0,Pt=void 0,xn.clear()},ot=function(r){Tr=!0,pn.push(r),pn=pn.slice(-16),X=[]},De=function(r){var o,y,d;return ge(ge(ge({},r.parameters),r.prototypeId?(o=Qe.get(r.prototypeId))===null||o===void 0?void 0:o.parameters:{}),(d=Qe.get((y=r.runtimeId)!==null&&y!==void 0?y:r.id))===null||d===void 0?void 0:d.parameters)};function pa(r,o){var y,d=xn.get(r.id);if(!d||Z!=null&&Z.matches)return o;var v=ae([],K(o),!1),p=d.held?0:ce-((y=d.releasedAt)!==null&&y!==void 0?y:ce),c=d.held?0:Math.min(1,p/d.behavior.springBackSeconds),w=d.held?d.behavior.scaleDown:d.behavior.scaleDown+(1-d.behavior.scaleDown)*(1-Math.pow(1-c,3)),m=De(r);v[4]+=(1-w)*(v[0]*m.width+v[2]*m.height)/2,v[5]+=(1-w)*(v[1]*m.width+v[3]*m.height)/2;for(var S=0;S<4;S++)v[S]*=w;return v}function kt(r){var o,y,d,v,p,c,w,m=r.transform,S=(d=(y=Qe.get((o=r.runtimeId)!==null&&o!==void 0?o:r.id))===null||y===void 0?void 0:y.transform)!==null&&d!==void 0?d:m,I=Le.get((v=r.prototypeId)!==null&&v!==void 0?v:r.id);if(!I)return pa(r,S);var C=R(),M=ae([],K(S),!1);C.landscape&&(M[4]+=I.x-m[4],M[5]+=I.y-m[5],M[0]*=I.scaleX,M[1]*=I.scaleX,M[2]*=I.scaleY,M[3]*=I.scaleY);var g=(p=I.anchor)!==null&&p!==void 0?p:"none";if(g==="none"&&!I.respectSafeArea)return pa(r,M);var P=I.respectSafeArea?eo(C):{left:0,top:0,right:C.width,bottom:C.height},A=De(r),T=(c=I.marginX)!==null&&c!==void 0?c:0,N=(w=I.marginY)!==null&&w!==void 0?w:0,W=Math.abs(M[0])*A.width+Math.abs(M[2])*A.height,B=Math.abs(M[1])*A.width+Math.abs(M[3])*A.height;return g!=="none"?(M[4]=g.endsWith("left")?P.left+T:g.endsWith("right")?P.right-W-T:(P.left+P.right-W)/2,M[5]=g.startsWith("top")?P.top+N:g.startsWith("bottom")?P.bottom-B-N:(P.top+P.bottom-B)/2):(M[4]=Math.max(P.left+T,Math.min(P.right-W-T,M[4])),M[5]=Math.max(P.top+N,Math.min(P.bottom-B-N,M[5]))),pa(r,M)}var Wi=function(r){return(Ir.has(r)?ae([],K(Ir.values()),!1):ae(ae([],K(e.components),!1),K(me),!1)).filter(function(o){return o.parentId===r&&!o.prototype}).sort(function(o,y){return o.order-y.order||(o.id<y.id?-1:o.id>y.id?1:0)})},io=function(){return e.components.filter(function(r){return r.sceneId===Q&&!r.parentId&&!r.prototype}).sort(function(r,o){return r.order-o.order||(r.id<o.id?-1:r.id>o.id?1:0)})},er=function(r){var o,y;if(r.kind==="sceneEnter"&&((o=e.scenes.find(function(d){return d.id===r.sceneId}))===null||o===void 0?void 0:o.role)==="end-card"&&sa!==r.sceneId&&(sa=r.sceneId,(y=ee==null?void 0:ee.notifyGameEnd)===null||y===void 0||y.call(ee)),X.length>=256){ot("Event queue budget exhausted");return}X.push(r)},lt=function(r,o,y,d){var v,p,c,w;return d===void 0&&(d={}),ge(ge({kind:r,componentId:(v=o.prototypeId)!==null&&v!==void 0?v:o.id,selfInstanceId:(p=o.instanceId)!==null&&p!==void 0?p:o.id,instanceId:o.instanceId},y?{otherId:(c=y.prototypeId)!==null&&c!==void 0?c:y.id,otherInstanceId:(w=y.instanceId)!==null&&w!==void 0?w:y.id}:{}),d)};function ma(r){for(var o,y=r;y;y=ze(y.parentId)){var d=Wt.states.get((o=y.instanceId)!==null&&o!==void 0?o:y.id);if(d)return d}}function ao(r){var o,y,d=St("instance-state",(o=r.prototypeId)!==null&&o!==void 0?o:r.id);return d?Wt.initialize((y=r.instanceId)!==null&&y!==void 0?y:r.id,d.parameters):void 0}function Cl(){var r,o,y,d;try{for(var v=q(e.gameplay.filter(function(I){return I.kind==="instance-state"})),p=v.next();!p.done;p=v.next()){var c=p.value;try{for(var w=(y=void 0,q(Hr(V.get(c.componentId)))),m=w.next();!m.done;m=w.next()){var S=m.value;ao(S)}}catch(I){y={error:I}}finally{try{m&&!m.done&&(d=w.return)&&d.call(w)}finally{if(y)throw y.error}}}}catch(I){r={error:I}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(r)throw r.error}}}function El(r,o,y,d){var v=ma(r);if(v){var p=v.hp;if(o==="tag")v.tag=y==="set"?String(d):v.tag;else{var c=Number(d);if(v[o]=y==="add"?v[o]+c:y==="sub"?v[o]-c:c,!Number.isFinite(v[o])){ot("Instance state range exceeded");return}o==="hp"&&(v.hp=Math.max(0,Math.min(v.maxHp,v.hp)))}p>0&&v.hp<=0&&er(lt("instanceDepleted",r))}}function Li(r,o){var y,d,v;if(!r)return!0;if(r.all)return r.all.every(function(S){return Li(S,o)});if(r.any)return r.any.some(function(S){return Li(S,o)});var p=r.instanceTarget==="other"?o==null?void 0:o.otherInstanceId:(y=o==null?void 0:o.selfInstanceId)!==null&&y!==void 0?y:o==null?void 0:o.instanceId,c=r.instanceField?(d=ze(p))!==null&&d!==void 0?d:ae([],K(Ir.values()),!1).find(function(S){return S.instanceId===p}):void 0,w=r.instanceField?(v=ma(c))===null||v===void 0?void 0:v[r.instanceField]:j[r.variableId],m=r.compareVariableId?j[r.compareVariableId]:r.value;return{eq:function(){return w===m},ne:function(){return w!==m},lt:function(){return w<m},lte:function(){return w<=m},gt:function(){return w>m},gte:function(){return w>=m}}[r.op]()}function oo(r){var o,y,d;Dr=void 0,et=void 0,r||Bt.clear();try{for(var v=q(e.gameplay),p=v.next();!p.done;p=v.next()){var c=p.value;if(c.kind==="match-tile"){var w=V.get(c.componentId);if(r&&w.id!==r&&!Ct(w,r))continue;Qe.delete(w.id),Bt.set(w.id,{row:c.parameters.row,column:c.parameters.column,group:c.parameters.group,sceneId:w.sceneId,boardId:(d=w.parentId)!==null&&d!==void 0?d:w.sceneId})}}}catch(m){o={error:m}}finally{try{p&&!p.done&&(y=v.return)&&y.call(v)}finally{if(o)throw o.error}}}function Pl(){var r,o,y=function(c){var w,m;if(Mt.has(c.componentId))return"continue";var S=c.componentId,I=c.parameters,C=e.gameplay.filter(function(O){return O.kind==="match-tile"&&V.get(O.componentId).parentId===S}).sort(function(O,F){return O.parameters.row-F.parameters.row||O.parameters.column-F.parameters.column}).map(function(O){return ge({id:O.componentId},O.parameters)}),M=new Map;try{for(var g=(w=void 0,q(C)),P=g.next();!P.done;P=g.next()){var A=P.value;if(!M.has(A.group)){var T=V.get(A.id);M.set(A.group,{fill:T.parameters.fill,children:Wi(A.id).filter(function(O){return["native.image.v1","native.text.v1"].includes(O.contract)})})}}}catch(O){w={error:O}}finally{try{P&&!P.done&&(m=g.return)&&m.call(g)}finally{if(w)throw w.error}}to.set(S,M);var N=V.get(C[I.columns].id).transform[5]-V.get(C[0].id).transform[5],W=function(O,F,G){var H,te=G.from,de=te===void 0?O:te,ne=G.progress,he=ne===void 0?0:ne,Ae=G.offsetRows,We=Ae===void 0?0:Ae,He=G.scale,se=He===void 0?1:He,be=G.opacity,Re=be===void 0?1:be,Ee=C[O],Oe=V.get(Ee.id),pe=V.get(C[de].id),gr=M.get(F),Pe=ae([],K(Oe.transform),!1);Pe[4]+=(pe.transform[4]-Oe.transform[4])*he,Pe[5]+=(pe.transform[5]-Oe.transform[5]+We*N)*he,Pe[4]+=(1-se)*(Pe[0]*Oe.parameters.width+Pe[2]*Oe.parameters.height)/2,Pe[5]+=(1-se)*(Pe[1]*Oe.parameters.width+Pe[3]*Oe.parameters.height)/2;for(var ar=0;ar<4;ar++)Pe[ar]*=se;Qe.set(Ee.id,ge(ge({},Qe.get(Ee.id)),{transform:Pe,parameters:ge(ge({},(H=Qe.get(Ee.id))===null||H===void 0?void 0:H.parameters),{fill:gr.fill,opacity:Re})})),Bt.get(Ee.id).group=F;var we=Wi(Ee.id).filter(function(hr){return["native.image.v1","native.text.v1"].includes(hr.contract)});we.forEach(function(hr,Ue){var Ze,Ur,yr=gr.children[Ue];if(!(!yr||yr.contract!==hr.contract)){var rr=(Ze=Qe.get(hr.id))!==null&&Ze!==void 0?Ze:{transform:ae([],K(hr.transform),!1),parameters:{}};hr.contract==="native.image.v1"?rr.assetId=(Ur=yr.assetSlots[0])===null||Ur===void 0?void 0:Ur.assetId:rr.parameters.text=yr.parameters.text,Qe.set(hr.id,rr)}})},B=Vo(ge(ge({},I),{slots:C,paint:W,onEvent:function(O){Dr=void 0,er({kind:O,componentId:S})}}));Mt.set(S,B)};try{for(var d=q(e.gameplay.filter(function(c){return c.kind==="match-board"})),v=d.next();!v.done;v=d.next()){var p=v.value;y(p)}}catch(c){r={error:c}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}function lo(r){var o,y;Pl();try{for(var d=q(Mt),v=d.next();!v.done;v=d.next()){var p=K(v.value,2),c=p[0],w=p[1];(!r||r===c||Ct(V.get(c),r))&&w.reset()}}catch(m){o={error:m}}finally{try{v&&!v.done&&(y=d.return)&&y.call(d)}finally{if(o)throw o.error}}}function Hr(r){return Qn(r)?ae([],K(Ir.values()),!1).filter(function(o){return o.prototypeId===r.id}):[r]}function Rr(r){var o=De(r);return cr(mr(r),o.width/2,o.height/2)}function zn(r,o,y){var d;y===void 0&&(y="self");var v=V.get(r),p=y==="other"?o.otherInstanceId:(d=o.selfInstanceId)!==null&&d!==void 0?d:o.instanceId,c=!!(v&&Qn(v));if(p!==void 0){if(r){var w=ae([],K(Ir.values()),!1).find(function(m){return m.prototypeId===r&&(m.instanceId===p||m.id===p)});if(w)return w}if(y==="other"||!r)return ze(p);if(c&&typeof p=="string"&&p.startsWith("instance."))return}return v?c?Hr(v)[0]:ze(r):void 0}function qt(r,o,y){var d,v=De(r),p=(d=Qe.get(r.id))!==null&&d!==void 0?d:{transform:ae([],K(r.transform),!1),parameters:{}},c=ae([],K(p.transform),!1),w=r.parentId?mr(ze(r.parentId)):tn(),m=cr(Xt(w),o,y);c[4]=m.x-(c[0]*v.width+c[2]*v.height)/2,c[5]=m.y-(c[1]*v.width+c[3]*v.height)/2,Qe.set(r.id,ge(ge({},p),{transform:c})),r.prototypeId&&(r.transform=ae([],K(c),!1))}function qn(r,o,y){var d,v,p,c;y===void 0&&(y=!1);var w=(d=Qe.get(r.id))!==null&&d!==void 0?d:{transform:ae([],K(r.transform),!1),parameters:{}},m=(c=(p=V.get((v=r.prototypeId)!==null&&v!==void 0?v:r.id))===null||p===void 0?void 0:p.transform)!==null&&c!==void 0?c:r.transform,S=Math.hypot(m[0],m[1])*(y?-1:1),I=Math.hypot(m[2],m[3]),C=o+(y?0:Math.atan2(m[1],m[0])),M=Math.cos(C),g=Math.sin(C),P=ae([],K(w.transform),!1);P[0]=M*S,P[1]=g*S,P[2]=-g*I,P[3]=M*I,Qe.set(r.id,ge(ge({},w),{transform:P}))}function Bn(r,o){var y=Tt.get(r.id);if(y)return y;var d=mr(r),v=De(r),p=cr(d,v.width/2,v.height/2);return y=ge({id:r.id,sourceId:o.componentId,instanceId:r.instanceId,x:p.x,y:p.y,vx:0,vy:0,width:Math.hypot(d[0],d[1])*v.width,height:Math.hypot(d[2],d[3])*v.height,angle:Math.atan2(d[1],d[0]),restElapsed:0,atRest:!0},o.parameters),Tt.set(r.id,y),y}function ui(r,o){var y,d=Kn.get(r.id);if(d)return d;var v=De(r),p=o.parameters;return d=Go(p,{width:v.width,height:v.height,source:r.contract==="native.image.v1"?Ce.get((y=r.assetSlots[0])===null||y===void 0?void 0:y.assetId):void 0,onProgress:function(c){p.progressVariableId&&(j[p.progressVariableId]=c),er(lt("maskProgress",r))},onComplete:function(){return er(lt("maskComplete",r))}}),Kn.set(r.id,d),d}function Tl(r){var o=on.get(r.componentId);return o||(o=Ko(r.parameters),on.set(r.componentId,o)),o}function fo(){var r,o,y,d,v,p,c,w,m,S,I,C,M=new Set,g=[];try{for(var P=q(e.gameplay.filter(function(Pe){return Pe.kind==="physics-body"})),A=P.next();!A.done;A=P.next()){var T=A.value,N=V.get(T.componentId);if(N.sceneId===Q)try{for(var W=(y=void 0,q(Hr(N))),B=W.next();!B.done;B=W.next()){var O=B.value;if(Cr(O)){if(g.length>=64){ot("Physics body budget exhausted");break}var F=Bn(O,T),G=mr(O),H=De(O),te=cr(G,H.width/2,H.height/2);if(M.add(O.id),F.width=Math.hypot(G[0],G[1])*H.width,F.height=Math.hypot(G[2],G[3])*H.height,F.mode!=="dynamic"){var de=On.get(O.id),ne=O.parentId?mr(ze(O.parentId)):tn(),he=(I=de==null?void 0:de.vx)!==null&&I!==void 0?I:0,Ae=(C=de==null?void 0:de.vy)!==null&&C!==void 0?C:0;F.x=te.x,F.y=te.y,F.angle=Math.atan2(G[1],G[0]),F.vx=ne[0]*he+ne[2]*Ae,F.vy=ne[1]*he+ne[3]*Ae}else F.atRest&&(F.x=te.x,F.y=te.y);g.push(F)}}}catch(Pe){y={error:Pe}}finally{try{B&&!B.done&&(d=W.return)&&d.call(W)}finally{if(y)throw y.error}}}}catch(Pe){r={error:Pe}}finally{try{A&&!A.done&&(o=P.return)&&o.call(P)}finally{if(r)throw r.error}}try{for(var We=q(Tt.keys()),He=We.next();!He.done;He=We.next()){var se=He.value;!M.has(se)&&!Ir.has(se)&&Tt.delete(se)}}catch(Pe){v={error:Pe}}finally{try{He&&!He.done&&(p=We.return)&&p.call(We)}finally{if(v)throw v.error}}var be=[];try{for(var Re=q(e.gameplay.filter(function(Pe){return Pe.kind==="capture-zone"})),Ee=Re.next();!Ee.done;Ee=Re.next()){var T=Ee.value,N=V.get(T.componentId);if(N.sceneId===Q)try{for(var Oe=(m=void 0,q(Hr(N))),pe=Oe.next();!pe.done;pe=Oe.next()){var O=pe.value;if(Cr(O)){var G=mr(O),H=De(O),te=cr(G,H.width/2,H.height/2),gr=Math.max(.1,Math.min(Math.hypot(G[0],G[1]),Math.hypot(G[2],G[3])));be.push(ge(ge({id:O.id,sourceId:N.id,instanceId:O.instanceId,x:te.x,y:te.y},T.parameters),{radius:T.parameters.radius*gr}))}}}catch(we){m={error:we}}finally{try{pe&&!pe.done&&(S=Oe.return)&&S.call(Oe)}finally{if(m)throw m.error}}}}catch(Pe){c={error:Pe}}finally{try{Ee&&!Ee.done&&(w=Re.return)&&w.call(Re)}finally{if(c)throw c.error}}return{bodies:ae(ae([],K(g),!1),K(Qt),!1),zones:be}}function Al(r){var o,y,d,v,p,c,w,m=fo(),S=m.bodies,I=m.zones,C=R();wn=[];try{for(var M=q(e.gameplay.filter(function(ne){return ne.kind==="physics-joint"})),g=M.next();!g.done;g=M.next()){var P=g.value,A=V.get(P.componentId);if(A.sceneId===Q){var T=ze(P.parameters.anchorComponentId),N=St("physics-body",A.id);if(!(!T||!N))try{for(var W=(d=void 0,q(Hr(A))),B=W.next();!B.done;B=W.next()){var O=B.value;Bn(O,N);var F=Rr(T),G=P.id+":"+O.id;wn.push(ge(ge({},P.parameters),{id:P.id,key:G,componentId:A.id,bodyId:O.id,anchorId:T.id,x:F.x,y:F.y,broken:Ni.has(G)}))}}catch(ne){d={error:ne}}finally{try{B&&!B.done&&(v=W.return)&&v.call(W)}finally{if(d)throw d.error}}}}}catch(ne){o={error:ne}}finally{try{g&&!g.done&&(y=M.return)&&y.call(M)}finally{if(o)throw o.error}}Ua({bodies:S,zones:I,joints:wn,bounds:{left:0,top:0,right:C.width,bottom:C.height},dt:r,onEvent:function(ne,he,Ae){var We,He,se,be;if(!(ne==="bodyBounce"&&Ae&&he.sourceId===Ae.sourceId&&he.id>Ae.id)){var Re=(We=he.instanceId)!==null&&We!==void 0?We:he.id,Ee=Ae?(He=Ae.instanceId)!==null&&He!==void 0?He:Ae.id:void 0,Oe=ge(ge({kind:ne,componentId:he.sourceId,selfInstanceId:Re},Ee?{otherInstanceId:Ee}:{}),{instanceId:(se=he.instanceId)!==null&&se!==void 0?se:Ae==null?void 0:Ae.instanceId});if(Ae&&(Oe.otherId=Ae.sourceId),er(Oe),ne==="zoneCapture"){var pe=ze(he.id),gr=V.get(Ae.sourceId);if(Ae.hideCaptured&&pe){var Pe=(be=Qe.get(pe.id))!==null&&be!==void 0?be:{transform:ae([],K(pe.transform),!1),parameters:{}};Pe.parameters.visible=!1,Qe.set(pe.id,Pe)}Ae.stopBody&&gr&&pe&&qt(pe,Ae.x,Ae.y)}}}});try{for(var H=q(S),te=H.next();!te.done;te=H.next()){var de=te.value,O=ze(de.id);!O||de.mode!=="dynamic"||(de.spinToRotation&&qn(O,(w=de.angle)!==null&&w!==void 0?w:0),qt(O,de.x,de.y))}}catch(ne){p={error:ne}}finally{try{te&&!te.done&&(c=H.return)&&c.call(H)}finally{if(p)throw p.error}}}function Rl(){var r,o,y,d,v;try{for(var p=q(e.gameplay.filter(function(B){return B.kind==="oscillate"})),c=p.next();!c.done;c=p.next()){var w=c.value,m=V.get(w.componentId);if(m.sceneId===Q)try{for(var S=(y=void 0,q(Hr(m))),I=S.next();!I.done;I=S.next()){var C=I.value,M=On.get(C.id);M||(M={base:ae([],K(kt(C)),!1),vx:0,vy:0},On.set(C.id,M));var g=w.parameters,P=(ce/g.periodSeconds+g.phase)*Math.PI*2,A=Math.sin(P)*g.amplitude,T=Math.cos(P)*g.amplitude*Math.PI*2/g.periodSeconds,N=(v=Qe.get(C.id))!==null&&v!==void 0?v:{parameters:{}},W=ae([],K(M.base),!1);g.axis==="x"?(W[4]+=A,M.vx=T,M.vy=0):(W[5]+=A,M.vy=T,M.vx=0),Qe.set(C.id,ge(ge({},N),{transform:W})),On.set(C.id,M)}}catch(B){y={error:B}}finally{try{I&&!I.done&&(d=S.return)&&d.call(S)}finally{if(y)throw y.error}}}}catch(B){r={error:B}}finally{try{c&&!c.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}}function uo(){var r,o;Kt.clear();var y=function(c){var w=e.gameplay.filter(function(S){return S.kind==="path-gate"&&S.parameters.networkBehaviorId===c.id}),m=il({id:c.id,nodes:c.parameters.nodes,edges:c.parameters.edges,gates:w,onEvent:function(S,I){var C,M=ze(I.componentId),g=(C=M==null?void 0:M.prototypeId)!==null&&C!==void 0?C:I.componentId;er(ge({kind:S,componentId:g,instanceId:M==null?void 0:M.instanceId},I.nodeId?{nodeId:I.nodeId}:{}))}});Kt.set(c.id,m)};try{for(var d=q(e.gameplay.filter(function(c){return c.kind==="path-network"})),v=d.next();!v.done;v=d.next()){var p=v.value;y(p)}}catch(c){r={error:c}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}function Di(r,o){var y,d,v,p,c,w,m,S,I,C,M,g,P;o===void 0&&(o=!0);var A=0;try{for(var T=q(e.gameplay.filter(function(Pe){return Pe.kind==="path-agent"})),N=T.next();!N.done;N=T.next()){var W=N.value,B=V.get(W.componentId),O=Kt.get(W.parameters.networkBehaviorId);if(!(B.sceneId!==Q||!O))try{for(var F=(v=void 0,q(Hr(B))),G=F.next();!G.done;G=F.next()){var H=G.value;if(++A>64){ot("Path agent budget exhausted");break}var te=O.getAgent(H.id);te||(te=O.addAgent(ge(ge({},W.parameters),{id:H.id,startNode:(M=H.pathStartNode)!==null&&M!==void 0?M:W.parameters.startNode,targetNode:(g=H.pathTargetNode)!==null&&g!==void 0?g:W.parameters.targetNode}))),te.speedMultiplier=Math.max(0,Number(W.parameters.speedMultiplierVariableId?j[W.parameters.speedMultiplierVariableId]:1))}}catch(Pe){v={error:Pe}}finally{try{G&&!G.done&&(p=F.return)&&p.call(F)}finally{if(v)throw v.error}}}}catch(Pe){y={error:Pe}}finally{try{N&&!N.done&&(d=T.return)&&d.call(T)}finally{if(y)throw y.error}}if(o){var de=function(Pe,ar){var we=e.gameplay.find(function(hr){return hr.id===Pe});V.get(we.componentId).sceneId===Q&&ar.tick(r)};try{for(var ne=q(Kt),he=ne.next();!he.done;he=ne.next()){var Ae=K(he.value,2),We=Ae[0],He=Ae[1];de(We,He)}}catch(Pe){c={error:Pe}}finally{try{he&&!he.done&&(w=ne.return)&&w.call(ne)}finally{if(c)throw c.error}}}try{for(var se=q(e.gameplay.filter(function(Pe){return Pe.kind==="path-agent"})),be=se.next();!be.done;be=se.next()){var W=be.value,B=V.get(W.componentId),Re=Kt.get(W.parameters.networkBehaviorId);if(!(B.sceneId!==Q||!Re))try{for(var Ee=(I=void 0,q(Hr(B))),Oe=Ee.next();!Oe.done;Oe=Ee.next()){var H=Oe.value,te=Re.getAgent(H.id);if(te){if(te.orientToPath==="rotate")qn(H,te.heading);else if(te.orientToPath==="flip-x")qn(H,0,te.flipX);else if(te.orientToPath==="iso-4"){var pe=(P=Qe.get(H.id))!==null&&P!==void 0?P:{transform:ae([],K(H.transform),!1),parameters:{}};pe.pathFrame=te.frame,Qe.set(H.id,pe)}var gr=H.parentId?cr(mr(ze(H.parentId)),te.x,te.y):te;qt(H,gr.x,gr.y)}}}catch(we){I={error:we}}finally{try{Oe&&!Oe.done&&(C=Ee.return)&&C.call(Ee)}finally{if(I)throw I.error}}}}catch(Pe){m={error:Pe}}finally{try{be&&!be.done&&(S=se.return)&&S.call(se)}finally{if(m)throw m.error}}}function ga(r){var o,y,d,v,p,c,w,m,S,I,C=new Set;try{for(var M=q(e.gameplay.filter(function(rr){return rr.kind==="value-meter"})),g=M.next();!g.done;g=M.next()){var P=g.value,A=V.get(P.componentId);if(A.sceneId===Q)try{for(var T=(d=void 0,q(Hr(A))),N=T.next();!N.done;N=T.next()){var W=N.value,B=P.parameters,O=B.instanceField?ma(W):void 0,F=B.instanceField==="hp"&&O?O.hp/O.maxHp*(B.max-B.min)+B.min:B.instanceField==="value"&&O?O.value:Number(j[B.variableId]),G=Vn.get(W.id);G||(G={base:ae([],K(kt(W)),!1),value:Number.isFinite(F)?Math.max(B.min,Math.min(B.max,F)):B.min},Vn.set(W.id,G)),C.add(W.id);var H=Math.max(B.min,Math.min(B.max,F)),te=B.smoothingSeconds?1-Math.exp(-r/B.smoothingSeconds):1;G.value+=((Number.isFinite(H)?H:B.min)-G.value)*te;var de=Math.max(0,Math.min(1,(G.value-B.min)/(B.max-B.min))),ne=ae([],K(G.base),!1),he=(S=Qe.get(W.id))!==null&&S!==void 0?S:{parameters:{}},Ae=B.axis==="x"?De(W).width:De(W).height;if(B.axis==="x"?(ne[0]*=de,ne[1]*=de):(ne[2]*=de,ne[3]*=de),B.direction==="negative"){var We=Ae*(1-de);B.axis==="x"?(ne[4]+=G.base[0]*We,ne[5]+=G.base[1]*We):(ne[4]+=G.base[2]*We,ne[5]+=G.base[3]*We)}Qe.set(W.id,ge(ge({},he),{transform:ne}))}}catch(rr){d={error:rr}}finally{try{N&&!N.done&&(v=T.return)&&v.call(T)}finally{if(d)throw d.error}}}}catch(rr){o={error:rr}}finally{try{g&&!g.done&&(y=M.return)&&y.call(M)}finally{if(o)throw o.error}}try{for(var He=q(Vn.keys()),se=He.next();!se.done;se=He.next()){var be=se.value;C.has(be)||Vn.delete(be)}}catch(rr){p={error:rr}}finally{try{se&&!se.done&&(c=He.return)&&c.call(He)}finally{if(p)throw p.error}}try{for(var Re=q(e.gameplay.filter(function(rr){return rr.kind==="camera-follow"})),Ee=Re.next();!Ee.done;Ee=Re.next()){var P=Ee.value,Oe=V.get(P.componentId),H=ze(P.parameters.targetId);if(!(Oe.sceneId!==Q||!H)){var pe=Ri.get(Oe.id);pe||(pe={base:ae([],K(Oe.transform),!1),x:P.parameters.minX,y:P.parameters.minY},Ri.set(Oe.id,pe));var gr=function(Fr,tt){for(var Zr=[],Er=Fr;Er&&Er.id!==tt.id;Er=ze(Er.parentId))Zr.unshift(Er);return Zr.reduce(function(dr,At){return ri(dr,kt(At))},tn())},ne=Ct(H,Oe.id)?gr(H,Oe):mr(H),B=De(H),Pe=cr(ne,B.width/2,B.height/2),ar=R(),we=P.parameters,hr=Math.max(we.minX,we.maxX-ar.width/we.zoom),Ue=Math.max(we.minY,we.maxY-ar.height/we.zoom),Ze=Math.max(we.minX,Math.min(hr,Pe.x-ar.width/(2*we.zoom))),Ur=Math.max(we.minY,Math.min(Ue,Pe.y-ar.height/(2*we.zoom))),te=1-Math.exp(-we.smoothing*r);pe.x+=(Ze-pe.x)*te,pe.y+=(Ur-pe.y)*te;var he=(I=Qe.get(Oe.id))!==null&&I!==void 0?I:{parameters:{}},yr=ae([],K(pe.base),!1);yr[0]*=we.zoom,yr[1]*=we.zoom,yr[2]*=we.zoom,yr[3]*=we.zoom,yr[4]-=pe.x*we.zoom,yr[5]-=pe.y*we.zoom,Qe.set(Oe.id,ge(ge({},he),{transform:yr}))}}}catch(rr){w={error:rr}}finally{try{Ee&&!Ee.done&&(m=Re.return)&&m.call(Re)}finally{if(w)throw w.error}}}function Ol(){return{bodies:ae([],K(Tt.values()),!1).map(function(r){return{id:r.id,sourceId:r.sourceId,x:r.x,y:r.y,vx:r.vx,vy:r.vy,atRest:!!r.atRest,captured:!!r.captured}}),aiming:Fe?{componentId:Fe.sourceId,pointerId:Fe.pointerId,power:Fe.power}:null}}function Ia(){sa=void 0,Jt(),ln.clear(),Ar.clear(),Oi.clear(),Vi.clear(),Wt.reset(),Kn.clear(),on.clear(),Qt=[],wn=[],Nn.clear(),Ni.clear(),ie.clear(),vt=[],at=[],Lr=void 0,Zt=0,$t=!1,ii=0,j=Object.fromEntries(e.variables.map(function(r){return[r.id,r.initial]})),di(),ua=0,Ir.clear(),oi.clear(),Tt.clear(),On.clear(),Vn.clear(),Ri.clear(),Fe=void 0,me=[],le=[],Ie=[],Qe.clear(),oo(),Rn.clear(),ve.clear(),Ve.clear(),X=[],ce=0,Se=0,$e=0,Tr=!1,Xe=0,Q=e.base.startScene,_r=void 0,Pt=void 0,Ut=void 0,wt=void 0,k||(Cl(),lo(),uo(),Di(0,!1),Ma(),ga(0),er({kind:"sceneEnter",sceneId:Q}))}function xa(){var r,o;if(!(!Ke||Ke.state!=="running"||!Zn.size)){var y=ae([],K(Zn.values()),!1);Zn.clear();try{for(var d=q(y),v=d.next();!v.done;v=d.next()){var p=v.value;so(p)}}catch(c){r={error:c}}finally{try{v&&!v.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}}}function vi(r){if(r===void 0&&(r=!1),!Ke)return Promise.resolve(void 0);if(Ke.state==="running")return Promise.resolve().then(xa),Promise.resolve(Ke);if(!bt||r){var o=Ke,y=Promise.resolve().then(function(){return o.resume()}).then(function(){if(o.state==="running")return xa(),o}).catch(function(){}).finally(function(){bt===y&&(bt=void 0)});bt=y}return bt}function ba(){var r,o,y=ae([],K(Ai.values()),!1),d=y.some(function(I){return I.bus==="voice"}),v=y.some(function(I){return I.bus==="stinger"}),p=v?.2:d?.25:1;try{for(var c=q(y),w=c.next();!w.done;w=c.next()){var m=w.value,S=m.volume*va*(m.bus==="music"?p:1);m.gain.gain.setTargetAtTime?m.gain.gain.setTargetAtTime(S,Ke.currentTime,.04):m.gain.gain.value=S}}catch(I){r={error:I}}finally{try{w&&!w.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}function vo(r,o,y){var d,v=(d=y.parameters.bus)!==null&&d!==void 0?d:"sfx";r.connect(o),o.connect(Ke.destination),In.add(r),Ai.set(r,{gain:o,bus:v,volume:y.parameters.volume}),r.onended=function(){In.delete(r),Ai.delete(r),y.parameters.loop&&Gn.delete(y.id),ba()},ba()}function so(r){return $f(this,void 0,void 0,function(){var o,y,d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W,B,O,F,G,H,te,de,ne,he,Ae,We,He;return Kf(this,function(se){switch(se.label){case 0:return In.size>=32?[2]:Ke?(o=Ke,y=li,d=(te=r.parameters.cooldownMs)!==null&&te!==void 0?te:45,v=o.currentTime,d>0&&v-((de=fa.get(r.id))!==null&&de!==void 0?de:-1/0)<d/1e3?[2]:r.parameters.loop&&Gn.has(r.id)?[2]:(p=V.get(r.componentId),c=Te.get((ne=p==null?void 0:p.assetSlots[0])===null||ne===void 0?void 0:ne.assetId),w=(c==null?void 0:c.mime)==="audio/wav"||(c==null?void 0:c.mime)==="audio/mpeg",!w&&r.parameters.allowSynthFallback===!1?(ua++,[2]):(fa.set(r.id,v),m=o.state!=="running",m?[4,vi()]:[3,2]))):(r.parameters.loop&&Zn.set(r.id,r),[2]);case 1:m=!se.sent(),se.label=2;case 2:if(m)return r.parameters.loop&&Zn.set(r.id,r),[2];if(Ke!==o||o.state!=="running"||y!==li||In.size>=32)return[2];if(S=(he=da.get(r.id))!==null&&he!==void 0?he:0,I=[0,-.5,.5,-1,1],C=((Ae=r.parameters.pitchJitter)!==null&&Ae!==void 0?Ae:0)*I[S%I.length],M=Number((We=j[r.parameters.pitchVariableId])!==null&&We!==void 0?We:0),g=Math.max(-12,Math.min(12,C+M*((He=r.parameters.pitchStep)!==null&&He!==void 0?He:0))),P=Math.pow(2,g/12),da.set(r.id,S+1),!w)return[3,8];r.parameters.loop&&Gn.add(r.id),se.label=3;case 3:if(se.trys.push([3,6,,7]),A=ro.get(c.hash),A)return[3,5];for(T=atob(c.data),N=new Uint8Array(T.length),W=0;W<T.length;W++)N[W]=T.charCodeAt(W);return[4,new Promise(function(be,Re){var Ee=o.decodeAudioData(N.buffer,be,Re);Ee&&typeof Ee.then=="function"&&Ee.then(be,Re)})];case 4:A=se.sent(),ro.set(c.hash,A),se.label=5;case 5:return Ke!==o||o.state!=="running"||y!==li||In.size>=32?(r.parameters.loop&&y===li&&Gn.delete(r.id),[2]):(B=o.createBufferSource(),O=o.createGain(),B.buffer=A,B.loop=r.parameters.loop,B.playbackRate&&(B.playbackRate.value=P),O.gain.value=r.parameters.volume,vo(B,O,r),B.start(),[3,7]);case 6:return F=se.sent(),Gn.delete(r.id),ot("Audio decode failed"),[3,7];case 7:return[2];case 8:return G=o.createOscillator(),H=o.createGain(),G.frequency.value=r.parameters.frequency*P,G.type="sine",H.gain.setValueAtTime(r.parameters.volume,o.currentTime),H.gain.exponentialRampToValueAtTime(.001,o.currentTime+r.parameters.seconds),vo(G,H,r),G.start(),G.stop(o.currentTime+r.parameters.seconds),[2]}})})}function Vl(r,o){for(var y=ae([],K(Bt.values()),!1).filter(function(I){return I.boardId===r}),d=function(I,C){var M;return(M=y.find(function(g){return g.row===I&&g.column===C}))===null||M===void 0?void 0:M.group},v=function(I){for(var C=function(P){var A=d(I,P);if(A&&A===d(I,P+1)&&A===d(I,P+2)&&o.some(function(T){return T.row===I&&T.column>=P&&T.column<=P+2}))return{value:!0}},M=0;M<14;M++){var g=C(M);if(typeof g=="object")return g}},p=0;p<16;p++){var c=v(p);if(typeof c=="object")return c.value}for(var w=function(I){for(var C=function(P){var A=d(P,I);if(A&&A===d(P+1,I)&&A===d(P+2,I)&&o.some(function(T){return T.column===I&&T.row>=P&&T.row<=P+2}))return{value:!0}},M=0;M<14;M++){var g=C(M);if(typeof g=="object")return g}},m=0;m<16;m++){var S=w(m);if(typeof S=="object")return S.value}return!1}function Nl(r){var o,y,d,v=Bt.get(r.id);if(!(!v||v.sceneId!==Q||!De(r).enabled||!Cr(r))){var p=Mt.get(r.parentId);if(p){Dr=p.select(r.id);return}if(Dr===r.id){Dr=void 0;return}var c=Bt.get(Dr);if(!c||c.sceneId!==Q||c.boardId!==v.boardId){Dr=r.id;return}var w=V.get(Dr);if(Math.abs(c.row-v.row)+Math.abs(c.column-v.column)!==1){Dr=r.id;return}if(c.group===v.group){Dr=void 0,er({kind:"invalidMatch",componentId:(o=r.parentId)!==null&&o!==void 0?o:r.id});return}var m=c.row,S=c.column,I=v.row,C=v.column,M=ae([],K(kt(w)),!1),g=ae([],K(kt(r)),!1);if(c.row=I,c.column=C,v.row=m,v.column=S,Vl(v.boardId,[c,v])){var P=function(A,T){var N,W=(N=Qe.get(A.id))!==null&&N!==void 0?N:{transform:ae([],K(kt(A)),!1),parameters:{}};W.transform=ae([],K(W.transform),!1),W.transform[4]=T[4],W.transform[5]=T[5],Qe.set(A.id,W)};P(w,g),P(r,M),Dr=void 0,er({kind:"validMatch",componentId:(y=r.parentId)!==null&&y!==void 0?y:r.id})}else c.row=m,c.column=S,v.row=I,v.column=C,Dr=void 0,er({kind:"invalidMatch",componentId:(d=r.parentId)!==null&&d!==void 0?d:r.id})}}function wa(r){var o,y,d,v,p=[],c=ft(r,mr(r)),w=Rr(r),m=St("drag",(d=r.prototypeId)!==null&&d!==void 0?d:r.id),S=function(g){var P,A,T=V.get(g.componentId),N=g.parameters;if(T.sceneId!==Q)return"continue";var W=function(G){if(G.id===r.id||Ct(G,r.id)||!Cr(G))return"continue";var H=ft(G,mr(G)),te=Rr(G),de=Math.hypot(te.x-w.x,te.y-w.y),ne=N.radiusPx>0?de<=N.radiusPx:c.left<H.right&&c.right>H.left&&c.top<H.bottom&&c.bottom>H.top;if(!ne)return"continue";p.push(ge({id:G.id,c:G,sourceId:T.id,paintOrder:Yt.findIndex(function(he){return he.c.id===G.id}),distance:de,itemTarget:e.gameplay.some(function(he){return he.kind==="drag"&&he.componentId===T.id})},N))};try{for(var B=(P=void 0,q(Hr(T))),O=B.next();!O.done;O=B.next()){var F=O.value;W(F)}}catch(G){P={error:G}}finally{try{O&&!O.done&&(A=B.return)&&A.call(B)}finally{if(P)throw P.error}}};try{for(var I=q(e.gameplay.filter(function(g){return g.kind==="drop-zone"})),C=I.next();!C.done;C=I.next()){var M=C.value;S(M)}}catch(g){o={error:g}}finally{try{C&&!C.done&&(y=I.return)&&y.call(I)}finally{if(o)throw o.error}}return{zones:p,tag:(v=m==null?void 0:m.parameters.tag)!==null&&v!==void 0?v:""}}function Ma(r){var o,y,d=r?[r]:e.gameplay.filter(function(C){return C.kind==="drag"}).flatMap(function(C){return Hr(V.get(C.componentId))});try{for(var v=q(d),p=v.next();!p.done;p=v.next()){var c=p.value;if(!(!c||!Cr(c)||Ar.zoneOf(c.id))){var w=wa(c),m=w.zones,S=w.tag,I=ea({itemId:c.id,tag:S,zones:m.filter(function(C){return!C.itemTarget}),occupancy:Ar});(I==null?void 0:I.kind)==="accept"&&Ar.place(c.id,I.zone.id)}}}catch(C){o={error:C}}finally{try{p&&!p.done&&(y=v.return)&&y.call(v)}finally{if(o)throw o.error}}}function Wn(r,o,y){y===void 0&&(y=.18),r&&$n.to(r.id,Rr(r),o,y)}function Sa(r,o,y,d){var v,p,c=d!=null?d:y==null?void 0:y.c;er(ge(ge({},lt(r,o,c,ge({},y?{otherId:y.sourceId}:{}))),{instanceId:(v=o.instanceId)!==null&&v!==void 0?v:(p=y==null?void 0:y.c)===null||p===void 0?void 0:p.instanceId}))}function zl(r){var o,y,d,v,p,c,w;if(!Ge||Ge.pointerId!==r.pointerId)return!1;var m=Ge,S=ze(m.targetId),I=m.b.parameters;Ge=void 0,bn=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,r.pointerId)&&((y=t.releasePointerCapture)===null||y===void 0||y.call(t,r.pointerId))}catch{}if(!S)return!0;var C=wa(S),M=C.zones,g=C.tag,P=ea({itemId:S.id,tag:g,zones:M,occupancy:Ar}),A=m.origin,T=m.originZone;if(!P)return Sa("dragReject",S,void 0,void 0),I.snapBack&&(T&&Ar.place(S.id,T),Wn(S,A,(d=I.snapBackSeconds)!==null&&d!==void 0?d:.18)),!0;var N=P.zone,W=P.occupantId?ze(P.occupantId):void 0;return P.kind==="reject"?(Sa("dragReject",S,N,W),I.snapBack&&(T&&Ar.place(S.id,T),Wn(S,A,(v=I.snapBackSeconds)!==null&&v!==void 0?v:.18)),!0):(P.kind==="accept"?(Ar.place(S.id,N.id),N.snapMode==="center"&&Wn(S,Rr(N.c),(p=I.snapBackSeconds)!==null&&p!==void 0?p:.18)):P.kind==="swap"&&W&&(Ar.place(S.id,N.id),T?Ar.place(W.id,T):Ar.release(W.id),Wn(S,Rr(N.c),(c=I.snapBackSeconds)!==null&&c!==void 0?c:.18),Wn(W,A,(w=I.snapBackSeconds)!==null&&w!==void 0?w:.18)),Sa("dragDrop",S,N,P.kind==="accept"?N.c:W),!0)}function Bl(r){var o,y,d,v,p;$n.tick(r,function(P,A){var T=ze(P);T&&qt(T,A.x,A.y)});try{for(var c=q(ae([],K(Ar.itemZone.keys()),!1)),w=c.next();!w.done;w=c.next()){var m=w.value,S=ze(m);(!S||!Cr(S))&&Ar.release(m)}}catch(P){o={error:P}}finally{try{w&&!w.done&&(y=c.return)&&y.call(c)}finally{if(o)throw o.error}}if(xr)try{for(var I=q(xr.holds),C=I.next();!C.done;C=I.next()){var M=C.value,g=M.charge.tick(r);g!==j[M.behavior.parameters.variableId]&&(j[M.behavior.parameters.variableId]=g,er({kind:"variableChange",variableId:M.behavior.parameters.variableId,instanceId:M.c.instanceId,selfInstanceId:(p=M.c.instanceId)!==null&&p!==void 0?p:M.c.id}))}}catch(P){d={error:P}}finally{try{C&&!C.done&&(v=I.return)&&v.call(I)}finally{if(d)throw d.error}}}function co(r,o){var y,d,v,p,c=o.targetMode;if(c==="pointer")return ge({},fi);if(c==="component"){var w=ze(o.targetComponentId);return w?Rr(w):void 0}if(c==="nearest-team"){var m=Rr(r),S=[],I=o.team,C=(v=o.maxRangePx)!==null&&v!==void 0?v:0;try{for(var M=q(Wt.states),g=M.next();!g.done;g=M.next()){var P=K(g.value,2),A=P[0],T=P[1],w=ze(A);w&&Cr(w)&&S.push(ge(ge({id:A},Rr(w)),{team:T.team}))}}catch(N){y={error:N}}finally{try{g&&!g.done&&(d=M.return)&&d.call(M)}finally{if(y)throw y.error}}return Xo(m,S,I,C,(p=r.instanceId)!==null&&p!==void 0?p:r.id)}}function Wl(r){var o,y,d,v,p;try{for(var c=q(e.gameplay.filter(function(F){return F.kind==="steer"})),w=c.next();!w.done;w=c.next()){var m=w.value,S=V.get(m.componentId),I=m.parameters;if(S.sceneId===Q)try{for(var C=(d=void 0,q(Hr(S))),M=C.next();!M.done;M=C.next()){var g=M.value;if(Cr(g)){var P=co(g,I);if(P){var A=Rr(g),T=P.x-A.x,N=P.y-A.y;if(!(I.maxRangePx>0&&Math.hypot(T,N)>I.maxRangePx)){var W=Math.atan2(N,T);I.mode==="flee"?W+=Math.PI:I.mode==="orbit"&&(W+=Math.PI/2);var B=(p=Wt.headings.get(g.id))!==null&&p!==void 0?p:W,O=Uo(B,W,I.turnRateDegPerSec*Math.PI/180*r);Wt.headings.set(g.id,O),qt(g,A.x+Math.cos(O)*I.speed*r,A.y+Math.sin(O)*I.speed*r),I.orientToVelocity!==!1&&qn(g,O)}}}}}catch(F){d={error:F}}finally{try{M&&!M.done&&(v=C.return)&&v.call(C)}finally{if(d)throw d.error}}}}catch(F){o={error:F}}finally{try{w&&!w.done&&(y=c.return)&&y.call(c)}finally{if(o)throw o.error}}}function ka(r,o,y,d){var v;if(me.length>=128){ot("Instance budget exhausted");return}var p=V.get(r),c=function(I){return 1+e.components.filter(function(C){return C.parentId===I}).reduce(function(C,M){return C+c(M.id)},0)};if(Ir.size+c(p.id)>4096){ot("Runtime node budget exhausted");return}var w="instance."+ ++$e;function m(I,C){var M,g,P=I.id===p.id?w:w+":"+I.id,A=ge(ge({},I),{id:P,runtimeId:P,instanceId:w,prototypeId:I.id,prototype:!1,parentId:C,transform:ae([],K(I.transform),!1),spawnTime:ce});Ir.set(P,A);try{for(var T=q(e.components.filter(function(B){return B.parentId===I.id})),N=T.next();!N.done;N=T.next()){var W=N.value;m(W,P)}}catch(B){M={error:B}}finally{try{N&&!N.done&&(g=T.return)&&g.call(T)}finally{if(M)throw M.error}}return A}var S=m(p,void 0);return S.transform[4]=o,S.transform[5]=y,d&&(S.pathStartNode=d.startNode,S.pathTargetNode=d.targetNode,S.parentId=(v=e.gameplay.find(function(I){return I.id===d.networkBehaviorId}))===null||v===void 0?void 0:v.componentId),me.push(S),ao(S),Ma(S),d&&Di(0,!1),S}function Ll(r,o,y){var d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W,B,O,F,G,H,te,de,ne,he,Ae,We,He,se,be,Re;if(++Vr>1024){ot("Action budget exhausted");return}if(r.kind==="add"||r.kind==="set"){var Ee=j[r.variableId],Oe=r.kind==="add"?Ee+r.value:r.value;if(typeof Oe=="number"&&(!Number.isFinite(Oe)||Math.abs(Oe)>1e12)){ot("Variable range exceeded");return}j[r.variableId]=Oe,Ee!==Oe&&er({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="setComponent"||r.kind==="setAsset"){var pe=ze(r.componentId);if(!pe)return;var gr=(C=Qe.get(pe.id))!==null&&C!==void 0?C:{transform:ae([],K(pe.transform),!1),parameters:{}};r.kind==="setComponent"?gr.parameters[r.key]=r.valueVariableId?j[r.valueVariableId]:r.value:gr.assetId=r.assetId,Qe.set(pe.id,gr),r.kind==="setComponent"&&r.key==="visible"&&r.value===!1&&(Ar.release(pe.id),$n.cancel(pe.id))}else if(r.kind==="resetMatch")oo(r.componentId),lo(r.componentId);else if(r.kind==="clearStrokes")(M=on.get(r.componentId))===null||M===void 0||M.clear(),Qt=Qt.filter(function(Jr){return Jr.owner!==r.componentId});else if(r.kind==="resetMask"){var pe=ze(r.componentId),Pe=St("erase-mask",r.componentId);pe&&Pe&&ui(pe,Pe).reset()}else if(r.kind==="copyMatchAsset"){var ar=(g=Mt.get(r.boardId))===null||g===void 0?void 0:g.snapshot().lastMatch,we=V.get(r.componentId),hr=ar&&((A=(P=to.get(r.boardId))===null||P===void 0?void 0:P.get(ar.group))===null||A===void 0?void 0:A.children.find(function(Jr){return Jr.contract==="native.image.v1"}));if(ar&&hr){var Ue=V.get(ar.from),Ze=cr(mr(Ue),Ue.parameters.width/2,Ue.parameters.height/2),Ur=we.parentId?mr(V.get(we.parentId)):tn(),yr=cr(Xt(Ur),Ze.x,Ze.y),rr=(T=Qe.get(we.id))!==null&&T!==void 0?T:{transform:ae([],K(we.transform),!1),parameters:{}};rr.transform=ae([],K(rr.transform),!1),rr.transform[4]=yr.x-we.parameters.width/2,rr.transform[5]=yr.y-we.parameters.height/2,rr.assetId=(N=hr.assetSlots[0])===null||N===void 0?void 0:N.assetId,Qe.set(we.id,rr)}}else if(r.kind==="hintMatch")Dr=void 0,(W=Mt.get(r.componentId))===null||W===void 0||W.showHint();else if(r.kind==="spawn")ka(r.prototypeId,r.x,r.y);else if(r.kind==="spawnAt"){var Yr=(r.at==="self"||r.at==="midpoint")&&(o.selfInstanceId!==void 0||o.instanceId!==void 0)?ze((B=o.selfInstanceId)!==null&&B!==void 0?B:o.instanceId):zn(r.targetComponentId,o,"self"),st=(r.at==="other"||r.at==="midpoint")&&o.otherInstanceId!==void 0?ze(o.otherInstanceId):void 0,we=r.at==="other"?st:Yr;if(r.at==="pointer"||(r.at==="midpoint"?Yr&&st:we))for(var jt=Yr?Rr(Yr):void 0,ct=st?Rr(st):void 0,Ze=r.at==="pointer"?fi:r.at==="midpoint"?{x:(jt.x+ct.x)/2,y:(jt.y+ct.y)/2}:Rr(we),Gr=V.get(r.prototypeId),Fr=Math.max(0,Math.min(16,Math.floor(r.countVariableId?Number(j[r.countVariableId]):(O=r.count)!==null&&O!==void 0?O:1))),tt=0;tt<Fr;tt++){var Zr=r.jitterX?(Wt.rng.next()*2-1)*r.jitterX:0,Er=r.jitterY?(Wt.rng.next()*2-1)*r.jitterY:0;ka(r.prototypeId,Ze.x+r.offsetX+Zr-Gr.parameters.width/2,Ze.y+r.offsetY+Er-Gr.parameters.height/2)}}else if(r.kind==="random"){var Ee=j[r.variableId],Oe=Wt.rng.between(r.min,r.max,r.integer===!0);j[r.variableId]=Oe,Ee!==Oe&&er({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="modifyInstanceState"){var pe=r.target==="component"?ze(r.componentId):zn(r.componentId,o,r.target);pe&&El(pe,r.field,r.op,r.variableId?j[r.variableId]:r.value)}else if(r.kind==="launchToward"){var Ue=V.get(r.componentId),dr=Hr(Ue),At=(F=o.selfInstanceId)!==null&&F!==void 0?F:o.instanceId,pe=Ue.prototype?(G=dr.find(function(ir){return ir.instanceId===At||ir.id===At}))!==null&&G!==void 0?G:dr[dr.length-1]:(H=zn(r.componentId,o,"self"))!==null&&H!==void 0?H:ze(r.componentId),Pe=St("physics-body",r.componentId),Je=pe&&Bn(pe,Pe);if(!Je)return;var $r=void 0;if(r.targetMode==="angle-variable")$r=Number(j[r.angleVariableId])*Math.PI/180;else{var we=co(pe,r);if(!we)return;var Ze=Rr(pe);$r=Math.atan2(we.y-Ze.y,we.x-Ze.x)}var tr=Number(r.speedVariableId?j[r.speedVariableId]:r.speed);if(!Number.isFinite(tr)){ot("Launch speed invalid");return}Je.vx=Math.cos($r)*tr,Je.vy=Math.sin($r)*tr,Je.atRest=!1,Je.restElapsed=0,Je.captured=!1,Je.exited=!1,r.orientToVelocity!==!1&&qn(pe,$r),er(lt("launch",pe))}else if(r.kind==="moveToComponent"){var qe=V.get(r.targetComponentId),pe=zn(r.componentId,o,(te=r.target)!==null&&te!==void 0?te:"self"),we=qe&&Qn(qe)?(de=zn(r.targetComponentId,o,r.target==="other"?"self":"other"))!==null&&de!==void 0?de:Hr(qe)[0]:ze(r.targetComponentId);pe&&we&&Wn(pe,Rr(we),r.seconds)}else if(r.kind==="returnToOrigin"){var pe=zn(r.componentId,o,"self"),Me=pe&&Oi.get(pe.id);pe&&Me&&Wn(pe,Me,r.seconds)}else if(r.kind==="spawnOnPath")ka(r.prototypeId,0,0,{startNode:r.startNode,targetNode:r.targetNode,networkBehaviorId:r.networkBehaviorId});else if(["setVelocity","applyImpulse","stopBody"].includes(r.kind)){var br=V.get(r.componentId),Qr=o.instanceId?ae([],K(Ir.values()),!1).filter(function(ur){return ur.instanceId===o.instanceId&&ur.prototypeId===br.id}):Hr(br),Pe=St("physics-body",br.id);try{for(var dt=q(Qr),pt=dt.next();!pt.done;pt=dt.next()){var pe=pt.value,Je=Bn(pe,Pe);r.kind==="setVelocity"?(Je.vx=r.vxVariableId?j[r.vxVariableId]:r.vx,Je.vy=r.vyVariableId?j[r.vyVariableId]:r.vy):r.kind==="applyImpulse"?(Je.vx+=r.vxVariableId?j[r.vxVariableId]:r.ix,Je.vy+=r.vyVariableId?j[r.vyVariableId]:r.iy):(Je.vx=0,Je.vy=0,Je.atRest=!0),Je.captured=!1,Je.exited=!1,Je.restElapsed=0,r.kind!=="stopBody"&&(Je.atRest=!1)}}catch(ur){d={error:ur}}finally{try{pt&&!pt.done&&(v=dt.return)&&v.call(dt)}finally{if(d)throw d.error}}}else if(r.kind==="setPosition"){var or=V.get(r.componentId),Qr=o.instanceId?ae([],K(Ir.values()),!1).filter(function(Kr){return Kr.instanceId===o.instanceId&&Kr.prototypeId===or.id}):Hr(or),Pe=St("physics-body",or.id);try{for(var ht=q(Qr),Et=ht.next();!Et.done;Et=ht.next()){var pe=Et.value,Je=Bn(pe,Pe);Je.x=r.xVariableId?j[r.xVariableId]:r.x,Je.y=r.yVariableId?j[r.yVariableId]:r.y,Je.vx=0,Je.vy=0,Je.captured=!1,Je.exited=!1,Je.atRest=!0,qt(pe,Je.x,Je.y)}}catch(Kr){p={error:Kr}}finally{try{Et&&!Et.done&&(c=ht.return)&&c.call(ht)}finally{if(p)throw p.error}}}else if(r.kind==="setPathEdge")(ne=Kt.get(r.behaviorId))===null||ne===void 0||ne.setEdge(r.edgeId,r.enabled,r.cost);else if(r.kind==="setPathGate")(Ae=Kt.get((he=e.gameplay.find(function(Jr){return Jr.id===r.behaviorId}))===null||he===void 0?void 0:he.parameters.networkBehaviorId))===null||Ae===void 0||Ae.setGate(r.behaviorId,r.mode,r.holdSeconds);else if(r.kind==="setPathTarget"){var Sn=V.get(r.componentId),Pe=St("path-agent",Sn.id),Rt=Kt.get(Pe.parameters.networkBehaviorId);try{for(var mt=q(o.instanceId?ae([],K(Ir.values()),!1).filter(function(ur){return ur.instanceId===o.instanceId&&ur.prototypeId===Sn.id}):Hr(Sn)),Ot=mt.next();!Ot.done;Ot=mt.next()){var pe=Ot.value;pe.pathTargetNode=r.targetNode,Rt==null||Rt.setTarget(pe.id,r.targetNode)}}catch(ur){w={error:ur}}finally{try{Ot&&!Ot.done&&(m=mt.return)&&m.call(mt)}finally{if(w)throw w.error}}}else if(r.kind==="compute"){var wr=Number(j[r.variableId]),nt=r.operandVariableId!==void 0?Number(j[r.operandVariableId]):r.value;if(["div","mod"].includes(r.op)&&nt===0){ot("Division by zero");return}var Oe={add:function(){return wr+nt},sub:function(){return wr-nt},mul:function(){return wr*nt},div:function(){return nt===0?wr:wr/nt},mod:function(){return nt===0?wr:wr%nt},min:function(){return Math.min(wr,nt)},max:function(){return Math.max(wr,nt)},set:function(){return nt},floor:function(){return Math.floor(wr)},ceil:function(){return Math.ceil(wr)},abs:function(){return Math.abs(wr)},clamp:function(){return Math.max(r.min,Math.min(r.max,wr))}}[r.op]();if(r.round&&(Oe=Math.round(Oe)),!Number.isFinite(Oe)||Math.abs(Oe)>1e12){ot("Variable range exceeded");return}var Ee=j[r.variableId];j[r.variableId]=Oe,Ee!==Oe&&er({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="despawn"){var Yr=(We=o.selfInstanceId)!==null&&We!==void 0?We:o.instanceId;r.target==="other"?Bi(o.otherInstanceId):r.target==="both"?(Bi(Yr),Bi(o.otherInstanceId)):Bi(Yr)}else if(r.kind==="changeScene")wt=r.sceneId;else if(r.kind==="restart")(He=ee==null?void 0:ee.notifyGameRetry)===null||He===void 0||He.call(ee),wt="__restart";else if(r.kind==="cameraShake")Z!=null&&Z.matches||(Lr={intensity:r.intensity,seconds:r.seconds,elapsed:0});else if(r.kind==="screenFlash")at.push({color:r.color,opacity:r.opacity,seconds:r.seconds,elapsed:0}),at.length>8&&at.shift();else if(r.kind==="floatingText"){var yt=V.get(r.componentId),Ue=o.instanceId?(se=ae([],K(Ir.values()),!1).find(function(Kr){return Kr.instanceId===o.instanceId&&Kr.prototypeId===r.componentId}))!==null&&se!==void 0?se:yt:(be=ze(r.componentId))!==null&&be!==void 0?be:yt,we=(Ue==null?void 0:Ue.sceneId)===Q?Ue:yt;if(we){var Ze=void 0;if(!Ze){var Lt=De(we);Ze=cr(mr(we),Lt.width/2,Lt.height/2)}vt.push({x:Ze.x,y:Ze.y,text:r.text.replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(ir,Br){var Ye;return String((Ye=j[Br])!==null&&Ye!==void 0?Ye:"")}),color:r.color,fontSize:r.fontSize,risePx:r.risePx,seconds:r.seconds,elapsed:0}),vt.length>32&&vt.shift()}}else if(r.kind==="store")o.kind==="click"&&o.pointerId!==void 0&&!Gt&&(Gt={pointerId:o.pointerId,targetId:o.targetId,condition:y},(Re=t.setPointerCapture)===null||Re===void 0||Re.call(t,o.pointerId));else if(r.behaviorId){var Nr=e.gameplay.find(function(Jr){return Jr.id===r.behaviorId});if(r.kind==="playAudio")so(Nr);else if(r.kind==="animate"){var dn=V.get(Nr.componentId),Qr=Qn(dn)?ae([],K(Ir.values()),!1).filter(function(ur){return ur.prototypeId===dn.id&&(!o.instanceId||ur.instanceId===o.instanceId)}):[dn],zr=function(ur){var Kr=Nr.id+":"+ur.id;Ie=Ie.filter(function(Br){return Br.id!==Kr});var ir=ge({},Nr.parameters);ir.fromCurrent&&(ir.from=ir.property==="opacity"?De(ur).opacity:kt(ur)[ir.property==="x"?4:5]),Ie.push(ge(ge({},Nr),{parameters:ir,id:Kr,behaviorId:Nr.id,targetId:ur.id,elapsed:0,baseTransform:ae([],K(ur.transform),!1)}))};try{for(var Mr=q(Qr),nr=Mr.next();!nr.done;nr=Mr.next()){var we=nr.value;zr(we)}}catch(ur){S={error:ur}}finally{try{nr&&!nr.done&&(I=Mr.return)&&I.call(Mr)}finally{if(S)throw S.error}}}else r.kind==="stopAnimation"?Ie=Ie.filter(function(Jr){return Jr.behaviorId!==Nr.id}):r.kind==="emit"&&Dl(Nr,o)}}function Dl(r,o){var y,d,v,p,c,w,m=r.parameters,S=m.shape==="pixel-confetti",I=m.shape==="confetti",C=S||I;if(!(C&&(Z!=null&&Z.matches))){if(le.length+m.count>256){ot("Particle budget exhausted");return}if(S&&m.coverage==="screen"){le.push.apply(le,ae([],K(ll(m)),!1));return}if(I&&m.coverage==="screen"){le.push.apply(le,ae([],K(dl(m)),!1));return}for(var M=V.get(r.componentId),g=o.instanceId&&(y=ae([],K(Ir.values()),!1).find(function(G){return G.instanceId===o.instanceId&&G.prototypeId===M.id}))!==null&&y!==void 0?y:M,P=kt(g),A,T=ze(g.parentId);T;T=ze(T.parentId)){if(C&&T.contract==="native.group.v1"&&De(T).clip){A=T.id;break}P=ri(kt(T),P)}var N=De(g),W=m.origin==="anchor"?cr(P,0,0):C||m.origin==="center"?cr(P,N.width/2,N.height/2):{x:P[4]+g.parameters.width/2,y:P[5]+g.parameters.height/2};if(S){le.push.apply(le,ae([],K($a(m,W,A)),!1));return}if(I){le.push.apply(le,ae([],K(Ka(m,W,A)),!1));return}for(var B=0;B<m.count;B++){var O=((d=m.spread)!==null&&d!==void 0?d:360)===360?B*2.399963:-Math.PI/2+((B+.5)/m.count-.5)*((v=m.spread)!==null&&v!==void 0?v:360)*Math.PI/180,F=m.speed*(.5+B%7/14);le.push(ge(ge({},W),{vx:Math.cos(O)*F,vy:Math.sin(O)*F,life:(p=m.lifetime)!==null&&p!==void 0?p:.7,gravity:(c=m.gravity)!==null&&c!==void 0?c:250,color:m.color,shape:(w=m.shape)!==null&&w!==void 0?w:"circle"}))}}}function fn(){for(var r=function(){var o,y,d,v,p,c,w=X.shift();Or++;var m=function(O){return O===void 0||!!ze(O)||ae([],K(Ir.values()),!1).some(function(F){return F.instanceId===O})};if(!m(w.selfInstanceId)||!m(w.otherInstanceId)||["contactBegin","boundaryExit"].includes(w.kind)&&w.instanceId&&!Ir.has(w.instanceId))return"continue";try{for(var S=(o=void 0,q(e.eventBindings)),I=S.next();!I.done;I=S.next()){var C=I.value;if(Object.entries(xe.get(C.eventId)).every(function(O){var F=K(O,2),G=F[0],H=F[1];return G==="id"||w[G]===H})&&Li(C.condition,w)){try{for(var M=(d=void 0,q(C.actions)),g=M.next();!g.done;g=M.next()){var P=g.value;if(Vr>=1024||Tr)break;Ll(P,w,C.condition)}}catch(O){d={error:O}}finally{try{g&&!g.done&&(v=M.return)&&v.call(M)}finally{if(d)throw d.error}}if(wt)break}}}catch(O){o={error:O}}finally{try{I&&!I.done&&(y=S.return)&&y.call(S)}finally{if(o)throw o.error}}if(wt){var A=wt;if(wt=void 0,A==="__restart")Ia();else if(A!==Q){var T=Q;di(),Q=A,ln.clear(),Ar.clear(),Oi.clear(),Vi.clear(),Kn.clear(),on.clear(),Qt=[],wn=[],Nn.clear(),Ni.clear(),Dr=void 0,me=[],le=[],vt=[],at=[],Lr=void 0,$t=!1,ii=0,Ir.clear(),Tt.clear(),On.clear(),Vn.clear(),Ri.clear(),Fe=void 0,uo(),X=X.filter(function(O){return O.kind==="variableChange"}),Qe.clear(),et=void 0;try{for(var N=(p=void 0,q(Mt.values())),W=N.next();!W.done;W=N.next()){var B=W.value;B.reset()}}catch(O){p={error:O}}finally{try{W&&!W.done&&(c=N.return)&&c.call(N)}finally{if(p)throw p.error}}ve.clear(),Ve.clear(),Rn.clear(),Ie=[],Jt(),ie.clear(),_r=void 0,Pt=void 0,Di(0,!1),Ma(),ga(0),er({kind:"sceneExit",sceneId:T}),er({kind:"sceneEnter",sceneId:Q})}}};X.length&&!Tr&&Or<256&&Vr<1024;)r();X.length&&ot("Event/action budget exhausted")}function mr(r){return ri(r.parentId?mr(ze(r.parentId)):tn(),kt(r))}var cr=function(r,o,y){return{x:r[0]*o+r[2]*y+r[4],y:r[1]*o+r[3]*y+r[5]}};function ft(r,o){var y=De(r),d=[[0,0],[y.width,0],[y.width,y.height],[0,y.height]].map(function(v){var p=K(v,2),c=p[0],w=p[1];return cr(o,c,w)});return{left:Math.min.apply(Math,ae([],K(d.map(function(v){return v.x})),!1)),right:Math.max.apply(Math,ae([],K(d.map(function(v){return v.x})),!1)),top:Math.min.apply(Math,ae([],K(d.map(function(v){return v.y})),!1)),bottom:Math.max.apply(Math,ae([],K(d.map(function(v){return v.y})),!1))}}function Cr(r){return De(r).visible&&De(r).opacity>0&&(!r.parentId||Cr(ze(r.parentId)))}function ho(r,o){for(var y=De(r),d=mr(r),v=Math.min(y.width,y.height)/2,p=o==="circle"?Array.from({length:32},function(m,S){return cr(d,y.width/2+Math.cos(S*Math.PI/16)*v,y.height/2+Math.sin(S*Math.PI/16)*v)}):[[0,0],[y.width,0],[y.width,y.height],[0,y.height]].map(function(m){var S=K(m,2),I=S[0],C=S[1];return cr(d,I,C)}),c=r.parentId?ze(r.parentId):void 0,w=function(){var m=De(c);if(c.contract==="native.group.v1"&&m.clip){for(var S=mr(c),I=[[0,0],[m.width,0],[m.width,m.height],[0,m.height]].map(function(A){var T=K(A,2),N=T[0],W=T[1];return cr(S,N,W)}),C=0,M=0;M<4;M++)C+=I[M].x*I[(M+1)%4].y-I[(M+1)%4].x*I[M].y;for(var g=C>=0?1:-1,P=function(A){var T,N,W=I[A],B=I[(A+1)%4],O=function(We){return g*((B.x-W.x)*(We.y-W.y)-(B.y-W.y)*(We.x-W.x))},F=p;p=[];var G=F[F.length-1],H=O(G);try{for(var te=(T=void 0,q(F)),de=te.next();!de.done;de=te.next()){var ne=de.value,he=O(ne);if(he>=0!=H>=0){var Ae=H/(H-he);p.push({x:G.x+(ne.x-G.x)*Ae,y:G.y+(ne.y-G.y)*Ae})}he>=0&&p.push(ne),G=ne,H=he}}catch(We){T={error:We}}finally{try{de&&!de.done&&(N=te.return)&&N.call(te)}finally{if(T)throw T.error}}},M=0;M<4&&p.length;M++)P(M)}c=c.parentId?ze(c.parentId):void 0};c;)w();return p}function Hl(r,o){var y,d,v,p,c,w;if(r.length<3||o.length<3)return!1;try{for(var m=q([r,o]),S=m.next();!S.done;S=m.next())for(var I=S.value,C=0;C<I.length;C++){var M=I[C],g=I[(C+1)%I.length],P=M.y-g.y,A=g.x-M.x,T=1/0,N=-1/0,W=1/0,B=-1/0;try{for(var O=(v=void 0,q(r)),F=O.next();!F.done;F=O.next()){var G=F.value,H=G.x*P+G.y*A;T=Math.min(T,H),N=Math.max(N,H)}}catch(ne){v={error:ne}}finally{try{F&&!F.done&&(p=O.return)&&p.call(O)}finally{if(v)throw v.error}}try{for(var te=(c=void 0,q(o)),de=te.next();!de.done;de=te.next()){var G=de.value,H=G.x*P+G.y*A;W=Math.min(W,H),B=Math.max(B,H)}}catch(ne){c={error:ne}}finally{try{de&&!de.done&&(w=te.return)&&w.call(te)}finally{if(c)throw c.error}}if(N<W||B<T)return!1}}catch(ne){y={error:ne}}finally{try{S&&!S.done&&(d=m.return)&&d.call(m)}finally{if(y)throw y.error}}return!0}function Fl(r){var o,y,d,v,p=R();try{for(var c=q(ln.values()),w=c.next();!w.done;w=c.next()){var m=w.value,S=m.behavior.parameters;if(!(!S.moveComponentId||m.magnitude<=0)){var I=ze(S.moveComponentId);if(!(!I||!Cr(I))){var C=(d=S.moveSpeed)!==null&&d!==void 0?d:220,M=St("physics-body",(v=I.prototypeId)!==null&&v!==void 0?v:I.id);if(M&&M.parameters.mode==="dynamic"){var g=Bn(I,M);g.vx=m.nx*C,g.vy=m.ny*C,g.atRest=!1,g.restElapsed=0}else{var P=Rr(I),A=De(I),T=P.x+m.nx*C*r,N=P.y+m.ny*C*r;yo(I)||(T=Math.max(A.width/2,Math.min(p.width-A.width/2,T)),N=Math.max(A.height/2,Math.min(p.height-A.height/2,N))),qt(I,T,N)}S.orientToMove&&qn(I,Math.atan2(m.ny,m.nx))}}}}catch(W){o={error:W}}finally{try{w&&!w.done&&(y=c.return)&&y.call(c)}finally{if(o)throw o.error}}}function Xl(r){var o,y,d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W,B,O,F,G,H,te,de,ne,he,Ae,We,He,se,be,Re=R();ce+=r,tf(r),Bl(r),Fl(r),Wl(r),Rl();try{for(var Ee=q(xn),Oe=Ee.next();!Oe.done;Oe=Ee.next()){var pe=K(Oe.value,2),gr=pe[0],Pe=pe[1];!Pe.held&&ce-((H=Pe.releasedAt)!==null&&H!==void 0?H:ce)>=Pe.behavior.springBackSeconds&&xn.delete(gr)}}catch(Ne){o={error:Ne}}finally{try{Oe&&!Oe.done&&(y=Ee.return)&&y.call(Ee)}finally{if(o)throw o.error}}Lr&&(Lr.elapsed+=r,Lr.elapsed>=Lr.seconds&&(Lr=void 0));try{for(var ar=q(at),we=ar.next();!we.done;we=ar.next()){var hr=we.value;hr.elapsed+=r}}catch(Ne){d={error:Ne}}finally{try{we&&!we.done&&(v=ar.return)&&v.call(ar)}finally{if(d)throw d.error}}at=at.filter(function(Ne){return Ne.elapsed<Ne.seconds});try{for(var Ue=q(vt),Ze=Ue.next();!Ze.done;Ze=Ue.next()){var Ur=Ze.value;Ur.elapsed+=r}}catch(Ne){p={error:Ne}}finally{try{Ze&&!Ze.done&&(c=Ue.return)&&c.call(Ue)}finally{if(p)throw p.error}}vt=vt.filter(function(Ne){return Ne.elapsed<Ne.seconds});try{for(var yr=q(Mt),rr=yr.next();!rr.done;rr=yr.next()){var Yr=K(rr.value,2),gr=Yr[0],st=Yr[1];V.get(gr).sceneId===Q&&Cr(V.get(gr))&&st.tick(r)}}catch(Ne){w={error:Ne}}finally{try{rr&&!rr.done&&(m=yr.return)&&m.call(yr)}finally{if(w)throw w.error}}var jt=function(Ne){var vr,qr,sr=V.get(Ne.componentId);if(sr.sceneId!==Q)return"continue";var xt=Qn(sr)?ae([],K(Ir.values()),!1).filter(function(hi){return hi.prototypeId===sr.id}):[sr];try{for(var lr=(vr=void 0,q(xt)),jr=lr.next();!jr.done;jr=lr.next()){var it=jr.value,un=Ne.id+":"+it.id;if(Ne.kind==="motion"){var ut=(te=Qe.get(it.id))!==null&&te!==void 0?te:{transform:ae([],K(it.transform),!1),parameters:{}},_t=(de=ut.velocity)!==null&&de!==void 0?de:{x:Ne.parameters.vx,y:Ne.parameters.vy};_t.y+=Ne.parameters.gravity*r,ut.transform[4]+=_t.x*r,ut.transform[5]+=_t.y*r,ut.velocity=_t,Qe.set(it.id,ut),it.prototypeId&&(it.transform=ut.transform);var _n=mr(it);(_n[5]>Re.height||_n[4]<-300||_n[4]>Re.width+300)&&(ut.exited||(ut.exited=!0,er({kind:"boundaryExit",componentId:sr.id,instanceId:it.instanceId})))}else if(Ne.kind==="timer"){var En=((ne=Rn.get(un))!==null&&ne!==void 0?ne:0)+r;Rn.set(un,En),En>=Ne.parameters.seconds&&En-r<Ne.parameters.seconds&&(er({kind:"timer",behaviorId:Ne.id,componentId:sr.id}),Ne.parameters.repeat&&Rn.set(un,En-Ne.parameters.seconds))}}}catch(hi){vr={error:hi}}finally{try{jr&&!jr.done&&(qr=lr.return)&&qr.call(lr)}finally{if(vr)throw vr.error}}};try{for(var ct=q(e.gameplay),Gr=ct.next();!Gr.done;Gr=ct.next()){var Fr=Gr.value;jt(Fr)}}catch(Ne){S={error:Ne}}finally{try{Gr&&!Gr.done&&(I=ct.return)&&I.call(ct)}finally{if(S)throw S.error}}Al(r),Di(r),ga(r);var tt=[],Zr=function(Ne){var vr,qr,sr=V.get(Ne.componentId);if(sr.sceneId!==Q)return"continue";try{for(var xt=(vr=void 0,q(Qn(sr)?ae([],K(Ir.values()),!1).filter(function(it){return it.prototypeId===sr.id}):[sr])),lr=xt.next();!lr.done;lr=xt.next()){var jr=lr.value;if(Cr(jr)){if(tt.length>=256){ot("Collider budget exhausted");break}tt.push({b:Ne,c:jr,box:ft(jr,mr(jr)),polygon:ho(jr,Ne.parameters.shape)})}}}catch(it){vr={error:it}}finally{try{lr&&!lr.done&&(qr=xt.return)&&qr.call(xt)}finally{if(vr)throw vr.error}}};try{for(var Er=q(e.gameplay.filter(function(Ne){return Ne.kind==="collider"})),dr=Er.next();!dr.done;dr=Er.next()){var Fr=dr.value;Zr(Fr)}}catch(Ne){C={error:Ne}}finally{try{dr&&!dr.done&&(M=Er.return)&&M.call(Er)}finally{if(C)throw C.error}}var At=new Set,Je=new Map,$r=function(Ne,vr,qr){var sr,xt,lr;((sr=vr.c.prototypeId)!==null&&sr!==void 0?sr:vr.c.id)===((xt=qr.c.prototypeId)!==null&&xt!==void 0?xt:qr.c.id)&&vr.c.id>qr.c.id||er(ge(ge({},lt(Ne,vr.c,qr.c)),{instanceId:(lr=vr.c.instanceId)!==null&&lr!==void 0?lr:qr.c.instanceId}))},tr=0;e:for(var qe=0;qe<tt.length;qe++)for(var Fr=qe+1;Fr<tt.length;Fr++){var Me=tt[qe],br=tt[Fr];if(!(Me.c.instanceId&&Me.c.instanceId===br.c.instanceId)){var Qr=Me.box,dt=br.box,pt=Qr.left<dt.right&&Qr.right>dt.left&&Qr.top<dt.bottom&&Qr.bottom>dt.top;if(pt){if(++tr>4096){ot("Collision budget exhausted");break e}pt=Hl(Me.polygon,br.polygon)}if(pt){var or=[Me.c.id,br.c.id].sort().join("|");if(At.add(or),Je.set(or,[Me,br]),!ve.has(or))try{for(var ht=(g=void 0,q([[Me,br],[br,Me]])),Et=ht.next();!Et.done;Et=ht.next()){var Sn=K(Et.value,2),Rt=Sn[0],mt=Sn[1];$r("contactBegin",Rt,mt)}}catch(vr){g={error:vr}}finally{try{Et&&!Et.done&&(P=ht.return)&&P.call(ht)}finally{if(g)throw g.error}}}}}try{for(var Ot=q(Ve),wr=Ot.next();!wr.done;wr=Ot.next()){var nt=K(wr.value,2),or=nt[0],yt=K(nt[1],2),Me=yt[0],br=yt[1];if(!At.has(or))try{for(var Lt=(N=void 0,q([[Me,br],[br,Me]])),Nr=Lt.next();!Nr.done;Nr=Lt.next()){var dn=K(Nr.value,2),Rt=dn[0],mt=dn[1];$r("contactEnd",Rt,mt)}}catch(sr){N={error:sr}}finally{try{Nr&&!Nr.done&&(W=Lt.return)&&W.call(Lt)}finally{if(N)throw N.error}}}}catch(Ne){A={error:Ne}}finally{try{wr&&!wr.done&&(T=Ot.return)&&T.call(Ot)}finally{if(A)throw A.error}}ve=At,Ve=Je;try{for(var zr=q(Ie),Mr=zr.next();!Mr.done;Mr=zr.next()){var qe=Mr.value;qe.elapsed+=r;var nr=qe.parameters,Jr=(he=nr.delay)!==null&&he!==void 0?he:0,ur=qe.elapsed-Jr;if(!(ur<0)){var Kr=ur/nr.seconds,ir=nr.loop?Kr%1:Math.min(1,Kr),Br=(Ae=nr.easing)!==null&&Ae!==void 0?Ae:"ease-out",Ye=ir;nr.loop&&Br==="ease-in-out"?Ye=.5-.5*Math.cos(ir*Math.PI*2):Br==="ease-out"?Ye=1-Math.pow(1-ir,3):Br==="ease-in"?Ye=Math.pow(ir,3):Br==="ease-in-out"?Ye=ir<.5?4*Math.pow(ir,3):1-Math.pow(-2*ir+2,3)/2:Br==="back-out"&&(Ye=1+2.70158*Math.pow(ir-1,3)+1.70158*Math.pow(ir-1,2));var je=nr.from+(nr.to-nr.from)*Ye,kn=ze((We=qe.targetId)!==null&&We!==void 0?We:qe.componentId);if(kn){var gt=(He=Qe.get(kn.id))!==null&&He!==void 0?He:{transform:ae([],K(kn.transform),!1),parameters:{}},It=(se=qe.baseTransform)!==null&&se!==void 0?se:kn.transform;if(nr.property==="opacity")gt.parameters.opacity=Math.max(0,Math.min(1,je));else if(["scale","scaleX","scaleY","rotation"].includes(nr.property)){(be=gt.animationAxes)!==null&&be!==void 0||(gt.animationAxes={scale:1,scaleX:1,scaleY:1,rotation:0}),gt.animationAxes[nr.property]=je;var Dt=gt.animationAxes,Yi=Dt.rotation*Math.PI/180,Ln=Math.cos(Yi),Cn=Math.sin(Yi),jn=Dt.scale*Dt.scaleX,ci=Dt.scale*Dt.scaleY;gt.transform[0]=(It[0]*Ln+It[2]*Cn)*jn,gt.transform[1]=(It[1]*Ln+It[3]*Cn)*jn,gt.transform[2]=(-It[0]*Cn+It[2]*Ln)*ci,gt.transform[3]=(-It[1]*Cn+It[3]*Ln)*ci}else gt.transform[nr.property==="x"?4:5]=je;Qe.set(kn.id,gt),nr.loop&&ur>=nr.seconds&&(qe.elapsed=Jr+ur%nr.seconds)}}}}catch(Ne){B={error:Ne}}finally{try{Mr&&!Mr.done&&(O=zr.return)&&O.call(zr)}finally{if(B)throw B.error}}Ie=Ie.filter(function(Ne){var vr,qr;return ze((vr=Ne.targetId)!==null&&vr!==void 0?vr:Ne.componentId)&&(Ne.elapsed<Ne.parameters.seconds+((qr=Ne.parameters.delay)!==null&&qr!==void 0?qr:0)||Ne.parameters.loop)});try{for(var Ht=q(le),Ft=Ht.next();!Ft.done;Ft=Ht.next()){var nr=Ft.value;if(nr.shape==="pixel-confetti"||nr.shape==="confetti"){nr.age+=r;continue}nr.life-=r,nr.x+=nr.vx*r,nr.y+=nr.vy*r,nr.vy+=nr.gravity*r}}catch(Ne){F={error:Ne}}finally{try{Ft&&!Ft.done&&(G=Ht.return)&&G.call(Ht)}finally{if(F)throw F.error}}le=le.filter(function(Ne){var vr;return Ne.life>((vr=Ne.age)!==null&&vr!==void 0?vr:0)}),fn()}function Hi(r,o){var y,d,v;if(h.beginPath(),r.contract==="native.ellipse.v1")h.ellipse(o.width/2,o.height/2,o.width/2,o.height/2,0,0,Math.PI*2);else if(r.contract==="native.path.v1"){var p=function(M,g){({M:function(){return h.moveTo.apply(h,ae([],K(g),!1))},L:function(){return h.lineTo.apply(h,ae([],K(g),!1))},C:function(){return h.bezierCurveTo.apply(h,ae([],K(g),!1))},Q:function(){return h.quadraticCurveTo.apply(h,ae([],K(g),!1))},Z:function(){return h.closePath()}})[M]()};try{for(var c=q(o.commands),w=c.next();!w.done;w=c.next()){var m=K(w.value),S=m[0],I=m.slice(1);p(S,I)}}catch(M){y={error:M}}finally{try{w&&!w.done&&(d=c.return)&&d.call(c)}finally{if(y)throw y.error}}}else{var C=Math.min((v=o.radius)!==null&&v!==void 0?v:0,o.width/2,o.height/2);typeof h.roundRect=="function"?h.roundRect(0,0,o.width,o.height,C):(h.moveTo(C,0),h.arcTo(o.width,0,o.width,o.height,C),h.arcTo(o.width,o.height,0,o.height,C),h.arcTo(0,o.height,0,0,C),h.arcTo(0,0,o.width,0,C),h.closePath())}}function Ul(r,o,y){var d,v,p,c=(d=Qe.get(r.id))===null||d===void 0?void 0:d.pathFrame;if(c!==void 0)return Math.min(o.frameCount-1,c);if(k||!o.frameRate)return 0;if(r.contract!=="native.walk-sprite.v1")return Math.floor(Math.max(0,ce-((v=r.spawnTime)!==null&&v!==void 0?v:0))*o.frameRate)%o.frameCount;var w=(p=r.runtimeId)!==null&&p!==void 0?p:r.id,m=oi.get(w);if(!m)return oi.set(w,{x:y[4],y:y[5],phase:0,lastMove:-1/0,frame:0}),0;var S=Math.hypot(y[4]-m.x,y[5]-m.y)>.3;if(S){var I=ce-m.lastMove;m.phase=Number.isFinite(I)&&I<.25?m.phase+Math.min(I,.12)*o.frameRate:0,m.lastMove=ce}return m.x=y[4],m.y=y[5],ce-m.lastMove>.11&&(m.phase=0),m.frame=Math.floor(m.phase)%o.frameCount,m.frame}function si(r,o,y,d){var v,p,c,w,m,S,I,C,M;if(o===void 0&&(o=tn()),y===void 0&&(y=[]),r.contract!=="native.mesh3d.v1"){var g=De(r),P=St("erase-mask",(c=r.prototypeId)!==null&&c!==void 0?c:r.id);if(!(!g.visible||g.opacity<=0)){var A=ri(o,kt(r));h.save(),h.transform.apply(h,ae([],K(kt(r)),!1)),h.globalAlpha*=g.opacity;var T=xn.get(r.id);T!=null&&T.behavior.liftShadow&&(h.shadowColor="#00000055",h.shadowBlur=8,h.shadowOffsetY=4);var N=y;r.contract==="native.group.v1"&&g.clip&&(h.beginPath(),h.rect(0,0,g.width,g.height),h.clip(),N=ae(ae([],K(y),!1),[{matrix:A,width:g.width,height:g.height}],!1));var W=!1;if(!["native.group.v1","native.text.v1","native.image.v1","native.sprite.v1","native.walk-sprite.v1","native.stage3d.v1","native.mesh3d.v1"].includes(r.contract)){var B=r.contract==="native.button.v1",O=_r===r.id,F=B?g.enabled?O?g.pressedFill:Ut===r.id?g.hoverFill:g.fill:g.disabledFill:g.fill;if(B&&(g.presentation==="pixel-cta"||g.presentation==="shiny-cta")){var G=(w=ye.get(r.id))!==null&&w!==void 0?w:Se;ie.set(r.id,G);var H=!k&&!(Z!=null&&Z.matches)?Se-G:-1;g.presentation==="shiny-cta"?sl(h,g,F,O,H):vl(h,g,F,O,H)}else g.pixelFrame&&(h.save(),h.translate(3,4),Hi(r,g),h.fillStyle="#3c293366",h.fill(),h.restore()),Hi(r,g),P?(h.save(),h.clip(),ui(r,P).render(h),h.restore(),W=!0,Hi(r,g)):(h.fillStyle=F,h.fill()),g.pixelFrame&&!(g.radius>0)&&(h.fillStyle="#ffffff22",h.fillRect(2,2,Math.max(0,g.width-4),2),h.fillRect(2,2,2,Math.max(0,g.height-4))),g.strokeWidth&&(h.strokeStyle=g.stroke,h.lineWidth=g.strokeWidth,h.stroke());Dr===r.id&&(Hi(r,g),h.strokeStyle="#ffffff",h.lineWidth=5,h.stroke())}var te;if(r.contract==="native.text.v1"){var de=g.text.replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(Ue,Ze){var Ur;return String((Ur=j[Ze])!==null&&Ur!==void 0?Ur:"")});g.pixelPanel&&(h.fillStyle="#3c293366",h.fillRect(3,4,g.width,g.height),h.fillStyle=g.panelFill,h.fillRect(0,0,g.width,g.height),h.strokeStyle=(m=g.panelStroke)!==null&&m!==void 0?m:g.color,h.lineWidth=2,h.strokeRect(1,1,g.width-2,g.height-2),h.fillStyle="#ffffff22",h.fillRect(3,3,Math.max(0,g.width-6),2));var ne=g.fontFamily==="pixel"?Ya(de,g):void 0;ne&&!ne.unsupportedChars.length?te=ol(h,de,g):te=Qf(h,de,ne?ge(ge({},g),{fontFamily:"sans-serif",fontWeight:"700"}):g)}if(["native.image.v1","native.sprite.v1","native.walk-sprite.v1"].includes(r.contract)&&!P){var he=Ce.get((I=(S=Qe.get(r.id))===null||S===void 0?void 0:S.assetId)!==null&&I!==void 0?I:(C=r.assetSlots[0])===null||C===void 0?void 0:C.assetId);if(he!=null&&he.complete&&he.naturalWidth){h.save(),h.beginPath(),h.rect(0,0,g.width,g.height),h.clip();var Ae=r.contract!=="native.image.v1",We=Ae?Math.min(g.frameColumns,g.frameCount):1,He=Ae?Math.ceil(g.frameCount/We):1,se=he.width/We,be=he.height/He,Re=Ae?Ul(r,g,A):0,Ee=Re%We*se,Oe=Math.floor(Re/We)*be,pe=g.fit==="cover"?Math.max(g.width/se,g.height/be):Math.min(g.width/se,g.height/be),gr=g.fit==="stretch"?g.width:se*pe,Pe=g.fit==="stretch"?g.height:be*pe;h.imageSmoothingEnabled=(M=g.smoothing)!==null&&M!==void 0?M:!0,h.drawImage(he,Ee,Oe,se,be,(g.width-gr)/2,(g.height-Pe)/2,gr,Pe),h.restore()}}P&&!W&&ui(r,P).render(h),Yt.push({c:r,m:A,clips:N,instance:d!=null?d:r.prototypeId,textMetrics:te});try{for(var ar=q(Wi(r.id)),we=ar.next();!we.done;we=ar.next()){var hr=we.value;si(hr,A,N,d!=null?d:r.prototypeId)}}catch(Ue){v={error:Ue}}finally{try{we&&!we.done&&(p=ar.return)&&p.call(ar)}finally{if(v)throw v.error}}g.clip&&r.contract==="native.group.v1"&&Ca(r.id),h.restore()}}}function Ca(r,o){var y,d;if(!(Z!=null&&Z.matches))try{for(var v=q(le),p=v.next();!p.done;p=v.next()){var c=p.value;c.shape!=="pixel-confetti"&&c.shape!=="confetti"||c.clipId!==r||!!c.screen!=!!o||(h.save(),c.shape==="confetti"?ul(h,c,o):fl(h,c,o),h.restore())}}catch(w){y={error:w}}finally{try{p&&!p.done&&(d=v.return)&&d.call(v)}finally{if(y)throw y.error}}}function Yl(r,o,y,d){h.save(),h.translate(r,o),h.globalAlpha=.92,h.lineWidth=2,h.lineJoin="round",y==="tap"&&(h.strokeStyle="#fff0bd",h.globalAlpha=.7*(1-d),h.beginPath(),h.arc(0,0,12+d*12,0,Math.PI*2),h.stroke(),h.globalAlpha=.92),h.fillStyle="#fff0bd",h.strokeStyle="#193b46",h.beginPath(),h.moveTo(-7,10),h.lineTo(-9,-1),h.quadraticCurveTo(-9,-5,-5,-5),h.lineTo(-3,-3),h.lineTo(-3,-17),h.quadraticCurveTo(-3,-22,1,-22),h.quadraticCurveTo(5,-22,5,-17),h.lineTo(5,-6),h.quadraticCurveTo(9,-9,11,-5),h.quadraticCurveTo(15,-7,16,-2),h.lineTo(14,9),h.quadraticCurveTo(12,18,3,18),h.lineTo(-1,18),h.quadraticCurveTo(-5,17,-7,10),h.closePath(),h.fill(),h.stroke(),h.restore()}function Gl(){var r,o,y,d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W;if(ii=0,!k)try{for(var B=q(e.gameplay.filter(function(or){return or.kind==="tutorial-hand"})),O=B.next();!O.done;O=B.next()){var F=O.value,G=V.get(F.componentId),H=ze(F.parameters.targetId);if(!(!G||G.sceneId!==Q||!H||H.sceneId!==Q||!Cr(H))&&!(F.parameters.hideOnFirstInput&&$t)){var te=gn?ce:Se;if(!(te-Zt<F.parameters.idleDelaySeconds)){ii++;var de=F.parameters.destinationId?ze(F.parameters.destinationId):void 0,ne=De(H),he=void 0;he||(he=cr(mr(H),ne.width/2,ne.height/2));var Ae=te%1.2/1.2,We=Z!=null&&Z.matches?0:Ae*Ae*(3-2*Ae),He=he.x,se=he.y;if(F.parameters.mode!=="tap"){var be=de?cr(mr(de),De(de).width/2,De(de).height/2):{x:he.x-36,y:he.y+48};He=he.x+(be.x-he.x)*We,se=he.y+(be.y-he.y)*We}Yl(He+8,se+22,F.parameters.mode,We)}}}}catch(or){r={error:or}}finally{try{O&&!O.done&&(o=B.return)&&o.call(B)}finally{if(r)throw r.error}}try{for(var Re=q(on),Ee=Re.next();!Ee.done;Ee=Re.next()){var Oe=K(Ee.value,2),pe=Oe[0],gr=Oe[1],Pe=St("draw-stroke",pe).parameters;try{for(var ar=(v=void 0,q(gr.strokes)),we=ar.next();!we.done;we=ar.next()){var hr=we.value;if(!(hr.points.length<2)){h.save(),h.globalAlpha=Pe.mode==="slice-blade"?Math.max(0,1-hr.age/.18):1,h.strokeStyle=Pe.color,h.lineWidth=Pe.strokeWidth,h.lineCap="round",h.lineJoin="round",h.beginPath(),h.moveTo(hr.points[0].x,hr.points[0].y);try{for(var Ue=(c=void 0,q(hr.points.slice(1))),Ze=Ue.next();!Ze.done;Ze=Ue.next()){var Ur=Ze.value;h.lineTo(Ur.x,Ur.y)}}catch(or){c={error:or}}finally{try{Ze&&!Ze.done&&(w=Ue.return)&&w.call(Ue)}finally{if(c)throw c.error}}h.stroke(),h.restore()}}}catch(or){v={error:or}}finally{try{we&&!we.done&&(p=ar.return)&&p.call(ar)}finally{if(v)throw v.error}}}}catch(or){y={error:or}}finally{try{Ee&&!Ee.done&&(d=Re.return)&&d.call(Re)}finally{if(y)throw y.error}}try{for(var yr=q(wn),rr=yr.next();!rr.done;rr=yr.next()){var Yr=rr.value;if(!(Yr.broken||!Yr.drawRope)){var st=Tt.get(Yr.bodyId),jt=ze(Yr.anchorId);if(!(!st||!jt)){var ct=Rr(jt);h.save(),h.strokeStyle=Yr.ropeColor,h.lineWidth=Yr.ropeWidth,h.beginPath(),h.moveTo(ct.x,ct.y),h.lineTo(st.x,st.y),h.stroke(),h.restore()}}}}catch(or){m={error:or}}finally{try{rr&&!rr.done&&(S=yr.return)&&S.call(yr)}finally{if(m)throw m.error}}try{for(var Gr=q(e.gameplay.filter(function(or){var ht;return or.kind==="virtual-joystick"&&((ht=V.get(or.componentId))===null||ht===void 0?void 0:ht.sceneId)===Q})),Fr=Gr.next();!Fr.done;Fr=Gr.next()){var F=Fr.value,tt=ze(F.componentId),ne=F.parameters;if(!(!tt||!Cr(tt)||ne.drawControl===!1)){var Zr=ln.get(F.id),Er=Zr&&Zr.pointerId!==null?Zr.origin:Rr(tt),dr=Zr&&Zr.pointerId!==null?Zr.knobX:Er.x,At=Zr&&Zr.pointerId!==null?Zr.knobY:Er.y,Je=(T=ne.radiusPx)!==null&&T!==void 0?T:56;h.save(),h.fillStyle=(N=ne.baseColor)!==null&&N!==void 0?N:"#ffffff44",h.strokeStyle="#ffffffaa",h.lineWidth=2.5,h.beginPath(),h.arc(Er.x,Er.y,Je,0,Math.PI*2),h.fill(),h.stroke(),h.fillStyle=(W=ne.knobColor)!==null&&W!==void 0?W:"#fff0bdee",h.strokeStyle="#193b46aa",h.lineWidth=2,h.beginPath(),h.arc(dr,At,Je*.42,0,Math.PI*2),h.fill(),h.stroke(),h.restore()}}}catch(or){I={error:or}}finally{try{Fr&&!Fr.done&&(C=Gr.return)&&C.call(Gr)}finally{if(I)throw I.error}}try{for(var $r=q(vt),tr=$r.next();!tr.done;tr=$r.next()){var qe=tr.value,Me=Math.min(1,qe.elapsed/qe.seconds);h.save(),h.globalAlpha=1-Me,h.fillStyle=qe.color,h.strokeStyle="#193b46",h.lineWidth=3,h.font="900 "+qe.fontSize+"px sans-serif",h.textAlign="center",h.textBaseline="middle";var se=qe.y-(Z!=null&&Z.matches?0:qe.risePx*Me);h.strokeText(qe.text,qe.x,se),h.fillText(qe.text,qe.x,se),h.restore()}}catch(or){M={error:or}}finally{try{tr&&!tr.done&&(g=$r.return)&&g.call($r)}finally{if(M)throw M.error}}try{for(var br=q(at),Qr=br.next();!Qr.done;Qr=br.next()){var dt=Qr.value,Me=Math.min(1,dt.elapsed/dt.seconds),pt=R();h.save(),h.globalAlpha=dt.opacity*(1-Me),h.fillStyle=dt.color,h.fillRect(0,0,pt.width,pt.height),h.restore()}}catch(or){P={error:or}}finally{try{Qr&&!Qr.done&&(A=br.return)&&A.call(br)}finally{if(P)throw P.error}}}function Zl(){if(Fe){var r=Tt.get(Fe.targetId),o=Fe.behavior.parameters;if(r){var y=Fe.current.x-Fe.start.x,d=Fe.current.y-Fe.start.y,v=Math.hypot(y,d),p=Math.min(o.maxPullPx,v),c=v>.001?p/v:0;h.save(),h.lineCap="round";var w=Math.max(12,Math.min(r.width,r.height)*.62);if(h.strokeStyle="#173a2f66",h.lineWidth=3.5,h.beginPath(),h.arc(r.x,r.y,w,0,Math.PI*2),h.stroke(),h.strokeStyle=o.trajectoryColor,h.lineWidth=2,h.beginPath(),h.arc(r.x,r.y,w,0,Math.PI*2),h.stroke(),o.showTrajectory&&v>=o.minPullPx){var m=Pa(),S=fo(),I=S.bodies,C=S.zones,M=R(),g=tl({body:ge(ge({},r),{vx:m.vx,vy:m.vy,atRest:!1}),bodies:I,zones:C,bounds:{left:0,top:0,right:M.width,bottom:M.height},dots:o.trajectoryDots,bounces:o.trajectoryBounces});g.forEach(function(T,N){var W=.96-.52*(N/Math.max(1,g.length)),B=Math.max(2.2,4.5-N*.22);h.globalAlpha=W,h.fillStyle="#173a2f88",h.beginPath(),h.arc(T.x,T.y,B+1.3,0,Math.PI*2),h.fill(),h.fillStyle=o.trajectoryColor,h.beginPath(),h.arc(T.x,T.y,B,0,Math.PI*2),h.fill()})}if(v>=4){var P=r.x+y*c,A=r.y+d*c;h.globalAlpha=.9,h.strokeStyle="#173a2f66",h.lineWidth=5,h.beginPath(),h.moveTo(r.x,r.y),h.lineTo(P,A),h.stroke(),h.strokeStyle=o.trajectoryColor,h.lineWidth=2.6,h.beginPath(),h.moveTo(r.x,r.y),h.lineTo(P,A),h.stroke(),h.fillStyle="#173a2f88",h.beginPath(),h.arc(P,A,5.2,0,Math.PI*2),h.fill(),h.fillStyle=o.trajectoryColor,h.beginPath(),h.arc(P,A,3.6,0,Math.PI*2),h.fill()}h.restore()}}}function $l(r){var o,y,d,v;try{for(var p=q(io()),c=p.next();!c.done;c=p.next()){var w=c.value,m=w.contract==="native.group.v1"?Wi(w.id):[w];try{for(var S=(d=void 0,q(m)),I=S.next();!I.done;I=S.next()){var C=I.value;if(C.contract==="native.stage3d.v1"&&Cr(C)&&De(C).skyColor)return De(C).skyColor;if(!(C.contract!=="native.rectangle.v1"||!Cr(C))){var M=De(C);if(!(M.opacity<.95||!M.fill||M.fill==="transparent")&&(/(?:^|\.)(background|backdrop|bg)(?:\.fill)?$/.test(C.id)||M.width>=r.width*.9&&M.height>=r.height*.9))return M.fill}}}catch(g){d={error:g}}finally{try{I&&!I.done&&(v=S.return)&&v.call(S)}finally{if(d)throw d.error}}}}catch(g){o={error:g}}finally{try{c&&!c.done&&(y=p.return)&&y.call(p)}finally{if(o)throw o.error}}return"#102a34"}function Kl(){var r;if(bn&&Cr(bn.c)){var o=bn.c,y=De(o);h.save(),h.transform.apply(h,ae([],K(mr(o)),!1)),h.strokeStyle=(r=bn.highlightColor)!==null&&r!==void 0?r:"#ffffff",h.lineWidth=4,h.globalAlpha=.85,h.strokeRect(-4,-4,y.width+8,y.height+8),h.restore()}if(Ge!=null&&Ge.b.parameters.bringToFront){var o=ze(Ge.targetId);o&&si(o,o.parentId?mr(ze(o.parentId)):tn(),[],o.prototypeId)}}function rt(){var r,o,y,d,v,p;ye=ie,ie=new Map;var c=R();ue!==void 0&&ue!==c.landscape&&Jt(),ue=c.landscape;var w=Math.min(devicePixelRatio||1,2),m=t.clientWidth,S=t.clientHeight;(t.width!==Math.round(m*w)||t.height!==Math.round(S*w))&&(t.width=Math.round(m*w),t.height=Math.round(S*w)),h.setTransform(w,0,0,w,0,0),h.fillStyle=$l(c),h.fillRect(0,0,m,S);var I=Math.min(m/c.width,S/c.height),C=(m-c.width*I)/2,M=(S-c.height*I)/2;if(Ml=I||1,Sl=w,h.translate(C,M),h.scale(I,I),Lr){var g=Math.min(1,Lr.elapsed/Lr.seconds),P=Lr.intensity*(1-g);h.translate(Math.sin(Lr.elapsed*95)*P,Math.cos(Lr.elapsed*113)*P)}h.save(),h.beginPath(),h.rect(0,0,c.width,c.height),h.clip(),Yt=[];try{for(var A=q(io()),T=A.next();!T.done;T=A.next()){var N=T.value;si(N)}}catch(se){r={error:se}}finally{try{T&&!T.done&&(o=A.return)&&o.call(A)}finally{if(r)throw r.error}}try{for(var W=q(me),B=W.next();!B.done;B=W.next()){var N=B.value;N.parentId||si(N,tn(),[],N.prototypeId)}}catch(se){y={error:se}}finally{try{B&&!B.done&&(d=W.return)&&d.call(W)}finally{if(y)throw y.error}}if(Kl(),Zl(),k&&zt){for(var O=V.get(zt);O!=null&&O.parentId;)O=V.get(O.parentId);O!=null&&O.prototype&&si(O)}Ca(),h.save();try{for(var F=q(le),G=F.next();!G.done;G=F.next()){var H=G.value;if(!(H.shape==="pixel-confetti"||H.shape==="confetti")){var te=Math.min(1,H.life*2),de=1.5+2.5*te;if(h.globalAlpha=te,h.globalCompositeOperation=H.shape==="square"?"source-over":"lighter",h.fillStyle=H.color,H.shape==="square"){var ne=Math.max(2,Math.round(de*1.6));h.fillRect(Math.round(H.x-ne/2),Math.round(H.y-ne/2),ne,ne);continue}h.globalCompositeOperation="lighter",h.shadowColor=H.color,h.shadowBlur=le.length<=16?6:0,h.strokeStyle=H.color,h.lineWidth=1.5+te,h.beginPath(),h.moveTo(H.x-H.vx*.025,H.y-H.vy*.025),h.lineTo(H.x,H.y),h.stroke(),h.beginPath(),h.arc(H.x,H.y,de,0,Math.PI*2),h.fill()}}}catch(se){v={error:se}}finally{try{G&&!G.done&&(p=F.return)&&p.call(F)}finally{if(v)throw v.error}}if(h.restore(),Gl(),k&&zt){var he=Yt.filter(function(se){return se.c.contract!=="native.group.v1"&&(se.c.id===zt||Ct(se.c,zt))});if(he.length){var Ae=he.map(function(se){return ft(se.c,se.m)}),We=Math.min.apply(Math,ae([],K(Ae.map(function(se){return se.left})),!1)),He=Math.min.apply(Math,ae([],K(Ae.map(function(se){return se.top})),!1));h.strokeStyle="#55e6ef",h.lineWidth=2/I,h.strokeRect(We,He,Math.max.apply(Math,ae([],K(Ae.map(function(se){return se.right})),!1))-We,Math.max.apply(Math,ae([],K(Ae.map(function(se){return se.bottom})),!1))-He)}}h.restore(),I>0&&Ca(void 0,{x:-C/I,y:-M/I,width:m/I,height:S/I})}function Ql(r){var o,y,d,v,p=Array.isArray(r)?ae([],K(new Set(r)),!1):void 0;rt();var c=R(),w=new Set,m=[];try{for(var S=q(Yt),I=S.next();!I.done;I=S.next()){var C=I.value,M=(d=C.c.prototypeId)!==null&&d!==void 0?d:C.c.id;if(!(C.c.contract==="native.group.v1"||p&&!p.includes(M))){w.add(M);var g=ft(C.c,C.m),P=((v=De(C.c).strokeWidth)!==null&&v!==void 0?v:0)/2;g.left-=P,g.right+=P,g.top-=P,g.bottom+=P;var A={left:Math.max(0,-g.left),right:Math.max(0,g.right-c.width),top:Math.max(0,-g.top),bottom:Math.max(0,g.bottom-c.height)};Object.values(A).some(function(N){return N>.01})&&m.push({id:M,contract:C.c.contract,bounds:g,overflow:A})}}}catch(N){o={error:N}}finally{try{I&&!I.done&&(y=S.return)&&y.call(S)}finally{if(o)throw o.error}}var T=p?p.filter(function(N){return!w.has(N)}):[];return{ok:m.length===0&&T.length===0,viewport:ge(ge({},c),{canvasWidth:t.clientWidth,canvasHeight:t.clientHeight}),issues:m,missing:T}}function Jl(r){var o,y,d,v,p,c,w,m,S,I,C,M,g,P,A,T,N,W,B,O,F,G,H,te,de,ne,he,Ae,We,He,se,be,Re,Ee=r===void 0?{}:r,Oe=Ee.ids,pe=Ee.interactiveIds,gr=Ee.network,Pe=gr===void 0?"standalone":gr,ar=Ee.minTouchPx,we=ar===void 0?44:ar,hr=Array.isArray(Oe)?ae([],K(new Set(Oe)),!1):void 0;rt();var Ue=R(),Ze=Math.min(t.clientWidth/Ue.width,t.clientHeight/Ue.height),Ur=eo(Ue,Pe),yr=[],rr=new Set,Yr=function(L){var ke;return!hr||hr.includes((ke=L.c.prototypeId)!==null&&ke!==void 0?ke:L.c.id)},st=Yt.filter(Yr),jt=new Set(e.events.filter(function(L){return L.kind==="click"}).map(function(L){return L.componentId}));try{for(var ct=q(e.gameplay),Gr=ct.next();!Gr.done;Gr=ct.next()){var Fr=Gr.value;["drag","match-tile","aim-launch","aim-launch-3d","swipe-input","hold-charge","virtual-joystick","draw-stroke","erase-mask"].includes(Fr.kind)&&jt.add(Fr.componentId)}}catch(L){o={error:L}}finally{try{Gr&&!Gr.done&&(y=ct.return)&&y.call(ct)}finally{if(o)throw o.error}}var tt=new Set(pe!=null?pe:jt),Zr=new Set(e.gameplay.filter(function(L){return["aim-launch","aim-launch-3d","swipe-input","hold-charge","draw-stroke","virtual-joystick"].includes(L.kind)&&(L.parameters.dragMode==="anywhere"||L.kind==="draw-stroke"||L.kind==="virtual-joystick"&&L.parameters.mode==="floating")}).map(function(L){return L.componentId})),Er=function(L){var ke;return tt.has((ke=L.c.prototypeId)!==null&&ke!==void 0?ke:L.c.id)},dr=function(L,ke,Be,_e,Wr,Sr){return yr.push(ge(ge({kind:L,severity:ke,id:Be},Sr?{otherId:Sr}:{}),{detail:_e,metrics:Wr}))},At=function(L){var ke=[[0,0],[L.width,0],[L.width,L.height],[0,L.height]].map(function(Be){var _e=K(Be,2),Wr=_e[0],Sr=_e[1];return cr(L.matrix,Wr,Sr)});return{left:Math.min.apply(Math,ae([],K(ke.map(function(Be){return Be.x})),!1)),right:Math.max.apply(Math,ae([],K(ke.map(function(Be){return Be.x})),!1)),top:Math.min.apply(Math,ae([],K(ke.map(function(Be){return Be.y})),!1)),bottom:Math.max.apply(Math,ae([],K(ke.map(function(Be){return Be.y})),!1))}};try{for(var Je=q(st),$r=Je.next();!$r.done;$r=Je.next()){var tr=$r.value,qe=(H=tr.c.prototypeId)!==null&&H!==void 0?H:tr.c.id;rr.add(qe);var Me=ft(tr.c,tr.m),br=((te=De(tr.c).strokeWidth)!==null&&te!==void 0?te:0)/2;Me.left-=br,Me.right+=br,Me.top-=br,Me.bottom+=br;var Qr=tr.c.contract==="native.group.v1"&&!De(tr.c).clip,dt=tr.c.contract==="native.image.v1"&&tr.clips.length===0&&De(tr.c).fit==="cover"&&Me.left<=0&&Me.top<=0&&Me.right>=Ue.width&&Me.bottom>=Ue.height||tr.c.contract==="native.stage3d.v1"&&Me.left<=0&&Me.top<=0&&Me.right>=Ue.width&&Me.bottom>=Ue.height,pt=tr.c.contract==="native.rectangle.v1"&&br===0&&Me.left<=0&&Me.top<=0&&Me.right>=Ue.width&&Me.bottom>=Ue.height||dt;if(!Qr){var or={left:Math.max(0,-Me.left),right:Math.max(0,Me.right-Ue.width),top:Math.max(0,-Me.top),bottom:Math.max(0,Me.bottom-Ue.height)};if(!pt&&!yo(tr.c)&&Object.values(or).some(function(L){return L>.01})&&dr("stage-overflow","blocker",qe,"Component extends beyond the active stage.",{bounds:Me,overflow:or}),tr.c.contract==="native.image.v1"&&tr.clips.length===0){var ht=Me.right-Me.left,Et=Me.bottom-Me.top,Sn=/(?:^|\.)(backdrop|background|bg)$/.test(qe)||De(tr.c).fit==="cover"&&!tr.c.parentId&&Me.left<=1&&Me.top<=1&&(ht>=Ue.width*.4||Et>=Ue.height*.4);Sn&&(Me.left>.5||Me.top>.5||Me.right<Ue.width-.5||Me.bottom<Ue.height-.5)&&dr("backdrop-incomplete","blocker",qe,"Backdrop image does not cover the full active stage, leaving a visible seam.",{bounds:Me,stage:{width:Ue.width,height:Ue.height}})}try{for(var Rt=(p=void 0,q(tr.clips)),mt=Rt.next();!mt.done;mt=Rt.next()){var Ot=mt.value,wr=At(Ot),nt={left:Math.max(0,wr.left-Me.left),right:Math.max(0,Me.right-wr.right),top:Math.max(0,wr.top-Me.top),bottom:Math.max(0,Me.bottom-wr.bottom)};Object.values(nt).some(function(L){return L>.01})&&dr("parent-clip-crop","blocker",qe,"Component is cropped by an ancestor clipping group.",{bounds:Me,clip:wr,crop:nt})}}catch(L){p={error:L}}finally{try{mt&&!mt.done&&(c=Rt.return)&&c.call(Rt)}finally{if(p)throw p.error}}}if(tr.textMetrics){var yt=tr.textMetrics;(yt.overflowsWidth||yt.overflowsHeight)&&dr("text-overflow","blocker",qe,"Text does not fit its component after wrapping and auto-fit.",yt);var Lt=(de=yt.fontSize)!==null&&de!==void 0?de:yt.scale*8;Lt<12&&dr("text-illegible",Lt<8?"blocker":"warning",qe,"Rendered text is below the recommended legible size.",ge({renderedFontSize:Lt},yt));var Nr=De(tr.c);if(Nr.pixelPanel&&Nr.align!=="center"){var dn=Math.max(0,Nr.width-2*(Nr.padding===void 0?8:Nr.padding));dn-((ne=yt.renderedWidth)!==null&&ne!==void 0?ne:0)>12&&dr("panel-off-center","blocker",qe,"Text inside a framed pixel panel is not horizontally centered.",{align:Nr.align,innerWidth:dn,renderedWidth:(he=yt.renderedWidth)!==null&&he!==void 0?he:0})}}if(Er(tr)&&!Zr.has(qe)&&(tr.c.contract!=="native.group.v1"||Me.right>Me.left&&Me.bottom>Me.top)){var zr=(Me.right-Me.left)*Ze,Mr=(Me.bottom-Me.top)*Ze;(zr<we-.01||Mr<we-.01)&&dr("touch-target-small","blocker",qe,"Interactive target is smaller than the required physical touch size.",{width:zr,height:Mr,minTouchPx:we,scale:Ze})}if(Er(tr)&&!Zr.has(qe)||tr.c.contract==="native.text.v1")try{for(var nr=(w=void 0,q(Ur.zones)),Jr=nr.next();!Jr.done;Jr=nr.next()){var ur=Jr.value,zr=Math.min(Me.right,ur.right)-Math.max(Me.left,ur.left),Mr=Math.min(Me.bottom,ur.bottom)-Math.max(Me.top,ur.top);zr>.01&&Mr>.01&&dr("sdk-safe-area-collision","blocker",qe,"Component intersects a reserved ad-SDK overlay zone.",{bounds:Me,zone:ur,intersection:{width:zr,height:Mr},network:Pe})}}catch(L){w={error:L}}finally{try{Jr&&!Jr.done&&(m=nr.return)&&m.call(nr)}finally{if(w)throw w.error}}}}catch(L){d={error:L}}finally{try{$r&&!$r.done&&(v=Je.return)&&v.call(Je)}finally{if(d)throw d.error}}for(var Kr=st.filter(function(L){return Er(L)&&L.c.contract!=="native.group.v1"}),ir=0;ir<Kr.length;ir++)for(var Br=ir+1;Br<Kr.length;Br++){var Ye=Kr[ir],je=Kr[Br],kn=(Ae=Ye.c.prototypeId)!==null&&Ae!==void 0?Ae:Ye.c.id,gt=(We=je.c.prototypeId)!==null&&We!==void 0?We:je.c.id;if(!(kn===gt||Ct(Ye.c,je.c.id)||Ct(je.c,Ye.c.id))){var It=ft(Ye.c,Ye.m),Dt=ft(je.c,je.m),zr=Math.min(It.right,Dt.right)-Math.max(It.left,Dt.left),Mr=Math.min(It.bottom,Dt.bottom)-Math.max(It.top,Dt.top);zr>1&&Mr>1&&dr("interactive-overlap","blocker",kn,"Interactive targets overlap.",{intersection:{width:zr,height:Mr},first:It,second:Dt},gt)}}var Yi=function(L){if(!L||L==="transparent")return!1;var ke=/^#([0-9a-f]{4}|[0-9a-f]{8})$/i.exec(L);if(ke)return ke[1].length===4?ke[1][3].toLowerCase()==="f":ke[1].slice(6).toLowerCase()==="ff";var Be=/^rgba\([^,]+,[^,]+,[^,]+,\s*([0-9.]+)\s*\)$/i.exec(L);return Be?Number(Be[1])>=.95:!0},Ln=[];st.forEach(function(L,ke){var Be,_e;L.c.contract==="native.rectangle.v1"&&!Er(L)&&((Be=De(L.c).opacity)!==null&&Be!==void 0?Be:1)>=.95&&Yi(De(L.c).fill)&&Ln.push({rowIndex:ke,row:L,order:(_e=L.c.order)!==null&&_e!==void 0?_e:0,bounds:ft(L.c,L.m)})});var Cn=st.filter(function(L,ke){var Be,_e=ft(L.c,L.m),Wr=(Be=L.c.order)!==null&&Be!==void 0?Be:0;return!Ln.some(function(Sr){return Sr.rowIndex>ke&&Sr.order>Wr&&Sr.row.c.id!==L.c.id&&!Ct(Sr.row.c,L.c.id)&&!Ct(L.c,Sr.row.c.id)&&Sr.bounds.left<=_e.left+1&&Sr.bounds.right>=_e.right-1&&Sr.bounds.top<=_e.top+1&&Sr.bounds.bottom>=_e.bottom-1})}),jn=Cn.map(function(L,ke){return{row:L,rowIndex:ke}}).filter(function(L){var ke,Be=L.row;if(Be.c.contract!=="native.rectangle.v1")return!1;var _e=ft(Be.c,Be.m),Wr=_e.right-_e.left,Sr=_e.bottom-_e.top,vn=((ke=De(Be.c).strokeWidth)!==null&&ke!==void 0?ke:0)===0&&_e.left<=0&&_e.right>=Ue.width;return!vn&&Wr>=180&&Sr>=140&&!Er(Be)}).map(function(L){var ke,Be=L.row,_e=L.rowIndex;return{id:(ke=Be.c.prototypeId)!==null&&ke!==void 0?ke:Be.c.id,row:Be,rowIndex:_e,bounds:ft(Be.c,Be.m)}}),ci=function(L,ke,Be,_e){var Wr,Sr;_e===void 0&&(_e=!1);var vn=(Wr=L.c.prototypeId)!==null&&Wr!==void 0?Wr:L.c.id,bi=(Be.left+Be.right)/2,sn=(Be.top+Be.bottom)/2,za=(Sr=L.c.order)!==null&&Sr!==void 0?Sr:0;return jn.filter(function(pr){var cn;return pr.id!==vn&&(!_e||pr.rowIndex<ke||((cn=pr.row.c.order)!==null&&cn!==void 0?cn:0)===za)&&Be.right-Be.left<=pr.bounds.right-pr.bounds.left+4&&Be.bottom-Be.top<=pr.bounds.bottom-pr.bounds.top+4&&bi>=pr.bounds.left&&bi<=pr.bounds.right&&sn>=pr.bounds.top&&sn<=pr.bounds.bottom}).sort(function(pr,cn){return(pr.bounds.right-pr.bounds.left)*(pr.bounds.bottom-pr.bounds.top)-(cn.bounds.right-cn.bounds.left)*(cn.bounds.bottom-cn.bounds.top)||cn.rowIndex-pr.rowIndex})[0]},Ht=new Map,Ft=new Map;if(jn.length){Cn.forEach(function(L,ke){var Be,_e=(Be=L.c.prototypeId)!==null&&Be!==void 0?Be:L.c.id,Wr=ft(L.c,L.m),Sr=(Wr.left+Wr.right)/2,vn=(Wr.top+Wr.bottom)/2,bi=L.c.contract==="native.button.v1"&&!Bt.has(L.c.id),sn=L.c.parentId?ze(L.c.parentId):void 0,za=L.c.contract==="native.text.v1"&&De(L.c).align==="center"&&(sn==null?void 0:sn.contract)!=="native.button.v1";if(bi||za){var pr=ci(L,ke,Wr,!1);pr&&(Ht.has(pr.id)||Ht.set(pr.id,{panel:pr,items:[]}),Ht.get(pr.id).items.push({id:_e,bounds:Wr,cx:Sr,cy:vn,isBtn:bi}))}if(["native.text.v1","native.image.v1","native.button.v1"].includes(L.c.contract)&&(sn==null?void 0:sn.contract)!=="native.button.v1"){var pr=ci(L,ke,Wr,!0);pr&&(Ft.has(pr.id)||Ft.set(pr.id,{panel:pr,content:[]}),Ft.get(pr.id).content.push({row:L,id:_e,bounds:Wr}))}});try{for(var Ne=q(Ht.values()),vr=Ne.next();!vr.done;vr=Ne.next()){var qr=vr.value,sr=qr.panel,xt=qr.items;if(xt.some(function(L){return L.isBtn})){var lr=sr.bounds,jr=(lr.left+lr.right)/2;try{for(var it=(C=void 0,q(xt)),un=it.next();!un.done;un=it.next()){var ut=un.value,_t={left:ut.bounds.left-lr.left,right:lr.right-ut.bounds.right,top:ut.bounds.top-lr.top,bottom:lr.bottom-ut.bounds.bottom},_n=Math.min(_t.left,_t.right,_t.top,_t.bottom);(_n<10||_n*Ze<8)&&dr("panel-edge-cramped","blocker",ut.id,"Element sits too close to its enclosing panel edge.",{panelId:sr.id,margins:_t,scale:Ze,minStagePx:10,minCssPx:8},sr.id)}}catch(L){C={error:L}}finally{try{un&&!un.done&&(M=it.return)&&M.call(it)}finally{if(C)throw C.error}}var En=[],hi=function(L){var ke=En.find(function(Be){return Math.abs(Be.cy-L.cy)<=16&&Be.isBtn===L.isBtn});ke?ke.items.push(L):En.push({cy:L.cy,isBtn:L.isBtn,items:[L]})};try{for(var Gi=(g=void 0,q(xt)),yi=Gi.next();!yi.done;yi=Gi.next()){var ut=yi.value;hi(ut)}}catch(L){g={error:L}}finally{try{yi&&!yi.done&&(P=Gi.return)&&P.call(Gi)}finally{if(g)throw g.error}}try{for(var Zi=(A=void 0,q(En)),pi=Zi.next();!pi.done;pi=Zi.next()){var Va=pi.value,lf=Math.min.apply(Math,ae([],K(Va.items.map(function(L){return L.bounds.left})),!1)),ff=Math.max.apply(Math,ae([],K(Va.items.map(function(L){return L.bounds.right})),!1)),ko=(lf+ff)/2,Co=ko-jr;Math.abs(Co)>3&&dr("panel-off-center","blocker",Va.items[0].id,"Element is not horizontally centered inside its enclosing panel.",{panelId:sr.id,offsetX:Co,groupCenterX:ko,panelCenterX:jr,scale:Ze},sr.id)}}catch(L){A={error:L}}finally{try{pi&&!pi.done&&(T=Zi.return)&&T.call(Zi)}finally{if(A)throw A.error}}}}}catch(L){S={error:L}}finally{try{vr&&!vr.done&&(I=Ne.return)&&I.call(Ne)}finally{if(S)throw S.error}}try{for(var $i=q(Ft.values()),mi=$i.next();!mi.done;mi=$i.next())for(var Eo=mi.value,sr=Eo.panel,Ki=Eo.content,df=Ht.has(sr.id),ir=0;ir<Ki.length;ir++)for(var Br=ir+1;Br<Ki.length;Br++){var Ye=Ki[ir],je=Ki[Br];if(!(Ye.id===je.id||Ct(Ye.row.c,je.row.c.id)||Ct(je.row.c,Ye.row.c.id))){var uf=Ye.row.c.contract==="native.image.v1"&&je.row.c.contract==="native.image.v1";if(!(uf&&(!df||Ye.row.c.parentId&&Ye.row.c.parentId===je.row.c.parentId))){var zr=Math.min(Ye.bounds.right,je.bounds.right)-Math.max(Ye.bounds.left,je.bounds.left),Mr=Math.min(Ye.bounds.bottom,je.bounds.bottom)-Math.max(Ye.bounds.top,je.bounds.top);zr>2&&Mr>2&&dr("panel-content-overlap","blocker",Ye.id,"Panel elements overlap each other.",{panelId:sr.id,intersection:{width:zr,height:Mr},first:Ye.bounds,second:je.bounds},je.id)}}}}catch(L){N={error:L}}finally{try{mi&&!mi.done&&(W=$i.return)&&W.call($i)}finally{if(N)throw N.error}}}var ei=Cn.filter(function(L){if(L.c.contract!=="native.text.v1")return!1;var ke=L.c.parentId?ze(L.c.parentId):void 0;return(ke==null?void 0:ke.contract)!=="native.button.v1"}).map(function(L){var ke,Be,_e=String((ke=De(L.c).text)!==null&&ke!==void 0?ke:"").replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(Wr,Sr){var vn;return String((vn=j[Sr])!==null&&vn!==void 0?vn:"")}).trim();return{row:L,id:(Be=L.c.prototypeId)!==null&&Be!==void 0?Be:L.c.id,bounds:ft(L.c,L.m),raw:_e,norm:_e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim()}}).filter(function(L){return L.raw.length>0}),vf=jn.filter(function(L){var ke,Be;return((ke=Ht.get(L.id))===null||ke===void 0?void 0:ke.items.some(function(_e){return _e.isBtn}))||((Be=Ft.get(L.id))===null||Be===void 0?void 0:Be.content.some(function(_e){return _e.row.c.contract==="native.button.v1"}))});try{for(var Qi=q(vf),gi=Qi.next();!gi.done;gi=Qi.next()){var sr=gi.value,lr=sr.bounds,jr=(lr.left+lr.right)/2,sf=lr.right-lr.left;try{for(var Ji=(F=void 0,q(ei)),Ii=Ji.next();!Ii.done;Ii=Ji.next()){var en=Ii.value;if(De(en.row.c).align==="center"&&!(en.bounds.bottom>lr.top+6||lr.top-en.bounds.bottom>48)){var Po=en.bounds.right-en.bounds.left,xi=(en.bounds.left+en.bounds.right)/2,cf=Math.min(en.bounds.right,lr.right)-Math.max(en.bounds.left,lr.left);(xi>=lr.left&&xi<=lr.right||cf>=Po*.6)&&Po<=sf+60&&Math.abs(xi-jr)>4&&dr("header-off-center","blocker",en.id,"Centered text above a panel is not horizontally aligned with the panel below it.",{panelId:sr.id,offsetX:xi-jr,textCenterX:xi,panelCenterX:jr,scale:Ze},sr.id)}}}catch(_e){F={error:_e}}finally{try{Ii&&!Ii.done&&(G=Ji.return)&&G.call(Ji)}finally{if(F)throw F.error}}}}catch(L){B={error:L}}finally{try{gi&&!gi.done&&(O=Qi.return)&&O.call(Qi)}finally{if(B)throw B.error}}for(var ir=0;ir<ei.length;ir++)for(var Br=ir+1;Br<ei.length;Br++){var Ye=ei[ir],je=ei[Br];if(!(Ye.id===je.id||Ct(Ye.row.c,je.row.c.id)||Ct(je.row.c,Ye.row.c.id))){var zr=Math.min(Ye.bounds.right,je.bounds.right)-Math.max(Ye.bounds.left,je.bounds.left),Mr=Math.min(Ye.bounds.bottom,je.bounds.bottom)-Math.max(Ye.bounds.top,je.bounds.top);if(zr>2&&Mr>2&&dr("panel-content-overlap","blocker",Ye.id,"Visible text elements overlap.",{intersection:{width:zr,height:Mr},first:Ye.bounds,second:je.bounds},je.id),Ye.norm&&je.norm){var To=K(Ye.norm.length<=je.norm.length?[Ye.norm,je.norm]:[je.norm,Ye.norm],2),qi=To[0],Ao=To[1];(qi===Ao&&qi.length>=6||qi.length>=12&&Ao.includes(qi))&&dr("duplicate-visible-copy","blocker",Ye.id,"Duplicate visible copy appears in multiple text elements simultaneously.",{first:Ye.raw,second:je.raw},je.id)}}}var rn=ei.filter(function(L){return!/^[\d\s/.,:%+\-x]+$/i.test(L.raw)}),ji=rn.reduce(function(L,ke){return L+(ke.norm?ke.norm.split(" ").filter(Boolean).length:0)},0),Na=rn.reduce(function(L,ke){return L+ke.raw.replace(/\s+/g," ").length},0);ji>20||Na>130||rn.length>5?dr("text-clutter-heavy","blocker",(se=(He=rn[0])===null||He===void 0?void 0:He.id)!==null&&se!==void 0?se:null,"Too much visible copy on one screen; keep playable ads visual and concise.",{blocks:rn.length,wordCount:ji,charCount:Na,texts:rn.map(function(L){return L.raw})}):(ji>12||rn.length>4)&&dr("text-clutter-heavy","warning",(Re=(be=rn[0])===null||be===void 0?void 0:be.id)!==null&&Re!==void 0?Re:null,"Screen copy is getting dense; consider trimming narration so gameplay carries the experience.",{blocks:rn.length,wordCount:ji,charCount:Na,texts:rn.map(function(L){return L.raw})});var Ro=hr?hr.filter(function(L){if(rr.has(L))return!1;var ke=ze(L);return(ke==null?void 0:ke.contract)==="native.mesh3d.v1"?!1:!ke||Cr(ke)}):[];return{ok:!yr.some(function(L){return L.severity==="blocker"})&&Ro.length===0,viewport:ge(ge({},Ue),{canvasWidth:t.clientWidth,canvasHeight:t.clientHeight,scale:Ze}),defects:yr,missing:Ro,interactive:Kr.map(function(L){var ke;return{id:(ke=L.c.prototypeId)!==null&&ke!==void 0?ke:L.c.id,bounds:ft(L.c,L.m)}}),safeArea:Ur}}function Ct(r,o){for(;r.parentId;){if(r.parentId===o)return!0;r=ze(r.parentId)}return!1}function yo(r){for(var o=function(v){if(e.gameplay.some(function(p){var c;return p.kind==="camera-follow"&&p.componentId===((c=v.prototypeId)!==null&&c!==void 0?c:v.id)}))return{value:!0}},y=r;y;y=y.parentId?ze(y.parentId):void 0){var d=o(y);if(typeof d=="object")return d.value}return!1}function Ea(r){var o=R(),y=t.getBoundingClientRect(),d=Math.min(y.width/o.width,y.height/o.height);return{x:(r.clientX-y.left-(y.width-o.width*d)/2)/d,y:(r.clientY-y.top-(y.height-o.height*d)/2)/d}}function ql(r,o){var y,d,v,p;try{try{for(var c=q(r.clips),w=c.next();!w.done;w=c.next()){var m=w.value,S=cr(Xt(m.matrix),o.x,o.y);if(S.x<0||S.y<0||S.x>m.width||S.y>m.height)return!1}}catch(O){y={error:O}}finally{try{w&&!w.done&&(d=c.return)&&d.call(c)}finally{if(y)throw y.error}}var I=cr(Xt(r.m),o.x,o.y),C=De(r.c);if(r.c.contract==="native.path.v1"){var M=new Path2D,g=function(O,F){({M:function(){return M.moveTo.apply(M,ae([],K(F),!1))},L:function(){return M.lineTo.apply(M,ae([],K(F),!1))},C:function(){return M.bezierCurveTo.apply(M,ae([],K(F),!1))},Q:function(){return M.quadraticCurveTo.apply(M,ae([],K(F),!1))},Z:function(){return M.closePath()}})[O]()};try{for(var P=q(C.commands),A=P.next();!A.done;A=P.next()){var T=K(A.value),N=T[0],W=T.slice(1);g(N,W)}}catch(O){v={error:O}}finally{try{A&&!A.done&&(p=P.return)&&p.call(P)}finally{if(v)throw v.error}}h.save(),h.setTransform(1,0,0,1,0,0),h.lineWidth=C.strokeWidth;var B=h.isPointInPath(M,I.x,I.y)||C.strokeWidth>0&&h.isPointInStroke(M,I.x,I.y);return h.restore(),B}return r.c.contract==="native.ellipse.v1"?Math.pow((I.x-C.width/2)/(C.width/2),2)+Math.pow((I.y-C.height/2)/(C.height/2),2)<=1:I.x>=0&&I.y>=0&&I.x<=C.width&&I.y<=C.height}catch{return!1}}function Fi(r){return ae([],K(Yt),!1).reverse().find(function(o){return o.c.contract!=="native.group.v1"&&o.c.sceneId===Q&&ze(o.c.id)&&Cr(o.c)&&ql(o,r)})}function Xi(r){for(var o=[];r;)o.push(r),r=ze(r.parentId);return o}function Pa(){if(!Fe)return{vx:0,vy:0,power:0,pull:0};var r=Fe.behavior.parameters,o=Fe.current.x-Fe.start.x,y=Fe.current.y-Fe.start.y,d=Math.hypot(o,y),v=Math.max(0,Math.min(1,(d-r.minPullPx)/Math.max(1,r.maxPullPx-r.minPullPx))),p=r.minSpeed+(r.maxSpeed-r.minSpeed)*v,c=r.invert?-1:1;return{vx:d?o/d*p*c:0,vy:d?y/d*p*c:0,power:v,pull:d}}function po(r){if(Fe){Fe.current=r;var o=Pa();Fe.power=o.power,Fe.behavior.parameters.powerVariableId&&(j[Fe.behavior.parameters.powerVariableId]=o.power)}}function mo(r){var o,y;r===void 0&&(r=!1);try{var d=(o=globalThis.AudioContext)!==null&&o!==void 0?o:globalThis.webkitAudioContext;d&&!Ke&&(Ke=new d,(y=Ke.addEventListener)===null||y===void 0||y.call(Ke,"statechange",function(){(Ke==null?void 0:Ke.state)==="running"&&xa()})),vi(r)}catch{}}function jl(r,o,y){var d,v,p,c,w,m,S=function(F){var G=y.find(function(de){var ne;return((ne=de.prototypeId)!==null&&ne!==void 0?ne:de.id)===F.componentId});if(!G)return"continue";var H=cr(Xt(mr(G)),o.x,o.y),te=ui(G,F);return te.stampSegment(H,H),Xr={kind:"mask",pointerId:r.pointerId,c:G,behavior:F,last:H},(w=t.setPointerCapture)===null||w===void 0||w.call(t,r.pointerId),{value:!0}};try{for(var I=q(e.gameplay.filter(function(F){var G;return F.kind==="erase-mask"&&((G=V.get(F.componentId))===null||G===void 0?void 0:G.sceneId)===Q})),C=I.next();!C.done;C=I.next()){var M=C.value,g=S(M);if(typeof g=="object")return g.value}}catch(F){d={error:F}}finally{try{C&&!C.done&&(v=I.return)&&v.call(I)}finally{if(d)throw d.error}}if(y.some(function(F){return F.contract==="native.button.v1"||e.events.some(function(G){var H;return G.kind==="click"&&G.componentId===((H=F.prototypeId)!==null&&H!==void 0?H:F.id)})}))return!1;try{for(var P=q(e.gameplay.filter(function(F){var G;return F.kind==="draw-stroke"&&((G=V.get(F.componentId))===null||G===void 0?void 0:G.sceneId)===Q})),A=P.next();!A.done;A=P.next()){var M=A.value,T=V.get(M.componentId),N=Xt(mr(T)),W=cr(N,o.x,o.y),B=De(T);if(!(W.x<0||W.y<0||W.x>B.width||W.y>B.height)){var O=Tl(M);return O.begin(o),Xr={kind:"stroke",pointerId:r.pointerId,c:T,behavior:M,store:O,last:o},er({kind:"strokeStart",componentId:T.id}),(m=t.setPointerCapture)===null||m===void 0||m.call(t,r.pointerId),!0}}}catch(F){p={error:F}}finally{try{A&&!A.done&&(c=P.return)&&c.call(P)}finally{if(p)throw p.error}}return!1}function _l(r,o,y){var d,v,p,c,w,m,S,I=y.store.active;if(I){try{for(var C=q(e.gameplay.filter(function(te){var de;return te.kind==="collider"&&((de=V.get(te.componentId))===null||de===void 0?void 0:de.sceneId)===Q})),M=C.next();!M.done;M=C.next()){var g=M.value,P=V.get(g.componentId);try{for(var A=(p=void 0,q(Hr(P))),T=A.next();!T.done;T=A.next()){var N=T.value;!Cr(N)||I.hitIds.has(N.id)||$o(r,o,ho(N,g.parameters.shape))&&(I.hitIds.add(N.id),er(lt("sliceHit",N)))}}catch(te){p={error:te}}finally{try{T&&!T.done&&(c=A.return)&&c.call(A)}finally{if(p)throw p.error}}}}catch(te){d={error:te}}finally{try{M&&!M.done&&(v=C.return)&&v.call(C)}finally{if(d)throw d.error}}try{for(var W=q(wn),B=W.next();!B.done;B=W.next()){var O=B.value;if(!(O.broken||!O.breakable||I.hitIds.has(O.key))){var F=Tt.get(O.bodyId),G=ze(O.anchorId);if(!(!F||!G)){var H=Rr(G);Xa(r,o,{x:H.x,y:H.y},{x:F.x,y:F.y})&&(I.hitIds.add(O.key),O.broken=!0,Ni.add(O.key),er({kind:"jointBreak",behaviorId:O.id,componentId:O.componentId,selfInstanceId:O.bodyId,instanceId:(S=ze(O.bodyId))===null||S===void 0?void 0:S.instanceId}))}}}}catch(te){w={error:te}}finally{try{B&&!B.done&&(m=W.return)&&m.call(W)}finally{if(w)throw w.error}}}}function ef(r,o){var y,d=o.last,v=o.behavior.parameters;if(v.inkVariableId){var p=v.inkVariableId,c=Math.hypot(r.x-d.x,r.y-d.y);if(((y=j[p])!==null&&y!==void 0?y:0)<c)return;j[p]-=c}o.store.add(r)&&(v.mode==="slice-blade"&&_l(d,r,o),o.last=r)}function rf(r){var o,y;if(!(!Xr||Xr.pointerId!==r.pointerId)){var d=Xr;Xr=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,r.pointerId)&&((y=t.releasePointerCapture)===null||y===void 0||y.call(t,r.pointerId))}catch{}if(d.kind==="stroke"){var v=d.store.end(),p=d.behavior.parameters;if(v){if(p.mode==="physics-wall"){var c=new Set(d.store.strokes.map(function(m){return m.id}));Qt=Qt.filter(function(m){return m.owner!==d.c.id||c.has(m.strokeId)}),Qt.push.apply(Qt,ae([],K(Qo(v,p.strokeWidth).map(function(m){return ge(ge({},m),{owner:d.c.id})})),!1))}else if(p.mode==="path-trace"){var w=ze(p.followComponentId);w&&v.points.length>1&&Nn.set(w.id,{points:v.points,index:1,speed:p.followSpeed})}}er({kind:"strokeEnd",componentId:d.c.id})}}}function tf(r){var o,y,d,v;try{for(var p=q(on.values()),c=p.next();!c.done;c=p.next()){var w=c.value;w.tick(r)}}catch(O){o={error:O}}finally{try{c&&!c.done&&(y=p.return)&&y.call(p)}finally{if(o)throw o.error}}try{for(var m=q(Nn),S=m.next();!S.done;S=m.next()){var I=K(S.value,2),C=I[0],M=I[1],g=ze(C);if(!g){Nn.delete(C);continue}var P=M.points[M.index];if(!P){Nn.delete(C),er(lt("pathArrive",g));continue}var A=Rr(g),T=P.x-A.x,N=P.y-A.y,W=Math.hypot(T,N),B=M.speed*r;W<=B?(qt(g,P.x,P.y),M.index++):W>.001&&qt(g,A.x+T/W*B,A.y+N/W*B)}}catch(O){d={error:O}}finally{try{S&&!S.done&&(v=m.return)&&v.call(m)}finally{if(d)throw d.error}}}function nf(r,o,y){var d,v,p=[],c=[],w=function(C){var M=V.get(C.componentId),g=C.parameters.dragMode==="anywhere"?Hr(M).find(function(T){return Cr(T)}):y.find(function(T){var N;return((N=T.prototypeId)!==null&&N!==void 0?N:T.id)===M.id});if(!g)return"continue";if(C.kind==="swipe-input")c.push({behavior:C,c:g});else{var P=C.parameters,A=Math.max(P.min,Math.min(P.max,Number(j[P.variableId])));j[P.variableId]=A,p.push({behavior:C,c:g,charge:Lo(P,A)}),er(lt("holdStart",g))}};try{for(var m=q(e.gameplay.filter(function(C){var M;return["swipe-input","hold-charge"].includes(C.kind)&&((M=V.get(C.componentId))===null||M===void 0?void 0:M.sceneId)===Q})),S=m.next();!S.done;S=m.next()){var I=S.value;w(I)}}catch(C){d={error:C}}finally{try{S&&!S.done&&(v=m.return)&&v.call(m)}finally{if(d)throw d.error}}(p.length||c.length)&&(xr={pointerId:r.pointerId,start:o,current:o,holds:p,swipes:c})}function af(r,o){var y,d,v,p,c,w,m,S;if(!(!xr||xr.pointerId!==r.pointerId)){var I=xr,C=new Set;xr=void 0;try{for(var M=q(ae(ae([],K(I.holds),!1),K(I.swipes),!1)),g=M.next();!g.done;g=M.next()){var P=g.value,A=P.behavior,T=P.c;C.has(A.componentId)||(C.add(A.componentId),er(lt("pointerUp",T,void 0,{targetId:T.id,pointerId:r.pointerId})))}}catch(ne){y={error:ne}}finally{try{g&&!g.done&&(d=M.return)&&d.call(M)}finally{if(y)throw y.error}}try{for(var N=q(I.holds),W=N.next();!W.done;W=N.next()){var B=W.value,O=B.behavior.parameters;if(er(lt("holdRelease",B.c)),O.resetOnRelease!==!1){var F=j[O.variableId];j[O.variableId]=O.min,F!==O.min&&er({kind:"variableChange",variableId:O.variableId,selfInstanceId:(m=B.c.instanceId)!==null&&m!==void 0?m:B.c.id,instanceId:B.c.instanceId})}}}catch(ne){v={error:ne}}finally{try{W&&!W.done&&(p=N.return)&&p.call(N)}finally{if(v)throw v.error}}try{for(var G=q(I.swipes),H=G.next();!H.done;H=G.next()){var te=H.value,de=Wo(I.start,o,te.behavior.parameters.minDistancePx,(S=Vi.get(te.behavior.id))!==null&&S!==void 0?S:-1/0,ce*1e3,te.behavior.parameters.cooldownMs);de&&(Vi.set(te.behavior.id,ce*1e3),er(lt("swipe",te.c,void 0,{direction:de})))}}catch(ne){c={error:ne}}finally{try{H&&!H.done&&(w=G.return)&&w.call(G)}finally{if(c)throw c.error}}return C}}function of(r,o,y){var d,v,p;if(y.some(function(A){return A.contract==="native.button.v1"&&De(A).enabled}))return!1;try{for(var c=q(e.gameplay.filter(function(A){var T;return A.kind==="virtual-joystick"&&((T=V.get(A.componentId))===null||T===void 0?void 0:T.sceneId)===Q})),w=c.next();!w.done;w=c.next()){var m=w.value,S=V.get(m.componentId);if(Cr(S)){var I=ln.get(m.id);if(!(I&&I.pointerId!==null)){var C=cr(Xt(mr(S)),o.x,o.y),M=De(S);if(!(C.x<0||C.y<0||C.x>M.width||C.y>M.height)){var g=m.parameters.mode==="floating"?ge({},o):Rr(S),P=Ha(g,o,m.parameters.radiusPx,m.parameters.deadZone);return I=ge({behavior:m,c:S,pointerId:r.pointerId,origin:g,current:o},P),ln.set(m.id,I),ca(I),er(lt("joystickStart",S)),(p=t.setPointerCapture)===null||p===void 0||p.call(t,r.pointerId),!0}}}}}catch(A){d={error:A}}finally{try{w&&!w.done&&(v=c.return)&&v.call(c)}finally{if(d)throw d.error}}return!1}var go=function(r){var o,y,d,v,p,c,w,m,S,I,C;x();var M=Ea(r),g=Fi(M);if(fi=M,!(!g&&k)){if(k){g&&(zt=g.c.id,Y((p=g.c.prototypeId)!==null&&p!==void 0?p:g.c.id));return}var P=e.gameplay.some(function(be){return be.kind==="virtual-joystick"||be.kind==="fps-controller-3d"});if(!(!r.isTrusted||r.button!==void 0&&r.button!==0||!P&&r.isPrimary===!1||Pr||An||!P&&(Ge&&Ge.pointerId!==r.pointerId||xr&&xr.pointerId!==r.pointerId||Fe&&Fe.pointerId!==r.pointerId)||ee&&(!ai||!Yn))){var A=!gn;Zt=ce,$t=!0,gn=!0,mo(!0),A&&!Tr&&(Or=Vr=0,fn());var T=g?Xi(g.c):[];if(of(r,M,T)){Or=Vr=0,Tr=!1,fn(),rt();return}if(jl(r,M,T)){fn(),rt();return}nf(r,M,T);var N=e.gameplay.find(function(be){return be.kind==="aim-launch"&&V.get(be.componentId).sceneId===Q&&(be.parameters.dragMode==="anywhere"&&!T.some(function(Re){return Re.contract==="native.button.v1"})||T.some(function(Re){var Ee;return((Ee=Re.prototypeId)!==null&&Ee!==void 0?Ee:Re.id)===be.componentId}))});if(N){var W=V.get(N.componentId),B=(c=T.find(function(be){var Re;return((Re=be.prototypeId)!==null&&Re!==void 0?Re:be.id)===W.id}))!==null&&c!==void 0?c:Hr(W).find(function(be){return Cr(be)}),O=B&&Bn(B,St("physics-body",W.id));if(O&&(!N.parameters.onlyWhenAtRest||O.atRest)){Fe={behavior:N,targetId:B.id,sourceId:W.id,pointerId:r.pointerId,start:M,current:M,power:0},po(M),(w=t.setPointerCapture)===null||w===void 0||w.call(t,r.pointerId),rt();return}}try{for(var F=q(T),G=F.next();!G.done;G=F.next()){var H=G.value,te=St("press-feedback",(m=H.prototypeId)!==null&&m!==void 0?m:H.id);te&&(H.contract!=="native.button.v1"||De(H).enabled)&&xn.set(H.id,{behavior:te.parameters,pointerId:r.pointerId,held:!0})}}catch(be){o={error:be}}finally{try{G&&!G.done&&(y=F.return)&&y.call(F)}finally{if(o)throw o.error}}var de=T.find(function(be){var Re;return((Re=Bt.get(be.id))===null||Re===void 0?void 0:Re.sceneId)===Q});if(de){var ne=Mt.get(de.parentId);if(ne!=null&&ne.snapshot().busy)return;Nl(de),ne&&!ne.snapshot().busy&&(et={pointerId:r.pointerId,boardId:de.parentId,tileId:de.id,start:M},(S=t.setPointerCapture)===null||S===void 0||S.call(t,r.pointerId))}_r=(I=T.find(function(be){return be.contract==="native.button.v1"&&De(be).enabled}))===null||I===void 0?void 0:I.id,Pt=_r?r.pointerId:void 0;var he=e.gameplay.find(function(be){return be.kind==="drag"&&T.some(function(Re){var Ee;return((Ee=Re.prototypeId)!==null&&Ee!==void 0?Ee:Re.id)===be.componentId})});if(he){var H=T.find(function(Re){var Ee;return((Ee=Re.prototypeId)!==null&&Ee!==void 0?Ee:Re.id)===he.componentId}),Ae=Rr(H),We=Ar.zoneOf(H.id);Oi.set(H.id,Ae),Ar.release(H.id),Ge={b:he,targetId:H.id,start:M,current:M,origin:Ae,originZone:We,m:ae([],K(kt(H)),!1),pointerId:r.pointerId},er(lt("dragStart",H)),t.setPointerCapture(r.pointerId)}Or=Vr=0,Tr=!1;try{for(var He=q(T),se=He.next();!se.done;se=He.next()){var H=se.value;(H.contract!=="native.button.v1"||De(H).enabled)&&er({kind:"click",componentId:(C=H.prototypeId)!==null&&C!==void 0?C:H.id,instanceId:H.instanceId,targetId:H.id,pointerId:r.pointerId})}}catch(be){d={error:be}}finally{try{se&&!se.done&&(v=He.return)&&v.call(He)}finally{if(d)throw d.error}}fn(),rt()}}};function Io(r,o){if(!et||et.pointerId!==r.pointerId)return!1;if(!r.isTrusted||!Jn())return!0;var y=et,d=Mt.get(y.boardId);if(d.snapshot().busy)return et=void 0,!0;var v=Xt(mr(V.get(y.boardId))),p=cr(v,y.start.x,y.start.y),c=cr(v,o.x,o.y),w=c.x-p.x,m=c.y-p.y,S=V.get(y.tileId);if(Math.max(Math.abs(w),Math.abs(m))<Math.min(S.parameters.width,S.parameters.height)*.35)return!0;var I=Bt.get(S.id),C=Math.abs(w)>Math.abs(m),M=I.row+(C?0:Math.sign(m)),g=I.column+(C?Math.sign(w):0),P=ae([],K(Bt),!1).find(function(A){var T=K(A,2),N=T[1];return N.boardId===y.boardId&&N.row===M&&N.column===g});return P&&d.swap(S.id,P[0])&&(Dr=void 0,rt()),et=void 0,!0}var xo=function(r){var o,y,d,v;if(!Pr){x();var p=R(),c=Ea(r);fi=c,(xr==null?void 0:xr.pointerId)===r.pointerId&&(xr.current=c);try{for(var w=q(ln.values()),m=w.next();!m.done;m=w.next()){var S=m.value;if(S.pointerId===r.pointerId){var I=c.x-S.current.x,C=c.y-S.current.y;Object.assign(S,{current:c},Ha(S.origin,c,S.behavior.parameters.radiusPx,S.behavior.parameters.deadZone)),ca(S),rt();return}}}catch(Re){o={error:Re}}finally{try{m&&!m.done&&(y=w.return)&&y.call(w)}finally{if(o)throw o.error}}if((Xr==null?void 0:Xr.pointerId)===r.pointerId){if(Xr.kind==="mask"){var M=Xr,g=cr(Xt(mr(M.c)),c.x,c.y);ui(M.c,M.behavior).stampSegment(M.last,g),M.last=g}else ef(c,Xr);fn(),rt();return}if((Fe==null?void 0:Fe.pointerId)===r.pointerId){r.isTrusted&&Jn()&&po(c),rt();return}var P=Fi(c);if(Ut=P?(d=Xi(P.c).find(function(Re){return Re.contract==="native.button.v1"}))===null||d===void 0?void 0:d.id:void 0,!Io(r,c)&&!(!Ge||Ge.pointerId!==r.pointerId)){var A=ze(Ge.targetId);if(!A){zi();return}var T=A.parentId?mr(ze(A.parentId)):tn(),N=Xt(T),W=cr(N,Ge.start.x,Ge.start.y),B=cr(N,c.x,c.y),O=ae([],K(Ge.m),!1),F=Ge.b.parameters.axis;if(F!=="y"){var G=Ge.m[4]+B.x-W.x;Number.isFinite(Ge.b.parameters.minX)&&(G=Math.max(Ge.b.parameters.minX,G)),Number.isFinite(Ge.b.parameters.maxX)&&(G=Math.min(Ge.b.parameters.maxX,G)),O[4]=G}if(F!=="x"){var H=Ge.m[5]+B.y-W.y;Number.isFinite(Ge.b.parameters.minY)&&(H=Math.max(Ge.b.parameters.minY,H)),Number.isFinite(Ge.b.parameters.maxY)&&(H=Math.min(Ge.b.parameters.maxY,H)),O[5]=H}if(!A.parentId)F!=="y"&&(O[4]=Math.max(0,Math.min(p.width-A.parameters.width,O[4])));else{var te=ft(A,ri(T,O)),de=0;te.left<0||te.right-te.left>p.width?de=-te.left:te.right>p.width&&(de=p.width-te.right);var ne=F==="y"?0:T[0],he=F==="x"?0:T[2];Math.abs(ne)>=Math.abs(he)&&Math.abs(ne)>1e-8?O[4]+=de/ne:Math.abs(he)>1e-8&&(O[5]+=de/he)}var Ae=(v=Qe.get(A.id))!==null&&v!==void 0?v:{parameters:{}};Qe.set(A.id,ge(ge({},Ae),{transform:O})),Ge.current=c;var We=wa(A),He=We.zones,se=We.tag,be=ea({itemId:A.id,tag:se,zones:He,occupancy:Ar});bn=be&&be.kind!=="reject"?be.zone:void 0}}},bo=function(r){var o,y,d,v;x();var p=Ea(r),c=Gt;fi=p,ha(r.pointerId,!0),rf(r);var w=(d=af(r,p))!==null&&d!==void 0?d:new Set;if(zl(r),r.isTrusted&&Jn()){var m=Fi(p);try{for(var S=q(m?Xi(m.c):[]),I=S.next();!I.done;I=S.next()){var C=I.value;!w.has((v=C.prototypeId)!==null&&v!==void 0?v:C.id)&&(C.contract!=="native.button.v1"||De(C).enabled)&&er(lt("pointerUp",C,void 0,{targetId:C.id,pointerId:r.pointerId}))}}catch(T){o={error:T}}finally{try{I&&!I.done&&(y=S.return)&&y.call(S)}finally{if(o)throw o.error}}}if(fn(),rt(),(Fe==null?void 0:Fe.pointerId)===r.pointerId){var M=Fe,g=Pa(),P=Tt.get(M.targetId);Fe=void 0,M.behavior.parameters.powerVariableId&&(j[M.behavior.parameters.powerVariableId]=0),P&&r.isTrusted&&Jn()&&g.pull>=M.behavior.parameters.minPullPx&&(P.vx=g.vx,P.vy=g.vy,P.atRest=!1,P.restElapsed=0,P.captured=!1,P.exited=!1,er({kind:"launch",componentId:M.sourceId,instanceId:P.instanceId})),ya(r),fn(),rt();return}if(Io(r,p),(et==null?void 0:et.pointerId)===r.pointerId&&(et=void 0),ya(r),!((c==null?void 0:c.pointerId)!==r.pointerId||!r.isTrusted||!Jn()||navigator.userActivation&&navigator.userActivation.isActive!==!0||!Li(c.condition))){var A=Fi(p);!A||!Xi(A.c).some(function(T){return T.id===c.targetId&&(T.contract!=="native.button.v1"||De(T).enabled)})||(ee?ee.openStore(e.base.storeUrl):window.open(e.base.storeUrl,"_blank","noopener"))}},Ui=function(r){var o,y;if(ha(r.pointerId,!0),(Fe==null?void 0:Fe.pointerId)===r.pointerId&&(Fe.behavior.parameters.powerVariableId&&(j[Fe.behavior.parameters.powerVariableId]=0),Fe=void 0),(et==null?void 0:et.pointerId)===r.pointerId&&(et=void 0),(Xr==null?void 0:Xr.pointerId)===r.pointerId&&(Xr.kind==="stroke"&&Xr.store.cancel(),Xr=void 0),(xr==null?void 0:xr.pointerId)===r.pointerId){try{for(var d=q(xr.holds),v=d.next();!v.done;v=d.next()){var p=v.value;p.behavior.parameters.resetOnRelease!==!1&&(j[p.behavior.parameters.variableId]=p.behavior.parameters.min)}}catch(c){o={error:c}}finally{try{v&&!v.done&&(y=d.return)&&y.call(d)}finally{if(o)throw o.error}}xr=void 0}ya(r)},wo=function(r){r!=null&&r.isTrusted&&!k&&!Pr&&!An&&mo(!0)},Ta=function(){Ti||rt()},Mn=typeof globalThis.ResizeObserver=="function"?new globalThis.ResizeObserver(Ta):void 0;try{(u=Mn==null?void 0:Mn.observe)===null||u===void 0||u.call(Mn,t)}catch{}var Mo=function(){Xe=0,fr=0,document.hidden&&Jt(),Ke&&(document.hidden?Ke.suspend().catch(function(){}):!Pr&&gn&&vi())};document.addEventListener("visibilitychange",Mo),(s=globalThis.addEventListener)===null||s===void 0||s.call(globalThis,"resize",Ta),t.addEventListener("pointerdown",go),t.addEventListener("pointermove",xo),t.addEventListener("pointerup",bo),t.addEventListener("pointercancel",Ui),t.addEventListener("lostpointercapture",Ui),t.addEventListener("click",wo);var Aa=ee==null?void 0:ee.onVisibilityChanged(function(r){Yn=r,Xe=0,fr=0,r||Jt(),Ke&&(r?!Pr&&gn&&vi():Ke.suspend().catch(function(){}))}),Ra=ee==null?void 0:ee.onClosed(function(){An=!0,Xe=0,fr=0,Jt(),di()}),Oa=(E=ee==null?void 0:ee.onVolumeChanged)===null||E===void 0?void 0:E.call(ee,function(r){typeof r=="number"&&Number.isFinite(r)&&r>=0&&(va=Math.min(1,r>1?r/100:r),ba())});function So(r){var o=!k&&!Pr&&!document.hidden&&ai&&Yn&&!An;if(o&&fr&&(Se+=Math.min((r-fr)/1e3,5/60)),Jn()){Or=Vr=0,Tr=!1,fr&&(Xe+=Math.min((r-fr)/1e3,5/60));for(var y=0;y<5&&Xe>=1/60;y++)Xl(1/60),Xe-=1/60;fn()}else Xe=0;fr=r,rt(),mn=requestAnimationFrame(So)}return Ia(),k&&(Q=re),rt(),mn=requestAnimationFrame(So),ee&&ee.init().then(function(){Ti||(ai=!0,Yn=ee.isVisible(),Xe=0,fr=0)}).catch(function(){Ti||(An=!0,Jt(),di())}),{state:kl,auditViewport:Ql,auditSceneLayout:Jl,restart:function(){var r;(r=ee==null?void 0:ee.notifyGameRetry)===null||r===void 0||r.call(ee),Ia(),rt()},select:function(r){zt=r},inspectScene:function(r){k&&e.scenes.some(function(o){return o.id===r})&&(Q=r,zt=void 0)},pause:function(r){Pr=r,Xe=0,fr=0,r&&Jt(),Ke&&(r?Ke.suspend().catch(function(){}):gn&&vi())},destroy:function(){var r,o;Ti=!0,cancelAnimationFrame(mn),Jt(),di(),Aa==null||Aa(),Ra==null||Ra(),Oa==null||Oa(),ee==null||ee.destroy(),(r=Mn==null?void 0:Mn.disconnect)===null||r===void 0||r.call(Mn),document.removeEventListener("visibilitychange",Mo),(o=globalThis.removeEventListener)===null||o===void 0||o.call(globalThis,"resize",Ta),t.removeEventListener("pointerdown",go),t.removeEventListener("pointermove",xo),t.removeEventListener("pointerup",bo),t.removeEventListener("pointercancel",Ui),t.removeEventListener("lostpointercapture",Ui),t.removeEventListener("click",wo),Ke==null||Ke.close().catch(function(){})}}}return If(qf);})();
|
|
1
|
+
var ToraNative=(()=>{var Fa=Object.defineProperty;var Sf=Object.getOwnPropertyDescriptor;var kf=Object.getOwnPropertyNames;var Cf=Object.prototype.hasOwnProperty;var Ef=(e,t)=>{for(var n in t)Fa(e,n,{get:t[n],enumerable:!0})},Pf=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of kf(t))!Cf.call(e,l)&&l!==n&&Fa(e,l,{get:()=>t[l],enumerable:!(a=Sf(t,l))||a.enumerable});return e};var Tf=e=>Pf(Fa({},"__esModule",{value:!0}),e);var od={};Ef(od,{computeSafeArea:()=>lo,createNetworkBridge:()=>Tl,layoutStandardText:()=>Al,mountNative:()=>ad});var Fo=function(e,t){if(!e)throw Error(t)},jt=function(){return[1,0,0,1,0,0]};function Xa(e){return Fo(Array.isArray(e)&&e.length===6&&e.every(Number.isFinite),"E_SCENE_MATRIX"),e}function ai(e,t){return Xa(e),Xa(t),[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Yt(e){Xa(e);var t=e[0]*e[3]-e[1]*e[2];return Fo(Math.abs(t)>1e-12,"E_SCENE_SINGULAR_TRANSFORM"),[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]}var Ya=function(){return Ya=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Ya.apply(this,arguments)},_t=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Fn=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Ua=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Xo(e){var t=e.rows,n=e.columns,a=e.seed,l=e.slots,i=e.paint,v=e.onEvent,c=l.map(function(X){return X.group}),E=Fn([],_t(new Set(c)),!1),f=Fn([],_t(c),!1),M=a,k="idle",B=0,re,U,Y=[],oe=[],_=0,ee=0,y=0,O,Re,Pe=function(X,ve){return X*n+ve},be=function(X){return Math.floor(X/n)},Le=function(X){return X%n},Z=function(){return M=Math.imul(M,1664525)+1013904223>>>0,M/4294967296};function ue(X){for(var ve=new Set,Ne=0;Ne<t;Ne++)for(var se=0;se<n;se++){var ke=Pe(Ne,se),$e=X[ke];if(se+2<n&&$e===X[ke+1]&&$e===X[ke+2])for(var Ue=0;Ue<3;Ue++)ve.add(ke+Ue);if(Ne+2<t&&$e===X[ke+n]&&$e===X[ke+n*2])for(var Ue=0;Ue<3;Ue++)ve.add(ke+n*Ue)}return Fn([],_t(ve),!1)}function ae(X,ve){var Ne;if(f[X]===f[ve])return!1;var se=Fn([],_t(f),!1);return Ne=_t([se[ve],se[X]],2),se[X]=Ne[0],se[ve]=Ne[1],ue(se).some(function(ke){return ke===X||ke===ve})}function he(){for(var X=[],ve=0;ve<f.length;ve++)Le(ve)+1<n&&ae(ve,ve+1)&&X.push({from:l[ve].id,to:l[ve+1].id}),be(ve)+1<t&&ae(ve,ve+n)&&X.push({from:l[ve].id,to:l[ve+n].id});return X}function R(){for(var X=0;X<64;X++){f=[];for(var ve=function(se){var ke=E.filter(function($e){return!(Le(se)>=2&&f[se-1]===$e&&f[se-2]===$e)&&!(be(se)>=2&&f[se-n]===$e&&f[se-n*2]===$e)});f.push(ke[Math.floor(Z()*ke.length)])},Ne=0;Ne<l.length;Ne++)ve(Ne);if(he().length)return}f=l.map(function(se,ke){return E[(be(ke)*2+Le(ke))%3]}),f[0]=E[0],f[1]=E[1],f[2]=E[0],f[n+1]=E[0]}function b(){for(var X=0;X<l.length;X++)i(X,f[X],{})}function K(){M=a,f=Fn([],_t(c),!1),k="idle",B=0,re=void 0,U=void 0,Y=[],oe=[],_=0,ee=0,y=0,O=void 0,Re=void 0,(ue(f).length||!he().length)&&R(),b()}function L(X,ve){if(k!=="idle")return!1;var Ne=l.findIndex(function(ke){return ke.id===X}),se=l.findIndex(function(ke){return ke.id===ve});return Ne<0||se<0||Math.abs(be(Ne)-be(se))+Math.abs(Le(Ne)-Le(se))!==1?!1:(re=void 0,O=void 0,b(),U=[Ne,se],k="swap",B=0,!0)}function fe(X){if(k==="idle"){if(re===X){re=void 0;return}if(!(re&&L(re,X)))return re=X,re}}function J(){Y=ue(f),y+=Y.length,Re={group:f[Y[0]],from:l[Y[0]].id,count:Y.length},v("matchClear"),k="clear",B=0}function Q(){var X=new Set(Y),ve=Fn([],_t(f),!1);oe=[];for(var Ne=0;Ne<n;Ne++){for(var se=[],ke=t-1;ke>=0;ke--)X.has(Pe(ke,Ne))||se.push(Pe(ke,Ne));for(var $e=0,ke=t-1;ke>=0;ke--){var Ue=Pe(ke,Ne),lr=se[t-1-ke];lr!==void 0?(ve[Ue]=f[lr],oe.push({cell:Ue,from:lr,offsetRows:0})):(ve[Ue]=E[Math.floor(Z()*E.length)],oe.push({cell:Ue,from:Ue,offsetRows:-(ke+1+$e++)}))}}f=ve,k="fall",B=0}function j(){if(ue(f).length&&_<3){_++,J();return}(ue(f).length||!he().length)&&R(),b(),k="idle",B=0,U=void 0,Y=[],oe=[],ee++,v("validMatch")}function ye(X){var ve,Ne,se,ke,$e,Ue,lr;if(k==="idle"){if(O){O.elapsed+=X;var Pr=1+.065*Math.sin(Math.min(1,O.elapsed/.8)*Math.PI*4),zr=function(Ar){i(l.findIndex(function(tn){return tn.id===Ar}),f[l.findIndex(function(tn){return tn.id===Ar})],{scale:Pr})};try{for(var Wr=Ua(O.ids),Tr=Wr.next();!Tr.done;Tr=Wr.next()){var pn=Tr.value;zr(pn)}}catch(Ar){ve={error:Ar}}finally{try{Tr&&!Tr.done&&(Ne=Wr.return)&&Ne.call(Wr)}finally{if(ve)throw ve.error}}O.elapsed>=.8&&(O=void 0,b())}return}if(B+=X,k==="swap"||k==="reverse"){var Ke=Math.min(1,B/.14),It=Ke*Ke*(3-2*Ke),Ze=_t(U,2),Gt=Ze[0],tt=Ze[1];if(i(Gt,f[Gt],{from:tt,progress:k==="swap"?It:1-It}),i(tt,f[tt],{from:Gt,progress:k==="swap"?It:1-It}),Ke<1)return;if(k==="reverse"){b(),k="idle",U=void 0,v("invalidMatch");return}if(!ae(Gt,tt)){k="reverse",B=0;return}se=_t([f[tt],f[Gt]],2),f[Gt]=se[0],f[tt]=se[1],b(),J();return}if(k==="clear"){var At=Math.min(1,B/.18),Pr=At<.22?1+At*.45:Math.max(.05,1.1*(1-At)/.78);try{for(var mn=Ua(Y),xt=mn.next();!xt.done;xt=mn.next()){var Rt=xt.value;i(Rt,f[Rt],{scale:Pr,opacity:1-At})}}catch(tn){ke={error:tn}}finally{try{xt&&!xt.done&&($e=mn.return)&&$e.call(mn)}finally{if(ke)throw ke.error}}At===1&&Q();return}var Dt=Math.min(1,B/.25),rn=1-Math.pow(1-Dt,3);try{for(var bt=Ua(oe),lt=bt.next();!lt.done;lt=bt.next()){var yt=lt.value;i(yt.cell,f[yt.cell],{from:yt.from,offsetRows:yt.offsetRows,progress:1-rn})}}catch(Ar){Ue={error:Ar}}finally{try{lt&&!lt.done&&(lr=bt.return)&&lr.call(bt)}finally{if(Ue)throw Ue.error}}Dt===1&&j()}function le(){if(k==="idle"){re=void 0;var X=he()[0];X&&(O={ids:[X.from,X.to],elapsed:0})}}function Ie(){var X;return{phase:k,busy:k!=="idle",selected:re!=null?re:null,moves:ee,cleared:y,groups:Fn([],_t(f),!1),legalMoves:k==="idle"?he():[],hint:(X=O==null?void 0:O.ids)!==null&&X!==void 0?X:[],lastMatch:Re?Ya({},Re):null}}return{reset:K,select:fe,swap:L,tick:ye,showHint:le,snapshot:Ie,cancelSelection:function(){re=void 0,O&&(O=void 0,b())}}}var na=function(){return na=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},na.apply(this,arguments)},Uo=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Af=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Yo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Go(){var e=new Map,t=new Map,n=function(l){var i,v,c=t.get(l);c!==void 0&&((i=e.get(c))===null||i===void 0||i.delete(l),((v=e.get(c))===null||v===void 0?void 0:v.size)===0&&e.delete(c)),t.delete(l)},a=function(l,i){n(l),i!=null&&(e.has(i)||e.set(i,new Set),e.get(i).add(l),t.set(l,i))};return{occupants:e,itemZone:t,release:n,place:a,clear:function(){e.clear(),t.clear()},items:function(l){var i;return Af([],Uo((i=e.get(l))!==null&&i!==void 0?i:[]),!1).sort()},zoneOf:function(l){return t.get(l)},snapshot:function(){return{itemZone:Object.fromEntries(t)}}}}function ia(e){var t,n,a=e.itemId,l=e.tag,i=l===void 0?"":l,v=e.zones,c=e.occupancy,E=v.filter(function(U){var Y,oe,_;return U.id!==a&&(((oe=(Y=U.acceptTags)===null||Y===void 0?void 0:Y.length)!==null&&oe!==void 0?oe:0)===0||((_=U.acceptTags)===null||_===void 0?void 0:_.includes(i)))});E.sort(function(U,Y){return Number(Y.itemTarget)-Number(U.itemTarget)||Y.paintOrder-U.paintOrder||U.distance-Y.distance||U.id.localeCompare(Y.id)});try{for(var f=Yo(E),M=f.next();!M.done;M=f.next()){var k=M.value,B=c.items(k.id).filter(function(U){return U!==a}),re=k.capacity>0&&B.length>=k.capacity;return k.snapMode==="reject"?{kind:"reject",zone:k,occupantId:B[0]}:re?k.onOccupied==="emit"?{kind:"emit",zone:k,occupantId:B[0]}:k.onOccupied==="swap"&&B.length?{kind:"swap",zone:k,occupantId:B[0]}:{kind:"reject",zone:k,occupantId:B[0]}:{kind:"accept",zone:k}}}catch(U){t={error:U}}finally{try{M&&!M.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}return null}function Zo(e,t,n,a,l,i){if(n===void 0&&(n=28),a===void 0&&(a=-1/0),l===void 0&&(l=0),i===void 0&&(i=80),l-a<i)return null;var v=t.x-e.x,c=t.y-e.y;return Math.max(Math.abs(v),Math.abs(c))<n?null:Math.abs(v)>Math.abs(c)?v<0?"left":"right":c<0?"up":"down"}function $o(e,t){var n=t,a=1;return{tick:function(l){return e.pingPong?(n+=a*e.ratePerSecond*l,n>=e.max?(n=e.max,a=-1):n<=e.min&&(n=e.min,a=1)):n=Math.max(e.min,Math.min(e.max,n+e.ratePerSecond*l)),n}}}function Ko(){var e=new Map;return{to:function(t,n,a,l,i){l===void 0&&(l=.18),e.set(t,{from:na({},n),to:na({},a),seconds:Math.max(.02,l),elapsed:0,onDone:i})},cancel:function(t){e.delete(t)},clear:function(){e.clear()},tick:function(t,n){var a,l,i;try{for(var v=Yo(e),c=v.next();!c.done;c=v.next()){var E=Uo(c.value,2),f=E[0],M=E[1];M.elapsed+=t;var k=Math.min(1,M.elapsed/M.seconds),B=1-Math.pow(1-k,3);n(f,{x:M.from.x+(M.to.x-M.from.x)*B,y:M.from.y+(M.to.y-M.from.y)*B}),k===1&&(e.delete(f),(i=M.onDone)===null||i===void 0||i.call(M))}}catch(re){a={error:re}}finally{try{c&&!c.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}}}}function Ga(e,t,n,a){n===void 0&&(n=56),a===void 0&&(a=.12);var l=Math.max(1,n),i=t.x-e.x,v=t.y-e.y,c=Math.hypot(i,v),E=Math.min(c,l),f=E/l,M=c>1e-6?i/c:0,k=c>1e-6?v/c:0,B=e.x+M*E,re=e.y+k*E;if(f<=a)return{nx:0,ny:0,magnitude:0,angle:0,knobX:B,knobY:re};var U=(f-a)/Math.max(1e-6,1-a);return{nx:M*U,ny:k*U,magnitude:U,angle:Math.atan2(k,M)*180/Math.PI,knobX:B,knobY:re}}var Za=function(){return Za=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Za.apply(this,arguments)},Qo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function $a(e){var t,n,a=2166136261;try{for(var l=Qo(String(e)),i=l.next();!i.done;i=l.next()){var v=i.value;a^=v.codePointAt(0),a=Math.imul(a,16777619)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return a>>>0||1}function Ka(e){var t=e>>>0||1,n=t;return{next:function(){return n=Math.imul(n,1664525)+1013904223>>>0,n/4294967296},between:function(a,l,i){if(i===void 0&&(i=!1),i){var v=Math.ceil(a),c=Math.floor(l);return c<v?v:Math.min(c,v+Math.floor((c-v+1)*this.next()))}return a+(l-a)*this.next()},reset:function(){n=t}}}function Jo(e,t,n,a,l){var i,v;a===void 0&&(a=0);var c=null,E=1/0;try{for(var f=Qo(t),M=f.next();!M.done;M=f.next()){var k=M.value;if(!(k.id===l||k.team!==n)){var B=Math.hypot(k.x-e.x,k.y-e.y);a>0&&B>a||(B<E||B===E&&k.id<(c==null?void 0:c.id))&&(c=k,E=B)}}}catch(re){i={error:re}}finally{try{M&&!M.done&&(v=f.return)&&v.call(f)}finally{if(i)throw i.error}}return c}function qo(e,t,n){var a=((t-e+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI;return e+Math.max(-n,Math.min(n,a))}function jo(e){var t=Ka(e),n=new Map,a=new Map;return{rng:t,states:n,headings:a,reset:function(){t.reset(),n.clear(),a.clear()},initialize:function(l,i){var v;return n.has(l)||n.set(l,{hp:i.hp,maxHp:i.maxHp,value:i.value,tag:(v=i.tag)!==null&&v!==void 0?v:"",team:i.team}),n.get(l)},remove:function(l){n.delete(l),a.delete(l)},snapshot:function(l){var i=n.get(l);return i?Za({},i):void 0}}}function _o(e,t){var n,a,l,i,v=t===void 0?{}:t,c=v.width,E=v.height,f=v.onProgress,M=f===void 0?function(){}:f,k=v.onComplete,B=k===void 0?function(){}:k,re=v.canvasFactory,U=v.source,Y=e,oe=Y.gridSize,_=new Uint8Array(oe*oe),ee=0,y=!1,O=-1,Re=!1,Pe=Math.max(1,c),be=Math.max(1,E),Le=Math.min(1,512/Math.max(Pe,be)),Z=(n=re==null?void 0:re())!==null&&n!==void 0?n:!((a=globalThis.document)===null||a===void 0)&&a.createElement?globalThis.document.createElement("canvas"):void 0;Z&&(Z.width=Math.max(1,Math.round(Pe*Le)),Z.height=Math.max(1,Math.round(be*Le)));var ue=(l=Z==null?void 0:Z.getContext)===null||l===void 0?void 0:l.call(Z,"2d"),ae=(i=Y.maskColor)!==null&&i!==void 0?i:"#dceeff",he=function(){return!!(U&&U.complete&&U.naturalWidth>0)},R=function(){ue&&(ue.globalCompositeOperation="source-over",ue.clearRect(0,0,Z.width,Z.height),Y.mode==="erase"&&(he()?(ue.drawImage(U,0,0,Z.width,Z.height),Re=!0):(ue.fillStyle=ae,ue.fillRect(0,0,Z.width,Z.height),Re=!1)))};R();var b=function(){if(!y){var L=Math.round(ee/_.length*100),fe=Math.min(100,L);fe!==O&&(O=fe,M(fe)),fe>=Y.targetPercent&&(y=!0,B(fe))}},K=function(L,fe){for(var J=Math.max(0,Math.min(oe-1,Math.floor(L/Pe*oe))),Q=Math.max(0,Math.min(oe-1,Math.floor(fe/be*oe))),j=Math.max(0,Math.ceil(Y.brushRadiusPx/Pe*oe)),ye=Math.max(0,Math.ceil(Y.brushRadiusPx/be*oe)),le=Math.max(0,Q-ye);le<=Math.min(oe-1,Q+ye);le++)for(var Ie=Math.max(0,J-j);Ie<=Math.min(oe-1,J+j);Ie++)if(!(Math.hypot((Ie+.5)/oe*Pe-L,(le+.5)/oe*be-fe)>Y.brushRadiusPx)){var X=le*oe+Ie;_[X]||(_[X]=1,ee++)}ue&&(ue.save(),ue.scale(Le,Le),ue.globalCompositeOperation=Y.mode==="erase"?"destination-out":"source-over",ue.fillStyle=ae,ue.beginPath(),ue.arc(L,fe,Y.brushRadiusPx,0,Math.PI*2),ue.fill(),Y.mode==="reveal"&&U&&(ue.globalCompositeOperation="source-in",ue.drawImage(U,0,0,Pe,be)),ue.restore()),b()};return{canvas:Z,stampSegment:function(L,fe){for(var J=Math.hypot(fe.x-L.x,fe.y-L.y),Q=Math.max(1,Math.ceil(J/Math.max(1,Y.brushRadiusPx*.45))),j=0;j<=Q;j++)K(L.x+(fe.x-L.x)*j/Q,L.y+(fe.y-L.y)*j/Q)},reset:function(){_.fill(0),ee=0,y=!1,O=-1,R(),b()},get progress(){return Math.round(ee/_.length*100)},render:function(L){Y.mode==="erase"&&ee===0&&!Re&&he()&&R(),Z?L.drawImage(Z,0,0,Z.width,Z.height,0,0,c,E):Y.mode==="erase"&&this.progress<100&&(L.save(),L.globalAlpha=1-this.progress/100,L.fillStyle=ae,L.fillRect(0,0,c,E),L.restore())}}}var Xn=function(){return Xn=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},Xn.apply(this,arguments)},Rf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Qa(e,t,n,a){var l=function(M,k,B){return(k.x-M.x)*(B.y-M.y)-(k.y-M.y)*(B.x-M.x)},i=l(e,t,n),v=l(e,t,a),c=l(n,a,e),E=l(n,a,t),f=1e-8;return Math.abs(i)<f&&Math.abs(v)<f&&Math.abs(c)<f&&Math.abs(E)<f?Math.max(Math.min(e.x,t.x),Math.min(n.x,a.x))<=Math.min(Math.max(e.x,t.x),Math.max(n.x,a.x))+f&&Math.max(Math.min(e.y,t.y),Math.min(n.y,a.y))<=Math.min(Math.max(e.y,t.y),Math.max(n.y,a.y))+f:i>0!=v>0&&c>0!=E>0}function el(e,t){for(var n=!1,a=0,l=t.length-1;a<t.length;l=a++){var i=t[a],v=t[l];i.y>e.y!=v.y>e.y&&e.x<(v.x-i.x)*(e.y-i.y)/(v.y-i.y)+i.x&&(n=!n)}return n}function rl(e,t,n){if(n.length>=3&&(el(e,n)||el(t,n)))return!0;for(var a=0;a<n.length;a++)if(Qa(e,t,n[a],n[(a+1)%n.length]))return!0;return!1}function tl(e){var t=e,n=[],a=null,l=0,i=function(v){return Xn(Xn({},v),{points:v.points.map(function(c){return Xn({},c)})})};return{begin:function(v){var c={id:++l,points:[Xn({},v)],age:0,hitIds:new Set};return a=c,n.push(c),n.length>t.maxStrokes&&n.shift(),c},add:function(v){if(!a||a.points.length>=t.maxPoints)return!1;var c=a.points[a.points.length-1];return Math.hypot(v.x-c.x,v.y-c.y)<t.minSegmentPx?!1:(a.points.push(Xn({},v)),!0)},end:function(){var v=a;return a=null,v?i(v):void 0},cancel:function(){a&&(n=n.filter(function(v){return v!==a})),a=null},clear:function(){a=null,n=[]},tick:function(v){var c,E;try{for(var f=Rf(n),M=f.next();!M.done;M=f.next()){var k=M.value;k.age+=v}}catch(B){c={error:B}}finally{try{M&&!M.done&&(E=f.return)&&E.call(f)}finally{if(c)throw c.error}}n=n.filter(function(B){return B===a||B.age<.18||t.mode!=="slice-blade"})},get active(){return a},get strokes(){return n}}}function nl(e,t){for(var n=[],a=1;a<e.points.length;a++){var l=e.points[a-1],i=e.points[a],v=Math.hypot(i.x-l.x,i.y-l.y);v<.001||n.push({id:"stroke-".concat(e.id,"-").concat(a),strokeId:e.id,mode:"static",shape:"box",x:(l.x+i.x)/2,y:(l.y+i.y)/2,width:v,height:Math.max(2,t),angle:Math.atan2(i.y-l.y,i.x-l.x),restitution:.8})}return n}var ki=function(){return ki=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},ki.apply(this,arguments)},dl=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},En=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Of=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},hn=function(e,t){return Math.hypot(e,t)},il=function(e,t,n){return Math.max(t,Math.min(n,e))},Un=function(e){return Math.max(1,Math.min(e.width,e.height)/2)};function al(e){var t,n,a=Math.cos((t=e.angle)!==null&&t!==void 0?t:0),l=Math.sin((n=e.angle)!==null&&n!==void 0?n:0),i=e.width/2,v=e.height/2;return[[-i,-v],[i,-v],[i,v],[-i,v]].map(function(c){var E=dl(c,2),f=E[0],M=E[1];return{x:e.x+f*a-M*l,y:e.y+f*l+M*a}})}function Vf(e,t){var n,a,l,i,v,c,E,f,M,k,B=al(e),re=al(t),U=[(E=e.angle)!==null&&E!==void 0?E:0,((f=e.angle)!==null&&f!==void 0?f:0)+Math.PI/2,(M=t.angle)!==null&&M!==void 0?M:0,((k=t.angle)!==null&&k!==void 0?k:0)+Math.PI/2],Y=1/0,oe=1,_=0;try{for(var ee=En(U),y=ee.next();!y.done;y=ee.next()){var O=y.value,Re=Math.cos(O),Pe=Math.sin(O),be=1/0,Le=-1/0,Z=1/0,ue=-1/0;try{for(var ae=(l=void 0,En(B)),he=ae.next();!he.done;he=ae.next()){var R=he.value,b=R.x*Re+R.y*Pe;b<be&&(be=b),b>Le&&(Le=b)}}catch(J){l={error:J}}finally{try{he&&!he.done&&(i=ae.return)&&i.call(ae)}finally{if(l)throw l.error}}try{for(var K=(v=void 0,En(re)),L=K.next();!L.done;L=K.next()){var R=L.value,b=R.x*Re+R.y*Pe;b<Z&&(Z=b),b>ue&&(ue=b)}}catch(J){v={error:J}}finally{try{L&&!L.done&&(c=K.return)&&c.call(K)}finally{if(v)throw v.error}}var fe=Math.min(Le,ue)-Math.max(be,Z);if(fe<=0)return null;fe<Y&&(Y=fe,oe=Re,_=Pe)}}catch(J){n={error:J}}finally{try{y&&!y.done&&(a=ee.return)&&a.call(ee)}finally{if(n)throw n.error}}return(e.x-t.x)*oe+(e.y-t.y)*_<0&&(oe=-oe,_=-_),{nx:oe,ny:_,penetration:Y}}function ol(e,t){var n,a,l,i=Un(e),v=-((n=t.angle)!==null&&n!==void 0?n:0),c=Math.cos(v),E=Math.sin(v),f=e.x-t.x,M=e.y-t.y,k=f*c-M*E,B=f*E+M*c,re=t.width/2,U=t.height/2,Y=il(k,-re,re),oe=il(B,-U,U),_=k-Y,ee=B-oe,y=hn(_,ee),O;if(y>=i)return null;if(y<1e-4){var Re=[{d:re-Math.abs(k),x:k>=0?1:-1,y:0},{d:U-Math.abs(B),x:0,y:B>=0?1:-1}].sort(function(Le,Z){return Le.d-Z.d});_=Re[0].x,ee=Re[0].y,O=i+Re[0].d}else _/=y,ee/=y,O=i-y;var Pe=Math.cos((a=t.angle)!==null&&a!==void 0?a:0),be=Math.sin((l=t.angle)!==null&&l!==void 0?l:0);return{nx:_*Pe-ee*be,ny:_*be+ee*Pe,penetration:O}}function ll(e,t){var n;return!!(e.ignoreGroup&&e.ignoreGroup!=="none"&&(e.ignoreGroup==="all"||e.ignoreGroup===((n=t.collisionGroup)!==null&&n!==void 0?n:"all")))}function fl(e,t,n){var a,l,i,v,c,E;if(!(e.captured||t.captured||ll(e,t)||ll(t,e))){var f=e.x-t.x,M=e.y-t.y,k;if(e.shape==="circle"&&t.shape==="circle"){var B=hn(f,M),re=Un(e)+Un(t)-B;if(re<=0)return;k=re,B>1e-4?(f/=B,M/=B):(f=1,M=0)}else if(e.shape==="circle"&&t.shape==="box"){var U=ol(e,t);if(!U)return;f=U.nx,M=U.ny,k=U.penetration}else if(e.shape==="box"&&t.shape==="circle"){var U=ol(t,e);if(!U)return;f=-U.nx,M=-U.ny,k=U.penetration}else if(e.shape==="box"&&t.shape==="box"){var U=Vf(e,t);if(!U)return;f=U.nx,M=U.ny,k=U.penetration}else return;var Y=e.mode==="dynamic"?1/((a=e.mass)!==null&&a!==void 0?a:1):0,oe=t.mode==="dynamic"?1/((l=t.mass)!==null&&l!==void 0?l:1):0,_=Y+oe;if(_){e.x+=f*k*Y/_,e.y+=M*k*Y/_,t.mode==="dynamic"&&(t.x-=f*k*oe/_,t.y-=M*k*oe/_);var ee=e.vx-((i=t.vx)!==null&&i!==void 0?i:0),y=e.vy-((v=t.vy)!==null&&v!==void 0?v:0),O=ee*f+y*M;if(!(O>=0)){var Re=Math.max((c=e.restitution)!==null&&c!==void 0?c:0,(E=t.restitution)!==null&&E!==void 0?E:0),Pe=-(1+Re)*O/_;e.vx+=f*Pe*Y,e.vy+=M*Pe*Y,t.mode==="dynamic"&&(t.vx-=f*Pe*oe,t.vy-=M*Pe*oe),e.atRest=!1,e.restElapsed=0,t.mode==="dynamic"&&(t.atRest=!1,t.restElapsed=0),Math.abs(O)>4&&(n("bodyBounce",e,t,{speed:Math.abs(O)}),t.mode==="dynamic"&&n("bodyBounce",t,e,{speed:Math.abs(O)}))}}}}function Nf(e,t,n,a){var l,i;if(!(e.mode!=="dynamic"||e.captured))try{for(var v=En(t),c=v.next();!c.done;c=v.next()){var E=c.value,f=E.x-e.x,M=E.y-e.y,k=hn(f,M);if(!(k>=E.radius*2.5)){if(k>E.radius&&k>.001&&E.pullStrength>0){var B=E.pullStrength*(1-k/(E.radius*2.5));e.vx+=f/k*B*n,e.vy+=M/k*B*n}if(k<E.radius&&hn(e.vx,e.vy)<=E.maxCaptureSpeed){e.captured=!0,e.atRest=!0,e.vx=E.stopBody?0:e.vx,e.vy=E.stopBody?0:e.vy,E.stopBody&&(e.x=E.x,e.y=E.y),a("zoneCapture",e,E,{});return}}}}catch(re){l={error:re}}finally{try{c&&!c.done&&(i=v.return)&&i.call(v)}finally{if(l)throw l.error}}}function Bf(e,t){var n,a,l,i,v,c,E=function(B){if(B.broken)return"continue";var re=t.find(function(be){return be.id===B.bodyId}),U=t.find(function(be){return be.id===B.anchorId});if(!re||re.mode!=="dynamic")return"continue";var Y=(i=(l=U==null?void 0:U.x)!==null&&l!==void 0?l:B.x)!==null&&i!==void 0?i:0,oe=(c=(v=U==null?void 0:U.y)!==null&&v!==void 0?v:B.y)!==null&&c!==void 0?c:0,_=re.x-Y,ee=re.y-oe,y=hn(_,ee);if(y<=B.lengthPx||y<1e-4)return"continue";var O=_/y,Re=ee/y;re.x=Y+O*B.lengthPx,re.y=oe+Re*B.lengthPx;var Pe=re.vx*O+re.vy*Re;Pe>0&&(re.vx-=O*Pe,re.vy-=Re*Pe)};try{for(var f=En(e),M=f.next();!M.done;M=f.next()){var k=M.value;E(k)}}catch(B){n={error:B}}finally{try{M&&!M.done&&(a=f.return)&&a.call(f)}finally{if(n)throw n.error}}}function Ja(e){for(var t,n,a,l,i,v,c,E,f,M,k,B=e.bodies,re=e.zones,U=re===void 0?[]:re,Y=e.joints,oe=Y===void 0?[]:Y,_=e.bounds,ee=e.dt,y=e.onEvent,O=y===void 0?function(){}:y,Re=B.filter(function(se){return se.mode==="dynamic"&&!se.captured}),Pe=Re.reduce(function(se,ke){return Math.max(se,hn(ke.vx,ke.vy))},0),be=Re.reduce(function(se,ke){return Math.min(se,Un(ke))},24),Le=Math.min(16,Math.max(1,Math.ceil(Pe*ee/(be*.45)))),Z=ee/Le,ue=0;ue<Le;ue++){try{for(var ae=(t=void 0,En(Re)),he=ae.next();!he.done;he=ae.next()){var R=he.value;R.vy+=((c=R.gravity)!==null&&c!==void 0?c:0)*Z;var b=hn(R.vx,R.vy);if(b>R.maxSpeed){var K=R.maxSpeed/b;R.vx*=K,R.vy*=K,b=R.maxSpeed}R.x+=R.vx*Z,R.y+=R.vy*Z;var L=Math.max(0,b-((E=R.friction)!==null&&E!==void 0?E:0)*Z),fe=Math.exp(-((f=R.linearDamping)!==null&&f!==void 0?f:0)*Z);if(b>1e-4){var J=L/b*fe;R.vx*=J,R.vy*=J}R.spinToRotation&&(R.angle=((M=R.angle)!==null&&M!==void 0?M:0)+hn(R.vx,R.vy)*Z/Un(R)*(R.vx<0?-1:1))}}catch(se){t={error:se}}finally{try{he&&!he.done&&(n=ae.return)&&n.call(ae)}finally{if(t)throw t.error}}for(var Q=0;Q<Re.length;Q++){var R=Re[Q];try{for(var j=(a=void 0,En(B)),ye=j.next();!ye.done;ye=j.next()){var le=ye.value;le.id!==R.id&&le.mode!=="dynamic"&&fl(R,le,O)}}catch(ke){a={error:ke}}finally{try{ye&&!ye.done&&(l=j.return)&&l.call(j)}finally{if(a)throw a.error}}for(var le=Q+1;le<Re.length;le++)fl(Re[le],R,O);var Ie=R.shape==="box"?R.width/2:Un(R),X=R.shape==="box"?R.height/2:Un(R);R.wallBounce?(R.x-Ie<_.left&&(R.x=_.left+Ie,R.vx<0&&(O("bodyBounce",R,null,{speed:Math.abs(R.vx)}),R.vx=-R.vx*R.restitution)),R.x+Ie>_.right&&(R.x=_.right-Ie,R.vx>0&&(O("bodyBounce",R,null,{speed:Math.abs(R.vx)}),R.vx=-R.vx*R.restitution)),R.y-X<_.top&&(R.y=_.top+X,R.vy<0&&(O("bodyBounce",R,null,{speed:Math.abs(R.vy)}),R.vy=-R.vy*R.restitution)),R.y+X>_.bottom&&(R.y=_.bottom-X,R.vy>0&&(O("bodyBounce",R,null,{speed:Math.abs(R.vy)}),R.vy=-R.vy*R.restitution))):!R.exited&&(R.x+Ie<_.left||R.x-Ie>_.right||R.y+X<_.top||R.y-X>_.bottom)&&(R.exited=!0,O("boundaryExit",R,null,{})),Nf(R,U,Z,O)}Bf(oe,B)}try{for(var ve=En(Re),Ne=ve.next();!Ne.done;Ne=ve.next()){var R=Ne.value,b=hn(R.vx,R.vy);b<R.restSpeed&&!R.captured?(R.restElapsed=((k=R.restElapsed)!==null&&k!==void 0?k:0)+ee,R.restElapsed>=R.restDelaySeconds&&!R.atRest&&(R.atRest=!0,R.vx=0,R.vy=0,O("bodyRest",R,null,{}))):b>=R.restSpeed&&(R.restElapsed=0,R.atRest=!1)}}catch(se){i={error:se}}finally{try{Ne&&!Ne.done&&(v=ve.return)&&v.call(ve)}finally{if(i)throw i.error}}}function ul(e){for(var t=e.body,n=e.bodies,a=e.zones,l=a===void 0?[]:a,i=e.bounds,v=e.dots,c=v===void 0?8:v,E=e.bounces,f=E===void 0?1:E,M=function(y){return ki({},y)},k=M(t),B=n.filter(function(y){return y.id!==t.id}).map(M),re=Of([k],dl(B),!1),U=[],Y=0,oe=!1,_=function(y,O,Re,Pe){y==="bodyBounce"&&Pe.sourceId===t.id&&Y++,y==="zoneCapture"&&Pe.sourceId===t.id&&(oe=!0)},ee=0;ee<90&&U.length<c&&!oe&&Y<=f;ee++)Ja({bodies:re,zones:l,bounds:i,dt:1/60,onEvent:function(y,O,Re,Pe){return _(y,O,Re,ki(ki({},Pe),{sourceId:O.id}))}}),ee%Math.max(1,Math.floor(90/c))===0&&U.push({x:k.x,y:k.y});return U}var yn=function(){return yn=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},yn.apply(this,arguments)},Wt=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Lt=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Ci=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},vl=function(e,t,n){return Math.max(t,Math.min(n,e))},Pn=function(e,t){return Math.hypot(t.x-e.x,t.y-e.y)};function sl(e){var t=e.id,n=e.nodes,a=e.edges,l=e.gates,i=l===void 0?[]:l,v=e.onEvent,c=v===void 0?function(){}:v,E=new Map(n.map(function(b){return[b.id,yn({},b)]})),f=new Map(a.map(function(b){return[b.id,yn({speedScale:1,enabled:!0,bidirectional:!1,cost:0},b)]})),M=new Map(i.map(function(b){return[b.id,yn({},b)]})),k=new Map,B=k,re=0,U=0,Y=function(b){return E.get(b)},oe=function(b){return Lt([],Wt(M.values()),!1).find(function(K){return K.parameters.nodeId===b})},_=function(b){var K=b.parameters;if(K.mode==="open")return!0;if(K.mode==="closed")return!1;var L=K.openSeconds+K.closedSeconds,fe=(re+K.phaseOffsetSeconds)%L;return fe<K.openSeconds},ee=function(b){return Lt([],Wt(f.values()),!1).filter(function(K){return K.enabled&&(K.from===b||K.bidirectional&&K.to===b)}).sort(function(K,L){return K.id<L.id?-1:K.id>L.id?1:0})},y=function(b,K){return Lt([],Wt(f.values()),!1).find(function(L){return L.enabled&&(L.from===b&&L.to===K||L.bidirectional&&L.from===K&&L.to===b)})};function O(b,K){var L,fe,J,Q;if(b===K)return[b];for(var j=new Map([[b,0]]),ye=new Map,le=new Set([b]);le.size;){var Ie=Lt([],Wt(le),!1).sort(function(Wr,Tr){return j.get(Wr)-j.get(Tr)||(Wr<Tr?-1:Wr>Tr?1:0)})[0];if(le.delete(Ie),Ie===K)break;try{for(var X=(L=void 0,Ci(ee(Ie))),ve=X.next();!ve.done;ve=X.next()){var Ne=ve.value,se=Ne.from===Ie?Ne.to:Ne.from,ke=oe(se),$e=Y(se),Ue=ke?ke.parameters.holdSeconds*90+(_(ke)?0:ke.parameters.closedSeconds*90):0,lr=j.get(Ie)+Pn(Y(Ie),$e)/Ne.speedScale+Ne.cost+((J=$e.cost)!==null&&J!==void 0?J:0)+Ue;lr>=((Q=j.get(se))!==null&&Q!==void 0?Q:1/0)||(j.set(se,lr),ye.set(se,Ie),le.add(se))}}catch(Wr){L={error:Wr}}finally{try{ve&&!ve.done&&(fe=X.return)&&fe.call(X)}finally{if(L)throw L.error}}}if(!j.has(K))return[];for(var Pr=[K],zr=K;zr!==b;)zr=ye.get(zr),Pr.unshift(zr);return Pr}function Re(b){var K,L=b.route.length>=2&&b.segment<b.route.length-1;if(!L){var fe=(K=b.route[Math.min(b.segment,b.route.length-1)])!==null&&K!==void 0?K:b.startNode,J=O(fe,b.target);b.route=J.length?J:[fe],b.segment=0,b.distance=0,b.arrived=!1,b.active=b.route.length>=2;return}var Q=b.route[b.segment],j=b.route[b.segment+1],ye=Pn(Y(Q),Y(j));if(b.arrived||b.distance>=ye-1e-4){var J=O(j,b.target);b.route=J.length?J:[j],b.segment=0,b.distance=0,b.arrived=!1,b.active=b.route.length>=2;return}var le=O(j,b.target);b.route=le.length?Lt([Q],Wt(le),!1):[Q,j],b.segment=0}function Pe(b){var K,L=O(b.startNode,b.targetNode),fe=Y(b.startNode),J=L.length>=2?Y(L[1]):fe,Q=L.length>=2?Math.atan2(J.y-fe.y,J.x-fe.x):0,j=Math.floor((Q%(Math.PI*2)+Math.PI*2+1e-6)%(Math.PI*2)/(Math.PI/2))%4,ye=yn(yn({},b),{loop:(K=b.loop)!==null&&K!==void 0?K:"none",originNode:b.startNode,destinationNode:b.targetNode,target:b.targetNode,networkId:t,route:L.length?L:[b.startNode],segment:0,distance:0,x:fe.x,y:fe.y,heading:Q,frame:[0,1,2,3][j],flipX:Math.cos(Q)<0,hold:0,arrived:!1,active:b.active&&L.length>=2,blockedTicks:0,blockedEmitted:!1,speedMultiplier:1});return k.set(ye.id,ye),ye}function be(b){if(Le("pathArrive",b,b.target),b.loop==="none"){b.active=!1;return}var K=b.target,L=b.loop==="ping-pong"?K===b.destinationNode?b.originNode:b.destinationNode:K===b.originNode?b.destinationNode:b.originNode;b.startNode=K,b.target=L,b.route=O(K,L),b.segment=0,b.distance=0,b.arrived=!1,b.route.length<2&&(b.active=!1)}function Le(b,K,L){c(b,{componentId:K.id,nodeId:L})}function Z(b,K){var L,fe,J=b.route[b.segment+1],Q=oe(J);if(Q&&!_(Q)){b.blockedTicks++,b.blockedTicks>=30&&!b.blockedEmitted&&(b.blockedEmitted=!0,Le("pathBlocked",b,J));return}if(!b.arrived){if(b.arrived=!0,b.segment+1===b.route.length-1){J===b.target?be(b):(b.active=!1,b.blockedEmitted||(b.blockedEmitted=!0,Le("pathBlocked",b,J)));return}b.hold=Math.max((L=Y(J).holdSeconds)!==null&&L!==void 0?L:0,(fe=Q==null?void 0:Q.parameters.holdSeconds)!==null&&fe!==void 0?fe:0)}if(b.hold>0){b.hold=Math.max(0,b.hold-K),b.blockedTicks++,b.blockedTicks>=30&&!b.blockedEmitted&&(b.blockedEmitted=!0,Le("pathBlocked",b,J));return}b.segment++,b.distance=0,b.arrived=!1,b.blockedTicks=0,b.blockedEmitted=!1}function ue(b,K){var L,fe;if(b.spacing<=0)return K;var J=b.route[b.segment],Q=b.route[b.segment+1],j=Pn(Y(J),Y(Q)),ye=j-b.distance,le=K;try{for(var Ie=Ci(B.values()),X=Ie.next();!X.done;X=Ie.next()){var ve=X.value;if(!(ve.id===b.id||!ve.active||ve.route.length<2||ve.segment>=ve.route.length-1)){var Ne=ve.route[ve.segment],se=ve.route[ve.segment+1],ke=1/0;if(Ne===J&&se===Q&&(ve.distance>b.distance||ve.distance===b.distance&&ve.id<b.id))ke=ve.distance-b.distance;else if(Ne===Q)ke=ye+ve.distance;else if(se===Q&&Ne!==J){var $e=Pn(Y(Ne),Y(se))-ve.distance;$e<b.spacing&&($e<ye||$e===ye&&ve.id<b.id)&&(ke=ye)}ke<1/0&&(le=Math.min(le,Math.max(0,ke-b.spacing)))}}}catch(Ue){L={error:Ue}}finally{try{X&&!X.done&&(fe=Ie.return)&&fe.call(Ie)}finally{if(L)throw L.error}}return le}function ae(b){var K=Y(b.route[b.segment]),L=Y(b.route[b.segment+1]),fe=Pn(K,L),J=vl(b.distance/Math.max(1e-4,fe),0,1),Q=K.x+(L.x-K.x)*J,j=K.y+(L.y-K.y)*J,ye=Math.atan2(L.y-K.y,L.x-K.x),le=Math.min(b.cornerRadius,fe/3),Ie=b.route[b.segment+2];if(le>0&&Ie){var X=Y(Ie),ve=Pn(L,X),Ne=Math.min(le,ve/3);if(b.distance>fe-le){var se={x:L.x-(L.x-K.x)/fe*le,y:L.y-(L.y-K.y)/fe*le},ke={x:L.x+(X.x-L.x)/ve*Ne,y:L.y+(X.y-L.y)/ve*Ne},$e=vl((b.distance-(fe-le))/(le*2),0,.5),Ue=1-$e;Q=Ue*Ue*se.x+2*Ue*$e*L.x+$e*$e*ke.x,j=Ue*Ue*se.y+2*Ue*$e*L.y+$e*$e*ke.y;var lr=2*Ue*(L.x-se.x)+2*$e*(ke.x-L.x),Pr=2*Ue*(L.y-se.y)+2*$e*(ke.y-L.y);Math.abs(lr)+Math.abs(Pr)>.001&&(ye=Math.atan2(Pr,lr))}}return{x:Q,y:j,heading:ye}}function he(b){var K,L,fe,J;re+=b,U++;var Q=Lt([],Wt(k.values()),!1).sort(function(Ke,It){return Ke.id<It.id?-1:Ke.id>It.id?1:0}),j=Q.length?U%Q.length:0,ye=Lt(Lt([],Wt(Q.slice(j)),!1),Wt(Q.slice(0,j)),!1);try{for(var le=Ci(ye),Ie=le.next();!Ie.done;Ie=le.next()){var X=Ie.value;if(!(!X.active||X.route.length<2||X.segment>=X.route.length-1)){var ve=X.route[X.segment],Ne=X.route[X.segment+1],se=Pn(Y(ve),Y(Ne));if(!(X.distance>=se-1e-4&&(Z(X,b),!X.active||X.route.length<2||X.segment>=X.route.length-1))){var ke=X.route[X.segment],$e=X.route[X.segment+1],Ue=Pn(Y(ke),Y($e)),lr=Ue-X.distance,Pr=(J=(fe=y(ke,$e))===null||fe===void 0?void 0:fe.speedScale)!==null&&J!==void 0?J:1,zr=Math.min(lr,X.speed*Pr*Math.max(0,X.speedMultiplier)*b),Wr=ue(X,zr);Wr<=1e-4?(X.blockedTicks++,X.blockedTicks>=30&&!X.blockedEmitted&&(X.blockedEmitted=!0,Le("pathBlocked",X,$e))):(X.distance+=Wr,X.blockedTicks=0,X.blockedEmitted=!1);var Tr=ae(X);X.x=Tr.x,X.y=Tr.y,X.heading=Tr.heading;var pn=Math.floor((X.heading%(Math.PI*2)+Math.PI*2+1e-6)%(Math.PI*2)/(Math.PI/2))%4;X.frame=[0,1,2,3][pn],X.flipX=Math.cos(X.heading)<0}}}}catch(Ke){K={error:Ke}}finally{try{Ie&&!Ie.done&&(L=le.return)&&L.call(le)}finally{if(K)throw K.error}}}function R(){return{id:t,nodeCount:E.size,edgeCount:f.size,activeAgents:Lt([],Wt(k.values()),!1).filter(function(b){return b.active}).length,queuedAgents:Lt([],Wt(k.values()),!1).filter(function(b){return b.active&&b.blockedTicks>0}).length,agents:Lt([],Wt(k.values()),!1).map(function(b){var K;return{id:b.id,x:b.x,y:b.y,heading:b.heading,frame:(K=b.frame)!==null&&K!==void 0?K:0,flipX:!!b.flipX,active:b.active,targetNode:b.target,route:Lt([],Wt(b.route),!1),segment:b.segment,distance:b.distance,blocked:b.blockedTicks>0}})}}return{addAgent:Pe,removeAgent:function(b){return k.delete(b)},getAgent:function(b){return k.get(b)},setTarget:function(b,K){var L=k.get(b);return!L||!Y(K)?!1:(L.target=K,L.destinationNode=K,L.active=!0,Re(L),!0)},setEdge:function(b,K,L){var fe,J,Q=f.get(b);if(!Q)return!1;Q.enabled=K,L!==void 0&&(Q.cost=L);try{for(var j=Ci(k.values()),ye=j.next();!ye.done;ye=j.next()){var le=ye.value;Re(le)}}catch(Ie){fe={error:Ie}}finally{try{ye&&!ye.done&&(J=j.return)&&J.call(j)}finally{if(fe)throw fe.error}}return!0},setGate:function(b,K,L){var fe,J,Q=M.get(b);if(!Q)return!1;Q.parameters=yn(yn({},Q.parameters),{mode:K,holdSeconds:L});try{for(var j=Ci(k.values()),ye=j.next();!ye.done;ye=j.next()){var le=ye.value;Re(le)}}catch(Ie){fe={error:Ie}}finally{try{ye&&!ye.done&&(J=j.return)&&J.call(j)}finally{if(fe)throw fe.error}}return!0},tick:he,snapshot:R}}var Ei=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},aa=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},oa=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},la={A:["01110","10001","10001","11111","10001","10001","10001"],B:["11110","10001","10001","11110","10001","10001","11110"],C:["01111","10000","10000","10000","10000","10000","01111"],D:["11110","10001","10001","10001","10001","10001","11110"],E:["11111","10000","10000","11110","10000","10000","11111"],F:["11111","10000","10000","11110","10000","10000","10000"],G:["01111","10000","10000","10111","10001","10001","01111"],H:["10001","10001","10001","11111","10001","10001","10001"],I:["11111","00100","00100","00100","00100","00100","11111"],J:["00111","00010","00010","00010","10010","10010","01100"],K:["10001","10010","10100","11000","10100","10010","10001"],L:["10000","10000","10000","10000","10000","10000","11111"],M:["10001","11011","10101","10101","10001","10001","10001"],N:["10001","11001","10101","10011","10001","10001","10001"],O:["01110","10001","10001","10001","10001","10001","01110"],P:["11110","10001","10001","11110","10000","10000","10000"],Q:["01110","10001","10001","10001","10101","10010","01101"],R:["11110","10001","10001","11110","10100","10010","10001"],S:["01111","10000","10000","01110","00001","00001","11110"],T:["11111","00100","00100","00100","00100","00100","00100"],U:["10001","10001","10001","10001","10001","10001","01110"],V:["10001","10001","10001","10001","10001","01010","00100"],W:["10001","10001","10001","10101","10101","10101","01010"],X:["10001","10001","01010","00100","01010","10001","10001"],Y:["10001","10001","01010","00100","00100","00100","00100"],Z:["11111","00001","00010","00100","01000","10000","11111"],0:["01110","10001","10011","10101","11001","10001","01110"],1:["00100","01100","00100","00100","00100","00100","01110"],2:["01110","10001","00001","00010","00100","01000","11111"],3:["11110","00001","00001","01110","00001","00001","11110"],4:["00010","00110","01010","10010","11111","00010","00010"],5:["11111","10000","10000","11110","00001","00001","11110"],6:["01110","10000","10000","11110","10001","10001","01110"],7:["11111","00001","00010","00100","01000","01000","01000"],8:["01110","10001","10001","01110","10001","10001","01110"],9:["01110","10001","10001","01111","00001","00001","01110"],"!":["00100","00100","00100","00100","00100","00000","00100"],"?":["01110","10001","00001","00010","00100","00000","00100"],".":["00000","00000","00000","00000","00000","00110","00110"],",":["00000","00000","00000","00000","00110","00110","00100"],":":["00000","00110","00110","00000","00110","00110","00000"],"+":["00000","00100","00100","11111","00100","00100","00000"],"-":["00000","00000","00000","11111","00000","00000","00000"],"/":["00001","00010","00010","00100","01000","01000","10000"],"'":["00100","00100","00000","00000","00000","00000","00000"]," ":["000","000","000","000","000","000","000"]},Pi=function(e){var t,n,a,l,i=0;try{for(var v=Ei(e),c=v.next();!c.done;c=v.next()){var E=c.value;i+=((l=(a=la[E])===null||a===void 0?void 0:a[0].length)!==null&&l!==void 0?l:5)+1}}catch(f){t={error:f}}finally{try{c&&!c.done&&(n=v.return)&&n.call(v)}finally{if(t)throw t.error}}return Math.max(0,i-1)},zf=function(e,t){var n,a,l=[],i="";try{for(var v=Ei(e),c=v.next();!c.done;c=v.next()){var E=c.value;i&&Pi(i+E)>t&&(l.push(i),i=""),i+=E}}catch(f){n={error:f}}finally{try{c&&!c.done&&(a=v.return)&&a.call(v)}finally{if(n)throw n.error}}return i&&l.push(i),l};function Wf(e,t,n){var a,l,i,v,c;n===void 0&&(n=1);var E=Math.max(1,Math.floor(t/Math.max(1,n))),f=[];try{for(var M=Ei(String(e).toUpperCase().split(`
|
|
2
|
+
`)),k=M.next();!k.done;k=M.next()){var B=k.value,re=B.split(/\s+/).filter(Boolean);if(!re.length){f.push("");continue}var U="";try{for(var Y=(i=void 0,Ei(re)),oe=Y.next();!oe.done;oe=Y.next()){var _=oe.value;if(Pi(_)>E){U&&f.push(U);var ee=zf(_,E);f.push.apply(f,oa([],aa(ee.slice(0,-1)),!1)),U=(c=ee.at(-1))!==null&&c!==void 0?c:""}else{var y=U?U+" "+_:_;Pi(y)<=E?U=y:(U&&f.push(U),U=_)}}}catch(O){i={error:O}}finally{try{oe&&!oe.done&&(v=Y.return)&&v.call(Y)}finally{if(i)throw i.error}}U&&f.push(U)}}catch(O){a={error:O}}finally{try{k&&!k.done&&(l=M.return)&&l.call(M)}finally{if(a)throw a.error}}return f}var cl=function(e){var t,n=Math.max(0,(t=e.padding)!==null&&t!==void 0?t:4),a=e.pixelPanel&&e.padding===void 0;return{x:a?8:n,y:a?4:n}},Lf=function(e,t,n,a){var l,i=t.wrap===!1?String(e).toUpperCase().split(`
|
|
3
|
+
`):Wf(e,a,n),v=i.slice(0,16),c=Math.round(n*8*((l=t.lineHeight)!==null&&l!==void 0?l:1.2));return{allLines:i,lines:v,renderedWidth:Math.max.apply(Math,oa([0],aa(v.map(function(E){return Pi(E)*n})),!1)),renderedHeight:(v.length-1)*c+7*n}};function qa(e,t){for(var n,a=cl(t),l=Math.max(0,t.width-2*a.x),i=Math.max(0,t.height-2*a.y),v=Math.max(1,Math.floor(t.fontSize/8)),c=t.autoFit===!1?v:Math.min(v,Math.max(1,Math.ceil(((n=t.minFontSize)!==null&&n!==void 0?n:12)/8))),E=oa([],aa(new Set(oa([],aa(String(e).toUpperCase()),!1).filter(function(U){return U!==`
|
|
4
|
+
`&&!la[U]}))),!1),f,M=v;M>=c;M--){var k=Lf(e,t,M,l),B=k.renderedWidth>l,re=k.allLines.length>16||k.renderedHeight>i;if(f={lines:k.lines,scale:M,fontSize:M*8,renderedWidth:k.renderedWidth,renderedHeight:k.renderedHeight,overflowsWidth:B,overflowsHeight:re,unsupportedChars:E},t.autoFit===!1||!B&&!re)break}return f}function hl(e,t,n){var a,l=qa(t,n),i=l.lines,v=l.scale,c=cl(n),E=Math.max(0,n.width-2*c.x),f=Math.max(0,n.height-2*c.y),M=Math.round(l.fontSize*((a=n.lineHeight)!==null&&a!==void 0?a:1.2)),k=c.y+(f-l.renderedHeight)/2;return e.fillStyle=n.color,i.forEach(function(B,re){var U,Y,oe,_=Pi(B)*v,ee=n.align==="left"?c.x:n.align==="right"?n.width-_-c.x:c.x+(E-_)/2,y=ee;try{for(var O=Ei(B),Re=O.next();!Re.done;Re=O.next()){var Pe=Re.value,be=(oe=la[Pe])!==null&&oe!==void 0?oe:la["?"];be.forEach(function(Le,Z){for(var ue=0;ue<Le.length;ue++)Le[ue]==="1"&&e.fillRect(Math.round(y+ue*v),Math.round(k+re*M+Z*v),v,v)}),y+=(be[0].length+1)*v}}catch(Le){U={error:Le}}finally{try{Re&&!Re.done&&(Y=O.return)&&Y.call(O)}finally{if(U)throw U.error}}}),l}var en=function(){return en=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},en.apply(this,arguments)},_a=Math.PI*2,Mr=function(e,t){return((Math.imul(e+1,2654435769)^Math.imul(t,2246822507))>>>0)/4294967296};function eo(e,t,n){var a,l,i=[e.color,e.color2,e.color3].filter(Boolean),v=((a=e.spread)!==null&&a!==void 0?a:360)*Math.PI/180,c=((l=e.direction)!==null&&l!==void 0?l:-90)*Math.PI/180;return Array.from({length:e.count},function(E,f){var M,k,B=c+((f+.2+Mr(f,1)*.6)/e.count-.5)*v,re=e.speed*(.42+.65*Mr(f,2));return en(en({},t),{clipId:n,shape:"pixel-confetti",age:-.12*Mr(f,3),vx:Math.cos(B)*re,vy:Math.sin(B)*re,gravity:(M=e.gravity)!==null&&M!==void 0?M:250,life:((k=e.lifetime)!==null&&k!==void 0?k:.7)*(.6+.4*Mr(f,4)),color:i[f%i.length],size:3+Math.floor(3*Mr(f,5)),angle:_a*Mr(f,6),spin:(Mr(f,7)-.5)*12})})}function yl(e){var t=Math.min(12,Math.ceil(Math.sqrt(e.count))),n=Math.ceil(e.count/t),a=e.speed;return eo(e).map(function(l,i){return en(en({},l),{screen:!0,x:(i%t+.15+.7*Mr(i,8))/t,y:(Math.floor(i/t)+.15+.7*Mr(i,9))/n,vx:a*(Mr(i,10)-.5)*.7,vy:a*(.3+.5*Mr(i,11)),size:l.size+1})})}var da=function(e,t){return(e%t+t)%t};function pl(e,t,n){var a=t.x,l=t.y,i=t.vx,v=t.vy,c=t.age,E=t.life,f=t.gravity,M=t.size,k=t.angle,B=t.spin,re=t.color;if(!(c<0)){var U=i*c,Y=v*c+f*c*c/2,oe=Math.round(n?n.x+da(a*n.width+U,n.width):a+U),_=Math.round(n?n.y+da(l*n.height+Y,n.height):l+Y),ee=Math.round((k+B*c)/(Math.PI/4))&3;if(e.globalAlpha*=Math.min(1,(E-c)*4),e.fillStyle="#3c293388",ee===0)e.fillRect(oe-M+1,_+1,M*2+1,M+1);else if(ee===2)e.fillRect(oe+1,_-M+1,M+1,M*2+1);else for(var y=-1;y<=1;y++)e.fillRect(oe+y*M+1,_+y*M*(ee===1?1:-1)+1,M+1,M+1);if(e.fillStyle=re,ee===0)e.fillRect(oe-M,_,M*2,M);else if(ee===2)e.fillRect(oe,_-M,M,M*2);else for(var y=-1;y<=1;y++)e.fillRect(oe+y*M,_+y*M*(ee===1?1:-1),M,M)}}function ro(e,t,n){var a,l,i=[e.color,e.color2,e.color3,"#ff6b6b","#4ecdc4","#fff3b0"].filter(Boolean),v=((a=e.spread)!==null&&a!==void 0?a:360)*Math.PI/180,c=((l=e.direction)!==null&&l!==void 0?l:-90)*Math.PI/180;return Array.from({length:e.count},function(E,f){var M,k,B=c+((f+.2+Mr(f,11)*.6)/e.count-.5)*v,re=e.speed*(.45+.65*Mr(f,12));return en(en({},t),{clipId:n,shape:"confetti",age:-.15*Mr(f,13),vx:Math.cos(B)*re,vy:Math.sin(B)*re,gravity:(M=e.gravity)!==null&&M!==void 0?M:140,life:((k=e.lifetime)!==null&&k!==void 0?k:2.6)*(.75+.35*Mr(f,14)),color:i[f%i.length],size:5+Math.floor(5*Mr(f,15)),kind:f%5===0?"star":"ribbon",angle:_a*Mr(f,16),spin:(Mr(f,17)-.5)*5.5,flutter:1.6+2.2*Mr(f,18),phase:_a*Mr(f,19)})})}function ml(e){var t=Math.min(14,Math.ceil(Math.sqrt(e.count))),n=Math.ceil(e.count/t),a=e.speed;return ro(e,{x:0,y:0}).map(function(l,i){var v;return en(en({},l),{screen:!0,x:(i%t+.12+.76*Mr(i,20))/t,y:(Math.floor(i/t)+.08+.84*Mr(i,21))/n,vx:a*(Mr(i,22)-.5)*.65,vy:a*(.38+.55*Mr(i,23)),gravity:Math.min((v=e.gravity)!==null&&v!==void 0?v:90,90)})})}function gl(e,t,n){var a=t.x,l=t.y,i=t.vx,v=t.vy,c=t.age,E=t.life,f=t.gravity,M=t.size,k=t.angle,B=t.spin,re=t.flutter,U=t.phase,Y=t.color,oe=t.kind;if(!(c<0)){var _=Math.sin(c*re+U)*14,ee=i*c+_,y=v*c+f*c*c/2,O=n?n.x+da(a*n.width+ee,n.width):a+ee,Re=n?n.y+da(l*n.height+y,n.height):l+y,Pe=Math.min(1,c*2.8,(E-c)*2.2);if(!(Pe<=0)){e.save(),e.globalAlpha*=Pe,e.translate(O,Re),e.rotate(k+B*c);var be=Math.cos(c*re*1.4+U);if(e.scale(1,Math.max(.22,Math.abs(be))),e.fillStyle=Y,oe==="star"){var Le=M*.85;e.beginPath();for(var Z=0;Z<8;Z++){var ue=Z%2===0?Le:Le*.38,ae=Z*Math.PI/4;Z===0?e.moveTo(Math.cos(ae)*ue,Math.sin(ae)*ue):e.lineTo(Math.cos(ae)*ue,Math.sin(ae)*ue)}e.closePath(),e.fill()}else e.fillRect(-M*.7,-M*.34,M*1.4,M*.68),e.fillStyle="#ffffff55",e.fillRect(-M*.7,-M*.34,M*1.4,M*.2);e.restore()}}}function Il(e,t,n,a,l){var i=t.width,v=t.height;if(!(i<=0||v<=0)){var c=Math.min(3,Math.floor(Math.min(i,v)/8));if(!c){e.fillStyle=n,e.fillRect(0,0,i,v);return}var E=a?c*2:0,f=v-(a?c:c*3),M=l>=0?.5+.5*Math.sin(l*4):0;t.enabled&&!a&&l>=0&&(e.save(),e.shadowColor="#ffd05a99",e.shadowBlur=8+M*9,e.fillStyle=n,e.fillRect(c,E+c,i-2*c,v-E-2*c),e.restore()),e.fillStyle=t.stroke,e.fillRect(c,0,i-2*c,v),e.fillRect(0,c,i,v-2*c),e.fillStyle=n,e.fillRect(c,E+c,i-2*c,v-E-2*c),e.fillStyle="#431d1380",e.fillRect(c,f,i-2*c,v-c-f),e.fillStyle=t.enabled?"#fff4be":"#ffffff55",e.fillRect(2*c,E+c,i-4*c,a?c:c*2),e.fillStyle="#ffffff55",e.fillRect(c,E+3*c,c,Math.max(0,f-E-3*c)),e.fillStyle="#521b2444",e.fillRect(i-2*c,E+3*c,c,Math.max(0,f-E-3*c));var k=l>=0?l%1.9:-1,B=(k-.1)/.55;if(t.enabled&&!a&&B>=0&&B<1){e.save(),e.beginPath(),e.rect(2*c,E+3*c,i-4*c,Math.max(0,f-E-3*c)),e.clip();for(var re=Math.floor(((i+14*c)*B-6*c)/c)*c,U=E+3*c,Y=0;U<f;U+=c,Y++){var oe=re-Math.floor(Y/2)*c;e.fillStyle="#fff4be44",e.fillRect(oe-2*c,U,9*c,c),e.fillStyle="#fffef0aa",e.fillRect(oe,U,4*c,c)}e.restore()}if(t.enabled&&!a&&l>=0){var _=Math.max(0,Math.sin(l*4.2)),ee=Math.max(0,Math.sin(l*4.2+2.2)),y=function(O,Re,Pe){if(!(Pe<.25)){e.save(),e.globalAlpha*=Pe*.95,e.fillStyle="#fffef4";var be=Pe>.65?c*2:c;e.fillRect(Math.round(O-be),Math.round(Re-c/2),be*2+c,c),e.fillRect(Math.round(O-c/2),Math.round(Re-be),c,be*2+c),e.restore()}};y(5*c,E+4*c,_),y(i-6*c,E+5*c,ee)}}}function fa(e,t,n,a,l,i){var v=Math.max(0,Math.min(i,a/2,l/2));e.beginPath(),typeof e.roundRect=="function"?e.roundRect(t,n,a,l,v):(e.moveTo(t+v,n),e.arcTo(t+a,n,t+a,n+l,v),e.arcTo(t+a,n+l,t,n+l,v),e.arcTo(t,n+l,t,n,v),e.arcTo(t,n,t+a,n,v),e.closePath())}function ja(e,t,n,a,l){if(!(l<=.02||a<=.5)){e.save(),e.translate(t,n),e.globalAlpha*=l,e.fillStyle="#fffef0",e.beginPath();for(var i=0;i<8;i++){var v=i%2===0?a:a*.24,c=i*Math.PI/4;i===0?e.moveTo(Math.cos(c)*v,Math.sin(c)*v):e.lineTo(Math.cos(c)*v,Math.sin(c)*v)}e.closePath(),e.fill(),e.restore()}}function xl(e,t,n,a,l){var i,v,c,E=t.width,f=t.height;if(!(E<=0||f<=0)){var M=Math.min((i=t.radius)!==null&&i!==void 0?i:16,E/2,f/2),k=a?2:6,B=a?3:0,re=l>=0?.5-.5*Math.cos(l*2.4):0;t.enabled&&!a&&l>=0&&(e.save(),e.shadowColor="#ffd23f99",e.shadowBlur=10+re*12,fa(e,0,B,E,f-B,M),e.fillStyle=n,e.fill(),e.restore()),e.save(),fa(e,0,B+2,E,Math.max(4,f-B-2),M),e.fillStyle="#0e2830",e.fill(),e.restore(),e.save(),fa(e,0,B,E,Math.max(4,f-k),M),e.fillStyle=n,e.fill(),e.clip();var U=(v=e.createLinearGradient)===null||v===void 0?void 0:v.call(e,0,B,0,f-k);if(U!=null&&U.addColorStop&&(U.addColorStop(0,"#ffffffa8"),U.addColorStop(.42,"#ffffff26"),U.addColorStop(.45,"#00000000"),U.addColorStop(1,"#00000024"),e.fillStyle=U,e.fillRect(0,B,E,f-k)),e.fillStyle="#fffef0bb",e.fillRect(M*.55,B+3,Math.max(0,E-M*1.1),3),t.enabled&&!a&&l>=0){var Y=(l%2.4-.15)/.95;if(Y>0&&Y<1){var oe=Y*Y*(3-2*Y),_=Math.sin(Y*Math.PI),ee=-E*.36+E*1.72*oe;e.save(),e.globalAlpha*=_,e.translate(ee,B),e.transform(1,0,-.36,1,0,0);var y=(c=e.createLinearGradient)===null||c===void 0?void 0:c.call(e,-48,0,48,0);y!=null&&y.addColorStop?(y.addColorStop(0,"#ffffff00"),y.addColorStop(.32,"#ffffff48"),y.addColorStop(.5,"#fffef8cc"),y.addColorStop(.68,"#ffffff48"),y.addColorStop(1,"#ffffff00"),e.fillStyle=y,e.fillRect(-48,0,96,f)):(e.fillStyle="#fffef8a8",e.fillRect(-14,0,28,f)),e.restore()}}if(e.restore(),t.strokeWidth&&(e.save(),fa(e,0,B,E,Math.max(4,f-k),M),e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,e.stroke(),e.restore()),t.enabled&&!a&&l>=0){var O=Math.max(0,Math.sin(l*2.4)),Re=O*O,Pe=Math.max(0,Math.sin(l*2.4+2.1)),be=Pe*Pe,Le=Math.max(0,Math.sin(l*2.4+4.2)),Z=Le*Le;ja(e,E*.12,B+9,4+Re*6,Re*.92),ja(e,E*.88,B+10,3.8+be*5.5,be*.9),ja(e,E*.76,Math.max(B+14,f-k-8),3+Z*4.2,Z*.8)}}}function ua(e){if(/\s/.test(e)||e.length>512)return!1;var t=/^https:\/\/play\.google\.com\/store\/apps\/details\?id=[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*){1,9}$/,n=/^https:\/\/apps\.apple\.com\/([a-z]{2}\/)?app\/([a-zA-Z0-9-]+\/)?id[1-9][0-9]{5,19}$/;return t.test(e)&&!/id=example\.|[.=]placeholder(\.|$)|id=com\.example(\.|$)/.test(e)||n.test(e)}var Ti=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ai=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},to=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function bl(e){var t,n,a;e===void 0&&(e={});var l=(t=e.timeoutMs)!==null&&t!==void 0?t:5e3,i=(n=e.pollMs)!==null&&n!==void 0?n:25;if(![l,i].every(function(J){return Number.isFinite(J)&&J>=1&&J<=6e4}))throw Error("Invalid Unity host deadline/poll interval");var v=(a=e.getHost)!==null&&a!==void 0?a:(function(){return window.mraid}),c=new Set,E=new Set,f=[],M={},k=!1,B=!1,re=!1,U=!1,Y=!1,oe=!1,_,ee,y,O,Re,Pe,be=function(){return re||U};function Le(){var J,Q,j;clearTimeout(Re),clearTimeout(Pe);try{for(var ye=Ti(f.splice(0)),le=ye.next();!le.done;le=ye.next()){var Ie=Ai(le.value,2),X=Ie[0],ve=Ie[1];try{(j=M.mraid)===null||j===void 0||j.removeEventListener(X,ve)}catch{}}}catch(Ne){J={error:Ne}}finally{try{le&&!le.done&&(Q=ye.return)&&Q.call(ye)}finally{if(J)throw J.error}}}function Z(J){O==null||O(J instanceof Error?J:Error(String(J))),y=void 0,O=void 0}function ue(J){var Q,j;if(!be()){var ye=k;if(re=!0,k=!1,B=!1,Le(),Z(J),ye)try{for(var le=Ti(to([],Ai(E),!1)),Ie=le.next();!Ie.done;Ie=le.next()){var X=Ie.value;X()}}catch(ve){Q={error:ve}}finally{try{Ie&&!Ie.done&&(j=le.return)&&j.call(le)}finally{if(Q)throw Q.error}}c.clear(),E.clear()}}function ae(J,Q){return f.push([J,Q]),M.mraid.addEventListener(J,Q),he(J,Q)}function he(J,Q){if(be()){try{M.mraid.removeEventListener(J,Q)}catch{}return!1}return!0}function R(J){var Q,j;if(!be()){if(typeof J!="boolean"){ue(Error("Invalid Unity viewability event"));return}if(!k){_=J;return}if(B!==J){B=J;try{for(var ye=Ti(to([],Ai(c),!1)),le=ye.next();!le.done;le=ye.next()){var Ie=le.value;if(be())break;Ie(B)}}catch(X){Q={error:X}}finally{try{le&&!le.done&&(j=ye.return)&&j.call(ye)}finally{if(Q)throw Q.error}}}}}var b=function(J){J==="hidden"&&ue(Error("Unity host closed"))},K=function(){var J;k&&!be()&&((J=e.onResize)===null||J===void 0||J.call(e))};function L(){var J,Q,j,ye;if(!(!Y||k||oe||be())){oe=!0;try{var le=M.mraid.getState();if(be()||le==="loading")return;if(le==="hidden")throw Error("Unity host closed before ready");if(!["default","expanded","resized"].includes(le))throw Error("Invalid Unity host state");var Ie=M.mraid.getVersion();if(be())return;if(Ie!=="3.0")throw Error("Unity Ads UA requires MRAID 3.0");try{for(var X=Ti([["viewableChange",R],["stateChange",b],["sizeChange",K]]),ve=X.next();!ve.done;ve=X.next()){var Ne=Ai(ve.value,2),se=Ne[0],ke=Ne[1];if(!ae(se,ke))return}}catch(zr){J={error:zr}}finally{try{ve&&!ve.done&&(Q=X.return)&&Q.call(X)}finally{if(J)throw J.error}}var $e=M.mraid.isViewable();if(be())return;if(typeof $e!="boolean")throw Error("Invalid Unity initial viewability");B=_!=null?_:$e,k=!0,clearTimeout(Re),clearTimeout(Pe),y==null||y(),y=void 0,O=void 0;try{for(var Ue=Ti(to([],Ai(c),!1)),lr=Ue.next();!lr.done;lr=Ue.next()){var Pr=lr.value;if(be())break;Pr(B)}}catch(zr){j={error:zr}}finally{try{lr&&!lr.done&&(ye=Ue.return)&&ye.call(Ue)}finally{if(j)throw j.error}}}catch(zr){ue(zr)}finally{oe=!1}}}function fe(){if(!be())try{var J=v();if(be())return;if(!J){Pe=setTimeout(fe,i);return}if(M.mraid=J,f.push(["ready",L]),M.mraid.addEventListener("ready",L),!he("ready",L))return;Y=!0,L()}catch(Q){ue(Q)}}return{init:function(){return ee||(ee=new Promise(function(J,Q){y=J,O=Q}),be()?(Z(Error("Unity bridge destroyed")),ee):(Re=setTimeout(function(){return ue(Error("Unity MRAID readiness timed out"))},l),fe(),ee))},isReady:function(){return k&&!be()},isVisible:function(){return k&&B&&!be()},isClosed:be,onVisibilityChanged:function(J){return be()||c.add(J),function(){return c.delete(J)}},onClosed:function(J){return be()||E.add(J),function(){return E.delete(J)}},openStore:function(J){if(!k||!B||be()||!ua(J))throw Error("Unity store request not permitted");M.mraid.open(J)},destroy:function(){U||(U=!0,k=!1,B=!1,Le(),Z(Error("Unity bridge destroyed")),c.clear(),E.clear())}}}var oi=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},li=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},no=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function wl(e){var t;e===void 0&&(e={});var n=(t=e.getHost)!==null&&t!==void 0?t:(function(){return window.mraid}),a,l=!1,i=!1,v=!1,c=!1,E=!1,f,M,k,B,re,U=new Set,Y=new Set,oe=[];function _(){var ae,he;clearTimeout(B),clearTimeout(re);try{for(var R=oi(oe.splice(0)),b=R.next();!b.done;b=R.next()){var K=li(b.value,2),L=K[0],fe=K[1];try{a==null||a.removeEventListener(L,fe)}catch{}}}catch(J){ae={error:J}}finally{try{b&&!b.done&&(he=R.return)&&he.call(R)}finally{if(ae)throw ae.error}}}function ee(ae,he){if(oe.push([ae,he]),a.addEventListener(ae,he),v||c){try{a.removeEventListener(ae,he)}catch{}return!1}return!0}function y(ae){var he=ae instanceof Error?ae:Error(String(ae));k==null||k(he),M=void 0,k=void 0}function O(ae,he){var R,b;if(!(v||c)&&(v=!0,l=!1,i=!1,_(),y(ae),he))try{for(var K=oi(no([],li(Y),!1)),L=K.next();!L.done;L=K.next()){var fe=L.value;fe()}}catch(J){R={error:J}}finally{try{L&&!L.done&&(b=K.return)&&b.call(K)}finally{if(R)throw R.error}}}function Re(){var ae,he,R,b;if(!(!E||l||v||c))try{var K=a.getState();if(v||c||K==="loading")return;if(K==="hidden"){O(Error("MRAID closed before ready"),!0);return}if(!["default","expanded","resized"].includes(K))throw Error("Invalid MRAID state");try{for(var L=oi([["viewableChange",be],["stateChange",Le],["sizeChange",Z]]),fe=L.next();!fe.done;fe=L.next()){var J=li(fe.value,2),Q=J[0],j=J[1];if(!ee(Q,j))return}}catch(X){ae={error:X}}finally{try{fe&&!fe.done&&(he=L.return)&&he.call(L)}finally{if(ae)throw ae.error}}var ye=a.isViewable();if(v||c)return;if(typeof ye!="boolean")throw Error("Invalid MRAID viewability");i=ye,l=!0,clearTimeout(B),clearTimeout(re),M==null||M(),M=void 0,k=void 0;try{for(var le=oi(no([],li(U),!1)),Ie=le.next();!Ie.done;Ie=le.next()){var j=Ie.value;j(i)}}catch(X){R={error:X}}finally{try{Ie&&!Ie.done&&(b=le.return)&&b.call(le)}finally{if(R)throw R.error}}}catch(X){O(X,l)}}var Pe=function(){return Re()},be=function(ae){var he,R;if(!(!l||v||c)){if(typeof ae!="boolean"){O(Error("Invalid MRAID visibility event"),!0);return}i=ae;try{for(var b=oi(no([],li(U),!1)),K=b.next();!K.done;K=b.next()){var L=K.value;L(i)}}catch(fe){he={error:fe}}finally{try{K&&!K.done&&(R=b.return)&&R.call(b)}finally{if(he)throw he.error}}}},Le=function(ae){ae==="hidden"&&O(Error("MRAID closed"),!0)},Z=function(){var ae;l&&!v&&!c&&((ae=e.onResize)===null||ae===void 0||ae.call(e))};function ue(){var ae,he,R;if(!(v||c))try{if(a=n(),v||c)return;if(!a){re=setTimeout(ue,(R=e.pollMs)!==null&&R!==void 0?R:50);return}if(![a.getState,a.isViewable,a.addEventListener,a.removeEventListener,a.open].every(function(Q){return typeof Q=="function"}))throw Error("Incomplete MRAID 2 interface");try{for(var b=oi([["ready",Pe]]),K=b.next();!K.done;K=b.next()){var L=li(K.value,2),fe=L[0],J=L[1];if(!ee(fe,J))return}}catch(Q){ae={error:Q}}finally{try{K&&!K.done&&(he=b.return)&&he.call(b)}finally{if(ae)throw ae.error}}E=!0,Re()}catch(Q){O(Q,!1)}}return{init:function(){var ae;return f||(f=new Promise(function(he,R){M=he,k=R}),v||c?(y(Error("MRAID bridge destroyed")),f):(B=setTimeout(function(){return O(Error("MRAID readiness timed out"),!1)},(ae=e.timeoutMs)!==null&&ae!==void 0?ae:5e3),ue(),f))},isReady:function(){return l&&!v&&!c},isVisible:function(){return i&&l&&!v&&!c},isClosed:function(){return v||c},onVisibilityChanged:function(ae){return!v&&!c&&U.add(ae),function(){return U.delete(ae)}},onClosed:function(ae){return!v&&!c&&Y.add(ae),function(){return Y.delete(ae)}},openStore:function(ae){if(!l||!i||v||c||!ua(ae))throw Error("MRAID store request not permitted");a.open(ae)},destroy:function(){c||(c=!0,l=!1,i=!1,_(),y(Error("MRAID bridge destroyed")),U.clear(),Y.clear())}}}var Yn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Gn=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Ri=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))};function Ml(e){e===void 0&&(e={});var t=new Set,n=new Set,a=new Set,l=[],i,v=!1,c=!1,E=!1,f=!1,M,k,B,re,U,Y=function(){return E||f};function oe(){var Z,ue;clearTimeout(re),clearTimeout(U);try{for(var ae=Yn(l.splice(0)),he=ae.next();!he.done;he=ae.next()){var R=Gn(he.value,2),b=R[0],K=R[1];try{i==null||i.removeEventListener(b,K)}catch{}}}catch(L){Z={error:L}}finally{try{he&&!he.done&&(ue=ae.return)&&ue.call(ae)}finally{if(Z)throw Z.error}}}function _(Z){var ue,ae;if(!Y()){E=!0,v=!1,c=!1,oe(),B==null||B(Z instanceof Error?Z:Error(String(Z))),k=void 0,B=void 0;try{for(var he=Yn(Ri([],Gn(n),!1)),R=he.next();!R.done;R=he.next()){var b=R.value;b()}}catch(K){ue={error:K}}finally{try{R&&!R.done&&(ae=he.return)&&ae.call(he)}finally{if(ue)throw ue.error}}}}var ee=function(Z){if(!(typeof Z!="number"||!Number.isFinite(Z)||Z<0))return Math.min(1,Z>1?Z/100:Z)},y=function(Z){if(typeof Z=="boolean")return Z;if(Z&&typeof Z=="object"&&typeof Z.isViewable=="boolean")return Z.isViewable},O=function(){var Z,ue,ae,he,R,b;if(!(v||Y()||!i||((R=i.isReady)===null||R===void 0?void 0:R.call(i))===!1))try{c=i.isViewable();var K=(b=i.getAudioVolume)===null||b===void 0?void 0:b.call(i),L=K===void 0?void 0:ee(K);if(typeof c!="boolean"||K!==void 0&&L===void 0)throw Error("Invalid DAPI initial state");if(v=!0,clearTimeout(re),clearTimeout(U),k==null||k(),k=void 0,B=void 0,L!==void 0)try{for(var fe=Yn(Ri([],Gn(a),!1)),J=fe.next();!J.done;J=fe.next()){var Q=J.value;Q(L)}}catch(le){Z={error:le}}finally{try{J&&!J.done&&(ue=fe.return)&&ue.call(fe)}finally{if(Z)throw Z.error}}try{for(var j=Yn(Ri([],Gn(t),!1)),ye=j.next();!ye.done;ye=j.next()){var Q=ye.value;Q(c)}}catch(le){ae={error:le}}finally{try{ye&&!ye.done&&(he=j.return)&&he.call(j)}finally{if(ae)throw ae.error}}}catch(le){_(le)}},Re=function(Z){var ue,ae;if(!Y()){var he=y(Z);if(he===void 0){_(Error("Invalid DAPI visibility"));return}c=he;try{for(var R=Yn(Ri([],Gn(t),!1)),b=R.next();!b.done;b=R.next()){var K=b.value;K(he)}}catch(L){ue={error:L}}finally{try{b&&!b.done&&(ae=R.return)&&ae.call(R)}finally{if(ue)throw ue.error}}}},Pe=function(Z){var ue,ae;if(!Y()){var he=ee(Z);if(he===void 0){_(Error("Invalid DAPI volume"));return}try{for(var R=Yn(Ri([],Gn(a),!1)),b=R.next();!b.done;b=R.next()){var K=b.value;K(he)}}catch(L){ue={error:L}}finally{try{b&&!b.done&&(ae=R.return)&&ae.call(R)}finally{if(ue)throw ue.error}}}},be=function(){var Z;v&&!Y()&&((Z=e.onResize)===null||Z===void 0||Z.call(e))};function Le(){var Z,ue,ae;if(!Y()){if(i=window.dapi,!i){U=setTimeout(Le,(ae=e.pollMs)!==null&&ae!==void 0?ae:25);return}try{try{for(var he=Yn([["ready",O],["viewableChange",Re],["audioVolumeChange",Pe],["adResized",be]]),R=he.next();!R.done;R=he.next()){var b=Gn(R.value,2),K=b[0],L=b[1];l.push([K,L]),i.addEventListener(K,L)}}catch(fe){Z={error:fe}}finally{try{R&&!R.done&&(ue=he.return)&&ue.call(he)}finally{if(Z)throw Z.error}}O()}catch(fe){_(fe)}}}return{init:function(){var Z;return M||(M=new Promise(function(ue,ae){k=ue,B=ae}),Y()?(B==null||B(Error("DAPI bridge closed")),M):(re=setTimeout(function(){return _(Error("DAPI readiness timed out"))},(Z=e.timeoutMs)!==null&&Z!==void 0?Z:5e3),Le(),M))},isReady:function(){return v&&!Y()},isVisible:function(){return v&&c&&!Y()},isClosed:Y,onVisibilityChanged:function(Z){return Y()||t.add(Z),function(){return t.delete(Z)}},onClosed:function(Z){return Y()||n.add(Z),function(){return n.delete(Z)}},onVolumeChanged:function(Z){return Y()||a.add(Z),function(){return a.delete(Z)}},openStore:function(){if(!v||!c||Y()||typeof(i==null?void 0:i.openStoreUrl)!="function")throw Error("DAPI store host unavailable");i.openStoreUrl()},destroy:function(){f||(f=!0,v=!1,c=!1,oe(),B==null||B(Error("DAPI bridge destroyed")),t.clear(),n.clear(),a.clear())}}}var Df=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(M){try{f(a.next(M))}catch(k){v(k)}}function E(M){try{f(a.throw(M))}catch(k){v(k)}}function f(M){M.done?i(M.value):l(M.value).then(c,E)}f((a=a.apply(e,t||[])).next())})},Hf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(M){return E([f,M])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(M){f=[6,M],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Ff=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},Xf=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Uf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Sl(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,v;if(!a){n=document.visibilityState!=="hidden";try{for(var c=Uf(Xf([],Ff(e),!1)),E=c.next();!E.done;E=c.next()){var f=E.value;f(n)}}catch(M){i={error:M}}finally{try{E&&!E.done&&(v=c.return)&&v.call(c)}finally{if(i)throw i.error}}}};return{init:function(){return Df(this,void 0,void 0,function(){return Hf(this,function(i){switch(i.label){case 0:if(a)throw Error("Meta bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(v){return document.addEventListener("DOMContentLoaded",function(){return v()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("Meta bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i=window.FbPlayableAd;if(!t||!n||a||typeof(i==null?void 0:i.onCTAClick)!="function")throw Error("Meta CTA host unavailable");i.onCTAClick()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var Yf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(M){try{f(a.next(M))}catch(k){v(k)}}function E(M){try{f(a.throw(M))}catch(k){v(k)}}function f(M){M.done?i(M.value):l(M.value).then(c,E)}f((a=a.apply(e,t||[])).next())})},Gf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(M){return E([f,M])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(M){f=[6,M],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},Zf=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},$f=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},Kf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function kl(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,v;if(!a){n=document.visibilityState!=="hidden";try{for(var c=Kf($f([],Zf(e),!1)),E=c.next();!E.done;E=c.next()){var f=E.value;f(n)}}catch(M){i={error:M}}finally{try{E&&!E.done&&(v=c.return)&&v.call(c)}finally{if(i)throw i.error}}}};return{init:function(){return Yf(this,void 0,void 0,function(){return Gf(this,function(i){switch(i.label){case 0:if(a)throw Error("Google Ads bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(v){return document.addEventListener("DOMContentLoaded",function(){return v()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("Google Ads bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i=window.ExitApi;if(!t||!n||a||typeof(i==null?void 0:i.exit)!="function")throw Error("Google ExitApi unavailable");i.exit()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var Qf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(M){try{f(a.next(M))}catch(k){v(k)}}function E(M){try{f(a.throw(M))}catch(k){v(k)}}function f(M){M.done?i(M.value):l(M.value).then(c,E)}f((a=a.apply(e,t||[])).next())})},Jf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(M){return E([f,M])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(M){f=[6,M],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},io=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},ao=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},oo=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Cl(){var e=window,t=new Set,n=new Set,a=e.gameStart,l=e.gameClose,i=!1,v=!1,c=!1,E=!1,f=function(){var k,B;if(!(c||E)){var re=!v||!i;if(i=!0,v=!0,re)try{for(var U=oo(ao([],io(t),!1)),Y=U.next();!Y.done;Y=U.next()){var oe=Y.value;oe(!0)}}catch(_){k={error:_}}finally{try{Y&&!Y.done&&(B=U.return)&&B.call(U)}finally{if(k)throw k.error}}}},M=function(){var k,B,re,U;if(!(c||E)){i=!1,v=!1,c=!0;try{for(var Y=oo(ao([],io(t),!1)),oe=Y.next();!oe.done;oe=Y.next()){var _=oe.value;_(!1)}}catch(O){k={error:O}}finally{try{oe&&!oe.done&&(B=Y.return)&&B.call(Y)}finally{if(k)throw k.error}}try{for(var ee=oo(ao([],io(n),!1)),y=ee.next();!y.done;y=ee.next()){var _=y.value;_()}}catch(O){re={error:O}}finally{try{y&&!y.done&&(U=ee.return)&&U.call(ee)}finally{if(re)throw re.error}}}};return e.gameStart=f,e.gameClose=M,{init:function(){return Qf(this,void 0,void 0,function(){return Jf(this,function(k){if(c||E)throw Error("Mintegral bridge closed");if(typeof e.gameReady!="function")throw Error("Mintegral gameReady host unavailable");return e.gameReady(),[2]})})},isReady:function(){return i&&!c&&!E},isVisible:function(){return i&&v&&!c&&!E},isClosed:function(){return c||E},onVisibilityChanged:function(k){return!c&&!E&&t.add(k),function(){return t.delete(k)}},onClosed:function(k){return!c&&!E&&n.add(k),function(){return n.delete(k)}},notifyGameEnd:function(){var k;!c&&!E&&((k=e.gameEnd)===null||k===void 0||k.call(e))},notifyGameRetry:function(){var k;!c&&!E&&((k=e.gameRetry)===null||k===void 0||k.call(e))},openStore:function(){if(!i||!v||c||E||typeof e.install!="function")throw Error("Mintegral install host unavailable");e.install()},destroy:function(){E||(E=!0,i=!1,v=!1,e.gameStart===f&&(a?e.gameStart=a:delete e.gameStart),e.gameClose===M&&(l?e.gameClose=l:delete e.gameClose),t.clear(),n.clear())}}}var qf=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(M){try{f(a.next(M))}catch(k){v(k)}}function E(M){try{f(a.throw(M))}catch(k){v(k)}}function f(M){M.done?i(M.value):l(M.value).then(c,E)}f((a=a.apply(e,t||[])).next())})},jf=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(M){return E([f,M])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(M){f=[6,M],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},_f=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},ed=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},rd=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function El(){var e=new Set,t=!1,n=!1,a=!1,l=function(){var i,v;if(!a){n=document.visibilityState!=="hidden";try{for(var c=rd(ed([],_f(e),!1)),E=c.next();!E.done;E=c.next()){var f=E.value;f(n)}}catch(M){i={error:M}}finally{try{E&&!E.done&&(v=c.return)&&v.call(c)}finally{if(i)throw i.error}}}};return{init:function(){return qf(this,void 0,void 0,function(){return jf(this,function(i){switch(i.label){case 0:if(a)throw Error("TikTok bridge destroyed");return document.readyState!=="loading"?[3,2]:[4,new Promise(function(v){return document.addEventListener("DOMContentLoaded",function(){return v()},{once:!0})})];case 1:i.sent(),i.label=2;case 2:if(a)throw Error("TikTok bridge destroyed");return document.addEventListener("visibilitychange",l),n=document.visibilityState!=="hidden",t=!0,l(),[2]}})})},isReady:function(){return t&&!a},isVisible:function(){return t&&n&&!a},isClosed:function(){return a},onVisibilityChanged:function(i){return a||e.add(i),function(){return e.delete(i)}},onClosed:function(){return function(){}},openStore:function(){var i,v,c=window,E=typeof c.openAppStore=="function"?c.openAppStore.bind(c):(v=(i=c.playableSDK)===null||i===void 0?void 0:i.openAppStore)===null||v===void 0?void 0:v.bind(c.playableSDK);if(!t||!n||a||!E)throw Error("TikTok store host unavailable");E()},destroy:function(){a=!0,t=!1,n=!1,document.removeEventListener("visibilitychange",l),e.clear()}}}var ge=function(){return ge=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e},ge.apply(this,arguments)},td=function(e,t,n,a){function l(i){return i instanceof n?i:new n(function(v){v(i)})}return new(n||(n=Promise))(function(i,v){function c(M){try{f(a.next(M))}catch(k){v(k)}}function E(M){try{f(a.throw(M))}catch(k){v(k)}}function f(M){M.done?i(M.value):l(M.value).then(c,E)}f((a=a.apply(e,t||[])).next())})},nd=function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,l,i,v=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return v.next=c(0),v.throw=c(1),v.return=c(2),typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function c(f){return function(M){return E([f,M])}}function E(f){if(a)throw new TypeError("Generator is already executing.");for(;v&&(v=0,f[0]&&(n=0)),n;)try{if(a=1,l&&(i=f[0]&2?l.return:f[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,f[1])).done)return i;switch(l=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,l=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){n.label=f[1];break}if(f[0]===6&&n.label<i[1]){n.label=i[1],i=f;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(f);break}i[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(M){f=[6,M],l=0}finally{a=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},$=function(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var a=n.call(e),l,i=[],v;try{for(;(t===void 0||t-- >0)&&!(l=a.next()).done;)i.push(l.value)}catch(c){v={error:c}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(v)throw v.error}}return i},ie=function(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,i;a<l;a++)(i||!(a in t))&&(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))},q=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Tl(e){if(e!=="standalone"){if(e==="unity-ads-ua-playable")return bl();if(e==="applovin-growth-playable")return wl();if(e==="ironsource-levelplay-playable")return Ml();if(e==="meta-audience-playable")return Sl();if(e==="google-ads-app-playable")return kl();if(e==="mintegral-appgrowth-zip")return Cl();if(e==="tiktok-ads-playable")return El();throw Error("E_NATIVE_TARGET")}}function lo(e){var t,n,a,l,i=(t=e.left)!==null&&t!==void 0?t:0,v=(n=e.top)!==null&&n!==void 0?n:0,c=(a=e.right)!==null&&a!==void 0?a:i+e.width,E=(l=e.bottom)!==null&&l!==void 0?l:v+e.height,f=[{id:"sdk-top-left",left:i,top:v,right:Math.min(i+48,c),bottom:Math.min(v+48,E)},{id:"sdk-top-right",left:Math.max(i,c-56),top:v,right:c,bottom:Math.min(v+56,E)},{id:"sdk-bottom-left",left:i,top:Math.max(v,E-28),right:Math.min(i+48,c),bottom:E}];return{left:Math.min(i+48,c),top:Math.min(v+56,E),right:Math.max(i,c-56),bottom:Math.max(v,E-28),zones:f}}function va(e,t){var n,a,l=(a=(n=e.measureText)===null||n===void 0?void 0:n.call(e,t))===null||a===void 0?void 0:a.width,i=/(\d+(?:\.\d+)?)px/.exec(e.font||"");return Number.isFinite(l)?l:ie([],$(t),!1).length*(i?Number(i[1]):16)*.6}function Pl(e,t,n,a){var l,i,v,c,E,f,M;e.font=n.fontWeight+" "+a+"px "+n.fontFamily;var k=Math.max(0,n.width-2*((M=n.padding)!==null&&M!==void 0?M:4)),B=[];try{for(var re=q(String(t).split(`
|
|
5
|
+
`)),U=re.next();!U.done;U=re.next()){var Y=U.value;if(n.wrap===!1){B.push(Y);continue}var oe=Y.trim()?Y.trim().split(/\s+/):[""],_=void 0;try{for(var ee=(v=void 0,q(oe)),y=ee.next();!y.done;y=ee.next()){var O=y.value,Re=_?_+" "+O:O;if(va(e,Re)<=k){_=Re;continue}if(_&&B.push(_),va(e,O)<=k){_=O;continue}var Pe="";try{for(var be=(E=void 0,q(O)),Le=be.next();!Le.done;Le=be.next()){var Z=Le.value;Pe&&va(e,Pe+Z)>k?(B.push(Pe),Pe=Z):Pe+=Z}}catch(ue){E={error:ue}}finally{try{Le&&!Le.done&&(f=be.return)&&f.call(be)}finally{if(E)throw E.error}}_=Pe}}catch(ue){v={error:ue}}finally{try{y&&!y.done&&(c=ee.return)&&c.call(ee)}finally{if(v)throw v.error}}B.push(_)}}catch(ue){l={error:ue}}finally{try{U&&!U.done&&(i=re.return)&&i.call(re)}finally{if(l)throw l.error}}return B}function Al(e,t,n){var a,l,i=(a=n.padding)!==null&&a!==void 0?a:4,v=Math.max(0,n.width-2*i),c=Math.max(0,n.height-2*i),E=Math.min(n.fontSize,(l=n.minFontSize)!==null&&l!==void 0?l:12),f=n.fontSize,M=Pl(e,t,n,f),k,B=function(){var re;e.font=n.fontWeight+" "+f+"px "+n.fontFamily;var U=Math.max.apply(Math,ie([0],$(M.map(function(ee){return va(e,ee)})),!1)),Y=f*((re=n.lineHeight)!==null&&re!==void 0?re:1.2),oe=M.length>16;oe&&(M=M.slice(0,16));var _=M.length*Y;return{lines:M,fontSize:f,scale:f/n.fontSize,renderedWidth:U,renderedHeight:_,availableWidth:v,availableHeight:c,padding:i,lineHeight:Y,overflowsWidth:U>v+.01,overflowsHeight:oe||_>c+.01,unsupportedChars:[]}};if(k=B(),n.autoFit!==!1)for(;(k.overflowsWidth||k.overflowsHeight)&&f>E;)f=Math.max(E,f-1),M=Pl(e,t,n,f),k=B();return k}function id(e,t,n){var a=Al(e,t,n),l=a.padding;e.fillStyle=n.color,e.font=n.fontWeight+" "+a.fontSize+"px "+n.fontFamily,e.textAlign=n.align,e.textBaseline="middle";var i=n.align==="left"?l:n.align==="right"?n.width-l:n.width/2,v=(n.height-a.renderedHeight)/2;return a.lines.forEach(function(c,E){return e.fillText(c,i,v+(E+.5)*a.lineHeight)}),a}function ad(e,t,n){var a,l,i,v,c,E,f=n===void 0?{}:n,M=f.edit,k=M===void 0?!1:M,B=f.sceneId,re=B===void 0?e.base.startScene:B,U=f.onSelect,Y=U===void 0?function(){}:U,oe=f.network,_=oe===void 0?"standalone":oe,ee=Tl(_),y=t.getContext("2d"),O=new Map(e.components.map(function(r){return[r.id,r]})),Re=new Map(e.assets.map(function(r){return[r.id,r]})),Pe=new Map,be=new Map(e.events.map(function(r){return[r.id,r]})),Le=new Map(e.gameplay.filter(function(r){return r.kind==="responsive-layout"}).map(function(r){return[r.componentId,r.parameters]})),Z=(i=globalThis.matchMedia)===null||i===void 0?void 0:i.call(globalThis,"(prefers-reduced-motion: reduce)"),ue,ae=new Map,he=ae;function R(){var r=Le.size>0&&t.clientWidth>t.clientHeight;return{width:r?Math.max(e.base.width,e.base.height):e.base.width,height:r?Math.min(e.base.width,e.base.height):e.base.height,landscape:r}}function b(){ue!==R().landscape&&(Kt(),it())}try{for(var K=q(e.assets),L=K.next();!L.done;L=K.next()){var fe=L.value;if(fe.mime.startsWith("image/")){var J=new Image;J.src="data:"+fe.mime+";base64,"+fe.data,Pe.set(fe.id,J)}}}catch(r){a={error:r}}finally{try{L&&!L.done&&(l=K.return)&&l.call(K)}finally{if(a)throw a.error}}var Q=re,j={},ye=[],le=[],Ie=[],X=[],ve=new Set,Ne=new Map,se=0,ke=0,$e=0,Ue=0,lr=0,Pr=!1,zr=0,Wr=0,Tr=!1,pn=[],Ke,It,Ze,Gt,tt,At,mn,xt,Rt,Dt,rn=[],bt,lt=[],yt=[],Ar,tn=0,Oi=!1,fi=0,gn=_==="standalone",di=_==="standalone",Zn=_==="standalone",Tn=!1,Vi=!1,Qe=new Map,An=new Map,mr=new Map,ui=new Map,In=new Set,fo=new Map,uo=new Map,$n=new Set,Kn=new Map,Ni=new Map,sa=new Map,ca=new Map,xn=new Map,Ht=new Map,vi=0,ha=0,Fr,nt,ya=1,pa,wt=new Map,vo=new Map,Ot=new Map,Zt=new Map,Rn=new Map,On=new Map,Bi=new Map,Rr=Go(),Qn=Ko(),zi=new Map,Wi=new Map,Ft=jo($a(e.projectId)),Jn=new Map,nn=new Map,Vn=new Map,Li=new Set,an=new Map,Xe,Rl=1,Ol=1,gr,bn,si={x:0,y:0},$r,$t=[],wn=[],Be=function(r){var o;return(o=mr.get(r))!==null&&o!==void 0?o:O.get(r)},Mt=function(r,o){return e.gameplay.find(function(d){return d.kind===r&&d.componentId===o})},ci=function(){var r,o;vi++,$n.clear(),Kn.clear(),sa.clear(),ca.clear();try{for(var d=q(In),u=d.next();!u.done;u=d.next()){var s=u.value;try{s.stop()}catch{}}}catch(p){r={error:p}}finally{try{u&&!u.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}In.clear(),Ni.clear()},so=function(r){var o,d;if(!Xe||r!==void 0&&Xe.pointerId!==r)return!1;var u=Xe.pointerId;Xe.behavior.parameters.powerVariableId&&(j[Xe.behavior.parameters.powerVariableId]=0),Xe=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,u)&&((d=t.releasePointerCapture)===null||d===void 0||d.call(t,u))}catch{}return!0},ma=function(r){var o=r.behavior.parameters;o.axisXVariableId&&(j[o.axisXVariableId]=r.nx),o.axisYVariableId&&(j[o.axisYVariableId]=r.ny),o.magnitudeVariableId&&(j[o.magnitudeVariableId]=r.magnitude),o.angleVariableId&&r.magnitude>0&&(j[o.angleVariableId]=r.angle)},ga=function(r,o){var d,u,s,p;o===void 0&&(o=!1);try{for(var h=q(an.values()),g=h.next();!g.done;g=h.next()){var I=g.value;if(!(I.pointerId===null||r!==void 0&&I.pointerId!==r)){var S=I.pointerId;I.pointerId=null,I.nx=0,I.ny=0,I.magnitude=0,I.knobX=I.origin.x,I.knobY=I.origin.y,ma(I);try{!((s=t.hasPointerCapture)===null||s===void 0)&&s.call(t,S)&&((p=t.releasePointerCapture)===null||p===void 0||p.call(t,S))}catch{}o&&rr(dt("joystickEnd",I.c))}}}catch(m){d={error:m}}finally{try{g&&!g.done&&(u=h.return)&&u.call(h)}finally{if(d)throw d.error}}},Di=function(r,o){var d,u;if(o===void 0&&(o=!0),!Ze||r!==void 0&&Ze.pointerId!==r)return!1;var s=Ze,p=s.pointerId;if(Ze=void 0,bn=void 0,o){var h=Be(s.targetId);h&&s.b.parameters.snapBack&&(Qt(h,s.origin.x,s.origin.y),s.originZone&&Rr.place(h.id,s.originZone))}try{!((d=t.hasPointerCapture)===null||d===void 0)&&d.call(t,p)&&((u=t.releasePointerCapture)===null||u===void 0||u.call(t,p))}catch{}return!0},Ia=function(r){var o,d;(bt==null?void 0:bt.pointerId)===r.pointerId&&(bt=void 0);try{for(var u=q(xn.values()),s=u.next();!s.done;s=u.next()){var p=s.value;p.pointerId===r.pointerId&&p.held&&(p.held=!1,p.releasedAt=se)}}catch(g){o={error:g}}finally{try{s&&!s.done&&(d=u.return)&&d.call(u)}finally{if(o)throw o.error}}var h=Di(r.pointerId);return At===r.pointerId?(tt=void 0,At=void 0,!0):h},Hi=function(r){var o,d,u,s,p,h,g,I;if(r){Ze&&((g=mr.get(Ze.targetId))===null||g===void 0?void 0:g.instanceId)===r&&Di(void 0,!1),Xe&&((I=mr.get(Xe.targetId))===null||I===void 0?void 0:I.instanceId)===r&&so();var S=[];Rr.release(r),Qn.cancel(r),Jn.delete(r),Vn.delete(r),Ft.remove(r),ye=ye.filter(function(H){return H.id!==r});try{for(var m=q(mr),C=m.next();!C.done;C=m.next()){var w=$(C.value,2),P=w[0],x=w[1];if(x.instanceId===r){S.push(P),Rr.release(P),Qn.cancel(P),mr.delete(P),Qe.delete(P),ui.delete(P),Ot.delete(P),Rn.delete(P),On.delete(P);try{for(var T=(u=void 0,q(Zt.values())),A=T.next();!A.done;A=T.next()){var N=A.value;N.removeAgent(P)}}catch(H){u={error:H}}finally{try{A&&!A.done&&(s=T.return)&&s.call(T)}finally{if(u)throw u.error}}try{for(var W=(p=void 0,q(An.keys())),D=W.next();!D.done;D=W.next()){var V=D.value;V.endsWith(":"+P)&&An.delete(V)}}catch(H){p={error:H}}finally{try{D&&!D.done&&(h=W.return)&&h.call(W)}finally{if(p)throw p.error}}}}}catch(H){o={error:H}}finally{try{C&&!C.done&&(d=m.return)&&d.call(m)}finally{if(o)throw o.error}}Ie=Ie.filter(function(H){return!S.includes(H.targetId)})}},qn=function(r){for(;r;){if(r.prototype)return r.id;r=Be(r.parentId)}},Vl=function(){var r,o,d;return{viewport:R(),components:Object.fromEntries(ie([],$(Qe),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,ge(ge({},h),{parameters:ge({},h.parameters)})]})),mode:k?"edit":"play",scene:Q,variables:ge({},j),time:se,instances:ye.map(function(u){return ge({id:u.id,prototypeId:u.prototypeId,x:u.transform[4],y:u.transform[5]},Ft.snapshot(u.id))}),particles:le.length,animations:Ie.length,contacts:ve.size,spriteFrames:Object.fromEntries(ie([],$(ui),!1).map(function(u){var s,p=$(u,2),h=p[0],g=p[1];return[h,(s=g.frame)!==null&&s!==void 0?s:0]})),input:{dragging:!!Ze,pointerId:(o=(r=Ze==null?void 0:Ze.pointerId)!==null&&r!==void 0?r:gr==null?void 0:gr.pointerId)!==null&&o!==void 0?o:null,pressed:tt!=null?tt:null,holding:!!(gr!=null&&gr.holds.length),occupancy:Rr.snapshot(),joysticks:Object.fromEntries(ie([],$(an),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,{active:h.pointerId!==null,x:h.nx,y:h.ny,magnitude:h.magnitude,angle:h.angle}]}))},feedback:{presses:xn.size,floatingTexts:lt.length,flashes:yt.length,shaking:!!Ar,tutorialHands:fi},match:{boards:Object.fromEntries(ie([],$(wt),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,h.snapshot()]})),selected:Fr!=null?Fr:null,cells:ie([],$(Ht),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return ge({id:p},h)})},physics:Hl(),paths:Object.fromEntries(ie([],$(Zt),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,h.snapshot()]})),canvas:{masks:Object.fromEntries(ie([],$(Jn),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,{progress:h.progress}]})),strokes:Object.fromEntries(ie([],$(nn),!1).map(function(u){var s=$(u,2),p=s[0],h=s[1];return[p,h.strokes.length]})),walls:$t.length,joints:wn.filter(function(u){return!u.broken}).length},audio:{state:(d=Ke==null?void 0:Ke.state)!==null&&d!==void 0?d:"locked",voices:In.size,blocked:ha},network:{target:_,ready:di,visible:Zn,started:gn,closed:Tn,hostVolume:ya},diagnostics:ie([],$(pn),!1)}},jn=function(){return!k&&!Pr&&!document.hidden&&di&&Zn&&gn&&!Tn},Kt=function(){var r,o,d,u;bt=void 0,so(),ga(),Di(),gr=void 0,bn=void 0,$r=void 0;try{for(var s=q(nn.values()),p=s.next();!p.done;p=s.next()){var h=p.value;h.cancel()}}catch(m){r={error:m}}finally{try{p&&!p.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}Qn.clear(),nt=void 0;try{for(var g=q(wt.values()),I=g.next();!I.done;I=g.next()){var S=I.value;S.cancelSelection()}}catch(m){d={error:m}}finally{try{I&&!I.done&&(u=g.return)&&u.call(g)}finally{if(d)throw d.error}}wt.size&&(Fr=void 0),tt=void 0,At=void 0,xn.clear()},ft=function(r){Tr=!0,pn.push(r),pn=pn.slice(-16),X=[]},Fe=function(r){var o,d,u;return ge(ge(ge({},r.parameters),r.prototypeId?(o=Qe.get(r.prototypeId))===null||o===void 0?void 0:o.parameters:{}),(u=Qe.get((d=r.runtimeId)!==null&&d!==void 0?d:r.id))===null||u===void 0?void 0:u.parameters)};function xa(r,o){var d,u=xn.get(r.id);if(!u||Z!=null&&Z.matches)return o;var s=ie([],$(o),!1),p=u.held?0:se-((d=u.releasedAt)!==null&&d!==void 0?d:se),h=u.held?0:Math.min(1,p/u.behavior.springBackSeconds),g=u.held?u.behavior.scaleDown:u.behavior.scaleDown+(1-u.behavior.scaleDown)*(1-Math.pow(1-h,3)),I=Fe(r);s[4]+=(1-g)*(s[0]*I.width+s[2]*I.height)/2,s[5]+=(1-g)*(s[1]*I.width+s[3]*I.height)/2;for(var S=0;S<4;S++)s[S]*=g;return s}function Fi(r){return{left:0,top:0,right:r.width,bottom:r.height,width:r.width,height:r.height}}function St(r){var o,d,u,s,p,h,g,I=r.transform,S=(u=(d=Qe.get((o=r.runtimeId)!==null&&o!==void 0?o:r.id))===null||d===void 0?void 0:d.transform)!==null&&u!==void 0?u:I,m=Le.get((s=r.prototypeId)!==null&&s!==void 0?s:r.id);if(!m)return xa(r,S);var C=R(),w=ie([],$(S),!1);C.landscape&&(w[4]+=m.x-I[4],w[5]+=m.y-I[5],w[0]*=m.scaleX,w[1]*=m.scaleX,w[2]*=m.scaleY,w[3]*=m.scaleY);var P=(p=m.anchor)!==null&&p!==void 0?p:"none";if(P==="none"&&!m.respectSafeArea)return xa(r,w);var x=Fi(C),T=m.respectSafeArea?lo(x):x,A=Fe(r),N=(h=m.marginX)!==null&&h!==void 0?h:0,W=(g=m.marginY)!==null&&g!==void 0?g:0,D=Math.abs(w[0])*A.width+Math.abs(w[2])*A.height,V=Math.abs(w[1])*A.width+Math.abs(w[3])*A.height;return P!=="none"?(w[4]=P.endsWith("left")?T.left+N:P.endsWith("right")?T.right-D-N:(T.left+T.right-D)/2,w[5]=P.startsWith("top")?T.top+W:P.startsWith("bottom")?T.bottom-V-W:(T.top+T.bottom-V)/2):(w[4]=Math.max(T.left+N,Math.min(T.right-D-N,w[4])),w[5]=Math.max(T.top+W,Math.min(T.bottom-V-W,w[5]))),xa(r,w)}var Xi=function(r){return(mr.has(r)?ie([],$(mr.values()),!1):ie(ie([],$(e.components),!1),$(ye),!1)).filter(function(o){return o.parentId===r&&!o.prototype}).sort(function(o,d){return o.order-d.order||(o.id<d.id?-1:o.id>d.id?1:0)})},co=function(){return e.components.filter(function(r){return r.sceneId===Q&&!r.parentId&&!r.prototype}).sort(function(r,o){return r.order-o.order||(r.id<o.id?-1:r.id>o.id?1:0)})},rr=function(r){var o,d;if(r.kind==="sceneEnter"&&((o=e.scenes.find(function(u){return u.id===r.sceneId}))===null||o===void 0?void 0:o.role)==="end-card"&&pa!==r.sceneId&&(pa=r.sceneId,(d=ee==null?void 0:ee.notifyGameEnd)===null||d===void 0||d.call(ee)),X.length>=256){ft("Event queue budget exhausted");return}X.push(r)},dt=function(r,o,d,u){var s,p,h,g;return u===void 0&&(u={}),ge(ge({kind:r,componentId:(s=o.prototypeId)!==null&&s!==void 0?s:o.id,selfInstanceId:(p=o.instanceId)!==null&&p!==void 0?p:o.id,instanceId:o.instanceId},d?{otherId:(h=d.prototypeId)!==null&&h!==void 0?h:d.id,otherInstanceId:(g=d.instanceId)!==null&&g!==void 0?g:d.id}:{}),u)};function ba(r){for(var o,d=r;d;d=Be(d.parentId)){var u=Ft.states.get((o=d.instanceId)!==null&&o!==void 0?o:d.id);if(u)return u}}function ho(r){var o,d,u=Mt("instance-state",(o=r.prototypeId)!==null&&o!==void 0?o:r.id);return u?Ft.initialize((d=r.instanceId)!==null&&d!==void 0?d:r.id,u.parameters):void 0}function Nl(){var r,o,d,u;try{for(var s=q(e.gameplay.filter(function(m){return m.kind==="instance-state"})),p=s.next();!p.done;p=s.next()){var h=p.value;try{for(var g=(d=void 0,q(Xr(O.get(h.componentId)))),I=g.next();!I.done;I=g.next()){var S=I.value;ho(S)}}catch(m){d={error:m}}finally{try{I&&!I.done&&(u=g.return)&&u.call(g)}finally{if(d)throw d.error}}}}catch(m){r={error:m}}finally{try{p&&!p.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}function Bl(r,o,d,u){var s=ba(r);if(s){var p=s.hp;if(o==="tag")s.tag=d==="set"?String(u):s.tag;else{var h=Number(u);if(s[o]=d==="add"?s[o]+h:d==="sub"?s[o]-h:h,!Number.isFinite(s[o])){ft("Instance state range exceeded");return}o==="hp"&&(s.hp=Math.max(0,Math.min(s.maxHp,s.hp)))}p>0&&s.hp<=0&&rr(dt("instanceDepleted",r))}}function Ui(r,o){var d,u,s;if(!r)return!0;if(r.all)return r.all.every(function(S){return Ui(S,o)});if(r.any)return r.any.some(function(S){return Ui(S,o)});var p=r.instanceTarget==="other"?o==null?void 0:o.otherInstanceId:(d=o==null?void 0:o.selfInstanceId)!==null&&d!==void 0?d:o==null?void 0:o.instanceId,h=r.instanceField?(u=Be(p))!==null&&u!==void 0?u:ie([],$(mr.values()),!1).find(function(S){return S.instanceId===p}):void 0,g=r.instanceField?(s=ba(h))===null||s===void 0?void 0:s[r.instanceField]:j[r.variableId],I=r.compareVariableId?j[r.compareVariableId]:r.value;return{eq:function(){return g===I},ne:function(){return g!==I},lt:function(){return g<I},lte:function(){return g<=I},gt:function(){return g>I},gte:function(){return g>=I}}[r.op]()}function yo(r){var o,d,u;Fr=void 0,nt=void 0,r||Ht.clear();try{for(var s=q(e.gameplay),p=s.next();!p.done;p=s.next()){var h=p.value;if(h.kind==="match-tile"){var g=O.get(h.componentId);if(r&&g.id!==r&&!kt(g,r))continue;Qe.delete(g.id),Ht.set(g.id,{row:h.parameters.row,column:h.parameters.column,group:h.parameters.group,sceneId:g.sceneId,boardId:(u=g.parentId)!==null&&u!==void 0?u:g.sceneId})}}}catch(I){o={error:I}}finally{try{p&&!p.done&&(d=s.return)&&d.call(s)}finally{if(o)throw o.error}}}function zl(){var r,o,d=function(h){var g,I;if(wt.has(h.componentId))return"continue";var S=h.componentId,m=h.parameters,C=e.gameplay.filter(function(V){return V.kind==="match-tile"&&O.get(V.componentId).parentId===S}).sort(function(V,H){return V.parameters.row-H.parameters.row||V.parameters.column-H.parameters.column}).map(function(V){return ge({id:V.componentId},V.parameters)}),w=new Map;try{for(var P=(g=void 0,q(C)),x=P.next();!x.done;x=P.next()){var T=x.value;if(!w.has(T.group)){var A=O.get(T.id);w.set(T.group,{fill:A.parameters.fill,children:Xi(T.id).filter(function(V){return["native.image.v1","native.text.v1"].includes(V.contract)})})}}}catch(V){g={error:V}}finally{try{x&&!x.done&&(I=P.return)&&I.call(P)}finally{if(g)throw g.error}}vo.set(S,w);var N=O.get(C[m.columns].id).transform[5]-O.get(C[0].id).transform[5],W=function(V,H,G){var F,te=G.from,de=te===void 0?V:te,ne=G.progress,pe=ne===void 0?0:ne,Ce=G.offsetRows,We=Ce===void 0?0:Ce,De=G.scale,me=De===void 0?1:De,xe=G.opacity,we=xe===void 0?1:xe,Te=C[V],Oe=O.get(Te.id),ce=O.get(C[de].id),yr=w.get(H),Ae=ie([],$(Oe.transform),!1);Ae[4]+=(ce.transform[4]-Oe.transform[4])*pe,Ae[5]+=(ce.transform[5]-Oe.transform[5]+We*N)*pe,Ae[4]+=(1-me)*(Ae[0]*Oe.parameters.width+Ae[2]*Oe.parameters.height)/2,Ae[5]+=(1-me)*(Ae[1]*Oe.parameters.width+Ae[3]*Oe.parameters.height)/2;for(var fr=0;fr<4;fr++)Ae[fr]*=me;Qe.set(Te.id,ge(ge({},Qe.get(Te.id)),{transform:Ae,parameters:ge(ge({},(F=Qe.get(Te.id))===null||F===void 0?void 0:F.parameters),{fill:yr.fill,opacity:we})})),Ht.get(Te.id).group=H;var Me=Xi(Te.id).filter(function(nr){return["native.image.v1","native.text.v1"].includes(nr.contract)});Me.forEach(function(nr,Ge){var Je,kr,ir=yr.children[Ge];if(!(!ir||ir.contract!==nr.contract)){var _e=(Je=Qe.get(nr.id))!==null&&Je!==void 0?Je:{transform:ie([],$(nr.transform),!1),parameters:{}};nr.contract==="native.image.v1"?_e.assetId=(kr=ir.assetSlots[0])===null||kr===void 0?void 0:kr.assetId:_e.parameters.text=ir.parameters.text,Qe.set(nr.id,_e)}})},D=Xo(ge(ge({},m),{slots:C,paint:W,onEvent:function(V){Fr=void 0,rr({kind:V,componentId:S})}}));wt.set(S,D)};try{for(var u=q(e.gameplay.filter(function(h){return h.kind==="match-board"})),s=u.next();!s.done;s=u.next()){var p=s.value;d(p)}}catch(h){r={error:h}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}function po(r){var o,d;zl();try{for(var u=q(wt),s=u.next();!s.done;s=u.next()){var p=$(s.value,2),h=p[0],g=p[1];(!r||r===h||kt(O.get(h),r))&&g.reset()}}catch(I){o={error:I}}finally{try{s&&!s.done&&(d=u.return)&&d.call(u)}finally{if(o)throw o.error}}}function Xr(r){return qn(r)?ie([],$(mr.values()),!1).filter(function(o){return o.prototypeId===r.id}):[r]}function Or(r){var o=Fe(r);return vr(hr(r),o.width/2,o.height/2)}function Nn(r,o,d){var u;d===void 0&&(d="self");var s=O.get(r),p=d==="other"?o.otherInstanceId:(u=o.selfInstanceId)!==null&&u!==void 0?u:o.instanceId,h=!!(s&&qn(s));if(p!==void 0){if(r){var g=ie([],$(mr.values()),!1).find(function(I){return I.prototypeId===r&&(I.instanceId===p||I.id===p)});if(g)return g}if(d==="other"||!r)return Be(p);if(h&&typeof p=="string"&&p.startsWith("instance."))return}return s?h?Xr(s)[0]:Be(r):void 0}function Qt(r,o,d){var u,s=Fe(r),p=(u=Qe.get(r.id))!==null&&u!==void 0?u:{transform:ie([],$(r.transform),!1),parameters:{}},h=ie([],$(p.transform),!1),g=r.parentId?hr(Be(r.parentId)):jt(),I=vr(Yt(g),o,d);h[4]=I.x-(h[0]*s.width+h[2]*s.height)/2,h[5]=I.y-(h[1]*s.width+h[3]*s.height)/2,Qe.set(r.id,ge(ge({},p),{transform:h})),r.prototypeId&&(r.transform=ie([],$(h),!1))}function _n(r,o,d){var u,s,p,h;d===void 0&&(d=!1);var g=(u=Qe.get(r.id))!==null&&u!==void 0?u:{transform:ie([],$(r.transform),!1),parameters:{}},I=(h=(p=O.get((s=r.prototypeId)!==null&&s!==void 0?s:r.id))===null||p===void 0?void 0:p.transform)!==null&&h!==void 0?h:r.transform,S=Math.hypot(I[0],I[1])*(d?-1:1),m=Math.hypot(I[2],I[3]),C=o+(d?0:Math.atan2(I[1],I[0])),w=Math.cos(C),P=Math.sin(C),x=ie([],$(g.transform),!1);x[0]=w*S,x[1]=P*S,x[2]=-P*m,x[3]=w*m,Qe.set(r.id,ge(ge({},g),{transform:x}))}function Bn(r,o){var d=Ot.get(r.id);if(d)return d;var u=hr(r),s=Fe(r),p=vr(u,s.width/2,s.height/2);return d=ge({id:r.id,sourceId:o.componentId,instanceId:r.instanceId,x:p.x,y:p.y,vx:0,vy:0,width:Math.hypot(u[0],u[1])*s.width,height:Math.hypot(u[2],u[3])*s.height,angle:Math.atan2(u[1],u[0]),restElapsed:0,atRest:!0},o.parameters),Ot.set(r.id,d),d}function hi(r,o){var d,u=Jn.get(r.id);if(u)return u;var s=Fe(r),p=o.parameters;return u=_o(p,{width:s.width,height:s.height,source:r.contract==="native.image.v1"?Pe.get((d=r.assetSlots[0])===null||d===void 0?void 0:d.assetId):void 0,onProgress:function(h){p.progressVariableId&&(j[p.progressVariableId]=h),rr(dt("maskProgress",r))},onComplete:function(){return rr(dt("maskComplete",r))}}),Jn.set(r.id,u),u}function Wl(r){var o=nn.get(r.componentId);return o||(o=tl(r.parameters),nn.set(r.componentId,o)),o}function mo(){var r,o,d,u,s,p,h,g,I,S,m,C,w=new Set,P=[];try{for(var x=q(e.gameplay.filter(function(Ae){return Ae.kind==="physics-body"})),T=x.next();!T.done;T=x.next()){var A=T.value,N=O.get(A.componentId);if(N.sceneId===Q)try{for(var W=(d=void 0,q(Xr(N))),D=W.next();!D.done;D=W.next()){var V=D.value;if(Sr(V)){if(P.length>=64){ft("Physics body budget exhausted");break}var H=Bn(V,A),G=hr(V),F=Fe(V),te=vr(G,F.width/2,F.height/2);if(w.add(V.id),H.width=Math.hypot(G[0],G[1])*F.width,H.height=Math.hypot(G[2],G[3])*F.height,H.mode!=="dynamic"){var de=Rn.get(V.id),ne=V.parentId?hr(Be(V.parentId)):jt(),pe=(m=de==null?void 0:de.vx)!==null&&m!==void 0?m:0,Ce=(C=de==null?void 0:de.vy)!==null&&C!==void 0?C:0;H.x=te.x,H.y=te.y,H.angle=Math.atan2(G[1],G[0]),H.vx=ne[0]*pe+ne[2]*Ce,H.vy=ne[1]*pe+ne[3]*Ce}else H.atRest&&(H.x=te.x,H.y=te.y);P.push(H)}}}catch(Ae){d={error:Ae}}finally{try{D&&!D.done&&(u=W.return)&&u.call(W)}finally{if(d)throw d.error}}}}catch(Ae){r={error:Ae}}finally{try{T&&!T.done&&(o=x.return)&&o.call(x)}finally{if(r)throw r.error}}try{for(var We=q(Ot.keys()),De=We.next();!De.done;De=We.next()){var me=De.value;!w.has(me)&&!mr.has(me)&&Ot.delete(me)}}catch(Ae){s={error:Ae}}finally{try{De&&!De.done&&(p=We.return)&&p.call(We)}finally{if(s)throw s.error}}var xe=[];try{for(var we=q(e.gameplay.filter(function(Ae){return Ae.kind==="capture-zone"})),Te=we.next();!Te.done;Te=we.next()){var A=Te.value,N=O.get(A.componentId);if(N.sceneId===Q)try{for(var Oe=(I=void 0,q(Xr(N))),ce=Oe.next();!ce.done;ce=Oe.next()){var V=ce.value;if(Sr(V)){var G=hr(V),F=Fe(V),te=vr(G,F.width/2,F.height/2),yr=Math.max(.1,Math.min(Math.hypot(G[0],G[1]),Math.hypot(G[2],G[3])));xe.push(ge(ge({id:V.id,sourceId:N.id,instanceId:V.instanceId,x:te.x,y:te.y},A.parameters),{radius:A.parameters.radius*yr}))}}}catch(Me){I={error:Me}}finally{try{ce&&!ce.done&&(S=Oe.return)&&S.call(Oe)}finally{if(I)throw I.error}}}}catch(Ae){h={error:Ae}}finally{try{Te&&!Te.done&&(g=we.return)&&g.call(we)}finally{if(h)throw h.error}}return{bodies:ie(ie([],$(P),!1),$($t),!1),zones:xe}}function Ll(r){var o,d,u,s,p,h,g,I=mo(),S=I.bodies,m=I.zones,C=R();wn=[];try{for(var w=q(e.gameplay.filter(function(ne){return ne.kind==="physics-joint"})),P=w.next();!P.done;P=w.next()){var x=P.value,T=O.get(x.componentId);if(T.sceneId===Q){var A=Be(x.parameters.anchorComponentId),N=Mt("physics-body",T.id);if(!(!A||!N))try{for(var W=(u=void 0,q(Xr(T))),D=W.next();!D.done;D=W.next()){var V=D.value;Bn(V,N);var H=Or(A),G=x.id+":"+V.id;wn.push(ge(ge({},x.parameters),{id:x.id,key:G,componentId:T.id,bodyId:V.id,anchorId:A.id,x:H.x,y:H.y,broken:Li.has(G)}))}}catch(ne){u={error:ne}}finally{try{D&&!D.done&&(s=W.return)&&s.call(W)}finally{if(u)throw u.error}}}}}catch(ne){o={error:ne}}finally{try{P&&!P.done&&(d=w.return)&&d.call(w)}finally{if(o)throw o.error}}Ja({bodies:S,zones:m,joints:wn,bounds:{left:0,top:0,right:C.width,bottom:C.height},dt:r,onEvent:function(ne,pe,Ce){var We,De,me,xe;if(!(ne==="bodyBounce"&&Ce&&pe.sourceId===Ce.sourceId&&pe.id>Ce.id)){var we=(We=pe.instanceId)!==null&&We!==void 0?We:pe.id,Te=Ce?(De=Ce.instanceId)!==null&&De!==void 0?De:Ce.id:void 0,Oe=ge(ge({kind:ne,componentId:pe.sourceId,selfInstanceId:we},Te?{otherInstanceId:Te}:{}),{instanceId:(me=pe.instanceId)!==null&&me!==void 0?me:Ce==null?void 0:Ce.instanceId});if(Ce&&(Oe.otherId=Ce.sourceId),rr(Oe),ne==="zoneCapture"){var ce=Be(pe.id),yr=O.get(Ce.sourceId);if(Ce.hideCaptured&&ce){var Ae=(xe=Qe.get(ce.id))!==null&&xe!==void 0?xe:{transform:ie([],$(ce.transform),!1),parameters:{}};Ae.parameters.visible=!1,Qe.set(ce.id,Ae)}Ce.stopBody&&yr&&ce&&Qt(ce,Ce.x,Ce.y)}}}});try{for(var F=q(S),te=F.next();!te.done;te=F.next()){var de=te.value,V=Be(de.id);!V||de.mode!=="dynamic"||(de.spinToRotation&&_n(V,(g=de.angle)!==null&&g!==void 0?g:0),Qt(V,de.x,de.y))}}catch(ne){p={error:ne}}finally{try{te&&!te.done&&(h=F.return)&&h.call(F)}finally{if(p)throw p.error}}}function Dl(){var r,o,d,u,s;try{for(var p=q(e.gameplay.filter(function(D){return D.kind==="oscillate"})),h=p.next();!h.done;h=p.next()){var g=h.value,I=O.get(g.componentId);if(I.sceneId===Q)try{for(var S=(d=void 0,q(Xr(I))),m=S.next();!m.done;m=S.next()){var C=m.value,w=Rn.get(C.id);w||(w={base:ie([],$(St(C)),!1),vx:0,vy:0},Rn.set(C.id,w));var P=g.parameters,x=(se/P.periodSeconds+P.phase)*Math.PI*2,T=Math.sin(x)*P.amplitude,A=Math.cos(x)*P.amplitude*Math.PI*2/P.periodSeconds,N=(s=Qe.get(C.id))!==null&&s!==void 0?s:{parameters:{}},W=ie([],$(w.base),!1);P.axis==="x"?(W[4]+=T,w.vx=A,w.vy=0):(W[5]+=T,w.vy=A,w.vx=0),Qe.set(C.id,ge(ge({},N),{transform:W})),Rn.set(C.id,w)}}catch(D){d={error:D}}finally{try{m&&!m.done&&(u=S.return)&&u.call(S)}finally{if(d)throw d.error}}}}catch(D){r={error:D}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}}function go(){var r,o;Zt.clear();var d=function(h){var g=e.gameplay.filter(function(S){return S.kind==="path-gate"&&S.parameters.networkBehaviorId===h.id}),I=sl({id:h.id,nodes:h.parameters.nodes,edges:h.parameters.edges,gates:g,onEvent:function(S,m){var C,w=Be(m.componentId),P=(C=w==null?void 0:w.prototypeId)!==null&&C!==void 0?C:m.componentId;rr(ge({kind:S,componentId:P,instanceId:w==null?void 0:w.instanceId},m.nodeId?{nodeId:m.nodeId}:{}))}});Zt.set(h.id,I)};try{for(var u=q(e.gameplay.filter(function(h){return h.kind==="path-network"})),s=u.next();!s.done;s=u.next()){var p=s.value;d(p)}}catch(h){r={error:h}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}function Yi(r,o){var d,u,s,p,h,g,I,S,m,C,w,P,x;o===void 0&&(o=!0);var T=0;try{for(var A=q(e.gameplay.filter(function(Ae){return Ae.kind==="path-agent"})),N=A.next();!N.done;N=A.next()){var W=N.value,D=O.get(W.componentId),V=Zt.get(W.parameters.networkBehaviorId);if(!(D.sceneId!==Q||!V))try{for(var H=(s=void 0,q(Xr(D))),G=H.next();!G.done;G=H.next()){var F=G.value;if(++T>64){ft("Path agent budget exhausted");break}var te=V.getAgent(F.id);te||(te=V.addAgent(ge(ge({},W.parameters),{id:F.id,startNode:(w=F.pathStartNode)!==null&&w!==void 0?w:W.parameters.startNode,targetNode:(P=F.pathTargetNode)!==null&&P!==void 0?P:W.parameters.targetNode}))),te.speedMultiplier=Math.max(0,Number(W.parameters.speedMultiplierVariableId?j[W.parameters.speedMultiplierVariableId]:1))}}catch(Ae){s={error:Ae}}finally{try{G&&!G.done&&(p=H.return)&&p.call(H)}finally{if(s)throw s.error}}}}catch(Ae){d={error:Ae}}finally{try{N&&!N.done&&(u=A.return)&&u.call(A)}finally{if(d)throw d.error}}if(o){var de=function(Ae,fr){var Me=e.gameplay.find(function(nr){return nr.id===Ae});O.get(Me.componentId).sceneId===Q&&fr.tick(r)};try{for(var ne=q(Zt),pe=ne.next();!pe.done;pe=ne.next()){var Ce=$(pe.value,2),We=Ce[0],De=Ce[1];de(We,De)}}catch(Ae){h={error:Ae}}finally{try{pe&&!pe.done&&(g=ne.return)&&g.call(ne)}finally{if(h)throw h.error}}}try{for(var me=q(e.gameplay.filter(function(Ae){return Ae.kind==="path-agent"})),xe=me.next();!xe.done;xe=me.next()){var W=xe.value,D=O.get(W.componentId),we=Zt.get(W.parameters.networkBehaviorId);if(!(D.sceneId!==Q||!we))try{for(var Te=(m=void 0,q(Xr(D))),Oe=Te.next();!Oe.done;Oe=Te.next()){var F=Oe.value,te=we.getAgent(F.id);if(te){if(te.orientToPath==="rotate")_n(F,te.heading);else if(te.orientToPath==="flip-x")_n(F,0,te.flipX);else if(te.orientToPath==="iso-4"){var ce=(x=Qe.get(F.id))!==null&&x!==void 0?x:{transform:ie([],$(F.transform),!1),parameters:{}};ce.pathFrame=te.frame,Qe.set(F.id,ce)}var yr=F.parentId?vr(hr(Be(F.parentId)),te.x,te.y):te;Qt(F,yr.x,yr.y)}}}catch(Me){m={error:Me}}finally{try{Oe&&!Oe.done&&(C=Te.return)&&C.call(Te)}finally{if(m)throw m.error}}}}catch(Ae){I={error:Ae}}finally{try{xe&&!xe.done&&(S=me.return)&&S.call(me)}finally{if(I)throw I.error}}}function wa(r){var o,d,u,s,p,h,g,I,S,m,C=new Set;try{for(var w=q(e.gameplay.filter(function(_e){return _e.kind==="value-meter"})),P=w.next();!P.done;P=w.next()){var x=P.value,T=O.get(x.componentId);if(T.sceneId===Q)try{for(var A=(u=void 0,q(Xr(T))),N=A.next();!N.done;N=A.next()){var W=N.value,D=x.parameters,V=D.instanceField?ba(W):void 0,H=D.instanceField==="hp"&&V?V.hp/V.maxHp*(D.max-D.min)+D.min:D.instanceField==="value"&&V?V.value:Number(j[D.variableId]),G=On.get(W.id);G||(G={base:ie([],$(St(W)),!1),value:Number.isFinite(H)?Math.max(D.min,Math.min(D.max,H)):D.min},On.set(W.id,G)),C.add(W.id);var F=Math.max(D.min,Math.min(D.max,H)),te=D.smoothingSeconds?1-Math.exp(-r/D.smoothingSeconds):1;G.value+=((Number.isFinite(F)?F:D.min)-G.value)*te;var de=Math.max(0,Math.min(1,(G.value-D.min)/(D.max-D.min))),ne=ie([],$(G.base),!1),pe=(S=Qe.get(W.id))!==null&&S!==void 0?S:{parameters:{}},Ce=D.axis==="x"?Fe(W).width:Fe(W).height;if(D.axis==="x"?(ne[0]*=de,ne[1]*=de):(ne[2]*=de,ne[3]*=de),D.direction==="negative"){var We=Ce*(1-de);D.axis==="x"?(ne[4]+=G.base[0]*We,ne[5]+=G.base[1]*We):(ne[4]+=G.base[2]*We,ne[5]+=G.base[3]*We)}Qe.set(W.id,ge(ge({},pe),{transform:ne}))}}catch(_e){u={error:_e}}finally{try{N&&!N.done&&(s=A.return)&&s.call(A)}finally{if(u)throw u.error}}}}catch(_e){o={error:_e}}finally{try{P&&!P.done&&(d=w.return)&&d.call(w)}finally{if(o)throw o.error}}try{for(var De=q(On.keys()),me=De.next();!me.done;me=De.next()){var xe=me.value;C.has(xe)||On.delete(xe)}}catch(_e){p={error:_e}}finally{try{me&&!me.done&&(h=De.return)&&h.call(De)}finally{if(p)throw p.error}}try{for(var we=q(e.gameplay.filter(function(_e){return _e.kind==="camera-follow"})),Te=we.next();!Te.done;Te=we.next()){var x=Te.value,Oe=O.get(x.componentId),F=Be(x.parameters.targetId);if(!(Oe.sceneId!==Q||!F)){var ce=Bi.get(Oe.id);ce||(ce={base:ie([],$(Oe.transform),!1),x:x.parameters.minX,y:x.parameters.minY},Bi.set(Oe.id,ce));var yr=function(Cr,qr){for(var jr=[],Yr=Cr;Yr&&Yr.id!==qr.id;Yr=Be(Yr.parentId))jr.unshift(Yr);return jr.reduce(function(Kr,pr){return ai(Kr,St(pr))},jt())},ne=kt(F,Oe.id)?yr(F,Oe):hr(F),D=Fe(F),Ae=vr(ne,D.width/2,D.height/2),fr=R(),Me=x.parameters,nr=Math.max(Me.minX,Me.maxX-fr.width/Me.zoom),Ge=Math.max(Me.minY,Me.maxY-fr.height/Me.zoom),Je=Math.max(Me.minX,Math.min(nr,Ae.x-fr.width/(2*Me.zoom))),kr=Math.max(Me.minY,Math.min(Ge,Ae.y-fr.height/(2*Me.zoom))),te=1-Math.exp(-Me.smoothing*r);ce.x+=(Je-ce.x)*te,ce.y+=(kr-ce.y)*te;var pe=(m=Qe.get(Oe.id))!==null&&m!==void 0?m:{parameters:{}},ir=ie([],$(ce.base),!1);ir[0]*=Me.zoom,ir[1]*=Me.zoom,ir[2]*=Me.zoom,ir[3]*=Me.zoom,ir[4]-=ce.x*Me.zoom,ir[5]-=ce.y*Me.zoom,Qe.set(Oe.id,ge(ge({},pe),{transform:ir}))}}}catch(_e){g={error:_e}}finally{try{Te&&!Te.done&&(I=we.return)&&I.call(we)}finally{if(g)throw g.error}}}function Hl(){return{bodies:ie([],$(Ot.values()),!1).map(function(r){return{id:r.id,sourceId:r.sourceId,x:r.x,y:r.y,vx:r.vx,vy:r.vy,atRest:!!r.atRest,captured:!!r.captured}}),aiming:Xe?{componentId:Xe.sourceId,pointerId:Xe.pointerId,power:Xe.power}:null}}function Ma(){Rt=void 0,pa=void 0,Kt(),an.clear(),Rr.clear(),zi.clear(),Wi.clear(),Ft.reset(),Jn.clear(),nn.clear(),$t=[],wn=[],Vn.clear(),Li.clear(),ae.clear(),lt=[],yt=[],Ar=void 0,tn=0,Oi=!1,fi=0,j=Object.fromEntries(e.variables.map(function(r){return[r.id,r.initial]})),ci(),ha=0,mr.clear(),ui.clear(),Ot.clear(),Rn.clear(),On.clear(),Bi.clear(),Xe=void 0,ye=[],le=[],Ie=[],Qe.clear(),yo(),An.clear(),ve.clear(),Ne.clear(),X=[],se=0,ke=0,$e=0,Tr=!1,Ue=0,Q=e.base.startScene,tt=void 0,At=void 0,Gt=void 0,xt=void 0,k||(Nl(),po(),go(),Yi(0,!1),Ea(),wa(0),rr({kind:"sceneEnter",sceneId:Q}))}function Sa(){var r,o;if(!(!Ke||Ke.state!=="running"||!Kn.size)){var d=ie([],$(Kn.values()),!1);Kn.clear();try{for(var u=q(d),s=u.next();!s.done;s=u.next()){var p=s.value;xo(p)}}catch(h){r={error:h}}finally{try{s&&!s.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}}function yi(r){if(r===void 0&&(r=!1),!Ke)return Promise.resolve(void 0);if(Ke.state==="running")return Promise.resolve().then(Sa),Promise.resolve(Ke);if(!It||r){var o=Ke,d=Promise.resolve().then(function(){return o.resume()}).then(function(){if(o.state==="running")return Sa(),o}).catch(function(){}).finally(function(){It===d&&(It=void 0)});It=d}return It}function ka(){var r,o,d=ie([],$(Ni.values()),!1),u=d.some(function(m){return m.bus==="voice"}),s=d.some(function(m){return m.bus==="stinger"}),p=s?.2:u?.25:1;try{for(var h=q(d),g=h.next();!g.done;g=h.next()){var I=g.value,S=I.volume*ya*(I.bus==="music"?p:1);I.gain.gain.setTargetAtTime?I.gain.gain.setTargetAtTime(S,Ke.currentTime,.04):I.gain.gain.value=S}}catch(m){r={error:m}}finally{try{g&&!g.done&&(o=h.return)&&o.call(h)}finally{if(r)throw r.error}}}function Fl(r,o){if(!o||typeof r.createBuffer!="function"||typeof o.getChannelData!="function"||!o.numberOfChannels)return o;var d=o.sampleRate||44100,u=o.length;if(u<Math.round(d*.2))return o;for(var s=o.numberOfChannels,p=.002,h=u,g=0,I=0;I<s;I++){for(var S=o.getChannelData(I),m=0;m<h;m++)if(Math.abs(S[m])>p){h=m;break}for(var m=u-1;m>g;m--)if(Math.abs(S[m])>p){g=m;break}}if(h>=g)return o;var C=g-h+1;if(C<Math.round(d*.15))return o;var w=Math.min(Math.round(d*.06),Math.floor(C*.1)),P=C-w;if(w<8||P<Math.round(d*.1))return o;for(var x=r.createBuffer(s,P,d),I=0;I<s;I++){for(var T=o.getChannelData(I),A=x.getChannelData(I),m=0;m<w;m++){var N=m/w;A[m]=T[h+m]*Math.sin(N*Math.PI*.5)+T[h+P+m]*Math.cos(N*Math.PI*.5)}for(var m=w;m<P;m++)A[m]=T[h+m]}return x}function Io(r,o,d){var u,s=(u=d.parameters.bus)!==null&&u!==void 0?u:"sfx";r.connect(o),o.connect(Ke.destination),In.add(r),Ni.set(r,{gain:o,bus:s,volume:d.parameters.volume}),r.onended=function(){In.delete(r),Ni.delete(r),d.parameters.loop&&$n.delete(d.id),ka()},ka()}function xo(r){return td(this,void 0,void 0,function(){var o,d,u,s,p,h,g,I,S,m,C,w,P,x,T,A,N,W,D,V,H,G,F,te,de,ne,pe,Ce,We,De,me,xe;return nd(this,function(we){switch(we.label){case 0:return In.size>=32?[2]:(o=!!r.parameters.loop,Ke?(d=Ke,u=vi,s=(ne=r.parameters.cooldownMs)!==null&&ne!==void 0?ne:45,p=d.currentTime,s>0&&p-((pe=sa.get(r.id))!==null&&pe!==void 0?pe:-1/0)<s/1e3?[2]:o&&$n.has(r.id)?[2]:(h=O.get(r.componentId),g=Re.get((Ce=h==null?void 0:h.assetSlots[0])===null||Ce===void 0?void 0:Ce.assetId),I=(g==null?void 0:g.mime)==="audio/wav"||(g==null?void 0:g.mime)==="audio/mpeg",!I&&r.parameters.allowSynthFallback===!1?(ha++,[2]):(sa.set(r.id,p),S=d.state!=="running",S?[4,yi()]:[3,2]))):(o&&Kn.set(r.id,r),[2]));case 1:S=!we.sent(),we.label=2;case 2:if(S)return o&&Kn.set(r.id,r),[2];if(Ke!==d||d.state!=="running"||u!==vi||In.size>=32)return[2];if(m=(We=ca.get(r.id))!==null&&We!==void 0?We:0,C=[0,-.5,.5,-1,1],w=((De=r.parameters.pitchJitter)!==null&&De!==void 0?De:0)*C[m%C.length],P=Number((me=j[r.parameters.pitchVariableId])!==null&&me!==void 0?me:0),x=Math.max(-12,Math.min(12,w+P*((xe=r.parameters.pitchStep)!==null&&xe!==void 0?xe:0))),T=Math.pow(2,x/12),ca.set(r.id,m+1),!I)return[3,8];o&&$n.add(r.id),we.label=3;case 3:if(we.trys.push([3,6,,7]),A=fo.get(g.hash),A)return[3,5];for(N=atob(g.data),W=new Uint8Array(N.length),D=0;D<N.length;D++)W[D]=N.charCodeAt(D);return[4,new Promise(function(Te,Oe){var ce=d.decodeAudioData(W.buffer,Te,Oe);ce&&typeof ce.then=="function"&&ce.then(Te,Oe)})];case 4:A=we.sent(),fo.set(g.hash,A),we.label=5;case 5:return Ke!==d||d.state!=="running"||u!==vi||In.size>=32?(o&&u===vi&&$n.delete(r.id),[2]):(V=A,o&&(V=uo.get(g.hash),V||(V=Fl(d,A),uo.set(g.hash,V))),H=d.createBufferSource(),G=d.createGain(),H.buffer=V,H.loop=o,H.playbackRate&&(H.playbackRate.value=T),o&&G.gain.setValueAtTime&&G.gain.linearRampToValueAtTime?(G.gain.setValueAtTime(1e-4,d.currentTime),G.gain.linearRampToValueAtTime(r.parameters.volume,d.currentTime+.025)):G.gain.value=r.parameters.volume,Io(H,G,r),H.start(),[3,7]);case 6:return F=we.sent(),$n.delete(r.id),ft("Audio decode failed"),[3,7];case 7:return[2];case 8:return te=d.createOscillator(),de=d.createGain(),te.frequency.value=r.parameters.frequency*T,te.type="sine",de.gain.setValueAtTime(r.parameters.volume,d.currentTime),de.gain.exponentialRampToValueAtTime(.001,d.currentTime+r.parameters.seconds),Io(te,de,r),te.start(),te.stop(d.currentTime+r.parameters.seconds),[2]}})})}function Xl(r,o){for(var d=ie([],$(Ht.values()),!1).filter(function(m){return m.boardId===r}),u=function(m,C){var w;return(w=d.find(function(P){return P.row===m&&P.column===C}))===null||w===void 0?void 0:w.group},s=function(m){for(var C=function(x){var T=u(m,x);if(T&&T===u(m,x+1)&&T===u(m,x+2)&&o.some(function(A){return A.row===m&&A.column>=x&&A.column<=x+2}))return{value:!0}},w=0;w<14;w++){var P=C(w);if(typeof P=="object")return P}},p=0;p<16;p++){var h=s(p);if(typeof h=="object")return h.value}for(var g=function(m){for(var C=function(x){var T=u(x,m);if(T&&T===u(x+1,m)&&T===u(x+2,m)&&o.some(function(A){return A.column===m&&A.row>=x&&A.row<=x+2}))return{value:!0}},w=0;w<14;w++){var P=C(w);if(typeof P=="object")return P}},I=0;I<16;I++){var S=g(I);if(typeof S=="object")return S.value}return!1}function Ul(r){var o,d,u,s=Ht.get(r.id);if(!(!s||s.sceneId!==Q||!Fe(r).enabled||!Sr(r))){var p=wt.get(r.parentId);if(p){Fr=p.select(r.id);return}if(Fr===r.id){Fr=void 0;return}var h=Ht.get(Fr);if(!h||h.sceneId!==Q||h.boardId!==s.boardId){Fr=r.id;return}var g=O.get(Fr);if(Math.abs(h.row-s.row)+Math.abs(h.column-s.column)!==1){Fr=r.id;return}if(h.group===s.group){Fr=void 0,rr({kind:"invalidMatch",componentId:(o=r.parentId)!==null&&o!==void 0?o:r.id});return}var I=h.row,S=h.column,m=s.row,C=s.column,w=ie([],$(St(g)),!1),P=ie([],$(St(r)),!1);if(h.row=m,h.column=C,s.row=I,s.column=S,Xl(s.boardId,[h,s])){var x=function(T,A){var N,W=(N=Qe.get(T.id))!==null&&N!==void 0?N:{transform:ie([],$(St(T)),!1),parameters:{}};W.transform=ie([],$(W.transform),!1),W.transform[4]=A[4],W.transform[5]=A[5],Qe.set(T.id,W)};x(g,P),x(r,w),Fr=void 0,rr({kind:"validMatch",componentId:(d=r.parentId)!==null&&d!==void 0?d:r.id})}else h.row=I,h.column=S,s.row=m,s.column=C,Fr=void 0,rr({kind:"invalidMatch",componentId:(u=r.parentId)!==null&&u!==void 0?u:r.id})}}function Ca(r){var o,d,u,s,p=[],h=ut(r,hr(r)),g=Or(r),I=Mt("drag",(u=r.prototypeId)!==null&&u!==void 0?u:r.id),S=function(P){var x,T,A=O.get(P.componentId),N=P.parameters;if(A.sceneId!==Q)return"continue";var W=function(G){if(G.id===r.id||kt(G,r.id)||!Sr(G))return"continue";var F=ut(G,hr(G)),te=Or(G),de=Math.hypot(te.x-g.x,te.y-g.y),ne=N.radiusPx>0?de<=N.radiusPx:h.left<F.right&&h.right>F.left&&h.top<F.bottom&&h.bottom>F.top;if(!ne)return"continue";p.push(ge({id:G.id,c:G,sourceId:A.id,paintOrder:rn.findIndex(function(pe){return pe.c.id===G.id}),distance:de,itemTarget:e.gameplay.some(function(pe){return pe.kind==="drag"&&pe.componentId===A.id})},N))};try{for(var D=(x=void 0,q(Xr(A))),V=D.next();!V.done;V=D.next()){var H=V.value;W(H)}}catch(G){x={error:G}}finally{try{V&&!V.done&&(T=D.return)&&T.call(D)}finally{if(x)throw x.error}}};try{for(var m=q(e.gameplay.filter(function(P){return P.kind==="drop-zone"})),C=m.next();!C.done;C=m.next()){var w=C.value;S(w)}}catch(P){o={error:P}}finally{try{C&&!C.done&&(d=m.return)&&d.call(m)}finally{if(o)throw o.error}}return{zones:p,tag:(s=I==null?void 0:I.parameters.tag)!==null&&s!==void 0?s:""}}function Ea(r){var o,d,u=r?[r]:e.gameplay.filter(function(C){return C.kind==="drag"}).flatMap(function(C){return Xr(O.get(C.componentId))});try{for(var s=q(u),p=s.next();!p.done;p=s.next()){var h=p.value;if(!(!h||!Sr(h)||Rr.zoneOf(h.id))){var g=Ca(h),I=g.zones,S=g.tag,m=ia({itemId:h.id,tag:S,zones:I.filter(function(C){return!C.itemTarget}),occupancy:Rr});(m==null?void 0:m.kind)==="accept"&&Rr.place(h.id,m.zone.id)}}}catch(C){o={error:C}}finally{try{p&&!p.done&&(d=s.return)&&d.call(s)}finally{if(o)throw o.error}}}function zn(r,o,d){d===void 0&&(d=.18),r&&Qn.to(r.id,Or(r),o,d)}function Pa(r,o,d,u){var s,p,h=u!=null?u:d==null?void 0:d.c;rr(ge(ge({},dt(r,o,h,ge({},d?{otherId:d.sourceId}:{}))),{instanceId:(s=o.instanceId)!==null&&s!==void 0?s:(p=d==null?void 0:d.c)===null||p===void 0?void 0:p.instanceId}))}function Yl(r){var o,d,u,s,p,h,g;if(!Ze||Ze.pointerId!==r.pointerId)return!1;var I=Ze,S=Be(I.targetId),m=I.b.parameters;Ze=void 0,bn=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,r.pointerId)&&((d=t.releasePointerCapture)===null||d===void 0||d.call(t,r.pointerId))}catch{}if(!S)return!0;var C=Ca(S),w=C.zones,P=C.tag,x=ia({itemId:S.id,tag:P,zones:w,occupancy:Rr}),T=I.origin,A=I.originZone;if(!x)return Pa("dragReject",S,void 0,void 0),m.snapBack&&(A&&Rr.place(S.id,A),zn(S,T,(u=m.snapBackSeconds)!==null&&u!==void 0?u:.18)),!0;var N=x.zone,W=x.occupantId?Be(x.occupantId):void 0;return x.kind==="reject"?(Pa("dragReject",S,N,W),m.snapBack&&(A&&Rr.place(S.id,A),zn(S,T,(s=m.snapBackSeconds)!==null&&s!==void 0?s:.18)),!0):(x.kind==="accept"?(Rr.place(S.id,N.id),N.snapMode==="center"&&zn(S,Or(N.c),(p=m.snapBackSeconds)!==null&&p!==void 0?p:.18)):x.kind==="swap"&&W&&(Rr.place(S.id,N.id),A?Rr.place(W.id,A):Rr.release(W.id),zn(S,Or(N.c),(h=m.snapBackSeconds)!==null&&h!==void 0?h:.18),zn(W,T,(g=m.snapBackSeconds)!==null&&g!==void 0?g:.18)),Pa("dragDrop",S,N,x.kind==="accept"?N.c:W),!0)}function Gl(r){var o,d,u,s,p;Qn.tick(r,function(x,T){var A=Be(x);A&&Qt(A,T.x,T.y)});try{for(var h=q(ie([],$(Rr.itemZone.keys()),!1)),g=h.next();!g.done;g=h.next()){var I=g.value,S=Be(I);(!S||!Sr(S))&&Rr.release(I)}}catch(x){o={error:x}}finally{try{g&&!g.done&&(d=h.return)&&d.call(h)}finally{if(o)throw o.error}}if(gr)try{for(var m=q(gr.holds),C=m.next();!C.done;C=m.next()){var w=C.value,P=w.charge.tick(r);P!==j[w.behavior.parameters.variableId]&&(j[w.behavior.parameters.variableId]=P,rr({kind:"variableChange",variableId:w.behavior.parameters.variableId,instanceId:w.c.instanceId,selfInstanceId:(p=w.c.instanceId)!==null&&p!==void 0?p:w.c.id}))}}catch(x){u={error:x}}finally{try{C&&!C.done&&(s=m.return)&&s.call(m)}finally{if(u)throw u.error}}}function bo(r,o){var d,u,s,p,h=o.targetMode;if(h==="pointer")return ge({},si);if(h==="component"){var g=Be(o.targetComponentId);return g?Or(g):void 0}if(h==="nearest-team"){var I=Or(r),S=[],m=o.team,C=(s=o.maxRangePx)!==null&&s!==void 0?s:0;try{for(var w=q(Ft.states),P=w.next();!P.done;P=w.next()){var x=$(P.value,2),T=x[0],A=x[1],g=Be(T);g&&Sr(g)&&S.push(ge(ge({id:T},Or(g)),{team:A.team}))}}catch(N){d={error:N}}finally{try{P&&!P.done&&(u=w.return)&&u.call(w)}finally{if(d)throw d.error}}return Jo(I,S,m,C,(p=r.instanceId)!==null&&p!==void 0?p:r.id)}}function Zl(r){var o,d,u,s,p;try{for(var h=q(e.gameplay.filter(function(H){return H.kind==="steer"})),g=h.next();!g.done;g=h.next()){var I=g.value,S=O.get(I.componentId),m=I.parameters;if(S.sceneId===Q)try{for(var C=(u=void 0,q(Xr(S))),w=C.next();!w.done;w=C.next()){var P=w.value;if(Sr(P)){var x=bo(P,m);if(x){var T=Or(P),A=x.x-T.x,N=x.y-T.y;if(!(m.maxRangePx>0&&Math.hypot(A,N)>m.maxRangePx)){var W=Math.atan2(N,A);m.mode==="flee"?W+=Math.PI:m.mode==="orbit"&&(W+=Math.PI/2);var D=(p=Ft.headings.get(P.id))!==null&&p!==void 0?p:W,V=qo(D,W,m.turnRateDegPerSec*Math.PI/180*r);Ft.headings.set(P.id,V),Qt(P,T.x+Math.cos(V)*m.speed*r,T.y+Math.sin(V)*m.speed*r),m.orientToVelocity!==!1&&_n(P,V)}}}}}catch(H){u={error:H}}finally{try{w&&!w.done&&(s=C.return)&&s.call(C)}finally{if(u)throw u.error}}}}catch(H){o={error:H}}finally{try{g&&!g.done&&(d=h.return)&&d.call(h)}finally{if(o)throw o.error}}}function Ta(r,o,d,u){var s;if(ye.length>=128){ft("Instance budget exhausted");return}var p=O.get(r),h=function(m){return 1+e.components.filter(function(C){return C.parentId===m}).reduce(function(C,w){return C+h(w.id)},0)};if(mr.size+h(p.id)>4096){ft("Runtime node budget exhausted");return}var g="instance."+ ++$e;function I(m,C){var w,P,x=m.id===p.id?g:g+":"+m.id,T=ge(ge({},m),{id:x,runtimeId:x,instanceId:g,prototypeId:m.id,prototype:!1,parentId:C,transform:ie([],$(m.transform),!1),spawnTime:se});mr.set(x,T);try{for(var A=q(e.components.filter(function(D){return D.parentId===m.id})),N=A.next();!N.done;N=A.next()){var W=N.value;I(W,x)}}catch(D){w={error:D}}finally{try{N&&!N.done&&(P=A.return)&&P.call(A)}finally{if(w)throw w.error}}return T}var S=I(p,void 0);return S.transform[4]=o,S.transform[5]=d,u&&(S.pathStartNode=u.startNode,S.pathTargetNode=u.targetNode,S.parentId=(s=e.gameplay.find(function(m){return m.id===u.networkBehaviorId}))===null||s===void 0?void 0:s.componentId),ye.push(S),ho(S),Ea(S),u&&Yi(0,!1),S}function $l(r,o,d){var u,s,p,h,g,I,S,m,C,w,P,x,T,A,N,W,D,V,H,G,F,te,de,ne,pe,Ce,We,De,me,xe,we;if(++Wr>1024){ft("Action budget exhausted");return}if(r.kind==="add"||r.kind==="set"){var Te=j[r.variableId],Oe=r.kind==="add"?Te+r.value:r.value;if(typeof Oe=="number"&&(!Number.isFinite(Oe)||Math.abs(Oe)>1e12)){ft("Variable range exceeded");return}j[r.variableId]=Oe,Te!==Oe&&rr({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="setComponent"||r.kind==="setAsset"){var ce=Be(r.componentId);if(!ce)return;var yr=(C=Qe.get(ce.id))!==null&&C!==void 0?C:{transform:ie([],$(ce.transform),!1),parameters:{}};r.kind==="setComponent"?yr.parameters[r.key]=r.valueVariableId?j[r.valueVariableId]:r.value:yr.assetId=r.assetId,Qe.set(ce.id,yr),r.kind==="setComponent"&&r.key==="visible"&&r.value===!1&&(Rr.release(ce.id),Qn.cancel(ce.id))}else if(r.kind==="resetMatch")yo(r.componentId),po(r.componentId);else if(r.kind==="clearStrokes")(w=nn.get(r.componentId))===null||w===void 0||w.clear(),$t=$t.filter(function(ot){return ot.owner!==r.componentId});else if(r.kind==="resetMask"){var ce=Be(r.componentId),Ae=Mt("erase-mask",r.componentId);ce&&Ae&&hi(ce,Ae).reset()}else if(r.kind==="copyMatchAsset"){var fr=(P=wt.get(r.boardId))===null||P===void 0?void 0:P.snapshot().lastMatch,Me=O.get(r.componentId),nr=fr&&((T=(x=vo.get(r.boardId))===null||x===void 0?void 0:x.get(fr.group))===null||T===void 0?void 0:T.children.find(function(ot){return ot.contract==="native.image.v1"}));if(fr&&nr){var Ge=O.get(fr.from),Je=vr(hr(Ge),Ge.parameters.width/2,Ge.parameters.height/2),kr=Me.parentId?hr(O.get(Me.parentId)):jt(),ir=vr(Yt(kr),Je.x,Je.y),_e=(A=Qe.get(Me.id))!==null&&A!==void 0?A:{transform:ie([],$(Me.transform),!1),parameters:{}};_e.transform=ie([],$(_e.transform),!1),_e.transform[4]=ir.x-Me.parameters.width/2,_e.transform[5]=ir.y-Me.parameters.height/2,_e.assetId=(N=nr.assetSlots[0])===null||N===void 0?void 0:N.assetId,Qe.set(Me.id,_e)}}else if(r.kind==="hintMatch")Fr=void 0,(W=wt.get(r.componentId))===null||W===void 0||W.showHint();else if(r.kind==="spawn")Ta(r.prototypeId,r.x,r.y);else if(r.kind==="spawnAt"){var Ur=(r.at==="self"||r.at==="midpoint")&&(o.selfInstanceId!==void 0||o.instanceId!==void 0)?Be((D=o.selfInstanceId)!==null&&D!==void 0?D:o.instanceId):Nn(r.targetComponentId,o,"self"),Vt=(r.at==="other"||r.at==="midpoint")&&o.otherInstanceId!==void 0?Be(o.otherInstanceId):void 0,Me=r.at==="other"?Vt:Ur;if(r.at==="pointer"||(r.at==="midpoint"?Ur&&Vt:Me))for(var Nt=Ur?Or(Ur):void 0,Ct=Vt?Or(Vt):void 0,Je=r.at==="pointer"?si:r.at==="midpoint"?{x:(Nt.x+Ct.x)/2,y:(Nt.y+Ct.y)/2}:Or(Me),Jr=O.get(r.prototypeId),Cr=Math.max(0,Math.min(16,Math.floor(r.countVariableId?Number(j[r.countVariableId]):(V=r.count)!==null&&V!==void 0?V:1))),qr=0;qr<Cr;qr++){var jr=r.jitterX?(Ft.rng.next()*2-1)*r.jitterX:0,Yr=r.jitterY?(Ft.rng.next()*2-1)*r.jitterY:0;Ta(r.prototypeId,Je.x+r.offsetX+jr-Jr.parameters.width/2,Je.y+r.offsetY+Yr-Jr.parameters.height/2)}}else if(r.kind==="random"){var Te=j[r.variableId],Oe=Ft.rng.between(r.min,r.max,r.integer===!0);j[r.variableId]=Oe,Te!==Oe&&rr({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="modifyInstanceState"){var ce=r.target==="component"?Be(r.componentId):Nn(r.componentId,o,r.target);ce&&Bl(ce,r.field,r.op,r.variableId?j[r.variableId]:r.value)}else if(r.kind==="launchToward"){var Ge=O.get(r.componentId),Kr=Xr(Ge),pr=(H=o.selfInstanceId)!==null&&H!==void 0?H:o.instanceId,ce=Ge.prototype?(G=Kr.find(function(xr){return xr.instanceId===pr||xr.id===pr}))!==null&&G!==void 0?G:Kr[Kr.length-1]:(F=Nn(r.componentId,o,"self"))!==null&&F!==void 0?F:Be(r.componentId),Ae=Mt("physics-body",r.componentId),tr=ce&&Bn(ce,Ae);if(!tr)return;var _r=void 0;if(r.targetMode==="angle-variable")_r=Number(j[r.angleVariableId])*Math.PI/180;else{var Me=bo(ce,r);if(!Me)return;var Je=Or(ce);_r=Math.atan2(Me.y-Je.y,Me.x-Je.x)}var at=Number(r.speedVariableId?j[r.speedVariableId]:r.speed);if(!Number.isFinite(at)){ft("Launch speed invalid");return}tr.vx=Math.cos(_r)*at,tr.vy=Math.sin(_r)*at,tr.atRest=!1,tr.restElapsed=0,tr.captured=!1,tr.exited=!1,r.orientToVelocity!==!1&&_n(ce,_r),rr(dt("launch",ce))}else if(r.kind==="moveToComponent"){var He=O.get(r.targetComponentId),ce=Nn(r.componentId,o,(te=r.target)!==null&&te!==void 0?te:"self"),Me=He&&qn(He)?(de=Nn(r.targetComponentId,o,r.target==="other"?"self":"other"))!==null&&de!==void 0?de:Xr(He)[0]:Be(r.targetComponentId);ce&&Me&&zn(ce,Or(Me),r.seconds)}else if(r.kind==="returnToOrigin"){var ce=Nn(r.componentId,o,"self"),ar=ce&&zi.get(ce.id);ce&&ar&&zn(ce,ar,r.seconds)}else if(r.kind==="spawnOnPath")Ta(r.prototypeId,0,0,{startNode:r.startNode,targetNode:r.targetNode,networkBehaviorId:r.networkBehaviorId});else if(["setVelocity","applyImpulse","stopBody"].includes(r.kind)){var Se=O.get(r.componentId),Vr=o.instanceId?ie([],$(mr.values()),!1).filter(function(dr){return dr.instanceId===o.instanceId&&dr.prototypeId===Se.id}):Xr(Se),Ae=Mt("physics-body",Se.id);try{for(var vt=q(Vr),pt=vt.next();!pt.done;pt=vt.next()){var ce=pt.value,tr=Bn(ce,Ae);r.kind==="setVelocity"?(tr.vx=r.vxVariableId?j[r.vxVariableId]:r.vx,tr.vy=r.vyVariableId?j[r.vyVariableId]:r.vy):r.kind==="applyImpulse"?(tr.vx+=r.vxVariableId?j[r.vxVariableId]:r.ix,tr.vy+=r.vyVariableId?j[r.vyVariableId]:r.iy):(tr.vx=0,tr.vy=0,tr.atRest=!0),tr.captured=!1,tr.exited=!1,tr.restElapsed=0,r.kind!=="stopBody"&&(tr.atRest=!1)}}catch(dr){u={error:dr}}finally{try{pt&&!pt.done&&(s=vt.return)&&s.call(vt)}finally{if(u)throw u.error}}}else if(r.kind==="setPosition"){var or=O.get(r.componentId),Vr=o.instanceId?ie([],$(mr.values()),!1).filter(function(Qr){return Qr.instanceId===o.instanceId&&Qr.prototypeId===or.id}):Xr(or),Ae=Mt("physics-body",or.id);try{for(var st=q(Vr),Et=st.next();!Et.done;Et=st.next()){var ce=Et.value,tr=Bn(ce,Ae);tr.x=r.xVariableId?j[r.xVariableId]:r.x,tr.y=r.yVariableId?j[r.yVariableId]:r.y,tr.vx=0,tr.vy=0,tr.captured=!1,tr.exited=!1,tr.atRest=!0,Qt(ce,tr.x,tr.y)}}catch(Qr){p={error:Qr}}finally{try{Et&&!Et.done&&(h=st.return)&&h.call(st)}finally{if(p)throw p.error}}}else if(r.kind==="setPathEdge")(ne=Zt.get(r.behaviorId))===null||ne===void 0||ne.setEdge(r.edgeId,r.enabled,r.cost);else if(r.kind==="setPathGate")(Ce=Zt.get((pe=e.gameplay.find(function(ot){return ot.id===r.behaviorId}))===null||pe===void 0?void 0:pe.parameters.networkBehaviorId))===null||Ce===void 0||Ce.setGate(r.behaviorId,r.mode,r.holdSeconds);else if(r.kind==="setPathTarget"){var Sn=O.get(r.componentId),Ae=Mt("path-agent",Sn.id),ln=Zt.get(Ae.parameters.networkBehaviorId);try{for(var Pt=q(o.instanceId?ie([],$(mr.values()),!1).filter(function(dr){return dr.instanceId===o.instanceId&&dr.prototypeId===Sn.id}):Xr(Sn)),ct=Pt.next();!ct.done;ct=Pt.next()){var ce=ct.value;ce.pathTargetNode=r.targetNode,ln==null||ln.setTarget(ce.id,r.targetNode)}}catch(dr){g={error:dr}}finally{try{ct&&!ct.done&&(I=Pt.return)&&I.call(Pt)}finally{if(g)throw g.error}}}else if(r.kind==="compute"){var Lr=Number(j[r.variableId]),Gr=r.operandVariableId!==void 0?Number(j[r.operandVariableId]):r.value;if(["div","mod"].includes(r.op)&&Gr===0){ft("Division by zero");return}var Oe={add:function(){return Lr+Gr},sub:function(){return Lr-Gr},mul:function(){return Lr*Gr},div:function(){return Gr===0?Lr:Lr/Gr},mod:function(){return Gr===0?Lr:Lr%Gr},min:function(){return Math.min(Lr,Gr)},max:function(){return Math.max(Lr,Gr)},set:function(){return Gr},floor:function(){return Math.floor(Lr)},ceil:function(){return Math.ceil(Lr)},abs:function(){return Math.abs(Lr)},clamp:function(){return Math.max(r.min,Math.min(r.max,Lr))}}[r.op]();if(r.round&&(Oe=Math.round(Oe)),!Number.isFinite(Oe)||Math.abs(Oe)>1e12){ft("Variable range exceeded");return}var Te=j[r.variableId];j[r.variableId]=Oe,Te!==Oe&&rr({kind:"variableChange",variableId:r.variableId,instanceId:o.instanceId})}else if(r.kind==="despawn"){var Ur=(We=o.selfInstanceId)!==null&&We!==void 0?We:o.instanceId;r.target==="other"?Hi(o.otherInstanceId):r.target==="both"?(Hi(Ur),Hi(o.otherInstanceId)):Hi(Ur)}else if(r.kind==="changeScene")r.delaySeconds>0?r.sceneId!==Q&&(Rt!=null||(Rt={sceneId:r.sceneId,at:se+r.delaySeconds})):xt=r.sceneId;else if(r.kind==="restart")(De=ee==null?void 0:ee.notifyGameRetry)===null||De===void 0||De.call(ee),xt="__restart";else if(r.kind==="cameraShake")Z!=null&&Z.matches||(Ar={intensity:r.intensity,seconds:r.seconds,elapsed:0});else if(r.kind==="screenFlash")yt.push({color:r.color,opacity:r.opacity,seconds:r.seconds,elapsed:0}),yt.length>8&&yt.shift();else if(r.kind==="floatingText"){var fn=O.get(r.componentId),Ge=o.instanceId?(me=ie([],$(mr.values()),!1).find(function(Qr){return Qr.instanceId===o.instanceId&&Qr.prototypeId===r.componentId}))!==null&&me!==void 0?me:fn:(xe=Be(r.componentId))!==null&&xe!==void 0?xe:fn,Me=(Ge==null?void 0:Ge.sceneId)===Q?Ge:fn;if(Me){var Je=void 0;if(!Je){var ht=Fe(Me);Je=vr(hr(Me),ht.width/2,ht.height/2)}lt.push({x:Je.x,y:Je.y,text:r.text.replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(xr,br){var Nr;return String((Nr=j[br])!==null&&Nr!==void 0?Nr:"")}),color:r.color,fontSize:r.fontSize,risePx:r.risePx,seconds:r.seconds,elapsed:0}),lt.length>32&<.shift()}}else if(r.kind==="store")o.kind==="click"&&o.pointerId!==void 0&&!bt&&(bt={pointerId:o.pointerId,targetId:o.targetId,condition:d},(we=t.setPointerCapture)===null||we===void 0||we.call(t,o.pointerId));else if(r.behaviorId){var et=e.gameplay.find(function(ot){return ot.id===r.behaviorId});if(r.kind==="playAudio")xo(et);else if(r.kind==="animate"){var Tt=O.get(et.componentId),Vr=qn(Tt)?ie([],$(mr.values()),!1).filter(function(dr){return dr.prototypeId===Tt.id&&(!o.instanceId||dr.instanceId===o.instanceId)}):[Tt],dn=function(dr){var Qr=et.id+":"+dr.id;Ie=Ie.filter(function(br){return br.id!==Qr});var xr=ge({},et.parameters);xr.fromCurrent&&(xr.from=xr.property==="opacity"?Fe(dr).opacity:St(dr)[xr.property==="x"?4:5]),Ie.push(ge(ge({},et),{parameters:xr,id:Qr,behaviorId:et.id,targetId:dr.id,elapsed:0,baseTransform:ie([],$(dr.transform),!1)}))};try{for(var Ir=q(Vr),Ye=Ir.next();!Ye.done;Ye=Ir.next()){var Me=Ye.value;dn(Me)}}catch(dr){S={error:dr}}finally{try{Ye&&!Ye.done&&(m=Ir.return)&&m.call(Ir)}finally{if(S)throw S.error}}}else r.kind==="stopAnimation"?Ie=Ie.filter(function(ot){return ot.behaviorId!==et.id}):r.kind==="emit"&&Kl(et,o)}}function Kl(r,o){var d,u,s,p,h,g=r.parameters,I=g.shape==="pixel-confetti",S=g.shape==="confetti",m=I||S;if(!(m&&(Z!=null&&Z.matches))){if(le.length+g.count>256){ft("Particle budget exhausted");return}if(I&&g.coverage==="screen"){le.push.apply(le,ie([],$(yl(g)),!1));return}if(S&&g.coverage==="screen"){le.push.apply(le,ie([],$(ml(g)),!1));return}for(var C=O.get(r.componentId),w=o.instanceId&&(d=ie([],$(mr.values()),!1).find(function(G){return G.instanceId===o.instanceId&&G.prototypeId===C.id}))!==null&&d!==void 0?d:C,P=St(w),x,T=Be(w.parentId);T;T=Be(T.parentId)){if(m&&T.contract==="native.group.v1"&&Fe(T).clip){x=T.id;break}P=ai(St(T),P)}var A=Fe(w),N=g.origin==="anchor"?vr(P,0,0):m||g.origin==="center"?vr(P,A.width/2,A.height/2):{x:P[4]+w.parameters.width/2,y:P[5]+w.parameters.height/2};if(I){le.push.apply(le,ie([],$(eo(g,N,x)),!1));return}if(S){le.push.apply(le,ie([],$(ro(g,N,x)),!1));return}for(var W=Ka($a(w.id+":"+se.toFixed(3))),D=0;D<g.count;D++){var V=-Math.PI/2+((D+W.next())/g.count-.5)*((u=g.spread)!==null&&u!==void 0?u:360)*Math.PI/180,H=g.speed*W.between(.5,.95);le.push(ge(ge({},N),{vx:Math.cos(V)*H,vy:Math.sin(V)*H,life:(s=g.lifetime)!==null&&s!==void 0?s:.7,gravity:(p=g.gravity)!==null&&p!==void 0?p:250,color:g.color,shape:(h=g.shape)!==null&&h!==void 0?h:"circle"}))}}}function wo(r){var o,d;if(r==="__restart"){Ma();return}if(r!==Q){Rt=void 0;var u=Q;ci(),Q=r,an.clear(),Rr.clear(),zi.clear(),Wi.clear(),Jn.clear(),nn.clear(),$t=[],wn=[],Vn.clear(),Li.clear(),Fr=void 0,ye=[],le=[],lt=[],yt=[],Ar=void 0,Oi=!1,fi=0,mr.clear(),Ot.clear(),Rn.clear(),On.clear(),Bi.clear(),Xe=void 0,go(),X=X.filter(function(g){return g.kind==="variableChange"}),Qe.clear(),nt=void 0;try{for(var s=q(wt.values()),p=s.next();!p.done;p=s.next()){var h=p.value;h.reset()}}catch(g){o={error:g}}finally{try{p&&!p.done&&(d=s.return)&&d.call(s)}finally{if(o)throw o.error}}ve.clear(),Ne.clear(),An.clear(),Ie=[],Kt(),ae.clear(),tt=void 0,At=void 0,Yi(0,!1),Ea(),wa(0),rr({kind:"sceneExit",sceneId:u}),rr({kind:"sceneEnter",sceneId:Q})}}function on(){for(var r=function(){var o,d,u,s,p=X.shift();zr++;var h=function(x){return x===void 0||!!Be(x)||ie([],$(mr.values()),!1).some(function(T){return T.instanceId===x})};if(!h(p.selfInstanceId)||!h(p.otherInstanceId)||["contactBegin","boundaryExit"].includes(p.kind)&&p.instanceId&&!mr.has(p.instanceId))return"continue";try{for(var g=(o=void 0,q(e.eventBindings)),I=g.next();!I.done;I=g.next()){var S=I.value;if(Object.entries(be.get(S.eventId)).every(function(x){var T=$(x,2),A=T[0],N=T[1];return A==="id"||p[A]===N})&&Ui(S.condition,p)){try{for(var m=(u=void 0,q(S.actions)),C=m.next();!C.done;C=m.next()){var w=C.value;if(Wr>=1024||Tr)break;$l(w,p,S.condition)}}catch(x){u={error:x}}finally{try{C&&!C.done&&(s=m.return)&&s.call(m)}finally{if(u)throw u.error}}if(xt)break}}}catch(x){o={error:x}}finally{try{I&&!I.done&&(d=g.return)&&d.call(g)}finally{if(o)throw o.error}}if(xt){var P=xt;xt=void 0,wo(P)}};X.length&&!Tr&&zr<256&&Wr<1024;)r();X.length&&ft("Event/action budget exhausted")}function hr(r){return ai(r.parentId?hr(Be(r.parentId)):jt(),St(r))}var vr=function(r,o,d){return{x:r[0]*o+r[2]*d+r[4],y:r[1]*o+r[3]*d+r[5]}};function ut(r,o){var d=Fe(r),u=[[0,0],[d.width,0],[d.width,d.height],[0,d.height]].map(function(s){var p=$(s,2),h=p[0],g=p[1];return vr(o,h,g)});return{left:Math.min.apply(Math,ie([],$(u.map(function(s){return s.x})),!1)),right:Math.max.apply(Math,ie([],$(u.map(function(s){return s.x})),!1)),top:Math.min.apply(Math,ie([],$(u.map(function(s){return s.y})),!1)),bottom:Math.max.apply(Math,ie([],$(u.map(function(s){return s.y})),!1))}}function Sr(r){return Fe(r).visible&&Fe(r).opacity>0&&(!r.parentId||Sr(Be(r.parentId)))}function Mo(r,o){for(var d=Fe(r),u=hr(r),s=Math.min(d.width,d.height)/2,p=o==="circle"?Array.from({length:32},function(I,S){return vr(u,d.width/2+Math.cos(S*Math.PI/16)*s,d.height/2+Math.sin(S*Math.PI/16)*s)}):[[0,0],[d.width,0],[d.width,d.height],[0,d.height]].map(function(I){var S=$(I,2),m=S[0],C=S[1];return vr(u,m,C)}),h=r.parentId?Be(r.parentId):void 0,g=function(){var I=Fe(h);if(h.contract==="native.group.v1"&&I.clip){for(var S=hr(h),m=[[0,0],[I.width,0],[I.width,I.height],[0,I.height]].map(function(T){var A=$(T,2),N=A[0],W=A[1];return vr(S,N,W)}),C=0,w=0;w<4;w++)C+=m[w].x*m[(w+1)%4].y-m[(w+1)%4].x*m[w].y;for(var P=C>=0?1:-1,x=function(T){var A,N,W=m[T],D=m[(T+1)%4],V=function(We){return P*((D.x-W.x)*(We.y-W.y)-(D.y-W.y)*(We.x-W.x))},H=p;p=[];var G=H[H.length-1],F=V(G);try{for(var te=(A=void 0,q(H)),de=te.next();!de.done;de=te.next()){var ne=de.value,pe=V(ne);if(pe>=0!=F>=0){var Ce=F/(F-pe);p.push({x:G.x+(ne.x-G.x)*Ce,y:G.y+(ne.y-G.y)*Ce})}pe>=0&&p.push(ne),G=ne,F=pe}}catch(We){A={error:We}}finally{try{de&&!de.done&&(N=te.return)&&N.call(te)}finally{if(A)throw A.error}}},w=0;w<4&&p.length;w++)x(w)}h=h.parentId?Be(h.parentId):void 0};h;)g();return p}function Ql(r,o){var d,u,s,p,h,g;if(r.length<3||o.length<3)return!1;try{for(var I=q([r,o]),S=I.next();!S.done;S=I.next())for(var m=S.value,C=0;C<m.length;C++){var w=m[C],P=m[(C+1)%m.length],x=w.y-P.y,T=P.x-w.x,A=1/0,N=-1/0,W=1/0,D=-1/0;try{for(var V=(s=void 0,q(r)),H=V.next();!H.done;H=V.next()){var G=H.value,F=G.x*x+G.y*T;A=Math.min(A,F),N=Math.max(N,F)}}catch(ne){s={error:ne}}finally{try{H&&!H.done&&(p=V.return)&&p.call(V)}finally{if(s)throw s.error}}try{for(var te=(h=void 0,q(o)),de=te.next();!de.done;de=te.next()){var G=de.value,F=G.x*x+G.y*T;W=Math.min(W,F),D=Math.max(D,F)}}catch(ne){h={error:ne}}finally{try{de&&!de.done&&(g=te.return)&&g.call(te)}finally{if(h)throw h.error}}if(N<W||D<A)return!1}}catch(ne){d={error:ne}}finally{try{S&&!S.done&&(u=I.return)&&u.call(I)}finally{if(d)throw d.error}}return!0}function Jl(r){var o,d,u,s,p=R();try{for(var h=q(an.values()),g=h.next();!g.done;g=h.next()){var I=g.value,S=I.behavior.parameters;if(!(!S.moveComponentId||I.magnitude<=0)){var m=Be(S.moveComponentId);if(!(!m||!Sr(m))){var C=(u=S.moveSpeed)!==null&&u!==void 0?u:220,w=Mt("physics-body",(s=m.prototypeId)!==null&&s!==void 0?s:m.id);if(w&&w.parameters.mode==="dynamic"){var P=Bn(m,w);P.vx=I.nx*C,P.vy=I.ny*C,P.atRest=!1,P.restElapsed=0}else{var x=Or(m),T=Fe(m),A=x.x+I.nx*C*r,N=x.y+I.ny*C*r;So(m)||(A=Math.max(T.width/2,Math.min(p.width-T.width/2,A)),N=Math.max(T.height/2,Math.min(p.height-T.height/2,N))),Qt(m,A,N)}S.orientToMove&&_n(m,Math.atan2(I.ny,I.nx))}}}}catch(W){o={error:W}}finally{try{g&&!g.done&&(d=h.return)&&d.call(h)}finally{if(o)throw o.error}}}function ql(r){var o,d,u,s,p,h,g,I,S,m,C,w,P,x,T,A,N,W,D,V,H,G,F,te,de,ne,pe,Ce,We,De,me,xe,we=R();se+=r,Rt&&se>=Rt.at&&wo(Rt.sceneId),sf(r),Gl(r),Jl(r),Zl(r),Dl();try{for(var Te=q(xn),Oe=Te.next();!Oe.done;Oe=Te.next()){var ce=$(Oe.value,2),yr=ce[0],Ae=ce[1];!Ae.held&&se-((F=Ae.releasedAt)!==null&&F!==void 0?F:se)>=Ae.behavior.springBackSeconds&&xn.delete(yr)}}catch(Ve){o={error:Ve}}finally{try{Oe&&!Oe.done&&(d=Te.return)&&d.call(Te)}finally{if(o)throw o.error}}Ar&&(Ar.elapsed+=r,Ar.elapsed>=Ar.seconds&&(Ar=void 0));try{for(var fr=q(yt),Me=fr.next();!Me.done;Me=fr.next()){var nr=Me.value;nr.elapsed+=r}}catch(Ve){u={error:Ve}}finally{try{Me&&!Me.done&&(s=fr.return)&&s.call(fr)}finally{if(u)throw u.error}}yt=yt.filter(function(Ve){return Ve.elapsed<Ve.seconds});try{for(var Ge=q(lt),Je=Ge.next();!Je.done;Je=Ge.next()){var kr=Je.value;kr.elapsed+=r}}catch(Ve){p={error:Ve}}finally{try{Je&&!Je.done&&(h=Ge.return)&&h.call(Ge)}finally{if(p)throw p.error}}lt=lt.filter(function(Ve){return Ve.elapsed<Ve.seconds});try{for(var ir=q(wt),_e=ir.next();!_e.done;_e=ir.next()){var Ur=$(_e.value,2),yr=Ur[0],Vt=Ur[1];O.get(yr).sceneId===Q&&Sr(O.get(yr))&&Vt.tick(r)}}catch(Ve){g={error:Ve}}finally{try{_e&&!_e.done&&(I=ir.return)&&I.call(ir)}finally{if(g)throw g.error}}var Nt=function(Ve){var ur,Dr,Zr=O.get(Ve.componentId);if(Zr.sceneId!==Q)return"continue";var Er=qn(Zr)?ie([],$(mr.values()),!1).filter(function(Hn){return Hn.prototypeId===Zr.id}):[Zr];try{for(var rt=(ur=void 0,q(Er)),sr=rt.next();!sr.done;sr=rt.next()){var Br=sr.value,Cn=Ve.id+":"+Br.id;if(Ve.kind==="motion"){var gt=(te=Qe.get(Br.id))!==null&&te!==void 0?te:{transform:ie([],$(Br.transform),!1),parameters:{}},zt=(de=gt.velocity)!==null&&de!==void 0?de:{x:Ve.parameters.vx,y:Ve.parameters.vy};zt.y+=Ve.parameters.gravity*r,gt.transform[4]+=zt.x*r,gt.transform[5]+=zt.y*r,gt.velocity=zt,Qe.set(Br.id,gt),Br.prototypeId&&(Br.transform=gt.transform);var un=hr(Br);(un[5]>we.height||un[4]<-300||un[4]>we.width+300)&&(gt.exited||(gt.exited=!0,rr({kind:"boundaryExit",componentId:Zr.id,instanceId:Br.instanceId})))}else if(Ve.kind==="timer"){var Dn=((ne=An.get(Cn))!==null&&ne!==void 0?ne:0)+r;An.set(Cn,Dn),Dn>=Ve.parameters.seconds&&Dn-r<Ve.parameters.seconds&&(rr(ge({kind:"timer",behaviorId:Ve.id,componentId:Zr.id},Br.instanceId?{instanceId:Br.instanceId,selfInstanceId:Br.instanceId}:{})),Ve.parameters.repeat&&An.set(Cn,Dn-Ve.parameters.seconds))}}}catch(Hn){ur={error:Hn}}finally{try{sr&&!sr.done&&(Dr=rt.return)&&Dr.call(rt)}finally{if(ur)throw ur.error}}};try{for(var Ct=q(e.gameplay),Jr=Ct.next();!Jr.done;Jr=Ct.next()){var Cr=Jr.value;Nt(Cr)}}catch(Ve){S={error:Ve}}finally{try{Jr&&!Jr.done&&(m=Ct.return)&&m.call(Ct)}finally{if(S)throw S.error}}Ll(r),Yi(r),wa(r);var qr=[],jr=function(Ve){var ur,Dr,Zr=O.get(Ve.componentId);if(Zr.sceneId!==Q)return"continue";try{for(var Er=(ur=void 0,q(qn(Zr)?ie([],$(mr.values()),!1).filter(function(Br){return Br.prototypeId===Zr.id}):[Zr])),rt=Er.next();!rt.done;rt=Er.next()){var sr=rt.value;if(Sr(sr)){if(qr.length>=256){ft("Collider budget exhausted");break}qr.push({b:Ve,c:sr,box:ut(sr,hr(sr)),polygon:Mo(sr,Ve.parameters.shape)})}}}catch(Br){ur={error:Br}}finally{try{rt&&!rt.done&&(Dr=Er.return)&&Dr.call(Er)}finally{if(ur)throw ur.error}}};try{for(var Yr=q(e.gameplay.filter(function(Ve){return Ve.kind==="collider"})),Kr=Yr.next();!Kr.done;Kr=Yr.next()){var Cr=Kr.value;jr(Cr)}}catch(Ve){C={error:Ve}}finally{try{Kr&&!Kr.done&&(w=Yr.return)&&w.call(Yr)}finally{if(C)throw C.error}}var pr=new Set,tr=new Map,_r=function(Ve,ur,Dr){var Zr,Er,rt;((Zr=ur.c.prototypeId)!==null&&Zr!==void 0?Zr:ur.c.id)===((Er=Dr.c.prototypeId)!==null&&Er!==void 0?Er:Dr.c.id)&&ur.c.id>Dr.c.id||rr(ge(ge({},dt(Ve,ur.c,Dr.c)),{instanceId:(rt=ur.c.instanceId)!==null&&rt!==void 0?rt:Dr.c.instanceId}))},at=0;e:for(var He=0;He<qr.length;He++)for(var Cr=He+1;Cr<qr.length;Cr++){var ar=qr[He],Se=qr[Cr];if(!(ar.c.instanceId&&ar.c.instanceId===Se.c.instanceId)){var Vr=ar.box,vt=Se.box,pt=Vr.left<vt.right&&Vr.right>vt.left&&Vr.top<vt.bottom&&Vr.bottom>vt.top;if(pt){if(++at>4096){ft("Collision budget exhausted");break e}pt=Ql(ar.polygon,Se.polygon)}if(pt){var or=[ar.c.id,Se.c.id].sort().join("|");if(pr.add(or),tr.set(or,[ar,Se]),!ve.has(or))try{for(var st=(P=void 0,q([[ar,Se],[Se,ar]])),Et=st.next();!Et.done;Et=st.next()){var Sn=$(Et.value,2),ln=Sn[0],Pt=Sn[1];_r("contactBegin",ln,Pt)}}catch(ur){P={error:ur}}finally{try{Et&&!Et.done&&(x=st.return)&&x.call(st)}finally{if(P)throw P.error}}}}}try{for(var ct=q(Ne),Lr=ct.next();!Lr.done;Lr=ct.next()){var Gr=$(Lr.value,2),or=Gr[0],fn=$(Gr[1],2),ar=fn[0],Se=fn[1];if(!pr.has(or))try{for(var ht=(N=void 0,q([[ar,Se],[Se,ar]])),et=ht.next();!et.done;et=ht.next()){var Tt=$(et.value,2),ln=Tt[0],Pt=Tt[1];_r("contactEnd",ln,Pt)}}catch(Zr){N={error:Zr}}finally{try{et&&!et.done&&(W=ht.return)&&W.call(ht)}finally{if(N)throw N.error}}}}catch(Ve){T={error:Ve}}finally{try{Lr&&!Lr.done&&(A=ct.return)&&A.call(ct)}finally{if(T)throw T.error}}ve=pr,Ne=tr;try{for(var dn=q(Ie),Ir=dn.next();!Ir.done;Ir=dn.next()){var He=Ir.value;He.elapsed+=r;var Ye=He.parameters,ot=(pe=Ye.delay)!==null&&pe!==void 0?pe:0,dr=He.elapsed-ot;if(!(dr<0)){var Qr=dr/Ye.seconds,xr=Ye.loop?Qr%1:Math.min(1,Qr),br=(Ce=Ye.easing)!==null&&Ce!==void 0?Ce:"ease-out",Nr=xr;Ye.loop&&br==="ease-in-out"?Nr=.5-.5*Math.cos(xr*Math.PI*2):br==="ease-out"?Nr=1-Math.pow(1-xr,3):br==="ease-in"?Nr=Math.pow(xr,3):br==="ease-in-out"?Nr=xr<.5?4*Math.pow(xr,3):1-Math.pow(-2*xr+2,3)/2:br==="back-out"&&(Nr=1+2.70158*Math.pow(xr-1,3)+1.70158*Math.pow(xr-1,2));var je=Ye.from+(Ye.to-Ye.from)*Nr,qe=Be((We=He.targetId)!==null&&We!==void 0?We:He.componentId);if(qe){var mt=(De=Qe.get(qe.id))!==null&&De!==void 0?De:{transform:ie([],$(qe.transform),!1),parameters:{}},Xt=(me=He.baseTransform)!==null&&me!==void 0?me:qe.transform;if(Ye.property==="opacity")mt.parameters.opacity=Math.max(0,Math.min(1,je));else if(["scale","scaleX","scaleY","rotation"].includes(Ye.property)){(xe=mt.animationAxes)!==null&&xe!==void 0||(mt.animationAxes={scale:1,scaleX:1,scaleY:1,rotation:0}),mt.animationAxes[Ye.property]=je;var Ut=mt.animationAxes,kn=Ut.rotation*Math.PI/180,ri=Math.cos(kn),Wn=Math.sin(kn),ti=Ut.scale*Ut.scaleX,ni=Ut.scale*Ut.scaleY;mt.transform[0]=(Xt[0]*ri+Xt[2]*Wn)*ti,mt.transform[1]=(Xt[1]*ri+Xt[3]*Wn)*ti,mt.transform[2]=(-Xt[0]*Wn+Xt[2]*ri)*ni,mt.transform[3]=(-Xt[1]*Wn+Xt[3]*ri)*ni}else mt.transform[Ye.property==="x"?4:5]=je;Qe.set(qe.id,mt),Ye.loop&&dr>=Ye.seconds&&(He.elapsed=ot+dr%Ye.seconds)}}}}catch(Ve){D={error:Ve}}finally{try{Ir&&!Ir.done&&(V=dn.return)&&V.call(dn)}finally{if(D)throw D.error}}Ie=Ie.filter(function(Ve){var ur,Dr;return Be((ur=Ve.targetId)!==null&&ur!==void 0?ur:Ve.componentId)&&(Ve.elapsed<Ve.parameters.seconds+((Dr=Ve.parameters.delay)!==null&&Dr!==void 0?Dr:0)||Ve.parameters.loop)});try{for(var Ln=q(le),Bt=Ln.next();!Bt.done;Bt=Ln.next()){var Ye=Bt.value;if(Ye.age!==void 0){Ye.age+=r;continue}Ye.life-=r,Ye.x+=Ye.vx*r,Ye.y+=Ye.vy*r,Ye.vy+=Ye.gravity*r}}catch(Ve){H={error:Ve}}finally{try{Bt&&!Bt.done&&(G=Ln.return)&&G.call(Ln)}finally{if(H)throw H.error}}le=le.filter(function(Ve){var ur;return Ve.life>((ur=Ve.age)!==null&&ur!==void 0?ur:0)}),on()}function Gi(r,o){var d,u,s;if(y.beginPath(),r.contract==="native.ellipse.v1")y.ellipse(o.width/2,o.height/2,o.width/2,o.height/2,0,0,Math.PI*2);else if(r.contract==="native.path.v1"){var p=function(w,P){({M:function(){return y.moveTo.apply(y,ie([],$(P),!1))},L:function(){return y.lineTo.apply(y,ie([],$(P),!1))},C:function(){return y.bezierCurveTo.apply(y,ie([],$(P),!1))},Q:function(){return y.quadraticCurveTo.apply(y,ie([],$(P),!1))},Z:function(){return y.closePath()}})[w]()};try{for(var h=q(o.commands),g=h.next();!g.done;g=h.next()){var I=$(g.value),S=I[0],m=I.slice(1);p(S,m)}}catch(w){d={error:w}}finally{try{g&&!g.done&&(u=h.return)&&u.call(h)}finally{if(d)throw d.error}}}else{var C=Math.min((s=o.radius)!==null&&s!==void 0?s:0,o.width/2,o.height/2);typeof y.roundRect=="function"?y.roundRect(0,0,o.width,o.height,C):(y.moveTo(C,0),y.arcTo(o.width,0,o.width,o.height,C),y.arcTo(o.width,o.height,0,o.height,C),y.arcTo(0,o.height,0,0,C),y.arcTo(0,0,o.width,0,C),y.closePath())}}function jl(r,o,d){var u,s,p,h=(u=Qe.get(r.id))===null||u===void 0?void 0:u.pathFrame;if(h!==void 0)return Math.min(o.frameCount-1,h);if(k||!o.frameRate)return 0;if(r.contract!=="native.walk-sprite.v1")return Math.floor(Math.max(0,se-((s=r.spawnTime)!==null&&s!==void 0?s:0))*o.frameRate)%o.frameCount;var g=(p=r.runtimeId)!==null&&p!==void 0?p:r.id,I=ui.get(g);if(!I)return ui.set(g,{x:d[4],y:d[5],phase:0,lastMove:-1/0,frame:0}),0;var S=Math.hypot(d[4]-I.x,d[5]-I.y)>.3;if(S){var m=se-I.lastMove;I.phase=Number.isFinite(m)&&m<.25?I.phase+Math.min(m,.12)*o.frameRate:0,I.lastMove=se}return I.x=d[4],I.y=d[5],se-I.lastMove>.11&&(I.phase=0),I.frame=Math.floor(I.phase)%o.frameCount,I.frame}var pi=!1,ei={width:390,height:700};function Aa(r){var o,d;r!==pi&&(r?(y.save(),y.beginPath(),y.rect((o=ei.left)!==null&&o!==void 0?o:0,(d=ei.top)!==null&&d!==void 0?d:0,ei.width,ei.height),y.clip(),pi=!0):(y.restore(),pi=!1))}function mi(r,o,d,u,s){var p,h,g,I,S,m,C,w,P;if(o===void 0&&(o=jt()),d===void 0&&(d=[]),s===void 0&&(s=!1),r.contract!=="native.mesh3d.v1"){var x=Fe(r),T=Mt("erase-mask",(g=r.prototypeId)!==null&&g!==void 0?g:r.id);if(!(!x.visible||x.opacity<=0)){var A=ai(o,St(r));pi||Aa(!0),y.save(),y.transform.apply(y,ie([],$(s?A:St(r)),!1)),y.globalAlpha*=x.opacity;var N=xn.get(r.id);N!=null&&N.behavior.liftShadow&&(y.shadowColor="#00000055",y.shadowBlur=8,y.shadowOffsetY=4);var W=d;r.contract==="native.group.v1"&&x.clip&&(y.beginPath(),y.rect(0,0,x.width,x.height),y.clip(),W=ie(ie([],$(d),!1),[{matrix:A,width:x.width,height:x.height}],!1));var D=!1;if(!["native.group.v1","native.text.v1","native.image.v1","native.sprite.v1","native.walk-sprite.v1","native.stage3d.v1","native.mesh3d.v1"].includes(r.contract)){var V=r.contract==="native.button.v1",H=tt===r.id,G=V?x.enabled?H?x.pressedFill:Gt===r.id?x.hoverFill:x.fill:x.disabledFill:x.fill;if(V&&(x.presentation==="pixel-cta"||x.presentation==="shiny-cta")){var F=(I=he.get(r.id))!==null&&I!==void 0?I:ke;ae.set(r.id,F);var te=!k&&!(Z!=null&&Z.matches)?ke-F:-1;x.presentation==="shiny-cta"?xl(y,x,G,H,te):Il(y,x,G,H,te)}else x.pixelFrame&&(y.save(),y.translate(3,4),Gi(r,x),y.fillStyle="#3c293366",y.fill(),y.restore()),Gi(r,x),T?(y.save(),y.clip(),hi(r,T).render(y),y.restore(),D=!0,Gi(r,x)):(y.fillStyle=G,y.fill()),x.pixelFrame&&!(x.radius>0)&&(y.fillStyle="#ffffff22",y.fillRect(2,2,Math.max(0,x.width-4),2),y.fillRect(2,2,2,Math.max(0,x.height-4))),x.strokeWidth&&(y.strokeStyle=x.stroke,y.lineWidth=x.strokeWidth,y.stroke());Fr===r.id&&(Gi(r,x),y.strokeStyle="#ffffff",y.lineWidth=5,y.stroke())}var de;if(r.contract==="native.text.v1"){var ne=x.text.replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(Je,kr){var ir;return String((ir=j[kr])!==null&&ir!==void 0?ir:"")});x.pixelPanel&&(y.fillStyle="#3c293366",y.fillRect(3,4,x.width,x.height),y.fillStyle=x.panelFill,y.fillRect(0,0,x.width,x.height),y.strokeStyle=(S=x.panelStroke)!==null&&S!==void 0?S:x.color,y.lineWidth=2,y.strokeRect(1,1,x.width-2,x.height-2),y.fillStyle="#ffffff22",y.fillRect(3,3,Math.max(0,x.width-6),2));var pe=x.fontFamily==="pixel"?qa(ne,x):void 0;pe&&!pe.unsupportedChars.length?de=hl(y,ne,x):de=id(y,ne,pe?ge(ge({},x),{fontFamily:"sans-serif",fontWeight:"700"}):x)}if(["native.image.v1","native.sprite.v1","native.walk-sprite.v1"].includes(r.contract)&&!T){var Ce=Pe.get((C=(m=Qe.get(r.id))===null||m===void 0?void 0:m.assetId)!==null&&C!==void 0?C:(w=r.assetSlots[0])===null||w===void 0?void 0:w.assetId);if(Ce!=null&&Ce.complete&&Ce.naturalWidth){y.save(),y.beginPath(),y.rect(0,0,x.width,x.height),y.clip();var We=r.contract!=="native.image.v1",De=We?Math.min(x.frameColumns,x.frameCount):1,me=We?Math.ceil(x.frameCount/De):1,xe=Ce.width/De,we=Ce.height/me,Te=We?jl(r,x,A):0,Oe=Te%De*xe,ce=Math.floor(Te/De)*we,yr=x.fit==="cover"?Math.max(x.width/xe,x.height/we):Math.min(x.width/xe,x.height/we),Ae=x.fit==="stretch"?x.width:xe*yr,fr=x.fit==="stretch"?x.height:we*yr;y.imageSmoothingEnabled=(P=x.smoothing)!==null&&P!==void 0?P:!0,y.drawImage(Ce,Oe,ce,xe,we,(x.width-Ae)/2,(x.height-fr)/2,Ae,fr),y.restore()}}T&&!D&&hi(r,T).render(y),rn.push({c:r,m:A,clips:W,instance:u!=null?u:r.prototypeId,textMetrics:de});try{for(var Me=q(Xi(r.id)),nr=Me.next();!nr.done;nr=Me.next()){var Ge=nr.value;mi(Ge,A,W,u!=null?u:r.prototypeId)}}catch(Je){p={error:Je}}finally{try{nr&&!nr.done&&(h=Me.return)&&h.call(Me)}finally{if(p)throw p.error}}x.clip&&r.contract==="native.group.v1"&&Ra(r.id),y.restore()}}}function Ra(r,o){var d,u;if(!(Z!=null&&Z.matches))try{for(var s=q(le),p=s.next();!p.done;p=s.next()){var h=p.value;h.shape!=="pixel-confetti"&&h.shape!=="confetti"||h.clipId!==r||!!h.screen!=!!o||(y.save(),h.shape==="confetti"?gl(y,h,o):pl(y,h,o),y.restore())}}catch(g){d={error:g}}finally{try{p&&!p.done&&(u=s.return)&&u.call(s)}finally{if(d)throw d.error}}}function _l(r,o,d,u){y.save(),y.translate(r,o),y.globalAlpha=.92,y.lineWidth=2,y.lineJoin="round",d==="tap"&&(y.strokeStyle="#fff0bd",y.globalAlpha=.7*(1-u),y.beginPath(),y.arc(0,0,12+u*12,0,Math.PI*2),y.stroke(),y.globalAlpha=.92),y.fillStyle="#fff0bd",y.strokeStyle="#193b46",y.beginPath(),y.moveTo(-7,10),y.lineTo(-9,-1),y.quadraticCurveTo(-9,-5,-5,-5),y.lineTo(-3,-3),y.lineTo(-3,-17),y.quadraticCurveTo(-3,-22,1,-22),y.quadraticCurveTo(5,-22,5,-17),y.lineTo(5,-6),y.quadraticCurveTo(9,-9,11,-5),y.quadraticCurveTo(15,-7,16,-2),y.lineTo(14,9),y.quadraticCurveTo(12,18,3,18),y.lineTo(-1,18),y.quadraticCurveTo(-5,17,-7,10),y.closePath(),y.fill(),y.stroke(),y.restore()}function ef(){var r,o,d,u,s,p,h,g,I,S,m,C,w,P,x,T,A,N,W;if(fi=0,!k)try{for(var D=q(e.gameplay.filter(function(or){return or.kind==="tutorial-hand"})),V=D.next();!V.done;V=D.next()){var H=V.value,G=O.get(H.componentId),F=Be(H.parameters.targetId);if(!(!G||G.sceneId!==Q||!F||F.sceneId!==Q||!Sr(F))&&!(H.parameters.hideOnFirstInput&&Oi)){var te=gn?se:ke;if(!(te-tn<H.parameters.idleDelaySeconds)){fi++;var de=H.parameters.destinationId?Be(H.parameters.destinationId):void 0,ne=Fe(F),pe=void 0;pe||(pe=vr(hr(F),ne.width/2,ne.height/2));var Ce=te%1.2/1.2,We=Z!=null&&Z.matches?0:Ce*Ce*(3-2*Ce),De=pe.x,me=pe.y;if(H.parameters.mode!=="tap"){var xe=de?vr(hr(de),Fe(de).width/2,Fe(de).height/2):{x:pe.x-36,y:pe.y+48};De=pe.x+(xe.x-pe.x)*We,me=pe.y+(xe.y-pe.y)*We}_l(De+8,me+22,H.parameters.mode,We)}}}}catch(or){r={error:or}}finally{try{V&&!V.done&&(o=D.return)&&o.call(D)}finally{if(r)throw r.error}}try{for(var we=q(nn),Te=we.next();!Te.done;Te=we.next()){var Oe=$(Te.value,2),ce=Oe[0],yr=Oe[1],Ae=Mt("draw-stroke",ce).parameters;try{for(var fr=(s=void 0,q(yr.strokes)),Me=fr.next();!Me.done;Me=fr.next()){var nr=Me.value;if(!(nr.points.length<2)){y.save(),y.globalAlpha=Ae.mode==="slice-blade"?Math.max(0,1-nr.age/.18):1,y.strokeStyle=Ae.color,y.lineWidth=Ae.strokeWidth,y.lineCap="round",y.lineJoin="round",y.beginPath(),y.moveTo(nr.points[0].x,nr.points[0].y);try{for(var Ge=(h=void 0,q(nr.points.slice(1))),Je=Ge.next();!Je.done;Je=Ge.next()){var kr=Je.value;y.lineTo(kr.x,kr.y)}}catch(or){h={error:or}}finally{try{Je&&!Je.done&&(g=Ge.return)&&g.call(Ge)}finally{if(h)throw h.error}}y.stroke(),y.restore()}}}catch(or){s={error:or}}finally{try{Me&&!Me.done&&(p=fr.return)&&p.call(fr)}finally{if(s)throw s.error}}}}catch(or){d={error:or}}finally{try{Te&&!Te.done&&(u=we.return)&&u.call(we)}finally{if(d)throw d.error}}try{for(var ir=q(wn),_e=ir.next();!_e.done;_e=ir.next()){var Ur=_e.value;if(!(Ur.broken||!Ur.drawRope)){var Vt=Ot.get(Ur.bodyId),Nt=Be(Ur.anchorId);if(!(!Vt||!Nt)){var Ct=Or(Nt);y.save(),y.strokeStyle=Ur.ropeColor,y.lineWidth=Ur.ropeWidth,y.beginPath(),y.moveTo(Ct.x,Ct.y),y.lineTo(Vt.x,Vt.y),y.stroke(),y.restore()}}}}catch(or){I={error:or}}finally{try{_e&&!_e.done&&(S=ir.return)&&S.call(ir)}finally{if(I)throw I.error}}try{for(var Jr=q(e.gameplay.filter(function(or){var st;return or.kind==="virtual-joystick"&&((st=O.get(or.componentId))===null||st===void 0?void 0:st.sceneId)===Q})),Cr=Jr.next();!Cr.done;Cr=Jr.next()){var H=Cr.value,qr=Be(H.componentId),ne=H.parameters;if(!(!qr||!Sr(qr)||ne.drawControl===!1)){var jr=an.get(H.id),Yr=jr&&jr.pointerId!==null?jr.origin:Or(qr),Kr=jr&&jr.pointerId!==null?jr.knobX:Yr.x,pr=jr&&jr.pointerId!==null?jr.knobY:Yr.y,tr=(A=ne.radiusPx)!==null&&A!==void 0?A:56;y.save(),y.fillStyle=(N=ne.baseColor)!==null&&N!==void 0?N:"#ffffff44",y.strokeStyle="#ffffffaa",y.lineWidth=2.5,y.beginPath(),y.arc(Yr.x,Yr.y,tr,0,Math.PI*2),y.fill(),y.stroke(),y.fillStyle=(W=ne.knobColor)!==null&&W!==void 0?W:"#fff0bdee",y.strokeStyle="#193b46aa",y.lineWidth=2,y.beginPath(),y.arc(Kr,pr,tr*.42,0,Math.PI*2),y.fill(),y.stroke(),y.restore()}}}catch(or){m={error:or}}finally{try{Cr&&!Cr.done&&(C=Jr.return)&&C.call(Jr)}finally{if(m)throw m.error}}try{for(var _r=q(lt),at=_r.next();!at.done;at=_r.next()){var He=at.value,ar=Math.min(1,He.elapsed/He.seconds);y.save(),y.globalAlpha=1-ar,y.fillStyle=He.color,y.strokeStyle="#193b46",y.lineWidth=3,y.font="900 "+He.fontSize+"px sans-serif",y.textAlign="center",y.textBaseline="middle";var me=He.y-(Z!=null&&Z.matches?0:He.risePx*ar);y.strokeText(He.text,He.x,me),y.fillText(He.text,He.x,me),y.restore()}}catch(or){w={error:or}}finally{try{at&&!at.done&&(P=_r.return)&&P.call(_r)}finally{if(w)throw w.error}}try{for(var Se=q(yt),Vr=Se.next();!Vr.done;Vr=Se.next()){var vt=Vr.value,ar=Math.min(1,vt.elapsed/vt.seconds),pt=R();y.save(),y.globalAlpha=vt.opacity*(1-ar),y.fillStyle=vt.color,y.fillRect(0,0,pt.width,pt.height),y.restore()}}catch(or){x={error:or}}finally{try{Vr&&!Vr.done&&(T=Se.return)&&T.call(Se)}finally{if(x)throw x.error}}}function rf(){if(Xe){var r=Ot.get(Xe.targetId),o=Xe.behavior.parameters;if(r){var d=Xe.current.x-Xe.start.x,u=Xe.current.y-Xe.start.y,s=Math.hypot(d,u),p=Math.min(o.maxPullPx,s),h=s>.001?p/s:0;y.save(),y.lineCap="round";var g=Math.max(12,Math.min(r.width,r.height)*.62);if(y.strokeStyle="#173a2f66",y.lineWidth=3.5,y.beginPath(),y.arc(r.x,r.y,g,0,Math.PI*2),y.stroke(),y.strokeStyle=o.trajectoryColor,y.lineWidth=2,y.beginPath(),y.arc(r.x,r.y,g,0,Math.PI*2),y.stroke(),o.showTrajectory&&s>=o.minPullPx){var I=Va(),S=mo(),m=S.bodies,C=S.zones,w=R(),P=ul({body:ge(ge({},r),{vx:I.vx,vy:I.vy,atRest:!1}),bodies:m,zones:C,bounds:{left:0,top:0,right:w.width,bottom:w.height},dots:o.trajectoryDots,bounces:o.trajectoryBounces});P.forEach(function(A,N){var W=.96-.52*(N/Math.max(1,P.length)),D=Math.max(2.2,4.5-N*.22);y.globalAlpha=W,y.fillStyle="#173a2f88",y.beginPath(),y.arc(A.x,A.y,D+1.3,0,Math.PI*2),y.fill(),y.fillStyle=o.trajectoryColor,y.beginPath(),y.arc(A.x,A.y,D,0,Math.PI*2),y.fill()})}if(s>=4){var x=r.x+d*h,T=r.y+u*h;y.globalAlpha=.9,y.strokeStyle="#173a2f66",y.lineWidth=5,y.beginPath(),y.moveTo(r.x,r.y),y.lineTo(x,T),y.stroke(),y.strokeStyle=o.trajectoryColor,y.lineWidth=2.6,y.beginPath(),y.moveTo(r.x,r.y),y.lineTo(x,T),y.stroke(),y.fillStyle="#173a2f88",y.beginPath(),y.arc(x,T,5.2,0,Math.PI*2),y.fill(),y.fillStyle=o.trajectoryColor,y.beginPath(),y.arc(x,T,3.6,0,Math.PI*2),y.fill()}y.restore()}}}function tf(r){var o,d,u,s;try{for(var p=q(co()),h=p.next();!h.done;h=p.next()){var g=h.value,I=g.contract==="native.group.v1"?Xi(g.id):[g];try{for(var S=(u=void 0,q(I)),m=S.next();!m.done;m=S.next()){var C=m.value;if(C.contract==="native.stage3d.v1"&&Sr(C)&&Fe(C).skyColor)return Fe(C).skyColor;if(!(C.contract!=="native.rectangle.v1"||!Sr(C))){var w=Fe(C);if(!(w.opacity<.95||!w.fill||w.fill==="transparent")&&(/(?:^|\.)(background|backdrop|bg)(?:\.fill)?$/.test(C.id)||w.width>=r.width*.9&&w.height>=r.height*.9))return w.fill}}}catch(P){u={error:P}}finally{try{m&&!m.done&&(s=S.return)&&s.call(S)}finally{if(u)throw u.error}}}}catch(P){o={error:P}}finally{try{h&&!h.done&&(d=p.return)&&d.call(p)}finally{if(o)throw o.error}}return"#102a34"}function nf(){var r;if(bn&&Sr(bn.c)){var o=bn.c,d=Fe(o);y.save(),y.transform.apply(y,ie([],$(hr(o)),!1)),y.strokeStyle=(r=bn.highlightColor)!==null&&r!==void 0?r:"#ffffff",y.lineWidth=4,y.globalAlpha=.85,y.strokeRect(-4,-4,d.width+8,d.height+8),y.restore()}if(Ze!=null&&Ze.b.parameters.bringToFront){var o=Be(Ze.targetId);o&&mi(o,o.parentId?hr(Be(o.parentId)):jt(),[],o.prototypeId)}}function it(){var r,o,d,u,s,p;he=ae,ae=new Map;var h=R();ue!==void 0&&ue!==h.landscape&&Kt(),ue=h.landscape;var g=Math.min(devicePixelRatio||1,2),I=t.clientWidth,S=t.clientHeight;(t.width!==Math.round(I*g)||t.height!==Math.round(S*g))&&(t.width=Math.round(I*g),t.height=Math.round(S*g)),y.setTransform(g,0,0,g,0,0),y.fillStyle=tf(h),y.fillRect(0,0,I,S);var m=Math.min(I/h.width,S/h.height),C=(I-h.width*m)/2,w=(S-h.height*m)/2;if(Rl=m||1,Ol=g,y.translate(C,w),y.scale(m,m),Ar){var P=Math.min(1,Ar.elapsed/Ar.seconds),x=Ar.intensity*(1-P);y.translate(Math.sin(Ar.elapsed*95)*x,Math.cos(Ar.elapsed*113)*x)}ei=h,pi=!1,ei=Fi(h),rn=[];try{for(var T=q(co()),A=T.next();!A.done;A=T.next()){var N=A.value;mi(N)}}catch(me){r={error:me}}finally{try{A&&!A.done&&(o=T.return)&&o.call(T)}finally{if(r)throw r.error}}Aa(!0);try{for(var W=q(ye),D=W.next();!D.done;D=W.next()){var N=D.value;N.parentId||mi(N,jt(),[],N.prototypeId)}}catch(me){d={error:me}}finally{try{D&&!D.done&&(u=W.return)&&u.call(W)}finally{if(d)throw d.error}}if(nf(),rf(),k&&Dt){for(var V=O.get(Dt);V!=null&&V.parentId;)V=O.get(V.parentId);V!=null&&V.prototype&&mi(V)}Ra(),y.save();try{for(var H=q(le),G=H.next();!G.done;G=H.next()){var F=G.value;if(F.age===void 0){var te=Math.min(1,F.life*2),de=1.5+2.5*te;if(y.globalAlpha=te,y.globalCompositeOperation=F.shape==="square"?"source-over":"lighter",y.fillStyle=F.color,F.shape==="square"){var ne=Math.max(2,Math.round(de*1.6));y.fillRect(Math.round(F.x-ne/2),Math.round(F.y-ne/2),ne,ne);continue}y.globalCompositeOperation="lighter",y.shadowColor=F.color,y.shadowBlur=le.length<=16?6:0,y.strokeStyle=F.color,y.lineWidth=1.5+te,y.beginPath(),y.moveTo(F.x-F.vx*.025,F.y-F.vy*.025),y.lineTo(F.x,F.y),y.stroke(),y.beginPath(),y.arc(F.x,F.y,de,0,Math.PI*2),y.fill()}}}catch(me){s={error:me}}finally{try{G&&!G.done&&(p=H.return)&&p.call(H)}finally{if(s)throw s.error}}if(y.restore(),ef(),k&&Dt){var pe=rn.filter(function(me){return me.c.contract!=="native.group.v1"&&(me.c.id===Dt||kt(me.c,Dt))});if(pe.length){var Ce=pe.map(function(me){return ut(me.c,me.m)}),We=Math.min.apply(Math,ie([],$(Ce.map(function(me){return me.left})),!1)),De=Math.min.apply(Math,ie([],$(Ce.map(function(me){return me.top})),!1));y.strokeStyle="#55e6ef",y.lineWidth=2/m,y.strokeRect(We,De,Math.max.apply(Math,ie([],$(Ce.map(function(me){return me.right})),!1))-We,Math.max.apply(Math,ie([],$(Ce.map(function(me){return me.bottom})),!1))-De)}}Aa(!1),m>0&&Ra(void 0,{x:-C/m,y:-w/m,width:I/m,height:S/m})}function af(r){var o,d,u,s,p=Array.isArray(r)?ie([],$(new Set(r)),!1):void 0;it();var h=R(),g=Fi(h),I=new Set,S=[];try{for(var m=q(rn),C=m.next();!C.done;C=m.next()){var w=C.value,P=(u=w.c.prototypeId)!==null&&u!==void 0?u:w.c.id;if(!(w.c.contract==="native.group.v1"||p&&!p.includes(P))){I.add(P);var x=ut(w.c,w.m),T=((s=Fe(w.c).strokeWidth)!==null&&s!==void 0?s:0)/2;x.left-=T,x.right+=T,x.top-=T,x.bottom+=T;var A={left:Math.max(0,g.left-x.left),right:Math.max(0,x.right-g.right),top:Math.max(0,g.top-x.top),bottom:Math.max(0,x.bottom-g.bottom)};Object.values(A).some(function(W){return W>.01})&&S.push({id:P,contract:w.c.contract,bounds:x,overflow:A})}}}catch(W){o={error:W}}finally{try{C&&!C.done&&(d=m.return)&&d.call(m)}finally{if(o)throw o.error}}var N=p?p.filter(function(W){return!I.has(W)}):[];return{ok:S.length===0&&N.length===0,viewport:ge(ge({},h),{canvasWidth:t.clientWidth,canvasHeight:t.clientHeight}),issues:S,missing:N}}function of(r){var o,d,u,s,p,h,g,I,S,m,C,w,P,x,T,A,N,W,D,V,H,G,F,te,de,ne,pe,Ce,We,De,me,xe,we,Te=r===void 0?{}:r,Oe=Te.ids,ce=Te.interactiveIds,yr=Te.network,Ae=yr===void 0?"standalone":yr,fr=Te.minTouchPx,Me=fr===void 0?44:fr,nr=Array.isArray(Oe)?ie([],$(new Set(Oe)),!1):void 0;it();var Ge=R(),Je=Fi(Ge),kr=Math.min(t.clientWidth/Ge.width,t.clientHeight/Ge.height),ir=lo(Je,Ae),_e=[],Ur=new Set,Vt=function(z){var Ee;return!nr||nr.includes((Ee=z.c.prototypeId)!==null&&Ee!==void 0?Ee:z.c.id)},Nt=rn.filter(Vt),Ct=new Set(e.events.filter(function(z){return z.kind==="click"}).map(function(z){return z.componentId}));try{for(var Jr=q(e.gameplay),Cr=Jr.next();!Cr.done;Cr=Jr.next()){var qr=Cr.value;["drag","match-tile","aim-launch","aim-launch-3d","swipe-input","hold-charge","virtual-joystick","draw-stroke","erase-mask"].includes(qr.kind)&&Ct.add(qr.componentId)}}catch(z){o={error:z}}finally{try{Cr&&!Cr.done&&(d=Jr.return)&&d.call(Jr)}finally{if(o)throw o.error}}var jr=new Set(ce!=null?ce:Ct),Yr=new Set(ie(ie([],$(e.gameplay.filter(function(z){return["aim-launch","aim-launch-3d","swipe-input","hold-charge","draw-stroke","virtual-joystick"].includes(z.kind)&&(z.parameters.dragMode==="anywhere"||z.kind==="draw-stroke"||z.kind==="virtual-joystick"&&z.parameters.mode==="floating")}).map(function(z){return z.componentId})),!1),$(e.components.filter(function(z){return z.contract==="native.stage3d.v1"}).map(function(z){return z.id})),!1)),Kr=function(z){var Ee;return jr.has((Ee=z.c.prototypeId)!==null&&Ee!==void 0?Ee:z.c.id)},pr=function(z,Ee,ze,er,Hr,wr){return _e.push(ge(ge({kind:z,severity:Ee,id:ze},wr?{otherId:wr}:{}),{detail:er,metrics:Hr}))},tr=function(z){var Ee=[[0,0],[z.width,0],[z.width,z.height],[0,z.height]].map(function(ze){var er=$(ze,2),Hr=er[0],wr=er[1];return vr(z.matrix,Hr,wr)});return{left:Math.min.apply(Math,ie([],$(Ee.map(function(ze){return ze.x})),!1)),right:Math.max.apply(Math,ie([],$(Ee.map(function(ze){return ze.x})),!1)),top:Math.min.apply(Math,ie([],$(Ee.map(function(ze){return ze.y})),!1)),bottom:Math.max.apply(Math,ie([],$(Ee.map(function(ze){return ze.y})),!1))}};try{for(var _r=q(Nt),at=_r.next();!at.done;at=_r.next()){var He=at.value,ar=(F=He.c.prototypeId)!==null&&F!==void 0?F:He.c.id;Ur.add(ar);var Se=ut(He.c,He.m),Vr=((te=Fe(He.c).strokeWidth)!==null&&te!==void 0?te:0)/2;Se.left-=Vr,Se.right+=Vr,Se.top-=Vr,Se.bottom+=Vr;var vt=He.c.contract==="native.group.v1"&&!Fe(He.c).clip,pt=He.c.contract==="native.image.v1"&&He.clips.length===0&&Fe(He.c).fit==="cover"&&Se.left<=0&&Se.top<=0&&Se.right>=Ge.width&&Se.bottom>=Ge.height||He.c.contract==="native.stage3d.v1"&&Se.left<=0&&Se.top<=0&&Se.right>=Ge.width&&Se.bottom>=Ge.height,or=He.c.contract==="native.rectangle.v1"&&Vr===0&&Se.left<=0&&Se.top<=0&&Se.right>=Ge.width&&Se.bottom>=Ge.height||pt;if(!vt){var st={left:Math.max(0,Je.left-Se.left),right:Math.max(0,Se.right-Je.right),top:Math.max(0,Je.top-Se.top),bottom:Math.max(0,Se.bottom-Je.bottom)};if(!or&&!So(He.c)&&Object.values(st).some(function(z){return z>.01})&&pr("stage-overflow","blocker",ar,"Component extends beyond the active stage.",{bounds:Se,overflow:st}),He.c.contract==="native.image.v1"&&He.clips.length===0){var Et=Se.right-Se.left,Sn=Se.bottom-Se.top,ln=/(?:^|\.)(backdrop|background|bg)$/.test(ar)||Fe(He.c).fit==="cover"&&!He.c.parentId&&Se.left<=1&&Se.top<=1&&(Et>=Ge.width*.4||Sn>=Ge.height*.4);ln&&(Se.left>.5||Se.top>.5||Se.right<Ge.width-.5||Se.bottom<Ge.height-.5)&&pr("backdrop-incomplete","blocker",ar,"Backdrop image does not cover the full active stage, leaving a visible seam.",{bounds:Se,stage:{width:Ge.width,height:Ge.height}})}try{for(var Pt=(p=void 0,q(He.clips)),ct=Pt.next();!ct.done;ct=Pt.next()){var Lr=ct.value,Gr=tr(Lr),fn={left:Math.max(0,Gr.left-Se.left),right:Math.max(0,Se.right-Gr.right),top:Math.max(0,Gr.top-Se.top),bottom:Math.max(0,Se.bottom-Gr.bottom)};Object.values(fn).some(function(z){return z>.01})&&pr("parent-clip-crop","blocker",ar,"Component is cropped by an ancestor clipping group.",{bounds:Se,clip:Gr,crop:fn})}}catch(z){p={error:z}}finally{try{ct&&!ct.done&&(h=Pt.return)&&h.call(Pt)}finally{if(p)throw p.error}}}if(He.textMetrics){var ht=He.textMetrics;(ht.overflowsWidth||ht.overflowsHeight)&&pr("text-overflow","blocker",ar,"Text does not fit its component after wrapping and auto-fit.",ht);var et=(de=ht.fontSize)!==null&&de!==void 0?de:ht.scale*8;et<12&&pr("text-illegible",et<8?"blocker":"warning",ar,"Rendered text is below the recommended legible size.",ge({renderedFontSize:et},ht));var Tt=Fe(He.c);if(Tt.pixelPanel&&Tt.align!=="center"){var dn=Math.max(0,Tt.width-2*(Tt.padding===void 0?8:Tt.padding));dn-((ne=ht.renderedWidth)!==null&&ne!==void 0?ne:0)>12&&pr("panel-off-center","blocker",ar,"Text inside a framed pixel panel is not horizontally centered.",{align:Tt.align,innerWidth:dn,renderedWidth:(pe=ht.renderedWidth)!==null&&pe!==void 0?pe:0})}}if(Kr(He)&&!Yr.has(ar)&&(He.c.contract!=="native.group.v1"||Se.right>Se.left&&Se.bottom>Se.top)){var Ir=(Se.right-Se.left)*kr,Ye=(Se.bottom-Se.top)*kr;(Ir<Me-.01||Ye<Me-.01)&&pr("touch-target-small","blocker",ar,"Interactive target is smaller than the required physical touch size.",{width:Ir,height:Ye,minTouchPx:Me,scale:kr})}if(Kr(He)&&!Yr.has(ar)||He.c.contract==="native.text.v1")try{for(var ot=(g=void 0,q(ir.zones)),dr=ot.next();!dr.done;dr=ot.next()){var Qr=dr.value,Ir=Math.min(Se.right,Qr.right)-Math.max(Se.left,Qr.left),Ye=Math.min(Se.bottom,Qr.bottom)-Math.max(Se.top,Qr.top);Ir>.01&&Ye>.01&&pr("sdk-safe-area-collision","blocker",ar,"Component intersects a reserved ad-SDK overlay zone.",{bounds:Se,zone:Qr,intersection:{width:Ir,height:Ye},network:Ae})}}catch(z){g={error:z}}finally{try{dr&&!dr.done&&(I=ot.return)&&I.call(ot)}finally{if(g)throw g.error}}}}catch(z){u={error:z}}finally{try{at&&!at.done&&(s=_r.return)&&s.call(_r)}finally{if(u)throw u.error}}for(var xr=Nt.filter(function(z){return Kr(z)&&z.c.contract!=="native.group.v1"&&z.c.contract!=="native.stage3d.v1"}),br=0;br<xr.length;br++)for(var Nr=br+1;Nr<xr.length;Nr++){var je=xr[br],qe=xr[Nr],mt=(Ce=je.c.prototypeId)!==null&&Ce!==void 0?Ce:je.c.id,Xt=(We=qe.c.prototypeId)!==null&&We!==void 0?We:qe.c.id;if(!(mt===Xt||kt(je.c,qe.c.id)||kt(qe.c,je.c.id))){var Ut=ut(je.c,je.m),kn=ut(qe.c,qe.m),Ir=Math.min(Ut.right,kn.right)-Math.max(Ut.left,kn.left),Ye=Math.min(Ut.bottom,kn.bottom)-Math.max(Ut.top,kn.top);Ir>1&&Ye>1&&pr("interactive-overlap","blocker",mt,"Interactive targets overlap.",{intersection:{width:Ir,height:Ye},first:Ut,second:kn},Xt)}}var ri=function(z){if(!z||z==="transparent")return!1;var Ee=/^#([0-9a-f]{4}|[0-9a-f]{8})$/i.exec(z);if(Ee)return Ee[1].length===4?Ee[1][3].toLowerCase()==="f":Ee[1].slice(6).toLowerCase()==="ff";var ze=/^rgba\([^,]+,[^,]+,[^,]+,\s*([0-9.]+)\s*\)$/i.exec(z);return ze?Number(ze[1])>=.95:!0},Wn=[];Nt.forEach(function(z,Ee){var ze,er;z.c.contract==="native.rectangle.v1"&&!Kr(z)&&((ze=Fe(z.c).opacity)!==null&&ze!==void 0?ze:1)>=.95&&ri(Fe(z.c).fill)&&Wn.push({rowIndex:Ee,row:z,order:(er=z.c.order)!==null&&er!==void 0?er:0,bounds:ut(z.c,z.m)})});var ti=Nt.filter(function(z,Ee){var ze,er=ut(z.c,z.m),Hr=(ze=z.c.order)!==null&&ze!==void 0?ze:0;return!Wn.some(function(wr){return wr.rowIndex>Ee&&wr.order>Hr&&wr.row.c.id!==z.c.id&&!kt(wr.row.c,z.c.id)&&!kt(z.c,wr.row.c.id)&&wr.bounds.left<=er.left+1&&wr.bounds.right>=er.right-1&&wr.bounds.top<=er.top+1&&wr.bounds.bottom>=er.bottom-1})}),ni=ti.map(function(z,Ee){return{row:z,rowIndex:Ee}}).filter(function(z){var Ee,ze=z.row;if(ze.c.contract!=="native.rectangle.v1")return!1;var er=ut(ze.c,ze.m),Hr=er.right-er.left,wr=er.bottom-er.top,vn=((Ee=Fe(ze.c).strokeWidth)!==null&&Ee!==void 0?Ee:0)===0&&er.left<=0&&er.right>=Ge.width;return!vn&&Hr>=180&&wr>=140&&!Kr(ze)}).map(function(z){var Ee,ze=z.row,er=z.rowIndex;return{id:(Ee=ze.c.prototypeId)!==null&&Ee!==void 0?Ee:ze.c.id,row:ze,rowIndex:er,bounds:ut(ze.c,ze.m)}}),Ln=function(z,Ee,ze,er){var Hr,wr;er===void 0&&(er=!1);var vn=(Hr=z.c.prototypeId)!==null&&Hr!==void 0?Hr:z.c.id,Si=(ze.left+ze.right)/2,sn=(ze.top+ze.bottom)/2,Ha=(wr=z.c.order)!==null&&wr!==void 0?wr:0;return ni.filter(function(cr){var cn;return cr.id!==vn&&(!er||cr.rowIndex<Ee||((cn=cr.row.c.order)!==null&&cn!==void 0?cn:0)===Ha)&&ze.right-ze.left<=cr.bounds.right-cr.bounds.left+4&&ze.bottom-ze.top<=cr.bounds.bottom-cr.bounds.top+4&&Si>=cr.bounds.left&&Si<=cr.bounds.right&&sn>=cr.bounds.top&&sn<=cr.bounds.bottom}).sort(function(cr,cn){return(cr.bounds.right-cr.bounds.left)*(cr.bounds.bottom-cr.bounds.top)-(cn.bounds.right-cn.bounds.left)*(cn.bounds.bottom-cn.bounds.top)||cn.rowIndex-cr.rowIndex})[0]},Bt=new Map,Ve=new Map;if(ni.length){ti.forEach(function(z,Ee){var ze,er=(ze=z.c.prototypeId)!==null&&ze!==void 0?ze:z.c.id,Hr=ut(z.c,z.m),wr=(Hr.left+Hr.right)/2,vn=(Hr.top+Hr.bottom)/2,Si=z.c.contract==="native.button.v1"&&!Ht.has(z.c.id),sn=z.c.parentId?Be(z.c.parentId):void 0,Ha=z.c.contract==="native.text.v1"&&Fe(z.c).align==="center"&&(sn==null?void 0:sn.contract)!=="native.button.v1";if(Si||Ha){var cr=Ln(z,Ee,Hr,!1);cr&&(Bt.has(cr.id)||Bt.set(cr.id,{panel:cr,items:[]}),Bt.get(cr.id).items.push({id:er,bounds:Hr,cx:wr,cy:vn,isBtn:Si}))}if(["native.text.v1","native.image.v1","native.button.v1"].includes(z.c.contract)&&(sn==null?void 0:sn.contract)!=="native.button.v1"){var cr=Ln(z,Ee,Hr,!0);cr&&(Ve.has(cr.id)||Ve.set(cr.id,{panel:cr,content:[]}),Ve.get(cr.id).content.push({row:z,id:er,bounds:Hr}))}});try{for(var ur=q(Bt.values()),Dr=ur.next();!Dr.done;Dr=ur.next()){var Zr=Dr.value,Er=Zr.panel,rt=Zr.items;if(rt.some(function(z){return z.isBtn})){var sr=Er.bounds,Br=(sr.left+sr.right)/2;try{for(var Cn=(C=void 0,q(rt)),gt=Cn.next();!gt.done;gt=Cn.next()){var zt=gt.value,un={left:zt.bounds.left-sr.left,right:sr.right-zt.bounds.right,top:zt.bounds.top-sr.top,bottom:sr.bottom-zt.bounds.bottom},Dn=Math.min(un.left,un.right,un.top,un.bottom);(Dn<10||Dn*kr<8)&&pr("panel-edge-cramped","blocker",zt.id,"Element sits too close to its enclosing panel edge.",{panelId:Er.id,margins:un,scale:kr,minStagePx:10,minCssPx:8},Er.id)}}catch(z){C={error:z}}finally{try{gt&&!gt.done&&(w=Cn.return)&&w.call(Cn)}finally{if(C)throw C.error}}var Hn=[],pf=function(z){var Ee=Hn.find(function(ze){return Math.abs(ze.cy-z.cy)<=16&&ze.isBtn===z.isBtn});Ee?Ee.items.push(z):Hn.push({cy:z.cy,isBtn:z.isBtn,items:[z]})};try{for(var Qi=(P=void 0,q(rt)),gi=Qi.next();!gi.done;gi=Qi.next()){var zt=gi.value;pf(zt)}}catch(z){P={error:z}}finally{try{gi&&!gi.done&&(x=Qi.return)&&x.call(Qi)}finally{if(P)throw P.error}}try{for(var Ji=(T=void 0,q(Hn)),Ii=Ji.next();!Ii.done;Ii=Ji.next()){var La=Ii.value,mf=Math.min.apply(Math,ie([],$(La.items.map(function(z){return z.bounds.left})),!1)),gf=Math.max.apply(Math,ie([],$(La.items.map(function(z){return z.bounds.right})),!1)),No=(mf+gf)/2,Bo=No-Br;Math.abs(Bo)>3&&pr("panel-off-center","blocker",La.items[0].id,"Element is not horizontally centered inside its enclosing panel.",{panelId:Er.id,offsetX:Bo,groupCenterX:No,panelCenterX:Br,scale:kr},Er.id)}}catch(z){T={error:z}}finally{try{Ii&&!Ii.done&&(A=Ji.return)&&A.call(Ji)}finally{if(T)throw T.error}}}}}catch(z){S={error:z}}finally{try{Dr&&!Dr.done&&(m=ur.return)&&m.call(ur)}finally{if(S)throw S.error}}try{for(var qi=q(Ve.values()),xi=qi.next();!xi.done;xi=qi.next())for(var zo=xi.value,Er=zo.panel,ji=zo.content,If=Bt.has(Er.id),br=0;br<ji.length;br++)for(var Nr=br+1;Nr<ji.length;Nr++){var je=ji[br],qe=ji[Nr];if(!(je.id===qe.id||kt(je.row.c,qe.row.c.id)||kt(qe.row.c,je.row.c.id))){var xf=je.row.c.contract==="native.image.v1"&&qe.row.c.contract==="native.image.v1";if(!(xf&&(!If||je.row.c.parentId&&je.row.c.parentId===qe.row.c.parentId))){var Ir=Math.min(je.bounds.right,qe.bounds.right)-Math.max(je.bounds.left,qe.bounds.left),Ye=Math.min(je.bounds.bottom,qe.bounds.bottom)-Math.max(je.bounds.top,qe.bounds.top);Ir>2&&Ye>2&&pr("panel-content-overlap","blocker",je.id,"Panel elements overlap each other.",{panelId:Er.id,intersection:{width:Ir,height:Ye},first:je.bounds,second:qe.bounds},qe.id)}}}}catch(z){N={error:z}}finally{try{xi&&!xi.done&&(W=qi.return)&&W.call(qi)}finally{if(N)throw N.error}}}var ii=ti.filter(function(z){if(z.c.contract!=="native.text.v1")return!1;var Ee=z.c.parentId?Be(z.c.parentId):void 0;return(Ee==null?void 0:Ee.contract)!=="native.button.v1"}).map(function(z){var Ee,ze,er=String((Ee=Fe(z.c).text)!==null&&Ee!==void 0?Ee:"").replace(/\{\{([a-z0-9_.-]+)\}\}/g,function(Hr,wr){var vn;return String((vn=j[wr])!==null&&vn!==void 0?vn:"")}).trim();return{row:z,id:(ze=z.c.prototypeId)!==null&&ze!==void 0?ze:z.c.id,bounds:ut(z.c,z.m),raw:er,norm:er.toLowerCase().replace(/[^a-z0-9]+/g," ").trim()}}).filter(function(z){return z.raw.length>0}),bf=ni.filter(function(z){var Ee,ze;return((Ee=Bt.get(z.id))===null||Ee===void 0?void 0:Ee.items.some(function(er){return er.isBtn}))||((ze=Ve.get(z.id))===null||ze===void 0?void 0:ze.content.some(function(er){return er.row.c.contract==="native.button.v1"}))});try{for(var _i=q(bf),bi=_i.next();!bi.done;bi=_i.next()){var Er=bi.value,sr=Er.bounds,Br=(sr.left+sr.right)/2,wf=sr.right-sr.left;try{for(var ea=(H=void 0,q(ii)),wi=ea.next();!wi.done;wi=ea.next()){var Jt=wi.value;if(Fe(Jt.row.c).align==="center"&&!(Jt.bounds.bottom>sr.top+6||sr.top-Jt.bounds.bottom>48)){var Wo=Jt.bounds.right-Jt.bounds.left,Mi=(Jt.bounds.left+Jt.bounds.right)/2,Mf=Math.min(Jt.bounds.right,sr.right)-Math.max(Jt.bounds.left,sr.left);(Mi>=sr.left&&Mi<=sr.right||Mf>=Wo*.6)&&Wo<=wf+60&&Math.abs(Mi-Br)>4&&pr("header-off-center","blocker",Jt.id,"Centered text above a panel is not horizontally aligned with the panel below it.",{panelId:Er.id,offsetX:Mi-Br,textCenterX:Mi,panelCenterX:Br,scale:kr},Er.id)}}}catch(er){H={error:er}}finally{try{wi&&!wi.done&&(G=ea.return)&&G.call(ea)}finally{if(H)throw H.error}}}}catch(z){D={error:z}}finally{try{bi&&!bi.done&&(V=_i.return)&&V.call(_i)}finally{if(D)throw D.error}}for(var br=0;br<ii.length;br++)for(var Nr=br+1;Nr<ii.length;Nr++){var je=ii[br],qe=ii[Nr];if(!(je.id===qe.id||kt(je.row.c,qe.row.c.id)||kt(qe.row.c,je.row.c.id))){var Ir=Math.min(je.bounds.right,qe.bounds.right)-Math.max(je.bounds.left,qe.bounds.left),Ye=Math.min(je.bounds.bottom,qe.bounds.bottom)-Math.max(je.bounds.top,qe.bounds.top);if(Ir>2&&Ye>2&&pr("panel-content-overlap","blocker",je.id,"Visible text elements overlap.",{intersection:{width:Ir,height:Ye},first:je.bounds,second:qe.bounds},qe.id),je.norm&&qe.norm){var Lo=$(je.norm.length<=qe.norm.length?[je.norm,qe.norm]:[qe.norm,je.norm],2),ra=Lo[0],Do=Lo[1];(ra===Do&&ra.length>=6||ra.length>=12&&Do.includes(ra))&&pr("duplicate-visible-copy","blocker",je.id,"Duplicate visible copy appears in multiple text elements simultaneously.",{first:je.raw,second:qe.raw},qe.id)}}}var qt=ii.filter(function(z){return!/^[\d\s/.,:%+\-x]+$/i.test(z.raw)}),ta=qt.reduce(function(z,Ee){return z+(Ee.norm?Ee.norm.split(" ").filter(Boolean).length:0)},0),Da=qt.reduce(function(z,Ee){return z+Ee.raw.replace(/\s+/g," ").length},0);ta>20||Da>130||qt.length>5?pr("text-clutter-heavy","blocker",(me=(De=qt[0])===null||De===void 0?void 0:De.id)!==null&&me!==void 0?me:null,"Too much visible copy on one screen; keep playable ads visual and concise.",{blocks:qt.length,wordCount:ta,charCount:Da,texts:qt.map(function(z){return z.raw})}):(ta>12||qt.length>4)&&pr("text-clutter-heavy","warning",(we=(xe=qt[0])===null||xe===void 0?void 0:xe.id)!==null&&we!==void 0?we:null,"Screen copy is getting dense; consider trimming narration so gameplay carries the experience.",{blocks:qt.length,wordCount:ta,charCount:Da,texts:qt.map(function(z){return z.raw})});var Ho=nr?nr.filter(function(z){if(Ur.has(z))return!1;var Ee=Be(z);return(Ee==null?void 0:Ee.contract)==="native.mesh3d.v1"?!1:!Ee||Sr(Ee)}):[];return{ok:!_e.some(function(z){return z.severity==="blocker"})&&Ho.length===0,viewport:ge(ge({},Ge),{canvasWidth:t.clientWidth,canvasHeight:t.clientHeight,scale:kr}),defects:_e,missing:Ho,interactive:xr.map(function(z){var Ee;return{id:(Ee=z.c.prototypeId)!==null&&Ee!==void 0?Ee:z.c.id,bounds:ut(z.c,z.m)}}),safeArea:ir}}function kt(r,o){for(;r.parentId;){if(r.parentId===o)return!0;r=Be(r.parentId)}return!1}function So(r){for(var o=function(s){if(e.gameplay.some(function(p){var h;return p.kind==="camera-follow"&&p.componentId===((h=s.prototypeId)!==null&&h!==void 0?h:s.id)}))return{value:!0}},d=r;d;d=d.parentId?Be(d.parentId):void 0){var u=o(d);if(typeof u=="object")return u.value}return!1}function Oa(r){var o=R(),d=t.getBoundingClientRect(),u=Math.min(d.width/o.width,d.height/o.height);return{x:(r.clientX-d.left-(d.width-o.width*u)/2)/u,y:(r.clientY-d.top-(d.height-o.height*u)/2)/u}}function lf(r,o){var d,u,s,p;try{try{for(var h=q(r.clips),g=h.next();!g.done;g=h.next()){var I=g.value,S=vr(Yt(I.matrix),o.x,o.y);if(S.x<0||S.y<0||S.x>I.width||S.y>I.height)return!1}}catch(V){d={error:V}}finally{try{g&&!g.done&&(u=h.return)&&u.call(h)}finally{if(d)throw d.error}}var m=vr(Yt(r.m),o.x,o.y),C=Fe(r.c);if(r.c.contract==="native.path.v1"){var w=new Path2D,P=function(V,H){({M:function(){return w.moveTo.apply(w,ie([],$(H),!1))},L:function(){return w.lineTo.apply(w,ie([],$(H),!1))},C:function(){return w.bezierCurveTo.apply(w,ie([],$(H),!1))},Q:function(){return w.quadraticCurveTo.apply(w,ie([],$(H),!1))},Z:function(){return w.closePath()}})[V]()};try{for(var x=q(C.commands),T=x.next();!T.done;T=x.next()){var A=$(T.value),N=A[0],W=A.slice(1);P(N,W)}}catch(V){s={error:V}}finally{try{T&&!T.done&&(p=x.return)&&p.call(x)}finally{if(s)throw s.error}}y.save(),y.setTransform(1,0,0,1,0,0),y.lineWidth=C.strokeWidth;var D=y.isPointInPath(w,m.x,m.y)||C.strokeWidth>0&&y.isPointInStroke(w,m.x,m.y);return y.restore(),D}return r.c.contract==="native.ellipse.v1"?Math.pow((m.x-C.width/2)/(C.width/2),2)+Math.pow((m.y-C.height/2)/(C.height/2),2)<=1:m.x>=0&&m.y>=0&&m.x<=C.width&&m.y<=C.height}catch{return!1}}function Zi(r){return ie([],$(rn),!1).reverse().find(function(o){return o.c.contract!=="native.group.v1"&&o.c.sceneId===Q&&Be(o.c.id)&&Sr(o.c)&&lf(o,r)})}function $i(r){for(var o=[];r;)o.push(r),r=Be(r.parentId);return o}function Va(){if(!Xe)return{vx:0,vy:0,power:0,pull:0};var r=Xe.behavior.parameters,o=Xe.current.x-Xe.start.x,d=Xe.current.y-Xe.start.y,u=Math.hypot(o,d),s=Math.max(0,Math.min(1,(u-r.minPullPx)/Math.max(1,r.maxPullPx-r.minPullPx))),p=r.minSpeed+(r.maxSpeed-r.minSpeed)*s,h=r.invert?-1:1;return{vx:u?o/u*p*h:0,vy:u?d/u*p*h:0,power:s,pull:u}}function ko(r){if(Xe){Xe.current=r;var o=Va();Xe.power=o.power,Xe.behavior.parameters.powerVariableId&&(j[Xe.behavior.parameters.powerVariableId]=o.power)}}function Co(r){var o,d;r===void 0&&(r=!1);try{var u=(o=globalThis.AudioContext)!==null&&o!==void 0?o:globalThis.webkitAudioContext;u&&!Ke&&(Ke=new u,(d=Ke.addEventListener)===null||d===void 0||d.call(Ke,"statechange",function(){(Ke==null?void 0:Ke.state)==="running"&&Sa()})),yi(r)}catch{}}function ff(r,o,d){var u,s,p,h,g,I,S=function(H){var G=d.find(function(de){var ne;return((ne=de.prototypeId)!==null&&ne!==void 0?ne:de.id)===H.componentId});if(!G)return"continue";var F=vr(Yt(hr(G)),o.x,o.y),te=hi(G,H);return te.stampSegment(F,F),$r={kind:"mask",pointerId:r.pointerId,c:G,behavior:H,last:F},(g=t.setPointerCapture)===null||g===void 0||g.call(t,r.pointerId),{value:!0}};try{for(var m=q(e.gameplay.filter(function(H){var G;return H.kind==="erase-mask"&&((G=O.get(H.componentId))===null||G===void 0?void 0:G.sceneId)===Q})),C=m.next();!C.done;C=m.next()){var w=C.value,P=S(w);if(typeof P=="object")return P.value}}catch(H){u={error:H}}finally{try{C&&!C.done&&(s=m.return)&&s.call(m)}finally{if(u)throw u.error}}if(d.some(function(H){return H.contract==="native.button.v1"||e.events.some(function(G){var F;return G.kind==="click"&&G.componentId===((F=H.prototypeId)!==null&&F!==void 0?F:H.id)})}))return!1;try{for(var x=q(e.gameplay.filter(function(H){var G;return H.kind==="draw-stroke"&&((G=O.get(H.componentId))===null||G===void 0?void 0:G.sceneId)===Q})),T=x.next();!T.done;T=x.next()){var w=T.value,A=O.get(w.componentId),N=Yt(hr(A)),W=vr(N,o.x,o.y),D=Fe(A);if(!(W.x<0||W.y<0||W.x>D.width||W.y>D.height)){var V=Wl(w);return V.begin(o),$r={kind:"stroke",pointerId:r.pointerId,c:A,behavior:w,store:V,last:o},rr({kind:"strokeStart",componentId:A.id}),(I=t.setPointerCapture)===null||I===void 0||I.call(t,r.pointerId),!0}}}catch(H){p={error:H}}finally{try{T&&!T.done&&(h=x.return)&&h.call(x)}finally{if(p)throw p.error}}return!1}function df(r,o,d){var u,s,p,h,g,I,S,m=d.store.active;if(m){try{for(var C=q(e.gameplay.filter(function(te){var de;return te.kind==="collider"&&((de=O.get(te.componentId))===null||de===void 0?void 0:de.sceneId)===Q})),w=C.next();!w.done;w=C.next()){var P=w.value,x=O.get(P.componentId);try{for(var T=(p=void 0,q(Xr(x))),A=T.next();!A.done;A=T.next()){var N=A.value;!Sr(N)||m.hitIds.has(N.id)||rl(r,o,Mo(N,P.parameters.shape))&&(m.hitIds.add(N.id),rr(dt("sliceHit",N)))}}catch(te){p={error:te}}finally{try{A&&!A.done&&(h=T.return)&&h.call(T)}finally{if(p)throw p.error}}}}catch(te){u={error:te}}finally{try{w&&!w.done&&(s=C.return)&&s.call(C)}finally{if(u)throw u.error}}try{for(var W=q(wn),D=W.next();!D.done;D=W.next()){var V=D.value;if(!(V.broken||!V.breakable||m.hitIds.has(V.key))){var H=Ot.get(V.bodyId),G=Be(V.anchorId);if(!(!H||!G)){var F=Or(G);Qa(r,o,{x:F.x,y:F.y},{x:H.x,y:H.y})&&(m.hitIds.add(V.key),V.broken=!0,Li.add(V.key),rr({kind:"jointBreak",behaviorId:V.id,componentId:V.componentId,selfInstanceId:V.bodyId,instanceId:(S=Be(V.bodyId))===null||S===void 0?void 0:S.instanceId}))}}}}catch(te){g={error:te}}finally{try{D&&!D.done&&(I=W.return)&&I.call(W)}finally{if(g)throw g.error}}}}function uf(r,o){var d,u=o.last,s=o.behavior.parameters;if(s.inkVariableId){var p=s.inkVariableId,h=Math.hypot(r.x-u.x,r.y-u.y);if(((d=j[p])!==null&&d!==void 0?d:0)<h)return;j[p]-=h}o.store.add(r)&&(s.mode==="slice-blade"&&df(u,r,o),o.last=r)}function vf(r){var o,d;if(!(!$r||$r.pointerId!==r.pointerId)){var u=$r;$r=void 0;try{!((o=t.hasPointerCapture)===null||o===void 0)&&o.call(t,r.pointerId)&&((d=t.releasePointerCapture)===null||d===void 0||d.call(t,r.pointerId))}catch{}if(u.kind==="stroke"){var s=u.store.end(),p=u.behavior.parameters;if(s){if(p.mode==="physics-wall"){var h=new Set(u.store.strokes.map(function(I){return I.id}));$t=$t.filter(function(I){return I.owner!==u.c.id||h.has(I.strokeId)}),$t.push.apply($t,ie([],$(nl(s,p.strokeWidth).map(function(I){return ge(ge({},I),{owner:u.c.id})})),!1))}else if(p.mode==="path-trace"){var g=Be(p.followComponentId);g&&s.points.length>1&&Vn.set(g.id,{points:s.points,index:1,speed:p.followSpeed})}}rr({kind:"strokeEnd",componentId:u.c.id})}}}function sf(r){var o,d,u,s;try{for(var p=q(nn.values()),h=p.next();!h.done;h=p.next()){var g=h.value;g.tick(r)}}catch(V){o={error:V}}finally{try{h&&!h.done&&(d=p.return)&&d.call(p)}finally{if(o)throw o.error}}try{for(var I=q(Vn),S=I.next();!S.done;S=I.next()){var m=$(S.value,2),C=m[0],w=m[1],P=Be(C);if(!P){Vn.delete(C);continue}var x=w.points[w.index];if(!x){Vn.delete(C),rr(dt("pathArrive",P));continue}var T=Or(P),A=x.x-T.x,N=x.y-T.y,W=Math.hypot(A,N),D=w.speed*r;W<=D?(Qt(P,x.x,x.y),w.index++):W>.001&&Qt(P,T.x+A/W*D,T.y+N/W*D)}}catch(V){u={error:V}}finally{try{S&&!S.done&&(s=I.return)&&s.call(I)}finally{if(u)throw u.error}}}function cf(r,o,d){var u,s,p=[],h=[],g=function(C){var w=O.get(C.componentId),P=C.parameters.dragMode==="anywhere"?Xr(w).find(function(A){return Sr(A)}):d.find(function(A){var N;return((N=A.prototypeId)!==null&&N!==void 0?N:A.id)===w.id});if(!P)return"continue";if(C.kind==="swipe-input")h.push({behavior:C,c:P});else{var x=C.parameters,T=Math.max(x.min,Math.min(x.max,Number(j[x.variableId])));j[x.variableId]=T,p.push({behavior:C,c:P,charge:$o(x,T)}),rr(dt("holdStart",P))}};try{for(var I=q(e.gameplay.filter(function(C){var w;return["swipe-input","hold-charge"].includes(C.kind)&&((w=O.get(C.componentId))===null||w===void 0?void 0:w.sceneId)===Q})),S=I.next();!S.done;S=I.next()){var m=S.value;g(m)}}catch(C){u={error:C}}finally{try{S&&!S.done&&(s=I.return)&&s.call(I)}finally{if(u)throw u.error}}(p.length||h.length)&&(gr={pointerId:r.pointerId,start:o,current:o,holds:p,swipes:h})}function hf(r,o){var d,u,s,p,h,g,I,S;if(!(!gr||gr.pointerId!==r.pointerId)){var m=gr,C=new Set;gr=void 0;try{for(var w=q(ie(ie([],$(m.holds),!1),$(m.swipes),!1)),P=w.next();!P.done;P=w.next()){var x=P.value,T=x.behavior,A=x.c;C.has(T.componentId)||(C.add(T.componentId),rr(dt("pointerUp",A,void 0,{targetId:A.id,pointerId:r.pointerId})))}}catch(ne){d={error:ne}}finally{try{P&&!P.done&&(u=w.return)&&u.call(w)}finally{if(d)throw d.error}}try{for(var N=q(m.holds),W=N.next();!W.done;W=N.next()){var D=W.value,V=D.behavior.parameters;if(rr(dt("holdRelease",D.c)),V.resetOnRelease!==!1){var H=j[V.variableId];j[V.variableId]=V.min,H!==V.min&&rr({kind:"variableChange",variableId:V.variableId,selfInstanceId:(I=D.c.instanceId)!==null&&I!==void 0?I:D.c.id,instanceId:D.c.instanceId})}}}catch(ne){s={error:ne}}finally{try{W&&!W.done&&(p=N.return)&&p.call(N)}finally{if(s)throw s.error}}try{for(var G=q(m.swipes),F=G.next();!F.done;F=G.next()){var te=F.value,de=Zo(m.start,o,te.behavior.parameters.minDistancePx,(S=Wi.get(te.behavior.id))!==null&&S!==void 0?S:-1/0,se*1e3,te.behavior.parameters.cooldownMs);de&&(Wi.set(te.behavior.id,se*1e3),rr(dt("swipe",te.c,void 0,{direction:de})))}}catch(ne){h={error:ne}}finally{try{F&&!F.done&&(g=G.return)&&g.call(G)}finally{if(h)throw h.error}}return C}}function yf(r,o,d){var u,s,p;if(d.some(function(T){return T.contract==="native.button.v1"&&Fe(T).enabled}))return!1;try{for(var h=q(e.gameplay.filter(function(T){var A;return T.kind==="virtual-joystick"&&((A=O.get(T.componentId))===null||A===void 0?void 0:A.sceneId)===Q})),g=h.next();!g.done;g=h.next()){var I=g.value,S=O.get(I.componentId);if(Sr(S)){var m=an.get(I.id);if(!(m&&m.pointerId!==null)){var C=vr(Yt(hr(S)),o.x,o.y),w=Fe(S);if(!(C.x<0||C.y<0||C.x>w.width||C.y>w.height)){var P=I.parameters.mode==="floating"?ge({},o):Or(S),x=Ga(P,o,I.parameters.radiusPx,I.parameters.deadZone);return m=ge({behavior:I,c:S,pointerId:r.pointerId,origin:P,current:o},x),an.set(I.id,m),ma(m),rr(dt("joystickStart",S)),(p=t.setPointerCapture)===null||p===void 0||p.call(t,r.pointerId),!0}}}}}catch(T){u={error:T}}finally{try{g&&!g.done&&(s=h.return)&&s.call(h)}finally{if(u)throw u.error}}return!1}var Eo=function(r){var o,d,u,s,p,h,g,I,S,m,C;b();var w=Oa(r),P=Zi(w);if(si=w,!(!P&&k)){if(k){P&&(Dt=P.c.id,Y((p=P.c.prototypeId)!==null&&p!==void 0?p:P.c.id));return}var x=e.gameplay.some(function(xe){return xe.kind==="virtual-joystick"||xe.kind==="fps-controller-3d"});if(!(!r.isTrusted||r.button!==void 0&&r.button!==0||!x&&r.isPrimary===!1||Pr||Tn||!x&&(Ze&&Ze.pointerId!==r.pointerId||gr&&gr.pointerId!==r.pointerId||Xe&&Xe.pointerId!==r.pointerId)||ee&&(!di||!Zn))){var T=!gn;tn=se,Oi=!0,gn=!0,Co(!0),T&&!Tr&&(zr=Wr=0,on());var A=P?$i(P.c):[];if(yf(r,w,A)){zr=Wr=0,Tr=!1,on(),it();return}if(ff(r,w,A)){on(),it();return}cf(r,w,A);var N=e.gameplay.find(function(xe){return xe.kind==="aim-launch"&&O.get(xe.componentId).sceneId===Q&&(xe.parameters.dragMode==="anywhere"&&!A.some(function(we){return we.contract==="native.button.v1"})||A.some(function(we){var Te;return((Te=we.prototypeId)!==null&&Te!==void 0?Te:we.id)===xe.componentId}))});if(N){var W=O.get(N.componentId),D=(h=A.find(function(xe){var we;return((we=xe.prototypeId)!==null&&we!==void 0?we:xe.id)===W.id}))!==null&&h!==void 0?h:Xr(W).find(function(xe){return Sr(xe)}),V=D&&Bn(D,Mt("physics-body",W.id));if(V&&(!N.parameters.onlyWhenAtRest||V.atRest)){Xe={behavior:N,targetId:D.id,sourceId:W.id,pointerId:r.pointerId,start:w,current:w,power:0},ko(w),(g=t.setPointerCapture)===null||g===void 0||g.call(t,r.pointerId),it();return}}try{for(var H=q(A),G=H.next();!G.done;G=H.next()){var F=G.value,te=Mt("press-feedback",(I=F.prototypeId)!==null&&I!==void 0?I:F.id);te&&(F.contract!=="native.button.v1"||Fe(F).enabled)&&xn.set(F.id,{behavior:te.parameters,pointerId:r.pointerId,held:!0})}}catch(xe){o={error:xe}}finally{try{G&&!G.done&&(d=H.return)&&d.call(H)}finally{if(o)throw o.error}}var de=A.find(function(xe){var we;return((we=Ht.get(xe.id))===null||we===void 0?void 0:we.sceneId)===Q});if(de){var ne=wt.get(de.parentId);if(ne!=null&&ne.snapshot().busy)return;Ul(de),ne&&!ne.snapshot().busy&&(nt={pointerId:r.pointerId,boardId:de.parentId,tileId:de.id,start:w},(S=t.setPointerCapture)===null||S===void 0||S.call(t,r.pointerId))}tt=(m=A.find(function(xe){return xe.contract==="native.button.v1"&&Fe(xe).enabled}))===null||m===void 0?void 0:m.id,At=tt?r.pointerId:void 0;var pe=e.gameplay.find(function(xe){return xe.kind==="drag"&&A.some(function(we){var Te;return((Te=we.prototypeId)!==null&&Te!==void 0?Te:we.id)===xe.componentId})});if(pe){var F=A.find(function(we){var Te;return((Te=we.prototypeId)!==null&&Te!==void 0?Te:we.id)===pe.componentId}),Ce=Or(F),We=Rr.zoneOf(F.id);zi.set(F.id,Ce),Rr.release(F.id),Ze={b:pe,targetId:F.id,start:w,current:w,origin:Ce,originZone:We,m:ie([],$(St(F)),!1),pointerId:r.pointerId},rr(dt("dragStart",F)),t.setPointerCapture(r.pointerId)}zr=Wr=0,Tr=!1;try{for(var De=q(A),me=De.next();!me.done;me=De.next()){var F=me.value;(F.contract!=="native.button.v1"||Fe(F).enabled)&&rr({kind:"click",componentId:(C=F.prototypeId)!==null&&C!==void 0?C:F.id,instanceId:F.instanceId,targetId:F.id,pointerId:r.pointerId})}}catch(xe){u={error:xe}}finally{try{me&&!me.done&&(s=De.return)&&s.call(De)}finally{if(u)throw u.error}}on(),it()}}};function Po(r,o){if(!nt||nt.pointerId!==r.pointerId)return!1;if(!r.isTrusted||!jn())return!0;var d=nt,u=wt.get(d.boardId);if(u.snapshot().busy)return nt=void 0,!0;var s=Yt(hr(O.get(d.boardId))),p=vr(s,d.start.x,d.start.y),h=vr(s,o.x,o.y),g=h.x-p.x,I=h.y-p.y,S=O.get(d.tileId);if(Math.max(Math.abs(g),Math.abs(I))<Math.min(S.parameters.width,S.parameters.height)*.35)return!0;var m=Ht.get(S.id),C=Math.abs(g)>Math.abs(I),w=m.row+(C?0:Math.sign(I)),P=m.column+(C?Math.sign(g):0),x=ie([],$(Ht),!1).find(function(T){var A=$(T,2),N=A[1];return N.boardId===d.boardId&&N.row===w&&N.column===P});return x&&u.swap(S.id,x[0])&&(Fr=void 0,it()),nt=void 0,!0}var To=function(r){var o,d,u,s;if(!Pr){b();var p=R(),h=Oa(r);si=h,(gr==null?void 0:gr.pointerId)===r.pointerId&&(gr.current=h);try{for(var g=q(an.values()),I=g.next();!I.done;I=g.next()){var S=I.value;if(S.pointerId===r.pointerId){var m=h.x-S.current.x,C=h.y-S.current.y;Object.assign(S,{current:h},Ga(S.origin,h,S.behavior.parameters.radiusPx,S.behavior.parameters.deadZone)),ma(S),it();return}}}catch(we){o={error:we}}finally{try{I&&!I.done&&(d=g.return)&&d.call(g)}finally{if(o)throw o.error}}if(($r==null?void 0:$r.pointerId)===r.pointerId){if($r.kind==="mask"){var w=$r,P=vr(Yt(hr(w.c)),h.x,h.y);hi(w.c,w.behavior).stampSegment(w.last,P),w.last=P}else uf(h,$r);on(),it();return}if((Xe==null?void 0:Xe.pointerId)===r.pointerId){r.isTrusted&&jn()&&ko(h),it();return}var x=Zi(h);if(Gt=x?(u=$i(x.c).find(function(we){return we.contract==="native.button.v1"}))===null||u===void 0?void 0:u.id:void 0,!Po(r,h)&&!(!Ze||Ze.pointerId!==r.pointerId)){var T=Be(Ze.targetId);if(!T){Di();return}var A=T.parentId?hr(Be(T.parentId)):jt(),N=Yt(A),W=vr(N,Ze.start.x,Ze.start.y),D=vr(N,h.x,h.y),V=ie([],$(Ze.m),!1),H=Ze.b.parameters.axis;if(H!=="y"){var G=Ze.m[4]+D.x-W.x;Number.isFinite(Ze.b.parameters.minX)&&(G=Math.max(Ze.b.parameters.minX,G)),Number.isFinite(Ze.b.parameters.maxX)&&(G=Math.min(Ze.b.parameters.maxX,G)),V[4]=G}if(H!=="x"){var F=Ze.m[5]+D.y-W.y;Number.isFinite(Ze.b.parameters.minY)&&(F=Math.max(Ze.b.parameters.minY,F)),Number.isFinite(Ze.b.parameters.maxY)&&(F=Math.min(Ze.b.parameters.maxY,F)),V[5]=F}if(!T.parentId)H!=="y"&&(V[4]=Math.max(0,Math.min(p.width-T.parameters.width,V[4])));else{var te=ut(T,ai(A,V)),de=0;te.left<0||te.right-te.left>p.width?de=-te.left:te.right>p.width&&(de=p.width-te.right);var ne=H==="y"?0:A[0],pe=H==="x"?0:A[2];Math.abs(ne)>=Math.abs(pe)&&Math.abs(ne)>1e-8?V[4]+=de/ne:Math.abs(pe)>1e-8&&(V[5]+=de/pe)}var Ce=(s=Qe.get(T.id))!==null&&s!==void 0?s:{parameters:{}};Qe.set(T.id,ge(ge({},Ce),{transform:V})),Ze.current=h;var We=Ca(T),De=We.zones,me=We.tag,xe=ia({itemId:T.id,tag:me,zones:De,occupancy:Rr});bn=xe&&xe.kind!=="reject"?xe.zone:void 0}}},Ao=function(r){var o,d,u,s;b();var p=Oa(r),h=bt;si=p,ga(r.pointerId,!0),vf(r);var g=(u=hf(r,p))!==null&&u!==void 0?u:new Set;if(Yl(r),r.isTrusted&&jn()){var I=Zi(p);try{for(var S=q(I?$i(I.c):[]),m=S.next();!m.done;m=S.next()){var C=m.value;!g.has((s=C.prototypeId)!==null&&s!==void 0?s:C.id)&&(C.contract!=="native.button.v1"||Fe(C).enabled)&&rr(dt("pointerUp",C,void 0,{targetId:C.id,pointerId:r.pointerId}))}}catch(A){o={error:A}}finally{try{m&&!m.done&&(d=S.return)&&d.call(S)}finally{if(o)throw o.error}}}if(on(),it(),(Xe==null?void 0:Xe.pointerId)===r.pointerId){var w=Xe,P=Va(),x=Ot.get(w.targetId);Xe=void 0,w.behavior.parameters.powerVariableId&&(j[w.behavior.parameters.powerVariableId]=0),x&&r.isTrusted&&jn()&&P.pull>=w.behavior.parameters.minPullPx&&(x.vx=P.vx,x.vy=P.vy,x.atRest=!1,x.restElapsed=0,x.captured=!1,x.exited=!1,rr({kind:"launch",componentId:w.sourceId,instanceId:x.instanceId})),Ia(r),on(),it();return}if(Po(r,p),(nt==null?void 0:nt.pointerId)===r.pointerId&&(nt=void 0),Ia(r),!((h==null?void 0:h.pointerId)!==r.pointerId||!r.isTrusted||!jn()||navigator.userActivation&&navigator.userActivation.isActive!==!0||!Ui(h.condition))){var T=Zi(p);!T||!$i(T.c).some(function(A){return A.id===h.targetId&&(A.contract!=="native.button.v1"||Fe(A).enabled)})||(ee?ee.openStore(e.base.storeUrl):window.open(e.base.storeUrl,"_blank","noopener"))}},Ki=function(r){var o,d;if(ga(r.pointerId,!0),(Xe==null?void 0:Xe.pointerId)===r.pointerId&&(Xe.behavior.parameters.powerVariableId&&(j[Xe.behavior.parameters.powerVariableId]=0),Xe=void 0),(nt==null?void 0:nt.pointerId)===r.pointerId&&(nt=void 0),($r==null?void 0:$r.pointerId)===r.pointerId&&($r.kind==="stroke"&&$r.store.cancel(),$r=void 0),(gr==null?void 0:gr.pointerId)===r.pointerId){try{for(var u=q(gr.holds),s=u.next();!s.done;s=u.next()){var p=s.value;p.behavior.parameters.resetOnRelease!==!1&&(j[p.behavior.parameters.variableId]=p.behavior.parameters.min)}}catch(h){o={error:h}}finally{try{s&&!s.done&&(d=u.return)&&d.call(u)}finally{if(o)throw o.error}}gr=void 0}Ia(r)},Ro=function(r){r!=null&&r.isTrusted&&!k&&!Pr&&!Tn&&Co(!0)},Na=function(){Vi||it()},Mn=typeof globalThis.ResizeObserver=="function"?new globalThis.ResizeObserver(Na):void 0;try{(v=Mn==null?void 0:Mn.observe)===null||v===void 0||v.call(Mn,t)}catch{}var Oo=function(){Ue=0,lr=0,document.hidden&&Kt(),Ke&&(document.hidden?Ke.suspend().catch(function(){}):!Pr&&gn&&yi())};document.addEventListener("visibilitychange",Oo),(c=globalThis.addEventListener)===null||c===void 0||c.call(globalThis,"resize",Na),t.addEventListener("pointerdown",Eo),t.addEventListener("pointermove",To),t.addEventListener("pointerup",Ao),t.addEventListener("pointercancel",Ki),t.addEventListener("lostpointercapture",Ki),t.addEventListener("click",Ro);var Ba=ee==null?void 0:ee.onVisibilityChanged(function(r){Zn=r,Ue=0,lr=0,r||Kt(),Ke&&(r?!Pr&&gn&&yi():Ke.suspend().catch(function(){}))}),za=ee==null?void 0:ee.onClosed(function(){Tn=!0,Ue=0,lr=0,Kt(),ci()}),Wa=(E=ee==null?void 0:ee.onVolumeChanged)===null||E===void 0?void 0:E.call(ee,function(r){typeof r=="number"&&Number.isFinite(r)&&r>=0&&(ya=Math.min(1,r>1?r/100:r),ka())});function Vo(r){var o=!k&&!Pr&&!document.hidden&&di&&Zn&&!Tn;if(o&&lr&&(ke+=Math.min((r-lr)/1e3,5/60)),jn()){zr=Wr=0,Tr=!1,lr&&(Ue+=Math.min((r-lr)/1e3,5/60));for(var d=0;d<5&&Ue>=1/60;d++)ql(1/60),Ue-=1/60;on()}else Ue=0;lr=r,it(),mn=requestAnimationFrame(Vo)}return Ma(),k&&(Q=re),it(),mn=requestAnimationFrame(Vo),ee&&ee.init().then(function(){Vi||(di=!0,Zn=ee.isVisible(),Ue=0,lr=0)}).catch(function(){Vi||(Tn=!0,Kt(),ci())}),{state:Vl,auditViewport:af,auditSceneLayout:of,restart:function(){var r;(r=ee==null?void 0:ee.notifyGameRetry)===null||r===void 0||r.call(ee),Ma(),it()},select:function(r){Dt=r},inspectScene:function(r){k&&e.scenes.some(function(o){return o.id===r})&&(Q=r,Dt=void 0)},pause:function(r){Pr=r,Ue=0,lr=0,r&&Kt(),Ke&&(r?Ke.suspend().catch(function(){}):gn&&yi())},destroy:function(){var r,o;Vi=!0,cancelAnimationFrame(mn),Kt(),ci(),Ba==null||Ba(),za==null||za(),Wa==null||Wa(),ee==null||ee.destroy(),(r=Mn==null?void 0:Mn.disconnect)===null||r===void 0||r.call(Mn),document.removeEventListener("visibilitychange",Oo),(o=globalThis.removeEventListener)===null||o===void 0||o.call(globalThis,"resize",Na),t.removeEventListener("pointerdown",Eo),t.removeEventListener("pointermove",To),t.removeEventListener("pointerup",Ao),t.removeEventListener("pointercancel",Ki),t.removeEventListener("lostpointercapture",Ki),t.removeEventListener("click",Ro),Ke==null||Ke.close().catch(function(){})}}}return Tf(od);})();
|