// Generated by Construct 3, the game and app creator :: https://www.construct.net
'use strict';(function(f,b){"object"===typeof exports&&"undefined"!==typeof module?b(exports):"function"===typeof define&&define.amd?define(["exports"],b):(f=f||self,b(f.glMatrix={}))})(this,function(f){function b(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];var F=v[0],H=v[1],K=v[2];v=v[3];h[0]=y*F+C*H;h[1]=A*F+l*H;h[2]=y*K+C*v;h[3]=A*K+l*v;return h}function a(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];return h}function d(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4];l=l[5];var K=
v[0],M=v[1],Q=v[2],S=v[3],X=v[4];v=v[5];h[0]=y*K+C*M;h[1]=A*K+F*M;h[2]=y*Q+C*S;h[3]=A*Q+F*S;h[4]=y*X+C*v+H;h[5]=A*X+F*v+l;return h}function c(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];h[4]=l[4]-v[4];h[5]=l[5]-v[5];return h}function e(){var h=new ma(9);ma!=Float32Array&&(h[1]=0,h[2]=0,h[3]=0,h[5]=0,h[6]=0,h[7]=0);h[0]=1;h[4]=1;h[8]=1;return h}function g(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7];l=l[8];var S=v[0],X=v[1],U=v[2],ca=v[3],ba=v[4],Z=v[5],
ra=v[6],la=v[7];v=v[8];h[0]=S*y+X*F+U*M;h[1]=S*A+X*H+U*Q;h[2]=S*C+X*K+U*l;h[3]=ca*y+ba*F+Z*M;h[4]=ca*A+ba*H+Z*Q;h[5]=ca*C+ba*K+Z*l;h[6]=ra*y+la*F+v*M;h[7]=ra*A+la*H+v*Q;h[8]=ra*C+la*K+v*l;return h}function k(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];h[4]=l[4]-v[4];h[5]=l[5]-v[5];h[6]=l[6]-v[6];h[7]=l[7]-v[7];h[8]=l[8]-v[8];return h}function m(h){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h}function p(h,
l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=l[8],X=l[9],U=l[10],ca=l[11],ba=l[12],Z=l[13],ra=l[14];l=l[15];var la=v[0],oa=v[1],pa=v[2],na=v[3];h[0]=la*y+oa*H+pa*S+na*ba;h[1]=la*A+oa*K+pa*X+na*Z;h[2]=la*C+oa*M+pa*U+na*ra;h[3]=la*F+oa*Q+pa*ca+na*l;la=v[4];oa=v[5];pa=v[6];na=v[7];h[4]=la*y+oa*H+pa*S+na*ba;h[5]=la*A+oa*K+pa*X+na*Z;h[6]=la*C+oa*M+pa*U+na*ra;h[7]=la*F+oa*Q+pa*ca+na*l;la=v[8];oa=v[9];pa=v[10];na=v[11];h[8]=la*y+oa*H+pa*S+na*ba;h[9]=la*A+oa*K+pa*X+na*Z;h[10]=la*C+oa*
M+pa*U+na*ra;h[11]=la*F+oa*Q+pa*ca+na*l;la=v[12];oa=v[13];pa=v[14];na=v[15];h[12]=la*y+oa*H+pa*S+na*ba;h[13]=la*A+oa*K+pa*X+na*Z;h[14]=la*C+oa*M+pa*U+na*ra;h[15]=la*F+oa*Q+pa*ca+na*l;return h}function n(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=y+y,K=A+A,M=C+C;l=y*H;var Q=y*K;y*=M;var S=A*K;A*=M;C*=M;H*=F;K*=F;F*=M;h[0]=1-(S+C);h[1]=Q+F;h[2]=y-K;h[3]=0;h[4]=Q-F;h[5]=1-(l+C);h[6]=A+H;h[7]=0;h[8]=y+K;h[9]=A-H;h[10]=1-(l+S);h[11]=0;h[12]=v[0];h[13]=v[1];h[14]=v[2];h[15]=1;return h}function u(h,l){h[0]=
l[12];h[1]=l[13];h[2]=l[14];return h}function q(h,l){var v=l[4],y=l[5],A=l[6],C=l[8],F=l[9],H=l[10];h[0]=Math.hypot(l[0],l[1],l[2]);h[1]=Math.hypot(v,y,A);h[2]=Math.hypot(C,F,H);return h}function r(h,l){var v=new ma(3);q(v,l);var y=1/v[0],A=1/v[1],C=1/v[2],F=l[0]*y;v=l[1]*A;var H=l[2]*C,K=l[4]*y,M=l[5]*A,Q=l[6]*C;y*=l[8];A*=l[9];l=l[10]*C;C=F+M+l;0<C?(F=2*Math.sqrt(C+1),h[3]=.25*F,h[0]=(Q-A)/F,h[1]=(y-H)/F,h[2]=(v-K)/F):F>M&&F>l?(F=2*Math.sqrt(1+F-M-l),h[3]=(Q-A)/F,h[0]=.25*F,h[1]=(v+K)/F,h[2]=(y+
H)/F):M>l?(F=2*Math.sqrt(1+M-F-l),h[3]=(y-H)/F,h[0]=(v+K)/F,h[1]=.25*F,h[2]=(Q+A)/F):(F=2*Math.sqrt(1+l-F-M),h[3]=(v-K)/F,h[0]=(y+H)/F,h[1]=(Q+A)/F,h[2]=.25*F);return h}function t(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];h[4]=l[4]-v[4];h[5]=l[5]-v[5];h[6]=l[6]-v[6];h[7]=l[7]-v[7];h[8]=l[8]-v[8];h[9]=l[9]-v[9];h[10]=l[10]-v[10];h[11]=l[11]-v[11];h[12]=l[12]-v[12];h[13]=l[13]-v[13];h[14]=l[14]-v[14];h[15]=l[15]-v[15];return h}function x(){var h=new ma(3);ma!=Float32Array&&
(h[0]=0,h[1]=0,h[2]=0);return h}function z(h){return Math.hypot(h[0],h[1],h[2])}function D(h,l,v){var y=new ma(3);y[0]=h;y[1]=l;y[2]=v;return y}function G(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];return h}function w(h,l,v){h[0]=l[0]*v[0];h[1]=l[1]*v[1];h[2]=l[2]*v[2];return h}function B(h,l,v){h[0]=l[0]/v[0];h[1]=l[1]/v[1];h[2]=l[2]/v[2];return h}function I(h,l){return Math.hypot(l[0]-h[0],l[1]-h[1],l[2]-h[2])}function P(h,l){var v=l[0]-h[0],y=l[1]-h[1];h=l[2]-h[2];return v*v+y*y+h*h}function E(h){var l=
h[0],v=h[1];h=h[2];return l*l+v*v+h*h}function J(h,l){var v=l[0],y=l[1],A=l[2];v=v*v+y*y+A*A;0<v&&(v=1/Math.sqrt(v));h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;return h}function O(h,l){return h[0]*l[0]+h[1]*l[1]+h[2]*l[2]}function R(h,l,v){var y=l[0],A=l[1];l=l[2];var C=v[0],F=v[1];v=v[2];h[0]=A*v-l*F;h[1]=l*C-y*v;h[2]=y*F-A*C;return h}function T(){var h=new ma(4);ma!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0,h[3]=0);return h}function Y(h){var l=new ma(4);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];return l}function W(h,
l,v,y){var A=new ma(4);A[0]=h;A[1]=l;A[2]=v;A[3]=y;return A}function ea(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];return h}function qa(h,l,v,y,A){h[0]=l;h[1]=v;h[2]=y;h[3]=A;return h}function ja(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];return h}function xa(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];return h}function ua(h,l,v){h[0]=l[0]*v[0];h[1]=l[1]*v[1];h[2]=l[2]*v[2];h[3]=l[3]*v[3];return h}function Da(h,l,v){h[0]=l[0]/v[0];h[1]=l[1]/v[1];h[2]=
l[2]/v[2];h[3]=l[3]/v[3];return h}function Ea(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;return h}function Ba(h,l){return Math.hypot(l[0]-h[0],l[1]-h[1],l[2]-h[2],l[3]-h[3])}function Aa(h,l){var v=l[0]-h[0],y=l[1]-h[1],A=l[2]-h[2];h=l[3]-h[3];return v*v+y*y+A*A+h*h}function ia(h){return Math.hypot(h[0],h[1],h[2],h[3])}function Fa(h){var l=h[0],v=h[1],y=h[2];h=h[3];return l*l+v*v+y*y+h*h}function wa(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v*v+y*y+A*A+l*l;0<C&&(C=1/Math.sqrt(C));h[0]=
v*C;h[1]=y*C;h[2]=A*C;h[3]=l*C;return h}function Ca(h,l){return h[0]*l[0]+h[1]*l[1]+h[2]*l[2]+h[3]*l[3]}function Pa(h,l,v,y){var A=l[0],C=l[1],F=l[2];l=l[3];h[0]=A+y*(v[0]-A);h[1]=C+y*(v[1]-C);h[2]=F+y*(v[2]-F);h[3]=l+y*(v[3]-l);return h}function Qa(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]}function Ra(h,l){var v=h[0],y=h[1],A=h[2];h=h[3];var C=l[0],F=l[1],H=l[2];l=l[3];return Math.abs(v-C)<=.000001*Math.max(1,Math.abs(v),Math.abs(C))&&Math.abs(y-F)<=.000001*Math.max(1,Math.abs(y),
Math.abs(F))&&Math.abs(A-H)<=.000001*Math.max(1,Math.abs(A),Math.abs(H))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))}function Ja(){var h=new ma(4);ma!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0);h[3]=1;return h}function Sa(h,l,v){v*=.5;var y=Math.sin(v);h[0]=y*l[0];h[1]=y*l[1];h[2]=y*l[2];h[3]=Math.cos(v);return h}function Ta(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];var F=v[0],H=v[1],K=v[2];v=v[3];h[0]=y*v+l*F+A*K-C*H;h[1]=A*v+l*H+C*F-y*K;h[2]=C*v+l*K+y*H-A*F;h[3]=l*v-y*F-A*H-C*K;return h}
function Ua(h,l,v){v*=.5;var y=l[0],A=l[1],C=l[2];l=l[3];var F=Math.sin(v);v=Math.cos(v);h[0]=y*v+l*F;h[1]=A*v+C*F;h[2]=C*v-A*F;h[3]=l*v-y*F;return h}function Va(h,l,v){v*=.5;var y=l[0],A=l[1],C=l[2];l=l[3];var F=Math.sin(v);v=Math.cos(v);h[0]=y*v-C*F;h[1]=A*v+l*F;h[2]=C*v+y*F;h[3]=l*v-A*F;return h}function Wa(h,l,v){v*=.5;var y=l[0],A=l[1],C=l[2];l=l[3];var F=Math.sin(v);v=Math.cos(v);h[0]=y*v+A*F;h[1]=A*v-y*F;h[2]=C*v+l*F;h[3]=l*v-C*F;return h}function Xa(h,l){var v=l[0],y=l[1],A=l[2],C=Math.sqrt(v*
v+y*y+A*A);l=Math.exp(l[3]);var F=0<C?l*Math.sin(C)/C:0;h[0]=v*F;h[1]=y*F;h[2]=A*F;h[3]=l*Math.cos(C);return h}function Ya(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=Math.sqrt(v*v+y*y+A*A);C=0<C?Math.atan2(C,l)/C:0;h[0]=v*C;h[1]=y*C;h[2]=A*C;h[3]=.5*Math.log(v*v+y*y+A*A+l*l);return h}function Ka(h,l,v,y){var A=l[0],C=l[1],F=l[2];l=l[3];var H=v[0],K=v[1],M=v[2];v=v[3];var Q=A*H+C*K+F*M+l*v;0>Q&&(Q=-Q,H=-H,K=-K,M=-M,v=-v);if(.000001<1-Q){var S=Math.acos(Q);var X=Math.sin(S);Q=Math.sin((1-y)*S)/X;y=
Math.sin(y*S)/X}else Q=1-y;h[0]=Q*A+y*H;h[1]=Q*C+y*K;h[2]=Q*F+y*M;h[3]=Q*l+y*v;return h}function Za(h,l){var v=l[0]+l[4]+l[8];if(0<v)v=Math.sqrt(v+1),h[3]=.5*v,v=.5/v,h[0]=(l[5]-l[7])*v,h[1]=(l[6]-l[2])*v,h[2]=(l[1]-l[3])*v;else{var y=0;l[4]>l[0]&&(y=1);l[8]>l[3*y+y]&&(y=2);var A=(y+1)%3,C=(y+2)%3;v=Math.sqrt(l[3*y+y]-l[3*A+A]-l[3*C+C]+1);h[y]=.5*v;v=.5/v;h[3]=(l[3*A+C]-l[3*C+A])*v;h[A]=(l[3*A+y]+l[3*y+A])*v;h[C]=(l[3*C+y]+l[3*y+C])*v}return h}function $a(h,l,v){var y=.5*v[0],A=.5*v[1];v=.5*v[2];
var C=l[0],F=l[1],H=l[2];l=l[3];h[0]=C;h[1]=F;h[2]=H;h[3]=l;h[4]=y*l+A*H-v*F;h[5]=A*l+v*C-y*H;h[6]=v*l+y*F-A*C;h[7]=-y*C-A*F-v*H;return h}function ab(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=l[4];h[5]=l[5];h[6]=l[6];h[7]=l[7];return h}function bb(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=v[4],K=v[5],M=v[6],Q=v[7],S=l[4],X=l[5],U=l[6];l=l[7];var ca=v[0],ba=v[1],Z=v[2];v=v[3];h[0]=y*v+F*ca+A*Z-C*ba;h[1]=A*v+F*ba+C*ca-y*Z;h[2]=C*v+F*Z+y*ba-A*ca;h[3]=F*v-y*ca-A*ba-C*Z;h[4]=y*Q+F*H+A*M-C*K+S*v+
l*ca+X*Z-U*ba;h[5]=A*Q+F*K+C*H-y*M+X*v+l*ba+U*ca-S*Z;h[6]=C*Q+F*M+y*K-A*H+U*v+l*Z+S*ba-X*ca;h[7]=F*Q-y*H-A*K-C*M+l*v-S*ca-X*ba-U*Z;return h}function cb(){var h=new ma(2);ma!=Float32Array&&(h[0]=0,h[1]=0);return h}function db(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];return h}function eb(h,l,v){h[0]=l[0]*v[0];h[1]=l[1]*v[1];return h}function fb(h,l,v){h[0]=l[0]/v[0];h[1]=l[1]/v[1];return h}function gb(h,l){return Math.hypot(l[0]-h[0],l[1]-h[1])}function hb(h,l){var v=l[0]-h[0];h=l[1]-h[1];return v*v+h*
h}function ib(h){return Math.hypot(h[0],h[1])}function jb(h){var l=h[0];h=h[1];return l*l+h*h}var ma="undefined"!==typeof Float32Array?Float32Array:Array,Ga=Math.random,kb=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var h=0,l=arguments.length;l--;)h+=arguments[l]*arguments[l];return Math.sqrt(h)});var lb=Object.freeze({__proto__:null,EPSILON:.000001,get ARRAY_TYPE(){return ma},RANDOM:Ga,setMatrixArrayType:function(h){ma=h},toRadian:function(h){return h*kb},equals:function(h,l){return Math.abs(h-
l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))}}),mb=Object.freeze({__proto__:null,create:function(){var h=new ma(4);ma!=Float32Array&&(h[1]=0,h[2]=0);h[0]=1;h[3]=1;return h},clone:function(h){var l=new ma(4);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];return l},copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=1;return h},fromValues:function(h,l,v,y){var A=new ma(4);A[0]=h;A[1]=l;A[2]=v;A[3]=y;return A},set:function(h,l,v,y,A){h[0]=l;
h[1]=v;h[2]=y;h[3]=A;return h},transpose:function(h,l){if(h===l){var v=l[1];h[1]=l[2];h[2]=v}else h[0]=l[0],h[1]=l[2],h[2]=l[1],h[3]=l[3];return h},invert:function(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v*l-A*y;if(!C)return null;C=1/C;h[0]=l*C;h[1]=-y*C;h[2]=-A*C;h[3]=v*C;return h},adjoint:function(h,l){var v=l[0];h[0]=l[3];h[1]=-l[1];h[2]=-l[2];h[3]=v;return h},determinant:function(h){return h[0]*h[3]-h[2]*h[1]},multiply:b,rotate:function(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];var F=Math.sin(v);
v=Math.cos(v);h[0]=y*v+C*F;h[1]=A*v+l*F;h[2]=y*-F+C*v;h[3]=A*-F+l*v;return h},scale:function(h,l,v){var y=l[1],A=l[2],C=l[3],F=v[0];v=v[1];h[0]=l[0]*F;h[1]=y*F;h[2]=A*v;h[3]=C*v;return h},fromRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=v;h[2]=-v;h[3]=l;return h},fromScaling:function(h,l){h[0]=l[0];h[1]=0;h[2]=0;h[3]=l[1];return h},str:function(h){return"mat2("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3])},LDU:function(h,l,v,
y){h[2]=y[2]/y[0];v[0]=y[0];v[1]=y[1];v[3]=y[3]-h[2]*v[1];return[h,l,v]},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];return h},subtract:a,exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]},equals:function(h,l){var v=h[0],y=h[1],A=h[2];h=h[3];var C=l[0],F=l[1],H=l[2];l=l[3];return Math.abs(v-C)<=.000001*Math.max(1,Math.abs(v),Math.abs(C))&&Math.abs(y-F)<=.000001*Math.max(1,Math.abs(y),Math.abs(F))&&Math.abs(A-H)<=.000001*Math.max(1,
Math.abs(A),Math.abs(H))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},multiplyScalar:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;return h},multiplyScalarAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;return h},mul:b,sub:a}),nb=Object.freeze({__proto__:null,create:function(){var h=new ma(6);ma!=Float32Array&&(h[1]=0,h[2]=0,h[4]=0,h[5]=0);h[0]=1;h[3]=1;return h},clone:function(h){var l=new ma(6);l[0]=h[0];l[1]=h[1];l[2]=
h[2];l[3]=h[3];l[4]=h[4];l[5]=h[5];return l},copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=l[4];h[5]=l[5];return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=1;h[4]=0;h[5]=0;return h},fromValues:function(h,l,v,y,A,C){var F=new ma(6);F[0]=h;F[1]=l;F[2]=v;F[3]=y;F[4]=A;F[5]=C;return F},set:function(h,l,v,y,A,C,F){h[0]=l;h[1]=v;h[2]=y;h[3]=A;h[4]=C;h[5]=F;return h},invert:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4];l=l[5];var H=v*C-y*A;if(!H)return null;H=1/H;h[0]=C*H;
h[1]=-y*H;h[2]=-A*H;h[3]=v*H;h[4]=(A*l-C*F)*H;h[5]=(y*F-v*l)*H;return h},determinant:function(h){return h[0]*h[3]-h[1]*h[2]},multiply:d,rotate:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4];l=l[5];var K=Math.sin(v);v=Math.cos(v);h[0]=y*v+C*K;h[1]=A*v+F*K;h[2]=y*-K+C*v;h[3]=A*-K+F*v;h[4]=H;h[5]=l;return h},scale:function(h,l,v){var y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=v[0];v=v[1];h[0]=l[0]*K;h[1]=y*K;h[2]=A*v;h[3]=C*v;h[4]=F;h[5]=H;return h},translate:function(h,l,v){var y=l[0],A=l[1],C=l[2],
F=l[3],H=l[4];l=l[5];var K=v[0];v=v[1];h[0]=y;h[1]=A;h[2]=C;h[3]=F;h[4]=y*K+C*v+H;h[5]=A*K+F*v+l;return h},fromRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=v;h[2]=-v;h[3]=l;h[4]=0;h[5]=0;return h},fromScaling:function(h,l){h[0]=l[0];h[1]=0;h[2]=0;h[3]=l[1];h[4]=0;h[5]=0;return h},fromTranslation:function(h,l){h[0]=1;h[1]=0;h[2]=0;h[3]=1;h[4]=l[0];h[5]=l[1];return h},str:function(h){return"mat2d("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+")"},frob:function(h){return Math.hypot(h[0],
h[1],h[2],h[3],h[4],h[5],1)},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];h[4]=l[4]+v[4];h[5]=l[5]+v[5];return h},subtract:c,multiplyScalar:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;h[4]=l[4]*v;h[5]=l[5]*v;return h},multiplyScalarAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;h[4]=l[4]+v[4]*y;h[5]=l[5]+v[5]*y;return h},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===
l[3]&&h[4]===l[4]&&h[5]===l[5]},equals:function(h,l){var v=h[0],y=h[1],A=h[2],C=h[3],F=h[4];h=h[5];var H=l[0],K=l[1],M=l[2],Q=l[3],S=l[4];l=l[5];return Math.abs(v-H)<=.000001*Math.max(1,Math.abs(v),Math.abs(H))&&Math.abs(y-K)<=.000001*Math.max(1,Math.abs(y),Math.abs(K))&&Math.abs(A-M)<=.000001*Math.max(1,Math.abs(A),Math.abs(M))&&Math.abs(C-Q)<=.000001*Math.max(1,Math.abs(C),Math.abs(Q))&&Math.abs(F-S)<=.000001*Math.max(1,Math.abs(F),Math.abs(S))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},
mul:d,sub:c}),ob=Object.freeze({__proto__:null,create:e,fromMat4:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[4];h[4]=l[5];h[5]=l[6];h[6]=l[8];h[7]=l[9];h[8]=l[10];return h},clone:function(h){var l=new ma(9);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];l[4]=h[4];l[5]=h[5];l[6]=h[6];l[7]=h[7];l[8]=h[8];return l},copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=l[4];h[5]=l[5];h[6]=l[6];h[7]=l[7];h[8]=l[8];return h},fromValues:function(h,l,v,y,A,C,F,H,K){var M=new ma(9);M[0]=h;M[1]=l;
M[2]=v;M[3]=y;M[4]=A;M[5]=C;M[6]=F;M[7]=H;M[8]=K;return M},set:function(h,l,v,y,A,C,F,H,K,M){h[0]=l;h[1]=v;h[2]=y;h[3]=A;h[4]=C;h[5]=F;h[6]=H;h[7]=K;h[8]=M;return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=1;h[5]=0;h[6]=0;h[7]=0;h[8]=1;return h},transpose:function(h,l){if(h===l){var v=l[1],y=l[2],A=l[5];h[1]=l[3];h[2]=l[6];h[3]=v;h[5]=l[7];h[6]=y;h[7]=A}else h[0]=l[0],h[1]=l[3],h[2]=l[6],h[3]=l[1],h[4]=l[4],h[5]=l[7],h[6]=l[2],h[7]=l[5],h[8]=l[8];return h},invert:function(h,l){var v=
l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7];l=l[8];var Q=l*F-H*M,S=-l*C+H*K,X=M*C-F*K,U=v*Q+y*S+A*X;if(!U)return null;U=1/U;h[0]=Q*U;h[1]=(-l*y+A*M)*U;h[2]=(H*y-A*F)*U;h[3]=S*U;h[4]=(l*v-A*K)*U;h[5]=(-H*v+A*C)*U;h[6]=X*U;h[7]=(-M*v+y*K)*U;h[8]=(F*v-y*C)*U;return h},adjoint:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7];l=l[8];h[0]=F*l-H*M;h[1]=A*M-y*l;h[2]=y*H-A*F;h[3]=H*K-C*l;h[4]=v*l-A*K;h[5]=A*C-v*H;h[6]=C*M-F*K;h[7]=y*K-v*M;h[8]=v*F-y*C;return h},determinant:function(h){var l=
h[3],v=h[4],y=h[5],A=h[6],C=h[7],F=h[8];return h[0]*(F*v-y*C)+h[1]*(-F*l+y*A)+h[2]*(C*l-v*A)},multiply:g,translate:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7];l=l[8];var S=v[0];v=v[1];h[0]=y;h[1]=A;h[2]=C;h[3]=F;h[4]=H;h[5]=K;h[6]=S*y+v*F+M;h[7]=S*A+v*H+Q;h[8]=S*C+v*K+l;return h},rotate:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7];l=l[8];var S=Math.sin(v);v=Math.cos(v);h[0]=v*y+S*F;h[1]=v*A+S*H;h[2]=v*C+S*K;h[3]=v*F-S*y;h[4]=v*H-S*A;h[5]=
v*K-S*C;h[6]=M;h[7]=Q;h[8]=l;return h},scale:function(h,l,v){var y=v[0];v=v[1];h[0]=y*l[0];h[1]=y*l[1];h[2]=y*l[2];h[3]=v*l[3];h[4]=v*l[4];h[5]=v*l[5];h[6]=l[6];h[7]=l[7];h[8]=l[8];return h},fromTranslation:function(h,l){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=1;h[5]=0;h[6]=l[0];h[7]=l[1];h[8]=1;return h},fromRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=v;h[2]=0;h[3]=-v;h[4]=l;h[5]=0;h[6]=0;h[7]=0;h[8]=1;return h},fromScaling:function(h,l){h[0]=l[0];h[1]=0;h[2]=0;h[3]=0;h[4]=l[1];h[5]=
0;h[6]=0;h[7]=0;h[8]=1;return h},fromMat2d:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=0;h[3]=l[2];h[4]=l[3];h[5]=0;h[6]=l[4];h[7]=l[5];h[8]=1;return h},fromQuat:function(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v+v,F=y+y,H=A+A;v*=C;var K=y*C;y*=F;var M=A*C,Q=A*F;A*=H;C*=l;F*=l;l*=H;h[0]=1-y-A;h[3]=K-l;h[6]=M+F;h[1]=K+l;h[4]=1-v-A;h[7]=Q-C;h[2]=M-F;h[5]=Q+C;h[8]=1-v-y;return h},normalFromMat4:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7],Q=l[8],S=l[9],X=l[10],U=l[11],ca=l[12],
ba=l[13],Z=l[14];l=l[15];var ra=v*H-y*F,la=v*K-A*F,oa=v*M-C*F,pa=y*K-A*H,na=y*M-C*H,za=A*M-C*K,L=Q*ba-S*ca,N=Q*Z-X*ca;Q=Q*l-U*ca;var V=S*Z-X*ba;S=S*l-U*ba;X=X*l-U*Z;U=ra*X-la*S+oa*V+pa*Q-na*N+za*L;if(!U)return null;U=1/U;h[0]=(H*X-K*S+M*V)*U;h[1]=(K*Q-F*X-M*N)*U;h[2]=(F*S-H*Q+M*L)*U;h[3]=(A*S-y*X-C*V)*U;h[4]=(v*X-A*Q+C*N)*U;h[5]=(y*Q-v*S-C*L)*U;h[6]=(ba*za-Z*na+l*pa)*U;h[7]=(Z*oa-ca*za-l*la)*U;h[8]=(ca*na-ba*oa+l*ra)*U;return h},projection:function(h,l,v){h[0]=2/l;h[1]=0;h[2]=0;h[3]=0;h[4]=-2/v;h[5]=
0;h[6]=-1;h[7]=1;h[8]=1;return h},str:function(h){return"mat3("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+", "+h[8]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8])},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];h[4]=l[4]+v[4];h[5]=l[5]+v[5];h[6]=l[6]+v[6];h[7]=l[7]+v[7];h[8]=l[8]+v[8];return h},subtract:k,multiplyScalar:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;h[4]=l[4]*
v;h[5]=l[5]*v;h[6]=l[6]*v;h[7]=l[7]*v;h[8]=l[8]*v;return h},multiplyScalarAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;h[4]=l[4]+v[4]*y;h[5]=l[5]+v[5]*y;h[6]=l[6]+v[6]*y;h[7]=l[7]+v[7]*y;h[8]=l[8]+v[8]*y;return h},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]&&h[4]===l[4]&&h[5]===l[5]&&h[6]===l[6]&&h[7]===l[7]&&h[8]===l[8]},equals:function(h,l){var v=h[0],y=h[1],A=h[2],C=h[3],F=h[4],H=h[5],K=h[6],M=h[7];h=h[8];var Q=
l[0],S=l[1],X=l[2],U=l[3],ca=l[4],ba=l[5],Z=l[6],ra=l[7];l=l[8];return Math.abs(v-Q)<=.000001*Math.max(1,Math.abs(v),Math.abs(Q))&&Math.abs(y-S)<=.000001*Math.max(1,Math.abs(y),Math.abs(S))&&Math.abs(A-X)<=.000001*Math.max(1,Math.abs(A),Math.abs(X))&&Math.abs(C-U)<=.000001*Math.max(1,Math.abs(C),Math.abs(U))&&Math.abs(F-ca)<=.000001*Math.max(1,Math.abs(F),Math.abs(ca))&&Math.abs(H-ba)<=.000001*Math.max(1,Math.abs(H),Math.abs(ba))&&Math.abs(K-Z)<=.000001*Math.max(1,Math.abs(K),Math.abs(Z))&&Math.abs(M-
ra)<=.000001*Math.max(1,Math.abs(M),Math.abs(ra))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},mul:g,sub:k}),pb=Object.freeze({__proto__:null,create:function(){var h=new ma(16);ma!=Float32Array&&(h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[11]=0,h[12]=0,h[13]=0,h[14]=0);h[0]=1;h[5]=1;h[10]=1;h[15]=1;return h},clone:function(h){var l=new ma(16);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];l[4]=h[4];l[5]=h[5];l[6]=h[6];l[7]=h[7];l[8]=h[8];l[9]=h[9];l[10]=h[10];l[11]=h[11];l[12]=
h[12];l[13]=h[13];l[14]=h[14];l[15]=h[15];return l},copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=l[4];h[5]=l[5];h[6]=l[6];h[7]=l[7];h[8]=l[8];h[9]=l[9];h[10]=l[10];h[11]=l[11];h[12]=l[12];h[13]=l[13];h[14]=l[14];h[15]=l[15];return h},fromValues:function(h,l,v,y,A,C,F,H,K,M,Q,S,X,U,ca,ba){var Z=new ma(16);Z[0]=h;Z[1]=l;Z[2]=v;Z[3]=y;Z[4]=A;Z[5]=C;Z[6]=F;Z[7]=H;Z[8]=K;Z[9]=M;Z[10]=Q;Z[11]=S;Z[12]=X;Z[13]=U;Z[14]=ca;Z[15]=ba;return Z},set:function(h,l,v,y,A,C,F,H,K,M,Q,S,X,U,ca,ba,
Z){h[0]=l;h[1]=v;h[2]=y;h[3]=A;h[4]=C;h[5]=F;h[6]=H;h[7]=K;h[8]=M;h[9]=Q;h[10]=S;h[11]=X;h[12]=U;h[13]=ca;h[14]=ba;h[15]=Z;return h},identity:m,transpose:function(h,l){if(h===l){var v=l[1],y=l[2],A=l[3],C=l[6],F=l[7],H=l[11];h[1]=l[4];h[2]=l[8];h[3]=l[12];h[4]=v;h[6]=l[9];h[7]=l[13];h[8]=y;h[9]=C;h[11]=l[14];h[12]=A;h[13]=F;h[14]=H}else h[0]=l[0],h[1]=l[4],h[2]=l[8],h[3]=l[12],h[4]=l[1],h[5]=l[5],h[6]=l[9],h[7]=l[13],h[8]=l[2],h[9]=l[6],h[10]=l[10],h[11]=l[14],h[12]=l[3],h[13]=l[7],h[14]=l[11],h[15]=
l[15];return h},invert:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7],Q=l[8],S=l[9],X=l[10],U=l[11],ca=l[12],ba=l[13],Z=l[14];l=l[15];var ra=v*H-y*F,la=v*K-A*F,oa=v*M-C*F,pa=y*K-A*H,na=y*M-C*H,za=A*M-C*K,L=Q*ba-S*ca,N=Q*Z-X*ca,V=Q*l-U*ca,aa=S*Z-X*ba,fa=S*l-U*ba,ha=X*l-U*Z,da=ra*ha-la*fa+oa*aa+pa*V-na*N+za*L;if(!da)return null;da=1/da;h[0]=(H*ha-K*fa+M*aa)*da;h[1]=(A*fa-y*ha-C*aa)*da;h[2]=(ba*za-Z*na+l*pa)*da;h[3]=(X*na-S*za-U*pa)*da;h[4]=(K*V-F*ha-M*N)*da;h[5]=(v*ha-A*V+
C*N)*da;h[6]=(Z*oa-ca*za-l*la)*da;h[7]=(Q*za-X*oa+U*la)*da;h[8]=(F*fa-H*V+M*L)*da;h[9]=(y*V-v*fa-C*L)*da;h[10]=(ca*na-ba*oa+l*ra)*da;h[11]=(S*oa-Q*na-U*ra)*da;h[12]=(H*N-F*aa-K*L)*da;h[13]=(v*aa-y*N+A*L)*da;h[14]=(ba*la-ca*pa-Z*ra)*da;h[15]=(Q*pa-S*la+X*ra)*da;return h},adjoint:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7],Q=l[8],S=l[9],X=l[10],U=l[11],ca=l[12],ba=l[13],Z=l[14];l=l[15];h[0]=H*(X*l-U*Z)-S*(K*l-M*Z)+ba*(K*U-M*X);h[1]=-(y*(X*l-U*Z)-S*(A*l-C*Z)+ba*(A*U-C*X));
h[2]=y*(K*l-M*Z)-H*(A*l-C*Z)+ba*(A*M-C*K);h[3]=-(y*(K*U-M*X)-H*(A*U-C*X)+S*(A*M-C*K));h[4]=-(F*(X*l-U*Z)-Q*(K*l-M*Z)+ca*(K*U-M*X));h[5]=v*(X*l-U*Z)-Q*(A*l-C*Z)+ca*(A*U-C*X);h[6]=-(v*(K*l-M*Z)-F*(A*l-C*Z)+ca*(A*M-C*K));h[7]=v*(K*U-M*X)-F*(A*U-C*X)+Q*(A*M-C*K);h[8]=F*(S*l-U*ba)-Q*(H*l-M*ba)+ca*(H*U-M*S);h[9]=-(v*(S*l-U*ba)-Q*(y*l-C*ba)+ca*(y*U-C*S));h[10]=v*(H*l-M*ba)-F*(y*l-C*ba)+ca*(y*M-C*H);h[11]=-(v*(H*U-M*S)-F*(y*U-C*S)+Q*(y*M-C*H));h[12]=-(F*(S*Z-X*ba)-Q*(H*Z-K*ba)+ca*(H*X-K*S));h[13]=v*(S*Z-
X*ba)-Q*(y*Z-A*ba)+ca*(y*X-A*S);h[14]=-(v*(H*Z-K*ba)-F*(y*Z-A*ba)+ca*(y*K-A*H));h[15]=v*(H*X-K*S)-F*(y*X-A*S)+Q*(y*K-A*H);return h},determinant:function(h){var l=h[0],v=h[1],y=h[2],A=h[3],C=h[4],F=h[5],H=h[6],K=h[7],M=h[8],Q=h[9],S=h[10],X=h[11],U=h[12],ca=h[13],ba=h[14];h=h[15];return(l*F-v*C)*(S*h-X*ba)-(l*H-y*C)*(Q*h-X*ca)+(l*K-A*C)*(Q*ba-S*ca)+(v*H-y*F)*(M*h-X*U)-(v*K-A*F)*(M*ba-S*U)+(y*K-A*H)*(M*ca-Q*U)},multiply:p,translate:function(h,l,v){var y=v[0],A=v[1];v=v[2];if(l===h)h[12]=l[0]*y+l[4]*
A+l[8]*v+l[12],h[13]=l[1]*y+l[5]*A+l[9]*v+l[13],h[14]=l[2]*y+l[6]*A+l[10]*v+l[14],h[15]=l[3]*y+l[7]*A+l[11]*v+l[15];else{var C=l[0];var F=l[1];var H=l[2];var K=l[3];var M=l[4];var Q=l[5];var S=l[6];var X=l[7];var U=l[8];var ca=l[9];var ba=l[10];var Z=l[11];h[0]=C;h[1]=F;h[2]=H;h[3]=K;h[4]=M;h[5]=Q;h[6]=S;h[7]=X;h[8]=U;h[9]=ca;h[10]=ba;h[11]=Z;h[12]=C*y+M*A+U*v+l[12];h[13]=F*y+Q*A+ca*v+l[13];h[14]=H*y+S*A+ba*v+l[14];h[15]=K*y+X*A+Z*v+l[15]}return h},scale:function(h,l,v){var y=v[0],A=v[1];v=v[2];h[0]=
l[0]*y;h[1]=l[1]*y;h[2]=l[2]*y;h[3]=l[3]*y;h[4]=l[4]*A;h[5]=l[5]*A;h[6]=l[6]*A;h[7]=l[7]*A;h[8]=l[8]*v;h[9]=l[9]*v;h[10]=l[10]*v;h[11]=l[11]*v;h[12]=l[12];h[13]=l[13];h[14]=l[14];h[15]=l[15];return h},rotate:function(h,l,v,y){var A=y[0],C=y[1];y=y[2];var F=Math.hypot(A,C,y);if(.000001>F)return null;F=1/F;A*=F;C*=F;y*=F;var H=Math.sin(v);var K=Math.cos(v);var M=1-K;v=l[0];F=l[1];var Q=l[2];var S=l[3];var X=l[4];var U=l[5];var ca=l[6];var ba=l[7];var Z=l[8];var ra=l[9];var la=l[10];var oa=l[11];var pa=
A*A*M+K;var na=C*A*M+y*H;var za=y*A*M-C*H;var L=A*C*M-y*H;var N=C*C*M+K;var V=y*C*M+A*H;var aa=A*y*M+C*H;A=C*y*M-A*H;C=y*y*M+K;h[0]=v*pa+X*na+Z*za;h[1]=F*pa+U*na+ra*za;h[2]=Q*pa+ca*na+la*za;h[3]=S*pa+ba*na+oa*za;h[4]=v*L+X*N+Z*V;h[5]=F*L+U*N+ra*V;h[6]=Q*L+ca*N+la*V;h[7]=S*L+ba*N+oa*V;h[8]=v*aa+X*A+Z*C;h[9]=F*aa+U*A+ra*C;h[10]=Q*aa+ca*A+la*C;h[11]=S*aa+ba*A+oa*C;l!==h&&(h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]);return h},rotateX:function(h,l,v){var y=Math.sin(v);v=Math.cos(v);var A=l[4],C=l[5],
F=l[6],H=l[7],K=l[8],M=l[9],Q=l[10],S=l[11];l!==h&&(h[0]=l[0],h[1]=l[1],h[2]=l[2],h[3]=l[3],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]);h[4]=A*v+K*y;h[5]=C*v+M*y;h[6]=F*v+Q*y;h[7]=H*v+S*y;h[8]=K*v-A*y;h[9]=M*v-C*y;h[10]=Q*v-F*y;h[11]=S*v-H*y;return h},rotateY:function(h,l,v){var y=Math.sin(v);v=Math.cos(v);var A=l[0],C=l[1],F=l[2],H=l[3],K=l[8],M=l[9],Q=l[10],S=l[11];l!==h&&(h[4]=l[4],h[5]=l[5],h[6]=l[6],h[7]=l[7],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]);h[0]=A*v-K*y;h[1]=C*v-M*y;h[2]=
F*v-Q*y;h[3]=H*v-S*y;h[8]=A*y+K*v;h[9]=C*y+M*v;h[10]=F*y+Q*v;h[11]=H*y+S*v;return h},rotateZ:function(h,l,v){var y=Math.sin(v);v=Math.cos(v);var A=l[0],C=l[1],F=l[2],H=l[3],K=l[4],M=l[5],Q=l[6],S=l[7];l!==h&&(h[8]=l[8],h[9]=l[9],h[10]=l[10],h[11]=l[11],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]);h[0]=A*v+K*y;h[1]=C*v+M*y;h[2]=F*v+Q*y;h[3]=H*v+S*y;h[4]=K*v-A*y;h[5]=M*v-C*y;h[6]=Q*v-F*y;h[7]=S*v-H*y;return h},fromTranslation:function(h,l){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;
h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=l[0];h[13]=l[1];h[14]=l[2];h[15]=1;return h},fromScaling:function(h,l){h[0]=l[0];h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=l[1];h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=l[2];h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromRotation:function(h,l,v){var y=v[0],A=v[1];v=v[2];var C=Math.hypot(y,A,v);if(.000001>C)return null;C=1/C;y*=C;A*=C;v*=C;C=Math.sin(l);l=Math.cos(l);var F=1-l;h[0]=y*y*F+l;h[1]=A*y*F+v*C;h[2]=v*y*F-A*C;h[3]=0;h[4]=y*A*F-v*C;h[5]=A*A*F+l;h[6]=v*A*F+y*C;h[7]=
0;h[8]=y*v*F+A*C;h[9]=A*v*F-y*C;h[10]=v*v*F+l;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromXRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=l;h[6]=v;h[7]=0;h[8]=0;h[9]=-v;h[10]=l;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromYRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=0;h[2]=-v;h[3]=0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;h[8]=v;h[9]=0;h[10]=l;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromZRotation:function(h,l){var v=
Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=v;h[2]=0;h[3]=0;h[4]=-v;h[5]=l;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromRotationTranslation:n,fromQuat2:function(h,l){var v=new ma(3),y=-l[0],A=-l[1],C=-l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=y*y+A*A+C*C+F*F;0<S?(v[0]=2*(H*F+Q*y+K*C-M*A)/S,v[1]=2*(K*F+Q*A+M*y-H*C)/S,v[2]=2*(M*F+Q*C+H*A-K*y)/S):(v[0]=2*(H*F+Q*y+K*C-M*A),v[1]=2*(K*F+Q*A+M*y-H*C),v[2]=2*(M*F+Q*C+H*A-K*y));n(h,l,v);return h},getTranslation:u,getScaling:q,
getRotation:r,fromRotationTranslationScale:function(h,l,v,y){var A=l[0],C=l[1],F=l[2],H=l[3],K=A+A,M=C+C,Q=F+F;l=A*K;var S=A*M;A*=Q;var X=C*M;C*=Q;F*=Q;K*=H;M*=H;H*=Q;Q=y[0];var U=y[1];y=y[2];h[0]=(1-(X+F))*Q;h[1]=(S+H)*Q;h[2]=(A-M)*Q;h[3]=0;h[4]=(S-H)*U;h[5]=(1-(l+F))*U;h[6]=(C+K)*U;h[7]=0;h[8]=(A+M)*y;h[9]=(C-K)*y;h[10]=(1-(l+X))*y;h[11]=0;h[12]=v[0];h[13]=v[1];h[14]=v[2];h[15]=1;return h},fromRotationTranslationScaleOrigin:function(h,l,v,y,A){var C=l[0],F=l[1],H=l[2],K=l[3],M=C+C,Q=F+F,S=H+H;l=
C*M;var X=C*Q,U=C*S;C=F*Q;F*=S;var ca=H*S;H=K*M;Q*=K;var ba=K*S,Z=y[0],ra=y[1];S=y[2];y=A[0];K=A[1];A=A[2];M=(1-(C+ca))*Z;var la=(X+ba)*Z;Z*=U-Q;X=(X-ba)*ra;ca=(1-(l+ca))*ra;ra*=F+H;U=(U+Q)*S;F=(F-H)*S;l=(1-(l+C))*S;h[0]=M;h[1]=la;h[2]=Z;h[3]=0;h[4]=X;h[5]=ca;h[6]=ra;h[7]=0;h[8]=U;h[9]=F;h[10]=l;h[11]=0;h[12]=v[0]+y-(M*y+X*K+U*A);h[13]=v[1]+K-(la*y+ca*K+F*A);h[14]=v[2]+A-(Z*y+ra*K+l*A);h[15]=1;return h},fromQuat:function(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v+v,F=y+y,H=A+A;v*=C;var K=y*C;y*=
F;var M=A*C,Q=A*F;A*=H;C*=l;F*=l;l*=H;h[0]=1-y-A;h[1]=K+l;h[2]=M-F;h[3]=0;h[4]=K-l;h[5]=1-v-A;h[6]=Q+C;h[7]=0;h[8]=M+F;h[9]=Q-C;h[10]=1-v-y;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},frustum:function(h,l,v,y,A,C,F){var H=1/(v-l),K=1/(A-y),M=1/(C-F);h[0]=2*C*H;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=2*C*K;h[6]=0;h[7]=0;h[8]=(v+l)*H;h[9]=(A+y)*K;h[10]=(F+C)*M;h[11]=-1;h[12]=0;h[13]=0;h[14]=F*C*2*M;h[15]=0;return h},perspective:function(h,l,v,y,A){l=1/Math.tan(l/2);h[0]=l/v;h[1]=0;h[2]=0;h[3]=0;h[4]=
0;h[5]=l;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[11]=-1;h[12]=0;h[13]=0;h[15]=0;null!=A&&Infinity!==A?(v=1/(y-A),h[10]=(A+y)*v,h[14]=2*A*y*v):(h[10]=-1,h[14]=-2*y);return h},perspectiveFromFieldOfView:function(h,l,v,y){var A=Math.tan(l.upDegrees*Math.PI/180),C=Math.tan(l.downDegrees*Math.PI/180),F=Math.tan(l.leftDegrees*Math.PI/180);l=Math.tan(l.rightDegrees*Math.PI/180);var H=2/(F+l),K=2/(A+C);h[0]=H;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=K;h[6]=0;h[7]=0;h[8]=-((F-l)*H*.5);h[9]=(A-C)*K*.5;h[10]=y/(v-y);h[11]=-1;
h[12]=0;h[13]=0;h[14]=y*v/(v-y);h[15]=0;return h},ortho:function(h,l,v,y,A,C,F){var H=1/(l-v),K=1/(y-A),M=1/(C-F);h[0]=-2*H;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=-2*K;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=2*M;h[11]=0;h[12]=(l+v)*H;h[13]=(A+y)*K;h[14]=(F+C)*M;h[15]=1;return h},lookAt:function(h,l,v,y){var A=l[0],C=l[1];l=l[2];var F=y[0];var H=y[1];var K=y[2];var M=v[0];y=v[1];var Q=v[2];if(.000001>Math.abs(A-M)&&.000001>Math.abs(C-y)&&.000001>Math.abs(l-Q))return m(h);v=A-M;y=C-y;M=l-Q;var S=1/Math.hypot(v,
y,M);v*=S;y*=S;M*=S;Q=H*M-K*y;K=K*v-F*M;F=F*y-H*v;(S=Math.hypot(Q,K,F))?(S=1/S,Q*=S,K*=S,F*=S):F=K=Q=0;H=y*F-M*K;var X=M*Q-v*F;var U=v*K-y*Q;(S=Math.hypot(H,X,U))?(S=1/S,H*=S,X*=S,U*=S):U=X=H=0;h[0]=Q;h[1]=H;h[2]=v;h[3]=0;h[4]=K;h[5]=X;h[6]=y;h[7]=0;h[8]=F;h[9]=U;h[10]=M;h[11]=0;h[12]=-(Q*A+K*C+F*l);h[13]=-(H*A+X*C+U*l);h[14]=-(v*A+y*C+M*l);h[15]=1;return h},targetTo:function(h,l,v,y){var A=l[0],C=l[1];l=l[2];var F=y[0],H=y[1],K=y[2];y=A-v[0];var M=C-v[1];v=l-v[2];var Q=y*y+M*M+v*v;0<Q&&(Q=1/Math.sqrt(Q),
y*=Q,M*=Q,v*=Q);var S=H*v-K*M;K=K*y-F*v;F=F*M-H*y;Q=S*S+K*K+F*F;0<Q&&(Q=1/Math.sqrt(Q),S*=Q,K*=Q,F*=Q);h[0]=S;h[1]=K;h[2]=F;h[3]=0;h[4]=M*F-v*K;h[5]=v*S-y*F;h[6]=y*K-M*S;h[7]=0;h[8]=y;h[9]=M;h[10]=v;h[11]=0;h[12]=A;h[13]=C;h[14]=l;h[15]=1;return h},str:function(h){return"mat4("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+", "+h[8]+", "+h[9]+", "+h[10]+", "+h[11]+", "+h[12]+", "+h[13]+", "+h[14]+", "+h[15]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3],h[4],
h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15])},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];h[4]=l[4]+v[4];h[5]=l[5]+v[5];h[6]=l[6]+v[6];h[7]=l[7]+v[7];h[8]=l[8]+v[8];h[9]=l[9]+v[9];h[10]=l[10]+v[10];h[11]=l[11]+v[11];h[12]=l[12]+v[12];h[13]=l[13]+v[13];h[14]=l[14]+v[14];h[15]=l[15]+v[15];return h},subtract:t,multiplyScalar:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;h[4]=l[4]*v;h[5]=l[5]*v;h[6]=l[6]*v;h[7]=l[7]*v;h[8]=l[8]*v;
h[9]=l[9]*v;h[10]=l[10]*v;h[11]=l[11]*v;h[12]=l[12]*v;h[13]=l[13]*v;h[14]=l[14]*v;h[15]=l[15]*v;return h},multiplyScalarAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;h[4]=l[4]+v[4]*y;h[5]=l[5]+v[5]*y;h[6]=l[6]+v[6]*y;h[7]=l[7]+v[7]*y;h[8]=l[8]+v[8]*y;h[9]=l[9]+v[9]*y;h[10]=l[10]+v[10]*y;h[11]=l[11]+v[11]*y;h[12]=l[12]+v[12]*y;h[13]=l[13]+v[13]*y;h[14]=l[14]+v[14]*y;h[15]=l[15]+v[15]*y;return h},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&
h[2]===l[2]&&h[3]===l[3]&&h[4]===l[4]&&h[5]===l[5]&&h[6]===l[6]&&h[7]===l[7]&&h[8]===l[8]&&h[9]===l[9]&&h[10]===l[10]&&h[11]===l[11]&&h[12]===l[12]&&h[13]===l[13]&&h[14]===l[14]&&h[15]===l[15]},equals:function(h,l){var v=h[0],y=h[1],A=h[2],C=h[3],F=h[4],H=h[5],K=h[6],M=h[7],Q=h[8],S=h[9],X=h[10],U=h[11],ca=h[12],ba=h[13],Z=h[14];h=h[15];var ra=l[0],la=l[1],oa=l[2],pa=l[3],na=l[4],za=l[5],L=l[6],N=l[7],V=l[8],aa=l[9],fa=l[10],ha=l[11],da=l[12],sa=l[13],ta=l[14];l=l[15];return Math.abs(v-ra)<=.000001*
Math.max(1,Math.abs(v),Math.abs(ra))&&Math.abs(y-la)<=.000001*Math.max(1,Math.abs(y),Math.abs(la))&&Math.abs(A-oa)<=.000001*Math.max(1,Math.abs(A),Math.abs(oa))&&Math.abs(C-pa)<=.000001*Math.max(1,Math.abs(C),Math.abs(pa))&&Math.abs(F-na)<=.000001*Math.max(1,Math.abs(F),Math.abs(na))&&Math.abs(H-za)<=.000001*Math.max(1,Math.abs(H),Math.abs(za))&&Math.abs(K-L)<=.000001*Math.max(1,Math.abs(K),Math.abs(L))&&Math.abs(M-N)<=.000001*Math.max(1,Math.abs(M),Math.abs(N))&&Math.abs(Q-V)<=.000001*Math.max(1,
Math.abs(Q),Math.abs(V))&&Math.abs(S-aa)<=.000001*Math.max(1,Math.abs(S),Math.abs(aa))&&Math.abs(X-fa)<=.000001*Math.max(1,Math.abs(X),Math.abs(fa))&&Math.abs(U-ha)<=.000001*Math.max(1,Math.abs(U),Math.abs(ha))&&Math.abs(ca-da)<=.000001*Math.max(1,Math.abs(ca),Math.abs(da))&&Math.abs(ba-sa)<=.000001*Math.max(1,Math.abs(ba),Math.abs(sa))&&Math.abs(Z-ta)<=.000001*Math.max(1,Math.abs(Z),Math.abs(ta))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},mul:p,sub:t}),La=function(){var h=x();return function(l,
v,y,A,C,F){v||(v=3);y||(y=0);for(A=A?Math.min(A*v+y,l.length):l.length;y<A;y+=v)h[0]=l[y],h[1]=l[y+1],h[2]=l[y+2],C(h,h,F),l[y]=h[0],l[y+1]=h[1],l[y+2]=h[2];return l}}();La=Object.freeze({__proto__:null,create:x,clone:function(h){var l=new ma(3);l[0]=h[0];l[1]=h[1];l[2]=h[2];return l},length:z,fromValues:D,copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];return h},set:function(h,l,v,y){h[0]=l;h[1]=v;h[2]=y;return h},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];return h},subtract:G,
multiply:w,divide:B,ceil:function(h,l){h[0]=Math.ceil(l[0]);h[1]=Math.ceil(l[1]);h[2]=Math.ceil(l[2]);return h},floor:function(h,l){h[0]=Math.floor(l[0]);h[1]=Math.floor(l[1]);h[2]=Math.floor(l[2]);return h},min:function(h,l,v){h[0]=Math.min(l[0],v[0]);h[1]=Math.min(l[1],v[1]);h[2]=Math.min(l[2],v[2]);return h},max:function(h,l,v){h[0]=Math.max(l[0],v[0]);h[1]=Math.max(l[1],v[1]);h[2]=Math.max(l[2],v[2]);return h},round:function(h,l){h[0]=Math.round(l[0]);h[1]=Math.round(l[1]);h[2]=Math.round(l[2]);
return h},scale:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;return h},scaleAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;return h},distance:I,squaredDistance:P,squaredLength:E,negate:function(h,l){h[0]=-l[0];h[1]=-l[1];h[2]=-l[2];return h},inverse:function(h,l){h[0]=1/l[0];h[1]=1/l[1];h[2]=1/l[2];return h},normalize:J,dot:O,cross:R,lerp:function(h,l,v,y){var A=l[0],C=l[1];l=l[2];h[0]=A+y*(v[0]-A);h[1]=C+y*(v[1]-C);h[2]=l+y*(v[2]-l);return h},hermite:function(h,
l,v,y,A,C){var F=C*C,H=F*(2*C-3)+1,K=F*(C-2)+C,M=F*(C-1);C=F*(3-2*C);h[0]=l[0]*H+v[0]*K+y[0]*M+A[0]*C;h[1]=l[1]*H+v[1]*K+y[1]*M+A[1]*C;h[2]=l[2]*H+v[2]*K+y[2]*M+A[2]*C;return h},bezier:function(h,l,v,y,A,C){var F=1-C,H=F*F,K=C*C,M=H*F;H*=3*C;F*=3*K;C*=K;h[0]=l[0]*M+v[0]*H+y[0]*F+A[0]*C;h[1]=l[1]*M+v[1]*H+y[1]*F+A[1]*C;h[2]=l[2]*M+v[2]*H+y[2]*F+A[2]*C;return h},random:function(h,l){l=l||1;var v=2*Ga()*Math.PI,y=2*Ga()-1,A=Math.sqrt(1-y*y)*l;h[0]=Math.cos(v)*A;h[1]=Math.sin(v)*A;h[2]=y*l;return h},
transformMat4:function(h,l,v){var y=l[0],A=l[1];l=l[2];var C=v[3]*y+v[7]*A+v[11]*l+v[15];C=C||1;h[0]=(v[0]*y+v[4]*A+v[8]*l+v[12])/C;h[1]=(v[1]*y+v[5]*A+v[9]*l+v[13])/C;h[2]=(v[2]*y+v[6]*A+v[10]*l+v[14])/C;return h},transformMat3:function(h,l,v){var y=l[0],A=l[1];l=l[2];h[0]=y*v[0]+A*v[3]+l*v[6];h[1]=y*v[1]+A*v[4]+l*v[7];h[2]=y*v[2]+A*v[5]+l*v[8];return h},transformQuat:function(h,l,v){var y=v[0],A=v[1],C=v[2],F=l[0],H=l[1];l=l[2];var K=A*l-C*H,M=C*F-y*l,Q=y*H-A*F;v=2*v[3];h[0]=F+K*v+2*(A*Q-C*M);h[1]=
H+M*v+2*(C*K-y*Q);h[2]=l+Q*v+2*(y*M-A*K);return h},rotateX:function(h,l,v,y){var A=[],C=[];A[0]=l[0]-v[0];A[1]=l[1]-v[1];A[2]=l[2]-v[2];C[0]=A[0];C[1]=A[1]*Math.cos(y)-A[2]*Math.sin(y);C[2]=A[1]*Math.sin(y)+A[2]*Math.cos(y);h[0]=C[0]+v[0];h[1]=C[1]+v[1];h[2]=C[2]+v[2];return h},rotateY:function(h,l,v,y){var A=[],C=[];A[0]=l[0]-v[0];A[1]=l[1]-v[1];A[2]=l[2]-v[2];C[0]=A[2]*Math.sin(y)+A[0]*Math.cos(y);C[1]=A[1];C[2]=A[2]*Math.cos(y)-A[0]*Math.sin(y);h[0]=C[0]+v[0];h[1]=C[1]+v[1];h[2]=C[2]+v[2];return h},
rotateZ:function(h,l,v,y){var A=[],C=[];A[0]=l[0]-v[0];A[1]=l[1]-v[1];A[2]=l[2]-v[2];C[0]=A[0]*Math.cos(y)-A[1]*Math.sin(y);C[1]=A[0]*Math.sin(y)+A[1]*Math.cos(y);C[2]=A[2];h[0]=C[0]+v[0];h[1]=C[1]+v[1];h[2]=C[2]+v[2];return h},angle:function(h,l){var v=h[0],y=h[1],A=h[2],C=l[0],F=l[1],H=l[2];h=(v=Math.sqrt(v*v+y*y+A*A)*Math.sqrt(C*C+F*F+H*H))&&O(h,l)/v;return Math.acos(Math.min(Math.max(h,-1),1))},zero:function(h){h[0]=0;h[1]=0;h[2]=0;return h},str:function(h){return"vec3("+h[0]+", "+h[1]+", "+h[2]+
")"},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]},equals:function(h,l){var v=h[0],y=h[1];h=h[2];var A=l[0],C=l[1];l=l[2];return Math.abs(v-A)<=.000001*Math.max(1,Math.abs(v),Math.abs(A))&&Math.abs(y-C)<=.000001*Math.max(1,Math.abs(y),Math.abs(C))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},sub:G,mul:w,div:B,dist:I,sqrDist:P,len:z,sqrLen:E,forEach:La});var Ma=function(){var h=T();return function(l,v,y,A,C,F){v||(v=4);y||(y=0);for(A=A?Math.min(A*v+y,l.length):
l.length;y<A;y+=v)h[0]=l[y],h[1]=l[y+1],h[2]=l[y+2],h[3]=l[y+3],C(h,h,F),l[y]=h[0],l[y+1]=h[1],l[y+2]=h[2],l[y+3]=h[3];return l}}();Ma=Object.freeze({__proto__:null,create:T,clone:Y,fromValues:W,copy:ea,set:qa,add:ja,subtract:xa,multiply:ua,divide:Da,ceil:function(h,l){h[0]=Math.ceil(l[0]);h[1]=Math.ceil(l[1]);h[2]=Math.ceil(l[2]);h[3]=Math.ceil(l[3]);return h},floor:function(h,l){h[0]=Math.floor(l[0]);h[1]=Math.floor(l[1]);h[2]=Math.floor(l[2]);h[3]=Math.floor(l[3]);return h},min:function(h,l,v){h[0]=
Math.min(l[0],v[0]);h[1]=Math.min(l[1],v[1]);h[2]=Math.min(l[2],v[2]);h[3]=Math.min(l[3],v[3]);return h},max:function(h,l,v){h[0]=Math.max(l[0],v[0]);h[1]=Math.max(l[1],v[1]);h[2]=Math.max(l[2],v[2]);h[3]=Math.max(l[3],v[3]);return h},round:function(h,l){h[0]=Math.round(l[0]);h[1]=Math.round(l[1]);h[2]=Math.round(l[2]);h[3]=Math.round(l[3]);return h},scale:Ea,scaleAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;return h},distance:Ba,squaredDistance:Aa,
length:ia,squaredLength:Fa,negate:function(h,l){h[0]=-l[0];h[1]=-l[1];h[2]=-l[2];h[3]=-l[3];return h},inverse:function(h,l){h[0]=1/l[0];h[1]=1/l[1];h[2]=1/l[2];h[3]=1/l[3];return h},normalize:wa,dot:Ca,cross:function(h,l,v,y){var A=v[0]*y[1]-v[1]*y[0],C=v[0]*y[2]-v[2]*y[0],F=v[0]*y[3]-v[3]*y[0],H=v[1]*y[2]-v[2]*y[1],K=v[1]*y[3]-v[3]*y[1];v=v[2]*y[3]-v[3]*y[2];y=l[0];var M=l[1],Q=l[2];l=l[3];h[0]=M*v-Q*K+l*H;h[1]=-(y*v)+Q*F-l*C;h[2]=y*K-M*F+l*A;h[3]=-(y*H)+M*C-Q*A;return h},lerp:Pa,random:function(h,
l){l=l||1;do{var v=2*Ga()-1;var y=2*Ga()-1;var A=v*v+y*y}while(1<=A);do{var C=2*Ga()-1;var F=2*Ga()-1;var H=C*C+F*F}while(1<=H);A=Math.sqrt((1-A)/H);h[0]=l*v;h[1]=l*y;h[2]=l*C*A;h[3]=l*F*A;return h},transformMat4:function(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];h[0]=v[0]*y+v[4]*A+v[8]*C+v[12]*l;h[1]=v[1]*y+v[5]*A+v[9]*C+v[13]*l;h[2]=v[2]*y+v[6]*A+v[10]*C+v[14]*l;h[3]=v[3]*y+v[7]*A+v[11]*C+v[15]*l;return h},transformQuat:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=v[0],H=v[1],K=v[2];v=v[3];var M=v*y+
H*C-K*A,Q=v*A+K*y-F*C,S=v*C+F*A-H*y;y=-F*y-H*A-K*C;h[0]=M*v+y*-F+Q*-K-S*-H;h[1]=Q*v+y*-H+S*-F-M*-K;h[2]=S*v+y*-K+M*-H-Q*-F;h[3]=l[3];return h},zero:function(h){h[0]=0;h[1]=0;h[2]=0;h[3]=0;return h},str:function(h){return"vec4("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},exactEquals:Qa,equals:Ra,sub:xa,mul:ua,div:Da,dist:Ba,sqrDist:Aa,len:ia,sqrLen:Fa,forEach:Ma});var Na=function(){var h=x(),l=D(1,0,0),v=D(0,1,0);return function(y,A,C){var F=O(A,C);if(-.999999>F)return R(h,l,A),.000001>z(h)&&R(h,v,A),
J(h,h),Sa(y,h,Math.PI),y;if(.999999<F)return y[0]=0,y[1]=0,y[2]=0,y[3]=1,y;R(h,A,C);y[0]=h[0];y[1]=h[1];y[2]=h[2];y[3]=1+F;return wa(y,y)}}(),Oa=function(){var h=Ja(),l=Ja();return function(v,y,A,C,F,H){Ka(h,y,F,H);Ka(l,A,C,H);Ka(v,h,l,2*H*(1-H));return v}}(),Ia=function(){var h=e();return function(l,v,y,A){h[0]=y[0];h[3]=y[1];h[6]=y[2];h[1]=A[0];h[4]=A[1];h[7]=A[2];h[2]=-v[0];h[5]=-v[1];h[8]=-v[2];return wa(l,Za(l,h))}}();Na=Object.freeze({__proto__:null,create:Ja,identity:function(h){h[0]=0;h[1]=
0;h[2]=0;h[3]=1;return h},setAxisAngle:Sa,getAxisAngle:function(h,l){var v=2*Math.acos(l[3]),y=Math.sin(v/2);.000001<y?(h[0]=l[0]/y,h[1]=l[1]/y,h[2]=l[2]/y):(h[0]=1,h[1]=0,h[2]=0);return v},getAngle:function(h,l){h=Ca(h,l);return Math.acos(2*h*h-1)},multiply:Ta,rotateX:Ua,rotateY:Va,rotateZ:Wa,calculateW:function(h,l){var v=l[0],y=l[1];l=l[2];h[0]=v;h[1]=y;h[2]=l;h[3]=Math.sqrt(Math.abs(1-v*v-y*y-l*l));return h},exp:Xa,ln:Ya,pow:function(h,l,v){Ya(h,l);Ea(h,h,v);Xa(h,h);return h},slerp:Ka,random:function(h){var l=
Ga(),v=Ga(),y=Ga(),A=Math.sqrt(1-l);l=Math.sqrt(l);h[0]=A*Math.sin(2*Math.PI*v);h[1]=A*Math.cos(2*Math.PI*v);h[2]=l*Math.sin(2*Math.PI*y);h[3]=l*Math.cos(2*Math.PI*y);return h},invert:function(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v*v+y*y+A*A+l*l;C=C?1/C:0;h[0]=-v*C;h[1]=-y*C;h[2]=-A*C;h[3]=l*C;return h},conjugate:function(h,l){h[0]=-l[0];h[1]=-l[1];h[2]=-l[2];h[3]=l[3];return h},fromMat3:Za,fromEuler:function(h,l,v,y){var A=.5*Math.PI/180;l*=A;v*=A;y*=A;A=Math.sin(l);l=Math.cos(l);var C=Math.sin(v);
v=Math.cos(v);var F=Math.sin(y);y=Math.cos(y);h[0]=A*v*y-l*C*F;h[1]=l*C*y+A*v*F;h[2]=l*v*F-A*C*y;h[3]=l*v*y+A*C*F;return h},str:function(h){return"quat("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},clone:Y,fromValues:W,copy:ea,set:qa,add:ja,mul:Ta,scale:Ea,dot:Ca,lerp:Pa,length:ia,len:ia,squaredLength:Fa,sqrLen:Fa,normalize:wa,exactEquals:Qa,equals:Ra,rotationTo:Na,sqlerp:Oa,setAxes:Ia});Oa=Object.freeze({__proto__:null,create:function(){var h=new ma(8);ma!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0,h[4]=0,
h[5]=0,h[6]=0,h[7]=0);h[3]=1;return h},clone:function(h){var l=new ma(8);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];l[4]=h[4];l[5]=h[5];l[6]=h[6];l[7]=h[7];return l},fromValues:function(h,l,v,y,A,C,F,H){var K=new ma(8);K[0]=h;K[1]=l;K[2]=v;K[3]=y;K[4]=A;K[5]=C;K[6]=F;K[7]=H;return K},fromRotationTranslationValues:function(h,l,v,y,A,C,F){var H=new ma(8);H[0]=h;H[1]=l;H[2]=v;H[3]=y;A*=.5;C*=.5;F*=.5;H[4]=A*y+C*v-F*l;H[5]=C*y+F*h-A*v;H[6]=F*y+A*l-C*h;H[7]=-A*h-C*l-F*v;return H},fromRotationTranslation:$a,
fromTranslation:function(h,l){h[0]=0;h[1]=0;h[2]=0;h[3]=1;h[4]=.5*l[0];h[5]=.5*l[1];h[6]=.5*l[2];h[7]=0;return h},fromRotation:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=0;h[5]=0;h[6]=0;h[7]=0;return h},fromMat4:function(h,l){var v=Ja();r(v,l);var y=new ma(3);u(y,l);$a(h,v,y);return h},copy:ab,identity:function(h){h[0]=0;h[1]=0;h[2]=0;h[3]=1;h[4]=0;h[5]=0;h[6]=0;h[7]=0;return h},set:function(h,l,v,y,A,C,F,H,K){h[0]=l;h[1]=v;h[2]=y;h[3]=A;h[4]=C;h[5]=F;h[6]=H;h[7]=K;return h},getReal:ea,
getDual:function(h,l){h[0]=l[4];h[1]=l[5];h[2]=l[6];h[3]=l[7];return h},setReal:ea,setDual:function(h,l){h[4]=l[0];h[5]=l[1];h[6]=l[2];h[7]=l[3];return h},getTranslation:function(h,l){var v=l[4],y=l[5],A=l[6],C=l[7],F=-l[0],H=-l[1],K=-l[2];l=l[3];h[0]=2*(v*l+C*F+y*K-A*H);h[1]=2*(y*l+C*H+A*F-v*K);h[2]=2*(A*l+C*K+v*H-y*F);return h},translate:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=.5*v[0],K=.5*v[1];v=.5*v[2];var M=l[4],Q=l[5],S=l[6];l=l[7];h[0]=y;h[1]=A;h[2]=C;h[3]=F;h[4]=F*H+A*v-C*K+M;h[5]=
F*K+C*H-y*v+Q;h[6]=F*v+y*K-A*H+S;h[7]=-y*H-A*K-C*v+l;return h},rotateX:function(h,l,v){var y=-l[0],A=-l[1],C=-l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=H*F+Q*y+K*C-M*A,X=K*F+Q*A+M*y-H*C,U=M*F+Q*C+H*A-K*y;H=Q*F-H*y-K*A-M*C;Ua(h,l,v);y=h[0];A=h[1];C=h[2];F=h[3];h[4]=S*F+H*y+X*C-U*A;h[5]=X*F+H*A+U*y-S*C;h[6]=U*F+H*C+S*A-X*y;h[7]=H*F-S*y-X*A-U*C;return h},rotateY:function(h,l,v){var y=-l[0],A=-l[1],C=-l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=H*F+Q*y+K*C-M*A,X=K*F+Q*A+M*y-H*C,U=M*F+Q*C+H*A-K*y;H=Q*F-
H*y-K*A-M*C;Va(h,l,v);y=h[0];A=h[1];C=h[2];F=h[3];h[4]=S*F+H*y+X*C-U*A;h[5]=X*F+H*A+U*y-S*C;h[6]=U*F+H*C+S*A-X*y;h[7]=H*F-S*y-X*A-U*C;return h},rotateZ:function(h,l,v){var y=-l[0],A=-l[1],C=-l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=H*F+Q*y+K*C-M*A,X=K*F+Q*A+M*y-H*C,U=M*F+Q*C+H*A-K*y;H=Q*F-H*y-K*A-M*C;Wa(h,l,v);y=h[0];A=h[1];C=h[2];F=h[3];h[4]=S*F+H*y+X*C-U*A;h[5]=X*F+H*A+U*y-S*C;h[6]=U*F+H*C+S*A-X*y;h[7]=H*F-S*y-X*A-U*C;return h},rotateByQuatAppend:function(h,l,v){var y=v[0],A=v[1],C=v[2];v=v[3];
var F=l[0],H=l[1],K=l[2],M=l[3];h[0]=F*v+M*y+H*C-K*A;h[1]=H*v+M*A+K*y-F*C;h[2]=K*v+M*C+F*A-H*y;h[3]=M*v-F*y-H*A-K*C;F=l[4];H=l[5];K=l[6];M=l[7];h[4]=F*v+M*y+H*C-K*A;h[5]=H*v+M*A+K*y-F*C;h[6]=K*v+M*C+F*A-H*y;h[7]=M*v-F*y-H*A-K*C;return h},rotateByQuatPrepend:function(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];var F=v[0],H=v[1],K=v[2],M=v[3];h[0]=y*M+l*F+A*K-C*H;h[1]=A*M+l*H+C*F-y*K;h[2]=C*M+l*K+y*H-A*F;h[3]=l*M-y*F-A*H-C*K;F=v[4];H=v[5];K=v[6];M=v[7];h[4]=y*M+l*F+A*K-C*H;h[5]=A*M+l*H+C*F-y*K;h[6]=C*M+
l*K+y*H-A*F;h[7]=l*M-y*F-A*H-C*K;return h},rotateAroundAxis:function(h,l,v,y){if(.000001>Math.abs(y))return ab(h,l);var A=Math.hypot(v[0],v[1],v[2]);y*=.5;var C=Math.sin(y),F=C*v[0]/A,H=C*v[1]/A;v=C*v[2]/A;y=Math.cos(y);A=l[0];C=l[1];var K=l[2],M=l[3];h[0]=A*y+M*F+C*v-K*H;h[1]=C*y+M*H+K*F-A*v;h[2]=K*y+M*v+A*H-C*F;h[3]=M*y-A*F-C*H-K*v;A=l[4];C=l[5];K=l[6];l=l[7];h[4]=A*y+l*F+C*v-K*H;h[5]=C*y+l*H+K*F-A*v;h[6]=K*y+l*v+A*H-C*F;h[7]=l*y-A*F-C*H-K*v;return h},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+
v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];h[4]=l[4]+v[4];h[5]=l[5]+v[5];h[6]=l[6]+v[6];h[7]=l[7]+v[7];return h},multiply:bb,mul:bb,scale:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;h[4]=l[4]*v;h[5]=l[5]*v;h[6]=l[6]*v;h[7]=l[7]*v;return h},dot:Ca,lerp:function(h,l,v,y){var A=1-y;0>Ca(l,v)&&(y=-y);h[0]=l[0]*A+v[0]*y;h[1]=l[1]*A+v[1]*y;h[2]=l[2]*A+v[2]*y;h[3]=l[3]*A+v[3]*y;h[4]=l[4]*A+v[4]*y;h[5]=l[5]*A+v[5]*y;h[6]=l[6]*A+v[6]*y;h[7]=l[7]*A+v[7]*y;return h},invert:function(h,l){var v=Fa(l);
h[0]=-l[0]/v;h[1]=-l[1]/v;h[2]=-l[2]/v;h[3]=l[3]/v;h[4]=-l[4]/v;h[5]=-l[5]/v;h[6]=-l[6]/v;h[7]=l[7]/v;return h},conjugate:function(h,l){h[0]=-l[0];h[1]=-l[1];h[2]=-l[2];h[3]=l[3];h[4]=-l[4];h[5]=-l[5];h[6]=-l[6];h[7]=l[7];return h},length:ia,len:ia,squaredLength:Fa,sqrLen:Fa,normalize:function(h,l){var v=Fa(l);if(0<v){v=Math.sqrt(v);var y=l[0]/v,A=l[1]/v,C=l[2]/v,F=l[3]/v,H=l[4],K=l[5],M=l[6];l=l[7];var Q=y*H+A*K+C*M+F*l;h[0]=y;h[1]=A;h[2]=C;h[3]=F;h[4]=(H-y*Q)/v;h[5]=(K-A*Q)/v;h[6]=(M-C*Q)/v;h[7]=
(l-F*Q)/v}return h},str:function(h){return"quat2("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+")"},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]&&h[4]===l[4]&&h[5]===l[5]&&h[6]===l[6]&&h[7]===l[7]},equals:function(h,l){var v=h[0],y=h[1],A=h[2],C=h[3],F=h[4],H=h[5],K=h[6];h=h[7];var M=l[0],Q=l[1],S=l[2],X=l[3],U=l[4],ca=l[5],ba=l[6];l=l[7];return Math.abs(v-M)<=.000001*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-Q)<=.000001*
Math.max(1,Math.abs(y),Math.abs(Q))&&Math.abs(A-S)<=.000001*Math.max(1,Math.abs(A),Math.abs(S))&&Math.abs(C-X)<=.000001*Math.max(1,Math.abs(C),Math.abs(X))&&Math.abs(F-U)<=.000001*Math.max(1,Math.abs(F),Math.abs(U))&&Math.abs(H-ca)<=.000001*Math.max(1,Math.abs(H),Math.abs(ca))&&Math.abs(K-ba)<=.000001*Math.max(1,Math.abs(K),Math.abs(ba))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))}});Ia=function(){var h=cb();return function(l,v,y,A,C,F){v||(v=2);y||(y=0);for(A=A?Math.min(A*v+y,l.length):
l.length;y<A;y+=v)h[0]=l[y],h[1]=l[y+1],C(h,h,F),l[y]=h[0],l[y+1]=h[1];return l}}();Ia=Object.freeze({__proto__:null,create:cb,clone:function(h){var l=new ma(2);l[0]=h[0];l[1]=h[1];return l},fromValues:function(h,l){var v=new ma(2);v[0]=h;v[1]=l;return v},copy:function(h,l){h[0]=l[0];h[1]=l[1];return h},set:function(h,l,v){h[0]=l;h[1]=v;return h},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];return h},subtract:db,multiply:eb,divide:fb,ceil:function(h,l){h[0]=Math.ceil(l[0]);h[1]=Math.ceil(l[1]);
return h},floor:function(h,l){h[0]=Math.floor(l[0]);h[1]=Math.floor(l[1]);return h},min:function(h,l,v){h[0]=Math.min(l[0],v[0]);h[1]=Math.min(l[1],v[1]);return h},max:function(h,l,v){h[0]=Math.max(l[0],v[0]);h[1]=Math.max(l[1],v[1]);return h},round:function(h,l){h[0]=Math.round(l[0]);h[1]=Math.round(l[1]);return h},scale:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;return h},scaleAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;return h},distance:gb,squaredDistance:hb,length:ib,squaredLength:jb,
negate:function(h,l){h[0]=-l[0];h[1]=-l[1];return h},inverse:function(h,l){h[0]=1/l[0];h[1]=1/l[1];return h},normalize:function(h,l){var v=l[0],y=l[1];v=v*v+y*y;0<v&&(v=1/Math.sqrt(v));h[0]=l[0]*v;h[1]=l[1]*v;return h},dot:function(h,l){return h[0]*l[0]+h[1]*l[1]},cross:function(h,l,v){l=l[0]*v[1]-l[1]*v[0];h[0]=h[1]=0;h[2]=l;return h},lerp:function(h,l,v,y){var A=l[0];l=l[1];h[0]=A+y*(v[0]-A);h[1]=l+y*(v[1]-l);return h},random:function(h,l){l=l||1;var v=2*Ga()*Math.PI;h[0]=Math.cos(v)*l;h[1]=Math.sin(v)*
l;return h},transformMat2:function(h,l,v){var y=l[0];l=l[1];h[0]=v[0]*y+v[2]*l;h[1]=v[1]*y+v[3]*l;return h},transformMat2d:function(h,l,v){var y=l[0];l=l[1];h[0]=v[0]*y+v[2]*l+v[4];h[1]=v[1]*y+v[3]*l+v[5];return h},transformMat3:function(h,l,v){var y=l[0];l=l[1];h[0]=v[0]*y+v[3]*l+v[6];h[1]=v[1]*y+v[4]*l+v[7];return h},transformMat4:function(h,l,v){var y=l[0];l=l[1];h[0]=v[0]*y+v[4]*l+v[12];h[1]=v[1]*y+v[5]*l+v[13];return h},rotate:function(h,l,v,y){var A=l[0]-v[0];l=l[1]-v[1];var C=Math.sin(y);y=
Math.cos(y);h[0]=A*y-l*C+v[0];h[1]=A*C+l*y+v[1];return h},angle:function(h,l){var v=h[0];h=h[1];var y=l[0];l=l[1];var A=Math.sqrt(v*v+h*h)*Math.sqrt(y*y+l*l);return Math.acos(Math.min(Math.max(A&&(v*y+h*l)/A,-1),1))},zero:function(h){h[0]=0;h[1]=0;return h},str:function(h){return"vec2("+h[0]+", "+h[1]+")"},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]},equals:function(h,l){var v=h[0];h=h[1];var y=l[0];l=l[1];return Math.abs(v-y)<=.000001*Math.max(1,Math.abs(v),Math.abs(y))&&Math.abs(h-
l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},len:ib,sub:db,mul:eb,div:fb,dist:gb,sqrDist:hb,sqrLen:jb,forEach:Ia});f.glMatrix=lb;f.mat2=mb;f.mat2d=nb;f.mat3=ob;f.mat4=pb;f.quat=Na;f.quat2=Oa;f.vec2=Ia;f.vec3=La;f.vec4=Ma;Object.defineProperty(f,"__esModule",{value:!0})});"use strict";
{function f(E,J,O){var R=[0,0];var T=E[1][1]-E[0][1];var Y=E[0][0]-E[1][0];E=T*E[0][0]+Y*E[0][1];var W=J[1][1]-J[0][1];var ea=J[0][0]-J[1][0];J=W*J[0][0]+ea*J[0][1];var qa=T*ea-W*Y;I(qa,0,O||0)||(R[0]=(ea*E-Y*J)/qa,R[1]=(T*J-W*E)/qa);return R}function b(E,J,O,R){var T=J[0]-E[0];J=J[1]-E[1];var Y=R[0]-O[0],W=R[1]-O[1];if(0===Y*J-W*T)return!1;R=(T*(O[1]-E[1])+J*(E[0]-O[0]))/(Y*J-W*T);E=(Y*(E[1]-O[1])+W*(O[0]-E[0]))/(W*T-Y*J);return 0<=R&&1>=R&&0<=E&&1>=E}function a(E,J,O){return(J[0]-E[0])*(O[1]-E[1])-
(O[0]-E[0])*(J[1]-E[1])}function d(E,J,O){return 0<a(E,J,O)}function c(E,J,O){return 0<=a(E,J,O)}function e(E,J,O){return 0>a(E,J,O)}function g(E,J,O){return 0>=a(E,J,O)}var tmpPoint1=[],tmpPoint2=[];function k(E,J,O,R){if(R){var T=tmpPoint1,Y=tmpPoint2;T[0]=J[0]-E[0];T[1]=J[1]-E[1];Y[0]=O[0]-J[0];Y[1]=O[1]-J[1];return Math.acos((T[0]*Y[0]+T[1]*Y[1])/(Math.sqrt(T[0]*T[0]+T[1]*T[1])*Math.sqrt(Y[0]*Y[0]+Y[1]*Y[1])))<R}return 0===a(E,J,O)}function m(E,J){var O=J[0]-E[0];E=J[1]-E[1];return O*O+E*E}function p(E,
J){var O=E.length;return E[0>J?J%O+O:J%O]}function n(E){E.length=0}function u(E,J,O,R){for(;O<R;O++)E.push(J[O])}function q(E){for(var J=[],O=E.length,R=0;R!==O;R++)J.push(E.pop());for(R=0;R!==O;R++)E[R]=J[R]}function r(E,J){return e(p(E,J-1),p(E,J),p(E,J+1))}var tmpLine1=[],tmpLine2=[];function t(E,J,O){var R=tmpLine1,T=tmpLine2;if(c(p(E,J+1),p(E,J),p(E,O))&&g(p(E,J-1),p(E,J),p(E,O)))return!1;var Y=m(p(E,J),p(E,O));for(var W=0;W!==E.length;++W)if((W+1)%E.length!==J&&W!==J&&c(p(E,J),p(E,O),p(E,W+
1))&&g(p(E,J),p(E,O),p(E,W))){R[0]=p(E,J);R[1]=p(E,O);T[0]=p(E,W);T[1]=p(E,W+1);var ea=f(R,T);if(m(p(E,J),ea)<Y)return!1}return!0}function x(E,J,O){for(var R=0;R!==E.length;++R)if(R!==J&&R!==O&&(R+1)%E.length!==J&&(R+1)%E.length!==O&&b(p(E,J),p(E,O),p(E,R),p(E,R+1)))return!1;return!0}function z(E,J,O,R){R=R||[];n(R);if(J<O)for(var T=J;T<=O;T++)R.push(E[T]);else{for(T=0;T<=O;T++)R.push(E[T]);for(T=J;T<E.length;T++)R.push(E[T])}return R}function D(E){for(var J=[],O,R,T=[],Y=Number.MAX_VALUE,W=0;W<E.length;++W)if(r(E,
W))for(var ea=0;ea<E.length;++ea)if(t(E,W,ea)){O=D(z(E,W,ea,T));R=D(z(E,ea,W,T));for(var qa=0;qa<R.length;qa++)O.push(R[qa]);O.length<Y&&(J=O,Y=O.length,J.push([p(E,W),p(E,ea)]))}return J}function G(E,J){if(0===J.length)return[E];if(J instanceof Array&&J.length&&J[0]instanceof Array&&2===J[0].length&&J[0][0]instanceof Array){E=[E];for(var O=0;O<J.length;O++)for(var R=J[O],T=0;T<E.length;T++){var Y=G(E[T],R);if(Y){E.splice(T,1);E.push(Y[0],Y[1]);break}}return E}R=J;O=E.indexOf(R[0]);T=E.indexOf(R[1]);
return-1!==O&&-1!==T?[z(E,O,T),z(E,T,O)]:!1}function w(E,J,O,R,T){var Y=J[1]-E[1];J=E[0]-J[0];E=Y*E[0]+J*E[1];var W=R[1]-O[1];R=O[0]-R[0];O=W*O[0]+R*O[1];var ea=Y*R-W*J;return I(ea,0,T||0)?[0,0]:[(R*E-J*O)/ea,(Y*O-W*E)/ea]}function B(E,J,O,R,T,Y,W){Y=Y||100;W=W||0;T=T||25;J="undefined"!==typeof J?J:[];O=O||[];R=R||[];var ea=[0,0],qa=[0,0],ja=[0,0],xa,ua=0,Da=0,Ea=0,Ba=[],Aa=[];if(3>E.length)return J;W++;if(W>Y)return console.warn("quickDecomp: max level ("+Y+") reached."),J;for(var ia=0;ia<E.length;++ia)if(r(E,
ia)){O.push(E[ia]);var Fa=xa=Number.MAX_VALUE;for(var wa=0;wa<E.length;++wa){if(d(p(E,ia-1),p(E,ia),p(E,wa))&&g(p(E,ia-1),p(E,ia),p(E,wa-1))&&(ja=w(p(E,ia-1),p(E,ia),p(E,wa),p(E,wa-1)),e(p(E,ia+1),p(E,ia),ja))){var Ca=m(E[ia],ja);Ca<xa&&(xa=Ca,qa=ja,Da=wa)}d(p(E,ia+1),p(E,ia),p(E,wa+1))&&g(p(E,ia+1),p(E,ia),p(E,wa))&&(ja=w(p(E,ia+1),p(E,ia),p(E,wa),p(E,wa+1)),d(p(E,ia-1),p(E,ia),ja)&&(Ca=m(E[ia],ja),Ca<Fa&&(Fa=Ca,ea=ja,ua=wa)))}if(Da===(ua+1)%E.length)ja[0]=(qa[0]+ea[0])/2,ja[1]=(qa[1]+ea[1])/2,R.push(ja),
ia<ua?(u(Ba,E,ia,ua+1),Ba.push(ja),Aa.push(ja),0!==Da&&u(Aa,E,Da,E.length),u(Aa,E,0,ia+1)):(0!==ia&&u(Ba,E,ia,E.length),u(Ba,E,0,ua+1),Ba.push(ja),Aa.push(ja),u(Aa,E,Da,ia+1));else{Da>ua&&(ua+=E.length);ea=Number.MAX_VALUE;if(ua<Da)return J;for(wa=Da;wa<=ua;++wa)c(p(E,ia-1),p(E,ia),p(E,wa))&&g(p(E,ia+1),p(E,ia),p(E,wa))&&(Ca=m(p(E,ia),p(E,wa)),Ca<ea&&x(E,ia,wa)&&(ea=Ca,Ea=wa%E.length));ia<Ea?(u(Ba,E,ia,Ea+1),0!==Ea&&u(Aa,E,Ea,E.length),u(Aa,E,0,ia+1)):(0!==ia&&u(Ba,E,ia,E.length),u(Ba,E,0,Ea+1),u(Aa,
E,Ea,ia+1))}Ba.length<Aa.length?(B(Ba,J,O,R,T,Y,W),B(Aa,J,O,R,T,Y,W)):(B(Aa,J,O,R,T,Y,W),B(Ba,J,O,R,T,Y,W));return J}J.push(E);return J}function I(E,J,O){return Math.abs(E-J)<=(O||0)}function P(E,J,O){return I(E[0],J[0],O)&&I(E[1],J[1],O)}self.polyDecomp={decomp:function(E){var J=D(E);return 0<J.length?G(E,J):[E]},quickDecomp:B,isSimple:function(E){var J;for(J=0;J<E.length-1;J++)for(var O=0;O<J-1;O++)if(b(E[J],E[J+1],E[O],E[O+1]))return!1;for(J=1;J<E.length-2;J++)if(b(E[0],E[E.length-1],E[J],E[J+
1]))return!1;return!0},removeCollinearPoints:function(E,J){for(var O=0,R=E.length-1;3<E.length&&0<=R;--R)k(p(E,R-1),p(E,R),p(E,R+1),J)&&(E.splice(R%E.length,1),O++);return O},removeDuplicatePoints:function(E,J){for(var O=E.length-1;1<=O;--O)for(var R=E[O],T=O-1;0<=T;--T)P(R,E[T],J)&&E.splice(O,1)},makeCCW:function(E){for(var J=0,O=1;O<E.length;++O)if(E[O][1]<E[J][1]||E[O][1]===E[J][1]&&E[O][0]>E[J][0])J=O;if(d(p(E,J-1),p(E,J),p(E,J+1)))return!1;q(E);return!0}}}"use strict";
{let f=!1,b=!1,a="dev";const d=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){f=!0}static IsReady(){return f}static SetAppStarted(){b=!0}static HasAppStarted(){return b}static SetBuildMode(c){a=c}static GetBuildMode(){return a}static IsReleaseBuild(){return"final"===a}};d.isDebug=!1;d.isDebugDefend=!1;d.hardwareConcurrency=navigator.hardwareConcurrency||2}"use strict";
{const f=self.C3;f.QueryParser=class{constructor(b){this._queryString=b;this._parameters=new Map;this._Parse()}_Parse(){var b=this._queryString;if(b.startsWith("?")||b.startsWith("#"))b=b.substr(1);b=b.split("&");for(const a of b)this._ParseParameter(a)}_ParseParameter(b){if(b)if(b.includes("=")){var a=b.indexOf("="),d=decodeURIComponent(b.substring(0,a));b=decodeURIComponent(b.substring(a+1));this._parameters.set(d,b)}else this._parameters.set(b,null)}LogAll(){for(const b of this._parameters)console.log("[QueryParser] Parameter '"+
b[0]+"' = "+(null===b[1]?"null":"'"+b[1]+"'"))}Has(b){return this._parameters.has(b)}Get(b){b=this._parameters.get(b);return"undefined"===typeof b?null:b}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(b){this._queryString=b;this._parameters.clear();this._Parse()}};f.QueryString=new f.QueryParser(location.search);f.LocationHashString=new f.QueryParser(location.hash);"dev"!==f.QueryString.Get("mode")&&f.SetBuildMode("final")}"use strict";
{const f=self.C3,b=navigator.userAgent;let a={linux:/linux|openbsd|freebsd|netbsd/i.test(b),chromeOS:/CrOS/.test(b),windowsTizen:/trident|iemobile|msie|tizen/i.test(b),genericMS:/trident|iemobile|msie|edge\//i.test(b),opera:/OPR\//.test(b),blackberry:/bb10/i.test(b),edge:/edge\//i.test(b),trident:/trident/i.test(b),webkit:/webkit/i.test(b),safari:/safari\//i.test(b),chrome:/chrome\//i.test(b),chromium:/chromium\//i.test(b),crosswalk:/crosswalk|xwalk/i.test(b),nwjs:/nwjs/i.test(b),amazonwebapp:/amazonwebappplatform/i.test(b),
webview:/wv\)/.test(b),android:/android/i.test(b),nokia:/nokiabrowser\/[0-9.]+/i.test(b)};var JSCompiler_object_inline_windows_0=/windows\s+nt\s+\d+\.\d+/i.exec(b),JSCompiler_object_inline_OSX_1=/mac\s+os\s+x\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_android_2=/android\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_opera_3=/OPR\/[0-9.]+/.exec(b),JSCompiler_object_inline_tizen_4=/tizen\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_iphone_5=/iphone\s+os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_ipad_6=
/ipad[^)]*os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_winPhone_7=/windows\s+phone\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_winPhoneOS_8=/windows\s+phone\s+os\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_chrome_9=/chrome\/[0-9.]+/i.exec(b),JSCompiler_object_inline_chromium_10=/chromium\/[0-9.]+/i.exec(b),JSCompiler_object_inline_nwjs_11=/nwjs\/[0-9.]+/i.exec(b),JSCompiler_object_inline_firefox_12=/firefox\/[0-9.]+/i.exec(b),JSCompiler_object_inline_ie_13=/msie\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_edge_14=
/edge\/[0-9.]+/i.exec(b),JSCompiler_object_inline_edgeChromium_15=/edg\/[0-9.]+/i.exec(b),JSCompiler_object_inline_silk_16=/silk\/[0-9.]+/i.exec(b);let d="(unknown)",c="(unknown)",e="(unknown)",g="(unknown)",k="(unknown)",m="(unknown)",p="(unknown)",n="browser",u=!1,q=!1,r=new Map;function t(z,D,G){!0===D?(G(),r.set(z,!0)):D&&D.length&&(G(D[0]),r.set(z,!0))}t("isWindows",JSCompiler_object_inline_windows_0,z=>{d="Windows";if(z=z.split(" ")[2])switch(z){case "5.0":c="2000";break;case "5.1":c="XP";break;
case "5.2":c="XP";break;case "6.0":c="Vista";break;case "6.1":c="7";break;case "6.2":c="8";break;case "6.3":c="8.1";break;case "10.0":c="10"}});t("isOSX",JSCompiler_object_inline_OSX_1,z=>{d="Mac OS X";(z=z.split(" ")[3])&&(c=z.replace("_","."))});t("isLinux",a.linux,()=>{d="Linux"});t("isChromeOS",a.chromeOS,()=>{d="Chrome OS"});t("isAndroid",!a.windowsTizen&&JSCompiler_object_inline_android_2,z=>{d="Android";(z=z.split(" ")[1])&&(c=z)});t("isTizen",JSCompiler_object_inline_tizen_4,z=>{d="Tizen";
(z=z.split(" ")[1])&&(c=z)});t("isIPhone",!a.windowsTizen&&JSCompiler_object_inline_iphone_5,z=>{d="iOS";(z=z.split(" ")[2])&&(c=z.replace("_","."))});t("isIPad",!a.windowsTizen&&JSCompiler_object_inline_ipad_6,z=>{d="iOS";(z=z.split(" ")[3])&&(c=z.replace("_","."))});t("isWindowsPhone",JSCompiler_object_inline_winPhone_7,z=>{d="Windows Phone";(z=z.split(" ")[2])&&(c=z)});t("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_8,z=>{d="Windows Phone";(z=z.split(" ")[3])&&(c=z)});t("isBlackberry",
a.blackberry,()=>{d="Blackberry";c="10";g="stock";p="webkit"});t("isChrome",!a.edge&&!a.opera&&JSCompiler_object_inline_chrome_9,z=>{g="Chrome";p="Chromium";(z=z.split("/")[1])&&(k=z)});t("isOpera",JSCompiler_object_inline_opera_3,z=>{g="Opera";p="Chromium";(z=z.split("/")[1])&&(k=z)});t("isChromium",JSCompiler_object_inline_chromium_10,z=>{p=g="Chromium";(z=z.split("/")[1])&&(k=z)});t("isFirefox",JSCompiler_object_inline_firefox_12,z=>{g="Firefox";p="Gecko";(z=z.split("/")[1])&&(k=z)});t("isInternetExplorer",
JSCompiler_object_inline_ie_13,z=>{g="Internet Explorer";p="Trident";(z=z.split(" ")[1])&&(k=z)});t("isTrident","Internet Explorer"!==g&&a.trident,()=>{p="Trident";var z=/rv:[0-9.]+/i.exec(b);z&&z.length&&(g="Internet Explorer",(z=z[0].split(":")[1])&&(k=z))});t("isEdge",JSCompiler_object_inline_edge_14,z=>{p=g="Edge";(z=z.split("/")[1])&&(k=z)});t("isEdgeChromium",JSCompiler_object_inline_edgeChromium_15,z=>{g="Edge";p="Chromium";(z=z.split("/")[1])&&(k=z)});t("isSafari",a.safari&&!a.nokia&&!a.chrome&&
!a.chromium&&!a.genericIE&&!a.blackberry,()=>{g="Safari";p="WebKit";var z=/version\/[0-9.]+/i.exec(b),D=/crios\/[0-9.]+/i.exec(b),G=/fxios\/[0-9.]+/i.exec(b);z&&z.length&&(z=z[0].split("/")[1])&&(k=z);D&&D.length&&(g="Chrome for iOS",(D=D[0].split("/")[1])&&(k=D));G&&G.length&&(g="Firefox for iOS",(G=G[0].split("/")[1])&&(k=G))});t("isSilk",JSCompiler_object_inline_silk_16,z=>{g="Silk";(z=z.split("/")[1])&&(k=z)});t("isCrosswalk",a.crosswalk,()=>n="crosswalk");t("isCordova",self.device&&(self.device.cordova||
self.device.phonegap),()=>n="cordova");t("isNWJS",JSCompiler_object_inline_nwjs_11,z=>{n="nwjs";g="NW.js";p="Chromium";(z=z.split("/")[1])&&(k=z)});t("isAmazonWebApp",a.amazonwebapp,()=>n="webapp");t("isHomeScreenWebApp","nwjs"!==n&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>n="webapp");t("isFalseSafari","Safari"===g&&("Android"===d||"Tizen"===d||"Blackberry"===d),()=>g="stock");t("isAndroidWebview","Chrome"===
g&&"browser"===n&&a.webview,()=>n="webview");t("isFirefoxOS","Firefox"===g&&"(unknown)"===d,()=>d="Firefox OS");t("isAndroidFallback","(unknown)"===d&&!a.windowsTizen&&a.android,()=>d="Android");t("isTridentFallback","(unknown)"===d&&a.trident,()=>p="Trident");t("isWebkitFallback","(unknown)"===d&&a.webkit,()=>p="WebKit");t("is64Bit",(z=>z.test(b)||z.test(navigator.platform)||"x64"===navigator.cpuClass)(/x86_64|x86-64|win64|x64;|x64\)|x64_|amd64|wow64|ia64|arm64|arch64|sparc64|ppc64|irix64/i),()=>
e="64-bit");t("is32Bit",(z=>z.test(b)||z.test(navigator.platform)||"x86"===navigator.cpuClass)(/x86;|x86\)|i86|i386|i486|i586|i686|armv1|armv2|armv3|armv4|armv5|armv6|armv7/i),()=>e="32-bit");t("is64BitFallback","(unknown)"===e&&"Mac OS X"===d&&10.7<=parseFloat(c),()=>e="64-bit");t("is32BitFallback","(unknown)"===e&&"Windows"===d||"Android"===d&&5>parseFloat(c),()=>e="32-bit");t("is32BitBrowser","32-bit"===e||/wow64/i.test(b),()=>m="32-bit");t("is64BitBrowser",/win64/i.test(b),()=>m="64-bit");t("isDesktop",
(()=>"Windows"===d||"Mac OS X"===d||"Linux"===d||"Chrome OS"===d||"nwjs"===n)(),()=>u=!0);"Edge"===p&&"undefined"!==typeof Windows&&"undefined"!==typeof Windows.System&&(n="windows-store");q="nwjs"===n;const x="Mac OS X"===d&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;x&&(d="iOS",c=k,q=u=!1);f.Platform={OS:d,OSVersion:c,OSArchitecture:e,Browser:g,BrowserVersion:k,BrowserVersionNumber:parseFloat(k),BrowserArchitecture:m,BrowserEngine:p,Context:n,IsDesktop:u,IsMobile:!u,IsDesktopApp:q,IsChromeWebStore:!!(self.chrome&&
self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===d||"iOS"===d,IsIpadOS:x}}"use strict";
{const f=new Map,b="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAll,a="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAllKeys;function d(r){return new Promise((t,x)=>{r.onsuccess=()=>t(r.result);r.onerror=()=>x(r.error)})}function c(r){return new Promise((t,x)=>{r.oncomplete=()=>t();r.onerror=()=>x(r.error);r.onabort=()=>x(r.error)})}function e(r,t){return k(r,t)}function g(r,t){return k(r,t,!0)}async function k(r,t,x=!1,
z=!0){const D=await m(r);try{const G=D.transaction(["keyvaluepairs"],x?"readwrite":"readonly");return t(G)}catch(G){if(z&&"InvalidStateError"===G.name)return f.delete(r),k(r,t,x,!1);throw G;}}function m(r){n(r);let t=f.get(r);t instanceof Promise||(t=p(r),f.set(r,t),t.catch(x=>f.delete(r)));return t}async function p(r){n(r);const t=indexedDB.open(r,2);t.addEventListener("upgradeneeded",x=>{try{x.target.result.createObjectStore("keyvaluepairs")}catch(z){console.error(`Failed to create objectstore for database ${r}`,
z)}});return d(t)}function n(r){if("string"!==typeof r)throw new TypeError("expected string");}function u(r,t){const x=r.objectStore("keyvaluepairs").openCursor();return new Promise(z=>{const D=[];x.onsuccess=G=>{if(G=G.target.result){switch(t){case "entries":D.push([G.key,G.value]);break;case "keys":D.push(G.key);break;case "values":D.push(G.value)}G.continue()}else z(D)}})}class q{constructor(r){n(r);this.name=r}async ready(){await m(this.name)}set(r,t){n(r);return g(this.name,async x=>{var z=x.objectStore("keyvaluepairs").put(t,
r);z=d(z);x=c(x);await Promise.all([x,z])})}get(r){n(r);return e(this.name,async t=>{var x=t.objectStore("keyvaluepairs").get(r);x=d(x);t=c(t);[,t]=await Promise.all([t,x]);return t})}delete(r){n(r);return g(this.name,async t=>{var x=t.objectStore("keyvaluepairs").delete(r);x=d(x);t=c(t);await Promise.all([t,x])})}clear(){return g(this.name,async r=>{var t=r.objectStore("keyvaluepairs").clear();t=d(t);r=c(r);await Promise.all([r,t])})}keys(){return e(this.name,async r=>{if(a){var t=r.objectStore("keyvaluepairs").getAllKeys();
t=d(t)}else t=u(r,"keys");r=c(r);[,r]=await Promise.all([r,t]);return r})}values(){return e(this.name,async r=>{if(b){var t=r.objectStore("keyvaluepairs").getAll();t=d(t)}else t=u(r,"values");r=c(r);[,r]=await Promise.all([r,t]);return r})}entries(){return e(this.name,async r=>{var t=u(r,"entries");r=c(r);[,t]=await Promise.all([r,t]);return t})}}self.KVStorageContainer=q}"use strict";
{const f=self.KVStorageContainer,b=[/no available storage method found/i,/an attempt was made to break through the security policy of the user agent/i,/the user denied permission to access the database/i,/a mutation operation was attempted on a database that did not allow mutations/i,/idbfactory\.open\(\) called in an invalid security context/i],a=new WeakMap;let d=!1;"undefined"===typeof indexedDB&&(d=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function c(m){throw Error(`"${m}" is not implemented`);
}function e(m){if("function"===typeof m)throw Error("localforage callback API is not implemented; please use the promise API instead");}function g(m){return"object"===typeof m?new Promise(p=>{const {port1:n,port2:u}=new MessageChannel;u.onmessage=q=>p(q.data);n.postMessage(m)}):Promise.resolve(m)}class k{constructor(m){this._inst=m;a.set(this,new Map)}_MaybeSwitchToMemoryFallback(m){if(!d)for(const p of b)if(m&&p.test(m.message)){console.error("Unable to use local storage, reverting to in-memory store: ",
m,m.message);d=!0;break}}async _getItemFallback(m){m=a.get(this).get(m);m=await g(m);return"undefined"===typeof m?null:m}async _setItemFallback(m,p){p=await g(p);a.get(this).set(m,p)}_removeItemFallback(m){a.get(this).delete(m)}_clearFallback(){a.get(this).clear()}_keysFallback(){return Array.from(a.get(this).keys())}IsUsingFallback(){return d}async getItem(m,p){e(p);if(d)return await this._getItemFallback(m);let n;try{n=await this._inst.get(m)}catch(u){this._MaybeSwitchToMemoryFallback(u);if(d)return await this._getItemFallback(m);
console.error(`Error reading '${m}' from storage, returning null: `,u);return null}return"undefined"===typeof n?null:n}async setItem(m,p,n){e(n);"undefined"===typeof p&&(p=null);if(d)await this._setItemFallback(m,p);else try{await this._inst.set(m,p)}catch(u){if(this._MaybeSwitchToMemoryFallback(u),d)await this._setItemFallback(m,p);else throw u;}}async removeItem(m,p){e(p);if(d)this._removeItemFallback(m);else try{await this._inst.delete(m)}catch(n){this._MaybeSwitchToMemoryFallback(n),d?this._removeItemFallback(m):
console.error(`Error removing '${m}' from storage: `,n)}}async clear(m){e(m);if(d)this._clearFallback();else try{await this._inst.clear()}catch(p){this._MaybeSwitchToMemoryFallback(p),d?this._clearFallback():console.error("Error clearing storage: ",p)}}async keys(m){e(m);if(d)return this._keysFallback();m=[];try{m=await this._inst.keys()}catch(p){this._MaybeSwitchToMemoryFallback(p);if(d)return this._keysFallback();console.error("Error getting storage keys: ",p)}return m}ready(m){e(m);return d?Promise.resolve(!0):
this._inst.ready()}createInstance(m){if("object"!==typeof m)throw new TypeError("invalid options object");m=m.name;if("string"!==typeof m)throw new TypeError("invalid store name");m=new f(m);return new k(m)}length(m){c("localforage.length()")}key(m,p){c("localforage.key()")}iterate(m,p){c("localforage.iterate()")}setDriver(m){c("localforage.setDriver()")}config(m){c("localforage.config()")}defineDriver(m){c("localforage.defineDriver()")}driver(){c("localforage.driver()")}supports(m){c("localforage.supports()")}dropInstance(){c("localforage.dropInstance()")}disableMemoryMode(){d=
!1}}self.localforage=new k(new f("localforage"))}"use strict";
{const f=self.C3;f.Supports={};f.Supports.WebAnimations=(()=>{try{if("Safari"===f.Platform.Browser||"undefined"===typeof document)return!1;const b=document.createElement("div");return"undefined"===typeof b.animate?!1:"undefined"!==typeof b.animate([{opacity:"0"},{opacity:"1"}],1E3).reverse}catch(b){return!1}})();f.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;f.Supports.RequestIdleCallback=!!self.requestIdleCallback;f.Supports.ImageBitmap=!!self.createImageBitmap;f.Supports.ImageBitmapOptions=
!1;if(f.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{premultiplyAlpha:"none"}).then(b=>{f.Supports.ImageBitmapOptions=!0}).catch(b=>{f.Supports.ImageBitmapOptions=!1})}catch(b){f.Supports.ImageBitmapOptions=!1}f.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===f.Platform.Browser);f.Supports.PermissionsQuery=!(!navigator.permissions||!navigator.permissions.query);f.Supports.Proxies="undefined"!==typeof Proxy;f.Supports.DownloadAttribute=
(()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();f.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();f.Supports.Fetch="function"===typeof fetch;f.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==f.Platform.Browser&&navigator.storage&&navigator.storage.persist);f.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);f.Supports.Fullscreen=
(()=>{if("undefined"===typeof document||"iOS"===f.Platform.OS)return!1;const b=document.documentElement;return!!(b.requestFullscreen||b.msRequestFullscreen||b.mozRequestFullScreen||b.webkitRequestFullscreen)})();f.Supports.ImageDecoder="undefined"!==typeof self.ImageDecoder;f.Supports.NativeFileSystemAPI=!!self.showOpenFilePicker;f.Supports.NavigatorFontsQuery=!(!navigator.fonts||!navigator.fonts.query)}"use strict";
{const f=self.C3;if(!String.prototype.trimStart){const b=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/;String.prototype.trimStart=function(){return this.replace(b,"")}}if(!String.prototype.trimEnd){const b=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;String.prototype.trimEnd=function(){return this.replace(b,
"")}}String.prototype.replaceAll||(String.prototype.replaceAll=function(b,a){return this.replace(new RegExp(f.EscapeRegex(b),"g"),a)});Array.prototype.values||(Array.prototype.values=function*(){for(const b of this)yield b});if(!Array.prototype.flat){function b(a,d){return a.reduce((c,e)=>{0<d&&Array.isArray(e)?Array.prototype.push.apply(c,b(e,d-1)):c.push(e);return c},[])}Array.prototype.flat=function(a=1){return b(this,a)}}RegExp.escape||(RegExp.escape=function(b){return String(b).replace(/[\\^$*+?.()|[\]{}]/g,
"\\$&")});navigator.storage&&!navigator.storage.estimate&&navigator.webkitTemporaryStorage&&navigator.webkitTemporaryStorage.queryUsageAndQuota&&(navigator.storage.estimate=function(){return new Promise((b,a)=>navigator.webkitTemporaryStorage.queryUsageAndQuota((d,c)=>b({usage:d,quota:c}),a))});"undefined"===typeof HTMLCollection||HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=function(){let b=0;return{next:()=>b>=this.length?{done:!0}:{value:this.item(b++),
done:!1}}});"undefined"===typeof NodeList||NodeList.prototype[Symbol.iterator]||(NodeList.prototype[Symbol.iterator]=function(){let b=0;return{next:()=>b>=this.length?{done:!0}:{value:this.item(b++),done:!1}}});"undefined"===typeof DOMTokenList||DOMTokenList.prototype[Symbol.iterator]||(DOMTokenList.prototype[Symbol.iterator]=function(){let b=0;return{next:()=>b>=this.length?{done:!0}:{value:this.item(b++),done:!1}}});"undefined"===typeof FileList||FileList.prototype[Symbol.iterator]||(FileList.prototype[Symbol.iterator]=
function(){let b=0;return{next:()=>b>=this.length?{done:!0}:{value:this.item(b++),done:!1}}});"undefined"===typeof TextEncoder&&(self.TextEncoder=class{constructor(){Object.defineProperty(this,"encoding",{value:"utf-8",writable:!1})}encode(b){for(var a=b.length,d=-1,c=new Uint8Array(3*a),e,g,k=0;k!==a;){e=b.charCodeAt(k);k+=1;if(55296<=e&&56319>=e){if(k===a){c[d+=1]=239;c[d+=1]=191;c[d+=1]=189;break}g=b.charCodeAt(k);if(56320<=g&&57343>=g){if(e=1024*(e-55296)+g-56320+65536,k+=1,65535<e){c[d+=1]=240|
e>>>18;c[d+=1]=128|e>>>12&63;c[d+=1]=128|e>>>6&63;c[d+=1]=128|e&63;continue}}else{c[d+=1]=239;c[d+=1]=191;c[d+=1]=189;continue}}127>=e?c[d+=1]=0|e:(2047>=e?c[d+=1]=192|e>>>6:(c[d+=1]=224|e>>>12,c[d+=1]=128|e>>>6&63),c[d+=1]=128|e&63)}return new Uint8Array(c.buffer.slice(0,d+1))}toString(){return"[object TextEncoder]"}},TextEncoder[Symbol.toStringTag]="TextEncoder");if("undefined"===typeof TextDecoder){function b(c){const e=c[Symbol.iterator]();return{next:g=>e.next(),[Symbol.iterator](){return this}}}
function a(c){c=c.next();if(c.done)throw Error("unexpected end of input");if(0!=(c.value&192^128))throw Error("invalid byte");return c.value&63}const d=new Map;d.set("utf-8",(c,e)=>{if(c.buffer)var g=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);else if(g instanceof ArrayBuffer)g=new Uint8Array(c);else throw Error("Invalid parameter");c=b(g);g=[];try{for(const k of c){let m;if(127>k)m=k&127;else if(223>k)m=(k&31)<<6|a(c);else if(239>k)m=(k&15)<<12|a(c)<<6|a(c);else if(247>k)m=(k&7)<<18|a(c)<<
12|a(c)<<6|a(c);else throw Error("Invalid character");g.push(String.fromCodePoint(m))}}catch(k){if(e)throw k;g.push("\ufffd")}return g.join("")});d.set("utf8",d.get("utf-8"));d.set("utf-16le",(c,e)=>{throw Error("utf-16le decoder not implemented");});self.TextDecoder=class{constructor(c="utf-8",e={}){const g=d.get(c);if(!g)throw Error(`TextDecoder polyfill does not support "${c}"`);Object.defineProperty(this,"fatal",{value:!0===e.fatal,writable:!1});Object.defineProperty(this,"_decoder",{value:g,
writable:!1});Object.defineProperty(this,"encoding",{value:c,writable:!1})}decode(c){return this._decoder(c,this.fatal)}toString(){return"[object TextDecoder]"}};TextDecoder[Symbol.toStringTag]="TextDecoder"}"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}"use strict";
{const f=self.C3;function b(a){let d=f.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+d)}self.assert=function(a,d){a||b(d)}}"use strict";
{const f=self.C3;f.IsNumber=function(a){return"number"===typeof a};f.IsFiniteNumber=function(a){return f.IsNumber(a)&&isFinite(a)};f.RequireNumber=function(a){if(!f.IsNumber(a))throw new TypeError("expected number");};f.RequireOptionalNumber=function(a){f.IsNullOrUndefined(a)};f.RequireNumberInRange=function(a,d,c){if(!f.IsNumber(a)||isNaN(a)||d>a||c<a)throw new RangeError("number outside of range");};f.RequireAllNumber=function(...a){for(let d of a);};f.RequireFiniteNumber=function(a){if(!f.IsFiniteNumber(a))throw new TypeError("expected finite number");
};f.RequireOptionalFiniteNumber=function(a){f.IsNullOrUndefined(a)};f.RequireAllFiniteNumber=function(...a){for(let d of a);};f.IsString=function(a){return"string"===typeof a};f.RequireString=function(a){if(!f.IsString(a))throw new TypeError("expected string");};f.RequireOptionalString=function(a){f.IsNullOrUndefined(a)};f.RequireAllString=function(...a){for(let d of a);};f.IsSimpleObject=function(a){return"object"!==typeof a||null===a?!1:(a=Object.getPrototypeOf(a))?a.constructor===Object:null===
a};f.RequireSimpleObject=function(a){if(!f.IsSimpleObject(a))throw new TypeError("expected simple object");};f.RequireOptionalSimpleObject=function(a){if(!f.IsNullOrUndefined(a)&&!f.IsSimpleObject(a))throw new TypeError("expected simple object");};f.IsObject=function(a){return"object"===typeof a&&null!==a&&!Array.isArray(a)};f.RequireObject=function(a){if(!f.IsObject(a))throw new TypeError("expected object");};f.RequireOptionalObject=function(a){f.IsNullOrUndefined(a)};f.RequireAllObject=function(...a){for(let d of a);
};f.IsFileLike=function(a){return f.IsInstanceOf(a,Blob)&&"string"===typeof a.name};f.RequireFileLike=function(a){if(!f.IsFileLike(a))throw new TypeError("expected file");};f.RequireOptionalFileLike=function(a){f.IsNullOrUndefined(a)};f.IsArray=function(a){return Array.isArray(a)};f.RequireArray=function(a){if(!f.IsArray(a))throw new TypeError("expected array");};f.RequireOptionalArray=function(a){f.IsNullOrUndefined(a)};f.RequireAllArray=function(...a){for(let d of a);};f.Is2DArray=function(a){return f.IsArray(a)?
a.length?f.IsArray(a[0])?!0:!1:!0:!1};f.Require2DArray=function(a){if(!f.Is2DArray(a))throw new TypeError("expected 2d array");for(let d of a)if(!f.IsArray(d))throw new TypeError("expected 2d array");};f.RequireOptional2DArray=function(a){f.IsNullOrUndefined(a)};f.IsFunction=function(a){return"function"===typeof a};f.RequireFunction=function(a,d){if(!f.IsFunction(a))throw new TypeError("expected function");if(!f.IsNullOrUndefined(d)&&a!==d)throw new TypeError("expected same function reference");};
f.RequireOptionalFunction=function(a){f.IsNullOrUndefined(a)};f.RequireAllFunction=function(...a){for(let d of a);};f.RequireAnyFunction=function(a,...d){if(!f.IsFunction(a))throw new TypeError("expected function");if(!d.length)throw Error("missing comparison functions");for(let c of d)if(!f.IsNullOrUndefined(c)&&a===c)return;throw new TypeError("expected same function reference");};f.RequireOptionalAllFunction=function(...a){if(!f.IsNullOrUndefined(a))for(let d of a);};f.IsInstanceOf=function(a,
d){return a instanceof d};f.IsInstanceOfAny=function(a,...d){for(let c of d)if(f.IsInstanceOf(a,c))return!0;return!1};f.RequireInstanceOf=function(a,d){if(!f.IsInstanceOf(a,d))throw new TypeError("unexpected type");};f.RequireOptionalInstanceOf=function(a,d){f.IsNullOrUndefined(a)};f.RequireAllInstanceOf=function(a,...d){for(let c of d);};f.RequireAnyInstanceOf=function(a,...d){if(!f.IsInstanceOfAny(a,...d))throw new TypeError("unexpected type");};f.RequireAnyOptionalInstanceOf=function(a,...d){if(!f.IsNullOrUndefined(a)&&
!f.IsInstanceOfAny(a,...d))throw new TypeError("unexpected type");};f.IsArrayOf=function(a,d){for(let c of a)if(!f.IsInstanceOf(c,d))return!1;return!0};f.IsArrayOfFiniteNumbers=function(a){for(let d of a)if(!f.IsFiniteNumber(d))return!1;return!0};f.RequireArrayOf=function(a,d){for(let c of a);};f.RequireOptionalArrayOf=function(a,d){if(!f.IsNullOrUndefined(a))for(let c of a);};f.RequireArrayOfAny=function(a,...d){for(let c of a);};f.RequireOptionalArrayOfAny=function(a,...d){if(!f.IsNullOrUndefined(a))for(let c of a);
};f.IsDOMNode=function(a,d){return f.IsNullOrUndefined(a)||!f.IsString(a.nodeName)?!1:!d||f.equalsNoCase(a.nodeName,d)};f.RequireDOMNode=function(a,d){if(f.IsNullOrUndefined(a)||!f.IsString(a.nodeName))throw new TypeError("expected DOM node");if(d&&!f.equalsNoCase(a.nodeName,d))throw new TypeError(`expected DOM '${d}' node`);};f.RequireOptionalDOMNode=function(a,d){f.IsNullOrUndefined(a)};f.IsHTMLElement=function(a,d){return f.IsNullOrUndefined(a)||!f.IsString(a.tagName)?!1:!d||f.equalsNoCase(a.tagName,
d)};f.RequireHTMLElement=function(a,d){if(f.IsNullOrUndefined(a)||!f.IsString(a.tagName))throw new TypeError("expected HTML element");if(d&&!f.equalsNoCase(a.tagName,d))throw new TypeError(`expected HTML '${d}' element`);};f.RequireOptionalHTMLElement=function(a,d){f.IsNullOrUndefined(a)};f.IsDrawable=function(a){return f.IsHTMLElement(a,"img")||f.IsHTMLElement(a,"canvas")||f.IsHTMLElement(a,"video")||"undefined"!==typeof OffscreenCanvas&&a instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&
a instanceof ImageBitmap};f.RequireDrawable=function(a){if(!f.IsDrawable(a))throw new TypeError("expected drawable");};f.RequireOptionalDrawable=function(a){f.IsNullOrUndefined(a)};f.IsDrawableOrImageData=function(a){return a instanceof ImageData?!0:f.IsDrawable(a)};f.RequireDrawableOrImageData=function(a){if(!f.IsDrawableOrImageData(a))throw new TypeError("expected drawable or image data");};f.RequireOptionalDrawableOrImageData=function(a){if(!f.IsNullOrUndefined(a)&&!f.IsDrawableOrImageData(a))throw new TypeError("expected drawable or image data");
};f.IsStringLike=function(a){return"string"===typeof a||a instanceof f.HtmlString||a instanceof f.BBString};f.RequireStringLike=function(a){if(!f.IsStringLike(a))throw new TypeError("expected string-like");};f.RequireOptionalStringLike=function(a){f.IsNullOrUndefined(a)};f.RequireAllStringLike=function(...a){for(let d of a);};f.RequireOverride=function(){throw Error("must be overridden");};f.NotYetImplemented=function(){throw Error("not yet implemented");};f.IsDefined=function(a,...d){if("undefined"===
typeof a)return!1;for(let c of d){if("undefined"===typeof a[c])return!1;a=a[c]}return!0};f.IsNullOrUndefined=function(a){return"undefined"===typeof a||null===a};f.AreArrayElementsOfSameType=function(a){let d=a[0].constructor;for(let c of a)if(c.constructor!==d)return!1;return d};f.AreArrayElementsOfType=function(a,d){for(let c of a)if(!(c instanceof d))return!1;return!0};const b=Object.getPrototypeOf(Uint8Array);f.IsTypedArray=function(a){return f.IsInstanceOf(a,b)};f.RequireTypedArray=function(a){};
f.WeakRequireTypedArray=function(a){f.WeakRequireInstanceOf(a,b)};f.WeakRequireAnyInstanceOf=function(a,...d){if(!f.WeakIsAnyInstanceOf(a,...d))throw new TypeError("unexpected type");};f.WeakIsAnyInstanceOf=function(a,...d){for(const c of d)if(f.WeakIsInstanceOf(a,c))return!0;return!1};f.WeakRequireInstanceOf=function(a,d){if(!f.WeakIsInstanceOf(a,d))throw new TypeError("unexpected type");};f.WeakIsInstanceOf=function(a,d){for(;a=Object.getPrototypeOf(a);)if(a.constructor.name===d.name)return!0;return!1}}"use strict";
{const f=self.C3;f.GetCallStack=function(){return Error().stack};f.Debugger=function(){debugger};f.cast=function(r,t){return r&&r instanceof t?r:null};f.getName=function(r){return"undefined"===typeof r?"undefined":null===r?"null":"boolean"===typeof r?"<boolean>":f.IsNumber(r)?"<number>":f.IsString(r)?"<string>":f.IsArray(r)?"<array>":"symbol"===typeof r?"<"+r.toString()+">":f.IsFunction(r)?r.name&&"Function"!==r.name?r.name:"<anonymous function>":"object"===typeof r?r.constructor&&r.constructor.name&&
"Object"!==r.constructor.name?r.constructor.name:"<anonymous object>":"<unknown>"};f.getType=function(r){return null===r?"null":Array.isArray(r)?"array":typeof r};f.range=function*(r,t){if(!isFinite(Math.abs(r-t)))throw Error("Invalid parameters");if(r>t)for(--r;r>=t;r--)yield r;else for(;r<t;r++)yield r};function b(r,t){r=f.getType(r);t=f.getType(t);return"null"===r||"null"===t?!0:"undefined"===r||"undefined"===t?!1:r===t}let a=new Map,d=new Map,c=new WeakMap,e=new WeakMap;f.DefendHandler={};const g=
new Set(["then","splice"]);function k(r){console.warn("[Defence] "+r+" @",f.GetCallStack())}f.DefendHandler.get=function(r,t){t in r||"symbol"===typeof t||g.has(t)||k(`Accessed missing property '${t}' from defended object '${f.getName(r)}', returning undefined`);e.has(r)&&"symbol"!==typeof t&&!g.has(t)&&k(`Accessed property '${t}' on a released object '${f.getName(r)}'\nObject was originally released at: ${e.get(r)})\nCall stack at access: `);return r[t]};f.DefendHandler.set=function(r,t,x){t in r||
a.has(r)||k(`Set non-existent property '${t}' to '${x}' on defended object '${f.getName(r)}'`);b(r[t],x)||a.has(r)||k(`Set '${f.getType(r[t])}' property '${t}' to type '${f.getType(x)}' on defended object '${f.getName(r)}'`);e.has(r)&&k(`Set property '${t}' on a released object '${f.getName(r)}'\nObject was originally released at: ${e.get(r)})\nCall stack at access: `);r[t]=x;return!0};f.DefendHandler.deleteProperty=function(r,t){throw new ReferenceError(`Cannot delete property '${t}' from defended object '${f.getName(r)}'`);
};f.DefendHandler.defineProperty=function(r,t,x){throw new ReferenceError(`Cannot define property '${t}' on defended object '${f.getName(r)}'`);};f.DefendHandler.enumerate=function(r){throw new ReferenceError(`Cannot enumerate defended object '${f.getName(r)}'`);};let m=-1;function p(){m=-1;if(0<a.size||0<d.size){let r=[...new Set([...a.keys()].map(t=>f.getName(t)))].join();console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${r}`);
a.clear();d.clear()}}f.DefendedBase=class{constructor(){if(f.isDebugDefend&&f.Supports.Proxies){var r=new.target;r=Object.create(r.prototype);var t=new Proxy(r,f.DefendHandler);a.set(r,t);d.set(t,r);c.set(t,r);-1===m&&(m=requestAnimationFrame(p));return t}}};f.debugDefend=function(r){if(f.isDebugDefend&&f.Supports.Proxies&&r instanceof f.DefendedBase){if(!d.has(r))return r;let t=d.get(r);d.delete(r);a.delete(t);return r}return f.isDebug?Object.seal(r):r};f.New=function(r,...t){let x;try{x=new r(...t)}catch(z){throw d.clear(),
a.clear(),z;}f.isDebugDefend&&q(r,x);return f.debugDefend(x)};f.Release=function(r){(r=c.get(r))&&e.set(r,f.GetCallStack())};f.WasReleased=function(r){return(r=c.get(r))?!!e.get(r):!1};let n=new Map;function u(r){let t=new Set;for(let x in r)t.add(x);return t}function q(r,t){t=u(t);let x=n.get(r);if(x){let z=[];for(let D of x.values())t.has(D)?t.delete(D):z.push(D);f.appendArray(z,[...t]);z.length&&console.warn(`[Defence] '${f.getName(r)}' constructor creates inconsistent properties: ${z.join(", ")}`)}else n.set(r,
t)}f.PerfMark=class{constructor(r){this._name="";r&&this.start(r)}start(r){this._name=r;performance.mark(this._name+"-Start")}end(){performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(r){this.end();this._name=r;performance.mark(this._name+"-Start")}}}"use strict";
{const f=self.C3,b=2*Math.PI,a=Math.PI/180,d=180/Math.PI;f.wrap=function(g,k,m){g=Math.floor(g);k=Math.floor(k);m=Math.floor(m);return g<k?(g=m-(k-g)%(m-k),g===m?0:g):k+(g-k)%(m-k)};f.mapToRange=function(g,k,m,p,n){return(g-k)*(n-p)/(m-k)+p};f.normalize=function(g,k,m){return(g-k)/(m-k)};f.clamp=function(g,k,m){return g<k?k:g>m?m:g};f.clampAngle=function(g){g%=b;0>g&&(g+=b);return g};f.toRadians=function(g){return g*a};f.toDegrees=function(g){return g*d};f.distanceTo=function(g,k,m,p){return Math.hypot(m-
g,p-k)};f.distanceSquared=function(g,k,m,p){g=m-g;k=p-k;return g*g+k*k};f.angleTo=function(g,k,m,p){return Math.atan2(p-k,m-g)};f.angleDiff=function(g,k){if(g===k)return 0;g=Math.sin(g)*Math.sin(k)+Math.cos(g)*Math.cos(k);return 1<=g?0:-1>=g?Math.PI:Math.acos(g)};f.angleRotate=function(g,k,m){let p=Math.sin(g),n=Math.cos(g),u=Math.sin(k),q=Math.cos(k);return Math.acos(p*u+n*q)>m?0<n*u-p*q?f.clampAngle(g+m):f.clampAngle(g-m):f.clampAngle(k)};f.angleClockwise=function(g,k){return 0>=Math.cos(g)*Math.sin(k)-
Math.sin(g)*Math.cos(k)};f.angleLerp=function(g,k,m,p=0){let n=f.angleDiff(g,k);p*=b;return f.angleClockwise(k,g)?f.clampAngle(g+(n+p)*m):f.clampAngle(g-(n+p)*m)};f.angleLerpClockwise=function(g,k,m,p=0){const n=f.angleDiff(g,k);p*=b;return f.angleClockwise(k,g)?f.clampAngle(g+(n+p)*m):f.clampAngle((b-n+p)*m)};f.angleLerpAntiClockwise=function(g,k,m,p=0){const n=f.angleDiff(g,k);p*=b;return f.angleClockwise(k,g)?f.clampAngle((-b+n-p)*m):f.clampAngle(g-(n+p)*m)};f.lerp=function(g,k,m){return g+m*(k-
g)};f.unlerp=function(g,k,m){return g===k?0:(m-g)/(k-g)};f.relerp=function(g,k,m,p,n){return f.lerp(p,n,f.unlerp(g,k,m))};f.qarp=function(g,k,m,p){return f.lerp(f.lerp(g,k,p),f.lerp(k,m,p),p)};f.cubic=function(g,k,m,p,n){return f.lerp(f.qarp(g,k,m,n),f.qarp(k,m,p,n),n)};f.cosp=function(g,k,m){return(g+k+(g-k)*Math.cos(m*Math.PI))/2};f.isPOT=function(g){return 0<g&&0===(g-1&g)};f.nextHighestPowerOfTwo=function(g){--g;for(let k=1;32>k;k<<=1)g|=g>>k;return g+1};f.roundToNearestFraction=function(g,k){return Math.round(g*
k)/k};f.floorToNearestFraction=function(g,k){return Math.floor(g*k)/k};f.round6dp=function(g){return Math.round(1E6*g)/1E6};f.toFixed=function(g,k){g=g.toFixed(k);for(k=g.length-1;0<=k&&"0"===g.charAt(k);--k);0<=k&&"."===g.charAt(k)&&--k;return 0>k?g:g.substr(0,k+1)};f.PackRGB=function(g,k,m){return f.clamp(g,0,255)|f.clamp(k,0,255)<<8|f.clamp(m,0,255)<<16};f.PackRGBAEx=function(g,k,m,p){g=f.clamp(Math.floor(1024*g),-8192,8191);k=f.clamp(Math.floor(1024*k),-8192,8191);m=f.clamp(Math.floor(1024*m),
-8192,8191);p=f.clamp(Math.floor(1023*p),0,1023);0>g&&(g+=16384);0>k&&(k+=16384);0>m&&(m+=16384);return-(274877906944*g+16777216*k+1024*m+p)};f.PackRGBEx=function(g,k,m){return f.PackRGBAEx(g,k,m,1)};function c(g){return 0===g&&0>1/g}f.GetRValue=function(g){if(0<=g)return(g&255)/255;g=Math.floor(-g/274877906944);8191<g&&(g-=16384);return g/1024};f.GetGValue=function(g){if(0<=g)return((g&65280)>>8)/255;g=Math.floor(-g%274877906944/16777216);8191<g&&(g-=16384);return g/1024};f.GetBValue=function(g){if(0<=
g)return((g&16711680)>>16)/255;g=Math.floor(-g%16777216/1024);8191<g&&(g-=16384);return g/1024};f.GetAValue=function(g){return c(g)?0:0<=g?1:Math.floor(-g%1024)/1023};f.greatestCommonDivisor=function(g,k){g=Math.floor(g);for(k=Math.floor(k);0!==k;){let m=k;k=g%k;g=m}return g};const e=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];f.getAspectRatio=function(g,k){g=Math.floor(g);k=Math.floor(k);if(g===k)return[1,1];for(var m of e){let p=g/m[0]*m[1];if(1>Math.abs(k-p))return m.slice(0);
p=g/m[1]*m[0];if(1>Math.abs(k-p))return[m[1],m[0]]}m=f.greatestCommonDivisor(g,k);return[g/m,k/m]};f.segmentsIntersect=function(g,k,m,p,n,u,q,r){var t=Math.min(g,m),x=Math.max(n,q);if(Math.max(g,m)<Math.min(n,q)||t>x)return!1;t=Math.min(k,p);x=Math.max(u,r);if(Math.max(k,p)<Math.min(u,r)||t>x)return!1;t=n-g+q-m;x=u-k+r-p;g=m-g;k=p-k;n=q-n;u=r-u;r=Math.abs(k*n-u*g);return Math.abs(n*x-u*t)>r?!1:Math.abs(g*x-k*t)<=r};f.segmentsIntersectPreCalc=function(g,k,m,p,n,u,q,r,t,x,z,D){const G=Math.max(t,z);
if(u<Math.min(t,z)||n>G)return!1;n=Math.max(x,D);if(r<Math.min(x,D)||q>n)return!1;q=t-g+z-m;r=x-k+D-p;g=m-g;k=p-k;t=z-t;x=D-x;D=Math.abs(k*t-x*g);return Math.abs(t*r-x*q)>D?!1:Math.abs(g*r-k*q)<=D};f.segmentIntersectsQuad=function(g,k,m,p,n){const u=Math.min(g,m),q=Math.max(g,m),r=Math.min(k,p),t=Math.max(k,p),x=n.getTlx(),z=n.getTly(),D=n.getTrx(),G=n.getTry(),w=n.getBrx(),B=n.getBry(),I=n.getBlx();n=n.getBly();return f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,x,z,D,G)||f.segmentsIntersectPreCalc(g,
k,m,p,u,q,r,t,D,G,w,B)||f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,w,B,I,n)||f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,I,n,x,z)};f.segmentIntersectsAnyN=function(g,k,m,p,n){const u=Math.min(g,m),q=Math.max(g,m),r=Math.min(k,p),t=Math.max(k,p);let x=0;for(let z=n.length-4;x<=z;x+=2)if(f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,n[x],n[x+1],n[x+2],n[x+3]))return!0;return f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,n[x],n[x+1],n[0],n[1])};f.rayIntersect=function(g,k,m,p,n,u,q,r){m-=g;u=r-u;const t=m*
u-(p-k)*(q-n);if(0===t)return 2;p=((k-p)*(q-g)+m*(r-k))/t;return 0<p&&1.000001>p?(u*(q-g)+(n-q)*(r-k))/t:2};f.rayIntersectExtended=function(g,k,m,p,n,u,q,r,t){const x=(q-n)*t;t*=r-u;return f.rayIntersect(g,k,m,p,n-x,u-t,q+x,r+t)};f.isPointInTriangleInclusive=function(g,k,m,p,n,u,q,r){n-=m;u-=p;q-=m;r-=p;g-=m;m=k-p;k=n*n+u*u;p=n*q+u*r;n=n*g+u*m;u=q*q+r*r;q=q*g+r*m;r=1/(k*u-p*p);u=(u*n-p*q)*r;n=(k*q-p*n)*r;return 0<=u&&0<=n&&1>=u+n};f.triangleCartesianToBarycentric=function(g,k,m,p,n,u,q,r){n-=m;u-=
p;q-=m;r-=p;g-=m;const t=k-p;k=n*n+u*u;p=n*q+u*r;m=q*q+r*r;n=g*n+t*u;u=g*q+t*r;q=k*m-p*p;r=(m*n-p*u)/q;n=(k*u-p*n)/q;return[1-r-n,r,n]};f.triangleBarycentricToCartesian=function(g,k,m,p,n,u,q,r,t){return[g*p+k*u+m*r,g*n+k*q+m*t]}}"use strict";
{const f=self.C3;let b=null,a="";if("undefined"!==typeof document){b=document;const m=document.querySelector("base");if(a=m&&m.hasAttribute("href")?m.getAttribute("href"):"")a.startsWith("/")&&(a=a.substr(1)),a.endsWith("/")||(a+="/")}f.GetBaseHref=function(){return a};f.GetBaseURL=function(){if(!b)return"";const m=b.location;return f.GetPathFromURL(m.origin+m.pathname)+a};f.GetPathFromURL=function(m){if(!m.length||m.endsWith("/")||m.endsWith("\\"))return m;const p=Math.max(m.lastIndexOf("/"),m.lastIndexOf("\\"));
return-1===p?"":m.substr(0,p+1)};f.GetFilenameFromURL=function(m){if(!m.length)return m;if(m.endsWith("/")||m.endsWith("\\"))return"";const p=Math.max(m.lastIndexOf("/"),m.lastIndexOf("\\"));return-1===p?m:m.substr(p+1)};f.DataTransferHasFiles=function(m){if(m.types)for(let p=0;p<m.types.length;p++)if("Files"===m.types[p]||"application/x-c3-file"===m.types[p])return!0;return!1};f.DataTransferFilterFiles=async function(m,p){m=Array.from(m.files).filter(n=>0!==n.size).filter(n=>p(n)).map(async n=>{try{return await f.CloneFile(n)}catch(u){return null}});
return(await Promise.all(m)).filter(n=>n)};f.IsFileAnImage=function(m){return m.type?-1!==m.type.search(/image\/.*/):-1!==f.MimeType.GetForFileExtension(f.GetFileExtension(m.name)).GetString().search(/image\/.*/)};f.IsFileAnSVG=function(m){return"image/svg+xml"===m.type};f.IsFileAMultiImageContainer=function(m){return m.type?f.MimeType.Get(m.type).IsAnimatedImage():f.MimeType.GetForFileExtension(f.GetFileExtension(m.name)).IsAnimatedImage()};f.GetFileExtension=function(m){let p=m.lastIndexOf(".");
return 1>p?"":m.substr(p)};f.GetFileNamePart=function(m){let p=m.lastIndexOf(".");return 1>p?m:m.substr(0,p)};f.NormalizeFileSeparator=function(m){return m.replace(/\\/g,"/")};f.ParseFilePath=function(m){m=f.NormalizeFileSeparator(m);let p=/^\w:\//.exec(m);p?(p=p[0],m=m.slice(3),"/"!==m[0]&&(m="/"+m)):p="";m=m.replace(/\/{2,}/g,"/");1<m.length&&"/"===m.slice(-1)&&(m=m.slice(0,-1));var n=m.lastIndexOf("/")+1;let u="",q=m,r="";0<n&&(u=m.slice(0,n),q=m.slice(n));m=q;n=q.lastIndexOf(".");0<n&&(r=q.slice(n),
m=q.slice(0,-r.length));return{dir:u,base:q,name:m,root:p,ext:r,full:p+u+q}};f.Wait=function(m,p){return new Promise((n,u)=>{self.setTimeout(n,m,p)})};f.swallowException=function(m){try{m()}catch(p){f.isDebug&&console.warn("Swallowed exception: ",p)}};f.noop=function(){};f.equalsNoCase=function(m,p){if("string"!==typeof m||"string"!==typeof p)return!1;if(m===p)return!0;m=m.normalize();p=p.normalize();return m.length!==p.length?!1:m.toLowerCase()===p.toLowerCase()};f.equalsCase=function(m,p){return"string"!==
typeof m||"string"!==typeof p?!1:m===p?!0:m.normalize()===p.normalize()};f.typedArraySet16=function(m,p,n){m[n++]=p[0];m[n++]=p[1];m[n++]=p[2];m[n++]=p[3];m[n++]=p[4];m[n++]=p[5];m[n++]=p[6];m[n++]=p[7];m[n++]=p[8];m[n++]=p[9];m[n++]=p[10];m[n++]=p[11];m[n++]=p[12];m[n++]=p[13];m[n++]=p[14];m[n]=p[15]};f.truncateArray=function(m,p){m.length=p};f.clearArray=function(m){m&&0!==m.length&&f.truncateArray(m,0)};f.clear2DArray=function(m){if(m){for(let p=0;p<m.length;p++)f.truncateArray(m[p],0);f.truncateArray(m,
0)}};f.extendArray=function(m,p,n){p|=0;var u=m.length;if(!(p<=u))for(;u<p;++u)m.push(n)};f.resizeArray=function(m,p,n){p|=0;const u=m.length;p<u?f.truncateArray(m,p):p>u&&f.extendArray(m,p,n)};f.shallowAssignArray=function(m,p){f.clearArray(m);f.appendArray(m,p)};f.appendArray=function(m,p){if(1E4>p.length)m.push(...p);else for(let n=0,u=p.length;n<u;++n)m.push(p[n])};f.arrayRemove=function(m,p){p=Math.floor(p);if(!(0>p||p>=m.length)){for(var n=m.length-1;p<n;++p)m[p]=m[p+1];f.truncateArray(m,n)}};
f.arrayFindRemove=function(m,p){p=m.indexOf(p);0<=p&&m.splice(p,1)};f.arraysEqual=function(m,p){let n=m.length;if(p.length!==n)return!1;for(let u=0;u<n;++u)if(m[u]!==p[u])return!1;return!0};f.arrayFilterOut=function(m,p){let n=[],u=0;for(let q=0,r=m.length;q<r;++q){let t=m[q];p(t)?n.push(t):(m[u]=t,++u)}f.truncateArray(m,u);return n};f.arrayRemoveAllInSet=function(m,p){const n=m.length;let u=0;for(let q=0,r=m.length;q<r;++q){let t=m[q];p.has(t)||(m[u++]=t)}f.truncateArray(m,u);return n-u};f.isArrayIndexInBounds=
function(m,p){return m!==Math.floor(m)?!1:0<=m&&m<p.length};f.validateArrayIndex=function(m,p){if(!f.isArrayIndexInBounds(m,p))throw new RangeError("array index out of bounds");};f.cloneArray=function(m){return m.slice()};f.deepCloneArray=function(m,p){let n=[];for(let u of m)if(f.IsObject(u)){m=p(u);if(!m)throw Error("missing clone");if(m.constructor!==u.constructor)throw Error("object is not a clone");n.push(m)}else f.IsArray(u)?n.push(f.deepCloneArray(u,p)):n.push(u);return n};f.clone2DArray=function(m){let p=
[];for(let n of m)p.push(n.slice());return p};f.mergeSets=function(m,p){return new Set([...m,...p])};f.mergeSetsInPlace=function(m,p){for(const n of p)m.add(n);return m};f.first=function(m){for(let p of m)return p;return null};f.xor=function(m,p){return!m!==!p};f.compare=function(m,p,n){switch(p){case 0:return m===n;case 1:return m!==n;case 2:return m<n;case 3:return m<=n;case 4:return m>n;case 5:return m>=n;default:return!1}};f.hasAnyOwnProperty=function(m){for(let p in m)if(m.hasOwnProperty(p))return!0;
return!1};f.PromiseAllWithProgress=function(m,p){return m.length?new Promise((n,u)=>{const q=[];let r=0,t=!1;for(let x=0,z=m.length;x<z;++x)q.push(void 0),m[x].then(D=>{t||(q[x]=D,++r,r===m.length?n(q):p(r,m.length))}).catch(D=>{t=!0;u(D)})}):Promise.resolve([])};let d=[];f.AddLibraryMemoryCallback=function(m){d.push(m)};f.GetEstimatedLibraryMemoryUsage=function(){let m=0;for(let p of d){let n=p();m+=n}return Math.floor(m)};let c=1;const e=new Map,g=new MessageChannel;g.port2.onmessage=function(m){const p=
m.data,n=e.get(p);e.delete(p);n&&n(m.timeStamp)};f.RequestUnlimitedAnimationFrame=function(m){const p=c++;e.set(p,m);g.port1.postMessage(p);return p};f.CancelUnlimitedAnimationFrame=function(m){e.delete(m)};f.PostTask=f.RequestUnlimitedAnimationFrame;f.WaitForNextTask=function(){return new Promise(m=>f.PostTask(m))};const k=new Set;f.RequestPostAnimationFrame=function(m){const p=self.requestAnimationFrame(async n=>{await f.WaitForNextTask();k.has(p)&&(k.delete(p),m(n))});k.add(p);return p};f.CancelPostAnimationFrame=
function(m){k.has(m)&&(self.cancelAnimationFrame(m),k.delete(m))}}"use strict";
{const f=self.C3;f.IsAbsoluteURL=function(b){return/^(?:[a-z]+:)?\/\//.test(b)||"data:"===b.substr(0,5)||"blob:"===b.substr(0,5)};f.IsRelativeURL=function(b){return!f.IsAbsoluteURL(b)};f.ThrowIfNotOk=function(b){if(!b.ok)throw Error(`fetch '${b.url}' response returned ${b.status} ${b.statusText}`);};f.FetchOk=function(b,a){return fetch(b,a).then(d=>{f.ThrowIfNotOk(d);return d})};f.FetchText=function(b){return f.FetchOk(b).then(a=>a.text())};f.FetchJson=function(b){return f.FetchOk(b).then(a=>a.json())};
f.FetchBlob=function(b){return f.FetchOk(b).then(a=>a.blob())};f.FetchArrayBuffer=function(b){return f.FetchOk(b).then(a=>a.arrayBuffer())};f.FetchImage=function(b){return new Promise((a,d)=>{const c=new Image;c.onload=()=>a(c);c.onerror=e=>d(e);c.src=b})};f.BlobToArrayBuffer=function(b){return"function"===typeof b.arrayBuffer?b.arrayBuffer():new Promise((a,d)=>{const c=new FileReader;c.onload=()=>a(c.result);c.onerror=()=>d(c.error);c.readAsArrayBuffer(b)})};f.BlobToString=function(b){return"function"===
typeof b.text?b.text():new Promise((a,d)=>{const c=new FileReader;c.onload=()=>a(c.result);c.onerror=()=>d(c.error);c.readAsText(b)})};f.BlobToJson=function(b){return f.BlobToString(b).then(a=>JSON.parse(a))};f.BlobToImage=async function(b,a){b=URL.createObjectURL(b);try{const d=await f.FetchImage(b);URL.revokeObjectURL(b);b="";a&&"function"===typeof d.decode&&await d.decode();return d}finally{b&&URL.revokeObjectURL(b)}};f.CreateCanvas=function(b,a){if("undefined"!==typeof document&&"function"===
typeof document.createElement){const d=document.createElement("canvas");d.width=b;d.height=a;return d}return new OffscreenCanvas(b,a)};f.CanvasToBlob=function(b,a,d){"number"!==typeof d&&(d=1);a=a||"image/png";d=f.clamp(d,0,1);return b.toBlob?new Promise(c=>b.toBlob(c,a,d)):b.convertToBlob?b.convertToBlob({type:a,quality:d}):f.Asyncify(()=>f.CanvasToBlobSync(b,a,d))};f.CanvasToBlobSync=function(b,a,d){"number"!==typeof d&&(d=1);a=a||"image/png";d=f.clamp(d,0,1);return f.DataURIToBinaryBlobSync(b.toDataURL(a,
d))};f.DataURIToBinaryBlobSync=function(b){b=f.ParseDataURI(b);return f.BinaryStringToBlob(b.data,b.mime_type)};f.ParseDataURI=function(b){if("data:"!==b.substr(0,5))throw new URIError("expected data: uri");var a=b.indexOf(",");if(0>a)throw new URIError("expected comma in data: uri");var d=b.substring(5,a);b=b.substring(a+1);a=d.split(";");d=a[0]||"";let c=a[2];b="base64"===a[1]||"base64"===c?atob(b):decodeURIComponent(b);return{mime_type:d,data:b}};f.BinaryStringToBlob=function(b,a){var d=b.length;
let c=d>>2,e=new Uint8Array(d),g=new Uint32Array(e.buffer,0,c),k,m;for(m=k=0;k<c;++k)g[k]=b.charCodeAt(m++)|b.charCodeAt(m++)<<8|b.charCodeAt(m++)<<16|b.charCodeAt(m++)<<24;for(d&=3;d--;)e[m]=b.charCodeAt(m),++m;return a?new Blob([e],{type:a}):new Blob([e])};f.DrawableToBlob=function(b,a,d){const c=f.CreateCanvas(b.width,b.height);c.getContext("2d").drawImage(b,0,0);return f.CanvasToBlob(c,a,d)};f.ImageDataToBlobSync=function(b,a,d){const c=f.CreateCanvas(b.width,b.height);c.getContext("2d").putImageData(b,
0,0);return f.CanvasToBlobSync(c,a,d)};f.ImageDataToBlob=function(b,a,d){if(f.Supports.ImageBitmapOptions)return createImageBitmap(b,{premultiplyAlpha:"none"}).then(c=>f.DrawableToBlob(c,a,d));if(f.Supports.ImageBitmap)return createImageBitmap(b).then(c=>f.DrawableToBlob(c,a,d));{const c=f.CreateCanvas(b.width,b.height);c.getContext("2d").putImageData(b,0,0);return f.CanvasToBlob(c,a,d)}};f.CopySet=function(b,a){b.clear();for(const d of a)b.add(d)};f.MapToObject=function(b){const a=Object.create(null);
for(const [d,c]of b.entries())a[d]=c;return a};f.ObjectToMap=function(b,a){a.clear();for(const [d,c]of Object.entries(b))a.set(d,c)};f.ToSuperJSON=function d(a){if("object"===typeof a&&null!==a){if(a instanceof Set)return{_c3type_:"set",data:[...a].map(c=>d(c))};if(a instanceof Map)return{_c3type_:"map",data:[...a].map(c=>[c[0],d(c[1])])};{const c=Object.create(null);for(const [e,g]of Object.entries(a))c[e]=d(g);return c}}return a};f.FromSuperJSON=function c(d){if("object"===typeof d&null!==d){if("set"===
d._c3type_)return new Set(d.data.map(e=>c(e)));if("map"===d._c3type_)return new Map(d.data.map(e=>[e[0],c(e[1])]));{const e=Object.create(null);for(const [g,k]of Object.entries(d))e[g]=c(k);return e}}return d};f.CSSToCamelCase=function(d){let c="",e=!1;for(const g of d)"-"===g?e=!0:e?(c+=g.toUpperCase(),e=!1):c+=g;return c};f.IsIterator=function(d){return"object"===typeof d&&"function"===typeof d.next};f.MakeFilledArray=function(d,c){const e=[];if("function"===typeof c)for(var g=0;g<d;++g)e.push(c());
else for(g=0;g<d;++g)e.push(c);return e}}"use strict";
{const f=self.C3,b=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,a=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;function d(e){return 0===e.length?"00":1===e.length?"0"+e:e}function c(e,g,k){0>k&&(k+=1);1<k&&--k;return k<1/6?e+6*(g-e)*k:.5>k?g:k<2/3?e+(g-e)*(2/3-k)*6:e}f.Color=class{constructor(e,g,k,m){this._a=this._b=this._g=this._r=0;e instanceof f.Color?this.set(e):this.setRgba(e||0,g||0,k||0,m||0)}setRgb(e,g,k){this._r=+e;this._g=+g;this._b=+k;this.clamp();return this}setRgba(e,g,k,m){this._r=+e;this._g=
+g;this._b=+k;this._a=+m;this.clamp();return this}set(e){this._r=e._r;this._g=e._g;this._b=e._b;this._a=e._a;return this}copy(e){return this.set(e)}add(e){this._r+=e._r;this._g+=e._g;this._b+=e._b;this._a+=e._a;this.clamp()}addRgb(e,g,k,m=0){this._r+=+e;this._g+=+g;this._b+=+k;this._a+=+m;this.clamp()}diff(e){this.setR(Math.max(this._r,e._r)-Math.min(this._r,e._r));this.setG(Math.max(this._g,e._g)-Math.min(this._g,e._g));this.setB(Math.max(this._b,e._b)-Math.min(this._b,e._b));this.setA(Math.max(this._a,
e._a)-Math.min(this._a,e._a));this.clamp()}copyRgb(e){this._r=e._r;this._g=e._g;this._b=e._b}setR(e){this._r=f.clamp(+e,0,1)}getR(){return this._r}setG(e){this._g=f.clamp(+e,0,1)}getG(){return this._g}setB(e){this._b=f.clamp(+e,0,1)}getB(){return this._b}setA(e){this._a=f.clamp(+e,0,1)}getA(){return this._a}clone(){return f.New(f.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(e,g){e[g++]=
this._r;e[g++]=this._g;e[g++]=this._b;e[g]=this._a}equals(e){return this._r===e._r&&this._g===e._g&&this._b===e._b&&this._a===e._a}equalsIgnoringAlpha(e){return this._r===e._r&&this._g===e._g&&this._b===e._b}equalsRgb(e,g,k){return this._r===e&&this._g===g&&this._b===k}equalsRgba(e,g,k,m){return this._r===e&&this._g===g&&this._b===k&&this._a===m}multiply(e){this._r*=e._r;this._g*=e._g;this._b*=e._b;this._a*=e._a}multiplyAlpha(e){this._r*=e;this._g*=e;this._b*=e;this._a*=e}premultiply(){this._r*=this._a;
this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=f.clamp(this._r,0,1);this._g=f.clamp(this._g,0,1);this._b=f.clamp(this._b,0,1);this._a=f.clamp(this._a,0,1);return this}setFromRgbValue(e){this._r=f.GetRValue(e);this._g=f.GetGValue(e);this._b=f.GetBValue(e);this._a=f.GetAValue(e)}getCssRgb(e,g,k){e=f.IsFiniteNumber(e)?e:this.getR();g=f.IsFiniteNumber(g)?g:this.getG();k=f.IsFiniteNumber(k)?k:this.getB();return`rgb(${100*
e}%, ${100*g}%, ${100*k}%)`}getCssRgba(e,g,k,m){e=f.IsFiniteNumber(e)?e:this.getR();g=f.IsFiniteNumber(g)?g:this.getG();k=f.IsFiniteNumber(k)?k:this.getB();m=f.IsFiniteNumber(m)?m:this.getA();return`rgba(${100*e}%, ${100*g}%, ${100*k}%, ${m})`}toHexString(){const e=Math.round(255*this.getR()),g=Math.round(255*this.getG()),k=Math.round(255*this.getB());return"#"+d(e.toString(16))+d(g.toString(16))+d(k.toString(16))}parseHexString(e){if("string"!==typeof e)return!1;e=e.trim();"#"===e.charAt(0)&&(e=
e.substr(1));let g,k;if(3===e.length)g=parseInt(e[0],16)/15,k=parseInt(e[1],16)/15,e=parseInt(e[2],16)/15;else if(6===e.length)g=parseInt(e.substr(0,2),16)/255,k=parseInt(e.substr(2,2),16)/255,e=parseInt(e.substr(4,2),16)/255;else return!1;isFinite(g)&&this.setR(g);isFinite(k)&&this.setG(k);isFinite(e)&&this.setB(e);this.setA(1);return!0}toCommaSeparatedRgb(){const e=Math.round(255*this.getR()),g=Math.round(255*this.getG()),k=Math.round(255*this.getB());return`${e}, ${g}, ${k}`}toRgbArray(){const e=
Math.round(255*this.getR()),g=Math.round(255*this.getG()),k=Math.round(255*this.getB());return[e,g,k]}parseCommaSeparatedRgb(e){if("string"!==typeof e)return!1;e=e.replace(/^rgb\(|\)|%/,"");var g=e.split(",");if(3>g.length)return!1;e=parseInt(g[0].trim(),10)/255;const k=parseInt(g[1].trim(),10)/255;g=parseInt(g[2].trim(),10)/255;isFinite(e)&&this.setR(e);isFinite(k)&&this.setG(k);isFinite(g)&&this.setB(g);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(e){if("string"!==typeof e)return!1;e=
e.replace(/^rgb\(|\)|%/,"");var g=e.split(",");if(3>g.length)return!1;e=parseInt(g[0].trim(),10)/100;const k=parseInt(g[1].trim(),10)/100;g=parseInt(g[2].trim(),10)/100;isFinite(e)&&this.setR(e);isFinite(k)&&this.setG(k);isFinite(g)&&this.setB(g);this.setA(1);return!0}parseCommaSeparatedRgba(e){if("string"!==typeof e)return!1;e=e.replace(/^rgba\(|\)|%/,"");var g=e.split(",");if(4>g.length)return!1;e=parseInt(g[0].trim(),10)/255;const k=parseInt(g[1].trim(),10)/255,m=parseInt(g[2].trim(),10)/255;g=
parseFloat(g[3].trim());isFinite(e)&&this.setR(e);isFinite(k)&&this.setG(k);isFinite(m)&&this.setB(m);isFinite(g)&&this.setA(g);return!0}parseCommaSeparatedPercentageRgba(e){if("string"!==typeof e)return!1;e=e.replace(/^rgba\(|\)|%/,"");var g=e.split(",");if(4>g.length)return!1;e=parseInt(g[0].trim(),10)/100;const k=parseInt(g[1].trim(),10)/100,m=parseInt(g[2].trim(),10)/100;g=parseFloat(g[3].trim());isFinite(e)&&this.setR(e);isFinite(k)&&this.setG(k);isFinite(m)&&this.setB(m);isFinite(g)&&this.setA(g);
return!0}parseString(e){if("string"!==typeof e)return!1;e=e.replace(/\s+/,"");if(e.includes(",")){if(e.startsWith("rgb("))return e.includes("%")?this.parseCommaSeparatedPercentageRgb(e):this.parseCommaSeparatedRgb(e);if(e.startsWith("rgba("))return e.includes("%")?this.parseCommaSeparatedPercentageRgba(e):this.parseCommaSeparatedRgba(e);if(e.startsWith("hsl(")||e.startsWith("hsla("))return this.parseHSLString(e);{const g=e.split(",");if(e.includes("%")){if(3===g.length)return this.parseCommaSeparatedPercentageRgb(e);
if(4===g.length)return this.parseCommaSeparatedPercentageRgba(e)}else{if(3===g.length)return this.parseCommaSeparatedRgb(e);if(4===g.length)return this.parseCommaSeparatedRgba(e)}return!1}}return this.parseHexString(e)}toJSON(){return[this._r,this._g,this._b,this._a]}setFromHSLA(e,g,k,m){e%=360;g=f.clamp(g,0,100);k=f.clamp(k,0,100);m=f.clamp(m,0,1);e/=360;g/=100;k/=100;if(0===g)k=g=e=k;else{const p=.5>k?k*(1+g):k+g-k*g,n=2*k-p;k=c(n,p,e+1/3);g=c(n,p,e);e=c(n,p,e-1/3)}this.setR(k);this.setG(g);this.setB(e);
this.setA(m);return this}parseHSLString(e){var g=e.replace(/ |hsl|hsla|\(|\)|;/gi,"");e=b.exec(g);g=a.exec(g);return e&&4===e.length?(this.setFromHSLA(+e[1],+e[2],+e[3],1),!0):g&&5===g.length?(this.setFromHSLA(+e[1],+e[2],+e[3],+e[4]),!0):!1}toHSLAString(){var e=this._r;const g=this._g,k=this._b,m=this._a,p=f.Color.GetHue(e,g,k),n=f.Color.GetSaturation(e,g,k);e=f.Color.GetLuminosity(e,g,k);return`hsla(${p}, ${n}%, ${e}%, ${m})`}toHSLAArray(){const e=this._r,g=this._g,k=this._b;return[f.Color.GetHue(e,
g,k),f.Color.GetSaturation(e,g,k),f.Color.GetLuminosity(e,g,k),this._a]}setFromJSON(e){!Array.isArray(e)||3>e.length||(this._r=e[0],this._g=e[1],this._b=e[2],this._a=4<=e.length?e[3]:1)}set r(e){this.setR(e)}get r(){return this.getR()}set g(e){this.setG(e)}get g(){return this.getG()}set b(e){this.setB(e)}get b(){return this.getB()}set a(e){this.setA(e)}get a(){return this.getA()}setAtIndex(e,g){switch(e){case 0:this.setR(g);break;case 1:this.setG(g);break;case 2:this.setB(g);break;case 3:this.setA(g);
break;default:throw new RangeError("invalid color index");}}getAtIndex(e){switch(e){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static DiffChannel(e,g){return f.clamp(Math.max(e,g)-Math.min(e,g),0,1)}static Diff(e,g){const k=new f.Color;k.setR(Math.max(e._r,g._r)-Math.min(e._r,g._r));k.setG(Math.max(e._g,g._g)-Math.min(e._g,g._g));k.setB(Math.max(e._b,g._b)-Math.min(e._b,g._b));k.setA(Math.max(e._a,
g._a)-Math.min(e._a,g._a));return k}static DiffNoAlpha(e,g){const k=new f.Color(0,0,0,1);k.setR(Math.max(e._r,g._r)-Math.min(e._r,g._r));k.setG(Math.max(e._g,g._g)-Math.min(e._g,g._g));k.setB(Math.max(e._b,g._b)-Math.min(e._b,g._b));return k}static GetHue(e,g,k){const m=Math.max(e,g,k),p=Math.min(e,g,k);if(m===p)return 0;let n=0;switch(m){case e:n=(g-k)/(m-p)+(g<k?6:0);break;case g:n=(k-e)/(m-p)+2;break;case k:n=(e-g)/(m-p)+4}return Math.round(n/6*360)}static GetSaturation(e,g,k){const m=Math.max(e,
g,k);e=Math.min(e,g,k);if(m===e)return 0;g=m-e;return Math.round(100*(.5<(m+e)/2?g/(2-m-e):g/(m+e)))}static GetLuminosity(e,g,k){const m=Math.max(e,g,k);return m?Math.round((m+Math.min(e,g,k))/2*100):0}};f.Color.White=Object.freeze(f.New(f.Color,1,1,1,1));f.Color.Black=Object.freeze(f.New(f.Color,0,0,0,1));f.Color.TransparentBlack=Object.freeze(f.New(f.Color,0,0,0,0))}"use strict";
{const f=self.C3;f.Vector2=class{constructor(b,a){this._y=this._x=0;b instanceof f.Vector2?this.copy(b):this.set(b||0,a||0)}set(b,a){this._x=+b;this._y=+a}copy(b){this._x=b._x;this._y=b._y}equals(b){return this._x===b._x&&this._y===b._y}setX(b){this._x=+b}getX(){return this._x}setY(b){this._y=+b}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,a){b[a++]=this._x;b[a]=this._y}offset(b,a){this._x+=+b;this._y+=+a}scale(b,
a){this._x*=b;this._y*=a}round(){this._x=Math.round(this._x);this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x);this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y)}angle(){return f.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}rotatePrecalc(b,a){const d=this._x*a-this._y*b;this._y=this._y*a+this._x*b;this._x=d}rotate(b){0!==b&&this.rotatePrecalc(Math.sin(b),Math.cos(b))}rotateAbout(b,
a,d){0===b||a===this._x&&d===this._y||(this._x-=a,this._y-=d,this.rotatePrecalc(Math.sin(b),Math.cos(b)),this._x+=+a,this._y+=+d)}move(b,a){0!==a&&(this._x+=Math.cos(b)*a,this._y+=Math.sin(b)*a)}normalize(){const b=this.length();0!==b&&1!==b&&(this._x/=b,this._y/=b)}clamp(b,a){this._x=f.clamp(this._x,b,a);this._y=f.clamp(this._y,b,a)}}}"use strict";
{const f=self.C3;f.Rect=class{constructor(b,a,d,c){this._bottom=this._right=this._top=this._left=0;b instanceof f.Rect?this.copy(b):this.set(b||0,a||0,d||0,c||0)}set(b,a,d,c){this._left=+b;this._top=+a;this._right=+d;this._bottom=+c}setWH(b,a,d,c){b=+b;a=+a;this._left=b;this._top=a;this._right=b+ +d;this._bottom=a+ +c}copy(b){this._left=+b._left;this._top=+b._top;this._right=+b._right;this._bottom=+b._bottom}clone(){return new f.Rect(this._left,this._top,this._right,this._bottom)}static Merge(b,a){const d=
new f.Rect;d.setLeft(Math.min(b._left,a._left));d.setTop(Math.min(b._top,a._top));d.setRight(Math.max(b._right,a._right));d.setBottom(Math.max(b._bottom,a._bottom));return d}static FromObject(b){return new f.Rect(b.left,b.top,b.right,b.bottom)}equals(b){return this._left===b._left&&this._top===b._top&&this._right===b._right&&this._bottom===b._bottom}setLeft(b){this._left=+b}getLeft(){return this._left}setTop(b){this._top=+b}getTop(){return this._top}setRight(b){this._right=+b}getRight(){return this._right}setBottom(b){this._bottom=
+b}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),this.height())}writeToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a]=this._bottom}writeAsQuadToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a++]=this._top;b[a++]=this._right;b[a++]=this._bottom;b[a++]=this._left;b[a]=this._bottom}width(){return this._right-
this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right+=b;this._bottom+=a}offsetLeft(b){this._left+=+b}offsetTop(b){this._top+=+b}offsetRight(b){this._right+=+b}offsetBottom(b){this._bottom+=+b}toSquare(b){if("x"!==b)throw Error("invalid axis, only 'x' supported");this._bottom=this._top<this._bottom?this._left<this._right?this._top+this.width():this._top-this.width():
this._left<this._right?this._top-this.width():this._top+this.width()}inflate(b,a){b=+b;a=+a;this._left-=b;this._top-=a;this._right+=b;this._bottom+=a}deflate(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right-=b;this._bottom-=a}multiply(b,a){this._left*=b;this._top*=a;this._right*=b;this._bottom*=a}divide(b,a){this._left/=b;this._top/=a;this._right/=b;this._bottom/=a}mirrorAround(b){this._left=+b-this._left;this._right=+b-this._right}flipAround(b){this._top=+b-this._top;this._bottom=+b-this._bottom}swapLeftRight(){const b=
this._left;this._left=this._right;this._right=b}swapTopBottom(){const b=this._top;this._top=this._bottom;this._bottom=b}shuntY(b){const a=this._top;this._top=+b-this._bottom;this._bottom=+b-a}round(){this._left=Math.round(this._left);this._top=Math.round(this._top);this._right=Math.round(this._right);this._bottom=Math.round(this._bottom)}roundInner(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}roundOuter(){this._left=
Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}floor(){this._left=Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}ceil(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}clamp(b,a,d,c){this._left<b&&(this._left=+b);this._top<a&&(this._top=+a);this._right>
d&&(this._right=+d);this._bottom>c&&(this._bottom=+c)}clampFlipped(b,a,d,c){this._left<b&&(this._left=+b);this._top>a&&(this._top=+a);this._right>d&&(this._right=+d);this._bottom<c&&(this._bottom=+c)}normalize(){this._left>this._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(b){return!(b._right<this._left||b._bottom<this._top||b._left>this._right||b._top>this._bottom)}intersectsRectOffset(b,a,d){return!(b._right+a<this._left||b._bottom+d<this._top||b._left+
a>this._right||b._top+d>this._bottom)}containsPoint(b,a){return b>=this._left&&b<=this._right&&a>=this._top&&a<=this._bottom}containsRect(b){return b._left>=this._left&&b._top>=this._top&&b._right<=this._right&&b._bottom<=this._bottom}expandToContain(b){b._left<this._left&&(this._left=+b._left);b._top<this._top&&(this._top=+b._top);b._right>this._right&&(this._right=+b._right);b._bottom>this._bottom&&(this._bottom=+b._bottom)}lerpInto(b){this._left=f.lerp(b._left,b._right,this._left);this._top=f.lerp(b._top,
b._bottom,this._top);this._right=f.lerp(b._left,b._right,this._right);this._bottom=f.lerp(b._top,b._bottom,this._bottom)}}}"use strict";
{const f=self.C3;f.Quad=class{constructor(b,a,d,c,e,g,k,m){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;b instanceof f.Quad?this.copy(b):this.set(b||0,a||0,d||0,c||0,e||0,g||0,k||0,m||0)}set(b,a,d,c,e,g,k,m){this._tlx=+b;this._tly=+a;this._trx=+d;this._try=+c;this._brx=+e;this._bry=+g;this._blx=+k;this._bly=+m}setRect(b,a,d,c){this.set(b,a,d,a,d,c,b,c)}copy(b){this._tlx=b._tlx;this._tly=b._tly;this._trx=b._trx;this._try=b._try;this._brx=b._brx;this._bry=b._bry;
this._blx=b._blx;this._bly=b._bly}equals(b){return this._tlx===b._tlx&&this._tly===b._tly&&this._trx===b._trx&&this._try===b._try&&this._brx===b._brx&&this._bry===b._bry&&this._blx===b._blx&&this._bly===b._bly}setTlx(b){this._tlx=+b}getTlx(){return this._tlx}setTly(b){this._tly=+b}getTly(){return this._tly}setTrx(b){this._trx=+b}getTrx(){return this._trx}setTry(b){this._try=+b}getTry(){return this._try}setBrx(b){this._brx=+b}getBrx(){return this._brx}setBry(b){this._bry=+b}getBry(){return this._bry}setBlx(b){this._blx=
+b}getBlx(){return this._blx}setBly(b){this._bly=+b}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}toArray(){return[this._tlx,this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,a){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=this._trx;b[a++]=this._try;b[a++]=this._brx;
b[a++]=this._bry;b[a++]=this._blx;b[a]=this._bly}writeToTypedArray3D(b,a,d){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=d;b[a++]=this._trx;b[a++]=this._try;b[a++]=d;b[a++]=this._brx;b[a++]=this._bry;b[a++]=d;b[a++]=this._blx;b[a++]=this._bly;b[a]=d}offset(b,a){b=+b;a=+a;this._tlx+=b;this._tly+=a;this._trx+=b;this._try+=a;this._brx+=b;this._bry+=a;this._blx+=b;this._bly+=a}round(){this._tlx=Math.round(this._tlx);this._tly=Math.round(this._tly);this._trx=Math.round(this._trx);this._try=Math.round(this._try);
this._brx=Math.round(this._brx);this._bry=Math.round(this._bry);this._blx=Math.round(this._blx);this._bly=Math.round(this._bly)}floor(){this._tlx=Math.floor(this._tlx);this._tly=Math.floor(this._tly);this._trx=Math.floor(this._trx);this._try=Math.floor(this._try);this._brx=Math.floor(this._brx);this._bry=Math.floor(this._bry);this._blx=Math.floor(this._blx);this._bly=Math.floor(this._bly)}ceil(){this._tlx=Math.ceil(this._tlx);this._tly=Math.ceil(this._tly);this._trx=Math.ceil(this._trx);this._try=
Math.ceil(this._try);this._brx=Math.ceil(this._brx);this._bry=Math.ceil(this._bry);this._blx=Math.ceil(this._blx);this._bly=Math.ceil(this._bly)}setFromRect(b){this._tlx=b._left;this._tly=b._top;this._trx=b._right;this._try=b._top;this._brx=b._right;this._bry=b._bottom;this._blx=b._left;this._bly=b._bottom}setFromRotatedRect(b,a){0===a?this.setFromRect(b):this.setFromRotatedRectPrecalc(b,Math.sin(a),Math.cos(a))}setFromRotatedRectPrecalc(b,a,d){const c=b._left*a,e=b._top*a,g=b._right*a;a*=b._bottom;
const k=b._left*d,m=b._top*d,p=b._right*d;b=b._bottom*d;this._tlx=k-e;this._tly=m+c;this._trx=p-e;this._try=m+g;this._brx=p-a;this._bry=b+g;this._blx=k-a;this._bly=b+c}getBoundingBox(b){b.set(Math.min(this._tlx,this._trx,this._brx,this._blx),Math.min(this._tly,this._try,this._bry,this._bly),Math.max(this._tlx,this._trx,this._brx,this._blx),Math.max(this._tly,this._try,this._bry,this._bly))}containsPoint(b,a){var d=this._trx-this._tlx,c=this._try-this._tly;const e=this._brx-this._tlx,g=this._bry-this._tly;
b-=this._tlx;a-=this._tly;var k=d*d+c*c;let m=d*e+c*g;c=d*b+c*a;const p=e*e+g*g,n=e*b+g*a;let u=1/(k*p-m*m);d=(p*c-m*n)*u;k=(k*n-m*c)*u;if(0<=d&&0<k&&1>d+k)return!0;d=this._blx-this._tlx;c=this._bly-this._tly;k=d*d+c*c;m=d*e+c*g;c=d*b+c*a;u=1/(k*p-m*m);d=(p*c-m*n)*u;k=(k*n-m*c)*u;return 0<=d&&0<k&&1>d+k}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(b,a,d,c){return this.containsPoint(b,a)||this.containsPoint(d,c)?
!0:f.segmentIntersectsQuad(b,a,d,c,this)}intersectsQuad(b){var a=b.midX(),d=b.midY();if(this.containsPoint(a,d))return!0;a=this.midX();d=this.midY();if(b.containsPoint(a,d))return!0;a=this._tlx;d=this._tly;const c=this._trx,e=this._try,g=this._brx,k=this._bry,m=this._blx,p=this._bly;return f.segmentIntersectsQuad(a,d,c,e,b)||f.segmentIntersectsQuad(c,e,g,k,b)||f.segmentIntersectsQuad(g,k,m,p,b)||f.segmentIntersectsQuad(m,p,a,d,b)}mirror(){this._swap(0,2);this._swap(1,3);this._swap(6,4);this._swap(7,
5)}flip(){this._swap(0,6);this._swap(1,7);this._swap(2,4);this._swap(3,5)}diag(){this._swap(2,6);this._swap(3,7)}_swap(b,a){const d=this._getAtIndex(b);this._setAtIndex(b,this._getAtIndex(a));this._setAtIndex(a,d)}_getAtIndex(b){switch(b){case 0:return this._tlx;case 1:return this._tly;case 2:return this._trx;case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index");}}_setAtIndex(b,
a){a=+a;switch(b){case 0:this._tlx=a;break;case 1:this._tly=a;break;case 2:this._trx=a;break;case 3:this._try=a;break;case 4:this._brx=a;break;case 5:this._bry=a;break;case 6:this._blx=a;break;case 7:this._bly=a;break;default:throw new RangeError("invalid quad point index");}}}}"use strict";
{const f=self.C3,b=[0,0,1,0,1,1,0,1],a=f.New(f.Quad);f.CollisionPoly=class extends f.DefendedBase{constructor(d,c=!0){super();d||(d=b);this._ptsArr=Float64Array.from(d);this._bbox=new f.Rect;this._isBboxChanged=!0;this._enabled=c}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(d){this._ptsArr.length===d.length?this._ptsArr.set(d):this._ptsArr=Float64Array.from(d);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(b)}copy(d){this.setPoints(d._ptsArr)}setBboxChanged(){this._isBboxChanged=
!0}_updateBbox(){if(this._isBboxChanged){var d=this._ptsArr,c=d[0],e=d[1],g=c,k=e;for(let m=0,p=d.length;m<p;m+=2){const n=d[m],u=d[m+1];n<c&&(c=n);n>g&&(g=n);u<e&&(e=u);u>k&&(k=u)}this._bbox.set(c,e,g,k);this._isBboxChanged=!1}}setFromRect(d,c,e){let g=this._ptsArr;8!==g.length&&(this._ptsArr=g=new Float64Array(8));g[0]=d.getLeft()-c;g[1]=d.getTop()-e;g[2]=d.getRight()-c;g[3]=d.getTop()-e;g[4]=d.getRight()-c;g[5]=d.getBottom()-e;g[6]=d.getLeft()-c;g[7]=d.getBottom()-e;this._bbox.copy(d);0===c&&0===
e||this._bbox.offset(-c,-e);this._isBboxChanged=!1}setFromQuad(d,c,e){a.copy(d);a.offset(c,e);this.setPoints(a.toArray());this._isBboxChanged=!0}transform(d,c,e){let g=0,k=1;0!==e&&(g=Math.sin(e),k=Math.cos(e));this.transformPrecalc(d,c,g,k)}transformPrecalc(d,c,e,g){const k=this._ptsArr;for(let m=0,p=k.length;m<p;m+=2){const n=m+1,u=k[m]*d,q=k[n]*c;k[m]=u*g-q*e;k[n]=q*g+u*e}this._isBboxChanged=!0}offset(d,c){const e=this._ptsArr;for(let g=0,k=e.length;g<k;g+=2)e[g]+=d,e[g+1]+=c}containsPoint(d,c){const e=
this._ptsArr;if(d===e[0]&&c===e[1])return!0;this._updateBbox();var g=this._bbox;const k=g.getLeft()-110,m=g.getTop()-101,p=g.getRight()+131;g=g.getBottom()+120;let n,u,q,r,t,x,z,D;k<d?(n=k,q=d):(n=d,q=k);m<c?(u=m,r=c):(u=c,r=m);p<d?(t=p,z=d):(t=d,z=p);g<c?(x=g,D=c):(x=c,D=g);let G=0,w=0;for(let I=0,P=e.length;I<P;I+=2){var B=(I+2)%P;const E=e[I],J=e[I+1],O=e[B];B=e[B+1];f.segmentsIntersectPreCalc(k,m,d,c,n,q,u,r,E,J,O,B)&&++G;f.segmentsIntersectPreCalc(p,g,d,c,t,z,x,D,E,J,O,B)&&++w}return 1===G%2||
1===w%2}intersectsPoly(d,c,e){const g=d._ptsArr,k=this._ptsArr;if(this.containsPoint(g[0]+c,g[1]+e)||d.containsPoint(k[0]-c,k[1]-e))return!0;for(let p=0,n=k.length;p<n;p+=2){var m=(p+2)%n;d=k[p];const u=k[p+1],q=k[m];m=k[m+1];let r,t,x,z;d<q?(r=d,x=q):(r=q,x=d);u<m?(t=u,z=m):(t=m,z=u);for(let D=0,G=g.length;D<G;D+=2){const w=(D+2)%G;if(f.segmentsIntersectPreCalc(d,u,q,m,r,x,t,z,g[D]+c,g[D+1]+e,g[w]+c,g[w+1]+e))return!0}}return!1}intersectsSegment(d,c,e,g,k,m){if(this.containsPoint(e-d,g-c)||this.containsPoint(k-
d,m-c))return!0;let p,n,u,q;e<k?(p=e,u=k):(p=k,u=e);g<m?(n=g,q=m):(n=m,q=g);const r=this._ptsArr;for(let t=0,x=r.length;t<x;t+=2){const z=(t+2)%x;if(f.segmentsIntersectPreCalc(e,g,k,m,p,u,n,q,r[t]+d,r[t+1]+c,r[z]+d,r[z+1]+c))return!0}return!1}mirror(d){const c=this._ptsArr;for(let e=0,g=c.length;e<g;e+=2)c[e]=2*d-c[e];this._isBboxChanged=!0}flip(d){const c=this._ptsArr;for(let e=0,g=c.length;e<g;e+=2){const k=e+1;c[k]=2*d-c[k]}this._isBboxChanged=!0}diag(){const d=this._ptsArr;for(let c=0,e=d.length;c<
e;c+=2){const g=c+1,k=d[c];d[c]=d[g];d[g]=k}this._isBboxChanged=!0}GetMidX(){const d=this._ptsArr;let c=0;for(let e=0,g=d.length;e<g;e+=2)c+=d[e];return c/this.pointCount()}GetMidY(){const d=this._ptsArr;let c=0;for(let e=0,g=d.length;e<g;e+=2)c+=d[e+1];return c/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}}"use strict";
{const f=self.C3;f.PairMap=class extends f.DefendedBase{constructor(b){super();this._firstMap=new Map;if(b)for(const [a,d,c]of b)this.Set(a,d,c)}Release(){this.Clear();this._firstMap=null}Clear(){const b=this._firstMap;for(const a of b.values())a.clear();b.clear()}Set(b,a,d){const c=this._firstMap;let e=c.get(b);e||(e=new Map,c.set(b,e));e.set(a,d)}Get(b,a){return(b=this._firstMap.get(b))?b.get(a):b}Has(b,a){return(b=this._firstMap.get(b))?b.has(a):!1}Delete(b,a){const d=this._firstMap,c=d.get(b);
if(!c)return!1;(a=c.delete(a))&&0===c.size&&d.delete(b);return a}DeleteEither(b){const a=this._firstMap,d=a.get(b);d&&(d.clear(),a.delete(b));for(const [c,e]of a.entries())e.delete(b)&&0===e.size&&a.delete(c)}GetSize(){let b=0;for(const a of this._firstMap.values())b+=a.size;return b}*values(){for(const b of this._firstMap.values())yield*b.values()}*keyPairs(){for(const [b,a]of this._firstMap.entries())for(const d of a.keys())yield[b,d]}*entries(){for(const [b,a]of this._firstMap.entries())for(const [d,
c]of a.entries())yield[b,d,c]}}}"use strict";
{const f=self.C3;f.ArraySet=class extends f.DefendedBase{constructor(){super();this._set=new Set;this._arr=[];this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear();f.clearArray(this._arr);this._needToRebuildArray=!1}Add(b){this._set.has(b)||(this._set.add(b),this._needToRebuildArray||this._arr.push(b))}Has(b){return this._set.has(b)}Delete(b){this._set.delete(b)&&(this._needToRebuildArray=!0)}GetSize(){return this._set.size}IsEmpty(){return 0===this._set.size}GetArray(){this._needToRebuildArray&&
(this._RebuildArray(),this._needToRebuildArray=!1);return this._arr}_RebuildArray(){const b=this._arr;f.clearArray(b);for(const a of this._set)b.push(a)}}}"use strict";
{const f=new Map,b=new Map,a=new Map,d=new Map,c=new Map,e=new Map;e.set("linear","noease");e.set("default","noease");self.Ease=class q{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(r,...t){this._CreateEaseMap();a.has(r)||a.set(r,new Map);r=a.get(r);return[...b.keys()].concat([...r.keys()]).filter(x=>!t.includes(x))}static GetRuntimeEaseNames(){this._CreateEaseMap();return[...b.keys()].concat([...d.keys()])}static IsNamePredefined(r){this._CreateEaseMap();
return[...b.keys()].includes(r)}static _GetEase(r){const t=e.get(r);if(t)return f.get(t);if(q.IsNamePredefined(r))return f.get(r);if(c.has(r))return c.get(r)}static GetEditorEase(r,t){this._CreateEaseMap();const x=q._GetEase(r);return x?x:a.get(t).get(r)}static GetRuntimeEase(r){this._CreateEaseMap();const t=q._GetEase(r);return t?t:d.get(r)}static GetEaseFromIndex(r){this._CreateEaseMap();return this.GetRuntimeEaseNames()[r]}static GetIndexForEase(r,t){this._CreateEaseMap();return this.GetEditorEaseNames(t).indexOf(r)}static _CreateEaseMap(){0===
f.size&&(this._AddPredifinedEase("default",()=>{}),this._AddPredifinedEase("noease",this.NoEase),this._AddPredifinedEase("easeinsine",this.EaseInSine),this._AddPredifinedEase("easeoutsine",this.EaseOutSine),this._AddPredifinedEase("easeinoutsine",this.EaseInOutSine),this._AddPredifinedEase("easeinelastic",this.EaseInElastic),this._AddPredifinedEase("easeoutelastic",this.EaseOutElastic),this._AddPredifinedEase("easeinoutelastic",this.EaseInOutElastic),this._AddPredifinedEase("easeinback",this.EaseInBack),
this._AddPredifinedEase("easeoutback",this.EaseOutBack),this._AddPredifinedEase("easeinoutback",this.EaseInOutBack),this._AddPredifinedEase("easeinbounce",this.EaseInBounce),this._AddPredifinedEase("easeoutbounce",this.EaseOutBounce),this._AddPredifinedEase("easeinoutbounce",this.EaseInOutBounce),this._AddPredifinedEase("easeincubic",this.EaseInCubic),this._AddPredifinedEase("easeoutcubic",this.EaseOutCubic),this._AddPredifinedEase("easeinoutcubic",this.EaseInOutCubic),this._AddPredifinedEase("easeinquad",
this.EaseInQuad),this._AddPredifinedEase("easeoutquad",this.EaseOutQuad),this._AddPredifinedEase("easeinoutquad",this.EaseInOutQuad),this._AddPredifinedEase("easeinquart",this.EaseInQuart),this._AddPredifinedEase("easeoutquart",this.EaseOutQuart),this._AddPredifinedEase("easeinoutquart",this.EaseInOutQuart),this._AddPredifinedEase("easeinquint",this.EaseInQuint),this._AddPredifinedEase("easeoutquint",this.EaseOutQuint),this._AddPredifinedEase("easeinoutquint",this.EaseInOutQuint),this._AddPredifinedEase("easeincirc",
this.EaseInCirc),this._AddPredifinedEase("easeoutcirc",this.EaseOutCirc),this._AddPredifinedEase("easeinoutcirc",this.EaseInOutCirc),this._AddPredifinedEase("easeinexpo",this.EaseInExpo),this._AddPredifinedEase("easeoutexpo",this.EaseOutExpo),this._AddPredifinedEase("easeinoutexpo",this.EaseInOutExpo),this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier),this._AddPrivateCustomEase("spline",this.EaseSpline))}static _AddPredifinedEase(r,t){q._AddEase(r,t,"predefined")}static _AddPrivateCustomEase(r,
t){q._AddEase(r,t,"private")}static AddCustomEase(r,t,x){this._CreateEaseMap();q._AddEase(r,t,"custom",x)}static RemoveCustomEase(r,t){this.IsNamePredefined(r)||[...c.keys()].includes(r)||(t=a.get(t))&&t.delete(r)}static _AddEase(r,t,x,z){switch(x){case "predefined":f.set(r,t);b.set(r,t);break;case "custom":z?(a.has(z)||a.set(z,new Map),a.get(z).set(r,t)):d.set(r,t);break;case "private":f.set(r,t);c.set(r,t);break;default:throw Error("unexpected ease mode");}}static NoEase(r,t,x,z){return x*r/z+t}static EaseInQuad(r,
t,x,z){return x*(r/=z)*r+t}static EaseOutQuad(r,t,x,z){return-x*(r/=z)*(r-2)+t}static EaseInOutQuad(r,t,x,z){return 1>(r/=z/2)?x/2*r*r+t:-x/2*(--r*(r-2)-1)+t}static EaseInCubic(r,t,x,z){return x*(r/=z)*r*r+t}static EaseOutCubic(r,t,x,z){return x*((r=r/z-1)*r*r+1)+t}static EaseInOutCubic(r,t,x,z){return 1>(r/=z/2)?x/2*r*r*r+t:x/2*((r-=2)*r*r+2)+t}static EaseInQuart(r,t,x,z){return x*(r/=z)*r*r*r+t}static EaseOutQuart(r,t,x,z){return-x*((r=r/z-1)*r*r*r-1)+t}static EaseInOutQuart(r,t,x,z){return 1>(r/=
z/2)?x/2*r*r*r*r+t:-x/2*((r-=2)*r*r*r-2)+t}static EaseInQuint(r,t,x,z){return x*(r/=z)*r*r*r*r+t}static EaseOutQuint(r,t,x,z){return x*((r=r/z-1)*r*r*r*r+1)+t}static EaseInOutQuint(r,t,x,z){return 1>(r/=z/2)?x/2*r*r*r*r*r+t:x/2*((r-=2)*r*r*r*r+2)+t}static EaseInSine(r,t,x,z){return-x*Math.cos(r/z*(Math.PI/2))+x+t}static EaseOutSine(r,t,x,z){return x*Math.sin(r/z*(Math.PI/2))+t}static EaseInOutSine(r,t,x,z){return-x/2*(Math.cos(Math.PI*r/z)-1)+t}static EaseInExpo(r,t,x,z){return 0===r?t:x*Math.pow(2,
10*(r/z-1))+t}static EaseOutExpo(r,t,x,z){return r===z?t+x:x*(-Math.pow(2,-10*r/z)+1)+t}static EaseInOutExpo(r,t,x,z){return 0===r?t:r===z?t+x:1>(r/=z/2)?x/2*Math.pow(2,10*(r-1))+t:x/2*(-Math.pow(2,-10*--r)+2)+t}static EaseInCirc(r,t,x,z){return-x*(Math.sqrt(1-(r/=z)*r)-1)+t}static EaseOutCirc(r,t,x,z){return x*Math.sqrt(1-(r=r/z-1)*r)+t}static EaseInOutCirc(r,t,x,z){return 1>(r/=z/2)?-x/2*(Math.sqrt(1-r*r)-1)+t:x/2*(Math.sqrt(1-(r-=2)*r)+1)+t}static EaseInElastic(r,t,x,z){let D=0,G=x;if(0===r)return t;
if(1===(r/=z))return t+x;D||(D=.3*z);G<Math.abs(x)?(G=x,x=D/4):x=D/(2*Math.PI)*Math.asin(x/G);return-(G*Math.pow(2,10*--r)*Math.sin(2*(r*z-x)*Math.PI/D))+t}static EaseOutElastic(r,t,x,z){let D,G=0,w=x;if(0===r)return t;if(1===(r/=z))return t+x;G||(G=.3*z);w<Math.abs(x)?(w=x,D=G/4):D=G/(2*Math.PI)*Math.asin(x/w);return w*Math.pow(2,-10*r)*Math.sin(2*(r*z-D)*Math.PI/G)+x+t}static EaseInOutElastic(r,t,x,z){let D,G=0,w=x;if(0===r)return t;if(2===(r/=z/2))return t+x;G||(G=.3*z*1.5);w<Math.abs(x)?(w=x,
D=G/4):D=G/(2*Math.PI)*Math.asin(x/w);return 1>r?-.5*w*Math.pow(2,10*--r)*Math.sin(2*(r*z-D)*Math.PI/G)+t:w*Math.pow(2,-10*--r)*Math.sin(2*(r*z-D)*Math.PI/G)*.5+x+t}static EaseInBack(r,t,x,z,D){void 0===D&&(D=1.70158);return x*(r/=z)*r*((D+1)*r-D)+t}static EaseOutBack(r,t,x,z,D){void 0===D&&(D=1.70158);return x*((r=r/z-1)*r*((D+1)*r+D)+1)+t}static EaseInOutBack(r,t,x,z,D){void 0===D&&(D=1.70158);return 1>(r/=z/2)?x/2*r*r*(((D*=1.525)+1)*r-D)+t:x/2*((r-=2)*r*(((D*=1.525)+1)*r+D)+2)+t}static EaseInBounce(r,
t,x,z){return x-q.EaseOutBounce(z-r,0,x,z)+t}static EaseOutBounce(r,t,x,z){return(r/=z)<1/2.75?7.5625*x*r*r+t:r<2/2.75?x*(7.5625*(r-=1.5/2.75)*r+.75)+t:r<2.5/2.75?x*(7.5625*(r-=2.25/2.75)*r+.9375)+t:x*(7.5625*(r-=2.625/2.75)*r+.984375)+t}static EaseInOutBounce(r,t,x,z){return r<z/2?.5*q.EaseInBounce(2*r,0,x,z)+t:.5*q.EaseOutBounce(2*r-z,0,x,z)+.5*x+t}static EaseCubicBezier(r,t,x,z,D){return t+3*r*(x-t)+3*r**2*(t+z-2*x)+r**3*(D-t+3*x-3*z)}static EaseSpline(r,t,x,z,D,G,w,B,I,P){if(z===D&&G===w)return r;
r=u(r,t,z,G,B,P);t=g(x,D,w,I);z=k(x,D,w,I);x=m(x,D,w,I);return p(r,t,z,x)}static GetBezierSamples(r,t,x,z){const D=[],G=g(r,t,x,z),w=k(r,t,x,z);r=m(r,t,x,z);for(t=0;11>t;++t)x=p(.1*t,G,w,r),D.push(x);return D}};const g=(q,r,t,x)=>x-3*t+3*r-q,k=(q,r,t,x)=>3*t-6*r+3*q,m=(q,r,t,x)=>3*(r-q),p=(q,r,t,x)=>((r*q+t)*q+x)*q,n=(q,r,t,x)=>3*r*q*q+2*t*q+x,u=(q,r,t,x,z,D)=>{if(1==q)return 1;for(var G=0,w=1,B=D[w];10!=w&&B<=q;)w++,B=D[w],G+=.1;w--;B=D[w];D=G+(q-B)/(D[w+1]-B)*.1;w=g(r,t,x,z);B=k(r,t,x,z);r=m(r,
t,x,z);t=n(D,w,B,r);if(0!==t)if(.02<=t)for(G=0;4>G;++G)t=p(D,w,B,r)-q,x=n(D,w,B,r),D-=t/x;else{t=G;G+=.1;x=0;let I;do D=t+(G-t)/2,z=p(D,w,B,r)-q,0<z?G=D:t=D,z=1e-7<Math.abs(z),I=10>++x;while(z&&I)}return D}}"use strict";
{const f=self.C3;function b(a){f.IsString(a)}f.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){f.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(a=Math.random()*this.GetTotalWeight()){let d=0;for(const [c,e]of this._items)if(d+=c,a<d)return e;return 0}AddItem(a,d){b(d);this._totalWeight+=a;this._items.push([a,d])}RemoveItem(a,d){b(d);const c=0===a;for(let e=0;e<this._items.length;e++){const g=
this._items[e],k=g[1]===d;if((c||g[0]===a)&&k){this._items.splice(e,1);this._totalWeight-=g[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(a){const d=new f.ProbabilityTable;a=JSON.parse(a);for(const c of a)d.AddItem(c[0],c[1]);return d}}}"use strict";
self.C3.Event=class{constructor(f,b){this.type=f;this.cancelable=!!b;this.isAsync=this.propagationStopped=this.defaultPrevented=!1}preventDefault(){if(!this.cancelable)throw Error(`event '${this.type}' is not cancelable`);this.defaultPrevented=!0}stopPropagation(){if(!this.cancelable)throw Error(`event '${this.type}' cannot be stopped`);if(this.isAsync)throw Error(`cannot stop async event '${this.type}' propagation`);this.propagationStopped=!0}};"use strict";
{const f=self.C3;f.Event.Handler=class extends f.DefendedBase{constructor(b){super();this._type=b;this._captureListeners=[];this._captureListenersSet=new Set;this._listeners=[];this._listenersSet=new Set;this._fireDepth=0;this._queueAddListeners=[];this._queueRemoveCaptureListeners=[];this._queueRemoveListeners=[]}Release(){0<this._fireDepth||(f.clearArray(this._captureListeners),this._captureListenersSet.clear(),f.clearArray(this._listeners),this._listenersSet.clear(),f.clearArray(this._queueAddListeners),
f.clearArray(this._queueRemoveCaptureListeners),f.clearArray(this._queueRemoveListeners),f.Release(this))}_AddListener(b,a){this._IsFiring()?this._queueAddListeners.push([b,a]):a?this._captureListenersSet.has(b)||(this._captureListeners.push(b),this._captureListenersSet.add(b)):this._listenersSet.has(b)||(this._listeners.push(b),this._listenersSet.add(b))}_RemoveListener(b,a){this._IsFiring()?a?this._queueRemoveCaptureListeners.push(b):this._queueRemoveListeners.push(b):a?this._captureListenersSet.has(b)&&
(this._captureListenersSet.delete(b),f.arrayFindRemove(this._captureListeners,b)):this._listenersSet.has(b)&&(this._listenersSet.delete(b),f.arrayFindRemove(this._listeners,b))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){for(var b of this._queueAddListeners)this._AddListener(...b);f.clearArray(this._queueAddListeners);for(var a of this._queueRemoveListeners)this._listenersSet.delete(a);for(const d of this._queueRemoveCaptureListeners)this._captureListenersSet.delete(d);
b=new Set(this._queueRemoveListeners);a=new Set(this._queueRemoveCaptureListeners);f.arrayRemoveAllInSet(this._listeners,b);f.arrayRemoveAllInSet(this._captureListeners,a);f.clearArray(this._queueRemoveCaptureListeners);f.clearArray(this._queueRemoveListeners)}_FireCancellable(b){this._IncreaseFireDepth();let a=!1;for(let d=0,c=this._captureListeners.length;d<c;++d)if(this._captureListeners[d](b),b.propagationStopped){a=!0;break}if(!a)for(let d=0,c=this._listeners.length;d<c&&(this._listeners[d](b),
!b.propagationStopped);++d);this._DecreaseFireDepth();return!b.defaultPrevented}_FireNonCancellable(b){this._IncreaseFireDepth();for(let a=0,d=this._captureListeners.length;a<d;++a)this._captureListeners[a](b);for(let a=0,d=this._listeners.length;a<d;++a)this._listeners[a](b);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&(this._queueAddListeners.length||this._queueRemoveCaptureListeners.length||this._queueRemoveListeners.length)&&
this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(b){b?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(b){let a=[];for(let d=0,c=this._captureListeners.length;d<c;++d){let e=this._captureListeners[d];a.push(f.Asyncify(()=>e(b)))}for(let d=0,c=this._listeners.length;d<c;++d){let e=this._listeners[d];a.push(f.Asyncify(()=>e(b)))}return Promise.all(a).then(()=>!b.defaultPrevented)}_FireAndWait_AsyncOptional(b){const a=[];this._IncreaseFireDepth();for(let c=0,e=this._captureListeners.length;c<
e;++c){var d=this._captureListeners[c](b);d instanceof Promise&&a.push(d)}for(let c=0,e=this._listeners.length;c<e;++c)d=this._listeners[c](b),d instanceof Promise&&a.push(d);this._DecreaseFireDepth();return a.length?Promise.all(a).then(()=>!b.defaultPrevented):!b.defaultPrevented}async _FireAndWaitAsync(b){return await this._FireAndWait_AsyncOptional(b)}async _FireAndWaitAsyncSequential(b){this._IncreaseFireDepth();for(let d=0,c=this._captureListeners.length;d<c;++d){var a=this._captureListeners[d](b);
a instanceof Promise&&await a}for(let d=0,c=this._listeners.length;d<c;++d)a=this._listeners[d](b),a instanceof Promise&&await a;this._DecreaseFireDepth();return!b.defaultPrevented}*_FireAsGenerator(b){this._IncreaseFireDepth();for(let d=0,c=this._captureListeners.length;d<c;++d){var a=this._captureListeners[d](b);f.IsIterator(a)&&(yield*a)}for(let d=0,c=this._listeners.length;d<c;++d)a=this._listeners[d](b),f.IsIterator(a)&&(yield*a);this._DecreaseFireDepth()}}}"use strict";
{const f=self.C3;f.Event.Dispatcher=class extends f.DefendedBase{constructor(){super();this._eventHandlers=new Map;this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw Error("already released");this.ClearEvents();this._dispatcherWasReleased=!0;f.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let b of this._eventHandlers.values())b.Release();this._eventHandlers.clear()}_GetHandlerByType(b,a){let d=this._eventHandlers.get(b);return d?d:a?(d=
f.New(f.Event.Handler,b),this._eventHandlers.set(b,d),d):null}HasAnyHandlerFor(b){return this._eventHandlers.has(b)}addEventListener(b,a,d){this._GetHandlerByType(b,!0)._AddListener(a,!!d)}removeEventListener(b,a,d){let c=this._GetHandlerByType(b,!1);c&&(c._RemoveListener(a,!!d),c._IsEmpty()&&this._eventHandlers.delete(b))}dispatchEvent(b){const a=this._GetHandlerByType(b.type,!1);return a?b.cancelable?a._FireCancellable(b):a._FireNonCancellable(b):!0}dispatchEventAsync(b){const a=this._GetHandlerByType(b.type,
!1);if(!a)return Promise.resolve(!0);b.isAsync=!0;return a._FireAsync(b)}async dispatchEventAndClearAsync(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return!0;this._eventHandlers.delete(b.type);b.isAsync=!0;b=await a._FireAsync(b);a.Release();return b}async dispatchEventAndWaitAsync(b){const a=this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsync(b):!0}dispatchEventAndWait_AsyncOptional(b){const a=this._GetHandlerByType(b.type,!1);return a?a._FireAndWait_AsyncOptional(b):!0}async dispatchEventAndWaitAsyncSequential(b){const a=
this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsyncSequential(b):!0}dispatchGeneratorEvent(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return null;if(b.cancelable)throw Error("not supported");return a._FireAsGenerator(b)}SetDelayRemoveEventsEnabled(b){for(const a of this._eventHandlers.values())a.SetDelayRemoveEventsEnabled(b)}}}"use strict";
{const f=self.C3,b="undefined"!==typeof requestIdleCallback;let a=[],d=-1,c=0;function e(p){d=b&&0===c?requestIdleCallback(g,{timeout:35}):setTimeout(g,0<c?1:p)}function g(p){d=-1;if(a.length){var n=performance.now(),u=0;do{k(a.shift());var q=performance.now();++u;var r=(q-n)/u*1.1}while(a.length&&(b&&0===c&&"undefined"!==typeof p?r<p.timeRemaining():12>q-n+r));-1===d&&a.length&&e(Math.max(16-(q-n),4))}}function k(p){let n;try{n=p.func()}catch(u){p.reject(u);return}p.resolve(n)}let m=f.QueryString.Has("disable-asyncify");
m&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously.");f.Asyncify=function(p){let n=null;f.isDebug&&(n=f.GetCallStack());return new Promise((u,q)=>{a.push({func:p,resolve:u,reject:q,stack:n});m?k(a.pop()):-1===d&&e(16)})};f.Asyncify.SetHighThroughputMode=function(p){if(p)++c;else if(--c,0>c)throw Error("already turned off high throughput mode");}}"use strict";
{const f=self.C3;let b=-1;function a(){b=-1}f.FastGetDateNow=function(){-1===b&&(b=Date.now(),self.setTimeout(a,16));return b};let d=-1,c=-1,e=new Set;function g(){c=d=-1;let k=Date.now();for(let m of e)if(m._CheckTimeout(k)){let p=m._GetDeadline();if(-1===c||p<c)c=p}else e.delete(m);-1!==c&&(d=self.setTimeout(g,Math.max(c-k+100,1E3)))}f.IdleTimeout=class{constructor(k,m){this._callback=k;this._timeout=1E3*m;this._deadline=0;this._isActive=!1}Reset(){let k=f.FastGetDateNow();this._deadline=k+this._timeout;
this._isActive||(e.add(this),this._isActive=!0);-1===d?(c=this._deadline,d=self.setTimeout(g,this._timeout+100)):this._deadline<c&&c>k+1E3&&(self.clearTimeout(d),c=this._deadline,d=self.setTimeout(g,this._timeout+100))}_CheckTimeout(k){return k>=this._deadline?this._callback()?(this._deadline=k+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(e.delete(this),this._isActive=!1,0===e.size&&-1!==d&&(self.clearTimeout(d),c=d=-1))}Release(){this.Cancel();
this._callback=null}}}"use strict";
{const f=self.C3;f.Disposable=class b{constructor(a){this._disposed=!1;this._disposeAction=a}Dispose(){this._disposed||(this._disposed=!0,this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(a){return new b(()=>a.Release())}static From(a,d,c,e,g){if("undefined"===typeof e||null===e)e=!1;else if("boolean"!==typeof e&&"object"!==typeof e)throw new TypeError("invalid event listener options");g&&(c=c.bind(g));
if(d.includes(" ")){d=d.split(" ");g=new f.CompositeDisposable;for(let k of d)a.addEventListener(k,c,e),g.Add(f.New(f.Disposable,()=>a.removeEventListener(k,c,e)));return g}a.addEventListener(d,c,e);return f.New(f.Disposable,()=>a.removeEventListener(d,c,e))}};f.StubDisposable=class extends f.Disposable{SetAction(b){this._disposeAction=b}};f.CompositeDisposable=class extends f.Disposable{constructor(...b){super();this._disposables=new Set;for(let a of b)this.Add(a)}Add(...b){if(this._disposed)throw Error("already disposed");
for(let a of b)this._disposables.add(a)}Remove(b){if(this._disposed)throw Error("already disposed");this._disposables.delete(b)}RemoveAll(){if(this._disposed)throw Error("already disposed");if(this._disposables){for(let b of this._disposables)b.Dispose();this._disposables.clear()}}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw Error("already disposed");this._disposed=!0;for(let b of this._disposables)b.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}}"use strict";
{const f=self.C3;f.KahanSum=class extends f.DefendedBase{constructor(){super();this._sum=this._t=this._y=this._c=0}Add(b){this._y=+b-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(b){this._sum-=+b}Get(){return this._sum}Reset(){this._sum=this._t=this._y=this._c=0}Set(b){this._t=this._y=this._c=0;this._sum=+b}Release(){}}}"use strict";
{const f=self.C3,b={RBnode:function(a){this.tree=a;this.left=this.right=this.tree.sentinel;this.parent=null;this.color=!1;this.key=null},RedBlackSet:function(a){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=a||this.default_compare}};b.RedBlackSet.prototype.default_compare=function(a,d){return a<d?-1:d<a?1:0};b.RedBlackSet.prototype.clone=function(){var a=new b.RedBlackSet(this.compare);a.insertAll(this);return a};
b.RedBlackSet.prototype.clear=function(){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel};b.RedBlackSet.prototype.leftRotate=function(a){var d=a.right;a.right=d.left;d.left!=this.sentinel&&(d.left.parent=a);d.parent=a.parent;a.parent==this.sentinel?this.root=d:a==a.parent.left?a.parent.left=d:a.parent.right=d;d.left=a;a.parent=d};b.RedBlackSet.prototype.rightRotate=function(a){var d=a.left;a.left=d.right;d.right!=this.sentinel&&
(d.right.parent=a);d.parent=a.parent;a.parent==this.sentinel?this.root=d:a==a.parent.right?a.parent.right=d:a.parent.left=d;d.right=a;a.parent=d};b.RedBlackSet.prototype.insert=function(a){if(this.contains(a))this.get_(a).key=a;else{var d=new b.RBnode(this);d.key=a;a=this.sentinel;for(var c=this.root;c!=this.sentinel;)a=c,c=0>this.compare(d.key,c.key)?c.left:c.right;d.parent=a;a==this.sentinel?this.root=d:0>this.compare(d.key,a.key)?a.left=d:a.right=d;d.left=this.sentinel;d.right=this.sentinel;d.color=
!0;this.insertFixup(d);this.size++}};b.RedBlackSet.prototype.insertFixup=function(a){for(;a!=this.sentinel&&a!=this.root&&1==a.parent.color;)if(a.parent==a.parent.parent.left){var d=a.parent.parent.right;1==d.color?(a.parent.color=!1,d.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.right&&(a=a.parent,this.leftRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.rightRotate(a.parent.parent))}else d=a.parent.parent.left,1==d.color?(a.parent.color=
!1,d.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.left&&(a=a.parent,this.rightRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.leftRotate(a.parent.parent));this.root.color=!1};b.RedBlackSet.prototype.delete_=function(a){var d=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a);var c=d.left!=this.sentinel?d.left:d.right;c.parent=d.parent;d.parent==this.sentinel?this.root=c:d==d.parent.left?d.parent.left=c:d.parent.right=
c;d!=a&&(a.key=d.key);0==d.color&&this.deleteFixup(c);this.size--};b.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&0==a.color;)if(a==a.parent.left){var d=a.parent.right;1==d.color&&(d.color=!1,a.parent.color=!0,this.leftRotate(a.parent),d=a.parent.right);0==d.left.color&&0==d.right.color?(d.color=!0,a=a.parent):(0==d.right.color&&(d.left.color=!1,d.color=!0,this.rightRotate(d),d=a.parent.right),d.color=a.parent.color,a.parent.color=!1,d.right.color=!1,this.leftRotate(a.parent),
a=this.root)}else d=a.parent.left,1==d.color&&(d.color=!1,a.parent.color=!0,this.rightRotate(a.parent),d=a.parent.left),0==d.right.color&&0==d.left.color?(d.color=!0,a=a.parent):(0==d.left.color&&(d.right.color=!1,d.color=!0,this.leftRotate(d),d=a.parent.left),d.color=a.parent.color,a.parent.color=!1,d.left.color=!1,this.rightRotate(a.parent),a=this.root);a.color=!1};b.RedBlackSet.prototype.remove=function(a){a=this.get_(a);if(a!=this.sentinel){var d=a.key;this.delete_(a);return d}return null};b.RedBlackSet.prototype.removeSwapped=
function(a,d){this.remove(d)};b.RedBlackSet.prototype.min=function(a){for(;a.left!=this.sentinel;)a=a.left;return a};b.RedBlackSet.prototype.max=function(a){for(;a.right!=this.sentinel;)a=a.right;return a};b.RedBlackSet.prototype.successor_=function(a){if(a.right!=this.sentinel)return this.min(a.right);for(var d=a.parent;d!=this.sentinel&&a==d.right;)a=d,d=d.parent;return d};b.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var d=a.parent;d!=this.sentinel&&
a==d.left;)a=d,d=d.parent;return d};b.RedBlackSet.prototype.successor=function(a){if(0<this.size){a=this.get_(a);if(a==this.sentinel)return null;if(a.right!=this.sentinel)return this.min(a.right).key;for(var d=a.parent;d!=this.sentinel&&a==d.right;)a=d,d=d.parent;return d!=this.sentinel?d.key:null}return null};b.RedBlackSet.prototype.predecessor=function(a){if(0<this.size){a=this.get_(a);if(a==this.sentinel)return null;if(a.left!=this.sentinel)return this.max(a.left).key;for(var d=a.parent;d!=this.sentinel&&
a==d.left;)a=d,d=d.parent;return d!=this.sentinel?d.key:null}return null};b.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};b.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key};b.RedBlackSet.prototype.get_=function(a){for(var d=this.root;d!=this.sentinel&&0!=this.compare(d.key,a);)d=0>this.compare(a,d.key)?d.left:d.right;return d};b.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key};b.RedBlackSet.prototype.getValues=function(){var a=
[];this.forEach(function(d){a.push(d)});return a};b.RedBlackSet.prototype.insertAll=function(a){if("array"==b.typeOf(a))for(var d=0;d<a.length;d++)this.insert(a[d]);else if("function"==b.typeOf(a.forEach))a.forEach(this.insert,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),d=0;d<a.length;d++)this.insert(a[d]);else if("object"==b.typeOf(a))for(d in a)this.insert(a[d])};b.RedBlackSet.prototype.removeAll=function(a){if("array"==b.typeOf(a))for(var d=0;d<a.length;d++)this.remove(a[d]);
else if("function"==b.typeOf(a.forEach))a.forEach(this.removeSwapped,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),d=0;d<a.length;d++)this.remove(a[d]);else if("object"==b.typeOf(a))for(d in a)this.remove(a[d])};b.RedBlackSet.prototype.containsAll=function(a){if("array"==b.typeOf(a)){for(var d=0;d<a.length;d++)if(!this.contains(a[d]))return!1;return!0}if("function"==b.typeOf(a.forEach))return a.every(this.contains,this);if("function"==b.typeOf(a.getValues)){a=a.getValues();for(d=
0;d<a.length;d++)if(!this.contains(a[d]))return!1;return!0}if("object"==b.typeOf(a)){for(d in a)if(!this.contains(a[d]))return!1;return!0}};b.RedBlackSet.prototype.range=function(a,d){var c=[];this.traverseFromTo(function(e){c.push(e)},a,d);return c};b.RedBlackSet.prototype.traverse=function(a,d){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel&&!a.call(d,c.key,this);)c=this.successor_(c)};b.RedBlackSet.prototype.traverseFrom=function(a,d,c){if(!this.isEmpty())for(d=this.get_(d);d!=
this.sentinel&&!a.call(c,d.key,this);)d=this.successor_(d)};b.RedBlackSet.prototype.traverseTo=function(a,d,c){if(!this.isEmpty()){var e=this.min(this.root);for(d=this.get_(d);e!=d&&!a.call(c,e.key,this);)e=this.successor_(e)}};b.RedBlackSet.prototype.traverseFromTo=function(a,d,c,e){if(!this.isEmpty())for(d=this.get_(d),c=this.get_(c);d!=c&&!a.call(e,d.key,this);)d=this.successor_(d)};b.RedBlackSet.prototype.traverseBackwards=function(a,d){if(!this.isEmpty())for(var c=this.max(this.root);c!=this.sentinel&&
!a.call(d,c.key,this);)c=this.predeccessor_(c)};b.RedBlackSet.prototype.forEach=function(a,d){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.call(d,c.key,c.key,this)};b.RedBlackSet.prototype.some=function(a,d){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(a.call(d,c.key,c.key,this))return!0;return!1};b.RedBlackSet.prototype.every=function(a,d){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=
this.successor_(c))if(!a.call(d,c.key,c.key,this))return!1;return!0};b.RedBlackSet.prototype.map=function(a,d){var c=[];if(this.isEmpty())return c;for(var e=this.min(this.root);e!=this.sentinel;e=this.successor_(e))c.push(a.call(d,e.key,e.key,this));return c};b.RedBlackSet.prototype.filter=function(a,d){var c=[];if(this.isEmpty())return c;for(var e=this.min(this.root);e!=this.sentinel;e=this.successor_(e))a.call(d,e.key,e.key,this)&&c.push(e.key);return c};b.RedBlackSet.prototype.getCount=function(){return this.size};
b.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};b.RedBlackSet.prototype.isSubsetOf=function(a){var d=b.getCount(a);if(this.getCount()>d)return!1;d=0;if(this.isEmpty())return!0;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))b.contains.call(a,a,c.key)&&d++;return d==this.getCount()};b.RedBlackSet.prototype.intersection=function(a){var d=new b.RedBlackSet(this.compare);if(this.isEmpty())return d;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.contains.call(a,
c.key,c.key,this)&&d.insert(c.key);return d};f.RedBlackSet=class extends f.DefendedBase{constructor(a){super();this._rbSet=new b.RedBlackSet(a);this._enableQueue=!1;this._queueInsert=new Set;this._queueRemove=new Set}Add(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.delete(a):this._queueInsert.add(a):this._rbSet.insert(a)}Remove(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.add(a):this._queueInsert.delete(a):this._rbSet.remove(a)}Has(a){return this._enableQueue?this._queueInsert.has(a)?
!0:!this._queueRemove.has(a)&&this._rbSet.contains(a):this._rbSet.contains(a)}Clear(){this._rbSet.clear();this._queueInsert.clear();this._queueRemove.clear()}toArray(){if(this._enableQueue)throw Error("cannot be used in queueing mode");return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()+this._queueInsert.size-this._queueRemove.size}IsEmpty(){return 0===this.GetSize()}Front(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");
const a=this._rbSet;return a.min(a.root).key}Shift(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");const a=this.Front();this.Remove(a);return a}SetQueueingEnabled(a){a=!!a;if(this._enableQueue!==a&&(this._enableQueue=a,!a)){for(const d of this._queueRemove)this._rbSet.remove(d);this._queueRemove.clear();for(const d of this._queueInsert)this._rbSet.insert(d);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){var a=
this._rbSet;for(let d=a.min(a.root);d!=a.sentinel;d=a.successor_(d))yield d.key}}[Symbol.iterator](){return this.values()}}}"use strict";
{const f=self.C3;f.PromiseThrottle=class{constructor(b=f.hardwareConcurrency){this._maxParallel=b;this._queue=[];this._activeCount=0}Add(b){return new Promise((a,d)=>{this._queue.push({func:b,resolve:a,reject:d});this._MaybeStartNext()})}_FindInQueue(b){for(let a=0,d=this._queue.length;a<d;++a)if(this._queue[a].func===b)return a;return-1}RemoveAndResolve(b,a){b=this._FindInQueue(b);if(-1===b)throw Error("cannot find promise to resolve");this._queue[b].resolve(a);this._queue.splice(b,1)}RemoveAndReject(b,
a){b=this._FindInQueue(b);if(-1===b)throw Error("cannot find promise to reject");this._queue[b].reject(a);this._queue.splice(b,1)}async _MaybeStartNext(){if(this._queue.length&&!(this._activeCount>=this._maxParallel)){this._activeCount++;var b=this._queue.shift();try{const a=await b.func();b.resolve(a)}catch(a){b.reject(a)}this._activeCount--;this._MaybeStartNext()}}static async Batch(b,a){const d=[];let c=!1;const e=async k=>{for(;(k=a.pop())&&!c;)try{d.push(await k())}catch(m){throw c=!0,m;}},g=
[];for(;b--;)g.push(e());await Promise.all(g);return d}}}"use strict";
{const f=self.C3;f.RateLimiter=class{constructor(b,a,d){this._callback=b;this._interval=a;this._intervalOnBattery=d||2*a;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._canRunImmediate=this._ignoreReset=!1;this._callbackArguments=null}SetCanRunImmediate(b){this._canRunImmediate=!!b}_GetInterval(){return"undefined"!==typeof f.Battery&&f.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...b){if(-1===this._timerId){this._callbackArguments=
b;b=f.FastGetDateNow();var a=b-this._lastCallTime,d=this._GetInterval();a>=d&&this._canRunImmediate?(this._lastCallTime=b,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(d-a,4))}}_RunCallback(){this._ignoreReset=!0;const b=this._callbackArguments;this._callbackArguments=null;b?this._callback(...b):this._callback();this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=f.FastGetDateNow())}_OnTimer(){this._timerId=
-1;this._lastCallTime=f.FastGetDateNow();this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer();this._timerCallFunc=this._callbackArguments=this._callback=null}}}"use strict";
{const f=self.C3;f.SVGRasterManager=class{constructor(){this._images=new Map;this._allowNpotSurfaces=!1;this._redrawCallback=this._releaseResultCallback=this._rasterAtSizeCallback=this._getBaseSizeCallback=null}SetNpotSurfaceAllowed(b){this._allowNpotSurfaces=!!b}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(b){this._getBaseSizeCallback=b}GetBaseSize(b){if(!this._getBaseSizeCallback)throw Error("no get base size callback set");return this._getBaseSizeCallback(b)}SetRasterAtSizeCallback(b){this._rasterAtSizeCallback=
b}RasterAtSize(b,a,d,c,e,g){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(b,a,d,c,e,g)}SetReleaseResultCallback(b){this._releaseResultCallback=b}ReleaseResult(b){if(!this._releaseResultCallback)throw Error("no release result callback set");this._releaseResultCallback(b)}SetRedrawCallback(b){this._redrawCallback=b}Redraw(){if(!this._redrawCallback)throw Error("no redraw callback set");this._redrawCallback()}AddImage(b){let a=this._images.get(b);
a||(a=f.New(f.SVGRasterImage,this,b),this._images.set(b,a));a.IncReference();return a}_RemoveImage(b){this._images.delete(b.GetDataSource())}}}"use strict";
{const f=self.C3;f.SVGRasterImage=class{constructor(b,a){this._manager=b;this._dataSource=a;this._baseHeight=this._baseWidth=this._refCount=0;this._getBaseSizePromise=this._manager.GetBaseSize(a).then(d=>{this._baseWidth=d[0];this._baseHeight=d[1];this._manager.Redraw()}).catch(d=>{console.error("[SVG] Error loading SVG: ",d);this._hadError=!0;this._manager.Redraw()});this._rasterImageHeight=this._rasterImageWidth=this._rasterSurfaceHeight=this._rasterSurfaceWidth=0;this._isRasterizing=!1;this._rasterizedResult=
null;this._hadError=this._forceRaster=!1}Release(){if(0>=this._refCount)throw Error("already released");this._refCount--;0===this._refCount&&this._Release()}_Release(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null);this._manager._RemoveImage(this);this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return 0<this._refCount}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=
!0}async StartRasterForSize(b,a,d){if(0!==a&&0!==d&&!this._hadError&&!this._isRasterizing){var c=f.nextHighestPowerOfTwo(Math.ceil(a)),e=f.nextHighestPowerOfTwo(Math.ceil(d)),g=Math.max(c,e);2048<g&&(g=2048/g,a*=g,d*=g,c=Math.min(Math.ceil(c*g),2048),e=Math.min(Math.ceil(e*g),2048));a<c&&d<e&&(d=a/d,c/e>d?(a=e*d,d=e):(a=c,d=c/d));this._manager.IsNpotSurfaceAllowed()&&(c=Math.ceil(a),e=Math.ceil(d));c<=this._rasterSurfaceWidth&&e<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=
!0,this._rasterSurfaceWidth=c,this._rasterSurfaceHeight=e,b=await this._manager.RasterAtSize(this._dataSource,b,this._rasterSurfaceWidth,this._rasterSurfaceHeight,a,d),this._rasterizedResult&&this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=b,this._rasterImageWidth=a,this._rasterImageHeight=d,this._forceRaster=this._isRasterizing=!1,this._manager.Redraw())}}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}}"use strict";
{const f=self.C3;f.UTF8_BOM="\ufeff";const b=new Set([..."0123456789"]);f.IsNumericChar=function(p){return b.has(p)};const a=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);f.IsWhitespaceChar=function(p){return a.has(p)};f.FilterWhitespace=function(p){return[...p].filter(n=>!f.IsWhitespaceChar(n)).join("")};f.IsStringAllWhitespace=function(p){for(const n of p)if(!f.IsWhitespaceChar(n))return!1;return!0};f.IsUnprintableChar=
function(p){return 1===p.length&&32>p.charCodeAt(0)};f.FilterUnprintableChars=function(p){return[...p].filter(n=>!f.IsUnprintableChar(n)).join("")};const d=new Set([..."0123456789.+-e"]);f.IsStringNumber=function(p){p=p.trim();if(!p.length)return!1;let n=p.charAt(0);if("-"!==n&&!b.has(n))return!1;for(let u of p)if(!d.has(u))return!1;return!0};f.RemoveTrailingDigits=function(p){let n=p.length;for(;0<n;){let u=p.charAt(n-1);if(!f.IsNumericChar(u))break;--n}return p.substr(0,n)};f.IncrementNumberAtEndOf=
function(p){let n=f.RemoveTrailingDigits(p);p=(p=p.substr(n.length))?(parseInt(p,10)+1).toString():"2";return n+p};const c=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#39;"]]);function e(p){return c.get(p)}const g=/[&<>"']/g;f.EscapeHTML=function(p){return p.replace(g,e)};f.EscapeJS=function(p){p=f.ReplaceAll(p,"\\","\\\\");p=f.ReplaceAll(p,'"','\\"');p=f.ReplaceAll(p,"\t","\\t");p=f.ReplaceAll(p,"\r","");return f.ReplaceAll(p,"\n","\\n")};f.EscapeXML=function(p){p=f.ReplaceAll(p,
"&","&amp;");p=f.ReplaceAll(p,"<","&lt;");p=f.ReplaceAll(p,">","&gt;");return f.ReplaceAll(p,'"',"&quot;")};const k=/[-[\]{}()*+?.,\\^$|#\s]/g;f.EscapeRegex=function(p){return p.replace(k,"\\$&")};f.FindAll=function(p,n,u=!1){if(!n)return[];u||(p=p.toLowerCase(),n=n.toLowerCase());u=n.length;var q=0;let r=[];for(;-1<(q=p.indexOf(n,q));)r.push(q),q+=u;return r};f.ReplaceAll=function(p,n,u){return p.replaceAll(n,()=>u)};f.ReplaceAllCaseInsensitive=function(p,n,u){return p.replace(new RegExp(f.EscapeRegex(n),
"gi"),()=>u)};f.SetElementContent=function(p,n){"string"===typeof n?p.textContent=n:n.isPlainText()?p.textContent=n.toString():(p.innerHTML=n.toHTML(),n instanceof f.BBString&&n.attachLinkHandlers(p))};f.StringLikeEquals=function(p,n){return p instanceof f.HtmlString||p instanceof f.BBString?p.equals(n):n instanceof f.HtmlString||n instanceof f.BBString?n.equals(p):p===n};f.StringSubstitute=function(p,...n){let u=p;for(let q=0,r=n.length;q<r;++q){const t=`{${q}}`;if(!p.includes(t))throw Error(`missing placeholder '${t}' in string substitution`);
u=u.replace(t,n[q].toString())}return u};f.StringSubstituteAllowMissing=function(p,...n){let u=p,q=-1,r=-1;for(let t=0,x=n.length;t<x;++t){const z=`{${t}}`;p.includes(z)?(r=t,u=u.replace(z,n[t].toString())):-1===q&&(q=t)}if(0<=q&&0<=r&&q<r)throw Error(`missing placeholder '${q}' in string substitution`);return u};f.StringSubstituteMap=function(p,n){for(let [u,q]of Object.entries(n))p=p.replaceAll(u,q.toString());return p};f.SortAZCaseInsensitive=function(p,n){p=p.toLowerCase();n=n.toLowerCase();return p>
n?1:p<n?-1:0};f.FormatDataSize=function(p,n){n="common."+(n?"dataRates":"dataSizes")+".";const u=self.langSub;if(1024>p)return u(n+"bytes",p);if(1048576>p)return p/=1024,p=10>p?Math.round(10*p)/10:Math.round(p),u(n+"kilobytes",p);if(1073741824>p)return p/=1048576,p=10>p?Math.round(10*p)/10:Math.round(p),u(n+"megabytes",p);if(1099511627776>p)return p/=1073741824,p=10>p?Math.round(10*p)/10:Math.round(p),u(n+"gigabytes",p);p/=1099511627776;p=10>p?Math.round(10*p)/10:Math.round(p);return u(n+"terabytes",
p)};const m={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};f.FormatTime=function(p,n){n=Object.assign({},m,n);f.Lang.PushContext("common.time");const u=[],q=self.lang,r=self.langPluralSub;if(n.days){var t=Math.floor(p/86400);0<t&&(p-=86400*t,u.push(r(".days",null,t)))}n.hours&&(t=Math.floor(p/3600),0<t||u.length)&&(p-=3600*t,u.push(r(".hours",null,t)));n.minutes&&(t=Math.floor(p/60),0<t||u.length||!n.seconds)&&(p-=60*t,u.push(r(".minutes",null,t)));n.seconds&&u.push(r(".seconds",null,Math.floor(p%
60)));p=(n.approximate?q(".approx-prefix"):"")+u.join(q(".separator"));f.Lang.PopContext();return p};f.ZeroPad=function(p,n){let u=0>p?"-":"";p=Math.abs(p);p=p.toString();n-=p.length;for(let q=0;q<n;++q)u+="0";return u+p};f.StringToTitleCase=function(p){return p.toLowerCase().replace(/\b\w/g,n=>n.toUpperCase())};f.CompareVersionStrings=function(p,n){p=p.split(".").map(u=>u.trim());n=n.split(".").map(u=>u.trim());f.resizeArray(p,4,"0");f.resizeArray(n,4,"0");p=p.map(u=>parseInt(u,10));n=n.map(u=>parseInt(u,
10));for(let u=0;4>u;++u){const q=p[u]-n[u];if(0!==q)return 0>q?-1:1}return 0};f.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,p=>{const n=Math.floor(16*Math.random());return("x"===p?n:n&3|8).toString(16)})};f.StringHammingDistance=function(p,n){if(p.length!==n.length)throw Error("strings must be same length");let u=0;for(let q=0,r=p.length;q<r;++q)p.charAt(q)!==n.charAt(q)&&++u;return u};f.StringLevenshteinDistance=function(p,n){if(0===p.length)return n.length;
if(0===n.length)return p.length;let u,q,r,t;if(p.length>n.length){var x=p;p=n;n=x}t=Array(p.length+1);for(x=0;x<=p.length;x++)t[x]=x;for(x=1;x<=n.length;x++){q=x;for(u=1;u<=p.length;u++)r=n[x-1]===p[u-1]?t[u-1]:Math.min(t[u-1]+1,Math.min(q+1,t[u]+1)),t[u-1]=q,q=r;t[p.length]=q}return t[p.length]}}"use strict";
{const f=self.C3,b=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]],["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]),a=/\[(\/?)([a-zA-Z0-9]+)\]/g,d=/\[(\/?)([^\[]*?)\]/g;
let c=null,e=0;function g(m,p,n){var u=b.get(n);if(u){if("string"===typeof u){if("a"!==u||p)return"<"+p+u+">";p=parseInt(n.substring(1),10)-1;if(0>p||p>=c.length)throw Error("invalid bbcode link substitution");u=c[p];if("string"===typeof u)return`<a href="${c[p]}">`;if("function"===typeof u)return`<a class="bblink${p}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(u))return m=u[0],u=u[1],p?"</"+m+">":`<${m} class="${u}">`}else return"class"===n?p?"</span>":`<span class="bbclass${e++}">`:
m}const k=/\n/g;f.BBString=class{constructor(m,p){this._bbstr=p&&p.noEscape?m:f.EscapeHTML(m);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(p&&(this._convertLineBreaks=!!p.convertLineBreaks,p.links)){if(9<p.links.length)throw Error("too many links");this._linkActions=p.links}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion=this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&!this._needsLineBreakConversion&&!this._bbstr.includes("&");
this._hasParsedFragments=!1;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){return this._hasAnyBBtags?this._bbstr.replace(a,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let m=this._bbstr;this._hasAnyBBtags&&(e=0,c=this._linkActions,m=m.replace(a,g),c=null);this._needsLineBreakConversion&&(m=m.replace(k,"<br>"));this._htmlstr=m}return this._htmlstr}attachLinkHandlers(m){if(this._linkActions.length)for(let p=
0,n=this._linkActions.length;p<n;++p){const u=this._linkActions[p];if("function"!==typeof u)continue;const q=m.querySelector(".bblink"+p);if(!q)throw Error("unable to attach BBString link handler");q.onclick=u}}equals(m){return m instanceof f.HtmlString?this.toHTML()===m.toHTML():m instanceof f.BBString?this._bbstr===m._bbstr:this._bbstr===m}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const m=this._bbstr,p=[];let n=d.lastIndex=0;for(var u;null!==(u=d.exec(m));){var q=u.index;
if(0<q&&"\\"===m.charAt(q-1))continue;var r=u[0],t=u[1];u=u[2];const x=m.substring(n,q);n=q+r.length;x&&this._fragments.push({text:x,styles:p.slice(0)});if(u)if(t)for(u=u.toLowerCase(),q=p.length-1;0<=q;--q){if(p[q].tag===u){p.splice(q,1);break}}else q=u,r=null,t=u.indexOf("="),-1!==t?(q=u.substring(0,t).toLowerCase(),r=u.substring(t+1)):q=q.toLowerCase(),p.push({tag:q,param:r})}n<m.length&&this._fragments.push({text:m.substring(n),styles:p.slice(0)});for(const x of this._fragments)x.text=this._ProcessBBCodeEscapeSequences(x.text);
this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(m){m=f.ReplaceAll(m,"\\[","[");return f.ReplaceAll(m,"\\\\","\\")}static StripTags(m){return f.New(f.BBString,m,{noEscape:!0}).toPlainText()}static StripAnyTags(m){return m.replace(d,"")}}}"use strict";
{const f=self.C3;f.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(b,a){let d=0,c=0;for(const e of b)-1===e.width&&(b=a(e.text,e.styles),e.width=b.width,e.height=b.height),d+=e.width,c=Math.max(c,e.height);return{width:d,height:c}}_AddLine(b,a,d){this._lines.push({fragments:b,width:a,height:d})}WordWrap(b,a,d,c,e){"string"===typeof b&&(b=[{text:b,styles:[]}]);f.clearArray(this._lines);if(!(!b.length||1===b.length&&!b[0].text.length||
2>d)){if(1===b.length){var g=b[0];const k=g.text;g=g.styles;if(100>=k.length&&!k.includes("\n")){let {width:m,height:p}=a(k,g);m+=e;if(m<=d){this._AddLine([{text:k,styles:g,width:m,height:p}],m,p);return}}}if("word"===c)c=this._TokeniseWords(b);else{c=[];for(const k of b)f.appendArray(c,[...k.text].map(m=>[{text:m,styles:k.styles}]))}this._WrapText(c,a,d,e)}}_TokeniseWords(b){const a=[];let d=[],c=!1;for(const g of b){var e=g.text;b=g.styles;for(const k of e)"\n"===k?(0<d.length&&a.push(d),a.push([{text:"\n",
styles:b}]),d=[]):0===d.length?(d.push({text:k,styles:b}),c=f.IsWhitespaceChar(k)):(e=f.IsWhitespaceChar(k),e===c?(e=d[d.length-1],e.styles===b?e.text+=k:d.push({text:k,styles:b})):(a.push(d),d=[],d.push({text:k,styles:b}),c=e))}0<d.length&&a.push(d);return a}_CopyLine(b){return b.map(a=>({text:a.text,styles:a.styles,width:a.width,height:a.height}))}_AddWordToLine(b,a){var d=b.length?b[b.length-1]:null;let c=0;d&&a[0].styles===d.styles&&(d.text+=a[0].text,d.width=-1,d.height=-1,c=1);for(d=a.length;c<
d;++c){const e=a[c];b.push({text:e.text,styles:e.styles,width:-1,height:-1})}}_WrapText(b,a,d,c){let e=[],g=0;var k=0;for(const p of b){if(1===p.length&&"\n"===p[0].text){0===k&&(k=a(" ",p[0].styles).height);this._AddLine(e,g,k);e=[];k=g=0;continue}b=this._CopyLine(e);this._AddWordToLine(b,p);var m=this._MeasureLine(b,a);const n=m.width;m=m.height;n>=d?(0<e.length&&this._AddLine(e,g,k),e=[],f.IsStringAllWhitespace(p[0].text)?k=g=0:(this._AddWordToLine(e,p),k=this._MeasureLine(e,a),g=k.width,k=k.height)):
(e=b,g=n,k=m)}0<e.length&&this._AddLine(e,g,k);this._TrimLinesTrailingWhitespace(a,c)}_TrimLinesTrailingWhitespace(b,a){for(const c of this._lines){const e=c.fragments;if(!e.length)continue;let g=e[e.length-1];var d=g.text;const k=d.trimEnd();if(!k)c.width-=g.width,e.pop();else if(k.length<d.length){d=b(k,g.styles).width;const m=g.width-d;g.width=d;g.text=k;c.width-=m}0!==a&&0<e.length&&(g=e[e.length-1],g.width+=a,c.width+=a)}}Clear(){f.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((b,
a)=>Math.max(b,a.width),0)}GetTotalLineHeight(){return this._lines.reduce((b,a)=>b+a.height,0)}}}"use strict";self.C3.Gfx={};"use strict";
{const f=self.C3,b=[0,0,0,0,0,0,0,0],a=self.glMatrix,d=a.vec3,c=a.mat4,e=d.fromValues(0,0,0);f.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._cam=d.fromValues(0,0,100);this._look=d.fromValues(0,0,0);this._up=d.fromValues(0,1,0);this._worldScale=d.fromValues(1,1,1);this._matP=c.create();this._matMV=c.create();this._lastMV=c.create();this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spTextureFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=
[];this._namedBlendModeMap=new Map;this._frameNumber=0;this._enableMipmaps=!0}FillIndexBufferData(g){let k=0,m=g.length,p=0;for(;k<m;)g[k++]=p,g[k++]=p+1,g[k++]=p+2,g[k++]=p,g[k++]=p+2,g[k++]=p+3,p+=4}Project(g,k,m,p,n){const u=this._matMV,q=this._matP;for(let r=0,t=b.length;r<t;++r)b[r]=0;b[0]=u[0]*g+u[4]*k+u[12];b[1]=u[1]*g+u[5]*k+u[13];b[2]=u[2]*g+u[6]*k+u[14];b[3]=u[3]*g+u[7]*k+u[15];b[4]=q[0]*b[0]+q[4]*b[1]+q[8]*b[2]+q[12]*b[3];b[5]=q[1]*b[0]+q[5]*b[1]+q[9]*b[2]+q[13]*b[3];b[6]=q[2]*b[0]+q[6]*
b[1]+q[10]*b[2]+q[14]*b[3];b[7]=-b[2];0!==b[7]&&(b[7]=1/b[7],b[4]*=b[7],b[5]*=b[7],b[6]*=b[7],n[0]=(.5*b[4]+.5)*m,n[1]=(.5*b[5]+.5)*p)}GetWidth(){return this._width}GetHeight(){return this._height}GetNearZ(){return 1}GetFarZ(){return 1E4}SetCameraXYZ(g,k,m){this._cam[0]=g*this._worldScale[0];this._cam[1]=k*this._worldScale[1];this._cam[2]=m}SetLookXYZ(g,k,m){this._look[0]=g*this._worldScale[0];this._look[1]=k*this._worldScale[1];this._look[2]=m}ResetModelView(g){c.lookAt(this._matMV,this._cam,this._look,
g||this._up);c.scale(this._matMV,this._matMV,this._worldScale)}Translate(g,k){if(0!==g||0!==k)e[0]=g,e[1]=k,e[2]=0,c.translate(this._matMV,this._matMV,e)}Scale(g,k){if(1!==g||1!==k)e[0]=g,e[1]=k,e[2]=1,c.scale(this._matMV,this._matMV,e)}RotateZ(g){0!==g&&c.rotateZ(this._matMV,this._matMV,g)}_AddShaderProgram(g){this._allShaderPrograms.push(g);this._shaderProgramsByName.set(g.GetName(),g)}_RemoveShaderProgram(g){const k=this._allShaderPrograms.indexOf(g);-1!==k&&this._allShaderPrograms.splice(k,1);
this._shaderProgramsByName.delete(g.GetName())}_ClearAllShaderPrograms(){f.clearArray(this._allShaderPrograms);this._shaderProgramsByName.clear()}GetShaderProgramByName(g){return this._shaderProgramsByName.get(g)||null}GetTextureFillShaderProgram(){return this._spTextureFill}_SetCurrentStateGroup(g){this._currentStateGroup=g}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(g,k,m,p){const n=f.Gfx.StateGroup.MakeKey(g,k,m,p);let u=this._stateGroups.get(n);u||(u=f.New(f.Gfx.StateGroup,
this,g,k,m,p),this._stateGroups.set(n,u));u.AddRef();return u}ReleaseStateGroup(g){g.DecRef();0===g._GetRefCount()&&(this._currentStateGroup===g&&(this._currentStateGroup=null),this._stateGroups.delete(g.GetKey()),g.Release())}_InitBlendModeData(g){f.clearArray(this._blendModeTable);this._namedBlendModeMap.clear();for(const k of g){g=k[0];const m=k[1],p=k[2];this._blendModeTable.push([m,p]);this._namedBlendModeMap.set(g,{srcBlend:m,destBlend:p})}}_GetBlendByIndex(g){return this._blendModeTable[g]}GetSrcBlendByIndex(g){return this._GetBlendByIndex(g)[0]}GetDestBlendByIndex(g){return this._GetBlendByIndex(g)[1]}GetNamedBlend(g){g=
this._namedBlendModeMap.get(g);if("undefined"===typeof g)throw Error("invalid blend name");return g}Finish(){this.EndBatch();this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(g){this._enableMipmaps=!!g}AreMipmapsEnabled(){return this._enableMipmaps}}}"use strict";
{const f=self.C3;f.Gfx.StateGroup=class{constructor(b,a,d,c,e){this._renderer=b;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=d;this._color=f.New(f.Color);this._color.set(c);this._zElevation=e;"string"===typeof a?this._shaderProgramName=a:(this._shaderProgram=a,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(0<this._refCount)throw Error("releasing state group still in use");this._shaderProgram=this._renderer=null;this._shaderProgramName=""}Apply(){const b=
this._renderer;b.SetProgram(this._shaderProgram);b.SetBlendMode(this._blendMode);b.SetColor(this._color);b.SetCurrentZ(this._zElevation);b._SetCurrentStateGroup(this)}GetKey(){return f.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram=null}OnContextRestored(b){this._shaderProgram=b.GetShaderProgramByName(this._shaderProgramName);if(!this._shaderProgram)throw Error("failed to restore shader program");
}static MakeKey(b,a,d,c){return("string"===typeof b?b:b.GetName())+","+a+","+d.getR()+","+d.getG()+","+d.getB()+","+d.getA()+","+c}}}"use strict";
{const f=self.C3,b=f.New(f.Quad),a=f.New(f.Quad);function d(e,g,k){const m=k.getTlx(),p=k.getTly(),n=k.getTrx()-m,u=k.getTry()-p,q=k.getBlx()-m;k=k.getBly()-p;return[m+n*e+q*g,p+u*e+k*g]}class c{constructor(e){this._mesh=e;this._v=this._u=this._y=this._x=0}_Init(e,g,k,m){this._x=e;this._y=g;this._u=k;this._v=m}GetX(){return this._x}SetX(e){this._x!==e&&(this._x=e,this._mesh._SetPointsChanged())}GetY(){return this._y}SetY(e){this._y!==e&&(this._y=e,this._mesh._SetPointsChanged())}GetU(){return this._u}SetU(e){this._u=
e}GetV(){return this._v}SetV(e){this._v=e}_Interpolate_TexRect(e,g,k){[this._x,this._y]=d(e._x,e._y,g);this._u=f.lerp(k.getLeft(),k.getRight(),e._u);this._v=f.lerp(k.getTop(),k.getBottom(),e._v)}_Interpolate_TexQuad(e,g,k){[this._x,this._y]=d(e._x,e._y,g);[this._u,this._v]=d(e._u,e._v,k)}}f.Gfx.Mesh=class{constructor(e,g){if(2>e||2>g)throw Error("invalid mesh size");this._hsize=e;this._vsize=g;this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._pointsChanged=!1;const k=e-1,m=g-1;for(let p=
0;p<g;++p){const n=[];for(let u=0;u<e;++u){const q=f.New(c,this),r=u/k,t=p/m;q._Init(r,t,r,t);n.push(q)}this._pts.push(n)}}Release(){f.clearArray(this._pts)}GetHSize(){return this._hsize}GetVSize(){return this._vsize}_SetPointsChanged(){this._pointsChanged=!0}_MaybeComputeBounds(){if(this._pointsChanged){var e=Infinity,g=Infinity,k=-Infinity,m=-Infinity;for(const p of this._pts)for(const n of p){const u=n.GetX(),q=n.GetY();e=Math.min(e,u);g=Math.min(g,q);k=Math.max(k,u);m=Math.max(m,q)}this._minX=
e;this._minY=g;this._maxX=k;this._maxY=m;this._pointsChanged=!1}}GetMinX(){this._MaybeComputeBounds();return this._minX}GetMinY(){this._MaybeComputeBounds();return this._minY}GetMaxX(){this._MaybeComputeBounds();return this._maxX}GetMaxY(){this._MaybeComputeBounds();return this._maxY}GetMeshPointAt(e,g){e=Math.floor(e);g=Math.floor(g);return 0>e||e>=this._hsize||0>g||g>=this._vsize?null:this._pts[g][e]}CalculateTransformedMesh(e,g,k){const m=k instanceof f.Rect;if(e.GetHSize()!==this.GetHSize()||
e.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");e=e._pts;const p=this._pts;for(let n=0,u=p.length;n<u;++n){const q=e[n],r=p[n];for(let t=0,x=r.length;t<x;++t){const z=q[t],D=r[t];m?D._Interpolate_TexRect(z,g,k):D._Interpolate_TexQuad(z,g,k)}}}Draw(e){const g=this._pts;let k=g[0];for(let m=1,p=g.length;m<p;++m){const n=g[m];let u=k[0],q=n[0];for(let r=1,t=n.length;r<t;++r){const x=k[r],z=n[r];b.set(u.GetX(),u.GetY(),x.GetX(),x.GetY(),z.GetX(),z.GetY(),q.GetX(),q.GetY());a.set(u.GetU(),
u.GetV(),x.GetU(),x.GetV(),z.GetU(),z.GetV(),q.GetU(),q.GetV());e.Quad4(b,a);u=x;q=z}k=n}}Outline(e){const g=this._pts;let k=g[0];for(let n=1,u=g.length;n<u;++n){const q=g[n];var m=k[0],p=q[0];for(let r=1,t=q.length;r<t;++r){const x=k[r],z=q[r],D=m.GetX();m=m.GetY();const G=x.GetX(),w=x.GetY(),B=z.GetX(),I=z.GetY(),P=p.GetX();p=p.GetY();e.Line(D,m,G,w);e.Line(D,m,B,I);e.Line(D,m,P,p);r===t-1&&e.Line(G,w,B,I);n===u-1&&e.Line(P,p,B,I);m=x;p=z}k=q}}InsertPolyMeshVertices(e){e=e.pointsArr();const g=[],
k=this.GetHSize()-1,m=this.GetVSize()-1,p=1/k,n=1/m,u=k-1,q=m-1;let r=e[0],t=e[1],x=f.clamp(Math.floor(r*k),0,u),z=f.clamp(Math.floor(t*m),0,q),D=0,G=0,w=0;var B=-1;const I=()=>{r=f.clamp(f.lerp(r,D,w),0,1);t=f.clamp(f.lerp(t,G,w),0,1);g.push(r,t)};for(let P=0,E=e.length;P<E;P+=2)for(r=e[P],t=e[P+1],g.push(r,t),x=f.clamp(Math.floor(r*k),0,u),z=f.clamp(Math.floor(t*m),0,q),B=(P+2)%E,D=e[B],G=e[B+1],B=-1;;){if(1E6<g.length)throw Error("Too many mesh poly points");const J=x*p,O=z*n,R=(x+1)*p,T=(z+1)*
n;f.isPointInTriangleInclusive(r,t,J,O,R,O,R,T);if(0!==B&&(w=f.rayIntersectExtended(r,t,D,G,J,O,R,T,-.001),0<=w&&.99999999>=w)){I();B=0;continue}if(0<z&&2!==B&&(w=f.rayIntersectExtended(r,t,D,G,J,O,R,O,.001),0<=w&&.99999999>=w)){I();z--;B=4;continue}if(x<u&&3!==B&&(w=f.rayIntersectExtended(r,t,D,G,R,O,R,T,.001),0<=w&&.99999999>=w)){I();x++;B=1;continue}if(0<x&&1!==B&&(w=f.rayIntersectExtended(r,t,D,G,J,O,J,T,.001),0<=w&&.99999999>=w)){I();x--;B=3;continue}if(z<q&&4!==B&&(w=f.rayIntersectExtended(r,
t,D,G,J,T,R,T,.001),0<=w&&.99999999>=w)){I();z++;B=2;continue}break}return f.New(f.CollisionPoly,g)}TransformCollisionPoly(e,g){e=this._TransformPolyPoints(e);this._SimplifyPoly(e);g.setPoints(e)}_TransformPolyPoints(e){const g=[];e=e.pointsArr();for(let k=0,m=e.length;k<m;k+=2){const [p,n]=this.TransformPoint(e[k],e[k+1]);g.push(p,n)}return g}TransformPoint(e,g){var k=this.GetHSize()-1,m=this.GetVSize()-1,p=1/k,n=1/m;k=f.clamp(Math.floor(e*k),0,k-1);const u=f.clamp(Math.floor(g*m),0,m-1);m=k*p;const q=
u*n,r=(k+1)*p,t=(u+1)*n,x=this.GetMeshPointAt(k,u),z=this.GetMeshPointAt(k+1,u+1),D=f.isPointInTriangleInclusive(e,g,m,q,r,q,r,t);p=D?m+p:m;n=D?q:q+n;k=this.GetMeshPointAt(k+(D?1:0),u+(D?0:1));const [G,w,B]=f.triangleCartesianToBarycentric(e,g,m,q,p,n,r,t);return f.triangleBarycentricToCartesian(G,w,B,x.GetX(),x.GetY(),k.GetX(),k.GetY(),z.GetX(),z.GetY())}_SimplifyPoly(e){const g=[];let k=e[0],m=e[1],p=k-e[e.length-2],n=m-e[e.length-1];for(let q=0,r=e.length;q<r;q+=2){var u=(q+2)%r;const t=e[u];u=
e[u+1];const x=t-k,z=u-m,D=1e-7>Math.abs(z)&&1e-7>Math.abs(n)&&Math.sign(x)===Math.sign(p);(!(1e-7>Math.abs(x)&&1e-7>Math.abs(p)&&Math.sign(z)===Math.sign(n)||D)&&1e-7<Math.abs(x/p-z/n)||0==x&&0===z)&&g.push(k,m);k=t;m=u;p=x;n=z}g.length<e.length&&f.shallowAssignArray(e,g)}}}"use strict";
{const f=self.C3,b=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),a=new Set(["nearest","bilinear","trilinear"]),d=new Set(["default","low","high"]),c=new Set(["clamp-to-edge","repeat","mirror-repeat"]);function e(p,n){let u,q;switch(p){case "rgba8":p=n.RGBA8;q=u=n.RGBA;n=n.UNSIGNED_BYTE;break;case "rgb8":p=n.RGB8;q=u=n.RGB;n=n.UNSIGNED_BYTE;break;case "rgba4":p=n.RGBA4;q=u=n.RGBA;n=n.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":p=n.RGB5_A1;q=u=n.RGBA;n=n.UNSIGNED_SHORT_5_5_5_1;break;case "rgb565":p=
n.RGB565;q=u=n.RGB;n=n.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:p,internalformat:u,format:q,type:n}}const g={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",sampling:"trilinear",pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},k={premultiplyAlpha:!0,flipY:!1},m=new Set;f.Gfx.WebGLRendererTexture=class{constructor(p){this._renderer=p;this._texture=null;this._height=this._width=0;this._isStatic=
!0;this._wrapY=this._wrapX="clamp-to-edge";this._sampling="trilinear";this._pixelFormat="rgba8";this._isMipMapped=!1;this._mipMapQuality="default";this._refCount=0}_CreateStatic(p,n){if(!("undefined"!==typeof HTMLImageElement&&p instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&p instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&p instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&p instanceof OffscreenCanvas||p instanceof ImageData||p instanceof ArrayBuffer)&&
null!==p)throw Error("invalid texture source");n=Object.assign({},g,n);if(this._texture)throw Error("already created texture");this._wrapX=n.wrapX;this._wrapY=n.wrapY;this._sampling=n.sampling;this._pixelFormat=n.pixelFormat;this._isMipMapped=!!n.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=n.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");if(!b.has(this._pixelFormat))throw Error("invalid pixel format");
if(!d.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(p instanceof ArrayBuffer||null===p||n.isSvg){if(this._width=n.width,this._height=n.height,p instanceof ArrayBuffer&&p.byteLength!==this._width*this._height*4)throw Error("ArrayBuffer wrong size");}else this._width=p.width,this._height=p.height;if(0>=this._width||0>=this._height)throw Error("invalid texture data size");if(n.isSvg){var u=f.CreateCanvas(this._width,this._height);u.getContext("2d").drawImage(p,0,
0,this._width,this._height);p=u}var q=f.isPOT(this._width)&&f.isPOT(this._height);u=this._renderer.GetMaxTextureSize();if(this._width>u||this._height>u)throw Error("texture data exceeds maximum texture size");u=this._renderer.GetContext();var r=this._renderer.GetWebGLVersionNumber();this._texture=u.createTexture();u.bindTexture(u.TEXTURE_2D,this._texture);u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha);n=e(this._pixelFormat,u);if(this._renderer.SupportsNPOTTextures()||q||!this._IsTiled())2<=
r?(u.texStorage2D(u.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,n.sizedinternalformat,this._width,this._height),p instanceof ArrayBuffer?u.texSubImage2D(u.TEXTURE_2D,0,0,0,this._width,this._height,n.format,n.type,new Uint8Array(p)):null!==p&&u.texSubImage2D(u.TEXTURE_2D,0,0,0,n.format,n.type,p)):p instanceof ArrayBuffer?u.texImage2D(u.TEXTURE_2D,0,n.internalformat,this._width,this._height,0,n.format,n.type,new Uint8Array(p)):null===p?u.texImage2D(u.TEXTURE_2D,
0,n.internalformat,this._width,this._height,0,n.format,n.type,null):u.texImage2D(u.TEXTURE_2D,0,n.internalformat,n.format,n.type,p);else{if(null===p)throw Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");p instanceof ArrayBuffer&&(p=new ImageData(new Uint8ClampedArray(p),this._width,this._height));p instanceof ImageData&&(q=f.CreateCanvas(this._width,this._height),q.getContext("2d").putImageData(p,0,0),p=q);q=f.CreateCanvas(f.nextHighestPowerOfTwo(this._width),
f.nextHighestPowerOfTwo(this._height));r=q.getContext("2d");r.imageSmoothingEnabled="nearest"!==this._sampling;r.drawImage(p,0,0,this._width,this._height,0,0,q.width,q.height);u.texImage2D(u.TEXTURE_2D,0,n.internalformat,n.format,n.type,q)}null!==p&&this._SetTextureParameters(u);u.bindTexture(u.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;m.add(this)}_CreateDynamic(p,n,u){u=Object.assign({},g,u);if(this._texture)throw Error("already created texture");this._wrapX=u.wrapX;this._wrapY=
u.wrapY;this._sampling=u.sampling;this._pixelFormat=u.pixelFormat;this._isMipMapped=!!u.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=u.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!1;this._width=Math.floor(p);this._height=Math.floor(n);
p=f.isPOT(this._width)&&f.isPOT(this._height);n=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>n||this._height>n)throw Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!p)throw Error("non-power-of-two tiled textures not supported");p=this._renderer.GetContext();n=this._renderer.GetWebGLVersionNumber();this._texture=p.createTexture();p.bindTexture(p.TEXTURE_2D,this._texture);
p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);u=e(this._pixelFormat,p);p.texImage2D(p.TEXTURE_2D,0,2<=n?u.sizedinternalformat:u.internalformat,this._width,this._height,0,u.format,u.type,null);this._SetTextureParameters(p);p.bindTexture(p.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;m.add(this)}_GetMipMapHint(p){if("default"===this._mipMapQuality)return this._isStatic?p.NICEST:p.FASTEST;if("low"===this._mipMapQuality)return p.FASTEST;if("high"===this._mipMapQuality)return p.NICEST;
throw Error("invalid mipmap quality");}_IsTiled(){return"clamp-to-edge"!==this._wrapX||"clamp-to-edge"!==this._wrapY}_GetTextureWrapMode(p,n){if("clamp-to-edge"===n)return p.CLAMP_TO_EDGE;if("repeat"===n)return p.REPEAT;if("mirror-repeat"===n)return p.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(p){var n=f.isPOT(this._width)&&f.isPOT(this._height);p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,this._GetTextureWrapMode(p,this._wrapX));p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,
this._GetTextureWrapMode(p,this._wrapY));"nearest"===this._sampling?(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),this._isMipMapped=!1):(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.LINEAR),(n||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(p.hint(p.GENERATE_MIPMAP_HINT,this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D),n="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),p.texParameteri(p.TEXTURE_2D,
p.TEXTURE_MIN_FILTER,n?p.LINEAR_MIPMAP_LINEAR:p.LINEAR_MIPMAP_NEAREST)):(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.LINEAR),this._isMipMapped=!1))}_Update(p,n){if(!("undefined"!==typeof HTMLImageElement&&p instanceof HTMLImageElement||"undefined"!==typeof HTMLVideoElement&&p instanceof HTMLVideoElement||"undefined"!==typeof HTMLCanvasElement&&p instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&p instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&p instanceof OffscreenCanvas||
p instanceof ImageData))throw Error("invalid texture source");if(!this._texture||0>=this._refCount)throw Error("texture not created");if(this._isStatic)throw Error("cannot update static texture");n=Object.assign({},k,n);const u=p.width||p.videoWidth,q=p.height||p.videoHeight;var r=this._renderer.GetWebGLVersionNumber();const t=this._renderer.GetContext();t.bindTexture(t.TEXTURE_2D,this._texture);t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha);t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,
!!n.flipY);n=e(this._pixelFormat,t);r=2<=r?n.sizedinternalformat:n.internalformat;try{if(this._width===u&&this._height===q){const x=f.isPOT(this._width)&&f.isPOT(this._height);t.texSubImage2D(t.TEXTURE_2D,0,0,0,n.format,n.type,p);(x||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(t.hint(t.GENERATE_MIPMAP_HINT,this._GetMipMapHint(t)),t.generateMipmap(t.TEXTURE_2D))}else{this._width=u;this._height=q;const x=f.isPOT(this._width)&&f.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&
this._IsTiled()&&!x)throw Error("non-power-of-two tiled textures not supported");t.texImage2D(t.TEXTURE_2D,0,r,n.format,n.type,p);(x||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(t.hint(t.GENERATE_MIPMAP_HINT,this._GetMipMapHint(t)),t.generateMipmap(t.TEXTURE_2D))}}catch(x){console.error("Error updating WebGL texture: ",x)}t.bindTexture(t.TEXTURE_2D,null);this._renderer._ResetLastTexture()}_Delete(){if(0<this._refCount)throw Error("texture still has references");if(!this._texture)throw Error("already deleted texture");
m.delete(this);this._renderer.GetContext().deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(0>=this._refCount)throw Error("no more references");this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let p=this._width*this._height;
switch(this._pixelFormat){case "rgba8":p*=4;break;case "rgb8":p*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":p*=2}this._isMipMapped&&(p+=Math.floor(p/3));return p}static OnContextLost(){m.clear()}static allTextures(){return m.values()}}}"use strict";
{const f=self.C3,b=new Set(["nearest","bilinear","trilinear"]),a={sampling:"trilinear",alpha:!0,readback:!0,isDefaultSize:!0,multisampling:0},d=new Set;f.Gfx.WebGLRenderTarget=class{constructor(c){this._renderer=c;this._renderBuffer=this._texture=this._frameBuffer=null;this._height=this._width=0;this._isDefaultSize=!0;this._sampling="trilinear";this._readback=this._alpha=!0;this._multisampling=0}_Create(c,e,g){g=Object.assign({},a,g);const k=this._renderer.GetWebGLVersionNumber();if(this._texture||
this._renderBuffer)throw Error("already created render target");this._sampling=g.sampling;this._alpha=!!g.alpha;this._readback=!!g.readback;this._isDefaultSize=!!g.isDefaultSize;this._multisampling=g.multisampling;if(!b.has(this._sampling))throw Error("invalid sampling");if(0<this._multisampling&&(2>k||this._readback))throw Error("invalid use of multisampling");2>k&&(this._readback=!0);this._width=c;this._height=e;if(0>=this._width||0>=this._height)throw Error("invalid render target size");c=this._renderer.GetContext();
this._frameBuffer=c.createFramebuffer();c.bindFramebuffer(c.FRAMEBUFFER,this._frameBuffer);this._readback?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),e=this._texture._GetTexture(),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,e,0)):(this._renderBuffer=c.createRenderbuffer(),c.bindRenderbuffer(c.RENDERBUFFER,this._renderBuffer),e=this._alpha?c.RGBA8:c.RGB8,0<this._multisampling&&
((g=c.getInternalformatParameter(c.RENDERBUFFER,e,c.SAMPLES))&&g[0]?(g=g[0],this._multisampling>g&&(this._multisampling=g)):this._multisampling=0),0===this._multisampling?c.renderbufferStorage(c.RENDERBUFFER,e,this._width,this._height):c.renderbufferStorageMultisample(c.RENDERBUFFER,this._multisampling,e,this._width,this._height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.RENDERBUFFER,this._renderBuffer),c.bindRenderbuffer(c.RENDERBUFFER,null));c.bindFramebuffer(c.FRAMEBUFFER,null);
d.add(this)}_Resize(c,e){if(this._width!==c||this._height!==e)this._width=c,this._height=e,c=this._renderer.GetContext(),c.bindFramebuffer(c.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(c.bindRenderbuffer(c.RENDERBUFFER,this._renderBuffer),c.renderbufferStorage(c.RENDERBUFFER,this._alpha?c.RGBA8:c.RGB8,this._width,this._height),c.bindRenderbuffer(c.RENDERBUFFER,null)),c.bindFramebuffer(c.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&
!this._renderBuffer)throw Error("already deleted render target");d.delete(this);const c=this._renderer.GetContext();c.bindFramebuffer(c.FRAMEBUFFER,this._frameBuffer);this._texture?(c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,null,0),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(c.framebufferRenderbuffer(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.RENDERBUFFER,null),c.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);c.bindFramebuffer(c.FRAMEBUFFER,
null);2<=this._renderer.GetWebGLVersionNumber()&&(c.bindFramebuffer(c.READ_FRAMEBUFFER,null),c.bindFramebuffer(c.DRAW_FRAMEBUFFER,null));c.deleteFramebuffer(this._frameBuffer);this._frameBuffer=this._renderer.GetBatchState().currentFramebuffer=null}_GetFramebuffer(){return this._frameBuffer}GetWebGLRenderer(){return this._renderer}GetTexture(){return this._texture}IsLinearSampling(){return"nearest"!==this._sampling}HasAlpha(){return this._alpha}IsReadback(){return this._readback}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const c=
{sampling:this._sampling,alpha:this._alpha,readback:this._readback};this._isDefaultSize||(c.width=this._width,c.height=this._height);return c}IsCompatibleWithOptions(c){c=Object.assign({},a,c);return"nearest"!==c.sampling!==this.IsLinearSampling()||!!c.alpha!==this.HasAlpha()||2<=this._renderer.GetWebGLVersionNumber()&&!!c.readback!==this.IsReadback()?!1:"number"===typeof c.width||"number"===typeof c.height?!this.IsDefaultSize()&&this.GetWidth()===c.width&&this.GetHeight()===c.height:this.IsDefaultSize()}_GetWebGLTexture(){return this._texture?
this._texture._GetTexture():null}GetEstimatedMemoryUsage(){return this._texture?this._texture.GetEstimatedMemoryUsage():this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(c,e){c=await c.ReadBackRenderTargetToImageData(e,!0);return await f.ImageDataToBlob(c)}static OnContextLost(){d.clear()}static allRenderTargets(){return d.values()}static ResizeAll(c,e){for(const g of d)g.IsDefaultSize()&&g._Resize(c,e)}}}"use strict";
{const f=self.C3,b=self.glMatrix,a=b.vec3,d=b.mat4,c=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));f.Gfx.WebGLShaderProgram=class{static async Compile(e,g,k,m){const p=e.GetContext(),n=p.createShader(p.FRAGMENT_SHADER);p.shaderSource(n,g);p.compileShader(n);
g=p.createShader(p.VERTEX_SHADER);p.shaderSource(g,k);p.compileShader(g);const u=p.createProgram();p.attachShader(u,n);p.attachShader(u,g);p.bindAttribLocation(u,0,"aPos");p.bindAttribLocation(u,1,"aTex");p.bindAttribLocation(u,2,"aPoints");p.linkProgram(u);const q=e._GetParallelShaderCompileExtension();q?await e._WaitForObjectReady(()=>p.getProgramParameter(u,q.COMPLETION_STATUS_KHR)):await f.Wait(5);if(!p.getShaderParameter(n,p.COMPILE_STATUS))throw m=p.getShaderInfoLog(n),p.deleteShader(n),p.deleteShader(g),
p.deleteProgram(u),Error("Error compiling fragment shader: "+m);if(!p.getShaderParameter(g,p.COMPILE_STATUS))throw m=p.getShaderInfoLog(g),p.deleteShader(n),p.deleteShader(g),p.deleteProgram(u),Error("Error compiling vertex shader: "+m);if(!p.getProgramParameter(u,p.LINK_STATUS))throw m=p.getProgramInfoLog(u),p.deleteShader(n),p.deleteShader(g),p.deleteProgram(u),Error("Error linking shader program: "+m);(e=f.FilterUnprintableChars(p.getProgramInfoLog(u)||"").trim())&&!f.IsStringAllWhitespace(e)&&
console.info(`[WebGL] Shader program '${m}' compilation log: `,e);p.deleteShader(n);p.deleteShader(g);return u}static async Create(e,g,k,m){k=await f.Gfx.WebGLShaderProgram.Compile(e,g.src,k,m);return new f.Gfx.WebGLShaderProgram(e,k,g,m)}constructor(e,g,k,m){const p=e.GetContext();var n=e.GetBatchState();e.EndBatch();p.useProgram(g);this._gl=p;this._renderer=e;this._name=m;this._shaderProgram=g;this._isDeviceTransform="<default-device-transform>"===m;m=p.getAttribLocation(g,"aPos");const u=p.getAttribLocation(g,
"aTex");g=p.getAttribLocation(g,"aPoints");-1!==m&&(p.bindBuffer(p.ARRAY_BUFFER,e._vertexBuffer),p.vertexAttribPointer(m,e.GetNumVertexComponents(),p.FLOAT,!1,0,0),p.enableVertexAttribArray(m));-1!==u&&(p.bindBuffer(p.ARRAY_BUFFER,e._texcoordBuffer),p.vertexAttribPointer(u,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(u));-1!==g&&(p.bindBuffer(p.ARRAY_BUFFER,e._pointBuffer),p.vertexAttribPointer(g,4,p.FLOAT,!1,0,0),p.enableVertexAttribArray(g));p.bindBuffer(p.ARRAY_BUFFER,null);this._uMatP=new f.Gfx.WebGLShaderUniform(this,
"matP","mat4");this._uMatMV=new f.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new f.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new f.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new f.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new f.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new f.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new f.Gfx.WebGLShaderUniform(this,"tileSize",
"vec2");this._uTileSpacing=new f.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new f.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new f.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new f.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uDestStart=new f.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new f.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new f.Gfx.WebGLShaderUniform(this,
"srcStart","vec2");this._uSrcEnd=new f.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new f.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new f.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new f.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new f.Gfx.WebGLShaderUniform(this,"seconds","float");this._uLayerScale=new f.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new f.Gfx.WebGLShaderUniform(this,
"layerAngle","float");this._uLayoutStart=new f.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new f.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||
this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());this._extendBoxHorizontal=k.extendBoxHorizontal||0;this._extendBoxVertical=k.extendBoxVertical||0;this._crossSampling=!!k.crossSampling;this._mustPreDraw=!!k.mustPreDraw;this._preservesOpaqueness=!!k.preservesOpaqueness;this._animated=!!k.animated;e=k.parameters||[];this._uCustomParameters=[];this._usesDest=this._uDestStart.IsUsed()||this._uDestEnd.IsUsed();this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||
this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();this._needsPostDrawOrExtendBox=this._crossSampling||this._usesDest||0!==this._extendBoxHorizontal||0!==this._extendBoxVertical;this._hasCurrentMatMV=this._hasCurrentMatP=!1;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0);this._uSamplerBack.Init1i(1);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0,
0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,0);this._uPixelSize.Init2f(0,0);this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const q of e)e=q[2],k=new f.Gfx.WebGLShaderUniform(this,q[0],e),"color"===e?k.Init3f(0,0,0):k.Init1f(0),this._uCustomParameters.push(k);
this._isDeviceTransform?this._UpdateDeviceTransformUniforms(n.currentMatP):(this.UpdateMatP(n.currentMatP,!0),this.UpdateMatMV(n.currentMV,!0));n=n.currentShader;p.useProgram(n?n._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._renderer=this._gl=null}GetName(){return this._name}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}UsesDest(){return this._usesDest}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}ExtendsBox(){return 0!==
this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(e){return this._uCustomParameters[e].GetType()}AreCustomParametersAlreadySetInBatch(e){for(let g=0,k=e.length;g<k;++g)if(!this._uCustomParameters[g].IsSetToCustomInBatch(e[g]))return!1;
return!0}SetCustomParametersInBatch(e){for(let g=0,k=e.length;g<k;++g)this._uCustomParameters[g].SetBatchValueCustom(e[g])}AreOptionalUniformsAlreadySetInBatch(e,g,k,m,p,n,u,q,r){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(p,n)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(e.getLeft(),e.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(e.getRight(),e.getBottom())||this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(u)||
this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(q)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(g.getLeft(),g.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(g.getRight(),g.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(k.getLeft(),k.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(k.getRight(),k.getBottom())||this._uLayoutStart.IsUsed()&&!this._uLayoutStart.IsSetTo2InBatch(m.getLeft(),
m.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(m.getTop(),m.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(r)?!1:!0}SetOptionalUniformsInBatch(e,g,k,m,p,n,u,q,r){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(p,n),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(e.getLeft(),e.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(e.getRight(),e.getBottom()),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(u),
this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(q),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(g.getLeft(),g.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(g.getRight(),g.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(k.getLeft(),k.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(k.getRight(),k.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(m.getLeft(),m.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(m.getTop(),
m.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(r))}IsAnimated(){return this._animated}UpdateMatP(e,g){this._hasCurrentMatP&&!g||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(e),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(e,g){this._hasCurrentMatMV&&!g||this._isDeviceTransform||(this._uMatMV.IsUsed()&&this._uMatMV.UpdateMatrix4fv(e),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(e){if(!this._isDeviceTransform)throw Error("not device transform shader");
this._uMatP.UpdateMatrix4fv(e);e=this._renderer;var g=e.GetWidth()/2,k=e.GetHeight()/2;const m=e._worldScale,p=a.fromValues(g*m[0],k*m[1],100*self.devicePixelRatio);g=a.fromValues(g*m[0],k*m[1],0);k=d.create();d.lookAt(k,p,g,e._up);d.scale(k,k,m);this._uMatMV.UpdateMatrix4fv(k)}UpdateColor(e){this._uColor.IsUsed()&&this._uColor.Update4f(e[0],e[1],e[2],e[3])}static GetReservedUniformNames(){return c}static GetDefaultVertexShaderSource(e,g){g=g?"highmedp":"mediump";return["#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif",
`attribute highp ${e?"vec3":"vec2"} aPos;`,`attribute ${g} vec2 aTex;`,`varying ${g} vec2 vTex;`,"uniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {",`	gl_Position = matP * matMV * vec4(aPos, ${e?"":"0.0,"} 1.0);`,"\tvTex = aTex;\n}"].join("\n")}static GetTextureFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex) * color;\n}"}static GetTilemapFragmentShaderSource(){return"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nvarying highmedp vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nuniform highmedp vec2 srcStart;\nuniform highmedp vec2 pixelSize;\nuniform highmedp vec2 tileSize;\nuniform highmedp vec2 tileSpacing;\nvoid main(void) {\n\thighmedp vec2 tile = floor(vTex);\n\thighmedp vec2 tex = fract(vTex);\n\thighmedp vec2 tileOrigin = srcStart + tile * (tileSize + tileSpacing);\n\thighmedp vec2 lowerBound = tileOrigin + pixelSize / 2.0;\n\thighmedp vec2 upperBound = tileOrigin + tileSize - pixelSize / 2.0;\n\tgl_FragColor = texture2D(samplerFront, clamp(tex, lowerBound, upperBound), -16.0) * color;\n}"}static GetPointVertexShaderSource(){return"attribute vec4 aPoints;\nvarying float pointOpacity;\nuniform float zElevation;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);\n\tgl_PointSize = aPoints.z;\n\tpointOpacity = aPoints.w;\n}"}static GetPointFragmentShaderSource(){return"uniform lowp sampler2D samplerFront;\nvarying lowp float pointOpacity;\nuniform mediump vec2 pointTexStart;\nuniform mediump vec2 pointTexEnd;\nuniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, mix(pointTexStart, pointTexEnd, gl_PointCoord)) * color * pointOpacity;\n}"}static GetColorFillFragmentShaderSource(){return"uniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = color;\n}"}static GetLinearGradientFillFragmentShaderSource(){return"precision lowp float;\nvarying mediump vec2 vTex;\nuniform vec4 color;\nuniform vec4 color2_;\nvec3 fromLinear(vec3 linearRGB)\n{\n\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));\n\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);\n\tvec3 lower = linearRGB * vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvec3 toLinear(vec3 sRGB)\n{\n\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));\n\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));\n\tvec3 lower = sRGB/vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvoid main(void) {\n\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);\n\tfloat a = mix(color.a, color2_.a, vTex.x);\n\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);\n}"}static GetSmoothLineFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float f = step(diffSq.x + diffSq.y, 0.25);\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump float innerF = step(distSq, 0.25);\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}static GetSmoothEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);\n\tgl_FragColor = color * f;\n}"}static GetSmoothEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 pxNorm = pixelSize * norm;\n\tmediump vec2 innerEdge1 = halfNorm - pxNorm;\n\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;\n\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);\n\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;\n\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;\n\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);\n\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;\n\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}}}"use strict";
{const f=self.C3,b=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);function a(d,c){return d[0]===c[0]&&d[1]===c[1]&&d[2]===c[2]&&d[3]===c[3]&&d[4]===c[4]&&d[5]===c[5]&&d[6]===c[6]&&d[7]===c[7]&&d[8]===c[8]&&d[9]===c[9]&&d[10]===c[10]&&d[11]===c[11]&&d[12]===c[12]&&d[13]===c[13]&&d[14]===c[14]&&d[15]===c[15]}f.Gfx.WebGLShaderUniform=class{constructor(d,c,e){if(!b.has(e))throw Error("invalid uniform type");this._owner=d;this._gl=this._owner.GetWebGLContext();
this._name=c;this._type=e;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),c);this._isUsed=!!this._location;d=b.get(e);this._lastValue=new Float32Array(d);this._lastBatchValue=new Float32Array(d)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(d){this.IsUsed()&&(this._lastValue[0]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,
d))}Init1i(d){this.IsUsed()&&(this._lastValue[0]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,d))}Init2f(d,c){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,d,c))}Init3f(d,c,e){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastValue[2]=e,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,d,c,e))}Init4f(d,c,e,g){this.IsUsed()&&(this._lastValue[0]=
d,this._lastValue[1]=c,this._lastValue[2]=e,this._lastValue[3]=g,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,d,c,e,g))}Update1f(d){d=Math.fround(d);const c=this._lastValue;c[0]!==d&&(c[0]=d,this._gl.uniform1f(this._location,d))}Update1i(d){const c=this._lastValue;c[0]!==d&&(c[0]=d,this._gl.uniform1i(this._location,d))}Update2f(d,c){d=Math.fround(d);c=Math.fround(c);const e=this._lastValue;if(e[0]!==d||e[1]!==c)e[0]=d,e[1]=c,this._gl.uniform2f(this._location,d,c)}Update3f(d,
c,e){d=Math.fround(d);c=Math.fround(c);e=Math.fround(e);const g=this._lastValue;if(g[0]!==d||g[1]!==c||g[2]!==e)g[0]=d,g[1]=c,g[2]=e,this._gl.uniform3f(this._location,d,c,e)}Update4f(d,c,e,g){d=Math.fround(d);c=Math.fround(c);e=Math.fround(e);g=Math.fround(g);const k=this._lastValue;if(k[0]!==d||k[1]!==c||k[2]!==e||k[3]!==g)k[0]=d,k[1]=c,k[2]=e,k[3]=g,this._gl.uniform4f(this._location,d,c,e,g)}UpdateMatrix4fv(d){const c=this._lastValue;a(c,d)||(f.typedArraySet16(c,d,0),this._gl.uniformMatrix4fv(this._location,
!1,d))}IsSetToCustomInBatch(d){const c=this._lastBatchValue;return this.IsColorType()?c[0]===Math.fround(d.getR())&&c[1]===Math.fround(d.getG())&&c[2]===Math.fround(d.getB()):c[0]===Math.fround(d)}SetBatchValueCustom(d){const c=this._lastBatchValue;this.IsColorType()?(c[0]=d.getR(),c[1]=d.getG(),c[2]=d.getB()):c[0]=d}IsSetTo1InBatch(d){return this._lastBatchValue[0]===Math.fround(d)}IsSetTo2InBatch(d,c){const e=this._lastBatchValue;return e[0]===Math.fround(d)&&e[1]===Math.fround(c)}SetBatch1(d){this._lastBatchValue[0]=
d}SetBatch2(d,c){const e=this._lastBatchValue;e[0]=d;e[1]=c}}}"use strict";
{const f=self.C3,b=self.glMatrix,a=b.vec4,d=b.mat4;f.Gfx.BatchState=class{constructor(c){this.renderer=c;this.currentMV=d.create();this.currentMatP=d.create();this.currentFramebuffer=null;this.currentColor=a.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new f.Rect;this.clearColor=f.New(f.Color,0,0,0,0)}};f.Gfx.WebGLBatchJob=class{constructor(c){const e=new ArrayBuffer(96);this._type=0;this._batchState=c;this._gl=c.renderer.GetContext();this._indexCount=this._startIndex=0;this._texParam=
null;this._mat4param=new Float32Array(e,0,16);this._colorParam=new Float32Array(e,64,4);this._srcOriginRect=new Float32Array(e,80,4);this._shaderParams=[]}InitQuad(c,e){this._type=1;this._startIndex=c;this._indexCount=e}DoQuad(){const c=this._gl;c.drawElements(c.TRIANGLES,this._indexCount,c.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(c){this._type=2;this._texParam=c}DoSetTexture(){const c=this._gl,e=this._texParam;c.bindTexture(c.TEXTURE_2D,e?e._GetTexture():null)}InitSetColor(c){this._type=3;
c.writeToTypedArray(this._colorParam,0)}DoSetColor(){const c=this._colorParam,e=this._batchState;a.copy(e.currentColor,c);e.currentShader.UpdateColor(c)}InitSetGradientColor(c){this._type=19;c.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const c=this._colorParam,e=this._batchState.currentShader;e._uColor2.IsUsed()&&e._uColor2.Update4f(c[0],c[1],c[2],c[3])}InitSetBlend(c,e){this._type=4;this._startIndex=c;this._indexCount=e}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitUpdateModelView(c){this._type=
5;d.copy(this._mat4param,c)}DoUpdateModelView(){const c=this._batchState,e=c.renderer._allShaderPrograms,g=c.currentShader,k=this._mat4param;for(let m=0,p=e.length;m<p;++m){const n=e[m];n===g?n.UpdateMatMV(k,!0):n.SetMatMVStale()}d.copy(c.currentMV,k)}InitSetRenderTarget(c,e,g){this._type=6;this._texParam=c;this._startIndex=e?1:0;e&&d.copy(this._mat4param,g)}DoSetRenderTarget(){var c=this._gl,e=this._texParam;const g=0!==this._startIndex,k=this._mat4param,m=this._batchState,p=m.renderer;if(e){const n=
e._GetFramebuffer();m.currentFramebuffer=n;c.bindFramebuffer(c.FRAMEBUFFER,n);c=e.GetWidth();e=e.GetHeight()}else m.currentFramebuffer=null,c.bindFramebuffer(c.FRAMEBUFFER,null),c=p.GetScissoredViewportWidth(),e=p.GetScissoredViewportHeight();g&&p._UpdateViewportBatch(c,e,k)}InitClearSurface(c){this._type=7;c.writeToTypedArray(this._mat4param,0)}InitClearSurface2(c,e,g,k){this._type=7;const m=this._mat4param;m[0]=c;m[1]=e;m[2]=g;m[3]=k}DoClearSurface(){const c=this._gl;var e=this._mat4param,g=this._batchState;
const k=g.clearColor;(g=g.renderer._isScissorViewport&&f.isDebug)&&c.disable(c.SCISSOR_TEST);const m=e[0],p=e[1],n=e[2];e=e[3];k.equalsRgba(m,p,n,e)||(c.clearColor(m,p,n,e),k.setRgba(m,p,n,e));c.clear(c.COLOR_BUFFER_BIT);g&&c.enable(c.SCISSOR_TEST)}InitClearRect(c,e,g,k,m,p,n,u){this._type=8;const q=this._mat4param;q[0]=c;q[1]=e;q[2]=g;q[3]=k;q[4]=m;q[5]=p;q[6]=n;q[7]=u}DoClearRectangle(){const c=this._gl;var e=this._mat4param,g=this._batchState;const k=g.renderer;g=g.clearColor;k._isScissorViewport||
c.enable(c.SCISSOR_TEST);c.scissor(e[0],e[1],e[2],e[3]);const m=e[4],p=e[5],n=e[6];e=e[7];g.equalsRgba(m,p,n,e)||(c.clearColor(m,p,n,e),g.setRgba(m,p,n,e));c.clear(c.COLOR_BUFFER_BIT);k._isScissorViewport?c.scissor(0,0,k._viewportScissorWidth,k._viewportScissorHeight):c.disable(c.SCISSOR_TEST)}InitSetPointTexCoords(c){this._type=13;c.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const c=this._mat4param;this._batchState.pointTexCoords.set(c[0],c[1],c[2],c[3])}InitPoints(c,e){this._type=
9;this._startIndex=c;this._indexCount=1;this._mat4param[0]=e}DoPoints(){const c=this._gl,e=this._batchState,g=e.renderer._spPoints;c.useProgram(g._shaderProgram);g.UpdateMatP(e.currentMatP,!1);g.UpdateMatMV(e.currentMV,!1);var k=e.pointTexCoords;g._uPointTexStart.IsUsed()&&g._uPointTexStart.Update2f(k.getLeft(),k.getTop());g._uPointTexEnd.IsUsed()&&g._uPointTexEnd.Update2f(k.getRight(),k.getBottom());k=this._mat4param[0];g._uZElevation.IsUsed()&&g._uZElevation.Update1f(k);g._uColor.IsUsed()&&(k=e.currentColor,
g._uColor.Update4f(k[0],k[1],k[2],k[3]));c.drawArrays(c.POINTS,this._startIndex/4,this._indexCount);c.useProgram(e.currentShader._shaderProgram)}InitSetProgram(c){this._type=10;this._texParam=c}DoSetProgram(){var c=this._gl;const e=this._batchState,g=this._texParam;e.currentShader=g;c.useProgram(g._shaderProgram);g.UpdateMatP(e.currentMatP,!1);g.UpdateMatMV(e.currentMV,!1);g._uColor.IsUsed()&&(c=e.currentColor,g._uColor.Update4f(c[0],c[1],c[2],c[3]))}InitSetProgramParameters(){this._type=11}DoSetProgramParameters(){const c=
this._batchState.currentShader;c._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(c);c._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(c)}_DoSetOptionalUniformProgramParameters(c){const e=this._gl,g=this._mat4param,k=this._colorParam,m=this._srcOriginRect;if(c._uSamplerBack.IsUsed()){const p=this._batchState.renderer,n=this._texParam;p._lastTexture1!==n&&(e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,n?n._GetTexture():null),p._lastTexture1=n,e.activeTexture(e.TEXTURE0))}c._uPixelSize.IsUsed()&&
c._uPixelSize.Update2f(g[0],g[1]);c._uDestStart.IsUsed()&&c._uDestStart.Update2f(g[2],g[3]);c._uDestEnd.IsUsed()&&c._uDestEnd.Update2f(g[4],g[5]);c._uLayerScale.IsUsed()&&c._uLayerScale.Update1f(g[6]);c._uLayerAngle.IsUsed()&&c._uLayerAngle.Update1f(g[7]);c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(g[12],g[13]);c._uSrcEnd.IsUsed()&&c._uSrcEnd.Update2f(g[14],g[15]);c._uSrcOriginStart.IsUsed()&&c._uSrcOriginStart.Update2f(m[0],m[1]);c._uSrcOriginEnd.IsUsed()&&c._uSrcOriginEnd.Update2f(m[2],m[3]);c._uLayoutStart.IsUsed()&&
c._uLayoutStart.Update2f(k[0],k[1]);c._uLayoutEnd.IsUsed()&&c._uLayoutEnd.Update2f(k[2],k[3]);c._uSeconds.IsUsed()&&c._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(c){c=c._uCustomParameters;const e=this._shaderParams;for(let g=0,k=c.length;g<k;++g){const m=c[g],p=e[g];m.IsColorType()?m.Update3f(p.getR(),p.getG(),p.getB()):m.Update1f(p)}}InitInvalidateFramebuffer(c){this._type=12;this._texParam=c}DoInvalidateFramebuffer(){const c=this._gl,e=this._texParam,g=this._batchState.currentFramebuffer;
e!==g&&c.bindFramebuffer(c.FRAMEBUFFER,e);c.invalidateFramebuffer(c.FRAMEBUFFER,[c.COLOR_ATTACHMENT0]);e!==g&&c.bindFramebuffer(c.FRAMEBUFFER,g)}InitBlitFramebuffer(c,e,g){this._type=15;const k=this._mat4param,m=this._batchState.renderer;k[0]=c.GetWidth();k[1]=c.GetHeight();k[2]=e?e.GetWidth():m.GetWidth();k[3]=e?e.GetHeight():m.GetHeight();k[4]=c.IsLinearSampling()?1:0;k[5]="stretch"===g;g=this._shaderParams;f.clearArray(g);g.push(c._GetFramebuffer());g.push(e?e._GetFramebuffer():null)}DoBlitFramebuffer(){var c=
this._mat4param,e=this._shaderParams;const g=this._gl;var k=c[0],m=c[1],p=c[2];const n=c[3],u=0!==c[4];c=0!==c[5];const q=e[1];g.bindFramebuffer(g.READ_FRAMEBUFFER,e[0]);g.bindFramebuffer(g.DRAW_FRAMEBUFFER,q);c?g.blitFramebuffer(0,0,k,m,0,0,p,n,g.COLOR_BUFFER_BIT,u?g.LINEAR:g.NEAREST):(e=Math.min(k,p),k=Math.min(m,n),p=Math.max(m-n,0),m=Math.max(n-m,0),g.blitFramebuffer(0,p,e,k+p,0,m,e,k+m,g.COLOR_BUFFER_BIT,g.NEAREST))}InitStartQuery(c){this._type=16;this._texParam=c}DoStartQuery(){this._texParam.BeginTimeElapsed();
this._texParam=null}InitEndQuery(c){this._type=17;this._texParam=c}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(c,e,g){this._type=18;const k=this._mat4param;k[0]=c;k[1]=e;k[2]=g}DoSetEllipseParams(){const c=this._batchState.currentShader,e=this._mat4param;c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(e[0],e[1]);c._uOutlineThickness.IsUsed()&&c._uOutlineThickness.Update1f(e[2])}InitSetTilemapInfo(c,e,g,k,m,p,n){this._type=14;const u=this._mat4param;c.writeToTypedArray(u,
0);u[4]=1/e;u[5]=1/g;u[6]=k/e;u[7]=m/g;u[8]=p/e;u[9]=n/g}DoSetTilemapInfo(){const c=this._batchState.currentShader,e=this._mat4param;c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(e[0],e[1]);c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(e[4],e[5]);c._uTileSize.IsUsed()&&c._uTileSize.Update2f(e[6],e[7]);c._uTileSpacing.IsUsed()&&c._uTileSpacing.Update2f(e[8],e[9])}Run(){switch(this._type){case 1:this.DoQuad();break;case 2:this.DoSetTexture();break;case 3:this.DoSetColor();break;case 4:this.DoSetBlend();
break;case 5:this.DoUpdateModelView();break;case 6:this.DoSetRenderTarget();break;case 7:this.DoClearSurface();break;case 8:this.DoClearRectangle();break;case 9:this.DoPoints();break;case 10:this.DoSetProgram();break;case 11:this.DoSetProgramParameters();break;case 12:this.DoInvalidateFramebuffer();break;case 13:this.DoSetPointTextureCoords();break;case 14:this.DoSetTilemapInfo();break;case 15:this.DoBlitFramebuffer();break;case 16:this.DoStartQuery();break;case 17:this.DoEndQuery();break;case 18:this.DoSetEllipseParams();
break;case 19:this.DoSetGradientColor()}}}}"use strict";
{const f=self.C3,b={timeout:60},a=new f.Color(0,0,0,1),d=new Set(["left","center","right"]),c=new Set(["top","center","bottom"]),e=new Set(["word","character"]),g=new Set;f.FontManager&&f.FontManager.addEventListener("fontload",n=>{n=n.font.GetName();for(const u of g)(u.IsBBCodeEnabled()||f.equalsNoCase(u.GetFontName(),n))&&u._SetTextChanged()});function k(n,u,q,r,t,x){u?"Gecko"===f.Platform.BrowserEngine?n.strokeText(q,r,t,x):n.strokeText(q,r,t):"Gecko"===f.Platform.BrowserEngine?n.fillText(q,r,
t,x):n.fillText(q,r,t)}function m(n,u,q,r,t,x){u?n.strokeRect(q,r,t,x):n.fillRect(q,r,t,x)}function p(n){return 4/3*n}f.Gfx.RendererText=class{constructor(n,u){u=Object.assign({},b,u);this._renderer=n;this._fontName="Arial";this._fontSize=16;this._lineHeight=0;this._isItalic=this._isBold=!1;this._colorStr="black";this._isBBcodeEnabled=!1;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text="";this._bbString=null;this._wrappedText=
f.New(f.WordWrap);this._wrapMode="word";this._isUpdating=this._textChanged=!1;this._isAsync=!0;this._drawMaxCharCount=-1;this._height=this._width=this._cssHeight=this._cssWidth=this._drawCharCount=0;this._zoom=1;this._changed=!1;this._measureContext=this._textContext=this._textCanvas=null;this._lastCanvasHeight=this._lastCanvasWidth=-1;this._lastTextCanvasFillStyle=this._lastMeasureCanvasFont=this._lastTextCanvasFont="";this._lastTextCanvasLineWidth=this._lastTextCanvasOpacity=1;this._measureTextCallback=
(q,r)=>this._MeasureText(q,r);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new f.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new f.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},u.timeout);this.ontextureupdate=null;this._wasReleased=!1;g.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._measureTextCallback=this._measureContext=this._textContext=this._textCanvas=this._bbString=null;this._textureTimeout.Release();
this.ontextureupdate=null;this.ReleaseTexture();this._wrappedText.Clear();this._renderer=this._wrappedText=null;this._wasReleased=!0;g.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=!0}SetIsAsync(n){this._isAsync=!!n}IsAsync(){return this._isAsync}SetBBCodeEnabled(n){n=!!n;this._isBBcodeEnabled!==n&&(this._isBBcodeEnabled=n,this._textContext&&(this._textContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top"),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(n){n||
(n="serif");this._fontName!==n&&(this._fontName=n,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(n){.1>n&&(n=.1);this._fontSize!==n&&(this._fontSize=n,this._SetTextChanged())}SetLineHeight(n){this._lineHeight!==n&&(this._lineHeight=n,this._SetChanged())}SetBold(n){n=!!n;this._isBold!==n&&(this._isBold=n,this._SetTextChanged())}SetItalic(n){n=!!n;this._isItalic!==n&&(this._isItalic=n,this._SetTextChanged())}SetDrawMaxCharacterCount(n){n=Math.floor(n);this._drawMaxCharCount!==
n&&(this._drawMaxCharCount=n,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(n,u){for(let q=n.length-1;0<=q;--q){const r=n[q];if(r.tag===u)return r}return null}_HasStyleTag(n,u){return!!this._GetStyleTag(n,u)}_GetFontString(n,u){let q="";if(this._isBold||this._HasStyleTag(u,"b"))q+="bold";if(this._isItalic||this._HasStyleTag(u,"i"))q+=" italic";var r=this._GetStyleTag(u,"size");r=r?parseFloat(r.param):this._fontSize;q=n?q+(" "+r+"pt"):q+(" "+r*this._scaleFactor*
this._zoom*self.devicePixelRatio+"pt");n=this._fontName;(u=this._GetStyleTag(u,"font"))&&u.param&&(n=u.param,this.onloadfont&&!this._alreadyLoadedFonts.has(n)&&(this.onloadfont(n),this._alreadyLoadedFonts.add(n)));n&&(q+=' "'+n+'"');return q}SetColor(n){n instanceof f.Color&&(n=n.getCssRgb());this._colorStr!==n&&(this._colorStr=n,this._SetChanged())}SetColorRgb(n,u,q){a.setRgb(n,u,q);this.SetColor(a)}SetHorizontalAlignment(n){if(!d.has(n))throw Error("invalid horizontal alignment");this._horizontalAlign!==
n&&(this._horizontalAlign=n,this._SetChanged())}SetVerticalAlignment(n){if(!c.has(n))throw Error("invalid vertical alignment");this._verticalAlign!==n&&(this._verticalAlign=n,this._SetChanged())}SetWordWrapMode(n){if(!e.has(n))throw Error("invalid word wrap mode");this._wrapMode!==n&&(this._wrapMode=n,this._SetTextChanged())}SetText(n){this._text!==n&&(this._text=n,this._SetTextChanged())}SetSize(n,u,q){"undefined"===typeof q&&(q=1);if(!(0>=n||0>=n||this._cssWidth===n&&this._cssHeight===u&&this._zoom===
q)){1===this._zoom!==(1===q)&&(this._needToRecreateTexture=!0);var r=this._cssWidth,t=this._zoom;this._cssWidth=n;this._cssHeight=u;this._zoom=q;n=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*n;this._height=this._cssHeight*this._zoom*n;n=Math.max(this._width,this._height);u=Math.min(this._renderer.GetMaxTextureSize(),2048);q=1;n>u&&(q=u/n,this._width=Math.min(this._width*q,u),this._height=Math.min(this._height*q,u));this._scaleFactor=q;0<this._textureWidth&&0<this._textureHeight&&this._zoom===
t&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);this._cssWidth!==r?this._SetTextChanged():this._SetChanged()}}GetWidth(){return this._width}GetHeight(){return this._height}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();return this._wrappedText.GetTotalLineHeight()+this._wrappedText.GetLineCount()*(this._lineHeight+4)-this._lineHeight}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();
return this._texture}_MaybeUpdate(){this._texture&&!this._changed&&!this._textChanged||this._isUpdating||0>=this._width||0>=this._height||(this._changed=!1,this._isUpdating=!0,this._isAsync?f.Asyncify(()=>this._DoUpdate()):this._DoUpdate())}_DoUpdate(){this._wasReleased||(this._SetTextCanvasSize(Math.ceil(this._width),Math.ceil(this._height)),this._MaybeWrapText(),this._DrawTextToCanvas(),this._UpdateTexture(),this._textureTimeout.Reset(),this._isUpdating=!1)}_SetTextCanvasSize(n,u){this._textCanvas||
(this._textCanvas=f.CreateCanvas(16,16));let q=!1;if(this._lastCanvasWidth!==n||this._lastCanvasHeight!==u)this._lastCanvasWidth=n,this._lastCanvasHeight=u,this._textCanvas.width=n,this._textCanvas.height=u,q=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),q=!0);q?(this._textContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._textContext.font=this._lastTextCanvasFont,this._textContext.fillStyle=this._lastTextCanvasFillStyle,this._textContext.strokeStyle=
this._lastTextCanvasFillStyle,this._textContext.globalAlpha=this._lastTextCanvasOpacity,this._textContext.lineWidth=this._lastTextCanvasLineWidth):this._textContext.clearRect(0,0,n,u)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=f.CreateCanvas(16,16).getContext("2d"))}_SetMeasureFontString(n){this._lastMeasureCanvasFont!==n&&(this._lastMeasureCanvasFont=n,this._measureContext.font=n)}_MaybeWrapText(){this._textChanged&&(this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||
this._bbString&&this._bbString.toString()===this._text||(this._bbString=new f.BBString(this._text,{noEscape:!0})),this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,0),this._textChanged=!1)}_MeasureText(n,u){this._SetMeasureFontString(this._GetFontString(!0,u));u=(u=this._GetStyleTag(u,"size"))?parseFloat(u.param):this._fontSize;return{width:this._measureContext.measureText(n).width,height:p(u)}}_SetDrawFontString(n){this._lastTextCanvasFont!==
n&&(this._lastTextCanvasFont=n,this._textContext.font=n)}_SetDrawCanvasColor(n){this._lastTextCanvasFillStyle!==n&&(this._lastTextCanvasFillStyle=n,this._textContext.fillStyle=n,this._textContext.strokeStyle=n)}_SetDrawCanvasOpacity(n){this._lastTextCanvasOpacity!==n&&(this._lastTextCanvasOpacity=n,this._textContext.globalAlpha=n)}_SetDrawCanvasLineWith(n){this._lastTextCanvasLineWidth!==n&&(this._lastTextCanvasLineWidth=n,this._textContext.lineWidth=n)}_DrawTextToCanvas(){this._drawCharCount=0;const n=
this._scaleFactor*this._zoom*self.devicePixelRatio,u=(4+this._lineHeight)*n;let q=0;const r=this._wrappedText.GetLines();var t=r.reduce((x,z)=>x+z.height*n+u,0)-this._lineHeight*n;"center"===this._verticalAlign?q=Math.max(this._height/2-t/2,0):"bottom"===this._verticalAlign&&(q=this._height-t-2);for(let x=0,z=r.length;x<z;++x){t=r[x];const D=t.height*n,G=q;if(this._isBBcodeEnabled){if(q+=D,0<x&&q>this._height-4*n)break}else if(0<x&&q>=this._height-D)break;0<=G&&this._DrawTextLine(t,q,n);this._isBBcodeEnabled||
(q+=D);q+=u}}_DrawTextLine(n,u,q){let r=0;"center"===this._horizontalAlign?r=(this._width-n.width*q)/2:"right"===this._horizontalAlign&&(r=this._width-n.width*q);for(const t of n.fragments)this._DrawTextFragment(t,r,u,q,n.height),r+=t.width*q}_DrawTextFragment(n,u,q,r,t){const x=this._textContext,z=t/16;t=n.width*r;const D=n.height*r,G=n.height/16;var w=(4+this._lineHeight)*r;const B=n.styles;n=n.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+
n.length>this._drawMaxCharCount&&(n=n.substr(0,this._drawMaxCharCount-this._drawCharCount),t=this._MeasureText(n,B).width*r);this._drawCharCount+=n.length}const I=this._GetStyleTag(B,"background"),P=this._HasStyleTag(B,"u"),E=this._HasStyleTag(B,"s");if((!f.IsStringAllWhitespace(n)||I||P||E)&&!this._HasStyleTag(B,"hide")){var J=this._GetStyleTag(B,"offsetx");u+=J?parseFloat(J.param)*r:0;J=this._GetStyleTag(B,"offsety");q+=J?parseFloat(J.param)*r:0;I&&(this._SetDrawCanvasColor(I.param),x.fillRect(u,
q-D,t,D+w));w=this._GetStyleTag(B,"color");this._SetDrawCanvasColor(w?w.param:this._colorStr);w=this._GetStyleTag(B,"opacity");this._SetDrawCanvasOpacity(w?parseFloat(w.param)/100:1);(w=this._HasStyleTag(B,"stroke"))&&this._SetDrawCanvasLineWith(G*this._scaleFactor*this._zoom);P&&m(x,w,u,q+r*z,t,r*z);E&&m(x,w,u,q-D/4,t,r*G);this._SetDrawFontString(this._GetFontString(!1,B));k(x,w,n,u,q,t);!w&&(this._SetDrawCanvasLineWith(G*this._scaleFactor*this._zoom),r=this._GetStyleTag(B,"outline"))&&(this._SetDrawCanvasColor(r.param),
k(x,!0,n,u,q,t))}}_UpdateTexture(){if(!this._renderer.IsContextLost()&&(this._textureWidth=Math.ceil(this._width),this._textureHeight=Math.ceil(this._height),this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight),this._needToRecreateTexture&&(this.ReleaseTexture(),this._needToRecreateTexture=!1),this._texture||(this._texture=this._renderer.CreateDynamicTexture(this._textureWidth,this._textureHeight,{mipMap:1===this._zoom,mipMapQuality:"high"})),this._renderer.UpdateTexture(this._textCanvas,
this._texture),this.ontextureupdate))this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){this._texture&&(this._renderer.IsContextLost()||this._renderer.DeleteTexture(this._texture),this._texture=null)}static OnContextLost(){for(const n of g)n.ReleaseTexture()}static GetAll(){return g.values()}}}"use strict";
{const f=self.C3;class b{constructor(a){this._gl=a.GetContext();this._version=a.GetWebGLVersionNumber();this._timerExt=a._GetDisjointTimerQueryExtension();this._query=null;this._hasResult=this._isActive=!1;this._result=0;this._query=1===this._version?this._timerExt.createQueryEXT():this._gl.createQuery()}Release(){this._DeleteQueryObject();this._timerExt=this._gl=null;this._hasResult=!1}_DeleteQueryObject(){this._query&&(1===this._version?this._timerExt.deleteQueryEXT(this._query):this._gl.deleteQuery(this._query),
this._query=null)}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");1===this._version?this._timerExt.beginQueryEXT(this._timerExt.TIME_ELAPSED_EXT,this._query):this._gl.beginQuery(this._timerExt.TIME_ELAPSED_EXT,this._query);this._isActive=!0}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");1===this._version?this._timerExt.endQueryEXT(this._timerExt.TIME_ELAPSED_EXT):this._gl.endQuery(this._timerExt.TIME_ELAPSED_EXT);this._isActive=!1}CheckForResult(){if(this._query&&
!this._hasResult&&!this._isActive){var a=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_AVAILABLE_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT_AVAILABLE);var d=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);a&&!d&&(this._result=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT),this._result/=1E9,this._hasResult=!0);(a||
d)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}f.Gfx.WebGLTimeElapsedQuery=class{constructor(a){this._renderer=a;this._frameNumber=a.GetFrameNumber();this._isActive=!1;this._parentQuery=null;this._isNested=!1;this._realQuery=null;this._queries=[]}Release(){for(const a of this._queries)a instanceof b&&a.Release();f.clearArray(this._queries);this._renderer=this._realQuery=this._parentQuery=null}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");
const a=this._renderer._GetTimeQueryStack();0<a.length?(this._isNested=!0,this._parentQuery=a[a.length-1],this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null);this._isActive=!0;a.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");if(this._renderer._GetTimeQueryStack().pop()!==this)throw Error("can only end most nested query");this._isActive=!1;this._EndReal();this._parentQuery&&(this._parentQuery._StartReal(),
this._parentQuery=null)}_StartReal(){this._realQuery=f.New(b,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const a of this._queries)a.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(a=>a.HasResult())}GetResult(){return this._queries.reduce((a,d)=>a+d.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}}"use strict";
{const f=self.C3;f.Gfx.WebGLQueryResultBuffer=class{constructor(b,a=1E3){this._renderer=b;this._maxQueries=a;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const b of this._buffer)b.Release();f.clearArray(this._buffer)}AddTimeElapsedQuery(){const b=new f.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(b);this._buffer.length>this._maxQueries&&this._buffer.shift().Release();return b}CheckForResults(b){for(const a of this._buffer){if(a.GetFrameNumber()>=
b)break;if(a.IsNested())break;a.CheckForResult()}}GetFrameRangeResultSum(b,a){if(a<=b)return NaN;let d=0;for(const c of this._buffer){if(c.GetFrameNumber()>=a)break;if(!(c.GetFrameNumber()<b))if(c.HasResult())d+=c.GetResult();else return NaN}return d}DeleteAllBeforeFrameNumber(b){for(let a=0,d=this._buffer.length;a<d;++a){const c=this._buffer[a];if(c.GetFrameNumber()<b)c.Release();else{0<a&&this._buffer.splice(0,a);break}}}}}"use strict";
{const f=self.C3,b=self.glMatrix,a=b.vec3,d=b.vec4,c=b.mat4,e={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,maxWebGLVersion:2},g=new Set(["default","low-power","high-performance"]);function k(w,B){return w[0]===B[0]&&w[1]===B[1]&&w[2]===B[2]&&w[3]===B[3]&&w[4]===B[4]&&w[5]===B[5]&&w[6]===B[6]&&w[7]===B[7]&&w[8]===B[8]&&w[9]===B[9]&&w[10]===B[10]&&w[11]===B[11]&&w[12]===B[12]&&w[13]===B[13]&&w[14]===B[14]&&w[15]===B[15]}const m=new f.Quad(0,0,1,0,1,1,0,1),p=a.fromValues(0,
0,0),n=a.fromValues(0,0,0),u=c.create(),q=new f.Quad,r=new f.Rect;let t=null;f.isDebug&&(self.debug_lose_context=function(){t?t.loseContext():console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=function(){t?t.restoreContext():console.warn("WEBGL_lose_context not supported")});const x=new Set;let z=-1;function D(){z=-1;for(const w of x)w.checkFunc()&&(w.resolve(),x.delete(w));0<x.size&&(z=self.requestAnimationFrame(D))}function G(w,B,I){if(2<=I&&(I=w.getContext("webgl2",B)))return{gl:I,
version:2};I=w.getContext("webgl",B);if(!I)try{I=w.getContext("experimental-webgl",B)}catch(P){console.warn("Error requesting 'experimental-webgl' context: ",P)}return{gl:I,version:1}}f.Gfx.WebGLRenderer=class extends f.Gfx.RendererBase{constructor(w,B){super();B=Object.assign({},e,B);if(!g.has(B.powerPreference))throw Error("invalid power preference");let I=!1;const P={alpha:!!B.alpha,depth:!1,antialias:!1,powerPreference:B.powerPreference,failIfMajorPerformanceCaveat:!0};B.lowLatency&&(P.desynchronized=
!0,P.preserveDrawingBuffer=!0);let E=G(w,P,B.maxWebGLVersion);E.gl||(I=!0,P.failIfMajorPerformanceCaveat=!1,E=G(w,P,B.maxWebGLVersion));if(!E.gl)throw Error("failed to initialise WebGL context");this._gl=w=E.gl;this._attribs=w.getContextAttributes();B.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=w.getParameter(w.VERSION);this._version=E.version;this._is3d=!0;this._lastBackbufferHeight=this._lastBackbufferWidth=
0;this._pointBuffer=this._indexBuffer=this._texcoordBuffer=this._vertexBuffer=null;this._vertexData=new Float32Array(8E3*this.GetNumVertexComponents());this._indexData=new Uint16Array(12E3);this._texcoordData=new Float32Array(16E3);this._pointData=new Float32Array(32E3);this._lastVertexPtr=this._pointPtr=this._texPtr=this._vertexPtr=0;this._spTilemapFill=this._spPoints=this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=
this._spLinearGradientFill=this._spColorFill=this._spDeviceTransformTextureFill=this._lastProgram=null;this._batch=[];this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=null;this._lastPointZ=this._currentZ=this._baseZ=0;this._batchState=f.New(f.Gfx.BatchState,this);this._lastColor=f.New(f.Color,1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._lastDestBlend=this._lastSrcBlend=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];
this._lineOffset=.5;this._lineOffsetStack=[this._lineOffset];this._isScissorViewport=!1;this._viewportScissorHeight=this._viewportScissorWidth=-1;this._lastPointTexCoords=new f.Rect;this._maxTextureSize=-1;this._highpPrecision=this._maxPointSize=this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._hasMajorPerformanceCaveat=I;this._isInitialisingAfterContextRestored=!1;this._parallelShaderCompileExt=null;this._isGpuProfilingEnabled=!!B.enableGpuProfiling;
this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}async InitState(){var w=this._gl,B=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*B-4*B;f.clearArray(this._batch);this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=this._currentZ=
this._baseZ=0;B=this._batchState;B.currentShader=null;B.currentFramebuffer=null;d.set(B.currentColor,1,1,1,1);B.clearColor.setRgba(0,0,0,0);B.pointTexCoords.set(0,0,1,1);w.clearColor(0,0,0,0);w.clear(w.COLOR_BUFFER_BIT);w.enable(w.BLEND);w.blendFunc(w.ONE,w.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=w.ONE;this._lastDestBlend=w.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(w);w.disable(w.CULL_FACE);w.disable(w.STENCIL_TEST);w.disable(w.DITHER);w.disable(w.DEPTH_TEST);this._pointBuffer=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,
this._pointBuffer);w.bufferData(w.ARRAY_BUFFER,this._pointData.byteLength,w.DYNAMIC_DRAW);this._vertexBuffer=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,this._vertexBuffer);w.bufferData(w.ARRAY_BUFFER,this._vertexData.byteLength,w.DYNAMIC_DRAW);this._texcoordBuffer=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,this._texcoordBuffer);w.bufferData(w.ARRAY_BUFFER,this._texcoordData.byteLength,w.DYNAMIC_DRAW);this._indexBuffer=w.createBuffer();w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,this._indexBuffer);w.bufferData(w.ELEMENT_ARRAY_BUFFER,
this._indexData,w.STATIC_DRAW);w.activeTexture(w.TEXTURE0);w.bindTexture(w.TEXTURE_2D,null);this._maxTextureSize=w.getParameter(w.MAX_TEXTURE_SIZE);B=w.getParameter(w.ALIASED_POINT_SIZE_RANGE);this._minPointSize=B[0];this._maxPointSize=B[1];B=w.getShaderPrecisionFormat(w.VERTEX_SHADER,w.HIGH_FLOAT);const I=w.getShaderPrecisionFormat(w.FRAGMENT_SHADER,w.HIGH_FLOAT);this._highpPrecision=B&&I?Math.min(B.precision,I.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=w.getSupportedExtensions();
if(B=w.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor=w.getParameter(B.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=w.getParameter(B.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=w.getExtension("KHR_parallel_shader_compile");f.isDebug&&(t=w.getExtension("WEBGL_lose_context"));if(this._isGpuProfilingEnabled)if(1===this.GetWebGLVersionNumber()){if("Chromium"!==f.Platform.BrowserEngine||81<=f.Platform.BrowserVersionNumber||"undefined"!==typeof document)this._timerExt=w.getExtension("EXT_disjoint_timer_query")}else this._timerExt=
w.getExtension("EXT_disjoint_timer_query_webgl2")||w.getExtension("EXT_disjoint_timer_query");this._ClearAllShaderPrograms();w=f.Gfx.WebGLShaderProgram;B=w.GetDefaultVertexShaderSource(this._is3d,!1);w=[[w.GetTextureFillFragmentShaderSource(),B,"<default>"],[w.GetTextureFillFragmentShaderSource(),B,"<default-device-transform>"],[w.GetPointFragmentShaderSource(),w.GetPointVertexShaderSource(),"<point>"],[w.GetColorFillFragmentShaderSource(),B,"<fill>"],[w.GetLinearGradientFillFragmentShaderSource(),
B,"<lineargradient>"],[w.GetHardEllipseFillFragmentShaderSource(),B,"<hardellipse>"],[w.GetHardEllipseOutlineFragmentShaderSource(),B,"<hardellipseoutline>"],[w.GetSmoothEllipseFillFragmentShaderSource(),B,"<smoothellipse>"],[w.GetSmoothEllipseOutlineFragmentShaderSource(),B,"<smoothellipseoutline>"],[w.GetSmoothLineFillFragmentShaderSource(),B,"<smoothline>"],[w.GetTilemapFragmentShaderSource(),w.GetDefaultVertexShaderSource(this._is3d,!0),"<tilemap>"]];w=await Promise.all(w.map(P=>this.CreateShaderProgram({src:P[0]},
P[1],P[2])));this._spTextureFill=w[0];this._spDeviceTransformTextureFill=w[1];this._spPoints=w[2];this._spColorFill=w[3];this._spLinearGradientFill=w[4];this._spHardEllipseFill=w[5];this._spHardEllipseOutline=w[6];this._spSmoothEllipseFill=w[7];this._spSmoothEllipseOutline=w[8];this._spSmoothLineFill=w[9];this._spTilemapFill=w[10];this._currentStateGroup=null;this.SetTextureFillMode()}Is3D(){return this._is3d}GetNumVertexComponents(){return this._is3d?3:2}SetBaseZ(w){this._baseZ=w}GetBaseZ(){return this._baseZ}SetCurrentZ(w){this._currentZ=
w;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}async CreateShaderProgram(w,B,I){w=await f.Gfx.WebGLShaderProgram.Create(this,w,B,I);this._AddShaderProgram(w);return w}ResetLastProgram(){this._lastProgram=null}SetSize(w,B,I){if(this._width!==w||this._height!==B||I){this.EndBatch();I=this._gl;var P=this._batchState;this._width=w;this._height=B;w=this.GetScissoredViewportWidth();B=this.GetScissoredViewportHeight();this._UpdateViewportRenderer(w,B,this._width,this._height);this._UpdateViewportBatch(w,
B,this._matP);this._spDeviceTransformTextureFill&&(I.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,this._batchState.currentShader=this._spDeviceTransformTextureFill);I.bindTexture(I.TEXTURE_2D,null);I.activeTexture(I.TEXTURE1);I.bindTexture(I.TEXTURE_2D,null);I.activeTexture(I.TEXTURE0);this._lastTexture1=this._lastTexture0=null;this._currentRenderTarget&&
this._currentRenderTarget._Resize(this._width,this._height);I.bindFramebuffer(I.FRAMEBUFFER,null);this._currentRenderTarget=null;P.currentFramebuffer=null}}_UpdateViewportRenderer(w,B,I,P){this._cam[2]=100;c.lookAt(this._matMV,this._cam,this._look,this._up);c.perspective(this._matP,45,w/B,this.GetNearZ(),this.GetFarZ());const E=[0,0],J=[0,0],O=self.devicePixelRatio;this.Project(0,0,w,B,E);this.Project(1,1,w,B,J);this._worldScale[0]=O/(J[0]-E[0]);this._worldScale[1]=-O/(J[1]-E[1]);this._lastBackbufferWidth=
I;this._lastBackbufferHeight=P}_UpdateViewportBatch(w,B,I){const P=this._batchState;this._gl.viewport(0,0,w,B);w=this._allShaderPrograms;B=P.currentShader;for(let E=0,J=w.length;E<J;++E){const O=w[E];O===B?O.UpdateMatP(I,!0):O.SetMatPStale()}c.copy(P.currentMatP,I)}SetViewportScissor(w,B){const I=this._gl;if(this._width===w&&this._height===B)this._isScissorViewport&&(this.EndBatch(),I.disable(I.SCISSOR_TEST),this._isScissorViewport=!1,this._viewportScissorHeight=this._viewportScissorWidth=-1,this.SetSize(this._width,
this._height,!0));else if(this._isScissorViewport||(this.EndBatch(),I.enable(I.SCISSOR_TEST),this._isScissorViewport=!0),this._viewportScissorWidth!==w||this._viewportScissorHeight!==B)this.EndBatch(),I.scissor(0,0,w,B),this._viewportScissorWidth=w,this._viewportScissorHeight=B,this.SetSize(this._width,this._height,!0)}RemoveViewportScissor(){const w=this._gl;this._isScissorViewport&&(this.EndBatch(),w.disable(w.SCISSOR_TEST),this._isScissorViewport=!1);this._viewportScissorHeight=this._viewportScissorWidth=
-1}GetScissoredViewportWidth(){return this._isScissorViewport?this._viewportScissorWidth:this.GetWidth()}GetScissoredViewportHeight(){return this._isScissorViewport?this._viewportScissorHeight:this.GetHeight()}UpdateModelView(){k(this._lastMV,this._matMV)||(this.PushBatch().InitUpdateModelView(this._matMV),c.copy(this._lastMV,this._matMV),this._topOfBatch=0)}GetBatchState(){return this._batchState}PushBatch(){const w=this._batch;this._batchPtr===w.length&&w.push(new f.Gfx.WebGLBatchJob(this._batchState));
return w[this._batchPtr++]}EndBatch(){0===this._batchPtr||this.IsContextLost()||(this._WriteBuffers(),this._ExecuteBatch(),this._topOfBatch=this._pointPtr=this._texPtr=this._vertexPtr=this._batchPtr=0)}_WriteBuffers(){const w=this._gl;0<this._pointPtr&&(w.bindBuffer(w.ARRAY_BUFFER,this._pointBuffer),w.bufferSubData(w.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr)));0<this._vertexPtr&&(w.bindBuffer(w.ARRAY_BUFFER,this._vertexBuffer),w.bufferSubData(w.ARRAY_BUFFER,0,this._vertexData.subarray(0,
this._vertexPtr)),w.bindBuffer(w.ARRAY_BUFFER,this._texcoordBuffer),w.bufferSubData(w.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const w=this._batch;for(let B=0,I=this._batchPtr;B<I;++B)w[B].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(w,B,I,P){const E=this._lastColor;E.equalsRgba(w,B,I,P)||(E.setRgba(w,B,I,P),this.PushBatch().InitSetColor(E),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(w){const B=this._lastColor;B.getA()!==w&&(B.setA(w),
this.PushBatch().InitSetColor(B),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(w){const B=this._lastColor;B.equals(w)||(B.set(w),this.PushBatch().InitSetColor(B),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(w){w!==this._lastTexture0&&(this.PushBatch().InitSetTexture(w),this._lastTexture0=w,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(w){w=this._GetBlendByIndex(w);this._SetBlend(w[0],
w[1])}SetNamedBlendMode(w){w=this.GetNamedBlend(w);this._SetBlend(w.srcBlend,w.destBlend)}_SetBlend(w,B){if(w!==this._lastSrcBlend||B!==this._lastDestBlend)this.PushBatch().InitSetBlend(w,B),this._lastSrcBlend=w,this._lastDestBlend=B,this._topOfBatch=0,this._currentStateGroup=null}IsPremultipliedAlphaBlend(){return this._lastSrcBlend===this._gl.ONE&&this._lastDestBlend===this._gl.ONE_MINUS_SRC_ALPHA}SetAlphaBlend(){this._SetBlend(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA)}SetNoPremultiplyAlphaBlend(){this._SetBlend(this._gl.SRC_ALPHA,
this._gl.ONE_MINUS_SRC_ALPHA)}SetCopyBlend(){this._SetBlend(this._gl.ONE,this._gl.ZERO)}Rect(w){this.Rect2(w.getLeft(),w.getTop(),w.getRight(),w.getBottom())}Rect2(w,B,I,P){this.Quad2(w,B,I,B,I,P,w,P)}_ExtendQuadBatch(){let w=this._vertexPtr;w>=this._lastVertexPtr&&(this.EndBatch(),w=0);1===this._topOfBatch?this._batch[this._batchPtr-1]._indexCount+=6:(this.PushBatch().InitQuad(this._is3d?w:w/2*3,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(w){w.writeToTypedArray3D(this._vertexData,this._vertexPtr,
this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(w){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(w);m.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(w,B,I,P,E,J,O,R){this._ExtendQuadBatch();const T=this._vertexData;let Y=this._vertexPtr;const W=this._baseZ+this._currentZ;this._is3d?(T[Y++]=w,T[Y++]=B,T[Y++]=W,T[Y++]=I,T[Y++]=P,T[Y++]=W,T[Y++]=E,T[Y++]=J,T[Y++]=W,T[Y++]=O,T[Y++]=R,T[Y++]=W):(T[Y++]=w,T[Y++]=B,T[Y++]=I,T[Y++]=P,T[Y++]=E,T[Y++]=J,T[Y++]=O,T[Y++]=
R);this._vertexPtr=Y;m.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(w,B){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(w);B.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(w,B){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(w);B.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(w,B){c.copy(u,this._lastMV);a.copy(p,this._cam);a.copy(n,this._look);this._cam[0]=0;this._cam[1]=0;this._cam[2]=100*
self.devicePixelRatio;this._look[0]=0;this._look[1]=0;this._look[2]=0;this.ResetModelView();this.UpdateModelView();if(this._isScissorViewport){w=this._viewportScissorWidth/2;var I=this._viewportScissorHeight/2;r.set(-w,I,-w+this._viewportScissorWidth,I-this._viewportScissorHeight);q.setFromRect(r);r.set(0,0,this._viewportScissorWidth/this._width,this._viewportScissorHeight/this._height);this.Quad3(q,r)}else if("crop"===w&&this._currentRenderTarget&&B){w=this._width/2;I=this._height/2;const J=B.GetWidth();
B=B.GetHeight();var P=this._currentRenderTarget.GetWidth(),E=this._currentRenderTarget.GetHeight();P=Math.min(P,J);const O=Math.min(E,B),R=Math.max(B-E,0);E=Math.max(E-B,0);r.set(-w,I-E,-w+P,I-O-E);q.setFromRect(r);r.set(0,R,P,O+R);r.divide(J,B);this.Quad3(q,r)}else{let [J,O]=this.GetRenderTargetSize(this._currentRenderTarget);w=J/2;I=O/2;this.Rect2(-w,I,w,-I)}c.copy(this._matMV,u);a.copy(this._cam,p);a.copy(this._look,n);this.UpdateModelView()}ConvexPoly(w){var B=w.length/2;if(3>B)throw Error("need at least 3 points");
B-=2;const I=B-1,P=w[0],E=w[1];for(let J=0;J<B;J+=2){const O=2*J,R=w[O+2],T=w[O+3],Y=w[O+4],W=w[O+5];J===I?this.Quad2(P,E,R,T,Y,W,Y,W):this.Quad2(P,E,R,T,Y,W,w[O+6],w[O+7])}}Line(w,B,I,P){var E=f.angleTo(w,B,I,P),J=.5*this._lineWidth;const O=Math.sin(E)*J;E=Math.cos(E)*J;J=this._lineCap;2===J?this.LinePreCalc_LineCap2(w,B,I,P,O,E):1===J?this.LinePreCalc_LineCap1(w,B,I,P,O,E):this.LinePreCalc_LineCap0(w,B,I,P,O,E)}LinePreCalc_LineCap2(w,B,I,P,E,J){var O=this._lineOffset;w=w+O-J;B=B+O-E;I=I+O+J;P=P+
O+E;O=2*J;const R=2*E;this.Quad2(w+E,B-J,I+E,P-J,I-E-O,P+J-R,w-E+O,B+J+R)}LinePreCalc_LineCap1(w,B,I,P,E,J){const O=this._lineOffset;w=w+O-J;B=B+O-E;I=I+O+J;P=P+O+E;this.Quad2(w+E,B-J,I+E,P-J,I-E,P+J,w-E,B+J)}LinePreCalc_LineCap0(w,B,I,P,E,J){const O=this._lineOffset;w+=O;B+=O;I+=O;P+=O;this.Quad2(w+E,B-J,I+E,P-J,I-E,P+J,w-E,B+J)}TexturedLine(w,B,I,P,E,J){var O=f.angleTo(w,B,I,P),R=.5*this._lineWidth;const T=Math.sin(O)*R;O=Math.cos(O)*R;R=this._lineCap;2===R?this.TexturedLinePreCalc_LineCap2(w,B,
I,P,T,O,E,J):1===R?this.TexturedLinePreCalc_LineCap1(w,B,I,P,T,O,E,J):this.TexturedLinePreCalc_LineCap0(w,B,I,P,T,O,E,J)}TexturedLinePreCalc_LineCap2(w,B,I,P,E,J,O,R){var T=this._lineOffset;w=w+T-J;B=B+T-E;I=I+T+J;P=P+T+E;T=2*J;const Y=2*E;q.set(w+E,B-J,I+E,P-J,I-E-T,P+J-Y,w-E+T,B+J+Y);r.set(O,0,R,0);this.Quad3(q,r)}TexturedLinePreCalc_LineCap1(w,B,I,P,E,J,O,R){const T=this._lineOffset;w=w+T-J;B=B+T-E;I=I+T+J;P=P+T+E;q.set(w+E,B-J,I+E,P-J,I-E,P+J,w-E,B+J);r.set(O,0,R,0);this.Quad3(q,r)}TexturedLinePreCalc_LineCap0(w,
B,I,P,E,J,O,R){const T=this._lineOffset;w+=T;B+=T;I+=T;P+=T;q.set(w+E,B-J,I+E,P-J,I-E,P+J,w-E,B+J);r.set(O,0,R,0);this.Quad3(q,r)}LineRect(w,B,I,P){const E=.5*this._lineWidth,J=this._lineCap;2===J?this._LineRectPreCalc_LineCap2(w,B,I,P,E):1===J?this._LineRectPreCalc_LineCap1(w,B,I,P,E):this._LineRectPreCalc_LineCap0(w,B,I,P,E)}_LineRectPreCalc_LineCap2(w,B,I,P,E){this.LinePreCalc_LineCap2(w,B,I,B,0,E);this.LinePreCalc_LineCap2(I,B,I,P,E,0);this.LinePreCalc_LineCap2(I,P,w,P,0,-E);this.LinePreCalc_LineCap2(w,
P,w,B,-E,0)}_LineRectPreCalc_LineCap1(w,B,I,P,E){this.LinePreCalc_LineCap1(w,B,I,B,0,E);this.LinePreCalc_LineCap1(I,B,I,P,E,0);this.LinePreCalc_LineCap1(I,P,w,P,0,-E);this.LinePreCalc_LineCap1(w,P,w,B,-E,0)}_LineRectPreCalc_LineCap0(w,B,I,P,E){this.LinePreCalc_LineCap0(w,B,I,B,0,E);this.LinePreCalc_LineCap0(I,B,I,P,E,0);this.LinePreCalc_LineCap0(I,P,w,P,0,-E);this.LinePreCalc_LineCap0(w,P,w,B,-E,0)}LineRect2(w){this.LineRect(w.getLeft(),w.getTop(),w.getRight(),w.getBottom())}LineQuad(w){var B=f.angleTo(w.getTlx(),
w.getTly(),w.getTrx(),w.getTry()),I=.5*this._lineWidth;const P=Math.sin(B)*I;B=Math.cos(B)*I;I=this._lineCap;2===I?this._LineQuadPreCalc_LineCap2(w,P,B):1===I?this._LineQuadPreCalc_LineCap1(w,P,B):this._LineQuadPreCalc_LineCap0(w,P,B)}_LineQuadPreCalc_LineCap2(w,B,I){this.LinePreCalc_LineCap2(w.getTlx(),w.getTly(),w.getTrx(),w.getTry(),B,I);this.LinePreCalc_LineCap2(w.getTrx(),w.getTry(),w.getBrx(),w.getBry(),I,-B);this.LinePreCalc_LineCap2(w.getBrx(),w.getBry(),w.getBlx(),w.getBly(),-B,-I);this.LinePreCalc_LineCap2(w.getBlx(),
w.getBly(),w.getTlx(),w.getTly(),-I,B)}_LineQuadPreCalc_LineCap1(w,B,I){this.LinePreCalc_LineCap1(w.getTlx(),w.getTly(),w.getTrx(),w.getTry(),B,I);this.LinePreCalc_LineCap1(w.getTrx(),w.getTry(),w.getBrx(),w.getBry(),I,-B);this.LinePreCalc_LineCap1(w.getBrx(),w.getBry(),w.getBlx(),w.getBly(),-B,-I);this.LinePreCalc_LineCap1(w.getBlx(),w.getBly(),w.getTlx(),w.getTly(),-I,B)}_LineQuadPreCalc_LineCap0(w,B,I){this.LinePreCalc_LineCap0(w.getTlx(),w.getTly(),w.getTrx(),w.getTry(),B,I);this.LinePreCalc_LineCap0(w.getTrx(),
w.getTry(),w.getBrx(),w.getBry(),I,-B);this.LinePreCalc_LineCap0(w.getBrx(),w.getBry(),w.getBlx(),w.getBly(),-B,-I);this.LinePreCalc_LineCap0(w.getBlx(),w.getBly(),w.getTlx(),w.getTly(),-I,B)}SetLineWidth(w){this._lineWidth=w;this._lineWidthStack[this._lineWidthStack.length-1]=w}GetLineWidth(){return this._lineWidth}PushLineWidth(w){if(100<=this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(w);this._lineWidth=w}PopLineWidth(){if(1>=
this._lineWidthStack.length)throw Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack[this._lineWidthStack.length-1]}SetLineCapButt(){this._lineCap=0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(w){if("butt"===w)this.PushLineCapButt();else if("square"===
w)this.PushLineCapSquare();else if("zag"===w)this.PushLineCapZag();else throw Error("invalid line cap");}PushLineCapButt(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");
this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(1>=this._lineCapStack.length)throw Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=this._lineCapStack[this._lineCapStack.length-1]}SetLineOffset(w){this._lineOffset=w;this._lineOffsetStack[this._lineOffsetStack.length-1]=w}GetLineOffset(){return this._lineOffset}PushLineOffset(w){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(w);
this._lineOffset=w}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack[this._lineOffsetStack.length-1]}SetPointTextureCoords(w){this._lastPointTexCoords.equals(w)||(this._lastPointTexCoords.copy(w),this.PushBatch().InitSetPointTexCoords(w),this._topOfBatch=0)}Point(w,B,I,P){7996<=this._pointPtr&&this.EndBatch();let E=this._pointPtr;var J=this._baseZ+this._currentZ;2===
this._topOfBatch&&this._lastPointZ===J?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(E,J),this._topOfBatch=2,this._lastPointZ=J);J=this._pointData;J[E++]=w;J[E++]=B;J[E++]=I;J[E++]=P;this._pointPtr=E}SetProgram(w){this._lastProgram!==w&&(this.PushBatch().InitSetProgram(w),this._lastProgram=w,this._topOfBatch=0,this._currentStateGroup=null)}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetGradientColor(w){this.PushBatch().InitSetGradientColor(w);
this._topOfBatch=0}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetEllipseParams(w,B,I=1){this.PushBatch().InitSetEllipseParams(w,B,I);this._topOfBatch=0}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetTilemapInfo(w,
B,I,P,E,J,O){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(w,B,I,P,E,J,O);this._topOfBatch=0}SetProgramParameters(w,B,I,P,E,J,O,R,T,Y,W){const ea=this._lastProgram;var qa=ea._hasAnyOptionalUniforms;const ja=!!W.length;if(qa&&!ea.AreOptionalUniformsAlreadySetInBatch(B,I,P,E,J,O,R,T,Y)||ja&&!ea.AreCustomParametersAlreadySetInBatch(W)){var xa=this.PushBatch();xa.InitSetProgramParameters();qa&&(ea.SetOptionalUniformsInBatch(B,
I,P,E,J,O,R,T,Y),qa=xa._mat4param,qa[0]=J,qa[1]=O,B.writeToTypedArray(qa,2),qa[6]=R,qa[7]=T,I.writeToTypedArray(qa,12),B=xa._colorParam,E.writeToTypedArray(B,0),E=B[1],B[1]=B[3],B[3]=E,P.writeToTypedArray(xa._srcOriginRect,0),xa._startIndex=Y,ea._uSamplerBack.IsUsed()?xa._texParam=w?w.GetTexture():null:xa._texParam=null);ja&&(ea.SetCustomParametersInBatch(W),f.shallowAssignArray(xa._shaderParams,W));this._topOfBatch=0}}ClearRgba(w,B,I,P){this.PushBatch().InitClearSurface2(w,B,I,P);this._topOfBatch=
0}Clear(w){this.PushBatch().InitClearSurface(w);this._topOfBatch=0}ClearRect(w,B,I,P){this.ClearRect4(w,B,I,P,0,0,0,0)}ClearRect2(w){this.ClearRect4(w.getLeft(),w.getTop(),w.width(),w.height(),0,0,0,0)}ClearRect3(w,B){this.ClearRect4(w.getLeft(),w.getTop(),w.width(),w.height(),B.getR(),B.getG(),B.getB(),B.getA())}ClearRect4(w,B,I,P,E,J,O,R){0>I||0>P||(this.PushBatch().InitClearRect(w,B,I,P,E,J,O,R),this._topOfBatch=0)}Start(){}Finish(){super.Finish();this._gl.flush()}CheckForQueryResults(){for(const w of this._allQueryResultBuffers)w.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||
this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){f.Gfx.WebGLRendererTexture.OnContextLost();f.Gfx.WebGLRenderTarget.OnContextLost();f.Gfx.RendererText.OnContextLost();for(const w of this._allQueryResultBuffers)w.Clear();this._extensions=[];this._parallelShaderCompileExt=this._timerExt=null;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._spTilemapFill=this._spPoints=this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=
this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spDeviceTransformTextureFill=this._spTextureFill=this._lastProgram=null;for(const w of this._stateGroups.values())w.OnContextLost();for(const w of this._allShaderPrograms)w.Release();this._ClearAllShaderPrograms()}async OnContextRestored(){this._isInitialisingAfterContextRestored=!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const w of this._stateGroups.values())w.OnContextRestored(this);this.SetSize(this._width,
this._height,!0)}CreateStaticTexture(w,B){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const I=f.New(f.Gfx.WebGLRendererTexture,this);I._CreateStatic(w,B);return I}CreateStaticTextureAsync(w,B){if(this.IsContextLost())return Promise.reject("context lost");B=Object.assign({},B);const I=B.wrapX&&"clamp-to-edge"!==B.wrapX||B.wrapY&&"clamp-to-edge"!==B.wrapY;if(!f.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&I)return f.Supports.ImageBitmap?createImageBitmap(w).then(P=>
f.Asyncify(()=>this.CreateStaticTexture(P,B))):w instanceof Blob?f.BlobToImage(w,!0).then(P=>this.CreateStaticTextureAsync(P,B)):"undefined"!==typeof HTMLImageElement&&w instanceof HTMLImageElement&&"function"===typeof w.decode?w.decode().then(()=>f.Asyncify(()=>this.CreateStaticTexture(w,B))):f.Asyncify(()=>this.CreateStaticTexture(w,B));B.premultiplyAlpha=!1;return createImageBitmap(w,{premultiplyAlpha:"premultiply"}).then(P=>f.Asyncify(()=>this.CreateStaticTexture(P,B)))}CreateDynamicTexture(w,
B,I){this.EndBatch();const P=f.New(f.Gfx.WebGLRendererTexture,this);P._CreateDynamic(w,B,I);return P}UpdateTexture(w,B,I){this.EndBatch();B._Update(w,I)}DeleteTexture(w){w&&(w.SubtractReference(),0<w.GetReferenceCount()||(this.EndBatch(),w===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),w===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=
null),w._Delete()))}CreateRenderTarget(w){let B=this._width,I=this._height,P=!0;w&&("number"===typeof w.width&&(B=w.width,P=!1),"number"===typeof w.height&&(I=w.height,P=!1));if(0>=B||0>=I)throw Error("invalid size");this.EndBatch();const E=f.New(f.Gfx.WebGLRenderTarget,this);E._Create(B,I,Object.assign({isDefaultSize:P},w));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;return E}SetRenderTarget(w){if(w!==this._currentRenderTarget){if(w){w.IsDefaultSize()&&w._Resize(this._width,
this._height);var B=w.GetWidth();var I=w.GetHeight();var P=B;var E=I}else B=this._width,I=this._height,P=this.GetScissoredViewportWidth(),E=this.GetScissoredViewportHeight();var J=this._lastBackbufferWidth!==B||this._lastBackbufferHeight!==I;J&&this._UpdateViewportRenderer(P,E,B,I);this.PushBatch().InitSetRenderTarget(w,J,this._matP);this._currentRenderTarget=w;this._topOfBatch=0}}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(w){return w?[w.GetWidth(),w.GetHeight()]:[this._width,
this._height]}CopyRenderTarget(w,B="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(w,B)):(this.PushBatch().InitBlitFramebuffer(w,this._currentRenderTarget,B),this._topOfBatch=0)}DrawRenderTarget(w,B="stretch"){w=w.GetTexture();if(!w)throw Error("not a texture-backed render target");this.SetTexture(w);this.FullscreenQuad(B,w)}InvalidateRenderTarget(w){2>this._version||(this.PushBatch().InitInvalidateFramebuffer(w._GetFramebuffer()),
this._topOfBatch=0)}DeleteRenderTarget(w){this.SetRenderTarget(null);this.EndBatch();const B=w.GetTexture();B===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);B===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=null);w._Delete()}async ReadBackRenderTargetToImageData(w,B,I){this.EndBatch();const P=this._currentRenderTarget;if(w){var E=
w.GetWidth();var J=w.GetHeight();var O=w._GetFramebuffer()}else E=this.GetWidth(),J=this.GetHeight(),O=null;let R=w=0;var T=E,Y=J;I&&(w=f.clamp(Math.floor(I.getLeft()),0,E-1),R=f.clamp(Math.floor(I.getTop()),0,J-1),T=I.width(),T=0===T?E-w:f.clamp(Math.floor(T),0,E-w),Y=I.height(),Y=0===Y?J-R:f.clamp(Math.floor(Y),0,J-R),R=J-(R+Y));const W=this._gl;W.bindFramebuffer(W.FRAMEBUFFER,O);J=()=>{W.bindFramebuffer(W.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;
this.SetRenderTarget(P)};if(!B&&2<=this.GetWebGLVersionNumber()){W.bindFramebuffer(W.READ_FRAMEBUFFER,O);O=W.createBuffer();I=T*Y*4;E=W.PIXEL_PACK_BUFFER;W.bindBuffer(E,O);W.bufferData(E,I,W.STREAM_READ);W.readPixels(w,R,T,Y,W.RGBA,W.UNSIGNED_BYTE,0);W.bindFramebuffer(W.READ_FRAMEBUFFER,null);W.bindBuffer(E,null);J();const ea=W.fenceSync(W.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>W.getSyncParameter(ea,W.SYNC_STATUS)===W.SIGNALED);W.deleteSync(ea);B=new ImageData(T,Y);W.bindBuffer(E,
O);W.getBufferSubData(E,0,new Uint8Array(B.data.buffer),0,I);W.bindBuffer(E,null);W.deleteBuffer(O)}else B=new ImageData(T,Y),W.readPixels(w,R,T,Y,W.RGBA,W.UNSIGNED_BYTE,new Uint8Array(B.data.buffer)),J();return B}StartQuery(w){this.SupportsGPUProfiling()&&(this.PushBatch().InitStartQuery(w),this._topOfBatch=0)}EndQuery(w){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(w),this._topOfBatch=0)}_WaitForObjectReady(w){const B=new Promise(I=>x.add({resolve:I,checkFunc:w}));-1===z&&(z=self.requestAnimationFrame(D));
return B}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*(this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let w=0;for(const B of f.Gfx.WebGLRenderTarget.allRenderTargets())B.GetTexture()||(w+=B.GetEstimatedMemoryUsage());return w}GetEstimatedTextureMemoryUsage(){let w=0;for(const B of f.Gfx.WebGLRendererTexture.allTextures())w+=B.GetEstimatedMemoryUsage();return w}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+
this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}SupportsNPOTTextures(){return 2<=this.GetWebGLVersionNumber()}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return 0!==this._highpPrecision}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetExtensions(){return this._extensions}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_AddQueryResultBuffer(w){this._allQueryResultBuffers.add(w)}_RemoveQueryResultBuffer(w){this._allQueryResultBuffers.delete(w)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(w){this._InitBlendModeData([["normal",
w.ONE,w.ONE_MINUS_SRC_ALPHA],["additive",w.ONE,w.ONE],["xor",w.ONE,w.ONE_MINUS_SRC_ALPHA],["copy",w.ONE,w.ZERO],["destination-over",w.ONE_MINUS_DST_ALPHA,w.ONE],["source-in",w.DST_ALPHA,w.ZERO],["destination-in",w.ZERO,w.SRC_ALPHA],["source-out",w.ONE_MINUS_DST_ALPHA,w.ZERO],["destination-out",w.ZERO,w.ONE_MINUS_SRC_ALPHA],["source-atop",w.DST_ALPHA,w.ONE_MINUS_SRC_ALPHA],["destination-atop",w.ONE_MINUS_DST_ALPHA,w.SRC_ALPHA]])}CreateRendererText(){return f.New(f.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}}"use strict";
{const f=self.C3;let b=null;const a=new Set;function d(k,m){const p=k[0]-m[0];return 0!==p?p:k[1]-m[1]}const c=[],e=[];let g=!1;self.IRuntime=class{constructor(k,m){b=k;Object.defineProperties(this,{assets:{value:b.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:m,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:b.GetProjectName(),writable:!1},projectVersion:{value:b.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(b),writable:!1},isInWorker:{value:b.IsInWorker(),
writable:!1}});b.UserScriptDispatcher().addEventListener("keydown",p=>{a.has(p.key)?p.stopPropagation():a.add(p.key)});b.UserScriptDispatcher().addEventListener("keyup",p=>a.delete(p.key));b.Dispatcher().addEventListener("window-blur",()=>a.clear());b.IsInWorker()&&(self.alert=p=>{g||(g=!0,console.warn("[Construct 3] alert() was called from a Web Worker, because the project 'Use worker' setting is enabled. This method is not normally available in a Web Worker. Construct has implemented the alert for you, but note that other features may be missing in worker mode. You may wish to disable 'Use worker', or use a more convenient function like console.log(). For more information please refer to the scripting section of the manual."));
return this.alert(p)})}_InitGlobalVars(k){Object.defineProperties(this.globalVars,k)}addEventListener(k,m){b.UserScriptDispatcher().addEventListener(k,m)}removeEventListener(k,m){b.UserScriptDispatcher().removeEventListener(k,m)}callFunction(k,...m){const p=b.GetEventSheetManager(),n=p.GetFunctionBlockByName(k);if(!n)throw Error(`cannot find function name '${k}'`);if(!n.IsEnabled())return n.GetDefaultReturnValue();if(m.length<n.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${k}' (${m.length} passed, ${n.GetFunctionParameterCount()} expected)`);
const u=n.GetEventBlock();k=null;var q=p.GetCurrentEvent();q&&(q=q.GetSolModifiersIncludingParents(),0<q.length&&(k=q,p.PushCleanSol(q)));m=u.RunAsExpressionFunctionCall(u.GetSolModifiersIncludingParents(),n.GetReturnType(),n.GetDefaultReturnValue(),...m);k&&p.PopSol(k);return m}setReturnValue(k){const m=b.GetEventStack().GetCurrentExpFuncStackFrame();if(!m)throw Error("not in a function which returns a value");switch(m.GetFunctionReturnType()){case 1:"number"===typeof k&&m.SetFunctionReturnValue(k);
break;case 2:"string"===typeof k&&m.SetFunctionReturnValue(k);break;case 3:"number"!==typeof k&&"string"!==typeof k||m.SetFunctionReturnValue(k)}}get dt(){return b.GetDt()}get gameTime(){return b.GetGameTime()}get wallTime(){return b.GetWallTime()}random(){return b.Random()}get layout(){return b.GetMainRunningLayout().GetILayout()}getLayout(k){const m=b.GetLayoutManager();if("number"===typeof k||"string"===typeof k)k=m.GetLayout(k);else throw new TypeError("expected string or number");if(!k)throw Error("invalid layout");
return k.GetILayout()}getAllLayouts(){return b.GetLayoutManager().GetAllLayouts().map(k=>k.GetILayout())}goToLayout(k){const m=b.GetLayoutManager();if("number"===typeof k||"string"===typeof k)k=m.GetLayout(k);else throw new TypeError("expected string or number");if(!k)throw Error("invalid layout");m.IsPendingChangeMainLayout()||m.ChangeMainLayout(k)}get keyboard(){const k=b._GetCommonScriptInterfaces().keyboard;if(!k)throw Error("runtime.keyboard used but Keyboard object missing - add it to your project first");
return k}get mouse(){const k=b._GetCommonScriptInterfaces().mouse;if(!k)throw Error("runtime.mouse used but Mouse object missing - add it to your project first");return k}get touch(){const k=b._GetCommonScriptInterfaces().touch;if(!k)throw Error("runtime.touch used but Touch object missing - add it to your project first");return k}invokeDownload(k,m){b.InvokeDownload(k,m)}getInstanceByUid(k){return(k=b.GetInstanceByUID(k))?k.GetInterfaceClass():null}sortZOrder(k,m){const p=b.GetCurrentLayout();for(var n of k){k=
b._UnwrapScriptInterface(n);if(!k||!k.GetWorldInfo())throw Error("invalid instance");var u=k.GetWorldInfo();c.push([u.GetLayer().GetIndex(),u.GetZIndex()]);e.push(k)}if(0!==c.length){c.sort(d);e.sort((q,r)=>m(q.GetInterfaceClass(),r.GetInterfaceClass()));n=!1;for(let q=0,r=c.length;q<r;++q){k=e[q];u=p.GetLayerByIndex(c[q][0]);const t=c[q][1],x=u._GetInstances();x[t]!==k&&(x[t]=k,k.GetWorldInfo()._SetLayer(u),u.SetZIndicesChanged(),n=!0)}n&&b.UpdateRender();f.clearArray(c);f.clearArray(e)}}alert(k){return b.PostComponentMessageToDOMAsync("runtime",
"alert",{message:k+(b.IsInWorker()?" [via Web Worker]":"")})}}}"use strict";
{const f=self.C3;let b=null;self.IAssetManager=class{constructor(a){b=a;Object.defineProperties(this,{isWebMOpusSupported:{value:b.IsAudioFormatSupported("audio/webm; codecs=opus"),writable:!1}})}fetchText(a){return b.FetchText(a)}fetchJson(a){return b.FetchJson(a)}fetchBlob(a){return b.FetchBlob(a)}fetchArrayBuffer(a){return b.FetchArrayBuffer(a)}getProjectFileUrl(a){return b.GetProjectFileUrl(a)}getMediaFileUrl(a){f.IsRelativeURL(a)&&(a=a.toLowerCase());return b.GetMediaFileUrl(a,b.GetMediaSubfolder())}get mediaFolder(){return b.GetMediaSubfolder()}async decodeWebMOpus(a,
d){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");d=await b.GetRuntime()._WasmDecodeWebMOpus(d);d=new Float32Array(d);a=a.createBuffer(1,d.length,48E3);a.getChannelData(0).set(d);return a}loadScripts(...a){return b.LoadScripts(...a)}compileWebAssembly(a){return b.CompileWebAssembly(a)}loadStyleSheet(a){return b.LoadStyleSheet(a)}}}"use strict";
self.IStorage=class{constructor(f){this._storage=f._GetProjectStorage()}getItem(f){return this._storage.getItem(f)}setItem(f,b){return this._storage.setItem(f,b)}removeItem(f){return this._storage.removeItem(f)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}};"use strict";
{const f=new WeakMap;self.IObjectClass=class{constructor(b){f.set(this,b);Object.defineProperties(this,{name:{value:b.GetName(),writable:!1}});b.GetRuntime()._MapScriptInterface(this,b)}addEventListener(b,a){f.get(this).UserScriptDispatcher().addEventListener(b,a)}removeEventListener(b,a){f.get(this).UserScriptDispatcher().removeEventListener(b,a)}getAllInstances(){return f.get(this).GetInstances().map(b=>b.GetInterfaceClass())}getFirstInstance(){const b=f.get(this).GetInstances();return 0<b.length?
b[0].GetInterfaceClass():null}getPickedInstances(){return f.get(this).GetCurrentSol().GetInstances().map(b=>b.GetInterfaceClass())}getFirstPickedInstance(){const b=f.get(this).GetCurrentSol().GetInstances();return 0<b.length?b[0].GetInterfaceClass():null}*instances(){for(const b of f.get(this).GetInstances())yield b.GetInterfaceClass()}*pickedInstances(){for(const b of f.get(this).GetCurrentSol().GetInstances())yield b.GetInterfaceClass()}setInstanceClass(b){if(0<f.get(this).GetInstanceCount())throw Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");
f.get(this)._SetUserScriptInstanceClass(b)}createInstance(b,a,d){if("number"!==typeof b&&"string"!==typeof b)throw new TypeError("invalid layer parameter");const c=f.get(this);var e=c.GetRuntime();b=e.GetMainRunningLayout().GetLayer(b);if(!b)throw Error("invalid layer");a=e.CreateInstance(c,b,a,d);e=e.GetEventSheetManager();e.BlockFlushingInstances(!0);a._TriggerOnCreated();if(a.IsInContainer())for(const g of a.siblings())g._TriggerOnCreated();e.BlockFlushingInstances(!1);return a.GetInterfaceClass()}}}"use strict";
{const f=new WeakMap;self.ILayout=class{constructor(b){f.set(this,b);const a=[],d=b.GetEffectList(),c=d.GetAllEffectTypes().length;for(let e=0;e<c;++e)a.push(new self.IEffectInstance(d,e));Object.defineProperties(this,{name:{value:b.GetName(),writable:!1},index:{value:b.GetIndex(),writable:!1},effects:{value:a,writable:!1}})}addEventListener(b,a){f.get(this).UserScriptDispatcher().addEventListener(b,a)}removeEventListener(b,a){f.get(this).UserScriptDispatcher().removeEventListener(b,a)}get width(){return f.get(this).GetWidth()}set width(b){f.get(this).SetWidth(b)}get height(){return f.get(this).GetHeight()}set height(b){f.get(this).SetHeight(b)}scrollTo(b,
a){const d=f.get(this);d.SetScrollX(b);d.SetScrollY(a)}getLayer(b){const a=f.get(this);if("number"===typeof b||"string"===typeof b)b=a.GetLayer(b);else throw new TypeError("expected string or number");if(!b)throw Error("invalid layer");return b.GetILayer()}getAllLayers(){return f.get(this).GetLayers().map(b=>b.GetILayer())}}}"use strict";
{const f=self.C3,b=new WeakMap;self.ILayer=class{constructor(a){b.set(this,a);const d=[],c=a.GetEffectList(),e=c.GetAllEffectTypes().length;for(let g=0;g<e;++g)d.push(new self.IEffectInstance(c,g));Object.defineProperties(this,{name:{value:a.GetName(),writable:!1},index:{value:a.GetIndex(),writable:!1},layout:{value:a.GetLayout().GetILayout(),writable:!1},effects:{value:d,writable:!1}})}static _Unwrap(a){return b.get(a)}get isVisible(){return b.get(this).IsVisible()}set isVisible(a){b.get(this).SetVisible(a)}get opacity(){return b.get(this).GetOpacity()}set opacity(a){a=
f.clamp(+a,0,1);isNaN(a)||b.get(this).SetOpacity(a)}getViewport(){return b.get(this).GetViewport().toDOMRect()}cssPxToLayer(a,d,c=0){const e=b.get(this),g=e.GetRuntime();return e.CanvasCssToLayer(a-g.GetCanvasClientX(),d-g.GetCanvasClientY(),c)}layerToCssPx(a,d,c=0){const e=b.get(this),g=e.GetRuntime(),[k,m]=e.LayerToCanvasCss(a,d,c);return[k+g.GetCanvasClientX(),m+g.GetCanvasClientY()]}}}"use strict";
{const f=self.C3,b=new WeakMap,a=new WeakMap;function d(e){let g=a.get(e);if(g)return g;g=f.New(f.Event.Dispatcher);a.set(e,g);return g}let c=null;self.IInstance=class{constructor(){b.set(this,c);const e={runtime:{value:c.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:c.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:c.GetUID(),writable:!1}};c._GetInstVarsScriptDescriptor(e);c._GetBehaviorsScriptDescriptor(e);Object.defineProperties(this,e);c.GetRuntime()._MapScriptInterface(this,
c)}static _Init(e){c=e}static _GetInitInst(){return c}_Release(){const e=a.get(this);e&&(e.Release(),a.delete(this));b.delete(this)}addEventListener(e,g,k){d(this).addEventListener(e,g,k)}removeEventListener(e,g,k){d(this).removeEventListener(e,g,k)}dispatchEvent(e){d(this).dispatchEvent(e)}destroy(){const e=b.get(this);e.GetRuntime().DestroyInstance(e)}}}"use strict";
{const f=self.C3,b=self.IInstance,a=self.ILayer,d=new WeakMap,c=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]),e=new Map([...c.entries()].map(k=>[k[1],k[0]])),g=f.New(f.Color);self.IWorldInstance=class extends b{constructor(){super();var k=b._GetInitInst();d.set(this,k);const m=[];var p=k.GetWorldInfo();if(k=p.GetInstanceEffectList()){p=p.GetObjectClass().GetEffectList().GetAllEffectTypes().length;
for(let n=0;n<p;++n)m.push(new self.IEffectInstance(k,n))}Object.defineProperties(this,{effects:{value:m,writable:!1}})}get layout(){return d.get(this).GetWorldInfo().GetLayout().GetILayout()}get layer(){return d.get(this).GetWorldInfo().GetLayer().GetILayer()}get x(){return d.get(this).GetWorldInfo().GetX()}set x(k){k=+k;const m=d.get(this).GetWorldInfo();isNaN(k)||m.GetX()===k||(m.SetX(k),m.SetBboxChanged())}get y(){return d.get(this).GetWorldInfo().GetY()}set y(k){k=+k;const m=d.get(this).GetWorldInfo();
isNaN(k)||m.GetY()===k||(m.SetY(k),m.SetBboxChanged())}get zElevation(){return d.get(this).GetWorldInfo().GetZElevation()}set zElevation(k){k=+k;const m=d.get(this),p=m.GetWorldInfo();p.GetZElevation()!==k&&(p.SetZElevation(k),m.GetRuntime().UpdateRender())}get totalZElevation(){return d.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return d.get(this).GetWorldInfo().GetWidth()}set width(k){k=+k;const m=d.get(this).GetWorldInfo();isNaN(k)||m.GetWidth()===k||(m.SetWidth(k),m.SetBboxChanged())}get height(){return d.get(this).GetWorldInfo().GetHeight()}set height(k){k=
+k;const m=d.get(this).GetWorldInfo();isNaN(k)||m.GetHeight()===k||(m.SetHeight(k),m.SetBboxChanged())}get angle(){return d.get(this).GetWorldInfo().GetAngle()}set angle(k){k=f.clampAngle(+k);const m=d.get(this).GetWorldInfo();isNaN(k)||m.GetAngle()===k||(m.SetAngle(k),m.SetBboxChanged())}get angleDegrees(){return f.toDegrees(this.angle)}set angleDegrees(k){this.angle=f.toRadians(k)}getBoundingBox(){return d.get(this).GetWorldInfo().GetBoundingBox().toDOMRect()}getBoundingQuad(){return d.get(this).GetWorldInfo().GetBoundingQuad().toDOMQuad()}get isVisible(){return d.get(this).GetWorldInfo().IsVisible()}set isVisible(k){k=
!!k;const m=d.get(this),p=m.GetWorldInfo();p.IsVisible()!==k&&(p.SetVisible(k),m.GetRuntime().UpdateRender())}get opacity(){return d.get(this).GetWorldInfo().GetOpacity()}set opacity(k){k=f.clamp(+k,0,1);const m=d.get(this),p=m.GetWorldInfo();isNaN(k)||p.GetOpacity()===k||(p.SetOpacity(k),m.GetRuntime().UpdateRender())}set colorRgb(k){if(3>k.length)throw Error("expected 3 elements");g.setRgb(k[0],k[1],k[2]);k=d.get(this);const m=k.GetWorldInfo();m.GetUnpremultipliedColor().equalsIgnoringAlpha(g)||
(m.SetUnpremultipliedColor(g),k.GetRuntime().UpdateRender())}get colorRgb(){const k=d.get(this).GetWorldInfo().GetUnpremultipliedColor();return[k.getR(),k.getG(),k.getB()]}set blendMode(k){k=c.get(k);if("number"!==typeof k)throw Error("invalid blend mode");const m=d.get(this);m.GetWorldInfo().SetBlendMode(k);m.GetRuntime().UpdateRender()}get blendMode(){return e.get(d.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){d.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){d.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(k){k=
a._Unwrap(k);if(!k)throw Error("invalid layer");d.get(this).GetWorldInfo().ZOrderMoveToLayer(k)}moveAdjacentToInstance(k,m){d.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(d.get(k),m)}containsPoint(k,m){return d.get(this).GetWorldInfo().ContainsPoint(+k,+m)}testOverlap(k){const m=d.get(this);k=d.get(k);return m.GetRuntime().GetCollisionEngine().TestOverlap(m,k)}testOverlapSolid(){var k=d.get(this);return(k=k.GetRuntime().GetCollisionEngine().TestOverlapSolid(k))?k.GetInterfaceClass():null}getParent(){const k=
d.get(this).GetParent();return k?k.GetInterfaceClass():null}getTopParent(){const k=d.get(this).GetTopParent();return k?k.GetInterfaceClass():null}*parents(){for(const k of d.get(this).parents())yield k.GetInterfaceClass()}getChildCount(){return d.get(this).GetChildCount()}getChildAt(k){return(k=d.get(this).GetChildAt(k))?k.GetInterfaceClass():null}*children(){for(const k of d.get(this).children())yield k.GetInterfaceClass()}*allChildren(){for(const k of d.get(this).allChildren())yield k.GetInterfaceClass()}addChild(k,
m){m||(m={});const p=d.get(this);k=d.get(k);p.AddChild(k,m)}removeChild(k){const m=d.get(this);k=d.get(k);m.RemoveChild(k)}removeFromParent(){const k=d.get(this);k.HasParent()&&k.GetParent().RemoveChild(k)}createMesh(k,m){d.get(this).GetWorldInfo().CreateMesh(k,m)}releaseMesh(){const k=d.get(this).GetWorldInfo();k.ReleaseMesh();k.SetBboxChanged()}setMeshPoint(k,m,p){const n=d.get(this).GetWorldInfo();n.SetMeshPoint(k,m,p)&&n.SetBboxChanged()}}}"use strict";
{const f=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();f.set(this,self.IInstance._GetInitInst())}getElement(){return f.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){f.get(this).GetSdkInstance().FocusElement()}blur(){f.get(this).GetSdkInstance().BlurElement()}setCssStyle(b,a){f.get(this).GetSdkInstance().SetElementCSSStyle(b,a)}}}"use strict";
{const f=self.C3,b=new WeakMap,a=new WeakMap;function d(e){let g=a.get(e);if(g)return g;g=f.New(f.Event.Dispatcher);a.set(e,g);return g}let c=null;self.IBehaviorInstance=class{constructor(){b.set(this,c);const e={runtime:{value:c.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:c.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,e)}static _Init(e){c=e}static _GetInitInst(){return c}get instance(){return b.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const e=
a.get(this);e&&(e.Release(),a.delete(this));b.delete(this)}addEventListener(e,g,k){d(this).addEventListener(e,g,k)}removeEventListener(e,g,k){d(this).removeEventListener(e,g,k)}dispatchEvent(e){d(this).dispatchEvent(e)}}}"use strict";{const f=new WeakMap;self.IBehavior=class{constructor(b){f.set(this,b);b={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,b)}getAllInstances(){return f.get(this).GetInstances().map(b=>b.GetInterfaceClass())}}}"use strict";
{const f=self.C3,b=new WeakMap;self.IEffectInstance=class{constructor(a,d){b.set(this,a);Object.defineProperties(this,{index:{value:d,writable:!1}})}get name(){return b.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return b.get(this).IsEffectIndexActive(this.index)}set isActive(a){a=!!a;const d=b.get(this);d.IsEffectIndexActive(this.index)!==a&&(d.SetEffectIndexActive(this.index,a),d.UpdateActiveEffects(),d.GetRuntime().UpdateRender())}setParameter(a,d){a=Math.floor(+a);const c=
b.get(this);var e=c.GetEffectParametersForIndex(this.index);if(0>a||a>=e.length)throw new RangeError("invalid effect parameter index");const g=e[a];if(g instanceof f.Color){if(!Array.isArray(d)||3>d.length)throw new TypeError("expected array with 3 elements");a=d[0];e=d[1];d=d[2];if(g.equalsRgb(a,e,d))return;g.setRgb(a,e,d)}else{if("number"!==typeof d)throw new TypeError("expected number");if(g===d)return;e[a]=d}c.IsEffectIndexActive(this.index)&&c.GetRuntime().UpdateRender()}getParameter(a){a=Math.floor(+a);
const d=b.get(this).GetEffectParametersForIndex(this.index);if(0>a||a>=d.length)throw new RangeError("invalid effect parameter index");a=d[a];return a instanceof f.Color?[a.getR(),a.getG(),a.getB()]:a}}}"use strict";
{const f=self.C3,b=new Set(["local","remote"]),a=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"],["html","text/html"]]);function d(e){if(!e)return"";e=e.split(".");if(2>e.length)return"";e=e[e.length-1].toLowerCase();return a.get(e)||""}function c(e){return new Promise((g,k)=>{const m=document.createElement("script");m.onload=g;m.onerror=k;m.async=!1;m.src=e;document.head.appendChild(m)})}
f.AssetManager=class extends f.DefendedBase{constructor(e,g){super();if(!b.has(g.defaultLoadPolicy))throw Error("invalid load policy");this._runtime=e;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._isCordova=!!g.isCordova;this._isiOSCordova=!!g.isiOSCordova;this._isFileProtocol="file:"===location.protocol;this._supportedAudioFormats=g.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=this._fontsSubfolder=this._mediaSubfolder="";this._defaultLoadPolicy=
g.defaultLoadPolicy;this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=!1;this._lastLoadProgress=this._assetSizeLoaded=this._totalAssetSizeToLoad=0;this._hasHadErrorLoading=!1;this._loadingRateLimiter=f.New(f.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new f.PromiseThrottle(Math.max(f.hardwareConcurrency,8));if(g.localUrlBlobs)for(const [k,m]of Object.entries(g.localUrlBlobs))this._localUrlBlobs.set(k.toLowerCase(),
m);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const e of this._localBlobUrlCache.values())URL.revokeObjectURL(e);this._localBlobUrlCache.clear();for(const e of this._allAssets)e.Release();f.clearArray(this._allAssets);this._assetsByUrl.clear();f.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(e){this._mediaSubfolder=e}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(e){this._fontsSubfolder=
e}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(e){this._iconsSubfolder=e}GetIconsSubfolder(){return this._iconsSubfolder}_HasLocalUrlBlob(e){return this._localUrlBlobs.has(e.toLowerCase())}_GetLocalUrlBlob(e){return this._localUrlBlobs.get(e.toLowerCase())||null}GetLocalUrlAsBlobUrl(e){const g=this._GetLocalUrlBlob(e);if(!g)return e;e=this._localBlobUrlCache.get(g);e||(e=URL.createObjectURL(g),this._localBlobUrlCache.set(g,e));return e}FetchBlob(e,g){g=g||this._defaultLoadPolicy;
const k=this._GetLocalUrlBlob(e);if(k)return Promise.resolve(k);if(f.IsRelativeURL(e)){const m=e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(m):"local"===g?this._promiseThrottle.Add(()=>f.FetchBlob(m)):f.FetchBlob(m)}return f.FetchBlob(e)}FetchArrayBuffer(e){const g=this._GetLocalUrlBlob(e);if(g)return f.BlobToArrayBuffer(g);if(f.IsRelativeURL(e)){const k=e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(k):
"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>f.FetchArrayBuffer(k)):f.FetchArrayBuffer(k)}return f.FetchArrayBuffer(e)}FetchText(e){const g=this._GetLocalUrlBlob(e);if(g)return f.BlobToString(g);if(f.IsRelativeURL(e)){const k=e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(k):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>f.FetchText(k)):f.FetchText(k)}return f.FetchText(e)}async FetchJson(e){e=await this.FetchText(e);
return JSON.parse(e)}_CordovaFetchLocalFileAs(e,g){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:e,as:g})}CordovaFetchLocalFileAsText(e){return this._CordovaFetchLocalFileAs(e,"text")}async CordovaFetchLocalFileAsBlob(e){const g=await this._CordovaFetchLocalFileAs(e,"buffer");e=d(e);return new Blob([g],{type:e})}async CordovaFetchLocalFileAsBlobURL(e){e=e.toLowerCase();var g=this._localBlobUrlCache.get(e);if(g)return g;g=await this.CordovaFetchLocalFileAsBlob(e);
g=URL.createObjectURL(g);this._localBlobUrlCache.set(e,g);return g}CordovaFetchLocalFileAsArrayBuffer(e){return this._CordovaFetchLocalFileAs(e,"buffer")}GetMediaFileUrl(e){return this._HasLocalUrlBlob(e)?this.GetLocalUrlAsBlobUrl(e):this._mediaSubfolder+e.toLowerCase()}GetProjectFileUrl(e,g=""){if(f.IsAbsoluteURL(e)){if(g)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(e)}return this._HasLocalUrlBlob(e)?Promise.resolve(this.GetLocalUrlAsBlobUrl(e)):this._isCordova&&
this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(g+e):Promise.resolve(g+e.toLowerCase())}LoadProjectFileUrl(e){return this.GetProjectFileUrl(e)}LoadImage(e){if(e.loadPolicy&&!b.has(e.loadPolicy))throw Error("invalid load policy");let g=this._assetsByUrl.get(e.url);if(g)return g;g=f.New(f.ImageAsset,this,{url:e.url,size:e.size||0,loadPolicy:e.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(g);this._assetsByUrl.set(g.GetURL(),g);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=
g.GetSize(),this._loadPromises.push(g.Load().then(()=>this._AddLoadedSize(g.GetSize()))));return g}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(e){console.error("Error loading: ",e),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(e){this._assetSizeLoaded+=e;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const e=
f.New(f.Event,"loadingprogress");this._lastLoadProgress=f.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);e.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(e)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(e){f.shallowAssignArray(this._webFonts,e);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"===typeof FontFace)return Promise.resolve();const e=[];for(const [g,k,m]of this._webFonts)this._totalAssetSizeToLoad+=
m,e.push(this._LoadWebFont(g,k).then(()=>this._AddLoadedSize(m)));return Promise.all(e)}async _LoadWebFont(e,g){try{const k=await this.GetProjectFileUrl(g,this._fontsSubfolder),m=new FontFace(e,`url('${k}')`);this._runtime.IsInWorker()?self.fonts.add(m):document.fonts.add(m);await m.load()}catch(k){console.warn(`[C3 runtime] Failed to load web font '${e}': `,k)}}IsAudioFormatSupported(e){return!!this._supportedAudioFormats[e]}_SetAudioFiles(e,g){this._preloadSounds=!!g;for(const [k,m,p]of e)this._audioFiles.set(k,
{fileName:k,formats:m.map(n=>({type:n[0],fileExtension:n[1],fullName:k+n[1],fileSize:n[2]})),isMusic:p})}GetPreferredAudioFile(e){e=this._audioFiles.get(e.toLowerCase());if(!e)return null;let g=null;for(const k of e.formats)if(g||"audio/webm; codecs=opus"!==k.type||(g=k),this.IsAudioFormatSupported(k.type))return k;return g}GetProjectAudioFileUrl(e){return(e=this.GetPreferredAudioFile(e))?{url:this.GetMediaFileUrl(e.fullName),type:e.type}:null}GetAudioToPreload(){if(this._preloadSounds){const e=[];
for(const g of this._audioFiles.values()){if(g.isMusic)continue;const k=this.GetPreferredAudioFile(g.fileName);k&&e.push({originalUrl:g.fileName,url:this.GetMediaFileUrl(k.fullName),type:k.type,fileSize:k.fileSize})}return e}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...e){e=await Promise.all(e.map(g=>this.GetProjectFileUrl(g)));this._runtime.IsInWorker()?importScripts(...e):await Promise.all(e.map(g=>c(g)))}async CompileWebAssembly(e){if(WebAssembly.compileStreaming)return e=
await this.GetProjectFileUrl(e),await WebAssembly.compileStreaming(fetch(e));e=await f.FetchArrayBuffer(e);return await WebAssembly.compile(e)}async LoadStyleSheet(e){e=await this.GetProjectFileUrl(e);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{url:e})}}}"use strict";
{const f=self.C3;f.Asset=class extends f.DefendedBase{constructor(b,a){super();this._assetManager=b;this._runtime=b.GetRuntime();this._url=a.url;this._size=a.size;this._loadPolicy=a.loadPolicy;this._blob=null;this._isLoaded=!1;this._loadPromise=null}Release(){this._blob=this._runtime=this._assetManager=this._loadPromise=null}GetURL(){return this._url}GetSize(){return this._size}Load(){return"local"===this._loadPolicy||this._blob?(this._isLoaded=!0,Promise.resolve()):this._loadPromise?this._loadPromise:
this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(b=>{this._isLoaded=!0;this._loadPromise=null;this._blob=b}).catch(b=>console.error("Error loading resource: ",b))}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._assetManager.FetchBlob(this._url,this._loadPolicy)}}}"use strict";
{const f=self.C3,b=new f.PromiseThrottle,a=new Set;f.ImageAsset=class extends f.Asset{constructor(d,c){super(d,c);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;a.add(this)}Release(){this.ReleaseTexture();if(0!==this._refCount)throw Error("released image asset which still has texture references");this._texturePromise=null;a.delete(this);super.Release()}static OnWebGLContextLost(){for(const d of a)d._texturePromise=null,d._webglTexture=null,d._refCount=
0}LoadStaticTexture(d,c){this._refCount++;return this._webglTexture?Promise.resolve(this._webglTexture):this._texturePromise?this._texturePromise:this._texturePromise=this.GetBlob().then(e=>b.Add(()=>d.CreateStaticTextureAsync(e,c).then(g=>{this._texturePromise=null;if(0===this._refCount)return d.DeleteTexture(g),null;this._webglTexture=g;this._imageWidth=g.GetWidth();this._imageHeight=g.GetHeight();return this._webglTexture}))).catch(e=>{console.error("Failed to load texture: ",e);throw e;})}ReleaseTexture(){if(0>=
this._refCount)throw Error("texture released too many times");this._refCount--;0===this._refCount&&this._webglTexture&&(this._webglTexture.GetRenderer().DeleteTexture(this._webglTexture),this._webglTexture=null)}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const d=await this.GetBlob();return f.Supports.ImageBitmapOptions?await createImageBitmap(d,{premultiplyAlpha:"none"}):f.Supports.ImageBitmap?await createImageBitmap(d):
await f.BlobToImage(d)}}}"use strict";
{const f=self.C3;function b(a,d){return a.GetWorldInfo()._GetLastCachedZIndex()-d.GetWorldInfo()._GetLastCachedZIndex()}f.RenderCell=class extends f.DefendedBase{constructor(a,d,c){super();this._grid=a;this._x=d;this._y=c;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){f.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){f.clearArray(this._instances);this._isSorted=!0;this._pendingRemoval.clear();this._isAnyPendingRemoval=
!1}SetChanged(){this._isSorted=!1}IsEmpty(){if(!this._instances.length)return!0;if(this._instances.length>this._pendingRemoval.size)return!1;this._FlushPending();return!0}Insert(a){this._pendingRemoval.has(a)?(this._pendingRemoval.delete(a),0===this._pendingRemoval.size&&(this._isAnyPendingRemoval=!1)):(this._instances.push(a),this._isSorted=1===this._instances.length)}Remove(a){this._pendingRemoval.add(a);this._isAnyPendingRemoval=!0;50<=this._pendingRemoval.size&&this._FlushPending()}_FlushPending(){this._isAnyPendingRemoval&&
(this._instances.length===this._pendingRemoval.size?this.Reset():(f.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1))}_EnsureSorted(){this._isSorted||(this._instances.sort(b),this._isSorted=!0)}Dump(a){this._FlushPending();this._EnsureSorted();this._instances.length&&a.push(this._instances)}}}"use strict";
{const f=self.C3;f.RenderGrid=class extends f.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=f.New(f.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,d){let c=this._cells.Get(b,a);return c?c:d?(c=f.New(f.RenderCell,this,b,a),this._cells.Set(b,a,c),c):null}XToCell(b){return Math.floor(b/this._cellWidth)}YToCell(b){return Math.floor(b/this._cellHeight)}Update(b,a,d){if(a)for(let c=a.getLeft(),e=a.getRight();c<=e;++c)for(let g=a.getTop(),k=
a.getBottom();g<=k;++g){if(d&&d.containsPoint(c,g))continue;const m=this.GetCell(c,g,!1);m&&(m.Remove(b),m.IsEmpty()&&this._cells.Delete(c,g))}if(d)for(let c=d.getLeft(),e=d.getRight();c<=e;++c)for(let g=d.getTop(),k=d.getBottom();g<=k;++g)a&&a.containsPoint(c,g)||this.GetCell(c,g,!0).Insert(b)}QueryRange(b,a){let d=this.XToCell(b.getLeft());const c=this.YToCell(b.getTop()),e=this.XToCell(b.getRight());for(b=this.YToCell(b.getBottom());d<=e;++d)for(let g=c;g<=b;++g){const k=this.GetCell(d,g,!1);k&&
k.Dump(a)}}MarkRangeChanged(b){let a=b.getLeft();const d=b.getTop(),c=b.getRight();for(b=b.getBottom();a<=c;++a)for(let e=d;e<=b;++e){const g=this.GetCell(a,e,!1);g&&g.SetChanged()}}}}"use strict";
{const f=self.C3,b=new f.Rect,a=new f.Quad,d=[],c=new f.Rect,e=new f.Rect,g=self.glMatrix.vec3,k=g.fromValues(0,1,0);function m(n,u){return n.GetWorldInfo()._GetLastCachedZIndex()-u.GetWorldInfo()._GetLastCachedZIndex()}function p(n,u){return n.GetWorldInfo().GetZElevation()-u.GetWorldInfo().GetZElevation()}f.Layer=class extends f.DefendedBase{constructor(n,u,q){super();this._layout=n;this._runtime=n.GetRuntime();this._name=q[0];this._index=u;this._sid=q[2];this._isVisible=!!q[3];this._backgroundColor=
f.New(f.Color);this._backgroundColor.setFromJSON(q[4].map(r=>r/255));this._isTransparent=!!q[5];this._parallaxX=q[6];this._parallaxY=q[7];this._color=f.New(f.Color,1,1,1,q[8]);this._premultipliedColor=f.New(f.Color);this._isForceOwnTexture=q[9];this._useRenderCells=q[10];this._scaleRate=q[11];this._blendMode=q[12];this._curRenderTarget=null;this._scale=1;this._zElevation=q[16];this._angle=0;this._isAngleEnabled=!0;this._viewport=f.New(f.Rect);this._viewportZ0=f.New(f.Rect);this._startupInitialInstances=
[];this._initialInstances=[];this._createdGlobalUids=[];this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;this._effectList=f.New(f.EffectList,this,q[15]);this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=f.New(f.Rect,0,0,-1,-1);this._curRenderCells=f.New(f.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this);this._UpdatePremultipliedColor();this._useRenderCells&&(this._renderGrid=f.New(f.RenderGrid,this._runtime.GetOriginalViewportWidth(),
this._runtime.GetOriginalViewportHeight()));for(const r of q[14])n=this._runtime.GetObjectClassByIndex(r[1]),this._layout._AddInitialObjectClass(n),n.GetDefaultInstanceData()||(n.SetDefaultInstanceData(r),n._SetDefaultLayerIndex(this._index)),this._initialInstances.push(r);f.shallowAssignArray(this._startupInitialInstances,this._initialInstances)}static Create(n,u,q){return f.New(f.Layer,n,u,q)}Release(){this._runtime=this._layout=null}CreateInitialInstances(n){const u=this._layout.IsFirstVisit();
let q=0;const r=this._initialInstances;for(let x=0,z=r.length;x<z;++x){var t=r[x];const D=this._runtime.GetObjectClassByIndex(t[1]);let G=!0;if(!D.HasPersistBehavior()||u)t=this._runtime.CreateInstanceFromData(t,this,!0),n.push(t),D.IsGlobal()&&(G=!1,this._createdGlobalUids.push(t.GetUID()));G&&(r[q]=r[x],++q)}f.truncateArray(r,q);this._runtime.FlushPendingInstances();this.SetZIndicesChanged()}_AddInstance(n,u){const q=n.GetWorldInfo();if(q.GetLayer()!==this)throw Error("instance added to wrong layer");
this._instances.push(n);0!==q.GetZElevation()&&(this._anyInstanceZElevated=!0);u&&this._useRenderCells&&n.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(n){this._instances.includes(n)||(this._instances.push(n),0!==n.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(n,u){const q=n.GetWorldInfo();if(q.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(n);0!==q.GetZElevation()&&
(this._anyInstanceZElevated=!0);this.SetZIndicesChanged();u&&this._useRenderCells&&n.GetWorldInfo().SetBboxChanged()}_RemoveInstance(n,u){const q=this._instances.indexOf(n);0>q||(u&&this._useRenderCells&&n.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(q,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(n){if(n){n=
new Set;for(var u of this._instances){var q=u.GetWorldInfo()._GetLastCachedZIndex();0<=q&&n.add(q)}u=-1;for(const r of this._instances)if(q=r.GetWorldInfo(),!(0<=q._GetLastCachedZIndex())){for(++u;n.has(u);)++u;q._SetZIndex(u)}}this._instances.sort(m)}_Start(){}_End(){for(const n of this._instances)n.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(n);this._runtime.FlushPendingInstances();f.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(n,
u,q,r){const t=this._runtime.GetEventSheetManager(),x=this._runtime.GetAllObjectClasses(),z=n.IsFamily(),D=[];for(const B of this._initialInstances){var G=B[0];if(u.containsPoint(G[0],G[1])){G=x[B[1]];if(G!==n)if(z){if(!n.FamilyHasMember(G))continue}else continue;G=this;var w=this._runtime.GetCurrentLayout();this.GetLayout()!==w&&((G=w.GetLayerByName(this.GetName()))||(G=w.GetLayerByIndex(this.GetIndex())));G=this._runtime.CreateInstanceFromData(B,G,!1);w=G.GetWorldInfo();w.OffsetXY(q,r);w.SetBboxChanged();
t.BlockFlushingInstances(!0);G._TriggerOnCreated();if(G.IsInContainer())for(const I of G.siblings())I._TriggerOnCreated();t.BlockFlushingInstances(!1);D.push(G)}}return D}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}UsesRenderCells(){return this._useRenderCells}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=
!1}IsVisible(){return this._isVisible}SetVisible(n){n=!!n;this._isVisible!==n&&(this._isVisible=n,this._runtime.UpdateRender())}GetViewport(){return this._viewport}GetViewportForZ(n,u){var q=this._viewportZ0;if(0===n)u.copy(q);else{const r=this.Get2DScaleFactorToZ(n);n=q.midX();const t=q.midY(),x=.5*q.width()/r;q=.5*q.height()/r;u.set(n-x,t-q,n+x,t+q)}}GetOpacity(){return this._color.getA()}SetOpacity(n){n=f.clamp(n,0,1);this._color.getA()!==n&&(this._color.setA(n),this._UpdatePremultipliedColor(),
this._runtime.UpdateRender())}_UpdatePremultipliedColor(){this._premultipliedColor.copy(this._color);this._premultipliedColor.premultiply()}GetPremultipliedColor(){return this._premultipliedColor}HasDefaultColor(){return this._color.equalsRgba(1,1,1,1)}GetScaleRate(){return this._scaleRate}SetScaleRate(n){this._scaleRate!==n&&(this._scaleRate=n,this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(n,u){if(this._parallaxX!==n||this._parallaxY!==
u)if(this._parallaxX=n,this._parallaxY=u,this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const q of this._instances)q.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(n){this.SetParallax(n,this.GetParallaxY())}SetParallaxY(n){this.SetParallax(this.GetParallaxX(),n)}SetZElevation(n){n=+n;this._zElevation!==n&&(this._zElevation=n,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(n){this._angle=f.clampAngle(n)}GetAngle(){return this._isAngleEnabled?
f.clampAngle(this._layout.GetAngle()+this._angle):0}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(n){this._isTransparent=!!n}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(n){this._isForceOwnTexture=!!n}SetBlendMode(n){this._blendMode!==n&&(this._blendMode=n,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}IsTransformCompatibleWith(n){return this===
n||this._parallaxX===n._parallaxX&&this._parallaxY===n._parallaxY&&this._scale===n._scale&&this._scaleRate===n._scaleRate&&this._angle===n._angle}_RemoveAllInstancesInSet(n){0!==n.size&&0<f.arrayRemoveAllInSet(this._instances,n)&&(this._MaybeResetAnyInstanceZElevatedFlag(),this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){this._instances.sort(p);if(this._useRenderCells)for(let n=0,u=this._instances.length;n<
u;++n){const q=this._instances[n].GetWorldInfo();q._SetZIndex(n);this._renderGrid.MarkRangeChanged(q.GetRenderCellRange())}else for(let n=0,u=this._instances.length;n<u;++n)this._instances[n].GetWorldInfo()._SetZIndex(n);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(n,u,q){var r=n.GetWorldInfo();u=u.GetWorldInfo();if(r.GetLayer()!==this||u.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");r=r.GetZIndex();u=u.GetZIndex();if(r===u+(q?1:-1))return!1;f.arrayRemove(this._instances,
r);r<u&&u--;q&&u++;u===this._instances.length?this._instances.push(n):this._instances.splice(u,0,n);this.SetZIndicesChanged();return!0}_MergeSortedZArrays(n,u){const q=[];let r=0,t=0,x=n.length,z=u.length;for(;r<x&&t<z;){const D=n[r],G=u[t];D.GetWorldInfo()._GetLastCachedZIndex()<G.GetWorldInfo()._GetLastCachedZIndex()?(q.push(D),++r):(q.push(G),++t)}for(;r<x;++r)q.push(n[r]);for(;t<z;++t)q.push(u[t]);return q}_MergeAllSortedZArrays_pass(n){const u=[],q=n.length;for(let r=0;r<q-1;r+=2)u.push(this._MergeSortedZArrays(n[r],
n[r+1]));1===q%2&&u.push(n[q-1]);return u}_MergeAllSortedZArrays(n){for(;1<n.length;)n=this._MergeAllSortedZArrays_pass(n);return n[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();f.clearArray(d);this._renderGrid.QueryRange(this._viewport,d);return d.length?1===d.length?d[0]:this._MergeAllSortedZArrays(d):[]}_IsOpaque(){return!this.UsesOwnTexture()&&!this.IsTransparent()}ShouldDraw(){return this.IsVisible()&&0<this.GetOpacity()&&(this.HasInstances()||!this.IsTransparent())}UsesOwnTexture(){return this.IsForceOwnTexture()||
!this.HasDefaultColor()||0!==this.GetBlendMode()||this._effectList.HasAnyActiveEffect()}GetRenderTarget(){return this._curRenderTarget}_CanFastPathDrawLayer(n){if(0===n.length)return!0;if(2<=n.length)return!1;n=n[0].GetShaderProgram();return!n.MustPreDraw()&&!n.UsesDest()&&!n.UsesCrossSampling()&&this.HasDefaultColor()}Get2DScaleFactorToZ(n){const u=this.GetCameraZ();return u/(u-n)}GetCameraZ(){return 100/this.GetNormalScale()}_SetTransform(n,u=0,q=0){const r=this._runtime.GetRenderScale();u=(this._viewport.midX()+
u)*r;q=(this._viewport.midY()+q)*r;const t=this.GetCameraZ();n.SetCameraXYZ(u,q,t);n.SetLookXYZ(u,q,t-100);u=this.GetAngle();0===u?g.set(k,0,1,0):g.set(k,Math.sin(u),Math.cos(u),0);n.ResetModelView(k);n.Scale(r,r);n.UpdateModelView()}Draw(n,u,q){const r=this._runtime.GetCanvasManager(),t=this.UsesOwnTexture();var x=null;let z=null;if(this._runtime.IsGPUProfiling()&&n.SupportsGPUProfiling()){const D=r.GetLayerTimingsBuffer(this);D&&(z=D.AddTimeElapsedQuery(),n.StartQuery(z))}t?(x={sampling:this._runtime.GetSampling()},
"low"===r.GetCurrentFullscreenScalingQuality()&&(x.width=r.GetDrawWidth(),x.height=r.GetDrawHeight()),x=this._runtime.GetAdditionalRenderTarget(x),n.SetRenderTarget(x),this.IsTransparent()&&n.ClearRgba(0,0,0,0)):n.SetRenderTarget(u);this.IsTransparent()||n.Clear(this._backgroundColor);this._curRenderTarget=x||u;this._SetTransform(n);n.SetBaseZ(this.GetZElevation());this.GetNormalScale()>Number.EPSILON&&(this._UpdateZIndices(),this._useRenderCells&&0===this.GetZElevation()&&!this._anyInstanceZElevated?
this._DrawInstances_RenderCells(n):this._DrawInstances(n,this._instances));n.SetBaseZ(0);n.SetCurrentZ(0);n.SetCameraXYZ(0,0,100);n.SetLookXYZ(0,0,0);t&&this._DrawLayerOwnTextureToRenderTarget(n,x,u,q);z&&n.EndQuery(z);this._curRenderTarget=null}_DrawInstances(n,u){const q=this._viewport,r=this._curRenderTarget;let t=null;for(let x=0,z=u.length;x<z;++x){const D=u[x];if(D===t)continue;t=D;const G=D.GetWorldInfo();G.IsVisible()&&G.IsInViewport(q)&&(G.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(D,
G,n,r):this._DrawInstance(D,G,n))}}_DrawInstances_RenderCells(n){var u=this._renderGrid;const q=this._curRenderCells,r=this._lastRenderCells,t=this._viewport;q.set(u.XToCell(t.getLeft()),u.YToCell(t.getTop()),u.XToCell(t.getRight()),u.YToCell(t.getBottom()));this._isRenderListUpToDate&&q.equals(r)?u=this._lastRenderList:(u=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,r.copy(q));this._DrawInstances(n,u);u!==this._lastRenderList&&f.shallowAssignArray(this._lastRenderList,u)}_DrawInstance(n,
u,q){u=u.GetRendererStateGroup();q.GetCurrentStateGroup()!==u&&u.Apply();n.Draw(q)}_DrawInstanceWithEffectsAndRestore(n,u,q,r){this._DrawInstanceWithEffects(n,u,q,r,null)&&this._SetTransform(q)}_DrawInstanceWithEffects(n,u,q,r,t){const x=u.GetInstanceEffectList().GetActiveEffectTypes();if(1===x.length){const z=x[0],D=z.GetShaderProgram();if(!D.NeedsPostDrawOrExtendsBox()&&u.HasDefaultColor()&&!n.MustPreDraw())return this._DrawInstanceWithEffects_FastPath(n,u,z,D,q),!1}n=f.RenderEffectChain(q,this._runtime,
n,r,x,t);q.SetBaseZ(this.GetZElevation());return n}_DrawInstanceWithEffects_FastPath(n,u,q,r,t){t.SetProgram(r);t.SetBlendMode(u.GetBlendMode());r.IsAnimated()&&this._runtime.UpdateRender();let x=0,z=0;if(r.UsesAnySrcRectOrPixelSize()){const [D,G]=n.GetCurrentSurfaceSize();x=1/D;z=1/G;(r=n.GetCurrentTexRect())?e.copy(r):e.set(0,0,0,0)}q=u.GetInstanceEffectList().GetEffectParametersForIndex(q.GetIndex());t.SetCurrentZ(u.GetZElevation());t.SetProgramParameters(null,c,e,e,u.GetBoundingBox(),x,z,this.GetOwnScale(),
this.GetAngle(),this._runtime.GetGameTime(),q);n.Draw(t)}_DrawLayerOwnTextureToRenderTarget(n,u,q,r){const t=this._effectList.GetActiveEffectTypes(),x=this._runtime;if(this._CanFastPathDrawLayer(t)){n.SetRenderTarget(q);if(1===t.length){var z=t[0];q=z.GetShaderProgram();n.SetProgram(q);e.set(0,0,1,1);z=this._effectList.GetEffectParametersForIndex(z.GetIndex());n.SetProgramParameters(null,c,e,e,this._viewport,1/x.GetDrawWidth(),1/x.GetDrawHeight(),this.GetNormalScale(),this.GetAngle(),x.GetGameTime(),
z);q.IsAnimated()&&x.UpdateRender()}else n.SetTextureFillMode();r&&0===this._blendMode&&this.HasDefaultColor()&&0===t.length?n.CopyRenderTarget(u):(n.SetBlendMode(this._blendMode),n.SetColor(this._premultipliedColor),n.DrawRenderTarget(u));n.InvalidateRenderTarget(u);x.ReleaseAdditionalRenderTarget(u)}else f.RenderEffectChain(n,x,this,q,t)}GetOwnScale(){return this._scale}SetOwnScale(n){this._scale!==n&&(this._scale=n,this._layout.BoundScrolling(),this._runtime.UpdateRender())}GetRenderScale(){return this.GetNormalScale()*
this._runtime.GetRenderScale()}GetDisplayScale(){return this.GetNormalScale()*this._runtime.GetDisplayScale()}GetNormalScale(){return(this._scale*this._layout.GetScale()-1)*this._scaleRate+1}UpdateViewport(){this._isAngleEnabled=!1;let [n,u]=this.CanvasCssToLayer(0,0);this._isAngleEnabled=!0;this._runtime.IsPixelRoundingEnabled()&&(n=Math.round(n),u=Math.round(u));var q=1/this.GetNormalScale();const r=this._viewportZ0;r.set(n,u,n+this._runtime.GetViewportWidth()*q,u+this._runtime.GetViewportHeight()*
q);q=this.GetAngle();0!==q&&(b.copy(r),b.offset(-r.midX(),-r.midY()),a.setFromRotatedRect(b,q),a.getBoundingBox(b),b.offset(r.midX(),r.midY()),r.copy(b));this.GetViewportForZ(this._zElevation,this._viewport)}CanvasCssToLayer(n,u,q=0){return this._CanvasToLayer(n,u,q,this.GetDisplayScale())}DrawSurfaceToLayer(n,u,q=0){return this._CanvasToLayer(n,u,q,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(n,u,q,r){var t=this._runtime.GetParallaxXOrigin(),x=this._runtime.GetParallaxYOrigin();
t=(this._layout.GetScrollX()-t)*this._parallaxX+t;x=(this._layout.GetScrollY()-x)*this._parallaxY+x;var z=this.GetNormalScale(),D=this._runtime.GetViewportWidth()/z;z=this._runtime.GetViewportHeight()/z;n=t-D/2+n/r;u=x-z/2+u/r;D=this.GetAngle();0!==D&&(n-=t,u-=x,r=Math.cos(D),D=Math.sin(D),z=n*r-u*D,u=u*r+n*D,n=z,n+=t,u+=x);0!==q&&(t=this._viewportZ0.midX(),x=this._viewportZ0.midY(),q=this.Get2DScaleFactorToZ(q),n=(n-t)/q+t,u=(u-x)/q+x);return[n,u]}CanvasCssToLayer_DefaultTransform(n,u){const q=this._scale,
r=this._scaleRate,t=this._parallaxX,x=this._parallaxY,z=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;n=this.CanvasCssToLayer(n,u);this._scale=q;this._scaleRate=r;this._parallaxX=t;this._parallaxY=x;this._angle=z;return n}LayerToCanvasCss(n,u,q=0){return this._LayerToCanvas(n,u,q,this.GetDisplayScale())}LayerToDrawSurface(n,u,q=0){return this._LayerToCanvas(n,u,q,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(n,u,q,r){var t=this._runtime,
x=this._layout;if(0!==q){var z=this._viewportZ0.midX(),D=this._viewportZ0.midY();q=this.Get2DScaleFactorToZ(q);n=(n-z)*q+z;u=(u-D)*q+D}z=t.GetParallaxXOrigin();D=t.GetParallaxYOrigin();z=(x.GetScrollX()-z)*this._parallaxX+z;x=(x.GetScrollY()-D)*this._parallaxY+D;q=this.GetAngle();if(0!==q){n-=z;u-=x;D=Math.cos(-q);q=Math.sin(-q);const G=n*D-u*q;u=u*D+n*q;n=G;n+=z;u+=x}q=this.GetNormalScale();D=t.GetViewportWidth()/q;t=t.GetViewportHeight()/q;return[(n-(z-D/2))*r,(u-(x-t/2))*r]}_GetLayerToDrawSurfaceScale(n,
u){n*=this.GetRenderScale()*this.GetDevicePixelRatio();0!==u&&(n*=this.Get2DScaleFactorToZ(u));return n}_SaveToJson(){return{s:this.GetOwnScale(),a:this.GetOwnAngle(),vl:this._viewport.getLeft(),vt:this._viewport.getTop(),vr:this._viewport.getRight(),vb:this._viewport.getBottom(),v:this.IsVisible(),bc:this._backgroundColor.toJSON(),t:this.IsTransparent(),px:this.GetParallaxX(),py:this.GetParallaxY(),c:this._color.toJSON(),sr:this.GetScaleRate(),fx:this._effectList.SaveToJson(),cg:this._createdGlobalUids}}_LoadFromJson(n){this._scale=
n.s;this._angle=n.a;this._viewport.set(n.vl,n.vt,n.vr,n.vb);this._isVisible=!!n.v;this._backgroundColor.setFromJSON(n.bc);this._isTransparent=!!n.t;this._parallaxX=n.px;this._parallaxY=n.py;this._color.setFromJSON(n.c);this._scaleRate=n.sr;f.shallowAssignArray(this._createdGlobalUids,n.cg);f.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const u=new Set(this._createdGlobalUids);let q=0;for(let r=0,t=this._initialInstances.length;r<t;++r)u.has(this._initialInstances[r][2])||
(this._initialInstances[q]=this._initialInstances[r],++q);f.truncateArray(this._initialInstances,q);this._effectList.LoadFromJson(n.fx);this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}}}"use strict";
{const f=self.C3,b=self.C3Debugger,a=f.New(f.Rect),d=f.New(f.Rect),c=f.New(f.Rect);f.Layout=class extends f.DefendedBase{constructor(e,g,k){super();this._layoutManager=e;this._runtime=e.GetRuntime();this._name=k[0];this._originalWidth=k[1];this._originalHeight=k[2];this._width=k[1];this._height=k[2];this._isUnboundedScrolling=!!k[3];this._eventSheetName=k[4];this._eventSheet=null;this._sid=k[5];this._index=g;this._scrollY=this._scrollX=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;
this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._initialNonWorld=[];this._layers=[];this._layersByName=new Map;this._layersBySid=new Map;this._effectList=f.New(f.EffectList,this,k[8]);this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=f.New(f.Event.Dispatcher);for(const m of k[6])e=f.Layer.Create(this,this._layers.length,m),this._layers.push(e),this._layersByName.set(e.GetName().toLowerCase(),
e),this._layersBySid.set(e.GetSID(),e);for(const m of k[7]){k=this._runtime.GetObjectClassByIndex(m[1]);if(!k)throw Error("missing nonworld object class");k.GetDefaultInstanceData()||k.SetDefaultInstanceData(m);this._initialNonWorld.push(m);this._AddInitialObjectClass(k)}}Release(){for(const e of this._layers)e.Release();f.clearArray(this._layers);this._textureLoadPendingPromises.clear();this._runtime=this._layoutManager=this._eventSheet=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetMinLayerScale(){let e=
this._layers[0].GetNormalScale();for(let g=1,k=this._layers.length;g<k;++g){const m=this._layers[g];if(0!==m.GetParallaxX()||0!==m.GetParallaxY())e=Math.min(e,m.GetNormalScale())}return e}SetScrollX(e){if(!this._isUnboundedScrolling){const g=this._runtime.GetViewportWidth()*(1/this.GetMinLayerScale())/2;e>this._width-g&&(e=this._width-g);e<g&&(e=g)}this._scrollX!==e&&(this._scrollX=e,this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(e){if(!this._isUnboundedScrolling){const g=
this._runtime.GetViewportHeight()*(1/this.GetMinLayerScale())/2;e>this._height-g&&(e=this._height-g);e<g&&(e=g)}this._scrollY!==e&&(this._scrollY=e,this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}BoundScrolling(){this.SetScrollX(this.GetScrollX());this.SetScrollY(this.GetScrollY())}GetScale(){return this._scale}SetScale(e){e=+e;this._scale!==e&&(this._scale=e,this.BoundScrolling())}SetAngle(e){this._angle=f.clampAngle(e)}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(e){!isFinite(e)||
1>e||(this._width=e)}GetHeight(){return this._height}SetHeight(e){!isFinite(e)||1>e||(this._height=e)}GetEventSheet(){return this._eventSheet}GetLayers(){return this._layers}GetLayerCount(){return this._layers.length}GetLayer(e){return"number"===typeof e?this.GetLayerByIndex(e):this.GetLayerByName(e.toString())}GetLayerByIndex(e){e=f.clamp(Math.floor(e),0,this._layers.length-1);return this._layers[e]}GetLayerByName(e){return this._layersByName.get(e.toLowerCase())||null}GetLayerBySID(e){return this._layersBySid.get(e)||
null}HasOpaqueBottomLayer(){for(const e of this._layers)if(e.ShouldDraw())return e._IsOpaque();return!1}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(e){if(e.IsInContainer())for(const g of e.GetContainer().GetObjectTypes())this._initialObjectClasses.add(g);else this._initialObjectClasses.add(e)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(e,g){if(e===this||!g)return Promise.resolve();e&&
(f.CopySet(this._textureLoadedTypes,e._textureLoadedTypes),e._textureLoadedTypes.clear());e=[];for(const k of this._initialObjectClasses)this._textureLoadedTypes.has(k)||(e.push(k.LoadTextures(g)),this._textureLoadedTypes.add(k));return Promise.all(e)}async MaybeLoadTexturesFor(e){if(e.IsFamily())throw Error("cannot load textures for family");var g=this._runtime.GetWebGLRenderer();!g||g.IsContextLost()||this._textureLoadedTypes.has(e)||(this._textureLoadedTypes.add(e),g=e.LoadTextures(g),this._AddPendingTextureLoadPromise(g),
await g,e.OnDynamicTextureLoadComplete(),this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(e){this._textureLoadPendingPromises.add(e);e.then(()=>this._textureLoadPendingPromises.delete(e)).catch(()=>this._textureLoadPendingPromises.delete(e))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(e){if(e.IsFamily()||0<e.GetInstanceCount())throw Error("cannot unload textures");const g=this._runtime.GetWebGLRenderer();g&&this._textureLoadedTypes.has(e)&&
(this._textureLoadedTypes.delete(e),e.ReleaseTextures(g))}_Unload(e,g){if(e!==this&&g)for(const k of this._textureLoadedTypes)k.IsGlobal()||e._initialObjectClasses.has(k)||(k.ReleaseTextures(),this._textureLoadedTypes.delete(k))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(e){const g=this._runtime,k=this._layoutManager,m=g.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=m.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());
k._SetMainRunningLayout(this);this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=g.GetOriginalViewportWidth()/2;this._scrollY=g.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(e);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();k.ClearPendingChangeLayout();
g.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);const p=this._runtime.GetCreatePromises();await Promise.all(p);f.clearArray(p);if(g.IsLoadingState())g._TriggerOnCreateAfterLoad(this._createdInstances);else for(const n of this._createdInstances)n._TriggerOnCreated(),n.SetupInitialSceneGraphConnections();f.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(n=>n.PreloadTexturesWithInstances(this._runtime.GetWebGLRenderer())));e&&(g.Dispatcher().dispatchEvent(new f.Event("beforefirstlayoutstart")),
await g.DispatchUserScriptEventAsyncWait(new f.Event("beforeprojectstart")));await this.DispatchUserScriptEventAsyncWait(new f.Event("beforelayoutstart"));g.IsLoadingState()||await g.TriggerAsync(f.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new f.Event("afterlayoutstart"));e&&(g.Dispatcher().dispatchEvent(new f.Event("afterfirstlayoutstart")),await g.DispatchUserScriptEventAsyncWait(new f.Event("afterprojectstart")));m._RunQueuedTriggers(k);await this.WaitForPendingTextureLoadsToComplete();
this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(e){for(const k of this._runtime.GetAllObjectClasses())if(!k.IsFamily()&&k.IsWorldType())for(const m of k.GetInstances()){const p=m.GetWorldInfo();var g=p.GetLayer();g=f.clamp(g.GetIndex(),0,this._layers.length-1);g=this._layers[g];p._SetLayer(g);g._MaybeAddInstance(m)}if(!e)for(const k of this._layers)k._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const e of this._layers)e.CreateInitialInstances(this._createdInstances),e.UpdateViewport(),
e._Start()}_CreatePersistedInstances(){let e=!1;for(const [k,m]of Object.entries(this._persistData)){const p=this._runtime.GetObjectClassBySID(parseInt(k,10));if(p&&!p.IsFamily()&&p.HasPersistBehavior()){for(const n of m){var g=null;if(p.IsWorldType()&&(g=this.GetLayerBySID(n.w.l),!g))continue;g=this._runtime.CreateInstanceFromData(p,g,!1,0,0,!0);g.LoadFromJson(n);e=!0;this._createdInstances.push(g)}f.clearArray(m)}}for(const k of this._layers)k._SortInstancesByLastCachedZIndex(!0),k.SetZIndicesChanged();
e&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(e){for(const k of e){if(!k.IsInContainer())continue;const m=k.GetWorldInfo(),p=k.GetIID();for(const n of k.GetObjectClass().GetContainer().objectTypes())if(n!==k.GetObjectClass()){var g=n.GetInstances();g.length>p?k._AddSibling(g[p]):(g=m?this._runtime.CreateInstanceFromData(n,m.GetLayer(),!0,m.GetX(),m.GetY(),!0):this._runtime.CreateInstanceFromData(n,null,!0,0,0,!0),this._runtime.FlushPendingInstances(),
n._UpdateIIDs(),k._AddSibling(g),e.push(g))}}}_CreateInitialNonWorldInstances(){for(const e of this._initialNonWorld)this._runtime.GetObjectClassByIndex(e[1]).IsInContainer()||this._runtime.CreateInstanceFromData(e,null,!0)}_CreateGlobalNonWorlds(){const e=[],g=this._initialNonWorld;let k=0;for(let m=0,p=g.length;m<p;++m){const n=g[m],u=this._runtime.GetObjectClassByIndex(n[1]);u.IsGlobal()?u.IsInContainer()&&u.GetContainer().HasAnyWorldType()||e.push(this._runtime.CreateInstanceFromData(n,null,!0)):
(g[k]=n,++k)}f.truncateArray(g,k);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(e)}RecreateInitialObjects(e,g,k,m,p){if(k)return k.RecreateInitialObjects(e,g,m,p);k=[];for(const n of this._layers)k.push(n.RecreateInitialObjects(e,g,m,p));return k.flat()}async _StopRunning(){const e=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(f.Plugins.System.Cnds.OnLayoutEnd,null,null);e.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();
this._isFirstVisit||this._SavePersistData();for(const g of this._layers)g._End();for(const g of this._runtime.GetAllObjectClasses())if(!(g.IsGlobal()||g.IsWorldType()||g.GetPlugin().IsSingleGlobal()||g.IsFamily())){for(const k of g.GetInstances())this._runtime.DestroyInstance(k);this._runtime.FlushPendingInstances()}e.SetIsEndingLayout(!1);e.GetMainRunningLayout()===this&&e._SetMainRunningLayout(null)}_SaveInstanceToPersist(e){const g=e.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(g)||
(this._persistData[g]=[]);this._persistData[g].push(e.SaveToJson())}_SavePersistData(){for(const e of this._layers){e._UpdateZIndices();for(const g of e._GetInstances()){const k=g.GetObjectClass();!k.IsGlobal()&&k.HasPersistBehavior()&&this._SaveInstanceToPersist(g)}}}ResetPersistData(){this._persistData={};this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){return"low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()||this._runtime.UsesAnyBackgroundBlending()||
"low-latency"===this._runtime.GetCompositingMode()||this._effectList.HasAnyActiveEffect()}_CanFastPathDrawLayout(e){return 0===e.length?!0:2<=e.length?!1:!e[0].GetShaderProgram().MustPreDraw()}Draw(e){var g=this._runtime.GetCanvasManager();const k=this.UsesOwnTexture();var m=null;k?("low-latency"!==this._runtime.GetCompositingMode()&&(e.SetRenderTarget(null),e.ClearRgba(0,0,0,0)),m={sampling:this._runtime.GetSampling(),readback:this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()},
"low"===g.GetCurrentFullscreenScalingQuality()&&(m.width=g.GetDrawWidth(),m.height=g.GetDrawHeight()),m=this._runtime.GetAdditionalRenderTarget(m),e.SetRenderTarget(m)):e.SetRenderTarget(null);this.HasOpaqueBottomLayer()||e.ClearRgba(0,0,0,0);this._curRenderTarget=m;g=!0;for(const p of this._layers)p.UpdateViewport(),p.ShouldDraw()&&(p.Draw(e,m,g),g=!1);k&&this._DrawLayoutOwnTextureToRenderTarget(e,m);this._curRenderTarget=null}_DrawLayoutOwnTextureToRenderTarget(e,g){const k=this._effectList.GetActiveEffectTypes(),
m=this._runtime;if(this._CanFastPathDrawLayout(k)){e.SetRenderTarget(null);if(1===k.length){var p=k[0];const n=p.GetShaderProgram();e.SetProgram(n);d.set(0,0,1,1);c.set(0,0,m.GetViewportWidth(),m.GetViewportHeight());p=this._effectList.GetEffectParametersForIndex(p.GetIndex());e.SetProgramParameters(null,a,d,d,c,1/m.GetDrawWidth(),1/m.GetDrawHeight(),this.GetScale(),this.GetAngle(),m.GetGameTime(),p);n.IsAnimated()&&m.UpdateRender()}else e.SetTextureFillMode();0===k.length?e.CopyRenderTarget(g):(e.SetAlphaBlend(),
e.ResetColor(),e.DrawRenderTarget(g));e.InvalidateRenderTarget(g);m.ReleaseAdditionalRenderTarget(g)}else f.RenderEffectChain(e,m,this,null,k)}_SaveToJson(){const e={sx:this.GetScrollX(),sy:this.GetScrollY(),s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(),layers:{}};for(const g of this._layers)e.layers[g.GetSID().toString()]=g._SaveToJson();return e}_LoadFromJson(e){this._scrollX=e.sx;this._scrollY=
e.sy;this._scale=e.s;this._angle=e.a;this._width=e.w;this._height=e.h;this._isFirstVisit=!!e.fv;this._persistData=e.persist;this._effectList.LoadFromJson(e.fx);for(const [g,k]of Object.entries(e.layers))e=parseInt(g,10),(e=this.GetLayerBySID(e))&&e._LoadFromJson(k)}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(e){e.layout=this.GetILayout();var g=this._runtime;(g=g.IsDebug()&&!g.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();
this._userScriptDispatcher.dispatchEvent(e);g&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(e){e.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(e)}}}"use strict";
{const f=self.C3;f.LayoutManager=class extends f.DefendedBase{constructor(b){super();this._runtime=b;this._allLayouts=[];this._layoutsByName=new Map;this._layoutsBySid=new Map;this._mainRunningLayout=null;this._runningSubLayouts=[];this._firstLayout=null;this._isEndingLayout=0;this._pendingChangeLayout=null}Release(){this._pendingChangeLayout=this._firstLayout=this._mainRunningLayout=this._runtime=null;f.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear();f.clearArray(this._runningSubLayouts)}Create(b){b=
f.New(f.Layout,this,this._allLayouts.length,b);this._allLayouts.push(b);this._layoutsByName.set(b.GetName().toLowerCase(),b);this._layoutsBySid.set(b.GetSID(),b)}GetRuntime(){return this._runtime}SetFirstLayout(b){this._firstLayout=b}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw Error("no first layout");}GetLayoutByName(b){return this._layoutsByName.get(b.toLowerCase())||null}GetLayoutBySID(b){return this._layoutsBySid.get(b)||
null}GetLayoutByIndex(b){b=f.clamp(Math.floor(b),0,this._allLayouts.length-1);return this._allLayouts[b]}GetLayout(b){return"number"===typeof b?this.GetLayoutByIndex(b):this.GetLayoutByName(b.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(b){this._mainRunningLayout=b}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(b){if(this._runningSubLayouts.includes(b))throw Error("layout already running");this._runningSubLayouts.push(b)}_RemoveRunningSubLayout(b){b=
this._runningSubLayouts.indexOf(b);if(-1===b)throw Error("layout not running");this._runningSubLayouts.splice(b,1)}*runningLayouts(){this._mainRunningLayout&&(yield this._mainRunningLayout);this._runningSubLayouts.length&&(yield*this._runningSubLayouts)}IsLayoutRunning(b){return this._mainRunningLayout===b||this._runningSubLayouts.includes(b)}SetIsEndingLayout(b){if(b)this._isEndingLayout++;else{if(0>=this._isEndingLayout)throw Error("already unset");this._isEndingLayout--}}IsEndingLayout(){return 0<
this._isEndingLayout}ChangeMainLayout(b){this._pendingChangeLayout=b}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}}}"use strict";
{const f=self.C3;class b{constructor(){this.runtime=this.renderer=null;this.surfaceHeight=this.surfaceWidth=this.drawHeight=this.drawWidth=0;this.layoutRect=new f.Rect;this.rcTexBounce=new f.Rect;this.rcTexDest=new f.Rect;this.rcTexOrigin=new f.Rect;this.screenRect=new f.Rect;this.clearRect=new f.Rect;this.srcRect=new f.Rect;this.fxTex=[null,null];this.fxIndex=0;this.otherFxIndex=1;this.layerAngle=this.layerScale=this.boxExtendVertical=this.boxExtendHorizontal=0;this.renderTarget=this.wi=this.inst=
this.layer=this.layout=null;this.didChangeTransform=this.postDraw=this.preDraw=!1;this.opts=null}Clear(){this.opts=this.renderTarget=this.wi=this.inst=this.layer=this.layout=this.runtime=this.renderer=null}ShouldPreDraw(t){t=t.GetShaderProgram();if(t.MustPreDraw())return!0;if(this.inst)return t.UsesDest()&&(0!==this.wi.GetAngle()||0>this.wi.GetWidth()||0>this.wi.GetHeight())||0!==this.boxExtendHorizontal||0!==this.boxExtendVertical||!this.wi.HasDefaultColor()||this.inst.MustPreDraw();if(this.layer)return!this.layer.HasDefaultColor()}ShouldPostDraw(t){t=
t.GetShaderProgram();return t.UsesDest()||t.UsesCrossSampling()||this.layout&&"low"===this.runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()}GetEffectRenderTarget(t){if(0!==t&&1!==t)throw Error("invalid effect target");const x=this.fxTex;if(!x[t]){var z=this.runtime;const D=z.GetCanvasManager();z={sampling:z.GetSampling()};"low"===D.GetCurrentFullscreenScalingQuality()&&(z.width=D.GetDrawWidth(),z.height=D.GetDrawHeight());x[t]=D.GetAdditionalRenderTarget(z)}return x[t]}ReleaseEffectRenderTargets(){const t=
this.fxTex,x=this.runtime.GetCanvasManager();t[0]&&(x.ReleaseAdditionalRenderTarget(t[0]),t[0]=null);t[1]&&(x.ReleaseAdditionalRenderTarget(t[1]),t[1]=null)}}const a=[];let d=0;function c(){d===a.length&&a.push(new b);return a[d++]}function e(t){t.ReleaseEffectRenderTargets();t.Clear();d--}const g=new f.Quad;let k=!1;async function m(t,x,z){x=await f.Gfx.WebGLRenderTarget.DebugReadPixelsToBlob(x,z);x=URL.createObjectURL(x);console.log("[FX] "+t+" "+(z?"":" [to display]")+": ",x)}f.RenderEffectChain=
function(t,x,z,D,G,w){const B=c();B.renderer=t;B.runtime=x;if(z instanceof f.Instance)B.inst=z,B.wi=B.inst.GetWorldInfo();else if(z instanceof f.Layer)B.layer=z;else if(z instanceof f.Layout)B.layout=z;else throw Error("invalid effects object");z=x.GetCanvasManager();B.renderTarget=D;B.drawWidth=z.GetDrawWidth();B.drawHeight=z.GetDrawHeight();B.surfaceWidth=B.drawWidth;B.surfaceHeight=B.drawHeight;B.fxIndex=0;B.otherFxIndex=1;B.boxExtendHorizontal=0;B.boxExtendVertical=0;B.screenRect.set(0,0,B.drawWidth,
B.drawHeight);B.clearRect.set(0,0,B.drawWidth,B.drawHeight);B.didChangeTransform=!1;B.opts=w;B.inst?(D=B.wi,B.layerScale=D.GetLayer().GetRenderScale(),B.layerAngle=D.GetLayer().GetAngle(),B.layoutRect.copy(D.GetBoundingBox())):B.layer?(D=B.layer,B.layerScale=D.GetRenderScale(),B.layerAngle=D.GetAngle(),B.layoutRect.copy(D.GetViewport())):(D=B.layout,B.layerScale=D.GetScale(),B.layerAngle=D.GetAngle(),B.layoutRect.set(0,0,B.drawWidth,B.drawHeight));B.inst?p(B,G):(B.rcTexBounce.set(0,0,B.drawWidth/
B.surfaceWidth,B.drawHeight/B.surfaceHeight),B.rcTexDest.copy(B.rcTexBounce),B.rcTexOrigin.copy(B.rcTexBounce),B.rcTexBounce.swapTopBottom(),B.rcTexDest.swapTopBottom(),B.rcTexOrigin.swapTopBottom());t.SetAlphaBlend();t.ResetColor();t.SetBaseZ(0);t.SetCurrentZ(0);B.preDraw=B.ShouldPreDraw(G[0]);B.preDraw&&n(B);t.ResetColor();D=G.length-1;B.postDraw=B.ShouldPostDraw(G[D]);for(let I=0,P=G.length;I<P;++I)w=G[I],z=w.GetShaderProgram(),t.SetProgram(z),z.IsAnimated()&&x.UpdateRender(),0!==I||B.preDraw?
(t.SetCopyBlend(),q(B,w,I===D&&!B.postDraw,I)):u(B,w),0===B.fxIndex?(B.fxIndex=1,B.otherFxIndex=0):(B.fxIndex=0,B.otherFxIndex=1);B.postDraw&&r(B,G);t=B.didChangeTransform;e(B);k=!1;return t};function p(t,x){for(let J=0,O=x.length;J<O;++J){var z=x[J].GetShaderProgram();t.boxExtendHorizontal+=z.GetBoxExtendHorizontal();t.boxExtendVertical+=z.GetBoxExtendVertical()}var D=t.wi;x=D.GetLayer();z=x.GetAngle();var G=D.GetBoundingBox();D=D.GetTotalZElevation();let [w,B]=x.LayerToDrawSurface(G.getLeft(),G.getTop(),
D),[I,P]=x.LayerToDrawSurface(G.getRight(),G.getBottom(),D);if(0!==z){const [J,O]=x.LayerToDrawSurface(G.getRight(),G.getTop(),D),[R,T]=x.LayerToDrawSurface(G.getLeft(),G.getBottom(),D);x=Math.min(w,I,J,R);I=Math.max(w,I,J,R);w=x;x=Math.min(B,P,O,T);P=Math.max(B,P,O,T);B=x}x=t.screenRect;z=t.rcTexOrigin;G=t.rcTexDest;D=t.clearRect;const E=t.rcTexBounce;x.set(w,B,I,P);x.shuntY(t.drawHeight);z.copy(x);z.divide(t.surfaceWidth,t.surfaceHeight);z.swapTopBottom();x.inflate(t.boxExtendHorizontal,t.boxExtendVertical);
G.copy(x);G.divide(t.surfaceWidth,t.surfaceHeight);G.swapTopBottom();D.copy(x);D.roundOuter();D.inflate(t.boxExtendHorizontal+1,t.boxExtendVertical+1);x.clamp(0,0,t.drawWidth,t.drawHeight);D.clamp(0,0,t.drawWidth,t.drawHeight);E.copy(x);E.divide(t.surfaceWidth,t.surfaceHeight);E.swapTopBottom()}function n(t){const x=t.renderer;x.SetTextureFillMode();const z=t.GetEffectRenderTarget(t.fxIndex);x.SetRenderTarget(z);var D=t.opts;D&&D.preTransform&&D.preTransform();x.ClearRect2(t.clearRect);t.inst?(x.SetColor(t.wi.GetPremultipliedColor()),
x.SetCurrentZ(t.wi.GetTotalZElevation()),t.inst.Draw(x),x.SetCurrentZ(0)):(D=(t.layer||t.layout).GetRenderTarget(),t.layer?x.SetColor(t.layer.GetPremultipliedColor()):x.ResetColor(),x.DrawRenderTarget(D),x.InvalidateRenderTarget(D),t.runtime.GetCanvasManager().ReleaseAdditionalRenderTarget(D));t.rcTexDest.clampFlipped(0,1,1,0);t.fxIndex=1;t.otherFxIndex=0;k&&m("Pre-draw",x,z)}function u(t,x){const z=t.renderer,D=t.runtime,G=t.GetEffectRenderTarget(t.fxIndex);z.SetRenderTarget(G);var w=t.opts;w&&w.preTransform&&
w.preTransform();z.ClearRect2(t.clearRect);if(t.inst){const [B,I]=t.inst.GetCurrentSurfaceSize();(w=t.inst.GetCurrentTexRect())?t.srcRect.copy(w):t.srcRect.set(0,0,0,0);x=t.wi.GetInstanceEffectList().GetEffectParametersForIndex(x.GetIndex());z.SetProgramParameters(t.renderTarget,t.rcTexDest,t.srcRect,t.srcRect,t.layoutRect,1/B,1/I,t.layerScale,t.layerAngle,D.GetGameTime(),x);z.SetCurrentZ(t.wi.GetTotalZElevation());t.inst.Draw(z);z.SetCurrentZ(0);t.rcTexDest.clampFlipped(0,1,1,0);t.screenRect.shuntY(t.drawHeight)}else x=
(t.layer||t.layout).GetEffectList().GetEffectParametersForIndex(x.GetIndex()),z.SetProgramParameters(t.renderTarget,t.rcTexDest,t.rcTexBounce,t.rcTexOrigin,t.layoutRect,1/t.drawWidth,1/t.drawHeight,t.layerScale,t.layerAngle,D.GetGameTime(),x),t=(t.layer||t.layout).GetRenderTarget(),k&&m("Layer target",z,t),z.DrawRenderTarget(t),z.InvalidateRenderTarget(t),D.GetCanvasManager().ReleaseAdditionalRenderTarget(t);k&&m("First bounce",z,G)}function q(t,x,z,D){const G=t.renderer,w=t.runtime;0===D&&t.preDraw&&
t.inst&&t.screenRect.shuntY(t.drawHeight);z?(t.inst?G.SetBlendMode(t.wi.GetBlendMode()):t.layer&&G.SetBlendMode(t.layer.GetBlendMode()),z=t.renderTarget,G.SetRenderTarget(z)):(z=t.GetEffectRenderTarget(t.fxIndex),G.SetRenderTarget(z),G.ClearRect2(t.clearRect));x=t.inst?t.wi.GetInstanceEffectList().GetEffectParametersForIndex(x.GetIndex()):(t.layer||t.layout).GetEffectList().GetEffectParametersForIndex(x.GetIndex());G.SetProgramParameters(t.renderTarget,t.rcTexDest,t.rcTexBounce,t.rcTexOrigin,t.layoutRect,
1/t.surfaceWidth,1/t.surfaceHeight,t.layerScale,t.layerAngle,w.GetGameTime(),x);x=t.GetEffectRenderTarget(t.otherFxIndex);G.SetTexture(x.GetTexture());w.GetCanvasManager().SetDeviceTransform(G);t.didChangeTransform=!0;g.setFromRect(t.screenRect);G.Quad3(g,t.rcTexBounce);t.inst||G.InvalidateRenderTarget(x);k&&m("Bounce "+D,G,z)}function r(t,x){x=t.renderer;if(t.layout)x.SetTextureFillMode(),x.SetRenderTarget(t.renderTarget),t=t.GetEffectRenderTarget(t.otherFxIndex),x.CopyRenderTarget(t),x.InvalidateRenderTarget(t);
else{var z=t.runtime.GetCanvasManager();"low"===z.GetCurrentFullscreenScalingQuality()?(x.SetTextureFillMode(),z.SetDeviceTransform(x,z.GetDrawWidth(),z.GetDrawHeight()),t.didChangeTransform=!0):x.SetDeviceTransformTextureFillMode();t.inst?x.SetBlendMode(t.wi.GetBlendMode()):t.layer&&x.SetBlendMode(t.layer.GetBlendMode());x.SetRenderTarget(t.renderTarget);z=t.GetEffectRenderTarget(t.otherFxIndex);x.SetTexture(z.GetTexture());g.setFromRect(t.screenRect);x.Quad3(g,t.rcTexBounce);t.inst||x.InvalidateRenderTarget(z);
k&&m("Post-draw",x,t.renderTarget)}}}"use strict";
{const f=self.C3,b=/<(.+?)>/g;f.TimelineManager=class extends f.DefendedBase{constructor(a){super();this._runtime=a;this._timelineDataManager=f.New(f.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._isTickingTimelines=this._changingLayout=this._hasRuntimeListeners=!1;this._tickFunc=()=>this._OnTick();this._tick2Func=
()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=d=>this._OnInstanceDestroy(d.instance);this._afterLoad=d=>this._OnAfterLoad();this._destroyedWhileLoadingState=[]}Release(){this.RemoveRuntimeListeners();this._afterLoad=this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const a of this._timelines)a.Stop(),a.Release();f.clearArray(this._timelines);
this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;f.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;f.clearArray(this._playingTimelines);this._playingTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._timelinesCreatedByTemplate=null;f.clearArray(this._destroyedWhileLoadingState);this._runtime=this._destroyedWhileLoadingState=
null}AddRuntimeListeners(){const a=this._runtime.Dispatcher();a.addEventListener("pretick",this._tickFunc);a.addEventListener("tick2",this._tick2Func);a.addEventListener("beforelayoutchange",this._beforeLayoutChange);a.addEventListener("layoutchange",this._layoutChange);a.addEventListener("instancedestroy",this._instanceDestroy);a.addEventListener("afterload",this._afterLoad)}RemoveRuntimeListeners(){const a=this._runtime.Dispatcher();a.removeEventListener("pretick",this._tickFunc);a.removeEventListener("tick2",
this._tick2Func);a.removeEventListener("beforelayoutchange",this._beforeLayoutChange);a.removeEventListener("layoutchange",this._layoutChange);a.removeEventListener("instancedestroy",this._instanceDestroy);a.removeEventListener("afterload",this._afterLoad)}Create(a){this._timelineDataManager.Add(a);a=f.TimelineState.CreateInitial(a,this);this.Add(a);this.SetTimelineObjectClassesToMap(a);this._timelinesCreatedByTemplate.set(a.GetName(),0)}CreateFromTemplate(a){var d=this.GetTimelineDataManager();a=
a.GetTemplateName();d=d.Get(a);d=f.TimelineState.CreateFromTemplate(`${a}:${this._timelinesCreatedByTemplate.get(a)}`,d,this);this._IncreaseTemplateTimelinesCount(a);this.Add(d);return d}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const d=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(d)}}_ClearCreatedTemplateTimelinesCount(){for(const a of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(a,
0)}Add(a){this._timelines.push(a);this._timelinesByName.set(a.GetName().toLowerCase(),a)}Remove(a){a.IsTemplate()||(f.arrayFindRemove(this._timelines,a),f.arrayFindRemove(this._scheduledTimelines,a),f.arrayFindRemove(this._playingTimelines,a),this._timelinesByName.delete(a.GetName().toLowerCase()),this.RemoveTimelineFromObjectClassMap(a),a.IsReleased()||a.Release())}Trigger(a){this._runtime.Trigger(a,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(a){this._pluginInstance=
a}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const a of this._timelines)yield a}SetTimelineObjectClassToMap(a,d){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set);this._objectClassToTimelineMap.get(a).add(d)}SetTimelineObjectClassesToMap(a){for(const d of a.GetObjectClasses())this.SetTimelineObjectClassToMap(d,a)}RemoveTimelineFromObjectClassMap(a){for(const [d,c]of this._objectClassToTimelineMap.entries())c.has(a)&&(c.delete(a),0===c.size&&
this._objectClassToTimelineMap.delete(d))}GetTimelinesForObjectClass(a){if(this._objectClassToTimelineMap.has(a))return this._objectClassToTimelineMap.get(a)}GetTimelineOfTemplateForInstances(a,d){if(d)for(const c of this._timelines)if(d.every(e=>c.HasTrackInstance(e.instance,e.trackId))&&c.GetName().includes(a.GetName()))return c}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const d of this._scheduledTimelines)if(d.GetName()===
a)return d;for(const d of this._playingTimelines)if(d.GetName()===a)return d;return null}*GetTimelinesByName(a){if(b.test(a)){b.lastIndex=0;let c;var d=new Set;do if(c=b.exec(a)){const e=c[1].split(",");for(const g of e)d.add(g)}while(c);for(const e of d.values())(a=this.GetTimelineByName(e))&&(yield a);d.clear()}else(d=this.GetTimelineByName(a))&&(yield d)}*GetTimelinesByTags(a){for(const d of this._timelines)d.HasTags(a)&&(yield d)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a);
this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){f.arrayFindRemove(this._playingTimelines,a);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(a){this._playingTimelines.includes(a)?(a.SetPlaying(!0),a.SetScheduled(!1),a.SetMarkedForRemoval(!1)):(a.SetPlaying(!1),a.SetScheduled(!0),a.SetMarkedForRemoval(!1),this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a));this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.ResolvePlayPromise();
f.arrayFindRemove(this._scheduledTimelines,a);this._MaybeDisableRuntimeListeners()}CompleteTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!0)}CompleteTimelineAndResolve(a){this.CompleteTimeline(a);a.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var a=!1;for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var d=this._scheduledTimelines.pop();d.SetInitialState();this._playingTimelines.push(d)}d=
this._runtime.GetDt();var c=this._runtime.GetTimeScale();for(const e of this._playingTimelines){if(e.IsMarkedForRemoval())continue;const g=e.Tick(d,c);!a&&g&&(a=!0)}this._isTickingTimelines=!1;a&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var a;for(const d of this._playingTimelines)d.IsMarkedForRemoval()&&(a||(a=new Set),this._MaybeExecuteTimelineFinishTriggers(d),a.add(d));a&&f.arrayRemoveAllInSet(this._playingTimelines,
a);this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(a){a.IsReleased()||a.HasValidTracks()&&a.IsComplete()&&a.InitialStateSet()&&a.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._playingTimelines.length||this._scheduledTimelines.length||this._isTickingTimelines||(this._hasRuntimeListeners=!1)}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop());
const a=new Set;for(const d of this._playingTimelines)d._OnBeforeChangeLayout()&&a.add(d);f.arrayRemoveAllInSet(this._playingTimelines,a);this._MaybeDisableRuntimeListeners();for(const d of this._timelines)d.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(a){var d=a.GetObjectClass();if(d=this.GetTimelinesForObjectClass(d))if(this._runtime.IsLoadingState())this._destroyedWhileLoadingState.push(a);else for(const c of d)c.IsTemplate()||(c.IsReleased()?this.Remove(c):c.HasValidTracks()||
(this._MaybeExecuteTimelineFinishTriggers(c),this.Remove(c)))}_OnAfterLoad(){for(const a of this._destroyedWhileLoadingState)this._OnInstanceDestroy(a);f.clearArray(this._destroyedWhileLoadingState)}_SaveToJson(){return{timelinesJson:this._SaveTimelinesToJson(),scheduledTimelinesJson:this._SaveScheduledTimelinesToJson(),playingTimelinesJson:this._SavePlayingTimelinesToJson(),hasRuntimeListeners:this._hasRuntimeListeners,changingLayout:this._changingLayout,isTickingTimelines:this._isTickingTimelines}}_LoadFromJson(a){a&&
(this._ClearCreatedTemplateTimelinesCount(),this._LoadTimelinesFromJson(a.timelinesJson),this._LoadScheduledTimelinesFromJson(a.scheduledTimelinesJson),this._LoadPlayingTimelinesFromJson(a.playingTimelinesJson),this._hasRuntimeListeners=!a.hasRuntimeListeners,this._changingLayout=!!a.changingLayout,this._isTickingTimelines=!!a.isTickingTimelines,this._SetCreatedTemplateTimelinesCount(),this._MaybeEnableRuntimeListeners(),this._MaybeDisableRuntimeListeners())}_SaveTimelinesToJson(){return this._timelines.map(a=>
a._SaveToJson())}_LoadTimelinesFromJson(a){for(const d of a){a=this.GetTimelineByName(d.name);if(!a){a=this._GetTemplateNameFromJson(d);if(!a)continue;a=this.GetTimelineByName(a);a=this.CreateFromTemplate(a)}a._LoadFromJson(d);a.HasTracks()||this.Remove(a)}}_GetTemplateNameFromJson(a){return(a=a.name.split(":"))&&2===a.length?a[0]:null}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(a){this._LoadTimelines(a,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(a){this._LoadTimelines(a,
this._playingTimelines)}_IsTimelineInJson(a,d){for(const c of d)if(c===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map(d=>d.GetName())}_LoadTimelines(a,d){var c=new Set;for(const e of d)this._IsTimelineInJson(e,a)||c.add(e);f.arrayRemoveAllInSet(d,c);c=e=>g=>g.GetName()===e;for(const e of a)(a=this.GetTimelineByName(e))&&(d.find(c(e))||d.push(a))}}}"use strict";
{const f=self.C3;f.TimelineState=class extends f.DefendedBase{constructor(b,a,d){super();this._runtime=d.GetRuntime();this._timelineManager=d;this._timelineDataItem=a;this._name=b;this._tracks=[];for(const c of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(f.TrackState.Create(this,c));this._playResolve=this._playPromise=null;this._playheadTime=f.New(f.KahanSum);this._playheadTime.Set(0);this._playbackRate=1;this._pingPongState=0;this._currentRepeatCount=1;this._initialStateSet=
this._isScheduled=this._isPlaying=!1;this._complete=!0;this._markedForRemoval=this._released=!1;this._completedTick=-1;this._firstTick=this._finishedTriggers=this._isTemplate=this._implicitPause=!1;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=!1}static CreateInitial(b,a){var d=a.GetTimelineDataManager();const c=d.GetNameId();d=d.Get(b[c]);b=f.New(f.TimelineState,b[c],d,a);b.SetIsTemplate(!0);return b}static CreateFromTemplate(b,a,d){return f.New(f.TimelineState,b,a,d)}static get WORLD_INSTANCE_BOX_CHANGE(){return 1}static get LAYOUT_RENDER_CHANGE(){return f.nextHighestPowerOfTwo(1)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this);
this._timelineManager.CompleteTimelineAndResolve(this);for(const b of this._tracks)b.Release();f.clearArray(this._tracks);this._tracks=null;this._playheadTime.Release();this._timelineDataItem=this._timelineManager=this._runtime=this._playheadTime=null;this._released=!0;this._playResolve=this._playPromise=null}}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(b,a,d){const c=[];for(const e of this._tracks){if(b!==
e.GetInstance())continue;const g=e.GetPropertyTrack(d);g&&a.constructor===g.GetSourceAdapter().constructor&&c.push(g)}return c}HasTracks(){return!!this._tracks.length}GetTrackById(b){for(const a of this._tracks)if(f.equalsNoCase(a.GetId(),b))return a;return null}SetName(b){this._name=b}GetName(){return this._name}GetTimelineDataItem(){return this._timelineDataItem}GetTemplateName(){return this._timelineDataItem.GetName()}GetTotalTime(){return this._timelineDataItem.GetTotalTime()}SetTotalTime(b){this._timelineDataItem.SetTotalTime(b)}GetStep(){return this._timelineDataItem.GetStep()}SetStep(b){this._timelineDataItem.SetStep(b)}GetInterpolationMode(){return this._timelineDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._timelineDataItem.SetInterpolationMode(b)}GetResultMode(){return this._timelineDataItem.GetResultMode()}SetResultMode(b){this._timelineDataItem.GetResultMode(b)}SetEase(b){for(const a of this.GetTracks())a.SetEase(b)}GetLoop(){return this._timelineDataItem.GetLoop()}SetLoop(b){return this._timelineDataItem.SetLoop(b)}GetPingPong(){return this._timelineDataItem.GetPingPong()}SetPingPong(b){return this._timelineDataItem.SetPingPong(b)}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(b){return this._playbackRate=
b}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return this.IsPlaying()?0<this._playbackRate:!0}GetPlayPromise(){return this._playPromise?this._playPromise:this._playPromise=new Promise(b=>{this._playResolve=b})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(b){this._tags=f.TimelineState._GetTagArray(b);this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){this._tagsChanged&&(this._stringTags=this._tags.join(" "));
this._tagsChanged=!1;return this._stringTags}HasTags(b){return this._tags&&this._tags.length?(b=f.TimelineState._GetTagArray(b))&&b.length?b.every(f.TimelineState._HasTag,this):!1:!1}OnStarted(){f.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnAnyTimelineStarted);
f.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,f.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnAnyTimelineFinished),
f.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(b){this._isPlaying=b}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(b=!1){return this.IsCompletedTick()||this.IsScheduled()&&!b?!0:this._isPlaying}_IsPlaying(){return this.IsPlaying(!0)}IsPaused(){return this._IsPaused()}_IsPaused(){return this.IsReleased()||this.IsScheduled()||this._IsPlaying()||this.IsComplete()?!1:!0}SetScheduled(b){this._isScheduled=b}IsScheduled(){return this._isScheduled}SetComplete(b){this._complete=
b;b=this.GetTime();if(0>=b||b>=this.GetTotalTime())this._complete=!0}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(b){this._markedForRemoval=b}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(b){this._implicitPause=b}IsImplicitPause(){return this._implicitPause}SetIsTemplate(b){this._isTemplate=!!b}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime.Get()}SetTime(b){const a=
this.GetTime();this._SetTime(b);this.SetComplete(!1);this.IsComplete()||this.SetImplicitPause(!0);if(this._IsPlaying()||this.IsScheduled()||!this._initialStateSet)this._IsPlaying()||this.IsScheduled()||this._initialStateSet?this._IsPlaying()?this.Stop():this.IsScheduled()&&(this._timelineManager.DeScheduleTimeline(this),this.SetInitialStateFromSetTime()):this.SetInitialStateFromSetTime();this._Interpolate(b,!1,!0,!0,a)&&this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(b){0>b?this._playheadTime.Set(0):
b>=this.GetTotalTime()?this._playheadTime.Set(this.GetTotalTime()):this._playheadTime.Set(b)}_OnSetTime(){f.Plugins.Timeline&&this.constructor===f.TimelineState&&(f.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSetByTags),f.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}_CanResume(){if(!this.GetLoop())if(this.GetPingPong()&&
1===this._pingPongState)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else{if(0>=this.GetTime())return!1}else if(!this.GetLoop()&&!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else if(0>=this.GetTime())return!1;return!0}Resume(){this.IsReleased()||this._CanResume()&&this.Play(!0)}Play(b=!1){return this.IsReleased()||this.IsScheduled()?!1:this._IsPlaying()&&this.IsCompletedTick()?this._SchedulePlayingTimeline():this._IsPlaying()||
!this.IsComplete()&&!b&&!this.IsImplicitPause()?!1:this._ScheduleStoppedTimeline()}_SchedulePlayingTimeline(){this.SetImplicitPause(!1);this._timelineManager.RemovePlayingTimeline(this);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}_ScheduleStoppedTimeline(){this.SetImplicitPause(!1);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}Stop(b=!1){this.IsReleased()||(this.SetComplete(b),this._timelineManager.CompleteTimeline(this),this.IsComplete()&&
this.ResolvePlayPromise())}Reset(b=!0,a=!1){if(!this.IsReleased()){if(!this._IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(!this.IsComplete()){this.Stop(!0);this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());var d=this.GetTime();a=a?this._InterpolateBeforeChangeLayout(d):this._Interpolate(d,!1,!1,!0);b&&this._OnSetTime();a&&b&&this.GetRuntime().UpdateRender()}}}ResetBeforeChangeLayout(){this.Reset(!1,!0)}_InterpolateBeforeChangeLayout(b){this._Interpolate(b,
!1,!1,!0,NaN,!1,!0)}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(this.HasValidGlobalTracks())return!1;this._timelineManager.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(b){if(!this.IsMarkedForRemoval())if(b){this._firstTick=this._initialStateSet=!0;for(const a of this._tracks)a.SetInitialState()}else if(this.SetPlaying(!0),this.SetScheduled(!1),this.OnStarted(),this.IsComplete()){this._completedTick=
-1;this._pingPongState=0;this._currentRepeatCount=1;this._finishedTriggers=this._complete=!1;this._firstTick=this._initialStateSet=!0;this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());for(const a of this._tracks)a.SetInitialState()}else{this._firstTick=!0;for(const a of this._tracks)a.SetResumeState()}}Tick(b,a){if(0!==b||0!==this._lastDelta){this._lastDelta=b;var d=this.GetTime();this._SetTime(d+b*a*this._playbackRate);var c;this.GetLoop()||this.GetPingPong()?this.GetLoop()&&
!this.GetPingPong()?c=this._LoopCompleteCheck():!this.GetLoop()&&this.GetPingPong()?c=this._PingPongCompleteCheck():this.GetLoop()&&this.GetPingPong()&&(c=this._LoopPingPongCompleteCheck()):c=this._SimpleCompleteCheck();if(c){for(const e of this._tracks)e.SetEndState();this.Stop(!0);this.OnCompleted();return!0}return this._Interpolate(this.GetTime(),!0,!1,!1,d,!0)}}_Interpolate(b,a=!1,d=!1,c=!1,e=NaN,g=!1,k=!1){let m=!1;for(var p of this._tracks)p.BeforeInterpolate();for(const n of this._tracks){p=
b;if("number"===typeof e){const u=this.GetTime()-n.GetStartOffset(),q=e-n.GetStartOffset();0>u&&0<q&&(p=n.GetStartOffset(),this._SetTime(p))}p=n.Interpolate(p,a,d,c,this._firstTick,k);!m&&p&&(m=!0)}for(const n of this._tracks)n.AfterInterpolate();this._firstTick&&g&&(this._firstTick=!1);return m}_SimpleCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(0);else return this._SetTime(this.GetTotalTime()),
!0}else if(0>=this.GetTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(this.GetTotalTime());else return this._SetTime(0),!0;return!1}_LoopCompleteCheck(){this.IsForwardPlayBack()?this.GetTime()>=this.GetTotalTime()&&this._SetTime(0):0>=this.GetTime()&&this._SetTime(this.GetTotalTime());return!1}_PingPongCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate()),
1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1)}else if(0>=this.GetTime())if(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1);return!1}_LoopPingPongCompleteCheck(){this.IsForwardPlayBack()?
this.GetTime()>=this.GetTotalTime()&&(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this.GetTime()&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()));return!1}AddTrack(){var b=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();b=f.TrackState.Create(this,b);this._tracks.push(b);return b}CleanCaches(){for(const b of this._tracks)b.CleanCaches()}ClearTrackInstances(){for(const b of this._tracks)b.ClearInstance()}SetTrackInstance(b,
a){if(a)for(const d of this._tracks){if(b){if(d.GetId()!==b)continue}else if(d.HasInstance())continue;d.SetInstance(a);this._timelineManager.SetTimelineObjectClassToMap(a.GetObjectClass(),this);break}}HasTrackInstance(b,a){for(const d of this._tracks)if(a){if(a===d.GetId()&&b===d.GetInstance())return!0}else if(b===d.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some(b=>b.CanInstanceBeValid())}HasValidGlobalTracks(){return this._tracks.some(b=>b.CanInstanceBeValid()?(b=b.GetObjectClass())?
b.IsGlobal():!1:!1)}GetPropertyTrack(b){for(const a of this.GetTracks())for(const d of a.GetPropertyTracks())if(d.GetPropertyName()===b)return d}GetKeyframeWithTags(b){b=b?b.split(" "):[];b=[...(new Set(b.map(a=>a.toLowerCase().trim()))).values()];for(const a of this.GetTracks())for(const d of a.GetKeyframeDataItems())if(b.every(c=>d.HasTag(c)))return d}GetObjectClasses(){const b=[];for(const a of this.GetTracks())b.push(a.GetObjectClass());return b.filter(a=>a)}_SaveToJson(){return{tracksJson:this._SaveTracksToJson(),
name:this._name,playheadTime:this.GetTime(),playbackRate:this._playbackRate,pingPongState:this._pingPongState,currentRepeatCount:this._currentRepeatCount,isPlaying:this._isPlaying,isScheduled:this._isScheduled,initialStateSet:this._initialStateSet,finishedTriggers:this._finishedTriggers,complete:this._complete,released:this._released,markedForRemoval:this._markedForRemoval,completedTick:this._completedTick,implicitPause:this._implicitPause,isTemplate:this._isTemplate,tags:this._tags.join(" "),stringTags:this._stringTags,
tagsChanged:this._tagsChanged,firstTick:this._firstTick}}_LoadFromJson(b){b&&(this._LoadTracksFromJson(b.tracksJson),this._name=b.name,this._playheadTime.Set(b.playheadTime),this._playbackRate=b.playbackRate,this._pingPongState=b.pingPongState,this._currentRepeatCount=b.currentRepeatCount,this._isPlaying=!!b.isPlaying,this._isScheduled=!!b.isScheduled,this._initialStateSet=!!b.initialStateSet,this._finishedTriggers=b.hasOwnProperty("finishedTriggers")?!!b.finishedTriggers:!1,this._complete=!!b.complete,
this._released=!!b.released,this._markedForRemoval=!!b.markedForRemoval,this._completedTick=b.completedTick,this._implicitPause=!!b.implicitPause,this._isTemplate=!!b.isTemplate,this._tags=b.tags.split(" "),this._stringTags=b.stringTags,this._tagsChanged=!!b.tagsChanged,this._firstTick=!!b.firstTick)}_SaveTracksToJson(){return this._tracks.map(b=>b._SaveToJson())}_LoadTracksFromJson(b){b.forEach((a,d)=>{this._tracks[d]._LoadFromJson(a)});this._tracks.filter(a=>a.CanInstanceBeValid())}static _HasTag(b){const a=
this.GetTags();return""===b?1===a.length&&""===a[0]:a.includes(b)}static _GetTagArray(b){if(f.IsArray(b))return b.slice(0);if(f.IsString(b))return b.split(" ")}}}"use strict";
{const f=self.C3;f.TrackState=class extends f.DefendedBase{constructor(b,a){super();this._timeline=b;this._trackDataItem=a;this._trackData=a.GetTrackData();this._objectClassIndex=this._instanceUid=NaN;this._worldInfo=this._instance=null;this._isNested=0<a.GetStartOffset();this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();this._propertyTracks=[];for(const d of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(f.PropertyTrackState.Create(this,
d))}static Create(b,a){return f.New(f.TrackState,b,a)}Release(){this._keyframeDataItems=null;for(const b of this._propertyTracks)b.Release();f.clearArray(this._propertyTracks);this._lastKeyframeDataItem=this._trackDataItem=this._worldInfo=this._instance=this._timeline=this._propertyTracks=null}CleanCaches(){for(const b of this._propertyTracks)b.CleanCaches();this._worldInfo=this._instance=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){return this._keyframeDataItems?
this._keyframeDataItems:this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(b){for(const a of this._propertyTracks)if(a.GetPropertyName()===b)return a}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){var b=this.GetInstanceUID();return(b=this.GetRuntime().GetInstanceByUID(b))?!b.IsDestroyed():!1}GetObjectClass(){const b=
this.GetObjectClassIndex();if(-1!==b)return this.GetRuntime().GetObjectClassByIndex(b)}ClearInstance(){this._instance=null;this._instanceUid=-1;this._worldInfo=null;this._objectClassIndex=-1}HasInstance(){return!!this._instance}GetInstance(){if(this._instance&&this.IsInstanceValid())return this._instance;const b=this.GetInstanceUID();return this._instance=this.GetRuntime().GetInstanceByUID(b)}SetInstance(b){if(this._instance!==b){this.CleanCaches();this._instance=b;this._objectClassIndex=b.GetObjectClass().GetIndex();
this._instanceUid=b.GetUID();this._worldInfo=b.GetWorldInfo();for(const g of this.propertyTrackItems()){const k=g.sourceAdapter;switch(g.propertyTrack.GetSourceAdapterId()){case "instance-variable":k.GetEditorIndex();var a=b.GetObjectClass(),d=a.GetInstanceVariableIndexByName(g.name),c=a.GetInstanceVariableName(d);a=a.GetInstanceVariableType(d);c===g.name&&a===g.type&&k.UpdateInstanceVariableIndex(d);break;case "behavior":var e=g.behaviorType;d=this.GetObjectClass();c=b.GetObjectClass();a=k.GetBehaviorType(c);
e&&a&&(e=e.GetName(),d.GetBehaviorIndexByName(e),c.GetBehaviorIndexByName(e),k.GetEditorIndex(),k.UpdateBehaviorTypeSid(a.GetSID()))}}}}*propertyTrackItems(){for(const d of this._propertyTracks){var b=d.GetSourceAdapter(),a=this.GetObjectClass();const c={propertyTrack:d,sourceAdapter:b};switch(d.GetSourceAdapterId()){case "world-instance":c.property=d.GetPropertyName();break;case "instance-variable":b=b.GetEditorIndex();c.name=a.GetInstanceVariableName(b);c.type=a.GetInstanceVariableType(b);break;
case "effect":a=a.GetEffectList();b=b.GetEffectType(a);c.effectType=b;break;case "behavior":b=b.GetBehaviorType(a);c.behaviorType=b;break;case "plugin":c.plugin=a.GetPlugin()}yield c}}GetWorldInfo(){if(this._worldInfo&&this.IsInstanceValid())return this._worldInfo;const b=this.GetInstance();b&&(this._worldInfo=b.GetWorldInfo());return this._worldInfo}GetTrackDataItem(){return this._trackDataItem}GetInstanceUID(){return this._instanceUid?this._instanceUid:this._trackDataItem.GetInstanceUID()}SetInstanceUID(b){this._trackDataItem.SetInstanceUID(b)}GetInterpolationMode(){return this._trackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._trackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._trackDataItem.GetResultMode()}GetId(){return this._trackDataItem.GetId()}GetStartOffset(){return this._trackDataItem.GetStartOffset()}GetLocalTotalTime(){return this._trackDataItem.GetLocalTotalTime()}SetResultMode(b){this._trackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetKeyframeDataItems())a.SetEase(b);
for(const a of this.GetPropertyTracks())a.SetEase(b)}GetEnable(){return this._trackDataItem.GetEnable()}SetEnable(b){this._trackDataItem.SetEnable(b)}GetObjectClassIndex(){return isNaN(this._objectClassIndex)?this._trackDataItem.GetObjectClassIndex():this._objectClassIndex}SetObjectClassIndex(b){this._trackDataItem.SetObjectClassIndex(b)}SetOriginalWidth(b){this._trackDataItem.SetOriginalWidth(b)}GetOriginalWidth(){return this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(b){this._trackDataItem.SetOriginalHeight(b)}GetOriginalHeight(){return this._trackDataItem.GetOriginalHeight()}SetInitialState(){this.MaybeGetInstance();
if(this.IsInstanceValid()){for(var b of this._propertyTracks)b.SetInitialState();b=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(b);this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(b)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()){this._timeline.IsForwardPlayBack();var b=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(b);
for(const a of this._propertyTracks)a.SetResumeState()}}SetEndState(){if(!this.GetTimeline().IsComplete()&&(this.MaybeGetInstance(),this.IsInstanceValid()&&!this._isNested)){const b=this._timeline.GetTime(),a=this.GetStartOffset()+this.GetLocalTotalTime();b>=a?this.Interpolate(this.GetLocalTotalTime(),!0,!1,!0):0>=b&&this.Interpolate(0,!0,!1,!0)}}BeforeInterpolate(){for(const b of this._propertyTracks)b.BeforeInterpolate()}Interpolate(b,a=!1,d=!1,c=!1,e=!1,g=!1){this.MaybeGetInstance();if(!this.IsInstanceValid()||
g&&this.GetObjectClass().IsGlobal())return!1;b-=this.GetStartOffset();if(0>b)return!1;this.MaybeSetInitialStateOfNestedTrack(b,a);this.MaybeTriggerKeyframeReachedConditions(b,a,e);e=g=!1;for(const k of this._propertyTracks){const m=k.Interpolate(b,d,!1,c);g||0===(m&f.TimelineState.WORLD_INSTANCE_BOX_CHANGE)||(g=!0);e||0===(m&f.TimelineState.LAYOUT_RENDER_CHANGE)||(e=!0)}this.MaybeSetEndStateOfNestedTrack(b,a);g&&(b=this.GetWorldInfo())&&b.SetBboxChanged();return e}AfterInterpolate(){for(const b of this._propertyTracks)b.AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(b,
a){if(a&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>b)return;for(const d of this._propertyTracks)d.Interpolate(0,!1,!1,!0)}else{if(b>this.GetLocalTotalTime())return;for(const d of this._propertyTracks)d.Interpolate(this.GetLocalTotalTime(),!1,!1,!0)}for(const d of this._propertyTracks)d.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(b>=
this.GetLocalTotalTime()){for(const d of this._propertyTracks)d.Interpolate(this.GetLocalTotalTime(),!1,!1,!0);this._endStateOfNestedSet=!0}}else if(0>=b){for(const d of this._propertyTracks)d.Interpolate(0,!1,!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(b,a,d){if(!d&&a)return b=this.GetLastKeyFrameBeforeTime(b),b!==this._lastKeyframeDataItem&&this.OnKeyframeReached(b),this._lastKeyframeDataItem=b}GetLastKeyFrameBeforeTime(b){const a=this.GetTimeline();let d=this._trackData.GetKeyFrameDataItemAtTime(b,
this._trackDataItem);return d?d:a.IsForwardPlayBack()?this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem):this._trackData.GetFirstKeyFrameDataItemHigherOrEqualThan(b,this._trackDataItem)}OnKeyframeReached(b){if(f.Plugins.Timeline&&this.GetTimeline().constructor===f.TimelineState){var a=this.GetTimeline();f.Plugins.Timeline.Cnds.SetTriggerTimeline(a);f.Plugins.Timeline.Cnds.SetTriggerKeyframe(b);b=a.GetTimelineManager();b.Trigger(f.Plugins.Timeline.Cnds.OnAnyKeyframeReached);
b.Trigger(f.Plugins.Timeline.Cnds.OnKeyframeReached);f.Plugins.Timeline.Cnds.SetTriggerTimeline(null);f.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var b=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=f.PropertyTrackState.Create(this,b);this._propertyTracks.push(b);return b}DeleteKeyframes(b){this._trackDataItem.GetKeyframeData().DeleteKeyframeDataItems(b)}DeletePropertyKeyframes(b){for(const a of this._propertyTracks)a.DeletePropertyKeyframes(b)}SaveState(){for(const b of this._propertyTracks)b.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();
if(this.IsInstanceValid())for(const b of this._propertyTracks)b.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();if(this.IsInstanceValid()){var b=!1;for(const a of this._propertyTracks){const d=a.CompareSaveStateWithCurrent();!b&&d&&(b=!0)}b&&(b=this.AddKeyframe(),b.SetTime(this.GetTimeline().GetTime()),b.SetEase("noease"),b.SetEnable(!0),b.SetTags(""))}}_SaveToJson(){var b=this.GetInstance();b=b?b.GetUID():this.GetInstanceUID();return{propertyTracksJson:this._SavePropertyTracksToJson(),
lastKeyframeDataItemJson:this._SaveLastKeyframeDataItemToJson(),initialStateOfNestedSet:this._initialStateOfNestedSet,endStateOfNestedSet:this._endStateOfNestedSet,instanceUid:b}}_LoadFromJson(b){b&&(this._LoadPropertyTracksFromJson(b.propertyTracksJson),this._LoadLastKeyframeDataItemFromJson(b.lastKeyframeDataItemJson),this._LoadInstanceFromJson(b.instanceUid),this._initialStateOfNestedSet=!1,b.hasOwnProperty.initialStateOfNestedSet&&(this._initialStateOfNestedSet=b.initialStateOfNestedSet),this._endStateOfNestedSet=
!1,b.hasOwnProperty.endStateOfNestedSet&&(this._endStateOfNestedSet=b.endStateOfNestedSet))}_SaveLastKeyframeDataItemToJson(){return this._trackDataItem.GetKeyframeData().GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(b=>b._SaveToJson())}_LoadPropertyTracksFromJson(b){b.forEach((a,d)=>{this._propertyTracks[d]._LoadFromJson(a)})}_LoadInstanceFromJson(b){if(f.IsFiniteNumber(b)&&(b=this.GetRuntime().GetInstanceByUID(b))){var a=this.GetTimeline();
a.ClearTrackInstances();a.SetTrackInstance(this._trackDataItem.GetId(),b)}}_LoadLastKeyframeDataItemFromJson(b){this._lastKeyframeDataItem=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemFromIndex(b)}}}"use strict";
{const f=self.C3;f.PropertyTrackState=class extends f.DefendedBase{constructor(b,a){super();this._track=b;this._propertyTrackDataItem=a;this._propertyTrackData=a.GetPropertyTrackData();this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}static Create(b,a){return f.New(f.PropertyTrackState,b,a)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=
null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;let b;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":b=
new f.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":b=new f.PropertyTrackState.EffectSourceAdapter(this);break;case "instance-variable":b=new f.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":b=new f.PropertyTrackState.PluginSourceAdapter(this);break;case "world-instance":b=new f.PropertyTrackState.WorldInstanceSourceAdapter(this);break;case "value":b=new f.PropertyTrackState.ValueSourceAdapter(this)}return this._sourceAdapter=b}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(b){this._propertyTrackDataItem.SetSourceAdapterId(b)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(b){this._propertyTrackDataItem.SetSourceAdapterArguments(b)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(b){this._propertyTrackDataItem.SetProperty(b)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(b){this._propertyTrackDataItem.SetType(b)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(b){this._propertyTrackDataItem.SetMin(b)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(b){this._propertyTrackDataItem.SetMax(b)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(b){this._propertyTrackDataItem.SetEnable(b)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._propertyTrackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(b){this._propertyTrackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetPropertyKeyframeDataItems())a.SetEase(b)}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems?
this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const b of this.GetPropertyKeyframeDataItems())yield b.GetValueWithResultMode()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(){this.GetSourceAdapter().SetInitialState()}SetResumeState(){this.GetSourceAdapter().SetResumeState()}BeforeInterpolate(){this.GetSourceAdapter().BeforeInterpolate()}Interpolate(b,
a=!1,d=!1,c=!1){var e=this._propertyTrackDataItem;let g=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(b,e);g?e=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(b,e):(g=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,e),e=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,e));return this.GetSourceAdapter().Interpolate(b,g,e,a,d,c)}AfterInterpolate(){this.GetSourceAdapter().AfterInterpolate()}static GetStartPropertyKeyframeForTime(b,
a){const d=a.GetPropertyTrackDataItem();a=a._propertyTrackData;let c=a.GetPropertyKeyFrameDataItemAtTime(b,d);c||(c=a.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,d));return c}static GetEndPropertyKeyframeForTime(b,a){const d=a.GetPropertyTrackDataItem();a=a._propertyTrackData;return a.GetPropertyKeyFrameDataItemAtTime(b,d)?a.GetFirstPropertyKeyFrameDataItemHigherThan(b,d):a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,d)}AddPropertyKeyframe(){return this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem()}DeletePropertyKeyframes(b){this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){if(this.GetSourceAdapter().CompareInitialStateWithCurrent()){const b=
this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),a=this.GetSourceAdapter().GetCurrentState();b.SetAbsoluteValue(a)}}CompareSaveStateWithCurrent(){const b=this.GetSourceAdapter().CompareSaveStateWithCurrent();b&&this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return b}AddPropertyKeyframeAtCurrentTime(){const b=this.GetTimeline().GetTime(),a=this.GetSourceAdapter(),d=f.PropertyTrackState.GetStartPropertyKeyframeForTime(b,this),c=
this.AddPropertyKeyframe();c.SetType(d.GetType());c.SetTime(b);c.SetEase(d.GetEase());c.SetEnable(!0);c.SetValue(a.GetValueAtTime());c.SetAbsoluteValue(a.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson)}}}"use strict";
{const f=self.C3.PropertyTrackState;f.PropertySourceAdapter=class{constructor(b){this._propertyTrack=b;this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}GetPropertyTrack(){return this._propertyTrack}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter?this._propertyAdapter:this._propertyAdapter=this._CreatePropertyAdapter()}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this.GetPropertyAdapter().BeforeChangeProperty()}Interpolate(b,
a,d,c,e,g){const k=f.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack)(b,a,d,this._propertyTrack);return e?k:this.GetPropertyAdapter().ChangeProperty(b,k,a,d,c,g)}AfterInterpolate(){this.GetPropertyAdapter().AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){return f.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_CreatePropertyAdapter(){const b=
this._propertyTrack.GetPropertyType();switch(this._propertyTrack.GetPropertyKeyframeType()){case "combo":case "boolean":case "text":case "string":return new f.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===b?new f.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new f.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new f.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(b){b&&
this.GetPropertyAdapter()._LoadFromJson(b.propertyAdapterJson)}static GetValueAtTime(b){const a=b.GetTrack().GetTimeline().GetTime(),d=f.GetStartPropertyKeyframeForTime(a,b),c=f.GetEndPropertyKeyframeForTime(a,b);return f.PropertySourceAdapter.GetInterpolateFunc(b)(a,d,c,b)}static GetValue(b,a,d){let c=b.GetResultMode();"combo"===b.GetPropertyType()&&(c="absolute");switch(c){case "relative":return a+d;case "absolute":return d}}static GetInterpolateFunc(b){switch(b.GetPropertyKeyframeType()){case "numeric":return f.NumericTypeAdapter.Interpolate;
case "angle":return f.AngleTypeAdapter.Interpolate;case "boolean":return f.BooleanTypeAdapter.Interpolate;case "color":return f.ColorTypeAdapter.Interpolate;case "text":return f.TextTypeAdapter.Interpolate}}static GetWillChangeFunc(b){switch(b.GetPropertyKeyframeType()){case "numeric":return f.NumericTypeAdapter.WillChange;case "angle":return f.AngleTypeAdapter.WillChange;case "boolean":return f.BooleanTypeAdapter.WillChange;case "color":return f.ColorTypeAdapter.WillChange;case "text":return f.TextTypeAdapter.WillChange}}}}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}}f.PropertyTrackState.WorldInstanceSourceAdapter=b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetIndex(){return this._updatedIndex?this._updatedIndex:super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._updatedIndex=a)}Interpolate(a,
d,c,e,g,k){if(this.GetPropertyAdapter().CanChange(d.GetValue()))return super.Interpolate(a,d,c,e,g,k)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a.index)}}f.PropertyTrackState.InstanceVariableSourceAdapter=b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var a=this._propertyTrack.GetPropertyTrackDataItem(),d=this._propertyTrack.GetTrack();a=this._sid?this._sid:a.GetSourceAdapterArguments()[0];d=d.GetInstance();a=d.GetBehaviorIndexBySID(a);return d.GetBehaviorInstances()[a].GetSdkInstance()}GetBehaviorType(a){const d=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];
return a.GetBehaviorTypeByName(d)}UpdateBehaviorTypeSid(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._sid=a)}Interpolate(a,d,c,e,g,k){const m=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(m.GetObjectClass()))return super.Interpolate(a,d,c,e,g,k)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._sid=a.sid)}}f.PropertyTrackState.BehaviorSourceAdapter=b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var d=a.GetEffectList();d=this.GetEffectType(d).GetIndex();return a.IsEffectIndexActive(d)?a.GetEffectParametersForIndex(d):null}GetEffectType(a){const d=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];
return a.GetEffectTypeByName(d)}Interpolate(a,d,c,e,g,k){if(this._IsEffectActive())return super.Interpolate(a,d,c,e,g,k)}_IsEffectActive(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var d=a.GetEffectList();if(d=this.GetEffectType(d))return d=d.GetIndex(),a.IsEffectIndexActive(d)}}f.PropertyTrackState.EffectSourceAdapter=b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(a,d,c,e,g,k){var m=this._propertyTrack.GetTrack();const p=m.GetObjectClass().GetPlugin();m=m.GetInstance().GetObjectClass().GetPlugin();if(p===m)return super.Interpolate(a,d,c,e,g,k)}}f.PropertyTrackState.PluginSourceAdapter=
b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._value=0;this._init=!1}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let d=this._propertyTrack.GetPropertyTrackDataItem();d=a.GetFirstPropertyKeyframeDataItem(d);this._value=d.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(a,d,c,e,g,k){e=f.PropertyTrackState.NumericTypeAdapter.Interpolate;this._value=
e(a,d,c,this._propertyTrack);this._init=!0}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{value:this._value,init:this._init}}_LoadFromJson(a){a&&(this._value=a.value,this._init=a.hasOwnProperty("init")?a.init:!0)}}f.PropertyTrackState.ValueSourceAdapter=b}"use strict";
self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(f){this._sourceAdapter=f;this._propertyTrack=f.GetPropertyTrack();this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo();this._property=this._propertyTrack.GetPropertyName();this._firstAbsoluteUpdate=!1;this._target=this._saveState=null}Release(){this._target=this._saveState=this._worldInfo=this._propertyTrack=this._sourceAdapter=null}CleanCaches(){this._target=this._saveState=this._worldInfo=null}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo?
this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(f){this._firstAbsoluteUpdate=!!f}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(f){return typeof this._Getter()===typeof f}BeforeChangeProperty(){}ChangeProperty(f,b,
a,d,c){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const f=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(f)},()=>{const f=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const f=this._propertyTrack.GetTimeline().GetTime()-this._propertyTrack.GetTrack().GetStartOffset();
return this._PickTimelinePlaybackMode(()=>{const b=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(f,b)},()=>{const b=this._propertyTrack.GetPropertyTrackDataItem(),a=this._propertyTrack.GetPropertyTrackData(),d=a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(f,b);return d?d:a.GetLastPropertyKeyframeDataItem(b)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(f,b){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?
f():b()}_PickResultMode(f,b){return"relative"===this._propertyTrack.GetResultMode()?f():b()}_PickFirstAbsoluteUpdate(f,b){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),f()):b()}_GetAbsoluteInitialValue(f){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(f,b,a,d,c){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return f();case "effect":return b();case "instance-variable":return a();
case "plugin":return d();case "world-instance":return c()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(f){f&&(this._firstAbsoluteUpdate=f.firstAbsoluteUpdate,this._saveState=f.saveState)}_GetPropertyKeyframeStubs(f,b=!1){const a=[];for(const d of f){f=d.GetTrack().GetStartOffset();for(const c of d.GetPropertyKeyframeDataItems())b&&0===c.GetTime()?a.push({time:f+c.GetTime(),value:c.GetAbsoluteValue()}):b||a.push({time:f+c.GetTime(),value:c.GetAbsoluteValue()})}return a.sort((d,
c)=>d.time-c.time)}_GetLastPropertyKeyframeStub(f,b,a){return this._GetPropertyKeyframeStubLowerThanPlayhead(b,a)}_GetPropertyKeyframeStubLowerThanPlayhead(f,b){for(let a=b.length-1;0<=a;a--)if(b[a].time<=f)return b[a];return null}};"use strict";
{const f=self.C3,b=new Map,a=[0,0,0];class d extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const c=this._propertyTrack.GetSourceAdapterId(),e=this._GetTarget(),g=this._GetIndex();switch(c){case "behavior":return this._ToColorArray(e.GetPropertyValueByIndex(g));case "effect":return this._ToColorArray(e[g]);case "plugin":return this._ToColorArray(e.GetPropertyValueByIndex(g));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const c=
this._FirstKeyframeGetter();return!this._CompareColors(c,this._Getter())}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(c,e){return c.equalsIgnoringAlpha(e)}_FirstKeyframeGetter(){const c=super._FirstKeyframeGetter();return this._GetColorFromArray(c)}_CurrentKeyframeGetter(){const c=super._CurrentKeyframeGetter();return this._GetColorFromArray(c)}_GetAbsoluteInitialValue(c){}_ToColorArray(c){return f.IsInstanceOf(c,
f.Color)?c.toArray().slice(0,3):c.slice(0,3)}_GetColorFromArray(c){return f.IsInstanceOf(c,f.Color)?c:new f.Color(c[0],c[1],c[2],1)}CanChange(c){return!0}BeforeChangeProperty(){var c=this._propertyTrack.GetInstance();b.has(c)||b.set(c,new Map);c=b.get(c);const e=this._propertyTrack.GetSourceAdapterId();c.has(e)||c.set(e,new Map);c=c.get(e);c.has(this._property)||c.set(this._property,{used:!1,color:new f.Color(0,0,0,1)})}_GetTmpColor(c,e,g){c=b.get(c).get(e).get(g);c.used=!0;return c.color}ChangeProperty(c,
e,g,k,m){m=this._propertyTrack.GetTimeline();k=this._propertyTrack.GetTrack();c=this._propertyTrack.GetInstance();var p=this._propertyTrack.GetSourceAdapter();g=this._propertyTrack.GetSourceAdapterId();p=m.GetSimilarPropertyTracks(c,p,this._property);if(1<p.length){if(p=this._GetPropertyKeyframeStubs(p,!0),m=this._GetLastPropertyKeyframeStub(m,m.GetTime(),p))if(k=k.GetStartOffset(),p=m.time-k,0===p)this._GetTmpColor(c,g,this._property).addRgb(e[0],e[1],e[2]);else{if(0>p)return;m=e[0];k=e[1];e=e[2];
p=this._propertyTrack.Interpolate(p,!1,!0);m=f.Color.DiffChannel(m,p[0]);k=f.Color.DiffChannel(k,p[1]);e=f.Color.DiffChannel(e,p[2]);this._GetTmpColor(c,g,this._property).addRgb(m,k,e)}}else this._Setter(e[0],e[1],e[2]);return f.TimelineState.LAYOUT_RENDER_CHANGE}AfterChangeProperty(){const c=this._propertyTrack.GetInstance();if(b.has(c)){var e=b.get(c),g=this._propertyTrack.GetSourceAdapterId();if(e.has(g)){var k=e.get(g);if(k.has(this._property)){var m=k.get(this._property),p=m.color;m.used&&this._Setter(p.getR(),
p.getG(),p.getB());0===k.size&&e.delete(g);0===e.size&&b.delete(c)}}}}_Getter(){const c=this._propertyTrack.GetSourceAdapterId(),e=this._GetTarget(),g=this._GetIndex();switch(c){case "behavior":return this._GetColorFromArray(e.GetPropertyValueByIndex(g));case "effect":return e[g].clone();case "plugin":return this._GetColorFromArray(e.GetPropertyValueByIndex(g));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(c,e,g){const k=this._propertyTrack.GetSourceAdapterId(),
m=this._GetTarget(),p=this._GetIndex();switch(k){case "behavior":a[0]=c;a[1]=e;a[2]=g;m.SetPropertyValueByIndex(p,a);break;case "effect":m[p].setRgb(c,e,g);break;case "plugin":a[0]=c;a[1]=e;a[2]=g;m.SetPropertyValueByIndex(p,a);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(c,e,g)}}_SaveToJson(){}_LoadFromJson(c){}}f.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=d}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(a){super(a)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}ChangeProperty(a,d,c,e,g){c=f.PropertyTrackState.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);
var k=this._propertyTrack;const m=k.GetTrack();e=k.GetSourceAdapterId();g=k.GetTimeline();var p=m.GetInstance();k=k.GetSourceAdapter();p=g.GetSimilarPropertyTracks(p,k,this._property);1<p.length&&(p=this._GetPropertyKeyframeStubs(p),a+=m.GetStartOffset(),a=this._GetLastPropertyKeyframeStub(g,a,p))&&(d=a.value);if(c(this._GetIndex(),this._GetTarget(),d,e))switch(this._Setter(d),e){case "plugin":return f.TimelineState.LAYOUT_RENDER_CHANGE}}_Getter(){const a=this._propertyTrack.GetSourceAdapterId(),
d=this._GetTarget(),c=this._GetIndex();switch(a){case "behavior":return d.GetPropertyValueByIndex(c);case "effect":return d[c];case "instance-variable":return d.GetInstanceVariableValue(c);case "plugin":return d.GetPropertyValueByIndex(c)}}_Setter(a){const d=this._propertyTrack.GetSourceAdapterId(),c=this._GetTarget(),e=this._GetIndex();switch(d){case "behavior":c.SetPropertyValueByIndex(e,a);break;case "effect":c[e]=a;break;case "instance-variable":c.SetInstanceVariableValue(e,a);break;case "plugin":c.SetPropertyValueByIndex(e,
a)}}}f.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=b}"use strict";
{const f=self.C3,b=new Map,a=(c,e,g,k,m)=>b.set(c,{setter:e,absolute_setter:g,getter:k,round:m});a("offsetX",(c,e)=>c.OffsetX(e),(c,e)=>c.SetX(e),c=>c.GetX(),!0);a("offsetY",(c,e)=>c.OffsetY(e),(c,e)=>c.SetY(e),c=>c.GetY(),!0);a("offsetWidth",(c,e)=>c.OffsetWidth(e),(c,e)=>c.SetWidth(e),c=>c.GetWidth(),!0);a("offsetHeight",(c,e)=>c.OffsetHeight(e),(c,e)=>c.SetHeight(e),c=>c.GetHeight(),!0);a("offsetAngle",(c,e)=>c.OffsetAngle(e),(c,e)=>c.SetAngle(e),c=>c.GetAngle(),!1);a("offsetOpacity",(c,e)=>c.OffsetOpacity(e),
(c,e)=>c.SetOpacity(e),c=>c.GetOpacity(),!1);a("offsetOriginX",(c,e)=>c.OffsetOriginX(e),(c,e)=>c.SetOriginX(e),c=>c.GetOriginX(),!1);a("offsetOriginY",(c,e)=>c.OffsetOriginY(e),(c,e)=>c.SetOriginY(e),c=>c.GetOriginY(),!1);a("offsetZElevation",(c,e)=>c.OffsetZElevation(e),(c,e)=>c.SetZElevation(e),c=>c.GetZElevation(),!0);a("offsetScaleX",(c,e,g)=>{c.OffsetWidth(g.GetOriginalWidth()*e)},(c,e,g)=>{c.SetWidth(g.GetOriginalWidth()*e)},(c,e)=>c.GetWidth()/e.GetOriginalWidth(),!1);a("offsetScaleY",(c,
e,g)=>{c.OffsetHeight(g.GetOriginalHeight()*e)},(c,e,g)=>{c.SetHeight(g.GetOriginalHeight()*e)},(c,e)=>c.GetHeight()/e.GetOriginalHeight(),!1);class d extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c);this._lastValue=0;this._instance_absolute_setter=this._instance_setter=this._instance_getter=null;this._round=!1;f.IsInstanceOf(this._propertyTrack.GetTimeline(),f.Tween)?this._typeAdapter=new f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):
this._typeAdapter=new f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);c=this._propertyTrack.GetPropertyName();"world-instance"===this._propertyTrack.GetSourceAdapterId()&&(c=b.get(c),this._instance_getter=c.getter,this._instance_setter=c.setter,this._instance_absolute_setter=c.absolute_setter,this._round=c.round)}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}GetLastValue(){return this._lastValue}SetLastValue(c){this._lastValue=
c}SetInitialState(){const c=this._typeAdapter.SetInitialState();"number"===typeof c&&(this._lastValue=c)}SetResumeState(){const c=this._typeAdapter.SetResumeState();"number"===typeof c&&(this._lastValue=c)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(c,
e,g,k,m,p){return this._typeAdapter.ChangeProperty(c,e,g,k,m,p)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const c=this._GetTarget(),e=this._GetIndex(),g=this._propertyTrack.GetTrack(),k=this.GetWorldInfo();return this._PickSource(()=>c.GetPropertyValueByIndex(e),()=>c[e],()=>c.GetInstanceVariableValue(e),()=>c.GetPropertyValueByIndex(e),()=>this._instance_getter(k,g))}_Setter(c,e,g){const k=this._GetTarget(),m=this._GetIndex(),p=this._propertyTrack.GetTrack(),n=this.GetWorldInfo();
this._PickSource(()=>k.OffsetPropertyValueByIndex(m,c),()=>k[m]+=c,()=>k.SetInstanceVariableOffset(m,c),()=>k.OffsetPropertyValueByIndex(m,c),()=>this._instance_setter(n,c,p))}_SetterAbsolute(c,e,g){const k=this._GetTarget(),m=this._GetIndex(),p=this._propertyTrack.GetTrack(),n=this.GetWorldInfo();this._PickSource(()=>k.SetPropertyValueByIndex(m,c),()=>k[m]=c,()=>k.SetInstanceVariableValue(m,c),()=>k.SetPropertyValueByIndex(m,c),()=>this._instance_absolute_setter(n,c,p))}_MaybeEnsureValue(c,e,g,k,
m,p){this._typeAdapter._MaybeEnsureValue(c,e,g,k,m,p)}_AddDelta(c,e,g){var k=(c.toString().split(".")[1]||"").length;c=this._Getter();k=0===k?this._round?Math.round(c):c:f.toFixed(c,k);this._Setter(k-c,e,g)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._lastValue=c.v)}}f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=d}"use strict";
{const f=self.C3,b=new Map;class a{constructor(d){this._numericInterpolationAdapter=d}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack();return d._PickResultMode(()=>d._PickTimelinePlaybackMode(()=>0,()=>f.PropertyTrackState.PropertySourceAdapter.GetValueAtTime(c)),()=>{})}SetResumeState(){}BeforeChangeProperty(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),
e=c.GetPropertyName();d._PickResultMode(()=>{},()=>{var g=c.GetInstance();b.has(g)||b.set(g,new Map);g=b.get(g);const k=c.GetSourceAdapterId();g.has(k)||g.set(k,new Map);g=g.get(k);g.has(e)||g.set(e,{used:!1,value:0})})}_GetTmpAbsoluteValueObject(d,c,e){d=b.get(d).get(c).get(e);d.used=!0;return d}ChangeProperty(d,c,e,g,k,m){const p=this._numericInterpolationAdapter,n=this._numericInterpolationAdapter.GetPropertyTrack(),u=n.GetPropertyName();p._PickResultMode(()=>{const q=p.GetLastValue();p._Setter(c-
q,e,g);m&&this._MaybeEnsureValue(d,e,g,k,q,c);p.SetLastValue(c)},()=>{var q=n.GetTimeline(),r=n.GetTrack();const t=n.GetInstance();var x=n.GetSourceAdapter();const z=n.GetSourceAdapterId();x=q.GetSimilarPropertyTracks(t,x,u);if(1<x.length){if(x=p._GetPropertyKeyframeStubs(x,!0),q=p._GetLastPropertyKeyframeStub(q,q.GetTime(),x))r=r.GetStartOffset(),r=q.time-r,0===r?this._GetTmpAbsoluteValueObject(t,z,u).value+=c:0>r||(r=n.Interpolate(r,!1,!0),this._GetTmpAbsoluteValueObject(t,z,u).value+=c-r)}else p._SetterAbsolute(c)});
return p._PickSource(()=>{},()=>f.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>f.TimelineState.LAYOUT_RENDER_CHANGE,()=>f.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){const d=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),e=c.GetPropertyName();d._PickResultMode(()=>{},()=>{const g=c.GetInstance();if(b.has(g)){var k=b.get(g),m=c.GetSourceAdapterId();if(k.has(m)){var p=k.get(m);if(p.has(e)){var n=p.get(e),u=n.value;n.used&&d._SetterAbsolute(u);
p.delete(e);0===p.size&&k.delete(m);0===k.size&&b.delete(g)}}}})}_MaybeEnsureValue(d,c,e,g,k,m){const p=this._numericInterpolationAdapter;g||(c&&d===c.GetTime()?p._AddDelta(c.GetValueWithResultMode(),c,e):e&&d===e.GetTime()?p._AddDelta(e.GetValueWithResultMode(),c,e):0===m-k&&p._AddDelta(c.GetValueWithResultMode(),c,e))}}f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=a}"use strict";
{const f=self.C3;new Map;class b{constructor(a){this._numericInterpolationAdapter=a}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const a=this._numericInterpolationAdapter;a.SetFirstAbsoluteUpdate(!0);return this._GetAbsoluteInitialValue(a._FirstKeyframeGetter())}SetResumeState(){const a=this._numericInterpolationAdapter;if(a._FirstKeyframeGetter()!==a._CurrentKeyframeGetter())return a.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(a._CurrentKeyframeGetter())}BeforeChangeProperty(){}ChangeProperty(a,
d,c,e,g,k){const m=this._numericInterpolationAdapter,p=m.GetLastValue();m._PickResultMode(()=>{m._Setter(d-p,c,e);k&&this._MaybeEnsureValue(a,c,e,g,p,d)},()=>{m._PickFirstAbsoluteUpdate(()=>{m._Setter(p,c,e)},()=>{m._Setter(d-p,c,e);k&&this._MaybeEnsureValue(a,c,e,g,p,d)})});m.SetLastValue(d);return m._PickSource(()=>{},()=>f.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>f.TimelineState.LAYOUT_RENDER_CHANGE,()=>f.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){}_GetAbsoluteInitialValue(a){return a-
this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(a,d,c,e,g,k){const m=this._numericInterpolationAdapter;e?d&&a===d.GetTime()?m._AddDelta(d.GetValueWithResultMode(),d,c):c&&a===c.GetTime()?m._AddDelta(c.GetValueWithResultMode(),d,c):c||m._AddDelta(d.GetValueWithResultMode(),d,c):d&&a===d.GetTime()?m._AddDelta(d.GetValueWithResultMode(),d,c):c&&a===c.GetTime()?m._AddDelta(c.GetValueWithResultMode(),d,c):0===k-g&&m._AddDelta(d.GetValueWithResultMode(),d,c)}}f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=
b}"use strict";
{const f=self.C3,b=self.Ease;f.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(a,d,c,e){let g;switch(e){case "behavior":g=d.GetPropertyValueByIndex(a);break;case "effect":g=d[a];break;case "instance-variable":g=d.GetInstanceVariableValue(a);break;case "plugin":g=d.GetPropertyValueByIndex(a)}return g===c?!1:!0}static Interpolate(a,d,c,e){if(!c)return c=e.GetPropertyTrackDataItem(),c=e.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(c),c.GetValueWithResultMode();var g=
e.GetInterpolationMode();"default"===g&&(g="continuous");"combo"===e.GetPropertyType()&&(g="discrete");if("discrete"===g)return d.GetValueWithResultMode();if("continuous"===g||"step"===g){"step"===g&&(g=e.GetTimeline().GetStep(),0!==g&&(g=1/g,a=Math.floor(a*g)/g));var k=d.GetTime();const m=c.GetTime();g=d.GetValueWithResultMode();const p=c.GetValueWithResultMode();if(g===p)return g;a=f.normalize(a,k,m);const n=d.GetEase();d=d.GetAddOn("cubic-bezier");c=c.GetAddOn("cubic-bezier");d&&d.GetStartEnable()&&
c&&c.GetEndEnable()?(k=m-k,k=b.GetRuntimeEase(n)(k*a,0,1,k),k=b.GetRuntimeEase("cubicbezier")(k,g,g+d.GetStartAnchor(),p+c.GetEndAnchor(),p)):k=b.GetRuntimeEase(n)((m-k)*a,g,p-g,m-k);return"integer"===e.GetPropertyType()?Math.floor(k):k}}}}"use strict";
{const f=self.C3;f.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(b,a,d,c){let e;switch(c){case "behavior":e=a.GetPropertyValueByIndex(b);break;case "effect":e=a[b];break;case "instance-variable":e=a.GetInstanceVariableValue(b);break;case "plugin":e=a.GetPropertyValueByIndex(b)}return e===d?!1:!0}static Interpolate(b,a,d,c){if(!d)return a=c.GetPropertyTrackDataItem(),a=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode();var e=c.GetInterpolationMode();
"default"===e&&(e="continuous");"combo"===c.GetPropertyType()&&(e="discrete");if("discrete"===e)return a.GetValueWithResultMode();if("continuous"===e||"step"===e){"step"===e&&(c=c.GetTimeline().GetStep(),0!==c&&(c=1/c,b=Math.floor(b*c)/c));const g=a.GetTime(),k=d.GetTime();c=a.GetValueWithResultMode();d=d.GetValueWithResultMode();if(e=a.GetAddOn("angle")){const m=e.GetRevolutions();if(c===d&&0===m)return c;b=f.normalize(b,g,k);a=self.Ease.GetRuntimeEase(a.GetEase())(b,0,1,1);switch(e.GetDirection()){case "closest":return f.angleLerp(c,
d,a,m);case "clockwise":return f.angleLerpClockwise(c,d,a,m);case "anti-clockwise":return f.angleLerpAntiClockwise(c,d,a,m)}}else{if(c===d)return c;b=f.normalize(b,g,k);a=self.Ease.GetRuntimeEase(a.GetEase());return f.angleLerp(c,d,a(b,0,1,1))}}}}}"use strict";
self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(f,b,a,d){let c;switch(d){case "behavior":c=b.GetPropertyValueByIndex(f);break;case "effect":c=b[f];break;case "instance-variable":c=b.GetInstanceVariableValue(f);break;case "plugin":c=b.GetPropertyValueByIndex(f)}return!!c===!!a?!1:!0}static Interpolate(f,b,a,d){return a?b.GetValueWithResultMode()?1:0:(f=d.GetPropertyTrackDataItem(),f=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f),f.GetValueWithResultMode()?
1:0)}};"use strict";
{const f=self.C3,b=[0,0,0],a=[0,0,0],d=[0,0,0];f.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(c,e,g,k){let m;switch(k){case "behavior":m=e.GetPropertyValueByIndex(c);break;case "effect":m=e[c];break;case "instance-variable":m=e.GetInstanceVariableValue(c);break;case "plugin":m=e.GetPropertyValueByIndex(c)}Array.isArray(g)?(b[0]=g[0],b[1]=g[1],b[2]=g[2]):(d.parseCommaSeparatedRgb(g),b[0]=Math.floor(255*d.getR()),b[1]=Math.floor(255*d.getG()),b[2]=Math.floor(255*d.getB()));
Array.isArray(m)?(a[0]=m[0],a[1]=m[1],a[2]=m[2]):(d.parseCommaSeparatedRgb(m),a[0]=Math.floor(255*d.getR()),a[1]=Math.floor(255*d.getG()),a[2]=Math.floor(255*d.getB()));return b[0]!==a[0]||b[1]!==a[1]||b[2]!==a[2]?!0:!1}static Interpolate(c,e,g,k){if(!g){var m=k.GetPropertyTrackDataItem();m=k.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(m);k=m.GetValueWithResultMode();b[0]=k[0];b[1]=k[1];b[2]=k[2];return b}m=k.GetInterpolationMode();"default"===m&&(m="continuous");if("discrete"===m)return k=
e.GetValueWithResultMode(),b[0]=k[0],b[1]=k[1],b[2]=k[2],b;if("continuous"===m||"step"===m){"step"===m&&(k=k.GetTimeline().GetStep(),0!==k&&(k=1/k,c=Math.floor(c*k)/k));k=e.GetTime();m=g.GetTime();var p=e.GetValueWithResultMode(),n=g.GetValueWithResultMode();c=f.normalize(c,k,m);var u=e.GetEase();e=p[0];g=p[1];p=p[2];const q=n[0],r=n[1];n=n[2];u=self.Ease.GetRuntimeEase(u);k=m-k;m=k*c;b[0]=e===q?e:u(m,e,q-e,k);b[1]=g===r?g:u(m,g,r-g,k);b[2]=p===n?p:u(m,p,n-p,k);return b}}}}"use strict";
self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(f,b,a,d){let c;switch(d){case "behavior":c=b.GetPropertyValueByIndex(f);break;case "effect":c=b[f];break;case "instance-variable":c=b.GetInstanceVariableValue(f);break;case "plugin":c=b.GetPropertyValueByIndex(f)}return c===a?!1:!0}static Interpolate(f,b,a,d){return a?b.GetValueWithResultMode():(f=d.GetPropertyTrackDataItem(),f=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f),f.GetValueWithResultMode())}};
"use strict";
{const f=self.C3;f.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const b of this._timelineDataItems.values())b.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(b){b=new f.TimelineDataItem(b);const a=b.GetName();this._timelineDataItems.set(a,b)}Get(b){return this._timelineDataItems.get(b)}GetNameId(){return 0}static _CreateDataItems(b,a,d,c){if(a)for(const e of a)f.TimelineDataManager._CreateDataItem("create",e,b,d,c)}static _LoadDataItemsFromJson(b,a,
d,c){b.length?a.forEach((e,g)=>{b[g]._LoadFromJson(e)}):a.forEach(e=>{f.TimelineDataManager._CreateDataItem("load",e,b,d,c)})}static _CreateDataItem(b,a,d,c,e){let g;if("function"===typeof c)switch(b){case "load":g=new c(null,e);break;case "create":g=new c(a,e)}else if("object"===typeof c)switch(c=c.map.get(a[c.prop]),b){case "load":g=new c(null,e);break;case "create":g=new c(a,e)}switch(b){case "load":g._LoadFromJson(a);d.push(g);break;case "create":if("function"===typeof g.GetEnable&&!g.GetEnable())return g.Release();
d.push(g)}}}}"use strict";
{const f=self.C3;f.TimelineDataItem=class{constructor(b){this._name="";this._totalTime=NaN;this._step=0;this._resultMode=this._interpolationMode="default";this._pingPong=this._loop=!1;this._repeatCount=1;this._trackData=null;b&&(this._name=b[0],this._totalTime=b[1],this._step=b[2],this._interpolationMode=b[3],this._resultMode=b[4],this._loop=!!b[6],this._pingPong=!!b[7],this._repeatCount=b[8],this._trackData=new f.TrackData(b[5],this))}Release(){this._trackData.Release();this._trackData=null}GetTrackData(){this._trackData||
(this._trackData=new f.TrackData(null,this));return this._trackData}GetName(){return this._name}SetName(b){this._name=b}GetTotalTime(){return this._totalTime}SetTotalTime(b){this._totalTime=b}GetStep(){return this._step}SetStep(b){this._step=b}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(b){this._interpolationMode=b}GetResultMode(){return this._resultMode}SetResultMode(b){this._resultMode=b}GetLoop(){return this._loop}SetLoop(b){this._loop=b}GetPingPong(){return this._pingPong}SetPingPong(b){this._pingPong=
b}GetRepeatCount(){return this._repeatCount}_SaveToJson(){return{trackDataJson:this._trackData._SaveToJson(),name:this._name,totalTime:this._totalTime,step:this._step,interpolationMode:this._interpolationMode,resultMode:this._resultMode,loop:this._loop,pingPong:this._pingPong,repeatCount:this._repeatCount}}_LoadFromJson(b){b&&(this.GetTrackData()._LoadFromJson(b.trackDataJson),this._name=b.name,this._totalTime=b.totalTime,this._step=b.step,this._interpolationMode=b.interpolationMode,this._resultMode=
b.resultMode,this._loop=b.loop,this._pingPong=b.pingPong,this._repeatCount=b.repeatCount)}}}"use strict";
{const f=self.C3;class b{constructor(a,d){this._trackData=d;this._additionalInstanceData=this._instanceData=null;this._objectClassIndex=this._instanceUid=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyTrackData=this._keyframeData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();a&&(this._instanceData=a[0],this._instanceUid=a[0][2],this._objectClassIndex=a[0][1],this._interpolationMode=
a[1],this._resultMode=a[2],this._enabled=!!a[3],a[6]&&(this._id=a[6]),a[7]&&(this._nestedData=a[7],this._startOffset=a[7][0],this._localTotalTime=a[7][1]),a[8]&&(this._additionalInstanceData=a[8]),this._keyframeData=new f.KeyframeData(a[4],this),this._propertyTrackData=new f.PropertyTrackData(a[5],this))}Release(){this._trackData=this._instanceData=null;this._keyframeData&&(this._keyframeData.Release(),this._keyframeData=null);this._propertyTrackData&&(this._propertyTrackData.Release(),this._propertyTrackData=
null);this._nestedData=null}GetTrackData(){return this._trackData}GetKeyframeData(){this._keyframeData||(this._keyframeData=new f.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new f.PropertyTrackData(null,this));return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(a){this._objectClassIndex=a}GetInstanceUID(){return this._instanceUid}SetInstanceUID(a){this._instanceUid=
a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}GetOriginalWidth(){return this._additionalInstanceData[0]}SetOriginalWidth(a){this._additionalInstanceData||(this._additionalInstanceData=[]);
this._additionalInstanceData[0]=a}GetOriginalHeight(){this._additionalInstanceData||(this._additionalInstanceData=[]);return this._additionalInstanceData[1]}SetOriginalHeight(a){this._additionalInstanceData||(this._additionalInstanceData=[]);this._additionalInstanceData[1]=a}_SaveToJson(){return{keyframeDataJson:this._keyframeData._SaveToJson(),propertyTrackDataJson:this._propertyTrackData._SaveToJson(),instanceData:this._instanceData,additionalInstanceData:this._additionalInstanceData,instanceUid:this._instanceUid,
objectClassIndex:this._objectClassIndex,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled,id:this._id,nestedData:this._nestedData}}_LoadFromJson(a){a&&(this._instanceData=a.instanceData,this._instanceUid=a.instanceUid,this._objectClassIndex=a.objectClassIndex,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._enabled=a.enabled,this._id=a.id,this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),a.nestedData&&
(this._nestedData=a.nestedData,this._startOffset=this._nestedData[0],this._localTotalTime=this._nestedData[1]),a.additionalInstanceData&&(this._additionalInstanceData=a.additionalInstanceData),this.GetKeyframeData()._LoadFromJson(a.keyframeDataJson),this.GetPropertyTrackData()._LoadFromJson(a.propertyTrackDataJson))}}f.TrackData=class{constructor(a,d){this._timelineDataItem=d;this._trackDataItems=[];this._keyframeTimeMap=new Map;f.TimelineDataManager._CreateDataItems(this._trackDataItems,a,b,this)}Release(){this._timelineDataItem=
null;for(const a of this._trackDataItems)a.Release();f.clearArray(this._trackDataItems);this._trackDataItems=null;this._keyframeTimeMap.clear();this._keyframeTimeMap=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const a=new b(null,this);this._trackDataItems.push(a);return a}GetFirstKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(a){a=a.GetKeyframeData().GetKeyframeDataItemArray();return a[a.length-1]}GetKeyFrameDataItemAtTime(a,
d){const c=this._keyframeTimeMap.get(d);if(c&&c.has(a))return c.get(a);for(const e of d.GetKeyframeData().keyframeDataItems())if(e.GetTime()===a)return c||this._keyframeTimeMap.set(d,new Map),this._keyframeTimeMap.get(d).set(a,e),e}GetFirstKeyFrameDataItemHigherThan(a,d){for(const c of d.GetKeyframeData().keyframeDataItems())if(c.GetTime()>a)return c}GetFirstKeyFrameDataItemHigherOrEqualThan(a,d){for(const c of d.GetKeyframeData().keyframeDataItems())if(c.GetTime()>=a)return c}GetFirstKeyFrameDataItemLowerOrEqualThan(a,
d){for(const c of d.GetKeyframeData().keyframeDataItemsReverse())if(c.GetTime()<=a)return c}*trackDataItems(){for(const a of this._trackDataItems)yield a}_SaveToJson(){return{trackDataItemsJson:this._trackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,a.trackDataItemsJson,b,this)}}}"use strict";
{const f=self.C3;class b{constructor(a,d){this._propertyTrackData=d;this._sourceAdapterId="";this._type=this._property=this._sourceAdapterArguments=null;this._max=this._min=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyKeyframeData=null;a&&(this._sourceAdapterId=a[0][0],this._sourceAdapterArguments=a[0].slice(1),this._property=a[1],this._type=a[2],this._min=a[3],this._max=a[4],this._interpolationMode=a[5],this._resultMode=a[6],this._enabled=!!a[7],this._propertyKeyframeData=
new f.PropertyKeyframeData(a[8],this))}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new f.PropertyKeyframeData(null,this));return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(a){this._sourceAdapterId=a}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(a){this._sourceAdapterArguments=
a}GetProperty(){return this._property}SetProperty(a){this._property=a}GetType(){return this._type}SetType(a){this._type=a}GetMin(){return this._min}SetMin(a){this._min=a}GetMax(){return this._max}SetMax(a){this._max=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}_SaveToJson(){return{propertyKeyframeDataJson:this._propertyKeyframeData._SaveToJson(),
sourceAdapterId:this._sourceAdapterId,sourceAdapterArguments:this._sourceAdapterArguments,property:this._property,type:this._type,min:this._min,max:this._max,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled}}_LoadFromJson(a){a&&(this._sourceAdapterId=a.sourceAdapterId,this._sourceAdapterArguments=a.sourceAdapterArguments,this._property=a.property,this._type=a.type,this._min=a.min,this._max=a.max,this._interpolationMode=a.interpolationMode,this._resultMode=
a.resultMode,this._enabled=a.enabled,this.GetPropertyKeyframeData()._LoadFromJson(a.propertyKeyframeDataJson))}}f.PropertyTrackData=class{constructor(a,d){this._trackDataItem=d;this._propertyTrackDataItems=[];this._propertyKeyframeTimeMap=new Map;f.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,a,b,this)}Release(){this._trackDataItem=null;for(const a of this._propertyTrackDataItems)a.Release();f.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null;this._propertyKeyframeTimeMap.clear();
this._propertyKeyframeTimeMap=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const a=new b(null,this);this._propertyTrackDataItems.push(a);return a}GetFirstPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(a){a=a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();return a[a.length-1]}GetPropertyKeyFrameDataItemAtTime(a,d){const c=this._propertyKeyframeTimeMap.get(d);if(c&&
c.has(a))return c.get(a);const e=d.GetPropertyKeyframeData();for(const g of e.propertyKeyframeDataItems())if(g.GetTime()===a)return c||this._propertyKeyframeTimeMap.set(d,new Map),this._propertyKeyframeTimeMap.get(d).set(a,g),g}GetFirstPropertyKeyFrameDataItemHigherThan(a,d){d=d.GetPropertyKeyframeData();for(const c of d.propertyKeyframeDataItems())if(c.GetTime()>a)return c}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,d){d=d.GetPropertyKeyframeData();for(const c of d.propertyKeyframeDataItems())if(c.GetTime()>=
a)return c}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,d){d=d.GetPropertyKeyframeData();for(const c of d.propertyKeyframeDataItemsReverse())if(c.GetTime()<=a)return c}*propertyTrackDataItems(){for(const a of this._propertyTrackDataItems)yield a}_SaveToJson(){return{propertyTrackDataItemsJson:this._propertyTrackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,a.propertyTrackDataItemsJson,b,this)}}}"use strict";
{const f=self.C3;class b{constructor(a,d){this._keyframeData=d;this._time=-1;this._ease="noease";this._enable=!1;this._lowerTags=this._tags=null;a&&(this._time=a[0],this._ease=a[1],this._enable=!!a[2],this._tags=(a=a[3])?a.split(" "):[],this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase())))}Release(){this._keyframeData=null;f.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetTime(){return this._time}SetTime(a){this._time=
a}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetTags(){return this._tags}SetTags(a){this._tags=a?a.split(" "):[];this._lowerTags=new Set(this._tags.map(d=>d.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(a){return this._lowerTags.has(a.toLowerCase())}_SaveToJson(){return{time:this._time,ease:this._ease,enable:this._enable,tags:this._tags}}_LoadFromJson(a){a&&(this._time=a.time,this._ease=a.ease,this._enable=a.enable,
this._tags=a.tags,this._lowerTags=new Set(this._tags.map(d=>d.toLowerCase())))}}f.KeyframeData=class{constructor(a,d){this._trackDataItem=d;this._keyframeDataItems=[];f.TimelineDataManager._CreateDataItems(this._keyframeDataItems,a,b,this)}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();f.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const a=
new b(null,this);this._keyframeDataItems.push(a);return a}DeleteKeyframeDataItems(a){for(const d of this._keyframeDataItems){if(!a(d))continue;const c=this._keyframeDataItems.indexOf(d);-1!==c&&(d.Release(),this._keyframeDataItems.splice(c,1))}this.SortKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((a,d)=>a.GetTime()-d.GetTime())}GetKeyframeDataItemIndex(a){return this._keyframeDataItems.indexOf(a)}GetKeyframeDataItemFromIndex(a){return this._keyframeDataItems[a]}*keyframeDataItems(){for(const a of this._keyframeDataItems)yield a}*keyframeDataItemsReverse(){for(let a=
this._keyframeDataItems.length-1;0<=a;a--)yield this._keyframeDataItems[a]}_SaveToJson(){return{keyframeDataItemsJson:this._keyframeDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,a.keyframeDataItemsJson,b,this)}}}"use strict";
{const f=self.C3;class b{constructor(a,d){this._propertyKeyframeData=d;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;a&&(this._value=a[0][0],this._aValue=a[0][1],this._type=a[0][2],this._time=a[1],this._ease=a[2],this._enable=!!a[3],this._addonData=null,a[4]&&(this._addonData=new f.AddonData(a[4],this)))}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(),this._addonData=null)}GetAddonData(){return this._addonData}GetValue(){return this._value}SetValue(a){"color"===
this._type&&f.IsFiniteNumber(a)?(this._value[0]=f.GetRValue(a),this._value[1]=f.GetGValue(a),this._value[2]=f.GetBValue(a)):this._value=a}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(a){"color"===this._type&&f.IsFiniteNumber(a)?(this._aValue[0]=f.GetRValue(a),this._aValue[1]=f.GetGValue(a),this._aValue[2]=f.GetBValue(a)):this._aValue=a}GetValueWithResultMode(){const a=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if("relative"===a)return this.GetValue();if("absolute"===
a)return this.GetAbsoluteValue()}GetType(){return this._type}SetType(a){this._type=a}GetTime(){return this._time}SetTime(a){this._time=a}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetAddOn(a){if(this.GetAddonData())for(const d of this.GetAddonData().addonDataItems())if(d.GetId()===a)return d}_SaveToJson(){const a=this._addonData;return{addonDataJson:a?a._SaveToJson():a,value:this._value,aValue:this._aValue,type:this._type,time:this._time,
ease:this._ease,enable:this._enable}}_LoadFromJson(a){a&&(a.addonDataJson&&this._addonData._SetFromJson(a.addonDataJson),this._value=a.value,this._aValue=a.aValue,this._type=a.type,this._time=a.time,this._ease=a.ease,this._enable=a.enable)}}f.PropertyKeyframeData=class{constructor(a,d){this._propertyTrackDataItem=d;this._propertyKeyframeDataItems=[];f.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,a,b,this)}Release(){this._propertyTrackDataItem=null;for(const a of this._propertyKeyframeDataItems)a.Release();
f.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=null}AddEmptyPropertyKeyframeDataItem(){const a=new b(null,this);this._propertyKeyframeDataItems.push(a);return a}DeletePropertyKeyframeDataItems(a){for(const d of this._propertyKeyframeDataItems){if(!a(d))continue;const c=this._propertyKeyframeDataItems.indexOf(d);-1!==c&&(d.Release(),this._propertyKeyframeDataItems.splice(c,1))}this.SortPropertyKeyFrameDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a,
d)=>a.GetTime()-d.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const a of this._propertyKeyframeDataItems)yield a}*propertyKeyframeDataItemsReverse(){for(let a=this._propertyKeyframeDataItems.length-1;0<=a;a--)yield this._propertyKeyframeDataItems[a]}_SaveToJson(){return{propertyKeyframeDataItemsJson:this._propertyKeyframeDataItems.map(a=>
a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a.propertyKeyframeDataItemsJson,b,this)}}}"use strict";
{const f=self.C3;class b{constructor(c,e){this._addonData=e;this._id=c[0];this._data=c[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(c){c&&(this._id=c.id,this._data=c.data)}}class a extends b{constructor(c,e){super(c,e);this._startAnchor=this._data[0];this._startEnable=!!this._data[1];this._endAnchor=this._data[2];this._endEnable=!!this._data[3]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),
{startAnchor:this._startAnchor,startEnable:!!this._startEnable,endAnchor:this._endAnchor,endEnable:!!this._endEnable})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._startAnchor=c.startAnchor,this._startEnable=!!c.startEnable,this._endAnchor=c.endAnchor,this._endEnable=!!c.endEnable)}}class d extends b{constructor(c,e){super(c,e);this._direction=this._data[0];this._revolutions=this._data[1]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),
{direction:this._direction,revolutions:this._revolutions})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._direction=c.direction,this._revolutions=c.revolutions)}}f.AddonData=class{constructor(c,e){this._propertyKeyframeDataItem=e;this._addonDataItems=[];f.TimelineDataManager._CreateDataItems(this._addonDataItems,c,{prop:0,map:new Map([["cubic-bezier",a],["angle",d]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const c of this._addonDataItems)c.Release();f.clearArray(this._addonDataItems);
this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}*addonDataItems(){for(const c of this._addonDataItems)yield c}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(c=>c._SaveToJson())}}_LoadFromJson(c){c&&f.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,c.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",a],["angle",d]])},this)}}}"use strict";
{const f=self.C3;let b=0;f.Tween=class extends f.TimelineState{constructor(a,d){super(`tween-${b++}`,a,d);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._on_started_callbacks=this._on_completed_callbacks=null}GetInstance(){var a=this.GetTracks();if(a&&a.length&&(a=a[0])){var d=a.GetInstance();return a.IsInstanceValid()?d:null}}AddStartedCallback(a){this._on_started_callbacks||(this._on_started_callbacks=[]);this._on_started_callbacks.push(a)}AddCompletedCallback(a){this._on_completed_callbacks||
(this._on_completed_callbacks=[]);this._on_completed_callbacks.push(a)}RemoveStartedCallback(a){this._on_started_callbacks&&(a=this._on_started_callbacks.indexOf(a),-1!==a&&this._on_started_callbacks.splice(a,1))}RemoveCompletedCallback(a){this._on_completed_callbacks&&(a=this._on_completed_callbacks.indexOf(a),-1!==a&&this._on_completed_callbacks.splice(a,1))}SetStartValue(a,d){for(const e of this._tracks)for(const g of e._propertyTracks){if(g.GetPropertyName()!==d)continue;var c=g.GetPropertyTrackData();
const k=g.GetPropertyTrackDataItem();c=c.GetFirstPropertyKeyframeDataItem(k);c.SetValue(a);c.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const d of this._tracks)for(const c of d._propertyTracks)if(c.GetPropertyName()===a)return c}BeforeSetEndValues(a){for(const d of a)a=this._GetPropertyTrackState(d),this.SetStartValue(a.GetCurrentState(),d);this.IsForwardPlayBack()?(this.SetTotalTime(this.GetTotalTime()-this.GetTime()),this._SetTime(0)):(this.SetTotalTime(this.GetTime()),this._SetTime(this.GetTotalTime()));
this.SetInitialStateFromSetTime()}SetEndValue(a,d){var c=this._GetPropertyTrackState(d);d=c.GetPropertyTrackData();c=c.GetPropertyTrackDataItem();d=d.GetLastPropertyKeyframeDataItem(c);d.SetTime(this.GetTotalTime());d.SetValue(a);d.SetAbsoluteValue(a)}SetId(a){this._id=a}GetId(){return this._id}SetInitialValueMode(a){this._initialValueMode=a}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(a){this._destroyInstanceOnComplete=a}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const a of this._on_started_callbacks)a(this);
if(!this.IsComplete())for(const a of this._tracks)a.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(!this._finishedTriggers&&(this._finishedTriggers=!0,this._on_completed_callbacks))for(const a of this._on_completed_callbacks)a(this)}SetTime(a){this._DeleteIntermediateKeyframes();super.SetTime(a)}SetInitialState(a){if(!this.InitialStateSet()&&"current-state"===this.GetInitialValueMode())for(const d of this._tracks)d.CompareInitialStateWithCurrent();
super.SetInitialState(a)}Stop(a=!1){super.Stop(a);if(!this.IsComplete())for(const d of this._tracks)d.SaveState()}Reset(a=!0,d=!1){this._DeleteIntermediateKeyframes();super.Reset(a,d)}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const d=c=>{c=c.GetTime();const e=this.GetTotalTime();return 0!==c&&c!==e};a.DeleteKeyframes(d);a.DeletePropertyKeyframes(d)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const a=this.GetInstance();if(a&&a.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimeline(this);
this.ResetBeforeChangeLayout();return!0}MaybeTriggerKeyframeReachedConditions(){}Tick(a,d){a=this.GetInstance();a=this.GetRuntime().GetDt(a);super.Tick(a,1)}_SaveToJson(){const a=super._SaveToJson(),d=this.GetTimelineDataItem();return Object.assign(a,{tweenDataItemJson:d._SaveToJson(),id:this._id,destroyInstanceOnComplete:this._destroyInstanceOnComplete,initialValueMode:this._initialValueMode})}_LoadFromJson(a){a&&(this.GetTimelineDataItem()._LoadFromJson(a.tweenDataItemJson),super._LoadFromJson(a),
this._id=a.id,this._destroyInstanceOnComplete=a.destroyInstanceOnComplete,this._initialValueMode=a.initialValueMode)}static IsPlaying(a){return a.IsPlaying()}static IsPaused(a){return a.IsPaused()}static Build(a){var d=a.runtime.GetTimelineManager(),c=new f.TimelineDataItem;if(a.json){c._LoadFromJson(a.json.tweenDataItemJson);var e=new f.Tween(c,d);e._LoadFromJson(a.json);return e}d=new f.Tween(c,d);f.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]);d.SetId(a.id);
d.SetTags(a.tags);d.SetInitialValueMode(a.initialValueMode);d.SetDestroyInstanceOnComplete(a.releaseOnComplete);d.SetLoop(a.loop);d.SetPingPong(a.pingPong);d.SetTotalTime(a.time);d.SetStep(0);d.SetInterpolationMode("default");d.SetResultMode(a.propertyTracksConfig[0].resultMode);c=d.AddTrack();c.SetInstanceUID(a.instance.GetUID());c.SetInterpolationMode("default");c.SetResultMode(a.propertyTracksConfig[0].resultMode);c.SetEnable(!0);c.SetObjectClassIndex(a.instance.GetObjectClass().GetIndex());c.SetOriginalWidth(a.instance.GetWorldInfo().GetWidth());
c.SetOriginalHeight(a.instance.GetWorldInfo().GetHeight());var g=c.AddKeyframe();g.SetTime(0);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");g=c.AddKeyframe();g.SetTime(a.time);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");for(e of a.propertyTracksConfig){g=c.AddPropertyTrack();g.SetSourceAdapterId(e.sourceId);g.SetSourceAdapterArgs(e.sourceArgs);g.SetPropertyName(e.property);g.SetPropertyType(e.type);g.SetMin(NaN);g.SetMax(NaN);g.SetInterpolationMode("default");g.SetResultMode(e.resultMode);
g.SetEnable(!0);const k=g.AddPropertyKeyframe();k.SetType(e.valueType);k.SetTime(0);k.SetEase(e.ease);k.SetEnable(!0);k.SetValue(e.startValue);k.SetAbsoluteValue(e.startValue);g=g.AddPropertyKeyframe();g.SetType(e.valueType);g.SetTime(a.time);g.SetEase(e.ease);g.SetEnable(!0);g.SetValue(e.endValue);g.SetAbsoluteValue(e.endValue)}return d}}}"use strict";
{const f=self.C3,b=self.Ease;f.Transition=class extends f.DefendedBase{constructor(a){super();this._name=a[0];this._transitionKeyframes=[];for(const d of a[1])a=f.TransitionKeyframe.Create(this,d),this._transitionKeyframes.push(a);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();b.AddCustomEase(this._name,(d,c,e,g)=>this.Interpolate(d,c,e,g))}static Create(a){return f.New(f.Transition,a)}Release(){for(const a of this._transitionKeyframes)a.Release();
f.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(a){const d=this._transitionKeyframeCache.get(a);if(d)return d;for(const c of this._transitionKeyframes)if(c.GetValueX()===a)return this._transitionKeyframeCache.set(a,c),c}GetFirstTransitionKeyFrameHigherThan(a){for(const d of this._transitionKeyframes)if(d.GetValueX()>
a)return d}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const d of this._transitionKeyframes)if(d.GetValueX()>=a)return d}GetFirstTransitionKeyFrameLowerOrEqualThan(a){for(let d=this._transitionKeyframes.length-1;0<=d;d--){const c=this._transitionKeyframes[d];if(c.GetValueX()<=a)return c}}Interpolate(a,d,c,e){var g=a/e;(a=this.GetTransitionKeyFrameAt(g))?e=this.GetFirstTransitionKeyFrameHigherThan(g):(a=this.GetFirstTransitionKeyFrameLowerOrEqualThan(g),e=this.GetFirstTransitionKeyFrameHigherOrEqualThan(g));
var k=e.GetValueX()-a.GetValueX();g=f.mapToRange(g,a.GetValueX(),e.GetValueX(),0,k);k=a.GetValueX();const m=a.GetValueY(),p=a.GetValueX()+a.GetStartAnchorX(),n=a.GetValueY()+a.GetStartAnchorY(),u=e.GetValueX()+e.GetEndAnchorX(),q=e.GetValueY()+e.GetEndAnchorY(),r=e.GetValueX();e=e.GetValueY();e=b.GetRuntimeEase("spline")(g,k,m,p,n,u,q,r,e,this._precalculatedSamples.get(a));e+=a.GetValueY();return(1-e)*d+e*(d+c)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let c=0;c<this._transitionKeyframes.length-
1;c++){var a=this._transitionKeyframes[c];if(!a.GetStartEnable())continue;var d=this._transitionKeyframes[c+1];const e=a.GetValueX(),g=a.GetValueX()+a.GetStartAnchorX(),k=d.GetValueX()+d.GetEndAnchorX();d=d.GetValueX();this._precalculatedSamples.set(a,b.GetBezierSamples(e,g,k,d))}}}}"use strict";
{const f=self.C3;f.TransitionKeyframe=class extends f.DefendedBase{constructor(b,a){super();this._transition=b;this._valueX=a[0];this._valueY=a[1];this._startAnchorX=a[2];this._startAnchorY=a[3];this._endAnchorX=a[4];this._endAnchorY=a[5];this._startEnable=a[6];this._endEnable=a[7]}Release(){this._transition=null}static Create(b,a){return f.New(f.TransitionKeyframe,b,a)}GetValueX(){return this._valueX}GetValueY(){return this._valueY}GetStartAnchorX(){return this._startAnchorX}GetStartAnchorY(){return this._startAnchorY}GetEndAnchorX(){return this._endAnchorX}GetEndAnchorY(){return this._endAnchorY}GetStartEnable(){return this._startEnable}GetEndEnable(){return this._endEnable}}}"use strict";
{const f=self.C3;f.TransitionManager=class extends f.DefendedBase{constructor(b){super();this._runtime=b;this._transitions=[]}Release(){for(const b of this._transitions)b.Release();f.clearArray(this._transitions);this._transitions=null}Create(b){this._transitions.push(f.Transition.Create(b))}}}"use strict";
{const f=self.C3;f.SolStack=class extends f.DefendedBase{constructor(b){super();this._objectClass=b;this._stack=[];this._stack.push(f.New(f.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const b of this._stack)b.Release();f.clearArray(this._stack);this._objectClass=this._current=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){var b=this._stack,a=++this._index;a===b.length?(a=f.New(f.Sol,this),
b.push(a),this._current=a):(b=b[a],b.Reset(),this._current=b)}PushCopy(){const b=this._stack,a=++this._index;a===b.length&&b.push(f.New(f.Sol,this));const d=b[a];d.Copy(b[a-1]);this._current=d}Pop(){this._current=this._stack[--this._index]}RemoveInstances(b){const a=this._stack;for(let d=0,c=a.length;d<c;++d)a[d].RemoveInstances(b)}}}"use strict";
{const f=self.C3;f.Sol=class extends f.DefendedBase{constructor(b){super();this._stack=b;this._objectClass=this._stack.GetObjectClass();this._eventStack=this._objectClass.GetRuntime().GetEventStack();this._selectAll=!0;this._instances=[];this._elseInstances=[]}Release(){this.ClearArrays();this._eventStack=this._objectClass=this._stack=null}ClearArrays(){f.clearArray(this._instances);f.clearArray(this._elseInstances)}GetObjectClass(){return this._objectClass}IsSelectAll(){return this._selectAll}HasAnyInstances(){return this._selectAll?
!!this._objectClass.GetInstanceCount():!!this._instances.length}GetInstances(){return this._selectAll?this._objectClass.GetInstances():this._instances}HasAnyElseInstances(){return!!this._elseInstances.length}GetElseInstances(){return this._elseInstances}GetExpressionInstances(){const b=this.GetInstances();return b.length?b:this._elseInstances}Reset(){this._selectAll=!0;f.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(b){b.IsSelectAll()?this.Reset():(this._selectAll=!1,f.shallowAssignArray(this._instances,
b._instances),f.clearArray(this._elseInstances))}_PushInstance(b){this._instances.push(b)}_PushElseInstance(b){this._elseInstances.push(b)}_SetSelectAll(b){this._selectAll=!!b}_GetOwnInstances(){return this._instances}_GetOwnElseInstances(){return this._elseInstances}SetSinglePicked(b){this._selectAll=!1;f.clearArray(this._instances);this._instances.push(b)}SetArrayPicked(b){this._selectAll=!1;f.shallowAssignArray(this._instances,b)}SetSetPicked(b){this._selectAll=!1;f.clearArray(this._instances);
for(const a of b)this._instances.push(a)}AddElseInstances(b,a){for(const d of a)b.has(d)||this._elseInstances.push(d)}TransferElseInstancesToOwn(b){for(const a of b)this._instances.push(a);f.arrayRemoveAllInSet(this._elseInstances,b)}PickOne(b){b&&(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()?(this.IsSelectAll()&&(f.clearArray(this._instances),f.shallowAssignArray(this._elseInstances,b.GetObjectClass().GetInstances()),this._selectAll=!1),b=this._elseInstances.indexOf(b),-1!==
b&&(this._instances.push(this._elseInstances[b]),this._elseInstances.splice(b,1))):this.SetSinglePicked(b))}RemoveInstances(b){f.arrayRemoveAllInSet(this._instances,b);f.arrayRemoveAllInSet(this._elseInstances,b)}}}"use strict";
{const f=self.C3;f.EventStack=class extends f.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._stack.push(f.New(f.EventStackFrame,this,null));this._index=0;this._expFuncStack=[]}Release(){for(const b of this._stack)b.Release();f.clearArray(this._stack);f.clearArray(this._expFuncStack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}Push(b){var a=
this._stack;const d=++this._index;if(d===a.length)return b=f.New(f.EventStackFrame,this,b),a.push(b),b;a=a[d];a.Reset(b);return a}Pop(){--this._index}PushExpFunc(b){this._expFuncStack.push(b)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const b=this._expFuncStack;return 0===b.length?null:b[b.length-1]}}}"use strict";
{const f=self.C3;f.EventStackFrame=class extends f.DefendedBase{constructor(b,a){super();this._stack=b;this._runtime=this._stack.GetRuntime();this._currentEvent=a;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1;this._expressionObjectClass=null;this._functionReturnValue=this._functionReturnType=0}Release(){this.Reset(null);this._runtime=this._stack=null}Reset(b){this._currentEvent=b;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1}_Restore(b,a){this._currentEvent=
b;this._cndIndex=0;this._actIndex=a}ResetQuick(){this._actIndex=this._cndIndex=0}GetCurrentEvent(){return this._currentEvent}SetCurrentEvent(b){this._currentEvent=b}GetConditionIndex(){return this._cndIndex}SetConditionIndex(b){this._cndIndex=b}GetActionIndex(){return this._actIndex}SetActionIndex(b){this._actIndex=b}SetLastEventTrue(b){this._lastEventTrue=!!b}GetLastEventTrue(){return this._lastEventTrue}SetElseBranchRan(b){this._elseBranchRan=!!b}GetElseBranchRan(){return this._elseBranchRan}SetExpressionObjectClass(b){this._expressionObjectClass=
b}GetExpressionObjectClass(){return this._expressionObjectClass}InitCallFunctionExpression(b,a){this._functionReturnType=b;this._functionReturnValue=a}GetFunctionReturnType(){return this._functionReturnType}SetFunctionReturnValue(b){this._functionReturnValue=b}GetFunctionReturnValue(){return this._functionReturnValue}IsSolModifierAfterCnds(){const b=this._currentEvent;return b.IsSolWriterAfterCnds()?!0:this._cndIndex<b.GetConditionCount()-1?!!b.GetSolModifiers().length:!1}}}"use strict";
{const f=self.C3;f.LocalVarStack=class extends f.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1;this._current=null;this._initialValues=[]}Release(){f.clearArray(this._stack);this._runtime=this._eventSheetManager=null}_SetInitialValues(b){this._initialValues=b;b=this._initialValues.slice(0);this._stack.push(b);this._index=0;this._current=b}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const b=
++this._index,a=this._stack;b===a.length?a.push(this._initialValues.slice(0)):f.shallowAssignArray(a[b],this._initialValues);this._current=a[b]}Pop(){this._current=this._stack[--this._index]}}}"use strict";
{const f=self.C3;f.LoopStack=class extends f.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1}Release(){f.clearArray(this._stack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}IsInLoop(){return 0<=this._index}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){var b=f.New(f.Loop,
this);this._stack.push(b);return b}b=this._stack[this._index];b.Reset();return b}Pop(){--this._index}FindByName(b){const a=this._stack;for(let d=this._index;0<=d;--d){const c=a[d];if(c.GetName()===b)return c}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}}"use strict";
{const f=self.C3;f.Loop=class extends f.DefendedBase{constructor(b){super();this._loopStack=b;this._name="";this._index=0;this._isStopped=!1;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=!1;this._end=NaN}SetName(b){this._name=b}GetName(){return this._name}SetIndex(b){this._index=b}GetIndex(){return this._index}Stop(){this._isStopped=!0}IsStopped(){return this._isStopped}SetEnd(b){this._end=b}GetEnd(){return this._end}}}"use strict";
{const f=self.C3;f.ArrayStack=class extends f.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){f.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const b=[];this._stack.push(b);return b}return this._stack[this._index]}Pop(){--this._index}}}"use strict";
{const f=self.C3;function b(d,c){return d.GetIndex()-c.GetIndex()}function a(d,c){for(let e=0,g=d.length;e<g;++e)if(d[e]!==c[e])return!1;return!0}f.EventSheetManager=class extends f.DefendedBase{constructor(d){super();this._runtime=d;this._allSheets=[];this._sheetsByName=new Map;this._allGroups=[];this._groupsByName=new Map;this._blocksBySid=new Map;this._cndsBySid=new Map;this._actsBySid=new Map;this._allUniqueSolModifiers=new Map;this._eventVarsBySid=new Map;this._nextLocalVarIndex=0;this._allGlobalVars=
[];this._allLocalVars=[];this._localVarInitialValues=[];this._functionBlocksByName=new Map;this._eventStack=f.New(f.EventStack,this);this._localVarStack=f.New(f.LocalVarStack,this);this._loopStack=f.New(f.LoopStack,this);this._triggersToPostInit=[];this._queuedTriggers=[];this._queuedDebugTriggers=[];this._blockFlushingDepth=this._executingTriggerDepth=this._runningEventsDepth=0;this._scheduledWaits=[];this._asyncActionPromises=[];self.c3_callFunction=(c,e)=>this._InvokeFunctionFromJS(c,e)}Release(){this.ClearAllScheduledWaits();
this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;f.clearArray(this._queuedTriggers);f.clearArray(this._queuedDebugTriggers);this._runtime=null;f.clearArray(this._allSheets);this._sheetsByName.clear()}Create(d){d=f.New(f.EventSheet,this,d);this._allSheets.push(d);this._sheetsByName.set(d.GetName().toLowerCase(),d)}_AddTriggerToPostInit(d){this._triggersToPostInit.push(d)}_PostInit(){for(const d of this._functionBlocksByName.values())d._PostInit(!1);
for(const d of this._allSheets)d._PostInit();for(const d of this._allSheets)d._UpdateDeepIncludes();for(const d of this._triggersToPostInit)d._PostInit(!1);f.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(d){return this._sheetsByName.get(d.toLowerCase())||null}_RegisterGroup(d){this._allGroups.push(d);this._groupsByName.set(d.GetGroupName(),d)}_RegisterEventBlock(d){this._blocksBySid.set(d.GetSID(),
d)}_RegisterCondition(d){this._cndsBySid.set(d.GetSID(),d)}_RegisterAction(d){this._actsBySid.set(d.GetSID(),d)}_RegisterFunctionBlock(d){this._functionBlocksByName.set(d.GetFunctionName().toLowerCase(),d)}_RegisterEventVariable(d){this._eventVarsBySid.set(d.GetSID(),d);d.IsGlobal()?this._allGlobalVars.push(d):this._allLocalVars.push(d)}_DeduplicateSolModifierList(d){2<=d.length&&d.sort(b);let c=this._allUniqueSolModifiers.get(d.length);c||(c=[],this._allUniqueSolModifiers.set(d.length,c));for(let e=
0,g=c.length;e<g;++e){const k=c[e];if(a(d,k))return k}c.push(d);return d}_GetNextLocalVarIndex(d){this._localVarInitialValues.push(d.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const d=this.GetCurrentEventStackFrame();return d.GetCurrentEvent().GetConditionAt(d.GetConditionIndex())}GetCurrentAction(){const d=
this.GetCurrentEventStackFrame();return d.GetCurrentEvent().GetActionAt(d.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetAllLocalVariablesInScope(d){const c=[];for(d=d.GetScopeParent();d;)f.appendArray(c,d._GetAllLocalVariablesInScope()),d=d.GetScopeParent();return c}_GetLocalVariablesScriptInterface(d){const c={};for(const e of this.GetAllLocalVariablesInScope(d))c[e.GetJsPropName()]=e._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,
c)}GetEventVariableBySID(d){return this._eventVarsBySid.get(d)||null}GetEventBlockBySID(d){return this._blocksBySid.get(d)||null}GetConditionBySID(d){return this._cndsBySid.get(d)||null}GetActionBySID(d){return this._actsBySid.get(d)||null}GetFunctionBlockByName(d){return this._functionBlocksByName.get(d.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const d of this._allGlobalVars)d.ResetToInitialValue()}GetEventGroupByName(d){return this._groupsByName.get(d.toLowerCase())||
null}GetEventGroupBySID(d){return(d=this._blocksBySid.get(d))&&d.IsGroup()?d:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const d of this._allGroups)d.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const d of this._allSheets)d._ResetHasRunFlag()}RunEvents(d){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const c of d.runningLayouts())if(d=c.GetEventSheet())this._runtime.PushCurrentLayout(c),d.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(d){this._ResetAllHasRunFlags();
this._runningEventsDepth++;for(const c of this._DebugRunEventsGen(d))await this._runtime.DebugBreak(c);this._runningEventsDepth--}*_DebugRunEventsGen(d){for(const c of d.runningLayouts())if(d=c.GetEventSheet())this._runtime.PushCurrentLayout(c),yield*d.DebugRun(),this._runtime.PopCurrentLayout()}_Trigger(d,c,e,g){let k=!1;if(!d.GetMainRunningLayout())return this.QueueTrigger(c,e,g);this._executingTriggerDepth++;for(const m of d.runningLayouts())if(d=m.GetEventSheet()){this._runtime.PushCurrentLayout(m);
for(const p of d.deepIncludes()){const n=p._Trigger(c,e,g);k=k||n}d=d._Trigger(c,e,g);k=k||d;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return k}*_DebugTrigger(d,c,e,g){let k=!1;if(!d.GetMainRunningLayout())return this.QueueTrigger(c,e,g);this._executingTriggerDepth++;for(const m of d.runningLayouts())if(d=m.GetEventSheet()){this._runtime.PushCurrentLayout(m);for(const p of d.deepIncludes()){const n=yield*p._DebugTrigger(c,e,g);k=k||n}d=yield*d._DebugTrigger(c,e,g);k=k||d;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;
return k}QueueTrigger(d,c,e){this._queuedTriggers.push([d,c,e]);return!1}QueueDebugTrigger(d,c,e){let g=null;const k=new Promise(m=>g=m);this._queuedDebugTriggers.push([d,c,e,g]);return k}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const d=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [c,e,g,k]=this._queuedDebugTriggers.shift(),m=yield*this._DebugTrigger(d,c,e,g);k(m)}}async RunQueuedDebugTriggersAsync(){for(const d of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(d)}_FastTrigger(d,
c,e,g){let k=!1;var m=d.GetMainRunningLayout();if(d=m.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(m);m=d.deepIncludes();for(let p=0,n=m.length;p<n;++p){const u=m[p]._FastTrigger(c,e,g);k=k||u}c=d._FastTrigger(c,e,g);k=k||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return k}}*_DebugFastTrigger(d,c,e,g){let k=!1;var m=d.GetMainRunningLayout();if(d=m.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(m);m=d.deepIncludes();
for(let p=0,n=m.length;p<n;++p){const u=yield*m[p]._DebugFastTrigger(c,e,g);k=k||u}c=yield*d._DebugFastTrigger(c,e,g);k=k||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return k}}GetTriggerDepth(){return this._executingTriggerDepth}IsInTrigger(){return 0<this.GetTriggerDepth()}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return 0<this._runningEventsDepth}IsInEventEngine(){return this.IsRunningEvents()||
this.IsInTrigger()}_RunQueuedTriggers(d){for(const [c,e,g]of this._queuedTriggers)this._Trigger(d,c,e,g);f.clearArray(this._queuedTriggers)}BlockFlushingInstances(d){d?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(d){for(let c=0,e=d.length;c<e;++c)d[c].GetSolStack().Clear()}PushCleanSol(d){for(let c=0,e=d.length;c<e;++c)d[c].GetSolStack().PushClean()}PushCopySol(d){for(let c=0,e=d.length;c<e;++c)d[c].GetSolStack().PushCopy()}PopSol(d){for(let c=
0,e=d.length;c<e;++c)d[c].GetSolStack().Pop()}AddScheduledWait(){const d=f.New(f.ScheduledWait,this);this._scheduledWaits.push(d);return d}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var d=this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let e=0,g=this._scheduledWaits.length;e<g;++e){const k=this._scheduledWaits[e];k._ShouldRun()&&k._Run(d);k.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var d=
this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let e=0,g=this._scheduledWaits.length;e<g;++e){const k=this._scheduledWaits[e];k._ShouldRun()&&await k._DebugRun(d);k.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const d=f.arrayFilterOut(this._scheduledWaits,c=>c.ShouldRelease());for(const c of d)c.Release()}ClearAllScheduledWaits(){for(const d of this._scheduledWaits)d.Release();f.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(d){for(const c of this._scheduledWaits)c.RemoveInstances(d)}AddAsyncActionPromise(d){this._asyncActionPromises.push(d)}ClearAsyncActionPromises(){f.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const d=
Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return d}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(d){this._LoadGroupsFromJson(d.groups);this._LoadCndsFromJson(d.cnds);this._LoadActsFromJson(d.acts);this._LoadVarsFromJson(d.vars);this._LoadScheduledWaitsFromJson(d.waits)}_SaveGroupsToJson(){const d={};for(const c of this.GetAllGroups())d[c.GetSID().toString()]=
c.IsGroupActive();return d}_LoadGroupsFromJson(d){for(const [c,e]of Object.entries(d))d=parseInt(c,10),(d=this.GetEventGroupBySID(d))&&d.SetGroupActive(e)}_SaveCndsToJson(){const d={};for(const [c,e]of this._cndsBySid){const g=e._SaveToJson();g&&(d[c.toString()]=g)}return d}_LoadCndsFromJson(d){const c=new Map;for(const [e,g]of Object.entries(d))c.set(parseInt(e,10),g);for(const [e,g]of this._cndsBySid)g._LoadFromJson(c.get(e)||null)}_SaveActsToJson(){const d={};for(const [c,e]of this._actsBySid){const g=
e._SaveToJson();g&&(d[c.toString()]=g)}return d}_LoadActsFromJson(d){const c=new Map;for(const [e,g]of Object.entries(d))c.set(parseInt(e,10),g);for(const [e,g]of this._actsBySid)g._LoadFromJson(c.get(e)||null)}_SaveVarsToJson(){const d={};for(const [c,e]of this._eventVarsBySid)e.IsConstant()||!e.IsGlobal()&&!e.IsStatic()||(d[c.toString()]=e.GetValue());return d}_LoadVarsFromJson(d){for(const [c,e]of Object.entries(d))d=parseInt(c,10),(d=this.GetEventVariableBySID(d))&&d.SetValue(e)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(d=>
!d.IsPromise()).map(d=>d._SaveToJson())}_LoadScheduledWaitsFromJson(d){this.ClearAllScheduledWaits();for(const c of d)(d=f.ScheduledWait._CreateFromJson(this,c))&&this._scheduledWaits.push(d)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(d=>d.GetEventSheet()).filter(d=>d).map(d=>d._GetPerfRecord())}FindFirstFunctionBlockParent(d){for(;d;){const c=d.GetScopeParent();if(c instanceof f.FunctionBlock)return c;d=d.GetParent()}return null}_InvokeFunctionFromJS(d,c){Array.isArray(c)||
(c=[]);d=this.GetFunctionBlockByName(d.toLowerCase());if(!d)return null;if(!d.IsEnabled())return d.GetDefaultReturnValue();var e=d.GetFunctionParameters();if(c.length<e.length){c=c.slice(0);do c.push(e[c.length].GetInitialValue());while(c.length<e.length)}e=d.GetEventBlock();return e.RunAsExpressionFunctionCall(e.GetSolModifiersIncludingParents(),d.GetReturnType(),d.GetDefaultReturnValue(),...c)}}}"use strict";
{const f=self.C3;f.EventSheet=class extends f.DefendedBase{constructor(b,a){super();this._eventSheetManager=b;this._runtime=b.GetRuntime();this._name=a[0];this._events=[];this._triggers=new Map;this._fastTriggers=new Map;this._eventsByDisplayNumber=new Map;this._hasRun=!1;this._shallowIncludes=[];this._deepIncludes=[];this._alreadyIncludedSheets=new Set;for(const d of a[1])this._CreateEvent(d,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0,
children:[]}:null}Release(){this._runtime=this._eventSheetManager=null}_CreateEvent(b,a,d){switch(b[0]){case 0:case 3:this._CreateEventBlock(b,a,d);break;case 1:this._CreateEventVariable(b,a,d);break;case 2:this._CreateInclude(b,a,d);break;case 4:this._CreateFunctionBlock(b,a);break;case 5:this._CreateScriptBlock(b,a,d);break;default:throw Error("invalid event type");}}_CreateEventBlock(b,a,d){b=f.EventBlock.Create(this,a,b);if(b.IsOrBlock()){d.push(b);d=b.GetConditions();for(let c=0,e=d.length;c<
e;++c)d[c].IsTrigger()&&this._InitTrigger(b,c)}else b.IsTrigger()?this._InitTrigger(b,0):d.push(b)}_CreateFunctionBlock(b,a){b=f.FunctionBlock.Create(this,a,b);this._eventSheetManager._RegisterFunctionBlock(b)}_CreateEventVariable(b,a,d){b=f.EventVariable.Create(this,a,b);d.push(b)}_CreateInclude(b,a,d){b=f.EventInclude.Create(this,a,b);d.push(b)}_CreateScriptBlock(b,a,d){b=f.EventScript.Create(this,a,b);d.push(b)}_InitTrigger(b,a){b.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(b);var d=
b.GetConditionAt(a),c=d._GetFunc(),e=d.GetObjectClass();if(d.IsFastTrigger()){var g=this._fastTriggers.get(e);g||(g=new Map,this._fastTriggers.set(e,g));d=d.GetFastTriggerValue().toLowerCase();e=g.get(c);e||(e=new Map,g.set(c,e));c=e.get(d);c||(c=[],e.set(d,c));c.push([b,a])}else g=this._triggers.get(e),g||(g={methodMap:new Map,behaviors:new Map},this._triggers.set(e,g)),(e=d.GetBehaviorType())?(d=g.behaviors.get(e),d||(d=new Map,g.behaviors.set(e,d))):d=g.methodMap,g=d.get(c),g||(g=[],d.set(c,g)),
g.push([b,a])}_PostInit(){const b=this._events;for(let a=0,d=b.length;a<d;++a){const c=a<d-1&&b[a+1]instanceof f.EventBlock&&b[a+1].IsElseBlock();b[a]._PostInit(c)}}_AddShallowInclude(b){this._shallowIncludes.push(b)}_UpdateDeepIncludes(){f.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(b){const a=b._deepIncludes,d=b._alreadyIncludedSheets;for(const c of this._shallowIncludes){const e=c.GetIncludeSheet();c.IsActive()&&b!==e&&!d.has(e)&&
(d.add(e),e._AddDeepIncludes(b),a.push(e))}}deepIncludes(){return this._deepIncludes}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetName(){return this._name}_RegisterEventByDisplayNumber(b,a){this._eventsByDisplayNumber.set(a,b)}_GetEventByDisplayNumber(b){return this._eventsByDisplayNumber.get(b)||null}_ResetHasRunFlag(){this._hasRun=!1}Run(){if(!this._hasRun){var b=this._runtime,a=b.IsCPUProfiling(),d=a?performance.now():0;this._hasRun=!0;var c=this.GetEventSheetManager(),
e=c.GetCurrentEventStackFrame();for(const g of this._events)g.Run(e),c.ClearSol(g.GetSolModifiers()),c.ClearAsyncActionPromises(),b.FlushPendingInstances();e.Reset(null);a&&(this._perfRecord.totalTimeCounter+=performance.now()-d)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var b=this._runtime,a=this.GetEventSheetManager(),d=a.GetCurrentEventStackFrame();for(const c of this._events)yield*c.DebugRun(d),a.ClearSol(c.GetSolModifiers()),a.ClearAsyncActionPromises(),b.FlushPendingInstances();d.Reset(null)}}_Trigger(b,
a,d){if(a){const c=a.GetObjectClass();this._TriggerForClass(b,a,c,d);for(const e of c.GetFamilies())this._TriggerForClass(b,a,e,d)}else return this._TriggerForClass(b,a,null,null)}_TriggerForClass(b,a,d,c){d=this._triggers.get(d);if(!d)return!1;c=c?d.behaviors.get(c):d.methodMap;if(!c)return!1;c=c.get(b);if(!c)return!1;b=!1;for(const [e,g]of c)c=this._ExecuteTrigger(a,e,g),b=b||c;return b}*_DebugTrigger(b,a,d){if(a){const c=a.GetObjectClass();yield*this._DebugTriggerForClass(b,a,c,d);for(const e of c.GetFamilies())yield*this._DebugTriggerForClass(b,
a,e,d)}else return yield*this._DebugTriggerForClass(b,a,null,null)}*_DebugTriggerForClass(b,a,d,c){d=this._triggers.get(d);if(!d)return!1;c=c?d.behaviors.get(c):d.methodMap;if(!c)return!1;c=c.get(b);if(!c)return!1;b=!1;for(const [e,g]of c)c=e.DebugCanRunFast()?this._ExecuteTrigger(a,e,g):yield*this._DebugExecuteTrigger(a,e,g),b=b||c;return b}_FastTrigger(b,a,d){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;d=b.get(d);if(!d)return!1;b=!1;for(let c=0,e=d.length;c<
e;++c)a=d[c],a=this._ExecuteTrigger(null,a[0],a[1]),b=b||a;return b}*_DebugFastTrigger(b,a,d){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;d=b.get(d);if(!d)return!1;b=!1;for(let e=0,g=d.length;e<g;++e){var c=d[e];a=c[0];c=c[1];a=a.DebugCanRunFast()?this._ExecuteTrigger(null,a,c):yield*this._DebugExecuteTrigger(null,a,c);b=b||a}return b}_ExecuteTrigger(b,a,d){const c=this._runtime,e=this._eventSheetManager,g=e.GetCurrentEvent(),k=e.GetEventStack(),m=e.GetTriggerDepth();
let p=!1;g&&e.PushCleanSol(g.GetSolModifiersIncludingParents());e.PushCleanSol(a.GetSolModifiersIncludingParents());const n=1<m;n&&e.GetLocalVarStack().Push();const u=k.Push(a);b&&(a.GetConditions()[d].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const q=a.GetTriggerParents();for(let r=0,t=q.length;r<t;++r)if(!q[r].RunPreTrigger(u)){b=!1;break}}b&&(c.IncrementExecCount(),a.IsOrBlock()?a.RunOrBlockTrigger(u,d):a.Run(u),p=
u.GetLastEventTrue());k.Pop();n&&e.GetLocalVarStack().Pop();e.PopSol(a.GetSolModifiersIncludingParents());g&&e.PopSol(g.GetSolModifiersIncludingParents());g||1!==m||e.IsFlushingBlocked()||c.FlushPendingInstances();return p}*_DebugExecuteTrigger(b,a,d){const c=this._runtime,e=this._eventSheetManager,g=e.GetCurrentEvent(),k=e.GetEventStack(),m=e.GetTriggerDepth();let p=!1;g&&e.PushCleanSol(g.GetSolModifiersIncludingParents());e.PushCleanSol(a.GetSolModifiersIncludingParents());const n=1<m;n&&e.GetLocalVarStack().Push();
const u=k.Push(a);b&&(a.GetConditions()[d].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const q=a.GetTriggerParents();for(let r=0,t=q.length;r<t;++r)if(!(yield*q[r].DebugRunPreTrigger(u))){b=!1;break}}b&&(c.IncrementExecCount(),a.IsOrBlock()?yield*a.DebugRunOrBlockTrigger(u,d):yield*a.DebugRun(u),p=u.GetLastEventTrue());k.Pop();n&&e.GetLocalVarStack().Pop();e.PopSol(a.GetSolModifiersIncludingParents());g&&e.PopSol(g.GetSolModifiersIncludingParents());
g||1!==m||e.IsFlushingBlocked()||c.FlushPendingInstances();return p}_GetPerfRecord(){return this._perfRecord}}}"use strict";
{const f=self.C3,b=[];function a(c,e){return!0}function*d(c,e){return!0}f.EventBlock=class extends f.DefendedBase{constructor(c,e,g){super();this._eventSheet=c;this._runtime=c.GetRuntime();this._parent=e;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=!1;this._isOrBlock=!!g[2];this._isElseBlock=
!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=a;this._DebugRunActions=d;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=g[4];this._displayNumber=g[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:g[3][0],isBreakable:g[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,
canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===g[0]&&this._InitGroup(g[1]);c=0;for(var k of g[6])e=f.Condition.Create(this,k,c++),this._conditions.push(e),this._AddSolModifier(e.GetObjectClass());c=0;for(const m of g[7])k=f.Action.Create(this,m,c++),this._actions.push(k);if(9===g.length){g=g[8];for(const m of g)this._eventSheet._CreateEvent(m,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&&
this._conditions[0]._GetFunc()===f.Plugins.System.Cnds.Else);0===this._conditions.length&&(this._conditions=b);0===this._actions.length&&(this._actions=b);0===this._subEvents.length&&(this._subEvents=b)}static Create(c,e,g){return f.New(f.EventBlock,c,e,g)}_InitGroup(c){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!c[0];this._groupName=c[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);this._runtime.IsDebug()&&(this._perfRecord={type:"group",
name:c[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(c){this._containedIncludes.push(c)}_AddContainerSolModifierToList(c,e){for(const g of c.GetContainer().objectTypes())e.includes(g)||e.push(g)}_AddSolModifierToList(c,e){if(c)if(e.includes(c)||e.push(c),c.IsFamily())for(const g of c.GetFamilyMembers())g.IsInContainer()&&this._AddContainerSolModifierToList(g,e);else c.IsInContainer()&&this._AddContainerSolModifierToList(c,e)}_AddSolModifier(c){this._AddSolModifierToList(c,this._solModifiers)}_AddParentSolModifier(c){this._AddSolModifierToList(c,
this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(c){this._hasElseBlock=!!c;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const g of this._conditions)g._PostInit();if(0<this._actions.length){c=!1;for(var e of this._actions)e._PostInit(),e.HasReturnType()&&(c=!0);c?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions=
this._DebugRunActions_Fast)}e=this._subEvents;for(let g=0,k=e.length;g<k;++g)c=g<k-1&&e[g+1]instanceof f.EventBlock&&e[g+1].IsElseBlock(),e[g]._PostInit(c);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let c=this.GetParent();for(;c;){if(c.IsGroup())return c;c=c.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const c=this._debugData;c.canRunAllConditionsFast=
this._conditions.every(e=>e.DebugCanRunFast());c.canRunAllActionsFast=this._actions.every(e=>e.DebugCanRunFast());c.canRunAllSubEventsFast=this._subEvents.every(e=>e.DebugCanRunFast());c.canRunSelfFast=c.canRunAllConditionsFast&&c.canRunAllActionsFast&&c.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let c=this;do c._UpdateCanRunFast(),c=c.GetParent();while(c)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var c=this.GetParent();for(this._isTopLevelGroup=!0;c;){if(!c.IsGroup()){this._isTopLevelGroup=
!1;break}c=c.GetParent()}}}_IdentifySolModifiersIncludingParents(){var c=this._runtime.GetAllObjectClasses();if(this._solModifiers===c)this._solModifiersIncludingParents=c;else{this._solModifiersIncludingParents=f.cloneArray(this._solModifiers);for(c=this.GetParent();c;){for(var e of c._solModifiers)this._AddParentSolModifier(e);c=c.GetParent()}e=this.GetEventSheetManager();this._solModifiers=e._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=e._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=
[];for(var c=this.GetParent();c;)this._triggerParents.push(c),c=c.GetParent();this._triggerParents.reverse()}}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds=!0;this._parent&&this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){this._hasGotSolModifiersIncludingParents||(this._hasGotSolModifiersIncludingParents=!0,this._IdentifySolModifiersIncludingParents());return this._solModifiersIncludingParents}HasSolModifier(c){return this._solModifiers.includes(c)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(c){this._scopeParent=
c}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(c){this._debugData.isBreakpoint=!!c;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(c){c=
!!c;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==c){this._isGroupActive=c;for(const e of this._containedIncludes)e.UpdateActive();this._containedIncludes.length&&(c=this._runtime.GetCurrentLayout().GetEventSheet())&&c._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&&this._scopeParent instanceof f.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||
this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(c){c=Math.floor(c);if(0>c||c>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[c]}GetConditionByDebugIndex(c){return this.GetConditionAt(c)}IsFirstConditionOfType(c){let e=c.GetIndex();if(0===e)return!0;for(--e;0<=e;--e)if(this._conditions[e].GetObjectClass()===c.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(c){c=
Math.floor(c);if(0>c||c>=this._actions.length)throw new RangeError("invalid action index");return this._actions[c]}GetActionByDebugIndex(c){c=Math.floor(c);const e=this._actions.find(g=>g.GetDebugIndex()===c);if(!e)throw new RangeError("invalid action debug index");return e}_HasActionIndex(c){c=Math.floor(c);return 0<=c&&c<this._actions.length}GetSubEvents(){return this._subEvents}_GetAllLocalVariablesInScope(){return this._subEvents.filter(c=>c instanceof f.EventVariable)}RunPreTrigger(c){c.SetCurrentEvent(this);
let e=!1;const g=this._conditions;for(let k=0,m=g.length;k<m;++k){const p=g[k];c.SetConditionIndex(k);if(p.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(p.Run())e=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?e:!0}RunOrBlockTrigger(c,e){c.SetCurrentEvent(this);this._conditions[e].Run()&&(this._RunActions(c,0)&&this._RunSubEvents(c),c.SetLastEventTrue(!0))}*DebugRunPreTrigger(c){c.SetCurrentEvent(this);let e=!1;const g=this._conditions;for(let k=0,m=g.length;k<
m;++k){const p=g[k];c.SetConditionIndex(k);if(p.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(p.DebugCanRunFast()?p.Run():yield*p.DebugRun())e=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?e:!0}*DebugRunOrBlockTrigger(c,e){c.SetCurrentEvent(this);e=this._conditions[e];if(e.DebugCanRunFast()?e.Run():yield*e.DebugRun())(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():
yield*this._DebugRunSubEvents()),c.SetLastEventTrue(!0)}Run(c){c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(c):this._RunAndBlock(c)}*DebugRun(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(c):yield*this._DebugRunAndBlock(c)}_RunOrBlock(c){const e=this._conditions;let g=0===e.length;for(let m=0,p=e.length;m<p;++m){var k=
e[m];k.IsTrigger()||(c.SetConditionIndex(m),k=k.Run(),g=g||k)}c.SetLastEventTrue(g);g&&(this._RunActions(c,0)&&this._RunSubEvents(c),this._hasElseBlock&&c.SetElseBranchRan(!0))}*_DebugRunOrBlock(c){const e=this._conditions;let g=0===e.length;for(let m=0,p=e.length;m<p;++m){var k=e[m];k.IsTrigger()||(c.SetConditionIndex(m),k=k.DebugCanRunFast()?k.Run():yield*k.DebugRun(),g=g||k)}c.SetLastEventTrue(g);g&&((this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?
this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&c.SetElseBranchRan(!0))}_RunAndBlock(c){const e=this._conditions;for(let g=0,k=e.length;g<k;++g){const m=e[g];c.SetConditionIndex(g);if(!m.Run()){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);this._RunActions(c,0)&&this._RunSubEvents(c);c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}*_DebugRunAndBlock(c){const e=this._conditions;for(let g=0,k=e.length;g<k;++g){const m=e[g];c.SetConditionIndex(g);if(m.DebugCanRunFast()?
!m.Run():!(yield*m.DebugRun())){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}_RunActions_Fast(c,e){const g=this._actions;for(let k=e,m=g.length;k<m;++k)e=g[k],c.SetActionIndex(k),e.Run();return!0}*_DebugRunActions_Fast(c,e){const g=this._actions;for(let k=
e,m=g.length;k<m;++k)e=g[k],c.SetActionIndex(k),e.DebugCanRunFast()?e.Run():yield*e.DebugRun();return!0}_RunActions_ReturnValue(c,e){const g=this.GetEventSheetManager(),k=this._actions;for(let m=e,p=k.length;m<p;++m){e=k[m];c.SetActionIndex(m);const n=e.Run();if(e.CanBailOut()&&!0===n)return!1;e.IsAsync()&&n instanceof Promise&&g.AddAsyncActionPromise(n)}return!0}*_DebugRunActions_ReturnValue(c,e){const g=this.GetEventSheetManager(),k=this._actions;for(let m=e,p=k.length;m<p;++m){e=k[m];c.SetActionIndex(m);
let n;n=e.DebugCanRunFast()?e.Run():yield*e.DebugRun();if(e.CanBailOut()&&!0===n)return!1;e.IsAsync()&&n instanceof Promise&&g.AddAsyncActionPromise(n)}return!0}_ResumeActionsAndSubEvents(c){this._RunActions(c,c.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(c){if(yield*this._DebugRunActions(c,c.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var c=this.IsGroup()&&this._runtime.IsCPUProfiling(),e=c?performance.now():0,g=this._eventStack,
k=g.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(k):this._RunSubEvents_Fast(k);g.Pop();c&&(this._perfRecord.totalTimeCounter+=performance.now()-e)}}_RunSubEvents_SolWriterAfterCnds(c){const e=this._isGroup,g=this._isTopLevelGroup,k=this.GetEventSheetManager(),m=this._subEvents;for(let p=0,n=m.length,u=n-1;p<n;++p){const q=m[p],r=q.GetSolModifiers(),t=!g||!e&&p<u;t&&k.PushCopySol(r);q.Run(c);t?k.PopSol(r):k.ClearSol(r)}}_RunSubEvents_Fast(c){const e=this._subEvents;for(let g=
0,k=e.length;g<k;++g)e[g].Run(c)}*_DebugRunSubEvents(){if(this._subEvents.length){var c=this._eventStack,e=c.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(e):yield*this._DebugRunSubEvents_Fast(e);c.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(c){const e=this._isGroup,g=this._isTopLevelGroup,k=this.GetEventSheetManager(),m=this._subEvents;for(let p=0,n=m.length,u=n-1;p<n;++p){const q=m[p],r=q.GetSolModifiers(),t=!g||!e&&p<u;t&&k.PushCopySol(r);yield*q.DebugRun(c);
t?k.PopSol(r):k.ClearSol(r)}}*_DebugRunSubEvents_Fast(c){const e=this._subEvents;for(let g=0,k=e.length;g<k;++g)yield*e[g].DebugRun(c)}Retrigger(c,e){this._runtime.IncrementExecCount();e.ResetQuick();const g=this._conditions;if(!this.IsOrBlock())for(let k=c.GetConditionIndex()+1,m=g.length;k<m;++k)if(c=g[k],e.SetConditionIndex(k),!c.Run())return!1;this._RunActions(e,0)&&this._RunSubEvents(e);return!0}*DebugRetrigger(c,e){this._runtime.IncrementExecCount();e.ResetQuick();const g=this._conditions;if(!this.IsOrBlock())for(let k=
c.GetConditionIndex()+1,m=g.length;k<m;++k)if(c=g[k],e.SetConditionIndex(k),c.DebugCanRunFast()?!c.Run():!(yield*c.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(e,0):yield*this._DebugRunActions(e,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());return!0}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()&&this._debugData.canRunSelfFast}DebugCanRunActionsFast(){return!this._runtime.DebugBreakNext()&&this._debugData.canRunAllActionsFast}DebugCanRunSubEventsFast(){return!this._runtime.DebugBreakNext()&&
this._debugData.canRunAllSubEventsFast}_CheckParentsOKToRun(c){if(this.GetParent()){const e=this.GetTriggerParents();for(let g=0,k=e.length;g<k;++g)if(!e[g].RunPreTrigger(c))return!1}return!0}*_DebugCheckParentsOKToRun(c){if(this.GetParent()){const e=this.GetTriggerParents();for(let g=0,k=e.length;g<k;++g)if(!(yield*e[g].DebugRunPreTrigger(c)))return!1}return!0}_EvaluateFunctionCallParameters(c,e,g){0<e.length?g?(e=e.map(k=>k.Get(0)),c.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(e)):
this._scopeParent.EvaluateFunctionParameters(e):g&&c.GetLocalVarStack().Push()}RunAsFunctionCall(c,e){let g,k;const m=0<c.length;var p=this._runtime;const n=this._eventStack,u=p.GetEventSheetManager(),q=1<u._IncTriggerDepth();this._EvaluateFunctionCallParameters(u,e,q);m&&u.PushCleanSol(c);e=n.Push(this);this._CheckParentsOKToRun(e)&&(p.IncrementExecCount(),e.SetCurrentEvent(this),(p=this._scopeParent.IsAsync())&&([k,g]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(e),p&&this._scopeParent.MaybeFinishAsyncFunctionCall(k));
n.Pop();q&&u.GetLocalVarStack().Pop();m&&u.PopSol(c);u._DecTriggerDepth();return g}*DebugRunAsFunctionCall(c,e){let g,k;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const m=0<c.length;var p=this._runtime;const n=this._eventStack,u=p.GetEventSheetManager(),q=1<u._IncTriggerDepth();this._EvaluateFunctionCallParameters(u,e,q);m&&u.PushCleanSol(c);e=n.Push(this);if(yield*this._DebugCheckParentsOKToRun(e))p.IncrementExecCount(),e.SetCurrentEvent(this),(p=this._scopeParent.IsAsync())&&
([k,g]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(e),p&&this._scopeParent.MaybeFinishAsyncFunctionCall(k);n.Pop();q&&u.GetLocalVarStack().Pop();m&&u.PopSol(c);u._DecTriggerDepth();return g}RunAsMappedFunctionCall(c){const e=this.GetSolModifiersIncludingParents(),g=0<e.length,k=this._runtime,m=this._eventStack,p=k.GetEventSheetManager(),n=1<p._IncTriggerDepth();n&&p.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);g&&p.PushCleanSol(e);c=m.Push(this);
this._CheckParentsOKToRun(c)&&(k.IncrementExecCount(),c.SetCurrentEvent(this),this._RunAndBlock(c));m.Pop();n&&p.GetLocalVarStack().Pop();g&&p.PopSol(e);p._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const e=this.GetSolModifiersIncludingParents(),g=0<e.length,k=this._runtime,m=this._eventStack,p=k.GetEventSheetManager(),n=1<p._IncTriggerDepth();n&&p.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);g&&
p.PushCleanSol(e);c=m.Push(this);if(yield*this._DebugCheckParentsOKToRun(c))k.IncrementExecCount(),c.SetCurrentEvent(this),yield*this._DebugRunAndBlock(c);m.Pop();n&&p.GetLocalVarStack().Pop();g&&p.PopSol(e);p._DecTriggerDepth()}RunAsExpressionFunctionCall(c,e,g,...k){let m,p;const n=0<c.length,u=this._runtime,q=this._eventStack,r=u.GetEventSheetManager(),t=1<r._IncTriggerDepth();t&&r.GetLocalVarStack().Push();0<k.length&&this._scopeParent.SetFunctionParameters(k);n&&r.PushCleanSol(c);k=q.Push(this);
k.InitCallFunctionExpression(e,g);q.PushExpFunc(k);u.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(k)&&(u.IncrementExecCount(),k.SetCurrentEvent(this),(e=this._scopeParent.IsAsync())&&([p,m]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(k),e&&this._scopeParent.MaybeFinishAsyncFunctionCall(p));u.SetDebuggingEnabled(!0);q.Pop();q.PopExpFunc();t&&r.GetLocalVarStack().Pop();n&&r.PopSol(c);r._DecTriggerDepth();return m||k.GetFunctionReturnValue()}}}"use strict";
{const f=self.C3,b=[];let a=!1;f.EventScript=class extends f.DefendedBase{constructor(d,c,e){super();const g=d.GetRuntime(),k=d.GetEventSheetManager();this._eventSheet=d;this._eventSheetManager=k;this._runtime=d.GetRuntime();this._parent=c;this._func=g.GetObjectReference(e[1]);this._displayNumber=e[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=g.IsDebug()?{isBreakpoint:e[3][0],isBreakable:e[3][1]}:null}static Create(d,c,e){return f.New(f.EventScript,d,
c,e)}_PostInit(){const d=this._func,c=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=d.bind(null,this._runtime.GetIRuntime(),c)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(d){this._debugData.isBreakpoint=
!!d}IsElseBlock(){return!1}GetSolModifiers(){return b}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():b}Run(d){d.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(d){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",d),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
a||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),a=!0)}}*DebugRun(d){d.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(d)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return a}static SetHadUserScriptException(){a=!0}}}"use strict";
{const f=self.C3;f.FunctionBlock=class extends f.DefendedBase{constructor(b,a,d){super();this._eventSheet=b;this._runtime=b.GetRuntime();this._parent=a;const c=d[1];this._functionName=c[0];this._returnType=c[1];this._functionParameters=c[2].map(e=>f.EventVariable.Create(b,this,e));this._isEnabled=c[3];this._isAsync=c[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=f.EventBlock.Create(b,a,d);this._eventBlock._SetScopeParent(this)}static Create(b,a,d){return f.New(f.FunctionBlock,
b,a,d)}_PostInit(){for(const b of this._functionParameters)b._PostInit();this._eventBlock._PostInit(!1)}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}EvaluateFunctionParameters(b){const a=this._functionParameters;for(let d=0,c=a.length;d<c;++d)a[d].SetValue(b[d].Get(0))}SetFunctionParameters(b){const a=this._functionParameters;for(let d=0,c=a.length;d<c;++d)a[d].SetValue(b[d])}CaptureFunctionParameters(){return this._functionParameters.map(b=>
b.GetValue())}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetFunctionName(){return this._functionName}GetReturnType(){return this._returnType}IsEnabled(){return this._isEnabled}GetDefaultReturnValue(){switch(this._returnType){case 0:return null;case 2:return"";default:return 0}}GetEventBlock(){return this._eventBlock}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const b=this._nextAsyncId++;this._currentAsyncId=b;let a;const d=new Promise(c=>a=c);this._asyncMap.set(b,
{resolve:a,pauseCount:0});return[b,d]}MaybeFinishAsyncFunctionCall(b){const a=this._asyncMap.get(b);0===a.pauseCount&&(a.resolve(),this._asyncMap.delete(b));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){this._asyncMap.get(this._currentAsyncId).pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(b){this._currentAsyncId=b;this._asyncMap.get(b).pauseCount--}}}"use strict";
{const f=self.C3,b=[];f.EventVariable=class extends f.DefendedBase{constructor(a,d,c){super();const e=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=e;this._runtime=a.GetRuntime();this._parent=d;this._localVarStack=e.GetLocalVarStack();this._name=c[1];this._type=c[2];this._initialValue=c[3];this._isStatic=!!c[4];this._isConstant=!!c[5];this._isFunctionParameter=d instanceof f.FunctionBlock;this._sid=c[6];this._jsPropName=this._runtime.GetJsPropName(c[8]);this._scriptSetter=g=>
this.SetValue(g);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;this.IsBoolean()&&(this._value=this._value?1:0);!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=e._GetNextLocalVarIndex(this));e._RegisterEventVariable(this)}static Create(a,d,c){return f.New(f.EventVariable,a,d,c)}_PostInit(){}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return 0===
this._type}IsString(){return 1===this._type}IsBoolean(){return 2===this._type}IsElseBlock(){return!1}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return b}Run(a){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(a){this.Run(a)}SetValue(a){this.IsNumber()?"number"!==typeof a&&(a=parseFloat(a)):this.IsString()?"string"!==typeof a&&(a=a.toString()):this.IsBoolean()&&(a=a?1:0);this._hasSingleValue?
this._value=a:this._localVarStack.GetCurrent()[this._localIndex]=a}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let a=this.GetValue();this.IsBoolean()&&(a=!!a);return a}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}}"use strict";
{const f=self.C3,b=[];f.EventInclude=class extends f.DefendedBase{constructor(a,d,c){super();const e=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=e;this._runtime=a.GetRuntime();this._parent=d;this._includeSheet=null;this._includeSheetName=c[1];this._isActive=!0}static Create(a,d,c){return f.New(f.EventInclude,a,d,c)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let a=this.GetParent();
for(;a;)a instanceof f.EventBlock&&a.IsGroup()&&a._AddContainedInclude(this),a=a.GetParent();this.UpdateActive();this._runtime.IsDebug()&&this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return b}GetIncludeSheet(){return this._includeSheet}Run(a){a=!!this.GetParent();const d=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(d);this._includeSheet.Run();a&&this._eventSheetManager.PopSol(d)}*DebugRun(a){a=
!!this.GetParent();const d=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(d);yield*this._includeSheet.DebugRun();a&&this._eventSheetManager.PopSol(d)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let a=this.GetParent();for(;a;){if(a instanceof f.EventBlock&&a.IsGroup()&&!a.IsGroupActive()){this._isActive=!1;return}a=a.GetParent()}this._isActive=!0}}}"use strict";
{const f=self.C3;f.ExpNode=class extends f.DefendedBase{constructor(m){super();this._owner=m;this._runtime=m.GetRuntime()}_PostInit(){}static CreateNode(m,p){return f.New([g,c,e,k,b,a][p[0]],m,p)}};class b extends f.ExpNode{constructor(m,p){super(m);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(p[1]);this._func!==f.Plugins.System.Exps.random&&this._func!==f.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,
this._systemPlugin)}}class a extends f.ExpNode{constructor(m,p){super(m);this._functionBlock=null;this._functionName=p[1];this._owner.SetVariesPerInstance()}_PostInit(){const m=this._runtime.GetEventSheetManager();this._functionBlock=m.GetFunctionBlockByName(this._functionName);this._functionName=null;const p=this._owner.GetEventBlock(),n=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...p.GetSolModifiersIncludingParents(),...n.GetSolModifiersIncludingParents()])];this._combinedSolModifiers=
m._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const m=this._functionBlock;if(m.IsEnabled()){const p=m.GetEventBlock();return f.EventBlock.prototype.RunAsExpressionFunctionCall.bind(p,this._combinedSolModifiers,m.GetReturnType(),m.GetDefaultReturnValue())}{const p=m.GetDefaultReturnValue();return()=>p}}}function d(m,p){if(m>=p)return m%p;0>m&&(m<=-p&&(m%=p),0>m&&(m+=p));return m}class c extends f.ExpNode{constructor(m,p){super(m);this._objectClass=this._runtime.GetObjectClassByIndex(p[1]);
this._func=this._runtime.GetObjectReference(p[2]);this._returnsString=!!p[3];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}GetBoundMethod(){return this._objectClass.GetPlugin()._GetBoundACEMethod(this._func,this._objectClass.GetSingleGlobalInstance().GetSdkInstance())}ExpObject(...m){const p=this._objectClass,n=p.GetCurrentSol().GetExpressionInstances();var u=n.length;if(0===u)return this._returnsString?"":0;u=d(this._owner.GetSolIndex(),
u);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(p);return this._func.apply(n[u].GetSdkInstance(),m)}ExpObject_InstExpr(m,...p){const n=this._objectClass,u=n.GetInstances(),q=u.length;if(0===q)return this._returnsString?"":0;m=d(m,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(n);return this._func.apply(u[m].GetSdkInstance(),p)}}class e extends f.ExpNode{constructor(m,p){super(m);this._objectClass=this._runtime.GetObjectClassByIndex(p[1]);this._varIndex=p[3];
this._returnsString=!!p[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const m=this._objectClass.GetCurrentSol().GetExpressionInstances();var p=m.length;if(0===p)return this._returnsString?"":0;p=d(this._owner.GetSolIndex(),p);return m[p]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var m=this._objectClass,p=m.GetCurrentSol().GetExpressionInstances(),n=p.length;if(0===n)return this._returnsString?"":0;n=d(this._owner.GetSolIndex(),n);p=p[n];m=p.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex());
return p._GetInstanceVariableValueUnchecked(this._varIndex+m)}ExpInstVar_InstExpr(m){const p=this._objectClass;var n=p.GetInstances();const u=n.length;if(0===u)return this._returnsString?"":0;m=d(m,u);n=n[m];m=0;p.IsFamily()&&(m=n.GetObjectClass().GetFamilyInstanceVariableOffset(p.GetFamilyIndex()));return n._GetInstanceVariableValueUnchecked(this._varIndex+m)}}class g extends f.ExpNode{constructor(m,p){super(m);this._objectClass=this._runtime.GetObjectClassByIndex(p[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(p[2]);
this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(p[2]);this._func=this._runtime.GetObjectReference(p[3]);this._returnsString=!!p[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...m){const p=this._objectClass;var n=p.GetCurrentSol().GetExpressionInstances(),u=n.length;if(0===u)return this._returnsString?"":0;u=d(this._owner.GetSolIndex(),u);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(p);
n=n[u];u=0;p.IsFamily()&&(u=n.GetObjectClass().GetFamilyBehaviorOffset(p.GetFamilyIndex()));return this._func.apply(n.GetBehaviorInstances()[this._behaviorIndex+u].GetSdkInstance(),m)}ExpBehavior_InstExpr(m,...p){const n=this._objectClass;var u=n.GetInstances();const q=u.length;if(0===q)return this._returnsString?"":0;m=d(m,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(n);u=u[m];m=0;n.IsFamily()&&(m=u.GetObjectClass().GetFamilyBehaviorOffset(n.GetFamilyIndex()));return this._func.apply(u.GetBehaviorInstances()[this._behaviorIndex+
m].GetSdkInstance(),p)}}class k extends f.ExpNode{constructor(m,p){super(m);this._eventVar=null;this._eventVarSid=p[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}}"use strict";
{const f=self.C3;f.Parameter=class extends f.DefendedBase{constructor(z,D,G){super();this._owner=z;this._index=G;this._type=D;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(z,D,G){const w=D[0];return f.New([a,d,n,e,k,c,m,a,e,e,u,q,n,t,d,p,g,r,x][w],z,w,G,D)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(z){this._variesPerInstance||!z||z.GetPlugin().IsSingleGlobal()||(this._variesPerInstance=!0)}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}};
function b(z){z=self.C3_ExpressionFuncs[z];if(!z)throw Error("invalid expression number");return z}class a extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._solIndex=0;z=w[1];this._expressionNumber=z[0];this._numberedNodes=[];this._expressionFunc=null;for(let B=1,I=z.length;B<I;++B)this._numberedNodes.push(f.ExpNode.CreateNode(this,z[B]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=b(this._expressionNumber),this._isConstant=!0)}_GetNode(z){if(0>z||z>=this._numberedNodes.length)throw new RangeError("invalid numbered node");
return this._numberedNodes[z]}_PostInit(){for(var z of this._numberedNodes)z._PostInit();z=b(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?z(this):z}GetSolIndex(){return this._solIndex}GetExpression(z){this._solIndex=z;return this._expressionFunc()}}class d extends a{constructor(z,D,G,w){super(z,D,G,w);this.Get=this.GetStringExpression;14===D&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof f.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(z){this._solIndex=
z;z=this._expressionFunc();return"string"===typeof z?z:""}_GetFastTriggerValue(){return b(this._expressionNumber)()}}class c extends a{constructor(z,D,G,w){super(z,D,G,w);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(z){this._solIndex=z;z=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(z)}}class e extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._combo=w[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class g extends f.Parameter{constructor(z,
D,G,w){super(z,D,G);this._bool=w[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class k extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._objectClass=this.GetRuntime().GetObjectClassByIndex(w[1]);this.Get=this.GetObjectClass;z=this.GetEventBlock();z._AddSolModifier(this._objectClass);this._owner instanceof f.Action?z.SetSolWriterAfterCnds():z.GetParent()&&z.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}}
class m extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(w[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class p extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(w[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class n extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._fileInfo=
w[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class u extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._instVarIndex=w[1];(z=this._owner.GetObjectClass())&&z.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(z){z=z||0;const D=this._owner.GetObjectClass();var G=D.GetCurrentSol();const w=G.GetInstances();
if(w.length)z=w[z%w.length].GetObjectClass();else if(G.HasAnyElseInstances())G=G.GetElseInstances(),z=G[z%G.length].GetObjectClass();else if(0<D.GetInstanceCount())G=D.GetInstances(),z=G[z%G.length].GetObjectClass();else return 0;return this._instVarIndex+z.GetFamilyInstanceVariableOffset(D.GetFamilyIndex())}}class q extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._eventVarSid=w[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}}
class r extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._functionBlockName=w[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=!0}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}}class t extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let B=1,I=w.length;B<
I;++B)z=f.Parameter.Create(this._owner,w[B],0),this._subParams.push(z),this._variadicRet.push(0),z.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const z of this._subParams)z._PostInit()}GetVariadic(){const z=this._subParams,D=this._variadicRet;for(let G=0,w=z.length;G<w;++G)D[G]=z[G].Get(0);return D}}class x extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._easeIndex=w[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}}"use strict";
{const f=self.C3;function b(c,e){for(let g=0,k=c.length;g<k;++g)e[g]=c[g].Get(0)}const a=[],d=function(){};f.Condition=class extends f.DefendedBase{constructor(c,e,g){super();this._eventBlock=c;this._runtime=c.GetRuntime();this._index=g;this._func=this._runtime.GetObjectReference(e[1]);this._isTrigger=0<e[3];this._isFastTrigger=2===e[3];this._isLooping=!!e[4];this._isInverted=!!e[5];this._isStatic=!!e[6];this._sid=e[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType=this._objectClass=
null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=d;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:e[8][0],canDebug:e[8][1]}:null;-1===e[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(e[0]),e[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(e[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(e[2])),
this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===e.length){c=e[9];for(let k of c)this._parameters.push(f.Parameter.Create(this,k,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(c,e,g){return f.New(f.Condition,c,e,g)}_PostInit(){for(const c of this._parameters)c._PostInit(),c.VariesPerInstance()&&(this._anyParamVariesPerInstance=
!0);this._isFastTrigger?(this.Run=this._RunFastTrigger,this.DebugRun=this._DebugRunFastTrigger):this._systemPlugin?(this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this._isStatic?(this.Run=this._RunStatic,this.DebugRun=this._DebugRunStatic):(this.Run=this._RunObject,this.DebugRun=this._DebugRunObject)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const c=this._objectClass.GetPlugin(),e=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(c,e,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(c,e,g){const k=this._func,m=this._isInverted,p=this._parameters;if(0===p.length){const n=c._GetBoundACEMethod(k,e);this.Run=m?function(){return f.xor(n(),m)}:n}else if(1===p.length){const n=p[0];if(!m&&n.IsConstant())this.Run=c._GetBoundACEMethod_1param(k,
e,n.Get(0));else{const u=c._GetBoundACEMethod(k,e);this.Run=function(){return f.xor(u(n.Get(0)),m)}}}else if(2===p.length){const n=p[0],u=p[1];if(!m&&n.IsConstant()&&u.IsConstant())this.Run=c._GetBoundACEMethod_2params(k,e,n.Get(0),u.Get(0));else{const q=c._GetBoundACEMethod(k,e);this.Run=function(){return f.xor(q(n.Get(0),u.Get(0)),m)}}}else if(3===p.length){const n=p[0],u=p[1],q=p[2];if(!m&&n.IsConstant()&&u.IsConstant()&&q.IsConstant())this.Run=c._GetBoundACEMethod_3params(k,e,n.Get(0),u.Get(0),
q.Get(0));else{const r=c._GetBoundACEMethod(k,e);this.Run=function(){return f.xor(r(n.Get(0),u.Get(0),q.Get(0)),m)}}}else this.Run=g}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(c){this._debugData.isBreakpoint=
!!c;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const c=this._results;b(this._parameters,c);return f.xor(this._func.apply(this._systemPlugin,c),
this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);c=this._func.apply(this._systemPlugin,c);f.IsIterator(c)&&(c=yield*c);return f.xor(c,this._isInverted)}return this.Run()}_RunSingleGlobal(){const c=this._results;b(this._parameters,c);const e=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return f.xor(this._func.apply(e,c),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);const e=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();c=this._func.apply(e,c);f.IsIterator(c)&&(c=yield*c);return f.xor(c,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var c=this._results;b(this._parameters,c);c=this._func.apply(this._behaviorType||
this._objectClass,c);this._objectClass.ApplySolToContainer();return c}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);c=this._func.apply(this._behaviorType||this._objectClass,c);f.IsIterator(c)&&(c=yield*c);this._objectClass.ApplySolToContainer();return c}return this.Run()}_RunObject(){const c=this._parameters,e=this._results,g=this._objectClass.GetCurrentSol();for(let k=0,m=c.length;k<
m;++k){const p=c[k];p.VariesPerInstance()||(e[k]=p.Get(0))}return g.IsSelectAll()?this._RunObject_FirstFilter(g):this._RunObject_NextFilter(g)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(c){const e=this._parameters,g=this._results;for(let k=0,m=e.length;k<m;++k){const p=e[k];p.VariesPerInstance()&&(g[k]=p.Get(c))}}_RunObject_FirstFilter(c){const e=this._objectClass,g=e.IsFamily(),k=e.GetFamilyIndex(),m=this._behaviorIndex,
p=0<=m,n=e.GetInstances(),u=this._anyParamVariesPerInstance,q=this._results,r=this._func,t=this._isInverted,x=this._isInOrBlock&&!this._isTrigger;c.ClearArrays();for(let D=0,G=n.length;D<G;++D){const w=n[D];u&&this._EvaluateVaryingParameters(D);var z=void 0;p?(z=g?w.GetObjectClass().GetFamilyBehaviorOffset(k):0,z=r.apply(w.GetBehaviorInstances()[m+z].GetSdkInstance(),q)):z=r.apply(w.GetSdkInstance(),q);f.xor(z,t)?c._PushInstance(w):x&&c._PushElseInstance(w)}e.FinishCondition(!0);c._SetSelectAll(!1);
e.ApplySolToContainer();return c.HasAnyInstances()}_RunObject_NextFilter(c){const e=this._objectClass;var g=e.IsFamily();const k=e.GetFamilyIndex(),m=e.IsInContainer(),p=this._behaviorIndex,n=0<=p,u=this._anyParamVariesPerInstance,q=this._results,r=this._func,t=this._isInverted,x=this._isInOrBlock&&!this._isTrigger,z=c._GetOwnInstances(),D=c._GetOwnElseInstances(),G=x&&!this._eventBlock.IsFirstConditionOfType(this),w=G?D:z;let B=0,I=!1;for(let E=0,J=w.length;E<J;++E){const O=w[E];u&&this._EvaluateVaryingParameters(E);
var P=void 0;n?(P=g?O.GetObjectClass().GetFamilyBehaviorOffset(k):0,P=r.apply(O.GetBehaviorInstances()[p+P].GetSdkInstance(),q)):P=r.apply(O.GetSdkInstance(),q);f.xor(P,t)?(I=!0,G?(z.push(O),m&&O._PushSiblingsToSolInstances()):(w[B]=O,m&&O._SetSiblingsToSolInstancesIndex(B),++B)):G?(w[B]=O,m&&O._SetSiblingsToSolElseInstancesIndex(B),++B):x&&(D.push(O),m&&O._PushSiblingsToSolElseInstances())}f.truncateArray(w,B);m&&e._TruncateContainerSols(G,B);g=I;G&&!I&&(I=this._OrBlockCheckInstances(z));e.FinishCondition(g||
x);return x?I:c.HasAnyInstances()}_OrBlockCheckInstances(c){var e=this._objectClass;const g=e.IsFamily();e=e.GetFamilyIndex();const k=this._anyParamVariesPerInstance,m=this._behaviorIndex,p=0<=m,n=this._results,u=this._func,q=this._isInverted;for(let t=0,x=c.length;t<x;++t){var r=c[t];k&&this._EvaluateVaryingParameters(t);if(p){const z=g?r.GetObjectClass().GetFamilyBehaviorOffset(e):0;r=u.apply(r.GetBehaviorInstances()[m+z].GetSdkInstance(),n)}else r=u.apply(r.GetSdkInstance(),n);if(f.xor(r,q))return!0}return!1}ReevaluateParameter(c,
e){return this._parameters[c].Get(e)}GetFastTriggerValue(){const c=this._parameters;if(!c.length)throw Error("no parameters");return c[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const c={};for(const [e,g]of this._savedData.entries()){let k=g;"collmemory"===e&&(k=[...g.entries()].map(m=>[m[0].GetUID(),m[1].GetUID(),m[2]]));c[e]=k}return{ex:c}}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);if(c){var e=this._runtime,
g=c.ex;if(g){c=this.GetSavedDataMap();c.clear();for(const [k,m]of Object.entries(g))g=m,"collmemory"===k&&(g=f.New(f.PairMap,m.map(p=>[e.GetInstanceByUID(p[0]),e.GetInstanceByUID(p[1]),p[2]]).filter(p=>p[0]&&p[1]))),c.set(k,g)}}}}}"use strict";
{const f=self.C3;function b(e,g){for(let k=0,m=e.length;k<m;++k)g[k]=e[k].Get(0)}const a=[],d=function(){},c=function*(){};f.Action=class extends f.DefendedBase{constructor(e,g,k){super();this._eventBlock=e;this._runtime=e=e.GetRuntime();this._index=k;this._sid=4<=g.length?g[3]:-1;this._actionReturnType=5<=g.length?g[4]:0;this._behaviorType=this._objectClass=this._func=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._combinedSolModifiers=this._callEventBlock=null;
this.DebugRun=this.Run=d;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const m=(k=-3===g[0])?g[2]:g[5];this._debugData=e.IsDebug()||k?{isBreakpoint:m[0],canDebug:m[1],index:m[2]}:null;-1===g[0]?(this._systemPlugin=e.GetSystemPlugin(),this._func=e.GetObjectReference(g[1])):-2===g[0]?this._callFunctionName=g[1]:k?(this._func=e.GetObjectReference(g[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=
1):(this._func=e.GetObjectReference(g[1]),this._objectClass=e.GetObjectClassByIndex(g[0]),g[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(g[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(g[2])));if(7===g.length){g=g[6];for(const p of g)this._parameters.push(f.Parameter.Create(this,p,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(e,
g,k){return f.New(f.Action,e,g,k)}_PostInit(){for(var e of this._parameters)e._PostInit(),e.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);if(this._systemPlugin)this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem;else if(this._callFunctionName)this._SetCallFunctionRunMethod(),this._callFunctionName="";else if(this.Run===this.RunUserScript){e=this._func;const g=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=e.bind(null,this._runtime.GetIRuntime(),
g)}else this._behaviorType?this.IsAsync()?(this.Run=this._RunBehavior_Async,this.DebugRun=this._DebugRunBehavior_Async):(this.Run=this._RunBehavior,this.DebugRun=this._DebugRunBehavior):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this.IsAsync()?(this.Run=this._RunObject_Async,this.DebugRun=this._DebugRunObject_Async):this._parameters.length?this._parameters.every(g=>g.VariesPerInstance())?(this.Run=this._RunObject_AllParamsVary,
this.DebugRun=this._DebugRunObject_AllParamsVary):this._anyParamVariesPerInstance?(this.Run=this._RunObject_SomeParamsVary,this.DebugRun=this._DebugRunObject_SomeParamsVary):this._parameters.every(g=>g.IsConstant())?(b(this._parameters,this._results),this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst):(this.Run=this._RunObject_ParamsDontVary,this.DebugRun=this._DebugRunObject_ParamsDontVary):(this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const e=this._objectClass.GetPlugin(),g=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(e,g,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const e=this._eventBlock.GetEventSheetManager(),g=e.GetFunctionBlockByName(this._callFunctionName);g.IsEnabled()?(this._callEventBlock=g.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],
this._combinedSolModifiers=e._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=f.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=d,this.DebugRun=c)}_SetRunMethodForBoundFunc(e,g,k){const m=this._func,p=this._parameters;if(0===p.length)this.Run=e._GetBoundACEMethod(m,g);else if(1===p.length){const n=p[0];if(n.IsConstant())this.Run=e._GetBoundACEMethod_1param(m,g,n.Get(0));
else{const u=e._GetBoundACEMethod(m,g);this.Run=function(){return u(n.Get(0))}}}else if(2===p.length){const n=p[0],u=p[1];if(n.IsConstant()&&u.IsConstant())this.Run=e._GetBoundACEMethod_2params(m,g,n.Get(0),u.Get(0));else{const q=e._GetBoundACEMethod(m,g);this.Run=function(){return q(n.Get(0),u.Get(0))}}}else if(3===p.length){const n=p[0],u=p[1],q=p[2];if(n.IsConstant()&&u.IsConstant()&&q.IsConstant())this.Run=e._GetBoundACEMethod_3params(m,g,n.Get(0),u.Get(0),q.Get(0));else{const r=e._GetBoundACEMethod(m,
g);this.Run=function(){return r(n.Get(0),u.Get(0),q.Get(0))}}}else this.Run=k}GetSID(){return this._sid}IsAsync(){return 1===this._actionReturnType}CanBailOut(){return 2===this._actionReturnType}HasReturnType(){return 0!==this._actionReturnType}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}GetCombinedSolModifiers(){return this._combinedSolModifiers}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(e){this._debugData.isBreakpoint=
!!e;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const e=this._results;b(this._parameters,e);return this._func.apply(this._systemPlugin,e)}*_DebugRunSystem(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results;b(this._parameters,e);return yield*this._func.apply(this._systemPlugin,e)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const e=this._results;b(this._parameters,e);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),
e)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results;b(this._parameters,e);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),e)}return this.Run()}_RunObject_ParamsConst(){const e=this._results,g=this._objectClass.GetCurrentSol().GetInstances();for(let k=0,m=g.length;k<m;++k)this._func.apply(g[k].GetSdkInstance(),e)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results,g=this._objectClass.GetCurrentSol().GetInstances();for(let k=0,m=g.length;k<m;++k)yield*this._func.apply(g[k].GetSdkInstance(),e)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const e=this._results;b(this._parameters,e);const g=this._objectClass.GetCurrentSol().GetInstances();for(let k=0,m=g.length;k<m;++k)this._func.apply(g[k].GetSdkInstance(),e)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results;b(this._parameters,e);const g=this._objectClass.GetCurrentSol().GetInstances();for(let k=0,m=g.length;k<m;++k)yield*this._func.apply(g[k].GetSdkInstance(),e)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const e=this._parameters,g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances();for(let p=0,n=m.length;p<n;++p){const u=m[p];for(let q=0,r=e.length;q<r;++q)g[q]=
e[q].Get(p);k.apply(u.GetSdkInstance(),g)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._parameters,g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances();for(let p=0,n=m.length;p<n;++p){const u=m[p];for(let q=0,r=e.length;q<r;++q)g[q]=e[q].Get(p);yield*k.apply(u.GetSdkInstance(),g)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const e=this._parameters,
g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances();for(let n=0,u=e.length;n<u;++n){var p=e[n];p.VariesPerInstance()||(g[n]=p.Get(0))}for(let n=0,u=m.length;n<u;++n){p=m[n];for(let q=0,r=e.length;q<r;++q){const t=e[q];t.VariesPerInstance()&&(g[q]=t.Get(n))}k.apply(p.GetSdkInstance(),g)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const g=this._parameters,k=this._results,m=this._func,
p=this._objectClass.GetCurrentSol().GetInstances();for(let n=0,u=g.length;n<u;++n){var e=g[n];e.VariesPerInstance()||(k[n]=e.Get(0))}for(let n=0,u=p.length;n<u;++n){e=p[n];for(let q=0,r=g.length;q<r;++q){const t=g[q];t.VariesPerInstance()&&(k[q]=t.Get(n))}yield*m.apply(e.GetSdkInstance(),k)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var e=this._objectClass;const g=e.IsFamily(),k=e.GetFamilyIndex(),m=this._parameters,p=this._anyParamVariesPerInstance,n=this._results,u=this._func,q=this._behaviorIndex;
e=e.GetCurrentSol().GetInstances();for(let x=0,z=m.length;x<z;++x){var r=m[x];r.VariesPerInstance()||(n[x]=r.Get(0))}for(let x=0,z=e.length;x<z;++x){r=e[x];if(p)for(let D=0,G=m.length;D<G;++D){var t=m[D];t.VariesPerInstance()&&(n[D]=t.Get(x))}t=g?r.GetObjectClass().GetFamilyBehaviorOffset(k):0;u.apply(r.GetBehaviorInstances()[q+t].GetSdkInstance(),n)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var e=this._objectClass;const m=
e.IsFamily(),p=e.GetFamilyIndex(),n=this._parameters,u=this._anyParamVariesPerInstance,q=this._results,r=this._func,t=this._behaviorIndex;e=e.GetCurrentSol().GetInstances();for(let x=0,z=n.length;x<z;++x){var g=n[x];g.VariesPerInstance()||(q[x]=g.Get(0))}for(let x=0,z=e.length;x<z;++x){g=e[x];if(u)for(let D=0,G=n.length;D<G;++D){var k=n[D];k.VariesPerInstance()&&(q[D]=k.Get(x))}k=m?g.GetObjectClass().GetFamilyBehaviorOffset(p):0;yield*r.apply(g.GetBehaviorInstances()[t+k].GetSdkInstance(),q)}}else this._RunBehavior()}_RunObject_Async(){const e=
this._parameters,g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances(),p=[];for(let n=0,u=m.length;n<u;++n){const q=m[n];for(let r=0,t=e.length;r<t;++r)g[r]=e[r].Get(n);p.push(k.apply(q.GetSdkInstance(),g))}return Promise.all(p)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._parameters,g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances(),p=[];for(let n=0,
u=m.length;n<u;++n){const q=m[n];for(let r=0,t=e.length;r<t;++r)g[r]=e[r].Get(n);p.push(yield*k.apply(q.GetSdkInstance(),g))}return Promise.all(p)}return this._RunObject_Async()}_RunBehavior_Async(){var e=this._objectClass;const g=e.IsFamily(),k=e.GetFamilyIndex(),m=this._parameters,p=this._results,n=this._func,u=this._behaviorIndex;e=e.GetCurrentSol().GetInstances();const q=[];for(let r=0,t=e.length;r<t;++r){const x=e[r];for(let D=0,G=m.length;D<G;++D)p[D]=m[D].Get(r);const z=g?x.GetObjectClass().GetFamilyBehaviorOffset(k):
0;q.push(n.apply(x.GetBehaviorInstances()[u+z].GetSdkInstance(),p))}return Promise.all(q)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var e=this._objectClass;const g=e.IsFamily(),k=e.GetFamilyIndex(),m=this._parameters,p=this._results,n=this._func,u=this._behaviorIndex;e=e.GetCurrentSol().GetInstances();const q=[];for(let r=0,t=e.length;r<t;++r){const x=e[r];for(let D=0,G=m.length;D<G;++D)p[D]=m[D].Get(r);const z=g?
x.GetObjectClass().GetFamilyBehaviorOffset(k):0;q.push(yield*n.apply(x.GetBehaviorInstances()[u+z].GetSdkInstance(),p))}return Promise.all(q)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(e){console.error(`Unhandled exception running script %c${this._eventBlock.GetEventSheet().GetName()}, event ${this._eventBlock.GetDisplayNumber()}, action ${this.GetDebugIndex()+1}:`,"font-size: 1.2em; font-weight: bold;",e),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
f.EventScript.HadUserScriptException()||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),f.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{ex:f.ToSuperJSON(this._savedData)}:null}_LoadFromJson(e){this._savedData&&
(this._savedData.clear(),this._savedData=null);e&&(e=e.ex)&&(this._savedData=f.FromSuperJSON(e))}}}"use strict";
{const f=self.C3,b=new f.Color;function a(L,N){return f.compare(this.GetWorldInfo().GetX(),L,N)}function d(L,N){return f.compare(this.GetWorldInfo().GetY(),L,N)}function c(){const L=this.GetWorldInfo();return L.IsInViewport(L.GetLayer().GetViewport())}function e(){var L=this.GetWorldInfo();const N=L.GetLayout();L=L.GetBoundingBox();return 0>L.getRight()||0>L.getBottom()||L.getLeft()>N.GetWidth()||L.getTop()>N.GetHeight()}function g(L,N,V){const aa=this.GetCurrentSol(),fa=aa.GetInstances();if(!fa.length)return!1;
let ha=fa[0];var da=ha.GetWorldInfo();let sa=ha,ta=f.distanceSquared(da.GetX(),da.GetY(),N,V);for(let ya=1,Ha=fa.length;ya<Ha;++ya)if(ha=fa[ya],da=ha.GetWorldInfo(),da=f.distanceSquared(da.GetX(),da.GetY(),N,V),0===L&&da<ta||1===L&&da>ta)ta=da,sa=ha;aa.PickOne(sa);return!0}function k(L){const N=this.GetWorldInfo();N.GetX()!==L&&(N.SetX(L),N.SetBboxChanged())}function m(L){const N=this.GetWorldInfo();N.GetY()!==L&&(N.SetY(L),N.SetBboxChanged())}function p(L,N){const V=this.GetWorldInfo();V.EqualsXY(L,
N)||(V.SetXY(L,N),V.SetBboxChanged())}function n(L,N){if(L&&(L=L.GetPairedInstance(this._inst))){var [V,aa]=L.GetImagePoint(N);N=this.GetWorldInfo();if(N.GetX()!==V||N.GetY()!==aa)N.SetXY(V,aa),N.SetBboxChanged()}}function u(L){if(0!==L){var N=this.GetWorldInfo();N.OffsetXY(N.GetCosAngle()*L,N.GetSinAngle()*L);N.SetBboxChanged()}}function q(L,N){if(0!==N){var V=this.GetWorldInfo();L=f.toRadians(L);V.OffsetXY(Math.cos(L)*N,Math.sin(L)*N);V.SetBboxChanged()}}function r(){return this.GetWorldInfo().GetX()}
function t(){return this.GetWorldInfo().GetY()}function x(){return this._runtime.GetDt(this._inst)}function z(L,N){return f.compare(this.GetWorldInfo().GetWidth(),L,N)}function D(L,N){return f.compare(this.GetWorldInfo().GetHeight(),L,N)}function G(L){const N=this.GetWorldInfo();N.GetWidth()!==L&&(N.SetWidth(L),N.SetBboxChanged())}function w(L){const N=this.GetWorldInfo();N.GetHeight()!==L&&(N.SetHeight(L),N.SetBboxChanged())}function B(L,N){const V=this.GetWorldInfo();if(V.GetWidth()!==L||V.GetHeight()!==
N)V.SetSize(L,N),V.SetBboxChanged()}function I(){return this.GetWorldInfo().GetWidth()}function P(){return this.GetWorldInfo().GetHeight()}function E(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function J(){return this.GetWorldInfo().GetBoundingBox().getTop()}function O(){return this.GetWorldInfo().GetBoundingBox().getRight()}function R(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function T(L,N){return f.angleDiff(this.GetWorldInfo().GetAngle(),f.toRadians(N))<=f.toRadians(L)}
function Y(L){return f.angleClockwise(this.GetWorldInfo().GetAngle(),f.toRadians(L))}function W(L,N){L=f.toRadians(L);N=f.toRadians(N);const V=this.GetWorldInfo().GetAngle();return f.angleClockwise(N,L)?f.angleClockwise(V,L)&&!f.angleClockwise(V,N):!(!f.angleClockwise(V,L)&&f.angleClockwise(V,N))}function ea(L){const N=this.GetWorldInfo();L=f.clampAngle(f.toRadians(L));isNaN(L)||N.GetAngle()===L||(N.SetAngle(L),N.SetBboxChanged())}function qa(L){if(!isNaN(L)&&0!==L){var N=this.GetWorldInfo();N.SetAngle(N.GetAngle()+
f.toRadians(L));N.SetBboxChanged()}}function ja(L){if(!isNaN(L)&&0!==L){var N=this.GetWorldInfo();N.SetAngle(N.GetAngle()-f.toRadians(L));N.SetBboxChanged()}}function xa(L,N){const V=this.GetWorldInfo(),aa=V.GetAngle();L=f.angleRotate(aa,f.toRadians(N),f.toRadians(L));isNaN(L)||aa===L||(V.SetAngle(L),V.SetBboxChanged())}function ua(L,N,V){const aa=this.GetWorldInfo(),fa=aa.GetAngle();N-=aa.GetX();V-=aa.GetY();L=f.angleRotate(fa,Math.atan2(V,N),f.toRadians(L));isNaN(L)||fa===L||(aa.SetAngle(L),aa.SetBboxChanged())}
function Da(L,N){const V=this.GetWorldInfo(),aa=V.GetAngle();L-=V.GetX();N-=V.GetY();N=Math.atan2(N,L);isNaN(N)||aa===N||(V.SetAngle(N),V.SetBboxChanged())}function Ea(){return f.toDegrees(this.GetWorldInfo().GetAngle())}function Ba(L,N){return f.compare(f.round6dp(100*this.GetWorldInfo().GetOpacity()),L,N)}function Aa(){return this.GetWorldInfo().IsVisible()}function ia(L){const N=this.GetWorldInfo();L=2===L?!N.IsVisible():0!==L;N.IsVisible()!==L&&(N.SetVisible(L),this._runtime.UpdateRender())}function Fa(L){L=
f.clamp(L/100,0,1);const N=this.GetWorldInfo();N.GetOpacity()!==L&&(N.SetOpacity(L),this._runtime.UpdateRender())}function wa(L){b.setFromRgbValue(L);L=this.GetWorldInfo();L.GetUnpremultipliedColor().equalsIgnoringAlpha(b)||(L.SetUnpremultipliedColor(b),this._runtime.UpdateRender())}function Ca(){const L=this.GetWorldInfo().GetUnpremultipliedColor();return f.PackRGBAEx(L.getR(),L.getG(),L.getB(),L.getA())}function Pa(){return f.round6dp(100*this.GetWorldInfo().GetOpacity())}function Qa(L){return L?
this.GetWorldInfo().GetLayer()===L:!1}function Ra(L){const N=this.GetCurrentSol(),V=N.GetInstances();if(!V.length)return!1;let aa=V[0];for(let fa=1,ha=V.length;fa<ha;++fa){const da=V[fa],sa=da.GetWorldInfo(),ta=aa.GetWorldInfo(),ya=sa.GetLayer().GetIndex(),Ha=ta.GetLayer().GetIndex();if(0===L){if(ya>Ha||ya===Ha&&sa.GetZIndex()>ta.GetZIndex())aa=da}else if(ya<Ha||ya===Ha&&sa.GetZIndex()<ta.GetZIndex())aa=da}N.PickOne(aa);return!0}function Ja(L,N,V){const aa=this.GetWorldInfo();L=0===L?aa.GetZElevation():
aa.GetTotalZElevation();return f.compare(L,N,V)}function Sa(){this.GetWorldInfo().ZOrderMoveToTop()}function Ta(){this.GetWorldInfo().ZOrderMoveToBottom()}function Ua(L){L&&this.GetWorldInfo().ZOrderMoveToLayer(L)}function Va(L,N){L=0===L;N&&(N=N.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(N,L)}function Wa(L){const N=this.GetWorldInfo();N.GetZElevation()!==L&&(N.SetZElevation(L),this._runtime.UpdateRender())}function Xa(){return this.GetWorldInfo().GetLayer().GetIndex()}
function Ya(){return this.GetWorldInfo().GetLayer().GetName()}function Ka(){return this.GetWorldInfo().GetZIndex()}function Za(){return this.GetWorldInfo().GetZElevation()}function $a(){return this.GetWorldInfo().GetTotalZElevation()}function ab(L,N){if(N=this.GetObjectClass().GetEffectList().GetEffectTypeByName(N)){N=N.GetIndex();L=1===L;var V=this.GetWorldInfo().GetInstanceEffectList();V.IsEffectIndexActive(N)!==L&&(V.SetEffectIndexActive(N,L),V.UpdateActiveEffects(),this._runtime.UpdateRender())}}
function bb(L,N,V){var aa=this.GetObjectClass().GetEffectList().GetEffectTypeByName(L);if(aa){L=aa.GetIndex();var fa=this.GetWorldInfo().GetInstanceEffectList(),ha=fa.GetEffectParametersForIndex(L);N=Math.floor(N);if(!(0>N||N>=ha.length)){aa=aa.GetShaderProgram().GetParameterType(N);if("color"===aa){b.setFromRgbValue(V);N=ha[N];if(b.equalsIgnoringAlpha(N))return;N.copyRgb(b)}else{"percent"===aa&&(V/=100);if(ha[N]===V)return;ha[N]=V}fa.IsEffectIndexActive(L)&&this._runtime.UpdateRender()}}}function cb(){return this.GetWorldInfo().HasParent()}
function db(){return this.GetWorldInfo().HasChildren()}function eb(L,N){const V=this.GetCurrentSol().GetInstances();if(0===V.length)return!1;const aa=L.GetCurrentSol();var fa=aa.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ha=new Set;for(let sa=0,ta=V.length;sa<ta;++sa){var da=V[sa];if(1===N)for(const ya of da.parents())ya.BelongsToObjectClass(L)&&fa.has(ya)&&ha.add(ya);else{if(0===N){if(da=da.GetParent(),null===da)continue}else da=da.GetTopParent();da.BelongsToObjectClass(L)&&fa.has(da)&&
ha.add(da)}}if(0===ha.size)return!1;aa.SetSetPicked(ha);L.ApplySolToContainer();return!0}function fb(L,N){const V=this.GetCurrentSol().GetInstances();if(0===V.length)return!1;const aa=L.GetCurrentSol();var fa=aa.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ha=new Set;for(let da=0,sa=V.length;da<sa;++da){const ta=V[da];2===N&&!ta.HasChildren()&&ta.BelongsToObjectClass(L)&&fa.has(ta)&&ha.add(ta);for(const ya of 0===N?ta.children():ta.allChildren())2===N&&ya.HasChildren()||ya.BelongsToObjectClass(L)&&
fa.has(ya)&&ha.add(ya)}if(0===ha.size)return!1;aa.SetSetPicked(ha);L.ApplySolToContainer();return!0}function gb(L,N){const V=this.GetCurrentSol().GetInstances();if(0===V.length)return!1;const aa=L.GetCurrentSol();var fa=aa.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ha=[];for(let da=0,sa=V.length;da<sa;++da){const ta=V[da].GetChildAt(N);null!==ta&&ta.BelongsToObjectClass(L)&&fa.has(ta)&&ha.push(ta)}if(0===ha.length)return!1;aa.SetArrayPicked(ha);L.ApplySolToContainer();return!0}
function hb(L,N){return f.compare(this._inst.GetChildCount(),L,N)}function ib(L,N,V,aa,fa,ha,da,sa){const ta=this._inst,ya=this._runtime.GetCurrentAction().GetObjectClass();for(const Ha of L.allCorrespondingInstances(ta,ya)){if(!Ha.GetPlugin().SupportsSceneGraph())break;ta.AddChild(Ha,{transformX:N,transformY:V,transformWidth:aa,transformHeight:fa,transformAngle:ha,transformZElevation:da,destroyWithParent:sa})}}function jb(L){const N=this._inst,V=this._runtime.GetCurrentAction().GetObjectClass();
for(const aa of L.allCorrespondingInstances(N,V))N.RemoveChild(aa)}function ma(){this._inst.HasParent()&&this._inst.GetParent().RemoveChild(this._inst)}function Ga(){return this._inst.GetChildCount()}function kb(L,N){L=Math.floor(L);N=Math.floor(N);const V=this.GetWorldInfo();2>L||2>N||!isFinite(L)||!isFinite(N)?(V.ReleaseMesh(),V.SetBboxChanged()):V.CreateMesh(L,N)}function lb(L,N,V,aa,fa,ha,da){const sa=this.GetWorldInfo();sa.SetMeshPoint(L,N,{mode:0===V?"absolute":"relative",x:aa,y:fa,u:ha,v:da})&&
sa.SetBboxChanged()}function mb(){const L=this.GetWorldInfo();return L.HasMesh()?L.GetSourceMesh().GetHSize():0}function nb(){const L=this.GetWorldInfo();return L.HasMesh()?L.GetSourceMesh().GetVSize():0}function ob(L){const N=this.GetWorldInfo();L=2===L?!N.IsVisible():0!==L;N.IsVisible()!==L&&N.SetVisible(L)}function pb(L,N){this.SetElementCSSStyle(L,N)}function La(L,N){this.SetElementAttribute(L,""+N)}function Ma(L){this.RemoveElementAttribute(L)}function Na(){this.FocusElement()}function Oa(){this.BlurElement()}
function Ia(){return this.IsElementFocused()}function h(L){this._SetEnabled(0!==L)}function l(){return this._IsEnabled()}function v(L,N,V){return f.compare(this.GetInstance().GetInstanceVariableValue(L),N,V)}function y(L){return!!this.GetInstance().GetInstanceVariableValue(L)}function A(L,N){const V=this.GetCurrentSol(),aa=V.GetInstances();if(!aa.length)return!1;let fa=aa[0],ha=fa,da=fa.GetInstanceVariableValue(N);for(let sa=1,ta=aa.length;sa<ta;++sa){fa=aa[sa];const ya=fa.GetInstanceVariableValue(N);
if(0===L&&ya<da||1===L&&ya>da)da=ya,ha=fa}V.PickOne(ha);return!0}function C(L){return this._runtime.GetCurrentCondition().IsInverted()?H(this,L):F(this,L)}function F(L,N){N=L.GetRuntime().GetInstanceByUID(N);if(!N)return!1;const V=L.GetCurrentSol();if(!V.IsSelectAll()&&!V._GetOwnInstances().includes(N))return!1;if(L.IsFamily()){if(N.GetObjectClass().BelongsToFamily(L))return V.PickOne(N),L.ApplySolToContainer(),!0}else if(N.GetObjectClass()===L)return V.PickOne(N),L.ApplySolToContainer(),!0;return!1}
function H(L,N){const V=L.GetCurrentSol();if(V.IsSelectAll()){V._SetSelectAll(!1);V.ClearArrays();var aa=L.GetInstances();for(let ha=0,da=aa.length;ha<da;++ha){var fa=aa[ha];fa.GetUID()===N?V._PushElseInstance(fa):V._PushInstance(fa)}L.ApplySolToContainer();return!!V._GetOwnInstances().length}aa=V._GetOwnInstances();fa=0;for(let ha=0,da=aa.length;ha<da;++ha){const sa=aa[ha];aa[fa]=sa;sa.GetUID()===N?V._PushElseInstance(sa):++fa}f.truncateArray(aa,fa);L.ApplySolToContainer();return!!aa.length}function K(){this._runtime.DestroyInstance(this._inst)}
function M(){return!0}function Q(){return!0}function S(L,N){this.GetInstance().SetInstanceVariableValue(L,N)}function X(L,N){const V=this.GetInstance(),aa=V.GetInstanceVariableValue(L);"number"===typeof aa&&"number"!==typeof N?N=parseFloat(N):"string"===typeof aa&&"string"!==typeof N&&(N=N.toString());V.SetInstanceVariableValue(L,aa+N)}function U(L,N){const V=this.GetInstance(),aa=V.GetInstanceVariableValue(L);"number"===typeof aa&&("number"!==typeof N&&(N=parseFloat(N)),V.SetInstanceVariableValue(L,
aa-N))}function ca(L,N){this.GetInstance().SetInstanceVariableValue(L,N?1:0)}function ba(L){const N=this.GetInstance();N.SetInstanceVariableValue(L,0===N.GetInstanceVariableValue(L)?1:0)}function Z(L){let N;try{N=JSON.parse(L)}catch(V){console.error("Failed to load from JSON string: ",V);return}this.GetInstance().LoadFromJson(N,"state")}function ra(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function la(){return this.GetInstance().GetObjectClass().GetName()}function oa(){const L=
this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let N=L.GetInstanceCount();const V=this._runtime._GetInstancesPendingCreate();for(const aa of V)L.IsFamily()?aa.GetObjectClass().BelongsToFamily(L)&&++N:aa.GetObjectClass()===L&&++N;return N}function pa(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}function na(){return this._inst.GetIID()}function za(){return this._inst.GetUID()}f.AddCommonACEs=function(L,N){const V=
L[1],aa=L[4],fa=L[5],ha=L[6],da=L[7],sa=L[8],ta=L[10],ya=L[11],Ha=L[12],qb=L[13],rb=L[14],va=N.Cnds,ka=N.Acts;N=N.Exps;L[3]&&(va.CompareX=a,va.CompareY=d,va.IsOnScreen=c,va.IsOutsideLayout=e,va.PickDistance=g,ka.SetX=k,ka.SetY=m,ka.SetPos=p,ka.SetPosToObject=n,ka.MoveForward=u,ka.MoveAtAngle=q,N.X=r,N.Y=t,N.dt=x);aa&&(va.CompareWidth=z,va.CompareHeight=D,ka.SetWidth=G,ka.SetHeight=w,ka.SetSize=B,N.Width=I,N.Height=P,N.BBoxLeft=E,N.BBoxTop=J,N.BBoxRight=O,N.BBoxBottom=R);fa&&(va.AngleWithin=T,va.IsClockwiseFrom=
Y,va.IsBetweenAngles=W,ka.SetAngle=ea,ka.RotateClockwise=qa,ka.RotateCounterclockwise=ja,ka.RotateTowardAngle=xa,ka.RotateTowardPosition=ua,ka.SetTowardPosition=Da,N.Angle=Ea);ha&&(va.IsVisible=Aa,va.CompareOpacity=Ba,ka.SetVisible=ia,ka.SetOpacity=Fa,ka.SetDefaultColor=wa,N.Opacity=Pa,N.ColorValue=Ca);da&&(va.IsOnLayer=Qa,va.PickTopBottom=Ra,va.CompareZElevation=Ja,ka.MoveToTop=Sa,ka.MoveToBottom=Ta,ka.MoveToLayer=Ua,ka.ZMoveToObject=Va,ka.SetZElevation=Wa,N.LayerNumber=Xa,N.LayerName=Ya,N.ZIndex=
Ka,N.ZElevation=Za,N.TotalZElevation=$a);sa&&(ka.SetEffectEnabled=ab,ka.SetEffectParam=bb);qb&&(va.HasParent=cb,va.HasChildren=db,va.PickParent=eb,va.PickChildren=fb,va.PickNthChild=gb,va.CompareChildCount=hb,ka.AddChild=ib,ka.RemoveChild=jb,ka.RemoveFromParent=ma,N.ChildCount=Ga);rb&&(ka.SetMeshSize=kb,ka.SetMeshPoint=lb,N.MeshColumns=mb,N.MeshRows=nb);ta&&(va.IsVisible=Aa,ka.SetVisible=ob,ka.SetCSSStyle=pb,ka.SetElemAttribute=La,ka.RemoveElemAttribute=Ma);ya&&(va.IsFocused=Ia,ka.SetFocus=Na,ka.SetBlur=
Oa);Ha&&(va.IsEnabled=l,ka.SetEnabled=h);V||(va.CompareInstanceVar=v,va.IsBoolInstanceVarSet=y,va.PickInstVarHiLow=A,va.PickByUID=C,ka.SetInstanceVar=S,ka.AddInstanceVar=X,ka.SubInstanceVar=U,ka.SetBoolInstanceVar=ca,ka.ToggleBoolInstanceVar=ba,va.OnCreated=M,va.OnDestroyed=Q,ka.Destroy=K,ka.LoadFromJsonString||(ka.LoadFromJsonString=Z),N.AsJSON||(N.AsJSON=ra),N.Count=oa,N.PickedCount=pa,N.IID=na,N.UID=za,N.ObjectTypeName=la)}}"use strict";
{const f=self.C3;f.ScheduledWait=class extends f.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._type="";this._time=-1;this._signalTag="";this._isSignalled=!1;this._event=null;this._actIndex=0;this._solModifiers=[];this._sols=new Map;this._callingFunctionBlock=null;this._asyncId=-1;this._functionParameters=null;this._shouldRelease=!1}Release(){this._type="";this._time=-1;this._signalTag="";this._functionParameters=this._callingFunctionBlock=this._event=null;this._asyncId=-1;f.clearArray(this._solModifiers);
for(const b of this._sols.values())b.Release();this._sols.clear()}_Init(){var b=this._eventSheetManager,a=b.GetRuntime().GetAllObjectClasses();const d=b.GetCurrentEventStackFrame();this._event=d.GetCurrentEvent();this._actIndex=d.GetActionIndex()+1;if(b=b.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=b,this._functionParameters=b.CaptureFunctionParameters(),b.IsAsync()&&(this._asyncId=b.PauseCurrentAsyncFunction());for(const c of a)if(a=c.GetCurrentSol(),!a.IsSelectAll()||this._event.HasSolModifier(c))this._solModifiers.push(c),
this._sols.set(c,f.New(f.SolState,a))}InitTimer(b){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+b}InitSignal(b){this._type="signal";this._Init();this._signalTag=b.toLowerCase()}InitPromise(b){this._type="promise";this._Init();b.then(()=>this.SetSignalled()).catch(a=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",a);this.SetSignalled()})}IsTimer(){return"timer"===this._type}IsSignal(){return"signal"===this._type}IsPromise(){return"promise"===
this._type}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=!0}_ShouldRun(){return this.IsTimer()?this._time<=this._eventSheetManager.GetRuntime().GetGameTime():this.IsSignalled()}_RestoreState(b){b._Restore(this._event,this._actIndex);for(const [a,d]of this._sols.entries())b=a.GetCurrentSol(),d._Restore(b);if(b=this._callingFunctionBlock)b.SetFunctionParameters(this._functionParameters),b.IsAsync()&&b.ResumeAsyncFunction(this._asyncId)}_Run(b){this._RestoreState(b);
this._event._ResumeActionsAndSubEvents(b);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}async _DebugRun(b){this._RestoreState(b);for(const a of this._event._DebugResumeActionsAndSubEvents(b))await this._eventSheetManager.GetRuntime().DebugBreak(a);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);
this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(b){for(const a of this._sols.values())a.RemoveInstances(b)}_SaveToJson(){const b={},a={t:this._time,st:this._signalTag,s:this._isSignalled,ev:this._event.GetSID(),sm:this._solModifiers.map(d=>d.GetSID()),sols:b};this._event._HasActionIndex(this._actIndex)&&(a.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [d,c]of this._sols)b[d.GetSID().toString()]=
c._SaveToJson();return a}static _CreateFromJson(b,a){const d=b.GetRuntime();var c=b.GetEventBlockBySID(a.ev);if(!c)return null;let e=0;if(a.hasOwnProperty("act")){var g=b.GetActionBySID(a.act);if(!g)return null;e=g.GetIndex()}g=f.New(f.ScheduledWait,b);g._time=a.t;g._type=-1===g._time?"signal":"timer";g._signalTag=a.st;g._isSignalled=a.s;g._event=c;g._actIndex=e;for(var k of a.sm)(c=d.GetObjectClassBySID(k))&&g._solModifiers.push(c);for(const [m,p]of Object.entries(a.sols))if(a=parseInt(m,10),a=d.GetObjectClassBySID(a))k=
f.New(f.SolState,null),k._LoadFromJson(b,p),g._sols.set(a,k);return g}}}"use strict";
{const f=self.C3;f.SolState=class extends f.DefendedBase{constructor(b){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];b&&(this._objectClass=b.GetObjectClass(),this._isSelectAll=b.IsSelectAll(),f.shallowAssignArray(this._instances,b._GetOwnInstances()))}Release(){this._objectClass=null;f.clearArray(this._instances)}_Restore(b){b._SetSelectAll(this._isSelectAll);f.shallowAssignArray(b._GetOwnInstances(),this._instances)}RemoveInstances(b){f.arrayRemoveAllInSet(this._instances,
b)}_SaveToJson(){return{sa:this._isSelectAll,insts:this._instances.map(b=>b.GetUID())}}_LoadFromJson(b,a){b=b.GetRuntime();this._isSelectAll=!!a.sa;f.clearArray(this._instances);for(const d of a.insts)(a=b.GetInstanceByUID(d))&&this._instances.push(a)}}}"use strict";
{const f=self.C3;function b(a,d){let c=a.get(d);c||(c=new Map,a.set(d,c));return c}f.SDKPluginBase=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._isSingleGlobal=!!a.isSingleGlobal;this._isWorldType=!!a.isWorld;this._isRotatable=!!a.isRotatable;this._mustPredraw=!!a.mustPredraw;this._hasEffects=!!a.hasEffects;this._supportsSceneGraph=!!a.supportsSceneGraph;this._supportsMesh=!!a.supportsMesh;this._singleGlobalObjectClass=null;this._boundACEMethodCache=new Map;this._boundACEMethodCache_1param=
new Map;this._boundACEMethodCache_2params=new Map;this._boundACEMethodCache_3params=new Map}Release(){this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}IsSingleGlobal(){return this._isSingleGlobal}IsWorldType(){return this._isWorldType}IsRotatable(){return this._isRotatable}MustPreDraw(){return this._mustPredraw}HasEffects(){return this._hasEffects}SupportsSceneGraph(){return this._supportsSceneGraph}SupportsMesh(){return this._supportsMesh}_GetBoundACEMethod(a,d){if(!d)throw Error("missing 'this' binding");
let c=this._boundACEMethodCache.get(a);if(c)return c;c=a.bind(d);this._boundACEMethodCache.set(a,c);return c}_GetBoundACEMethod_1param(a,d,c){if(!d)throw Error("missing 'this' binding");const e=b(this._boundACEMethodCache_1param,a);let g=e.get(c);if(g)return g;g=a.bind(d,c);e.set(c,g);return g}_GetBoundACEMethod_2params(a,d,c,e){if(!d)throw Error("missing 'this' binding");var g=b(this._boundACEMethodCache_2params,a);g=b(g,c);let k=g.get(e);if(k)return k;k=a.bind(d,c,e);g.set(e,k);return k}_GetBoundACEMethod_3params(a,
d,c,e,g){if(!d)throw Error("missing 'this' binding");var k=b(this._boundACEMethodCache_3params,a);k=b(k,c);k=b(k,e);let m=k.get(g);if(m)return m;m=a.bind(d,c,e,g);k.set(g,m);return m}_SetSingleGlobalObjectClass(a){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");this._singleGlobalObjectClass=a}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");
return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}}"use strict";
{const f=self.C3;f.SDKDOMPluginBase=class extends f.SDKPluginBase{constructor(b,a){super(b);this._domComponentId=a;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",d=>d._OnElemFocused());this.AddElementMessageHandler("elem-blurred",d=>{d&&d._OnElemBlurred()})}Release(){super.Release()}_AddElement(b){const a=this._nextElementId++;this._instMap.set(a,b);return a}_RemoveElement(b){this._instMap.delete(b)}AddElementMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,
b,d=>{const c=this._instMap.get(d.elementId);a(c,d)})}}}"use strict";{const f=self.C3;f.SDKTypeBase=class extends f.DefendedBase{constructor(b){super();this._objectClass=b;this._runtime=b.GetRuntime();this._plugin=b.GetPlugin()}Release(){this._plugin=this._runtime=this._objectClass=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}FinishCondition(b){}LoadTextures(b){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(b){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}}}"use strict";
{const f=self.C3;f.SDKInstanceBase=class extends f.DefendedBase{constructor(b,a){super();this._inst=b;this._domComponentId=a;this._runtime=b.GetRuntime();this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._tick2Func=this._tickFunc=null;this._isTicking2=this._isTicking=!1;this._disposables=null;this._wasReleased=!1}Release(){this._wasReleased=!0;this._StopTicking();this._StopTicking2();this._tick2Func=this._tickFunc=null;this._disposables&&(this._disposables.Release(),
this._disposables=null);this._sdkType=this._objectClass=this._runtime=this._inst=null}WasReleased(){return this._wasReleased}GetInstance(){return this._inst}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetPlugin(){return this._sdkType.GetPlugin()}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._inst.GetInterfaceClass()}Trigger(b){return this._runtime.Trigger(b,this._inst,null)}DebugTrigger(b){return this._runtime.DebugTrigger(b,this._inst,null)}TriggerAsync(b){return this._runtime.TriggerAsync(b,
this._inst,null)}FastTrigger(b,a){return this._runtime.FastTrigger(b,this._inst,a)}DebugFastTrigger(b,a){return this._runtime.DebugFastTrigger(b,this._inst,a)}ScheduleTriggers(b){return this._runtime.ScheduleTriggers(b)}AddDOMMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,b,a)}AddDOMMessageHandlers(b){for(const [a,d]of b)this.AddDOMMessageHandler(a,d)}PostToDOM(b,a){this._runtime.PostComponentMessageToDOM(this._domComponentId,b,a)}PostToDOMAsync(b,a){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,
b,a)}_PostToDOMMaybeSync(b,a){if(this._runtime.IsInWorker())this.PostToDOM(b,a);else return window.c3_runtimeInterface._OnMessageFromRuntime({type:"event",component:this._domComponentId,handler:b,data:a,responseId:null})}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){var b=this.GetCurrentImageInfo();return b&&(b=b.GetTexture())?[b.GetWidth(),b.GetHeight()]:[100,100]}GetCurrentTexRect(){const b=this.GetCurrentImageInfo();return b?b.GetTexRect():null}GetImagePoint(b){b=this._inst.GetWorldInfo();
return[b.GetX(),b.GetY()]}Tick(){}Tick2(){}_StartTicking(){this._isTicking||(this._tickFunc||(this._tickFunc=()=>this.Tick()),this._runtime.Dispatcher().addEventListener("tick",this._tickFunc),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._tick2Func||(this._tick2Func=()=>this.Tick2()),this._runtime.Dispatcher().addEventListener("tick2",
this._tick2Func),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(b){}LoadTilemapData(b,a,d){}TestPointOverlapTile(b,a){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var d=this.GetPropertyValueByIndex(b);if("number"!==typeof d)throw Error("expected number");
this.SetPropertyValueByIndex(b,d+a)}}SetPropertyColorOffsetValueByIndex(b,a,d,c){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}}}"use strict";
{const f=self.C3;f.SDKWorldInstanceBase=class extends f.SDKInstanceBase{constructor(b,a){super(b,a);this._worldInfo=b.GetWorldInfo();this._webglcontextrestored_handler=this._webglcontextlost_handler=null}Release(){if(this._webglcontextlost_handler){const b=this._runtime.Dispatcher();b.removeEventListener("webglcontextlost",this._webglcontextlost_handler);b.removeEventListener("webglcontextrestored",this._webglcontextrestored_handler);this._webglcontextrestored_handler=this._webglcontextlost_handler=
null}this._worldInfo=null;super.Release()}HandleWebGLContextLoss(){if(!this._webglcontextlost_handler){this._webglcontextlost_handler=()=>this.OnWebGLContextLost();this._webglcontextrestored_handler=()=>this.OnWebGLContextRestored();var b=this._runtime.Dispatcher();b.addEventListener("webglcontextlost",this._webglcontextlost_handler);b.addEventListener("webglcontextrestored",this._webglcontextrestored_handler)}}OnWebGLContextLost(){}OnWebGLContextRestored(){}GetWorldInfo(){return this._worldInfo}}}"use strict";
{const f=self.C3,b=f.New(f.Rect);f.SDKDOMInstanceBase=class extends f.SDKWorldInstanceBase{constructor(a,d){super(a,d);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=this._elemHasFocus=!1;this._lastRect=f.New(f.Rect,0,0,-1,-1);a=this._runtime.GetCanvasManager();this._lastWindowWidth=a.GetLastWidth();this._lastWindowHeight=a.GetLastHeight();this._isPendingUpdateState=!1;this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId);
this.PostToDOMElement("destroy");this._elementId=-1;super.Release()}_GetElementInDOMMode(){if(this._runtime.IsInWorker())throw Error("not valid in worker mode");return this._PostToDOMElementMaybeSync("get-element")}PostToDOMElement(a,d){d||(d={});d.elementId=this._elementId;this.PostToDOM(a,d)}_PostToDOMElementMaybeSync(a,d){d||(d={});d.elementId=this._elementId;return this._PostToDOMMaybeSync(a,d)}PostToDOMElementAsync(a,d){d||(d={});d.elementId=this._elementId;return this.PostToDOMAsync(a,d)}CreateElement(a){a||
(a={});const d=this.GetWorldInfo().IsVisible();a.elementId=this._elementId;a.isVisible=d;Object.assign(a,this.GetElementState());this._isElementShowing=!!a.isVisible;this._PostToDOMMaybeSync("create",a);this._UpdatePosition(!0)}SetElementVisible(a){a=!!a;this._isElementShowing!==a&&(this._isElementShowing=a,this.PostToDOMElement("set-visible",{isVisible:a}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const a=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===f.Platform.OS&&
("scale-inner"===a||"scale-outer"===a||"crop"===a)}_UpdatePosition(a){var d=this.GetWorldInfo();const c=d.GetLayer();var e=d.GetX(),g=d.GetY();let [k,m]=c.LayerToCanvasCss(e,g),[p,n]=c.LayerToCanvasCss(e+d.GetWidth(),g+d.GetHeight());e=this._runtime.GetCanvasManager();g=e.GetCssWidth();const u=e.GetCssHeight();if(d.IsVisible()&&c.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=p||0>=n||k>=g||m>=u){this.SetElementVisible(!1);return}1>k&&(k=1);1>m&&(m=1);p>=g&&(p=g-1);n>=u&&(n=u-1)}b.set(k,m,
p,n);d=e.GetLastWidth();g=e.GetLastHeight();!a&&b.equals(this._lastRect)&&this._lastWindowWidth===d&&this._lastWindowHeight===g?this.SetElementVisible(!0):(this._lastRect.copy(b),this._lastWindowWidth=d,this._lastWindowHeight=g,this.SetElementVisible(!0),a=null,this._autoFontSize&&(a=c.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+e.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+e.GetCanvasClientY(),width:Math.round(this._lastRect.width()),
height:Math.round(this._lastRect.height()),fontSize:a}))}else this.SetElementVisible(!1)}FocusElement(){this._PostToDOMElementMaybeSync("focus",{focus:!0})}BlurElement(){this._PostToDOMElementMaybeSync("focus",{focus:!1})}_OnElemFocused(){this._elemHasFocus=!0}_OnElemBlurred(){this._elemHasFocus=!1}IsElementFocused(){return this._elemHasFocus}SetElementCSSStyle(a,d){this.PostToDOMElement("set-css-style",{prop:f.CSSToCamelCase(a),val:d})}SetElementAttribute(a,d){this.PostToDOMElement("set-attribute",
{name:a,val:d})}RemoveElementAttribute(a){this.PostToDOMElement("remove-attribute",{name:a})}UpdateElementState(){this._isPendingUpdateState||(this._isPendingUpdateState=!0,Promise.resolve().then(()=>{this._isPendingUpdateState=!1;this.PostToDOMElement("update-state",this.GetElementState())}))}GetElementState(){}GetElementId(){return this._elementId}}}"use strict";
{const f=self.C3,b=self.IBehavior;f.SDKBehaviorBase=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._myObjectClasses=f.New(f.ArraySet);this._myInstances=f.New(f.ArraySet);this._iBehavior=null;if(a=a.scriptInterfaceClass){if(this._iBehavior=new a(this),!(this._iBehavior instanceof b))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new b(this)}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=
null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(a){this._myObjectClasses.Add(a)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(a){this._myInstances.Add(a)}_RemoveInstance(a){this._myInstances.Delete(a)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){return this._iBehavior}}}"use strict";
{const f=self.C3;f.SDKBehaviorTypeBase=class extends f.DefendedBase{constructor(b){super();this._runtime=b.GetRuntime();this._behaviorType=b;this._objectClass=b.GetObjectClass();this._behavior=b.GetBehavior();this._behavior._AddObjectClass(this._objectClass)}Release(){this._behavior=this._objectClass=this._behaviorType=this._runtime=null}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}}"use strict";
{const f=self.C3;f.SDKBehaviorInstanceBase=class extends f.DefendedBase{constructor(b,a){super();this._behInst=b;this._domComponentId=a;this._inst=b.GetObjectInstance();this._runtime=b.GetRuntime();this._behaviorType=b.GetBehaviorType();this._sdkType=this._behaviorType.GetSdkType();this._isPostTicking=this._isTicking2=this._isTicking=!1;this._disposables=null}Release(){this._StopTicking();this._StopTicking2();this._StopPostTicking();this._disposables&&(this._disposables.Release(),this._disposables=
null);this._sdkType=this._behaviorType=this._runtime=this._inst=this._behInst=null}GetBehavior(){return this._behaviorType.GetBehavior()}GetBehaviorInstance(){return this._behInst}GetObjectInstance(){return this._inst}GetObjectClass(){return this._inst.GetObjectClass()}GetWorldInfo(){return this._inst.GetWorldInfo()}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._behInst.GetScriptInterface()}Trigger(b){return this._runtime.Trigger(b,
this._inst,this._behaviorType)}DebugTrigger(b){return this._runtime.DebugTrigger(b,this._inst,this._behaviorType)}TriggerAsync(b){return this._runtime.TriggerAsync(b,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){this._isTicking||(this._runtime._AddBehInstToTick(this),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime._RemoveBehInstToTick(this),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._runtime._AddBehInstToTick2(this),
this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime._RemoveBehInstToTick2(this),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}_StartPostTicking(){this._isPostTicking||(this._runtime._AddBehInstToPostTick(this),this._isPostTicking=!0)}_StopPostTicking(){this._isPostTicking&&(this._runtime._RemoveBehInstToPostTick(this),this._isPostTicking=!1)}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,
b,a)}OnSpriteFrameChanged(b,a){}SaveToJson(){return null}LoadFromJson(b){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var d=this.GetPropertyValueByIndex(b);if("number"!==typeof d)throw Error("expected number");this.SetPropertyValueByIndex(b,d+a)}}SetPropertyColorOffsetValueByIndex(b,a,d,c){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}}}"use strict";
{const f=self.C3;f.Plugins={};f.Behaviors={};f.PluginManager=class extends f.DefendedBase{constructor(b){super();this._runtime=b;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._jumpthruBehavior=this._solidBehavior=null}CreatePlugin(b){const a=this._runtime.GetObjectReference(b[0]);if(!a)throw Error("missing plugin");f.AddCommonACEs(b,a);b=f.New(a,{runtime:this._runtime,isSingleGlobal:b[1],isWorld:b[2],isRotatable:b[5],
hasEffects:b[8],mustPredraw:b[9],supportsSceneGraph:b[13],supportsMesh:b[14]});b.OnCreate();this._allPlugins.push(b);this._pluginsByCtor.set(a,b)}CreateSystemPlugin(){this._systemPlugin=f.New(f.Plugins.System,{runtime:this._runtime,isSingleGlobal:!0});this._systemPlugin.OnCreate()}CreateBehavior(b){b=this._runtime.GetObjectReference(b[1]);if(!b)throw Error("missing behavior");const a=f.New(b,{runtime:this._runtime});a.OnCreate();this._allBehaviors.push(a);this._behaviorsByCtor.set(b,a);!this._solidBehavior&&
f.Behaviors.solid&&a instanceof f.Behaviors.solid?this._solidBehavior=a:!this._jumpthruBehavior&&f.Behaviors.jumpthru&&a instanceof f.Behaviors.jumpthru&&(this._jumpthruBehavior=a)}GetPluginByConstructorFunction(b){return this._pluginsByCtor.get(b)||null}HasBehaviorByConstructorFunction(b){return this._behaviorsByCtor.has(b)}GetBehaviorByConstructorFunction(b){return this._behaviorsByCtor.get(b)||null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}}"use strict";
{const f=self.C3,b=new Set;f.ImageInfo=class extends f.DefendedBase{constructor(){super();this._url="";this._height=this._width=this._offsetY=this._offsetX=this._pixelFormat=this._size=0;this._hasMetaData=!1;this._imageAsset=null;this._textureState="";this._rcTex=f.New(f.Rect);b.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;b.delete(this)}static OnWebGLContextLost(){for(const a of b)a._textureState="",a._rcTex.set(0,0,0,0)}LoadData(a){this._url=a[0];this._size=a[1];this._pixelFormat=
a[2];this._offsetX=a[3];this._offsetY=a[4];this._width=a[5];this._height=a[6];this._hasMetaData=!0}LoadAnimationFrameData(a){this._url=a[0];this._size=a[1];this._offsetX=a[2];this._offsetY=a[3];this._width=a[4];this._height=a[5];this._pixelFormat=a[11];this._hasMetaData=!0}LoadDynamicAsset(a,d){if(this._imageAsset)throw Error("already loaded asset");this._url=d;const c={};f.IsAbsoluteURL(d)&&(c.loadPolicy="remote");this.LoadAsset(a,c);return this._imageAsset.Load()}ReplaceWith(a){if(a===this)throw Error("cannot replace with self");
this.ReleaseTexture();this._url=a._url;this._size=a._size;this._pixelFormat=a._pixelFormat;this._offsetX=a._offsetX;this._offsetY=a._offsetY;this._width=a._width;this._height=a._height;this._hasMetaData=a._hasMetaData;this._imageAsset=a._imageAsset;this._textureState=a._textureState;this._rcTex=a._rcTex}GetURL(){return this._url}GetSize(){return this._size}GetPixelFormat(){return this._pixelFormat}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(a,
d){if(this._imageAsset)throw Error("already got asset");d=Object.assign({},d,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=a.LoadImage(d)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,d){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";a=await this._imageAsset.LoadStaticTexture(a,d);if(!a)return this._textureState="",null;this._textureState="loaded";this._hasMetaData||
(this._width=a.GetWidth(),this._height=a.GetHeight(),this._hasMetaData=!0);this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+this._width,this._offsetY+this._height);this._rcTex.divide(a.GetWidth(),a.GetHeight());return a}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,0,0,0))}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}async ExtractImageToCanvas(){const a=
await this._imageAsset.LoadToDrawable(),d=f.CreateCanvas(this._width,this._height);d.getContext("2d").drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return d}}}"use strict";
{const f=self.C3;f.AnimationInfo=class extends f.DefendedBase{constructor(b){super();this._name=b[0];this._speed=b[1];this._isLooping=!!b[2];this._repeatCount=b[3];this._repeatTo=b[4];this._isPingPong=!!b[5];this._sid=b[6];this._frames=b[7].map(a=>f.New(f.AnimationFrameInfo,a))}Release(){for(const b of this._frames)b.Release();f.clearArray(this._frames)}LoadAllAssets(b){for(const a of this._frames)a.GetImageInfo().LoadAsset(b)}LoadAllTextures(b,a){return Promise.all(this._frames.map(d=>d.GetImageInfo().LoadStaticTexture(b,
a)))}ReleaseAllTextures(){for(const b of this._frames)b.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(b){b=Math.floor(b);if(0>b||b>=this._frames.length)throw new RangeError("invalid frame");return this._frames[b]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}}}"use strict";
{const f=self.C3;f.AnimationFrameInfo=class extends f.DefendedBase{constructor(b){super();this._imageInfo=f.New(f.ImageInfo);this._imageInfo.LoadAnimationFrameData(b);this._duration=b[6];this._origin=f.New(f.Vector2,b[7],b[8]);this._imagePoints=b[9].map(a=>f.New(f.ImagePoint,this,a));this._imagePointsByName=new Map;for(const a of this._imagePoints)this._imagePointsByName.set(a.GetName().toLowerCase(),a);this._collisionPoly=null;b=b[10];6<=b.length&&(this._collisionPoly=f.New(f.CollisionPoly,b))}Release(){this._collisionPoly&&
(this._collisionPoly.Release(),this._collisionPoly=null);this._imageInfo.Release();this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(b){return this._imagePointsByName.get(b.toLowerCase())||null}GetImagePointByIndex(b){b=Math.floor(b);return 0>b||b>=this._imagePoints.length?null:this._imagePoints[b]}GetImagePointCount(){return this._imagePoints.length}}}"use strict";
{const f=self.C3;f.ImagePoint=class extends f.DefendedBase{constructor(b,a){super();this._afi=b;this._name=a[0];this._pos=f.New(f.Vector2,a[1],a[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}}"use strict";
{const f=self.C3,b=self.C3Debugger,a=self.IObjectClass;f.ObjectClass=class extends f.DefendedBase{constructor(d,c,e){super();const g=d.GetObjectReference(e[1]);this._runtime=d;this._plugin=d.GetPluginManager().GetPluginByConstructorFunction(g);this._sdkType=null;this._instSdkCtor=g.Instance;this._index=c;this._sid=e[11];this._name=e[0];this._jsPropName=this._runtime.GetJsPropName(e[14]);this._isGlobal=!!e[9];this._isFamily=!!e[2];this._isOnLoaderLayout=!!e[10];this._instVars=e[3].map(k=>({sid:k[0],
type:k[1],name:k[2],jsPropName:d.GetJsPropName(k[3])}));this._behaviorsCount=e[4];this._effectsCount=e[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=f.New(f.SparseGrid,d.GetOriginalViewportWidth(),d.GetOriginalViewportHeight());this._anyCollisionCellChanged=!0;this._anyInstanceParallaxed=!1;this._familyMembersSet=this._familyMembers=null;this._familyIndex=-1;this._familyEffectMap=this._familyBehaviorMap=this._familyInstVarMap=this._familiesSet=this._families=
null;this._isInContainer=!1;this._container=null;this._behaviorTypes=e[8].map(k=>f.BehaviorType.Create(this,k));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=f.New(f.SolStack,this);this._defaultInstanceData=null;this._defaultLayerIndex=0;this._isContained=!1;this._animationsBySid=this._animationsByName=this._animations=this._imageInfo=this._container=null;this._textureRefCount=0;this._savedData=
new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=!0;this._plugin.HasEffects()&&(this._effectList=f.New(f.EffectList,this,e[12]));e[6]&&(this._imageInfo=f.New(f.ImageInfo),this._imageInfo.LoadData(e[6]));if(e[7]){this._animations=e[7].map(k=>f.New(f.AnimationInfo,k));this._animationsByName=new Map;this._animationsBySid=new Map;for(const k of this._animations)this._animationsByName.set(k.GetName().toLowerCase(),k),this._animationsBySid.set(k.GetSID(),k)}this._isFamily?(this._familyMembers=
[],this._familyMembersSet=new Set,this._familyIndex=this._runtime._GetNextFamilyIndex()):(this._families=[],this._familiesSet=new Set,this._familyInstVarMap=[],this._familyBehaviorMap=[],this._familyEffectMap=[]);this._sdkType=f.New(g.Type,this,e[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=f.New(f.Event.Dispatcher);if(c=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new c(this),!(this._iObjectClass instanceof a))throw new TypeError("script interface class must derive from IObjectClass");
}else this._iObjectClass=new a(this);e[13]&&(c=e[13])&&this._sdkType.LoadTilemapData(c[0],c[1]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(e))}static Create(d,c,e){return f.New(f.ObjectClass,d,c,e)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const d of this._animations)d.Release();
f.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._runtime=this._container=null}_LoadFamily(d){for(let c=1,e=d.length;c<e;++c){const g=this._runtime.GetObjectClassByIndex(d[c]);this._familyMembers.push(g);this._familyMembersSet.add(g);g._families.push(this);g._familiesSet.add(this)}}_SetContainer(d){this._isInContainer=!0;this._container=d}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var d=
0;if(!this._isFamily)for(var c of this._families)for(var e of c.GetBehaviorTypes()){const m=e.GetName().toLowerCase();this._behaviorsByName.set(m,e);this._behaviorNameToIndex.set(m,d);this._behaviorTypesIncludingInherited.push(e);++d}for(var g of this.GetBehaviorTypes())c=g.GetName().toLowerCase(),this._behaviorsByName.set(c,g),this._behaviorNameToIndex.set(c,d),this._behaviorTypesIncludingInherited.push(g),++d;for(var k of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(k.GetBehavior().constructor);
if(!this._isFamily&&this._families.length){d=this._runtime.GetFamilyCount();f.extendArray(this._familyInstVarMap,d,0);f.extendArray(this._familyBehaviorMap,d,0);f.extendArray(this._familyEffectMap,d,0);d=[];c=k=g=0;for(const m of this._families)if(e=m.GetFamilyIndex(),this._familyInstVarMap[e]=g,g+=m.GetInstanceVariablesCount(),this._familyBehaviorMap[e]=k,k+=m.GetBehaviorTypesCount(),this._familyEffectMap[e]=c,c+=m.GetEffectTypesCount(),(e=m.GetEffectList())&&this._effectList)for(const p of e.GetAllEffectTypes())d.push(p.Clone(this._effectList));
this._effectList&&this._effectList.PrependEffectTypes(d)}}_CreateSingleGlobalInstance(d){const c=this._runtime._GetNewUID(),e=f.New(f.Instance,{runtime:this._runtime,objectType:this,uid:c});e._CreateSdkInstance(d[16],[]);this._runtime._MapInstanceByUID(c,e);this._instances.push(e)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(d){if(this._isFamily)return Promise.resolve();
this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(d)||Promise.resolve():Promise.resolve()}ReleaseTextures(){if(!this._isFamily){this._textureRefCount--;if(0>this._textureRefCount)throw Error("released textures too many times");0===this._textureRefCount&&this._sdkType.ReleaseTextures()}}OnDynamicTextureLoadComplete(){if(this._isFamily)throw Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(d){return this._isFamily?
Promise.resolve():this._sdkType.PreloadTexturesWithInstances(d)}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetIndex(){return this._index}GetSID(){return this._sid}IsFamily(){return this._isFamily}IsGlobal(){return this._isGlobal}IsWorldType(){return this._isWorldType}GetFamilyIndex(){return this._familyIndex}GetBehaviorTypes(){return this._behaviorTypes}GetBehaviorTypesCount(){return this._behaviorsCount}UsesBehaviorByCtor(d){return d&&
this._usedBehaviorCtors.has(d)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(d=>d.sid)}GetInstanceVariableIndexBySID(d){return this._instVars.findIndex(c=>c.sid===d)}GetInstanceVariableIndexByName(d){return this._instVars.findIndex(c=>c.name===d)}_GetAllInstanceVariableNames(){return this._instVars.map(d=>d.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(d=>d.jsPropName)}GetInstanceVariableType(d){d=Math.floor(d);
if(0>d||d>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[d].type}GetInstanceVariableName(d){d=Math.floor(d);if(0>d||d>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[d].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(d){return this._behaviorsByName.get(d.toLowerCase())||null}GetBehaviorIndexByName(d){d=
this._behaviorNameToIndex.get(d.toLowerCase());return"undefined"===typeof d?-1:d}GetEffectList(){return this._effectList}HasEffects(){return this._plugin.HasEffects()}UsesEffects(){return this._effectList&&this._effectList.HasAnyEffectType()}GetSolStack(){return this._solStack}GetCurrentSol(){return this._solStack.GetCurrentSol()}GetImageInfo(){return this._imageInfo}SetDefaultInstanceData(d){this._defaultInstanceData=d}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(d){this._defaultLayerIndex=
d}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(d){return this._familiesSet.has(d)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(d){return this._familyMembersSet.has(d)}GetFamilyBehaviorOffset(d){return this._familyBehaviorMap[d]}GetFamilyInstanceVariableOffset(d){return this._familyInstVarMap[d]}GetAnimationByName(d){if(!this._animations)throw Error("no animations");
return this._animationsByName.get(d.toLowerCase())||null}GetAnimationBySID(d){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(d)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const d=this.GetFirstAnimationFrame().GetImageInfo();return[d.GetWidth(),d.GetHeight()]}return this._imageInfo?[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()]:[100,
100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances;for(const d of this._runtime._GetInstancesPendingCreate())d.GetObjectClass()===this&&(yield d)}GetInstanceCount(){return this._instances.length}_AddInstance(d){this._instances.push(d)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&
!this._isFamily){var d=this._instances,c=0;for(let e=d.length;c<e;++c)d[c]._SetIID(c);d=this._runtime._GetInstancesPendingCreate();for(const e of d)e.GetObjectClass()===this&&e._SetIID(c++);this._iidsStale=!1}}GetInstanceByIID(d){var c=this._instances;if(d<c.length)return c[d];d-=c.length;c=this._runtime._GetInstancesPendingCreate();for(const e of c)if(e.GetObjectClass()===this){if(0===d)return e;--d}return null}GetFirstPicked(d){if(d&&d.IsInContainer()&&d.GetObjectClass()!==this)for(const c of d.siblings())if(c.GetObjectClass()===
this)return c;d=this.GetCurrentSol().GetInstances();return d.length?d[0]:null}GetPairedInstance(d){const c=this.GetCurrentSol().GetInstances();return c.length?c[d.GetIID()%c.length]:null}*allCorrespondingInstances(d,c){const e=this.GetCurrentSol().GetInstances();var g=e.length;const k=c.GetCurrentSol(),m=c.GetCurrentSol().GetInstances(),p=m.length;var n=d.GetIID();if(c.IsFamily()||!k.IsSelectAll())n=m.indexOf(d);d=Math.ceil(g/p);g%=p;0===g||n<g?(n*=d,g=d):(n=g*d+(n-g)*(d-1),g=d-1);for(let u=n,q=n+
g;u<q;++u)yield e[u]}FinishCondition(d){this._sdkType.FinishCondition(d)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var d=this.GetCurrentSol(),c=d._GetOwnInstances(),e=d.IsSelectAll(),g=this._runtime.GetCurrentEventStackFrame();g=g&&g.GetCurrentEvent()&&g.GetCurrentEvent().IsOrBlock();for(const p of this._container.objectTypes())if(p!==this){p._UpdateIIDs();var k=p.GetCurrentSol();k._SetSelectAll(e);if(!e){var m=k._GetOwnInstances();f.clearArray(m);for(const n of c)m.push(p.GetInstanceByIID(n.GetIID()));
if(g){m=d._GetOwnElseInstances();k=k._GetOwnElseInstances();f.clearArray(k);for(const n of m)k.push(p.GetInstanceByIID(n.GetIID()))}}}}}_TruncateContainerSols(d,c){for(const e of this.GetContainer().objectTypes()){const g=e.GetCurrentSol();d?f.truncateArray(g._GetOwnElseInstances(),c):f.truncateArray(g._GetOwnInstances(),c)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(d){this._anyCollisionCellChanged=!!d}_SetAnyInstanceParallaxed(d){this._anyInstanceParallaxed=!!d}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&
this._isWorldType){for(const d of this._instances)d.GetWorldInfo()._UpdateCollisionCell();for(const d of this._runtime._GetInstancesPendingCreate())d.GetObjectClass()===this&&d.GetWorldInfo()._UpdateCollisionCell();this._anyCollisionCellChanged=!1}}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}HasSolidBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.Persist)}_SaveToJson(){const d=
{instances:this._instances.map(c=>c.SaveToJson())};this._savedData&&this._savedData.size&&(d.ex=f.ToSuperJSON(this._savedData));return d}_LoadFromJson(d){this._savedData&&(this._savedData.clear(),this._savedData=null);var c=d.ex;c&&(this._savedData=f.FromSuperJSON(c));c=this._instances;d=d.instances;for(let e=0,g=Math.min(c.length,d.length);e<g;++e)c[e].LoadFromJson(d[e]);for(let e=d.length,g=c.length;e<g;++e)this._runtime.DestroyInstance(c[e]);for(let e=c.length,g=d.length;e<g;++e){c=d[e];let k=
null;if(this.IsWorldType()&&(k=this._runtime.GetMainRunningLayout().GetLayerBySID(c.w.l),!k))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,k,!1,0,0,!0).LoadFromJson(c)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(d){this._instanceUserScriptClass=d}DispatchUserScriptEvent(d){var c=this._runtime;(c=
c.IsDebug()&&!c.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(d);c&&b.AddScriptTime()}}}"use strict";
{const f=self.C3;f.Container=class extends f.DefendedBase{constructor(b,a){super();this._runtime=b;this._objectTypes=a;for(const d of this._objectTypes)d._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(b=>b.IsWorldType())}}}"use strict";
{const f=self.C3,b=self.C3Debugger,a=self.IInstance,d=[];let c=0;const e=new WeakMap,g=new WeakMap;f.Instance=class extends f.DefendedBase{constructor(k){super();this._runtime=k.runtime;this._objectType=k.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=k.uid;this._puid=c++;this._flags=0;this._behaviorInstances=this._instVarValues=d;var m=this._objectType.GetBehaviorTypesIncludingInherited();0<m.length&&(this._behaviorInstances=m.map((p,n)=>f.New(f.BehaviorInstance,
{runtime:this._runtime,behaviorType:p,instance:this,index:n})));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;m=this.GetPlugin();m.MustPreDraw()&&(this._flags|=4);if(m.IsWorldType())if(this._worldInfo=f.New(f.WorldInfo,this,k.layer),k.worldData)this._worldInfo.Init(k.worldData);else{this._worldInfo.InitNoData();const [p,n]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(p,n);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}k.instVarData?
this._LoadInstanceVariableData(k.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var k of this._behaviorInstances)k.Release();f.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(k=e.get(this))k.clear(),e.delete(this);if(k=g.get(this))k.clear(),g.delete(this);this._siblings&&f.clearArray(this._siblings);this._dispatcher&&(this._dispatcher.Release(),
this._dispatcher=null);this._objectType=this._runtime=null;0<this._instVarValues.length&&f.clearArray(this._instVarValues);this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(k){0<k.length&&(this._instVarValues=[],f.shallowAssignArray(this._instVarValues,k))}_LoadDefaultInstanceVariables(){const k=this._objectType.GetInstanceVariablesCount();if(0!==k){this._instVarValues=[];var m=[0,0,""];for(let p=0;p<k;++p)this._instVarValues.push(m[this._objectType.GetInstanceVariableType(p)])}}_CreateSdkInstance(k,
m){if(this._sdkInst)throw Error("already got sdk instance");for(let p=0,n=this._behaviorInstances.length;p<n;++p)this._behaviorInstances[p]._CreateSdkInstance(m?m[p]:null);this._sdkInst=f.New(this._objectType.GetInstanceSdkCtor(),this,k);if(!(this._sdkInst instanceof f.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let p=0,n=this._behaviorInstances.length;p<n;++p)this._behaviorInstances[p].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}GetActiveTimeScale(){const k=
this._timeScale;return-1===k?this.GetRuntime().GetTimeScale():k}SetTimeScale(k){k=+k;if(0>k||!isFinite(k))k=0;this._timeScale=k}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=f.New(f.Event.Dispatcher));return this._dispatcher}Draw(k){this._sdkInst.Draw(k)}OnCreate(k){this._sdkInst.OnCreate(k)}_SetHasTilemap(){this._flags|=2}HasTilemap(){return 0!==(this._flags&2)}_MarkDestroyed(){this._flags|=1}IsDestroyed(){return 0!==(this._flags&1)}MustPreDraw(){return 0!==
(this._flags&4)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(k){this._flags=k?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(k){this._flags=k?this._flags|16:this._flags&-17}SetFlag(k,m){k<<=16;this._flags=m?this._flags|k:this._flags&~k}GetFlag(k){return 0!==(this._flags&k<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetImagePoint(k){return this._sdkInst.GetImagePoint(k)}GetObjectClass(){return this._objectType}BelongsToObjectClass(k){return k.IsFamily()?
k.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===k}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw Error("object does not support scene graph");}HasParent(){return null!==this.GetParent()}GetParent(){var k=this.GetWorldInfo();return k?(k=k.GetParent())?k.GetInstance():null:null}GetTopParent(){var k=this.GetWorldInfo();return k?(k=k.GetTopParent())?k.GetInstance():null:null}*parents(){const k=this.GetWorldInfo();if(k)for(const m of k.parents())yield m.GetInstance()}HasChildren(){const k=
this.GetWorldInfo();return k?k.HasChildren():!1}GetChildren(){const k=this.GetWorldInfo();return k?k.GetChildren().map(m=>m.GetInstance()):[]}*children(){const k=this.GetWorldInfo();if(k)for(const m of k.children())yield m.GetInstance()}*allChildren(){const k=this.GetWorldInfo();if(k)for(const m of k.allChildren())yield m.GetInstance()}GetChildCount(){const k=this.GetWorldInfo();return k?k.GetChildCount():0}GetChildAt(k){const m=this.GetWorldInfo();return m?(k=m.GetChildAt(k))?k.GetInstance():null:
null}AddChild(k,m){this.VerifySupportsSceneGraph();k.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(k.GetWorldInfo(),m||{})}RemoveChild(k){const m=this.GetWorldInfo();m&&m.RemoveChild(k.GetWorldInfo())}GetDestroyWithParent(){const k=this.GetWorldInfo();return k?k.GetDestroyWithParent():!1}SetupInitialSceneGraphConnections(){var k=this.GetWorldInfo();if(k&&(k=k.GetSceneGraphChildrenExportData()))for(const m of k)if(k=this._runtime.GetInstanceByUID(m[0])){const p=m[1];this.AddChild(k,{transformX:!!(p>>
0&1),transformY:!!(p>>1&1),transformWidth:!!(p>>2&1),transformHeight:!!(p>>3&1),transformAngle:!!(p>>4&1),destroyWithParent:!!(p>>5&1),transformZElevation:!!(p>>6&1)})}}IsInContainer(){return null!==this._siblings}_AddSibling(k){this._siblings.push(k)}GetSiblings(){return this._siblings}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const k of this.siblings())k.GetObjectClass().GetCurrentSol().SetSinglePicked(k)}_PushSiblingsToSolInstances(){for(const k of this.siblings())k.GetObjectClass().GetCurrentSol()._PushInstance(k)}_SetSiblingsToSolInstancesIndex(k){for(const m of this.siblings())m.GetObjectClass().GetCurrentSol()._GetOwnInstances()[k]=
m}_PushSiblingsToSolElseInstances(){for(const k of this.siblings())k.GetObjectClass().GetCurrentSol()._PushElseInstance(k)}_SetSiblingsToSolElseInstancesIndex(k){for(const m of this.siblings())m.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[k]=m}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(k){this._iid=k}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(k){if(!k)return null;
for(const m of this._behaviorInstances)if(m.GetBehavior()instanceof k)return m;return null}GetBehaviorSdkInstanceFromCtor(k){return k?(k=this.GetBehaviorInstanceFromCtor(k))?k.GetSdkInstance():null:null}GetBehaviorIndexBySID(k){const m=this._behaviorInstances;for(let p=0,n=m.length;p<n;++p)if(m[p].GetBehaviorType().GetSID()===k)return p;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(k){k|=
0;const m=this._instVarValues;if(0>k||k>=m.length)throw new RangeError("invalid instance variable");return m[k]}_GetInstanceVariableValueUnchecked(k){return this._instVarValues[k]}SetInstanceVariableValue(k,m){k|=0;const p=this._instVarValues;if(0>k||k>=p.length)throw new RangeError("invalid instance variable");const n=p[k];if("number"===typeof n)p[k]="number"===typeof m?m:parseFloat(m);else if("boolean"===typeof n)p[k]="boolean"===typeof m?m:!!m;else if("string"===typeof n)p[k]="string"===typeof m?
m:m.toString();else throw Error("unknown instance variable type");}SetInstanceVariableOffset(k,m){if(0!==m){k|=0;var p=this._instVarValues;if(0>k||k>=p.length)throw new RangeError("invalid instance variable");var n=p[k];if("number"===typeof n)p[k]="number"===typeof m?p[k]+m:p[k]+parseFloat(m);else{if("boolean"===typeof n)throw Error("can not set offset of boolean variable");if("string"===typeof n)throw Error("can not set offset of string variable");throw Error("unknown instance variable type");}}}GetSavedDataMap(){let k=
e.get(this);if(k)return k;k=new Map;e.set(this,k);return k}GetUnsavedDataMap(){let k=g.get(this);if(k)return k;k=new Map;g.set(this,k);return k}_HasAnyCreateDestroyHandler(k){const m=this.GetObjectClass();if(m.UserScriptDispatcher().HasAnyHandlerFor(k))return!0;for(const p of m.GetFamilies())if(p.UserScriptDispatcher().HasAnyHandlerFor(k))return!0;return this._runtime.UserScriptDispatcher().HasAnyHandlerFor(k)?!0:!1}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const k=
this.GetObjectClass(),m=new f.Event("instancecreate");m.instance=this.GetInterfaceClass();k.DispatchUserScriptEvent(m);for(const p of k.GetFamilies())p.DispatchUserScriptEvent(m);this._runtime.DispatchUserScriptEvent(m)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(k){if(this._iScriptInterface){var m=new f.Event("destroy");m.isEndingLayout=
k;this.DispatchUserScriptEvent(m)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){m=this.GetObjectClass();var p=new f.Event("instancedestroy");p.instance=this.GetInterfaceClass();p.isEndingLayout=k;m.DispatchUserScriptEvent(p);for(const n of m.GetFamilies())n.DispatchUserScriptEvent(p);this._runtime.DispatchUserScriptEvent(p)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(k="full"){const m={};"full"===k?m.uid=this.GetUID():m.c3=!0;if("visual-state"!==k){(k=
e.get(this))&&k.size&&(m.ex=f.ToSuperJSON(k));-1!==this.GetTimeScale()&&(m.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){k={};var p=this._objectType.GetInstanceVariableSIDs();for(let u=0,q=this._instVarValues.length;u<q;++u)k[p[u].toString()]=this._instVarValues[u];m.ivs=k}if(this._behaviorInstances.length){k={};for(var n of this._behaviorInstances)(p=n.SaveToJson())&&(k[n.GetBehaviorType().GetSID().toString()]=p);m.behs=k}}this._worldInfo&&(m.w=this._worldInfo._SaveToJson());
(n=this._sdkInst.SaveToJson())&&(m.data=n);return m}LoadFromJson(k,m="full"){if("full"===m)this._uid=k.uid;else if(!k.c3)return;if("visual-state"!==m){var p=e.get(this);p&&(p.clear(),e.delete(this));if(p=k.ex)p=f.FromSuperJSON(p),e.set(this,p);this._timeScale=k.hasOwnProperty("mts")?k.mts:-1;if(p=k.ivs)for(const [q,r]of Object.entries(p))if(p=parseInt(q,10),p=this._objectType.GetInstanceVariableIndexBySID(p),!(0>p||p>=this._instVarValues.length)){var n=r;null===n&&(n=NaN);this._instVarValues[p]=n}}if(this.GetPlugin().IsWorldType()){p=
k.w;var u=p.l;this._worldInfo.GetLayer().GetSID()!==u&&(n=this._worldInfo.GetLayer(),(u=n.GetLayout().GetLayerBySID(u))?(this._worldInfo._SetLayer(u),n._RemoveInstance(this,!0),u._AddInstance(this,!0),u.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===m&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(p)}if("visual-state"!==m&&(m=k.behs))for(const [q,r]of Object.entries(m))m=parseInt(q,10),m=this.GetBehaviorIndexBySID(m),0>m||m>=this._behaviorInstances.length||this._behaviorInstances[m].LoadFromJson(r);
(k=k.data)&&this._sdkInst.LoadFromJson(k)}GetInterfaceClass(){return this._iScriptInterface||this._InitUserScriptInterface()}_InitUserScriptInterface(){var k=this._worldInfo?self.IWorldInstance:a;const m=this._sdkInst.GetScriptInterfaceClass(),p=this._objectType._GetUserScriptInstanceClass(),n=p||m||k;a._Init(this);this._iScriptInterface=new n;a._Init(null);if(m&&!(this._iScriptInterface instanceof k))throw new TypeError(`script interface class '${m.name}' does not extend the right base class '${k.name}'`);
if(p&&(k=m||k,!(this._iScriptInterface instanceof k)))throw new TypeError(`setInstanceClass(): class '${p.name}' does not extend the right base class '${k.name}'`);return this._iScriptInterface}_GetInstVarsScriptDescriptor(k){if(0!==this._instVarValues.length){var m={},p=this._objectType._GetAllInstanceVariableJsPropNames();for(let n=0,u=p.length;n<u;++n)m[p[n]]={configurable:!1,enumerable:!0,get:f.Instance.prototype._GetInstanceVariableValueUnchecked.bind(this,n),set:f.Instance.prototype.SetInstanceVariableValue.bind(this,
n)};m=Object.create(Object.prototype,m);k.instVars={value:m,writable:!1}}}_GetBehaviorsScriptDescriptor(k){var m=this._behaviorInstances;if(0!==m.length){var p={};for(const n of m)p[n.GetBehaviorType().GetJsPropName()]={value:n.GetScriptInterface(),writable:!1};m=Object.create(Object.prototype,p);k.behaviors={value:m,writable:!1}}}DispatchUserScriptEvent(k){k.instance=this.GetInterfaceClass();var m=this._runtime;(m=m.IsDebug()&&!m.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();
this.GetInterfaceClass().dispatchEvent(k);m&&b.AddScriptTime()}}}"use strict";
{const f=self.C3;f.SceneGraphInfo=class extends f.DefendedBase{constructor(b){super();this._owner=b;this._parent=null;this._children=[];this._myStartWidth=b.GetWidth();this._myStartHeight=b.GetHeight();this._parentStartAngle=0}Release(){this._parent=null;f.clearArray(this._children)}SetParent(b){this._parentStartAngle=(this._parent=b)?b.GetAngle():0}GetParent(){return this._parent}HasChildren(){return 0<this._children.length}GetChildren(){return this._children}_GetStartWidth(){return this._myStartWidth}_GetStartHeight(){return this._myStartHeight}GetParentScaleX(){return this._owner.GetTransformWithParentWidth()?this._parent.GetWidth()/
this._parent._GetSceneGraphInfo()._GetStartWidth():1}GetParentScaleY(){return this._owner.GetTransformWithParentHeight()?this._parent.GetHeight()/this._parent._GetSceneGraphInfo()._GetStartHeight():1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(){return{sw:this._myStartWidth,sh:this._myStartHeight,psa:this._parentStartAngle,c:this._children.map(b=>{let a="";b.GetTransformWithParentX()&&(a+="x");b.GetTransformWithParentY()&&(a+="y");b.GetTransformWithParentWidth()&&(a+="w");b.GetTransformWithParentHeight()&&
(a+="h");b.GetTransformWithParentAngle()&&(a+="a");b.GetTransformWithParentZElevation()&&(a+="z");b.GetDestroyWithParent()&&(a+="d");return{uid:b.GetInstance().GetUID(),f:a}})}}_LoadFromJson(b){this._myStartWidth=b.sw;this._myStartHeight=b.sh;this._parentStartAngle=b.psa}_OnAfterLoad(b){const a=this._owner,d=a.GetRuntime();for(const c of b.c){b=d.GetInstanceByUID(c.uid).GetWorldInfo();const e=c.f,g={};g.transformX=e.includes("x");g.transformY=e.includes("y");g.transformWidth=e.includes("w");g.transformHeight=
e.includes("h");g.transformAngle=e.includes("a");g.transformZElevation=e.includes("z");g.destroyWithParent=e.includes("d");a.AddChild(b,g)}}}}"use strict";
{const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad),d=f.New(f.Event,"bboxchange",!1),c=f.New(f.Color,0,0,0,0),e=f.New(f.CollisionPoly),g=f.New(f.Color,1,1,1,1),k=f.New(f.Rect,0,0,-1,-1),m=f.New(f.Rect,0,0,-1,-1),p=new Set(["absolute","relative"]),n=[];let u=!0;f.WorldInfo=class extends f.DefendedBase{constructor(q,r){super();this._inst=q;this._objectClass=q.GetObjectClass();this._runtime=q.GetRuntime();this._layer=r;this._zIndex=-1;this._flags=98331;this._objectClass.GetPlugin().IsRotatable()&&(this._flags|=
128);this._oy=this._ox=this._cosA=this._sinA=this._a=this._h=this._w=this._zElevation=this._y=this._x=NaN;this._boundingBox=f.New(f.Rect);this._boundingQuad=f.New(f.Quad);this._collisionCells=m;this._renderCells=k;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=g;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=f.New(f.InstanceEffectList,this._inst,this));this._sceneGraphInfo=
null;this._sceneGraphFlagsExportData=NaN;this._meshInfo=this._sceneGraphChildrenExportData=null}Release(){this._stateGroup&&(this._runtime.GetRenderer().ReleaseStateGroup(this._stateGroup),this._stateGroup=null);this._sourceCollisionPoly=null;this._transformedPolyInfo&&(this._transformedPolyInfo.poly.Release(),this._transformedPolyInfo=null);this._solidFilterTags&&(this._solidFilterTags.clear(),this._solidFilterTags=null);this.ReleaseMesh();this.HasParent()&&this.GetParent().RemoveChild(this);if(this.HasChildren()){const q=
[...this.GetChildren()];for(const r of q)this.RemoveChild(r)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(q){u=!1;this.SetXY(q[0],q[1]);this.SetZElevation(q[2]);this.SetSize(q[3],q[4]);this.IsRotatable()?this.SetAngle(q[6]):this._a=0;c.setFromJSON(q[7]);this._SetColor(c);this.SetOriginX(q[8]);this.SetOriginY(q[9]);this.SetBlendMode(q[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(q[12]);q[14]&&(this._sceneGraphFlagsExportData=
q[14][0],this._sceneGraphChildrenExportData=q[14][1]);u=!0;this._UpdateRendererStateGroup()}InitNoData(){this._sinA=this._a=this._h=this._w=this._zElevation=this._y=this._x=0;this._cosA=1;this._oy=this._ox=0;this._UpdateRendererStateGroup()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetInstance(){return this._inst}_GetParentOffsetAngle(){return this.GetTransformWithParentAngle()?this.GetParent().GetAngle()-this._sceneGraphInfo.GetParentStartAngle():0}SetX(q){q=+q;
if(this.GetTransformWithParentX()){const r=this._sceneGraphInfo;q-=this.GetX();const t=-this._GetParentOffsetAngle();0===t?this._x+=q/r.GetParentScaleX():(this._x+=Math.cos(t)*q/r.GetParentScaleX(),this.GetTransformWithParentY()&&(this._y+=Math.sin(t)*q/r.GetParentScaleY()))}else this._x=q}OffsetX(q){q=+q;this.GetTransformWithParentX()?this.SetX(this.GetX()+q):this._x+=q}GetX(){if(this.GetTransformWithParentX()){let q=this._x;const r=this._sceneGraphInfo,t=this.GetParent(),x=this._GetParentOffsetAngle();
0===x?q*=r.GetParentScaleX():(q=q*r.GetParentScaleX()*Math.cos(x),this.GetTransformWithParentY()&&(q-=this._y*r.GetParentScaleY()*Math.sin(x)));return t.GetX()+q}return this._x}SetY(q){q=+q;if(this.GetTransformWithParentY()){const r=this._sceneGraphInfo;q-=this.GetY();const t=-this._GetParentOffsetAngle();0===t?this._y+=q/r.GetParentScaleY():(this.GetTransformWithParentX()&&(this._x-=Math.sin(t)*q/r.GetParentScaleX()),this._y+=Math.cos(t)*q/r.GetParentScaleY())}else this._y=q}OffsetY(q){q=+q;this.GetTransformWithParentY()?
this.SetY(this.GetY()+q):this._y+=q}GetY(){if(this.GetTransformWithParentY()){let q=this._y;const r=this._sceneGraphInfo,t=this.GetParent(),x=this._GetParentOffsetAngle();0===x?q*=r.GetParentScaleY():(q=q*r.GetParentScaleY()*Math.cos(x),this.GetTransformWithParentX()&&(q+=this._x*r.GetParentScaleX()*Math.sin(x)));return t.GetY()+q}return this._y}SetXY(q,r){q=+q;r=+r;if(this.GetTransformWithParentXOrY()){const x=this.GetTransformWithParentX(),z=this.GetTransformWithParentY(),D=this._sceneGraphInfo,
G=q-this.GetX(),w=r-this.GetY();var t=-this._GetParentOffsetAngle();if(0===t)this._x=x?this._x+G/D.GetParentScaleX():q,this._y=z?this._y+w/D.GetParentScaleY():r;else{const B=Math.sin(t);t=Math.cos(t);this._x=x?z?this._x+(t*G-B*w)/D.GetParentScaleX():this._x+t*G/D.GetParentScaleX():q;this._y=z?x?this._y+(B*G+t*w)/D.GetParentScaleY():this._y+t*w/D.GetParentScaleY():r}}else this._x=q,this._y=r}OffsetXY(q,r){q=+q;r=+r;this.GetTransformWithParentXOrY()?this.SetXY(this.GetX()+q,this.GetY()+r):(this._x+=
q,this._y+=r)}EqualsXY(q,r){return this.GetX()===q&&this.GetY()===r}SetZElevation(q){q=+q;this.GetTransformWithParentZElevation()&&(q-=this.GetParent().GetZElevation());this._zElevation!==q&&(this._zElevation=q,this._UpdateZElevation(),q=this.GetLayer(),0!==this._zElevation&&q._SetAnyInstanceZElevated(),q.SetZIndicesChanged())}_UpdateZElevation(){this._UpdateRendererStateGroup();if(this.HasChildren()){const q=this.GetChildren();for(let r=0,t=q.length;r<t;r++){const x=q[r];x.GetTransformWithParentZElevation()&&
x._UpdateZElevation()}}}OffsetZElevation(q){this.SetZElevation(this.GetZElevation()+q)}GetZElevation(){return this.GetTransformWithParentZElevation()?this.GetParent().GetZElevation()+this._zElevation:this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(q){q=+q;this.GetTransformWithParentWidth()?this._w*=q/this.GetWidth():this._w=q}OffsetWidth(q){q=+q;this.GetTransformWithParentWidth()?this.SetWidth(this.GetWidth()+q):this._w+=q}GetWidth(){return this.GetTransformWithParentWidth()?
this.GetParent().GetWidth()*this._w:this._w}SetHeight(q){q=+q;this.GetTransformWithParentHeight()?this._h*=q/this.GetHeight():this._h=q}OffsetHeight(q){q=+q;this.GetTransformWithParentHeight()?this.SetHeight(this.GetHeight()+q):this._h+=q}GetHeight(){return this.GetTransformWithParentHeight()?this.GetParent().GetHeight()*this._h:this._h}SetSize(q,r){q=+q;r=+r;this.GetTransformWithParentWidth()?this._w*=q/this.GetWidth():this._w=q;this.GetTransformWithParentHeight()?this._h*=r/this.GetHeight():this._h=
r}GetSceneGraphScale(){if(this.HasParent()){const q=this._sceneGraphInfo;return Math.min(q.GetParentScaleX(),q.GetParentScaleY())}return 1}IsRotatable(){return 0!==(this._flags&128)}SetAngle(q){q=+q;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(q-=this.GetParent().GetAngle()),q=f.clampAngle(q),this._a!==q&&(this._a=q,this._MarkSinCosAngleChanged()))}OffsetAngle(q){q=+q;0!==q&&this.IsRotatable()&&(this._a=f.clampAngle(this._a+q),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|=
131072;if(this.HasChildren()){const q=this.GetChildren();for(let r=0,t=q.length;r<t;r++)q[r]._MarkSinCosAngleChanged()}}GetAngle(){return this.GetTransformWithParentAngle()?f.clampAngle(this.GetParent().GetAngle()+this._a):this._a}_MaybeUpdateSinCosAngle(){const q=this._flags;if(0!==(q&131072)){var r=this.GetAngle();this._sinA=Math.sin(r);this._cosA=Math.cos(r);this._flags=q&-131073}}GetSinAngle(){this._MaybeUpdateSinCosAngle();return this._sinA}GetCosAngle(){this._MaybeUpdateSinCosAngle();return this._cosA}SetOriginX(q){this._ox=
+q}OffsetOriginX(q){this._ox+=+q}GetOriginX(){return this._ox}SetOriginY(q){this._oy=+q}OffsetOriginY(q){this._oy+=+q}GetOriginY(){return this._oy}_SetColor(q){this._color.equals(q)||(this._color===g?(this._color=f.New(f.Color,q),this._colorPremultiplied=f.New(f.Color,q),this._colorPremultiplied.premultiply()):q.equalsRgba(1,1,1,1)?this._colorPremultiplied=this._color=g:(this._color.set(q),this._colorPremultiplied.set(q),this._colorPremultiplied.premultiply()),this._UpdateRendererStateGroup())}SetOpacity(q){q=
f.clamp(+q,0,1);this._color.a!==q&&(c.copyRgb(this._color),c.a=q,this._SetColor(c))}OffsetOpacity(q){this.SetOpacity(this.GetOpacity()+q)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(q){this._color.equalsIgnoringAlpha(q)||(c.copyRgb(q),c.a=this._color.a,this._SetColor(c))}SetUnpremultipliedColorRGB(q,r,t){c.setRgb(q,r,t);this.SetUnpremultipliedColor(c)}OffsetUnpremultipliedColorRGB(q,r,t){if(0!==q||0!==r||0!==t)c.copyRgb(this._color),c.r+=q,c.g+=r,c.b+=t,this.SetUnpremultipliedColor(c)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}GetDestroyWithParent(){return 0!==
(this._flags&256)}SetDestroyWithParent(q){this._SetFlag(256,q)}GetTransformWithParentX(){return 0!==(this._flags&512)}SetTransformWithParentX(q){this._SetFlag(512,q)}GetTransformWithParentY(){return 0!==(this._flags&1024)}GetTransformWithParentXOrY(){return 0!==(this._flags&1536)}SetTransformWithParentY(q){this._SetFlag(1024,q)}GetTransformWithParentWidth(){return 0!==(this._flags&2048)}SetTransformWithParentWidth(q){this._SetFlag(2048,q)}GetTransformWithParentHeight(){return 0!==(this._flags&4096)}SetTransformWithParentHeight(q){this._SetFlag(4096,
q)}GetTransformWithParentAngle(){return 0!==(this._flags&8192)}SetTransformWithParentAngle(q){this._SetFlag(8192,q)}GetTransformWithParentZElevation(){return 0!==(this._flags&16384)}SetTransformWithParentZElevation(q){this._SetFlag(16384,q)}_ClearAllSceneGraphFlags(){this._flags&=-32513}AddChild(q,r){if(q!==this&&!q.HasParent()&&!this._HasChildRecursive(q)&&!this._HasAnyParent(q)){var t=q.GetX(),x=q.GetY(),z=q.GetWidth(),D=q.GetHeight(),G=q.GetAngle(),w=q.GetZElevation();q._SetParent(this);q.SetTransformWithParentX(r.transformX);
q.SetTransformWithParentY(r.transformY);q.SetTransformWithParentWidth(r.transformWidth);q.SetTransformWithParentHeight(r.transformHeight);q.SetTransformWithParentAngle(r.transformAngle);q.SetTransformWithParentZElevation(r.transformZElevation);q.SetDestroyWithParent(r.destroyWithParent);r.transformX&&(q._x=t-this.GetX());r.transformY&&(q._y=x-this.GetY());r.transformWidth&&(q._w=z/this.GetWidth());r.transformHeight&&(q._h=D/this.GetHeight());r.transformAngle&&(q._a=G-this.GetAngle());r.transformZElevation&&
(q._zElevation=w-this.GetZElevation());this._AddChildToSceneGraphInfo(q);this.SetBboxChanged()}}RemoveChild(q){if(q.GetParent()===this){var r=q.GetX(),t=q.GetY(),x=q.GetWidth(),z=q.GetHeight(),D=q.GetAngle(),G=q.GetZElevation();q._SetParent(null);q._ClearAllSceneGraphFlags();q.SetXY(r,t);q.SetSize(x,z);q.SetAngle(D);q.SetZElevation(G);this._RemoveChildFromSceneGraphInfo(q);this.SetBboxChanged()}}_ResetAllSceneGraphState(){for(var q of this.children())this.RemoveChild(q);(q=this.GetParent())&&q.RemoveChild(this);
this._ClearAllSceneGraphFlags()}HasParent(){return null!==this.GetParent()}GetParent(){const q=this._sceneGraphInfo;return null!==q?q.GetParent():null}GetTopParent(){let q=this;for(;q.HasParent();)q=q.GetParent();return q}*parents(){let q=this.GetParent();for(;q;)yield q,q=q.GetParent()}HasChild(q){return this.GetChildren().includes(q)}HasChildren(){const q=this._sceneGraphInfo;return null!==q?q.HasChildren():!1}GetChildren(){const q=this._sceneGraphInfo;return null!==q?q.GetChildren():n}children(){return this.GetChildren()}*allChildren(){for(const q of this.children())yield q,
yield*q.allChildren()}GetChildCount(){return this.GetChildren().length}GetChildAt(q){const r=this.GetChildren();q=Math.floor(+q);return 0>q||q>=r.length?null:r[q]}_CreateSceneGraphInfo(q){this._sceneGraphInfo||(this._sceneGraphInfo=f.New(f.SceneGraphInfo,this));q&&this._sceneGraphInfo.SetParent(q)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&&(this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(q){q?(q._CreateSceneGraphInfo(null),
this._CreateSceneGraphInfo(q)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(q){if(!this.HasParent())return!1;const r=this.GetParent();return r===q?!0:r._HasAnyParent(q)}_HasChildRecursive(q){if(this.HasChild(q))return!0;for(const r of this.GetChildren())if(r._HasChildRecursive(q))return!0;return!1}_AddChildToSceneGraphInfo(q){this._sceneGraphInfo.GetChildren().push(q)}_RemoveChildFromSceneGraphInfo(q){const r=this._sceneGraphInfo.GetChildren(),
t=r.indexOf(q);-1!==t&&r.splice(t,1);0!==r.length||this.HasParent()||this._ReleaseSceneGraphInfo();q.HasChildren()||q._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){return this._sceneGraphChildrenExportData}_UpdateRendererStateGroup(){if(u){var q=this._runtime.GetRenderer();this._stateGroup&&q.ReleaseStateGroup(this._stateGroup);this._stateGroup=q.AcquireStateGroup(q.GetTextureFillShaderProgram()||"<default>",this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===
g}SetBlendMode(q){q|=0;if(0>q||31<q)throw new RangeError("invalid blend mode");this.GetBlendMode()!==q&&(this._flags=this._flags&-2080374785|q<<26,this._UpdateRendererStateGroup())}GetBlendMode(){return(this._flags&2080374784)>>26}_SetLayer(q){this._layer=q;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(q){this._zIndex=q|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(q,
r){this._flags=r?this._flags|q:this._flags&~q}IsVisible(){return 0!==(this._flags&1)}SetVisible(q){this._SetFlag(1,q)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(q){q=!!q;this.IsCollisionEnabled()!==q&&(this._SetFlag(8,q),q?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(q,r){this._SetFlag(32,q);this._solidFilterTags&&this._solidFilterTags.clear();if(r.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const t of r.split(" "))t&&
this._solidFilterTags.add(t.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(q){const r=0!==(this._flags&32),t=this._solidFilterTags;if(!q||!t)return!r;for(const x of t)if(q.has(x))return r;return!r}SetBboxChanged(){this._flags|=32786;this._objectClass._SetAnyCollisionCellChanged(!0);this._runtime.UpdateRender();this._layer.UsesRenderCells()&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags&=-3,this._UpdateRenderCell());0!==(this._flags&4)&&this._inst.Dispatcher().dispatchEvent(d);
if(null!==this._sceneGraphInfo){const q=this._sceneGraphInfo.GetChildren();for(let r=0,t=q.length;r<t;++r)q[r].SetBboxChanged()}}CalculateBbox(q,r,t){const x=this.GetX(),z=this.GetY(),D=this.GetWidth(),G=this.GetHeight(),w=this.GetAngle();q.setWH(x-this._ox*D,z-this._oy*G,D,G);t&&this.HasMesh()&&this._ExpandBboxForMesh(q);0===w?r.setFromRect(q):(q.offset(-x,-z),r.setFromRotatedRectPrecalc(q,this.GetSinAngle(),this.GetCosAngle()),r.offset(x,z),r.getBoundingBox(q));q.normalize()}_UpdateBbox(){const q=
this._flags;0!==(q&2)&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags=q&-3)}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(q){var r=this.GetX(),t=this.GetY();r=Math.round(r)-r;t=Math.round(t)-t;if(0===r&&0===t)return q;a.copy(q);a.offset(r,t);return a}OverwriteBoundingBox(q){this._boundingBox.copy(q);this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell();
this._UpdateRenderCell()}SetBboxChangeEventEnabled(q){this._SetFlag(4,q)}IsBboxChangeEventEnabled(){return 0!==(this._flags&4)}IsInViewport(q){return 0===this.GetZElevation()?q.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const q=this.GetLayer(),r=this.GetTotalZElevation();if(r>=q.GetCameraZ())return!1;q.GetViewportForZ(r,b);return b.intersectsRect(this.GetBoundingBox())}SetSourceCollisionPoly(q){this._sourceCollisionPoly=q;this._DiscardTransformedCollisionPoly();
this.HasMesh()&&(this._meshInfo.meshPoly=null)}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return null!==this._sourceCollisionPoly||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(q,r,t){let x=0,z=1;0!==t&&(x=Math.sin(t),z=Math.cos(t));return this._GetCustomTransformedCollisionPolyPrecalc(q,
r,t,x,z)}_GetCustomTransformedCollisionPolyPrecalc(q,r,t,x,z){let D=this._transformedPolyInfo;null===D&&(this._transformedPolyInfo=D={poly:f.New(f.CollisionPoly),width:NaN,height:NaN,angle:NaN});const G=D.poly;if(D.width===q&&D.height===r&&D.angle===t)return G;const w=this._sourceCollisionPoly;if(this.HasMesh()){const B=this.GetOriginX(),I=this.GetOriginY(),P=this.GetSourceMesh();let E=this._meshInfo.meshPoly;E||(w?(e.copy(w),e.offset(B,I)):e.setDefaultPoints(),E=P.InsertPolyMeshVertices(e),this._meshInfo.meshPoly=
E);P.TransformCollisionPoly(E,G);G.offset(-B,-I);G.transformPrecalc(q,r,x,z)}else w?(G.copy(w),G.transformPrecalc(q,r,x,z)):G.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());D.width=q;D.height=r;D.angle=t;return G}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);const q=this._transformedPolyInfo;null!==q&&(q.width=NaN)}CreateMesh(q,r){q=Math.floor(q);r=Math.floor(r);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();
this._meshInfo={sourceMesh:f.New(f.Gfx.Mesh,q,r),transformedMesh:f.New(f.Gfx.Mesh,q,r),meshPoly:null}}HasMesh(){return null!==this._meshInfo}GetSourceMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(q){this._SetFlag(32768,q)}IsMeshChanged(){return 0!==(this._flags&32768)}SetPhysicsBodyChanged(q){this._SetFlag(65536,q)}IsPhysicsBodyChanged(){return 0!==
(this._flags&65536)}_ExpandBboxForMesh(q){var r=this._meshInfo.sourceMesh;const t=Math.min(r.GetMinX(),0),x=Math.min(r.GetMinY(),0),z=Math.max(r.GetMaxX(),1);r=Math.max(r.GetMaxY(),1);const D=q.width(),G=q.height();q.offsetLeft(t*D);q.offsetTop(x*G);q.offsetRight((z-1)*D);q.offsetBottom((r-1)*G)}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(q,r,t){q=Math.floor(q);
r=Math.floor(r);var x=t.mode||"absolute";if(!p.has(x))throw Error("invalid mode");x="relative"===x;let z=t.x,D=t.y,G="number"===typeof t.u?t.u:x?0:-1;t="number"===typeof t.v?t.v:x?0:-1;if(!this.HasMesh())return!1;const w=this.GetSourceMesh(),B=w.GetMeshPointAt(q,r);if(null===B)return!1;x&&(z+=q/(w.GetHSize()-1),D+=r/(w.GetVSize()-1));-1!==G||x?(x&&(G+=q/(w.GetHSize()-1)),G=f.clamp(G,0,1)):G=B.GetU();-1!==t||x?(x&&(t+=r/(w.GetVSize()-1)),t=f.clamp(t,0,1)):t=B.GetV();if(B.GetX()===z&&B.GetY()===D&&
B.GetU()===G&&B.GetV()===t)return!1;B.SetX(z);B.SetY(D);B.SetU(G);B.SetV(t);this._DiscardTransformedCollisionPoly();return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(q,r){return this.GetBoundingBox().containsPoint(q,r)&&this.GetBoundingQuad().containsPoint(q,r)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(q,r):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(q-this.GetX(),r-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&
16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()){var q=this.GetBoundingBox(),r=this._objectClass._GetCollisionCellGrid(),t=this._collisionCells;b.set(r.XToCell(q.getLeft()),r.YToCell(q.getTop()),r.XToCell(q.getRight()),r.YToCell(q.getBottom()));t.equals(b)||(q=this._inst,t===m?(r.Update(q,null,b),this._collisionCells=f.New(f.Rect,b)):(r.Update(q,t,b),t.copy(b)),this._flags&=-17)}}_RemoveFromCollisionCells(){const q=this._collisionCells;q!==m&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,
q,null),this._collisionCells=m)}_UpdateRenderCell(){const q=this.GetLayer();if(q.UsesRenderCells()){var r=q.GetRenderGrid(),t=this.GetBoundingBox(),x=this._renderCells;b.set(r.XToCell(t.getLeft()),r.YToCell(t.getTop()),r.XToCell(t.getRight()),r.YToCell(t.getBottom()));x.equals(b)||(t=this._inst,x===k?(r.Update(t,null,b),this._renderCells=f.New(f.Rect,b)):(r.Update(t,x,b),x.copy(b)),q.SetRenderListStale())}}_RemoveFromRenderCells(){const q=this._renderCells;q!==k&&(this.GetLayer().GetRenderGrid().Update(this._inst,
q,null),this._renderCells=k)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const q=this._inst,r=this._layer,t=r._GetInstances();t.length&&t[t.length-1]===q||(r._RemoveInstance(q,!1),r._AddInstance(q,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const q=this._inst,r=this._layer,t=r._GetInstances();t.length&&t[0]===q||(r._RemoveInstance(q,!1),r._PrependInstance(q,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(q){const r=this._inst,t=this._layer;if(t.GetLayout()!==q.GetLayout())throw Error("layer from different layout");
q!==t&&(t._RemoveInstance(r,!0),this._SetLayer(q),q._AddInstance(r,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(q,r){const t=this._inst,x=this._layer;if(q.GetUID()!==t.GetUID()){var z=q.GetWorldInfo();if(!z)throw Error("expected world instance");var D=z.GetLayer();z=!1;x.GetIndex()!==D.GetIndex()&&(x._RemoveInstance(t,!0),this._SetLayer(D),D._AddInstance(t,!0),z=!0);q=D.MoveInstanceAdjacent(t,q,!!r);(z||q)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(q){this._SetFlag(64,
q)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(){const q={x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(q.ze=this.GetZElevation());0!==this.GetAngle()&&(q.a=this.GetAngle());this.HasDefaultColor()||(q.c=this._color.toJSON());.5!==this.GetOriginX()&&(q.oX=this.GetOriginX());.5!==this.GetOriginY()&&(q.oY=this.GetOriginY());0!==this.GetBlendMode()&&(q.bm=this.GetBlendMode());this.IsVisible()||
(q.v=this.IsVisible());this.IsCollisionEnabled()||(q.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&(q.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(q.fx=this._instanceEffectList._SaveToJson());const r=0!==(this._flags&32);r&&(q.sfi=r);this._solidFilterTags&&(q.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&(q.sgi=this._sceneGraphInfo._SaveToJson());return q}_LoadFromJson(q){u=!1;this._ResetAllSceneGraphState();this.SetX(q.x);this.SetY(q.y);this.SetWidth(q.w);
this.SetHeight(q.h);this._SetZIndex(q.zi);this.SetZElevation(q.hasOwnProperty("ze")?q.ze:0);this.SetAngle(q.hasOwnProperty("a")?q.a:0);q.hasOwnProperty("c")?c.setFromJSON(q.c):q.hasOwnProperty("o")?(c.copyRgb(this._color),c.a=q.o):c.setRgba(1,1,1,1);this._SetColor(c);this.SetOriginX(q.hasOwnProperty("oX")?q.oX:.5);this.SetOriginY(q.hasOwnProperty("oY")?q.oY:.5);this.SetBlendMode(q.hasOwnProperty("bm")?q.bm:0);this.SetVisible(q.hasOwnProperty("v")?q.v:!0);this.SetCollisionEnabled(q.hasOwnProperty("ce")?
q.ce:!0);this.SetBboxChangeEventEnabled(q.hasOwnProperty("be")?q.be:!1);this.SetSolidCollisionFilter(q.hasOwnProperty("sfi")?q.sfi:!1,q.hasOwnProperty("sft")?q.sft:"");this._instanceEffectList&&q.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(q.fx);if(q.hasOwnProperty("sgi")){this._CreateSceneGraphInfo(null);const r=this._sceneGraphInfo,t=q.sgi;r._LoadFromJson(t);const x=this.GetRuntime().Dispatcher(),z=()=>{x.removeEventListener("afterload",z);r._OnAfterLoad(t)};x.addEventListener("afterload",
z)}this.SetBboxChanged();u=!0;this._UpdateRendererStateGroup()}}}"use strict";
{const f=self.C3;f.BehaviorType=class extends f.DefendedBase{constructor(b,a){super();const d=b.GetRuntime(),c=d.GetPluginManager(),e=d.GetObjectReference(a[1]);c.HasBehaviorByConstructorFunction(e)||c.CreateBehavior(a);this._runtime=d;this._objectClass=b;this._behavior=c.GetBehaviorByConstructorFunction(e);this._sdkType=null;this._instSdkCtor=e.Instance;this._sid=a[2];this._name=a[0];this._jsPropName=this._runtime.GetJsPropName(a[3]);this._sdkType=f.New(e.Type,this);this.OnCreate()}static Create(b,
a){return f.New(f.BehaviorType,b,a)}Release(){this._behavior=this._runtime=null;this._sdkType.Release();this._instSdkCtor=this._sdkType=null}GetSdkType(){return this._sdkType}OnCreate(){this._sdkType.OnCreate()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetBehavior(){return this._behavior}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetSID(){return this._sid}GetJsPropName(){return this._jsPropName}}}"use strict";
{const f=self.C3,b=self.IBehaviorInstance;f.BehaviorInstance=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._behaviorType=a.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=a.instance;this._index=a.index;this._iScriptInterface=this._sdkInst=null;this._behavior._AddInstance(this._inst)}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);this._behavior._RemoveInstance(this._inst);this._sdkInst.Release();
this._inst=this._behavior=this._behaviorType=this._runtime=this._iScriptInterface=this._sdkInst=null}_CreateSdkInstance(a){if(this._sdkInst)throw Error("already got sdk instance");this._sdkInst=f.New(this._behaviorType.GetInstanceSdkCtor(),this,a);this._InitScriptInterface()}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(a,
d){this._sdkInst.OnSpriteFrameChanged(a,d)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(a,d){var c=a.GetObjectInstance(),e=d.GetObjectInstance();const g=c.GetObjectClass().GetIndex(),k=e.GetObjectClass().GetIndex();if(g!==k)return g-k;c=c.GetPUID();e=e.GetPUID();return c!==e?c-e:a.GetBehaviorInstance()._GetIndex()-d.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const a=
this._sdkInst.GetScriptInterfaceClass(),d=a||b;b._Init(this);this._iScriptInterface=new d;b._Init(null);if(a&&!(this._iScriptInterface instanceof b))throw new TypeError(`script interface class '${a.name}' does not extend the right base class '${b.name}'`);}GetScriptInterface(){return this._iScriptInterface}}}"use strict";
{const f=self.C3;f.EffectList=class extends f.DefendedBase{constructor(b,a){super();this._owner=b;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const d of a)b=f.New(f.EffectType,this,d,this._allEffectTypes.length),this._allEffectTypes.push(b),this._effectTypesByName.set(b.GetName().toLowerCase(),b),3<=d.length&&this._effectParams.push(this._LoadSingleEffectParameters(d[2]));this.GetRuntime()._AddEffectList(this)}Release(){f.clearArray(this._allEffectTypes);
f.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();f.clearArray(this._effectParams);this._owner=null}PrependEffectTypes(b){if(b.length){this._allEffectTypes=b.concat(this._allEffectTypes);for(const a of b)this._effectTypesByName.set(a.GetName().toLowerCase(),a);for(let a=0,d=this._allEffectTypes.length;a<d;++a)this._allEffectTypes[a]._SetIndex(a)}}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,d=b.length;a<d;++a){const c=b[a];if(Array.isArray(c)){const e=f.New(f.Color);
e.setFromJSON(c);b[a]=e}}return b}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){f.clearArray(this._activeEffectTypes);let b=!0;for(const a of this._allEffectTypes)a.IsActive()&&(this._activeEffectTypes.push(a),a.GetShaderProgram().PreservesOpaqueness()||(b=!1));this._preservesOpaqueness=b}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return 0<this._allEffectTypes.length}GetEffectTypeByName(b){return this._effectTypesByName.get(b.toLowerCase())||
null}GetEffectTypeByIndex(b){b=Math.floor(+b);if(0>b||b>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[b]}IsEffectIndexActive(b){return this.GetEffectTypeByIndex(b).IsActive()}SetEffectIndexActive(b,a){this.GetEffectTypeByIndex(b).SetActive(a)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return 0<this._activeEffectTypes.length}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(b){return this._effectParams[b]}static SaveFxParamToJson(b){return b&&
b instanceof f.Color?{t:"color",v:b.toJSON()}:b}static LoadFxParamFromJson(b){if("object"===typeof b){if("color"===b.t){const a=f.New(f.Color);a.setFromJSON(b.v);return a}throw Error("invalid effect parameter type");}return b}static SaveFxParamsToJson(b){return b.map(f.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(b){return b.map(f.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(b=>({name:b.GetName(),active:b.IsActive(),params:f.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}LoadFromJson(b){for(const a of b)if(b=
this.GetEffectTypeByName(a.name))b.SetActive(a.active),this._effectParams[b.GetIndex()]=f.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}"use strict";
{const f=self.C3;f.EffectType=class extends f.DefendedBase{constructor(b,a,d){super();this._effectList=b;this._id=a[0];this._name=a[1];this._index=d;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(b){b=f.New(f.EffectType,b,[this._id,this._name],-1);b._shaderProgram=this._shaderProgram;b._isActive=this._isActive;return b}_InitRenderer(b){b=b.GetShaderProgramByName(this._id);if(!b)throw Error("failed to find shader program '"+this._id+"'");this._shaderProgram=
b}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(b){this._index=b}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(b){this._isActive=!!b}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const b=[];for(let a=0,d=this._shaderProgram.GetParameterCount();a<d;++a){const c=this._shaderProgram.GetParameterType(a);if("float"===c||"percent"===
c)b.push(0);else if("color"===c)b.push(f.New(f.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type");}return b}}}"use strict";
{const f=self.C3;f.InstanceEffectList=class extends f.DefendedBase{constructor(b,a,d){super();this._inst=b;this._wi=a;this._effectList=b.GetObjectClass().GetEffectList();this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const c of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){f.clearArray(this._activeEffectFlags);f.clearArray(this._activeEffectTypes);f.clearArray(this._effectParams);
this._effectList=this._inst=null}_LoadEffectParameters(b){for(const a of b)this._effectParams.push(this._LoadSingleEffectParameters(a))}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,d=b.length;a<d;++a){const c=b[a];if(Array.isArray(c)){const e=f.New(f.Color);e.setFromJSON(c);b[a]=e}}return b}LoadDefaultEffectParameters(){for(const b of this._effectList.GetAllEffectTypes())this._effectParams.push(b.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){f.clearArray(this._activeEffectTypes);
const b=this._effectList.GetAllEffectTypes(),a=this._activeEffectTypes,d=this._activeEffectFlags;let c=!0;for(let e=0,g=b.length;e<g;++e)if(d[e]){const k=b[e];a.push(k);k.GetShaderProgram().PreservesOpaqueness()||(c=!1)}this._preservesOpaqueness=c;this._wi._SetHasAnyActiveEffect(!!a.length)}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(b){return this._effectParams[b]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(b=>
b.GetShaderProgram().UsesDest())}IsEffectIndexActive(b){return this._activeEffectFlags[b]}SetEffectIndexActive(b,a){this._activeEffectFlags[b]=!!a}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(b=>({name:b.GetName(),active:this._activeEffectFlags[b.GetIndex()],params:f.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}_LoadFromJson(b){for(const a of b)if(b=this._effectList.GetEffectTypeByName(a.name))this._activeEffectFlags[b.GetIndex()]=
a.active,this._effectParams[b.GetIndex()]=f.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}"use strict";
{const f=self.C3,b=[],a=[],d=[],c=f.New(f.CollisionPoly),e=f.New(f.CollisionPoly),g=f.New(f.Quad),k=f.New(f.Rect),m=f.New(f.Rect);f.CollisionEngine=class extends f.DefendedBase{constructor(p){super();this._runtime=p;this._registeredCollisions=[];this._polyCheckSec=this._polyCheckCount=this._collisionCheckSec=this._collisionCheckCount=0}Release(){this._runtime=null}_Update1sStats(){this._collisionCheckSec=this._collisionCheckCount;this._collisionCheckCount=0;this._polyCheckSec=this._polyCheckCount;
this._polyCheckCount=0}Get1secCollisionChecks(){return this._collisionCheckSec}Get1secPolyChecks(){return this._polyCheckSec}RegisterCollision(p,n){const u=p.GetWorldInfo(),q=n.GetWorldInfo();u&&q&&u.IsCollisionEnabled()&&q.IsCollisionEnabled()&&this._registeredCollisions.push([p,n])}AddRegisteredCollisionCandidates(p,n,u){for(const [q,r]of this._registeredCollisions){let t;if(p===q)t=r;else if(p===r)t=q;else continue;t.BelongsToObjectClass(n)&&(u.includes(t)||u.push(t))}}CheckRegisteredCollision(p,
n){if(!this._registeredCollisions.length)return!1;for(const [u,q]of this._registeredCollisions)if(p===u&&n===q||p===q&&n===u)return!0;return!1}ClearRegisteredCollisions(){f.clearArray(this._registeredCollisions)}TestOverlap(p,n){if(!p||!n||p===n)return!1;p=p.GetWorldInfo();n=n.GetWorldInfo();if(!p.IsCollisionEnabled()||!n.IsCollisionEnabled())return!1;this._collisionCheckCount++;const u=p.GetLayer(),q=n.GetLayer();return u.IsTransformCompatibleWith(q)?this._TestOverlap_SameLayers(p,n):this._TestOverlap_DifferentLayers(p,
n)}_TestOverlap_SameLayers(p,n){if(!p.GetBoundingBox().intersectsRect(n.GetBoundingBox()))return!1;this._polyCheckCount++;if(!p.GetBoundingQuad().intersectsQuad(n.GetBoundingQuad())||p.HasTilemap()&&n.HasTilemap())return!1;if(p.HasTilemap())return this.TestTilemapOverlap(p,n);if(n.HasTilemap())return this.TestTilemapOverlap(n,p);if(!p.HasOwnCollisionPoly()&&!n.HasOwnCollisionPoly())return!0;const u=p.GetTransformedCollisionPoly(),q=n.GetTransformedCollisionPoly();return u.intersectsPoly(q,n.GetX()-
p.GetX(),n.GetY()-p.GetY())}_TestOverlap_DifferentLayers(p,n){var u=p.GetLayer();const q=n.GetLayer();c.copy(p.GetTransformedCollisionPoly());e.copy(n.GetTransformedCollisionPoly());var r=c.pointsArr();for(let t=0,x=r.length;t<x;t+=2){const z=t+1,D=r[z],[G,w]=u.LayerToCanvasCss(r[t]+p.GetX(),D+p.GetY());r[t]=G;r[z]=w}p=e.pointsArr();for(let t=0,x=p.length;t<x;t+=2){u=t+1;r=p[u];const [z,D]=q.LayerToCanvasCss(p[t]+n.GetX(),r+n.GetY());p[t]=z;p[u]=D}c.setBboxChanged();e.setBboxChanged();this._polyCheckCount++;
return c.intersectsPoly(e,0,0)}TestTilemapOverlap(p,n){const u=n.GetBoundingBox(),q=p.GetX(),r=p.GetY();var t=p.GetInstance().GetSdkInstance();p=n.GetX();const x=n.GetY(),z=n.HasOwnCollisionPoly(),D=n.GetBoundingQuad();t.GetCollisionRectCandidates(u,a);for(let B=0,I=a.length;B<I;++B){var G=a[B];t=G.GetRect();this._collisionCheckCount++;if(u.intersectsRectOffset(t,q,r)&&(g.setFromRect(t),g.offset(q,r),g.intersectsQuad(D)))if(z){var w=n.GetTransformedCollisionPoly();if(G=G.GetPoly()){if(this._polyCheckCount++,
G.intersectsPoly(w,p-(q+t.getLeft()),x-(r+t.getTop())))return f.clearArray(a),!0}else if(c.setFromQuad(g,0,0),c.intersectsPoly(w,p,x))return f.clearArray(a),!0}else if(w=G.GetPoly()){if(c.setFromQuad(D,0,0),w.intersectsPoly(c,-(q+t.getLeft()),-(r+t.getTop())))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestAndSelectCanvasPointOverlap(p,n,u,q){const r=p.GetCurrentSol();var t=this._runtime.GetCurrentEvent();if(!t)throw Error("cannot call outside event");t=t.IsOrBlock();
if(r.IsSelectAll()){q||(r._SetSelectAll(!1),f.clearArray(r._GetOwnInstances()));for(var x of p.GetInstances()){var z=x.GetWorldInfo(),D=z.GetLayer();const [G,w]=D.CanvasCssToLayer(n,u,z.GetTotalZElevation());if(z.ContainsPoint(G,w)){if(q)return!1;r._PushInstance(x)}else t&&r._PushElseInstance(x)}}else{x=t?r._GetOwnElseInstances():r._GetOwnInstances();z=0;for(let G=0,w=x.length;G<w;++G){D=x[G];const B=D.GetWorldInfo(),I=B.GetLayer(),[P,E]=I.CanvasCssToLayer(n,u,B.GetTotalZElevation());if(B.ContainsPoint(P,
E)){if(q)return!1;t?r._PushInstance(D):x[z++]=D}else t&&(x[z++]=D)}q||(x.length=z)}p.ApplySolToContainer();return q?!0:r.HasAnyInstances()}GetCollisionCandidates(p,n,u,q){p=p?1!==p.GetParallaxX()||1!==p.GetParallaxY():!1;if(n.IsFamily())for(const r of n.GetFamilyMembers())p||r.IsAnyInstanceParallaxed()?f.appendArray(q,r.GetInstances()):(r._UpdateAllCollisionCells(),r._GetCollisionCellGrid().QueryRange(u,q));else p||n.IsAnyInstanceParallaxed()?f.appendArray(q,n.GetInstances()):(n._UpdateAllCollisionCells(),
n._GetCollisionCellGrid().QueryRange(u,q))}GetObjectClassesCollisionCandidates(p,n,u,q){for(const r of n)this.GetCollisionCandidates(p,r,u,q)}GetSolidCollisionCandidates(p,n,u){const q=this._runtime.GetSolidBehavior();q&&this.GetObjectClassesCollisionCandidates(p,q.GetObjectClasses(),n,u)}GetJumpthruCollisionCandidates(p,n,u){const q=this._runtime.GetJumpthruBehavior();q&&this.GetObjectClassesCollisionCandidates(p,q.GetObjectClasses(),n,u)}IsSolidCollisionAllowed(p,n){return p._IsSolidEnabled()&&
(!n||n.GetWorldInfo().IsSolidCollisionAllowed(p.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(p){const n=p.GetWorldInfo();this.GetSolidCollisionCandidates(n.GetLayer(),n.GetBoundingBox(),b);for(const u of b)if(this.IsSolidCollisionAllowed(u,p)&&this.TestOverlap(p,u))return f.clearArray(b),u;f.clearArray(b);return null}TestRectOverlapSolid(p,n){this.GetSolidCollisionCandidates(null,p,b);for(const u of b)if(this.IsSolidCollisionAllowed(u,n)&&this.TestRectOverlap(p,u))return f.clearArray(b),
u;f.clearArray(b);return null}TestOverlapJumpthru(p,n){let u=null;n&&(u=d,f.clearArray(u));const q=p.GetWorldInfo();this.GetJumpthruCollisionCandidates(q.GetLayer(),q.GetBoundingBox(),b);for(const r of b)if(r._IsJumpthruEnabled()&&this.TestOverlap(p,r))if(n)u.push(r);else return f.clearArray(b),r;f.clearArray(b);return u}PushOut(p,n,u,q,r){q=q||50;const t=p.GetWorldInfo(),x=t.GetX(),z=t.GetY();for(let D=0;D<q;++D)if(t.SetXY(x+n*D,z+u*D),t.SetBboxChanged(),!this.TestOverlap(p,r))return!0;t.SetXY(x,
z);t.SetBboxChanged();return!1}PushOutSolid(p,n,u,q,r,t){q=q||50;const x=p.GetWorldInfo(),z=x.GetX(),D=x.GetY();let G=null,w=null;for(let B=0;B<q;++B)if(x.SetXY(z+n*B,D+u*B),x.SetBboxChanged(),!this.TestOverlap(p,G))if(G=this.TestOverlapSolid(p))w=G;else if(r&&(G=t?this.TestOverlap(p,t)?t:null:this.TestOverlapJumpthru(p))&&(w=G),!G)return w&&this.PushInFractional(p,n,u,w,16,!0),!0;x.SetXY(z,D);x.SetBboxChanged();return!1}PushOutSolidAxis(p,n,u,q){q=q||50;const r=p.GetWorldInfo(),t=r.GetX(),x=r.GetY();
let z=null,D=null;for(let G=0;G<q;++G)for(let w=0;2>w;++w){const B=2*w-1;r.SetXY(t+n*G*B,x+u*G*B);r.SetBboxChanged();if(!this.TestOverlap(p,z))if(z=this.TestOverlapSolid(p))D=z;else return D&&this.PushInFractional(p,n*B,u*B,D,16,!0),!0}r.SetXY(t,x);r.SetBboxChanged();return!1}PushInFractional(p,n,u,q,r,t){let x=2,z=!1;var D=!1;const G=p.GetWorldInfo();let w=G.GetX(),B=G.GetY();for(;x<=r;)D=1/x,x*=2,G.OffsetXY(n*D*(z?1:-1),u*D*(z?1:-1)),G.SetBboxChanged(),this.TestOverlap(p,q)||t&&this.TestOverlapSolid(p)?
D=z=!0:(D=z=!1,w=G.GetX(),B=G.GetY());D&&(G.SetXY(w,B),G.SetBboxChanged())}PushOutSolidNearest(p,n=100){let u=0;const q=p.GetWorldInfo(),r=q.GetX(),t=q.GetY();let x=0,z=this.TestOverlapSolid(p);if(!z)return!0;for(;u<=n;){let D=0,G=0;switch(x){case 0:D=0;G=-1;u++;break;case 1:D=1;G=-1;break;case 2:D=1;G=0;break;case 3:G=D=1;break;case 4:D=0;G=1;break;case 5:D=-1;G=1;break;case 6:D=-1;G=0;break;case 7:G=D=-1}x=(x+1)%8;q.SetXY(Math.floor(r+D*u),Math.floor(t+G*u));q.SetBboxChanged();if(!this.TestOverlap(p,
z)&&(z=this.TestOverlapSolid(p),!z))return!0}q.SetXY(r,t);q.SetBboxChanged();return!1}CalculateBounceAngle(p,n,u,q){const r=p.GetWorldInfo(),t=r.GetX(),x=r.GetY(),z=Math.max(10,f.distanceTo(n,u,t,x));var D=f.angleTo(n,u,t,x),G=q||this.TestOverlapSolid(p);if(!G)return f.clampAngle(D+Math.PI);let w=G;var B=0,I=0;const P=f.toRadians(5);let E;for(E=1;36>E;++E){const J=D-E*P;r.SetXY(n+Math.cos(J)*z,u+Math.sin(J)*z);r.SetBboxChanged();if(!this.TestOverlap(p,w)&&(w=q?null:this.TestOverlapSolid(p),!w)){B=
J;break}}36===E&&(B=f.clampAngle(D+Math.PI));w=G;for(E=1;36>E;++E)if(G=D+E*P,r.SetXY(n+Math.cos(G)*z,u+Math.sin(G)*z),r.SetBboxChanged(),!this.TestOverlap(p,w)&&(w=q?null:this.TestOverlapSolid(p),!w)){I=G;break}36===E&&(I=f.clampAngle(D+Math.PI));r.SetXY(t,x);r.SetBboxChanged();if(I===B)return I;p=f.angleDiff(I,B)/2;p=f.angleClockwise(I,B)?f.clampAngle(B+p+Math.PI):f.clampAngle(I+p);B=Math.cos(D);D=Math.sin(D);I=Math.cos(p);p=Math.sin(p);n=B*I+D*p;return f.angleTo(0,0,B-2*n*I,D-2*n*p)}TestSegmentOverlap(p,
n,u,q,r){if(!r)return!1;const t=r.GetWorldInfo();if(!t.IsCollisionEnabled())return!1;this._collisionCheckCount++;k.set(Math.min(p,u),Math.min(n,q),Math.max(p,u),Math.max(n,q));if(!t.GetBoundingBox().intersectsRect(k))return!1;if(r.HasTilemap())return this._TestSegmentOverlapTilemap(p,n,u,q,r,t);this._polyCheckCount++;return t.GetBoundingQuad().intersectsSegment(p,n,u,q)?t.HasOwnCollisionPoly()?t.GetTransformedCollisionPoly().intersectsSegment(t.GetX(),t.GetY(),p,n,u,q):!0:!1}_TestSegmentOverlapTilemap(p,
n,u,q,r,t){const x=t.GetX();t=t.GetY();r=r.GetSdkInstance();m.set(p,n,u,q);m.normalize();r.GetCollisionRectCandidates(m,a);for(let D=0,G=a.length;D<G;++D){var z=a[D];r=z.GetRect();this._collisionCheckCount++;if(k.intersectsRectOffset(r,x,t)&&(g.setFromRect(r),g.offset(x,t),g.intersectsSegment(p,n,u,q)))if(z=z.GetPoly()){if(this._polyCheckCount++,z.intersectsSegment(x+r.getLeft(),t+r.getTop(),p,n,u,q))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestRectOverlap(p,
n){if(!n)return!1;const u=n.GetWorldInfo();if(!u.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!u.GetBoundingBox().intersectsRect(p))return!1;if(n.HasTilemap())return this._TestRectOverlapTilemap(p,n,u);this._polyCheckCount++;g.setFromRect(p);if(!u.GetBoundingQuad().intersectsQuad(g))return!1;if(!u.HasOwnCollisionPoly())return!0;c.setFromRect(p,u.GetX(),u.GetY());p=u.GetTransformedCollisionPoly();return c.intersectsPoly(p,0,0)}_TestRectOverlapTilemap(p,n,u){const q=u.GetX();u=u.GetY();
n.GetSdkInstance().GetCollisionRectCandidates(p,a);for(let t=0,x=a.length;t<x;++t){var r=a[t];n=r.GetRect();this._collisionCheckCount++;if(p.intersectsRectOffset(n,q,u))if(r=r.GetPoly()){if(this._polyCheckCount++,c.setFromRect(p,0,0),r.intersectsPoly(c,-(q+n.getLeft()),-(u+n.getTop())))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestRayIntersectsInstance(p,n){if(p){var u=p.GetWorldInfo();u.IsCollisionEnabled()&&(this._collisionCheckCount++,u.GetBoundingBox().intersectsRect(n.rect)&&
(p.HasTilemap()?this._TestRayIntersectsTilemap(p,u,n):(this._polyCheckCount++,u.HasOwnCollisionPoly()?n.TestInstancePoly(p,u.GetX(),u.GetY(),u.GetTransformedCollisionPoly()):n.TestInstanceQuad(p,u.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(p,n,u){const q=n.GetX(),r=n.GetY();p.GetSdkInstance().GetCollisionRectCandidates(u.rect,a);for(let x=0,z=a.length;x<z;x++){var t=a[x];const D=t.GetRect();this._collisionCheckCount++;u.rect.intersectsRectOffset(D,q,r)&&(t=t.GetPoly(),this._polyCheckCount++,
t?u.TestInstancePoly(p,q+D.getLeft(),r+D.getTop(),t):u.TestInstanceRect(p,n.GetX(),n.GetY(),D))}f.clearArray(a)}}}"use strict";
{const f=self.C3;f.SparseGrid=class extends f.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=f.New(f.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,d){let c=this._cells.Get(b,a);return c?c:d?(c=f.New(f.GridCell,this,b,a),this._cells.Set(b,a,c),c):null}XToCell(b){b=Math.floor(b/this._cellWidth);return isFinite(b)?b:0}YToCell(b){b=Math.floor(b/this._cellHeight);return isFinite(b)?b:0}Update(b,a,d){if(a)for(let c=a.getLeft(),e=a.getRight();c<=
e;++c)for(let g=a.getTop(),k=a.getBottom();g<=k;++g){if(d&&d.containsPoint(c,g))continue;const m=this.GetCell(c,g,!1);m&&(m.Remove(b),m.IsEmpty()&&this._cells.Delete(c,g))}if(d)for(let c=d.getLeft(),e=d.getRight();c<=e;++c)for(let g=d.getTop(),k=d.getBottom();g<=k;++g)a&&a.containsPoint(c,g)||this.GetCell(c,g,!0).Insert(b)}QueryRange(b,a){let d=this.XToCell(b.getLeft());const c=this.YToCell(b.getTop()),e=this.XToCell(b.getRight());b=this.YToCell(b.getBottom());if(isFinite(e)&&isFinite(b))for(;d<=
e;++d)for(let g=c;g<=b;++g){const k=this.GetCell(d,g,!1);k&&k.Dump(a)}}}}"use strict";{const f=self.C3;f.GridCell=class extends f.DefendedBase{constructor(b,a,d){super();this._grid=b;this._x=a;this._y=d;this._instances=f.New(f.ArraySet)}Release(){this._instances.Release();this._grid=this._instances=null}IsEmpty(){return this._instances.IsEmpty()}Insert(b){this._instances.Add(b)}Remove(b){this._instances.Delete(b)}Dump(b){f.appendArray(b,this._instances.GetArray())}}}"use strict";
{const f=self.C3;f.Ray=class{constructor(){this.dy=this.dx=this.y2=this.x2=this.y1=this.x1=0;this.rect=new f.Rect;this.hitFraction=2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0}DidCollide(){return 1.000001>this.hitFraction}Set(b,a,d,c){this.x1=b;this.y1=a;this.x2=d;this.y2=c;this.dx=d-b;this.dy=c-a;this.rect.set(b,a,d,c);this.rect.normalize();this.hitFraction=2;this.hitUid=
null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0;return this}Complete(){if(!1!==this.DidCollide()){var b=this.dx*this.hitFraction,a=this.dy*this.hitFraction,d=Math.sqrt(b*b+a*a);b/=d;a/=d;this.distance=d-.000001;this.hitX=this.x1+b*this.distance;this.hitY=this.y1+a*this.distance;this.hitNormal=Math.atan2(this.hitNormalDy,this.hitNormalDx)+Math.PI/2;this.normalX=Math.cos(this.hitNormal);this.normalY=
Math.sin(this.hitNormal);d=b*this.normalX+a*this.normalY;this.reflectionX=b-2*this.normalX*d;this.reflectionY=a-2*this.normalY*d;0<d&&(this.hitNormal=f.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(b,a,d,c,e){const g=f.rayIntersect(this.x1,this.y1,this.x2,this.y2,a,d,c,e);0<=g&&g<this.hitFraction&&(this.hitFraction=g,this.hitUid=b.GetUID(),this.hitNormalDx=a-c,this.hitNormalDy=d-e)}TestInstanceRect(b,a,d,c){const e=a+c.getLeft();a+=
c.getRight();const g=d+c.getTop();d+=c.getBottom();this.TestInstanceSegment(b,e,g,a,g);this.TestInstanceSegment(b,a,g,a,d);this.TestInstanceSegment(b,a,d,e,d);this.TestInstanceSegment(b,e,d,e,g)}TestInstanceQuad(b,a){const d=a.getTlx(),c=a.getTly(),e=a.getTrx(),g=a.getTry(),k=a.getBrx(),m=a.getBry(),p=a.getBlx();a=a.getBly();this.TestInstanceSegment(b,d,c,e,g);this.TestInstanceSegment(b,e,g,k,m);this.TestInstanceSegment(b,k,m,p,a);this.TestInstanceSegment(b,p,a,d,c)}TestInstancePoly(b,a,d,c){c=c.pointsArr();
for(let e=0,g=c.length;e<g;e+=2){const k=(e+2)%g;this.TestInstanceSegment(b,c[e]+a,c[e+1]+d,c[k]+a,c[k+1]+d)}}}}"use strict";
{const f=self.C3,b=new Set("off crop scale-inner scale-outer letterbox-scale letterbox-integer-scale".split(" ")),a=new Set(["high","low"]),d=f.New(f.Quad),c=f.New(f.Rect);f.CanvasManager=class extends f.DefendedBase{constructor(e){super();this._runtime=e;this._webglRenderer=this._canvas=null;this._gpuPreference="high-performance";this._canvasCssOffsetY=this._canvasCssOffsetX=this._canvasDeviceHeight=this._canvasDeviceWidth=this._canvasCssHeight=this._canvasCssWidth=this._windowInnerHeight=this._windowInnerWidth=
0;this._enableMipmaps=!0;this._drawHeight=this._drawWidth=0;this._documentFullscreenMode=this._fullscreenMode="letterbox-scale";this._deviceTransformOffY=this._deviceTransformOffX=0;this._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=!1;this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets=new Set;this._gpuFrameTimingsBuffer=this._shaderData=null;this._gpuTimeEndFrame=this._gpuTimeStartFrame=0;this._gpuCurUtilisation=NaN;this._gpuLastUtilisation=
0;this._layersGpuProfile=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=f.New(f.Rect);this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=g=>this._loadingProgress=g.progress;this._loadingLogoAsset=this._percentText=null;this._splashTextures={logo:null,powered:null,website:null};this._splashFadeOutStartTime=this._splashFadeInFinishTime=this._splashFrameNumber=0;
this._splashState="fade-in";this._splashDoneResolve=null;this._splashDonePromise=new Promise(g=>this._splashDoneResolve=g)}_SetGPUPowerPreference(e){this._gpuPreference=e}async CreateCanvas(e){this._canvas=e.canvas;this._canvas.addEventListener("webglcontextlost",k=>this._OnWebGLContextLost(k));this._canvas.addEventListener("webglcontextrestored",k=>this._OnWebGLContextRestored(k));const g={powerPreference:this._gpuPreference,enableGpuProfiling:!0};"Android"===f.Platform.OS&&"Chromium"===f.Platform.BrowserEngine&&
75>f.Platform.BrowserVersionNumber&&(console.warn("[Construct 3] Disabling WebGL 2 because this device appears to be affected by crbug.com/934823. Install software updates to avoid this."),g.maxWebGLVersion=1);"standard"===this._runtime.GetCompositingMode()?g.alpha=!0:(g.alpha=!1,g.lowLatency=!0);this._webglRenderer=f.New(f.Gfx.WebGLRenderer,this._canvas,g);await this._webglRenderer.InitState();this._webglRenderer.SupportsGPUProfiling()||(this._gpuLastUtilisation=NaN);this._runtime.AddDOMComponentMessageHandler("runtime",
"window-resize",k=>this._OnWindowResize(k));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",k=>this._OnFullscreenChange(k));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",k=>this._OnFullscreenError(k));this._isDocumentFullscreen=!!e.isFullscreen;this.SetSize(e.windowInnerWidth,e.windowInnerHeight,!0);this._shaderData=self.C3_Shaders;await this._LoadShaderPrograms();e=!1;for(const k of this._runtime._GetAllEffectLists()){for(const m of k.GetAllEffectTypes())m._InitRenderer(this._webglRenderer),
m.GetShaderProgram().UsesDest()&&(e=!0);k.UpdateActiveEffects()}this._runtime._SetUsesAnyBackgroundBlending(e);this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=f.New(f.Gfx.WebGLQueryResultBuffer,this._webglRenderer));this._webglRenderer.SetMipmapsEnabled(this._enableMipmaps)}async _LoadShaderPrograms(){if(this._shaderData){var e=[];for(const [g,k]of Object.entries(this._shaderData)){const m=f.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource(this._webglRenderer.Is3D());e.push(this._webglRenderer.CreateShaderProgram(k,
m,g))}await Promise.all(e);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}}Release(){this._canvas=this._webglRenderer=this._runtime=null}_OnWindowResize(e){const g=e.devicePixelRatio;this._runtime.IsInWorker()&&(self.devicePixelRatio=g);this._runtime._SetDevicePixelRatio(g);this.SetSize(e.innerWidth,e.innerHeight);this._runtime.UpdateRender()}_OnFullscreenChange(e){this._isDocumentFullscreen=!!e.isFullscreen;this.SetSize(e.innerWidth,e.innerHeight,!0);this._runtime.UpdateRender()}_OnFullscreenError(e){this._isDocumentFullscreen=
!!e.isFullscreen;this.SetSize(e.innerWidth,e.innerHeight,!0);this._runtime.UpdateRender()}SetSize(e,g,k=!1){e=Math.floor(e);g=Math.floor(g);if(0>=e||0>=g)throw Error("invalid size");if(this._windowInnerWidth!==e||this._windowInnerHeight!==g||k)this._windowInnerWidth=e,this._windowInnerHeight=g,k=this.GetCurrentFullscreenMode(),"letterbox-scale"===k?this._CalculateLetterboxScale(e,g):"letterbox-integer-scale"===k?this._CalculateLetterboxIntegerScale(e,g):"off"===k?this._CalculateFixedSizeCanvas(e,
g):this._CalculateFullsizeCanvas(e,g),this._UpdateFullscreenScalingQuality(k),this._canvas.width=this._canvasDeviceWidth,this._canvas.height=this._canvasDeviceHeight,this._runtime.PostComponentMessageToDOM("canvas","update-size",{marginLeft:this._canvasCssOffsetX,marginTop:this._canvasCssOffsetY,styleWidth:this._canvasCssWidth,styleHeight:this._canvasCssHeight}),this._webglRenderer.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0)}_CalculateLetterboxScale(e,g){const k=this._runtime.GetDevicePixelRatio(),
m=this._runtime.GetOriginalViewportWidth(),p=this._runtime.GetOriginalViewportHeight(),n=m/p;e/g>n?(this._canvasCssWidth=Math.round(g*n),this._canvasCssHeight=g,this._canvasCssOffsetX=Math.floor((e-this._canvasCssWidth)/2),this._canvasCssOffsetY=0):(this._canvasCssWidth=e,this._canvasCssHeight=Math.round(e/n),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((g-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*k);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*
k);this._runtime.SetViewportSize(m,p)}_CalculateLetterboxIntegerScale(e,g){const k=this._runtime.GetDevicePixelRatio();1!==k&&(e+=1,g+=1);const m=this._runtime.GetOriginalViewportWidth(),p=this._runtime.GetOriginalViewportHeight();var n=m/p;n=e/g>n?g*n*k/m:e/n*k/p;1<n?n=Math.floor(n):1>n&&(n=1/Math.ceil(1/n));this._canvasDeviceWidth=Math.round(m*n);this._canvasDeviceHeight=Math.round(p*n);this._canvasCssWidth=this._canvasDeviceWidth/k;this._canvasCssHeight=this._canvasDeviceHeight/k;this._canvasCssOffsetX=
Math.max(Math.floor((e-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((g-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(m,p)}_CalculateFullsizeCanvas(e,g){const k=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=e;this._canvasCssHeight=g;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*k);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*k);this._canvasCssOffsetY=this._canvasCssOffsetX=0;e=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/
e,this._canvasCssHeight/e)}_CalculateFixedSizeCanvas(e,g){const k=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth*k);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*k);this.IsDocumentFullscreen()?(this._canvasCssOffsetX=Math.floor((e-this._canvasCssWidth)/2),this._canvasCssOffsetY=Math.floor((g-this._canvasCssHeight)/2)):this._canvasCssOffsetY=
this._canvasCssOffsetX=0;this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(e){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let k;if("off"===this.GetCurrentFullscreenMode()){var g=this._runtime.GetViewportWidth();k=this._runtime.GetViewportHeight()}else g=this._runtime.GetOriginalViewportWidth(),
k=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<g&&this._canvasDeviceHeight<k?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"):(this._drawWidth=g,this._drawHeight=k,this._fullscreenScalingQuality="low","scale-inner"===e?(e=g/k,g=this._windowInnerWidth/this._windowInnerHeight,g<e?this._drawWidth=this._drawHeight*g:g>e&&(this._drawHeight=this._drawWidth/g)):"scale-outer"===e&&(e=g/k,g=this._windowInnerWidth/
this._windowInnerHeight,g>e?this._drawWidth=this._drawHeight*g:g<e&&(this._drawHeight=this._drawWidth/g)))}}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(e){if(!b.has(e))throw Error("invalid fullscreen mode");this._fullscreenMode=e}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(e){if(!b.has(e))throw Error("invalid fullscreen mode");this._documentFullscreenMode=e}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?
this.GetDocumentFullscreenMode():this.GetFullscreenMode()}SetFullscreenScalingQuality(e){if(!a.has(e))throw Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=e}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(e){switch(e){case 0:return"off";case 1:return"crop";case 2:return"scale-inner";case 3:return"scale-outer";case 4:return"letterbox-scale";
case 5:return"letterbox-integer-scale";default:throw Error("invalid fullscreen mode");}}GetLastWidth(){return this._windowInnerWidth}GetLastHeight(){return this._windowInnerHeight}GetDrawWidth(){return this._drawWidth}GetDrawHeight(){return this._drawHeight}SetMipmapsEnabled(e){this._enableMipmaps=!!e}IsWebGLContextLost(){return this._webglRenderer.IsContextLost()}_OnWebGLContextLost(e){console.log("[Construct 3] WebGL context lost");e.preventDefault();this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets.clear();
this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(e){await this._webglRenderer.OnContextRestored();await this._LoadShaderPrograms();for(const g of this._runtime._GetAllEffectLists())for(const k of g.GetAllEffectTypes())k._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored();console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?
1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const e=this.GetCurrentFullscreenMode();if("off"===e||"crop"===e)return 1;const g=this._runtime.GetOriginalViewportWidth(),k=this._runtime.GetOriginalViewportHeight(),m=g/k,p=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==e&&p>m||"scale-inner"===e&&p<m?this._canvasCssHeight/k:this._canvasCssWidth/g}SetDeviceTransformOffset(e,g){this._deviceTransformOffX=e;this._deviceTransformOffY=g}SetDeviceTransform(e,
g,k){g=(g||this._drawWidth)/2+this._deviceTransformOffX;k=(k||this._drawHeight)/2+this._deviceTransformOffY;e.SetCameraXYZ(g,k,100*this._runtime.GetDevicePixelRatio());e.SetLookXYZ(g,k,0);e.ResetModelView();e.UpdateModelView()}SetCssTransform(e){const g=this._canvasCssWidth/2,k=this._canvasCssHeight/2;e.SetCameraXYZ(g,k,100);e.SetLookXYZ(g,k,0);e.ResetModelView();e.UpdateModelView()}GetDeviceWidth(){return this._canvasDeviceWidth}GetDeviceHeight(){return this._canvasDeviceHeight}GetCssWidth(){return this._canvasCssWidth}GetCssHeight(){return this._canvasCssHeight}GetCanvasClientX(){return this._canvasCssOffsetX}GetCanvasClientY(){return this._canvasCssOffsetY}GetAdditionalRenderTarget(e){const g=
this._availableAdditionalRenderTargets,k=g.findIndex(p=>p.IsCompatibleWithOptions(e));let m;-1!==k?(m=g[k],g.splice(k,1)):m=this._webglRenderer.CreateRenderTarget(e);this._usedAdditionalRenderTargets.add(m);return m}ReleaseAdditionalRenderTarget(e){if(!this._usedAdditionalRenderTargets.has(e))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(e);this._availableAdditionalRenderTargets.push(e)}*activeLayersGpuProfiles(){for(const e of this._runtime.GetLayoutManager().runningLayouts())for(const g of e.GetLayers()){const k=
this._layersGpuProfile.get(g);k&&(yield k)}}GetLayerTimingsBuffer(e){if(!this._webglRenderer.SupportsGPUProfiling())return null;let g=this._layersGpuProfile.get(e);g||(g={name:e.GetName(),timingsBuffer:f.New(f.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(e,g));return g.timingsBuffer}_Update1sFrameRange(){if(this._webglRenderer.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=this._webglRenderer.GetFrameNumber();
this._gpuCurUtilisation=NaN;for(const e of this.activeLayersGpuProfiles())e.curUtilisation=NaN}}_UpdateTick(){if(this._webglRenderer.SupportsGPUProfiling()&&isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const e of this.activeLayersGpuProfiles())if(e.curUtilisation=e.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,
this._gpuTimeEndFrame),isNaN(e.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const e of this.activeLayersGpuProfiles())e.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),e.lastUtilisation=Math.min(e.curUtilisation,1);self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;
this._gpuTimeEndFrame=0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(e,g,k,m,p,n){this._snapshotFormat=e;this._snapshotQuality=g;this._snapshotArea.setWH(k,m,p,n);return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(u=>{this._snapshotResolve=u})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var e=this._canvas,g=this._snapshotArea,k=f.clamp(Math.floor(g.getLeft()),0,e.width),m=f.clamp(Math.floor(g.getTop()),
0,e.height),p=g.width();p=0===p?e.width-k:f.clamp(Math.floor(p),0,e.width-k);g=g.height();g=0===g?e.height-m:f.clamp(Math.floor(g),0,e.height-m);(0!==k||0!==m||p!==e.width||g!==e.height)&&0<p&&0<g&&(e=f.CreateCanvas(p,g),e.getContext("2d").drawImage(this._canvas,k,m,p,g,0,0,p,g));f.CanvasToBlob(e,this._snapshotFormat,this._snapshotQuality).then(n=>{this._snapshotUrl=URL.createObjectURL(n);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat="";this._snapshotQuality=
1}}GetCanvasSnapshotUrl(){return this._snapshotUrl}InitLoadingScreen(e){if(2===e)this._percentText=f.New(f.Gfx.RendererText,this._webglRenderer),this._percentText.SetIsAsync(!1),this._percentText.SetFontName("Arial"),this._percentText.SetFontSize(16),this._percentText.SetHorizontalAlignment("center"),this._percentText.SetVerticalAlignment("center"),this._percentText.SetSize(300,200);else if(0===e){const g=this._runtime.GetLoadingLogoFilename();e=this._runtime.GetAssetManager();let k;if(this._runtime.IsPreview()){if(!e._HasLocalUrlBlob(g))return;
k=e.GetLocalUrlAsBlobUrl(g)}else k=e.GetIconsSubfolder()+g;this._loadingLogoAsset=e.LoadImage({url:k});this._loadingLogoAsset.LoadStaticTexture(this._webglRenderer).catch(m=>console.warn(`[C3 runtime] Failed to load '${g}' for loading screen. Check the project has an icon with that name.`,m))}else 4===e&&(this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(g=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.logo=g}).catch(g=>console.warn("Failed to load splash image: ",
g)),this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(g=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.powered=g}).catch(g=>console.warn("Failed to load splash image: ",g)),this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(g=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.website=g}).catch(g=>console.warn("Failed to load splash image: ",g)))}async _LoadSvgSplashImage(e){e=
(new URL(e,this._runtime.GetBaseURL())).toString();e=await f.FetchBlob(e);e=await this._runtime.RasterSvgImage(e,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(e,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(e){e=(new URL(e,this._runtime.GetBaseURL())).toString();e=await f.FetchBlob(e);return await this._webglRenderer.CreateStaticTextureAsync(e,{mipMapQuality:"high"})}HideCordovaSplashScreen(){this._runtime.PostComponentMessageToDOM("runtime","hide-cordova-splash")}StartLoadingScreen(){this._loaderStartTime=
Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen());3!==this._runtime.GetLoaderStyle()&&this.HideCordovaSplashScreen()}async EndLoadingScreen(){this._loadingProgress=1;const e=this._runtime.GetLoaderStyle();4===e&&await this._splashDonePromise;this._splashDonePromise=this._splashDoneResolve=null;-1!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=-1);this._runtime.Dispatcher().removeEventListener("loadingprogress",
this._loadingprogress_handler);this._loadingprogress_handler=null;this._percentText&&(this._percentText.Release(),this._percentText=null);this._loadingLogoAsset&&(this._loadingLogoAsset.Release(),this._loadingLogoAsset=null);this._webglRenderer.Start();this._splashTextures.logo&&(this._webglRenderer.DeleteTexture(this._splashTextures.logo),this._splashTextures.logo=null);this._splashTextures.powered&&(this._webglRenderer.DeleteTexture(this._splashTextures.powered),this._splashTextures.powered=null);
this._splashTextures.website&&(this._webglRenderer.DeleteTexture(this._splashTextures.website),this._splashTextures.website=null);this._webglRenderer.ClearRgba(0,0,0,0);this._webglRenderer.Finish();this._splashState="done";this._gpuTimeStartFrame=this._webglRenderer.GetFrameNumber();3===e&&this.HideCordovaSplashScreen()}_DrawLoadingScreen(){if(-1!==this._rafId){var e=this._webglRenderer;e.Start();this._rafId=-1;var g=this._runtime.GetAssetManager().HasHadErrorLoading(),k=this._runtime.GetLoaderStyle();
3!==k&&(this.SetCssTransform(e),e.ClearRgba(0,0,0,0),e.ResetColor(),e.SetTextureFillMode(),e.SetTexture(null));if(0===k)this._DrawProgressBarAndLogoLoadingScreen(g);else if(1===k)this._DrawProgressBarLoadingScreen(g,120,0);else if(2===k)this._DrawPercentTextLoadingScreen(g);else if(3===k)f.noop();else if(4===k)this._DrawSplashLoadingScreen(g);else throw Error("invalid loader style");e.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}_DrawPercentTextLoadingScreen(e){e?this._percentText.SetColorRgb(1,
0,0):this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(100*this._loadingProgress)+"%");e=this._canvasCssWidth/2;const g=this._canvasCssHeight/2;d.setRect(e-150,g-100,e+150,g+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(d,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(e,g,k){const m=this._webglRenderer;m.SetColorFillMode();e?m.SetColorRgba(1,0,0,1):m.SetColorRgba(.118,.565,1,1);e=this._canvasCssWidth/2;const p=
this._canvasCssHeight/2,n=g/2;c.setWH(e-n,p-4+k,Math.floor(g*this._loadingProgress),8);m.Rect(c);c.setWH(e-n,p-4+k,g,8);c.offset(-.5,-.5);c.inflate(.5,.5);m.SetColorRgba(0,0,0,1);m.LineRect2(c);c.inflate(1,1);m.SetColorRgba(1,1,1,1);m.LineRect2(c)}_DrawProgressBarAndLogoLoadingScreen(e){if(this._loadingLogoAsset){var g=this._loadingLogoAsset.GetTexture();if(g){var k=g.GetWidth(),m=g.GetHeight(),p=this._canvasCssWidth/2,n=this._canvasCssHeight/2,u=k/2;m/=2;d.setRect(p-u,n-m,p+u,n+m);this._webglRenderer.SetTexture(g);
this._webglRenderer.Quad(d);this._DrawProgressBarLoadingScreen(e,k,m+16)}else this._DrawProgressBarLoadingScreen(e,120,0)}else this._DrawProgressBarLoadingScreen(e,120,0)}_DrawSplashLoadingScreen(e){const g=this._webglRenderer,k=this._splashTextures.logo,m=this._splashTextures.powered,p=this._splashTextures.website,n=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=n);const u=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),q=u?0:200,r=u?0:
3E3;let t=1;"fade-in"===this._splashState?t=Math.min((n-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&(t=Math.max(1-(n-this._splashFadeOutStartTime)/300,0));g.SetColorFillMode();g.SetColorRgba(.231*t,.251*t,.271*t,t);c.set(0,0,this._canvasCssWidth,this._canvasCssHeight);g.Rect(c);const x=Math.ceil(this._canvasCssWidth),z=Math.ceil(this._canvasCssHeight);let D;256<this._canvasCssHeight?(g.SetColorRgba(.302*t,.334*t,.365*t,t),D=Math.max(.005*z,2),c.setWH(0,.8*z-D/2,x,D),g.Rect(c),e?
g.SetColorRgba(t,0,0,t):g.SetColorRgba(.161*t,.953*t,.816*t,t),e=x*this._loadingProgress,c.setWH(.5*x-e/2,.8*z-D/2,e,D),g.Rect(c),g.SetColorRgba(t,t,t,t),g.SetTextureFillMode(),m&&(e=1.5*f.clamp(.22*z,105,.6*x),D=e/8,c.setWH(.5*x-e/2,.2*z-D/2,e,D),g.SetTexture(m),g.Rect(c)),k&&(D=e=Math.min(.395*z,.95*x),c.setWH(.5*x-e/2,.485*z-D/2,e,D),g.SetTexture(k),g.Rect(c)),p&&(e=1.5*f.clamp(.22*z,105,.6*x),D=e/8,c.setWH(.5*x-e/2,.868*z-D/2,e,D),g.SetTexture(p),g.Rect(c))):(g.SetColorRgba(.302*t,.334*t,.365*
t,t),D=Math.max(.005*z,2),c.setWH(0,.85*z-D/2,x,D),g.Rect(c),e?g.SetColorRgba(t,0,0,t):g.SetColorRgba(.161*t,.953*t,.816*t,t),e=x*this._loadingProgress,c.setWH(.5*x-e/2,.85*z-D/2,e,D),g.Rect(c),g.SetColorRgba(t,t,t,t),g.SetTextureFillMode(),k&&(D=e=.55*z,c.setWH(.5*x-e/2,.45*z-D/2,e,D),g.SetTexture(k),g.Rect(c)));this._splashFrameNumber++;"fade-in"===this._splashState&&300<=n-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=n);"wait"===this._splashState&&
n-this._splashFadeInFinishTime>=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=n);("fade-out"===this._splashState&&n-this._splashFadeOutStartTime>=300+q||u&&1<=this._loadingProgress&&500>n-this._loaderStartTime)&&this._splashDoneResolve()}}}"use strict";
{const f=self.C3,b=self.C3Debugger,a={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let d=!0;f.Runtime=class extends f.DefendedBase{constructor(c){c=Object.assign({},a,c);super();this._messagePort=c.messagePort;this._baseUrl=c.baseUrl;this._isHeadless=!!c.headless;this._hasDom=!!c.hasDom;this._isInWorker=!!c.isInWorker;d=c.ife;this._useAudio=!!c.useAudio;this._exportType=c.exportType;this._isiOSCordova=!!c.isiOSCordova;this._isiOSWebView=
!!c.isiOSWebView;this._isFBInstantAvailable=!!c.isFBInstantAvailable;this._opusWasmScriptUrl=c.opusWasmScriptUrl;this._opusWasmBinaryUrl=c.opusWasmBinaryUrl;this._dataJsonFilename="data.json";this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!c.isDebug);this._debuggingDisabled=0;const e=c.previewImageBlobs;var g=c.previewProjectFileBlobs;g&&Object.assign(e,g);(g=c.projectData)&&(e[this._dataJsonFilename]=g);this._additionalLoadPromises=[];this._additionalCreatePromises=
[];this._isUsingCreatePromises=!1;this._appId=this._projectUniqueId=this._projectVersion=this._projectName="";this._originalViewportHeight=this._originalViewportWidth=0;this._devicePixelRatio=self.devicePixelRatio;this._loaderStyle=this._viewportHeight=this._viewportWidth=this._parallaxYorigin=this._parallaxXorigin=0;this._usesLoaderLayout=!1;this._isLoading=!0;this._usesAnyBackgroundBlending=!1;this._loadingLogoFilename="loading-logo.png";this._assetManager=f.New(f.AssetManager,this,{defaultLoadPolicy:"html5"===
this._exportType||"scirra-arcade"===this._exportType||"instant-games"===this._exportType?"remote":"local",localUrlBlobs:e,isCordova:"cordova"===this._exportType,isiOSCordova:this._isiOSCordova,supportedAudioFormats:c.supportedAudioFormats});this._layoutManager=f.New(f.LayoutManager,this);this._eventSheetManager=f.New(f.EventSheetManager,this);this._pluginManager=f.New(f.PluginManager,this);this._collisionEngine=f.New(f.CollisionEngine,this);this._timelineManager=f.New(f.TimelineManager,this);this._transitionManager=
f.New(f.TransitionManager,this);this._allObjectClasses=[];this._objectClassesByName=new Map;this._objectClassesBySid=new Map;this._familyCount=0;this._allContainers=[];this._allEffectLists=[];this._currentLayoutStack=[];this._instancesPendingCreate=[];this._instancesPendingDestroy=new Map;this._isFlushingPendingInstances=this._hasPendingInstances=!1;this._nextUid=this._objectCount=0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick=new Set;this._instancesToReleaseAffectedObjectClasses=
new Set;this._objectReferenceTable=[];this._jsPropNameTable=[];this._canvasManager=null;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._tickCallbacks={normal:k=>{this._ruafId=this._rafId=-1;this.Tick(k)},tickOnly:k=>{this._ruafId=-1;this.Tick(k,!1,"skip-render")},renderOnly:()=>{this._rafId=-1;this.Render()}};this._ruafId=this._rafId=-1;this._execCount=this._tickCountNoSave=
this._tickCount=0;this._hasStartedTicking=this._isInTick=this._hasStarted=!1;this._isLayoutFirstTick=!0;this._suspendCount=0;this._scheduleTriggersThrottle=new f.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=f.New(f.KahanSum);this._wallTime=f.New(f.KahanSum);this._fpsFrameCount=-1;this._mainThreadTime=this._mainThreadTimeCounter=this._fps=this._fpsLastTime=0;this._isLoadingState=
!1;this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null;this._lastSaveJson="";this._triggerOnCreateAfterLoad=[];this._savegamesStorage=this._projectStorage=null;this._dispatcher=f.New(f.Event.Dispatcher);this._domEventHandlers=new Map;this._pendingResponsePromises=new Map;this._nextDomResponseId=0;this._isReadyToHandleEvents=this._didRequestDeviceMotionEvent=this._didRequestDeviceOrientationEvent=!1;this._waitingToHandleEvents=[];this._eventObjects={pretick:f.New(f.Event,"pretick",
!1),tick:f.New(f.Event,"tick",!1),tick2:f.New(f.Event,"tick2",!1),instancedestroy:f.New(f.Event,"instancedestroy",!1),beforelayoutchange:f.New(f.Event,"beforelayoutchange",!1),layoutchange:f.New(f.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=f.New(f.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);
this._behInstsToTick2=f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);this._jobScheduler=f.New(f.JobSchedulerRuntime,this,c.jobScheduler);c.canvas&&(this._canvasManager=f.New(f.CanvasManager,this));this._messagePort.onmessage=k=>this._OnMessageFromDOM(k.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",k=>this._OnVisibilityChange(k));this.AddDOMComponentMessageHandler("runtime","opus-decode",k=>this._WasmDecodeWebMOpus(k.arrayBuffer));this.AddDOMComponentMessageHandler("runtime",
"get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",k=>this._InvokeFunctionFromJS(k));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",k=>this._OnWindowBlur(k));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus());this._timelineManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=
new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(c){return f.New(f.Runtime,c)}Release(){f.clearArray(this._allObjectClasses);this._objectClassesByName.clear();this._objectClassesBySid.clear();this._layoutManager.Release();this._layoutManager=null;this._eventSheetManager.Release();this._eventSheetManager=null;this._pluginManager.Release();this._pluginManager=null;this._assetManager.Release();this._assetManager=null;this._collisionEngine.Release();this._collisionEngine=
null;this._timelineManager.Release();this._timelineManager=null;this._transitionManager.Release();this._transitionManager=null;this._canvasManager&&(this._canvasManager.Release(),this._canvasManager=null);this._dispatcher.Release();this._tickEvent=this._dispatcher=null}["_OnMessageFromDOM"](c){const e=c.type;if("event"===e)this._OnEventFromDOM(c);else if("result"===e)this._OnResultFromDOM(c);else throw Error(`unknown message '${e}'`);}_OnEventFromDOM(c){if(this._isReadyToHandleEvents){var e=c.component,
g=c.handler,k=c.data,m=c.dispatchOpts,p=!(!m||!m.dispatchRuntimeEvent);m=!(!m||!m.dispatchUserScriptEvent);var n=c.responseId;if("runtime"===e&&(p&&(c=new f.Event(g),c.data=k,this._dispatcher.dispatchEventAndWaitAsyncSequential(c)),m)){c=new f.Event(g,!0);for(const [u,q]of Object.entries(k))c[u]=q;this.DispatchUserScriptEvent(c)}if(c=this._domEventHandlers.get(e))if(c=c.get(g)){p=null;try{p=c(k)}catch(u){console.error(`Exception in '${e}' handler '${g}':`,u);null!==n&&this._PostResultToDOM(n,!1,""+
u);return}null!==n&&(p&&p.then?p.then(u=>this._PostResultToDOM(n,!0,u)).catch(u=>{console.error(`Rejection from '${e}' handler '${g}':`,u);this._PostResultToDOM(n,!1,""+u)}):this._PostResultToDOM(n,!0,p))}else p||m||console.warn(`[Runtime] No DOM handler '${g}' for component '${e}'`);else p||m||console.warn(`[Runtime] No DOM event handlers for component '${e}'`)}else this._waitingToHandleEvents.push(c)}_PostResultToDOM(c,e,g){this._messagePort.postMessage({type:"result",responseId:c,isOk:e,result:g})}_OnResultFromDOM(c){const e=
c.responseId,g=c.isOk;c=c.result;const k=this._pendingResponsePromises.get(e);g?k.resolve(c):k.reject(c);this._pendingResponsePromises.delete(e)}AddDOMComponentMessageHandler(c,e,g){let k=this._domEventHandlers.get(c);k||(k=new Map,this._domEventHandlers.set(c,k));if(k.has(e))throw Error(`[Runtime] Component '${c}' already has handler '${e}'`);k.set(e,g)}PostComponentMessageToDOM(c,e,g){this._messagePort.postMessage({type:"event",component:c,handler:e,data:g,responseId:null})}PostComponentMessageToDOMAsync(c,
e,g){const k=this._nextDomResponseId++,m=new Promise((p,n)=>{this._pendingResponsePromises.set(k,{resolve:p,reject:n})});this._messagePort.postMessage({type:"event",component:c,handler:e,data:g,responseId:k});return m}PostToDebugger(c){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",c)}async Init(c){this.IsDebug()?await b.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);var [e]=await Promise.all([this._assetManager.FetchJson(this._dataJsonFilename),
this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(e);await this._InitialiseCanvas(c);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");(e=this.GetWebGLRenderer())?(console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${e.GetWebGLVersionNumber()} [${e.GetUnmaskedRenderer()}] (${e.IsDesynchronized()?"desynchronized":"standard"} compositing)`),e.HasMajorPerformanceCaveat()&&
console.warn("[C3 runtime] WebGL indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.")):console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, headless`);this._isReadyToHandleEvents=!0;for(const g of this._waitingToHandleEvents)this._OnEventFromDOM(g);f.clearArray(this._waitingToHandleEvents);this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const g of c.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(g));
await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);f.clearArray(this._additionalLoadPromises);if(this._assetManager.HasHadErrorLoading())this._canvasManager&&this._canvasManager.HideCordovaSplashScreen();else return this._canvasManager&&await this._canvasManager.EndLoadingScreen(),await this._dispatcher.dispatchEventAndWaitAsync(new f.Event("beforeruntimestart")),await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(c){try{await c(this._iRuntime)}catch(e){console.error("[C3 runtime] Error in runOnStartup function: ",
e)}}_LoadDataJson(c){c=c.project;this._projectName=c[0];this._projectVersion=c[16];this._projectUniqueId=c[31];this._appId=c[38];this._loadingLogoFilename=c[39];this._isPixelRoundingEnabled=!!c[9];this._originalViewportWidth=this._viewportWidth=c[10];this._originalViewportHeight=this._viewportHeight=c[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=c[36];this._framerateMode=c[37];"low-latency"===this._compositingMode&&
this.IsAndroidWebView()&&77>=f.Platform.BrowserVersionNumber&&(console.warn("[C3 runtime] Desynchronized (low-latency) compositing is enabled, but is disabled in the Android WebView <=77 due to crbug.com/1008842. Reverting to synchronized (standard) compositing."),this._compositingMode="standard");this._sampling=c[14];this._usesLoaderLayout=!!c[18];this._loaderStyle=c[19];this._nextUid=c[21];this._pauseOnBlur=c[22];this._assetManager._SetAudioFiles(c[7],c[25]);this._assetManager._SetMediaSubfolder(c[8]);
this._assetManager._SetFontsSubfolder(c[32]);this._assetManager._SetIconsSubfolder(c[28]);this._assetManager._SetWebFonts(c[29]);this._canvasManager&&(this._canvasManager.SetFullscreenMode(f.CanvasManager._FullscreenModeNumberToString(c[12])),this._canvasManager.SetFullscreenScalingQuality(c[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==c[24]),this._canvasManager._SetGPUPowerPreference(c[34]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();
for(var e of c[2])this._pluginManager.CreatePlugin(e);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var g of c[3])e=f.ObjectClass.Create(this,this._allObjectClasses.length,g),this._allObjectClasses.push(e),this._objectClassesByName.set(e.GetName().toLowerCase(),e),this._objectClassesBySid.set(e.GetSID(),e);for(const p of c[4])this._allObjectClasses[p[0]]._LoadFamily(p);for(var k of c[27])g=k.map(p=>this._allObjectClasses[p]),this._allContainers.push(f.New(f.Container,
this,g));for(const p of this._allObjectClasses)p._OnAfterCreate();for(const p of c[5])this._layoutManager.Create(p);(k=c[1])&&(k=this._layoutManager.GetLayoutByName(k))&&this._layoutManager.SetFirstLayout(k);for(var m of c[33])this._timelineManager.Create(m);for(const p of c[35])this._transitionManager.Create(p);this._InitScriptInterfaces();for(const p of c[6])this._eventSheetManager.Create(p);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();f.clearArray(this._objectReferenceTable);
this.FlushPendingInstances();m="any";c=c[20];1===c?m="portrait":2===c&&(m="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:m})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(c){this._additionalLoadPromises.push(c)}SetUsingCreatePromises(c){this._isUsingCreatePromises=!!c}AddCreatePromise(c){this._isUsingCreatePromises&&this._additionalCreatePromises.push(c)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(c){this._allEffectLists.push(c)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(c){this._canvasManager&&
(await this._canvasManager.CreateCanvas(c),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var c=null,e=null;try{this.IsiOSCordova()&&"file:"===location.protocol?e=await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):c=await this._assetManager.FetchBlob(this._opusWasmBinaryUrl)}catch(g){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",
g);return}e?this.AddJobWorkerBuffer(e,"opus-decoder-wasm"):this.AddJobWorkerBlob(c,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(c){return await this.AddJob("OpusDecode",{arrayBuffer:c},[c])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var c of this._allObjectClasses)c.IsFamily()||c.IsOnLoaderLayout()||!c.IsWorldType()||c.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=
!1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&b.RuntimeInit(d);for(const e of this._layoutManager.GetAllLayouts())e._CreateGlobalNonWorlds();c=this._layoutManager.GetFirstLayout();await c._Load(null,this.GetWebGLRenderer());await c._StartRunning(!0);this._fpsLastTime=performance.now();this._usesLoaderLayout||this._OnLoadFinished();(await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking")).isSuspended?this._suspendCount++:
this.Tick()}_OnLoadFinished(){this.Trigger(f.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(c){c=Math.floor(c);const e=this._objectReferenceTable;if(0>c||c>=e.length)throw Error("invalid object reference");return e[c]}_LoadJsPropNameTable(){for(const c of self.C3_JsPropNameTable){const e=f.first(Object.keys(c));this._jsPropNameTable.push(e)}}GetJsPropName(c){c=Math.floor(c);const e=this._jsPropNameTable;if(0>c||c>=e.length)throw Error("invalid prop reference");
return e[c]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetBaseURL(){return this._baseUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return 0===
this.GetCurrentEventStackFrame().GetConditionIndex()}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(c){c=Math.floor(c);if(0>c||c>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[c]}GetObjectClassByName(c){return this._objectClassesByName.get(c.toLowerCase())||null}GetObjectClassBySID(c){return this._objectClassesBySid.get(c)||
null}GetSingleGlobalObjectClassByCtor(c){return(c=this._pluginManager.GetPluginByConstructorFunction(c))?c.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(c){c.runtime=this.GetIRuntime();const e=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();e&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(c);e&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(c){c.runtime=
this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(c)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(c,e){this._originalViewportWidth=c;this._originalViewportHeight=e}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(c,e){this._viewportWidth=c;this._viewportHeight=e}_SetDevicePixelRatio(c){this._devicePixelRatio=
c}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){return this._canvasManager?this._canvasManager.GetDrawWidth():this._viewportWidth}GetDrawHeight(){return this._canvasManager?this._canvasManager.GetDrawHeight():this._viewportHeight}GetRenderScale(){return this._canvasManager?this._canvasManager.GetRenderScale():1}GetDisplayScale(){return this._canvasManager?
this._canvasManager.GetDisplayScale():1}GetCanvasClientX(){return this._canvasManager?this._canvasManager.GetCanvasClientX():0}GetCanvasClientY(){return this._canvasManager?this._canvasManager.GetCanvasClientY():0}GetCanvasCssWidth(){return this._canvasManager?this._canvasManager.GetCssWidth():0}GetCanvasCssHeight(){return this._canvasManager?this._canvasManager.GetCssHeight():0}GetFullscreenMode(){return this._canvasManager?this._canvasManager.GetFullscreenMode():"off"}GetAdditionalRenderTarget(c){return this._canvasManager?
this._canvasManager.GetAdditionalRenderTarget(c):null}ReleaseAdditionalRenderTarget(c){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(c)}_SetUsesAnyBackgroundBlending(c){this._usesAnyBackgroundBlending=!!c}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}GetGPUUtilisation(){return this._canvasManager?this._canvasManager.GetGPUUtilisation():NaN}IsLinearSampling(){return"nearest"!==this.GetSampling()}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoFilename(){return this._loadingLogoFilename}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetAssetManager(){return this._assetManager}LoadImage(c){return this._assetManager.LoadImage(c)}CreateInstance(c,
e,g,k){return this.CreateInstanceFromData(c,e,!1,g,k)}CreateInstanceFromData(c,e,g,k,m,p){let n=null,u=null;if(c instanceof f.ObjectClass){u=c;if(u.IsFamily()){c=u.GetFamilyMembers();var q=Math.floor(this.Random()*c.length);u=c[q]}n=u.GetDefaultInstanceData()}else n=c,u=this.GetObjectClassByIndex(n[1]);const r=u.GetPlugin().IsWorldType();if(this._isLoading&&r&&!u.IsOnLoaderLayout())return null;const t=e;r||(e=null);var x=g&&!p&&n&&!this._instancesByUid.has(n[2])?n[2]:this._nextUid++;q=n?n[0]:null;
c=f.New(f.Instance,{runtime:this,objectType:u,layer:e,worldData:q,instVarData:n?n[3]:null,uid:x});this._instancesByUid.set(x,c);x=null;r&&(x=c.GetWorldInfo(),"undefined"!==typeof k&&"undefined"!==typeof m&&(x.SetX(k),x.SetY(m)),u._SetAnyCollisionCellChanged(!0));e&&(e._AddInstance(c,!0),1===e.GetParallaxX()&&1===e.GetParallaxY()||u._SetAnyInstanceParallaxed(!0),e.GetLayout().MaybeLoadTexturesFor(u));this._objectCount++;if(u.IsInContainer()&&!g&&!p){for(var z of u.GetContainer().objectTypes())z!==
u&&(e=this.CreateInstanceFromData(z,t,!1,x?x.GetX():k,x?x.GetY():m,!0),c._AddSibling(e));for(const D of c.siblings()){D._AddSibling(c);for(const G of c.siblings())D!==G&&D._AddSibling(G)}}u._SetIIDsStale();k=n?f.cloneArray(n[5]):null;m=n?n[4].map(D=>f.cloneArray(D)):null;(z=r&&q&&14===q.length)&&c._SetHasTilemap();c._CreateSdkInstance(k,m);z&&(k=q[13],c.GetSdkInstance().LoadTilemapData(k[2],k[0],k[1]));this._instancesPendingCreate.push(c);this._hasPendingInstances=!0;this.IsDebug()&&b.InstanceCreated(c);
return c}DestroyInstance(c){if(!this._instancesToReleaseAtEndOfTick.has(c)){var e=c.GetObjectClass(),g=this._instancesPendingDestroy.get(e);if(g){if(g.has(c))return;g.add(c)}else g=new Set,g.add(c),this._instancesPendingDestroy.set(e,g);this.IsDebug()&&b.InstanceDestroyed(c);c._MarkDestroyed();this._hasPendingInstances=!0;if(c.IsInContainer())for(const k of c.siblings())this.DestroyInstance(k);for(const k of c.children())k.GetDestroyWithParent()&&this.DestroyInstance(k);this._layoutManager.IsEndingLayout()||
this._isLoadingState||(e=this.GetEventSheetManager(),e.BlockFlushingInstances(!0),c._TriggerOnDestroyed(),e.BlockFlushingInstances(!1));c._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances=this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const c of this._instancesPendingCreate){const e=
c.GetObjectClass();e._AddInstance(c);for(const g of e.GetFamilies())g._AddInstance(c),g._SetIIDsStale()}f.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [c,e]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(c,e),e.clear();this._instancesPendingDestroy.clear();this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(c,e){for(const k of e){var g=
this._eventObjects.instancedestroy;g.instance=k;this._dispatcher.dispatchEvent(g);this._instancesByUid.delete(k.GetUID());if(g=k.GetWorldInfo())g._RemoveFromCollisionCells(),g._RemoveFromRenderCells();this._instancesToReleaseAtEndOfTick.add(k);this._objectCount--}f.arrayRemoveAllInSet(c.GetInstances(),e);c._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(c);0===c.GetInstances().length&&c._SetAnyInstanceParallaxed(!1);for(const k of c.GetFamilies())f.arrayRemoveAllInSet(k.GetInstances(),
e),k._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(k);if(c.GetPlugin().IsWorldType()){c=new Set([...e].map(k=>k.GetWorldInfo().GetLayer()));for(const k of c)k._RemoveAllInstancesInSet(e)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(c,e){this._instancesByUid.set(c,e)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(f.New(f.Event,"webglcontextlost"));this.SetSuspended(!0);for(var c of this._allObjectClasses)!c.IsFamily()&&
c.HasLoadedTextures()&&c.ReleaseTextures();(c=this.GetMainRunningLayout())&&c._OnWebGLContextLost();f.ImageInfo.OnWebGLContextLost();f.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,this.GetWebGLRenderer());this._dispatcher.dispatchEvent(f.New(f.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(c){this.SetSuspended(c.hidden)}_OnWindowBlur(c){this.IsPreview()&&this._pauseOnBlur&&!f.Platform.IsMobile&&
!c.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const c=this._tickCallbacks;"vsync"===this._framerateMode?-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=f.RequestUnlimitedAnimationFrame(c.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.renderOnly))):
-1===this._ruafId&&(this._ruafId=f.RequestUnlimitedAnimationFrame(c.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(f.CancelUnlimitedAnimationFrame(this._ruafId),this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(c){var e=this.IsSuspended();this._suspendCount+=c?1:-1;0>this._suspendCount&&(this._suspendCount=0);c=this.IsSuspended();!e&&c?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),
this._dispatcher.dispatchEvent(f.New(f.Event,"suspend")),this.Trigger(f.Plugins.System.Cnds.OnSuspend,null,null)):e&&!c&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=e=performance.now(),this._mainThreadTimeCounter=this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(f.New(f.Event,"resume")),this.Trigger(f.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(e))}_AddBehInstToTick(c){this._behInstsToTick.Add(c)}_AddBehInstToPostTick(c){this._behInstsToPostTick.Add(c)}_AddBehInstToTick2(c){this._behInstsToTick2.Add(c)}_RemoveBehInstToTick(c){this._behInstsToTick.Remove(c)}_RemoveBehInstToPostTick(c){this._behInstsToPostTick.Remove(c)}_RemoveBehInstToTick2(c){this._behInstsToTick2.Remove(c)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);
for(const c of this._behInstsToTick)c.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick)c.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2)c.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const c of this._behInstsToTick){const e=
c.Tick();f.IsIterator(e)&&(yield*e)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick){const e=c.PostTick();f.IsIterator(e)&&(yield*e)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2){const e=c.Tick2();f.IsIterator(e)&&(yield*e)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(c,e,
g){this._hasStartedTicking=!0;const k="background-wake"===g;g="background-wake"!==g&&"skip-render"!==g;this._hasStarted&&(!this.IsSuspended()||e||k)&&(e=performance.now(),this._isInTick=!0,c||(c=e),this._MeasureDt(c),c=this.Step_BeforePreTick(),this.IsDebugging()&&await c,c=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),c instanceof Promise&&await c,c=this.Step_AfterPreTick(),this.IsDebugging()&&await c,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),
this.GetLayoutManager().IsPendingChangeMainLayout()&&await this._MaybeChangeLayout(),c=this.Step_RunEventsEtc(),this.IsDebugging()&&await c,g&&this.Render(),this.IsSuspended()||k||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-e)}async Step_BeforePreTick(){const c=this._eventSheetManager,e=this.IsDebug();this.FlushPendingInstances();c.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());
e&&b.StartMeasuringTime();this.IsDebugging()?await c.DebugRunScheduledWaits():c.RunScheduledWaits();e&&b.AddEventsTime();this.PopCurrentLayout();c.BlockFlushingInstances(!1);this.FlushPendingInstances();c.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const c=this.IsDebug(),e=this.IsDebugging(),g=this._dispatcher,k=this._eventObjects,m=this._userScriptEventObjects;c&&b.StartMeasuringTime();e?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();e?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):
this._BehaviorPostTick();c&&b.AddBehaviorTickTime();c&&b.StartMeasuringTime();e?await this.DebugFireGeneratorEventAndBreak(k.tick):g.dispatchEvent(k.tick);c&&b.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(m.tick)}async Step_RunEventsEtc(){const c=this._eventSheetManager,e=this._dispatcher,g=this._eventObjects,k=this.IsDebug(),m=this.IsDebugging();k&&b.StartMeasuringTime();m?await c.DebugRunEvents(this._layoutManager):c.RunEvents(this._layoutManager);
k&&b.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();if(0<this._instancesToReleaseAtEndOfTick.size){e.SetDelayRemoveEventsEnabled(!0);for(const p of this._instancesToReleaseAffectedObjectClasses)p.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const p of this._instancesToReleaseAtEndOfTick)p.Release();this._instancesToReleaseAtEndOfTick.clear();
e.SetDelayRemoveEventsEnabled(!1)}this._isLayoutFirstTick=!1;c.BlockFlushingInstances(!0);k&&b.StartMeasuringTime();m?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();k&&b.AddBehaviorTickTime();k&&b.StartMeasuringTime();m?await this.DebugFireGeneratorEventAndBreak(g.tick2):e.dispatchEvent(g.tick2);k&&b.AddPluginTickTime();c.BlockFlushingInstances(!1);m&&await c.RunQueuedDebugTriggersAsync()}async _MaybeChangeLayout(){const c=this.GetLayoutManager();let e=0;for(;c.IsPendingChangeMainLayout()&&
10>e++;)await this._DoChangeLayout(c.GetPendingChangeMainLayout())}_MeasureDt(c){if(0!==this._lastTickTime){this._dt1=Math.max(c-this._lastTickTime,0)/1E3;const e=1/this._minimumFramerate;.5<this._dt1?this._dt1=0:this._dt1>e&&(this._dt1=e)}this._lastTickTime=c;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=c-this._fpsLastTime&&(this._fpsLastTime+=1E3,1E3<=c-this._fpsLastTime&&(this._fpsLastTime=
c),this._fps=this._fpsFrameCount,this._fpsFrameCount=0,this._mainThreadTime=Math.min(this._mainThreadTimeCounter/1E3,1),this._mainThreadTimeCounter=0,this._canvasManager&&this._canvasManager._Update1sFrameRange(),this._collisionEngine._Update1sStats(),this.IsDebug()&&b.Update1sPerfStats());this._fpsFrameCount++}async _DoChangeLayout(c){const e=this._dispatcher,g=this.GetLayoutManager().GetMainRunningLayout();await g._StopRunning();g._Unload(c,this.GetWebGLRenderer());g===c&&this._eventSheetManager.ClearAllScheduledWaits();
this._collisionEngine.ClearRegisteredCollisions();e.dispatchEvent(this._eventObjects.beforelayoutchange);f.Asyncify.SetHighThroughputMode(!0);await c._Load(g,this.GetWebGLRenderer());f.Asyncify.SetHighThroughputMode(!1);await c._StartRunning(!1);e.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender=!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}GetRenderer(){return this.GetWebGLRenderer()}Render(){if(this._canvasManager&&
!this._canvasManager.IsWebGLContextLost()){var c=this.GetWebGLRenderer();c.Start();c.CheckForQueryResults();if(this._needRender){var e=this.IsDebug();e&&b.StartMeasuringTime();this._needRender=!1;var g=null;c.SupportsGPUProfiling()&&(g=this._canvasManager.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),c.StartQuery(g));c.SetTextureFillMode();c.SetAlphaBlend();c.SetColorRgba(1,1,1,1);c.SetRenderTarget(null);c.SetTexture(null);this._layoutManager.GetMainRunningLayout().Draw(c);g&&c.EndQuery(g);c.Finish();
e&&(b.AddDrawCallsTime(),b.UpdateInspectHighlight());this._canvasManager&&this._canvasManager._MaybeTakeSnapshot()}else c.IncrementFrameNumber()}}Trigger(c,e,g){if(!this._hasStarted)return!1;var k=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let m=0;k&&(m=performance.now());const p=this.IsDebug();p&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._Trigger(this._layoutManager,c,e,g);k&&(k=performance.now()-m,this._mainThreadTimeCounter+=k,p&&b.AddTriggersTime(k));p&&this.SetDebuggingEnabled(!0);
return c}DebugTrigger(c,e,g){if(!this.IsDebug())return this.Trigger(c,e,g);if(this.HitBreakpoint())throw Error("called DebugTrigger() while stopped on breakpoint");if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,c,e,g)}async TriggerAsync(c,e,g){if(!this.IsDebugging())return this.Trigger(c,e,g);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(c,
e,g);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(c,e,g);const k=performance.now();c=this._eventSheetManager._DebugTrigger(this._layoutManager,c,e,g);for(e=c.next();!e.done;)await this.DebugBreak(e.value),e=c.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-k;return e.value}FastTrigger(c,
e,g){const k=this.IsDebug();k&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._FastTrigger(this._layoutManager,c,e,g);k&&this.SetDebuggingEnabled(!0);return c}DebugFastTrigger(c,e,g){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,c,e,g)}ScheduleTriggers(c){return this._scheduleTriggersThrottle.Add(c)}PushCurrentLayout(c){this._currentLayoutStack.push(c)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty");this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?
this._currentLayoutStack[this._currentLayoutStack.length-1]:this.GetMainRunningLayout()}GetDt(c){return c&&-1!==c.GetTimeScale()?this._dt1*c.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(c){if(isNaN(c)||0>c)c=0;this._timeScale=c}SetMinimumFramerate(c){this._minimumFramerate=f.clamp(c,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}IncrementExecCount(){++this._execCount}GetExecCount(){return this._execCount}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(c){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event");
return this._instancesByUid.get(c)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const c of this._allObjectClasses)if(!c.IsFamily())for(const e of c.GetInstances())this._instancesByUid.set(e.GetUID(),e)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===f.Platform.OS&&("cordova"===this._exportType||"playable-ad"===this._exportType||"instant-games"===
this._exportType)}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(c){c=!!c;this._isPixelRoundingEnabled!==c&&(this._isPixelRoundingEnabled=c,this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(c){this._saveToSlotName=
c}LoadFromSlot(c){this._loadFromSlotName=c}LoadFromJsonString(c){this._loadFromJson=c}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!(!this._saveToSlotName&&!this._loadFromSlotName&&null===this._loadFromJson)}async _HandleSaveOrLoad(){this._saveToSlotName&&(this.FlushPendingInstances(),await this._DoSaveToSlot(this._saveToSlotName),this._ClearSaveOrLoad());this._loadFromSlotName&&(await this._DoLoadFromSlot(this._loadFromSlotName),this._ClearSaveOrLoad(),this.IsDebug()&&
b.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(c){console.error("[Construct 3] Failed to load state from JSON string: ",c),await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._loadFromSlotName=this._saveToSlotName=
"";this._loadFromJson=null}_GetProjectStorage(){this._projectStorage||(this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._projectStorage}_GetSavegamesStorage(){this._savegamesStorage||(this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._savegamesStorage}async _DoSaveToSlot(c){const e=await this._SaveToJsonString();
try{await this._GetSavegamesStorage().setItem(c,e),console.log("[Construct 3] Saved state to storage ("+e.length+" chars)"),this._lastSaveJson=e,await this.TriggerAsync(f.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(g){console.error("[Construct 3] Failed to save state to storage: ",g),await this.TriggerAsync(f.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(c){try{const e=await this._GetSavegamesStorage().getItem(c);if(!e)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+
e.length+" chars)");await this._DoLoadFromJsonString(e);this._lastSaveJson=e;await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(e){console.error("[Construct 3] Failed to load state from storage: ",e),await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const c={c3save:!0,version:1,rt:{time:this.GetGameTime(),walltime:this.GetWallTime(),timescale:this.GetTimeScale(),tickcount:this.GetTickCount(),execcount:this.GetExecCount(),
next_uid:this._nextUid,running_layout:this.GetMainRunningLayout().GetSID(),start_time_offset:Date.now()-this._startTime},types:{},layouts:{},events:this._eventSheetManager._SaveToJson(),timelines:this._timelineManager._SaveToJson(),user_script_data:null};for(var e of this._allObjectClasses)e.IsFamily()||e.HasNoSaveBehavior()||(c.types[e.GetSID().toString()]=e._SaveToJson());for(const g of this._layoutManager.GetAllLayouts())c.layouts[g.GetSID().toString()]=g._SaveToJson();e=this._CreateUserScriptEvent("save");
e.saveData=null;await this.DispatchUserScriptEventAsyncWait(e);c.user_script_data=e.saveData;return JSON.stringify(c)}IsLoadingState(){return this._isLoadingState}_TriggerOnCreateAfterLoad(c){f.shallowAssignArray(this._triggerOnCreateAfterLoad,c)}async _DoLoadFromJsonString(c){c=JSON.parse(c);if(c.c2save)throw Error("C2 saves are incompatible with C3 runtime");if(!c.c3save)throw Error("not valid C3 save data");if(1<c.version)throw Error("C3 save data from future version");this._isLoadingState=!0;
var e=c.rt;this._gameTime.Set(e.time);this._wallTime.Set(e.walltime);this._timeScale=e.timescale;this._tickCount=e.tickcount;this._execCount=e.execcount;this._startTime=Date.now()-e.start_time_offset;var g=e.running_layout;if(g!==this.GetMainRunningLayout().GetSID())if(g=this._layoutManager.GetLayoutBySID(g))await this._DoChangeLayout(g);else return;for(const [p,n]of Object.entries(c.types))g=parseInt(p,10),g=this.GetObjectClassBySID(g),!g||g.IsFamily()||g.HasNoSaveBehavior()||g._LoadFromJson(n);
this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=e.next_uid;for(const [p,n]of Object.entries(c.layouts))e=parseInt(p,10),(e=this._layoutManager.GetLayoutBySID(e))&&e._LoadFromJson(n);this._eventSheetManager._LoadFromJson(c.events);for(var k of this._triggerOnCreateAfterLoad)k._TriggerOnCreated(),k.SetupInitialSceneGraphConnections();f.clearArray(this._triggerOnCreateAfterLoad);for(var m of this._allObjectClasses)if(!m.IsFamily()&&m.IsInContainer())for(const p of m.GetInstances()){k=
p.GetIID();for(const n of m.GetContainer().objectTypes())if(n!==m){e=n.GetInstances();if(0>k||k>=e.length)throw Error("missing sibling instance");p._AddSibling(e[k])}}this._timelineManager._LoadFromJson(c.timelines);this._dispatcher.dispatchEvent(f.New(f.Event,"afterload"));m=this._CreateUserScriptEvent("load");m.saveData=c.user_script_data;await this.DispatchUserScriptEventAsyncWait(m);this.UpdateRender()}async AddJobWorkerScripts(c){c=(await Promise.all(c.map(e=>this._assetManager.FetchBlob(e)))).map(e=>
URL.createObjectURL(e));this._jobScheduler.ImportScriptsToJobWorkers(c)}AddJobWorkerBlob(c,e){this._jobScheduler.SendBlobToJobWorkers(c,e)}AddJobWorkerBuffer(c,e){this._jobScheduler.SendBufferToJobWorkers(c,e)}AddJob(c,e,g){return this._jobScheduler.AddJob(c,e,g)}BroadcastJob(c,e,g){return this._jobScheduler.BroadcastJob(c,e,g)}InvokeDownload(c,e){this.PostComponentMessageToDOM("runtime","invoke-download",{url:c,filename:e})}async RasterSvgImage(c,e,g,k,m,p){k=k||e;m=m||g;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime",
"raster-svg-image",{blob:c,imageWidth:e,imageHeight:g,surfaceWidth:k,surfaceHeight:m,imageBitmapOpts:p})).imageBitmap;c=await self.C3_RasterSvgImageBlob(c,e,g,k,m);return p?await self.createImageBitmap(c,p):c}async GetSvgImageSize(c){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{blob:c}):await self.C3_GetSvgImageSize(c)}RequestDeviceOrientationEvent(){this._didRequestDeviceOrientationEvent||(this._didRequestDeviceOrientationEvent=!0,this.PostComponentMessageToDOM("runtime",
"enable-device-orientation"))}RequestDeviceMotionEvent(){this._didRequestDeviceMotionEvent||(this._didRequestDeviceMotionEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-motion"))}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(c){this._randomNumberCallback=c}_GetRemotePreviewStatusInfo(){return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:this.GetWebGLRenderer().GetUnmaskedRenderer()}}HitBreakpoint(){return this.IsDebug()?
b.HitBreakpoint():!1}DebugBreak(c){return this.IsDebugging()?b.DebugBreak(c):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?b.BreakNext():!1}SetDebugBreakpointsEnabled(c){this._breakpointsEnabled=!!c;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(c){c?this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&
this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&b.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetWebGLRenderer().SupportsGPUProfiling()&&b.IsGPUProfiling()}async DebugIterateAndBreak(c){if(c)for(const e of c)await this.DebugBreak(e)}DebugFireGeneratorEventAndBreak(c){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(c))}_InvokeFunctionFromJS(c){return this._eventSheetManager._InvokeFunctionFromJS(c.name,c.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(c){c=
f.New(f.Event,c,!1);c.runtime=this._iRuntime;return c}_InitScriptInterfaces(){var c={};for(const e of this._allObjectClasses)c[e.GetJsPropName()]={value:e.GetIObjectClass(),enumerable:!0,writable:!1};c=Object.create(Object.prototype,c);this._iRuntime=new self.IRuntime(this,c);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const c={};for(const e of this.GetEventSheetManager().GetAllGlobalVariables())c[e.GetJsPropName()]=e._GetScriptInterfaceDescriptor();
this._iRuntime._InitGlobalVars(c)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(c,e){this._interfaceMap.set(c,e)}_UnwrapScriptInterface(c){return this._interfaceMap.get(c)}};self.C3_CreateRuntime=f.Runtime.Create;self.C3_InitRuntime=(c,e)=>c.Init(e)}"use strict";
{const f=self.C3;f.JobSchedulerRuntime=class extends f.DefendedBase{constructor(b,a){super();this._runtime=b;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=a.inputPort;a.outputPort.onmessage=d=>this._OnJobWorkerMessage(d);this._maxNumWorkers=a.maxNumWorkers;this._jobWorkerCount=1;this._hadErrorCreatingWorker=this._isCreatingWorker=!1}async Init(){}ImportScriptsToJobWorkers(b){this._inputPort.postMessage({type:"_import_scripts",scripts:b})}SendBlobToJobWorkers(b,a){this._inputPort.postMessage({type:"_send_blob",
blob:b,id:a})}SendBufferToJobWorkers(b,a){this._inputPort.postMessage({type:"_send_buffer",buffer:b,id:a},[b])}AddJob(b,a,d,c,e){d||(d=[]);const g=this._nextJobId++;b={type:b,isBroadcast:!1,jobId:g,params:a,transferables:d};a=new Promise((k,m)=>{this._jobPromises.set(g,{resolve:k,progress:c,reject:m,cancelled:!1})});e&&e.SetAction(()=>this._CancelJob(g));this._inputPort.postMessage(b,d);this._MaybeCreateExtraWorker();return a}BroadcastJob(b,a,d){d||(d=[]);const c=this._nextJobId++;this._inputPort.postMessage({type:b,
isBroadcast:!0,jobId:c,params:a,transferables:d},d)}_CancelJob(b){const a=this._jobPromises.get(b);a&&(a.cancelled=!0,a.resolve=null,a.progress=null,a.reject=null,this._inputPort.postMessage({type:"_cancel",jobId:b}))}_OnJobWorkerMessage(b){b=b.data;const a=b.type,d=b.jobId;switch(a){case "result":this._OnJobResult(d,b.result);break;case "progress":this._OnJobProgress(d,b.progress);break;case "error":this._OnJobError(d,b.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${a}'`);
}}_OnJobResult(b,a){const d=this._jobPromises.get(b);if(!d)throw Error("invalid job ID");d.cancelled||d.resolve(a);this._jobPromises.delete(b)}_OnJobProgress(b,a){b=this._jobPromises.get(b);if(!b)throw Error("invalid job ID");!b.cancelled&&b.progress&&b.progress(a)}_OnJobError(b,a){const d=this._jobPromises.get(b);if(!d)throw Error("invalid job ID");d.cancelled||d.reject(a);this._jobPromises.delete(b)}_OnJobWorkerReady(){this._isCreatingWorker&&(this._isCreatingWorker=!1,this._jobWorkerCount++,this._jobWorkerCount<
this._maxNumWorkers?this._MaybeCreateExtraWorker():this._inputPort.postMessage({type:"_no_more_workers"}))}async _MaybeCreateExtraWorker(){if(!(this._jobWorkerCount>=this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._jobPromises.size<=this._jobWorkerCount))try{this._isCreatingWorker=!0,(await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker")).outputPort.onmessage=b=>this._OnJobWorkerMessage(b)}catch(b){this._hadErrorCreatingWorker=!0,this._isCreatingWorker=
!1,console.error(`[Construct 3] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,b)}}}}self.C3_Shaders={};"use strict";
{const f=self.C3;let b=null,a="",d="",c=[],e="",g="",k="";const m=f.New(f.ArrayStack);function p(n,u){n=n[1];u=u[1];if("number"===typeof n&&"number"===typeof u)return n-u;n=""+n;u=""+u;return n<u?-1:n>u?1:0}f.Plugins.System=class extends f.SDKPluginBase{constructor(n){super(n);this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingComplete=this._imagesLoadingTotal=0;this._functionMaps=new Map}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(n){this._runtime.Trigger(n,
null,null)}GetRegex(n,u){b&&n===a&&u===d||(b=new RegExp(n,u),a=n,d=u);b.lastIndex=0;return b}GetRegexMatches(n,u,q){if(n===e&&u===g&&q===k)return c;const r=this.GetRegex(u,q);c=n.match(r);e=n;g=u;k=q;return c}async _LoadTexturesForObjectClasses(n,u){if(u.length){this._imagesLoadingTotal+=u.length;var q=[];for(const r of u)q.push(n.MaybeLoadTexturesFor(r));await f.PromiseAllWithProgress(q,()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&
(this._runtime.Trigger(f.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(n,u){for(const q of u)0===q.GetInstanceCount()&&n.MaybeUnloadTexturesFor(q)}_GetForEachStack(){return m}_Repeat(n){var u=this._runtime.GetEventSheetManager();const q=u.GetEventStack(),r=q.GetCurrentStackFrame(),t=r.GetCurrentEvent(),x=t.GetSolModifiers();var z=r.IsSolModifierAfterCnds();const D=q.Push(t),G=u.GetLoopStack(),w=G.Push();
w.SetEnd(n);if(z)for(z=0;z<n&&!w.IsStopped();++z)u.PushCopySol(x),w.SetIndex(z),t.Retrigger(r,D),u.PopSol(x);else for(u=0;u<n&&!w.IsStopped();++u)w.SetIndex(u),t.Retrigger(r,D);q.Pop();G.Pop();return!1}*_DebugRepeat(n){var u=this._runtime.GetEventSheetManager();const q=u.GetEventStack(),r=q.GetCurrentStackFrame(),t=r.GetCurrentEvent(),x=t.GetSolModifiers();var z=r.IsSolModifierAfterCnds();const D=q.Push(t),G=u.GetLoopStack(),w=G.Push();w.SetEnd(n);if(z)for(z=0;z<n&&!w.IsStopped();++z)u.PushCopySol(x),
w.SetIndex(z),yield*t.DebugRetrigger(r,D),u.PopSol(x);else for(u=0;u<n&&!w.IsStopped();++u)w.SetIndex(u),yield*t.DebugRetrigger(r,D);q.Pop();G.Pop();return!1}_While(){var n=this._runtime.GetEventSheetManager();const u=n.GetEventStack(),q=u.GetCurrentStackFrame(),r=q.GetCurrentEvent(),t=r.GetSolModifiers();var x=q.IsSolModifierAfterCnds();const z=u.Push(r),D=n.GetLoopStack(),G=D.Push();if(x)for(x=0;!G.IsStopped();++x)n.PushCopySol(t),G.SetIndex(x),r.Retrigger(q,z)||G.Stop(),n.PopSol(t);else for(n=
0;!G.IsStopped();++n)G.SetIndex(n),r.Retrigger(q,z)||G.Stop();u.Pop();D.Pop();return!1}*_DebugWhile(){var n=this._runtime.GetEventSheetManager();const u=n.GetEventStack(),q=u.GetCurrentStackFrame(),r=q.GetCurrentEvent(),t=r.GetSolModifiers();var x=q.IsSolModifierAfterCnds();const z=u.Push(r),D=n.GetLoopStack(),G=D.Push();if(x)for(x=0;!G.IsStopped();++x)n.PushCopySol(t),G.SetIndex(x),(yield*r.DebugRetrigger(q,z))||G.Stop(),n.PopSol(t);else for(n=0;!G.IsStopped();++n)G.SetIndex(n),(yield*r.DebugRetrigger(q,
z))||G.Stop();u.Pop();D.Pop();return!1}_For(n,u,q){var r=this._runtime.GetEventSheetManager();const t=r.GetEventStack(),x=t.GetCurrentStackFrame(),z=x.GetCurrentEvent(),D=z.GetSolModifiers(),G=x.IsSolModifierAfterCnds(),w=t.Push(z),B=r.GetLoopStack(),I=B.Push();I.SetName(n);I.SetEnd(q);if(q<u)if(G)for(n=u;n>=q&&!I.IsStopped();--n)r.PushCopySol(D),I.SetIndex(n),z.Retrigger(x,w),r.PopSol(D);else for(r=u;r>=q&&!I.IsStopped();--r)I.SetIndex(r),z.Retrigger(x,w);else if(G)for(n=u;n<=q&&!I.IsStopped();++n)r.PushCopySol(D),
I.SetIndex(n),z.Retrigger(x,w),r.PopSol(D);else for(r=u;r<=q&&!I.IsStopped();++r)I.SetIndex(r),z.Retrigger(x,w);t.Pop();B.Pop();return!1}*_DebugFor(n,u,q){var r=this._runtime.GetEventSheetManager();const t=r.GetEventStack(),x=t.GetCurrentStackFrame(),z=x.GetCurrentEvent(),D=z.GetSolModifiers(),G=x.IsSolModifierAfterCnds(),w=t.Push(z),B=r.GetLoopStack(),I=B.Push();I.SetName(n);I.SetEnd(q);if(q<u)if(G)for(n=u;n>=q&&!I.IsStopped();--n)r.PushCopySol(D),I.SetIndex(n),yield*z.DebugRetrigger(x,w),r.PopSol(D);
else for(r=u;r>=q&&!I.IsStopped();--r)I.SetIndex(r),yield*z.DebugRetrigger(x,w);else if(G)for(n=u;n<=q&&!I.IsStopped();++n)r.PushCopySol(D),I.SetIndex(n),yield*z.DebugRetrigger(x,w),r.PopSol(D);else for(r=u;r<=q&&!I.IsStopped();++r)I.SetIndex(r),yield*z.DebugRetrigger(x,w);t.Pop();B.Pop();return!1}_ForEach(n){var u=this._runtime.GetEventSheetManager();const q=u.GetEventStack(),r=q.GetCurrentStackFrame(),t=r.GetCurrentEvent(),x=t.GetSolModifiers();var z=r.IsSolModifierAfterCnds();const D=q.Push(t),
G=u.GetLoopStack(),w=G.Push(),B=n.IsInContainer(),I=n.GetCurrentSol(),P=m.Push();f.shallowAssignArray(P,I.GetInstances());w.SetEnd(P.length);if(z)for(let E=0,J=P.length;E<J&&!w.IsStopped();++E)u.PushCopySol(x),z=P[E],n.GetCurrentSol().SetSinglePicked(z),B&&z.SetSiblingsSinglePicked(),w.SetIndex(E),t.Retrigger(r,D),u.PopSol(x);else{I._SetSelectAll(!1);n=I._GetOwnInstances();f.clearArray(n);n.push(null);for(let E=0,J=P.length;E<J&&!w.IsStopped();++E)u=P[E],n[0]=u,B&&u.SetSiblingsSinglePicked(),w.SetIndex(E),
t.Retrigger(r,D)}q.Pop();G.Pop();f.clearArray(P);m.Pop();return!1}*_DebugForEach(n){var u=this._runtime.GetEventSheetManager();const q=u.GetEventStack(),r=q.GetCurrentStackFrame(),t=r.GetCurrentEvent(),x=t.GetSolModifiers();var z=r.IsSolModifierAfterCnds();const D=q.Push(t),G=u.GetLoopStack(),w=G.Push(),B=n.IsInContainer(),I=n.GetCurrentSol(),P=m.Push();f.shallowAssignArray(P,I.GetInstances());w.SetEnd(P.length);if(z)for(let E=0,J=P.length;E<J&&!w.IsStopped();++E)u.PushCopySol(x),z=P[E],n.GetCurrentSol().SetSinglePicked(z),
B&&z.SetSiblingsSinglePicked(),w.SetIndex(E),yield*t.DebugRetrigger(r,D),u.PopSol(x);else{I._SetSelectAll(!1);n=I._GetOwnInstances();f.clearArray(n);n.push(null);for(let E=0,J=P.length;E<J&&!w.IsStopped();++E)u=P[E],n[0]=u,B&&u.SetSiblingsSinglePicked(),w.SetIndex(E),yield*t.DebugRetrigger(r,D)}q.Pop();G.Pop();f.clearArray(P);m.Pop();return!1}_ForEachOrdered(n,u){var q=this._runtime.GetEventSheetManager();const r=q.GetEventStack(),t=q.GetCurrentCondition(),x=r.GetCurrentStackFrame(),z=x.GetCurrentEvent(),
D=z.GetSolModifiers(),G=x.IsSolModifierAfterCnds(),w=r.Push(z),B=q.GetLoopStack(),I=B.Push(),P=n.IsInContainer(),E=n.GetCurrentSol(),J=m.Push();f.clearArray(J);const O=E.GetInstances();I.SetEnd(O.length);for(let R=0,T=O.length;R<T;++R)J.push([O[R],t.ReevaluateParameter(1,R)]);J.sort(p);1===u&&J.reverse();if(G)for(let R=0,T=J.length;R<T&&!I.IsStopped();++R)q.PushCopySol(D),u=J[R][0],n.GetCurrentSol().SetSinglePicked(u),P&&u.SetSiblingsSinglePicked(),I.SetIndex(R),z.Retrigger(x,w),q.PopSol(D);else{E._SetSelectAll(!1);
n=E._GetOwnInstances();f.clearArray(n);n.push(null);for(let R=0,T=J.length;R<T&&!I.IsStopped();++R)q=J[R][0],n[0]=q,P&&q.SetSiblingsSinglePicked(),I.SetIndex(R),z.Retrigger(x,w)}r.Pop();B.Pop();f.clearArray(J);m.Pop();return!1}*_DebugForEachOrdered(n,u){var q=this._runtime.GetEventSheetManager();const r=q.GetEventStack(),t=q.GetCurrentCondition(),x=r.GetCurrentStackFrame(),z=x.GetCurrentEvent(),D=z.GetSolModifiers(),G=x.IsSolModifierAfterCnds(),w=r.Push(z),B=q.GetLoopStack(),I=B.Push(),P=n.IsInContainer(),
E=n.GetCurrentSol(),J=m.Push();f.clearArray(J);const O=E.GetInstances();I.SetEnd(O.length);for(let R=0,T=O.length;R<T;++R)J.push([O[R],t.ReevaluateParameter(1,R)]);J.sort(p);1===u&&J.reverse();if(G)for(let R=0,T=J.length;R<T&&!I.IsStopped();++R)q.PushCopySol(D),u=J[R][0],n.GetCurrentSol().SetSinglePicked(u),P&&u.SetSiblingsSinglePicked(),I.SetIndex(R),yield*z.DebugRetrigger(x,w),q.PopSol(D);else{E._SetSelectAll(!1);n=E._GetOwnInstances();f.clearArray(n);n.push(null);for(let R=0,T=J.length;R<T&&!I.IsStopped();++R)q=
J[R][0],n[0]=q,P&&q.SetSiblingsSinglePicked(),I.SetIndex(R),yield*z.DebugRetrigger(x,w)}r.Pop();B.Pop();f.clearArray(J);m.Pop();return!1}_GetFunctionMap(n,u){let q=this._functionMaps.get(n);if(q)return q;if(!u)return null;q={defaultFunc:null,strMap:new Map};this._functionMaps.set(n,q);return q}_DoCallMappedFunction(n,u,q,r,t){u.GetEventBlock().RunAsMappedFunctionCall(q);r&&n.PopSol(t)}*_DebugDoCallMappedFunction(n,u,q,r,t){yield*u.GetEventBlock().DebugRunAsMappedFunctionCall(q);r&&n.PopSol(t)}}}"use strict";
{const f=self.C3;f.Plugins.System.Type=class extends f.DefendedBase{constructor(b){super();this._objectClass=b;this._runtime=b.GetRuntime();this._plugin=b.GetPlugin()}OnCreate(){}Release(){this._plugin=this._runtime=this._objectClass=null}}}"use strict";
{const f=self.C3;f.Plugins.System.Instance=class extends f.DefendedBase{constructor(b,a){super();this._inst=b;this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._runtime=this._inst.GetRuntime()}Release(){this._runtime=this._sdkType=this._objectClass=this._inst=null}}}"use strict";
{const f=self.C3,b=[];f.Plugins.System.Cnds={EveryTick(){return!0},OnLayoutStart(){return!0},OnLayoutEnd(){return!0},OnSuspend(){return!0},OnResume(){return!0},IsSuspended(){return this._runtime.IsSuspended()},Else(){const a=this._runtime.GetCurrentEventStackFrame();return a.GetElseBranchRan()?!1:!a.GetLastEventTrue()},TriggerOnce(){const a=this._runtime.GetCurrentCondition().GetSavedDataMap();let d=a.get("TriggerOnce_lastTick");"undefined"===typeof d&&(d=-1,a.set("TriggerOnce_lastTick",-1));const c=
this._runtime.GetTickCount();a.set("TriggerOnce_lastTick",c);return this._runtime.IsLayoutFirstTick()||d!==c-1},Every(a){const d=this._runtime.GetCurrentCondition().GetSavedDataMap(),c=d.get("Every_lastTime")||0,e=this._runtime.GetGameTime();d.has("Every_seconds")||d.set("Every_seconds",a);const g=d.get("Every_seconds");if(e>=c+g)return d.set("Every_lastTime",c+g),e>=d.get("Every_lastTime")+.04&&d.set("Every_lastTime",e),d.set("Every_seconds",a),!0;e<c-.1&&d.set("Every_lastTime",e);return!1},IsGroupActive(a){return(a=
this._runtime.GetEventSheetManager().GetEventGroupByName(a))&&a.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return f.Platform.IsMobile},OnLoadFinished(){return!0},OnCanvasSnapshot(){return!0},EffectsSupported(){return!0},OnSaveComplete(){return!0},OnSaveFailed(){return!0},OnLoadComplete(){return!0},OnLoadFailed(){return!0},ObjectUIDExists(a){return!!this._runtime.GetInstanceByUID(a)},IsOnPlatform(a){switch(a){case 0:return"browser"===f.Platform.Context;case 1:return"iOS"===
f.Platform.OS;case 2:return"Android"===f.Platform.OS;case 8:return"cordova"===f.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===f.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(a,d,c){return this.GetRegex(d,c).test(a)},Compare(a,d,c){return f.compare(a,d,c)},CompareBetween(a,d,c){return a>=d&&a<=c},CompareVar(a,d,c){return f.compare(a.GetValue(),d,c)},CompareBoolVar(a){return!!a.GetValue()},
CompareTime(a,d){const c=this._runtime.GetGameTime();return 0===a?(a=this._runtime.GetCurrentCondition().GetSavedDataMap(),!a.get("CompareTime_executed")&&c>=d?(a.set("CompareTime_executed",!0),!0):!1):f.compare(c,a,d)},IsNaN(a){return isNaN(a)},AngleWithin(a,d,c){return f.angleDiff(f.toRadians(a),f.toRadians(c))<=f.toRadians(d)},IsClockwiseFrom(a,d){return f.angleClockwise(f.toRadians(a),f.toRadians(d))},IsBetweenAngles(a,d,c){a=f.toRadians(a);d=f.toRadians(d);c=f.toRadians(c);return f.angleClockwise(c,
d)?f.angleClockwise(a,d)&&!f.angleClockwise(a,c):!(!f.angleClockwise(a,d)&&f.angleClockwise(a,c))},IsValueType(a,d){return"number"===typeof a?0===d:1===d},EvaluateExpression(a){return!!a},PickByComparison(a,d,c,e){if(!a)return!1;const g=this._GetForEachStack(),k=g.Push(),m=a.GetCurrentSol();f.shallowAssignArray(k,m.GetInstances());m.IsSelectAll()&&f.clearArray(m._GetOwnElseInstances());const p=this._runtime.GetCurrentCondition();let n=0;for(let u=0,q=k.length;u<q;++u){const r=k[u];k[n]=r;d=p.ReevaluateParameter(1,
u);e=p.ReevaluateParameter(3,u);f.compare(d,c,e)?++n:m._PushElseInstance(r)}f.truncateArray(k,n);m.SetArrayPicked(k);d=!!k.length;f.clearArray(k);g.Pop();a.ApplySolToContainer();return d},PickByEvaluate(a,d){if(!a)return!1;const c=this._GetForEachStack(),e=c.Push(),g=a.GetCurrentSol();f.shallowAssignArray(e,g.GetInstances());g.IsSelectAll()&&f.clearArray(g._GetOwnElseInstances());const k=this._runtime.GetCurrentCondition();let m=0;for(let p=0,n=e.length;p<n;++p){const u=e[p];e[m]=u;(d=k.ReevaluateParameter(1,
p))?++m:g._PushElseInstance(u)}f.truncateArray(e,m);g.SetArrayPicked(e);d=!!e.length;f.clearArray(e);c.Pop();a.ApplySolToContainer();return d},PickNth(a,d){if(!a)return!1;const c=a.GetCurrentSol(),e=c.GetInstances();d=Math.floor(d);if(d>=e.length)return!1;c.PickOne(e[d]);a.ApplySolToContainer();return!0},PickRandom(a){if(!a)return!1;const d=a.GetCurrentSol(),c=d.GetInstances(),e=Math.floor(this._runtime.Random()*c.length);if(e>=c.length)return!1;d.PickOne(c[e]);a.ApplySolToContainer();return!0},PickAll(a){if(!a||
!a.GetInstanceCount())return!1;a.GetCurrentSol()._SetSelectAll(!0);a.ApplySolToContainer();return!0},PickOverlappingPoint(a,d,c){if(!a)return!1;const e=a.GetCurrentSol();var g=e.GetInstances();const k=this._runtime.GetCurrentEvent().IsOrBlock(),m=this._runtime.GetCurrentCondition().IsInverted();e.IsSelectAll()?(f.shallowAssignArray(b,g),e.ClearArrays(),e._SetSelectAll(!1)):k?(f.shallowAssignArray(b,e._GetOwnElseInstances()),f.clearArray(e._GetOwnElseInstances())):(f.shallowAssignArray(b,e._GetOwnInstances()),
f.clearArray(e._GetOwnInstances()));for(let p=0,n=b.length;p<n;++p)g=b[p],f.xor(g.GetWorldInfo().ContainsPoint(d,c),m)?e._PushInstance(g):e._PushElseInstance(g);a.ApplySolToContainer();return f.xor(!!e._GetOwnInstances().length,m)},PickLastCreated(a){if(!a)return!1;var d=a.IsFamily();let c=null;const e=this._runtime._GetInstancesPendingCreate();for(let g=e.length-1;0<=g;--g){const k=e[g];if(d){if(k.GetObjectClass().BelongsToFamily(a)){c=k;break}}else if(k.GetObjectClass()===a){c=k;break}}c||(d=a.GetInstances(),
d.length&&(c=d[d.length-1]));if(!c)return!1;a.GetCurrentSol().PickOne(c);a.ApplySolToContainer();return!0},Repeat(a){return this._runtime.IsDebugging()?this._DebugRepeat(a):this._Repeat(a)},While(){return this._runtime.IsDebugging()?this._DebugWhile():this._While()},For(a,d,c){return this._runtime.IsDebugging()?this._DebugFor(a,d,c):this._For(a,d,c)},ForEach(a){return this._runtime.IsDebugging()?this._DebugForEach(a):this._ForEach(a)},ForEachOrdered(a,d,c){return this._runtime.IsDebugging()?this._DebugForEachOrdered(a,
c):this._ForEachOrdered(a,c)},LayerVisible(a){return a?a.IsVisible():!1},LayerEmpty(a){return a?!a.GetInstanceCount():!1},LayerCmpOpacity(a,d,c){return a?f.compare(100*a.GetOpacity(),d,c):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}}"use strict";
{const f=self.C3;function b(k,m){const p=k[0]-m[0];return 0!==p?p:k[1]-m[1]}function a(k,m){return k[1]-m[1]}const d=[],c=[],e=f.New(f.Rect),g=f.New(f.Color);f.Plugins.System.Acts={SetVar(k,m){k.SetValue(m)},AddVar(k,m){k.IsNumber()&&"number"!==typeof m&&(m=parseFloat(m));k.SetValue(k.GetValue()+m)},SubVar(k,m){k.IsNumber()&&k.SetValue(k.GetValue()-m)},SetBoolVar(k,m){k.SetValue(!!m)},ToggleBoolVar(k){k.SetValue(!k.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},
CreateObject(k,m,p,n){if(k&&m&&(m=this._runtime.CreateInstance(k,m,p,n))){p=this._runtime.GetEventSheetManager();p.BlockFlushingInstances(!0);m._TriggerOnCreated();if(m.IsInContainer())for(const u of m.siblings())u._TriggerOnCreated();p.BlockFlushingInstances(!1);k.GetCurrentSol().SetSinglePicked(m);m.IsInContainer()&&m.SetSiblingsSinglePicked()}},CreateObjectByName(k,m,p,n){k&&m&&(k=this._runtime.GetObjectClassByName(k))&&f.Plugins.System.Acts.CreateObject.call(this,k,m,p,n)},RecreateInitialObjects(k,
m,p,n,u,q,r,t,x){if(k){var z=this._runtime.GetCurrentLayout();if(q&&(z=this._runtime.GetLayoutManager().GetLayoutByName(q),!z))return;q=null;if("number"!==typeof r||0<=r)if(q=z.GetLayer(r),!q)return;e.set(m,p,n,u);m=z.RecreateInitialObjects(k,e,q,t,x);k.GetCurrentSol().SetArrayPicked(m);k.ApplySolToContainer()}},StopLoop(){const k=this._loopStack;k.IsInLoop()&&k.GetCurrent().Stop()},SetGroupActive(k,m){(k=this._runtime.GetEventSheetManager().GetEventGroupByName(k))&&(0===m?k.SetGroupActive(!1):1===
m?k.SetGroupActive(!0):k.SetGroupActive(!k.IsGroupActive()))},SetTimescale(k){this._runtime.SetTimeScale(k)},SetObjectTimescale(k,m){0>m&&(m=0);if(k){k=k.GetCurrentSol().GetInstances();for(const p of k)p.SetTimeScale(m)}},RestoreObjectTimescale(k){if(k){k=k.GetCurrentSol().GetInstances();for(const m of k)m.RestoreTimeScale()}},Wait(k){if(!(0>k))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(k),!0},WaitForSignal(k){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(k);
return!0},WaitForPreviousActions(){const k=this._runtime.GetEventSheetManager();k.AddScheduledWait().InitPromise(k.GetPromiseForAllAsyncActions());return!0},Signal(k){k=k.toLowerCase();for(const m of this._runtime.GetEventSheetManager().scheduledWaits())m.IsSignal()&&m.GetSignalTag()===k&&m.SetSignalled()},async SnapshotCanvas(k,m,p,n,u,q){const r=this._runtime.GetCanvasManager();r&&(this.UpdateRender(),await r.SnapshotCanvas(0===k?"image/png":"image/jpeg",m/100,p,n,u,q),await this._runtime.TriggerAsync(f.Plugins.System.Cnds.OnCanvasSnapshot,
null))},SetCanvasSize(k,m){if(!(0>=k||0>=m)){this._runtime.SetViewportSize(k,m);var p=this._runtime.GetCurrentLayout();p.BoundScrolling();for(const n of p.GetLayers())n.UpdateViewport();if(p=this._runtime.GetCanvasManager())"off"!==p.GetCurrentFullscreenMode()&&this._runtime.SetOriginalViewportSize(k,m),p.SetSize(p.GetLastWidth(),p.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(k){const m=this._runtime.GetCanvasManager();m&&"off"!==m.GetCurrentFullscreenMode()&&(m.SetFullscreenScalingQuality(0!==
k?"high":"low"),m.SetSize(m.GetLastWidth(),m.GetLastHeight(),!0))},SaveState(k){this._runtime.SaveToSlot(k)},LoadState(k){this._runtime.LoadFromSlot(k)},LoadStateJSON(k){this._runtime.LoadFromJsonString(k)},SetHalfFramerateMode(k){},ResetPersisted(){for(const k of this._runtime.GetLayoutManager().GetAllLayouts())k.ResetPersistData()},SetPixelRounding(k){this._runtime.SetPixelRoundingEnabled(0!==k)},SetMinimumFramerate(k){this._runtime.SetMinimumFramerate(k)},SortZOrderByInstVar(k,m){if(k){var p=k.GetCurrentSol().GetInstances(),
n=this._runtime.GetCurrentLayout(),u=k.IsFamily();k=k.GetFamilyIndex();for(let r=0,t=p.length;r<t;++r){var q=p[r];const x=q.GetWorldInfo();if(!x)continue;let z;z=u?q.GetInstanceVariableValue(m+q.GetObjectClass().GetFamilyInstanceVariableOffset(k)):q.GetInstanceVariableValue(m);d.push([x.GetLayer().GetIndex(),x.GetZIndex()]);c.push([q,z])}if(d.length){d.sort(b);c.sort(a);m=!1;for(let r=0,t=d.length;r<t;++r)p=c[r][0],u=n.GetLayerByIndex(d[r][0]),k=d[r][1],q=u._GetInstances(),q[k]!==p&&(q[k]=p,p.GetWorldInfo()._SetLayer(u),
u.SetZIndicesChanged(),m=!0);m&&this._runtime.UpdateRender();f.clearArray(d);f.clearArray(c)}}},GoToLayout(k){if(!this._runtime.IsLoading()){var m=this._runtime.GetLayoutManager();m.IsPendingChangeMainLayout()||m.ChangeMainLayout(k)}},GoToLayoutByName(k){if(!this._runtime.IsLoading()){var m=this._runtime.GetLayoutManager();m.IsPendingChangeMainLayout()||(k=m.GetLayoutByName(k))&&m.ChangeMainLayout(k)}},NextPrevLayout(k){if(!this._runtime.IsLoading()){var m=this._runtime.GetLayoutManager();if(!m.IsPendingChangeMainLayout()){var p=
m.GetAllLayouts(),n=p.indexOf(m.GetMainRunningLayout());k&&0===n||(k||n!==p.length-1)&&m.ChangeMainLayout(p[n+(k?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var k=this._runtime.GetLayoutManager();k.IsPendingChangeMainLayout()||(k.ChangeMainLayout(k.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(k,m){k&&k.SetVisible(m)},SetLayerOpacity(k,m){k&&k.SetOpacity(m/100)},SetLayerScale(k,m){k&&k.SetOwnScale(m)},SetLayerScaleRate(k,
m){k&&k.SetScaleRate(m)},SetLayerAngle(k,m){k&&(m=f.clampAngle(f.toRadians(+m)),k.GetOwnAngle()!==m&&(k.SetAngle(m),this.UpdateRender()))},SetLayerParallax(k,m,p){k&&k.SetParallax(m/100,p/100)},SetLayerZElevation(k,m){k&&k.SetZElevation(m)},SetLayerBackground(k,m){k&&(g.setFromRgbValue(m),g.clamp(),k=k.GetBackgroundColor(),k.equalsIgnoringAlpha(g)||(k.copyRgb(g),this.UpdateRender()))},SetLayerTransparent(k,m){k&&(m=!!m,k.IsTransparent()!==m&&(k.SetTransparent(m),this.UpdateRender()))},SetLayerBlendMode(k,
m){k&&k.GetBlendMode()!==m&&(k.SetBlendMode(m),this.UpdateRender())},SetLayerEffectEnabled(k,m,p){k&&(k=k.GetEffectList(),p=k.GetEffectTypeByName(p))&&(m=1===m,p.IsActive()!==m&&(p.SetActive(m),k.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(k,m,p,n){if(k&&(k=k.GetEffectList(),m=k.GetEffectTypeByName(m))){var u=m.GetIndex();k=k.GetEffectParametersForIndex(u);p=Math.floor(p);if(!(0>p||p>=k.length)){u=m.GetShaderProgram().GetParameterType(p);if("color"===u){g.setFromRgbValue(n);
p=k[p];if(g.equalsIgnoringAlpha(p))return;p.copyRgb(g)}else{"percent"===u&&(n/=100);if(k[p]===n)return;k[p]=n}m.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(k,m){k&&(m=!!m,k.IsForceOwnTexture()!==m&&(k.SetForceOwnTexture(m),this.UpdateRender()))},SetLayoutScale(k){const m=this._runtime.GetCurrentLayout();m.GetScale()!==k&&(m.SetScale(k),this.UpdateRender())},SetLayoutAngle(k){k=f.clampAngle(f.toRadians(+k));const m=this._runtime.GetCurrentLayout();m.GetAngle()!==k&&(m.SetAngle(k),
this.UpdateRender())},SetLayoutEffectEnabled(k,m){const p=this._runtime.GetCurrentLayout().GetEffectList();if(m=p.GetEffectTypeByName(m))k=1===k,m.IsActive()!==k&&(m.SetActive(k),p.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(k,m,p){var n=this._runtime.GetCurrentLayout().GetEffectList();if(k=n.GetEffectTypeByName(k)){var u=k.GetIndex();n=n.GetEffectParametersForIndex(u);m=Math.floor(m);if(!(0>m||m>=n.length)){u=k.GetShaderProgram().GetParameterType(m);if("color"===u){g.setFromRgbValue(p);
m=n[m];if(g.equalsIgnoringAlpha(m))return;m.copyRgb(g)}else{"percent"===u&&(p/=100);if(n[m]===p)return;n[m]=p}k.IsActive()&&this._runtime.UpdateRender()}}},ScrollX(k){this._runtime.GetCurrentLayout().SetScrollX(k)},ScrollY(k){this._runtime.GetCurrentLayout().SetScrollY(k)},Scroll(k,m){const p=this._runtime.GetCurrentLayout();p.SetScrollX(k);p.SetScrollY(m)},ScrollToObject(k){if(k&&(k=k.GetFirstPicked())&&(k=k.GetWorldInfo())){var m=this._runtime.GetCurrentLayout();m.SetScrollX(k.GetX());m.SetScrollY(k.GetY())}},
async LoadObjectTextures(k){const m=this._runtime.GetMainRunningLayout();m&&k&&!this._runtime.IsLoading()&&(k=k.IsFamily()?k.GetFamilyMembers():[k],await this._LoadTexturesForObjectClasses(m,k))},async LoadObjectTexturesByName(k){await f.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(k))},UnloadObjectTextures(k){const m=this._runtime.GetMainRunningLayout();m&&k&&(k=k.IsFamily()?k.GetFamilyMembers():[k],this._UnloadTexturesForObjectClasses(m,k))},UnloadObjectTexturesByName(k){f.Plugins.System.Acts.UnloadObjectTexturesByName.call(this,
this._runtime.GetObjectClassByName(k))},UnloadUnusedTextures(){const k=this._runtime.GetMainRunningLayout();if(k){var m=k._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(k,m)}},async LoadLayoutTextures(k){const m=this._runtime.GetMainRunningLayout();k&&m&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(m,k._GetInitialObjectClasses())},async LoadLayoutTexturesByName(k){const m=this._runtime.GetMainRunningLayout();(k=this._runtime.GetLayoutManager().GetLayoutByName(k))&&
m&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(m,k._GetInitialObjectClasses())},SetFunctionReturnValue(k){const m=this._eventStack.GetCurrentExpFuncStackFrame();if(m)switch(m.GetFunctionReturnType()){case 1:"number"===typeof k&&m.SetFunctionReturnValue(k);break;case 2:"string"===typeof k&&m.SetFunctionReturnValue(k);break;case 3:m.SetFunctionReturnValue(k)}},MapFunction(k,m,p){var n=this._GetFunctionMap(k.toLowerCase(),!0);const u=n.strMap,q=m.toLowerCase();u.has(q)&&console.warn(`[Construct 3] Function map '${k}' string '${m}' already in map; overwriting entry`);
if(n=f.first(u.values())||n.defaultFunc){n=0!==n.GetReturnType();const r=0!==p.GetReturnType();if(n!==r){console.error(`[Construct 3] Function map '${k}' string '${m}' function return type not compatible with other functions in the map; entry ignored`);return}}u.set(q,p)},MapFunctionDefault(k,m){const p=this._GetFunctionMap(k.toLowerCase(),!0);p.defaultFunc&&console.warn(`[Construct 3] Function map '${k}' already has a default; overwriting entry`);var n=f.first(p.strMap.values())||p.defaultFunc;if(n){n=
0!==n.GetReturnType();const u=0!==m.GetReturnType();if(n!==u){console.error(`[Construct 3] Function map '${k}' default: function return type not compatible with other functions in the map; entry ignored`);return}}p.defaultFunc=m},CallMappedFunction(k,m,p){p=Math.floor(p);var n=this._GetFunctionMap(k.toLowerCase(),!1);if(n){var u=n.strMap.get(m.toLowerCase());if(!u)if(n.defaultFunc)u=n.defaultFunc,p=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${k}' string '${m}'; call ignored (consider setting a default)`);
return}if(u.IsEnabled())if(0!==u.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${k}' string '${m}' has a return type so cannot be called`);else{k=this._runtime;m=k.GetEventSheetManager();var q=m.GetCurrentEvent();n=q.GetSolModifiersIncludingParents();var r=0<n.length;r&&m.PushCleanSol(n);var t=[];if(q=m.FindFirstFunctionBlockParent(q)){q=q.GetFunctionParameters();for(let x=p,z=q.length;x<z;++x)t.push(q[x].GetValue())}p=u.GetFunctionParameters();for(let x=t.length,z=p.length;x<
z;++x)t.push(p[x].GetInitialValue());return k.IsDebugging()?this._DebugDoCallMappedFunction(m,u,t,r,n):this._DoCallMappedFunction(m,u,t,r,n)}}else console.warn(`[Construct 3] Call mapped function: map name '${k}' not found; call ignored`)}}}"use strict";
{const f=self.C3;f.Plugins.System.Exps={int:function(b){"string"===typeof b&&(b=parseInt(b,10),isNaN(b)&&(b=0));return Math.floor(b)},float:function(b){"string"===typeof b&&(b=parseFloat(b),isNaN(b)&&(b=0));return b},str(b){return b.toString()},len(b){return"string"===typeof b?b.length:0},random(b,a){return"undefined"===typeof a?this._runtime.Random()*b:this._runtime.Random()*(a-b)+b},choose(...b){const a=Math.floor(this._runtime.Random()*b.length);return b[a]},pi(){return Math.PI},infinity(){return Infinity},
sqrt(b){return Math.sqrt(b)},abs(b){return Math.abs(b)},round(b){return Math.round(b)},floor(b){return Math.floor(b)},ceil(b){return Math.ceil(b)},sign(b){return Math.sign(b)},sin(b){return Math.sin(f.toRadians(b))},cos(b){return Math.cos(f.toRadians(b))},tan(b){return Math.tan(f.toRadians(b))},asin(b){return f.toDegrees(Math.asin(b))},acos(b){return f.toDegrees(Math.acos(b))},atan(b){return f.toDegrees(Math.atan(b))},exp(b){return Math.exp(b)},ln(b){return Math.log(b)},log10(b){return Math.log(b)/
Math.LN10},max(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let d=1,c=b.length;d<c;++d){let e=b[d];"number"===typeof e&&a<e&&(a=e)}return a},min(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let d=1,c=b.length;d<c;++d){let e=b[d];"number"===typeof e&&a>e&&(a=e)}return a},clamp(b,a,d){return f.clamp(b,a,d)},distance(b,a,d,c){return f.distanceTo(b,a,d,c)},angle(b,a,d,c){return f.toDegrees(f.angleTo(b,a,d,c))},lerp(b,a,d){return f.lerp(b,a,d)},unlerp(b,a,d){return f.unlerp(b,a,d)},qarp(b,a,d,c){return f.qarp(b,
a,d,c)},cubic(b,a,d,c,e){return f.cubic(b,a,d,c,e)},cosp(b,a,d){return f.cosp(b,a,d)},anglediff(b,a){return f.toDegrees(f.angleDiff(f.toRadians(b),f.toRadians(a)))},anglelerp(b,a,d){return f.toDegrees(f.angleLerp(f.toRadians(b),f.toRadians(a),d))},anglerotate(b,a,d){return f.toDegrees(f.angleRotate(f.toRadians(b),f.toRadians(a),f.toRadians(d)))},setbit(b,a,d){a|=0;return(b|0)&~(1<<a)|(0!==d?1:0)<<a},togglebit(b,a){return(b|0)^1<<(a|0)},getbit(b,a){return(b|0)&1<<(a|0)?1:0},newline(){return"\n"},uppercase(b){return"string"===
typeof b?b.toUpperCase():""},lowercase(b){return"string"===typeof b?b.toLowerCase():""},left(b,a){return"string"===typeof b?b.substr(0,a):""},mid(b,a,d){return"string"!==typeof b?"":0>d?b.substr(a):b.substr(a,d)},right(b,a){return"string"===typeof b?b.substr(b.length-a):""},trim(b){return"string"===typeof b?b.trim():""},tokenat(b,a,d){if("string"!==typeof b||"string"!==typeof d)return"";b=b.split(d);a=Math.floor(a);return 0>a||a>=b.length?"":b[a]},tokencount(b,a){return"string"===typeof b&&"string"===
typeof a&&b.length?b.split(a).length:0},find(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(f.EscapeRegex(a),"i")):-1},findcase(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(f.EscapeRegex(a),"")):-1},replace(b,a,d){return"string"===typeof b&&"string"===typeof a&&"string"===typeof d?b.replace(new RegExp(f.EscapeRegex(a),"gi"),d):"string"===typeof b?b:""},regexsearch(b,a,d){a=this.GetRegex(a,d);return b?b.search(a):-1},regexreplace(b,a,d,c){a=this.GetRegex(a,
d);return b?b.replace(a,c):""},regexmatchcount(b,a,d){return(b=this.GetRegexMatches(b.toString(),a,d))?b.length:0},regexmatchat(b,a,d,c){c=Math.floor(c);b=this.GetRegexMatches(b.toString(),a,d);return!b||0>c||c>=b.length?"":b[c]},zeropad(b,a){let d=0>b?"-":"";0>b&&(b=-b);d+="0".repeat(Math.max(a-b.toString().length,0));return d+b.toString()},urlencode(b){return encodeURIComponent(b)},urldecode(b){return decodeURIComponent(b)},dt(){return this._runtime._GetDtFast()},timescale(){return this._runtime.GetTimeScale()},
wallclocktime(){return(Date.now()-this._runtime.GetStartTime())/1E3},unixtime(){return Date.now()},time(){return this._runtime.GetGameTime()},tickcount(){return this._runtime.GetTickCount()},objectcount(){return this._runtime.GetObjectCount()},fps(){return this._runtime.GetFPS()},cpuutilisation(){return this._runtime.GetMainThreadTime()},gpuutilisation(){return this._runtime.GetGPUUtilisation()},windowwidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()},windowheight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},
originalwindowwidth(){return this._runtime.GetOriginalViewportWidth()},originalwindowheight(){return this._runtime.GetOriginalViewportHeight()},originalviewportwidth(){return this._runtime.GetOriginalViewportWidth()},originalviewportheight(){return this._runtime.GetOriginalViewportHeight()},scrollx(){return this._runtime.GetCurrentLayout().GetScrollX()},scrolly(){return this._runtime.GetCurrentLayout().GetScrollY()},layoutname(){return this._runtime.GetCurrentLayout().GetName()},layoutscale(){return this._runtime.GetCurrentLayout().GetScale()},
layoutangle(){return f.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},viewportleft(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().getLeft():0},viewporttop(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().getTop():0},viewportright(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().getRight():
0},viewportbottom(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().getBottom():0},viewportwidth(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().width():0},viewportheight(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().height():0},canvastolayerx(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,d)[0]:0},canvastolayery(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,
d)[1]:0},layertocanvasx(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,d)[0]:0},layertocanvasy(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,d)[1]:0},layerscale(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetOwnScale():0},layerangle(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?f.toDegrees(b.GetOwnAngle()):0},layeropacity(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetOpacity():
0},layerscalerate(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScaleRate():0},layerparallaxx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetParallaxX():0},layerparallaxy(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetParallaxY():0},layerzelevation(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetZElevation():0},layerindex(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetIndex():-1},canvassnapshot(){const b=this._runtime.GetCanvasManager();
return b?b.GetCanvasSnapshotUrl():""},loopindex(b){const a=this._loopStack;return a.IsInLoop()?b?(b=a.FindByName(b))?b.GetIndex():0:a.GetCurrent().GetIndex():0},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(b,a,...d){var c=this._GetFunctionMap(b.toLowerCase(),!1);if(!c)return console.warn(`[Construct 3] Call mapped function: map name '${b}' not found; returning 0`),0;var e=c.strMap.get(a.toLowerCase());if(!e)if(c.defaultFunc)e=c.defaultFunc;else return console.warn(`[Construct 3] Call mapped function: no function associated with map '${b}' string '${a}'; returning 0 (consider setting a default)`),
0;c=e.GetReturnType();const g=e.GetDefaultReturnValue();if(0===c)return console.warn(`[Construct 3] Call mapped function: map '${b}' string '${a}' has no return type so cannot be called from an expression; returning 0`),0;if(!e.IsEnabled())return g;b=this._runtime.GetEventSheetManager();a=b.GetCurrentEvent().GetSolModifiersIncludingParents();const k=0<a.length;k&&b.PushCleanSol(a);const m=e.GetFunctionParameters();for(let p=d.length,n=m.length;p<n;++p)d.push(m[p].GetInitialValue());e=e.GetEventBlock();
d=e.RunAsExpressionFunctionCall(e.GetSolModifiersIncludingParents(),c,g,...d);k&&b.PopSol(a);return d},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return"webgl"},rendererdetail(){return this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let b=this._runtime.GetWebGLRenderer().GetEstimatedTextureMemoryUsage();return Math.round(100*
b/1048576)/100},rgb(b,a,d){return f.PackRGB(b,a,d)},rgbex(b,a,d){return f.PackRGBEx(b/100,a/100,d/100)},rgba(b,a,d,c){return f.PackRGBAEx(b/100,a/100,d/100,c/100)},rgbex255(b,a,d){return f.PackRGBEx(b/255,a/255,d/255)},rgba255(b,a,d,c){return f.PackRGBAEx(b/255,a/255,d/255,c/255)},projectname(){return this._runtime.GetProjectName()},projectversion(){return this._runtime.GetProjectVersion()},currenteventsheetname(){return this._runtime.GetCurrentEvent().GetEventSheet().GetName()},currenteventnumber(){return this._runtime.GetCurrentEvent().GetDisplayNumber()}}}"use strict";
{const f=self.C3;f.Plugins.Audio=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Audio.Type=class extends f.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};function b(){if(self.C3Audio_DOMInterface)return self.C3Audio_DOMInterface;throw Error("audio scripting API cannot be used here - make sure the project is using DOM mode, not worker mode");}self.IAudioObjectType=class extends self.IObjectClass{constructor(a){super(a)}get audioContext(){return b().GetAudioContext()}get destinationNode(){return b().GetDestinationNode()}}}"use strict";
{const f=self.C3,b=["interactive","balanced","playback"];f.Plugins.Audio.Instance=class extends f.SDKInstanceBase{constructor(a,d){super(a,"audio");this._nextPlayTime=0;this._triggerTag="";this._saveLoadMode=this._timeScaleMode=0;this._playInBackground=!1;this._distanceModel=this._panningModel=1;this._listenerX=this._runtime.GetViewportWidth()/2;this._listenerY=this._runtime.GetViewportHeight()/2;this._listenerZ=-600;this._referenceDistance=600;this._maxDistance=1E4;this._rolloffFactor=1;this._listenerInst=
null;this._loadListenerUid=-1;this._masterVolume=1;this._isSilent=!1;this._sampleRate=0;this._effectCount=new Map;this._preloadCount=this._preloadTotal=0;this._remoteUrls=new Map;a="interactive";d&&(this._timeScaleMode=d[0],this._saveLoadMode=d[1],this._playInBackground=d[2],a=b[d[3]],this._panningModel=d[4],this._distanceModel=d[5],this._listenerZ=-d[6],this._referenceDistance=d[7],this._maxDistance=d[8],this._rolloffFactor=d[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=
[];this.AddDOMMessageHandlers([["state",c=>this._OnUpdateState(c)],["fxstate",c=>this._OnUpdateFxState(c)],["trigger",c=>this._OnTrigger(c)]]);d=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(d,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)),f.Disposable.From(d,"afterload",()=>this._OnAfterLoad()),f.Disposable.From(d,"suspend",()=>this._OnSuspend()),f.Disposable.From(d,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",
{preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(c=>({originalUrl:c.originalUrl,url:c.url,type:c.type,fileSize:c.fileSize})),isiOSCordova:this._runtime.IsiOSCordova(),timeScaleMode:this._timeScaleMode,latencyHint:a,panningModel:this._panningModel,distanceModel:this._distanceModel,refDistance:this._referenceDistance,maxDistance:this._maxDistance,rolloffFactor:this._rolloffFactor,listenerPos:[this._listenerX,this._listenerY,this._listenerZ]}).then(c=>{this._sampleRate=c.sampleRate}));
this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_OnInstanceDestroyed(a){this._listenerInst===a&&(this._listenerInst=null)}DbToLinearNoCap(a){return Math.pow(10,a/20)}DbToLinear(a){a=this.DbToLinearNoCap(a);return isFinite(a)?Math.max(Math.min(a,1),0):0}LinearToDbNoCap(a){return Math.log(a)/Math.log(10)*20}LinearToDb(a){return this.LinearToDbNoCap(Math.max(Math.min(a,1),0))}_OnSuspend(){this._playInBackground||this.PostToDOM("set-suspended",{isSuspended:!0})}_OnResume(){this._playInBackground||
this.PostToDOM("set-suspended",{isSuspended:!1})}_OnUpdateState(a){const d=a.tickCount,c=this._lastAIState.filter(e=>e.hasOwnProperty("placeholder")&&(e.placeholder>d||-1===e.placeholder));this._lastAIState=a.audioInstances;this._lastAnalysersData=a.analysers;0<c.length&&f.appendArray(this._lastAIState,c)}_OnUpdateFxState(a){this._lastFxState=a.fxstate}_GetFirstAudioStateByTag(a){for(const d of this._lastAIState)if(f.equalsNoCase(d.tag,a))return d;return null}_IsTagPlaying(a){return this._lastAIState.some(d=>
f.equalsNoCase(a,d.tag)&&d.isPlaying)}_MaybeMarkAsPlaying(a,d,c,e){if(this._IsTagPlaying(a))return null;a={tag:a,duration:0,volume:e,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:d,isLooping:c,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(a);return a}async _OnTrigger(a){const d=a.type;this._triggerTag=a.tag;a=a.aiid;if("ended"===d){for(const c of this._lastAIState)if(c.aiid===a){c.isPlaying=!1;break}await this.TriggerAsync(f.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"===
d&&await this.TriggerAsync(f.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const a={timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTime(),instPans:this.GetInstancePans(),tickCount:this._runtime.GetTickCountNoSave()};if(this._listenerInst){const d=this._listenerInst.GetWorldInfo();this._listenerX=d.GetX();this._listenerY=d.GetY();a.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(a,d,c,e,g){if(0===c)return[a,d];const k=Math.sin(c);
c=Math.cos(c);a-=e;d-=g;const m=a*k;a=a*c-d*k;return[a+e,d*c+m+g]}GetInstancePans(){return this._lastAIState.filter(a=>-1!==a.uid).map(a=>this._runtime.GetInstanceByUID(a.uid)).filter(a=>a).map(a=>{const d=a.GetWorldInfo(),c=d.GetLayer().GetAngle(),[e,g]=this.rotatePtAround(d.GetX(),d.GetY(),-c,this._listenerX,this._listenerY);return{uid:a.GetUID(),x:e,y:g,angle:d.GetAngle()-c}})}GetAnalyserData(a,d){for(const c of this._lastAnalysersData)if(c.index===d&&f.equalsNoCase(c.tag,a))return c;return null}_IncrementEffectCount(a){this._effectCount.set(a,
(this._effectCount.get(a)||0)+1)}_ShouldSave(a){return a.hasOwnProperty("placeholder")||3===this._saveLoadMode?!1:a.isMusic&&1===this._saveLoadMode?!1:a.isMusic||2!==this._saveLoadMode?!0:!1}SaveToJson(){return{isSilent:this._isSilent,masterVolume:this._masterVolume,listenerZ:this._listenerZ,listenerUid:this._listenerInst?this._listenerInst.GetUID():-1,remoteUrls:[...this._remoteUrls.entries()],playing:this._lastAIState.filter(a=>this._ShouldSave(a)),effects:this._lastFxState,analysers:this._lastAnalysersData}}LoadFromJson(a){this._isSilent=
a.isSilent;this._masterVolume=a.masterVolume;this._listenerZ=a.listenerZ;this._listenerInst=null;this._loadListenerUid=a.listenerUid;this._remoteUrls.clear();if(a.remoteUrls)for(const [d,c]of a.remoteUrls)this._remoteUrls.set(d,c);this._lastAIState=a.playing;this._lastFxState=a.effects;this._lastAnalysersData=a.analysers}_OnAfterLoad(){if(-1!==this._loadListenerUid&&(this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid),this._loadListenerUid=-1,this._listenerInst)){var a=this._listenerInst.GetWorldInfo();
this._listenerX=a.GetX();this._listenerY=a.GetY()}for(var d of this._lastAIState)(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d.bufferOriginalUrl))?(d.bufferUrl=a.url,d.bufferType=a.type):d.bufferUrl=null;for(const c of Object.values(this._lastFxState))for(const e of c)e.hasOwnProperty("bufferOriginalUrl")&&(d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e.bufferOriginalUrl))&&(e.bufferUrl=d.url,e.bufferType=d.type);this.PostToDOM("load-state",{saveLoadMode:this._saveLoadMode,
timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTime(),listenerPos:[this._listenerX,this._listenerY,this._listenerZ],isSilent:this._isSilent,masterVolume:this._masterVolume,playing:this._lastAIState.filter(c=>null!==c.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const a=[];for(const [d,c]of Object.entries(this._lastFxState))a.push({name:"$"+d,value:c.map(e=>e.type).join(", ")});return[{title:"plugins.audio.debugger.tag-effects",properties:a},{title:"plugins.audio.debugger.currently-playing",
properties:[{name:"plugins.audio.debugger.currently-playing-count",value:this._lastAIState.length},...this._lastAIState.map((d,c)=>({name:"$#"+c,value:`${d.bufferOriginalUrl} ("${d.tag}") ${Math.round(10*d.playbackTime)/10} / ${Math.round(10*d.duration)/10}`}))]}]}}}"use strict";
{const f=self.C3;f.Plugins.Audio.Cnds={OnEnded(b){return f.equalsNoCase(this._triggerTag,b)},OnFadeEnded(b){return f.equalsNoCase(this._triggerTag,b)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return!0},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const b of this._lastAIState)if(b.isPlaying)return!0;return!1},IsTagPlaying(b){return this._IsTagPlaying(b)}}}"use strict";
{const f=self.C3,b="lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ");f.Plugins.Audio.Acts={async Play(a,d,c,e){if(!this._isSilent){var g=a[1],k=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(k){var m=this._nextPlayTime;this._nextPlayTime=0;var p=this._MaybeMarkAsPlaying(e.toLowerCase(),g,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:k.url,type:k.type,isMusic:g,tag:e.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(c),
pos:0,off:m,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{p&&(p.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,d,c,e,g,k,m,p,n,u){if(!this._isSilent){var q=a[1],r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(r){var t=this._nextPlayTime;this._nextPlayTime=0;var x=this._MaybeMarkAsPlaying(u.toLowerCase(),q,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:r.url,type:r.type,isMusic:q,tag:u.toLowerCase(),isLooping:0!==
d,vol:this.DbToLinear(c),pos:0,off:t,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:e,y:g,angle:f.toRadians(k),innerAngle:f.toRadians(m),outerAngle:f.toRadians(p),outerGain:this.DbToLinear(n)}})}finally{x&&(x.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,d,c,e,g,k,m,p){if(!this._isSilent&&e&&(e=e.GetFirstPicked())&&e.GetWorldInfo()){var n=e.GetWorldInfo(),u=n.GetLayer().GetAngle(),[q,r]=this.rotatePtAround(n.GetX(),n.GetY(),-u,this._listenerX,this._listenerY),
t=a[1],x=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(x){var z=this._nextPlayTime;this._nextPlayTime=0;var D=this._MaybeMarkAsPlaying(p.toLowerCase(),t,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:x.url,type:x.type,isMusic:t,tag:p.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(c),pos:0,off:z,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:q,y:r,angle:n.GetAngle()-u,innerAngle:f.toRadians(g),outerAngle:f.toRadians(k),outerGain:this.DbToLinear(m),
uid:e.GetUID()}})}finally{D&&(D.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(a,d,c,e,g){if(!this._isSilent){a=1===a;var k=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(k){var m=this._nextPlayTime;this._nextPlayTime=0;var p=this._MaybeMarkAsPlaying(g.toLowerCase(),a,0!==c,this.DbToLinear(e));try{await this.PostToDOMAsync("play",{originalUrl:d,url:k.url,type:k.type,isMusic:a,tag:g.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(e),
pos:0,off:m,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{p&&(p.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,d,c,e,g,k,m,p,n,u,q){if(!this._isSilent){a=1===a;var r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(r){var t=this._nextPlayTime;this._nextPlayTime=0;var x=this._MaybeMarkAsPlaying(q.toLowerCase(),a,0!==c,this.DbToLinear(e));try{await this.PostToDOMAsync("play",{originalUrl:d,url:r.url,type:r.type,
isMusic:a,tag:q.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(e),pos:0,off:t,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:g,y:k,angle:f.toRadians(m),innerAngle:f.toRadians(p),outerAngle:f.toRadians(n),outerGain:this.DbToLinear(u)}})}finally{x&&(x.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,d,c,e,g,k,m,p,n){if(!this._isSilent&&!this._isSilent&&g&&(g=g.GetFirstPicked())&&g.GetWorldInfo()){var u=g.GetWorldInfo(),q=u.GetLayer().GetAngle(),[r,t]=this.rotatePtAround(u.GetX(),
u.GetY(),-q,this._listenerX,this._listenerY);a=1===a;var x=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(x){var z=this._nextPlayTime;this._nextPlayTime=0;var D=this._MaybeMarkAsPlaying(n.toLowerCase(),a,0!==c,this.DbToLinear(e));try{await this.PostToDOMAsync("play",{originalUrl:d,url:x.url,type:x.type,isMusic:a,tag:n.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(e),pos:0,off:z,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:r,y:t,
angle:u.GetAngle()-q,innerAngle:f.toRadians(k),outerAngle:f.toRadians(m),outerGain:this.DbToLinear(p),uid:g.GetUID()}})}finally{D&&(D.placeholder=this._runtime.GetTickCountNoSave())}}}},SetLooping(a,d){this.PostToDOM("set-looping",{tag:a.toLowerCase(),isLooping:0===d})},SetMuted(a,d){this.PostToDOM("set-muted",{tag:a.toLowerCase(),isMuted:0===d})},SetVolume(a,d){this.PostToDOM("set-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(d)})},FadeVolume(a,d,c,e){this.PostToDOM("fade-volume",{tag:a.toLowerCase(),
vol:this.DbToLinear(d),duration:c,stopOnEnd:0===e})},async Preload(a){const d=a[1],c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:a[0],url:c.url,type:c.type,isMusic:d}),this._preloadCount++)},async PreloadByName(a,d){a=1===a;const c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:d,url:c.url,
type:c.type,isMusic:a}),this._preloadCount++)},SetPlaybackRate(a,d){this.PostToDOM("set-playback-rate",{tag:a.toLowerCase(),rate:Math.max(d,0)})},Stop(a){this.PostToDOM("stop",{tag:a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,d){this.PostToDOM("set-paused",{tag:a.toLowerCase(),paused:0===d})},Seek(a,d){this.PostToDOM("seek",{tag:a.toLowerCase(),pos:d})},SetSilent(a){2===a&&(a=this._isSilent?1:0);a=0===a;this._isSilent!==a&&(this._isSilent=a,this.PostToDOM("set-silent",{isSilent:a}))},
SetMasterVolume(a){a=this.DbToLinear(a);this._masterVolume!==a&&(this._masterVolume=a,this.PostToDOM("set-master-volume",{vol:a}))},AddFilterEffect(a,d,c,e,g,k,m){a=a.toLowerCase();d=b[d];this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"filter",tag:a,params:[d,c,e,g,k,f.clamp(m/100,0,1)]})},AddDelayEffect(a,d,c,e){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"delay",tag:a,params:[d,this.DbToLinear(c),f.clamp(e/100,0,1)]})},AddFlangerEffect(a,d,
c,e,g,k){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"flanger",tag:a,params:[d/1E3,c/1E3,e,g/100,f.clamp(k/100,0,1)]})},AddPhaserEffect(a,d,c,e,g,k,m){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"phaser",tag:a,params:[d,c,e,g,k,f.clamp(m/100,0,1)]})},AddConvolutionEffect(a,d,c,e){a=a.toLowerCase();const g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d[0]);g&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect",
{type:"convolution",tag:a,bufferOriginalUrl:d[0],bufferUrl:g.url,bufferType:g.type,params:[0===c,f.clamp(e/100,0,1)]}))},AddGainEffect(a,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[this.DbToLinear(d)]})},AddMuteEffect(a){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[0]})},AddTremoloEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"tremolo",
tag:a,params:[d,f.clamp(c/100,0,1)]})},AddRingModEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"ringmod",tag:a,params:[d,f.clamp(c/100,0,1)]})},AddDistortionEffect(a,d,c,e,g,k){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"distortion",tag:a,params:[this.DbToLinearNoCap(d),this.DbToLinearNoCap(c),e,this.DbToLinearNoCap(g),f.clamp(k/100,0,1)]})},AddCompressorEffect(a,d,c,e,g,k){a=a.toLowerCase();this._IncrementEffectCount(a);
this.PostToDOM("add-effect",{type:"compressor",tag:a,params:[d,c,e,g/1E3,k/1E3]})},AddAnalyserEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"analyser",tag:a,params:[d,c]})},RemoveEffects(a){a=a.toLowerCase();this._effectCount.set(a,0);this.PostToDOM("remove-effects",{tag:a});this._lastFxState={}},SetEffectParameter(a,d,c,e,g,k){this.PostToDOM("set-effect-param",{tag:a.toLowerCase(),index:Math.floor(d),param:c,value:e,ramp:g,time:k})},SetListenerObject(a){a&&
(a=a.GetFirstPicked())&&a.GetWorldInfo()&&(this._listenerInst=a)},SetListenerZ(a){this._listenerZ=a},ScheduleNextPlay(a){this._nextPlayTime=Math.max(a,0)},UnloadAudio(a){const d=a[1];(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]))&&this.PostToDOM("unload",{url:a.url,type:a.type,isMusic:d})},UnloadAudioByName(a,d){a=1===a;(d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase()))&&this.PostToDOM("unload",{url:d.url,type:d.type,isMusic:a})},
UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(a,d,c){this._remoteUrls.set(c.toLowerCase(),{url:a,type:d})}}}"use strict";
self.C3.Plugins.Audio.Exps={Duration(f){return(f=this._GetFirstAudioStateByTag(f))?f.duration:0},PlaybackTime(f){return(f=this._GetFirstAudioStateByTag(f))?f.playbackTime:0},PlaybackRate(f){return(f=this._GetFirstAudioStateByTag(f))?f.playbackRate:0},Volume(f){return(f=this._GetFirstAudioStateByTag(f))?this.LinearToDb(f.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(f){return this._effectCount.get(f.toLowerCase())||0},AnalyserFreqBinCount(f,b){return(f=this.GetAnalyserData(f,
Math.floor(b)))?f.binCount:0},AnalyserFreqBinAt(f,b,a){f=this.GetAnalyserData(f,Math.floor(b));if(!f)return 0;a=Math.floor(a);return 0>a||a>=f.binCount?0:f.freqBins[a]},AnalyserPeakLevel(f,b){return(f=this.GetAnalyserData(f,Math.floor(b)))?f.peak:0},AnalyserRMSLevel(f,b){return(f=this.GetAnalyserData(f,Math.floor(b)))?f.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/1E3}};"use strict";
{const f=self.C3;f.Plugins.Browser=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Plugins.Browser.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}"use strict";
{const f=self.C3;f.Plugins.Browser.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b,"browser");this._initLocationStr="";this._isOnline=!1;this._docTitle=this._referrer="";this._isCookieEnabled=!1;this._windowOuterHeight=this._windowOuterWidth=this._screenHeight=this._screenWidth=0;this._isScirraArcade=!1;this.AddDOMMessageHandlers([["online-state",d=>this._OnOnlineStateChanged(d)],["backbutton",()=>this._OnBackButton()],["sw-message",d=>this._OnSWMessage(d)],["hashchange",d=>this._OnHashChange(d)]]);
b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),f.Disposable.From(b,"window-resize",()=>this._OnWindowResize()),f.Disposable.From(b,"suspend",()=>this._OnSuspend()),f.Disposable.From(b,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state",{exportType:this._runtime.GetExportType()}).then(d=>{this._initLocationStr=d.location;this._isOnline=d.isOnline;
this._referrer=d.referrer;this._docTitle=d.title;this._isCookieEnabled=d.isCookieEnabled;this._screenWidth=d.screenWidth;this._screenHeight=d.screenHeight;this._windowOuterWidth=d.windowOuterWidth;this._windowOuterHeight=d.windowOuterHeight;this._isScirraArcade=d.isScirraArcade}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(b){b=!!b.isOnline;this._isOnline!==b&&((this._isOnline=b)?await this.TriggerAsync(f.Plugins.Browser.Cnds.OnOnline):
await this.TriggerAsync(f.Plugins.Browser.Cnds.OnOffline))}async _OnWindowResize(){await this.TriggerAsync(f.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(f.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(f.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(f.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(b){b=b.type;"downloading-update"===b?this.Trigger(f.Plugins.Browser.Cnds.OnUpdateFound):"update-ready"===b||"update-pending"===b?this.Trigger(f.Plugins.Browser.Cnds.OnUpdateReady):
"offline-ready"===b&&this.Trigger(f.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(b){this._initLocationStr=b.location;this.Trigger(f.Plugins.Browser.Cnds.OnHashChange)}GetDebuggerProperties(){return[{title:"plugins.browser.name",properties:[{name:"plugins.browser.debugger.user-agent",value:navigator.userAgent},{name:"plugins.browser.debugger.is-online",value:this._isOnline},{name:"plugins.browser.debugger.is-fullscreen",value:this._runtime.GetCanvasManager().IsDocumentFullscreen()}]}]}}}"use strict";
self.C3.Plugins.Browser.Cnds={IsOnline(){return this._isOnline},OnOnline(){return!0},OnOffline(){return!0},OnResize(){return!0},CookiesEnabled(){return this._isCookieEnabled},IsFullscreen(){return this._runtime.GetCanvasManager().IsDocumentFullscreen()},OnBackButton(){return!0},IsPortraitLandscape(f){const b=this._runtime.GetCanvasManager().GetLastWidth(),a=this._runtime.GetCanvasManager().GetLastHeight();return(b<=a?0:1)===f},OnUpdateFound(){return!0},OnUpdateReady(){return!0},OnOfflineReady(){return!0},
OnHashChange(){return!0},PageVisible(){return!this._runtime.IsSuspended()},OnPageHidden(){return!0},OnPageVisible(){return!0},HasJava(){return!1},IsDownloadingUpdate(){return!1},OnMenuButton(){return!1},OnSearchButton(){return!1},IsMetered(){return!1},IsCharging(){return!0},SupportsFullscreen(){return!0}};"use strict";
{const f=self.C3,b="portrait landscape portrait-primary portrait-secondary landscape-primary landscape-secondary".split(" ");f.Plugins.Browser.Acts={Alert(a){this.PostToDOM("alert",{message:a.toString()})},Close(){this._isScirraArcade||(this._runtime.IsDebug()?self.C3Debugger.CloseWindow():this.PostToDOM("close"))},Focus(){this.PostToDOM("set-focus",{isFocus:!0})},Blur(){this.PostToDOM("set-focus",{isFocus:!1})},GoBack(){this._isScirraArcade||this.PostToDOM("navigate",{type:"back"})},GoForward(){this._isScirraArcade||
this.PostToDOM("navigate",{type:"forward"})},GoHome(){this._isScirraArcade||this.PostToDOM("navigate",{type:"home"})},Reload(){this._isScirraArcade||(this._runtime.IsDebug()?this._runtime.PostToDebugger({type:"reload"}):this.PostToDOM("navigate",{type:"reload"}))},GoToURL(a,d){this._PostToDOMMaybeSync("navigate",{type:"url",url:a,target:d,exportType:this._runtime.GetExportType()})},GoToURLWindow(a,d){this._PostToDOMMaybeSync("navigate",{type:"new-window",url:a,tag:d,exportType:this._runtime.GetExportType()})},
RequestFullScreen(a,d){2<=a&&(a+=1);6===a&&(a=2);1===a&&(a=0);a=f.CanvasManager._FullscreenModeNumberToString(a);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(a);this._PostToDOMMaybeSync("request-fullscreen",{navUI:d})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(a){a=a.split(",");for(let d=0,c=a.length;d<c;++d)a[d]=parseInt(a[d],10);this._PostToDOMMaybeSync("vibrate",{pattern:a})},async InvokeDownload(a,d){d&&(a=await this._runtime.GetAssetManager().GetProjectFileUrl(a),
this._runtime.InvokeDownload(a,d))},InvokeDownloadString(a,d,c){c&&(a=`data:${d},${encodeURIComponent(a)}`,this._runtime.InvokeDownload(a,c))},ConsoleLog(a,d){d=d.toString();0===a?console.log(d):1===a?console.warn(d):2===a&&console.error(d)},ConsoleGroup(a){console.group(a)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(a){try{eval(a)}catch(d){console.error("Error executing JavaScript: ",d)}},LockOrientation(a){a=Math.floor(a);0>a||a>=b.length||this._PostToDOMMaybeSync("lock-orientation",{orientation:b[a]})},
UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")},LoadStyleSheet(a){this._runtime.GetAssetManager().LoadStyleSheet(a)},SetHash(a){this.PostToDOM("set-hash",{hash:a})}}}"use strict";
self.C3.Plugins.Browser.Exps={URL(){return this._runtime.IsInWorker()?this._initLocationStr:location.toString()},Protocol(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).protocol:location.protocol},Domain(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).hostname:location.hostname},Port(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).port:location.port},PathName(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).pathname:
location.pathname},Hash(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).hash:location.hash},QueryString(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search},QueryParam(f){const b=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;return(f=RegExp("[?&]"+f+"=([^&]*)").exec(b))?decodeURIComponent(f[1].replace(/\+/g," ")):""},Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},
Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(f){let b=0;try{b=eval(f)}catch(a){console.error("Error executing JavaScript: ",a)}return"number"===typeof b||"string"===typeof b?b:"boolean"===typeof b?b?1:0:0},Name(){return navigator.appName},Version(){return navigator.appVersion},Product(){return navigator.product},Vendor(){return navigator.vendor},BatteryLevel(){return 1},BatteryTimeLeft(){return Infinity},Bandwidth(){const f=navigator.connection;return f?f.downlink||
f.downlinkMax||f.bandwidth||Infinity:Infinity},ConnectionType(){const f=navigator.connection;return f?f.type||"unknown":"unknown"},DevicePixelRatio(){return self.devicePixelRatio},ScreenWidth(){return this._screenWidth},ScreenHeight(){return this._screenHeight},WindowInnerWidth(){return this._runtime.GetCanvasManager().GetLastWidth()},WindowInnerHeight(){return this._runtime.GetCanvasManager().GetLastHeight()},WindowOuterWidth(){return this._windowOuterWidth},WindowOuterHeight(){return this._windowOuterWidth}};
"use strict";{const f=self.C3;f.Plugins.Touch=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Touch.Type=class extends f.SDKTypeBase{constructor(d){super(d)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.ITouchObjectType}};let b=null;function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.ITouchObjectType=class extends self.IObjectClass{constructor(d){super(d);b=d;d.GetRuntime()._GetCommonScriptInterfaces().touch=this}requestPermission(d){const c=a();if("orientation"===d)return c._RequestPermission(0);if("motion"===d)return c._RequestPermission(1);
throw Error("invalid type");}}}"use strict";
{const f=self.C3;f.Plugins.Touch.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b,"touch");this._touches=new Map;this._isMouseDown=this._useMouseInput=!1;this._getTouchIndex=this._curTouchY=this._curTouchX=this._triggerPermission=this._triggerId=this._triggerIndex=this._accWithGZ=this._accWithGY=this._accWithGX=this._accZ=this._accY=this._accX=this._orientGamma=this._orientBeta=this._orientAlpha=this._orientCompassHeading=0;this._permissionPromises=[];a&&(this._useMouseInput=a[0]);
this.AddDOMMessageHandler("permission-result",d=>this._OnPermissionResult(d));b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"pointerdown",d=>this._OnPointerDown(d.data)),f.Disposable.From(b,"pointermove",d=>this._OnPointerMove(d.data)),f.Disposable.From(b,"pointerup",d=>this._OnPointerUp(d.data,!1)),f.Disposable.From(b,"pointercancel",d=>this._OnPointerUp(d.data,!0)),f.Disposable.From(b,"deviceorientation",d=>this._OnDeviceOrientation(d.data)),f.Disposable.From(b,
"deviceorientationabsolute",d=>this._OnDeviceOrientationAbsolute(d.data)),f.Disposable.From(b,"devicemotion",d=>this._OnDeviceMotion(d.data)),f.Disposable.From(b,"tick2",d=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(b){if("mouse"===b.pointerType)if(this._useMouseInput)this._isMouseDown=!0;else return;const a=b.pointerId;if(!this._touches.has(a)){var d=b.pageX-this._runtime.GetCanvasClientX(),c=b.pageY-this._runtime.GetCanvasClientY();b=b.timeStamp;var e=this._touches.size;
this._triggerIndex=e;this._triggerId=a;var g=f.New(f.Plugins.Touch.TouchInfo);g.Init(b,d,c,a,e);this._touches.set(a,g);this.Trigger(f.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(f.Plugins.Touch.Cnds.OnTouchStart);this._curTouchX=d;this._curTouchY=c;this.Trigger(f.Plugins.Touch.Cnds.OnTouchObject)}}_OnPointerMove(b){if("mouse"!==b.pointerType||this._isMouseDown){var a=this._touches.get(b.pointerId);if(a){var d=b.timeStamp;if(!(2>d-a.GetTime())){var c=b.pageX-this._runtime.GetCanvasClientX(),e=
b.pageY-this._runtime.GetCanvasClientY();a.Update(d,c,e,b.width,b.height,b.pressure)}}}}_OnPointerUp(b,a){if("mouse"===b.pointerType)if(this._isMouseDown)this._isMouseDown=!1;else return;const d=b.timeStamp;b=b.pointerId;const c=this._touches.get(b);c&&(this._triggerIndex=c.GetStartIndex(),this._triggerId=c.GetId(),this.Trigger(f.Plugins.Touch.Cnds.OnNthTouchEnd),this.Trigger(f.Plugins.Touch.Cnds.OnTouchEnd),a||(a=c.ShouldTriggerTap(d),"single-tap"===a?(this.Trigger(f.Plugins.Touch.Cnds.OnTapGesture),
this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnTapGestureObject)):"double-tap"===a&&(this.Trigger(f.Plugins.Touch.Cnds.OnDoubleTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnDoubleTapGestureObject))),c.Release(),this._touches.delete(b))}_RequestPermission(b){this._PostToDOMMaybeSync("request-permission",{type:b});return new Promise((a,d)=>{this._permissionPromises.push({type:b,resolve:a,reject:d})})}_OnPermissionResult(b){const a=
b.result,d=b.type;this._triggerPermission=d;b=this._permissionPromises.filter(c=>c.type===d);for(const c of b)c.resolve(a?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(c=>c.type!==d);a?(this.Trigger(f.Plugins.Touch.Cnds.OnPermissionGranted),0===d?this._runtime.RequestDeviceOrientationEvent():this._runtime.RequestDeviceMotionEvent()):this.Trigger(f.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(b){"number"===typeof b.webkitCompassHeading?this._orientCompassHeading=
b.webkitCompassHeading:b.absolute&&(this._orientCompassHeading=b.alpha);this._orientAlpha=b.alpha;this._orientBeta=b.beta;this._orientGamma=b.gamma}_OnDeviceOrientationAbsolute(b){this._orientCompassHeading=b.alpha}_OnDeviceMotion(b){const a=b.acceleration;a&&(this._accX=a.x,this._accY=a.y,this._accZ=a.z);if(b=b.accelerationIncludingGravity)this._accWithGX=b.x,this._accWithGY=b.y,this._accWithGZ=b.z}_OnTick2(){const b=performance.now();let a=0;for(const d of this._touches.values())d.GetTime()<=b-
50&&d._SetLastTime(b),d.ShouldTriggerHold(b)&&(this._triggerIndex=d.GetStartIndex(),this._triggerId=d.GetId(),this._getTouchIndex=a,this.Trigger(f.Plugins.Touch.Cnds.OnHoldGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnHoldGestureObject),this._getTouchIndex=0),++a}_GetTouchByIndex(b){b=Math.floor(b);for(const a of this._touches.values()){if(0===b)return a;--b}return null}_IsClientPosOnCanvas(b,a){return 0<=b&&0<=a&&b<this._runtime.GetCanvasCssWidth()&&
a<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.touch.debugger.touches",properties:[...this._touches.values()].map(b=>({name:"$"+b.GetId(),value:b.GetX()+", "+b.GetY()}))}]}}}"use strict";
{const f=self.C3,b=[];f.Plugins.Touch.Cnds={OnTouchStart(){return!0},OnTouchEnd(){return!0},IsInTouch(){return 0<this._touches.size},OnTouchObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},IsTouchingObject(a){if(!a)return!1;const d=a.GetCurrentSol();var c=d.GetInstances();for(const e of c){c=e.GetWorldInfo();const g=c.GetLayer();for(const k of this._touches.values()){if(!this._IsClientPosOnCanvas(k.GetX(),
k.GetY()))continue;const [m,p]=g.CanvasCssToLayer(k.GetX(),k.GetY(),c.GetTotalZElevation());if(c.ContainsPoint(m,p)){b.push(e);break}}}return b.length?(d.SetArrayPicked(b),a.ApplySolToContainer(),f.clearArray(b),!0):!1},CompareTouchSpeed(a,d,c){return(a=this._GetTouchByIndex(a))?f.compare(a.GetSpeed(),d,c):!1},OrientationSupported(){return!0},MotionSupported(){return!0},CompareOrientation(a,d,c){this._runtime.RequestDeviceOrientationEvent();return f.compare(0===a?this._orientAlpha:1===a?this._orientBeta:
this._orientGamma,d,c)},CompareAcceleration(a,d,c){this._runtime.RequestDeviceMotionEvent();return f.compare(0===a?this._accWithGX:1===a?this._accWithGY:2===a?this._accWithGZ:3===a?this._accX:4===a?this._accY:this._accZ,d,c)},OnNthTouchStart(a){a=Math.floor(a);return a===this._triggerIndex},OnNthTouchEnd(a){a=Math.floor(a);return a===this._triggerIndex},HasNthTouch(a){a=Math.floor(a);return this._touches.size>=a+1},OnHoldGesture(){return!0},OnTapGesture(){return!0},OnDoubleTapGesture(){return!0},
OnHoldGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnTapGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnDoubleTapGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,
this._curTouchX,this._curTouchY,!1):!1},OnPermissionGranted(a){return this._triggerPermission===a},OnPermissionDenied(a){return this._triggerPermission===a}}}"use strict";self.C3.Plugins.Touch.Acts={RequestPermission(f){this._RequestPermission(f)}};"use strict";
{const f=self.C3;f.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(b){const a=this._GetTouchByIndex(this._getTouchIndex);return a?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!0):0},Y(b){const a=this._GetTouchByIndex(this._getTouchIndex);return a?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!1):0},XAt(b,a){return(b=this._GetTouchByIndex(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},YAt(b,a){return(b=this._GetTouchByIndex(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),
a,!1):0},XForID(b,a){return(b=this._touches.get(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},YForID(b,a){return(b=this._touches.get(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},AbsoluteX(){const b=this._GetTouchByIndex(0);return b?b.GetX():0},AbsoluteY(){const b=this._GetTouchByIndex(0);return b?b.GetY():0},AbsoluteXAt(b){return(b=this._GetTouchByIndex(b))?b.GetX():0},AbsoluteYAt(b){return(b=this._GetTouchByIndex(b))?b.GetY():0},AbsoluteXForID(b){return(b=
this._touches.get(b))?b.GetX():0},AbsoluteYForID(b){return(b=this._touches.get(b))?b.GetY():0},SpeedAt(b){return(b=this._GetTouchByIndex(b))?b.GetSpeed():0},SpeedForID(b){return(b=this._touches.get(b))?b.GetSpeed():0},AngleAt(b){return(b=this._GetTouchByIndex(b))?f.toDegrees(b.GetAngle()):0},AngleForID(b){return(b=this._touches.get(b))?f.toDegrees(b.GetAngle()):0},CompassHeading(){this._runtime.RequestDeviceOrientationEvent();return this._orientCompassHeading},Alpha(){this._runtime.RequestDeviceOrientationEvent();
return this._orientAlpha},Beta(){this._runtime.RequestDeviceOrientationEvent();return this._orientBeta},Gamma(){this._runtime.RequestDeviceOrientationEvent();return this._orientGamma},AccelerationXWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGX},AccelerationYWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGY},AccelerationZWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGZ},AccelerationX(){this._runtime.RequestDeviceMotionEvent();return this._accX},
AccelerationY(){this._runtime.RequestDeviceMotionEvent();return this._accY},AccelerationZ(){this._runtime.RequestDeviceMotionEvent();return this._accZ},TouchIndex(){return this._triggerIndex},TouchID(){return this._triggerId},WidthForID(b){return(b=this._touches.get(b))?b.GetWidth():0},HeightForID(b){return(b=this._touches.get(b))?b.GetHeight():0},PressureForID(b){return(b=this._touches.get(b))?b.GetPressure():0}}}"use strict";
{const f=self.C3;let b=-1E3,a=-1E3,d=-1E4;f.Plugins.Touch.TouchInfo=class extends f.DefendedBase{constructor(){super();this._pressure=this._height=this._width=this._lastY=this._lastX=this._y=this._x=this._startY=this._startX=this._lastTime=this._time=this._startTime=this._startIndex=this._pointerId=0;this._isTooFarForHold=this._hasTriggeredHold=!1}Release(){}Init(c,e,g,k,m){this._pointerId=k;this._startIndex=m;this._startTime=this._lastTime=this._time=c;this._startX=e;this._startY=g;this._x=e;this._y=
g;this._lastX=e;this._lastY=g}Update(c,e,g,k,m,p){this._lastTime=this._time;this._time=c;this._lastX=this._x;this._lastY=this._y;this._x=e;this._y=g;this._width=k;this._height=m;this._pressure=p;!this._isTooFarForHold&&15<=f.distanceTo(this._startX,this._startY,this._x,this._y)&&(this._isTooFarForHold=!0)}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(c){this._lastTime=c}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const c=
f.distanceTo(this._x,this._y,this._lastX,this._lastY),e=(this._time-this._lastTime)/1E3;return 0<e?c/e:0}GetAngle(){return f.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(c){return this._hasTriggeredHold?!1:500<=c-this._startTime&&!this._isTooFarForHold&&15>f.distanceTo(this._startX,this._startY,this._x,this._y)?this._hasTriggeredHold=!0:!1}ShouldTriggerTap(c){if(this._hasTriggeredHold)return"";
if(333>=c-this._startTime&&!this._isTooFarForHold&&15>f.distanceTo(this._startX,this._startY,this._x,this._y)){if(666>=c-d&&25>f.distanceTo(b,a,this._x,this._y))return a=b=-1E3,d=-1E4,"double-tap";b=this._x;a=this._y;d=c;return"single-tap"}return""}GetPositionForLayer(c,e,g){return"undefined"===typeof e?c.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(this._x,this._y)[g?0:1]:(c=c.GetLayer(e))?c.CanvasCssToLayer(this._x,this._y)[g?0:1]:0}}}"use strict";{const f=self.C3;f.Plugins.Arr=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Arr.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}"use strict";
{const f=self.C3,b=self.IInstance;function a(c,e,g){if(e<c.length)f.truncateArray(c,e);else if(e>c.length)if("function"===typeof g)for(var k=c.length;k<e;++k)c.push(g());else for(k=c.length;k<e;++k)c.push(g)}f.Plugins.Arr.Instance=class extends f.SDKInstanceBase{constructor(c,e){super(c);this._cx=10;this._cz=this._cy=1;this._arr=null;this._forX=[];this._forY=[];this._forZ=[];this._forDepth=-1;e&&(this._cx=e[0],this._cy=e[1],this._cz=e[2]);this._arr=f.MakeFilledArray(this._cx,()=>f.MakeFilledArray(this._cy,
()=>f.MakeFilledArray(this._cz,0)))}Release(){this._arr=null;super.Release()}At(c,e,g){c=Math.floor(c);e=Math.floor(e);g=Math.floor(g);return 0<=c&&c<this._cx&&0<=e&&e<this._cy&&0<=g&&g<this._cz?this._arr[c][e][g]:0}Set(c,e,g,k){c=Math.floor(c);e=Math.floor(e);g=Math.floor(g);0<=c&&c<this._cx&&0<=e&&e<this._cy&&0<=g&&g<this._cz&&(this._arr[c][e][g]=k)}SetSize(c,e,g){c=Math.floor(c);e=Math.floor(e);g=Math.floor(g);0>c&&(c=0);0>e&&(e=0);0>g&&(g=0);if(this._cx!==c||this._cy!==e||this._cz!==g){this._cx=
c;this._cy=e;this._cz=g;var k=this._arr;a(k,c,()=>f.MakeFilledArray(e,()=>f.MakeFilledArray(g,0)));for(let m=0;m<c;++m){a(k[m],e,()=>f.MakeFilledArray(g,0));for(let p=0;p<e;++p)a(k[m][p],g,0)}}}GetWidth(){return this._cx}GetHeight(){return this._cy}GetDepth(){return this._cz}GetDebuggerProperties(){const c=[{title:"plugins.arr.debugger.array-properties.title",properties:[{name:"plugins.arr.properties.width.name",value:this._cx,onedit:g=>this.SetSize(g,this._cy,this._cz)},{name:"plugins.arr.properties.height.name",
value:this._cy,onedit:g=>this.SetSize(this._cx,g,this._cz)},{name:"plugins.arr.properties.depth.name",value:this._cz,onedit:g=>this.SetSize(this._cx,this._cy,g)},{name:"plugins.arr.properties.elements.name",value:this._cx*this._cy*this._cz}]}],e=[];if(1===this._cy&&1===this._cz)for(let g=0;g<this._cx;++g)e.push({name:"$"+g,value:this._arr[g][0][0],onedit:k=>this._arr[g][0][0]=k});else for(let g=0;g<this._cx;++g)e.push({name:"$"+g,value:this._arr[g].toString()});e.length&&c.push({title:"plugins.arr.debugger.array-data.title",
properties:e});return c}GetAsJsonString(){return JSON.stringify({c2array:!0,size:[this._cx,this._cy,this._cz],data:this._arr})}SaveToJson(){return{size:[this._cx,this._cy,this._cz],data:this._arr}}LoadFromJson(c){const e=c.size;this._cx=e[0];this._cy=e[1];this._cz=e[2];this._arr=c.data}_GetForX(){return 0<=this._forDepth&&this._forDepth<this._forX.length?this._forX[this._forDepth]:0}_GetForY(){return 0<=this._forDepth&&this._forDepth<this._forY.length?this._forY[this._forDepth]:0}_GetForZ(){return 0<=
this._forDepth&&this._forDepth<this._forZ.length?this._forZ[this._forDepth]:0}GetScriptInterfaceClass(){return self.IArrayInstance}};const d=new WeakMap;self.IArrayInstance=class extends b{constructor(){super();d.set(this,b._GetInitInst().GetSdkInstance())}get width(){return d.get(this).GetWidth()}get height(){return d.get(this).GetHeight()}get depth(){return d.get(this).GetDepth()}setSize(c,e=1,g=1){d.get(this).SetSize(c,e,g)}getAt(c,e=0,g=0){return d.get(this).At(c,e,g)}setAt(c,e,g=0,k=0){if("number"!==
typeof c&&"string"!==typeof c)throw new TypeError("invalid type");d.get(this).Set(e,g,k,c)}}}"use strict";
{const f=self.C3;function b(a,d,c,e,g){a.PushCopySol(c);d.Retrigger(e,g);a.PopSol(c)}f.Plugins.Arr.Cnds={CompareX(a,d,c){return f.compare(this.At(a,0,0),d,c)},CompareXY(a,d,c,e){return f.compare(this.At(a,d,0),c,e)},CompareXYZ(a,d,c,e,g){return f.compare(this.At(a,d,c),e,g)},ArrForEach(a){const d=this._runtime,c=d.GetEventSheetManager(),e=d.GetCurrentEvent(),g=e.GetSolModifiers(),k=d.GetEventStack(),m=k.GetCurrentStackFrame(),p=k.Push(e),n=++this._forDepth,u=this._forX;var q=this._forY,r=this._forZ;
const t=this._cx,x=this._cy;var z=this._cz;n===this._forX.length?(u.push(0),q.push(0),r.push(0)):(u[n]=0,q[n]=0,r[n]=0);d.SetDebuggingEnabled(!1);if(0===a)for(a=0;a<t;++a)for(let D=0;D<x;++D)for(let G=0;G<z;++G)u[n]=a,q[n]=D,r[n]=G,b(c,e,g,m,p);else if(1===a)for(r=0;r<t;++r)for(z=0;z<x;++z)u[n]=r,q[n]=z,b(c,e,g,m,p);else for(q=0;q<t;++q)u[n]=q,b(c,e,g,m,p);d.SetDebuggingEnabled(!0);this._forDepth--;k.Pop();return!1},CompareCurrent(a,d){return f.compare(this.At(this._GetForX(),this._GetForY(),this._GetForZ()),
a,d)},Contains(a){const d=this._cx,c=this._cy,e=this._cz,g=this._arr;for(let k=0;k<d;++k)for(let m=0;m<c;++m)for(let p=0;p<e;++p)if(g[k][m][p]===a)return!0;return!1},IsEmpty(){return 0===this._cx||0===this._cy||0===this._cz},CompareSize(a,d,c){let e=0;switch(a){case 0:e=this._cx;break;case 1:e=this._cy;break;case 2:e=this._cz}return f.compare(e,d,c)}}}"use strict";
{const f=self.C3;function b(a,d){if("number"===typeof a&&"number"===typeof d)return a-d;a=a.toString();d=d.toString();return a<d?-1:a>d?1:0}f.Plugins.Arr.Acts={Clear(a){const d=this._cx,c=this._cy,e=this._cz,g=this._arr;for(let k=0;k<d;++k)for(let m=0;m<c;++m)for(let p=0;p<e;++p)g[k][m][p]=a},SetSize(a,d,c){this.SetSize(a,d,c)},SetX(a,d){this.Set(a,0,0,d)},SetXY(a,d,c){this.Set(a,d,0,c)},SetXYZ(a,d,c,e){this.Set(a,d,c,e)},Push(a,d,c){var e=this._cx,g=this._cy;const k=this._cz,m=this._arr;if(0===c)e=
f.MakeFilledArray(g,()=>f.MakeFilledArray(k,d)),0===a?m.push(e):m.unshift(e),this._cx++;else if(1===c){for(g=0;g<e;++g)c=f.MakeFilledArray(k,d),0===a?m[g].push(c):m[g].unshift(c);this._cy++}else{for(c=0;c<e;++c)for(let p=0;p<g;++p)0===a?m[c][p].push(d):m[c][p].unshift(d);this._cz++}},Pop(a,d){const c=this._cx;var e=this._cy,g=this._cz;const k=this._arr;if(0===d)0!==c&&(0===a?k.pop():k.shift(),this._cx--);else if(1===d){if(0!==e){for(e=0;e<c;++e)0===a?k[e].pop():k[e].shift();this._cy--}}else if(0!==
g){for(d=0;d<c;++d)for(g=0;g<e;++g)0===a?k[d][g].pop():k[d][g].shift();this._cz--}},Reverse(a){const d=this._cx;var c=this._cy,e=this._cz;const g=this._arr;if(0!==d&&0!==c&&0!==e)if(0===a)g.reverse();else if(1===a)for(c=0;c<d;++c)g[c].reverse();else for(a=0;a<d;++a)for(e=0;e<c;++e)g[a][e].reverse()},Sort(a){const d=this._cx;var c=this._cy,e=this._cz;const g=this._arr;if(0!==d&&0!==c&&0!==e)if(0===a)g.sort((k,m)=>b(k[0][0],m[0][0]));else if(1===a)for(c=0;c<d;++c)g[c].sort((k,m)=>b(k[0],m[0]));else for(a=
0;a<d;++a)for(e=0;e<c;++e)g[a][e].sort(b)},Delete(a,d){a=Math.floor(a);if(!(0>a)){var c=this._cx,e=this._cy,g=this._cz,k=this._arr;if(0===d)a>=c||(k.splice(a,1),this._cx--);else if(1===d){if(!(a>=e)){for(e=0;e<c;++e)k[e].splice(a,1);this._cy--}}else if(!(a>=g)){for(d=0;d<c;++d)for(g=0;g<e;++g)k[d][g].splice(a,1);this._cz--}}},Insert(a,d,c){d=Math.floor(d);if(!(0>d)){var e=this._cx,g=this._cy,k=this._cz,m=this._arr;if(0===c)d>e||(m.splice(d,0,f.MakeFilledArray(g,()=>f.MakeFilledArray(k,a))),this._cx++);
else if(1===c){if(!(d>g)){for(g=0;g<e;++g)m[g].splice(d,0,f.MakeFilledArray(k,a));this._cy++}}else if(!(d>k)){for(c=0;c<e;++c)for(let p=0;p<g;++p)m[c][p].splice(d,0,a);this._cz++}}},JSONLoad(a){let d=null;try{d=JSON.parse(a)}catch(c){console.error("[Construct 3] Failed to parse JSON: ",c);return}d.c2array&&(a=d.size,this._cx=a[0],this._cy=a[1],this._cz=a[2],this._arr=d.data)},JSONDownload(a){const d=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(d,
a)}}}"use strict";
self.C3.Plugins.Arr.Exps={At(f,b,a){return this.At(f,b||0,a||0)},Width(){return this._cx},Height(){return this._cy},Depth(){return this._cz},CurX(){return this._GetForX()},CurY(){return this._GetForY()},CurZ(){return this._GetForZ()},CurValue(){return this.At(this._GetForX(),this._GetForY(),this._GetForZ())},Front(){return this.At(0,0,0)},Back(){return this.At(this._cx-1,0,0)},IndexOf(f){const b=this._arr;for(let a=0,d=this._cx;a<d;++a)if(b[a][0][0]===f)return a;return-1},LastIndexOf(f){const b=this._arr;
for(let a=this._cx-1;0<=a;--a)if(b[a][0][0]===f)return a;return-1},AsJSON(){return this.GetAsJsonString()}};"use strict";{const f=self.C3;f.Plugins.LocalStorage=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Plugins.LocalStorage.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}"use strict";
{const f=self.C3;f.Plugins.LocalStorage.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b);this._lastValue=this._currentKey="";this._keyNamesList=[];this._errorMessage="";this._pendingSets=this._pendingGets=0;this._storage=this._runtime._GetProjectStorage();this._debugCache=new Map;this._isLoadingDebugCache=!1}Release(){super.Release()}async _TriggerStorageError(b){this._errorMessage=this._GetErrorString(b);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnError)}_GetErrorString(b){return b?
"string"===typeof b?b:"string"===typeof b.message?b.message:"string"===typeof b.name?b.name:"string"===typeof b.data?b.data:"unknown error":"unknown error"}GetDebuggerProperties(){this._isLoadingDebugCache||this._DebugCacheStorage();return[{title:"plugins.localstorage.name",properties:[...this._debugCache.entries()].map(b=>({name:"$"+b[0],value:b[1],onedit:a=>this._storage.setItem(b[0],a)}))}]}async _DebugCacheStorage(){this._isLoadingDebugCache=!0;try{const b=await this._storage.keys();b.sort((d,
c)=>{d=d.toLowerCase();c=c.toLowerCase();return d<c?-1:c<d?1:0});const a=await Promise.all(b.map(d=>this._storage.getItem(d)));this._debugCache.clear();for(let d=0,c=b.length;d<c;++d)this._debugCache.set(b[d],a[d])}catch(b){console.warn("[C3 debugger] Error displaying local storage: ",b)}finally{this._isLoadingDebugCache=!1}}}}"use strict";
{const f=self.C3;f.Plugins.LocalStorage.Cnds={OnItemSet(b){return this._currentKey===b},OnAnyItemSet(){return!0},OnItemGet(b){return this._currentKey===b},OnAnyItemGet(){return!0},OnItemRemoved(b){return this._currentKey===b},OnAnyItemRemoved(){return!0},OnCleared(){return!0},OnAllKeyNamesLoaded(){return!0},OnError(){return!0},OnItemExists(b){return this._currentKey===b},OnItemMissing(b){return this._currentKey===b},CompareKey(b,a){return f.compare(this._currentKey,b,a)},CompareValue(b,a){return f.compare(this._lastValue,
b,a)},IsProcessingSets(){return 0<this._pendingSets},IsProcessingGets(){return 0<this._pendingGets},OnAllSetsComplete(){return!0},OnAllGetsComplete(){return!0}}}"use strict";
{const f=self.C3;function b(a){return"string"===typeof a||"number"===typeof a}f.Plugins.LocalStorage.Acts={async SetItem(a,d){this._pendingSets++;try{const c=await this._storage.setItem(a,d);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=c;await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,0===this._pendingSets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},
async SetBinaryItem(a,d){if(d&&(d=d.GetFirstPicked(this._inst))&&(d=d.GetSdkInstance())){d=d.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(a,d),await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,0===this._pendingSets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},
async GetItem(a){this._pendingGets++;try{const d=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=b(d)?d:"";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}},async GetBinaryItem(a,d){if(d&&(d=d.GetFirstPicked(this._inst))){var c=
d.GetSdkInstance();this._pendingGets++;try{let e=await this._storage.getItem(a);e=e instanceof ArrayBuffer?e:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=a;c.SetArrayBufferTransfer(e);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(e){await this._TriggerStorageError(e)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},
async CheckItemExists(a){try{const d=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;"undefined"===typeof d||null===d?(this._lastValue="",await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=b(d)?d:"",await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(d){await this._TriggerStorageError(d)}},async RemoveItem(a){try{await this._storage.removeItem(a),await this.ScheduleTriggers(async()=>{this._currentKey=
a;this._lastValue="";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(d){await this._TriggerStorageError(d)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";f.clearArray(this._keyNamesList);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnCleared)})}catch(a){await this._TriggerStorageError(a)}},async GetAllKeyNames(){try{const a=
await this._storage.keys();await this.ScheduleTriggers(async()=>{this._keyNamesList=a;await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllKeyNamesLoaded)})}catch(a){await this._TriggerStorageError(a)}}}}"use strict";self.C3.Plugins.LocalStorage.Exps={ItemValue(){return this._lastValue},Key(){return this._currentKey},KeyCount(){return this._keyNamesList.length},KeyAt(f){f=Math.floor(f);return 0>f||f>=this._keyNamesList.length?"":this._keyNamesList[f]},ErrorMessage(){return this._errorMessage}};
"use strict";{const f=self.C3;f.Plugins.Function=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Plugins.Function.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}"use strict";
{const f=self.C3;class b{constructor(){this.name="";this.retVal=0;this.params=[]}}f.Plugins.Function.Instance=class extends f.SDKInstanceBase{constructor(a,d){super(a);this._isPreview=this._runtime.IsPreview();this._funcStackPtr=-1;this._funcStack=[];a=(c,e)=>this._InvokeFromJS(c,e);self.c2_callFunction=a;self.c3_callFunction=a}Release(){super.Release()}Push(){const a=this._funcStack,d=++this._funcStackPtr;d===a.length&&a.push(new b);return a[d]}Pop(){--this._funcStackPtr}GetCurrent(){const a=this._funcStackPtr;
return 0>a?null:this._funcStack[a]}GetOneAbove(){const a=this._funcStack;return a.length?a[Math.min(this._funcStackPtr+1,a.length-1)]:null}_CallFunction(a,d){const c=this.Push();c.name=a.toLowerCase();c.retVal=0;f.shallowAssignArray(c.params,d);d=this.FastTrigger(f.Plugins.Function.Cnds.OnFunction,c.name);this._isPreview&&!d&&console.warn(`[Construct 3] Function object: called function '${a}' but no event was triggered. Is the function call spelt incorrectly or no longer used?`);this.Pop()}*_DebugCallFunction(a,
d){const c=this.Push();c.name=a.toLowerCase();c.retVal=0;f.shallowAssignArray(c.params,d);d=yield*this.DebugFastTrigger(f.Plugins.Function.Cnds.OnFunction,c.name);this._isPreview&&!d&&console.warn(`[Construct 3] Function object: called function '${a}' but no event was triggered. Is the function call spelt incorrectly or no longer used?`);this.Pop()}_InvokeFromJS(a,d){const c=this.Push();c.name=a.toLowerCase();c.retVal=0;c.params=(d||[]).map(e=>"number"===typeof e||"string"===typeof e?e:"boolean"===
typeof e?e?1:0:0);this.FastTrigger(f.Plugins.Function.Cnds.OnFunction,c.name);this.Pop();return c.retVal}}}"use strict";
{const f=self.C3;f.Plugins.Function.Cnds={OnFunction(b){return!0},CompareParam(b,a,d){const c=this.GetCurrent();if(!c)return this._isPreview&&console.warn("[Construct 3] Function object: used 'Compare parameter' condition when not in a function call"),!1;const e=c.params;b=Math.floor(b);let g=0;0>b||b>=e.length?this._isPreview&&console.warn(`[Construct 3] Function object: in function '${c.name}', compared parameter out of bounds (accessed index ${b} of ${e.length})`):g=e[b];return f.compare(g,a,d)}}}"use strict";
self.C3.Plugins.Function.Acts={CallFunction(f,b){if(this._runtime.IsDebugging())return this._DebugCallFunction(f,b);this._CallFunction(f,b)},SetReturnValue(f){const b=this.GetCurrent();b?b.retVal=f:this._isPreview&&console.warn("[Construct 3] Function object: used 'Set return value' when not in a function call")},CallExpression(f){}};"use strict";
{const f=self.C3;f.Plugins.Function.Exps={ReturnValue(){const b=this.GetOneAbove();return b?b.retVal:0},ParamCount(){const b=this.GetCurrent();if(b)return b.params.length;this._isPreview&&console.warn("[Construct 3] Function object: used 'ParamCount' expression when not in a function call");return 0},Param(b){b=Math.floor(b);const a=this.GetCurrent();if(a){const d=a.params;if(0<=b&&b<d.length)return d[b];this._isPreview&&console.warn(`[Construct 3] Function object: in function '${a.name}', accessed parameter out of bounds (accessed index ${b} of ${d.length})`);
return 0}this._isPreview&&console.warn("[Construct 3] Function object: used 'Param' expression when not in a function call");return 0},Call(b,...a){const d=this.Push();d.name=b.toLowerCase();d.retVal=0;d.params=a;a=this.FastTrigger(f.Plugins.Function.Cnds.OnFunction,d.name);this._isPreview&&!a&&console.warn(`[Construct 3] Function object: expression Function.Call("${b}" ...) was used, but no event was triggered. Is the function call spelt incorrectly or no longer used?`);this.Pop();return d.retVal}}}"use strict";
{const f=self.C3;f.Plugins.Keyboard=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Keyboard.Type=class extends f.SDKTypeBase{constructor(d){super(d)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let b=null;function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class extends self.IObjectClass{constructor(d){super(d);b=d;d.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(d){const c=a();if("string"===typeof d)return c.IsKeyDown(d);if("number"===typeof d)return c.IsKeyCodeDown(d);
throw new TypeError("expected string or number");}}}"use strict";
{const f=self.C3;f.Plugins.Keyboard.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b);this._keysDownByString=new Set;this._keysDownByWhich=new Set;this._triggerWhich=0;this._triggerTypedKey=this._triggerString="";b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"keydown",d=>this._OnKeyDown(d.data)),f.Disposable.From(b,"keyup",d=>this._OnKeyUp(d.data)),f.Disposable.From(b,"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnKeyDown(b){const a=
b.which,d=b.code||a.toString();b=b.key;this._keysDownByString.has(d)||(this._keysDownByString.add(d),this._keysDownByWhich.add(a),this._triggerString=d,this._triggerWhich=a,this._triggerTypedKey=b,this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKey),this.Trigger(f.Plugins.Keyboard.Cnds.OnKey),this.Trigger(f.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed),this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCode))}_OnKeyUp(b){const a=b.which,d=b.code||a.toString();b=b.key;this._keysDownByString.delete(d);this._keysDownByWhich.delete(a);
this._triggerString=d;this._triggerWhich=a;this._triggerTypedKey=b;this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowBlur(){for(const b of this._keysDownByWhich)this._keysDownByWhich.delete(b),this._triggerWhich=b,this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyReleased),
this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCodeReleased);this._keysDownByString.clear()}IsKeyDown(b){return this._keysDownByString.has(b)}IsKeyCodeDown(b){return this._keysDownByWhich.has(b)}SaveToJson(){return{tk:this._triggerWhich,tkk:this._triggerTypedKey}}LoadFromJson(b){this._triggerWhich=b.tk;b.hasOwnProperty("tkk")&&(this._triggerTypedKey=b.tkk)}GetDebuggerProperties(){return[{title:"plugins.keyboard.name",properties:[{name:"plugins.keyboard.debugger.last-key-code",value:this._triggerWhich},
{name:"plugins.keyboard.debugger.last-key-string",value:f.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:"plugins.keyboard.debugger.last-typed-key",value:this._triggerTypedKey}]}]}}}"use strict";
{const f="ShiftLeft ShiftRight ControlLeft ControlRight AltLeft AltRight MetaLeft MetaRight".split(" ");self.C3.Plugins.Keyboard.Cnds={IsKeyDown(b){return this._keysDownByWhich.has(b)},OnKey(b){return this._triggerWhich===b},OnAnyKey(){return!0},OnAnyKeyReleased(){return!0},OnKeyReleased(b){return this._triggerWhich===b},IsKeyCodeDown(b){b=Math.floor(b);return this._keysDownByWhich.has(b)},OnKeyCode(b){return this._triggerWhich===b},OnKeyCodeReleased(b){return this._triggerWhich===b},OnLeftRightKeyPressed(b){return this._triggerString===
f[b]},OnLeftRightKeyReleased(b){return this._triggerString===f[b]},IsLeftRightKeyDown(b){return this._keysDownByString.has(f[b])}}}"use strict";self.C3.Plugins.Keyboard.Acts={};"use strict";
{function f(b){b=Math.floor(b);switch(b){case 8:return"backspace";case 9:return"tab";case 13:return"enter";case 16:return"shift";case 17:return"control";case 18:return"alt";case 19:return"pause";case 20:return"capslock";case 27:return"esc";case 33:return"pageup";case 34:return"pagedown";case 35:return"end";case 36:return"home";case 37:return"\u2190";case 38:return"\u2191";case 39:return"\u2192";case 40:return"\u2193";case 45:return"insert";case 46:return"del";case 91:return"left window key";case 92:return"right window key";
case 93:return"select";case 96:return"numpad 0";case 97:return"numpad 1";case 98:return"numpad 2";case 99:return"numpad 3";case 100:return"numpad 4";case 101:return"numpad 5";case 102:return"numpad 6";case 103:return"numpad 7";case 104:return"numpad 8";case 105:return"numpad 9";case 106:return"numpad *";case 107:return"numpad +";case 109:return"numpad -";case 110:return"numpad .";case 111:return"numpad /";case 112:return"F1";case 113:return"F2";case 114:return"F3";case 115:return"F4";case 116:return"F5";
case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 144:return"numlock";case 145:return"scroll lock";case 186:return";";case 187:return"=";case 188:return",";case 189:return"-";case 190:return".";case 191:return"/";case 192:return"'";case 219:return"[";case 220:return"\\";case 221:return"]";case 222:return"#";case 223:return"`";default:return String.fromCharCode(b)}}self.C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},
StringFromKeyCode(b){return f(b)},TypedKey(){return this._triggerTypedKey}}}"use strict";{const f=self.C3;f.Plugins.Mouse=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Mouse.Type=class extends f.SDKTypeBase{constructor(d){super(d)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IMouseObjectType}};let b=null;function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.IMouseObjectType=class extends self.IObjectClass{constructor(d){super(d);b=d;d.GetRuntime()._GetCommonScriptInterfaces().mouse=this}getMouseX(d){return a().GetMousePositionForLayer(d)[0]}getMouseY(d){return a().GetMousePositionForLayer(d)[1]}getMousePosition(d){return a().GetMousePositionForLayer(d)}isMouseButtonDown(d){return a().IsMouseButtonDown(d)}}}"use strict";
{const f=self.C3;f.Plugins.Mouse.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b,"mouse");this._buttonMap=[!1,!1,!1];this._triggerDir=this._triggerType=this._triggerButton=this._mouseYcanvas=this._mouseXcanvas=0;b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"pointermove",d=>this._OnPointerMove(d.data)),f.Disposable.From(b,"pointerdown",d=>this._OnPointerDown(d.data)),f.Disposable.From(b,"pointerup",d=>this._OnPointerUp(d.data)),
f.Disposable.From(b,"dblclick",d=>this._OnDoubleClick(d.data)),f.Disposable.From(b,"wheel",d=>this._OnMouseWheel(d.data)),f.Disposable.From(b,"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnPointerDown(b){"mouse"===b.pointerType&&(this._mouseXcanvas=b.pageX-this._runtime.GetCanvasClientX(),this._mouseYcanvas=b.pageY-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(b.lastButtons,b.buttons))}_OnPointerMove(b){"mouse"===b.pointerType&&(this._mouseXcanvas=b.pageX-this._runtime.GetCanvasClientX(),
this._mouseYcanvas=b.pageY-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(b.lastButtons,b.buttons))}_OnPointerUp(b){"mouse"===b.pointerType&&this._CheckButtonChanges(b.lastButtons,b.buttons)}_CheckButtonChanges(b,a){this._CheckButtonChange(b,a,1,0);this._CheckButtonChange(b,a,4,1);this._CheckButtonChange(b,a,2,2)}_CheckButtonChange(b,a,d,c){!(b&d)&&a&d?this._OnMouseDown(c):b&d&&!(a&d)&&this._OnMouseUp(c)}_OnMouseDown(b){this._buttonMap[b]=!0;this.Trigger(f.Plugins.Mouse.Cnds.OnAnyClick);
this._triggerButton=b;this._triggerType=0;this.Trigger(f.Plugins.Mouse.Cnds.OnClick);this.Trigger(f.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseUp(b){this._buttonMap[b]&&(this._buttonMap[b]=!1,this._triggerButton=b,this.Trigger(f.Plugins.Mouse.Cnds.OnRelease))}_OnDoubleClick(b){this._triggerButton=b.button;this._triggerType=1;this.Trigger(f.Plugins.Mouse.Cnds.OnClick);this.Trigger(f.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseWheel(b){this._triggerDir=0>b.deltaY?1:0;this.Trigger(f.Plugins.Mouse.Cnds.OnWheel)}_OnWindowBlur(){for(let b=
0,a=this._buttonMap.length;b<a&&this._buttonMap[b];++b)this._buttonMap[b]=!1,this._triggerButton=b,this.Trigger(f.Plugins.Mouse.Cnds.OnRelease)}GetMousePositionForLayer(b){const a=this._runtime.GetMainRunningLayout(),d=this._mouseXcanvas,c=this._mouseYcanvas;return"undefined"===typeof b?a.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(d,c):(b=a.GetLayer(b))?b.CanvasCssToLayer(d,c):[0,0]}IsMouseButtonDown(b){b=Math.floor(b);return!!this._buttonMap[b]}_IsMouseOverCanvas(){return 0<=this._mouseXcanvas&&
0<=this._mouseYcanvas&&this._mouseXcanvas<this._runtime.GetCanvasCssWidth()&&this._mouseYcanvas<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.mouse.name",properties:[{name:"plugins.mouse.debugger.absolute-position",value:this._mouseXcanvas+","+this._mouseYcanvas},{name:"plugins.mouse.debugger.left-button",value:this._buttonMap[0]},{name:"plugins.mouse.debugger.middle-button",value:this._buttonMap[1]},{name:"plugins.mouse.debugger.right-button",value:this._buttonMap[2]}]},
{title:"plugins.mouse.debugger.position-on-each-layer",properties:this._runtime.GetMainRunningLayout().GetLayers().map(b=>({name:"$"+b.GetName(),value:b.CanvasCssToLayer(this._mouseXcanvas,this._mouseYcanvas).join(", ")}))}]}}}"use strict";
{const f=self.C3;f.Plugins.Mouse.Cnds={OnClick(b,a){return this._triggerButton===b&&this._triggerType===a},OnAnyClick(){return!0},IsButtonDown(b){return this._buttonMap[b]},OnRelease(b){return this._triggerButton===b},IsOverObject(b){if(!this._IsMouseOverCanvas())return!1;const a=this._runtime.GetCurrentCondition().IsInverted(),d=this._mouseXcanvas,c=this._mouseYcanvas;return f.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,d,c,a),a)},OnObjectClicked(b,a,d){if(b!==this._triggerButton||
a!==this._triggerType||!this._IsMouseOverCanvas())return!1;b=this._mouseXcanvas;a=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(d,b,a,!1)},OnWheel(b){return this._triggerDir===b}}}"use strict";
{const f=self.C3;let b=null;const a="auto pointer text crosshair move help wait none".split(" ");f.Plugins.Mouse.Acts={SetCursor(d){d=a[d];b!==d&&(b=d,this.PostToDOM("cursor",d))},SetCursorSprite(d){if(!f.Platform.IsMobile&&d&&(d=d.GetFirstPicked())){var c=d.GetWorldInfo(),e=d.GetCurrentImageInfo();c&&e&&b!==e&&(b=e,e.ExtractImageToCanvas().then(g=>f.CanvasToBlob(g)).then(g=>{g=`url(${URL.createObjectURL(g)}) ${Math.round(c.GetOriginX()*e.GetWidth())} ${Math.round(c.GetOriginY()*e.GetHeight())}, auto`;
this.PostToDOM("cursor","");this.PostToDOM("cursor",g)}))}}}}"use strict";self.C3.Plugins.Mouse.Exps={X(f){return this.GetMousePositionForLayer(f)[0]},Y(f){return this.GetMousePositionForLayer(f)[1]},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas}};"use strict";{const f=self.C3;f.Plugins.NodeWebkit=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Plugins.NodeWebkit.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}"use strict";
{const f=self.C3,b=new Map([["EACCES","access denied"],["EEXIST","file exists"],["EISDIR","is a directory"],["EMFILE","too many open files"],["ENOENT","no such file or directory"],["ENOTDIR","not a directory"],["ENOTEMPTY","directory not empty"],["EPERM","operation not permitted"]]);f.Plugins.NodeWebkit.Instance=class extends f.SDKInstanceBase{constructor(a,d){super(a,"nwjs");this._isNWjs="nwjs"===this._runtime.GetExportType()||this._runtime.IsPreview()&&/nwjs\//i.test(navigator.userAgent);this._os=
this._process=this._childProcess=this._fs=this._path=null;this._projectFilesFolder=this._userFolder=this._appFolder=this._fileError=this._currentTag="";this._slash="\\";this._fileList=[];this._chosenPath=this._droppedFile="";this._argv=[];this._windowTitle=this._clipboardText="";this._windowHeight=this._windowWidth=this._windowY=this._windowX=0;this._isNWjs&&this._InitNWjs()}_InitNWjs(){this._path=require("path");this._fs=require("fs");this._childProcess=require("child_process");this._process=self.process||
nw.process;this._os=require("os");"win32"!==this._process.platform&&(this._slash="/");this._appFolder=this._path.dirname(this._process.execPath)+this._slash;this._userFolder=this._os.homedir()+this._slash;this._projectFilesFolder=this._process.mainModule.filename;const a=Math.max(this._projectFilesFolder.lastIndexOf("/"),this._projectFilesFolder.lastIndexOf("\\"));-1!==a&&(this._projectFilesFolder=this._projectFilesFolder.substr(0,a+1));this.AddDOMMessageHandlers([["drop",d=>this._OnDrop(d)],["open-dlg",
d=>this._OnOpenDlg(d)],["open-dlg-cancel",()=>this._OnOpenDlgCancel()],["folder-dlg",d=>this._OnFolderDlg(d)],["folder-dlg-cancel",()=>this._OnFolderDlgCancel()],["save-dlg",d=>this._OnSaveDlg(d)],["save-dlg-cancel",()=>this._OnSaveDlgCancel()],["window-change",d=>this._OnWindowChange(d)],["clipboard-change",d=>this._OnClipboardChange(d)]]);this._runtime.AddLoadPromise(this.PostToDOMAsync("init").then(d=>{this._OnWindowChange(d);this._OnClipboardChange(d);this._argv=d.argv}))}Release(){super.Release()}_OnWindowChange(a){this._windowTitle=
a["window-title"];this._windowX=a["window-x"];this._windowY=a["window-y"];this._windowWidth=a["window-width"];this._windowHeight=a["window-height"]}_OnClipboardChange(a){this._clipboardText=a["clipboard-text"]}_BufferToArrayBuffer(a){const d=a.buffer,c=a.byteLength,e=a.byteOffset;return d.byteLength!==a.length?d.slice(e,e+c):d}_GetBinaryDataSdkInstance(a){return a?(a=a.GetFirstPicked(this._inst))?a.GetSdkInstance():null:null}_ReadBinaryFile(a){return new Promise((d,c)=>{this._fs.readFile(a,{},(e,
g)=>{e?c(e):d(this._BufferToArrayBuffer(g))})})}_WriteBinaryFile(a,d){f.WeakRequireInstanceOf(d,ArrayBuffer);const c=new Uint8Array(d);return new Promise((e,g)=>{this._fs.writeFile(a,c,{},k=>{k?g(k):e()})})}_GetFileError(a){return a&&"string"===typeof a.code?b.get(a.code)||a.code:"unknown error"}_OnFileSystemError(a){this._fileError=this._GetFileError(a);this.Trigger(f.Plugins.NodeWebkit.Cnds.OnFileSystemError);this._fileError=""}async _OnDrop(a){a=a.filePaths;for(const d of a)this._droppedFile=d,
await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnFileDrop);this._droppedFile=""}async _OnOpenDlg(a){this._chosenPath=a.chosenPath;await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnOpenDlg)}async _OnOpenDlgCancel(){await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnOpenDlgCancel)}async _OnFolderDlg(a){this._chosenPath=a.chosenPath;await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnFolderDlg)}async _OnFolderDlgCancel(){await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnFolderDlgCancel)}async _OnSaveDlg(a){this._chosenPath=
a.chosenPath;await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnSaveDlg)}async _OnSaveDlgCancel(){await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnSaveDlgCancel)}GetDebuggerProperties(){return[{title:"plugins.nodewebkit.name",properties:[{name:"plugins.nodewebkit.debugger.app-folder",value:this._appFolder},{name:"plugins.nodewebkit.debugger.user-folder",value:this._userFolder},{name:"plugins.nodewebkit.debugger.project-files-folder",value:this._projectFilesFolder}]}]}}}"use strict";
self.C3.Plugins.NodeWebkit.Cnds={PathExists(f){return this._isNWjs?this._fs.existsSync(f):!1},OnBinaryFileRead(f){return this._currentTag===f},OnBinaryFileWritten(f){return this._currentTag===f},OnFileSystemError(){return!0},OnFileDrop(){return!0},OnOpenDlg(){return!0},OnFolderDlg(){return!0},OnSaveDlg(){return!0},OnOpenDlgCancel(){return!0},OnFolderDlgCancel(){return!0},OnSaveDlgCancel(){return!0}};"use strict";
{const f=self.C3;function b(a,d,c){"function"===typeof a.copyfileSync?a.copyfileSync(d,c):(d=a.readFileSync(d,{flags:"rb"}),a.writeFileSync(c,d,{flags:"wb"}))}f.Plugins.NodeWebkit.Acts={WriteTextFile(a,d){if(this._isNWjs)try{this._fs.writeFileSync(a,d,{encoding:"utf8"})}catch(c){console.error(`Error writing text file '${a}': `,c),this._OnFileSystemError(c)}},async ReadBinaryFile(a,d,c){c=this._GetBinaryDataSdkInstance(c);if(this._isNWjs&&c)try{const e=await this._ReadBinaryFile(d);c.SetArrayBufferTransfer(e);
this._currentTag=a;await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnBinaryFileRead);this._currentTag=""}catch(e){console.error(`Error reading binary file '${d}': `,e),this._OnFileSystemError(e)}},async WriteBinaryFile(a,d,c){c=this._GetBinaryDataSdkInstance(c);if(this._isNWjs&&c)try{const e=c.GetArrayBufferReadOnly();await this._WriteBinaryFile(d,e);this._currentTag=a;await this.TriggerAsync(f.Plugins.NodeWebkit.Cnds.OnBinaryFileWritten);this._currentTag=""}catch(e){console.error(`Error writing binary file '${d}': `,
e),this._OnFileSystemError(e)}},RenameFile(a,d){if(this._isNWjs)try{this._fs.renameSync(a,d)}catch(c){console.error(`Error renaming file '${a}': `,c),this._OnFileSystemError(c)}},DeleteFile(a){if(this._isNWjs)try{this._fs.unlinkSync(a)}catch(d){"ENOENT"!==d.code&&(console.error(`Error deleting file '${a}': `,d),this._OnFileSystemError(d))}},CopyFile(a,d){if(this._isNWjs)try{b(this._fs,a,d)}catch(c){console.error(`Error copying file '${a}': `,c),this._OnFileSystemError(c)}},MoveFile(a,d){if(this._isNWjs&&
a!==d)try{b(this._fs,a,d),this._fs.existsSync(d)&&this._fs.unlinkSync(a)}catch(c){console.error(`Error moving file '${a}': `,c),this._OnFileSystemError(c)}},RunFile(a){this._isNWjs&&this._childProcess.exec(a,()=>{})},ShellOpen(a){this._isNWjs&&this.PostToDOM("shell-cmd",{method:"openItem",arg:a})},OpenBrowser(a){this._isNWjs&&this.PostToDOM("shell-cmd",{method:"openExternal",arg:a})},CreateFolder(a){if(this._isNWjs)try{this._fs.mkdirSync(a)}catch(d){console.error(`Error creating folder '${a}': `,
d),this._OnFileSystemError(d)}},AppendFile(a,d){if(this._isNWjs)try{this._fs.appendFileSync(a,d,{encoding:"utf8"})}catch(c){console.error(`Error appending to file '${a}': `,c),this._OnFileSystemError(c)}},ListFiles(a){if(this._isNWjs)try{this._fileList=this._fs.readdirSync(a)}catch(d){this._fileList=[],console.error(`Error listing files at '${a}': `,d),this._OnFileSystemError(d)}},ShowOpenDlg(a){this._isNWjs&&this.PostToDOM("show-open-dlg",{accept:a})},ShowFolderDlg(){this._isNWjs&&this.PostToDOM("show-folder-dlg")},
ShowSaveDlg(a){this._isNWjs&&this.PostToDOM("show-save-dlg",{accept:a})},SetWindowX(a){this._isNWjs&&this.PostToDOM("set-window-x",{x:a})},SetWindowY(a){this._isNWjs&&this.PostToDOM("set-window-y",{y:a})},SetWindowWidth(a){this._isNWjs&&this.PostToDOM("set-window-width",{width:a})},SetWindowHeight(a){this._isNWjs&&this.PostToDOM("set-window-height",{height:a})},SetWindowTitle(a){this._isNWjs&&(this._windowTitle=a,this.PostToDOM("set-title",{title:a}))},WindowMinimize(){this._isNWjs&&this.PostToDOM("window-cmd",
{method:"minimize"})},WindowMaximize(){this._isNWjs&&this.PostToDOM("window-cmd",{method:"maximize"})},WindowUnmaximize(){this._isNWjs&&this.PostToDOM("window-cmd",{method:"unmaximize"})},WindowRestore(){this._isNWjs&&this.PostToDOM("window-cmd",{method:"restore"})},WindowRequestAttention(a){this._isNWjs&&this.PostToDOM("window-attention",{request:a?3:0})},WindowSetMaxSize(a,d){this._isNWjs&&this.PostToDOM("set-window-max-size",{width:a,height:d})},WindowSetMinSize(a,d){this._isNWjs&&this.PostToDOM("set-window-min-size",
{width:a,height:d})},WindowSetResizable(a){this._isNWjs&&this.PostToDOM("set-window-resizable",{resizable:0!==a})},WindowSetAlwaysOnTop(a){this._isNWjs&&this.PostToDOM("set-window-always-top",{top:0!==a})},ShowDevTools(){this._isNWjs&&this.PostToDOM("window-cmd",{method:"showDevTools"})},SetClipboardText(a){this._isNWjs&&(this._clipboardText=a,this.PostToDOM("set-clipboard",{text:a}))},ClearClipboard(){this._isNWjs&&(this._clipboardText="",this.PostToDOM("clear-clipboard"))}}}"use strict";
self.C3.Plugins.NodeWebkit.Exps={AppFolder(){return this._appFolder},AppFolderURL(){return"file://"+this._appFolder},ProjectFilesFolder(){return this._projectFilesFolder},ProjectFilesFolderURL(){return"file://"+this._projectFilesFolder},UserFolder(){return this._userFolder},ReadFile(f){if(!this._isNWjs)return"";let b="";try{b=this._fs.readFileSync(f,{encoding:"utf8"})}catch(a){console.error(`Failed to read file '${f}': `,a),this._OnFileSystemError(a)}return b},FileSize(f){if(!this._isNWjs)return 0;
let b=0;try{const a=this._fs.statSync(f);a&&(b=a.size||0)}catch(a){console.error(`Failed to read file '${f}' size: `,a),this._OnFileSystemError(a)}return b},ListCount(){return this._fileList.length},ListAt(f){f=Math.floor(f);return 0>f||f>=this._fileList.length?"":this._fileList[f]},DroppedFile(){return this._droppedFile},ChosenPath(){return this._chosenPath},WindowX(){return this._windowX},WindowY(){return this._windowY},WindowWidth(){return this._windowWidth},WindowHeight(){return this._windowHeight},
WindowTitle(){return this._windowTitle},ClipboardText(){return this._isNWjs?this._clipboardText:""},ArgumentCount(){return this._isNWjs?this._argv.length:0},ArgumentAt(f){if(!this._isNWjs)return"";f=Math.floor(f);const b=this._argv;return 0>f||f>=b.length?"":b[f]},FileError(){return this._fileError}};"use strict";{const f=self.C3;f.Plugins.Text=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Plugins.Text.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}LoadTextures(b){}ReleaseTextures(){}}}"use strict";
{const f=self.C3,b=[0,0,0],a=["left","center","right"],d=["top","center","bottom"],c=new f.Rect,e=new f.Quad;f.Plugins.Text.Instance=class extends f.SDKWorldInstanceBase{constructor(n,u){super(n);this._text="";this._enableBBcode=!0;this._faceName="Arial";this._ptSize=12;this._lineHeightOffset=0;this._isItalic=this._isBold=!1;this._color=f.New(f.Color);this._verticalAlign=this._horizontalAlign=0;this._wrapByWord=!0;this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._rendererText=
f.New(f.Gfx.RendererText,this._runtime.GetWebGLRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(!1);u&&(this._text=u[0],this._enableBBcode=!!u[1],this._faceName=u[2],this._ptSize=u[3],this._lineHeightOffset=u[4],this._isBold=!!u[5],this._isItalic=!!u[6],this._horizontalAlign=u[8],this._verticalAlign=u[9],this._wrapByWord=0===u[10],n=u[7],this._color.setRgb(n[0],n[1],n[2]),this.GetWorldInfo().SetVisible(u[11]));this._UpdateTextSettings()}Release(){this._CancelTypewriter();
this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const n=this._rendererText;n.SetText(this._text);n.SetBBCodeEnabled(this._enableBBcode);n.SetFontName(this._faceName);n.SetLineHeight(this._lineHeightOffset);n.SetBold(this._isBold);n.SetItalic(this._isItalic);n.SetColor(this._color);n.SetHorizontalAlignment(a[this._horizontalAlign]);n.SetVerticalAlignment(d[this._verticalAlign]);n.SetWordWrapMode(this._wrapByWord?"word":"character")}_UpdateTextSize(){const n=
this.GetWorldInfo();this._rendererText.SetFontSize(this._ptSize*n.GetSceneGraphScale());var u=n.GetLayer();u=u.GetRenderScale()*u.Get2DScaleFactorToZ(n.GetTotalZElevation());this._rendererText.SetSize(n.GetWidth(),n.GetHeight(),u)}Draw(n){var u=this.GetWorldInfo();this._UpdateTextSize();const q=this._rendererText.GetTexture();if(q){var r=u.GetLayer(),t=u.GetBoundingQuad();if(0===u.GetAngle()&&0===u.GetLayer().GetAngle()&&0===u.GetTotalZElevation()){const [x,z]=r.LayerToDrawSurface(t.getTlx(),t.getTly()),
[D,G]=r.LayerToDrawSurface(t.getBrx(),t.getBry());t=x-Math.round(x);u=z-Math.round(z);c.set(x,z,D,G);c.offset(-t,-u);e.setFromRect(c);const [w,B]=n.GetRenderTargetSize(n.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(n,w,B);n.SetTexture(q);n.Quad3(e,this._rendererText.GetTexRect());r._SetTransform(n)}else{u=r=0;this._runtime.IsPixelRoundingEnabled()&&(r=t.getTlx()-Math.round(t.getTlx()),u=t.getTly()-Math.round(t.getTly()));if(0!==r||0!==u)e.copy(t),e.offset(-r,-u),t=e;n.SetTexture(q);
n.Quad3(t,this._rendererText.GetTexRect())}}}SaveToJson(){const n={t:this._text,c:this._color.toJSON(),fn:this._faceName,ps:this._ptSize};this._enableBBcode&&(n.bbc=this._enableBBcode);0!==this._horizontalAlign&&(n.ha=this._horizontalAlign);0!==this._verticalAlign&&(n.va=this._verticalAlign);this._wrapByWord||(n.wr=this._wrapByWord);0!==this._lineHeightOffset&&(n.lho=this._lineHeightOffset);this._isBold&&(n.b=this._isBold);this._isItalic&&(n.i=this._isItalic);-1!==this._typewriterEndTime&&(n.tw={st:this._typewriterStartTime,
en:this._typewriterEndTime,l:this._typewriterLength});return n}LoadFromJson(n){this._CancelTypewriter();this._text=n.t;this._color.setFromJSON(n.c);this._faceName=n.fn;this._ptSize=n.ps;this._enableBBcode=n.hasOwnProperty("bbc")?n.bbc:!1;this._horizontalAlign=n.hasOwnProperty("ha")?n.ha:0;this._verticalAlign=n.hasOwnProperty("va")?n.va:0;this._wrapByWord=n.hasOwnProperty("wr")?n.wr:!0;this._lineHeightOffset=n.hasOwnProperty("lho")?n.lho:0;this._isBold=n.hasOwnProperty("b")?n.b:!1;this._isItalic=n.hasOwnProperty("i")?
n.i:!1;n.hasOwnProperty("tw")&&(n=n.tw,this._typewriterStartTime=n.st,this._typewriterEndTime=n.en,this._typewriterLength=n.l);this._UpdateTextSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(n){switch(n){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._faceName;case 3:return this._ptSize;case 4:return this._lineHeightOffset;case 5:return this._isBold;case 6:return this._isItalic;case 7:return b[0]=this._color.getR(),b[1]=this._color.getG(),
b[2]=this._color.getB(),b;case 8:return this._horizontalAlign;case 9:return this._verticalAlign;case 10:return this._wrapByWord?1:0}}SetPropertyValueByIndex(n,u){switch(n){case 0:if(this._text===u)break;this._text=u;this._UpdateTextSettings();break;case 1:if(this._enableBBcode===!!u)break;this._enableBBcode=!!u;this._UpdateTextSettings();break;case 2:if(this._faceName===u)break;this._faceName=u;this._UpdateTextSettings();break;case 3:if(this._ptSize===u)break;this._ptSize=u;this._UpdateTextSettings();
break;case 4:if(this._lineHeightOffset===u)break;this._lineHeightOffset=u;this._UpdateTextSettings();break;case 5:if(this._isBold===!!u)break;this._isBold=!!u;this._UpdateTextSettings();break;case 6:if(this._isItalic===!!u)break;this._isItalic=!!u;this._UpdateTextSettings();break;case 7:n=this._color;if(n.getR()===u[0]&&n.getG()===u[1]&&n.getB()===u[2])break;this._color.setRgb(u[0],u[1],u[2]);this._UpdateTextSettings();break;case 8:if(this._horizontalAlign===u)break;this._horizontalAlign=u;this._UpdateTextSettings();
break;case 9:if(this._verticalAlign===u)break;this._verticalAlign=u;this._UpdateTextSettings();break;case 10:this._wrapByWord!==(0===u)&&(this._wrapByWord=0===u,this._UpdateTextSettings())}}SetPropertyColorOffsetValueByIndex(n,u,q,r){if(0!==u||0!==q||0!==r)switch(n){case 7:this._color.addRgb(u,q,r),this._UpdateTextSettings()}}_SetText(n){this._text!==n&&(this._text=n,this._rendererText.SetText(n),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(n,u){this._SetText(n);this._typewriterStartTime=
this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+u/this.GetInstance().GetActiveTimeScale();this._typewriterLength=f.BBString.StripAnyTags(n).length;this._rendererText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._rendererText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(f.Plugins.Text.Cnds.OnTypewriterTextFinished),
this._runtime.UpdateRender())}_SetFontFace(n){this._faceName!==n&&(this._faceName=n,this._rendererText.SetFontName(n),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(n){n=!!n;this._isBold!==n&&(this._isBold=n,this._rendererText.SetBold(n),this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(n){n=!!n;this._isItalic!==n&&(this._isItalic=n,this._rendererText.SetItalic(n),this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(n){this._ptSize!==
n&&(this._ptSize=n,this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetLineHeight(n){this._lineHeightOffset!==n&&(this._lineHeightOffset=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(n){this._horizontalAlign!==n&&(this._horizontalAlign=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(n){this._verticalAlign!==n&&(this._verticalAlign=n,this._UpdateTextSettings(),
this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(n){n=!!n;this._wrapByWord!==n&&(this._wrapByWord=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){var n=this._runtime.GetWallTime();n>=this._typewriterEndTime?(this._CancelTypewriter(),this.Trigger(f.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(n=f.relerp(this._typewriterStartTime,this._typewriterEndTime,n,0,this._typewriterLength),
n=Math.floor(n),n!==this._rendererText.GetDrawMaxCharacterCount()&&(this._rendererText.SetDrawMaxCharacterCount(n),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.text.name",properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:n=>this._SetText(n)}]}]}GetScriptInterfaceClass(){return self.ITextInstance}};const g=new WeakMap,k=new Map([["left",0],["center",1],["right",2]]),m=new Map([["top",0],["center",1],["bottom",2]]),p=new Map([["word",!0],
["character",!1]]);self.ITextInstance=class extends self.IWorldInstance{constructor(){super();g.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return g.get(this).GetText()}set text(n){const u=g.get(this);u._CancelTypewriter();u._SetText(n)}typewriterText(n,u){const q=g.get(this);q._CancelTypewriter();q._StartTypewriter(n,u)}typewriterFinish(){g.get(this)._FinishTypewriter()}set fontFace(n){g.get(this)._SetFontFace(n)}get fontFace(){return g.get(this)._GetFontFace()}set isBold(n){g.get(this)._SetBold(n)}get isBold(){return g.get(this)._IsBold()}set isItalic(n){g.get(this)._SetItalic(n)}get isItalic(){return g.get(this)._IsItalic()}set sizePt(n){g.get(this)._SetFontSize(n)}get sizePt(){return g.get(this)._GetFontSize()}set lineHeight(n){g.get(this)._SetLineHeight(n)}get lineHeight(){return g.get(this)._GetLineHeight()}set horizontalAlign(n){n=
k.get(n);if("undefined"===typeof n)throw Error("invalid mode");g.get(this)._SetHAlign(n)}get horizontalAlign(){return a[g.get(this)._GetHAlign()]}set verticalAlign(n){n=m.get(n);if("undefined"===typeof n)throw Error("invalid mode");g.get(this)._SetVAlign(n)}get verticalAlign(){return d[g.get(this)._GetVAlign()]}set wordWrapMode(n){n=p.get(n);if("undefined"===typeof n)throw Error("invalid mode");g.get(this)._SetWrapByWord(n)}get wordWrapMode(){return g.get(this)._IsWrapByWord()?"word":"character"}}}"use strict";
{const f=self.C3;f.Plugins.Text.Cnds={CompareText(b,a){return a?this._text===b:f.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}"use strict";
{const f=self.C3,b=f.New(f.Color);f.Plugins.Text.Acts={SetText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._SetText(a.toString())},AppendText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);(a=a.toString())&&this._SetText(this._text+a)},TypewriterText(a,d){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._StartTypewriter(a.toString(),d)},SetFontFace(a,d){let c=!1,e=!1;switch(d){case 1:c=
!0;break;case 2:e=!0;break;case 3:e=c=!0}if(a!==this._faceName||c!==this._isBold||e!==this._isItalic)this._SetFontFace(a),this._SetBold(c),this._SetItalic(e)},SetFontSize(a){this._SetFontSize(a)},SetFontColor(a){b.setFromRgbValue(a);b.clamp();this._color.equalsIgnoringAlpha(b)||(this._color.copyRgb(b),this._rendererText.SetColor(this._color),this._runtime.UpdateRender())},SetWebFont(a,d){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);
this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()},SetLineHeight(a){this._SetLineHeight(a)},SetHAlign(a){this._SetHAlign(a)},SetVAlign(a){this._SetVAlign(a)},SetWrapping(a){this._SetWrapByWord(0===a)}}}"use strict";
{const f=self.C3;f.Plugins.Text.Exps={Text(){return this._text},PlainText(){return this._enableBBcode?f.BBString.StripAnyTags(this._text):this._text},FaceName(){return this._faceName},FaceSize(){return this._ptSize},TextWidth(){this._UpdateTextSize();return this._rendererText.GetTextWidth()},TextHeight(){this._UpdateTextSize();return this._rendererText.GetTextHeight()},LineHeight(){return this._lineHeightOffset}}}"use strict";{const f=self.C3;f.Plugins.Sprite=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Sprite.Type=class extends f.SDKTypeBase{constructor(b){super(b);this._animations=b.GetAnimations()}Release(){f.clearArray(this._animations);super.Release()}OnCreate(){for(const b of this._animations)b.LoadAllAssets(this._runtime)}LoadTextures(b){const a={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(d=>d.LoadAllTextures(b,a)))}ReleaseTextures(){for(const b of this._animations)b.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const b of this._objectClass.instancesIncludingPendingCreate())b.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(b){f.Plugins.Sprite._FinishCondition(this,
b)}}}"use strict";
{const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad),d=f.New(f.Vector2);f.Plugins.Sprite.Instance=class extends f.SDKWorldInstanceBase{constructor(g,k){super(g);let m=!0,p="",n=0,u=!0;k&&(m=!!k[0],p=k[1],n=k[2],u=k[3]);this._currentAnimation=this._objectClass.GetAnimationByName(p)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=f.clamp(n,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);k=this._currentAnimationFrame.GetImageInfo();
this._currentTexture=k.GetTexture();this._currentRcTex=k.GetTexRect();this.HandleWebGLContextLoss();g.SetFlag(2,!0);g.SetFlag(1,0<=this._currentAnimation.GetSpeed());this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo();this._animationTimer=f.New(f.KahanSum);this._animationRepeats=this._frameStartTime=0;this._animTriggerName="";this._changeAnimFrameIndex=-1;this._changeAnimationName="";this._changeAnimationFrom=
0;g=this.GetWorldInfo();this._bquadRef=g.GetBoundingQuad();g.SetVisible(m);g.SetCollisionEnabled(u);g.SetOriginX(this._currentAnimationFrame.GetOriginX());g.SetOriginY(this._currentAnimationFrame.GetOriginY());g.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly());g.SetBboxChanged();1===this._objectClass.GetAnimationCount()&&1===this._objectClass.GetAnimations()[0].GetFrameCount()||0===this._currentAnimationSpeed||this._StartTicking()}Release(){this._animationTimer=this._currentTexture=
this._currentAnimationFrame=this._currentAnimation=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(g){var k=this._currentTexture;null!==k&&(g.SetTexture(k),k=this.GetWorldInfo(),k.HasMesh()?this._DrawMesh(k,g):this._DrawStandard(k,g))}_DrawStandard(g,k){let m=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));k.Quad3(m,this._currentRcTex)}_DrawMesh(g,
k){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(b,a,!1);let p=a;this._runtime.IsPixelRoundingEnabled()&&(p=g.PixelRoundQuad(p));m.CalculateTransformedMesh(g.GetSourceMesh(),p,this._currentRcTex);g.SetMeshChanged(!1)}m.Draw(k)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(2)}SetAnimationPlaying(g){this._inst.SetFlag(2,g)}IsPlayingForwards(){return this._inst.GetFlag(1)}SetPlayingForwards(g){this._inst.SetFlag(1,g)}IsInAnimationTrigger(){return this._inst.GetFlag(4)}SetInAnimationTrigger(g){this._inst.SetFlag(4,
g)}Tick(){this._changeAnimationName&&this._DoChangeAnimation();0<=this._changeAnimFrameIndex&&this._DoChangeAnimFrame();const g=this._currentAnimationSpeed;if(this.IsAnimationPlaying()&&0!==g){var k=this._runtime.GetDt(this._inst);this._animationTimer.Add(k);k=this.GetAnimationTime();var m=this._currentAnimationFrame,p=m.GetDuration()/g;if(!(k<this._frameStartTime+p)){var n=this._currentAnimation,u=this._currentAnimationRepeatTo,q=n.GetFrameCount(),r=n.GetRepeatCount(),t=n.IsLooping(),x=n.IsPingPong();
this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=p;this._currentFrameIndex>=q&&(x?(this.SetPlayingForwards(!1),this._currentFrameIndex=q-2):t?this._currentFrameIndex=u:(this._animationRepeats++,this._animationRepeats>=r?this._FinishAnimation(!1):this._currentFrameIndex=u));0>this._currentFrameIndex&&(x?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),t||(this._animationRepeats++,this._animationRepeats>=r&&this._FinishAnimation(!0))):t?this._currentFrameIndex=
u:(this._animationRepeats++,this._animationRepeats>=r?this._FinishAnimation(!0):this._currentFrameIndex=u));this._currentFrameIndex=f.clamp(this._currentFrameIndex,0,q-1);p=n.GetFrameAt(this._currentFrameIndex);k>this._frameStartTime+p.GetDuration()/g&&(this._frameStartTime=k);this._OnFrameChanged(m,p)}}else this._StopTicking()}_FinishAnimation(g){this._currentFrameIndex=g?0:this._currentAnimation.GetFrameCount()-1;this.SetAnimationPlaying(!1);this._animTriggerName=this._currentAnimation.GetName();
this.SetInAnimationTrigger(!0);this.Trigger(f.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(f.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(g,k){if(g!==k){var m=this.GetWorldInfo(),p=g.GetImageInfo(),n=k.GetImageInfo(),u=p.GetWidth();p=p.GetHeight();var q=n.GetWidth(),r=n.GetHeight();u!==q&&m.SetWidth(m.GetWidth()*(q/u));p!==r&&m.SetHeight(m.GetHeight()*(r/p));m.SetOriginX(k.GetOriginX());m.SetOriginY(k.GetOriginY());m.SetSourceCollisionPoly(k.GetCollisionPoly());
m.SetBboxChanged();this._currentAnimationFrame=k;this._currentTexture=n.GetTexture();this._currentRcTex=n.GetTexRect();m=this.GetInstance().GetBehaviorInstances();for(let t=0,x=m.length;t<x;++t)m[t].OnSpriteFrameChanged(g,k);this.Trigger(f.Plugins.Sprite.Cnds.OnFrameChanged);this._runtime.UpdateRender()}}_StartAnim(g){this.SetAnimationPlaying(!0);this._frameStartTime=this.GetAnimationTime();1===g&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,this.IsInAnimationTrigger()||this._DoChangeAnimFrame());
this._StartTicking()}_SetAnim(g,k){this._changeAnimationName=g;this._changeAnimationFrom=k;this._StartTicking();this.IsInAnimationTrigger()||this._DoChangeAnimation()}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(g){isFinite(g)&&(this._changeAnimFrameIndex=g,this.IsInAnimationTrigger()||this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(g){this._currentAnimationSpeed=Math.abs(g);
this.SetPlayingForwards(0<=g);0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(g){this._currentAnimationRepeatTo=g=f.clamp(Math.floor(g),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const g=this._currentAnimationFrame;var k=this._objectClass.GetAnimationByName(this._changeAnimationName);this._changeAnimationName=
"";!k||k===this._currentAnimation&&this.IsAnimationPlaying()||(this._currentAnimation=k,this.SetPlayingForwards(0<=k.GetSpeed()),this._currentAnimationSpeed=Math.abs(k.GetSpeed()),this._currentAnimationRepeatTo=k.GetRepeatTo(),this._currentFrameIndex=f.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex=0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),k=this._currentAnimation.GetFrameAt(this._currentFrameIndex),
this._OnFrameChanged(g,k))}_DoChangeAnimFrame(){const g=this._currentAnimationFrame;var k=this._currentFrameIndex;this._currentFrameIndex=f.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;k!==this._currentFrameIndex&&(k=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,k),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const g=this._currentAnimationFrame.GetImageInfo();this._currentTexture=
g.GetTexture();this._currentRcTex=g.GetTexRect();this.GetWorldInfo().SetMeshChanged(!0)}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(g){const k=this._currentAnimationFrame,m=this.GetWorldInfo();if("string"===typeof g)g=k.GetImagePointByName(g);else if("number"===typeof g)g=k.GetImagePointByIndex(g-1);else throw new TypeError("expected string or number");if(!g)return[m.GetX(),m.GetY()];d.copy(g.GetVec2());if(m.HasMesh()){const [p,n]=m.GetSourceMesh().TransformPoint(d.getX(),
d.getY());d.set(p,n)}d.offset(-k.GetOriginX(),-k.GetOriginY());d.scale(m.GetWidth(),m.GetHeight());d.rotate(m.GetAngle());d.offset(m.GetX(),m.GetY());return[d.getX(),d.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(g){g=Math.floor(g);const k=this.GetWorldInfo();var m=k.GetTransformedCollisionPoly();const p=m.pointCount();g===p&&(g=0);if(0>g||g>=p)return[0,0];m=m.pointsArr();return[m[2*g]+k.GetX(),m[2*g+1]+k.GetY()]}GetDebuggerProperties(){const g=
f.Plugins.Sprite.Acts;return[{title:"plugins.sprite.debugger.animation-properties.title",properties:[{name:"plugins.sprite.debugger.animation-properties.current-animation",value:this._currentAnimation.GetName(),onedit:k=>this.CallAction(g.SetAnim,k,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",value:this._currentFrameIndex,onedit:k=>this.CallAction(g.SetAnimFrame,k)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:k=>
k?this.CallAction(g.StartAnim,0):this.CallAction(g.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:k=>this.CallAction(g.SetAnimSpeed,k)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:k=>this._animationRepeats=k}]}]}SaveToJson(){const g={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&(g.fs=this._frameStartTime);var k=this.GetAnimationTime();0!==k&&(g.at=k);0!==this._currentFrameIndex&&
(g.f=this._currentFrameIndex);0!==this._currentAnimationSpeed&&(g.cas=this._currentAnimationSpeed);1!==this._animationRepeats&&(g.ar=this._animationRepeats);0!==this._currentAnimationRepeatTo&&(g.rt=this._currentAnimationRepeatTo);this.IsAnimationPlaying()||(g.ap=this.IsAnimationPlaying());this.IsPlayingForwards()||(g.af=this.IsPlayingForwards());k=this.GetWorldInfo();k.IsCollisionEnabled()&&(g.ce=k.IsCollisionEnabled());return g}LoadFromJson(g){var k=this.GetObjectClass().GetAnimationBySID(g.a);
k&&(this._currentAnimation=k);this._frameStartTime=g.hasOwnProperty("fs")?g.fs:0;this._animationTimer.Set(g.hasOwnProperty("at")?g.at:0);k=g.hasOwnProperty("f")?g.f:0;this._currentFrameIndex=f.clamp(k,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=g.hasOwnProperty("cas")?g.cas:0;this._animationRepeats=g.hasOwnProperty("ar")?g.ar:1;k=g.hasOwnProperty("rt")?g.rt:0;this._currentAnimationRepeatTo=f.clamp(k,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(g.hasOwnProperty("ap")?
!!g.ap:!0);this.SetPlayingForwards(g.hasOwnProperty("af")?!!g.af:!0);this._currentAnimationFrame=k=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._UpdateCurrentTexture();const m=this.GetWorldInfo();m.SetOriginX(k.GetOriginX());m.SetOriginY(k.GetOriginY());m.SetSourceCollisionPoly(k.GetCollisionPoly());m.SetCollisionEnabled(!!g.ce)}GetPropertyValueByIndex(g){const k=this.GetWorldInfo();switch(g){case 3:return k.IsCollisionEnabled();case 2:return f.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-
1)}}SetPropertyValueByIndex(g,k){var m=this.GetWorldInfo();switch(g){case 3:m.SetCollisionEnabled(!!k);break;case 2:this.SetAnimationPlaying(!1);g=this._currentAnimation.GetFrameCount()-1;m=k=f.clamp(k,0,g);k=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const p=this._currentAnimation.GetFrameAt(m);this._OnFrameChanged(k,p);this._currentFrameIndex=f.clamp(m,0,g)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const c=new WeakMap,e=new Map([["current-frame",0],["beginning",1]]);
self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();c.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return c.get(this).GetImagePointCount()}getImagePointX(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return c.get(this).GetImagePoint(g)[0]}getImagePointY(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return c.get(this).GetImagePoint(g)[1]}getImagePoint(g){if("string"!==
typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return c.get(this).GetImagePoint(g)}getPolyPointCount(){return c.get(this).GetCollisionPolyPointCount()}getPolyPointX(g){return c.get(this).GetCollisionPolyPoint(g)[0]}getPolyPointY(g){return c.get(this).GetCollisionPolyPoint(g)[1]}getPolyPoint(g){return c.get(this).GetCollisionPolyPoint(g)}stopAnimation(){c.get(this).SetAnimationPlaying(!1)}startAnimation(g="current-frame"){g=e.get(g);if("undefined"===typeof g)throw Error("invalid mode");
c.get(this)._StartAnim(g)}setAnimation(g,k="beginning"){k=e.get(k);if("undefined"===typeof k)throw Error("invalid mode");c.get(this)._SetAnim(g,k)}get animationName(){return c.get(this)._GetCurrentAnimationName()}set animationFrame(g){c.get(this)._SetAnimFrame(g)}get animationFrame(){return c.get(this)._GetAnimFrame()}set animationSpeed(g){c.get(this)._SetAnimSpeed(g)}get animationSpeed(){return c.get(this)._GetAnimSpeed()}set animationRepeatToFrame(g){c.get(this)._SetAnimRepeatToFrame(g)}get animationRepeatToFrame(){return c.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return c.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return c.get(this).GetCurrentImageInfo().GetHeight()}}}"use strict";
{const f=self.C3,b=f.New(f.Rect),a=[],d=[];let c=!1,e=null,g=!1;const k=new Set;function m(t,x,z,D){const G=x.GetUID(),w=z.GetUID();G<w?t.Set(x,z,D):t.Set(z,x,D)}function p(t,x,z){const D=x.GetUID(),G=z.GetUID();D<G?t.Delete(x,z):t.Delete(z,x)}function n(t,x){t.DeleteEither(x)}function u(t,x,z){const D=x.GetUID(),G=z.GetUID();return D<G?t.Get(x,z):t.Get(z,x)}function q(t,x,z,D){if(!x)return!1;t=t.GetInstance();const G=0!==z||0!==D,w=t.GetWorldInfo(),B=t.GetRuntime(),I=B.GetCollisionEngine();var P=
B.GetCurrentCondition();const E=P.GetEventBlock().IsOrBlock();var J=P.GetObjectClass();P=P.IsInverted();const O=x.GetCurrentSol();J=J!==x;e=x;c=J&&!P;g=!1;let R=0,T=0,Y=!1;O.IsSelectAll()?(b.copy(w.GetBoundingBox()),b.offset(z,D),I.GetCollisionCandidates(w.GetLayer(),x,b,d),x=d):E?B.IsCurrentConditionFirst()&&!O._GetOwnElseInstances().length&&O._GetOwnInstances().length?x=O._GetOwnInstances():(x=O._GetOwnElseInstances(),g=!0):x=O._GetOwnInstances();G&&(R=w.GetX(),T=w.GetY(),w.OffsetXY(z,D),w.SetBboxChanged());
for(const W of x)if(I.TestOverlap(t,W)){Y=!0;if(P)break;J&&k.add(W)}G&&(w.SetXY(R,T),w.SetBboxChanged());f.clearArray(d);return Y}function r(t){t=t.GetRuntime().GetCurrentEvent().IsOrBlock();const x=e.GetCurrentSol(),z=x._GetOwnInstances(),D=x._GetOwnElseInstances();x.IsSelectAll()?(x.SetSetPicked(k),t&&(f.clearArray(D),x.AddElseInstances(k,e.GetInstances()))):t?g?x.TransferElseInstancesToOwn(k):(x.AddElseInstances(k,z),x.SetSetPicked(k)):x.SetSetPicked(k);e.ApplySolToContainer()}f.Plugins.Sprite._FinishCondition=
function(t,x){c&&(x&&r(t),k.clear(),e=null,c=!1)};f.Plugins.Sprite.Cnds={OnCollision(t){if(this._runtime.IsDebugging())return f.Plugins.Sprite.Cnds.DebugOnCollision.call(this,t);if(!t)return!1;var x=this._runtime;const z=x.GetCollisionEngine(),D=x.GetEventSheetManager(),G=D.GetEventStack();var w=D.GetCurrentCondition();const B=w.GetObjectClass();var I=w.GetSavedDataMap(),P=w.GetUnsavedDataMap();w=G.GetCurrentStackFrame();const E=x.GetTickCount(),J=E-1,O=w.GetCurrentEvent(),R=G.Push(O);let T=I.get("collmemory");
T||(T=f.New(f.PairMap),I.set("collmemory",T));P.get("spriteCreatedDestroyCallback")||(P.set("spriteCreatedDestroyCallback",!0),x.Dispatcher().addEventListener("instancedestroy",qa=>n(T,qa.instance)));I=B.GetCurrentSol();x=t.GetCurrentSol();I=I.GetInstances();P=null;for(let qa=0;qa<I.length;++qa){const ja=I[qa];x.IsSelectAll()?(z.GetCollisionCandidates(ja.GetWorldInfo().GetLayer(),t,ja.GetWorldInfo().GetBoundingBox(),a),P=a,z.AddRegisteredCollisionCandidates(ja,t,P)):P=x.GetInstances();for(let xa=
0;xa<P.length;++xa){const ua=P[xa];if(z.TestOverlap(ja,ua)||z.CheckRegisteredCollision(ja,ua)){var Y=u(T,ja,ua),W=!1,ea=-2;"number"===typeof Y&&(W=!0,ea=Y);Y=!W||ea<J;m(T,ja,ua,E);Y&&(Y=O.GetSolModifiers(),D.PushCopySol(Y),ea=B.GetCurrentSol(),W=t.GetCurrentSol(),ea._SetSelectAll(!1),W._SetSelectAll(!1),B===t?(W=ea._GetOwnInstances(),f.clearArray(W),W.push(ja),W.push(ua),B.ApplySolToContainer()):(ea=ea._GetOwnInstances(),W=W._GetOwnInstances(),f.clearArray(ea),f.clearArray(W),ea.push(ja),W.push(ua),
B.ApplySolToContainer(),t.ApplySolToContainer()),O.Retrigger(w,R),D.PopSol(Y))}else p(T,ja,ua)}f.clearArray(a)}G.Pop();return!1},*DebugOnCollision(t){if(!t)return!1;var x=this._runtime;const z=x.GetCollisionEngine(),D=x.GetEventSheetManager(),G=D.GetEventStack(),w=G.GetCurrentStackFrame(),B=x.GetTickCount(),I=B-1,P=w.GetCurrentEvent(),E=G.Push(P);var J=D.GetCurrentCondition();const O=J.GetObjectClass();var R=J.GetSavedDataMap();J=J.GetUnsavedDataMap();let T=R.get("collmemory");T||(T=f.New(f.PairMap),
R.set("collmemory",T));J.get("spriteCreatedDestroyCallback")||(J.set("spriteCreatedDestroyCallback",!0),x.Dispatcher().addEventListener("instancedestroy",qa=>n(T,qa.instance)));R=O.GetCurrentSol();x=t.GetCurrentSol();R=R.GetInstances();J=null;for(let qa=0;qa<R.length;++qa){const ja=R[qa];x.IsSelectAll()?(z.GetCollisionCandidates(ja.GetWorldInfo().GetLayer(),t,ja.GetWorldInfo().GetBoundingBox(),a),J=a,z.AddRegisteredCollisionCandidates(ja,t,J)):J=x.GetInstances();for(let xa=0;xa<J.length;++xa){const ua=
J[xa];if(z.TestOverlap(ja,ua)||z.CheckRegisteredCollision(ja,ua)){var Y=u(T,ja,ua),W=!1,ea=-2;"number"===typeof Y&&(W=!0,ea=Y);Y=!W||ea<I;m(T,ja,ua,B);Y&&(Y=P.GetSolModifiers(),D.PushCopySol(Y),ea=O.GetCurrentSol(),W=t.GetCurrentSol(),ea._SetSelectAll(!1),W._SetSelectAll(!1),O===t?(W=ea._GetOwnInstances(),f.clearArray(W),W.push(ja),W.push(ua),O.ApplySolToContainer()):(ea=ea._GetOwnInstances(),W=W._GetOwnInstances(),f.clearArray(ea),f.clearArray(W),ea.push(ja),W.push(ua),O.ApplySolToContainer(),t.ApplySolToContainer()),
yield*P.DebugRetrigger(w,E),D.PopSol(Y))}else p(T,ja,ua)}f.clearArray(a)}G.Pop();return!1},IsOverlapping(t){return q(this,t,0,0)},IsOverlappingOffset(t,x,z){return q(this,t,x,z)},IsAnimPlaying(t){return f.equalsNoCase(this._GetCurrentAnimationName(),t)},CompareFrame(t,x){return f.compare(this._currentFrameIndex,t,x)},CompareAnimSpeed(t,x){return f.compare(this._GetAnimSpeed(),t,x)},OnAnimFinished(t){return f.equalsNoCase(this._animTriggerName,t)},OnAnyAnimFinished(){return!0},OnFrameChanged(){return!0},
IsMirrored(){return 0>this.GetWorldInfo().GetWidth()},IsFlipped(){return 0>this.GetWorldInfo().GetHeight()},OnURLLoaded(){return!0},OnURLFailed(){return!0},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}}"use strict";
{const f=self.C3;f.Plugins.Sprite.Acts={Spawn(b,a,d){if(b&&a){var [c,e]=this.GetImagePoint(d);if(a=this._runtime.CreateInstance(b,a,c,e)){b.GetPlugin().IsRotatable()&&(d=a.GetWorldInfo(),d.SetAngle(this.GetWorldInfo().GetAngle()),d.SetBboxChanged());d=this._runtime.GetEventSheetManager();d.BlockFlushingInstances(!0);a._TriggerOnCreated();if(a.IsInContainer())for(var g of a.siblings())g._TriggerOnCreated();d.BlockFlushingInstances(!1);d=this._runtime.GetCurrentAction().GetSavedDataMap();g=!1;if(!d.has("Spawn_LastExec")||
d.get("Spawn_LastExec")<this._runtime.GetExecCount())g=!0,d.set("Spawn_LastExec",this._runtime.GetExecCount());if(b!==this.GetObjectClass()&&(b=b.GetCurrentSol(),b._SetSelectAll(!1),b=b._GetOwnInstances(),g&&f.clearArray(b),b.push(a),a.IsInContainer()))for(const k of a.siblings())b=k.GetObjectClass().GetCurrentSol(),g?b.SetSinglePicked(k):(b._SetSelectAll(!1),b._PushInstance(k))}}},StopAnim(){this.SetAnimationPlaying(!1)},StartAnim(b){this._StartAnim(b)},SetAnim(b,a){this._SetAnim(b,a)},SetAnimFrame(b){this._SetAnimFrame(b)},
SetAnimSpeed(b){this._SetAnimSpeed(b)},SetAnimRepeatToFrame(b){this._SetAnimRepeatToFrame(b)},SetMirrored(b){const a=this.GetWorldInfo(),d=a.GetWidth();b=Math.abs(d)*(0===b?-1:1);d!==b&&(a.SetWidth(b),a.SetBboxChanged())},SetFlipped(b){const a=this.GetWorldInfo(),d=a.GetHeight();b=Math.abs(d)*(0===b?-1:1);d!==b&&(a.SetHeight(b),a.SetBboxChanged())},SetScale(b){const a=this._currentAnimationFrame.GetImageInfo(),d=this.GetWorldInfo();var c=0>d.GetWidth()?-1:1;const e=0>d.GetHeight()?-1:1;c*=a.GetWidth()*
b;b=a.GetHeight()*b*e;if(d.GetWidth()!==c||d.GetHeight()!==b)d.SetSize(c,b),d.SetBboxChanged()},async LoadURL(b,a,d){d=this._currentAnimationFrame.GetImageInfo();const c=this.GetWorldInfo(),e=this._runtime;if(d.GetURL()===b)0===a&&(c.SetSize(d.GetWidth(),d.GetHeight()),c.SetBboxChanged()),this.Trigger(f.Plugins.Sprite.Cnds.OnURLLoaded);else{var g=f.New(f.ImageInfo);await g.LoadDynamicAsset(e,b);g.IsLoaded()?(await g.LoadStaticTexture(e.GetWebGLRenderer(),{sampling:this._runtime.GetSampling()}),d.ReplaceWith(g),
this._sdkType._UpdateAllCurrentTexture(),this.WasReleased()||0!==a||(c.SetSize(d.GetWidth(),d.GetHeight()),c.SetBboxChanged()),e.UpdateRender(),this.WasReleased()||await this.TriggerAsync(f.Plugins.Sprite.Cnds.OnURLLoaded)):this.Trigger(f.Plugins.Sprite.Cnds.OnURLFailed)}},SetCollisions(b){this.GetWorldInfo().SetCollisionEnabled(b)},SetSolidCollisionFilter(b,a){this.GetWorldInfo().SetSolidCollisionFilter(0===b,a)},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()}}}"use strict";
self.C3.Plugins.Sprite.Exps={AnimationFrame(){return this._currentFrameIndex},AnimationFrameCount(){return this._currentAnimation.GetFrameCount()},AnimationName(){return this._currentAnimation.GetName()},AnimationSpeed(){return this._GetAnimSpeed()},OriginalAnimationSpeed(){return this._currentAnimation.GetSpeed()},ImagePointX(f){return this.GetImagePoint(f)[0]},ImagePointY(f){return this.GetImagePoint(f)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},
ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(f){return this.GetCollisionPolyPoint(f)[0]},PolyPointYAt(f){return this.GetCollisionPolyPoint(f)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};"use strict";{const f=self.C3;f.Plugins.TiledBg=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;function b(a){switch(a){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}f.Plugins.TiledBg.Type=class extends f.SDKTypeBase{constructor(a,d){super(a);this._wrapY=this._wrapX="repeat";d&&(this._wrapX=b(d[0]),this._wrapY=b(d[1]))}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}}"use strict";
{const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad),d=f.New(f.Rect),c=f.New(f.Quad);f.Plugins.TiledBg.Instance=class extends f.SDKWorldInstanceBase{constructor(g,k){super(g);this._imageOffsetY=this._imageOffsetX=0;this._imageScaleY=this._imageScaleX=1;this._imageAngle=0;this._ownImageInfo=null;k&&(this.GetWorldInfo().SetVisible(!!k[0]),this._imageOffsetX=k[4],this._imageOffsetY=k[5],this._imageScaleX=k[6],this._imageScaleY=k[7],this._imageAngle=f.toRadians(k[8]))}Release(){this._ReleaseOwnImage();super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&
(this._ownImageInfo.Release(),this._ownImageInfo=null)}Draw(g){var k=this.GetCurrentImageInfo(),m=k.GetTexture();if(null!==m){g.SetTexture(m);m=k.GetWidth();k=k.GetHeight();var p=this._imageOffsetX/m,n=this._imageOffsetY/k,u=this.GetWorldInfo();d.set(0,0,u.GetWidth()/(m*this._imageScaleX),u.GetHeight()/(k*this._imageScaleY));d.offset(-p,-n);u.HasMesh()?this._DrawMesh(u,g):this._DrawStandard(u,g)}}_DrawStandard(g,k){let m=g.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));
0===this._imageAngle?k.Quad3(m,d):(c.setFromRotatedRect(d,-this._imageAngle),k.Quad4(m,c))}_DrawMesh(g,k){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(b,a,!1);let p=a;this._runtime.IsPixelRoundingEnabled()&&(p=g.PixelRoundQuad(p));let n=d;0!==this._imageAngle&&(c.setFromRotatedRect(d,-this._imageAngle),n=c);m.CalculateTransformedMesh(g.GetSourceMesh(),p,n);g.SetMeshChanged(!1)}m.Draw(k)}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}_SetMeshChanged(){this.GetWorldInfo().SetMeshChanged(!0)}_SetImageOffsetX(g){this._imageOffsetX!==
g&&(this._imageOffsetX=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(g){this._imageOffsetY!==g&&(this._imageOffsetY=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(g){this._imageScaleX!==g&&(this._imageScaleX=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(g){this._imageScaleY!==g&&(this._imageScaleY=
g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(g){this._imageAngle!==g&&(this._imageAngle=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageAngle(){return this._imageAngle}GetPropertyValueByIndex(g){switch(g){case 4:return this._GetImageOffsetX();case 5:return this._GetImageOffsetY();case 6:return this._GetImageScaleX();case 7:return this._GetImageScaleY();case 8:return this._GetImageAngle()}}SetPropertyValueByIndex(g,
k){switch(g){case 4:this._SetImageOffsetX(k);break;case 5:this._SetImageOffsetY(k);break;case 6:this._SetImageScaleX(k);break;case 7:this._SetImageScaleY(k);break;case 8:this._SetImageAngle(k)}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const e=new WeakMap;self.ITiledBackgroundInstance=class extends self.IWorldInstance{constructor(){super();e.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(g){e.get(this)._SetImageOffsetX(g)}get imageOffsetX(){return e.get(this)._GetImageOffsetX()}set imageOffsetY(g){e.get(this)._SetImageOffsetY(g)}get imageOffsetY(){return e.get(this)._GetImageOffsetY()}set imageScaleX(g){e.get(this)._SetImageScaleX(g)}get imageScaleX(){return e.get(this)._GetImageScaleX()}set imageScaleY(g){e.get(this)._SetImageScaleY(g)}get imageScaleY(){return e.get(this)._GetImageScaleY()}set imageAngle(g){e.get(this)._SetImageAngle(g)}get imageAngle(){return e.get(this)._GetImageAngle()}set imageAngleDegrees(g){e.get(this)._SetImageAngle(f.toRadians(g))}get imageAngleDegrees(){return f.toDegrees(e.get(this)._GetImageAngle())}}}"use strict";
self.C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}};"use strict";
{const f=self.C3;f.Plugins.TiledBg.Acts={SetImageOffsetX(b){this._SetImageOffsetX(b)},SetImageOffsetY(b){this._SetImageOffsetY(b)},SetImageScaleX(b){this._SetImageScaleX(b/100)},SetImageScaleY(b){this._SetImageScaleY(b/100)},SetImageAngle(b){this._SetImageAngle(f.toRadians(b))},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()},async LoadURL(b,a){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==b){a=this._runtime;var d=f.New(f.ImageInfo);await d.LoadDynamicAsset(a,
b);if(d.IsLoaded()){if(this.WasReleased())return d.Release(),null;await d.LoadStaticTexture(a.GetWebGLRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"})&&(this.WasReleased()?d.Release():(this._ReleaseOwnImage(),this._ownImageInfo=d,a.UpdateRender(),await this.TriggerAsync(f.Plugins.TiledBg.Cnds.OnURLLoaded)))}else this.Trigger(f.Plugins.TiledBg.Cnds.OnURLFailed)}}}}"use strict";
{const f=self.C3;f.Plugins.TiledBg.Exps={ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},ImageOffsetX(){return this._imageOffsetX},ImageOffsetY(){return this._imageOffsetY},ImageScaleX(){return 100*this._imageScaleX},ImageScaleY(){return 100*this._imageScaleY},ImageAngle(){return f.toDegrees(this._imageAngle)}}}"use strict";
{const f=self.C3;f.Plugins.sliderbar=class extends f.SDKDOMPluginBase{constructor(b){super(b,"sliderbar");this.AddElementMessageHandler("click",(a,d)=>a._OnClick(d));this.AddElementMessageHandler("change",(a,d)=>a._OnChange(d));this.AddElementMessageHandler("input",(a,d)=>a._OnInput(d))}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Plugins.sliderbar.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}"use strict";
{const f=self.C3;f.Plugins.sliderbar.Instance=class extends f.SDKDOMInstanceBase{constructor(a,d){super(a,"sliderbar");this._min=this._value=0;this._max=100;this._step=1;this._title="";this._isEnabled=!0;this._id="";d&&(this._value=d[0],this._min=d[1],this._max=d[2],this._step=d[3],this._title=d[4],this.GetWorldInfo().SetVisible(d[5]),this._isEnabled=d[6],this._id=d[7]);this.CreateElement({id:this._id})}Release(){super.Release()}GetElementState(){return{value:this._value,min:this._min,max:this._max,
step:this._step,title:this._title,isEnabled:this._isEnabled}}async _OnClick(a){this.GetScriptInterface().dispatchEvent(f.New(f.Event,"click",!0));await this.TriggerAsync(f.Plugins.sliderbar.Cnds.OnClicked)}async _OnChange(a){this._value=a.value;this.GetScriptInterface().dispatchEvent(f.New(f.Event,"change",!0));await this.TriggerAsync(f.Plugins.sliderbar.Cnds.OnChanged)}_OnInput(a){this._value=a.value}Draw(a){}_SetValue(a){this._value!==a&&(this._value=a,this.UpdateElementState())}_GetValue(){return this._value}_SetMaximum(a){this._max!==
a&&(this._max=a,this.UpdateElementState())}_GetMaximum(){return this._max}_SetMinimum(a){this._min!==a&&(this._min=a,this.UpdateElementState())}_GetMinimum(){return this._min}_SetTooltip(a){this._title!==a&&(this._title=a,this.UpdateElementState())}_GetTooltip(){return this._title}_SetStep(a){this._step!==a&&(this._step=a,this.UpdateElementState())}_GetStep(){return this._step}_SetEnabled(a){a=!!a;this._isEnabled!==a&&(this._isEnabled=a,this.UpdateElementState())}_IsEnabled(){return this._isEnabled}SaveToJson(){return{v:this._value,
min:this._min,max:this._max,s:this._step,t:this._title,e:this._isEnabled,id:this._id}}LoadFromJson(a){this._value=a.v;this._min=a.min;this._max=a.max;this._step=a.s;this._title=a.t;this._isEnabled=a.e;this._id=a.id;this.UpdateElementState()}GetPropertyValueByIndex(a){switch(a){case 0:return this._GetValue();case 1:return this._GetMinimum();case 2:return this._GetMaximum();case 3:return this._GetStep();case 4:return this._GetTooltip();case 6:return this._IsEnbled();case 7:return this._id}}SetPropertyValueByIndex(a,
d){switch(a){case 0:this._SetValue(d);break;case 1:this._SetMinimum(d);break;case 2:this._SetMaximum(d);break;case 3:this._SetStep(d);break;case 4:this._SetTooltip(d);break;case 6:this._SetEnabled(d);break;case 7:this._id!==d&&(this._id=d,this.UpdateElementState())}}GetDebuggerProperties(){return[{title:"plugins.sliderbar.name",properties:[{name:"plugins.sliderbar.properties.value.name",value:this._GetValue(),onedit:a=>this._SetValue(a)},{name:"plugins.sliderbar.properties.minimum.name",value:this._GetMinimum(),
onedit:a=>this._SetMinimum(a)},{name:"plugins.sliderbar.properties.maximum.name",value:this._GetMaximum(),onedit:a=>this._SetMaximum(a)},{name:"plugins.sliderbar.properties.step.name",value:this._GetStep(),onedit:a=>this._SetStep(a)}]}]}GetScriptInterfaceClass(){return self.ISliderBarInstance}};const b=new WeakMap;self.ISliderBarInstance=class extends self.IDOMInstance{constructor(){super();b.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set value(a){b.get(this)._SetValue(a)}get value(){return b.get(this)._GetValue()}set maximum(a){b.get(this)._SetMaximum(a)}get maximum(){return b.get(this)._GetMaximum()}set minimum(a){b.get(this)._SetMinimum(a)}get minimum(){return b.get(this)._GetMinimum()}set step(a){b.get(this)._SetStep(a)}get step(){return b.get(this)._GetStep()}set tooltip(a){b.get(this)._SetTooltip(a)}get tooltip(){return b.get(this)._GetTooltip()}set isEnabled(a){b.get(this)._SetEnabled(a)}get isEnabled(){return b.get(this)._IsEnabled()}}}"use strict";
{const f=self.C3;f.Plugins.sliderbar.Cnds={OnClicked(){return!0},OnChanged(){return!0},CompareValue(b,a){return f.compare(this._GetValue(),b,a)}}}"use strict";self.C3.Plugins.sliderbar.Acts={SetTooltip(f){this._SetTooltip(f)},SetValue(f){this._SetValue(f)},SetMaximum(f){this._SetMaximum(f)},SetMinimum(f){this._SetMinimum(f)},SetStep(f){this._SetStep(f)}};"use strict";
self.C3.Plugins.sliderbar.Exps={Value(){return this._GetValue()},Maximum(){return this._GetMaximum()},Minimum(){return this._GetMinimum()},Step(){return this._GetStep()}};"use strict";{const f=self.C3;f.Behaviors.Rotate=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Behaviors.Rotate.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}"use strict";
{const f=self.C3;f.Behaviors.Rotate.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._acceleration=this._speed=0;this._isEnabled=!0;a&&(this._speed=f.toRadians(a[0]),this._acceleration=f.toRadians(a[1]),this._isEnabled=a[2]);this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{s:this._speed,a:this._acceleration,e:this._isEnabled}}LoadFromJson(b){this._speed=b.s;this._acceleration=b.a;this._SetEnabled(b.e)}Tick(){if(this._isEnabled){var b=
this._runtime.GetDt(this._inst);if(0!==b&&(0!==this._acceleration&&(this._speed+=this._acceleration*b),0!==this._speed)){const a=this._inst.GetWorldInfo();a.SetAngle(a.GetAngle()+this._speed*b);a.SetBboxChanged()}}}GetPropertyValueByIndex(b){switch(b){case 0:return f.toDegrees(this._speed);case 1:return f.toDegrees(this._acceleration);case 2:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._speed=f.toRadians(a);break;case 1:this._acceleration=f.toRadians(a);break;case 2:this._SetEnabled(a)}}_SetEnabled(b){(this._isEnabled=
!!b)?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.rotate.properties.speed.name",value:f.toDegrees(this._speed),onedit:b=>this._speed=f.toRadians(b)},{name:"behaviors.rotate.properties.acceleration.name",value:f.toDegrees(this._acceleration),onedit:b=>this._acceleration=f.toRadians(b)},{name:"behaviors.rotate.properties.enabled.name",value:this._isEnabled,onedit:b=>this._SetEnabled(b)}]}]}}}"use strict";
self.C3.Behaviors.Rotate.Cnds={IsEnabled(){return this._isEnabled}};"use strict";{const f=self.C3;f.Behaviors.Rotate.Acts={SetSpeed(b){this._speed=f.toRadians(b)},SetAcceleration(b){this._acceleration=f.toRadians(b)},SetEnabled(b){this._SetEnabled(b)}}}"use strict";{const f=self.C3;f.Behaviors.Rotate.Exps={Speed(){return f.toDegrees(this._speed)},Acceleration(){return f.toDegrees(this._acceleration)}}}"use strict";
{const f=self.C3;self.C3_GetObjectRefTable=function(){return[f.Plugins.Audio,f.Plugins.Browser,f.Plugins.Touch,f.Plugins.Arr,f.Plugins.LocalStorage,f.Plugins.Function,f.Plugins.Keyboard,f.Plugins.Mouse,f.Plugins.NodeWebkit,f.Plugins.Text,f.Plugins.Sprite,f.Plugins.TiledBg,f.Plugins.sliderbar,f.Behaviors.Rotate,f.Plugins.System.Cnds.OnLayoutStart,f.Plugins.System.Acts.ResetGlobals,f.Plugins.Audio.Acts.Play,f.Plugins.System.Acts.SetVar,f.Plugins.sliderbar.Exps.Value,f.Plugins.System.Cnds.IsGroupActive,
f.Plugins.Mouse.Cnds.IsOverObject,f.Plugins.System.Cnds.LayerVisible,f.Plugins.System.Cnds.TriggerOnce,f.Plugins.Text.Cnds.PickByUID,f.Plugins.Text.Acts.SetVisible,f.Plugins.Mouse.Acts.SetCursor,f.Plugins.Sprite.Acts.SetSize,f.Plugins.Sprite.Exps.Width,f.Plugins.Sprite.Exps.Height,f.Plugins.Sprite.Acts.SetAnimFrame,f.Plugins.Sprite.Cnds.CompareInstanceVar,f.Plugins.System.Cnds.CompareVar,f.Plugins.System.Cnds.PickAll,f.Plugins.System.Cnds.PickByComparison,f.Plugins.System.Acts.SetGroupActive,f.Plugins.Audio.Acts.StopAll,
f.Plugins.System.Cnds.Else,f.Plugins.Function.Acts.CallFunction,f.Plugins.System.Cnds.Every,f.Plugins.System.Acts.AddVar,f.Plugins.System.Acts.Wait,f.Plugins.Function.Cnds.OnFunction,f.Plugins.Sprite.Cnds.IsOverlapping,f.Plugins.Audio.Acts.SetVolume,f.Plugins.Audio.Acts.PlayByName,f.Plugins.Audio.Acts.Stop,f.Plugins.Sprite.Acts.SetVisible,f.Plugins.Sprite.Cnds.PickInstVarHiLow,f.Plugins.System.Cnds.ForEach,f.Plugins.Touch.Cnds.OnTouchObject,f.Plugins.Sprite.Acts.SetInstanceVar,f.Plugins.System.Acts.CreateObjectByName,
f.Plugins.Sprite.Exps.X,f.Plugins.Sprite.Exps.Y,f.Plugins.Sprite.Acts.Destroy,f.Plugins.Touch.Cnds.OnDoubleTapGestureObject,f.Plugins.Sprite.Cnds.PickDistance,f.Plugins.System.Acts.RestartLayout,f.Plugins.Browser.Acts.GoToURLWindow,f.Plugins.sliderbar.Cnds.OnChanged,f.Plugins.System.Acts.SetLayerVisible,f.Plugins.System.Cnds.EveryTick,f.Behaviors.Rotate.Cnds.IsEnabled,f.Behaviors.Rotate.Acts.SetSpeed,f.Behaviors.Rotate.Exps.Speed,f.Plugins.System.Cnds.Compare,f.Plugins.Sprite.Cnds.IsBetweenAngles,
f.Behaviors.Rotate.Acts.SetEnabled,f.Plugins.Sprite.Acts.SetAngle,f.Plugins.System.Acts.GoToLayout]};self.C3_JsPropNameTable=[{Audio:0},{Browser:0},{Touch:0},{Mds024WGRPlayersData:0},{Mds024WGRHighscores:0},{LocalStorage:0},{Function:0},{Keyboard:0},{Mouse:0},{NWjs:0},{T_General1:0},{T_General2:0},{OriginalWidth:0},{OriginalHeight:0},{B_Info:0},{B_Vocal:0},{B_Loop:0},{B_Instrument:0},{B_Clear:0},{B_Metronome:0},{B_Help:0},{B_Close:0},{Active:0},{value:0},{Container:0},{No:0},{DottedLine:0},{"8o":0},
{"2o":0},{CellNo:0},{PlacedValue:0},{Empty:0},{MusicCell:0},{StaffLine:0},{"4o":0},{Rest:0},{MetronomeSpeed:0},{SliderBar:0},{Shadow:0},{TiledBackground1:0},{Ribbon:0},{Cursor:0},{Picture_Instrument:0},{Picture_Loop:0},{Picture_Metronome:0},{Picture_Vocal:0},{Picture_Clear:0},{Logo_Text:0},{Rotate:0},{Logo:0},{Picture_Bar:0},{Values:0},{Buttons:0},{cellNumber:0},{metronomeValue:0},{loop:0},{playMode:0},{metronome:0}]}"use strict";
self.C3_ExpressionFuncs=[()=>-100,()=>"",f=>{const b=f._GetNode(0);return()=>1/b.ExpObject()},()=>"FX",()=>2,()=>45,()=>51,f=>{const b=f._GetNode(0),a=f._GetNode(1);return()=>b.ExpObject()+a.ExpObject()/4},f=>{const b=f._GetNode(0);return()=>b.ExpInstVar_Family()},()=>"Play",()=>1,()=>0,()=>"v",()=>"i",f=>{const b=f._GetNode(0);return()=>b.ExpInstVar()},f=>{const b=f._GetNode(0).GetVar();return()=>b.GetValue()},()=>"Metronome",()=>.08,()=>9,()=>-60,f=>{const b=f._GetNode(0).GetVar(),a=f._GetNode(1);
return()=>b.GetValue()+a.ExpInstVar()},()=>"8o",f=>{const b=f._GetNode(0).GetVar();return()=>b.GetValue()/2},()=>-40,f=>{const b=f._GetNode(0);return()=>b.ExpObject()},f=>{const b=f._GetNode(0);return()=>b.ExpObject()-37},()=>-10,()=>8,()=>"2o",f=>{const b=f._GetNode(0).GetVar();return()=>b.GetValue()+1},()=>"Full",()=>.1,()=>"index_DS_I_DS_II.html",()=>"NewWindow",f=>{const b=f._GetNode(0);return()=>b.ExpBehavior()-5},f=>{const b=f._GetNode(0);return()=>b.ExpBehavior()},()=>10,()=>1.5];"use strict";
self.C3.ScriptsInEvents={};