// Generated by Construct 3, the game and app creator :: https://www.construct.net
'use strict';"use strict";
(function(e,b){"object"===typeof exports&&"undefined"!==typeof module?b(exports):"function"===typeof define&&define.amd?define(["exports"],b):(e="undefined"!==typeof globalThis?globalThis:e||self,b(e.glMatrix={}))})(this,function(e){function b(k,n,w){var z=n[0],D=n[1],F=n[2];n=n[3];var H=w[0],K=w[1],M=w[2];w=w[3];k[0]=z*H+F*K;k[1]=D*H+n*K;k[2]=z*M+F*w;k[3]=D*M+n*w;return k}function a(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];return k}function c(k,n,w){var z=n[0],D=n[1],F=
n[2],H=n[3],K=n[4];n=n[5];var M=w[0],O=w[1],R=w[2],T=w[3],Y=w[4];w=w[5];k[0]=z*M+F*O;k[1]=D*M+H*O;k[2]=z*R+F*T;k[3]=D*R+H*T;k[4]=z*Y+F*w+K;k[5]=D*Y+H*w+n;return k}function d(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];k[4]=n[4]-w[4];k[5]=n[5]-w[5];return k}function f(){var k=new sa(9);sa!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0);k[0]=1;k[4]=1;k[8]=1;return k}function h(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=w[0],Y=w[1],
X=w[2],fa=w[3],ha=w[4],ba=w[5],qa=w[6],ka=w[7];w=w[8];k[0]=T*z+Y*H+X*O;k[1]=T*D+Y*K+X*R;k[2]=T*F+Y*M+X*n;k[3]=fa*z+ha*H+ba*O;k[4]=fa*D+ha*K+ba*R;k[5]=fa*F+ha*M+ba*n;k[6]=qa*z+ka*H+w*O;k[7]=qa*D+ka*K+w*R;k[8]=qa*F+ka*M+w*n;return k}function g(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];k[4]=n[4]-w[4];k[5]=n[5]-w[5];k[6]=n[6]-w[6];k[7]=n[7]-w[7];k[8]=n[8]-w[8];return k}function l(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;
k[13]=0;k[14]=0;k[15]=1;return k}function m(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=n[8],Y=n[9],X=n[10],fa=n[11],ha=n[12],ba=n[13],qa=n[14];n=n[15];var ka=w[0],ta=w[1],ua=w[2],ra=w[3];k[0]=ka*z+ta*K+ua*T+ra*ha;k[1]=ka*D+ta*M+ua*Y+ra*ba;k[2]=ka*F+ta*O+ua*X+ra*qa;k[3]=ka*H+ta*R+ua*fa+ra*n;ka=w[4];ta=w[5];ua=w[6];ra=w[7];k[4]=ka*z+ta*K+ua*T+ra*ha;k[5]=ka*D+ta*M+ua*Y+ra*ba;k[6]=ka*F+ta*O+ua*X+ra*qa;k[7]=ka*H+ta*R+ua*fa+ra*n;ka=w[8];ta=w[9];ua=w[10];ra=w[11];k[8]=ka*z+ta*K+
ua*T+ra*ha;k[9]=ka*D+ta*M+ua*Y+ra*ba;k[10]=ka*F+ta*O+ua*X+ra*qa;k[11]=ka*H+ta*R+ua*fa+ra*n;ka=w[12];ta=w[13];ua=w[14];ra=w[15];k[12]=ka*z+ta*K+ua*T+ra*ha;k[13]=ka*D+ta*M+ua*Y+ra*ba;k[14]=ka*F+ta*O+ua*X+ra*qa;k[15]=ka*H+ta*R+ua*fa+ra*n;return k}function u(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=z+z,M=D+D,O=F+F;n=z*K;var R=z*M;z*=O;var T=D*M;D*=O;F*=O;K*=H;M*=H;H*=O;k[0]=1-(T+F);k[1]=R+H;k[2]=z-M;k[3]=0;k[4]=R-H;k[5]=1-(n+F);k[6]=D+K;k[7]=0;k[8]=z+M;k[9]=D-K;k[10]=1-(n+T);k[11]=0;k[12]=w[0];k[13]=
w[1];k[14]=w[2];k[15]=1;return k}function v(k,n){k[0]=n[12];k[1]=n[13];k[2]=n[14];return k}function t(k,n){var w=n[4],z=n[5],D=n[6],F=n[8],H=n[9],K=n[10];k[0]=Math.hypot(n[0],n[1],n[2]);k[1]=Math.hypot(w,z,D);k[2]=Math.hypot(F,H,K);return k}function q(k,n){var w=new sa(3);t(w,n);var z=1/w[0],D=1/w[1],F=1/w[2],H=n[0]*z;w=n[1]*D;var K=n[2]*F,M=n[4]*z,O=n[5]*D,R=n[6]*F;z*=n[8];D*=n[9];n=n[10]*F;F=H+O+n;0<F?(H=2*Math.sqrt(F+1),k[3]=.25*H,k[0]=(R-D)/H,k[1]=(z-K)/H,k[2]=(w-M)/H):H>O&&H>n?(H=2*Math.sqrt(1+
H-O-n),k[3]=(R-D)/H,k[0]=.25*H,k[1]=(w+M)/H,k[2]=(z+K)/H):O>n?(H=2*Math.sqrt(1+O-H-n),k[3]=(z-K)/H,k[0]=(w+M)/H,k[1]=.25*H,k[2]=(R+D)/H):(H=2*Math.sqrt(1+n-H-O),k[3]=(w-M)/H,k[0]=(z+K)/H,k[1]=(R+D)/H,k[2]=.25*H);return k}function p(k,n,w,z,D){n=1/Math.tan(n/2);k[0]=n/w;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[11]=-1;k[12]=0;k[13]=0;k[15]=0;null!=D&&Infinity!==D?(w=1/(z-D),k[10]=(D+z)*w,k[14]=2*D*z*w):(k[10]=-1,k[14]=-2*z);return k}function r(k,n,w,z,D,F,H){var K=1/(n-w),M=
1/(z-D),O=1/(F-H);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=2*O;k[11]=0;k[12]=(n+w)*K;k[13]=(D+z)*M;k[14]=(H+F)*O;k[15]=1;return k}function x(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];k[4]=n[4]-w[4];k[5]=n[5]-w[5];k[6]=n[6]-w[6];k[7]=n[7]-w[7];k[8]=n[8]-w[8];k[9]=n[9]-w[9];k[10]=n[10]-w[10];k[11]=n[11]-w[11];k[12]=n[12]-w[12];k[13]=n[13]-w[13];k[14]=n[14]-w[14];k[15]=n[15]-w[15];return k}function y(){var k=new sa(3);sa!=Float32Array&&
(k[0]=0,k[1]=0,k[2]=0);return k}function C(k){return Math.hypot(k[0],k[1],k[2])}function G(k,n,w){var z=new sa(3);z[0]=k;z[1]=n;z[2]=w;return z}function A(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];return k}function E(k,n,w){k[0]=n[0]*w[0];k[1]=n[1]*w[1];k[2]=n[2]*w[2];return k}function J(k,n,w){k[0]=n[0]/w[0];k[1]=n[1]/w[1];k[2]=n[2]/w[2];return k}function B(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2])}function I(k,n){var w=n[0]-k[0],z=n[1]-k[1];k=n[2]-k[2];return w*w+z*z+k*k}function L(k){var n=
k[0],w=k[1];k=k[2];return n*n+w*w+k*k}function P(k,n){var w=n[0],z=n[1],D=n[2];w=w*w+z*z+D*D;0<w&&(w=1/Math.sqrt(w));k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;return k}function S(k,n){return k[0]*n[0]+k[1]*n[1]+k[2]*n[2]}function U(k,n,w){var z=n[0],D=n[1];n=n[2];var F=w[0],H=w[1];w=w[2];k[0]=D*w-n*H;k[1]=n*F-z*w;k[2]=z*H-D*F;return k}function V(){var k=new sa(4);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[3]=0);return k}function Z(k){var n=new sa(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n}function la(k,
n,w,z){var D=new sa(4);D[0]=k;D[1]=n;D[2]=w;D[3]=z;return D}function va(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k}function Na(k,n,w,z,D){k[0]=n;k[1]=w;k[2]=z;k[3]=D;return k}function za(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];return k}function Ha(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];return k}function Ja(k,n,w){k[0]=n[0]*w[0];k[1]=n[1]*w[1];k[2]=n[2]*w[2];k[3]=n[3]*w[3];return k}function Aa(k,n,w){k[0]=n[0]/w[0];k[1]=n[1]/w[1];k[2]=
n[2]/w[2];k[3]=n[3]/w[3];return k}function ya(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;return k}function na(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2],n[3]-k[3])}function Ta(k,n){var w=n[0]-k[0],z=n[1]-k[1],D=n[2]-k[2];k=n[3]-k[3];return w*w+z*z+D*D+k*k}function wa(k){return Math.hypot(k[0],k[1],k[2],k[3])}function Ba(k){var n=k[0],w=k[1],z=k[2];k=k[3];return n*n+w*w+z*z+k*k}function Ya(k,n){var w=n[0],z=n[1],D=n[2];n=n[3];var F=w*w+z*z+D*D+n*n;0<F&&(F=1/Math.sqrt(F));k[0]=
w*F;k[1]=z*F;k[2]=D*F;k[3]=n*F;return k}function Xa(k,n){return k[0]*n[0]+k[1]*n[1]+k[2]*n[2]+k[3]*n[3]}function gb(k,n,w,z){var D=n[0],F=n[1],H=n[2];n=n[3];k[0]=D+z*(w[0]-D);k[1]=F+z*(w[1]-F);k[2]=H+z*(w[2]-H);k[3]=n+z*(w[3]-n);return k}function hb(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]}function Za(){var k=new sa(4);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0);k[3]=1;return k}function ib(k,n,w){w*=.5;var z=Math.sin(w);k[0]=z*n[0];k[1]=z*n[1];k[2]=z*n[2];k[3]=Math.cos(w);return k}
function jb(k,n,w){var z=n[0],D=n[1],F=n[2];n=n[3];var H=w[0],K=w[1],M=w[2];w=w[3];k[0]=z*w+n*H+D*M-F*K;k[1]=D*w+n*K+F*H-z*M;k[2]=F*w+n*M+z*K-D*H;k[3]=n*w-z*H-D*K-F*M;return k}function kb(k,n,w){w*=.5;var z=n[0],D=n[1],F=n[2];n=n[3];var H=Math.sin(w);w=Math.cos(w);k[0]=z*w+n*H;k[1]=D*w+F*H;k[2]=F*w-D*H;k[3]=n*w-z*H;return k}function lb(k,n,w){w*=.5;var z=n[0],D=n[1],F=n[2];n=n[3];var H=Math.sin(w);w=Math.cos(w);k[0]=z*w-F*H;k[1]=D*w+n*H;k[2]=F*w+z*H;k[3]=n*w-D*H;return k}function mb(k,n,w){w*=.5;
var z=n[0],D=n[1],F=n[2];n=n[3];var H=Math.sin(w);w=Math.cos(w);k[0]=z*w+D*H;k[1]=D*w-z*H;k[2]=F*w+n*H;k[3]=n*w-F*H;return k}function nb(k,n){var w=n[0],z=n[1],D=n[2],F=Math.sqrt(w*w+z*z+D*D);n=Math.exp(n[3]);var H=0<F?n*Math.sin(F)/F:0;k[0]=w*H;k[1]=z*H;k[2]=D*H;k[3]=n*Math.cos(F);return k}function ob(k,n){var w=n[0],z=n[1],D=n[2];n=n[3];var F=Math.sqrt(w*w+z*z+D*D);F=0<F?Math.atan2(F,n)/F:0;k[0]=w*F;k[1]=z*F;k[2]=D*F;k[3]=.5*Math.log(w*w+z*z+D*D+n*n);return k}function $a(k,n,w,z){var D=n[0],F=n[1],
H=n[2];n=n[3];var K=w[0],M=w[1],O=w[2];w=w[3];var R=D*K+F*M+H*O+n*w;0>R&&(R=-R,K=-K,M=-M,O=-O,w=-w);if(1E-6<1-R){var T=Math.acos(R);var Y=Math.sin(T);R=Math.sin((1-z)*T)/Y;z=Math.sin(z*T)/Y}else R=1-z;k[0]=R*D+z*K;k[1]=R*F+z*M;k[2]=R*H+z*O;k[3]=R*n+z*w;return k}function pb(k,n){var w=n[0]+n[4]+n[8];if(0<w)w=Math.sqrt(w+1),k[3]=.5*w,w=.5/w,k[0]=(n[5]-n[7])*w,k[1]=(n[6]-n[2])*w,k[2]=(n[1]-n[3])*w;else{var z=0;n[4]>n[0]&&(z=1);n[8]>n[3*z+z]&&(z=2);var D=(z+1)%3,F=(z+2)%3;w=Math.sqrt(n[3*z+z]-n[3*D+D]-
n[3*F+F]+1);k[z]=.5*w;w=.5/w;k[3]=(n[3*D+F]-n[3*F+D])*w;k[D]=(n[3*D+z]+n[3*z+D])*w;k[F]=(n[3*F+z]+n[3*z+F])*w}return k}function qb(k,n,w){var z=.5*w[0],D=.5*w[1];w=.5*w[2];var F=n[0],H=n[1],K=n[2];n=n[3];k[0]=F;k[1]=H;k[2]=K;k[3]=n;k[4]=z*n+D*K-w*H;k[5]=D*n+w*F-z*K;k[6]=w*n+z*H-D*F;k[7]=-z*F-D*H-w*K;return k}function rb(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];return k}function ab(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=w[4],M=w[5],O=w[6],R=w[7],T=n[4],
Y=n[5],X=n[6];n=n[7];var fa=w[0],ha=w[1],ba=w[2];w=w[3];k[0]=z*w+H*fa+D*ba-F*ha;k[1]=D*w+H*ha+F*fa-z*ba;k[2]=F*w+H*ba+z*ha-D*fa;k[3]=H*w-z*fa-D*ha-F*ba;k[4]=z*R+H*K+D*O-F*M+T*w+n*fa+Y*ba-X*ha;k[5]=D*R+H*M+F*K-z*O+Y*w+n*ha+X*fa-T*ba;k[6]=F*R+H*O+z*M-D*K+X*w+n*ba+T*ha-Y*fa;k[7]=H*R-z*K-D*M-F*O+n*w-T*fa-Y*ha-X*ba;return k}function Ua(){var k=new sa(2);sa!=Float32Array&&(k[0]=0,k[1]=0);return k}function bb(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];return k}function sb(k,n,w){k[0]=n[0]*w[0];k[1]=n[1]*w[1];
return k}function cb(k,n,w){k[0]=n[0]/w[0];k[1]=n[1]/w[1];return k}function tb(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1])}function Va(k,n){var w=n[0]-k[0];k=n[1]-k[1];return w*w+k*k}function ub(k){return Math.hypot(k[0],k[1])}function vb(k){var n=k[0];k=k[1];return n*n+k*k}var sa="undefined"!==typeof Float32Array?Float32Array:Array,Sa=Math.random,Ab=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var k=0,n=arguments.length;n--;)k+=arguments[n]*arguments[n];return Math.sqrt(k)});var Db=Object.freeze({__proto__:null,
EPSILON:1E-6,get ARRAY_TYPE(){return sa},RANDOM:Sa,ANGLE_ORDER:"zyx",setMatrixArrayType:function(k){sa=k},toRadian:function(k){return k*Ab},equals:function(k,n){return Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))}}),Eb=Object.freeze({__proto__:null,create:function(){var k=new sa(4);sa!=Float32Array&&(k[1]=0,k[2]=0);k[0]=1;k[3]=1;return k},clone:function(k){var n=new sa(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k},
identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;return k},fromValues:function(k,n,w,z){var D=new sa(4);D[0]=k;D[1]=n;D[2]=w;D[3]=z;return D},set:function(k,n,w,z,D){k[0]=n;k[1]=w;k[2]=z;k[3]=D;return k},transpose:function(k,n){if(k===n){var w=n[1];k[1]=n[2];k[2]=w}else k[0]=n[0],k[1]=n[2],k[2]=n[1],k[3]=n[3];return k},invert:function(k,n){var w=n[0],z=n[1],D=n[2];n=n[3];var F=w*n-D*z;if(!F)return null;F=1/F;k[0]=n*F;k[1]=-z*F;k[2]=-D*F;k[3]=w*F;return k},adjoint:function(k,n){var w=n[0];k[0]=n[3];
k[1]=-n[1];k[2]=-n[2];k[3]=w;return k},determinant:function(k){return k[0]*k[3]-k[2]*k[1]},multiply:b,rotate:function(k,n,w){var z=n[0],D=n[1],F=n[2];n=n[3];var H=Math.sin(w);w=Math.cos(w);k[0]=z*w+F*H;k[1]=D*w+n*H;k[2]=z*-H+F*w;k[3]=D*-H+n*w;return k},scale:function(k,n,w){var z=n[1],D=n[2],F=n[3],H=w[0];w=w[1];k[0]=n[0]*H;k[1]=z*H;k[2]=D*w;k[3]=F*w;return k},fromRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=w;k[2]=-w;k[3]=n;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=
0;k[2]=0;k[3]=n[1];return k},str:function(k){return"mat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3])},LDU:function(k,n,w,z){k[2]=z[2]/z[0];w[0]=z[0];w[1]=z[1];w[3]=z[3]-k[2]*w[1];return[k,n,w]},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];return k},subtract:a,exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]},equals:function(k,n){var w=k[0],z=k[1],D=k[2];k=k[3];var F=n[0],H=n[1],
K=n[2];n=n[3];return Math.abs(w-F)<=1E-6*Math.max(1,Math.abs(w),Math.abs(F))&&Math.abs(z-H)<=1E-6*Math.max(1,Math.abs(z),Math.abs(H))&&Math.abs(D-K)<=1E-6*Math.max(1,Math.abs(D),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},multiplyScalar:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;return k},multiplyScalarAndAdd:function(k,n,w,z){k[0]=n[0]+w[0]*z;k[1]=n[1]+w[1]*z;k[2]=n[2]+w[2]*z;k[3]=n[3]+w[3]*z;return k},mul:b,sub:a}),Fb=Object.freeze({__proto__:null,
create:function(){var k=new sa(6);sa!=Float32Array&&(k[1]=0,k[2]=0,k[4]=0,k[5]=0);k[0]=1;k[3]=1;return k},clone:function(k){var n=new sa(6);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;return k},fromValues:function(k,n,w,z,D,F){var H=new sa(6);H[0]=k;H[1]=n;H[2]=w;H[3]=z;H[4]=D;H[5]=F;return H},set:function(k,n,w,z,D,F,H){k[0]=
n;k[1]=w;k[2]=z;k[3]=D;k[4]=F;k[5]=H;return k},invert:function(k,n){var w=n[0],z=n[1],D=n[2],F=n[3],H=n[4];n=n[5];var K=w*F-z*D;if(!K)return null;K=1/K;k[0]=F*K;k[1]=-z*K;k[2]=-D*K;k[3]=w*K;k[4]=(D*n-F*H)*K;k[5]=(z*H-w*n)*K;return k},determinant:function(k){return k[0]*k[3]-k[1]*k[2]},multiply:c,rotate:function(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=n[4];n=n[5];var M=Math.sin(w);w=Math.cos(w);k[0]=z*w+F*M;k[1]=D*w+H*M;k[2]=z*-M+F*w;k[3]=D*-M+H*w;k[4]=K;k[5]=n;return k},scale:function(k,n,w){var z=
n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=w[0];w=w[1];k[0]=n[0]*M;k[1]=z*M;k[2]=D*w;k[3]=F*w;k[4]=H;k[5]=K;return k},translate:function(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=n[4];n=n[5];var M=w[0];w=w[1];k[0]=z;k[1]=D;k[2]=F;k[3]=H;k[4]=z*M+F*w+K;k[5]=D*M+H*w+n;return k},fromRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=w;k[2]=-w;k[3]=n;k[4]=0;k[5]=0;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=n[1];k[4]=0;k[5]=0;return k},fromTranslation:function(k,n){k[0]=1;
k[1]=0;k[2]=0;k[3]=1;k[4]=n[0];k[5]=n[1];return k},str:function(k){return"mat2d("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],1)},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];k[4]=n[4]+w[4];k[5]=n[5]+w[5];return k},subtract:d,multiplyScalar:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;k[4]=n[4]*w;k[5]=n[5]*w;return k},multiplyScalarAndAdd:function(k,n,w,z){k[0]=n[0]+
w[0]*z;k[1]=n[1]+w[1]*z;k[2]=n[2]+w[2]*z;k[3]=n[3]+w[3]*z;k[4]=n[4]+w[4]*z;k[5]=n[5]+w[5]*z;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]},equals:function(k,n){var w=k[0],z=k[1],D=k[2],F=k[3],H=k[4];k=k[5];var K=n[0],M=n[1],O=n[2],R=n[3],T=n[4];n=n[5];return Math.abs(w-K)<=1E-6*Math.max(1,Math.abs(w),Math.abs(K))&&Math.abs(z-M)<=1E-6*Math.max(1,Math.abs(z),Math.abs(M))&&Math.abs(D-O)<=1E-6*Math.max(1,Math.abs(D),Math.abs(O))&&
Math.abs(F-R)<=1E-6*Math.max(1,Math.abs(F),Math.abs(R))&&Math.abs(H-T)<=1E-6*Math.max(1,Math.abs(H),Math.abs(T))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:c,sub:d}),Gb=Object.freeze({__proto__:null,create:f,fromMat4:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[4];k[4]=n[5];k[5]=n[6];k[6]=n[8];k[7]=n[9];k[8]=n[10];return k},clone:function(k){var n=new sa(9);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];return n},copy:function(k,
n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromValues:function(k,n,w,z,D,F,H,K,M){var O=new sa(9);O[0]=k;O[1]=n;O[2]=w;O[3]=z;O[4]=D;O[5]=F;O[6]=H;O[7]=K;O[8]=M;return O},set:function(k,n,w,z,D,F,H,K,M,O){k[0]=n;k[1]=w;k[2]=z;k[3]=D;k[4]=F;k[5]=H;k[6]=K;k[7]=M;k[8]=O;return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},transpose:function(k,n){if(k===n){var w=n[1],z=n[2],D=n[5];k[1]=n[3];
k[2]=n[6];k[3]=w;k[5]=n[7];k[6]=z;k[7]=D}else k[0]=n[0],k[1]=n[3],k[2]=n[6],k[3]=n[1],k[4]=n[4],k[5]=n[7],k[6]=n[2],k[7]=n[5],k[8]=n[8];return k},invert:function(k,n){var w=n[0],z=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=n[6],O=n[7];n=n[8];var R=n*H-K*O,T=-n*F+K*M,Y=O*F-H*M,X=w*R+z*T+D*Y;if(!X)return null;X=1/X;k[0]=R*X;k[1]=(-n*z+D*O)*X;k[2]=(K*z-D*H)*X;k[3]=T*X;k[4]=(n*w-D*M)*X;k[5]=(-K*w+D*F)*X;k[6]=Y*X;k[7]=(-O*w+z*M)*X;k[8]=(H*w-z*F)*X;return k},adjoint:function(k,n){var w=n[0],z=n[1],D=n[2],F=n[3],
H=n[4],K=n[5],M=n[6],O=n[7];n=n[8];k[0]=H*n-K*O;k[1]=D*O-z*n;k[2]=z*K-D*H;k[3]=K*M-F*n;k[4]=w*n-D*M;k[5]=D*F-w*K;k[6]=F*O-H*M;k[7]=z*M-w*O;k[8]=w*H-z*F;return k},determinant:function(k){var n=k[3],w=k[4],z=k[5],D=k[6],F=k[7],H=k[8];return k[0]*(H*w-z*F)+k[1]*(-H*n+z*D)+k[2]*(F*n-w*D)},multiply:h,translate:function(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=w[0];w=w[1];k[0]=z;k[1]=D;k[2]=F;k[3]=H;k[4]=K;k[5]=M;k[6]=T*z+w*H+O;k[7]=T*D+w*K+R;k[8]=T*F+w*M+n;return k},
rotate:function(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=Math.sin(w);w=Math.cos(w);k[0]=w*z+T*H;k[1]=w*D+T*K;k[2]=w*F+T*M;k[3]=w*H-T*z;k[4]=w*K-T*D;k[5]=w*M-T*F;k[6]=O;k[7]=R;k[8]=n;return k},scale:function(k,n,w){var z=w[0];w=w[1];k[0]=z*n[0];k[1]=z*n[1];k[2]=z*n[2];k[3]=w*n[3];k[4]=w*n[4];k[5]=w*n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=n[0];k[7]=n[1];k[8]=1;return k},fromRotation:function(k,
n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=w;k[2]=0;k[3]=-w;k[4]=n;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=n[1];k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromMat2d:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=0;k[3]=n[2];k[4]=n[3];k[5]=0;k[6]=n[4];k[7]=n[5];k[8]=1;return k},fromQuat:function(k,n){var w=n[0],z=n[1],D=n[2];n=n[3];var F=w+w,H=z+z,K=D+D;w*=F;var M=z*F;z*=H;var O=D*F,R=D*H;D*=K;F*=n;H*=n;n*=K;k[0]=1-z-D;k[3]=M-n;k[6]=O+H;k[1]=M+n;k[4]=
1-w-D;k[7]=R-F;k[2]=O-H;k[5]=R+F;k[8]=1-w-z;return k},normalFromMat4:function(k,n){var w=n[0],z=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=w*K-z*H,ka=w*M-D*H,ta=w*O-F*H,ua=z*M-D*K,ra=z*O-F*K,Ca=D*O-F*M,Da=R*ha-T*fa,Ea=R*ba-Y*fa;R=R*n-X*fa;var Fa=T*ba-Y*ha;T=T*n-X*ha;Y=Y*n-X*ba;X=qa*Y-ka*T+ta*Fa+ua*R-ra*Ea+Ca*Da;if(!X)return null;X=1/X;k[0]=(K*Y-M*T+O*Fa)*X;k[1]=(M*R-H*Y-O*Ea)*X;k[2]=(H*T-K*R+O*Da)*X;k[3]=(D*T-z*Y-F*Fa)*X;
k[4]=(w*Y-D*R+F*Ea)*X;k[5]=(z*R-w*T-F*Da)*X;k[6]=(ha*Ca-ba*ra+n*ua)*X;k[7]=(ba*ta-fa*Ca-n*ka)*X;k[8]=(fa*ra-ha*ta+n*qa)*X;return k},projection:function(k,n,w){k[0]=2/n;k[1]=0;k[2]=0;k[3]=0;k[4]=-2/w;k[5]=0;k[6]=-1;k[7]=1;k[8]=1;return k},str:function(k){return"mat3("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+", "+k[8]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8])},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];
k[3]=n[3]+w[3];k[4]=n[4]+w[4];k[5]=n[5]+w[5];k[6]=n[6]+w[6];k[7]=n[7]+w[7];k[8]=n[8]+w[8];return k},subtract:g,multiplyScalar:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;k[4]=n[4]*w;k[5]=n[5]*w;k[6]=n[6]*w;k[7]=n[7]*w;k[8]=n[8]*w;return k},multiplyScalarAndAdd:function(k,n,w,z){k[0]=n[0]+w[0]*z;k[1]=n[1]+w[1]*z;k[2]=n[2]+w[2]*z;k[3]=n[3]+w[3]*z;k[4]=n[4]+w[4]*z;k[5]=n[5]+w[5]*z;k[6]=n[6]+w[6]*z;k[7]=n[7]+w[7]*z;k[8]=n[8]+w[8]*z;return k},exactEquals:function(k,n){return k[0]===
n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]&&k[8]===n[8]},equals:function(k,n){var w=k[0],z=k[1],D=k[2],F=k[3],H=k[4],K=k[5],M=k[6],O=k[7];k=k[8];var R=n[0],T=n[1],Y=n[2],X=n[3],fa=n[4],ha=n[5],ba=n[6],qa=n[7];n=n[8];return Math.abs(w-R)<=1E-6*Math.max(1,Math.abs(w),Math.abs(R))&&Math.abs(z-T)<=1E-6*Math.max(1,Math.abs(z),Math.abs(T))&&Math.abs(D-Y)<=1E-6*Math.max(1,Math.abs(D),Math.abs(Y))&&Math.abs(F-X)<=1E-6*Math.max(1,Math.abs(F),Math.abs(X))&&
Math.abs(H-fa)<=1E-6*Math.max(1,Math.abs(H),Math.abs(fa))&&Math.abs(K-ha)<=1E-6*Math.max(1,Math.abs(K),Math.abs(ha))&&Math.abs(M-ba)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ba))&&Math.abs(O-qa)<=1E-6*Math.max(1,Math.abs(O),Math.abs(qa))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:h,sub:g}),Hb=Object.freeze({__proto__:null,create:function(){var k=new sa(16);sa!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[4]=0,k[6]=0,k[7]=0,k[8]=0,k[9]=0,k[11]=0,k[12]=0,k[13]=0,k[14]=0);k[0]=1;k[5]=1;k[10]=
1;k[15]=1;return k},clone:function(k){var n=new sa(16);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];n[9]=k[9];n[10]=k[10];n[11]=k[11];n[12]=k[12];n[13]=k[13];n[14]=k[14];n[15]=k[15];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];k[9]=n[9];k[10]=n[10];k[11]=n[11];k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},fromValues:function(k,n,w,z,D,F,H,K,M,O,R,T,Y,X,fa,ha){var ba=new sa(16);
ba[0]=k;ba[1]=n;ba[2]=w;ba[3]=z;ba[4]=D;ba[5]=F;ba[6]=H;ba[7]=K;ba[8]=M;ba[9]=O;ba[10]=R;ba[11]=T;ba[12]=Y;ba[13]=X;ba[14]=fa;ba[15]=ha;return ba},set:function(k,n,w,z,D,F,H,K,M,O,R,T,Y,X,fa,ha,ba){k[0]=n;k[1]=w;k[2]=z;k[3]=D;k[4]=F;k[5]=H;k[6]=K;k[7]=M;k[8]=O;k[9]=R;k[10]=T;k[11]=Y;k[12]=X;k[13]=fa;k[14]=ha;k[15]=ba;return k},identity:l,transpose:function(k,n){if(k===n){var w=n[1],z=n[2],D=n[3],F=n[6],H=n[7],K=n[11];k[1]=n[4];k[2]=n[8];k[3]=n[12];k[4]=w;k[6]=n[9];k[7]=n[13];k[8]=z;k[9]=F;k[11]=n[14];
k[12]=D;k[13]=H;k[14]=K}else k[0]=n[0],k[1]=n[4],k[2]=n[8],k[3]=n[12],k[4]=n[1],k[5]=n[5],k[6]=n[9],k[7]=n[13],k[8]=n[2],k[9]=n[6],k[10]=n[10],k[11]=n[14],k[12]=n[3],k[13]=n[7],k[14]=n[11],k[15]=n[15];return k},invert:function(k,n){var w=n[0],z=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=w*K-z*H,ka=w*M-D*H,ta=w*O-F*H,ua=z*M-D*K,ra=z*O-F*K,Ca=D*O-F*M,Da=R*ha-T*fa,Ea=R*ba-Y*fa,Fa=R*n-X*fa,Ka=T*ba-Y*ha,Pa=T*n-X*ha,Qa=Y*n-X*ba,
Ga=qa*Qa-ka*Pa+ta*Ka+ua*Fa-ra*Ea+Ca*Da;if(!Ga)return null;Ga=1/Ga;k[0]=(K*Qa-M*Pa+O*Ka)*Ga;k[1]=(D*Pa-z*Qa-F*Ka)*Ga;k[2]=(ha*Ca-ba*ra+n*ua)*Ga;k[3]=(Y*ra-T*Ca-X*ua)*Ga;k[4]=(M*Fa-H*Qa-O*Ea)*Ga;k[5]=(w*Qa-D*Fa+F*Ea)*Ga;k[6]=(ba*ta-fa*Ca-n*ka)*Ga;k[7]=(R*Ca-Y*ta+X*ka)*Ga;k[8]=(H*Pa-K*Fa+O*Da)*Ga;k[9]=(z*Fa-w*Pa-F*Da)*Ga;k[10]=(fa*ra-ha*ta+n*qa)*Ga;k[11]=(T*ta-R*ra-X*qa)*Ga;k[12]=(K*Ea-H*Ka-M*Da)*Ga;k[13]=(w*Ka-z*Ea+D*Da)*Ga;k[14]=(ha*ka-fa*ua-ba*qa)*Ga;k[15]=(R*ua-T*ka+Y*qa)*Ga;return k},adjoint:function(k,
n){var w=n[0],z=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=w*K-z*H,ka=w*M-D*H,ta=w*O-F*H,ua=z*M-D*K,ra=z*O-F*K,Ca=D*O-F*M,Da=R*ha-T*fa,Ea=R*ba-Y*fa,Fa=R*n-X*fa,Ka=T*ba-Y*ha,Pa=T*n-X*ha,Qa=Y*n-X*ba;k[0]=K*Qa-M*Pa+O*Ka;k[1]=D*Pa-z*Qa-F*Ka;k[2]=ha*Ca-ba*ra+n*ua;k[3]=Y*ra-T*Ca-X*ua;k[4]=M*Fa-H*Qa-O*Ea;k[5]=w*Qa-D*Fa+F*Ea;k[6]=ba*ta-fa*Ca-n*ka;k[7]=R*Ca-Y*ta+X*ka;k[8]=H*Pa-K*Fa+O*Da;k[9]=z*Fa-w*Pa-F*Da;k[10]=fa*ra-ha*ta+n*qa;k[11]=
T*ta-R*ra-X*qa;k[12]=K*Ea-H*Ka-M*Da;k[13]=w*Ka-z*Ea+D*Da;k[14]=ha*ka-fa*ua-ba*qa;k[15]=R*ua-T*ka+Y*qa;return k},determinant:function(k){var n=k[0],w=k[1],z=k[2],D=k[4],F=k[5],H=k[6],K=k[8],M=k[9],O=k[10],R=k[12],T=k[13],Y=k[14],X=n*F-w*D,fa=n*H-z*D,ha=w*H-z*F,ba=K*T-M*R,qa=K*Y-O*R,ka=M*Y-O*T;return k[7]*(n*ka-w*qa+z*ba)-k[3]*(D*ka-F*qa+H*ba)+k[15]*(K*ha-M*fa+O*X)-k[11]*(R*ha-T*fa+Y*X)},multiply:m,translate:function(k,n,w){var z=w[0],D=w[1];w=w[2];if(n===k)k[12]=n[0]*z+n[4]*D+n[8]*w+n[12],k[13]=n[1]*
z+n[5]*D+n[9]*w+n[13],k[14]=n[2]*z+n[6]*D+n[10]*w+n[14],k[15]=n[3]*z+n[7]*D+n[11]*w+n[15];else{var F=n[0];var H=n[1];var K=n[2];var M=n[3];var O=n[4];var R=n[5];var T=n[6];var Y=n[7];var X=n[8];var fa=n[9];var ha=n[10];var ba=n[11];k[0]=F;k[1]=H;k[2]=K;k[3]=M;k[4]=O;k[5]=R;k[6]=T;k[7]=Y;k[8]=X;k[9]=fa;k[10]=ha;k[11]=ba;k[12]=F*z+O*D+X*w+n[12];k[13]=H*z+R*D+fa*w+n[13];k[14]=K*z+T*D+ha*w+n[14];k[15]=M*z+Y*D+ba*w+n[15]}return k},scale:function(k,n,w){var z=w[0],D=w[1];w=w[2];k[0]=n[0]*z;k[1]=n[1]*z;
k[2]=n[2]*z;k[3]=n[3]*z;k[4]=n[4]*D;k[5]=n[5]*D;k[6]=n[6]*D;k[7]=n[7]*D;k[8]=n[8]*w;k[9]=n[9]*w;k[10]=n[10]*w;k[11]=n[11]*w;k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},rotate:function(k,n,w,z){var D=z[0],F=z[1];z=z[2];var H=Math.hypot(D,F,z);if(1E-6>H)return null;H=1/H;D*=H;F*=H;z*=H;var K=Math.sin(w);var M=Math.cos(w);var O=1-M;w=n[0];H=n[1];var R=n[2];var T=n[3];var Y=n[4];var X=n[5];var fa=n[6];var ha=n[7];var ba=n[8];var qa=n[9];var ka=n[10];var ta=n[11];var ua=D*D*O+M;var ra=F*
D*O+z*K;var Ca=z*D*O-F*K;var Da=D*F*O-z*K;var Ea=F*F*O+M;var Fa=z*F*O+D*K;var Ka=D*z*O+F*K;D=F*z*O-D*K;F=z*z*O+M;k[0]=w*ua+Y*ra+ba*Ca;k[1]=H*ua+X*ra+qa*Ca;k[2]=R*ua+fa*ra+ka*Ca;k[3]=T*ua+ha*ra+ta*Ca;k[4]=w*Da+Y*Ea+ba*Fa;k[5]=H*Da+X*Ea+qa*Fa;k[6]=R*Da+fa*Ea+ka*Fa;k[7]=T*Da+ha*Ea+ta*Fa;k[8]=w*Ka+Y*D+ba*F;k[9]=H*Ka+X*D+qa*F;k[10]=R*Ka+fa*D+ka*F;k[11]=T*Ka+ha*D+ta*F;n!==k&&(k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);return k},rotateX:function(k,n,w){var z=Math.sin(w);w=Math.cos(w);var D=n[4],F=
n[5],H=n[6],K=n[7],M=n[8],O=n[9],R=n[10],T=n[11];n!==k&&(k[0]=n[0],k[1]=n[1],k[2]=n[2],k[3]=n[3],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[4]=D*w+M*z;k[5]=F*w+O*z;k[6]=H*w+R*z;k[7]=K*w+T*z;k[8]=M*w-D*z;k[9]=O*w-F*z;k[10]=R*w-H*z;k[11]=T*w-K*z;return k},rotateY:function(k,n,w){var z=Math.sin(w);w=Math.cos(w);var D=n[0],F=n[1],H=n[2],K=n[3],M=n[8],O=n[9],R=n[10],T=n[11];n!==k&&(k[4]=n[4],k[5]=n[5],k[6]=n[6],k[7]=n[7],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=D*w-M*z;k[1]=F*w-O*
z;k[2]=H*w-R*z;k[3]=K*w-T*z;k[8]=D*z+M*w;k[9]=F*z+O*w;k[10]=H*z+R*w;k[11]=K*z+T*w;return k},rotateZ:function(k,n,w){var z=Math.sin(w);w=Math.cos(w);var D=n[0],F=n[1],H=n[2],K=n[3],M=n[4],O=n[5],R=n[6],T=n[7];n!==k&&(k[8]=n[8],k[9]=n[9],k[10]=n[10],k[11]=n[11],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=D*w+M*z;k[1]=F*w+O*z;k[2]=H*w+R*z;k[3]=K*w+T*z;k[4]=M*w-D*z;k[5]=O*w-F*z;k[6]=R*w-H*z;k[7]=T*w-K*z;return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;
k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=n[0];k[13]=n[1];k[14]=n[2];k[15]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n[1];k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=n[2];k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotation:function(k,n,w){var z=w[0],D=w[1];w=w[2];var F=Math.hypot(z,D,w);if(1E-6>F)return null;F=1/F;z*=F;D*=F;w*=F;F=Math.sin(n);n=Math.cos(n);var H=1-n;k[0]=z*z*H+n;k[1]=D*z*H+w*F;k[2]=w*z*H-D*F;k[3]=0;k[4]=z*D*H-w*F;k[5]=D*D*H+n;k[6]=w*D*H+z*
F;k[7]=0;k[8]=z*w*H+D*F;k[9]=D*w*H-z*F;k[10]=w*w*H+n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromXRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=w;k[7]=0;k[8]=0;k[9]=-w;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromYRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=0;k[2]=-w;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=w;k[9]=0;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromZRotation:function(k,
n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=w;k[2]=0;k[3]=0;k[4]=-w;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotationTranslation:u,fromQuat2:function(k,n){var w=new sa(3),z=-n[0],D=-n[1],F=-n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=z*z+D*D+F*F+H*H;0<T?(w[0]=2*(K*H+R*z+M*F-O*D)/T,w[1]=2*(M*H+R*D+O*z-K*F)/T,w[2]=2*(O*H+R*F+K*D-M*z)/T):(w[0]=2*(K*H+R*z+M*F-O*D),w[1]=2*(M*H+R*D+O*z-K*F),w[2]=2*(O*H+R*F+K*D-M*z));u(k,n,w);return k},getTranslation:v,
getScaling:t,getRotation:q,decompose:function(k,n,w,z){n[0]=z[12];n[1]=z[13];n[2]=z[14];var D=z[0],F=z[1],H=z[2],K=z[4],M=z[5],O=z[6],R=z[8];n=z[9];z=z[10];w[0]=Math.hypot(D,F,H);w[1]=Math.hypot(K,M,O);w[2]=Math.hypot(R,n,z);var T=1/w[0],Y=1/w[1],X=1/w[2];w=D*T;F*=Y;H*=X;K*=T;M*=Y;O*=X;R*=T;n*=Y;z*=X;Y=w+M+z;0<Y?(z=2*Math.sqrt(Y+1),k[3]=.25*z,k[0]=(O-n)/z,k[1]=(R-H)/z,k[2]=(F-K)/z):w>M&&w>z?(z=2*Math.sqrt(1+w-M-z),k[3]=(O-n)/z,k[0]=.25*z,k[1]=(F+K)/z,k[2]=(R+H)/z):M>z?(z=2*Math.sqrt(1+M-w-z),k[3]=
(R-H)/z,k[0]=(F+K)/z,k[1]=.25*z,k[2]=(O+n)/z):(z=2*Math.sqrt(1+z-w-M),k[3]=(F-K)/z,k[0]=(R+H)/z,k[1]=(O+n)/z,k[2]=.25*z);return k},fromRotationTranslationScale:function(k,n,w,z){var D=n[0],F=n[1],H=n[2],K=n[3],M=D+D,O=F+F,R=H+H;n=D*M;var T=D*O;D*=R;var Y=F*O;F*=R;H*=R;M*=K;O*=K;K*=R;R=z[0];var X=z[1];z=z[2];k[0]=(1-(Y+H))*R;k[1]=(T+K)*R;k[2]=(D-O)*R;k[3]=0;k[4]=(T-K)*X;k[5]=(1-(n+H))*X;k[6]=(F+M)*X;k[7]=0;k[8]=(D+O)*z;k[9]=(F-M)*z;k[10]=(1-(n+Y))*z;k[11]=0;k[12]=w[0];k[13]=w[1];k[14]=w[2];k[15]=1;
return k},fromRotationTranslationScaleOrigin:function(k,n,w,z,D){var F=n[0],H=n[1],K=n[2],M=n[3],O=F+F,R=H+H,T=K+K;n=F*O;var Y=F*R,X=F*T;F=H*R;H*=T;var fa=K*T;K=M*O;R*=M;var ha=M*T,ba=z[0],qa=z[1];T=z[2];z=D[0];M=D[1];D=D[2];O=(1-(F+fa))*ba;var ka=(Y+ha)*ba;ba*=X-R;Y=(Y-ha)*qa;fa=(1-(n+fa))*qa;qa*=H+K;X=(X+R)*T;H=(H-K)*T;n=(1-(n+F))*T;k[0]=O;k[1]=ka;k[2]=ba;k[3]=0;k[4]=Y;k[5]=fa;k[6]=qa;k[7]=0;k[8]=X;k[9]=H;k[10]=n;k[11]=0;k[12]=w[0]+z-(O*z+Y*M+X*D);k[13]=w[1]+M-(ka*z+fa*M+H*D);k[14]=w[2]+D-(ba*z+
qa*M+n*D);k[15]=1;return k},fromQuat:function(k,n){var w=n[0],z=n[1],D=n[2];n=n[3];var F=w+w,H=z+z,K=D+D;w*=F;var M=z*F;z*=H;var O=D*F,R=D*H;D*=K;F*=n;H*=n;n*=K;k[0]=1-z-D;k[1]=M+n;k[2]=O-H;k[3]=0;k[4]=M-n;k[5]=1-w-D;k[6]=R+F;k[7]=0;k[8]=O+H;k[9]=R-F;k[10]=1-w-z;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},frustum:function(k,n,w,z,D,F,H){var K=1/(w-n),M=1/(D-z),O=1/(F-H);k[0]=2*F*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2*F*M;k[6]=0;k[7]=0;k[8]=(w+n)*K;k[9]=(D+z)*M;k[10]=(H+F)*O;k[11]=-1;k[12]=0;k[13]=
0;k[14]=H*F*2*O;k[15]=0;return k},perspectiveNO:p,perspective:p,perspectiveZO:function(k,n,w,z,D){n=1/Math.tan(n/2);k[0]=n/w;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[11]=-1;k[12]=0;k[13]=0;k[15]=0;null!=D&&Infinity!==D?(w=1/(z-D),k[10]=D*w,k[14]=D*z*w):(k[10]=-1,k[14]=-z);return k},perspectiveFromFieldOfView:function(k,n,w,z){var D=Math.tan(n.upDegrees*Math.PI/180),F=Math.tan(n.downDegrees*Math.PI/180),H=Math.tan(n.leftDegrees*Math.PI/180);n=Math.tan(n.rightDegrees*Math.PI/
180);var K=2/(H+n),M=2/(D+F);k[0]=K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=M;k[6]=0;k[7]=0;k[8]=-((H-n)*K*.5);k[9]=(D-F)*M*.5;k[10]=z/(w-z);k[11]=-1;k[12]=0;k[13]=0;k[14]=z*w/(w-z);k[15]=0;return k},orthoNO:r,ortho:r,orthoZO:function(k,n,w,z,D,F,H){var K=1/(n-w),M=1/(z-D);H=1/(F-H);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=H;k[11]=0;k[12]=(n+w)*K;k[13]=(D+z)*M;k[14]=F*H;k[15]=1;return k},lookAt:function(k,n,w,z){var D=n[0],F=n[1];n=n[2];var H=z[0];var K=z[1];var M=
z[2];var O=w[0];z=w[1];var R=w[2];if(1E-6>Math.abs(D-O)&&1E-6>Math.abs(F-z)&&1E-6>Math.abs(n-R))return l(k);w=D-O;z=F-z;O=n-R;var T=1/Math.hypot(w,z,O);w*=T;z*=T;O*=T;R=K*O-M*z;M=M*w-H*O;H=H*z-K*w;(T=Math.hypot(R,M,H))?(T=1/T,R*=T,M*=T,H*=T):H=M=R=0;K=z*H-O*M;var Y=O*R-w*H;var X=w*M-z*R;(T=Math.hypot(K,Y,X))?(T=1/T,K*=T,Y*=T,X*=T):X=Y=K=0;k[0]=R;k[1]=K;k[2]=w;k[3]=0;k[4]=M;k[5]=Y;k[6]=z;k[7]=0;k[8]=H;k[9]=X;k[10]=O;k[11]=0;k[12]=-(R*D+M*F+H*n);k[13]=-(K*D+Y*F+X*n);k[14]=-(w*D+z*F+O*n);k[15]=1;return k},
targetTo:function(k,n,w,z){var D=n[0],F=n[1];n=n[2];var H=z[0],K=z[1],M=z[2];z=D-w[0];var O=F-w[1];w=n-w[2];var R=z*z+O*O+w*w;0<R&&(R=1/Math.sqrt(R),z*=R,O*=R,w*=R);var T=K*w-M*O;M=M*z-H*w;H=H*O-K*z;R=T*T+M*M+H*H;0<R&&(R=1/Math.sqrt(R),T*=R,M*=R,H*=R);k[0]=T;k[1]=M;k[2]=H;k[3]=0;k[4]=O*H-w*M;k[5]=w*T-z*H;k[6]=z*M-O*T;k[7]=0;k[8]=z;k[9]=O;k[10]=w;k[11]=0;k[12]=D;k[13]=F;k[14]=n;k[15]=1;return k},str:function(k){return"mat4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+
", "+k[8]+", "+k[9]+", "+k[10]+", "+k[11]+", "+k[12]+", "+k[13]+", "+k[14]+", "+k[15]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15])},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];k[4]=n[4]+w[4];k[5]=n[5]+w[5];k[6]=n[6]+w[6];k[7]=n[7]+w[7];k[8]=n[8]+w[8];k[9]=n[9]+w[9];k[10]=n[10]+w[10];k[11]=n[11]+w[11];k[12]=n[12]+w[12];k[13]=n[13]+w[13];k[14]=n[14]+w[14];k[15]=n[15]+w[15];return k},
subtract:x,multiplyScalar:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;k[4]=n[4]*w;k[5]=n[5]*w;k[6]=n[6]*w;k[7]=n[7]*w;k[8]=n[8]*w;k[9]=n[9]*w;k[10]=n[10]*w;k[11]=n[11]*w;k[12]=n[12]*w;k[13]=n[13]*w;k[14]=n[14]*w;k[15]=n[15]*w;return k},multiplyScalarAndAdd:function(k,n,w,z){k[0]=n[0]+w[0]*z;k[1]=n[1]+w[1]*z;k[2]=n[2]+w[2]*z;k[3]=n[3]+w[3]*z;k[4]=n[4]+w[4]*z;k[5]=n[5]+w[5]*z;k[6]=n[6]+w[6]*z;k[7]=n[7]+w[7]*z;k[8]=n[8]+w[8]*z;k[9]=n[9]+w[9]*z;k[10]=n[10]+w[10]*z;k[11]=n[11]+w[11]*
z;k[12]=n[12]+w[12]*z;k[13]=n[13]+w[13]*z;k[14]=n[14]+w[14]*z;k[15]=n[15]+w[15]*z;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]&&k[8]===n[8]&&k[9]===n[9]&&k[10]===n[10]&&k[11]===n[11]&&k[12]===n[12]&&k[13]===n[13]&&k[14]===n[14]&&k[15]===n[15]},equals:function(k,n){var w=k[0],z=k[1],D=k[2],F=k[3],H=k[4],K=k[5],M=k[6],O=k[7],R=k[8],T=k[9],Y=k[10],X=k[11],fa=k[12],ha=k[13],ba=k[14];k=k[15];var qa=n[0],
ka=n[1],ta=n[2],ua=n[3],ra=n[4],Ca=n[5],Da=n[6],Ea=n[7],Fa=n[8],Ka=n[9],Pa=n[10],Qa=n[11],Ga=n[12],Bb=n[13],Cb=n[14];n=n[15];return Math.abs(w-qa)<=1E-6*Math.max(1,Math.abs(w),Math.abs(qa))&&Math.abs(z-ka)<=1E-6*Math.max(1,Math.abs(z),Math.abs(ka))&&Math.abs(D-ta)<=1E-6*Math.max(1,Math.abs(D),Math.abs(ta))&&Math.abs(F-ua)<=1E-6*Math.max(1,Math.abs(F),Math.abs(ua))&&Math.abs(H-ra)<=1E-6*Math.max(1,Math.abs(H),Math.abs(ra))&&Math.abs(K-Ca)<=1E-6*Math.max(1,Math.abs(K),Math.abs(Ca))&&Math.abs(M-Da)<=
1E-6*Math.max(1,Math.abs(M),Math.abs(Da))&&Math.abs(O-Ea)<=1E-6*Math.max(1,Math.abs(O),Math.abs(Ea))&&Math.abs(R-Fa)<=1E-6*Math.max(1,Math.abs(R),Math.abs(Fa))&&Math.abs(T-Ka)<=1E-6*Math.max(1,Math.abs(T),Math.abs(Ka))&&Math.abs(Y-Pa)<=1E-6*Math.max(1,Math.abs(Y),Math.abs(Pa))&&Math.abs(X-Qa)<=1E-6*Math.max(1,Math.abs(X),Math.abs(Qa))&&Math.abs(fa-Ga)<=1E-6*Math.max(1,Math.abs(fa),Math.abs(Ga))&&Math.abs(ha-Bb)<=1E-6*Math.max(1,Math.abs(ha),Math.abs(Bb))&&Math.abs(ba-Cb)<=1E-6*Math.max(1,Math.abs(ba),
Math.abs(Cb))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:m,sub:x}),wb=function(){var k=y();return function(n,w,z,D,F,H){w||(w=3);z||(z=0);for(D=D?Math.min(D*w+z,n.length):n.length;z<D;z+=w)k[0]=n[z],k[1]=n[z+1],k[2]=n[z+2],F(k,k,H),n[z]=k[0],n[z+1]=k[1],n[z+2]=k[2];return n}}();wb=Object.freeze({__proto__:null,create:y,clone:function(k){var n=new sa(3);n[0]=k[0];n[1]=k[1];n[2]=k[2];return n},length:C,fromValues:G,copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];return k},set:function(k,
n,w,z){k[0]=n;k[1]=w;k[2]=z;return k},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];return k},subtract:A,multiply:E,divide:J,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);k[2]=Math.ceil(n[2]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);k[2]=Math.floor(n[2]);return k},min:function(k,n,w){k[0]=Math.min(n[0],w[0]);k[1]=Math.min(n[1],w[1]);k[2]=Math.min(n[2],w[2]);return k},max:function(k,n,w){k[0]=Math.max(n[0],w[0]);k[1]=Math.max(n[1],
w[1]);k[2]=Math.max(n[2],w[2]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);k[2]=Math.round(n[2]);return k},scale:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;return k},scaleAndAdd:function(k,n,w,z){k[0]=n[0]+w[0]*z;k[1]=n[1]+w[1]*z;k[2]=n[2]+w[2]*z;return k},distance:B,squaredDistance:I,squaredLength:L,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];k[2]=1/n[2];return k},normalize:P,dot:S,cross:U,lerp:function(k,
n,w,z){var D=n[0],F=n[1];n=n[2];k[0]=D+z*(w[0]-D);k[1]=F+z*(w[1]-F);k[2]=n+z*(w[2]-n);return k},slerp:function(k,n,w,z){var D=Math.acos(Math.min(Math.max(S(n,w),-1),1)),F=Math.sin(D),H=Math.sin((1-z)*D)/F;z=Math.sin(z*D)/F;k[0]=H*n[0]+z*w[0];k[1]=H*n[1]+z*w[1];k[2]=H*n[2]+z*w[2];return k},hermite:function(k,n,w,z,D,F){var H=F*F,K=H*(2*F-3)+1,M=H*(F-2)+F,O=H*(F-1);F=H*(3-2*F);k[0]=n[0]*K+w[0]*M+z[0]*O+D[0]*F;k[1]=n[1]*K+w[1]*M+z[1]*O+D[1]*F;k[2]=n[2]*K+w[2]*M+z[2]*O+D[2]*F;return k},bezier:function(k,
n,w,z,D,F){var H=1-F,K=H*H,M=F*F,O=K*H;K*=3*F;H*=3*M;F*=M;k[0]=n[0]*O+w[0]*K+z[0]*H+D[0]*F;k[1]=n[1]*O+w[1]*K+z[1]*H+D[1]*F;k[2]=n[2]*O+w[2]*K+z[2]*H+D[2]*F;return k},random:function(k,n){n=n||1;var w=2*Sa()*Math.PI,z=2*Sa()-1,D=Math.sqrt(1-z*z)*n;k[0]=Math.cos(w)*D;k[1]=Math.sin(w)*D;k[2]=z*n;return k},transformMat4:function(k,n,w){var z=n[0],D=n[1];n=n[2];var F=w[3]*z+w[7]*D+w[11]*n+w[15];F=F||1;k[0]=(w[0]*z+w[4]*D+w[8]*n+w[12])/F;k[1]=(w[1]*z+w[5]*D+w[9]*n+w[13])/F;k[2]=(w[2]*z+w[6]*D+w[10]*n+
w[14])/F;return k},transformMat3:function(k,n,w){var z=n[0],D=n[1];n=n[2];k[0]=z*w[0]+D*w[3]+n*w[6];k[1]=z*w[1]+D*w[4]+n*w[7];k[2]=z*w[2]+D*w[5]+n*w[8];return k},transformQuat:function(k,n,w){var z=w[0],D=w[1],F=w[2],H=n[0],K=n[1];n=n[2];var M=D*n-F*K,O=F*H-z*n,R=z*K-D*H;w=2*w[3];k[0]=H+M*w+2*(D*R-F*O);k[1]=K+O*w+2*(F*M-z*R);k[2]=n+R*w+2*(z*O-D*M);return k},rotateX:function(k,n,w,z){var D=[],F=[];D[0]=n[0]-w[0];D[1]=n[1]-w[1];D[2]=n[2]-w[2];F[0]=D[0];F[1]=D[1]*Math.cos(z)-D[2]*Math.sin(z);F[2]=D[1]*
Math.sin(z)+D[2]*Math.cos(z);k[0]=F[0]+w[0];k[1]=F[1]+w[1];k[2]=F[2]+w[2];return k},rotateY:function(k,n,w,z){var D=[],F=[];D[0]=n[0]-w[0];D[1]=n[1]-w[1];D[2]=n[2]-w[2];F[0]=D[2]*Math.sin(z)+D[0]*Math.cos(z);F[1]=D[1];F[2]=D[2]*Math.cos(z)-D[0]*Math.sin(z);k[0]=F[0]+w[0];k[1]=F[1]+w[1];k[2]=F[2]+w[2];return k},rotateZ:function(k,n,w,z){var D=[],F=[];D[0]=n[0]-w[0];D[1]=n[1]-w[1];D[2]=n[2]-w[2];F[0]=D[0]*Math.cos(z)-D[1]*Math.sin(z);F[1]=D[0]*Math.sin(z)+D[1]*Math.cos(z);F[2]=D[2];k[0]=F[0]+w[0];k[1]=
F[1]+w[1];k[2]=F[2]+w[2];return k},angle:function(k,n){var w=k[0],z=k[1],D=k[2],F=n[0],H=n[1],K=n[2];k=(w=Math.sqrt((w*w+z*z+D*D)*(F*F+H*H+K*K)))&&S(k,n)/w;return Math.acos(Math.min(Math.max(k,-1),1))},zero:function(k){k[0]=0;k[1]=0;k[2]=0;return k},str:function(k){return"vec3("+k[0]+", "+k[1]+", "+k[2]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]},equals:function(k,n){var w=k[0],z=k[1];k=k[2];var D=n[0],F=n[1];n=n[2];return Math.abs(w-D)<=1E-6*Math.max(1,Math.abs(w),
Math.abs(D))&&Math.abs(z-F)<=1E-6*Math.max(1,Math.abs(z),Math.abs(F))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},sub:A,mul:E,div:J,dist:B,sqrDist:I,len:C,sqrLen:L,forEach:wb});var xb=function(){var k=V();return function(n,w,z,D,F,H){w||(w=4);z||(z=0);for(D=D?Math.min(D*w+z,n.length):n.length;z<D;z+=w)k[0]=n[z],k[1]=n[z+1],k[2]=n[z+2],k[3]=n[z+3],F(k,k,H),n[z]=k[0],n[z+1]=k[1],n[z+2]=k[2],n[z+3]=k[3];return n}}();xb=Object.freeze({__proto__:null,create:V,clone:Z,fromValues:la,copy:va,
set:Na,add:za,subtract:Ha,multiply:Ja,divide:Aa,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);k[2]=Math.ceil(n[2]);k[3]=Math.ceil(n[3]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);k[2]=Math.floor(n[2]);k[3]=Math.floor(n[3]);return k},min:function(k,n,w){k[0]=Math.min(n[0],w[0]);k[1]=Math.min(n[1],w[1]);k[2]=Math.min(n[2],w[2]);k[3]=Math.min(n[3],w[3]);return k},max:function(k,n,w){k[0]=Math.max(n[0],w[0]);k[1]=Math.max(n[1],w[1]);k[2]=Math.max(n[2],w[2]);
k[3]=Math.max(n[3],w[3]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);k[2]=Math.round(n[2]);k[3]=Math.round(n[3]);return k},scale:ya,scaleAndAdd:function(k,n,w,z){k[0]=n[0]+w[0]*z;k[1]=n[1]+w[1]*z;k[2]=n[2]+w[2]*z;k[3]=n[3]+w[3]*z;return k},distance:na,squaredDistance:Ta,length:wa,squaredLength:Ba,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=-n[3];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];k[2]=1/n[2];k[3]=1/n[3];return k},normalize:Ya,dot:Xa,
cross:function(k,n,w,z){var D=w[0]*z[1]-w[1]*z[0],F=w[0]*z[2]-w[2]*z[0],H=w[0]*z[3]-w[3]*z[0],K=w[1]*z[2]-w[2]*z[1],M=w[1]*z[3]-w[3]*z[1];w=w[2]*z[3]-w[3]*z[2];z=n[0];var O=n[1],R=n[2];n=n[3];k[0]=O*w-R*M+n*K;k[1]=-(z*w)+R*H-n*F;k[2]=z*M-O*H+n*D;k[3]=-(z*K)+O*F-R*D;return k},lerp:gb,random:function(k,n){n=n||1;do{var w=2*Sa()-1;var z=2*Sa()-1;var D=w*w+z*z}while(1<=D);do{var F=2*Sa()-1;var H=2*Sa()-1;var K=F*F+H*H}while(1<=K);D=Math.sqrt((1-D)/K);k[0]=n*w;k[1]=n*z;k[2]=n*F*D;k[3]=n*H*D;return k},
transformMat4:function(k,n,w){var z=n[0],D=n[1],F=n[2];n=n[3];k[0]=w[0]*z+w[4]*D+w[8]*F+w[12]*n;k[1]=w[1]*z+w[5]*D+w[9]*F+w[13]*n;k[2]=w[2]*z+w[6]*D+w[10]*F+w[14]*n;k[3]=w[3]*z+w[7]*D+w[11]*F+w[15]*n;return k},transformQuat:function(k,n,w){var z=n[0],D=n[1],F=n[2],H=w[0],K=w[1],M=w[2];w=w[3];var O=w*z+K*F-M*D,R=w*D+M*z-H*F,T=w*F+H*D-K*z;z=-H*z-K*D-M*F;k[0]=O*w+z*-H+R*-M-T*-K;k[1]=R*w+z*-K+T*-H-O*-M;k[2]=T*w+z*-M+O*-K-R*-H;k[3]=n[3];return k},zero:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=0;return k},
str:function(k){return"vec4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},exactEquals:hb,equals:function(k,n){var w=k[0],z=k[1],D=k[2];k=k[3];var F=n[0],H=n[1],K=n[2];n=n[3];return Math.abs(w-F)<=1E-6*Math.max(1,Math.abs(w),Math.abs(F))&&Math.abs(z-H)<=1E-6*Math.max(1,Math.abs(z),Math.abs(H))&&Math.abs(D-K)<=1E-6*Math.max(1,Math.abs(D),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},sub:Ha,mul:Ja,div:Aa,dist:na,sqrDist:Ta,len:wa,sqrLen:Ba,forEach:xb});var yb=function(){var k=y(),
n=G(1,0,0),w=G(0,1,0);return function(z,D,F){var H=S(D,F);if(-.999999>H)return U(k,n,D),1E-6>C(k)&&U(k,w,D),P(k,k),ib(z,k,Math.PI),z;if(.999999<H)return z[0]=0,z[1]=0,z[2]=0,z[3]=1,z;U(k,D,F);z[0]=k[0];z[1]=k[1];z[2]=k[2];z[3]=1+H;return Ya(z,z)}}(),zb=function(){var k=Za(),n=Za();return function(w,z,D,F,H,K){$a(k,z,H,K);$a(n,D,F,K);$a(w,k,n,2*K*(1-K));return w}}(),eb=function(){var k=f();return function(n,w,z,D){k[0]=z[0];k[3]=z[1];k[6]=z[2];k[1]=D[0];k[4]=D[1];k[7]=D[2];k[2]=-w[0];k[5]=-w[1];k[8]=
-w[2];return Ya(n,pb(n,k))}}();yb=Object.freeze({__proto__:null,create:Za,identity:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=1;return k},setAxisAngle:ib,getAxisAngle:function(k,n){var w=2*Math.acos(n[3]),z=Math.sin(w/2);1E-6<z?(k[0]=n[0]/z,k[1]=n[1]/z,k[2]=n[2]/z):(k[0]=1,k[1]=0,k[2]=0);return w},getAngle:function(k,n){k=Xa(k,n);return Math.acos(2*k*k-1)},multiply:jb,rotateX:kb,rotateY:lb,rotateZ:mb,calculateW:function(k,n){var w=n[0],z=n[1];n=n[2];k[0]=w;k[1]=z;k[2]=n;k[3]=Math.sqrt(Math.abs(1-w*w-z*
z-n*n));return k},exp:nb,ln:ob,pow:function(k,n,w){ob(k,n);ya(k,k,w);nb(k,k);return k},slerp:$a,random:function(k){var n=Sa(),w=Sa(),z=Sa(),D=Math.sqrt(1-n);n=Math.sqrt(n);k[0]=D*Math.sin(2*Math.PI*w);k[1]=D*Math.cos(2*Math.PI*w);k[2]=n*Math.sin(2*Math.PI*z);k[3]=n*Math.cos(2*Math.PI*z);return k},invert:function(k,n){var w=n[0],z=n[1],D=n[2];n=n[3];var F=w*w+z*z+D*D+n*n;F=F?1/F:0;k[0]=-w*F;k[1]=-z*F;k[2]=-D*F;k[3]=n*F;return k},conjugate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];return k},
fromMat3:pb,fromEuler:function(k,n,w,z){var D=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"zyx",F=Math.PI/360;n*=F;z*=F;w*=F;F=Math.sin(n);var H=Math.cos(n),K=Math.sin(w),M=Math.cos(w),O=Math.sin(z),R=Math.cos(z);switch(D){case "xyz":k[0]=F*M*R+H*K*O;k[1]=H*K*R-F*M*O;k[2]=H*M*O+F*K*R;k[3]=H*M*R-F*K*O;break;case "xzy":k[0]=F*M*R-H*K*O;k[1]=H*K*R-F*M*O;k[2]=H*M*O+F*K*R;k[3]=H*M*R+F*K*O;break;case "yxz":k[0]=F*M*R+H*K*O;k[1]=H*K*R-F*M*O;k[2]=H*M*O-F*K*R;k[3]=H*M*R+F*K*O;break;case "yzx":k[0]=
F*M*R+H*K*O;k[1]=H*K*R+F*M*O;k[2]=H*M*O-F*K*R;k[3]=H*M*R-F*K*O;break;case "zxy":k[0]=F*M*R-H*K*O;k[1]=H*K*R+F*M*O;k[2]=H*M*O+F*K*R;k[3]=H*M*R-F*K*O;break;case "zyx":k[0]=F*M*R-H*K*O;k[1]=H*K*R+F*M*O;k[2]=H*M*O-F*K*R;k[3]=H*M*R+F*K*O;break;default:throw Error("Unknown angle order "+D);}return k},str:function(k){return"quat("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},clone:Z,fromValues:la,copy:va,set:Na,add:za,mul:jb,scale:ya,dot:Xa,lerp:gb,length:wa,len:wa,squaredLength:Ba,sqrLen:Ba,normalize:Ya,exactEquals:hb,
equals:function(k,n){return.999999<=Math.abs(Xa(k,n))},rotationTo:yb,sqlerp:zb,setAxes:eb});zb=Object.freeze({__proto__:null,create:function(){var k=new sa(8);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[4]=0,k[5]=0,k[6]=0,k[7]=0);k[3]=1;return k},clone:function(k){var n=new sa(8);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];return n},fromValues:function(k,n,w,z,D,F,H,K){var M=new sa(8);M[0]=k;M[1]=n;M[2]=w;M[3]=z;M[4]=D;M[5]=F;M[6]=H;M[7]=K;return M},fromRotationTranslationValues:function(k,
n,w,z,D,F,H){var K=new sa(8);K[0]=k;K[1]=n;K[2]=w;K[3]=z;D*=.5;F*=.5;H*=.5;K[4]=D*z+F*w-H*n;K[5]=F*z+H*k-D*w;K[6]=H*z+D*n-F*k;K[7]=-D*k-F*n-H*w;return K},fromRotationTranslation:qb,fromTranslation:function(k,n){k[0]=0;k[1]=0;k[2]=0;k[3]=1;k[4]=.5*n[0];k[5]=.5*n[1];k[6]=.5*n[2];k[7]=0;return k},fromRotation:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},fromMat4:function(k,n){var w=Za();q(w,n);var z=new sa(3);v(z,n);qb(k,w,z);return k},copy:rb,identity:function(k){k[0]=
0;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},set:function(k,n,w,z,D,F,H,K,M){k[0]=n;k[1]=w;k[2]=z;k[3]=D;k[4]=F;k[5]=H;k[6]=K;k[7]=M;return k},getReal:va,getDual:function(k,n){k[0]=n[4];k[1]=n[5];k[2]=n[6];k[3]=n[7];return k},setReal:va,setDual:function(k,n){k[4]=n[0];k[5]=n[1];k[6]=n[2];k[7]=n[3];return k},getTranslation:function(k,n){var w=n[4],z=n[5],D=n[6],F=n[7],H=-n[0],K=-n[1],M=-n[2];n=n[3];k[0]=2*(w*n+F*H+z*M-D*K);k[1]=2*(z*n+F*K+D*H-w*M);k[2]=2*(D*n+F*M+w*K-z*H);return k},
translate:function(k,n,w){var z=n[0],D=n[1],F=n[2],H=n[3],K=.5*w[0],M=.5*w[1];w=.5*w[2];var O=n[4],R=n[5],T=n[6];n=n[7];k[0]=z;k[1]=D;k[2]=F;k[3]=H;k[4]=H*K+D*w-F*M+O;k[5]=H*M+F*K-z*w+R;k[6]=H*w+z*M-D*K+T;k[7]=-z*K-D*M-F*w+n;return k},rotateX:function(k,n,w){var z=-n[0],D=-n[1],F=-n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*H+R*z+M*F-O*D,Y=M*H+R*D+O*z-K*F,X=O*H+R*F+K*D-M*z;K=R*H-K*z-M*D-O*F;kb(k,n,w);z=k[0];D=k[1];F=k[2];H=k[3];k[4]=T*H+K*z+Y*F-X*D;k[5]=Y*H+K*D+X*z-T*F;k[6]=X*H+K*F+T*D-Y*z;k[7]=K*
H-T*z-Y*D-X*F;return k},rotateY:function(k,n,w){var z=-n[0],D=-n[1],F=-n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*H+R*z+M*F-O*D,Y=M*H+R*D+O*z-K*F,X=O*H+R*F+K*D-M*z;K=R*H-K*z-M*D-O*F;lb(k,n,w);z=k[0];D=k[1];F=k[2];H=k[3];k[4]=T*H+K*z+Y*F-X*D;k[5]=Y*H+K*D+X*z-T*F;k[6]=X*H+K*F+T*D-Y*z;k[7]=K*H-T*z-Y*D-X*F;return k},rotateZ:function(k,n,w){var z=-n[0],D=-n[1],F=-n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*H+R*z+M*F-O*D,Y=M*H+R*D+O*z-K*F,X=O*H+R*F+K*D-M*z;K=R*H-K*z-M*D-O*F;mb(k,n,w);z=k[0];D=k[1];F=k[2];
H=k[3];k[4]=T*H+K*z+Y*F-X*D;k[5]=Y*H+K*D+X*z-T*F;k[6]=X*H+K*F+T*D-Y*z;k[7]=K*H-T*z-Y*D-X*F;return k},rotateByQuatAppend:function(k,n,w){var z=w[0],D=w[1],F=w[2];w=w[3];var H=n[0],K=n[1],M=n[2],O=n[3];k[0]=H*w+O*z+K*F-M*D;k[1]=K*w+O*D+M*z-H*F;k[2]=M*w+O*F+H*D-K*z;k[3]=O*w-H*z-K*D-M*F;H=n[4];K=n[5];M=n[6];O=n[7];k[4]=H*w+O*z+K*F-M*D;k[5]=K*w+O*D+M*z-H*F;k[6]=M*w+O*F+H*D-K*z;k[7]=O*w-H*z-K*D-M*F;return k},rotateByQuatPrepend:function(k,n,w){var z=n[0],D=n[1],F=n[2];n=n[3];var H=w[0],K=w[1],M=w[2],O=
w[3];k[0]=z*O+n*H+D*M-F*K;k[1]=D*O+n*K+F*H-z*M;k[2]=F*O+n*M+z*K-D*H;k[3]=n*O-z*H-D*K-F*M;H=w[4];K=w[5];M=w[6];O=w[7];k[4]=z*O+n*H+D*M-F*K;k[5]=D*O+n*K+F*H-z*M;k[6]=F*O+n*M+z*K-D*H;k[7]=n*O-z*H-D*K-F*M;return k},rotateAroundAxis:function(k,n,w,z){if(1E-6>Math.abs(z))return rb(k,n);var D=Math.hypot(w[0],w[1],w[2]);z*=.5;var F=Math.sin(z),H=F*w[0]/D,K=F*w[1]/D;w=F*w[2]/D;z=Math.cos(z);D=n[0];F=n[1];var M=n[2],O=n[3];k[0]=D*z+O*H+F*w-M*K;k[1]=F*z+O*K+M*H-D*w;k[2]=M*z+O*w+D*K-F*H;k[3]=O*z-D*H-F*K-M*w;
D=n[4];F=n[5];M=n[6];n=n[7];k[4]=D*z+n*H+F*w-M*K;k[5]=F*z+n*K+M*H-D*w;k[6]=M*z+n*w+D*K-F*H;k[7]=n*z-D*H-F*K-M*w;return k},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];k[4]=n[4]+w[4];k[5]=n[5]+w[5];k[6]=n[6]+w[6];k[7]=n[7]+w[7];return k},multiply:ab,mul:ab,scale:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;k[4]=n[4]*w;k[5]=n[5]*w;k[6]=n[6]*w;k[7]=n[7]*w;return k},dot:Xa,lerp:function(k,n,w,z){var D=1-z;0>Xa(n,w)&&(z=-z);k[0]=n[0]*D+w[0]*z;k[1]=
n[1]*D+w[1]*z;k[2]=n[2]*D+w[2]*z;k[3]=n[3]*D+w[3]*z;k[4]=n[4]*D+w[4]*z;k[5]=n[5]*D+w[5]*z;k[6]=n[6]*D+w[6]*z;k[7]=n[7]*D+w[7]*z;return k},invert:function(k,n){var w=Ba(n);k[0]=-n[0]/w;k[1]=-n[1]/w;k[2]=-n[2]/w;k[3]=n[3]/w;k[4]=-n[4]/w;k[5]=-n[5]/w;k[6]=-n[6]/w;k[7]=n[7]/w;return k},conjugate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];k[4]=-n[4];k[5]=-n[5];k[6]=-n[6];k[7]=n[7];return k},length:wa,len:wa,squaredLength:Ba,sqrLen:Ba,normalize:function(k,n){var w=Ba(n);if(0<w){w=Math.sqrt(w);
var z=n[0]/w,D=n[1]/w,F=n[2]/w,H=n[3]/w,K=n[4],M=n[5],O=n[6];n=n[7];var R=z*K+D*M+F*O+H*n;k[0]=z;k[1]=D;k[2]=F;k[3]=H;k[4]=(K-z*R)/w;k[5]=(M-D*R)/w;k[6]=(O-F*R)/w;k[7]=(n-H*R)/w}return k},str:function(k){return"quat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]},equals:function(k,n){var w=k[0],z=k[1],D=k[2],F=k[3],H=k[4],K=k[5],
M=k[6];k=k[7];var O=n[0],R=n[1],T=n[2],Y=n[3],X=n[4],fa=n[5],ha=n[6];n=n[7];return Math.abs(w-O)<=1E-6*Math.max(1,Math.abs(w),Math.abs(O))&&Math.abs(z-R)<=1E-6*Math.max(1,Math.abs(z),Math.abs(R))&&Math.abs(D-T)<=1E-6*Math.max(1,Math.abs(D),Math.abs(T))&&Math.abs(F-Y)<=1E-6*Math.max(1,Math.abs(F),Math.abs(Y))&&Math.abs(H-X)<=1E-6*Math.max(1,Math.abs(H),Math.abs(X))&&Math.abs(K-fa)<=1E-6*Math.max(1,Math.abs(K),Math.abs(fa))&&Math.abs(M-ha)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ha))&&Math.abs(k-n)<=
1E-6*Math.max(1,Math.abs(k),Math.abs(n))}});eb=function(){var k=Ua();return function(n,w,z,D,F,H){w||(w=2);z||(z=0);for(D=D?Math.min(D*w+z,n.length):n.length;z<D;z+=w)k[0]=n[z],k[1]=n[z+1],F(k,k,H),n[z]=k[0],n[z+1]=k[1];return n}}();eb=Object.freeze({__proto__:null,create:Ua,clone:function(k){var n=new sa(2);n[0]=k[0];n[1]=k[1];return n},fromValues:function(k,n){var w=new sa(2);w[0]=k;w[1]=n;return w},copy:function(k,n){k[0]=n[0];k[1]=n[1];return k},set:function(k,n,w){k[0]=n;k[1]=w;return k},add:function(k,
n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];return k},subtract:bb,multiply:sb,divide:cb,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);return k},min:function(k,n,w){k[0]=Math.min(n[0],w[0]);k[1]=Math.min(n[1],w[1]);return k},max:function(k,n,w){k[0]=Math.max(n[0],w[0]);k[1]=Math.max(n[1],w[1]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);return k},scale:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*
w;return k},scaleAndAdd:function(k,n,w,z){k[0]=n[0]+w[0]*z;k[1]=n[1]+w[1]*z;return k},distance:tb,squaredDistance:Va,length:ub,squaredLength:vb,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];return k},normalize:function(k,n){var w=n[0],z=n[1];w=w*w+z*z;0<w&&(w=1/Math.sqrt(w));k[0]=n[0]*w;k[1]=n[1]*w;return k},dot:function(k,n){return k[0]*n[0]+k[1]*n[1]},cross:function(k,n,w){n=n[0]*w[1]-n[1]*w[0];k[0]=k[1]=0;k[2]=n;return k},lerp:function(k,n,w,
z){var D=n[0];n=n[1];k[0]=D+z*(w[0]-D);k[1]=n+z*(w[1]-n);return k},random:function(k,n){n=n||1;var w=2*Sa()*Math.PI;k[0]=Math.cos(w)*n;k[1]=Math.sin(w)*n;return k},transformMat2:function(k,n,w){var z=n[0];n=n[1];k[0]=w[0]*z+w[2]*n;k[1]=w[1]*z+w[3]*n;return k},transformMat2d:function(k,n,w){var z=n[0];n=n[1];k[0]=w[0]*z+w[2]*n+w[4];k[1]=w[1]*z+w[3]*n+w[5];return k},transformMat3:function(k,n,w){var z=n[0];n=n[1];k[0]=w[0]*z+w[3]*n+w[6];k[1]=w[1]*z+w[4]*n+w[7];return k},transformMat4:function(k,n,w){var z=
n[0];n=n[1];k[0]=w[0]*z+w[4]*n+w[12];k[1]=w[1]*z+w[5]*n+w[13];return k},rotate:function(k,n,w,z){var D=n[0]-w[0];n=n[1]-w[1];var F=Math.sin(z);z=Math.cos(z);k[0]=D*z-n*F+w[0];k[1]=D*F+n*z+w[1];return k},angle:function(k,n){var w=k[0];k=k[1];var z=n[0];n=n[1];var D=Math.sqrt((w*w+k*k)*(z*z+n*n));return Math.acos(Math.min(Math.max(D&&(w*z+k*n)/D,-1),1))},zero:function(k){k[0]=0;k[1]=0;return k},str:function(k){return"vec2("+k[0]+", "+k[1]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]},
equals:function(k,n){var w=k[0];k=k[1];var z=n[0];n=n[1];return Math.abs(w-z)<=1E-6*Math.max(1,Math.abs(w),Math.abs(z))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},len:ub,sub:bb,mul:sb,div:cb,dist:tb,sqrDist:Va,sqrLen:vb,forEach:eb});e.glMatrix=Db;e.mat2=Eb;e.mat2d=Fb;e.mat3=Gb;e.mat4=Hb;e.quat=yb;e.quat2=zb;e.vec2=eb;e.vec3=wb;e.vec4=xb;Object.defineProperty(e,"__esModule",{value:!0})});
{"use strict";function e(B,I,L){var P=[0,0];var S=B[1][1]-B[0][1];var U=B[0][0]-B[1][0];B=S*B[0][0]+U*B[0][1];var V=I[1][1]-I[0][1];var Z=I[0][0]-I[1][0];I=V*I[0][0]+Z*I[0][1];var la=S*Z-V*U;E(la,0,L||0)||(P[0]=(Z*B-U*I)/la,P[1]=(S*I-V*B)/la);return P}function b(B,I,L,P){var S=I[0]-B[0];I=I[1]-B[1];var U=P[0]-L[0],V=P[1]-L[1];if(0===U*I-V*S)return!1;P=(S*(L[1]-B[1])+I*(B[0]-L[0]))/(U*I-V*S);B=(U*(B[1]-L[1])+V*(L[0]-B[0]))/(V*S-U*I);return 0<=P&&1>=P&&0<=B&&1>=B}function a(B,I,L){return(I[0]-B[0])*
(L[1]-B[1])-(L[0]-B[0])*(I[1]-B[1])}function c(B,I,L){return 0<a(B,I,L)}function d(B,I,L){return 0<=a(B,I,L)}function f(B,I,L){return 0>a(B,I,L)}function h(B,I,L){return 0>=a(B,I,L)}var tmpPoint1$$module$str$c3runtime=[],tmpPoint2$$module$str$c3runtime=[];function g(B,I,L,P){if(P){var S=tmpPoint1$$module$str$c3runtime,U=tmpPoint2$$module$str$c3runtime;S[0]=I[0]-B[0];S[1]=I[1]-B[1];U[0]=L[0]-I[0];U[1]=L[1]-I[1];return Math.acos((S[0]*U[0]+S[1]*U[1])/(Math.sqrt(S[0]*S[0]+S[1]*S[1])*Math.sqrt(U[0]*U[0]+
U[1]*U[1])))<P}return 0===a(B,I,L)}function l(B,I){var L=I[0]-B[0];B=I[1]-B[1];return L*L+B*B}function m(B,I){var L=B.length;return B[0>I?I%L+L:I%L]}function u(B){B.length=0}function v(B,I,L,P){for(;L<P;L++)B.push(I[L])}function t(B){for(var I=[],L=B.length,P=0;P!==L;P++)I.push(B.pop());for(P=0;P!==L;P++)B[P]=I[P]}function q(B,I){return f(m(B,I-1),m(B,I),m(B,I+1))}var tmpLine1$$module$str$c3runtime=[],tmpLine2$$module$str$c3runtime=[];function p(B,I,L){var P=tmpLine1$$module$str$c3runtime,S=tmpLine2$$module$str$c3runtime;
if(d(m(B,I+1),m(B,I),m(B,L))&&h(m(B,I-1),m(B,I),m(B,L)))return!1;var U=l(m(B,I),m(B,L));for(var V=0;V!==B.length;++V)if((V+1)%B.length!==I&&V!==I&&d(m(B,I),m(B,L),m(B,V+1))&&h(m(B,I),m(B,L),m(B,V))){P[0]=m(B,I);P[1]=m(B,L);S[0]=m(B,V);S[1]=m(B,V+1);var Z=e(P,S);if(l(m(B,I),Z)<U)return!1}return!0}function r(B,I,L){for(var P=0;P!==B.length;++P)if(P!==I&&P!==L&&(P+1)%B.length!==I&&(P+1)%B.length!==L&&b(m(B,I),m(B,L),m(B,P),m(B,P+1)))return!1;return!0}function x(B,I,L,P){P=P||[];u(P);if(I<L)for(var S=
I;S<=L;S++)P.push(B[S]);else{for(S=0;S<=L;S++)P.push(B[S]);for(S=I;S<B.length;S++)P.push(B[S])}return P}function y(B){for(var I=[],L,P,S=[],U=Number.MAX_VALUE,V=0;V<B.length;++V)if(q(B,V))for(var Z=0;Z<B.length;++Z)if(p(B,V,Z)){L=y(x(B,V,Z,S));P=y(x(B,Z,V,S));for(var la=0;la<P.length;la++)L.push(P[la]);L.length<U&&(I=L,U=L.length,I.push([m(B,V),m(B,Z)]))}return I}function C(B,I){if(0===I.length)return[B];if(I instanceof Array&&I.length&&I[0]instanceof Array&&2===I[0].length&&I[0][0]instanceof Array){B=
[B];for(var L=0;L<I.length;L++)for(var P=I[L],S=0;S<B.length;S++){var U=C(B[S],P);if(U){B.splice(S,1);B.push(U[0],U[1]);break}}return B}P=I;L=B.indexOf(P[0]);S=B.indexOf(P[1]);return-1!==L&&-1!==S?[x(B,L,S),x(B,S,L)]:!1}function G(B,I,L,P,S){var U=I[1]-B[1];I=B[0]-I[0];B=U*B[0]+I*B[1];var V=P[1]-L[1];P=L[0]-P[0];L=V*L[0]+P*L[1];var Z=U*P-V*I;return E(Z,0,S||0)?[0,0]:[(P*B-I*L)/Z,(U*L-V*B)/Z]}function A(B,I,L,P,S,U,V){U=U||100;V=V||0;S=S||25;I="undefined"!==typeof I?I:[];L=L||[];P=P||[];var Z=[0,0],
la=[0,0],va=[0,0],Na,za=0,Ha=0,Ja=0,Aa=[],ya=[];if(3>B.length)return I;V++;if(V>U)return console.warn("quickDecomp: max level ("+U+") reached."),I;for(var na=0;na<B.length;++na)if(q(B,na)){L.push(B[na]);var Ta=Na=Number.MAX_VALUE;for(var wa=0;wa<B.length;++wa){if(c(m(B,na-1),m(B,na),m(B,wa))&&h(m(B,na-1),m(B,na),m(B,wa-1))&&(va=G(m(B,na-1),m(B,na),m(B,wa),m(B,wa-1)),f(m(B,na+1),m(B,na),va))){var Ba=l(B[na],va);Ba<Na&&(Na=Ba,la=va,Ha=wa)}c(m(B,na+1),m(B,na),m(B,wa+1))&&h(m(B,na+1),m(B,na),m(B,wa))&&
(va=G(m(B,na+1),m(B,na),m(B,wa),m(B,wa+1)),c(m(B,na-1),m(B,na),va)&&(Ba=l(B[na],va),Ba<Ta&&(Ta=Ba,Z=va,za=wa)))}if(Ha===(za+1)%B.length)va[0]=(la[0]+Z[0])/2,va[1]=(la[1]+Z[1])/2,P.push(va),na<za?(v(Aa,B,na,za+1),Aa.push(va),ya.push(va),0!==Ha&&v(ya,B,Ha,B.length),v(ya,B,0,na+1)):(0!==na&&v(Aa,B,na,B.length),v(Aa,B,0,za+1),Aa.push(va),ya.push(va),v(ya,B,Ha,na+1));else{Ha>za&&(za+=B.length);Z=Number.MAX_VALUE;if(za<Ha)return I;for(wa=Ha;wa<=za;++wa)d(m(B,na-1),m(B,na),m(B,wa))&&h(m(B,na+1),m(B,na),
m(B,wa))&&(Ba=l(m(B,na),m(B,wa)),Ba<Z&&r(B,na,wa)&&(Z=Ba,Ja=wa%B.length));na<Ja?(v(Aa,B,na,Ja+1),0!==Ja&&v(ya,B,Ja,B.length),v(ya,B,0,na+1)):(0!==na&&v(Aa,B,na,B.length),v(Aa,B,0,Ja+1),v(ya,B,Ja,na+1))}Aa.length<ya.length?(A(Aa,I,L,P,S,U,V),A(ya,I,L,P,S,U,V)):(A(ya,I,L,P,S,U,V),A(Aa,I,L,P,S,U,V));return I}I.push(B);return I}function E(B,I,L){return Math.abs(B-I)<=(L||0)}function J(B,I,L){return E(B[0],I[0],L)&&E(B[1],I[1],L)}self.polyDecomp={decomp:function(B){var I=y(B);return 0<I.length?C(B,I):
[B]},quickDecomp:A,isSimple:function(B){var I;for(I=0;I<B.length-1;I++)for(var L=0;L<I-1;L++)if(b(B[I],B[I+1],B[L],B[L+1]))return!1;for(I=1;I<B.length-2;I++)if(b(B[0],B[B.length-1],B[I],B[I+1]))return!1;return!0},removeCollinearPoints:function(B,I){for(var L=0,P=B.length-1;3<B.length&&0<=P;--P)g(m(B,P-1),m(B,P),m(B,P+1),I)&&(B.splice(P%B.length,1),L++);return L},removeDuplicatePoints:function(B,I){for(var L=B.length-1;1<=L;--L)for(var P=B[L],S=L-1;0<=S;--S)J(P,B[S],I)&&B.splice(L,1)},makeCCW:function(B){for(var I=
0,L=1;L<B.length;++L)if(B[L][1]<B[I][1]||B[L][1]===B[I][1]&&B[L][0]>B[I][0])I=L;if(c(m(B,I-1),m(B,I),m(B,I+1)))return!1;t(B);return!0}}}
{"use strict";let e=!1,b=!1,a="dev";const c=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){e=!0}static IsReady(){return e}static SetAppStarted(){b=!0}static HasAppStarted(){return b}static SetBuildMode(d){a=d}static GetBuildMode(){return a}static IsReleaseBuild(){return"final"===a}};c.isDebug=!1;c.isDebugDefend=!1;c.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}}
{"use strict";const e=self.C3;e.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("="),c=decodeURIComponent(b.substring(0,a));b=decodeURIComponent(b.substring(a+1));this._parameters.set(c,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()}};e.QueryString=new e.QueryParser(location.search);e.LocationHashString=new e.QueryParser(location.hash);"dev"!==e.QueryString.Get("mode")&&e.SetBuildMode("final")}
{"use strict";const e=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 c="(unknown)",d="(unknown)",f="(unknown)",h="(unknown)",g="(unknown)",l="browser",m=!1,u=!1,v=new Map;function t(p,r,x){!0===r?(x(),v.set(p,!0)):r&&r.length&&(x(r[0]),v.set(p,!0))}t("isWindows",JSCompiler_object_inline_windows_0,p=>{c="Windows";if(p=p.split(" ")[2])switch(p){case "5.0":d="2000";break;case "5.1":d="XP";break;case "5.2":d="XP";break;
case "6.0":d="Vista";break;case "6.1":d="7";break;case "6.2":d="8";break;case "6.3":d="8.1";break;case "10.0":d="10"}});t("isOSX",JSCompiler_object_inline_OSX_1,p=>{c="Mac OS X";(p=p.split(" ")[3])&&(d=p.replace("_","."))});t("isLinux",a.linux,()=>{c="Linux"});t("isChromeOS",a.chromeOS,()=>{c="Chrome OS"});t("isAndroid",!a.windowsTizen&&JSCompiler_object_inline_android_2,p=>{c="Android";(p=p.split(" ")[1])&&(d=p)});t("isTizen",JSCompiler_object_inline_tizen_4,p=>{c="Tizen";(p=p.split(" ")[1])&&(d=
p)});t("isIPhone",!a.windowsTizen&&JSCompiler_object_inline_iphone_5,p=>{c="iOS";(p=p.split(" ")[2])&&(d=p.replace("_","."))});t("isIPad",!a.windowsTizen&&JSCompiler_object_inline_ipad_6,p=>{c="iOS";(p=p.split(" ")[3])&&(d=p.replace("_","."))});t("isWindowsPhone",JSCompiler_object_inline_winPhone_7,p=>{c="Windows Phone";(p=p.split(" ")[2])&&(d=p)});t("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_8,p=>{c="Windows Phone";(p=p.split(" ")[3])&&(d=p)});t("isBlackberry",a.blackberry,()=>{c="Blackberry";
d="10";f="stock";g="webkit"});t("isChrome",!a.edge&&!a.opera&&JSCompiler_object_inline_chrome_9,p=>{f="Chrome";g="Chromium";(p=p.split("/")[1])&&(h=p)});t("isOpera",JSCompiler_object_inline_opera_3,p=>{f="Opera";g="Chromium";(p=p.split("/")[1])&&(h=p)});t("isChromium",JSCompiler_object_inline_chromium_10,p=>{g=f="Chromium";(p=p.split("/")[1])&&(h=p)});t("isFirefox",JSCompiler_object_inline_firefox_12,p=>{f="Firefox";g="Gecko";(p=p.split("/")[1])&&(h=p)});t("isInternetExplorer",JSCompiler_object_inline_ie_13,
p=>{f="Internet Explorer";g="Trident";(p=p.split(" ")[1])&&(h=p)});t("isTrident","Internet Explorer"!==f&&a.trident,()=>{g="Trident";var p=/rv:[0-9.]+/i.exec(b);p&&p.length&&(f="Internet Explorer",(p=p[0].split(":")[1])&&(h=p))});t("isEdge",JSCompiler_object_inline_edge_14,p=>{g=f="Edge";(p=p.split("/")[1])&&(h=p)});t("isEdgeChromium",JSCompiler_object_inline_edgeChromium_15,p=>{f="Edge";g="Chromium";(p=p.split("/")[1])&&(h=p)});t("isSafari",a.safari&&!a.nokia&&!a.chrome&&!a.chromium&&!a.genericIE&&
!a.blackberry,()=>{f="Safari";g="WebKit";var p=/version\/[0-9.]+/i.exec(b),r=/crios\/[0-9.]+/i.exec(b),x=/fxios\/[0-9.]+/i.exec(b);p&&p.length&&(p=p[0].split("/")[1])&&(h=p);r&&r.length&&(f="Chrome for iOS",(r=r[0].split("/")[1])&&(h=r));x&&x.length&&(f="Firefox for iOS",(x=x[0].split("/")[1])&&(h=x))});t("isSilk",JSCompiler_object_inline_silk_16,p=>{f="Silk";(p=p.split("/")[1])&&(h=p)});t("isCrosswalk",a.crosswalk,()=>l="crosswalk");t("isCordova",self.device&&(self.device.cordova||self.device.phonegap),
()=>l="cordova");t("isNWJS",JSCompiler_object_inline_nwjs_11,p=>{l="nwjs";f="NW.js";g="Chromium";(p=p.split("/")[1])&&(h=p)});t("isAmazonWebApp",a.amazonwebapp,()=>l="webapp");t("isHomeScreenWebApp","nwjs"!==l&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>l="webapp");t("isFalseSafari","Safari"===f&&("Android"===c||"Tizen"===c||"Blackberry"===c),()=>f="stock");t("isAndroidWebview","Chrome"===f&&"browser"===l&&a.webview,
()=>l="webview");t("isFirefoxOS","Firefox"===f&&"(unknown)"===c,()=>c="Firefox OS");t("isAndroidFallback","(unknown)"===c&&!a.windowsTizen&&a.android,()=>c="Android");t("isTridentFallback","(unknown)"===c&&a.trident,()=>g="Trident");t("isWebkitFallback","(unknown)"===c&&a.webkit,()=>g="WebKit");t("isDesktop",(()=>"Windows"===c||"Mac OS X"===c||"Linux"===c||"Chrome OS"===c||"nwjs"===l)(),()=>m=!0);u="nwjs"===l;const q="Mac OS X"===c&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;q&&(c="iOS",
d=h,u=m=!1);e.Platform={OS:c,OSVersion:d,Browser:f,BrowserVersion:h,BrowserVersionNumber:parseFloat(h),BrowserEngine:g,Context:l,IsDesktop:m,IsMobile:!m,IsDesktopApp:u,IsChromeWebStore:!!(self.chrome&&self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===c||"iOS"===c,IsIpadOS:q,IsLinux:"Linux"===c}}"use strict";
{const e=new Map,b="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAll,a="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAllKeys;function c(q){return new Promise((p,r)=>{q.onsuccess=()=>p(q.result);q.onerror=()=>r(q.error)})}function d(q){return new Promise((p,r)=>{q.oncomplete=()=>p();q.onerror=()=>r(q.error);q.onabort=()=>r(q.error)})}function f(q,p){return g(q,p)}function h(q,p){return g(q,p,!0)}async function g(q,p,r=!1,
x=!0){const y=await l(q);try{const C=y.transaction(["keyvaluepairs"],r?"readwrite":"readonly");return p(C)}catch(C){if(x&&"InvalidStateError"===C.name)return e.delete(q),g(q,p,r,!1);throw C;}}function l(q){u(q);let p=e.get(q);p instanceof Promise||(p=m(q),e.set(q,p),p.catch(r=>e.delete(q)));return p}async function m(q){u(q);const p=indexedDB.open(q,2);p.addEventListener("upgradeneeded",r=>{try{r.target.result.createObjectStore("keyvaluepairs")}catch(x){console.error(`Failed to create objectstore for database ${q}`,
x)}});return c(p)}function u(q){if("string"!==typeof q)throw new TypeError("expected string");}function v(q,p){const r=q.objectStore("keyvaluepairs").openCursor();return new Promise(x=>{const y=[];r.onsuccess=C=>{if(C=C.target.result){switch(p){case "entries":y.push([C.key,C.value]);break;case "keys":y.push(C.key);break;case "values":y.push(C.value)}C.continue()}else x(y)}})}class t{constructor(q){u(q);this.name=q}async ready(){await l(this.name)}set(q,p){u(q);return h(this.name,async r=>{var x=r.objectStore("keyvaluepairs").put(p,
q);x=c(x);r=d(r);await Promise.all([r,x])})}get(q){u(q);return f(this.name,async p=>{var r=p.objectStore("keyvaluepairs").get(q);r=c(r);p=d(p);[,p]=await Promise.all([p,r]);return p})}delete(q){u(q);return h(this.name,async p=>{var r=p.objectStore("keyvaluepairs").delete(q);r=c(r);p=d(p);await Promise.all([p,r])})}clear(){return h(this.name,async q=>{var p=q.objectStore("keyvaluepairs").clear();p=c(p);q=d(q);await Promise.all([q,p])})}keys(){return f(this.name,async q=>{if(a){var p=q.objectStore("keyvaluepairs").getAllKeys();
p=c(p)}else p=v(q,"keys");q=d(q);[,q]=await Promise.all([q,p]);return q})}values(){return f(this.name,async q=>{if(b){var p=q.objectStore("keyvaluepairs").getAll();p=c(p)}else p=v(q,"values");q=d(q);[,q]=await Promise.all([q,p]);return q})}entries(){return f(this.name,async q=>{var p=v(q,"entries");q=d(q);[,p]=await Promise.all([q,p]);return p})}}self.KVStorageContainer=t}"use strict";
{const e=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 c=!1;"undefined"===typeof indexedDB&&(c=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function d(l){throw Error(`"${l}" is not implemented`);
}function f(l){if("function"===typeof l)throw Error("localforage callback API is not implemented; please use the promise API instead");}function h(l){return"object"===typeof l?new Promise(m=>{const {port1:u,port2:v}=new MessageChannel;v.onmessage=t=>m(t.data);u.postMessage(l)}):Promise.resolve(l)}class g{constructor(l){this._inst=l;a.set(this,new Map)}_MaybeSwitchToMemoryFallback(l){if(!c)for(const m of b)if(l&&m.test(l.message)){console.error("Unable to use local storage, reverting to in-memory store: ",
l,l.message);c=!0;break}}async _getItemFallback(l){l=a.get(this).get(l);l=await h(l);return"undefined"===typeof l?null:l}async _setItemFallback(l,m){m=await h(m);a.get(this).set(l,m)}_removeItemFallback(l){a.get(this).delete(l)}_clearFallback(){a.get(this).clear()}_keysFallback(){return Array.from(a.get(this).keys())}IsUsingFallback(){return c}async getItem(l,m){f(m);if(c)return await this._getItemFallback(l);let u;try{u=await this._inst.get(l)}catch(v){this._MaybeSwitchToMemoryFallback(v);if(c)return await this._getItemFallback(l);
console.error(`Error reading '${l}' from storage, returning null: `,v);return null}return"undefined"===typeof u?null:u}async setItem(l,m,u){f(u);"undefined"===typeof m&&(m=null);if(c)await this._setItemFallback(l,m);else try{await this._inst.set(l,m)}catch(v){if(this._MaybeSwitchToMemoryFallback(v),c)await this._setItemFallback(l,m);else throw v;}}async removeItem(l,m){f(m);if(c)this._removeItemFallback(l);else try{await this._inst.delete(l)}catch(u){this._MaybeSwitchToMemoryFallback(u),c?this._removeItemFallback(l):
console.error(`Error removing '${l}' from storage: `,u)}}async clear(l){f(l);if(c)this._clearFallback();else try{await this._inst.clear()}catch(m){this._MaybeSwitchToMemoryFallback(m),c?this._clearFallback():console.error("Error clearing storage: ",m)}}async keys(l){f(l);if(c)return this._keysFallback();l=[];try{l=await this._inst.keys()}catch(m){this._MaybeSwitchToMemoryFallback(m);if(c)return this._keysFallback();console.error("Error getting storage keys: ",m)}return l}ready(l){f(l);return c?Promise.resolve(!0):
this._inst.ready()}createInstance(l){if("object"!==typeof l)throw new TypeError("invalid options object");l=l.name;if("string"!==typeof l)throw new TypeError("invalid store name");l=new e(l);return new g(l)}length(l){d("localforage.length()")}key(l,m){d("localforage.key()")}iterate(l,m){d("localforage.iterate()")}setDriver(l){d("localforage.setDriver()")}config(l){d("localforage.config()")}defineDriver(l){d("localforage.defineDriver()")}driver(){d("localforage.driver()")}supports(l){d("localforage.supports()")}dropInstance(){d("localforage.dropInstance()")}disableMemoryMode(){c=
!1}}self.localforage=new g(new e("localforage"))}
{"use strict";const e=self.C3;e.Supports={};e.Supports.WebAnimations=(()=>{try{if("Safari"===e.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}})();e.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;e.Supports.RequestIdleCallback=!!self.requestIdleCallback;e.Supports.ImageBitmap=!!self.createImageBitmap&&"Safari"!==
e.Platform.Browser;e.Supports.ImageBitmapOptions=!1;if(e.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{resizeWidth:10,resizeHeight:10,premultiplyAlpha:"none"}).then(b=>{e.Supports.ImageBitmapOptions=10===b.width&&10===b.height?!0:!1}).catch(b=>{e.Supports.ImageBitmapOptions=!1})}catch(b){e.Supports.ImageBitmapOptions=!1}e.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===e.Platform.Browser);e.Supports.PermissionsQuery=!(!navigator.permissions||
!navigator.permissions.query);e.Supports.Proxies="undefined"!==typeof Proxy;e.Supports.DownloadAttribute=(()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();e.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();e.Supports.Fetch="function"===typeof fetch;e.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==e.Platform.Browser&&navigator.storage&&navigator.storage.persist);e.Supports.StorageQuotaEstimate=
!!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);e.Supports.Fullscreen=(()=>{if("undefined"===typeof document||"iOS"===e.Platform.OS)return!1;const b=document.documentElement;return!!(b.requestFullscreen||b.msRequestFullscreen||b.mozRequestFullScreen||b.webkitRequestFullscreen)})();e.Supports.ImageDecoder="undefined"!==typeof self.ImageDecoder;e.Supports.NativeFileSystemAPI=!!self.showOpenFilePicker;e.Supports.NavigatorFontsQuery=!(!navigator.fonts||!navigator.fonts.query)}
{"use strict";const e=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(e.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,c){return a.reduce((d,f)=>{0<c&&Array.isArray(f)?Array.prototype.push.apply(d,b(f,c-1)):d.push(f);return d},[])}Array.prototype.flat=function(a=1){return b(this,a)}}Array.prototype.at||(Array.prototype.at=function(b){b=Math.trunc(b)||0;0>
b&&(b+=this.length);if(!(0>b||b>=this.length))return this[b]});String.prototype.at||(String.prototype.at=function(b){b=Math.trunc(b)||0;0>b&&(b+=this.length);if(!(0>b||b>=this.length))return this[b]});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((c,
d)=>b({usage:c,quota:d}),a))});"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}{"use strict";const e=self.C3;function b(a){let c=e.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+c)}self.assert=function(a,c){a||b(c)}}
{"use strict";const e=self.C3,b=self.C3X;e.IsNumber=function(c){return"number"===typeof c};e.IsFiniteNumber=function(c){return e.IsNumber(c)&&isFinite(c)};e.RequireNumber=function(c){if(!e.IsNumber(c))throw new TypeError("expected number");};e.RequireOptionalNumber=function(c){e.IsNullOrUndefined(c)};e.RequireNumberInRange=function(c,d,f){if(!e.IsNumber(c)||isNaN(c)||d>c||f<c)throw new RangeError("number outside of range");};e.RequireAllNumber=function(...c){for(let d of c);};e.RequireFiniteNumber=
function(c){if(!e.IsFiniteNumber(c))throw new TypeError("expected finite number");};e.RequireOptionalFiniteNumber=function(c){e.IsNullOrUndefined(c)};e.RequireAllFiniteNumber=function(...c){for(let d of c);};e.IsString=function(c){return"string"===typeof c};e.RequireString=function(c){if(!e.IsString(c))throw new TypeError("expected string");};e.RequireOptionalString=function(c){e.IsNullOrUndefined(c)};e.RequireAllString=function(...c){for(let d of c);};e.IsSimpleObject=function(c){return"object"!==
typeof c||null===c?!1:(c=Object.getPrototypeOf(c))?c.constructor===Object:null===c};e.RequireSimpleObject=function(c){if(!e.IsSimpleObject(c))throw new TypeError("expected simple object");};e.RequireOptionalSimpleObject=function(c){if(!e.IsNullOrUndefined(c)&&!e.IsSimpleObject(c))throw new TypeError("expected simple object");};e.IsObject=function(c){return"object"===typeof c&&null!==c&&!Array.isArray(c)};e.RequireObject=function(c){if(!e.IsObject(c))throw new TypeError("expected object");};e.RequireOptionalObject=
function(c){e.IsNullOrUndefined(c)};e.RequireAllObject=function(...c){for(let d of c);};e.IsFileLike=function(c){return e.IsInstanceOf(c,Blob)&&"string"===typeof c.name};e.RequireFileLike=function(c){if(!e.IsFileLike(c))throw new TypeError("expected file");};e.RequireOptionalFileLike=function(c){e.IsNullOrUndefined(c)};e.IsArray=function(c){return Array.isArray(c)};e.RequireArray=function(c){if(!e.IsArray(c))throw new TypeError("expected array");};e.RequireOptionalArray=function(c){e.IsNullOrUndefined(c)};
e.RequireAllArray=function(...c){for(let d of c);};e.Is2DArray=function(c){return e.IsArray(c)?c.length?e.IsArray(c[0])?!0:!1:!0:!1};e.Require2DArray=function(c){if(!e.Is2DArray(c))throw new TypeError("expected 2d array");for(let d of c)if(!e.IsArray(d))throw new TypeError("expected 2d array");};e.RequireOptional2DArray=function(c){e.IsNullOrUndefined(c)};e.IsFunction=function(c){return"function"===typeof c};e.RequireFunction=function(c,d){if(!e.IsFunction(c))throw new TypeError("expected function");
if(!e.IsNullOrUndefined(d)&&c!==d)throw new TypeError("expected same function reference");};e.RequireOptionalFunction=function(c){e.IsNullOrUndefined(c)};e.RequireAllFunction=function(...c){for(let d of c);};e.RequireAnyFunction=function(c,...d){if(!e.IsFunction(c))throw new TypeError("expected function");if(!d.length)throw Error("missing comparison functions");for(let f of d)if(!e.IsNullOrUndefined(f)&&c===f)return;throw new TypeError("expected same function reference");};e.RequireOptionalAllFunction=
function(...c){if(!e.IsNullOrUndefined(c))for(let d of c);};e.IsInstanceOf=function(c,d){return c instanceof d};e.IsInstanceOfAny=function(c,...d){for(let f of d)if(e.IsInstanceOf(c,f))return!0;return!1};e.RequireInstanceOf=function(c,d){if(!e.IsInstanceOf(c,d))throw new TypeError("unexpected type");};e.RequireOptionalInstanceOf=function(c,d){e.IsNullOrUndefined(c)};e.RequireAllInstanceOf=function(c,...d){for(let f of d);};e.RequireAnyInstanceOf=function(c,...d){if(!e.IsInstanceOfAny(c,...d))throw new TypeError("unexpected type");
};e.RequireAnyOptionalInstanceOf=function(c,...d){if(!e.IsNullOrUndefined(c)&&!e.IsInstanceOfAny(c,...d))throw new TypeError("unexpected type");};e.IsArrayOf=function(c,d){for(let f of c)if(!e.IsInstanceOf(f,d))return!1;return!0};e.IsArrayOfFiniteNumbers=function(c){for(let d of c)if(!e.IsFiniteNumber(d))return!1;return!0};e.RequireArrayOf=function(c,d){for(let f of c);};e.RequireOptionalArrayOf=function(c,d){if(!e.IsNullOrUndefined(c))for(let f of c);};e.RequireArrayOfAny=function(c,...d){for(let f of c);
};e.RequireOptionalArrayOfAny=function(c,...d){if(!e.IsNullOrUndefined(c))for(let f of c);};e.IsDOMNode=function(c,d){return e.IsNullOrUndefined(c)||!e.IsString(c.nodeName)?!1:!d||e.equalsNoCase(c.nodeName,d)};e.RequireDOMNode=function(c,d){if(e.IsNullOrUndefined(c)||!e.IsString(c.nodeName))throw new TypeError("expected DOM node");if(d&&!e.equalsNoCase(c.nodeName,d))throw new TypeError(`expected DOM '${d}' node`);};e.RequireOptionalDOMNode=function(c,d){e.IsNullOrUndefined(c)};e.IsHTMLElement=function(c,
d){return e.IsNullOrUndefined(c)||!e.IsString(c.tagName)?!1:!d||e.equalsNoCase(c.tagName,d)};e.RequireHTMLElement=function(c,d){if(e.IsNullOrUndefined(c)||!e.IsString(c.tagName))throw new TypeError("expected HTML element");if(d&&!e.equalsNoCase(c.tagName,d))throw new TypeError(`expected HTML '${d}' element`);};e.RequireOptionalHTMLElement=function(c,d){e.IsNullOrUndefined(c)};e.IsDrawable=function(c){return e.IsHTMLElement(c,"img")||e.IsHTMLElement(c,"canvas")||e.IsHTMLElement(c,"video")||"undefined"!==
typeof OffscreenCanvas&&c instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&c instanceof ImageBitmap};e.RequireDrawable=function(c){if(!e.IsDrawable(c))throw new TypeError("expected drawable");};e.RequireOptionalDrawable=function(c){e.IsNullOrUndefined(c)};e.IsDrawableOrImageData=function(c){return c instanceof ImageData?!0:e.IsDrawable(c)};e.RequireDrawableOrImageData=function(c){if(!e.IsDrawableOrImageData(c))throw new TypeError("expected drawable or image data");};e.RequireOptionalDrawableOrImageData=
function(c){if(!e.IsNullOrUndefined(c)&&!e.IsDrawableOrImageData(c))throw new TypeError("expected drawable or image data");};e.IsStringLike=function(c){return"string"===typeof c||c instanceof e.HtmlString||c instanceof e.BBString};e.RequireStringLike=function(c){if(!e.IsStringLike(c))throw new TypeError("expected string-like");};e.RequireOptionalStringLike=function(c){e.IsNullOrUndefined(c)};e.RequireAllStringLike=function(...c){for(let d of c);};e.RequireOverride=function(){throw Error("must be overridden");
};e.NotYetImplemented=function(){throw Error("not yet implemented");};e.IsDefined=function(c,...d){if("undefined"===typeof c)return!1;for(let f of d){if("undefined"===typeof c[f])return!1;c=c[f]}return!0};e.IsNullOrUndefined=function(c){return"undefined"===typeof c||null===c};e.AreArrayElementsOfSameType=function(c){let d=c[0].constructor;for(let f of c)if(f.constructor!==d)return!1;return d};e.AreArrayElementsOfType=function(c,d){for(let f of c)if(!(f instanceof d))return!1;return!0};const a=Object.getPrototypeOf(Uint8Array);
e.IsTypedArray=function(c){return e.IsInstanceOf(c,a)};e.RequireTypedArray=function(c){};e.WeakRequireTypedArray=function(c){e.WeakRequireInstanceOf(c,a)};e.WeakRequireAnyInstanceOf=function(c,...d){if(!e.WeakIsAnyInstanceOf(c,...d))throw new TypeError("unexpected type");};e.WeakIsAnyInstanceOf=function(c,...d){for(const f of d)if(e.WeakIsInstanceOf(c,f))return!0;return!1};e.WeakRequireInstanceOf=function(c,d){if(!e.WeakIsInstanceOf(c,d))throw new TypeError("unexpected type");};e.WeakIsInstanceOf=
function(c,d){for(;c=Object.getPrototypeOf(c);)if(c.constructor.name===d.name)return!0;return!1};b.RequireNumber=e.RequireNumber;b.RequireOptionalNumber=e.RequireOptionalNumber;b.RequireFiniteNumber=e.RequireFiniteNumber;b.RequireOptionalFiniteNumber=e.RequireOptionalFiniteNumber;b.RequireString=e.RequireString;b.RequireOptionalString=e.RequireOptionalString;b.RequireObject=e.RequireObject;b.RequireOptionalObject=e.RequireOptionalObject;b.RequireArray=e.RequireArray;b.RequireOptionalArray=e.RequireOptionalArray;
b.RequireFunction=e.RequireFunction;b.RequireOptionalFunction=e.RequireOptionalFunction;b.RequireInstanceOf=e.RequireInstanceOf;b.RequireOptionalInstanceOf=e.RequireOptionalInstanceOf;b.IsNullOrUndefined=e.IsNullOrUndefined}
{"use strict";const e=self.C3,b=new Map;e.RafLog=function(r,...x){b.has(r)||b.set(r,-1);-1===b.get(r)&&b.set(r,requestAnimationFrame(()=>{console.log(`%c${r}`,"font-weight: bold",...x);b.set(r,-1)}))};let a;e.StartMeasure=function(r){performance.mark(r);a||(a=new Map);a.has(r)||a.set(r,{current:0,total:0,average:0,calls:1,toString:function(){return`current => ${this.current.toPrecision(3)} :: average => ${this.average.toPrecision(3)} :: calls => ${this.calls}`}})};e.EndMeasure=function(r){performance.measure("measure",
r);const x=performance.getEntriesByName("measure")[0];r=a.get(r);r.current=x.duration;r.total+=r.current;r.average=r.total/r.calls;r.calls++;console.log(r.toString());performance.clearMarks();performance.clearMeasures()};e.GetCallStack=function(){return Error().stack};e.Debugger=function(){debugger};e.cast=function(r,x){return r&&r instanceof x?r:null};e.getName=function(r){return"undefined"===typeof r?"undefined":null===r?"null":"boolean"===typeof r?"<boolean>":e.IsNumber(r)?"<number>":e.IsString(r)?
"<string>":e.IsArray(r)?"<array>":"symbol"===typeof r?"<"+r.toString()+">":e.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>"};e.getType=function(r){return null===r?"null":Array.isArray(r)?"array":typeof r};e.range=function*(r,x){if(!isFinite(Math.abs(r-x)))throw Error("Invalid parameters");if(r>x)for(--r;r>=x;r--)yield r;else for(;r<x;r++)yield r};
function c(r,x){r=e.getType(r);x=e.getType(x);return"null"===r||"null"===x?!0:"undefined"===r||"undefined"===x?!1:r===x}let d=new Map,f=new Map,h=new WeakMap,g=new WeakMap;e.DefendHandler={};const l=new Set(["then","splice"]);function m(r){console.warn("[Defence] "+r+" @",e.GetCallStack())}e.DefendHandler.get=function(r,x){x in r||"symbol"===typeof x||l.has(x)||m(`Accessed missing property '${x}' from defended object '${e.getName(r)}', returning undefined`);g.has(r)&&"symbol"!==typeof x&&!l.has(x)&&
m(`Accessed property '${x}' on a released object '${e.getName(r)}'\nObject was originally released at: ${g.get(r)})\nCall stack at access: `);return r[x]};e.DefendHandler.set=function(r,x,y){x in r||d.has(r)||m(`Set non-existent property '${x}' to '${y}' on defended object '${e.getName(r)}'`);c(r[x],y)||d.has(r)||m(`Set '${e.getType(r[x])}' property '${x}' to type '${e.getType(y)}' on defended object '${e.getName(r)}'`);g.has(r)&&m(`Set property '${x}' on a released object '${e.getName(r)}'\nObject was originally released at: ${g.get(r)})\nCall stack at access: `);
r[x]=y;return!0};e.DefendHandler.deleteProperty=function(r,x){throw new ReferenceError(`Cannot delete property '${x}' from defended object '${e.getName(r)}'`);};e.DefendHandler.defineProperty=function(r,x,y){throw new ReferenceError(`Cannot define property '${x}' on defended object '${e.getName(r)}'`);};e.DefendHandler.enumerate=function(r){throw new ReferenceError(`Cannot enumerate defended object '${e.getName(r)}'`);};let u=-1;function v(){u=-1;if(0<d.size||0<f.size){let r=[...new Set([...d.keys()].map(x=>
e.getName(x)))].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}`);d.clear();f.clear()}}e.DefendedBase=class{constructor(){if(e.isDebugDefend&&e.Supports.Proxies){var r=new.target;r=Object.create(r.prototype);var x=new Proxy(r,e.DefendHandler);d.set(r,x);f.set(x,r);h.set(x,r);-1===u&&(u=requestAnimationFrame(v));return x}}};e.debugDefend=function(r){if(e.isDebugDefend&&
e.Supports.Proxies&&r instanceof e.DefendedBase){if(!f.has(r))return r;let x=f.get(r);f.delete(r);d.delete(x);return r}return e.isDebug?Object.seal(r):r};e.New=function(r,...x){let y;try{y=new r(...x)}catch(C){throw f.clear(),d.clear(),C;}e.isDebugDefend&&p(r,y);return e.debugDefend(y)};e.Release=function(r){(r=h.get(r))&&g.set(r,e.GetCallStack())};e.WasReleased=function(r){return(r=h.get(r))?!!g.get(r):!1};let t=new Map;function q(r){let x=new Set;for(let y in r)x.add(y);return x}function p(r,x){x=
q(x);let y=t.get(r);if(y){let C=[];for(let G of y.values())x.has(G)?x.delete(G):C.push(G);e.appendArray(C,[...x]);C.length&&console.warn(`[Defence] '${e.getName(r)}' constructor creates inconsistent properties: ${C.join(", ")}`)}else t.set(r,x)}e.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 e=self.C3,b=2*Math.PI,a=Math.PI/180,c=180/Math.PI;e.wrap=function(h,g,l){h=Math.floor(h);g=Math.floor(g);l=Math.floor(l);return h<g?(h=l-(g-h)%(l-g),h===l?0:h):g+(h-g)%(l-g)};e.mapToRange=function(h,g,l,m,u){return(h-g)*(u-m)/(l-g)+m};e.normalize=function(h,g,l){return(h-g)/(l-g)};e.clamp=function(h,g,l){return h<g?g:h>l?l:h};e.clampAngle=function(h){h%=b;0>h&&(h+=b);return h};e.toRadians=function(h){return h*a};e.toDegrees=function(h){return h*c};e.distanceTo=function(h,g,l,m){return Math.hypot(l-
h,m-g)};e.distanceSquared=function(h,g,l,m){h=l-h;g=m-g;return h*h+g*g};e.angleTo=function(h,g,l,m){return Math.atan2(m-g,l-h)};e.angleDiff=function(h,g){if(h===g)return 0;h=Math.sin(h)*Math.sin(g)+Math.cos(h)*Math.cos(g);return 1<=h?0:-1>=h?Math.PI:Math.acos(h)};e.angleRotate=function(h,g,l){let m=Math.sin(h),u=Math.cos(h),v=Math.sin(g),t=Math.cos(g);return Math.acos(m*v+u*t)>l?0<u*v-m*t?e.clampAngle(h+l):e.clampAngle(h-l):e.clampAngle(g)};e.angleClockwise=function(h,g){return 0>=Math.cos(h)*Math.sin(g)-
Math.sin(h)*Math.cos(g)};e.angleLerp=function(h,g,l,m=0){let u=e.angleDiff(h,g);m*=b;return e.angleClockwise(g,h)?e.clampAngle(h+(u+m)*l):e.clampAngle(h-(u+m)*l)};e.angleLerpClockwise=function(h,g,l,m=0){const u=e.angleDiff(h,g);m*=b;return e.angleClockwise(g,h)?e.clampAngle(h+(u+m)*l):e.clampAngle((b-u+m)*l)};e.angleLerpAntiClockwise=function(h,g,l,m=0){const u=e.angleDiff(h,g);m*=b;return e.angleClockwise(g,h)?e.clampAngle((-b+u-m)*l):e.clampAngle(h-(u+m)*l)};e.lerp=function(h,g,l){return h+l*(g-
h)};e.unlerp=function(h,g,l){return h===g?0:(l-h)/(g-h)};e.relerp=function(h,g,l,m,u){return e.lerp(m,u,e.unlerp(h,g,l))};e.qarp=function(h,g,l,m){return e.lerp(e.lerp(h,g,m),e.lerp(g,l,m),m)};e.cubic=function(h,g,l,m,u){return e.lerp(e.qarp(h,g,l,u),e.qarp(g,l,m,u),u)};e.cosp=function(h,g,l){return(h+g+(h-g)*Math.cos(l*Math.PI))/2};e.isPOT=function(h){return 0<h&&0===(h-1&h)};e.nextHighestPowerOfTwo=function(h){--h;for(let g=1;32>g;g<<=1)h|=h>>g;return h+1};e.roundToNearestFraction=function(h,g){return Math.round(h*
g)/g};e.floorToNearestFraction=function(h,g){return Math.floor(h*g)/g};e.round6dp=function(h){return Math.round(1E6*h)/1E6};e.toFixed=function(h,g){h=h.toFixed(g);for(g=h.length-1;0<=g&&"0"===h.charAt(g);--g);0<=g&&"."===h.charAt(g)&&--g;return 0>g?h:h.substr(0,g+1)};e.PackRGB=function(h,g,l){return e.clamp(h,0,255)|e.clamp(g,0,255)<<8|e.clamp(l,0,255)<<16};e.PackRGBAEx=function(h,g,l,m){h=e.clamp(Math.floor(1024*h),-8192,8191);g=e.clamp(Math.floor(1024*g),-8192,8191);l=e.clamp(Math.floor(1024*l),
-8192,8191);m=e.clamp(Math.floor(1023*m),0,1023);0>h&&(h+=16384);0>g&&(g+=16384);0>l&&(l+=16384);return-(274877906944*h+16777216*g+1024*l+m)};e.PackRGBEx=function(h,g,l){return e.PackRGBAEx(h,g,l,1)};function d(h){return 0===h&&0>1/h}e.GetRValue=function(h){if(0<=h)return(h&255)/255;h=Math.floor(-h/274877906944);8191<h&&(h-=16384);return h/1024};e.GetGValue=function(h){if(0<=h)return((h&65280)>>8)/255;h=Math.floor(-h%274877906944/16777216);8191<h&&(h-=16384);return h/1024};e.GetBValue=function(h){if(0<=
h)return((h&16711680)>>16)/255;h=Math.floor(-h%16777216/1024);8191<h&&(h-=16384);return h/1024};e.GetAValue=function(h){return d(h)?0:0<=h?1:Math.floor(-h%1024)/1023};e.greatestCommonDivisor=function(h,g){h=Math.floor(h);for(g=Math.floor(g);0!==g;){let l=g;g=h%g;h=l}return h};const f=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];e.getAspectRatio=function(h,g){h=Math.floor(h);g=Math.floor(g);if(h===g)return[1,1];for(var l of f){let m=h/l[0]*l[1];if(1>Math.abs(g-m))return l.slice(0);
m=h/l[1]*l[0];if(1>Math.abs(g-m))return[l[1],l[0]]}l=e.greatestCommonDivisor(h,g);return[h/l,g/l]};e.segmentsIntersect=function(h,g,l,m,u,v,t,q){var p=Math.min(h,l),r=Math.max(u,t);if(Math.max(h,l)<Math.min(u,t)||p>r)return!1;p=Math.min(g,m);r=Math.max(v,q);if(Math.max(g,m)<Math.min(v,q)||p>r)return!1;p=u-h+t-l;r=v-g+q-m;h=l-h;g=m-g;u=t-u;v=q-v;q=Math.abs(g*u-v*h);return Math.abs(u*r-v*p)>q?!1:Math.abs(h*r-g*p)<=q};e.segmentsIntersectPreCalc=function(h,g,l,m,u,v,t,q,p,r,x,y){const C=Math.max(p,x);
if(v<Math.min(p,x)||u>C)return!1;u=Math.max(r,y);if(q<Math.min(r,y)||t>u)return!1;t=p-h+x-l;q=r-g+y-m;h=l-h;g=m-g;p=x-p;r=y-r;y=Math.abs(g*p-r*h);return Math.abs(p*q-r*t)>y?!1:Math.abs(h*q-g*t)<=y};e.segmentIntersectsQuad=function(h,g,l,m,u){const v=Math.min(h,l),t=Math.max(h,l),q=Math.min(g,m),p=Math.max(g,m),r=u.getTlx(),x=u.getTly(),y=u.getTrx(),C=u.getTry(),G=u.getBrx(),A=u.getBry(),E=u.getBlx();u=u.getBly();return e.segmentsIntersectPreCalc(h,g,l,m,v,t,q,p,r,x,y,C)||e.segmentsIntersectPreCalc(h,
g,l,m,v,t,q,p,y,C,G,A)||e.segmentsIntersectPreCalc(h,g,l,m,v,t,q,p,G,A,E,u)||e.segmentsIntersectPreCalc(h,g,l,m,v,t,q,p,E,u,r,x)};e.segmentIntersectsAnyN=function(h,g,l,m,u){const v=Math.min(h,l),t=Math.max(h,l),q=Math.min(g,m),p=Math.max(g,m);let r=0;for(let x=u.length-4;r<=x;r+=2)if(e.segmentsIntersectPreCalc(h,g,l,m,v,t,q,p,u[r],u[r+1],u[r+2],u[r+3]))return!0;return e.segmentsIntersectPreCalc(h,g,l,m,v,t,q,p,u[r],u[r+1],u[0],u[1])};e.rayIntersect=function(h,g,l,m,u,v,t,q){l-=h;v=q-v;const p=l*
v-(m-g)*(t-u);if(0===p)return 2;m=((g-m)*(t-h)+l*(q-g))/p;return 0<m&&1.000001>m?(v*(t-h)+(u-t)*(q-g))/p:2};e.rayIntersectExtended=function(h,g,l,m,u,v,t,q,p){const r=(t-u)*p;p*=q-v;return e.rayIntersect(h,g,l,m,u-r,v-p,t+r,q+p)};e.isPointInTriangleInclusive=function(h,g,l,m,u,v,t,q){u-=l;v-=m;t-=l;q-=m;h-=l;l=g-m;g=u*u+v*v;m=u*t+v*q;u=u*h+v*l;v=t*t+q*q;t=t*h+q*l;q=1/(g*v-m*m);v=(v*u-m*t)*q;u=(g*t-m*u)*q;return 0<=v&&0<=u&&1>=v+u};e.triangleCartesianToBarycentric=function(h,g,l,m,u,v,t,q){u-=l;v-=
m;t-=l;q-=m;h-=l;const p=g-m;g=u*u+v*v;m=u*t+v*q;l=t*t+q*q;u=h*u+p*v;v=h*t+p*q;t=g*l-m*m;q=(l*u-m*v)/t;u=(g*v-m*u)/t;return[1-q-u,q,u]};e.triangleBarycentricToCartesian=function(h,g,l,m,u,v,t,q,p){return[h*m+g*v+l*q,h*u+g*t+l*p]}}
{"use strict";const e=self.C3;let b=null,a="";if("undefined"!==typeof document){b=document;const l=document.querySelector("base");if(a=l&&l.hasAttribute("href")?l.getAttribute("href"):"")a.startsWith("/")&&(a=a.substr(1)),a.endsWith("/")||(a+="/")}e.GetBaseHref=function(){return a};e.GetBaseURL=function(){if(!b)return"";const l=b.location;return e.GetPathFromURL(l.origin+l.pathname)+a};e.GetPathFromURL=function(l){if(!l.length||l.endsWith("/")||l.endsWith("\\"))return l;const m=Math.max(l.lastIndexOf("/"),
l.lastIndexOf("\\"));return-1===m?"":l.substr(0,m+1)};e.GetFilenameFromURL=function(l){if(!l.length)return l;if(l.endsWith("/")||l.endsWith("\\"))return"";const m=Math.max(l.lastIndexOf("/"),l.lastIndexOf("\\"));return-1===m?l:l.substr(m+1)};e.GetFileExtension=function(l){let m=l.lastIndexOf(".");return 1>m?"":l.substr(m)};e.GetFileNamePart=function(l){let m=l.lastIndexOf(".");return 1>m?l:l.substr(0,m)};e.NormalizeFileSeparator=function(l){return l.replace(/\\/g,"/")};e.IsFileExtension=function(l,
m){l=l?e.GetFileExtension(l).slice(1):"";return m===l};e.FileNameEquals=function(l,m){let u,v;e.IsFileLike(l)&&(u=e.GetFileNamePart(l.name));e.IsString(l)&&(u=e.GetFileNamePart(l));e.IsFileLike(m)&&(v=e.GetFileNamePart(m.name));e.IsString(m)&&(v=e.GetFileNamePart(m));return u===v};e.ParseFilePath=function(l){l=e.NormalizeFileSeparator(l);let m=/^\w:\//.exec(l);m?(m=m[0],l=l.slice(3),"/"!==l[0]&&(l="/"+l)):m="";l=l.replace(/\/{2,}/g,"/");1<l.length&&"/"===l.slice(-1)&&(l=l.slice(0,-1));var u=l.lastIndexOf("/")+
1;let v="",t=l,q="";0<u&&(v=l.slice(0,u),t=l.slice(u));l=t;u=t.lastIndexOf(".");0<u&&(q=t.slice(u),l=t.slice(0,-q.length));return{dir:v,base:t,name:l,root:m,ext:q,full:m+v+t}};e.Wait=function(l,m){return new Promise((u,v)=>{self.setTimeout(u,l,m)})};e.swallowException=function(l){try{l()}catch(m){e.isDebug&&console.warn("Swallowed exception: ",m)}};e.noop=function(){};e.equalsNoCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m||l.normalize().toLowerCase()===m.normalize().toLowerCase()};
e.equalsCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m?!0:l.normalize()===m.normalize()};e.typedArraySet16=function(l,m,u){l[u++]=m[0];l[u++]=m[1];l[u++]=m[2];l[u++]=m[3];l[u++]=m[4];l[u++]=m[5];l[u++]=m[6];l[u++]=m[7];l[u++]=m[8];l[u++]=m[9];l[u++]=m[10];l[u++]=m[11];l[u++]=m[12];l[u++]=m[13];l[u++]=m[14];l[u]=m[15]};e.truncateArray=function(l,m){l.length=m};e.clearArray=function(l){l&&0!==l.length&&e.truncateArray(l,0)};e.clear2DArray=function(l){if(l){for(let m=0;m<
l.length;m++)e.truncateArray(l[m],0);e.truncateArray(l,0)}};e.extendArray=function(l,m,u){m|=0;var v=l.length;if(!(m<=v))for(;v<m;++v)l.push(u)};e.resizeArray=function(l,m,u){m|=0;const v=l.length;m<v?e.truncateArray(l,m):m>v&&e.extendArray(l,m,u)};e.shallowAssignArray=function(l,m){e.clearArray(l);e.appendArray(l,m)};e.appendArray=function(l,m){if(1E4>m.length)l.push(...m);else for(let u=0,v=m.length;u<v;++u)l.push(m[u])};e.arrayRemove=function(l,m){m=Math.floor(m);if(!(0>m||m>=l.length)){for(var u=
l.length-1;m<u;++m)l[m]=l[m+1];e.truncateArray(l,u)}};e.arrayFindRemove=function(l,m){m=l.indexOf(m);0<=m&&l.splice(m,1)};e.arraysEqual=function(l,m){let u=l.length;if(m.length!==u)return!1;for(let v=0;v<u;++v)if(l[v]!==m[v])return!1;return!0};e.arrayFilterOut=function(l,m){let u=[],v=0;for(let t=0,q=l.length;t<q;++t){let p=l[t];m(p)?u.push(p):(l[v]=p,++v)}e.truncateArray(l,v);return u};e.arrayRemoveAllInSet=function(l,m){const u=l.length;let v=0;for(let t=0,q=l.length;t<q;++t){let p=l[t];m.has(p)||
(l[v++]=p)}e.truncateArray(l,v);return u-v};e.isArrayIndexInBounds=function(l,m){return l!==Math.floor(l)?!1:0<=l&&l<m.length};e.validateArrayIndex=function(l,m){if(!e.isArrayIndexInBounds(l,m))throw new RangeError("array index out of bounds");};e.cloneArray=function(l){return l.slice()};e.deepCloneArray=function(l,m){let u=[];for(let v of l)if(e.IsObject(v)){l=m(v);if(!l)throw Error("missing clone");if(l.constructor!==v.constructor)throw Error("object is not a clone");u.push(l)}else e.IsArray(v)?
u.push(e.deepCloneArray(v,m)):u.push(v);return u};e.clone2DArray=function(l){let m=[];for(let u of l)m.push(u.slice());return m};e.mergeSets=function(l,m){return new Set([...l,...m])};e.mergeSetsInPlace=function(l,m){for(const u of m)l.add(u);return l};e.first=function(l){for(let m of l)return m;return null};e.xor=function(l,m){return!l!==!m};e.compare=function(l,m,u){switch(m){case 0:return l===u;case 1:return l!==u;case 2:return l<u;case 3:return l<=u;case 4:return l>u;case 5:return l>=u;default:return!1}};
e.hasAnyOwnProperty=function(l){for(let m in l)if(l.hasOwnProperty(m))return!0;return!1};e.PromiseAllWithProgress=function(l,m){return l.length?new Promise((u,v)=>{const t=[];let q=0,p=!1;for(let r=0,x=l.length;r<x;++r)t.push(void 0),l[r].then(y=>{p||(t[r]=y,++q,q===l.length?u(t):m(q,l.length))}).catch(y=>{p=!0;v(y)})}):Promise.resolve([])};let c=[];e.AddLibraryMemoryCallback=function(l){c.push(l)};e.GetEstimatedLibraryMemoryUsage=function(){let l=0;for(let m of c){let u=m();l+=u}return Math.floor(l)};
let d=1;const f=new Map,h=new MessageChannel;h.port2.onmessage=function(l){l=l.data;const m=f.get(l);f.delete(l);m&&m(performance.now())};e.RequestUnlimitedAnimationFrame=function(l){const m=d++;f.set(m,l);h.port1.postMessage(m);return m};e.CancelUnlimitedAnimationFrame=function(l){f.delete(l)};e.PostTask=e.RequestUnlimitedAnimationFrame;e.WaitForNextTask=function(){return new Promise(l=>e.PostTask(l))};const g=new Set;e.RequestPostAnimationFrame=function(l){const m=self.requestAnimationFrame(async u=>
{await e.WaitForNextTask();g.has(m)&&(g.delete(m),l(u))});g.add(m);return m};e.CancelPostAnimationFrame=function(l){g.has(l)&&(self.cancelAnimationFrame(l),g.delete(l))}}
{"use strict";const e=self.C3;e.IsAbsoluteURL=function(b){return/^(?:[a-z\-]+:)?\/\//.test(b)||"data:"===b.substr(0,5)||"blob:"===b.substr(0,5)};e.IsRelativeURL=function(b){return!e.IsAbsoluteURL(b)};e.ThrowIfNotOk=function(b){if(!b.ok)throw Error(`fetch '${b.url}' response returned ${b.status} ${b.statusText}`);};e.FetchOk=function(b,a){return fetch(b,a).then(c=>{e.ThrowIfNotOk(c);return c})};e.FetchText=function(b){return e.FetchOk(b).then(a=>a.text())};e.FetchJson=function(b){return e.FetchOk(b).then(a=>
a.json())};e.FetchBlob=function(b){return e.FetchOk(b).then(a=>a.blob())};e.FetchArrayBuffer=function(b){return e.FetchOk(b).then(a=>a.arrayBuffer())};e.FetchImage=function(b){return new Promise((a,c)=>{const d=new Image;d.onload=()=>a(d);d.onerror=f=>c(f);d.src=b})};e.BlobToArrayBuffer=function(b){return"function"===typeof b.arrayBuffer?b.arrayBuffer():new Promise((a,c)=>{const d=new FileReader;d.onload=()=>a(d.result);d.onerror=()=>c(d.error);d.readAsArrayBuffer(b)})};e.BlobToString=function(b){return"function"===
typeof b.text?b.text():new Promise((a,c)=>{const d=new FileReader;d.onload=()=>a(d.result);d.onerror=()=>c(d.error);d.readAsText(b)})};e.BlobToJson=function(b){return e.BlobToString(b).then(a=>JSON.parse(a))};e.BlobToImage=async function(b,a){b=URL.createObjectURL(b);try{const c=await e.FetchImage(b);URL.revokeObjectURL(b);b="";a&&"function"===typeof c.decode&&await c.decode();return c}finally{b&&URL.revokeObjectURL(b)}};e.CreateCanvas=function(b,a){if("undefined"!==typeof document&&"function"===
typeof document.createElement){const c=document.createElement("canvas");c.width=b;c.height=a;return c}return new OffscreenCanvas(b,a)};e.CanvasToBlob=function(b,a,c){"number"!==typeof c&&(c=1);a=a||"image/png";c=e.clamp(c,0,1);return b.toBlob?new Promise(d=>b.toBlob(d,a,c)):b.convertToBlob?b.convertToBlob({type:a,quality:c}):e.Asyncify(()=>e.CanvasToBlobSync(b,a,c))};e.CanvasToBlobSync=function(b,a,c){"number"!==typeof c&&(c=1);a=a||"image/png";c=e.clamp(c,0,1);return e.DataURIToBinaryBlobSync(b.toDataURL(a,
c))};e.DataURIToBinaryBlobSync=function(b){b=e.ParseDataURI(b);return e.BinaryStringToBlob(b.data,b.mime_type)};e.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 c=b.substring(5,a);b=b.substring(a+1);a=c.split(";");c=a[0]||"";let d=a[2];b="base64"===a[1]||"base64"===d?atob(b):decodeURIComponent(b);return{mime_type:c,data:b}};e.BinaryStringToBlob=function(b,a){var c=b.length;
let d=c>>2,f=new Uint8Array(c),h=new Uint32Array(f.buffer,0,d),g,l;for(l=g=0;g<d;++g)h[g]=b.charCodeAt(l++)|b.charCodeAt(l++)<<8|b.charCodeAt(l++)<<16|b.charCodeAt(l++)<<24;for(c&=3;c--;)f[l]=b.charCodeAt(l),++l;return a?new Blob([f],{type:a}):new Blob([f])};e.DrawableToBlob=function(b,a,c){const d=e.CreateCanvas(b.width,b.height);d.getContext("2d").drawImage(b,0,0);return e.CanvasToBlob(d,a,c)};e.ImageDataToBlobSync=function(b,a,c){const d=e.CreateCanvas(b.width,b.height);d.getContext("2d").putImageData(b,
0,0);return e.CanvasToBlobSync(d,a,c)};e.ImageDataToBlob=function(b,a,c){if(e.Supports.ImageBitmapOptions)return createImageBitmap(b,{premultiplyAlpha:"none"}).then(d=>e.DrawableToBlob(d,a,c));if(e.Supports.ImageBitmap)return createImageBitmap(b).then(d=>e.DrawableToBlob(d,a,c));{const d=e.CreateCanvas(b.width,b.height);d.getContext("2d").putImageData(b,0,0);return e.CanvasToBlob(d,a,c)}};e.CopySet=function(b,a){b.clear();for(const c of a)b.add(c)};e.MapToObject=function(b){const a=Object.create(null);
for(const [c,d]of b.entries())a[c]=d;return a};e.ObjectToMap=function(b,a){a.clear();for(const [c,d]of Object.entries(b))a.set(c,d)};e.ToSuperJSON=function c(a){if("object"===typeof a&&null!==a){if(a instanceof Set)return{_c3type_:"set",data:[...a].map(d=>c(d))};if(a instanceof Map)return{_c3type_:"map",data:[...a].map(d=>[d[0],c(d[1])])};{const d=Object.create(null);for(const [f,h]of Object.entries(a))d[f]=c(h);return d}}return a};e.FromSuperJSON=function d(c){if("object"===typeof c&null!==c){if("set"===
c._c3type_)return new Set(c.data.map(f=>d(f)));if("map"===c._c3type_)return new Map(c.data.map(f=>[f[0],d(f[1])]));{const f=Object.create(null);for(const [h,g]of Object.entries(c))f[h]=d(g);return f}}return c};e.CSSToCamelCase=function(c){let d="",f=!1;for(const h of c)"-"===h?f=!0:f?(d+=h.toUpperCase(),f=!1):d+=h;return d};e.IsIterator=function(c){return"object"===typeof c&&"function"===typeof c.next};e.MakeFilledArray=function(c,d){const f=[];if("function"===typeof d)for(var h=0;h<c;++h)f.push(d());
else for(h=0;h<c;++h)f.push(d);return f}}
{"use strict";const e=self.C3,b=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,a=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;function c(f){return 0===f.length?"00":1===f.length?"0"+f:f}function d(f,h,g){0>g&&(g+=1);1<g&&--g;return g<1/6?f+6*(h-f)*g:.5>g?h:g<2/3?f+(h-f)*(2/3-g)*6:f}e.Color=class{constructor(f,h,g,l){this._a=this._b=this._g=this._r=0;f instanceof e.Color?this.set(f):this.setRgba(f||0,h||0,g||0,l||0)}setRgb(f,h,g){this._r=+f;this._g=+h;this._b=+g;this.clamp();return this}setRgba(f,h,g,l){this._r=
+f;this._g=+h;this._b=+g;this._a=+l;this.clamp();return this}set(f){this._r=f._r;this._g=f._g;this._b=f._b;this._a=f._a;return this}copy(f){return this.set(f)}add(f){this._r+=f._r;this._g+=f._g;this._b+=f._b;this._a+=f._a;this.clamp()}addRgb(f,h,g,l=0){this._r+=+f;this._g+=+h;this._b+=+g;this._a+=+l;this.clamp()}diff(f){this.setR(Math.max(this._r,f._r)-Math.min(this._r,f._r));this.setG(Math.max(this._g,f._g)-Math.min(this._g,f._g));this.setB(Math.max(this._b,f._b)-Math.min(this._b,f._b));this.setA(Math.max(this._a,
f._a)-Math.min(this._a,f._a));this.clamp()}copyRgb(f){this._r=f._r;this._g=f._g;this._b=f._b}setR(f){this._r=e.clamp(+f,0,1)}getR(){return this._r}setG(f){this._g=e.clamp(+f,0,1)}getG(){return this._g}setB(f){this._b=e.clamp(+f,0,1)}getB(){return this._b}setA(f){this._a=e.clamp(+f,0,1)}getA(){return this._a}clone(){return e.New(e.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(f,h){f[h++]=
this._r;f[h++]=this._g;f[h++]=this._b;f[h]=this._a}writeRGBToTypedArray(f,h){f[h++]=this._r;f[h++]=this._g;f[h]=this._b}equals(f){return this._r===f._r&&this._g===f._g&&this._b===f._b&&this._a===f._a}equalsIgnoringAlpha(f){return this._r===f._r&&this._g===f._g&&this._b===f._b}equalsRgb(f,h,g){return this._r===f&&this._g===h&&this._b===g}equalsRgba(f,h,g,l){return this._r===f&&this._g===h&&this._b===g&&this._a===l}equalsF32Array(f,h){return f[h]===Math.fround(this._r)&&f[h+1]===Math.fround(this._g)&&
f[h+2]===Math.fround(this._b)&&f[h+3]===Math.fround(this._a)}equalsRGBF32Array(f,h){return f[h]===Math.fround(this._r)&&f[h+1]===Math.fround(this._g)&&f[h+2]===Math.fround(this._b)}multiply(f){this._r*=f._r;this._g*=f._g;this._b*=f._b;this._a*=f._a}multiplyAlpha(f){this._r*=f;this._g*=f;this._b*=f;this._a*=f}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=e.clamp(this._r,0,1);
this._g=e.clamp(this._g,0,1);this._b=e.clamp(this._b,0,1);this._a=e.clamp(this._a,0,1);return this}setFromRgbValue(f){this._r=e.GetRValue(f);this._g=e.GetGValue(f);this._b=e.GetBValue(f);this._a=e.GetAValue(f)}getCssRgb(f,h,g){f=e.IsFiniteNumber(f)?f:this.getR();h=e.IsFiniteNumber(h)?h:this.getG();g=e.IsFiniteNumber(g)?g:this.getB();return`rgb(${100*f}%, ${100*h}%, ${100*g}%)`}getCssRgba(f,h,g,l){f=e.IsFiniteNumber(f)?f:this.getR();h=e.IsFiniteNumber(h)?h:this.getG();g=e.IsFiniteNumber(g)?g:this.getB();
l=e.IsFiniteNumber(l)?l:this.getA();return`rgba(${100*f}%, ${100*h}%, ${100*g}%, ${l})`}toHexString(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return"#"+c(f.toString(16))+c(h.toString(16))+c(g.toString(16))}parseHexString(f){if("string"!==typeof f)return!1;f=f.trim();"#"===f.charAt(0)&&(f=f.substr(1));let h,g;if(3===f.length)h=parseInt(f[0],16)/15,g=parseInt(f[1],16)/15,f=parseInt(f[2],16)/15;else if(6===f.length)h=parseInt(f.substr(0,2),16)/
255,g=parseInt(f.substr(2,2),16)/255,f=parseInt(f.substr(4,2),16)/255;else return!1;isFinite(h)&&this.setR(h);isFinite(g)&&this.setG(g);isFinite(f)&&this.setB(f);this.setA(1);return!0}toCommaSeparatedRgb(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return`${f}, ${h}, ${g}`}toRgbArray(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return[f,h,g]}parseCommaSeparatedRgb(f){if("string"!==typeof f)return!1;
f=f.replace(/^rgb\(|\)|%/,"");var h=f.split(",");if(3>h.length)return!1;f=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255;h=parseInt(h[2].trim(),10)/255;isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(f){if("string"!==typeof f)return!1;f=f.replace(/^rgb\(|\)|%/,"");var h=f.split(",");if(3>h.length)return!1;f=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100;h=parseInt(h[2].trim(),
10)/100;isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedRgba(f){if("string"!==typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var h=f.split(",");if(4>h.length)return!1;f=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255,l=parseInt(h[2].trim(),10)/255;h=parseFloat(h[3].trim());isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseCommaSeparatedPercentageRgba(f){if("string"!==
typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var h=f.split(",");if(4>h.length)return!1;f=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100,l=parseInt(h[2].trim(),10)/100;h=parseFloat(h[3].trim());isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseString(f){if("string"!==typeof f)return!1;f=f.replace(/\s+/,"");if(f.includes(",")){if(f.startsWith("rgb("))return f.includes("%")?this.parseCommaSeparatedPercentageRgb(f):
this.parseCommaSeparatedRgb(f);if(f.startsWith("rgba("))return f.includes("%")?this.parseCommaSeparatedPercentageRgba(f):this.parseCommaSeparatedRgba(f);if(f.startsWith("hsl(")||f.startsWith("hsla("))return this.parseHSLString(f);{const h=f.split(",");if(f.includes("%")){if(3===h.length)return this.parseCommaSeparatedPercentageRgb(f);if(4===h.length)return this.parseCommaSeparatedPercentageRgba(f)}else{if(3===h.length)return this.parseCommaSeparatedRgb(f);if(4===h.length)return this.parseCommaSeparatedRgba(f)}return!1}}return this.parseHexString(f)}toJSON(){return[this._r,
this._g,this._b,this._a]}setFromHSLA(f,h,g,l){f%=360;h=e.clamp(h,0,100);g=e.clamp(g,0,100);l=e.clamp(l,0,1);f/=360;h/=100;g/=100;if(0===h)g=h=f=g;else{const m=.5>g?g*(1+h):g+h-g*h,u=2*g-m;g=d(u,m,f+1/3);h=d(u,m,f);f=d(u,m,f-1/3)}this.setR(g);this.setG(h);this.setB(f);this.setA(l);return this}parseHSLString(f){var h=f.replace(/ |hsl|hsla|\(|\)|;/gi,"");f=b.exec(h);h=a.exec(h);return f&&4===f.length?(this.setFromHSLA(+f[1],+f[2],+f[3],1),!0):h&&5===h.length?(this.setFromHSLA(+f[1],+f[2],+f[3],+f[4]),
!0):!1}toHSLAString(){var f=this._r;const h=this._g,g=this._b,l=this._a,m=e.Color.GetHue(f,h,g),u=e.Color.GetSaturation(f,h,g);f=e.Color.GetLuminosity(f,h,g);return`hsla(${m}, ${u}%, ${f}%, ${l})`}toHSLAArray(){const f=this._r,h=this._g,g=this._b;return[e.Color.GetHue(f,h,g),e.Color.GetSaturation(f,h,g),e.Color.GetLuminosity(f,h,g),this._a]}setFromJSON(f){!Array.isArray(f)||3>f.length||(this._r=f[0],this._g=f[1],this._b=f[2],this._a=4<=f.length?f[3]:1)}set r(f){this.setR(f)}get r(){return this.getR()}set g(f){this.setG(f)}get g(){return this.getG()}set b(f){this.setB(f)}get b(){return this.getB()}set a(f){this.setA(f)}get a(){return this.getA()}setAtIndex(f,
h){switch(f){case 0:this.setR(h);break;case 1:this.setG(h);break;case 2:this.setB(h);break;case 3:this.setA(h);break;default:throw new RangeError("invalid color index");}}getAtIndex(f){switch(f){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 Equals(f,h){let g;if(Array.isArray(f))g=new e.Color,g.setFromJSON(f);else if(f instanceof e.Color)g=f;else throw Error("unexpected type");if(Array.isArray(h))f=
new e.Color,f.setFromJSON(h);else if(h instanceof e.Color)f=h;else throw Error("unexpected type");return g.equals(f)}static DiffChannel(f,h){return e.clamp(Math.max(f,h)-Math.min(f,h),0,1)}static Diff(f,h){const g=new e.Color;g.setR(Math.max(f._r,h._r)-Math.min(f._r,h._r));g.setG(Math.max(f._g,h._g)-Math.min(f._g,h._g));g.setB(Math.max(f._b,h._b)-Math.min(f._b,h._b));g.setA(Math.max(f._a,h._a)-Math.min(f._a,h._a));return g}static DiffNoAlpha(f,h){const g=new e.Color(0,0,0,1);g.setR(Math.max(f._r,
h._r)-Math.min(f._r,h._r));g.setG(Math.max(f._g,h._g)-Math.min(f._g,h._g));g.setB(Math.max(f._b,h._b)-Math.min(f._b,h._b));return g}static GetHue(f,h,g){const l=Math.max(f,h,g),m=Math.min(f,h,g);if(l===m)return 0;let u=0;switch(l){case f:u=(h-g)/(l-m)+(h<g?6:0);break;case h:u=(g-f)/(l-m)+2;break;case g:u=(f-h)/(l-m)+4}return Math.round(u/6*360)}static GetSaturation(f,h,g){const l=Math.max(f,h,g);f=Math.min(f,h,g);if(l===f)return 0;h=l-f;return Math.round(100*(.5<(l+f)/2?h/(2-l-f):h/(l+f)))}static GetLuminosity(f,
h,g){const l=Math.max(f,h,g);return l?Math.round((l+Math.min(f,h,g))/2*100):0}};e.Color.White=Object.freeze(e.New(e.Color,1,1,1,1));e.Color.Black=Object.freeze(e.New(e.Color,0,0,0,1));e.Color.TransparentBlack=Object.freeze(e.New(e.Color,0,0,0,0))}
{"use strict";const e=self.C3;e.Vector2=class{constructor(b,a){this._y=this._x=0;b instanceof e.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}equalsValues(b,a){return this._x===b&&this._y===a}equalsF32Array(b,a){return b[a]===Math.fround(this._x)&&b[a+1]===Math.fround(this._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}divide(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 e.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 c=this._x*
a-this._y*b;this._y=this._y*a+this._x*b;this._x=c}rotate(b){0!==b&&this.rotatePrecalc(Math.sin(b),Math.cos(b))}rotateAbout(b,a,c){0===b||a===this._x&&c===this._y||(this._x-=a,this._y-=c,this.rotatePrecalc(Math.sin(b),Math.cos(b)),this._x+=+a,this._y+=+c)}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=e.clamp(this._x,b,a);this._y=e.clamp(this._y,b,a)}}}
{"use strict";const e=self.C3;e.Rect=class{constructor(b,a,c,d){this._bottom=this._right=this._top=this._left=0;b instanceof e.Rect?this.copy(b):this.set(b||0,a||0,c||0,d||0)}set(b,a,c,d){this._left=+b;this._top=+a;this._right=+c;this._bottom=+d}setWH(b,a,c,d){b=+b;a=+a;this._left=b;this._top=a;this._right=b+ +c;this._bottom=a+ +d}copy(b){this._left=+b._left;this._top=+b._top;this._right=+b._right;this._bottom=+b._bottom}clone(){return new e.Rect(this._left,this._top,this._right,this._bottom)}static Merge(b,
a){const c=new e.Rect;c.setLeft(Math.min(b._left,a._left));c.setTop(Math.min(b._top,a._top));c.setRight(Math.max(b._right,a._right));c.setBottom(Math.max(b._bottom,a._bottom));return c}static FromObject(b){return new e.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}equalsWH(b,a,c,d){return this._left===b&&this._top===a&&this.width()===c&&this.height()===d}equalsF32Array(b,a){return b[a]===Math.fround(this._left)&&
b[a+1]===Math.fround(this._top)&&b[a+2]===Math.fround(this._right)&&b[a+3]===Math.fround(this._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}writeAsQuadToTypedArray3D(b,a,c){b[a++]=this._left;b[a++]=this._top;b[a++]=c;b[a++]=this._right;b[a++]=this._top;b[a++]=c;b[a++]=this._right;b[a++]=this._bottom;b[a++]=c;b[a++]=this._left;b[a++]=this._bottom;b[a]=c}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,c,d){this._left<b&&(this._left=+b);this._top<a&&(this._top=+a);this._right>
c&&(this._right=+c);this._bottom>d&&(this._bottom=+d)}clampFlipped(b,a,c,d){this._left<b&&(this._left=+b);this._top>a&&(this._top=+a);this._right>c&&(this._right=+c);this._bottom<d&&(this._bottom=+d)}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,c){return!(b._right+a<this._left||b._bottom+c<this._top||b._left+
a>this._right||b._top+c>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=e.lerp(b._left,b._right,this._left);this._top=e.lerp(b._top,
b._bottom,this._top);this._right=e.lerp(b._left,b._right,this._right);this._bottom=e.lerp(b._top,b._bottom,this._bottom)}}}
{"use strict";const e=self.C3;e.Quad=class{constructor(b,a,c,d,f,h,g,l){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;b instanceof e.Quad?this.copy(b):this.set(b||0,a||0,c||0,d||0,f||0,h||0,g||0,l||0)}set(b,a,c,d,f,h,g,l){this._tlx=+b;this._tly=+a;this._trx=+c;this._try=+d;this._brx=+f;this._bry=+h;this._blx=+g;this._bly=+l}setRect(b,a,c,d){this.set(b,a,c,a,c,d,b,d)}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,c){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=c;b[a++]=this._trx;b[a++]=this._try;b[a++]=c;b[a++]=this._brx;b[a++]=this._bry;b[a++]=c;b[a++]=this._blx;b[a++]=this._bly;b[a]=c}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,c){const d=b._left*a,f=b._top*a,h=b._right*a;a*=b._bottom;
const g=b._left*c,l=b._top*c,m=b._right*c;b=b._bottom*c;this._tlx=g-f;this._tly=l+d;this._trx=m-f;this._try=l+h;this._brx=m-a;this._bry=b+h;this._blx=g-a;this._bly=b+d}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 c=this._trx-this._tlx,d=this._try-this._tly;const f=this._brx-this._tlx,h=this._bry-this._tly;
b-=this._tlx;a-=this._tly;var g=c*c+d*d;let l=c*f+d*h;d=c*b+d*a;const m=f*f+h*h,u=f*b+h*a;let v=1/(g*m-l*l);c=(m*d-l*u)*v;g=(g*u-l*d)*v;if(0<=c&&0<g&&1>c+g)return!0;c=this._blx-this._tlx;d=this._bly-this._tly;g=c*c+d*d;l=c*f+d*h;d=c*b+d*a;v=1/(g*m-l*l);c=(m*d-l*u)*v;g=(g*u-l*d)*v;return 0<=c&&0<g&&1>c+g}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,c,d){return this.containsPoint(b,a)||this.containsPoint(c,d)?
!0:e.segmentIntersectsQuad(b,a,c,d,this)}intersectsQuad(b){var a=b.midX(),c=b.midY();if(this.containsPoint(a,c))return!0;a=this.midX();c=this.midY();if(b.containsPoint(a,c))return!0;a=this._tlx;c=this._tly;const d=this._trx,f=this._try,h=this._brx,g=this._bry,l=this._blx,m=this._bly;return e.segmentIntersectsQuad(a,c,d,f,b)||e.segmentIntersectsQuad(d,f,h,g,b)||e.segmentIntersectsQuad(h,g,l,m,b)||e.segmentIntersectsQuad(l,m,a,c,b)}rotatePointsAnticlockwise(){const b=this._tlx,a=this._tly;this._tlx=
this._trx;this._tly=this._try;this._trx=this._brx;this._try=this._bry;this._brx=this._blx;this._bry=this._bly;this._blx=b;this._bly=a}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 c=this._getAtIndex(b);this._setAtIndex(b,this._getAtIndex(a));this._setAtIndex(a,c)}_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 e=self.C3,b=[0,0,1,0,1,1,0,1],a=e.New(e.Quad);e.CollisionPoly=class extends e.DefendedBase{constructor(c,d=!0){super();c||(c=b);this._ptsArr=Float64Array.from(c);this._bbox=new e.Rect;this._isBboxChanged=!0;this._enabled=d}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(c){this._ptsArr.length===c.length?this._ptsArr.set(c):this._ptsArr=Float64Array.from(c);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(b)}copy(c){this.setPoints(c._ptsArr)}setBboxChanged(){this._isBboxChanged=
!0}_updateBbox(){if(this._isBboxChanged){var c=this._ptsArr,d=c[0],f=c[1],h=d,g=f;for(let l=0,m=c.length;l<m;l+=2){const u=c[l],v=c[l+1];u<d&&(d=u);u>h&&(h=u);v<f&&(f=v);v>g&&(g=v)}this._bbox.set(d,f,h,g);this._isBboxChanged=!1}}setFromRect(c,d,f){let h=this._ptsArr;8!==h.length&&(this._ptsArr=h=new Float64Array(8));h[0]=c.getLeft()-d;h[1]=c.getTop()-f;h[2]=c.getRight()-d;h[3]=c.getTop()-f;h[4]=c.getRight()-d;h[5]=c.getBottom()-f;h[6]=c.getLeft()-d;h[7]=c.getBottom()-f;this._bbox.copy(c);0===d&&0===
f||this._bbox.offset(-d,-f);this._isBboxChanged=!1}setFromQuad(c,d,f){a.copy(c);a.offset(d,f);this.setPoints(a.toArray());this._isBboxChanged=!0}transform(c,d,f){let h=0,g=1;0!==f&&(h=Math.sin(f),g=Math.cos(f));this.transformPrecalc(c,d,h,g)}transformPrecalc(c,d,f,h){const g=this._ptsArr;for(let l=0,m=g.length;l<m;l+=2){const u=l+1,v=g[l]*c,t=g[u]*d;g[l]=v*h-t*f;g[u]=t*h+v*f}this._isBboxChanged=!0}offset(c,d){const f=this._ptsArr;for(let h=0,g=f.length;h<g;h+=2)f[h]+=c,f[h+1]+=d}containsPoint(c,d){const f=
this._ptsArr;if(c===f[0]&&d===f[1])return!0;this._updateBbox();var h=this._bbox;const g=h.getLeft()-110,l=h.getTop()-101,m=h.getRight()+131;h=h.getBottom()+120;let u,v,t,q,p,r,x,y;g<c?(u=g,t=c):(u=c,t=g);l<d?(v=l,q=d):(v=d,q=l);m<c?(p=m,x=c):(p=c,x=m);h<d?(r=h,y=d):(r=d,y=h);let C=0,G=0;for(let E=0,J=f.length;E<J;E+=2){var A=(E+2)%J;const B=f[E],I=f[E+1],L=f[A];A=f[A+1];e.segmentsIntersectPreCalc(g,l,c,d,u,t,v,q,B,I,L,A)&&++C;e.segmentsIntersectPreCalc(m,h,c,d,p,x,r,y,B,I,L,A)&&++G}return 1===C%2||
1===G%2}intersectsPoly(c,d,f){const h=c._ptsArr,g=this._ptsArr;if(this.containsPoint(h[0]+d,h[1]+f)||c.containsPoint(g[0]-d,g[1]-f))return!0;for(let m=0,u=g.length;m<u;m+=2){var l=(m+2)%u;c=g[m];const v=g[m+1],t=g[l];l=g[l+1];let q,p,r,x;c<t?(q=c,r=t):(q=t,r=c);v<l?(p=v,x=l):(p=l,x=v);for(let y=0,C=h.length;y<C;y+=2){const G=(y+2)%C;if(e.segmentsIntersectPreCalc(c,v,t,l,q,r,p,x,h[y]+d,h[y+1]+f,h[G]+d,h[G+1]+f))return!0}}return!1}intersectsSegment(c,d,f,h,g,l){if(this.containsPoint(f-c,h-d)||this.containsPoint(g-
c,l-d))return!0;let m,u,v,t;f<g?(m=f,v=g):(m=g,v=f);h<l?(u=h,t=l):(u=l,t=h);const q=this._ptsArr;for(let p=0,r=q.length;p<r;p+=2){const x=(p+2)%r;if(e.segmentsIntersectPreCalc(f,h,g,l,m,v,u,t,q[p]+c,q[p+1]+d,q[x]+c,q[x+1]+d))return!0}return!1}mirror(c){const d=this._ptsArr;for(let f=0,h=d.length;f<h;f+=2)d[f]=2*c-d[f];this._isBboxChanged=!0}flip(c){const d=this._ptsArr;for(let f=0,h=d.length;f<h;f+=2){const g=f+1;d[g]=2*c-d[g]}this._isBboxChanged=!0}diag(){const c=this._ptsArr;for(let d=0,f=c.length;d<
f;d+=2){const h=d+1,g=c[d];c[d]=c[h];c[h]=g}this._isBboxChanged=!0}GetMidX(){const c=this._ptsArr;let d=0;for(let f=0,h=c.length;f<h;f+=2)d+=c[f];return d/this.pointCount()}GetMidY(){const c=this._ptsArr;let d=0;for(let f=0,h=c.length;f<h;f+=2)d+=c[f+1];return d/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}}
{"use strict";const e=self.C3;e.PairMap=class extends e.DefendedBase{constructor(b){super();this._firstMap=new Map;if(b)for(const [a,c,d]of b)this.Set(a,c,d)}Release(){this.Clear();this._firstMap=null}Clear(){const b=this._firstMap;for(const a of b.values())a.clear();b.clear()}Set(b,a,c){const d=this._firstMap;let f=d.get(b);f||(f=new Map,d.set(b,f));f.set(a,c)}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 c=this._firstMap,
d=c.get(b);if(!d)return!1;(a=d.delete(a))&&0===d.size&&c.delete(b);return a}DeleteEither(b){const a=this._firstMap,c=a.get(b);c&&(c.clear(),a.delete(b));for(const [d,f]of a.entries())f.delete(b)&&0===f.size&&a.delete(d)}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 c of a.keys())yield[b,c]}*entries(){for(const [b,a]of this._firstMap.entries())for(const [c,
d]of a.entries())yield[b,c,d]}}}
{"use strict";const e=self.C3;e.ArraySet=class extends e.DefendedBase{constructor(){super();this._set=new Set;this._arr=[];this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear();e.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;e.clearArray(b);for(const a of this._set)b.push(a)}}}
{"use strict";const e=new Map,b=new Map,a=new Map,c=new Map,d=new Map,f=new Map;f.set("linear","noease");f.set("default","noease");self.Ease=class t{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(q,...p){this._CreateEaseMap();a.has(q)||a.set(q,new Map);q=[...a.get(q).keys()];q.sort();return[...b.keys()].concat(q).filter(r=>!p.includes(r))}static GetRuntimeEaseNames(){this._CreateEaseMap();const q=[...c.keys()];q.sort();return[...b.keys()].concat(q)}static IsNamePredefined(q){this._CreateEaseMap();
return[...b.keys()].includes(q)}static _GetEase(q){const p=f.get(q);if(p)return e.get(p);if(t.IsNamePredefined(q))return e.get(q);if(d.has(q))return d.get(q)}static GetEditorEase(q,p){this._CreateEaseMap();const r=t._GetEase(q);return r?r:a.get(p).get(q)}static GetRuntimeEase(q){this._CreateEaseMap();const p=t._GetEase(q);return p?p:c.get(q)}static GetEaseFromIndex(q){this._CreateEaseMap();return this.GetRuntimeEaseNames()[q]}static GetIndexForEase(q,p){this._CreateEaseMap();return this.GetEditorEaseNames(p).indexOf(q)}static _CreateEaseMap(){0===
e.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(q,p){t._AddEase(q,p,"predefined")}static _AddPrivateCustomEase(q,
p){t._AddEase(q,p,"private")}static AddCustomEase(q,p,r){this._CreateEaseMap();t._AddEase(q,p,"custom",r)}static RemoveCustomEase(q,p){this.IsNamePredefined(q)||[...d.keys()].includes(q)||(p=a.get(p))&&p.delete(q)}static _AddEase(q,p,r,x){switch(r){case "predefined":e.set(q,p);b.set(q,p);break;case "custom":x?(a.has(x)||a.set(x,new Map),a.get(x).set(q,p)):c.set(q,p);break;case "private":e.set(q,p);d.set(q,p);break;default:throw Error("unexpected ease mode");}}static NoEase(q,p,r,x){return r*q/x+p}static EaseInQuad(q,
p,r,x){return r*(q/=x)*q+p}static EaseOutQuad(q,p,r,x){return-r*(q/=x)*(q-2)+p}static EaseInOutQuad(q,p,r,x){return 1>(q/=x/2)?r/2*q*q+p:-r/2*(--q*(q-2)-1)+p}static EaseInCubic(q,p,r,x){return r*(q/=x)*q*q+p}static EaseOutCubic(q,p,r,x){return r*((q=q/x-1)*q*q+1)+p}static EaseInOutCubic(q,p,r,x){return 1>(q/=x/2)?r/2*q*q*q+p:r/2*((q-=2)*q*q+2)+p}static EaseInQuart(q,p,r,x){return r*(q/=x)*q*q*q+p}static EaseOutQuart(q,p,r,x){return-r*((q=q/x-1)*q*q*q-1)+p}static EaseInOutQuart(q,p,r,x){return 1>(q/=
x/2)?r/2*q*q*q*q+p:-r/2*((q-=2)*q*q*q-2)+p}static EaseInQuint(q,p,r,x){return r*(q/=x)*q*q*q*q+p}static EaseOutQuint(q,p,r,x){return r*((q=q/x-1)*q*q*q*q+1)+p}static EaseInOutQuint(q,p,r,x){return 1>(q/=x/2)?r/2*q*q*q*q*q+p:r/2*((q-=2)*q*q*q*q+2)+p}static EaseInSine(q,p,r,x){return-r*Math.cos(q/x*(Math.PI/2))+r+p}static EaseOutSine(q,p,r,x){return r*Math.sin(q/x*(Math.PI/2))+p}static EaseInOutSine(q,p,r,x){return-r/2*(Math.cos(Math.PI*q/x)-1)+p}static EaseInExpo(q,p,r,x){return 0===q?p:r*Math.pow(2,
10*(q/x-1))+p}static EaseOutExpo(q,p,r,x){return q===x?p+r:r*(-Math.pow(2,-10*q/x)+1)+p}static EaseInOutExpo(q,p,r,x){return 0===q?p:q===x?p+r:1>(q/=x/2)?r/2*Math.pow(2,10*(q-1))+p:r/2*(-Math.pow(2,-10*--q)+2)+p}static EaseInCirc(q,p,r,x){return-r*(Math.sqrt(1-(q/=x)*q)-1)+p}static EaseOutCirc(q,p,r,x){return r*Math.sqrt(1-(q=q/x-1)*q)+p}static EaseInOutCirc(q,p,r,x){return 1>(q/=x/2)?-r/2*(Math.sqrt(1-q*q)-1)+p:r/2*(Math.sqrt(1-(q-=2)*q)+1)+p}static EaseInElastic(q,p,r,x){let y=0,C=r;if(0===q)return p;
if(1===(q/=x))return p+r;y||(y=.3*x);C<Math.abs(r)?(C=r,r=y/4):r=y/(2*Math.PI)*Math.asin(r/C);return-(C*Math.pow(2,10*--q)*Math.sin(2*(q*x-r)*Math.PI/y))+p}static EaseOutElastic(q,p,r,x){let y,C=0,G=r;if(0===q)return p;if(1===(q/=x))return p+r;C||(C=.3*x);G<Math.abs(r)?(G=r,y=C/4):y=C/(2*Math.PI)*Math.asin(r/G);return G*Math.pow(2,-10*q)*Math.sin(2*(q*x-y)*Math.PI/C)+r+p}static EaseInOutElastic(q,p,r,x){let y,C=0,G=r;if(0===q)return p;if(2===(q/=x/2))return p+r;C||(C=.3*x*1.5);G<Math.abs(r)?(G=r,
y=C/4):y=C/(2*Math.PI)*Math.asin(r/G);return 1>q?-.5*G*Math.pow(2,10*--q)*Math.sin(2*(q*x-y)*Math.PI/C)+p:G*Math.pow(2,-10*--q)*Math.sin(2*(q*x-y)*Math.PI/C)*.5+r+p}static EaseInBack(q,p,r,x,y){void 0===y&&(y=1.70158);return r*(q/=x)*q*((y+1)*q-y)+p}static EaseOutBack(q,p,r,x,y){void 0===y&&(y=1.70158);return r*((q=q/x-1)*q*((y+1)*q+y)+1)+p}static EaseInOutBack(q,p,r,x,y){void 0===y&&(y=1.70158);return 1>(q/=x/2)?r/2*q*q*(((y*=1.525)+1)*q-y)+p:r/2*((q-=2)*q*(((y*=1.525)+1)*q+y)+2)+p}static EaseInBounce(q,
p,r,x){return r-t.EaseOutBounce(x-q,0,r,x)+p}static EaseOutBounce(q,p,r,x){return(q/=x)<1/2.75?7.5625*r*q*q+p:q<2/2.75?r*(7.5625*(q-=1.5/2.75)*q+.75)+p:q<2.5/2.75?r*(7.5625*(q-=2.25/2.75)*q+.9375)+p:r*(7.5625*(q-=2.625/2.75)*q+.984375)+p}static EaseInOutBounce(q,p,r,x){return q<x/2?.5*t.EaseInBounce(2*q,0,r,x)+p:.5*t.EaseOutBounce(2*q-x,0,r,x)+.5*r+p}static EaseCubicBezier(q,p,r,x,y){return p+3*q*(r-p)+3*q**2*(p+x-2*r)+q**3*(y-p+3*r-3*x)}static EaseSpline(q,p,r,x,y,C,G,A,E,J){if(x===y&&C===G)return q;
q=v(q,p,x,C,A,J);p=h(r,y,G,E);x=g(r,y,G,E);r=l(r,y,G,E);return m(q,p,x,r)}static GetBezierSamples(q,p,r,x){const y=[],C=h(q,p,r,x),G=g(q,p,r,x);q=l(q,p,r,x);for(p=0;11>p;++p)r=m(.1*p,C,G,q),y.push(r);return y}};const h=(t,q,p,r)=>r-3*p+3*q-t,g=(t,q,p,r)=>3*p-6*q+3*t,l=(t,q,p,r)=>3*(q-t),m=(t,q,p,r)=>((q*t+p)*t+r)*t,u=(t,q,p,r)=>3*q*t*t+2*p*t+r,v=(t,q,p,r,x,y)=>{if(1==t)return 1;for(var C=0,G=1,A=y[G];10!=G&&A<=t;)G++,A=y[G],C+=.1;G--;A=y[G];y=C+(t-A)/(y[G+1]-A)*.1;G=h(q,p,r,x);A=g(q,p,r,x);q=l(q,
p,r,x);p=u(y,G,A,q);if(0!==p)if(.02<=p)for(C=0;4>C;++C)p=m(y,G,A,q)-t,r=u(y,G,A,q),y-=p/r;else{p=C;C+=.1;r=0;let E;do y=p+(C-p)/2,x=m(y,G,A,q)-t,0<x?C=y:p=y,x=1E-7<Math.abs(x),E=10>++r;while(x&&E)}return y}}
{"use strict";const e=self.C3;function b(a){e.IsString(a)}e.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){e.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(a=Math.random()*this.GetTotalWeight()){let c=0;for(const [d,f]of this._items)if(c+=d,a<c)return f;return 0}AddItem(a,c){b(c);this._totalWeight+=a;this._items.push([a,c])}RemoveItem(a,c){b(c);const d=0===a;for(let f=0;f<this._items.length;f++){const h=
this._items[f],g=h[1]===c;if((d||h[0]===a)&&g){this._items.splice(f,1);this._totalWeight-=h[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(a){const c=new e.ProbabilityTable;a=JSON.parse(a);for(const d of a)c.AddItem(d[0],d[1]);return c}}}"use strict";
self.C3.Event=class{constructor(e,b){this.type=e;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 e=self.C3;e.Event.Handler=class extends e.DefendedBase{constructor(b){super();this._type=b;this._captureListeners=[];this._captureListenersSet=new Set;this._listeners=[];this._listenersSet=new Set;this._fireDepth=0;this._queueModifyListeners=[]}Release(){0<this._fireDepth||(e.clearArray(this._captureListeners),this._captureListenersSet.clear(),e.clearArray(this._listeners),this._listenersSet.clear(),e.clearArray(this._queueModifyListeners),e.Release(this))}_AddListener(b,a){this._IsFiring()?
this._queueModifyListeners.push({op:"add",func:b,capture: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()?this._queueModifyListeners.push({op:"remove",func:b,capture:a}):a?this._captureListenersSet.has(b)&&(this._captureListenersSet.delete(b),e.arrayFindRemove(this._captureListeners,b)):this._listenersSet.has(b)&&(this._listenersSet.delete(b),
e.arrayFindRemove(this._listeners,b))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){const b=new Set,a=new Set;for(const c of this._queueModifyListeners)if("add"===c.op)this._AddListener(c.func,c.capture),c.capture?a.delete(c.func):b.delete(c.func);else if("remove"===c.op)c.capture?(this._captureListenersSet.delete(c.func),a.add(c.func)):(this._listenersSet.delete(c.func),b.add(c.func));else throw Error("invalid op");
e.arrayRemoveAllInSet(this._listeners,b);e.arrayRemoveAllInSet(this._captureListeners,a);e.clearArray(this._queueModifyListeners)}_FireCancellable(b){this._IncreaseFireDepth();let a=!1;for(let c=0,d=this._captureListeners.length;c<d;++c)if(this._captureListeners[c](b),b.propagationStopped){a=!0;break}if(!a)for(let c=0,d=this._listeners.length;c<d&&(this._listeners[c](b),!b.propagationStopped);++c);this._DecreaseFireDepth();return!b.defaultPrevented}_FireNonCancellable(b){this._IncreaseFireDepth();
for(let a=0,c=this._captureListeners.length;a<c;++a)this._captureListeners[a](b);for(let a=0,c=this._listeners.length;a<c;++a)this._listeners[a](b);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&0<this._queueModifyListeners.length&&this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(b){b?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(b){let a=[];for(let c=0,d=this._captureListeners.length;c<
d;++c){let f=this._captureListeners[c];a.push(e.Asyncify(()=>f(b)))}for(let c=0,d=this._listeners.length;c<d;++c){let f=this._listeners[c];a.push(e.Asyncify(()=>f(b)))}return Promise.all(a).then(()=>!b.defaultPrevented)}_FireAndWait_AsyncOptional(b){const a=[];this._IncreaseFireDepth();for(let d=0,f=this._captureListeners.length;d<f;++d){var c=this._captureListeners[d](b);c instanceof Promise&&a.push(c)}for(let d=0,f=this._listeners.length;d<f;++d)c=this._listeners[d](b),c instanceof Promise&&a.push(c);
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 c=0,d=this._captureListeners.length;c<d;++c){var a=this._captureListeners[c](b);a instanceof Promise&&await a}for(let c=0,d=this._listeners.length;c<d;++c)a=this._listeners[c](b),a instanceof Promise&&await a;this._DecreaseFireDepth();return!b.defaultPrevented}*_FireAsGenerator(b){this._IncreaseFireDepth();
for(let c=0,d=this._captureListeners.length;c<d;++c){var a=this._captureListeners[c](b);e.IsIterator(a)&&(yield*a)}for(let c=0,d=this._listeners.length;c<d;++c)a=this._listeners[c](b),e.IsIterator(a)&&(yield*a);this._DecreaseFireDepth()}}}
{"use strict";const e=self.C3;e.Event.Dispatcher=class extends e.DefendedBase{constructor(){super();this._eventHandlers=new Map;this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw Error("already released");this.ClearEvents();this._dispatcherWasReleased=!0;e.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let b of this._eventHandlers.values())b.Release();this._eventHandlers.clear()}_GetHandlerByType(b,a){let c=this._eventHandlers.get(b);return c?
c:a?(c=e.New(e.Event.Handler,b),this._eventHandlers.set(b,c),c):null}HasAnyHandlerFor(b){return this._eventHandlers.has(b)}addEventListener(b,a,c){this._GetHandlerByType(b,!0)._AddListener(a,!!c)}removeEventListener(b,a,c){let d=this._GetHandlerByType(b,!1);d&&(d._RemoveListener(a,!!c),d._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 e=self.C3,b="undefined"!==typeof requestIdleCallback;let a=[],c=-1,d=0;function f(m){c=b&&0===d?requestIdleCallback(h,{timeout:35}):setTimeout(h,0<d?1:m)}function h(m){c=-1;if(a.length){var u=performance.now(),v=0;do{g(a.shift());var t=performance.now();++v;var q=(t-u)/v*1.1}while(a.length&&(b&&0===d&&"undefined"!==typeof m?q<m.timeRemaining():12>t-u+q));-1===c&&a.length&&f(Math.max(16-(t-u),4))}}function g(m){let u;try{u=m.func()}catch(v){m.reject(v);return}m.resolve(u)}let l=
e.QueryString.Has("disable-asyncify");l&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously.");e.Asyncify=function(m){let u=null;e.isDebug&&(u=e.GetCallStack());return new Promise((v,t)=>{a.push({func:m,resolve:v,reject:t,stack:u});l?g(a.pop()):-1===c&&f(16)})};e.Asyncify.SetHighThroughputMode=function(m){if(m)++d;else if(--d,0>d)throw Error("already turned off high throughput mode");}}
{"use strict";const e=self.C3;let b=-1;function a(){b=-1}e.FastGetDateNow=function(){-1===b&&(b=Date.now(),self.setTimeout(a,16));return b};let c=-1,d=-1,f=new Set;function h(){d=c=-1;let g=Date.now();for(let l of f)if(l._CheckTimeout(g)){let m=l._GetDeadline();if(-1===d||m<d)d=m}else f.delete(l);-1!==d&&(c=self.setTimeout(h,Math.max(d-g+100,1E3)))}e.IdleTimeout=class{constructor(g,l){this._callback=g;this._timeout=1E3*l;this._deadline=0;this._isActive=!1}Reset(){let g=e.FastGetDateNow();this._deadline=
g+this._timeout;this._isActive||(f.add(this),this._isActive=!0);-1===c?(d=this._deadline,c=self.setTimeout(h,this._timeout+100)):this._deadline<d&&d>g+1E3&&(self.clearTimeout(c),d=this._deadline,c=self.setTimeout(h,this._timeout+100))}_CheckTimeout(g){return g>=this._deadline?this._callback()?(this._deadline=g+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(f.delete(this),this._isActive=!1,0===f.size&&-1!==c&&(self.clearTimeout(c),d=c=-1))}Release(){this.Cancel();
this._callback=null}}}
{"use strict";const e=self.C3;e.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,c,d,f,h){if("undefined"===typeof f||null===f)f=!1;else if("boolean"!==typeof f&&"object"!==typeof f)throw new TypeError("invalid event listener options");h&&
(d=d.bind(h));if(c.includes(" ")){c=c.split(" ");h=new e.CompositeDisposable;for(let g of c)a.addEventListener(g,d,f),h.Add(e.New(e.Disposable,()=>a.removeEventListener(g,d,f)));return h}a.addEventListener(c,d,f);return e.New(e.Disposable,()=>a.removeEventListener(c,d,f))}};e.StubDisposable=class extends e.Disposable{SetAction(b){this._disposeAction=b}};e.CompositeDisposable=class extends e.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 e=self.C3;e.KahanSum=class extends e.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 e=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,c){return a<c?-1:c<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 c=a.right;a.right=c.left;c.left!=this.sentinel&&(c.left.parent=a);c.parent=a.parent;a.parent==this.sentinel?this.root=c:a==a.parent.left?a.parent.left=c:a.parent.right=c;c.left=a;a.parent=c};b.RedBlackSet.prototype.rightRotate=function(a){var c=a.left;a.left=c.right;c.right!=
this.sentinel&&(c.right.parent=a);c.parent=a.parent;a.parent==this.sentinel?this.root=c:a==a.parent.right?a.parent.right=c:a.parent.left=c;c.right=a;a.parent=c};b.RedBlackSet.prototype.insert=function(a){if(this.contains(a))this.get_(a).key=a;else{var c=new b.RBnode(this);c.key=a;a=this.sentinel;for(var d=this.root;d!=this.sentinel;)a=d,d=0>this.compare(c.key,d.key)?d.left:d.right;c.parent=a;a==this.sentinel?this.root=c:0>this.compare(c.key,a.key)?a.left=c:a.right=c;c.left=this.sentinel;c.right=this.sentinel;
c.color=!0;this.insertFixup(c);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 c=a.parent.parent.right;1==c.color?(a.parent.color=!1,c.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 c=a.parent.parent.left,1==c.color?(a.parent.color=
!1,c.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 c=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a);var d=c.left!=this.sentinel?c.left:c.right;d.parent=c.parent;c.parent==this.sentinel?this.root=d:c==c.parent.left?c.parent.left=d:c.parent.right=
d;c!=a&&(a.key=c.key);0==c.color&&this.deleteFixup(d);this.size--};b.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&0==a.color;)if(a==a.parent.left){var c=a.parent.right;1==c.color&&(c.color=!1,a.parent.color=!0,this.leftRotate(a.parent),c=a.parent.right);0==c.left.color&&0==c.right.color?(c.color=!0,a=a.parent):(0==c.right.color&&(c.left.color=!1,c.color=!0,this.rightRotate(c),c=a.parent.right),c.color=a.parent.color,a.parent.color=!1,c.right.color=!1,this.leftRotate(a.parent),
a=this.root)}else c=a.parent.left,1==c.color&&(c.color=!1,a.parent.color=!0,this.rightRotate(a.parent),c=a.parent.left),0==c.right.color&&0==c.left.color?(c.color=!0,a=a.parent):(0==c.left.color&&(c.right.color=!1,c.color=!0,this.leftRotate(c),c=a.parent.left),c.color=a.parent.color,a.parent.color=!1,c.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 c=a.key;this.delete_(a);return c}return null};b.RedBlackSet.prototype.removeSwapped=
function(a,c){this.remove(c)};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 c=a.parent;c!=this.sentinel&&a==c.right;)a=c,c=c.parent;return c};b.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var c=a.parent;c!=this.sentinel&&
a==c.left;)a=c,c=c.parent;return c};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 c=a.parent;c!=this.sentinel&&a==c.right;)a=c,c=c.parent;return c!=this.sentinel?c.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 c=a.parent;c!=this.sentinel&&
a==c.left;)a=c,c=c.parent;return c!=this.sentinel?c.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 c=this.root;c!=this.sentinel&&0!=this.compare(c.key,a);)c=0>this.compare(a,c.key)?c.left:c.right;return c};b.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key};b.RedBlackSet.prototype.getValues=function(){var a=
[];this.forEach(function(c){a.push(c)});return a};b.RedBlackSet.prototype.insertAll=function(a){if("array"==b.typeOf(a))for(var c=0;c<a.length;c++)this.insert(a[c]);else if("function"==b.typeOf(a.forEach))a.forEach(this.insert,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),c=0;c<a.length;c++)this.insert(a[c]);else if("object"==b.typeOf(a))for(c in a)this.insert(a[c])};b.RedBlackSet.prototype.removeAll=function(a){if("array"==b.typeOf(a))for(var c=0;c<a.length;c++)this.remove(a[c]);
else if("function"==b.typeOf(a.forEach))a.forEach(this.removeSwapped,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),c=0;c<a.length;c++)this.remove(a[c]);else if("object"==b.typeOf(a))for(c in a)this.remove(a[c])};b.RedBlackSet.prototype.containsAll=function(a){if("array"==b.typeOf(a)){for(var c=0;c<a.length;c++)if(!this.contains(a[c]))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(c=
0;c<a.length;c++)if(!this.contains(a[c]))return!1;return!0}if("object"==b.typeOf(a)){for(c in a)if(!this.contains(a[c]))return!1;return!0}};b.RedBlackSet.prototype.range=function(a,c){var d=[];this.traverseFromTo(function(f){d.push(f)},a,c);return d};b.RedBlackSet.prototype.traverse=function(a,c){if(!this.isEmpty())for(var d=this.min(this.root);d!=this.sentinel&&!a.call(c,d.key,this);)d=this.successor_(d)};b.RedBlackSet.prototype.traverseFrom=function(a,c,d){if(!this.isEmpty())for(c=this.get_(c);c!=
this.sentinel&&!a.call(d,c.key,this);)c=this.successor_(c)};b.RedBlackSet.prototype.traverseTo=function(a,c,d){if(!this.isEmpty()){var f=this.min(this.root);for(c=this.get_(c);f!=c&&!a.call(d,f.key,this);)f=this.successor_(f)}};b.RedBlackSet.prototype.traverseFromTo=function(a,c,d,f){if(!this.isEmpty())for(c=this.get_(c),d=this.get_(d);c!=d&&!a.call(f,c.key,this);)c=this.successor_(c)};b.RedBlackSet.prototype.traverseBackwards=function(a,c){if(!this.isEmpty())for(var d=this.max(this.root);d!=this.sentinel&&
!a.call(c,d.key,this);)d=this.predeccessor_(d)};b.RedBlackSet.prototype.forEach=function(a,c){if(!this.isEmpty())for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))a.call(c,d.key,d.key,this)};b.RedBlackSet.prototype.some=function(a,c){if(this.isEmpty())return!1;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))if(a.call(c,d.key,d.key,this))return!0;return!1};b.RedBlackSet.prototype.every=function(a,c){if(this.isEmpty())return!1;for(var d=this.min(this.root);d!=this.sentinel;d=
this.successor_(d))if(!a.call(c,d.key,d.key,this))return!1;return!0};b.RedBlackSet.prototype.map=function(a,c){var d=[];if(this.isEmpty())return d;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))d.push(a.call(c,f.key,f.key,this));return d};b.RedBlackSet.prototype.filter=function(a,c){var d=[];if(this.isEmpty())return d;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))a.call(c,f.key,f.key,this)&&d.push(f.key);return d};b.RedBlackSet.prototype.getCount=function(){return this.size};
b.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};b.RedBlackSet.prototype.isSubsetOf=function(a){var c=b.getCount(a);if(this.getCount()>c)return!1;c=0;if(this.isEmpty())return!0;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))b.contains.call(a,a,d.key)&&c++;return c==this.getCount()};b.RedBlackSet.prototype.intersection=function(a){var c=new b.RedBlackSet(this.compare);if(this.isEmpty())return c;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))a.contains.call(a,
d.key,d.key,this)&&c.insert(d.key);return c};e.RedBlackSet=class extends e.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 c of this._queueRemove)this._rbSet.remove(c);this._queueRemove.clear();for(const c of this._queueInsert)this._rbSet.insert(c);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){var a=
this._rbSet;for(let c=a.min(a.root);c!=a.sentinel;c=a.successor_(c))yield c.key}}[Symbol.iterator](){return this.values()}}}
{"use strict";const e=self.C3;e.PromiseThrottle=class{constructor(b=e.hardwareConcurrency){this._maxParallel=b;this._queue=[];this._activeCount=0}Add(b){return new Promise((a,c)=>{this._queue.push({func:b,resolve:a,reject:c});this._MaybeStartNext()})}_FindInQueue(b){for(let a=0,c=this._queue.length;a<c;++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 c=[];let d=!1;const f=async g=>{for(;(g=a.pop())&&!d;)try{c.push(await g())}catch(l){throw d=
!0,l;}},h=[];for(;b--;)h.push(f());await Promise.all(h);return c}}}
{"use strict";const e=self.C3;e.RateLimiter=class{constructor(b,a,c){this._callback=b;this._interval=a;this._intervalOnBattery=c||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 e.Battery&&e.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...b){if(-1===this._timerId){this._callbackArguments=
b;b=e.FastGetDateNow();var a=b-this._lastCallTime,c=this._GetInterval();a>=c&&this._canRunImmediate?(this._lastCallTime=b,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(c-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=e.FastGetDateNow())}_OnTimer(){this._timerId=
-1;this._lastCallTime=e.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 e=self.C3;e.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,c,d,f,h){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(b,a,c,d,f,h)}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=e.New(e.SVGRasterImage,this,b),this._images.set(b,a));a.IncReference();return a}_RemoveImage(b){this._images.delete(b.GetDataSource())}OnTexturesChanged(){for(const b of this._images.values())b.ReleaseRasterizedResult(),b.ForceRasterAgain()}}}
{"use strict";const e=self.C3;e.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(c=>{this._baseWidth=c[0];this._baseHeight=c[1];this._manager.Redraw()}).catch(c=>{console.error("[SVG] Error loading SVG: ",c);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()}ReleaseRasterizedResult(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null)}_Release(){this.ReleaseRasterizedResult();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,c){if(0!==a&&0!==c&&!this._hadError&&!this._isRasterizing){var d=e.nextHighestPowerOfTwo(Math.ceil(a)),f=e.nextHighestPowerOfTwo(Math.ceil(c)),h=Math.max(d,f);2048<h&&(h=2048/h,a*=h,c*=h,d=Math.min(Math.ceil(d*h),2048),f=Math.min(Math.ceil(f*h),2048));a<d&&c<f&&(c=a/c,d/f>c?(a=f*c,c=f):(a=d,c=d/c));this._manager.IsNpotSurfaceAllowed()&&(d=Math.ceil(a),f=Math.ceil(c));
d<=this._rasterSurfaceWidth&&f<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=!0,this._rasterSurfaceWidth=d,this._rasterSurfaceHeight=f,b=await this._manager.RasterAtSize(this._dataSource,b,this._rasterSurfaceWidth,this._rasterSurfaceHeight,a,c),this._manager&&(this.ReleaseRasterizedResult(),this._rasterizedResult=b,this._rasterImageWidth=a,this._rasterImageHeight=c,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 e=self.C3;e.UTF8_BOM="\ufeff";const b=new Set([..."0123456789"]);e.IsNumericChar=function(m){return b.has(m)};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"]);e.IsWhitespaceChar=function(m){return a.has(m)};e.FilterWhitespace=function(m){return[...m].filter(u=>!e.IsWhitespaceChar(u)).join("")};e.IsStringAllWhitespace=function(m){for(const u of m)if(!e.IsWhitespaceChar(u))return!1;return!0};
e.IsUnprintableChar=function(m){return 1===m.length&&32>m.charCodeAt(0)};e.FilterUnprintableChars=function(m){return[...m].filter(u=>!e.IsUnprintableChar(u)).join("")};const c=new Set([..."0123456789.+-e"]);e.IsStringNumber=function(m){m=m.trim();if(!m.length)return!1;let u=m.charAt(0);if("-"!==u&&!b.has(u))return!1;for(let v of m)if(!c.has(v))return!1;return!0};e.RemoveTrailingDigits=function(m){let u=m.length;for(;0<u;){let v=m.charAt(u-1);if(!e.IsNumericChar(v))break;--u}return m.substr(0,u)};
e.IncrementNumberAtEndOf=function(m){let u=e.RemoveTrailingDigits(m);m=(m=m.substr(u.length))?(parseInt(m,10)+1).toString():"2";return u+m};const d=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#39;"]]);function f(m){return d.get(m)}const h=/[&<>"']/g;e.EscapeHTML=function(m){return m.replace(h,f)};e.EscapeJS=function(m){m=e.ReplaceAll(m,"\\","\\\\");m=e.ReplaceAll(m,'"','\\"');m=e.ReplaceAll(m,"\t","\\t");m=e.ReplaceAll(m,"\r","");return e.ReplaceAll(m,"\n","\\n")};e.EscapeXML=
function(m){m=e.ReplaceAll(m,"&","&amp;");m=e.ReplaceAll(m,"<","&lt;");m=e.ReplaceAll(m,">","&gt;");return e.ReplaceAll(m,'"',"&quot;")};const g=/[-[\]{}()*+?.,\\^$|#\s]/g;e.EscapeRegex=function(m){return m.replace(g,"\\$&")};e.FindAll=function(m,u,v=!1){if(!u)return[];v||(m=m.toLowerCase(),u=u.toLowerCase());v=u.length;var t=0;let q=[];for(;-1<(t=m.indexOf(u,t));)q.push(t),t+=v;return q};e.ReplaceAll=function(m,u,v){return m.replaceAll(u,()=>v)};e.ReplaceAllCaseInsensitive=function(m,u,v){return m.replace(new RegExp(e.EscapeRegex(u),
"gi"),()=>v)};e.SetElementContent=function(m,u){"string"===typeof u?m.textContent=u:u.isPlainText()?m.textContent=u.toString():(m.innerHTML=u.toHTML(),u instanceof e.BBString&&u.attachLinkHandlers(m))};e.StringLikeEquals=function(m,u){return m instanceof e.HtmlString||m instanceof e.BBString?m.equals(u):u instanceof e.HtmlString||u instanceof e.BBString?u.equals(m):m===u};e.StringSubstitute=function(m,...u){let v=m;for(let t=0,q=u.length;t<q;++t){const p=`{${t}}`;if(!m.includes(p))throw Error(`missing placeholder '${p}' in string substitution`);
v=v.replace(p,u[t].toString())}return v};e.StringSubstituteAllowMissing=function(m,...u){let v=m,t=-1,q=-1;for(let p=0,r=u.length;p<r;++p){const x=`{${p}}`;m.includes(x)?(q=p,v=v.replace(x,u[p].toString())):-1===t&&(t=p)}if(0<=t&&0<=q&&t<q)throw Error(`missing placeholder '${t}' in string substitution`);return v};e.StringSubstituteMap=function(m,u){for(let [v,t]of Object.entries(u))m=m.replaceAll(v,t.toString());return m};e.SortAZCaseInsensitive=function(m,u){m=m.toLowerCase();u=u.toLowerCase();return m>
u?1:m<u?-1:0};e.FormatDataSize=function(m,u){u="common."+(u?"dataRates":"dataSizes")+".";const v=self.langSub;if(1024>m)return v(u+"bytes",m);if(1048576>m)return m/=1024,m=10>m?Math.round(10*m)/10:Math.round(m),v(u+"kilobytes",m);if(1073741824>m)return m/=1048576,m=10>m?Math.round(10*m)/10:Math.round(m),v(u+"megabytes",m);if(1099511627776>m)return m/=1073741824,m=10>m?Math.round(10*m)/10:Math.round(m),v(u+"gigabytes",m);m/=1099511627776;m=10>m?Math.round(10*m)/10:Math.round(m);return v(u+"terabytes",
m)};const l={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};e.FormatTime=function(m,u){u=Object.assign({},l,u);e.Lang.PushContext("common.time");const v=[],t=self.lang,q=self.langPluralSub;if(u.days){var p=Math.floor(m/86400);0<p&&(m-=86400*p,v.push(q(".days",null,p)))}u.hours&&(p=Math.floor(m/3600),0<p||v.length)&&(m-=3600*p,v.push(q(".hours",null,p)));u.minutes&&(p=Math.floor(m/60),0<p||v.length||!u.seconds)&&(m-=60*p,v.push(q(".minutes",null,p)));u.seconds&&v.push(q(".seconds",null,Math.floor(m%
60)));m=(u.approximate?t(".approx-prefix"):"")+v.join(t(".separator"));e.Lang.PopContext();return m};e.ZeroPad=function(m,u){let v=0>m?"-":"";m=Math.abs(m);m=m.toString();u-=m.length;for(let t=0;t<u;++t)v+="0";return v+m};e.StringToTitleCase=function(m){return m.toLowerCase().replace(/\b\w/g,u=>u.toUpperCase())};e.CompareVersionStrings=function(m,u){m=m.split(".").map(v=>v.trim());u=u.split(".").map(v=>v.trim());e.resizeArray(m,4,"0");e.resizeArray(u,4,"0");m=m.map(v=>parseInt(v,10));u=u.map(v=>parseInt(v,
10));for(let v=0;4>v;++v){const t=m[v]-u[v];if(0!==t)return 0>t?-1:1}return 0};e.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,m=>{const u=Math.floor(16*Math.random());return("x"===m?u:u&3|8).toString(16)})};e.StringHammingDistance=function(m,u){if(m.length!==u.length)throw Error("strings must be same length");let v=0;for(let t=0,q=m.length;t<q;++t)m.charAt(t)!==u.charAt(t)&&++v;return v};e.StringLevenshteinDistance=function(m,u){if(0===m.length)return u.length;
if(0===u.length)return m.length;let v,t,q,p;if(m.length>u.length){var r=m;m=u;u=r}p=Array(m.length+1);for(r=0;r<=m.length;r++)p[r]=r;for(r=1;r<=u.length;r++){t=r;for(v=1;v<=m.length;v++)q=u[r-1]===m[v-1]?p[v-1]:Math.min(p[v-1]+1,Math.min(t+1,p[v]+1)),p[v-1]=t,t=q;p[m.length]=t}return p[m.length]}}
{"use strict";const e=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,
c=/\[(\/?)([^\[\n]*?)\]/g;let d=null,f=0;function h(l,m,u){var v=b.get(u);if(v){if("string"===typeof v){if("a"!==v||m)return"<"+m+v+">";m=parseInt(u.substring(1),10)-1;if(0>m||m>=d.length)throw Error("invalid bbcode link substitution");v=d[m];if("string"===typeof v)return`<a href="${d[m]}">`;if("function"===typeof v)return`<a class="bblink${m}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(v))return l=v[0],v=v[1],m?"</"+l+">":`<${l} class="${v}">`}else return"class"===u?m?
"</span>":`<span class="bbclass${f++}">`:l}const g=/\n/g;e.BBString=class{constructor(l,m){this._bbstr=m&&m.noEscape?l:e.EscapeHTML(l);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(m&&(this._convertLineBreaks=!!m.convertLineBreaks,m.links)){if(9<m.links.length)throw Error("too many links");this._linkActions=m.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 l=this._bbstr;this._hasAnyBBtags&&(f=0,d=this._linkActions,l=l.replace(a,h),d=null);this._needsLineBreakConversion&&(l=l.replace(g,"<br>"));this._htmlstr=
l}return this._htmlstr}attachLinkHandlers(l){if(this._linkActions.length)for(let m=0,u=this._linkActions.length;m<u;++m){const v=this._linkActions[m];if("function"!==typeof v)continue;const t=l.querySelector(".bblink"+m);if(!t)throw Error("unable to attach BBString link handler");t.onclick=v}}equals(l){return l instanceof e.HtmlString?this.toHTML()===l.toHTML():l instanceof e.BBString?this._bbstr===l._bbstr:this._bbstr===l}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const l=
this._bbstr,m=[];let u=c.lastIndex=0;for(var v;null!==(v=c.exec(l));){var t=v.index;if(0<t&&"\\"===l.charAt(t-1))continue;var q=v[0],p=v[1];v=v[2];const r=l.substring(u,t);u=t+q.length;r&&this._fragments.push({text:r,styles:m.slice(0)});if(v)if(p)for(v=v.toLowerCase(),t=m.length-1;0<=t;--t){if(m[t].tag===v){m.splice(t,1);break}}else t=v,q=null,p=v.indexOf("="),-1!==p?(t=v.substring(0,p).toLowerCase(),q=v.substring(p+1)):t=t.toLowerCase(),m.push({tag:t,param:q})}u<l.length&&this._fragments.push({text:l.substring(u),
styles:m.slice(0)});for(const r of this._fragments)r.text=this._ProcessBBCodeEscapeSequences(r.text);this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(l){l=e.ReplaceAll(l,"\\[","[");return e.ReplaceAll(l,"\\\\","\\")}static StripTags(l){return e.New(e.BBString,l,{noEscape:!0}).toPlainText()}static StripAnyTags(l){return l.replace(c,"")}}}
{"use strict";const e=self.C3;e.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(b,a){let c=0,d=0,f=0,h=0,g=0;for(const l of b)-1===l.width&&(b=a(l.text,l.styles),l.width=b.width,l.height=b.height,l.fontBoundingBoxAscent=b.fontBoundingBoxAscent||0,l.fontBoundingBoxDescent=b.fontBoundingBoxDescent||0,l.topToAlphabeticDistance=b.topToAlphabeticDistance||0),c+=l.width,d=Math.max(d,l.height),f=Math.max(f,l.fontBoundingBoxAscent),
h=Math.max(h,l.fontBoundingBoxDescent),g=Math.max(g,l.topToAlphabeticDistance);return{width:c,height:d,fontBoundingBoxAscent:f,fontBoundingBoxDescent:h,topToAlphabeticDistance:g}}_AddLine(b,a,c,d,f,h){this._lines.push({fragments:b,width:a,height:c,fontBoundingBoxAscent:d,fontBoundingBoxDescent:f,topToAlphabeticDistance:h})}WordWrap(b,a,c,d,f){"string"===typeof b&&(b=[{text:b,styles:[]}]);e.clearArray(this._lines);if(!(!b.length||1===b.length&&!b[0].text.length||2>c)){if(1===b.length){var h=b[0];const g=
h.text;h=h.styles;if(100>=g.length&&!g.includes("\n")){let {width:l,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:v,topToAlphabeticDistance:t}=a(g,h);l+=f;u=u||0;v=v||0;t=t||0;if(l<=c){this._AddLine([{text:g,styles:h,width:l,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:v,topToAlphabeticDistance:t}],l,m,u,v,t);return}}}if("word"===d)d=this._TokeniseWords(b);else{d=[];for(const g of b)e.appendArray(d,[...g.text].map(l=>[{text:l,styles:g.styles}]))}this._WrapText(d,a,c,f)}}_TokeniseWords(b){const a=
[];let c=[],d=!1;for(const h of b){var f=h.text;b=h.styles;for(const g of f)"\n"===g?(0<c.length&&a.push(c),a.push([{text:"\n",styles:b}]),c=[]):0===c.length?(c.push({text:g,styles:b}),d=e.IsWhitespaceChar(g)):(f=e.IsWhitespaceChar(g),f===d?(f=c.at(-1),f.styles===b?f.text+=g:c.push({text:g,styles:b})):(a.push(c),c=[],c.push({text:g,styles:b}),d=f))}0<c.length&&a.push(c);return a}_CopyLine(b){return b.map(a=>({text:a.text,styles:a.styles,width:a.width,height:a.height,fontBoundingBoxAscent:a.fontBoundingBoxAscent,
fontBoundingBoxDescent:a.fontBoundingBoxDescent,topToAlphabeticDistance:a.topToAlphabeticDistance}))}_AddWordToLine(b,a){var c=b.length?b.at(-1):null;let d=0;c&&a[0].styles===c.styles&&(c.text+=a[0].text,c.width=-1,c.height=-1,c.fontBoundingBoxAscent=-1,c.fontBoundingBoxDescent=-1,c.topToAlphabeticDistance=-1,d=1);for(c=a.length;d<c;++d){const f=a[d];b.push({text:f.text,styles:f.styles,width:-1,height:-1,fontBoundingBoxAscent:-1,fontBoundingBoxDescent:-1,topToAlphabeticDistance:-1})}}_WrapText(b,
a,c,d){let f=[],h=0,g=0,l=0,m=0;var u=0;for(const v of b){if(1===v.length&&"\n"===v[0].text){0===g&&(u=a(" ",v[0].styles),g=u.height,l=u.fontBoundingBoxAscent||0,m=u.fontBoundingBoxDescent||0,u=u.topToAlphabeticDistance||0);this._AddLine(f,h,g,l,m,u);f=[];u=m=l=g=h=0;continue}b=this._CopyLine(f);this._AddWordToLine(b,v);const t=this._MeasureLine(b,a),q=t.width;q>=c?(0<f.length&&this._AddLine(f,h,g,l,m,u),f=[],e.IsStringAllWhitespace(v[0].text)?u=m=l=g=h=0:(this._AddWordToLine(f,v),u=this._MeasureLine(f,
a),h=u.width,g=u.height,l=u.fontBoundingBoxAscent,m=u.fontBoundingBoxDescent,u=u.topToAlphabeticDistance)):(f=b,h=q,g=t.height,l=t.fontBoundingBoxAscent,m=t.fontBoundingBoxDescent,u=t.topToAlphabeticDistance)}0<f.length&&this._AddLine(f,h,g,l,m,u);this._TrimLinesTrailingWhitespace(a,d)}_TrimLinesTrailingWhitespace(b,a){for(const d of this._lines){const f=d.fragments;if(!f.length)continue;let h=f.at(-1);var c=h.text;const g=c.trimEnd();if(!g)d.width-=h.width,f.pop();else if(g.length<c.length){c=b(g,
h.styles).width;const l=h.width-c;h.width=c;h.text=g;d.width-=l}0!==a&&0<f.length&&(h=f.at(-1),h.width+=a,d.width+=a)}}Clear(){e.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";const e=self.C3,b=self.glMatrix,a=b.vec3,c=b.vec4,d=b.mat4,f=a.create(),h=a.create(),g=a.create(),l=c.create(),m=d.create(),u=a.create(),v=a.create(),t=a.create(),q=a.create(),p=a.create(),r=a.create(),x=a.create(),y=a.create(),C=c.fromValues(0,0,1,1);e.Gfx={Project(B,I,L,P,S,U,V){const Z=P[0]*B+P[4]*I+P[8]*L+P[12],la=P[1]*B+P[5]*I+P[9]*L+P[13],va=P[2]*B+P[6]*I+P[10]*L+P[14];P=P[3]*B+P[7]*I+P[11]*L+P[15];B=S[0]*Z+S[4]*la+S[8]*va+S[12]*P;I=S[1]*Z+S[5]*la+S[9]*va+S[13]*P;L=S[2]*Z+S[6]*
la+S[10]*va+S[14]*P;S=S[3]*Z+S[7]*la+S[11]*va+S[15]*P;if(0===S)return!1;S=1/S;V[0]=(B*S*.5+.5)*U[2]+U[0];V[1]=(I*S*.5+.5)*U[3]+U[1];V[2]=.5*(1+L*S);return!0},Unproject(B,I,L,P,S,U,V){d.multiply(m,S,P);if(null===d.invert(m,m))return!1;l[0]=(B-U[0])/U[2]*2-1;l[1]=(I-U[1])/U[3]*2-1;l[2]=2*L-1;l[3]=1;c.transformMat4(l,l,m);if(0===l[3])return!1;l[3]=1/l[3];V[0]=l[0]*l[3];V[1]=l[1]*l[3];V[2]=l[2]*l[3];return!0},UnprojectScreenToWorldZ(B,I,L,P,S,U,V){if(!e.Gfx.Unproject(B,I,0,P,S,U,f)||!e.Gfx.Unproject(B,
I,1,P,S,U,h))return!1;a.subtract(h,h,f);a.set(g,0,0,1);B=-L;I=a.dot(g,h);L=0;if(0===I){if(0!==a.dot(g,f)+B)return!1}else if(L=-(a.dot(f,g)+B)/I,0>L)return!1;a.scaleAndAdd(V,f,h,L);return!0}};function G(B,I,L,P){a.subtract(f,L,I);a.subtract(h,B,I);a.cross(g,f,h);a.normalize(g,g);P.set(g[0],g[1],g[2],a.dot(B,g))}function A(B,I,L,P,S,U,V){const Z=V.x,la=V.y,va=V.z,Na=V.w,za=V.xF,Ha=V.yF;V=V.zF;const Ja=1-za,Aa=1-Ha,ya=1-V;return Z*B*za+Z*P*Ja+la*I*Ha+la*S*Aa+va*L*V+va*U*ya>=Na?!0:Z*P*za+Z*B*Ja+la*S*
Ha+la*I*Aa+va*U*V+va*L*ya>Na}function E(B,I,L,P){return P.x*B+P.y*I+P.z*L>=P.w}class J{constructor(){this.zF=this.yF=this.xF=this.w=this.z=this.y=this.x=NaN}set(B,I,L,P){this.x=B;this.y=I;this.z=L;this.w=P;this.xF=0<B?1:0;this.yF=0<I?1:0;this.zF=0<L?1:0}}e.Gfx.ViewFrustum=class{constructor(){this._leftP=new J;this._topP=new J;this._rightP=new J;this._bottomP=new J;this._nearP=new J;this._farP=new J}CalculatePlanes(B,I){e.Gfx.Unproject(0,1,0,B,I,C,u);e.Gfx.Unproject(1,1,0,B,I,C,v);e.Gfx.Unproject(0,
0,0,B,I,C,t);e.Gfx.Unproject(1,0,0,B,I,C,q);e.Gfx.Unproject(0,1,1,B,I,C,p);e.Gfx.Unproject(1,1,1,B,I,C,r);e.Gfx.Unproject(0,0,1,B,I,C,x);e.Gfx.Unproject(1,0,1,B,I,C,y);G(t,u,p,this._leftP);G(u,v,r,this._topP);G(v,q,y,this._rightP);G(q,t,x,this._bottomP);G(x,p,r,this._farP);G(q,v,u,this._nearP)}ContainsAABB(B,I,L,P,S,U){return A(B,I,L,P,S,U,this._leftP)&&A(B,I,L,P,S,U,this._topP)&&A(B,I,L,P,S,U,this._rightP)&&A(B,I,L,P,S,U,this._bottomP)&&A(B,I,L,P,S,U,this._nearP)&&A(B,I,L,P,S,U,this._farP)}IsBehindNearPlane(B,
I,L){return!E(B,I,L,this._nearP)}}}
{"use strict";const e=self.C3,b=self.glMatrix,a=b.vec3,c=b.vec4,d=b.mat4,f=d.create(),h=a.fromValues(0,0,0),g=a.fromValues(0,0,0),l=a.fromValues(0,0,0),m=a.fromValues(0,1,0);c.fromValues(0,0,0,0);const u=new e.Quad,v=new e.Rect,t=new e.Quad(0,0,1,0,1,1,0,1);e.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._fovY=e.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=d.create();this._matMV=d.create();this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spSmoothLineFill=
this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._currentZ=this._baseZ=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];this._lineOffset=.5;this._lineOffsetStack=
[this._lineOffset];this._frameNumber=0;this._enableMipmaps=!0;this._hasMajorPerformanceCaveat=!1}FillIndexBufferData(q){let p=0,r=q.length,x=0;for(;p<r;)q[p++]=x,q[p++]=x+1,q[p++]=x+2,q[p++]=x,q[p++]=x+2,q[p++]=x+3,x+=4}_ClearState(){this._currentZ=this._baseZ=0;this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._ClearAllShaderPrograms()}InitState(){this._ClearState();
this._currentStateGroup=null}OnDeviceOrContextLost(){for(const q of this._allShaderPrograms)q.Release();this._ClearState()}GetWidth(){return this._width}GetHeight(){return this._height}GetDefaultCameraZ(){return 100}GetNearZ(){return 1}GetFarZ(){return 1E4}GetFovY(){return this._fovY}_GetTanFovYDiv2(){return this._tan_fovY_2}CalculatePerspectiveMatrix(q,p,r=.5,x=.5){const y=this.GetNearZ(),C=this.GetFarZ();var G=this.GetFovY();if(.5===r&&.5===x)this.IsWebGPU()?d.perspectiveZO(q,G,p,y,C):d.perspective(q,
G,p,y,C);else{r=1-r;G=2*r-2;r*=2;const A=2*x-2;x*=2;const E=this._GetTanFovYDiv2()*y;p*=E;d.frustum(q,G*p,r*p,A*E,x*E,y,C)}}CalculateOrthographicMatrix(q,p,r,x=1){var y=self.devicePixelRatio;const C=2*this.GetDefaultCameraZ()*y*this._GetTanFovYDiv2()/r;p=p*C/(2*y*x);r=r*C/(2*y*x);x=-p;y=-r;this.IsWebGPU()?d.orthoZO(q,x,p,y,r,this.GetNearZ(),this.GetFarZ()):d.ortho(q,x,p,y,r,this.GetNearZ(),this.GetFarZ())}CalculateLookAtModelView(q,p,r,x,y=this.GetHeight()){y=2*this.GetDefaultCameraZ()*self.devicePixelRatio*
this._GetTanFovYDiv2()/y;a.set(l,y,-y,1);a.multiply(h,p,l);a.multiply(g,r,l);d.lookAt(q,h,g,x||m);d.scale(q,q,l)}CalculateLookAtModelView2(q,p,r,x,y,C,G){a.set(h,q,p,r);a.set(g,x,y,C);this.CalculateLookAtModelView(f,h,g,m,G);return f}_AddShaderProgram(q){this._allShaderPrograms.push(q);this._shaderProgramsByName.set(q.GetName(),q)}_RemoveShaderProgram(q){const p=this._allShaderPrograms.indexOf(q);-1!==p&&this._allShaderPrograms.splice(p,1);this._shaderProgramsByName.delete(q.GetName())}_ClearAllShaderPrograms(){e.clearArray(this._allShaderPrograms);
this._shaderProgramsByName.clear()}GetShaderProgramByName(q){return this._shaderProgramsByName.get(q)||null}GetTextureFillShaderProgram(){return this._spTextureFill}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}GetPointsRenderingProgram(){return this._spPoints}SetPointsRenderingProgram(){this.SetProgram(this._spPoints)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}_SetCurrentStateGroup(q){this._currentStateGroup=
q}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(q,p,r,x){const y=e.Gfx.StateGroup.MakeKey(q,p,r,x);let C=this._stateGroups.get(y);C||(C=e.New(e.Gfx.StateGroup,this,q,p,r,x),this._stateGroups.set(y,C));C.AddRef();return C}ReleaseStateGroup(q){q.DecRef();0===q._GetRefCount()&&(this._currentStateGroup===q&&(this._currentStateGroup=null),this._stateGroups.delete(q.GetKey()),q.Release())}_InitBlendModeData(q){e.clearArray(this._blendModeTable);this._namedBlendModeMap.clear();
let p=0;for(const r of q){q=r[0];const x=r[1],y=r[2];this._blendModeTable.push([x,y]);this._namedBlendModeMap.set(q,{number:p,srcBlend:x,destBlend:y});p++}}_GetBlendByIndex(q){return this._blendModeTable[q]}GetSrcBlendByIndex(q){return this._GetBlendByIndex(q)[0]}GetDestBlendByIndex(q){return this._GetBlendByIndex(q)[1]}GetNamedBlend(q){q=this._namedBlendModeMap.get(q);if("undefined"===typeof q)throw Error("invalid blend name");return q}NamedBlendToNumber(q){q=this._namedBlendModeMap.get(q);if("undefined"===
typeof q)throw Error("invalid blend name");return q.number}SetBaseZ(q){this._baseZ=q}GetBaseZ(){return this._baseZ}SetCurrentZ(q){this._currentZ=q;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}Line(q,p,r,x){var y=e.angleTo(q,p,r,x),C=.5*this._lineWidth;const G=Math.sin(y)*C;y=Math.cos(y)*C;C=this._lineCap;2===C?this.LinePreCalc_LineCap2(q,p,0,r,x,0,G,y):1===C?this.LinePreCalc_LineCap1(q,p,0,r,x,0,G,y):this.LinePreCalc_LineCap0(q,p,0,r,x,0,G,y)}Line3D(q,p,r,x,y,C){var G=e.angleTo(q,
p,x,y),A=.5*this._lineWidth;const E=Math.sin(G)*A;G=Math.cos(G)*A;A=this._lineCap;2===A?this.LinePreCalc_LineCap2(q,p,r,x,y,C,E,G):1===A?this.LinePreCalc_LineCap1(q,p,r,x,y,C,E,G):this.LinePreCalc_LineCap0(q,p,r,x,y,C,E,G)}LinePreCalc_LineCap2(q,p,r,x,y,C,G,A){var E=this._lineOffset;q=q+E-A;p=p+E-G;x=x+E+A;y=y+E+G;E=2*A;const J=2*G;this.Quad3D2(q+G,p-A,r,x+G,y-A,C,x-G-E,y+A-J,C,q-G+E,p+A+J,r,t)}LinePreCalc_LineCap1(q,p,r,x,y,C,G,A){const E=this._lineOffset;q=q+E-A;p=p+E-G;x=x+E+A;y=y+E+G;this.Quad3D2(q+
G,p-A,r,x+G,y-A,C,x-G,y+A,C,q-G,p+A,r,t)}LinePreCalc_LineCap0(q,p,r,x,y,C,G,A){const E=this._lineOffset;q+=E;p+=E;x+=E;y+=E;this.Quad3D2(q+G,p-A,r,x+G,y-A,C,x-G,y+A,C,q-G,p+A,r,t)}TexturedLine(q,p,r,x,y,C){var G=e.angleTo(q,p,r,x),A=.5*this._lineWidth;const E=Math.sin(G)*A;G=Math.cos(G)*A;A=this._lineCap;2===A?this.TexturedLinePreCalc_LineCap2(q,p,r,x,E,G,y,C):1===A?this.TexturedLinePreCalc_LineCap1(q,p,r,x,E,G,y,C):this.TexturedLinePreCalc_LineCap0(q,p,r,x,E,G,y,C)}TexturedLinePreCalc_LineCap2(q,
p,r,x,y,C,G,A){var E=this._lineOffset;q=q+E-C;p=p+E-y;r=r+E+C;x=x+E+y;E=2*C;const J=2*y;u.set(q+y,p-C,r+y,x-C,r-y-E,x+C-J,q-y+E,p+C+J);v.set(G,0,A,0);this.Quad3(u,v)}TexturedLinePreCalc_LineCap1(q,p,r,x,y,C,G,A){const E=this._lineOffset;q=q+E-C;p=p+E-y;r=r+E+C;x=x+E+y;u.set(q+y,p-C,r+y,x-C,r-y,x+C,q-y,p+C);v.set(G,0,A,0);this.Quad3(u,v)}TexturedLinePreCalc_LineCap0(q,p,r,x,y,C,G,A){const E=this._lineOffset;q+=E;p+=E;r+=E;x+=E;u.set(q+y,p-C,r+y,x-C,r-y,x+C,q-y,p+C);v.set(G,0,A,0);this.Quad3(u,v)}LineRect(q,
p,r,x){const y=.5*this._lineWidth,C=this._lineCap;2===C?this._LineRectPreCalc_LineCap2(q,p,r,x,y):1===C?this._LineRectPreCalc_LineCap1(q,p,r,x,y):this._LineRectPreCalc_LineCap0(q,p,r,x,y)}_LineRectPreCalc_LineCap2(q,p,r,x,y){this.LinePreCalc_LineCap2(q,p,0,r,p,0,0,y);this.LinePreCalc_LineCap2(r,p,0,r,x,0,y,0);this.LinePreCalc_LineCap2(r,x,0,q,x,0,0,-y);this.LinePreCalc_LineCap2(q,x,0,q,p,0,-y,0)}_LineRectPreCalc_LineCap1(q,p,r,x,y){this.LinePreCalc_LineCap1(q,p,0,r,p,0,0,y);this.LinePreCalc_LineCap1(r,
p,0,r,x,0,y,0);this.LinePreCalc_LineCap1(r,x,0,q,x,0,0,-y);this.LinePreCalc_LineCap1(q,x,0,q,p,0,-y,0)}_LineRectPreCalc_LineCap0(q,p,r,x,y){this.LinePreCalc_LineCap0(q,p,0,r,p,0,0,y);this.LinePreCalc_LineCap0(r,p,0,r,x,0,y,0);this.LinePreCalc_LineCap0(r,x,0,q,x,0,0,-y);this.LinePreCalc_LineCap0(q,x,0,q,p,0,-y,0)}LineRect2(q){this.LineRect(q.getLeft(),q.getTop(),q.getRight(),q.getBottom())}LineQuad(q){var p=e.angleTo(q.getTlx(),q.getTly(),q.getTrx(),q.getTry()),r=.5*this._lineWidth;const x=Math.sin(p)*
r;p=Math.cos(p)*r;r=this._lineCap;2===r?this._LineQuadPreCalc_LineCap2(q,x,p):1===r?this._LineQuadPreCalc_LineCap1(q,x,p):this._LineQuadPreCalc_LineCap0(q,x,p)}_LineQuadPreCalc_LineCap2(q,p,r){this.LinePreCalc_LineCap2(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,p,r);this.LinePreCalc_LineCap2(q.getTrx(),q.getTry(),0,q.getBrx(),q.getBry(),0,r,-p);this.LinePreCalc_LineCap2(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-p,-r);this.LinePreCalc_LineCap2(q.getBlx(),q.getBly(),0,q.getTlx(),q.getTly(),
0,-r,p)}_LineQuadPreCalc_LineCap1(q,p,r){this.LinePreCalc_LineCap1(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,p,r);this.LinePreCalc_LineCap1(q.getTrx(),q.getTry(),0,q.getBrx(),q.getBry(),0,r,-p);this.LinePreCalc_LineCap1(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-p,-r);this.LinePreCalc_LineCap1(q.getBlx(),q.getBly(),0,q.getTlx(),q.getTly(),0,-r,p)}_LineQuadPreCalc_LineCap0(q,p,r){this.LinePreCalc_LineCap0(q.getTlx(),q.getTly(),0,q.getTrx(),q.getTry(),0,p,r);this.LinePreCalc_LineCap0(q.getTrx(),
q.getTry(),0,q.getBrx(),q.getBry(),0,r,-p);this.LinePreCalc_LineCap0(q.getBrx(),q.getBry(),0,q.getBlx(),q.getBly(),0,-p,-r);this.LinePreCalc_LineCap0(q.getBlx(),q.getBly(),0,q.getTlx(),q.getTly(),0,-r,p)}SetLineWidth(q){this._lineWidth=q;this._lineWidthStack[this._lineWidthStack.length-1]=q}GetLineWidth(){return this._lineWidth}PushLineWidth(q){if(100<=this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(q);this._lineWidth=q}PopLineWidth(){if(1>=
this._lineWidthStack.length)throw Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack.at(-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(q){if("butt"===q)this.PushLineCapButt();else if("square"===q)this.PushLineCapSquare();
else if("zag"===q)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.at(-1)}SetLineOffset(q){this._lineOffset=q;this._lineOffsetStack[this._lineOffsetStack.length-1]=q}GetLineOffset(){return this._lineOffset}PushLineOffset(q){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(q);this._lineOffset=
q}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack.at(-1)}ConvexPoly(q){var p=q.length/2;if(3>p)throw Error("need at least 3 points");p-=2;const r=p-1,x=q[0],y=q[1];for(let C=0;C<p;C+=2){const G=2*C,A=q[G+2],E=q[G+3],J=q[G+4],B=q[G+5];C===r?this.Quad2(x,y,A,E,J,B,J,B):this.Quad2(x,y,A,E,J,B,q[G+6],q[G+7])}}GetNumVertexComponents(){return 3}Finish(){this.EndBatch(!0);
this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(q){this._enableMipmaps=!!q}AreMipmapsEnabled(){return this._enableMipmaps}SetHasMajorPerformanceCaveat(q){this._hasMajorPerformanceCaveat=!!q}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}IsWebGL(){return!1}IsWebGPU(){return!1}}}"use strict";
self.C3.Gfx.ShaderProgramBase=class{constructor(e,b,a){this._name=b;this._renderer=e;this._extendBoxHorizontal=a.extendBoxHorizontal||0;this._extendBoxVertical=a.extendBoxVertical||0;this._crossSampling=!!a.crossSampling;this._mustPreDraw=!!a.mustPreDraw;this._preservesOpaqueness=!!a.preservesOpaqueness;this._animated=!!a.animated;this._blendsBackground=!!a.blendsBackground;this._usesDepth=!!a.usesDepth;this._usesAnySrcRectOrPixelSize=!1;this._needsPostDrawOrExtendBox=this._crossSampling||this._blendsBackground||
0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}Release(){this._renderer=null}GetRenderer(){return this._renderer}GetName(){return this._name}ExtendsBox(){return 0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}IsAnimated(){return this._animated}BlendsBackground(){return this._blendsBackground}UsesDepth(){return this._usesDepth}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}};
{"use strict";const e=self.C3;e.Gfx.StateGroup=class{constructor(b,a,c,d,f){this._renderer=b;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=c;this._color=e.New(e.Color);this._color.set(d);this._zElevation=f;"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 e.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,c,d){return("string"===typeof b?b:b.GetName())+","+a+","+c.getR()+","+c.getG()+","+c.getB()+","+c.getA()+","+d}}}
{"use strict";const e=self.C3,b=e.New(e.Quad);function a(c,d,f){const h=f.getTlx(),g=f.getTly(),l=f.getTrx()-h,m=f.getTry()-g,u=f.getBlx()-h;f=f.getBly()-g;return[h+l*c+u*d,g+m*c+f*d]}e.Gfx.MeshPoint=class{constructor(c,d,f){this._mesh=c;this._col=d;this._row=f;this._v=this._u=this._zElevation=this._y=this._x=0}_Init(c,d,f,h){this._x=c;this._y=d;this._u=f;this._v=h}GetX(){return this._x}SetX(c){this._x!==c&&(this._x=c,this._mesh._SetPointsChanged())}GetY(){return this._y}SetY(c){this._y!==c&&(this._y=
c,this._mesh._SetPointsChanged())}GetZElevation(){return this._zElevation}SetZElevation(c){this._zElevation!==c&&(this._zElevation=Math.max(c,0),this._mesh._SetPointsChanged())}GetU(){return this._u}SetU(c){this._u=c}GetV(){return this._v}SetV(c){this._v=c}_Interpolate_TexRect(c,d,f){[this._x,this._y]=a(c._x,c._y,d);this._zElevation=c._zElevation;this._u=e.lerp(f.getLeft(),f.getRight(),c._u);this._v=e.lerp(f.getTop(),f.getBottom(),c._v)}_Interpolate_TexQuad(c,d,f){[this._x,this._y]=a(c._x,c._y,d);
this._zElevation=c._zElevation;[this._u,this._v]=a(c._u,c._v,f)}SaveToJson(){return{x:this.GetX(),y:this.GetY(),z:this.GetZElevation(),u:this.GetU(),v:this.GetV()}}LoadFromJson(c){this.SetX(c.x);this.SetY(c.y);c.hasOwnProperty("z")&&this.SetZElevation(c.z);this.SetU(c.u);this.SetV(c.v)}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}};e.Gfx.Mesh=class{constructor(c,d,f){if(2>c||2>d)throw Error("invalid mesh size");this._hsize=c;this._vsize=d;this._owner=f||null;
this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._maxZ=0;this._pointsChanged=!1;f=c-1;const h=d-1;for(let g=0;g<d;++g){const l=[];for(let m=0;m<c;++m){const u=e.New(e.Gfx.MeshPoint,this,m,g),v=m/f,t=g/h;u._Init(v,t,v,t);l.push(u)}this._pts.push(l)}}Release(){e.clearArray(this._pts)}GetHSize(){return this._hsize}GetVSize(){return this._vsize}GetOwner(){return this._owner}_GetPoints(){return this._pts}_SetPointsChanged(){this._pointsChanged=!0}_MaybeComputeBounds(){if(this._pointsChanged){var c=
Infinity,d=Infinity,f=-Infinity,h=-Infinity,g=0;for(const l of this._pts)for(const m of l){const u=m.GetX(),v=m.GetY();c=Math.min(c,u);d=Math.min(d,v);f=Math.max(f,u);h=Math.max(h,v);g=Math.max(g,m.GetZElevation())}this._minX=c;this._minY=d;this._maxX=f;this._maxY=h;this._maxZ=g;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}GetMaxZ(){this._MaybeComputeBounds();return this._maxZ}HasAnyZElevation(){return 0<this.GetMaxZ()}GetMeshPointAt(c,d){c=Math.floor(c);d=Math.floor(d);return 0>c||c>=this._hsize||0>d||d>=this._vsize?null:this._pts[d][c]}CalculateTransformedMesh(c,d,f){const h=f instanceof e.Rect;if(c.GetHSize()!==this.GetHSize()||c.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");c=c._pts;const g=this._pts;for(let l=0,m=g.length;l<m;++l){const u=c[l],v=g[l];for(let t=0,q=v.length;t<
q;++t){const p=u[t],r=v[t];h?r._Interpolate_TexRect(p,d,f):r._Interpolate_TexQuad(p,d,f)}}}Draw(c){const d=this._pts;let f=d[0];for(let h=1,g=d.length;h<g;++h){const l=d[h];let m=f[0],u=l[0];for(let v=1,t=l.length;v<t;++v){const q=f[v],p=l[v];b.set(m.GetU(),m.GetV(),q.GetU(),q.GetV(),p.GetU(),p.GetV(),u.GetU(),u.GetV());c.Quad3D2(m.GetX(),m.GetY(),m.GetZElevation(),q.GetX(),q.GetY(),q.GetZElevation(),p.GetX(),p.GetY(),p.GetZElevation(),u.GetX(),u.GetY(),u.GetZElevation(),b);m=q;u=p}f=l}}Outline(c,
d){d||(d=(g,l,m)=>[g,l,m]);const f=this._pts;let h=f[0];for(let g=1,l=f.length;g<l;++g){const m=f[g];let u=h[0],v=m[0];for(let t=1,q=m.length;t<q;++t){const p=h[t],r=m[t],[x,y,C]=d(u.GetX(),u.GetY(),u.GetZElevation()),[G,A,E]=d(p.GetX(),p.GetY(),p.GetZElevation()),[J,B,I]=d(r.GetX(),r.GetY(),r.GetZElevation()),[L,P,S]=d(v.GetX(),v.GetY(),v.GetZElevation());c.Line3D(x,y,C,G,A,E);c.Line3D(x,y,C,J,B,I);c.Line3D(x,y,C,L,P,S);t===q-1&&c.Line3D(G,A,E,J,B,I);g===l-1&&c.Line3D(L,P,S,J,B,I);u=p;v=r}h=m}}InsertPolyMeshVertices(c){c=
c.pointsArr();const d=[],f=this.GetHSize()-1,h=this.GetVSize()-1,g=1/f,l=1/h,m=f-1,u=h-1;let v=c[0],t=c[1],q=e.clamp(Math.floor(v*f),0,m),p=e.clamp(Math.floor(t*h),0,u),r=0,x=0,y=0;var C=-1;const G=()=>{v=e.clamp(e.lerp(v,r,y),0,1);t=e.clamp(e.lerp(t,x,y),0,1);d.push(v,t)};for(let A=0,E=c.length;A<E;A+=2)for(v=c[A],t=c[A+1],d.push(v,t),q=e.clamp(Math.floor(v*f),0,m),p=e.clamp(Math.floor(t*h),0,u),C=(A+2)%E,r=c[C],x=c[C+1],C=-1;;){if(1E6<d.length)throw Error("Too many mesh poly points");const J=q*
g,B=p*l,I=(q+1)*g,L=(p+1)*l;e.isPointInTriangleInclusive(v,t,J,B,I,B,I,L);if(0!==C&&(y=e.rayIntersectExtended(v,t,r,x,J,B,I,L,-.001),0<=y&&.99999999>=y)){G();C=0;continue}if(0<p&&2!==C&&(y=e.rayIntersectExtended(v,t,r,x,J,B,I,B,.001),0<=y&&.99999999>=y)){G();p--;C=4;continue}if(q<m&&3!==C&&(y=e.rayIntersectExtended(v,t,r,x,I,B,I,L,.001),0<=y&&.99999999>=y)){G();q++;C=1;continue}if(0<q&&1!==C&&(y=e.rayIntersectExtended(v,t,r,x,J,B,J,L,.001),0<=y&&.99999999>=y)){G();q--;C=3;continue}if(p<u&&4!==C&&
(y=e.rayIntersectExtended(v,t,r,x,J,L,I,L,.001),0<=y&&.99999999>=y)){G();p++;C=2;continue}break}return e.New(e.CollisionPoly,d)}TransformCollisionPoly(c,d){c=this._TransformPolyPoints(c);this._SimplifyPoly(c);d.setPoints(c)}_TransformPolyPoints(c){const d=[];c=c.pointsArr();for(let f=0,h=c.length;f<h;f+=2){const [g,l]=this.TransformPoint(c[f],c[f+1]);d.push(g,l)}return d}TransformPoint(c,d){var f=this.GetHSize()-1,h=this.GetVSize()-1,g=1/f,l=1/h;f=e.clamp(Math.floor(c*f),0,f-1);const m=e.clamp(Math.floor(d*
h),0,h-1);h=f*g;const u=m*l,v=(f+1)*g,t=(m+1)*l,q=this.GetMeshPointAt(f,m),p=this.GetMeshPointAt(f+1,m+1),r=e.isPointInTriangleInclusive(c,d,h,u,v,u,v,t);g=r?h+g:h;l=r?u:u+l;f=this.GetMeshPointAt(f+(r?1:0),m+(r?0:1));const [x,y,C]=e.triangleCartesianToBarycentric(c,d,h,u,g,l,v,t);return e.triangleBarycentricToCartesian(x,y,C,q.GetX(),q.GetY(),f.GetX(),f.GetY(),p.GetX(),p.GetY())}_SimplifyPoly(c){const d=[];let f=c[0],h=c[1],g=f-c.at(-2),l=h-c.at(-1);for(let u=0,v=c.length;u<v;u+=2){var m=(u+2)%v;
const t=c[m];m=c[m+1];const q=t-f,p=m-h,r=1E-7>Math.abs(p)&&1E-7>Math.abs(l)&&Math.sign(q)===Math.sign(g);(!(1E-7>Math.abs(q)&&1E-7>Math.abs(g)&&Math.sign(p)===Math.sign(l)||r)&&1E-7<Math.abs(q/g-p/l)||0==q&&0===p)&&d.push(f,h);f=t;h=m;g=q;l=p}6<=d.length&&d.length<c.length&&e.shallowAssignArray(c,d)}SaveToJson(){return{cols:this.GetHSize(),rows:this.GetVSize(),points:this._pts.map(c=>c.map(d=>d.SaveToJson()))}}LoadFromJson(c){const d=this.GetHSize(),f=this.GetVSize();if(c.cols!==d||c.rows!==f)throw Error("mesh data wrong size");
c=c.points;for(let h=0;h<f;++h){const g=c[h];for(let l=0;l<d;++l)this.GetMeshPointAt(l,h).LoadFromJson(g[l])}}}}
{"use strict";const e=self.C3,b=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),a=new Set(["nearest","bilinear","trilinear"]),c=new Set(["default","low","high"]),d=new Set(["clamp-to-edge","repeat","mirror-repeat"]);function f(m,u){let v,t;switch(m){case "rgba8":m=u.RGBA8;t=v=u.RGBA;u=u.UNSIGNED_BYTE;break;case "rgb8":m=u.RGB8;t=v=u.RGB;u=u.UNSIGNED_BYTE;break;case "rgba4":m=u.RGBA4;t=v=u.RGBA;u=u.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":m=u.RGB5_A1;t=v=u.RGBA;u=u.UNSIGNED_SHORT_5_5_5_1;break;
case "rgb565":m=u.RGB565;t=v=u.RGB;u=u.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:m,internalformat:v,format:t,type:u}}const h={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",sampling:"trilinear",anisotropy:0,pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},g={premultiplyAlpha:!0,flipY:!1},l=new Set;e.Gfx.WebGLRendererTexture=class{constructor(m){this._renderer=m;this._texture=null;this._height=
this._width=0;this._isStatic=!0;this._wrapY=this._wrapX="clamp-to-edge";this._sampling="trilinear";this._anisotropy=0;this._pixelFormat="rgba8";this._isMipMapped=!1;this._mipMapQuality="default";this._refCount=0}_CreateStatic(m,u){if(!("undefined"!==typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||
m instanceof ImageData||m instanceof ArrayBuffer)&&null!==m)throw Error("invalid texture source");u=Object.assign({},h,u);if(this._texture)throw Error("already created texture");this._wrapX=u.wrapX;this._wrapY=u.wrapY;this._sampling=u.sampling;this._anisotropy=u.anisotropy;this._pixelFormat=u.pixelFormat;this._isMipMapped=!!u.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=u.mipMapQuality;if(!d.has(this._wrapX)||!d.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(!c.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(m instanceof ArrayBuffer||null===m||u.isSvg){if(this._width=u.width,this._height=u.height,m instanceof ArrayBuffer&&m.byteLength!==this._width*this._height*4)throw Error("ArrayBuffer wrong size");}else this._width=m.width,this._height=m.height;if(0>=this._width||0>=this._height)throw Error("invalid texture data size");if(u.isSvg){var v=e.CreateCanvas(this._width,
this._height);v.getContext("2d").drawImage(m,0,0,this._width,this._height);m=v}var t=e.isPOT(this._width)&&e.isPOT(this._height);v=this._renderer.GetMaxTextureSize();if(this._width>v||this._height>v)throw Error("texture data exceeds maximum texture size");v=this._renderer.GetContext();var q=this._renderer.GetWebGLVersionNumber();this._texture=v.createTexture();v.bindTexture(v.TEXTURE_2D,this._texture);v.pixelStorei(v.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,
!1);u=f(this._pixelFormat,v);if(this._renderer.SupportsNPOTTextures()||t||!this._IsTiled())2<=q?(v.texStorage2D(v.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,u.sizedinternalformat,this._width,this._height),m instanceof ArrayBuffer?v.texSubImage2D(v.TEXTURE_2D,0,0,0,this._width,this._height,u.format,u.type,new Uint8Array(m)):null!==m&&v.texSubImage2D(v.TEXTURE_2D,0,0,0,u.format,u.type,m)):m instanceof ArrayBuffer?v.texImage2D(v.TEXTURE_2D,0,u.internalformat,
this._width,this._height,0,u.format,u.type,new Uint8Array(m)):null===m?v.texImage2D(v.TEXTURE_2D,0,u.internalformat,this._width,this._height,0,u.format,u.type,null):v.texImage2D(v.TEXTURE_2D,0,u.internalformat,u.format,u.type,m);else{if(null===m)throw Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");m instanceof ArrayBuffer&&(m=new ImageData(new Uint8ClampedArray(m),this._width,this._height));m instanceof ImageData&&(t=e.CreateCanvas(this._width,this._height),
t.getContext("2d").putImageData(m,0,0),m=t);t=e.CreateCanvas(e.nextHighestPowerOfTwo(this._width),e.nextHighestPowerOfTwo(this._height));q=t.getContext("2d");q.imageSmoothingEnabled="nearest"!==this._sampling;q.drawImage(m,0,0,this._width,this._height,0,0,t.width,t.height);v.texImage2D(v.TEXTURE_2D,0,u.internalformat,u.format,u.type,t)}null!==m&&this._SetTextureParameters(v);v.bindTexture(v.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_CreateDynamic(m,u,v){v=Object.assign({},
h,v);if(this._texture)throw Error("already created texture");this._wrapX=v.wrapX;this._wrapY=v.wrapY;this._sampling=v.sampling;this._pixelFormat=v.pixelFormat;this._isMipMapped=!!v.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=v.mipMapQuality;if(!d.has(this._wrapX)||!d.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(!c.has(this._mipMapQuality))throw Error("invalid mipmap quality");
this._isStatic=!1;this._width=Math.floor(m);this._height=Math.floor(u);m=e.isPOT(this._width)&&e.isPOT(this._height);u=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>u||this._height>u)throw Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!m)throw Error("non-power-of-two tiled textures not supported");m=this._renderer.GetContext();u=this._renderer.GetWebGLVersionNumber();
this._texture=m.createTexture();m.bindTexture(m.TEXTURE_2D,this._texture);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,!1);v=f(this._pixelFormat,m);m.texImage2D(m.TEXTURE_2D,0,2<=u?v.sizedinternalformat:v.internalformat,this._width,this._height,0,v.format,v.type,null);this._SetTextureParameters(m);m.bindTexture(m.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_GetMipMapHint(m){if("default"===this._mipMapQuality)return this._isStatic?
m.NICEST:m.FASTEST;if("low"===this._mipMapQuality)return m.FASTEST;if("high"===this._mipMapQuality)return m.NICEST;throw Error("invalid mipmap quality");}_IsTiled(){return"clamp-to-edge"!==this._wrapX||"clamp-to-edge"!==this._wrapY}_GetTextureWrapMode(m,u){if("clamp-to-edge"===u)return m.CLAMP_TO_EDGE;if("repeat"===u)return m.REPEAT;if("mirror-repeat"===u)return m.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(m){var u=e.isPOT(this._width)&&e.isPOT(this._height);m.texParameteri(m.TEXTURE_2D,
m.TEXTURE_WRAP_S,this._GetTextureWrapMode(m,this._wrapX));m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,this._GetTextureWrapMode(m,this._wrapY));"nearest"===this._sampling?(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),this._isMipMapped=!1):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR),(u||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(m.hint(m.GENERATE_MIPMAP_HINT,this._GetMipMapHint(m)),m.generateMipmap(m.TEXTURE_2D),
u="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,u?m.LINEAR_MIPMAP_LINEAR:m.LINEAR_MIPMAP_NEAREST)):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),this._isMipMapped=!1));(u=this._renderer._GetAnisotropicExtension())&&0<this._anisotropy&&"nearest"!==this._sampling&&m.texParameterf(m.TEXTURE_2D,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(m,u){if(!("undefined"!==
typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLVideoElement&&m instanceof HTMLVideoElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||m 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");
u=Object.assign({},g,u);const v=m.width||m.videoWidth,t=m.height||m.videoHeight;var q=this._renderer.GetWebGLVersionNumber();const p=this._renderer.GetContext();p.bindTexture(p.TEXTURE_2D,this._texture);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!!u.flipY);u=f(this._pixelFormat,p);q=2<=q?u.sizedinternalformat:u.internalformat;try{if(this._width===v&&this._height===t){const r=e.isPOT(this._width)&&e.isPOT(this._height);p.texSubImage2D(p.TEXTURE_2D,
0,0,0,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(p.hint(p.GENERATE_MIPMAP_HINT,this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D))}else{this._width=v;this._height=t;const r=e.isPOT(this._width)&&e.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!r)throw Error("non-power-of-two tiled textures not supported");p.texImage2D(p.TEXTURE_2D,0,q,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(p.hint(p.GENERATE_MIPMAP_HINT,
this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D))}}catch(r){console.error("Error updating WebGL texture: ",r)}p.bindTexture(p.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");l.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 m=this._width*this._height;switch(this._pixelFormat){case "rgba8":m*=4;break;case "rgb8":m*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":m*=2}this._isMipMapped&&(m+=Math.floor(m/3));return m}static OnContextLost(){l.clear()}static allTextures(){return l.values()}}}
{"use strict";const e=self.C3,b=self.glMatrix.mat4,a=new Set(["nearest","bilinear","trilinear"]),c={sampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,isDefaultSize:!0,multisampling:0},d=new Set;e.Gfx.WebGLRenderTarget=class{constructor(f){this._renderer=f;this._renderBuffer=this._texture=this._frameBufferNoDepth=this._frameBuffer=null;this._height=this._width=0;this._isDefaultSize=!0;this._sampling="trilinear";this._alpha=!0;this._depth=!1;this._isSampled=!0;this._multisampling=0;this._projectionMatrix=
b.create()}_Create(f,h,g){g=Object.assign({},c,g);const l=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw Error("already created render target");this._sampling=g.sampling;this._alpha=!!g.alpha;this._depth=!!g.depth;this._isSampled=!!g.isSampled;this._isDefaultSize=!!g.isDefaultSize;this._multisampling=g.multisampling;if(!a.has(this._sampling))throw Error("invalid sampling");if(0<this._multisampling&&(2>l||this._isSampled))throw Error("invalid use of multisampling");
2>l&&(this._isSampled=!0);this._width=f;this._height=h;if(0>=this._width||0>=this._height)throw Error("invalid render target size");this._CalculateProjection();f=this._renderer.GetContext();this._frameBuffer=f.createFramebuffer();this._depth&&(this._frameBufferNoDepth=f.createFramebuffer());this._isSampled?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),h=this._texture._GetTexture(),f.bindFramebuffer(f.FRAMEBUFFER,
this._frameBuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,h,0),this._depth&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBufferNoDepth),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,h,0))):(this._renderBuffer=f.createRenderbuffer(),f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),h=this._alpha?f.RGBA8:f.RGB8,0<this._multisampling&&((g=f.getInternalformatParameter(f.RENDERBUFFER,h,f.SAMPLES))&&g[0]?(g=g[0],this._multisampling>g&&(this._multisampling=
g)):this._multisampling=0),0===this._multisampling?f.renderbufferStorage(f.RENDERBUFFER,h,this._width,this._height):f.renderbufferStorageMultisample(f.RENDERBUFFER,this._multisampling,h,this._width,this._height),f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,this._renderBuffer),this._depth&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBufferNoDepth),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,
this._renderBuffer)),f.bindRenderbuffer(f.RENDERBUFFER,null));h=this._renderer._GetDepthBuffer();this._depth&&h&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),this._renderer._CanSampleDepth()?f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,h,0):f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,h));f.bindFramebuffer(f.FRAMEBUFFER,null);d.add(this)}_Resize(f,h){if(this._width!==f||this._height!==h)this._width=f,this._height=h,this._CalculateProjection(),
f=this._renderer.GetContext(),f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),f.renderbufferStorage(f.RENDERBUFFER,this._alpha?f.RGBA8:f.RGB8,this._width,this._height),f.bindRenderbuffer(f.RENDERBUFFER,null)),h=this._renderer._GetDepthBuffer(),this._depth&&h&&(this._renderer._CanSampleDepth()?f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,
h,0):f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,h)),f.bindFramebuffer(f.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw Error("already deleted render target");d.delete(this);var f=this._renderer.GetContext();this._texture?(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,null,0),this._depth&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBufferNoDepth),f.framebufferTexture2D(f.FRAMEBUFFER,
f.COLOR_ATTACHMENT0,f.TEXTURE_2D,null,0)),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,null),this._depth&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBufferNoDepth),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,null)),f.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);f.bindFramebuffer(f.FRAMEBUFFER,
null);2<=this._renderer.GetWebGLVersionNumber()&&(f.bindFramebuffer(f.READ_FRAMEBUFFER,null),f.bindFramebuffer(f.DRAW_FRAMEBUFFER,null));f.deleteFramebuffer(this._frameBuffer);this._depth&&f.deleteFramebuffer(this._frameBufferNoDepth);f=this._renderer.GetBatchState();f.currentFramebuffer=null;this._frameBuffer=f.currentFramebufferNoDepth=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height)}_GetFramebuffer(){return this._frameBuffer}_GetFramebufferNoDepth(){return this._frameBufferNoDepth}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){return this._projectionMatrix}IsLinearSampling(){return"nearest"!==
this._sampling}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const f={sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};this._isDefaultSize||(f.width=this._width,f.height=this._height);return f}IsCompatibleWithOptions(f){f=Object.assign({},c,f);return"nearest"!==
f.sampling!==this.IsLinearSampling()||!!f.alpha!==this.HasAlpha()||!!f.depth!==this.HasDepthBuffer()||2<=this._renderer.GetWebGLVersionNumber()&&!!f.isSampled!==this.IsSampled()?!1:"number"===typeof f.width||"number"===typeof f.height?!this.IsDefaultSize()&&this.GetWidth()===f.width&&this.GetHeight()===f.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(f,h){f=await f.ReadBackRenderTargetToImageData(h,!0);return await e.ImageDataToBlob(f)}static OnContextLost(){d.clear()}static allRenderTargets(){return d.values()}static ResizeAll(f,h){for(const g of d)g.IsDefaultSize()&&g._Resize(f,h)}}}
{"use strict";const e=self.C3,b=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack samplerDepth destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds devicePixelRatio layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));e.Gfx.WebGLShaderProgram=class extends e.Gfx.ShaderProgramBase{static async Compile(a,c,d,f){const h=a.GetContext(),g=h.createShader(h.FRAGMENT_SHADER);
h.shaderSource(g,c);h.compileShader(g);c=h.createShader(h.VERTEX_SHADER);h.shaderSource(c,d);h.compileShader(c);const l=h.createProgram();h.attachShader(l,g);h.attachShader(l,c);h.bindAttribLocation(l,0,"aPos");h.bindAttribLocation(l,1,"aTex");h.bindAttribLocation(l,2,"aPoints");h.linkProgram(l);const m=a._GetParallelShaderCompileExtension();m?await a._WaitForObjectReady(()=>h.getProgramParameter(l,m.COMPLETION_STATUS_KHR)):await e.Wait(5);if(!h.getShaderParameter(g,h.COMPILE_STATUS))throw f=h.getShaderInfoLog(g),
h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error compiling fragment shader: "+f);if(!h.getShaderParameter(c,h.COMPILE_STATUS))throw f=h.getShaderInfoLog(c),h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error compiling vertex shader: "+f);if(!h.getProgramParameter(l,h.LINK_STATUS))throw f=h.getProgramInfoLog(l),h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error linking shader program: "+f);(a=e.FilterUnprintableChars(h.getProgramInfoLog(l)||"").trim())&&
!e.IsStringAllWhitespace(a)&&console.info(`[WebGL] Shader program '${f}' compilation log: `,a);h.deleteShader(g);h.deleteShader(c);return l}static async Create(a,c,d,f){d=await e.Gfx.WebGLShaderProgram.Compile(a,c.src,d,f);return new e.Gfx.WebGLShaderProgram(a,d,c,f)}constructor(a,c,d,f){super(a,f,d);const h=a.GetContext();var g=a.GetBatchState();a.EndBatch();h.useProgram(c);this._gl=h;this._shaderProgram=c;this._isDeviceTransform="<default-device-transform>"===f;f=h.getAttribLocation(c,"aPos");const l=
h.getAttribLocation(c,"aTex");this._locAPoints=h.getAttribLocation(c,"aPoints");-1!==f&&(h.bindBuffer(h.ARRAY_BUFFER,a._vertexBuffer),h.vertexAttribPointer(f,a.GetNumVertexComponents(),h.FLOAT,!1,0,0),h.enableVertexAttribArray(f));-1!==l&&(h.bindBuffer(h.ARRAY_BUFFER,a._texcoordBuffer),h.vertexAttribPointer(l,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(l));-1!==this._locAPoints&&(h.bindBuffer(h.ARRAY_BUFFER,a._pointBuffer),h.vertexAttribPointer(this._locAPoints,4,h.FLOAT,!1,0,0),h.enableVertexAttribArray(this._locAPoints));
h.bindBuffer(h.ARRAY_BUFFER,null);this._uMatP=new e.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=new e.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new e.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new e.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new e.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new e.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new e.Gfx.WebGLShaderUniform(this,
"zElevation","float");this._uTileSize=new e.Gfx.WebGLShaderUniform(this,"tileSize","vec2");this._uTileSpacing=new e.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new e.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new e.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new e.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uSamplerDepth=new e.Gfx.WebGLShaderUniform(this,"samplerDepth","sampler");this._uDestStart=new e.Gfx.WebGLShaderUniform(this,
"destStart","vec2");this._uDestEnd=new e.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new e.Gfx.WebGLShaderUniform(this,"srcStart","vec2");this._uSrcEnd=new e.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new e.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new e.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new e.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new e.Gfx.WebGLShaderUniform(this,"seconds",
"float");this._uDevicePixelRatio=new e.Gfx.WebGLShaderUniform(this,"devicePixelRatio","float");this._uLayerScale=new e.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new e.Gfx.WebGLShaderUniform(this,"layerAngle","float");this._uLayoutStart=new e.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new e.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._uDevicePixelRatio.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());a=d.parameters||[];this._uCustomParameters=[];this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();
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._uSamplerDepth.Init1i(2);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._uDevicePixelRatio.Init1f(1);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 m of a)a=m[2],c=new e.Gfx.WebGLShaderUniform(this,m[0],a),"color"===a?c.Init3f(0,0,0):c.Init1f(0),this._uCustomParameters.push(c);this._isDeviceTransform?this._UpdateDeviceTransformUniforms(g.currentMatP):(this.UpdateMatP(g.currentMatP,!0),this.UpdateMatMV(g.currentMV,
!0));g=g.currentShader;h.useProgram(g?g._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._gl=null;super.Release()}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(a){return this._uCustomParameters[a].GetType()}AreCustomParametersAlreadySetInBatch(a){for(let c=0,d=a.length;c<d;++c)if(!this._uCustomParameters[c].IsSetToCustomInBatch(a[c]))return!1;
return!0}SetCustomParametersInBatch(a){for(let c=0,d=a.length;c<d;++c)this._uCustomParameters[c].SetBatchValueCustom(a[c])}AreOptionalUniformsAlreadySetInBatch(a,c,d,f,h,g,l,m,u,v){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(h,g)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(a.getLeft(),a.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(a.getRight(),a.getBottom())||this._uDevicePixelRatio.IsUsed()&&!this._uDevicePixelRatio.IsSetTo1InBatch(l)||
this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(m)||this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(u)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(c.getLeft(),c.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(c.getRight(),c.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(d.getLeft(),d.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(d.getRight(),d.getBottom())||this._uLayoutStart.IsUsed()&&
!this._uLayoutStart.IsSetTo2InBatch(f.getLeft(),f.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(f.getTop(),f.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(v)?!1:!0}SetOptionalUniformsInBatch(a,c,d,f,h,g,l,m,u,v){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(h,g),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(a.getLeft(),a.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(a.getRight(),a.getBottom()),
this._uDevicePixelRatio.IsUsed()&&this._uDevicePixelRatio.SetBatch1(l),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(m),this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(u),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(c.getLeft(),c.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(c.getRight(),c.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(d.getLeft(),d.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(d.getRight(),
d.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(f.getLeft(),f.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(f.getTop(),f.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(v))}UpdateMatP(a,c){this._hasCurrentMatP&&!c||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(a),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(a,c){this._hasCurrentMatMV&&!c||this._isDeviceTransform||(this._uMatMV.IsUsed()&&
this._uMatMV.UpdateMatrix4fv(a),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(a){if(!this._isDeviceTransform)throw Error("not device transform shader");this._uMatP.UpdateMatrix4fv(a);a=this._renderer;const c=a.GetWidth()/2,d=a.GetHeight()/2;a=a.CalculateLookAtModelView2(c,d,a.GetDefaultCameraZ()*self.devicePixelRatio,c,d,0);this._uMatMV.UpdateMatrix4fv(a)}UpdateColor(a){this._uColor.IsUsed()&&this._uColor.Update4f(a[0],a[1],a[2],a[3])}static GetReservedUniformNames(){return b}static GetDefaultVertexShaderSource(a){a=
a?"highmedp":"mediump";return["#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nattribute highp vec3 aPos;",`attribute ${a} vec2 aTex;`,`varying ${a} vec2 vTex;`,"uniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos, 1.0);\n\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(a){return e.Gfx.WebGLShaderProgram.GetPointVertexShaderSource_WebGL1()}static GetPointFragmentShaderSource(a){return e.Gfx.WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1()}static GetPointVertexShaderSource_WebGL1(){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_WebGL1(){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 e=self.C3,b=self.glMatrix.mat4,a=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);e.Gfx.WebGLShaderUniform=class{constructor(c,d,f){if(!a.has(f))throw Error("invalid uniform type");this._owner=c;this._gl=this._owner.GetWebGLContext();this._name=d;this._type=f;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),d);this._isUsed=!!this._location;c=a.get(f);this._lastValue=
new Float32Array(c);this._lastBatchValue=new Float32Array(c)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(c){this.IsUsed()&&(this._lastValue[0]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,c))}Init1i(c){this.IsUsed()&&(this._lastValue[0]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,c))}Init2f(c,d){this.IsUsed()&&(this._lastValue[0]=
c,this._lastValue[1]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,c,d))}Init3f(c,d,f){this.IsUsed()&&(this._lastValue[0]=c,this._lastValue[1]=d,this._lastValue[2]=f,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,c,d,f))}Init4f(c,d,f,h){this.IsUsed()&&(this._lastValue[0]=c,this._lastValue[1]=d,this._lastValue[2]=f,this._lastValue[3]=h,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,c,d,f,h))}Update1f(c){c=Math.fround(c);
const d=this._lastValue;d[0]!==c&&(d[0]=c,this._gl.uniform1f(this._location,c))}Update1i(c){const d=this._lastValue;d[0]!==c&&(d[0]=c,this._gl.uniform1i(this._location,c))}Update2f(c,d){c=Math.fround(c);d=Math.fround(d);const f=this._lastValue;if(f[0]!==c||f[1]!==d)f[0]=c,f[1]=d,this._gl.uniform2f(this._location,c,d)}Update3f(c,d,f){c=Math.fround(c);d=Math.fround(d);f=Math.fround(f);const h=this._lastValue;if(h[0]!==c||h[1]!==d||h[2]!==f)h[0]=c,h[1]=d,h[2]=f,this._gl.uniform3f(this._location,c,d,
f)}Update4f(c,d,f,h){c=Math.fround(c);d=Math.fround(d);f=Math.fround(f);h=Math.fround(h);const g=this._lastValue;if(g[0]!==c||g[1]!==d||g[2]!==f||g[3]!==h)g[0]=c,g[1]=d,g[2]=f,g[3]=h,this._gl.uniform4f(this._location,c,d,f,h)}UpdateMatrix4fv(c){const d=this._lastValue;b.exactEquals(d,c)||(e.typedArraySet16(d,c,0),this._gl.uniformMatrix4fv(this._location,!1,c))}IsSetToCustomInBatch(c){const d=this._lastBatchValue;return this.IsColorType()?d[0]===Math.fround(c.getR())&&d[1]===Math.fround(c.getG())&&
d[2]===Math.fround(c.getB()):d[0]===Math.fround(c)}SetBatchValueCustom(c){const d=this._lastBatchValue;this.IsColorType()?(d[0]=c.getR(),d[1]=c.getG(),d[2]=c.getB()):d[0]=c}IsSetTo1InBatch(c){return this._lastBatchValue[0]===Math.fround(c)}IsSetTo2InBatch(c,d){const f=this._lastBatchValue;return f[0]===Math.fround(c)&&f[1]===Math.fround(d)}SetBatch1(c){this._lastBatchValue[0]=c}SetBatch2(c,d){const f=this._lastBatchValue;f[0]=c;f[1]=d}}}
{"use strict";const e=self.C3,b=self.glMatrix,a=b.vec4,c=b.mat4;e.Gfx.BatchState=class{constructor(d){this.renderer=d;this.currentMV=c.create();this.currentMatP=c.create();this.currentFramebufferNoDepth=this.currentFramebuffer=null;this.isDepthSamplingEnabled=!1;this.currentColor=a.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new e.Rect;this.clearColor=e.New(e.Color,0,0,0,0)}};e.Gfx.WebGLBatchJob=class{constructor(d){const f=new ArrayBuffer(96);this._type=0;this._batchState=d;this._gl=
d.renderer.GetContext();this._indexCount=this._startIndex=0;this._texParam=null;this._mat4param=new Float32Array(f,0,16);this._colorParam=new Float32Array(f,64,4);this._srcOriginRect=new Float32Array(f,80,4);this._shaderParams=[]}InitQuad(d,f){this._type=1;this._startIndex=d;this._indexCount=f}DoQuad(){const d=this._gl;d.drawElements(d.TRIANGLES,this._indexCount,d.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(d){this._type=2;this._texParam=d}DoSetTexture(){const d=this._gl,f=this._texParam;d.bindTexture(d.TEXTURE_2D,
f?f._GetTexture():null)}InitSetColor(d){this._type=3;d.writeToTypedArray(this._colorParam,0)}DoSetColor(){const d=this._colorParam,f=this._batchState;a.copy(f.currentColor,d);f.currentShader.UpdateColor(d)}InitSetGradientColor(d){this._type=20;d.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const d=this._colorParam,f=this._batchState.currentShader;f._uColor2.IsUsed()&&f._uColor2.Update4f(d[0],d[1],d[2],d[3])}InitSetBlend(d,f){this._type=4;this._startIndex=d;this._indexCount=f}DoSetBlend(){this._gl.blendFunc(this._startIndex,
this._indexCount)}InitSetViewport(d,f,h,g){this._type=5;const l=this._colorParam;l[0]=d;l[1]=f;l[2]=h;l[3]=g}DoSetViewport(){const d=this._colorParam;this._gl.viewport(d[0],d[1],d[2],d[3])}InitSetProjection(d){this._type=6;c.copy(this._mat4param,d)}DoSetProjection(){const d=this._batchState,f=d.renderer._allShaderPrograms,h=d.currentShader,g=this._mat4param;for(let l=0,m=f.length;l<m;++l){const u=f[l];u===h?u.UpdateMatP(g,!0):u.SetMatPStale()}c.copy(d.currentMatP,g)}InitSetModelView(d){this._type=
7;c.copy(this._mat4param,d)}DoSetModelView(){const d=this._batchState,f=d.renderer._allShaderPrograms,h=d.currentShader,g=this._mat4param;for(let l=0,m=f.length;l<m;++l){const u=f[l];u===h?u.UpdateMatMV(g,!0):u.SetMatMVStale()}c.copy(d.currentMV,g)}InitSetRenderTarget(d){this._type=8;this._texParam=d}DoSetRenderTarget(){const d=this._gl,f=this._texParam,h=this._batchState;f?(h.currentFramebuffer=f._GetFramebuffer(),h.currentFramebufferNoDepth=f._GetFramebufferNoDepth(),h.isDepthSamplingEnabled&&h.currentFramebufferNoDepth?
d.bindFramebuffer(d.FRAMEBUFFER,h.currentFramebufferNoDepth):d.bindFramebuffer(d.FRAMEBUFFER,h.currentFramebuffer)):(h.currentFramebuffer=null,h.currentFramebufferNoDepth=null,d.bindFramebuffer(d.FRAMEBUFFER,null))}InitClearSurface(d){this._type=9;d.writeToTypedArray(this._mat4param,0)}InitClearSurface2(d,f,h,g){this._type=9;const l=this._mat4param;l[0]=d;l[1]=f;l[2]=h;l[3]=g}DoClearSurface(){const d=this._gl;var f=this._mat4param;const h=this._batchState.clearColor,g=f[0],l=f[1],m=f[2];f=f[3];h.equalsRgba(g,
l,m,f)||(d.clearColor(g,l,m,f),h.setRgba(g,l,m,f));d.clear(d.COLOR_BUFFER_BIT)}InitSetPointTexCoords(d){this._type=14;d.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const d=this._mat4param;this._batchState.pointTexCoords.set(d[0],d[1],d[2],d[3])}InitPoints(d,f){this._type=10;this._startIndex=d;this._indexCount=1;this._mat4param[0]=f}DoPoints(){const d=this._gl,f=this._batchState,h=f.renderer._spPoints;d.useProgram(h._shaderProgram);h.UpdateMatP(f.currentMatP,!1);h.UpdateMatMV(f.currentMV,
!1);var g=f.pointTexCoords;h._uPointTexStart.IsUsed()&&h._uPointTexStart.Update2f(g.getLeft(),g.getTop());h._uPointTexEnd.IsUsed()&&h._uPointTexEnd.Update2f(g.getRight(),g.getBottom());g=this._mat4param[0];h._uZElevation.IsUsed()&&h._uZElevation.Update1f(g);h._uColor.IsUsed()&&(g=f.currentColor,h._uColor.Update4f(g[0],g[1],g[2],g[3]));d.drawArrays(d.POINTS,this._startIndex/4,this._indexCount);d.useProgram(f.currentShader._shaderProgram)}InitSetProgram(d){this._type=11;this._texParam=d}DoSetProgram(){var d=
this._gl;const f=this._batchState,h=this._texParam;f.currentShader=h;d.useProgram(h._shaderProgram);h.UpdateMatP(f.currentMatP,!1);h.UpdateMatMV(f.currentMV,!1);h._uColor.IsUsed()&&(d=f.currentColor,h._uColor.Update4f(d[0],d[1],d[2],d[3]))}InitSetProgramParameters(){this._type=12}DoSetProgramParameters(){const d=this._batchState.currentShader;d._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(d);d._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(d)}_DoSetOptionalUniformProgramParameters(d){const f=
this._gl,h=this._mat4param,g=this._colorParam,l=this._srcOriginRect;if(d._uSamplerBack.IsUsed()){const m=this._batchState.renderer,u=this._texParam;m._lastTexture1!==u&&(f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,u?u._GetTexture():null),m._lastTexture1=u,f.activeTexture(f.TEXTURE0))}d._uPixelSize.IsUsed()&&d._uPixelSize.Update2f(h[0],h[1]);d._uDestStart.IsUsed()&&d._uDestStart.Update2f(h[2],h[3]);d._uDestEnd.IsUsed()&&d._uDestEnd.Update2f(h[4],h[5]);d._uDevicePixelRatio.IsUsed()&&d._uDevicePixelRatio.Update1f(this._indexCount);
d._uLayerScale.IsUsed()&&d._uLayerScale.Update1f(h[6]);d._uLayerAngle.IsUsed()&&d._uLayerAngle.Update1f(h[7]);d._uSrcStart.IsUsed()&&d._uSrcStart.Update2f(h[12],h[13]);d._uSrcEnd.IsUsed()&&d._uSrcEnd.Update2f(h[14],h[15]);d._uSrcOriginStart.IsUsed()&&d._uSrcOriginStart.Update2f(l[0],l[1]);d._uSrcOriginEnd.IsUsed()&&d._uSrcOriginEnd.Update2f(l[2],l[3]);d._uLayoutStart.IsUsed()&&d._uLayoutStart.Update2f(g[0],g[1]);d._uLayoutEnd.IsUsed()&&d._uLayoutEnd.Update2f(g[2],g[3]);d._uSeconds.IsUsed()&&d._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(d){d=
d._uCustomParameters;const f=this._shaderParams;for(let h=0,g=d.length;h<g;++h){const l=d[h],m=f[h];l.IsColorType()?l.Update3f(m.getR(),m.getG(),m.getB()):l.Update1f(m)}}InitInvalidateFramebuffer(d){this._type=13;this._texParam=d}DoInvalidateFramebuffer(){const d=this._gl,f=this._texParam,h=this._batchState.currentFramebuffer;f!==h&&d.bindFramebuffer(d.FRAMEBUFFER,f);d.invalidateFramebuffer(d.FRAMEBUFFER,[d.COLOR_ATTACHMENT0]);f!==h&&d.bindFramebuffer(d.FRAMEBUFFER,h)}InitBlitFramebuffer(d,f,h){this._type=
16;const g=this._mat4param,l=this._batchState.renderer;g[0]=d.GetWidth();g[1]=d.GetHeight();g[2]=f?f.GetWidth():l.GetWidth();g[3]=f?f.GetHeight():l.GetHeight();g[4]=d.IsLinearSampling()?1:0;g[5]="stretch"===h;h=this._shaderParams;e.clearArray(h);h.push(d._GetFramebuffer());h.push(f?f._GetFramebuffer():null)}DoBlitFramebuffer(){var d=this._mat4param,f=this._shaderParams;const h=this._gl;var g=d[0],l=d[1],m=d[2];const u=d[3],v=0!==d[4];d=0!==d[5];const t=f[1];h.bindFramebuffer(h.READ_FRAMEBUFFER,f[0]);
h.bindFramebuffer(h.DRAW_FRAMEBUFFER,t);d?h.blitFramebuffer(0,0,g,l,0,0,m,u,h.COLOR_BUFFER_BIT,v?h.LINEAR:h.NEAREST):(f=Math.min(g,m),g=Math.min(l,u),m=Math.max(l-u,0),l=Math.max(u-l,0),h.blitFramebuffer(0,m,f,g+m,0,l,f,g+l,h.COLOR_BUFFER_BIT,h.NEAREST))}InitStartQuery(d){this._type=17;this._texParam=d}DoStartQuery(){this._texParam.BeginTimeElapsed();this._texParam=null}InitEndQuery(d){this._type=18;this._texParam=d}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(d,
f,h){this._type=19;const g=this._mat4param;g[0]=d;g[1]=f;g[2]=h}DoSetEllipseParams(){const d=this._batchState.currentShader,f=this._mat4param;d._uPixelSize.IsUsed()&&d._uPixelSize.Update2f(f[0],f[1]);d._uOutlineThickness.IsUsed()&&d._uOutlineThickness.Update1f(f[2])}InitSetTilemapInfo(d,f,h,g,l,m,u){this._type=15;const v=this._mat4param;d.writeToTypedArray(v,0);v[4]=1/f;v[5]=1/h;v[6]=g/f;v[7]=l/h;v[8]=m/f;v[9]=u/h}DoSetTilemapInfo(){const d=this._batchState.currentShader,f=this._mat4param;d._uSrcStart.IsUsed()&&
d._uSrcStart.Update2f(f[0],f[1]);d._uPixelSize.IsUsed()&&d._uPixelSize.Update2f(f[4],f[5]);d._uTileSize.IsUsed()&&d._uTileSize.Update2f(f[6],f[7]);d._uTileSpacing.IsUsed()&&d._uTileSpacing.Update2f(f[8],f[9])}InitClearDepth(d){this._type=21;this._startIndex=d?1:0}DoClearDepth(){const d=this._gl,f=0!==this._startIndex;f||d.depthMask(!0);d.clear(d.DEPTH_BUFFER_BIT);f||d.depthMask(!1)}InitSetDepthEnabled(d){this._type=22;this._startIndex=d?1:0}DoSetDepthEnabled(){const d=this._gl;0===this._startIndex?
(d.disable(d.DEPTH_TEST),d.depthMask(!1)):(d.enable(d.DEPTH_TEST),d.depthMask(!0))}InitSetDepthSamplingEnabled(d){this._type=23;this._startIndex=d?1:0}DoSetDepthSamplingEnabled(){const d=this._gl,f=this._batchState,h=f.renderer,g=0!==this._startIndex;f.isDepthSamplingEnabled=g;d.activeTexture(d.TEXTURE2);g?(f.currentFramebufferNoDepth&&d.bindFramebuffer(d.FRAMEBUFFER,f.currentFramebufferNoDepth),d.bindTexture(d.TEXTURE_2D,h._GetDepthBuffer())):(d.bindTexture(d.TEXTURE_2D,null),f.currentFramebufferNoDepth&&
d.bindFramebuffer(d.FRAMEBUFFER,f.currentFramebuffer));d.activeTexture(d.TEXTURE0)}InitCoplanarStartStencilPass(){this._type=24}DoCoplanarStartStencilPass(){const d=this._gl;d.clear(d.STENCIL_BUFFER_BIT);d.enable(d.STENCIL_TEST);d.stencilFunc(d.ALWAYS,1,1);d.stencilOp(d.KEEP,d.KEEP,d.REPLACE);d.colorMask(!1,!1,!1,!1)}InitCoplanarStartColorPass(){this._type=25}DoCoplanarStartColorPass(){const d=this._gl;d.colorMask(!0,!0,!0,!0);d.stencilFunc(d.EQUAL,1,1);d.stencilOp(d.KEEP,d.KEEP,d.KEEP)}InitCoplanarRestore(){this._type=
26}DoCoplanarRestore(){const d=this._gl;d.disable(d.STENCIL_TEST)}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.DoSetViewport();break;case 6:this.DoSetProjection();break;case 7:this.DoSetModelView();break;case 8:this.DoSetRenderTarget();break;case 9:this.DoClearSurface();break;case 10:this.DoPoints();break;case 11:this.DoSetProgram();break;case 12:this.DoSetProgramParameters();break;case 13:this.DoInvalidateFramebuffer();
break;case 14:this.DoSetPointTextureCoords();break;case 15:this.DoSetTilemapInfo();break;case 16:this.DoBlitFramebuffer();break;case 17:this.DoStartQuery();break;case 18:this.DoEndQuery();break;case 19:this.DoSetEllipseParams();break;case 20:this.DoSetGradientColor();break;case 21:this.DoClearDepth();break;case 22:this.DoSetDepthEnabled();break;case 23:this.DoSetDepthSamplingEnabled();break;case 24:this.DoCoplanarStartStencilPass();break;case 25:this.DoCoplanarStartColorPass();break;case 26:this.DoCoplanarRestore()}}}}
{"use strict";const e=self.C3,b={timeout:60},a=new e.Color(0,0,0,1),c=new Set(["left","center","right"]),d=new Set(["top","center","bottom"]),f=new Set(["word","character"]),h=new Set;e.FontManager&&e.FontManager.addEventListener("fontload",t=>{t=t.font.GetName();for(const q of h)(q.IsBBCodeEnabled()||e.equalsNoCase(q.GetFontName(),t))&&q._SetTextChanged()});function g(t,q,p,r,x,y){q?"Gecko"===e.Platform.BrowserEngine?t.strokeText(p,r,x,y):t.strokeText(p,r,x):"Gecko"===e.Platform.BrowserEngine?t.fillText(p,
r,x,y):t.fillText(p,r,x)}function l(t,q,p,r,x,y){q?t.strokeRect(p,r,x,y):t.fillRect(p,r,x,y)}function m(t){return 4/3*t}let u=!1,v=!1;e.Gfx.RendererText=class{constructor(t,q){q=Object.assign({},b,q);this._renderer=t;this._fontName="Arial";this._fontSize=16;this._fontSizeScale=1;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=e.New(e.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._measureContextTop=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=(p,r)=>this._MeasureText(p,r);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new e.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new e.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},q.timeout);this.ontextureupdate=null;this._wasReleased=!1;h.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._measureTextCallback=this._measureContextTop=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;h.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=!0}SetIsAsync(t){this._isAsync=!!t}IsAsync(){return this._isAsync}SetBBCodeEnabled(t){t=!!t;this._isBBcodeEnabled!==t&&(t=(this._isBBcodeEnabled=t)?"alphabetic":
"top",this._textContext&&(this._textContext.textBaseline=t),this._measureContext&&(this._measureContext.textBaseline=t),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(t){t||(t="serif");this._fontName!==t&&(this._fontName=t,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(t){.1>t&&(t=.1);this._fontSize!==t&&(this._fontSize=t,this._SetTextChanged())}SetFontSizeScale(t){this._fontSizeScale!==t&&(this._fontSizeScale=t,this._SetTextChanged())}SetLineHeight(t){this._lineHeight!==
t&&(this._lineHeight=t,this._SetChanged())}SetBold(t){t=!!t;this._isBold!==t&&(this._isBold=t,this._SetTextChanged())}SetItalic(t){t=!!t;this._isItalic!==t&&(this._isItalic=t,this._SetTextChanged())}SetDrawMaxCharacterCount(t){t=Math.floor(t);this._drawMaxCharCount!==t&&(this._drawMaxCharCount=t,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(t,q){for(let p=t.length-1;0<=p;--p){const r=t[p];if(r.tag===q)return r}return null}_HasStyleTag(t,q){return!!this._GetStyleTag(t,
q)}_GetFontString(t,q){let p=[];(this._isBold||this._HasStyleTag(q,"b"))&&p.push("bold");(this._isItalic||this._HasStyleTag(q,"i"))&&p.push("italic");var r=this._GetStyleTag(q,"size");r=(r?parseFloat(r.param):this._fontSize)*this._fontSizeScale;t?p.push(r+"pt"):p.push(r*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");t=this._fontName;(q=this._GetStyleTag(q,"font"))&&q.param&&(t=q.param,this.onloadfont&&!this._alreadyLoadedFonts.has(t)&&(this.onloadfont(t),this._alreadyLoadedFonts.add(t)));
t&&p.push('"'+t+'"');return p.join(" ")}SetColor(t){t instanceof e.Color&&(t=t.getCssRgb());this._colorStr!==t&&(this._colorStr=t,this._SetChanged())}SetColorRgb(t,q,p){a.setRgb(t,q,p);this.SetColor(a)}SetHorizontalAlignment(t){if(!c.has(t))throw Error("invalid horizontal alignment");this._horizontalAlign!==t&&(this._horizontalAlign=t,this._SetChanged())}SetVerticalAlignment(t){if(!d.has(t))throw Error("invalid vertical alignment");this._verticalAlign!==t&&(this._verticalAlign=t,this._SetChanged())}SetWordWrapMode(t){if(!f.has(t))throw Error("invalid word wrap mode");
this._wrapMode!==t&&(this._wrapMode=t,this._SetTextChanged())}SetText(t){this._text!==t&&(this._text=t,this._SetTextChanged())}SetSize(t,q,p){"undefined"===typeof p&&(p=1);if(!(0>=t||0>=t||this._cssWidth===t&&this._cssHeight===q&&this._zoom===p)){1===this._zoom!==(1===p)&&(this._needToRecreateTexture=!0);var r=this._cssWidth,x=this._zoom;this._cssWidth=t;this._cssHeight=q;this._zoom=p;t=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*t;this._height=this._cssHeight*this._zoom*t;t=Math.max(this._width,
this._height);q=Math.min(this._renderer.GetMaxTextureSize(),2048);p=1;t>q&&(p=q/t,this._width=Math.min(this._width*p,q),this._height=Math.min(this._height*p,q));this._scaleFactor=p;0<this._textureWidth&&0<this._textureHeight&&this._zoom===x&&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?e.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(t,q){this._textCanvas||(this._textCanvas=e.CreateCanvas(16,16));let p=!1;if(this._lastCanvasWidth!==t||this._lastCanvasHeight!==q)this._lastCanvasWidth=t,this._lastCanvasHeight=q,this._textCanvas.width=t,this._textCanvas.height=q,p=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),p=!0);p?(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,t,q)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=e.CreateCanvas(16,16).getContext("2d"),this._measureContextTop=e.CreateCanvas(16,16).getContext("2d"),
this._measureContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._measureContextTop.textBaseline="top")}_SetMeasureFontString(t){this._lastMeasureCanvasFont!==t&&(this._lastMeasureCanvasFont=t,this._measureContext.font=t,this._measureContextTop.font=t)}_SupportsFontBoundingBoxMeasurements(){if(!u){u=!0;this._MaybeCreateMeasureContext();const t=this._measureContext.measureText("test");v="number"===typeof t.fontBoundingBoxAscent&&"number"===typeof t.fontBoundingBoxDescent}return v}_MaybeWrapText(){this._textChanged&&
(this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||this._bbString&&this._bbString.toString()===this._text||(this._bbString=new e.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(t,q){this._SetMeasureFontString(this._GetFontString(!0,q));q=this._GetStyleTag(q,"size");q=(q?parseFloat(q.param):this._fontSize)*this._fontSizeScale;
const p=this._measureContext.measureText(t);let r=0;this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements()&&(t=this._measureContextTop.measureText(t),r=p.fontBoundingBoxAscent-t.fontBoundingBoxAscent);return{width:p.width,height:m(q),fontBoundingBoxAscent:p.fontBoundingBoxAscent||0,fontBoundingBoxDescent:p.fontBoundingBoxDescent||0,topToAlphabeticDistance:r}}_SetDrawFontString(t){this._lastTextCanvasFont!==t&&(this._lastTextCanvasFont=t,this._textContext.font=t)}_SetDrawCanvasColor(t){this._lastTextCanvasFillStyle!==
t&&(this._lastTextCanvasFillStyle=t,this._textContext.fillStyle=t,this._textContext.strokeStyle=t)}_SetDrawCanvasOpacity(t){this._lastTextCanvasOpacity!==t&&(this._lastTextCanvasOpacity=t,this._textContext.globalAlpha=t)}_SetDrawCanvasLineWith(t){this._lastTextCanvasLineWidth!==t&&(this._lastTextCanvasLineWidth=t,this._textContext.lineWidth=t)}_DrawTextToCanvas(){this._drawCharCount=0;const t=this._scaleFactor*this._zoom*self.devicePixelRatio,q=(4+this._lineHeight)*t;var p=0;const r=this._wrappedText.GetLines();
if(0!==r.length){var x=this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements(),y=r[0].height*t;"center"===this._verticalAlign?(p=r.reduce((C,G)=>C+G.height*t+q,0)-q,p=Math.max(this._height/2-p/2,0),x&&(y=r[0].topToAlphabeticDistance*t)):"bottom"===this._verticalAlign&&(p=r.reduce((C,G)=>C+G.height*t+q,0)-this._lineHeight*t,x=x?r.at(-1).fontBoundingBoxDescent*t:0,p=this._height-p-x-2);for(let C=0,G=r.length;C<G;++C){x=r[C];const A=x.height*t,E=p;if(this._isBBcodeEnabled){if(p+=0===C?y:A,
0<C&&p>this._height-4*t)break}else if(0<C&&p>=this._height-A)break;0<=E&&this._DrawTextLine(x,p,t);this._isBBcodeEnabled||(p+=A);p+=q}}}_DrawTextLine(t,q,p){let r=0;"center"===this._horizontalAlign?r=(this._width-t.width*p)/2:"right"===this._horizontalAlign&&(r=this._width-t.width*p);for(const x of t.fragments)this._DrawTextFragment(x,r,q,p,t.height),r+=x.width*p}_DrawTextFragment(t,q,p,r,x){const y=this._textContext,C=x/16;x=t.width*r;const G=t.height*r,A=t.height/16;var E=(4+this._lineHeight)*r,
J=t.styles;t=t.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+t.length>this._drawMaxCharCount&&(t=t.substr(0,this._drawMaxCharCount-this._drawCharCount),x=this._MeasureText(t,J).width*r);this._drawCharCount+=t.length}var B=this._GetStyleTag(J,"background");const I=this._HasStyleTag(J,"u"),L=this._HasStyleTag(J,"s");if((!e.IsStringAllWhitespace(t)||B||I||L)&&!this._HasStyleTag(J,"hide")){var P=this._GetStyleTag(J,"offsetx");q+=P?parseFloat(P.param)*
r:0;P=this._GetStyleTag(J,"offsety");p+=P?parseFloat(P.param)*r:0;B&&(this._SetDrawCanvasColor(B.param),y.fillRect(q,p-G,x,G+E));E=this._GetStyleTag(J,"color");this._SetDrawCanvasColor(E?E.param:this._colorStr);B=this._GetStyleTag(J,"opacity");this._SetDrawCanvasOpacity(B?parseFloat(B.param)/100:1);B=(B=this._GetStyleTag(J,"linethickness"))?parseFloat(B.param):1;(P=this._HasStyleTag(J,"stroke"))&&this._SetDrawCanvasLineWith(.5*A*B*this._scaleFactor*this._zoom*self.devicePixelRatio);this._SetDrawFontString(this._GetFontString(!1,
J));g(y,P,t,q,p,x);!P&&(this._SetDrawCanvasLineWith(.5*A*B*this._scaleFactor*this._zoom*self.devicePixelRatio),J=this._GetStyleTag(J,"outline"))&&(this._SetDrawCanvasColor(J.param),g(y,!0,t,q,p,x));this._SetDrawCanvasColor(E?E.param:this._colorStr);I&&l(y,P,q,p+r*C,x,r*C*B);L&&(r*=A,y.fillRect(q,p-G/4+r/2-r*B/2,x,r*B))}}_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 t of h)t.ReleaseTexture()}static GetAll(){return h.values()}}}
{"use strict";const e=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 c=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);a&&!c&&(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||
c)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}e.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();e.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.at(-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=e.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,c)=>a+c.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}}
{"use strict";const e=self.C3;e.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();e.clearArray(this._buffer)}AddTimeElapsedQuery(){const b=new e.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 c=0;for(const d of this._buffer){if(d.GetFrameNumber()>=a)break;if(!(d.GetFrameNumber()<b))if(d.HasResult())c+=d.GetResult();else return NaN}return c}DeleteAllBeforeFrameNumber(b){for(let a=0,c=this._buffer.length;a<c;++a){const d=this._buffer[a];if(d.GetFrameNumber()<b)d.Release();else{0<a&&this._buffer.splice(0,a);break}}}}}
{"use strict";const e=self.C3,b=self.glMatrix,a=b.vec4,c=b.mat4,d={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,depth:!1,canSampleDepth:!1,maxWebGLVersion:2,failIfMajorPerformanceCaveat:!1},f=new Set(["default","low-power","high-performance"]),h=new e.Quad(0,0,1,0,1,1,0,1),g=c.create(),l=c.create(),m=new e.Quad,u=new e.Rect;let v=null;e.isDebug&&(self.debug_lose_context=function(){v?v.loseContext():console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=
function(){v?v.restoreContext():console.warn("WEBGL_lose_context not supported")});const t=new Set;let q=-1;function p(){q=-1;for(const r of t)r.checkFunc()&&(r.resolve(),t.delete(r));0<t.size&&(q=self.requestAnimationFrame(p))}e.Gfx.WebGLRenderer=class extends e.Gfx.RendererBase{constructor(r,x){super();x=Object.assign({},d,x);if(!f.has(x.powerPreference))throw Error("invalid power preference");const y={alpha:!!x.alpha,depth:!1,antialias:!1,powerPreference:x.powerPreference,failIfMajorPerformanceCaveat:!!x.failIfMajorPerformanceCaveat};
x.lowLatency&&(y.desynchronized=!0,y.preserveDrawingBuffer=!0);let C=null,G=0;2<=x.maxWebGLVersion&&(C=r.getContext("webgl2",y),G=2);C||(C=r.getContext("webgl",y),G=1);if(!C)throw Error("failed to initialise WebGL context");this._gl=C;this._attribs=C.getContextAttributes();x.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=C.getParameter(C.VERSION);this._version=G;this._viewport=a.create();this._didChangeTransform=
!1;this._bbProjectionMatrix=c.create();this._usesDepthBuffer=!!x.depth;this._canSampleDepth=!(!x.depth||!x.canSampleDepth);this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=!1;this._depthBuffer=null;this._isAutoSizeDepthBuffer=!0;this._depthBufferHeight=this._depthBufferWidth=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._spDeviceTransformTextureFill=this._lastProgram=null;this._batch=[];this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=null;this._lastPointZ=0;this._batchState=e.New(e.Gfx.BatchState,this);this._lastColor=e.New(e.Color,1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._lastDestBlend=this._lastSrcBlend=0;this._lastPointTexCoords=new e.Rect;this._maxTextureSize=
-1;this._highpPrecision=this._maxPointSize=this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._isInitialisingAfterContextRestored=!1;this._depthTextureExt=this._anisotropicExt=this._parallelShaderCompileExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled=!!x.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return!0}async InitState(){super.InitState();
var r=this._gl,x=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*x-4*x;e.clearArray(this._batch);this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;x=this._batchState;x.currentShader=null;x.currentFramebuffer=null;x.currentFramebufferNoDepth=null;a.set(x.currentColor,1,1,1,1);x.clearColor.setRgba(0,
0,0,0);x.pointTexCoords.set(0,0,1,1);r.clearColor(0,0,0,0);r.clear(r.COLOR_BUFFER_BIT);r.enable(r.BLEND);r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=r.ONE;this._lastDestBlend=r.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(r);r.disable(r.CULL_FACE);r.disable(r.STENCIL_TEST);r.disable(r.DITHER);this._usesDepthBuffer?(r.enable(r.DEPTH_TEST),r.depthMask(!0),r.depthFunc(r.LEQUAL)):(r.disable(r.DEPTH_TEST),r.depthMask(!1));this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=
!1;this._pointBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer);r.bufferData(r.ARRAY_BUFFER,this._pointData.byteLength,r.DYNAMIC_DRAW);this._vertexBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer);r.bufferData(r.ARRAY_BUFFER,this._vertexData.byteLength,r.DYNAMIC_DRAW);this._texcoordBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer);r.bufferData(r.ARRAY_BUFFER,this._texcoordData.byteLength,r.DYNAMIC_DRAW);this._indexBuffer=r.createBuffer();
r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this._indexBuffer);r.bufferData(r.ELEMENT_ARRAY_BUFFER,this._indexData,r.STATIC_DRAW);r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,null);this._maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE);x=r.getParameter(r.ALIASED_POINT_SIZE_RANGE);this._minPointSize=x[0];this._maxPointSize=x[1];x=r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT);const y=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);this._highpPrecision=x&&y?Math.min(x.precision,
y.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=r.getSupportedExtensions();if(x=r.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor=r.getParameter(x.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=r.getParameter(x.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=r.getExtension("KHR_parallel_shader_compile");e.isDebug&&(v=r.getExtension("WEBGL_lose_context"));if(this._isGpuProfilingEnabled)if(1===this.GetWebGLVersionNumber()){if("Chromium"!==e.Platform.BrowserEngine||
81<=e.Platform.BrowserVersionNumber||"undefined"!==typeof document)this._timerExt=r.getExtension("EXT_disjoint_timer_query")}else this._timerExt=r.getExtension("EXT_disjoint_timer_query_webgl2")||r.getExtension("EXT_disjoint_timer_query");this._maxAnisotropy=(this._anisotropicExt=r.getExtension("EXT_texture_filter_anisotropic"))?r.getParameter(this._anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;if(2>this.GetWebGLVersionNumber()&&this._usesDepthBuffer&&this._canSampleDepth&&(this._depthTextureExt=
r.getExtension("WEBGL_depth_texture"),!this._depthTextureExt))throw Error("no depth texture support");r=e.Gfx.WebGLShaderProgram;x=r.GetDefaultVertexShaderSource(!1);r=[[r.GetTextureFillFragmentShaderSource(),x,"<default>"],[r.GetTextureFillFragmentShaderSource(),x,"<default-device-transform>"],[r.GetPointFragmentShaderSource(this._version),r.GetPointVertexShaderSource(this._version),"<point>"],[r.GetColorFillFragmentShaderSource(),x,"<fill>"],[r.GetLinearGradientFillFragmentShaderSource(),x,"<lineargradient>"],
[r.GetHardEllipseFillFragmentShaderSource(),x,"<hardellipse>"],[r.GetHardEllipseOutlineFragmentShaderSource(),x,"<hardellipseoutline>"],[r.GetSmoothEllipseFillFragmentShaderSource(),x,"<smoothellipse>"],[r.GetSmoothEllipseOutlineFragmentShaderSource(),x,"<smoothellipseoutline>"],[r.GetSmoothLineFillFragmentShaderSource(),x,"<smoothline>"],[r.GetTilemapFragmentShaderSource(),r.GetDefaultVertexShaderSource(!0),"<tilemap>"]];r=await Promise.all(r.map(C=>this.CreateShaderProgram({src:C[0]},C[1],C[2])));
this._spTextureFill=r[0];this._spDeviceTransformTextureFill=r[1];this._spPoints=r[2];this._spColorFill=r[3];this._spLinearGradientFill=r[4];this._spHardEllipseFill=r[5];this._spHardEllipseOutline=r[6];this._spSmoothEllipseFill=r[7];this._spSmoothEllipseOutline=r[8];this._spSmoothLineFill=r[9];this._spTilemapFill=r[10];this.SetTextureFillMode()}async CreateShaderProgram(r,x,y){r=await e.Gfx.WebGLShaderProgram.Create(this,r,x,y);this._AddShaderProgram(r);return r}ResetLastProgram(){this._lastProgram=
null}SetSize(r,x,y){if(this._width!==r||this._height!==x||y){this.EndBatch();y=this._gl;var C=this._batchState;this._width=r;this._height=x;this._SetViewport(0,0,r,x);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,r/x);this.SetProjectionMatrix(this._bbProjectionMatrix);this._spDeviceTransformTextureFill&&(y.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,
this._batchState.currentShader=this._spDeviceTransformTextureFill);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE1);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE0);this._lastTexture1=this._lastTexture0=null;this._usesDepthBuffer&&this._isAutoSizeDepthBuffer&&this._SetDepthBufferSize(this._width,this._height);this._currentRenderTarget&&this._currentRenderTarget._Resize(this._width,this._height);y.bindFramebuffer(y.FRAMEBUFFER,null);this._currentRenderTarget=null;C.currentFramebuffer=
null;C.currentFramebufferNoDepth=null}}_SetDepthBufferSize(r,x){const y=this._gl;this._depthBuffer&&this._depthBufferWidth===r&&this._depthBufferHeight===x||(this._canSampleDepth?(this._depthBuffer&&y.deleteTexture(this._depthBuffer),this._depthBuffer=y.createTexture(),y.bindTexture(y.TEXTURE_2D,this._depthBuffer),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),
y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),2<=this.GetWebGLVersionNumber()?y.texImage2D(y.TEXTURE_2D,0,y.DEPTH24_STENCIL8,r,x,0,y.DEPTH_STENCIL,y.UNSIGNED_INT_24_8,null):this._depthTextureExt&&y.texImage2D(y.TEXTURE_2D,0,y.DEPTH_STENCIL,r,x,0,y.DEPTH_STENCIL,this._depthTextureExt.UNSIGNED_INT_24_8_WEBGL,null),y.bindTexture(y.TEXTURE_2D,null)):(this._depthBuffer&&y.deleteRenderbuffer(this._depthBuffer),this._depthBuffer=y.createRenderbuffer(),y.bindRenderbuffer(y.RENDERBUFFER,this._depthBuffer),
y.renderbufferStorage(y.RENDERBUFFER,2<=this._version?y.DEPTH24_STENCIL8:y.DEPTH_STENCIL,r,x),y.bindRenderbuffer(y.RENDERBUFFER,null)),this._depthBufferWidth=r,this._depthBufferHeight=x)}SetFixedSizeDepthBuffer(r,x){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!1,this._SetDepthBufferSize(r,x))}SetAutoSizeDepthBuffer(){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!0,this._SetDepthBufferSize(this._width,this._height))}_SetViewport(r,x,y,C){const G=this._viewport;if(G[0]!==r||G[1]!==x||
G[2]!==y||G[3]!==C)this.PushBatch().InitSetViewport(r,x,y,C),a.set(G,r,x,y,C),this._topOfBatch=0}SetProjectionMatrix(r){c.exactEquals(this._matP,r)||(this.PushBatch().InitSetProjection(r),c.copy(this._matP,r),this._topOfBatch=0,this._didChangeTransform=!0)}SetDefaultRenderTargetProjectionState(){let r,x;var y=this._currentRenderTarget;null===y?(r=this._bbProjectionMatrix,x=this.GetWidth(),y=this.GetHeight()):(r=y.GetProjectionMatrix(),x=y.GetWidth(),y=y.GetHeight());this.SetProjectionMatrix(r);this._SetViewport(0,
0,x,y)}SetModelViewMatrix(r){c.exactEquals(this._matMV,r)||(this.PushBatch().InitSetModelView(r),c.copy(this._matMV,r),this._topOfBatch=0,this._didChangeTransform=!0)}ResetDidChangeTransformFlag(){this._didChangeTransform=!1}DidChangeTransform(){return this._didChangeTransform}GetBatchState(){return this._batchState}PushBatch(){const r=this._batch;this._batchPtr===r.length&&r.push(new e.Gfx.WebGLBatchJob(this._batchState));return r[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 r=this._gl;0<this._pointPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr)));0<this._vertexPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr)),r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer),r.bufferSubData(r.ARRAY_BUFFER,
0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const r=this._batch;for(let x=0,y=this._batchPtr;x<y;++x)r[x].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(r,x,y,C){const G=this._lastColor;G.equalsRgba(r,x,y,C)||(G.setRgba(r,x,y,C),this.PushBatch().InitSetColor(G),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(r){const x=this._lastColor;x.getA()!==r&&(x.setA(r),this.PushBatch().InitSetColor(x),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(r){const x=
this._lastColor;x.equals(r)||(x.set(r),this.PushBatch().InitSetColor(x),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(r){r!==this._lastTexture0&&(this.PushBatch().InitSetTexture(r),this._lastTexture0=r,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(r){r=this._GetBlendByIndex(r);this._SetBlend(r[0],r[1])}SetNamedBlendMode(r){r=this.GetNamedBlend(r);this._SetBlend(r.srcBlend,r.destBlend)}_SetBlend(r,
x){if(r!==this._lastSrcBlend||x!==this._lastDestBlend)this.PushBatch().InitSetBlend(r,x),this._lastSrcBlend=r,this._lastDestBlend=x,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(r){this.Rect2(r.getLeft(),r.getTop(),r.getRight(),r.getBottom())}Rect2(r,x,y,C){this.Quad2(r,x,y,x,y,C,r,C)}_ExtendQuadBatch(){let r=this._vertexPtr;r>=this._lastVertexPtr&&(this.EndBatch(),r=0);1===this._topOfBatch?this._batch[this._batchPtr-1]._indexCount+=6:(this.PushBatch().InitQuad(r,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(r){r.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(r){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);
h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(r,x,y,C,G,A,E,J){this._ExtendQuadBatch();const B=this._vertexData;let I=this._vertexPtr;const L=this._baseZ+this._currentZ;B[I++]=r;B[I++]=x;B[I++]=L;B[I++]=y;B[I++]=C;B[I++]=L;B[I++]=G;B[I++]=A;B[I++]=L;B[I++]=E;B[I++]=J;B[I++]=L;this._vertexPtr=I;h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(r,x){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);x.writeAsQuadToTypedArray(this._texcoordData,
this._texPtr);this._texPtr+=8}Quad4(r,x){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);x.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(r,x,y,C,G,A,E,J,B,I,L,P,S){this._ExtendQuadBatch();const U=this._vertexData;let V=this._vertexPtr;const Z=this._baseZ+this._currentZ;U[V++]=r;U[V++]=x;U[V++]=Z+y;U[V++]=C;U[V++]=G;U[V++]=Z+A;U[V++]=E;U[V++]=J;U[V++]=Z+B;U[V++]=I;U[V++]=L;U[V++]=Z+P;this._vertexPtr=V;S.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=
8}Quad3D2(r,x,y,C,G,A,E,J,B,I,L,P,S){this._ExtendQuadBatch();const U=this._vertexData;let V=this._vertexPtr;const Z=this._baseZ+this._currentZ;U[V++]=r;U[V++]=x;U[V++]=Z+y;U[V++]=C;U[V++]=G;U[V++]=Z+A;U[V++]=E;U[V++]=J;U[V++]=Z+B;U[V++]=I;U[V++]=L;U[V++]=Z+P;this._vertexPtr=V;S.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(r,x){c.copy(g,this._matP);c.copy(l,this._matMV);this.SetDefaultRenderTargetProjectionState();const [y,C]=this.GetRenderTargetSize(this._currentRenderTarget);
var G=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0,C);this.SetModelViewMatrix(G);if("crop"===r&&this._currentRenderTarget&&x){r=this._width/2;G=this._height/2;const J=x.GetWidth();x=x.GetHeight();var A=this._currentRenderTarget.GetWidth(),E=this._currentRenderTarget.GetHeight();A=Math.min(A,J);const B=Math.min(E,x),I=Math.max(x-E,0);E=Math.max(E-x,0);u.set(-r,G-E,-r+A,G-B-E);m.setFromRect(u);u.set(0,I,A,B+I);u.divide(J,x);this.Quad3(m,u)}else r=y/2,G=C/2,
this.Rect2(-r,G,r,-G);this.SetProjectionMatrix(g);this.SetModelViewMatrix(l)}StartRenderingPoints(r){this._lastPointTexCoords.equals(r)||(this._lastPointTexCoords.copy(r),this.PushBatch().InitSetPointTexCoords(r),this._topOfBatch=0)}FinishRenderingPoints(){}Point(r,x,y,C){7996<=this._pointPtr&&this.EndBatch();let G=this._pointPtr;var A=this._baseZ+this._currentZ;2===this._topOfBatch&&this._lastPointZ===A?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(G,A),this._topOfBatch=
2,this._lastPointZ=A);A=this._pointData;A[G++]=r;A[G++]=x;A[G++]=y;A[G++]=C;this._pointPtr=G}SetProgram(r){this._lastProgram!==r&&(this.PushBatch().InitSetProgram(r),this._lastProgram=r,this._topOfBatch=0,this._currentStateGroup=null)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(r){this.PushBatch().InitSetGradientColor(r);this._topOfBatch=0}SetEllipseParams(r,x,y=1){this.PushBatch().InitSetEllipseParams(r,x,y);this._topOfBatch=0}SetTilemapInfo(r,
x,y,C,G,A,E){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(r,x,y,C,G,A,E);this._topOfBatch=0}SetProgramParameters(r,x,y,C,G,A,E,J,B,I,L,P){const S=this._lastProgram;var U=S._hasAnyOptionalUniforms;const V=!!P.length;if(U&&!S.AreOptionalUniformsAlreadySetInBatch(x,y,C,G,A,E,J,B,I,L)||V&&!S.AreCustomParametersAlreadySetInBatch(P)){var Z=this.PushBatch();Z.InitSetProgramParameters();U&&(S.SetOptionalUniformsInBatch(x,y,
C,G,A,E,J,B,I,L),U=Z._mat4param,U[0]=A,U[1]=E,x.writeToTypedArray(U,2),U[6]=B,U[7]=I,y.writeToTypedArray(U,12),x=Z._colorParam,G.writeToTypedArray(x,0),G=x[1],x[1]=x[3],x[3]=G,C.writeToTypedArray(Z._srcOriginRect,0),Z._startIndex=L,Z._indexCount=J,S._uSamplerBack.IsUsed()?Z._texParam=r?r.GetTexture():null:Z._texParam=null);V&&(S.SetCustomParametersInBatch(P),e.shallowAssignArray(Z._shaderParams,P));this._topOfBatch=0}}ClearRgba(r,x,y,C){this.PushBatch().InitClearSurface2(r,x,y,C);this._topOfBatch=
0}Clear(r){this.PushBatch().InitClearSurface(r);this._topOfBatch=0}Start(){}Finish(){super.Finish();this._gl.flush()}ClearDepth(){this._usesDepthBuffer&&this._currentRenderTarget&&this._currentRenderTarget.HasDepthBuffer()&&(this.PushBatch().InitClearDepth(this._isDepthEnabled),this._topOfBatch=0)}SetDepthEnabled(r){r=!!r;this._isDepthEnabled!==r&&this._usesDepthBuffer&&(this._isDepthEnabled=r,this.PushBatch().InitSetDepthEnabled(r),this._topOfBatch=0)}IsDepthEnabled(){return this._isDepthEnabled}_GetDepthBuffer(){return this._depthBuffer}_CanSampleDepth(){return this._canSampleDepth}SetDepthSamplingEnabled(r){r=
!!r;if(this._canSampleDepth&&this._isDepthSamplingEnabled!==r){if(r&&this.IsDepthEnabled())throw Error("depth still enabled");this._isDepthSamplingEnabled=r;this.PushBatch().InitSetDepthSamplingEnabled(r);this._topOfBatch=0}}CheckForQueryResults(){for(const r of this._allQueryResultBuffers)r.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();e.Gfx.WebGLRendererTexture.OnContextLost();
e.Gfx.WebGLRenderTarget.OnContextLost();e.Gfx.RendererText.OnContextLost();for(const r of this._allQueryResultBuffers)r.Clear();this._extensions=[];this._depthTextureExt=this._anisotropicExt=this._parallelShaderCompileExt=this._timerExt=null;this._maxAnisotropy=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._depthBuffer=this._spDeviceTransformTextureFill=this._lastProgram=null;for(const r of this._stateGroups.values())r.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored=
!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const r of this._stateGroups.values())r.OnContextRestored(this);this.SetSize(this._width,this._height,!0)}CreateStaticTexture(r,x){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const y=e.New(e.Gfx.WebGLRendererTexture,this);y._CreateStatic(r,x);return y}CreateStaticTextureAsync(r,x){if(this.IsContextLost())return Promise.reject("context lost");x=Object.assign({},x);const y=x.wrapX&&"clamp-to-edge"!==x.wrapX||
x.wrapY&&"clamp-to-edge"!==x.wrapY;if(!e.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&y)return e.Supports.ImageBitmap?createImageBitmap(r).then(C=>e.Asyncify(()=>this.CreateStaticTexture(C,x))):r instanceof Blob?e.BlobToImage(r,!0).then(C=>this.CreateStaticTextureAsync(C,x)):"undefined"!==typeof HTMLImageElement&&r instanceof HTMLImageElement&&"function"===typeof r.decode?r.decode().then(()=>e.Asyncify(()=>this.CreateStaticTexture(r,x))):e.Asyncify(()=>this.CreateStaticTexture(r,x));
x.premultiplyAlpha=!1;return createImageBitmap(r,{premultiplyAlpha:"premultiply"}).then(C=>e.Asyncify(()=>this.CreateStaticTexture(C,x)))}CreateDynamicTexture(r,x,y){this.EndBatch();const C=e.New(e.Gfx.WebGLRendererTexture,this);C._CreateDynamic(r,x,y);return C}UpdateTexture(r,x,y){this.EndBatch();x._Update(r,y)}DeleteTexture(r){r&&(r.SubtractReference(),0<r.GetReferenceCount()||(this.EndBatch(),r===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),r===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),r._Delete()))}CreateRenderTarget(r){let x=this._width,y=this._height,C=!0;r&&("number"===typeof r.width&&(x=r.width,C=!1),"number"===typeof r.height&&(y=r.height,C=!1));if(0>=x||0>=y)throw Error("invalid size");this.EndBatch();const G=e.New(e.Gfx.WebGLRenderTarget,this);G._Create(x,y,Object.assign({isDefaultSize:C},r));this._currentRenderTarget=
null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;return G}SetRenderTarget(r,x=!0){r!==this._currentRenderTarget&&(r&&r.IsDefaultSize()&&r._Resize(this._width,this._height),this.PushBatch().InitSetRenderTarget(r),this._currentRenderTarget=r,this._topOfBatch=0,x&&this.SetDefaultRenderTargetProjectionState())}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(r){return r?[r.GetWidth(),r.GetHeight()]:[this._width,this._height]}CopyRenderTarget(r,
x="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(r,x)):(this.PushBatch().InitBlitFramebuffer(r,this._currentRenderTarget,x),this._topOfBatch=0)}DrawRenderTarget(r,x="stretch"){r=r.GetTexture();if(!r)throw Error("not a texture-backed render target");this.SetTexture(r);this.FullscreenQuad(x,r)}InvalidateRenderTarget(r){2>this._version||(this.PushBatch().InitInvalidateFramebuffer(r._GetFramebuffer()),
this._topOfBatch=0)}DeleteRenderTarget(r){this.SetRenderTarget(null);this.EndBatch();const x=r.GetTexture();x===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);x===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);r._Delete()}async ReadBackRenderTargetToImageData(r,x,y){this.EndBatch();const C=this._currentRenderTarget;if(r){var G=
r.GetWidth();var A=r.GetHeight();var E=r._GetFramebuffer()}else G=this.GetWidth(),A=this.GetHeight(),E=null;let J=r=0;var B=G,I=A;y&&(r=e.clamp(Math.floor(y.getLeft()),0,G-1),J=e.clamp(Math.floor(y.getTop()),0,A-1),B=y.width(),B=0===B?G-r:e.clamp(Math.floor(B),0,G-r),I=y.height(),I=0===I?A-J:e.clamp(Math.floor(I),0,A-J),J=A-(J+I));const L=this._gl;L.bindFramebuffer(L.FRAMEBUFFER,E);A=()=>{L.bindFramebuffer(L.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;
this._batchState.currentFramebufferNoDepth=null;this.SetRenderTarget(C)};if(!x&&2<=this.GetWebGLVersionNumber()){L.bindFramebuffer(L.READ_FRAMEBUFFER,E);E=L.createBuffer();y=B*I*4;G=L.PIXEL_PACK_BUFFER;L.bindBuffer(G,E);L.bufferData(G,y,L.STREAM_READ);L.readPixels(r,J,B,I,L.RGBA,L.UNSIGNED_BYTE,0);L.bindFramebuffer(L.READ_FRAMEBUFFER,null);L.bindBuffer(G,null);A();const P=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>L.getSyncParameter(P,L.SYNC_STATUS)===L.SIGNALED);
L.deleteSync(P);x=new ImageData(B,I);L.bindBuffer(G,E);L.getBufferSubData(G,0,new Uint8Array(x.data.buffer),0,y);L.bindBuffer(G,null);L.deleteBuffer(E)}else x=new ImageData(B,I),L.readPixels(r,J,B,I,L.RGBA,L.UNSIGNED_BYTE,new Uint8Array(x.data.buffer)),A();return x}CoplanarStartStencilPass(){this.SetDepthEnabled(!0);this.PushBatch().InitCoplanarStartStencilPass();this._topOfBatch=0}CoplanarStartColorPass(){this.SetDepthEnabled(!1);this.PushBatch().InitCoplanarStartColorPass();this._topOfBatch=0}CoplanarRestoreStandardRendering(){this.SetDepthEnabled(!0);
this.PushBatch().InitCoplanarRestore();this._topOfBatch=0}StartQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitStartQuery(r),this._topOfBatch=0)}EndQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(r),this._topOfBatch=0)}_WaitForObjectReady(r){const x=new Promise(y=>t.add({resolve:y,checkFunc:r}));-1===q&&(q=self.requestAnimationFrame(p));return x}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*
(this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let r=0;for(const x of e.Gfx.WebGLRenderTarget.allRenderTargets())x.GetTexture()||(r+=x.GetEstimatedMemoryUsage());return r}GetEstimatedTextureMemoryUsage(){let r=0;for(const x of e.Gfx.WebGLRendererTexture.allTextures())r+=x.GetEstimatedMemoryUsage();return r}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}GetDisplayName(){return"webgl"+
this.GetWebGLVersionNumber()}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}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_GetAnisotropicExtension(){return this._anisotropicExt}_GetMaxAnisotropy(){return this._maxAnisotropy}_AddQueryResultBuffer(r){this._allQueryResultBuffers.add(r)}_RemoveQueryResultBuffer(r){this._allQueryResultBuffers.delete(r)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(r){this._InitBlendModeData([["normal",
r.ONE,r.ONE_MINUS_SRC_ALPHA],["additive",r.ONE,r.ONE],["xor",r.ONE,r.ONE_MINUS_SRC_ALPHA],["copy",r.ONE,r.ZERO],["destination-over",r.ONE_MINUS_DST_ALPHA,r.ONE],["source-in",r.DST_ALPHA,r.ZERO],["destination-in",r.ZERO,r.SRC_ALPHA],["source-out",r.ONE_MINUS_DST_ALPHA,r.ZERO],["destination-out",r.ZERO,r.ONE_MINUS_SRC_ALPHA],["source-atop",r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],["destination-atop",r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA]])}CreateRendererText(){return e.New(e.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}}
{"use strict";const e={getDrawSize:null,getRenderTarget:null,releaseRenderTarget:null,getTime:null,redraw:null};self.C3.Gfx.EffectChainManager=class{constructor(b){b=Object.assign({},e,b);this._cbGetDrawSize=b.getDrawSize;this._cbGetRenderTarget=b.getRenderTarget;this._cbReleaseRenderTarget=b.releaseRenderTarget;this._cbGetTime=b.getTime;this._cbRedraw=b.redraw}GetDrawSize(b){return this._cbGetDrawSize?this._cbGetDrawSize(b):[b.GetWidth(),b.GetHeight()]}GetRenderTarget(b){return this._cbGetRenderTarget(b)}ReleaseRenderTarget(b,
a){this._cbReleaseRenderTarget(b,a)}GetTime(){return this._cbGetTime()}Redraw(b){this._cbRedraw(b)}}}
{"use strict";const e=self.C3,b=self.glMatrix.mat4,a=e.New(e.Rect),c=e.New(e.Rect),d=e.New(e.Rect),f=e.New(e.Rect),h=b.create(),g=b.create(),l={drawContent:null,getSourceTextureInfo:null,getShaderParameters:null,invalidateRenderTargets:!1},m={indexMap:null,forcePreDraw:!1,forcePostDraw:!1,is3D:!1,isSourceTextureRotated:!1,isRotatedOrNegativeSizeInstance:!1,useFullSurface:!1},u={contentObject:null,contextObject:null,blendMode:0,devicePixelRatio:1,layerScale:1,layerAngle:0,layoutRect:null,drawSurfaceRect:null,
drawContentHook:null,compositOffX:0,compositOffY:0,updateOwnProjection:!1};e.Gfx.EffectChain=class{constructor(v,t){t=Object.assign({},l,t);this._manager=v;this._cbDrawContent=t.drawContent;this._cbGetSourceTextureInfo=t.getSourceTextureInfo;this._cbGetShaderParameters=t.getShaderParameters;this._cbDrawContentHook=null;this._shaderProgramList=[];this._shaderProgramIndices=[];this._steps=[];this._blendMode=0;this._isSourceTextureRotated=this._useFullSurface=this._canUseFastPath=this._depthEnabledAtStart=
this._didChangeTransform=this._isAnyShaderDepthSampling=this._isAnyShaderAnimated=!1;this._numTempSurfacesRequired=0;this._renderTargets=[null,null,null];this._invalidateRenderTargets=!!t.invalidateRenderTargets;this._drawHeight=this._drawWidth=this._boxExtendVertical=this._boxExtendHorizontal=0;this._contextObject=this._contentObject=null;this._layoutRect=e.New(e.Rect);this._drawSurfaceRect=e.New(e.Rect);this._rcTexOriginal=e.New(e.Rect);this._rcTexBounce=e.New(e.Rect);this._rcTexDest=e.New(e.Rect);
this._layerScale=this._devicePixelRatio=1;this._time=this._layerAngle=0;this._destRenderTarget=null;this._compositOffY=this._compositOffX=0;this._updateOwnProjection=!1;this._projectionMatrix=b.create();this._modelViewMatrix=b.create()}Release(){e.clearArray(this._steps);e.clearArray(this._shaderProgramList);e.clearArray(this._shaderProgramIndices);this._cbGetShaderParameters=this._cbGetSourceTextureInfo=this._cbDrawContent=this._contextObject=this._contentObject=null}BuildSteps(v,t){t=Object.assign({},
m,t);e.clearArray(this._steps);this._boxExtendVertical=this._boxExtendHorizontal=0;this._isAnyShaderDepthSampling=this._isAnyShaderAnimated=!1;this._numTempSurfacesRequired=0;this._isSourceTextureRotated=!!t.isSourceTextureRotated;this._useFullSurface=!!t.useFullSurface;e.shallowAssignArray(this._shaderProgramList,v);if(0!==v.length){if(t.indexMap){if(t.indexMap.length!==v.length)throw Error("incorrect indexMap length");e.shallowAssignArray(this._shaderProgramIndices,t.indexMap)}else{e.clearArray(this._shaderProgramIndices);
for(let r=0,x=v.length;r<x;++r)this._shaderProgramIndices.push(r)}for(var q of v)this._boxExtendHorizontal+=q.GetBoxExtendHorizontal(),this._boxExtendVertical+=q.GetBoxExtendVertical(),q.IsAnimated()&&(this._isAnyShaderAnimated=!0),q.UsesDepth()&&(this._isAnyShaderDepthSampling=!0);if(1!==v.length||v[0].BlendsBackground()||v[0].UsesCrossSampling()||!t.useFullSurface&&v[0].ExtendsBox()||t.forcePreDraw||v[0].MustPreDraw()||t.forcePostDraw||t.is3D||!this._useFullSurface&&v[0].UsesDepth()){this._canUseFastPath=
!1;q=this._ShouldPreDraw(v[0],t);t=this._ShouldPostDraw(v.at(-1),t);var p=0;q&&(this._numTempSurfacesRequired=1,this._steps.push(e.New(e.Gfx.EffectChain.Step.PreDraw,this,-1,1)),p=1);for(let r=0,x=v.length;r<x;++r)0!==r||q?(v=1===p?2:1,r!==x-1||t||(v=0),this._numTempSurfacesRequired=Math.max(this._numTempSurfacesRequired,v),this._steps.push(e.New(e.Gfx.EffectChain.Step.Bounce,this,p,v,r)),p=v):(this._numTempSurfacesRequired=1,this._steps.push(e.New(e.Gfx.EffectChain.Step.FirstBounce,this,-1,1,r)),
p=1);t&&this._steps.push(e.New(e.Gfx.EffectChain.Step.PostDraw,this,p,0))}else this._canUseFastPath=!0}}_ShouldPreDraw(v,t){return t.forcePreDraw||t.is3D||!this._useFullSurface&&v.UsesDepth()||v.MustPreDraw()||v.BlendsBackground()&&(t.isRotatedOrNegativeSizeInstance||v.GetRenderer().IsWebGL()&&t.isSourceTextureRotated)||0!==this._boxExtendHorizontal||0!==this._boxExtendVertical}_ShouldPostDraw(v,t){return t.forcePostDraw||v.BlendsBackground()||v.UsesCrossSampling()}Render(v,t,q){q=Object.assign({},
u,q);v.IsWebGPU()&&null===t&&(t=v.GetBackbufferRenderTarget());this._destRenderTarget=t;this._contentObject=q.contentObject;this._contextObject=q.contextObject;this._blendMode=q.blendMode;this._devicePixelRatio=q.devicePixelRatio;this._layerScale=q.layerScale;this._layerAngle=q.layerAngle;this._time=this._manager.GetTime();this._didChangeTransform=!1;v.ResetDidChangeTransformFlag();this._isAnyShaderAnimated&&this._Redraw();if(this._canUseFastPath)this._Render_FastPath(v,q);else{var [p,r]=this._manager.GetDrawSize(v);
this._SetDrawSize(v,p,r);this._CalculateRectangles(q);v.ResetColor();v.SetBaseZ(0);v.SetCurrentZ(0);this._cbDrawContentHook=q.drawContentHook;this._compositOffX=q.compositOffX||0;this._compositOffY=q.compositOffY||0;this._updateOwnProjection=!!q.updateOwnProjection;this._OnBeforeStartEffectChain(v);this._renderTargets[0]=t;this._renderTargets[1]=1<=this._numTempSurfacesRequired?this._GetRenderTarget():null;this._renderTargets[2]=2===this._numTempSurfacesRequired?this._GetRenderTarget():null;for(const x of this._steps)t=
this._GetRenderTargetForId(x.GetSrcTargetId()),q=this._GetRenderTargetForId(x.GetDestTargetId()),v.IsWebGPU()?x.Run_WebGPU(v,t,q):x.Run_WebGL(v,t,q);this._renderTargets[1]&&this._ReleaseRenderTarget(this._renderTargets[1]);this._renderTargets[2]&&this._ReleaseRenderTarget(this._renderTargets[2]);this._renderTargets.fill(null);this._OnAfterEndEffectChain(v);this._cbDrawContentHook=this._contextObject=this._contentObject=this._destRenderTarget=null}}_SetDrawSize(v,t,q){if(0>=t||0>=q)throw Error("invalid draw size");
this._drawWidth===t&&this._drawHeight===q||this._CalculateDeviceTransformMatrices(v,t,q,0,0,this._projectionMatrix,this._modelViewMatrix);this._drawWidth=t;this._drawHeight=q}_CalculateDeviceTransformMatrices(v,t,q,p,r,x,y){p=t/2+p;r=q/2+r;v.CalculatePerspectiveMatrix(x,t/q);v=v.CalculateLookAtModelView2(p,r,v.GetDefaultCameraZ()*self.devicePixelRatio,p,r,0,q);b.copy(y,v)}_CalculateRectangles(v){this._layoutRect.copy(v.layoutRect);v.drawSurfaceRect?this._drawSurfaceRect.copy(v.drawSurfaceRect):this._drawSurfaceRect.set(0,
0,this._drawWidth,this._drawHeight);this._rcTexOriginal.copy(this._drawSurfaceRect);this._rcTexOriginal.divide(this._drawWidth,this._drawHeight);v=v.layerScale*v.devicePixelRatio;this._drawSurfaceRect.inflate(this._boxExtendHorizontal*v,this._boxExtendVertical*v);this._rcTexDest.copy(this._drawSurfaceRect);this._rcTexDest.divide(this._drawWidth,this._drawHeight);this._drawSurfaceRect.clamp(0,0,this._drawWidth,this._drawHeight);this._rcTexBounce.copy(this._drawSurfaceRect);this._rcTexBounce.divide(this._drawWidth,
this._drawHeight)}_OnBeforeStartEffectChain(v){this._depthEnabledAtStart=v.IsDepthEnabled();this._useFullSurface&&(v.SetDepthEnabled(!1),this._isAnyShaderDepthSampling&&v.SetDepthSamplingEnabled(!0));v.IsWebGPU()&&!this._useFullSurface&&(a.copy(this._drawSurfaceRect),a.roundOuter(),v.SetScissorRect(a.getLeft(),a.getTop(),a.width(),a.height()))}_OnAfterEffectChainDrawContent(v){v.ResetColor();this._useFullSurface||(v.SetDepthEnabled(!1),this._isAnyShaderDepthSampling&&v.SetDepthSamplingEnabled(!0));
v.IsWebGPU()&&v.SetNormalizedCoordsProgramVariant(!0)}_OnAfterEndEffectChain(v){v.SetDepthSamplingEnabled(!1);v.SetDepthEnabled(this._depthEnabledAtStart);v.IsWebGPU()&&!this._useFullSurface&&v.RemoveScissorRect();v.IsWebGPU()&&v.SetNormalizedCoordsProgramVariant(!1);this._didChangeTransform=v.DidChangeTransform()}_ClampRcTexDest(){this._rcTexDest.clamp(0,0,1,1)}_GetRenderTargetForId(v){return 0>v?null:this._renderTargets[v]}_GetRenderTarget(){return this._manager.GetRenderTarget(this)}_GetDestRenderTarget(){return this._destRenderTarget}_ReleaseRenderTarget(v){this._manager.ReleaseRenderTarget(v,
this)}_GetShaderProgramAt(v){return this._shaderProgramList[v]}_DrawContent(v){this._cbDrawContentHook?this._cbDrawContentHook(this,v,()=>this._cbDrawContent(v,this)):this._cbDrawContent(v,this);this._canUseFastPath||this._OnAfterEffectChainDrawContent(v)}_IsRenderTargetSameSizeAndOffset(v){if(this._useFullSurface)return!0;if(0!==this._compositOffX||0!==this._compositOffY)return!1;const [t,q]=v.GetRenderTargetSize(v.GetRenderTarget());return t!==this._drawWidth||q!==this._drawHeight?!1:!0}_SetDeviceTransform(v,
t){let q=this._projectionMatrix,p=this._modelViewMatrix;if(t&&!this._IsRenderTargetSameSizeAndOffset(v)){q=h;p=g;const [r,x]=v.GetRenderTargetSize(v.GetRenderTarget());this._CalculateDeviceTransformMatrices(v,r,x,this._compositOffX,this._compositOffY,q,p);v.IsWebGPU()&&!this._useFullSurface&&v.RemoveScissorRect()}v.SetProjectionMatrix(q);v.SetModelViewMatrix(p)}_Redraw(){this._manager.Redraw(this)}_GetShaderParameters(v){return this._cbGetShaderParameters(this._shaderProgramIndices[v])}_SetProgramParameters(v,
t){let q=this._rcTexDest,p=this._rcTexBounce,r=this._rcTexOriginal;v.IsWebGL()&&(c.copy(q),c.flipAround(1),q=c,d.copy(p),d.flipAround(1),p=d,f.copy(r),f.flipAround(1),r=f);this._DoSetProgramParameters(v,t,p,r,q,1/this._drawWidth,1/this._drawHeight)}_SetFirstBounceProgramParameters(v,t){let q=this._rcTexBounce,p=this._rcTexOriginal,r=1/this._drawWidth,x=1/this._drawHeight;if(this._cbGetSourceTextureInfo){let {srcTexRect:C,srcWidth:G,srcHeight:A}=this._cbGetSourceTextureInfo(this._contentObject);C||
(a.set(0,0,0,0),C=a);G||(G=this._drawWidth);A||(A=this._drawHeight);p=q=C;r=1/G;x=1/A}else v.IsWebGL()&&(d.copy(q),d.flipAround(1),q=d,f.copy(p),f.flipAround(1),p=f);let y=this._rcTexDest;v.IsWebGL()&&(y=c,y.copy(this._rcTexDest),y.flipAround(1));this._DoSetProgramParameters(v,t,q,p,y,r,x);v.IsWebGPU()&&this._shaderProgramList[0].BlendsBackground()&&v.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated)}_DoSetProgramParameters(v,t,q,p,r,x,y){t=this._GetShaderParameters(t);v.SetProgramParameters(this._destRenderTarget,
r,q,p,this._layoutRect,x,y,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time,t)}_Render_FastPath(v,t){var q=this._shaderProgramList[0];const p=v.IsDepthEnabled(),r=q.UsesDepth();r&&(v.SetDepthEnabled(!1),v.SetDepthSamplingEnabled(!0),this._rcTexDest.set(0,0,1,1),this._rcTexOriginal.set(0,0,1,1));v.SetProgram(q);v.SetBlendMode(this._blendMode);v.SetRenderTarget(this._destRenderTarget);let x;this._rcTexOriginal.set(0,0,1,1);if(q.UsesAnySrcRectOrPixelSize()&&this._cbGetSourceTextureInfo){const {srcTexRect:y,
srcWidth:C,srcHeight:G}=this._cbGetSourceTextureInfo(this._contentObject);y&&this._rcTexOriginal.copy(y);q=Number.isFinite(C)?1/C:0;x=Number.isFinite(G)?1/G:0}else{const [y,C]=this._manager.GetDrawSize(v);q=1/y;x=1/C}t.layoutRect?this._layoutRect.copy(t.layoutRect):this._layoutRect.set(0,0,0,0);t=this._GetShaderParameters(0);v.SetProgramParameters(null,this._rcTexDest,this._rcTexOriginal,this._rcTexOriginal,this._layoutRect,q,x,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time,t);
v.SetBaseZ(0);this._DrawContent(v);r&&(v.SetDepthSamplingEnabled(!1),v.SetDepthEnabled(p))}IsFastPath(){return this._canUseFastPath}UseFullSurface(){return this._useFullSurface}GetContentObject(){return this._contentObject}GetContextObject(){return this._contextObject}_GetBlendMode(){return this._blendMode}_UpdateOwnProjection(){return this._updateOwnProjection}DidChangeTransform(){return this._didChangeTransform}_GetDrawSurfaceRect(){return this._drawSurfaceRect}_GetRcTexBounce(){return this._rcTexBounce}_ShouldInvalidateRenderTargets(){return this._invalidateRenderTargets}async DebugLogRenderTargetContents(v,
t,q){}}}"use strict";self.C3.Gfx.EffectChain.Step=class{constructor(e,b,a,c=-1){this._effectChain=e;this._srcTargetId=b;this._destTargetId=a;this._index=c}GetEffectChain(){return this._effectChain}GetSrcTargetId(){return this._srcTargetId}GetDestTargetId(){return this._destTargetId}GetIndex(){return this._index}GetShaderProgram(){return this.GetEffectChain()._GetShaderProgramAt(this.GetIndex())}Run_WebGL(e,b,a){}Run_WebGPU(e,b,a){}};
{"use strict";const e=self.C3;e.Gfx.EffectChain.Step.PreDraw=class extends e.Gfx.EffectChain.Step{constructor(b,a,c,d){super(b,a,c,d)}Run_WebGL(b,a,c){a=this.GetEffectChain();b.SetAlphaBlend();b.SetTextureFillMode();b.SetRenderTarget(c,a._UpdateOwnProjection());b.ClearRgba(0,0,0,0);a._DrawContent(b);a._ClampRcTexDest()}Run_WebGPU(b,a,c){a=this.GetEffectChain();b.SetAlphaBlend();b.SetTextureFillMode();b.SetRenderTarget(c,!1);b.ClearRgba(0,0,0,0);a._DrawContent(b);a._ClampRcTexDest()}}}
{"use strict";const e=self.C3,b=e.New(e.Rect),a=e.New(e.Quad);e.Gfx.EffectChain.Step.PostDraw=class extends e.Gfx.EffectChain.Step{constructor(c,d,f,h){super(c,d,f,h)}Run_WebGL(c,d,f){const h=this.GetEffectChain();c.SetTextureFillMode();c.SetRenderTarget(f);h._SetDeviceTransform(c,!0);c.SetBlendMode(h._GetBlendMode());c.SetTexture(d.GetTexture());a.setFromRect(h._GetDrawSurfaceRect());b.copy(h._GetRcTexBounce());b.flipAround(1);c.Quad3(a,b);h._ShouldInvalidateRenderTargets()&&c.InvalidateRenderTarget(d)}Run_WebGPU(c,
d,f){const h=this.GetEffectChain();c.SetTextureFillMode();c.SetRenderTarget(f,!1);h._IsRenderTargetSameSizeAndOffset(c)?a.setFromRect(h._GetRcTexBounce()):(c.SetNormalizedCoordsProgramVariant(!1),h._SetDeviceTransform(c,!0),a.setFromRect(h._GetDrawSurfaceRect()));c.SetBackTexture(null);c.SetBlendMode(h._GetBlendMode());c.SetTexture(d.GetTexture());h.UseFullSurface()?c.FullscreenQuad():c.Quad3(a,h._GetRcTexBounce())}}}
{"use strict";const e=self.C3;e.Gfx.EffectChain.Step.FirstBounce=class extends e.Gfx.EffectChain.Step{constructor(b,a,c,d){super(b,a,c,d)}Run_WebGL(b,a,c){a=this.GetEffectChain();b.SetRenderTarget(c,a._UpdateOwnProjection());b.ClearRgba(0,0,0,0);b.SetCopyBlend();b.SetProgram(this.GetShaderProgram());a._SetFirstBounceProgramParameters(b,this.GetIndex());a._DrawContent(b);a._ClampRcTexDest()}Run_WebGPU(b,a,c){a=this.GetEffectChain();b.SetRenderTarget(c,!1);b.ClearRgba(0,0,0,0);b.SetCopyBlend();b.SetProgram(this.GetShaderProgram());
a._SetFirstBounceProgramParameters(b,this.GetIndex());a._DrawContent(b);a._ClampRcTexDest()}}}
{"use strict";const e=self.C3,b=e.New(e.Rect),a=e.New(e.Quad);e.Gfx.EffectChain.Step.Bounce=class extends e.Gfx.EffectChain.Step{constructor(c,d,f,h){super(c,d,f,h)}Run_WebGL(c,d,f){const h=this.GetEffectChain();c.SetRenderTarget(f);(f=0===this.GetDestTargetId())?c.SetBlendMode(h._GetBlendMode()):(c.ClearRgba(0,0,0,0),c.SetCopyBlend());c.SetProgram(this.GetShaderProgram());h._SetProgramParameters(c,this.GetIndex());c.SetTexture(d.GetTexture());h._SetDeviceTransform(c,f);a.setFromRect(h._GetDrawSurfaceRect());
b.copy(h._GetRcTexBounce());b.flipAround(1);c.Quad3(a,b);h._ShouldInvalidateRenderTargets()&&c.InvalidateRenderTarget(d)}Run_WebGPU(c,d,f){const h=this.GetEffectChain();c.SetRenderTarget(f,!1);0===this.GetDestTargetId()?(c.SetBlendMode(h._GetBlendMode()),c.SetBackTexture(null),h._IsRenderTargetSameSizeAndOffset(c)?a.setFromRect(h._GetRcTexBounce()):(c.SetNormalizedCoordsProgramVariant(!1),h._SetDeviceTransform(c,!0),a.setFromRect(h._GetDrawSurfaceRect()))):(c.ClearRgba(0,0,0,0),c.SetCopyBlend(),a.setFromRect(h._GetRcTexBounce()));
c.SetProgram(this.GetShaderProgram());h._SetProgramParameters(c,this.GetIndex());c.SetTexture(d.GetTexture());h.UseFullSurface()?c.FullscreenQuad():c.Quad3(a,h._GetRcTexBounce())}}}
{"use strict";const e=self.C3,b=self.C3X;let a=null;const c=new Set;function d(l,m){const u=l[0]-m[0];return 0!==u?u:l[1]-m[1]}const f=[],h=[];let g=!1;self.IRuntime=class{constructor(l,m){a=l;Object.defineProperties(this,{assets:{value:a.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:m,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:a.GetProjectName(),writable:!1},projectVersion:{value:a.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(a),writable:!1},
isInWorker:{value:a.IsInWorker(),writable:!1}});a.UserScriptDispatcher().addEventListener("keydown",u=>{c.has(u.key)?u.stopPropagation():c.add(u.key)});a.UserScriptDispatcher().addEventListener("keyup",u=>c.delete(u.key));a.Dispatcher().addEventListener("window-blur",()=>c.clear());a.IsInWorker()&&(self.alert=u=>{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(u)})}_InitGlobalVars(l){Object.defineProperties(this.globalVars,l)}addEventListener(l,m){a.UserScriptDispatcher().addEventListener(l,m)}removeEventListener(l,m){a.UserScriptDispatcher().removeEventListener(l,m)}callFunction(l,...m){b.RequireString(l);const u=a.GetEventSheetManager(),v=u.GetFunctionBlockByName(l);if(!v)throw Error(`cannot find function name '${l}'`);if(!v.IsEnabled())return v.GetDefaultReturnValue();if(m.length<v.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${l}' (${m.length} passed, ${v.GetFunctionParameterCount()} expected)`);
const t=v.GetEventBlock();l=null;var q=u.GetCurrentEvent();q&&(q=q.GetSolModifiersIncludingParents(),0<q.length&&(l=q,u.PushCleanSol(q)));m=t.RunAsExpressionFunctionCall(t.GetSolModifiersIncludingParents(),v.GetReturnType(),v.GetDefaultReturnValue(),...m);l&&u.PopSol(l);return m}setReturnValue(l){const m=a.GetEventStack().GetCurrentExpFuncStackFrame();if(!m)throw Error("not in a function which returns a value");switch(m.GetFunctionReturnType()){case 1:"number"===typeof l&&m.SetFunctionReturnValue(l);
break;case 2:"string"===typeof l&&m.SetFunctionReturnValue(l);break;case 3:"number"!==typeof l&&"string"!==typeof l||m.SetFunctionReturnValue(l)}}get dt(){return a.GetDt()}get gameTime(){return a.GetGameTime()}get wallTime(){return a.GetWallTime()}random(){return a.Random()}get layout(){return a.GetMainRunningLayout().GetILayout()}getLayout(l){const m=a.GetLayoutManager();if("number"===typeof l||"string"===typeof l)l=m.GetLayout(l);else throw new TypeError("expected string or number");if(!l)throw Error("invalid layout");
return l.GetILayout()}getAllLayouts(){return a.GetLayoutManager().GetAllLayouts().map(l=>l.GetILayout())}goToLayout(l){const m=a.GetLayoutManager();if("number"===typeof l||"string"===typeof l)l=m.GetLayout(l);else throw new TypeError("expected string or number");if(!l)throw Error("invalid layout");m.IsPendingChangeMainLayout()||m.ChangeMainLayout(l)}get keyboard(){const l=a._GetCommonScriptInterfaces().keyboard;if(!l)throw Error("runtime.keyboard used but Keyboard object missing - add it to your project first");
return l}get mouse(){const l=a._GetCommonScriptInterfaces().mouse;if(!l)throw Error("runtime.mouse used but Mouse object missing - add it to your project first");return l}get touch(){const l=a._GetCommonScriptInterfaces().touch;if(!l)throw Error("runtime.touch used but Touch object missing - add it to your project first");return l}invokeDownload(l,m){b.RequireString(l);b.RequireString(m);a.InvokeDownload(l,m)}getInstanceByUid(l){b.RequireFiniteNumber(l);return(l=a.GetInstanceByUID(l))?l.GetInterfaceClass():
null}sortZOrder(l,m){b.RequireFunction(m);const u=a.GetCurrentLayout();for(var v of l){l=a._UnwrapIWorldInstance(v);var t=l.GetWorldInfo();f.push([t.GetLayer().GetIndex(),t.GetZIndex()]);h.push(l)}if(0!==f.length){f.sort(d);h.sort((q,p)=>m(q.GetInterfaceClass(),p.GetInterfaceClass()));v=!1;for(let q=0,p=f.length;q<p;++q){l=h[q];t=u.GetLayerByIndex(f[q][0]);const r=f[q][1],x=t._GetInstances();x[r]!==l&&(x[r]=l,l.GetWorldInfo()._SetLayer(t),t.SetZIndicesChanged(),v=!0)}v&&a.UpdateRender();e.clearArray(f);
e.clearArray(h)}}alert(l){return a.PostComponentMessageToDOMAsync("runtime","alert",{message:l+(a.IsInWorker()?" [via Web Worker]":"")})}}}
{"use strict";const e=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){e.IsRelativeURL(a)&&(a=a.toLowerCase());return b.GetMediaFileUrl(a,b.GetMediaSubfolder())}get mediaFolder(){return b.GetMediaSubfolder()}async decodeWebMOpus(a,
c){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");c=await b.GetRuntime()._WasmDecodeWebMOpus(c);c=new Float32Array(c);a=a.createBuffer(1,c.length,48E3);a.getChannelData(0).set(c);return a}loadScripts(...a){return b.LoadScripts(...a)}compileWebAssembly(a){return b.CompileWebAssembly(a)}loadStyleSheet(a){return b.LoadStyleSheet(a)}}}
{"use strict";const e=self.C3X;self.IStorage=class{constructor(b){this._storage=b._GetProjectStorage()}getItem(b){e.RequireString(b);return this._storage.getItem(b)}setItem(b,a){e.RequireString(b);return this._storage.setItem(b,a)}removeItem(b){e.RequireString(b);return this._storage.removeItem(b)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}}}
{"use strict";const e=self.C3X,b=new WeakMap;self.IObjectClass=class{constructor(a){b.set(this,a);Object.defineProperties(this,{name:{value:a.GetName(),writable:!1}});a.GetRuntime()._MapScriptInterface(this,a)}addEventListener(a,c){e.RequireString(a);e.RequireFunction(c);b.get(this).UserScriptDispatcher().addEventListener(a,c)}removeEventListener(a,c){e.RequireString(a);e.RequireFunction(c);b.get(this).UserScriptDispatcher().removeEventListener(a,c)}getAllInstances(){return b.get(this).GetInstances().map(a=>
a.GetInterfaceClass())}getFirstInstance(){const a=b.get(this).GetInstances();return 0<a.length?a[0].GetInterfaceClass():null}getPickedInstances(){return b.get(this).GetCurrentSol().GetInstances().map(a=>a.GetInterfaceClass())}getFirstPickedInstance(){const a=b.get(this).GetCurrentSol().GetInstances();return 0<a.length?a[0].GetInterfaceClass():null}*instances(){for(const a of b.get(this).GetInstances())yield a.GetInterfaceClass()}*pickedInstances(){for(const a of b.get(this).GetCurrentSol().GetInstances())yield a.GetInterfaceClass()}setInstanceClass(a){e.RequireFunction(a);
if(0<b.get(this).GetInstanceCount())throw Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");b.get(this)._SetUserScriptInstanceClass(a)}createInstance(a,c,d,f){e.RequireNumber(c);e.RequireNumber(d);if("number"!==typeof a&&"string"!==typeof a)throw new TypeError("invalid layer parameter");const h=b.get(this),g=h.GetRuntime();a=g.GetMainRunningLayout().GetLayer(a);if(!a)throw Error("invalid layer");c=g.CreateInstance(h,a,c,d,f);f&&a.SortAndAddInstancesByZIndex(c);
f=g.GetEventSheetManager();f.BlockFlushingInstances(!0);c._TriggerOnCreatedOnSelfAndRelated();f.BlockFlushingInstances(!1);return c.GetInterfaceClass()}}}
{"use strict";const e=self.C3X,b=new WeakMap;self.ILayout=class{constructor(a){b.set(this,a);const c=[],d=a.GetEffectList(),f=d.GetAllEffectTypes().length;for(let h=0;h<f;++h)c.push(new self.IEffectInstance(d,h));Object.defineProperties(this,{name:{value:a.GetName(),writable:!1},index:{value:a.GetIndex(),writable:!1},effects:{value:c,writable:!1}})}addEventListener(a,c){e.RequireString(a);e.RequireFunction(c);b.get(this).UserScriptDispatcher().addEventListener(a,c)}removeEventListener(a,c){e.RequireString(a);
e.RequireFunction(c);b.get(this).UserScriptDispatcher().removeEventListener(a,c)}get width(){return b.get(this).GetWidth()}set width(a){b.get(this).SetWidth(a)}get height(){return b.get(this).GetHeight()}set height(a){b.get(this).SetHeight(a)}set scale(a){e.RequireFiniteNumber(a);b.get(this).SetScale(a)}get scale(){return b.get(this).GetScale()}set angle(a){e.RequireFiniteNumber(a);b.get(this).SetAngle(a)}get angle(){return b.get(this).GetAngle()}set scrollX(a){e.RequireNumber(a);b.get(this).SetScrollX(a)}get scrollX(){return b.get(this).GetScrollX()}set scrollY(a){e.RequireNumber(a);
b.get(this).SetScrollY(a)}get scrollY(){return b.get(this).GetScrollY()}scrollTo(a,c){e.RequireNumber(a);e.RequireNumber(c);const d=b.get(this);d.SetScrollX(a);d.SetScrollY(c)}getLayer(a){const c=b.get(this);if("number"===typeof a||"string"===typeof a)a=c.GetLayer(a);else throw new TypeError("expected string or number");return a?a.GetILayer():null}getAllLayers(){return b.get(this).GetLayers().map(a=>a.GetILayer())}setVanishingPoint(a,c){e.RequireFiniteNumber(a);e.RequireFiniteNumber(c);b.get(this).SetVanishingPointXY(a,
c)}getVanishingPoint(){return b.get(this)._GetVanishingPoint()}set projection(a){e.RequireString(a);const c=b.get(this);if("perspective"===a)c.SetPerspectiveProjection();else if("orthographic"===a)c.SetOrthographicProjection();else throw Error("invalid projection");}get projection(){return b.get(this).IsOrthographicProjection()?"orthographic":"perspective"}}}
{"use strict";const e=self.C3,b=self.C3X,a=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]]),d=new Map([...c.entries()].map(h=>[h[1],h[0]])),f=e.New(e.Color);self.ILayer=class{constructor(h){a.set(this,h);const g=[],l=h.GetEffectList(),m=l.GetAllEffectTypes().length;for(let u=0;u<m;++u)g.push(new self.IEffectInstance(l,u));Object.defineProperties(this,
{name:{value:h.GetName(),writable:!1},index:{value:h.GetIndex(),writable:!1},layout:{value:h.GetLayout().GetILayout(),writable:!1},effects:{value:g,writable:!1}})}static _Unwrap(h){return a.get(h)}get isVisible(){return a.get(this).IsVisible()}set isVisible(h){a.get(this).SetVisible(h)}get opacity(){return a.get(this).GetOpacity()}set opacity(h){h=e.clamp(+h,0,1);isNaN(h)||a.get(this).SetOpacity(h)}set scale(h){b.RequireFiniteNumber(h);a.get(this).SetOwnScale(h)}get scale(){return a.get(this).GetOwnScale()}set scaleRate(h){b.RequireFiniteNumber(h);
a.get(this).SetScaleRate(h)}get scaleRate(){return a.get(this).GetScaleRate()}set angle(h){b.RequireFiniteNumber(h);a.get(this).SetAngle(h)}get angle(){return a.get(this).GetOwnAngle()}set parallaxX(h){b.RequireFiniteNumber(h);a.get(this).SetParallaxX(h)}get parallaxX(){return a.get(this).GetParallaxX()}set parallaxY(h){b.RequireFiniteNumber(h);a.get(this).SetParallaxY(h)}get parallaxY(){return a.get(this).GetParallaxY()}set zElevation(h){b.RequireFiniteNumber(h);a.get(this).SetZElevation(h)}get zElevation(){return a.get(this).GetZElevation()}set isTransparent(h){a.get(this).SetTransparent(h)}get isTransparent(){return a.get(this).IsTransparent()}set isForceOwnTexture(h){a.get(this).SetForceOwnTexture(h)}get isForceOwnTexture(){return a.get(this).IsForceOwnTexture()}set blendMode(h){b.RequireString(h);
h=c.get(h);if("number"!==typeof h)throw Error("invalid blend mode");a.get(this).SetBlendMode(h)}get blendMode(){return d.get(a.get(this).GetBlendMode())}set backgroundColor(h){b.RequireArray(h);if(3>h.length)throw Error("expected 3 elements");f.setRgb(h[0],h[1],h[2]);h=a.get(this);const g=h.GetBackgroundColor();g.equalsIgnoringAlpha(f)||(g.copyRgb(f),h.GetRuntime().UpdateRender())}get backgroundColor(){const h=a.get(this).GetBackgroundColor();return[h.getR(),h.getG(),h.getB()]}set scrollX(h){b.RequireNumber(h);
const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollX(h)}get scrollX(){return a.get(this).GetScrollX()}set scrollY(h){b.RequireNumber(h);const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollY(h)}get scrollY(){return a.get(this).GetScrollY()}scrollTo(h,g){b.RequireNumber(h);b.RequireNumber(g);const l=a.get(this);l.SetOwnScrollPositionEnabled(!0);l.SetScrollX(h);l.SetScrollY(g)}restoreScrollPosition(){a.get(this).SetOwnScrollPositionEnabled(!1)}getViewport(){return a.get(this).GetViewport().toDOMRect()}cssPxToLayer(h,
g,l=0){b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);const m=a.get(this),u=m.GetRuntime();return m.CanvasCssToLayer(h-u.GetCanvasClientX(),g-u.GetCanvasClientY(),l)}layerToCssPx(h,g,l=0){b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);const m=a.get(this),u=m.GetRuntime(),[v,t]=m.LayerToCanvasCss(h,g,l);return[v+u.GetCanvasClientX(),t+u.GetCanvasClientY()]}}}
{"use strict";const e=self.C3,b=self.C3X,a=new WeakMap,c=new WeakMap;function d(h){let g=c.get(h);if(g)return g;g=e.New(e.Event.Dispatcher);c.set(h,g);return g}let f=null;self.IInstance=class{constructor(){a.set(this,f);const h={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:f.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:f.GetUID(),writable:!1}};f._GetInstVarsScriptDescriptor(h);f._GetBehaviorsScriptDescriptor(h);Object.defineProperties(this,h);f.GetRuntime()._MapScriptInterface(this,
f)}static _Init(h){f=h}static _GetInitInst(){return f}_Release(){const h=c.get(this);h&&(h.Release(),c.delete(this));a.delete(this)}addEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).addEventListener(h,g,l)}removeEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).removeEventListener(h,g,l)}dispatchEvent(h){d(this).dispatchEvent(h)}destroy(){const h=a.get(this);h.GetRuntime().DestroyInstance(h)}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IInstance,c=self.ILayer,d=new WeakMap,f=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]]),h=new Map([...f.entries()].map(l=>[l[1],l[0]])),g=e.New(e.Color);self.IWorldInstance=class l extends a{constructor(){super();var m=a._GetInitInst();d.set(this,m);const u=[];var v=m.GetWorldInfo();if(m=v.GetInstanceEffectList()){v=
v.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let t=0;t<v;++t)u.push(new self.IEffectInstance(m,t))}Object.defineProperties(this,{effects:{value:u,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(m){m=+m;const u=d.get(this).GetWorldInfo();isNaN(m)||u.GetX()===m||(u.SetX(m),u.SetBboxChanged())}get y(){return d.get(this).GetWorldInfo().GetY()}set y(m){m=
+m;const u=d.get(this).GetWorldInfo();isNaN(m)||u.GetY()===m||(u.SetY(m),u.SetBboxChanged())}get zElevation(){return d.get(this).GetWorldInfo().GetZElevation()}set zElevation(m){m=+m;const u=d.get(this),v=u.GetWorldInfo();isNaN(m)||v.GetZElevation()===m||(v.SetZElevation(m),u.GetRuntime().UpdateRender())}get totalZElevation(){return d.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return d.get(this).GetWorldInfo().GetWidth()}set width(m){m=+m;const u=d.get(this).GetWorldInfo();isNaN(m)||
u.GetWidth()===m||(u.SetWidth(m),u.SetBboxChanged())}get height(){return d.get(this).GetWorldInfo().GetHeight()}set height(m){m=+m;const u=d.get(this).GetWorldInfo();isNaN(m)||u.GetHeight()===m||(u.SetHeight(m),u.SetBboxChanged())}get angle(){return d.get(this).GetWorldInfo().GetAngle()}set angle(m){m=e.clampAngle(+m);const u=d.get(this).GetWorldInfo();isNaN(m)||u.GetAngle()===m||(u.SetAngle(m),u.SetBboxChanged())}get angleDegrees(){return e.toDegrees(this.angle)}set angleDegrees(m){this.angle=e.toRadians(m)}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(m){m=
!!m;const u=d.get(this),v=u.GetWorldInfo();v.IsVisible()!==m&&(v.SetVisible(m),u.GetRuntime().UpdateRender())}get opacity(){return d.get(this).GetWorldInfo().GetOpacity()}set opacity(m){m=e.clamp(+m,0,1);const u=d.get(this),v=u.GetWorldInfo();isNaN(m)||v.GetOpacity()===m||(v.SetOpacity(m),u.GetRuntime().UpdateRender())}set colorRgb(m){b.RequireArray(m);if(3>m.length)throw Error("expected 3 elements");g.setRgb(m[0],m[1],m[2]);m=d.get(this);const u=m.GetWorldInfo();u.GetUnpremultipliedColor().equalsIgnoringAlpha(g)||
(u.SetUnpremultipliedColor(g),m.GetRuntime().UpdateRender())}get colorRgb(){const m=d.get(this).GetWorldInfo().GetUnpremultipliedColor();return[m.getR(),m.getG(),m.getB()]}set blendMode(m){b.RequireString(m);m=f.get(m);if("number"!==typeof m)throw Error("invalid blend mode");const u=d.get(this);u.GetWorldInfo().SetBlendMode(m);u.GetRuntime().UpdateRender()}get blendMode(){return h.get(d.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){d.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){d.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(m){b.RequireInstanceOf(m,
c);m=c._Unwrap(m);if(!m)throw Error("invalid layer");d.get(this).GetWorldInfo().ZOrderMoveToLayer(m)}moveAdjacentToInstance(m,u){b.RequireInstanceOf(m,l);d.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(d.get(m),u)}get zIndex(){return d.get(this).GetWorldInfo().GetZIndex()}containsPoint(m,u){b.RequireNumber(m);b.RequireNumber(u);return d.get(this).GetWorldInfo().ContainsPoint(+m,+u)}testOverlap(m){b.RequireInstanceOf(m,l);const u=d.get(this);m=d.get(m);return u.GetRuntime().GetCollisionEngine().TestOverlap(u,
m)}testOverlapSolid(){var m=d.get(this);return(m=m.GetRuntime().GetCollisionEngine().TestOverlapSolid(m))?m.GetInterfaceClass():null}getParent(){const m=d.get(this).GetParent();return m?m.GetInterfaceClass():null}getTopParent(){const m=d.get(this).GetTopParent();return m?m.GetInterfaceClass():null}*parents(){for(const m of d.get(this).parents())yield m.GetInterfaceClass()}getChildCount(){return d.get(this).GetChildCount()}getChildAt(m){return(m=d.get(this).GetChildAt(m))?m.GetInterfaceClass():null}*children(){for(const m of d.get(this).children())yield m.GetInterfaceClass()}*allChildren(){for(const m of d.get(this).allChildren())yield m.GetInterfaceClass()}addChild(m,
u){b.RequireInstanceOf(m,l);b.RequireOptionalObject(u);u||(u={});const v=d.get(this);m=d.get(m);v.AddChild(m,u)}removeChild(m){b.RequireInstanceOf(m,l);const u=d.get(this);m=d.get(m);u.RemoveChild(m)}removeFromParent(){const m=d.get(this);m.HasParent()&&m.GetParent().RemoveChild(m)}createMesh(m,u){b.RequireFiniteNumber(m);b.RequireFiniteNumber(u);d.get(this).GetWorldInfo().CreateMesh(m,u)}releaseMesh(){const m=d.get(this).GetWorldInfo();m.ReleaseMesh();m.SetBboxChanged()}setMeshPoint(m,u,v){b.RequireFiniteNumber(m);
b.RequireFiniteNumber(u);b.RequireObject(v);const t=d.get(this).GetWorldInfo();t.SetMeshPoint(m,u,v)&&t.SetBboxChanged()}getMeshSize(){var m=d.get(this).GetWorldInfo();if(!m.HasMesh())return[0,0];m=m.GetSourceMesh();return[m.GetHSize(),m.GetVSize()]}}}
{"use strict";const e=self.C3X,b=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();b.set(this,self.IInstance._GetInitInst())}getElement(){return b.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){b.get(this).GetSdkInstance().FocusElement()}blur(){b.get(this).GetSdkInstance().BlurElement()}setCssStyle(a,c){e.RequireString(a);b.get(this).GetSdkInstance().SetElementCSSStyle(a,c)}}}
{"use strict";const e=self.C3,b=self.C3X,a=new WeakMap,c=new WeakMap;function d(h){let g=c.get(h);if(g)return g;g=e.New(e.Event.Dispatcher);c.set(h,g);return g}let f=null;self.IBehaviorInstance=class{constructor(){a.set(this,f);const h={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:f.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,h)}static _Init(h){f=h}static _GetInitInst(){return f}get instance(){return a.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const h=
c.get(this);h&&(h.Release(),c.delete(this));a.delete(this)}addEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).addEventListener(h,g,l)}removeEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).removeEventListener(h,g,l)}dispatchEvent(h){d(this).dispatchEvent(h)}}}
{"use strict";const e=new WeakMap;self.IBehavior=class{constructor(b){e.set(this,b);b={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,b)}getAllInstances(){return e.get(this).GetInstances().map(b=>b.GetInterfaceClass())}}}
{"use strict";const e=self.C3,b=self.C3X,a=new WeakMap;self.IEffectInstance=class{constructor(c,d){a.set(this,c);Object.defineProperties(this,{index:{value:d,writable:!1}})}get name(){return a.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return a.get(this).IsEffectIndexActive(this.index)}set isActive(c){c=!!c;const d=a.get(this);d.IsEffectIndexActive(this.index)!==c&&(d.SetEffectIndexActive(this.index,c),d.UpdateActiveEffects(),d.GetRuntime().UpdateRender())}setParameter(c,d){b.RequireFiniteNumber(c);
c=Math.floor(+c);const f=a.get(this);var h=f.GetEffectParametersForIndex(this.index);if(0>c||c>=h.length)throw new RangeError("invalid effect parameter index");const g=h[c];if(g instanceof e.Color){if(!Array.isArray(d)||3>d.length)throw new TypeError("expected array with 3 elements");c=d[0];h=d[1];d=d[2];if(g.equalsRgb(c,h,d))return;g.setRgb(c,h,d)}else{if("number"!==typeof d)throw new TypeError("expected number");if(g===d)return;h[c]=d}f.IsEffectIndexActive(this.index)&&f.GetRuntime().UpdateRender()}getParameter(c){b.RequireFiniteNumber(c);
c=Math.floor(+c);const d=a.get(this).GetEffectParametersForIndex(this.index);if(0>c||c>=d.length)throw new RangeError("invalid effect parameter index");c=d[c];return c instanceof e.Color?[c.getR(),c.getG(),c.getB()]:c}}}
{"use strict";const e=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 c(f){if(!f)return"";f=f.split(".");if(2>f.length)return"";f=f.at(-1).toLowerCase();return a.get(f)||""}function d(f){return new Promise((h,g)=>{const l=document.createElement("script");l.onload=h;l.onerror=g;l.async=!1;l.type="module";
l.src=f;document.head.appendChild(l)})}e.AssetManager=class extends e.DefendedBase{constructor(f,h){super();var g=h.exportType;this._runtime=f;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova="cordova"===g;this._isiOSCordova=!!h.isiOSCordova;this._isFileProtocol=!!h.isFileProtocol;this._swClientId=h.swClientId;this._supportedAudioFormats=h.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=this._fontsSubfolder=
this._mediaSubfolder="";this._defaultLoadPolicy="html5"===g||"scirra-arcade"===g||"instant-games"===g?"remote":"local";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=e.New(e.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new e.PromiseThrottle(Math.max(e.hardwareConcurrency,8));
if(f=h.previewImageBlobs){(g=h.previewProjectFileBlobs)&&Object.assign(f,g);(g=h.projectData)&&(f["data.json"]=g);for(const [l,m]of Object.entries(f))this._localUrlBlobs.set(l.toLowerCase(),m)}if(h=h.previewProjectFileSWUrls)for(const [l,m]of Object.entries(h))this._localBlobSWUrls.set(l,m);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const f of this._localBlobUrlCache.values())f.startsWith("blob:")&&URL.revokeObjectURL(f);this._localBlobUrlCache.clear();
for(const f of this._allAssets)f.Release();e.clearArray(this._allAssets);this._assetsByUrl.clear();e.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(f){this._mediaSubfolder=f}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(f){this._fontsSubfolder=f}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(f){this._iconsSubfolder=f}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(f){return this._localUrlBlobs.has(f.toLowerCase())}_GetLocalUrlBlob(f){return this._localUrlBlobs.get(f.toLowerCase())||
null}GetLocalUrlAsBlobUrl(f){if(!this._HasLocalUrlBlob(f))return f;f=f.toLowerCase();var h=this._localBlobUrlCache.get(f);h||(h=this._GetLocalUrlBlob(f),h=URL.createObjectURL(h),this._localBlobUrlCache.set(f,h));return h}FetchBlob(f,h){h=h||this._defaultLoadPolicy;const g=this._GetLocalUrlBlob(f);if(g)return Promise.resolve(g);if(e.IsRelativeURL(f)){const l=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(l):"local"===h?this._promiseThrottle.Add(()=>e.FetchBlob(l)):
e.FetchBlob(l)}return e.FetchBlob(f)}FetchArrayBuffer(f){const h=this._GetLocalUrlBlob(f);if(h)return e.BlobToArrayBuffer(h);if(e.IsRelativeURL(f)){const g=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>e.FetchArrayBuffer(g)):e.FetchArrayBuffer(g)}return e.FetchArrayBuffer(f)}FetchText(f){const h=this._GetLocalUrlBlob(f);if(h)return e.BlobToString(h);if(e.IsRelativeURL(f)){const g=
f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>e.FetchText(g)):e.FetchText(g)}return e.FetchText(f)}async FetchJson(f){f=await this.FetchText(f);return JSON.parse(f)}_CordovaFetchLocalFileAs(f,h){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:f,as:h})}CordovaFetchLocalFileAsText(f){return this._CordovaFetchLocalFileAs(f,"text")}async CordovaFetchLocalFileAsBlob(f){const h=
await this._CordovaFetchLocalFileAs(f,"buffer");f=c(f);return new Blob([h],{type:f})}async CordovaFetchLocalFileAsBlobURL(f){f=f.toLowerCase();var h=this._localBlobUrlCache.get(f);if(h)return h;h=await this.CordovaFetchLocalFileAsBlob(f);h=URL.createObjectURL(h);this._localBlobUrlCache.set(f,h);return h}CordovaFetchLocalFileAsArrayBuffer(f){return this._CordovaFetchLocalFileAs(f,"buffer")}GetMediaFileUrl(f){return this._HasLocalUrlBlob(f)?this.GetLocalUrlAsBlobUrl(f):this._mediaSubfolder+f.toLowerCase()}GetProjectFileUrl(f,
h=""){if(e.IsAbsoluteURL(f)){if(h)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(f)}return this._HasLocalUrlBlob(f)?Promise.resolve(this.GetLocalUrlAsBlobUrl(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h+f):Promise.resolve(h+f.toLowerCase())}GetProjectFileIframeUrl(f){if(e.IsAbsoluteURL(f))return Promise.resolve(f);var h=f.indexOf("?"),g=-1===h?"":f.substr(h);h=-1===h?f:f.substr(0,h);return this._HasLocalUrlBlob(h)?(f=this._localBlobSWUrls.get(h)||
this.GetLocalUrlAsBlobUrl(h),!f.startsWith("blob:")&&this._swClientId&&(f=new URL(f),g=new URLSearchParams(g),g.set("__c3_client_id",this._swClientId),f.search=g.toString(),f=f.toString()),Promise.resolve(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h):Promise.resolve(f.toLowerCase())}LoadProjectFileUrl(f){return this.GetProjectFileUrl(f)}LoadImage(f){if(f.loadPolicy&&!b.has(f.loadPolicy))throw Error("invalid load policy");let h=this._assetsByUrl.get(f.url);if(h)return h;
h=e.New(e.ImageAsset,this,{url:f.url,size:f.size||0,loadPolicy:f.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(h);this._assetsByUrl.set(h.GetURL(),h);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=h.GetSize(),this._loadPromises.push(h.Load().then(()=>this._AddLoadedSize(h.GetSize()))));return h}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(f){console.error("Error loading: ",f),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=
!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(f){this._assetSizeLoaded+=f;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const f=e.New(e.Event,"loadingprogress");this._lastLoadProgress=e.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);f.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(f)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(f){e.shallowAssignArray(this._webFonts,f);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"===
typeof FontFace)return Promise.resolve();const f=[];for(const [h,g,l]of this._webFonts)this._totalAssetSizeToLoad+=l,f.push(this._LoadWebFont(h,g).then(()=>this._AddLoadedSize(l)));return Promise.all(f)}async _LoadWebFont(f,h){try{const g=await this.GetProjectFileUrl(h,this._fontsSubfolder),l=new FontFace(f,`url('${g}')`);this._runtime.IsInWorker()?self.fonts.add(l):document.fonts.add(l);await l.load()}catch(g){console.warn(`[C3 runtime] Failed to load web font '${f}': `,g)}}IsAudioFormatSupported(f){return!!this._supportedAudioFormats[f]}_SetAudioFiles(f,
h){this._preloadSounds=!!h;for(const [g,l,m]of f)this._audioFiles.set(g,{fileName:g,formats:l.map(u=>({type:u[0],fileExtension:u[1],fullName:g+u[1],fileSize:u[2]})),isMusic:m})}GetPreferredAudioFile(f){f=this._audioFiles.get(f.toLowerCase());if(!f)return null;let h=null;for(const g of f.formats)if(h||"audio/webm; codecs=opus"!==g.type||(h=g),this.IsAudioFormatSupported(g.type))return g;return h}GetProjectAudioFileUrl(f){return(f=this.GetPreferredAudioFile(f))?{url:this.GetMediaFileUrl(f.fullName),
type:f.type}:null}GetAudioToPreload(){if(this._preloadSounds){const f=[];for(const h of this._audioFiles.values()){if(h.isMusic)continue;const g=this.GetPreferredAudioFile(h.fileName);g&&f.push({originalUrl:h.fileName,url:this.GetMediaFileUrl(g.fullName),type:g.type,fileSize:g.fileSize})}return f}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...f){const h=await Promise.all(f.map(g=>this.GetProjectFileUrl(g)));this._runtime.IsInWorker()?1===f.length?(f=f[0],await self.c3_import((e.IsRelativeURL(f)?
"./":"")+f)):(f=f.map(g=>`import "${e.IsRelativeURL(g)?"./":""}${g}";`).join("\n"),f=URL.createObjectURL(new Blob([f],{type:"application/javascript"})),await self.c3_import(f)):await Promise.all(h.map(g=>d(g)))}async CompileWebAssembly(f){if(WebAssembly.compileStreaming)return f=await this.GetProjectFileUrl(f),await WebAssembly.compileStreaming(fetch(f));f=await e.FetchArrayBuffer(f);return await WebAssembly.compile(f)}async LoadStyleSheet(f){f=await this.GetProjectFileUrl(f);return await this._runtime.PostComponentMessageToDOMAsync("runtime",
"add-stylesheet",{url:f})}}}
{"use strict";const e=self.C3;e.Asset=class extends e.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;return this._blob=b}).catch(b=>console.error("Error loading resource: ",b))}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._loadPromise?this._loadPromise:this._assetManager.FetchBlob(this._url,this._loadPolicy)}}}
{"use strict";const e=self.C3,b=new e.PromiseThrottle,a=new Set;e.ImageAsset=class extends e.Asset{constructor(c,d){super(c,d);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 c of a)c._texturePromise=null,c._webglTexture=
null,c._refCount=0}LoadStaticTexture(c,d){d=d||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;d.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();return this._texturePromise=this.GetBlob().then(f=>b.Add(()=>c.CreateStaticTextureAsync(f,d).then(h=>{this._texturePromise=null;if(0===this._refCount)return c.DeleteTexture(h),null;this._webglTexture=h;this._imageWidth=h.GetWidth();this._imageHeight=
h.GetHeight();return this._webglTexture}))).catch(f=>{console.error("Failed to load texture: ",f);throw f;})}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 c=await this.GetBlob();
return e.Supports.ImageBitmapOptions?await createImageBitmap(c,{premultiplyAlpha:"none"}):e.Supports.ImageBitmap?await createImageBitmap(c):await e.BlobToImage(c)}}}
{"use strict";const e=self.C3;function b(a,c){return a.GetWorldInfo()._GetLastCachedZIndex()-c.GetWorldInfo()._GetLastCachedZIndex()}e.RenderCell=class extends e.DefendedBase{constructor(a,c,d){super();this._grid=a;this._x=c;this._y=d;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){e.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){e.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():(e.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 e=self.C3;e.RenderGrid=class extends e.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=e.New(e.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,c){let d=this._cells.Get(b,a);return d?d:c?(d=e.New(e.RenderCell,this,b,a),this._cells.Set(b,a,d),d):null}XToCell(b){return Math.floor(b/this._cellWidth)}YToCell(b){return Math.floor(b/this._cellHeight)}Update(b,a,c){if(a)for(let d=a.getLeft(),f=a.getRight();d<=f;++d)for(let h=
a.getTop(),g=a.getBottom();h<=g;++h){if(c&&c.containsPoint(d,h))continue;const l=this.GetCell(d,h,!1);l&&(l.Remove(b),l.IsEmpty()&&this._cells.Delete(d,h))}if(c)for(let d=c.getLeft(),f=c.getRight();d<=f;++d)for(let h=c.getTop(),g=c.getBottom();h<=g;++h)a&&a.containsPoint(d,h)||this.GetCell(d,h,!0).Insert(b)}QueryRange(b,a){let c=this.XToCell(b.getLeft());const d=this.YToCell(b.getTop()),f=this.XToCell(b.getRight());for(b=this.YToCell(b.getBottom());c<=f;++c)for(let h=d;h<=b;++h){const g=this.GetCell(c,
h,!1);g&&g.Dump(a)}}MarkRangeChanged(b){let a=b.getLeft();const c=b.getTop(),d=b.getRight();for(b=b.getBottom();a<=d;++a)for(let f=c;f<=b;++f){const h=this.GetCell(a,f,!1);h&&h.SetChanged()}}}}
{"use strict";const e=self.C3,b=new e.Rect,a=new e.Quad,c=[];new e.Rect;new e.Rect;const d=self.glMatrix,f=d.vec3,h=d.vec4,g=d.mat4,l=g.create(),m=f.create(),u=h.create(),v=f.create(),t=f.create(),q=f.create(),p=e.New(e.Vector2);e.New(e.Rect);function r(A,E){return A.GetWorldInfo()._GetLastCachedZIndex()-E.GetWorldInfo()._GetLastCachedZIndex()}function x(A,E){return A.GetWorldInfo().GetZElevation()-E.GetWorldInfo().GetZElevation()}const y=[],C=[],G=[];e.Layer=class extends e.DefendedBase{constructor(A,
E,J){super();this._layout=A;this._runtime=A.GetRuntime();this._parentLayer=E;this._name=J[0];this._index=-1;this._sid=J[2];this._isVisible=!!J[3];this._backgroundColor=e.New(e.Color);this._backgroundColor.setFromJSON(J[4].map(I=>I/255));this._isTransparent=!!J[5];this._parallaxX=J[6];this._parallaxY=J[7];this._color=e.New(e.Color,1,1,1,J[8]);this._premultipliedColor=e.New(e.Color);this._isForceOwnTexture=J[9];this._renderAs3d=J[17];this._useCameraDistanceDrawOrder=J[18];this._useRenderCells=J[10];
this._scaleRate=J[11];this._blendMode=J[12];this._curRenderTarget=null;this._scale=1;this._zElevation=J[16];this._scrollY=this._scrollX=this._angle=0;this._hasOwnScrollPosition=!1;this._viewport=e.New(e.Rect);this._viewportZ0=e.New(e.Rect);this._viewport3D=e.New(e.Rect);this._projectionMatrix=g.create();this._isProjectionMatrixChanged=!0;this._modelViewMatrix=g.create();this._isMVMatrixChanged=!0;this._viewFrustum=e.New(e.Gfx.ViewFrustum);this._isViewFrustumChanged=!0;this._startupInitialInstances=
[];this._initialInstancesData=J[14];this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;const B=this._runtime.GetCanvasManager();this._effectList=e.New(e.EffectList,this,J[15]);this._effectChain=e.New(e.Gfx.EffectChain,B.GetEffectChainManager(),{drawContent:(I,L)=>{L=L.GetContentObject();const P=L.GetRenderTarget();I.SetColor(L.GetPremultipliedColor());I.DrawRenderTarget(P);I.InvalidateRenderTarget(P);
B.ReleaseAdditionalRenderTarget(P)},getShaderParameters:I=>this.GetEffectList().GetEffectParametersForIndex(I)});this._wasDefaultColor=this._needsRebuildEffectChainSteps=!0;this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=e.New(e.Rect,0,0,-1,-1);this._curRenderCells=e.New(e.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this);this._UpdatePremultipliedColor();this.UsesRenderCells()&&(this._renderGrid=e.New(e.RenderGrid,this._runtime.GetOriginalViewportWidth(),
this._runtime.GetOriginalViewportHeight()));this._subLayers=J[19].map(I=>e.New(e.Layer,this._layout,this,I))}_Init(){for(const A of this._initialInstancesData){const E=this._runtime.GetObjectClassByIndex(A[1]);this._layout._AddInitialObjectClass(E);E.GetDefaultInstanceData()||(E.SetDefaultInstanceData(A),E._SetDefaultLayerIndex(this._index));this._initialInstances.push(A);this._initialUIDsToInstanceData.set(A[2],A)}e.shallowAssignArray(this._startupInitialInstances,this._initialInstances);this._initialInstancesData=
null}Release(){this._runtime=this._layout=null}GetInitialInstanceData(A){return this._initialUIDsToInstanceData.get(A)}CreateInitialInstances(A){const E=this._layout.IsFirstVisit();let J=0;const B=this._initialInstances;for(let L=0,P=B.length;L<P;++L){var I=B[L];const S=this._runtime.GetObjectClassByIndex(I[1]);let U=!0;if(!S.HasPersistBehavior()||E)I=this._runtime.CreateInstanceFromData(I,this,!0),A.push(I),S.IsGlobal()&&(U=!1,this._createdGlobalUids.push(I.GetUID()));U&&(B[J]=B[L],++J)}e.truncateArray(B,
J);this._runtime.FlushPendingInstances();this.SetZIndicesChanged()}_AddInstance(A,E){const J=A.GetWorldInfo();if(J.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.push(A);0!==J.GetZElevation()&&(this._anyInstanceZElevated=!0);E&&this.UsesRenderCells()&&A.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(A){this._instances.includes(A)||(this._instances.push(A),0!==A.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(A,
E){const J=A.GetWorldInfo();if(J.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(A);0!==J.GetZElevation()&&(this._anyInstanceZElevated=!0);this.SetZIndicesChanged();E&&this.UsesRenderCells()&&A.GetWorldInfo().SetBboxChanged()}_RemoveInstance(A,E){const J=this._instances.indexOf(A);0>J||(E&&this.UsesRenderCells()&&A.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(J,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=
!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(A){if(A){A=new Set;for(var E of this._instances){var J=E.GetWorldInfo()._GetLastCachedZIndex();0<=J&&A.add(J)}E=-1;for(const B of this._instances)if(J=B.GetWorldInfo(),!(0<=J._GetLastCachedZIndex())){for(++E;A.has(E);)++E;J._SetZIndex(E)}}this._instances.sort(r)}_Start(){}_End(){for(const A of this._instances)A.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(A);
this._runtime.FlushPendingInstances();e.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(A,E,J,B,I){const L=this._runtime.GetEventSheetManager(),P=this._runtime.GetAllObjectClasses(),S=A.IsFamily(),U=[];for(const la of this._initialInstances){var V=la[0];if(E.containsPoint(V[0],V[1])){V=P[la[1]];if(V!==A)if(S){if(!A.FamilyHasMember(V))continue}else continue;V=this;var Z=this._runtime.GetCurrentLayout();this.GetLayout()!==Z&&((V=Z.GetLayerByName(this.GetName()))||
(V=Z.GetLayerByIndex(this.GetIndex())));Z=this._runtime.CreateInstanceFromData(la,V,!1,void 0,void 0,!1,I);V.SortAndAddInstancesByZIndex(Z);V=Z.GetWorldInfo();V.OffsetXY(J,B);V.SetBboxChanged();L.BlockFlushingInstances(!0);Z._TriggerOnCreatedOnSelfAndRelated();L.BlockFlushingInstances(!1);U.push(Z)}}return U}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}_SetIndex(A){this._index=A}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}_MaybeRebuildEffectChainSteps(){const A=this.HasDefaultColor();if(this._needsRebuildEffectChainSteps||A!==this._wasDefaultColor){var E=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(E.map(J=>J.GetShaderProgram()),{indexMap:E.map(J=>J.GetIndex()),forcePreDraw:!A,useFullSurface:!0});this._needsRebuildEffectChainSteps=!1;this._wasDefaultColor=A}}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();this._needsRebuildEffectChainSteps=!0}UsesRenderCells(){return this._useRenderCells&&
!this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=!1}IsVisible(){for(const A of this.selfAndParentLayers())if(!A._IsVisibleFlagSet())return!1;return!0}_IsVisibleFlagSet(){return this._isVisible}SetVisible(A){A=!!A;this._isVisible!==A&&(this._isVisible=A,this._runtime.UpdateRender())}SetOwnScrollPositionEnabled(A){A=!!A;if(this._hasOwnScrollPosition!==A){if(this._hasOwnScrollPosition=A)A=this.GetLayout(),this._scrollX=A.GetScrollX(),
this._scrollY=A.GetScrollY();this._SetMVMatrixChanged();this._runtime.UpdateRender()}}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(A){var E=this.GetLayout();const J=E.GetScrollLeftBound();E=E.GetScrollRightBound();A>E&&(A=E);A<J&&(A=J);this._scrollX!==A&&(this._scrollX=A,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}SetScrollY(A){var E=this.GetLayout();const J=E.GetScrollTopBound();E=E.GetScrollBottomBound();A>E&&(A=E);A<
J&&(A=J);this._scrollY!==A&&(this._scrollY=A,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}GetScrollX(){return this.IsOwnScrollPositionEnabled()?this._scrollX:this.GetLayout().GetScrollX()}GetScrollY(){return this.IsOwnScrollPositionEnabled()?this._scrollY:this.GetLayout().GetScrollY()}GetViewport(){return this._viewport}GetViewport3D(){return this._viewport3D}_GetVanishingPoint(){const A=this.GetLayout();return[A.GetVanishingPointX(),A.GetVanishingPointY()]}GetViewportForZ(A,
E){var J=this._viewportZ0;if(0===A)E.copy(J);else{let P=J.midX(),S=J.midY();var B=this.Get2DScaleFactorToZ(A);const U=J.width()/B;J=J.height()/B;const [V,Z]=this._GetVanishingPoint();if(.5!==V||.5!==Z){const la=this.GetCameraZ();var I=this._runtime,L=100/la;B=(V-.5)*I.GetViewportWidth()/L;I=(Z-.5)*I.GetViewportHeight()/L;L=this.GetAngle();0!==L&&(p.set(B,I),p.rotate(L),B=p.getX(),I=p.getY());A=e.unlerp(la,0,A);P+=e.lerp(B,0,A);S+=e.lerp(I,0,A)}E.set(P-U/2,S-J/2,P+U/2,S+J/2)}}GetOpacity(){return this._color.getA()}SetOpacity(A){A=
e.clamp(A,0,1);this._color.getA()!==A&&(this._color.setA(A),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(A){this._scaleRate!==A&&(this._scaleRate=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(A,
E){if(this._parallaxX!==A||this._parallaxY!==E)if(this._parallaxX=A,this._parallaxY=E,this._SetMVMatrixChanged(),this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const J of this._instances)J.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(A){this.SetParallax(A,this.GetParallaxY())}SetParallaxY(A){this.SetParallax(this.GetParallaxX(),A)}SetZElevation(A){this._zElevation!==A&&(this._zElevation=A,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(A){A=
e.clampAngle(A);this._angle!==A&&(this._angle=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetAngle(){return e.clampAngle(this._layout.GetAngle()+this._angle)}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}_GetInstancesInDrawOrder(){return this.RendersIn3DMode()&&this._useCameraDistanceDrawOrder?(e.shallowAssignArray(G,this._GetInstances()),G.sort((A,E)=>this._SortInstancesByCameraDistance(A,E)),G):this._GetInstances()}_AppendAllInstancesIncludingSubLayersInDrawOrder(A){e.appendArray(A,
this._GetInstancesInDrawOrder());for(const E of this._subLayers)E.IsVisible()&&0<E.GetOpacity()&&E._AppendAllInstancesIncludingSubLayersInDrawOrder(A)}_SortInstancesByCameraDistance(A,E){var J=this.GetLayout().Get3DCameraPosition(),B=J[0],I=J[1];J=J[2];var L=A.GetWorldInfo();const P=E.GetWorldInfo();E=L.GetX()-B;A=L.GetY()-I;L=L.GetZElevation()-J;B=P.GetX()-B;I=P.GetY()-I;J=P.GetZElevation()-J;return B*B+I*I+J*J-(E*E+A*A+L*L)}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(A){A=
!!A;this._isTransparent!==A&&(this._isTransparent=A,this._runtime.UpdateRender())}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(A){A=!!A;this._isForceOwnTexture!==A&&(this._isForceOwnTexture=A,this._runtime.UpdateRender())}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()||!this._renderAs3d}RendersIn3DMode(){return!this.RendersIn2DMode()}Has3DCamera(){return this.RendersIn3DMode()&&this.GetLayout().Is3DCameraEnabled()}SelfAndAllSubLayersHave3DCamera(){if(!this.Has3DCamera())return!1;
for(const A of this._subLayers)if(!A.SelfAndAllSubLayersHave3DCamera())return!1;return!0}SetBlendMode(A){this._blendMode!==A&&(this._blendMode=A,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}IsRootLayer(){return!this._parentLayer}GetParentLayer(){return this._parentLayer}GetSubLayers(){return this._subLayers}HasAnySubLayers(){return 0<this._subLayers.length}HasAnyVisibleSubLayer(){for(const A of this._subLayers)if(A.ShouldDraw())return!0;return!1}*selfAndAllSubLayers(){for(const A of this._subLayers)yield*A.selfAndAllSubLayers();
yield this}*parentLayers(){let A=this.GetParentLayer();for(;A;)yield A,A=A.GetParentLayer()}*selfAndParentLayers(){yield this;yield*this.parentLayers()}IsTransformCompatibleWith(A){return this===A||this._parallaxX===A._parallaxX&&this._parallaxY===A._parallaxY&&this._scale===A._scale&&this._scaleRate===A._scaleRate&&this._angle===A._angle&&this.GetScrollX()===A.GetScrollX()&&this.GetScrollY()===A.GetScrollY()}SaveTransform(){return{parallaxX:this.GetParallaxX(),parallaxY:this.GetParallaxY(),scale:this.GetOwnScale(),
scaleRate:this.GetScaleRate(),angle:this.GetOwnAngle(),hasOwnScroll:this.IsOwnScrollPositionEnabled(),scrollX:this.GetScrollX(),scrollY:this.GetScrollY()}}RestoreTransform(A){this.SetParallax(A.parallaxX,A.parallaxY);this.SetOwnScale(A.scale);this.SetScaleRate(A.scaleRate);this.SetAngle(A.angle);this.SetOwnScrollPositionEnabled(A.hasOwnScroll);this.SetScrollX(A.scrollX);this.SetScrollY(A.scrollY)}_RemoveAllInstancesInSet(A){0!==A.size&&0<e.arrayRemoveAllInSet(this._instances,A)&&(this._MaybeResetAnyInstanceZElevatedFlag(),
this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){this._instances.sort(x);if(this.UsesRenderCells())for(let A=0,E=this._instances.length;A<E;++A){const J=this._instances[A].GetWorldInfo();J._SetZIndex(A);this._renderGrid.MarkRangeChanged(J.GetRenderCellRange())}else for(let A=0,E=this._instances.length;A<E;++A)this._instances[A].GetWorldInfo()._SetZIndex(A);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(A,
E,J){var B=A.GetWorldInfo();E=E.GetWorldInfo();if(B.GetLayer()!==this||E.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");B=B.GetZIndex();E=E.GetZIndex();if(B===E+(J?1:-1))return!1;e.arrayRemove(this._instances,B);B<E&&E--;J&&E++;E===this._instances.length?this._instances.push(A):this._instances.splice(E,0,A);this.SetZIndicesChanged();return!0}_MergeSortedZArrays(A,E){const J=[];let B=0,I=0,L=A.length,P=E.length;for(;B<L&&I<P;){const S=A[B],U=E[I];S.GetWorldInfo()._GetLastCachedZIndex()<
U.GetWorldInfo()._GetLastCachedZIndex()?(J.push(S),++B):(J.push(U),++I)}for(;B<L;++B)J.push(A[B]);for(;I<P;++I)J.push(E[I]);return J}_MergeAllSortedZArrays_pass(A){const E=[],J=A.length;for(let B=0;B<J-1;B+=2)E.push(this._MergeSortedZArrays(A[B],A[B+1]));1===J%2&&E.push(A[J-1]);return E}_MergeAllSortedZArrays(A){for(;1<A.length;)A=this._MergeAllSortedZArrays_pass(A);return A[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();e.clearArray(c);this._renderGrid.QueryRange(this._viewport,c);return c.length?
1===c.length?c[0]:this._MergeAllSortedZArrays(c):[]}ShouldDraw(){return this.IsVisible()&&0<this.GetOpacity()&&this._DrawsAnyContentInSelfOrSubLayers()}_DrawsAnyContentInSelfOrSubLayers(){if(this.HasInstances()||!this.IsTransparent())return!0;for(const A of this._subLayers)if(A._DrawsAnyContentInSelfOrSubLayers())return!0;return!1}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||0!==this.GetBlendMode()||this._effectList.HasAnyActiveEffect()}SelfOrAnySubLayerUsesOwnTexture(){if(this.UsesOwnTexture())return!0;
for(const A of this._subLayers)if(A.SelfOrAnySubLayerUsesOwnTexture())return!0;return!1}GetRenderTarget(){return this._curRenderTarget}Get2DScaleFactorToZ(A){if(this._layout.IsOrthographicProjection())return 1;{const E=this.GetCameraZ();return E/(E-A)}}GetCameraZ(){return 100/this.GetNormalScale()}_SetMVMatrixChanged(){this._isViewFrustumChanged=this._isMVMatrixChanged=!0}_GetModelViewMatrix(A){this._isMVMatrixChanged&&(this._CalculateModelViewMatrix(A,this._modelViewMatrix,0,0,null),this._isMVMatrixChanged=
!1);return this._modelViewMatrix}GetCameraPosition(){if(this.Has3DCamera()){const A=this.GetLayout().Get3DCameraPosition();return[A[0],A[1],A[2]]}return this._Get2DCameraPosition()}_Get2DCameraPosition(A=0,E=0){var J=this._runtime,B=this.GetLayout(),I=J.GetRenderScale(),L=J.GetParallaxXOrigin(),P=J.GetParallaxYOrigin();L=(this.GetScrollX()-L)*this._parallaxX+L;P=(this.GetScrollY()-P)*this._parallaxY+P;J.IsPixelRoundingEnabled()&&(L=Math.round(L),P=Math.round(P));A=(L+A)*I;E=(P+E)*I;B=B.IsOrthographicProjection()?
100:this.GetCameraZ();const [S,U]=this._GetVanishingPoint();if(.5!==S||.5!==U)L=100/B,P=(S-.5)*J.GetViewportWidth()*I/L,J=(U-.5)*J.GetViewportHeight()*I/L,I=this.GetAngle(),0!==I&&(p.set(P,J),p.rotate(I),P=p.getX(),J=p.getY()),A+=P,E+=J;return[A,E,B]}_CalculateModelViewMatrix(A,E,J,B,I){const L=this._runtime;var P=this.GetLayout();const S=L.GetRenderScale();if(this.Has3DCamera()){f.copy(v,P.Get3DCameraPosition());f.copy(t,P.Get3DCameraLookAt());f.copy(q,P.Get3DCameraUpVector());J=L.GetParallaxXOrigin();
B=L.GetParallaxYOrigin();P=t[0]-v[0];const U=t[1]-v[1],V=t[2]-v[2];v[0]=(v[0]-J)*this._parallaxX+J;v[1]=(v[1]-B)*this._parallaxY+B;v[2]*=Math.max(this._parallaxX,this._parallaxY);t[0]=v[0]+P;t[1]=v[1]+U;t[2]=v[2]+V;f.set(m,S,S,1);f.multiply(v,v,m);f.multiply(t,t,m)}else{const [U,V,Z]=this._Get2DCameraPosition(J,B);f.set(v,U,V,Z);f.set(t,U,V,Z-100);J=this.GetAngle();0===J?f.set(q,0,1,0):f.set(q,Math.sin(J),Math.cos(J),0)}A.CalculateLookAtModelView(E,v,t,q,I||L.GetCanvasManager().GetDrawHeight());1!==
S&&(f.set(m,S,S,1),g.scale(E,E,m))}_SetProjectionMatrixChanged(){this._isViewFrustumChanged=this._isProjectionMatrixChanged=!0}_GetProjectionMatrix(A){this._isProjectionMatrixChanged&&(this._CalculateProjectionMatrix(A),this._isProjectionMatrixChanged=!1);return this._projectionMatrix}_CalculateProjectionMatrix(A){var E=this._runtime.GetCanvasManager();const [J,B]=this._GetVanishingPoint();if(this._layout.IsOrthographicProjection())A.CalculateOrthographicMatrix(this._projectionMatrix,E.GetDrawWidth(),
E.GetDrawHeight());else if(.5===J&&.5===B)g.copy(this._projectionMatrix,E.GetDefaultProjectionMatrix());else{const I=E.GetDrawWidth();E=E.GetDrawHeight();A.CalculatePerspectiveMatrix(this._projectionMatrix,I/E,J,B)}}_SetTransform(A,E=!0,J=0,B=0,I=0){E&&A.SetProjectionMatrix(this._GetProjectionMatrix(A));0===J&&0===B&&0===I?E=this._GetModelViewMatrix(A):(this._CalculateModelViewMatrix(A,l,J,B,I),E=l);A.SetModelViewMatrix(E)}PrepareForDraw(A){this._SetTransform(A);A.SetBaseZ(this.GetZElevation())}Draw(A,
E,J){var B=this._runtime.GetCanvasManager();const I=this.UsesOwnTexture();var L=null;let P=null;if(this._runtime.IsGPUProfiling())if(A.IsWebGL()){const S=B.GetLayerTimingsBuffer(this);S&&(P=S.AddTimeElapsedQuery(),A.StartQuery(P))}else A.IsWebGPU()&&A.WriteTimestamp(2*(this.GetIndex()+1));I?(L={sampling:this._runtime.GetSampling()},"low"===B.GetCurrentFullscreenScalingQuality()&&(L.width=B.GetDrawWidth(),L.height=B.GetDrawHeight()),this._curRenderTarget=L=this._runtime.GetAdditionalRenderTarget(L),
A.SetRenderTarget(L),this.IsTransparent()&&A.ClearRgba(0,0,0,0)):(this._curRenderTarget=E,A.SetRenderTarget(E));this.IsTransparent()||A.Clear(this._backgroundColor);this._layout._DrawLayerList(A,this._curRenderTarget,this._subLayers,I&&this.IsTransparent());this._SetTransform(A);A.SetBaseZ(this.GetZElevation());A.SetDepthEnabled(this.RendersIn3DMode());this.GetNormalScale()>Number.EPSILON&&(this._UpdateZIndices(),B=this.UsesRenderCells()&&0===this.GetZElevation()&&!this._anyInstanceZElevated,this.Has3DCamera()?
this._DrawInstances_3DCamera(A):B?this._DrawInstances_RenderCells(A):this._DrawInstances(A,this._GetInstancesInDrawOrder()));A.SetBaseZ(0);A.SetCurrentZ(0);I&&(A.SetDepthEnabled(!1),this._DrawLayerOwnTextureToRenderTarget(A,L,E,J));P&&A.EndQuery(P);this._runtime.IsGPUProfiling()&&A.IsWebGPU()&&A.WriteTimestamp(2*(this.GetIndex()+1)+1);this._curRenderTarget=null}_DrawInstances(A,E){const J=this._viewport,B=this._curRenderTarget,I=this.GetLayout().IsOrthographicProjection(),L=this.GetLayout().HasVanishingPointOutsideViewport();
let P=null;for(let S=0,U=E.length;S<U;++S){const V=E[S];if(V===P)continue;P=V;const Z=V.GetWorldInfo();Z.IsVisible()&&Z.IsInViewport(J,L,I)&&this._DrawInstanceMaybeWithEffects(V,Z,A,B)}}_DrawInstances_3DCamera(A){const E=this._curRenderTarget,J=this._GetViewFrustum(),B=this._GetInstancesInDrawOrder();for(let S=0,U=B.length;S<U;){var I=B[S],L=I.GetWorldInfo();if(!L.IsVisible()||!L.IsInViewport3D(J)){++S;continue}(!I.RendersToOwnZPlane()||0<L.GetDepth())&&C.push(I);var P=I.GetWorldInfo().GetTotalZElevation();
y.push(I);let V=S+1;for(;V<U;++V){const Z=B[V],la=Z.GetWorldInfo();if(la.IsVisible()&&la.IsInViewport3D(J)){if(la.GetTotalZElevation()!==P)break;Z.RendersToOwnZPlane()?(0<la.GetDepth()&&C.push(Z),y.push(Z)):C.push(Z)}}if(1!==y.length||y[0].MustMitigateZFighting()){this._DrawCoplanarInstances_3DCamera(A,y);for(let Z=0,la=C.length;Z<la;++Z)I=C[Z],L=I.GetWorldInfo(),L._SetDrawNonBackFacesOnly(!0),this._DrawInstanceMaybeWithEffects(I,L,A,E),L._SetDrawNonBackFacesOnly(!1)}else{this._DrawInstanceMaybeWithEffects(I,
L,A,E);for(let Z=0,la=C.length;Z<la;++Z)L=C[Z],L!==I&&(P=L.GetWorldInfo(),P.GetLayer()._DrawInstanceMaybeWithEffects(L,P,A,E))}S=V;e.clearArray(y);e.clearArray(C)}}_DrawCoplanarInstances_3DCamera(A,E){const J=this._curRenderTarget;A.CoplanarStartStencilPass();for(let L=0,P=E.length;L<P;++L){var B=E[L],I=B.GetWorldInfo();I._SetDrawBackFaceOnly(!0);this._DrawInstance(B,I,A)}A.CoplanarStartColorPass();for(let L=0,P=E.length;L<P;++L)B=E[L],I=B.GetWorldInfo(),this._DrawInstanceMaybeWithEffects(B,I,A,J),
I._SetDrawBackFaceOnly(!1);A.CoplanarRestoreStandardRendering()}_DrawInstances_RenderCells(A){var E=this._renderGrid;const J=this._curRenderCells,B=this._lastRenderCells,I=this._viewport;J.set(E.XToCell(I.getLeft()),E.YToCell(I.getTop()),E.XToCell(I.getRight()),E.YToCell(I.getBottom()));this._isRenderListUpToDate&&J.equals(B)?E=this._lastRenderList:(E=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,B.copy(J));this._DrawInstances(A,E);E!==this._lastRenderList&&e.shallowAssignArray(this._lastRenderList,
E)}_DrawInstanceMaybeWithEffects(A,E,J,B){E.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(A,E,J,B):this._DrawInstance(A,E,J)}_DrawInstance(A,E,J){E=E.GetRendererStateGroup();J.GetCurrentStateGroup()!==E&&E.Apply();A.Draw(J)}_DrawInstanceWithEffectsAndRestore(A,E,J,B){this._DrawInstanceWithEffects(A,E,J,B,null)&&this._SetTransform(J)}_DrawInstanceWithEffects(A,E,J,B,I){const L=E.GetInstanceEffectList().GetEffectChain();L.Render(J,B,{contentObject:A,blendMode:E.GetBlendMode(),devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),
layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetNormalScale(),layerAngle:this.GetAngle(),layoutRect:E.GetBoundingBox(),drawSurfaceRect:L.IsFastPath()?null:this._InstanceBoxToDrawSurface(E),drawContentHook:I&&I.drawContentHook,compositOffX:I&&I.compositOffX,compositOffY:I&&I.compositOffY,updateOwnProjection:I&&I.updateOwnProjection});J.SetBaseZ(this.GetZElevation());return L.DidChangeTransform()}_DrawLayerOwnTextureToRenderTarget(A,E,J,B){const I=this._effectList.GetActiveEffectTypes(),
L=this._runtime;0===I.length?(A.SetRenderTarget(J),A.SetTextureFillMode(),B&&0===this._blendMode&&this.HasDefaultColor()?A.CopyRenderTarget(E):(A.SetBlendMode(this._blendMode),A.SetColor(this._premultipliedColor),A.DrawRenderTarget(E)),A.InvalidateRenderTarget(E),L.ReleaseAdditionalRenderTarget(E)):this.GetEffectChain().Render(A,J,{contentObject:this,blendMode:this.GetBlendMode(),devicePixelRatio:L.GetEffectDevicePixelRatioParam(),layerScale:L.GetEffectLayerScaleParam()*this.GetNormalScale(),layerAngle:this.GetAngle(),
layoutRect:this.GetViewport(),drawSurfaceRect:null,invalidateRenderTargets:!0})}GetOwnScale(){return this._scale}SetOwnScale(A){this._scale!==A&&(this._scale=A,this._layout.BoundScrolling(),this._SetMVMatrixChanged(),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(){var A=
this._runtime.GetParallaxXOrigin(),E=this._runtime.GetParallaxYOrigin(),J=(this.GetScrollX()-A)*this._parallaxX+A,B=(this.GetScrollY()-E)*this._parallaxY+E;A=this.GetNormalScale();E=this._runtime.GetViewportWidth()/A;A=this._runtime.GetViewportHeight()/A;J-=E/2;let I=B-A/2;this._runtime.IsPixelRoundingEnabled()&&(J=Math.round(J),I=Math.round(I));B=this._viewportZ0;B.set(J,I,J+E,I+A);E=this.GetAngle();0!==E&&(b.copy(B),b.offset(-B.midX(),-B.midY()),a.setFromRotatedRect(b,E),a.getBoundingBox(b),b.offset(B.midX(),
B.midY()),B.copy(b));E=this._zElevation;this.GetViewportForZ(E,this._viewport);this.Has3DCamera()?this.CalculateViewport3D(E,this._viewport3D):this._viewport3D.copy(this._viewport)}CalculateViewport3D(A,E){var J=this._runtime.GetCanvasManager(),B=J.GetCssWidth();J=J.GetCssHeight();const [I,L]=this.CanvasCssToLayer(0,0,A),[P,S]=this.CanvasCssToLayer(B,0,A),[U,V]=this.CanvasCssToLayer(B,J,A),[Z,la]=this.CanvasCssToLayer(0,J,A);A=Math.min(I,P,U,Z);B=Math.min(L,S,V,la);J=Math.max(I,P,U,Z);let va=Math.max(L,
S,V,la);isFinite(A)||(A=-Infinity);isFinite(B)||(B=-Infinity);isFinite(J)||(J=Infinity);isFinite(va)||(va=Infinity);E.set(A,B,J,va)}CanvasCssToLayer(A,E,J=0){return this._CanvasToLayer(A,E,J,this.GetDisplayScale())}DrawSurfaceToLayer(A,E,J=0){return this._CanvasToLayer(A,E,J,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(A,E,J,B){var I=this._runtime,L=I.GetRenderer();const P=this.GetNormalScale(),S=I.GetViewportWidth()/P;I=I.GetViewportHeight()/P;h.set(u,0,0,S,I);A/=B;E=u[3]-E/B;
B=this._GetProjectionMatrix(L);L=this._GetModelViewMatrix(L);return e.Gfx.UnprojectScreenToWorldZ(A,E,J,L,B,u,m)?[m[0],m[1]]:[NaN,NaN]}CanvasCssToLayer_DefaultTransform(A,E){const J=this._scale,B=this._scaleRate,I=this._parallaxX,L=this._parallaxY,P=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;this._SetMVMatrixChanged();A=this.CanvasCssToLayer(A,E);this._scale=J;this._scaleRate=B;this._parallaxX=I;this._parallaxY=L;this._angle=P;this._SetMVMatrixChanged();
return A}LayerToCanvasCss(A,E,J=0){return this._LayerToCanvas(A,E,J,this.GetDisplayScale())}LayerToDrawSurface(A,E,J=0){return this._LayerToCanvas(A,E,J,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(A,E,J,B){var I=this._runtime,L=I.GetRenderer();const P=this.GetNormalScale();var S=I.GetViewportWidth()/P;I=I.GetViewportHeight()/P;h.set(u,0,0,S,I);S=this._GetProjectionMatrix(L);L=this._GetModelViewMatrix(L);return e.Gfx.Project(A,E,J,L,S,u,m)?[m[0]*B,(u[3]-m[1])*B]:[NaN,NaN]}_GetLayerToDrawSurfaceScale(A,
E){A*=this.GetRenderScale()*this.GetDevicePixelRatio();0!==E&&(A*=this.Get2DScaleFactorToZ(E));return A}_InstanceBoxToDrawSurface(A){var E=A.GetBoundingBox(),J=A.GetTotalZElevation();A=A.GetDepth();const B=J+A,I=E.getLeft(),L=E.getTop(),P=E.getRight();E=E.getBottom();if(this.Has3DCamera()){if(this._IsPointBehindNearPlane(I,L,J)||this._IsPointBehindNearPlane(P,L,J)||this._IsPointBehindNearPlane(P,E,J)||this._IsPointBehindNearPlane(I,E,J)||0<A&&(this._IsPointBehindNearPlane(I,L,B)||this._IsPointBehindNearPlane(P,
L,B)||this._IsPointBehindNearPlane(P,E,B)||this._IsPointBehindNearPlane(I,E,B)))return null}else if(B>=this.GetCameraZ())return null;let [S,U]=this.LayerToDrawSurface(I,L,J),[V,Z]=this.LayerToDrawSurface(P,E,J);if(0!==this.GetAngle()||0<A){const [la,va]=this.LayerToDrawSurface(P,L,J),[Na,za]=this.LayerToDrawSurface(I,E,J);if(0<A){const [Ha,Ja]=this.LayerToDrawSurface(I,L,B),[Aa,ya]=this.LayerToDrawSurface(P,L,B),[na,Ta]=this.LayerToDrawSurface(P,E,B),[wa,Ba]=this.LayerToDrawSurface(I,E,B);J=Math.min(S,
V,la,Na,Ha,Aa,na,wa);V=Math.max(S,V,la,Na,Ha,Aa,na,wa);S=J;J=Math.min(U,Z,va,za,Ja,ya,Ta,Ba);Z=Math.max(U,Z,va,za,Ja,ya,Ta,Ba);U=J}else J=Math.min(S,V,la,Na),V=Math.max(S,V,la,Na),S=J,J=Math.min(U,Z,va,za),Z=Math.max(U,Z,va,za),U=J}b.set(S,U,V,Z);return b}_GetViewFrustum(){this._isViewFrustumChanged&&(this._UpdateViewFrustum(),this._isViewFrustumChanged=!1);return this._viewFrustum}_UpdateViewFrustum(){var A=this._runtime.GetRenderer();const E=this._GetProjectionMatrix(A);A=this._GetModelViewMatrix(A);
this._viewFrustum.CalculatePlanes(A,E)}_IsPointBehindNearPlane(A,E,J){return this._GetViewFrustum().IsBehindNearPlane(A,E,J)}_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._IsVisibleFlagSet(),bc:this._backgroundColor.toJSON(),t:this.IsTransparent(),sx:this._scrollX,sy:this._scrollY,hosp:this._hasOwnScrollPosition,px:this.GetParallaxX(),py:this.GetParallaxY(),c:this._color.toJSON(),
sr:this.GetScaleRate(),fx:this._effectList.SaveToJson(),cg:this._createdGlobalUids}}_LoadFromJson(A){this._scale=A.s;this._angle=A.a;this._viewport.set(A.vl,A.vt,A.vr,A.vb);this._isVisible=!!A.v;this._backgroundColor.setFromJSON(A.bc);this._isTransparent=!!A.t;A.hasOwnProperty("sx")&&(this._scrollX=A.sx);A.hasOwnProperty("sy")&&(this._scrollY=A.sy);A.hasOwnProperty("hosp")&&(this._hasOwnScrollPosition=!!A.hosp);this._parallaxX=A.px;this._parallaxY=A.py;this._color.setFromJSON(A.c);this._scaleRate=
A.sr;e.shallowAssignArray(this._createdGlobalUids,A.cg);e.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const E=new Set(this._createdGlobalUids);let J=0;for(let B=0,I=this._initialInstances.length;B<I;++B)E.has(this._initialInstances[B][2])||(this._initialInstances[J]=this._initialInstances[B],++J);e.truncateArray(this._initialInstances,J);this._effectList.LoadFromJson(A.fx);this._needsRebuildEffectChainSteps=!0;this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}SortAndAddInstancesByZIndex(A){if(!this._instances.includes(A))if(A.HasChildren()){var E=
[...A.allChildren()];E.push(A);E.sort((B,I)=>{B=B.GetWorldInfo().GetSceneGraphZIndex();I=I.GetWorldInfo().GetSceneGraphZIndex();return B-I});for(var J of E)if(J.IsInContainer())for(const B of J.siblings())E.includes(B)||(A=[...B.allChildren()],A.push(B),A.sort((I,L)=>{I=I.GetWorldInfo().GetSceneGraphZIndex();L=L.GetWorldInfo().GetSceneGraphZIndex();return I-L}),A&&A.length&&E.splice(E.length,0,...A));for(const B of E)this._AddInstance(B,!0)}else if(this._AddInstance(A,!0),A.IsInContainer())for(E of A.siblings())if(J=
[...E.allChildren()],J.push(E),J.sort((B,I)=>{B=B.GetWorldInfo().GetSceneGraphZIndex();I=I.GetWorldInfo().GetSceneGraphZIndex();return B-I}),J&&J.length)for(const B of J)this._AddInstance(B,!0)}}}
{"use strict";const e=self.C3,b=self.C3Debugger;e.New(e.Rect);e.New(e.Rect);const a=e.New(e.Rect),c=e.New(e.Color),d=self.glMatrix.vec3,f=[],h=[],g=[],l=[];function m(t,q,p,r){return t[0]===Math.fround(q)&&t[1]===Math.fround(p)&&t[2]===Math.fround(r)}let u=null;function v(t,q){u!==t&&(t.PrepareForDraw(q),u=t)}e.Layout=class extends e.DefendedBase{constructor(t,q,p){super();this._layoutManager=t;this._runtime=t.GetRuntime();this._name=p[0];this._originalWidth=p[1];this._originalHeight=p[2];this._width=
p[1];this._height=p[2];this._isUnboundedScrolling=!!p[3];this._isOrthographicProjection=!!p[4];this._vanishingPointX=p[5];this._vanishingPointY=p[6];this._eventSheetName=p[7];this._eventSheet=null;this._sid=p[8];this._index=q;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._is3dCameraEnabled=!1;this._cam3dposition=d.create();
this._cam3dlook=d.create();this._cam3dup=d.create();this._rootLayers=[];this._allLayersFlat=[];this._layersByName=new Map;this._layersBySid=new Map;const r=this._runtime.GetCanvasManager();this._effectList=e.New(e.EffectList,this,p[11]);this._effectChain=e.New(e.Gfx.EffectChain,r.GetEffectChainManager(),{drawContent:(x,y)=>{y=y.GetContentObject().GetRenderTarget();x.ResetColor();x.DrawRenderTarget(y);x.InvalidateRenderTarget(y);r.ReleaseAdditionalRenderTarget(y)},getShaderParameters:x=>this.GetEffectList().GetEffectParametersForIndex(x)});
this._needsRebuildEffectChainSteps=!0;this._wasFullScreenQualityLow=!1;this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=e.New(e.Event.Dispatcher);for(const x of p[9])this._rootLayers.push(e.New(e.Layer,this,null,x));this._allLayersFlat=[...this.allLayers()];for(let x=0,y=this._allLayersFlat.length;x<y;++x)t=this._allLayersFlat[x],t._SetIndex(x),t._Init(),this._layersByName.set(t.GetName().toLowerCase(),t),this._layersBySid.set(t.GetSID(),
t);for(const x of p[10]){p=this._runtime.GetObjectClassByIndex(x[1]);if(!p)throw Error("missing nonworld object class");p.GetDefaultInstanceData()||p.SetDefaultInstanceData(x);this._initialNonWorld.push(x);this._AddInitialObjectClass(p)}}Release(){for(const t of this._allLayersFlat)t.Release();e.clearArray(this._allLayersFlat);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}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}_MaybeRebuildEffectChainSteps(){const t="low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality();if(this._needsRebuildEffectChainSteps||this._wasFullScreenQualityLow!==t){var q=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(q.map(p=>p.GetShaderProgram()),{indexMap:q.map(p=>p.GetIndex()),forcePostDraw:t,useFullSurface:!0});this._needsRebuildEffectChainSteps=!1;this._wasFullScreenQualityLow=t}}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();
this._needsRebuildEffectChainSteps=!0}GetMinLayerScale(){let t=this._allLayersFlat[0].GetNormalScale();for(let q=1,p=this._allLayersFlat.length;q<p;++q){const r=this._allLayersFlat[q];if(0!==r.GetParallaxX()||0!==r.GetParallaxY())t=Math.min(t,r.GetNormalScale())}return t}_GetScrollBoundMarginHorizontal(){return.5*this._runtime.GetViewportWidth()/this.GetMinLayerScale()}_GetScrollBoundMarginVertical(){return.5*this._runtime.GetViewportHeight()/this.GetMinLayerScale()}GetScrollLeftBound(){return this.IsUnboundedScrolling()?
-Infinity:this._GetScrollBoundMarginHorizontal()}GetScrollRightBound(){return this.IsUnboundedScrolling()?Infinity:this.GetWidth()-this._GetScrollBoundMarginHorizontal()}GetScrollTopBound(){return this.IsUnboundedScrolling()?-Infinity:this._GetScrollBoundMarginVertical()}GetScrollBottomBound(){return this.IsUnboundedScrolling()?Infinity:this.GetHeight()-this._GetScrollBoundMarginVertical()}SetScrollX(t){const q=this.GetScrollLeftBound(),p=this.GetScrollRightBound();t>p&&(t=p);t<q&&(t=q);this._scrollX!==
t&&(this._scrollX=t,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(t){const q=this.GetScrollTopBound(),p=this.GetScrollBottomBound();t>p&&(t=p);t<q&&(t=q);this._scrollY!==t&&(this._scrollY=t,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}IsUnboundedScrolling(){return this._isUnboundedScrolling}BoundScrolling(){this.SetScrollX(this.GetScrollX());this.SetScrollY(this.GetScrollY());for(const t of this._allLayersFlat)t.IsOwnScrollPositionEnabled()&&
(t.SetScrollX(t.GetScrollX()),t.SetScrollY(t.GetScrollY()))}SetVanishingPointXY(t,q){if(this._vanishingPointX!==t||this._vanishingPointY!==q)this._vanishingPointX=t,this._vanishingPointY=q,this.IsPerspectiveProjection()&&(this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetVanishingPointX(){return this.IsOrthographicProjection()?.5:this._vanishingPointX}GetVanishingPointY(){return this.IsOrthographicProjection()?.5:this._vanishingPointY}HasVanishingPointOutsideViewport(){const t=
this.GetVanishingPointX(),q=this.GetVanishingPointY();return 0>t||1<t||0>q||1<q}SetPerspectiveProjection(){this._isOrthographicProjection&&(this._isOrthographicProjection=!1,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}SetOrthographicProjection(){this._isOrthographicProjection||(this._isOrthographicProjection=!0,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}IsOrthographicProjection(){return this._isOrthographicProjection}IsPerspectiveProjection(){return!this.IsOrthographicProjection()}Set3DCameraEnabled(t){t=
!!t;this._is3dCameraEnabled!==t&&(this._is3dCameraEnabled=t,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}Is3DCameraEnabled(){return this._is3dCameraEnabled}Set3DCameraOrientation(t,q,p,r,x,y,C,G,A){m(this._cam3dposition,t,q,p)&&m(this._cam3dlook,r,x,y)&&m(this._cam3dup,C,G,A)||(d.set(this._cam3dposition,t,q,p),d.set(this._cam3dlook,r,x,y),d.set(this._cam3dup,C,G,A),this.Set3DCameraChanged())}Set3DCameraChanged(){this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Get3DCameraPosition(){return this._cam3dposition}Get3DCameraLookAt(){return this._cam3dlook}Get3DCameraUpVector(){return this._cam3dup}GetScale(){return this._scale}SetScale(t){this._scale!==
t&&(this._scale=t,this._SetAllLayersMVChanged(),this.BoundScrolling(),this._runtime.UpdateRender())}SetAngle(t){t=e.clampAngle(t);this._angle!==t&&(this._angle=t,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(t){!isFinite(t)||1>t||(this._width=t)}GetHeight(){return this._height}SetHeight(t){!isFinite(t)||1>t||(this._height=t)}GetEventSheet(){return this._eventSheet}*allLayers(){for(const t of this._rootLayers)yield*t.selfAndAllSubLayers()}GetLayers(){return this._allLayersFlat}GetLayerCount(){return this._allLayersFlat.length}GetLayer(t){return"number"===
typeof t?this.GetLayerByIndex(t):this.GetLayerByName(t.toString())}GetLayerByIndex(t){t=e.clamp(Math.floor(t),0,this._allLayersFlat.length-1);return this._allLayersFlat[t]}GetLayerByName(t){return this._layersByName.get(t.toLowerCase())||null}GetLayerBySID(t){return this._layersBySid.get(t)||null}_SetAllLayersProjectionChanged(){for(const t of this._allLayersFlat)t._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const t of this._allLayersFlat)t._SetMVMatrixChanged()}SaveTransform(){return{scrollX:this.GetScrollX(),
scrollY:this.GetScrollY(),scale:this.GetScale(),angle:this.GetAngle(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY()}}RestoreTransform(t){this.SetScrollX(t.scrollX);this.SetScrollY(t.scrollY);this.SetScale(t.scale);this.SetAngle(t.angle);this.SetVanishingPointXY(t.vpX,t.vpY)}GetLayoutBackgroundColor(){let t=this._rootLayers.filter(q=>q.ShouldDraw())[0];for(;t;){if(!t.IsTransparent())return c.copyRgb(t.GetBackgroundColor()),c.setA(1),c;if(t.UsesOwnTexture())return c.setRgba(0,0,0,0),c;
t=t.GetSubLayers().filter(q=>q.ShouldDraw())[0]}c.setRgba(0,0,0,0);return c}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(t){if(t.IsInContainer())for(const q of t.GetContainer().GetObjectTypes())this._initialObjectClasses.add(q);else this._initialObjectClasses.add(t)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(t,q){if(t===this||!q)return Promise.resolve();t&&(e.CopySet(this._textureLoadedTypes,
t._textureLoadedTypes),t._textureLoadedTypes.clear());t=[];for(const p of this._initialObjectClasses)this._textureLoadedTypes.has(p)||(t.push(p.LoadTextures(q)),this._textureLoadedTypes.add(p));return Promise.all(t)}async MaybeLoadTexturesFor(t){if(t.IsFamily())throw Error("cannot load textures for family");var q=this._runtime.GetRenderer();!q||q.IsContextLost()||this._textureLoadedTypes.has(t)||(this._textureLoadedTypes.add(t),q=t.LoadTextures(q),this._AddPendingTextureLoadPromise(q),await q,t.OnDynamicTextureLoadComplete(),
this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(t){this._textureLoadPendingPromises.add(t);t.then(()=>this._textureLoadPendingPromises.delete(t)).catch(()=>this._textureLoadPendingPromises.delete(t))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(t){if(t.IsFamily()||0<t.GetInstanceCount())throw Error("cannot unload textures");const q=this._runtime.GetRenderer();q&&this._textureLoadedTypes.has(t)&&(this._textureLoadedTypes.delete(t),
t.ReleaseTextures(q))}_Unload(t,q){if(t!==this&&q)for(const p of this._textureLoadedTypes)p.IsGlobal()||t._initialObjectClasses.has(p)||(p.ReleaseTextures(),this._textureLoadedTypes.delete(p))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(t){const q=this._runtime,p=this._layoutManager,r=q.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=r.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());p._SetMainRunningLayout(this);this._width=
this._originalWidth;this._height=this._originalHeight;this._scrollX=q.GetOriginalViewportWidth()/2;this._scrollY=q.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(t);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();p.ClearPendingChangeLayout();q.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);
const x=this._runtime.GetCreatePromises();await Promise.all(x);e.clearArray(x);if(!q.IsLoadingState()){for(const y of this._createdInstances)y.SetupInitialSceneGraphConnections();for(const y of this._createdInstances)y._TriggerOnCreated()}e.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(y=>y.PreloadTexturesWithInstances(this._runtime.GetRenderer())));t&&(q.Dispatcher().dispatchEvent(new e.Event("beforefirstlayoutstart")),await q.DispatchUserScriptEventAsyncWait(new e.Event("beforeprojectstart")));
await this.DispatchUserScriptEventAsyncWait(new e.Event("beforelayoutstart"));q.IsLoadingState()||await q.TriggerAsync(e.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new e.Event("afterlayoutstart"));t&&(q.Dispatcher().dispatchEvent(new e.Event("afterfirstlayoutstart")),await q.DispatchUserScriptEventAsyncWait(new e.Event("afterprojectstart")));r._RunQueuedTriggers(p);await this.WaitForPendingTextureLoadsToComplete();this._SetAllLayersProjectionChanged();
this._SetAllLayersMVChanged();this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(t){for(const p of this._runtime.GetAllObjectClasses())if(!p.IsFamily()&&p.IsWorldType())for(const r of p.GetInstances()){const x=r.GetWorldInfo();var q=x.GetLayer();q=e.clamp(q.GetIndex(),0,this._allLayersFlat.length-1);q=this._allLayersFlat[q];x._SetLayer(q);q._MaybeAddInstance(r)}if(!t)for(const p of this._allLayersFlat)p._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const t of this._allLayersFlat)t.CreateInitialInstances(this._createdInstances),
t.UpdateViewport(),t._Start()}_CreatePersistedInstances(){let t=!1;for(const [p,r]of Object.entries(this._persistData)){const x=this._runtime.GetObjectClassBySID(parseInt(p,10));if(x&&!x.IsFamily()&&x.HasPersistBehavior()){for(const y of r){var q=null;if(x.IsWorldType()&&(q=this.GetLayerBySID(y.w.l),!q))continue;q=this._runtime.CreateInstanceFromData(x,q,!1,0,0,!0);q.LoadFromJson(y);t=!0;this._createdInstances.push(q)}e.clearArray(r)}}for(const p of this._allLayersFlat)p._SortInstancesByLastCachedZIndex(!0),
p.SetZIndicesChanged();t&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(t){for(const p of t){if(!p.IsInContainer())continue;const r=p.GetWorldInfo(),x=p.GetIID();for(const y of p.GetObjectClass().GetContainer().objectTypes())if(y!==p.GetObjectClass()){var q=y.GetInstances();q.length>x?p._AddSibling(q[x]):(q=r?this._runtime.CreateInstanceFromData(y,r.GetLayer(),!0,r.GetX(),r.GetY(),!0):this._runtime.CreateInstanceFromData(y,null,!0,0,0,!0),
this._runtime.FlushPendingInstances(),y._UpdateIIDs(),p._AddSibling(q),t.push(q))}}}_CreateInitialNonWorldInstances(){for(const t of this._initialNonWorld)this._runtime.GetObjectClassByIndex(t[1]).IsInContainer()||this._runtime.CreateInstanceFromData(t,null,!0)}_CreateGlobalNonWorlds(){const t=[],q=this._initialNonWorld;let p=0;for(let r=0,x=q.length;r<x;++r){const y=q[r],C=this._runtime.GetObjectClassByIndex(y[1]);C.IsGlobal()?C.IsInContainer()&&C.GetContainer().HasAnyWorldType()||t.push(this._runtime.CreateInstanceFromData(y,
null,!0)):(q[p]=y,++p)}e.truncateArray(q,p);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(t)}RecreateInitialObjects(t,q,p,r,x,y){if(p)return p.RecreateInitialObjects(t,q,r,x,y);p=[];for(const C of this._allLayersFlat)p.push(C.RecreateInitialObjects(t,q,r,x,y));return p.flat()}async _StopRunning(){const t=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(e.Plugins.System.Cnds.OnLayoutEnd,null,null);t.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();
this._isFirstVisit||this._SavePersistData();for(const q of this._allLayersFlat)q._End();for(const q of this._runtime.GetAllObjectClasses())if(!(q.IsGlobal()||q.IsWorldType()||q.GetPlugin().IsSingleGlobal()||q.IsFamily())){for(const p of q.GetInstances())this._runtime.DestroyInstance(p);this._runtime.FlushPendingInstances()}t.SetIsEndingLayout(!1);t.GetMainRunningLayout()===this&&t._SetMainRunningLayout(null)}_SaveInstanceToPersist(t){const q=t.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(q)||
(this._persistData[q]=[]);this._persistData[q].push(t.SaveToJson())}_SavePersistData(){for(const t of this._allLayersFlat){t._UpdateZIndices();for(const q of t._GetInstances()){const p=q.GetObjectClass();!p.IsGlobal()&&p.HasPersistBehavior()&&this._SaveInstanceToPersist(q)}}}ResetPersistData(){this._persistData={};this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){const t=this._runtime,q=t.GetRenderer().IsWebGL();return"low"===t.GetCanvasManager().GetCurrentFullscreenScalingQuality()||
q&&t.UsesAnyBackgroundBlending()||"low-latency"===t.GetCompositingMode()||this._effectList.HasAnyActiveEffect()||q&&t.Uses3DFeatures()}Draw(t){const q=this._runtime.GetCanvasManager(),p=this.UsesOwnTexture();if(p){"low-latency"!==this._runtime.GetCompositingMode()&&(t.SetRenderTarget(null),t.ClearRgba(0,0,0,0));const r={sampling:this._runtime.GetSampling(),isSampled:t.IsWebGPU()||this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()};"low"===q.GetCurrentFullscreenScalingQuality()&&
(r.width=q.GetDrawWidth(),r.height=q.GetDrawHeight());this._curRenderTarget=this._runtime.GetAdditionalRenderTarget(r)}else this._curRenderTarget=null;t.SetRenderTarget(this._curRenderTarget);t.Clear(this.GetLayoutBackgroundColor());this._runtime.Uses3DFeatures()&&t.ClearDepth();for(const r of this._allLayersFlat)r.UpdateViewport();this._DrawLayerList(t,this._curRenderTarget,this._rootLayers,!0);p&&(t.SetDepthEnabled(!1),this._DrawLayoutOwnTextureToRenderTarget(t,this._curRenderTarget));this._curRenderTarget=
null}_DrawLayerList(t,q,p,r){p=p.filter(x=>x.ShouldDraw());for(let x=0,y=p.length;x<y;){const C=p[x];if(C.SelfAndAllSubLayersHave3DCamera()&&!C.SelfOrAnySubLayerUsesOwnTexture()){f.push(C);for(let G=x+1;G<y;++G){const A=p[G];if(A.SelfAndAllSubLayersHave3DCamera()&&!A.SelfOrAnySubLayerUsesOwnTexture())f.push(p[G]);else break}if(2<=f.length||1===f.length&&f[0].HasAnyVisibleSubLayer()){this._Draw3DLayers(t,q,f);x+=f.length;e.clearArray(f);continue}e.clearArray(f)}C.Draw(t,q,r&&0===x);++x}}_DrawLayoutOwnTextureToRenderTarget(t,
q){const p=this._effectList.GetActiveEffectTypes(),r=this._runtime;0===p.length?(t.SetRenderTarget(null),t.SetTextureFillMode(),t.CopyRenderTarget(q),t.InvalidateRenderTarget(q),r.ReleaseAdditionalRenderTarget(q)):(a.set(0,0,r.GetViewportWidth(),r.GetViewportHeight()),this.GetEffectChain().Render(t,null,{contentObject:this,blendMode:3,devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetScale(),layerAngle:this.GetAngle(),layoutRect:a,
drawSurfaceRect:null,invalidateRenderTargets:!0}))}_Draw3DLayers(t,q,p){p[0].IsTransparent()||(c.copyRgb(p[0].GetBackgroundColor()),c.setA(1),t.Clear(c));var r=this._runtime.GetCanvasManager();t.SetDepthEnabled(!0);for(var x of p)x._UpdateZIndices(),x._AppendAllInstancesIncludingSubLayersInDrawOrder(h);p=p[0];x=null;if(this._runtime.IsGPUProfiling())if(t.IsWebGL()){if(r=r.GetLayerTimingsBuffer(p))x=r.AddTimeElapsedQuery(),t.StartQuery(x)}else t.IsWebGPU()&&t.WriteTimestamp(2*(p.GetIndex()+1));for(let E=
0,J=h.length;E<J;){var y=h[E],C=y.GetWorldInfo(),G=C.GetLayer();if(C.IsVisible()&&C.IsInViewport3D(G._GetViewFrustum())){(!y.RendersToOwnZPlane()||0<C.GetDepth())&&l.push(y);var A=y.GetWorldInfo().GetTotalZElevation();g.push(y);for(r=E+1;r<J;++r){const B=h[r],I=B.GetWorldInfo();if(I.IsVisible()&&I.IsInViewport3D(I.GetLayer()._GetViewFrustum())){if(I.GetTotalZElevation()!==A)break;B.RendersToOwnZPlane()?(0<I.GetDepth()&&l.push(B),g.push(B)):l.push(B)}}if(1!==g.length||g[0].MustMitigateZFighting()){this._Draw3DLayersCoplanarInstances(t,
q,g);for(let B=0,I=l.length;B<I;++B)y=l[B],C=y.GetWorldInfo(),G=C.GetLayer(),C._SetDrawNonBackFacesOnly(!0),v(G,t),G._DrawInstanceMaybeWithEffects(y,C,t,q),C._SetDrawNonBackFacesOnly(!1)}else{v(G,t);G._DrawInstanceMaybeWithEffects(y,C,t,q);for(let B=0,I=l.length;B<I;++B)C=l[B],C!==y&&(G=C.GetWorldInfo(),A=G.GetLayer(),v(A,t),A._DrawInstanceMaybeWithEffects(C,G,t,q))}E=r;e.clearArray(g);e.clearArray(l)}else++E}x&&t.EndQuery(x);this._runtime.IsGPUProfiling()&&t.IsWebGPU()&&t.WriteTimestamp(2*(p.GetIndex()+
1)+1);e.clearArray(h);u=null}_Draw3DLayersCoplanarInstances(t,q,p){t.CoplanarStartStencilPass();for(let C=0,G=p.length;C<G;++C){var r=p[C],x=r.GetWorldInfo(),y=x.GetLayer();x._SetDrawBackFaceOnly(!0);v(y,t);y._DrawInstance(r,x,t)}t.CoplanarStartColorPass();for(let C=0,G=p.length;C<G;++C)r=p[C],x=r.GetWorldInfo(),y=x.GetLayer(),v(y,t),y._DrawInstanceMaybeWithEffects(r,x,t,q),x._SetDrawBackFaceOnly(!1);t.CoplanarRestoreStandardRendering()}_SaveToJson(){const t={sx:this.GetScrollX(),sy:this.GetScrollY(),
s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),ortho:this.IsOrthographicProjection(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(),layers:{}};for(const q of this._allLayersFlat)t.layers[q.GetSID().toString()]=q._SaveToJson();return t}_LoadFromJson(t){this._scrollX=t.sx;this._scrollY=t.sy;this._scale=t.s;this._angle=t.a;this._width=t.w;this._height=t.h;this._isOrthographicProjection=
!!t.ortho;t.hasOwnProperty("vpX")&&(this._vanishingPointX=t.vpX);t.hasOwnProperty("vpY")&&(this._vanishingPointY=t.vpY);this._isFirstVisit=!!t.fv;this._persistData=t.persist;this._effectList.LoadFromJson(t.fx);this._needsRebuildEffectChainSteps=!0;for(const [q,p]of Object.entries(t.layers))t=parseInt(q,10),(t=this.GetLayerBySID(t))&&t._LoadFromJson(p);this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged()}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(t){t.layout=
this.GetILayout();var q=this._runtime;(q=q.IsDebug()&&!q.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(t);q&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(t){t.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(t)}}}
{"use strict";const e=self.C3;e.LayoutManager=class extends e.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;e.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear();
e.clearArray(this._runningSubLayouts)}Create(b){b=e.New(e.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=e.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}SetAllLayerProjectionChanged(){const b=this.GetMainRunningLayout();b&&b._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const b=this.GetMainRunningLayout();b&&b._SetAllLayersMVChanged()}}}
{"use strict";const e=self.C3,b=/<(.+?)>/g;e.TimelineManager=class extends e.DefendedBase{constructor(a){super();this._runtime=a;this._timelineDataManager=e.New(e.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._markedForRemovalTimelines=[];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=c=>this._OnInstanceDestroy(c.instance);this._afterLoad=c=>this._OnAfterLoad();this._destroyedWhileLoadingState=[];this._renderChange=0}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();e.clearArray(this._timelines);this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;e.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;e.clearArray(this._playingTimelines);this._playingTimelines=null;e.clearArray(this._markedForRemovalTimelines);this._markedForRemovalTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();
this._timelinesCreatedByTemplate=null;e.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=e.TimelineState.CreateInitial(a,this);this.Add(a);this.SetTimelineObjectClassesToMap(a);this._timelinesCreatedByTemplate.set(a.GetName(),
0)}CreateFromTemplate(a){var c=this.GetTimelineDataManager();a=a.GetTemplateName();c=c.Get(a);c=e.TimelineState.CreateFromTemplate(`${a}:${this._timelinesCreatedByTemplate.get(a)}`,c,this);this._IncreaseTemplateTimelinesCount(a);this.Add(c);return c}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const c=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(c)}}_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.Removed();a.IsTemplate()||(e.arrayFindRemove(this._timelines,a),e.arrayFindRemove(this._scheduledTimelines,a),e.arrayFindRemove(this._playingTimelines,a),e.arrayFindRemove(this._markedForRemovalTimelines,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,c){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set);this._objectClassToTimelineMap.get(a).add(c)}SetTimelineObjectClassesToMap(a){for(const c of a.GetObjectClasses())this.SetTimelineObjectClassToMap(c,a)}RemoveTimelineFromObjectClassMap(a){for(const [c,d]of this._objectClassToTimelineMap.entries())d.has(a)&&(d.delete(a),0===d.size&&
this._objectClassToTimelineMap.delete(c))}GetTimelinesForObjectClass(a){if(this._objectClassToTimelineMap.has(a))return this._objectClassToTimelineMap.get(a)}GetTimelineOfTemplateForInstances(a,c){if(c)for(const d of this._timelines)if(c.every(f=>d.HasTrackInstance(f.instance,f.trackId))&&d.GetName().includes(a.GetName()))return d}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const c of this._scheduledTimelines)if(c.GetName()===
a)return c;for(const c of this._playingTimelines)if(c.GetName()===a)return c;return null}*GetTimelinesByName(a){if(b.test(a)){b.lastIndex=0;let d;var c=new Set;do if(d=b.exec(a)){const f=d[1].split(",");for(const h of f)c.add(h)}while(d);for(const f of c.values())(a=this.GetTimelineByName(f))&&(yield a);c.clear()}else(c=this.GetTimelineByName(a))&&(yield c)}*GetTimelinesByTags(a){for(const c of this._timelines)c.HasTags(a)&&(yield c)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a);
this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){e.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();
e.arrayFindRemove(this._scheduledTimelines,a);this._MaybeDisableRuntimeListeners()}CompleteTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!0);this._markedForRemovalTimelines.push(a);e.arrayFindRemove(this._playingTimelines,a)}CompleteTimelineBeforeChangeOfLayout(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!1);a.SetPlaybackRate(1);e.arrayFindRemove(this._playingTimelines,a)}CompleteTimelineAndResolve(a){this.CompleteTimeline(a);a.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&&
this._hasRuntimeListeners&&!this._changingLayout){for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var a=this._scheduledTimelines.pop();a.SetInitialState();0!==a.GetRenderChange()&&(this._renderChange=1);this._playingTimelines.push(a)}a=this._runtime._GetDtFast();var c=this._runtime.GetDt1(),d=this._runtime.GetTimeScale();for(let f=this._playingTimelines.length-1;0<=f;f--)this._playingTimelines[f].Tick(a,d,c);this._isTickingTimelines=!1;0!==this._renderChange&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&
this._hasRuntimeListeners&&!this._changingLayout){var a;for(let c=0,d=this._markedForRemovalTimelines.length;c<d;c++){const f=this._markedForRemovalTimelines[c];a||(a=new Set);f.Removed();this._MaybeExecuteTimelineFinishTriggers(f);a.add(f)}if(a){e.arrayRemoveAllInSet(this._markedForRemovalTimelines,a);this._renderChange=0;for(let c=0,d=this._playingTimelines.length;c<d;c++)if(0!==this._playingTimelines[c].GetRenderChange()){this._renderChange=1;break}}this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(a){a.IsReleased()||
a.HasValidTracks()&&a.IsComplete()&&a.InitialStateSet()&&a.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._markedForRemovalTimelines.length||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 c of this._playingTimelines)c._OnBeforeChangeLayout()&&(c.Removed(),a.add(c));e.arrayRemoveAllInSet(this._playingTimelines,a);a.clear();for(const c of this._markedForRemovalTimelines)c._OnBeforeChangeLayout()&&(c.Removed(),a.add(c));e.arrayRemoveAllInSet(this._markedForRemovalTimelines,a);this._MaybeDisableRuntimeListeners();for(const c of this._timelines)c.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(a){var c=a.GetObjectClass();if(c=this.GetTimelinesForObjectClass(c))if(this._runtime.IsLoadingState())this._destroyedWhileLoadingState.push(a);
else for(const d of c)d.IsTemplate()||(d.IsReleased()?this.Remove(d):d.HasValidTracks()||(this._MaybeExecuteTimelineFinishTriggers(d),this.Remove(d)))}_OnAfterLoad(){for(const a of this._destroyedWhileLoadingState)this._OnInstanceDestroy(a);e.clearArray(this._destroyedWhileLoadingState)}_SaveToJson(){return{timelinesJson:this._SaveTimelinesToJson(),scheduledTimelinesJson:this._SaveScheduledTimelinesToJson(),playingTimelinesJson:this._SavePlayingTimelinesToJson(),markedForRemovalTimelinesJson:this._SaveMarkedForRemovalTimelinesToJson(),
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._LoadMarkedForRemovalTimelinesFromJson(a.markedForRemovalTimelinesJson),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 c of a){a=this.GetTimelineByName(c.name);if(!a){a=this._GetTemplateNameFromJson(c);if(!a)continue;a=this.GetTimelineByName(a);a=this.CreateFromTemplate(a)}a._LoadFromJson(c);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)}_SaveMarkedForRemovalTimelinesToJson(){return this._SaveTimelines(this._markedForRemovalTimelines)}_LoadMarkedForRemovalTimelinesFromJson(a){this._LoadTimelines(a,
this._markedForRemovalTimelines)}_IsTimelineInJson(a,c){for(const d of c)if(d===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map(c=>c.GetName())}_LoadTimelines(a,c){var d=new Set;for(const f of c)this._IsTimelineInJson(f,a)||d.add(f);e.arrayRemoveAllInSet(c,d);d=f=>h=>h.GetName()===f;for(const f of a)(a=this.GetTimelineByName(f))&&(c.find(d(f))||c.push(a))}}}
{"use strict";const e=self.C3;e.TimelineState=class extends e.DefendedBase{constructor(b,a,c){super();this._runtime=c.GetRuntime();this._timelineManager=c;this._timelineDataItem=a;this._name=b;this._tracks=[];this._tracksLength=0;this._beforeAndAfterTracks=null;this._beforeAndAfterTracksLength=0;this.CreateTrackStates();this._playResolve=this._playPromise=null;this._playheadTime=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;this._hasNestedContent=this._renderChange=0}static CreateInitial(b,a){var c=a.GetTimelineDataManager();const d=c.GetNameId();c=c.Get(b[d]);b=e.New(e.TimelineState,b[d],c,a);b.SetIsTemplate(!0);return b}static CreateFromTemplate(b,a,c){return e.New(e.TimelineState,
b,a,c)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this);this._timelineManager.CompleteTimelineAndResolve(this);for(const b of this._tracks)b.Release();e.clearArray(this._tracks);this._timelineDataItem=this._timelineManager=this._runtime=this._tracks=null;this._released=!0;this._playResolve=this._playPromise=null}}CreateTrackStates(){for(const b of this._timelineDataItem.GetTrackData().trackDataItems())this._tracksLength=this._tracks.push(e.TrackState.Create(this,b))}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(b,
a,c){if(this._hasNestedContent){var d;for(let h=0;h<this._tracks.length;h++){var f=this._tracks[h];b===f.GetInstance()&&(f=f.GetPropertyTrack(c))&&a.constructor===f.GetSourceAdapter().constructor&&(d||(d=[]),d.push(f))}return d}}HasTracks(){return!!this._tracks.length}GetTrackById(b){for(const a of this._tracks)if(e.equalsNoCase(a.GetId(),b))return a;return null}GetTrackByName(b){for(const a of this._tracks)if(!a.IsInstanceTrack()&&e.equalsNoCase(a.GetName(),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=e.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=e.TimelineState._GetTagArray(b))&&b.length?b.every(e.TimelineState._HasTag,this):!1:!1}OnStarted(){e.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnAnyTimelineStarted);
e.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,e.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnAnyTimelineFinished),
e.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}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._SetUpdateStateBefore();this._Interpolate(b,!1,!0,!0,a);this._SetUpdateStateAfter();this._renderChange&&this.GetRuntime().UpdateRender();
this._OnSetTime()}_SetTime(b){0>b?this._playheadTime=0:b>=this.GetTotalTime()?this._playheadTime=this.GetTotalTime():this._playheadTime=b}_OnSetTime(){e.Plugins.Timeline&&this.constructor===e.TimelineState&&(e.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSetByTags),e.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 c=this.GetTime();this._SetUpdateStateBefore();a?this._InterpolateBeforeChangeLayout(c):this._Interpolate(c,!1,!1,!0);b&&this._OnSetTime();this._SetUpdateStateAfter();this._renderChange&&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.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(b){if(!this.IsMarkedForRemoval()){if(b){this._firstTick=this._initialStateSet=!0;this._SetUpdateStateBefore();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());this._SetUpdateStateBefore();for(const a of this._tracks)a.SetInitialState()}else{this._firstTick=!0;this._SetUpdateStateBefore();for(const a of this._tracks)a.SetResumeState()}this._SetUpdateStateAfter()}}GetRenderChange(){return this._renderChange}_SetUpdateStateBefore(){this._hasNestedContent=
0;for(const b of this._tracks)b.IsNested()&&(this._hasNestedContent=1)}_SetUpdateStateAfter(){this._renderChange=0;for(const b of this._tracks)b._SetUpdateState(),0===this._renderChange&&1===b.GetRenderChange()&&(this._renderChange=1),this._beforeAndAfterTracks||1!==b.GetNeedsBeforeAndAfter()||(this._beforeAndAfterTracks||(this._beforeAndAfterTracks=[]),this._beforeAndAfterTracksLength=this._beforeAndAfterTracks.push(b))}Tick(b,a,c){if(0!==b||0!==this._lastDelta){this._lastDelta=b;c=this._playheadTime;
a=c+b*a*this._playbackRate;b=this._timelineDataItem._totalTime;this._playheadTime=0>a?0:a>=b?b:a;var d=!1;a=this.GetLoop();var f=this.GetPingPong();a||f?a&&!f?0<this._playbackRate?this._playheadTime>=b&&this._SetTime(0):0>=this._playheadTime&&this._SetTime(b):!a&&f?0<this._playbackRate?this._playheadTime>=b&&(this._SetTime(b),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):d=!0:
0===this._pingPongState&&(this._pingPongState=1)):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):d=!0:0===this._pingPongState&&(this._pingPongState=1)):a&&f&&(0<this._playbackRate?this._playheadTime>=b&&(this._SetTime(b),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()))):
0<this._playbackRate?this._playheadTime>=b&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTime(0)):(this._SetTime(b),d=!0)):0>=this._playheadTime&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTime(b)):(this._SetTime(0),d=!0));a=this._tracksLength;if(d){for(d=0;d<a;d++)this._tracks[d].SetEndState();this.Stop(!0);this.OnCompleted()}else{f=this._beforeAndAfterTracksLength;for(d=0;d<f;d++)this._beforeAndAfterTracks[d].BeforeInterpolate();
if(1===this._hasNestedContent)for(d=0;d<a;d++){const h=this._tracks[d],g=h.GetStartOffset(),l=c-g;0>this._playheadTime-g&&0<l?(this._playheadTime=0>g?0:g>=b?b:g,h.Interpolate(g,!0,!1,!1,this._firstTick,!1)):h.Interpolate(this._playheadTime,!0,!1,!1,this._firstTick,!1)}else for(d=0;d<a;d++)this._tracks[d].Interpolate(this._playheadTime,!0,!1,!1,this._firstTick,!1);for(d=0;d<f;d++)this._beforeAndAfterTracks[d].AfterInterpolate();this._firstTick&&(this._firstTick=!1)}}}_Interpolate(b,a=!1,c=!1,d=!1,
f=NaN,h=!1,g=!1){for(var l of this._tracks)l.BeforeInterpolate();for(const m of this._tracks){l=b;if("number"===typeof f){const u=this.GetTime()-m.GetStartOffset(),v=f-m.GetStartOffset();0>u&&0<v&&(l=m.GetStartOffset(),this._SetTime(l))}m.Interpolate(l,a,c,d,this._firstTick,g)}for(const m of this._tracks)m.AfterInterpolate();this._firstTick&&h&&(this._firstTick=!1)}AddTrack(){var b=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();b=e.TrackState.Create(this,b);this._tracksLength=this._tracks.push(b);
return b}Removed(){if(!this.IsReleased())for(const b of this._tracks)b.TimelineRemoved()}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 c of this._tracks)if(c.IsInstanceTrack()){if(b){if(c.GetId()!==b)continue}else if(c.HasInstance())continue;c.SetInstance(a);this._timelineManager.SetTimelineObjectClassToMap(a.GetObjectClass(),this);break}}HasTrackInstance(b,a){for(const c of this._tracks)if(c.IsInstanceTrack())if(a){if(a===
c.GetId()&&b===c.GetInstance())return!0}else if(b===c.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some(b=>b.IsInstanceTrack()?b.CanInstanceBeValid():!0)}HasValidGlobalTracks(){return this._tracks.some(b=>b.IsInstanceTrack()?b.CanInstanceBeValid()?(b=b.GetObjectClass())?b.IsGlobal():!1:!1:!1)}GetPropertyTrack(b){for(const a of this.GetTracks())for(const c of a.GetPropertyTracks())if(c.GetPropertyName()===b)return c}GetTrackFromInstance(b){for(const a of this._tracks)if(b===
a.GetInstance())return a;return null}GetKeyframeWithTags(b){b=b?b.split(" "):[];b=[...(new Set(b.map(a=>a.toLowerCase().trim()))).values()];for(const a of this.GetTracks())for(const c of a.GetKeyframeDataItems())if(b.every(d=>c.HasTag(d)))return c}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=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,c)=>{this._tracks[c]._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(e.IsArray(b))return b.slice(0);
if(e.IsString(b))return b.split(" ")}}}
{"use strict";const e=self.C3;e.TrackState=class extends e.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=[];this.CreatePropertyTrackStates();
this._needsBeforeAndAfter=this._renderChange=this._worldInfoChange=0}static Create(b,a){return e.New(e.TrackState,b,a)}Release(){this._keyframeDataItems=null;for(const b of this._propertyTracks)b.Release();e.clearArray(this._propertyTracks);this._lastKeyframeDataItem=this._trackDataItem=this._worldInfo=this._instance=this._timeline=this._propertyTracks=null}CreatePropertyTrackStates(){for(const b of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(e.PropertyTrackState.Create(this,
b))}TimelineRemoved(){for(const b of this._propertyTracks)b.TimelineRemoved()}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(let a=
0;a<this._propertyTracks.length;a++){const c=this._propertyTracks[a];if(c.GetPropertyName()===b)return c}}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){if(!this.IsInstanceTrack())return!1;var b=this.GetInstanceUID();return(b=this.GetRuntime().GetInstanceByUID(b))?!b.IsDestroyed():!1}GetObjectClass(){if(this.IsInstanceTrack()){var 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 h of this.propertyTrackItems()){const g=
h.sourceAdapter;switch(h.propertyTrack.GetSourceAdapterId()){case "instance-variable":g.GetEditorIndex();var a=b.GetObjectClass(),c=a.GetInstanceVariableIndexByName(h.name),d=a.GetInstanceVariableName(c);a=a.GetInstanceVariableType(c);d===h.name&&a===h.type&&g.UpdateInstanceVariableIndex(c);break;case "behavior":var f=h.behaviorType;c=this.GetObjectClass();d=b.GetObjectClass();a=g.GetBehaviorType(d);f&&a&&(f=f.GetName(),c.GetBehaviorIndexByName(f),d.GetBehaviorIndexByName(f),g.GetEditorIndex(),g.UpdateBehaviorTypeSid(a.GetSID()))}}}}*propertyTrackItems(){for(const c of this._propertyTracks){var b=
c.GetSourceAdapter(),a=this.GetObjectClass();const d={propertyTrack:c,sourceAdapter:b};switch(c.GetSourceAdapterId()){case "world-instance":d.property=c.GetPropertyName();break;case "instance-variable":b=b.GetEditorIndex();d.name=a.GetInstanceVariableName(b);d.type=a.GetInstanceVariableType(b);break;case "effect":a=a.GetEffectList();b=b.GetEffectType(a);d.effectType=b;break;case "behavior":b=b.GetBehaviorType(a);d.behaviorType=b;break;case "plugin":d.plugin=a.GetPlugin()}yield d}}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()}SetLocalTotalTime(b){this._trackDataItem.SetLocalTotalTime(b)}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(){const b=this.GetInstance();return b&&b.GetSdkInstance().IsOriginalSizeKnown()?b.GetSdkInstance().GetOriginalWidth():
this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(b){this._trackDataItem.SetOriginalHeight(b)}GetOriginalHeight(){const b=this.GetInstance();return b&&b.GetSdkInstance().IsOriginalSizeKnown()?b.GetSdkInstance().GetOriginalHeight():this._trackDataItem.GetOriginalHeight()}GetType(){return this._trackDataItem.GetType()}GetName(){return this._trackDataItem.GetName()}IsInstanceTrack(){return 0===this.GetType()}IsValueTrack(){return 1===this.GetType()}IsAudioTrack(){return 2===this.GetType()}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}IsNested(){return this._isNested}SetInitialState(){this.MaybeGetInstance();
if(this.IsInstanceValid()||!this.IsInstanceTrack()){var b=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();for(const a of this._propertyTracks)a.SetInitialState(b),0===this._worldInfoChange&&1===a.GetWorldInfoChange()&&(this._worldInfoChange=1),0===this._renderChange&&1===a.GetRenderChange()&&(this._renderChange=1);this._needsBeforeAndAfter=0;this._propertyTracks.some(a=>a.GetNeedsBeforeAndAfter())&&(this._needsBeforeAndAfter=1);this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(b);
this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(b)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack()){this._timeline.IsForwardPlayBack();var b=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(b);for(const a of this._propertyTracks)a.SetResumeState(b)}}SetEndState(){if(!(this.GetTimeline().IsComplete()||(this.MaybeGetInstance(),!this.IsInstanceValid()&&this.IsInstanceTrack()||
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)}}_SetUpdateState(){for(let b=0,a=this._propertyTracks.length;b<a;b++){const c=this._propertyTracks[b];c._SetUpdateState();0===this._worldInfoChange&&1===c.GetWorldInfoChange()&&(this._worldInfoChange=1);0===this._renderChange&&1===c.GetRenderChange()&&(this._renderChange=1)}}BeforeInterpolate(){const b=this._propertyTracks.length;
for(let a=0;a<b;a++)this._propertyTracks[a].BeforeInterpolate()}Interpolate(b,a=!1,c=!1,d=!1,f=!1,h=!1){this._instance||this.GetInstance();const g=this._instance&&!this._instance.IsDestroyed(),l=0===this._trackDataItem._type;if(!(!g&&l||h&&l&&this.GetObjectClass().IsGlobal()||(b-=this.GetStartOffset(),0>b))){this.MaybeSetInitialStateOfNestedTrack(b,a);this.MaybeTriggerKeyframeReachedConditions(b,a,f);for(let m=0,u=this._propertyTracks.length;m<u;m++)this._propertyTracks[m].Interpolate(b,c,d);this.MaybeSetEndStateOfNestedTrack(b,
a);0!==this._worldInfoChange&&(this._worldInfo||(this._worldInfo=this._instance.GetWorldInfo()),this._worldInfo&&this._worldInfo.SetBboxChanged())}}AfterInterpolate(){const b=this._propertyTracks.length;for(let a=0;a<b;a++)this._propertyTracks[a].AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>b)return;for(const c of this._propertyTracks)c.Interpolate(0,!1,!0)}else{if(b>this.GetLocalTotalTime())return;
for(const c of this._propertyTracks)c.Interpolate(this.GetLocalTotalTime(),!1,!0)}for(const c of this._propertyTracks)c.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(b>=this.GetLocalTotalTime()){for(const c of this._propertyTracks)c.Interpolate(this.GetLocalTotalTime(),!1,!0);this._endStateOfNestedSet=!0}}else if(0>=b){for(const c of this._propertyTracks)c.Interpolate(0,
!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(b,a,c){if(!c&&a&&e.Plugins.Timeline){a=this.GetTimeline();c=this._lastKeyframeDataItem.GetNext();var d=this._lastKeyframeDataItem.GetTime(),f=c?c.GetTime():a.GetTotalTime();if(b<=d||b>=f)this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem),a.IsForwardPlayBack()?c&&this.OnKeyframeReached(this._lastKeyframeDataItem):this._lastKeyframeDataItem.GetNext()&&this.OnKeyframeReached(this._lastKeyframeDataItem)}}_GetLastKeyFrameBeforeTime(b){const a=
this._trackData.GetKeyFrameDataItemAtTime(b,this._trackDataItem);return a?a:this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem)}OnKeyframeReached(b){const a=this.GetTimeline();e.Plugins.Timeline.Cnds.SetTriggerTimeline(a);e.Plugins.Timeline.Cnds.SetTriggerKeyframe(b);b=a.GetTimelineManager();b.Trigger(e.Plugins.Timeline.Cnds.OnAnyKeyframeReached);b.Trigger(e.Plugins.Timeline.Cnds.OnKeyframeReached);e.Plugins.Timeline.Cnds.SetTriggerTimeline(null);e.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var b=
this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=e.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()||!this.IsInstanceTrack())for(const b of this._propertyTracks)b.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();
if(this.IsInstanceValid()||!this.IsInstanceTrack()){var b=!1;for(const a of this._propertyTracks){const c=a.CompareSaveStateWithCurrent();!b&&c&&(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,c)=>{this._propertyTracks[c]._LoadFromJson(a)})}_LoadInstanceFromJson(b){if(e.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 e=self.C3;e.PropertyTrackState=class extends e.DefendedBase{constructor(b,a){super();this._track=b;this._propertyTrackDataItem=a;this._propertyTrackData=a.GetPropertyTrackData();this._needsBeforeAndAfter=this._renderChange=this._worldInfoChange=0;this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();this._absoluteValueObject=this._lastPropertyKeyframeDataItem=null}static Create(b,
a){return e.New(e.PropertyTrackState,b,a)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}HasAbsoluteValueObject(){return!!this._absoluteValueObject}SetAbsoluteValueObject(b){this._absoluteValueObject=b}GetAbsoluteValueObject(){return this._absoluteValueObject}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 e.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":b=new e.PropertyTrackState.EffectSourceAdapter(this);this._renderChange=1;break;case "instance-variable":b=new e.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":b=new e.PropertyTrackState.PluginSourceAdapter(this);this._renderChange=1;break;case "world-instance":b=new e.PropertyTrackState.PropertySourceAdapter(this);this._worldInfoChange=
this._renderChange=1;break;case "value":b=new e.PropertyTrackState.ValueSourceAdapter(this);break;case "audio":b=new e.PropertyTrackState.AudioSourceAdapter(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)}CanHavePropertyKeyframes(){return this._propertyTrackDataItem.CanHavePropertyKeyframes()}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems?
this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const b of this.GetPropertyKeyframeDataItems())yield b.GetValueWithResultMode()}TimelineRemoved(){this.GetSourceAdapter().TimelineRemoved()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(b){this.GetSourceAdapter().SetInitialState();
this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(b);this._SetUpdateState()}SetResumeState(b){this.GetSourceAdapter().SetResumeState();this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(b)}_SetUpdateState(){var b=this.GetTrack();this._needsBeforeAndAfter=0;if(b.IsInstanceTrack()){var a=this.GetTimeline();b=b.GetInstance();const c=this.GetSourceAdapter(),d=this.GetPropertyName();c.MayNeedBeforeAndAfterInterpolate()?(a=a.GetSimilarPropertyTracks(b,c,
d))&&a.length&&(this._needsBeforeAndAfter=1):this._needsBeforeAndAfter=0}}_GetLastPropertyKeyFrameBeforeTime(b){const a=this.GetTimeline(),c=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(b,this._propertyTrackDataItem);return c?c:a.IsForwardPlayBack()?this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem):this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,this._propertyTrackDataItem)}BeforeInterpolate(){this._sourceAdapter.BeforeInterpolate()}Interpolate(b,
a=!1,c=!1){let d;if(a)var f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){var h=this.GetTimeline();const g=this._lastPropertyKeyframeDataItem.GetNext();f=this._lastPropertyKeyframeDataItem.GetTime();h=g?g.GetTime():h.GetTotalTime();if(b<=f||b>=h)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=
this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);f=this._lastPropertyKeyframeDataItem}f&&(d=f.GetNext());this._sourceAdapter.Interpolate(b,f,d,a,c)}GetInterpolatedValue(b){if(this._lastPropertyKeyframeDataItem){var a=this.GetTimeline();const d=this._lastPropertyKeyframeDataItem.GetNext();var c=this._lastPropertyKeyframeDataItem.GetTime();a=d?d.GetTime():a.GetTotalTime();if(b<=c||b>=a)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,
this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);c=this._lastPropertyKeyframeDataItem;a=c.GetNext();return this._sourceAdapter.GetInterpolatedValue(b,c,a)}AfterInterpolate(){this._sourceAdapter.AfterInterpolate()}static GetStartPropertyKeyframeForTime(b,a){const c=a.GetPropertyTrackDataItem();return a._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,c)}static GetEndPropertyKeyframeForTime(b,
a){const c=a.GetPropertyTrackDataItem();return a._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,c)}AddPropertyKeyframe(){const b=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;return b}DeletePropertyKeyframes(b){this._lastPropertyKeyframeDataItem=null;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(),c=e.PropertyTrackState.GetStartPropertyKeyframeForTime(b,this),d=
this.AddPropertyKeyframe();d.SetType(c.GetType());d.SetTime(b);d.SetEase(c.GetEase());d.SetEnable(!0);d.SetValue(a.GetValueAtTime());d.SetAbsoluteValue(a.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson)}}}
{"use strict";const e=self.C3.PropertyTrackState;e.PropertySourceAdapter=class{constructor(b){this._propertyTrack=b;this._propertyAdapter=null;this.GetPropertyAdapter()}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}MayNeedBeforeAndAfterInterpolate(){return this._propertyAdapter.MayNeedBeforeAndAfterInterpolate()}GetPropertyTrack(){return this._propertyTrack}TimelineRemoved(){this._propertyAdapter&&this._propertyAdapter.TimelineRemoved()}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._propertyAdapter.BeforeChangeProperty()}Interpolate(b,a,c,d,f){let h;switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":h=
e.NumericTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "angle":h=e.AngleTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "boolean":h=e.BooleanTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "color":h=e.ColorTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "text":h=e.TextTypeAdapter.Interpolate(b,a,c,this._propertyTrack)}this._propertyAdapter.ChangeProperty(b,h,a,c,d,f)}GetInterpolatedValue(b,a,c){switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":return e.NumericTypeAdapter.Interpolate(b,
a,c,this._propertyTrack);case "angle":return e.AngleTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "boolean":return e.BooleanTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "color":return e.ColorTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "text":return e.TextTypeAdapter.Interpolate(b,a,c,this._propertyTrack)}}AfterInterpolate(){this._propertyAdapter.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(){const b=
this._propertyTrack,a=b.GetTrack().GetTimeline().GetTime(),c=e.GetStartPropertyKeyframeForTime(a,b),d=c.GetNext();switch(b.GetPropertyKeyframeType()){case "numeric":return e.NumericTypeAdapter.Interpolate(a,c,d,b);case "angle":return e.AngleTypeAdapter.Interpolate(a,c,d,b);case "boolean":return e.BooleanTypeAdapter.Interpolate(a,c,d,b);case "color":return e.ColorTypeAdapter.Interpolate(a,c,d,b);case "text":return e.TextTypeAdapter.Interpolate(a,c,d,b)}}_CreatePropertyAdapter(){const b=this._propertyTrack;
switch(b.CanHavePropertyKeyframes()?b.GetPropertyKeyframeType():""){case "combo":case "boolean":case "text":case "string":return new e.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===this._propertyTrack.GetPropertyType()?new e.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new e.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new e.PropertyInterpolationAdapter.ColorInterpolationAdapter(this);
default:return new e.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetPropertyAdapter()._LoadFromJson(b.propertyAdapterJson)}}}
{"use strict";const e=self.C3;class b extends e.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,c,d,f,h){this.GetPropertyAdapter().CanChange(c.GetValue())&&super.Interpolate(a,c,d,f,h)}GetInterpolatedValue(a,c,d){if(this.GetPropertyAdapter().CanChange(c.GetValue()))return super.GetInterpolatedValue(a,c,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a.index)}}e.PropertyTrackState.InstanceVariableSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var a=this._propertyTrack.GetPropertyTrackDataItem(),c=this._propertyTrack.GetTrack();a=this._sid?this._sid:a.GetSourceAdapterArguments()[0];c=c.GetInstance();a=c.GetBehaviorIndexBySID(a);return c.GetBehaviorInstances()[a].GetSdkInstance()}GetBehaviorType(a){const c=
this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return a.GetBehaviorTypeByName(c)}UpdateBehaviorTypeSid(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._sid=a)}Interpolate(a,c,d,f,h){const g=this._propertyTrack.GetTrack().GetInstance();this.GetBehaviorType(g.GetObjectClass())&&super.Interpolate(a,c,d,f,h)}GetInterpolatedValue(a,c,d){const f=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(f.GetObjectClass()))return super.GetInterpolatedValue(a,
c,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._sid=a.sid)}}e.PropertyTrackState.BehaviorSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var c=a.GetEffectList();c=this.GetEffectType(c).GetIndex();return a.IsEffectIndexActive(c)?a.GetEffectParametersForIndex(c):null}GetEffectType(a){const c=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];
return a.GetEffectTypeByName(c)}Interpolate(a,c,d,f,h){this._IsEffectActive()&&super.Interpolate(a,c,d,f,h)}GetInterpolatedValue(a,c,d){if(this._IsEffectActive())return super.GetInterpolatedValue(a,c,d)}_IsEffectActive(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var c=a.GetEffectList();if(c=this.GetEffectType(c))return c=c.GetIndex(),a.IsEffectIndexActive(c)}}e.PropertyTrackState.EffectSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(a,c,d,f,h){var g=this._propertyTrack.GetTrack();const l=g.GetObjectClass().GetPlugin();g=g.GetInstance().GetObjectClass().GetPlugin();l===g&&super.Interpolate(a,c,d,f,h)}GetInterpolatedValue(a,
c,d){var f=this._propertyTrack.GetTrack();const h=f.GetObjectClass().GetPlugin();f=f.GetInstance().GetObjectClass().GetPlugin();if(h===f)return super.GetInterpolatedValue(a,c,d)}}e.PropertyTrackState.PluginSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._value=0;this._init=!1}MayNeedBeforeAndAfterInterpolate(){return!1}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let c=this._propertyTrack.GetPropertyTrackDataItem();c=a.GetFirstPropertyKeyframeDataItem(c);this._value=c.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(a,c,d,f,
h){this._value=e.PropertyTrackState.NumericTypeAdapter.Interpolate(a,c,d,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)}}e.PropertyTrackState.ValueSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._audioPlaybackStarted=!1;this._expressions=this._actions=this._sdkInstance=null;this._timeline=this._propertyTrack.GetTimeline();this._track=this._propertyTrack.GetTrack();this._sourceAdapterArgs=this._propertyTrack.GetSourceAdapterArgs();this._fileArgs=this._sourceAdapterArgs[0];this._startOffsetTime=this._sourceAdapterArgs[1];this._audioTag=this._sourceAdapterArgs[3]?this._sourceAdapterArgs[3]:
Math.random().toString(36).slice(2);this._volume=this._pauseVolume=this._pauseTime=NaN;this._audioSource=null;this._Initialize()}Release(){super.Release();this._audioSource=this._fileArgs=this._sourceAdapterArgs=this._track=this._timeline=this._expressions=this._actions=this._sdkInstance=null}_Initialize(){if(self.C3.Plugins.Audio){var a=this._propertyTrack.GetRuntime().GetObjectClassByName("audio");a&&(this._sdkInstance=a.GetSingleGlobalInstance().GetSdkInstance());this._actions=self.C3.Plugins.Audio.Acts;
this._expressions=self.C3.Plugins.Audio.Exps}}_MaybeSetAudioSource(){if(!this._audioSource){var a=this._propertyTrack.GetTrack().GetPropertyTrack("audioSource");a&&(this._audioSource=a.GetSourceAdapter())}}_GetPauseVolume(){const a=this._propertyTrack.GetTrack().GetPropertyTrack("volume");return a?a.GetSourceAdapter()._pauseVolume:this._pauseVolume}TimelineRemoved(){super.TimelineRemoved();this._audioPlaybackStarted=!1;this._sdkInstance&&(this._expressions&&(this._pauseTime=this._expressions.PlaybackTime.call(this._sdkInstance,
this._audioTag),this._pauseVolume=this._expressions.Volume.call(this._sdkInstance,this._audioTag)),this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag))}GetAudioTag(){return this._audioTag}GetVolume(){return this._volume}SetVolume(a){this._volume=a}SetInitialState(){super.SetInitialState();this._pauseTime=NaN;this._audioPlaybackStarted=!1}SetResumeState(){super.SetResumeState();const a=this._propertyTrack.GetTimeline().GetTime();this._pauseTime=a-this._startOffsetTime;switch(this._propertyTrack.GetPropertyName()){case "volume":this._pauseVolume=
this._propertyTrack.GetInterpolatedValue(a)}this._audioPlaybackStarted=!1}Interpolate(a,c,d,f,h){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case "audioSource":if(!this._timeline.IsForwardPlayBack())break;if(f){this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag);break}if(a<this._startOffsetTime){this._audioPlaybackStarted=!1;break}c=this._expressions.PlaybackRate.call(this._sdkInstance,this._audioTag);d=this._timeline.GetPlaybackRate();d!==c&&this._actions.SetPlaybackRate.call(this._sdkInstance,
this._audioTag,d);if(this._audioPlaybackStarted)break;this._audioPlaybackStarted=!0;if(isNaN(this._pauseTime)){const g=self.performance.now(),l=a-this._startOffsetTime;this._sdkInstance.PostToDOMAsync("get-suspended").then(m=>{if("suspended"===m)this._audioPlaybackStarted=!1;else if(m=(self.performance.now()-g)/1E3,m=l+m,this._actions){let u=this.GetVolume();isNaN(u)?(this.SetVolume(0),u=0):this.SetVolume(u);this._actions.Play.call(this._sdkInstance,this._fileArgs,0,u,this._audioTag,m)}})}else{const g=
this._pauseTime;this._pauseTime=NaN;const l=this._GetPauseVolume();this._pauseVolume=NaN;this._sdkInstance.PostToDOMAsync("get-suspended").then(m=>{"suspended"===m?this._audioPlaybackStarted=!1:this._actions&&(this.SetVolume(l),this._actions.Play.call(this._sdkInstance,this._fileArgs,0,l,this._audioTag,g))})}break;case "volume":this._MaybeSetAudioSource(),super.Interpolate(a,c,d,f,h)}}GetInterpolatedValue(a,c,d){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case "volume":return this._MaybeSetAudioSource(),
super.GetInterpolatedValue(a,c,d)}}Getter(a,c){return this._audioSource?this._audioSource.GetVolume():0}Setter(a,c,d,f){this._audioSource&&this._audioSource.SetVolume(this.Getter()+c);this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),this._audioSource.GetVolume())}AbsoluteSetter(a,c,d){this._audioSource&&this._audioSource.SetVolume(c);this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),
this._audioSource.GetVolume())}DoesRounding(){return!0}_SaveToJson(){return{audioPlaybackStarted:this._audioPlaybackStarted,audioTag:this._audioTag,pauseTime:this._pauseTime,pauseVolume:this._pauseVolume,volume:this._volume}}_LoadFromJson(a){a&&(this._audioPlaybackStarted=a.audioPlaybackStarted,this._audioTag=a.audioTag,this._pauseTime=a.pauseTime,this._pauseVolume=a.pauseVolume,this._volume=a.volume,this._Initialize())}}e.PropertyTrackState.AudioSourceAdapter=b}"use strict";
self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(e){this._sourceAdapter=e;this._propertyTrack=e.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}MayNeedBeforeAndAfterInterpolate(){return!1}TimelineRemoved(){}CleanCaches(){this._target=
this._saveState=this._worldInfo=null}GetSourceAdapter(){return this._sourceAdapter}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo?this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(e){this._firstAbsoluteUpdate=!!e}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(e){return typeof this._Getter()===
typeof e}BeforeChangeProperty(){}ChangeProperty(e,b,a,c,d){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(e)},()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const e=this._propertyTrack.GetTimeline().GetTime()-
this._propertyTrack.GetTrack().GetStartOffset();return this._PickTimelinePlaybackMode(()=>{const b=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(e,b)},()=>{const b=this._propertyTrack.GetPropertyTrackDataItem(),a=this._propertyTrack.GetPropertyTrackData(),c=a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(e,b);return c?c:a.GetLastPropertyKeyframeDataItem(b)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(e,
b){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?e():b()}_PickResultMode(e,b){return"relative"===this._propertyTrack.GetResultMode()?e():b()}_PickFirstAbsoluteUpdate(e,b){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),e()):b()}_GetAbsoluteInitialValue(e){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(e,b,a,c,d,f){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return e();
case "effect":return b();case "instance-variable":return a();case "plugin":return c();case "world-instance":return d();case "audio":return f()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(e){e&&(this._firstAbsoluteUpdate=e.firstAbsoluteUpdate,this._saveState=e.saveState)}_GetPropertyKeyframeStubs(e,b=!1){const a=[];for(const c of e){e=c.GetTrack().GetStartOffset();for(const d of c.GetPropertyKeyframeDataItems())b&&0===d.GetTime()?a.push({time:e+
d.GetTime(),value:d.GetAbsoluteValue()}):b||a.push({time:e+d.GetTime(),value:d.GetAbsoluteValue()})}return a.sort((c,d)=>c.time-d.time)}_GetLastPropertyKeyframeStub(e,b,a){return this._GetPropertyKeyframeStubLowerThanPlayhead(b,a)}_GetPropertyKeyframeStubLowerThanPlayhead(e,b){for(let a=b.length-1;0<=a;a--)if(b[a].time<=e)return b[a];return null}};
{"use strict";const e=self.C3,b=new Map,a=[0,0,0];class c extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(d){super(d)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const d=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),h=this._GetIndex();switch(d){case "behavior":return this._ToColorArray(f.GetPropertyValueByIndex(h));case "effect":return this._ToColorArray(f[h]);case "plugin":return this._ToColorArray(f.GetPropertyValueByIndex(h));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const d=
this._FirstKeyframeGetter();return!this._CompareColors(d,this._Getter())}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(d,f){return d.equalsIgnoringAlpha(f)}_FirstKeyframeGetter(){const d=super._FirstKeyframeGetter();return this._GetColorFromArray(d)}_CurrentKeyframeGetter(){const d=super._CurrentKeyframeGetter();return this._GetColorFromArray(d)}_GetAbsoluteInitialValue(d){}_ToColorArray(d){return e.IsInstanceOf(d,
e.Color)?d.toArray().slice(0,3):d.slice(0,3)}_GetColorFromArray(d){return e.IsInstanceOf(d,e.Color)?d:new e.Color(d[0],d[1],d[2],1)}CanChange(d){return!0}MayNeedBeforeAndAfterInterpolate(){return!0}BeforeChangeProperty(){var d=this._propertyTrack.GetTimeline(),f=this._propertyTrack.GetInstance();const h=this._propertyTrack.GetSourceAdapter();(d=d.GetSimilarPropertyTracks(f,h,this._property))&&1<d.length&&(b.has(f)||b.set(f,new Map),f=b.get(f),d=this._propertyTrack.GetSourceAdapterId(),f.has(d)||f.set(d,
new Map),f=f.get(d),f.has(this._property)||f.set(this._property,{used:!1,color:new e.Color(0,0,0,1)}))}_GetTmpColor(d,f,h){d=b.get(d).get(f).get(h);d.used=!0;return d.color}ChangeProperty(d,f,h,g,l){l=this._propertyTrack.GetTimeline();g=this._propertyTrack.GetTrack();d=this._propertyTrack.GetInstance();var m=this._propertyTrack.GetSourceAdapter();h=this._propertyTrack.GetSourceAdapterId();if((m=l.GetSimilarPropertyTracks(d,m,this._property))&&1<m.length){if(m=this._GetPropertyKeyframeStubs(m,!0),
l=this._GetLastPropertyKeyframeStub(l,l.GetTime(),m))g=g.GetStartOffset(),m=l.time-g,0===m?this._GetTmpColor(d,h,this._property).addRgb(f[0],f[1],f[2]):0>m||(l=f[0],g=f[1],f=f[2],m=this._propertyTrack.Interpolate(m,!1,!0),l=e.Color.DiffChannel(l,m[0]),g=e.Color.DiffChannel(g,m[1]),f=e.Color.DiffChannel(f,m[2]),this._GetTmpColor(d,h,this._property).addRgb(l,g,f))}else this._Setter(f[0],f[1],f[2])}AfterChangeProperty(){const d=this._propertyTrack.GetInstance();if(b.has(d)){var f=b.get(d),h=this._propertyTrack.GetSourceAdapterId();
if(f.has(h)){var g=f.get(h);if(g.has(this._property)){var l=g.get(this._property),m=l.color;l.used&&this._Setter(m.getR(),m.getG(),m.getB());0===g.size&&f.delete(h);0===f.size&&b.delete(d)}}}}_Getter(){const d=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),h=this._GetIndex();switch(d){case "behavior":return this._GetColorFromArray(f.GetPropertyValueByIndex(h));case "effect":return f[h].clone();case "plugin":return this._GetColorFromArray(f.GetPropertyValueByIndex(h));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(d,
f,h){const g=this._propertyTrack.GetSourceAdapterId(),l=this._GetTarget(),m=this._GetIndex();switch(g){case "behavior":a[0]=d;a[1]=f;a[2]=h;l.SetPropertyValueByIndex(m,a);break;case "effect":l[m].setRgb(d,f,h);break;case "plugin":a[0]=d;a[1]=f;a[2]=h;l.SetPropertyValueByIndex(m,a);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(d,f,h)}}_SaveToJson(){}_LoadFromJson(d){}}e.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=c}
{"use strict";const e=self.C3,b=e.PropertyTrackState;class a extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}MayNeedBeforeAndAfterInterpolate(){return!1}ChangeProperty(c,d,f,h,g){f=
this._propertyTrack;const l=f.GetTrack();h=f.GetSourceAdapterId();g=f.GetTimeline();var m=l.GetInstance();const u=f.GetSourceAdapter();(m=g.GetSimilarPropertyTracks(m,u,this._property))&&1<m.length&&(m=this._GetPropertyKeyframeStubs(m),c+=l.GetStartOffset(),c=this._GetLastPropertyKeyframeStub(g,c,m))&&(d=c.value);switch(f.GetPropertyKeyframeType()){case "numeric":if(!b.NumericTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),d,h))return;break;case "angle":if(!b.AngleTypeAdapter.WillChange(this._GetIndex(),
this._GetTarget(),d,h))return;break;case "boolean":if(!b.BooleanTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),d,h))return;break;case "color":if(!b.ColorTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),d,h))return;break;case "text":if(!b.TextTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),d,h))return}this._Setter(d)}_Getter(){const c=this._propertyTrack.GetSourceAdapterId(),d=this._GetTarget(),f=this._GetIndex();switch(c){case "behavior":return d.GetPropertyValueByIndex(f);
case "effect":return d[f];case "instance-variable":return d.GetInstanceVariableValue(f);case "plugin":return d.GetPropertyValueByIndex(f)}}_Setter(c){const d=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),h=this._GetIndex();switch(d){case "behavior":f.SetPropertyValueByIndex(h,c);break;case "effect":f[h]=c;break;case "instance-variable":f.SetInstanceVariableValue(h,c);break;case "plugin":f.SetPropertyValueByIndex(h,c)}}}e.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=
a}
{"use strict";const e=self.C3,b=new Map,a=(d,f,h,g,l)=>b.set(d,{setter:f,absolute_setter:h,getter:g,round:l});a("offsetX",(d,f)=>d.OffsetX(f),(d,f)=>d.SetX(f),d=>d.GetX(),!0);a("offsetY",(d,f)=>d.OffsetY(f),(d,f)=>d.SetY(f),d=>d.GetY(),!0);a("offsetWidth",(d,f)=>d.OffsetWidth(f),(d,f)=>d.SetWidth(f),d=>d.GetWidth(),!0);a("offsetHeight",(d,f)=>d.OffsetHeight(f),(d,f)=>d.SetHeight(f),d=>d.GetHeight(),!0);a("offsetAngle",(d,f)=>d.OffsetAngle(f),(d,f)=>d.SetAngle(f),d=>d.GetAngle(),!1);a("offsetOpacity",(d,
f,h,g)=>{h=d.GetOpacity()+f;0===g._clampAccumulator?(1<h?g._clampAccumulator+=h-1:0>h&&(g._clampAccumulator+=h),d.OffsetOpacity(f)):(d=d.GetOpacity()+f,0<f&&0<g._clampAccumulator?1<d&&(g._clampAccumulator+=d-1):0<f&&0>g._clampAccumulator?(g._clampAccumulator+=f,0<g._clampAccumulator&&(g._clampAccumulator=0)):0>f&&0<g._clampAccumulator?(g._clampAccumulator+=f,0>g._clampAccumulator&&(g._clampAccumulator=0)):0>f&&0>g._clampAccumulator&&0>d&&(g._clampAccumulator+=d))},(d,f)=>{d.SetOpacity(f)},d=>d.GetOpacity(),
!1);a("offsetOriginX",(d,f)=>d.OffsetOriginX(f),(d,f)=>d.SetOriginX(f),d=>d.GetOriginX(),!1);a("offsetOriginY",(d,f)=>d.OffsetOriginY(f),(d,f)=>d.SetOriginY(f),d=>d.GetOriginY(),!1);a("offsetZElevation",(d,f)=>d.OffsetZElevation(f),(d,f)=>d.SetZElevation(f),d=>d.GetZElevation(),!0);a("offsetScaleX",(d,f,h,g)=>{g=0>d.GetWidth()?-1:1;d.GetTransformWithParentWidth();d.OffsetWidth(h.GetOriginalWidth()*g*f)},(d,f,h)=>{d.SetWidth(h.GetOriginalWidth()*f)},(d,f)=>{const h=0>d.GetWidth()?-1:1;if(d.GetTransformWithParentWidth()){var g=
d.GetParent(),l=f.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetWidth()/l.GetOriginalWidth():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetWidth()/l.GetOriginalWidth():1);return d.GetWidth()*h/(f.GetOriginalWidth()*g)}return d.GetWidth()*h/f.GetOriginalWidth()},!1);a("offsetScaleY",(d,f,h,g)=>{g=0>d.GetHeight()?-1:1;d.GetTransformWithParentHeight();d.OffsetHeight(h.GetOriginalHeight()*g*f)},(d,f,h)=>{d.SetHeight(h.GetOriginalHeight()*f)},(d,f)=>{const h=0>d.GetHeight()?
-1:1;if(d.GetTransformWithParentHeight()){var g=d.GetParent(),l=f.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetHeight()/l.GetOriginalHeight():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetHeight()/l.GetOriginalHeight():1);return d.GetHeight()*h/(f.GetOriginalHeight()*g)}return d.GetHeight()*h/f.GetOriginalHeight()},!1);class c extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(d){super(d);this._clampAccumulator=this._lastValue=0;this._source_adapter_absolute_setter=
this._source_adapter_setter=this._source_adapter_getter=this._instance_absolute_setter=this._instance_setter=this._instance_getter=null;this._round=!1;e.IsInstanceOf(this._propertyTrack.GetTimeline(),e.TweenState)?this._typeAdapter=new e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):this._typeAdapter=new e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);const f=this._propertyTrack.GetPropertyName();switch(this._propertyTrack.GetSourceAdapterId()){case "world-instance":d=
b.get(f);this._instance_getter=d.getter;this._instance_setter=d.setter;this._instance_absolute_setter=d.absolute_setter;this._round=d.round;break;case "audio":this._source_adapter_getter=d.Getter,this._source_adapter_setter=d.Setter,this._source_adapter_absolute_setter=d.AbsoluteSetter,this._round=!!d.DoesRounding()}}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}MayNeedBeforeAndAfterInterpolate(){return this._typeAdapter.MayNeedBeforeAndAfterInterpolate()}GetLastValue(){return this._lastValue}SetLastValue(d){this._lastValue=
d}SetInitialState(){const d=this._typeAdapter.SetInitialState();"number"===typeof d&&(this._lastValue=d);this._clampAccumulator=0}SetResumeState(){const d=this._typeAdapter.SetResumeState();"number"===typeof d&&(this._lastValue=d)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(d,
f,h,g,l,m,u){return this._typeAdapter.ChangeProperty(d,f,h,g,l,m,u)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const d=this._GetTarget(),f=this._GetIndex(),h=this.GetWorldInfo(),g=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return d.GetPropertyValueByIndex(f);case "effect":return d[f];case "instance-variable":return d.GetInstanceVariableValue(f);case "plugin":return d.GetPropertyValueByIndex(f);case "world-instance":return this._instance_getter(h,
g);case "audio":return this._source_adapter_getter.call(this.GetSourceAdapter(),h,g)}}_Setter(d,f,h){f=this._GetTarget();h=this._GetIndex();const g=this.GetWorldInfo(),l=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":f.OffsetPropertyValueByIndex(h,d);break;case "effect":f[h]+=d;break;case "instance-variable":f.SetInstanceVariableOffset(h,d);break;case "plugin":f.OffsetPropertyValueByIndex(h,d);break;case "world-instance":this._instance_setter(g,d,l,
this);break;case "audio":this._source_adapter_setter.call(this.GetSourceAdapter(),g,d,l,this)}}_SetterAbsolute(d,f,h){f=this._GetTarget();h=this._GetIndex();const g=this.GetWorldInfo(),l=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":f.SetPropertyValueByIndex(h,d);break;case "effect":f[h]=d;break;case "instance-variable":f.SetInstanceVariableValue(h,d);break;case "plugin":f.SetPropertyValueByIndex(h,d);break;case "world-instance":this._instance_absolute_setter(g,
d,l);break;case "audio":this._source_adapter_absolute_setter.call(this.GetSourceAdapter(),g,d,l)}}_MaybeEnsureValue(d,f,h,g,l,m){this._typeAdapter._MaybeEnsureValue(d,f,h,g,l,m)}_AddDelta(d,f,h){var g=(d.toString().split(".")[1]||"").length;d=this._Getter();g=0===g?this._round?Math.round(d):d:e.toFixed(d,g);this._Setter(g-d,f,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue,a:this._clampAccumulator})}_LoadFromJson(d){d&&(super._LoadFromJson(d),this._lastValue=d.v,this._clampAccumulator=
d.a)}}e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=c}
{"use strict";class e{constructor(a){this._used=!1;this._value=0;this._propertyTracks=a;for(let c=0,d=this._propertyTracks.length;c<d;c++)this._propertyTracks[c].SetAbsoluteValueObject(this)}GetPropertyTracks(){return this._propertyTracks}SetUsed(){this._used=!0}GetUsed(){return this._used}SetValue(a){this._value=a}GetValue(){return this._value}Reset(){this._used=!1;this._value=0}}class b{constructor(a){this._numericInterpolationAdapter=a}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const a=
this._numericInterpolationAdapter;this._numericInterpolationAdapter.GetPropertyTrack();return a._PickResultMode(()=>a._PickTimelinePlaybackMode(()=>0,()=>a.GetSourceAdapter().GetValueAtTime()),()=>{})}SetResumeState(){}MayNeedBeforeAndAfterInterpolate(){switch(this._numericInterpolationAdapter.GetPropertyTrack().GetResultMode()){case "relative":return!1;case "absolute":return!0}}BeforeChangeProperty(){var a=this._numericInterpolationAdapter.GetPropertyTrack(),c=a.GetPropertyName();switch(a.GetResultMode()){case "absolute":if(a.HasAbsoluteValueObject())a.GetAbsoluteValueObject().Reset();
else{const d=a.GetTimeline(),f=a.GetInstance();a=a.GetSourceAdapter();(c=d.GetSimilarPropertyTracks(f,a,c))&&1<c.length&&new e(c)}}}ChangeProperty(a,c,d,f,h,g){var l=this._numericInterpolationAdapter,m=this._numericInterpolationAdapter.GetPropertyTrack();switch(m.GetResultMode()){case "relative":m=l.GetLastValue();l._Setter(c-m,d,f);g&&this._MaybeEnsureValue(a,d,f,h,m,c);l.SetLastValue(c);break;case "absolute":if(f=m.GetTimeline(),d=m.GetTrack(),m.GetInstance(),m.GetSourceAdapter(),m.HasAbsoluteValueObject()){if(a=
m.GetAbsoluteValueObject(),h=a.GetPropertyTracks(),h=l._GetPropertyKeyframeStubs(h,!0),l=l._GetLastPropertyKeyframeStub(f,f.GetTime(),h))d=d.GetStartOffset(),l=l.time-d,0===l?(a.SetUsed(),a.SetValue(a.GetValue()+c)):0>l||(m=m.GetInterpolatedValue(l),a.SetUsed(),a.SetValue(a.GetValue()+(c-m)))}else l._SetterAbsolute(c)}}AfterChangeProperty(){const a=this._numericInterpolationAdapter;var c=this._numericInterpolationAdapter.GetPropertyTrack();switch(c.GetResultMode()){case "absolute":c.HasAbsoluteValueObject()&&
(c=c.GetAbsoluteValueObject(),c.GetUsed()&&a._SetterAbsolute(c.GetValue()))}}_MaybeEnsureValue(a,c,d,f,h,g){const l=this._numericInterpolationAdapter;f||(c&&a===c.GetTime()?l._AddDelta(c.GetValueWithResultMode(),c,d):d&&a===d.GetTime()?l._AddDelta(d.GetValueWithResultMode(),c,d):0===g-h&&l._AddDelta(c.GetValueWithResultMode(),c,d))}}self.C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=b}
{"use strict";class e{constructor(b){this._numericInterpolationAdapter=b}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const b=this._numericInterpolationAdapter;b.SetFirstAbsoluteUpdate(!0);return this._GetAbsoluteInitialValue(b._FirstKeyframeGetter())}SetResumeState(){const b=this._numericInterpolationAdapter;if(b._FirstKeyframeGetter()!==b._CurrentKeyframeGetter())return b.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(b._CurrentKeyframeGetter())}MayNeedBeforeAndAfterInterpolate(){return!1}BeforeChangeProperty(){}ChangeProperty(b,
a,c,d,f,h){const g=this._numericInterpolationAdapter,l=g.GetLastValue();switch(g.GetPropertyTrack().GetResultMode()){case "relative":g._Setter(a-l,c,d);h&&this._MaybeEnsureValue(b,c,d,f,l,a);break;case "absolute":g.GetFirstAbsoluteUpdate()?(g.SetFirstAbsoluteUpdate(!1),g._Setter(l,c,d)):(g._Setter(a-l,c,d),h&&this._MaybeEnsureValue(b,c,d,f,l,a))}g.SetLastValue(a)}AfterChangeProperty(){}_GetAbsoluteInitialValue(b){return b-this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(b,a,c,
d,f,h){const g=this._numericInterpolationAdapter;d?a&&b===a.GetTime()?g._AddDelta(a.GetValueWithResultMode(),a,c):c&&b===c.GetTime()?g._AddDelta(c.GetValueWithResultMode(),a,c):c||g._AddDelta(a.GetValueWithResultMode(),a,c):a&&b===a.GetTime()?g._AddDelta(a.GetValueWithResultMode(),a,c):c&&b===c.GetTime()?g._AddDelta(c.GetValueWithResultMode(),a,c):0===h-f&&g._AddDelta(a.GetValueWithResultMode(),a,c)}}self.C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=e}
{"use strict";const e=self.C3,b=self.Ease;e.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(a,c,d,f){let h;switch(f){case "behavior":h=c.GetPropertyValueByIndex(a);break;case "effect":h=c[a];break;case "instance-variable":h=c.GetInstanceVariableValue(a);break;case "plugin":h=c.GetPropertyValueByIndex(a)}return h===d?!1:!0}static Interpolate(a,c,d,f){if(!d)return d=f.GetPropertyTrackDataItem(),d=f.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(d),d.GetValueWithResultMode();
var h=f.GetInterpolationMode();"default"===h&&(h="continuous");"combo"===f.GetPropertyType()&&(h="discrete");if("discrete"===h)return c.GetValueWithResultMode();if("continuous"===h||"step"===h){"step"===h&&(h=f.GetTimeline().GetStep(),0!==h&&(h=1/h,a=Math.floor(a*h)/h));var g=c.GetTime();const l=d.GetTime();h=c.GetValueWithResultMode();const m=d.GetValueWithResultMode();if(h===m)return h;a=e.normalize(a,g,l);const u=c.GetEase();c=c.GetAddOn("cubic-bezier");d=d.GetAddOn("cubic-bezier");c&&c.GetStartEnable()&&
d&&d.GetEndEnable()?(g=l-g,g=b.GetRuntimeEase(u)(g*a,0,1,g),g=b.GetRuntimeEase("cubicbezier")(g,h,h+c.GetStartAnchor(),m+d.GetEndAnchor(),m)):g=b.GetRuntimeEase(u)((l-g)*a,h,m-h,l-g);return"integer"===f.GetPropertyType()?Math.floor(g):g}}}}
{"use strict";const e=self.C3;e.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(b,a,c,d){let f;switch(d){case "behavior":f=a.GetPropertyValueByIndex(b);break;case "effect":f=a[b];break;case "instance-variable":f=a.GetInstanceVariableValue(b);break;case "plugin":f=a.GetPropertyValueByIndex(b)}return f===c?!1:!0}static Interpolate(b,a,c,d){if(!c)return a=d.GetPropertyTrackDataItem(),a=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode();var f=
d.GetInterpolationMode();"default"===f&&(f="continuous");"combo"===d.GetPropertyType()&&(f="discrete");if("discrete"===f)return a.GetValueWithResultMode();if("continuous"===f||"step"===f){"step"===f&&(d=d.GetTimeline().GetStep(),0!==d&&(d=1/d,b=Math.floor(b*d)/d));const h=a.GetTime(),g=c.GetTime();d=a.GetValueWithResultMode();c=c.GetValueWithResultMode();if(f=a.GetAddOn("angle")){const l=f.GetRevolutions();if(d===c&&0===l)return d;b=e.normalize(b,h,g);a=self.Ease.GetRuntimeEase(a.GetEase())(b,0,1,
1);switch(f.GetDirection()){case "closest":return e.angleLerp(d,c,a,l);case "clockwise":return e.angleLerpClockwise(d,c,a,l);case "anti-clockwise":return e.angleLerpAntiClockwise(d,c,a,l)}}else{if(d===c)return d;b=e.normalize(b,h,g);a=self.Ease.GetRuntimeEase(a.GetEase());return e.angleLerp(d,c,a(b,0,1,1))}}}}}"use strict";
self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(e,b,a,c){let d;switch(c){case "behavior":d=b.GetPropertyValueByIndex(e);break;case "effect":d=b[e];break;case "instance-variable":d=b.GetInstanceVariableValue(e);break;case "plugin":d=b.GetPropertyValueByIndex(e)}return!!d===!!a?!1:!0}static Interpolate(e,b,a,c){return a?b.GetValueWithResultMode()?1:0:(e=c.GetPropertyTrackDataItem(),e=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e),e.GetValueWithResultMode()?
1:0)}};
{"use strict";const e=self.C3,b=[0,0,0],a=[0,0,0],c=[0,0,0];e.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(d,f,h,g){let l;switch(g){case "behavior":l=f.GetPropertyValueByIndex(d);break;case "effect":l=f[d];break;case "instance-variable":l=f.GetInstanceVariableValue(d);break;case "plugin":l=f.GetPropertyValueByIndex(d)}Array.isArray(h)?(b[0]=h[0],b[1]=h[1],b[2]=h[2]):(c.parseCommaSeparatedRgb(h),b[0]=Math.floor(255*c.getR()),b[1]=Math.floor(255*c.getG()),b[2]=Math.floor(255*c.getB()));
Array.isArray(l)?(a[0]=l[0],a[1]=l[1],a[2]=l[2]):(c.parseCommaSeparatedRgb(l),a[0]=Math.floor(255*c.getR()),a[1]=Math.floor(255*c.getG()),a[2]=Math.floor(255*c.getB()));return b[0]!==a[0]||b[1]!==a[1]||b[2]!==a[2]?!0:!1}static Interpolate(d,f,h,g){if(!h){var l=g.GetPropertyTrackDataItem();l=g.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(l);g=l.GetValueWithResultMode();b[0]=g[0];b[1]=g[1];b[2]=g[2];return b}l=g.GetInterpolationMode();"default"===l&&(l="continuous");if("discrete"===l)return g=
f.GetValueWithResultMode(),b[0]=g[0],b[1]=g[1],b[2]=g[2],b;if("continuous"===l||"step"===l){"step"===l&&(g=g.GetTimeline().GetStep(),0!==g&&(g=1/g,d=Math.floor(d*g)/g));g=f.GetTime();l=h.GetTime();var m=f.GetValueWithResultMode(),u=h.GetValueWithResultMode();d=e.normalize(d,g,l);var v=f.GetEase();f=m[0];h=m[1];m=m[2];const t=u[0],q=u[1];u=u[2];v=self.Ease.GetRuntimeEase(v);g=l-g;l=g*d;b[0]=f===t?f:v(l,f,t-f,g);b[1]=h===q?h:v(l,h,q-h,g);b[2]=m===u?m:v(l,m,u-m,g);return b}}}}"use strict";
self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(e,b,a,c){let d;switch(c){case "behavior":d=b.GetPropertyValueByIndex(e);break;case "effect":d=b[e];break;case "instance-variable":d=b.GetInstanceVariableValue(e);break;case "plugin":d=b.GetPropertyValueByIndex(e)}return d===a?!1:!0}static Interpolate(e,b,a,c){return a?b.GetValueWithResultMode():(e=c.GetPropertyTrackDataItem(),e=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e),e.GetValueWithResultMode())}};
{"use strict";const e=self.C3;e.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 e.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,c,d){if(a)for(const f of a)e.TimelineDataManager._CreateDataItem("create",f,b,c,d)}static _LoadDataItemsFromJson(b,
a,c,d){b.length?a.forEach((f,h)=>{b[h]._LoadFromJson(f)}):a.forEach(f=>{e.TimelineDataManager._CreateDataItem("load",f,b,c,d)})}static _CreateDataItem(b,a,c,d,f){let h;if("function"===typeof d)switch(b){case "load":h=new d(null,f);break;case "create":h=new d(a,f)}else if("object"===typeof d)switch(d=d.map.get(a[d.prop]),b){case "load":h=new d(null,f);break;case "create":h=new d(a,f)}switch(b){case "load":h._LoadFromJson(a);c.push(h);break;case "create":if("function"===typeof h.GetEnable&&!h.GetEnable())return h.Release();
c.push(h)}}}}
{"use strict";const e=self.C3;e.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 e.TrackData(b[5],this))}Release(){this._trackData.Release();this._trackData=
null}GetTrackData(){this._trackData||(this._trackData=new e.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 e=self.C3;class b{constructor(a,c){this._trackData=c;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();this._type=0;this._name="";a&&(a[0]&&(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]),a[8]&&(this._additionalInstanceData=a[8]),a[9]&&(this._type=a[9]),a[10]&&(this._name=a[10]),this._keyframeData=new e.KeyframeData(a[4],this),this._propertyTrackData=new e.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 e.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new e.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}SetLocalTotalTime(a){this._localTotalTime=a}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}GetType(){return this._type}GetName(){return this._name}_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,type:this._type,name:this._name}}_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._type=a.type?a.type:0,this._name=a.name?a.name:"",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))}}e.TrackData=class{constructor(a,
c){this._timelineDataItem=c;this._trackDataItems=[];e.TimelineDataManager._CreateDataItems(this._trackDataItems,a,b,this)}Release(){this._timelineDataItem=null;for(const a of this._trackDataItems)a.Release();e.clearArray(this._trackDataItems);this._trackDataItems=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){return a.GetKeyframeData().GetKeyframeDataItemArray().at(-1)}GetKeyFrameDataItemAtTime(a,
c){c=c.GetKeyframeData().GetKeyframeDataItemArray();const d=c.length;for(let f=0;f<d;f++){const h=c[f];if(h.GetTime()===a)return h}}GetFirstKeyFrameDataItemHigherThan(a,c){c=c.GetKeyframeData().GetKeyframeDataItemArray();const d=c.length;for(let f=0;f<d;f++){const h=c[f];if(h.GetTime()>a)return h}}GetFirstKeyFrameDataItemHigherOrEqualThan(a,c){c=c.GetKeyframeData().GetKeyframeDataItemArray();const d=c.length;for(let f=0;f<d;f++){const h=c[f];if(h.GetTime()>=a)return h}}GetFirstKeyFrameDataItemLowerOrEqualThan(a,
c){c=c.GetKeyframeData().GetKeyframeDataItemArray();for(let d=c.length-1;0<=d;d--){const f=c[d];if(f.GetTime()<=a)return f}}*trackDataItems(){for(const a of this._trackDataItems)yield a}_SaveToJson(){return{trackDataItemsJson:this._trackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&e.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,a.trackDataItemsJson,b,this)}}}
{"use strict";const e=self.C3;class b{constructor(a,c){this._propertyTrackData=c;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;this._canHavePropertyKeyframes=!0;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 e.PropertyKeyframeData(a[8],this),this._canHavePropertyKeyframes=a[9])}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new e.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}CanHavePropertyKeyframes(){return!!this._canHavePropertyKeyframes}_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,canHavePropertyKeyframes:this._canHavePropertyKeyframes}}_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._canHavePropertyKeyframes=a.canHavePropertyKeyframes,this.GetPropertyKeyframeData()._LoadFromJson(a.propertyKeyframeDataJson))}}e.PropertyTrackData=class{constructor(a,c){this._trackDataItem=c;this._propertyTrackDataItems=[];e.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,
a,b,this)}Release(){this._trackDataItem=null;for(const a of this._propertyTrackDataItems)a.Release();e.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=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){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray().at(-1)}GetPropertyKeyFrameDataItemAtTime(a,
c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const d=c.length;for(let f=0;f<d;f++){const h=c[f];if(h.GetTime()===a)return h}}GetFirstPropertyKeyFrameDataItemHigherThan(a,c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const d=c.length;for(let f=0;f<d;f++){const h=c[f];if(h.GetTime()>a)return h}}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const d=c.length;for(let f=0;f<d;f++){const h=
c[f];if(h.GetTime()>=a)return h}}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();for(let d=c.length-1;0<=d;d--){const f=c[d];if(f.GetTime()<=a)return f}}*propertyTrackDataItems(){for(const a of this._propertyTrackDataItems)yield a}_SaveToJson(){return{propertyTrackDataItemsJson:this._propertyTrackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&e.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,a.propertyTrackDataItemsJson,
b,this)}}}
{"use strict";const e=self.C3;class b{constructor(a,c){this._keyframeData=c;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(d=>d.toLowerCase())),this._next=null)}Release(){this._keyframeData=null;e.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetNext(){return this._next}SetNext(a){this._next=a}GetTime(){return this._time}SetTime(a){this._time=
a;this._keyframeData._LinkKeyframeDataItems()}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(c=>c.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(c=>c.toLowerCase())))}}e.KeyframeData=class{constructor(a,c){this._trackDataItem=c;this._keyframeDataItems=[];e.TimelineDataManager._CreateDataItems(this._keyframeDataItems,a,b,this);this._LinkKeyframeDataItems()}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();e.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}_LinkKeyframeDataItems(){this._keyframeDataItems.sort((a,
c)=>a.GetTime()-c.GetTime());for(let a=0;a<this._keyframeDataItems.length;a++)this._keyframeDataItems[a].SetNext(this._keyframeDataItems[a+1])}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const a=new b(null,this);this._keyframeDataItems.push(a);this._LinkKeyframeDataItems();return a}DeleteKeyframeDataItems(a){for(const c of this._keyframeDataItems){if(!a(c))continue;
const d=this._keyframeDataItems.indexOf(c);-1!==d&&(c.Release(),this._keyframeDataItems.splice(d,1))}this.SortKeyframeDataItems();this._LinkKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((a,c)=>a.GetTime()-c.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&&(e.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,a.keyframeDataItemsJson,b,this),this._LinkKeyframeDataItems())}}}
{"use strict";const e=self.C3;class b{constructor(a,c){this._propertyKeyframeData=c;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;this._addonInstance=void 0;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 e.AddonData(a[4],this)),this._next=null)}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(),
this._addonData=null)}GetAddonData(){return this._addonData}SetNext(a){this._next=a}GetNext(){return this._next}GetValue(){return this._value}SetValue(a){"color"===this._type&&e.IsFiniteNumber(a)?(this._value[0]=e.GetRValue(a),this._value[1]=e.GetGValue(a),this._value[2]=e.GetBValue(a)):this._value=a}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(a){"color"===this._type&&e.IsFiniteNumber(a)?(this._aValue[0]=e.GetRValue(a),this._aValue[1]=e.GetGValue(a),this._aValue[2]=e.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;this._propertyKeyframeData._LinkPropertyKeyframeDataItems()}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetAddOn(a){if(this._addonData){if(this._addonInstance||
null===this._addonInstance)return this._addonInstance;var c=this._addonData.GetAddDataItemArray();if(!c)return this._addonInstance=null;var d=c.length;for(let f=0;f<d;f++){const h=c[f];if(h.GetId()===a)return this._addonInstance=h}return this._addonInstance=null}}_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)}}e.PropertyKeyframeData=class{constructor(a,c){this._propertyTrackDataItem=c;this._propertyKeyframeDataItems=[];e.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,a,b,this);this._LinkPropertyKeyframeDataItems()}Release(){this._propertyTrackDataItem=null;for(const a of this._propertyKeyframeDataItems)a.Release();e.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=
null}_LinkPropertyKeyframeDataItems(){this._propertyKeyframeDataItems.sort((a,c)=>a.GetTime()-c.GetTime());for(let a=0;a<this._propertyKeyframeDataItems.length;a++)this._propertyKeyframeDataItems[a].SetNext(this._propertyKeyframeDataItems[a+1])}AddEmptyPropertyKeyframeDataItem(){const a=new b(null,this);this._propertyKeyframeDataItems.push(a);this._LinkPropertyKeyframeDataItems();return a}DeletePropertyKeyframeDataItems(a){for(const c of this._propertyKeyframeDataItems){if(!a(c))continue;const d=
this._propertyKeyframeDataItems.indexOf(c);-1!==d&&(c.Release(),this._propertyKeyframeDataItems.splice(d,1))}this.SortPropertyKeyFrameDataItems();this._LinkPropertyKeyframeDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a,c)=>a.GetTime()-c.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&&(e.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a.propertyKeyframeDataItemsJson,b,this),this._LinkPropertyKeyframeDataItems())}}}
{"use strict";const e=self.C3;class b{constructor(d,f){this._addonData=f;this._id=d[0];this._data=d[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(d){d&&(this._id=d.id,this._data=d.data)}}class a extends b{constructor(d,f){super(d,f);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(d){d&&(super._LoadFromJson(d),this._startAnchor=d.startAnchor,this._startEnable=!!d.startEnable,this._endAnchor=d.endAnchor,this._endEnable=!!d.endEnable)}}class c extends b{constructor(d,f){super(d,f);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(d){d&&(super._LoadFromJson(d),this._direction=d.direction,this._revolutions=d.revolutions)}}e.AddonData=class{constructor(d,f){this._propertyKeyframeDataItem=f;this._addonDataItems=[];e.TimelineDataManager._CreateDataItems(this._addonDataItems,d,{prop:0,map:new Map([["cubic-bezier",a],["angle",c]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const d of this._addonDataItems)d.Release();e.clearArray(this._addonDataItems);
this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}GetAddDataItemArray(){return this._addonDataItems}*addonDataItems(){for(const d of this._addonDataItems)yield d}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(d=>d._SaveToJson())}}_LoadFromJson(d){d&&e.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,d.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",a],["angle",c]])},this)}}}
{"use strict";const e=self.C3;let b=0;e.TweenState=class extends e.TimelineState{constructor(a,c){super(`tween-${b++}`,a,c);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._track=this._on_started_callbacks=this._on_completed_callbacks=this._instance=null}CreateTrackStates(){for(const a of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(e.TweenTrackState.Create(this,a));this._track=this._tracks[0]}AddTrack(){var a=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();
a=e.TweenTrackState.Create(this,a);this._tracks.push(a);this._track=this._tracks[0];return a}GetPropertyTrack(a){return this._track.GetPropertyTracks()[0]}SetPropertyType(a){this._propertyType=a}GetInstance(){var a=this.GetTracks();if(a&&a.length&&(this._track=a=a[0])){var c=a.GetInstance();return a.IsInstanceValid()?c:void 0}}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,c){for(const f of this._tracks)for(const h of f._propertyTracks){if(h.GetPropertyName()!==c)continue;var d=h.GetPropertyTrackData();const g=h.GetPropertyTrackDataItem();
d=d.GetFirstPropertyKeyframeDataItem(g);d.SetValue(a);d.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const c of this._tracks)for(const d of c._propertyTracks)if(d.GetPropertyName()===a)return d}BeforeSetEndValues(a){for(const f of a)a=this._GetPropertyTrackState(f),this.SetStartValue(a.GetCurrentState(),f);if(this.IsForwardPlayBack()){var c=this.GetTotalTime()-this.GetTime();this.SetTotalTime(c);for(var d of this._tracks)d.SetLocalTotalTime(c);this._SetTime(0)}else{d=this.GetTime();this.SetTotalTime(d);
for(c of this._tracks)c.SetLocalTotalTime(d);this._SetTime(d)}this.SetInitialStateFromSetTime()}SetEndValue(a,c){var d=this._GetPropertyTrackState(c);c=d.GetPropertyTrackData();d=d.GetPropertyTrackDataItem();c=c.GetLastPropertyKeyframeDataItem(d);c.SetTime(this.GetTotalTime());c.SetValue(a);c.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 c of this._tracks)c.CompareInitialStateWithCurrent();super.SetInitialState(a)}Stop(a=!1){super.Stop(a);if(!this.IsComplete())for(const c of this._tracks)c.SaveState()}Reset(a=!0,c=!1){this._DeleteIntermediateKeyframes();super.Reset(a,c)}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const c=d=>{d=d.GetTime();const f=this.GetTotalTime();return 0!==d&&d!==f};a.DeleteKeyframes(c);
a.DeletePropertyKeyframes(c)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const a=this.GetInstance();if(a&&a.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return!0}Tick(a,c,d){this._instance||(this._instance=this.GetInstance());if(this._instance&&!this._instance.IsDestroyed()&&(c=this._instance.GetTimeScale(),-1!==c&&(a=d*c),0!==a||0!==this._lastDelta)){this._lastDelta=a;d=this._playheadTime+a*this._playbackRate;
a=this._timelineDataItem._totalTime;this._playheadTime=0>d?0:d>=a?a:d;d=!1;c=this.GetLoop();var f=this.GetPingPong();c||f?c&&!f?0<this._playbackRate?this._playheadTime>=a&&this._SetTime(0):0>=this._playheadTime&&this._SetTime(a):!c&&f?0<this._playbackRate?this._playheadTime>=a&&(this._SetTime(a),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):d=!0:0===this._pingPongState&&(this._pingPongState=
1)):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):d=!0:0===this._pingPongState&&(this._pingPongState=1)):c&&f&&(0<this._playbackRate?this._playheadTime>=a&&(this._SetTime(a),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()))):0<this._playbackRate?this._playheadTime>=
a&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTime(0)):(this._SetTime(a),d=!0)):0>=this._playheadTime&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTime(a)):(this._SetTime(0),d=!0));d?(this._track.SetEndState(),this.Stop(!0),this.OnCompleted()):(this._track.Interpolate(this._playheadTime,!0,!1,!1,this._firstTick,!1),this._firstTick&&(this._firstTick=!1))}}_SaveToJson(){const a=super._SaveToJson(),c=this.GetTimelineDataItem();
return Object.assign(a,{tweenDataItemJson:c._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 c=a.runtime.GetTimelineManager(),
d=new e.TimelineDataItem;if(a.json){d._LoadFromJson(a.json.tweenDataItemJson);var f=new e.TweenState(d,c);f._LoadFromJson(a.json);return f}c=new e.TweenState(d,c);e.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]);c.SetId(a.id);c.SetTags(a.tags);c.SetInitialValueMode(a.initialValueMode);c.SetDestroyInstanceOnComplete(a.releaseOnComplete);c.SetLoop(a.loop);c.SetPingPong(a.pingPong);c.SetTotalTime(a.time);c.SetStep(0);c.SetInterpolationMode("default");c.SetResultMode(a.propertyTracksConfig[0].resultMode);
d=c.AddTrack();d.SetInstanceUID(a.instance.GetUID());d.SetInterpolationMode("default");d.SetResultMode(a.propertyTracksConfig[0].resultMode);d.SetEnable(!0);d.SetObjectClassIndex(a.instance.GetObjectClass().GetIndex());var h=a.instance.GetSdkInstance(),g=h.IsOriginalSizeKnown()?h.GetOriginalWidth():a.instance.GetWorldInfo().GetWidth();h=h.IsOriginalSizeKnown()?h.GetOriginalHeight():a.instance.GetWorldInfo().GetHeight();d.SetOriginalWidth(g);d.SetOriginalHeight(h);g=d.AddKeyframe();g.SetTime(0);g.SetEase("noease");
g.SetEnable(!0);g.SetTags("");g=d.AddKeyframe();g.SetTime(a.time);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");for(f of a.propertyTracksConfig)g=d.AddPropertyTrack(),g.SetSourceAdapterId(f.sourceId),g.SetSourceAdapterArgs(f.sourceArgs),g.SetPropertyName(f.property),g.SetPropertyType(f.type),g.SetMin(NaN),g.SetMax(NaN),g.SetInterpolationMode("default"),g.SetResultMode(f.resultMode),g.SetEnable(!0),h=g.AddPropertyKeyframe(),h.SetType(f.valueType),h.SetTime(0),h.SetEase(f.ease),h.SetEnable(!0),
h.SetValue(f.startValue),h.SetAbsoluteValue(f.startValue),h=g.AddPropertyKeyframe(),h.SetType(f.valueType),h.SetTime(a.time),h.SetEase(f.ease),h.SetEnable(!0),h.SetValue(f.endValue),h.SetAbsoluteValue(f.endValue),g.GetSourceAdapter();return c}}}
{"use strict";const e=self.C3;e.TweenTrackState=class extends e.TrackState{constructor(b,a){super(b,a);this._secondPropertyTrack=this._firstPropertyTrack=null}static Create(b,a){return e.New(e.TweenTrackState,b,a)}_CachePropertyTracks(){1===this._propertyTracks.length?this._firstPropertyTrack=this._propertyTracks[0]:(this._firstPropertyTrack=this._propertyTracks[0],this._secondPropertyTrack=this._propertyTracks[1])}CreatePropertyTrackStates(){for(const b of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(e.TweenPropertyTrackState.Create(this,
b));this._CachePropertyTracks()}AddPropertyTrack(){var b=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=e.TweenPropertyTrackState.Create(this,b);this._propertyTracks.push(b);this._CachePropertyTracks();return b}BeforeInterpolate(){}Interpolate(b,a,c=!1,d=!1,f,h=!1){this._instance||this.GetInstance();if(this._instance){if(this._instance.IsDestroyed()||h&&this.GetObjectClass().IsGlobal())return!1;this._secondPropertyTrack?(this._firstPropertyTrack.Interpolate(b,c,d),this._secondPropertyTrack.Interpolate(b,
c,d)):this._firstPropertyTrack.Interpolate(b,c,d);0!==this._firstPropertyTrack.GetWorldInfoChange()&&(this._worldInfo||(this._worldInfo=this._instance.GetWorldInfo()),this._worldInfo&&this._worldInfo.SetBboxChanged())}}AfterInterpolate(){}_LoadFromJson(b){super._LoadFromJson(b);this._CachePropertyTracks()}}}
{"use strict";const e=self.C3;e.TweenPropertyTrackState=class extends e.PropertyTrackState{constructor(b,a){super(b,a);this._basic=!1}static Create(b,a){return e.New(e.TweenPropertyTrackState,b,a)}Interpolate(b,a=!1,c=!1){if(this._basic){var d=this._propertyKeyframeDataItems[0];var f=this._propertyKeyframeDataItems[1]}else{if(a)d=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){f=this.GetTimeline();
const h=this._lastPropertyKeyframeDataItem.GetNext();d=this._lastPropertyKeyframeDataItem.GetTime();f=h?h.GetTime():f.GetTotalTime();if(b<=d||b>=f)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);d=this._lastPropertyKeyframeDataItem}f=d.GetNext()}this._sourceAdapter.Interpolate(b,
d,f,a,c)}AddPropertyKeyframe(){const b=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;this._basic=2>=this.GetPropertyKeyframeDataItems().length;return b}DeletePropertyKeyframes(b){this._lastPropertyKeyframeDataItem=null;this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b);this._basic=2>=this.GetPropertyKeyframeDataItems().length}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson(),
basic:this._basic}}_LoadFromJson(b){b&&(this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson),this._basic=b.basic)}}}
{"use strict";const e=self.C3,b=self.Ease;e.Transition=class extends e.DefendedBase{constructor(a){super();this._name=a[0];this._transitionKeyframes=[];for(var c of a[1])a=e.TransitionKeyframe.Create(this,c),this._transitionKeyframes.push(a);for(c=0;c<this._transitionKeyframes.length;c++)this._transitionKeyframes[c].SetNext(this._transitionKeyframes[c+1]);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();b.AddCustomEase(this._name,(d,f,h,g)=>this.Interpolate(d,
f,h,g))}static Create(a){return e.New(e.Transition,a)}Release(){for(const a of this._transitionKeyframes)a.Release();e.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(a){const c=this._transitionKeyframeCache.get(a);if(c)return c;for(const d of this._transitionKeyframes)if(d.GetValueX()===a)return this._transitionKeyframeCache.set(a,
d),d}GetFirstTransitionKeyFrameHigherThan(a){for(const c of this._transitionKeyframes)if(c.GetValueX()>a)return c}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const c of this._transitionKeyframes)if(c.GetValueX()>=a)return c}GetFirstTransitionKeyFrameLowerThan(a){for(let c=this._transitionKeyframes.length-1;0<=c;c--){const d=this._transitionKeyframes[c];if(d.GetValueX()<a)return d}}GetFirstTransitionKeyFrameLowerOrEqualThan(a){for(let c=this._transitionKeyframes.length-1;0<=c;c--){const d=this._transitionKeyframes[c];
if(d.GetValueX()<=a)return d}}Interpolate(a,c,d,f){var h=a/f;a=this.GetFirstTransitionKeyFrameLowerOrEqualThan(h);f=a.GetNext();f||(a=this.GetFirstTransitionKeyFrameLowerThan(h),f=a.GetNext());var g=f.GetValueX()-a.GetValueX();h=e.mapToRange(h,a.GetValueX(),f.GetValueX(),0,g);g=a.GetValueX();const l=a.GetValueY(),m=a.GetValueX()+a.GetStartAnchorX(),u=a.GetValueY()+a.GetStartAnchorY(),v=f.GetValueX()+f.GetEndAnchorX(),t=f.GetValueY()+f.GetEndAnchorY(),q=f.GetValueX();f=f.GetValueY();f=b.GetRuntimeEase("spline")(h,
g,l,m,u,v,t,q,f,this._precalculatedSamples.get(a));f+=a.GetValueY();return(1-f)*c+f*(c+d)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let d=0;d<this._transitionKeyframes.length-1;d++){var a=this._transitionKeyframes[d];if(!a.GetStartEnable())continue;var c=this._transitionKeyframes[d+1];const f=a.GetValueX(),h=a.GetValueX()+a.GetStartAnchorX(),g=c.GetValueX()+c.GetEndAnchorX();c=c.GetValueX();this._precalculatedSamples.set(a,b.GetBezierSamples(f,h,g,c))}}}}
{"use strict";const e=self.C3;e.TransitionKeyframe=class extends e.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];this._next=null}Release(){this._transition=null}static Create(b,a){return e.New(e.TransitionKeyframe,b,a)}SetNext(b){this._next=b}GetNext(){return this._next}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 e=self.C3;e.TransitionManager=class extends e.DefendedBase{constructor(b){super();this._runtime=b;this._transitions=[]}Release(){for(const b of this._transitions)b.Release();e.clearArray(this._transitions);this._transitions=null}Create(b){this._transitions.push(e.Transition.Create(b))}}}
{"use strict";const e=self.C3;e.SolStack=class extends e.DefendedBase{constructor(b){super();this._objectClass=b;this._stack=[];this._stack.push(e.New(e.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const b of this._stack)b.Release();e.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=e.New(e.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(e.New(e.Sol,this));const c=b[a];c.Copy(b[a-1]);this._current=c}Pop(){this._current=this._stack[--this._index]}RemoveInstances(b){const a=this._stack;for(let c=0,d=a.length;c<d;++c)a[c].RemoveInstances(b)}}}
{"use strict";const e=self.C3;e.Sol=class extends e.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(){e.clearArray(this._instances);e.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;e.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(b){b.IsSelectAll()?this.Reset():(this._selectAll=!1,e.shallowAssignArray(this._instances,
b._instances),e.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;e.clearArray(this._instances);this._instances.push(b)}SetArrayPicked(b){this._selectAll=!1;e.shallowAssignArray(this._instances,b)}SetSetPicked(b){this._selectAll=!1;e.clearArray(this._instances);
for(const a of b)this._instances.push(a)}AddElseInstances(b,a){for(const c of a)b.has(c)||this._elseInstances.push(c)}TransferElseInstancesToOwn(b){for(const a of b)this._instances.push(a);e.arrayRemoveAllInSet(this._elseInstances,b)}PickOne(b){b&&(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()?(this.IsSelectAll()&&(e.clearArray(this._instances),e.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){e.arrayRemoveAllInSet(this._instances,b);e.arrayRemoveAllInSet(this._elseInstances,b)}}}
{"use strict";const e=self.C3;e.EventStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._stack.push(e.New(e.EventStackFrame,this,null));this._index=0;this._expFuncStack=[]}Release(){for(const b of this._stack)b.Release();e.clearArray(this._stack);e.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 c=++this._index;if(c===a.length)return b=e.New(e.EventStackFrame,this,b),a.push(b),b;a=a[c];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.at(-1)}}}
{"use strict";const e=self.C3;e.EventStackFrame=class extends e.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 e=self.C3;e.LocalVarStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1;this._current=null;this._initialValues=[]}Release(){e.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)):e.shallowAssignArray(a[b],this._initialValues);this._current=a[b]}Pop(){this._current=this._stack[--this._index]}}}
{"use strict";const e=self.C3;e.LoopStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1}Release(){e.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=
e.New(e.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 c=this._index;0<=c;--c){const d=a[c];if(d.GetName()===b)return d}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}}
{"use strict";const e=self.C3;e.Loop=class extends e.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 e=self.C3;e.ArrayStack=class extends e.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){e.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 e=self.C3;function b(c,d){return c.GetIndex()-d.GetIndex()}function a(c,d){for(let f=0,h=c.length;f<h;++f)if(c[f]!==d[f])return!1;return!0}e.EventSheetManager=class extends e.DefendedBase{constructor(c){super();this._runtime=c;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=e.New(e.EventStack,this);this._localVarStack=e.New(e.LocalVarStack,this);this._loopStack=e.New(e.LoopStack,this);this._triggersToPostInit=[];this._queuedTriggers=[];this._queuedDebugTriggers=[];this._blockFlushingDepth=this._executingTriggerDepth=this._runningEventsDepth=0;this._scheduledWaits=[];this._asyncActionPromises=[];self.c3_callFunction=(d,f)=>this._InvokeFunctionFromJS(d,
f)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;e.clearArray(this._queuedTriggers);e.clearArray(this._queuedDebugTriggers);this._runtime=null;e.clearArray(this._allSheets);this._sheetsByName.clear()}Create(c){c=e.New(e.EventSheet,this,c);this._allSheets.push(c);this._sheetsByName.set(c.GetName().toLowerCase(),c)}_AddTriggerToPostInit(c){this._triggersToPostInit.push(c)}_PostInit(){for(const c of this._functionBlocksByName.values())c._PostInit(!1);
for(const c of this._allSheets)c._PostInit();for(const c of this._allSheets)c._UpdateDeepIncludes();for(const c of this._triggersToPostInit)c._PostInit(!1);e.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(c){return this._sheetsByName.get(c.toLowerCase())||null}_RegisterGroup(c){this._allGroups.push(c);this._groupsByName.set(c.GetGroupName(),c)}_RegisterEventBlock(c){this._blocksBySid.set(c.GetSID(),
c)}_RegisterCondition(c){this._cndsBySid.set(c.GetSID(),c)}_RegisterAction(c){this._actsBySid.set(c.GetSID(),c)}_RegisterFunctionBlock(c){this._functionBlocksByName.set(c.GetFunctionName().toLowerCase(),c)}_RegisterEventVariable(c){this._eventVarsBySid.set(c.GetSID(),c);c.IsGlobal()?this._allGlobalVars.push(c):this._allLocalVars.push(c)}_DeduplicateSolModifierList(c){2<=c.length&&c.sort(b);let d=this._allUniqueSolModifiers.get(c.length);d||(d=[],this._allUniqueSolModifiers.set(c.length,d));for(let f=
0,h=d.length;f<h;++f){const g=d[f];if(a(c,g))return g}d.push(c);return c}_GetNextLocalVarIndex(c){this._localVarInitialValues.push(c.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const c=this.GetCurrentEventStackFrame();return c.GetCurrentEvent().GetConditionAt(c.GetConditionIndex())}GetCurrentAction(){const c=
this.GetCurrentEventStackFrame();return c.GetCurrentEvent().GetActionAt(c.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetAllLocalVariablesInScope(c){const d=[];for(c=c.GetScopeParent();c;)e.appendArray(d,c._GetAllLocalVariablesInScope()),c=c.GetScopeParent();return d}_GetLocalVariablesScriptInterface(c){const d={};for(const f of this.GetAllLocalVariablesInScope(c))d[f.GetJsPropName()]=f._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,
d)}GetEventVariableBySID(c){return this._eventVarsBySid.get(c)||null}GetEventBlockBySID(c){return this._blocksBySid.get(c)||null}GetConditionBySID(c){return this._cndsBySid.get(c)||null}GetActionBySID(c){return this._actsBySid.get(c)||null}GetFunctionBlockByName(c){return this._functionBlocksByName.get(c.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const c of this._allGlobalVars)c.ResetToInitialValue()}GetEventGroupByName(c){return this._groupsByName.get(c.toLowerCase())||
null}GetEventGroupBySID(c){return(c=this._blocksBySid.get(c))&&c.IsGroup()?c:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const c of this._allGroups)c.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const c of this._allSheets)c._ResetHasRunFlag()}RunEvents(c){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const d of c.runningLayouts())if(c=d.GetEventSheet())this._runtime.PushCurrentLayout(d),c.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(c){this._ResetAllHasRunFlags();
this._runningEventsDepth++;for(const d of this._DebugRunEventsGen(c))await this._runtime.DebugBreak(d);this._runningEventsDepth--}*_DebugRunEventsGen(c){for(const d of c.runningLayouts())if(c=d.GetEventSheet())this._runtime.PushCurrentLayout(d),yield*c.DebugRun(),this._runtime.PopCurrentLayout()}_Trigger(c,d,f,h){let g=!1;if(!c.GetMainRunningLayout())return this.QueueTrigger(d,f,h);this._executingTriggerDepth++;for(const l of c.runningLayouts())if(c=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);
for(const m of c.deepIncludes()){const u=m._Trigger(d,f,h);g=g||u}c=c._Trigger(d,f,h);g=g||c;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return g}*_DebugTrigger(c,d,f,h){let g=!1;if(!c.GetMainRunningLayout())return this.QueueTrigger(d,f,h);this._executingTriggerDepth++;for(const l of c.runningLayouts())if(c=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);for(const m of c.deepIncludes()){const u=yield*m._DebugTrigger(d,f,h);g=g||u}c=yield*c._DebugTrigger(d,f,h);g=g||c;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;
return g}QueueTrigger(c,d,f){this._queuedTriggers.push([c,d,f]);return!1}QueueDebugTrigger(c,d,f){let h=null;const g=new Promise(l=>h=l);this._queuedDebugTriggers.push([c,d,f,h]);return g}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const c=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [d,f,h,g]=this._queuedDebugTriggers.shift(),l=yield*this._DebugTrigger(c,d,f,h);g(l)}}async RunQueuedDebugTriggersAsync(){for(const c of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(c)}_FastTrigger(c,
d,f,h){let g=!1;var l=c.GetMainRunningLayout();if(c=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=c.deepIncludes();for(let m=0,u=l.length;m<u;++m){const v=l[m]._FastTrigger(d,f,h);g=g||v}d=c._FastTrigger(d,f,h);g=g||d;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}*_DebugFastTrigger(c,d,f,h){let g=!1;var l=c.GetMainRunningLayout();if(c=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=c.deepIncludes();
for(let m=0,u=l.length;m<u;++m){const v=yield*l[m]._DebugFastTrigger(d,f,h);g=g||v}d=yield*c._DebugFastTrigger(d,f,h);g=g||d;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}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(c){for(const [d,f,h]of this._queuedTriggers)this._Trigger(c,d,f,h);e.clearArray(this._queuedTriggers)}BlockFlushingInstances(c){c?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(c){for(let d=0,f=c.length;d<f;++d)c[d].GetSolStack().Clear()}PushCleanSol(c){for(let d=0,f=c.length;d<f;++d)c[d].GetSolStack().PushClean()}PushCopySol(c){for(let d=0,f=c.length;d<f;++d)c[d].GetSolStack().PushCopy()}PopSol(c){for(let d=
0,f=c.length;d<f;++d)c[d].GetSolStack().Pop()}AddScheduledWait(){const c=e.New(e.ScheduledWait,this);this._scheduledWaits.push(c);return c}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var c=this.GetCurrentEventStackFrame(),d=!1;this._runningEventsDepth++;for(let f=0,h=this._scheduledWaits.length;f<h;++f){const g=this._scheduledWaits[f];g._ShouldRun()&&g._Run(c);g.ShouldRelease()&&(d=!0)}d&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var c=
this.GetCurrentEventStackFrame(),d=!1;this._runningEventsDepth++;for(let f=0,h=this._scheduledWaits.length;f<h;++f){const g=this._scheduledWaits[f];g._ShouldRun()&&await g._DebugRun(c);g.ShouldRelease()&&(d=!0)}d&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const c=e.arrayFilterOut(this._scheduledWaits,d=>d.ShouldRelease());for(const d of c)d.Release()}ClearAllScheduledWaits(){for(const c of this._scheduledWaits)c.Release();e.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(c){for(const d of this._scheduledWaits)d.RemoveInstances(c)}AddAsyncActionPromise(c){this._asyncActionPromises.push(c)}ClearAsyncActionPromises(){e.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const c=
Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return c}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(c){this._LoadGroupsFromJson(c.groups);this._LoadCndsFromJson(c.cnds);this._LoadActsFromJson(c.acts);this._LoadVarsFromJson(c.vars);this._LoadScheduledWaitsFromJson(c.waits)}_SaveGroupsToJson(){const c={};for(const d of this.GetAllGroups())c[d.GetSID().toString()]=
d.IsGroupActive();return c}_LoadGroupsFromJson(c){for(const [d,f]of Object.entries(c))c=parseInt(d,10),(c=this.GetEventGroupBySID(c))&&c.SetGroupActive(f)}_SaveCndsToJson(){const c={};for(const [d,f]of this._cndsBySid){const h=f._SaveToJson();h&&(c[d.toString()]=h)}return c}_LoadCndsFromJson(c){const d=new Map;for(const [f,h]of Object.entries(c))d.set(parseInt(f,10),h);for(const [f,h]of this._cndsBySid)h._LoadFromJson(d.get(f)||null)}_SaveActsToJson(){const c={};for(const [d,f]of this._actsBySid){const h=
f._SaveToJson();h&&(c[d.toString()]=h)}return c}_LoadActsFromJson(c){const d=new Map;for(const [f,h]of Object.entries(c))d.set(parseInt(f,10),h);for(const [f,h]of this._actsBySid)h._LoadFromJson(d.get(f)||null)}_SaveVarsToJson(){const c={};for(const [d,f]of this._eventVarsBySid)f.IsConstant()||!f.IsGlobal()&&!f.IsStatic()||(c[d.toString()]=f.GetValue());return c}_LoadVarsFromJson(c){for(const [d,f]of Object.entries(c))c=parseInt(d,10),(c=this.GetEventVariableBySID(c))&&c.SetValue(f)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(c=>
!c.IsPromise()).map(c=>c._SaveToJson())}_LoadScheduledWaitsFromJson(c){this.ClearAllScheduledWaits();for(const d of c)(c=e.ScheduledWait._CreateFromJson(this,d))&&this._scheduledWaits.push(c)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(c=>c.GetEventSheet()).filter(c=>c).map(c=>c._GetPerfRecord())}FindFirstFunctionBlockParent(c){for(;c;)if(c=c.GetScopeParent(),c instanceof e.FunctionBlock)return c;return null}_InvokeFunctionFromJS(c,d){Array.isArray(d)||(d=[]);
c=this.GetFunctionBlockByName(c.toLowerCase());if(!c)return null;if(!c.IsEnabled())return c.GetDefaultReturnValue();var f=c.GetFunctionParameters();if(d.length<f.length){d=d.slice(0);do d.push(f[d.length].GetInitialValue());while(d.length<f.length)}f=c.GetEventBlock();return f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),c.GetReturnType(),c.GetDefaultReturnValue(),...d)}}}
{"use strict";const e=self.C3;e.EventSheet=class extends e.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 c of a[1])this._CreateEvent(c,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,c){switch(b[0]){case 0:case 3:this._CreateEventBlock(b,a,c);break;case 1:this._CreateEventVariable(b,a,c);break;case 2:this._CreateInclude(b,a,c);break;case 4:this._CreateFunctionBlock(b,a);break;case 5:this._CreateScriptBlock(b,a,c);break;default:throw Error("invalid event type");}}_CreateEventBlock(b,a,c){b=e.EventBlock.Create(this,a,b);if(b.IsOrBlock()){c.push(b);c=b.GetConditions();for(let d=0,f=c.length;d<
f;++d)c[d].IsTrigger()&&this._InitTrigger(b,d)}else b.IsTrigger()?this._InitTrigger(b,0):c.push(b)}_CreateFunctionBlock(b,a){b=e.FunctionBlock.Create(this,a,b);this._eventSheetManager._RegisterFunctionBlock(b)}_CreateEventVariable(b,a,c){b=e.EventVariable.Create(this,a,b);c.push(b)}_CreateInclude(b,a,c){b=e.EventInclude.Create(this,a,b);c.push(b)}_CreateScriptBlock(b,a,c){b=e.EventScript.Create(this,a,b);c.push(b)}_InitTrigger(b,a){b.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(b);var c=
b.GetConditionAt(a),d=c._GetFunc(),f=c.GetObjectClass();if(c.IsFastTrigger()){var h=this._fastTriggers.get(f);h||(h=new Map,this._fastTriggers.set(f,h));c=c.GetFastTriggerValue().toLowerCase();f=h.get(d);f||(f=new Map,h.set(d,f));d=f.get(c);d||(d=[],f.set(c,d));d.push([b,a])}else h=this._triggers.get(f),h||(h={methodMap:new Map,behaviors:new Map},this._triggers.set(f,h)),(f=c.GetBehaviorType())?(c=h.behaviors.get(f),c||(c=new Map,h.behaviors.set(f,c))):c=h.methodMap,h=c.get(d),h||(h=[],c.set(d,h)),
h.push([b,a])}_PostInit(){const b=this._events;for(let a=0,c=b.length;a<c;++a){const d=a<c-1&&b[a+1]instanceof e.EventBlock&&b[a+1].IsElseBlock();b[a]._PostInit(d)}}_AddShallowInclude(b){this._shallowIncludes.push(b)}_UpdateDeepIncludes(){e.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(b){const a=b._deepIncludes,c=b._alreadyIncludedSheets;for(const d of this._shallowIncludes){const f=d.GetIncludeSheet();d.IsActive()&&b!==f&&!c.has(f)&&
(c.add(f),f._AddDeepIncludes(b),a.push(f))}}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(),c=a?performance.now():0;this._hasRun=!0;var d=this.GetEventSheetManager(),
f=d.GetCurrentEventStackFrame();for(const h of this._events)h.Run(f),d.ClearSol(h.GetSolModifiers()),d.ClearAsyncActionPromises(),b.FlushPendingInstances();f.Reset(null);a&&(this._perfRecord.totalTimeCounter+=performance.now()-c)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var b=this._runtime,a=this.GetEventSheetManager(),c=a.GetCurrentEventStackFrame();for(const d of this._events)yield*d.DebugRun(c),a.ClearSol(d.GetSolModifiers()),a.ClearAsyncActionPromises(),b.FlushPendingInstances();c.Reset(null)}}_Trigger(b,
a,c){if(a){const d=a.GetObjectClass();this._TriggerForClass(b,a,d,c);for(const f of d.GetFamilies())this._TriggerForClass(b,a,f,c)}else return this._TriggerForClass(b,a,null,null)}_TriggerForClass(b,a,c,d){c=this._triggers.get(c);if(!c)return!1;d=d?c.behaviors.get(d):c.methodMap;if(!d)return!1;d=d.get(b);if(!d)return!1;b=!1;for(const [f,h]of d)d=this._ExecuteTrigger(a,f,h),b=b||d;return b}*_DebugTrigger(b,a,c){if(a){const d=a.GetObjectClass();yield*this._DebugTriggerForClass(b,a,d,c);for(const f of d.GetFamilies())yield*this._DebugTriggerForClass(b,
a,f,c)}else return yield*this._DebugTriggerForClass(b,a,null,null)}*_DebugTriggerForClass(b,a,c,d){c=this._triggers.get(c);if(!c)return!1;d=d?c.behaviors.get(d):c.methodMap;if(!d)return!1;d=d.get(b);if(!d)return!1;b=!1;for(const [f,h]of d)d=f.DebugCanRunFast()?this._ExecuteTrigger(a,f,h):yield*this._DebugExecuteTrigger(a,f,h),b=b||d;return b}_FastTrigger(b,a,c){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;c=b.get(c);if(!c)return!1;b=!1;for(let d=0,f=c.length;d<
f;++d)a=c[d],a=this._ExecuteTrigger(null,a[0],a[1]),b=b||a;return b}*_DebugFastTrigger(b,a,c){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;c=b.get(c);if(!c)return!1;b=!1;for(let f=0,h=c.length;f<h;++f){var d=c[f];a=d[0];d=d[1];a=a.DebugCanRunFast()?this._ExecuteTrigger(null,a,d):yield*this._DebugExecuteTrigger(null,a,d);b=b||a}return b}_ExecuteTrigger(b,a,c){const d=this._runtime,f=this._eventSheetManager,h=f.GetCurrentEvent(),g=f.GetEventStack(),l=f.GetTriggerDepth();
let m=!1;h&&f.PushCleanSol(h.GetSolModifiersIncludingParents());f.PushCleanSol(a.GetSolModifiersIncludingParents());const u=1<l;u&&f.GetLocalVarStack().Push();const v=g.Push(a);b&&(a.GetConditions()[c].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const t=a.GetTriggerParents();for(let q=0,p=t.length;q<p;++q)if(!t[q].RunPreTrigger(v)){b=!1;break}}b&&(d.IncrementExecCount(),a.IsOrBlock()?a.RunOrBlockTrigger(v,c):a.Run(v),m=
v.GetLastEventTrue());g.Pop();u&&f.GetLocalVarStack().Pop();f.PopSol(a.GetSolModifiersIncludingParents());h&&f.PopSol(h.GetSolModifiersIncludingParents());h||1!==l||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||d.FlushPendingInstances());return m}*_DebugExecuteTrigger(b,a,c){const d=this._runtime,f=this._eventSheetManager,h=f.GetCurrentEvent(),g=f.GetEventStack(),l=f.GetTriggerDepth();let m=!1;h&&f.PushCleanSol(h.GetSolModifiersIncludingParents());f.PushCleanSol(a.GetSolModifiersIncludingParents());
const u=1<l;u&&f.GetLocalVarStack().Push();const v=g.Push(a);b&&(a.GetConditions()[c].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const t=a.GetTriggerParents();for(let q=0,p=t.length;q<p;++q)if(!(yield*t[q].DebugRunPreTrigger(v))){b=!1;break}}b&&(d.IncrementExecCount(),a.IsOrBlock()?yield*a.DebugRunOrBlockTrigger(v,c):yield*a.DebugRun(v),m=v.GetLastEventTrue());g.Pop();u&&f.GetLocalVarStack().Pop();f.PopSol(a.GetSolModifiersIncludingParents());
h&&f.PopSol(h.GetSolModifiersIncludingParents());h||1!==l||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||d.FlushPendingInstances());return m}_GetPerfRecord(){return this._perfRecord}}}
{"use strict";const e=self.C3,b=[];function a(d,f){return!0}function*c(d,f){return!0}e.EventBlock=class extends e.DefendedBase{constructor(d,f,h){super();this._eventSheet=d;this._runtime=d.GetRuntime();this._parent=f;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=!1;this._isOrBlock=!!h[2];
this._isElseBlock=!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=a;this._DebugRunActions=c;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=h[4];this._displayNumber=h[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:h[3][0],isBreakable:h[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,
canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===h[0]&&this._InitGroup(h[1]);d=0;for(var g of h[6])f=e.Condition.Create(this,g,d++),this._conditions.push(f),this._AddSolModifier(f.GetObjectClass());d=0;for(const l of h[7])g=e.Action.Create(this,l,d++),this._actions.push(g);if(9===h.length){h=h[8];for(const l of h)this._eventSheet._CreateEvent(l,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&&
this._conditions[0]._GetFunc()===e.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(d,f,h){return e.New(e.EventBlock,d,f,h)}_InitGroup(d){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!d[0];this._groupName=d[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);this._runtime.IsDebug()&&(this._perfRecord={type:"group",
name:d[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(d){this._containedIncludes.push(d)}_AddContainerSolModifierToList(d,f){for(const h of d.GetContainer().objectTypes())f.includes(h)||f.push(h)}_AddSolModifierToList(d,f){if(d)if(f.includes(d)||f.push(d),d.IsFamily())for(const h of d.GetFamilyMembers())h.IsInContainer()&&this._AddContainerSolModifierToList(h,f);else d.IsInContainer()&&this._AddContainerSolModifierToList(d,f)}_AddSolModifier(d){this._AddSolModifierToList(d,this._solModifiers)}_AddParentSolModifier(d){this._AddSolModifierToList(d,
this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(d){this._hasElseBlock=!!d;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const h of this._conditions)h._PostInit();if(0<this._actions.length){d=!1;for(var f of this._actions)f._PostInit(),f.HasReturnType()&&(d=!0);d?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions=
this._DebugRunActions_Fast)}f=this._subEvents;for(let h=0,g=f.length;h<g;++h)d=h<g-1&&f[h+1]instanceof e.EventBlock&&f[h+1].IsElseBlock(),f[h]._PostInit(d);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let d=this.GetParent();for(;d;){if(d.IsGroup())return d;d=d.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const d=this._debugData;d.canRunAllConditionsFast=
this._conditions.every(f=>f.DebugCanRunFast());d.canRunAllActionsFast=this._actions.every(f=>f.DebugCanRunFast());d.canRunAllSubEventsFast=this._subEvents.every(f=>f.DebugCanRunFast());d.canRunSelfFast=d.canRunAllConditionsFast&&d.canRunAllActionsFast&&d.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let d=this;do d._UpdateCanRunFast(),d=d.GetParent();while(d)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var d=this.GetParent();for(this._isTopLevelGroup=!0;d;){if(!d.IsGroup()){this._isTopLevelGroup=
!1;break}d=d.GetParent()}}}_IdentifySolModifiersIncludingParents(){var d=this._runtime.GetAllObjectClasses();if(this._solModifiers===d)this._solModifiersIncludingParents=d;else{this._solModifiersIncludingParents=e.cloneArray(this._solModifiers);for(d=this.GetParent();d;){for(var f of d._solModifiers)this._AddParentSolModifier(f);d=d.GetParent()}f=this.GetEventSheetManager();this._solModifiers=f._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=f._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=
[];for(var d=this.GetParent();d;)this._triggerParents.push(d),d=d.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(d){return this._solModifiers.includes(d)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(d){this._scopeParent=
d}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(d){this._debugData.isBreakpoint=!!d;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(d){d=
!!d;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==d){this._isGroupActive=d;for(const f of this._containedIncludes)f.UpdateActive();this._containedIncludes.length&&(d=this._runtime.GetCurrentLayout().GetEventSheet())&&d._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 e.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||
this._conditions.some(d=>d.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(d){d=Math.floor(d);if(0>d||d>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[d]}GetConditionByDebugIndex(d){return this.GetConditionAt(d)}IsFirstConditionOfType(d){let f=d.GetIndex();if(0===f)return!0;for(--f;0<=f;--f)if(this._conditions[f].GetObjectClass()===d.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(d){d=
Math.floor(d);if(0>d||d>=this._actions.length)throw new RangeError("invalid action index");return this._actions[d]}GetActionByDebugIndex(d){d=Math.floor(d);const f=this._actions.find(h=>h.GetDebugIndex()===d);if(!f)throw new RangeError("invalid action debug index");return f}_HasActionIndex(d){d=Math.floor(d);return 0<=d&&d<this._actions.length}GetSubEvents(){return this._subEvents}_GetAllLocalVariablesInScope(){return this._subEvents.filter(d=>d instanceof e.EventVariable)}RunPreTrigger(d){d.SetCurrentEvent(this);
let f=!1;const h=this._conditions;for(let g=0,l=h.length;g<l;++g){const m=h[g];d.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.Run())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}RunOrBlockTrigger(d,f){d.SetCurrentEvent(this);this._conditions[f].Run()&&(this._RunActions(d,0)&&this._RunSubEvents(d),d.SetLastEventTrue(!0))}*DebugRunPreTrigger(d){d.SetCurrentEvent(this);let f=!1;const h=this._conditions;for(let g=0,l=h.length;g<
l;++g){const m=h[g];d.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.DebugCanRunFast()?m.Run():yield*m.DebugRun())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}*DebugRunOrBlockTrigger(d,f){d.SetCurrentEvent(this);f=this._conditions[f];if(f.DebugCanRunFast()?f.Run():yield*f.DebugRun())(this.DebugCanRunActionsFast()?this._RunActions(d,0):yield*this._DebugRunActions(d,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():
yield*this._DebugRunSubEvents()),d.SetLastEventTrue(!0)}Run(d){d.SetCurrentEvent(this);this._isElseBlock||d.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(d):this._RunAndBlock(d)}*DebugRun(d){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;d.SetCurrentEvent(this);this._isElseBlock||d.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(d):yield*this._DebugRunAndBlock(d)}_RunOrBlock(d){const f=this._conditions;let h=0===f.length;for(let l=0,m=f.length;l<m;++l){var g=
f[l];g.IsTrigger()||(d.SetConditionIndex(l),g=g.Run(),h=h||g)}d.SetLastEventTrue(h);h&&(this._RunActions(d,0)&&this._RunSubEvents(d),this._hasElseBlock&&d.SetElseBranchRan(!0))}*_DebugRunOrBlock(d){const f=this._conditions;let h=0===f.length;for(let l=0,m=f.length;l<m;++l){var g=f[l];g.IsTrigger()||(d.SetConditionIndex(l),g=g.DebugCanRunFast()?g.Run():yield*g.DebugRun(),h=h||g)}d.SetLastEventTrue(h);h&&((this.DebugCanRunActionsFast()?this._RunActions(d,0):yield*this._DebugRunActions(d,0))&&(this.DebugCanRunSubEventsFast()?
this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&d.SetElseBranchRan(!0))}_RunAndBlock(d){const f=this._conditions;for(let h=0,g=f.length;h<g;++h){const l=f[h];d.SetConditionIndex(h);if(!l.Run()){d.SetLastEventTrue(!1);return}}d.SetLastEventTrue(!0);this._RunActions(d,0)&&this._RunSubEvents(d);d.GetLastEventTrue()&&this._hasElseBlock&&d.SetElseBranchRan(!0)}*_DebugRunAndBlock(d){const f=this._conditions;for(let h=0,g=f.length;h<g;++h){const l=f[h];d.SetConditionIndex(h);if(l.DebugCanRunFast()?
!l.Run():!(yield*l.DebugRun())){d.SetLastEventTrue(!1);return}}d.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(d,0):yield*this._DebugRunActions(d,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());d.GetLastEventTrue()&&this._hasElseBlock&&d.SetElseBranchRan(!0)}_RunActions_Fast(d,f){const h=this._actions;for(let g=f,l=h.length;g<l;++g)f=h[g],d.SetActionIndex(g),f.Run();return!0}*_DebugRunActions_Fast(d,f){const h=this._actions;for(let g=
f,l=h.length;g<l;++g)f=h[g],d.SetActionIndex(g),f.DebugCanRunFast()?f.Run():yield*f.DebugRun();return!0}_RunActions_ReturnValue(d,f){const h=this.GetEventSheetManager(),g=this._actions;for(let l=f,m=g.length;l<m;++l){f=g[l];d.SetActionIndex(l);const u=f.Run();if(f.CanBailOut()&&!0===u)return!1;f.IsAsync()&&u instanceof Promise&&h.AddAsyncActionPromise(u)}return!0}*_DebugRunActions_ReturnValue(d,f){const h=this.GetEventSheetManager(),g=this._actions;for(let l=f,m=g.length;l<m;++l){f=g[l];d.SetActionIndex(l);
let u;u=f.DebugCanRunFast()?f.Run():yield*f.DebugRun();if(f.CanBailOut()&&!0===u)return!1;f.IsAsync()&&u instanceof Promise&&h.AddAsyncActionPromise(u)}return!0}_ResumeActionsAndSubEvents(d){this._RunActions(d,d.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(d){if(yield*this._DebugRunActions(d,d.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var d=this.IsGroup()&&this._runtime.IsCPUProfiling(),f=d?performance.now():0,h=this._eventStack,
g=h.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(g):this._RunSubEvents_Fast(g);h.Pop();d&&(this._perfRecord.totalTimeCounter+=performance.now()-f)}}_RunSubEvents_SolWriterAfterCnds(d){const f=this._isGroup,h=this._isTopLevelGroup,g=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,u=l.length,v=u-1;m<u;++m){const t=l[m],q=t.GetSolModifiers(),p=!h||!f&&m<v;p&&g.PushCopySol(q);t.Run(d);p?g.PopSol(q):g.ClearSol(q)}}_RunSubEvents_Fast(d){const f=this._subEvents;for(let h=
0,g=f.length;h<g;++h)f[h].Run(d)}*_DebugRunSubEvents(){if(this._subEvents.length){var d=this._eventStack,f=d.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(f):yield*this._DebugRunSubEvents_Fast(f);d.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(d){const f=this._isGroup,h=this._isTopLevelGroup,g=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,u=l.length,v=u-1;m<u;++m){const t=l[m],q=t.GetSolModifiers(),p=!h||!f&&m<v;p&&g.PushCopySol(q);yield*t.DebugRun(d);
p?g.PopSol(q):g.ClearSol(q)}}*_DebugRunSubEvents_Fast(d){const f=this._subEvents;for(let h=0,g=f.length;h<g;++h)yield*f[h].DebugRun(d)}Retrigger(d,f){this._runtime.IncrementExecCount();f.ResetQuick();const h=this._conditions;if(!this.IsOrBlock())for(let g=d.GetConditionIndex()+1,l=h.length;g<l;++g)if(d=h[g],f.SetConditionIndex(g),!d.Run())return!1;this._RunActions(f,0)&&this._RunSubEvents(f);return!0}*DebugRetrigger(d,f){this._runtime.IncrementExecCount();f.ResetQuick();const h=this._conditions;if(!this.IsOrBlock())for(let g=
d.GetConditionIndex()+1,l=h.length;g<l;++g)if(d=h[g],f.SetConditionIndex(g),d.DebugCanRunFast()?!d.Run():!(yield*d.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(f,0):yield*this._DebugRunActions(f,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(d){if(this.GetParent()){const f=this.GetTriggerParents();for(let h=0,g=f.length;h<g;++h)if(!f[h].RunPreTrigger(d))return!1}return!0}*_DebugCheckParentsOKToRun(d){if(this.GetParent()){const f=this.GetTriggerParents();for(let h=0,g=f.length;h<g;++h)if(!(yield*f[h].DebugRunPreTrigger(d)))return!1}return!0}_EvaluateFunctionCallParameters(d,f,h){0<f.length?h?(f=f.map(g=>g.Get(0)),d.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(f)):
this._scopeParent.EvaluateFunctionParameters(f):h&&d.GetLocalVarStack().Push()}RunAsFunctionCall(d,f){let h,g;const l=0<d.length;var m=this._runtime;const u=this._eventStack,v=m.GetEventSheetManager(),t=1<v._IncTriggerDepth();this._EvaluateFunctionCallParameters(v,f,t);l&&v.PushCleanSol(d);f=u.Push(this);this._CheckParentsOKToRun(f)&&(m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&([g,h]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g));
u.Pop();t&&v.GetLocalVarStack().Pop();l&&v.PopSol(d);v._DecTriggerDepth();return h}*DebugRunAsFunctionCall(d,f){let h,g;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const l=0<d.length;var m=this._runtime;const u=this._eventStack,v=m.GetEventSheetManager(),t=1<v._IncTriggerDepth();this._EvaluateFunctionCallParameters(v,f,t);l&&v.PushCleanSol(d);f=u.Push(this);if(yield*this._DebugCheckParentsOKToRun(f))m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&
([g,h]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g);u.Pop();t&&v.GetLocalVarStack().Pop();l&&v.PopSol(d);v._DecTriggerDepth();return h}RunAsMappedFunctionCall(d){const f=this.GetSolModifiersIncludingParents(),h=0<f.length,g=this._runtime,l=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(d);h&&m.PushCleanSol(f);d=l.Push(this);
this._CheckParentsOKToRun(d)&&(g.IncrementExecCount(),d.SetCurrentEvent(this),this._RunAndBlock(d));l.Pop();u&&m.GetLocalVarStack().Pop();h&&m.PopSol(f);m._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(d){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const f=this.GetSolModifiersIncludingParents(),h=0<f.length,g=this._runtime,l=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(d);h&&
m.PushCleanSol(f);d=l.Push(this);if(yield*this._DebugCheckParentsOKToRun(d))g.IncrementExecCount(),d.SetCurrentEvent(this),yield*this._DebugRunAndBlock(d);l.Pop();u&&m.GetLocalVarStack().Pop();h&&m.PopSol(f);m._DecTriggerDepth()}RunAsExpressionFunctionCall(d,f,h,...g){let l,m;const u=0<d.length,v=this._runtime,t=this._eventStack,q=v.GetEventSheetManager(),p=1<q._IncTriggerDepth();p&&q.GetLocalVarStack().Push();0<g.length&&this._scopeParent.SetFunctionParameters(g);u&&q.PushCleanSol(d);g=t.Push(this);
g.InitCallFunctionExpression(f,h);t.PushExpFunc(g);v.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(g)&&(v.IncrementExecCount(),g.SetCurrentEvent(this),(f=this._scopeParent.IsAsync())&&([m,l]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(g),f&&this._scopeParent.MaybeFinishAsyncFunctionCall(m));v.SetDebuggingEnabled(!0);t.Pop();t.PopExpFunc();p&&q.GetLocalVarStack().Pop();u&&q.PopSol(d);q._DecTriggerDepth();return l||g.GetFunctionReturnValue()}}}
{"use strict";const e=self.C3,b=[];let a=!1;e.EventScript=class extends e.DefendedBase{constructor(c,d,f){super();const h=c.GetRuntime(),g=c.GetEventSheetManager();this._eventSheet=c;this._eventSheetManager=g;this._runtime=c.GetRuntime();this._parent=d;this._func=h.GetObjectReference(f[1]);this._displayNumber=f[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=h.IsDebug()?{isBreakpoint:f[3][0],isBreakable:f[3][1]}:null}static Create(c,d,f){return e.New(e.EventScript,
c,d,f)}_PostInit(){const c=this._func,d=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=c.bind(null,this._runtime.GetIRuntime(),d)}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(c){this._debugData.isBreakpoint=
!!c}IsElseBlock(){return!1}GetSolModifiers(){return b}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():b}Run(c){c.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(c){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",c),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(c){c.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(c)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return a}static SetHadUserScriptException(){a=!0}}}
{"use strict";const e=self.C3;e.FunctionBlock=class extends e.DefendedBase{constructor(b,a,c){super();this._eventSheet=b;this._runtime=b.GetRuntime();this._parent=a;const d=c[1];this._functionName=d[0];this._returnType=d[1];this._functionParameters=d[2].map(f=>e.EventVariable.Create(b,this,f));this._isEnabled=d[3];this._innerLocalVariables=[];this._isAsync=d[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=e.EventBlock.Create(b,a,c);this._eventBlock._SetScopeParent(this)}static Create(b,
a,c){return e.New(e.FunctionBlock,b,a,c)}_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}_RegisterLocalVariable(b){this._innerLocalVariables.push(b)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(b){const a=this._functionParameters;
for(let c=0,d=a.length;c<d;++c)a[c].SetValue(b[c].Get(0))}SetFunctionParameters(b){const a=this._functionParameters;for(let c=0,d=a.length;c<d;++c)a[c].SetValue(b[c])}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 c=new Promise(d=>a=d);this._asyncMap.set(b,{resolve:a,pauseCount:0});return[b,c]}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 e=self.C3,b=[];e.EventVariable=class extends e.DefendedBase{constructor(a,c,d){super();const f=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=f;this._runtime=a.GetRuntime();this._parent=c;this._localVarStack=f.GetLocalVarStack();this._name=d[1];this._type=d[2];this._initialValue=d[3];this._isStatic=!!d[4];this._isConstant=!!d[5];this._isFunctionParameter=c instanceof e.FunctionBlock;this._sid=d[6];this._jsPropName=this._runtime.GetJsPropName(d[8]);this._scriptSetter=
h=>this.SetValue(h);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=f._GetNextLocalVarIndex(this));f._RegisterEventVariable(this)}static Create(a,c,d){return e.New(e.EventVariable,a,c,d)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const a=
this._eventSheetManager.FindFirstFunctionBlockParent(this);a&&a._RegisterLocalVariable(this)}}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}GetScopeParent(){return this.GetParent()}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 e=self.C3,b=[];e.EventInclude=class extends e.DefendedBase{constructor(a,c,d){super();const f=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=f;this._runtime=a.GetRuntime();this._parent=c;this._includeSheet=null;this._includeSheetName=d[1];this._isActive=!0}static Create(a,c,d){return e.New(e.EventInclude,a,c,d)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let a=
this.GetParent();for(;a;)a instanceof e.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 c=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(c);this._includeSheet.Run();a&&this._eventSheetManager.PopSol(c)}*DebugRun(a){a=
!!this.GetParent();const c=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(c);yield*this._includeSheet.DebugRun();a&&this._eventSheetManager.PopSol(c)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let a=this.GetParent();for(;a;){if(a instanceof e.EventBlock&&a.IsGroup()&&!a.IsGroupActive()){this._isActive=!1;return}a=a.GetParent()}this._isActive=!0}}}
{"use strict";const e=self.C3;e.ExpNode=class extends e.DefendedBase{constructor(l){super();this._owner=l;this._runtime=l.GetRuntime()}_PostInit(){}static CreateNode(l,m){return e.New([h,d,f,g,b,a][m[0]],l,m)}};class b extends e.ExpNode{constructor(l,m){super(l);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(m[1]);this._func!==e.Plugins.System.Exps.random&&this._func!==e.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,
this._systemPlugin)}}class a extends e.ExpNode{constructor(l,m){super(l);this._functionBlock=null;this._functionName=m[1];this._owner.SetVariesPerInstance()}_PostInit(){const l=this._runtime.GetEventSheetManager();this._functionBlock=l.GetFunctionBlockByName(this._functionName);this._functionName=null;const m=this._owner.GetEventBlock(),u=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...m.GetSolModifiersIncludingParents(),...u.GetSolModifiersIncludingParents()])];this._combinedSolModifiers=
l._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const l=this._functionBlock;if(l.IsEnabled()){const m=l.GetEventBlock();return e.EventBlock.prototype.RunAsExpressionFunctionCall.bind(m,this._combinedSolModifiers,l.GetReturnType(),l.GetDefaultReturnValue())}{const m=l.GetDefaultReturnValue();return()=>m}}}function c(l,m){if(l>=m)return l%m;0>l&&(l<=-m&&(l%=m),0>l&&(l+=m));return l}class d extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);
this._func=this._runtime.GetObjectReference(m[2]);this._returnsString=!!m[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(...l){const m=this._objectClass,u=m.GetCurrentSol().GetExpressionInstances();var v=u.length;if(0===v)return this._returnsString?"":0;v=c(this._owner.GetSolIndex(),
v);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);return this._func.apply(u[v].GetSdkInstance(),l)}ExpObject_InstExpr(l,...m){const u=this._objectClass,v=u.GetInstances(),t=v.length;if(0===t)return this._returnsString?"":0;l=c(l,t);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);return this._func.apply(v[l].GetSdkInstance(),m)}}class f extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._varIndex=m[3];
this._returnsString=!!m[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const l=this._objectClass.GetCurrentSol().GetExpressionInstances();var m=l.length;if(0===m)return this._returnsString?"":0;m=c(this._owner.GetSolIndex(),m);return l[m]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var l=this._objectClass,m=l.GetCurrentSol().GetExpressionInstances(),u=m.length;if(0===u)return this._returnsString?"":0;u=c(this._owner.GetSolIndex(),u);m=m[u];l=m.GetObjectClass().GetFamilyInstanceVariableOffset(l.GetFamilyIndex());
return m._GetInstanceVariableValueUnchecked(this._varIndex+l)}ExpInstVar_InstExpr(l){const m=this._objectClass;var u=m.GetInstances();const v=u.length;if(0===v)return this._returnsString?"":0;l=c(l,v);u=u[l];l=0;m.IsFamily()&&(l=u.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex()));return u._GetInstanceVariableValueUnchecked(this._varIndex+l)}}class h extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(m[2]);
this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(m[2]);this._func=this._runtime.GetObjectReference(m[3]);this._returnsString=!!m[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...l){const m=this._objectClass;var u=m.GetCurrentSol().GetExpressionInstances(),v=u.length;if(0===v)return this._returnsString?"":0;v=c(this._owner.GetSolIndex(),v);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);
u=u[v];v=0;m.IsFamily()&&(v=u.GetObjectClass().GetFamilyBehaviorOffset(m.GetFamilyIndex()));return this._func.apply(u.GetBehaviorInstances()[this._behaviorIndex+v].GetSdkInstance(),l)}ExpBehavior_InstExpr(l,...m){const u=this._objectClass;var v=u.GetInstances();const t=v.length;if(0===t)return this._returnsString?"":0;l=c(l,t);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);v=v[l];l=0;u.IsFamily()&&(l=v.GetObjectClass().GetFamilyBehaviorOffset(u.GetFamilyIndex()));return this._func.apply(v.GetBehaviorInstances()[this._behaviorIndex+
l].GetSdkInstance(),m)}}class g extends e.ExpNode{constructor(l,m){super(l);this._eventVar=null;this._eventVarSid=m[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}}
{"use strict";const e=self.C3;e.Parameter=class extends e.DefendedBase{constructor(y,C,G){super();this._owner=y;this._index=G;this._type=C;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(y,C,G){const A=C[0];return e.New([a,c,u,f,g,d,l,a,f,f,v,t,u,p,c,m,h,q,r,x][A],y,A,G,C)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(y){this._variesPerInstance||!y||y.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(y){y=self.C3_ExpressionFuncs[y];if(!y)throw Error("invalid expression number");return y}class a extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._solIndex=0;y=A[1];this._expressionNumber=y[0];this._numberedNodes=[];this._expressionFunc=null;for(let E=1,J=y.length;E<J;++E)this._numberedNodes.push(e.ExpNode.CreateNode(this,y[E]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=b(this._expressionNumber),this._isConstant=!0)}_GetNode(y){if(0>y||y>=this._numberedNodes.length)throw new RangeError("invalid numbered node");
return this._numberedNodes[y]}_PostInit(){for(var y of this._numberedNodes)y._PostInit();y=b(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?y(this):y}GetSolIndex(){return this._solIndex}GetExpression(y){this._solIndex=y;return this._expressionFunc()}}class c extends a{constructor(y,C,G,A){super(y,C,G,A);this.Get=this.GetStringExpression;14===C&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof e.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(y){this._solIndex=
y;y=this._expressionFunc();return"string"===typeof y?y:""}_GetFastTriggerValue(){return b(this._expressionNumber)()}}class d extends a{constructor(y,C,G,A){super(y,C,G,A);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(y){this._solIndex=y;y=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(y)}}class f extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._combo=A[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class h extends e.Parameter{constructor(y,
C,G,A){super(y,C,G);this._bool=A[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class g extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._objectClass=this.GetRuntime().GetObjectClassByIndex(A[1]);this.Get=this.GetObjectClass;y=this.GetEventBlock();y._AddSolModifier(this._objectClass);this._owner instanceof e.Action?y.SetSolWriterAfterCnds():y.GetParent()&&y.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}}
class l extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(A[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class m extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(A[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class u extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._fileInfo=
A[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class v extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._instVarIndex=A[1];(y=this._owner.GetObjectClass())&&y.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(y){y=y||0;const C=this._owner.GetObjectClass();var G=C.GetCurrentSol();const A=G.GetInstances();
if(A.length)y=A[y%A.length].GetObjectClass();else if(G.HasAnyElseInstances())G=G.GetElseInstances(),y=G[y%G.length].GetObjectClass();else if(0<C.GetInstanceCount())G=C.GetInstances(),y=G[y%G.length].GetObjectClass();else return 0;return this._instVarIndex+y.GetFamilyInstanceVariableOffset(C.GetFamilyIndex())}}class t extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._eventVarSid=A[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 q extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._functionBlockName=A[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 p extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let E=1,J=A.length;E<
J;++E)y=e.Parameter.Create(this._owner,A[E],0),this._subParams.push(y),this._variadicRet.push(0),y.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const y of this._subParams)y._PostInit()}GetVariadic(){const y=this._subParams,C=this._variadicRet;for(let G=0,A=y.length;G<A;++G)C[G]=y[G].Get(0);return C}}class r extends e.Parameter{constructor(y,C,G,A){super(y,C,G);this._easeIndex=A[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}class x extends e.Parameter{constructor(y,
C,G,A){super(y,C,G);this._brushIndex=A[1];this.Get=this.GetTilemapBrush;this._isConstant=!0}GetTilemapBrush(){return this._brushIndex}}}
{"use strict";const e=self.C3;function b(d,f){for(let h=0,g=d.length;h<g;++h)f[h]=d[h].Get(0)}const a=[],c=function(){};e.Condition=class extends e.DefendedBase{constructor(d,f,h){super();this._eventBlock=d;this._runtime=d.GetRuntime();this._index=h;this._func=this._runtime.GetObjectReference(f[1]);this._isTrigger=0<f[3];this._isFastTrigger=2===f[3];this._isLooping=!!f[4];this._isInverted=!!f[5];this._isStatic=!!f[6];this._sid=f[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType=
this._objectClass=null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=c;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:f[8][0],canDebug:f[8][1]}:null;-1===f[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(f[0]),f[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(f[2]),this._behaviorIndex=
this._objectClass.GetBehaviorIndexByName(f[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===f.length){d=f[9];for(let g of d)this._parameters.push(e.Parameter.Create(this,g,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(d,f,h){return e.New(e.Condition,d,f,h)}_PostInit(){for(const d of this._parameters)d._PostInit(),
d.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 d=this._objectClass.GetPlugin(),f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(d,f,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(d,f,h){const g=this._func,l=this._isInverted,m=this._parameters;if(0===m.length){const u=d._GetBoundACEMethod(g,f);this.Run=l?function(){return e.xor(u(),l)}:u}else if(1===m.length){const u=m[0];if(!l&&u.IsConstant())this.Run=d._GetBoundACEMethod_1param(g,
f,u.Get(0));else{const v=d._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(v(u.Get(0)),l)}}}else if(2===m.length){const u=m[0],v=m[1];if(!l&&u.IsConstant()&&v.IsConstant())this.Run=d._GetBoundACEMethod_2params(g,f,u.Get(0),v.Get(0));else{const t=d._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(t(u.Get(0),v.Get(0)),l)}}}else if(3===m.length){const u=m[0],v=m[1],t=m[2];if(!l&&u.IsConstant()&&v.IsConstant()&&t.IsConstant())this.Run=d._GetBoundACEMethod_3params(g,f,u.Get(0),v.Get(0),
t.Get(0));else{const q=d._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(q(u.Get(0),v.Get(0),t.Get(0)),l)}}}else this.Run=h}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(d){this._debugData.isBreakpoint=
!!d;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 d=this._results;b(this._parameters,d);return e.xor(this._func.apply(this._systemPlugin,d),
this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var d=this._results;b(this._parameters,d);d=this._func.apply(this._systemPlugin,d);e.IsIterator(d)&&(d=yield*d);return e.xor(d,this._isInverted)}return this.Run()}_RunSingleGlobal(){const d=this._results;b(this._parameters,d);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return e.xor(this._func.apply(f,d),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var d=this._results;b(this._parameters,d);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();d=this._func.apply(f,d);e.IsIterator(d)&&(d=yield*d);return e.xor(d,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var d=this._results;b(this._parameters,d);d=this._func.apply(this._behaviorType||
this._objectClass,d);this._objectClass.ApplySolToContainer();return d}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var d=this._results;b(this._parameters,d);d=this._func.apply(this._behaviorType||this._objectClass,d);e.IsIterator(d)&&(d=yield*d);this._objectClass.ApplySolToContainer();return d}return this.Run()}_RunObject(){const d=this._parameters,f=this._results,h=this._objectClass.GetCurrentSol();for(let g=0,l=d.length;g<
l;++g){const m=d[g];m.VariesPerInstance()||(f[g]=m.Get(0))}return h.IsSelectAll()?this._RunObject_FirstFilter(h):this._RunObject_NextFilter(h)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(d){const f=this._parameters,h=this._results;for(let g=0,l=f.length;g<l;++g){const m=f[g];m.VariesPerInstance()&&(h[g]=m.Get(d))}}_RunObject_FirstFilter(d){const f=this._objectClass,h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._behaviorIndex,
m=0<=l,u=f.GetInstances(),v=this._anyParamVariesPerInstance,t=this._results,q=this._func,p=this._isInverted,r=this._isInOrBlock&&!this._isTrigger;d.ClearArrays();for(let y=0,C=u.length;y<C;++y){const G=u[y];v&&this._EvaluateVaryingParameters(y);var x=void 0;m?(x=h?G.GetObjectClass().GetFamilyBehaviorOffset(g):0,x=q.apply(G.GetBehaviorInstances()[l+x].GetSdkInstance(),t)):x=q.apply(G.GetSdkInstance(),t);e.xor(x,p)?d._PushInstance(G):r&&d._PushElseInstance(G)}f.FinishCondition(!0);d._SetSelectAll(!1);
f.ApplySolToContainer();return d.HasAnyInstances()}_RunObject_NextFilter(d){const f=this._objectClass;var h=f.IsFamily();const g=f.GetFamilyIndex(),l=f.IsInContainer(),m=this._behaviorIndex,u=0<=m,v=this._anyParamVariesPerInstance,t=this._results,q=this._func,p=this._isInverted,r=this._isInOrBlock&&!this._isTrigger,x=d._GetOwnInstances(),y=d._GetOwnElseInstances(),C=r&&!this._eventBlock.IsFirstConditionOfType(this),G=C?y:x;let A=0,E=!1;for(let B=0,I=G.length;B<I;++B){const L=G[B];v&&this._EvaluateVaryingParameters(B);
var J=void 0;u?(J=h?L.GetObjectClass().GetFamilyBehaviorOffset(g):0,J=q.apply(L.GetBehaviorInstances()[m+J].GetSdkInstance(),t)):J=q.apply(L.GetSdkInstance(),t);e.xor(J,p)?(E=!0,C?(x.push(L),l&&L._PushSiblingsToSolInstances()):(G[A]=L,l&&L._SetSiblingsToSolInstancesIndex(A),++A)):C?(G[A]=L,l&&L._SetSiblingsToSolElseInstancesIndex(A),++A):r&&(y.push(L),l&&L._PushSiblingsToSolElseInstances())}e.truncateArray(G,A);l&&f._TruncateContainerSols(C,A);h=E;C&&!E&&(E=this._OrBlockCheckInstances(x));f.FinishCondition(h||
r);return r?E:d.HasAnyInstances()}_OrBlockCheckInstances(d){var f=this._objectClass;const h=f.IsFamily();f=f.GetFamilyIndex();const g=this._anyParamVariesPerInstance,l=this._behaviorIndex,m=0<=l,u=this._results,v=this._func,t=this._isInverted;for(let p=0,r=d.length;p<r;++p){var q=d[p];g&&this._EvaluateVaryingParameters(p);if(m){const x=h?q.GetObjectClass().GetFamilyBehaviorOffset(f):0;q=v.apply(q.GetBehaviorInstances()[l+x].GetSdkInstance(),u)}else q=v.apply(q.GetSdkInstance(),u);if(e.xor(q,t))return!0}return!1}ReevaluateParameter(d,
f){return this._parameters[d].Get(f)}GetFastTriggerValue(){const d=this._parameters;if(!d.length)throw Error("no parameters");return d[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const d={};for(const [f,h]of this._savedData.entries()){let g=h;"collmemory"===f&&(g=[...h.entries()].map(l=>[l[0].GetUID(),l[1].GetUID(),l[2]]));d[f]=g}return{ex:d}}_LoadFromJson(d){this._savedData&&(this._savedData.clear(),this._savedData=null);if(d){var f=this._runtime,
h=d.ex;if(h){d=this.GetSavedDataMap();d.clear();for(const [g,l]of Object.entries(h))h=l,"collmemory"===g&&(h=e.New(e.PairMap,l.map(m=>[f.GetInstanceByUID(m[0]),f.GetInstanceByUID(m[1]),m[2]]).filter(m=>m[0]&&m[1]))),d.set(g,h)}}}}}
{"use strict";const e=self.C3;function b(f,h){for(let g=0,l=f.length;g<l;++g)h[g]=f[g].Get(0)}const a=[],c=function(){},d=function*(){};e.Action=class extends e.DefendedBase{constructor(f,h,g){super();this._eventBlock=f;this._runtime=f=f.GetRuntime();this._index=g;this._sid=4<=h.length?h[3]:-1;this._actionReturnType=5<=h.length?h[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=c;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const l=(g=-3===h[0])?h[2]:h[5];this._debugData=f.IsDebug()||g?{isBreakpoint:l[0],canDebug:l[1],index:l[2]}:null;-1===h[0]?(this._systemPlugin=f.GetSystemPlugin(),this._func=f.GetObjectReference(h[1])):-2===h[0]?this._callFunctionName=h[1]:g?(this._func=f.GetObjectReference(h[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=
1):(this._func=f.GetObjectReference(h[1]),this._objectClass=f.GetObjectClassByIndex(h[0]),h[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(h[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(h[2])));if(7===h.length){h=h[6];for(const m of h)this._parameters.push(e.Parameter.Create(this,m,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(f,
h,g){return e.New(e.Action,f,h,g)}_PostInit(){for(var f of this._parameters)f._PostInit(),f.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){f=this._func;const h=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=f.bind(null,this._runtime.GetIRuntime(),
h)}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(h=>h.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(h=>h.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 f=this._objectClass.GetPlugin(),h=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(f,h,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const f=this._eventBlock.GetEventSheetManager(),h=f.GetFunctionBlockByName(this._callFunctionName);h.IsEnabled()?(this._callEventBlock=h.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],
this._combinedSolModifiers=f._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=e.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=c,this.DebugRun=d)}_SetRunMethodForBoundFunc(f,h,g){const l=this._func,m=this._parameters;if(0===m.length)this.Run=f._GetBoundACEMethod(l,h);else if(1===m.length){const u=m[0];if(u.IsConstant())this.Run=f._GetBoundACEMethod_1param(l,h,u.Get(0));
else{const v=f._GetBoundACEMethod(l,h);this.Run=function(){return v(u.Get(0))}}}else if(2===m.length){const u=m[0],v=m[1];if(u.IsConstant()&&v.IsConstant())this.Run=f._GetBoundACEMethod_2params(l,h,u.Get(0),v.Get(0));else{const t=f._GetBoundACEMethod(l,h);this.Run=function(){return t(u.Get(0),v.Get(0))}}}else if(3===m.length){const u=m[0],v=m[1],t=m[2];if(u.IsConstant()&&v.IsConstant()&&t.IsConstant())this.Run=f._GetBoundACEMethod_3params(l,h,u.Get(0),v.Get(0),t.Get(0));else{const q=f._GetBoundACEMethod(l,
h);this.Run=function(){return q(u.Get(0),v.Get(0),t.Get(0))}}}else this.Run=g}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(f){this._debugData.isBreakpoint=
!!f;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 f=this._results;b(this._parameters,f);return this._func.apply(this._systemPlugin,f)}*_DebugRunSystem(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);return yield*this._func.apply(this._systemPlugin,f)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const f=this._results;b(this._parameters,f);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),
f)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),f)}return this.Run()}_RunObject_ParamsConst(){const f=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)this._func.apply(h[g].GetSdkInstance(),f)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)yield*this._func.apply(h[g].GetSdkInstance(),f)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const f=this._results;b(this._parameters,f);const h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)this._func.apply(h[g].GetSdkInstance(),f)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);const h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)yield*this._func.apply(h[g].GetSdkInstance(),f)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=l.length;m<u;++m){const v=l[m];for(let t=0,q=f.length;t<q;++t)h[t]=
f[t].Get(m);g.apply(v.GetSdkInstance(),h)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=l.length;m<u;++m){const v=l[m];for(let t=0,q=f.length;t<q;++t)h[t]=f[t].Get(m);yield*g.apply(v.GetSdkInstance(),h)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const f=this._parameters,
h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,v=f.length;u<v;++u){var m=f[u];m.VariesPerInstance()||(h[u]=m.Get(0))}for(let u=0,v=l.length;u<v;++u){m=l[u];for(let t=0,q=f.length;t<q;++t){const p=f[t];p.VariesPerInstance()&&(h[t]=p.Get(u))}g.apply(m.GetSdkInstance(),h)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const h=this._parameters,g=this._results,l=this._func,
m=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,v=h.length;u<v;++u){var f=h[u];f.VariesPerInstance()||(g[u]=f.Get(0))}for(let u=0,v=m.length;u<v;++u){f=m[u];for(let t=0,q=h.length;t<q;++t){const p=h[t];p.VariesPerInstance()&&(g[t]=p.Get(u))}yield*l.apply(f.GetSdkInstance(),g)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._anyParamVariesPerInstance,u=this._results,v=this._func,t=this._behaviorIndex;
f=f.GetCurrentSol().GetInstances();for(let r=0,x=l.length;r<x;++r){var q=l[r];q.VariesPerInstance()||(u[r]=q.Get(0))}for(let r=0,x=f.length;r<x;++r){q=f[r];if(m)for(let y=0,C=l.length;y<C;++y){var p=l[y];p.VariesPerInstance()&&(u[y]=p.Get(r))}p=h?q.GetObjectClass().GetFamilyBehaviorOffset(g):0;v.apply(q.GetBehaviorInstances()[t+p].GetSdkInstance(),u)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const l=
f.IsFamily(),m=f.GetFamilyIndex(),u=this._parameters,v=this._anyParamVariesPerInstance,t=this._results,q=this._func,p=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();for(let r=0,x=u.length;r<x;++r){var h=u[r];h.VariesPerInstance()||(t[r]=h.Get(0))}for(let r=0,x=f.length;r<x;++r){h=f[r];if(v)for(let y=0,C=u.length;y<C;++y){var g=u[y];g.VariesPerInstance()&&(t[y]=g.Get(r))}g=l?h.GetObjectClass().GetFamilyBehaviorOffset(m):0;yield*q.apply(h.GetBehaviorInstances()[p+g].GetSdkInstance(),t)}}else this._RunBehavior()}_RunObject_Async(){const f=
this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,v=l.length;u<v;++u){const t=l[u];for(let q=0,p=f.length;q<p;++q)h[q]=f[q].Get(u);m.push(g.apply(t.GetSdkInstance(),h))}return Promise.all(m)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,
v=l.length;u<v;++u){const t=l[u];for(let q=0,p=f.length;q<p;++q)h[q]=f[q].Get(u);m.push(yield*g.apply(t.GetSdkInstance(),h))}return Promise.all(m)}return this._RunObject_Async()}_RunBehavior_Async(){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._results,u=this._func,v=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const t=[];for(let q=0,p=f.length;q<p;++q){const r=f[q];for(let y=0,C=l.length;y<C;++y)m[y]=l[y].Get(q);const x=h?r.GetObjectClass().GetFamilyBehaviorOffset(g):
0;t.push(u.apply(r.GetBehaviorInstances()[v+x].GetSdkInstance(),m))}return Promise.all(t)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._results,u=this._func,v=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const t=[];for(let q=0,p=f.length;q<p;++q){const r=f[q];for(let y=0,C=l.length;y<C;++y)m[y]=l[y].Get(q);const x=h?
r.GetObjectClass().GetFamilyBehaviorOffset(g):0;t.push(yield*u.apply(r.GetBehaviorInstances()[v+x].GetSdkInstance(),m))}return Promise.all(t)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(f){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;",f),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
e.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"),e.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{ex:e.ToSuperJSON(this._savedData)}:null}_LoadFromJson(f){this._savedData&&
(this._savedData.clear(),this._savedData=null);f&&(f=f.ex)&&(this._savedData=e.FromSuperJSON(f))}}}
{"use strict";const e=self.C3,b=new e.Color;function a(N,Q){return e.compare(this.GetWorldInfo().GetX(),N,Q)}function c(N,Q){return e.compare(this.GetWorldInfo().GetY(),N,Q)}function d(){const N=this.GetWorldInfo(),Q=N.GetLayer();return Q.Has3DCamera()?N.IsInViewport3D(Q._GetViewFrustum()):N.IsInViewport(Q.GetViewport(),N.GetLayout().HasVanishingPointOutsideViewport(),N.GetLayout().IsOrthographicProjection())}function f(){var N=this.GetWorldInfo();const Q=N.GetLayout();N=N.GetBoundingBox();return 0>
N.getRight()||0>N.getBottom()||N.getLeft()>Q.GetWidth()||N.getTop()>Q.GetHeight()}function h(N,Q,W){const aa=this.GetCurrentSol(),ea=aa.GetInstances();if(!ea.length)return!1;let ca=ea[0];var ia=ca.GetWorldInfo();let oa=ca,ja=e.distanceSquared(ia.GetX(),ia.GetY(),Q,W);for(let xa=1,La=ea.length;xa<La;++xa)if(ca=ea[xa],ia=ca.GetWorldInfo(),ia=e.distanceSquared(ia.GetX(),ia.GetY(),Q,W),0===N&&ia<ja||1===N&&ia>ja)ja=ia,oa=ca;aa.PickOne(oa);return!0}function g(N){const Q=this.GetWorldInfo();Q.GetX()!==
N&&(Q.SetX(N),Q.SetBboxChanged())}function l(N){const Q=this.GetWorldInfo();Q.GetY()!==N&&(Q.SetY(N),Q.SetBboxChanged())}function m(N,Q){const W=this.GetWorldInfo();W.EqualsXY(N,Q)||(W.SetXY(N,Q),W.SetBboxChanged())}function u(N,Q){if(N&&(N=N.GetPairedInstance(this._inst))){var [W,aa]=N.GetImagePoint(Q);Q=this.GetWorldInfo();if(Q.GetX()!==W||Q.GetY()!==aa)Q.SetXY(W,aa),Q.SetBboxChanged()}}function v(N){if(0!==N){var Q=this.GetWorldInfo();Q.OffsetXY(Q.GetCosAngle()*N,Q.GetSinAngle()*N);Q.SetBboxChanged()}}
function t(N,Q){if(0!==Q){var W=this.GetWorldInfo();N=e.toRadians(N);W.OffsetXY(Math.cos(N)*Q,Math.sin(N)*Q);W.SetBboxChanged()}}function q(){return this.GetWorldInfo().GetX()}function p(){return this.GetWorldInfo().GetY()}function r(){return this._runtime.GetDt(this._inst)}function x(N,Q){return e.compare(this.GetWorldInfo().GetWidth(),N,Q)}function y(N,Q){return e.compare(this.GetWorldInfo().GetHeight(),N,Q)}function C(N){const Q=this.GetWorldInfo();Q.GetWidth()!==N&&(Q.SetWidth(N),Q.SetBboxChanged())}
function G(N){const Q=this.GetWorldInfo();Q.GetHeight()!==N&&(Q.SetHeight(N),Q.SetBboxChanged())}function A(N,Q){const W=this.GetWorldInfo();if(W.GetWidth()!==N||W.GetHeight()!==Q)W.SetSize(N,Q),W.SetBboxChanged()}function E(){return this.GetWorldInfo().GetWidth()}function J(){return this.GetWorldInfo().GetHeight()}function B(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function I(){return this.GetWorldInfo().GetBoundingBox().getTop()}function L(){return this.GetWorldInfo().GetBoundingBox().getRight()}
function P(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function S(N,Q){return e.angleDiff(this.GetWorldInfo().GetAngle(),e.toRadians(Q))<=e.toRadians(N)}function U(N){return e.angleClockwise(this.GetWorldInfo().GetAngle(),e.toRadians(N))}function V(N,Q){N=e.toRadians(N);Q=e.toRadians(Q);const W=this.GetWorldInfo().GetAngle();return e.angleClockwise(Q,N)?e.angleClockwise(W,N)&&!e.angleClockwise(W,Q):!(!e.angleClockwise(W,N)&&e.angleClockwise(W,Q))}function Z(N){const Q=this.GetWorldInfo();
N=e.clampAngle(e.toRadians(N));isNaN(N)||Q.GetAngle()===N||(Q.SetAngle(N),Q.SetBboxChanged())}function la(N){if(!isNaN(N)&&0!==N){var Q=this.GetWorldInfo();Q.SetAngle(Q.GetAngle()+e.toRadians(N));Q.SetBboxChanged()}}function va(N){if(!isNaN(N)&&0!==N){var Q=this.GetWorldInfo();Q.SetAngle(Q.GetAngle()-e.toRadians(N));Q.SetBboxChanged()}}function Na(N,Q){const W=this.GetWorldInfo(),aa=W.GetAngle();N=e.angleRotate(aa,e.toRadians(Q),e.toRadians(N));isNaN(N)||aa===N||(W.SetAngle(N),W.SetBboxChanged())}
function za(N,Q,W){const aa=this.GetWorldInfo(),ea=aa.GetAngle();Q-=aa.GetX();W-=aa.GetY();N=e.angleRotate(ea,Math.atan2(W,Q),e.toRadians(N));isNaN(N)||ea===N||(aa.SetAngle(N),aa.SetBboxChanged())}function Ha(N,Q){const W=this.GetWorldInfo(),aa=W.GetAngle();N-=W.GetX();Q-=W.GetY();Q=Math.atan2(Q,N);isNaN(Q)||aa===Q||(W.SetAngle(Q),W.SetBboxChanged())}function Ja(){return e.toDegrees(this.GetWorldInfo().GetAngle())}function Aa(N,Q){return e.compare(e.round6dp(100*this.GetWorldInfo().GetOpacity()),
N,Q)}function ya(){return this.GetWorldInfo().IsVisible()}function na(N){const Q=this.GetWorldInfo();N=2===N?!Q.IsVisible():0!==N;Q.IsVisible()!==N&&(Q.SetVisible(N),this._runtime.UpdateRender())}function Ta(N){N=e.clamp(N/100,0,1);const Q=this.GetWorldInfo();Q.GetOpacity()!==N&&(Q.SetOpacity(N),this._runtime.UpdateRender())}function wa(N){b.setFromRgbValue(N);N=this.GetWorldInfo();N.GetUnpremultipliedColor().equalsIgnoringAlpha(b)||(N.SetUnpremultipliedColor(b),this._runtime.UpdateRender())}function Ba(){const N=
this.GetWorldInfo().GetUnpremultipliedColor();return e.PackRGBAEx(N.getR(),N.getG(),N.getB(),N.getA())}function Ya(){return e.round6dp(100*this.GetWorldInfo().GetOpacity())}function Xa(N){return N?this.GetWorldInfo().GetLayer()===N:!1}function gb(N){const Q=this.GetCurrentSol(),W=Q.GetInstances();if(!W.length)return!1;let aa=W[0];for(let ea=1,ca=W.length;ea<ca;++ea){const ia=W[ea],oa=ia.GetWorldInfo(),ja=aa.GetWorldInfo(),xa=oa.GetLayer().GetIndex(),La=ja.GetLayer().GetIndex();if(0===N){if(xa>La||
xa===La&&oa.GetZIndex()>ja.GetZIndex())aa=ia}else if(xa<La||xa===La&&oa.GetZIndex()<ja.GetZIndex())aa=ia}Q.PickOne(aa);return!0}function hb(N,Q,W){const aa=this.GetWorldInfo();N=0===N?aa.GetZElevation():aa.GetTotalZElevation();return e.compare(N,Q,W)}function Za(){this.GetWorldInfo().ZOrderMoveToTop()}function ib(){this.GetWorldInfo().ZOrderMoveToBottom()}function jb(N){N&&this.GetWorldInfo().ZOrderMoveToLayer(N)}function kb(N,Q){N=0===N;Q&&(Q=Q.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(Q,
N)}function lb(N){const Q=this.GetWorldInfo();Q.GetZElevation()!==N&&(Q.SetZElevation(N),this._runtime.UpdateRender())}function mb(){return this.GetWorldInfo().GetLayer().GetIndex()}function nb(){return this.GetWorldInfo().GetLayer().GetName()}function ob(){return this.GetWorldInfo().GetZIndex()}function $a(){return this.GetWorldInfo().GetZElevation()}function pb(){return this.GetWorldInfo().GetTotalZElevation()}function qb(N,Q){if(Q=this.GetObjectClass().GetEffectList().GetEffectTypeByName(Q)){Q=
Q.GetIndex();N=1===N;var W=this.GetWorldInfo().GetInstanceEffectList();W.IsEffectIndexActive(Q)!==N&&(W.SetEffectIndexActive(Q,N),W.UpdateActiveEffects(),this._runtime.UpdateRender())}}function rb(N,Q,W){var aa=this.GetObjectClass().GetEffectList().GetEffectTypeByName(N);if(aa){N=aa.GetIndex();var ea=this.GetWorldInfo().GetInstanceEffectList(),ca=ea.GetEffectParametersForIndex(N);Q=Math.floor(Q);if(!(0>Q||Q>=ca.length)){aa=aa.GetShaderProgram().GetParameterType(Q);if("color"===aa){b.setFromRgbValue(W);
Q=ca[Q];if(b.equalsIgnoringAlpha(Q))return;Q.copyRgb(b)}else{"percent"===aa&&(W/=100);if(ca[Q]===W)return;ca[Q]=W}ea.IsEffectIndexActive(N)&&this._runtime.UpdateRender()}}}const ab=e.New(e.Rect),Ua=[],bb=[];let sb=!1,cb=null,tb=!1;const Va=new Set;function ub(N,Q,W,aa){const ea=Q.GetUID(),ca=W.GetUID();ea<ca?N.Set(Q,W,aa):N.Set(W,Q,aa)}function vb(N,Q,W){const aa=Q.GetUID(),ea=W.GetUID();aa<ea?N.Delete(Q,W):N.Delete(W,Q)}function sa(N,Q){N.DeleteEither(Q)}function Sa(N,Q,W){const aa=Q.GetUID(),ea=
W.GetUID();return aa<ea?N.Get(Q,W):N.Get(W,Q)}function Ab(N,Q,W,aa){if(!Q)return!1;N=N.GetInstance();const ea=0!==W||0!==aa,ca=N.GetWorldInfo(),ia=N.GetRuntime(),oa=ia.GetCollisionEngine();var ja=ia.GetCurrentCondition();const xa=ja.GetEventBlock().IsOrBlock();var La=ja.GetObjectClass();ja=ja.IsInverted();const Oa=Q.GetCurrentSol();La=La!==Q;cb=Q;sb=La&&!ja;tb=!1;let db=0,Ma=0,ma=!1;Oa.IsSelectAll()?(ab.copy(ca.GetBoundingBox()),ab.offset(W,aa),oa.GetCollisionCandidates(ca.GetLayer(),Q,ab,bb),Q=bb):
xa?ia.IsCurrentConditionFirst()&&!Oa._GetOwnElseInstances().length&&Oa._GetOwnInstances().length?Q=Oa._GetOwnInstances():(Q=Oa._GetOwnElseInstances(),tb=!0):Q=Oa._GetOwnInstances();ea&&(db=ca.GetX(),Ma=ca.GetY(),ca.OffsetXY(W,aa),ca.SetBboxChanged());for(const da of Q)if(oa.TestOverlap(N,da)){ma=!0;if(ja)break;La&&Va.add(da)}ea&&(ca.SetXY(db,Ma),ca.SetBboxChanged());e.clearArray(bb);return ma}function Db(N){N=N.GetRuntime().GetCurrentEvent().IsOrBlock();const Q=cb.GetCurrentSol(),W=Q._GetOwnInstances(),
aa=Q._GetOwnElseInstances();Q.IsSelectAll()?(Q.SetSetPicked(Va),N&&(e.clearArray(aa),Q.AddElseInstances(Va,cb.GetInstances()))):N?tb?Q.TransferElseInstancesToOwn(Va):(Q.AddElseInstances(Va,W),Q.SetSetPicked(Va)):Q.SetSetPicked(Va);cb.ApplySolToContainer()}function Eb(N,Q){sb&&(Q&&Db(N),Va.clear(),cb=null,sb=!1)}function Fb(N){if(this._runtime.IsDebugging())return Gb.call(this,N);if(!N)return!1;var Q=this._runtime;const W=Q.GetCollisionEngine(),aa=Q.GetEventSheetManager(),ea=aa.GetEventStack();var ca=
aa.GetCurrentCondition();const ia=ca.GetObjectClass();var oa=ca.GetSavedDataMap(),ja=ca.GetUnsavedDataMap();ca=ea.GetCurrentStackFrame();const xa=Q.GetTickCount(),La=xa-1,Oa=ca.GetCurrentEvent(),db=ea.Push(Oa);let Ma=oa.get("collmemory");Ma||(Ma=e.New(e.PairMap),oa.set("collmemory",Ma));ja.get("collisionCreatedDestroyCallback")||(ja.set("collisionCreatedDestroyCallback",!0),Q.Dispatcher().addEventListener("instancedestroy",Wa=>sa(Ma,Wa.instance)));oa=ia.GetCurrentSol();Q=N.GetCurrentSol();oa=oa.GetInstances();
ja=null;for(let Wa=0;Wa<oa.length;++Wa){const Ia=oa[Wa];Q.IsSelectAll()?(W.GetCollisionCandidates(Ia.GetWorldInfo().GetLayer(),N,Ia.GetWorldInfo().GetBoundingBox(),Ua),ja=Ua,W.AddRegisteredCollisionCandidates(Ia,N,ja)):ja=Q.GetInstances();for(let fb=0;fb<ja.length;++fb){const Ra=ja[fb];if(W.TestOverlap(Ia,Ra)||W.CheckRegisteredCollision(Ia,Ra)){var ma=Sa(Ma,Ia,Ra),da=!1,pa=-2;"number"===typeof ma&&(da=!0,pa=ma);ma=!da||pa<La;ub(Ma,Ia,Ra,xa);ma&&(ma=Oa.GetSolModifiers(),aa.PushCopySol(ma),pa=ia.GetCurrentSol(),
da=N.GetCurrentSol(),pa._SetSelectAll(!1),da._SetSelectAll(!1),ia===N?(da=pa._GetOwnInstances(),e.clearArray(da),da.push(Ia),da.push(Ra),ia.ApplySolToContainer()):(pa=pa._GetOwnInstances(),da=da._GetOwnInstances(),e.clearArray(pa),e.clearArray(da),pa.push(Ia),da.push(Ra),ia.ApplySolToContainer(),N.ApplySolToContainer()),Oa.Retrigger(ca,db),aa.PopSol(ma))}else vb(Ma,Ia,Ra)}e.clearArray(Ua)}ea.Pop();return!1}function*Gb(N){if(!N)return!1;var Q=this._runtime;const W=Q.GetCollisionEngine(),aa=Q.GetEventSheetManager(),
ea=aa.GetEventStack();var ca=aa.GetCurrentCondition();const ia=ca.GetObjectClass();var oa=ca.GetSavedDataMap(),ja=ca.GetUnsavedDataMap();ca=ea.GetCurrentStackFrame();const xa=Q.GetTickCount(),La=xa-1,Oa=ca.GetCurrentEvent(),db=ea.Push(Oa);let Ma=oa.get("collmemory");Ma||(Ma=e.New(e.PairMap),oa.set("collmemory",Ma));ja.get("collisionCreatedDestroyCallback")||(ja.set("collisionCreatedDestroyCallback",!0),Q.Dispatcher().addEventListener("instancedestroy",Wa=>sa(Ma,Wa.instance)));oa=ia.GetCurrentSol();
Q=N.GetCurrentSol();oa=oa.GetInstances();ja=null;for(let Wa=0;Wa<oa.length;++Wa){const Ia=oa[Wa];Q.IsSelectAll()?(W.GetCollisionCandidates(Ia.GetWorldInfo().GetLayer(),N,Ia.GetWorldInfo().GetBoundingBox(),Ua),ja=Ua,W.AddRegisteredCollisionCandidates(Ia,N,ja)):ja=Q.GetInstances();for(let fb=0;fb<ja.length;++fb){const Ra=ja[fb];if(W.TestOverlap(Ia,Ra)||W.CheckRegisteredCollision(Ia,Ra)){var ma=Sa(Ma,Ia,Ra),da=!1,pa=-2;"number"===typeof ma&&(da=!0,pa=ma);ma=!da||pa<La;ub(Ma,Ia,Ra,xa);ma&&(ma=Oa.GetSolModifiers(),
aa.PushCopySol(ma),pa=ia.GetCurrentSol(),da=N.GetCurrentSol(),pa._SetSelectAll(!1),da._SetSelectAll(!1),ia===N?(da=pa._GetOwnInstances(),e.clearArray(da),da.push(Ia),da.push(Ra),ia.ApplySolToContainer()):(pa=pa._GetOwnInstances(),da=da._GetOwnInstances(),e.clearArray(pa),e.clearArray(da),pa.push(Ia),da.push(Ra),ia.ApplySolToContainer(),N.ApplySolToContainer()),yield*Oa.DebugRetrigger(ca,db),aa.PopSol(ma))}else vb(Ma,Ia,Ra)}e.clearArray(Ua)}ea.Pop();return!1}function Hb(N){return Ab(this,N,0,0)}function wb(N,
Q,W){return Ab(this,N,Q,W)}function xb(){return this.GetWorldInfo().HasParent()}function yb(){return this.GetWorldInfo().HasChildren()}function zb(N,Q){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(0===ea.length)return!1;ea=new Set(ea);const ca=new Set;for(let oa=0,ja=W.length;oa<ja;++oa){var ia=W[oa];if(1===Q)for(const xa of ia.parents())xa.BelongsToObjectClass(N)&&ea.has(xa)&&ca.add(xa);else{if(0===Q){if(ia=ia.GetParent(),
null===ia)continue}else ia=ia.GetTopParent();ia.BelongsToObjectClass(N)&&ea.has(ia)&&ca.add(ia)}}if(0===ca.size)return!1;aa.SetSetPicked(ca);N.ApplySolToContainer();return!0}function eb(N,Q){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(aa.IsSelectAll()){var ca=[...this._runtime.instancesPendingCreateForObjectClass(N)];0<ca.length&&(ea=ea.concat(ca))}if(0===ea.length)return!1;ea=new Set(ea);ca=new Set;for(let ia=0,oa=W.length;ia<
oa;++ia){const ja=W[ia];2===Q&&!ja.HasChildren()&&ja.BelongsToObjectClass(N)&&ea.has(ja)&&ca.add(ja);for(const xa of 0===Q?ja.children():ja.allChildren())2===Q&&xa.HasChildren()||xa.BelongsToObjectClass(N)&&ea.has(xa)&&ca.add(xa)}if(0===ca.size)return!1;aa.SetSetPicked(ca);N.ApplySolToContainer();return!0}function k(N,Q){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(aa.IsSelectAll()){var ca=[...this._runtime.instancesPendingCreateForObjectClass(N)];
0<ca.length&&(ea=ea.concat(ca))}if(0===ea.length)return!1;ea=new Set(ea);ca=[];for(let ia=0,oa=W.length;ia<oa;++ia){const ja=W[ia].GetChildAt(Q);null!==ja&&ja.BelongsToObjectClass(N)&&ea.has(ja)&&ca.push(ja)}if(0===ca.length)return!1;aa.SetArrayPicked(ca);N.ApplySolToContainer();return!0}function n(N,Q){return e.compare(this._inst.GetChildCount(),N,Q)}function w(N,Q,W,aa,ea,ca,ia,oa){const ja=this._inst,xa=this._runtime.GetCurrentAction().GetObjectClass();for(const La of N.allCorrespondingInstances(ja,
xa)){if(!La.GetPlugin().SupportsSceneGraph())break;ja.AddChild(La,{transformX:Q,transformY:W,transformWidth:aa,transformHeight:ea,transformAngle:ca,transformZElevation:ia,destroyWithParent:oa})}}function z(N){const Q=this._inst,W=this._runtime.GetCurrentAction().GetObjectClass();for(const aa of N.allCorrespondingInstances(Q,W))Q.RemoveChild(aa)}function D(){this._inst.HasParent()&&this._inst.GetParent().RemoveChild(this._inst)}function F(){return this._inst.GetChildCount()}function H(N,Q){N=Math.floor(N);
Q=Math.floor(Q);const W=this.GetWorldInfo();2>N||2>Q||!isFinite(N)||!isFinite(Q)?(W.ReleaseMesh(),W.SetBboxChanged()):W.CreateMesh(N,Q)}function K(N,Q,W,aa,ea,ca,ia,oa){const ja=this.GetWorldInfo();ja.SetMeshPoint(N,Q,{mode:0===W?"absolute":"relative",x:aa,y:ea,zElevation:ca,u:ia,v:oa})&&ja.SetBboxChanged()}function M(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetHSize():0}function O(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetVSize():0}function R(N){const Q=
this.GetWorldInfo();N=2===N?!Q.IsVisible():0!==N;Q.IsVisible()!==N&&Q.SetVisible(N)}function T(N,Q){this.SetElementCSSStyle(N,Q)}function Y(N,Q){this.SetElementAttribute(N,""+Q)}function X(N){this.RemoveElementAttribute(N)}function fa(){this.FocusElement()}function ha(){this.BlurElement()}function ba(){return this.IsElementFocused()}function qa(N){this._SetEnabled(0!==N)}function ka(){return this._IsEnabled()}function ta(N,Q,W){return e.compare(this.GetInstance().GetInstanceVariableValue(N),Q,W)}
function ua(N){return!!this.GetInstance().GetInstanceVariableValue(N)}function ra(N,Q){const W=this.GetCurrentSol(),aa=W.GetInstances();if(!aa.length)return!1;let ea=aa[0],ca=ea,ia=ea.GetInstanceVariableValue(Q);for(let oa=1,ja=aa.length;oa<ja;++oa){ea=aa[oa];const xa=ea.GetInstanceVariableValue(Q);if(0===N&&xa<ia||1===N&&xa>ia)ia=xa,ca=ea}W.PickOne(ca);return!0}function Ca(N){return this._runtime.GetCurrentCondition().IsInverted()?Ea(this,N):Da(this,N)}function Da(N,Q){Q=N.GetRuntime().GetInstanceByUID(Q);
if(!Q)return!1;const W=N.GetCurrentSol();if(!W.IsSelectAll()&&!W._GetOwnInstances().includes(Q))return!1;if(N.IsFamily()){if(Q.GetObjectClass().BelongsToFamily(N))return W.PickOne(Q),N.ApplySolToContainer(),!0}else if(Q.GetObjectClass()===N)return W.PickOne(Q),N.ApplySolToContainer(),!0;return!1}function Ea(N,Q){const W=N.GetCurrentSol();if(W.IsSelectAll()){W._SetSelectAll(!1);W.ClearArrays();var aa=N.GetInstances();for(let ca=0,ia=aa.length;ca<ia;++ca){var ea=aa[ca];ea.GetUID()===Q?W._PushElseInstance(ea):
W._PushInstance(ea)}N.ApplySolToContainer();return!!W._GetOwnInstances().length}aa=W._GetOwnInstances();ea=0;for(let ca=0,ia=aa.length;ca<ia;++ca){const oa=aa[ca];aa[ea]=oa;oa.GetUID()===Q?W._PushElseInstance(oa):++ea}e.truncateArray(aa,ea);N.ApplySolToContainer();return!!aa.length}function Fa(){this._runtime.DestroyInstance(this._inst)}function Ka(){return!0}function Pa(){return!0}function Qa(N,Q){this.GetInstance().SetInstanceVariableValue(N,Q)}function Ga(N,Q){const W=this.GetInstance(),aa=W.GetInstanceVariableValue(N);
"number"===typeof aa&&"number"!==typeof Q?Q=parseFloat(Q):"string"===typeof aa&&"string"!==typeof Q&&(Q=Q.toString());W.SetInstanceVariableValue(N,aa+Q)}function Bb(N,Q){const W=this.GetInstance(),aa=W.GetInstanceVariableValue(N);"number"===typeof aa&&("number"!==typeof Q&&(Q=parseFloat(Q)),W.SetInstanceVariableValue(N,aa-Q))}function Cb(N,Q){this.GetInstance().SetInstanceVariableValue(N,Q?1:0)}function Ib(N){const Q=this.GetInstance();Q.SetInstanceVariableValue(N,0===Q.GetInstanceVariableValue(N)?
1:0)}function Jb(N){let Q;try{Q=JSON.parse(N)}catch(W){console.error("Failed to load from JSON string: ",W);return}N=this.GetInstance();N._OnBeforeLoad("state");N.LoadFromJson(Q,"state")}function Kb(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function Lb(){return this.GetInstance().GetObjectClass().GetName()}function Mb(){const N=this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let Q=N.GetInstanceCount();for(const W of this._runtime.instancesPendingCreateForObjectClass(N))++Q;
return Q}function Nb(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}function Ob(){return this._inst.GetIID()}function Pb(){return this._inst.GetUID()}e.AddCommonACEs=function(N,Q){const W=N[1],aa=N[4],ea=N[5],ca=N[6],ia=N[7],oa=N[8],ja=N[10],xa=N[11],La=N[12],Oa=N[13],db=N[14],Ma=N[15],ma=Q.Cnds,da=Q.Acts,pa=Q.Exps;N[3]&&(ma.CompareX=a,ma.CompareY=c,ma.IsOnScreen=d,ma.IsOutsideLayout=f,ma.PickDistance=h,da.SetX=g,da.SetY=l,da.SetPos=
m,da.SetPosToObject=u,da.MoveForward=v,da.MoveAtAngle=t,pa.X=q,pa.Y=p,pa.dt=r);aa&&(ma.CompareWidth=x,ma.CompareHeight=y,da.SetWidth=C,da.SetHeight=G,da.SetSize=A,pa.Width=E,pa.Height=J,pa.BBoxLeft=B,pa.BBoxTop=I,pa.BBoxRight=L,pa.BBoxBottom=P);ea&&(ma.AngleWithin=S,ma.IsClockwiseFrom=U,ma.IsBetweenAngles=V,da.SetAngle=Z,da.RotateClockwise=la,da.RotateCounterclockwise=va,da.RotateTowardAngle=Na,da.RotateTowardPosition=za,da.SetTowardPosition=Ha,pa.Angle=Ja);ca&&(ma.IsVisible=ya,ma.CompareOpacity=
Aa,da.SetVisible=na,da.SetOpacity=Ta,da.SetDefaultColor=wa,pa.Opacity=Ya,pa.ColorValue=Ba);ia&&(ma.IsOnLayer=Xa,ma.PickTopBottom=gb,ma.CompareZElevation=hb,da.MoveToTop=Za,da.MoveToBottom=ib,da.MoveToLayer=jb,da.ZMoveToObject=kb,da.SetZElevation=lb,pa.LayerNumber=mb,pa.LayerName=nb,pa.ZIndex=ob,pa.ZElevation=$a,pa.TotalZElevation=pb);oa&&(da.SetEffectEnabled=qb,da.SetEffectParam=rb);Oa&&(ma.HasParent=xb,ma.HasChildren=yb,ma.PickParent=zb,ma.PickChildren=eb,ma.PickNthChild=k,ma.CompareChildCount=n,
da.AddChild=w,da.RemoveChild=z,da.RemoveFromParent=D,pa.ChildCount=F);db&&(da.SetMeshSize=H,da.SetMeshPoint=K,pa.MeshColumns=M,pa.MeshRows=O);ja&&(ma.IsVisible=ya,da.SetVisible=R,da.SetCSSStyle=T,da.SetElemAttribute=Y,da.RemoveElemAttribute=X);xa&&(ma.IsFocused=ba,da.SetFocus=fa,da.SetBlur=ha);La&&(ma.IsEnabled=ka,da.SetEnabled=qa);Ma&&(ma.OnCollision=Fb,ma.IsOverlapping=Hb,ma.IsOverlappingOffset=wb,Q.FinishCollisionCondition=Eb);W||(ma.CompareInstanceVar=ta,ma.IsBoolInstanceVarSet=ua,ma.PickInstVarHiLow=
ra,ma.PickByUID=Ca,da.SetInstanceVar=Qa,da.AddInstanceVar=Ga,da.SubInstanceVar=Bb,da.SetBoolInstanceVar=Cb,da.ToggleBoolInstanceVar=Ib,ma.OnCreated=Ka,ma.OnDestroyed=Pa,da.Destroy=Fa,da.LoadFromJsonString||(da.LoadFromJsonString=Jb),pa.AsJSON||(pa.AsJSON=Kb),pa.Count=Mb,pa.PickedCount=Nb,pa.IID=Ob,pa.UID=Pb,pa.ObjectTypeName=Lb)}}
{"use strict";const e=self.C3;e.ScheduledWait=class extends e.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._functionInnerLocalVars=this._functionParameters=null;this._shouldRelease=!1}Release(){this._type="";this._time=-1;this._signalTag="";this._functionInnerLocalVars=this._functionParameters=
this._callingFunctionBlock=this._event=null;this._asyncId=-1;e.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 c=b.GetCurrentEventStackFrame();this._event=c.GetCurrentEvent();this._actIndex=c.GetActionIndex()+1;if(b=b.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=b,this._functionParameters=b.CaptureFunctionParameters(),this._functionInnerLocalVars=
b._GetAllInnerLocalVariables().map(d=>d.GetValue()),b.IsAsync()&&(this._asyncId=b.PauseCurrentAsyncFunction());for(const d of a)if(a=d.GetCurrentSol(),!a.IsSelectAll()||this._event.HasSolModifier(d))this._solModifiers.push(d),this._sols.set(d,e.New(e.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,c]of this._sols.entries())b=a.GetCurrentSol(),c._Restore(b);if(b=this._callingFunctionBlock)b.SetFunctionParameters(this._functionParameters),b._GetAllInnerLocalVariables().map((a,c)=>a.SetValue(this._functionInnerLocalVars[c])),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(c=>c.GetSID()),sols:b};this._event._HasActionIndex(this._actIndex)&&(a.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [c,d]of this._sols)b[c.GetSID().toString()]=d._SaveToJson();return a}static _CreateFromJson(b,a){const c=b.GetRuntime();var d=b.GetEventBlockBySID(a.ev);if(!d)return null;let f=0;if(a.hasOwnProperty("act")){var h=b.GetActionBySID(a.act);if(!h)return null;f=h.GetIndex()}h=
e.New(e.ScheduledWait,b);h._time=a.t;h._type=-1===h._time?"signal":"timer";h._signalTag=a.st;h._isSignalled=a.s;h._event=d;h._actIndex=f;for(var g of a.sm)(d=c.GetObjectClassBySID(g))&&h._solModifiers.push(d);for(const [l,m]of Object.entries(a.sols))if(a=parseInt(l,10),a=c.GetObjectClassBySID(a))g=e.New(e.SolState,null),g._LoadFromJson(b,m),h._sols.set(a,g);return h}}}
{"use strict";const e=self.C3;e.SolState=class extends e.DefendedBase{constructor(b){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];b&&(this._objectClass=b.GetObjectClass(),this._isSelectAll=b.IsSelectAll(),e.shallowAssignArray(this._instances,b._GetOwnInstances()))}Release(){this._objectClass=null;e.clearArray(this._instances)}_Restore(b){b._SetSelectAll(this._isSelectAll);e.shallowAssignArray(b._GetOwnInstances(),this._instances)}RemoveInstances(b){e.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;e.clearArray(this._instances);for(const c of a.insts)(a=b.GetInstanceByUID(c))&&this._instances.push(a)}}}
{"use strict";const e=self.C3;function b(a,c){let d=a.get(c);d||(d=new Map,a.set(c,d));return d}e.SDKPluginBase=class extends e.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,
c){if(!c)throw Error("missing 'this' binding");let d=this._boundACEMethodCache.get(a);if(d)return d;d=a.bind(c);this._boundACEMethodCache.set(a,d);return d}_GetBoundACEMethod_1param(a,c,d){if(!c)throw Error("missing 'this' binding");const f=b(this._boundACEMethodCache_1param,a);let h=f.get(d);if(h)return h;h=a.bind(c,d);f.set(d,h);return h}_GetBoundACEMethod_2params(a,c,d,f){if(!c)throw Error("missing 'this' binding");var h=b(this._boundACEMethodCache_2params,a);h=b(h,d);let g=h.get(f);if(g)return g;
g=a.bind(c,d,f);h.set(f,g);return g}_GetBoundACEMethod_3params(a,c,d,f,h){if(!c)throw Error("missing 'this' binding");var g=b(this._boundACEMethodCache_3params,a);g=b(g,d);g=b(g,f);let l=g.get(h);if(l)return l;l=a.bind(c,d,f,h);g.set(h,l);return l}_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 e=self.C3;e.SDKDOMPluginBase=class extends e.SDKPluginBase{constructor(b,a){super(b);this._domComponentId=a;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",c=>c._OnElemFocused());this.AddElementMessageHandler("elem-blurred",c=>{c&&c._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,c=>{const d=this._instMap.get(c.elementId);a(d,c)})}}}{"use strict";const e=self.C3;e.SDKTypeBase=class extends e.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 e=self.C3;e.SDKInstanceBase=class extends e.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,c]of b)this.AddDOMMessageHandler(a,c)}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})}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){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,
a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var c=this.GetPropertyValueByIndex(b);if("number"!==typeof c)throw Error("expected number");this.SetPropertyValueByIndex(b,c+a)}}SetPropertyColorOffsetValueByIndex(b,a,c,d){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(b,a,c){const d=this.GetScriptInterface();b=e.New(e.Event,b,a);b.instance=d;c&&Object.assign(b,c);d.dispatchEvent(b)}}}
{"use strict";const e=self.C3;e.SDKWorldInstanceBase=class extends e.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}IsOriginalSizeKnown(){return!1}GetOriginalWidth(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");
const b=this.GetCurrentImageInfo();if(b)return b.GetWidth()}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");const b=this.GetCurrentImageInfo();if(b)return b.GetHeight()}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}GetCurrentTexQuad(){const b=this.GetCurrentImageInfo();
return b?b.GetTexQuad():null}IsCurrentTexRotated(){const b=this.GetCurrentImageInfo();return b?b.IsRotated():!1}GetImagePoint(b){b=this._inst.GetWorldInfo();return[b.GetX(),b.GetY()]}LoadTilemapData(b,a,c){}TestPointOverlapTile(b,a){}RendersToOwnZPlane(){return!0}}}
{"use strict";const e=self.C3,b=e.New(e.Rect);e.SDKDOMInstanceBase=class extends e.SDKWorldInstanceBase{constructor(a,c){super(a,c);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=this._elemHasFocus=!1;this._lastRect=e.New(e.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,c){c||(c={});c.elementId=this._elementId;this.PostToDOM(a,c)}_PostToDOMElementMaybeSync(a,c){c||(c={});c.elementId=this._elementId;return this._PostToDOMMaybeSync(a,c)}PostToDOMElementAsync(a,c){c||(c={});c.elementId=this._elementId;return this.PostToDOMAsync(a,c)}CreateElement(a){a||
(a={});const c=this.GetWorldInfo().IsVisible();a.elementId=this._elementId;a.isVisible=c;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"===e.Platform.OS&&
("scale-inner"===a||"scale-outer"===a||"crop"===a)}_UpdatePosition(a){var c=this.GetWorldInfo();const d=c.GetLayer();var f=c.GetX(),h=c.GetY();let [g,l]=d.LayerToCanvasCss(f,h),[m,u]=d.LayerToCanvasCss(f+c.GetWidth(),h+c.GetHeight());f=this._runtime.GetCanvasManager();h=f.GetCssWidth();const v=f.GetCssHeight();if(c.IsVisible()&&d.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=m||0>=u||g>=h||l>=v){this.SetElementVisible(!1);return}1>g&&(g=1);1>l&&(l=1);m>=h&&(m=h-1);u>=v&&(u=v-1)}b.set(g,l,
m,u);c=f.GetLastWidth();h=f.GetLastHeight();!a&&b.equals(this._lastRect)&&this._lastWindowWidth===c&&this._lastWindowHeight===h?this.SetElementVisible(!0):(this._lastRect.copy(b),this._lastWindowWidth=c,this._lastWindowHeight=h,this.SetElementVisible(!0),a=null,this._autoFontSize&&(a=d.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+f.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+f.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,c){this.PostToDOMElement("set-css-style",{prop:e.CSSToCamelCase(a),val:c})}SetElementAttribute(a,c){this.PostToDOMElement("set-attribute",
{name:a,val:c})}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 e=self.C3,b=self.IBehavior;e.SDKBehaviorBase=class extends e.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._myObjectClasses=e.New(e.ArraySet);this._myInstances=e.New(e.ArraySet);this._iBehavior=null;this._scriptInterfaceClass=a.scriptInterfaceClass||null}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(){if(null===
this._iBehavior){const a=this._scriptInterfaceClass;if(a){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)}return this._iBehavior}}}
{"use strict";const e=self.C3;e.SDKBehaviorTypeBase=class extends e.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 e=self.C3;e.SDKBehaviorInstanceBase=class extends e.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 c=this.GetPropertyValueByIndex(b);if("number"!==typeof c)throw Error("expected number");this.SetPropertyValueByIndex(b,c+a)}}SetPropertyColorOffsetValueByIndex(b,a,c,d){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(b,a,c){const d=
this.GetScriptInterface();b=e.New(e.Event,b,a);b.behaviorInstance=d;b.instance=d.instance;c&&Object.assign(b,c);d.dispatchEvent(b)}}}
{"use strict";const e=self.C3;e.Plugins={};e.Behaviors={};e.PluginManager=class extends e.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");e.AddCommonACEs(b,a);b=e.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=e.New(e.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=e.New(b,{runtime:this._runtime});a.OnCreate();this._allBehaviors.push(a);this._behaviorsByCtor.set(b,a);!this._solidBehavior&&
e.Behaviors.solid&&a instanceof e.Behaviors.solid?this._solidBehavior=a:!this._jumpthruBehavior&&e.Behaviors.jumpthru&&a instanceof e.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 e=self.C3,b=new Set;e.ImageInfo=class extends e.DefendedBase{constructor(){super();this._url="";this._height=this._width=this._offsetY=this._offsetX=this._size=0;this._hasMetaData=this._isRotated=!1;this._imageAsset=null;this._textureState="";this._rcTex=e.New(e.Rect);this._quadTex=e.New(e.Quad);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),a._quadTex.setFromRect(a._rcTex)}LoadData(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._isRotated=a[6];this._hasMetaData=!0}LoadDynamicAsset(a,c){if(this._imageAsset)throw Error("already loaded asset");this._url=c;const d={};e.IsAbsoluteURL(c)&&(d.loadPolicy="remote");this.LoadAsset(a,d);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._offsetX=a._offsetX;this._offsetY=a._offsetY;
this._width=a._width;this._height=a._height;this._isRotated=a._isRotated;this._hasMetaData=a._hasMetaData;this._imageAsset=a._imageAsset;this._textureState=a._textureState;this._rcTex=a._rcTex;this._quadTex=a._quadTex}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}IsRotated(){return this._isRotated}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(a,
c){if(this._imageAsset)throw Error("already got asset");c=Object.assign({},c,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=a.LoadImage(c)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,c){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";a=await this._imageAsset.LoadStaticTexture(a,c);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._isRotated?this._height:this._width),this._offsetY+(this._isRotated?this._width:this._height));this._rcTex.divide(a.GetWidth(),a.GetHeight());this._quadTex.setFromRect(this._rcTex);this._isRotated&&this._quadTex.rotatePointsAnticlockwise();return a}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,
0,0,0),this._quadTex.setFromRect(this._rcTex))}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}GetTexQuad(){return this._quadTex}async ExtractImageToCanvas(){const a=await this._imageAsset.LoadToDrawable(),c=e.CreateCanvas(this._width,this._height);c.getContext("2d").drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return c}}}
{"use strict";const e=self.C3;e.AnimationInfo=class extends e.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=>e.New(e.AnimationFrameInfo,a))}Release(){for(const b of this._frames)b.Release();e.clearArray(this._frames)}LoadAllAssets(b){for(const a of this._frames)a.GetImageInfo().LoadAsset(b)}LoadAllTextures(b,a){return Promise.all(this._frames.map(c=>
c.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 e=self.C3;e.AnimationFrameInfo=class extends e.DefendedBase{constructor(b){super();this._imageInfo=e.New(e.ImageInfo);this._imageInfo.LoadData(b);this._duration=b[7];this._origin=e.New(e.Vector2,b[8],b[9]);this._imagePoints=b[10].map(a=>e.New(e.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[11];6<=b.length&&(this._collisionPoly=e.New(e.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 e=self.C3;e.ImagePoint=class extends e.DefendedBase{constructor(b,a){super();this._afi=b;this._name=a[0];this._pos=e.New(e.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 e=self.C3,b=self.C3Debugger,a=self.IObjectClass;e.ObjectClass=class extends e.DefendedBase{constructor(c,d,f){super();const h=c.GetObjectReference(f[1]);this._runtime=c;this._plugin=c.GetPluginManager().GetPluginByConstructorFunction(h);this._sdkType=null;this._instSdkCtor=h.Instance;this._index=d;this._sid=f[11];this._name=f[0];this._jsPropName=this._runtime.GetJsPropName(f[14]);this._isGlobal=!!f[9];this._isFamily=!!f[2];this._isOnLoaderLayout=!!f[10];this._instVars=f[3].map(g=>
({sid:g[0],type:g[1],name:g[2],jsPropName:c.GetJsPropName(g[3])}));this._behaviorsCount=f[4];this._effectsCount=f[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=e.New(e.SparseGrid,c.GetOriginalViewportWidth(),c.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=f[8].map(g=>e.BehaviorType.Create(this,g));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=e.New(e.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=e.New(e.EffectList,this,f[12]));f[6]&&(this._imageInfo=e.New(e.ImageInfo),this._imageInfo.LoadData(f[6]));if(f[7]){this._animations=f[7].map(g=>e.New(e.AnimationInfo,g));this._animationsByName=new Map;this._animationsBySid=new Map;for(const g of this._animations)this._animationsByName.set(g.GetName().toLowerCase(),g),this._animationsBySid.set(g.GetSID(),g)}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=e.New(h.Type,this,f[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=e.New(e.Event.Dispatcher);if(d=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new d(this),!(this._iObjectClass instanceof a))throw new TypeError("script interface class must derive from IObjectClass");
}else this._iObjectClass=new a(this);f[13]&&(d=f[13])&&this._sdkType.LoadTilemapData(d[0],d[1],d[2]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(f))}static Create(c,d,f){return e.New(e.ObjectClass,c,d,f)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const c of this._animations)c.Release();
e.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(c){for(let d=1,f=c.length;d<f;++d){const h=this._runtime.GetObjectClassByIndex(c[d]);this._familyMembers.push(h);this._familyMembersSet.add(h);h._families.push(this);h._familiesSet.add(this)}}_SetContainer(c){this._isInContainer=!0;this._container=c}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var c=
0;if(!this._isFamily)for(var d of this._families)for(var f of d.GetBehaviorTypes()){const l=f.GetName().toLowerCase();this._behaviorsByName.set(l,f);this._behaviorNameToIndex.set(l,c);this._behaviorTypesIncludingInherited.push(f);++c}for(var h of this.GetBehaviorTypes())d=h.GetName().toLowerCase(),this._behaviorsByName.set(d,h),this._behaviorNameToIndex.set(d,c),this._behaviorTypesIncludingInherited.push(h),++c;for(var g of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(g.GetBehavior().constructor);
if(!this._isFamily&&this._families.length){c=this._runtime.GetFamilyCount();e.extendArray(this._familyInstVarMap,c,0);e.extendArray(this._familyBehaviorMap,c,0);e.extendArray(this._familyEffectMap,c,0);c=[];d=g=h=0;for(const l of this._families)if(f=l.GetFamilyIndex(),this._familyInstVarMap[f]=h,h+=l.GetInstanceVariablesCount(),this._familyBehaviorMap[f]=g,g+=l.GetBehaviorTypesCount(),this._familyEffectMap[f]=d,d+=l.GetEffectTypesCount(),(f=l.GetEffectList())&&this._effectList)for(const m of f.GetAllEffectTypes())c.push(m.Clone(this._effectList));
this._effectList&&this._effectList.PrependEffectTypes(c)}}_CreateSingleGlobalInstance(c){const d=this._runtime._GetNewUID(),f=e.New(e.Instance,{runtime:this._runtime,objectType:this,uid:d});f._CreateSdkInstance(c[16],[]);this._runtime._MapInstanceByUID(d,f);this._instances.push(f)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(c){if(this._isFamily)return Promise.resolve();
this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(c)||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(c){return this._isFamily?
Promise.resolve():this._sdkType.PreloadTexturesWithInstances(c)}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(c){return c&&
this._usedBehaviorCtors.has(c)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(c=>c.sid)}GetInstanceVariableIndexBySID(c){return this._instVars.findIndex(d=>d.sid===c)}GetInstanceVariableIndexByName(c){return this._instVars.findIndex(d=>d.name===c)}_GetAllInstanceVariableNames(){return this._instVars.map(c=>c.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(c=>c.jsPropName)}GetInstanceVariableType(c){c=Math.floor(c);
if(0>c||c>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[c].type}GetInstanceVariableName(c){c=Math.floor(c);if(0>c||c>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[c].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(c){return this._behaviorsByName.get(c.toLowerCase())||null}GetBehaviorIndexByName(c){c=
this._behaviorNameToIndex.get(c.toLowerCase());return"undefined"===typeof c?-1:c}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(c){this._defaultInstanceData=c}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(c){this._defaultLayerIndex=
c}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(c){return this._familiesSet.has(c)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(c){return this._familyMembersSet.has(c)}GetFamilyBehaviorOffset(c){return this._familyBehaviorMap[c]}GetFamilyInstanceVariableOffset(c){return this._familyInstVarMap[c]}GetAnimationByName(c){if(!this._animations)throw Error("no animations");
return this._animationsByName.get(c.toLowerCase())||null}GetAnimationBySID(c){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(c)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const c=this.GetFirstAnimationFrame().GetImageInfo();return[c.GetWidth(),c.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 c of this._runtime._GetInstancesPendingCreate())c.GetObjectClass()===this&&(yield c)}GetInstanceCount(){return this._instances.length}_AddInstance(c){this._instances.push(c)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&
!this._isFamily){var c=this._instances,d=0;for(let f=c.length;d<f;++d)c[d]._SetIID(d);c=this._runtime._GetInstancesPendingCreate();for(const f of c)f.GetObjectClass()===this&&f._SetIID(d++);this._iidsStale=!1}}GetInstanceByIID(c){var d=this._instances;if(c<d.length)return d[c];c-=d.length;d=this._runtime._GetInstancesPendingCreate();for(const f of d)if(f.GetObjectClass()===this){if(0===c)return f;--c}return null}GetFirstPicked(c){if(c&&c.IsInContainer()&&c.GetObjectClass()!==this)for(const d of c.siblings())if(d.GetObjectClass()===
this)return d;c=this.GetCurrentSol().GetInstances();return c.length?c[0]:null}GetPairedInstance(c){const d=this.GetCurrentSol().GetInstances();return 0<d.length?d[c.GetIID()%d.length]:null}*allCorrespondingInstances(c,d){const f=this.GetCurrentSol().GetInstances();var h=f.length;const g=d.GetCurrentSol(),l=d.GetCurrentSol().GetInstances(),m=l.length;var u=c.GetIID();if(d.IsFamily()||!g.IsSelectAll())u=l.indexOf(c);c=Math.ceil(h/m);h%=m;0===h||u<h?(u*=c,h=c):(u=h*c+(u-h)*(c-1),h=c-1);for(let v=u,t=
u+h;v<t;++v)yield f[v]}FinishCondition(c){this._sdkType.FinishCondition(c)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var c=this.GetCurrentSol(),d=c._GetOwnInstances(),f=c.IsSelectAll(),h=this._runtime.GetCurrentEventStackFrame();h=h&&h.GetCurrentEvent()&&h.GetCurrentEvent().IsOrBlock();for(const m of this._container.objectTypes())if(m!==this){m._UpdateIIDs();var g=m.GetCurrentSol();g._SetSelectAll(f);if(!f){var l=g._GetOwnInstances();e.clearArray(l);for(const u of d)l.push(m.GetInstanceByIID(u.GetIID()));
if(h){l=c._GetOwnElseInstances();g=g._GetOwnElseInstances();e.clearArray(g);for(const u of l)g.push(m.GetInstanceByIID(u.GetIID()))}}}}}_TruncateContainerSols(c,d){for(const f of this.GetContainer().objectTypes()){const h=f.GetCurrentSol();c?e.truncateArray(h._GetOwnElseInstances(),d):e.truncateArray(h._GetOwnInstances(),d)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(c){this._anyCollisionCellChanged=!!c}_SetAnyInstanceParallaxed(c){this._anyInstanceParallaxed=!!c}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&
this._isWorldType){for(const c of this._instances)c.GetWorldInfo()._UpdateCollisionCell();for(const c of this._runtime._GetInstancesPendingCreate())c.GetObjectClass()===this&&c.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(e.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.Persist)}_SaveToJson(){const c=
{instances:this._instances.map(d=>d.SaveToJson())};this._savedData&&this._savedData.size&&(c.ex=e.ToSuperJSON(this._savedData));return c}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);var d=c.ex;d&&(this._savedData=e.FromSuperJSON(d));d=this._instances;c=c.instances;for(let f=0,h=Math.min(d.length,c.length);f<h;++f)d[f].LoadFromJson(c[f]);for(let f=c.length,h=d.length;f<h;++f)this._runtime.DestroyInstance(d[f]);for(let f=d.length,h=c.length;f<h;++f){d=c[f];let g=
null;if(this.IsWorldType()&&(g=this._runtime.GetMainRunningLayout().GetLayerBySID(d.w.l),!g))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,g,!1,0,0,!0).LoadFromJson(d)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(c){this._instanceUserScriptClass=c}DispatchUserScriptEvent(c){var d=this._runtime;(d=
d.IsDebug()&&!d.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(c);d&&b.AddScriptTime()}}}
{"use strict";const e=self.C3;e.Container=class extends e.DefendedBase{constructor(b,a){super();this._runtime=b;this._objectTypes=a;for(const c of this._objectTypes)c._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 e=self.C3,b=self.C3Debugger,a=self.IInstance,c=[];let d=0;const f=new WeakMap,h=new WeakMap;e.Instance=class extends e.DefendedBase{constructor(g){super();this._runtime=g.runtime;this._objectType=g.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=g.uid;this._puid=d++;this._flags=0;this._behaviorInstances=this._instVarValues=c;var l=this._objectType.GetBehaviorTypesIncludingInherited();0<l.length&&(this._behaviorInstances=l.map((m,u)=>e.New(e.BehaviorInstance,
{runtime:this._runtime,behaviorType:m,instance:this,index:u})));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;l=this.GetPlugin();l.MustPreDraw()&&(this._flags|=4);if(l.IsWorldType())if(this._worldInfo=e.New(e.WorldInfo,this,g.layer),g.worldData)this._worldInfo.Init(g.worldData);else{this._worldInfo.InitNoData();const [m,u]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(m,u);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}g.instVarData?
this._LoadInstanceVariableData(g.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var g of this._behaviorInstances)g.Release();e.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(g=f.get(this))g.clear(),f.delete(this);if(g=h.get(this))g.clear(),h.delete(this);this._siblings&&e.clearArray(this._siblings);this._dispatcher&&(this._dispatcher.Release(),
this._dispatcher=null);this._objectType=this._runtime=null;0<this._instVarValues.length&&e.clearArray(this._instVarValues);this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(g){0<g.length&&(this._instVarValues=[],e.shallowAssignArray(this._instVarValues,g))}_LoadDefaultInstanceVariables(){const g=this._objectType.GetInstanceVariablesCount();if(0!==g){this._instVarValues=[];var l=[0,0,""];for(let m=0;m<g;++m)this._instVarValues.push(l[this._objectType.GetInstanceVariableType(m)])}}_CreateSdkInstance(g,
l){if(this._sdkInst)throw Error("already got sdk instance");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m]._CreateSdkInstance(l?l[m]:null);this._sdkInst=e.New(this._objectType.GetInstanceSdkCtor(),this,g);if(!(this._sdkInst instanceof e.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}GetActiveTimeScale(){const g=
this._timeScale;return-1===g?this.GetRuntime().GetTimeScale():g}SetTimeScale(g){g=+g;if(0>g||!isFinite(g))g=0;this._timeScale=g}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=e.New(e.Event.Dispatcher));return this._dispatcher}Draw(g){this._sdkInst.Draw(g)}OnCreate(g){this._sdkInst.OnCreate(g)}_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)}SetMustMitigateZFighting(){this._flags|=32}MustMitigateZFighting(){return 0!==(this._flags&32)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(g){this._flags=g?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(g){this._flags=g?this._flags|16:this._flags&-17}SetFlag(g,l){g<<=16;this._flags=l?this._flags|g:this._flags&~g}GetFlag(g){return 0!==(this._flags&g<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetCurrentTexQuad(){return this._sdkInst.GetCurrentTexQuad()}IsCurrentTexRotated(){return this._sdkInst.IsCurrentTexRotated()}GetImagePoint(g){return this._sdkInst.GetImagePoint(g)}GetObjectClass(){return this._objectType}RendersToOwnZPlane(){return this._sdkInst.RendersToOwnZPlane()}BelongsToObjectClass(g){return g.IsFamily()?
g.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===g}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw Error("object does not support scene graph");}HasParent(){return null!==this.GetParent()}GetParent(){var g=this.GetWorldInfo();return g?(g=g.GetParent())?g.GetInstance():null:null}GetTopParent(){var g=this.GetWorldInfo();return g?(g=g.GetTopParent())?g.GetInstance():null:null}*parents(){const g=this.GetWorldInfo();if(g)for(const l of g.parents())yield l.GetInstance()}HasChildren(){const g=
this.GetWorldInfo();return g?g.HasChildren():!1}GetChildren(){const g=this.GetWorldInfo();return g?g.GetChildren().map(l=>l.GetInstance()):[]}*children(){const g=this.GetWorldInfo();if(g)for(const l of g.children())yield l.GetInstance()}*allChildren(){const g=this.GetWorldInfo();if(g)for(const l of g.allChildren())yield l.GetInstance()}GetChildCount(){const g=this.GetWorldInfo();return g?g.GetChildCount():0}GetChildAt(g){const l=this.GetWorldInfo();return l?(g=l.GetChildAt(g))?g.GetInstance():null:
null}AddChild(g,l){this.VerifySupportsSceneGraph();g.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(g.GetWorldInfo(),l||{})}RemoveChild(g){const l=this.GetWorldInfo();l&&l.RemoveChild(g.GetWorldInfo())}GetDestroyWithParent(){const g=this.GetWorldInfo();return g?g.GetDestroyWithParent():!1}SetupInitialSceneGraphConnections(){var g=this.GetWorldInfo();if(g&&(g=g.GetSceneGraphChildrenExportData()))for(const l of g)if(g=this._runtime.GetInstanceByUID(l[2])){const m=l[3];this.AddChild(g,{transformX:!!(m>>
0&1),transformY:!!(m>>1&1),transformWidth:!!(m>>2&1),transformHeight:!!(m>>3&1),transformAngle:!!(m>>4&1),destroyWithParent:!!(m>>5&1),transformZElevation:!!(m>>6&1)})}}IsInContainer(){return null!==this._siblings}_AddSibling(g){this._siblings.push(g)}GetSiblings(){return this._siblings}HasSibling(g){return!!this.GetSibling(g)}GetSibling(g){const l=this.siblings();if(null===l||0===l.length)return!1;for(const m of l)if(m.GetObjectClass()===g)return m;return null}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol().SetSinglePicked(g)}_PushSiblingsToSolInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushInstance(g)}_SetSiblingsToSolInstancesIndex(g){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnInstances()[g]=
l}_PushSiblingsToSolElseInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushElseInstance(g)}_SetSiblingsToSolElseInstancesIndex(g){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[g]=l}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(g){this._iid=g}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(g){if(!g)return null;
for(const l of this._behaviorInstances)if(l.GetBehavior()instanceof g)return l;return null}GetBehaviorSdkInstanceFromCtor(g){return g?(g=this.GetBehaviorInstanceFromCtor(g))?g.GetSdkInstance():null:null}GetBehaviorIndexBySID(g){const l=this._behaviorInstances;for(let m=0,u=l.length;m<u;++m)if(l[m].GetBehaviorType().GetSID()===g)return m;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(g){g|=
0;const l=this._instVarValues;if(0>g||g>=l.length)throw new RangeError("invalid instance variable");return l[g]}_GetInstanceVariableValueUnchecked(g){return this._instVarValues[g]}_GetInstanceVariableTypedValue(g){const l=this._instVarValues[g];return 0===this._objectType.GetInstanceVariableType(g)?!!l:l}SetInstanceVariableValue(g,l){g|=0;const m=this._instVarValues;if(0>g||g>=m.length)throw new RangeError("invalid instance variable");switch(this._objectType.GetInstanceVariableType(g)){case 0:m[g]=
l?1:0;break;case 1:m[g]="number"===typeof l?l:parseFloat(l);break;case 2:m[g]="string"===typeof l?l:l.toString();break;default:throw Error("unknown instance variable type");}}SetInstanceVariableOffset(g,l){if(0!==l){g|=0;var m=this._instVarValues;if(0>g||g>=m.length)throw new RangeError("invalid instance variable");var u=m[g];if("number"===typeof u)m[g]="number"===typeof l?m[g]+l:m[g]+parseFloat(l);else{if("boolean"===typeof u)throw Error("can not set offset of boolean variable");if("string"===typeof u)throw Error("can not set offset of string variable");
throw Error("unknown instance variable type");}}}GetSavedDataMap(){let g=f.get(this);if(g)return g;g=new Map;f.set(this,g);return g}GetUnsavedDataMap(){let g=h.get(this);if(g)return g;g=new Map;h.set(this,g);return g}_HasAnyCreateDestroyHandler(g){const l=this.GetObjectClass();if(l.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;for(const m of l.GetFamilies())if(m.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;return this._runtime.UserScriptDispatcher().HasAnyHandlerFor(g)?!0:!1}_TriggerOnCreatedOnSelfAndRelated(){const g=
new Set;g.add(this);const l=this.GetWorldInfo();if(l&&l.HasChildren())for(const m of this.allChildren())if(g.add(m),m.IsInContainer())for(const u of m.siblings())g.add(u);if(this.IsInContainer())for(const m of this.siblings())g.add(m);for(const m of g.values())m._TriggerOnCreated()}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const g=this.GetObjectClass(),l=new e.Event("instancecreate");l.instance=this.GetInterfaceClass();g.DispatchUserScriptEvent(l);for(const m of g.GetFamilies())m.DispatchUserScriptEvent(l);
this._runtime.DispatchUserScriptEvent(l)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(g){if(this._iScriptInterface){var l=new e.Event("destroy");l.isEndingLayout=g;this.DispatchUserScriptEvent(l)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){l=this.GetObjectClass();var m=new e.Event("instancedestroy");m.instance=this.GetInterfaceClass();
m.isEndingLayout=g;l.DispatchUserScriptEvent(m);for(const u of l.GetFamilies())u.DispatchUserScriptEvent(m);this._runtime.DispatchUserScriptEvent(m)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(g="full"){const l={};"full"===g?l.uid=this.GetUID():l.c3=!0;if("visual-state"!==g){var m=f.get(this);m&&m.size&&(l.ex=e.ToSuperJSON(m));-1!==this.GetTimeScale()&&(l.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){m={};var u=this._objectType.GetInstanceVariableSIDs();
for(let v=0,t=this._instVarValues.length;v<t;++v)m[u[v].toString()]=this._instVarValues[v];l.ivs=m}if(this._behaviorInstances.length){m={};for(const v of this._behaviorInstances)(u=v.SaveToJson())&&(m[v.GetBehaviorType().GetSID().toString()]=u);l.behs=m}}this._worldInfo&&(l.w=this._worldInfo._SaveToJson(g));(g=this._sdkInst.SaveToJson())&&(l.data=g);return l}_OnBeforeLoad(g="full"){this._worldInfo&&this._worldInfo._OnBeforeLoad(g)}LoadFromJson(g,l="full"){if("full"===l)this._uid=g.uid;else if(!g.c3)return;
if("visual-state"!==l){var m=f.get(this);m&&(m.clear(),f.delete(this));if(m=g.ex)m=e.FromSuperJSON(m),f.set(this,m);this._timeScale=g.hasOwnProperty("mts")?g.mts:-1;if(m=g.ivs)for(const [t,q]of Object.entries(m))if(m=parseInt(t,10),m=this._objectType.GetInstanceVariableIndexBySID(m),!(0>m||m>=this._instVarValues.length)){var u=q;null===u&&(u=NaN);this._instVarValues[m]=u}}if(this.GetPlugin().IsWorldType()){m=g.w;var v=m.l;this._worldInfo.GetLayer().GetSID()!==v&&(u=this._worldInfo.GetLayer(),(v=u.GetLayout().GetLayerBySID(v))?
(this._worldInfo._SetLayer(v),u._RemoveInstance(this,!0),v._AddInstance(this,!0),v.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===l&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(m,l)}if("visual-state"!==l&&(l=g.behs))for(const [t,q]of Object.entries(l))l=parseInt(t,10),l=this.GetBehaviorIndexBySID(l),0>l||l>=this._behaviorInstances.length||this._behaviorInstances[l].LoadFromJson(q);(g=g.data)&&this._sdkInst.LoadFromJson(g)}GetInterfaceClass(){return this._iScriptInterface||
this._InitUserScriptInterface()}_InitUserScriptInterface(){var g=this._worldInfo?self.IWorldInstance:a;const l=this._sdkInst.GetScriptInterfaceClass(),m=this._objectType._GetUserScriptInstanceClass(),u=m||l||g;a._Init(this);this._iScriptInterface=new u;a._Init(null);if(l&&!(this._iScriptInterface instanceof g))throw new TypeError(`script interface class '${l.name}' does not extend the right base class '${g.name}'`);if(m&&(g=l||g,!(this._iScriptInterface instanceof g)))throw new TypeError(`setInstanceClass(): class '${m.name}' does not extend the right base class '${g.name}'`);
return this._iScriptInterface}_GetInstVarsScriptDescriptor(g){if(0!==this._instVarValues.length){var l={},m=this._objectType._GetAllInstanceVariableJsPropNames();for(let u=0,v=m.length;u<v;++u)l[m[u]]={configurable:!1,enumerable:!0,get:e.Instance.prototype._GetInstanceVariableTypedValue.bind(this,u),set:e.Instance.prototype.SetInstanceVariableValue.bind(this,u)};l=Object.create(Object.prototype,l);g.instVars={value:l,writable:!1}}}_GetBehaviorsScriptDescriptor(g){var l=this._behaviorInstances;if(0!==
l.length){var m={};for(const u of l)m[u.GetBehaviorType().GetJsPropName()]={value:u.GetScriptInterface(),writable:!1};l=Object.create(Object.prototype,m);g.behaviors={value:l,writable:!1}}}DispatchUserScriptEvent(g){g.instance=this.GetInterfaceClass();var l=this._runtime;(l=l.IsDebug()&&!l.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this.GetInterfaceClass().dispatchEvent(g);l&&b.AddScriptTime()}}}
{"use strict";const e=self.C3;e.SceneGraphInfo=class extends e.DefendedBase{constructor(b){super();this._owner=b;this._parent=null;this._children=[];this._startWidth=b.GetWidth();this._startHeight=b.GetHeight();this._startScaleY=this._startScaleX=1;this._parentStartAngle=0}Release(){this._parent=null;e.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}GetStartScaleX(){return this._startScaleX}SetStartScaleX(b){this._startScaleX=
b}GetStartScaleY(){return this._startScaleY}SetStartScaleY(b){this._startScaleY=b}_GetStartWidth(){return this._startWidth}_GetStartHeight(){return this._startHeight}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._startWidth,
sh:this._startHeight,sx:this._startScaleX,sy:this._startScaleY,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._startWidth=b.sw;this._startHeight=
b.sh;this._startScaleX=b.sx;this._startScaleY=b.sy;this._parentStartAngle=b.psa}_OnAfterLoad(b){const a=this._owner,c=a.GetRuntime();for(const d of b.c){b=c.GetInstanceByUID(d.uid).GetWorldInfo();const f=d.f,h={};h.transformX=f.includes("x");h.transformY=f.includes("y");h.transformWidth=f.includes("w");h.transformHeight=f.includes("h");h.transformAngle=f.includes("a");h.transformZElevation=f.includes("z");h.destroyWithParent=f.includes("d");a.AddChild(b,h)}}}}
{"use strict";const e=self.C3,b=e.New(e.Rect),a=e.New(e.Quad),c=e.New(e.Event,"bboxchange",!1),d=e.New(e.Color,0,0,0,0),f=e.New(e.CollisionPoly),h=e.New(e.Color,1,1,1,1),g=e.New(e.Rect,0,0,-1,-1),l=e.New(e.Rect,0,0,-1,-1),m=new Set(["absolute","relative"]),u=[];let v=!0;const t=new WeakMap,q=new WeakMap;e.WorldInfo=class extends e.DefendedBase{constructor(p,r){super();this._inst=p;this._objectClass=p.GetObjectClass();this._runtime=p.GetRuntime();this._layer=r;this._zIndex=-1;this._flags=196635;this._objectClass.GetPlugin().IsRotatable()&&
(this._flags|=128);this._oy=this._ox=this._cosA=this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=NaN;this._boundingBox=e.New(e.Rect);this._boundingQuad=e.New(e.Quad);this._collisionCells=l;this._renderCells=g;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=h;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=e.New(e.InstanceEffectList,
this._inst,this));this._meshInfo=this._sceneGraphInfo=null}_MarkDestroyed(){this._flags|=256}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 p=
[...this.GetChildren()];for(const r of p)this.RemoveChild(r)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(p){v=!1;this.SetXY(p[0],p[1]);this.SetZElevation(p[2]);this.SetSize(p[3],p[4]);this._depth=0;this.IsRotatable()?this.SetAngle(p[6]):this._a=0;d.setFromJSON(p[7]);this._SetColor(d);this.SetOriginX(p[8]);this.SetOriginY(p[9]);this.SetBlendMode(p[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(p[12]);p[14]&&t.set(this,
{childrenData:p[14][1],zIndexData:p[14][2]});if(p[15]){var r=p[15];this.CreateMesh(r[0],r[1]);p=this.GetSourceMesh();r=r[2];for(let x=0,y=r.length;x<y;++x){const C=r[x];for(let G=0,A=C.length;G<A;++G){const E=C[G],J=p.GetMeshPointAt(G,x);J.SetX(E[0]);J.SetY(E[1]);J.SetZElevation(E[2]);J.SetU(E[3]);J.SetV(E[4])}}}v=!0;this._UpdateRendererStateGroup()}InitNoData(){this._sinA=this._a=this._depth=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(p){p=+p;if(this.GetTransformWithParentX()){const r=this._sceneGraphInfo;p-=this.GetX();const x=-this._GetParentOffsetAngle();0===x?this._x+=p/r.GetParentScaleX():(this._x+=Math.cos(x)*p/r.GetParentScaleX(),this.GetTransformWithParentY()&&(this._y+=Math.sin(x)*p/r.GetParentScaleY()))}else this._x=p}OffsetX(p){p=+p;this.GetTransformWithParentX()?this.SetX(this.GetX()+p):this._x+=p}GetX(){if(this.GetTransformWithParentX()){let p=
this._x;const r=this._sceneGraphInfo,x=this.GetParent(),y=this._GetParentOffsetAngle();0===y?p*=r.GetParentScaleX():(p=p*r.GetParentScaleX()*Math.cos(y),this.GetTransformWithParentY()&&(p-=this._y*r.GetParentScaleY()*Math.sin(y)));return x.GetX()+p}return this._x}SetY(p){p=+p;if(this.GetTransformWithParentY()){const r=this._sceneGraphInfo;p-=this.GetY();const x=-this._GetParentOffsetAngle();0===x?this._y+=p/r.GetParentScaleY():(this.GetTransformWithParentX()&&(this._x-=Math.sin(x)*p/r.GetParentScaleX()),
this._y+=Math.cos(x)*p/r.GetParentScaleY())}else this._y=p}OffsetY(p){p=+p;this.GetTransformWithParentY()?this.SetY(this.GetY()+p):this._y+=p}GetY(){if(this.GetTransformWithParentY()){let p=this._y;const r=this._sceneGraphInfo,x=this.GetParent(),y=this._GetParentOffsetAngle();0===y?p*=r.GetParentScaleY():(p=p*r.GetParentScaleY()*Math.cos(y),this.GetTransformWithParentX()&&(p+=this._x*r.GetParentScaleX()*Math.sin(y)));return x.GetY()+p}return this._y}SetXY(p,r){p=+p;r=+r;if(this.GetTransformWithParentXOrY()){const y=
this.GetTransformWithParentX(),C=this.GetTransformWithParentY(),G=this._sceneGraphInfo,A=p-this.GetX(),E=r-this.GetY();var x=-this._GetParentOffsetAngle();if(0===x)this._x=y?this._x+A/G.GetParentScaleX():p,this._y=C?this._y+E/G.GetParentScaleY():r;else{const J=Math.sin(x);x=Math.cos(x);this._x=y?C?this._x+(x*A-J*E)/G.GetParentScaleX():this._x+x*A/G.GetParentScaleX():p;this._y=C?y?this._y+(J*A+x*E)/G.GetParentScaleY():this._y+x*E/G.GetParentScaleY():r}}else this._x=p,this._y=r}OffsetXY(p,r){p=+p;r=
+r;this.GetTransformWithParentXOrY()?this.SetXY(this.GetX()+p,this.GetY()+r):(this._x+=p,this._y+=r)}EqualsXY(p,r){return this.GetX()===p&&this.GetY()===r}SetZElevation(p){p=+p;this.GetTransformWithParentZElevation()&&(p-=this.GetParent().GetZElevation());this._zElevation!==p&&(this._zElevation=p,this._UpdateZElevation(),p=this.GetLayer(),0!==this._zElevation&&p._SetAnyInstanceZElevated(),p.SetZIndicesChanged())}_UpdateZElevation(){this._UpdateRendererStateGroup();if(this.HasChildren()){const p=this.GetChildren();
for(let r=0,x=p.length;r<x;r++){const y=p[r];y.GetTransformWithParentZElevation()&&y._UpdateZElevation()}}}OffsetZElevation(p){this.SetZElevation(this.GetZElevation()+p)}GetZElevation(){return this.GetTransformWithParentZElevation()?this.GetParent().GetZElevation()+this._zElevation:this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(p){p=+p;if(this.GetTransformWithParentWidth()){const r=this.GetWidth();this._w=0===r?1E-6:p/r*this._w}else this._w=
p}OffsetWidth(p){p=+p;this.GetTransformWithParentWidth()?this.SetWidth(this.GetWidth()+p):this._w+=p}GetWidth(){return this.GetTransformWithParentWidth()?this.GetParent().GetWidth()*this._w:this._w}SetHeight(p){p=+p;if(this.GetTransformWithParentHeight()){const r=this.GetHeight();this._h=0===r?1E-6:p/r*this._h}else this._h=p}OffsetHeight(p){p=+p;this.GetTransformWithParentHeight()?this.SetHeight(this.GetHeight()+p):this._h+=p}GetHeight(){return this.GetTransformWithParentHeight()?this.GetParent().GetHeight()*
this._h:this._h}SetSize(p,r){p=+p;r=+r;if(this.GetTransformWithParentWidth()){const x=this.GetWidth();this._w=0===x?1E-6:p/x*this._w}else this._w=p;this.GetTransformWithParentHeight()?(p=this.GetHeight(),this._h=0===p?1E-6:r/p*this._h):this._h=r}GetDepth(){return this._depth}SetDepth(p){if(0>p)throw new RangeError("invalid depth");this._depth=p}GetSceneGraphScale(){if(this.HasParent()){const p=this._sceneGraphInfo;return Math.min(p.GetParentScaleX(),p.GetParentScaleY())}return 1}IsRotatable(){return 0!==
(this._flags&128)}SetAngle(p){p=+p;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(p-=this.GetParent().GetAngle()),p=e.clampAngle(p),this._a!==p&&(this._a=p,this._MarkSinCosAngleChanged()))}OffsetAngle(p){p=+p;0!==p&&this.IsRotatable()&&(this._a=e.clampAngle(this._a+p),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|=262144;if(this.HasChildren()){const p=this.GetChildren();for(let r=0,x=p.length;r<x;r++)p[r]._MarkSinCosAngleChanged()}}GetAngle(){return this.GetTransformWithParentAngle()?
e.clampAngle(this.GetParent().GetAngle()+this._a):this._a}_MaybeUpdateSinCosAngle(){const p=this._flags;if(0!==(p&262144)){var r=this.GetAngle();this._sinA=Math.sin(r);this._cosA=Math.cos(r);this._flags=p&-262145}}GetSinAngle(){this._MaybeUpdateSinCosAngle();return this._sinA}GetCosAngle(){this._MaybeUpdateSinCosAngle();return this._cosA}SetOriginX(p){this._ox=+p}OffsetOriginX(p){this._ox+=+p}GetOriginX(){return this._ox}SetOriginY(p){this._oy=+p}OffsetOriginY(p){this._oy+=+p}GetOriginY(){return this._oy}_SetColor(p){this._color.equals(p)||
(this._color===h?(this._color=e.New(e.Color,p),this._colorPremultiplied=e.New(e.Color,p),this._colorPremultiplied.premultiply()):p.equalsRgba(1,1,1,1)?this._colorPremultiplied=this._color=h:(this._color.set(p),this._colorPremultiplied.set(p),this._colorPremultiplied.premultiply()),this._UpdateRendererStateGroup())}SetOpacity(p){p=e.clamp(+p,0,1);this._color.a!==p&&(d.copyRgb(this._color),d.a=p,this._SetColor(d))}OffsetOpacity(p){this.SetOpacity(this.GetOpacity()+p)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(p){this._color.equalsIgnoringAlpha(p)||
(d.copyRgb(p),d.a=this._color.a,this._SetColor(d))}SetUnpremultipliedColorRGB(p,r,x){d.setRgb(p,r,x);this.SetUnpremultipliedColor(d)}OffsetUnpremultipliedColorRGB(p,r,x){if(0!==p||0!==r||0!==x)d.copyRgb(this._color),d.r+=p,d.g+=r,d.b+=x,this.SetUnpremultipliedColor(d)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}GetDestroyWithParent(){return 0!==(this._flags&512)}SetDestroyWithParent(p){this._SetFlag(512,p)}GetTransformWithParentX(){return 0!==
(this._flags&1024)}SetTransformWithParentX(p){this._SetFlag(1024,p)}GetTransformWithParentY(){return 0!==(this._flags&2048)}GetTransformWithParentXOrY(){return 0!==(this._flags&3072)}SetTransformWithParentY(p){this._SetFlag(2048,p)}GetTransformWithParentWidth(){return 0!==(this._flags&4096)}SetTransformWithParentWidth(p){this._SetFlag(4096,p)}GetTransformWithParentHeight(){return 0!==(this._flags&8192)}SetTransformWithParentHeight(p){this._SetFlag(8192,p)}GetTransformWithParentAngle(){return 0!==
(this._flags&16384)}SetTransformWithParentAngle(p){this._SetFlag(16384,p)}GetTransformWithParentZElevation(){return 0!==(this._flags&32768)}SetTransformWithParentZElevation(p){this._SetFlag(32768,p)}_ClearAllSceneGraphFlags(){this._flags&=-65025}AddChild(p,r){if(p!==this&&!p.HasParent()&&!this._HasChildRecursive(p)&&!this._HasAnyParent(p)){var x=p.GetX(),y=p.GetY(),C=p.GetWidth(),G=p.GetHeight(),A=p.GetAngle(),E=p.GetZElevation();p._SetParent(this);p.SetTransformWithParentX(r.transformX);p.SetTransformWithParentY(r.transformY);
p.SetTransformWithParentWidth(r.transformWidth);p.SetTransformWithParentHeight(r.transformHeight);p.SetTransformWithParentAngle(r.transformAngle);p.SetTransformWithParentZElevation(r.transformZElevation);p.SetDestroyWithParent(r.destroyWithParent);r.transformX&&(p._x=x-this.GetX(),r.transformWidth&&(p._x/=this.GetWidth()/this._sceneGraphInfo._GetStartWidth()));r.transformY&&(p._y=y-this.GetY(),r.transformHeight&&(p._y/=this.GetHeight()/this._sceneGraphInfo._GetStartHeight()));r.transformWidth&&(p._w=
C/this.GetWidth(),p._sceneGraphInfo.SetStartScaleX(p._w));r.transformHeight&&(p._h=G/this.GetHeight(),p._sceneGraphInfo.SetStartScaleY(p._h));r.transformAngle&&(p._a=A-this.GetAngle());r.transformZElevation&&(p._zElevation=E-this.GetZElevation());this._AddChildToSceneGraphInfo(p);this.SetBboxChanged()}}RemoveChild(p){if(p.GetParent()===this){var r=p.GetX(),x=p.GetY(),y=p.GetWidth(),C=p.GetHeight(),G=p.GetAngle(),A=p.GetZElevation();p._SetParent(null);p._ClearAllSceneGraphFlags();p.SetXY(r,x);p.SetSize(y,
C);p.SetAngle(G);p.SetZElevation(A);this._RemoveChildFromSceneGraphInfo(p);this.SetBboxChanged()}}_ResetAllSceneGraphState(){for(var p of this.children())this.RemoveChild(p);(p=this.GetParent())&&p.RemoveChild(this);this._ClearAllSceneGraphFlags()}HasParent(){return null!==this.GetParent()}GetParent(){const p=this._sceneGraphInfo;return null!==p?p.GetParent():null}GetTopParent(){let p=this;for(;p.HasParent();)p=p.GetParent();return p}*parents(){let p=this.GetParent();for(;p;)yield p,p=p.GetParent()}HasChild(p){return this.GetChildren().includes(p)}HasChildren(){const p=
this._sceneGraphInfo;return null!==p?p.HasChildren():!1}GetChildren(){const p=this._sceneGraphInfo;return null!==p?p.GetChildren():u}children(){return this.GetChildren()}*allChildren(){for(const p of this.children())yield p,yield*p.allChildren()}GetChildCount(){return this.GetChildren().length}GetChildAt(p){const r=this.GetChildren();p=Math.floor(+p);return 0>p||p>=r.length?null:r[p]}_CreateSceneGraphInfo(p){this._sceneGraphInfo||(this._sceneGraphInfo=e.New(e.SceneGraphInfo,this));p&&this._sceneGraphInfo.SetParent(p)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&&
(this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(p){p?(p._CreateSceneGraphInfo(null),this._CreateSceneGraphInfo(p)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(p){if(!this.HasParent())return!1;const r=this.GetParent();return r===p?!0:r._HasAnyParent(p)}_HasChildRecursive(p){if(this.HasChild(p))return!0;for(const r of this.GetChildren())if(r._HasChildRecursive(p))return!0;return!1}_AddChildToSceneGraphInfo(p){this._sceneGraphInfo.GetChildren().push(p)}_RemoveChildFromSceneGraphInfo(p){const r=
this._sceneGraphInfo.GetChildren(),x=r.indexOf(p);-1!==x&&r.splice(x,1);0!==r.length||this.HasParent()||this._ReleaseSceneGraphInfo();p.HasChildren()||p._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){const p=t.get(this);return p?p.childrenData:null}GetSceneGraphZIndexExportData(){const p=t.get(this);return p?p.zIndexData:NaN}GetSceneGraphZIndex(){return q.get(this)||NaN}SetSceneGraphZIndex(p){q.set(this,p)}SetUsePointsShaderProgram(){this._SetFlag(524288,!0);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(v){var p=
this._runtime.GetRenderer();this._stateGroup&&p.ReleaseStateGroup(this._stateGroup);var r=0!==(this._flags&524288)?p.GetPointsRenderingProgram()||"<point>":p.GetTextureFillShaderProgram()||"<default>";this._stateGroup=p.AcquireStateGroup(r,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===h}SetBlendMode(p){p|=0;if(0>p||31<p)throw new RangeError("invalid blend mode");this.GetBlendMode()!==p&&(this._flags=
this._flags&-2080374785|p<<26,this._UpdateRendererStateGroup())}GetBlendMode(){return(this._flags&2080374784)>>26}_SetLayer(p){this._layer=p;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(p){this._zIndex=p|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(p,r){this._flags=r?this._flags|p:this._flags&~p}IsVisible(){return 0!==(this._flags&
1)}SetVisible(p){this._SetFlag(1,p)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(p){p=!!p;this.IsCollisionEnabled()!==p&&(this._SetFlag(8,p),p?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(p,r){this._SetFlag(32,p);this._solidFilterTags&&this._solidFilterTags.clear();if(r.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const x of r.split(" "))x&&this._solidFilterTags.add(x.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(p){const r=
0!==(this._flags&32),x=this._solidFilterTags;if(!p||!x)return!r;for(const y of x)if(p.has(y))return r;return!r}SetBboxChanged(){this._flags|=65554;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(c);if(null!==this._sceneGraphInfo){const p=this._sceneGraphInfo.GetChildren();for(let r=
0,x=p.length;r<x;++r)p[r].SetBboxChanged()}}CalculateBbox(p,r,x){const y=this.GetX(),C=this.GetY(),G=this.GetWidth(),A=this.GetHeight(),E=this.GetAngle();p.setWH(y-this._ox*G,C-this._oy*A,G,A);x&&this.HasMesh()&&this._ExpandBboxForMesh(p);0===E?r.setFromRect(p):(p.offset(-y,-C),r.setFromRotatedRectPrecalc(p,this.GetSinAngle(),this.GetCosAngle()),r.offset(y,C),r.getBoundingBox(p));p.normalize()}_UpdateBbox(){const p=this._flags;0!==(p&2)&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),
this._flags=p&-3)}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(p){var r=this.GetX(),x=this.GetY();r=Math.round(r)-r;x=Math.round(x)-x;if(0===r&&0===x)return p;a.copy(p);a.offset(r,x);return a}OverwriteBoundingBox(p){this._boundingBox.copy(p);this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell();this._UpdateRenderCell()}SetBboxChangeEventEnabled(p){this._SetFlag(4,p)}IsBboxChangeEventEnabled(){return 0!==
(this._flags&4)}IsInViewport(p,r,x){return r&&0!==this.GetDepth()?this.IsInViewport3D(this.GetLayer()._GetViewFrustum()):0===this.GetZElevation()||x?p.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const p=this.GetLayer(),r=this.GetTotalZElevation();if(r>=p.GetCameraZ())return!1;p.GetViewportForZ(r,b);return b.intersectsRect(this.GetBoundingBox())}IsInViewport3D(p){var r=this.GetBoundingBox();const x=r.getLeft(),y=r.getRight(),C=r.getTop();r=r.getBottom();
const G=this.GetTotalZElevation(),A=G+this.GetDepth();return p.ContainsAABB(x,C,G,y,r,A)}_SetDrawBackFaceOnly(p){this._SetFlag(1048576,p)}_SetDrawNonBackFacesOnly(p){this._SetFlag(2097152,p)}IsDrawBackFaceOnly(){return 0!==(this._flags&1048576)}IsDrawNonBackFacesOnly(){return 0!==(this._flags&2097152)}SetSourceCollisionPoly(p){this._sourceCollisionPoly=p;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(p,r,x){let y=0,C=1;0!==x&&(y=Math.sin(x),C=Math.cos(x));return this._GetCustomTransformedCollisionPolyPrecalc(p,r,x,y,C)}_GetCustomTransformedCollisionPolyPrecalc(p,r,x,y,C){let G=this._transformedPolyInfo;null===G&&(this._transformedPolyInfo=G={poly:e.New(e.CollisionPoly),
width:NaN,height:NaN,angle:NaN});const A=G.poly;if(G.width===p&&G.height===r&&G.angle===x)return A;const E=this._sourceCollisionPoly;if(this.HasMesh()){const J=this.GetOriginX(),B=this.GetOriginY(),I=this.GetSourceMesh();let L=this._meshInfo.meshPoly;L||(E?(f.copy(E),f.offset(J,B)):f.setDefaultPoints(),L=I.InsertPolyMeshVertices(f),this._meshInfo.meshPoly=L);I.TransformCollisionPoly(L,A);A.offset(-J,-B);A.transformPrecalc(p,r,y,C)}else E?(A.copy(E),A.transformPrecalc(p,r,y,C)):A.setFromQuad(this.GetBoundingQuad(),
-this.GetX(),-this.GetY());G.width=p;G.height=r;G.angle=x;return A}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);const p=this._transformedPolyInfo;null!==p&&(p.width=NaN)}CreateMesh(p,r){p=Math.floor(p);r=Math.floor(r);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:e.New(e.Gfx.Mesh,p,r),transformedMesh:e.New(e.Gfx.Mesh,p,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(p){this._SetFlag(65536,p)}IsMeshChanged(){return 0!==(this._flags&65536)}SetPhysicsBodyChanged(p){this._SetFlag(131072,p)}IsPhysicsBodyChanged(){return 0!==(this._flags&131072)}_ExpandBboxForMesh(p){const r=this._meshInfo.sourceMesh,x=Math.min(r.GetMinX(),0),y=Math.min(r.GetMinY(),0),C=Math.max(r.GetMaxX(),1),G=Math.max(r.GetMaxY(),1),A=p.width(),E=p.height();
p.offsetLeft(x*A);p.offsetTop(y*E);p.offsetRight((C-1)*A);p.offsetBottom((G-1)*E);this._depth=r.GetMaxZ()}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(p,r,x){p=Math.floor(p);r=Math.floor(r);var y=x.mode||"absolute";if(!m.has(y))throw Error("invalid mode");y="relative"===y;let C=x.x,G=x.y;const A=x.zElevation;let E="number"===typeof x.u?x.u:y?0:-1;x="number"===typeof x.v?
x.v:y?0:-1;if(!this.HasMesh())return!1;const J=this.GetSourceMesh(),B=J.GetMeshPointAt(p,r);if(null===B)return!1;let I=!1;"number"===typeof A&&B.GetZElevation()!==A&&(B.SetZElevation(A),I=!0);y&&(C+=p/(J.GetHSize()-1),G+=r/(J.GetVSize()-1));-1!==E||y?(y&&(E+=p/(J.GetHSize()-1)),E=e.clamp(E,0,1)):E=B.GetU();-1!==x||y?(y&&(x+=r/(J.GetVSize()-1)),x=e.clamp(x,0,1)):x=B.GetV();if(B.GetX()===C&&B.GetY()===G&&B.GetU()===E&&B.GetV()===x)return I;B.SetX(C);B.SetY(G);B.SetU(E);B.SetV(x);this._DiscardTransformedCollisionPoly();
return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(p,r){return this.GetBoundingBox().containsPoint(p,r)&&this.GetBoundingQuad().containsPoint(p,r)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(p,r):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(p-this.GetX(),r-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()&&0===(this._flags&
256)){var p=this.GetBoundingBox(),r=this._objectClass._GetCollisionCellGrid(),x=this._collisionCells;b.set(r.XToCell(p.getLeft()),r.YToCell(p.getTop()),r.XToCell(p.getRight()),r.YToCell(p.getBottom()));x.equals(b)||(p=this._inst,x===l?(r.Update(p,null,b),this._collisionCells=e.New(e.Rect,b)):(r.Update(p,x,b),x.copy(b)),this._flags&=-17)}}_RemoveFromCollisionCells(){const p=this._collisionCells;p!==l&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,p,null),this._collisionCells=l)}_UpdateRenderCell(){const p=
this.GetLayer();if(p.UsesRenderCells()&&0===(this._flags&256)){var r=p.GetRenderGrid(),x=this.GetBoundingBox(),y=this._renderCells;b.set(r.XToCell(x.getLeft()),r.YToCell(x.getTop()),r.XToCell(x.getRight()),r.YToCell(x.getBottom()));y.equals(b)||(x=this._inst,y===g?(r.Update(x,null,b),this._renderCells=e.New(e.Rect,b)):(r.Update(x,y,b),y.copy(b)),p.SetRenderListStale())}}_RemoveFromRenderCells(){const p=this._renderCells;p!==g&&(this.GetLayer().GetRenderGrid().Update(this._inst,p,null),this._renderCells=
g)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const p=this._inst,r=this._layer,x=r._GetInstances();x.length&&x.at(-1)===p||(r._RemoveInstance(p,!1),r._AddInstance(p,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const p=this._inst,r=this._layer,x=r._GetInstances();x.length&&x[0]===p||(r._RemoveInstance(p,!1),r._PrependInstance(p,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(p){const r=this._inst,x=this._layer;if(x.GetLayout()!==p.GetLayout())throw Error("layer from different layout");
p!==x&&(x._RemoveInstance(r,!0),this._SetLayer(p),p._AddInstance(r,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(p,r){const x=this._inst;let y=!1;const C=this._layer;if(p.GetUID()!==x.GetUID()){var G=p.GetWorldInfo();if(!G)throw Error("expected world instance");G=G.GetLayer();C.GetIndex()!==G.GetIndex()&&(C._RemoveInstance(x,!0),this._SetLayer(G),G._AddInstance(x,!0),y=!0);p=G.MoveInstanceAdjacent(x,p,!!r);(y||p)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(p){this._SetFlag(64,
p)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(p){const r={x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(r.ze=this.GetZElevation());0!==this.GetAngle()&&(r.a=this.GetAngle());this.HasDefaultColor()||(r.c=this._color.toJSON());.5!==this.GetOriginX()&&(r.oX=this.GetOriginX());.5!==this.GetOriginY()&&(r.oY=this.GetOriginY());0!==this.GetBlendMode()&&(r.bm=this.GetBlendMode());this.IsVisible()||
(r.v=this.IsVisible());this.IsCollisionEnabled()||(r.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&(r.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(r.fx=this._instanceEffectList._SaveToJson());const x=0!==(this._flags&32);x&&(r.sfi=x);this._solidFilterTags&&(r.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&"visual-state"!==p&&(r.sgi=this._sceneGraphInfo._SaveToJson());this.HasMesh()&&(r.mesh=this.GetSourceMesh().SaveToJson());return r}_OnBeforeLoad(p){"visual-state"!==
p&&this._ResetAllSceneGraphState()}_LoadFromJson(p,r){v=!1;this.SetX(p.x);this.SetY(p.y);this.SetWidth(p.w);this.SetHeight(p.h);this._SetZIndex(p.zi);this.SetZElevation(p.hasOwnProperty("ze")?p.ze:0);this.SetAngle(p.hasOwnProperty("a")?p.a:0);p.hasOwnProperty("c")?d.setFromJSON(p.c):p.hasOwnProperty("o")?(d.copyRgb(this._color),d.a=p.o):d.setRgba(1,1,1,1);this._SetColor(d);this.SetOriginX(p.hasOwnProperty("oX")?p.oX:.5);this.SetOriginY(p.hasOwnProperty("oY")?p.oY:.5);this.SetBlendMode(p.hasOwnProperty("bm")?
p.bm:0);this.SetVisible(p.hasOwnProperty("v")?p.v:!0);this.SetCollisionEnabled(p.hasOwnProperty("ce")?p.ce:!0);this.SetBboxChangeEventEnabled(p.hasOwnProperty("be")?p.be:!1);this.SetSolidCollisionFilter(p.hasOwnProperty("sfi")?p.sfi:!1,p.hasOwnProperty("sft")?p.sft:"");this._instanceEffectList&&p.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(p.fx);if(p.hasOwnProperty("sgi")&&"visual-state"!==r){this._CreateSceneGraphInfo(null);const x=this._sceneGraphInfo,y=p.sgi;x._LoadFromJson(y);
const C=this.GetRuntime().Dispatcher(),G=()=>{C.removeEventListener("afterload",G);0===(this._flags&256)&&x._OnAfterLoad(y)};C.addEventListener("afterload",G)}p.hasOwnProperty("mesh")?(p=p.mesh,this.CreateMesh(p.cols,p.rows),this.GetSourceMesh().LoadFromJson(p)):this.ReleaseMesh();this.SetBboxChanged();v=!0;this._UpdateRendererStateGroup()}}}
{"use strict";const e=self.C3;e.BehaviorType=class extends e.DefendedBase{constructor(b,a){super();const c=b.GetRuntime(),d=c.GetPluginManager(),f=c.GetObjectReference(a[1]);d.HasBehaviorByConstructorFunction(f)||d.CreateBehavior(a);this._runtime=c;this._objectClass=b;this._behavior=d.GetBehaviorByConstructorFunction(f);this._sdkType=null;this._instSdkCtor=f.Instance;this._sid=a[2];this._name=a[0];this._jsPropName=this._runtime.GetJsPropName(a[3]);this._sdkType=e.New(f.Type,this);this.OnCreate()}static Create(b,
a){return e.New(e.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 e=self.C3,b=self.IBehaviorInstance;e.BehaviorInstance=class extends e.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=e.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,
c){this._sdkInst.OnSpriteFrameChanged(a,c)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(a,c){var d=a.GetObjectInstance(),f=c.GetObjectInstance();const h=d.GetObjectClass().GetIndex(),g=f.GetObjectClass().GetIndex();if(h!==g)return h-g;d=d.GetPUID();f=f.GetPUID();return d!==f?d-f:a.GetBehaviorInstance()._GetIndex()-c.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const a=
this._sdkInst.GetScriptInterfaceClass(),c=a||b;b._Init(this);this._iScriptInterface=new c;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 e=self.C3;e.EffectList=class extends e.DefendedBase{constructor(b,a){super();this._owner=b;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const c of a)b=e.New(e.EffectType,this,c,this._allEffectTypes.length),this._allEffectTypes.push(b),this._effectTypesByName.set(b.GetName().toLowerCase(),b),3<=c.length&&this._effectParams.push(this._LoadSingleEffectParameters(c[2]));this.GetRuntime()._AddEffectList(this)}Release(){e.clearArray(this._allEffectTypes);
e.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();e.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,c=this._allEffectTypes.length;a<c;++a)this._allEffectTypes[a]._SetIndex(a)}}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,c=b.length;a<c;++a){const d=b[a];if(Array.isArray(d)){const f=e.New(e.Color);
f.setFromJSON(d);b[a]=f}}return b}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){e.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 e.Color?{t:"color",v:b.toJSON()}:b}static LoadFxParamFromJson(b){if("object"===typeof b){if("color"===b.t){const a=e.New(e.Color);a.setFromJSON(b.v);return a}throw Error("invalid effect parameter type");}return b}static SaveFxParamsToJson(b){return b.map(e.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(b){return b.map(e.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(b=>({name:b.GetName(),active:b.IsActive(),params:e.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()]=e.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}
{"use strict";const e=self.C3;e.EffectType=class extends e.DefendedBase{constructor(b,a,c){super();this._effectList=b;this._id=a[0];this._name=a[1];this._index=c;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(b){b=e.New(e.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,c=this._shaderProgram.GetParameterCount();a<c;++a){const d=this._shaderProgram.GetParameterType(a);
if("float"===d||"percent"===d)b.push(0);else if("color"===d)b.push(e.New(e.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type");}return b}}}
{"use strict";const e=self.C3;e.InstanceEffectList=class extends e.DefendedBase{constructor(b,a){super();this._inst=b;this._wi=a;this._effectList=b.GetObjectClass().GetEffectList();this._wasDefaultColor=this._needsRebuildSteps=!0;this._wasTexRotated=this._wasRotatedOrNegativeSize=this._was3D=!1;this._effectChain=e.New(e.Gfx.EffectChain,b.GetRuntime().GetCanvasManager().GetEffectChainManager(),{drawContent:(c,d)=>{d=d.GetContentObject();const f=d.GetWorldInfo();c.SetColor(f.GetPremultipliedColor());
c.SetCurrentZ(f.GetTotalZElevation());d.Draw(c);c.SetCurrentZ(0)},getSourceTextureInfo:c=>{const d=c.GetCurrentTexRect(),[f,h]=c.GetCurrentSurfaceSize();return{srcTexRect:d,srcWidth:f,srcHeight:h}},getShaderParameters:c=>this.GetEffectParametersForIndex(c)});this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const c of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){this._effectChain.Release();
this._effectChain=null;e.clearArray(this._activeEffectFlags);e.clearArray(this._activeEffectTypes);e.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,c=b.length;a<c;++a){const d=b[a];if(Array.isArray(d)){const f=e.New(e.Color);f.setFromJSON(d);b[a]=f}}return b}LoadDefaultEffectParameters(){for(const b of this._effectList.GetAllEffectTypes())this._effectParams.push(b.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){e.clearArray(this._activeEffectTypes);const b=this._wi,a=this._effectList.GetAllEffectTypes(),c=this._activeEffectTypes,d=this._activeEffectFlags;let f=!0;for(let h=0,g=a.length;h<g;++h)if(d[h]){const l=a[h];c.push(l);l.GetShaderProgram().PreservesOpaqueness()||(f=!1)}this._preservesOpaqueness=f;b._SetHasAnyActiveEffect(!!c.length);this._needsRebuildSteps=!0}_MaybeRebuildEffectChainSteps(){const b=this._inst;
var a=this._wi;const c=a.HasDefaultColor(),d=0<a.GetDepth();a=0!==a.GetAngle()||0>a.GetWidth()||0>a.GetHeight();const f=b.IsCurrentTexRotated();if(this._needsRebuildSteps||c!==this._wasDefaultColor||d!==this._was3D||a!==this._wasRotatedOrNegativeSize||f!==this._wasTexRotated)this._effectChain.BuildSteps(this._activeEffectTypes.map(h=>h.GetShaderProgram()),{indexMap:this._activeEffectTypes.map(h=>h.GetIndex()),forcePreDraw:!c||b.MustPreDraw(),is3D:d,isSourceTextureRotated:f,isRotatedOrNegativeSizeInstance:a}),
this._needsRebuildSteps=!1,this._wasDefaultColor=c,this._was3D=d,this._wasRotatedOrNegativeSize=a,this._wasTexRotated=f}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(b){return this._effectParams[b]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(b=>b.GetShaderProgram().BlendsBackground())}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:e.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()]=e.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}
{"use strict";const e=self.C3,b=[],a=[],c=[],d=e.New(e.CollisionPoly),f=e.New(e.CollisionPoly),h=e.New(e.Quad),g=e.New(e.Rect),l=e.New(e.Rect);let m=null,u=null,v=null;e.CollisionEngine=class extends e.DefendedBase{constructor(t){super();this._runtime=t;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(t,q){const p=t.GetWorldInfo(),r=q.GetWorldInfo();p&&r&&p.IsCollisionEnabled()&&r.IsCollisionEnabled()&&this._registeredCollisions.push([t,q])}AddRegisteredCollisionCandidates(t,q,p){for(const [r,x]of this._registeredCollisions){let y;if(t===r)y=x;else if(t===x)y=r;else continue;y.BelongsToObjectClass(q)&&(p.includes(y)||p.push(y))}}CheckRegisteredCollision(t,
q){if(!this._registeredCollisions.length)return!1;for(const [p,r]of this._registeredCollisions)if(t===p&&q===r||t===r&&q===p)return!0;return!1}ClearRegisteredCollisions(){e.clearArray(this._registeredCollisions)}TestOverlap(t,q){if(!t||!q||t===q)return!1;t=t.GetWorldInfo();q=q.GetWorldInfo();if(!t.IsCollisionEnabled()||!q.IsCollisionEnabled())return!1;this._collisionCheckCount++;const p=t.GetLayer(),r=q.GetLayer();return p.IsTransformCompatibleWith(r)?this._TestOverlap_SameLayers(t,q):this._TestOverlap_DifferentLayers(t,
q)}_TestOverlap_SameLayers(t,q){if(!t.GetBoundingBox().intersectsRect(q.GetBoundingBox()))return!1;this._polyCheckCount++;if(!t.GetBoundingQuad().intersectsQuad(q.GetBoundingQuad())||t.HasTilemap()&&q.HasTilemap())return!1;if(t.HasTilemap())return this.TestTilemapOverlap(t,q);if(q.HasTilemap())return this.TestTilemapOverlap(q,t);if(!t.HasOwnCollisionPoly()&&!q.HasOwnCollisionPoly())return!0;const p=t.GetTransformedCollisionPoly(),r=q.GetTransformedCollisionPoly();return p.intersectsPoly(r,q.GetX()-
t.GetX(),q.GetY()-t.GetY())}_TestOverlap_DifferentLayers(t,q){var p=t.HasTilemap(),r=q.HasTilemap();if(p&&!r)return this.TestTilemapOverlapDifferentLayers(t,q);if(r&&!p)return this.TestTilemapOverlapDifferentLayers(q,t);if(r||p)return!1;r=t.GetLayer();p=q.GetLayer();d.copy(t.GetTransformedCollisionPoly());f.copy(q.GetTransformedCollisionPoly());var x=d.pointsArr();for(let y=0,C=x.length;y<C;y+=2){const G=y+1,A=x[G],[E,J]=r.LayerToCanvasCss(x[y]+t.GetX(),A+t.GetY());x[y]=E;x[G]=J}t=f.pointsArr();for(let y=
0,C=t.length;y<C;y+=2){r=y+1;x=t[r];const [G,A]=p.LayerToCanvasCss(t[y]+q.GetX(),x+q.GetY());t[y]=G;t[r]=A}d.setBboxChanged();f.setBboxChanged();this._polyCheckCount++;return d.intersectsPoly(f,0,0)}TestTilemapOverlapDifferentLayers(t,q){var p=t.GetLayer(),r=q.GetLayer();m||(m=e.New(e.CollisionPoly));u||(u=e.New(e.Rect));v||(v=e.New(e.Quad));var x=q.GetX(),y=q.GetY();const [C,G]=r.LayerToCanvasCss(x,y),[A,E]=p.CanvasCssToLayer(C,G);p=A-x;y=E-y;u.copy(q.GetBoundingBox());u.offset(p,y);if(!t.GetBoundingBox().intersectsRect(u))return!1;
v.copy(q.GetBoundingQuad());v.offset(p,y);this._polyCheckCount++;if(!t.GetBoundingQuad().intersectsQuad(v))return!1;m.copy(q.GetTransformedCollisionPoly());r=m.pointsArr();for(let J=0,B=r.length;J<B;J+=2)x=J+1,r[J]+=p,r[x]+=y;m.setBboxChanged();return this.TestTilemapOverlap(t,q,A,E,m,u,v)}TestTilemapOverlap(t,q,p,r,x,y,C){y=void 0!==y?y:q.GetBoundingBox();const G=t.GetX(),A=t.GetY();var E=t.GetInstance().GetSdkInstance();p=void 0!==p?p:q.GetX();r=void 0!==r?r:q.GetY();t=q.HasOwnCollisionPoly();C=
void 0!==C?C:q.GetBoundingQuad();E.GetCollisionRectCandidates(y,a);for(let I=0,L=a.length;I<L;++I){var J=a[I];E=J.GetRect();this._collisionCheckCount++;if(y.intersectsRectOffset(E,G,A)&&(h.setFromRect(E),h.offset(G,A),h.intersectsQuad(C)))if(t){var B=void 0!==x?x:q.GetTransformedCollisionPoly();if(J=J.GetPoly()){if(this._polyCheckCount++,J.intersectsPoly(B,p-(G+E.getLeft()),r-(A+E.getTop())))return e.clearArray(a),!0}else if(d.setFromQuad(h,0,0),d.intersectsPoly(B,p,r))return e.clearArray(a),!0}else if(B=
J.GetPoly()){if(d.setFromQuad(C,0,0),B.intersectsPoly(d,-(G+E.getLeft()),-(A+E.getTop())))return e.clearArray(a),!0}else return e.clearArray(a),!0}e.clearArray(a);return!1}TestAndSelectCanvasPointOverlap(t,q,p,r){const x=t.GetCurrentSol();var y=this._runtime.GetCurrentEvent();if(!y)throw Error("cannot call outside event");y=y.IsOrBlock();if(x.IsSelectAll()){r||(x._SetSelectAll(!1),e.clearArray(x._GetOwnInstances()));for(var C of t.GetInstances()){var G=C.GetWorldInfo(),A=G.GetLayer();const [E,J]=
A.CanvasCssToLayer(q,p,G.GetTotalZElevation());if(G.ContainsPoint(E,J)){if(r)return!1;x._PushInstance(C)}else y&&x._PushElseInstance(C)}}else{G=!1;y?this._runtime.IsCurrentConditionFirst()&&!x._GetOwnElseInstances().length&&x._GetOwnInstances().length?C=x._GetOwnInstances():(C=x._GetOwnElseInstances(),G=!0):C=x._GetOwnInstances();A=0;for(let E=0,J=C.length;E<J;++E){const B=C[E],I=B.GetWorldInfo(),L=I.GetLayer(),[P,S]=L.CanvasCssToLayer(q,p,I.GetTotalZElevation());if(I.ContainsPoint(P,S)){if(r)return!1;
G?x._PushInstance(B):C[A++]=B}else G?C[A++]=B:y&&x._PushElseInstance(B)}r||(C.length=A)}t.ApplySolToContainer();return r?!0:x.HasAnyInstances()}GetCollisionCandidates(t,q,p,r){t=t?1!==t.GetParallaxX()||1!==t.GetParallaxY():!1;if(q.IsFamily())for(const x of q.GetFamilyMembers())t||x.IsAnyInstanceParallaxed()?e.appendArray(r,x.GetInstances()):(x._UpdateAllCollisionCells(),x._GetCollisionCellGrid().QueryRange(p,r));else t||q.IsAnyInstanceParallaxed()?e.appendArray(r,q.GetInstances()):(q._UpdateAllCollisionCells(),
q._GetCollisionCellGrid().QueryRange(p,r))}GetObjectClassesCollisionCandidates(t,q,p,r){for(const x of q)this.GetCollisionCandidates(t,x,p,r)}GetSolidCollisionCandidates(t,q,p){const r=this._runtime.GetSolidBehavior();r&&this.GetObjectClassesCollisionCandidates(t,r.GetObjectClasses(),q,p)}GetJumpthruCollisionCandidates(t,q,p){const r=this._runtime.GetJumpthruBehavior();r&&this.GetObjectClassesCollisionCandidates(t,r.GetObjectClasses(),q,p)}IsSolidCollisionAllowed(t,q){return t._IsSolidEnabled()&&
(!q||q.GetWorldInfo().IsSolidCollisionAllowed(t.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(t){const q=t.GetWorldInfo();this.GetSolidCollisionCandidates(q.GetLayer(),q.GetBoundingBox(),b);for(const p of b)if(this.IsSolidCollisionAllowed(p,t)&&this.TestOverlap(t,p))return e.clearArray(b),p;e.clearArray(b);return null}TestRectOverlapSolid(t,q){this.GetSolidCollisionCandidates(null,t,b);for(const p of b)if(this.IsSolidCollisionAllowed(p,q)&&this.TestRectOverlap(t,p))return e.clearArray(b),
p;e.clearArray(b);return null}TestOverlapJumpthru(t,q){let p=null;q&&(p=c,e.clearArray(p));const r=t.GetWorldInfo();this.GetJumpthruCollisionCandidates(r.GetLayer(),r.GetBoundingBox(),b);for(const x of b)if(x._IsJumpthruEnabled()&&this.TestOverlap(t,x))if(q)p.push(x);else return e.clearArray(b),x;e.clearArray(b);return p}PushOut(t,q,p,r,x){r=r||50;const y=t.GetWorldInfo(),C=y.GetX(),G=y.GetY();for(let A=0;A<r;++A)if(y.SetXY(C+q*A,G+p*A),y.SetBboxChanged(),!this.TestOverlap(t,x))return!0;y.SetXY(C,
G);y.SetBboxChanged();return!1}PushOutSolid(t,q,p,r,x,y){r=r||50;const C=t.GetWorldInfo(),G=C.GetX(),A=C.GetY();let E=null,J=null;for(let B=0;B<r;++B)if(C.SetXY(G+q*B,A+p*B),C.SetBboxChanged(),!this.TestOverlap(t,E))if(E=this.TestOverlapSolid(t))J=E;else if(x&&(E=y?this.TestOverlap(t,y)?y:null:this.TestOverlapJumpthru(t))&&(J=E),!E)return J&&this.PushInFractional(t,q,p,J,16,!0),!0;C.SetXY(G,A);C.SetBboxChanged();return!1}PushOutSolidAxis(t,q,p,r){r=r||50;const x=t.GetWorldInfo(),y=x.GetX(),C=x.GetY();
let G=null,A=null;for(let E=0;E<r;++E)for(let J=0;2>J;++J){const B=2*J-1;x.SetXY(y+q*E*B,C+p*E*B);x.SetBboxChanged();if(!this.TestOverlap(t,G))if(G=this.TestOverlapSolid(t))A=G;else return A&&this.PushInFractional(t,q*B,p*B,A,16,!0),!0}x.SetXY(y,C);x.SetBboxChanged();return!1}PushInFractional(t,q,p,r,x,y){let C=2,G=!1;var A=!1;const E=t.GetWorldInfo();let J=E.GetX(),B=E.GetY();for(;C<=x;)A=1/C,C*=2,E.OffsetXY(q*A*(G?1:-1),p*A*(G?1:-1)),E.SetBboxChanged(),this.TestOverlap(t,r)||y&&this.TestOverlapSolid(t)?
A=G=!0:(A=G=!1,J=E.GetX(),B=E.GetY());A&&(E.SetXY(J,B),E.SetBboxChanged())}PushOutSolidNearest(t,q=100){let p=0;const r=t.GetWorldInfo(),x=r.GetX(),y=r.GetY();let C=0,G=this.TestOverlapSolid(t);if(!G)return!0;for(;p<=q;){let A=0,E=0;switch(C){case 0:A=0;E=-1;p++;break;case 1:A=1;E=-1;break;case 2:A=1;E=0;break;case 3:E=A=1;break;case 4:A=0;E=1;break;case 5:A=-1;E=1;break;case 6:A=-1;E=0;break;case 7:E=A=-1}C=(C+1)%8;r.SetXY(Math.floor(x+A*p),Math.floor(y+E*p));r.SetBboxChanged();if(!this.TestOverlap(t,
G)&&(G=this.TestOverlapSolid(t),!G))return!0}r.SetXY(x,y);r.SetBboxChanged();return!1}CalculateBounceAngle(t,q,p,r){const x=t.GetWorldInfo(),y=x.GetX(),C=x.GetY(),G=Math.max(10,e.distanceTo(q,p,y,C));var A=e.angleTo(q,p,y,C),E=r||this.TestOverlapSolid(t);if(!E)return e.clampAngle(A+Math.PI);let J=E;var B=0,I=0;const L=e.toRadians(5);let P;for(P=1;36>P;++P){const S=A-P*L;x.SetXY(q+Math.cos(S)*G,p+Math.sin(S)*G);x.SetBboxChanged();if(!this.TestOverlap(t,J)&&(J=r?null:this.TestOverlapSolid(t),!J)){B=
S;break}}36===P&&(B=e.clampAngle(A+Math.PI));J=E;for(P=1;36>P;++P)if(E=A+P*L,x.SetXY(q+Math.cos(E)*G,p+Math.sin(E)*G),x.SetBboxChanged(),!this.TestOverlap(t,J)&&(J=r?null:this.TestOverlapSolid(t),!J)){I=E;break}36===P&&(I=e.clampAngle(A+Math.PI));x.SetXY(y,C);x.SetBboxChanged();if(I===B)return I;t=e.angleDiff(I,B)/2;t=e.angleClockwise(I,B)?e.clampAngle(B+t+Math.PI):e.clampAngle(I+t);B=Math.cos(A);A=Math.sin(A);I=Math.cos(t);t=Math.sin(t);q=B*I+A*t;return e.angleTo(0,0,B-2*q*I,A-2*q*t)}TestSegmentOverlap(t,
q,p,r,x){if(!x)return!1;const y=x.GetWorldInfo();if(!y.IsCollisionEnabled())return!1;this._collisionCheckCount++;g.set(Math.min(t,p),Math.min(q,r),Math.max(t,p),Math.max(q,r));if(!y.GetBoundingBox().intersectsRect(g))return!1;if(x.HasTilemap())return this._TestSegmentOverlapTilemap(t,q,p,r,x,y);this._polyCheckCount++;return y.GetBoundingQuad().intersectsSegment(t,q,p,r)?y.HasOwnCollisionPoly()?y.GetTransformedCollisionPoly().intersectsSegment(y.GetX(),y.GetY(),t,q,p,r):!0:!1}_TestSegmentOverlapTilemap(t,
q,p,r,x,y){const C=y.GetX();y=y.GetY();x=x.GetSdkInstance();l.set(t,q,p,r);l.normalize();x.GetCollisionRectCandidates(l,a);for(let A=0,E=a.length;A<E;++A){var G=a[A];x=G.GetRect();this._collisionCheckCount++;if(g.intersectsRectOffset(x,C,y)&&(h.setFromRect(x),h.offset(C,y),h.intersectsSegment(t,q,p,r)))if(G=G.GetPoly()){if(this._polyCheckCount++,G.intersectsSegment(C+x.getLeft(),y+x.getTop(),t,q,p,r))return e.clearArray(a),!0}else return e.clearArray(a),!0}e.clearArray(a);return!1}TestRectOverlap(t,
q){if(!q)return!1;const p=q.GetWorldInfo();if(!p.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!p.GetBoundingBox().intersectsRect(t))return!1;if(q.HasTilemap())return this._TestRectOverlapTilemap(t,q,p);this._polyCheckCount++;h.setFromRect(t);if(!p.GetBoundingQuad().intersectsQuad(h))return!1;if(!p.HasOwnCollisionPoly())return!0;d.setFromRect(t,p.GetX(),p.GetY());t=p.GetTransformedCollisionPoly();return d.intersectsPoly(t,0,0)}_TestRectOverlapTilemap(t,q,p){const r=p.GetX();p=p.GetY();
q.GetSdkInstance().GetCollisionRectCandidates(t,a);for(let y=0,C=a.length;y<C;++y){var x=a[y];q=x.GetRect();this._collisionCheckCount++;if(t.intersectsRectOffset(q,r,p))if(x=x.GetPoly()){if(this._polyCheckCount++,d.setFromRect(t,0,0),x.intersectsPoly(d,-(r+q.getLeft()),-(p+q.getTop())))return e.clearArray(a),!0}else return e.clearArray(a),!0}e.clearArray(a);return!1}TestRayIntersectsInstance(t,q){if(t){var p=t.GetWorldInfo();p.IsCollisionEnabled()&&(this._collisionCheckCount++,p.GetBoundingBox().intersectsRect(q.rect)&&
(t.HasTilemap()?this._TestRayIntersectsTilemap(t,p,q):(this._polyCheckCount++,p.HasOwnCollisionPoly()?q.TestInstancePoly(t,p.GetX(),p.GetY(),p.GetTransformedCollisionPoly()):q.TestInstanceQuad(t,p.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(t,q,p){const r=q.GetX(),x=q.GetY();t.GetSdkInstance().GetCollisionRectCandidates(p.rect,a);for(let C=0,G=a.length;C<G;C++){var y=a[C];const A=y.GetRect();this._collisionCheckCount++;p.rect.intersectsRectOffset(A,r,x)&&(y=y.GetPoly(),this._polyCheckCount++,
y?p.TestInstancePoly(t,r+A.getLeft(),x+A.getTop(),y):p.TestInstanceRect(t,q.GetX(),q.GetY(),A))}e.clearArray(a)}}}
{"use strict";const e=self.C3;e.SparseGrid=class extends e.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=e.New(e.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,c){let d=this._cells.Get(b,a);return d?d:c?(d=e.New(e.GridCell,this,b,a),this._cells.Set(b,a,d),d):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,c){if(a)for(let d=a.getLeft(),
f=a.getRight();d<=f;++d)for(let h=a.getTop(),g=a.getBottom();h<=g;++h){if(c&&c.containsPoint(d,h))continue;const l=this.GetCell(d,h,!1);l&&(l.Remove(b),l.IsEmpty()&&this._cells.Delete(d,h))}if(c)for(let d=c.getLeft(),f=c.getRight();d<=f;++d)for(let h=c.getTop(),g=c.getBottom();h<=g;++h)a&&a.containsPoint(d,h)||this.GetCell(d,h,!0).Insert(b)}QueryRange(b,a){let c=this.XToCell(b.getLeft());const d=this.YToCell(b.getTop()),f=this.XToCell(b.getRight());b=this.YToCell(b.getBottom());if(isFinite(f)&&isFinite(b))for(;c<=
f;++c)for(let h=d;h<=b;++h){const g=this.GetCell(c,h,!1);g&&g.Dump(a)}}}}{"use strict";const e=self.C3;e.GridCell=class extends e.DefendedBase{constructor(b,a,c){super();this._grid=b;this._x=a;this._y=c;this._instances=e.New(e.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){e.appendArray(b,this._instances.GetArray())}}}
{"use strict";const e=self.C3;e.Ray=class{constructor(){this.dy=this.dx=this.y2=this.x2=this.y1=this.x1=0;this.rect=new e.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,c,d){this.x1=b;this.y1=a;this.x2=c;this.y2=d;this.dx=c-b;this.dy=d-a;this.rect.set(b,a,c,d);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,c=Math.sqrt(b*b+a*a);b/=c;a/=c;this.distance=c-1E-6;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);c=b*this.normalX+a*this.normalY;this.reflectionX=b-2*this.normalX*c;this.reflectionY=a-2*this.normalY*c;0<c&&(this.hitNormal=e.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(b,a,c,d,f){const h=e.rayIntersect(this.x1,this.y1,this.x2,this.y2,a,c,d,f);0<=h&&h<this.hitFraction&&(this.hitFraction=h,this.hitUid=b.GetUID(),this.hitNormalDx=a-d,this.hitNormalDy=c-f)}TestInstanceRect(b,a,c,d){const f=a+d.getLeft();
a+=d.getRight();const h=c+d.getTop();c+=d.getBottom();this.TestInstanceSegment(b,f,h,a,h);this.TestInstanceSegment(b,a,h,a,c);this.TestInstanceSegment(b,a,c,f,c);this.TestInstanceSegment(b,f,c,f,h)}TestInstanceQuad(b,a){const c=a.getTlx(),d=a.getTly(),f=a.getTrx(),h=a.getTry(),g=a.getBrx(),l=a.getBry(),m=a.getBlx();a=a.getBly();this.TestInstanceSegment(b,c,d,f,h);this.TestInstanceSegment(b,f,h,g,l);this.TestInstanceSegment(b,g,l,m,a);this.TestInstanceSegment(b,m,a,c,d)}TestInstancePoly(b,a,c,d){d=
d.pointsArr();for(let f=0,h=d.length;f<h;f+=2){const g=(f+2)%h;this.TestInstanceSegment(b,d[f]+a,d[f+1]+c,d[g]+a,d[g+1]+c)}}}}
{"use strict";const e=self.C3,b=new Set("off crop scale-inner scale-outer letterbox-scale letterbox-integer-scale".split(" ")),a=new Set(["high","low"]),c=self.glMatrix.mat4,d=c.create(),f=e.New(e.Quad),h=e.New(e.Rect);e.CanvasManager=class extends e.DefendedBase{constructor(g){super();this._runtime=g;this._canvas=null;this._isWebGPUEnabled=!1;this._webgpuRenderer=this._webglRenderer=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=this._textureAnisotropy=0;this._documentFullscreenMode=this._fullscreenMode="letterbox-scale";this._deviceTransformOffY=this._deviceTransformOffX=0;this._defaultProjectionMatrix=c.create();this._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=!1;this._availableAdditionalRenderTargets=
[];this._usedAdditionalRenderTargets=new Set;this._shaderData=self.C3_Shaders;this._effectChainManager=e.New(e.Gfx.EffectChainManager,{getDrawSize:()=>[this.GetDrawWidth(),this.GetDrawHeight()],getRenderTarget:()=>this.GetEffectCompositorRenderTarget(),releaseRenderTarget:l=>this.ReleaseEffectCompositorRenderTarget(l),getTime:()=>this.GetRuntime().GetGameTime(),redraw:()=>this.GetRuntime().UpdateRender()});this._gpuTimeEndFrame=this._gpuTimeStartFrame=0;this._gpuLastUtilisation=NaN;this._gpuFrameTimingsBuffer=
null;this._layersGpuProfile=new Map;this._gpuCurUtilisation=NaN;this._webgpuFrameTimings=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=e.New(e.Rect);this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=this._isPastingToDrawingCanvas=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=l=>this._loadingProgress=l.progress;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(l=>this._splashDoneResolve=l)}_SetGPUPowerPreference(g){this._gpuPreference=g}_SetWebGPUEnabled(g){this._isWebGPUEnabled=!!g}async CreateCanvas(g){this._canvas=g.canvas;this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",u=>this._OnWindowResize(u));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",u=>this._OnFullscreenChange(u));
this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",u=>this._OnFullscreenError(u));this._canvas.addEventListener("webglcontextlost",u=>this._OnWebGLContextLost(u));this._canvas.addEventListener("webglcontextrestored",u=>this._OnWebGLContextRestored(u));this._isDocumentFullscreen=!!g.isFullscreen;var l=navigator.gpu&&this._isWebGPUEnabled;let m=!1;if(l)try{await this._InitWebGPUContext(!0)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!0)}catch(u){this._webglRenderer=
null}this.GetRenderer()||(m=!0);if(!this.GetRenderer()&&l)try{await this._InitWebGPUContext(!1)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!1)}catch(u){this._webglRenderer=null}l=this.GetRenderer();if(!l)throw Error("failed to acquire a renderer - check WebGL or WebGPU is supported");l.SetHasMajorPerformanceCaveat(m);this.SetSize(g.windowInnerWidth,g.windowInnerHeight,!0);this._webgpuRenderer?await this._InitWebGPU():this._webglRenderer&&await this._InitWebGL();
l.SetMipmapsEnabled(this._enableMipmaps);l.SupportsGPUProfiling()&&(this._gpuLastUtilisation=0);for(const u of this._runtime._GetAllEffectLists()){for(const v of u.GetAllEffectTypes())v._InitRenderer(l);u.UpdateActiveEffects()}}async _InitWebGPUContext(g){g={powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat:g,canSampleBackbuffer:this._runtime.UsesAnyBackgroundBlending(),canSampleDepth:this._runtime.UsesAnyDepthSampling()};this._webgpuRenderer=e.New(e.Gfx.WebGPURenderer);
await this._webgpuRenderer.Create(this._canvas,g)}async _InitWebGLContext(g){g={powerPreference:this._gpuPreference,enableGpuProfiling:!0,depth:this._runtime.Uses3DFeatures(),canSampleDepth:this._runtime.UsesAnyDepthSampling(),failIfMajorPerformanceCaveat:g};"Android"===e.Platform.OS&&"Chromium"===e.Platform.BrowserEngine&&75>e.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=e.New(e.Gfx.WebGLRenderer,this._canvas,g);await this._webglRenderer.InitState()}async _InitWebGPU(){if(this._shaderData){const g=[];for(const [l,m]of Object.entries(this._shaderData)){m.src=m.wgsl;const u=e.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();g.push(this._webgpuRenderer.CreateShaderProgram(m,u,l))}await Promise.all(g)}}async _InitWebGL(){if(this._shaderData){const g=
[];for(const [l,m]of Object.entries(this._shaderData)){m.src=m.glsl;const u=e.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource();g.push(this._webglRenderer.CreateShaderProgram(m,u,l))}await Promise.all(g);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=e.New(e.Gfx.WebGLQueryResultBuffer,this._webglRenderer))}Release(){this._canvas=this._webglRenderer=this._runtime=null}_OnWindowResize(g){const l=
this._runtime,m=g.devicePixelRatio;l.IsInWorker()&&(self.devicePixelRatio=m);l._SetDevicePixelRatio(m);this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight);l.UpdateRender();l.IsDebug()&&(l.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused())&&l.Render()}_OnFullscreenChange(g){this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight,!0);this._runtime.UpdateRender()}_OnFullscreenError(g){this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,
g.innerHeight,!0);this._runtime.UpdateRender()}SetSize(g,l,m=!1){g=Math.floor(g);l=Math.floor(l);if(0>=g||0>=l)throw Error("invalid size");if(this._windowInnerWidth!==g||this._windowInnerHeight!==l||m){this._windowInnerWidth=g;this._windowInnerHeight=l;m=this.GetCurrentFullscreenMode();"letterbox-scale"===m?this._CalculateLetterboxScale(g,l):"letterbox-integer-scale"===m?this._CalculateLetterboxIntegerScale(g,l):"off"===m?this._CalculateFixedSizeCanvas(g,l):this._CalculateFullsizeCanvas(g,l);this._UpdateFullscreenScalingQuality(m);
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});g=this.GetRenderer();g.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0);for(var u of this._availableAdditionalRenderTargets)g.DeleteRenderTarget(u);e.clearArray(this._availableAdditionalRenderTargets);g.CalculatePerspectiveMatrix(this._defaultProjectionMatrix,
this.GetDrawWidth()/this.GetDrawHeight());u=this._runtime.GetLayoutManager();u.SetAllLayerProjectionChanged();u.SetAllLayerMVChanged()}}GetDefaultProjectionMatrix(){return this._defaultProjectionMatrix}_CalculateLetterboxScale(g,l){const m=this._runtime.GetDevicePixelRatio(),u=this._runtime.GetOriginalViewportWidth(),v=this._runtime.GetOriginalViewportHeight(),t=u/v;g/l>t?(this._canvasCssWidth=Math.round(l*t),this._canvasCssHeight=l,this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY=
0):(this._canvasCssWidth=g,this._canvasCssHeight=Math.round(g/t),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((l-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._runtime.SetViewportSize(u,v)}_CalculateLetterboxIntegerScale(g,l){const m=this._runtime.GetDevicePixelRatio();1!==m&&(g+=1,l+=1);const u=this._runtime.GetOriginalViewportWidth(),v=this._runtime.GetOriginalViewportHeight();
var t=u/v;t=g/l>t?l*t*m/u:g/t*m/v;1<t?t=Math.floor(t):1>t&&(t=1/Math.ceil(1/t));this._canvasDeviceWidth=Math.round(u*t);this._canvasDeviceHeight=Math.round(v*t);this._canvasCssWidth=this._canvasDeviceWidth/m;this._canvasCssHeight=this._canvasDeviceHeight/m;this._canvasCssOffsetX=Math.max(Math.floor((g-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((l-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(u,v)}_CalculateFullsizeCanvas(g,l){const m=this._runtime.GetDevicePixelRatio();
this._canvasCssWidth=g;this._canvasCssHeight=l;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._canvasCssOffsetY=this._canvasCssOffsetX=0;g=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/g,this._canvasCssHeight/g)}_CalculateFixedSizeCanvas(g,l){const m=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();
this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this.IsDocumentFullscreen()?(this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY=Math.floor((l-this._canvasCssHeight)/2)):this._canvasCssOffsetY=this._canvasCssOffsetX=0;this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(g){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=
this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let m;if("off"===this.GetCurrentFullscreenMode()){var l=this._runtime.GetViewportWidth();m=this._runtime.GetViewportHeight()}else l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<l&&this._canvasDeviceHeight<m?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"):
(this._drawWidth=l,this._drawHeight=m,this._fullscreenScalingQuality="low","scale-inner"===g?(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l<g?this._drawWidth=this._drawHeight*l:l>g&&(this._drawHeight=this._drawWidth/l)):"scale-outer"===g&&(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l>g?this._drawWidth=this._drawHeight*l:l<g&&(this._drawHeight=this._drawWidth/l)))}}GetRuntime(){return this._runtime}GetEffectChainManager(){return this._effectChainManager}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(g){if(!b.has(g))throw Error("invalid fullscreen mode");
this._fullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(g){if(!b.has(g))throw Error("invalid fullscreen mode");this._documentFullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?this.GetDocumentFullscreenMode():
this.GetFullscreenMode()}SetFullscreenScalingQuality(g){if(!a.has(g))throw Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=g;this._runtime.GetLayoutManager().SetAllLayerProjectionChanged()}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(g){switch(g){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(g){this._enableMipmaps=!!g}_SetTextureAnisotropy(g){this._textureAnisotropy=g}GetTextureAnisotropy(){return this._textureAnisotropy}IsRendererContextLost(){return this.GetRenderer().IsContextLost()}_OnWebGLContextLost(g){console.log("[Construct 3] WebGL context lost");
g.preventDefault();this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets.clear();this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(g){await this._webglRenderer.OnContextRestored();await this._LoadWebGLShaderPrograms();for(const l of this._runtime._GetAllEffectLists())for(const m of l.GetAllEffectTypes())m._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored();console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetWebGPURenderer(){return this._webgpuRenderer}GetRenderer(){return this._webgpuRenderer||
this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const g=this.GetCurrentFullscreenMode();if("off"===g||"crop"===g)return 1;const l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight(),u=l/m,v=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==g&&v>u||"scale-inner"===g&&v<u?this._canvasCssHeight/m:this._canvasCssWidth/l}GetEffectLayerScaleParam(){return"low"===
this.GetCurrentFullscreenScalingQuality()?1:this.GetDisplayScale()}GetEffectDevicePixelRatioParam(){return"low"===this.GetCurrentFullscreenScalingQuality()?1:this._runtime.GetDevicePixelRatio()}SetDeviceTransformOffset(g,l){this._deviceTransformOffX=g;this._deviceTransformOffY=l}SetDeviceTransform(g,l,m,u=!0){l=l||this._drawWidth;m=m||this._drawHeight;const v=l/2+this._deviceTransformOffX,t=m/2+this._deviceTransformOffY;if(u){u=this.GetDefaultProjectionMatrix();if(l!==this._drawWidth||m!==this._drawHeight)g.CalculatePerspectiveMatrix(d,
l/m),u=d;g.SetProjectionMatrix(u)}l=g.CalculateLookAtModelView2(v,t,g.GetDefaultCameraZ()*this._runtime.GetDevicePixelRatio(),v,t,0,m||this._drawHeight);g.SetModelViewMatrix(l)}SetCssTransform(g,l=!0){const m=this._canvasCssWidth/2,u=this._canvasCssHeight/2;l&&g.SetProjectionMatrix(this.GetDefaultProjectionMatrix());l=g.CalculateLookAtModelView2(m,u,g.GetDefaultCameraZ(),m,u,0);g.SetModelViewMatrix(l)}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(g){g.depth=
this._runtime.Uses3DFeatures();const l=this._availableAdditionalRenderTargets,m=l.findIndex(v=>v.IsCompatibleWithOptions(g));let u;-1!==m?(u=l[m],l.splice(m,1)):u=this.GetRenderer().CreateRenderTarget(g);this._usedAdditionalRenderTargets.add(u);return u}ReleaseAdditionalRenderTarget(g){if(!this._usedAdditionalRenderTargets.has(g))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(g);this._availableAdditionalRenderTargets.push(g)}GetEffectCompositorRenderTarget(){const g=
{sampling:this._runtime.GetSampling()};"low"===this.GetCurrentFullscreenScalingQuality()&&(g.width=this.GetDrawWidth(),g.height=this.GetDrawHeight());return this.GetAdditionalRenderTarget(g)}ReleaseEffectCompositorRenderTarget(g){this.ReleaseAdditionalRenderTarget(g)}*activeLayersGpuProfiles(){for(const g of this._runtime.GetLayoutManager().runningLayouts())for(const l of g.GetLayers()){const m=this._layersGpuProfile.get(l);m&&(yield m)}}GetLayerTimingsBuffer(g){if(!this.GetRenderer().SupportsGPUProfiling())return null;
let l=this._layersGpuProfile.get(g);l||(l={name:g.GetName(),timingsBuffer:e.New(e.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(g,l));return l.timingsBuffer}_Update1sFrameRange(){const g=this.GetRenderer();if(g.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=g.GetFrameNumber();this._gpuCurUtilisation=NaN;for(const l of this.activeLayersGpuProfiles())l.curUtilisation=NaN}}_UpdateTick(){this._webglRenderer&&this._webglRenderer.SupportsGPUProfiling()&&
this._UpdateTick_WebGL();this._webgpuRenderer&&this._webgpuRenderer.SupportsGPUProfiling()&&this._UpdateTick_WebGPU()}_UpdateTick_WebGL(){if(isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const g of this.activeLayersGpuProfiles())if(g.curUtilisation=g.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),
isNaN(g.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const g of this.activeLayersGpuProfiles())g.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),g.lastUtilisation=Math.min(g.curUtilisation,1);self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=
0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}_UpdateTick_WebGPU(){if(0!==this._gpuTimeEndFrame){for(var g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g){var l=this._webgpuFrameTimings.get(g);if(l&&!l.HasResult())return}l=this._runtime.GetMainRunningLayout();g=e.MakeFilledArray(l.GetLayerCount()+1,0);for(var m=this._gpuTimeStartFrame;m<this._gpuTimeEndFrame;++m){var u=this._webgpuFrameTimings.get(m);if(u){u=u.GetResult();for(let v=0,t=Math.min(g.length,u.length/2);v<t;++v){const q=
u[2*v],p=u[2*v+1];g[v]=0===Number(q)||0===Number(p)?NaN:g[v]+Number(p-q)/1E9}}}this._gpuLastUtilisation=e.clamp(g[0],0,1);if(this._runtime.IsDebug()){m=[];l=l.GetLayers();for(let v=0,t=Math.min(l.length,g.length-1);v<t;++v)m.push({name:l[v].GetName(),lastUtilisation:e.clamp(g[v+1],0,1)});self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,m)}for(g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g)this._webgpuFrameTimings.delete(g);this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=
0}}_AddWebGPUFrameTiming(g){this._webgpuFrameTimings.set(this._webgpuRenderer.GetFrameNumber(),g)}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(g,l,m,u,v,t){this._snapshotFormat=g;this._snapshotQuality=l;this._snapshotArea.setWH(m,u,v,t);return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(q=>{this._snapshotResolve=q})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var g=this._canvas,l=this._snapshotArea,m=e.clamp(Math.floor(l.getLeft()),0,g.width),
u=e.clamp(Math.floor(l.getTop()),0,g.height),v=l.width();v=0===v?g.width-m:e.clamp(Math.floor(v),0,g.width-m);l=l.height();l=0===l?g.height-u:e.clamp(Math.floor(l),0,g.height-u);(0!==m||0!==u||v!==g.width||l!==g.height)&&0<v&&0<l&&(g=e.CreateCanvas(v,l),g.getContext("2d").drawImage(this._canvas,m,u,v,l,0,0,v,l));e.CanvasToBlob(g,this._snapshotFormat,this._snapshotQuality).then(t=>{this._snapshotUrl=URL.createObjectURL(t);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat=
"";this._snapshotQuality=1}}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(g){g?this._isPastingToDrawingCanvas++:this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return 0<this._isPastingToDrawingCanvas}InitLoadingScreen(g){this._webglRenderer&&(2===g?(this._percentText=e.New(e.Gfx.RendererText,this.GetRenderer()),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)):0===g?(g=this._runtime.GetLoadingLogoAsset())&&g.LoadStaticTexture(this._webglRenderer).catch(l=>console.warn("[C3 runtime] Failed to create texture for loading logo: ",l)):4===g&&(this._LoadSvgSplashImage("data:image/svg+xml;base64, ").then(l=>
{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.logo=l}).catch(l=>console.warn("Failed to load splash image: ",l)),this._LoadBitmapSplashImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABABAMAAACekdKMAAAAMFBMVEUAAAByfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYYgo7vbAAAAD3RSTlMAESIzRFVmd4iZqrvM3e5GKvWZAAAFX0lEQVR42u2asW7bVhSGP0qWpUi2oM3tUFhbgAJJtBUdWvsNrLlD1AcoILZBlgaNXKBAR/sN5Ewd6fYF5HbJKAdB0FFKu5d1ZEeSJfPvcC8pyrWTDi5MgPwXCRQp6H4895z/HAoyZcqUKVOmTJkyJU8D7dt3d6QMQIK1LqPzRykHIL1KOwA9SzuAeS2dAC4A+MSXDtIMgJL0NtUA2IvepRTAutRINYCi5KYaQE7mN294Ch5ff4HzRPoprBfOU70B2Ojp/Gt7bKOnqXsJQKGj4FHSAWAAfBi5onWdA9Ay5SEvbYPTlaQpQFfHLek0umY/DCQpaC4ByPcl6RdomyvB13ESARzAim9MwQEUFdjs+NqsLAA+Mx//BnT1StIp5AfGR9QBepKk8RKAHUnSRYOq/cqVG91uN7oFdqwrmkHeZkVfZwBlnUPe8rmoQVd/GQCf22teAOXIV8UARJ+XpKatuY3EAShILjlf+obVnrQLvlwT+lOATb2F+9Jzch1pH7rS3AVyvuYud81pHek5zneXAIzrfCFNydvD65onLwdUpCYV6WdgVTqFrg7N3QpMKjgBT1MgN9Ab6Eq7JjS0D9yT6jh+mB/iAGY1oC1t09cQYEvj5AFoKYAde2vaurBLZk0mbvd0xIr1y/c1ha5NkjvmNedrn6I9obwE4FebHffpmO3UMcUjUQBWpTH07C8rS9ts6gzY0kC7QF8uZQW1KCF27bmeSZJ0NGRNQR3A8eMAtq01eM0DEyB9HSUNwN2+9AInvHE5aZeKJkBHDzUER2qwqQm2JDbo6m8Ax+4EtjRiK6xzVxihjs6oKDDf7iYHQKSgQcFmaXOPipoD/aCsERQUQEujsI67IYBCmNGrGtMyIX4lgC2NWZWaUJRqCQTwEkrRL9vTCXmphqNpQRMoaQIds2YYaDcEUAwXuK4JHZ1cC6CqqQ2ximYJHIiMgXKUEtsaQV9Nijpz/Dms6Qy6ipV5C2BR5zWla7L8lQDWNANPQ1tREwZg9tiUwrA+7+gU9rRLRUM8NdjU69DmLQOoLAM4vhZARTPMHmmHcZIsK0w8Nnd0Ci0N2dQBLbmmI4gBOLwCwAzvfQCqmoJ3o8On/xFAVSPaarKpI/bk/gcA742AkgIcP0y1iQNwKQeUNcZTjbLe0FcdvHj9tgDKcVv7rhywbhuMZsG6iQQCWK4CrOrc8c9hVWNHc2AvXF8MQMl2eLbWv7sKwED7d0KzkDwAqzEfcAyOgoLegqNZwZqi0b8AFOOd3ft8AHQ0rIYnJQ9AbskJQl+f6gTw9IFGl5sYCyAft3WhVbzOCcIDne3E4yhZAKJewBr4jp7qEOjoKw2BdWv14wAY6I/o2Jrd3lf3AkOgoume9c5JBNC2Ga1lDm/JzAQ21dOBCXeTBe+5CwAde03ud67pBl9E3SAUFQwskSQCWDPzgILMNq1KqttS1wScgRl8FfzzBYCPzISMhzrA8c0e8JYAzOtmHlA3vdONPoC4YQB2IuTZG1mSubtF2fKwJU22KfZ0EXWD5CX9AE+kl9C+eiLUMBMhy2aSXADxmaCJhLFteWdhmTD6cxEBtBftZKwzWAC4iM0MoaV4KUkcgNhU2Cx8ZJPjOKxz4YR3AaCwaCfBM51VLwZgZqfCdWsHkjMNuQIAHy/9WyK0fpEByJkFfh+rAuE1k1oUI0GzGwMwNc8FnkVbwk0ygOUnQx1bsR5EDzKcb6WJyxIANjzpx/B9X1OXJQBLT4ZWTDJMr/LJGYnfjkrJGYnfjqoJmobcito6TDeAvr5M9fqLSZqG3IIKXrpzoKTE/DXitgAEjZQDeJnqFNjVczJlypQpU6Yb0D8QEXpo1mjM/QAAAABJRU5ErkJggg==").then(l=>
{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.powered=l}).catch(l=>console.warn("Failed to load splash image: ",l)),this._LoadBitmapSplashImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABABAMAAACekdKMAAAAMFBMVEUAAAByfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYYgo7vbAAAAD3RSTlMAdxHdu4hmVZnuRMwzqiLYE4y2AAAFw0lEQVR42u2Yy+9LQRTHp6Xq0VIkXkFvwkYslAWJiGJj2a6sJJe/oF3YWGElEQmxkYi4ErFWNpatWFmIx9Lm1sJCLKgqraqv82h726l6hOuRzDf53TtnOr+ZOZ+ZOffca5ycnJycnJycnJycnJycnJz+pi7g2G9osxjvzX8qB8ABcAAcgH8XwDa85dspNOiaRDuAR4U0PnHtDuyy7IJRJS6gvVmL6TywVkp4ZxIhulUxFvlaXQTrgEHbnMDH5XRjlXCdb+uAnc2ojWgFFTYBZ8e9tzcaswAk6v/3K4sPfPNRFj87IXj+KXQUS9m2jXoH1lMuLq2DtEcAtNMBT9PjanFq7ySAhbABVEAaeDaAwkk2D7GRqctAMQJIq2sBauLnB/VxCfqKpWrbRhSC1W5SMQ9RTgBUwKpF1ccmAIQ2gCxE+20Au9nSESvDgeIDkJSBMpA9vgyXdsj0H0GORL3n2fbwPOKoSQS4Q2cBOGzSJbQYAHDbZEI+rEuBcyZRlF71fIP/x0wBuIBOw6xH3xu2GQFAP2cegmvSwHkeqBZjECzB46UXD3bg8UKJCT6QYzgDY9uiU7hC11doERq6MAZ2CPJ7ipEulOrteDcB4KOZBpBG7zrV1JGzATzmIdnrl/go3bRiBJBHlZc+6ItjuQQ+yFLz8Gka2LZFRVTFGdoQJQ0LPodHnXkS8AjlRWkBLwKQswAs0PDzGpcsAAMNuG+5WgdqxwjgEcp8qcBjN5oZdPhEvOfhU/hsbJuVloWV6WWgp2IBLxXQNEwLDfKqoMXrEQBjATiFA3qePlgAZJRl+EStdaAQjfgALOC1zfeX8ALV+7S69JdALWjxHGqztmxyMnTD6OOBWvAdGDkn60c6vrI5H4CPnOJsWQDe8G0hIU0MB8ojFx+AFAeqeitLy5FkL3w0yNNcSOx3oDxjjxaH9XxldZluY5NBfwrAQvQbRjQXAO8UqVq5dh6A7HCgWzgdFwBdgOX4lMZbTndkWWkDN07Bk+zItllLdHm1+FkLwBSADNDf8B0AnGOp5gFYgJEexwcgGQx4iyeD9ybFkWsbDZbv0+2Y8XvGtqMpWsUimpMAzA1AUrj5ALjm2wCoONKB+ACYsEeDlU04MMs4imeJQqljslSuD4xl/zgAsx6ku/8DgDwaO9AwFU56qhzOPiXpKCzCpSSdb8v+CQDmXshb99cARAPFCOA1chWaFXlP55yn2FqEgiFvOSzYtmiJzisKB7MxQPS8iO63YsD3AHDv8QPgjR92eKuf9vts1wdZjvZhN4XajD35FNDiR7ln0LYBaILY+OZT4DsA+BkTP4AUrgXkxSJcDFps+72X7EGlx6mBbU/lAbdQjvKA7hSAlSuHxdw0gORsHrAUnXkAUuj+AQAZdHGRp9bShX2ECz1JRSk4zNhRJqj5SZQJfpgCUNS2eRsAP/usTDAxPxFKA834AZgAOM1z6qGgxxpdmUDQNjP25LtAsojxu0AehSkAF6RLXWR/EkAdVYEevQtswVtpMwuAB1JGh2jbxQcgBKrig/qSxTD6o2Nm7fttSY6uUnErV+jb4CJyaArAI5luJkCDOy5HAPISSB5A3wYbhJERahvtPALAAw2EI9Vzsh2TTuk23qEceN9d4vVVv227hNroe0CRi/o9IKTZTQFIAc/M8jwGEiouG2/042u8u25uAuPvAavRH7XhzqcBpICdRpssRa+aNLFoh2JeyBzU08fih/ht20WZXghW34s+/ZQnAKhzojsSH4CC/sjARPKamLXacOfTAIwfNSkCbROLluG9Tm2gdl3PY178tu2SBIpFQ6fHH//2GAvAogCkjtGDEAFQYPsu6DdBqw11bgFIF8dNHsQGIEFRSDOe0RS9YYJk23JMrw+/Cr9bFX0VXmNsACbhA088qXhBrMYAlq8Gjhh//FX4YNSGO7cASO9n9B99AuHk5OTk5OTk5OTk5OTk5OTk5OT0VX0B7+fX+9cwWYYAAAAASUVORK5CYII=").then(l=>
{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.website=l}).catch(l=>console.warn("Failed to load splash image: ",l))))}async _LoadSvgSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await e.FetchBlob(g);g=await this._runtime.RasterSvgImage(g,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(g,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await e.FetchBlob(g);
return await this._webglRenderer.CreateStaticTextureAsync(g,{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(){if(this._webglRenderer){this._loadingProgress=
1;var g=this._runtime.GetLoaderStyle();4===g&&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._runtime.ReleaseLoadingLogoAsset();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===g&&this.HideCordovaSplashScreen()}}_DrawLoadingScreen(){if(-1!==
this._rafId){var g=this._webglRenderer;if(g){g.Start();this._rafId=-1;var l=this._runtime.GetAssetManager().HasHadErrorLoading(),m=this._runtime.GetLoaderStyle();3!==m&&(this.SetCssTransform(g),g.ClearRgba(0,0,0,0),g.ResetColor(),g.SetTextureFillMode(),g.SetTexture(null));if(0===m)this._DrawProgressBarAndLogoLoadingScreen(l);else if(1===m)this._DrawProgressBarLoadingScreen(l,120,0);else if(2===m)this._DrawPercentTextLoadingScreen(l);else if(3===m)e.noop();else if(4===m)this._DrawSplashLoadingScreen(l);
else throw Error("invalid loader style");g.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}}_DrawPercentTextLoadingScreen(g){g?this._percentText.SetColorRgb(1,0,0):this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(100*this._loadingProgress)+"%");g=this._canvasCssWidth/2;const l=this._canvasCssHeight/2;f.setRect(g-150,l-100,g+150,l+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(f,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(g,
l,m){const u=this._webglRenderer;u.SetColorFillMode();g?u.SetColorRgba(1,0,0,1):u.SetColorRgba(.118,.565,1,1);g=this._canvasCssWidth/2;const v=this._canvasCssHeight/2,t=l/2;h.setWH(g-t,v-4+m,Math.floor(l*this._loadingProgress),8);u.Rect(h);h.setWH(g-t,v-4+m,l,8);h.offset(-.5,-.5);h.inflate(.5,.5);u.SetColorRgba(0,0,0,1);u.LineRect2(h);h.inflate(1,1);u.SetColorRgba(1,1,1,1);u.LineRect2(h)}_DrawProgressBarAndLogoLoadingScreen(g){var l=this._runtime.GetLoadingLogoAsset();if(l)if(l=l.GetTexture()){var m=
l.GetWidth(),u=l.GetHeight(),v=this._canvasCssWidth/2,t=this._canvasCssHeight/2,q=m/2;u/=2;f.setRect(v-q,t-u,v+q,t+u);this._webglRenderer.SetTexture(l);this._webglRenderer.Quad(f);this._DrawProgressBarLoadingScreen(g,m,u+16)}else this._DrawProgressBarLoadingScreen(g,120,0);else this._DrawProgressBarLoadingScreen(g,120,0)}_DrawSplashLoadingScreen(g){const l=this._webglRenderer,m=this._splashTextures.logo,u=this._splashTextures.powered,v=this._splashTextures.website,t=Date.now();0===this._splashFrameNumber&&
(this._loaderStartTime=t);const q=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),p=q?0:200,r=q?0:3E3;let x=1;"fade-in"===this._splashState?x=Math.min((t-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&(x=Math.max(1-(t-this._splashFadeOutStartTime)/300,0));l.SetColorFillMode();l.SetColorRgba(.231*x,.251*x,.271*x,x);h.set(0,0,this._canvasCssWidth,this._canvasCssHeight);l.Rect(h);const y=Math.ceil(this._canvasCssWidth),C=Math.ceil(this._canvasCssHeight);
let G;256<this._canvasCssHeight?(l.SetColorRgba(.302*x,.334*x,.365*x,x),G=Math.max(.005*C,2),h.setWH(0,.8*C-G/2,y,G),l.Rect(h),g?l.SetColorRgba(x,0,0,x):l.SetColorRgba(.161*x,.953*x,.816*x,x),g=y*this._loadingProgress,h.setWH(.5*y-g/2,.8*C-G/2,g,G),l.Rect(h),l.SetColorRgba(x,x,x,x),l.SetTextureFillMode(),u&&(g=1.5*e.clamp(.22*C,105,.6*y),G=g/8,h.setWH(.5*y-g/2,.2*C-G/2,g,G),l.SetTexture(u),l.Rect(h)),m&&(G=g=Math.min(.395*C,.95*y),h.setWH(.5*y-g/2,.485*C-G/2,g,G),l.SetTexture(m),l.Rect(h)),v&&(g=
1.5*e.clamp(.22*C,105,.6*y),G=g/8,h.setWH(.5*y-g/2,.868*C-G/2,g,G),l.SetTexture(v),l.Rect(h))):(l.SetColorRgba(.302*x,.334*x,.365*x,x),G=Math.max(.005*C,2),h.setWH(0,.85*C-G/2,y,G),l.Rect(h),g?l.SetColorRgba(x,0,0,x):l.SetColorRgba(.161*x,.953*x,.816*x,x),g=y*this._loadingProgress,h.setWH(.5*y-g/2,.85*C-G/2,g,G),l.Rect(h),l.SetColorRgba(x,x,x,x),l.SetTextureFillMode(),m&&(G=g=.55*C,h.setWH(.5*y-g/2,.45*C-G/2,g,G),l.SetTexture(m),l.Rect(h)));this._splashFrameNumber++;"fade-in"===this._splashState&&
300<=t-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=t);"wait"===this._splashState&&t-this._splashFadeInFinishTime>=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=t);("fade-out"===this._splashState&&t-this._splashFadeOutStartTime>=300+p||q&&1<=this._loadingProgress&&500>t-this._loaderStartTime)&&this._splashDoneResolve()}}}
{"use strict";const e=self.C3,b=self.C3Debugger,a={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let c=!0;e.Runtime=class extends e.DefendedBase{constructor(d){d=Object.assign({},a,d);super();this._messagePort=d.messagePort;this._baseUrl=d.baseUrl;this._isHeadless=!!d.headless;this._hasDom=!!d.hasDom;this._isInWorker=!!d.isInWorker;c=d.ife;this._useAudio=!!d.useAudio;this._exportType=d.exportType;this._isiOSCordova=!!d.isiOSCordova;this._isiOSWebView=
!!d.isiOSWebView;this._isFBInstantAvailable=!!d.isFBInstantAvailable;this._opusWasmScriptUrl=d.opusWasmScriptUrl;this._opusWasmBinaryUrl=d.opusWasmBinaryUrl;this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!d.isDebug);this._debuggingDisabled=0;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._usesAnyDepthSampling=this._usesAnyBackgroundBlending=!1;this._loadingLogoAsset=null;this._assetManager=e.New(e.AssetManager,this,d);this._layoutManager=e.New(e.LayoutManager,this);this._eventSheetManager=e.New(e.EventSheetManager,this);this._pluginManager=e.New(e.PluginManager,this);this._collisionEngine=
e.New(e.CollisionEngine,this);this._timelineManager=e.New(e.TimelineManager,this);this._transitionManager=e.New(e.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._uses3dFeatures=!1;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._tickCallbacks={normal:f=>{this._ruafId=this._rafId=-1;this.Tick(f)},tickOnly:f=>{this._ruafId=-1;this.Tick(f,
!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 e.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=e.New(e.KahanSum);this._gameTimeRaw=
e.New(e.KahanSum);this._wallTime=e.New(e.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._savegamesStorage=this._projectStorage=null;this._dispatcher=e.New(e.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:e.New(e.Event,"pretick",!1),tick:e.New(e.Event,"tick",!1),tick2:e.New(e.Event,"tick2",!1),instancedestroy:e.New(e.Event,"instancedestroy",!1),beforelayoutchange:e.New(e.Event,"beforelayoutchange",!1),layoutchange:e.New(e.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=e.New(e.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=
e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._jobScheduler=e.New(e.JobSchedulerRuntime,this,d.jobScheduler);d.canvas&&(this._canvasManager=e.New(e.CanvasManager,this));this._messagePort.onmessage=f=>this._OnMessageFromDOM(f.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",f=>this._OnVisibilityChange(f));
this.AddDOMComponentMessageHandler("runtime","opus-decode",f=>this._WasmDecodeWebMOpus(f.arrayBuffer));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",f=>this._InvokeFunctionFromJS(f));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",f=>this._OnWindowBlur(f));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(d){return e.New(e.Runtime,d)}Release(){e.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"](d){const f=d.type;if("event"===f)this._OnEventFromDOM(d);else if("result"===f)this._OnResultFromDOM(d);
else throw Error(`unknown message '${f}'`);}_OnEventFromDOM(d){if(this._isReadyToHandleEvents){var f=d.component,h=d.handler,g=d.data,l=d.dispatchOpts,m=!(!l||!l.dispatchRuntimeEvent);l=!(!l||!l.dispatchUserScriptEvent);var u=d.responseId;if("runtime"===f&&(m&&(d=new e.Event(h),d.data=g,this._dispatcher.dispatchEventAndWaitAsyncSequential(d)),l)){d=new e.Event(h,!0);for(const [v,t]of Object.entries(g))d[v]=t;this.DispatchUserScriptEvent(d)}if(d=this._domEventHandlers.get(f))if(d=d.get(h)){m=null;
try{m=d(g)}catch(v){console.error(`Exception in '${f}' handler '${h}':`,v);null!==u&&this._PostResultToDOM(u,!1,""+v);return}null!==u&&(m&&m.then?m.then(v=>this._PostResultToDOM(u,!0,v)).catch(v=>{console.error(`Rejection from '${f}' handler '${h}':`,v);this._PostResultToDOM(u,!1,""+v)}):this._PostResultToDOM(u,!0,m))}else m||l||console.warn(`[Runtime] No DOM handler '${h}' for component '${f}'`);else m||l||console.warn(`[Runtime] No DOM event handlers for component '${f}'`)}else this._waitingToHandleEvents.push(d)}_PostResultToDOM(d,
f,h){this._messagePort.postMessage({type:"result",responseId:d,isOk:f,result:h})}_OnResultFromDOM(d){const f=d.responseId,h=d.isOk;d=d.result;const g=this._pendingResponsePromises.get(f);h?g.resolve(d):g.reject(d);this._pendingResponsePromises.delete(f)}AddDOMComponentMessageHandler(d,f,h){let g=this._domEventHandlers.get(d);g||(g=new Map,this._domEventHandlers.set(d,g));if(g.has(f))throw Error(`[Runtime] Component '${d}' already has handler '${f}'`);g.set(f,h)}PostComponentMessageToDOM(d,f,h){this._messagePort.postMessage({type:"event",
component:d,handler:f,data:h,responseId:null})}PostComponentMessageToDOMAsync(d,f,h){const g=this._nextDomResponseId++,l=new Promise((m,u)=>{this._pendingResponsePromises.set(g,{resolve:m,reject:u})});this._messagePort.postMessage({type:"event",component:d,handler:f,data:h,responseId:g});return l}PostToDebugger(d){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",d)}async Init(d){this.IsDebug()?await b.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);
var [f]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(f);await this._InitialiseCanvas(d);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");this.GetWebGLRenderer()?(f=this.GetWebGLRenderer(),console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${f.GetWebGLVersionNumber()} [${f.GetUnmaskedRenderer()}] (${f.IsDesynchronized()?
"desynchronized":"standard"} compositing)`)):this.GetWebGPURenderer()&&console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with experimental WebGPU`);this.GetRenderer().HasMajorPerformanceCaveat()&&console.warn("[C3 runtime] The renderer indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.");this._isReadyToHandleEvents=!0;for(const h of this._waitingToHandleEvents)this._OnEventFromDOM(h);e.clearArray(this._waitingToHandleEvents);
this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const h of d.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(h));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);e.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 e.Event("beforeruntimestart")),
await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(d){try{await d(this._iRuntime)}catch(f){console.error("[C3 runtime] Error in runOnStartup function: ",f)}}_LoadDataJson(d){d=d.project;this._projectName=d[0];this._projectVersion=d[16];this._projectUniqueId=d[31];this._appId=d[38];const f=d[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!d[9];this._originalViewportWidth=this._viewportWidth=d[10];this._originalViewportHeight=this._viewportHeight=
d[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=d[36];this._framerateMode=d[37];"low-latency"===this._compositingMode&&this.IsAndroidWebView()&&77>=e.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._uses3dFeatures=!!d[40];this._sampling=d[14];this._usesAnyBackgroundBlending=d[15];this._usesAnyDepthSampling=d[17];this._usesLoaderLayout=!!d[18];this._loaderStyle=d[19];this._nextUid=d[21];this._pauseOnBlur=d[22];const h=this._assetManager;h._SetAudioFiles(d[7],d[25]);h._SetMediaSubfolder(d[8]);h._SetFontsSubfolder(d[32]);h._SetIconsSubfolder(d[28]);h._SetWebFonts(d[29]);if(0===this._loaderStyle){let v="";this.IsPreview()?h._HasLocalUrlBlob(f)&&(v=h.GetLocalUrlAsBlobUrl(f)):v=h.GetIconsSubfolder()+
f;v&&(this._loadingLogoAsset=h.LoadImage({url:v}))}this._canvasManager&&(this._canvasManager.SetFullscreenMode(e.CanvasManager._FullscreenModeNumberToString(d[12])),this._canvasManager.SetFullscreenScalingQuality(d[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==d[24]),this._canvasManager._SetGPUPowerPreference(d[34]),this._canvasManager._SetTextureAnisotropy(d[41]),this._canvasManager._SetWebGPUEnabled(d[13]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();
for(var g of d[2])this._pluginManager.CreatePlugin(g);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var l of d[3])g=e.ObjectClass.Create(this,this._allObjectClasses.length,l),this._allObjectClasses.push(g),this._objectClassesByName.set(g.GetName().toLowerCase(),g),this._objectClassesBySid.set(g.GetSID(),g);for(const v of d[4])this._allObjectClasses[v[0]]._LoadFamily(v);for(var m of d[27])l=m.map(v=>this._allObjectClasses[v]),this._allContainers.push(e.New(e.Container,
this,l));for(const v of this._allObjectClasses)v._OnAfterCreate();for(const v of d[5])this._layoutManager.Create(v);(m=d[1])&&(m=this._layoutManager.GetLayoutByName(m))&&this._layoutManager.SetFirstLayout(m);for(var u of d[33])this._timelineManager.Create(u);for(const v of d[35])this._transitionManager.Create(v);this._InitScriptInterfaces();for(const v of d[6])this._eventSheetManager.Create(v);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();e.clearArray(this._objectReferenceTable);
this.FlushPendingInstances();u="any";d=d[20];1===d?u="portrait":2===d&&(u="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:u})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(d){this._additionalLoadPromises.push(d)}SetUsingCreatePromises(d){this._isUsingCreatePromises=!!d}AddCreatePromise(d){this._isUsingCreatePromises&&this._additionalCreatePromises.push(d)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(d){this._allEffectLists.push(d)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(d){this._canvasManager&&
(await this._canvasManager.CreateCanvas(d),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var d=null;try{d=this.IsiOSCordova()&&this._assetManager.IsFileProtocol()?await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(f){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",
f);return}d?this.AddJobWorkerBuffer(d,"opus-decoder-wasm"):this.AddJobWorkerBlob(null,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(d){return await this.AddJob("OpusDecode",{arrayBuffer:d},[d])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var d of this._allObjectClasses)d.IsFamily()||d.IsOnLoaderLayout()||!d.IsWorldType()||d.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=
!1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&b.RuntimeInit(c);for(const f of this._layoutManager.GetAllLayouts())f._CreateGlobalNonWorlds();d=this._layoutManager.GetFirstLayout();await d._Load(null,this.GetRenderer());await d._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(e.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(d){d=Math.floor(d);const f=this._objectReferenceTable;if(0>d||d>=f.length)throw Error("invalid object reference");return f[d]}_LoadJsPropNameTable(){for(const d of self.C3_JsPropNameTable){const f=e.first(Object.keys(d));this._jsPropNameTable.push(f)}}GetJsPropName(d){d=Math.floor(d);const f=this._jsPropNameTable;if(0>d||d>=f.length)throw Error("invalid prop reference");
return f[d]}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(d){d=Math.floor(d);if(0>d||d>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[d]}GetObjectClassByName(d){return this._objectClassesByName.get(d.toLowerCase())||null}GetObjectClassBySID(d){return this._objectClassesBySid.get(d)||
null}GetSingleGlobalObjectClassByCtor(d){return(d=this._pluginManager.GetPluginByConstructorFunction(d))?d.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const d of this._allObjectClasses)d.IsFamily()||(yield*d.instances())}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(d){d.runtime=this.GetIRuntime();const f=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();f&&
b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(d);f&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(d){d.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(d)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(d,f){if(this._originalViewportWidth!==d||this._originalViewportHeight!==f)this._originalViewportWidth=d,this._originalViewportHeight=
f,d=this.GetLayoutManager(),d.SetAllLayerProjectionChanged(),d.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(d,f){if(this._viewportWidth!==d||this._viewportHeight!==f)this._viewportWidth=d,this._viewportHeight=f,d=this.GetLayoutManager(),d.SetAllLayerProjectionChanged(),d.SetAllLayerMVChanged()}_SetDevicePixelRatio(d){this._devicePixelRatio=d}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}GetEffectLayerScaleParam(){return this._canvasManager?this._canvasManager.GetEffectLayerScaleParam():1}GetEffectDevicePixelRatioParam(){return this._canvasManager?this._canvasManager.GetEffectDevicePixelRatioParam():
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(d){return this._canvasManager?this._canvasManager.GetAdditionalRenderTarget(d):
null}ReleaseAdditionalRenderTarget(d){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(d)}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}UsesAnyDepthSampling(){return this._usesAnyDepthSampling}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}GetLoadingLogoAsset(){return this._loadingLogoAsset}ReleaseLoadingLogoAsset(){this._loadingLogoAsset&&
(this._loadingLogoAsset.Release(),this._loadingLogoAsset=null)}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetAssetManager(){return this._assetManager}LoadImage(d){return this._assetManager.LoadImage(d)}CreateInstance(d,f,h,g,l){return this.CreateInstanceFromData(d,f,!1,h,g,!1,l,void 0,l)}CreateInstanceFromData(d,f,h,g,l,
m,u,v,t){var q=null;let p=null;if(d instanceof e.ObjectClass){p=d;if(p.IsFamily()){d=p.GetFamilyMembers();var r=Math.floor(this.Random()*d.length);p=d[r]}q=p.GetDefaultInstanceData()}else q=d,p=this.GetObjectClassByIndex(q[1]);var x=p.GetPlugin().IsWorldType();if(this._isLoading&&x&&!p.IsOnLoaderLayout())return null;const y=f;x||(f=null);var C=h&&!m&&q&&!this._instancesByUid.has(q[2])?q[2]:this._nextUid++;r=q?q[0]:null;d=e.New(e.Instance,{runtime:this,objectType:p,layer:f,worldData:r,instVarData:q?
q[3]:null,uid:C});this._instancesByUid.set(C,d);C=null;x&&(C=d.GetWorldInfo(),"undefined"!==typeof g&&"undefined"!==typeof l&&(C.SetX(g),C.SetY(l)),p._SetAnyCollisionCellChanged(!0));f&&(t||f._AddInstance(d,!0),1===f.GetParallaxX()&&1===f.GetParallaxY()||p._SetAnyInstanceParallaxed(!0),f.GetLayout().MaybeLoadTexturesFor(p));this._objectCount++;let G=!0;if(v){var A=v.GetObjectClass();A.IsInContainer()&&p.IsInContainer()&&(v=p.GetContainer(),A=A.GetContainer(),v===A&&(G=!1))}if(p.IsInContainer()&&!h&&
!m&&G){for(var E of p.GetContainer().objectTypes())E!==p&&(v=this.CreateInstanceFromData(E,y,!1,C?C.GetX():g,C?C.GetY():l,!0,!1,void 0,t),d._AddSibling(v));for(var J of d.siblings()){J._AddSibling(d);for(const B of d.siblings())J!==B&&J._AddSibling(B)}}x&&!h&&u&&this._CreateChildInstancesFromData(d,r,C,f,g,l,t);if(p.IsInContainer()&&!h&&!m&&u)for(const B of d.siblings())if(h=B.GetWorldInfo())E=B.GetPlugin(),J=B.GetObjectClass().GetDefaultInstanceData()[0],E.IsWorldType()?this._CreateChildInstancesFromData(B,
J,h,f,h.GetX(),h.GetY(),t):this._CreateChildInstancesFromData(B,J,h,f,void 0,void 0,t);!m&&u&&("undefined"===typeof g&&(g=r[0]),"undefined"===typeof l&&(l=r[1]),f=C.GetTopParent(),g=g-C.GetX()+f.GetX(),l=l-C.GetY()+f.GetY(),f.SetXY(g,l));p._SetIIDsStale();l=q?e.cloneArray(q[5]):null;q=q?q[4].map(B=>e.cloneArray(B)):null;(x=x&&r&&r[13])&&d._SetHasTilemap();d._CreateSdkInstance(l,q);x&&(r=r[13],d.GetSdkInstance().LoadTilemapData(r[2],r[0],r[1]));this._instancesPendingCreate.push(d);this._hasPendingInstances=
!0;this.IsDebug()&&b.InstanceCreated(d);return d}_CreateChildInstancesFromData(d,f,h,g,l,m,u){var v=h.GetSceneGraphZIndexExportData(),t=h.GetSceneGraphChildrenExportData();d.GetWorldInfo().SetSceneGraphZIndex(v);if(t){"undefined"===typeof l&&(l=f[0]);"undefined"===typeof m&&(m=f[1]);v=new Set;h=f[0];f=f[1];for(const y of t){var q=y[1],p=y[2];t=y[3];var r=!!y[4];const C=y[5];p=this._layoutManager.GetLayoutBySID(y[0]).GetLayer(q).GetInitialInstanceData(p);q=this.GetObjectClassByIndex(p[1]);var x=d.HasSibling(q);
const G=v.has(q);x&&!G&&r?(r=d.GetSibling(q),x=l+p[0][0]-h,p=m+p[0][1]-f,r.GetWorldInfo().SetXY(x,p),r.GetWorldInfo().SetSceneGraphZIndex(C),d.AddChild(r,{transformX:!!(t>>0&1),transformY:!!(t>>1&1),transformWidth:!!(t>>2&1),transformHeight:!!(t>>3&1),transformAngle:!!(t>>4&1),destroyWithParent:!!(t>>5&1),transformZElevation:!!(t>>6&1)}),v.add(q)):(q=this.CreateInstanceFromData(p,g,!1,l+p[0][0]-h,m+p[0][1]-f,!1,!0,d,u),q.GetWorldInfo().SetSceneGraphZIndex(C),d.AddChild(q,{transformX:!!(t>>0&1),transformY:!!(t>>
1&1),transformWidth:!!(t>>2&1),transformHeight:!!(t>>3&1),transformAngle:!!(t>>4&1),destroyWithParent:!!(t>>5&1),transformZElevation:!!(t>>6&1)}))}}}DestroyInstance(d){if(!this._instancesToReleaseAtEndOfTick.has(d)){var f=d.GetObjectClass(),h=this._instancesPendingDestroy.get(f);if(h){if(h.has(d))return;h.add(d)}else h=new Set,h.add(d),this._instancesPendingDestroy.set(f,h);this.IsDebug()&&b.InstanceDestroyed(d);d._MarkDestroyed();this._hasPendingInstances=!0;if(d.IsInContainer())for(const g of d.siblings())this.DestroyInstance(g);
for(const g of d.children())g.GetDestroyWithParent()&&this.DestroyInstance(g);this._layoutManager.IsEndingLayout()||this._isLoadingState||(f=this.GetEventSheetManager(),f.BlockFlushingInstances(!0),d._TriggerOnDestroyed(),f.BlockFlushingInstances(!1));d._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances=
this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const d of this._instancesPendingCreate){const f=d.GetObjectClass();f._AddInstance(d);for(const h of f.GetFamilies())h._AddInstance(d),h._SetIIDsStale()}e.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [d,f]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(d,f),f.clear();this._instancesPendingDestroy.clear();
this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(d,f){for(const g of f){var h=this._eventObjects.instancedestroy;h.instance=g;this._dispatcher.dispatchEvent(h);this._instancesByUid.delete(g.GetUID());if(h=g.GetWorldInfo())h._RemoveFromCollisionCells(),h._RemoveFromRenderCells(),h._MarkDestroyed();this._instancesToReleaseAtEndOfTick.add(g);this._objectCount--}e.arrayRemoveAllInSet(d.GetInstances(),f);d._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(d);
0===d.GetInstances().length&&d._SetAnyInstanceParallaxed(!1);for(const g of d.GetFamilies())e.arrayRemoveAllInSet(g.GetInstances(),f),g._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(g);if(d.GetPlugin().IsWorldType()){d=new Set([...f].map(g=>g.GetWorldInfo().GetLayer()));for(const g of d)g._RemoveAllInstancesInSet(f)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(d){for(const f of this._GetInstancesPendingCreate())d.IsFamily()?
f.GetObjectClass().BelongsToFamily(d)&&(yield f):f.GetObjectClass()===d&&(yield f)}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(d,f){this._instancesByUid.set(d,f)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(e.New(e.Event,"webglcontextlost"));this.SetSuspended(!0);for(var d of this._allObjectClasses)!d.IsFamily()&&d.HasLoadedTextures()&&d.ReleaseTextures();(d=this.GetMainRunningLayout())&&d._OnWebGLContextLost();e.ImageInfo.OnWebGLContextLost();e.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,
this.GetWebGLRenderer());this._dispatcher.dispatchEvent(e.New(e.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(d){this.SetSuspended(d.hidden)}_OnWindowBlur(d){this.IsPreview()&&this._pauseOnBlur&&!e.Platform.IsMobile&&!d.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const d=this._tickCallbacks;"vsync"===this._framerateMode?
-1===this._rafId&&(this._rafId=self.requestAnimationFrame(d.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=e.RequestUnlimitedAnimationFrame(d.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(d.renderOnly))):-1===this._ruafId&&(this._ruafId=e.RequestUnlimitedAnimationFrame(d.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(e.CancelUnlimitedAnimationFrame(this._ruafId),
this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(d){var f=this.IsSuspended();this._suspendCount+=d?1:-1;0>this._suspendCount&&(this._suspendCount=0);d=this.IsSuspended();!f&&d?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(e.New(e.Event,"suspend")),this.Trigger(e.Plugins.System.Cnds.OnSuspend,null,null)):f&&!d&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=f=performance.now(),this._mainThreadTimeCounter=
this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(e.New(e.Event,"resume")),this.Trigger(e.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(f))}_AddBehInstToTick(d){this._behInstsToTick.Add(d)}_AddBehInstToPostTick(d){this._behInstsToPostTick.Add(d)}_AddBehInstToTick2(d){this._behInstsToTick2.Add(d)}_RemoveBehInstToTick(d){this._behInstsToTick.Remove(d)}_RemoveBehInstToPostTick(d){this._behInstsToPostTick.Remove(d)}_RemoveBehInstToTick2(d){this._behInstsToTick2.Remove(d)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);
for(const d of this._behInstsToTick)d.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const d of this._behInstsToPostTick)d.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const d of this._behInstsToTick2)d.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const d of this._behInstsToTick){const f=
d.Tick();e.IsIterator(f)&&(yield*f)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const d of this._behInstsToPostTick){const f=d.PostTick();e.IsIterator(f)&&(yield*f)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const d of this._behInstsToTick2){const f=d.Tick2();e.IsIterator(f)&&(yield*f)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(d,f,
h){this._hasStartedTicking=!0;const g="background-wake"===h;h="background-wake"!==h&&"skip-render"!==h;this._hasStarted&&(!this.IsSuspended()||f||g)&&(f=performance.now(),this._isInTick=!0,this._MeasureDt(d||0),d=this.Step_BeforePreTick(),this.IsDebugging()&&await d,d=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),d instanceof Promise&&await d,d=this.Step_AfterPreTick(),this.IsDebugging()&&await d,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),this.GetLayoutManager().IsPendingChangeMainLayout()&&
await this._MaybeChangeLayout(),d=this.Step_RunEventsEtc(),this.IsDebugging()&&await d,h&&this.Render(),this.IsSuspended()||g||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-f)}async Step_BeforePreTick(){const d=this._eventSheetManager,f=this.IsDebug();this.FlushPendingInstances();d.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());f&&b.StartMeasuringTime();this.IsDebugging()?
await d.DebugRunScheduledWaits():d.RunScheduledWaits();f&&b.AddEventsTime();this.PopCurrentLayout();d.BlockFlushingInstances(!1);this.FlushPendingInstances();d.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const d=this.IsDebug(),f=this.IsDebugging(),h=this._dispatcher,g=this._eventObjects,l=this._userScriptEventObjects;d&&b.StartMeasuringTime();f?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();f?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):
this._BehaviorPostTick();d&&b.AddBehaviorTickTime();d&&b.StartMeasuringTime();f?await this.DebugFireGeneratorEventAndBreak(g.tick):h.dispatchEvent(g.tick);d&&b.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(l.tick)}async Step_RunEventsEtc(){const d=this._eventSheetManager,f=this._dispatcher,h=this._eventObjects,g=this.IsDebug(),l=this.IsDebugging();g&&b.StartMeasuringTime();l?await d.DebugRunEvents(this._layoutManager):d.RunEvents(this._layoutManager);
g&&b.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=!1;d.BlockFlushingInstances(!0);g&&b.StartMeasuringTime();l?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();g&&b.AddBehaviorTickTime();g&&b.StartMeasuringTime();l?await this.DebugFireGeneratorEventAndBreak(h.tick2):f.dispatchEvent(h.tick2);g&&b.AddPluginTickTime();d.BlockFlushingInstances(!1);l&&await d.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(0!==
this._instancesToReleaseAtEndOfTick.size){var d=this._dispatcher;d.SetDelayRemoveEventsEnabled(!0);for(const f of this._instancesToReleaseAffectedObjectClasses)f.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const f of this._instancesToReleaseAtEndOfTick)f.Release();this._instancesToReleaseAtEndOfTick.clear();d.SetDelayRemoveEventsEnabled(!1)}}async _MaybeChangeLayout(){const d=
this.GetLayoutManager();let f=0;for(;d.IsPendingChangeMainLayout()&&10>f++;)await this._DoChangeLayout(d.GetPendingChangeMainLayout())}_MeasureDt(d){let f=0;0!==this._lastTickTime&&(f=Math.max(d-this._lastTickTime,0)/1E3,.5<f&&(f=0),this._dt1=Math.min(f,1/this._minimumFramerate));this._lastTickTime=d;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(f*this._timeScale);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=d-this._fpsLastTime&&
(this._fpsLastTime+=1E3,1E3<=d-this._fpsLastTime&&(this._fpsLastTime=d),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(d){const f=this._dispatcher,h=this.GetLayoutManager().GetMainRunningLayout();await h._StopRunning();
h._Unload(d,this.GetRenderer());h===d&&this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();f.dispatchEvent(this._eventObjects.beforelayoutchange);e.Asyncify.SetHighThroughputMode(!0);await d._Load(h,this.GetRenderer());e.Asyncify.SetHighThroughputMode(!1);await d._StartRunning(!1);f.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender=
!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}GetWebGPURenderer(){return this._canvasManager?this._canvasManager.GetWebGPURenderer():null}GetRenderer(){return this._canvasManager?this._canvasManager.GetRenderer():null}Render(){const d=this._canvasManager;if(d&&!d.IsRendererContextLost()){var f=this.GetRenderer(),h=f.SupportsGPUProfiling(),g=h&&f.IsWebGL();h=h&&f.IsWebGPU();g&&f.CheckForQueryResults();if(this._needRender){var l=this._layoutManager.GetMainRunningLayout();
f.Start();var m=this.IsDebug();m&&b.StartMeasuringTime();this._needRender=!1;var u=null;g&&(u=d.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),f.StartQuery(u));g=null;h&&(g=f.StartFrameTiming(2*(1+l.GetLayerCount())),f.WriteTimestamp(0));this.Uses3DFeatures()&&"low"===d.GetCurrentFullscreenScalingQuality()?f.SetFixedSizeDepthBuffer(d.GetDrawWidth(),d.GetDrawHeight()):f.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),l);u&&f.EndQuery(u);h&&(f.WriteTimestamp(1),this._canvasManager._AddWebGPUFrameTiming(g));
f.Finish();m&&(b.AddDrawCallsTime(),b.UpdateInspectHighlight());d&&d._MaybeTakeSnapshot()}else f.IncrementFrameNumber()}}_Render(d,f){d.SetTextureFillMode();d.SetAlphaBlend();d.SetColorRgba(1,1,1,1);d.SetRenderTarget(null);d.SetTexture(null);d.SetDepthEnabled(this.Uses3DFeatures());f.Draw(d)}Trigger(d,f,h){if(!this._hasStarted)return!1;var g=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let l=0;g&&(l=performance.now());const m=this.IsDebug();m&&this.SetDebuggingEnabled(!1);d=this._eventSheetManager._Trigger(this._layoutManager,
d,f,h);g&&(g=performance.now()-l,this._mainThreadTimeCounter+=g,m&&b.AddTriggersTime(g));m&&this.SetDebuggingEnabled(!0);return d}DebugTrigger(d,f,h){if(!this.IsDebug())return this.Trigger(d,f,h);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,d,f,
h)}async TriggerAsync(d,f,h){if(!this.IsDebugging())return this.Trigger(d,f,h);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(d,f,h);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(d,f,h);const g=performance.now();d=this._eventSheetManager._DebugTrigger(this._layoutManager,d,f,h);for(f=d.next();!f.done;)await this.DebugBreak(f.value),f=d.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),
this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-g;return f.value}FastTrigger(d,f,h){const g=this.IsDebug();g&&this.SetDebuggingEnabled(!1);d=this._eventSheetManager._FastTrigger(this._layoutManager,d,f,h);g&&this.SetDebuggingEnabled(!0);return d}DebugFastTrigger(d,f,h){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,d,f,h)}ScheduleTriggers(d){return this._scheduleTriggersThrottle.Add(d)}PushCurrentLayout(d){this._currentLayoutStack.push(d)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty");
this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?this._currentLayoutStack.at(-1):this.GetMainRunningLayout()}GetDt(d){return d&&-1!==d.GetTimeScale()?this._dt1*d.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(d){if(isNaN(d)||0>d)d=0;this._timeScale=d}SetMinimumFramerate(d){this._minimumFramerate=e.clamp(d,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetGameTimeRaw(){return this._gameTimeRaw.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(d){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event");
return this._instancesByUid.get(d)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const d of this._allObjectClasses)if(!d.IsFamily())for(const f of d.GetInstances())this._instancesByUid.set(f.GetUID(),f)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===e.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()}Uses3DFeatures(){return this._uses3dFeatures}GetZScaleFactor(){const d=this.GetRenderer();return this.GetViewportHeight()/2/Math.tan(d.GetFovY()/2)/d.GetDefaultCameraZ()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(d){d=
!!d;this._isPixelRoundingEnabled!==d&&(this._isPixelRoundingEnabled=d,this.GetLayoutManager().SetAllLayerMVChanged(),this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(d){this._saveToSlotName=d}LoadFromSlot(d){this._loadFromSlotName=d}LoadFromJsonString(d){this._loadFromJson=d}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(e.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(d){console.error("[Construct 3] Failed to load state from JSON string: ",
d),await this.TriggerAsync(e.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(d){const f=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(d,f),console.log("[Construct 3] Saved state to storage ("+f.length+" chars)"),this._lastSaveJson=f,await this.TriggerAsync(e.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(h){console.error("[Construct 3] Failed to save state to storage: ",h),await this.TriggerAsync(e.Plugins.System.Cnds.OnSaveFailed,
null)}}async _DoLoadFromSlot(d){try{const f=await this._GetSavegamesStorage().getItem(d);if(!f)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+f.length+" chars)");await this._DoLoadFromJsonString(f);this._lastSaveJson=f;await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(f){console.error("[Construct 3] Failed to load state from storage: ",f),await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const d=
{c3save:!0,version:1,rt:{time:this.GetGameTime(),timeRaw:this.GetGameTimeRaw(),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 f of this._allObjectClasses)f.IsFamily()||
f.HasNoSaveBehavior()||(d.types[f.GetSID().toString()]=f._SaveToJson());for(const h of this._layoutManager.GetAllLayouts())d.layouts[h.GetSID().toString()]=h._SaveToJson();f=this._CreateUserScriptEvent("save");f.saveData=null;await this.DispatchUserScriptEventAsyncWait(f);d.user_script_data=f.saveData;return JSON.stringify(d)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(d){var f=this.GetLayoutManager();d=JSON.parse(d);if(d.c2save)throw Error("C2 saves are incompatible with C3 runtime");
if(!d.c3save)throw Error("not valid C3 save data");if(1<d.version)throw Error("C3 save data from future version");this._dispatcher.dispatchEvent(e.New(e.Event,"beforeload"));for(var h of this.allInstances())h._OnBeforeLoad();this._isLoadingState=!0;h=d.rt;this._gameTime.Set(h.time);h.hasOwnProperty("timeRaw")&&this._gameTimeRaw.Set(h.timeRaw);this._wallTime.Set(h.walltime);this._timeScale=h.timescale;this._tickCount=h.tickcount;this._execCount=h.execcount;this._startTime=Date.now()-h.start_time_offset;
var g=h.running_layout;if(g!==this.GetMainRunningLayout().GetSID())if(g=f.GetLayoutBySID(g))await this._DoChangeLayout(g);else return;for(const [l,m]of Object.entries(d.types))g=parseInt(l,10),g=this.GetObjectClassBySID(g),!g||g.IsFamily()||g.HasNoSaveBehavior()||g._LoadFromJson(m);this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=h.next_uid;for(const [l,m]of Object.entries(d.layouts))h=parseInt(l,10),(h=f.GetLayoutBySID(h))&&h._LoadFromJson(m);this._eventSheetManager._LoadFromJson(d.events);
for(const l of this._allObjectClasses)if(!l.IsFamily()&&l.IsInContainer())for(const m of l.GetInstances()){h=m.GetIID();for(const u of l.GetContainer().objectTypes())if(u!==l){g=u.GetInstances();if(0>h||h>=g.length)throw Error("missing sibling instance");m._AddSibling(g[h])}}this._timelineManager._LoadFromJson(d.timelines);f.SetAllLayerProjectionChanged();f.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(e.New(e.Event,"afterload"));f=this._CreateUserScriptEvent("load");f.saveData=d.user_script_data;
await this.DispatchUserScriptEventAsyncWait(f);this.UpdateRender()}async AddJobWorkerScripts(d){d=(await Promise.all(d.map(f=>this._assetManager.FetchBlob(f)))).map(f=>URL.createObjectURL(f));this._jobScheduler.ImportScriptsToJobWorkers(d)}AddJobWorkerBlob(d,f){this._jobScheduler.SendBlobToJobWorkers(d,f)}AddJobWorkerBuffer(d,f){this._jobScheduler.SendBufferToJobWorkers(d,f)}AddJob(d,f,h){return this._jobScheduler.AddJob(d,f,h)}BroadcastJob(d,f,h){return this._jobScheduler.BroadcastJob(d,f,h)}InvokeDownload(d,
f){this.PostComponentMessageToDOM("runtime","invoke-download",{url:d,filename:f})}async RasterSvgImage(d,f,h,g,l,m){g=g||f;l=l||h;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{blob:d,imageWidth:f,imageHeight:h,surfaceWidth:g,surfaceHeight:l,imageBitmapOpts:m})).imageBitmap;d=await self.C3_RasterSvgImageBlob(d,f,h,g,l);return m?await self.createImageBitmap(d,m):d}async GetSvgImageSize(d){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime",
"get-svg-image-size",{blob:d}):await self.C3_GetSvgImageSize(d)}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(d){this._randomNumberCallback=
d}_GetRemotePreviewStatusInfo(){const d=this.GetWebGLRenderer();return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:d?d.GetUnmaskedRenderer():"<unavailable>"}}HitBreakpoint(){return this.IsDebug()?b.HitBreakpoint():!1}DebugBreak(d){return this.IsDebugging()?b.DebugBreak(d):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?b.BreakNext():!1}SetDebugBreakpointsEnabled(d){this._breakpointsEnabled=
!!d;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(d){d?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.GetRenderer().SupportsGPUProfiling()&&b.IsGPUProfiling()}async DebugIterateAndBreak(d){if(d)for(const f of d)await this.DebugBreak(f)}DebugFireGeneratorEventAndBreak(d){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(d))}_InvokeFunctionFromJS(d){return this._eventSheetManager._InvokeFunctionFromJS(d.name,
d.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(d){d=e.New(e.Event,d,!1);d.runtime=this._iRuntime;return d}_InitScriptInterfaces(){var d={};for(const f of this._allObjectClasses)d[f.GetJsPropName()]={value:f.GetIObjectClass(),enumerable:!0,writable:!1};d=Object.create(Object.prototype,d);this._iRuntime=new self.IRuntime(this,d);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const d={};for(const f of this.GetEventSheetManager().GetAllGlobalVariables())d[f.GetJsPropName()]=
f._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(d)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(d,f){this._interfaceMap.set(d,f)}_UnwrapScriptInterface(d){return this._interfaceMap.get(d)}_UnwrapIObjectClass(d){if(!(d instanceof self.IObjectClass))throw new TypeError("expected IObjectClass");d=this._UnwrapScriptInterface(d);if(!(d&&d instanceof e.ObjectClass))throw Error("invalid IObjectClass");return d}_UnwrapIWorldInstance(d){if(!(d instanceof
self.IWorldInstance))throw new TypeError("expected IWorldInstance");d=this._UnwrapScriptInterface(d);if(!(d&&d instanceof e.Instance))throw Error("invalid IInstance");return d}};self.C3_CreateRuntime=e.Runtime.Create;self.C3_InitRuntime=(d,f)=>d.Init(f)}
{"use strict";const e=self.C3;e.JobSchedulerRuntime=class extends e.DefendedBase{constructor(b,a){super();this._runtime=b;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=a.inputPort;a.outputPort.onmessage=c=>this._OnJobWorkerMessage(c);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,c,d,f){c||(c=[]);const h=this._nextJobId++;b={type:b,isBroadcast:!1,jobId:h,params:a,transferables:c};a=new Promise((g,l)=>{this._jobPromises.set(h,{resolve:g,progress:d,reject:l,cancelled:!1})});f&&f.SetAction(()=>this._CancelJob(h));this._inputPort.postMessage(b,c);this._MaybeCreateExtraWorker();return a}BroadcastJob(b,a,c){c||(c=[]);const d=this._nextJobId++;this._inputPort.postMessage({type:b,
isBroadcast:!0,jobId:d,params:a,transferables:c},c)}_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,c=b.jobId;switch(a){case "result":this._OnJobResult(c,b.result);break;case "progress":this._OnJobProgress(c,b.progress);break;case "error":this._OnJobError(c,b.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${a}'`);
}}_OnJobResult(b,a){const c=this._jobPromises.get(b);if(!c)throw Error("invalid job ID");c.cancelled||c.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 c=this._jobPromises.get(b);if(!c)throw Error("invalid job ID");c.cancelled||c.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 e=self.C3;let b=null,a="",c="",d=[],f="",h="",g="";const l=e.New(e.ArrayStack);function m(u,v){u=u[1];v=v[1];if("number"===typeof u&&"number"===typeof v)return u-v;u=""+u;v=""+v;return u<v?-1:u>v?1:0}e.Plugins.System=class extends e.SDKPluginBase{constructor(u){super(u);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(u){this._runtime.Trigger(u,null,null)}GetRegex(u,v){b&&u===a&&v===c||(b=new RegExp(u,v),a=u,c=v);b.lastIndex=0;return b}GetRegexMatches(u,v,t){if(u===f&&v===h&&t===g)return d;const q=this.GetRegex(v,t);d=u.match(q);f=u;h=v;g=t;return d}async _LoadTexturesForObjectClasses(u,v){if(v.length){this._imagesLoadingTotal+=v.length;var t=[];for(const q of v)t.push(u.MaybeLoadTexturesFor(q));await e.PromiseAllWithProgress(t,
()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&(this._runtime.Trigger(e.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(u,v){for(const t of v)0===t.GetInstanceCount()&&u.MaybeUnloadTexturesFor(t)}_GetForEachStack(){return l}_Repeat(u){var v=this._runtime.GetEventSheetManager();const t=v.GetEventStack(),q=t.GetCurrentStackFrame(),
p=q.GetCurrentEvent(),r=p.GetSolModifiers();var x=q.IsSolModifierAfterCnds();const y=t.Push(p),C=v.GetLoopStack(),G=C.Push();G.SetEnd(u);if(x)for(x=0;x<u&&!G.IsStopped();++x)v.PushCopySol(r),G.SetIndex(x),p.Retrigger(q,y),v.PopSol(r);else for(v=0;v<u&&!G.IsStopped();++v)G.SetIndex(v),p.Retrigger(q,y);t.Pop();C.Pop();return!1}*_DebugRepeat(u){var v=this._runtime.GetEventSheetManager();const t=v.GetEventStack(),q=t.GetCurrentStackFrame(),p=q.GetCurrentEvent(),r=p.GetSolModifiers();var x=q.IsSolModifierAfterCnds();
const y=t.Push(p),C=v.GetLoopStack(),G=C.Push();G.SetEnd(u);if(x)for(x=0;x<u&&!G.IsStopped();++x)v.PushCopySol(r),G.SetIndex(x),yield*p.DebugRetrigger(q,y),v.PopSol(r);else for(v=0;v<u&&!G.IsStopped();++v)G.SetIndex(v),yield*p.DebugRetrigger(q,y);t.Pop();C.Pop();return!1}_While(){var u=this._runtime.GetEventSheetManager();const v=u.GetEventStack(),t=v.GetCurrentStackFrame(),q=t.GetCurrentEvent(),p=q.GetSolModifiers();var r=t.IsSolModifierAfterCnds();const x=v.Push(q),y=u.GetLoopStack(),C=y.Push();
if(r)for(r=0;!C.IsStopped();++r)u.PushCopySol(p),C.SetIndex(r),q.Retrigger(t,x)||C.Stop(),u.PopSol(p);else for(u=0;!C.IsStopped();++u)C.SetIndex(u),q.Retrigger(t,x)||C.Stop();v.Pop();y.Pop();return!1}*_DebugWhile(){var u=this._runtime.GetEventSheetManager();const v=u.GetEventStack(),t=v.GetCurrentStackFrame(),q=t.GetCurrentEvent(),p=q.GetSolModifiers();var r=t.IsSolModifierAfterCnds();const x=v.Push(q),y=u.GetLoopStack(),C=y.Push();if(r)for(r=0;!C.IsStopped();++r)u.PushCopySol(p),C.SetIndex(r),(yield*q.DebugRetrigger(t,
x))||C.Stop(),u.PopSol(p);else for(u=0;!C.IsStopped();++u)C.SetIndex(u),(yield*q.DebugRetrigger(t,x))||C.Stop();v.Pop();y.Pop();return!1}_For(u,v,t){var q=this._runtime.GetEventSheetManager();const p=q.GetEventStack(),r=p.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),C=r.IsSolModifierAfterCnds(),G=p.Push(x),A=q.GetLoopStack(),E=A.Push();E.SetName(u);E.SetEnd(t);if(t<v)if(C)for(u=v;u>=t&&!E.IsStopped();--u)q.PushCopySol(y),E.SetIndex(u),x.Retrigger(r,G),q.PopSol(y);else for(q=
v;q>=t&&!E.IsStopped();--q)E.SetIndex(q),x.Retrigger(r,G);else if(C)for(u=v;u<=t&&!E.IsStopped();++u)q.PushCopySol(y),E.SetIndex(u),x.Retrigger(r,G),q.PopSol(y);else for(q=v;q<=t&&!E.IsStopped();++q)E.SetIndex(q),x.Retrigger(r,G);p.Pop();A.Pop();return!1}*_DebugFor(u,v,t){var q=this._runtime.GetEventSheetManager();const p=q.GetEventStack(),r=p.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),C=r.IsSolModifierAfterCnds(),G=p.Push(x),A=q.GetLoopStack(),E=A.Push();E.SetName(u);E.SetEnd(t);
if(t<v)if(C)for(u=v;u>=t&&!E.IsStopped();--u)q.PushCopySol(y),E.SetIndex(u),yield*x.DebugRetrigger(r,G),q.PopSol(y);else for(q=v;q>=t&&!E.IsStopped();--q)E.SetIndex(q),yield*x.DebugRetrigger(r,G);else if(C)for(u=v;u<=t&&!E.IsStopped();++u)q.PushCopySol(y),E.SetIndex(u),yield*x.DebugRetrigger(r,G),q.PopSol(y);else for(q=v;q<=t&&!E.IsStopped();++q)E.SetIndex(q),yield*x.DebugRetrigger(r,G);p.Pop();A.Pop();return!1}_ForEach(u){var v=this._runtime.GetEventSheetManager();const t=v.GetEventStack(),q=t.GetCurrentStackFrame(),
p=q.GetCurrentEvent(),r=p.GetSolModifiers();var x=q.IsSolModifierAfterCnds();const y=t.Push(p),C=v.GetLoopStack(),G=C.Push(),A=u.IsInContainer(),E=u.GetCurrentSol(),J=l.Push();e.shallowAssignArray(J,E.GetInstances());G.SetEnd(J.length);if(x)for(let B=0,I=J.length;B<I&&!G.IsStopped();++B)v.PushCopySol(r),x=J[B],u.GetCurrentSol().SetSinglePicked(x),A&&x.SetSiblingsSinglePicked(),G.SetIndex(B),p.Retrigger(q,y),v.PopSol(r);else{E._SetSelectAll(!1);u=E._GetOwnInstances();e.clearArray(u);u.push(null);for(let B=
0,I=J.length;B<I&&!G.IsStopped();++B)v=J[B],u[0]=v,A&&v.SetSiblingsSinglePicked(),G.SetIndex(B),p.Retrigger(q,y)}t.Pop();C.Pop();e.clearArray(J);l.Pop();return!1}*_DebugForEach(u){var v=this._runtime.GetEventSheetManager();const t=v.GetEventStack(),q=t.GetCurrentStackFrame(),p=q.GetCurrentEvent(),r=p.GetSolModifiers();var x=q.IsSolModifierAfterCnds();const y=t.Push(p),C=v.GetLoopStack(),G=C.Push(),A=u.IsInContainer(),E=u.GetCurrentSol(),J=l.Push();e.shallowAssignArray(J,E.GetInstances());G.SetEnd(J.length);
if(x)for(let B=0,I=J.length;B<I&&!G.IsStopped();++B)v.PushCopySol(r),x=J[B],u.GetCurrentSol().SetSinglePicked(x),A&&x.SetSiblingsSinglePicked(),G.SetIndex(B),yield*p.DebugRetrigger(q,y),v.PopSol(r);else{E._SetSelectAll(!1);u=E._GetOwnInstances();e.clearArray(u);u.push(null);for(let B=0,I=J.length;B<I&&!G.IsStopped();++B)v=J[B],u[0]=v,A&&v.SetSiblingsSinglePicked(),G.SetIndex(B),yield*p.DebugRetrigger(q,y)}t.Pop();C.Pop();e.clearArray(J);l.Pop();return!1}_ForEachOrdered(u,v){var t=this._runtime.GetEventSheetManager();
const q=t.GetEventStack(),p=t.GetCurrentCondition(),r=q.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),C=r.IsSolModifierAfterCnds(),G=q.Push(x),A=t.GetLoopStack(),E=A.Push(),J=u.IsInContainer(),B=u.GetCurrentSol(),I=l.Push();e.clearArray(I);const L=B.GetInstances();E.SetEnd(L.length);for(let P=0,S=L.length;P<S;++P)I.push([L[P],p.ReevaluateParameter(1,P)]);I.sort(m);1===v&&I.reverse();if(C)for(let P=0,S=I.length;P<S&&!E.IsStopped();++P)t.PushCopySol(y),v=I[P][0],u.GetCurrentSol().SetSinglePicked(v),
J&&v.SetSiblingsSinglePicked(),E.SetIndex(P),x.Retrigger(r,G),t.PopSol(y);else{B._SetSelectAll(!1);u=B._GetOwnInstances();e.clearArray(u);u.push(null);for(let P=0,S=I.length;P<S&&!E.IsStopped();++P)t=I[P][0],u[0]=t,J&&t.SetSiblingsSinglePicked(),E.SetIndex(P),x.Retrigger(r,G)}q.Pop();A.Pop();e.clearArray(I);l.Pop();return!1}*_DebugForEachOrdered(u,v){var t=this._runtime.GetEventSheetManager();const q=t.GetEventStack(),p=t.GetCurrentCondition(),r=q.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),
C=r.IsSolModifierAfterCnds(),G=q.Push(x),A=t.GetLoopStack(),E=A.Push(),J=u.IsInContainer(),B=u.GetCurrentSol(),I=l.Push();e.clearArray(I);const L=B.GetInstances();E.SetEnd(L.length);for(let P=0,S=L.length;P<S;++P)I.push([L[P],p.ReevaluateParameter(1,P)]);I.sort(m);1===v&&I.reverse();if(C)for(let P=0,S=I.length;P<S&&!E.IsStopped();++P)t.PushCopySol(y),v=I[P][0],u.GetCurrentSol().SetSinglePicked(v),J&&v.SetSiblingsSinglePicked(),E.SetIndex(P),yield*x.DebugRetrigger(r,G),t.PopSol(y);else{B._SetSelectAll(!1);
u=B._GetOwnInstances();e.clearArray(u);u.push(null);for(let P=0,S=I.length;P<S&&!E.IsStopped();++P)t=I[P][0],u[0]=t,J&&t.SetSiblingsSinglePicked(),E.SetIndex(P),yield*x.DebugRetrigger(r,G)}q.Pop();A.Pop();e.clearArray(I);l.Pop();return!1}_GetFunctionMap(u,v){let t=this._functionMaps.get(u);if(t)return t;if(!v)return null;t={defaultFunc:null,strMap:new Map};this._functionMaps.set(u,t);return t}_DoCallMappedFunction(u,v,t,q,p){v.GetEventBlock().RunAsMappedFunctionCall(t);q&&u.PopSol(p)}*_DebugDoCallMappedFunction(u,
v,t,q,p){yield*v.GetEventBlock().DebugRunAsMappedFunctionCall(t);q&&u.PopSol(p)}}}{"use strict";const e=self.C3;e.Plugins.System.Type=class extends e.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 e=self.C3;e.Plugins.System.Instance=class extends e.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 e=self.C3,b=[];e.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 c=a.get("TriggerOnce_lastTick");"undefined"===typeof c&&(c=-1,a.set("TriggerOnce_lastTick",
-1));const d=this._runtime.GetTickCount();a.set("TriggerOnce_lastTick",d);return this._runtime.IsLayoutFirstTick()||c!==d-1},Every(a){const c=this._runtime.GetCurrentCondition().GetSavedDataMap(),d=c.get("Every_lastTime")||0,f=this._runtime.GetGameTime();c.has("Every_seconds")||c.set("Every_seconds",a);const h=c.get("Every_seconds");if(f>=d+h)return c.set("Every_lastTime",d+h),f>=c.get("Every_lastTime")+.04&&c.set("Every_lastTime",f),c.set("Every_seconds",a),!0;f<d-.1&&c.set("Every_lastTime",f);return!1},
IsGroupActive(a){return(a=this._runtime.GetEventSheetManager().GetEventGroupByName(a))&&a.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return e.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"===e.Platform.Context;
case 1:return"iOS"===e.Platform.OS;case 2:return"Android"===e.Platform.OS;case 8:return"cordova"===e.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===e.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(a,c,d){return this.GetRegex(c,d).test(a)},Compare(a,c,d){return e.compare(a,c,d)},CompareBetween(a,c,d){return a>=c&&a<=d},CompareVar(a,c,d){return e.compare(a.GetValue(),c,d)},CompareBoolVar(a){return!!a.GetValue()},
CompareTime(a,c){const d=this._runtime.GetGameTime();return 0===a?(a=this._runtime.GetCurrentCondition().GetSavedDataMap(),!a.get("CompareTime_executed")&&d>=c?(a.set("CompareTime_executed",!0),!0):!1):e.compare(d,a,c)},IsNaN(a){return isNaN(a)},AngleWithin(a,c,d){return e.angleDiff(e.toRadians(a),e.toRadians(d))<=e.toRadians(c)},IsClockwiseFrom(a,c){return e.angleClockwise(e.toRadians(a),e.toRadians(c))},IsBetweenAngles(a,c,d){a=e.toRadians(a);c=e.toRadians(c);d=e.toRadians(d);return e.angleClockwise(d,
c)?e.angleClockwise(a,c)&&!e.angleClockwise(a,d):!(!e.angleClockwise(a,c)&&e.angleClockwise(a,d))},IsValueType(a,c){return"number"===typeof a?0===c:1===c},EvaluateExpression(a){return!!a},PickByComparison(a,c,d,f){if(!a)return!1;const h=this._GetForEachStack(),g=h.Push(),l=a.GetCurrentSol();e.shallowAssignArray(g,l.GetInstances());l.IsSelectAll()&&e.clearArray(l._GetOwnElseInstances());const m=this._runtime.GetCurrentCondition();let u=0;for(let v=0,t=g.length;v<t;++v){const q=g[v];g[u]=q;c=m.ReevaluateParameter(1,
v);f=m.ReevaluateParameter(3,v);e.compare(c,d,f)?++u:l._PushElseInstance(q)}e.truncateArray(g,u);l.SetArrayPicked(g);c=!!g.length;e.clearArray(g);h.Pop();a.ApplySolToContainer();return c},PickByEvaluate(a,c){if(!a)return!1;const d=this._GetForEachStack(),f=d.Push(),h=a.GetCurrentSol();e.shallowAssignArray(f,h.GetInstances());h.IsSelectAll()&&e.clearArray(h._GetOwnElseInstances());const g=this._runtime.GetCurrentCondition();let l=0;for(let m=0,u=f.length;m<u;++m){const v=f[m];f[l]=v;(c=g.ReevaluateParameter(1,
m))?++l:h._PushElseInstance(v)}e.truncateArray(f,l);h.SetArrayPicked(f);c=!!f.length;e.clearArray(f);d.Pop();a.ApplySolToContainer();return c},PickNth(a,c){if(!a)return!1;const d=a.GetCurrentSol(),f=d.GetInstances();c=Math.floor(c);if(c>=f.length)return!1;d.PickOne(f[c]);a.ApplySolToContainer();return!0},PickRandom(a){if(!a)return!1;const c=a.GetCurrentSol(),d=c.GetInstances(),f=Math.floor(this._runtime.Random()*d.length);if(f>=d.length)return!1;c.PickOne(d[f]);a.ApplySolToContainer();return!0},PickAll(a){if(!a||
!a.GetInstanceCount())return!1;a.GetCurrentSol()._SetSelectAll(!0);a.ApplySolToContainer();return!0},PickOverlappingPoint(a,c,d){if(!a)return!1;const f=a.GetCurrentSol();var h=f.GetInstances();const g=this._runtime.GetCurrentEvent().IsOrBlock(),l=this._runtime.GetCurrentCondition().IsInverted();f.IsSelectAll()?(e.shallowAssignArray(b,h),f.ClearArrays(),f._SetSelectAll(!1)):g?(e.shallowAssignArray(b,f._GetOwnElseInstances()),e.clearArray(f._GetOwnElseInstances())):(e.shallowAssignArray(b,f._GetOwnInstances()),
e.clearArray(f._GetOwnInstances()));for(let m=0,u=b.length;m<u;++m)h=b[m],e.xor(h.GetWorldInfo().ContainsPoint(c,d),l)?f._PushInstance(h):f._PushElseInstance(h);a.ApplySolToContainer();return e.xor(!!f._GetOwnInstances().length,l)},PickLastCreated(a){if(!a)return!1;var c=a.IsFamily();let d=null;const f=this._runtime._GetInstancesPendingCreate();for(let h=f.length-1;0<=h;--h){const g=f[h];if(c){if(g.GetObjectClass().BelongsToFamily(a)){d=g;break}}else if(g.GetObjectClass()===a){d=g;break}}d||(c=a.GetInstances(),
c.length&&(d=c.at(-1)));if(!d)return!1;a.GetCurrentSol().PickOne(d);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,c,d){return this._runtime.IsDebugging()?this._DebugFor(a,c,d):this._For(a,c,d)},ForEach(a){return this._runtime.IsDebugging()?this._DebugForEach(a):this._ForEach(a)},ForEachOrdered(a,c,d){return this._runtime.IsDebugging()?this._DebugForEachOrdered(a,
d):this._ForEachOrdered(a,d)},LayerVisible(a){return a?a.IsVisible():!1},LayerEmpty(a){return a?!a.GetInstanceCount():!1},LayerCmpOpacity(a,c,d){return a?e.compare(100*a.GetOpacity(),c,d):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}}
{"use strict";const e=self.C3;function b(g,l){const m=g[0]-l[0];return 0!==m?m:g[1]-l[1]}function a(g,l){return g[1]-l[1]}const c=[],d=[],f=e.New(e.Rect),h=e.New(e.Color);e.Plugins.System.Acts={SetVar(g,l){g.SetValue(l)},AddVar(g,l){g.IsNumber()&&"number"!==typeof l&&(l=parseFloat(l));g.SetValue(g.GetValue()+l)},SubVar(g,l){g.IsNumber()&&g.SetValue(g.GetValue()-l)},SetBoolVar(g,l){g.SetValue(!!l)},ToggleBoolVar(g){g.SetValue(!g.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},
CreateObject(g,l,m,u,v){g&&l&&(m=this._runtime.CreateInstance(g,l,m,u,v))&&(v&&l.SortAndAddInstancesByZIndex(m),l=this._runtime.GetEventSheetManager(),l.BlockFlushingInstances(!0),m._TriggerOnCreatedOnSelfAndRelated(),l.BlockFlushingInstances(!1),g.GetCurrentSol().SetSinglePicked(m),m.IsInContainer()&&m.SetSiblingsSinglePicked())},CreateObjectByName(g,l,m,u,v){g&&l&&(g=this._runtime.GetObjectClassByName(g))&&e.Plugins.System.Acts.CreateObject.call(this,g,l,m,u,v)},RecreateInitialObjects(g,l,m,u,v,
t,q,p,r,x){if(g){var y=this._runtime.GetCurrentLayout();if(t&&(y=this._runtime.GetLayoutManager().GetLayoutByName(t),!y))return;t=null;if("number"!==typeof q||0<=q)if(t=y.GetLayer(q),!t)return;f.set(l,m,u,v);l=y.RecreateInitialObjects(g,f,t,p,r,x);g.GetCurrentSol().SetArrayPicked(l);g.ApplySolToContainer()}},StopLoop(){const g=this._loopStack;g.IsInLoop()&&g.GetCurrent().Stop()},SetGroupActive(g,l){(g=this._runtime.GetEventSheetManager().GetEventGroupByName(g))&&(0===l?g.SetGroupActive(!1):1===l?
g.SetGroupActive(!0):g.SetGroupActive(!g.IsGroupActive()))},SetTimescale(g){this._runtime.SetTimeScale(g)},SetObjectTimescale(g,l){0>l&&(l=0);if(g){g=g.GetCurrentSol().GetInstances();for(const m of g)m.SetTimeScale(l)}},RestoreObjectTimescale(g){if(g){g=g.GetCurrentSol().GetInstances();for(const l of g)l.RestoreTimeScale()}},Wait(g){if(!(0>g))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(g),!0},WaitForSignal(g){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(g);
return!0},WaitForPreviousActions(){const g=this._runtime.GetEventSheetManager();g.AddScheduledWait().InitPromise(g.GetPromiseForAllAsyncActions());return!0},Signal(g){g=g.toLowerCase();for(const l of this._runtime.GetEventSheetManager().scheduledWaits())l.IsSignal()&&l.GetSignalTag()===g&&l.SetSignalled()},async SnapshotCanvas(g,l,m,u,v,t){const q=this._runtime.GetCanvasManager();q&&(this.UpdateRender(),await q.SnapshotCanvas(0===g?"image/png":"image/jpeg",l/100,m,u,v,t),await this._runtime.TriggerAsync(e.Plugins.System.Cnds.OnCanvasSnapshot,
null))},SetCanvasSize(g,l){if(!(0>=g||0>=l)){this._runtime.SetViewportSize(g,l);var m=this._runtime.GetCurrentLayout();m.BoundScrolling();for(const u of m.GetLayers())u.UpdateViewport();if(m=this._runtime.GetCanvasManager())"off"!==m.GetCurrentFullscreenMode()&&this._runtime.SetOriginalViewportSize(g,l),m.SetSize(m.GetLastWidth(),m.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(g){const l=this._runtime.GetCanvasManager();l&&"off"!==l.GetCurrentFullscreenMode()&&(l.SetFullscreenScalingQuality(0!==
g?"high":"low"),l.SetSize(l.GetLastWidth(),l.GetLastHeight(),!0))},SaveState(g){this._runtime.SaveToSlot(g)},LoadState(g){this._runtime.LoadFromSlot(g)},LoadStateJSON(g){this._runtime.LoadFromJsonString(g)},SetHalfFramerateMode(g){},ResetPersisted(){for(const g of this._runtime.GetLayoutManager().GetAllLayouts())g.ResetPersistData()},SetPixelRounding(g){this._runtime.SetPixelRoundingEnabled(0!==g)},SetMinimumFramerate(g){this._runtime.SetMinimumFramerate(g)},SortZOrderByInstVar(g,l){if(g){var m=g.GetCurrentSol().GetInstances(),
u=this._runtime.GetCurrentLayout(),v=g.IsFamily();g=g.GetFamilyIndex();for(let q=0,p=m.length;q<p;++q){var t=m[q];const r=t.GetWorldInfo();if(!r)continue;let x;x=v?t.GetInstanceVariableValue(l+t.GetObjectClass().GetFamilyInstanceVariableOffset(g)):t.GetInstanceVariableValue(l);c.push([r.GetLayer().GetIndex(),r.GetZIndex()]);d.push([t,x])}if(c.length){c.sort(b);d.sort(a);l=!1;for(let q=0,p=c.length;q<p;++q)m=d[q][0],v=u.GetLayerByIndex(c[q][0]),g=c[q][1],t=v._GetInstances(),t[g]!==m&&(t[g]=m,m.GetWorldInfo()._SetLayer(v),
v.SetZIndicesChanged(),l=!0);l&&this._runtime.UpdateRender();e.clearArray(c);e.clearArray(d)}}},GoToLayout(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||l.ChangeMainLayout(g)}},GoToLayoutByName(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||(g=l.GetLayoutByName(g))&&l.ChangeMainLayout(g)}},NextPrevLayout(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();if(!l.IsPendingChangeMainLayout()){var m=
l.GetAllLayouts(),u=m.indexOf(l.GetMainRunningLayout());g&&0===u||(g||u!==m.length-1)&&l.ChangeMainLayout(m[u+(g?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var g=this._runtime.GetLayoutManager();g.IsPendingChangeMainLayout()||(g.ChangeMainLayout(g.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(g,l){g&&g.SetVisible(l)},SetLayerOpacity(g,l){g&&g.SetOpacity(l/100)},SetLayerScale(g,l){g&&g.SetOwnScale(l)},SetLayerScaleRate(g,
l){g&&g.SetScaleRate(l)},SetLayerAngle(g,l){g&&g.SetAngle(e.toRadians(+l))},SetLayerScroll(g,l,m){g&&(g.SetOwnScrollPositionEnabled(!0),g.SetScrollX(l),g.SetScrollY(m))},RestoreLayerScroll(g){g&&g.SetOwnScrollPositionEnabled(!1)},SetLayerParallax(g,l,m){g&&g.SetParallax(l/100,m/100)},SetLayerZElevation(g,l){g&&g.SetZElevation(+l)},SetLayerBackground(g,l){g&&(h.setFromRgbValue(l),h.clamp(),g=g.GetBackgroundColor(),g.equalsIgnoringAlpha(h)||(g.copyRgb(h),this.UpdateRender()))},SetLayerTransparent(g,
l){g&&g.SetTransparent(l)},SetLayerBlendMode(g,l){g&&g.SetBlendMode(l)},SetLayerEffectEnabled(g,l,m){g&&(m=g.GetEffectList().GetEffectTypeByName(m))&&(l=1===l,m.IsActive()!==l&&(m.SetActive(l),g.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(g,l,m,u){if(g&&(g=g.GetEffectList(),l=g.GetEffectTypeByName(l))){var v=l.GetIndex();g=g.GetEffectParametersForIndex(v);m=Math.floor(m);if(!(0>m||m>=g.length)){v=l.GetShaderProgram().GetParameterType(m);if("color"===v){h.setFromRgbValue(u);
m=g[m];if(h.equalsIgnoringAlpha(m))return;m.copyRgb(h)}else{"percent"===v&&(u/=100);if(g[m]===u)return;g[m]=u}l.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(g,l){g&&g.SetForceOwnTexture(l)},SetLayoutScale(g){this._runtime.GetCurrentLayout().SetScale(+g)},SetLayoutAngle(g){this._runtime.GetCurrentLayout().SetAngle(e.toRadians(+g))},SetLayoutEffectEnabled(g,l){const m=this._runtime.GetCurrentLayout();if(l=m.GetEffectList().GetEffectTypeByName(l))g=1===g,l.IsActive()!==g&&(l.SetActive(g),
m.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(g,l,m){var u=this._runtime.GetCurrentLayout().GetEffectList();if(g=u.GetEffectTypeByName(g)){var v=g.GetIndex();u=u.GetEffectParametersForIndex(v);l=Math.floor(l);if(!(0>l||l>=u.length)){v=g.GetShaderProgram().GetParameterType(l);if("color"===v){h.setFromRgbValue(m);l=u[l];if(h.equalsIgnoringAlpha(l))return;l.copyRgb(h)}else{"percent"===v&&(m/=100);if(u[l]===m)return;u[l]=m}g.IsActive()&&this._runtime.UpdateRender()}}},SetLayoutVanishingPoint(g,
l){this._runtime.GetCurrentLayout().SetVanishingPointXY(g/100,l/100)},SetLayoutProjection(g){const l=this._runtime.GetCurrentLayout();0===g?l.SetPerspectiveProjection():l.SetOrthographicProjection()},ScrollX(g){this._runtime.GetCurrentLayout().SetScrollX(g)},ScrollY(g){this._runtime.GetCurrentLayout().SetScrollY(g)},Scroll(g,l){const m=this._runtime.GetCurrentLayout();m.SetScrollX(g);m.SetScrollY(l)},ScrollToObject(g){if(g&&(g=g.GetFirstPicked())&&(g=g.GetWorldInfo())){var l=this._runtime.GetCurrentLayout();
l.SetScrollX(g.GetX());l.SetScrollY(g.GetY())}},async LoadObjectTextures(g){const l=this._runtime.GetMainRunningLayout();l&&g&&!this._runtime.IsLoading()&&(g=g.IsFamily()?g.GetFamilyMembers():[g],await this._LoadTexturesForObjectClasses(l,g))},async LoadObjectTexturesByName(g){await e.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(g))},UnloadObjectTextures(g){const l=this._runtime.GetMainRunningLayout();l&&g&&(g=g.IsFamily()?g.GetFamilyMembers():[g],this._UnloadTexturesForObjectClasses(l,
g))},UnloadObjectTexturesByName(g){e.Plugins.System.Acts.UnloadObjectTextures.call(this,this._runtime.GetObjectClassByName(g))},UnloadUnusedTextures(){const g=this._runtime.GetMainRunningLayout();if(g){var l=g._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(g,l)}},async LoadLayoutTextures(g){const l=this._runtime.GetMainRunningLayout();g&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,g._GetInitialObjectClasses())},async LoadLayoutTexturesByName(g){const l=
this._runtime.GetMainRunningLayout();(g=this._runtime.GetLayoutManager().GetLayoutByName(g))&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,g._GetInitialObjectClasses())},SetFunctionReturnValue(g){const l=this._eventStack.GetCurrentExpFuncStackFrame();if(l)switch(l.GetFunctionReturnType()){case 1:"number"===typeof g&&l.SetFunctionReturnValue(g);break;case 2:"string"===typeof g&&l.SetFunctionReturnValue(g);break;case 3:l.SetFunctionReturnValue(g)}},MapFunction(g,l,m){var u=
this._GetFunctionMap(g.toLowerCase(),!0);const v=u.strMap,t=l.toLowerCase();v.has(t)&&console.warn(`[Construct 3] Function map '${g}' string '${l}' already in map; overwriting entry`);if(u=e.first(v.values())||u.defaultFunc){u=0!==u.GetReturnType();const q=0!==m.GetReturnType();if(u!==q){console.error(`[Construct 3] Function map '${g}' string '${l}' function return type not compatible with other functions in the map; entry ignored`);return}}v.set(t,m)},MapFunctionDefault(g,l){const m=this._GetFunctionMap(g.toLowerCase(),
!0);m.defaultFunc&&console.warn(`[Construct 3] Function map '${g}' already has a default; overwriting entry`);var u=e.first(m.strMap.values())||m.defaultFunc;if(u){u=0!==u.GetReturnType();const v=0!==l.GetReturnType();if(u!==v){console.error(`[Construct 3] Function map '${g}' default: function return type not compatible with other functions in the map; entry ignored`);return}}m.defaultFunc=l},CallMappedFunction(g,l,m){m=Math.floor(m);var u=this._GetFunctionMap(g.toLowerCase(),!1);if(u){var v=u.strMap.get(l.toLowerCase());
if(!v)if(u.defaultFunc)v=u.defaultFunc,m=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${g}' string '${l}'; call ignored (consider setting a default)`);return}if(v.IsEnabled())if(0!==v.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${g}' string '${l}' has a return type so cannot be called`);else{g=this._runtime;l=g.GetEventSheetManager();var t=l.GetCurrentEvent();u=t.GetSolModifiersIncludingParents();var q=0<u.length;q&&l.PushCleanSol(u);
var p=[];if(t=l.FindFirstFunctionBlockParent(t)){t=t.GetFunctionParameters();for(let r=m,x=t.length;r<x;++r)p.push(t[r].GetValue())}m=v.GetFunctionParameters();for(let r=p.length,x=m.length;r<x;++r)p.push(m[r].GetInitialValue());return g.IsDebugging()?this._DebugDoCallMappedFunction(l,v,p,q,u):this._DoCallMappedFunction(l,v,p,q,u)}}else console.warn(`[Construct 3] Call mapped function: map name '${g}' not found; call ignored`)}}}
{"use strict";const e=self.C3;e.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)},roundtodp(b,a){a=Math.max(Math.floor(a),0);a=Math.pow(10,a);return Math.round((b+Number.EPSILON)*a)/a},floor(b){return Math.floor(b)},ceil(b){return Math.ceil(b)},sign(b){return Math.sign(b)},sin(b){return Math.sin(e.toRadians(b))},cos(b){return Math.cos(e.toRadians(b))},tan(b){return Math.tan(e.toRadians(b))},asin(b){return e.toDegrees(Math.asin(b))},acos(b){return e.toDegrees(Math.acos(b))},atan(b){return e.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 c=1,d=b.length;c<d;++c){let f=b[c];"number"===typeof f&&a<f&&(a=f)}return a},min(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let c=1,d=b.length;c<d;++c){let f=b[c];"number"===typeof f&&a>f&&(a=f)}return a},clamp(b,a,c){return e.clamp(b,a,c)},distance(b,a,c,d){return e.distanceTo(b,a,c,d)},angle(b,a,c,d){return e.toDegrees(e.angleTo(b,a,c,d))},lerp(b,
a,c){return e.lerp(b,a,c)},unlerp(b,a,c){return e.unlerp(b,a,c)},qarp(b,a,c,d){return e.qarp(b,a,c,d)},cubic(b,a,c,d,f){return e.cubic(b,a,c,d,f)},cosp(b,a,c){return e.cosp(b,a,c)},anglediff(b,a){return e.toDegrees(e.angleDiff(e.toRadians(b),e.toRadians(a)))},anglelerp(b,a,c){return e.toDegrees(e.angleLerp(e.toRadians(b),e.toRadians(a),c))},anglerotate(b,a,c){return e.toDegrees(e.angleRotate(e.toRadians(b),e.toRadians(a),e.toRadians(c)))},setbit(b,a,c){a|=0;return(b|0)&~(1<<a)|(0!==c?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,c){return"string"!==typeof b?"":0>c?b.substr(a):b.substr(a,c)},right(b,a){return"string"===typeof b?b.substr(Math.max(b.length-a,0)):""},trim(b){return"string"===typeof b?b.trim():""},tokenat(b,a,c){if("string"!==typeof b||"string"!==typeof c)return"";
b=b.split(c);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(e.EscapeRegex(a),"i")):-1},findcase(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(e.EscapeRegex(a),"")):-1},replace(b,a,c){return"string"===typeof b&&"string"===typeof a&&"string"===typeof c?b.replace(new RegExp(e.EscapeRegex(a),"gi"),c):"string"===
typeof b?b:""},regexsearch(b,a,c){a=this.GetRegex(a,c);return b?b.search(a):-1},regexreplace(b,a,c,d){a=this.GetRegex(a,c);return b?b.replace(a,d):""},regexmatchcount(b,a,c){return(b=this.GetRegexMatches(b.toString(),a,c))?b.length:0},regexmatchat(b,a,c,d){d=Math.floor(d);b=this.GetRegexMatches(b.toString(),a,c);return!b||0>d||d>=b.length?"":b[d]},zeropad(b,a){let c=0>b?"-":"";0>b&&(b=-b);c+="0".repeat(Math.max(a-b.toString().length,0));return c+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 e.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.GetViewport3D().getLeft():
0},viewporttop(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getTop():0},viewportright(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getRight():0},viewportbottom(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getBottom():0},viewportwidth(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().width():0},viewportheight(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().height():
0},canvastolayerx(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,c)[0]:0},canvastolayery(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,c)[1]:0},layertocanvasx(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,c)[0]:0},layertocanvasy(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,c)[1]:0},layerscale(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetOwnScale():
0},layerangle(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?e.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},layerscrollx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScrollX():0},layerscrolly(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScrollY():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,...c){var d=this._GetFunctionMap(b.toLowerCase(),!1);if(!d)return console.warn(`[Construct 3] Call mapped function: map name '${b}' not found; returning 0`),0;var f=d.strMap.get(a.toLowerCase());if(!f)if(d.defaultFunc)f=d.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;d=f.GetReturnType();const h=
f.GetDefaultReturnValue();if(0===d)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(!f.IsEnabled())return h;b=this._runtime.GetEventSheetManager();a=b.GetCurrentEvent().GetSolModifiersIncludingParents();const g=0<a.length;g&&b.PushCleanSol(a);const l=f.GetFunctionParameters();for(let m=c.length,u=l.length;m<u;++m)c.push(l[m].GetInitialValue());f=f.GetEventBlock();c=f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),
d,h,...c);g&&b.PopSol(a);return c},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return this._runtime.GetWebGPURenderer()?"webgpu":"webgl"},rendererdetail(){return this._runtime.GetWebGPURenderer()?"<unavailable>":this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let b=this._runtime.GetRenderer().GetEstimatedTextureMemoryUsage();
return Math.round(100*b/1048576)/100},rgb(b,a,c){return e.PackRGB(b,a,c)},rgbex(b,a,c){return e.PackRGBEx(b/100,a/100,c/100)},rgba(b,a,c,d){return e.PackRGBAEx(b/100,a/100,c/100,d/100)},rgbex255(b,a,c){return e.PackRGBEx(b/255,a/255,c/255)},rgba255(b,a,c,d){return e.PackRGBAEx(b/255,a/255,c/255,d/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 e=self.C3;e.Plugins.Sprite=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.Sprite.Type=class extends e.SDKTypeBase{constructor(b){super(b);this._animations=b.GetAnimations()}Release(){e.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(c=>c.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){e.Plugins.Sprite.FinishCollisionCondition(this,
b)}}}
{"use strict";const e=self.C3,b=self.C3X,a=e.New(e.Rect),c=e.New(e.Quad),d=e.New(e.Vector2);e.Plugins.Sprite.Instance=class extends e.SDKWorldInstanceBase{constructor(g,l){super(g);let m=!0,u="",v=0,t=!0;l&&(m=!!l[0],u=l[1],v=l[2],t=l[3]);this._currentAnimation=this._objectClass.GetAnimationByName(u)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=e.clamp(v,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);l=
this._currentAnimationFrame.GetImageInfo();this._currentTexture=l.GetTexture();this._currentRcTex=l.GetTexRect();this._currentQuadTex=l.GetTexQuad();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=e.New(e.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(t);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()}IsOriginalSizeKnown(){return!0}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(g){var l=this._currentTexture;null!==l&&(g.SetTexture(l),l=this.GetWorldInfo(),l.HasMesh()?this._DrawMesh(l,g):this._DrawStandard(l,g))}_DrawStandard(g,l){let m=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&&
(m=g.PixelRoundQuad(m));l.Quad4(m,this._currentQuadTex)}_DrawMesh(g,l){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(a,c,!1);let u=c;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));m.CalculateTransformedMesh(g.GetSourceMesh(),u,this._currentQuadTex);g.SetMeshChanged(!1)}m.Draw(l)}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 l=this._runtime.GetDt(this._inst);this._animationTimer.Add(l);l=this.GetAnimationTime();var m=this._currentAnimationFrame,u=m.GetDuration()/g;if(!(l<this._frameStartTime+u)){var v=this._currentAnimation,
t=this._currentAnimationRepeatTo,q=v.GetFrameCount(),p=v.GetRepeatCount(),r=v.IsLooping(),x=v.IsPingPong();this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=u;this._currentFrameIndex>=q&&(x?(this.SetPlayingForwards(!1),this._currentFrameIndex=q-2):r?this._currentFrameIndex=t:(this._animationRepeats++,this._animationRepeats>=p?this._FinishAnimation(!1):this._currentFrameIndex=t));0>this._currentFrameIndex&&(x?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),
r||(this._animationRepeats++,this._animationRepeats>=p&&this._FinishAnimation(!0))):r?this._currentFrameIndex=t:(this._animationRepeats++,this._animationRepeats>=p?this._FinishAnimation(!0):this._currentFrameIndex=t));this._currentFrameIndex=e.clamp(this._currentFrameIndex,0,q-1);u=v.GetFrameAt(this._currentFrameIndex);l>this._frameStartTime+u.GetDuration()/g&&(this._frameStartTime=l);this._OnFrameChanged(m,u)}}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.DispatchScriptEvent("animationend",!1,{animationName:this._animTriggerName});this.Trigger(e.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(e.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(g,l){if(g!==l){var m=this.GetWorldInfo(),u=g.GetImageInfo(),v=l.GetImageInfo(),t=u.GetWidth();u=u.GetHeight();var q=v.GetWidth(),
p=v.GetHeight();t!==q&&m.SetWidth(m.GetWidth()*(q/t));u!==p&&m.SetHeight(m.GetHeight()*(p/u));m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());m.SetBboxChanged();this._currentAnimationFrame=l;this._currentTexture=v.GetTexture();this._currentRcTex=v.GetTexRect();this._currentQuadTex=v.GetTexQuad();m=this.GetInstance().GetBehaviorInstances();for(let r=0,x=m.length;r<x;++r)m[r].OnSpriteFrameChanged(g,l);this.DispatchScriptEvent("framechange",!1,
{animationName:this._currentAnimation.GetName(),animationFrame:this._currentFrameIndex});this.Trigger(e.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,l){this._changeAnimationName=g;this._changeAnimationFrom=l;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=e.clamp(Math.floor(g),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const g=this._currentAnimationFrame;var l=this._objectClass.GetAnimationByName(this._changeAnimationName);this._changeAnimationName="";!l||l===this._currentAnimation&&this.IsAnimationPlaying()||(this._currentAnimation=l,this.SetPlayingForwards(0<=l.GetSpeed()),this._currentAnimationSpeed=
Math.abs(l.GetSpeed()),this._currentAnimationRepeatTo=l.GetRepeatTo(),this._currentFrameIndex=e.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex=0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,l))}_DoChangeAnimFrame(){const g=this._currentAnimationFrame;var l=this._currentFrameIndex;this._currentFrameIndex=
e.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;l!==this._currentFrameIndex&&(l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,l),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const g=this._currentAnimationFrame.GetImageInfo();this._currentTexture=g.GetTexture();this._currentRcTex=g.GetTexRect();this._currentQuadTex=g.GetTexQuad();this.GetWorldInfo().SetMeshChanged(!0)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetTexQuad(){return this._currentQuadTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(g){const l=
this._currentAnimationFrame,m=this.GetWorldInfo();if("string"===typeof g)g=l.GetImagePointByName(g);else if("number"===typeof g)g=l.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 [u,v]=m.GetSourceMesh().TransformPoint(d.getX(),d.getY());d.set(u,v)}d.offset(-l.GetOriginX(),-l.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 l=this.GetWorldInfo();var m=l.GetTransformedCollisionPoly();const u=m.pointCount();g===u&&(g=0);if(0>g||g>=u)return[0,0];m=m.pointsArr();return[m[2*g]+l.GetX(),m[2*g+1]+l.GetY()]}GetDebuggerProperties(){const g=e.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:l=>this.CallAction(g.SetAnim,l,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",
value:this._currentFrameIndex,onedit:l=>this.CallAction(g.SetAnimFrame,l)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:l=>l?this.CallAction(g.StartAnim,0):this.CallAction(g.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:l=>this.CallAction(g.SetAnimSpeed,l)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:l=>this._animationRepeats=
l}]}]}SaveToJson(){const g={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&(g.fs=this._frameStartTime);var l=this.GetAnimationTime();0!==l&&(g.at=l);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());l=this.GetWorldInfo();l.IsCollisionEnabled()&&(g.ce=l.IsCollisionEnabled());return g}LoadFromJson(g){var l=this.GetObjectClass().GetAnimationBySID(g.a);l&&(this._currentAnimation=l);this._frameStartTime=g.hasOwnProperty("fs")?g.fs:0;this._animationTimer.Set(g.hasOwnProperty("at")?g.at:0);l=g.hasOwnProperty("f")?g.f:0;this._currentFrameIndex=e.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=g.hasOwnProperty("cas")?g.cas:0;this._animationRepeats=
g.hasOwnProperty("ar")?g.ar:1;l=g.hasOwnProperty("rt")?g.rt:0;this._currentAnimationRepeatTo=e.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(g.hasOwnProperty("ap")?!!g.ap:!0);this.SetPlayingForwards(g.hasOwnProperty("af")?!!g.af:!0);this._currentAnimationFrame=l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._UpdateCurrentTexture();const m=this.GetWorldInfo();m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());
m.SetCollisionEnabled(!!g.ce)}GetPropertyValueByIndex(g){const l=this.GetWorldInfo();switch(g){case 3:return l.IsCollisionEnabled();case 2:return e.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1)}}SetPropertyValueByIndex(g,l){var m=this.GetWorldInfo();switch(g){case 3:m.SetCollisionEnabled(!!l);break;case 2:this.SetAnimationPlaying(!1);g=this._currentAnimation.GetFrameCount()-1;m=l=e.clamp(l,0,g);l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const u=this._currentAnimation.GetFrameAt(m);
this._OnFrameChanged(l,u);this._currentFrameIndex=e.clamp(m,0,g)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const f=new WeakMap,h=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();f.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return f.get(this).GetImagePointCount()}getImagePointX(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)[0]}getImagePointY(g){if("string"!==
typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)[1]}getImagePoint(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)}getPolyPointCount(){return f.get(this).GetCollisionPolyPointCount()}getPolyPointX(g){b.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)[0]}getPolyPointY(g){b.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)[1]}getPolyPoint(g){b.RequireFiniteNumber(g);
return f.get(this).GetCollisionPolyPoint(g)}stopAnimation(){f.get(this).SetAnimationPlaying(!1)}startAnimation(g="current-frame"){b.RequireString(g);g=h.get(g);if("undefined"===typeof g)throw Error("invalid mode");f.get(this)._StartAnim(g)}setAnimation(g,l="beginning"){b.RequireString(g);b.RequireString(l);l=h.get(l);if("undefined"===typeof l)throw Error("invalid mode");f.get(this)._SetAnim(g,l)}get animationName(){return f.get(this)._GetCurrentAnimationName()}set animationFrame(g){b.RequireFiniteNumber(g);
f.get(this)._SetAnimFrame(g)}get animationFrame(){return f.get(this)._GetAnimFrame()}set animationSpeed(g){b.RequireFiniteNumber(g);f.get(this)._SetAnimSpeed(g)}get animationSpeed(){return f.get(this)._GetAnimSpeed()}set animationRepeatToFrame(g){b.RequireFiniteNumber(g);f.get(this)._SetAnimRepeatToFrame(g)}get animationRepeatToFrame(){return f.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return f.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return f.get(this).GetCurrentImageInfo().GetHeight()}}}
{"use strict";const e=self.C3;e.Plugins.Sprite.Cnds={IsAnimPlaying(b){return e.equalsNoCase(this._GetCurrentAnimationName(),b)},CompareFrame(b,a){return e.compare(this._currentFrameIndex,b,a)},CompareAnimSpeed(b,a){return e.compare(this._GetAnimSpeed(),b,a)},OnAnimFinished(b){return e.equalsNoCase(this._animTriggerName,b)},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 e=self.C3;e.Plugins.Sprite.Acts={Spawn(b,a,c,d){if(b&&a){var [f,h]=this.GetImagePoint(c);if(c=this._runtime.CreateInstance(b,a,f,h,d)){d&&a.SortAndAddInstancesByZIndex(c);b.GetPlugin().IsRotatable()&&(a=c.GetWorldInfo(),a.SetAngle(this.GetWorldInfo().GetAngle()),a.SetBboxChanged());a=this._runtime.GetEventSheetManager();a.BlockFlushingInstances(!0);c._TriggerOnCreatedOnSelfAndRelated();a.BlockFlushingInstances(!1);d=this._runtime.GetCurrentAction().GetSavedDataMap();a=!1;if(!d.has("Spawn_LastExec")||
d.get("Spawn_LastExec")<this._runtime.GetExecCount())a=!0,d.set("Spawn_LastExec",this._runtime.GetExecCount());if(b!==this.GetObjectClass()&&(b=b.GetCurrentSol(),b._SetSelectAll(!1),b=b._GetOwnInstances(),a&&e.clearArray(b),b.push(c),c.IsInContainer()))for(const g of c.siblings())c=g.GetObjectClass().GetCurrentSol(),a?c.SetSinglePicked(g):(c._SetSelectAll(!1),c._PushInstance(g))}}},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(),c=a.GetWidth();b=Math.abs(c)*(0===b?-1:1);c!==b&&(a.SetWidth(b),a.SetBboxChanged())},SetFlipped(b){const a=this.GetWorldInfo(),c=a.GetHeight();b=Math.abs(c)*(0===b?-1:1);c!==b&&(a.SetHeight(b),a.SetBboxChanged())},SetScale(b){const a=this._currentAnimationFrame.GetImageInfo(),c=this.GetWorldInfo();var d=0>c.GetWidth()?-1:1;const f=0>c.GetHeight()?-1:1;d*=a.GetWidth()*
b;b=a.GetHeight()*b*f;if(c.GetWidth()!==d||c.GetHeight()!==b)c.SetSize(d,b),c.SetBboxChanged()},async LoadURL(b,a,c){c=this._currentAnimationFrame.GetImageInfo();const d=this.GetWorldInfo(),f=this._runtime;if(c.GetURL()===b)0===a&&(d.SetSize(c.GetWidth(),c.GetHeight()),d.SetBboxChanged()),this.Trigger(e.Plugins.Sprite.Cnds.OnURLLoaded);else{var h=e.New(e.ImageInfo);try{await h.LoadDynamicAsset(f,b);if(!h.IsLoaded())throw Error("image failed to load");await h.LoadStaticTexture(f.GetRenderer(),{sampling:this._runtime.GetSampling()})}catch(g){console.error("Load image from URL failed: ",
g);this.Trigger(e.Plugins.Sprite.Cnds.OnURLFailed);return}c.ReplaceWith(h);this._sdkType._UpdateAllCurrentTexture();this.WasReleased()||0!==a||(d.SetSize(c.GetWidth(),c.GetHeight()),d.SetBboxChanged());f.UpdateRender();this.WasReleased()||await this.TriggerAsync(e.Plugins.Sprite.Cnds.OnURLLoaded)}},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(e){return this.GetImagePoint(e)[0]},ImagePointY(e){return this.GetImagePoint(e)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},
ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(e){return this.GetCollisionPolyPoint(e)[0]},PolyPointYAt(e){return this.GetCollisionPolyPoint(e)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};{"use strict";const e=self.C3;e.Plugins.NinePatch=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.NinePatch.Type=class extends e.SDKTypeBase{constructor(b){super(b);this._drawable=this._textureSet=null}Release(){this.ReleaseTextures();super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}async LoadTextures(b){this._drawable=await this.GetImageInfo().ExtractImageToCanvas()}CreatePatch(b,a,c,d){!this._textureSet&&this._drawable&&(this._textureSet=new self.NinePatchTextureSet(this),this._textureSet.CreateTextures(this._drawable,b,a,c,d))}ReleaseTextures(){this._textureSet&&
(this._textureSet.Release(),this._textureSet=null)}GetTextureSet(){return this._textureSet}}}
{"use strict";const e=self.C3,b=e.New(e.Rect),a=e.New(e.Rect),c=e.New(e.Quad);e.Plugins.NinePatch.Instance=class extends e.SDKWorldInstanceBase{constructor(d,f){super(d);this._bottomMargin=this._topMargin=this._rightMargin=this._leftMargin=16;this._fill=this._edges=1;this._isSeamless=!0;this._callback3d=null;f&&(this._leftMargin=f[0],this._rightMargin=f[1],this._topMargin=f[2],this._bottomMargin=f[3],this._edges=f[4],this._fill=f[5],this._isSeamless=!!f[8],this.GetWorldInfo().SetVisible(!!f[6]));
this._sdkType.CreatePatch(this._leftMargin,this._rightMargin,this._topMargin,this._bottomMargin)}Release(){super.Release()}_Set3DCallback(d){this._callback3d=d}Draw(d){const f=this.GetWorldInfo(),h=f.GetBoundingQuad();this._Draw(d,h.getTlx(),h.getTly(),f.GetWidth(),f.GetHeight())}_Draw(d,f,h,g,l){let m=this._sdkType.GetTextureSet();if(!m&&(this._sdkType.CreatePatch(this._leftMargin,this._rightMargin,this._topMargin,this._bottomMargin),m=this._sdkType.GetTextureSet(),!m))return;const u=this._leftMargin,
v=this._rightMargin,t=this._topMargin,q=this._bottomMargin;var p=m.GetImageWidth(),r=m.GetImageHeight();p-=v;r-=q;var x=this._isSeamless?1:0;const y=this._edges,C=this._fill;0<u&&0<t&&this._DrawPatch(d,m.GetTexture(),0,0,u+x,t+x,f,h,u+x,t+x);0<v&&0<t&&this._DrawPatch(d,m.GetTexture(),p-x,0,v+x,t+x,f+g-v-x,h,v+x,t+x);0<v&&0<q&&this._DrawPatch(d,m.GetTexture(),p-x,r-x,v+x,q+x,f+g-v-x,h+l-q-x,v+x,q+x);0<u&&0<q&&this._DrawPatch(d,m.GetTexture(),0,r-x,u+x,q+x,f,h+l-q-x,u+x,q+x);0===y?(x=2===C?0:x,0<u&&
r>t&&this._TilePatch(d,m.GetLeftTexture(),f,h+t,u+x,l-t-q,0,0),0<v&&r>t&&this._TilePatch(d,m.GetRightTexture(),f+g-v-x,h+t,v+x,l-t-q,x,0),0<t&&p>u&&this._TilePatch(d,m.GetTopTexture(),f+u,h,g-u-v,t+x,0,0),0<q&&p>u&&this._TilePatch(d,m.GetBottomTexture(),f+u,h+l-q-x,g-u-v,q+x,0,x)):1===y&&(0<u&&r>t&&this._DrawPatch(d,m.GetTexture(),0,t,u,r-t,f,h+t,u,l-t-q),0<v&&r>t&&this._DrawPatch(d,m.GetTexture(),p,t,v,r-t,f+g-v,h+t,v,l-t-q),0<t&&p>u&&this._DrawPatch(d,m.GetTexture(),u,0,p-u,t,f+u,h,g-u-v,t),0<q&&
p>u&&this._DrawPatch(d,m.GetTexture(),u,r,p-u,q,f+u,h+l-q,g-u-v,q));r>t&&p>u&&(0===C?this._TilePatch(d,m.GetFillTexture(),f+u,h+t,g-u-v,l-t-q,0,0):1===C&&this._DrawPatch(d,m.GetTexture(),u,t,p-u,r-t,f+u,h+t,g-u-v,l-t-q))}_DrawPatch(d,f,h,g,l,m,u,v,t,q){const p=f.GetWidth(),r=f.GetHeight();d.SetTexture(f);b.set(u,v,u+t,v+q);a.set(h/p,g/r,(h+l)/p,(g+m)/r);null===this._callback3d?(f=this.GetWorldInfo(),g=f.GetBoundingQuad(),h=g.getTlx(),g=g.getTly(),b.offset(-h,-g),c.setFromRotatedRect(b,f.GetAngle()),
c.offset(h,g),d.Quad3(c,a)):this._callback3d(b,a)}_TilePatch(d,f,h,g,l,m,u,v){const t=f.GetWidth(),q=f.GetHeight();d.SetTexture(f);b.set(h,g,h+l,g+m);a.set(-u/t,-v/q,(l-u)/t,(m-v)/q);null===this._callback3d?(f=this.GetWorldInfo(),g=f.GetBoundingQuad(),h=g.getTlx(),g=g.getTly(),b.offset(-h,-g),c.setFromRotatedRect(b,f.GetAngle()),c.offset(h,g),d.Quad3(c,a)):this._callback3d(b,a)}GetCurrentImageInfo(){this._objectClass.GetImageInfo()}GetPropertyValueByIndex(d){}SetPropertyValueByIndex(d,f){}}}"use strict";
self.C3.Plugins.NinePatch.Cnds={};"use strict";self.C3.Plugins.NinePatch.Acts={SetEffect(e){this.GetWorldInfo().SetBlendMode(e);this._runtime.UpdateRender()}};"use strict";self.C3.Plugins.NinePatch.Exps={};
{"use strict";const e=self.C3;function b(a){const c=e.CreateCanvas(a.width,a.height);c.getContext("2d").drawImage(a,0,0);return c}self.NinePatchTextureSet=class{constructor(a){this._sdkType=a;this._runtime=this._sdkType.GetRuntime();this._bottomTexture=this._topTexture=this._rightTexture=this._leftTexture=this._fillTexture=this._texture=null;this._imageHeight=this._imageWidth=0;this._renderer=this._runtime.GetRenderer();this._wasReleased=this._isLoading=!1}Release(){this._renderer.IsContextLost()||
(this._renderer.DeleteTexture(this._texture),this._renderer.DeleteTexture(this._fillTexture),this._renderer.DeleteTexture(this._leftTexture),this._renderer.DeleteTexture(this._rightTexture),this._renderer.DeleteTexture(this._topTexture),this._renderer.DeleteTexture(this._bottomTexture));this._renderer=this._sdkType=this._bottomTexture=this._topTexture=this._rightTexture=this._leftTexture=this._fillTexture=this._texture=null;this._wasReleased=!0}WasReleased(){return this._wasReleased}CreateTextures(a,
c,d,f,h){this._SliceImage(a,c,d,f,h)}HasCreatedTextures(){return!!this._texture}_SliceImage(a,c,d,f,h){if(!this._wasReleased){var g=a.width,l=a.height;this._imageWidth=g;this._imageHeight=l;var m=g-d,u=l-h,v=this._runtime.GetSampling(),t=this._runtime.GetCanvasManager().GetTextureAnisotropy();this._texture=this._renderer.CreateStaticTexture(b(a),{sampling:v,anisotropy:t});m>c&&u>f&&(this._fillTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),c,f,m,u),{wrapX:"repeat",wrapY:"repeat",
sampling:v,anisotropy:t}));0<c&&u>f&&(this._leftTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),0,f,c,u),{wrapY:"repeat",sampling:v,anisotropy:t}));0<d&&u>f&&(this._rightTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),m,f,g,u),{wrapY:"repeat",sampling:v,anisotropy:t}));0<f&&m>c&&(this._topTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),c,0,m,f),{wrapX:"repeat",sampling:v,anisotropy:t}));0<h&&m>c&&(this._bottomTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),
c,u,m,l),{wrapX:"repeat",sampling:v,anisotropy:t}))}}_SliceSubImage(a,c,d,f,h){f-=c;h-=d;const g=e.CreateCanvas(f,h);g.getContext("2d").drawImage(a,c,d,f,h,0,0,f,h);return g}GetImageWidth(){return this._imageWidth}GetImageHeight(){return this._imageHeight}GetTexture(){return this._texture}GetFillTexture(){return this._fillTexture}GetLeftTexture(){return this._leftTexture}GetRightTexture(){return this._rightTexture}GetTopTexture(){return this._topTexture}GetBottomTexture(){return this._bottomTexture}}}
{"use strict";const e=self.C3;e.Plugins.Text=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.Text.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}LoadTextures(b){}ReleaseTextures(){}}}
{"use strict";const e=self.C3,b=self.C3X,a=[0,0,0],c=["left","center","right"],d=["top","center","bottom"],f=new e.Rect,h=new e.Quad,g=new e.Color;e.Plugins.Text.Instance=class extends e.SDKWorldInstanceBase{constructor(t,q){super(t);this._text="";this._enableBBcode=!0;this._faceName="Arial";this._ptSize=12;this._lineHeightOffset=0;this._isItalic=this._isBold=!1;this._color=e.New(e.Color);this._verticalAlign=this._horizontalAlign=0;this._wrapByWord=!0;this._typewriterEndTime=this._typewriterStartTime=
-1;this._typewriterLength=0;this._rendererText=e.New(e.Gfx.RendererText,this._runtime.GetRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(!1);q&&(this._text=q[0],this._enableBBcode=!!q[1],this._faceName=q[2],this._ptSize=q[3],this._lineHeightOffset=q[4],this._isBold=!!q[5],this._isItalic=!!q[6],this._horizontalAlign=q[8],this._verticalAlign=q[9],this._wrapByWord=0===q[10],t=q[7],this._color.setRgb(t[0],t[1],t[2]),this.GetWorldInfo().SetVisible(q[11]));
this._UpdateTextSettings()}Release(){this._CancelTypewriter();this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const t=this._rendererText;t.SetText(this._text);t.SetBBCodeEnabled(this._enableBBcode);t.SetFontName(this._faceName);t.SetLineHeight(this._lineHeightOffset);t.SetBold(this._isBold);t.SetItalic(this._isItalic);t.SetColor(this._color);t.SetHorizontalAlignment(c[this._horizontalAlign]);t.SetVerticalAlignment(d[this._verticalAlign]);t.SetWordWrapMode(this._wrapByWord?
"word":"character")}_UpdateTextSize(){const t=this.GetWorldInfo();this._rendererText.SetFontSize(this._ptSize);this._rendererText.SetFontSizeScale(t.GetSceneGraphScale());var q=t.GetLayer();q=q.GetRenderScale()*q.Get2DScaleFactorToZ(t.GetTotalZElevation());this._rendererText.SetSize(t.GetWidth(),t.GetHeight(),q)}Draw(t){var q=this.GetWorldInfo();this._UpdateTextSize();const p=this._rendererText.GetTexture();if(p){var r=q.GetLayer();if(0===q.GetAngle()&&0===r.GetAngle()&&0===q.GetTotalZElevation()&&
!q.HasMesh()&&r.RendersIn2DMode()){q=q.GetBoundingQuad();const [x,y]=r.LayerToDrawSurface(q.getTlx(),q.getTly()),[C,G]=r.LayerToDrawSurface(q.getBrx(),q.getBry());q=x-Math.round(x);const A=y-Math.round(y);f.set(x,y,C,G);f.offset(-q,-A);h.setFromRect(f);const [E,J]=t.GetRenderTargetSize(t.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(t,E,J);t.SetTexture(p);t.Quad3(h,this._rendererText.GetTexRect());r._SetTransform(t)}else t.SetTexture(p),q.HasMesh()?this._DrawMesh(q,t):this._DrawStandard(q,
t)}}_DrawStandard(t,q){t=t.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(t=this._PixelRoundQuad(t));q.Quad3(t,this._rendererText.GetTexRect())}_DrawMesh(t,q){const p=t.GetTransformedMesh();if(t.IsMeshChanged()){t.CalculateBbox(f,h,!1);let r=h;this._runtime.IsPixelRoundingEnabled()&&(r=this._PixelRoundQuad(r));p.CalculateTransformedMesh(t.GetSourceMesh(),r,this._rendererText.GetTexRect());t.SetMeshChanged(!1)}p.Draw(q)}_PixelRoundQuad(t){const q=t.getTlx()-Math.round(t.getTlx()),p=t.getTly()-
Math.round(t.getTly());if(0===q&&0===p)return t;h.copy(t);h.offset(-q,-p);return h}SaveToJson(){const t={t:this._text,c:this._color.toJSON(),fn:this._faceName,ps:this._ptSize};this._enableBBcode&&(t.bbc=this._enableBBcode);0!==this._horizontalAlign&&(t.ha=this._horizontalAlign);0!==this._verticalAlign&&(t.va=this._verticalAlign);this._wrapByWord||(t.wr=this._wrapByWord);0!==this._lineHeightOffset&&(t.lho=this._lineHeightOffset);this._isBold&&(t.b=this._isBold);this._isItalic&&(t.i=this._isItalic);
-1!==this._typewriterEndTime&&(t.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return t}LoadFromJson(t){this._CancelTypewriter();this._text=t.t;this._color.setFromJSON(t.c);this._faceName=t.fn;this._ptSize=t.ps;this._enableBBcode=t.hasOwnProperty("bbc")?t.bbc:!1;this._horizontalAlign=t.hasOwnProperty("ha")?t.ha:0;this._verticalAlign=t.hasOwnProperty("va")?t.va:0;this._wrapByWord=t.hasOwnProperty("wr")?t.wr:!0;this._lineHeightOffset=t.hasOwnProperty("lho")?
t.lho:0;this._isBold=t.hasOwnProperty("b")?t.b:!1;this._isItalic=t.hasOwnProperty("i")?t.i:!1;t.hasOwnProperty("tw")&&(t=t.tw,this._typewriterStartTime=t.st,this._typewriterEndTime=t.en,this._typewriterLength=t.l);this._UpdateTextSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(t){switch(t){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 a[0]=this._color.getR(),a[1]=this._color.getG(),a[2]=this._color.getB(),a;case 8:return this._horizontalAlign;case 9:return this._verticalAlign;case 10:return this._wrapByWord?1:0}}SetPropertyValueByIndex(t,q){switch(t){case 0:if(this._text===q)break;this._text=q;this._UpdateTextSettings();break;case 1:if(this._enableBBcode===!!q)break;this._enableBBcode=!!q;this._UpdateTextSettings();break;case 2:if(this._faceName===q)break;this._faceName=q;this._UpdateTextSettings();
break;case 3:if(this._ptSize===q)break;this._ptSize=q;this._UpdateTextSettings();break;case 4:if(this._lineHeightOffset===q)break;this._lineHeightOffset=q;this._UpdateTextSettings();break;case 5:if(this._isBold===!!q)break;this._isBold=!!q;this._UpdateTextSettings();break;case 6:if(this._isItalic===!!q)break;this._isItalic=!!q;this._UpdateTextSettings();break;case 7:t=this._color;if(t.getR()===q[0]&&t.getG()===q[1]&&t.getB()===q[2])break;this._color.setRgb(q[0],q[1],q[2]);this._UpdateTextSettings();
break;case 8:if(this._horizontalAlign===q)break;this._horizontalAlign=q;this._UpdateTextSettings();break;case 9:if(this._verticalAlign===q)break;this._verticalAlign=q;this._UpdateTextSettings();break;case 10:this._wrapByWord!==(0===q)&&(this._wrapByWord=0===q,this._UpdateTextSettings())}}SetPropertyColorOffsetValueByIndex(t,q,p,r){if(0!==q||0!==p||0!==r)switch(t){case 7:this._color.addRgb(q,p,r),this._UpdateTextSettings()}}_SetText(t){this._text!==t&&(this._text=t,this._rendererText.SetText(t),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(t,
q){this._SetText(t);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+q/this.GetInstance().GetActiveTimeScale();this._typewriterLength=e.BBString.StripAnyTags(t).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(e.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetFontFace(t){this._faceName!==t&&(this._faceName=t,this._rendererText.SetFontName(t),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(t){t=!!t;this._isBold!==t&&(this._isBold=t,this._rendererText.SetBold(t),this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(t){t=!!t;this._isItalic!==t&&(this._isItalic=t,this._rendererText.SetItalic(t),
this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(t){this._ptSize!==t&&(this._ptSize=t,this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetFontColor(t){this._color.equalsIgnoringAlpha(t)||(this._color.copyRgb(t),this._rendererText.SetColor(this._color),this._runtime.UpdateRender())}_GetFontColor(){return this._color}_SetLineHeight(t){this._lineHeightOffset!==t&&(this._lineHeightOffset=t,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(t){this._horizontalAlign!==
t&&(this._horizontalAlign=t,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(t){t=!!t;this._wrapByWord!==t&&(this._wrapByWord=t,this._UpdateTextSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}_GetTextWidth(){this._UpdateTextSize();return this._rendererText.GetTextWidth()}_GetTextHeight(){this._UpdateTextSize();
return this._rendererText.GetTextHeight()}Tick(){var t=this._runtime.GetWallTime();t>=this._typewriterEndTime?(this._CancelTypewriter(),this.Trigger(e.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(t=e.relerp(this._typewriterStartTime,this._typewriterEndTime,t,0,this._typewriterLength),t=Math.floor(t),t!==this._rendererText.GetDrawMaxCharacterCount()&&(this._rendererText.SetDrawMaxCharacterCount(t),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.text.name",
properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:t=>this._SetText(t)}]}]}GetScriptInterfaceClass(){return self.ITextInstance}};const l=new WeakMap,m=new Map([["left",0],["center",1],["right",2]]),u=new Map([["top",0],["center",1],["bottom",2]]),v=new Map([["word",!0],["character",!1]]);self.ITextInstance=class extends self.IWorldInstance{constructor(){super();l.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return l.get(this).GetText()}set text(t){b.RequireString(t);
const q=l.get(this);q._CancelTypewriter();q._SetText(t)}typewriterText(t,q){b.RequireString(t);b.RequireFiniteNumber(q);const p=l.get(this);p._CancelTypewriter();p._StartTypewriter(t,q)}typewriterFinish(){l.get(this)._FinishTypewriter()}set fontFace(t){b.RequireString(t);l.get(this)._SetFontFace(t)}get fontFace(){return l.get(this)._GetFontFace()}set isBold(t){l.get(this)._SetBold(t)}get isBold(){return l.get(this)._IsBold()}set isItalic(t){l.get(this)._SetItalic(t)}get isItalic(){return l.get(this)._IsItalic()}set sizePt(t){b.RequireFiniteNumber(t);
l.get(this)._SetFontSize(t)}get sizePt(){return l.get(this)._GetFontSize()}set fontColor(t){b.RequireArray(t);if(3>t.length)throw Error("expected 3 elements");g.setRgb(t[0],t[1],t[2]);l.get(this)._SetFontColor(g)}get fontColor(){const t=l.get(this)._GetFontColor();return[t.getR(),t.getG(),t.getB()]}set lineHeight(t){b.RequireFiniteNumber(t);l.get(this)._SetLineHeight(t)}get lineHeight(){return l.get(this)._GetLineHeight()}set horizontalAlign(t){b.RequireString(t);t=m.get(t);if("undefined"===typeof t)throw Error("invalid mode");
l.get(this)._SetHAlign(t)}get horizontalAlign(){return c[l.get(this)._GetHAlign()]}set verticalAlign(t){b.RequireString(t);t=u.get(t);if("undefined"===typeof t)throw Error("invalid mode");l.get(this)._SetVAlign(t)}get verticalAlign(){return d[l.get(this)._GetVAlign()]}set wordWrapMode(t){b.RequireString(t);t=v.get(t);if("undefined"===typeof t)throw Error("invalid mode");l.get(this)._SetWrapByWord(t)}get wordWrapMode(){return l.get(this)._IsWrapByWord()?"word":"character"}get textWidth(){return l.get(this)._GetTextWidth()}get textHeight(){return l.get(this)._GetTextHeight()}}}
{"use strict";const e=self.C3;e.Plugins.Text.Cnds={CompareText(b,a){return a?this._text===b:e.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}
{"use strict";const e=self.C3,b=e.New(e.Color);e.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,c){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._StartTypewriter(a.toString(),c)},SetFontFace(a,c){let d=!1,f=!1;
switch(c){case 1:d=!0;break;case 2:f=!0;break;case 3:f=d=!0}if(a!==this._faceName||d!==this._isBold||f!==this._isItalic)this._SetFontFace(a),this._SetBold(d),this._SetItalic(f)},SetFontSize(a){this._SetFontSize(a)},SetFontColor(a){b.setFromRgbValue(a);b.clamp();this._SetFontColor(b)},SetWebFont(a,c){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 e=self.C3;e.Plugins.Text.Exps={Text(){return this._text},PlainText(){return this._enableBBcode?e.BBString.StripAnyTags(this._text):this._text},FaceName(){return this._faceName},FaceSize(){return this._ptSize},TextWidth(){return this._GetTextWidth()},TextHeight(){return this._GetTextHeight()},LineHeight(){return this._lineHeightOffset}}}
{"use strict";const e=self.C3;e.Plugins.Spritefont2=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.Spritefont2.Type=class extends e.SDKTypeBase{constructor(b){super(b);this._spriteFont=e.New(self.SpriteFont)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(b){return this.GetImageInfo().LoadStaticTexture(b,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}GetSpriteFont(){return this._spriteFont}UpdateSettings(b,a,c,d){const f=this.GetImageInfo(),h=this._spriteFont;h.SetWidth(f.GetWidth());
h.SetHeight(f.GetHeight());h.SetCharacterWidth(b);h.SetCharacterHeight(a);h.SetCharacterSet(c);h.SetSpacingData(d);h.UpdateCharacterMap()}}}
{"use strict";const e=self.C3,b=self.C3X,a=["left","center","right"],c=["top","center","bottom"];e.Plugins.Spritefont2.Instance=class extends e.SDKWorldInstanceBase{constructor(l,m){super(l);this._text="";this._enableBBcode=!0;this._characterHeight=this._characterWidth=16;this._characterSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@\u00b0+=*$\u00a3\u20ac<>";l="";this._characterScale=1;this._verticalAlign=this._horizontalAlign=this._lineHeight=this._characterSpacing=
0;this._wrapByWord=!0;this._spriteFontText=null;this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;m&&(this._text=m[0],this._enableBBcode=m[1],this._characterWidth=m[2],this._characterHeight=m[3],this._characterSet=m[4],l=m[5],this._characterScale=m[6],this._characterSpacing=m[7],this._lineHeight=m[8],this._horizontalAlign=m[9],this._verticalAlign=m[10],this._wrapByWord=0===m[11],this.GetWorldInfo().SetVisible(m[12]));this._sdkType.UpdateSettings(this._characterWidth,this._characterHeight,
this._characterSet,l);this._spriteFontText=e.New(self.SpriteFontText,this._sdkType.GetSpriteFont());m=this.GetWorldInfo();this._spriteFontText.SetSize(m.GetWidth(),m.GetHeight());this._UpdateSettings();this._inst.SetMustMitigateZFighting()}Release(){this._CancelTypewriter();this._spriteFontText.Release();this._spriteFontText=null;super.Release()}_UpdateSettings(){const l=this._spriteFontText;l&&(l.SetBBCodeEnabled(this._enableBBcode),l.SetText(this._text),l.SetWordWrapMode(this._wrapByWord?"word":
"character"),l.SetHorizontalAlign(a[this._horizontalAlign]),l.SetVerticalAlign(c[this._verticalAlign]),l.SetSpacing(this._characterSpacing),l.SetLineHeight(this._lineHeight))}Draw(l){const m=this._objectClass.GetImageInfo();var u=m.GetTexture();if(u){l.SetTexture(u);u=this.GetWorldInfo();var v=u.GetBoundingQuad(),t=this._spriteFontText;t.SetScale(this._characterScale);t.SetSceneGraphScale(u.GetSceneGraphScale());this._runtime.IsPixelRoundingEnabled()&&(v=u.PixelRoundQuad(v));t.SetSize(u.GetWidth(),
u.GetHeight());t.GetSpriteFont().SetTexRect(m.GetTexRect());t.SetColor(u.GetUnpremultipliedColor());t.Draw(l,v.getTlx(),v.getTly(),u.GetAngle())}}SaveToJson(){const l={t:this._text,ebbc:this._enableBBcode,csc:this._characterScale,csp:this._characterSpacing,lh:this._lineHeight,ha:this._horizontalAlign,va:this._verticalAlign,w:this._wrapByWord,cw:this._sdkType.GetSpriteFont().GetCharacterWidth(),ch:this._sdkType.GetSpriteFont().GetCharacterHeight(),cs:this._sdkType.GetSpriteFont().GetCharacterSet(),
sd:this._sdkType.GetSpriteFont().GetSpacingData()};-1!==this._typewriterEndTime&&(l.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return l}LoadFromJson(l){this._CancelTypewriter();this._text=l.t;this._enableBBcode=l.ebbc;this._characterScale=l.csc;this._characterSpacing=l.csp;this._lineHeight=l.lh;this._horizontalAlign=l.ha;this._verticalAlign=l.va;this._wrapByWord=l.w;if(l.hasOwnProperty("tw")){var m=l.tw;this._typewriterStartTime=m.st;this._typewriterEndTime=
m.en;this._typewriterLength=l.l}m=this._sdkType.GetSpriteFont();m.SetCharacterWidth(l.cw);m.SetCharacterHeight(l.ch);m.SetCharacterSet(l.cs);m.SetSpacingData(l.sd);this._UpdateSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(l){switch(l){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._sdkType.GetSpriteFont().GetCharacterWidth();case 3:return this._sdkType.GetSpriteFont().GetCharacterHeight();case 4:return this._sdkType.GetSpriteFont().GetCharacterSet();
case 5:return this._sdkType.GetSpriteFont().GetSpacingData();case 6:return this._characterScale;case 7:return this._characterSpacing;case 8:return this._lineHeight;case 9:return this._horizontalAlign;case 10:return this._verticalAlign;case 11:return this._wrapByWord?1:0}}SetPropertyValueByIndex(l,m){switch(l){case 0:if(this._text===m)break;this._text=m;this._UpdateSettings();break;case 1:if(this._enableBBcode===!!m)break;this._enableBBcode=!!m;this._UpdateSettings();break;case 2:this._sdkType.GetSpriteFont().SetCharacterWidth(m);
break;case 3:this._sdkType.GetSpriteFont().SetCharacterHeight(m);break;case 4:this._sdkType.GetSpriteFont().SetCharacterSet(m);break;case 5:this._sdkType.GetSpriteFont().SetSpacingData(m);break;case 6:if(this._characterScale===m)break;this._characterScale=m;this._UpdateSettings();break;case 7:if(this._characterSpacing===m)break;this._characterSpacing=m;this._UpdateSettings();break;case 8:if(this._lineHeight===m)break;this._lineHeight=m;this._UpdateSettings();break;case 9:if(this._horizontalAlign===
m)break;this._horizontalAlign=m;this._UpdateSettings();break;case 10:if(this._verticalAlign===m)break;this._verticalAlign=m;this._UpdateSettings();break;case 11:this._wrapByWord!==(0===m)&&(this._wrapByWord=0===m,this._UpdateSettings())}}_SetText(l){this._text!==l&&(this._text=l,this._spriteFontText.SetText(l),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(l,m){this._SetText(l);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+
m/this.GetInstance().GetActiveTimeScale();this._typewriterLength=e.BBString.StripAnyTags(l).length;this._spriteFontText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._spriteFontText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(e.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetScale(l){this._characterScale!==
l&&(this._characterScale=l,this._spriteFontText.SetScale(this._characterScale),this._runtime.UpdateRender())}_GetScale(){return this._characterScale}_SetCharacterSpacing(l){this._characterSpacing!==l&&(this._characterSpacing=l,this._spriteFontText.SetSpacing(this._characterSpacing),this._runtime.UpdateRender())}_GetCharacterSpacing(){return this._characterSpacing}_SetLineHeight(l){this._lineHeight!==l&&(this._lineHeight=l,this._spriteFontText.SetLineHeight(this._lineHeight),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeight}_SetHAlign(l){this._horizontalAlign!==
l&&(this._horizontalAlign=l,this._UpdateSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(l){this._verticalAlign!==l&&(this._verticalAlign=l,this._UpdateSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(l){l=!!l;this._wrapByWord!==l&&(this._wrapByWord=l,this._UpdateSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){var l=this._runtime.GetWallTime();l>=this._typewriterEndTime?
(this._CancelTypewriter(),this.Trigger(e.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(l=e.relerp(this._typewriterStartTime,this._typewriterEndTime,l,0,this._typewriterLength),l=Math.floor(l),l!==this._spriteFontText.GetDrawMaxCharacterCount()&&(this._spriteFontText.SetDrawMaxCharacterCount(l),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.spritefont2.name",properties:[{name:"plugins.spritefont2.properties.text.name",value:this._text,
onedit:l=>this._SetText(l)}]}]}GetScriptInterfaceClass(){return self.ISpriteFontInstance}};const d=new WeakMap,f=new Map([["left",0],["center",1],["right",2]]),h=new Map([["top",0],["center",1],["bottom",2]]),g=new Map([["word",!0],["character",!1]]);self.ISpriteFontInstance=class extends self.IWorldInstance{constructor(){super();d.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return d.get(this).GetText()}set text(l){b.RequireString(l);const m=d.get(this);m._CancelTypewriter();
m._SetText(l)}typewriterText(l,m){b.RequireString(l);b.RequireFiniteNumber(m);const u=d.get(this);u._CancelTypewriter();u._StartTypewriter(l,m)}typewriterFinish(){d.get(this)._FinishTypewriter()}set characterScale(l){b.RequireFiniteNumber(l);d.get(this)._SetScale(l)}get characterScale(){return d.get(this)._GetScale()}set characterSpacing(l){b.RequireFiniteNumber(l);d.get(this)._SetCharacterSpacing(l)}get characterSpacing(){return d.get(this)._GetCharacterSpacing()}set lineHeight(l){b.RequireFiniteNumber(l);
d.get(this)._SetLineHeight(l)}get lineHeight(){return d.get(this)._GetLineHeight()}set horizontalAlign(l){b.RequireString(l);l=f.get(l);if("undefined"===typeof l)throw Error("invalid mode");d.get(this)._SetHAlign(l)}get horizontalAlign(){return a[d.get(this)._GetHAlign()]}set verticalAlign(l){b.RequireString(l);l=h.get(l);if("undefined"===typeof l)throw Error("invalid mode");d.get(this)._SetVAlign(l)}get verticalAlign(){return c[d.get(this)._GetVAlign()]}set wordWrapMode(l){b.RequireString(l);l=g.get(l);
if("undefined"===typeof l)throw Error("invalid mode");d.get(this)._SetWrapByWord(l)}get wordWrapMode(){return d.get(this)._IsWrapByWord()?"word":"character"}}}{"use strict";const e=self.C3;e.Plugins.Spritefont2.Cnds={CompareText(b,a){return a?this._text===b:e.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}"use strict";
self.C3.Plugins.Spritefont2.Acts={SetText(e){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);this._SetText(e.toString())},AppendText(e){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);(e=e.toString())&&this._SetText(this._text+e)},TypewriterText(e,b){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);this._StartTypewriter(e.toString(),b)},TypewriterFinish(){this._FinishTypewriter()},SetScale(e){this._SetScale(e)},
SetCharacterSpacing(e){this._SetCharacterSpacing(e)},SetLineHeight(e){this._SetLineHeight(e)},SetCharacterWidth(e,b){let a=!1;const c=this._sdkType.GetSpriteFont();for(const d of e)if(" "===d)c.SetSpaceWidth(b),a=!0;else if(e=c.GetCharacter(d))e.SetDisplayWidth(b),a=!0;a&&c.SetCharacterWidthsChanged();this._runtime.UpdateRender()},SetEffect(e){this.GetWorldInfo().SetBlendMode(e);this._runtime.UpdateRender()},SetHAlign(e){this._SetHAlign(e)},SetVAlign(e){this._SetVAlign(e)},SetWrapping(e){this._SetWrapByWord(0===
e)}};
{"use strict";const e=self.C3;e.Plugins.Spritefont2.Exps={CharacterWidth(b){return(b=this._sdkType.GetSpriteFont().GetCharacter(b))?b.GetDisplayWidth():this._sdkType.GetSpriteFont().GetCharacterWidth()},CharacterHeight(){return this._characterHeight},CharacterScale(){return this._characterScale},CharacterSpacing(){return this._characterSpacing},LineHeight(){return this._lineHeight},Text(){return this._text},PlainText(){return this._enableBBcode?e.BBString.StripAnyTags(this._text):this._text},TextWidth(){const b=
this.GetWorldInfo();this._spriteFontText.SetSize(b.GetWidth(),b.GetHeight());return this._spriteFontText.GetTextWidth()},TextHeight(){const b=this.GetWorldInfo();this._spriteFontText.SetSize(b.GetWidth(),b.GetHeight());return this._spriteFontText.GetTextHeight()}}}
{"use strict";const e=self.C3;self.SpriteFontCharacter=class{constructor(b,a,c,d){let f=b.GetCharacterWidth(),h=b.GetCharacterHeight();this._spriteFont=b;this._char=a;this._pxRect=new e.Rect(c,d,c+f,d+h);this._texRect=new e.Rect;this._displayWidth=-1;this._UpdateTexRect()}Release(){this._texRect=this._pxRect=this._spriteFont=null}_UpdateTexRect(){let b=this._spriteFont.GetWidth(),a=this._spriteFont.GetHeight();this._texRect.copy(this._pxRect);this._texRect.divide(b,a);this._texRect.lerpInto(this._spriteFont.GetTexRect())}GetSpriteFont(){return this._spriteFont}GetChar(){return this._char}GetTexRect(){return this._texRect}SetDisplayWidth(b){this._displayWidth=
b}GetDisplayWidth(){return 0>this._displayWidth?this._spriteFont.GetCharacterWidth():this._displayWidth}}}
{"use strict";const e=self.C3,b=new e.Rect,a=new e.Quad,c=new e.Color,d=new Set(["left","center","right"]),f=new Set(["top","center","bottom"]),h=new Set(["word","character"]);self.SpriteFontText=class{constructor(g){this._spriteFont=g;this._cssHeight=this._cssWidth=0;this._text="";this._isBBcodeEnabled=!1;this._bbString=null;this._wrappedText=e.New(e.WordWrap);this._wrapMode="word";this._wrapChanged=!1;this._horizontalAlign="left";this._verticalAlign="top";this._sceneGraphScale=this._scale=1;this._lineHeight=
this._spacing=0;this._color=e.New(e.Color);this._drawMaxCharCount=-1;this._drawCharCount=0;this._measureTextCallback=(l,m)=>this._MeasureText(l,m);this._spriteFont._AddSpriteFontText(this)}Release(){this._spriteFont._RemoveSpriteFontText(this);this._measureTextCallback=this._color=null;this._wrappedText.Clear();this._bbString=this._spriteFont=this._wrappedText=null}_MeasureText(g,l){var m=this._GetStyleTag(l,"scale"),u=(m?parseFloat(m.param):this._scale)*this._sceneGraphScale;m=this._GetStyleTag(l,
"scalex");m=(m?parseFloat(m.param):1)*u;l=this._GetStyleTag(l,"scaley");l=(l?parseFloat(l.param):1)*u;l=this._spriteFont.GetCharacterHeight()*l+this._lineHeight;const v=this.GetSpriteFont();u=v.GetCharacterWidth()*m;const t=this.GetSpacing();if(v.HasAnyCustomWidths()){let p=0,r=0;for(var q of g){g=u;const x=v.GetCharacter(q);x?g=x.GetDisplayWidth()*m:" "===q&&(g=v.GetSpaceWidth()*m);r+=g;++p}return{width:r+p*t,height:l}}q=[...g].length;return{width:u*q+Math.max(q,0)*t,height:l}}_SetWrapChanged(){this._wrapChanged=
!0;this._wrappedText.Clear()}SetSize(g,l){0>=g||0>=l||this._cssWidth===g&&this._cssHeight===l||(this._cssWidth!==g&&this._SetWrapChanged(),this._cssWidth=g,this._cssHeight=l)}SetDrawMaxCharacterCount(g){this._drawMaxCharCount=Math.floor(g)}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(g,l){for(let m=g.length-1;0<=m;--m){const u=g[m];if(u.tag===l)return u}return null}_HasStyleTag(g,l){return!!this._GetStyleTag(g,l)}_MaybeWrapText(){if(this._wrapChanged){!this._isBBcodeEnabled||
this._bbString&&this._bbString.toString()===this._text||(this._bbString=new e.BBString(this._text,{noEscape:!0}));var g=-this.GetSpacing();this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,g);this._wrapChanged=!1}}Draw(g,l,m,u){this._MaybeWrapText();let v=this._drawCharCount=0;const t=this._lineHeight,q=e.cloneArray(this._wrappedText.GetLines()),p=Math.sin(u);u=Math.cos(u);var r=q.reduce((x,y)=>x+y.height,
0)-t;"center"===this._verticalAlign?v=Math.max(Math.floor(this._cssHeight/2-r/2),0):"bottom"===this._verticalAlign&&(v=Math.floor(this._cssHeight-r));for(let x=0,y=q.length;x<y;++x){r=q[x];const C=r.height;if(0<x&&v>this._cssHeight-(C-t))break;0<=v&&this._DrawLine(g,r,l,m,v,p,u);v+=C}}_DrawLine(g,l,m,u,v,t,q){const p=l.height;let r=0;"center"===this._horizontalAlign?r=Math.max(Math.floor((this._cssWidth-l.width)/2),0):"right"===this._horizontalAlign&&(r=Math.max(Math.floor(this._cssWidth-l.width),
0));for(const x of l.fragments)this._DrawFragment(g,x,m,u,r,v,t,q,p),r+=x.width}_DrawFragment(g,l,m,u,v,t,q,p,r){var x=l.text,y=l.width,C=l.styles;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+x.length>this._drawMaxCharCount&&(x=x.substr(0,this._drawMaxCharCount-this._drawCharCount),y=this._MeasureText(x,C).width);this._drawCharCount+=x.length}var G=this._GetStyleTag(C,"background");if(!(e.IsStringAllWhitespace(x)&&!G||this._HasStyleTag(C,
"hide"))){l=this._GetStyleTag(C,"scale");var A=(l?parseFloat(l.param):this._scale)*this._sceneGraphScale;l=this._GetStyleTag(C,"scalex");l=(l?parseFloat(l.param):1)*A;var E=this._GetStyleTag(C,"scaley");A*=E?parseFloat(E.param):1;A*=this._spriteFont.GetCharacterHeight();t+=r-this._lineHeight-A;r=this._GetStyleTag(C,"offsetx");v+=r?parseFloat(r.param):0;r=this._GetStyleTag(C,"offsety");t+=r?parseFloat(r.param):0;G&&(g.SetColorFillMode(),c.parseString(G.param),c.setA(1),g.SetColor(c),b.set(v,t,v+y,
t+A),b.getRight()>this._cssWidth&&b.setRight(this._cssWidth),a.setFromRotatedRectPrecalc(b,q,p),a.offset(m,u),g.Quad(a),g.SetTextureFillMode());(y=this._GetStyleTag(C,"color"))?(c.parseString(y.param),c.setA(this._color.getA())):c.copy(this._color);(y=this._GetStyleTag(C,"opacity"))&&c.setA(c.getA()*parseFloat(y.param)/100);c.premultiply();g.SetColor(c);y=this._spriteFont.GetCharacterWidth()*l;C=Math.abs(this.GetSpacing());for(const J of x)if(x=this._spriteFont.GetCharacter(J)){G=x.GetDisplayWidth()*
l;if(v+G>this._cssWidth+C+1E-5)break;b.set(v,t,v+y,t+A);a.setFromRotatedRectPrecalc(b,q,p);a.offset(m,u);g.Quad3(a,x.GetTexRect());v+=G+this._spacing}else v+=this._spriteFont.GetSpaceWidth()*l+this._spacing}}GetSpriteFont(){return this._spriteFont}SetBBCodeEnabled(g){g=!!g;this._isBBcodeEnabled!==g&&(this._isBBcodeEnabled=g,this._SetWrapChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetText(g){this._text!==g&&(this._text=g,this._SetWrapChanged())}SetWordWrapMode(g){if(!h.has(g))throw Error("invalid word wrap mode");
this._wrapMode!==g&&(this._wrapMode=g,this._SetWrapChanged())}SetHorizontalAlign(g){if(!d.has(g))throw Error("invalid alignment");this._horizontalAlign=g}SetVerticalAlign(g){if(!f.has(g))throw Error("invalid alignment");this._verticalAlign=g}SetScale(g){this._scale!==g&&(this._scale=g,this._SetWrapChanged())}GetScale(){return this._scale}SetSceneGraphScale(g){this._sceneGraphScale!==g&&(this._sceneGraphScale=g,this._SetWrapChanged())}GetSceneGraphScale(){return this._sceneGraphScale}SetSpacing(g){this._spacing!==
g&&(this._spacing=g,this._SetWrapChanged())}GetSpacing(){return this._spacing}SetLineHeight(g){this._lineHeight=g;this._SetWrapChanged()}GetLineHeight(){return this._lineHeight}SetOpacity(g){g=e.clamp(g,0,1);this._color.a=g}SetColor(g){this._color.equals(g)||this._color.copy(g)}GetColor(){return this._color}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();var g=this._spriteFont.GetCharacterHeight()*this._scale;const l=this._lineHeight;
g+=l;return this._wrappedText.GetLineCount()*g-l}}}
{"use strict";const e=self.C3,b={width:256,height:256,characterWidth:16,characterHeight:16,characterSet:""};self.SpriteFont=class{constructor(a){a=Object.assign({},b,a);if(0>=a.width||0>=a.height||0>=a.characterWidth||0>=a.characterHeight)throw Error("invalid size");this._width=a.width;this._height=a.height;this._characterWidth=a.characterWidth;this._characterHeight=a.characterHeight;this._characterSet=a.characterSet;this._spacingData="";this._spacingParsed=null;this._hasAnyCustomWidths=!1;this._spaceWidth=
-1;this._texRect=new e.Rect(0,0,1,1);this._characterMap=new Map;this._mapChanged=!0;this._allTexts=new Set}Release(){this._texRect=null;this._ReleaseCharacters();this._characterMap=null;this._allTexts&&this._allTexts.clear();this._allTexts=null}_ReleaseCharacters(){for(let a of this._characterMap.values())a.Release();this._characterMap.clear()}_AddSpriteFontText(a){this._allTexts.add(a)}_RemoveSpriteFontText(a){this._allTexts.delete(a)}UpdateCharacterMap(){if(this._mapChanged){this._ReleaseCharacters();
var a=[...this._characterSet],c=Math.floor(this._width/this._characterWidth),d=c*Math.floor(this._height/this._characterHeight);for(let f=0,h=a.length;f<h&&!(f>=d);++f){let g=a[f];this._characterMap.set(g,e.New(self.SpriteFontCharacter,this,g,f%c*this._characterWidth,Math.floor(f/c)*this._characterHeight))}this._hasAnyCustomWidths=!1;this._spaceWidth=-1;if(Array.isArray(this._spacingParsed))for(let f of this._spacingParsed)if(Array.isArray(f)&&2===f.length&&(a=f[0],c=f[1],"number"===typeof a&&isFinite(a)&&
"string"===typeof c&&a!==this._characterWidth))for(let h of c)(c=this._characterMap.get(h))?(c.SetDisplayWidth(a),this._hasAnyCustomWidths=!0):" "===h&&(this._spaceWidth=a,this._hasAnyCustomWidths=!0);this._mapChanged=!1;for(let f of this._allTexts)f._SetWrapChanged()}}SetCharacterWidthsChanged(){this._hasAnyCustomWidths=!0;for(const a of this._allTexts)a._SetWrapChanged()}GetCharacter(a){this.UpdateCharacterMap();return this._characterMap.get(a)||null}HasAnyCustomWidths(){return this._hasAnyCustomWidths}SetWidth(a){a=
Math.floor(a);if(0>=a)throw Error("invalid size");this._width!==a&&(this._width=a,this._mapChanged=!0)}GetWidth(){return this._width}SetHeight(a){a=Math.floor(a);if(0>=a)throw Error("invalid size");this._height!==a&&(this._height=a,this._mapChanged=!0)}GetHeight(){return this._height}SetTexRect(a){if(!this._texRect.equals(a)){this._texRect.copy(a);for(const c of this._characterMap.values())c._UpdateTexRect()}}GetTexRect(){return this._texRect}SetCharacterWidth(a){a=Math.floor(a);if(0>=a)throw Error("invalid size");
this._characterWidth!==a&&(this._characterWidth=a,this._mapChanged=!0)}GetCharacterWidth(){return this._characterWidth}SetCharacterHeight(a){a=Math.floor(a);if(0>=a)throw Error("invalid size");this._characterHeight!==a&&(this._characterHeight=a,this._mapChanged=!0)}GetCharacterHeight(){return this._characterHeight}SetCharacterSet(a){this._characterSet!==a&&(this._characterSet=a,this._mapChanged=!0)}GetCharacterSet(){return this._characterSet}SetSpacingData(a){if(this._spacingData!==a&&(this._spacingData=
a,this._mapChanged=!0,this._spacingParsed=null,this._spacingData.length))try{this._spacingParsed=JSON.parse(this._spacingData)}catch(c){this._spacingParsed=null}}GetSpacingData(){return this._spacingData}SetSpaceWidth(a){0>a&&(a=-1);this._spaceWidth!==a&&(this._spaceWidth=a,0<=this._spaceWidth&&(this._hasAnyCustomWidths=!0))}GetSpaceWidth(){return 0>this._spaceWidth?this._characterWidth:this._spaceWidth}}}
{"use strict";const e=self.C3;e.Plugins.Tilemap=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}};e.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL=-2147483648;e.Plugins.Tilemap.TILE_FLIPPED_VERTICAL=1073741824;e.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL=536870912;e.Plugins.Tilemap.TILE_FLAGS_MASK=3758096384;e.Plugins.Tilemap.TILE_ID_MASK=536870911}
{"use strict";const e=self.C3,b=e.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,a=e.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,c=e.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,d=e.Plugins.Tilemap.TILE_ID_MASK;e.Plugins.Tilemap.Type=class extends e.SDKTypeBase{constructor(f){super(f);this._tilePolys=[];this._areTilePolysCached=!1;this._maxTileIndex=0;this._brushesData=[]}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(f){return this.GetImageInfo().LoadStaticTexture(f,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}OnDynamicTextureLoadComplete(){for(const f of this.GetObjectClass().instancesIncludingPendingCreate())f.GetSdkInstance()._OnDynamicTextureLoadComplete()}LoadTilemapData(f,
h,g){this._maxTileIndex=h;for(const l of f)l?this._tilePolys.push({poly:l[0],use:!!l[1],flipmap:[[[null,null],[null,null]],[[null,null],[null,null]]]}):this._tilePolys.push(null);for(const l of g)this._brushesData.push({name:l[0],type:l[1],tileData:l[2]})}_ForceCacheOfTileCollisionPolys(f,h){this._areTilePolysCached=!1;this._MaybeCacheTileCollisionPolys(f,h)}_MaybeCacheTileCollisionPolys(f,h){if(!this._areTilePolysCached){this._areTilePolysCached=!0;for(let g=0,l=this._tilePolys.length;g<l;++g)this._tilePolys[g]&&
(this._CacheTilePoly(g,f,h,!1,!1,!1),this._CacheTilePoly(g,f,h,!1,!1,!0),this._CacheTilePoly(g,f,h,!1,!0,!1),this._CacheTilePoly(g,f,h,!1,!0,!0),this._CacheTilePoly(g,f,h,!0,!1,!1),this._CacheTilePoly(g,f,h,!0,!1,!0),this._CacheTilePoly(g,f,h,!0,!0,!1),this._CacheTilePoly(g,f,h,!0,!0,!0))}}_CacheTilePoly(f,h,g,l,m,u){if(!(0>f||f>=this._tilePolys.length)&&(f=this._tilePolys[f])){var v=e.New(e.CollisionPoly,f.poly,f.use);v.transform(h,g,0);u&&v.diag();l&&v.mirror(h/2);m&&v.flip(g/2);f.flipmap[l?1:0][m?
1:0][u?1:0]=null;f.flipmap[l?1:0][m?1:0][u?1:0]=v}}GetTilePoly(f){if(-1===f)return null;var h=f&d;return 0>h||h>=this._tilePolys.length?null:(h=this._tilePolys[h])?h.flipmap[f&b?1:0][f&a?1:0][f&c?1:0]:null}IsTilePolyEnabled(f){return f?f.IsEnabled():!0}GetMaxTileIndex(){return this._maxTileIndex}GetBrushData(f){return this._brushesData[f]}}}
{"use strict";const e=self.C3,b=self.C3X,a=e.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,c=e.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,d=e.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,f=e.Plugins.Tilemap.TILE_FLAGS_MASK,h=e.Plugins.Tilemap.TILE_ID_MASK,g=e.New(e.Rect),l=e.New(e.Rect),m=e.New(e.Rect);function u(q){const p=[];q=q.split(",");for(let C=0,G=q.length;C<G;++C){var r=q[C],x=r.indexOf("x");if(-1<x){var y=parseInt(r.substring(0,x),10);r=r.substring(x+1);x=parseInt(r,10);r.includes("h")&&(x|=a);r.includes("v")&&
(x|=c);for(r.includes("d")&&(x|=d);0<y;--y)p.push(x)}else y=parseInt(r,10),r.includes("h")&&(y|=a),r.includes("v")&&(y|=c),r.includes("d")&&(y|=d),p.push(y)}return p}e.Plugins.Tilemap.Instance=class extends e.SDKWorldInstanceBase{constructor(q,p){super(q);q=this.GetWorldInfo();this._tileHeight=this._tileWidth=32;this._mapHeight=this._mapWidth=this._tileYspacing=this._tileXspacing=this._tileYoffset=this._tileXoffset=0;this._lastWidth=q.GetWidth();this._lastHeight=q.GetHeight();this._cellHeight=this._cellWidth=
0;this._tileCells=[];this._tileTexQuads=new Map;this._isAnyQuadMapChanged=!0;this._ownImageInfo=null;p&&(q.SetVisible(p[0]),this._tileWidth=Math.max(p[1],1),this._tileHeight=Math.max(p[2],1),this._tileXoffset=p[3],this._tileYoffset=p[4],this._tileXspacing=p[5],this._tileYspacing=p[6]);this._cellWidth=Math.ceil(this._runtime.GetOriginalViewportWidth()/this._tileWidth);this._cellHeight=Math.ceil(this._runtime.GetOriginalViewportHeight()/this._tileHeight);this._sdkType._MaybeCacheTileCollisionPolys(this._tileWidth,
this._tileHeight);this._autoTiling=null}Release(){this._ReleaseOwnImage();e.clearArray(this._tileCells);this._tileCells=null;this._tileTexQuads.clear();this._tileTexQuads=null;super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}LoadTilemapData(q,p,r){this._mapWidth=p;this._mapHeight=r;this._MaybeResizeTilemap(!0);this.SetTilesFromRLECSV(q);this._MaybeBuildAllQuadMap()}_MaybeResizeTilemap(q){const [p,r]=this.GetMapDisplaySize();if(!(p<=this._mapWidth&&
r<=this._mapHeight)||q){if(q){q=Math.ceil(this._mapHeight/this._cellHeight);var x=Math.ceil(this._mapWidth/this._cellWidth)}else q=this._tileCells.length,x=Math.ceil(this._mapWidth/this._cellWidth),r>this._mapHeight&&(this._mapHeight=r,q=Math.ceil(this._mapHeight/this._cellHeight)),p>this._mapWidth&&(this._mapWidth=p,x=Math.ceil(this._mapWidth/this._cellWidth)),this._SetAllQuadMapChanged(),this._SetPhysicsChanged(),this._runtime.UpdateRender();var y=this._tileCells;if(y.length<q)for(var C=y.length;C<
q;++C)y.push([]);for(C=0;C<q;++C){const G=y[C];for(let A=G.length;A<x;++A)G.push(e.New(e.Plugins.Tilemap.TileCell,this,A,C))}}}SetTilesFromRLECSV(q){q=u(q);let p=0;const r=this._mapWidth,x=this._cellWidth,y=this._cellHeight;for(let C=0,G=this._mapHeight;C<G;++C)for(let A=0;A<r;++A){const E=q[p++],J=this.GetCellAt(A,C);J&&J.SetTileAt(A%x,C%y,E)}}GetTilesAsRLECSV(){let q="";if(0>=this._mapWidth||0>=this._mapHeight)return q;let p=1;var r=this.GetTileAt(0,0);const [x,y]=this.GetMapDisplaySize();let C,
G,A;for(let E=0;E<y;++E)for(let J=0===E?1:0;J<x;++J){const B=this.GetTileAt(J,E);B===r?++p:(-1===r?(C=-1,r=A=G=!1):(C=r&h,G=0!==(r&a),A=0!==(r&c),r=0!==(r&d)),q=1===p?q+(""+C):q+(""+p+"x"+C),G&&(q+="h"),A&&(q+="v"),r&&(q+="d"),q+=",",p=1,r=B)}-1===r?(C=-1,r=A=G=!1):(C=r&h,G=0!==(r&a),A=0!==(r&c),r=0!==(r&d));q=1===p?q+(""+C):q+(""+p+"x"+C);G&&(q+="h");A&&(q+="v");r&&(q+="d");return q}_SetAllQuadMapChanged(){const q=this._tileCells;for(let p=0,r=q.length;p<r;++p){const x=q[p];for(let y=0,C=x.length;y<
C;++y)x[y]._SetQuadMapChanged()}this._isAnyQuadMapChanged=!0}_MaybeBuildAllQuadMap(){if(this._isAnyQuadMapChanged){this._isAnyQuadMapChanged=!1;var q=this._tileCells;for(let p=0,r=q.length;p<r;++p){const x=q[p];for(let y=0,C=x.length;y<C;++y)x[y].MaybeBuildQuadMap()}}}SetTileChanged(){this._isAnyQuadMapChanged=!0;this._SetPhysicsChanged();this._runtime.UpdateRender()}_SetPhysicsChanged(){this.GetWorldInfo().SetPhysicsBodyChanged(!0)}GetCellAt(q,p){if(0>q||0>p)return null;p=Math.floor(p/this._cellHeight);
if(p>=this._tileCells.length)return null;p=this._tileCells[p];q=Math.floor(q/this._cellWidth);return q>=p.length?null:p[q]}GetCellAtIndex(q,p){if(0>q||0>p||p>=this._tileCells.length)return null;p=this._tileCells[p];return q>=p.length?null:p[q]}GetTileAt(q,p){q=Math.floor(q);p=Math.floor(p);if(0>q||0>p||q>=this._mapWidth||p>=this._mapHeight)return-1;const r=this.GetCellAt(q,p);return r?r.GetTilesArr()[p%this._cellHeight][q%this._cellWidth]:-1}SetTileAt(q,p,r){q=Math.floor(q);p=Math.floor(p);if(!(0>
q||0>p||q>=this._mapWidth||p>=this._mapHeight||-1!==r&&(r&h)>this.GetMaxTileIndex())){var x=this.GetCellAt(q,p);x&&x.SetTileAt(q%this._cellWidth,p%this._cellHeight,r)}}GetMaxTileIndex(){return this._sdkType.GetMaxTileIndex()}WorldToCellX(q){return Math.floor((q-this.GetWorldInfo().GetX())/(this._cellWidth*this._tileWidth))}WorldToCellY(q){return Math.floor((q-this.GetWorldInfo().GetY())/(this._cellHeight*this._tileHeight))}WorldToTileX(q){return Math.floor((q-this.GetWorldInfo().GetX())/this._tileWidth)}WorldToTileY(q){return Math.floor((q-
this.GetWorldInfo().GetY())/this._tileHeight)}GetMapWidth(){return this._mapWidth}GetMapHeight(){return this._mapHeight}GetMapDisplayWidth(){return Math.floor(this.GetWorldInfo().GetWidth()/this.GetTileWidth())}GetMapDisplayHeight(){return Math.floor(this.GetWorldInfo().GetHeight()/this.GetTileHeight())}GetMapDisplaySize(){const q=this.GetWorldInfo();return[Math.floor(q.GetWidth()/this.GetTileWidth()),Math.floor(q.GetHeight()/this.GetTileHeight())]}GetTileWidth(){return this._tileWidth}GetTileHeight(){return this._tileHeight}GetCellWidth(){return this._cellWidth}GetCellHeight(){return this._cellHeight}GetCollisionRectCandidates(q,
p){var r=this.WorldToCellX(q.getLeft());const x=this.WorldToCellY(q.getTop()),y=this.WorldToCellX(q.getRight());for(q=this.WorldToCellY(q.getBottom());r<=y;++r)for(let C=x;C<=q;++C){const G=this.GetCellAtIndex(r,C);G&&(G.MaybeBuildQuadMap(),e.appendArray(p,G.GetCollisionRects()))}}TestPointOverlapTile(q,p){var r=this.WorldToTileX(q),x=this.WorldToTileY(p);r=this.GetTileAt(r,x);if(-1===r)return!1;r=this._sdkType.GetTilePoly(r);if(!r)return!0;if(!this._sdkType.IsTilePolyEnabled(r))return!1;var y=this.GetWorldInfo();
x=Math.floor((q-y.GetX())/this._tileWidth)*this._tileWidth+y.GetX();y=Math.floor((p-y.GetY())/this._tileHeight)*this._tileHeight+y.GetY();return r.containsPoint(q-x,p-y)}GetAllCollisionRects(q){const p=this._tileCells;for(let r=0,x=p.length;r<x;++r){const y=p[r];for(let C=0,G=y.length;C<G;++C){const A=y[C];A.MaybeBuildQuadMap();e.appendArray(q,A.GetCollisionRects())}}}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}GetTileUvQuad(q){const p=this._tileTexQuads;var r=
p.get(q);if(r)return r;var x=q&h;r=0!==(q&a);const y=0!==(q&c),C=0!==(q&d);var G=this.GetCurrentImageInfo(),A=G.GetWidth(),E=this._tileWidth,J=this._tileXspacing;E=Math.floor((Math.floor((A-this._tileXoffset)/(E+J)*E)+J)/E);A=x%E;x=Math.floor(x/E);E=G.GetOffsetX()+this._tileXoffset+(this._tileWidth+this._tileXspacing)*A;J=G.GetOffsetY()+this._tileYoffset+(this._tileHeight+this._tileYspacing)*x;g.setWH(E,J,this._tileWidth,this._tileHeight);g.divide(G.GetSheetWidth(),G.GetSheetHeight());G=e.New(e.Quad);
G.setFromRect(g);C&&G.diag();r&&G.mirror();y&&G.flip();G.offset(A,x);p.set(q,G);return G}_OnDynamicTextureLoadComplete(){this._tileTexQuads.clear();this._SetAllQuadMapChanged()}Draw(q){var p=this.GetCurrentImageInfo(),r=p.GetTexture();if(r){g.copy(p.GetTexRect());g.offsetLeft(this._tileXoffset/r.GetWidth());g.offsetTop(this._tileYoffset/r.GetHeight());q.SetTilemapFillMode();q.SetTilemapInfo(g,r.GetWidth(),r.GetHeight(),this._tileWidth,this._tileHeight,this._tileXspacing,this._tileYspacing);q.SetTexture(r);
var x=this.GetWorldInfo(),y=x.GetLayer();if(x.GetWidth()!==this._lastWidth||x.GetHeight()!==this._lastHeight)this._SetPhysicsChanged(),this._SetAllQuadMapChanged(),this._lastWidth=x.GetWidth(),this._lastHeight=x.GetHeight();p=x.GetX();r=x.GetY();this._runtime.IsPixelRoundingEnabled()&&(p=Math.round(p),r=Math.round(r));var C=this._cellWidth*this._tileWidth,G=this._cellHeight*this._tileHeight;x=x.GetTotalZElevation();if(y.Has3DCamera()){l.set(-Infinity,-Infinity,Infinity,Infinity);G=y._GetViewFrustum();
for(var A of this._tileCells)for(var E of A)E.GetLayoutRect(m),G.ContainsAABB(m.getLeft(),m.getTop(),x,m.getRight(),m.getBottom(),x)&&(E.MaybeBuildQuadMap(),E.Draw(q,l,p,r))}else for(y.GetViewportForZ(x,l),y=Math.floor((l.getLeft()-p)/C),A=Math.floor((l.getRight()-p)/C),E=Math.floor((l.getTop()-r)/G),G=Math.floor((l.getBottom()-r)/G),C=y;C<=A;++C)for(y=E;y<=G;++y)if(x=this.GetCellAtIndex(C,y))x.MaybeBuildQuadMap(),x.Draw(q,l,p,r)}}SaveToJson(){this._MaybeResizeTilemap();const [q,p]=this.GetMapDisplaySize();
return{tw:this._tileWidth,th:this._tileHeight,tox:this._tileXoffset,toy:this._tileYoffset,tsx:this._tileXspacing,tsy:this._tileYspacing,w:q,h:p,d:this.GetTilesAsRLECSV()}}LoadFromJson(q){this._tileWidth=q.tw;this._tileHeight=q.th;this._tileXoffset=q.tox;this._tileYoffset=q.toy;this._tileXspacing=q.tsx;this._tileYspacing=q.tsy;this._mapWidth=q.w;this._mapHeight=q.h;this._MaybeResizeTilemap(!0);this.SetTilesFromRLECSV(q.d);this._SetPhysicsChanged();this._SetAllQuadMapChanged()}GetAsJsonString(){this._MaybeResizeTilemap();
const [q,p]=this.GetMapDisplaySize();return JSON.stringify({c2tilemap:!0,width:q,height:p,data:this.GetTilesAsRLECSV()})}StateComboToFlags(q){switch(q){case 0:return 0;case 1:return a;case 2:return c;case 3:return a|d;case 4:return a|c;case 5:return c|d;case 6:return a|c|d;case 7:return d;default:return 0}}GetPropertyValueByIndex(q){switch(q){case 1:return this._tileWidth;case 2:return this._tileHeight;case 3:return this._tileXoffset;case 4:return this._tileYoffset;case 5:return this._tileXspacing;
case 6:return this._tileYspacing}}SetPropertyValueByIndex(q,p){switch(q){case 1:if(this._tileWidth===p)break;this._tileWidth=Math.max(p,1);this._cellWidth=Math.ceil(this._runtime.GetOriginalViewportWidth()/this._tileWidth);this._sdkType._ForceCacheOfTileCollisionPolys();this._UpdateQuadMaps();break;case 2:if(this._tileHeight===p)break;this._tileHeight=Math.max(p,1);this._cellHeight=Math.ceil(this._runtime.GetOriginalViewportHeight()/this._tileHeight);this._sdkType._ForceCacheOfTileCollisionPolys();
this._UpdateQuadMaps();break;case 3:if(this._tileXoffset===p)break;this._tileXoffset=p;this._UpdateQuadMaps();break;case 4:if(this._tileYoffset===p)break;this._tileYoffset=p;this._UpdateQuadMaps();break;case 5:if(this._tileXspacing===p)break;this._tileXspacing=p;this._UpdateQuadMaps();break;case 6:this._tileYspacing!==p&&(this._tileYspacing=p,this._UpdateQuadMaps())}}_UpdateQuadMaps(){this._tileTexQuads.clear();this._SetAllQuadMapChanged();this._MaybeBuildAllQuadMap()}GetScriptInterfaceClass(){return t}};
const v=new WeakMap,t=self.ITilemapInstance=class extends self.IWorldInstance{constructor(){super();v.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get mapWidth(){return v.get(this).GetMapWidth()}get mapHeight(){return v.get(this).GetMapHeight()}get mapDisplayWidth(){return v.get(this).GetMapDisplayWidth()}get mapDisplayHeight(){return v.get(this).GetMapDisplayHeight()}get tileWidth(){return v.get(this).GetTileWidth()}get tileHeight(){return v.get(this).GetTileHeight()}getTileAt(q,p){b.RequireFiniteNumber(q);
b.RequireFiniteNumber(p);return v.get(this).GetTileAt(q,p)}setTileAt(q,p,r){b.RequireFiniteNumber(q);b.RequireFiniteNumber(p);b.RequireFiniteNumber(r);return v.get(this).SetTileAt(q,p,r)}};t.TILE_FLIPPED_HORIZONTAL=a;t.TILE_FLIPPED_VERTICAL=c;t.TILE_FLIPPED_DIAGONAL=d;t.TILE_FLAGS_MASK=f;t.TILE_ID_MASK=h}
{"use strict";const e=self.C3,b=e.Plugins.Tilemap.TILE_FLAGS_MASK,a=e.Plugins.Tilemap.TILE_ID_MASK;e.Plugins.Tilemap.Cnds={CompareTileAt(c,d,f,h){c=this.GetTileAt(c,d);-1!==c&&(c&=a);return e.compare(c,f,h)},CompareTileStateAt(c,d,f){c=this.GetTileAt(c,d);d=0;-1!==c&&(d=c&b);return d===this.StateComboToFlags(f)},OnURLLoaded(){return!0},OnURLFailed(){return!0}}}
{"use strict";const e=self.C3,b=e.Plugins.Tilemap.TILE_ID_MASK;e.Plugins.Tilemap.Acts={EraseTile(a,c){this._MaybeResizeTilemap();this.SetTileAt(a,c,-1)},SetTile(a,c,d,f){this._MaybeResizeTilemap();this.SetTileAt(a,c,d&b|this.StateComboToFlags(f))},SetTileState(a,c,d){const f=this.GetTileAt(a,c);-1!==f&&(this._MaybeResizeTilemap(),this.SetTileAt(a,c,f&b|this.StateComboToFlags(d)))},EraseTileRange(a,c,d,f){const h=Math.floor(Math.max(a,0));var g=Math.floor(Math.max(c,0));a=Math.floor(Math.min(a+d,this._mapWidth));
for(c=Math.floor(Math.min(c+f,this._mapHeight));g<c;++g)for(f=h;f<a;++f)this.SetTileAt(f,g,-1)},SetTileRange(a,c,d,f,h,g){this._MaybeResizeTilemap();const l=Math.floor(Math.max(a,0));var m=Math.floor(Math.max(c,0));a=Math.floor(Math.min(a+d,this._mapWidth));c=Math.floor(Math.min(c+f,this._mapHeight));for(h=h&b|this.StateComboToFlags(g);m<c;++m)for(g=l;g<a;++g)this.SetTileAt(g,m,h)},SetTileStateRange(a,c,d,f,h){this._MaybeResizeTilemap();const g=Math.floor(Math.max(a,0));var l=Math.floor(Math.max(c,
0));a=Math.floor(Math.min(a+d,this._mapWidth));c=Math.floor(Math.min(c+f,this._mapHeight));for(h=this.StateComboToFlags(h);l<c;++l)for(f=g;f<a;++f)d=this.GetTileAt(f,l),-1!==d&&this.SetTileAt(f,l,d&b|h)},LoadFromJSON(a){let c=null;try{c=JSON.parse(a)}catch(d){console.error("[Construct 3] Failed to parse tilemap JSON: ",d);return}c.c2tilemap?(this._mapWidth=c.width,this._mapHeight=c.height,this._MaybeResizeTilemap(!0),this.SetTilesFromRLECSV(c.data),this._SetAllQuadMapChanged(),this._SetPhysicsChanged()):
console.error("[Construct 3] Unrecognized JSON data format")},JSONDownload(a){const c=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(c,a)},async LoadURL(a,c){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==a){c=this._runtime;var d=e.New(e.ImageInfo);try{await d.LoadDynamicAsset(c,a);if(!d.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return d.Release(),null;if(!await d.LoadStaticTexture(c.GetRenderer(),{sampling:this._runtime.GetSampling()}))return}catch(f){console.error("Load image from URL failed: ",
f);this.Trigger(e.Plugins.Tilemap.Cnds.OnURLFailed);return}this.WasReleased()?d.Release():(this._ReleaseOwnImage(),this._ownImageInfo=d,c.UpdateRender(),this._tileTexQuads.clear(),this._SetAllQuadMapChanged(),await this.TriggerAsync(e.Plugins.Tilemap.Cnds.OnURLLoaded))}},SetEffect(a){2<=a&&a++;this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()},SetTileWithBrush(a,c,d){this._MaybeResizeTilemap();this._autoTiling||(this._autoTiling=new e.Plugins.Tilemap.AutoTiling(this,this._sdkType));
this._autoTiling.SetAutoTile(a,c,d)},EraseTileWithBrush(a,c,d){this._MaybeResizeTilemap();this._autoTiling||(this._autoTiling=new e.Plugins.Tilemap.AutoTiling(this,this._sdkType));this._autoTiling.EraseAutoTile(a,c,d)}}}
{"use strict";const e=self.C3,b=e.Plugins.Tilemap.TILE_ID_MASK;e.Plugins.Tilemap.Exps={TileAt(a,c){a=this.GetTileAt(a,c);return-1===a?-1:a&b},PositionToTileX(a){return this.WorldToTileX(a)},PositionToTileY(a){return this.WorldToTileY(a)},TileToPositionX(a){return a*this._tileWidth+this.GetWorldInfo().GetX()+this._tileWidth/2},TileToPositionY(a){return a*this._tileHeight+this.GetWorldInfo().GetY()+this._tileHeight/2},SnapX(a){const c=this.GetWorldInfo().GetX();return Math.floor((a-c)/this._tileWidth)*
this._tileWidth+c+this._tileWidth/2},SnapY(a){const c=this.GetWorldInfo().GetY();return Math.floor((a-c)/this._tileHeight)*this._tileHeight+c+this._tileHeight/2},TilesJSON(){return this.GetAsJsonString()},TileWidth(){return this.GetTileWidth()},TileHeight(){return this.GetTileHeight()},MapDisplayWidth(){return this.GetMapDisplayWidth()},MapDisplayHeight(){return this.GetMapDisplayHeight()}}}
{"use strict";const e=self.C3,b=e.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,a=e.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,c=e.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,d=e.Plugins.Tilemap.TILE_ID_MASK,f=e.New(e.Rect),h=e.New(e.Quad);e.Plugins.Tilemap.TileQuad=class extends e.DefendedBase{constructor(){super();this._tileId=this._id=-1;this._isDiagFlip=this._isVertFlip=this._isHorizFlip=!1;this._rc=e.New(e.Rect);this._uv=null}Update(g,l,m,u,v,t,q,p){this._id=g;this._tileId=g&d;this._isHorizFlip=0!==(g&b);this._isVertFlip=
0!==(g&a);this._isDiagFlip=0!==(g&c);this._rc.setWH(u*l+t,v*m+q,l,m);this._uv=p.GetTileUvQuad(this._id)}Draw(g,l,m,u,v){f.copy(this._rc);f.offset(m,u);f.intersectsRect(l)&&(h.setFromRect(f),g.Quad4(h,this._uv))}}}
{"use strict";const e=self.C3;e.Plugins.Tilemap.TileCollisionRect=class extends e.DefendedBase{constructor(){super();this._id=-1;this._poly=null;this._rc=e.New(e.Rect)}Update(b,a,c,d,f,h,g,l){this._id=b;this._poly=a;this._rc.setWH(f*c+g,h*d+l,c,d)}ExtendRight(b){this._rc.setRight(this._rc.getRight()+b)}GetTileId(){return this._id}HasPoly(){return!!this._poly}GetPoly(){return this._poly}GetRect(){return this._rc}}}
{"use strict";const e=self.C3;e.Plugins.Tilemap.TileCell=class extends e.DefendedBase{constructor(b,a,c){super();const d=b.GetCellWidth(),f=b.GetCellHeight();this._sdkInst=b;this._x=a;this._y=c;this._left=this._x*d*b.GetTileWidth();this._top=this._y*f*b.GetTileHeight();this._tiles=[];this._quads=[];this._collisionRects=[];this._isQuadMapValid=!1;for(b=0;b<f;++b)a=new Int32Array(d),a.fill(-1),this._tiles.push(a)}Clear(){const b=this._sdkInst.GetCellWidth();var a=this._sdkInst.GetCellHeight();const c=
this._tiles;if(c.length<a)for(let d=c.length;d<a;++d)c.push(new Int32Array(b));else c.length>a&&e.truncateArray(c,a);for(let d=0,f=c.length;d<f;++d)a=c[d],a.length!==b&&(a=new Int32Array(b),c[d]=a),a.fill(-1)}GetLayoutRect(b){var a=this._sdkInst,c=a.GetWorldInfo();const d=a.GetCellWidth()*a.GetTileWidth();a=a.GetCellHeight()*a.GetTileHeight();const f=c.GetX()+this._left;c=c.GetY()+this._top;b.set(f,c,f+d,c+a)}_SetQuadMapChanged(){this._isQuadMapValid=!1}MaybeBuildQuadMap(){if(!this._isQuadMapValid){var b=
this._sdkInst,a=b.GetSdkType(),c=b.GetWorldInfo(),d=b.GetTileWidth(),f=b.GetTileHeight(),h=b.GetCellWidth(),g=b.GetCellHeight(),l=this._left,m=this._top;if(!(0>=d||0>=f)){var u=Math.min(b.GetMapWidth(),Math.floor(c.GetWidth()/d));c=Math.min(b.GetMapHeight(),Math.floor(c.GetHeight()/f));u-=l/d;c-=m/f;u>h&&(u=h);c>g&&(c=g);h=this._tiles;g=this._quads;var v=0;for(var t=0;t<c;++t){var q=h[t];for(var p=0;p<u;++p){var r=q[p];if(-1!==r){var x=void 0;v<g.length?x=g[v]:(x=e.New(e.Plugins.Tilemap.TileQuad),
g.push(x));x.Update(r,d,f,p,t,l,m,b);++v}}}v<g.length&&e.truncateArray(g,v);g=null;v=!1;b=this._collisionRects;e.clearArray(b);for(t=0;t<c;++t){q=h[t];for(p=0;p<u;++p){r=q[p];x=a.GetTilePoly(r);const y=a.IsTilePolyEnabled(x);-1!==r&&y?!g||x||v?(g&&b.push(g),g=e.New(e.Plugins.Tilemap.TileCollisionRect),g.Update(r,x,d,f,p,t,l,m),v=!!x):g.ExtendRight(d):g&&(b.push(g),g=null,v=!1)}g&&(b.push(g),g=null,v=!1)}a=b.length;for(d=0;d<a;++d)if(l=b[d],!l.HasPoly())for(l=l.GetRect(),m=d+1;m<a;++m)u=b[m],c=u.GetRect(),
c.getTop()<l.getBottom()||c.getTop()>l.getBottom()||c.getRight()>l.getRight()||c.getLeft()>l.getLeft()||u.HasPoly()||c.getLeft()!==l.getLeft()||c.getRight()!==l.getRight()||(b.splice(m,1),--a,l.setBottom(l.getBottom()+f),--m);this._isQuadMapValid=!0}}}SetTileAt(b,a,c){this._tiles[a][b]!==c&&(this._tiles[a][b]=c,this._isQuadMapValid=!1,this._sdkInst.SetTileChanged())}GetTilesArr(){return this._tiles}GetCollisionRects(){return this._collisionRects}Draw(b,a,c,d){const f=this._sdkInst,h=this._quads;for(let g=
0,l=h.length;g<l;++g)h[g].Draw(b,a,c,d,f)}}}
{"use strict";const e=self.C3,b=Object.freeze([[0,0,0],[0,0,0],[0,0,0]]);e.Plugins.Tilemap.AutoTiling=class{constructor(a,c){this._sdkInst=a;this._sdkType=c;this._brushAdapterInstances=[null,null];this._brushAdapterConstructors=[e.Plugins.Tilemap.AutoTiling16,e.Plugins.Tilemap.AutoTiling47];this._probabilityTable=new e.ProbabilityTable}get AUTO_TILING_PATCH(){return b}get IGNORE_INDEX(){return-999}get FORCE_INDEX(){return-998}get EMPTY_INDEX(){return-1}get PAINT_MODE(){return 0}get ERASE_MODE(){return 1}GetSdkIntance(){return this._sdkInst}GetSdkType(){return this._sdkType}SetAutoTile(a,c,
d){this._SetAutoTileMode(d,0);this._SetAutoTilePatch(a,c,this._GetAutoTilePatch(a,c,d))}EraseAutoTile(a,c,d){this._SetAutoTileMode(d,1);this._EraseTile(a,c);this._SetAutoTilePatch(a,c,this._GetAutoTilePatch(a,c,d))}GetTile(a,c){return this.GetSdkIntance().GetTileAt(a,c)}DoesTileExist(a,c,d){a=this.GetTile(a,c);return!!this.IsTileValid(a,!0,a,d)}IsTileValid(a,c,d,f){return-1===a?0:c&&-998===a?1:c&&f&&!this._IsTileIndexInBrush(d,f)?0:1}GetTileIndex(a,c,d,f){a=f.tileData[a];if(!a.length)return-1;if(1===
a.length)return a[0][0];const h=this.GetTile(c,d);if(this.IsTileValid(h)&&a.some(g=>h===g[0]))return h;this._probabilityTable.Clear();for(let [g,l]of a)"number"!==typeof l&&(l=1),this._probabilityTable.AddItem(l,g);return this._probabilityTable.Sample()}_SetTile(a,c,d){-1!==a&&this.GetSdkIntance().SetTileAt(a,c,d)}_EraseTile(a,c){this.GetSdkIntance().SetTileAt(a,c,-1)}_IsTileIndexInBrush(a,c){for(const d of c.tileData)for(const [f]of d)if(f===a)return!0;return!1}_SetAutoTilePatch(a,c,d){d&&(this._SetTile(a-
1,c-1,d[0][0]),this._SetTile(a,c-1,d[1][0]),this._SetTile(a+1,c-1,d[2][0]),this._SetTile(a-1,c,d[0][1]),this._SetTile(a,c,d[1][1]),this._SetTile(a+1,c,d[2][1]),this._SetTile(a-1,c+1,d[0][2]),this._SetTile(a,c+1,d[1][2]),this._SetTile(a+1,c+1,d[2][2]))}_GetBrushType(a){return this.GetSdkType().GetBrushData(a).type}_MaybeCreateBrushAdapter(a){a=this._GetBrushType(a);this._brushAdapterInstances[a]||(this._brushAdapterInstances[a]=new this._brushAdapterConstructors[a](this))}_SetAutoTileMode(a,c){this._MaybeCreateBrushAdapter(a);
a=this._GetBrushType(a);this._brushAdapterInstances[a]&&this._brushAdapterInstances[a].SetMode(c)}_GetAutoTilePatch(a,c,d){this._MaybeCreateBrushAdapter(d);d=this.GetSdkType().GetBrushData(d);if(this._brushAdapterInstances[d.type])return this._brushAdapterInstances[d.type].BuildPatch(a,c,d)}}}"use strict";
self.C3.Plugins.Tilemap.AutoTiling16=class{constructor(e){this._auto=e;this._mode=e.PAINT_MODE}SetMode(e){this._mode=e}BuildPatch(e,b,a){return this._Build4BitAutoTilePatch(e,b,a)}_Build4BitAutoTilePatch(e,b,a){const c=this._mode===this._auto.PAINT_MODE?this._4BitAutoTiling(e,b,void 0,a):this._auto.EMPTY_INDEX,d=this._Get4BitAutoTile(e,b-1,"s",a),f=this._Get4BitAutoTile(e-1,b,"e",a),h=this._Get4BitAutoTile(e+1,b,"w",a),g=this._Get4BitAutoTile(e,b+1,"n",a),l=this._auto.AUTO_TILING_PATCH;l[0][0]=this._auto.IGNORE_INDEX;
l[1][0]=this._Get4BitTileIndex(d,e,b-1,a);l[2][0]=this._auto.IGNORE_INDEX;l[0][1]=this._Get4BitTileIndex(f,e-1,b,a);l[1][1]=this._Get4BitTileIndex(c,e,b,a);l[2][1]=this._Get4BitTileIndex(h,e+1,b,a);l[0][2]=this._auto.IGNORE_INDEX;l[1][2]=this._Get4BitTileIndex(g,e,b+1,a);l[2][2]=this._auto.IGNORE_INDEX;return l}_Get4BitAutoTile(e,b,a,c){return this._auto.DoesTileExist(e,b,c)?this._4BitAutoTiling(e,b,a,c):this._auto.IGNORE_INDEX}_4BitAutoTiling(e,b,a,c){this._mode===this._auto.ERASE_MODE&&(a=void 0);
const d=this._auto.GetTile(e,b-1);var f=this._auto.GetTile(e-1,b),h=this._auto.GetTile(e+1,b);e=this._auto.GetTile(e,b+1);const g="w"===a?this._auto.FORCE_INDEX:f,l="e"===a?this._auto.FORCE_INDEX:h;b="s"===a?this._auto.FORCE_INDEX:e;a=this._auto.IsTileValid("n"===a?this._auto.FORCE_INDEX:d,!0,d,c);f=this._auto.IsTileValid(g,!0,f,c);h=this._auto.IsTileValid(l,!0,h,c);c=this._auto.IsTileValid(b,!0,e,c);return 1*a+2*f+4*h+8*c}_Get4BitTileIndex(e,b,a,c){return e===this._auto.IGNORE_INDEX||e===this._auto.EMPTY_INDEX?
e:this._auto.GetTileIndex(e,b,a,c)}};
{"use strict";const e=self.C3,b=new Map([[2,1],[8,2],[10,3],[11,4],[16,5],[18,6],[22,7],[24,8],[26,9],[27,10],[30,11],[31,12],[64,13],[66,14],[72,15],[74,16],[75,17],[80,18],[82,19],[86,20],[88,21],[90,22],[91,23],[94,24],[95,25],[104,26],[106,27],[107,28],[120,29],[122,30],[123,31],[126,32],[127,33],[208,34],[210,35],[214,36],[216,37],[218,38],[219,39],[222,40],[223,41],[248,42],[250,43],[251,44],[254,45],[255,46],[0,47]]);e.Plugins.Tilemap.AutoTiling47=class{constructor(a){this._auto=a;this._mode=
a.PAINT_MODE}SetMode(a){this._mode=a}BuildPatch(a,c,d){return this._Build8BitAutoTilePatch(a,c,d)}_Build8BitAutoTilePatch(a,c,d){const f=this._mode===this._auto.PAINT_MODE?this._8BitAutoTiling(a,c,void 0,d):this._auto.EMPTY_INDEX,h=this._Get8BitAutoTile(a-1,c-1,"se",d),g=this._Get8BitAutoTile(a,c-1,"s",d),l=this._Get8BitAutoTile(a+1,c-1,"sw",d),m=this._Get8BitAutoTile(a-1,c,"e",d),u=this._Get8BitAutoTile(a+1,c,"w",d),v=this._Get8BitAutoTile(a-1,c+1,"ne",d),t=this._Get8BitAutoTile(a,c+1,"n",d),q=this._Get8BitAutoTile(a+
1,c+1,"nw",d),p=this._auto.AUTO_TILING_PATCH;p[0][0]=this._Get8BitTileIndex(h,a-1,c-1,d);p[1][0]=this._Get8BitTileIndex(g,a,c-1,d);p[2][0]=this._Get8BitTileIndex(l,a+1,c-1,d);p[0][1]=this._Get8BitTileIndex(m,a-1,c,d);p[1][1]=this._Get8BitTileIndex(f,a,c,d);p[2][1]=this._Get8BitTileIndex(u,a+1,c,d);p[0][2]=this._Get8BitTileIndex(v,a-1,c+1,d);p[1][2]=this._Get8BitTileIndex(t,a,c+1,d);p[2][2]=this._Get8BitTileIndex(q,a+1,c+1,d);return p}_Get8BitAutoTile(a,c,d,f){return this._auto.DoesTileExist(a,c,f)?
this._8BitAutoTiling(a,c,d,f):this._auto.IGNORE_INDEX}_8BitAutoTiling(a,c,d,f){this._mode===this._auto.ERASE_MODE&&(d=void 0);const h=this._auto.GetTile(a,c-1);var g=this._auto.GetTile(a-1,c),l=this._auto.GetTile(a+1,c),m=this._auto.GetTile(a,c+1),u=this._auto.GetTile(a-1,c-1),v=this._auto.GetTile(a+1,c-1),t=this._auto.GetTile(a-1,c+1);a=this._auto.GetTile(a+1,c+1);const q="w"===d?this._auto.FORCE_INDEX:g,p="e"===d?this._auto.FORCE_INDEX:l,r="s"===d?this._auto.FORCE_INDEX:m,x="nw"===d?this._auto.FORCE_INDEX:
u,y="ne"===d?this._auto.FORCE_INDEX:v,C="sw"===d?this._auto.FORCE_INDEX:t;c="se"===d?this._auto.FORCE_INDEX:a;d=this._auto.IsTileValid("n"===d?this._auto.FORCE_INDEX:h,!0,h,f);g=this._auto.IsTileValid(q,!0,g,f);l=this._auto.IsTileValid(p,!0,l,f);m=this._auto.IsTileValid(r,!0,m,f);u=d&&g?this._auto.IsTileValid(x,!0,u,f):0;v=d&&l?this._auto.IsTileValid(y,!0,v,f):0;t=m&&g?this._auto.IsTileValid(C,!0,t,f):0;f=m&&l?this._auto.IsTileValid(c,!0,a,f):0;return 1*u+2*d+4*v+8*g+16*l+32*t+64*m+128*f}_Get8BitTileIndex(a,
c,d,f){return a===this._auto.IGNORE_INDEX||a===this._auto.EMPTY_INDEX?a:this._auto.GetTileIndex(b.get(a),c,d,f)}}}{"use strict";const e=self.C3;e.Plugins.Keyboard=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.Keyboard.Type=class extends e.SDKTypeBase{constructor(c){super(c)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let b=null;function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class extends self.IObjectClass{constructor(c){super(c);b=c;c.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(c){const d=a();if("string"===typeof c)return d.IsKeyDown(c);if("number"===
typeof c)return d.IsKeyCodeDown(c);throw new TypeError("expected string or number");}}}
{"use strict";const e=self.C3;e.Plugins.Keyboard.Instance=class extends e.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 e.CompositeDisposable(e.Disposable.From(b,"keydown",c=>this._OnKeyDown(c.data)),e.Disposable.From(b,"keyup",c=>this._OnKeyUp(c.data)),e.Disposable.From(b,"window-blur",()=>this._OnWindowOrKeyboardBlur()),
e.Disposable.From(b,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}Release(){super.Release()}_OnKeyDown(b){const a=b.which,c=b.code||a.toString();b=b.key;this._keysDownByString.has(c)||(this._keysDownByString.add(c),this._keysDownByWhich.add(a),this._triggerString=c,this._triggerWhich=a,this._triggerTypedKey=b,this.Trigger(e.Plugins.Keyboard.Cnds.OnAnyKey),this.Trigger(e.Plugins.Keyboard.Cnds.OnKey),this.Trigger(e.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed),this.Trigger(e.Plugins.Keyboard.Cnds.OnKeyCode))}_OnKeyUp(b){const a=
b.which,c=b.code||a.toString();b=b.key;this._keysDownByString.delete(c);this._keysDownByWhich.delete(a);this._triggerString=c;this._triggerWhich=a;this._triggerTypedKey=b;this.Trigger(e.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(e.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(e.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased);this.Trigger(e.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowOrKeyboardBlur(){for(const b of this._keysDownByWhich)this._keysDownByWhich.delete(b),this._triggerWhich=
b,this.Trigger(e.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(e.Plugins.Keyboard.Cnds.OnKeyReleased),this.Trigger(e.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:e.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:"plugins.keyboard.debugger.last-typed-key",value:this._triggerTypedKey}]}]}}}
{"use strict";const e="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===e[b]},OnLeftRightKeyReleased(b){return this._triggerString===e[b]},IsLeftRightKeyDown(b){return this._keysDownByString.has(e[b])}}}"use strict";self.C3.Plugins.Keyboard.Acts={};
{"use strict";function e(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 e(b)},TypedKey(){return this._triggerTypedKey}}}{"use strict";const e=self.C3;e.Plugins.Touch=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3,b=self.C3X;e.Plugins.Touch.Type=class extends e.SDKTypeBase{constructor(d){super(d)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.ITouchObjectType}};let a=null;function c(){return a.GetSingleGlobalInstance().GetSdkInstance()}self.ITouchObjectType=class extends self.IObjectClass{constructor(d){super(d);a=d;d.GetRuntime()._GetCommonScriptInterfaces().touch=this}requestPermission(d){b.RequireString(d);const f=c();if("orientation"===d)return f._RequestPermission(0);
if("motion"===d)return f._RequestPermission(1);throw Error("invalid type");}}}
{"use strict";const e=self.C3;e.Plugins.Touch.Instance=class extends e.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",c=>this._OnPermissionResult(c));b=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"pointerdown",c=>this._OnPointerDown(c.data)),e.Disposable.From(b,"pointermove",c=>this._OnPointerMove(c.data)),e.Disposable.From(b,"pointerup",c=>this._OnPointerUp(c.data,!1)),e.Disposable.From(b,"pointercancel",c=>this._OnPointerUp(c.data,!0)),e.Disposable.From(b,"deviceorientation",c=>this._OnDeviceOrientation(c.data)),
e.Disposable.From(b,"deviceorientationabsolute",c=>this._OnDeviceOrientationAbsolute(c.data)),e.Disposable.From(b,"devicemotion",c=>this._OnDeviceMotion(c.data)),e.Disposable.From(b,"tick2",c=>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 c=b.pageX-this._runtime.GetCanvasClientX();b=b.pageY-this._runtime.GetCanvasClientY();var d=
performance.now(),f=this._touches.size;this._triggerIndex=f;this._triggerId=a;var h=e.New(e.Plugins.Touch.TouchInfo);h.Init(d,c,b,a,f);this._touches.set(a,h);this.Trigger(e.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(e.Plugins.Touch.Cnds.OnTouchStart);this._curTouchX=c;this._curTouchY=b;this.Trigger(e.Plugins.Touch.Cnds.OnTouchObject)}}_OnPointerMove(b){if("mouse"!==b.pointerType||this._isMouseDown){var a=this._touches.get(b.pointerId);if(a){var c=performance.now();if(!(2>c-a.GetTime())){var d=
b.pageX-this._runtime.GetCanvasClientX(),f=b.pageY-this._runtime.GetCanvasClientY();a.Update(c,d,f,b.width,b.height,b.pressure)}}}}_OnPointerUp(b,a){if("mouse"===b.pointerType)if(this._isMouseDown)this._isMouseDown=!1;else return;const c=performance.now();b=b.pointerId;const d=this._touches.get(b);d&&(this._triggerIndex=d.GetStartIndex(),this._triggerId=d.GetId(),this.Trigger(e.Plugins.Touch.Cnds.OnNthTouchEnd),this.Trigger(e.Plugins.Touch.Cnds.OnTouchEnd),a||(a=d.ShouldTriggerTap(c),"single-tap"===
a?(this.Trigger(e.Plugins.Touch.Cnds.OnTapGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnTapGestureObject)):"double-tap"===a&&(this.Trigger(e.Plugins.Touch.Cnds.OnDoubleTapGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnDoubleTapGestureObject))),d.Release(),this._touches.delete(b))}_RequestPermission(b){this._PostToDOMMaybeSync("request-permission",{type:b});return new Promise((a,c)=>{this._permissionPromises.push({type:b,
resolve:a,reject:c})})}_OnPermissionResult(b){const a=b.result,c=b.type;this._triggerPermission=c;b=this._permissionPromises.filter(d=>d.type===c);for(const d of b)d.resolve(a?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(d=>d.type!==c);a?(this.Trigger(e.Plugins.Touch.Cnds.OnPermissionGranted),0===c?this._runtime.RequestDeviceOrientationEvent():this._runtime.RequestDeviceMotionEvent()):this.Trigger(e.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 c of this._touches.values())c.GetTime()<=b-50&&c._SetLastTime(b),c.ShouldTriggerHold(b)&&(this._triggerIndex=c.GetStartIndex(),this._triggerId=c.GetId(),this._getTouchIndex=a,this.Trigger(e.Plugins.Touch.Cnds.OnHoldGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(e.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 e=self.C3,b=[];e.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 c=a.GetCurrentSol();var d=c.GetInstances();for(const f of d){d=f.GetWorldInfo();const h=d.GetLayer();for(const g of this._touches.values()){if(!this._IsClientPosOnCanvas(g.GetX(),
g.GetY()))continue;const [l,m]=h.CanvasCssToLayer(g.GetX(),g.GetY(),d.GetTotalZElevation());if(d.ContainsPoint(l,m)){b.push(f);break}}}return b.length?(c.SetArrayPicked(b),a.ApplySolToContainer(),e.clearArray(b),!0):!1},CompareTouchSpeed(a,c,d){return(a=this._GetTouchByIndex(a))?e.compare(a.GetSpeed(),c,d):!1},OrientationSupported(){return!0},MotionSupported(){return!0},CompareOrientation(a,c,d){this._runtime.RequestDeviceOrientationEvent();return e.compare(0===a?this._orientAlpha:1===a?this._orientBeta:
this._orientGamma,c,d)},CompareAcceleration(a,c,d){this._runtime.RequestDeviceMotionEvent();return e.compare(0===a?this._accWithGX:1===a?this._accWithGY:2===a?this._accWithGZ:3===a?this._accX:4===a?this._accY:this._accZ,c,d)},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(e){this._RequestPermission(e)}};
{"use strict";const e=self.C3;e.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))?e.toDegrees(b.GetAngle()):0},AngleForID(b){return(b=this._touches.get(b))?e.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 e=self.C3;let b=-1E3,a=-1E3,c=-1E4;e.Plugins.Touch.TouchInfo=class extends e.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(d,f,h,g,l){this._pointerId=g;this._startIndex=l;this._startTime=this._lastTime=this._time=d;this._startX=f;this._startY=h;
this._x=f;this._y=h;this._lastX=f;this._lastY=h}Update(d,f,h,g,l,m){this._lastTime=this._time;this._time=d;this._lastX=this._x;this._lastY=this._y;this._x=f;this._y=h;this._width=g;this._height=l;this._pressure=m;!this._isTooFarForHold&&15<=e.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(d){this._lastTime=d}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const d=
e.distanceTo(this._x,this._y,this._lastX,this._lastY),f=(this._time-this._lastTime)/1E3;return 0<f?d/f:0}GetAngle(){return e.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(d){return this._hasTriggeredHold?!1:500<=d-this._startTime&&!this._isTooFarForHold&&15>e.distanceTo(this._startX,this._startY,this._x,this._y)?this._hasTriggeredHold=!0:!1}ShouldTriggerTap(d){if(this._hasTriggeredHold)return"";
if(333>=d-this._startTime&&!this._isTooFarForHold&&15>e.distanceTo(this._startX,this._startY,this._x,this._y)){if(666>=d-c&&25>e.distanceTo(b,a,this._x,this._y))return a=b=-1E3,c=-1E4,"double-tap";b=this._x;a=this._y;c=d;return"single-tap"}return""}GetPositionForLayer(d,f,h){return"undefined"===typeof f?d.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(this._x,this._y)[h?0:1]:(d=d.GetLayer(f))?d.CanvasCssToLayer(this._x,this._y)[h?0:1]:0}}}
{"use strict";const e=self.C3;e.Plugins.gamepad=class extends e.SDKPluginBase{constructor(b){super(b);this._isSupported=!1;this._runtime.AddLoadPromise(this._runtime.PostComponentMessageToDOMAsync("gamepad","is-supported").then(a=>this._isSupported=!!a))}Release(){super.Release()}IsSupported(){return this._isSupported}}}{"use strict";const e=self.C3;e.Plugins.gamepad.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;class b{constructor(c,d){this._index=c;this._id=d;this._state=new a;this._oldState=new a;this._buttonsPressed=[];this._buttonsReleased=[]}GetID(){return this._id}Update(c,d){const f=this._oldState;this._oldState=this._state;this._state=f;this._state.Update(c,d);e.resizeArray(this._buttonsPressed,this._state.GetButtonCount(),!1);e.resizeArray(this._buttonsReleased,this._state.GetButtonCount(),!1);for(let h=0,g=this._state.GetButtonCount();h<g;++h)c=this._oldState.GetButtonAt(h),
d=this._state.GetButtonAt(h),.5<=d&&.5>c&&(this._buttonsPressed[h]=!0),.5>d&&.5<=c&&(this._buttonsReleased[h]=!0)}GetButtonCount(){return this._state.GetButtonCount()}GetAxisCount(){return this._state.GetAxisCount()}HasButtonBecomePressed(c){c=Math.floor(c);return 0>c||c>=this._buttonsPressed.length?!1:this._buttonsPressed[c]}HasButtonBecomeReleased(c){c=Math.floor(c);return 0>c||c>=this._buttonsReleased.length?!1:this._buttonsReleased[c]}ResetButtonPressAndReleaseFlags(){this._buttonsPressed.fill(!1);
this._buttonsReleased.fill(!1)}GetButtonAt(c){return this._state.GetButtonAt(c)}IsButtonDown(c){return.5<=this._state.GetButtonAt(c)}GetAxisAt(c){return this._state.GetAxisAt(c)}}class a{constructor(){this._buttons=[];this._axes=[]}Update(c,d){const f=this._buttons;let h=0;for(let g=c.length;h<g;++h){const l=c[h];h===f.length?f.push(l.value):f[h]=l.value}h<f.length&&e.truncateArray(f,h);e.shallowAssignArray(this._axes,d)}GetButtonCount(){return this._buttons.length}GetAxisCount(){return this._axes.length}GetButtonAt(c){c=
Math.floor(c);return 0>c||c>=this._buttons.length?0:this._buttons[c]}GetAxisAt(c){c=Math.floor(c);return 0>c||c>=this._axes.length?0:this._axes[c]}}e.Plugins.gamepad.Instance=class extends e.SDKInstanceBase{constructor(c,d){super(c,"gamepad");this._deadZone=25;this._lastButton=0;this._lastIndex=-1;this._gamepads=new Map;d&&(this._deadZone=d[0]);this.AddDOMMessageHandler("gamepad-connected",f=>this._OnGamepadConnected(f));this.AddDOMMessageHandler("gamepad-disconnected",f=>this._OnGamepadDisconnected(f));
this.AddDOMMessageHandler("input-update",f=>this._OnInputUpdate(f));c=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(c,"tick2",()=>this._OnTick2()));this.PostToDOM("ready")}Release(){super.Release()}_OnGamepadConnected(c){const d=c.index;this._lastIndex=d;c=c.id;this._gamepads.has(d)||(this._gamepads.set(d,new b(d,c)),this.Trigger(e.Plugins.gamepad.Cnds.OnGamepadConnected),this._lastIndex=-1)}_OnGamepadDisconnected(c){this._lastIndex=c=c.index;this.Trigger(e.Plugins.gamepad.Cnds.OnGamepadDisconnected);
this._gamepads.delete(c);this._lastIndex=-1}_OnInputUpdate(c){for(const d of c)this._OnGamepadInputUpdate(d)}_OnGamepadInputUpdate(c){var d=c.index;this._gamepads.has(d)||this._OnGamepadConnected(c);d=this._gamepads.get(d);d.Update(c.buttons,c.axes);for(let f=0,h=d.GetButtonCount();f<h;++f)d.HasButtonBecomePressed(f)&&(this._lastButton=f)}_GetGamepadByIndex(c){return this._gamepads.get(Math.floor(c))||null}_OnTick2(){for(const c of this._gamepads.values())c.ResetButtonPressAndReleaseFlags()}GetDebuggerProperties(){return[{title:"plugins.gamepad.name",
properties:[{name:"plugins.gamepad.debugger.last-button",value:this._lastButton}]}]}}}
{"use strict";const e=self.C3;e.Plugins.gamepad.Cnds={SupportsGamepad(){return this.GetPlugin().IsSupported()},OnGamepadConnected(){return!0},OnGamepadDisconnected(){return!0},IsButtonDown(b,a){b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.IsButtonDown(a))this._lastButton=a;return b},OnButtonDown(b,a){b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.HasButtonBecomePressed(a))this._lastButton=a;return b},OnButtonUp(b,a){b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.HasButtonBecomeReleased(a))this._lastButton=
a;return b},HasGamepads(){return 0<this._gamepads.size},CompareAxis(b,a,c,d){a=Math.floor(a);const f=this._GetGamepadByIndex(b);if(!f)return!1;b=f.GetAxisAt(a);a=0===a%2?f.GetAxisAt(a+1):f.GetAxisAt(a-1);b*=100;Math.hypot(b,100*a)<=this._deadZone&&(b=0);return e.compare(b,c,d)},OnAnyButtonDown(b){b=this._GetGamepadByIndex(b);if(!b)return!1;for(let a=0,c=b.GetButtonCount();a<c;++a)if(b.HasButtonBecomePressed(a))return this._lastButton=a,!0;return!1},OnAnyButtonUp(b){b=this._GetGamepadByIndex(b);if(!b)return!1;
for(let a=0,c=b.GetButtonCount();a<c;++a)if(b.HasButtonBecomeReleased(a))return this._lastButton=a,!0;return!1},IsButtonIndexDown(b,a){a=Math.floor(a);b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.IsButtonDown(a))this._lastButton=a;return b},OnButtonIndexDown(b,a){a=Math.floor(a);b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.HasButtonBecomePressed(a))this._lastButton=a;return b},OnButtonIndexUp(b,a){a=Math.floor(a);b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.HasButtonBecomeReleased(a))this._lastButton=
a;return b}}}{"use strict";const e=self.C3;e.Plugins.gamepad.Acts={Vibrate(b,a,c,d){this.PostToDOM("vibrate",{index:b,duration:a,weakMag:e.clamp(c/100,0,1),strongMag:e.clamp(d/100,0,1)})},ResetVibrate(b){this.PostToDOM("reset-vibrate",{index:b})}}}"use strict";
self.C3.Plugins.gamepad.Exps={GamepadCount(){return this._gamepads.size},GamepadID(e){return(e=this._GetGamepadByIndex(e))?e.GetID():""},GamepadIndex(){return this._lastIndex},GamepadAxes(e){e=this._GetGamepadByIndex(e);if(!e)return"";let b="";for(let a=0,c=e.GetAxisCount();a<c;++a)b+=`Axis ${a}: ${Math.round(100*e.GetAxisAt(a))}\n`;return b},GamepadButtons(e){e=this._GetGamepadByIndex(e);if(!e)return"";let b="";for(let a=0,c=e.GetButtonCount();a<c;++a)b+=`Button ${a}: ${Math.round(100*e.GetButtonAt(a))}\n`;
return b},RawButton(e,b){return(e=this._GetGamepadByIndex(e))?e.GetButtonAt(Math.floor(b)):0},RawAxis(e,b){return(e=this._GetGamepadByIndex(e))?e.GetAxisAt(Math.floor(b)):0},RawButtonCount(e){return(e=this._GetGamepadByIndex(e))?e.GetButtonCount():0},RawAxisCount(e){return(e=this._GetGamepadByIndex(e))?e.GetAxisCount():0},Button(e,b){return(e=this._GetGamepadByIndex(e))?100*e.GetButtonAt(Math.floor(b)):0},Axis(e,b){b=Math.floor(b);const a=this._GetGamepadByIndex(e);if(!a)return 0;e=a.GetAxisAt(b);
b=0===b%2?a.GetAxisAt(b+1):a.GetAxisAt(b-1);e*=100;Math.hypot(e,100*b)<=this._deadZone&&(e=0);return e},LastButton(){return this._lastButton}};{"use strict";const e=self.C3;e.Plugins.Audio=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.Audio.Type=class extends e.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 e=self.C3,b=["interactive","balanced","playback"];e.Plugins.Audio.Instance=class extends e.SDKInstanceBase{constructor(a,c){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";c&&(this._timeScaleMode=c[0],this._saveLoadMode=c[1],this._playInBackground=c[2],a=b[c[3]],this._panningModel=c[4],this._distanceModel=c[5],this._listenerZ=-c[6],this._referenceDistance=c[7],this._maxDistance=c[8],this._rolloffFactor=c[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=
[];this.AddDOMMessageHandlers([["state",d=>this._OnUpdateState(d)],["fxstate",d=>this._OnUpdateFxState(d)],["trigger",d=>this._OnTrigger(d)]]);c=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(c,"instancedestroy",d=>this._OnInstanceDestroyed(d.instance)),e.Disposable.From(c,"afterload",()=>this._OnAfterLoad()),e.Disposable.From(c,"suspend",()=>this._OnSuspend()),e.Disposable.From(c,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",
{preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(d=>({originalUrl:d.originalUrl,url:d.url,type:d.type,fileSize:d.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(d=>{this._sampleRate=d.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 c=a.tickCount,d=this._lastAIState.filter(f=>f.hasOwnProperty("placeholder")&&(f.placeholder>c||-1===f.placeholder));this._lastAIState=a.audioInstances;this._lastAnalysersData=a.analysers;0<d.length&&e.appendArray(this._lastAIState,d)}_OnUpdateFxState(a){this._lastFxState=a.fxstate}_GetFirstAudioStateByTag(a){for(const c of this._lastAIState)if(e.equalsNoCase(c.tag,a))return c;return null}_IsTagPlaying(a){return this._lastAIState.some(c=>
e.equalsNoCase(a,c.tag)&&c.isPlaying)}_MaybeMarkAsPlaying(a,c,d,f){if(this._IsTagPlaying(a))return null;a={tag:a,duration:0,volume:f,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:c,isLooping:d,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(a);return a}async _OnTrigger(a){const c=a.type;this._triggerTag=a.tag;a=a.aiid;if("ended"===c){for(const d of this._lastAIState)if(d.aiid===a){d.isPlaying=!1;break}await this.TriggerAsync(e.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"===
c&&await this.TriggerAsync(e.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const a={timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),instPans:this.GetInstancePans(),tickCount:this._runtime.GetTickCountNoSave()};if(this._listenerInst){const c=this._listenerInst.GetWorldInfo();this._listenerX=c.GetX();this._listenerY=c.GetY();a.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(a,c,d,f,h){if(0===d)return[a,c];const g=Math.sin(d);
d=Math.cos(d);a-=f;c-=h;const l=a*g;a=a*d-c*g;return[a+f,c*d+l+h]}GetInstancePans(){return this._lastAIState.filter(a=>-1!==a.uid).map(a=>this._runtime.GetInstanceByUID(a.uid)).filter(a=>a).map(a=>{const c=a.GetWorldInfo(),d=c.GetLayer().GetAngle(),[f,h]=this.rotatePtAround(c.GetX(),c.GetY(),-d,this._listenerX,this._listenerY);return{uid:a.GetUID(),x:f,y:h,angle:c.GetAngle()-d}})}GetAnalyserData(a,c){for(const d of this._lastAnalysersData)if(d.index===c&&e.equalsNoCase(d.tag,a))return d;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 [c,d]of a.remoteUrls)this._remoteUrls.set(c,d);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 c of this._lastAIState)(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c.bufferOriginalUrl))?(c.bufferUrl=a.url,c.bufferType=a.type):c.bufferUrl=null;for(const d of Object.values(this._lastFxState))for(const f of d)f.hasOwnProperty("bufferOriginalUrl")&&(c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(f.bufferOriginalUrl))&&(f.bufferUrl=c.url,f.bufferType=c.type);this.PostToDOM("load-state",{saveLoadMode:this._saveLoadMode,
timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),listenerPos:[this._listenerX,this._listenerY,this._listenerZ],isSilent:this._isSilent,masterVolume:this._masterVolume,playing:this._lastAIState.filter(d=>null!==d.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const a=[];for(const [c,d]of Object.entries(this._lastFxState))a.push({name:"$"+c,value:d.map(f=>f.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((c,d)=>({name:"$#"+d,value:`${c.bufferOriginalUrl} ("${c.tag}") ${Math.round(10*c.playbackTime)/10} / ${Math.round(10*c.duration)/10}`}))]}]}}}
{"use strict";const e=self.C3;e.Plugins.Audio.Cnds={OnEnded(b){return e.equalsNoCase(this._triggerTag,b)},OnFadeEnded(b){return e.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 e=self.C3,b="lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ");e.Plugins.Audio.Acts={async Play(a,c,d,f,h){if(!this._isSilent){var g=a[1],l=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(l){h=h?h:0;var m=this._nextPlayTime;this._nextPlayTime=0;var u=this._MaybeMarkAsPlaying(f.toLowerCase(),g,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:l.url,type:l.type,isMusic:g,tag:f.toLowerCase(),isLooping:0!==
c,vol:this.DbToLinear(d),pos:h,off:m,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{u&&(u.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,c,d,f,h,g,l,m,u,v){if(!this._isSilent){var t=a[1],q=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(q){var p=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(v.toLowerCase(),t,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:q.url,type:q.type,isMusic:t,
tag:v.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:p,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:f,y:h,angle:e.toRadians(g),innerAngle:e.toRadians(l),outerAngle:e.toRadians(m),outerGain:this.DbToLinear(u)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,c,d,f,h,g,l,m){if(!this._isSilent&&f&&(f=f.GetFirstPicked())&&f.GetWorldInfo()){var u=f.GetWorldInfo(),v=u.GetLayer().GetAngle(),[t,q]=this.rotatePtAround(u.GetX(),u.GetY(),-v,
this._listenerX,this._listenerY),p=a[1],r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(r){var x=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(m.toLowerCase(),p,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:r.url,type:r.type,isMusic:p,tag:m.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:x,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:t,y:q,angle:u.GetAngle()-v,innerAngle:e.toRadians(h),outerAngle:e.toRadians(g),
outerGain:this.DbToLinear(l),uid:f.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(a,c,d,f,h){if(!this._isSilent){a=1===a;var g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(g){var l=this._nextPlayTime;this._nextPlayTime=0;var m=this._MaybeMarkAsPlaying(h.toLowerCase(),a,0!==d,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:c,url:g.url,type:g.type,isMusic:a,tag:h.toLowerCase(),
isLooping:0!==d,vol:this.DbToLinear(f),pos:0,off:l,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{m&&(m.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,c,d,f,h,g,l,m,u,v,t){if(!this._isSilent){a=1===a;var q=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(q){var p=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(t.toLowerCase(),a,0!==d,this.DbToLinear(f));try{await this.PostToDOMAsync("play",
{originalUrl:c,url:q.url,type:q.type,isMusic:a,tag:t.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(f),pos:0,off:p,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:h,y:g,angle:e.toRadians(l),innerAngle:e.toRadians(m),outerAngle:e.toRadians(u),outerGain:this.DbToLinear(v)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,c,d,f,h,g,l,m,u){if(!this._isSilent&&!this._isSilent&&h&&(h=h.GetFirstPicked())&&h.GetWorldInfo()){var v=h.GetWorldInfo(),
t=v.GetLayer().GetAngle(),[q,p]=this.rotatePtAround(v.GetX(),v.GetY(),-t,this._listenerX,this._listenerY);a=1===a;var r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(r){var x=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(u.toLowerCase(),a,0!==d,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:c,url:r.url,type:r.type,isMusic:a,tag:u.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(f),pos:0,off:x,trueClock:!!self.C3_GetAudioContextCurrentTime,
panning:{x:q,y:p,angle:v.GetAngle()-t,innerAngle:e.toRadians(g),outerAngle:e.toRadians(l),outerGain:this.DbToLinear(m),uid:h.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},SetLooping(a,c){this.PostToDOM("set-looping",{tag:a.toLowerCase(),isLooping:0===c})},SetMuted(a,c){this.PostToDOM("set-muted",{tag:a.toLowerCase(),isMuted:0===c})},SetVolume(a,c){this.PostToDOM("set-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(c)})},FadeVolume(a,c,d,f){this.PostToDOM("fade-volume",
{tag:a.toLowerCase(),vol:this.DbToLinear(c),duration:d,stopOnEnd:0===f})},async Preload(a){const c=a[1],d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);d&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:a[0],url:d.url,type:d.type,isMusic:c}),this._preloadCount++)},async PreloadByName(a,c){a=1===a;const d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());d&&(this._preloadTotal++,await this.PostToDOMAsync("preload",
{originalUrl:c,url:d.url,type:d.type,isMusic:a}),this._preloadCount++)},SetPlaybackRate(a,c){this.PostToDOM("set-playback-rate",{tag:a.toLowerCase(),rate:Math.max(c,0)})},Stop(a){this.PostToDOM("stop",{tag:a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,c){this.PostToDOM("set-paused",{tag:a.toLowerCase(),paused:0===c})},Seek(a,c){this.PostToDOM("seek",{tag:a.toLowerCase(),pos:c})},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,c,d,f,h,g,l){a=a.toLowerCase();c=b[c];this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"filter",tag:a,params:[c,d,f,h,g,e.clamp(l/100,0,1)]})},AddDelayEffect(a,c,d,f){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"delay",tag:a,params:[c,this.DbToLinear(d),e.clamp(f/100,0,1)]})},AddFlangerEffect(a,
c,d,f,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"flanger",tag:a,params:[c/1E3,d/1E3,f,h/100,e.clamp(g/100,0,1)]})},AddPhaserEffect(a,c,d,f,h,g,l){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"phaser",tag:a,params:[c,d,f,h,g,e.clamp(l/100,0,1)]})},AddConvolutionEffect(a,c,d,f){a=a.toLowerCase();const h=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c[0]);h&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect",
{type:"convolution",tag:a,bufferOriginalUrl:c[0],bufferUrl:h.url,bufferType:h.type,params:[0===d,e.clamp(f/100,0,1)]}))},AddGainEffect(a,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[this.DbToLinear(c)]})},AddMuteEffect(a){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[0]})},AddTremoloEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"tremolo",
tag:a,params:[c,e.clamp(d/100,0,1)]})},AddRingModEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"ringmod",tag:a,params:[c,e.clamp(d/100,0,1)]})},AddDistortionEffect(a,c,d,f,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"distortion",tag:a,params:[this.DbToLinearNoCap(c),this.DbToLinearNoCap(d),f,this.DbToLinearNoCap(h),e.clamp(g/100,0,1)]})},AddCompressorEffect(a,c,d,f,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);
this.PostToDOM("add-effect",{type:"compressor",tag:a,params:[c,d,f,h/1E3,g/1E3]})},AddAnalyserEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"analyser",tag:a,params:[c,d]})},RemoveEffects(a){a=a.toLowerCase();this._effectCount.set(a,0);this.PostToDOM("remove-effects",{tag:a});this._lastFxState={}},SetEffectParameter(a,c,d,f,h,g){this.PostToDOM("set-effect-param",{tag:a.toLowerCase(),index:Math.floor(c),param:d,value:f,ramp:h,time:g})},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 c=a[1];(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]))&&this.PostToDOM("unload",{url:a.url,type:a.type,isMusic:c})},UnloadAudioByName(a,c){a=1===a;(c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase()))&&this.PostToDOM("unload",{url:c.url,type:c.type,isMusic:a})},
UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(a,c,d){this._remoteUrls.set(d.toLowerCase(),{url:a,type:c})}}}"use strict";
self.C3.Plugins.Audio.Exps={Duration(e){return(e=this._GetFirstAudioStateByTag(e))?e.duration:0},PlaybackTime(e){return(e=this._GetFirstAudioStateByTag(e))?e.playbackTime:0},PlaybackRate(e){return(e=this._GetFirstAudioStateByTag(e))?e.playbackRate:0},Volume(e){return(e=this._GetFirstAudioStateByTag(e))?this.LinearToDb(e.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(e){return this._effectCount.get(e.toLowerCase())||0},AnalyserFreqBinCount(e,b){return(e=this.GetAnalyserData(e,
Math.floor(b)))?e.binCount:0},AnalyserFreqBinAt(e,b,a){e=this.GetAnalyserData(e,Math.floor(b));if(!e)return 0;a=Math.floor(a);return 0>a||a>=e.binCount?0:e.freqBins[a]},AnalyserPeakLevel(e,b){return(e=this.GetAnalyserData(e,Math.floor(b)))?e.peak:0},AnalyserRMSLevel(e,b){return(e=this.GetAnalyserData(e,Math.floor(b)))?e.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/1E3}};
{"use strict";const e=self.C3;e.Plugins.TiledBg=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;function b(a){switch(a){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}e.Plugins.TiledBg.Type=class extends e.SDKTypeBase{constructor(a,c){super(a);this._wrapY=this._wrapX="repeat";c&&(this._wrapX=b(c[0]),this._wrapY=b(c[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 e=self.C3,b=self.C3X,a=e.New(e.Rect),c=e.New(e.Quad),d=e.New(e.Rect),f=e.New(e.Quad);e.Plugins.TiledBg.Instance=class extends e.SDKWorldInstanceBase{constructor(g,l){super(g);this._imageOffsetY=this._imageOffsetX=0;this._imageScaleY=this._imageScaleX=1;this._imageAngle=0;this._ownImageInfo=null;l&&(this.GetWorldInfo().SetVisible(!!l[0]),this._imageOffsetX=l[4],this._imageOffsetY=l[5],this._imageScaleX=l[6],this._imageScaleY=l[7],this._imageAngle=e.toRadians(l[8]))}Release(){this._ReleaseOwnImage();
super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}CalculateTextureCoordsFor3DFace(g,l,m){var u=this.GetCurrentImageInfo();const v=u.GetWidth();u=u.GetHeight();const t=this._imageOffsetX/v,q=this._imageOffsetY/u,p=this._imageAngle;d.set(0,0,g/(v*this._imageScaleX),l/(u*this._imageScaleY));d.offset(-t,-q);0===p?m.setFromRect(d):m.setFromRotatedRect(d,-p)}Draw(g){var l=this.GetCurrentImageInfo(),m=l.GetTexture();if(null!==m){g.SetTexture(m);
m=l.GetWidth();l=l.GetHeight();var u=this._imageOffsetX/m,v=this._imageOffsetY/l,t=this.GetWorldInfo();d.set(0,0,t.GetWidth()/(m*this._imageScaleX),t.GetHeight()/(l*this._imageScaleY));d.offset(-u,-v);t.HasMesh()?this._DrawMesh(t,g):this._DrawStandard(t,g)}}_DrawStandard(g,l){let m=g.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));0===this._imageAngle?l.Quad3(m,d):(f.setFromRotatedRect(d,-this._imageAngle),l.Quad4(m,f))}_DrawMesh(g,l){const m=g.GetTransformedMesh();
if(g.IsMeshChanged()){g.CalculateBbox(a,c,!1);let u=c;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));let v=d;0!==this._imageAngle&&(f.setFromRotatedRect(d,-this._imageAngle),v=f);m.CalculateTransformedMesh(g.GetSourceMesh(),u,v);g.SetMeshChanged(!1)}m.Draw(l)}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}IsOriginalSizeKnown(){return!0}GetTexture(){return this.GetCurrentImageInfo().GetTexture()}_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,
l){switch(g){case 4:this._SetImageOffsetX(l);break;case 5:this._SetImageOffsetY(l);break;case 6:this._SetImageScaleX(l);break;case 7:this._SetImageScaleY(l);break;case 8:this._SetImageAngle(l)}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const h=new WeakMap;self.ITiledBackgroundInstance=class extends self.IWorldInstance{constructor(){super();h.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(g){b.RequireFiniteNumber(g);h.get(this)._SetImageOffsetX(g)}get imageOffsetX(){return h.get(this)._GetImageOffsetX()}set imageOffsetY(g){b.RequireFiniteNumber(g);
h.get(this)._SetImageOffsetY(g)}get imageOffsetY(){return h.get(this)._GetImageOffsetY()}set imageScaleX(g){b.RequireFiniteNumber(g);h.get(this)._SetImageScaleX(g)}get imageScaleX(){return h.get(this)._GetImageScaleX()}set imageScaleY(g){b.RequireFiniteNumber(g);h.get(this)._SetImageScaleY(g)}get imageScaleY(){return h.get(this)._GetImageScaleY()}set imageAngle(g){b.RequireFiniteNumber(g);h.get(this)._SetImageAngle(g)}get imageAngle(){return h.get(this)._GetImageAngle()}set imageAngleDegrees(g){b.RequireFiniteNumber(g);
h.get(this)._SetImageAngle(e.toRadians(g))}get imageAngleDegrees(){return e.toDegrees(h.get(this)._GetImageAngle())}get imageWidth(){return h.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return h.get(this).GetCurrentImageInfo().GetHeight()}}}"use strict";self.C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}};
{"use strict";const e=self.C3;e.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(e.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 c=e.New(e.ImageInfo);try{await c.LoadDynamicAsset(a,
b);if(!c.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return c.Release(),null;if(!await c.LoadStaticTexture(a.GetRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"}))return}catch(d){console.error("Load image from URL failed: ",d);this.Trigger(e.Plugins.TiledBg.Cnds.OnURLFailed);return}this.WasReleased()?c.Release():(this._ReleaseOwnImage(),this._ownImageInfo=c,a.UpdateRender(),await this.TriggerAsync(e.Plugins.TiledBg.Cnds.OnURLLoaded))}}}}
{"use strict";const e=self.C3;e.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 e.toDegrees(this._imageAngle)}}}
{"use strict";const e=self.C3;e.Plugins.TextBox=class extends e.SDKDOMPluginBase{constructor(b){super(b,"text-input");this.AddElementMessageHandler("click",(a,c)=>a._OnClick(c));this.AddElementMessageHandler("dblclick",(a,c)=>a._OnDoubleClick(c));this.AddElementMessageHandler("change",(a,c)=>a._OnChange(c))}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.TextBox.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=self.C3X,a="text password email number tel url textarea search".split(" ");e.Plugins.TextBox.Instance=class extends e.SDKDOMInstanceBase{constructor(d,f){super(d,"text-input");this._title=this._placeholder=this._text="";this._isEnabled=!0;this._spellCheck=this._isReadOnly=!1;this._type="text";this._autoFontSize=!0;this._maxLength=-1;this._id="";f&&(this._text=f[0],this._placeholder=f[1],this._title=f[2],this.GetWorldInfo().SetVisible(f[3]),this._isEnabled=f[4],this._isReadOnly=
f[5],this._spellCheck=f[6],this._type=a[f[7]],this._autoFontSize=f[8],this._id=f[9]);this.CreateElement({type:this._type,id:this._id})}Release(){super.Release()}GetElementState(){return{text:this._text,placeholder:this._placeholder,title:this._title,isEnabled:this._isEnabled,isReadOnly:this._isReadOnly,spellCheck:this._spellCheck,maxLength:this._maxLength}}async _OnClick(d){this.DispatchScriptEvent("click",!0);await this.TriggerAsync(e.Plugins.TextBox.Cnds.OnClicked)}async _OnDoubleClick(d){this.DispatchScriptEvent("dblclick",
!0);await this.TriggerAsync(e.Plugins.TextBox.Cnds.OnDoubleClicked)}async _OnChange(d){this._text=d.text;this.DispatchScriptEvent("change",!0);await this.TriggerAsync(e.Plugins.TextBox.Cnds.OnTextChanged)}_SetText(d){this._text!==d&&(this._text=d,this.UpdateElementState())}_GetText(){return this._text}_SetPlaceholder(d){this._placeholder!==d&&(this._placeholder=d,this.UpdateElementState())}_GetPlaceholder(){return this._placeholder}_SetTooltip(d){this._title!==d&&(this._title=d,this.UpdateElementState())}_GetTooltip(){return this._title}_SetEnabled(d){d=
!!d;this._isEnabled!==d&&(this._isEnabled=d,this.UpdateElementState())}_IsEnabled(){return this._isEnabled}_SetReadOnly(d){d=!!d;this._isReadOnly!==d&&(this._isReadOnly=d,this.UpdateElementState())}_IsReadOnly(){return this._isReadOnly}_SetMaxLength(d){d=Math.max(+d,-1);this._maxLength!==d&&(this._maxLength=d,this.UpdateElementState())}_GetMaxLength(){return this._maxLength}_ScrollToBottom(){Promise.resolve().then(()=>this.PostToDOMElement("scroll-to-bottom"))}Draw(d){}SaveToJson(){return{t:this._text,
p:this._placeholder,ti:this._title,e:this._isEnabled,r:this._isReadOnly,sp:this._spellCheck,ml:this._maxLength,type:this._type,id:this._id}}LoadFromJson(d){this._text=d.t;this._placeholder=d.p;this._title=d.ti;this._isEnabled=d.e;this._isReadOnly=d.r;this._spellCheck=d.sp;this._maxLength=d.hasOwnProperty("ml")?d.ml:-1;this._type=d.type;this._id=d.id;this.UpdateElementState()}GetPropertyValueByIndex(d){switch(d){case 0:return this._text;case 1:return this._placeholder;case 2:return this._title;case 4:return this._isEnabled;
case 5:return this._isReadOnly;case 6:return this._spellCheck;case 8:return this._autoFontSize;case 9:return this._id}}SetPropertyValueByIndex(d,f){switch(d){case 0:if(this._text===f)break;this._text=f;this.UpdateElementState();break;case 1:if(this._placeholder===f)break;this._placeholder=f;this.UpdateElementState();break;case 2:if(this._title===f)break;this._title=f;this.UpdateElementState();break;case 4:if(this._isEnabled===!!f)break;this._isEnabled=!!f;this.UpdateElementState();break;case 5:if(this._isReadOnly===
!!f)break;this._isReadOnly=!!f;this.UpdateElementState();break;case 6:if(this._spellCheck===!!f)break;this._spellCheck=!!f;this.UpdateElementState();break;case 8:this._autoFontSize=!!f;break;case 9:this._id!==f&&(this._id=f,this.UpdateElementState())}}GetDebuggerProperties(){const d=e.Plugins.TextBox.Acts;return[{title:"plugins.textbox.name",properties:[{name:"plugins.textbox.properties.text.name",value:this._text,onedit:f=>this.CallAction(d.SetText,f)},{name:"plugins.textbox.properties.enabled.name",
value:this._isEnabled,onedit:f=>this.CallAction(d.SetEnabled,f)},{name:"plugins.textbox.properties.read-only.name",value:this._isReadOnly,onedit:f=>this.CallAction(d.SetReadOnly,f)}]}]}GetScriptInterfaceClass(){return self.ITextInputInstance}};const c=new WeakMap;self.ITextInputInstance=class extends self.IDOMInstance{constructor(){super();c.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set text(d){b.RequireString(d);c.get(this)._SetText(d)}get text(){return c.get(this)._GetText()}set placeholder(d){b.RequireString(d);
c.get(this)._SetPlaceholder(d)}get placeholder(){return c.get(this)._GetPlaceholder()}set tooltip(d){b.RequireString(d);c.get(this)._SetTooltip(d)}get tooltip(){return c.get(this)._GetTooltip()}set isEnabled(d){c.get(this)._SetEnabled(d)}get isEnabled(){return c.get(this)._IsEnabled()}set isReadOnly(d){c.get(this)._SetReadOnly(d)}get isReadOnly(){return c.get(this)._IsReadOnly()}set maxLength(d){b.RequireFiniteNumber(d);c.get(this)._SetMaxLength(d)}get maxLength(){return c.get(this)._GetMaxLength()}scrollToBottom(){c.get(this)._ScrollToBottom()}}}
{"use strict";const e=self.C3;e.Plugins.TextBox.Cnds={CompareText(b,a){return 0===a?e.equalsNoCase(this._text,b):this._text===b},OnTextChanged(){return!0},OnClicked(){return!0},OnDoubleClicked(){return!0}}}"use strict";
self.C3.Plugins.TextBox.Acts={SetText(e){this._SetText(e.toString())},AppendText(e){""!==e&&this._SetText(this._GetText()+e)},SetPlaceholder(e){this._SetPlaceholder(e)},SetTooltip(e){this._SetTooltip(e)},SetReadOnly(e){this._SetReadOnly(0===e)},ScrollToBottom(){this._ScrollToBottom()},SetMaxLength(e){this._SetMaxLength(e)}};"use strict";self.C3.Plugins.TextBox.Exps={Text(){return this._GetText()},MaxLength(){return this._GetMaxLength()}};{"use strict";const e=self.C3;e.Plugins.NodeWebkit=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.NodeWebkit.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=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"]]);e.Plugins.NodeWebkit.Instance=class extends e.SDKInstanceBase{constructor(a,c){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",c=>this._OnDrop(c)],
["open-dlg",c=>this._OnOpenDlg(c)],["open-dlg-cancel",()=>this._OnOpenDlgCancel()],["folder-dlg",c=>this._OnFolderDlg(c)],["folder-dlg-cancel",()=>this._OnFolderDlgCancel()],["save-dlg",c=>this._OnSaveDlg(c)],["save-dlg-cancel",()=>this._OnSaveDlgCancel()],["window-change",c=>this._OnWindowChange(c)],["clipboard-change",c=>this._OnClipboardChange(c)]]);this._runtime.AddLoadPromise(this.PostToDOMAsync("init").then(c=>{this._OnWindowChange(c);this._OnClipboardChange(c);this._argv=c.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 c=a.buffer,d=a.byteLength,f=a.byteOffset;return c.byteLength!==a.length?c.slice(f,f+d):c}_GetBinaryDataSdkInstance(a){return a?(a=a.GetFirstPicked(this._inst))?a.GetSdkInstance():null:null}_ReadBinaryFile(a){return new Promise((c,d)=>{this._fs.readFile(a,{},(f,
h)=>{f?d(f):c(this._BufferToArrayBuffer(h))})})}_WriteBinaryFile(a,c){e.WeakRequireInstanceOf(c,ArrayBuffer);const d=new Uint8Array(c);return new Promise((f,h)=>{this._fs.writeFile(a,d,{},g=>{g?h(g):f()})})}_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(e.Plugins.NodeWebkit.Cnds.OnFileSystemError);this._fileError=""}async _OnDrop(a){a=a.filePaths;for(const c of a)this._droppedFile=c,
await this.TriggerAsync(e.Plugins.NodeWebkit.Cnds.OnFileDrop);this._droppedFile=""}async _OnOpenDlg(a){this._chosenPath=a.chosenPath;await this.TriggerAsync(e.Plugins.NodeWebkit.Cnds.OnOpenDlg)}async _OnOpenDlgCancel(){await this.TriggerAsync(e.Plugins.NodeWebkit.Cnds.OnOpenDlgCancel)}async _OnFolderDlg(a){this._chosenPath=a.chosenPath;await this.TriggerAsync(e.Plugins.NodeWebkit.Cnds.OnFolderDlg)}async _OnFolderDlgCancel(){await this.TriggerAsync(e.Plugins.NodeWebkit.Cnds.OnFolderDlgCancel)}async _OnSaveDlg(a){this._chosenPath=
a.chosenPath;await this.TriggerAsync(e.Plugins.NodeWebkit.Cnds.OnSaveDlg)}async _OnSaveDlgCancel(){await this.TriggerAsync(e.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(e){return this._isNWjs?this._fs.existsSync(e):!1},OnBinaryFileRead(e){return this._currentTag===e},OnBinaryFileWritten(e){return this._currentTag===e},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 e=self.C3;function b(a,c,d){"function"===typeof a.copyfileSync?a.copyfileSync(c,d):(c=a.readFileSync(c,{flags:"rb"}),a.writeFileSync(d,c,{flags:"wb"}))}e.Plugins.NodeWebkit.Acts={WriteTextFile(a,c){if(this._isNWjs)try{this._fs.writeFileSync(a,c,{encoding:"utf8"})}catch(d){console.error(`Error writing text file '${a}': `,d),this._OnFileSystemError(d)}},async ReadBinaryFile(a,c,d){d=this._GetBinaryDataSdkInstance(d);if(this._isNWjs&&d)try{const f=await this._ReadBinaryFile(c);d.SetArrayBufferTransfer(f);
this._currentTag=a;await this.TriggerAsync(e.Plugins.NodeWebkit.Cnds.OnBinaryFileRead);this._currentTag=""}catch(f){console.error(`Error reading binary file '${c}': `,f),this._OnFileSystemError(f)}},async WriteBinaryFile(a,c,d){d=this._GetBinaryDataSdkInstance(d);if(this._isNWjs&&d)try{const f=d.GetArrayBufferReadOnly();await this._WriteBinaryFile(c,f);this._currentTag=a;await this.TriggerAsync(e.Plugins.NodeWebkit.Cnds.OnBinaryFileWritten);this._currentTag=""}catch(f){console.error(`Error writing binary file '${c}': `,
f),this._OnFileSystemError(f)}},RenameFile(a,c){if(this._isNWjs)try{this._fs.renameSync(a,c)}catch(d){console.error(`Error renaming file '${a}': `,d),this._OnFileSystemError(d)}},DeleteFile(a){if(this._isNWjs)try{this._fs.unlinkSync(a)}catch(c){"ENOENT"!==c.code&&(console.error(`Error deleting file '${a}': `,c),this._OnFileSystemError(c))}},CopyFile(a,c){if(this._isNWjs)try{b(this._fs,a,c)}catch(d){console.error(`Error copying file '${a}': `,d),this._OnFileSystemError(d)}},MoveFile(a,c){if(this._isNWjs&&
a!==c)try{b(this._fs,a,c),this._fs.existsSync(c)&&this._fs.unlinkSync(a)}catch(d){console.error(`Error moving file '${a}': `,d),this._OnFileSystemError(d)}},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(c){console.error(`Error creating folder '${a}': `,
c),this._OnFileSystemError(c)}},AppendFile(a,c){if(this._isNWjs)try{this._fs.appendFileSync(a,c,{encoding:"utf8"})}catch(d){console.error(`Error appending to file '${a}': `,d),this._OnFileSystemError(d)}},ListFiles(a){if(this._isNWjs)try{this._fileList=this._fs.readdirSync(a)}catch(c){this._fileList=[],console.error(`Error listing files at '${a}': `,c),this._OnFileSystemError(c)}},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,c){this._isNWjs&&this.PostToDOM("set-window-max-size",{width:a,height:c})},WindowSetMinSize(a,c){this._isNWjs&&this.PostToDOM("set-window-min-size",
{width:a,height:c})},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(e){if(!this._isNWjs)return"";let b="";try{b=this._fs.readFileSync(e,{encoding:"utf8"})}catch(a){console.error(`Failed to read file '${e}': `,a),this._OnFileSystemError(a)}return b},FileSize(e){if(!this._isNWjs)return 0;
let b=0;try{const a=this._fs.statSync(e);a&&(b=a.size||0)}catch(a){console.error(`Failed to read file '${e}' size: `,a),this._OnFileSystemError(a)}return b},ListCount(){return this._fileList.length},ListAt(e){e=Math.floor(e);return 0>e||e>=this._fileList.length?"":this._fileList[e]},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(e){if(!this._isNWjs)return"";e=Math.floor(e);const b=this._argv;return 0>e||e>=b.length?"":b[e]},FileError(){return this._fileError}};{"use strict";const e=self.C3;e.Plugins.PlatformInfo=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.PlatformInfo.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Plugins.PlatformInfo.Instance=class extends e.SDKInstanceBase{constructor(b,a){super(b,"platform-info");this._windowOuterHeight=this._windowOuterWidth=this._screenHeight=this._screenWidth=0;this._safeAreaInset=[0,0,0,0];this._isWakeLockActive=this._supportsWakeLock=!1;this.AddDOMMessageHandlers([["window-resize",c=>this._OnWindowResize(c)],["wake-lock-acquired",c=>this._OnWakeLockAcquired(c)],["wake-lock-error",c=>this._OnWakeLockError(c)],["wake-lock-released",c=>
this._OnWakeLockReleased(c)]]);navigator.connection&&navigator.connection.addEventListener("change",()=>this._OnNetworkChange());this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state").then(c=>{this._screenWidth=c.screenWidth;this._screenHeight=c.screenHeight;this._windowOuterWidth=c.windowOuterWidth;this._windowOuterHeight=c.windowOuterHeight;this._safeAreaInset=c.safeAreaInset;this._supportsWakeLock=c.supportsWakeLock}))}Release(){super.Release()}_OnWindowResize(b){this._windowOuterWidth=
b.windowOuterWidth;this._windowOuterHeight=b.windowOuterHeight;this._safeAreaInset=b.safeAreaInset}async _OnNetworkChange(){await this.TriggerAsync(e.Plugins.PlatformInfo.Cnds.OnNetworkChange)}async _OnWakeLockAcquired(){this._isWakeLockActive=!0;await this.TriggerAsync(e.Plugins.PlatformInfo.Cnds.OnWakeLockAcquired)}async _OnWakeLockError(){this._isWakeLockActive=!1;await this.TriggerAsync(e.Plugins.PlatformInfo.Cnds.OnWakeLockError)}async _OnWakeLockReleased(){this._isWakeLockActive=!1;await this.TriggerAsync(e.Plugins.PlatformInfo.Cnds.OnWakeLockReleased)}}}
{"use strict";const e=self.C3;e.Plugins.PlatformInfo.Cnds={IsOnMobile(){return e.Platform.IsMobile},IsOnWindows(){return"Windows"===e.Platform.OS},IsOnMacOS(){return"Mac OS X"===e.Platform.OS},IsOnLinux(){return"Linux"===e.Platform.OS},IsOnChromeOS(){return"Chrome OS"===e.Platform.OS},IsOnAndroid(){return"Android"===e.Platform.OS},IsOniOS(){return"iOS"===e.Platform.OS},IsWebExport(){const b=this._runtime.GetExportType();return"html5"===b||"scirra-arcade"===b||"preview"===b||"instant-games"===b},IsCordovaExport(){return this._runtime.IsCordova()},
IsNWjsExport(){return"nwjs"===this._runtime.GetExportType()},IsWindowsUWPExport(){return"windows-uwp"===this._runtime.GetExportType()},IsWindowsWebView2Export(){return"windows-webview2"===this._runtime.GetExportType()},IsMacOSWKWebView2Export(){return"macos-wkwebview"===this._runtime.GetExportType()},OnNetworkChange(){return!0},OnWakeLockAcquired(){return!0},OnWakeLockError(){return!0},OnWakeLockReleased(){return!0},IsWakeLockActive(){return this._isWakeLockActive},IsWakeLockSupported(){return this._supportsWakeLock}}}"use strict";
self.C3.Plugins.PlatformInfo.Acts={RequestWakeLock(){this._supportsWakeLock&&this._PostToDOMMaybeSync("request-wake-lock")},ReleaseWakeLock(){this._supportsWakeLock&&(this._isWakeLockActive=!1,this.PostToDOM("release-wake-lock"))}};"use strict";
self.C3.Plugins.PlatformInfo.Exps={Renderer(){let e;e=this._runtime.GetWebGPURenderer()?"webgpu":"webgl"+this._runtime.GetWebGLRenderer().GetWebGLVersionNumber();this._runtime.GetRenderer().HasMajorPerformanceCaveat()&&(e+="-software");return e},RendererDetail(){return this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},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._windowOuterHeight},CanvasCssWidth(){return this._runtime.GetCanvasManager().GetCssWidth()},CanvasCssHeight(){return this._runtime.GetCanvasManager().GetCssHeight()},CanvasDeviceWidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()},CanvasDeviceHeight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},Downlink(){return navigator.connection?
navigator.connection.downlink||0:0},DownlinkMax(){return navigator.connection?navigator.connection.downlinkMax||0:0},ConnectionType(){return navigator.connection?navigator.connection.type||"unknown":"unknown"},ConnectionEffectiveType(){return navigator.connection?navigator.connection.effectiveType||"unknown":"unknown"},ConnectionRTT(){return navigator.connection?navigator.connection.rtt||0:0},HardwareConcurrency(){return navigator.hardwareConcurrency||0},DeviceMemory(){return navigator.deviceMemory||
0},SafeAreaInsetTop(){return this._safeAreaInset[0]},SafeAreaInsetRight(){return this._safeAreaInset[1]},SafeAreaInsetBottom(){return this._safeAreaInset[2]},SafeAreaInsetLeft(){return this._safeAreaInset[3]}};{"use strict";const e=self.C3;e.Plugins.Browser=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.Browser.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Plugins.Browser.Instance=class extends e.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",c=>this._OnOnlineStateChanged(c)],["backbutton",()=>this._OnBackButton()],["sw-message",c=>this._OnSWMessage(c)],["hashchange",
c=>this._OnHashChange(c)]]);b=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),e.Disposable.From(b,"window-resize",()=>this._OnWindowResize()),e.Disposable.From(b,"suspend",()=>this._OnSuspend()),e.Disposable.From(b,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state",{exportType:this._runtime.GetExportType()}).then(c=>{this._initLocationStr=c.location;
this._isOnline=c.isOnline;this._referrer=c.referrer;this._docTitle=c.title;this._isCookieEnabled=c.isCookieEnabled;this._screenWidth=c.screenWidth;this._screenHeight=c.screenHeight;this._windowOuterWidth=c.windowOuterWidth;this._windowOuterHeight=c.windowOuterHeight;this._isScirraArcade=c.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(e.Plugins.Browser.Cnds.OnOnline):
await this.TriggerAsync(e.Plugins.Browser.Cnds.OnOffline))}async _OnWindowResize(){await this.TriggerAsync(e.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(e.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(e.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(e.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(b){b=b.type;"downloading-update"===b?this.Trigger(e.Plugins.Browser.Cnds.OnUpdateFound):"update-ready"===b||"update-pending"===b?this.Trigger(e.Plugins.Browser.Cnds.OnUpdateReady):
"offline-ready"===b&&this.Trigger(e.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(b){this._initLocationStr=b.location;this.Trigger(e.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(e){const b=this._runtime.GetCanvasManager().GetLastWidth(),a=this._runtime.GetCanvasManager().GetLastHeight();return(b<=a?0:1)===e},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 e=self.C3,b="portrait landscape portrait-primary portrait-secondary landscape-primary landscape-secondary".split(" ");e.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(){},Reload(){this._isScirraArcade||(this._runtime.IsDebug()?this._runtime.PostToDebugger({type:"reload"}):this.PostToDOM("navigate",{type:"reload"}))},GoToURL(a,c){this._PostToDOMMaybeSync("navigate",{type:"url",url:a,target:c,exportType:this._runtime.GetExportType()})},GoToURLWindow(a,c){this._PostToDOMMaybeSync("navigate",{type:"new-window",url:a,tag:c,exportType:this._runtime.GetExportType()})},RequestFullScreen(a,
c){2<=a&&(a+=1);6===a&&(a=2);1===a&&(a=0);a=e.CanvasManager._FullscreenModeNumberToString(a);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(a);this._PostToDOMMaybeSync("request-fullscreen",{navUI:c})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(a){a=a.split(",");for(let c=0,d=a.length;c<d;++c)a[c]=parseInt(a[c],10);this._PostToDOMMaybeSync("vibrate",{pattern:a})},async InvokeDownload(a,c){a&&c&&(a=await this._runtime.GetAssetManager().GetProjectFileUrl(a),this._runtime.InvokeDownload(a,
c))},InvokeDownloadString(a,c,d){d&&(a=`data:${c},${encodeURIComponent(a)}`,this._runtime.InvokeDownload(a,d))},ConsoleLog(a,c){c=c.toString();0===a?console.log(c):1===a?console.warn(c):2===a&&console.error(c)},ConsoleGroup(a){console.group(a)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(a){try{eval(a)}catch(c){console.error("Error executing JavaScript: ",c)}},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(e){const b=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;return(e=RegExp("[?&]"+e+"=([^&]*)").exec(b))?decodeURIComponent(e[1].replace(/\+/g," ")):""},Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},
Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(e){let b=0;try{b=eval(e)}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 e=navigator.connection;return e?e.downlink||
e.downlinkMax||e.bandwidth||Infinity:Infinity},ConnectionType(){const e=navigator.connection;return e?e.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 e=self.C3;e.Plugins.LocalStorage=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.LocalStorage.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Plugins.LocalStorage.Instance=class extends e.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(e.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((c,
d)=>{c=c.toLowerCase();d=d.toLowerCase();return c<d?-1:d<c?1:0});const a=await Promise.all(b.map(c=>this._storage.getItem(c)));this._debugCache.clear();for(let c=0,d=b.length;c<d;++c)this._debugCache.set(b[c],a[c])}catch(b){console.warn("[C3 debugger] Error displaying local storage: ",b)}finally{this._isLoadingDebugCache=!1}}}}
{"use strict";const e=self.C3;e.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 e.compare(this._currentKey,b,a)},CompareValue(b,
a){return e.compare(this._lastValue,b,a)},IsProcessingSets(){return 0<this._pendingSets},IsProcessingGets(){return 0<this._pendingGets},OnAllSetsComplete(){return!0},OnAllGetsComplete(){return!0}}}
{"use strict";const e=self.C3;function b(a){return"string"===typeof a||"number"===typeof a}e.Plugins.LocalStorage.Acts={async SetItem(a,c){this._pendingSets++;try{const d=await this._storage.setItem(a,c);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=d;await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingSets--,0===this._pendingSets&&
await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},async SetBinaryItem(a,c){if(c&&(c=c.GetFirstPicked(this._inst))&&(c=c.GetSdkInstance())){c=c.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(a,c),await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingSets--,
0===this._pendingSets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},async GetItem(a){this._pendingGets++;try{const c=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=b(c)?c:"";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}},
async GetBinaryItem(a,c){if(c&&(c=c.GetFirstPicked(this._inst))){var d=c.GetSdkInstance();this._pendingGets++;try{let f=await this._storage.getItem(a);f=f instanceof ArrayBuffer?f:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=a;d.SetArrayBufferTransfer(f);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(f){await this._TriggerStorageError(f)}finally{this._pendingGets--,
0===this._pendingGets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},async CheckItemExists(a){try{const c=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;"undefined"===typeof c||null===c?(this._lastValue="",await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=b(c)?c:"",await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(c){await this._TriggerStorageError(c)}},async RemoveItem(a){try{await this._storage.removeItem(a),
await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(c){await this._TriggerStorageError(c)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";e.clearArray(this._keyNamesList);await this.TriggerAsync(e.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(e.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(e){e=Math.floor(e);return 0>e||e>=this._keyNamesList.length?"":this._keyNamesList[e]},ErrorMessage(){return this._errorMessage}};
{"use strict";const e=self.C3;e.Behaviors.Tween=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Tween.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=e.Behaviors.Tween;b.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,c){super(a);this._allowMultiple=!1;this._enabled=!0;c&&(this._allowMultiple=!1,this._enabled=!!c[0]);this._activeTweens=new Map;this._disabledTweens=[];this._waitingForReleaseTweens=new Map;this._waitingForReleaseTweensJson=this._disabledTweensJson=this._activeTweensJson=this._finishingTween=null;this._finishingTweenName="";this._enabled&&this._StartTicking2();this._afterLoad=d=>this._OnAfterLoad(d);
this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;this._finishingTween&&(this.ReleaseAndCompleteTween(this._finishingTween),this._finishingTween=null);this.ReleaseAndCompleteTweens();this._tweens=null;this.ClearDisabledList();this._disabledTweens=null;this._ReleaseWaitingTweens();this._waitingForReleaseTweens=null;super.Release()}SetEnabled(a){(this._enabled=a)?
this._StartTicking2():this._StopTicking2()}GetEnabled(){return this._enabled}AddToDisabledList(a){this._disabledTweens.push(a)}IsInDisabledList(a){return this._disabledTweens.includes(a)}ClearDisabledList(){e.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const a=this.GetObjectInstance();return a?!a.IsDestroyed():!1}GetTween(a,c,d=!1){if((c=c?this.PropertyTweens(c,d):this.AllTweens(d))&&c.length)for(const f of c)if(f.HasTags(a))return f}GetTweenIncludingWaitingForRelease(a,
c){return this.GetTween(a,c,!0)}*GetTweens(a,c,d=!1){if((c=c?this.PropertyTweens(c,d):this.AllTweens(d))&&c.length)for(const f of c)f.HasTags(a)&&(yield f)}*GetTweensIncludingWaitingForRelease(a,c){yield*this.GetTweens(a,c,!0)}PropertyTweens(a,c){if(c)return c=this._activeTweens.get(a),a=this._waitingForReleaseTweens.get(a),c||(c=[]),a||(a=[]),c.concat(a).filter(d=>d);(a=this._activeTweens.get(a))||(a=[]);return a.filter(d=>d)}AllTweens(a){if(a){a=[...this._activeTweens.values()].flat();const c=[...this._waitingForReleaseTweens.values()].flat();
return a.concat(c).filter(d=>d)}return[...this._activeTweens.values()].flat().filter(c=>c)}AllTweensIncludingWaitingForRelease(){return this.AllTweens(!0)}SaveToJson(){return{s:!1,e:!!this._enabled,at:this._SaveActiveTweensToJson(),dt:this._SaveDisabledTweensToJson(),wt:this._SaveWaitingForReleaseTweensToJson(),ft:this._SaveFinishingTweenToJson()}}LoadFromJson(a){a&&(this._activeTweensJson=a.at,this._disabledTweensJson=a.dt,this._waitingForReleaseTweensJson=a.wt,this._finishingTweenName=a.ft,this._allowMultiple=
!1,this._enabled=!!a.e)}_OnAfterLoad(a){a=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,a);if(this._disabledTweensJson){e.clearArray(this._disabledTweens);for(const c of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,c,a)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,a);this._finishingTween=this._GetTween(this._finishingTweenName,a);this._enabled?this._StartTicking2():this._StopTicking2()}_PopulateTweenMap(a,
c,d){if(a)for(const h in a){let g=c.get(h);g?e.clearArray(g):g=[];var f=a[h];for(const l of f)this._PopulateTweenArray(g,l.name,d)?this._LoadTweenFromJson(l.name,l,d):(f=e.TweenState.Build({runtime:this.GetRuntime(),json:l}),f.AddCompletedCallback(m=>this._FinishTriggers(m)),d.AddScheduledTimeline(f),this._PopulateTweenArray(g,f,d));c.set(h,g)}}_GetTween(a,c){return c.GetScheduledOrPlayingTimelineByName(a)}_PopulateTweenArray(a,c,d){if("string"===typeof c){if(c=this._GetTween(c,d))return!!a.push(c)}else return!!a.push(c);
return!1}_LoadTweenFromJson(a,c,d){"string"===typeof a?(a=this._GetTween(a,d))&&a._LoadFromJson(c):a._LoadFromJson(c)}_SaveActiveTweensToJson(){const a={};for(const [c,d]of this._activeTweens)a[c]=d.map(f=>f._SaveToJson());return a}_SaveDisabledTweensToJson(){return this._disabledTweens.map(a=>a.GetName())}_SaveWaitingForReleaseTweensToJson(){const a={};for(const [c,d]of this._waitingForReleaseTweens)a[c]=d.map(f=>f._SaveToJson());return a}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():
""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(a){var c=b.Config.GetPropertyTracksConfig(a.property,a.startValue,a.endValue,a.ease,a.resultMode,this.GetObjectInstance());const d=b.Maps.GetPropertyFromIndex(a.property);b.Maps.IsValueId(d)||this.ReleaseTweens(a.property);c=e.TweenState.Build({runtime:this.GetRuntime(),id:d,tags:a.tags,time:a.time,instance:this.GetObjectInstance(),releaseOnComplete:!!a.releaseOnComplete,loop:!!a.loop,pingPong:!!a.pingPong,initialValueMode:a.initialValueMode,propertyTracksConfig:c});
c.AddCompletedCallback(f=>this._FinishTriggers(f));this._AddTween(c,a.property);return c}ReleaseTween(a,c=!1){var d=a.GetId();if(this._activeTweens.has(d)&&(d=this._activeTweens.get(d))){const f=d.indexOf(a);-1!==f&&d.splice(f,1)}a.IsReleased()||this._IsInWaitingList(a)||(a.Stop(c),this._AddToWaitingList(a))}ReleaseTweens(a,c=!1){if(e.IsFiniteNumber(a)){var d=b.Maps.GetPropertyFromIndex(a);if(this._activeTweens.has(d)){d=this._activeTweens.get(d);var f=this.GetFinishingTween();for(var h of d)h===
f||h.IsReleased()||this._IsInWaitingList(h)||(h.Stop(c),h.Release());e.clearArray(d)}}else{h=this.GetFinishingTween();for(d of this.AllTweens())d===h||d.IsReleased()||this._IsInWaitingList(d)||(d.Stop(c),d.Release());for(f of this._activeTweens.keys())e.clearArray(this._activeTweens.get(f)),this._activeTweens.delete(f);this._activeTweens.clear()}}ReleaseAndCompleteTween(a){this.ReleaseTween(a,!0)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,!0)}GetPropertyValueByIndex(a){switch(a){case 0:return this._enabled}}SetPropertyValueByIndex(a,
c){switch(a){case 0:this._enabled=!!c}}_GetBehaviorType(a){a=a.GetInstance().GetBehaviorInstances();for(const c of a)if(a=c.GetBehaviorType(),a.GetInstanceSdkCtor()===this.constructor)return a}Trigger(a,c,d,f){return this._runtime?super.Trigger(a):c.Trigger(a,d,f)}_FinishTriggers(a){this._finishingTween=a;b.Cnds.SetFinishingTween(a);let c,d;if(this.GetRuntime())c=this._inst,d=this._runtime,this.Trigger(b.Cnds.OnTweensFinished),this.Trigger(b.Cnds.OnAnyTweensFinished),this.ReleaseTween(a);else{c=a.GetInstance();
if(!c||c&&c.IsDestroyed())return;d=c.GetRuntime();const f=this._GetBehaviorType(a);this.Trigger(b.Cnds.OnTweensFinished,d,c,f);this.Trigger(b.Cnds.OnAnyTweensFinished,d,c,f);a.Stop()}this._finishingTween=null;b.Cnds.SetFinishingTween(null);a.GetDestroyInstanceOnComplete()&&d.DestroyInstance(c)}_AddTween(a,c){c=b.Maps.GetPropertyFromIndex(c);this._activeTweens.has(c)||this._activeTweens.set(c,[]);this._activeTweens.get(c).push(a)}_AddToWaitingList(a){const c=a.GetId();this._waitingForReleaseTweens.has(c)||
this._waitingForReleaseTweens.set(c,[]);this._waitingForReleaseTweens.get(c).push(a)}_IsInWaitingList(a){const c=a.GetId();return this._waitingForReleaseTweens.has(c)?this._waitingForReleaseTweens.get(c).includes(a):!1}_ReleaseWaitingTweens(){if(this._waitingForReleaseTweens.size){for(const a of this._waitingForReleaseTweens.values()){for(const c of a)c.IsReleased()||c.Release();e.clearArray(a)}this._waitingForReleaseTweens.clear()}}}}
{"use strict";const e=self.C3;let b=null;e.Behaviors.Tween.Cnds={SetFinishingTween(a){b=a},OnTweensFinished(a){return b.HasTags(a)},OnAnyTweensFinished(){return!0},IsPlaying(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(e.TweenState.IsPlaying):!1},IsAnyPlaying(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(e.TweenState.IsPlaying):!1},IsPaused(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(e.TweenState.IsPaused):
!1},IsAnyPaused(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(e.TweenState.IsPaused):!1}}}
{"use strict";const e=self.C3,b=self.Ease,a=e.Behaviors.Tween;a.Acts={SetEnabled(c){this.SetEnabled(!!c);for(const d of this.AllTweens())c?this.IsInDisabledList(d)&&d.Resume():((d.IsPlaying()||d.IsScheduled())&&this.AddToDisabledList(d),d.Stop());c&&this.ClearDisabledList()},async TweenOneProperty(...c){this.GetEnabled()&&this.IsInstanceValid()&&(c=this.CreateTween(a.TweenArguments.OneProperty(this,...c)),c.Play()&&await c.GetPlayPromise())},async TweenTwoProperties(...c){this.GetEnabled()&&this.IsInstanceValid()&&
(c=this.CreateTween(a.TweenArguments.TwoProperties(this,...c)),c.Play()&&await c.GetPlayPromise())},async TweenValue(...c){this.GetEnabled()&&this.IsInstanceValid()&&(c=this.CreateTween(a.TweenArguments.ValueProperty(this,...c)),c.Play()&&await c.GetPlayPromise())},PauseTweens(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.GetTweens(c))d.Stop()},PauseAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.Stop()},ResumeTweens(c){if(this.GetEnabled()&&
this.IsInstanceValid())for(const d of this.GetTweens(c))d.Resume()},ResumeAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.Resume()},StopTweens(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.GetTweens(c))this.ReleaseTween(d)},StopAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())this.ReleaseTween(c)},SetOnePropertyTweensEndValue(c,d,f){if(this.GetEnabled()&&this.IsInstanceValid()){d=e.Behaviors.Tween.Maps.GetSinglePropertyFromIndex(d);
for(const h of this.GetTweens(c))h.BeforeSetEndValues([d]),h.SetEndValue(f,d)}},SetTwoPropertiesTweensEndValue(c,d,f,h){if(this.GetEnabled()&&this.IsInstanceValid()){d=e.Behaviors.Tween.Maps.GetRealProperties(d);for(const g of this.GetTweens(c))g.BeforeSetEndValues(d),g.SetEndValue(f,d[0]),g.SetEndValue(h,d[1])}},SetValuePropertyTweensStartValue(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(c,"value"))f.SetStartValue(d,"value")},SetValuePropertyTweensEndValue(c,d){if(this.GetEnabled()&&
this.IsInstanceValid())for(const f of this.GetTweens(c,"value"))f.BeforeSetEndValues(["value"]),f.SetEndValue(d,"value")},SetTweensEase(c,d){if(this.GetEnabled()&&this.IsInstanceValid()){d=b.GetEaseFromIndex(d);for(const f of this.GetTweens(c))f.SetEase(d)}},SetAllTweensEase(c){if(this.GetEnabled()&&this.IsInstanceValid()){c=b.GetEaseFromIndex(c);for(const d of this.AllTweens())d.SetEase(c)}},SetTweensTime(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(c))f.SetTime(d)},
SetAllTweensTime(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetTime(c)},SetTweensPlaybackRate(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(c))f.SetPlaybackRate(d)},SetAllTweensPlaybackRate(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetPlaybackRate(c)},SetTweensDestroyOnComplete(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(c))f.SetDestroyInstanceOnComplete(!!d)},
SetAllTweensDestroyOnComplete(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetDestroyInstanceOnComplete(!!c)}}}"use strict";
self.C3.Behaviors.Tween.Exps={Time(e){return(e=this.GetTweenIncludingWaitingForRelease(e))?e.GetTime():0},Progress(e){return(e=this.GetTweenIncludingWaitingForRelease(e))?e.GetTime()/e.GetTotalTime():0},Value(e){return(e=this.GetTweenIncludingWaitingForRelease(e,"value"))?e.GetPropertyTrack("value").GetSourceAdapterValue():0},Tags(){return this.GetFinishingTween()?this.GetFinishingTween().GetStringTags():""}};
{"use strict";const e=self.C3,b=self.Ease,a=["position","size","scale"],c="offsetX offsetY offsetWidth offsetHeight offsetAngle offsetOpacity offsetColor offsetZElevation offsetScaleX offsetScaleY".split(" "),d=["value"],f=[].concat(a).concat(c).concat(d),h={position:["offsetX","offsetY"],size:["offsetWidth","offsetHeight"],scale:["offsetScaleX","offsetScaleY"]},g=Object.assign({},f.reduce((l,m)=>Object.assign({},l,{[m]:[m]}),{}),h);e.Behaviors.Tween.Maps=class{constructor(){}static GetEases(){return[...b.GetRuntimeEaseNames()]}static GetEaseFromIndex(l){return[...b.GetRuntimeEaseNames()][l]}static GetPropertyFromIndex(l){return f[l]}static GetPropertyIndexFromName(l){return f.indexOf(l)}static GetPairPropertyFromIndex(l){return a[l]}static GetSinglePropertyFromIndex(l){return c[l]}static GetValuePropertyFromIndex(l){return d[l]}static GetPairProperties(l){return h[l]}static GetRealProperties(l){return e.IsString(l)?
g[l]:g[f[l]]}static IsPairId(l){return!!h[l]}static IsColorId(l){return"offsetColor"===l}static IsAngleId(l){return"offsetAngle"===l}static IsOpacityId(l){return"offsetOpacity"===l}static IsValueId(l){return"value"===l}}}
{"use strict";const e=self.C3,b=e.Behaviors.Tween,a=new Map;b.Config=class{constructor(){}static GetPropertyTracksConfig(c,d,f,h,g,l){0===a.size&&this._CreateConfigObjects();var m=b.PropertyTypes.Pick(c);m=a.get(m);e.IsFiniteNumber(c)&&(c=b.Maps.GetPropertyFromIndex(c));return this._GetConfig(m,c,d,f,h,g,l)}static TransformValue(c,d){return e.Behaviors.Tween.GetPropertyTracksConfig(c).valueGetter(d)}static _CreateConfigObjects(){const c=b.PropertyTypes,d=b.ValueGetters;this._AddConfigObject(c.PAIR,
this._GetPairConfig,d._GetPropertyValue);this._AddConfigObject(c.COLOR,this._GetColorConfig,d._GetColorPropertyValue);this._AddConfigObject(c.ANGLE,this._GetAngleConfig,d._GetPropertyAngleValue);this._AddConfigObject(c.VALUE,this._GetValueConfig,d._GetPropertyValue);this._AddConfigObject(c.OTHER,this._GetCommonConfig,d._GetPropertyValue)}static _AddConfigObject(c,d,f){a.set(c,this._CreateConfigObject(c,d,f))}static _CreateConfigObject(c,d,f){return{name:c,configFunc:d,valueGetter:f}}static _GetConfig(c,
d,f,h,g,l,m){return c.configFunc(d,c.valueGetter(f),c.valueGetter(h),g,l,m)}static _GetPairConfig(c,d,f,h,g,l){return b.Maps.GetPairProperties(c).map((m,u)=>({sourceId:"world-instance",property:m,type:"float",valueType:"numeric",startValue:d[u],endValue:f[u],ease:b.Maps.GetEaseFromIndex(h),resultMode:g}))}static _GetColorConfig(c,d,f,h,g,l){return e.Plugins.Text&&l.GetPlugin()instanceof e.Plugins.Text?{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:d,endValue:f,
ease:b.Maps.GetEaseFromIndex(h),resultMode:g}:{sourceId:"world-instance",property:c,type:"color",valueType:"color",startValue:d,endValue:f,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetAngleConfig(c,d,f,h,g,l){return{sourceId:"world-instance",property:c,type:"angle",valueType:"angle",startValue:d,endValue:f,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetCommonConfig(c,d,f,h,g,l){return{sourceId:"world-instance",property:c,type:"float",valueType:"numeric",startValue:d,endValue:f,
ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetValueConfig(c,d,f,h,g,l){return{sourceId:"value",property:c,type:"float",valueType:"numeric",startValue:d,endValue:f,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}}}
{"use strict";const e=self.C3,b=e.Behaviors.Tween,a=Object.assign({},{resultMode:"absolute"},{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:!1,pingPong:!1}),c=Object.assign({},a,{initialValueMode:"current-state",startValue:0,endValue:0}),d=Object.assign({},a,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]}),f=Object.assign({},a,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]}),h=Object.assign({},c,{initialValueMode:"start-value"});b.TweenArguments=
class{constructor(){}static _SetCommonProperties(g,l,m,u,v,t,q){g.tags=l;g.time=m;g.ease=u;g.releaseOnComplete=v;g.loop=t;g.pingPong=q}static OneProperty(g,l,m,u,v,t,q,p,r){g=b.Maps.GetSinglePropertyFromIndex(m);m=b.Maps.IsColorId(g)?f:c;this._SetCommonProperties(m,l,v,t,q,p,r);b.Maps.IsColorId(g)?(f.endValue[0]=e.GetRValue(u),f.endValue[1]=e.GetGValue(u),f.endValue[2]=e.GetBValue(u),f.property=b.Maps.GetPropertyIndexFromName(g)):b.Maps.IsOpacityId(g)?c.endValue=u/100:c.endValue=u;m.property=b.Maps.GetPropertyIndexFromName(g);
return m}static TwoProperties(g,l,m,u,v,t,q,p,r,x){this._SetCommonProperties(d,l,t,q,p,r,x);g=b.Maps.GetPairPropertyFromIndex(m);d.endValue[0]=u;d.endValue[1]=v;d.property=b.Maps.GetPropertyIndexFromName(g);return d}static ValueProperty(g,l,m,u,v,t,q,p,r){this._SetCommonProperties(h,l,v,t,q,p,r);h.startValue=m;h.endValue=u;h.property=b.Maps.GetPropertyIndexFromName("value");return h}}}
{"use strict";const e=self.C3,b=e.Behaviors.Tween,a=[];b.PropertyTypes=class{constructor(){}static Pick(c){0===a.length&&(a.push({checkFunc:b.Maps.IsPairId,result:this.PAIR}),a.push({checkFunc:b.Maps.IsColorId,result:this.COLOR}),a.push({checkFunc:b.Maps.IsAngleId,result:this.ANGLE}),a.push({checkFunc:b.Maps.IsValueId,result:this.VALUE}),a.push({checkFunc:()=>!0,result:this.OTHER}));e.IsFiniteNumber(c)&&(c=e.Behaviors.Tween.Maps.GetPropertyFromIndex(c));for(const d of a)if(d.checkFunc(c))return d.result}static get PAIR(){return"pair"}static get COLOR(){return"color"}static get ANGLE(){return"angle"}static get VALUE(){return"value"}static get OTHER(){return"other"}}}
{"use strict";const e=self.C3;e.Behaviors.Tween.ValueGetters=class{constructor(){}static _GetPropertyAngleValue(b){b=e.toRadians(parseFloat(b));return e.clampAngle(b)}static _GetColorPropertyValue(b){return b.slice(0)}static _GetPropertyValue(b){return b}}}{"use strict";const e=self.C3;e.Behaviors.Rotate=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Rotate.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Rotate.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._acceleration=this._speed=0;this._isEnabled=!0;a&&(this._speed=e.toRadians(a[0]),this._acceleration=e.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 e.toDegrees(this._speed);case 1:return e.toDegrees(this._acceleration);case 2:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._speed=e.toRadians(a);break;case 1:this._acceleration=e.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:e.toDegrees(this._speed),onedit:b=>this._speed=e.toRadians(b)},{name:"behaviors.rotate.properties.acceleration.name",value:e.toDegrees(this._acceleration),onedit:b=>this._acceleration=e.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 e=self.C3;e.Behaviors.Rotate.Acts={SetSpeed(b){this._speed=e.toRadians(b)},SetAcceleration(b){this._acceleration=e.toRadians(b)},SetEnabled(b){this._SetEnabled(b)}}}{"use strict";const e=self.C3;e.Behaviors.Rotate.Exps={Speed(){return e.toDegrees(this._speed)},Acceleration(){return e.toDegrees(this._acceleration)}}}{"use strict";const e=self.C3;e.Behaviors.TileMovement=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Behaviors.TileMovement.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IBehaviorInstance,c=[];e.Behaviors.TileMovement.Instance=class extends e.SDKBehaviorInstanceBase{constructor(f,h){super(f);this._simRight=this._simLeft=this._simDown=this._simUp=this._ignoreInput=this._rightKey=this._leftKey=this._downKey=this._upKey=!1;this._gridHeight=this._gridWidth=32;this._gridOffsetY=this._gridOffsetX=0;this._speedY=this._speedX=100;h&&(this._gridWidth=h[0],this._gridHeight=h[1],this._gridOffsetX=h[2],this._gridOffsetY=h[3],this._speedX=
h[4],this._speedY=h[5]);this._targetGridY=this._targetGridX=this._targetY=this._targetX=0;this._lastY2=this._lastX2=this._lastY=this._lastX=NaN;this._collisionRect=e.New(e.Rect);this._isEnabled=h[6];this._defaultControls=h[7];this._iso=h[8];this._disposables=null;this._isEnabled&&this._StartTicking();this._defaultControls&&this._BindEvents();this._ResetTarget()}Release(){this._UnBindEvents();super.Release()}_BindEvents(){if(!this._disposables){var f=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(f,
"keydown",h=>this._OnKeyDown(h.data)),e.Disposable.From(f,"keyup",h=>this._OnKeyUp(h.data)),e.Disposable.From(f,"window-blur",()=>this._OnWindowOrKeyboardBlur()),e.Disposable.From(f,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}}_UnBindEvents(){this._disposables&&(this._disposables.Release(),this._disposables=null)}_OnKeyDown(f){switch(f.key){case "ArrowLeft":this._leftKey=!0;break;case "ArrowUp":this._upKey=!0;break;case "ArrowRight":this._rightKey=!0;break;case "ArrowDown":this._downKey=
!0}}_OnKeyUp(f){switch(f.key){case "ArrowLeft":this._leftKey=!1;break;case "ArrowUp":this._upKey=!1;break;case "ArrowRight":this._rightKey=!1;break;case "ArrowDown":this._downKey=!1}}_OnWindowOrKeyboardBlur(){this._rightKey=this._leftKey=this._downKey=this._upKey=!1}_ResetLastPositions(){this._lastY2=this._lastX2=this._lastY=this._lastX=NaN}SaveToJson(){return{gw:this._gridWidth,gh:this._gridHeight,ox:this._gridOffsetX,oy:this._gridOffsetY,sx:this._speedX,sy:this._speedY,x:this._targetX,y:this._targetY,
gx:this._targetGridX,gy:this._targetGridY,e:this._isEnabled,i:this._ignoreInput,c:this._defaultControls}}LoadFromJson(f){this._gridWidth=f.gw;this._gridHeight=f.gh;this._gridOffsetX=f.ox;this._gridOffsetY=f.oy;this._speedX=f.sx;this._speedY=f.sy;this._targetX=f.x;this._targetY=f.y;this._targetGridX=f.gx;this._targetGridY=f.gy;this._isEnabled=!!f.e;this._ignoreInput=!!f.i;this._defaultControls=!!f.c;this._isEnabled?this._StartTicking():(this._simDown=this._simUp=this._simRight=this._simLeft=!1,this._StopTicking());
this._defaultControls?this._BindEvents():this._UnBindEvents();this._ResetLastPositions()}_GetTargetDelta(){var f=this.GetWorldInfo();const h=this._targetX-f.GetX();f=this._targetY-f.GetY();return[h,f]}IsMoving(){const [f,h]=this._GetTargetDelta();return 0<Math.abs(f)&&0!==this._speedX||0<Math.abs(h)&&0!==this._speedY}IsMovingDirection(f){const [h,g]=this._GetTargetDelta();return 2>f&&0!==this._speedX?0===f?0<h:0>h:0!==this._speedY?2===f?0<g:0>g:!1}CanMoveTo(f,h){const g=this.GetWorldInfo(),l=g.GetX(),
m=g.GetY();f=this._WorldPosition(f,h);g.SetX(f[0]);g.SetY(f[1]);g.SetBboxChanged();f=this._TestCollision();g.SetX(l);g.SetY(m);g.SetBboxChanged();return!f}CanMoveDirection(f,h){const g=this.GetWorldInfo(),l=g.GetX(),m=g.GetY();let u=0,v=0;switch(f){case 0:u=1;break;case 1:u=-1;break;case 2:v=1;break;case 3:v=-1}h=Math.floor(h);0>h&&(u=-u,v=-v,h=-h);f=this._GridX(l,m);let t=this._GridY(l,m);var q=null;for(let p=0;p<h&&!(f+=u,t+=v,q=this._WorldPosition(f,t),g.SetX(q[0]),g.SetY(q[1]),g.SetBboxChanged(),
q=this._TestCollision());p++);g.SetX(l);g.SetY(m);g.SetBboxChanged();return!q}SetIgnoreInput(f){this._ignoreInput=!!f}GetDefaultControls(){return this._defaultControls}SimulateControl(f){if(this._isEnabled)switch(f){case 0:this._simLeft=!0;break;case 1:this._simRight=!0;break;case 2:this._simUp=!0;break;case 3:this._simDown=!0}}SetSpeed(f,h){this._speedX=f;this._speedY=h}SetGridPosition(f,h,g){g=!!g;!this._UpdateTarget(f,h)&&g&&this._MoveToTarget()}SetGridDimensions(f,h,g,l){this._gridWidth=f;this._gridHeight=
h;this._gridOffsetX=g;this._gridOffsetY=l;this._TargetCurrentPositon()}_GridX(f,h){if(this._iso)return this._IsoGridX(f,h);f-=this._gridOffsetX;f/=this._gridWidth;return Math.round(f)}_GridY(f,h){if(this._iso)return this._IsoGridY(f,h);h-=this._gridOffsetY;h/=this._gridHeight;return Math.round(h)}_IsoGridX(f,h){f-=this._gridOffsetX;h-=this._gridOffsetY;f/=this._gridWidth/2;h/=this._gridHeight/2;return Math.round((f+h)/2)}_IsoGridY(f,h){f-=this._gridOffsetX;h-=this._gridOffsetY;f/=this._gridWidth/
2;h/=this._gridHeight/2;return Math.round((h-f)/2)}_ClampedGridPosition(f,h){const [g,l]=this._GridPosition(f,h);return[Math.round(g),Math.round(l)]}_GridPosition(f,h){if(this._iso)return this._IsoGridPosition(f,h);f-=this._gridOffsetX;h-=this._gridOffsetY;f/=this._gridWidth;h/=this._gridHeight;return[f,h]}_WorldPosition(f,h){if(this._iso)return this._IsoWorldPosition(f,h);f*=this._gridWidth;h*=this._gridHeight;f+=this._gridOffsetX;h+=this._gridOffsetY;return[f,h]}_IsoGridPosition(f,h){f-=this._gridOffsetX;
h-=this._gridOffsetY;f/=this._gridWidth/2;h/=this._gridHeight/2;return[(f+h)/2,(h-f)/2]}_IsoWorldPosition(f,h){let g;g=this._gridWidth/2*(f-h);f=this._gridHeight/2*(f+h);g+=this._gridOffsetX;f+=this._gridOffsetY;return[g,f]}_UpdateTarget(f,h){const g=this.GetWorldInfo(),l=g.GetX(),m=g.GetY(),u=this._WorldPosition(f,h);g.SetX(u[0]);g.SetY(u[1]);g.SetBboxChanged();const v=this._TestCollision();g.SetX(l);g.SetY(m);g.SetBboxChanged();if(v)return!0;this._targetGridX=f;this._targetGridY=h;this._targetX=
u[0];this._targetY=u[1];this._ResetLastPositions();return!1}_MoveToTarget(){const f=this.GetWorldInfo();f.SetXY(this._targetX,this._targetY);f.SetBboxChanged()}_TargetCurrentPositon(){var f=this.GetWorldInfo();f=this._ClampedGridPosition(f.GetX(),f.GetY());const h=this._WorldPosition(f[0],f[1]);this._targetGridX=f[0];this._targetGridY=f[1];this._targetX=h[0];this._targetY=h[1];this._ResetLastPositions()}_ResetTarget(){this._TargetCurrentPositon();this._MoveToTarget()}_UpdateCollisionRect(){const f=
this.GetWorldInfo().GetBoundingBox();this._collisionRect.copy(f);let h=.01,g=.01;var l=f.width(),m=f.height();.02>l&&(l=f.midX(),h=0,f.setRight(l),f.setLeft(l));.02>m&&(m=f.midY(),g=0,f.setRight(m),f.setLeft(m));this._collisionRect.deflate(h,g);return this._collisionRect}_TestCollision(){const f=this._runtime.GetCollisionEngine(),h=this._UpdateCollisionRect(),g=this.GetObjectInstance();f.GetSolidCollisionCandidates(null,h,c);for(const l of c)if(l!==g&&f.IsSolidCollisionAllowed(l,g)&&f.TestRectOverlap(h,
l))return e.clearArray(c),l;e.clearArray(c);return null}_MaybePushOut(){const f=this._runtime.GetCollisionEngine(),h=this._TestCollision();if(!h)return null;const g=this.GetWorldInfo(),l=g.GetX(),m=g.GetY(),u=g.GetBoundingBox(),v=h.GetWorldInfo().GetBoundingBox();var t=Math.max(u.getRight(),v.getRight())-Math.min(u.getLeft(),v.getLeft()),q=Math.max(u.getBottom(),v.getBottom())-Math.min(u.getTop(),v.getTop());t=u.width()+v.width()-t;q=u.height()+v.height()-q;let p=!1;t<q?(10<t&&(p=!0),t=Math.min(t,
10),u.getLeft()<v.getLeft()?g.OffsetX(-t):g.OffsetX(t)):(10<q&&(p=!0),q=Math.min(q,10),u.getTop()<v.getTop()?g.OffsetY(-q):g.OffsetY(q));g.SetBboxChanged();this._TestCollision()&&(g.SetX(l),g.SetY(m),g.SetBboxChanged());p&&f.RegisterCollision(this._inst,h);this._TargetCurrentPositon();return h}Tick(){var f=this._runtime.GetDt(this._inst);const h=this.GetWorldInfo();let g=this._leftKey||this._simLeft,l=this._rightKey||this._simRight,m=this._upKey||this._simUp,u=this._downKey||this._simDown;this._simDown=
this._simUp=this._simRight=this._simLeft=!1;if(this._isEnabled&&(this._ignoreInput&&(g=l=m=u=!1),m&&u&&(m=u=!1),g&&l&&(g=l=!1),!this._MaybePushOut()&&0!==f)){var v=h.GetX(),t=h.GetY(),q=f*this._speedX;f*=this._speedY;var p=this._targetGridX,r=this._targetGridY,x=this._targetX-v,y=this._targetY-t,C=Math.abs(x),G=Math.abs(y),A=0,E=0;if(0<C){A=Math.sign(x);const J=0>A&&g,B=0<A&&l;if(J||B)for(;!(!(C<q)||B&&this._UpdateTarget(++p,r)||J&&this._UpdateTarget(--p,r));)x=this._targetX-v,C=Math.abs(x);A*=e.clamp(C,
0,q)}if(0<G){v=Math.sign(y);q=0<v&&u;x=0>v&&m;if(q||x)for(;!(!(G<f)||q&&this._UpdateTarget(p,++r)||x&&this._UpdateTarget(p,--r));)y=this._targetY-t,G=Math.abs(y);E=v*e.clamp(G,0,f)}0!=A||0!=E?(this._lastX2=this._lastX,this._lastY2=this._lastY,this._lastX=h.GetX(),this._lastY=h.GetY(),this._lastX===this._lastX2&&this._lastY===this._lastY2?this._UpdateTarget(p-Math.sign(A),r-Math.sign(E)):(h.OffsetXY(A,E),h.SetBboxChanged(),this._MaybePushOut())):g?this._UpdateTarget(p-1,r):l?this._UpdateTarget(p+1,
r):m?this._UpdateTarget(p,r-1):u&&this._UpdateTarget(p,r+1)}}GetPropertyValueByIndex(f){switch(f){case 0:return this._gridWidth;case 1:return this._gridHeight;case 2:return this._gridOffsetX;case 3:return this._gridOffsetY;case 4:return this._speedX;case 5:return this._speedY;case 6:return this._isEnabled;case 7:return this._defaultControls}}SetPropertyValueByIndex(f,h){switch(f){case 0:this._gridWidth=h;this._TargetCurrentPositon();break;case 1:this._gridHeight=h;this._TargetCurrentPositon();break;
case 2:this._gridOffsetX=h;this._TargetCurrentPositon();break;case 3:this._gridOffsetY=h;this._TargetCurrentPositon();break;case 4:this._speedX=h;break;case 5:this._speedY=h;break;case 6:this.SetEnabled(h);break;case 7:this._SetDefaultControls(h)}}SetEnabled(f){f=!!f;this._isEnabled!==f&&((this._isEnabled=f)?this._StartTicking():(this._simDown=this._simUp=this._simRight=this._simLeft=!1,this._StopTicking()),this._ResetLastPositions())}_SetDefaultControls(f){f=!!f;this._defaultControls!==f&&((this._defaultControls=
f)?this._BindEvents():(this._UnBindEvents(),this._OnWindowOrKeyboardBlur()))}GetDebuggerProperties(){const f=this.GetWorldInfo(),h=this._GridPosition(f.GetX(),f.GetY());return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.tilemovement.debugger.grid-x",value:h[0],onedit:g=>{g=this._WorldPosition(g,h[1]);f.SetX(g[0]);f.SetBboxChanged()}},{name:"behaviors.tilemovement.debugger.grid-y",value:h[1],onedit:g=>{g=this._WorldPosition(h[0],g);f.SetY(g[1]);f.SetBboxChanged()}},{name:"behaviors.tilemovement.properties.grid-width.name",
value:this._gridWidth,onedit:g=>{this._gridWidth=g;this._TargetCurrentPositon()}},{name:"behaviors.tilemovement.properties.grid-height.name",value:this._gridHeight,onedit:g=>{this._gridHeight=g;this._TargetCurrentPositon()}},{name:"behaviors.tilemovement.properties.grid-offset-x.name",value:this._gridOffsetX,onedit:g=>{this._gridOffsetX=g;this._TargetCurrentPositon()}},{name:"behaviors.tilemovement.properties.grid-offset-y.name",value:this._gridOffsetY,onedit:g=>{this._gridOffsetY=g;this._TargetCurrentPositon()}},
{name:"behaviors.tilemovement.properties.speed-x.name",value:this._speedX,onedit:g=>this._speedX=g},{name:"behaviors.tilemovement.properties.speed-y.name",value:this._speedY,onedit:g=>this._speedY=g},{name:"behaviors.tilemovement.debugger.target-x",value:this._targetX,onedit:g=>{this._targetX=g;this._targetGridX=this._ClampedGridPosition(this._targetX,this._targetY)[0];this._ResetLastPositions()}},{name:"behaviors.tilemovement.debugger.target-y",value:this._targetY,onedit:g=>{this._targetY=g;this._targetGridY=
this._ClampedGridPosition(this._targetX,this._targetY)[1];this._ResetLastPositions()}},{name:"behaviors.tilemovement.debugger.grid-target-x",value:this._targetGridX,onedit:g=>{this._targetGridX=g;this._targetX=this._WorldPosition(this._targetGridX,this._targetGridY)[0]}},{name:"behaviors.tilemovement.debugger.grid-target-y",value:this._targetGridY,onedit:g=>{this._targetGridY=g;this._targetY=this._WorldPosition(this._targetGridX,this._targetGridY)[1]}},{name:"behaviors.tilemovement.properties.enabled.name",
value:this._isEnabled,onedit:g=>this.SetEnabled(g)},{name:"behaviors.tilemovement.properties.default-controls.name",value:this._defaultControls,onedit:g=>this._SetDefaultControls(g)}]}]}GetScriptInterfaceClass(){return self.ITileMovementBehaviorInstance}};const d=new WeakMap;self.ITileMovementBehaviorInstance=class extends a{constructor(){super();d.set(this,a._GetInitInst().GetSdkInstance())}set isIgnoringInput(f){d.get(this).SetIgnoreInput(!!f)}get isIgnoringInput(){return d.get(this)._ignoreInput}simulateControl(f){b.RequireString(f);
switch(f){case "left":f=0;break;case "right":f=1;break;case "up":f=2;break;case "down":f=3;break;default:throw Error(`Invalid direction ${f}`);}d.get(this).SimulateControl(f)}set isEnabled(f){d.get(this).SetEnabled(!!f)}get isEnabled(){return d.get(this)._isEnabled}get isDefaultControls(){return d.get(this).GetDefaultControls()}set isDefaultControls(f){d.get(this)._SetDefaultControls(!!f)}setSpeed(f,h){b.RequireFiniteNumber(f);b.RequireFiniteNumber(h);d.get(this).SetSpeed(f,h)}getSpeed(){const f=
d.get(this);return[f._speedX,f._speedY]}setGridPosition(f,h,g){b.RequireFiniteNumber(f);b.RequireFiniteNumber(h);d.get(this).SetGridPosition(f,h,!!g)}getGridPosition(){const f=d.get(this);var h=f.GetWorldInfo();const g=h.GetX();h=h.GetY();return[f._GridX(g,h),f._GridY(g,h)]}modifyGridDimensions(f,h,g,l){b.RequireFiniteNumber(f);b.RequireFiniteNumber(h);b.RequireFiniteNumber(g);b.RequireFiniteNumber(l);d.get(this).SetGridDimensions(f,h,g,l)}isMoving(){return d.get(this).IsMoving()}isMovingDirection(f){b.RequireString(f);
switch(f){case "right":f=0;break;case "left":f=1;break;case "down":f=2;break;case "up":f=3;break;default:throw Error(`Invalid direction ${f}`);}return d.get(this).IsMovingDirection(f)}canMoveTo(f,h){b.RequireFiniteNumber(f);b.RequireFiniteNumber(h);return d.get(this).CanMoveTo(f,h)}canMoveDirection(f,h){b.RequireString(f);switch(f){case "right":f=0;break;case "left":f=1;break;case "down":f=2;break;case "up":f=3;break;default:throw Error(`invalid direction '${f}'`);}return d.get(this).CanMoveDirection(f,
h)}getTargetPosition(){const f=d.get(this);return[f._targetX,f._targetY]}getGridTargetPosition(){const f=d.get(this);return[f._targetGridX,f._targetGridY]}toGridSpace(f,h){b.RequireFiniteNumber(f);b.RequireFiniteNumber(h);return d.get(this)._GridPosition(f,h)}fromGridSpace(f,h){b.RequireFiniteNumber(f);b.RequireFiniteNumber(h);return d.get(this)._WorldPosition(f,h)}}}"use strict";
self.C3.Behaviors.TileMovement.Cnds={IsMoving(){return this.IsMoving()},IsMovingDirection(e){return this.IsMovingDirection(e)},IsEnabled(){return this._isEnabled},CanMoveTo(e,b){return this.CanMoveTo(e,b)},CanMoveDirection(e,b){return this.CanMoveDirection(e,b)}};"use strict";
self.C3.Behaviors.TileMovement.Acts={SetIgnoreInput(e){this.SetIgnoreInput(e)},SimulateControl(e){this.SimulateControl(e)},SetEnabled(e){this.SetEnabled(e)},SetSpeed(e,b){this.SetSpeed(e,b)},SetGridPosition(e,b,a){this.SetGridPosition(e,b,a)},SetGridDimensions(e,b,a,c){this.SetGridDimensions(e,b,a,c)},SetDefaultControls(e){this._SetDefaultControls(!!e)}};"use strict";
self.C3.Behaviors.TileMovement.Exps={GridX(){const e=this.GetWorldInfo();return this._GridX(e.GetX(),e.GetY())},GridY(){const e=this.GetWorldInfo();return this._GridY(e.GetX(),e.GetY())},SpeedX(){return this._speedX},SpeedY(){return this._speedY},TargetX(){return this._targetX},TargetY(){return this._targetY},GridTargetX(){return this._targetGridX},GridTargetY(){return this._targetGridY}};{"use strict";const e=self.C3;e.Behaviors.destroy=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Behaviors.destroy.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}{"use strict";const e=self.C3;e.Behaviors.destroy.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._StartTicking()}Release(){super.Release()}Tick(){var b=this._inst.GetWorldInfo();const a=b.GetBoundingBox();b=b.GetLayout();(0>a.getRight()||0>a.getBottom()||a.getLeft()>b.GetWidth()||a.getTop()>b.GetHeight())&&this._runtime.DestroyInstance(this._inst)}}}"use strict";
self.C3.Behaviors.destroy.Cnds={};"use strict";self.C3.Behaviors.destroy.Acts={};"use strict";self.C3.Behaviors.destroy.Exps={};{"use strict";const e=self.C3;e.Behaviors.Bullet=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Bullet.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IBehaviorInstance;e.Behaviors.Bullet.Instance=class extends e.SDKBehaviorInstanceBase{constructor(d,f){super(d);d=this.GetWorldInfo();this._g=this._acc=this._speed=0;this._isStepping=this._setAngle=this._bounceOffSolid=!1;this._isEnabled=!0;this._dy=this._dx=0;this._lastX=d.GetX();this._lastY=d.GetY();this._lastKnownAngle=d.GetAngle();this._travelled=0;this._stepSize=Math.min(Math.abs(d.GetWidth()),Math.abs(d.GetHeight())/2);this._stopStepping=!1;f&&
(this._speed=f[0],this._acc=f[1],this._g=f[2],this._bounceOffSolid=!!f[3],this._setAngle=!!f[4],this._isStepping=!!f[5],this._isEnabled=!!f[6]);f=d.GetAngle();this._dx=Math.cos(f)*this._speed;this._dy=Math.sin(f)*this._speed;this._isEnabled&&(this._StartTicking(),this._bounceOffSolid&&this._StartPostTicking())}Release(){super.Release()}SaveToJson(){const d={dx:this._dx,dy:this._dy,lx:this._lastX,ly:this._lastY,lka:this._lastKnownAngle,t:this._travelled};0!==this._acc&&(d.acc=this._acc);0!==this._g&&
(d.g=this._g);this._isStepping&&(d.st=this._isStepping);this._isEnabled||(d.e=this._isEnabled);this._bounceOffSolid&&(d.bos=this._bounceOffSolid);this._setAngle&&(d.sa=this._setAngle);return d}LoadFromJson(d){this._dx=d.dx;this._dy=d.dy;this._lastX=d.lx;this._lastY=d.ly;this._lastKnownAngle=d.lka;this._travelled=d.t;this._acc=d.hasOwnProperty("acc")?d.acc:0;this._g=d.hasOwnProperty("g")?d.g:0;this._isStepping=d.hasOwnProperty("st")?d.st:!1;this._bounceOffSolid=d.hasOwnProperty("bos")?d.bos:!1;this._setAngle=
d.hasOwnProperty("sa")?d.sa:!1;this._SetEnabled(d.hasOwnProperty("e")?d.e:!0)}Tick(){if(this._isEnabled){var d=this._runtime.GetDt(this._inst),f=this._inst.GetWorldInfo();if(f.GetAngle()!==this._lastKnownAngle){var h=f.GetAngle();if(this._setAngle){var g=e.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(h)*g;this._dy=Math.sin(h)*g}this._lastKnownAngle=h}h=g=0;if(0!==this._acc){let l=e.distanceTo(0,0,this._dx,this._dy),m;m=0===this._dx&&0===this._dy?f.GetAngle():e.angleTo(0,0,this._dx,this._dy);
l+=this._acc*d;g=Math.cos(m)*this._acc;h=Math.sin(m)*this._acc;0>l&&(h=g=l=0);this._dx=Math.cos(m)*l;this._dy=Math.sin(m)*l}0!==this._g&&(this._dy+=this._g*d,h+=this._g);this._lastX=f.GetX();this._lastY=f.GetY();if(0!==this._dx||0!==this._dy)g=this._dx*d+.5*g*d*d,d=this._dy*d+.5*h*d*d,h=e.distanceTo(0,0,g,d),this._MoveBy(g,d,h),this._travelled+=h,!this._setAngle||0===g&&0===d||(d=e.angleTo(0,0,g,d),f.SetAngle(d),this._lastKnownAngle=f.GetAngle()),f.SetBboxChanged()}}_MoveBy(d,f,h){const g=this.GetWorldInfo();
if(!this._isStepping||h<=this._stepSize)g.OffsetXY(d,f),g.SetBboxChanged(),this._isStepping&&this.Trigger(e.Behaviors.Bullet.Cnds.OnStep);else{this._stopStepping=!1;var l=g.GetX(),m=g.GetY(),u=l+d,v=m+f;f=e.angleTo(0,0,d,f);d=Math.cos(f)*this._stepSize;f=Math.sin(f)*this._stepSize;h=Math.floor(h/this._stepSize);for(let t=1;t<=h;++t)if(g.SetXY(l+d*t,m+f*t),g.SetBboxChanged(),this.Trigger(e.Behaviors.Bullet.Cnds.OnStep),this._inst.IsDestroyed()||this._stopStepping)return;g.SetXY(u,v);g.SetBboxChanged();
this.Trigger(e.Behaviors.Bullet.Cnds.OnStep)}}PostTick(){if(this._isEnabled&&this._bounceOffSolid&&(0!==this._dx||0!==this._dy)){var d=this._runtime.GetDt(this._inst),f=this._inst.GetWorldInfo(),h=this._runtime.GetCollisionEngine(),g=h.TestOverlapSolid(this._inst);if(g){h.RegisterCollision(this._inst,g);g=e.distanceTo(0,0,this._dx,this._dy);const l=h.CalculateBounceAngle(this._inst,this._lastX,this._lastY);this._dx=Math.cos(l)*g;this._dy=Math.sin(l)*g;f.OffsetXY(this._dx*d,this._dy*d);f.SetBboxChanged();
this._setAngle&&(f.SetAngle(l),this._lastKnownAngle=f.GetAngle(),f.SetBboxChanged());h.PushOutSolid(this._inst,this._dx/g,this._dy/g,Math.max(2.5*g*d,30))||h.PushOutSolidNearest(this._inst,100)}}}GetPropertyValueByIndex(d){switch(d){case 0:return this._GetSpeed();case 1:return this._GetAcceleration();case 2:return this._GetGravity();case 4:return this._setAngle;case 5:return this._isStepping;case 6:return this._IsEnabled()}}SetPropertyValueByIndex(d,f){switch(d){case 0:this._SetSpeed(f);break;case 1:this._acc=
f;break;case 2:this._g=f;break;case 4:this._setAngle=!!f;break;case 5:this._isStepping=!!f;break;case 6:this._SetEnabled(!!f)}}_SetSpeed(d){const f=e.angleTo(0,0,this._dx,this._dy);this._dx=Math.cos(f)*d;this._dy=Math.sin(f)*d}_GetSpeed(){return e.round6dp(e.distanceTo(0,0,this._dx,this._dy))}_SetAcceleration(d){this._acc=d}_GetAcceleration(){return this._acc}_SetGravity(d){this._g=d}_GetGravity(){return this._g}_SetAngleOfMotion(d){const f=e.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(d)*
f;this._dy=Math.sin(d)*f}_GetAngleOfMotion(){return e.angleTo(0,0,this._dx,this._dy)}_SetBounceOffSolids(d){d=!!d;this._bounceOffSolid!==d&&(this._bounceOffSolid=d,this._isEnabled&&(this._bounceOffSolid?this._StartPostTicking():this._StopPostTicking()))}_IsBounceOffSolids(){return this._bounceOffSolid}_SetDistanceTravelled(d){this._travelled=d}_GetDistanceTravelled(){return this._travelled}_SetEnabled(d){(this._isEnabled=!!d)?(this._StartTicking(),this._bounceOffSolid&&this._StartPostTicking()):(this._StopTicking(),
this._StopPostTicking())}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.bullet.debugger.vector-x",value:this._dx,onedit:d=>this._dx=d},{name:"behaviors.bullet.debugger.vector-y",value:this._dy,onedit:d=>this._dy=d},{name:"behaviors.bullet.properties.speed.name",value:this._GetSpeed(),onedit:d=>this._SetSpeed(d)},{name:"behaviors.bullet.debugger.angle-of-motion",value:e.toDegrees(this._GetAngleOfMotion())},
{name:"behaviors.bullet.properties.gravity.name",value:this._GetGravity(),onedit:d=>this._SetGravity(d)},{name:"behaviors.bullet.properties.acceleration.name",value:this._GetAcceleration(),onedit:d=>this._SetAcceleration(d)},{name:"behaviors.bullet.debugger.distance-travelled",value:this._GetDistanceTravelled()},{name:"behaviors.bullet.properties.enabled.name",value:this._IsEnabled(),onedit:d=>this._SetEnabled(d)}]}]}GetScriptInterfaceClass(){return self.IBulletBehaviorInstance}};const c=new WeakMap;
self.IBulletBehaviorInstance=class extends a{constructor(){super();c.set(this,a._GetInitInst().GetSdkInstance())}get speed(){return c.get(this)._GetSpeed()}set speed(d){b.RequireFiniteNumber(d);c.get(this)._SetSpeed(d)}get acceleration(){return c.get(this)._GetAcceleration()}set acceleration(d){b.RequireFiniteNumber(d);c.get(this)._SetAcceleration(d)}get gravity(){return c.get(this)._GetGravity()}set gravity(d){b.RequireFiniteNumber(d);c.get(this)._SetGravity(d)}get angleOfMotion(){return c.get(this)._GetAngleOfMotion()}set angleOfMotion(d){b.RequireFiniteNumber(d);
c.get(this)._SetAngleOfMotion(d)}get bounceOffSolids(){return c.get(this)._IsBounceOffSolids()}set bounceOffSolids(d){c.get(this)._SetBounceOffSolids(!!d)}get distanceTravelled(){return c.get(this)._GetDistanceTravelled()}set distanceTravelled(d){b.RequireFiniteNumber(d);c.get(this)._SetDistanceTravelled(d)}get isEnabled(){return c.get(this)._IsEnabled()}set isEnabled(d){c.get(this)._SetEnabled(d)}}}
{"use strict";const e=self.C3;e.Behaviors.Bullet.Cnds={CompareSpeed(b,a){return e.compare(Math.sqrt(this._dx*this._dx+this._dy*this._dy),b,a)},CompareTravelled(b,a){return e.compare(this._GetDistanceTravelled(),b,a)},OnStep(){return!0},IsEnabled(){return this._IsEnabled()}}}
{"use strict";const e=self.C3;e.Behaviors.Bullet.Acts={SetSpeed(b){this._SetSpeed(b)},SetAcceleration(b){this._SetAcceleration(b)},SetGravity(b){this._SetGravity(b)},SetAngleOfMotion(b){this._SetAngleOfMotion(e.toRadians(b))},Bounce(b){if(b&&(b=b.GetFirstPicked(this._inst))){var a=this._inst.GetWorldInfo(),c=this._runtime.GetCollisionEngine(),d=this._runtime.GetDt(this._inst),f=e.distanceTo(0,0,this._dx,this._dy),h=c.CalculateBounceAngle(this._inst,this._lastX,this._lastY,b);this._dx=Math.cos(h)*
f;this._dy=Math.sin(h)*f;a.OffsetXY(this._dx*d,this._dy*d);a.SetBboxChanged();this._setAngle&&(a.SetAngle(h),this._lastKnownAngle=a.GetAngle(),a.SetBboxChanged());0!==f&&(this._bounceOffSolid?c.PushOutSolid(this._inst,this._dx/f,this._dy/f,Math.max(2.5*f*d,30))||c.PushOutSolidNearest(this._inst,100):c.PushOut(this._inst,this._dx/f,this._dy/f,Math.max(2.5*f*d,30),b))}},SetBounceOffSolids(b){this._SetBounceOffSolids(b)},SetDistanceTravelled(b){this._SetDistanceTravelled(b)},SetEnabled(b){this._SetEnabled(b)},
StopStepping(){this._stopStepping=!0}}}{"use strict";const e=self.C3;e.Behaviors.Bullet.Exps={Speed(){return this._GetSpeed()},Acceleration(){return this._GetAcceleration()},AngleOfMotion(){return e.toDegrees(this._GetAngleOfMotion())},DistanceTravelled(){return this._GetDistanceTravelled()},Gravity(){return this._GetGravity()}}}{"use strict";const e=self.C3;e.Behaviors.LOS=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Behaviors.LOS.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b);this._obstacleTypes=[]}Release(){e.clearArray(this._obstacleTypes);super.Release()}OnCreate(){}GetObstacleTypes(){return this._obstacleTypes}FindLOSBehavior(b){const a=this.GetBehaviorType();for(const c of b.GetBehaviorInstances())if(c.GetBehaviorType()===a)return c.GetSdkInstance();return null}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IBehaviorInstance,c=[];e.Behaviors.LOS.Instance=class extends e.SDKBehaviorInstanceBase{constructor(f,h){super(f);this._obstacleMode=0;this._range=1E4;this._cone=e.toRadians(360);this._useCollisionCells=!0;this._ray=new e.Ray;h&&(this._obstacleMode=h[0],this._range=h[1],this._cone=e.toRadians(h[2]),this._useCollisionCells=h[3])}Release(){super.Release()}SaveToJson(){return{r:this._range,c:this._cone,om:this._obstacleMode,ucc:this._useCollisionCells,
t:this.GetSdkType().GetObstacleTypes().map(f=>f.GetSID())}}LoadFromJson(f){this._range=f.r;this._cone=f.c;this._obstacleMode=f.om||0;this._useCollisionCells=!!f.ucc;const h=this.GetSdkType().GetObstacleTypes();e.clearArray(h);for(const g of f.t)(f=this._runtime.GetObjectClassBySID(g))&&h.push(f)}HasLOSToInstance(f,h){const g=f.GetUID(),[l,m]=f.GetImagePoint(h);return this.HasLOSTo(l,m)||this._ray.hitUid===g}HasLOSTo(f,h){const g=this.GetWorldInfo();let l=g.GetAngle();0>g.GetWidth()&&(l+=Math.PI);
return this.HasLOSBetweenPositions(g.GetX(),g.GetY(),l,f,h)}HasLOSBetweenPositions(f,h,g,l,m){var u=this._range;if(e.distanceSquared(f,h,l,m)>u*u)return!1;u=e.angleTo(f,h,l,m);return e.angleDiff(g,u)>this._cone/2?!1:!this.CastRay(f,h,l,m,this._useCollisionCells).DidCollide()}_GetCollisionCandidates(f,h){if(h){h=this.GetWorldInfo().GetLayer();var g=this._runtime.GetCollisionEngine();0===this._obstacleMode?g.GetSolidCollisionCandidates(h,f.rect,c):g.GetObjectClassesCollisionCandidates(h,this._GetObstacleTypes(),
f.rect,c);return c}if(0===this._obstacleMode)return(f=this._runtime.GetSolidBehavior())?f.GetInstances():c;for(g of this._GetObstacleTypes())e.appendArray(c,g.GetInstances());return c}_GetObstacleTypes(){return this.GetSdkType().GetObstacleTypes()}CastRay(f,h,g,l,m){f=this._ray.Set(f,h,g,l);m=this._GetCollisionCandidates(f,m);h=this._runtime.GetCollisionEngine();g=0===this._obstacleMode;l=this._inst;for(let u=0,v=m.length;u<v;++u){const t=m[u];t!==l&&(g&&!h.IsSolidCollisionAllowed(t,l)||h.TestRayIntersectsInstance(t,
f))}f.Complete();e.clearArray(c);return f}_GetRay(){return this._ray}_GetRayHitX(){const f=this._ray;return f.DidCollide()?f.hitX:0}_GetRayHitY(){const f=this._ray;return f.DidCollide()?f.hitY:0}_GetRayHitDistance(){const f=this._ray;return f.DidCollide()?f.distance:0}_GetRayHitUID(){const f=this._ray;return f.DidCollide()?f.hitUid:-1}_GetRayNormalX(f){const h=this._ray;return h.DidCollide()?h.hitX+f*h.normalX:0}_GetRayNormalY(f){const h=this._ray;return h.DidCollide()?h.hitY+f*h.normalY:0}_GetRayNormalAngle(){const f=
this._ray;return f.DidCollide()?f.hitNormal:0}_GetRayReflectionX(f){const h=this._ray;return h.DidCollide()?h.hitX+f*h.reflectionX:0}_GetRayReflectionY(f){const h=this._ray;return h.DidCollide()?h.hitY+f*h.reflectionY:0}_GetRayReflectionAngle(){const f=this._ray;return f.DidCollide()?Math.atan2(f.reflectionY,f.reflectionX):0}_SetRange(f){this._range=f}_GetRange(){return this._range}_SetConeOfView(f){this._cone=f}_GetConeOfView(){return this._cone}GetPropertyValueByIndex(f){switch(f){case 0:return this._obstacleMode;
case 1:return this._range;case 2:return e.toDegrees(this._cone);case 3:return this._useCollisionCells}}SetPropertyValueByIndex(f,h){switch(f){case 0:this._obstacleMode=h;break;case 1:this._range=h;break;case 2:this._cone=e.toRadians(h);break;case 3:this._useCollisionCells=!!h}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.los.properties.range.name",value:this._GetRange(),onedit:f=>this._SetRange(f)},{name:"behaviors.los.properties.cone-of-view.name",
value:e.toDegrees(this._GetConeOfView()),onedit:f=>this._SetConeOfView(e.toRadians(f))}]}]}GetScriptInterfaceClass(){return self.ILOSBehaviorInstance}};const d=new WeakMap;self.ILOSBehaviorInstance=class extends a{constructor(){super();const f=a._GetInitInst().GetSdkInstance();d.set(this,f);this.ray=new self.ILOSBehaviorRay(f)}set range(f){b.RequireFiniteNumber(f);d.get(this)._SetRange(f)}get range(){return d.get(this)._GetRange()}set coneOfView(f){b.RequireFiniteNumber(f);d.get(this)._SetConeOfView(f)}get coneOfView(){return d.get(this)._GetConeOfView()}hasLOStoPosition(f,
h){b.RequireNumber(f);b.RequireNumber(h);return d.get(this).HasLOSTo(f,h)}hasLOSBetweenPositions(f,h,g,l,m){b.RequireNumber(f);b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);b.RequireNumber(m);return d.get(this).HasLOSBetweenPositions(f,h,g,l,m)}castRay(f,h,g,l,m=!0){b.RequireNumber(f);b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);d.get(this).CastRay(f,h,g,l,m);return this.ray}};self.ILOSBehaviorRay=class{constructor(f){d.set(this,f)}get didCollide(){return d.get(this)._GetRay().DidCollide()}get hitX(){return d.get(this)._GetRayHitX()}get hitY(){return d.get(this)._GetRayHitY()}get hitDistance(){return d.get(this)._GetRayHitDistance()}get hitUid(){return d.get(this)._GetRayHitUID()}getNormalX(f){b.RequireFiniteNumber(f);
return d.get(this)._GetRayNormalX(f)}getNormalY(f){b.RequireFiniteNumber(f);return d.get(this)._GetRayNormalY(f)}get normalAngle(){return d.get(this)._GetRayNormalAngle()}getReflectionX(f){b.RequireFiniteNumber(f);return d.get(this)._GetRayReflectionX(f)}getReflectionY(f){b.RequireFiniteNumber(f);return d.get(this)._GetRayReflectionY(f)}get reflectionAngle(){return d.get(this)._GetRayReflectionAngle()}}}
{"use strict";const e=self.C3,b=new Set,a=new Set;e.Behaviors.LOS.Cnds={HasLOSToPosition(c,d){return this.HasLOSTo(c,d)},RayIntersected(){return this._ray.DidCollide()},HasLOSBetweenPositions(c,d,f,h,g){return this.HasLOSBetweenPositions(c,d,e.toRadians(f),h,g)},HasLOSToObject(c,d){if(!c)return!1;var f=this._runtime.GetCurrentCondition();const h=f.GetEventBlock().IsOrBlock();var g=f.GetRuntime();const l=f.GetObjectClass().GetCurrentSol();c=c.GetCurrentSol();let m=l.GetInstances(),u=c.GetInstances();
l.IsSelectAll()?e.clearArray(l._GetOwnElseInstances()):h&&(m=g.IsCurrentConditionFirst()&&!l._GetOwnElseInstances().length&&l._GetOwnInstances().length?l._GetOwnInstances():l._GetOwnElseInstances());c.IsSelectAll()?e.clearArray(c._GetOwnElseInstances()):h&&(u=g.IsCurrentConditionFirst()&&!c._GetOwnElseInstances().length&&c._GetOwnInstances().length?c._GetOwnInstances():c._GetOwnElseInstances());f=f.IsInverted();g=this.GetSdkType();for(const v of m){let t=!1;const q=g.FindLOSBehavior(v);if(0===u.length)f&&
(t=!0);else for(const p of u)v!==p&&e.xor(q.HasLOSToInstance(p,d),f)&&(t=!0,a.add(p));t&&b.add(v)}h?(m===l._GetOwnElseInstances()?l.TransferElseInstancesToOwn(b):(l.AddElseInstances(b,m),l.SetSetPicked(b)),u===c._GetOwnElseInstances()?c.TransferElseInstancesToOwn(a):(c.AddElseInstances(a,u),c.SetSetPicked(a))):(l.SetSetPicked(b),c.SetSetPicked(a));b.clear();a.clear();return l.HasAnyInstances()}}}
{"use strict";const e=self.C3;e.Behaviors.LOS.Acts={SetRange(b){this._SetRange(b)},SetCone(b){this._SetConeOfView(e.toRadians(b))},CastRay(b,a,c,d,f){this.CastRay(b,a,c,d,f)},AddObstacle(b){const a=this.GetSdkType().GetObstacleTypes();if(!a.includes(b)){for(const c of a)if(c.IsFamily()&&c.FamilyHasMember(b))return;a.push(b)}},ClearObstacles(){e.clearArray(this.GetSdkType().GetObstacleTypes())}}}
{"use strict";const e=self.C3;e.Behaviors.LOS.Exps={Range(){return this._GetRange()},ConeOfView(){return e.toDegrees(this._GetConeOfView())},HitX(){return this._GetRayHitX()},HitY(){return this._GetRayHitY()},HitDistance(){return this._GetRayHitDistance()},HitUID(){return this._GetRayHitUID()},NormalX(b){return this._GetRayNormalX(b)},NormalY(b){return this._GetRayNormalY(b)},NormalAngle(){return e.toDegrees(this._GetRayNormalAngle())},ReflectionX(b){return this._GetRayReflectionX(b)},ReflectionY(b){return this._GetRayReflectionY(b)},
ReflectionAngle(){return e.toDegrees(this._GetRayReflectionAngle())}}}{"use strict";const e=self.C3;e.Behaviors.solid=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.solid.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=new Set;e.Behaviors.solid.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,c){super(a);this.SetEnabled(!0);c&&(this.SetEnabled(c[0]),this.SetTags(c[1]))}Release(){super.Release()}SetEnabled(a){this._inst._SetSolidEnabled(!!a)}IsEnabled(){return this._inst._IsSolidEnabled()}SetTags(a){const c=this._inst.GetSavedDataMap();if(a.trim()){var d=c.get("solidTags");d||(d=new Set,c.set("solidTags",d));d.clear();for(const f of a.split(" "))f&&d.add(f.toLowerCase())}else c.delete("solidTags")}GetTags(){return this._inst.GetSavedDataMap().get("solidTags")||
b}SaveToJson(){return{e:this.IsEnabled()}}LoadFromJson(a){this.SetEnabled(a.e)}GetPropertyValueByIndex(a){switch(a){case 0:return this.IsEnabled()}}SetPropertyValueByIndex(a,c){switch(a){case 0:this.SetEnabled(c)}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.solid.properties.enabled.name",value:this.IsEnabled(),onedit:a=>this.SetEnabled(a)}]}]}}}"use strict";self.C3.Behaviors.solid.Cnds={IsEnabled(){return this.IsEnabled()}};"use strict";
self.C3.Behaviors.solid.Acts={SetEnabled(e){this.SetEnabled(e)},SetTags(e){this.SetTags(e)}};"use strict";self.C3.Behaviors.solid.Exps={};{"use strict";const e=self.C3;e.Behaviors.Sin=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Sin.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IBehaviorInstance,c=2*Math.PI,d=Math.PI/2,f=3*Math.PI/2,h=[0,1,8,3,4,2,5,6,9,7];e.Behaviors.Sin.Instance=class extends e.SDKBehaviorInstanceBase{constructor(u,v){super(u);this._mag=this._period=this._wave=this._movement=this._i=0;this._isEnabled=!0;this._ratio=this._lastKnownValue2=this._lastKnownValue=this._initialValue2=this._initialValue=this._magnitudeRandom=this._periodOffsetRandom=this._periodRandom=this._baseMag=this._basePeriodOffset=this._basePeriod=
0;v&&(this._movement=h[v[0]],this._wave=v[1],this._periodRandom=this._runtime.Random()*v[3],this._basePeriod=v[2],this._period=v[2],this._period+=this._periodRandom,this._basePeriodOffset=v[4],0!==this._period&&(this._periodOffsetRandom=this._runtime.Random()*v[5],this._i=v[4]/this._period*c,this._i+=this._periodOffsetRandom/this._period*c),this._magnitudeRandom=this._runtime.Random()*v[7],this._baseMag=v[6],this._mag=v[6],this._mag+=this._magnitudeRandom,this._isEnabled=!!v[8]);5===this._movement&&
(this._mag=e.toRadians(this._mag));this.Init();this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{i:this._i,e:this._isEnabled,mv:this._movement,w:this._wave,p:this._period,mag:this._mag,iv:this._initialValue,iv2:this._initialValue2,r:this._ratio,lkv:this._lastKnownValue,lkv2:this._lastKnownValue2}}LoadFromJson(u){this._i=u.i;this._SetEnabled(u.e);this._movement=u.mv;this._wave=u.w;this._period=u.p;this._mag=u.mag;this._initialValue=u.iv;this._initialValue2=u.iv2;this._ratio=
u.r;this._lastKnownValue=u.lkv;this._lastKnownValue2=u.lkv2}Init(){const u=this._inst.GetWorldInfo();switch(this._movement){case 0:this._initialValue=u.GetX();break;case 1:this._initialValue=u.GetY();break;case 2:this._initialValue=u.GetWidth();this._ratio=u.GetHeight()/u.GetWidth();break;case 3:this._initialValue=u.GetWidth();break;case 4:this._initialValue=u.GetHeight();break;case 5:this._initialValue=u.GetAngle();break;case 6:this._initialValue=u.GetOpacity();break;case 7:this._initialValue=0;
break;case 8:this._initialValue=u.GetX();this._initialValue2=u.GetY();break;case 9:this._initialValue=u.GetZElevation()}this._lastKnownValue=this._initialValue;this._lastKnownValue2=this._initialValue2}WaveFunc(u){u%=c;switch(this._wave){case 0:return Math.sin(u);case 1:return u<=d?u/d:u<=f?1-2*(u-d)/Math.PI:(u-f)/d-1;case 2:return 2*u/c-1;case 3:return-2*u/c+1;case 4:return u<Math.PI?-1:1}return 0}Tick(){const u=this._runtime.GetDt(this._inst);this._isEnabled&&0!==u&&(this._i=0===this._period?0:
(this._i+u/this._period*c)%c,this._UpdateFromPhase())}_UpdateFromPhase(){const u=this._inst.GetWorldInfo();switch(this._movement){case 0:u.GetX()!==this._lastKnownValue&&(this._initialValue+=u.GetX()-this._lastKnownValue);u.SetX(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetX();break;case 1:u.GetY()!==this._lastKnownValue&&(this._initialValue+=u.GetY()-this._lastKnownValue);u.SetY(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetY();break;
case 2:u.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);u.SetHeight(u.GetWidth()*this._ratio);break;case 3:u.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 4:u.SetHeight(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 5:u.GetAngle()!==this._lastKnownValue&&(this._initialValue=e.clampAngle(this._initialValue+(u.GetAngle()-this._lastKnownValue)));u.SetAngle(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetAngle();
break;case 6:u.SetOpacity(this._initialValue+this.WaveFunc(this._i)*this._mag/100);break;case 8:u.GetX()!==this._lastKnownValue&&(this._initialValue+=u.GetX()-this._lastKnownValue);u.GetY()!==this._lastKnownValue2&&(this._initialValue2+=u.GetY()-this._lastKnownValue2);u.SetX(this._initialValue+Math.cos(u.GetAngle())*this.WaveFunc(this._i)*this._mag);u.SetY(this._initialValue2+Math.sin(u.GetAngle())*this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetX();this._lastKnownValue2=u.GetY();break;
case 9:u.SetZElevation(this._initialValue+this.WaveFunc(this._i)*this._mag)}u.SetBboxChanged()}_OnSpriteFrameChanged(u,v){}_SetPeriod(u){this._period=u}_GetPeriod(){return this._period}_SetMagnitude(u){this._mag=u}_SetMagnitude_ConvertAngle(u){5===this._movement&&(u=e.toRadians(u));this._SetMagnitude(u)}_GetMagnitude(){return this._mag}_GetMagnitude_ConvertAngle(){let u=this._GetMagnitude();5===this._movement&&(u=e.toDegrees(u));return u}_SetMovement(u){5===this._movement&&5!==u&&(this._mag=e.toDegrees(this._mag));
this._movement=u;this.Init()}_GetMovement(){return this._movement}_SetWave(u){this._wave=u}_GetWave(){return this._wave}_SetPhase(u){this._i=e.clamp(u,0,2*Math.PI);this._UpdateFromPhase()}_GetPhase(){return this._i}_SetEnabled(u){(this._isEnabled=!!u)?this._StartTicking():this._StopTicking()}_IsEnabled(){return this._isEnabled}GetPropertyValueByIndex(u){switch(u){case 0:return this._movement;case 1:return this._wave;case 2:return this._basePeriod;case 6:return this._baseMag;case 8:return this._isEnabled}}SetPropertyValueByIndex(u,
v){switch(u){case 0:this._movement=h[v];this.Init();break;case 1:this._wave=v;break;case 2:this._basePeriod=v;this._period=this._basePeriod+this._periodRandom;this._isEnabled||(0!==this._period?(this._i=this._basePeriodOffset/this._period*c,this._i+=this._periodOffsetRandom/this._period*c):this._i=0);break;case 6:this._baseMag=v;this._mag=this._baseMag+this._magnitudeRandom;5===this._movement&&(this._mag=e.toRadians(this._mag));break;case 8:this._isEnabled=!!v}}GetDebuggerProperties(){return[{title:"$"+
this.GetBehaviorType().GetName(),properties:[{name:"behaviors.sin.properties.enabled.name",value:this._IsEnabled(),onedit:u=>this._SetEnabled(u)},{name:"behaviors.sin.properties.period.name",value:this._GetPeriod(),onedit:u=>this._SetPeriod(u)},{name:"behaviors.sin.properties.magnitude.name",value:this._GetMagnitude_ConvertAngle(),onedit:u=>this._SetMagnitude_ConvertAngle(u)},{name:"behaviors.sin.debugger.value",value:this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}]}]}GetScriptInterfaceClass(){return self.ISineBehaviorInstance}};
const g=new WeakMap,l="horizontal vertical size width height angle opacity value-only forwards-backwards z-elevation".split(" "),m=["sine","triangle","sawtooth","reverse-sawtooth","square"];self.ISineBehaviorInstance=class extends a{constructor(){super();g.set(this,a._GetInitInst().GetSdkInstance())}set period(u){b.RequireFiniteNumber(u);g.get(this)._SetPeriod(u)}get period(){return g.get(this)._GetPeriod()}set magnitude(u){b.RequireFiniteNumber(u);g.get(this)._SetMagnitude(u)}get magnitude(){return g.get(this)._GetMagnitude()}set phase(u){g.get(this)._SetPhase(u)}get phase(){return g.get(this)._GetPhase()}set movement(u){b.RequireString(u);
u=l.indexOf(u);if(-1===u)throw Error("invalid movement");g.get(this)._SetMovement(u)}get movement(){return l[g.get(this)._GetMovement()]}set wave(u){b.RequireString(u);u=m.indexOf(u);if(-1===u)throw Error("invalid wave");g.get(this)._SetWave(u)}get wave(){return m[g.get(this)._GetWave()]}get value(){const u=g.get(this);return u.WaveFunc(u._GetPhase())*u._GetMagnitude()}updateInitialState(){g.get(this).Init()}set isEnabled(u){g.get(this)._SetEnabled(!!u)}get isEnabled(){return g.get(this)._IsEnabled()}}}
{"use strict";const e=self.C3;e.Behaviors.Sin.Cnds={IsEnabled(){return this._IsEnabled()},CompareMovement(b){return this._GetMovement()===b},ComparePeriod(b,a){return e.compare(this._GetPeriod(),b,a)},CompareMagnitude(b,a){return e.compare(this._GetMagnitude_ConvertAngle(),b,a)},CompareWave(b){return this._GetWave()===b}}}"use strict";
self.C3.Behaviors.Sin.Acts={SetEnabled(e){this._SetEnabled(0!==e)},SetPeriod(e){this._SetPeriod(e)},SetMagnitude(e){this._SetMagnitude_ConvertAngle(e)},SetMovement(e){this._SetMovement(e)},SetWave(e){this._wave=e},SetPhase(e){const b=2*Math.PI;this._SetPhase(e*b%b)},UpdateInitialState(){this.Init()}};"use strict";
self.C3.Behaviors.Sin.Exps={CyclePosition(){return this._GetPhase()/(2*Math.PI)},Period(){return this._GetPeriod()},Magnitude(){return this._GetMagnitude_ConvertAngle()},Value(){return this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}};{"use strict";const e=self.C3;e.Behaviors.Orbit=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Orbit.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Orbit.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._acceleration=this._speed=0;this._isEnabled=!0;this._offsetAngle=this._majorAxis=this._minorAxis=0;this._matchRotation=!1;this._targetY=this._targetX=0;this._targetObject=null;this._targetUid=-1;this._totalAbsoluteRotation=this._totalRotation=this._rotation=0;a&&(this._speed=e.toRadians(a[0]),this._acceleration=e.toRadians(a[1]),this._isEnabled=a[6],this._minorAxis=a[2],
this._majorAxis=a[3],this._offsetAngle=e.toRadians(a[4]),this._matchRotation=a[5]);b=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)),e.Disposable.From(b,"afterload",c=>this._OnAfterLoad()));this._SetEnabled(this._isEnabled);b=this._inst.GetWorldInfo();this._targetX=b.GetX();this._targetY=b.GetY();this._rotation=b.GetAngle()}Release(){this._targetObject=null;super.Release()}SaveToJson(){return{s:this._speed,
a:this._acceleration,r:this._rotation,e:this._isEnabled,a1:this._majorAxis,a2:this._minorAxis,oa:this._offsetAngle,mr:this._matchRotation,tx:this._targetX,ty:this._targetY,tuid:this._targetObject?this._targetObject.GetUID():-1}}LoadFromJson(b){this._speed=b.s;this._acceleration=b.a;this._rotation=b.r;this._majorAxis=b.a1;this._minorAxis=b.a2;this._offsetAngle=b.oa;this._matchRotation=b.mr;this._targetX=b.tx;this._targetY=b.ty;this._targetUid=b.tuid;this._SetEnabled(b.e)}_OnAfterLoad(){-1===this._targetUid?
this._targetObject=null:(this._targetObject=this._runtime.GetInstanceByUID(this._targetUid),this._targetUid=-1)}_OnInstanceDestroyed(b){this._targetObject===b&&(this._targetObject=null)}_Initialise(){if(this._shouldInitialise){var b=this._inst.GetWorldInfo();this._targetX=b.GetX();this._targetY=b.GetY();this._rotation=b.GetAngle();this._shouldInitialise=!1}}_UpdateTarget(){if(this._targetObject){var b=this._targetObject.GetWorldInfo();this._targetX=b.GetX();this._targetY=b.GetY()}}_ShouldTickLate(){return!!this._targetObject}Tick(){this._TickInternal()}Tick2(){this._TickInternal()}_TickInternal(){if(this._isEnabled){var b=
this._runtime.GetDt(this._inst);if(0!==b){0!==this._acceleration&&(this._speed+=this._acceleration*b);var a=this._inst.GetWorldInfo();b*=this._speed;this._rotation=e.clampAngle(this._rotation+b);this._totalRotation+=b;this._totalAbsoluteRotation+=Math.abs(b);b=this._minorAxis*Math.cos(this._rotation);var c=this._majorAxis*Math.sin(this._rotation),d=Math.cos(this._offsetAngle),f=Math.sin(this._offsetAngle);this._UpdateTarget();a.SetXY(this._targetX+(b*d-c*f),this._targetY+(b*f+c*d));this._matchRotation&&
a.SetAngle(this._rotation+this._offsetAngle+.5*Math.PI);a.SetBboxChanged()}}}GetPropertyValueByIndex(b){switch(b){case 0:return e.toDegrees(this._speed);case 1:return e.toDegrees(this._acceleration);case 6:return this._isEnabled;case 2:return this._minorAxis;case 3:return this._majorAxis;case 4:return this._offsetAngle;case 5:return this._matchRotation}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._speed=e.toRadians(a);break;case 1:this._acceleration=e.toRadians(a);break;case 6:this._SetEnabled(a);
break;case 2:this._minorAxis=a;break;case 3:this._majorAxis=a;break;case 4:this._offsetAngle=a;break;case 5:this._matchRotation=a}}_SetEnabled(b){this._isEnabled=!!b;this._ShouldTickLate()?this._isEnabled?this._StartTicking2():this._StopTicking2():this._isEnabled?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.orbit.debugger.rotation",value:e.toDegrees(this._rotation)},{name:"behaviors.orbit.debugger.total-rotation",
value:e.toDegrees(this._totalRotation)},{name:"behaviors.orbit.debugger.total-absolute-rotation",value:e.toDegrees(this._totalAbsoluteRotation)},{name:"behaviors.orbit.properties.speed.name",value:e.toDegrees(this._speed),onedit:b=>this._speed=e.toRadians(b)},{name:"behaviors.orbit.properties.acceleration.name",value:e.toDegrees(this._acceleration),onedit:b=>this._acceleration=e.toRadians(b)},{name:"behaviors.orbit.properties.primary-axis.name",value:this._majorAxis,onedit:b=>this._majorAxis=b},{name:"behaviors.orbit.properties.secondary-axis.name",
value:this._minorAxis,onedit:b=>this._minorAxis=b},{name:"behaviors.orbit.properties.offset-angle.name",value:e.toDegrees(this._offsetAngle),onedit:b=>this._offsetAngle=e.toRadians(b)},{name:"behaviors.orbit.properties.match-rotation.name",value:this._matchRotation,onedit:b=>this._matchRotation=!!b},{name:"behaviors.orbit.properties.enabled.name",value:this._isEnabled,onedit:b=>this._SetEnabled(b)}]}]}}}"use strict";self.C3.Behaviors.Orbit.Cnds={IsEnabled(){return this._isEnabled}};
{"use strict";const e=self.C3;e.Behaviors.Orbit.Acts={SetSpeed(b){this._speed=e.toRadians(b)},SetTarget(b,a){this._targetObject=null;this._targetX=b;this._targetY=a},SetRotation(b){this._rotation=e.toRadians(b)},SetOffsetAngle(b){this._offsetAngle=e.toRadians(b)},SetRadius(b,a){this._minorAxis=b;this._majorAxis=a},SetMatchRotation(b){this._matchRotation=!!b},Pin(b){if(b&&(b=b.GetFirstPicked(this._inst))&&b.GetWorldInfo()){var a=this._isEnabled;a&&this._SetEnabled(!1);this._targetObject=b;a&&this._SetEnabled(!0)}},
Unpin(){const b=this._isEnabled;b&&this._SetEnabled(!1);this._targetObject=null;b&&this._SetEnabled(!0)},SetAcceleration(b){this._acceleration=e.toRadians(b)},SetEnabled(b){this._SetEnabled(b)},ResetTotalRotation(){this._totalAbsoluteRotation=this._totalRotation=0}}}
{"use strict";const e=self.C3;e.Behaviors.Orbit.Exps={Speed(){return e.toDegrees(this._speed)},Acceleration(){return e.toDegrees(this._acceleration)},PrimaryRadius(){return this._majorAxis},SecondaryRadius(){return this._minorAxis},OffsetAngle(){return e.toDegrees(this._offsetAngle)},Rotation(){return e.toDegrees(this._rotation)},TotalRotation(){return e.toDegrees(this._totalRotation)},TotalAbsoluteRotation(){return e.toDegrees(this._totalAbsoluteRotation)},TargetX(){return this._targetX},TargetY(){return this._targetY},
DistanceToTarget(){return Math.sqrt((this._minorAxis*Math.cos(this._rotation))**2+(this._majorAxis*Math.sin(this._rotation))**2)}}}{"use strict";const e=self.C3;e.Behaviors.Anchor=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Anchor.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Anchor.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._anchorTop=this._anchorLeft=2;this._anchorBottom=this._anchorRight=0;this._isEnabled=!0;b=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=b.getLeft();this._yTop=b.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()-b.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-b.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-b.getRight();
this._bDiff=this._runtime.GetOriginalViewportHeight()-b.getBottom();a&&(this._anchorLeft=a[0],this._anchorTop=a[1],this._anchorRight=a[2],this._anchorBottom=a[3],this._isEnabled=!!a[4]);a=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(a,"layoutchange",()=>this._OnLayoutChange()));this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{xl:this._xLeft,yt:this._yTop,xr:this._xRight,yb:this._yBottom,rd:this._rDiff,bd:this._bDiff,al:this._anchorLeft,
at:this._anchorTop,ar:this._anchorRight,ab:this._anchorBottom,e:this._isEnabled}}LoadFromJson(b){this._xLeft=b.xl;this._yTop=b.yt;this._xRight=b.xr;this._yBottom=b.yb;this._rDiff=b.rd;this._bDiff=b.bd;this._anchorLeft=b.al;this._anchorTop=b.at;this._anchorRight=b.ar;this._anchorBottom=b.ab;(this._isEnabled=b.e)?this._StartTicking():this._StopTicking()}_UpdatePosition(){if(this._isEnabled){var b=this._inst.GetWorldInfo(),a=b.GetLayer().GetViewport();if(0===this._anchorLeft){var c=a.getLeft()+this._xLeft-
b.GetBoundingBox().getLeft();0!==c&&(b.OffsetX(c),b.SetBboxChanged())}else 1===this._anchorLeft&&(c=a.getRight()-this._xRight-b.GetBoundingBox().getLeft(),0!==c&&(b.OffsetX(c),b.SetBboxChanged()));0===this._anchorTop?(c=a.getTop()+this._yTop-b.GetBoundingBox().getTop(),0!==c&&(b.OffsetY(c),b.SetBboxChanged())):1===this._anchorTop&&(c=a.getBottom()-this._yBottom-b.GetBoundingBox().getTop(),0!==c&&(b.OffsetY(c),b.SetBboxChanged()));1===this._anchorRight&&(c=a.getRight()-this._rDiff-b.GetBoundingBox().getRight(),
0!==c&&(b.OffsetX(b.GetOriginX()*c),b.SetWidth(Math.max(b.GetWidth()+c),0),b.SetBboxChanged(),this._rDiff=a.getRight()-b.GetBoundingBox().getRight()));1===this._anchorBottom&&(c=a.getBottom()-this._bDiff-b.GetBoundingBox().getBottom(),0!==c&&(b.OffsetY(b.GetOriginY()*c),b.SetHeight(Math.max(b.GetHeight()+c,0)),b.SetBboxChanged(),this._bDiff=a.getBottom()-b.GetBoundingBox().getBottom()))}}Tick(){this._UpdatePosition()}_OnLayoutChange(){this._UpdatePosition()}GetPropertyValueByIndex(b){switch(b){case 0:return this._anchorLeft;
case 1:return this._anchorTop;case 2:return this._anchorRight;case 3:return this._anchorBottom;case 4:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._anchorLeft=a;break;case 1:this._anchorTop=a;break;case 2:this._anchorRight=a;break;case 3:this._anchorBottom=a;break;case 4:(this._isEnabled=!!a)?this._StartTicking():this._StopTicking()}}}}"use strict";self.C3.Behaviors.Anchor.Cnds={IsEnabled(){return this._isEnabled}};"use strict";
self.C3.Behaviors.Anchor.Acts={SetEnabled(e){this._isEnabled&&0===e?(this._isEnabled=!1,this._StopTicking()):this._isEnabled||0===e||(e=this._inst.GetWorldInfo().GetBoundingBox(),this._xLeft=e.getLeft(),this._yTop=e.getTop(),this._xRight=this._runtime.GetOriginalViewportWidth()-e.getLeft(),this._yBottom=this._runtime.GetOriginalViewportHeight()-e.getTop(),this._rDiff=this._runtime.GetOriginalViewportWidth()-e.getRight(),this._bDiff=this._runtime.GetOriginalViewportHeight()-e.getBottom(),this._isEnabled=
!0,this._StartTicking())}};"use strict";self.C3.Behaviors.Anchor.Exps={};{"use strict";const e=self.C3;e.Behaviors.Flash=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Flash.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Flash.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._timeLeft=this._stageTimeLeft=this._stage=this._offTime=this._onTime=0;this._StartTicking()}Release(){super.Release()}SaveToJson(){return{on:this._onTime,off:this._offTime,s:this._stage,stl:this._stageTimeLeft,tl:this._timeLeft}}LoadFromJson(b){this._onTime=b.on;this._offTime=b.off;this._stage=b.s;this._stageTimeLeft=b.stl;this._timeLeft=null===b.tl?Infinity:b.tl}Tick(){if(!(0>=
this._timeLeft)){var b=this._runtime.GetDt(this._inst);this._timeLeft-=b;if(0>=this._timeLeft)return this._timeLeft=0,this._inst.GetWorldInfo().SetVisible(!0),this._runtime.UpdateRender(),this.DebugTrigger(e.Behaviors.Flash.Cnds.OnFlashEnded);this._stageTimeLeft-=b;0>=this._stageTimeLeft&&(0===this._stage?(this._inst.GetWorldInfo().SetVisible(!1),this._stage=1,this._stageTimeLeft+=this._offTime):(this._inst.GetWorldInfo().SetVisible(!0),this._stage=0,this._stageTimeLeft+=this._onTime),this._runtime.UpdateRender())}}GetDebuggerProperties(){return[{title:"$"+
this.GetBehaviorType().GetName(),properties:[{name:"behaviors.flash.debugger.on-time",value:this._onTime,onedit:b=>this._onTime=b},{name:"behaviors.flash.debugger.off-time",value:this._offTime,onedit:b=>this._offTime=b},{name:"behaviors.flash.debugger.is-flashing",value:0<this._timeLeft},{name:"behaviors.flash.debugger.time-left",value:this._timeLeft}]}]}}}"use strict";self.C3.Behaviors.Flash.Cnds={IsFlashing(){return 0<this._timeLeft},OnFlashEnded(){return!0}};"use strict";
self.C3.Behaviors.Flash.Acts={Flash(e,b,a){this._onTime=e;this._offTime=b;this._stage=1;this._stageTimeLeft=b;this._timeLeft=a;this._inst.GetWorldInfo().SetVisible(!1);this._runtime.UpdateRender()},StopFlashing(){this._timeLeft=0;this._inst.GetWorldInfo().SetVisible(!0);this._runtime.UpdateRender()}};"use strict";self.C3.Behaviors.Flash.Exps={};{"use strict";const e=self.C3;e.Behaviors.Pin=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Behaviors.Pin.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Pin.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._pinInst=null;this._pinUid=-1;this._mode="";this._propSet=new Set;this._lastKnownAngle=this._dz=this._dAngle=this._dHeight=this._dWidth=this._dy=this._dx=this._pinImagePoint=this._pinAngle=this._pinDist=0;this._destroy=!1;a&&(this._destroy=a[0]);b=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)),
e.Disposable.From(b,"afterload",c=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(b){b?(this._pinInst=b,this._StartTicking2()):(this._pinInst=null,this._StopTicking2())}_Pin(b,a,c){if(b&&(b=b.GetFirstPicked(this._inst)))if(this._mode=a,this._SetPinInst(b),a=this._inst.GetWorldInfo(),b=b.GetWorldInfo(),"properties"===this._mode){const d=this._propSet;d.clear();for(const f of c)d.add(f);this._dx=a.GetX()-b.GetX();this._dy=a.GetY()-b.GetY();this._dAngle=a.GetAngle()-b.GetAngle();
this._lastKnownAngle=a.GetAngle();this._dz=a.GetZElevation()-b.GetZElevation();d.has("x")&&d.has("y")&&(this._pinAngle=e.angleTo(b.GetX(),b.GetY(),a.GetX(),a.GetY())-b.GetAngle(),this._pinDist=e.distanceTo(b.GetX(),b.GetY(),a.GetX(),a.GetY()));d.has("width-abs")?this._dWidth=a.GetWidth()-b.GetWidth():d.has("width-scale")&&(this._dWidth=a.GetWidth()/b.GetWidth());d.has("height-abs")?this._dHeight=a.GetHeight()-b.GetHeight():d.has("height-scale")&&(this._dHeight=a.GetHeight()/b.GetHeight())}else this._pinDist=
e.distanceTo(b.GetX(),b.GetY(),a.GetX(),a.GetY())}SaveToJson(){const b=this._propSet,a=this._mode,c={uid:this._pinInst?this._pinInst.GetUID():-1,m:a,d:this._destroy};if("rope"===a||"bar"===a)c.pd=this._pinDist;else if("properties"===a){c.ps=[...this._propSet];b.has("imagepoint")?c.ip=this._pinImagePoint:b.has("x")&&b.has("y")?(c.pa=this._pinAngle,c.pd=this._pinDist):(b.has("x")&&(c.dx=this._dx),b.has("y")&&(c.dy=this._dy));b.has("angle")&&(c.da=this._dAngle,c.lka=this._lastKnownAngle);if(b.has("width-abs")||
b.has("width-scale"))c.dw=this._dWidth;if(b.has("height-abs")||b.has("height-scale"))c.dh=this._dHeight;b.has("z")&&(c.dz=this._dz)}return c}LoadFromJson(b){const a=b.m,c=this._propSet;c.clear();this._pinUid=b.uid;if("number"===typeof a)this._LoadFromJson_Legacy(b);else if(this._mode=a,b.hasOwnProperty("d")&&(this._destroy=!!b.d),"rope"===a||"bar"===a)this._pinDist=b.pd;else if("properties"===a){for(const d of b.ps)c.add(d);c.has("imagepoint")?this._pinImagePoint=b.ip:c.has("x")&&c.has("y")?(this._pinAngle=
b.pa,this._pinDist=b.pd):(c.has("x")&&(this._dx=b.dx),c.has("y")&&(this._dy=b.dy));c.has("angle")&&(this._dAngle=b.da,this._lastKnownAngle=b.lka||0);if(c.has("width-abs")||c.has("width-scale"))this._dWidth=b.dw;if(c.has("height-abs")||c.has("height-scale"))this._dHeight=b.dh;c.has("z")&&(this._dz=b.dz)}}_LoadFromJson_Legacy(b){const a=this._propSet,c=b.msa,d=b.tsa,f=b.pa,h=b.pd;switch(b.m){case 0:this._mode="properties";a.add("x").add("y").add("angle");this._pinAngle=f;this._pinDist=h;this._dAngle=
c-d;this._lastKnownAngle=b.lka;break;case 1:this._mode="properties";a.add("x").add("y");this._pinAngle=f;this._pinDist=h;break;case 2:this._mode="properties";a.add("angle");this._dAngle=c-d;this._lastKnownAngle=b.lka;break;case 3:this._mode="rope";this._pinDist=b.pd;break;case 4:this._mode="bar",this._pinDist=b.pd}}_OnAfterLoad(){-1===this._pinUid?this._SetPinInst(null):(this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid)),this._pinUid=-1)}_OnInstanceDestroyed(b){this._pinInst===b&&(this._SetPinInst(null),
this._destroy&&this._runtime.DestroyInstance(this._inst))}Tick2(){var b=this._pinInst;if(b){var a=b.GetWorldInfo(),c=this._inst.GetWorldInfo(),d=this._mode,f=!1;if("rope"===d||"bar"===d){if(b=e.distanceTo(c.GetX(),c.GetY(),a.GetX(),a.GetY()),b>this._pinDist||"bar"===d&&b<this._pinDist)f=e.angleTo(a.GetX(),a.GetY(),c.GetX(),c.GetY()),c.SetXY(a.GetX()+Math.cos(f)*this._pinDist,a.GetY()+Math.sin(f)*this._pinDist),f=!0}else{d=this._propSet;if(d.has("imagepoint")){const [h,g]=b.GetImagePoint(this._pinImagePoint);
c.EqualsXY(h,g)||(c.SetXY(h,g),f=!0)}else if(d.has("x")&&d.has("y")){b=a.GetX()+Math.cos(a.GetAngle()+this._pinAngle)*this._pinDist;const h=a.GetY()+Math.sin(a.GetAngle()+this._pinAngle)*this._pinDist;c.EqualsXY(b,h)||(c.SetXY(b,h),f=!0)}else b=a.GetX()+this._dx,d.has("x")&&b!==c.GetX()&&(c.SetX(b),f=!0),b=a.GetY()+this._dy,d.has("y")&&b!==c.GetY()&&(c.SetY(b),f=!0);d.has("angle")&&(this._lastKnownAngle!==c.GetAngle()&&(this._dAngle=e.clampAngle(this._dAngle+(c.GetAngle()-this._lastKnownAngle))),
b=e.clampAngle(a.GetAngle()+this._dAngle),b!==c.GetAngle()&&(c.SetAngle(b),f=!0),this._lastKnownAngle=c.GetAngle());d.has("width-abs")&&(b=a.GetWidth()+this._dWidth,b!==c.GetWidth()&&(c.SetWidth(b),f=!0));d.has("width-scale")&&(b=a.GetWidth()*this._dWidth,b!==c.GetWidth()&&(c.SetWidth(b),f=!0));d.has("height-abs")&&(b=a.GetHeight()+this._dHeight,b!==c.GetHeight()&&(c.SetHeight(b),f=!0));d.has("height-scale")&&(b=a.GetHeight()*this._dHeight,b!==c.GetHeight()&&(c.SetHeight(b),f=!0));d.has("z")&&(b=
a.GetZElevation()+this._dz,b!==c.GetZElevation()&&(c.SetZElevation(b),this._runtime.UpdateRender()))}f&&c.SetBboxChanged()}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.pin.debugger.is-pinned",value:!!this._pinInst},{name:"behaviors.pin.debugger.pinned-uid",value:this._pinInst?this._pinInst.GetUID():0}]}]}}}"use strict";self.C3.Behaviors.Pin.Cnds={IsPinned(){return!!this._pinInst},WillDestroy(){return this._destroy}};"use strict";
self.C3.Behaviors.Pin.Acts={PinByDistance(e,b){this._Pin(e,0===b?"rope":"bar")},PinByProperties(e,b,a,c,d,f,h){const g=[];b&&g.push("x");a&&g.push("y");c&&g.push("angle");h&&g.push("z");1===d?g.push("width-abs"):2===d&&g.push("width-scale");1===f?g.push("height-abs"):2===f&&g.push("height-scale");0!==g.length&&this._Pin(e,"properties",g)},PinByImagePoint(e,b,a,c,d,f){const h=["imagepoint"];a&&h.push("angle");f&&h.push("z");1===c?h.push("width-abs"):2===c&&h.push("width-scale");1===d?h.push("height-abs"):
2===d&&h.push("height-scale");this._pinImagePoint=b;this._Pin(e,"properties",h)},SetPinDistance(e){if("rope"===this._mode||"bar"===this._mode)this._pinDist=Math.max(e,0)},SetDestroy(e){this._destroy=e},Unpin(){this._SetPinInst(null);this._mode="";this._propSet.clear();this._pinImagePoint=""},Pin(e,b){switch(b){case 0:this._Pin(e,"properties",["x","y","angle"]);break;case 1:this._Pin(e,"properties",["x","y"]);break;case 2:this._Pin(e,"properties",["angle"]);break;case 3:this._Pin(e,"rope");break;case 4:this._Pin(e,
"bar")}}};"use strict";self.C3.Behaviors.Pin.Exps={PinnedUID(){return this._pinInst?this._pinInst.GetUID():-1}};{"use strict";const e=self.C3;e.Behaviors.EightDir=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.EightDir.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IBehaviorInstance;e.Behaviors.EightDir.Instance=class extends e.SDKBehaviorInstanceBase{constructor(f,h){super(f);this._simRight=this._simLeft=this._simDown=this._simUp=this._ignoreInput=this._rightKey=this._leftKey=this._downKey=this._upKey=!1;this._dy=this._dx=0;this._maxSpeed=200;this._acc=600;this._dec=500;this._angleMode=this._directions=3;this._isEnabled=this._defaultControls=!0;h&&(this._maxSpeed=h[0],this._acc=h[1],this._dec=h[2],this._directions=
h[3],this._angleMode=h[4],this._defaultControls=!!h[5],this._isEnabled=!!h[6]);this._isEnabled&&this._StartTicking();this._defaultControls&&this._BindEvents()}_BindEvents(){if(!this._disposables){var f=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(f,"keydown",h=>this._OnKeyDown(h.data)),e.Disposable.From(f,"keyup",h=>this._OnKeyUp(h.data)),e.Disposable.From(f,"window-blur",()=>this._OnWindowOrKeyboardBlur()),e.Disposable.From(f,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}}_UnBindEvents(){this._disposables&&
(this._disposables.Release(),this._disposables=null)}Release(){super.Release()}SaveToJson(){return{dx:this._dx,dy:this._dy,e:this._isEnabled,ms:this._maxSpeed,acc:this._acc,dec:this._dec,d:this._directions,am:this._angleMode,dc:this._defaultControls,ii:this._ignoreInput}}LoadFromJson(f){this._dx=f.dx;this._dy=f.dy;this._SetEnabled(f.e);this._maxSpeed=f.ms;this._acc=f.acc;this._dec=f.dec;this._directions=f.d;this._angleMode=f.am;this._defaultControls=f.dc;this._ignoreInput=f.ii;this._simRight=this._simLeft=
this._simDown=this._simUp=this._rightKey=this._leftKey=this._downKey=this._upKey=!1;this._defaultControls?this._BindEvents():this._UnBindEvents()}_OnKeyDown(f){switch(f.key){case "ArrowLeft":this._leftKey=!0;break;case "ArrowUp":this._upKey=!0;break;case "ArrowRight":this._rightKey=!0;break;case "ArrowDown":this._downKey=!0}}_OnKeyUp(f){switch(f.key){case "ArrowLeft":this._leftKey=!1;break;case "ArrowUp":this._upKey=!1;break;case "ArrowRight":this._rightKey=!1;break;case "ArrowDown":this._downKey=
!1}}_OnWindowOrKeyboardBlur(){this._rightKey=this._leftKey=this._downKey=this._upKey=!1}Tick(){var f=this._runtime.GetDt(this._inst);const h=this._runtime.GetCollisionEngine();var g=this._leftKey||this._simLeft,l=this._rightKey||this._simRight,m=this._upKey||this._simUp,u=this._downKey||this._simDown;this._simDown=this._simUp=this._simRight=this._simLeft=!1;if(this._isEnabled){var v=h.TestOverlapSolid(this._inst);if(v&&(h.RegisterCollision(this._inst,v),!h.PushOutSolidNearest(this._inst)))return;
this._ignoreInput&&(g=l=m=u=!1);0===this._directions?g=l=!1:1===this._directions&&(m=u=!1);2===this._directions&&(m||u)&&(g=l=!1);g===l&&(0>this._dx?this._dx=Math.min(this._dx+this._dec*f,0):0<this._dx&&(this._dx=Math.max(this._dx-this._dec*f,0)));m===u&&(0>this._dy?this._dy=Math.min(this._dy+this._dec*f,0):0<this._dy&&(this._dy=Math.max(this._dy-this._dec*f,0)));var t=v=0;g&&!l&&(v=0<this._dx?-(this._acc+this._dec):-this._acc);l&&!g&&(v=0>this._dx?this._acc+this._dec:this._acc);m&&!u&&(t=0<this._dy?
-(this._acc+this._dec):-this._acc);u&&!m&&(t=0>this._dy?this._acc+this._dec:this._acc);this._dx+=v*f;this._dy+=t*f;if(0!==this._dx||0!==this._dy){l=Math.atan2(this._dy,this._dx);g=this._maxSpeed*Math.cos(l);l=this._maxSpeed*Math.sin(l);Math.sqrt(this._dx*this._dx+this._dy*this._dy)>this._maxSpeed&&(this._dx=g,this._dy=l);var q=Math.abs(g)*f;u=Math.abs(l)*f;g=this._inst.GetWorldInfo();const p=g.GetX();m=g.GetY();l=g.GetAngle();q=e.clamp(this._dx*f+.5*v*f*f,-q,q);g.OffsetX(q);g.SetBboxChanged();if(v=
h.TestOverlapSolid(this._inst))h.PushOutSolid(this._inst,0>this._dx?1:-1,0,Math.max(Math.abs(Math.floor(q)),1))||(g.SetX(p),g.SetBboxChanged()),this._dx=0,h.RegisterCollision(this._inst,v);f=e.clamp(this._dy*f+.5*t*f*f,-u,u);g.OffsetY(f);g.SetBboxChanged();if(v=h.TestOverlapSolid(this._inst))h.PushOutSolid(this._inst,0,0>this._dy?1:-1,Math.max(Math.abs(Math.floor(f)),1))||(g.SetY(m),g.SetBboxChanged()),this._dy=0,h.RegisterCollision(this._inst,v);f=e.round6dp(this._dx);t=e.round6dp(this._dy);0===
f&&0===t||!this._inst.GetPlugin().IsRotatable()||(1===this._angleMode?g.SetAngle(e.toRadians(90*Math.round(e.toDegrees(Math.atan2(t,f))/90))):2===this._angleMode?g.SetAngle(e.toRadians(45*Math.round(e.toDegrees(Math.atan2(t,f))/45))):3===this._angleMode&&g.SetAngle(Math.atan2(t,f)));g.SetBboxChanged();g.GetAngle()!=l&&(v=h.TestOverlapSolid(this._inst))&&(g.SetAngle(l),g.SetBboxChanged(),h.RegisterCollision(this._inst,v))}}}GetPropertyValueByIndex(f){switch(f){case 0:return this._GetMaxSpeed();case 1:return this._GetAcceleration();
case 2:return this._GetDeceleration();case 3:return this._directions;case 4:return this._angleMode;case 5:return this._IsDefaultControls();case 6:return this._IsEnabled()}}SetPropertyValueByIndex(f,h){switch(f){case 0:this._SetMaxSpeed(h);break;case 1:this._SetAcceleration(h);break;case 2:this._SetDeceleration(h);break;case 3:this._directions=h;break;case 4:this._angleMode=h;break;case 5:this._SetDefaultControls(!!h);break;case 6:this._SetEnabled(!!h)}}_Stop(){this._dy=this._dx=0}_Reverse(){this._dx*=
-1;this._dy*=-1}_MaybeClampSpeed(){const f=Math.hypot(this._dx,this._dy);f>this._maxSpeed&&this._SetSpeed(f)}_SetSpeed(f){f=e.clamp(f,0,this._maxSpeed);const h=Math.atan2(this._dy,this._dx);this._dx=f*Math.cos(h);this._dy=f*Math.sin(h)}_GetSpeed(){return Math.hypot(this._dx,this._dy)}_SetMaxSpeed(f){this._maxSpeed=Math.max(f,0)}_GetMaxSpeed(){return this._maxSpeed}_SetAcceleration(f){this._acc=Math.max(f,0)}_GetAcceleration(){return this._acc}_SetDeceleration(f){this._dec=Math.max(f,0)}_GetDeceleration(){return this._dec}_GetMovingAngle(){return Math.atan2(this._dy,
this._dx)}_SetVectorX(f){this._dx=f;this._MaybeClampSpeed()}_GetVectorX(){return this._dx}_SetVectorY(f){this._dy=f;this._MaybeClampSpeed()}_GetVectorY(){return this._dy}_SimulateControl(f){if(this._isEnabled)switch(f){case 0:this._simLeft=!0;break;case 1:this._simRight=!0;break;case 2:this._simUp=!0;break;case 3:this._simDown=!0}}_SetDefaultControls(f){f=!!f;this._defaultControls!==f&&((this._defaultControls=f)?this._BindEvents():(this._UnBindEvents(),this._OnWindowOrKeyboardBlur()))}_IsDefaultControls(){return this._defaultControls}_SetIgnoreInput(f){this._ignoreInput=
!!f}_IsIgnoreInput(){return this._ignoreInput}_SetEnabled(f){(this._isEnabled=!!f)?this._StartTicking():(this._simDown=this._simUp=this._simRight=this._simLeft=!1,this._StopTicking())}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.eightdir.debugger.vector-x",value:this._GetVectorX(),onedit:f=>this._SetVectorX(f)},{name:"behaviors.eightdir.debugger.vector-y",value:this._GetVectorY(),onedit:f=>this._SetVectorY(f)},
{name:"behaviors.eightdir.debugger.speed",value:this._GetSpeed(),onedit:f=>this._SetSpeed(f)},{name:"behaviors.eightdir.debugger.angle-of-motion",value:e.toDegrees(this._GetMovingAngle())},{name:"behaviors.eightdir.properties.max-speed.name",value:this._GetMaxSpeed(),onedit:f=>this._SetMaxSpeed(f)},{name:"behaviors.eightdir.properties.acceleration.name",value:this._GetAcceleration(),onedit:f=>this._SetAcceleration(f)},{name:"behaviors.eightdir.properties.deceleration.name",value:this._GetDeceleration(),
onedit:f=>this._SetDeceleration(f)},{name:"behaviors.eightdir.properties.enabled.name",value:this._IsEnabled(),onedit:f=>this._SetEnabled(f)}]}]}GetScriptInterfaceClass(){return self.I8DirectionBehaviorInstance}};const c=new WeakMap,d=new Map([["left",0],["right",1],["up",2],["down",3]]);self.I8DirectionBehaviorInstance=class extends a{constructor(){super();c.set(this,a._GetInitInst().GetSdkInstance())}stop(){c.get(this)._Stop()}reverse(){c.get(this)._Reverse()}simulateControl(f){b.RequireString(f);
f=d.get(f);if("number"!==typeof f)throw Error("invalid control");c.get(this)._SimulateControl(f)}get speed(){return c.get(this)._GetSpeed()}set speed(f){b.RequireFiniteNumber(f);c.get(this)._SetSpeed(f)}get maxSpeed(){return c.get(this)._GetMaxSpeed()}set maxSpeed(f){b.RequireFiniteNumber(f);c.get(this)._SetMaxSpeed(f)}get acceleration(){return c.get(this)._GetAcceleration()}set acceleration(f){b.RequireFiniteNumber(f);c.get(this)._SetAcceleration(f)}get deceleration(){return c.get(this)._GetDeceleration()}set deceleration(f){b.RequireFiniteNumber(f);
c.get(this)._SetDeceleration(f)}get vectorX(){return c.get(this)._GetVectorX()}set vectorX(f){b.RequireFiniteNumber(f);c.get(this)._SetVectorX(f)}get vectorY(){return c.get(this)._GetVectorY()}set vectorY(f){b.RequireFiniteNumber(f);c.get(this)._SetVectorX(f)}get isDefaultControls(){return c.get(this)._IsDefaultControls()}set isDefaultControls(f){c.get(this)._SetDefaultControls(!!f)}get isIgnoringInput(){return c.get(this)._IsIgnoreInput()}set isIgnoringInput(f){c.get(this)._SetIgnoreInput(!!f)}get isEnabled(){return c.get(this)._IsEnabled()}set isEnabled(f){c.get(this)._SetEnabled(!!f)}}}
{"use strict";const e=self.C3;e.Behaviors.EightDir.Cnds={IsMoving(){return 1E-10<this._GetSpeed()},CompareSpeed(b,a){return e.compare(this._GetSpeed(),b,a)},IsEnabled(){return this._IsEnabled()}}}"use strict";
self.C3.Behaviors.EightDir.Acts={Stop(){this._Stop()},Reverse(){this._Reverse()},SetIgnoreInput(e){this._SetIgnoreInput(e)},SetSpeed(e){this._SetSpeed(e)},SetMaxSpeed(e){this._SetMaxSpeed(e)},SetAcceleration(e){this._SetAcceleration(e)},SetDeceleration(e){this._SetDeceleration(e)},SimulateControl(e){this._SimulateControl(e)},SetEnabled(e){this._SetEnabled(e)},SetVectorX(e){this._SetVectorX(e)},SetVectorY(e){this._SetVectorY(e)},SetDefaultControls(e){this._SetDefaultControls(!!e)}};
{"use strict";const e=self.C3;e.Behaviors.EightDir.Exps={Speed(){return this._GetSpeed()},MaxSpeed(){return this._GetMaxSpeed()},Acceleration(){return this._GetAcceleration()},Deceleration(){return this._GetDeceleration()},MovingAngle(){return e.toDegrees(this._GetMovingAngle())},VectorX(){return this._GetVectorX()},VectorY(){return this._GetVectorY()}}}
{"use strict";const e=self.C3;e.Behaviors.scrollto=class extends e.SDKBehaviorBase{constructor(b){super(b);this._shakeMode=this._shakeEnd=this._shakeStart=this._shakeMag=0}Release(){super.Release()}SetShakeMagnitude(b){this._shakeMag=b}GetShakeMagnitude(){return this._shakeMag}SetShakeStart(b){this._shakeStart=b}GetShakeStart(){return this._shakeStart}SetShakeEnd(b){this._shakeEnd=b}GetShakeEnd(){return this._shakeEnd}SetShakeMode(b){this._shakeMode=b}GetShakeMode(){return this._shakeMode}}}
{"use strict";const e=self.C3;e.Behaviors.scrollto.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.scrollto.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._isEnabled=!0;a&&(this._isEnabled=a[0]);this._isEnabled&&this._StartTicking2()}Release(){super.Release()}SaveToJson(){const b=this.GetBehavior();return{e:this._isEnabled,smg:b.GetShakeMagnitude(),ss:b.GetShakeStart(),se:b.GetShakeEnd(),smd:b.GetShakeMode()}}LoadFromJson(b){const a=this.GetBehavior();a.SetShakeMagnitude(b.smg);a.SetShakeStart(b.ss);a.SetShakeEnd(b.se);
a.SetShakeMode(b.smd);(this._isEnabled=b.e)?this._StartTicking2():this._StopTicking2()}IsEnabled(){return this._isEnabled}Tick2(){if(this.IsEnabled()){this._runtime.GetDt(this._inst);var b=this.GetBehavior(),a=b.GetInstances(),c=0,d=0,f=0;for(var h of a)(a=h.GetBehaviorInstanceFromCtor(e.Behaviors.scrollto))&&a.GetSdkInstance().IsEnabled()&&(a=h.GetWorldInfo(),c+=a.GetX(),d+=a.GetY(),++f);h=this._inst.GetWorldInfo().GetLayout();var g=this._runtime.GetGameTime(),l=a=0;g>=b.GetShakeStart()&&g<b.GetShakeEnd()&&
(a=b.GetShakeMagnitude()*Math.min(this._runtime.GetTimeScale(),1),0===b.GetShakeMode()&&(a*=1-(g-b.GetShakeStart())/(b.GetShakeEnd()-b.GetShakeStart())),b=this._runtime.Random()*Math.PI*2,g=this._runtime.Random()*a,a=Math.cos(b)*g,l=Math.sin(b)*g);h.SetScrollX(c/f+a);h.SetScrollY(d/f+l)}}GetPropertyValueByIndex(b){switch(b){case 0:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:(this._isEnabled=!!a)?this._StartTicking2():this._StopTicking2()}}}}"use strict";
self.C3.Behaviors.scrollto.Cnds={IsEnabled(){return this._isEnabled}};"use strict";self.C3.Behaviors.scrollto.Acts={Shake(e,b,a){const c=this.GetBehavior();c.SetShakeMagnitude(e);c.SetShakeStart(this._runtime.GetGameTime());c.SetShakeEnd(this._runtime.GetGameTime()+b);c.SetShakeMode(a)},SetEnabled(e){(this._isEnabled=0!==e)?this._StartTicking2():this._StopTicking2()}};"use strict";self.C3.Behaviors.scrollto.Exps={};{"use strict";const e=self.C3;e.Behaviors.Fade=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Behaviors.Fade.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Fade.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._fadeOutTime=this._waitTime=this._fadeInTime=0;this._activeAtStart=this._destroy=!0;this._setMaxOpacity=!1;this._stage=0;this._stageTime=e.New(e.KahanSum);this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1;a&&(this._fadeInTime=a[0],this._waitTime=a[1],this._fadeOutTime=a[2],this._destroy=!!a[3],this._stage=(this._activeAtStart=!!a[4])?0:3);this._activeAtStart&&(0===
this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender()));this._StartTicking()}Release(){super.Release()}SaveToJson(){return{fit:this._fadeInTime,wt:this._waitTime,fot:this._fadeOutTime,d:this._destroy,s:this._stage,st:this._stageTime.Get(),mo:this._maxOpacity}}LoadFromJson(b){this._fadeInTime=b.fit;this._waitTime=b.wt;this._fadeOutTime=b.fot;this._destroy=b.d;this._stage=b.s;this._stageTime.Set(b.st);this._maxOpacity=
b.mo}Tick(){var b=this._runtime.GetDt(this._inst);this._stageTime.Add(b);b=this._inst.GetWorldInfo();0===this._stage&&(b.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity),this._runtime.UpdateRender(),b.GetOpacity()>=this._maxOpacity&&(b.SetOpacity(this._maxOpacity),this._stage=1,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnFadeInEnd)));1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnWaitEnd));
2===this._stage&&0!==this._fadeOutTime&&(b.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity),this._runtime.UpdateRender(),0>=b.GetOpacity()&&(this._stage=3,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnFadeOutEnd),this._destroy&&this._runtime.DestroyInstance(this._inst)))}Start(){this._stage=0;this._stageTime.Reset();0===this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender())}GetPropertyValueByIndex(b){switch(b){case 0:return this._fadeInTime;
case 1:return this._waitTime;case 2:return this._fadeOutTime;case 3:return this._destroy}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._fadeInTime=a;break;case 1:this._waitTime=a;break;case 2:this._fadeOutTime=a;break;case 3:this._destroy=!!a}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.fade.properties.fade-in-time.name",value:this._fadeInTime,onedit:b=>this._fadeInTime=b},{name:"behaviors.fade.properties.wait-time.name",value:this._waitTime,
onedit:b=>this._waitTime=b},{name:"behaviors.fade.properties.fade-out-time.name",value:this._fadeOutTime,onedit:b=>this._fadeOutTime=b},{name:"behaviors.fade.debugger.stage",value:["behaviors.fade.debugger."+["fade-in","wait","fade-out","done"][this._stage]]}]}]}}}"use strict";self.C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return!0},OnFadeInEnd(){return!0},OnWaitEnd(){return!0}};"use strict";
self.C3.Behaviors.Fade.Acts={StartFade(){this._activeAtStart||this._setMaxOpacity||(this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1,this._setMaxOpacity=!0);3===this._stage&&this.Start()},RestartFade(){this.Start()},SetFadeInTime(e){0>e&&(e=0);this._fadeInTime=e},SetWaitTime(e){0>e&&(e=0);this._waitTime=e},SetFadeOutTime(e){0>e&&(e=0);this._fadeOutTime=e}};"use strict";self.C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}};
{const e=self.C3;self.C3_GetObjectRefTable=function(){return[e.Plugins.Sprite,e.Behaviors.Tween,e.Behaviors.Rotate,e.Behaviors.TileMovement,e.Behaviors.destroy,e.Behaviors.Bullet,e.Behaviors.LOS,e.Behaviors.solid,e.Plugins.NinePatch,e.Plugins.Text,e.Behaviors.Sin,e.Behaviors.Orbit,e.Plugins.Spritefont2,e.Behaviors.Anchor,e.Behaviors.Flash,e.Behaviors.Pin,e.Behaviors.EightDir,e.Plugins.Tilemap,e.Plugins.Keyboard,e.Plugins.Touch,e.Plugins.gamepad,e.Plugins.Audio,e.Behaviors.scrollto,e.Plugins.TiledBg,
e.Behaviors.Fade,e.Plugins.TextBox,e.Plugins.NodeWebkit,e.Plugins.PlatformInfo,e.Plugins.Browser,e.Plugins.LocalStorage,e.Plugins.System.Cnds.IsGroupActive,e.Plugins.System.Cnds.CompareVar,e.Plugins.gamepad.Cnds.OnButtonDown,e.Plugins.Keyboard.Cnds.OnKey,e.Behaviors.Sin.Acts.SetEnabled,e.Plugins.System.Acts.AddVar,e.Plugins.System.Cnds.TriggerOnce,e.Plugins.Text.Acts.SetText,e.Plugins.Audio.Acts.Play,e.Plugins.Audio.Acts.StopAll,e.Plugins.System.Acts.SetTimescale,e.Plugins.System.Acts.SetVar,e.Plugins.System.Acts.GoToLayout,
e.Plugins.System.Acts.Wait,e.Plugins.System.Acts.SetObjectTimescale,e.Plugins.Text.Acts.SetVisible,e.Plugins.Audio.Acts.SetPaused,e.Plugins.System.Cnds.EveryTick,e.Plugins.Sprite.Acts.SetPos,e.Plugins.Sprite.Exps.X,e.Plugins.Sprite.Exps.Y,e.Plugins.System.Acts.SetLayerAngle,e.Plugins.System.Exps.layerangle,e.Plugins.Sprite.Acts.SetAngle,e.Plugins.Sprite.Exps.Angle,e.Plugins.System.Cnds.OnLayoutStart,e.Plugins.Sprite.Acts.SetVisible,e.Plugins.System.Cnds.Compare,e.Plugins.System.Exps.layoutname,e.Plugins.Spritefont2.Acts.SetInstanceVar,
e.Behaviors.Flash.Cnds.IsFlashing,e.Behaviors.Flash.Acts.Flash,e.Plugins.Keyboard.Cnds.OnAnyKey,e.Plugins.Touch.Cnds.OnTouchStart,e.Behaviors.Flash.Acts.StopFlashing,e.Plugins.Sprite.Cnds.IsOnScreen,e.Behaviors.Sin.Exps.Value,e.Plugins.Spritefont2.Acts.SetText,e.Behaviors.TileMovement.Acts.SetEnabled,e.Plugins.Spritefont2.Cnds.CompareInstanceVar,e.Plugins.Spritefont2.Acts.AppendText,e.Plugins.System.Cnds.Every,e.Plugins.Spritefont2.Acts.SubInstanceVar,e.Plugins.Sprite.Cnds.OnCreated,e.Plugins.Sprite.Acts.SetAnim,
e.Plugins.Sprite.Acts.SetZElevation,e.Plugins.Sprite.Acts.SetSize,e.Behaviors.TileMovement.Cnds.IsMoving,e.Plugins.Sprite.Cnds.IsOverlapping,e.Plugins.Audio.Acts.Stop,e.Plugins.Sprite.Cnds.OnCollision,e.Plugins.TiledBg.Acts.SetVisible,e.Behaviors.Fade.Acts.StartFade,e.Plugins.Audio.Cnds.IsTagPlaying,e.Plugins.System.Acts.CreateObject,e.Behaviors.Tween.Acts.TweenOneProperty,e.Plugins.Sprite.Acts.RotateClockwise,e.Plugins.TiledBg.Acts.SetPos,e.Plugins.Sprite.Cnds.CompareInstanceVar,e.Plugins.Sprite.Cnds.IsAnimPlaying,
e.Plugins.Spritefont2.Acts.AddInstanceVar,e.Plugins.LocalStorage.Acts.SetItem,e.Plugins.NinePatch.Cnds.IsVisible,e.Plugins.Sprite.Exps.Width,e.Plugins.Sprite.Acts.AddInstanceVar,e.Plugins.Sprite.Acts.SetScale,e.Plugins.Sprite.Cnds.CompareWidth,e.Behaviors.scrollto.Acts.Shake,e.Plugins.Sprite.Acts.Destroy,e.Plugins.Sprite.Acts.MoveAtAngle,e.Behaviors.TileMovement.Acts.SimulateControl,e.Plugins.Touch.Cnds.CompareTouchSpeed,e.Plugins.System.Cnds.CompareBetween,e.Plugins.Touch.Exps.AngleAt,e.Plugins.Touch.Cnds.OnNthTouchEnd,
e.Plugins.Keyboard.Cnds.OnKeyReleased,e.Plugins.gamepad.Cnds.OnButtonUp,e.Behaviors.LOS.Acts.AddObstacle,e.Plugins.Sprite.Acts.SetInstanceVar,e.Plugins.Sprite.Cnds.PickInstVarHiLow,e.Plugins.Sprite.Acts.MoveForward,e.Behaviors.LOS.Cnds.HasLOSToObject,e.Plugins.Sprite.Acts.SetAnimSpeed,e.Plugins.Sprite.Cnds.CompareX,e.Plugins.Sprite.Cnds.CompareY,e.Behaviors.Tween.Acts.TweenTwoProperties,e.Plugins.Sprite.Acts.Spawn,e.Behaviors.Bullet.Acts.SetAngleOfMotion,e.Plugins.Sprite.Cnds.IsVisible,e.Behaviors.TileMovement.Cnds.IsMovingDirection,
e.Plugins.Sprite.Cnds.IsOverlappingOffset,e.Behaviors.EightDir.Acts.SetIgnoreInput,e.Behaviors.TileMovement.Acts.SetIgnoreInput,e.Plugins.System.Acts.SubVar,e.Plugins.NinePatch.Acts.SetVisible,e.Plugins.Spritefont2.Acts.SetVisible,e.Behaviors.solid.Acts.SetEnabled,e.Plugins.System.Exps.choose,e.Plugins.LocalStorage.Acts.CheckItemExists,e.Plugins.LocalStorage.Cnds.OnItemMissing,e.Plugins.LocalStorage.Cnds.OnItemExists,e.Plugins.LocalStorage.Exps.ItemValue,e.Behaviors.Pin.Acts.Pin,e.Plugins.Audio.Cnds.OnEnded,
e.Behaviors.Pin.Acts.Unpin,e.Plugins.Text.Acts.TypewriterText,e.Plugins.Text.Cnds.OnTypewriterTextFinished,e.Plugins.Audio.Acts.FadeVolume,e.Plugins.Sprite.Acts.SetX,e.Plugins.System.Acts.WaitForPreviousActions,e.Plugins.Keyboard.Cnds.IsKeyDown,e.Plugins.Touch.Cnds.IsInTouch,e.Plugins.gamepad.Cnds.IsButtonDown,e.Plugins.Touch.Cnds.OnTouchEnd,e.Plugins.TextBox.Acts.SetMaxLength,e.Plugins.TextBox.Acts.SetCSSStyle,e.Plugins.TextBox.Acts.SetPlaceholder,e.Plugins.TextBox.Cnds.IsFocused,e.Plugins.TextBox.Acts.SetText,
e.Behaviors.Orbit.Acts.Pin,e.Behaviors.Orbit.Acts.SetEnabled,e.Plugins.Text.Acts.Destroy,e.Behaviors.EightDir.Acts.SetEnabled,e.Plugins.Sprite.Cnds.IsOutsideLayout,e.Plugins.gamepad.Cnds.OnAnyButtonDown,e.Behaviors.EightDir.Acts.SimulateControl,e.Plugins.Touch.Cnds.OnTouchObject,e.Plugins.Sprite.Acts.RotateTowardAngle,e.Plugins.Touch.Cnds.IsTouchingObject,e.Plugins.System.Acts.GoToLayoutByName,e.Plugins.Sprite.Acts.MoveToTop,e.Behaviors.Fade.Acts.SetFadeInTime,e.Behaviors.Fade.Acts.SetFadeOutTime,
e.Plugins.TextBox.Acts.SetVisible,e.Plugins.TextBox.Cnds.IsVisible,e.Behaviors.Tween.Acts.StopTweens,e.Behaviors.EightDir.Acts.SetMaxSpeed,e.Behaviors.EightDir.Acts.SetAcceleration,e.Plugins.Sprite.Acts.StopAnim,e.Plugins.Text.Acts.SetFontColor,e.Plugins.Sprite.Acts.SetY,e.Plugins.Audio.Cnds.OnFadeEnded]};self.C3_JsPropNameTable=[{BGApple1:0},{BGBanana1:0},{BGCherry:0},{BGFrenchHorn:0},{BGGrapes:0},{BGOrange:0},{BGPapaya:0},{BGPineapple:0},{BGSaxophone:0},{BGStrawberry:0},{BGTrombone:0},{BGTrumpet:0},
{BGTuba:0},{BGWatermelonSlice:0},{Tween:0},{BGApple2:0},{BGTrumpet2:0},{BGBeret1:0},{BGBeret2:0},{BGBroccoli:0},{BGCarrot1:0},{BGCarrot2:0},{BGCauliflower:0},{BGCroissant1:0},{BGCroissant2:0},{BGCucumber:0},{BGMushrooms:0},{BGOnion:0},{BGPepper1:0},{BGPeppers2:0},{BGPotato1:0},{BGPotato2:0},{BGTomato:0},{BGWine1:0},{BGWine2:0},{BGFranceTower:0},{BGTrashCan1:0},{BGTrashCan2:0},{BGTrashCan3:0},{BGTrashCan4:0},{BGTrashCan5:0},{BGTrashCan6:0},{BGKittens1:0},{BGKittens2:0},{BGKittens3:0},{BGKittens4:0},
{BGKittens5:0},{BGKittens6:0},{BGKittens7:0},{BGKittens8:0},{BGKittens9:0},{BGBrain1:0},{BGBrain2:0},{BGBrain3:0},{BGBrain4:0},{BGBrain5:0},{BGBrain6:0},{BGMuffin1:0},{BGMuffin5:0},{BGMuffin6:0},{BGMuffin7:0},{BGMuffin8:0},{BGMuffin9:0},{BGMuffin10:0},{BGMuffin11:0},{BGMuffin12:0},{BGMuffin13:0},{BGMuffin2:0},{BGMuffin3:0},{BGMuffin4:0},{Rotate:0},{BGBlackHole:0},{ScaleRate:0},{SelfPositionX:0},{SelfPositionY:0},{LifeStatus:0},{TileMovement:0},{SeeMonkey:0},{PukeBucket:0},{DestroyOutsideLayout:0},
{Bullet:0},{PukeBullet:0},{SizeStatus:0},{GrowTimer:0},{GarbageCat:0},{ChaseMode:0},{MegDistance:0},{LineOfSight:0},{MuffinMen:0},{ButtonLetterA:0},{ButtonLetterB:0},{ButtonLetterC:0},{Solid:0},{GateLock:0},{ButtonSimpleLock:0},{GateblockSimpleLock:0},{ButtonSimpleFloor:0},{FloorDisappearing:0},{TeleportPad1:0},{Teleporter1:0},{Teleporter2:0},{Teleporter3:0},{Teleporter4:0},{TeleportPad2:0},{TeleportPad3:0},{TeleportPad4:0},{Teleporter0:0},{TeleportPad0:0},{Teleporter5:0},{TeleportPad5:0},{SpeechBubble:0},
{IntroFont:0},{SpeechBubbleArrow:0},{Sine:0},{GenieLamp:0},{GenieSimmons:0},{IntroAdditionalFont:0},{ExtraFont:0},{Orbit:0},{LevelSelectButton1:0},{LevelSelectButton10:0},{LevelSelectButton11:0},{LevelSelectButton12:0},{LevelSelectButton2:0},{LevelSelectButton3:0},{LevelSelectButton4:0},{LevelSelectButton5:0},{LevelSelectButton6:0},{LevelSelectButton7:0},{LevelSelectButton8:0},{LevelSelectButton9:0},{LevelSelectButtonVC:0},{LevelSelectButtonVCDead:0},{Timer:0},{Anchor:0},{Flash:0},{TimerFont:0},{LevelSelectFontDiamond:0},
{LevelSelectFontTimerTotal:0},{LevelSelectFontTitle:0},{LevelSelectFontScore:0},{SpecialCondition:0},{GraffitiFont:0},{Identifier:0},{BlackboardFont:0},{HurtBlockFall:0},{SolidBlock:0},{Pin:0},{"8Direction":0},{PreciousMeg:0},{Tilemap1TootyFruity:0},{CompassDudeNorth:0},{Keyboard:0},{Touch:0},{Gamepad:0},{Audio:0},{Diamond:0},{BlackboardTile:0},{CompanyCard:0},{TilemapShadows:0},{TitleCard:0},{ScrollTo:0},{Camera:0},{CheckpointFlag:0},{ColourPalette:0},{PreciousMegTitle:0},{Tilemap2TresVeggie:0},
{Fade:0},{BlackoutTiles:0},{DiamondType:0},{CollectStatus:0},{DiamondHUD:0},{Winzone:0},{LevelSelectStartButton:0},{CounterDiamond:0},{CounterTimer:0},{Tilemap3LitterKitties:0},{PassengerStatus:0},{Direction:0},{GarbageCannon:0},{GarbageCatLanding:0},{Sine2:0},{LogoSplash:0},{TextInput:0},{NWjs:0},{PlatformInfo:0},{Browser:0},{Tilemap4BrainMuffin:0},{PushBlock:0},{Tilemap5ViciousCircle:0},{LocalStorage:0},{LevelSelectTiledBG:0},{BlackoutTiles2:0},{ClosingExitBad:0},{ClosingExitGood:0},{CreditsText:0},
{ExitSign:0},{Enemy:0},{LevelSelectButtons:0},{TeleporterPadFamily:0},{WinState:0},{MoveStatus:0},{DiamondCount:0},{RandomizerInt:0},{CodeCounter:0},{SimpleLockCounter:0},{FloorDisappearingCounter:0},{GemCollectCheck:0},{PauseState:0},{PreIntroSetup:0},{IntroTextCounter:0},{IntroSkipCounter:0},{DiamondLevel1:0},{CitrineLevel1:0},{EmeraldLevel1:0},{RubyLevel1:0},{SapphireLevel1:0},{DiamondLevel2:0},{CitrineLevel2:0},{EmeraldLevel2:0},{RubyLevel2:0},{SapphireLevel2:0},{DiamondLevel3:0},{CitrineLevel3:0},
{EmeraldLevel3:0},{RubyLevel3:0},{SapphireLevel3:0},{DiamondLevel4:0},{CitrineLevel4:0},{EmeraldLevel4:0},{RubyLevel4:0},{SapphireLevel4:0},{DiamondLevel5:0},{CitrineLevel5:0},{EmeraldLevel5:0},{RubyLevel5:0},{SapphireLevel5:0},{DiamondLevel6:0},{CitrineLevel6:0},{EmeraldLevel6:0},{RubyLevel6:0},{SapphireLevel6:0},{DiamondLevel7:0},{CitrineLevel7:0},{EmeraldLevel7:0},{RubyLevel7:0},{SapphireLevel7:0},{DiamondLevel8:0},{CitrineLevel8:0},{EmeraldLevel8:0},{RubyLevel8:0},{SapphireLevel8:0},{DiamondLevel9:0},
{CitrineLevel9:0},{EmeraldLevel9:0},{RubyLevel9:0},{SapphireLevel9:0},{DiamondLevel10:0},{CitrineLevel10:0},{EmeraldLevel10:0},{RubyLevel10:0},{SapphireLevel10:0},{DiamondLevel11:0},{CitrineLevel11:0},{EmeraldLevel11:0},{RubyLevel11:0},{SapphireLevel11:0},{DiamondLevel12:0},{CitrineLevel12:0},{EmeraldLevel12:0},{RubyLevel12:0},{SapphireLevel12:0},{LevelSelectState:0},{HighScoreLevel1:0},{HighScoreLevel2:0},{HighScoreLevel3:0},{HighScoreLevel4:0},{HighScoreLevel5:0},{HighScoreLevel6:0},{HighScoreLevel7:0},
{HighScoreLevel8:0},{HighScoreLevel9:0},{HighScoreLevel10:0},{HighScoreLevel11:0},{HighScoreLevel12:0},{LevelSelectProgress:0},{TotalHighScore:0},{TotalDiamondCount:0},{LevelSelectControl:0},{CreditsScreenStatus:0}]}
{const e=self.C3;self.C3_ExpressionFuncs=[()=>"Overall",()=>"Pause Function",()=>"Exit Function",()=>"Off",()=>"On",()=>0,()=>1,()=>"[outline=#ffffff]PRESS B TO QUIT[/outline]",()=>"[outline=#ffffff]PRESS B TO QUIT?[/outline]",()=>"",()=>2,()=>"[outline=#ffffff]PRESS B TO QUIT?![/outline]",()=>3,()=>.05,()=>"Action Music",()=>.1,()=>"Camera Function",()=>"Start",b=>{const a=b._GetNode(0);return()=>a.ExpObject()},()=>"Reset",b=>{const a=b._GetNode(0),c=b._GetNode(1);return()=>e.lerp(a.ExpObject(),
c.ExpObject(),.1)},()=>"Teleport",()=>"Tile Layer",b=>{const a=b._GetNode(0).GetBoundMethod();return()=>e.lerp(a("Tile Layer"),0,.1)},()=>"Block Layer",b=>{const a=b._GetNode(0).GetBoundMethod();return()=>e.lerp(a("Block Layer"),0,.1)},()=>"Main Layer",b=>{const a=b._GetNode(0).GetBoundMethod();return()=>e.lerp(a("Main Layer"),0,.1)},()=>"Shadow Layer",b=>{const a=b._GetNode(0).GetBoundMethod();return()=>e.lerp(a("Shadow Layer"),0,.1)},()=>"Background Layer",b=>{const a=b._GetNode(0).GetBoundMethod();
return()=>e.lerp(a("Background Layer"),0,.1)},b=>{const a=b._GetNode(0);return()=>e.lerp(a.ExpObject(),0,.1)},b=>{const a=b._GetNode(0).GetBoundMethod();return()=>a()},()=>"TootyFruity Zone 1",()=>69,()=>"TootyFruity Zone 2",()=>80,()=>"TootyFruity Zone 3",()=>115,()=>"TresVeggie Zone 1",()=>99,()=>"TresVeggie Zone 2",()=>90,()=>"TresVeggie Zone 3",()=>150,()=>"LitterKitties Zone 1",()=>111,()=>"LitterKitties Zone 2",()=>120,()=>"LitterKitties Zone 3",()=>128,()=>"BrainMuffins Zone 1",()=>101,()=>
"BrainMuffins Zone 2",()=>135,()=>"BrainMuffins Zone 3",()=>200,()=>.2,()=>-5,()=>"ViciousCircle Zone",b=>{const a=b._GetNode(0);return()=>a.ExpBehavior()},b=>{const a=b._GetNode(0);return()=>-a.ExpBehavior()},()=>"???",()=>10,b=>{const a=b._GetNode(0);return()=>a.ExpInstVar()},()=>100,()=>1E3,()=>"MainWalkCuffs",()=>50,()=>16,()=>"Win State",()=>.5,()=>-10,()=>"Level Complete",()=>"WinnerDanceCuffs",()=>4.4,b=>{const a=b._GetNode(0);return()=>a.ExpObject()+300},()=>"Idle",()=>"LastLevelSlide",b=>
{const a=b._GetNode(0);return()=>a.ExpObject()+50},()=>4.5,()=>"Magic",()=>20,()=>4,()=>"Sting",()=>"Diamond",()=>"EmptyEnd",()=>5,()=>.4,()=>"DiamondLevel1",()=>"DiamondLevel2",()=>"DiamondLevel3",()=>"DiamondLevel4",()=>"DiamondLevel5",()=>"DiamondLevel6",()=>"DiamondLevel7",()=>"DiamondLevel8",()=>"DiamondLevel9",()=>"DiamondLevel10",()=>"DiamondLevel11",()=>"DiamondLevel12",()=>"Empty",()=>"Citrine",()=>"CitrineLevel1",()=>"CitrineLevel2",()=>"CitrineLevel3",()=>"CitrineLevel4",()=>"CitrineLevel5",
()=>"CitrineLevel6",()=>"CitrineLevel7",()=>"CitrineLevel8",()=>"CitrineLevel9",()=>"CitrineLevel10",()=>"CitrineLevel11",()=>"CitrineLevel12",()=>"Emerald",()=>"EmeraldLevel1",()=>"EmeraldLevel2",()=>"EmeraldLevel3",()=>"EmeraldLevel4",()=>"EmeraldLevel5",()=>"EmeraldLevel6",()=>"EmeraldLevel7",()=>"EmeraldLevel8",()=>"EmeraldLevel9",()=>"EmeraldLevel10",()=>"EmeraldLevel11",()=>"EmeraldLevel12",()=>"Ruby",()=>"RubyLevel1",()=>"RubyLevel2",()=>"RubyLevel3",()=>"RubyLevel4",()=>"RubyLevel5",()=>"RubyLevel6",
()=>"RubyLevel7",()=>"RubyLevel8",()=>"RubyLevel9",()=>"RubyLevel10",()=>"RubyLevel11",()=>"RubyLevel12",()=>"Sapphire",()=>"SapphireLevel1",()=>"SapphireLevel2",()=>"SapphireLevel3",()=>"SapphireLevel4",()=>"SapphireLevel5",()=>"SapphireLevel6",()=>"SapphireLevel7",()=>"SapphireLevel8",()=>"SapphireLevel9",()=>"SapphireLevel10",()=>"SapphireLevel11",()=>"SapphireLevel12",()=>6,()=>"LevelSelectProgress",b=>{const a=b._GetNode(0).GetVar();return()=>a.GetValue()},()=>"HighScoreLevel1",()=>7,()=>"HighScoreLevel2",
()=>"HighScoreLevel3",()=>"HighScoreLevel4",()=>"HighScoreLevel5",()=>"HighScoreLevel6",()=>"HighScoreLevel7",()=>8,()=>"HighScoreLevel8",()=>9,()=>"HighScoreLevel9",()=>"HighScoreLevel10",()=>11,()=>"HighScoreLevel11",()=>12,()=>"HighScoreLevel12",()=>"Lose State / Reset",()=>"UpShoot",()=>"DownShoot",()=>"LeftShoot",()=>"RightShoot",()=>"BigSurpriseCuffs",()=>"LoseFall",b=>{const a=b._GetNode(0);return()=>1-a.ExpInstVar()},()=>1.5,()=>"LoseEnemy",()=>.02,b=>{const a=b._GetNode(0);return()=>1+a.ExpInstVar()},
()=>270,()=>"Collectibles",()=>"Collected",()=>"Controls",()=>"Checkpoint Function",()=>"Left",()=>"Right",()=>"Up",()=>"Down",()=>500,b=>{const a=b._GetNode(0).GetBoundMethod();return()=>a(0)},()=>-180,()=>-155,()=>155,()=>180,()=>-25,()=>25,()=>-115,()=>-65,()=>65,()=>"Stuck",()=>"Enemies",()=>"Solid Filters",()=>"MuffinMen",()=>"No-Behaviours MM",b=>{const a=b._GetNode(0),c=b._GetNode(1),d=b._GetNode(2),f=b._GetNode(3);return()=>e.toDegrees(e.angleTo(a.ExpObject(),c.ExpObject(),16*Math.round(d.ExpObject()/
16),16*Math.round(f.ExpObject()/16)))},()=>.3,b=>{const a=b._GetNode(0),c=b._GetNode(1),d=b._GetNode(2),f=b._GetNode(3);return()=>e.distanceTo(a.ExpObject(),c.ExpObject(),d.ExpObject(),f.ExpObject())},()=>-1,b=>{const a=b._GetNode(0),c=b._GetNode(1),d=b._GetNode(2),f=b._GetNode(3);return()=>e.toDegrees(e.angleTo(a.ExpObject(),c.ExpObject(),d.ExpObject(),f.ExpObject()))},b=>{const a=b._GetNode(0);return()=>16*Math.round(a.ExpObject()/16)},()=>"GarbageCats",()=>"Small",()=>2.2,()=>"Medium1",()=>"Large",
()=>"Medium2",()=>48,()=>"PukeBuckets",()=>2.3,()=>"Mouth",b=>{const a=b._GetNode(0);return()=>a.ExpObject()+90},()=>"SeeMonkey",()=>-16,()=>"Contraptions",()=>"Teleporters",()=>"TeleporterReady1",()=>"TeleporterDown1",()=>"CannonRotate",()=>"Cannons",()=>"Full",()=>"Floors",()=>"Push Blocks",()=>-14,()=>"Disappearing Floors",()=>"FloorButtonReady",()=>"FloorButtonDown",()=>"FloorDisappearingAppear",()=>"Buttons",()=>"SimpleLock Buttons",()=>"SimpleLockReady",()=>"SimpleLockDown",()=>"SimpleLockAppear",
()=>"SimpleLockDisappear",()=>"LetterButtons (Animations)",()=>"AReady",()=>"ADown",()=>"BReady",()=>"BDown",()=>"CReady",()=>"CDown",()=>"LetterButtons - Level Functions",b=>{const a=b._GetNode(0).GetBoundMethod();return()=>a(1,2,3)},()=>"LightOff",()=>"#1 = C",()=>"#2 = B",()=>"#3 = C",()=>"LightRed",()=>"LightGreen",()=>"#1 = A",()=>"#2 = C",()=>"#3 = B",()=>"#3 = A",()=>"Save Function (Initial)",()=>"Pre-Intro",()=>"TitleCard",()=>"BlankCard",()=>30,()=>232,()=>-6,()=>"IntroGoodNews",()=>"This is \nPrecious Meg.",
()=>-20,()=>"Precious Meg is a world-renowned gem thief.",()=>"Sapphires... Rubies... Emeralds... \nYou name it.",()=>"In fact, stealing stones had become stultifying... \n\nShe was [i]bored[/i].",()=>2.4,()=>-15,()=>"Precious Meg needed a new mountain to climb and steal... \n\nThe ultimate prize...",()=>88,()=>152,()=>"[color=#1C1121]I'll steal the [size=16] Genie's [size=20][offsetx=32] Magic [size=24][offsetx=64]Lamp!![/color]",()=>.25,()=>32,()=>1.75,()=>"She would need to be sneakier than a snake...",
()=>-100,()=>320,()=>244,()=>142,()=>"[color=#1C1121][offsety=40][offsetx=24][size=24]HEY!!![/color]",()=>.15,()=>66,()=>"Point",()=>"BigSurprise",()=>360,()=>"MainWalk",()=>"[color=#1C1121][offsety=20]That's my only lamp, you [i]thief[/i]! \n\nI need it to read my stories![/color]",()=>-3,()=>"IntroBadNews",()=>"[color=#1C1121]\nWhat do you have to say for yourself, buddy?![/color]",()=>248,()=>"[offsety=30][color=#1C1121][size=4]Uh... well, of course I... you know I would never in a million years...[/size][/color]",
()=>132,()=>"[color=#1C1121][offsety=30][offsetx=24][size=24]CAN IT, LADY![/color]",()=>"[color=#1C1121]You will pay for your rude dude attitude...[/color]",()=>2.5,()=>"[color=#1C1121]CITIZEN'S ARREST! \n\nYou must now wear the accursed [i]ROTATOR CUFFS[/i]... [/color]",()=>13,()=>"[color=#1C1121]... and I [i]banish you[/i] to the [b]Spinomatic Universe[/b] for ALL [size=24]ETERNITY!![/color]",()=>14,()=>-40,()=>"EnergyField",()=>15,()=>"LogoBounce",()=>252,()=>184,()=>"IntroOver",()=>1.2,()=>"TextInput Experiments",
()=>21,()=>"border",()=>"5px #545554",()=>"padding",()=>"10px",()=>"box-shadow",()=>"4px 8px #888888",()=>"font-family",()=>"monospace",()=>"text-transform",()=>"uppercase",()=>"I STEAL FROM...",()=>"Save Function",b=>{const a=b._GetNode(0).GetVar(),c=b._GetNode(1).GetVar(),d=b._GetNode(2).GetVar(),f=b._GetNode(3).GetVar(),h=b._GetNode(4).GetVar(),g=b._GetNode(5).GetVar(),l=b._GetNode(6).GetVar(),m=b._GetNode(7).GetVar(),u=b._GetNode(8).GetVar(),v=b._GetNode(9).GetVar(),t=b._GetNode(10).GetVar(),
q=b._GetNode(11).GetVar(),p=b._GetNode(12).GetVar(),r=b._GetNode(13).GetVar(),x=b._GetNode(14).GetVar(),y=b._GetNode(15).GetVar(),C=b._GetNode(16).GetVar(),G=b._GetNode(17).GetVar(),A=b._GetNode(18).GetVar(),E=b._GetNode(19).GetVar(),J=b._GetNode(20).GetVar(),B=b._GetNode(21).GetVar(),I=b._GetNode(22).GetVar(),L=b._GetNode(23).GetVar(),P=b._GetNode(24).GetVar(),S=b._GetNode(25).GetVar(),U=b._GetNode(26).GetVar(),V=b._GetNode(27).GetVar(),Z=b._GetNode(28).GetVar(),la=b._GetNode(29).GetVar(),va=b._GetNode(30).GetVar(),
Na=b._GetNode(31).GetVar(),za=b._GetNode(32).GetVar(),Ha=b._GetNode(33).GetVar(),Ja=b._GetNode(34).GetVar(),Aa=b._GetNode(35).GetVar(),ya=b._GetNode(36).GetVar(),na=b._GetNode(37).GetVar(),Ta=b._GetNode(38).GetVar(),wa=b._GetNode(39).GetVar(),Ba=b._GetNode(40).GetVar(),Ya=b._GetNode(41).GetVar(),Xa=b._GetNode(42).GetVar(),gb=b._GetNode(43).GetVar(),hb=b._GetNode(44).GetVar(),Za=b._GetNode(45).GetVar(),ib=b._GetNode(46).GetVar(),jb=b._GetNode(47).GetVar(),kb=b._GetNode(48).GetVar(),lb=b._GetNode(49).GetVar(),
mb=b._GetNode(50).GetVar(),nb=b._GetNode(51).GetVar(),ob=b._GetNode(52).GetVar(),$a=b._GetNode(53).GetVar(),pb=b._GetNode(54).GetVar(),qb=b._GetNode(55).GetVar(),rb=b._GetNode(56).GetVar(),ab=b._GetNode(57).GetVar(),Ua=b._GetNode(58).GetVar(),bb=b._GetNode(59).GetVar();return()=>a.GetValue()+c.GetValue()+d.GetValue()+f.GetValue()+h.GetValue()+g.GetValue()+l.GetValue()+m.GetValue()+u.GetValue()+v.GetValue()+t.GetValue()+q.GetValue()+p.GetValue()+r.GetValue()+x.GetValue()+y.GetValue()+C.GetValue()+
G.GetValue()+A.GetValue()+E.GetValue()+J.GetValue()+B.GetValue()+I.GetValue()+L.GetValue()+P.GetValue()+S.GetValue()+U.GetValue()+V.GetValue()+Z.GetValue()+la.GetValue()+va.GetValue()+Na.GetValue()+za.GetValue()+Ha.GetValue()+Ja.GetValue()+Aa.GetValue()+ya.GetValue()+na.GetValue()+Ta.GetValue()+wa.GetValue()+Ba.GetValue()+Ya.GetValue()+Xa.GetValue()+gb.GetValue()+hb.GetValue()+Za.GetValue()+ib.GetValue()+jb.GetValue()+kb.GetValue()+lb.GetValue()+mb.GetValue()+nb.GetValue()+ob.GetValue()+$a.GetValue()+
pb.GetValue()+qb.GetValue()+rb.GetValue()+ab.GetValue()+Ua.GetValue()+bb.GetValue()},b=>{const a=b._GetNode(0).GetVar(),c=b._GetNode(1).GetVar(),d=b._GetNode(2).GetVar(),f=b._GetNode(3).GetVar(),h=b._GetNode(4).GetVar(),g=b._GetNode(5).GetVar(),l=b._GetNode(6).GetVar(),m=b._GetNode(7).GetVar(),u=b._GetNode(8).GetVar(),v=b._GetNode(9).GetVar(),t=b._GetNode(10).GetVar(),q=b._GetNode(11).GetVar();return()=>a.GetValue()+c.GetValue()+d.GetValue()+f.GetValue()+h.GetValue()+g.GetValue()+l.GetValue()+m.GetValue()+
u.GetValue()+v.GetValue()+t.GetValue()+q.GetValue()},()=>"StartUp",()=>"LevelSelectSong",b=>{const a=b._GetNode(0);return()=>a.ExpObject()-40},()=>"MouseTouch",()=>"Intro",()=>"Controls (Introduction)",()=>"Transition",()=>"ButtonsKeys",()=>"PreMouseTouch",()=>"Level1",()=>"Question",()=>"FRUITY TOOTS \nI",()=>"@ ",()=>"Level2",()=>"FRUITY TOOTS \nII",()=>"Level3",()=>"FRUITY TOOTS III",()=>"Level4",()=>"TR#S VEGGIE I",()=>"Level5",()=>"TR#S VEGGIE II",()=>"Level6",()=>"TR#S VEGGIE III",()=>"Level7",
()=>"LITTER KITTIES \nI",()=>"Level8",()=>"LITTER KITTIES \nII",()=>"Level9",()=>"LITTER KITTIES \nIII",()=>"Level10",()=>"BRAIN MUFFIN \nI",()=>"Level11",()=>"BRAIN MUFFIN \nII",()=>"Level12",()=>"BRAIN MUFFIN \nIII",()=>"LevelVC",()=>"VICIOUS CIRCLE",()=>"??? ",()=>"LevelVCDead",()=>"GET ALL GEMS!",b=>{const a=b._GetNode(0),c=b._GetNode(1),d=b._GetNode(2),f=b._GetNode(3);return()=>e.toDegrees(e.angleTo(a.ExpObject(),c.ExpObject(),d.ExpObject(),f.ExpObject()))+90},()=>"Nothing",()=>"Exclamation",
()=>"LevelSelectLevel1",()=>"LevelSelectLevel2",()=>"LevelSelectLevel3",()=>"LevelSelectLevel4",()=>"LevelSelectLevel5",()=>"LevelSelectLevel6",()=>"LevelSelectLevel7",()=>"LevelSelectLevel8",()=>"LevelSelectLevel9",()=>"LevelSelectLevel10",()=>"LevelSelectLevel11",()=>"LevelSelectLevel12",()=>"LevelSelectLevelVC",()=>60,()=>110,()=>"ClosingMelancholy",()=>23,()=>"BECAUSE...",()=>"Grow",()=>"This is still \nPrecious Meg.",()=>"[color=#1C1121]So...\n\nI have some questions.[/color]",()=>"[color=#1C1121]... why do you take things?[/color]",
()=>"WELL...",()=>"[color=#1C1121]... what made you steal from me?[/color]",()=>"I...",()=>"[color=#1C1121]... how do we fix this?[/color]",()=>"[color=#1C1121]... I don't need this lamp.\n\nI don't [i]need[/i] anything.[/color]",()=>"Thinking",()=>"[color=#1C1121]... the lamp... \n\n\n...was the one thing that was just for me.[/color]",()=>"Sad",()=>"[color=#1C1121]... but I would've shared it...[/color]",()=>3.5,()=>"[color=#1C1121]You're, uh...\n\n... you're free to go.[/color]",()=>"Bad",()=>
"Good",()=>"Hug",()=>192,()=>"Closing Screen - Controls",()=>-1023,()=>174,()=>148,()=>"LampHold",()=>"DiamondHeart",()=>"CitrineHeart",()=>"EmeraldHeart",()=>"RubyHeart",()=>"SapphireHeart",b=>{const a=b._GetNode(0);return()=>a.ExpObject()+16},b=>{const a=b._GetNode(0);return()=>a.ExpObject()+24},()=>"A Game By\nASTROSAURUS GAMES",()=>"ALMOST EVERYTHING:\nNeil Armstrong",()=>"THANKS: Scirra,\nPNGIMG.com, BeepBox",()=>"SPECIAL THANKS:\nParents, Pals, Bros!",()=>"SPECIALEST THANKS:\nEmily, Louise, & Fred!",
()=>"IntroOverFade",()=>"TRY HUGGING NEXT TIME?",()=>3.6]}var module$str$c3runtime={};var module$str$__c3root__={};
