// Generated by Construct 3, the game and app creator :: https://www.construct.net
'use strict';(function(f,b){"object"===typeof exports&&"undefined"!==typeof module?b(exports):"function"===typeof define&&define.amd?define(["exports"],b):(f=f||self,b(f.glMatrix={}))})(this,function(f){function b(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];var F=v[0],H=v[1],K=v[2];v=v[3];h[0]=y*F+C*H;h[1]=A*F+l*H;h[2]=y*K+C*v;h[3]=A*K+l*v;return h}function a(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];return h}function e(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4];l=l[5];var K=
v[0],M=v[1],Q=v[2],S=v[3],X=v[4];v=v[5];h[0]=y*K+C*M;h[1]=A*K+F*M;h[2]=y*Q+C*S;h[3]=A*Q+F*S;h[4]=y*X+C*v+H;h[5]=A*X+F*v+l;return h}function c(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];h[4]=l[4]-v[4];h[5]=l[5]-v[5];return h}function d(){var h=new ma(9);ma!=Float32Array&&(h[1]=0,h[2]=0,h[3]=0,h[5]=0,h[6]=0,h[7]=0);h[0]=1;h[4]=1;h[8]=1;return h}function g(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7];l=l[8];var S=v[0],X=v[1],U=v[2],ca=v[3],ba=v[4],Z=v[5],
ra=v[6],la=v[7];v=v[8];h[0]=S*y+X*F+U*M;h[1]=S*A+X*H+U*Q;h[2]=S*C+X*K+U*l;h[3]=ca*y+ba*F+Z*M;h[4]=ca*A+ba*H+Z*Q;h[5]=ca*C+ba*K+Z*l;h[6]=ra*y+la*F+v*M;h[7]=ra*A+la*H+v*Q;h[8]=ra*C+la*K+v*l;return h}function k(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];h[4]=l[4]-v[4];h[5]=l[5]-v[5];h[6]=l[6]-v[6];h[7]=l[7]-v[7];h[8]=l[8]-v[8];return h}function m(h){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h}function p(h,
l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=l[8],X=l[9],U=l[10],ca=l[11],ba=l[12],Z=l[13],ra=l[14];l=l[15];var la=v[0],oa=v[1],pa=v[2],na=v[3];h[0]=la*y+oa*H+pa*S+na*ba;h[1]=la*A+oa*K+pa*X+na*Z;h[2]=la*C+oa*M+pa*U+na*ra;h[3]=la*F+oa*Q+pa*ca+na*l;la=v[4];oa=v[5];pa=v[6];na=v[7];h[4]=la*y+oa*H+pa*S+na*ba;h[5]=la*A+oa*K+pa*X+na*Z;h[6]=la*C+oa*M+pa*U+na*ra;h[7]=la*F+oa*Q+pa*ca+na*l;la=v[8];oa=v[9];pa=v[10];na=v[11];h[8]=la*y+oa*H+pa*S+na*ba;h[9]=la*A+oa*K+pa*X+na*Z;h[10]=la*C+oa*
M+pa*U+na*ra;h[11]=la*F+oa*Q+pa*ca+na*l;la=v[12];oa=v[13];pa=v[14];na=v[15];h[12]=la*y+oa*H+pa*S+na*ba;h[13]=la*A+oa*K+pa*X+na*Z;h[14]=la*C+oa*M+pa*U+na*ra;h[15]=la*F+oa*Q+pa*ca+na*l;return h}function n(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=y+y,K=A+A,M=C+C;l=y*H;var Q=y*K;y*=M;var S=A*K;A*=M;C*=M;H*=F;K*=F;F*=M;h[0]=1-(S+C);h[1]=Q+F;h[2]=y-K;h[3]=0;h[4]=Q-F;h[5]=1-(l+C);h[6]=A+H;h[7]=0;h[8]=y+K;h[9]=A-H;h[10]=1-(l+S);h[11]=0;h[12]=v[0];h[13]=v[1];h[14]=v[2];h[15]=1;return h}function u(h,l){h[0]=
l[12];h[1]=l[13];h[2]=l[14];return h}function q(h,l){var v=l[4],y=l[5],A=l[6],C=l[8],F=l[9],H=l[10];h[0]=Math.hypot(l[0],l[1],l[2]);h[1]=Math.hypot(v,y,A);h[2]=Math.hypot(C,F,H);return h}function r(h,l){var v=new ma(3);q(v,l);var y=1/v[0],A=1/v[1],C=1/v[2],F=l[0]*y;v=l[1]*A;var H=l[2]*C,K=l[4]*y,M=l[5]*A,Q=l[6]*C;y*=l[8];A*=l[9];l=l[10]*C;C=F+M+l;0<C?(F=2*Math.sqrt(C+1),h[3]=.25*F,h[0]=(Q-A)/F,h[1]=(y-H)/F,h[2]=(v-K)/F):F>M&&F>l?(F=2*Math.sqrt(1+F-M-l),h[3]=(Q-A)/F,h[0]=.25*F,h[1]=(v+K)/F,h[2]=(y+
H)/F):M>l?(F=2*Math.sqrt(1+M-F-l),h[3]=(y-H)/F,h[0]=(v+K)/F,h[1]=.25*F,h[2]=(Q+A)/F):(F=2*Math.sqrt(1+l-F-M),h[3]=(v-K)/F,h[0]=(y+H)/F,h[1]=(Q+A)/F,h[2]=.25*F);return h}function t(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];h[4]=l[4]-v[4];h[5]=l[5]-v[5];h[6]=l[6]-v[6];h[7]=l[7]-v[7];h[8]=l[8]-v[8];h[9]=l[9]-v[9];h[10]=l[10]-v[10];h[11]=l[11]-v[11];h[12]=l[12]-v[12];h[13]=l[13]-v[13];h[14]=l[14]-v[14];h[15]=l[15]-v[15];return h}function x(){var h=new ma(3);ma!=Float32Array&&
(h[0]=0,h[1]=0,h[2]=0);return h}function z(h){return Math.hypot(h[0],h[1],h[2])}function D(h,l,v){var y=new ma(3);y[0]=h;y[1]=l;y[2]=v;return y}function G(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];return h}function w(h,l,v){h[0]=l[0]*v[0];h[1]=l[1]*v[1];h[2]=l[2]*v[2];return h}function B(h,l,v){h[0]=l[0]/v[0];h[1]=l[1]/v[1];h[2]=l[2]/v[2];return h}function I(h,l){return Math.hypot(l[0]-h[0],l[1]-h[1],l[2]-h[2])}function P(h,l){var v=l[0]-h[0],y=l[1]-h[1];h=l[2]-h[2];return v*v+y*y+h*h}function E(h){var l=
h[0],v=h[1];h=h[2];return l*l+v*v+h*h}function J(h,l){var v=l[0],y=l[1],A=l[2];v=v*v+y*y+A*A;0<v&&(v=1/Math.sqrt(v));h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;return h}function O(h,l){return h[0]*l[0]+h[1]*l[1]+h[2]*l[2]}function R(h,l,v){var y=l[0],A=l[1];l=l[2];var C=v[0],F=v[1];v=v[2];h[0]=A*v-l*F;h[1]=l*C-y*v;h[2]=y*F-A*C;return h}function T(){var h=new ma(4);ma!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0,h[3]=0);return h}function Y(h){var l=new ma(4);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];return l}function W(h,
l,v,y){var A=new ma(4);A[0]=h;A[1]=l;A[2]=v;A[3]=y;return A}function ea(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];return h}function qa(h,l,v,y,A){h[0]=l;h[1]=v;h[2]=y;h[3]=A;return h}function ja(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];return h}function xa(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];h[2]=l[2]-v[2];h[3]=l[3]-v[3];return h}function ua(h,l,v){h[0]=l[0]*v[0];h[1]=l[1]*v[1];h[2]=l[2]*v[2];h[3]=l[3]*v[3];return h}function Da(h,l,v){h[0]=l[0]/v[0];h[1]=l[1]/v[1];h[2]=
l[2]/v[2];h[3]=l[3]/v[3];return h}function Ea(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;return h}function Ba(h,l){return Math.hypot(l[0]-h[0],l[1]-h[1],l[2]-h[2],l[3]-h[3])}function Aa(h,l){var v=l[0]-h[0],y=l[1]-h[1],A=l[2]-h[2];h=l[3]-h[3];return v*v+y*y+A*A+h*h}function ia(h){return Math.hypot(h[0],h[1],h[2],h[3])}function Fa(h){var l=h[0],v=h[1],y=h[2];h=h[3];return l*l+v*v+y*y+h*h}function wa(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v*v+y*y+A*A+l*l;0<C&&(C=1/Math.sqrt(C));h[0]=
v*C;h[1]=y*C;h[2]=A*C;h[3]=l*C;return h}function Ca(h,l){return h[0]*l[0]+h[1]*l[1]+h[2]*l[2]+h[3]*l[3]}function Pa(h,l,v,y){var A=l[0],C=l[1],F=l[2];l=l[3];h[0]=A+y*(v[0]-A);h[1]=C+y*(v[1]-C);h[2]=F+y*(v[2]-F);h[3]=l+y*(v[3]-l);return h}function Qa(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]}function Ra(h,l){var v=h[0],y=h[1],A=h[2];h=h[3];var C=l[0],F=l[1],H=l[2];l=l[3];return Math.abs(v-C)<=.000001*Math.max(1,Math.abs(v),Math.abs(C))&&Math.abs(y-F)<=.000001*Math.max(1,Math.abs(y),
Math.abs(F))&&Math.abs(A-H)<=.000001*Math.max(1,Math.abs(A),Math.abs(H))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))}function Ja(){var h=new ma(4);ma!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0);h[3]=1;return h}function Sa(h,l,v){v*=.5;var y=Math.sin(v);h[0]=y*l[0];h[1]=y*l[1];h[2]=y*l[2];h[3]=Math.cos(v);return h}function Ta(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];var F=v[0],H=v[1],K=v[2];v=v[3];h[0]=y*v+l*F+A*K-C*H;h[1]=A*v+l*H+C*F-y*K;h[2]=C*v+l*K+y*H-A*F;h[3]=l*v-y*F-A*H-C*K;return h}
function Ua(h,l,v){v*=.5;var y=l[0],A=l[1],C=l[2];l=l[3];var F=Math.sin(v);v=Math.cos(v);h[0]=y*v+l*F;h[1]=A*v+C*F;h[2]=C*v-A*F;h[3]=l*v-y*F;return h}function Va(h,l,v){v*=.5;var y=l[0],A=l[1],C=l[2];l=l[3];var F=Math.sin(v);v=Math.cos(v);h[0]=y*v-C*F;h[1]=A*v+l*F;h[2]=C*v+y*F;h[3]=l*v-A*F;return h}function Wa(h,l,v){v*=.5;var y=l[0],A=l[1],C=l[2];l=l[3];var F=Math.sin(v);v=Math.cos(v);h[0]=y*v+A*F;h[1]=A*v-y*F;h[2]=C*v+l*F;h[3]=l*v-C*F;return h}function Xa(h,l){var v=l[0],y=l[1],A=l[2],C=Math.sqrt(v*
v+y*y+A*A);l=Math.exp(l[3]);var F=0<C?l*Math.sin(C)/C:0;h[0]=v*F;h[1]=y*F;h[2]=A*F;h[3]=l*Math.cos(C);return h}function Ya(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=Math.sqrt(v*v+y*y+A*A);C=0<C?Math.atan2(C,l)/C:0;h[0]=v*C;h[1]=y*C;h[2]=A*C;h[3]=.5*Math.log(v*v+y*y+A*A+l*l);return h}function Ka(h,l,v,y){var A=l[0],C=l[1],F=l[2];l=l[3];var H=v[0],K=v[1],M=v[2];v=v[3];var Q=A*H+C*K+F*M+l*v;0>Q&&(Q=-Q,H=-H,K=-K,M=-M,v=-v);if(.000001<1-Q){var S=Math.acos(Q);var X=Math.sin(S);Q=Math.sin((1-y)*S)/X;y=
Math.sin(y*S)/X}else Q=1-y;h[0]=Q*A+y*H;h[1]=Q*C+y*K;h[2]=Q*F+y*M;h[3]=Q*l+y*v;return h}function Za(h,l){var v=l[0]+l[4]+l[8];if(0<v)v=Math.sqrt(v+1),h[3]=.5*v,v=.5/v,h[0]=(l[5]-l[7])*v,h[1]=(l[6]-l[2])*v,h[2]=(l[1]-l[3])*v;else{var y=0;l[4]>l[0]&&(y=1);l[8]>l[3*y+y]&&(y=2);var A=(y+1)%3,C=(y+2)%3;v=Math.sqrt(l[3*y+y]-l[3*A+A]-l[3*C+C]+1);h[y]=.5*v;v=.5/v;h[3]=(l[3*A+C]-l[3*C+A])*v;h[A]=(l[3*A+y]+l[3*y+A])*v;h[C]=(l[3*C+y]+l[3*y+C])*v}return h}function $a(h,l,v){var y=.5*v[0],A=.5*v[1];v=.5*v[2];
var C=l[0],F=l[1],H=l[2];l=l[3];h[0]=C;h[1]=F;h[2]=H;h[3]=l;h[4]=y*l+A*H-v*F;h[5]=A*l+v*C-y*H;h[6]=v*l+y*F-A*C;h[7]=-y*C-A*F-v*H;return h}function ab(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=l[4];h[5]=l[5];h[6]=l[6];h[7]=l[7];return h}function bb(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=v[4],K=v[5],M=v[6],Q=v[7],S=l[4],X=l[5],U=l[6];l=l[7];var ca=v[0],ba=v[1],Z=v[2];v=v[3];h[0]=y*v+F*ca+A*Z-C*ba;h[1]=A*v+F*ba+C*ca-y*Z;h[2]=C*v+F*Z+y*ba-A*ca;h[3]=F*v-y*ca-A*ba-C*Z;h[4]=y*Q+F*H+A*M-C*K+S*v+
l*ca+X*Z-U*ba;h[5]=A*Q+F*K+C*H-y*M+X*v+l*ba+U*ca-S*Z;h[6]=C*Q+F*M+y*K-A*H+U*v+l*Z+S*ba-X*ca;h[7]=F*Q-y*H-A*K-C*M+l*v-S*ca-X*ba-U*Z;return h}function cb(){var h=new ma(2);ma!=Float32Array&&(h[0]=0,h[1]=0);return h}function db(h,l,v){h[0]=l[0]-v[0];h[1]=l[1]-v[1];return h}function eb(h,l,v){h[0]=l[0]*v[0];h[1]=l[1]*v[1];return h}function fb(h,l,v){h[0]=l[0]/v[0];h[1]=l[1]/v[1];return h}function gb(h,l){return Math.hypot(l[0]-h[0],l[1]-h[1])}function hb(h,l){var v=l[0]-h[0];h=l[1]-h[1];return v*v+h*
h}function ib(h){return Math.hypot(h[0],h[1])}function jb(h){var l=h[0];h=h[1];return l*l+h*h}var ma="undefined"!==typeof Float32Array?Float32Array:Array,Ga=Math.random,kb=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var h=0,l=arguments.length;l--;)h+=arguments[l]*arguments[l];return Math.sqrt(h)});var lb=Object.freeze({__proto__:null,EPSILON:.000001,get ARRAY_TYPE(){return ma},RANDOM:Ga,setMatrixArrayType:function(h){ma=h},toRadian:function(h){return h*kb},equals:function(h,l){return Math.abs(h-
l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))}}),mb=Object.freeze({__proto__:null,create:function(){var h=new ma(4);ma!=Float32Array&&(h[1]=0,h[2]=0);h[0]=1;h[3]=1;return h},clone:function(h){var l=new ma(4);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];return l},copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=1;return h},fromValues:function(h,l,v,y){var A=new ma(4);A[0]=h;A[1]=l;A[2]=v;A[3]=y;return A},set:function(h,l,v,y,A){h[0]=l;
h[1]=v;h[2]=y;h[3]=A;return h},transpose:function(h,l){if(h===l){var v=l[1];h[1]=l[2];h[2]=v}else h[0]=l[0],h[1]=l[2],h[2]=l[1],h[3]=l[3];return h},invert:function(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v*l-A*y;if(!C)return null;C=1/C;h[0]=l*C;h[1]=-y*C;h[2]=-A*C;h[3]=v*C;return h},adjoint:function(h,l){var v=l[0];h[0]=l[3];h[1]=-l[1];h[2]=-l[2];h[3]=v;return h},determinant:function(h){return h[0]*h[3]-h[2]*h[1]},multiply:b,rotate:function(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];var F=Math.sin(v);
v=Math.cos(v);h[0]=y*v+C*F;h[1]=A*v+l*F;h[2]=y*-F+C*v;h[3]=A*-F+l*v;return h},scale:function(h,l,v){var y=l[1],A=l[2],C=l[3],F=v[0];v=v[1];h[0]=l[0]*F;h[1]=y*F;h[2]=A*v;h[3]=C*v;return h},fromRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=v;h[2]=-v;h[3]=l;return h},fromScaling:function(h,l){h[0]=l[0];h[1]=0;h[2]=0;h[3]=l[1];return h},str:function(h){return"mat2("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3])},LDU:function(h,l,v,
y){h[2]=y[2]/y[0];v[0]=y[0];v[1]=y[1];v[3]=y[3]-h[2]*v[1];return[h,l,v]},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];return h},subtract:a,exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]},equals:function(h,l){var v=h[0],y=h[1],A=h[2];h=h[3];var C=l[0],F=l[1],H=l[2];l=l[3];return Math.abs(v-C)<=.000001*Math.max(1,Math.abs(v),Math.abs(C))&&Math.abs(y-F)<=.000001*Math.max(1,Math.abs(y),Math.abs(F))&&Math.abs(A-H)<=.000001*Math.max(1,
Math.abs(A),Math.abs(H))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},multiplyScalar:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;return h},multiplyScalarAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;return h},mul:b,sub:a}),nb=Object.freeze({__proto__:null,create:function(){var h=new ma(6);ma!=Float32Array&&(h[1]=0,h[2]=0,h[4]=0,h[5]=0);h[0]=1;h[3]=1;return h},clone:function(h){var l=new ma(6);l[0]=h[0];l[1]=h[1];l[2]=
h[2];l[3]=h[3];l[4]=h[4];l[5]=h[5];return l},copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=l[4];h[5]=l[5];return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=1;h[4]=0;h[5]=0;return h},fromValues:function(h,l,v,y,A,C){var F=new ma(6);F[0]=h;F[1]=l;F[2]=v;F[3]=y;F[4]=A;F[5]=C;return F},set:function(h,l,v,y,A,C,F){h[0]=l;h[1]=v;h[2]=y;h[3]=A;h[4]=C;h[5]=F;return h},invert:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4];l=l[5];var H=v*C-y*A;if(!H)return null;H=1/H;h[0]=C*H;
h[1]=-y*H;h[2]=-A*H;h[3]=v*H;h[4]=(A*l-C*F)*H;h[5]=(y*F-v*l)*H;return h},determinant:function(h){return h[0]*h[3]-h[1]*h[2]},multiply:e,rotate:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4];l=l[5];var K=Math.sin(v);v=Math.cos(v);h[0]=y*v+C*K;h[1]=A*v+F*K;h[2]=y*-K+C*v;h[3]=A*-K+F*v;h[4]=H;h[5]=l;return h},scale:function(h,l,v){var y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=v[0];v=v[1];h[0]=l[0]*K;h[1]=y*K;h[2]=A*v;h[3]=C*v;h[4]=F;h[5]=H;return h},translate:function(h,l,v){var y=l[0],A=l[1],C=l[2],
F=l[3],H=l[4];l=l[5];var K=v[0];v=v[1];h[0]=y;h[1]=A;h[2]=C;h[3]=F;h[4]=y*K+C*v+H;h[5]=A*K+F*v+l;return h},fromRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=v;h[2]=-v;h[3]=l;h[4]=0;h[5]=0;return h},fromScaling:function(h,l){h[0]=l[0];h[1]=0;h[2]=0;h[3]=l[1];h[4]=0;h[5]=0;return h},fromTranslation:function(h,l){h[0]=1;h[1]=0;h[2]=0;h[3]=1;h[4]=l[0];h[5]=l[1];return h},str:function(h){return"mat2d("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+")"},frob:function(h){return Math.hypot(h[0],
h[1],h[2],h[3],h[4],h[5],1)},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];h[4]=l[4]+v[4];h[5]=l[5]+v[5];return h},subtract:c,multiplyScalar:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;h[4]=l[4]*v;h[5]=l[5]*v;return h},multiplyScalarAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;h[4]=l[4]+v[4]*y;h[5]=l[5]+v[5]*y;return h},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===
l[3]&&h[4]===l[4]&&h[5]===l[5]},equals:function(h,l){var v=h[0],y=h[1],A=h[2],C=h[3],F=h[4];h=h[5];var H=l[0],K=l[1],M=l[2],Q=l[3],S=l[4];l=l[5];return Math.abs(v-H)<=.000001*Math.max(1,Math.abs(v),Math.abs(H))&&Math.abs(y-K)<=.000001*Math.max(1,Math.abs(y),Math.abs(K))&&Math.abs(A-M)<=.000001*Math.max(1,Math.abs(A),Math.abs(M))&&Math.abs(C-Q)<=.000001*Math.max(1,Math.abs(C),Math.abs(Q))&&Math.abs(F-S)<=.000001*Math.max(1,Math.abs(F),Math.abs(S))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},
mul:e,sub:c}),ob=Object.freeze({__proto__:null,create:d,fromMat4:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[4];h[4]=l[5];h[5]=l[6];h[6]=l[8];h[7]=l[9];h[8]=l[10];return h},clone:function(h){var l=new ma(9);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];l[4]=h[4];l[5]=h[5];l[6]=h[6];l[7]=h[7];l[8]=h[8];return l},copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=l[4];h[5]=l[5];h[6]=l[6];h[7]=l[7];h[8]=l[8];return h},fromValues:function(h,l,v,y,A,C,F,H,K){var M=new ma(9);M[0]=h;M[1]=l;
M[2]=v;M[3]=y;M[4]=A;M[5]=C;M[6]=F;M[7]=H;M[8]=K;return M},set:function(h,l,v,y,A,C,F,H,K,M){h[0]=l;h[1]=v;h[2]=y;h[3]=A;h[4]=C;h[5]=F;h[6]=H;h[7]=K;h[8]=M;return h},identity:function(h){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=1;h[5]=0;h[6]=0;h[7]=0;h[8]=1;return h},transpose:function(h,l){if(h===l){var v=l[1],y=l[2],A=l[5];h[1]=l[3];h[2]=l[6];h[3]=v;h[5]=l[7];h[6]=y;h[7]=A}else h[0]=l[0],h[1]=l[3],h[2]=l[6],h[3]=l[1],h[4]=l[4],h[5]=l[7],h[6]=l[2],h[7]=l[5],h[8]=l[8];return h},invert:function(h,l){var v=
l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7];l=l[8];var Q=l*F-H*M,S=-l*C+H*K,X=M*C-F*K,U=v*Q+y*S+A*X;if(!U)return null;U=1/U;h[0]=Q*U;h[1]=(-l*y+A*M)*U;h[2]=(H*y-A*F)*U;h[3]=S*U;h[4]=(l*v-A*K)*U;h[5]=(-H*v+A*C)*U;h[6]=X*U;h[7]=(-M*v+y*K)*U;h[8]=(F*v-y*C)*U;return h},adjoint:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7];l=l[8];h[0]=F*l-H*M;h[1]=A*M-y*l;h[2]=y*H-A*F;h[3]=H*K-C*l;h[4]=v*l-A*K;h[5]=A*C-v*H;h[6]=C*M-F*K;h[7]=y*K-v*M;h[8]=v*F-y*C;return h},determinant:function(h){var l=
h[3],v=h[4],y=h[5],A=h[6],C=h[7],F=h[8];return h[0]*(F*v-y*C)+h[1]*(-F*l+y*A)+h[2]*(C*l-v*A)},multiply:g,translate:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7];l=l[8];var S=v[0];v=v[1];h[0]=y;h[1]=A;h[2]=C;h[3]=F;h[4]=H;h[5]=K;h[6]=S*y+v*F+M;h[7]=S*A+v*H+Q;h[8]=S*C+v*K+l;return h},rotate:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7];l=l[8];var S=Math.sin(v);v=Math.cos(v);h[0]=v*y+S*F;h[1]=v*A+S*H;h[2]=v*C+S*K;h[3]=v*F-S*y;h[4]=v*H-S*A;h[5]=
v*K-S*C;h[6]=M;h[7]=Q;h[8]=l;return h},scale:function(h,l,v){var y=v[0];v=v[1];h[0]=y*l[0];h[1]=y*l[1];h[2]=y*l[2];h[3]=v*l[3];h[4]=v*l[4];h[5]=v*l[5];h[6]=l[6];h[7]=l[7];h[8]=l[8];return h},fromTranslation:function(h,l){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=1;h[5]=0;h[6]=l[0];h[7]=l[1];h[8]=1;return h},fromRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=v;h[2]=0;h[3]=-v;h[4]=l;h[5]=0;h[6]=0;h[7]=0;h[8]=1;return h},fromScaling:function(h,l){h[0]=l[0];h[1]=0;h[2]=0;h[3]=0;h[4]=l[1];h[5]=
0;h[6]=0;h[7]=0;h[8]=1;return h},fromMat2d:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=0;h[3]=l[2];h[4]=l[3];h[5]=0;h[6]=l[4];h[7]=l[5];h[8]=1;return h},fromQuat:function(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v+v,F=y+y,H=A+A;v*=C;var K=y*C;y*=F;var M=A*C,Q=A*F;A*=H;C*=l;F*=l;l*=H;h[0]=1-y-A;h[3]=K-l;h[6]=M+F;h[1]=K+l;h[4]=1-v-A;h[7]=Q-C;h[2]=M-F;h[5]=Q+C;h[8]=1-v-y;return h},normalFromMat4:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7],Q=l[8],S=l[9],X=l[10],U=l[11],ca=l[12],
ba=l[13],Z=l[14];l=l[15];var ra=v*H-y*F,la=v*K-A*F,oa=v*M-C*F,pa=y*K-A*H,na=y*M-C*H,za=A*M-C*K,L=Q*ba-S*ca,N=Q*Z-X*ca;Q=Q*l-U*ca;var V=S*Z-X*ba;S=S*l-U*ba;X=X*l-U*Z;U=ra*X-la*S+oa*V+pa*Q-na*N+za*L;if(!U)return null;U=1/U;h[0]=(H*X-K*S+M*V)*U;h[1]=(K*Q-F*X-M*N)*U;h[2]=(F*S-H*Q+M*L)*U;h[3]=(A*S-y*X-C*V)*U;h[4]=(v*X-A*Q+C*N)*U;h[5]=(y*Q-v*S-C*L)*U;h[6]=(ba*za-Z*na+l*pa)*U;h[7]=(Z*oa-ca*za-l*la)*U;h[8]=(ca*na-ba*oa+l*ra)*U;return h},projection:function(h,l,v){h[0]=2/l;h[1]=0;h[2]=0;h[3]=0;h[4]=-2/v;h[5]=
0;h[6]=-1;h[7]=1;h[8]=1;return h},str:function(h){return"mat3("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+", "+h[8]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8])},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];h[4]=l[4]+v[4];h[5]=l[5]+v[5];h[6]=l[6]+v[6];h[7]=l[7]+v[7];h[8]=l[8]+v[8];return h},subtract:k,multiplyScalar:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;h[4]=l[4]*
v;h[5]=l[5]*v;h[6]=l[6]*v;h[7]=l[7]*v;h[8]=l[8]*v;return h},multiplyScalarAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;h[4]=l[4]+v[4]*y;h[5]=l[5]+v[5]*y;h[6]=l[6]+v[6]*y;h[7]=l[7]+v[7]*y;h[8]=l[8]+v[8]*y;return h},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]&&h[4]===l[4]&&h[5]===l[5]&&h[6]===l[6]&&h[7]===l[7]&&h[8]===l[8]},equals:function(h,l){var v=h[0],y=h[1],A=h[2],C=h[3],F=h[4],H=h[5],K=h[6],M=h[7];h=h[8];var Q=
l[0],S=l[1],X=l[2],U=l[3],ca=l[4],ba=l[5],Z=l[6],ra=l[7];l=l[8];return Math.abs(v-Q)<=.000001*Math.max(1,Math.abs(v),Math.abs(Q))&&Math.abs(y-S)<=.000001*Math.max(1,Math.abs(y),Math.abs(S))&&Math.abs(A-X)<=.000001*Math.max(1,Math.abs(A),Math.abs(X))&&Math.abs(C-U)<=.000001*Math.max(1,Math.abs(C),Math.abs(U))&&Math.abs(F-ca)<=.000001*Math.max(1,Math.abs(F),Math.abs(ca))&&Math.abs(H-ba)<=.000001*Math.max(1,Math.abs(H),Math.abs(ba))&&Math.abs(K-Z)<=.000001*Math.max(1,Math.abs(K),Math.abs(Z))&&Math.abs(M-
ra)<=.000001*Math.max(1,Math.abs(M),Math.abs(ra))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},mul:g,sub:k}),pb=Object.freeze({__proto__:null,create:function(){var h=new ma(16);ma!=Float32Array&&(h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[11]=0,h[12]=0,h[13]=0,h[14]=0);h[0]=1;h[5]=1;h[10]=1;h[15]=1;return h},clone:function(h){var l=new ma(16);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];l[4]=h[4];l[5]=h[5];l[6]=h[6];l[7]=h[7];l[8]=h[8];l[9]=h[9];l[10]=h[10];l[11]=h[11];l[12]=
h[12];l[13]=h[13];l[14]=h[14];l[15]=h[15];return l},copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=l[4];h[5]=l[5];h[6]=l[6];h[7]=l[7];h[8]=l[8];h[9]=l[9];h[10]=l[10];h[11]=l[11];h[12]=l[12];h[13]=l[13];h[14]=l[14];h[15]=l[15];return h},fromValues:function(h,l,v,y,A,C,F,H,K,M,Q,S,X,U,ca,ba){var Z=new ma(16);Z[0]=h;Z[1]=l;Z[2]=v;Z[3]=y;Z[4]=A;Z[5]=C;Z[6]=F;Z[7]=H;Z[8]=K;Z[9]=M;Z[10]=Q;Z[11]=S;Z[12]=X;Z[13]=U;Z[14]=ca;Z[15]=ba;return Z},set:function(h,l,v,y,A,C,F,H,K,M,Q,S,X,U,ca,ba,
Z){h[0]=l;h[1]=v;h[2]=y;h[3]=A;h[4]=C;h[5]=F;h[6]=H;h[7]=K;h[8]=M;h[9]=Q;h[10]=S;h[11]=X;h[12]=U;h[13]=ca;h[14]=ba;h[15]=Z;return h},identity:m,transpose:function(h,l){if(h===l){var v=l[1],y=l[2],A=l[3],C=l[6],F=l[7],H=l[11];h[1]=l[4];h[2]=l[8];h[3]=l[12];h[4]=v;h[6]=l[9];h[7]=l[13];h[8]=y;h[9]=C;h[11]=l[14];h[12]=A;h[13]=F;h[14]=H}else h[0]=l[0],h[1]=l[4],h[2]=l[8],h[3]=l[12],h[4]=l[1],h[5]=l[5],h[6]=l[9],h[7]=l[13],h[8]=l[2],h[9]=l[6],h[10]=l[10],h[11]=l[14],h[12]=l[3],h[13]=l[7],h[14]=l[11],h[15]=
l[15];return h},invert:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7],Q=l[8],S=l[9],X=l[10],U=l[11],ca=l[12],ba=l[13],Z=l[14];l=l[15];var ra=v*H-y*F,la=v*K-A*F,oa=v*M-C*F,pa=y*K-A*H,na=y*M-C*H,za=A*M-C*K,L=Q*ba-S*ca,N=Q*Z-X*ca,V=Q*l-U*ca,aa=S*Z-X*ba,fa=S*l-U*ba,ha=X*l-U*Z,da=ra*ha-la*fa+oa*aa+pa*V-na*N+za*L;if(!da)return null;da=1/da;h[0]=(H*ha-K*fa+M*aa)*da;h[1]=(A*fa-y*ha-C*aa)*da;h[2]=(ba*za-Z*na+l*pa)*da;h[3]=(X*na-S*za-U*pa)*da;h[4]=(K*V-F*ha-M*N)*da;h[5]=(v*ha-A*V+
C*N)*da;h[6]=(Z*oa-ca*za-l*la)*da;h[7]=(Q*za-X*oa+U*la)*da;h[8]=(F*fa-H*V+M*L)*da;h[9]=(y*V-v*fa-C*L)*da;h[10]=(ca*na-ba*oa+l*ra)*da;h[11]=(S*oa-Q*na-U*ra)*da;h[12]=(H*N-F*aa-K*L)*da;h[13]=(v*aa-y*N+A*L)*da;h[14]=(ba*la-ca*pa-Z*ra)*da;h[15]=(Q*pa-S*la+X*ra)*da;return h},adjoint:function(h,l){var v=l[0],y=l[1],A=l[2],C=l[3],F=l[4],H=l[5],K=l[6],M=l[7],Q=l[8],S=l[9],X=l[10],U=l[11],ca=l[12],ba=l[13],Z=l[14];l=l[15];h[0]=H*(X*l-U*Z)-S*(K*l-M*Z)+ba*(K*U-M*X);h[1]=-(y*(X*l-U*Z)-S*(A*l-C*Z)+ba*(A*U-C*X));
h[2]=y*(K*l-M*Z)-H*(A*l-C*Z)+ba*(A*M-C*K);h[3]=-(y*(K*U-M*X)-H*(A*U-C*X)+S*(A*M-C*K));h[4]=-(F*(X*l-U*Z)-Q*(K*l-M*Z)+ca*(K*U-M*X));h[5]=v*(X*l-U*Z)-Q*(A*l-C*Z)+ca*(A*U-C*X);h[6]=-(v*(K*l-M*Z)-F*(A*l-C*Z)+ca*(A*M-C*K));h[7]=v*(K*U-M*X)-F*(A*U-C*X)+Q*(A*M-C*K);h[8]=F*(S*l-U*ba)-Q*(H*l-M*ba)+ca*(H*U-M*S);h[9]=-(v*(S*l-U*ba)-Q*(y*l-C*ba)+ca*(y*U-C*S));h[10]=v*(H*l-M*ba)-F*(y*l-C*ba)+ca*(y*M-C*H);h[11]=-(v*(H*U-M*S)-F*(y*U-C*S)+Q*(y*M-C*H));h[12]=-(F*(S*Z-X*ba)-Q*(H*Z-K*ba)+ca*(H*X-K*S));h[13]=v*(S*Z-
X*ba)-Q*(y*Z-A*ba)+ca*(y*X-A*S);h[14]=-(v*(H*Z-K*ba)-F*(y*Z-A*ba)+ca*(y*K-A*H));h[15]=v*(H*X-K*S)-F*(y*X-A*S)+Q*(y*K-A*H);return h},determinant:function(h){var l=h[0],v=h[1],y=h[2],A=h[3],C=h[4],F=h[5],H=h[6],K=h[7],M=h[8],Q=h[9],S=h[10],X=h[11],U=h[12],ca=h[13],ba=h[14];h=h[15];return(l*F-v*C)*(S*h-X*ba)-(l*H-y*C)*(Q*h-X*ca)+(l*K-A*C)*(Q*ba-S*ca)+(v*H-y*F)*(M*h-X*U)-(v*K-A*F)*(M*ba-S*U)+(y*K-A*H)*(M*ca-Q*U)},multiply:p,translate:function(h,l,v){var y=v[0],A=v[1];v=v[2];if(l===h)h[12]=l[0]*y+l[4]*
A+l[8]*v+l[12],h[13]=l[1]*y+l[5]*A+l[9]*v+l[13],h[14]=l[2]*y+l[6]*A+l[10]*v+l[14],h[15]=l[3]*y+l[7]*A+l[11]*v+l[15];else{var C=l[0];var F=l[1];var H=l[2];var K=l[3];var M=l[4];var Q=l[5];var S=l[6];var X=l[7];var U=l[8];var ca=l[9];var ba=l[10];var Z=l[11];h[0]=C;h[1]=F;h[2]=H;h[3]=K;h[4]=M;h[5]=Q;h[6]=S;h[7]=X;h[8]=U;h[9]=ca;h[10]=ba;h[11]=Z;h[12]=C*y+M*A+U*v+l[12];h[13]=F*y+Q*A+ca*v+l[13];h[14]=H*y+S*A+ba*v+l[14];h[15]=K*y+X*A+Z*v+l[15]}return h},scale:function(h,l,v){var y=v[0],A=v[1];v=v[2];h[0]=
l[0]*y;h[1]=l[1]*y;h[2]=l[2]*y;h[3]=l[3]*y;h[4]=l[4]*A;h[5]=l[5]*A;h[6]=l[6]*A;h[7]=l[7]*A;h[8]=l[8]*v;h[9]=l[9]*v;h[10]=l[10]*v;h[11]=l[11]*v;h[12]=l[12];h[13]=l[13];h[14]=l[14];h[15]=l[15];return h},rotate:function(h,l,v,y){var A=y[0],C=y[1];y=y[2];var F=Math.hypot(A,C,y);if(.000001>F)return null;F=1/F;A*=F;C*=F;y*=F;var H=Math.sin(v);var K=Math.cos(v);var M=1-K;v=l[0];F=l[1];var Q=l[2];var S=l[3];var X=l[4];var U=l[5];var ca=l[6];var ba=l[7];var Z=l[8];var ra=l[9];var la=l[10];var oa=l[11];var pa=
A*A*M+K;var na=C*A*M+y*H;var za=y*A*M-C*H;var L=A*C*M-y*H;var N=C*C*M+K;var V=y*C*M+A*H;var aa=A*y*M+C*H;A=C*y*M-A*H;C=y*y*M+K;h[0]=v*pa+X*na+Z*za;h[1]=F*pa+U*na+ra*za;h[2]=Q*pa+ca*na+la*za;h[3]=S*pa+ba*na+oa*za;h[4]=v*L+X*N+Z*V;h[5]=F*L+U*N+ra*V;h[6]=Q*L+ca*N+la*V;h[7]=S*L+ba*N+oa*V;h[8]=v*aa+X*A+Z*C;h[9]=F*aa+U*A+ra*C;h[10]=Q*aa+ca*A+la*C;h[11]=S*aa+ba*A+oa*C;l!==h&&(h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]);return h},rotateX:function(h,l,v){var y=Math.sin(v);v=Math.cos(v);var A=l[4],C=l[5],
F=l[6],H=l[7],K=l[8],M=l[9],Q=l[10],S=l[11];l!==h&&(h[0]=l[0],h[1]=l[1],h[2]=l[2],h[3]=l[3],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]);h[4]=A*v+K*y;h[5]=C*v+M*y;h[6]=F*v+Q*y;h[7]=H*v+S*y;h[8]=K*v-A*y;h[9]=M*v-C*y;h[10]=Q*v-F*y;h[11]=S*v-H*y;return h},rotateY:function(h,l,v){var y=Math.sin(v);v=Math.cos(v);var A=l[0],C=l[1],F=l[2],H=l[3],K=l[8],M=l[9],Q=l[10],S=l[11];l!==h&&(h[4]=l[4],h[5]=l[5],h[6]=l[6],h[7]=l[7],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]);h[0]=A*v-K*y;h[1]=C*v-M*y;h[2]=
F*v-Q*y;h[3]=H*v-S*y;h[8]=A*y+K*v;h[9]=C*y+M*v;h[10]=F*y+Q*v;h[11]=H*y+S*v;return h},rotateZ:function(h,l,v){var y=Math.sin(v);v=Math.cos(v);var A=l[0],C=l[1],F=l[2],H=l[3],K=l[4],M=l[5],Q=l[6],S=l[7];l!==h&&(h[8]=l[8],h[9]=l[9],h[10]=l[10],h[11]=l[11],h[12]=l[12],h[13]=l[13],h[14]=l[14],h[15]=l[15]);h[0]=A*v+K*y;h[1]=C*v+M*y;h[2]=F*v+Q*y;h[3]=H*v+S*y;h[4]=K*v-A*y;h[5]=M*v-C*y;h[6]=Q*v-F*y;h[7]=S*v-H*y;return h},fromTranslation:function(h,l){h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;
h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=l[0];h[13]=l[1];h[14]=l[2];h[15]=1;return h},fromScaling:function(h,l){h[0]=l[0];h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=l[1];h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=l[2];h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromRotation:function(h,l,v){var y=v[0],A=v[1];v=v[2];var C=Math.hypot(y,A,v);if(.000001>C)return null;C=1/C;y*=C;A*=C;v*=C;C=Math.sin(l);l=Math.cos(l);var F=1-l;h[0]=y*y*F+l;h[1]=A*y*F+v*C;h[2]=v*y*F-A*C;h[3]=0;h[4]=y*A*F-v*C;h[5]=A*A*F+l;h[6]=v*A*F+y*C;h[7]=
0;h[8]=y*v*F+A*C;h[9]=A*v*F-y*C;h[10]=v*v*F+l;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromXRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=1;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=l;h[6]=v;h[7]=0;h[8]=0;h[9]=-v;h[10]=l;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromYRotation:function(h,l){var v=Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=0;h[2]=-v;h[3]=0;h[4]=0;h[5]=1;h[6]=0;h[7]=0;h[8]=v;h[9]=0;h[10]=l;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromZRotation:function(h,l){var v=
Math.sin(l);l=Math.cos(l);h[0]=l;h[1]=v;h[2]=0;h[3]=0;h[4]=-v;h[5]=l;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=1;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},fromRotationTranslation:n,fromQuat2:function(h,l){var v=new ma(3),y=-l[0],A=-l[1],C=-l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=y*y+A*A+C*C+F*F;0<S?(v[0]=2*(H*F+Q*y+K*C-M*A)/S,v[1]=2*(K*F+Q*A+M*y-H*C)/S,v[2]=2*(M*F+Q*C+H*A-K*y)/S):(v[0]=2*(H*F+Q*y+K*C-M*A),v[1]=2*(K*F+Q*A+M*y-H*C),v[2]=2*(M*F+Q*C+H*A-K*y));n(h,l,v);return h},getTranslation:u,getScaling:q,
getRotation:r,fromRotationTranslationScale:function(h,l,v,y){var A=l[0],C=l[1],F=l[2],H=l[3],K=A+A,M=C+C,Q=F+F;l=A*K;var S=A*M;A*=Q;var X=C*M;C*=Q;F*=Q;K*=H;M*=H;H*=Q;Q=y[0];var U=y[1];y=y[2];h[0]=(1-(X+F))*Q;h[1]=(S+H)*Q;h[2]=(A-M)*Q;h[3]=0;h[4]=(S-H)*U;h[5]=(1-(l+F))*U;h[6]=(C+K)*U;h[7]=0;h[8]=(A+M)*y;h[9]=(C-K)*y;h[10]=(1-(l+X))*y;h[11]=0;h[12]=v[0];h[13]=v[1];h[14]=v[2];h[15]=1;return h},fromRotationTranslationScaleOrigin:function(h,l,v,y,A){var C=l[0],F=l[1],H=l[2],K=l[3],M=C+C,Q=F+F,S=H+H;l=
C*M;var X=C*Q,U=C*S;C=F*Q;F*=S;var ca=H*S;H=K*M;Q*=K;var ba=K*S,Z=y[0],ra=y[1];S=y[2];y=A[0];K=A[1];A=A[2];M=(1-(C+ca))*Z;var la=(X+ba)*Z;Z*=U-Q;X=(X-ba)*ra;ca=(1-(l+ca))*ra;ra*=F+H;U=(U+Q)*S;F=(F-H)*S;l=(1-(l+C))*S;h[0]=M;h[1]=la;h[2]=Z;h[3]=0;h[4]=X;h[5]=ca;h[6]=ra;h[7]=0;h[8]=U;h[9]=F;h[10]=l;h[11]=0;h[12]=v[0]+y-(M*y+X*K+U*A);h[13]=v[1]+K-(la*y+ca*K+F*A);h[14]=v[2]+A-(Z*y+ra*K+l*A);h[15]=1;return h},fromQuat:function(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v+v,F=y+y,H=A+A;v*=C;var K=y*C;y*=
F;var M=A*C,Q=A*F;A*=H;C*=l;F*=l;l*=H;h[0]=1-y-A;h[1]=K+l;h[2]=M-F;h[3]=0;h[4]=K-l;h[5]=1-v-A;h[6]=Q+C;h[7]=0;h[8]=M+F;h[9]=Q-C;h[10]=1-v-y;h[11]=0;h[12]=0;h[13]=0;h[14]=0;h[15]=1;return h},frustum:function(h,l,v,y,A,C,F){var H=1/(v-l),K=1/(A-y),M=1/(C-F);h[0]=2*C*H;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=2*C*K;h[6]=0;h[7]=0;h[8]=(v+l)*H;h[9]=(A+y)*K;h[10]=(F+C)*M;h[11]=-1;h[12]=0;h[13]=0;h[14]=F*C*2*M;h[15]=0;return h},perspective:function(h,l,v,y,A){l=1/Math.tan(l/2);h[0]=l/v;h[1]=0;h[2]=0;h[3]=0;h[4]=
0;h[5]=l;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[11]=-1;h[12]=0;h[13]=0;h[15]=0;null!=A&&Infinity!==A?(v=1/(y-A),h[10]=(A+y)*v,h[14]=2*A*y*v):(h[10]=-1,h[14]=-2*y);return h},perspectiveFromFieldOfView:function(h,l,v,y){var A=Math.tan(l.upDegrees*Math.PI/180),C=Math.tan(l.downDegrees*Math.PI/180),F=Math.tan(l.leftDegrees*Math.PI/180);l=Math.tan(l.rightDegrees*Math.PI/180);var H=2/(F+l),K=2/(A+C);h[0]=H;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=K;h[6]=0;h[7]=0;h[8]=-((F-l)*H*.5);h[9]=(A-C)*K*.5;h[10]=y/(v-y);h[11]=-1;
h[12]=0;h[13]=0;h[14]=y*v/(v-y);h[15]=0;return h},ortho:function(h,l,v,y,A,C,F){var H=1/(l-v),K=1/(y-A),M=1/(C-F);h[0]=-2*H;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=-2*K;h[6]=0;h[7]=0;h[8]=0;h[9]=0;h[10]=2*M;h[11]=0;h[12]=(l+v)*H;h[13]=(A+y)*K;h[14]=(F+C)*M;h[15]=1;return h},lookAt:function(h,l,v,y){var A=l[0],C=l[1];l=l[2];var F=y[0];var H=y[1];var K=y[2];var M=v[0];y=v[1];var Q=v[2];if(.000001>Math.abs(A-M)&&.000001>Math.abs(C-y)&&.000001>Math.abs(l-Q))return m(h);v=A-M;y=C-y;M=l-Q;var S=1/Math.hypot(v,
y,M);v*=S;y*=S;M*=S;Q=H*M-K*y;K=K*v-F*M;F=F*y-H*v;(S=Math.hypot(Q,K,F))?(S=1/S,Q*=S,K*=S,F*=S):F=K=Q=0;H=y*F-M*K;var X=M*Q-v*F;var U=v*K-y*Q;(S=Math.hypot(H,X,U))?(S=1/S,H*=S,X*=S,U*=S):U=X=H=0;h[0]=Q;h[1]=H;h[2]=v;h[3]=0;h[4]=K;h[5]=X;h[6]=y;h[7]=0;h[8]=F;h[9]=U;h[10]=M;h[11]=0;h[12]=-(Q*A+K*C+F*l);h[13]=-(H*A+X*C+U*l);h[14]=-(v*A+y*C+M*l);h[15]=1;return h},targetTo:function(h,l,v,y){var A=l[0],C=l[1];l=l[2];var F=y[0],H=y[1],K=y[2];y=A-v[0];var M=C-v[1];v=l-v[2];var Q=y*y+M*M+v*v;0<Q&&(Q=1/Math.sqrt(Q),
y*=Q,M*=Q,v*=Q);var S=H*v-K*M;K=K*y-F*v;F=F*M-H*y;Q=S*S+K*K+F*F;0<Q&&(Q=1/Math.sqrt(Q),S*=Q,K*=Q,F*=Q);h[0]=S;h[1]=K;h[2]=F;h[3]=0;h[4]=M*F-v*K;h[5]=v*S-y*F;h[6]=y*K-M*S;h[7]=0;h[8]=y;h[9]=M;h[10]=v;h[11]=0;h[12]=A;h[13]=C;h[14]=l;h[15]=1;return h},str:function(h){return"mat4("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+", "+h[8]+", "+h[9]+", "+h[10]+", "+h[11]+", "+h[12]+", "+h[13]+", "+h[14]+", "+h[15]+")"},frob:function(h){return Math.hypot(h[0],h[1],h[2],h[3],h[4],
h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15])},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];h[4]=l[4]+v[4];h[5]=l[5]+v[5];h[6]=l[6]+v[6];h[7]=l[7]+v[7];h[8]=l[8]+v[8];h[9]=l[9]+v[9];h[10]=l[10]+v[10];h[11]=l[11]+v[11];h[12]=l[12]+v[12];h[13]=l[13]+v[13];h[14]=l[14]+v[14];h[15]=l[15]+v[15];return h},subtract:t,multiplyScalar:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;h[4]=l[4]*v;h[5]=l[5]*v;h[6]=l[6]*v;h[7]=l[7]*v;h[8]=l[8]*v;
h[9]=l[9]*v;h[10]=l[10]*v;h[11]=l[11]*v;h[12]=l[12]*v;h[13]=l[13]*v;h[14]=l[14]*v;h[15]=l[15]*v;return h},multiplyScalarAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;h[4]=l[4]+v[4]*y;h[5]=l[5]+v[5]*y;h[6]=l[6]+v[6]*y;h[7]=l[7]+v[7]*y;h[8]=l[8]+v[8]*y;h[9]=l[9]+v[9]*y;h[10]=l[10]+v[10]*y;h[11]=l[11]+v[11]*y;h[12]=l[12]+v[12]*y;h[13]=l[13]+v[13]*y;h[14]=l[14]+v[14]*y;h[15]=l[15]+v[15]*y;return h},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&
h[2]===l[2]&&h[3]===l[3]&&h[4]===l[4]&&h[5]===l[5]&&h[6]===l[6]&&h[7]===l[7]&&h[8]===l[8]&&h[9]===l[9]&&h[10]===l[10]&&h[11]===l[11]&&h[12]===l[12]&&h[13]===l[13]&&h[14]===l[14]&&h[15]===l[15]},equals:function(h,l){var v=h[0],y=h[1],A=h[2],C=h[3],F=h[4],H=h[5],K=h[6],M=h[7],Q=h[8],S=h[9],X=h[10],U=h[11],ca=h[12],ba=h[13],Z=h[14];h=h[15];var ra=l[0],la=l[1],oa=l[2],pa=l[3],na=l[4],za=l[5],L=l[6],N=l[7],V=l[8],aa=l[9],fa=l[10],ha=l[11],da=l[12],sa=l[13],ta=l[14];l=l[15];return Math.abs(v-ra)<=.000001*
Math.max(1,Math.abs(v),Math.abs(ra))&&Math.abs(y-la)<=.000001*Math.max(1,Math.abs(y),Math.abs(la))&&Math.abs(A-oa)<=.000001*Math.max(1,Math.abs(A),Math.abs(oa))&&Math.abs(C-pa)<=.000001*Math.max(1,Math.abs(C),Math.abs(pa))&&Math.abs(F-na)<=.000001*Math.max(1,Math.abs(F),Math.abs(na))&&Math.abs(H-za)<=.000001*Math.max(1,Math.abs(H),Math.abs(za))&&Math.abs(K-L)<=.000001*Math.max(1,Math.abs(K),Math.abs(L))&&Math.abs(M-N)<=.000001*Math.max(1,Math.abs(M),Math.abs(N))&&Math.abs(Q-V)<=.000001*Math.max(1,
Math.abs(Q),Math.abs(V))&&Math.abs(S-aa)<=.000001*Math.max(1,Math.abs(S),Math.abs(aa))&&Math.abs(X-fa)<=.000001*Math.max(1,Math.abs(X),Math.abs(fa))&&Math.abs(U-ha)<=.000001*Math.max(1,Math.abs(U),Math.abs(ha))&&Math.abs(ca-da)<=.000001*Math.max(1,Math.abs(ca),Math.abs(da))&&Math.abs(ba-sa)<=.000001*Math.max(1,Math.abs(ba),Math.abs(sa))&&Math.abs(Z-ta)<=.000001*Math.max(1,Math.abs(Z),Math.abs(ta))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},mul:p,sub:t}),La=function(){var h=x();return function(l,
v,y,A,C,F){v||(v=3);y||(y=0);for(A=A?Math.min(A*v+y,l.length):l.length;y<A;y+=v)h[0]=l[y],h[1]=l[y+1],h[2]=l[y+2],C(h,h,F),l[y]=h[0],l[y+1]=h[1],l[y+2]=h[2];return l}}();La=Object.freeze({__proto__:null,create:x,clone:function(h){var l=new ma(3);l[0]=h[0];l[1]=h[1];l[2]=h[2];return l},length:z,fromValues:D,copy:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];return h},set:function(h,l,v,y){h[0]=l;h[1]=v;h[2]=y;return h},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];h[2]=l[2]+v[2];return h},subtract:G,
multiply:w,divide:B,ceil:function(h,l){h[0]=Math.ceil(l[0]);h[1]=Math.ceil(l[1]);h[2]=Math.ceil(l[2]);return h},floor:function(h,l){h[0]=Math.floor(l[0]);h[1]=Math.floor(l[1]);h[2]=Math.floor(l[2]);return h},min:function(h,l,v){h[0]=Math.min(l[0],v[0]);h[1]=Math.min(l[1],v[1]);h[2]=Math.min(l[2],v[2]);return h},max:function(h,l,v){h[0]=Math.max(l[0],v[0]);h[1]=Math.max(l[1],v[1]);h[2]=Math.max(l[2],v[2]);return h},round:function(h,l){h[0]=Math.round(l[0]);h[1]=Math.round(l[1]);h[2]=Math.round(l[2]);
return h},scale:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;return h},scaleAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;return h},distance:I,squaredDistance:P,squaredLength:E,negate:function(h,l){h[0]=-l[0];h[1]=-l[1];h[2]=-l[2];return h},inverse:function(h,l){h[0]=1/l[0];h[1]=1/l[1];h[2]=1/l[2];return h},normalize:J,dot:O,cross:R,lerp:function(h,l,v,y){var A=l[0],C=l[1];l=l[2];h[0]=A+y*(v[0]-A);h[1]=C+y*(v[1]-C);h[2]=l+y*(v[2]-l);return h},hermite:function(h,
l,v,y,A,C){var F=C*C,H=F*(2*C-3)+1,K=F*(C-2)+C,M=F*(C-1);C=F*(3-2*C);h[0]=l[0]*H+v[0]*K+y[0]*M+A[0]*C;h[1]=l[1]*H+v[1]*K+y[1]*M+A[1]*C;h[2]=l[2]*H+v[2]*K+y[2]*M+A[2]*C;return h},bezier:function(h,l,v,y,A,C){var F=1-C,H=F*F,K=C*C,M=H*F;H*=3*C;F*=3*K;C*=K;h[0]=l[0]*M+v[0]*H+y[0]*F+A[0]*C;h[1]=l[1]*M+v[1]*H+y[1]*F+A[1]*C;h[2]=l[2]*M+v[2]*H+y[2]*F+A[2]*C;return h},random:function(h,l){l=l||1;var v=2*Ga()*Math.PI,y=2*Ga()-1,A=Math.sqrt(1-y*y)*l;h[0]=Math.cos(v)*A;h[1]=Math.sin(v)*A;h[2]=y*l;return h},
transformMat4:function(h,l,v){var y=l[0],A=l[1];l=l[2];var C=v[3]*y+v[7]*A+v[11]*l+v[15];C=C||1;h[0]=(v[0]*y+v[4]*A+v[8]*l+v[12])/C;h[1]=(v[1]*y+v[5]*A+v[9]*l+v[13])/C;h[2]=(v[2]*y+v[6]*A+v[10]*l+v[14])/C;return h},transformMat3:function(h,l,v){var y=l[0],A=l[1];l=l[2];h[0]=y*v[0]+A*v[3]+l*v[6];h[1]=y*v[1]+A*v[4]+l*v[7];h[2]=y*v[2]+A*v[5]+l*v[8];return h},transformQuat:function(h,l,v){var y=v[0],A=v[1],C=v[2],F=l[0],H=l[1];l=l[2];var K=A*l-C*H,M=C*F-y*l,Q=y*H-A*F;v=2*v[3];h[0]=F+K*v+2*(A*Q-C*M);h[1]=
H+M*v+2*(C*K-y*Q);h[2]=l+Q*v+2*(y*M-A*K);return h},rotateX:function(h,l,v,y){var A=[],C=[];A[0]=l[0]-v[0];A[1]=l[1]-v[1];A[2]=l[2]-v[2];C[0]=A[0];C[1]=A[1]*Math.cos(y)-A[2]*Math.sin(y);C[2]=A[1]*Math.sin(y)+A[2]*Math.cos(y);h[0]=C[0]+v[0];h[1]=C[1]+v[1];h[2]=C[2]+v[2];return h},rotateY:function(h,l,v,y){var A=[],C=[];A[0]=l[0]-v[0];A[1]=l[1]-v[1];A[2]=l[2]-v[2];C[0]=A[2]*Math.sin(y)+A[0]*Math.cos(y);C[1]=A[1];C[2]=A[2]*Math.cos(y)-A[0]*Math.sin(y);h[0]=C[0]+v[0];h[1]=C[1]+v[1];h[2]=C[2]+v[2];return h},
rotateZ:function(h,l,v,y){var A=[],C=[];A[0]=l[0]-v[0];A[1]=l[1]-v[1];A[2]=l[2]-v[2];C[0]=A[0]*Math.cos(y)-A[1]*Math.sin(y);C[1]=A[0]*Math.sin(y)+A[1]*Math.cos(y);C[2]=A[2];h[0]=C[0]+v[0];h[1]=C[1]+v[1];h[2]=C[2]+v[2];return h},angle:function(h,l){var v=h[0],y=h[1],A=h[2],C=l[0],F=l[1],H=l[2];h=(v=Math.sqrt(v*v+y*y+A*A)*Math.sqrt(C*C+F*F+H*H))&&O(h,l)/v;return Math.acos(Math.min(Math.max(h,-1),1))},zero:function(h){h[0]=0;h[1]=0;h[2]=0;return h},str:function(h){return"vec3("+h[0]+", "+h[1]+", "+h[2]+
")"},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]},equals:function(h,l){var v=h[0],y=h[1];h=h[2];var A=l[0],C=l[1];l=l[2];return Math.abs(v-A)<=.000001*Math.max(1,Math.abs(v),Math.abs(A))&&Math.abs(y-C)<=.000001*Math.max(1,Math.abs(y),Math.abs(C))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},sub:G,mul:w,div:B,dist:I,sqrDist:P,len:z,sqrLen:E,forEach:La});var Ma=function(){var h=T();return function(l,v,y,A,C,F){v||(v=4);y||(y=0);for(A=A?Math.min(A*v+y,l.length):
l.length;y<A;y+=v)h[0]=l[y],h[1]=l[y+1],h[2]=l[y+2],h[3]=l[y+3],C(h,h,F),l[y]=h[0],l[y+1]=h[1],l[y+2]=h[2],l[y+3]=h[3];return l}}();Ma=Object.freeze({__proto__:null,create:T,clone:Y,fromValues:W,copy:ea,set:qa,add:ja,subtract:xa,multiply:ua,divide:Da,ceil:function(h,l){h[0]=Math.ceil(l[0]);h[1]=Math.ceil(l[1]);h[2]=Math.ceil(l[2]);h[3]=Math.ceil(l[3]);return h},floor:function(h,l){h[0]=Math.floor(l[0]);h[1]=Math.floor(l[1]);h[2]=Math.floor(l[2]);h[3]=Math.floor(l[3]);return h},min:function(h,l,v){h[0]=
Math.min(l[0],v[0]);h[1]=Math.min(l[1],v[1]);h[2]=Math.min(l[2],v[2]);h[3]=Math.min(l[3],v[3]);return h},max:function(h,l,v){h[0]=Math.max(l[0],v[0]);h[1]=Math.max(l[1],v[1]);h[2]=Math.max(l[2],v[2]);h[3]=Math.max(l[3],v[3]);return h},round:function(h,l){h[0]=Math.round(l[0]);h[1]=Math.round(l[1]);h[2]=Math.round(l[2]);h[3]=Math.round(l[3]);return h},scale:Ea,scaleAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;h[2]=l[2]+v[2]*y;h[3]=l[3]+v[3]*y;return h},distance:Ba,squaredDistance:Aa,
length:ia,squaredLength:Fa,negate:function(h,l){h[0]=-l[0];h[1]=-l[1];h[2]=-l[2];h[3]=-l[3];return h},inverse:function(h,l){h[0]=1/l[0];h[1]=1/l[1];h[2]=1/l[2];h[3]=1/l[3];return h},normalize:wa,dot:Ca,cross:function(h,l,v,y){var A=v[0]*y[1]-v[1]*y[0],C=v[0]*y[2]-v[2]*y[0],F=v[0]*y[3]-v[3]*y[0],H=v[1]*y[2]-v[2]*y[1],K=v[1]*y[3]-v[3]*y[1];v=v[2]*y[3]-v[3]*y[2];y=l[0];var M=l[1],Q=l[2];l=l[3];h[0]=M*v-Q*K+l*H;h[1]=-(y*v)+Q*F-l*C;h[2]=y*K-M*F+l*A;h[3]=-(y*H)+M*C-Q*A;return h},lerp:Pa,random:function(h,
l){l=l||1;do{var v=2*Ga()-1;var y=2*Ga()-1;var A=v*v+y*y}while(1<=A);do{var C=2*Ga()-1;var F=2*Ga()-1;var H=C*C+F*F}while(1<=H);A=Math.sqrt((1-A)/H);h[0]=l*v;h[1]=l*y;h[2]=l*C*A;h[3]=l*F*A;return h},transformMat4:function(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];h[0]=v[0]*y+v[4]*A+v[8]*C+v[12]*l;h[1]=v[1]*y+v[5]*A+v[9]*C+v[13]*l;h[2]=v[2]*y+v[6]*A+v[10]*C+v[14]*l;h[3]=v[3]*y+v[7]*A+v[11]*C+v[15]*l;return h},transformQuat:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=v[0],H=v[1],K=v[2];v=v[3];var M=v*y+
H*C-K*A,Q=v*A+K*y-F*C,S=v*C+F*A-H*y;y=-F*y-H*A-K*C;h[0]=M*v+y*-F+Q*-K-S*-H;h[1]=Q*v+y*-H+S*-F-M*-K;h[2]=S*v+y*-K+M*-H-Q*-F;h[3]=l[3];return h},zero:function(h){h[0]=0;h[1]=0;h[2]=0;h[3]=0;return h},str:function(h){return"vec4("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},exactEquals:Qa,equals:Ra,sub:xa,mul:ua,div:Da,dist:Ba,sqrDist:Aa,len:ia,sqrLen:Fa,forEach:Ma});var Na=function(){var h=x(),l=D(1,0,0),v=D(0,1,0);return function(y,A,C){var F=O(A,C);if(-.999999>F)return R(h,l,A),.000001>z(h)&&R(h,v,A),
J(h,h),Sa(y,h,Math.PI),y;if(.999999<F)return y[0]=0,y[1]=0,y[2]=0,y[3]=1,y;R(h,A,C);y[0]=h[0];y[1]=h[1];y[2]=h[2];y[3]=1+F;return wa(y,y)}}(),Oa=function(){var h=Ja(),l=Ja();return function(v,y,A,C,F,H){Ka(h,y,F,H);Ka(l,A,C,H);Ka(v,h,l,2*H*(1-H));return v}}(),Ia=function(){var h=d();return function(l,v,y,A){h[0]=y[0];h[3]=y[1];h[6]=y[2];h[1]=A[0];h[4]=A[1];h[7]=A[2];h[2]=-v[0];h[5]=-v[1];h[8]=-v[2];return wa(l,Za(l,h))}}();Na=Object.freeze({__proto__:null,create:Ja,identity:function(h){h[0]=0;h[1]=
0;h[2]=0;h[3]=1;return h},setAxisAngle:Sa,getAxisAngle:function(h,l){var v=2*Math.acos(l[3]),y=Math.sin(v/2);.000001<y?(h[0]=l[0]/y,h[1]=l[1]/y,h[2]=l[2]/y):(h[0]=1,h[1]=0,h[2]=0);return v},getAngle:function(h,l){h=Ca(h,l);return Math.acos(2*h*h-1)},multiply:Ta,rotateX:Ua,rotateY:Va,rotateZ:Wa,calculateW:function(h,l){var v=l[0],y=l[1];l=l[2];h[0]=v;h[1]=y;h[2]=l;h[3]=Math.sqrt(Math.abs(1-v*v-y*y-l*l));return h},exp:Xa,ln:Ya,pow:function(h,l,v){Ya(h,l);Ea(h,h,v);Xa(h,h);return h},slerp:Ka,random:function(h){var l=
Ga(),v=Ga(),y=Ga(),A=Math.sqrt(1-l);l=Math.sqrt(l);h[0]=A*Math.sin(2*Math.PI*v);h[1]=A*Math.cos(2*Math.PI*v);h[2]=l*Math.sin(2*Math.PI*y);h[3]=l*Math.cos(2*Math.PI*y);return h},invert:function(h,l){var v=l[0],y=l[1],A=l[2];l=l[3];var C=v*v+y*y+A*A+l*l;C=C?1/C:0;h[0]=-v*C;h[1]=-y*C;h[2]=-A*C;h[3]=l*C;return h},conjugate:function(h,l){h[0]=-l[0];h[1]=-l[1];h[2]=-l[2];h[3]=l[3];return h},fromMat3:Za,fromEuler:function(h,l,v,y){var A=.5*Math.PI/180;l*=A;v*=A;y*=A;A=Math.sin(l);l=Math.cos(l);var C=Math.sin(v);
v=Math.cos(v);var F=Math.sin(y);y=Math.cos(y);h[0]=A*v*y-l*C*F;h[1]=l*C*y+A*v*F;h[2]=l*v*F-A*C*y;h[3]=l*v*y+A*C*F;return h},str:function(h){return"quat("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+")"},clone:Y,fromValues:W,copy:ea,set:qa,add:ja,mul:Ta,scale:Ea,dot:Ca,lerp:Pa,length:ia,len:ia,squaredLength:Fa,sqrLen:Fa,normalize:wa,exactEquals:Qa,equals:Ra,rotationTo:Na,sqlerp:Oa,setAxes:Ia});Oa=Object.freeze({__proto__:null,create:function(){var h=new ma(8);ma!=Float32Array&&(h[0]=0,h[1]=0,h[2]=0,h[4]=0,
h[5]=0,h[6]=0,h[7]=0);h[3]=1;return h},clone:function(h){var l=new ma(8);l[0]=h[0];l[1]=h[1];l[2]=h[2];l[3]=h[3];l[4]=h[4];l[5]=h[5];l[6]=h[6];l[7]=h[7];return l},fromValues:function(h,l,v,y,A,C,F,H){var K=new ma(8);K[0]=h;K[1]=l;K[2]=v;K[3]=y;K[4]=A;K[5]=C;K[6]=F;K[7]=H;return K},fromRotationTranslationValues:function(h,l,v,y,A,C,F){var H=new ma(8);H[0]=h;H[1]=l;H[2]=v;H[3]=y;A*=.5;C*=.5;F*=.5;H[4]=A*y+C*v-F*l;H[5]=C*y+F*h-A*v;H[6]=F*y+A*l-C*h;H[7]=-A*h-C*l-F*v;return H},fromRotationTranslation:$a,
fromTranslation:function(h,l){h[0]=0;h[1]=0;h[2]=0;h[3]=1;h[4]=.5*l[0];h[5]=.5*l[1];h[6]=.5*l[2];h[7]=0;return h},fromRotation:function(h,l){h[0]=l[0];h[1]=l[1];h[2]=l[2];h[3]=l[3];h[4]=0;h[5]=0;h[6]=0;h[7]=0;return h},fromMat4:function(h,l){var v=Ja();r(v,l);var y=new ma(3);u(y,l);$a(h,v,y);return h},copy:ab,identity:function(h){h[0]=0;h[1]=0;h[2]=0;h[3]=1;h[4]=0;h[5]=0;h[6]=0;h[7]=0;return h},set:function(h,l,v,y,A,C,F,H,K){h[0]=l;h[1]=v;h[2]=y;h[3]=A;h[4]=C;h[5]=F;h[6]=H;h[7]=K;return h},getReal:ea,
getDual:function(h,l){h[0]=l[4];h[1]=l[5];h[2]=l[6];h[3]=l[7];return h},setReal:ea,setDual:function(h,l){h[4]=l[0];h[5]=l[1];h[6]=l[2];h[7]=l[3];return h},getTranslation:function(h,l){var v=l[4],y=l[5],A=l[6],C=l[7],F=-l[0],H=-l[1],K=-l[2];l=l[3];h[0]=2*(v*l+C*F+y*K-A*H);h[1]=2*(y*l+C*H+A*F-v*K);h[2]=2*(A*l+C*K+v*H-y*F);return h},translate:function(h,l,v){var y=l[0],A=l[1],C=l[2],F=l[3],H=.5*v[0],K=.5*v[1];v=.5*v[2];var M=l[4],Q=l[5],S=l[6];l=l[7];h[0]=y;h[1]=A;h[2]=C;h[3]=F;h[4]=F*H+A*v-C*K+M;h[5]=
F*K+C*H-y*v+Q;h[6]=F*v+y*K-A*H+S;h[7]=-y*H-A*K-C*v+l;return h},rotateX:function(h,l,v){var y=-l[0],A=-l[1],C=-l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=H*F+Q*y+K*C-M*A,X=K*F+Q*A+M*y-H*C,U=M*F+Q*C+H*A-K*y;H=Q*F-H*y-K*A-M*C;Ua(h,l,v);y=h[0];A=h[1];C=h[2];F=h[3];h[4]=S*F+H*y+X*C-U*A;h[5]=X*F+H*A+U*y-S*C;h[6]=U*F+H*C+S*A-X*y;h[7]=H*F-S*y-X*A-U*C;return h},rotateY:function(h,l,v){var y=-l[0],A=-l[1],C=-l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=H*F+Q*y+K*C-M*A,X=K*F+Q*A+M*y-H*C,U=M*F+Q*C+H*A-K*y;H=Q*F-
H*y-K*A-M*C;Va(h,l,v);y=h[0];A=h[1];C=h[2];F=h[3];h[4]=S*F+H*y+X*C-U*A;h[5]=X*F+H*A+U*y-S*C;h[6]=U*F+H*C+S*A-X*y;h[7]=H*F-S*y-X*A-U*C;return h},rotateZ:function(h,l,v){var y=-l[0],A=-l[1],C=-l[2],F=l[3],H=l[4],K=l[5],M=l[6],Q=l[7],S=H*F+Q*y+K*C-M*A,X=K*F+Q*A+M*y-H*C,U=M*F+Q*C+H*A-K*y;H=Q*F-H*y-K*A-M*C;Wa(h,l,v);y=h[0];A=h[1];C=h[2];F=h[3];h[4]=S*F+H*y+X*C-U*A;h[5]=X*F+H*A+U*y-S*C;h[6]=U*F+H*C+S*A-X*y;h[7]=H*F-S*y-X*A-U*C;return h},rotateByQuatAppend:function(h,l,v){var y=v[0],A=v[1],C=v[2];v=v[3];
var F=l[0],H=l[1],K=l[2],M=l[3];h[0]=F*v+M*y+H*C-K*A;h[1]=H*v+M*A+K*y-F*C;h[2]=K*v+M*C+F*A-H*y;h[3]=M*v-F*y-H*A-K*C;F=l[4];H=l[5];K=l[6];M=l[7];h[4]=F*v+M*y+H*C-K*A;h[5]=H*v+M*A+K*y-F*C;h[6]=K*v+M*C+F*A-H*y;h[7]=M*v-F*y-H*A-K*C;return h},rotateByQuatPrepend:function(h,l,v){var y=l[0],A=l[1],C=l[2];l=l[3];var F=v[0],H=v[1],K=v[2],M=v[3];h[0]=y*M+l*F+A*K-C*H;h[1]=A*M+l*H+C*F-y*K;h[2]=C*M+l*K+y*H-A*F;h[3]=l*M-y*F-A*H-C*K;F=v[4];H=v[5];K=v[6];M=v[7];h[4]=y*M+l*F+A*K-C*H;h[5]=A*M+l*H+C*F-y*K;h[6]=C*M+
l*K+y*H-A*F;h[7]=l*M-y*F-A*H-C*K;return h},rotateAroundAxis:function(h,l,v,y){if(.000001>Math.abs(y))return ab(h,l);var A=Math.hypot(v[0],v[1],v[2]);y*=.5;var C=Math.sin(y),F=C*v[0]/A,H=C*v[1]/A;v=C*v[2]/A;y=Math.cos(y);A=l[0];C=l[1];var K=l[2],M=l[3];h[0]=A*y+M*F+C*v-K*H;h[1]=C*y+M*H+K*F-A*v;h[2]=K*y+M*v+A*H-C*F;h[3]=M*y-A*F-C*H-K*v;A=l[4];C=l[5];K=l[6];l=l[7];h[4]=A*y+l*F+C*v-K*H;h[5]=C*y+l*H+K*F-A*v;h[6]=K*y+l*v+A*H-C*F;h[7]=l*y-A*F-C*H-K*v;return h},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+
v[1];h[2]=l[2]+v[2];h[3]=l[3]+v[3];h[4]=l[4]+v[4];h[5]=l[5]+v[5];h[6]=l[6]+v[6];h[7]=l[7]+v[7];return h},multiply:bb,mul:bb,scale:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;h[2]=l[2]*v;h[3]=l[3]*v;h[4]=l[4]*v;h[5]=l[5]*v;h[6]=l[6]*v;h[7]=l[7]*v;return h},dot:Ca,lerp:function(h,l,v,y){var A=1-y;0>Ca(l,v)&&(y=-y);h[0]=l[0]*A+v[0]*y;h[1]=l[1]*A+v[1]*y;h[2]=l[2]*A+v[2]*y;h[3]=l[3]*A+v[3]*y;h[4]=l[4]*A+v[4]*y;h[5]=l[5]*A+v[5]*y;h[6]=l[6]*A+v[6]*y;h[7]=l[7]*A+v[7]*y;return h},invert:function(h,l){var v=Fa(l);
h[0]=-l[0]/v;h[1]=-l[1]/v;h[2]=-l[2]/v;h[3]=l[3]/v;h[4]=-l[4]/v;h[5]=-l[5]/v;h[6]=-l[6]/v;h[7]=l[7]/v;return h},conjugate:function(h,l){h[0]=-l[0];h[1]=-l[1];h[2]=-l[2];h[3]=l[3];h[4]=-l[4];h[5]=-l[5];h[6]=-l[6];h[7]=l[7];return h},length:ia,len:ia,squaredLength:Fa,sqrLen:Fa,normalize:function(h,l){var v=Fa(l);if(0<v){v=Math.sqrt(v);var y=l[0]/v,A=l[1]/v,C=l[2]/v,F=l[3]/v,H=l[4],K=l[5],M=l[6];l=l[7];var Q=y*H+A*K+C*M+F*l;h[0]=y;h[1]=A;h[2]=C;h[3]=F;h[4]=(H-y*Q)/v;h[5]=(K-A*Q)/v;h[6]=(M-C*Q)/v;h[7]=
(l-F*Q)/v}return h},str:function(h){return"quat2("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]+", "+h[4]+", "+h[5]+", "+h[6]+", "+h[7]+")"},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]&&h[2]===l[2]&&h[3]===l[3]&&h[4]===l[4]&&h[5]===l[5]&&h[6]===l[6]&&h[7]===l[7]},equals:function(h,l){var v=h[0],y=h[1],A=h[2],C=h[3],F=h[4],H=h[5],K=h[6];h=h[7];var M=l[0],Q=l[1],S=l[2],X=l[3],U=l[4],ca=l[5],ba=l[6];l=l[7];return Math.abs(v-M)<=.000001*Math.max(1,Math.abs(v),Math.abs(M))&&Math.abs(y-Q)<=.000001*
Math.max(1,Math.abs(y),Math.abs(Q))&&Math.abs(A-S)<=.000001*Math.max(1,Math.abs(A),Math.abs(S))&&Math.abs(C-X)<=.000001*Math.max(1,Math.abs(C),Math.abs(X))&&Math.abs(F-U)<=.000001*Math.max(1,Math.abs(F),Math.abs(U))&&Math.abs(H-ca)<=.000001*Math.max(1,Math.abs(H),Math.abs(ca))&&Math.abs(K-ba)<=.000001*Math.max(1,Math.abs(K),Math.abs(ba))&&Math.abs(h-l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))}});Ia=function(){var h=cb();return function(l,v,y,A,C,F){v||(v=2);y||(y=0);for(A=A?Math.min(A*v+y,l.length):
l.length;y<A;y+=v)h[0]=l[y],h[1]=l[y+1],C(h,h,F),l[y]=h[0],l[y+1]=h[1];return l}}();Ia=Object.freeze({__proto__:null,create:cb,clone:function(h){var l=new ma(2);l[0]=h[0];l[1]=h[1];return l},fromValues:function(h,l){var v=new ma(2);v[0]=h;v[1]=l;return v},copy:function(h,l){h[0]=l[0];h[1]=l[1];return h},set:function(h,l,v){h[0]=l;h[1]=v;return h},add:function(h,l,v){h[0]=l[0]+v[0];h[1]=l[1]+v[1];return h},subtract:db,multiply:eb,divide:fb,ceil:function(h,l){h[0]=Math.ceil(l[0]);h[1]=Math.ceil(l[1]);
return h},floor:function(h,l){h[0]=Math.floor(l[0]);h[1]=Math.floor(l[1]);return h},min:function(h,l,v){h[0]=Math.min(l[0],v[0]);h[1]=Math.min(l[1],v[1]);return h},max:function(h,l,v){h[0]=Math.max(l[0],v[0]);h[1]=Math.max(l[1],v[1]);return h},round:function(h,l){h[0]=Math.round(l[0]);h[1]=Math.round(l[1]);return h},scale:function(h,l,v){h[0]=l[0]*v;h[1]=l[1]*v;return h},scaleAndAdd:function(h,l,v,y){h[0]=l[0]+v[0]*y;h[1]=l[1]+v[1]*y;return h},distance:gb,squaredDistance:hb,length:ib,squaredLength:jb,
negate:function(h,l){h[0]=-l[0];h[1]=-l[1];return h},inverse:function(h,l){h[0]=1/l[0];h[1]=1/l[1];return h},normalize:function(h,l){var v=l[0],y=l[1];v=v*v+y*y;0<v&&(v=1/Math.sqrt(v));h[0]=l[0]*v;h[1]=l[1]*v;return h},dot:function(h,l){return h[0]*l[0]+h[1]*l[1]},cross:function(h,l,v){l=l[0]*v[1]-l[1]*v[0];h[0]=h[1]=0;h[2]=l;return h},lerp:function(h,l,v,y){var A=l[0];l=l[1];h[0]=A+y*(v[0]-A);h[1]=l+y*(v[1]-l);return h},random:function(h,l){l=l||1;var v=2*Ga()*Math.PI;h[0]=Math.cos(v)*l;h[1]=Math.sin(v)*
l;return h},transformMat2:function(h,l,v){var y=l[0];l=l[1];h[0]=v[0]*y+v[2]*l;h[1]=v[1]*y+v[3]*l;return h},transformMat2d:function(h,l,v){var y=l[0];l=l[1];h[0]=v[0]*y+v[2]*l+v[4];h[1]=v[1]*y+v[3]*l+v[5];return h},transformMat3:function(h,l,v){var y=l[0];l=l[1];h[0]=v[0]*y+v[3]*l+v[6];h[1]=v[1]*y+v[4]*l+v[7];return h},transformMat4:function(h,l,v){var y=l[0];l=l[1];h[0]=v[0]*y+v[4]*l+v[12];h[1]=v[1]*y+v[5]*l+v[13];return h},rotate:function(h,l,v,y){var A=l[0]-v[0];l=l[1]-v[1];var C=Math.sin(y);y=
Math.cos(y);h[0]=A*y-l*C+v[0];h[1]=A*C+l*y+v[1];return h},angle:function(h,l){var v=h[0];h=h[1];var y=l[0];l=l[1];var A=Math.sqrt(v*v+h*h)*Math.sqrt(y*y+l*l);return Math.acos(Math.min(Math.max(A&&(v*y+h*l)/A,-1),1))},zero:function(h){h[0]=0;h[1]=0;return h},str:function(h){return"vec2("+h[0]+", "+h[1]+")"},exactEquals:function(h,l){return h[0]===l[0]&&h[1]===l[1]},equals:function(h,l){var v=h[0];h=h[1];var y=l[0];l=l[1];return Math.abs(v-y)<=.000001*Math.max(1,Math.abs(v),Math.abs(y))&&Math.abs(h-
l)<=.000001*Math.max(1,Math.abs(h),Math.abs(l))},len:ib,sub:db,mul:eb,div:fb,dist:gb,sqrDist:hb,sqrLen:jb,forEach:Ia});f.glMatrix=lb;f.mat2=mb;f.mat2d=nb;f.mat3=ob;f.mat4=pb;f.quat=Na;f.quat2=Oa;f.vec2=Ia;f.vec3=La;f.vec4=Ma;Object.defineProperty(f,"__esModule",{value:!0})});"use strict";
{function f(E,J,O){var R=[0,0];var T=E[1][1]-E[0][1];var Y=E[0][0]-E[1][0];E=T*E[0][0]+Y*E[0][1];var W=J[1][1]-J[0][1];var ea=J[0][0]-J[1][0];J=W*J[0][0]+ea*J[0][1];var qa=T*ea-W*Y;I(qa,0,O||0)||(R[0]=(ea*E-Y*J)/qa,R[1]=(T*J-W*E)/qa);return R}function b(E,J,O,R){var T=J[0]-E[0];J=J[1]-E[1];var Y=R[0]-O[0],W=R[1]-O[1];if(0===Y*J-W*T)return!1;R=(T*(O[1]-E[1])+J*(E[0]-O[0]))/(Y*J-W*T);E=(Y*(E[1]-O[1])+W*(O[0]-E[0]))/(W*T-Y*J);return 0<=R&&1>=R&&0<=E&&1>=E}function a(E,J,O){return(J[0]-E[0])*(O[1]-E[1])-
(O[0]-E[0])*(J[1]-E[1])}function e(E,J,O){return 0<a(E,J,O)}function c(E,J,O){return 0<=a(E,J,O)}function d(E,J,O){return 0>a(E,J,O)}function g(E,J,O){return 0>=a(E,J,O)}var tmpPoint1=[],tmpPoint2=[];function k(E,J,O,R){if(R){var T=tmpPoint1,Y=tmpPoint2;T[0]=J[0]-E[0];T[1]=J[1]-E[1];Y[0]=O[0]-J[0];Y[1]=O[1]-J[1];return Math.acos((T[0]*Y[0]+T[1]*Y[1])/(Math.sqrt(T[0]*T[0]+T[1]*T[1])*Math.sqrt(Y[0]*Y[0]+Y[1]*Y[1])))<R}return 0===a(E,J,O)}function m(E,J){var O=J[0]-E[0];E=J[1]-E[1];return O*O+E*E}function p(E,
J){var O=E.length;return E[0>J?J%O+O:J%O]}function n(E){E.length=0}function u(E,J,O,R){for(;O<R;O++)E.push(J[O])}function q(E){for(var J=[],O=E.length,R=0;R!==O;R++)J.push(E.pop());for(R=0;R!==O;R++)E[R]=J[R]}function r(E,J){return d(p(E,J-1),p(E,J),p(E,J+1))}var tmpLine1=[],tmpLine2=[];function t(E,J,O){var R=tmpLine1,T=tmpLine2;if(c(p(E,J+1),p(E,J),p(E,O))&&g(p(E,J-1),p(E,J),p(E,O)))return!1;var Y=m(p(E,J),p(E,O));for(var W=0;W!==E.length;++W)if((W+1)%E.length!==J&&W!==J&&c(p(E,J),p(E,O),p(E,W+
1))&&g(p(E,J),p(E,O),p(E,W))){R[0]=p(E,J);R[1]=p(E,O);T[0]=p(E,W);T[1]=p(E,W+1);var ea=f(R,T);if(m(p(E,J),ea)<Y)return!1}return!0}function x(E,J,O){for(var R=0;R!==E.length;++R)if(R!==J&&R!==O&&(R+1)%E.length!==J&&(R+1)%E.length!==O&&b(p(E,J),p(E,O),p(E,R),p(E,R+1)))return!1;return!0}function z(E,J,O,R){R=R||[];n(R);if(J<O)for(var T=J;T<=O;T++)R.push(E[T]);else{for(T=0;T<=O;T++)R.push(E[T]);for(T=J;T<E.length;T++)R.push(E[T])}return R}function D(E){for(var J=[],O,R,T=[],Y=Number.MAX_VALUE,W=0;W<E.length;++W)if(r(E,
W))for(var ea=0;ea<E.length;++ea)if(t(E,W,ea)){O=D(z(E,W,ea,T));R=D(z(E,ea,W,T));for(var qa=0;qa<R.length;qa++)O.push(R[qa]);O.length<Y&&(J=O,Y=O.length,J.push([p(E,W),p(E,ea)]))}return J}function G(E,J){if(0===J.length)return[E];if(J instanceof Array&&J.length&&J[0]instanceof Array&&2===J[0].length&&J[0][0]instanceof Array){E=[E];for(var O=0;O<J.length;O++)for(var R=J[O],T=0;T<E.length;T++){var Y=G(E[T],R);if(Y){E.splice(T,1);E.push(Y[0],Y[1]);break}}return E}R=J;O=E.indexOf(R[0]);T=E.indexOf(R[1]);
return-1!==O&&-1!==T?[z(E,O,T),z(E,T,O)]:!1}function w(E,J,O,R,T){var Y=J[1]-E[1];J=E[0]-J[0];E=Y*E[0]+J*E[1];var W=R[1]-O[1];R=O[0]-R[0];O=W*O[0]+R*O[1];var ea=Y*R-W*J;return I(ea,0,T||0)?[0,0]:[(R*E-J*O)/ea,(Y*O-W*E)/ea]}function B(E,J,O,R,T,Y,W){Y=Y||100;W=W||0;T=T||25;J="undefined"!==typeof J?J:[];O=O||[];R=R||[];var ea=[0,0],qa=[0,0],ja=[0,0],xa,ua=0,Da=0,Ea=0,Ba=[],Aa=[];if(3>E.length)return J;W++;if(W>Y)return console.warn("quickDecomp: max level ("+Y+") reached."),J;for(var ia=0;ia<E.length;++ia)if(r(E,
ia)){O.push(E[ia]);var Fa=xa=Number.MAX_VALUE;for(var wa=0;wa<E.length;++wa){if(e(p(E,ia-1),p(E,ia),p(E,wa))&&g(p(E,ia-1),p(E,ia),p(E,wa-1))&&(ja=w(p(E,ia-1),p(E,ia),p(E,wa),p(E,wa-1)),d(p(E,ia+1),p(E,ia),ja))){var Ca=m(E[ia],ja);Ca<xa&&(xa=Ca,qa=ja,Da=wa)}e(p(E,ia+1),p(E,ia),p(E,wa+1))&&g(p(E,ia+1),p(E,ia),p(E,wa))&&(ja=w(p(E,ia+1),p(E,ia),p(E,wa),p(E,wa+1)),e(p(E,ia-1),p(E,ia),ja)&&(Ca=m(E[ia],ja),Ca<Fa&&(Fa=Ca,ea=ja,ua=wa)))}if(Da===(ua+1)%E.length)ja[0]=(qa[0]+ea[0])/2,ja[1]=(qa[1]+ea[1])/2,R.push(ja),
ia<ua?(u(Ba,E,ia,ua+1),Ba.push(ja),Aa.push(ja),0!==Da&&u(Aa,E,Da,E.length),u(Aa,E,0,ia+1)):(0!==ia&&u(Ba,E,ia,E.length),u(Ba,E,0,ua+1),Ba.push(ja),Aa.push(ja),u(Aa,E,Da,ia+1));else{Da>ua&&(ua+=E.length);ea=Number.MAX_VALUE;if(ua<Da)return J;for(wa=Da;wa<=ua;++wa)c(p(E,ia-1),p(E,ia),p(E,wa))&&g(p(E,ia+1),p(E,ia),p(E,wa))&&(Ca=m(p(E,ia),p(E,wa)),Ca<ea&&x(E,ia,wa)&&(ea=Ca,Ea=wa%E.length));ia<Ea?(u(Ba,E,ia,Ea+1),0!==Ea&&u(Aa,E,Ea,E.length),u(Aa,E,0,ia+1)):(0!==ia&&u(Ba,E,ia,E.length),u(Ba,E,0,Ea+1),u(Aa,
E,Ea,ia+1))}Ba.length<Aa.length?(B(Ba,J,O,R,T,Y,W),B(Aa,J,O,R,T,Y,W)):(B(Aa,J,O,R,T,Y,W),B(Ba,J,O,R,T,Y,W));return J}J.push(E);return J}function I(E,J,O){return Math.abs(E-J)<=(O||0)}function P(E,J,O){return I(E[0],J[0],O)&&I(E[1],J[1],O)}self.polyDecomp={decomp:function(E){var J=D(E);return 0<J.length?G(E,J):[E]},quickDecomp:B,isSimple:function(E){var J;for(J=0;J<E.length-1;J++)for(var O=0;O<J-1;O++)if(b(E[J],E[J+1],E[O],E[O+1]))return!1;for(J=1;J<E.length-2;J++)if(b(E[0],E[E.length-1],E[J],E[J+
1]))return!1;return!0},removeCollinearPoints:function(E,J){for(var O=0,R=E.length-1;3<E.length&&0<=R;--R)k(p(E,R-1),p(E,R),p(E,R+1),J)&&(E.splice(R%E.length,1),O++);return O},removeDuplicatePoints:function(E,J){for(var O=E.length-1;1<=O;--O)for(var R=E[O],T=O-1;0<=T;--T)P(R,E[T],J)&&E.splice(O,1)},makeCCW:function(E){for(var J=0,O=1;O<E.length;++O)if(E[O][1]<E[J][1]||E[O][1]===E[J][1]&&E[O][0]>E[J][0])J=O;if(e(p(E,J-1),p(E,J),p(E,J+1)))return!1;q(E);return!0}}}"use strict";
{let f=!1,b=!1,a="dev";const e=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){f=!0}static IsReady(){return f}static SetAppStarted(){b=!0}static HasAppStarted(){return b}static SetBuildMode(c){a=c}static GetBuildMode(){return a}static IsReleaseBuild(){return"final"===a}};e.isDebug=!1;e.isDebugDefend=!1;e.hardwareConcurrency=navigator.hardwareConcurrency||2}"use strict";
{const f=self.C3;f.QueryParser=class{constructor(b){this._queryString=b;this._parameters=new Map;this._Parse()}_Parse(){var b=this._queryString;if(b.startsWith("?")||b.startsWith("#"))b=b.substr(1);b=b.split("&");for(const a of b)this._ParseParameter(a)}_ParseParameter(b){if(b)if(b.includes("=")){var a=b.indexOf("="),e=decodeURIComponent(b.substring(0,a));b=decodeURIComponent(b.substring(a+1));this._parameters.set(e,b)}else this._parameters.set(b,null)}LogAll(){for(const b of this._parameters)console.log("[QueryParser] Parameter '"+
b[0]+"' = "+(null===b[1]?"null":"'"+b[1]+"'"))}Has(b){return this._parameters.has(b)}Get(b){b=this._parameters.get(b);return"undefined"===typeof b?null:b}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(b){this._queryString=b;this._parameters.clear();this._Parse()}};f.QueryString=new f.QueryParser(location.search);f.LocationHashString=new f.QueryParser(location.hash);"dev"!==f.QueryString.Get("mode")&&f.SetBuildMode("final")}"use strict";
{const f=self.C3,b=navigator.userAgent;let a={linux:/linux|openbsd|freebsd|netbsd/i.test(b),chromeOS:/CrOS/.test(b),windowsTizen:/trident|iemobile|msie|tizen/i.test(b),genericMS:/trident|iemobile|msie|edge\//i.test(b),opera:/OPR\//.test(b),blackberry:/bb10/i.test(b),edge:/edge\//i.test(b),trident:/trident/i.test(b),webkit:/webkit/i.test(b),safari:/safari\//i.test(b),chrome:/chrome\//i.test(b),chromium:/chromium\//i.test(b),crosswalk:/crosswalk|xwalk/i.test(b),nwjs:/nwjs/i.test(b),amazonwebapp:/amazonwebappplatform/i.test(b),
webview:/wv\)/.test(b),android:/android/i.test(b),nokia:/nokiabrowser\/[0-9.]+/i.test(b)};var JSCompiler_object_inline_windows_0=/windows\s+nt\s+\d+\.\d+/i.exec(b),JSCompiler_object_inline_OSX_1=/mac\s+os\s+x\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_android_2=/android\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_opera_3=/OPR\/[0-9.]+/.exec(b),JSCompiler_object_inline_tizen_4=/tizen\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_iphone_5=/iphone\s+os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_ipad_6=
/ipad[^)]*os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_winPhone_7=/windows\s+phone\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_winPhoneOS_8=/windows\s+phone\s+os\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_chrome_9=/chrome\/[0-9.]+/i.exec(b),JSCompiler_object_inline_chromium_10=/chromium\/[0-9.]+/i.exec(b),JSCompiler_object_inline_nwjs_11=/nwjs\/[0-9.]+/i.exec(b),JSCompiler_object_inline_firefox_12=/firefox\/[0-9.]+/i.exec(b),JSCompiler_object_inline_ie_13=/msie\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_edge_14=
/edge\/[0-9.]+/i.exec(b),JSCompiler_object_inline_edgeChromium_15=/edg\/[0-9.]+/i.exec(b),JSCompiler_object_inline_silk_16=/silk\/[0-9.]+/i.exec(b);let e="(unknown)",c="(unknown)",d="(unknown)",g="(unknown)",k="(unknown)",m="(unknown)",p="(unknown)",n="browser",u=!1,q=!1,r=new Map;function t(z,D,G){!0===D?(G(),r.set(z,!0)):D&&D.length&&(G(D[0]),r.set(z,!0))}t("isWindows",JSCompiler_object_inline_windows_0,z=>{e="Windows";if(z=z.split(" ")[2])switch(z){case "5.0":c="2000";break;case "5.1":c="XP";break;
case "5.2":c="XP";break;case "6.0":c="Vista";break;case "6.1":c="7";break;case "6.2":c="8";break;case "6.3":c="8.1";break;case "10.0":c="10"}});t("isOSX",JSCompiler_object_inline_OSX_1,z=>{e="Mac OS X";(z=z.split(" ")[3])&&(c=z.replace("_","."))});t("isLinux",a.linux,()=>{e="Linux"});t("isChromeOS",a.chromeOS,()=>{e="Chrome OS"});t("isAndroid",!a.windowsTizen&&JSCompiler_object_inline_android_2,z=>{e="Android";(z=z.split(" ")[1])&&(c=z)});t("isTizen",JSCompiler_object_inline_tizen_4,z=>{e="Tizen";
(z=z.split(" ")[1])&&(c=z)});t("isIPhone",!a.windowsTizen&&JSCompiler_object_inline_iphone_5,z=>{e="iOS";(z=z.split(" ")[2])&&(c=z.replace("_","."))});t("isIPad",!a.windowsTizen&&JSCompiler_object_inline_ipad_6,z=>{e="iOS";(z=z.split(" ")[3])&&(c=z.replace("_","."))});t("isWindowsPhone",JSCompiler_object_inline_winPhone_7,z=>{e="Windows Phone";(z=z.split(" ")[2])&&(c=z)});t("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_8,z=>{e="Windows Phone";(z=z.split(" ")[3])&&(c=z)});t("isBlackberry",
a.blackberry,()=>{e="Blackberry";c="10";g="stock";p="webkit"});t("isChrome",!a.edge&&!a.opera&&JSCompiler_object_inline_chrome_9,z=>{g="Chrome";p="Chromium";(z=z.split("/")[1])&&(k=z)});t("isOpera",JSCompiler_object_inline_opera_3,z=>{g="Opera";p="Chromium";(z=z.split("/")[1])&&(k=z)});t("isChromium",JSCompiler_object_inline_chromium_10,z=>{p=g="Chromium";(z=z.split("/")[1])&&(k=z)});t("isFirefox",JSCompiler_object_inline_firefox_12,z=>{g="Firefox";p="Gecko";(z=z.split("/")[1])&&(k=z)});t("isInternetExplorer",
JSCompiler_object_inline_ie_13,z=>{g="Internet Explorer";p="Trident";(z=z.split(" ")[1])&&(k=z)});t("isTrident","Internet Explorer"!==g&&a.trident,()=>{p="Trident";var z=/rv:[0-9.]+/i.exec(b);z&&z.length&&(g="Internet Explorer",(z=z[0].split(":")[1])&&(k=z))});t("isEdge",JSCompiler_object_inline_edge_14,z=>{p=g="Edge";(z=z.split("/")[1])&&(k=z)});t("isEdgeChromium",JSCompiler_object_inline_edgeChromium_15,z=>{g="Edge";p="Chromium";(z=z.split("/")[1])&&(k=z)});t("isSafari",a.safari&&!a.nokia&&!a.chrome&&
!a.chromium&&!a.genericIE&&!a.blackberry,()=>{g="Safari";p="WebKit";var z=/version\/[0-9.]+/i.exec(b),D=/crios\/[0-9.]+/i.exec(b),G=/fxios\/[0-9.]+/i.exec(b);z&&z.length&&(z=z[0].split("/")[1])&&(k=z);D&&D.length&&(g="Chrome for iOS",(D=D[0].split("/")[1])&&(k=D));G&&G.length&&(g="Firefox for iOS",(G=G[0].split("/")[1])&&(k=G))});t("isSilk",JSCompiler_object_inline_silk_16,z=>{g="Silk";(z=z.split("/")[1])&&(k=z)});t("isCrosswalk",a.crosswalk,()=>n="crosswalk");t("isCordova",self.device&&(self.device.cordova||
self.device.phonegap),()=>n="cordova");t("isNWJS",JSCompiler_object_inline_nwjs_11,z=>{n="nwjs";g="NW.js";p="Chromium";(z=z.split("/")[1])&&(k=z)});t("isAmazonWebApp",a.amazonwebapp,()=>n="webapp");t("isHomeScreenWebApp","nwjs"!==n&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>n="webapp");t("isFalseSafari","Safari"===g&&("Android"===e||"Tizen"===e||"Blackberry"===e),()=>g="stock");t("isAndroidWebview","Chrome"===
g&&"browser"===n&&a.webview,()=>n="webview");t("isFirefoxOS","Firefox"===g&&"(unknown)"===e,()=>e="Firefox OS");t("isAndroidFallback","(unknown)"===e&&!a.windowsTizen&&a.android,()=>e="Android");t("isTridentFallback","(unknown)"===e&&a.trident,()=>p="Trident");t("isWebkitFallback","(unknown)"===e&&a.webkit,()=>p="WebKit");t("is64Bit",(z=>z.test(b)||z.test(navigator.platform)||"x64"===navigator.cpuClass)(/x86_64|x86-64|win64|x64;|x64\)|x64_|amd64|wow64|ia64|arm64|arch64|sparc64|ppc64|irix64/i),()=>
d="64-bit");t("is32Bit",(z=>z.test(b)||z.test(navigator.platform)||"x86"===navigator.cpuClass)(/x86;|x86\)|i86|i386|i486|i586|i686|armv1|armv2|armv3|armv4|armv5|armv6|armv7/i),()=>d="32-bit");t("is64BitFallback","(unknown)"===d&&"Mac OS X"===e&&10.7<=parseFloat(c),()=>d="64-bit");t("is32BitFallback","(unknown)"===d&&"Windows"===e||"Android"===e&&5>parseFloat(c),()=>d="32-bit");t("is32BitBrowser","32-bit"===d||/wow64/i.test(b),()=>m="32-bit");t("is64BitBrowser",/win64/i.test(b),()=>m="64-bit");t("isDesktop",
(()=>"Windows"===e||"Mac OS X"===e||"Linux"===e||"Chrome OS"===e||"nwjs"===n)(),()=>u=!0);"Edge"===p&&"undefined"!==typeof Windows&&"undefined"!==typeof Windows.System&&(n="windows-store");q="nwjs"===n;const x="Mac OS X"===e&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;x&&(e="iOS",c=k,q=u=!1);f.Platform={OS:e,OSVersion:c,OSArchitecture:d,Browser:g,BrowserVersion:k,BrowserVersionNumber:parseFloat(k),BrowserArchitecture:m,BrowserEngine:p,Context:n,IsDesktop:u,IsMobile:!u,IsDesktopApp:q,IsChromeWebStore:!!(self.chrome&&
self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===e||"iOS"===e,IsIpadOS:x}}"use strict";
{const f=new Map,b="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAll,a="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAllKeys;function e(r){return new Promise((t,x)=>{r.onsuccess=()=>t(r.result);r.onerror=()=>x(r.error)})}function c(r){return new Promise((t,x)=>{r.oncomplete=()=>t();r.onerror=()=>x(r.error);r.onabort=()=>x(r.error)})}function d(r,t){return k(r,t)}function g(r,t){return k(r,t,!0)}async function k(r,t,x=!1,
z=!0){const D=await m(r);try{const G=D.transaction(["keyvaluepairs"],x?"readwrite":"readonly");return t(G)}catch(G){if(z&&"InvalidStateError"===G.name)return f.delete(r),k(r,t,x,!1);throw G;}}function m(r){n(r);let t=f.get(r);t instanceof Promise||(t=p(r),f.set(r,t),t.catch(x=>f.delete(r)));return t}async function p(r){n(r);const t=indexedDB.open(r,2);t.addEventListener("upgradeneeded",x=>{try{x.target.result.createObjectStore("keyvaluepairs")}catch(z){console.error(`Failed to create objectstore for database ${r}`,
z)}});return e(t)}function n(r){if("string"!==typeof r)throw new TypeError("expected string");}function u(r,t){const x=r.objectStore("keyvaluepairs").openCursor();return new Promise(z=>{const D=[];x.onsuccess=G=>{if(G=G.target.result){switch(t){case "entries":D.push([G.key,G.value]);break;case "keys":D.push(G.key);break;case "values":D.push(G.value)}G.continue()}else z(D)}})}class q{constructor(r){n(r);this.name=r}async ready(){await m(this.name)}set(r,t){n(r);return g(this.name,async x=>{var z=x.objectStore("keyvaluepairs").put(t,
r);z=e(z);x=c(x);await Promise.all([x,z])})}get(r){n(r);return d(this.name,async t=>{var x=t.objectStore("keyvaluepairs").get(r);x=e(x);t=c(t);[,t]=await Promise.all([t,x]);return t})}delete(r){n(r);return g(this.name,async t=>{var x=t.objectStore("keyvaluepairs").delete(r);x=e(x);t=c(t);await Promise.all([t,x])})}clear(){return g(this.name,async r=>{var t=r.objectStore("keyvaluepairs").clear();t=e(t);r=c(r);await Promise.all([r,t])})}keys(){return d(this.name,async r=>{if(a){var t=r.objectStore("keyvaluepairs").getAllKeys();
t=e(t)}else t=u(r,"keys");r=c(r);[,r]=await Promise.all([r,t]);return r})}values(){return d(this.name,async r=>{if(b){var t=r.objectStore("keyvaluepairs").getAll();t=e(t)}else t=u(r,"values");r=c(r);[,r]=await Promise.all([r,t]);return r})}entries(){return d(this.name,async r=>{var t=u(r,"entries");r=c(r);[,t]=await Promise.all([r,t]);return t})}}self.KVStorageContainer=q}"use strict";
{const f=self.KVStorageContainer,b=[/no available storage method found/i,/an attempt was made to break through the security policy of the user agent/i,/the user denied permission to access the database/i,/a mutation operation was attempted on a database that did not allow mutations/i,/idbfactory\.open\(\) called in an invalid security context/i],a=new WeakMap;let e=!1;"undefined"===typeof indexedDB&&(e=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function c(m){throw Error(`"${m}" is not implemented`);
}function d(m){if("function"===typeof m)throw Error("localforage callback API is not implemented; please use the promise API instead");}function g(m){return"object"===typeof m?new Promise(p=>{const {port1:n,port2:u}=new MessageChannel;u.onmessage=q=>p(q.data);n.postMessage(m)}):Promise.resolve(m)}class k{constructor(m){this._inst=m;a.set(this,new Map)}_MaybeSwitchToMemoryFallback(m){if(!e)for(const p of b)if(m&&p.test(m.message)){console.error("Unable to use local storage, reverting to in-memory store: ",
m,m.message);e=!0;break}}async _getItemFallback(m){m=a.get(this).get(m);m=await g(m);return"undefined"===typeof m?null:m}async _setItemFallback(m,p){p=await g(p);a.get(this).set(m,p)}_removeItemFallback(m){a.get(this).delete(m)}_clearFallback(){a.get(this).clear()}_keysFallback(){return Array.from(a.get(this).keys())}IsUsingFallback(){return e}async getItem(m,p){d(p);if(e)return await this._getItemFallback(m);let n;try{n=await this._inst.get(m)}catch(u){this._MaybeSwitchToMemoryFallback(u);if(e)return await this._getItemFallback(m);
console.error(`Error reading '${m}' from storage, returning null: `,u);return null}return"undefined"===typeof n?null:n}async setItem(m,p,n){d(n);"undefined"===typeof p&&(p=null);if(e)await this._setItemFallback(m,p);else try{await this._inst.set(m,p)}catch(u){if(this._MaybeSwitchToMemoryFallback(u),e)await this._setItemFallback(m,p);else throw u;}}async removeItem(m,p){d(p);if(e)this._removeItemFallback(m);else try{await this._inst.delete(m)}catch(n){this._MaybeSwitchToMemoryFallback(n),e?this._removeItemFallback(m):
console.error(`Error removing '${m}' from storage: `,n)}}async clear(m){d(m);if(e)this._clearFallback();else try{await this._inst.clear()}catch(p){this._MaybeSwitchToMemoryFallback(p),e?this._clearFallback():console.error("Error clearing storage: ",p)}}async keys(m){d(m);if(e)return this._keysFallback();m=[];try{m=await this._inst.keys()}catch(p){this._MaybeSwitchToMemoryFallback(p);if(e)return this._keysFallback();console.error("Error getting storage keys: ",p)}return m}ready(m){d(m);return e?Promise.resolve(!0):
this._inst.ready()}createInstance(m){if("object"!==typeof m)throw new TypeError("invalid options object");m=m.name;if("string"!==typeof m)throw new TypeError("invalid store name");m=new f(m);return new k(m)}length(m){c("localforage.length()")}key(m,p){c("localforage.key()")}iterate(m,p){c("localforage.iterate()")}setDriver(m){c("localforage.setDriver()")}config(m){c("localforage.config()")}defineDriver(m){c("localforage.defineDriver()")}driver(){c("localforage.driver()")}supports(m){c("localforage.supports()")}dropInstance(){c("localforage.dropInstance()")}disableMemoryMode(){e=
!1}}self.localforage=new k(new f("localforage"))}"use strict";
{const f=self.C3;f.Supports={};f.Supports.WebAnimations=(()=>{try{if("Safari"===f.Platform.Browser||"undefined"===typeof document)return!1;const b=document.createElement("div");return"undefined"===typeof b.animate?!1:"undefined"!==typeof b.animate([{opacity:"0"},{opacity:"1"}],1E3).reverse}catch(b){return!1}})();f.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;f.Supports.RequestIdleCallback=!!self.requestIdleCallback;f.Supports.ImageBitmap=!!self.createImageBitmap;f.Supports.ImageBitmapOptions=
!1;if(f.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{premultiplyAlpha:"none"}).then(b=>{f.Supports.ImageBitmapOptions=!0}).catch(b=>{f.Supports.ImageBitmapOptions=!1})}catch(b){f.Supports.ImageBitmapOptions=!1}f.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===f.Platform.Browser);f.Supports.PermissionsQuery=!(!navigator.permissions||!navigator.permissions.query);f.Supports.Proxies="undefined"!==typeof Proxy;f.Supports.DownloadAttribute=
(()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();f.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();f.Supports.Fetch="function"===typeof fetch;f.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==f.Platform.Browser&&navigator.storage&&navigator.storage.persist);f.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);f.Supports.Fullscreen=
(()=>{if("undefined"===typeof document||"iOS"===f.Platform.OS)return!1;const b=document.documentElement;return!!(b.requestFullscreen||b.msRequestFullscreen||b.mozRequestFullScreen||b.webkitRequestFullscreen)})();f.Supports.ImageDecoder="undefined"!==typeof self.ImageDecoder;f.Supports.NativeFileSystemAPI=!!self.showOpenFilePicker;f.Supports.NavigatorFontsQuery=!(!navigator.fonts||!navigator.fonts.query)}"use strict";
{const f=self.C3;if(!String.prototype.trimStart){const b=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/;String.prototype.trimStart=function(){return this.replace(b,"")}}if(!String.prototype.trimEnd){const b=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;String.prototype.trimEnd=function(){return this.replace(b,
"")}}String.prototype.replaceAll||(String.prototype.replaceAll=function(b,a){return this.replace(new RegExp(f.EscapeRegex(b),"g"),a)});Array.prototype.values||(Array.prototype.values=function*(){for(const b of this)yield b});if(!Array.prototype.flat){function b(a,e){return a.reduce((c,d)=>{0<e&&Array.isArray(d)?Array.prototype.push.apply(c,b(d,e-1)):c.push(d);return c},[])}Array.prototype.flat=function(a=1){return b(this,a)}}RegExp.escape||(RegExp.escape=function(b){return String(b).replace(/[\\^$*+?.()|[\]{}]/g,
"\\$&")});navigator.storage&&!navigator.storage.estimate&&navigator.webkitTemporaryStorage&&navigator.webkitTemporaryStorage.queryUsageAndQuota&&(navigator.storage.estimate=function(){return new Promise((b,a)=>navigator.webkitTemporaryStorage.queryUsageAndQuota((e,c)=>b({usage:e,quota:c}),a))});"undefined"===typeof HTMLCollection||HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=function(){let b=0;return{next:()=>b>=this.length?{done:!0}:{value:this.item(b++),
done:!1}}});"undefined"===typeof NodeList||NodeList.prototype[Symbol.iterator]||(NodeList.prototype[Symbol.iterator]=function(){let b=0;return{next:()=>b>=this.length?{done:!0}:{value:this.item(b++),done:!1}}});"undefined"===typeof DOMTokenList||DOMTokenList.prototype[Symbol.iterator]||(DOMTokenList.prototype[Symbol.iterator]=function(){let b=0;return{next:()=>b>=this.length?{done:!0}:{value:this.item(b++),done:!1}}});"undefined"===typeof FileList||FileList.prototype[Symbol.iterator]||(FileList.prototype[Symbol.iterator]=
function(){let b=0;return{next:()=>b>=this.length?{done:!0}:{value:this.item(b++),done:!1}}});"undefined"===typeof TextEncoder&&(self.TextEncoder=class{constructor(){Object.defineProperty(this,"encoding",{value:"utf-8",writable:!1})}encode(b){for(var a=b.length,e=-1,c=new Uint8Array(3*a),d,g,k=0;k!==a;){d=b.charCodeAt(k);k+=1;if(55296<=d&&56319>=d){if(k===a){c[e+=1]=239;c[e+=1]=191;c[e+=1]=189;break}g=b.charCodeAt(k);if(56320<=g&&57343>=g){if(d=1024*(d-55296)+g-56320+65536,k+=1,65535<d){c[e+=1]=240|
d>>>18;c[e+=1]=128|d>>>12&63;c[e+=1]=128|d>>>6&63;c[e+=1]=128|d&63;continue}}else{c[e+=1]=239;c[e+=1]=191;c[e+=1]=189;continue}}127>=d?c[e+=1]=0|d:(2047>=d?c[e+=1]=192|d>>>6:(c[e+=1]=224|d>>>12,c[e+=1]=128|d>>>6&63),c[e+=1]=128|d&63)}return new Uint8Array(c.buffer.slice(0,e+1))}toString(){return"[object TextEncoder]"}},TextEncoder[Symbol.toStringTag]="TextEncoder");if("undefined"===typeof TextDecoder){function b(c){const d=c[Symbol.iterator]();return{next:g=>d.next(),[Symbol.iterator](){return this}}}
function a(c){c=c.next();if(c.done)throw Error("unexpected end of input");if(0!=(c.value&192^128))throw Error("invalid byte");return c.value&63}const e=new Map;e.set("utf-8",(c,d)=>{if(c.buffer)var g=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);else if(g instanceof ArrayBuffer)g=new Uint8Array(c);else throw Error("Invalid parameter");c=b(g);g=[];try{for(const k of c){let m;if(127>k)m=k&127;else if(223>k)m=(k&31)<<6|a(c);else if(239>k)m=(k&15)<<12|a(c)<<6|a(c);else if(247>k)m=(k&7)<<18|a(c)<<
12|a(c)<<6|a(c);else throw Error("Invalid character");g.push(String.fromCodePoint(m))}}catch(k){if(d)throw k;g.push("\ufffd")}return g.join("")});e.set("utf8",e.get("utf-8"));e.set("utf-16le",(c,d)=>{throw Error("utf-16le decoder not implemented");});self.TextDecoder=class{constructor(c="utf-8",d={}){const g=e.get(c);if(!g)throw Error(`TextDecoder polyfill does not support "${c}"`);Object.defineProperty(this,"fatal",{value:!0===d.fatal,writable:!1});Object.defineProperty(this,"_decoder",{value:g,
writable:!1});Object.defineProperty(this,"encoding",{value:c,writable:!1})}decode(c){return this._decoder(c,this.fatal)}toString(){return"[object TextDecoder]"}};TextDecoder[Symbol.toStringTag]="TextDecoder"}"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}"use strict";
{const f=self.C3;function b(a){let e=f.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+e)}self.assert=function(a,e){a||b(e)}}"use strict";
{const f=self.C3;f.IsNumber=function(a){return"number"===typeof a};f.IsFiniteNumber=function(a){return f.IsNumber(a)&&isFinite(a)};f.RequireNumber=function(a){if(!f.IsNumber(a))throw new TypeError("expected number");};f.RequireOptionalNumber=function(a){f.IsNullOrUndefined(a)};f.RequireNumberInRange=function(a,e,c){if(!f.IsNumber(a)||isNaN(a)||e>a||c<a)throw new RangeError("number outside of range");};f.RequireAllNumber=function(...a){for(let e of a);};f.RequireFiniteNumber=function(a){if(!f.IsFiniteNumber(a))throw new TypeError("expected finite number");
};f.RequireOptionalFiniteNumber=function(a){f.IsNullOrUndefined(a)};f.RequireAllFiniteNumber=function(...a){for(let e of a);};f.IsString=function(a){return"string"===typeof a};f.RequireString=function(a){if(!f.IsString(a))throw new TypeError("expected string");};f.RequireOptionalString=function(a){f.IsNullOrUndefined(a)};f.RequireAllString=function(...a){for(let e of a);};f.IsSimpleObject=function(a){return"object"!==typeof a||null===a?!1:(a=Object.getPrototypeOf(a))?a.constructor===Object:null===
a};f.RequireSimpleObject=function(a){if(!f.IsSimpleObject(a))throw new TypeError("expected simple object");};f.RequireOptionalSimpleObject=function(a){if(!f.IsNullOrUndefined(a)&&!f.IsSimpleObject(a))throw new TypeError("expected simple object");};f.IsObject=function(a){return"object"===typeof a&&null!==a&&!Array.isArray(a)};f.RequireObject=function(a){if(!f.IsObject(a))throw new TypeError("expected object");};f.RequireOptionalObject=function(a){f.IsNullOrUndefined(a)};f.RequireAllObject=function(...a){for(let e of a);
};f.IsFileLike=function(a){return f.IsInstanceOf(a,Blob)&&"string"===typeof a.name};f.RequireFileLike=function(a){if(!f.IsFileLike(a))throw new TypeError("expected file");};f.RequireOptionalFileLike=function(a){f.IsNullOrUndefined(a)};f.IsArray=function(a){return Array.isArray(a)};f.RequireArray=function(a){if(!f.IsArray(a))throw new TypeError("expected array");};f.RequireOptionalArray=function(a){f.IsNullOrUndefined(a)};f.RequireAllArray=function(...a){for(let e of a);};f.Is2DArray=function(a){return f.IsArray(a)?
a.length?f.IsArray(a[0])?!0:!1:!0:!1};f.Require2DArray=function(a){if(!f.Is2DArray(a))throw new TypeError("expected 2d array");for(let e of a)if(!f.IsArray(e))throw new TypeError("expected 2d array");};f.RequireOptional2DArray=function(a){f.IsNullOrUndefined(a)};f.IsFunction=function(a){return"function"===typeof a};f.RequireFunction=function(a,e){if(!f.IsFunction(a))throw new TypeError("expected function");if(!f.IsNullOrUndefined(e)&&a!==e)throw new TypeError("expected same function reference");};
f.RequireOptionalFunction=function(a){f.IsNullOrUndefined(a)};f.RequireAllFunction=function(...a){for(let e of a);};f.RequireAnyFunction=function(a,...e){if(!f.IsFunction(a))throw new TypeError("expected function");if(!e.length)throw Error("missing comparison functions");for(let c of e)if(!f.IsNullOrUndefined(c)&&a===c)return;throw new TypeError("expected same function reference");};f.RequireOptionalAllFunction=function(...a){if(!f.IsNullOrUndefined(a))for(let e of a);};f.IsInstanceOf=function(a,
e){return a instanceof e};f.IsInstanceOfAny=function(a,...e){for(let c of e)if(f.IsInstanceOf(a,c))return!0;return!1};f.RequireInstanceOf=function(a,e){if(!f.IsInstanceOf(a,e))throw new TypeError("unexpected type");};f.RequireOptionalInstanceOf=function(a,e){f.IsNullOrUndefined(a)};f.RequireAllInstanceOf=function(a,...e){for(let c of e);};f.RequireAnyInstanceOf=function(a,...e){if(!f.IsInstanceOfAny(a,...e))throw new TypeError("unexpected type");};f.RequireAnyOptionalInstanceOf=function(a,...e){if(!f.IsNullOrUndefined(a)&&
!f.IsInstanceOfAny(a,...e))throw new TypeError("unexpected type");};f.IsArrayOf=function(a,e){for(let c of a)if(!f.IsInstanceOf(c,e))return!1;return!0};f.IsArrayOfFiniteNumbers=function(a){for(let e of a)if(!f.IsFiniteNumber(e))return!1;return!0};f.RequireArrayOf=function(a,e){for(let c of a);};f.RequireOptionalArrayOf=function(a,e){if(!f.IsNullOrUndefined(a))for(let c of a);};f.RequireArrayOfAny=function(a,...e){for(let c of a);};f.RequireOptionalArrayOfAny=function(a,...e){if(!f.IsNullOrUndefined(a))for(let c of a);
};f.IsDOMNode=function(a,e){return f.IsNullOrUndefined(a)||!f.IsString(a.nodeName)?!1:!e||f.equalsNoCase(a.nodeName,e)};f.RequireDOMNode=function(a,e){if(f.IsNullOrUndefined(a)||!f.IsString(a.nodeName))throw new TypeError("expected DOM node");if(e&&!f.equalsNoCase(a.nodeName,e))throw new TypeError(`expected DOM '${e}' node`);};f.RequireOptionalDOMNode=function(a,e){f.IsNullOrUndefined(a)};f.IsHTMLElement=function(a,e){return f.IsNullOrUndefined(a)||!f.IsString(a.tagName)?!1:!e||f.equalsNoCase(a.tagName,
e)};f.RequireHTMLElement=function(a,e){if(f.IsNullOrUndefined(a)||!f.IsString(a.tagName))throw new TypeError("expected HTML element");if(e&&!f.equalsNoCase(a.tagName,e))throw new TypeError(`expected HTML '${e}' element`);};f.RequireOptionalHTMLElement=function(a,e){f.IsNullOrUndefined(a)};f.IsDrawable=function(a){return f.IsHTMLElement(a,"img")||f.IsHTMLElement(a,"canvas")||f.IsHTMLElement(a,"video")||"undefined"!==typeof OffscreenCanvas&&a instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&
a instanceof ImageBitmap};f.RequireDrawable=function(a){if(!f.IsDrawable(a))throw new TypeError("expected drawable");};f.RequireOptionalDrawable=function(a){f.IsNullOrUndefined(a)};f.IsDrawableOrImageData=function(a){return a instanceof ImageData?!0:f.IsDrawable(a)};f.RequireDrawableOrImageData=function(a){if(!f.IsDrawableOrImageData(a))throw new TypeError("expected drawable or image data");};f.RequireOptionalDrawableOrImageData=function(a){if(!f.IsNullOrUndefined(a)&&!f.IsDrawableOrImageData(a))throw new TypeError("expected drawable or image data");
};f.IsStringLike=function(a){return"string"===typeof a||a instanceof f.HtmlString||a instanceof f.BBString};f.RequireStringLike=function(a){if(!f.IsStringLike(a))throw new TypeError("expected string-like");};f.RequireOptionalStringLike=function(a){f.IsNullOrUndefined(a)};f.RequireAllStringLike=function(...a){for(let e of a);};f.RequireOverride=function(){throw Error("must be overridden");};f.NotYetImplemented=function(){throw Error("not yet implemented");};f.IsDefined=function(a,...e){if("undefined"===
typeof a)return!1;for(let c of e){if("undefined"===typeof a[c])return!1;a=a[c]}return!0};f.IsNullOrUndefined=function(a){return"undefined"===typeof a||null===a};f.AreArrayElementsOfSameType=function(a){let e=a[0].constructor;for(let c of a)if(c.constructor!==e)return!1;return e};f.AreArrayElementsOfType=function(a,e){for(let c of a)if(!(c instanceof e))return!1;return!0};const b=Object.getPrototypeOf(Uint8Array);f.IsTypedArray=function(a){return f.IsInstanceOf(a,b)};f.RequireTypedArray=function(a){};
f.WeakRequireTypedArray=function(a){f.WeakRequireInstanceOf(a,b)};f.WeakRequireAnyInstanceOf=function(a,...e){if(!f.WeakIsAnyInstanceOf(a,...e))throw new TypeError("unexpected type");};f.WeakIsAnyInstanceOf=function(a,...e){for(const c of e)if(f.WeakIsInstanceOf(a,c))return!0;return!1};f.WeakRequireInstanceOf=function(a,e){if(!f.WeakIsInstanceOf(a,e))throw new TypeError("unexpected type");};f.WeakIsInstanceOf=function(a,e){for(;a=Object.getPrototypeOf(a);)if(a.constructor.name===e.name)return!0;return!1}}"use strict";
{const f=self.C3;f.GetCallStack=function(){return Error().stack};f.Debugger=function(){debugger};f.cast=function(r,t){return r&&r instanceof t?r:null};f.getName=function(r){return"undefined"===typeof r?"undefined":null===r?"null":"boolean"===typeof r?"<boolean>":f.IsNumber(r)?"<number>":f.IsString(r)?"<string>":f.IsArray(r)?"<array>":"symbol"===typeof r?"<"+r.toString()+">":f.IsFunction(r)?r.name&&"Function"!==r.name?r.name:"<anonymous function>":"object"===typeof r?r.constructor&&r.constructor.name&&
"Object"!==r.constructor.name?r.constructor.name:"<anonymous object>":"<unknown>"};f.getType=function(r){return null===r?"null":Array.isArray(r)?"array":typeof r};f.range=function*(r,t){if(!isFinite(Math.abs(r-t)))throw Error("Invalid parameters");if(r>t)for(--r;r>=t;r--)yield r;else for(;r<t;r++)yield r};function b(r,t){r=f.getType(r);t=f.getType(t);return"null"===r||"null"===t?!0:"undefined"===r||"undefined"===t?!1:r===t}let a=new Map,e=new Map,c=new WeakMap,d=new WeakMap;f.DefendHandler={};const g=
new Set(["then","splice"]);function k(r){console.warn("[Defence] "+r+" @",f.GetCallStack())}f.DefendHandler.get=function(r,t){t in r||"symbol"===typeof t||g.has(t)||k(`Accessed missing property '${t}' from defended object '${f.getName(r)}', returning undefined`);d.has(r)&&"symbol"!==typeof t&&!g.has(t)&&k(`Accessed property '${t}' on a released object '${f.getName(r)}'\nObject was originally released at: ${d.get(r)})\nCall stack at access: `);return r[t]};f.DefendHandler.set=function(r,t,x){t in r||
a.has(r)||k(`Set non-existent property '${t}' to '${x}' on defended object '${f.getName(r)}'`);b(r[t],x)||a.has(r)||k(`Set '${f.getType(r[t])}' property '${t}' to type '${f.getType(x)}' on defended object '${f.getName(r)}'`);d.has(r)&&k(`Set property '${t}' on a released object '${f.getName(r)}'\nObject was originally released at: ${d.get(r)})\nCall stack at access: `);r[t]=x;return!0};f.DefendHandler.deleteProperty=function(r,t){throw new ReferenceError(`Cannot delete property '${t}' from defended object '${f.getName(r)}'`);
};f.DefendHandler.defineProperty=function(r,t,x){throw new ReferenceError(`Cannot define property '${t}' on defended object '${f.getName(r)}'`);};f.DefendHandler.enumerate=function(r){throw new ReferenceError(`Cannot enumerate defended object '${f.getName(r)}'`);};let m=-1;function p(){m=-1;if(0<a.size||0<e.size){let r=[...new Set([...a.keys()].map(t=>f.getName(t)))].join();console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${r}`);
a.clear();e.clear()}}f.DefendedBase=class{constructor(){if(f.isDebugDefend&&f.Supports.Proxies){var r=new.target;r=Object.create(r.prototype);var t=new Proxy(r,f.DefendHandler);a.set(r,t);e.set(t,r);c.set(t,r);-1===m&&(m=requestAnimationFrame(p));return t}}};f.debugDefend=function(r){if(f.isDebugDefend&&f.Supports.Proxies&&r instanceof f.DefendedBase){if(!e.has(r))return r;let t=e.get(r);e.delete(r);a.delete(t);return r}return f.isDebug?Object.seal(r):r};f.New=function(r,...t){let x;try{x=new r(...t)}catch(z){throw e.clear(),
a.clear(),z;}f.isDebugDefend&&q(r,x);return f.debugDefend(x)};f.Release=function(r){(r=c.get(r))&&d.set(r,f.GetCallStack())};f.WasReleased=function(r){return(r=c.get(r))?!!d.get(r):!1};let n=new Map;function u(r){let t=new Set;for(let x in r)t.add(x);return t}function q(r,t){t=u(t);let x=n.get(r);if(x){let z=[];for(let D of x.values())t.has(D)?t.delete(D):z.push(D);f.appendArray(z,[...t]);z.length&&console.warn(`[Defence] '${f.getName(r)}' constructor creates inconsistent properties: ${z.join(", ")}`)}else n.set(r,
t)}f.PerfMark=class{constructor(r){this._name="";r&&this.start(r)}start(r){this._name=r;performance.mark(this._name+"-Start")}end(){performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(r){this.end();this._name=r;performance.mark(this._name+"-Start")}}}"use strict";
{const f=self.C3,b=2*Math.PI,a=Math.PI/180,e=180/Math.PI;f.wrap=function(g,k,m){g=Math.floor(g);k=Math.floor(k);m=Math.floor(m);return g<k?(g=m-(k-g)%(m-k),g===m?0:g):k+(g-k)%(m-k)};f.mapToRange=function(g,k,m,p,n){return(g-k)*(n-p)/(m-k)+p};f.normalize=function(g,k,m){return(g-k)/(m-k)};f.clamp=function(g,k,m){return g<k?k:g>m?m:g};f.clampAngle=function(g){g%=b;0>g&&(g+=b);return g};f.toRadians=function(g){return g*a};f.toDegrees=function(g){return g*e};f.distanceTo=function(g,k,m,p){return Math.hypot(m-
g,p-k)};f.distanceSquared=function(g,k,m,p){g=m-g;k=p-k;return g*g+k*k};f.angleTo=function(g,k,m,p){return Math.atan2(p-k,m-g)};f.angleDiff=function(g,k){if(g===k)return 0;g=Math.sin(g)*Math.sin(k)+Math.cos(g)*Math.cos(k);return 1<=g?0:-1>=g?Math.PI:Math.acos(g)};f.angleRotate=function(g,k,m){let p=Math.sin(g),n=Math.cos(g),u=Math.sin(k),q=Math.cos(k);return Math.acos(p*u+n*q)>m?0<n*u-p*q?f.clampAngle(g+m):f.clampAngle(g-m):f.clampAngle(k)};f.angleClockwise=function(g,k){return 0>=Math.cos(g)*Math.sin(k)-
Math.sin(g)*Math.cos(k)};f.angleLerp=function(g,k,m,p=0){let n=f.angleDiff(g,k);p*=b;return f.angleClockwise(k,g)?f.clampAngle(g+(n+p)*m):f.clampAngle(g-(n+p)*m)};f.angleLerpClockwise=function(g,k,m,p=0){const n=f.angleDiff(g,k);p*=b;return f.angleClockwise(k,g)?f.clampAngle(g+(n+p)*m):f.clampAngle((b-n+p)*m)};f.angleLerpAntiClockwise=function(g,k,m,p=0){const n=f.angleDiff(g,k);p*=b;return f.angleClockwise(k,g)?f.clampAngle((-b+n-p)*m):f.clampAngle(g-(n+p)*m)};f.lerp=function(g,k,m){return g+m*(k-
g)};f.unlerp=function(g,k,m){return g===k?0:(m-g)/(k-g)};f.relerp=function(g,k,m,p,n){return f.lerp(p,n,f.unlerp(g,k,m))};f.qarp=function(g,k,m,p){return f.lerp(f.lerp(g,k,p),f.lerp(k,m,p),p)};f.cubic=function(g,k,m,p,n){return f.lerp(f.qarp(g,k,m,n),f.qarp(k,m,p,n),n)};f.cosp=function(g,k,m){return(g+k+(g-k)*Math.cos(m*Math.PI))/2};f.isPOT=function(g){return 0<g&&0===(g-1&g)};f.nextHighestPowerOfTwo=function(g){--g;for(let k=1;32>k;k<<=1)g|=g>>k;return g+1};f.roundToNearestFraction=function(g,k){return Math.round(g*
k)/k};f.floorToNearestFraction=function(g,k){return Math.floor(g*k)/k};f.round6dp=function(g){return Math.round(1E6*g)/1E6};f.toFixed=function(g,k){g=g.toFixed(k);for(k=g.length-1;0<=k&&"0"===g.charAt(k);--k);0<=k&&"."===g.charAt(k)&&--k;return 0>k?g:g.substr(0,k+1)};f.PackRGB=function(g,k,m){return f.clamp(g,0,255)|f.clamp(k,0,255)<<8|f.clamp(m,0,255)<<16};f.PackRGBAEx=function(g,k,m,p){g=f.clamp(Math.floor(1024*g),-8192,8191);k=f.clamp(Math.floor(1024*k),-8192,8191);m=f.clamp(Math.floor(1024*m),
-8192,8191);p=f.clamp(Math.floor(1023*p),0,1023);0>g&&(g+=16384);0>k&&(k+=16384);0>m&&(m+=16384);return-(274877906944*g+16777216*k+1024*m+p)};f.PackRGBEx=function(g,k,m){return f.PackRGBAEx(g,k,m,1)};function c(g){return 0===g&&0>1/g}f.GetRValue=function(g){if(0<=g)return(g&255)/255;g=Math.floor(-g/274877906944);8191<g&&(g-=16384);return g/1024};f.GetGValue=function(g){if(0<=g)return((g&65280)>>8)/255;g=Math.floor(-g%274877906944/16777216);8191<g&&(g-=16384);return g/1024};f.GetBValue=function(g){if(0<=
g)return((g&16711680)>>16)/255;g=Math.floor(-g%16777216/1024);8191<g&&(g-=16384);return g/1024};f.GetAValue=function(g){return c(g)?0:0<=g?1:Math.floor(-g%1024)/1023};f.greatestCommonDivisor=function(g,k){g=Math.floor(g);for(k=Math.floor(k);0!==k;){let m=k;k=g%k;g=m}return g};const d=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];f.getAspectRatio=function(g,k){g=Math.floor(g);k=Math.floor(k);if(g===k)return[1,1];for(var m of d){let p=g/m[0]*m[1];if(1>Math.abs(k-p))return m.slice(0);
p=g/m[1]*m[0];if(1>Math.abs(k-p))return[m[1],m[0]]}m=f.greatestCommonDivisor(g,k);return[g/m,k/m]};f.segmentsIntersect=function(g,k,m,p,n,u,q,r){var t=Math.min(g,m),x=Math.max(n,q);if(Math.max(g,m)<Math.min(n,q)||t>x)return!1;t=Math.min(k,p);x=Math.max(u,r);if(Math.max(k,p)<Math.min(u,r)||t>x)return!1;t=n-g+q-m;x=u-k+r-p;g=m-g;k=p-k;n=q-n;u=r-u;r=Math.abs(k*n-u*g);return Math.abs(n*x-u*t)>r?!1:Math.abs(g*x-k*t)<=r};f.segmentsIntersectPreCalc=function(g,k,m,p,n,u,q,r,t,x,z,D){const G=Math.max(t,z);
if(u<Math.min(t,z)||n>G)return!1;n=Math.max(x,D);if(r<Math.min(x,D)||q>n)return!1;q=t-g+z-m;r=x-k+D-p;g=m-g;k=p-k;t=z-t;x=D-x;D=Math.abs(k*t-x*g);return Math.abs(t*r-x*q)>D?!1:Math.abs(g*r-k*q)<=D};f.segmentIntersectsQuad=function(g,k,m,p,n){const u=Math.min(g,m),q=Math.max(g,m),r=Math.min(k,p),t=Math.max(k,p),x=n.getTlx(),z=n.getTly(),D=n.getTrx(),G=n.getTry(),w=n.getBrx(),B=n.getBry(),I=n.getBlx();n=n.getBly();return f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,x,z,D,G)||f.segmentsIntersectPreCalc(g,
k,m,p,u,q,r,t,D,G,w,B)||f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,w,B,I,n)||f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,I,n,x,z)};f.segmentIntersectsAnyN=function(g,k,m,p,n){const u=Math.min(g,m),q=Math.max(g,m),r=Math.min(k,p),t=Math.max(k,p);let x=0;for(let z=n.length-4;x<=z;x+=2)if(f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,n[x],n[x+1],n[x+2],n[x+3]))return!0;return f.segmentsIntersectPreCalc(g,k,m,p,u,q,r,t,n[x],n[x+1],n[0],n[1])};f.rayIntersect=function(g,k,m,p,n,u,q,r){m-=g;u=r-u;const t=m*
u-(p-k)*(q-n);if(0===t)return 2;p=((k-p)*(q-g)+m*(r-k))/t;return 0<p&&1.000001>p?(u*(q-g)+(n-q)*(r-k))/t:2};f.rayIntersectExtended=function(g,k,m,p,n,u,q,r,t){const x=(q-n)*t;t*=r-u;return f.rayIntersect(g,k,m,p,n-x,u-t,q+x,r+t)};f.isPointInTriangleInclusive=function(g,k,m,p,n,u,q,r){n-=m;u-=p;q-=m;r-=p;g-=m;m=k-p;k=n*n+u*u;p=n*q+u*r;n=n*g+u*m;u=q*q+r*r;q=q*g+r*m;r=1/(k*u-p*p);u=(u*n-p*q)*r;n=(k*q-p*n)*r;return 0<=u&&0<=n&&1>=u+n};f.triangleCartesianToBarycentric=function(g,k,m,p,n,u,q,r){n-=m;u-=
p;q-=m;r-=p;g-=m;const t=k-p;k=n*n+u*u;p=n*q+u*r;m=q*q+r*r;n=g*n+t*u;u=g*q+t*r;q=k*m-p*p;r=(m*n-p*u)/q;n=(k*u-p*n)/q;return[1-r-n,r,n]};f.triangleBarycentricToCartesian=function(g,k,m,p,n,u,q,r,t){return[g*p+k*u+m*r,g*n+k*q+m*t]}}"use strict";
{const f=self.C3;let b=null,a="";if("undefined"!==typeof document){b=document;const m=document.querySelector("base");if(a=m&&m.hasAttribute("href")?m.getAttribute("href"):"")a.startsWith("/")&&(a=a.substr(1)),a.endsWith("/")||(a+="/")}f.GetBaseHref=function(){return a};f.GetBaseURL=function(){if(!b)return"";const m=b.location;return f.GetPathFromURL(m.origin+m.pathname)+a};f.GetPathFromURL=function(m){if(!m.length||m.endsWith("/")||m.endsWith("\\"))return m;const p=Math.max(m.lastIndexOf("/"),m.lastIndexOf("\\"));
return-1===p?"":m.substr(0,p+1)};f.GetFilenameFromURL=function(m){if(!m.length)return m;if(m.endsWith("/")||m.endsWith("\\"))return"";const p=Math.max(m.lastIndexOf("/"),m.lastIndexOf("\\"));return-1===p?m:m.substr(p+1)};f.DataTransferHasFiles=function(m){if(m.types)for(let p=0;p<m.types.length;p++)if("Files"===m.types[p]||"application/x-c3-file"===m.types[p])return!0;return!1};f.DataTransferFilterFiles=async function(m,p){m=Array.from(m.files).filter(n=>0!==n.size).filter(n=>p(n)).map(async n=>{try{return await f.CloneFile(n)}catch(u){return null}});
return(await Promise.all(m)).filter(n=>n)};f.IsFileAnImage=function(m){return m.type?-1!==m.type.search(/image\/.*/):-1!==f.MimeType.GetForFileExtension(f.GetFileExtension(m.name)).GetString().search(/image\/.*/)};f.IsFileAnSVG=function(m){return"image/svg+xml"===m.type};f.IsFileAMultiImageContainer=function(m){return m.type?f.MimeType.Get(m.type).IsAnimatedImage():f.MimeType.GetForFileExtension(f.GetFileExtension(m.name)).IsAnimatedImage()};f.GetFileExtension=function(m){let p=m.lastIndexOf(".");
return 1>p?"":m.substr(p)};f.GetFileNamePart=function(m){let p=m.lastIndexOf(".");return 1>p?m:m.substr(0,p)};f.NormalizeFileSeparator=function(m){return m.replace(/\\/g,"/")};f.ParseFilePath=function(m){m=f.NormalizeFileSeparator(m);let p=/^\w:\//.exec(m);p?(p=p[0],m=m.slice(3),"/"!==m[0]&&(m="/"+m)):p="";m=m.replace(/\/{2,}/g,"/");1<m.length&&"/"===m.slice(-1)&&(m=m.slice(0,-1));var n=m.lastIndexOf("/")+1;let u="",q=m,r="";0<n&&(u=m.slice(0,n),q=m.slice(n));m=q;n=q.lastIndexOf(".");0<n&&(r=q.slice(n),
m=q.slice(0,-r.length));return{dir:u,base:q,name:m,root:p,ext:r,full:p+u+q}};f.Wait=function(m,p){return new Promise((n,u)=>{self.setTimeout(n,m,p)})};f.swallowException=function(m){try{m()}catch(p){f.isDebug&&console.warn("Swallowed exception: ",p)}};f.noop=function(){};f.equalsNoCase=function(m,p){if("string"!==typeof m||"string"!==typeof p)return!1;if(m===p)return!0;m=m.normalize();p=p.normalize();return m.length!==p.length?!1:m.toLowerCase()===p.toLowerCase()};f.equalsCase=function(m,p){return"string"!==
typeof m||"string"!==typeof p?!1:m===p?!0:m.normalize()===p.normalize()};f.typedArraySet16=function(m,p,n){m[n++]=p[0];m[n++]=p[1];m[n++]=p[2];m[n++]=p[3];m[n++]=p[4];m[n++]=p[5];m[n++]=p[6];m[n++]=p[7];m[n++]=p[8];m[n++]=p[9];m[n++]=p[10];m[n++]=p[11];m[n++]=p[12];m[n++]=p[13];m[n++]=p[14];m[n]=p[15]};f.truncateArray=function(m,p){m.length=p};f.clearArray=function(m){m&&0!==m.length&&f.truncateArray(m,0)};f.clear2DArray=function(m){if(m){for(let p=0;p<m.length;p++)f.truncateArray(m[p],0);f.truncateArray(m,
0)}};f.extendArray=function(m,p,n){p|=0;var u=m.length;if(!(p<=u))for(;u<p;++u)m.push(n)};f.resizeArray=function(m,p,n){p|=0;const u=m.length;p<u?f.truncateArray(m,p):p>u&&f.extendArray(m,p,n)};f.shallowAssignArray=function(m,p){f.clearArray(m);f.appendArray(m,p)};f.appendArray=function(m,p){if(1E4>p.length)m.push(...p);else for(let n=0,u=p.length;n<u;++n)m.push(p[n])};f.arrayRemove=function(m,p){p=Math.floor(p);if(!(0>p||p>=m.length)){for(var n=m.length-1;p<n;++p)m[p]=m[p+1];f.truncateArray(m,n)}};
f.arrayFindRemove=function(m,p){p=m.indexOf(p);0<=p&&m.splice(p,1)};f.arraysEqual=function(m,p){let n=m.length;if(p.length!==n)return!1;for(let u=0;u<n;++u)if(m[u]!==p[u])return!1;return!0};f.arrayFilterOut=function(m,p){let n=[],u=0;for(let q=0,r=m.length;q<r;++q){let t=m[q];p(t)?n.push(t):(m[u]=t,++u)}f.truncateArray(m,u);return n};f.arrayRemoveAllInSet=function(m,p){const n=m.length;let u=0;for(let q=0,r=m.length;q<r;++q){let t=m[q];p.has(t)||(m[u++]=t)}f.truncateArray(m,u);return n-u};f.isArrayIndexInBounds=
function(m,p){return m!==Math.floor(m)?!1:0<=m&&m<p.length};f.validateArrayIndex=function(m,p){if(!f.isArrayIndexInBounds(m,p))throw new RangeError("array index out of bounds");};f.cloneArray=function(m){return m.slice()};f.deepCloneArray=function(m,p){let n=[];for(let u of m)if(f.IsObject(u)){m=p(u);if(!m)throw Error("missing clone");if(m.constructor!==u.constructor)throw Error("object is not a clone");n.push(m)}else f.IsArray(u)?n.push(f.deepCloneArray(u,p)):n.push(u);return n};f.clone2DArray=function(m){let p=
[];for(let n of m)p.push(n.slice());return p};f.mergeSets=function(m,p){return new Set([...m,...p])};f.mergeSetsInPlace=function(m,p){for(const n of p)m.add(n);return m};f.first=function(m){for(let p of m)return p;return null};f.xor=function(m,p){return!m!==!p};f.compare=function(m,p,n){switch(p){case 0:return m===n;case 1:return m!==n;case 2:return m<n;case 3:return m<=n;case 4:return m>n;case 5:return m>=n;default:return!1}};f.hasAnyOwnProperty=function(m){for(let p in m)if(m.hasOwnProperty(p))return!0;
return!1};f.PromiseAllWithProgress=function(m,p){return m.length?new Promise((n,u)=>{const q=[];let r=0,t=!1;for(let x=0,z=m.length;x<z;++x)q.push(void 0),m[x].then(D=>{t||(q[x]=D,++r,r===m.length?n(q):p(r,m.length))}).catch(D=>{t=!0;u(D)})}):Promise.resolve([])};let e=[];f.AddLibraryMemoryCallback=function(m){e.push(m)};f.GetEstimatedLibraryMemoryUsage=function(){let m=0;for(let p of e){let n=p();m+=n}return Math.floor(m)};let c=1;const d=new Map,g=new MessageChannel;g.port2.onmessage=function(m){const p=
m.data,n=d.get(p);d.delete(p);n&&n(m.timeStamp)};f.RequestUnlimitedAnimationFrame=function(m){const p=c++;d.set(p,m);g.port1.postMessage(p);return p};f.CancelUnlimitedAnimationFrame=function(m){d.delete(m)};f.PostTask=f.RequestUnlimitedAnimationFrame;f.WaitForNextTask=function(){return new Promise(m=>f.PostTask(m))};const k=new Set;f.RequestPostAnimationFrame=function(m){const p=self.requestAnimationFrame(async n=>{await f.WaitForNextTask();k.has(p)&&(k.delete(p),m(n))});k.add(p);return p};f.CancelPostAnimationFrame=
function(m){k.has(m)&&(self.cancelAnimationFrame(m),k.delete(m))}}"use strict";
{const f=self.C3;f.IsAbsoluteURL=function(b){return/^(?:[a-z]+:)?\/\//.test(b)||"data:"===b.substr(0,5)||"blob:"===b.substr(0,5)};f.IsRelativeURL=function(b){return!f.IsAbsoluteURL(b)};f.ThrowIfNotOk=function(b){if(!b.ok)throw Error(`fetch '${b.url}' response returned ${b.status} ${b.statusText}`);};f.FetchOk=function(b,a){return fetch(b,a).then(e=>{f.ThrowIfNotOk(e);return e})};f.FetchText=function(b){return f.FetchOk(b).then(a=>a.text())};f.FetchJson=function(b){return f.FetchOk(b).then(a=>a.json())};
f.FetchBlob=function(b){return f.FetchOk(b).then(a=>a.blob())};f.FetchArrayBuffer=function(b){return f.FetchOk(b).then(a=>a.arrayBuffer())};f.FetchImage=function(b){return new Promise((a,e)=>{const c=new Image;c.onload=()=>a(c);c.onerror=d=>e(d);c.src=b})};f.BlobToArrayBuffer=function(b){return"function"===typeof b.arrayBuffer?b.arrayBuffer():new Promise((a,e)=>{const c=new FileReader;c.onload=()=>a(c.result);c.onerror=()=>e(c.error);c.readAsArrayBuffer(b)})};f.BlobToString=function(b){return"function"===
typeof b.text?b.text():new Promise((a,e)=>{const c=new FileReader;c.onload=()=>a(c.result);c.onerror=()=>e(c.error);c.readAsText(b)})};f.BlobToJson=function(b){return f.BlobToString(b).then(a=>JSON.parse(a))};f.BlobToImage=async function(b,a){b=URL.createObjectURL(b);try{const e=await f.FetchImage(b);URL.revokeObjectURL(b);b="";a&&"function"===typeof e.decode&&await e.decode();return e}finally{b&&URL.revokeObjectURL(b)}};f.CreateCanvas=function(b,a){if("undefined"!==typeof document&&"function"===
typeof document.createElement){const e=document.createElement("canvas");e.width=b;e.height=a;return e}return new OffscreenCanvas(b,a)};f.CanvasToBlob=function(b,a,e){"number"!==typeof e&&(e=1);a=a||"image/png";e=f.clamp(e,0,1);return b.toBlob?new Promise(c=>b.toBlob(c,a,e)):b.convertToBlob?b.convertToBlob({type:a,quality:e}):f.Asyncify(()=>f.CanvasToBlobSync(b,a,e))};f.CanvasToBlobSync=function(b,a,e){"number"!==typeof e&&(e=1);a=a||"image/png";e=f.clamp(e,0,1);return f.DataURIToBinaryBlobSync(b.toDataURL(a,
e))};f.DataURIToBinaryBlobSync=function(b){b=f.ParseDataURI(b);return f.BinaryStringToBlob(b.data,b.mime_type)};f.ParseDataURI=function(b){if("data:"!==b.substr(0,5))throw new URIError("expected data: uri");var a=b.indexOf(",");if(0>a)throw new URIError("expected comma in data: uri");var e=b.substring(5,a);b=b.substring(a+1);a=e.split(";");e=a[0]||"";let c=a[2];b="base64"===a[1]||"base64"===c?atob(b):decodeURIComponent(b);return{mime_type:e,data:b}};f.BinaryStringToBlob=function(b,a){var e=b.length;
let c=e>>2,d=new Uint8Array(e),g=new Uint32Array(d.buffer,0,c),k,m;for(m=k=0;k<c;++k)g[k]=b.charCodeAt(m++)|b.charCodeAt(m++)<<8|b.charCodeAt(m++)<<16|b.charCodeAt(m++)<<24;for(e&=3;e--;)d[m]=b.charCodeAt(m),++m;return a?new Blob([d],{type:a}):new Blob([d])};f.DrawableToBlob=function(b,a,e){const c=f.CreateCanvas(b.width,b.height);c.getContext("2d").drawImage(b,0,0);return f.CanvasToBlob(c,a,e)};f.ImageDataToBlobSync=function(b,a,e){const c=f.CreateCanvas(b.width,b.height);c.getContext("2d").putImageData(b,
0,0);return f.CanvasToBlobSync(c,a,e)};f.ImageDataToBlob=function(b,a,e){if(f.Supports.ImageBitmapOptions)return createImageBitmap(b,{premultiplyAlpha:"none"}).then(c=>f.DrawableToBlob(c,a,e));if(f.Supports.ImageBitmap)return createImageBitmap(b).then(c=>f.DrawableToBlob(c,a,e));{const c=f.CreateCanvas(b.width,b.height);c.getContext("2d").putImageData(b,0,0);return f.CanvasToBlob(c,a,e)}};f.CopySet=function(b,a){b.clear();for(const e of a)b.add(e)};f.MapToObject=function(b){const a=Object.create(null);
for(const [e,c]of b.entries())a[e]=c;return a};f.ObjectToMap=function(b,a){a.clear();for(const [e,c]of Object.entries(b))a.set(e,c)};f.ToSuperJSON=function e(a){if("object"===typeof a&&null!==a){if(a instanceof Set)return{_c3type_:"set",data:[...a].map(c=>e(c))};if(a instanceof Map)return{_c3type_:"map",data:[...a].map(c=>[c[0],e(c[1])])};{const c=Object.create(null);for(const [d,g]of Object.entries(a))c[d]=e(g);return c}}return a};f.FromSuperJSON=function c(e){if("object"===typeof e&null!==e){if("set"===
e._c3type_)return new Set(e.data.map(d=>c(d)));if("map"===e._c3type_)return new Map(e.data.map(d=>[d[0],c(d[1])]));{const d=Object.create(null);for(const [g,k]of Object.entries(e))d[g]=c(k);return d}}return e};f.CSSToCamelCase=function(e){let c="",d=!1;for(const g of e)"-"===g?d=!0:d?(c+=g.toUpperCase(),d=!1):c+=g;return c};f.IsIterator=function(e){return"object"===typeof e&&"function"===typeof e.next};f.MakeFilledArray=function(e,c){const d=[];if("function"===typeof c)for(var g=0;g<e;++g)d.push(c());
else for(g=0;g<e;++g)d.push(c);return d}}"use strict";
{const f=self.C3,b=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,a=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;function e(d){return 0===d.length?"00":1===d.length?"0"+d:d}function c(d,g,k){0>k&&(k+=1);1<k&&--k;return k<1/6?d+6*(g-d)*k:.5>k?g:k<2/3?d+(g-d)*(2/3-k)*6:d}f.Color=class{constructor(d,g,k,m){this._a=this._b=this._g=this._r=0;d instanceof f.Color?this.set(d):this.setRgba(d||0,g||0,k||0,m||0)}setRgb(d,g,k){this._r=+d;this._g=+g;this._b=+k;this.clamp();return this}setRgba(d,g,k,m){this._r=+d;this._g=
+g;this._b=+k;this._a=+m;this.clamp();return this}set(d){this._r=d._r;this._g=d._g;this._b=d._b;this._a=d._a;return this}copy(d){return this.set(d)}add(d){this._r+=d._r;this._g+=d._g;this._b+=d._b;this._a+=d._a;this.clamp()}addRgb(d,g,k,m=0){this._r+=+d;this._g+=+g;this._b+=+k;this._a+=+m;this.clamp()}diff(d){this.setR(Math.max(this._r,d._r)-Math.min(this._r,d._r));this.setG(Math.max(this._g,d._g)-Math.min(this._g,d._g));this.setB(Math.max(this._b,d._b)-Math.min(this._b,d._b));this.setA(Math.max(this._a,
d._a)-Math.min(this._a,d._a));this.clamp()}copyRgb(d){this._r=d._r;this._g=d._g;this._b=d._b}setR(d){this._r=f.clamp(+d,0,1)}getR(){return this._r}setG(d){this._g=f.clamp(+d,0,1)}getG(){return this._g}setB(d){this._b=f.clamp(+d,0,1)}getB(){return this._b}setA(d){this._a=f.clamp(+d,0,1)}getA(){return this._a}clone(){return f.New(f.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(d,g){d[g++]=
this._r;d[g++]=this._g;d[g++]=this._b;d[g]=this._a}equals(d){return this._r===d._r&&this._g===d._g&&this._b===d._b&&this._a===d._a}equalsIgnoringAlpha(d){return this._r===d._r&&this._g===d._g&&this._b===d._b}equalsRgb(d,g,k){return this._r===d&&this._g===g&&this._b===k}equalsRgba(d,g,k,m){return this._r===d&&this._g===g&&this._b===k&&this._a===m}multiply(d){this._r*=d._r;this._g*=d._g;this._b*=d._b;this._a*=d._a}multiplyAlpha(d){this._r*=d;this._g*=d;this._b*=d;this._a*=d}premultiply(){this._r*=this._a;
this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=f.clamp(this._r,0,1);this._g=f.clamp(this._g,0,1);this._b=f.clamp(this._b,0,1);this._a=f.clamp(this._a,0,1);return this}setFromRgbValue(d){this._r=f.GetRValue(d);this._g=f.GetGValue(d);this._b=f.GetBValue(d);this._a=f.GetAValue(d)}getCssRgb(d,g,k){d=f.IsFiniteNumber(d)?d:this.getR();g=f.IsFiniteNumber(g)?g:this.getG();k=f.IsFiniteNumber(k)?k:this.getB();return`rgb(${100*
d}%, ${100*g}%, ${100*k}%)`}getCssRgba(d,g,k,m){d=f.IsFiniteNumber(d)?d:this.getR();g=f.IsFiniteNumber(g)?g:this.getG();k=f.IsFiniteNumber(k)?k:this.getB();m=f.IsFiniteNumber(m)?m:this.getA();return`rgba(${100*d}%, ${100*g}%, ${100*k}%, ${m})`}toHexString(){const d=Math.round(255*this.getR()),g=Math.round(255*this.getG()),k=Math.round(255*this.getB());return"#"+e(d.toString(16))+e(g.toString(16))+e(k.toString(16))}parseHexString(d){if("string"!==typeof d)return!1;d=d.trim();"#"===d.charAt(0)&&(d=
d.substr(1));let g,k;if(3===d.length)g=parseInt(d[0],16)/15,k=parseInt(d[1],16)/15,d=parseInt(d[2],16)/15;else if(6===d.length)g=parseInt(d.substr(0,2),16)/255,k=parseInt(d.substr(2,2),16)/255,d=parseInt(d.substr(4,2),16)/255;else return!1;isFinite(g)&&this.setR(g);isFinite(k)&&this.setG(k);isFinite(d)&&this.setB(d);this.setA(1);return!0}toCommaSeparatedRgb(){const d=Math.round(255*this.getR()),g=Math.round(255*this.getG()),k=Math.round(255*this.getB());return`${d}, ${g}, ${k}`}toRgbArray(){const d=
Math.round(255*this.getR()),g=Math.round(255*this.getG()),k=Math.round(255*this.getB());return[d,g,k]}parseCommaSeparatedRgb(d){if("string"!==typeof d)return!1;d=d.replace(/^rgb\(|\)|%/,"");var g=d.split(",");if(3>g.length)return!1;d=parseInt(g[0].trim(),10)/255;const k=parseInt(g[1].trim(),10)/255;g=parseInt(g[2].trim(),10)/255;isFinite(d)&&this.setR(d);isFinite(k)&&this.setG(k);isFinite(g)&&this.setB(g);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(d){if("string"!==typeof d)return!1;d=
d.replace(/^rgb\(|\)|%/,"");var g=d.split(",");if(3>g.length)return!1;d=parseInt(g[0].trim(),10)/100;const k=parseInt(g[1].trim(),10)/100;g=parseInt(g[2].trim(),10)/100;isFinite(d)&&this.setR(d);isFinite(k)&&this.setG(k);isFinite(g)&&this.setB(g);this.setA(1);return!0}parseCommaSeparatedRgba(d){if("string"!==typeof d)return!1;d=d.replace(/^rgba\(|\)|%/,"");var g=d.split(",");if(4>g.length)return!1;d=parseInt(g[0].trim(),10)/255;const k=parseInt(g[1].trim(),10)/255,m=parseInt(g[2].trim(),10)/255;g=
parseFloat(g[3].trim());isFinite(d)&&this.setR(d);isFinite(k)&&this.setG(k);isFinite(m)&&this.setB(m);isFinite(g)&&this.setA(g);return!0}parseCommaSeparatedPercentageRgba(d){if("string"!==typeof d)return!1;d=d.replace(/^rgba\(|\)|%/,"");var g=d.split(",");if(4>g.length)return!1;d=parseInt(g[0].trim(),10)/100;const k=parseInt(g[1].trim(),10)/100,m=parseInt(g[2].trim(),10)/100;g=parseFloat(g[3].trim());isFinite(d)&&this.setR(d);isFinite(k)&&this.setG(k);isFinite(m)&&this.setB(m);isFinite(g)&&this.setA(g);
return!0}parseString(d){if("string"!==typeof d)return!1;d=d.replace(/\s+/,"");if(d.includes(",")){if(d.startsWith("rgb("))return d.includes("%")?this.parseCommaSeparatedPercentageRgb(d):this.parseCommaSeparatedRgb(d);if(d.startsWith("rgba("))return d.includes("%")?this.parseCommaSeparatedPercentageRgba(d):this.parseCommaSeparatedRgba(d);if(d.startsWith("hsl(")||d.startsWith("hsla("))return this.parseHSLString(d);{const g=d.split(",");if(d.includes("%")){if(3===g.length)return this.parseCommaSeparatedPercentageRgb(d);
if(4===g.length)return this.parseCommaSeparatedPercentageRgba(d)}else{if(3===g.length)return this.parseCommaSeparatedRgb(d);if(4===g.length)return this.parseCommaSeparatedRgba(d)}return!1}}return this.parseHexString(d)}toJSON(){return[this._r,this._g,this._b,this._a]}setFromHSLA(d,g,k,m){d%=360;g=f.clamp(g,0,100);k=f.clamp(k,0,100);m=f.clamp(m,0,1);d/=360;g/=100;k/=100;if(0===g)k=g=d=k;else{const p=.5>k?k*(1+g):k+g-k*g,n=2*k-p;k=c(n,p,d+1/3);g=c(n,p,d);d=c(n,p,d-1/3)}this.setR(k);this.setG(g);this.setB(d);
this.setA(m);return this}parseHSLString(d){var g=d.replace(/ |hsl|hsla|\(|\)|;/gi,"");d=b.exec(g);g=a.exec(g);return d&&4===d.length?(this.setFromHSLA(+d[1],+d[2],+d[3],1),!0):g&&5===g.length?(this.setFromHSLA(+d[1],+d[2],+d[3],+d[4]),!0):!1}toHSLAString(){var d=this._r;const g=this._g,k=this._b,m=this._a,p=f.Color.GetHue(d,g,k),n=f.Color.GetSaturation(d,g,k);d=f.Color.GetLuminosity(d,g,k);return`hsla(${p}, ${n}%, ${d}%, ${m})`}toHSLAArray(){const d=this._r,g=this._g,k=this._b;return[f.Color.GetHue(d,
g,k),f.Color.GetSaturation(d,g,k),f.Color.GetLuminosity(d,g,k),this._a]}setFromJSON(d){!Array.isArray(d)||3>d.length||(this._r=d[0],this._g=d[1],this._b=d[2],this._a=4<=d.length?d[3]:1)}set r(d){this.setR(d)}get r(){return this.getR()}set g(d){this.setG(d)}get g(){return this.getG()}set b(d){this.setB(d)}get b(){return this.getB()}set a(d){this.setA(d)}get a(){return this.getA()}setAtIndex(d,g){switch(d){case 0:this.setR(g);break;case 1:this.setG(g);break;case 2:this.setB(g);break;case 3:this.setA(g);
break;default:throw new RangeError("invalid color index");}}getAtIndex(d){switch(d){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static DiffChannel(d,g){return f.clamp(Math.max(d,g)-Math.min(d,g),0,1)}static Diff(d,g){const k=new f.Color;k.setR(Math.max(d._r,g._r)-Math.min(d._r,g._r));k.setG(Math.max(d._g,g._g)-Math.min(d._g,g._g));k.setB(Math.max(d._b,g._b)-Math.min(d._b,g._b));k.setA(Math.max(d._a,
g._a)-Math.min(d._a,g._a));return k}static DiffNoAlpha(d,g){const k=new f.Color(0,0,0,1);k.setR(Math.max(d._r,g._r)-Math.min(d._r,g._r));k.setG(Math.max(d._g,g._g)-Math.min(d._g,g._g));k.setB(Math.max(d._b,g._b)-Math.min(d._b,g._b));return k}static GetHue(d,g,k){const m=Math.max(d,g,k),p=Math.min(d,g,k);if(m===p)return 0;let n=0;switch(m){case d:n=(g-k)/(m-p)+(g<k?6:0);break;case g:n=(k-d)/(m-p)+2;break;case k:n=(d-g)/(m-p)+4}return Math.round(n/6*360)}static GetSaturation(d,g,k){const m=Math.max(d,
g,k);d=Math.min(d,g,k);if(m===d)return 0;g=m-d;return Math.round(100*(.5<(m+d)/2?g/(2-m-d):g/(m+d)))}static GetLuminosity(d,g,k){const m=Math.max(d,g,k);return m?Math.round((m+Math.min(d,g,k))/2*100):0}};f.Color.White=Object.freeze(f.New(f.Color,1,1,1,1));f.Color.Black=Object.freeze(f.New(f.Color,0,0,0,1));f.Color.TransparentBlack=Object.freeze(f.New(f.Color,0,0,0,0))}"use strict";
{const f=self.C3;f.Vector2=class{constructor(b,a){this._y=this._x=0;b instanceof f.Vector2?this.copy(b):this.set(b||0,a||0)}set(b,a){this._x=+b;this._y=+a}copy(b){this._x=b._x;this._y=b._y}equals(b){return this._x===b._x&&this._y===b._y}setX(b){this._x=+b}getX(){return this._x}setY(b){this._y=+b}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,a){b[a++]=this._x;b[a]=this._y}offset(b,a){this._x+=+b;this._y+=+a}scale(b,
a){this._x*=b;this._y*=a}round(){this._x=Math.round(this._x);this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x);this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y)}angle(){return f.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}rotatePrecalc(b,a){const e=this._x*a-this._y*b;this._y=this._y*a+this._x*b;this._x=e}rotate(b){0!==b&&this.rotatePrecalc(Math.sin(b),Math.cos(b))}rotateAbout(b,
a,e){0===b||a===this._x&&e===this._y||(this._x-=a,this._y-=e,this.rotatePrecalc(Math.sin(b),Math.cos(b)),this._x+=+a,this._y+=+e)}move(b,a){0!==a&&(this._x+=Math.cos(b)*a,this._y+=Math.sin(b)*a)}normalize(){const b=this.length();0!==b&&1!==b&&(this._x/=b,this._y/=b)}clamp(b,a){this._x=f.clamp(this._x,b,a);this._y=f.clamp(this._y,b,a)}}}"use strict";
{const f=self.C3;f.Rect=class{constructor(b,a,e,c){this._bottom=this._right=this._top=this._left=0;b instanceof f.Rect?this.copy(b):this.set(b||0,a||0,e||0,c||0)}set(b,a,e,c){this._left=+b;this._top=+a;this._right=+e;this._bottom=+c}setWH(b,a,e,c){b=+b;a=+a;this._left=b;this._top=a;this._right=b+ +e;this._bottom=a+ +c}copy(b){this._left=+b._left;this._top=+b._top;this._right=+b._right;this._bottom=+b._bottom}clone(){return new f.Rect(this._left,this._top,this._right,this._bottom)}static Merge(b,a){const e=
new f.Rect;e.setLeft(Math.min(b._left,a._left));e.setTop(Math.min(b._top,a._top));e.setRight(Math.max(b._right,a._right));e.setBottom(Math.max(b._bottom,a._bottom));return e}static FromObject(b){return new f.Rect(b.left,b.top,b.right,b.bottom)}equals(b){return this._left===b._left&&this._top===b._top&&this._right===b._right&&this._bottom===b._bottom}setLeft(b){this._left=+b}getLeft(){return this._left}setTop(b){this._top=+b}getTop(){return this._top}setRight(b){this._right=+b}getRight(){return this._right}setBottom(b){this._bottom=
+b}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),this.height())}writeToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a]=this._bottom}writeAsQuadToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a++]=this._top;b[a++]=this._right;b[a++]=this._bottom;b[a++]=this._left;b[a]=this._bottom}width(){return this._right-
this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right+=b;this._bottom+=a}offsetLeft(b){this._left+=+b}offsetTop(b){this._top+=+b}offsetRight(b){this._right+=+b}offsetBottom(b){this._bottom+=+b}toSquare(b){if("x"!==b)throw Error("invalid axis, only 'x' supported");this._bottom=this._top<this._bottom?this._left<this._right?this._top+this.width():this._top-this.width():
this._left<this._right?this._top-this.width():this._top+this.width()}inflate(b,a){b=+b;a=+a;this._left-=b;this._top-=a;this._right+=b;this._bottom+=a}deflate(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right-=b;this._bottom-=a}multiply(b,a){this._left*=b;this._top*=a;this._right*=b;this._bottom*=a}divide(b,a){this._left/=b;this._top/=a;this._right/=b;this._bottom/=a}mirrorAround(b){this._left=+b-this._left;this._right=+b-this._right}flipAround(b){this._top=+b-this._top;this._bottom=+b-this._bottom}swapLeftRight(){const b=
this._left;this._left=this._right;this._right=b}swapTopBottom(){const b=this._top;this._top=this._bottom;this._bottom=b}shuntY(b){const a=this._top;this._top=+b-this._bottom;this._bottom=+b-a}round(){this._left=Math.round(this._left);this._top=Math.round(this._top);this._right=Math.round(this._right);this._bottom=Math.round(this._bottom)}roundInner(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}roundOuter(){this._left=
Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}floor(){this._left=Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}ceil(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}clamp(b,a,e,c){this._left<b&&(this._left=+b);this._top<a&&(this._top=+a);this._right>
e&&(this._right=+e);this._bottom>c&&(this._bottom=+c)}clampFlipped(b,a,e,c){this._left<b&&(this._left=+b);this._top>a&&(this._top=+a);this._right>e&&(this._right=+e);this._bottom<c&&(this._bottom=+c)}normalize(){this._left>this._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(b){return!(b._right<this._left||b._bottom<this._top||b._left>this._right||b._top>this._bottom)}intersectsRectOffset(b,a,e){return!(b._right+a<this._left||b._bottom+e<this._top||b._left+
a>this._right||b._top+e>this._bottom)}containsPoint(b,a){return b>=this._left&&b<=this._right&&a>=this._top&&a<=this._bottom}containsRect(b){return b._left>=this._left&&b._top>=this._top&&b._right<=this._right&&b._bottom<=this._bottom}expandToContain(b){b._left<this._left&&(this._left=+b._left);b._top<this._top&&(this._top=+b._top);b._right>this._right&&(this._right=+b._right);b._bottom>this._bottom&&(this._bottom=+b._bottom)}lerpInto(b){this._left=f.lerp(b._left,b._right,this._left);this._top=f.lerp(b._top,
b._bottom,this._top);this._right=f.lerp(b._left,b._right,this._right);this._bottom=f.lerp(b._top,b._bottom,this._bottom)}}}"use strict";
{const f=self.C3;f.Quad=class{constructor(b,a,e,c,d,g,k,m){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;b instanceof f.Quad?this.copy(b):this.set(b||0,a||0,e||0,c||0,d||0,g||0,k||0,m||0)}set(b,a,e,c,d,g,k,m){this._tlx=+b;this._tly=+a;this._trx=+e;this._try=+c;this._brx=+d;this._bry=+g;this._blx=+k;this._bly=+m}setRect(b,a,e,c){this.set(b,a,e,a,e,c,b,c)}copy(b){this._tlx=b._tlx;this._tly=b._tly;this._trx=b._trx;this._try=b._try;this._brx=b._brx;this._bry=b._bry;
this._blx=b._blx;this._bly=b._bly}equals(b){return this._tlx===b._tlx&&this._tly===b._tly&&this._trx===b._trx&&this._try===b._try&&this._brx===b._brx&&this._bry===b._bry&&this._blx===b._blx&&this._bly===b._bly}setTlx(b){this._tlx=+b}getTlx(){return this._tlx}setTly(b){this._tly=+b}getTly(){return this._tly}setTrx(b){this._trx=+b}getTrx(){return this._trx}setTry(b){this._try=+b}getTry(){return this._try}setBrx(b){this._brx=+b}getBrx(){return this._brx}setBry(b){this._bry=+b}getBry(){return this._bry}setBlx(b){this._blx=
+b}getBlx(){return this._blx}setBly(b){this._bly=+b}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}toArray(){return[this._tlx,this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,a){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=this._trx;b[a++]=this._try;b[a++]=this._brx;
b[a++]=this._bry;b[a++]=this._blx;b[a]=this._bly}writeToTypedArray3D(b,a,e){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=e;b[a++]=this._trx;b[a++]=this._try;b[a++]=e;b[a++]=this._brx;b[a++]=this._bry;b[a++]=e;b[a++]=this._blx;b[a++]=this._bly;b[a]=e}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,e){const c=b._left*a,d=b._top*a,g=b._right*a;a*=b._bottom;
const k=b._left*e,m=b._top*e,p=b._right*e;b=b._bottom*e;this._tlx=k-d;this._tly=m+c;this._trx=p-d;this._try=m+g;this._brx=p-a;this._bry=b+g;this._blx=k-a;this._bly=b+c}getBoundingBox(b){b.set(Math.min(this._tlx,this._trx,this._brx,this._blx),Math.min(this._tly,this._try,this._bry,this._bly),Math.max(this._tlx,this._trx,this._brx,this._blx),Math.max(this._tly,this._try,this._bry,this._bly))}containsPoint(b,a){var e=this._trx-this._tlx,c=this._try-this._tly;const d=this._brx-this._tlx,g=this._bry-this._tly;
b-=this._tlx;a-=this._tly;var k=e*e+c*c;let m=e*d+c*g;c=e*b+c*a;const p=d*d+g*g,n=d*b+g*a;let u=1/(k*p-m*m);e=(p*c-m*n)*u;k=(k*n-m*c)*u;if(0<=e&&0<k&&1>e+k)return!0;e=this._blx-this._tlx;c=this._bly-this._tly;k=e*e+c*c;m=e*d+c*g;c=e*b+c*a;u=1/(k*p-m*m);e=(p*c-m*n)*u;k=(k*n-m*c)*u;return 0<=e&&0<k&&1>e+k}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(b,a,e,c){return this.containsPoint(b,a)||this.containsPoint(e,c)?
!0:f.segmentIntersectsQuad(b,a,e,c,this)}intersectsQuad(b){var a=b.midX(),e=b.midY();if(this.containsPoint(a,e))return!0;a=this.midX();e=this.midY();if(b.containsPoint(a,e))return!0;a=this._tlx;e=this._tly;const c=this._trx,d=this._try,g=this._brx,k=this._bry,m=this._blx,p=this._bly;return f.segmentIntersectsQuad(a,e,c,d,b)||f.segmentIntersectsQuad(c,d,g,k,b)||f.segmentIntersectsQuad(g,k,m,p,b)||f.segmentIntersectsQuad(m,p,a,e,b)}mirror(){this._swap(0,2);this._swap(1,3);this._swap(6,4);this._swap(7,
5)}flip(){this._swap(0,6);this._swap(1,7);this._swap(2,4);this._swap(3,5)}diag(){this._swap(2,6);this._swap(3,7)}_swap(b,a){const e=this._getAtIndex(b);this._setAtIndex(b,this._getAtIndex(a));this._setAtIndex(a,e)}_getAtIndex(b){switch(b){case 0:return this._tlx;case 1:return this._tly;case 2:return this._trx;case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index");}}_setAtIndex(b,
a){a=+a;switch(b){case 0:this._tlx=a;break;case 1:this._tly=a;break;case 2:this._trx=a;break;case 3:this._try=a;break;case 4:this._brx=a;break;case 5:this._bry=a;break;case 6:this._blx=a;break;case 7:this._bly=a;break;default:throw new RangeError("invalid quad point index");}}}}"use strict";
{const f=self.C3,b=[0,0,1,0,1,1,0,1],a=f.New(f.Quad);f.CollisionPoly=class extends f.DefendedBase{constructor(e,c=!0){super();e||(e=b);this._ptsArr=Float64Array.from(e);this._bbox=new f.Rect;this._isBboxChanged=!0;this._enabled=c}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(e){this._ptsArr.length===e.length?this._ptsArr.set(e):this._ptsArr=Float64Array.from(e);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(b)}copy(e){this.setPoints(e._ptsArr)}setBboxChanged(){this._isBboxChanged=
!0}_updateBbox(){if(this._isBboxChanged){var e=this._ptsArr,c=e[0],d=e[1],g=c,k=d;for(let m=0,p=e.length;m<p;m+=2){const n=e[m],u=e[m+1];n<c&&(c=n);n>g&&(g=n);u<d&&(d=u);u>k&&(k=u)}this._bbox.set(c,d,g,k);this._isBboxChanged=!1}}setFromRect(e,c,d){let g=this._ptsArr;8!==g.length&&(this._ptsArr=g=new Float64Array(8));g[0]=e.getLeft()-c;g[1]=e.getTop()-d;g[2]=e.getRight()-c;g[3]=e.getTop()-d;g[4]=e.getRight()-c;g[5]=e.getBottom()-d;g[6]=e.getLeft()-c;g[7]=e.getBottom()-d;this._bbox.copy(e);0===c&&0===
d||this._bbox.offset(-c,-d);this._isBboxChanged=!1}setFromQuad(e,c,d){a.copy(e);a.offset(c,d);this.setPoints(a.toArray());this._isBboxChanged=!0}transform(e,c,d){let g=0,k=1;0!==d&&(g=Math.sin(d),k=Math.cos(d));this.transformPrecalc(e,c,g,k)}transformPrecalc(e,c,d,g){const k=this._ptsArr;for(let m=0,p=k.length;m<p;m+=2){const n=m+1,u=k[m]*e,q=k[n]*c;k[m]=u*g-q*d;k[n]=q*g+u*d}this._isBboxChanged=!0}offset(e,c){const d=this._ptsArr;for(let g=0,k=d.length;g<k;g+=2)d[g]+=e,d[g+1]+=c}containsPoint(e,c){const d=
this._ptsArr;if(e===d[0]&&c===d[1])return!0;this._updateBbox();var g=this._bbox;const k=g.getLeft()-110,m=g.getTop()-101,p=g.getRight()+131;g=g.getBottom()+120;let n,u,q,r,t,x,z,D;k<e?(n=k,q=e):(n=e,q=k);m<c?(u=m,r=c):(u=c,r=m);p<e?(t=p,z=e):(t=e,z=p);g<c?(x=g,D=c):(x=c,D=g);let G=0,w=0;for(let I=0,P=d.length;I<P;I+=2){var B=(I+2)%P;const E=d[I],J=d[I+1],O=d[B];B=d[B+1];f.segmentsIntersectPreCalc(k,m,e,c,n,q,u,r,E,J,O,B)&&++G;f.segmentsIntersectPreCalc(p,g,e,c,t,z,x,D,E,J,O,B)&&++w}return 1===G%2||
1===w%2}intersectsPoly(e,c,d){const g=e._ptsArr,k=this._ptsArr;if(this.containsPoint(g[0]+c,g[1]+d)||e.containsPoint(k[0]-c,k[1]-d))return!0;for(let p=0,n=k.length;p<n;p+=2){var m=(p+2)%n;e=k[p];const u=k[p+1],q=k[m];m=k[m+1];let r,t,x,z;e<q?(r=e,x=q):(r=q,x=e);u<m?(t=u,z=m):(t=m,z=u);for(let D=0,G=g.length;D<G;D+=2){const w=(D+2)%G;if(f.segmentsIntersectPreCalc(e,u,q,m,r,x,t,z,g[D]+c,g[D+1]+d,g[w]+c,g[w+1]+d))return!0}}return!1}intersectsSegment(e,c,d,g,k,m){if(this.containsPoint(d-e,g-c)||this.containsPoint(k-
e,m-c))return!0;let p,n,u,q;d<k?(p=d,u=k):(p=k,u=d);g<m?(n=g,q=m):(n=m,q=g);const r=this._ptsArr;for(let t=0,x=r.length;t<x;t+=2){const z=(t+2)%x;if(f.segmentsIntersectPreCalc(d,g,k,m,p,u,n,q,r[t]+e,r[t+1]+c,r[z]+e,r[z+1]+c))return!0}return!1}mirror(e){const c=this._ptsArr;for(let d=0,g=c.length;d<g;d+=2)c[d]=2*e-c[d];this._isBboxChanged=!0}flip(e){const c=this._ptsArr;for(let d=0,g=c.length;d<g;d+=2){const k=d+1;c[k]=2*e-c[k]}this._isBboxChanged=!0}diag(){const e=this._ptsArr;for(let c=0,d=e.length;c<
d;c+=2){const g=c+1,k=e[c];e[c]=e[g];e[g]=k}this._isBboxChanged=!0}GetMidX(){const e=this._ptsArr;let c=0;for(let d=0,g=e.length;d<g;d+=2)c+=e[d];return c/this.pointCount()}GetMidY(){const e=this._ptsArr;let c=0;for(let d=0,g=e.length;d<g;d+=2)c+=e[d+1];return c/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}}"use strict";
{const f=self.C3;f.PairMap=class extends f.DefendedBase{constructor(b){super();this._firstMap=new Map;if(b)for(const [a,e,c]of b)this.Set(a,e,c)}Release(){this.Clear();this._firstMap=null}Clear(){const b=this._firstMap;for(const a of b.values())a.clear();b.clear()}Set(b,a,e){const c=this._firstMap;let d=c.get(b);d||(d=new Map,c.set(b,d));d.set(a,e)}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 e=this._firstMap,c=e.get(b);
if(!c)return!1;(a=c.delete(a))&&0===c.size&&e.delete(b);return a}DeleteEither(b){const a=this._firstMap,e=a.get(b);e&&(e.clear(),a.delete(b));for(const [c,d]of a.entries())d.delete(b)&&0===d.size&&a.delete(c)}GetSize(){let b=0;for(const a of this._firstMap.values())b+=a.size;return b}*values(){for(const b of this._firstMap.values())yield*b.values()}*keyPairs(){for(const [b,a]of this._firstMap.entries())for(const e of a.keys())yield[b,e]}*entries(){for(const [b,a]of this._firstMap.entries())for(const [e,
c]of a.entries())yield[b,e,c]}}}"use strict";
{const f=self.C3;f.ArraySet=class extends f.DefendedBase{constructor(){super();this._set=new Set;this._arr=[];this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear();f.clearArray(this._arr);this._needToRebuildArray=!1}Add(b){this._set.has(b)||(this._set.add(b),this._needToRebuildArray||this._arr.push(b))}Has(b){return this._set.has(b)}Delete(b){this._set.delete(b)&&(this._needToRebuildArray=!0)}GetSize(){return this._set.size}IsEmpty(){return 0===this._set.size}GetArray(){this._needToRebuildArray&&
(this._RebuildArray(),this._needToRebuildArray=!1);return this._arr}_RebuildArray(){const b=this._arr;f.clearArray(b);for(const a of this._set)b.push(a)}}}"use strict";
{const f=new Map,b=new Map,a=new Map,e=new Map,c=new Map,d=new Map;d.set("linear","noease");d.set("default","noease");self.Ease=class q{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(r,...t){this._CreateEaseMap();a.has(r)||a.set(r,new Map);r=a.get(r);return[...b.keys()].concat([...r.keys()]).filter(x=>!t.includes(x))}static GetRuntimeEaseNames(){this._CreateEaseMap();return[...b.keys()].concat([...e.keys()])}static IsNamePredefined(r){this._CreateEaseMap();
return[...b.keys()].includes(r)}static _GetEase(r){const t=d.get(r);if(t)return f.get(t);if(q.IsNamePredefined(r))return f.get(r);if(c.has(r))return c.get(r)}static GetEditorEase(r,t){this._CreateEaseMap();const x=q._GetEase(r);return x?x:a.get(t).get(r)}static GetRuntimeEase(r){this._CreateEaseMap();const t=q._GetEase(r);return t?t:e.get(r)}static GetEaseFromIndex(r){this._CreateEaseMap();return this.GetRuntimeEaseNames()[r]}static GetIndexForEase(r,t){this._CreateEaseMap();return this.GetEditorEaseNames(t).indexOf(r)}static _CreateEaseMap(){0===
f.size&&(this._AddPredifinedEase("default",()=>{}),this._AddPredifinedEase("noease",this.NoEase),this._AddPredifinedEase("easeinsine",this.EaseInSine),this._AddPredifinedEase("easeoutsine",this.EaseOutSine),this._AddPredifinedEase("easeinoutsine",this.EaseInOutSine),this._AddPredifinedEase("easeinelastic",this.EaseInElastic),this._AddPredifinedEase("easeoutelastic",this.EaseOutElastic),this._AddPredifinedEase("easeinoutelastic",this.EaseInOutElastic),this._AddPredifinedEase("easeinback",this.EaseInBack),
this._AddPredifinedEase("easeoutback",this.EaseOutBack),this._AddPredifinedEase("easeinoutback",this.EaseInOutBack),this._AddPredifinedEase("easeinbounce",this.EaseInBounce),this._AddPredifinedEase("easeoutbounce",this.EaseOutBounce),this._AddPredifinedEase("easeinoutbounce",this.EaseInOutBounce),this._AddPredifinedEase("easeincubic",this.EaseInCubic),this._AddPredifinedEase("easeoutcubic",this.EaseOutCubic),this._AddPredifinedEase("easeinoutcubic",this.EaseInOutCubic),this._AddPredifinedEase("easeinquad",
this.EaseInQuad),this._AddPredifinedEase("easeoutquad",this.EaseOutQuad),this._AddPredifinedEase("easeinoutquad",this.EaseInOutQuad),this._AddPredifinedEase("easeinquart",this.EaseInQuart),this._AddPredifinedEase("easeoutquart",this.EaseOutQuart),this._AddPredifinedEase("easeinoutquart",this.EaseInOutQuart),this._AddPredifinedEase("easeinquint",this.EaseInQuint),this._AddPredifinedEase("easeoutquint",this.EaseOutQuint),this._AddPredifinedEase("easeinoutquint",this.EaseInOutQuint),this._AddPredifinedEase("easeincirc",
this.EaseInCirc),this._AddPredifinedEase("easeoutcirc",this.EaseOutCirc),this._AddPredifinedEase("easeinoutcirc",this.EaseInOutCirc),this._AddPredifinedEase("easeinexpo",this.EaseInExpo),this._AddPredifinedEase("easeoutexpo",this.EaseOutExpo),this._AddPredifinedEase("easeinoutexpo",this.EaseInOutExpo),this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier),this._AddPrivateCustomEase("spline",this.EaseSpline))}static _AddPredifinedEase(r,t){q._AddEase(r,t,"predefined")}static _AddPrivateCustomEase(r,
t){q._AddEase(r,t,"private")}static AddCustomEase(r,t,x){this._CreateEaseMap();q._AddEase(r,t,"custom",x)}static RemoveCustomEase(r,t){this.IsNamePredefined(r)||[...c.keys()].includes(r)||(t=a.get(t))&&t.delete(r)}static _AddEase(r,t,x,z){switch(x){case "predefined":f.set(r,t);b.set(r,t);break;case "custom":z?(a.has(z)||a.set(z,new Map),a.get(z).set(r,t)):e.set(r,t);break;case "private":f.set(r,t);c.set(r,t);break;default:throw Error("unexpected ease mode");}}static NoEase(r,t,x,z){return x*r/z+t}static EaseInQuad(r,
t,x,z){return x*(r/=z)*r+t}static EaseOutQuad(r,t,x,z){return-x*(r/=z)*(r-2)+t}static EaseInOutQuad(r,t,x,z){return 1>(r/=z/2)?x/2*r*r+t:-x/2*(--r*(r-2)-1)+t}static EaseInCubic(r,t,x,z){return x*(r/=z)*r*r+t}static EaseOutCubic(r,t,x,z){return x*((r=r/z-1)*r*r+1)+t}static EaseInOutCubic(r,t,x,z){return 1>(r/=z/2)?x/2*r*r*r+t:x/2*((r-=2)*r*r+2)+t}static EaseInQuart(r,t,x,z){return x*(r/=z)*r*r*r+t}static EaseOutQuart(r,t,x,z){return-x*((r=r/z-1)*r*r*r-1)+t}static EaseInOutQuart(r,t,x,z){return 1>(r/=
z/2)?x/2*r*r*r*r+t:-x/2*((r-=2)*r*r*r-2)+t}static EaseInQuint(r,t,x,z){return x*(r/=z)*r*r*r*r+t}static EaseOutQuint(r,t,x,z){return x*((r=r/z-1)*r*r*r*r+1)+t}static EaseInOutQuint(r,t,x,z){return 1>(r/=z/2)?x/2*r*r*r*r*r+t:x/2*((r-=2)*r*r*r*r+2)+t}static EaseInSine(r,t,x,z){return-x*Math.cos(r/z*(Math.PI/2))+x+t}static EaseOutSine(r,t,x,z){return x*Math.sin(r/z*(Math.PI/2))+t}static EaseInOutSine(r,t,x,z){return-x/2*(Math.cos(Math.PI*r/z)-1)+t}static EaseInExpo(r,t,x,z){return 0===r?t:x*Math.pow(2,
10*(r/z-1))+t}static EaseOutExpo(r,t,x,z){return r===z?t+x:x*(-Math.pow(2,-10*r/z)+1)+t}static EaseInOutExpo(r,t,x,z){return 0===r?t:r===z?t+x:1>(r/=z/2)?x/2*Math.pow(2,10*(r-1))+t:x/2*(-Math.pow(2,-10*--r)+2)+t}static EaseInCirc(r,t,x,z){return-x*(Math.sqrt(1-(r/=z)*r)-1)+t}static EaseOutCirc(r,t,x,z){return x*Math.sqrt(1-(r=r/z-1)*r)+t}static EaseInOutCirc(r,t,x,z){return 1>(r/=z/2)?-x/2*(Math.sqrt(1-r*r)-1)+t:x/2*(Math.sqrt(1-(r-=2)*r)+1)+t}static EaseInElastic(r,t,x,z){let D=0,G=x;if(0===r)return t;
if(1===(r/=z))return t+x;D||(D=.3*z);G<Math.abs(x)?(G=x,x=D/4):x=D/(2*Math.PI)*Math.asin(x/G);return-(G*Math.pow(2,10*--r)*Math.sin(2*(r*z-x)*Math.PI/D))+t}static EaseOutElastic(r,t,x,z){let D,G=0,w=x;if(0===r)return t;if(1===(r/=z))return t+x;G||(G=.3*z);w<Math.abs(x)?(w=x,D=G/4):D=G/(2*Math.PI)*Math.asin(x/w);return w*Math.pow(2,-10*r)*Math.sin(2*(r*z-D)*Math.PI/G)+x+t}static EaseInOutElastic(r,t,x,z){let D,G=0,w=x;if(0===r)return t;if(2===(r/=z/2))return t+x;G||(G=.3*z*1.5);w<Math.abs(x)?(w=x,
D=G/4):D=G/(2*Math.PI)*Math.asin(x/w);return 1>r?-.5*w*Math.pow(2,10*--r)*Math.sin(2*(r*z-D)*Math.PI/G)+t:w*Math.pow(2,-10*--r)*Math.sin(2*(r*z-D)*Math.PI/G)*.5+x+t}static EaseInBack(r,t,x,z,D){void 0===D&&(D=1.70158);return x*(r/=z)*r*((D+1)*r-D)+t}static EaseOutBack(r,t,x,z,D){void 0===D&&(D=1.70158);return x*((r=r/z-1)*r*((D+1)*r+D)+1)+t}static EaseInOutBack(r,t,x,z,D){void 0===D&&(D=1.70158);return 1>(r/=z/2)?x/2*r*r*(((D*=1.525)+1)*r-D)+t:x/2*((r-=2)*r*(((D*=1.525)+1)*r+D)+2)+t}static EaseInBounce(r,
t,x,z){return x-q.EaseOutBounce(z-r,0,x,z)+t}static EaseOutBounce(r,t,x,z){return(r/=z)<1/2.75?7.5625*x*r*r+t:r<2/2.75?x*(7.5625*(r-=1.5/2.75)*r+.75)+t:r<2.5/2.75?x*(7.5625*(r-=2.25/2.75)*r+.9375)+t:x*(7.5625*(r-=2.625/2.75)*r+.984375)+t}static EaseInOutBounce(r,t,x,z){return r<z/2?.5*q.EaseInBounce(2*r,0,x,z)+t:.5*q.EaseOutBounce(2*r-z,0,x,z)+.5*x+t}static EaseCubicBezier(r,t,x,z,D){return t+3*r*(x-t)+3*r**2*(t+z-2*x)+r**3*(D-t+3*x-3*z)}static EaseSpline(r,t,x,z,D,G,w,B,I,P){if(z===D&&G===w)return r;
r=u(r,t,z,G,B,P);t=g(x,D,w,I);z=k(x,D,w,I);x=m(x,D,w,I);return p(r,t,z,x)}static GetBezierSamples(r,t,x,z){const D=[],G=g(r,t,x,z),w=k(r,t,x,z);r=m(r,t,x,z);for(t=0;11>t;++t)x=p(.1*t,G,w,r),D.push(x);return D}};const g=(q,r,t,x)=>x-3*t+3*r-q,k=(q,r,t,x)=>3*t-6*r+3*q,m=(q,r,t,x)=>3*(r-q),p=(q,r,t,x)=>((r*q+t)*q+x)*q,n=(q,r,t,x)=>3*r*q*q+2*t*q+x,u=(q,r,t,x,z,D)=>{if(1==q)return 1;for(var G=0,w=1,B=D[w];10!=w&&B<=q;)w++,B=D[w],G+=.1;w--;B=D[w];D=G+(q-B)/(D[w+1]-B)*.1;w=g(r,t,x,z);B=k(r,t,x,z);r=m(r,
t,x,z);t=n(D,w,B,r);if(0!==t)if(.02<=t)for(G=0;4>G;++G)t=p(D,w,B,r)-q,x=n(D,w,B,r),D-=t/x;else{t=G;G+=.1;x=0;let I;do D=t+(G-t)/2,z=p(D,w,B,r)-q,0<z?G=D:t=D,z=1e-7<Math.abs(z),I=10>++x;while(z&&I)}return D}}"use strict";
{const f=self.C3;function b(a){f.IsString(a)}f.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){f.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(a=Math.random()*this.GetTotalWeight()){let e=0;for(const [c,d]of this._items)if(e+=c,a<e)return d;return 0}AddItem(a,e){b(e);this._totalWeight+=a;this._items.push([a,e])}RemoveItem(a,e){b(e);const c=0===a;for(let d=0;d<this._items.length;d++){const g=
this._items[d],k=g[1]===e;if((c||g[0]===a)&&k){this._items.splice(d,1);this._totalWeight-=g[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(a){const e=new f.ProbabilityTable;a=JSON.parse(a);for(const c of a)e.AddItem(c[0],c[1]);return e}}}"use strict";
self.C3.Event=class{constructor(f,b){this.type=f;this.cancelable=!!b;this.isAsync=this.propagationStopped=this.defaultPrevented=!1}preventDefault(){if(!this.cancelable)throw Error(`event '${this.type}' is not cancelable`);this.defaultPrevented=!0}stopPropagation(){if(!this.cancelable)throw Error(`event '${this.type}' cannot be stopped`);if(this.isAsync)throw Error(`cannot stop async event '${this.type}' propagation`);this.propagationStopped=!0}};"use strict";
{const f=self.C3;f.Event.Handler=class extends f.DefendedBase{constructor(b){super();this._type=b;this._captureListeners=[];this._captureListenersSet=new Set;this._listeners=[];this._listenersSet=new Set;this._fireDepth=0;this._queueAddListeners=[];this._queueRemoveCaptureListeners=[];this._queueRemoveListeners=[]}Release(){0<this._fireDepth||(f.clearArray(this._captureListeners),this._captureListenersSet.clear(),f.clearArray(this._listeners),this._listenersSet.clear(),f.clearArray(this._queueAddListeners),
f.clearArray(this._queueRemoveCaptureListeners),f.clearArray(this._queueRemoveListeners),f.Release(this))}_AddListener(b,a){this._IsFiring()?this._queueAddListeners.push([b,a]):a?this._captureListenersSet.has(b)||(this._captureListeners.push(b),this._captureListenersSet.add(b)):this._listenersSet.has(b)||(this._listeners.push(b),this._listenersSet.add(b))}_RemoveListener(b,a){this._IsFiring()?a?this._queueRemoveCaptureListeners.push(b):this._queueRemoveListeners.push(b):a?this._captureListenersSet.has(b)&&
(this._captureListenersSet.delete(b),f.arrayFindRemove(this._captureListeners,b)):this._listenersSet.has(b)&&(this._listenersSet.delete(b),f.arrayFindRemove(this._listeners,b))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){for(var b of this._queueAddListeners)this._AddListener(...b);f.clearArray(this._queueAddListeners);for(var a of this._queueRemoveListeners)this._listenersSet.delete(a);for(const e of this._queueRemoveCaptureListeners)this._captureListenersSet.delete(e);
b=new Set(this._queueRemoveListeners);a=new Set(this._queueRemoveCaptureListeners);f.arrayRemoveAllInSet(this._listeners,b);f.arrayRemoveAllInSet(this._captureListeners,a);f.clearArray(this._queueRemoveCaptureListeners);f.clearArray(this._queueRemoveListeners)}_FireCancellable(b){this._IncreaseFireDepth();let a=!1;for(let e=0,c=this._captureListeners.length;e<c;++e)if(this._captureListeners[e](b),b.propagationStopped){a=!0;break}if(!a)for(let e=0,c=this._listeners.length;e<c&&(this._listeners[e](b),
!b.propagationStopped);++e);this._DecreaseFireDepth();return!b.defaultPrevented}_FireNonCancellable(b){this._IncreaseFireDepth();for(let a=0,e=this._captureListeners.length;a<e;++a)this._captureListeners[a](b);for(let a=0,e=this._listeners.length;a<e;++a)this._listeners[a](b);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&(this._queueAddListeners.length||this._queueRemoveCaptureListeners.length||this._queueRemoveListeners.length)&&
this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(b){b?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(b){let a=[];for(let e=0,c=this._captureListeners.length;e<c;++e){let d=this._captureListeners[e];a.push(f.Asyncify(()=>d(b)))}for(let e=0,c=this._listeners.length;e<c;++e){let d=this._listeners[e];a.push(f.Asyncify(()=>d(b)))}return Promise.all(a).then(()=>!b.defaultPrevented)}_FireAndWait_AsyncOptional(b){const a=[];this._IncreaseFireDepth();for(let c=0,d=this._captureListeners.length;c<
d;++c){var e=this._captureListeners[c](b);e instanceof Promise&&a.push(e)}for(let c=0,d=this._listeners.length;c<d;++c)e=this._listeners[c](b),e instanceof Promise&&a.push(e);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 e=0,c=this._captureListeners.length;e<c;++e){var a=this._captureListeners[e](b);
a instanceof Promise&&await a}for(let e=0,c=this._listeners.length;e<c;++e)a=this._listeners[e](b),a instanceof Promise&&await a;this._DecreaseFireDepth();return!b.defaultPrevented}*_FireAsGenerator(b){this._IncreaseFireDepth();for(let e=0,c=this._captureListeners.length;e<c;++e){var a=this._captureListeners[e](b);f.IsIterator(a)&&(yield*a)}for(let e=0,c=this._listeners.length;e<c;++e)a=this._listeners[e](b),f.IsIterator(a)&&(yield*a);this._DecreaseFireDepth()}}}"use strict";
{const f=self.C3;f.Event.Dispatcher=class extends f.DefendedBase{constructor(){super();this._eventHandlers=new Map;this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw Error("already released");this.ClearEvents();this._dispatcherWasReleased=!0;f.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let b of this._eventHandlers.values())b.Release();this._eventHandlers.clear()}_GetHandlerByType(b,a){let e=this._eventHandlers.get(b);return e?e:a?(e=
f.New(f.Event.Handler,b),this._eventHandlers.set(b,e),e):null}HasAnyHandlerFor(b){return this._eventHandlers.has(b)}addEventListener(b,a,e){this._GetHandlerByType(b,!0)._AddListener(a,!!e)}removeEventListener(b,a,e){let c=this._GetHandlerByType(b,!1);c&&(c._RemoveListener(a,!!e),c._IsEmpty()&&this._eventHandlers.delete(b))}dispatchEvent(b){const a=this._GetHandlerByType(b.type,!1);return a?b.cancelable?a._FireCancellable(b):a._FireNonCancellable(b):!0}dispatchEventAsync(b){const a=this._GetHandlerByType(b.type,
!1);if(!a)return Promise.resolve(!0);b.isAsync=!0;return a._FireAsync(b)}async dispatchEventAndClearAsync(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return!0;this._eventHandlers.delete(b.type);b.isAsync=!0;b=await a._FireAsync(b);a.Release();return b}async dispatchEventAndWaitAsync(b){const a=this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsync(b):!0}dispatchEventAndWait_AsyncOptional(b){const a=this._GetHandlerByType(b.type,!1);return a?a._FireAndWait_AsyncOptional(b):!0}async dispatchEventAndWaitAsyncSequential(b){const a=
this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsyncSequential(b):!0}dispatchGeneratorEvent(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return null;if(b.cancelable)throw Error("not supported");return a._FireAsGenerator(b)}SetDelayRemoveEventsEnabled(b){for(const a of this._eventHandlers.values())a.SetDelayRemoveEventsEnabled(b)}}}"use strict";
{const f=self.C3,b="undefined"!==typeof requestIdleCallback;let a=[],e=-1,c=0;function d(p){e=b&&0===c?requestIdleCallback(g,{timeout:35}):setTimeout(g,0<c?1:p)}function g(p){e=-1;if(a.length){var n=performance.now(),u=0;do{k(a.shift());var q=performance.now();++u;var r=(q-n)/u*1.1}while(a.length&&(b&&0===c&&"undefined"!==typeof p?r<p.timeRemaining():12>q-n+r));-1===e&&a.length&&d(Math.max(16-(q-n),4))}}function k(p){let n;try{n=p.func()}catch(u){p.reject(u);return}p.resolve(n)}let m=f.QueryString.Has("disable-asyncify");
m&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously.");f.Asyncify=function(p){let n=null;f.isDebug&&(n=f.GetCallStack());return new Promise((u,q)=>{a.push({func:p,resolve:u,reject:q,stack:n});m?k(a.pop()):-1===e&&d(16)})};f.Asyncify.SetHighThroughputMode=function(p){if(p)++c;else if(--c,0>c)throw Error("already turned off high throughput mode");}}"use strict";
{const f=self.C3;let b=-1;function a(){b=-1}f.FastGetDateNow=function(){-1===b&&(b=Date.now(),self.setTimeout(a,16));return b};let e=-1,c=-1,d=new Set;function g(){c=e=-1;let k=Date.now();for(let m of d)if(m._CheckTimeout(k)){let p=m._GetDeadline();if(-1===c||p<c)c=p}else d.delete(m);-1!==c&&(e=self.setTimeout(g,Math.max(c-k+100,1E3)))}f.IdleTimeout=class{constructor(k,m){this._callback=k;this._timeout=1E3*m;this._deadline=0;this._isActive=!1}Reset(){let k=f.FastGetDateNow();this._deadline=k+this._timeout;
this._isActive||(d.add(this),this._isActive=!0);-1===e?(c=this._deadline,e=self.setTimeout(g,this._timeout+100)):this._deadline<c&&c>k+1E3&&(self.clearTimeout(e),c=this._deadline,e=self.setTimeout(g,this._timeout+100))}_CheckTimeout(k){return k>=this._deadline?this._callback()?(this._deadline=k+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(d.delete(this),this._isActive=!1,0===d.size&&-1!==e&&(self.clearTimeout(e),c=e=-1))}Release(){this.Cancel();
this._callback=null}}}"use strict";
{const f=self.C3;f.Disposable=class b{constructor(a){this._disposed=!1;this._disposeAction=a}Dispose(){this._disposed||(this._disposed=!0,this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(a){return new b(()=>a.Release())}static From(a,e,c,d,g){if("undefined"===typeof d||null===d)d=!1;else if("boolean"!==typeof d&&"object"!==typeof d)throw new TypeError("invalid event listener options");g&&(c=c.bind(g));
if(e.includes(" ")){e=e.split(" ");g=new f.CompositeDisposable;for(let k of e)a.addEventListener(k,c,d),g.Add(f.New(f.Disposable,()=>a.removeEventListener(k,c,d)));return g}a.addEventListener(e,c,d);return f.New(f.Disposable,()=>a.removeEventListener(e,c,d))}};f.StubDisposable=class extends f.Disposable{SetAction(b){this._disposeAction=b}};f.CompositeDisposable=class extends f.Disposable{constructor(...b){super();this._disposables=new Set;for(let a of b)this.Add(a)}Add(...b){if(this._disposed)throw Error("already disposed");
for(let a of b)this._disposables.add(a)}Remove(b){if(this._disposed)throw Error("already disposed");this._disposables.delete(b)}RemoveAll(){if(this._disposed)throw Error("already disposed");if(this._disposables){for(let b of this._disposables)b.Dispose();this._disposables.clear()}}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw Error("already disposed");this._disposed=!0;for(let b of this._disposables)b.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}}"use strict";
{const f=self.C3;f.KahanSum=class extends f.DefendedBase{constructor(){super();this._sum=this._t=this._y=this._c=0}Add(b){this._y=+b-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(b){this._sum-=+b}Get(){return this._sum}Reset(){this._sum=this._t=this._y=this._c=0}Set(b){this._t=this._y=this._c=0;this._sum=+b}Release(){}}}"use strict";
{const f=self.C3,b={RBnode:function(a){this.tree=a;this.left=this.right=this.tree.sentinel;this.parent=null;this.color=!1;this.key=null},RedBlackSet:function(a){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=a||this.default_compare}};b.RedBlackSet.prototype.default_compare=function(a,e){return a<e?-1:e<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 e=a.right;a.right=e.left;e.left!=this.sentinel&&(e.left.parent=a);e.parent=a.parent;a.parent==this.sentinel?this.root=e:a==a.parent.left?a.parent.left=e:a.parent.right=e;e.left=a;a.parent=e};b.RedBlackSet.prototype.rightRotate=function(a){var e=a.left;a.left=e.right;e.right!=this.sentinel&&
(e.right.parent=a);e.parent=a.parent;a.parent==this.sentinel?this.root=e:a==a.parent.right?a.parent.right=e:a.parent.left=e;e.right=a;a.parent=e};b.RedBlackSet.prototype.insert=function(a){if(this.contains(a))this.get_(a).key=a;else{var e=new b.RBnode(this);e.key=a;a=this.sentinel;for(var c=this.root;c!=this.sentinel;)a=c,c=0>this.compare(e.key,c.key)?c.left:c.right;e.parent=a;a==this.sentinel?this.root=e:0>this.compare(e.key,a.key)?a.left=e:a.right=e;e.left=this.sentinel;e.right=this.sentinel;e.color=
!0;this.insertFixup(e);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 e=a.parent.parent.right;1==e.color?(a.parent.color=!1,e.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 e=a.parent.parent.left,1==e.color?(a.parent.color=
!1,e.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 e=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a);var c=e.left!=this.sentinel?e.left:e.right;c.parent=e.parent;e.parent==this.sentinel?this.root=c:e==e.parent.left?e.parent.left=c:e.parent.right=
c;e!=a&&(a.key=e.key);0==e.color&&this.deleteFixup(c);this.size--};b.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&0==a.color;)if(a==a.parent.left){var e=a.parent.right;1==e.color&&(e.color=!1,a.parent.color=!0,this.leftRotate(a.parent),e=a.parent.right);0==e.left.color&&0==e.right.color?(e.color=!0,a=a.parent):(0==e.right.color&&(e.left.color=!1,e.color=!0,this.rightRotate(e),e=a.parent.right),e.color=a.parent.color,a.parent.color=!1,e.right.color=!1,this.leftRotate(a.parent),
a=this.root)}else e=a.parent.left,1==e.color&&(e.color=!1,a.parent.color=!0,this.rightRotate(a.parent),e=a.parent.left),0==e.right.color&&0==e.left.color?(e.color=!0,a=a.parent):(0==e.left.color&&(e.right.color=!1,e.color=!0,this.leftRotate(e),e=a.parent.left),e.color=a.parent.color,a.parent.color=!1,e.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 e=a.key;this.delete_(a);return e}return null};b.RedBlackSet.prototype.removeSwapped=
function(a,e){this.remove(e)};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 e=a.parent;e!=this.sentinel&&a==e.right;)a=e,e=e.parent;return e};b.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var e=a.parent;e!=this.sentinel&&
a==e.left;)a=e,e=e.parent;return e};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 e=a.parent;e!=this.sentinel&&a==e.right;)a=e,e=e.parent;return e!=this.sentinel?e.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 e=a.parent;e!=this.sentinel&&
a==e.left;)a=e,e=e.parent;return e!=this.sentinel?e.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 e=this.root;e!=this.sentinel&&0!=this.compare(e.key,a);)e=0>this.compare(a,e.key)?e.left:e.right;return e};b.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key};b.RedBlackSet.prototype.getValues=function(){var a=
[];this.forEach(function(e){a.push(e)});return a};b.RedBlackSet.prototype.insertAll=function(a){if("array"==b.typeOf(a))for(var e=0;e<a.length;e++)this.insert(a[e]);else if("function"==b.typeOf(a.forEach))a.forEach(this.insert,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),e=0;e<a.length;e++)this.insert(a[e]);else if("object"==b.typeOf(a))for(e in a)this.insert(a[e])};b.RedBlackSet.prototype.removeAll=function(a){if("array"==b.typeOf(a))for(var e=0;e<a.length;e++)this.remove(a[e]);
else if("function"==b.typeOf(a.forEach))a.forEach(this.removeSwapped,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),e=0;e<a.length;e++)this.remove(a[e]);else if("object"==b.typeOf(a))for(e in a)this.remove(a[e])};b.RedBlackSet.prototype.containsAll=function(a){if("array"==b.typeOf(a)){for(var e=0;e<a.length;e++)if(!this.contains(a[e]))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(e=
0;e<a.length;e++)if(!this.contains(a[e]))return!1;return!0}if("object"==b.typeOf(a)){for(e in a)if(!this.contains(a[e]))return!1;return!0}};b.RedBlackSet.prototype.range=function(a,e){var c=[];this.traverseFromTo(function(d){c.push(d)},a,e);return c};b.RedBlackSet.prototype.traverse=function(a,e){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel&&!a.call(e,c.key,this);)c=this.successor_(c)};b.RedBlackSet.prototype.traverseFrom=function(a,e,c){if(!this.isEmpty())for(e=this.get_(e);e!=
this.sentinel&&!a.call(c,e.key,this);)e=this.successor_(e)};b.RedBlackSet.prototype.traverseTo=function(a,e,c){if(!this.isEmpty()){var d=this.min(this.root);for(e=this.get_(e);d!=e&&!a.call(c,d.key,this);)d=this.successor_(d)}};b.RedBlackSet.prototype.traverseFromTo=function(a,e,c,d){if(!this.isEmpty())for(e=this.get_(e),c=this.get_(c);e!=c&&!a.call(d,e.key,this);)e=this.successor_(e)};b.RedBlackSet.prototype.traverseBackwards=function(a,e){if(!this.isEmpty())for(var c=this.max(this.root);c!=this.sentinel&&
!a.call(e,c.key,this);)c=this.predeccessor_(c)};b.RedBlackSet.prototype.forEach=function(a,e){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.call(e,c.key,c.key,this)};b.RedBlackSet.prototype.some=function(a,e){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(a.call(e,c.key,c.key,this))return!0;return!1};b.RedBlackSet.prototype.every=function(a,e){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=
this.successor_(c))if(!a.call(e,c.key,c.key,this))return!1;return!0};b.RedBlackSet.prototype.map=function(a,e){var c=[];if(this.isEmpty())return c;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))c.push(a.call(e,d.key,d.key,this));return c};b.RedBlackSet.prototype.filter=function(a,e){var c=[];if(this.isEmpty())return c;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))a.call(e,d.key,d.key,this)&&c.push(d.key);return c};b.RedBlackSet.prototype.getCount=function(){return this.size};
b.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};b.RedBlackSet.prototype.isSubsetOf=function(a){var e=b.getCount(a);if(this.getCount()>e)return!1;e=0;if(this.isEmpty())return!0;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))b.contains.call(a,a,c.key)&&e++;return e==this.getCount()};b.RedBlackSet.prototype.intersection=function(a){var e=new b.RedBlackSet(this.compare);if(this.isEmpty())return e;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.contains.call(a,
c.key,c.key,this)&&e.insert(c.key);return e};f.RedBlackSet=class extends f.DefendedBase{constructor(a){super();this._rbSet=new b.RedBlackSet(a);this._enableQueue=!1;this._queueInsert=new Set;this._queueRemove=new Set}Add(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.delete(a):this._queueInsert.add(a):this._rbSet.insert(a)}Remove(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.add(a):this._queueInsert.delete(a):this._rbSet.remove(a)}Has(a){return this._enableQueue?this._queueInsert.has(a)?
!0:!this._queueRemove.has(a)&&this._rbSet.contains(a):this._rbSet.contains(a)}Clear(){this._rbSet.clear();this._queueInsert.clear();this._queueRemove.clear()}toArray(){if(this._enableQueue)throw Error("cannot be used in queueing mode");return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()+this._queueInsert.size-this._queueRemove.size}IsEmpty(){return 0===this.GetSize()}Front(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");
const a=this._rbSet;return a.min(a.root).key}Shift(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");const a=this.Front();this.Remove(a);return a}SetQueueingEnabled(a){a=!!a;if(this._enableQueue!==a&&(this._enableQueue=a,!a)){for(const e of this._queueRemove)this._rbSet.remove(e);this._queueRemove.clear();for(const e of this._queueInsert)this._rbSet.insert(e);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){var a=
this._rbSet;for(let e=a.min(a.root);e!=a.sentinel;e=a.successor_(e))yield e.key}}[Symbol.iterator](){return this.values()}}}"use strict";
{const f=self.C3;f.PromiseThrottle=class{constructor(b=f.hardwareConcurrency){this._maxParallel=b;this._queue=[];this._activeCount=0}Add(b){return new Promise((a,e)=>{this._queue.push({func:b,resolve:a,reject:e});this._MaybeStartNext()})}_FindInQueue(b){for(let a=0,e=this._queue.length;a<e;++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 e=[];let c=!1;const d=async k=>{for(;(k=a.pop())&&!c;)try{e.push(await k())}catch(m){throw c=!0,m;}},g=
[];for(;b--;)g.push(d());await Promise.all(g);return e}}}"use strict";
{const f=self.C3;f.RateLimiter=class{constructor(b,a,e){this._callback=b;this._interval=a;this._intervalOnBattery=e||2*a;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._canRunImmediate=this._ignoreReset=!1;this._callbackArguments=null}SetCanRunImmediate(b){this._canRunImmediate=!!b}_GetInterval(){return"undefined"!==typeof f.Battery&&f.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...b){if(-1===this._timerId){this._callbackArguments=
b;b=f.FastGetDateNow();var a=b-this._lastCallTime,e=this._GetInterval();a>=e&&this._canRunImmediate?(this._lastCallTime=b,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(e-a,4))}}_RunCallback(){this._ignoreReset=!0;const b=this._callbackArguments;this._callbackArguments=null;b?this._callback(...b):this._callback();this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=f.FastGetDateNow())}_OnTimer(){this._timerId=
-1;this._lastCallTime=f.FastGetDateNow();this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer();this._timerCallFunc=this._callbackArguments=this._callback=null}}}"use strict";
{const f=self.C3;f.SVGRasterManager=class{constructor(){this._images=new Map;this._allowNpotSurfaces=!1;this._redrawCallback=this._releaseResultCallback=this._rasterAtSizeCallback=this._getBaseSizeCallback=null}SetNpotSurfaceAllowed(b){this._allowNpotSurfaces=!!b}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(b){this._getBaseSizeCallback=b}GetBaseSize(b){if(!this._getBaseSizeCallback)throw Error("no get base size callback set");return this._getBaseSizeCallback(b)}SetRasterAtSizeCallback(b){this._rasterAtSizeCallback=
b}RasterAtSize(b,a,e,c,d,g){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(b,a,e,c,d,g)}SetReleaseResultCallback(b){this._releaseResultCallback=b}ReleaseResult(b){if(!this._releaseResultCallback)throw Error("no release result callback set");this._releaseResultCallback(b)}SetRedrawCallback(b){this._redrawCallback=b}Redraw(){if(!this._redrawCallback)throw Error("no redraw callback set");this._redrawCallback()}AddImage(b){let a=this._images.get(b);
a||(a=f.New(f.SVGRasterImage,this,b),this._images.set(b,a));a.IncReference();return a}_RemoveImage(b){this._images.delete(b.GetDataSource())}}}"use strict";
{const f=self.C3;f.SVGRasterImage=class{constructor(b,a){this._manager=b;this._dataSource=a;this._baseHeight=this._baseWidth=this._refCount=0;this._getBaseSizePromise=this._manager.GetBaseSize(a).then(e=>{this._baseWidth=e[0];this._baseHeight=e[1];this._manager.Redraw()}).catch(e=>{console.error("[SVG] Error loading SVG: ",e);this._hadError=!0;this._manager.Redraw()});this._rasterImageHeight=this._rasterImageWidth=this._rasterSurfaceHeight=this._rasterSurfaceWidth=0;this._isRasterizing=!1;this._rasterizedResult=
null;this._hadError=this._forceRaster=!1}Release(){if(0>=this._refCount)throw Error("already released");this._refCount--;0===this._refCount&&this._Release()}_Release(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null);this._manager._RemoveImage(this);this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return 0<this._refCount}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=
!0}async StartRasterForSize(b,a,e){if(0!==a&&0!==e&&!this._hadError&&!this._isRasterizing){var c=f.nextHighestPowerOfTwo(Math.ceil(a)),d=f.nextHighestPowerOfTwo(Math.ceil(e)),g=Math.max(c,d);2048<g&&(g=2048/g,a*=g,e*=g,c=Math.min(Math.ceil(c*g),2048),d=Math.min(Math.ceil(d*g),2048));a<c&&e<d&&(e=a/e,c/d>e?(a=d*e,e=d):(a=c,e=c/e));this._manager.IsNpotSurfaceAllowed()&&(c=Math.ceil(a),d=Math.ceil(e));c<=this._rasterSurfaceWidth&&d<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=
!0,this._rasterSurfaceWidth=c,this._rasterSurfaceHeight=d,b=await this._manager.RasterAtSize(this._dataSource,b,this._rasterSurfaceWidth,this._rasterSurfaceHeight,a,e),this._rasterizedResult&&this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=b,this._rasterImageWidth=a,this._rasterImageHeight=e,this._forceRaster=this._isRasterizing=!1,this._manager.Redraw())}}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}}"use strict";
{const f=self.C3;f.UTF8_BOM="\ufeff";const b=new Set([..."0123456789"]);f.IsNumericChar=function(p){return b.has(p)};const a=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);f.IsWhitespaceChar=function(p){return a.has(p)};f.FilterWhitespace=function(p){return[...p].filter(n=>!f.IsWhitespaceChar(n)).join("")};f.IsStringAllWhitespace=function(p){for(const n of p)if(!f.IsWhitespaceChar(n))return!1;return!0};f.IsUnprintableChar=
function(p){return 1===p.length&&32>p.charCodeAt(0)};f.FilterUnprintableChars=function(p){return[...p].filter(n=>!f.IsUnprintableChar(n)).join("")};const e=new Set([..."0123456789.+-e"]);f.IsStringNumber=function(p){p=p.trim();if(!p.length)return!1;let n=p.charAt(0);if("-"!==n&&!b.has(n))return!1;for(let u of p)if(!e.has(u))return!1;return!0};f.RemoveTrailingDigits=function(p){let n=p.length;for(;0<n;){let u=p.charAt(n-1);if(!f.IsNumericChar(u))break;--n}return p.substr(0,n)};f.IncrementNumberAtEndOf=
function(p){let n=f.RemoveTrailingDigits(p);p=(p=p.substr(n.length))?(parseInt(p,10)+1).toString():"2";return n+p};const c=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#39;"]]);function d(p){return c.get(p)}const g=/[&<>"']/g;f.EscapeHTML=function(p){return p.replace(g,d)};f.EscapeJS=function(p){p=f.ReplaceAll(p,"\\","\\\\");p=f.ReplaceAll(p,'"','\\"');p=f.ReplaceAll(p,"\t","\\t");p=f.ReplaceAll(p,"\r","");return f.ReplaceAll(p,"\n","\\n")};f.EscapeXML=function(p){p=f.ReplaceAll(p,
"&","&amp;");p=f.ReplaceAll(p,"<","&lt;");p=f.ReplaceAll(p,">","&gt;");return f.ReplaceAll(p,'"',"&quot;")};const k=/[-[\]{}()*+?.,\\^$|#\s]/g;f.EscapeRegex=function(p){return p.replace(k,"\\$&")};f.FindAll=function(p,n,u=!1){if(!n)return[];u||(p=p.toLowerCase(),n=n.toLowerCase());u=n.length;var q=0;let r=[];for(;-1<(q=p.indexOf(n,q));)r.push(q),q+=u;return r};f.ReplaceAll=function(p,n,u){return p.replaceAll(n,()=>u)};f.ReplaceAllCaseInsensitive=function(p,n,u){return p.replace(new RegExp(f.EscapeRegex(n),
"gi"),()=>u)};f.SetElementContent=function(p,n){"string"===typeof n?p.textContent=n:n.isPlainText()?p.textContent=n.toString():(p.innerHTML=n.toHTML(),n instanceof f.BBString&&n.attachLinkHandlers(p))};f.StringLikeEquals=function(p,n){return p instanceof f.HtmlString||p instanceof f.BBString?p.equals(n):n instanceof f.HtmlString||n instanceof f.BBString?n.equals(p):p===n};f.StringSubstitute=function(p,...n){let u=p;for(let q=0,r=n.length;q<r;++q){const t=`{${q}}`;if(!p.includes(t))throw Error(`missing placeholder '${t}' in string substitution`);
u=u.replace(t,n[q].toString())}return u};f.StringSubstituteAllowMissing=function(p,...n){let u=p,q=-1,r=-1;for(let t=0,x=n.length;t<x;++t){const z=`{${t}}`;p.includes(z)?(r=t,u=u.replace(z,n[t].toString())):-1===q&&(q=t)}if(0<=q&&0<=r&&q<r)throw Error(`missing placeholder '${q}' in string substitution`);return u};f.StringSubstituteMap=function(p,n){for(let [u,q]of Object.entries(n))p=p.replaceAll(u,q.toString());return p};f.SortAZCaseInsensitive=function(p,n){p=p.toLowerCase();n=n.toLowerCase();return p>
n?1:p<n?-1:0};f.FormatDataSize=function(p,n){n="common."+(n?"dataRates":"dataSizes")+".";const u=self.langSub;if(1024>p)return u(n+"bytes",p);if(1048576>p)return p/=1024,p=10>p?Math.round(10*p)/10:Math.round(p),u(n+"kilobytes",p);if(1073741824>p)return p/=1048576,p=10>p?Math.round(10*p)/10:Math.round(p),u(n+"megabytes",p);if(1099511627776>p)return p/=1073741824,p=10>p?Math.round(10*p)/10:Math.round(p),u(n+"gigabytes",p);p/=1099511627776;p=10>p?Math.round(10*p)/10:Math.round(p);return u(n+"terabytes",
p)};const m={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};f.FormatTime=function(p,n){n=Object.assign({},m,n);f.Lang.PushContext("common.time");const u=[],q=self.lang,r=self.langPluralSub;if(n.days){var t=Math.floor(p/86400);0<t&&(p-=86400*t,u.push(r(".days",null,t)))}n.hours&&(t=Math.floor(p/3600),0<t||u.length)&&(p-=3600*t,u.push(r(".hours",null,t)));n.minutes&&(t=Math.floor(p/60),0<t||u.length||!n.seconds)&&(p-=60*t,u.push(r(".minutes",null,t)));n.seconds&&u.push(r(".seconds",null,Math.floor(p%
60)));p=(n.approximate?q(".approx-prefix"):"")+u.join(q(".separator"));f.Lang.PopContext();return p};f.ZeroPad=function(p,n){let u=0>p?"-":"";p=Math.abs(p);p=p.toString();n-=p.length;for(let q=0;q<n;++q)u+="0";return u+p};f.StringToTitleCase=function(p){return p.toLowerCase().replace(/\b\w/g,n=>n.toUpperCase())};f.CompareVersionStrings=function(p,n){p=p.split(".").map(u=>u.trim());n=n.split(".").map(u=>u.trim());f.resizeArray(p,4,"0");f.resizeArray(n,4,"0");p=p.map(u=>parseInt(u,10));n=n.map(u=>parseInt(u,
10));for(let u=0;4>u;++u){const q=p[u]-n[u];if(0!==q)return 0>q?-1:1}return 0};f.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,p=>{const n=Math.floor(16*Math.random());return("x"===p?n:n&3|8).toString(16)})};f.StringHammingDistance=function(p,n){if(p.length!==n.length)throw Error("strings must be same length");let u=0;for(let q=0,r=p.length;q<r;++q)p.charAt(q)!==n.charAt(q)&&++u;return u};f.StringLevenshteinDistance=function(p,n){if(0===p.length)return n.length;
if(0===n.length)return p.length;let u,q,r,t;if(p.length>n.length){var x=p;p=n;n=x}t=Array(p.length+1);for(x=0;x<=p.length;x++)t[x]=x;for(x=1;x<=n.length;x++){q=x;for(u=1;u<=p.length;u++)r=n[x-1]===p[u-1]?t[u-1]:Math.min(t[u-1]+1,Math.min(q+1,t[u]+1)),t[u-1]=q,q=r;t[p.length]=q}return t[p.length]}}"use strict";
{const f=self.C3,b=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]],["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]),a=/\[(\/?)([a-zA-Z0-9]+)\]/g,e=/\[(\/?)([^\[]*?)\]/g;
let c=null,d=0;function g(m,p,n){var u=b.get(n);if(u){if("string"===typeof u){if("a"!==u||p)return"<"+p+u+">";p=parseInt(n.substring(1),10)-1;if(0>p||p>=c.length)throw Error("invalid bbcode link substitution");u=c[p];if("string"===typeof u)return`<a href="${c[p]}">`;if("function"===typeof u)return`<a class="bblink${p}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(u))return m=u[0],u=u[1],p?"</"+m+">":`<${m} class="${u}">`}else return"class"===n?p?"</span>":`<span class="bbclass${d++}">`:
m}const k=/\n/g;f.BBString=class{constructor(m,p){this._bbstr=p&&p.noEscape?m:f.EscapeHTML(m);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(p&&(this._convertLineBreaks=!!p.convertLineBreaks,p.links)){if(9<p.links.length)throw Error("too many links");this._linkActions=p.links}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion=this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&!this._needsLineBreakConversion&&!this._bbstr.includes("&");
this._hasParsedFragments=!1;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){return this._hasAnyBBtags?this._bbstr.replace(a,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let m=this._bbstr;this._hasAnyBBtags&&(d=0,c=this._linkActions,m=m.replace(a,g),c=null);this._needsLineBreakConversion&&(m=m.replace(k,"<br>"));this._htmlstr=m}return this._htmlstr}attachLinkHandlers(m){if(this._linkActions.length)for(let p=
0,n=this._linkActions.length;p<n;++p){const u=this._linkActions[p];if("function"!==typeof u)continue;const q=m.querySelector(".bblink"+p);if(!q)throw Error("unable to attach BBString link handler");q.onclick=u}}equals(m){return m instanceof f.HtmlString?this.toHTML()===m.toHTML():m instanceof f.BBString?this._bbstr===m._bbstr:this._bbstr===m}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const m=this._bbstr,p=[];let n=e.lastIndex=0;for(var u;null!==(u=e.exec(m));){var q=u.index;
if(0<q&&"\\"===m.charAt(q-1))continue;var r=u[0],t=u[1];u=u[2];const x=m.substring(n,q);n=q+r.length;x&&this._fragments.push({text:x,styles:p.slice(0)});if(u)if(t)for(u=u.toLowerCase(),q=p.length-1;0<=q;--q){if(p[q].tag===u){p.splice(q,1);break}}else q=u,r=null,t=u.indexOf("="),-1!==t?(q=u.substring(0,t).toLowerCase(),r=u.substring(t+1)):q=q.toLowerCase(),p.push({tag:q,param:r})}n<m.length&&this._fragments.push({text:m.substring(n),styles:p.slice(0)});for(const x of this._fragments)x.text=this._ProcessBBCodeEscapeSequences(x.text);
this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(m){m=f.ReplaceAll(m,"\\[","[");return f.ReplaceAll(m,"\\\\","\\")}static StripTags(m){return f.New(f.BBString,m,{noEscape:!0}).toPlainText()}static StripAnyTags(m){return m.replace(e,"")}}}"use strict";
{const f=self.C3;f.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(b,a){let e=0,c=0;for(const d of b)-1===d.width&&(b=a(d.text,d.styles),d.width=b.width,d.height=b.height),e+=d.width,c=Math.max(c,d.height);return{width:e,height:c}}_AddLine(b,a,e){this._lines.push({fragments:b,width:a,height:e})}WordWrap(b,a,e,c,d){"string"===typeof b&&(b=[{text:b,styles:[]}]);f.clearArray(this._lines);if(!(!b.length||1===b.length&&!b[0].text.length||
2>e)){if(1===b.length){var g=b[0];const k=g.text;g=g.styles;if(100>=k.length&&!k.includes("\n")){let {width:m,height:p}=a(k,g);m+=d;if(m<=e){this._AddLine([{text:k,styles:g,width:m,height:p}],m,p);return}}}if("word"===c)c=this._TokeniseWords(b);else{c=[];for(const k of b)f.appendArray(c,[...k.text].map(m=>[{text:m,styles:k.styles}]))}this._WrapText(c,a,e,d)}}_TokeniseWords(b){const a=[];let e=[],c=!1;for(const g of b){var d=g.text;b=g.styles;for(const k of d)"\n"===k?(0<e.length&&a.push(e),a.push([{text:"\n",
styles:b}]),e=[]):0===e.length?(e.push({text:k,styles:b}),c=f.IsWhitespaceChar(k)):(d=f.IsWhitespaceChar(k),d===c?(d=e[e.length-1],d.styles===b?d.text+=k:e.push({text:k,styles:b})):(a.push(e),e=[],e.push({text:k,styles:b}),c=d))}0<e.length&&a.push(e);return a}_CopyLine(b){return b.map(a=>({text:a.text,styles:a.styles,width:a.width,height:a.height}))}_AddWordToLine(b,a){var e=b.length?b[b.length-1]:null;let c=0;e&&a[0].styles===e.styles&&(e.text+=a[0].text,e.width=-1,e.height=-1,c=1);for(e=a.length;c<
e;++c){const d=a[c];b.push({text:d.text,styles:d.styles,width:-1,height:-1})}}_WrapText(b,a,e,c){let d=[],g=0;var k=0;for(const p of b){if(1===p.length&&"\n"===p[0].text){0===k&&(k=a(" ",p[0].styles).height);this._AddLine(d,g,k);d=[];k=g=0;continue}b=this._CopyLine(d);this._AddWordToLine(b,p);var m=this._MeasureLine(b,a);const n=m.width;m=m.height;n>=e?(0<d.length&&this._AddLine(d,g,k),d=[],f.IsStringAllWhitespace(p[0].text)?k=g=0:(this._AddWordToLine(d,p),k=this._MeasureLine(d,a),g=k.width,k=k.height)):
(d=b,g=n,k=m)}0<d.length&&this._AddLine(d,g,k);this._TrimLinesTrailingWhitespace(a,c)}_TrimLinesTrailingWhitespace(b,a){for(const c of this._lines){const d=c.fragments;if(!d.length)continue;let g=d[d.length-1];var e=g.text;const k=e.trimEnd();if(!k)c.width-=g.width,d.pop();else if(k.length<e.length){e=b(k,g.styles).width;const m=g.width-e;g.width=e;g.text=k;c.width-=m}0!==a&&0<d.length&&(g=d[d.length-1],g.width+=a,c.width+=a)}}Clear(){f.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((b,
a)=>Math.max(b,a.width),0)}GetTotalLineHeight(){return this._lines.reduce((b,a)=>b+a.height,0)}}}"use strict";self.C3.Gfx={};"use strict";
{const f=self.C3,b=[0,0,0,0,0,0,0,0],a=self.glMatrix,e=a.vec3,c=a.mat4,d=e.fromValues(0,0,0);f.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._cam=e.fromValues(0,0,100);this._look=e.fromValues(0,0,0);this._up=e.fromValues(0,1,0);this._worldScale=e.fromValues(1,1,1);this._matP=c.create();this._matMV=c.create();this._lastMV=c.create();this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spTextureFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=
[];this._namedBlendModeMap=new Map;this._frameNumber=0;this._enableMipmaps=!0}FillIndexBufferData(g){let k=0,m=g.length,p=0;for(;k<m;)g[k++]=p,g[k++]=p+1,g[k++]=p+2,g[k++]=p,g[k++]=p+2,g[k++]=p+3,p+=4}Project(g,k,m,p,n){const u=this._matMV,q=this._matP;for(let r=0,t=b.length;r<t;++r)b[r]=0;b[0]=u[0]*g+u[4]*k+u[12];b[1]=u[1]*g+u[5]*k+u[13];b[2]=u[2]*g+u[6]*k+u[14];b[3]=u[3]*g+u[7]*k+u[15];b[4]=q[0]*b[0]+q[4]*b[1]+q[8]*b[2]+q[12]*b[3];b[5]=q[1]*b[0]+q[5]*b[1]+q[9]*b[2]+q[13]*b[3];b[6]=q[2]*b[0]+q[6]*
b[1]+q[10]*b[2]+q[14]*b[3];b[7]=-b[2];0!==b[7]&&(b[7]=1/b[7],b[4]*=b[7],b[5]*=b[7],b[6]*=b[7],n[0]=(.5*b[4]+.5)*m,n[1]=(.5*b[5]+.5)*p)}GetWidth(){return this._width}GetHeight(){return this._height}GetNearZ(){return 1}GetFarZ(){return 1E4}SetCameraXYZ(g,k,m){this._cam[0]=g*this._worldScale[0];this._cam[1]=k*this._worldScale[1];this._cam[2]=m}SetLookXYZ(g,k,m){this._look[0]=g*this._worldScale[0];this._look[1]=k*this._worldScale[1];this._look[2]=m}ResetModelView(g){c.lookAt(this._matMV,this._cam,this._look,
g||this._up);c.scale(this._matMV,this._matMV,this._worldScale)}Translate(g,k){if(0!==g||0!==k)d[0]=g,d[1]=k,d[2]=0,c.translate(this._matMV,this._matMV,d)}Scale(g,k){if(1!==g||1!==k)d[0]=g,d[1]=k,d[2]=1,c.scale(this._matMV,this._matMV,d)}RotateZ(g){0!==g&&c.rotateZ(this._matMV,this._matMV,g)}_AddShaderProgram(g){this._allShaderPrograms.push(g);this._shaderProgramsByName.set(g.GetName(),g)}_RemoveShaderProgram(g){const k=this._allShaderPrograms.indexOf(g);-1!==k&&this._allShaderPrograms.splice(k,1);
this._shaderProgramsByName.delete(g.GetName())}_ClearAllShaderPrograms(){f.clearArray(this._allShaderPrograms);this._shaderProgramsByName.clear()}GetShaderProgramByName(g){return this._shaderProgramsByName.get(g)||null}GetTextureFillShaderProgram(){return this._spTextureFill}_SetCurrentStateGroup(g){this._currentStateGroup=g}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(g,k,m,p){const n=f.Gfx.StateGroup.MakeKey(g,k,m,p);let u=this._stateGroups.get(n);u||(u=f.New(f.Gfx.StateGroup,
this,g,k,m,p),this._stateGroups.set(n,u));u.AddRef();return u}ReleaseStateGroup(g){g.DecRef();0===g._GetRefCount()&&(this._currentStateGroup===g&&(this._currentStateGroup=null),this._stateGroups.delete(g.GetKey()),g.Release())}_InitBlendModeData(g){f.clearArray(this._blendModeTable);this._namedBlendModeMap.clear();for(const k of g){g=k[0];const m=k[1],p=k[2];this._blendModeTable.push([m,p]);this._namedBlendModeMap.set(g,{srcBlend:m,destBlend:p})}}_GetBlendByIndex(g){return this._blendModeTable[g]}GetSrcBlendByIndex(g){return this._GetBlendByIndex(g)[0]}GetDestBlendByIndex(g){return this._GetBlendByIndex(g)[1]}GetNamedBlend(g){g=
this._namedBlendModeMap.get(g);if("undefined"===typeof g)throw Error("invalid blend name");return g}Finish(){this.EndBatch();this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(g){this._enableMipmaps=!!g}AreMipmapsEnabled(){return this._enableMipmaps}}}"use strict";
{const f=self.C3;f.Gfx.StateGroup=class{constructor(b,a,e,c,d){this._renderer=b;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=e;this._color=f.New(f.Color);this._color.set(c);this._zElevation=d;"string"===typeof a?this._shaderProgramName=a:(this._shaderProgram=a,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(0<this._refCount)throw Error("releasing state group still in use");this._shaderProgram=this._renderer=null;this._shaderProgramName=""}Apply(){const b=
this._renderer;b.SetProgram(this._shaderProgram);b.SetBlendMode(this._blendMode);b.SetColor(this._color);b.SetCurrentZ(this._zElevation);b._SetCurrentStateGroup(this)}GetKey(){return f.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram=null}OnContextRestored(b){this._shaderProgram=b.GetShaderProgramByName(this._shaderProgramName);if(!this._shaderProgram)throw Error("failed to restore shader program");
}static MakeKey(b,a,e,c){return("string"===typeof b?b:b.GetName())+","+a+","+e.getR()+","+e.getG()+","+e.getB()+","+e.getA()+","+c}}}"use strict";
{const f=self.C3,b=f.New(f.Quad),a=f.New(f.Quad);function e(d,g,k){const m=k.getTlx(),p=k.getTly(),n=k.getTrx()-m,u=k.getTry()-p,q=k.getBlx()-m;k=k.getBly()-p;return[m+n*d+q*g,p+u*d+k*g]}class c{constructor(d){this._mesh=d;this._v=this._u=this._y=this._x=0}_Init(d,g,k,m){this._x=d;this._y=g;this._u=k;this._v=m}GetX(){return this._x}SetX(d){this._x!==d&&(this._x=d,this._mesh._SetPointsChanged())}GetY(){return this._y}SetY(d){this._y!==d&&(this._y=d,this._mesh._SetPointsChanged())}GetU(){return this._u}SetU(d){this._u=
d}GetV(){return this._v}SetV(d){this._v=d}_Interpolate_TexRect(d,g,k){[this._x,this._y]=e(d._x,d._y,g);this._u=f.lerp(k.getLeft(),k.getRight(),d._u);this._v=f.lerp(k.getTop(),k.getBottom(),d._v)}_Interpolate_TexQuad(d,g,k){[this._x,this._y]=e(d._x,d._y,g);[this._u,this._v]=e(d._u,d._v,k)}}f.Gfx.Mesh=class{constructor(d,g){if(2>d||2>g)throw Error("invalid mesh size");this._hsize=d;this._vsize=g;this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._pointsChanged=!1;const k=d-1,m=g-1;for(let p=
0;p<g;++p){const n=[];for(let u=0;u<d;++u){const q=f.New(c,this),r=u/k,t=p/m;q._Init(r,t,r,t);n.push(q)}this._pts.push(n)}}Release(){f.clearArray(this._pts)}GetHSize(){return this._hsize}GetVSize(){return this._vsize}_SetPointsChanged(){this._pointsChanged=!0}_MaybeComputeBounds(){if(this._pointsChanged){var d=Infinity,g=Infinity,k=-Infinity,m=-Infinity;for(const p of this._pts)for(const n of p){const u=n.GetX(),q=n.GetY();d=Math.min(d,u);g=Math.min(g,q);k=Math.max(k,u);m=Math.max(m,q)}this._minX=
d;this._minY=g;this._maxX=k;this._maxY=m;this._pointsChanged=!1}}GetMinX(){this._MaybeComputeBounds();return this._minX}GetMinY(){this._MaybeComputeBounds();return this._minY}GetMaxX(){this._MaybeComputeBounds();return this._maxX}GetMaxY(){this._MaybeComputeBounds();return this._maxY}GetMeshPointAt(d,g){d=Math.floor(d);g=Math.floor(g);return 0>d||d>=this._hsize||0>g||g>=this._vsize?null:this._pts[g][d]}CalculateTransformedMesh(d,g,k){const m=k instanceof f.Rect;if(d.GetHSize()!==this.GetHSize()||
d.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");d=d._pts;const p=this._pts;for(let n=0,u=p.length;n<u;++n){const q=d[n],r=p[n];for(let t=0,x=r.length;t<x;++t){const z=q[t],D=r[t];m?D._Interpolate_TexRect(z,g,k):D._Interpolate_TexQuad(z,g,k)}}}Draw(d){const g=this._pts;let k=g[0];for(let m=1,p=g.length;m<p;++m){const n=g[m];let u=k[0],q=n[0];for(let r=1,t=n.length;r<t;++r){const x=k[r],z=n[r];b.set(u.GetX(),u.GetY(),x.GetX(),x.GetY(),z.GetX(),z.GetY(),q.GetX(),q.GetY());a.set(u.GetU(),
u.GetV(),x.GetU(),x.GetV(),z.GetU(),z.GetV(),q.GetU(),q.GetV());d.Quad4(b,a);u=x;q=z}k=n}}Outline(d){const g=this._pts;let k=g[0];for(let n=1,u=g.length;n<u;++n){const q=g[n];var m=k[0],p=q[0];for(let r=1,t=q.length;r<t;++r){const x=k[r],z=q[r],D=m.GetX();m=m.GetY();const G=x.GetX(),w=x.GetY(),B=z.GetX(),I=z.GetY(),P=p.GetX();p=p.GetY();d.Line(D,m,G,w);d.Line(D,m,B,I);d.Line(D,m,P,p);r===t-1&&d.Line(G,w,B,I);n===u-1&&d.Line(P,p,B,I);m=x;p=z}k=q}}InsertPolyMeshVertices(d){d=d.pointsArr();const g=[],
k=this.GetHSize()-1,m=this.GetVSize()-1,p=1/k,n=1/m,u=k-1,q=m-1;let r=d[0],t=d[1],x=f.clamp(Math.floor(r*k),0,u),z=f.clamp(Math.floor(t*m),0,q),D=0,G=0,w=0;var B=-1;const I=()=>{r=f.clamp(f.lerp(r,D,w),0,1);t=f.clamp(f.lerp(t,G,w),0,1);g.push(r,t)};for(let P=0,E=d.length;P<E;P+=2)for(r=d[P],t=d[P+1],g.push(r,t),x=f.clamp(Math.floor(r*k),0,u),z=f.clamp(Math.floor(t*m),0,q),B=(P+2)%E,D=d[B],G=d[B+1],B=-1;;){if(1E6<g.length)throw Error("Too many mesh poly points");const J=x*p,O=z*n,R=(x+1)*p,T=(z+1)*
n;f.isPointInTriangleInclusive(r,t,J,O,R,O,R,T);if(0!==B&&(w=f.rayIntersectExtended(r,t,D,G,J,O,R,T,-.001),0<=w&&.99999999>=w)){I();B=0;continue}if(0<z&&2!==B&&(w=f.rayIntersectExtended(r,t,D,G,J,O,R,O,.001),0<=w&&.99999999>=w)){I();z--;B=4;continue}if(x<u&&3!==B&&(w=f.rayIntersectExtended(r,t,D,G,R,O,R,T,.001),0<=w&&.99999999>=w)){I();x++;B=1;continue}if(0<x&&1!==B&&(w=f.rayIntersectExtended(r,t,D,G,J,O,J,T,.001),0<=w&&.99999999>=w)){I();x--;B=3;continue}if(z<q&&4!==B&&(w=f.rayIntersectExtended(r,
t,D,G,J,T,R,T,.001),0<=w&&.99999999>=w)){I();z++;B=2;continue}break}return f.New(f.CollisionPoly,g)}TransformCollisionPoly(d,g){d=this._TransformPolyPoints(d);this._SimplifyPoly(d);g.setPoints(d)}_TransformPolyPoints(d){const g=[];d=d.pointsArr();for(let k=0,m=d.length;k<m;k+=2){const [p,n]=this.TransformPoint(d[k],d[k+1]);g.push(p,n)}return g}TransformPoint(d,g){var k=this.GetHSize()-1,m=this.GetVSize()-1,p=1/k,n=1/m;k=f.clamp(Math.floor(d*k),0,k-1);const u=f.clamp(Math.floor(g*m),0,m-1);m=k*p;const q=
u*n,r=(k+1)*p,t=(u+1)*n,x=this.GetMeshPointAt(k,u),z=this.GetMeshPointAt(k+1,u+1),D=f.isPointInTriangleInclusive(d,g,m,q,r,q,r,t);p=D?m+p:m;n=D?q:q+n;k=this.GetMeshPointAt(k+(D?1:0),u+(D?0:1));const [G,w,B]=f.triangleCartesianToBarycentric(d,g,m,q,p,n,r,t);return f.triangleBarycentricToCartesian(G,w,B,x.GetX(),x.GetY(),k.GetX(),k.GetY(),z.GetX(),z.GetY())}_SimplifyPoly(d){const g=[];let k=d[0],m=d[1],p=k-d[d.length-2],n=m-d[d.length-1];for(let q=0,r=d.length;q<r;q+=2){var u=(q+2)%r;const t=d[u];u=
d[u+1];const x=t-k,z=u-m,D=1e-7>Math.abs(z)&&1e-7>Math.abs(n)&&Math.sign(x)===Math.sign(p);(!(1e-7>Math.abs(x)&&1e-7>Math.abs(p)&&Math.sign(z)===Math.sign(n)||D)&&1e-7<Math.abs(x/p-z/n)||0==x&&0===z)&&g.push(k,m);k=t;m=u;p=x;n=z}g.length<d.length&&f.shallowAssignArray(d,g)}}}"use strict";
{const f=self.C3,b=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),a=new Set(["nearest","bilinear","trilinear"]),e=new Set(["default","low","high"]),c=new Set(["clamp-to-edge","repeat","mirror-repeat"]);function d(p,n){let u,q;switch(p){case "rgba8":p=n.RGBA8;q=u=n.RGBA;n=n.UNSIGNED_BYTE;break;case "rgb8":p=n.RGB8;q=u=n.RGB;n=n.UNSIGNED_BYTE;break;case "rgba4":p=n.RGBA4;q=u=n.RGBA;n=n.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":p=n.RGB5_A1;q=u=n.RGBA;n=n.UNSIGNED_SHORT_5_5_5_1;break;case "rgb565":p=
n.RGB565;q=u=n.RGB;n=n.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:p,internalformat:u,format:q,type:n}}const g={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",sampling:"trilinear",pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},k={premultiplyAlpha:!0,flipY:!1},m=new Set;f.Gfx.WebGLRendererTexture=class{constructor(p){this._renderer=p;this._texture=null;this._height=this._width=0;this._isStatic=
!0;this._wrapY=this._wrapX="clamp-to-edge";this._sampling="trilinear";this._pixelFormat="rgba8";this._isMipMapped=!1;this._mipMapQuality="default";this._refCount=0}_CreateStatic(p,n){if(!("undefined"!==typeof HTMLImageElement&&p instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&p instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&p instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&p instanceof OffscreenCanvas||p instanceof ImageData||p instanceof ArrayBuffer)&&
null!==p)throw Error("invalid texture source");n=Object.assign({},g,n);if(this._texture)throw Error("already created texture");this._wrapX=n.wrapX;this._wrapY=n.wrapY;this._sampling=n.sampling;this._pixelFormat=n.pixelFormat;this._isMipMapped=!!n.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=n.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");if(!b.has(this._pixelFormat))throw Error("invalid pixel format");
if(!e.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(p instanceof ArrayBuffer||null===p||n.isSvg){if(this._width=n.width,this._height=n.height,p instanceof ArrayBuffer&&p.byteLength!==this._width*this._height*4)throw Error("ArrayBuffer wrong size");}else this._width=p.width,this._height=p.height;if(0>=this._width||0>=this._height)throw Error("invalid texture data size");if(n.isSvg){var u=f.CreateCanvas(this._width,this._height);u.getContext("2d").drawImage(p,0,
0,this._width,this._height);p=u}var q=f.isPOT(this._width)&&f.isPOT(this._height);u=this._renderer.GetMaxTextureSize();if(this._width>u||this._height>u)throw Error("texture data exceeds maximum texture size");u=this._renderer.GetContext();var r=this._renderer.GetWebGLVersionNumber();this._texture=u.createTexture();u.bindTexture(u.TEXTURE_2D,this._texture);u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha);n=d(this._pixelFormat,u);if(this._renderer.SupportsNPOTTextures()||q||!this._IsTiled())2<=
r?(u.texStorage2D(u.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,n.sizedinternalformat,this._width,this._height),p instanceof ArrayBuffer?u.texSubImage2D(u.TEXTURE_2D,0,0,0,this._width,this._height,n.format,n.type,new Uint8Array(p)):null!==p&&u.texSubImage2D(u.TEXTURE_2D,0,0,0,n.format,n.type,p)):p instanceof ArrayBuffer?u.texImage2D(u.TEXTURE_2D,0,n.internalformat,this._width,this._height,0,n.format,n.type,new Uint8Array(p)):null===p?u.texImage2D(u.TEXTURE_2D,
0,n.internalformat,this._width,this._height,0,n.format,n.type,null):u.texImage2D(u.TEXTURE_2D,0,n.internalformat,n.format,n.type,p);else{if(null===p)throw Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");p instanceof ArrayBuffer&&(p=new ImageData(new Uint8ClampedArray(p),this._width,this._height));p instanceof ImageData&&(q=f.CreateCanvas(this._width,this._height),q.getContext("2d").putImageData(p,0,0),p=q);q=f.CreateCanvas(f.nextHighestPowerOfTwo(this._width),
f.nextHighestPowerOfTwo(this._height));r=q.getContext("2d");r.imageSmoothingEnabled="nearest"!==this._sampling;r.drawImage(p,0,0,this._width,this._height,0,0,q.width,q.height);u.texImage2D(u.TEXTURE_2D,0,n.internalformat,n.format,n.type,q)}null!==p&&this._SetTextureParameters(u);u.bindTexture(u.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;m.add(this)}_CreateDynamic(p,n,u){u=Object.assign({},g,u);if(this._texture)throw Error("already created texture");this._wrapX=u.wrapX;this._wrapY=
u.wrapY;this._sampling=u.sampling;this._pixelFormat=u.pixelFormat;this._isMipMapped=!!u.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=u.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!e.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!1;this._width=Math.floor(p);this._height=Math.floor(n);
p=f.isPOT(this._width)&&f.isPOT(this._height);n=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>n||this._height>n)throw Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!p)throw Error("non-power-of-two tiled textures not supported");p=this._renderer.GetContext();n=this._renderer.GetWebGLVersionNumber();this._texture=p.createTexture();p.bindTexture(p.TEXTURE_2D,this._texture);
p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);u=d(this._pixelFormat,p);p.texImage2D(p.TEXTURE_2D,0,2<=n?u.sizedinternalformat:u.internalformat,this._width,this._height,0,u.format,u.type,null);this._SetTextureParameters(p);p.bindTexture(p.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;m.add(this)}_GetMipMapHint(p){if("default"===this._mipMapQuality)return this._isStatic?p.NICEST:p.FASTEST;if("low"===this._mipMapQuality)return p.FASTEST;if("high"===this._mipMapQuality)return p.NICEST;
throw Error("invalid mipmap quality");}_IsTiled(){return"clamp-to-edge"!==this._wrapX||"clamp-to-edge"!==this._wrapY}_GetTextureWrapMode(p,n){if("clamp-to-edge"===n)return p.CLAMP_TO_EDGE;if("repeat"===n)return p.REPEAT;if("mirror-repeat"===n)return p.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(p){var n=f.isPOT(this._width)&&f.isPOT(this._height);p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,this._GetTextureWrapMode(p,this._wrapX));p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,
this._GetTextureWrapMode(p,this._wrapY));"nearest"===this._sampling?(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),this._isMipMapped=!1):(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.LINEAR),(n||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(p.hint(p.GENERATE_MIPMAP_HINT,this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D),n="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),p.texParameteri(p.TEXTURE_2D,
p.TEXTURE_MIN_FILTER,n?p.LINEAR_MIPMAP_LINEAR:p.LINEAR_MIPMAP_NEAREST)):(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.LINEAR),this._isMipMapped=!1))}_Update(p,n){if(!("undefined"!==typeof HTMLImageElement&&p instanceof HTMLImageElement||"undefined"!==typeof HTMLVideoElement&&p instanceof HTMLVideoElement||"undefined"!==typeof HTMLCanvasElement&&p instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&p instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&p instanceof OffscreenCanvas||
p instanceof ImageData))throw Error("invalid texture source");if(!this._texture||0>=this._refCount)throw Error("texture not created");if(this._isStatic)throw Error("cannot update static texture");n=Object.assign({},k,n);const u=p.width||p.videoWidth,q=p.height||p.videoHeight;var r=this._renderer.GetWebGLVersionNumber();const t=this._renderer.GetContext();t.bindTexture(t.TEXTURE_2D,this._texture);t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha);t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,
!!n.flipY);n=d(this._pixelFormat,t);r=2<=r?n.sizedinternalformat:n.internalformat;try{if(this._width===u&&this._height===q){const x=f.isPOT(this._width)&&f.isPOT(this._height);t.texSubImage2D(t.TEXTURE_2D,0,0,0,n.format,n.type,p);(x||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(t.hint(t.GENERATE_MIPMAP_HINT,this._GetMipMapHint(t)),t.generateMipmap(t.TEXTURE_2D))}else{this._width=u;this._height=q;const x=f.isPOT(this._width)&&f.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&
this._IsTiled()&&!x)throw Error("non-power-of-two tiled textures not supported");t.texImage2D(t.TEXTURE_2D,0,r,n.format,n.type,p);(x||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(t.hint(t.GENERATE_MIPMAP_HINT,this._GetMipMapHint(t)),t.generateMipmap(t.TEXTURE_2D))}}catch(x){console.error("Error updating WebGL texture: ",x)}t.bindTexture(t.TEXTURE_2D,null);this._renderer._ResetLastTexture()}_Delete(){if(0<this._refCount)throw Error("texture still has references");if(!this._texture)throw Error("already deleted texture");
m.delete(this);this._renderer.GetContext().deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(0>=this._refCount)throw Error("no more references");this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let p=this._width*this._height;
switch(this._pixelFormat){case "rgba8":p*=4;break;case "rgb8":p*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":p*=2}this._isMipMapped&&(p+=Math.floor(p/3));return p}static OnContextLost(){m.clear()}static allTextures(){return m.values()}}}"use strict";
{const f=self.C3,b=new Set(["nearest","bilinear","trilinear"]),a={sampling:"trilinear",alpha:!0,readback:!0,isDefaultSize:!0,multisampling:0},e=new Set;f.Gfx.WebGLRenderTarget=class{constructor(c){this._renderer=c;this._renderBuffer=this._texture=this._frameBuffer=null;this._height=this._width=0;this._isDefaultSize=!0;this._sampling="trilinear";this._readback=this._alpha=!0;this._multisampling=0}_Create(c,d,g){g=Object.assign({},a,g);const k=this._renderer.GetWebGLVersionNumber();if(this._texture||
this._renderBuffer)throw Error("already created render target");this._sampling=g.sampling;this._alpha=!!g.alpha;this._readback=!!g.readback;this._isDefaultSize=!!g.isDefaultSize;this._multisampling=g.multisampling;if(!b.has(this._sampling))throw Error("invalid sampling");if(0<this._multisampling&&(2>k||this._readback))throw Error("invalid use of multisampling");2>k&&(this._readback=!0);this._width=c;this._height=d;if(0>=this._width||0>=this._height)throw Error("invalid render target size");c=this._renderer.GetContext();
this._frameBuffer=c.createFramebuffer();c.bindFramebuffer(c.FRAMEBUFFER,this._frameBuffer);this._readback?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),d=this._texture._GetTexture(),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,d,0)):(this._renderBuffer=c.createRenderbuffer(),c.bindRenderbuffer(c.RENDERBUFFER,this._renderBuffer),d=this._alpha?c.RGBA8:c.RGB8,0<this._multisampling&&
((g=c.getInternalformatParameter(c.RENDERBUFFER,d,c.SAMPLES))&&g[0]?(g=g[0],this._multisampling>g&&(this._multisampling=g)):this._multisampling=0),0===this._multisampling?c.renderbufferStorage(c.RENDERBUFFER,d,this._width,this._height):c.renderbufferStorageMultisample(c.RENDERBUFFER,this._multisampling,d,this._width,this._height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.RENDERBUFFER,this._renderBuffer),c.bindRenderbuffer(c.RENDERBUFFER,null));c.bindFramebuffer(c.FRAMEBUFFER,null);
e.add(this)}_Resize(c,d){if(this._width!==c||this._height!==d)this._width=c,this._height=d,c=this._renderer.GetContext(),c.bindFramebuffer(c.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(c.bindRenderbuffer(c.RENDERBUFFER,this._renderBuffer),c.renderbufferStorage(c.RENDERBUFFER,this._alpha?c.RGBA8:c.RGB8,this._width,this._height),c.bindRenderbuffer(c.RENDERBUFFER,null)),c.bindFramebuffer(c.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&
!this._renderBuffer)throw Error("already deleted render target");e.delete(this);const c=this._renderer.GetContext();c.bindFramebuffer(c.FRAMEBUFFER,this._frameBuffer);this._texture?(c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,null,0),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(c.framebufferRenderbuffer(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.RENDERBUFFER,null),c.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);c.bindFramebuffer(c.FRAMEBUFFER,
null);2<=this._renderer.GetWebGLVersionNumber()&&(c.bindFramebuffer(c.READ_FRAMEBUFFER,null),c.bindFramebuffer(c.DRAW_FRAMEBUFFER,null));c.deleteFramebuffer(this._frameBuffer);this._frameBuffer=this._renderer.GetBatchState().currentFramebuffer=null}_GetFramebuffer(){return this._frameBuffer}GetWebGLRenderer(){return this._renderer}GetTexture(){return this._texture}IsLinearSampling(){return"nearest"!==this._sampling}HasAlpha(){return this._alpha}IsReadback(){return this._readback}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const c=
{sampling:this._sampling,alpha:this._alpha,readback:this._readback};this._isDefaultSize||(c.width=this._width,c.height=this._height);return c}IsCompatibleWithOptions(c){c=Object.assign({},a,c);return"nearest"!==c.sampling!==this.IsLinearSampling()||!!c.alpha!==this.HasAlpha()||2<=this._renderer.GetWebGLVersionNumber()&&!!c.readback!==this.IsReadback()?!1:"number"===typeof c.width||"number"===typeof c.height?!this.IsDefaultSize()&&this.GetWidth()===c.width&&this.GetHeight()===c.height:this.IsDefaultSize()}_GetWebGLTexture(){return this._texture?
this._texture._GetTexture():null}GetEstimatedMemoryUsage(){return this._texture?this._texture.GetEstimatedMemoryUsage():this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(c,d){c=await c.ReadBackRenderTargetToImageData(d,!0);return await f.ImageDataToBlob(c)}static OnContextLost(){e.clear()}static allRenderTargets(){return e.values()}static ResizeAll(c,d){for(const g of e)g.IsDefaultSize()&&g._Resize(c,d)}}}"use strict";
{const f=self.C3,b=self.glMatrix,a=b.vec3,e=b.mat4,c=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));f.Gfx.WebGLShaderProgram=class{static async Compile(d,g,k,m){const p=d.GetContext(),n=p.createShader(p.FRAGMENT_SHADER);p.shaderSource(n,g);p.compileShader(n);
g=p.createShader(p.VERTEX_SHADER);p.shaderSource(g,k);p.compileShader(g);const u=p.createProgram();p.attachShader(u,n);p.attachShader(u,g);p.bindAttribLocation(u,0,"aPos");p.bindAttribLocation(u,1,"aTex");p.bindAttribLocation(u,2,"aPoints");p.linkProgram(u);const q=d._GetParallelShaderCompileExtension();q?await d._WaitForObjectReady(()=>p.getProgramParameter(u,q.COMPLETION_STATUS_KHR)):await f.Wait(5);if(!p.getShaderParameter(n,p.COMPILE_STATUS))throw m=p.getShaderInfoLog(n),p.deleteShader(n),p.deleteShader(g),
p.deleteProgram(u),Error("Error compiling fragment shader: "+m);if(!p.getShaderParameter(g,p.COMPILE_STATUS))throw m=p.getShaderInfoLog(g),p.deleteShader(n),p.deleteShader(g),p.deleteProgram(u),Error("Error compiling vertex shader: "+m);if(!p.getProgramParameter(u,p.LINK_STATUS))throw m=p.getProgramInfoLog(u),p.deleteShader(n),p.deleteShader(g),p.deleteProgram(u),Error("Error linking shader program: "+m);(d=f.FilterUnprintableChars(p.getProgramInfoLog(u)||"").trim())&&!f.IsStringAllWhitespace(d)&&
console.info(`[WebGL] Shader program '${m}' compilation log: `,d);p.deleteShader(n);p.deleteShader(g);return u}static async Create(d,g,k,m){k=await f.Gfx.WebGLShaderProgram.Compile(d,g.src,k,m);return new f.Gfx.WebGLShaderProgram(d,k,g,m)}constructor(d,g,k,m){const p=d.GetContext();var n=d.GetBatchState();d.EndBatch();p.useProgram(g);this._gl=p;this._renderer=d;this._name=m;this._shaderProgram=g;this._isDeviceTransform="<default-device-transform>"===m;m=p.getAttribLocation(g,"aPos");const u=p.getAttribLocation(g,
"aTex");g=p.getAttribLocation(g,"aPoints");-1!==m&&(p.bindBuffer(p.ARRAY_BUFFER,d._vertexBuffer),p.vertexAttribPointer(m,d.GetNumVertexComponents(),p.FLOAT,!1,0,0),p.enableVertexAttribArray(m));-1!==u&&(p.bindBuffer(p.ARRAY_BUFFER,d._texcoordBuffer),p.vertexAttribPointer(u,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(u));-1!==g&&(p.bindBuffer(p.ARRAY_BUFFER,d._pointBuffer),p.vertexAttribPointer(g,4,p.FLOAT,!1,0,0),p.enableVertexAttribArray(g));p.bindBuffer(p.ARRAY_BUFFER,null);this._uMatP=new f.Gfx.WebGLShaderUniform(this,
"matP","mat4");this._uMatMV=new f.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new f.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new f.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new f.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new f.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new f.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new f.Gfx.WebGLShaderUniform(this,"tileSize",
"vec2");this._uTileSpacing=new f.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new f.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new f.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new f.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uDestStart=new f.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new f.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new f.Gfx.WebGLShaderUniform(this,
"srcStart","vec2");this._uSrcEnd=new f.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new f.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new f.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new f.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new f.Gfx.WebGLShaderUniform(this,"seconds","float");this._uLayerScale=new f.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new f.Gfx.WebGLShaderUniform(this,
"layerAngle","float");this._uLayoutStart=new f.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new f.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||
this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());this._extendBoxHorizontal=k.extendBoxHorizontal||0;this._extendBoxVertical=k.extendBoxVertical||0;this._crossSampling=!!k.crossSampling;this._mustPreDraw=!!k.mustPreDraw;this._preservesOpaqueness=!!k.preservesOpaqueness;this._animated=!!k.animated;d=k.parameters||[];this._uCustomParameters=[];this._usesDest=this._uDestStart.IsUsed()||this._uDestEnd.IsUsed();this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||
this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();this._needsPostDrawOrExtendBox=this._crossSampling||this._usesDest||0!==this._extendBoxHorizontal||0!==this._extendBoxVertical;this._hasCurrentMatMV=this._hasCurrentMatP=!1;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0);this._uSamplerBack.Init1i(1);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0,
0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,0);this._uPixelSize.Init2f(0,0);this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const q of d)d=q[2],k=new f.Gfx.WebGLShaderUniform(this,q[0],d),"color"===d?k.Init3f(0,0,0):k.Init1f(0),this._uCustomParameters.push(k);
this._isDeviceTransform?this._UpdateDeviceTransformUniforms(n.currentMatP):(this.UpdateMatP(n.currentMatP,!0),this.UpdateMatMV(n.currentMV,!0));n=n.currentShader;p.useProgram(n?n._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._renderer=this._gl=null}GetName(){return this._name}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}UsesDest(){return this._usesDest}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}ExtendsBox(){return 0!==
this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(d){return this._uCustomParameters[d].GetType()}AreCustomParametersAlreadySetInBatch(d){for(let g=0,k=d.length;g<k;++g)if(!this._uCustomParameters[g].IsSetToCustomInBatch(d[g]))return!1;
return!0}SetCustomParametersInBatch(d){for(let g=0,k=d.length;g<k;++g)this._uCustomParameters[g].SetBatchValueCustom(d[g])}AreOptionalUniformsAlreadySetInBatch(d,g,k,m,p,n,u,q,r){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(p,n)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(d.getLeft(),d.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(d.getRight(),d.getBottom())||this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(u)||
this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(q)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(g.getLeft(),g.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(g.getRight(),g.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(k.getLeft(),k.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(k.getRight(),k.getBottom())||this._uLayoutStart.IsUsed()&&!this._uLayoutStart.IsSetTo2InBatch(m.getLeft(),
m.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(m.getTop(),m.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(r)?!1:!0}SetOptionalUniformsInBatch(d,g,k,m,p,n,u,q,r){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(p,n),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(d.getLeft(),d.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(d.getRight(),d.getBottom()),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(u),
this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(q),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(g.getLeft(),g.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(g.getRight(),g.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(k.getLeft(),k.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(k.getRight(),k.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(m.getLeft(),m.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(m.getTop(),
m.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(r))}IsAnimated(){return this._animated}UpdateMatP(d,g){this._hasCurrentMatP&&!g||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(d),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(d,g){this._hasCurrentMatMV&&!g||this._isDeviceTransform||(this._uMatMV.IsUsed()&&this._uMatMV.UpdateMatrix4fv(d),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(d){if(!this._isDeviceTransform)throw Error("not device transform shader");
this._uMatP.UpdateMatrix4fv(d);d=this._renderer;var g=d.GetWidth()/2,k=d.GetHeight()/2;const m=d._worldScale,p=a.fromValues(g*m[0],k*m[1],100*self.devicePixelRatio);g=a.fromValues(g*m[0],k*m[1],0);k=e.create();e.lookAt(k,p,g,d._up);e.scale(k,k,m);this._uMatMV.UpdateMatrix4fv(k)}UpdateColor(d){this._uColor.IsUsed()&&this._uColor.Update4f(d[0],d[1],d[2],d[3])}static GetReservedUniformNames(){return c}static GetDefaultVertexShaderSource(d,g){g=g?"highmedp":"mediump";return["#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif",
`attribute highp ${d?"vec3":"vec2"} aPos;`,`attribute ${g} vec2 aTex;`,`varying ${g} vec2 vTex;`,"uniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {",`	gl_Position = matP * matMV * vec4(aPos, ${d?"":"0.0,"} 1.0);`,"\tvTex = aTex;\n}"].join("\n")}static GetTextureFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex) * color;\n}"}static GetTilemapFragmentShaderSource(){return"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nvarying highmedp vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nuniform highmedp vec2 srcStart;\nuniform highmedp vec2 pixelSize;\nuniform highmedp vec2 tileSize;\nuniform highmedp vec2 tileSpacing;\nvoid main(void) {\n\thighmedp vec2 tile = floor(vTex);\n\thighmedp vec2 tex = fract(vTex);\n\thighmedp vec2 tileOrigin = srcStart + tile * (tileSize + tileSpacing);\n\thighmedp vec2 lowerBound = tileOrigin + pixelSize / 2.0;\n\thighmedp vec2 upperBound = tileOrigin + tileSize - pixelSize / 2.0;\n\tgl_FragColor = texture2D(samplerFront, clamp(tex, lowerBound, upperBound), -16.0) * color;\n}"}static GetPointVertexShaderSource(){return"attribute vec4 aPoints;\nvarying float pointOpacity;\nuniform float zElevation;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);\n\tgl_PointSize = aPoints.z;\n\tpointOpacity = aPoints.w;\n}"}static GetPointFragmentShaderSource(){return"uniform lowp sampler2D samplerFront;\nvarying lowp float pointOpacity;\nuniform mediump vec2 pointTexStart;\nuniform mediump vec2 pointTexEnd;\nuniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, mix(pointTexStart, pointTexEnd, gl_PointCoord)) * color * pointOpacity;\n}"}static GetColorFillFragmentShaderSource(){return"uniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = color;\n}"}static GetLinearGradientFillFragmentShaderSource(){return"precision lowp float;\nvarying mediump vec2 vTex;\nuniform vec4 color;\nuniform vec4 color2_;\nvec3 fromLinear(vec3 linearRGB)\n{\n\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));\n\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);\n\tvec3 lower = linearRGB * vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvec3 toLinear(vec3 sRGB)\n{\n\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));\n\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));\n\tvec3 lower = sRGB/vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvoid main(void) {\n\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);\n\tfloat a = mix(color.a, color2_.a, vTex.x);\n\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);\n}"}static GetSmoothLineFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float f = step(diffSq.x + diffSq.y, 0.25);\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump float innerF = step(distSq, 0.25);\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}static GetSmoothEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);\n\tgl_FragColor = color * f;\n}"}static GetSmoothEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 pxNorm = pixelSize * norm;\n\tmediump vec2 innerEdge1 = halfNorm - pxNorm;\n\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;\n\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);\n\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;\n\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;\n\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);\n\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;\n\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}}}"use strict";
{const f=self.C3,b=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);function a(e,c){return e[0]===c[0]&&e[1]===c[1]&&e[2]===c[2]&&e[3]===c[3]&&e[4]===c[4]&&e[5]===c[5]&&e[6]===c[6]&&e[7]===c[7]&&e[8]===c[8]&&e[9]===c[9]&&e[10]===c[10]&&e[11]===c[11]&&e[12]===c[12]&&e[13]===c[13]&&e[14]===c[14]&&e[15]===c[15]}f.Gfx.WebGLShaderUniform=class{constructor(e,c,d){if(!b.has(d))throw Error("invalid uniform type");this._owner=e;this._gl=this._owner.GetWebGLContext();
this._name=c;this._type=d;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),c);this._isUsed=!!this._location;e=b.get(d);this._lastValue=new Float32Array(e);this._lastBatchValue=new Float32Array(e)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(e){this.IsUsed()&&(this._lastValue[0]=e,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,
e))}Init1i(e){this.IsUsed()&&(this._lastValue[0]=e,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,e))}Init2f(e,c){this.IsUsed()&&(this._lastValue[0]=e,this._lastValue[1]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,e,c))}Init3f(e,c,d){this.IsUsed()&&(this._lastValue[0]=e,this._lastValue[1]=c,this._lastValue[2]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,e,c,d))}Init4f(e,c,d,g){this.IsUsed()&&(this._lastValue[0]=
e,this._lastValue[1]=c,this._lastValue[2]=d,this._lastValue[3]=g,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,e,c,d,g))}Update1f(e){e=Math.fround(e);const c=this._lastValue;c[0]!==e&&(c[0]=e,this._gl.uniform1f(this._location,e))}Update1i(e){const c=this._lastValue;c[0]!==e&&(c[0]=e,this._gl.uniform1i(this._location,e))}Update2f(e,c){e=Math.fround(e);c=Math.fround(c);const d=this._lastValue;if(d[0]!==e||d[1]!==c)d[0]=e,d[1]=c,this._gl.uniform2f(this._location,e,c)}Update3f(e,
c,d){e=Math.fround(e);c=Math.fround(c);d=Math.fround(d);const g=this._lastValue;if(g[0]!==e||g[1]!==c||g[2]!==d)g[0]=e,g[1]=c,g[2]=d,this._gl.uniform3f(this._location,e,c,d)}Update4f(e,c,d,g){e=Math.fround(e);c=Math.fround(c);d=Math.fround(d);g=Math.fround(g);const k=this._lastValue;if(k[0]!==e||k[1]!==c||k[2]!==d||k[3]!==g)k[0]=e,k[1]=c,k[2]=d,k[3]=g,this._gl.uniform4f(this._location,e,c,d,g)}UpdateMatrix4fv(e){const c=this._lastValue;a(c,e)||(f.typedArraySet16(c,e,0),this._gl.uniformMatrix4fv(this._location,
!1,e))}IsSetToCustomInBatch(e){const c=this._lastBatchValue;return this.IsColorType()?c[0]===Math.fround(e.getR())&&c[1]===Math.fround(e.getG())&&c[2]===Math.fround(e.getB()):c[0]===Math.fround(e)}SetBatchValueCustom(e){const c=this._lastBatchValue;this.IsColorType()?(c[0]=e.getR(),c[1]=e.getG(),c[2]=e.getB()):c[0]=e}IsSetTo1InBatch(e){return this._lastBatchValue[0]===Math.fround(e)}IsSetTo2InBatch(e,c){const d=this._lastBatchValue;return d[0]===Math.fround(e)&&d[1]===Math.fround(c)}SetBatch1(e){this._lastBatchValue[0]=
e}SetBatch2(e,c){const d=this._lastBatchValue;d[0]=e;d[1]=c}}}"use strict";
{const f=self.C3,b=self.glMatrix,a=b.vec4,e=b.mat4;f.Gfx.BatchState=class{constructor(c){this.renderer=c;this.currentMV=e.create();this.currentMatP=e.create();this.currentFramebuffer=null;this.currentColor=a.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new f.Rect;this.clearColor=f.New(f.Color,0,0,0,0)}};f.Gfx.WebGLBatchJob=class{constructor(c){const d=new ArrayBuffer(96);this._type=0;this._batchState=c;this._gl=c.renderer.GetContext();this._indexCount=this._startIndex=0;this._texParam=
null;this._mat4param=new Float32Array(d,0,16);this._colorParam=new Float32Array(d,64,4);this._srcOriginRect=new Float32Array(d,80,4);this._shaderParams=[]}InitQuad(c,d){this._type=1;this._startIndex=c;this._indexCount=d}DoQuad(){const c=this._gl;c.drawElements(c.TRIANGLES,this._indexCount,c.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(c){this._type=2;this._texParam=c}DoSetTexture(){const c=this._gl,d=this._texParam;c.bindTexture(c.TEXTURE_2D,d?d._GetTexture():null)}InitSetColor(c){this._type=3;
c.writeToTypedArray(this._colorParam,0)}DoSetColor(){const c=this._colorParam,d=this._batchState;a.copy(d.currentColor,c);d.currentShader.UpdateColor(c)}InitSetGradientColor(c){this._type=19;c.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const c=this._colorParam,d=this._batchState.currentShader;d._uColor2.IsUsed()&&d._uColor2.Update4f(c[0],c[1],c[2],c[3])}InitSetBlend(c,d){this._type=4;this._startIndex=c;this._indexCount=d}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitUpdateModelView(c){this._type=
5;e.copy(this._mat4param,c)}DoUpdateModelView(){const c=this._batchState,d=c.renderer._allShaderPrograms,g=c.currentShader,k=this._mat4param;for(let m=0,p=d.length;m<p;++m){const n=d[m];n===g?n.UpdateMatMV(k,!0):n.SetMatMVStale()}e.copy(c.currentMV,k)}InitSetRenderTarget(c,d,g){this._type=6;this._texParam=c;this._startIndex=d?1:0;d&&e.copy(this._mat4param,g)}DoSetRenderTarget(){var c=this._gl,d=this._texParam;const g=0!==this._startIndex,k=this._mat4param,m=this._batchState,p=m.renderer;if(d){const n=
d._GetFramebuffer();m.currentFramebuffer=n;c.bindFramebuffer(c.FRAMEBUFFER,n);c=d.GetWidth();d=d.GetHeight()}else m.currentFramebuffer=null,c.bindFramebuffer(c.FRAMEBUFFER,null),c=p.GetScissoredViewportWidth(),d=p.GetScissoredViewportHeight();g&&p._UpdateViewportBatch(c,d,k)}InitClearSurface(c){this._type=7;c.writeToTypedArray(this._mat4param,0)}InitClearSurface2(c,d,g,k){this._type=7;const m=this._mat4param;m[0]=c;m[1]=d;m[2]=g;m[3]=k}DoClearSurface(){const c=this._gl;var d=this._mat4param,g=this._batchState;
const k=g.clearColor;(g=g.renderer._isScissorViewport&&f.isDebug)&&c.disable(c.SCISSOR_TEST);const m=d[0],p=d[1],n=d[2];d=d[3];k.equalsRgba(m,p,n,d)||(c.clearColor(m,p,n,d),k.setRgba(m,p,n,d));c.clear(c.COLOR_BUFFER_BIT);g&&c.enable(c.SCISSOR_TEST)}InitClearRect(c,d,g,k,m,p,n,u){this._type=8;const q=this._mat4param;q[0]=c;q[1]=d;q[2]=g;q[3]=k;q[4]=m;q[5]=p;q[6]=n;q[7]=u}DoClearRectangle(){const c=this._gl;var d=this._mat4param,g=this._batchState;const k=g.renderer;g=g.clearColor;k._isScissorViewport||
c.enable(c.SCISSOR_TEST);c.scissor(d[0],d[1],d[2],d[3]);const m=d[4],p=d[5],n=d[6];d=d[7];g.equalsRgba(m,p,n,d)||(c.clearColor(m,p,n,d),g.setRgba(m,p,n,d));c.clear(c.COLOR_BUFFER_BIT);k._isScissorViewport?c.scissor(0,0,k._viewportScissorWidth,k._viewportScissorHeight):c.disable(c.SCISSOR_TEST)}InitSetPointTexCoords(c){this._type=13;c.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const c=this._mat4param;this._batchState.pointTexCoords.set(c[0],c[1],c[2],c[3])}InitPoints(c,d){this._type=
9;this._startIndex=c;this._indexCount=1;this._mat4param[0]=d}DoPoints(){const c=this._gl,d=this._batchState,g=d.renderer._spPoints;c.useProgram(g._shaderProgram);g.UpdateMatP(d.currentMatP,!1);g.UpdateMatMV(d.currentMV,!1);var k=d.pointTexCoords;g._uPointTexStart.IsUsed()&&g._uPointTexStart.Update2f(k.getLeft(),k.getTop());g._uPointTexEnd.IsUsed()&&g._uPointTexEnd.Update2f(k.getRight(),k.getBottom());k=this._mat4param[0];g._uZElevation.IsUsed()&&g._uZElevation.Update1f(k);g._uColor.IsUsed()&&(k=d.currentColor,
g._uColor.Update4f(k[0],k[1],k[2],k[3]));c.drawArrays(c.POINTS,this._startIndex/4,this._indexCount);c.useProgram(d.currentShader._shaderProgram)}InitSetProgram(c){this._type=10;this._texParam=c}DoSetProgram(){var c=this._gl;const d=this._batchState,g=this._texParam;d.currentShader=g;c.useProgram(g._shaderProgram);g.UpdateMatP(d.currentMatP,!1);g.UpdateMatMV(d.currentMV,!1);g._uColor.IsUsed()&&(c=d.currentColor,g._uColor.Update4f(c[0],c[1],c[2],c[3]))}InitSetProgramParameters(){this._type=11}DoSetProgramParameters(){const c=
this._batchState.currentShader;c._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(c);c._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(c)}_DoSetOptionalUniformProgramParameters(c){const d=this._gl,g=this._mat4param,k=this._colorParam,m=this._srcOriginRect;if(c._uSamplerBack.IsUsed()){const p=this._batchState.renderer,n=this._texParam;p._lastTexture1!==n&&(d.activeTexture(d.TEXTURE1),d.bindTexture(d.TEXTURE_2D,n?n._GetTexture():null),p._lastTexture1=n,d.activeTexture(d.TEXTURE0))}c._uPixelSize.IsUsed()&&
c._uPixelSize.Update2f(g[0],g[1]);c._uDestStart.IsUsed()&&c._uDestStart.Update2f(g[2],g[3]);c._uDestEnd.IsUsed()&&c._uDestEnd.Update2f(g[4],g[5]);c._uLayerScale.IsUsed()&&c._uLayerScale.Update1f(g[6]);c._uLayerAngle.IsUsed()&&c._uLayerAngle.Update1f(g[7]);c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(g[12],g[13]);c._uSrcEnd.IsUsed()&&c._uSrcEnd.Update2f(g[14],g[15]);c._uSrcOriginStart.IsUsed()&&c._uSrcOriginStart.Update2f(m[0],m[1]);c._uSrcOriginEnd.IsUsed()&&c._uSrcOriginEnd.Update2f(m[2],m[3]);c._uLayoutStart.IsUsed()&&
c._uLayoutStart.Update2f(k[0],k[1]);c._uLayoutEnd.IsUsed()&&c._uLayoutEnd.Update2f(k[2],k[3]);c._uSeconds.IsUsed()&&c._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(c){c=c._uCustomParameters;const d=this._shaderParams;for(let g=0,k=c.length;g<k;++g){const m=c[g],p=d[g];m.IsColorType()?m.Update3f(p.getR(),p.getG(),p.getB()):m.Update1f(p)}}InitInvalidateFramebuffer(c){this._type=12;this._texParam=c}DoInvalidateFramebuffer(){const c=this._gl,d=this._texParam,g=this._batchState.currentFramebuffer;
d!==g&&c.bindFramebuffer(c.FRAMEBUFFER,d);c.invalidateFramebuffer(c.FRAMEBUFFER,[c.COLOR_ATTACHMENT0]);d!==g&&c.bindFramebuffer(c.FRAMEBUFFER,g)}InitBlitFramebuffer(c,d,g){this._type=15;const k=this._mat4param,m=this._batchState.renderer;k[0]=c.GetWidth();k[1]=c.GetHeight();k[2]=d?d.GetWidth():m.GetWidth();k[3]=d?d.GetHeight():m.GetHeight();k[4]=c.IsLinearSampling()?1:0;k[5]="stretch"===g;g=this._shaderParams;f.clearArray(g);g.push(c._GetFramebuffer());g.push(d?d._GetFramebuffer():null)}DoBlitFramebuffer(){var c=
this._mat4param,d=this._shaderParams;const g=this._gl;var k=c[0],m=c[1],p=c[2];const n=c[3],u=0!==c[4];c=0!==c[5];const q=d[1];g.bindFramebuffer(g.READ_FRAMEBUFFER,d[0]);g.bindFramebuffer(g.DRAW_FRAMEBUFFER,q);c?g.blitFramebuffer(0,0,k,m,0,0,p,n,g.COLOR_BUFFER_BIT,u?g.LINEAR:g.NEAREST):(d=Math.min(k,p),k=Math.min(m,n),p=Math.max(m-n,0),m=Math.max(n-m,0),g.blitFramebuffer(0,p,d,k+p,0,m,d,k+m,g.COLOR_BUFFER_BIT,g.NEAREST))}InitStartQuery(c){this._type=16;this._texParam=c}DoStartQuery(){this._texParam.BeginTimeElapsed();
this._texParam=null}InitEndQuery(c){this._type=17;this._texParam=c}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(c,d,g){this._type=18;const k=this._mat4param;k[0]=c;k[1]=d;k[2]=g}DoSetEllipseParams(){const c=this._batchState.currentShader,d=this._mat4param;c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(d[0],d[1]);c._uOutlineThickness.IsUsed()&&c._uOutlineThickness.Update1f(d[2])}InitSetTilemapInfo(c,d,g,k,m,p,n){this._type=14;const u=this._mat4param;c.writeToTypedArray(u,
0);u[4]=1/d;u[5]=1/g;u[6]=k/d;u[7]=m/g;u[8]=p/d;u[9]=n/g}DoSetTilemapInfo(){const c=this._batchState.currentShader,d=this._mat4param;c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(d[0],d[1]);c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(d[4],d[5]);c._uTileSize.IsUsed()&&c._uTileSize.Update2f(d[6],d[7]);c._uTileSpacing.IsUsed()&&c._uTileSpacing.Update2f(d[8],d[9])}Run(){switch(this._type){case 1:this.DoQuad();break;case 2:this.DoSetTexture();break;case 3:this.DoSetColor();break;case 4:this.DoSetBlend();
break;case 5:this.DoUpdateModelView();break;case 6:this.DoSetRenderTarget();break;case 7:this.DoClearSurface();break;case 8:this.DoClearRectangle();break;case 9:this.DoPoints();break;case 10:this.DoSetProgram();break;case 11:this.DoSetProgramParameters();break;case 12:this.DoInvalidateFramebuffer();break;case 13:this.DoSetPointTextureCoords();break;case 14:this.DoSetTilemapInfo();break;case 15:this.DoBlitFramebuffer();break;case 16:this.DoStartQuery();break;case 17:this.DoEndQuery();break;case 18:this.DoSetEllipseParams();
break;case 19:this.DoSetGradientColor()}}}}"use strict";
{const f=self.C3,b={timeout:60},a=new f.Color(0,0,0,1),e=new Set(["left","center","right"]),c=new Set(["top","center","bottom"]),d=new Set(["word","character"]),g=new Set;f.FontManager&&f.FontManager.addEventListener("fontload",n=>{n=n.font.GetName();for(const u of g)(u.IsBBCodeEnabled()||f.equalsNoCase(u.GetFontName(),n))&&u._SetTextChanged()});function k(n,u,q,r,t,x){u?"Gecko"===f.Platform.BrowserEngine?n.strokeText(q,r,t,x):n.strokeText(q,r,t):"Gecko"===f.Platform.BrowserEngine?n.fillText(q,r,
t,x):n.fillText(q,r,t)}function m(n,u,q,r,t,x){u?n.strokeRect(q,r,t,x):n.fillRect(q,r,t,x)}function p(n){return 4/3*n}f.Gfx.RendererText=class{constructor(n,u){u=Object.assign({},b,u);this._renderer=n;this._fontName="Arial";this._fontSize=16;this._lineHeight=0;this._isItalic=this._isBold=!1;this._colorStr="black";this._isBBcodeEnabled=!1;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text="";this._bbString=null;this._wrappedText=
f.New(f.WordWrap);this._wrapMode="word";this._isUpdating=this._textChanged=!1;this._isAsync=!0;this._drawMaxCharCount=-1;this._height=this._width=this._cssHeight=this._cssWidth=this._drawCharCount=0;this._zoom=1;this._changed=!1;this._measureContext=this._textContext=this._textCanvas=null;this._lastCanvasHeight=this._lastCanvasWidth=-1;this._lastTextCanvasFillStyle=this._lastMeasureCanvasFont=this._lastTextCanvasFont="";this._lastTextCanvasLineWidth=this._lastTextCanvasOpacity=1;this._measureTextCallback=
(q,r)=>this._MeasureText(q,r);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new f.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new f.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},u.timeout);this.ontextureupdate=null;this._wasReleased=!1;g.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._measureTextCallback=this._measureContext=this._textContext=this._textCanvas=this._bbString=null;this._textureTimeout.Release();
this.ontextureupdate=null;this.ReleaseTexture();this._wrappedText.Clear();this._renderer=this._wrappedText=null;this._wasReleased=!0;g.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=!0}SetIsAsync(n){this._isAsync=!!n}IsAsync(){return this._isAsync}SetBBCodeEnabled(n){n=!!n;this._isBBcodeEnabled!==n&&(this._isBBcodeEnabled=n,this._textContext&&(this._textContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top"),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(n){n||
(n="serif");this._fontName!==n&&(this._fontName=n,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(n){.1>n&&(n=.1);this._fontSize!==n&&(this._fontSize=n,this._SetTextChanged())}SetLineHeight(n){this._lineHeight!==n&&(this._lineHeight=n,this._SetChanged())}SetBold(n){n=!!n;this._isBold!==n&&(this._isBold=n,this._SetTextChanged())}SetItalic(n){n=!!n;this._isItalic!==n&&(this._isItalic=n,this._SetTextChanged())}SetDrawMaxCharacterCount(n){n=Math.floor(n);this._drawMaxCharCount!==
n&&(this._drawMaxCharCount=n,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(n,u){for(let q=n.length-1;0<=q;--q){const r=n[q];if(r.tag===u)return r}return null}_HasStyleTag(n,u){return!!this._GetStyleTag(n,u)}_GetFontString(n,u){let q="";if(this._isBold||this._HasStyleTag(u,"b"))q+="bold";if(this._isItalic||this._HasStyleTag(u,"i"))q+=" italic";var r=this._GetStyleTag(u,"size");r=r?parseFloat(r.param):this._fontSize;q=n?q+(" "+r+"pt"):q+(" "+r*this._scaleFactor*
this._zoom*self.devicePixelRatio+"pt");n=this._fontName;(u=this._GetStyleTag(u,"font"))&&u.param&&(n=u.param,this.onloadfont&&!this._alreadyLoadedFonts.has(n)&&(this.onloadfont(n),this._alreadyLoadedFonts.add(n)));n&&(q+=' "'+n+'"');return q}SetColor(n){n instanceof f.Color&&(n=n.getCssRgb());this._colorStr!==n&&(this._colorStr=n,this._SetChanged())}SetColorRgb(n,u,q){a.setRgb(n,u,q);this.SetColor(a)}SetHorizontalAlignment(n){if(!e.has(n))throw Error("invalid horizontal alignment");this._horizontalAlign!==
n&&(this._horizontalAlign=n,this._SetChanged())}SetVerticalAlignment(n){if(!c.has(n))throw Error("invalid vertical alignment");this._verticalAlign!==n&&(this._verticalAlign=n,this._SetChanged())}SetWordWrapMode(n){if(!d.has(n))throw Error("invalid word wrap mode");this._wrapMode!==n&&(this._wrapMode=n,this._SetTextChanged())}SetText(n){this._text!==n&&(this._text=n,this._SetTextChanged())}SetSize(n,u,q){"undefined"===typeof q&&(q=1);if(!(0>=n||0>=n||this._cssWidth===n&&this._cssHeight===u&&this._zoom===
q)){1===this._zoom!==(1===q)&&(this._needToRecreateTexture=!0);var r=this._cssWidth,t=this._zoom;this._cssWidth=n;this._cssHeight=u;this._zoom=q;n=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*n;this._height=this._cssHeight*this._zoom*n;n=Math.max(this._width,this._height);u=Math.min(this._renderer.GetMaxTextureSize(),2048);q=1;n>u&&(q=u/n,this._width=Math.min(this._width*q,u),this._height=Math.min(this._height*q,u));this._scaleFactor=q;0<this._textureWidth&&0<this._textureHeight&&this._zoom===
t&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);this._cssWidth!==r?this._SetTextChanged():this._SetChanged()}}GetWidth(){return this._width}GetHeight(){return this._height}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();return this._wrappedText.GetTotalLineHeight()+this._wrappedText.GetLineCount()*(this._lineHeight+4)-this._lineHeight}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();
return this._texture}_MaybeUpdate(){this._texture&&!this._changed&&!this._textChanged||this._isUpdating||0>=this._width||0>=this._height||(this._changed=!1,this._isUpdating=!0,this._isAsync?f.Asyncify(()=>this._DoUpdate()):this._DoUpdate())}_DoUpdate(){this._wasReleased||(this._SetTextCanvasSize(Math.ceil(this._width),Math.ceil(this._height)),this._MaybeWrapText(),this._DrawTextToCanvas(),this._UpdateTexture(),this._textureTimeout.Reset(),this._isUpdating=!1)}_SetTextCanvasSize(n,u){this._textCanvas||
(this._textCanvas=f.CreateCanvas(16,16));let q=!1;if(this._lastCanvasWidth!==n||this._lastCanvasHeight!==u)this._lastCanvasWidth=n,this._lastCanvasHeight=u,this._textCanvas.width=n,this._textCanvas.height=u,q=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),q=!0);q?(this._textContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._textContext.font=this._lastTextCanvasFont,this._textContext.fillStyle=this._lastTextCanvasFillStyle,this._textContext.strokeStyle=
this._lastTextCanvasFillStyle,this._textContext.globalAlpha=this._lastTextCanvasOpacity,this._textContext.lineWidth=this._lastTextCanvasLineWidth):this._textContext.clearRect(0,0,n,u)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=f.CreateCanvas(16,16).getContext("2d"))}_SetMeasureFontString(n){this._lastMeasureCanvasFont!==n&&(this._lastMeasureCanvasFont=n,this._measureContext.font=n)}_MaybeWrapText(){this._textChanged&&(this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||
this._bbString&&this._bbString.toString()===this._text||(this._bbString=new f.BBString(this._text,{noEscape:!0})),this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,0),this._textChanged=!1)}_MeasureText(n,u){this._SetMeasureFontString(this._GetFontString(!0,u));u=(u=this._GetStyleTag(u,"size"))?parseFloat(u.param):this._fontSize;return{width:this._measureContext.measureText(n).width,height:p(u)}}_SetDrawFontString(n){this._lastTextCanvasFont!==
n&&(this._lastTextCanvasFont=n,this._textContext.font=n)}_SetDrawCanvasColor(n){this._lastTextCanvasFillStyle!==n&&(this._lastTextCanvasFillStyle=n,this._textContext.fillStyle=n,this._textContext.strokeStyle=n)}_SetDrawCanvasOpacity(n){this._lastTextCanvasOpacity!==n&&(this._lastTextCanvasOpacity=n,this._textContext.globalAlpha=n)}_SetDrawCanvasLineWith(n){this._lastTextCanvasLineWidth!==n&&(this._lastTextCanvasLineWidth=n,this._textContext.lineWidth=n)}_DrawTextToCanvas(){this._drawCharCount=0;const n=
this._scaleFactor*this._zoom*self.devicePixelRatio,u=(4+this._lineHeight)*n;let q=0;const r=this._wrappedText.GetLines();var t=r.reduce((x,z)=>x+z.height*n+u,0)-this._lineHeight*n;"center"===this._verticalAlign?q=Math.max(this._height/2-t/2,0):"bottom"===this._verticalAlign&&(q=this._height-t-2);for(let x=0,z=r.length;x<z;++x){t=r[x];const D=t.height*n,G=q;if(this._isBBcodeEnabled){if(q+=D,0<x&&q>this._height-4*n)break}else if(0<x&&q>=this._height-D)break;0<=G&&this._DrawTextLine(t,q,n);this._isBBcodeEnabled||
(q+=D);q+=u}}_DrawTextLine(n,u,q){let r=0;"center"===this._horizontalAlign?r=(this._width-n.width*q)/2:"right"===this._horizontalAlign&&(r=this._width-n.width*q);for(const t of n.fragments)this._DrawTextFragment(t,r,u,q,n.height),r+=t.width*q}_DrawTextFragment(n,u,q,r,t){const x=this._textContext,z=t/16;t=n.width*r;const D=n.height*r,G=n.height/16;var w=(4+this._lineHeight)*r;const B=n.styles;n=n.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+
n.length>this._drawMaxCharCount&&(n=n.substr(0,this._drawMaxCharCount-this._drawCharCount),t=this._MeasureText(n,B).width*r);this._drawCharCount+=n.length}const I=this._GetStyleTag(B,"background"),P=this._HasStyleTag(B,"u"),E=this._HasStyleTag(B,"s");if((!f.IsStringAllWhitespace(n)||I||P||E)&&!this._HasStyleTag(B,"hide")){var J=this._GetStyleTag(B,"offsetx");u+=J?parseFloat(J.param)*r:0;J=this._GetStyleTag(B,"offsety");q+=J?parseFloat(J.param)*r:0;I&&(this._SetDrawCanvasColor(I.param),x.fillRect(u,
q-D,t,D+w));w=this._GetStyleTag(B,"color");this._SetDrawCanvasColor(w?w.param:this._colorStr);w=this._GetStyleTag(B,"opacity");this._SetDrawCanvasOpacity(w?parseFloat(w.param)/100:1);(w=this._HasStyleTag(B,"stroke"))&&this._SetDrawCanvasLineWith(G*this._scaleFactor*this._zoom);P&&m(x,w,u,q+r*z,t,r*z);E&&m(x,w,u,q-D/4,t,r*G);this._SetDrawFontString(this._GetFontString(!1,B));k(x,w,n,u,q,t);!w&&(this._SetDrawCanvasLineWith(G*this._scaleFactor*this._zoom),r=this._GetStyleTag(B,"outline"))&&(this._SetDrawCanvasColor(r.param),
k(x,!0,n,u,q,t))}}_UpdateTexture(){if(!this._renderer.IsContextLost()&&(this._textureWidth=Math.ceil(this._width),this._textureHeight=Math.ceil(this._height),this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight),this._needToRecreateTexture&&(this.ReleaseTexture(),this._needToRecreateTexture=!1),this._texture||(this._texture=this._renderer.CreateDynamicTexture(this._textureWidth,this._textureHeight,{mipMap:1===this._zoom,mipMapQuality:"high"})),this._renderer.UpdateTexture(this._textCanvas,
this._texture),this.ontextureupdate))this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){this._texture&&(this._renderer.IsContextLost()||this._renderer.DeleteTexture(this._texture),this._texture=null)}static OnContextLost(){for(const n of g)n.ReleaseTexture()}static GetAll(){return g.values()}}}"use strict";
{const f=self.C3;class b{constructor(a){this._gl=a.GetContext();this._version=a.GetWebGLVersionNumber();this._timerExt=a._GetDisjointTimerQueryExtension();this._query=null;this._hasResult=this._isActive=!1;this._result=0;this._query=1===this._version?this._timerExt.createQueryEXT():this._gl.createQuery()}Release(){this._DeleteQueryObject();this._timerExt=this._gl=null;this._hasResult=!1}_DeleteQueryObject(){this._query&&(1===this._version?this._timerExt.deleteQueryEXT(this._query):this._gl.deleteQuery(this._query),
this._query=null)}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");1===this._version?this._timerExt.beginQueryEXT(this._timerExt.TIME_ELAPSED_EXT,this._query):this._gl.beginQuery(this._timerExt.TIME_ELAPSED_EXT,this._query);this._isActive=!0}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");1===this._version?this._timerExt.endQueryEXT(this._timerExt.TIME_ELAPSED_EXT):this._gl.endQuery(this._timerExt.TIME_ELAPSED_EXT);this._isActive=!1}CheckForResult(){if(this._query&&
!this._hasResult&&!this._isActive){var a=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_AVAILABLE_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT_AVAILABLE);var e=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);a&&!e&&(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||
e)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}f.Gfx.WebGLTimeElapsedQuery=class{constructor(a){this._renderer=a;this._frameNumber=a.GetFrameNumber();this._isActive=!1;this._parentQuery=null;this._isNested=!1;this._realQuery=null;this._queries=[]}Release(){for(const a of this._queries)a instanceof b&&a.Release();f.clearArray(this._queries);this._renderer=this._realQuery=this._parentQuery=null}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");
const a=this._renderer._GetTimeQueryStack();0<a.length?(this._isNested=!0,this._parentQuery=a[a.length-1],this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null);this._isActive=!0;a.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");if(this._renderer._GetTimeQueryStack().pop()!==this)throw Error("can only end most nested query");this._isActive=!1;this._EndReal();this._parentQuery&&(this._parentQuery._StartReal(),
this._parentQuery=null)}_StartReal(){this._realQuery=f.New(b,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const a of this._queries)a.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(a=>a.HasResult())}GetResult(){return this._queries.reduce((a,e)=>a+e.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}}"use strict";
{const f=self.C3;f.Gfx.WebGLQueryResultBuffer=class{constructor(b,a=1E3){this._renderer=b;this._maxQueries=a;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const b of this._buffer)b.Release();f.clearArray(this._buffer)}AddTimeElapsedQuery(){const b=new f.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(b);this._buffer.length>this._maxQueries&&this._buffer.shift().Release();return b}CheckForResults(b){for(const a of this._buffer){if(a.GetFrameNumber()>=
b)break;if(a.IsNested())break;a.CheckForResult()}}GetFrameRangeResultSum(b,a){if(a<=b)return NaN;let e=0;for(const c of this._buffer){if(c.GetFrameNumber()>=a)break;if(!(c.GetFrameNumber()<b))if(c.HasResult())e+=c.GetResult();else return NaN}return e}DeleteAllBeforeFrameNumber(b){for(let a=0,e=this._buffer.length;a<e;++a){const c=this._buffer[a];if(c.GetFrameNumber()<b)c.Release();else{0<a&&this._buffer.splice(0,a);break}}}}}"use strict";
{const f=self.C3,b=self.glMatrix,a=b.vec3,e=b.vec4,c=b.mat4,d={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,maxWebGLVersion:2},g=new Set(["default","low-power","high-performance"]);function k(w,B){return w[0]===B[0]&&w[1]===B[1]&&w[2]===B[2]&&w[3]===B[3]&&w[4]===B[4]&&w[5]===B[5]&&w[6]===B[6]&&w[7]===B[7]&&w[8]===B[8]&&w[9]===B[9]&&w[10]===B[10]&&w[11]===B[11]&&w[12]===B[12]&&w[13]===B[13]&&w[14]===B[14]&&w[15]===B[15]}const m=new f.Quad(0,0,1,0,1,1,0,1),p=a.fromValues(0,
0,0),n=a.fromValues(0,0,0),u=c.create(),q=new f.Quad,r=new f.Rect;let t=null;f.isDebug&&(self.debug_lose_context=function(){t?t.loseContext():console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=function(){t?t.restoreContext():console.warn("WEBGL_lose_context not supported")});const x=new Set;let z=-1;function D(){z=-1;for(const w of x)w.checkFunc()&&(w.resolve(),x.delete(w));0<x.size&&(z=self.requestAnimationFrame(D))}function G(w,B,I){if(2<=I&&(I=w.getContext("webgl2",B)))return{gl:I,
version:2};I=w.getContext("webgl",B);if(!I)try{I=w.getContext("experimental-webgl",B)}catch(P){console.warn("Error requesting 'experimental-webgl' context: ",P)}return{gl:I,version:1}}f.Gfx.WebGLRenderer=class extends f.Gfx.RendererBase{constructor(w,B){super();B=Object.assign({},d,B);if(!g.has(B.powerPreference))throw Error("invalid power preference");let I=!1;const P={alpha:!!B.alpha,depth:!1,antialias:!1,powerPreference:B.powerPreference,failIfMajorPerformanceCaveat:!0};B.lowLatency&&(P.desynchronized=
!0,P.preserveDrawingBuffer=!0);let E=G(w,P,B.maxWebGLVersion);E.gl||(I=!0,P.failIfMajorPerformanceCaveat=!1,E=G(w,P,B.maxWebGLVersion));if(!E.gl)throw Error("failed to initialise WebGL context");this._gl=w=E.gl;this._attribs=w.getContextAttributes();B.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=w.getParameter(w.VERSION);this._version=E.version;this._is3d=!0;this._lastBackbufferHeight=this._lastBackbufferWidth=
0;this._pointBuffer=this._indexBuffer=this._texcoordBuffer=this._vertexBuffer=null;this._vertexData=new Float32Array(8E3*this.GetNumVertexComponents());this._indexData=new Uint16Array(12E3);this._texcoordData=new Float32Array(16E3);this._pointData=new Float32Array(32E3);this._lastVertexPtr=this._pointPtr=this._texPtr=this._vertexPtr=0;this._spTilemapFill=this._spPoints=this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=
this._spLinearGradientFill=this._spColorFill=this._spDeviceTransformTextureFill=this._lastProgram=null;this._batch=[];this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=null;this._lastPointZ=this._currentZ=this._baseZ=0;this._batchState=f.New(f.Gfx.BatchState,this);this._lastColor=f.New(f.Color,1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._lastDestBlend=this._lastSrcBlend=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];
this._lineOffset=.5;this._lineOffsetStack=[this._lineOffset];this._isScissorViewport=!1;this._viewportScissorHeight=this._viewportScissorWidth=-1;this._lastPointTexCoords=new f.Rect;this._maxTextureSize=-1;this._highpPrecision=this._maxPointSize=this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._hasMajorPerformanceCaveat=I;this._isInitialisingAfterContextRestored=!1;this._parallelShaderCompileExt=null;this._isGpuProfilingEnabled=!!B.enableGpuProfiling;
this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}async InitState(){var w=this._gl,B=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*B-4*B;f.clearArray(this._batch);this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=this._currentZ=
this._baseZ=0;B=this._batchState;B.currentShader=null;B.currentFramebuffer=null;e.set(B.currentColor,1,1,1,1);B.clearColor.setRgba(0,0,0,0);B.pointTexCoords.set(0,0,1,1);w.clearColor(0,0,0,0);w.clear(w.COLOR_BUFFER_BIT);w.enable(w.BLEND);w.blendFunc(w.ONE,w.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=w.ONE;this._lastDestBlend=w.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(w);w.disable(w.CULL_FACE);w.disable(w.STENCIL_TEST);w.disable(w.DITHER);w.disable(w.DEPTH_TEST);this._pointBuffer=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,
this._pointBuffer);w.bufferData(w.ARRAY_BUFFER,this._pointData.byteLength,w.DYNAMIC_DRAW);this._vertexBuffer=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,this._vertexBuffer);w.bufferData(w.ARRAY_BUFFER,this._vertexData.byteLength,w.DYNAMIC_DRAW);this._texcoordBuffer=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,this._texcoordBuffer);w.bufferData(w.ARRAY_BUFFER,this._texcoordData.byteLength,w.DYNAMIC_DRAW);this._indexBuffer=w.createBuffer();w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,this._indexBuffer);w.bufferData(w.ELEMENT_ARRAY_BUFFER,
this._indexData,w.STATIC_DRAW);w.activeTexture(w.TEXTURE0);w.bindTexture(w.TEXTURE_2D,null);this._maxTextureSize=w.getParameter(w.MAX_TEXTURE_SIZE);B=w.getParameter(w.ALIASED_POINT_SIZE_RANGE);this._minPointSize=B[0];this._maxPointSize=B[1];B=w.getShaderPrecisionFormat(w.VERTEX_SHADER,w.HIGH_FLOAT);const I=w.getShaderPrecisionFormat(w.FRAGMENT_SHADER,w.HIGH_FLOAT);this._highpPrecision=B&&I?Math.min(B.precision,I.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=w.getSupportedExtensions();
if(B=w.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor=w.getParameter(B.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=w.getParameter(B.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=w.getExtension("KHR_parallel_shader_compile");f.isDebug&&(t=w.getExtension("WEBGL_lose_context"));if(this._isGpuProfilingEnabled)if(1===this.GetWebGLVersionNumber()){if("Chromium"!==f.Platform.BrowserEngine||81<=f.Platform.BrowserVersionNumber||"undefined"!==typeof document)this._timerExt=w.getExtension("EXT_disjoint_timer_query")}else this._timerExt=
w.getExtension("EXT_disjoint_timer_query_webgl2")||w.getExtension("EXT_disjoint_timer_query");this._ClearAllShaderPrograms();w=f.Gfx.WebGLShaderProgram;B=w.GetDefaultVertexShaderSource(this._is3d,!1);w=[[w.GetTextureFillFragmentShaderSource(),B,"<default>"],[w.GetTextureFillFragmentShaderSource(),B,"<default-device-transform>"],[w.GetPointFragmentShaderSource(),w.GetPointVertexShaderSource(),"<point>"],[w.GetColorFillFragmentShaderSource(),B,"<fill>"],[w.GetLinearGradientFillFragmentShaderSource(),
B,"<lineargradient>"],[w.GetHardEllipseFillFragmentShaderSource(),B,"<hardellipse>"],[w.GetHardEllipseOutlineFragmentShaderSource(),B,"<hardellipseoutline>"],[w.GetSmoothEllipseFillFragmentShaderSource(),B,"<smoothellipse>"],[w.GetSmoothEllipseOutlineFragmentShaderSource(),B,"<smoothellipseoutline>"],[w.GetSmoothLineFillFragmentShaderSource(),B,"<smoothline>"],[w.GetTilemapFragmentShaderSource(),w.GetDefaultVertexShaderSource(this._is3d,!0),"<tilemap>"]];w=await Promise.all(w.map(P=>this.CreateShaderProgram({src:P[0]},
P[1],P[2])));this._spTextureFill=w[0];this._spDeviceTransformTextureFill=w[1];this._spPoints=w[2];this._spColorFill=w[3];this._spLinearGradientFill=w[4];this._spHardEllipseFill=w[5];this._spHardEllipseOutline=w[6];this._spSmoothEllipseFill=w[7];this._spSmoothEllipseOutline=w[8];this._spSmoothLineFill=w[9];this._spTilemapFill=w[10];this._currentStateGroup=null;this.SetTextureFillMode()}Is3D(){return this._is3d}GetNumVertexComponents(){return this._is3d?3:2}SetBaseZ(w){this._baseZ=w}GetBaseZ(){return this._baseZ}SetCurrentZ(w){this._currentZ=
w;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}async CreateShaderProgram(w,B,I){w=await f.Gfx.WebGLShaderProgram.Create(this,w,B,I);this._AddShaderProgram(w);return w}ResetLastProgram(){this._lastProgram=null}SetSize(w,B,I){if(this._width!==w||this._height!==B||I){this.EndBatch();I=this._gl;var P=this._batchState;this._width=w;this._height=B;w=this.GetScissoredViewportWidth();B=this.GetScissoredViewportHeight();this._UpdateViewportRenderer(w,B,this._width,this._height);this._UpdateViewportBatch(w,
B,this._matP);this._spDeviceTransformTextureFill&&(I.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,this._batchState.currentShader=this._spDeviceTransformTextureFill);I.bindTexture(I.TEXTURE_2D,null);I.activeTexture(I.TEXTURE1);I.bindTexture(I.TEXTURE_2D,null);I.activeTexture(I.TEXTURE0);this._lastTexture1=this._lastTexture0=null;this._currentRenderTarget&&
this._currentRenderTarget._Resize(this._width,this._height);I.bindFramebuffer(I.FRAMEBUFFER,null);this._currentRenderTarget=null;P.currentFramebuffer=null}}_UpdateViewportRenderer(w,B,I,P){this._cam[2]=100;c.lookAt(this._matMV,this._cam,this._look,this._up);c.perspective(this._matP,45,w/B,this.GetNearZ(),this.GetFarZ());const E=[0,0],J=[0,0],O=self.devicePixelRatio;this.Project(0,0,w,B,E);this.Project(1,1,w,B,J);this._worldScale[0]=O/(J[0]-E[0]);this._worldScale[1]=-O/(J[1]-E[1]);this._lastBackbufferWidth=
I;this._lastBackbufferHeight=P}_UpdateViewportBatch(w,B,I){const P=this._batchState;this._gl.viewport(0,0,w,B);w=this._allShaderPrograms;B=P.currentShader;for(let E=0,J=w.length;E<J;++E){const O=w[E];O===B?O.UpdateMatP(I,!0):O.SetMatPStale()}c.copy(P.currentMatP,I)}SetViewportScissor(w,B){const I=this._gl;if(this._width===w&&this._height===B)this._isScissorViewport&&(this.EndBatch(),I.disable(I.SCISSOR_TEST),this._isScissorViewport=!1,this._viewportScissorHeight=this._viewportScissorWidth=-1,this.SetSize(this._width,
this._height,!0));else if(this._isScissorViewport||(this.EndBatch(),I.enable(I.SCISSOR_TEST),this._isScissorViewport=!0),this._viewportScissorWidth!==w||this._viewportScissorHeight!==B)this.EndBatch(),I.scissor(0,0,w,B),this._viewportScissorWidth=w,this._viewportScissorHeight=B,this.SetSize(this._width,this._height,!0)}RemoveViewportScissor(){const w=this._gl;this._isScissorViewport&&(this.EndBatch(),w.disable(w.SCISSOR_TEST),this._isScissorViewport=!1);this._viewportScissorHeight=this._viewportScissorWidth=
-1}GetScissoredViewportWidth(){return this._isScissorViewport?this._viewportScissorWidth:this.GetWidth()}GetScissoredViewportHeight(){return this._isScissorViewport?this._viewportScissorHeight:this.GetHeight()}UpdateModelView(){k(this._lastMV,this._matMV)||(this.PushBatch().InitUpdateModelView(this._matMV),c.copy(this._lastMV,this._matMV),this._topOfBatch=0)}GetBatchState(){return this._batchState}PushBatch(){const w=this._batch;this._batchPtr===w.length&&w.push(new f.Gfx.WebGLBatchJob(this._batchState));
return w[this._batchPtr++]}EndBatch(){0===this._batchPtr||this.IsContextLost()||(this._WriteBuffers(),this._ExecuteBatch(),this._topOfBatch=this._pointPtr=this._texPtr=this._vertexPtr=this._batchPtr=0)}_WriteBuffers(){const w=this._gl;0<this._pointPtr&&(w.bindBuffer(w.ARRAY_BUFFER,this._pointBuffer),w.bufferSubData(w.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr)));0<this._vertexPtr&&(w.bindBuffer(w.ARRAY_BUFFER,this._vertexBuffer),w.bufferSubData(w.ARRAY_BUFFER,0,this._vertexData.subarray(0,
this._vertexPtr)),w.bindBuffer(w.ARRAY_BUFFER,this._texcoordBuffer),w.bufferSubData(w.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const w=this._batch;for(let B=0,I=this._batchPtr;B<I;++B)w[B].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(w,B,I,P){const E=this._lastColor;E.equalsRgba(w,B,I,P)||(E.setRgba(w,B,I,P),this.PushBatch().InitSetColor(E),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(w){const B=this._lastColor;B.getA()!==w&&(B.setA(w),
this.PushBatch().InitSetColor(B),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(w){const B=this._lastColor;B.equals(w)||(B.set(w),this.PushBatch().InitSetColor(B),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(w){w!==this._lastTexture0&&(this.PushBatch().InitSetTexture(w),this._lastTexture0=w,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(w){w=this._GetBlendByIndex(w);this._SetBlend(w[0],
w[1])}SetNamedBlendMode(w){w=this.GetNamedBlend(w);this._SetBlend(w.srcBlend,w.destBlend)}_SetBlend(w,B){if(w!==this._lastSrcBlend||B!==this._lastDestBlend)this.PushBatch().InitSetBlend(w,B),this._lastSrcBlend=w,this._lastDestBlend=B,this._topOfBatch=0,this._currentStateGroup=null}IsPremultipliedAlphaBlend(){return this._lastSrcBlend===this._gl.ONE&&this._lastDestBlend===this._gl.ONE_MINUS_SRC_ALPHA}SetAlphaBlend(){this._SetBlend(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA)}SetNoPremultiplyAlphaBlend(){this._SetBlend(this._gl.SRC_ALPHA,
this._gl.ONE_MINUS_SRC_ALPHA)}SetCopyBlend(){this._SetBlend(this._gl.ONE,this._gl.ZERO)}Rect(w){this.Rect2(w.getLeft(),w.getTop(),w.getRight(),w.getBottom())}Rect2(w,B,I,P){this.Quad2(w,B,I,B,I,P,w,P)}_ExtendQuadBatch(){let w=this._vertexPtr;w>=this._lastVertexPtr&&(this.EndBatch(),w=0);1===this._topOfBatch?this._batch[this._batchPtr-1]._indexCount+=6:(this.PushBatch().InitQuad(this._is3d?w:w/2*3,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(w){w.writeToTypedArray3D(this._vertexData,this._vertexPtr,
this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(w){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(w);m.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(w,B,I,P,E,J,O,R){this._ExtendQuadBatch();const T=this._vertexData;let Y=this._vertexPtr;const W=this._baseZ+this._currentZ;this._is3d?(T[Y++]=w,T[Y++]=B,T[Y++]=W,T[Y++]=I,T[Y++]=P,T[Y++]=W,T[Y++]=E,T[Y++]=J,T[Y++]=W,T[Y++]=O,T[Y++]=R,T[Y++]=W):(T[Y++]=w,T[Y++]=B,T[Y++]=I,T[Y++]=P,T[Y++]=E,T[Y++]=J,T[Y++]=O,T[Y++]=
R);this._vertexPtr=Y;m.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(w,B){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(w);B.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(w,B){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(w);B.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(w,B){c.copy(u,this._lastMV);a.copy(p,this._cam);a.copy(n,this._look);this._cam[0]=0;this._cam[1]=0;this._cam[2]=100*
self.devicePixelRatio;this._look[0]=0;this._look[1]=0;this._look[2]=0;this.ResetModelView();this.UpdateModelView();if(this._isScissorViewport){w=this._viewportScissorWidth/2;var I=this._viewportScissorHeight/2;r.set(-w,I,-w+this._viewportScissorWidth,I-this._viewportScissorHeight);q.setFromRect(r);r.set(0,0,this._viewportScissorWidth/this._width,this._viewportScissorHeight/this._height);this.Quad3(q,r)}else if("crop"===w&&this._currentRenderTarget&&B){w=this._width/2;I=this._height/2;const J=B.GetWidth();
B=B.GetHeight();var P=this._currentRenderTarget.GetWidth(),E=this._currentRenderTarget.GetHeight();P=Math.min(P,J);const O=Math.min(E,B),R=Math.max(B-E,0);E=Math.max(E-B,0);r.set(-w,I-E,-w+P,I-O-E);q.setFromRect(r);r.set(0,R,P,O+R);r.divide(J,B);this.Quad3(q,r)}else{let [J,O]=this.GetRenderTargetSize(this._currentRenderTarget);w=J/2;I=O/2;this.Rect2(-w,I,w,-I)}c.copy(this._matMV,u);a.copy(this._cam,p);a.copy(this._look,n);this.UpdateModelView()}ConvexPoly(w){var B=w.length/2;if(3>B)throw Error("need at least 3 points");
B-=2;const I=B-1,P=w[0],E=w[1];for(let J=0;J<B;J+=2){const O=2*J,R=w[O+2],T=w[O+3],Y=w[O+4],W=w[O+5];J===I?this.Quad2(P,E,R,T,Y,W,Y,W):this.Quad2(P,E,R,T,Y,W,w[O+6],w[O+7])}}Line(w,B,I,P){var E=f.angleTo(w,B,I,P),J=.5*this._lineWidth;const O=Math.sin(E)*J;E=Math.cos(E)*J;J=this._lineCap;2===J?this.LinePreCalc_LineCap2(w,B,I,P,O,E):1===J?this.LinePreCalc_LineCap1(w,B,I,P,O,E):this.LinePreCalc_LineCap0(w,B,I,P,O,E)}LinePreCalc_LineCap2(w,B,I,P,E,J){var O=this._lineOffset;w=w+O-J;B=B+O-E;I=I+O+J;P=P+
O+E;O=2*J;const R=2*E;this.Quad2(w+E,B-J,I+E,P-J,I-E-O,P+J-R,w-E+O,B+J+R)}LinePreCalc_LineCap1(w,B,I,P,E,J){const O=this._lineOffset;w=w+O-J;B=B+O-E;I=I+O+J;P=P+O+E;this.Quad2(w+E,B-J,I+E,P-J,I-E,P+J,w-E,B+J)}LinePreCalc_LineCap0(w,B,I,P,E,J){const O=this._lineOffset;w+=O;B+=O;I+=O;P+=O;this.Quad2(w+E,B-J,I+E,P-J,I-E,P+J,w-E,B+J)}TexturedLine(w,B,I,P,E,J){var O=f.angleTo(w,B,I,P),R=.5*this._lineWidth;const T=Math.sin(O)*R;O=Math.cos(O)*R;R=this._lineCap;2===R?this.TexturedLinePreCalc_LineCap2(w,B,
I,P,T,O,E,J):1===R?this.TexturedLinePreCalc_LineCap1(w,B,I,P,T,O,E,J):this.TexturedLinePreCalc_LineCap0(w,B,I,P,T,O,E,J)}TexturedLinePreCalc_LineCap2(w,B,I,P,E,J,O,R){var T=this._lineOffset;w=w+T-J;B=B+T-E;I=I+T+J;P=P+T+E;T=2*J;const Y=2*E;q.set(w+E,B-J,I+E,P-J,I-E-T,P+J-Y,w-E+T,B+J+Y);r.set(O,0,R,0);this.Quad3(q,r)}TexturedLinePreCalc_LineCap1(w,B,I,P,E,J,O,R){const T=this._lineOffset;w=w+T-J;B=B+T-E;I=I+T+J;P=P+T+E;q.set(w+E,B-J,I+E,P-J,I-E,P+J,w-E,B+J);r.set(O,0,R,0);this.Quad3(q,r)}TexturedLinePreCalc_LineCap0(w,
B,I,P,E,J,O,R){const T=this._lineOffset;w+=T;B+=T;I+=T;P+=T;q.set(w+E,B-J,I+E,P-J,I-E,P+J,w-E,B+J);r.set(O,0,R,0);this.Quad3(q,r)}LineRect(w,B,I,P){const E=.5*this._lineWidth,J=this._lineCap;2===J?this._LineRectPreCalc_LineCap2(w,B,I,P,E):1===J?this._LineRectPreCalc_LineCap1(w,B,I,P,E):this._LineRectPreCalc_LineCap0(w,B,I,P,E)}_LineRectPreCalc_LineCap2(w,B,I,P,E){this.LinePreCalc_LineCap2(w,B,I,B,0,E);this.LinePreCalc_LineCap2(I,B,I,P,E,0);this.LinePreCalc_LineCap2(I,P,w,P,0,-E);this.LinePreCalc_LineCap2(w,
P,w,B,-E,0)}_LineRectPreCalc_LineCap1(w,B,I,P,E){this.LinePreCalc_LineCap1(w,B,I,B,0,E);this.LinePreCalc_LineCap1(I,B,I,P,E,0);this.LinePreCalc_LineCap1(I,P,w,P,0,-E);this.LinePreCalc_LineCap1(w,P,w,B,-E,0)}_LineRectPreCalc_LineCap0(w,B,I,P,E){this.LinePreCalc_LineCap0(w,B,I,B,0,E);this.LinePreCalc_LineCap0(I,B,I,P,E,0);this.LinePreCalc_LineCap0(I,P,w,P,0,-E);this.LinePreCalc_LineCap0(w,P,w,B,-E,0)}LineRect2(w){this.LineRect(w.getLeft(),w.getTop(),w.getRight(),w.getBottom())}LineQuad(w){var B=f.angleTo(w.getTlx(),
w.getTly(),w.getTrx(),w.getTry()),I=.5*this._lineWidth;const P=Math.sin(B)*I;B=Math.cos(B)*I;I=this._lineCap;2===I?this._LineQuadPreCalc_LineCap2(w,P,B):1===I?this._LineQuadPreCalc_LineCap1(w,P,B):this._LineQuadPreCalc_LineCap0(w,P,B)}_LineQuadPreCalc_LineCap2(w,B,I){this.LinePreCalc_LineCap2(w.getTlx(),w.getTly(),w.getTrx(),w.getTry(),B,I);this.LinePreCalc_LineCap2(w.getTrx(),w.getTry(),w.getBrx(),w.getBry(),I,-B);this.LinePreCalc_LineCap2(w.getBrx(),w.getBry(),w.getBlx(),w.getBly(),-B,-I);this.LinePreCalc_LineCap2(w.getBlx(),
w.getBly(),w.getTlx(),w.getTly(),-I,B)}_LineQuadPreCalc_LineCap1(w,B,I){this.LinePreCalc_LineCap1(w.getTlx(),w.getTly(),w.getTrx(),w.getTry(),B,I);this.LinePreCalc_LineCap1(w.getTrx(),w.getTry(),w.getBrx(),w.getBry(),I,-B);this.LinePreCalc_LineCap1(w.getBrx(),w.getBry(),w.getBlx(),w.getBly(),-B,-I);this.LinePreCalc_LineCap1(w.getBlx(),w.getBly(),w.getTlx(),w.getTly(),-I,B)}_LineQuadPreCalc_LineCap0(w,B,I){this.LinePreCalc_LineCap0(w.getTlx(),w.getTly(),w.getTrx(),w.getTry(),B,I);this.LinePreCalc_LineCap0(w.getTrx(),
w.getTry(),w.getBrx(),w.getBry(),I,-B);this.LinePreCalc_LineCap0(w.getBrx(),w.getBry(),w.getBlx(),w.getBly(),-B,-I);this.LinePreCalc_LineCap0(w.getBlx(),w.getBly(),w.getTlx(),w.getTly(),-I,B)}SetLineWidth(w){this._lineWidth=w;this._lineWidthStack[this._lineWidthStack.length-1]=w}GetLineWidth(){return this._lineWidth}PushLineWidth(w){if(100<=this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(w);this._lineWidth=w}PopLineWidth(){if(1>=
this._lineWidthStack.length)throw Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack[this._lineWidthStack.length-1]}SetLineCapButt(){this._lineCap=0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(w){if("butt"===w)this.PushLineCapButt();else if("square"===
w)this.PushLineCapSquare();else if("zag"===w)this.PushLineCapZag();else throw Error("invalid line cap");}PushLineCapButt(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");
this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(1>=this._lineCapStack.length)throw Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=this._lineCapStack[this._lineCapStack.length-1]}SetLineOffset(w){this._lineOffset=w;this._lineOffsetStack[this._lineOffsetStack.length-1]=w}GetLineOffset(){return this._lineOffset}PushLineOffset(w){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(w);
this._lineOffset=w}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack[this._lineOffsetStack.length-1]}SetPointTextureCoords(w){this._lastPointTexCoords.equals(w)||(this._lastPointTexCoords.copy(w),this.PushBatch().InitSetPointTexCoords(w),this._topOfBatch=0)}Point(w,B,I,P){7996<=this._pointPtr&&this.EndBatch();let E=this._pointPtr;var J=this._baseZ+this._currentZ;2===
this._topOfBatch&&this._lastPointZ===J?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(E,J),this._topOfBatch=2,this._lastPointZ=J);J=this._pointData;J[E++]=w;J[E++]=B;J[E++]=I;J[E++]=P;this._pointPtr=E}SetProgram(w){this._lastProgram!==w&&(this.PushBatch().InitSetProgram(w),this._lastProgram=w,this._topOfBatch=0,this._currentStateGroup=null)}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetGradientColor(w){this.PushBatch().InitSetGradientColor(w);
this._topOfBatch=0}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetEllipseParams(w,B,I=1){this.PushBatch().InitSetEllipseParams(w,B,I);this._topOfBatch=0}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetTilemapInfo(w,
B,I,P,E,J,O){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(w,B,I,P,E,J,O);this._topOfBatch=0}SetProgramParameters(w,B,I,P,E,J,O,R,T,Y,W){const ea=this._lastProgram;var qa=ea._hasAnyOptionalUniforms;const ja=!!W.length;if(qa&&!ea.AreOptionalUniformsAlreadySetInBatch(B,I,P,E,J,O,R,T,Y)||ja&&!ea.AreCustomParametersAlreadySetInBatch(W)){var xa=this.PushBatch();xa.InitSetProgramParameters();qa&&(ea.SetOptionalUniformsInBatch(B,
I,P,E,J,O,R,T,Y),qa=xa._mat4param,qa[0]=J,qa[1]=O,B.writeToTypedArray(qa,2),qa[6]=R,qa[7]=T,I.writeToTypedArray(qa,12),B=xa._colorParam,E.writeToTypedArray(B,0),E=B[1],B[1]=B[3],B[3]=E,P.writeToTypedArray(xa._srcOriginRect,0),xa._startIndex=Y,ea._uSamplerBack.IsUsed()?xa._texParam=w?w.GetTexture():null:xa._texParam=null);ja&&(ea.SetCustomParametersInBatch(W),f.shallowAssignArray(xa._shaderParams,W));this._topOfBatch=0}}ClearRgba(w,B,I,P){this.PushBatch().InitClearSurface2(w,B,I,P);this._topOfBatch=
0}Clear(w){this.PushBatch().InitClearSurface(w);this._topOfBatch=0}ClearRect(w,B,I,P){this.ClearRect4(w,B,I,P,0,0,0,0)}ClearRect2(w){this.ClearRect4(w.getLeft(),w.getTop(),w.width(),w.height(),0,0,0,0)}ClearRect3(w,B){this.ClearRect4(w.getLeft(),w.getTop(),w.width(),w.height(),B.getR(),B.getG(),B.getB(),B.getA())}ClearRect4(w,B,I,P,E,J,O,R){0>I||0>P||(this.PushBatch().InitClearRect(w,B,I,P,E,J,O,R),this._topOfBatch=0)}Start(){}Finish(){super.Finish();this._gl.flush()}CheckForQueryResults(){for(const w of this._allQueryResultBuffers)w.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||
this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){f.Gfx.WebGLRendererTexture.OnContextLost();f.Gfx.WebGLRenderTarget.OnContextLost();f.Gfx.RendererText.OnContextLost();for(const w of this._allQueryResultBuffers)w.Clear();this._extensions=[];this._parallelShaderCompileExt=this._timerExt=null;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._spTilemapFill=this._spPoints=this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=
this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spDeviceTransformTextureFill=this._spTextureFill=this._lastProgram=null;for(const w of this._stateGroups.values())w.OnContextLost();for(const w of this._allShaderPrograms)w.Release();this._ClearAllShaderPrograms()}async OnContextRestored(){this._isInitialisingAfterContextRestored=!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const w of this._stateGroups.values())w.OnContextRestored(this);this.SetSize(this._width,
this._height,!0)}CreateStaticTexture(w,B){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const I=f.New(f.Gfx.WebGLRendererTexture,this);I._CreateStatic(w,B);return I}CreateStaticTextureAsync(w,B){if(this.IsContextLost())return Promise.reject("context lost");B=Object.assign({},B);const I=B.wrapX&&"clamp-to-edge"!==B.wrapX||B.wrapY&&"clamp-to-edge"!==B.wrapY;if(!f.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&I)return f.Supports.ImageBitmap?createImageBitmap(w).then(P=>
f.Asyncify(()=>this.CreateStaticTexture(P,B))):w instanceof Blob?f.BlobToImage(w,!0).then(P=>this.CreateStaticTextureAsync(P,B)):"undefined"!==typeof HTMLImageElement&&w instanceof HTMLImageElement&&"function"===typeof w.decode?w.decode().then(()=>f.Asyncify(()=>this.CreateStaticTexture(w,B))):f.Asyncify(()=>this.CreateStaticTexture(w,B));B.premultiplyAlpha=!1;return createImageBitmap(w,{premultiplyAlpha:"premultiply"}).then(P=>f.Asyncify(()=>this.CreateStaticTexture(P,B)))}CreateDynamicTexture(w,
B,I){this.EndBatch();const P=f.New(f.Gfx.WebGLRendererTexture,this);P._CreateDynamic(w,B,I);return P}UpdateTexture(w,B,I){this.EndBatch();B._Update(w,I)}DeleteTexture(w){w&&(w.SubtractReference(),0<w.GetReferenceCount()||(this.EndBatch(),w===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),w===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=
null),w._Delete()))}CreateRenderTarget(w){let B=this._width,I=this._height,P=!0;w&&("number"===typeof w.width&&(B=w.width,P=!1),"number"===typeof w.height&&(I=w.height,P=!1));if(0>=B||0>=I)throw Error("invalid size");this.EndBatch();const E=f.New(f.Gfx.WebGLRenderTarget,this);E._Create(B,I,Object.assign({isDefaultSize:P},w));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;return E}SetRenderTarget(w){if(w!==this._currentRenderTarget){if(w){w.IsDefaultSize()&&w._Resize(this._width,
this._height);var B=w.GetWidth();var I=w.GetHeight();var P=B;var E=I}else B=this._width,I=this._height,P=this.GetScissoredViewportWidth(),E=this.GetScissoredViewportHeight();var J=this._lastBackbufferWidth!==B||this._lastBackbufferHeight!==I;J&&this._UpdateViewportRenderer(P,E,B,I);this.PushBatch().InitSetRenderTarget(w,J,this._matP);this._currentRenderTarget=w;this._topOfBatch=0}}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(w){return w?[w.GetWidth(),w.GetHeight()]:[this._width,
this._height]}CopyRenderTarget(w,B="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(w,B)):(this.PushBatch().InitBlitFramebuffer(w,this._currentRenderTarget,B),this._topOfBatch=0)}DrawRenderTarget(w,B="stretch"){w=w.GetTexture();if(!w)throw Error("not a texture-backed render target");this.SetTexture(w);this.FullscreenQuad(B,w)}InvalidateRenderTarget(w){2>this._version||(this.PushBatch().InitInvalidateFramebuffer(w._GetFramebuffer()),
this._topOfBatch=0)}DeleteRenderTarget(w){this.SetRenderTarget(null);this.EndBatch();const B=w.GetTexture();B===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);B===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=null);w._Delete()}async ReadBackRenderTargetToImageData(w,B,I){this.EndBatch();const P=this._currentRenderTarget;if(w){var E=
w.GetWidth();var J=w.GetHeight();var O=w._GetFramebuffer()}else E=this.GetWidth(),J=this.GetHeight(),O=null;let R=w=0;var T=E,Y=J;I&&(w=f.clamp(Math.floor(I.getLeft()),0,E-1),R=f.clamp(Math.floor(I.getTop()),0,J-1),T=I.width(),T=0===T?E-w:f.clamp(Math.floor(T),0,E-w),Y=I.height(),Y=0===Y?J-R:f.clamp(Math.floor(Y),0,J-R),R=J-(R+Y));const W=this._gl;W.bindFramebuffer(W.FRAMEBUFFER,O);J=()=>{W.bindFramebuffer(W.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;
this.SetRenderTarget(P)};if(!B&&2<=this.GetWebGLVersionNumber()){W.bindFramebuffer(W.READ_FRAMEBUFFER,O);O=W.createBuffer();I=T*Y*4;E=W.PIXEL_PACK_BUFFER;W.bindBuffer(E,O);W.bufferData(E,I,W.STREAM_READ);W.readPixels(w,R,T,Y,W.RGBA,W.UNSIGNED_BYTE,0);W.bindFramebuffer(W.READ_FRAMEBUFFER,null);W.bindBuffer(E,null);J();const ea=W.fenceSync(W.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>W.getSyncParameter(ea,W.SYNC_STATUS)===W.SIGNALED);W.deleteSync(ea);B=new ImageData(T,Y);W.bindBuffer(E,
O);W.getBufferSubData(E,0,new Uint8Array(B.data.buffer),0,I);W.bindBuffer(E,null);W.deleteBuffer(O)}else B=new ImageData(T,Y),W.readPixels(w,R,T,Y,W.RGBA,W.UNSIGNED_BYTE,new Uint8Array(B.data.buffer)),J();return B}StartQuery(w){this.SupportsGPUProfiling()&&(this.PushBatch().InitStartQuery(w),this._topOfBatch=0)}EndQuery(w){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(w),this._topOfBatch=0)}_WaitForObjectReady(w){const B=new Promise(I=>x.add({resolve:I,checkFunc:w}));-1===z&&(z=self.requestAnimationFrame(D));
return B}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*(this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let w=0;for(const B of f.Gfx.WebGLRenderTarget.allRenderTargets())B.GetTexture()||(w+=B.GetEstimatedMemoryUsage());return w}GetEstimatedTextureMemoryUsage(){let w=0;for(const B of f.Gfx.WebGLRendererTexture.allTextures())w+=B.GetEstimatedMemoryUsage();return w}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+
this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}SupportsNPOTTextures(){return 2<=this.GetWebGLVersionNumber()}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return 0!==this._highpPrecision}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetExtensions(){return this._extensions}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_AddQueryResultBuffer(w){this._allQueryResultBuffers.add(w)}_RemoveQueryResultBuffer(w){this._allQueryResultBuffers.delete(w)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(w){this._InitBlendModeData([["normal",
w.ONE,w.ONE_MINUS_SRC_ALPHA],["additive",w.ONE,w.ONE],["xor",w.ONE,w.ONE_MINUS_SRC_ALPHA],["copy",w.ONE,w.ZERO],["destination-over",w.ONE_MINUS_DST_ALPHA,w.ONE],["source-in",w.DST_ALPHA,w.ZERO],["destination-in",w.ZERO,w.SRC_ALPHA],["source-out",w.ONE_MINUS_DST_ALPHA,w.ZERO],["destination-out",w.ZERO,w.ONE_MINUS_SRC_ALPHA],["source-atop",w.DST_ALPHA,w.ONE_MINUS_SRC_ALPHA],["destination-atop",w.ONE_MINUS_DST_ALPHA,w.SRC_ALPHA]])}CreateRendererText(){return f.New(f.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}}"use strict";
{const f=self.C3;let b=null;const a=new Set;function e(k,m){const p=k[0]-m[0];return 0!==p?p:k[1]-m[1]}const c=[],d=[];let g=!1;self.IRuntime=class{constructor(k,m){b=k;Object.defineProperties(this,{assets:{value:b.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:m,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:b.GetProjectName(),writable:!1},projectVersion:{value:b.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(b),writable:!1},isInWorker:{value:b.IsInWorker(),
writable:!1}});b.UserScriptDispatcher().addEventListener("keydown",p=>{a.has(p.key)?p.stopPropagation():a.add(p.key)});b.UserScriptDispatcher().addEventListener("keyup",p=>a.delete(p.key));b.Dispatcher().addEventListener("window-blur",()=>a.clear());b.IsInWorker()&&(self.alert=p=>{g||(g=!0,console.warn("[Construct 3] alert() was called from a Web Worker, because the project 'Use worker' setting is enabled. This method is not normally available in a Web Worker. Construct has implemented the alert for you, but note that other features may be missing in worker mode. You may wish to disable 'Use worker', or use a more convenient function like console.log(). For more information please refer to the scripting section of the manual."));
return this.alert(p)})}_InitGlobalVars(k){Object.defineProperties(this.globalVars,k)}addEventListener(k,m){b.UserScriptDispatcher().addEventListener(k,m)}removeEventListener(k,m){b.UserScriptDispatcher().removeEventListener(k,m)}callFunction(k,...m){const p=b.GetEventSheetManager(),n=p.GetFunctionBlockByName(k);if(!n)throw Error(`cannot find function name '${k}'`);if(!n.IsEnabled())return n.GetDefaultReturnValue();if(m.length<n.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${k}' (${m.length} passed, ${n.GetFunctionParameterCount()} expected)`);
const u=n.GetEventBlock();k=null;var q=p.GetCurrentEvent();q&&(q=q.GetSolModifiersIncludingParents(),0<q.length&&(k=q,p.PushCleanSol(q)));m=u.RunAsExpressionFunctionCall(u.GetSolModifiersIncludingParents(),n.GetReturnType(),n.GetDefaultReturnValue(),...m);k&&p.PopSol(k);return m}setReturnValue(k){const m=b.GetEventStack().GetCurrentExpFuncStackFrame();if(!m)throw Error("not in a function which returns a value");switch(m.GetFunctionReturnType()){case 1:"number"===typeof k&&m.SetFunctionReturnValue(k);
break;case 2:"string"===typeof k&&m.SetFunctionReturnValue(k);break;case 3:"number"!==typeof k&&"string"!==typeof k||m.SetFunctionReturnValue(k)}}get dt(){return b.GetDt()}get gameTime(){return b.GetGameTime()}get wallTime(){return b.GetWallTime()}random(){return b.Random()}get layout(){return b.GetMainRunningLayout().GetILayout()}getLayout(k){const m=b.GetLayoutManager();if("number"===typeof k||"string"===typeof k)k=m.GetLayout(k);else throw new TypeError("expected string or number");if(!k)throw Error("invalid layout");
return k.GetILayout()}getAllLayouts(){return b.GetLayoutManager().GetAllLayouts().map(k=>k.GetILayout())}goToLayout(k){const m=b.GetLayoutManager();if("number"===typeof k||"string"===typeof k)k=m.GetLayout(k);else throw new TypeError("expected string or number");if(!k)throw Error("invalid layout");m.IsPendingChangeMainLayout()||m.ChangeMainLayout(k)}get keyboard(){const k=b._GetCommonScriptInterfaces().keyboard;if(!k)throw Error("runtime.keyboard used but Keyboard object missing - add it to your project first");
return k}get mouse(){const k=b._GetCommonScriptInterfaces().mouse;if(!k)throw Error("runtime.mouse used but Mouse object missing - add it to your project first");return k}get touch(){const k=b._GetCommonScriptInterfaces().touch;if(!k)throw Error("runtime.touch used but Touch object missing - add it to your project first");return k}invokeDownload(k,m){b.InvokeDownload(k,m)}getInstanceByUid(k){return(k=b.GetInstanceByUID(k))?k.GetInterfaceClass():null}sortZOrder(k,m){const p=b.GetCurrentLayout();for(var n of k){k=
b._UnwrapScriptInterface(n);if(!k||!k.GetWorldInfo())throw Error("invalid instance");var u=k.GetWorldInfo();c.push([u.GetLayer().GetIndex(),u.GetZIndex()]);d.push(k)}if(0!==c.length){c.sort(e);d.sort((q,r)=>m(q.GetInterfaceClass(),r.GetInterfaceClass()));n=!1;for(let q=0,r=c.length;q<r;++q){k=d[q];u=p.GetLayerByIndex(c[q][0]);const t=c[q][1],x=u._GetInstances();x[t]!==k&&(x[t]=k,k.GetWorldInfo()._SetLayer(u),u.SetZIndicesChanged(),n=!0)}n&&b.UpdateRender();f.clearArray(c);f.clearArray(d)}}alert(k){return b.PostComponentMessageToDOMAsync("runtime",
"alert",{message:k+(b.IsInWorker()?" [via Web Worker]":"")})}}}"use strict";
{const f=self.C3;let b=null;self.IAssetManager=class{constructor(a){b=a;Object.defineProperties(this,{isWebMOpusSupported:{value:b.IsAudioFormatSupported("audio/webm; codecs=opus"),writable:!1}})}fetchText(a){return b.FetchText(a)}fetchJson(a){return b.FetchJson(a)}fetchBlob(a){return b.FetchBlob(a)}fetchArrayBuffer(a){return b.FetchArrayBuffer(a)}getProjectFileUrl(a){return b.GetProjectFileUrl(a)}getMediaFileUrl(a){f.IsRelativeURL(a)&&(a=a.toLowerCase());return b.GetMediaFileUrl(a,b.GetMediaSubfolder())}get mediaFolder(){return b.GetMediaSubfolder()}async decodeWebMOpus(a,
e){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");e=await b.GetRuntime()._WasmDecodeWebMOpus(e);e=new Float32Array(e);a=a.createBuffer(1,e.length,48E3);a.getChannelData(0).set(e);return a}loadScripts(...a){return b.LoadScripts(...a)}compileWebAssembly(a){return b.CompileWebAssembly(a)}loadStyleSheet(a){return b.LoadStyleSheet(a)}}}"use strict";
self.IStorage=class{constructor(f){this._storage=f._GetProjectStorage()}getItem(f){return this._storage.getItem(f)}setItem(f,b){return this._storage.setItem(f,b)}removeItem(f){return this._storage.removeItem(f)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}};"use strict";
{const f=new WeakMap;self.IObjectClass=class{constructor(b){f.set(this,b);Object.defineProperties(this,{name:{value:b.GetName(),writable:!1}});b.GetRuntime()._MapScriptInterface(this,b)}addEventListener(b,a){f.get(this).UserScriptDispatcher().addEventListener(b,a)}removeEventListener(b,a){f.get(this).UserScriptDispatcher().removeEventListener(b,a)}getAllInstances(){return f.get(this).GetInstances().map(b=>b.GetInterfaceClass())}getFirstInstance(){const b=f.get(this).GetInstances();return 0<b.length?
b[0].GetInterfaceClass():null}getPickedInstances(){return f.get(this).GetCurrentSol().GetInstances().map(b=>b.GetInterfaceClass())}getFirstPickedInstance(){const b=f.get(this).GetCurrentSol().GetInstances();return 0<b.length?b[0].GetInterfaceClass():null}*instances(){for(const b of f.get(this).GetInstances())yield b.GetInterfaceClass()}*pickedInstances(){for(const b of f.get(this).GetCurrentSol().GetInstances())yield b.GetInterfaceClass()}setInstanceClass(b){if(0<f.get(this).GetInstanceCount())throw Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");
f.get(this)._SetUserScriptInstanceClass(b)}createInstance(b,a,e){if("number"!==typeof b&&"string"!==typeof b)throw new TypeError("invalid layer parameter");const c=f.get(this);var d=c.GetRuntime();b=d.GetMainRunningLayout().GetLayer(b);if(!b)throw Error("invalid layer");a=d.CreateInstance(c,b,a,e);d=d.GetEventSheetManager();d.BlockFlushingInstances(!0);a._TriggerOnCreated();if(a.IsInContainer())for(const g of a.siblings())g._TriggerOnCreated();d.BlockFlushingInstances(!1);return a.GetInterfaceClass()}}}"use strict";
{const f=new WeakMap;self.ILayout=class{constructor(b){f.set(this,b);const a=[],e=b.GetEffectList(),c=e.GetAllEffectTypes().length;for(let d=0;d<c;++d)a.push(new self.IEffectInstance(e,d));Object.defineProperties(this,{name:{value:b.GetName(),writable:!1},index:{value:b.GetIndex(),writable:!1},effects:{value:a,writable:!1}})}addEventListener(b,a){f.get(this).UserScriptDispatcher().addEventListener(b,a)}removeEventListener(b,a){f.get(this).UserScriptDispatcher().removeEventListener(b,a)}get width(){return f.get(this).GetWidth()}set width(b){f.get(this).SetWidth(b)}get height(){return f.get(this).GetHeight()}set height(b){f.get(this).SetHeight(b)}scrollTo(b,
a){const e=f.get(this);e.SetScrollX(b);e.SetScrollY(a)}getLayer(b){const a=f.get(this);if("number"===typeof b||"string"===typeof b)b=a.GetLayer(b);else throw new TypeError("expected string or number");if(!b)throw Error("invalid layer");return b.GetILayer()}getAllLayers(){return f.get(this).GetLayers().map(b=>b.GetILayer())}}}"use strict";
{const f=self.C3,b=new WeakMap;self.ILayer=class{constructor(a){b.set(this,a);const e=[],c=a.GetEffectList(),d=c.GetAllEffectTypes().length;for(let g=0;g<d;++g)e.push(new self.IEffectInstance(c,g));Object.defineProperties(this,{name:{value:a.GetName(),writable:!1},index:{value:a.GetIndex(),writable:!1},layout:{value:a.GetLayout().GetILayout(),writable:!1},effects:{value:e,writable:!1}})}static _Unwrap(a){return b.get(a)}get isVisible(){return b.get(this).IsVisible()}set isVisible(a){b.get(this).SetVisible(a)}get opacity(){return b.get(this).GetOpacity()}set opacity(a){a=
f.clamp(+a,0,1);isNaN(a)||b.get(this).SetOpacity(a)}getViewport(){return b.get(this).GetViewport().toDOMRect()}cssPxToLayer(a,e,c=0){const d=b.get(this),g=d.GetRuntime();return d.CanvasCssToLayer(a-g.GetCanvasClientX(),e-g.GetCanvasClientY(),c)}layerToCssPx(a,e,c=0){const d=b.get(this),g=d.GetRuntime(),[k,m]=d.LayerToCanvasCss(a,e,c);return[k+g.GetCanvasClientX(),m+g.GetCanvasClientY()]}}}"use strict";
{const f=self.C3,b=new WeakMap,a=new WeakMap;function e(d){let g=a.get(d);if(g)return g;g=f.New(f.Event.Dispatcher);a.set(d,g);return g}let c=null;self.IInstance=class{constructor(){b.set(this,c);const d={runtime:{value:c.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:c.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:c.GetUID(),writable:!1}};c._GetInstVarsScriptDescriptor(d);c._GetBehaviorsScriptDescriptor(d);Object.defineProperties(this,d);c.GetRuntime()._MapScriptInterface(this,
c)}static _Init(d){c=d}static _GetInitInst(){return c}_Release(){const d=a.get(this);d&&(d.Release(),a.delete(this));b.delete(this)}addEventListener(d,g,k){e(this).addEventListener(d,g,k)}removeEventListener(d,g,k){e(this).removeEventListener(d,g,k)}dispatchEvent(d){e(this).dispatchEvent(d)}destroy(){const d=b.get(this);d.GetRuntime().DestroyInstance(d)}}}"use strict";
{const f=self.C3,b=self.IInstance,a=self.ILayer,e=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(k=>[k[1],k[0]])),g=f.New(f.Color);self.IWorldInstance=class extends b{constructor(){super();var k=b._GetInitInst();e.set(this,k);const m=[];var p=k.GetWorldInfo();if(k=p.GetInstanceEffectList()){p=p.GetObjectClass().GetEffectList().GetAllEffectTypes().length;
for(let n=0;n<p;++n)m.push(new self.IEffectInstance(k,n))}Object.defineProperties(this,{effects:{value:m,writable:!1}})}get layout(){return e.get(this).GetWorldInfo().GetLayout().GetILayout()}get layer(){return e.get(this).GetWorldInfo().GetLayer().GetILayer()}get x(){return e.get(this).GetWorldInfo().GetX()}set x(k){k=+k;const m=e.get(this).GetWorldInfo();isNaN(k)||m.GetX()===k||(m.SetX(k),m.SetBboxChanged())}get y(){return e.get(this).GetWorldInfo().GetY()}set y(k){k=+k;const m=e.get(this).GetWorldInfo();
isNaN(k)||m.GetY()===k||(m.SetY(k),m.SetBboxChanged())}get zElevation(){return e.get(this).GetWorldInfo().GetZElevation()}set zElevation(k){k=+k;const m=e.get(this),p=m.GetWorldInfo();p.GetZElevation()!==k&&(p.SetZElevation(k),m.GetRuntime().UpdateRender())}get totalZElevation(){return e.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return e.get(this).GetWorldInfo().GetWidth()}set width(k){k=+k;const m=e.get(this).GetWorldInfo();isNaN(k)||m.GetWidth()===k||(m.SetWidth(k),m.SetBboxChanged())}get height(){return e.get(this).GetWorldInfo().GetHeight()}set height(k){k=
+k;const m=e.get(this).GetWorldInfo();isNaN(k)||m.GetHeight()===k||(m.SetHeight(k),m.SetBboxChanged())}get angle(){return e.get(this).GetWorldInfo().GetAngle()}set angle(k){k=f.clampAngle(+k);const m=e.get(this).GetWorldInfo();isNaN(k)||m.GetAngle()===k||(m.SetAngle(k),m.SetBboxChanged())}get angleDegrees(){return f.toDegrees(this.angle)}set angleDegrees(k){this.angle=f.toRadians(k)}getBoundingBox(){return e.get(this).GetWorldInfo().GetBoundingBox().toDOMRect()}getBoundingQuad(){return e.get(this).GetWorldInfo().GetBoundingQuad().toDOMQuad()}get isVisible(){return e.get(this).GetWorldInfo().IsVisible()}set isVisible(k){k=
!!k;const m=e.get(this),p=m.GetWorldInfo();p.IsVisible()!==k&&(p.SetVisible(k),m.GetRuntime().UpdateRender())}get opacity(){return e.get(this).GetWorldInfo().GetOpacity()}set opacity(k){k=f.clamp(+k,0,1);const m=e.get(this),p=m.GetWorldInfo();isNaN(k)||p.GetOpacity()===k||(p.SetOpacity(k),m.GetRuntime().UpdateRender())}set colorRgb(k){if(3>k.length)throw Error("expected 3 elements");g.setRgb(k[0],k[1],k[2]);k=e.get(this);const m=k.GetWorldInfo();m.GetUnpremultipliedColor().equalsIgnoringAlpha(g)||
(m.SetUnpremultipliedColor(g),k.GetRuntime().UpdateRender())}get colorRgb(){const k=e.get(this).GetWorldInfo().GetUnpremultipliedColor();return[k.getR(),k.getG(),k.getB()]}set blendMode(k){k=c.get(k);if("number"!==typeof k)throw Error("invalid blend mode");const m=e.get(this);m.GetWorldInfo().SetBlendMode(k);m.GetRuntime().UpdateRender()}get blendMode(){return d.get(e.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){e.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){e.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(k){k=
a._Unwrap(k);if(!k)throw Error("invalid layer");e.get(this).GetWorldInfo().ZOrderMoveToLayer(k)}moveAdjacentToInstance(k,m){e.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(e.get(k),m)}containsPoint(k,m){return e.get(this).GetWorldInfo().ContainsPoint(+k,+m)}testOverlap(k){const m=e.get(this);k=e.get(k);return m.GetRuntime().GetCollisionEngine().TestOverlap(m,k)}testOverlapSolid(){var k=e.get(this);return(k=k.GetRuntime().GetCollisionEngine().TestOverlapSolid(k))?k.GetInterfaceClass():null}getParent(){const k=
e.get(this).GetParent();return k?k.GetInterfaceClass():null}getTopParent(){const k=e.get(this).GetTopParent();return k?k.GetInterfaceClass():null}*parents(){for(const k of e.get(this).parents())yield k.GetInterfaceClass()}getChildCount(){return e.get(this).GetChildCount()}getChildAt(k){return(k=e.get(this).GetChildAt(k))?k.GetInterfaceClass():null}*children(){for(const k of e.get(this).children())yield k.GetInterfaceClass()}*allChildren(){for(const k of e.get(this).allChildren())yield k.GetInterfaceClass()}addChild(k,
m){m||(m={});const p=e.get(this);k=e.get(k);p.AddChild(k,m)}removeChild(k){const m=e.get(this);k=e.get(k);m.RemoveChild(k)}removeFromParent(){const k=e.get(this);k.HasParent()&&k.GetParent().RemoveChild(k)}createMesh(k,m){e.get(this).GetWorldInfo().CreateMesh(k,m)}releaseMesh(){const k=e.get(this).GetWorldInfo();k.ReleaseMesh();k.SetBboxChanged()}setMeshPoint(k,m,p){const n=e.get(this).GetWorldInfo();n.SetMeshPoint(k,m,p)&&n.SetBboxChanged()}}}"use strict";
{const f=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();f.set(this,self.IInstance._GetInitInst())}getElement(){return f.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){f.get(this).GetSdkInstance().FocusElement()}blur(){f.get(this).GetSdkInstance().BlurElement()}setCssStyle(b,a){f.get(this).GetSdkInstance().SetElementCSSStyle(b,a)}}}"use strict";
{const f=self.C3,b=new WeakMap,a=new WeakMap;function e(d){let g=a.get(d);if(g)return g;g=f.New(f.Event.Dispatcher);a.set(d,g);return g}let c=null;self.IBehaviorInstance=class{constructor(){b.set(this,c);const d={runtime:{value:c.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:c.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,d)}static _Init(d){c=d}static _GetInitInst(){return c}get instance(){return b.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const d=
a.get(this);d&&(d.Release(),a.delete(this));b.delete(this)}addEventListener(d,g,k){e(this).addEventListener(d,g,k)}removeEventListener(d,g,k){e(this).removeEventListener(d,g,k)}dispatchEvent(d){e(this).dispatchEvent(d)}}}"use strict";{const f=new WeakMap;self.IBehavior=class{constructor(b){f.set(this,b);b={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,b)}getAllInstances(){return f.get(this).GetInstances().map(b=>b.GetInterfaceClass())}}}"use strict";
{const f=self.C3,b=new WeakMap;self.IEffectInstance=class{constructor(a,e){b.set(this,a);Object.defineProperties(this,{index:{value:e,writable:!1}})}get name(){return b.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return b.get(this).IsEffectIndexActive(this.index)}set isActive(a){a=!!a;const e=b.get(this);e.IsEffectIndexActive(this.index)!==a&&(e.SetEffectIndexActive(this.index,a),e.UpdateActiveEffects(),e.GetRuntime().UpdateRender())}setParameter(a,e){a=Math.floor(+a);const c=
b.get(this);var d=c.GetEffectParametersForIndex(this.index);if(0>a||a>=d.length)throw new RangeError("invalid effect parameter index");const g=d[a];if(g instanceof f.Color){if(!Array.isArray(e)||3>e.length)throw new TypeError("expected array with 3 elements");a=e[0];d=e[1];e=e[2];if(g.equalsRgb(a,d,e))return;g.setRgb(a,d,e)}else{if("number"!==typeof e)throw new TypeError("expected number");if(g===e)return;d[a]=e}c.IsEffectIndexActive(this.index)&&c.GetRuntime().UpdateRender()}getParameter(a){a=Math.floor(+a);
const e=b.get(this).GetEffectParametersForIndex(this.index);if(0>a||a>=e.length)throw new RangeError("invalid effect parameter index");a=e[a];return a instanceof f.Color?[a.getR(),a.getG(),a.getB()]:a}}}"use strict";
{const f=self.C3,b=new Set(["local","remote"]),a=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"],["html","text/html"]]);function e(d){if(!d)return"";d=d.split(".");if(2>d.length)return"";d=d[d.length-1].toLowerCase();return a.get(d)||""}function c(d){return new Promise((g,k)=>{const m=document.createElement("script");m.onload=g;m.onerror=k;m.async=!1;m.src=d;document.head.appendChild(m)})}
f.AssetManager=class extends f.DefendedBase{constructor(d,g){super();if(!b.has(g.defaultLoadPolicy))throw Error("invalid load policy");this._runtime=d;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._isCordova=!!g.isCordova;this._isiOSCordova=!!g.isiOSCordova;this._isFileProtocol="file:"===location.protocol;this._supportedAudioFormats=g.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=this._fontsSubfolder=this._mediaSubfolder="";this._defaultLoadPolicy=
g.defaultLoadPolicy;this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=!1;this._lastLoadProgress=this._assetSizeLoaded=this._totalAssetSizeToLoad=0;this._hasHadErrorLoading=!1;this._loadingRateLimiter=f.New(f.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new f.PromiseThrottle(Math.max(f.hardwareConcurrency,8));if(g.localUrlBlobs)for(const [k,m]of Object.entries(g.localUrlBlobs))this._localUrlBlobs.set(k.toLowerCase(),
m);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const d of this._localBlobUrlCache.values())URL.revokeObjectURL(d);this._localBlobUrlCache.clear();for(const d of this._allAssets)d.Release();f.clearArray(this._allAssets);this._assetsByUrl.clear();f.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(d){this._mediaSubfolder=d}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(d){this._fontsSubfolder=
d}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(d){this._iconsSubfolder=d}GetIconsSubfolder(){return this._iconsSubfolder}_HasLocalUrlBlob(d){return this._localUrlBlobs.has(d.toLowerCase())}_GetLocalUrlBlob(d){return this._localUrlBlobs.get(d.toLowerCase())||null}GetLocalUrlAsBlobUrl(d){const g=this._GetLocalUrlBlob(d);if(!g)return d;d=this._localBlobUrlCache.get(g);d||(d=URL.createObjectURL(g),this._localBlobUrlCache.set(g,d));return d}FetchBlob(d,g){g=g||this._defaultLoadPolicy;
const k=this._GetLocalUrlBlob(d);if(k)return Promise.resolve(k);if(f.IsRelativeURL(d)){const m=d.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(m):"local"===g?this._promiseThrottle.Add(()=>f.FetchBlob(m)):f.FetchBlob(m)}return f.FetchBlob(d)}FetchArrayBuffer(d){const g=this._GetLocalUrlBlob(d);if(g)return f.BlobToArrayBuffer(g);if(f.IsRelativeURL(d)){const k=d.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(k):
"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>f.FetchArrayBuffer(k)):f.FetchArrayBuffer(k)}return f.FetchArrayBuffer(d)}FetchText(d){const g=this._GetLocalUrlBlob(d);if(g)return f.BlobToString(g);if(f.IsRelativeURL(d)){const k=d.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(k):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>f.FetchText(k)):f.FetchText(k)}return f.FetchText(d)}async FetchJson(d){d=await this.FetchText(d);
return JSON.parse(d)}_CordovaFetchLocalFileAs(d,g){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:d,as:g})}CordovaFetchLocalFileAsText(d){return this._CordovaFetchLocalFileAs(d,"text")}async CordovaFetchLocalFileAsBlob(d){const g=await this._CordovaFetchLocalFileAs(d,"buffer");d=e(d);return new Blob([g],{type:d})}async CordovaFetchLocalFileAsBlobURL(d){d=d.toLowerCase();var g=this._localBlobUrlCache.get(d);if(g)return g;g=await this.CordovaFetchLocalFileAsBlob(d);
g=URL.createObjectURL(g);this._localBlobUrlCache.set(d,g);return g}CordovaFetchLocalFileAsArrayBuffer(d){return this._CordovaFetchLocalFileAs(d,"buffer")}GetMediaFileUrl(d){return this._HasLocalUrlBlob(d)?this.GetLocalUrlAsBlobUrl(d):this._mediaSubfolder+d.toLowerCase()}GetProjectFileUrl(d,g=""){if(f.IsAbsoluteURL(d)){if(g)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(d)}return this._HasLocalUrlBlob(d)?Promise.resolve(this.GetLocalUrlAsBlobUrl(d)):this._isCordova&&
this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(g+d):Promise.resolve(g+d.toLowerCase())}LoadProjectFileUrl(d){return this.GetProjectFileUrl(d)}LoadImage(d){if(d.loadPolicy&&!b.has(d.loadPolicy))throw Error("invalid load policy");let g=this._assetsByUrl.get(d.url);if(g)return g;g=f.New(f.ImageAsset,this,{url:d.url,size:d.size||0,loadPolicy:d.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(g);this._assetsByUrl.set(g.GetURL(),g);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=
g.GetSize(),this._loadPromises.push(g.Load().then(()=>this._AddLoadedSize(g.GetSize()))));return g}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(d){console.error("Error loading: ",d),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(d){this._assetSizeLoaded+=d;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const d=
f.New(f.Event,"loadingprogress");this._lastLoadProgress=f.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);d.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(d)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(d){f.shallowAssignArray(this._webFonts,d);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"===typeof FontFace)return Promise.resolve();const d=[];for(const [g,k,m]of this._webFonts)this._totalAssetSizeToLoad+=
m,d.push(this._LoadWebFont(g,k).then(()=>this._AddLoadedSize(m)));return Promise.all(d)}async _LoadWebFont(d,g){try{const k=await this.GetProjectFileUrl(g,this._fontsSubfolder),m=new FontFace(d,`url('${k}')`);this._runtime.IsInWorker()?self.fonts.add(m):document.fonts.add(m);await m.load()}catch(k){console.warn(`[C3 runtime] Failed to load web font '${d}': `,k)}}IsAudioFormatSupported(d){return!!this._supportedAudioFormats[d]}_SetAudioFiles(d,g){this._preloadSounds=!!g;for(const [k,m,p]of d)this._audioFiles.set(k,
{fileName:k,formats:m.map(n=>({type:n[0],fileExtension:n[1],fullName:k+n[1],fileSize:n[2]})),isMusic:p})}GetPreferredAudioFile(d){d=this._audioFiles.get(d.toLowerCase());if(!d)return null;let g=null;for(const k of d.formats)if(g||"audio/webm; codecs=opus"!==k.type||(g=k),this.IsAudioFormatSupported(k.type))return k;return g}GetProjectAudioFileUrl(d){return(d=this.GetPreferredAudioFile(d))?{url:this.GetMediaFileUrl(d.fullName),type:d.type}:null}GetAudioToPreload(){if(this._preloadSounds){const d=[];
for(const g of this._audioFiles.values()){if(g.isMusic)continue;const k=this.GetPreferredAudioFile(g.fileName);k&&d.push({originalUrl:g.fileName,url:this.GetMediaFileUrl(k.fullName),type:k.type,fileSize:k.fileSize})}return d}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...d){d=await Promise.all(d.map(g=>this.GetProjectFileUrl(g)));this._runtime.IsInWorker()?importScripts(...d):await Promise.all(d.map(g=>c(g)))}async CompileWebAssembly(d){if(WebAssembly.compileStreaming)return d=
await this.GetProjectFileUrl(d),await WebAssembly.compileStreaming(fetch(d));d=await f.FetchArrayBuffer(d);return await WebAssembly.compile(d)}async LoadStyleSheet(d){d=await this.GetProjectFileUrl(d);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{url:d})}}}"use strict";
{const f=self.C3;f.Asset=class extends f.DefendedBase{constructor(b,a){super();this._assetManager=b;this._runtime=b.GetRuntime();this._url=a.url;this._size=a.size;this._loadPolicy=a.loadPolicy;this._blob=null;this._isLoaded=!1;this._loadPromise=null}Release(){this._blob=this._runtime=this._assetManager=this._loadPromise=null}GetURL(){return this._url}GetSize(){return this._size}Load(){return"local"===this._loadPolicy||this._blob?(this._isLoaded=!0,Promise.resolve()):this._loadPromise?this._loadPromise:
this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(b=>{this._isLoaded=!0;this._loadPromise=null;this._blob=b}).catch(b=>console.error("Error loading resource: ",b))}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._assetManager.FetchBlob(this._url,this._loadPolicy)}}}"use strict";
{const f=self.C3,b=new f.PromiseThrottle,a=new Set;f.ImageAsset=class extends f.Asset{constructor(e,c){super(e,c);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;a.add(this)}Release(){this.ReleaseTexture();if(0!==this._refCount)throw Error("released image asset which still has texture references");this._texturePromise=null;a.delete(this);super.Release()}static OnWebGLContextLost(){for(const e of a)e._texturePromise=null,e._webglTexture=null,e._refCount=
0}LoadStaticTexture(e,c){this._refCount++;return this._webglTexture?Promise.resolve(this._webglTexture):this._texturePromise?this._texturePromise:this._texturePromise=this.GetBlob().then(d=>b.Add(()=>e.CreateStaticTextureAsync(d,c).then(g=>{this._texturePromise=null;if(0===this._refCount)return e.DeleteTexture(g),null;this._webglTexture=g;this._imageWidth=g.GetWidth();this._imageHeight=g.GetHeight();return this._webglTexture}))).catch(d=>{console.error("Failed to load texture: ",d);throw d;})}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 e=await this.GetBlob();return f.Supports.ImageBitmapOptions?await createImageBitmap(e,{premultiplyAlpha:"none"}):f.Supports.ImageBitmap?await createImageBitmap(e):
await f.BlobToImage(e)}}}"use strict";
{const f=self.C3;function b(a,e){return a.GetWorldInfo()._GetLastCachedZIndex()-e.GetWorldInfo()._GetLastCachedZIndex()}f.RenderCell=class extends f.DefendedBase{constructor(a,e,c){super();this._grid=a;this._x=e;this._y=c;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){f.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){f.clearArray(this._instances);this._isSorted=!0;this._pendingRemoval.clear();this._isAnyPendingRemoval=
!1}SetChanged(){this._isSorted=!1}IsEmpty(){if(!this._instances.length)return!0;if(this._instances.length>this._pendingRemoval.size)return!1;this._FlushPending();return!0}Insert(a){this._pendingRemoval.has(a)?(this._pendingRemoval.delete(a),0===this._pendingRemoval.size&&(this._isAnyPendingRemoval=!1)):(this._instances.push(a),this._isSorted=1===this._instances.length)}Remove(a){this._pendingRemoval.add(a);this._isAnyPendingRemoval=!0;50<=this._pendingRemoval.size&&this._FlushPending()}_FlushPending(){this._isAnyPendingRemoval&&
(this._instances.length===this._pendingRemoval.size?this.Reset():(f.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1))}_EnsureSorted(){this._isSorted||(this._instances.sort(b),this._isSorted=!0)}Dump(a){this._FlushPending();this._EnsureSorted();this._instances.length&&a.push(this._instances)}}}"use strict";
{const f=self.C3;f.RenderGrid=class extends f.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=f.New(f.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,e){let c=this._cells.Get(b,a);return c?c:e?(c=f.New(f.RenderCell,this,b,a),this._cells.Set(b,a,c),c):null}XToCell(b){return Math.floor(b/this._cellWidth)}YToCell(b){return Math.floor(b/this._cellHeight)}Update(b,a,e){if(a)for(let c=a.getLeft(),d=a.getRight();c<=d;++c)for(let g=a.getTop(),k=
a.getBottom();g<=k;++g){if(e&&e.containsPoint(c,g))continue;const m=this.GetCell(c,g,!1);m&&(m.Remove(b),m.IsEmpty()&&this._cells.Delete(c,g))}if(e)for(let c=e.getLeft(),d=e.getRight();c<=d;++c)for(let g=e.getTop(),k=e.getBottom();g<=k;++g)a&&a.containsPoint(c,g)||this.GetCell(c,g,!0).Insert(b)}QueryRange(b,a){let e=this.XToCell(b.getLeft());const c=this.YToCell(b.getTop()),d=this.XToCell(b.getRight());for(b=this.YToCell(b.getBottom());e<=d;++e)for(let g=c;g<=b;++g){const k=this.GetCell(e,g,!1);k&&
k.Dump(a)}}MarkRangeChanged(b){let a=b.getLeft();const e=b.getTop(),c=b.getRight();for(b=b.getBottom();a<=c;++a)for(let d=e;d<=b;++d){const g=this.GetCell(a,d,!1);g&&g.SetChanged()}}}}"use strict";
{const f=self.C3,b=new f.Rect,a=new f.Quad,e=[],c=new f.Rect,d=new f.Rect,g=self.glMatrix.vec3,k=g.fromValues(0,1,0);function m(n,u){return n.GetWorldInfo()._GetLastCachedZIndex()-u.GetWorldInfo()._GetLastCachedZIndex()}function p(n,u){return n.GetWorldInfo().GetZElevation()-u.GetWorldInfo().GetZElevation()}f.Layer=class extends f.DefendedBase{constructor(n,u,q){super();this._layout=n;this._runtime=n.GetRuntime();this._name=q[0];this._index=u;this._sid=q[2];this._isVisible=!!q[3];this._backgroundColor=
f.New(f.Color);this._backgroundColor.setFromJSON(q[4].map(r=>r/255));this._isTransparent=!!q[5];this._parallaxX=q[6];this._parallaxY=q[7];this._color=f.New(f.Color,1,1,1,q[8]);this._premultipliedColor=f.New(f.Color);this._isForceOwnTexture=q[9];this._useRenderCells=q[10];this._scaleRate=q[11];this._blendMode=q[12];this._curRenderTarget=null;this._scale=1;this._zElevation=q[16];this._angle=0;this._isAngleEnabled=!0;this._viewport=f.New(f.Rect);this._viewportZ0=f.New(f.Rect);this._startupInitialInstances=
[];this._initialInstances=[];this._createdGlobalUids=[];this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;this._effectList=f.New(f.EffectList,this,q[15]);this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=f.New(f.Rect,0,0,-1,-1);this._curRenderCells=f.New(f.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this);this._UpdatePremultipliedColor();this._useRenderCells&&(this._renderGrid=f.New(f.RenderGrid,this._runtime.GetOriginalViewportWidth(),
this._runtime.GetOriginalViewportHeight()));for(const r of q[14])n=this._runtime.GetObjectClassByIndex(r[1]),this._layout._AddInitialObjectClass(n),n.GetDefaultInstanceData()||(n.SetDefaultInstanceData(r),n._SetDefaultLayerIndex(this._index)),this._initialInstances.push(r);f.shallowAssignArray(this._startupInitialInstances,this._initialInstances)}static Create(n,u,q){return f.New(f.Layer,n,u,q)}Release(){this._runtime=this._layout=null}CreateInitialInstances(n){const u=this._layout.IsFirstVisit();
let q=0;const r=this._initialInstances;for(let x=0,z=r.length;x<z;++x){var t=r[x];const D=this._runtime.GetObjectClassByIndex(t[1]);let G=!0;if(!D.HasPersistBehavior()||u)t=this._runtime.CreateInstanceFromData(t,this,!0),n.push(t),D.IsGlobal()&&(G=!1,this._createdGlobalUids.push(t.GetUID()));G&&(r[q]=r[x],++q)}f.truncateArray(r,q);this._runtime.FlushPendingInstances();this.SetZIndicesChanged()}_AddInstance(n,u){const q=n.GetWorldInfo();if(q.GetLayer()!==this)throw Error("instance added to wrong layer");
this._instances.push(n);0!==q.GetZElevation()&&(this._anyInstanceZElevated=!0);u&&this._useRenderCells&&n.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(n){this._instances.includes(n)||(this._instances.push(n),0!==n.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(n,u){const q=n.GetWorldInfo();if(q.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(n);0!==q.GetZElevation()&&
(this._anyInstanceZElevated=!0);this.SetZIndicesChanged();u&&this._useRenderCells&&n.GetWorldInfo().SetBboxChanged()}_RemoveInstance(n,u){const q=this._instances.indexOf(n);0>q||(u&&this._useRenderCells&&n.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(q,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(n){if(n){n=
new Set;for(var u of this._instances){var q=u.GetWorldInfo()._GetLastCachedZIndex();0<=q&&n.add(q)}u=-1;for(const r of this._instances)if(q=r.GetWorldInfo(),!(0<=q._GetLastCachedZIndex())){for(++u;n.has(u);)++u;q._SetZIndex(u)}}this._instances.sort(m)}_Start(){}_End(){for(const n of this._instances)n.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(n);this._runtime.FlushPendingInstances();f.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(n,
u,q,r){const t=this._runtime.GetEventSheetManager(),x=this._runtime.GetAllObjectClasses(),z=n.IsFamily(),D=[];for(const B of this._initialInstances){var G=B[0];if(u.containsPoint(G[0],G[1])){G=x[B[1]];if(G!==n)if(z){if(!n.FamilyHasMember(G))continue}else continue;G=this;var w=this._runtime.GetCurrentLayout();this.GetLayout()!==w&&((G=w.GetLayerByName(this.GetName()))||(G=w.GetLayerByIndex(this.GetIndex())));G=this._runtime.CreateInstanceFromData(B,G,!1);w=G.GetWorldInfo();w.OffsetXY(q,r);w.SetBboxChanged();
t.BlockFlushingInstances(!0);G._TriggerOnCreated();if(G.IsInContainer())for(const I of G.siblings())I._TriggerOnCreated();t.BlockFlushingInstances(!1);D.push(G)}}return D}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}UsesRenderCells(){return this._useRenderCells}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=
!1}IsVisible(){return this._isVisible}SetVisible(n){n=!!n;this._isVisible!==n&&(this._isVisible=n,this._runtime.UpdateRender())}GetViewport(){return this._viewport}GetViewportForZ(n,u){var q=this._viewportZ0;if(0===n)u.copy(q);else{const r=this.Get2DScaleFactorToZ(n);n=q.midX();const t=q.midY(),x=.5*q.width()/r;q=.5*q.height()/r;u.set(n-x,t-q,n+x,t+q)}}GetOpacity(){return this._color.getA()}SetOpacity(n){n=f.clamp(n,0,1);this._color.getA()!==n&&(this._color.setA(n),this._UpdatePremultipliedColor(),
this._runtime.UpdateRender())}_UpdatePremultipliedColor(){this._premultipliedColor.copy(this._color);this._premultipliedColor.premultiply()}GetPremultipliedColor(){return this._premultipliedColor}HasDefaultColor(){return this._color.equalsRgba(1,1,1,1)}GetScaleRate(){return this._scaleRate}SetScaleRate(n){this._scaleRate!==n&&(this._scaleRate=n,this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(n,u){if(this._parallaxX!==n||this._parallaxY!==
u)if(this._parallaxX=n,this._parallaxY=u,this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const q of this._instances)q.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(n){this.SetParallax(n,this.GetParallaxY())}SetParallaxY(n){this.SetParallax(this.GetParallaxX(),n)}SetZElevation(n){n=+n;this._zElevation!==n&&(this._zElevation=n,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(n){this._angle=f.clampAngle(n)}GetAngle(){return this._isAngleEnabled?
f.clampAngle(this._layout.GetAngle()+this._angle):0}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(n){this._isTransparent=!!n}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(n){this._isForceOwnTexture=!!n}SetBlendMode(n){this._blendMode!==n&&(this._blendMode=n,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}IsTransformCompatibleWith(n){return this===
n||this._parallaxX===n._parallaxX&&this._parallaxY===n._parallaxY&&this._scale===n._scale&&this._scaleRate===n._scaleRate&&this._angle===n._angle}_RemoveAllInstancesInSet(n){0!==n.size&&0<f.arrayRemoveAllInSet(this._instances,n)&&(this._MaybeResetAnyInstanceZElevatedFlag(),this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){this._instances.sort(p);if(this._useRenderCells)for(let n=0,u=this._instances.length;n<
u;++n){const q=this._instances[n].GetWorldInfo();q._SetZIndex(n);this._renderGrid.MarkRangeChanged(q.GetRenderCellRange())}else for(let n=0,u=this._instances.length;n<u;++n)this._instances[n].GetWorldInfo()._SetZIndex(n);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(n,u,q){var r=n.GetWorldInfo();u=u.GetWorldInfo();if(r.GetLayer()!==this||u.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");r=r.GetZIndex();u=u.GetZIndex();if(r===u+(q?1:-1))return!1;f.arrayRemove(this._instances,
r);r<u&&u--;q&&u++;u===this._instances.length?this._instances.push(n):this._instances.splice(u,0,n);this.SetZIndicesChanged();return!0}_MergeSortedZArrays(n,u){const q=[];let r=0,t=0,x=n.length,z=u.length;for(;r<x&&t<z;){const D=n[r],G=u[t];D.GetWorldInfo()._GetLastCachedZIndex()<G.GetWorldInfo()._GetLastCachedZIndex()?(q.push(D),++r):(q.push(G),++t)}for(;r<x;++r)q.push(n[r]);for(;t<z;++t)q.push(u[t]);return q}_MergeAllSortedZArrays_pass(n){const u=[],q=n.length;for(let r=0;r<q-1;r+=2)u.push(this._MergeSortedZArrays(n[r],
n[r+1]));1===q%2&&u.push(n[q-1]);return u}_MergeAllSortedZArrays(n){for(;1<n.length;)n=this._MergeAllSortedZArrays_pass(n);return n[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();f.clearArray(e);this._renderGrid.QueryRange(this._viewport,e);return e.length?1===e.length?e[0]:this._MergeAllSortedZArrays(e):[]}_IsOpaque(){return!this.UsesOwnTexture()&&!this.IsTransparent()}ShouldDraw(){return this.IsVisible()&&0<this.GetOpacity()&&(this.HasInstances()||!this.IsTransparent())}UsesOwnTexture(){return this.IsForceOwnTexture()||
!this.HasDefaultColor()||0!==this.GetBlendMode()||this._effectList.HasAnyActiveEffect()}GetRenderTarget(){return this._curRenderTarget}_CanFastPathDrawLayer(n){if(0===n.length)return!0;if(2<=n.length)return!1;n=n[0].GetShaderProgram();return!n.MustPreDraw()&&!n.UsesDest()&&!n.UsesCrossSampling()&&this.HasDefaultColor()}Get2DScaleFactorToZ(n){const u=this.GetCameraZ();return u/(u-n)}GetCameraZ(){return 100/this.GetNormalScale()}_SetTransform(n,u=0,q=0){const r=this._runtime.GetRenderScale();u=(this._viewport.midX()+
u)*r;q=(this._viewport.midY()+q)*r;const t=this.GetCameraZ();n.SetCameraXYZ(u,q,t);n.SetLookXYZ(u,q,t-100);u=this.GetAngle();0===u?g.set(k,0,1,0):g.set(k,Math.sin(u),Math.cos(u),0);n.ResetModelView(k);n.Scale(r,r);n.UpdateModelView()}Draw(n,u,q){const r=this._runtime.GetCanvasManager(),t=this.UsesOwnTexture();var x=null;let z=null;if(this._runtime.IsGPUProfiling()&&n.SupportsGPUProfiling()){const D=r.GetLayerTimingsBuffer(this);D&&(z=D.AddTimeElapsedQuery(),n.StartQuery(z))}t?(x={sampling:this._runtime.GetSampling()},
"low"===r.GetCurrentFullscreenScalingQuality()&&(x.width=r.GetDrawWidth(),x.height=r.GetDrawHeight()),x=this._runtime.GetAdditionalRenderTarget(x),n.SetRenderTarget(x),this.IsTransparent()&&n.ClearRgba(0,0,0,0)):n.SetRenderTarget(u);this.IsTransparent()||n.Clear(this._backgroundColor);this._curRenderTarget=x||u;this._SetTransform(n);n.SetBaseZ(this.GetZElevation());this.GetNormalScale()>Number.EPSILON&&(this._UpdateZIndices(),this._useRenderCells&&0===this.GetZElevation()&&!this._anyInstanceZElevated?
this._DrawInstances_RenderCells(n):this._DrawInstances(n,this._instances));n.SetBaseZ(0);n.SetCurrentZ(0);n.SetCameraXYZ(0,0,100);n.SetLookXYZ(0,0,0);t&&this._DrawLayerOwnTextureToRenderTarget(n,x,u,q);z&&n.EndQuery(z);this._curRenderTarget=null}_DrawInstances(n,u){const q=this._viewport,r=this._curRenderTarget;let t=null;for(let x=0,z=u.length;x<z;++x){const D=u[x];if(D===t)continue;t=D;const G=D.GetWorldInfo();G.IsVisible()&&G.IsInViewport(q)&&(G.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(D,
G,n,r):this._DrawInstance(D,G,n))}}_DrawInstances_RenderCells(n){var u=this._renderGrid;const q=this._curRenderCells,r=this._lastRenderCells,t=this._viewport;q.set(u.XToCell(t.getLeft()),u.YToCell(t.getTop()),u.XToCell(t.getRight()),u.YToCell(t.getBottom()));this._isRenderListUpToDate&&q.equals(r)?u=this._lastRenderList:(u=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,r.copy(q));this._DrawInstances(n,u);u!==this._lastRenderList&&f.shallowAssignArray(this._lastRenderList,u)}_DrawInstance(n,
u,q){u=u.GetRendererStateGroup();q.GetCurrentStateGroup()!==u&&u.Apply();n.Draw(q)}_DrawInstanceWithEffectsAndRestore(n,u,q,r){this._DrawInstanceWithEffects(n,u,q,r,null)&&this._SetTransform(q)}_DrawInstanceWithEffects(n,u,q,r,t){const x=u.GetInstanceEffectList().GetActiveEffectTypes();if(1===x.length){const z=x[0],D=z.GetShaderProgram();if(!D.NeedsPostDrawOrExtendsBox()&&u.HasDefaultColor()&&!n.MustPreDraw())return this._DrawInstanceWithEffects_FastPath(n,u,z,D,q),!1}n=f.RenderEffectChain(q,this._runtime,
n,r,x,t);q.SetBaseZ(this.GetZElevation());return n}_DrawInstanceWithEffects_FastPath(n,u,q,r,t){t.SetProgram(r);t.SetBlendMode(u.GetBlendMode());r.IsAnimated()&&this._runtime.UpdateRender();let x=0,z=0;if(r.UsesAnySrcRectOrPixelSize()){const [D,G]=n.GetCurrentSurfaceSize();x=1/D;z=1/G;(r=n.GetCurrentTexRect())?d.copy(r):d.set(0,0,0,0)}q=u.GetInstanceEffectList().GetEffectParametersForIndex(q.GetIndex());t.SetCurrentZ(u.GetZElevation());t.SetProgramParameters(null,c,d,d,u.GetBoundingBox(),x,z,this.GetOwnScale(),
this.GetAngle(),this._runtime.GetGameTime(),q);n.Draw(t)}_DrawLayerOwnTextureToRenderTarget(n,u,q,r){const t=this._effectList.GetActiveEffectTypes(),x=this._runtime;if(this._CanFastPathDrawLayer(t)){n.SetRenderTarget(q);if(1===t.length){var z=t[0];q=z.GetShaderProgram();n.SetProgram(q);d.set(0,0,1,1);z=this._effectList.GetEffectParametersForIndex(z.GetIndex());n.SetProgramParameters(null,c,d,d,this._viewport,1/x.GetDrawWidth(),1/x.GetDrawHeight(),this.GetNormalScale(),this.GetAngle(),x.GetGameTime(),
z);q.IsAnimated()&&x.UpdateRender()}else n.SetTextureFillMode();r&&0===this._blendMode&&this.HasDefaultColor()&&0===t.length?n.CopyRenderTarget(u):(n.SetBlendMode(this._blendMode),n.SetColor(this._premultipliedColor),n.DrawRenderTarget(u));n.InvalidateRenderTarget(u);x.ReleaseAdditionalRenderTarget(u)}else f.RenderEffectChain(n,x,this,q,t)}GetOwnScale(){return this._scale}SetOwnScale(n){this._scale!==n&&(this._scale=n,this._layout.BoundScrolling(),this._runtime.UpdateRender())}GetRenderScale(){return this.GetNormalScale()*
this._runtime.GetRenderScale()}GetDisplayScale(){return this.GetNormalScale()*this._runtime.GetDisplayScale()}GetNormalScale(){return(this._scale*this._layout.GetScale()-1)*this._scaleRate+1}UpdateViewport(){this._isAngleEnabled=!1;let [n,u]=this.CanvasCssToLayer(0,0);this._isAngleEnabled=!0;this._runtime.IsPixelRoundingEnabled()&&(n=Math.round(n),u=Math.round(u));var q=1/this.GetNormalScale();const r=this._viewportZ0;r.set(n,u,n+this._runtime.GetViewportWidth()*q,u+this._runtime.GetViewportHeight()*
q);q=this.GetAngle();0!==q&&(b.copy(r),b.offset(-r.midX(),-r.midY()),a.setFromRotatedRect(b,q),a.getBoundingBox(b),b.offset(r.midX(),r.midY()),r.copy(b));this.GetViewportForZ(this._zElevation,this._viewport)}CanvasCssToLayer(n,u,q=0){return this._CanvasToLayer(n,u,q,this.GetDisplayScale())}DrawSurfaceToLayer(n,u,q=0){return this._CanvasToLayer(n,u,q,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(n,u,q,r){var t=this._runtime.GetParallaxXOrigin(),x=this._runtime.GetParallaxYOrigin();
t=(this._layout.GetScrollX()-t)*this._parallaxX+t;x=(this._layout.GetScrollY()-x)*this._parallaxY+x;var z=this.GetNormalScale(),D=this._runtime.GetViewportWidth()/z;z=this._runtime.GetViewportHeight()/z;n=t-D/2+n/r;u=x-z/2+u/r;D=this.GetAngle();0!==D&&(n-=t,u-=x,r=Math.cos(D),D=Math.sin(D),z=n*r-u*D,u=u*r+n*D,n=z,n+=t,u+=x);0!==q&&(t=this._viewportZ0.midX(),x=this._viewportZ0.midY(),q=this.Get2DScaleFactorToZ(q),n=(n-t)/q+t,u=(u-x)/q+x);return[n,u]}CanvasCssToLayer_DefaultTransform(n,u){const q=this._scale,
r=this._scaleRate,t=this._parallaxX,x=this._parallaxY,z=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;n=this.CanvasCssToLayer(n,u);this._scale=q;this._scaleRate=r;this._parallaxX=t;this._parallaxY=x;this._angle=z;return n}LayerToCanvasCss(n,u,q=0){return this._LayerToCanvas(n,u,q,this.GetDisplayScale())}LayerToDrawSurface(n,u,q=0){return this._LayerToCanvas(n,u,q,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(n,u,q,r){var t=this._runtime,
x=this._layout;if(0!==q){var z=this._viewportZ0.midX(),D=this._viewportZ0.midY();q=this.Get2DScaleFactorToZ(q);n=(n-z)*q+z;u=(u-D)*q+D}z=t.GetParallaxXOrigin();D=t.GetParallaxYOrigin();z=(x.GetScrollX()-z)*this._parallaxX+z;x=(x.GetScrollY()-D)*this._parallaxY+D;q=this.GetAngle();if(0!==q){n-=z;u-=x;D=Math.cos(-q);q=Math.sin(-q);const G=n*D-u*q;u=u*D+n*q;n=G;n+=z;u+=x}q=this.GetNormalScale();D=t.GetViewportWidth()/q;t=t.GetViewportHeight()/q;return[(n-(z-D/2))*r,(u-(x-t/2))*r]}_GetLayerToDrawSurfaceScale(n,
u){n*=this.GetRenderScale()*this.GetDevicePixelRatio();0!==u&&(n*=this.Get2DScaleFactorToZ(u));return n}_SaveToJson(){return{s:this.GetOwnScale(),a:this.GetOwnAngle(),vl:this._viewport.getLeft(),vt:this._viewport.getTop(),vr:this._viewport.getRight(),vb:this._viewport.getBottom(),v:this.IsVisible(),bc:this._backgroundColor.toJSON(),t:this.IsTransparent(),px:this.GetParallaxX(),py:this.GetParallaxY(),c:this._color.toJSON(),sr:this.GetScaleRate(),fx:this._effectList.SaveToJson(),cg:this._createdGlobalUids}}_LoadFromJson(n){this._scale=
n.s;this._angle=n.a;this._viewport.set(n.vl,n.vt,n.vr,n.vb);this._isVisible=!!n.v;this._backgroundColor.setFromJSON(n.bc);this._isTransparent=!!n.t;this._parallaxX=n.px;this._parallaxY=n.py;this._color.setFromJSON(n.c);this._scaleRate=n.sr;f.shallowAssignArray(this._createdGlobalUids,n.cg);f.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const u=new Set(this._createdGlobalUids);let q=0;for(let r=0,t=this._initialInstances.length;r<t;++r)u.has(this._initialInstances[r][2])||
(this._initialInstances[q]=this._initialInstances[r],++q);f.truncateArray(this._initialInstances,q);this._effectList.LoadFromJson(n.fx);this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}}}"use strict";
{const f=self.C3,b=self.C3Debugger,a=f.New(f.Rect),e=f.New(f.Rect),c=f.New(f.Rect);f.Layout=class extends f.DefendedBase{constructor(d,g,k){super();this._layoutManager=d;this._runtime=d.GetRuntime();this._name=k[0];this._originalWidth=k[1];this._originalHeight=k[2];this._width=k[1];this._height=k[2];this._isUnboundedScrolling=!!k[3];this._eventSheetName=k[4];this._eventSheet=null;this._sid=k[5];this._index=g;this._scrollY=this._scrollX=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;
this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._initialNonWorld=[];this._layers=[];this._layersByName=new Map;this._layersBySid=new Map;this._effectList=f.New(f.EffectList,this,k[8]);this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=f.New(f.Event.Dispatcher);for(const m of k[6])d=f.Layer.Create(this,this._layers.length,m),this._layers.push(d),this._layersByName.set(d.GetName().toLowerCase(),
d),this._layersBySid.set(d.GetSID(),d);for(const m of k[7]){k=this._runtime.GetObjectClassByIndex(m[1]);if(!k)throw Error("missing nonworld object class");k.GetDefaultInstanceData()||k.SetDefaultInstanceData(m);this._initialNonWorld.push(m);this._AddInitialObjectClass(k)}}Release(){for(const d of this._layers)d.Release();f.clearArray(this._layers);this._textureLoadPendingPromises.clear();this._runtime=this._layoutManager=this._eventSheet=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetMinLayerScale(){let d=
this._layers[0].GetNormalScale();for(let g=1,k=this._layers.length;g<k;++g){const m=this._layers[g];if(0!==m.GetParallaxX()||0!==m.GetParallaxY())d=Math.min(d,m.GetNormalScale())}return d}SetScrollX(d){if(!this._isUnboundedScrolling){const g=this._runtime.GetViewportWidth()*(1/this.GetMinLayerScale())/2;d>this._width-g&&(d=this._width-g);d<g&&(d=g)}this._scrollX!==d&&(this._scrollX=d,this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(d){if(!this._isUnboundedScrolling){const g=
this._runtime.GetViewportHeight()*(1/this.GetMinLayerScale())/2;d>this._height-g&&(d=this._height-g);d<g&&(d=g)}this._scrollY!==d&&(this._scrollY=d,this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}BoundScrolling(){this.SetScrollX(this.GetScrollX());this.SetScrollY(this.GetScrollY())}GetScale(){return this._scale}SetScale(d){d=+d;this._scale!==d&&(this._scale=d,this.BoundScrolling())}SetAngle(d){this._angle=f.clampAngle(d)}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(d){!isFinite(d)||
1>d||(this._width=d)}GetHeight(){return this._height}SetHeight(d){!isFinite(d)||1>d||(this._height=d)}GetEventSheet(){return this._eventSheet}GetLayers(){return this._layers}GetLayerCount(){return this._layers.length}GetLayer(d){return"number"===typeof d?this.GetLayerByIndex(d):this.GetLayerByName(d.toString())}GetLayerByIndex(d){d=f.clamp(Math.floor(d),0,this._layers.length-1);return this._layers[d]}GetLayerByName(d){return this._layersByName.get(d.toLowerCase())||null}GetLayerBySID(d){return this._layersBySid.get(d)||
null}HasOpaqueBottomLayer(){for(const d of this._layers)if(d.ShouldDraw())return d._IsOpaque();return!1}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(d){if(d.IsInContainer())for(const g of d.GetContainer().GetObjectTypes())this._initialObjectClasses.add(g);else this._initialObjectClasses.add(d)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(d,g){if(d===this||!g)return Promise.resolve();d&&
(f.CopySet(this._textureLoadedTypes,d._textureLoadedTypes),d._textureLoadedTypes.clear());d=[];for(const k of this._initialObjectClasses)this._textureLoadedTypes.has(k)||(d.push(k.LoadTextures(g)),this._textureLoadedTypes.add(k));return Promise.all(d)}async MaybeLoadTexturesFor(d){if(d.IsFamily())throw Error("cannot load textures for family");var g=this._runtime.GetWebGLRenderer();!g||g.IsContextLost()||this._textureLoadedTypes.has(d)||(this._textureLoadedTypes.add(d),g=d.LoadTextures(g),this._AddPendingTextureLoadPromise(g),
await g,d.OnDynamicTextureLoadComplete(),this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(d){this._textureLoadPendingPromises.add(d);d.then(()=>this._textureLoadPendingPromises.delete(d)).catch(()=>this._textureLoadPendingPromises.delete(d))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(d){if(d.IsFamily()||0<d.GetInstanceCount())throw Error("cannot unload textures");const g=this._runtime.GetWebGLRenderer();g&&this._textureLoadedTypes.has(d)&&
(this._textureLoadedTypes.delete(d),d.ReleaseTextures(g))}_Unload(d,g){if(d!==this&&g)for(const k of this._textureLoadedTypes)k.IsGlobal()||d._initialObjectClasses.has(k)||(k.ReleaseTextures(),this._textureLoadedTypes.delete(k))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(d){const g=this._runtime,k=this._layoutManager,m=g.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=m.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());
k._SetMainRunningLayout(this);this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=g.GetOriginalViewportWidth()/2;this._scrollY=g.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(d);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();k.ClearPendingChangeLayout();
g.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);const p=this._runtime.GetCreatePromises();await Promise.all(p);f.clearArray(p);if(g.IsLoadingState())g._TriggerOnCreateAfterLoad(this._createdInstances);else for(const n of this._createdInstances)n._TriggerOnCreated(),n.SetupInitialSceneGraphConnections();f.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(n=>n.PreloadTexturesWithInstances(this._runtime.GetWebGLRenderer())));d&&(g.Dispatcher().dispatchEvent(new f.Event("beforefirstlayoutstart")),
await g.DispatchUserScriptEventAsyncWait(new f.Event("beforeprojectstart")));await this.DispatchUserScriptEventAsyncWait(new f.Event("beforelayoutstart"));g.IsLoadingState()||await g.TriggerAsync(f.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new f.Event("afterlayoutstart"));d&&(g.Dispatcher().dispatchEvent(new f.Event("afterfirstlayoutstart")),await g.DispatchUserScriptEventAsyncWait(new f.Event("afterprojectstart")));m._RunQueuedTriggers(k);await this.WaitForPendingTextureLoadsToComplete();
this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(d){for(const k of this._runtime.GetAllObjectClasses())if(!k.IsFamily()&&k.IsWorldType())for(const m of k.GetInstances()){const p=m.GetWorldInfo();var g=p.GetLayer();g=f.clamp(g.GetIndex(),0,this._layers.length-1);g=this._layers[g];p._SetLayer(g);g._MaybeAddInstance(m)}if(!d)for(const k of this._layers)k._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const d of this._layers)d.CreateInitialInstances(this._createdInstances),d.UpdateViewport(),
d._Start()}_CreatePersistedInstances(){let d=!1;for(const [k,m]of Object.entries(this._persistData)){const p=this._runtime.GetObjectClassBySID(parseInt(k,10));if(p&&!p.IsFamily()&&p.HasPersistBehavior()){for(const n of m){var g=null;if(p.IsWorldType()&&(g=this.GetLayerBySID(n.w.l),!g))continue;g=this._runtime.CreateInstanceFromData(p,g,!1,0,0,!0);g.LoadFromJson(n);d=!0;this._createdInstances.push(g)}f.clearArray(m)}}for(const k of this._layers)k._SortInstancesByLastCachedZIndex(!0),k.SetZIndicesChanged();
d&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(d){for(const k of d){if(!k.IsInContainer())continue;const m=k.GetWorldInfo(),p=k.GetIID();for(const n of k.GetObjectClass().GetContainer().objectTypes())if(n!==k.GetObjectClass()){var g=n.GetInstances();g.length>p?k._AddSibling(g[p]):(g=m?this._runtime.CreateInstanceFromData(n,m.GetLayer(),!0,m.GetX(),m.GetY(),!0):this._runtime.CreateInstanceFromData(n,null,!0,0,0,!0),this._runtime.FlushPendingInstances(),
n._UpdateIIDs(),k._AddSibling(g),d.push(g))}}}_CreateInitialNonWorldInstances(){for(const d of this._initialNonWorld)this._runtime.GetObjectClassByIndex(d[1]).IsInContainer()||this._runtime.CreateInstanceFromData(d,null,!0)}_CreateGlobalNonWorlds(){const d=[],g=this._initialNonWorld;let k=0;for(let m=0,p=g.length;m<p;++m){const n=g[m],u=this._runtime.GetObjectClassByIndex(n[1]);u.IsGlobal()?u.IsInContainer()&&u.GetContainer().HasAnyWorldType()||d.push(this._runtime.CreateInstanceFromData(n,null,!0)):
(g[k]=n,++k)}f.truncateArray(g,k);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(d)}RecreateInitialObjects(d,g,k,m,p){if(k)return k.RecreateInitialObjects(d,g,m,p);k=[];for(const n of this._layers)k.push(n.RecreateInitialObjects(d,g,m,p));return k.flat()}async _StopRunning(){const d=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(f.Plugins.System.Cnds.OnLayoutEnd,null,null);d.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();
this._isFirstVisit||this._SavePersistData();for(const g of this._layers)g._End();for(const g of this._runtime.GetAllObjectClasses())if(!(g.IsGlobal()||g.IsWorldType()||g.GetPlugin().IsSingleGlobal()||g.IsFamily())){for(const k of g.GetInstances())this._runtime.DestroyInstance(k);this._runtime.FlushPendingInstances()}d.SetIsEndingLayout(!1);d.GetMainRunningLayout()===this&&d._SetMainRunningLayout(null)}_SaveInstanceToPersist(d){const g=d.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(g)||
(this._persistData[g]=[]);this._persistData[g].push(d.SaveToJson())}_SavePersistData(){for(const d of this._layers){d._UpdateZIndices();for(const g of d._GetInstances()){const k=g.GetObjectClass();!k.IsGlobal()&&k.HasPersistBehavior()&&this._SaveInstanceToPersist(g)}}}ResetPersistData(){this._persistData={};this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){return"low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()||this._runtime.UsesAnyBackgroundBlending()||
"low-latency"===this._runtime.GetCompositingMode()||this._effectList.HasAnyActiveEffect()}_CanFastPathDrawLayout(d){return 0===d.length?!0:2<=d.length?!1:!d[0].GetShaderProgram().MustPreDraw()}Draw(d){var g=this._runtime.GetCanvasManager();const k=this.UsesOwnTexture();var m=null;k?("low-latency"!==this._runtime.GetCompositingMode()&&(d.SetRenderTarget(null),d.ClearRgba(0,0,0,0)),m={sampling:this._runtime.GetSampling(),readback:this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()},
"low"===g.GetCurrentFullscreenScalingQuality()&&(m.width=g.GetDrawWidth(),m.height=g.GetDrawHeight()),m=this._runtime.GetAdditionalRenderTarget(m),d.SetRenderTarget(m)):d.SetRenderTarget(null);this.HasOpaqueBottomLayer()||d.ClearRgba(0,0,0,0);this._curRenderTarget=m;g=!0;for(const p of this._layers)p.UpdateViewport(),p.ShouldDraw()&&(p.Draw(d,m,g),g=!1);k&&this._DrawLayoutOwnTextureToRenderTarget(d,m);this._curRenderTarget=null}_DrawLayoutOwnTextureToRenderTarget(d,g){const k=this._effectList.GetActiveEffectTypes(),
m=this._runtime;if(this._CanFastPathDrawLayout(k)){d.SetRenderTarget(null);if(1===k.length){var p=k[0];const n=p.GetShaderProgram();d.SetProgram(n);e.set(0,0,1,1);c.set(0,0,m.GetViewportWidth(),m.GetViewportHeight());p=this._effectList.GetEffectParametersForIndex(p.GetIndex());d.SetProgramParameters(null,a,e,e,c,1/m.GetDrawWidth(),1/m.GetDrawHeight(),this.GetScale(),this.GetAngle(),m.GetGameTime(),p);n.IsAnimated()&&m.UpdateRender()}else d.SetTextureFillMode();0===k.length?d.CopyRenderTarget(g):(d.SetAlphaBlend(),
d.ResetColor(),d.DrawRenderTarget(g));d.InvalidateRenderTarget(g);m.ReleaseAdditionalRenderTarget(g)}else f.RenderEffectChain(d,m,this,null,k)}_SaveToJson(){const d={sx:this.GetScrollX(),sy:this.GetScrollY(),s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(),layers:{}};for(const g of this._layers)d.layers[g.GetSID().toString()]=g._SaveToJson();return d}_LoadFromJson(d){this._scrollX=d.sx;this._scrollY=
d.sy;this._scale=d.s;this._angle=d.a;this._width=d.w;this._height=d.h;this._isFirstVisit=!!d.fv;this._persistData=d.persist;this._effectList.LoadFromJson(d.fx);for(const [g,k]of Object.entries(d.layers))d=parseInt(g,10),(d=this.GetLayerBySID(d))&&d._LoadFromJson(k)}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(d){d.layout=this.GetILayout();var g=this._runtime;(g=g.IsDebug()&&!g.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();
this._userScriptDispatcher.dispatchEvent(d);g&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(d){d.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(d)}}}"use strict";
{const f=self.C3;f.LayoutManager=class extends f.DefendedBase{constructor(b){super();this._runtime=b;this._allLayouts=[];this._layoutsByName=new Map;this._layoutsBySid=new Map;this._mainRunningLayout=null;this._runningSubLayouts=[];this._firstLayout=null;this._isEndingLayout=0;this._pendingChangeLayout=null}Release(){this._pendingChangeLayout=this._firstLayout=this._mainRunningLayout=this._runtime=null;f.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear();f.clearArray(this._runningSubLayouts)}Create(b){b=
f.New(f.Layout,this,this._allLayouts.length,b);this._allLayouts.push(b);this._layoutsByName.set(b.GetName().toLowerCase(),b);this._layoutsBySid.set(b.GetSID(),b)}GetRuntime(){return this._runtime}SetFirstLayout(b){this._firstLayout=b}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw Error("no first layout");}GetLayoutByName(b){return this._layoutsByName.get(b.toLowerCase())||null}GetLayoutBySID(b){return this._layoutsBySid.get(b)||
null}GetLayoutByIndex(b){b=f.clamp(Math.floor(b),0,this._allLayouts.length-1);return this._allLayouts[b]}GetLayout(b){return"number"===typeof b?this.GetLayoutByIndex(b):this.GetLayoutByName(b.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(b){this._mainRunningLayout=b}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(b){if(this._runningSubLayouts.includes(b))throw Error("layout already running");this._runningSubLayouts.push(b)}_RemoveRunningSubLayout(b){b=
this._runningSubLayouts.indexOf(b);if(-1===b)throw Error("layout not running");this._runningSubLayouts.splice(b,1)}*runningLayouts(){this._mainRunningLayout&&(yield this._mainRunningLayout);this._runningSubLayouts.length&&(yield*this._runningSubLayouts)}IsLayoutRunning(b){return this._mainRunningLayout===b||this._runningSubLayouts.includes(b)}SetIsEndingLayout(b){if(b)this._isEndingLayout++;else{if(0>=this._isEndingLayout)throw Error("already unset");this._isEndingLayout--}}IsEndingLayout(){return 0<
this._isEndingLayout}ChangeMainLayout(b){this._pendingChangeLayout=b}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}}}"use strict";
{const f=self.C3;class b{constructor(){this.runtime=this.renderer=null;this.surfaceHeight=this.surfaceWidth=this.drawHeight=this.drawWidth=0;this.layoutRect=new f.Rect;this.rcTexBounce=new f.Rect;this.rcTexDest=new f.Rect;this.rcTexOrigin=new f.Rect;this.screenRect=new f.Rect;this.clearRect=new f.Rect;this.srcRect=new f.Rect;this.fxTex=[null,null];this.fxIndex=0;this.otherFxIndex=1;this.layerAngle=this.layerScale=this.boxExtendVertical=this.boxExtendHorizontal=0;this.renderTarget=this.wi=this.inst=
this.layer=this.layout=null;this.didChangeTransform=this.postDraw=this.preDraw=!1;this.opts=null}Clear(){this.opts=this.renderTarget=this.wi=this.inst=this.layer=this.layout=this.runtime=this.renderer=null}ShouldPreDraw(t){t=t.GetShaderProgram();if(t.MustPreDraw())return!0;if(this.inst)return t.UsesDest()&&(0!==this.wi.GetAngle()||0>this.wi.GetWidth()||0>this.wi.GetHeight())||0!==this.boxExtendHorizontal||0!==this.boxExtendVertical||!this.wi.HasDefaultColor()||this.inst.MustPreDraw();if(this.layer)return!this.layer.HasDefaultColor()}ShouldPostDraw(t){t=
t.GetShaderProgram();return t.UsesDest()||t.UsesCrossSampling()||this.layout&&"low"===this.runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()}GetEffectRenderTarget(t){if(0!==t&&1!==t)throw Error("invalid effect target");const x=this.fxTex;if(!x[t]){var z=this.runtime;const D=z.GetCanvasManager();z={sampling:z.GetSampling()};"low"===D.GetCurrentFullscreenScalingQuality()&&(z.width=D.GetDrawWidth(),z.height=D.GetDrawHeight());x[t]=D.GetAdditionalRenderTarget(z)}return x[t]}ReleaseEffectRenderTargets(){const t=
this.fxTex,x=this.runtime.GetCanvasManager();t[0]&&(x.ReleaseAdditionalRenderTarget(t[0]),t[0]=null);t[1]&&(x.ReleaseAdditionalRenderTarget(t[1]),t[1]=null)}}const a=[];let e=0;function c(){e===a.length&&a.push(new b);return a[e++]}function d(t){t.ReleaseEffectRenderTargets();t.Clear();e--}const g=new f.Quad;let k=!1;async function m(t,x,z){x=await f.Gfx.WebGLRenderTarget.DebugReadPixelsToBlob(x,z);x=URL.createObjectURL(x);console.log("[FX] "+t+" "+(z?"":" [to display]")+": ",x)}f.RenderEffectChain=
function(t,x,z,D,G,w){const B=c();B.renderer=t;B.runtime=x;if(z instanceof f.Instance)B.inst=z,B.wi=B.inst.GetWorldInfo();else if(z instanceof f.Layer)B.layer=z;else if(z instanceof f.Layout)B.layout=z;else throw Error("invalid effects object");z=x.GetCanvasManager();B.renderTarget=D;B.drawWidth=z.GetDrawWidth();B.drawHeight=z.GetDrawHeight();B.surfaceWidth=B.drawWidth;B.surfaceHeight=B.drawHeight;B.fxIndex=0;B.otherFxIndex=1;B.boxExtendHorizontal=0;B.boxExtendVertical=0;B.screenRect.set(0,0,B.drawWidth,
B.drawHeight);B.clearRect.set(0,0,B.drawWidth,B.drawHeight);B.didChangeTransform=!1;B.opts=w;B.inst?(D=B.wi,B.layerScale=D.GetLayer().GetRenderScale(),B.layerAngle=D.GetLayer().GetAngle(),B.layoutRect.copy(D.GetBoundingBox())):B.layer?(D=B.layer,B.layerScale=D.GetRenderScale(),B.layerAngle=D.GetAngle(),B.layoutRect.copy(D.GetViewport())):(D=B.layout,B.layerScale=D.GetScale(),B.layerAngle=D.GetAngle(),B.layoutRect.set(0,0,B.drawWidth,B.drawHeight));B.inst?p(B,G):(B.rcTexBounce.set(0,0,B.drawWidth/
B.surfaceWidth,B.drawHeight/B.surfaceHeight),B.rcTexDest.copy(B.rcTexBounce),B.rcTexOrigin.copy(B.rcTexBounce),B.rcTexBounce.swapTopBottom(),B.rcTexDest.swapTopBottom(),B.rcTexOrigin.swapTopBottom());t.SetAlphaBlend();t.ResetColor();t.SetBaseZ(0);t.SetCurrentZ(0);B.preDraw=B.ShouldPreDraw(G[0]);B.preDraw&&n(B);t.ResetColor();D=G.length-1;B.postDraw=B.ShouldPostDraw(G[D]);for(let I=0,P=G.length;I<P;++I)w=G[I],z=w.GetShaderProgram(),t.SetProgram(z),z.IsAnimated()&&x.UpdateRender(),0!==I||B.preDraw?
(t.SetCopyBlend(),q(B,w,I===D&&!B.postDraw,I)):u(B,w),0===B.fxIndex?(B.fxIndex=1,B.otherFxIndex=0):(B.fxIndex=0,B.otherFxIndex=1);B.postDraw&&r(B,G);t=B.didChangeTransform;d(B);k=!1;return t};function p(t,x){for(let J=0,O=x.length;J<O;++J){var z=x[J].GetShaderProgram();t.boxExtendHorizontal+=z.GetBoxExtendHorizontal();t.boxExtendVertical+=z.GetBoxExtendVertical()}var D=t.wi;x=D.GetLayer();z=x.GetAngle();var G=D.GetBoundingBox();D=D.GetTotalZElevation();let [w,B]=x.LayerToDrawSurface(G.getLeft(),G.getTop(),
D),[I,P]=x.LayerToDrawSurface(G.getRight(),G.getBottom(),D);if(0!==z){const [J,O]=x.LayerToDrawSurface(G.getRight(),G.getTop(),D),[R,T]=x.LayerToDrawSurface(G.getLeft(),G.getBottom(),D);x=Math.min(w,I,J,R);I=Math.max(w,I,J,R);w=x;x=Math.min(B,P,O,T);P=Math.max(B,P,O,T);B=x}x=t.screenRect;z=t.rcTexOrigin;G=t.rcTexDest;D=t.clearRect;const E=t.rcTexBounce;x.set(w,B,I,P);x.shuntY(t.drawHeight);z.copy(x);z.divide(t.surfaceWidth,t.surfaceHeight);z.swapTopBottom();x.inflate(t.boxExtendHorizontal,t.boxExtendVertical);
G.copy(x);G.divide(t.surfaceWidth,t.surfaceHeight);G.swapTopBottom();D.copy(x);D.roundOuter();D.inflate(t.boxExtendHorizontal+1,t.boxExtendVertical+1);x.clamp(0,0,t.drawWidth,t.drawHeight);D.clamp(0,0,t.drawWidth,t.drawHeight);E.copy(x);E.divide(t.surfaceWidth,t.surfaceHeight);E.swapTopBottom()}function n(t){const x=t.renderer;x.SetTextureFillMode();const z=t.GetEffectRenderTarget(t.fxIndex);x.SetRenderTarget(z);var D=t.opts;D&&D.preTransform&&D.preTransform();x.ClearRect2(t.clearRect);t.inst?(x.SetColor(t.wi.GetPremultipliedColor()),
x.SetCurrentZ(t.wi.GetTotalZElevation()),t.inst.Draw(x),x.SetCurrentZ(0)):(D=(t.layer||t.layout).GetRenderTarget(),t.layer?x.SetColor(t.layer.GetPremultipliedColor()):x.ResetColor(),x.DrawRenderTarget(D),x.InvalidateRenderTarget(D),t.runtime.GetCanvasManager().ReleaseAdditionalRenderTarget(D));t.rcTexDest.clampFlipped(0,1,1,0);t.fxIndex=1;t.otherFxIndex=0;k&&m("Pre-draw",x,z)}function u(t,x){const z=t.renderer,D=t.runtime,G=t.GetEffectRenderTarget(t.fxIndex);z.SetRenderTarget(G);var w=t.opts;w&&w.preTransform&&
w.preTransform();z.ClearRect2(t.clearRect);if(t.inst){const [B,I]=t.inst.GetCurrentSurfaceSize();(w=t.inst.GetCurrentTexRect())?t.srcRect.copy(w):t.srcRect.set(0,0,0,0);x=t.wi.GetInstanceEffectList().GetEffectParametersForIndex(x.GetIndex());z.SetProgramParameters(t.renderTarget,t.rcTexDest,t.srcRect,t.srcRect,t.layoutRect,1/B,1/I,t.layerScale,t.layerAngle,D.GetGameTime(),x);z.SetCurrentZ(t.wi.GetTotalZElevation());t.inst.Draw(z);z.SetCurrentZ(0);t.rcTexDest.clampFlipped(0,1,1,0);t.screenRect.shuntY(t.drawHeight)}else x=
(t.layer||t.layout).GetEffectList().GetEffectParametersForIndex(x.GetIndex()),z.SetProgramParameters(t.renderTarget,t.rcTexDest,t.rcTexBounce,t.rcTexOrigin,t.layoutRect,1/t.drawWidth,1/t.drawHeight,t.layerScale,t.layerAngle,D.GetGameTime(),x),t=(t.layer||t.layout).GetRenderTarget(),k&&m("Layer target",z,t),z.DrawRenderTarget(t),z.InvalidateRenderTarget(t),D.GetCanvasManager().ReleaseAdditionalRenderTarget(t);k&&m("First bounce",z,G)}function q(t,x,z,D){const G=t.renderer,w=t.runtime;0===D&&t.preDraw&&
t.inst&&t.screenRect.shuntY(t.drawHeight);z?(t.inst?G.SetBlendMode(t.wi.GetBlendMode()):t.layer&&G.SetBlendMode(t.layer.GetBlendMode()),z=t.renderTarget,G.SetRenderTarget(z)):(z=t.GetEffectRenderTarget(t.fxIndex),G.SetRenderTarget(z),G.ClearRect2(t.clearRect));x=t.inst?t.wi.GetInstanceEffectList().GetEffectParametersForIndex(x.GetIndex()):(t.layer||t.layout).GetEffectList().GetEffectParametersForIndex(x.GetIndex());G.SetProgramParameters(t.renderTarget,t.rcTexDest,t.rcTexBounce,t.rcTexOrigin,t.layoutRect,
1/t.surfaceWidth,1/t.surfaceHeight,t.layerScale,t.layerAngle,w.GetGameTime(),x);x=t.GetEffectRenderTarget(t.otherFxIndex);G.SetTexture(x.GetTexture());w.GetCanvasManager().SetDeviceTransform(G);t.didChangeTransform=!0;g.setFromRect(t.screenRect);G.Quad3(g,t.rcTexBounce);t.inst||G.InvalidateRenderTarget(x);k&&m("Bounce "+D,G,z)}function r(t,x){x=t.renderer;if(t.layout)x.SetTextureFillMode(),x.SetRenderTarget(t.renderTarget),t=t.GetEffectRenderTarget(t.otherFxIndex),x.CopyRenderTarget(t),x.InvalidateRenderTarget(t);
else{var z=t.runtime.GetCanvasManager();"low"===z.GetCurrentFullscreenScalingQuality()?(x.SetTextureFillMode(),z.SetDeviceTransform(x,z.GetDrawWidth(),z.GetDrawHeight()),t.didChangeTransform=!0):x.SetDeviceTransformTextureFillMode();t.inst?x.SetBlendMode(t.wi.GetBlendMode()):t.layer&&x.SetBlendMode(t.layer.GetBlendMode());x.SetRenderTarget(t.renderTarget);z=t.GetEffectRenderTarget(t.otherFxIndex);x.SetTexture(z.GetTexture());g.setFromRect(t.screenRect);x.Quad3(g,t.rcTexBounce);t.inst||x.InvalidateRenderTarget(z);
k&&m("Post-draw",x,t.renderTarget)}}}"use strict";
{const f=self.C3,b=/<(.+?)>/g;f.TimelineManager=class extends f.DefendedBase{constructor(a){super();this._runtime=a;this._timelineDataManager=f.New(f.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._isTickingTimelines=this._changingLayout=this._hasRuntimeListeners=!1;this._tickFunc=()=>this._OnTick();this._tick2Func=
()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=e=>this._OnInstanceDestroy(e.instance);this._afterLoad=e=>this._OnAfterLoad();this._destroyedWhileLoadingState=[]}Release(){this.RemoveRuntimeListeners();this._afterLoad=this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const a of this._timelines)a.Stop(),a.Release();f.clearArray(this._timelines);
this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;f.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;f.clearArray(this._playingTimelines);this._playingTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._timelinesCreatedByTemplate=null;f.clearArray(this._destroyedWhileLoadingState);this._runtime=this._destroyedWhileLoadingState=
null}AddRuntimeListeners(){const a=this._runtime.Dispatcher();a.addEventListener("pretick",this._tickFunc);a.addEventListener("tick2",this._tick2Func);a.addEventListener("beforelayoutchange",this._beforeLayoutChange);a.addEventListener("layoutchange",this._layoutChange);a.addEventListener("instancedestroy",this._instanceDestroy);a.addEventListener("afterload",this._afterLoad)}RemoveRuntimeListeners(){const a=this._runtime.Dispatcher();a.removeEventListener("pretick",this._tickFunc);a.removeEventListener("tick2",
this._tick2Func);a.removeEventListener("beforelayoutchange",this._beforeLayoutChange);a.removeEventListener("layoutchange",this._layoutChange);a.removeEventListener("instancedestroy",this._instanceDestroy);a.removeEventListener("afterload",this._afterLoad)}Create(a){this._timelineDataManager.Add(a);a=f.TimelineState.CreateInitial(a,this);this.Add(a);this.SetTimelineObjectClassesToMap(a);this._timelinesCreatedByTemplate.set(a.GetName(),0)}CreateFromTemplate(a){var e=this.GetTimelineDataManager();a=
a.GetTemplateName();e=e.Get(a);e=f.TimelineState.CreateFromTemplate(`${a}:${this._timelinesCreatedByTemplate.get(a)}`,e,this);this._IncreaseTemplateTimelinesCount(a);this.Add(e);return e}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const e=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(e)}}_ClearCreatedTemplateTimelinesCount(){for(const a of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(a,
0)}Add(a){this._timelines.push(a);this._timelinesByName.set(a.GetName().toLowerCase(),a)}Remove(a){a.IsTemplate()||(f.arrayFindRemove(this._timelines,a),f.arrayFindRemove(this._scheduledTimelines,a),f.arrayFindRemove(this._playingTimelines,a),this._timelinesByName.delete(a.GetName().toLowerCase()),this.RemoveTimelineFromObjectClassMap(a),a.IsReleased()||a.Release())}Trigger(a){this._runtime.Trigger(a,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(a){this._pluginInstance=
a}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const a of this._timelines)yield a}SetTimelineObjectClassToMap(a,e){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set);this._objectClassToTimelineMap.get(a).add(e)}SetTimelineObjectClassesToMap(a){for(const e of a.GetObjectClasses())this.SetTimelineObjectClassToMap(e,a)}RemoveTimelineFromObjectClassMap(a){for(const [e,c]of this._objectClassToTimelineMap.entries())c.has(a)&&(c.delete(a),0===c.size&&
this._objectClassToTimelineMap.delete(e))}GetTimelinesForObjectClass(a){if(this._objectClassToTimelineMap.has(a))return this._objectClassToTimelineMap.get(a)}GetTimelineOfTemplateForInstances(a,e){if(e)for(const c of this._timelines)if(e.every(d=>c.HasTrackInstance(d.instance,d.trackId))&&c.GetName().includes(a.GetName()))return c}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const e of this._scheduledTimelines)if(e.GetName()===
a)return e;for(const e of this._playingTimelines)if(e.GetName()===a)return e;return null}*GetTimelinesByName(a){if(b.test(a)){b.lastIndex=0;let c;var e=new Set;do if(c=b.exec(a)){const d=c[1].split(",");for(const g of d)e.add(g)}while(c);for(const d of e.values())(a=this.GetTimelineByName(d))&&(yield a);e.clear()}else(e=this.GetTimelineByName(a))&&(yield e)}*GetTimelinesByTags(a){for(const e of this._timelines)e.HasTags(a)&&(yield e)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a);
this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){f.arrayFindRemove(this._playingTimelines,a);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(a){this._playingTimelines.includes(a)?(a.SetPlaying(!0),a.SetScheduled(!1),a.SetMarkedForRemoval(!1)):(a.SetPlaying(!1),a.SetScheduled(!0),a.SetMarkedForRemoval(!1),this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a));this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.ResolvePlayPromise();
f.arrayFindRemove(this._scheduledTimelines,a);this._MaybeDisableRuntimeListeners()}CompleteTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!0)}CompleteTimelineAndResolve(a){this.CompleteTimeline(a);a.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var a=!1;for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var e=this._scheduledTimelines.pop();e.SetInitialState();this._playingTimelines.push(e)}e=
this._runtime.GetDt();var c=this._runtime.GetTimeScale();for(const d of this._playingTimelines){if(d.IsMarkedForRemoval())continue;const g=d.Tick(e,c);!a&&g&&(a=!0)}this._isTickingTimelines=!1;a&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var a;for(const e of this._playingTimelines)e.IsMarkedForRemoval()&&(a||(a=new Set),this._MaybeExecuteTimelineFinishTriggers(e),a.add(e));a&&f.arrayRemoveAllInSet(this._playingTimelines,
a);this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(a){a.IsReleased()||a.HasValidTracks()&&a.IsComplete()&&a.InitialStateSet()&&a.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._playingTimelines.length||this._scheduledTimelines.length||this._isTickingTimelines||(this._hasRuntimeListeners=!1)}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop());
const a=new Set;for(const e of this._playingTimelines)e._OnBeforeChangeLayout()&&a.add(e);f.arrayRemoveAllInSet(this._playingTimelines,a);this._MaybeDisableRuntimeListeners();for(const e of this._timelines)e.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(a){var e=a.GetObjectClass();if(e=this.GetTimelinesForObjectClass(e))if(this._runtime.IsLoadingState())this._destroyedWhileLoadingState.push(a);else for(const c of e)c.IsTemplate()||(c.IsReleased()?this.Remove(c):c.HasValidTracks()||
(this._MaybeExecuteTimelineFinishTriggers(c),this.Remove(c)))}_OnAfterLoad(){for(const a of this._destroyedWhileLoadingState)this._OnInstanceDestroy(a);f.clearArray(this._destroyedWhileLoadingState)}_SaveToJson(){return{timelinesJson:this._SaveTimelinesToJson(),scheduledTimelinesJson:this._SaveScheduledTimelinesToJson(),playingTimelinesJson:this._SavePlayingTimelinesToJson(),hasRuntimeListeners:this._hasRuntimeListeners,changingLayout:this._changingLayout,isTickingTimelines:this._isTickingTimelines}}_LoadFromJson(a){a&&
(this._ClearCreatedTemplateTimelinesCount(),this._LoadTimelinesFromJson(a.timelinesJson),this._LoadScheduledTimelinesFromJson(a.scheduledTimelinesJson),this._LoadPlayingTimelinesFromJson(a.playingTimelinesJson),this._hasRuntimeListeners=!a.hasRuntimeListeners,this._changingLayout=!!a.changingLayout,this._isTickingTimelines=!!a.isTickingTimelines,this._SetCreatedTemplateTimelinesCount(),this._MaybeEnableRuntimeListeners(),this._MaybeDisableRuntimeListeners())}_SaveTimelinesToJson(){return this._timelines.map(a=>
a._SaveToJson())}_LoadTimelinesFromJson(a){for(const e of a){a=this.GetTimelineByName(e.name);if(!a){a=this._GetTemplateNameFromJson(e);if(!a)continue;a=this.GetTimelineByName(a);a=this.CreateFromTemplate(a)}a._LoadFromJson(e);a.HasTracks()||this.Remove(a)}}_GetTemplateNameFromJson(a){return(a=a.name.split(":"))&&2===a.length?a[0]:null}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(a){this._LoadTimelines(a,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(a){this._LoadTimelines(a,
this._playingTimelines)}_IsTimelineInJson(a,e){for(const c of e)if(c===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map(e=>e.GetName())}_LoadTimelines(a,e){var c=new Set;for(const d of e)this._IsTimelineInJson(d,a)||c.add(d);f.arrayRemoveAllInSet(e,c);c=d=>g=>g.GetName()===d;for(const d of a)(a=this.GetTimelineByName(d))&&(e.find(c(d))||e.push(a))}}}"use strict";
{const f=self.C3;f.TimelineState=class extends f.DefendedBase{constructor(b,a,e){super();this._runtime=e.GetRuntime();this._timelineManager=e;this._timelineDataItem=a;this._name=b;this._tracks=[];for(const c of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(f.TrackState.Create(this,c));this._playResolve=this._playPromise=null;this._playheadTime=f.New(f.KahanSum);this._playheadTime.Set(0);this._playbackRate=1;this._pingPongState=0;this._currentRepeatCount=1;this._initialStateSet=
this._isScheduled=this._isPlaying=!1;this._complete=!0;this._markedForRemoval=this._released=!1;this._completedTick=-1;this._firstTick=this._finishedTriggers=this._isTemplate=this._implicitPause=!1;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=!1}static CreateInitial(b,a){var e=a.GetTimelineDataManager();const c=e.GetNameId();e=e.Get(b[c]);b=f.New(f.TimelineState,b[c],e,a);b.SetIsTemplate(!0);return b}static CreateFromTemplate(b,a,e){return f.New(f.TimelineState,b,a,e)}static get WORLD_INSTANCE_BOX_CHANGE(){return 1}static get LAYOUT_RENDER_CHANGE(){return f.nextHighestPowerOfTwo(1)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this);
this._timelineManager.CompleteTimelineAndResolve(this);for(const b of this._tracks)b.Release();f.clearArray(this._tracks);this._tracks=null;this._playheadTime.Release();this._timelineDataItem=this._timelineManager=this._runtime=this._playheadTime=null;this._released=!0;this._playResolve=this._playPromise=null}}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(b,a,e){const c=[];for(const d of this._tracks){if(b!==
d.GetInstance())continue;const g=d.GetPropertyTrack(e);g&&a.constructor===g.GetSourceAdapter().constructor&&c.push(g)}return c}HasTracks(){return!!this._tracks.length}GetTrackById(b){for(const a of this._tracks)if(f.equalsNoCase(a.GetId(),b))return a;return null}SetName(b){this._name=b}GetName(){return this._name}GetTimelineDataItem(){return this._timelineDataItem}GetTemplateName(){return this._timelineDataItem.GetName()}GetTotalTime(){return this._timelineDataItem.GetTotalTime()}SetTotalTime(b){this._timelineDataItem.SetTotalTime(b)}GetStep(){return this._timelineDataItem.GetStep()}SetStep(b){this._timelineDataItem.SetStep(b)}GetInterpolationMode(){return this._timelineDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._timelineDataItem.SetInterpolationMode(b)}GetResultMode(){return this._timelineDataItem.GetResultMode()}SetResultMode(b){this._timelineDataItem.GetResultMode(b)}SetEase(b){for(const a of this.GetTracks())a.SetEase(b)}GetLoop(){return this._timelineDataItem.GetLoop()}SetLoop(b){return this._timelineDataItem.SetLoop(b)}GetPingPong(){return this._timelineDataItem.GetPingPong()}SetPingPong(b){return this._timelineDataItem.SetPingPong(b)}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(b){return this._playbackRate=
b}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return this.IsPlaying()?0<this._playbackRate:!0}GetPlayPromise(){return this._playPromise?this._playPromise:this._playPromise=new Promise(b=>{this._playResolve=b})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(b){this._tags=f.TimelineState._GetTagArray(b);this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){this._tagsChanged&&(this._stringTags=this._tags.join(" "));
this._tagsChanged=!1;return this._stringTags}HasTags(b){return this._tags&&this._tags.length?(b=f.TimelineState._GetTagArray(b))&&b.length?b.every(f.TimelineState._HasTag,this):!1:!1}OnStarted(){f.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnAnyTimelineStarted);
f.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,f.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnAnyTimelineFinished),
f.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(b){this._isPlaying=b}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(b=!1){return this.IsCompletedTick()||this.IsScheduled()&&!b?!0:this._isPlaying}_IsPlaying(){return this.IsPlaying(!0)}IsPaused(){return this._IsPaused()}_IsPaused(){return this.IsReleased()||this.IsScheduled()||this._IsPlaying()||this.IsComplete()?!1:!0}SetScheduled(b){this._isScheduled=b}IsScheduled(){return this._isScheduled}SetComplete(b){this._complete=
b;b=this.GetTime();if(0>=b||b>=this.GetTotalTime())this._complete=!0}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(b){this._markedForRemoval=b}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(b){this._implicitPause=b}IsImplicitPause(){return this._implicitPause}SetIsTemplate(b){this._isTemplate=!!b}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime.Get()}SetTime(b){const a=
this.GetTime();this._SetTime(b);this.SetComplete(!1);this.IsComplete()||this.SetImplicitPause(!0);if(this._IsPlaying()||this.IsScheduled()||!this._initialStateSet)this._IsPlaying()||this.IsScheduled()||this._initialStateSet?this._IsPlaying()?this.Stop():this.IsScheduled()&&(this._timelineManager.DeScheduleTimeline(this),this.SetInitialStateFromSetTime()):this.SetInitialStateFromSetTime();this._Interpolate(b,!1,!0,!0,a)&&this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(b){0>b?this._playheadTime.Set(0):
b>=this.GetTotalTime()?this._playheadTime.Set(this.GetTotalTime()):this._playheadTime.Set(b)}_OnSetTime(){f.Plugins.Timeline&&this.constructor===f.TimelineState&&(f.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(f.Plugins.Timeline.Cnds.OnTimeSetByTags),f.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}_CanResume(){if(!this.GetLoop())if(this.GetPingPong()&&
1===this._pingPongState)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else{if(0>=this.GetTime())return!1}else if(!this.GetLoop()&&!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else if(0>=this.GetTime())return!1;return!0}Resume(){this.IsReleased()||this._CanResume()&&this.Play(!0)}Play(b=!1){return this.IsReleased()||this.IsScheduled()?!1:this._IsPlaying()&&this.IsCompletedTick()?this._SchedulePlayingTimeline():this._IsPlaying()||
!this.IsComplete()&&!b&&!this.IsImplicitPause()?!1:this._ScheduleStoppedTimeline()}_SchedulePlayingTimeline(){this.SetImplicitPause(!1);this._timelineManager.RemovePlayingTimeline(this);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}_ScheduleStoppedTimeline(){this.SetImplicitPause(!1);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}Stop(b=!1){this.IsReleased()||(this.SetComplete(b),this._timelineManager.CompleteTimeline(this),this.IsComplete()&&
this.ResolvePlayPromise())}Reset(b=!0,a=!1){if(!this.IsReleased()){if(!this._IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(!this.IsComplete()){this.Stop(!0);this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());var e=this.GetTime();a=a?this._InterpolateBeforeChangeLayout(e):this._Interpolate(e,!1,!1,!0);b&&this._OnSetTime();a&&b&&this.GetRuntime().UpdateRender()}}}ResetBeforeChangeLayout(){this.Reset(!1,!0)}_InterpolateBeforeChangeLayout(b){this._Interpolate(b,
!1,!1,!0,NaN,!1,!0)}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(this.HasValidGlobalTracks())return!1;this._timelineManager.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(b){if(!this.IsMarkedForRemoval())if(b){this._firstTick=this._initialStateSet=!0;for(const a of this._tracks)a.SetInitialState()}else if(this.SetPlaying(!0),this.SetScheduled(!1),this.OnStarted(),this.IsComplete()){this._completedTick=
-1;this._pingPongState=0;this._currentRepeatCount=1;this._finishedTriggers=this._complete=!1;this._firstTick=this._initialStateSet=!0;this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());for(const a of this._tracks)a.SetInitialState()}else{this._firstTick=!0;for(const a of this._tracks)a.SetResumeState()}}Tick(b,a){if(0!==b||0!==this._lastDelta){this._lastDelta=b;var e=this.GetTime();this._SetTime(e+b*a*this._playbackRate);var c;this.GetLoop()||this.GetPingPong()?this.GetLoop()&&
!this.GetPingPong()?c=this._LoopCompleteCheck():!this.GetLoop()&&this.GetPingPong()?c=this._PingPongCompleteCheck():this.GetLoop()&&this.GetPingPong()&&(c=this._LoopPingPongCompleteCheck()):c=this._SimpleCompleteCheck();if(c){for(const d of this._tracks)d.SetEndState();this.Stop(!0);this.OnCompleted();return!0}return this._Interpolate(this.GetTime(),!0,!1,!1,e,!0)}}_Interpolate(b,a=!1,e=!1,c=!1,d=NaN,g=!1,k=!1){let m=!1;for(var p of this._tracks)p.BeforeInterpolate();for(const n of this._tracks){p=
b;if("number"===typeof d){const u=this.GetTime()-n.GetStartOffset(),q=d-n.GetStartOffset();0>u&&0<q&&(p=n.GetStartOffset(),this._SetTime(p))}p=n.Interpolate(p,a,e,c,this._firstTick,k);!m&&p&&(m=!0)}for(const n of this._tracks)n.AfterInterpolate();this._firstTick&&g&&(this._firstTick=!1);return m}_SimpleCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(0);else return this._SetTime(this.GetTotalTime()),
!0}else if(0>=this.GetTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(this.GetTotalTime());else return this._SetTime(0),!0;return!1}_LoopCompleteCheck(){this.IsForwardPlayBack()?this.GetTime()>=this.GetTotalTime()&&this._SetTime(0):0>=this.GetTime()&&this._SetTime(this.GetTotalTime());return!1}_PingPongCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate()),
1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1)}else if(0>=this.GetTime())if(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1);return!1}_LoopPingPongCompleteCheck(){this.IsForwardPlayBack()?
this.GetTime()>=this.GetTotalTime()&&(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this.GetTime()&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()));return!1}AddTrack(){var b=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();b=f.TrackState.Create(this,b);this._tracks.push(b);return b}CleanCaches(){for(const b of this._tracks)b.CleanCaches()}ClearTrackInstances(){for(const b of this._tracks)b.ClearInstance()}SetTrackInstance(b,
a){if(a)for(const e of this._tracks){if(b){if(e.GetId()!==b)continue}else if(e.HasInstance())continue;e.SetInstance(a);this._timelineManager.SetTimelineObjectClassToMap(a.GetObjectClass(),this);break}}HasTrackInstance(b,a){for(const e of this._tracks)if(a){if(a===e.GetId()&&b===e.GetInstance())return!0}else if(b===e.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some(b=>b.CanInstanceBeValid())}HasValidGlobalTracks(){return this._tracks.some(b=>b.CanInstanceBeValid()?(b=b.GetObjectClass())?
b.IsGlobal():!1:!1)}GetPropertyTrack(b){for(const a of this.GetTracks())for(const e of a.GetPropertyTracks())if(e.GetPropertyName()===b)return e}GetKeyframeWithTags(b){b=b?b.split(" "):[];b=[...(new Set(b.map(a=>a.toLowerCase().trim()))).values()];for(const a of this.GetTracks())for(const e of a.GetKeyframeDataItems())if(b.every(c=>e.HasTag(c)))return e}GetObjectClasses(){const b=[];for(const a of this.GetTracks())b.push(a.GetObjectClass());return b.filter(a=>a)}_SaveToJson(){return{tracksJson:this._SaveTracksToJson(),
name:this._name,playheadTime:this.GetTime(),playbackRate:this._playbackRate,pingPongState:this._pingPongState,currentRepeatCount:this._currentRepeatCount,isPlaying:this._isPlaying,isScheduled:this._isScheduled,initialStateSet:this._initialStateSet,finishedTriggers:this._finishedTriggers,complete:this._complete,released:this._released,markedForRemoval:this._markedForRemoval,completedTick:this._completedTick,implicitPause:this._implicitPause,isTemplate:this._isTemplate,tags:this._tags.join(" "),stringTags:this._stringTags,
tagsChanged:this._tagsChanged,firstTick:this._firstTick}}_LoadFromJson(b){b&&(this._LoadTracksFromJson(b.tracksJson),this._name=b.name,this._playheadTime.Set(b.playheadTime),this._playbackRate=b.playbackRate,this._pingPongState=b.pingPongState,this._currentRepeatCount=b.currentRepeatCount,this._isPlaying=!!b.isPlaying,this._isScheduled=!!b.isScheduled,this._initialStateSet=!!b.initialStateSet,this._finishedTriggers=b.hasOwnProperty("finishedTriggers")?!!b.finishedTriggers:!1,this._complete=!!b.complete,
this._released=!!b.released,this._markedForRemoval=!!b.markedForRemoval,this._completedTick=b.completedTick,this._implicitPause=!!b.implicitPause,this._isTemplate=!!b.isTemplate,this._tags=b.tags.split(" "),this._stringTags=b.stringTags,this._tagsChanged=!!b.tagsChanged,this._firstTick=!!b.firstTick)}_SaveTracksToJson(){return this._tracks.map(b=>b._SaveToJson())}_LoadTracksFromJson(b){b.forEach((a,e)=>{this._tracks[e]._LoadFromJson(a)});this._tracks.filter(a=>a.CanInstanceBeValid())}static _HasTag(b){const a=
this.GetTags();return""===b?1===a.length&&""===a[0]:a.includes(b)}static _GetTagArray(b){if(f.IsArray(b))return b.slice(0);if(f.IsString(b))return b.split(" ")}}}"use strict";
{const f=self.C3;f.TrackState=class extends f.DefendedBase{constructor(b,a){super();this._timeline=b;this._trackDataItem=a;this._trackData=a.GetTrackData();this._objectClassIndex=this._instanceUid=NaN;this._worldInfo=this._instance=null;this._isNested=0<a.GetStartOffset();this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();this._propertyTracks=[];for(const e of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(f.PropertyTrackState.Create(this,
e))}static Create(b,a){return f.New(f.TrackState,b,a)}Release(){this._keyframeDataItems=null;for(const b of this._propertyTracks)b.Release();f.clearArray(this._propertyTracks);this._lastKeyframeDataItem=this._trackDataItem=this._worldInfo=this._instance=this._timeline=this._propertyTracks=null}CleanCaches(){for(const b of this._propertyTracks)b.CleanCaches();this._worldInfo=this._instance=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){return this._keyframeDataItems?
this._keyframeDataItems:this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(b){for(const a of this._propertyTracks)if(a.GetPropertyName()===b)return a}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){var b=this.GetInstanceUID();return(b=this.GetRuntime().GetInstanceByUID(b))?!b.IsDestroyed():!1}GetObjectClass(){const b=
this.GetObjectClassIndex();if(-1!==b)return this.GetRuntime().GetObjectClassByIndex(b)}ClearInstance(){this._instance=null;this._instanceUid=-1;this._worldInfo=null;this._objectClassIndex=-1}HasInstance(){return!!this._instance}GetInstance(){if(this._instance&&this.IsInstanceValid())return this._instance;const b=this.GetInstanceUID();return this._instance=this.GetRuntime().GetInstanceByUID(b)}SetInstance(b){if(this._instance!==b){this.CleanCaches();this._instance=b;this._objectClassIndex=b.GetObjectClass().GetIndex();
this._instanceUid=b.GetUID();this._worldInfo=b.GetWorldInfo();for(const g of this.propertyTrackItems()){const k=g.sourceAdapter;switch(g.propertyTrack.GetSourceAdapterId()){case "instance-variable":k.GetEditorIndex();var a=b.GetObjectClass(),e=a.GetInstanceVariableIndexByName(g.name),c=a.GetInstanceVariableName(e);a=a.GetInstanceVariableType(e);c===g.name&&a===g.type&&k.UpdateInstanceVariableIndex(e);break;case "behavior":var d=g.behaviorType;e=this.GetObjectClass();c=b.GetObjectClass();a=k.GetBehaviorType(c);
d&&a&&(d=d.GetName(),e.GetBehaviorIndexByName(d),c.GetBehaviorIndexByName(d),k.GetEditorIndex(),k.UpdateBehaviorTypeSid(a.GetSID()))}}}}*propertyTrackItems(){for(const e of this._propertyTracks){var b=e.GetSourceAdapter(),a=this.GetObjectClass();const c={propertyTrack:e,sourceAdapter:b};switch(e.GetSourceAdapterId()){case "world-instance":c.property=e.GetPropertyName();break;case "instance-variable":b=b.GetEditorIndex();c.name=a.GetInstanceVariableName(b);c.type=a.GetInstanceVariableType(b);break;
case "effect":a=a.GetEffectList();b=b.GetEffectType(a);c.effectType=b;break;case "behavior":b=b.GetBehaviorType(a);c.behaviorType=b;break;case "plugin":c.plugin=a.GetPlugin()}yield c}}GetWorldInfo(){if(this._worldInfo&&this.IsInstanceValid())return this._worldInfo;const b=this.GetInstance();b&&(this._worldInfo=b.GetWorldInfo());return this._worldInfo}GetTrackDataItem(){return this._trackDataItem}GetInstanceUID(){return this._instanceUid?this._instanceUid:this._trackDataItem.GetInstanceUID()}SetInstanceUID(b){this._trackDataItem.SetInstanceUID(b)}GetInterpolationMode(){return this._trackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._trackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._trackDataItem.GetResultMode()}GetId(){return this._trackDataItem.GetId()}GetStartOffset(){return this._trackDataItem.GetStartOffset()}GetLocalTotalTime(){return this._trackDataItem.GetLocalTotalTime()}SetResultMode(b){this._trackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetKeyframeDataItems())a.SetEase(b);
for(const a of this.GetPropertyTracks())a.SetEase(b)}GetEnable(){return this._trackDataItem.GetEnable()}SetEnable(b){this._trackDataItem.SetEnable(b)}GetObjectClassIndex(){return isNaN(this._objectClassIndex)?this._trackDataItem.GetObjectClassIndex():this._objectClassIndex}SetObjectClassIndex(b){this._trackDataItem.SetObjectClassIndex(b)}SetOriginalWidth(b){this._trackDataItem.SetOriginalWidth(b)}GetOriginalWidth(){return this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(b){this._trackDataItem.SetOriginalHeight(b)}GetOriginalHeight(){return this._trackDataItem.GetOriginalHeight()}SetInitialState(){this.MaybeGetInstance();
if(this.IsInstanceValid()){for(var b of this._propertyTracks)b.SetInitialState();b=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(b);this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(b)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()){this._timeline.IsForwardPlayBack();var b=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(b);
for(const a of this._propertyTracks)a.SetResumeState()}}SetEndState(){if(!this.GetTimeline().IsComplete()&&(this.MaybeGetInstance(),this.IsInstanceValid()&&!this._isNested)){const b=this._timeline.GetTime(),a=this.GetStartOffset()+this.GetLocalTotalTime();b>=a?this.Interpolate(this.GetLocalTotalTime(),!0,!1,!0):0>=b&&this.Interpolate(0,!0,!1,!0)}}BeforeInterpolate(){for(const b of this._propertyTracks)b.BeforeInterpolate()}Interpolate(b,a=!1,e=!1,c=!1,d=!1,g=!1){this.MaybeGetInstance();if(!this.IsInstanceValid()||
g&&this.GetObjectClass().IsGlobal())return!1;b-=this.GetStartOffset();if(0>b)return!1;this.MaybeSetInitialStateOfNestedTrack(b,a);this.MaybeTriggerKeyframeReachedConditions(b,a,d);d=g=!1;for(const k of this._propertyTracks){const m=k.Interpolate(b,e,!1,c);g||0===(m&f.TimelineState.WORLD_INSTANCE_BOX_CHANGE)||(g=!0);d||0===(m&f.TimelineState.LAYOUT_RENDER_CHANGE)||(d=!0)}this.MaybeSetEndStateOfNestedTrack(b,a);g&&(b=this.GetWorldInfo())&&b.SetBboxChanged();return d}AfterInterpolate(){for(const b of this._propertyTracks)b.AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(b,
a){if(a&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>b)return;for(const e of this._propertyTracks)e.Interpolate(0,!1,!1,!0)}else{if(b>this.GetLocalTotalTime())return;for(const e of this._propertyTracks)e.Interpolate(this.GetLocalTotalTime(),!1,!1,!0)}for(const e of this._propertyTracks)e.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(b>=
this.GetLocalTotalTime()){for(const e of this._propertyTracks)e.Interpolate(this.GetLocalTotalTime(),!1,!1,!0);this._endStateOfNestedSet=!0}}else if(0>=b){for(const e of this._propertyTracks)e.Interpolate(0,!1,!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(b,a,e){if(!e&&a)return b=this.GetLastKeyFrameBeforeTime(b),b!==this._lastKeyframeDataItem&&this.OnKeyframeReached(b),this._lastKeyframeDataItem=b}GetLastKeyFrameBeforeTime(b){const a=this.GetTimeline();let e=this._trackData.GetKeyFrameDataItemAtTime(b,
this._trackDataItem);return e?e:a.IsForwardPlayBack()?this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem):this._trackData.GetFirstKeyFrameDataItemHigherOrEqualThan(b,this._trackDataItem)}OnKeyframeReached(b){if(f.Plugins.Timeline&&this.GetTimeline().constructor===f.TimelineState){var a=this.GetTimeline();f.Plugins.Timeline.Cnds.SetTriggerTimeline(a);f.Plugins.Timeline.Cnds.SetTriggerKeyframe(b);b=a.GetTimelineManager();b.Trigger(f.Plugins.Timeline.Cnds.OnAnyKeyframeReached);
b.Trigger(f.Plugins.Timeline.Cnds.OnKeyframeReached);f.Plugins.Timeline.Cnds.SetTriggerTimeline(null);f.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var b=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=f.PropertyTrackState.Create(this,b);this._propertyTracks.push(b);return b}DeleteKeyframes(b){this._trackDataItem.GetKeyframeData().DeleteKeyframeDataItems(b)}DeletePropertyKeyframes(b){for(const a of this._propertyTracks)a.DeletePropertyKeyframes(b)}SaveState(){for(const b of this._propertyTracks)b.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();
if(this.IsInstanceValid())for(const b of this._propertyTracks)b.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();if(this.IsInstanceValid()){var b=!1;for(const a of this._propertyTracks){const e=a.CompareSaveStateWithCurrent();!b&&e&&(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,e)=>{this._propertyTracks[e]._LoadFromJson(a)})}_LoadInstanceFromJson(b){if(f.IsFiniteNumber(b)&&(b=this.GetRuntime().GetInstanceByUID(b))){var a=this.GetTimeline();
a.ClearTrackInstances();a.SetTrackInstance(this._trackDataItem.GetId(),b)}}_LoadLastKeyframeDataItemFromJson(b){this._lastKeyframeDataItem=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemFromIndex(b)}}}"use strict";
{const f=self.C3;f.PropertyTrackState=class extends f.DefendedBase{constructor(b,a){super();this._track=b;this._propertyTrackDataItem=a;this._propertyTrackData=a.GetPropertyTrackData();this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}static Create(b,a){return f.New(f.PropertyTrackState,b,a)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=
null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;let b;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":b=
new f.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":b=new f.PropertyTrackState.EffectSourceAdapter(this);break;case "instance-variable":b=new f.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":b=new f.PropertyTrackState.PluginSourceAdapter(this);break;case "world-instance":b=new f.PropertyTrackState.WorldInstanceSourceAdapter(this);break;case "value":b=new f.PropertyTrackState.ValueSourceAdapter(this)}return this._sourceAdapter=b}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(b){this._propertyTrackDataItem.SetSourceAdapterId(b)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(b){this._propertyTrackDataItem.SetSourceAdapterArguments(b)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(b){this._propertyTrackDataItem.SetProperty(b)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(b){this._propertyTrackDataItem.SetType(b)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(b){this._propertyTrackDataItem.SetMin(b)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(b){this._propertyTrackDataItem.SetMax(b)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(b){this._propertyTrackDataItem.SetEnable(b)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._propertyTrackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(b){this._propertyTrackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetPropertyKeyframeDataItems())a.SetEase(b)}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems?
this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const b of this.GetPropertyKeyframeDataItems())yield b.GetValueWithResultMode()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(){this.GetSourceAdapter().SetInitialState()}SetResumeState(){this.GetSourceAdapter().SetResumeState()}BeforeInterpolate(){this.GetSourceAdapter().BeforeInterpolate()}Interpolate(b,
a=!1,e=!1,c=!1){var d=this._propertyTrackDataItem;let g=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(b,d);g?d=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(b,d):(g=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,d),d=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,d));return this.GetSourceAdapter().Interpolate(b,g,d,a,e,c)}AfterInterpolate(){this.GetSourceAdapter().AfterInterpolate()}static GetStartPropertyKeyframeForTime(b,
a){const e=a.GetPropertyTrackDataItem();a=a._propertyTrackData;let c=a.GetPropertyKeyFrameDataItemAtTime(b,e);c||(c=a.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,e));return c}static GetEndPropertyKeyframeForTime(b,a){const e=a.GetPropertyTrackDataItem();a=a._propertyTrackData;return a.GetPropertyKeyFrameDataItemAtTime(b,e)?a.GetFirstPropertyKeyFrameDataItemHigherThan(b,e):a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,e)}AddPropertyKeyframe(){return this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem()}DeletePropertyKeyframes(b){this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){if(this.GetSourceAdapter().CompareInitialStateWithCurrent()){const b=
this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),a=this.GetSourceAdapter().GetCurrentState();b.SetAbsoluteValue(a)}}CompareSaveStateWithCurrent(){const b=this.GetSourceAdapter().CompareSaveStateWithCurrent();b&&this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return b}AddPropertyKeyframeAtCurrentTime(){const b=this.GetTimeline().GetTime(),a=this.GetSourceAdapter(),e=f.PropertyTrackState.GetStartPropertyKeyframeForTime(b,this),c=
this.AddPropertyKeyframe();c.SetType(e.GetType());c.SetTime(b);c.SetEase(e.GetEase());c.SetEnable(!0);c.SetValue(a.GetValueAtTime());c.SetAbsoluteValue(a.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson)}}}"use strict";
{const f=self.C3.PropertyTrackState;f.PropertySourceAdapter=class{constructor(b){this._propertyTrack=b;this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}GetPropertyTrack(){return this._propertyTrack}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter?this._propertyAdapter:this._propertyAdapter=this._CreatePropertyAdapter()}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this.GetPropertyAdapter().BeforeChangeProperty()}Interpolate(b,
a,e,c,d,g){const k=f.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack)(b,a,e,this._propertyTrack);return d?k:this.GetPropertyAdapter().ChangeProperty(b,k,a,e,c,g)}AfterInterpolate(){this.GetPropertyAdapter().AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){return f.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_CreatePropertyAdapter(){const b=
this._propertyTrack.GetPropertyType();switch(this._propertyTrack.GetPropertyKeyframeType()){case "combo":case "boolean":case "text":case "string":return new f.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===b?new f.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new f.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new f.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(b){b&&
this.GetPropertyAdapter()._LoadFromJson(b.propertyAdapterJson)}static GetValueAtTime(b){const a=b.GetTrack().GetTimeline().GetTime(),e=f.GetStartPropertyKeyframeForTime(a,b),c=f.GetEndPropertyKeyframeForTime(a,b);return f.PropertySourceAdapter.GetInterpolateFunc(b)(a,e,c,b)}static GetValue(b,a,e){let c=b.GetResultMode();"combo"===b.GetPropertyType()&&(c="absolute");switch(c){case "relative":return a+e;case "absolute":return e}}static GetInterpolateFunc(b){switch(b.GetPropertyKeyframeType()){case "numeric":return f.NumericTypeAdapter.Interpolate;
case "angle":return f.AngleTypeAdapter.Interpolate;case "boolean":return f.BooleanTypeAdapter.Interpolate;case "color":return f.ColorTypeAdapter.Interpolate;case "text":return f.TextTypeAdapter.Interpolate}}static GetWillChangeFunc(b){switch(b.GetPropertyKeyframeType()){case "numeric":return f.NumericTypeAdapter.WillChange;case "angle":return f.AngleTypeAdapter.WillChange;case "boolean":return f.BooleanTypeAdapter.WillChange;case "color":return f.ColorTypeAdapter.WillChange;case "text":return f.TextTypeAdapter.WillChange}}}}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}}f.PropertyTrackState.WorldInstanceSourceAdapter=b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetIndex(){return this._updatedIndex?this._updatedIndex:super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._updatedIndex=a)}Interpolate(a,
e,c,d,g,k){if(this.GetPropertyAdapter().CanChange(e.GetValue()))return super.Interpolate(a,e,c,d,g,k)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a.index)}}f.PropertyTrackState.InstanceVariableSourceAdapter=b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var a=this._propertyTrack.GetPropertyTrackDataItem(),e=this._propertyTrack.GetTrack();a=this._sid?this._sid:a.GetSourceAdapterArguments()[0];e=e.GetInstance();a=e.GetBehaviorIndexBySID(a);return e.GetBehaviorInstances()[a].GetSdkInstance()}GetBehaviorType(a){const e=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];
return a.GetBehaviorTypeByName(e)}UpdateBehaviorTypeSid(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._sid=a)}Interpolate(a,e,c,d,g,k){const m=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(m.GetObjectClass()))return super.Interpolate(a,e,c,d,g,k)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._sid=a.sid)}}f.PropertyTrackState.BehaviorSourceAdapter=b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var e=a.GetEffectList();e=this.GetEffectType(e).GetIndex();return a.IsEffectIndexActive(e)?a.GetEffectParametersForIndex(e):null}GetEffectType(a){const e=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];
return a.GetEffectTypeByName(e)}Interpolate(a,e,c,d,g,k){if(this._IsEffectActive())return super.Interpolate(a,e,c,d,g,k)}_IsEffectActive(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var e=a.GetEffectList();if(e=this.GetEffectType(e))return e=e.GetIndex(),a.IsEffectIndexActive(e)}}f.PropertyTrackState.EffectSourceAdapter=b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(a,e,c,d,g,k){var m=this._propertyTrack.GetTrack();const p=m.GetObjectClass().GetPlugin();m=m.GetInstance().GetObjectClass().GetPlugin();if(p===m)return super.Interpolate(a,e,c,d,g,k)}}f.PropertyTrackState.PluginSourceAdapter=
b}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._value=0;this._init=!1}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let e=this._propertyTrack.GetPropertyTrackDataItem();e=a.GetFirstPropertyKeyframeDataItem(e);this._value=e.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(a,e,c,d,g,k){d=f.PropertyTrackState.NumericTypeAdapter.Interpolate;this._value=
d(a,e,c,this._propertyTrack);this._init=!0}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{value:this._value,init:this._init}}_LoadFromJson(a){a&&(this._value=a.value,this._init=a.hasOwnProperty("init")?a.init:!0)}}f.PropertyTrackState.ValueSourceAdapter=b}"use strict";
self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(f){this._sourceAdapter=f;this._propertyTrack=f.GetPropertyTrack();this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo();this._property=this._propertyTrack.GetPropertyName();this._firstAbsoluteUpdate=!1;this._target=this._saveState=null}Release(){this._target=this._saveState=this._worldInfo=this._propertyTrack=this._sourceAdapter=null}CleanCaches(){this._target=this._saveState=this._worldInfo=null}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo?
this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(f){this._firstAbsoluteUpdate=!!f}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(f){return typeof this._Getter()===typeof f}BeforeChangeProperty(){}ChangeProperty(f,b,
a,e,c){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const f=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(f)},()=>{const f=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const f=this._propertyTrack.GetTimeline().GetTime()-this._propertyTrack.GetTrack().GetStartOffset();
return this._PickTimelinePlaybackMode(()=>{const b=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(f,b)},()=>{const b=this._propertyTrack.GetPropertyTrackDataItem(),a=this._propertyTrack.GetPropertyTrackData(),e=a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(f,b);return e?e:a.GetLastPropertyKeyframeDataItem(b)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(f,b){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?
f():b()}_PickResultMode(f,b){return"relative"===this._propertyTrack.GetResultMode()?f():b()}_PickFirstAbsoluteUpdate(f,b){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),f()):b()}_GetAbsoluteInitialValue(f){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(f,b,a,e,c){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return f();case "effect":return b();case "instance-variable":return a();
case "plugin":return e();case "world-instance":return c()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(f){f&&(this._firstAbsoluteUpdate=f.firstAbsoluteUpdate,this._saveState=f.saveState)}_GetPropertyKeyframeStubs(f,b=!1){const a=[];for(const e of f){f=e.GetTrack().GetStartOffset();for(const c of e.GetPropertyKeyframeDataItems())b&&0===c.GetTime()?a.push({time:f+c.GetTime(),value:c.GetAbsoluteValue()}):b||a.push({time:f+c.GetTime(),value:c.GetAbsoluteValue()})}return a.sort((e,
c)=>e.time-c.time)}_GetLastPropertyKeyframeStub(f,b,a){return this._GetPropertyKeyframeStubLowerThanPlayhead(b,a)}_GetPropertyKeyframeStubLowerThanPlayhead(f,b){for(let a=b.length-1;0<=a;a--)if(b[a].time<=f)return b[a];return null}};"use strict";
{const f=self.C3,b=new Map,a=[0,0,0];class e extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const c=this._propertyTrack.GetSourceAdapterId(),d=this._GetTarget(),g=this._GetIndex();switch(c){case "behavior":return this._ToColorArray(d.GetPropertyValueByIndex(g));case "effect":return this._ToColorArray(d[g]);case "plugin":return this._ToColorArray(d.GetPropertyValueByIndex(g));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const c=
this._FirstKeyframeGetter();return!this._CompareColors(c,this._Getter())}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(c,d){return c.equalsIgnoringAlpha(d)}_FirstKeyframeGetter(){const c=super._FirstKeyframeGetter();return this._GetColorFromArray(c)}_CurrentKeyframeGetter(){const c=super._CurrentKeyframeGetter();return this._GetColorFromArray(c)}_GetAbsoluteInitialValue(c){}_ToColorArray(c){return f.IsInstanceOf(c,
f.Color)?c.toArray().slice(0,3):c.slice(0,3)}_GetColorFromArray(c){return f.IsInstanceOf(c,f.Color)?c:new f.Color(c[0],c[1],c[2],1)}CanChange(c){return!0}BeforeChangeProperty(){var c=this._propertyTrack.GetInstance();b.has(c)||b.set(c,new Map);c=b.get(c);const d=this._propertyTrack.GetSourceAdapterId();c.has(d)||c.set(d,new Map);c=c.get(d);c.has(this._property)||c.set(this._property,{used:!1,color:new f.Color(0,0,0,1)})}_GetTmpColor(c,d,g){c=b.get(c).get(d).get(g);c.used=!0;return c.color}ChangeProperty(c,
d,g,k,m){m=this._propertyTrack.GetTimeline();k=this._propertyTrack.GetTrack();c=this._propertyTrack.GetInstance();var p=this._propertyTrack.GetSourceAdapter();g=this._propertyTrack.GetSourceAdapterId();p=m.GetSimilarPropertyTracks(c,p,this._property);if(1<p.length){if(p=this._GetPropertyKeyframeStubs(p,!0),m=this._GetLastPropertyKeyframeStub(m,m.GetTime(),p))if(k=k.GetStartOffset(),p=m.time-k,0===p)this._GetTmpColor(c,g,this._property).addRgb(d[0],d[1],d[2]);else{if(0>p)return;m=d[0];k=d[1];d=d[2];
p=this._propertyTrack.Interpolate(p,!1,!0);m=f.Color.DiffChannel(m,p[0]);k=f.Color.DiffChannel(k,p[1]);d=f.Color.DiffChannel(d,p[2]);this._GetTmpColor(c,g,this._property).addRgb(m,k,d)}}else this._Setter(d[0],d[1],d[2]);return f.TimelineState.LAYOUT_RENDER_CHANGE}AfterChangeProperty(){const c=this._propertyTrack.GetInstance();if(b.has(c)){var d=b.get(c),g=this._propertyTrack.GetSourceAdapterId();if(d.has(g)){var k=d.get(g);if(k.has(this._property)){var m=k.get(this._property),p=m.color;m.used&&this._Setter(p.getR(),
p.getG(),p.getB());0===k.size&&d.delete(g);0===d.size&&b.delete(c)}}}}_Getter(){const c=this._propertyTrack.GetSourceAdapterId(),d=this._GetTarget(),g=this._GetIndex();switch(c){case "behavior":return this._GetColorFromArray(d.GetPropertyValueByIndex(g));case "effect":return d[g].clone();case "plugin":return this._GetColorFromArray(d.GetPropertyValueByIndex(g));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(c,d,g){const k=this._propertyTrack.GetSourceAdapterId(),
m=this._GetTarget(),p=this._GetIndex();switch(k){case "behavior":a[0]=c;a[1]=d;a[2]=g;m.SetPropertyValueByIndex(p,a);break;case "effect":m[p].setRgb(c,d,g);break;case "plugin":a[0]=c;a[1]=d;a[2]=g;m.SetPropertyValueByIndex(p,a);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(c,d,g)}}_SaveToJson(){}_LoadFromJson(c){}}f.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=e}"use strict";
{const f=self.C3;class b extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(a){super(a)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}ChangeProperty(a,e,c,d,g){c=f.PropertyTrackState.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);
var k=this._propertyTrack;const m=k.GetTrack();d=k.GetSourceAdapterId();g=k.GetTimeline();var p=m.GetInstance();k=k.GetSourceAdapter();p=g.GetSimilarPropertyTracks(p,k,this._property);1<p.length&&(p=this._GetPropertyKeyframeStubs(p),a+=m.GetStartOffset(),a=this._GetLastPropertyKeyframeStub(g,a,p))&&(e=a.value);if(c(this._GetIndex(),this._GetTarget(),e,d))switch(this._Setter(e),d){case "plugin":return f.TimelineState.LAYOUT_RENDER_CHANGE}}_Getter(){const a=this._propertyTrack.GetSourceAdapterId(),
e=this._GetTarget(),c=this._GetIndex();switch(a){case "behavior":return e.GetPropertyValueByIndex(c);case "effect":return e[c];case "instance-variable":return e.GetInstanceVariableValue(c);case "plugin":return e.GetPropertyValueByIndex(c)}}_Setter(a){const e=this._propertyTrack.GetSourceAdapterId(),c=this._GetTarget(),d=this._GetIndex();switch(e){case "behavior":c.SetPropertyValueByIndex(d,a);break;case "effect":c[d]=a;break;case "instance-variable":c.SetInstanceVariableValue(d,a);break;case "plugin":c.SetPropertyValueByIndex(d,
a)}}}f.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=b}"use strict";
{const f=self.C3,b=new Map,a=(c,d,g,k,m)=>b.set(c,{setter:d,absolute_setter:g,getter:k,round:m});a("offsetX",(c,d)=>c.OffsetX(d),(c,d)=>c.SetX(d),c=>c.GetX(),!0);a("offsetY",(c,d)=>c.OffsetY(d),(c,d)=>c.SetY(d),c=>c.GetY(),!0);a("offsetWidth",(c,d)=>c.OffsetWidth(d),(c,d)=>c.SetWidth(d),c=>c.GetWidth(),!0);a("offsetHeight",(c,d)=>c.OffsetHeight(d),(c,d)=>c.SetHeight(d),c=>c.GetHeight(),!0);a("offsetAngle",(c,d)=>c.OffsetAngle(d),(c,d)=>c.SetAngle(d),c=>c.GetAngle(),!1);a("offsetOpacity",(c,d)=>c.OffsetOpacity(d),
(c,d)=>c.SetOpacity(d),c=>c.GetOpacity(),!1);a("offsetOriginX",(c,d)=>c.OffsetOriginX(d),(c,d)=>c.SetOriginX(d),c=>c.GetOriginX(),!1);a("offsetOriginY",(c,d)=>c.OffsetOriginY(d),(c,d)=>c.SetOriginY(d),c=>c.GetOriginY(),!1);a("offsetZElevation",(c,d)=>c.OffsetZElevation(d),(c,d)=>c.SetZElevation(d),c=>c.GetZElevation(),!0);a("offsetScaleX",(c,d,g)=>{c.OffsetWidth(g.GetOriginalWidth()*d)},(c,d,g)=>{c.SetWidth(g.GetOriginalWidth()*d)},(c,d)=>c.GetWidth()/d.GetOriginalWidth(),!1);a("offsetScaleY",(c,
d,g)=>{c.OffsetHeight(g.GetOriginalHeight()*d)},(c,d,g)=>{c.SetHeight(g.GetOriginalHeight()*d)},(c,d)=>c.GetHeight()/d.GetOriginalHeight(),!1);class e extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c);this._lastValue=0;this._instance_absolute_setter=this._instance_setter=this._instance_getter=null;this._round=!1;f.IsInstanceOf(this._propertyTrack.GetTimeline(),f.Tween)?this._typeAdapter=new f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):
this._typeAdapter=new f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);c=this._propertyTrack.GetPropertyName();"world-instance"===this._propertyTrack.GetSourceAdapterId()&&(c=b.get(c),this._instance_getter=c.getter,this._instance_setter=c.setter,this._instance_absolute_setter=c.absolute_setter,this._round=c.round)}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}GetLastValue(){return this._lastValue}SetLastValue(c){this._lastValue=
c}SetInitialState(){const c=this._typeAdapter.SetInitialState();"number"===typeof c&&(this._lastValue=c)}SetResumeState(){const c=this._typeAdapter.SetResumeState();"number"===typeof c&&(this._lastValue=c)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(c,
d,g,k,m,p){return this._typeAdapter.ChangeProperty(c,d,g,k,m,p)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const c=this._GetTarget(),d=this._GetIndex(),g=this._propertyTrack.GetTrack(),k=this.GetWorldInfo();return this._PickSource(()=>c.GetPropertyValueByIndex(d),()=>c[d],()=>c.GetInstanceVariableValue(d),()=>c.GetPropertyValueByIndex(d),()=>this._instance_getter(k,g))}_Setter(c,d,g){const k=this._GetTarget(),m=this._GetIndex(),p=this._propertyTrack.GetTrack(),n=this.GetWorldInfo();
this._PickSource(()=>k.OffsetPropertyValueByIndex(m,c),()=>k[m]+=c,()=>k.SetInstanceVariableOffset(m,c),()=>k.OffsetPropertyValueByIndex(m,c),()=>this._instance_setter(n,c,p))}_SetterAbsolute(c,d,g){const k=this._GetTarget(),m=this._GetIndex(),p=this._propertyTrack.GetTrack(),n=this.GetWorldInfo();this._PickSource(()=>k.SetPropertyValueByIndex(m,c),()=>k[m]=c,()=>k.SetInstanceVariableValue(m,c),()=>k.SetPropertyValueByIndex(m,c),()=>this._instance_absolute_setter(n,c,p))}_MaybeEnsureValue(c,d,g,k,
m,p){this._typeAdapter._MaybeEnsureValue(c,d,g,k,m,p)}_AddDelta(c,d,g){var k=(c.toString().split(".")[1]||"").length;c=this._Getter();k=0===k?this._round?Math.round(c):c:f.toFixed(c,k);this._Setter(k-c,d,g)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._lastValue=c.v)}}f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=e}"use strict";
{const f=self.C3,b=new Map;class a{constructor(e){this._numericInterpolationAdapter=e}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const e=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack();return e._PickResultMode(()=>e._PickTimelinePlaybackMode(()=>0,()=>f.PropertyTrackState.PropertySourceAdapter.GetValueAtTime(c)),()=>{})}SetResumeState(){}BeforeChangeProperty(){const e=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),
d=c.GetPropertyName();e._PickResultMode(()=>{},()=>{var g=c.GetInstance();b.has(g)||b.set(g,new Map);g=b.get(g);const k=c.GetSourceAdapterId();g.has(k)||g.set(k,new Map);g=g.get(k);g.has(d)||g.set(d,{used:!1,value:0})})}_GetTmpAbsoluteValueObject(e,c,d){e=b.get(e).get(c).get(d);e.used=!0;return e}ChangeProperty(e,c,d,g,k,m){const p=this._numericInterpolationAdapter,n=this._numericInterpolationAdapter.GetPropertyTrack(),u=n.GetPropertyName();p._PickResultMode(()=>{const q=p.GetLastValue();p._Setter(c-
q,d,g);m&&this._MaybeEnsureValue(e,d,g,k,q,c);p.SetLastValue(c)},()=>{var q=n.GetTimeline(),r=n.GetTrack();const t=n.GetInstance();var x=n.GetSourceAdapter();const z=n.GetSourceAdapterId();x=q.GetSimilarPropertyTracks(t,x,u);if(1<x.length){if(x=p._GetPropertyKeyframeStubs(x,!0),q=p._GetLastPropertyKeyframeStub(q,q.GetTime(),x))r=r.GetStartOffset(),r=q.time-r,0===r?this._GetTmpAbsoluteValueObject(t,z,u).value+=c:0>r||(r=n.Interpolate(r,!1,!0),this._GetTmpAbsoluteValueObject(t,z,u).value+=c-r)}else p._SetterAbsolute(c)});
return p._PickSource(()=>{},()=>f.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>f.TimelineState.LAYOUT_RENDER_CHANGE,()=>f.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){const e=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),d=c.GetPropertyName();e._PickResultMode(()=>{},()=>{const g=c.GetInstance();if(b.has(g)){var k=b.get(g),m=c.GetSourceAdapterId();if(k.has(m)){var p=k.get(m);if(p.has(d)){var n=p.get(d),u=n.value;n.used&&e._SetterAbsolute(u);
p.delete(d);0===p.size&&k.delete(m);0===k.size&&b.delete(g)}}}})}_MaybeEnsureValue(e,c,d,g,k,m){const p=this._numericInterpolationAdapter;g||(c&&e===c.GetTime()?p._AddDelta(c.GetValueWithResultMode(),c,d):d&&e===d.GetTime()?p._AddDelta(d.GetValueWithResultMode(),c,d):0===m-k&&p._AddDelta(c.GetValueWithResultMode(),c,d))}}f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=a}"use strict";
{const f=self.C3;new Map;class b{constructor(a){this._numericInterpolationAdapter=a}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const a=this._numericInterpolationAdapter;a.SetFirstAbsoluteUpdate(!0);return this._GetAbsoluteInitialValue(a._FirstKeyframeGetter())}SetResumeState(){const a=this._numericInterpolationAdapter;if(a._FirstKeyframeGetter()!==a._CurrentKeyframeGetter())return a.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(a._CurrentKeyframeGetter())}BeforeChangeProperty(){}ChangeProperty(a,
e,c,d,g,k){const m=this._numericInterpolationAdapter,p=m.GetLastValue();m._PickResultMode(()=>{m._Setter(e-p,c,d);k&&this._MaybeEnsureValue(a,c,d,g,p,e)},()=>{m._PickFirstAbsoluteUpdate(()=>{m._Setter(p,c,d)},()=>{m._Setter(e-p,c,d);k&&this._MaybeEnsureValue(a,c,d,g,p,e)})});m.SetLastValue(e);return m._PickSource(()=>{},()=>f.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>f.TimelineState.LAYOUT_RENDER_CHANGE,()=>f.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){}_GetAbsoluteInitialValue(a){return a-
this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(a,e,c,d,g,k){const m=this._numericInterpolationAdapter;d?e&&a===e.GetTime()?m._AddDelta(e.GetValueWithResultMode(),e,c):c&&a===c.GetTime()?m._AddDelta(c.GetValueWithResultMode(),e,c):c||m._AddDelta(e.GetValueWithResultMode(),e,c):e&&a===e.GetTime()?m._AddDelta(e.GetValueWithResultMode(),e,c):c&&a===c.GetTime()?m._AddDelta(c.GetValueWithResultMode(),e,c):0===k-g&&m._AddDelta(e.GetValueWithResultMode(),e,c)}}f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=
b}"use strict";
{const f=self.C3,b=self.Ease;f.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(a,e,c,d){let g;switch(d){case "behavior":g=e.GetPropertyValueByIndex(a);break;case "effect":g=e[a];break;case "instance-variable":g=e.GetInstanceVariableValue(a);break;case "plugin":g=e.GetPropertyValueByIndex(a)}return g===c?!1:!0}static Interpolate(a,e,c,d){if(!c)return c=d.GetPropertyTrackDataItem(),c=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(c),c.GetValueWithResultMode();var g=
d.GetInterpolationMode();"default"===g&&(g="continuous");"combo"===d.GetPropertyType()&&(g="discrete");if("discrete"===g)return e.GetValueWithResultMode();if("continuous"===g||"step"===g){"step"===g&&(g=d.GetTimeline().GetStep(),0!==g&&(g=1/g,a=Math.floor(a*g)/g));var k=e.GetTime();const m=c.GetTime();g=e.GetValueWithResultMode();const p=c.GetValueWithResultMode();if(g===p)return g;a=f.normalize(a,k,m);const n=e.GetEase();e=e.GetAddOn("cubic-bezier");c=c.GetAddOn("cubic-bezier");e&&e.GetStartEnable()&&
c&&c.GetEndEnable()?(k=m-k,k=b.GetRuntimeEase(n)(k*a,0,1,k),k=b.GetRuntimeEase("cubicbezier")(k,g,g+e.GetStartAnchor(),p+c.GetEndAnchor(),p)):k=b.GetRuntimeEase(n)((m-k)*a,g,p-g,m-k);return"integer"===d.GetPropertyType()?Math.floor(k):k}}}}"use strict";
{const f=self.C3;f.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(b,a,e,c){let d;switch(c){case "behavior":d=a.GetPropertyValueByIndex(b);break;case "effect":d=a[b];break;case "instance-variable":d=a.GetInstanceVariableValue(b);break;case "plugin":d=a.GetPropertyValueByIndex(b)}return d===e?!1:!0}static Interpolate(b,a,e,c){if(!e)return a=c.GetPropertyTrackDataItem(),a=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode();var d=c.GetInterpolationMode();
"default"===d&&(d="continuous");"combo"===c.GetPropertyType()&&(d="discrete");if("discrete"===d)return a.GetValueWithResultMode();if("continuous"===d||"step"===d){"step"===d&&(c=c.GetTimeline().GetStep(),0!==c&&(c=1/c,b=Math.floor(b*c)/c));const g=a.GetTime(),k=e.GetTime();c=a.GetValueWithResultMode();e=e.GetValueWithResultMode();if(d=a.GetAddOn("angle")){const m=d.GetRevolutions();if(c===e&&0===m)return c;b=f.normalize(b,g,k);a=self.Ease.GetRuntimeEase(a.GetEase())(b,0,1,1);switch(d.GetDirection()){case "closest":return f.angleLerp(c,
e,a,m);case "clockwise":return f.angleLerpClockwise(c,e,a,m);case "anti-clockwise":return f.angleLerpAntiClockwise(c,e,a,m)}}else{if(c===e)return c;b=f.normalize(b,g,k);a=self.Ease.GetRuntimeEase(a.GetEase());return f.angleLerp(c,e,a(b,0,1,1))}}}}}"use strict";
self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(f,b,a,e){let c;switch(e){case "behavior":c=b.GetPropertyValueByIndex(f);break;case "effect":c=b[f];break;case "instance-variable":c=b.GetInstanceVariableValue(f);break;case "plugin":c=b.GetPropertyValueByIndex(f)}return!!c===!!a?!1:!0}static Interpolate(f,b,a,e){return a?b.GetValueWithResultMode()?1:0:(f=e.GetPropertyTrackDataItem(),f=e.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f),f.GetValueWithResultMode()?
1:0)}};"use strict";
{const f=self.C3,b=[0,0,0],a=[0,0,0],e=[0,0,0];f.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(c,d,g,k){let m;switch(k){case "behavior":m=d.GetPropertyValueByIndex(c);break;case "effect":m=d[c];break;case "instance-variable":m=d.GetInstanceVariableValue(c);break;case "plugin":m=d.GetPropertyValueByIndex(c)}Array.isArray(g)?(b[0]=g[0],b[1]=g[1],b[2]=g[2]):(e.parseCommaSeparatedRgb(g),b[0]=Math.floor(255*e.getR()),b[1]=Math.floor(255*e.getG()),b[2]=Math.floor(255*e.getB()));
Array.isArray(m)?(a[0]=m[0],a[1]=m[1],a[2]=m[2]):(e.parseCommaSeparatedRgb(m),a[0]=Math.floor(255*e.getR()),a[1]=Math.floor(255*e.getG()),a[2]=Math.floor(255*e.getB()));return b[0]!==a[0]||b[1]!==a[1]||b[2]!==a[2]?!0:!1}static Interpolate(c,d,g,k){if(!g){var m=k.GetPropertyTrackDataItem();m=k.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(m);k=m.GetValueWithResultMode();b[0]=k[0];b[1]=k[1];b[2]=k[2];return b}m=k.GetInterpolationMode();"default"===m&&(m="continuous");if("discrete"===m)return k=
d.GetValueWithResultMode(),b[0]=k[0],b[1]=k[1],b[2]=k[2],b;if("continuous"===m||"step"===m){"step"===m&&(k=k.GetTimeline().GetStep(),0!==k&&(k=1/k,c=Math.floor(c*k)/k));k=d.GetTime();m=g.GetTime();var p=d.GetValueWithResultMode(),n=g.GetValueWithResultMode();c=f.normalize(c,k,m);var u=d.GetEase();d=p[0];g=p[1];p=p[2];const q=n[0],r=n[1];n=n[2];u=self.Ease.GetRuntimeEase(u);k=m-k;m=k*c;b[0]=d===q?d:u(m,d,q-d,k);b[1]=g===r?g:u(m,g,r-g,k);b[2]=p===n?p:u(m,p,n-p,k);return b}}}}"use strict";
self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(f,b,a,e){let c;switch(e){case "behavior":c=b.GetPropertyValueByIndex(f);break;case "effect":c=b[f];break;case "instance-variable":c=b.GetInstanceVariableValue(f);break;case "plugin":c=b.GetPropertyValueByIndex(f)}return c===a?!1:!0}static Interpolate(f,b,a,e){return a?b.GetValueWithResultMode():(f=e.GetPropertyTrackDataItem(),f=e.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f),f.GetValueWithResultMode())}};
"use strict";
{const f=self.C3;f.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const b of this._timelineDataItems.values())b.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(b){b=new f.TimelineDataItem(b);const a=b.GetName();this._timelineDataItems.set(a,b)}Get(b){return this._timelineDataItems.get(b)}GetNameId(){return 0}static _CreateDataItems(b,a,e,c){if(a)for(const d of a)f.TimelineDataManager._CreateDataItem("create",d,b,e,c)}static _LoadDataItemsFromJson(b,a,
e,c){b.length?a.forEach((d,g)=>{b[g]._LoadFromJson(d)}):a.forEach(d=>{f.TimelineDataManager._CreateDataItem("load",d,b,e,c)})}static _CreateDataItem(b,a,e,c,d){let g;if("function"===typeof c)switch(b){case "load":g=new c(null,d);break;case "create":g=new c(a,d)}else if("object"===typeof c)switch(c=c.map.get(a[c.prop]),b){case "load":g=new c(null,d);break;case "create":g=new c(a,d)}switch(b){case "load":g._LoadFromJson(a);e.push(g);break;case "create":if("function"===typeof g.GetEnable&&!g.GetEnable())return g.Release();
e.push(g)}}}}"use strict";
{const f=self.C3;f.TimelineDataItem=class{constructor(b){this._name="";this._totalTime=NaN;this._step=0;this._resultMode=this._interpolationMode="default";this._pingPong=this._loop=!1;this._repeatCount=1;this._trackData=null;b&&(this._name=b[0],this._totalTime=b[1],this._step=b[2],this._interpolationMode=b[3],this._resultMode=b[4],this._loop=!!b[6],this._pingPong=!!b[7],this._repeatCount=b[8],this._trackData=new f.TrackData(b[5],this))}Release(){this._trackData.Release();this._trackData=null}GetTrackData(){this._trackData||
(this._trackData=new f.TrackData(null,this));return this._trackData}GetName(){return this._name}SetName(b){this._name=b}GetTotalTime(){return this._totalTime}SetTotalTime(b){this._totalTime=b}GetStep(){return this._step}SetStep(b){this._step=b}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(b){this._interpolationMode=b}GetResultMode(){return this._resultMode}SetResultMode(b){this._resultMode=b}GetLoop(){return this._loop}SetLoop(b){this._loop=b}GetPingPong(){return this._pingPong}SetPingPong(b){this._pingPong=
b}GetRepeatCount(){return this._repeatCount}_SaveToJson(){return{trackDataJson:this._trackData._SaveToJson(),name:this._name,totalTime:this._totalTime,step:this._step,interpolationMode:this._interpolationMode,resultMode:this._resultMode,loop:this._loop,pingPong:this._pingPong,repeatCount:this._repeatCount}}_LoadFromJson(b){b&&(this.GetTrackData()._LoadFromJson(b.trackDataJson),this._name=b.name,this._totalTime=b.totalTime,this._step=b.step,this._interpolationMode=b.interpolationMode,this._resultMode=
b.resultMode,this._loop=b.loop,this._pingPong=b.pingPong,this._repeatCount=b.repeatCount)}}}"use strict";
{const f=self.C3;class b{constructor(a,e){this._trackData=e;this._additionalInstanceData=this._instanceData=null;this._objectClassIndex=this._instanceUid=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyTrackData=this._keyframeData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();a&&(this._instanceData=a[0],this._instanceUid=a[0][2],this._objectClassIndex=a[0][1],this._interpolationMode=
a[1],this._resultMode=a[2],this._enabled=!!a[3],a[6]&&(this._id=a[6]),a[7]&&(this._nestedData=a[7],this._startOffset=a[7][0],this._localTotalTime=a[7][1]),a[8]&&(this._additionalInstanceData=a[8]),this._keyframeData=new f.KeyframeData(a[4],this),this._propertyTrackData=new f.PropertyTrackData(a[5],this))}Release(){this._trackData=this._instanceData=null;this._keyframeData&&(this._keyframeData.Release(),this._keyframeData=null);this._propertyTrackData&&(this._propertyTrackData.Release(),this._propertyTrackData=
null);this._nestedData=null}GetTrackData(){return this._trackData}GetKeyframeData(){this._keyframeData||(this._keyframeData=new f.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new f.PropertyTrackData(null,this));return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(a){this._objectClassIndex=a}GetInstanceUID(){return this._instanceUid}SetInstanceUID(a){this._instanceUid=
a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}GetOriginalWidth(){return this._additionalInstanceData[0]}SetOriginalWidth(a){this._additionalInstanceData||(this._additionalInstanceData=[]);
this._additionalInstanceData[0]=a}GetOriginalHeight(){this._additionalInstanceData||(this._additionalInstanceData=[]);return this._additionalInstanceData[1]}SetOriginalHeight(a){this._additionalInstanceData||(this._additionalInstanceData=[]);this._additionalInstanceData[1]=a}_SaveToJson(){return{keyframeDataJson:this._keyframeData._SaveToJson(),propertyTrackDataJson:this._propertyTrackData._SaveToJson(),instanceData:this._instanceData,additionalInstanceData:this._additionalInstanceData,instanceUid:this._instanceUid,
objectClassIndex:this._objectClassIndex,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled,id:this._id,nestedData:this._nestedData}}_LoadFromJson(a){a&&(this._instanceData=a.instanceData,this._instanceUid=a.instanceUid,this._objectClassIndex=a.objectClassIndex,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._enabled=a.enabled,this._id=a.id,this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),a.nestedData&&
(this._nestedData=a.nestedData,this._startOffset=this._nestedData[0],this._localTotalTime=this._nestedData[1]),a.additionalInstanceData&&(this._additionalInstanceData=a.additionalInstanceData),this.GetKeyframeData()._LoadFromJson(a.keyframeDataJson),this.GetPropertyTrackData()._LoadFromJson(a.propertyTrackDataJson))}}f.TrackData=class{constructor(a,e){this._timelineDataItem=e;this._trackDataItems=[];this._keyframeTimeMap=new Map;f.TimelineDataManager._CreateDataItems(this._trackDataItems,a,b,this)}Release(){this._timelineDataItem=
null;for(const a of this._trackDataItems)a.Release();f.clearArray(this._trackDataItems);this._trackDataItems=null;this._keyframeTimeMap.clear();this._keyframeTimeMap=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const a=new b(null,this);this._trackDataItems.push(a);return a}GetFirstKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(a){a=a.GetKeyframeData().GetKeyframeDataItemArray();return a[a.length-1]}GetKeyFrameDataItemAtTime(a,
e){const c=this._keyframeTimeMap.get(e);if(c&&c.has(a))return c.get(a);for(const d of e.GetKeyframeData().keyframeDataItems())if(d.GetTime()===a)return c||this._keyframeTimeMap.set(e,new Map),this._keyframeTimeMap.get(e).set(a,d),d}GetFirstKeyFrameDataItemHigherThan(a,e){for(const c of e.GetKeyframeData().keyframeDataItems())if(c.GetTime()>a)return c}GetFirstKeyFrameDataItemHigherOrEqualThan(a,e){for(const c of e.GetKeyframeData().keyframeDataItems())if(c.GetTime()>=a)return c}GetFirstKeyFrameDataItemLowerOrEqualThan(a,
e){for(const c of e.GetKeyframeData().keyframeDataItemsReverse())if(c.GetTime()<=a)return c}*trackDataItems(){for(const a of this._trackDataItems)yield a}_SaveToJson(){return{trackDataItemsJson:this._trackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,a.trackDataItemsJson,b,this)}}}"use strict";
{const f=self.C3;class b{constructor(a,e){this._propertyTrackData=e;this._sourceAdapterId="";this._type=this._property=this._sourceAdapterArguments=null;this._max=this._min=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyKeyframeData=null;a&&(this._sourceAdapterId=a[0][0],this._sourceAdapterArguments=a[0].slice(1),this._property=a[1],this._type=a[2],this._min=a[3],this._max=a[4],this._interpolationMode=a[5],this._resultMode=a[6],this._enabled=!!a[7],this._propertyKeyframeData=
new f.PropertyKeyframeData(a[8],this))}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new f.PropertyKeyframeData(null,this));return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(a){this._sourceAdapterId=a}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(a){this._sourceAdapterArguments=
a}GetProperty(){return this._property}SetProperty(a){this._property=a}GetType(){return this._type}SetType(a){this._type=a}GetMin(){return this._min}SetMin(a){this._min=a}GetMax(){return this._max}SetMax(a){this._max=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}_SaveToJson(){return{propertyKeyframeDataJson:this._propertyKeyframeData._SaveToJson(),
sourceAdapterId:this._sourceAdapterId,sourceAdapterArguments:this._sourceAdapterArguments,property:this._property,type:this._type,min:this._min,max:this._max,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled}}_LoadFromJson(a){a&&(this._sourceAdapterId=a.sourceAdapterId,this._sourceAdapterArguments=a.sourceAdapterArguments,this._property=a.property,this._type=a.type,this._min=a.min,this._max=a.max,this._interpolationMode=a.interpolationMode,this._resultMode=
a.resultMode,this._enabled=a.enabled,this.GetPropertyKeyframeData()._LoadFromJson(a.propertyKeyframeDataJson))}}f.PropertyTrackData=class{constructor(a,e){this._trackDataItem=e;this._propertyTrackDataItems=[];this._propertyKeyframeTimeMap=new Map;f.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,a,b,this)}Release(){this._trackDataItem=null;for(const a of this._propertyTrackDataItems)a.Release();f.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null;this._propertyKeyframeTimeMap.clear();
this._propertyKeyframeTimeMap=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const a=new b(null,this);this._propertyTrackDataItems.push(a);return a}GetFirstPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(a){a=a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();return a[a.length-1]}GetPropertyKeyFrameDataItemAtTime(a,e){const c=this._propertyKeyframeTimeMap.get(e);if(c&&
c.has(a))return c.get(a);const d=e.GetPropertyKeyframeData();for(const g of d.propertyKeyframeDataItems())if(g.GetTime()===a)return c||this._propertyKeyframeTimeMap.set(e,new Map),this._propertyKeyframeTimeMap.get(e).set(a,g),g}GetFirstPropertyKeyFrameDataItemHigherThan(a,e){e=e.GetPropertyKeyframeData();for(const c of e.propertyKeyframeDataItems())if(c.GetTime()>a)return c}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,e){e=e.GetPropertyKeyframeData();for(const c of e.propertyKeyframeDataItems())if(c.GetTime()>=
a)return c}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,e){e=e.GetPropertyKeyframeData();for(const c of e.propertyKeyframeDataItemsReverse())if(c.GetTime()<=a)return c}*propertyTrackDataItems(){for(const a of this._propertyTrackDataItems)yield a}_SaveToJson(){return{propertyTrackDataItemsJson:this._propertyTrackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,a.propertyTrackDataItemsJson,b,this)}}}"use strict";
{const f=self.C3;class b{constructor(a,e){this._keyframeData=e;this._time=-1;this._ease="noease";this._enable=!1;this._lowerTags=this._tags=null;a&&(this._time=a[0],this._ease=a[1],this._enable=!!a[2],this._tags=(a=a[3])?a.split(" "):[],this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase())))}Release(){this._keyframeData=null;f.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetTime(){return this._time}SetTime(a){this._time=
a}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetTags(){return this._tags}SetTags(a){this._tags=a?a.split(" "):[];this._lowerTags=new Set(this._tags.map(e=>e.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(e=>e.toLowerCase())))}}f.KeyframeData=class{constructor(a,e){this._trackDataItem=e;this._keyframeDataItems=[];f.TimelineDataManager._CreateDataItems(this._keyframeDataItems,a,b,this)}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();f.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const a=
new b(null,this);this._keyframeDataItems.push(a);return a}DeleteKeyframeDataItems(a){for(const e of this._keyframeDataItems){if(!a(e))continue;const c=this._keyframeDataItems.indexOf(e);-1!==c&&(e.Release(),this._keyframeDataItems.splice(c,1))}this.SortKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((a,e)=>a.GetTime()-e.GetTime())}GetKeyframeDataItemIndex(a){return this._keyframeDataItems.indexOf(a)}GetKeyframeDataItemFromIndex(a){return this._keyframeDataItems[a]}*keyframeDataItems(){for(const a of this._keyframeDataItems)yield a}*keyframeDataItemsReverse(){for(let a=
this._keyframeDataItems.length-1;0<=a;a--)yield this._keyframeDataItems[a]}_SaveToJson(){return{keyframeDataItemsJson:this._keyframeDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,a.keyframeDataItemsJson,b,this)}}}"use strict";
{const f=self.C3;class b{constructor(a,e){this._propertyKeyframeData=e;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;a&&(this._value=a[0][0],this._aValue=a[0][1],this._type=a[0][2],this._time=a[1],this._ease=a[2],this._enable=!!a[3],this._addonData=null,a[4]&&(this._addonData=new f.AddonData(a[4],this)))}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(),this._addonData=null)}GetAddonData(){return this._addonData}GetValue(){return this._value}SetValue(a){"color"===
this._type&&f.IsFiniteNumber(a)?(this._value[0]=f.GetRValue(a),this._value[1]=f.GetGValue(a),this._value[2]=f.GetBValue(a)):this._value=a}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(a){"color"===this._type&&f.IsFiniteNumber(a)?(this._aValue[0]=f.GetRValue(a),this._aValue[1]=f.GetGValue(a),this._aValue[2]=f.GetBValue(a)):this._aValue=a}GetValueWithResultMode(){const a=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if("relative"===a)return this.GetValue();if("absolute"===
a)return this.GetAbsoluteValue()}GetType(){return this._type}SetType(a){this._type=a}GetTime(){return this._time}SetTime(a){this._time=a}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetAddOn(a){if(this.GetAddonData())for(const e of this.GetAddonData().addonDataItems())if(e.GetId()===a)return e}_SaveToJson(){const a=this._addonData;return{addonDataJson:a?a._SaveToJson():a,value:this._value,aValue:this._aValue,type:this._type,time:this._time,
ease:this._ease,enable:this._enable}}_LoadFromJson(a){a&&(a.addonDataJson&&this._addonData._SetFromJson(a.addonDataJson),this._value=a.value,this._aValue=a.aValue,this._type=a.type,this._time=a.time,this._ease=a.ease,this._enable=a.enable)}}f.PropertyKeyframeData=class{constructor(a,e){this._propertyTrackDataItem=e;this._propertyKeyframeDataItems=[];f.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,a,b,this)}Release(){this._propertyTrackDataItem=null;for(const a of this._propertyKeyframeDataItems)a.Release();
f.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=null}AddEmptyPropertyKeyframeDataItem(){const a=new b(null,this);this._propertyKeyframeDataItems.push(a);return a}DeletePropertyKeyframeDataItems(a){for(const e of this._propertyKeyframeDataItems){if(!a(e))continue;const c=this._propertyKeyframeDataItems.indexOf(e);-1!==c&&(e.Release(),this._propertyKeyframeDataItems.splice(c,1))}this.SortPropertyKeyFrameDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a,
e)=>a.GetTime()-e.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const a of this._propertyKeyframeDataItems)yield a}*propertyKeyframeDataItemsReverse(){for(let a=this._propertyKeyframeDataItems.length-1;0<=a;a--)yield this._propertyKeyframeDataItems[a]}_SaveToJson(){return{propertyKeyframeDataItemsJson:this._propertyKeyframeDataItems.map(a=>
a._SaveToJson())}}_LoadFromJson(a){a&&f.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a.propertyKeyframeDataItemsJson,b,this)}}}"use strict";
{const f=self.C3;class b{constructor(c,d){this._addonData=d;this._id=c[0];this._data=c[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(c){c&&(this._id=c.id,this._data=c.data)}}class a extends b{constructor(c,d){super(c,d);this._startAnchor=this._data[0];this._startEnable=!!this._data[1];this._endAnchor=this._data[2];this._endEnable=!!this._data[3]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),
{startAnchor:this._startAnchor,startEnable:!!this._startEnable,endAnchor:this._endAnchor,endEnable:!!this._endEnable})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._startAnchor=c.startAnchor,this._startEnable=!!c.startEnable,this._endAnchor=c.endAnchor,this._endEnable=!!c.endEnable)}}class e extends b{constructor(c,d){super(c,d);this._direction=this._data[0];this._revolutions=this._data[1]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),
{direction:this._direction,revolutions:this._revolutions})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._direction=c.direction,this._revolutions=c.revolutions)}}f.AddonData=class{constructor(c,d){this._propertyKeyframeDataItem=d;this._addonDataItems=[];f.TimelineDataManager._CreateDataItems(this._addonDataItems,c,{prop:0,map:new Map([["cubic-bezier",a],["angle",e]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const c of this._addonDataItems)c.Release();f.clearArray(this._addonDataItems);
this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}*addonDataItems(){for(const c of this._addonDataItems)yield c}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(c=>c._SaveToJson())}}_LoadFromJson(c){c&&f.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,c.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",a],["angle",e]])},this)}}}"use strict";
{const f=self.C3;let b=0;f.Tween=class extends f.TimelineState{constructor(a,e){super(`tween-${b++}`,a,e);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._on_started_callbacks=this._on_completed_callbacks=null}GetInstance(){var a=this.GetTracks();if(a&&a.length&&(a=a[0])){var e=a.GetInstance();return a.IsInstanceValid()?e:null}}AddStartedCallback(a){this._on_started_callbacks||(this._on_started_callbacks=[]);this._on_started_callbacks.push(a)}AddCompletedCallback(a){this._on_completed_callbacks||
(this._on_completed_callbacks=[]);this._on_completed_callbacks.push(a)}RemoveStartedCallback(a){this._on_started_callbacks&&(a=this._on_started_callbacks.indexOf(a),-1!==a&&this._on_started_callbacks.splice(a,1))}RemoveCompletedCallback(a){this._on_completed_callbacks&&(a=this._on_completed_callbacks.indexOf(a),-1!==a&&this._on_completed_callbacks.splice(a,1))}SetStartValue(a,e){for(const d of this._tracks)for(const g of d._propertyTracks){if(g.GetPropertyName()!==e)continue;var c=g.GetPropertyTrackData();
const k=g.GetPropertyTrackDataItem();c=c.GetFirstPropertyKeyframeDataItem(k);c.SetValue(a);c.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const e of this._tracks)for(const c of e._propertyTracks)if(c.GetPropertyName()===a)return c}BeforeSetEndValues(a){for(const e of a)a=this._GetPropertyTrackState(e),this.SetStartValue(a.GetCurrentState(),e);this.IsForwardPlayBack()?(this.SetTotalTime(this.GetTotalTime()-this.GetTime()),this._SetTime(0)):(this.SetTotalTime(this.GetTime()),this._SetTime(this.GetTotalTime()));
this.SetInitialStateFromSetTime()}SetEndValue(a,e){var c=this._GetPropertyTrackState(e);e=c.GetPropertyTrackData();c=c.GetPropertyTrackDataItem();e=e.GetLastPropertyKeyframeDataItem(c);e.SetTime(this.GetTotalTime());e.SetValue(a);e.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 e of this._tracks)e.CompareInitialStateWithCurrent();
super.SetInitialState(a)}Stop(a=!1){super.Stop(a);if(!this.IsComplete())for(const e of this._tracks)e.SaveState()}Reset(a=!0,e=!1){this._DeleteIntermediateKeyframes();super.Reset(a,e)}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const e=c=>{c=c.GetTime();const d=this.GetTotalTime();return 0!==c&&c!==d};a.DeleteKeyframes(e);a.DeletePropertyKeyframes(e)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const a=this.GetInstance();if(a&&a.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimeline(this);
this.ResetBeforeChangeLayout();return!0}MaybeTriggerKeyframeReachedConditions(){}Tick(a,e){a=this.GetInstance();a=this.GetRuntime().GetDt(a);super.Tick(a,1)}_SaveToJson(){const a=super._SaveToJson(),e=this.GetTimelineDataItem();return Object.assign(a,{tweenDataItemJson:e._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 e=a.runtime.GetTimelineManager(),c=new f.TimelineDataItem;if(a.json){c._LoadFromJson(a.json.tweenDataItemJson);var d=new f.Tween(c,e);d._LoadFromJson(a.json);return d}e=new f.Tween(c,e);f.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]);e.SetId(a.id);
e.SetTags(a.tags);e.SetInitialValueMode(a.initialValueMode);e.SetDestroyInstanceOnComplete(a.releaseOnComplete);e.SetLoop(a.loop);e.SetPingPong(a.pingPong);e.SetTotalTime(a.time);e.SetStep(0);e.SetInterpolationMode("default");e.SetResultMode(a.propertyTracksConfig[0].resultMode);c=e.AddTrack();c.SetInstanceUID(a.instance.GetUID());c.SetInterpolationMode("default");c.SetResultMode(a.propertyTracksConfig[0].resultMode);c.SetEnable(!0);c.SetObjectClassIndex(a.instance.GetObjectClass().GetIndex());c.SetOriginalWidth(a.instance.GetWorldInfo().GetWidth());
c.SetOriginalHeight(a.instance.GetWorldInfo().GetHeight());var g=c.AddKeyframe();g.SetTime(0);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");g=c.AddKeyframe();g.SetTime(a.time);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");for(d of a.propertyTracksConfig){g=c.AddPropertyTrack();g.SetSourceAdapterId(d.sourceId);g.SetSourceAdapterArgs(d.sourceArgs);g.SetPropertyName(d.property);g.SetPropertyType(d.type);g.SetMin(NaN);g.SetMax(NaN);g.SetInterpolationMode("default");g.SetResultMode(d.resultMode);
g.SetEnable(!0);const k=g.AddPropertyKeyframe();k.SetType(d.valueType);k.SetTime(0);k.SetEase(d.ease);k.SetEnable(!0);k.SetValue(d.startValue);k.SetAbsoluteValue(d.startValue);g=g.AddPropertyKeyframe();g.SetType(d.valueType);g.SetTime(a.time);g.SetEase(d.ease);g.SetEnable(!0);g.SetValue(d.endValue);g.SetAbsoluteValue(d.endValue)}return e}}}"use strict";
{const f=self.C3,b=self.Ease;f.Transition=class extends f.DefendedBase{constructor(a){super();this._name=a[0];this._transitionKeyframes=[];for(const e of a[1])a=f.TransitionKeyframe.Create(this,e),this._transitionKeyframes.push(a);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();b.AddCustomEase(this._name,(e,c,d,g)=>this.Interpolate(e,c,d,g))}static Create(a){return f.New(f.Transition,a)}Release(){for(const a of this._transitionKeyframes)a.Release();
f.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(a){const e=this._transitionKeyframeCache.get(a);if(e)return e;for(const c of this._transitionKeyframes)if(c.GetValueX()===a)return this._transitionKeyframeCache.set(a,c),c}GetFirstTransitionKeyFrameHigherThan(a){for(const e of this._transitionKeyframes)if(e.GetValueX()>
a)return e}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const e of this._transitionKeyframes)if(e.GetValueX()>=a)return e}GetFirstTransitionKeyFrameLowerOrEqualThan(a){for(let e=this._transitionKeyframes.length-1;0<=e;e--){const c=this._transitionKeyframes[e];if(c.GetValueX()<=a)return c}}Interpolate(a,e,c,d){var g=a/d;(a=this.GetTransitionKeyFrameAt(g))?d=this.GetFirstTransitionKeyFrameHigherThan(g):(a=this.GetFirstTransitionKeyFrameLowerOrEqualThan(g),d=this.GetFirstTransitionKeyFrameHigherOrEqualThan(g));
var k=d.GetValueX()-a.GetValueX();g=f.mapToRange(g,a.GetValueX(),d.GetValueX(),0,k);k=a.GetValueX();const m=a.GetValueY(),p=a.GetValueX()+a.GetStartAnchorX(),n=a.GetValueY()+a.GetStartAnchorY(),u=d.GetValueX()+d.GetEndAnchorX(),q=d.GetValueY()+d.GetEndAnchorY(),r=d.GetValueX();d=d.GetValueY();d=b.GetRuntimeEase("spline")(g,k,m,p,n,u,q,r,d,this._precalculatedSamples.get(a));d+=a.GetValueY();return(1-d)*e+d*(e+c)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let c=0;c<this._transitionKeyframes.length-
1;c++){var a=this._transitionKeyframes[c];if(!a.GetStartEnable())continue;var e=this._transitionKeyframes[c+1];const d=a.GetValueX(),g=a.GetValueX()+a.GetStartAnchorX(),k=e.GetValueX()+e.GetEndAnchorX();e=e.GetValueX();this._precalculatedSamples.set(a,b.GetBezierSamples(d,g,k,e))}}}}"use strict";
{const f=self.C3;f.TransitionKeyframe=class extends f.DefendedBase{constructor(b,a){super();this._transition=b;this._valueX=a[0];this._valueY=a[1];this._startAnchorX=a[2];this._startAnchorY=a[3];this._endAnchorX=a[4];this._endAnchorY=a[5];this._startEnable=a[6];this._endEnable=a[7]}Release(){this._transition=null}static Create(b,a){return f.New(f.TransitionKeyframe,b,a)}GetValueX(){return this._valueX}GetValueY(){return this._valueY}GetStartAnchorX(){return this._startAnchorX}GetStartAnchorY(){return this._startAnchorY}GetEndAnchorX(){return this._endAnchorX}GetEndAnchorY(){return this._endAnchorY}GetStartEnable(){return this._startEnable}GetEndEnable(){return this._endEnable}}}"use strict";
{const f=self.C3;f.TransitionManager=class extends f.DefendedBase{constructor(b){super();this._runtime=b;this._transitions=[]}Release(){for(const b of this._transitions)b.Release();f.clearArray(this._transitions);this._transitions=null}Create(b){this._transitions.push(f.Transition.Create(b))}}}"use strict";
{const f=self.C3;f.SolStack=class extends f.DefendedBase{constructor(b){super();this._objectClass=b;this._stack=[];this._stack.push(f.New(f.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const b of this._stack)b.Release();f.clearArray(this._stack);this._objectClass=this._current=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){var b=this._stack,a=++this._index;a===b.length?(a=f.New(f.Sol,this),
b.push(a),this._current=a):(b=b[a],b.Reset(),this._current=b)}PushCopy(){const b=this._stack,a=++this._index;a===b.length&&b.push(f.New(f.Sol,this));const e=b[a];e.Copy(b[a-1]);this._current=e}Pop(){this._current=this._stack[--this._index]}RemoveInstances(b){const a=this._stack;for(let e=0,c=a.length;e<c;++e)a[e].RemoveInstances(b)}}}"use strict";
{const f=self.C3;f.Sol=class extends f.DefendedBase{constructor(b){super();this._stack=b;this._objectClass=this._stack.GetObjectClass();this._eventStack=this._objectClass.GetRuntime().GetEventStack();this._selectAll=!0;this._instances=[];this._elseInstances=[]}Release(){this.ClearArrays();this._eventStack=this._objectClass=this._stack=null}ClearArrays(){f.clearArray(this._instances);f.clearArray(this._elseInstances)}GetObjectClass(){return this._objectClass}IsSelectAll(){return this._selectAll}HasAnyInstances(){return this._selectAll?
!!this._objectClass.GetInstanceCount():!!this._instances.length}GetInstances(){return this._selectAll?this._objectClass.GetInstances():this._instances}HasAnyElseInstances(){return!!this._elseInstances.length}GetElseInstances(){return this._elseInstances}GetExpressionInstances(){const b=this.GetInstances();return b.length?b:this._elseInstances}Reset(){this._selectAll=!0;f.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(b){b.IsSelectAll()?this.Reset():(this._selectAll=!1,f.shallowAssignArray(this._instances,
b._instances),f.clearArray(this._elseInstances))}_PushInstance(b){this._instances.push(b)}_PushElseInstance(b){this._elseInstances.push(b)}_SetSelectAll(b){this._selectAll=!!b}_GetOwnInstances(){return this._instances}_GetOwnElseInstances(){return this._elseInstances}SetSinglePicked(b){this._selectAll=!1;f.clearArray(this._instances);this._instances.push(b)}SetArrayPicked(b){this._selectAll=!1;f.shallowAssignArray(this._instances,b)}SetSetPicked(b){this._selectAll=!1;f.clearArray(this._instances);
for(const a of b)this._instances.push(a)}AddElseInstances(b,a){for(const e of a)b.has(e)||this._elseInstances.push(e)}TransferElseInstancesToOwn(b){for(const a of b)this._instances.push(a);f.arrayRemoveAllInSet(this._elseInstances,b)}PickOne(b){b&&(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()?(this.IsSelectAll()&&(f.clearArray(this._instances),f.shallowAssignArray(this._elseInstances,b.GetObjectClass().GetInstances()),this._selectAll=!1),b=this._elseInstances.indexOf(b),-1!==
b&&(this._instances.push(this._elseInstances[b]),this._elseInstances.splice(b,1))):this.SetSinglePicked(b))}RemoveInstances(b){f.arrayRemoveAllInSet(this._instances,b);f.arrayRemoveAllInSet(this._elseInstances,b)}}}"use strict";
{const f=self.C3;f.EventStack=class extends f.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._stack.push(f.New(f.EventStackFrame,this,null));this._index=0;this._expFuncStack=[]}Release(){for(const b of this._stack)b.Release();f.clearArray(this._stack);f.clearArray(this._expFuncStack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}Push(b){var a=
this._stack;const e=++this._index;if(e===a.length)return b=f.New(f.EventStackFrame,this,b),a.push(b),b;a=a[e];a.Reset(b);return a}Pop(){--this._index}PushExpFunc(b){this._expFuncStack.push(b)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const b=this._expFuncStack;return 0===b.length?null:b[b.length-1]}}}"use strict";
{const f=self.C3;f.EventStackFrame=class extends f.DefendedBase{constructor(b,a){super();this._stack=b;this._runtime=this._stack.GetRuntime();this._currentEvent=a;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1;this._expressionObjectClass=null;this._functionReturnValue=this._functionReturnType=0}Release(){this.Reset(null);this._runtime=this._stack=null}Reset(b){this._currentEvent=b;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1}_Restore(b,a){this._currentEvent=
b;this._cndIndex=0;this._actIndex=a}ResetQuick(){this._actIndex=this._cndIndex=0}GetCurrentEvent(){return this._currentEvent}SetCurrentEvent(b){this._currentEvent=b}GetConditionIndex(){return this._cndIndex}SetConditionIndex(b){this._cndIndex=b}GetActionIndex(){return this._actIndex}SetActionIndex(b){this._actIndex=b}SetLastEventTrue(b){this._lastEventTrue=!!b}GetLastEventTrue(){return this._lastEventTrue}SetElseBranchRan(b){this._elseBranchRan=!!b}GetElseBranchRan(){return this._elseBranchRan}SetExpressionObjectClass(b){this._expressionObjectClass=
b}GetExpressionObjectClass(){return this._expressionObjectClass}InitCallFunctionExpression(b,a){this._functionReturnType=b;this._functionReturnValue=a}GetFunctionReturnType(){return this._functionReturnType}SetFunctionReturnValue(b){this._functionReturnValue=b}GetFunctionReturnValue(){return this._functionReturnValue}IsSolModifierAfterCnds(){const b=this._currentEvent;return b.IsSolWriterAfterCnds()?!0:this._cndIndex<b.GetConditionCount()-1?!!b.GetSolModifiers().length:!1}}}"use strict";
{const f=self.C3;f.LocalVarStack=class extends f.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1;this._current=null;this._initialValues=[]}Release(){f.clearArray(this._stack);this._runtime=this._eventSheetManager=null}_SetInitialValues(b){this._initialValues=b;b=this._initialValues.slice(0);this._stack.push(b);this._index=0;this._current=b}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const b=
++this._index,a=this._stack;b===a.length?a.push(this._initialValues.slice(0)):f.shallowAssignArray(a[b],this._initialValues);this._current=a[b]}Pop(){this._current=this._stack[--this._index]}}}"use strict";
{const f=self.C3;f.LoopStack=class extends f.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1}Release(){f.clearArray(this._stack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}IsInLoop(){return 0<=this._index}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){var b=f.New(f.Loop,
this);this._stack.push(b);return b}b=this._stack[this._index];b.Reset();return b}Pop(){--this._index}FindByName(b){const a=this._stack;for(let e=this._index;0<=e;--e){const c=a[e];if(c.GetName()===b)return c}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}}"use strict";
{const f=self.C3;f.Loop=class extends f.DefendedBase{constructor(b){super();this._loopStack=b;this._name="";this._index=0;this._isStopped=!1;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=!1;this._end=NaN}SetName(b){this._name=b}GetName(){return this._name}SetIndex(b){this._index=b}GetIndex(){return this._index}Stop(){this._isStopped=!0}IsStopped(){return this._isStopped}SetEnd(b){this._end=b}GetEnd(){return this._end}}}"use strict";
{const f=self.C3;f.ArrayStack=class extends f.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){f.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const b=[];this._stack.push(b);return b}return this._stack[this._index]}Pop(){--this._index}}}"use strict";
{const f=self.C3;function b(e,c){return e.GetIndex()-c.GetIndex()}function a(e,c){for(let d=0,g=e.length;d<g;++d)if(e[d]!==c[d])return!1;return!0}f.EventSheetManager=class extends f.DefendedBase{constructor(e){super();this._runtime=e;this._allSheets=[];this._sheetsByName=new Map;this._allGroups=[];this._groupsByName=new Map;this._blocksBySid=new Map;this._cndsBySid=new Map;this._actsBySid=new Map;this._allUniqueSolModifiers=new Map;this._eventVarsBySid=new Map;this._nextLocalVarIndex=0;this._allGlobalVars=
[];this._allLocalVars=[];this._localVarInitialValues=[];this._functionBlocksByName=new Map;this._eventStack=f.New(f.EventStack,this);this._localVarStack=f.New(f.LocalVarStack,this);this._loopStack=f.New(f.LoopStack,this);this._triggersToPostInit=[];this._queuedTriggers=[];this._queuedDebugTriggers=[];this._blockFlushingDepth=this._executingTriggerDepth=this._runningEventsDepth=0;this._scheduledWaits=[];this._asyncActionPromises=[];self.c3_callFunction=(c,d)=>this._InvokeFunctionFromJS(c,d)}Release(){this.ClearAllScheduledWaits();
this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;f.clearArray(this._queuedTriggers);f.clearArray(this._queuedDebugTriggers);this._runtime=null;f.clearArray(this._allSheets);this._sheetsByName.clear()}Create(e){e=f.New(f.EventSheet,this,e);this._allSheets.push(e);this._sheetsByName.set(e.GetName().toLowerCase(),e)}_AddTriggerToPostInit(e){this._triggersToPostInit.push(e)}_PostInit(){for(const e of this._functionBlocksByName.values())e._PostInit(!1);
for(const e of this._allSheets)e._PostInit();for(const e of this._allSheets)e._UpdateDeepIncludes();for(const e of this._triggersToPostInit)e._PostInit(!1);f.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(e){return this._sheetsByName.get(e.toLowerCase())||null}_RegisterGroup(e){this._allGroups.push(e);this._groupsByName.set(e.GetGroupName(),e)}_RegisterEventBlock(e){this._blocksBySid.set(e.GetSID(),
e)}_RegisterCondition(e){this._cndsBySid.set(e.GetSID(),e)}_RegisterAction(e){this._actsBySid.set(e.GetSID(),e)}_RegisterFunctionBlock(e){this._functionBlocksByName.set(e.GetFunctionName().toLowerCase(),e)}_RegisterEventVariable(e){this._eventVarsBySid.set(e.GetSID(),e);e.IsGlobal()?this._allGlobalVars.push(e):this._allLocalVars.push(e)}_DeduplicateSolModifierList(e){2<=e.length&&e.sort(b);let c=this._allUniqueSolModifiers.get(e.length);c||(c=[],this._allUniqueSolModifiers.set(e.length,c));for(let d=
0,g=c.length;d<g;++d){const k=c[d];if(a(e,k))return k}c.push(e);return e}_GetNextLocalVarIndex(e){this._localVarInitialValues.push(e.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const e=this.GetCurrentEventStackFrame();return e.GetCurrentEvent().GetConditionAt(e.GetConditionIndex())}GetCurrentAction(){const e=
this.GetCurrentEventStackFrame();return e.GetCurrentEvent().GetActionAt(e.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetAllLocalVariablesInScope(e){const c=[];for(e=e.GetScopeParent();e;)f.appendArray(c,e._GetAllLocalVariablesInScope()),e=e.GetScopeParent();return c}_GetLocalVariablesScriptInterface(e){const c={};for(const d of this.GetAllLocalVariablesInScope(e))c[d.GetJsPropName()]=d._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,
c)}GetEventVariableBySID(e){return this._eventVarsBySid.get(e)||null}GetEventBlockBySID(e){return this._blocksBySid.get(e)||null}GetConditionBySID(e){return this._cndsBySid.get(e)||null}GetActionBySID(e){return this._actsBySid.get(e)||null}GetFunctionBlockByName(e){return this._functionBlocksByName.get(e.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const e of this._allGlobalVars)e.ResetToInitialValue()}GetEventGroupByName(e){return this._groupsByName.get(e.toLowerCase())||
null}GetEventGroupBySID(e){return(e=this._blocksBySid.get(e))&&e.IsGroup()?e:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const e of this._allGroups)e.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const e of this._allSheets)e._ResetHasRunFlag()}RunEvents(e){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const c of e.runningLayouts())if(e=c.GetEventSheet())this._runtime.PushCurrentLayout(c),e.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(e){this._ResetAllHasRunFlags();
this._runningEventsDepth++;for(const c of this._DebugRunEventsGen(e))await this._runtime.DebugBreak(c);this._runningEventsDepth--}*_DebugRunEventsGen(e){for(const c of e.runningLayouts())if(e=c.GetEventSheet())this._runtime.PushCurrentLayout(c),yield*e.DebugRun(),this._runtime.PopCurrentLayout()}_Trigger(e,c,d,g){let k=!1;if(!e.GetMainRunningLayout())return this.QueueTrigger(c,d,g);this._executingTriggerDepth++;for(const m of e.runningLayouts())if(e=m.GetEventSheet()){this._runtime.PushCurrentLayout(m);
for(const p of e.deepIncludes()){const n=p._Trigger(c,d,g);k=k||n}e=e._Trigger(c,d,g);k=k||e;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return k}*_DebugTrigger(e,c,d,g){let k=!1;if(!e.GetMainRunningLayout())return this.QueueTrigger(c,d,g);this._executingTriggerDepth++;for(const m of e.runningLayouts())if(e=m.GetEventSheet()){this._runtime.PushCurrentLayout(m);for(const p of e.deepIncludes()){const n=yield*p._DebugTrigger(c,d,g);k=k||n}e=yield*e._DebugTrigger(c,d,g);k=k||e;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;
return k}QueueTrigger(e,c,d){this._queuedTriggers.push([e,c,d]);return!1}QueueDebugTrigger(e,c,d){let g=null;const k=new Promise(m=>g=m);this._queuedDebugTriggers.push([e,c,d,g]);return k}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const e=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [c,d,g,k]=this._queuedDebugTriggers.shift(),m=yield*this._DebugTrigger(e,c,d,g);k(m)}}async RunQueuedDebugTriggersAsync(){for(const e of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(e)}_FastTrigger(e,
c,d,g){let k=!1;var m=e.GetMainRunningLayout();if(e=m.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(m);m=e.deepIncludes();for(let p=0,n=m.length;p<n;++p){const u=m[p]._FastTrigger(c,d,g);k=k||u}c=e._FastTrigger(c,d,g);k=k||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return k}}*_DebugFastTrigger(e,c,d,g){let k=!1;var m=e.GetMainRunningLayout();if(e=m.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(m);m=e.deepIncludes();
for(let p=0,n=m.length;p<n;++p){const u=yield*m[p]._DebugFastTrigger(c,d,g);k=k||u}c=yield*e._DebugFastTrigger(c,d,g);k=k||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return k}}GetTriggerDepth(){return this._executingTriggerDepth}IsInTrigger(){return 0<this.GetTriggerDepth()}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return 0<this._runningEventsDepth}IsInEventEngine(){return this.IsRunningEvents()||
this.IsInTrigger()}_RunQueuedTriggers(e){for(const [c,d,g]of this._queuedTriggers)this._Trigger(e,c,d,g);f.clearArray(this._queuedTriggers)}BlockFlushingInstances(e){e?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(e){for(let c=0,d=e.length;c<d;++c)e[c].GetSolStack().Clear()}PushCleanSol(e){for(let c=0,d=e.length;c<d;++c)e[c].GetSolStack().PushClean()}PushCopySol(e){for(let c=0,d=e.length;c<d;++c)e[c].GetSolStack().PushCopy()}PopSol(e){for(let c=
0,d=e.length;c<d;++c)e[c].GetSolStack().Pop()}AddScheduledWait(){const e=f.New(f.ScheduledWait,this);this._scheduledWaits.push(e);return e}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var e=this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let d=0,g=this._scheduledWaits.length;d<g;++d){const k=this._scheduledWaits[d];k._ShouldRun()&&k._Run(e);k.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var e=
this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let d=0,g=this._scheduledWaits.length;d<g;++d){const k=this._scheduledWaits[d];k._ShouldRun()&&await k._DebugRun(e);k.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const e=f.arrayFilterOut(this._scheduledWaits,c=>c.ShouldRelease());for(const c of e)c.Release()}ClearAllScheduledWaits(){for(const e of this._scheduledWaits)e.Release();f.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(e){for(const c of this._scheduledWaits)c.RemoveInstances(e)}AddAsyncActionPromise(e){this._asyncActionPromises.push(e)}ClearAsyncActionPromises(){f.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const e=
Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return e}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(e){this._LoadGroupsFromJson(e.groups);this._LoadCndsFromJson(e.cnds);this._LoadActsFromJson(e.acts);this._LoadVarsFromJson(e.vars);this._LoadScheduledWaitsFromJson(e.waits)}_SaveGroupsToJson(){const e={};for(const c of this.GetAllGroups())e[c.GetSID().toString()]=
c.IsGroupActive();return e}_LoadGroupsFromJson(e){for(const [c,d]of Object.entries(e))e=parseInt(c,10),(e=this.GetEventGroupBySID(e))&&e.SetGroupActive(d)}_SaveCndsToJson(){const e={};for(const [c,d]of this._cndsBySid){const g=d._SaveToJson();g&&(e[c.toString()]=g)}return e}_LoadCndsFromJson(e){const c=new Map;for(const [d,g]of Object.entries(e))c.set(parseInt(d,10),g);for(const [d,g]of this._cndsBySid)g._LoadFromJson(c.get(d)||null)}_SaveActsToJson(){const e={};for(const [c,d]of this._actsBySid){const g=
d._SaveToJson();g&&(e[c.toString()]=g)}return e}_LoadActsFromJson(e){const c=new Map;for(const [d,g]of Object.entries(e))c.set(parseInt(d,10),g);for(const [d,g]of this._actsBySid)g._LoadFromJson(c.get(d)||null)}_SaveVarsToJson(){const e={};for(const [c,d]of this._eventVarsBySid)d.IsConstant()||!d.IsGlobal()&&!d.IsStatic()||(e[c.toString()]=d.GetValue());return e}_LoadVarsFromJson(e){for(const [c,d]of Object.entries(e))e=parseInt(c,10),(e=this.GetEventVariableBySID(e))&&e.SetValue(d)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(e=>
!e.IsPromise()).map(e=>e._SaveToJson())}_LoadScheduledWaitsFromJson(e){this.ClearAllScheduledWaits();for(const c of e)(e=f.ScheduledWait._CreateFromJson(this,c))&&this._scheduledWaits.push(e)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(e=>e.GetEventSheet()).filter(e=>e).map(e=>e._GetPerfRecord())}FindFirstFunctionBlockParent(e){for(;e;){const c=e.GetScopeParent();if(c instanceof f.FunctionBlock)return c;e=e.GetParent()}return null}_InvokeFunctionFromJS(e,c){Array.isArray(c)||
(c=[]);e=this.GetFunctionBlockByName(e.toLowerCase());if(!e)return null;if(!e.IsEnabled())return e.GetDefaultReturnValue();var d=e.GetFunctionParameters();if(c.length<d.length){c=c.slice(0);do c.push(d[c.length].GetInitialValue());while(c.length<d.length)}d=e.GetEventBlock();return d.RunAsExpressionFunctionCall(d.GetSolModifiersIncludingParents(),e.GetReturnType(),e.GetDefaultReturnValue(),...c)}}}"use strict";
{const f=self.C3;f.EventSheet=class extends f.DefendedBase{constructor(b,a){super();this._eventSheetManager=b;this._runtime=b.GetRuntime();this._name=a[0];this._events=[];this._triggers=new Map;this._fastTriggers=new Map;this._eventsByDisplayNumber=new Map;this._hasRun=!1;this._shallowIncludes=[];this._deepIncludes=[];this._alreadyIncludedSheets=new Set;for(const e of a[1])this._CreateEvent(e,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,e){switch(b[0]){case 0:case 3:this._CreateEventBlock(b,a,e);break;case 1:this._CreateEventVariable(b,a,e);break;case 2:this._CreateInclude(b,a,e);break;case 4:this._CreateFunctionBlock(b,a);break;case 5:this._CreateScriptBlock(b,a,e);break;default:throw Error("invalid event type");}}_CreateEventBlock(b,a,e){b=f.EventBlock.Create(this,a,b);if(b.IsOrBlock()){e.push(b);e=b.GetConditions();for(let c=0,d=e.length;c<
d;++c)e[c].IsTrigger()&&this._InitTrigger(b,c)}else b.IsTrigger()?this._InitTrigger(b,0):e.push(b)}_CreateFunctionBlock(b,a){b=f.FunctionBlock.Create(this,a,b);this._eventSheetManager._RegisterFunctionBlock(b)}_CreateEventVariable(b,a,e){b=f.EventVariable.Create(this,a,b);e.push(b)}_CreateInclude(b,a,e){b=f.EventInclude.Create(this,a,b);e.push(b)}_CreateScriptBlock(b,a,e){b=f.EventScript.Create(this,a,b);e.push(b)}_InitTrigger(b,a){b.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(b);var e=
b.GetConditionAt(a),c=e._GetFunc(),d=e.GetObjectClass();if(e.IsFastTrigger()){var g=this._fastTriggers.get(d);g||(g=new Map,this._fastTriggers.set(d,g));e=e.GetFastTriggerValue().toLowerCase();d=g.get(c);d||(d=new Map,g.set(c,d));c=d.get(e);c||(c=[],d.set(e,c));c.push([b,a])}else g=this._triggers.get(d),g||(g={methodMap:new Map,behaviors:new Map},this._triggers.set(d,g)),(d=e.GetBehaviorType())?(e=g.behaviors.get(d),e||(e=new Map,g.behaviors.set(d,e))):e=g.methodMap,g=e.get(c),g||(g=[],e.set(c,g)),
g.push([b,a])}_PostInit(){const b=this._events;for(let a=0,e=b.length;a<e;++a){const c=a<e-1&&b[a+1]instanceof f.EventBlock&&b[a+1].IsElseBlock();b[a]._PostInit(c)}}_AddShallowInclude(b){this._shallowIncludes.push(b)}_UpdateDeepIncludes(){f.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(b){const a=b._deepIncludes,e=b._alreadyIncludedSheets;for(const c of this._shallowIncludes){const d=c.GetIncludeSheet();c.IsActive()&&b!==d&&!e.has(d)&&
(e.add(d),d._AddDeepIncludes(b),a.push(d))}}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(),e=a?performance.now():0;this._hasRun=!0;var c=this.GetEventSheetManager(),
d=c.GetCurrentEventStackFrame();for(const g of this._events)g.Run(d),c.ClearSol(g.GetSolModifiers()),c.ClearAsyncActionPromises(),b.FlushPendingInstances();d.Reset(null);a&&(this._perfRecord.totalTimeCounter+=performance.now()-e)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var b=this._runtime,a=this.GetEventSheetManager(),e=a.GetCurrentEventStackFrame();for(const c of this._events)yield*c.DebugRun(e),a.ClearSol(c.GetSolModifiers()),a.ClearAsyncActionPromises(),b.FlushPendingInstances();e.Reset(null)}}_Trigger(b,
a,e){if(a){const c=a.GetObjectClass();this._TriggerForClass(b,a,c,e);for(const d of c.GetFamilies())this._TriggerForClass(b,a,d,e)}else return this._TriggerForClass(b,a,null,null)}_TriggerForClass(b,a,e,c){e=this._triggers.get(e);if(!e)return!1;c=c?e.behaviors.get(c):e.methodMap;if(!c)return!1;c=c.get(b);if(!c)return!1;b=!1;for(const [d,g]of c)c=this._ExecuteTrigger(a,d,g),b=b||c;return b}*_DebugTrigger(b,a,e){if(a){const c=a.GetObjectClass();yield*this._DebugTriggerForClass(b,a,c,e);for(const d of c.GetFamilies())yield*this._DebugTriggerForClass(b,
a,d,e)}else return yield*this._DebugTriggerForClass(b,a,null,null)}*_DebugTriggerForClass(b,a,e,c){e=this._triggers.get(e);if(!e)return!1;c=c?e.behaviors.get(c):e.methodMap;if(!c)return!1;c=c.get(b);if(!c)return!1;b=!1;for(const [d,g]of c)c=d.DebugCanRunFast()?this._ExecuteTrigger(a,d,g):yield*this._DebugExecuteTrigger(a,d,g),b=b||c;return b}_FastTrigger(b,a,e){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;e=b.get(e);if(!e)return!1;b=!1;for(let c=0,d=e.length;c<
d;++c)a=e[c],a=this._ExecuteTrigger(null,a[0],a[1]),b=b||a;return b}*_DebugFastTrigger(b,a,e){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;e=b.get(e);if(!e)return!1;b=!1;for(let d=0,g=e.length;d<g;++d){var c=e[d];a=c[0];c=c[1];a=a.DebugCanRunFast()?this._ExecuteTrigger(null,a,c):yield*this._DebugExecuteTrigger(null,a,c);b=b||a}return b}_ExecuteTrigger(b,a,e){const c=this._runtime,d=this._eventSheetManager,g=d.GetCurrentEvent(),k=d.GetEventStack(),m=d.GetTriggerDepth();
let p=!1;g&&d.PushCleanSol(g.GetSolModifiersIncludingParents());d.PushCleanSol(a.GetSolModifiersIncludingParents());const n=1<m;n&&d.GetLocalVarStack().Push();const u=k.Push(a);b&&(a.GetConditions()[e].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const q=a.GetTriggerParents();for(let r=0,t=q.length;r<t;++r)if(!q[r].RunPreTrigger(u)){b=!1;break}}b&&(c.IncrementExecCount(),a.IsOrBlock()?a.RunOrBlockTrigger(u,e):a.Run(u),p=
u.GetLastEventTrue());k.Pop();n&&d.GetLocalVarStack().Pop();d.PopSol(a.GetSolModifiersIncludingParents());g&&d.PopSol(g.GetSolModifiersIncludingParents());g||1!==m||d.IsFlushingBlocked()||c.FlushPendingInstances();return p}*_DebugExecuteTrigger(b,a,e){const c=this._runtime,d=this._eventSheetManager,g=d.GetCurrentEvent(),k=d.GetEventStack(),m=d.GetTriggerDepth();let p=!1;g&&d.PushCleanSol(g.GetSolModifiersIncludingParents());d.PushCleanSol(a.GetSolModifiersIncludingParents());const n=1<m;n&&d.GetLocalVarStack().Push();
const u=k.Push(a);b&&(a.GetConditions()[e].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const q=a.GetTriggerParents();for(let r=0,t=q.length;r<t;++r)if(!(yield*q[r].DebugRunPreTrigger(u))){b=!1;break}}b&&(c.IncrementExecCount(),a.IsOrBlock()?yield*a.DebugRunOrBlockTrigger(u,e):yield*a.DebugRun(u),p=u.GetLastEventTrue());k.Pop();n&&d.GetLocalVarStack().Pop();d.PopSol(a.GetSolModifiersIncludingParents());g&&d.PopSol(g.GetSolModifiersIncludingParents());
g||1!==m||d.IsFlushingBlocked()||c.FlushPendingInstances();return p}_GetPerfRecord(){return this._perfRecord}}}"use strict";
{const f=self.C3,b=[];function a(c,d){return!0}function*e(c,d){return!0}f.EventBlock=class extends f.DefendedBase{constructor(c,d,g){super();this._eventSheet=c;this._runtime=c.GetRuntime();this._parent=d;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=!1;this._isOrBlock=!!g[2];this._isElseBlock=
!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=a;this._DebugRunActions=e;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=g[4];this._displayNumber=g[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:g[3][0],isBreakable:g[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,
canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===g[0]&&this._InitGroup(g[1]);c=0;for(var k of g[6])d=f.Condition.Create(this,k,c++),this._conditions.push(d),this._AddSolModifier(d.GetObjectClass());c=0;for(const m of g[7])k=f.Action.Create(this,m,c++),this._actions.push(k);if(9===g.length){g=g[8];for(const m of g)this._eventSheet._CreateEvent(m,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&&
this._conditions[0]._GetFunc()===f.Plugins.System.Cnds.Else);0===this._conditions.length&&(this._conditions=b);0===this._actions.length&&(this._actions=b);0===this._subEvents.length&&(this._subEvents=b)}static Create(c,d,g){return f.New(f.EventBlock,c,d,g)}_InitGroup(c){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!c[0];this._groupName=c[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);this._runtime.IsDebug()&&(this._perfRecord={type:"group",
name:c[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(c){this._containedIncludes.push(c)}_AddContainerSolModifierToList(c,d){for(const g of c.GetContainer().objectTypes())d.includes(g)||d.push(g)}_AddSolModifierToList(c,d){if(c)if(d.includes(c)||d.push(c),c.IsFamily())for(const g of c.GetFamilyMembers())g.IsInContainer()&&this._AddContainerSolModifierToList(g,d);else c.IsInContainer()&&this._AddContainerSolModifierToList(c,d)}_AddSolModifier(c){this._AddSolModifierToList(c,this._solModifiers)}_AddParentSolModifier(c){this._AddSolModifierToList(c,
this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(c){this._hasElseBlock=!!c;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const g of this._conditions)g._PostInit();if(0<this._actions.length){c=!1;for(var d of this._actions)d._PostInit(),d.HasReturnType()&&(c=!0);c?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions=
this._DebugRunActions_Fast)}d=this._subEvents;for(let g=0,k=d.length;g<k;++g)c=g<k-1&&d[g+1]instanceof f.EventBlock&&d[g+1].IsElseBlock(),d[g]._PostInit(c);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let c=this.GetParent();for(;c;){if(c.IsGroup())return c;c=c.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const c=this._debugData;c.canRunAllConditionsFast=
this._conditions.every(d=>d.DebugCanRunFast());c.canRunAllActionsFast=this._actions.every(d=>d.DebugCanRunFast());c.canRunAllSubEventsFast=this._subEvents.every(d=>d.DebugCanRunFast());c.canRunSelfFast=c.canRunAllConditionsFast&&c.canRunAllActionsFast&&c.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let c=this;do c._UpdateCanRunFast(),c=c.GetParent();while(c)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var c=this.GetParent();for(this._isTopLevelGroup=!0;c;){if(!c.IsGroup()){this._isTopLevelGroup=
!1;break}c=c.GetParent()}}}_IdentifySolModifiersIncludingParents(){var c=this._runtime.GetAllObjectClasses();if(this._solModifiers===c)this._solModifiersIncludingParents=c;else{this._solModifiersIncludingParents=f.cloneArray(this._solModifiers);for(c=this.GetParent();c;){for(var d of c._solModifiers)this._AddParentSolModifier(d);c=c.GetParent()}d=this.GetEventSheetManager();this._solModifiers=d._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=d._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=
[];for(var c=this.GetParent();c;)this._triggerParents.push(c),c=c.GetParent();this._triggerParents.reverse()}}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds=!0;this._parent&&this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){this._hasGotSolModifiersIncludingParents||(this._hasGotSolModifiersIncludingParents=!0,this._IdentifySolModifiersIncludingParents());return this._solModifiersIncludingParents}HasSolModifier(c){return this._solModifiers.includes(c)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(c){this._scopeParent=
c}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(c){this._debugData.isBreakpoint=!!c;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(c){c=
!!c;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==c){this._isGroupActive=c;for(const d of this._containedIncludes)d.UpdateActive();this._containedIncludes.length&&(c=this._runtime.GetCurrentLayout().GetEventSheet())&&c._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&&this._scopeParent instanceof f.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||
this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(c){c=Math.floor(c);if(0>c||c>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[c]}GetConditionByDebugIndex(c){return this.GetConditionAt(c)}IsFirstConditionOfType(c){let d=c.GetIndex();if(0===d)return!0;for(--d;0<=d;--d)if(this._conditions[d].GetObjectClass()===c.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(c){c=
Math.floor(c);if(0>c||c>=this._actions.length)throw new RangeError("invalid action index");return this._actions[c]}GetActionByDebugIndex(c){c=Math.floor(c);const d=this._actions.find(g=>g.GetDebugIndex()===c);if(!d)throw new RangeError("invalid action debug index");return d}_HasActionIndex(c){c=Math.floor(c);return 0<=c&&c<this._actions.length}GetSubEvents(){return this._subEvents}_GetAllLocalVariablesInScope(){return this._subEvents.filter(c=>c instanceof f.EventVariable)}RunPreTrigger(c){c.SetCurrentEvent(this);
let d=!1;const g=this._conditions;for(let k=0,m=g.length;k<m;++k){const p=g[k];c.SetConditionIndex(k);if(p.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(p.Run())d=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?d:!0}RunOrBlockTrigger(c,d){c.SetCurrentEvent(this);this._conditions[d].Run()&&(this._RunActions(c,0)&&this._RunSubEvents(c),c.SetLastEventTrue(!0))}*DebugRunPreTrigger(c){c.SetCurrentEvent(this);let d=!1;const g=this._conditions;for(let k=0,m=g.length;k<
m;++k){const p=g[k];c.SetConditionIndex(k);if(p.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(p.DebugCanRunFast()?p.Run():yield*p.DebugRun())d=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?d:!0}*DebugRunOrBlockTrigger(c,d){c.SetCurrentEvent(this);d=this._conditions[d];if(d.DebugCanRunFast()?d.Run():yield*d.DebugRun())(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():
yield*this._DebugRunSubEvents()),c.SetLastEventTrue(!0)}Run(c){c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(c):this._RunAndBlock(c)}*DebugRun(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(c):yield*this._DebugRunAndBlock(c)}_RunOrBlock(c){const d=this._conditions;let g=0===d.length;for(let m=0,p=d.length;m<p;++m){var k=
d[m];k.IsTrigger()||(c.SetConditionIndex(m),k=k.Run(),g=g||k)}c.SetLastEventTrue(g);g&&(this._RunActions(c,0)&&this._RunSubEvents(c),this._hasElseBlock&&c.SetElseBranchRan(!0))}*_DebugRunOrBlock(c){const d=this._conditions;let g=0===d.length;for(let m=0,p=d.length;m<p;++m){var k=d[m];k.IsTrigger()||(c.SetConditionIndex(m),k=k.DebugCanRunFast()?k.Run():yield*k.DebugRun(),g=g||k)}c.SetLastEventTrue(g);g&&((this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?
this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&c.SetElseBranchRan(!0))}_RunAndBlock(c){const d=this._conditions;for(let g=0,k=d.length;g<k;++g){const m=d[g];c.SetConditionIndex(g);if(!m.Run()){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);this._RunActions(c,0)&&this._RunSubEvents(c);c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}*_DebugRunAndBlock(c){const d=this._conditions;for(let g=0,k=d.length;g<k;++g){const m=d[g];c.SetConditionIndex(g);if(m.DebugCanRunFast()?
!m.Run():!(yield*m.DebugRun())){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}_RunActions_Fast(c,d){const g=this._actions;for(let k=d,m=g.length;k<m;++k)d=g[k],c.SetActionIndex(k),d.Run();return!0}*_DebugRunActions_Fast(c,d){const g=this._actions;for(let k=
d,m=g.length;k<m;++k)d=g[k],c.SetActionIndex(k),d.DebugCanRunFast()?d.Run():yield*d.DebugRun();return!0}_RunActions_ReturnValue(c,d){const g=this.GetEventSheetManager(),k=this._actions;for(let m=d,p=k.length;m<p;++m){d=k[m];c.SetActionIndex(m);const n=d.Run();if(d.CanBailOut()&&!0===n)return!1;d.IsAsync()&&n instanceof Promise&&g.AddAsyncActionPromise(n)}return!0}*_DebugRunActions_ReturnValue(c,d){const g=this.GetEventSheetManager(),k=this._actions;for(let m=d,p=k.length;m<p;++m){d=k[m];c.SetActionIndex(m);
let n;n=d.DebugCanRunFast()?d.Run():yield*d.DebugRun();if(d.CanBailOut()&&!0===n)return!1;d.IsAsync()&&n instanceof Promise&&g.AddAsyncActionPromise(n)}return!0}_ResumeActionsAndSubEvents(c){this._RunActions(c,c.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(c){if(yield*this._DebugRunActions(c,c.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var c=this.IsGroup()&&this._runtime.IsCPUProfiling(),d=c?performance.now():0,g=this._eventStack,
k=g.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(k):this._RunSubEvents_Fast(k);g.Pop();c&&(this._perfRecord.totalTimeCounter+=performance.now()-d)}}_RunSubEvents_SolWriterAfterCnds(c){const d=this._isGroup,g=this._isTopLevelGroup,k=this.GetEventSheetManager(),m=this._subEvents;for(let p=0,n=m.length,u=n-1;p<n;++p){const q=m[p],r=q.GetSolModifiers(),t=!g||!d&&p<u;t&&k.PushCopySol(r);q.Run(c);t?k.PopSol(r):k.ClearSol(r)}}_RunSubEvents_Fast(c){const d=this._subEvents;for(let g=
0,k=d.length;g<k;++g)d[g].Run(c)}*_DebugRunSubEvents(){if(this._subEvents.length){var c=this._eventStack,d=c.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(d):yield*this._DebugRunSubEvents_Fast(d);c.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(c){const d=this._isGroup,g=this._isTopLevelGroup,k=this.GetEventSheetManager(),m=this._subEvents;for(let p=0,n=m.length,u=n-1;p<n;++p){const q=m[p],r=q.GetSolModifiers(),t=!g||!d&&p<u;t&&k.PushCopySol(r);yield*q.DebugRun(c);
t?k.PopSol(r):k.ClearSol(r)}}*_DebugRunSubEvents_Fast(c){const d=this._subEvents;for(let g=0,k=d.length;g<k;++g)yield*d[g].DebugRun(c)}Retrigger(c,d){this._runtime.IncrementExecCount();d.ResetQuick();const g=this._conditions;if(!this.IsOrBlock())for(let k=c.GetConditionIndex()+1,m=g.length;k<m;++k)if(c=g[k],d.SetConditionIndex(k),!c.Run())return!1;this._RunActions(d,0)&&this._RunSubEvents(d);return!0}*DebugRetrigger(c,d){this._runtime.IncrementExecCount();d.ResetQuick();const g=this._conditions;if(!this.IsOrBlock())for(let k=
c.GetConditionIndex()+1,m=g.length;k<m;++k)if(c=g[k],d.SetConditionIndex(k),c.DebugCanRunFast()?!c.Run():!(yield*c.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(d,0):yield*this._DebugRunActions(d,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());return!0}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()&&this._debugData.canRunSelfFast}DebugCanRunActionsFast(){return!this._runtime.DebugBreakNext()&&this._debugData.canRunAllActionsFast}DebugCanRunSubEventsFast(){return!this._runtime.DebugBreakNext()&&
this._debugData.canRunAllSubEventsFast}_CheckParentsOKToRun(c){if(this.GetParent()){const d=this.GetTriggerParents();for(let g=0,k=d.length;g<k;++g)if(!d[g].RunPreTrigger(c))return!1}return!0}*_DebugCheckParentsOKToRun(c){if(this.GetParent()){const d=this.GetTriggerParents();for(let g=0,k=d.length;g<k;++g)if(!(yield*d[g].DebugRunPreTrigger(c)))return!1}return!0}_EvaluateFunctionCallParameters(c,d,g){0<d.length?g?(d=d.map(k=>k.Get(0)),c.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(d)):
this._scopeParent.EvaluateFunctionParameters(d):g&&c.GetLocalVarStack().Push()}RunAsFunctionCall(c,d){let g,k;const m=0<c.length;var p=this._runtime;const n=this._eventStack,u=p.GetEventSheetManager(),q=1<u._IncTriggerDepth();this._EvaluateFunctionCallParameters(u,d,q);m&&u.PushCleanSol(c);d=n.Push(this);this._CheckParentsOKToRun(d)&&(p.IncrementExecCount(),d.SetCurrentEvent(this),(p=this._scopeParent.IsAsync())&&([k,g]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(d),p&&this._scopeParent.MaybeFinishAsyncFunctionCall(k));
n.Pop();q&&u.GetLocalVarStack().Pop();m&&u.PopSol(c);u._DecTriggerDepth();return g}*DebugRunAsFunctionCall(c,d){let g,k;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const m=0<c.length;var p=this._runtime;const n=this._eventStack,u=p.GetEventSheetManager(),q=1<u._IncTriggerDepth();this._EvaluateFunctionCallParameters(u,d,q);m&&u.PushCleanSol(c);d=n.Push(this);if(yield*this._DebugCheckParentsOKToRun(d))p.IncrementExecCount(),d.SetCurrentEvent(this),(p=this._scopeParent.IsAsync())&&
([k,g]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(d),p&&this._scopeParent.MaybeFinishAsyncFunctionCall(k);n.Pop();q&&u.GetLocalVarStack().Pop();m&&u.PopSol(c);u._DecTriggerDepth();return g}RunAsMappedFunctionCall(c){const d=this.GetSolModifiersIncludingParents(),g=0<d.length,k=this._runtime,m=this._eventStack,p=k.GetEventSheetManager(),n=1<p._IncTriggerDepth();n&&p.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);g&&p.PushCleanSol(d);c=m.Push(this);
this._CheckParentsOKToRun(c)&&(k.IncrementExecCount(),c.SetCurrentEvent(this),this._RunAndBlock(c));m.Pop();n&&p.GetLocalVarStack().Pop();g&&p.PopSol(d);p._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const d=this.GetSolModifiersIncludingParents(),g=0<d.length,k=this._runtime,m=this._eventStack,p=k.GetEventSheetManager(),n=1<p._IncTriggerDepth();n&&p.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);g&&
p.PushCleanSol(d);c=m.Push(this);if(yield*this._DebugCheckParentsOKToRun(c))k.IncrementExecCount(),c.SetCurrentEvent(this),yield*this._DebugRunAndBlock(c);m.Pop();n&&p.GetLocalVarStack().Pop();g&&p.PopSol(d);p._DecTriggerDepth()}RunAsExpressionFunctionCall(c,d,g,...k){let m,p;const n=0<c.length,u=this._runtime,q=this._eventStack,r=u.GetEventSheetManager(),t=1<r._IncTriggerDepth();t&&r.GetLocalVarStack().Push();0<k.length&&this._scopeParent.SetFunctionParameters(k);n&&r.PushCleanSol(c);k=q.Push(this);
k.InitCallFunctionExpression(d,g);q.PushExpFunc(k);u.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(k)&&(u.IncrementExecCount(),k.SetCurrentEvent(this),(d=this._scopeParent.IsAsync())&&([p,m]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(k),d&&this._scopeParent.MaybeFinishAsyncFunctionCall(p));u.SetDebuggingEnabled(!0);q.Pop();q.PopExpFunc();t&&r.GetLocalVarStack().Pop();n&&r.PopSol(c);r._DecTriggerDepth();return m||k.GetFunctionReturnValue()}}}"use strict";
{const f=self.C3,b=[];let a=!1;f.EventScript=class extends f.DefendedBase{constructor(e,c,d){super();const g=e.GetRuntime(),k=e.GetEventSheetManager();this._eventSheet=e;this._eventSheetManager=k;this._runtime=e.GetRuntime();this._parent=c;this._func=g.GetObjectReference(d[1]);this._displayNumber=d[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=g.IsDebug()?{isBreakpoint:d[3][0],isBreakable:d[3][1]}:null}static Create(e,c,d){return f.New(f.EventScript,e,
c,d)}_PostInit(){const e=this._func,c=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=e.bind(null,this._runtime.GetIRuntime(),c)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(e){this._debugData.isBreakpoint=
!!e}IsElseBlock(){return!1}GetSolModifiers(){return b}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():b}Run(e){e.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(e){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",e),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(e){e.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(e)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return a}static SetHadUserScriptException(){a=!0}}}"use strict";
{const f=self.C3;f.FunctionBlock=class extends f.DefendedBase{constructor(b,a,e){super();this._eventSheet=b;this._runtime=b.GetRuntime();this._parent=a;const c=e[1];this._functionName=c[0];this._returnType=c[1];this._functionParameters=c[2].map(d=>f.EventVariable.Create(b,this,d));this._isEnabled=c[3];this._isAsync=c[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=f.EventBlock.Create(b,a,e);this._eventBlock._SetScopeParent(this)}static Create(b,a,e){return f.New(f.FunctionBlock,
b,a,e)}_PostInit(){for(const b of this._functionParameters)b._PostInit();this._eventBlock._PostInit(!1)}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}EvaluateFunctionParameters(b){const a=this._functionParameters;for(let e=0,c=a.length;e<c;++e)a[e].SetValue(b[e].Get(0))}SetFunctionParameters(b){const a=this._functionParameters;for(let e=0,c=a.length;e<c;++e)a[e].SetValue(b[e])}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 e=new Promise(c=>a=c);this._asyncMap.set(b,
{resolve:a,pauseCount:0});return[b,e]}MaybeFinishAsyncFunctionCall(b){const a=this._asyncMap.get(b);0===a.pauseCount&&(a.resolve(),this._asyncMap.delete(b));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){this._asyncMap.get(this._currentAsyncId).pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(b){this._currentAsyncId=b;this._asyncMap.get(b).pauseCount--}}}"use strict";
{const f=self.C3,b=[];f.EventVariable=class extends f.DefendedBase{constructor(a,e,c){super();const d=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=d;this._runtime=a.GetRuntime();this._parent=e;this._localVarStack=d.GetLocalVarStack();this._name=c[1];this._type=c[2];this._initialValue=c[3];this._isStatic=!!c[4];this._isConstant=!!c[5];this._isFunctionParameter=e instanceof f.FunctionBlock;this._sid=c[6];this._jsPropName=this._runtime.GetJsPropName(c[8]);this._scriptSetter=g=>
this.SetValue(g);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;this.IsBoolean()&&(this._value=this._value?1:0);!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=d._GetNextLocalVarIndex(this));d._RegisterEventVariable(this)}static Create(a,e,c){return f.New(f.EventVariable,a,e,c)}_PostInit(){}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return 0===
this._type}IsString(){return 1===this._type}IsBoolean(){return 2===this._type}IsElseBlock(){return!1}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return b}Run(a){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(a){this.Run(a)}SetValue(a){this.IsNumber()?"number"!==typeof a&&(a=parseFloat(a)):this.IsString()?"string"!==typeof a&&(a=a.toString()):this.IsBoolean()&&(a=a?1:0);this._hasSingleValue?
this._value=a:this._localVarStack.GetCurrent()[this._localIndex]=a}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let a=this.GetValue();this.IsBoolean()&&(a=!!a);return a}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}}"use strict";
{const f=self.C3,b=[];f.EventInclude=class extends f.DefendedBase{constructor(a,e,c){super();const d=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=d;this._runtime=a.GetRuntime();this._parent=e;this._includeSheet=null;this._includeSheetName=c[1];this._isActive=!0}static Create(a,e,c){return f.New(f.EventInclude,a,e,c)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let a=this.GetParent();
for(;a;)a instanceof f.EventBlock&&a.IsGroup()&&a._AddContainedInclude(this),a=a.GetParent();this.UpdateActive();this._runtime.IsDebug()&&this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return b}GetIncludeSheet(){return this._includeSheet}Run(a){a=!!this.GetParent();const e=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(e);this._includeSheet.Run();a&&this._eventSheetManager.PopSol(e)}*DebugRun(a){a=
!!this.GetParent();const e=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(e);yield*this._includeSheet.DebugRun();a&&this._eventSheetManager.PopSol(e)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let a=this.GetParent();for(;a;){if(a instanceof f.EventBlock&&a.IsGroup()&&!a.IsGroupActive()){this._isActive=!1;return}a=a.GetParent()}this._isActive=!0}}}"use strict";
{const f=self.C3;f.ExpNode=class extends f.DefendedBase{constructor(m){super();this._owner=m;this._runtime=m.GetRuntime()}_PostInit(){}static CreateNode(m,p){return f.New([g,c,d,k,b,a][p[0]],m,p)}};class b extends f.ExpNode{constructor(m,p){super(m);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(p[1]);this._func!==f.Plugins.System.Exps.random&&this._func!==f.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,
this._systemPlugin)}}class a extends f.ExpNode{constructor(m,p){super(m);this._functionBlock=null;this._functionName=p[1];this._owner.SetVariesPerInstance()}_PostInit(){const m=this._runtime.GetEventSheetManager();this._functionBlock=m.GetFunctionBlockByName(this._functionName);this._functionName=null;const p=this._owner.GetEventBlock(),n=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...p.GetSolModifiersIncludingParents(),...n.GetSolModifiersIncludingParents()])];this._combinedSolModifiers=
m._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const m=this._functionBlock;if(m.IsEnabled()){const p=m.GetEventBlock();return f.EventBlock.prototype.RunAsExpressionFunctionCall.bind(p,this._combinedSolModifiers,m.GetReturnType(),m.GetDefaultReturnValue())}{const p=m.GetDefaultReturnValue();return()=>p}}}function e(m,p){if(m>=p)return m%p;0>m&&(m<=-p&&(m%=p),0>m&&(m+=p));return m}class c extends f.ExpNode{constructor(m,p){super(m);this._objectClass=this._runtime.GetObjectClassByIndex(p[1]);
this._func=this._runtime.GetObjectReference(p[2]);this._returnsString=!!p[3];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}GetBoundMethod(){return this._objectClass.GetPlugin()._GetBoundACEMethod(this._func,this._objectClass.GetSingleGlobalInstance().GetSdkInstance())}ExpObject(...m){const p=this._objectClass,n=p.GetCurrentSol().GetExpressionInstances();var u=n.length;if(0===u)return this._returnsString?"":0;u=e(this._owner.GetSolIndex(),
u);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(p);return this._func.apply(n[u].GetSdkInstance(),m)}ExpObject_InstExpr(m,...p){const n=this._objectClass,u=n.GetInstances(),q=u.length;if(0===q)return this._returnsString?"":0;m=e(m,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(n);return this._func.apply(u[m].GetSdkInstance(),p)}}class d extends f.ExpNode{constructor(m,p){super(m);this._objectClass=this._runtime.GetObjectClassByIndex(p[1]);this._varIndex=p[3];
this._returnsString=!!p[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const m=this._objectClass.GetCurrentSol().GetExpressionInstances();var p=m.length;if(0===p)return this._returnsString?"":0;p=e(this._owner.GetSolIndex(),p);return m[p]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var m=this._objectClass,p=m.GetCurrentSol().GetExpressionInstances(),n=p.length;if(0===n)return this._returnsString?"":0;n=e(this._owner.GetSolIndex(),n);p=p[n];m=p.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex());
return p._GetInstanceVariableValueUnchecked(this._varIndex+m)}ExpInstVar_InstExpr(m){const p=this._objectClass;var n=p.GetInstances();const u=n.length;if(0===u)return this._returnsString?"":0;m=e(m,u);n=n[m];m=0;p.IsFamily()&&(m=n.GetObjectClass().GetFamilyInstanceVariableOffset(p.GetFamilyIndex()));return n._GetInstanceVariableValueUnchecked(this._varIndex+m)}}class g extends f.ExpNode{constructor(m,p){super(m);this._objectClass=this._runtime.GetObjectClassByIndex(p[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(p[2]);
this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(p[2]);this._func=this._runtime.GetObjectReference(p[3]);this._returnsString=!!p[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...m){const p=this._objectClass;var n=p.GetCurrentSol().GetExpressionInstances(),u=n.length;if(0===u)return this._returnsString?"":0;u=e(this._owner.GetSolIndex(),u);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(p);
n=n[u];u=0;p.IsFamily()&&(u=n.GetObjectClass().GetFamilyBehaviorOffset(p.GetFamilyIndex()));return this._func.apply(n.GetBehaviorInstances()[this._behaviorIndex+u].GetSdkInstance(),m)}ExpBehavior_InstExpr(m,...p){const n=this._objectClass;var u=n.GetInstances();const q=u.length;if(0===q)return this._returnsString?"":0;m=e(m,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(n);u=u[m];m=0;n.IsFamily()&&(m=u.GetObjectClass().GetFamilyBehaviorOffset(n.GetFamilyIndex()));return this._func.apply(u.GetBehaviorInstances()[this._behaviorIndex+
m].GetSdkInstance(),p)}}class k extends f.ExpNode{constructor(m,p){super(m);this._eventVar=null;this._eventVarSid=p[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}}"use strict";
{const f=self.C3;f.Parameter=class extends f.DefendedBase{constructor(z,D,G){super();this._owner=z;this._index=G;this._type=D;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(z,D,G){const w=D[0];return f.New([a,e,n,d,k,c,m,a,d,d,u,q,n,t,e,p,g,r,x][w],z,w,G,D)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(z){this._variesPerInstance||!z||z.GetPlugin().IsSingleGlobal()||(this._variesPerInstance=!0)}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}};
function b(z){z=self.C3_ExpressionFuncs[z];if(!z)throw Error("invalid expression number");return z}class a extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._solIndex=0;z=w[1];this._expressionNumber=z[0];this._numberedNodes=[];this._expressionFunc=null;for(let B=1,I=z.length;B<I;++B)this._numberedNodes.push(f.ExpNode.CreateNode(this,z[B]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=b(this._expressionNumber),this._isConstant=!0)}_GetNode(z){if(0>z||z>=this._numberedNodes.length)throw new RangeError("invalid numbered node");
return this._numberedNodes[z]}_PostInit(){for(var z of this._numberedNodes)z._PostInit();z=b(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?z(this):z}GetSolIndex(){return this._solIndex}GetExpression(z){this._solIndex=z;return this._expressionFunc()}}class e extends a{constructor(z,D,G,w){super(z,D,G,w);this.Get=this.GetStringExpression;14===D&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof f.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(z){this._solIndex=
z;z=this._expressionFunc();return"string"===typeof z?z:""}_GetFastTriggerValue(){return b(this._expressionNumber)()}}class c extends a{constructor(z,D,G,w){super(z,D,G,w);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(z){this._solIndex=z;z=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(z)}}class d extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._combo=w[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class g extends f.Parameter{constructor(z,
D,G,w){super(z,D,G);this._bool=w[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class k extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._objectClass=this.GetRuntime().GetObjectClassByIndex(w[1]);this.Get=this.GetObjectClass;z=this.GetEventBlock();z._AddSolModifier(this._objectClass);this._owner instanceof f.Action?z.SetSolWriterAfterCnds():z.GetParent()&&z.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}}
class m extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(w[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class p extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(w[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class n extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._fileInfo=
w[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class u extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._instVarIndex=w[1];(z=this._owner.GetObjectClass())&&z.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(z){z=z||0;const D=this._owner.GetObjectClass();var G=D.GetCurrentSol();const w=G.GetInstances();
if(w.length)z=w[z%w.length].GetObjectClass();else if(G.HasAnyElseInstances())G=G.GetElseInstances(),z=G[z%G.length].GetObjectClass();else if(0<D.GetInstanceCount())G=D.GetInstances(),z=G[z%G.length].GetObjectClass();else return 0;return this._instVarIndex+z.GetFamilyInstanceVariableOffset(D.GetFamilyIndex())}}class q extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._eventVarSid=w[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}}
class r extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._functionBlockName=w[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=!0}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}}class t extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let B=1,I=w.length;B<
I;++B)z=f.Parameter.Create(this._owner,w[B],0),this._subParams.push(z),this._variadicRet.push(0),z.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const z of this._subParams)z._PostInit()}GetVariadic(){const z=this._subParams,D=this._variadicRet;for(let G=0,w=z.length;G<w;++G)D[G]=z[G].Get(0);return D}}class x extends f.Parameter{constructor(z,D,G,w){super(z,D,G);this._easeIndex=w[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}}"use strict";
{const f=self.C3;function b(c,d){for(let g=0,k=c.length;g<k;++g)d[g]=c[g].Get(0)}const a=[],e=function(){};f.Condition=class extends f.DefendedBase{constructor(c,d,g){super();this._eventBlock=c;this._runtime=c.GetRuntime();this._index=g;this._func=this._runtime.GetObjectReference(d[1]);this._isTrigger=0<d[3];this._isFastTrigger=2===d[3];this._isLooping=!!d[4];this._isInverted=!!d[5];this._isStatic=!!d[6];this._sid=d[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType=this._objectClass=
null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=e;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:d[8][0],canDebug:d[8][1]}:null;-1===d[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(d[0]),d[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(d[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(d[2])),
this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===d.length){c=d[9];for(let k of c)this._parameters.push(f.Parameter.Create(this,k,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(c,d,g){return f.New(f.Condition,c,d,g)}_PostInit(){for(const c of this._parameters)c._PostInit(),c.VariesPerInstance()&&(this._anyParamVariesPerInstance=
!0);this._isFastTrigger?(this.Run=this._RunFastTrigger,this.DebugRun=this._DebugRunFastTrigger):this._systemPlugin?(this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this._isStatic?(this.Run=this._RunStatic,this.DebugRun=this._DebugRunStatic):(this.Run=this._RunObject,this.DebugRun=this._DebugRunObject)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const c=this._objectClass.GetPlugin(),d=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(c,d,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(c,d,g){const k=this._func,m=this._isInverted,p=this._parameters;if(0===p.length){const n=c._GetBoundACEMethod(k,d);this.Run=m?function(){return f.xor(n(),m)}:n}else if(1===p.length){const n=p[0];if(!m&&n.IsConstant())this.Run=c._GetBoundACEMethod_1param(k,
d,n.Get(0));else{const u=c._GetBoundACEMethod(k,d);this.Run=function(){return f.xor(u(n.Get(0)),m)}}}else if(2===p.length){const n=p[0],u=p[1];if(!m&&n.IsConstant()&&u.IsConstant())this.Run=c._GetBoundACEMethod_2params(k,d,n.Get(0),u.Get(0));else{const q=c._GetBoundACEMethod(k,d);this.Run=function(){return f.xor(q(n.Get(0),u.Get(0)),m)}}}else if(3===p.length){const n=p[0],u=p[1],q=p[2];if(!m&&n.IsConstant()&&u.IsConstant()&&q.IsConstant())this.Run=c._GetBoundACEMethod_3params(k,d,n.Get(0),u.Get(0),
q.Get(0));else{const r=c._GetBoundACEMethod(k,d);this.Run=function(){return f.xor(r(n.Get(0),u.Get(0),q.Get(0)),m)}}}else this.Run=g}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(c){this._debugData.isBreakpoint=
!!c;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const c=this._results;b(this._parameters,c);return f.xor(this._func.apply(this._systemPlugin,c),
this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);c=this._func.apply(this._systemPlugin,c);f.IsIterator(c)&&(c=yield*c);return f.xor(c,this._isInverted)}return this.Run()}_RunSingleGlobal(){const c=this._results;b(this._parameters,c);const d=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return f.xor(this._func.apply(d,c),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);const d=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();c=this._func.apply(d,c);f.IsIterator(c)&&(c=yield*c);return f.xor(c,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var c=this._results;b(this._parameters,c);c=this._func.apply(this._behaviorType||
this._objectClass,c);this._objectClass.ApplySolToContainer();return c}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);c=this._func.apply(this._behaviorType||this._objectClass,c);f.IsIterator(c)&&(c=yield*c);this._objectClass.ApplySolToContainer();return c}return this.Run()}_RunObject(){const c=this._parameters,d=this._results,g=this._objectClass.GetCurrentSol();for(let k=0,m=c.length;k<
m;++k){const p=c[k];p.VariesPerInstance()||(d[k]=p.Get(0))}return g.IsSelectAll()?this._RunObject_FirstFilter(g):this._RunObject_NextFilter(g)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(c){const d=this._parameters,g=this._results;for(let k=0,m=d.length;k<m;++k){const p=d[k];p.VariesPerInstance()&&(g[k]=p.Get(c))}}_RunObject_FirstFilter(c){const d=this._objectClass,g=d.IsFamily(),k=d.GetFamilyIndex(),m=this._behaviorIndex,
p=0<=m,n=d.GetInstances(),u=this._anyParamVariesPerInstance,q=this._results,r=this._func,t=this._isInverted,x=this._isInOrBlock&&!this._isTrigger;c.ClearArrays();for(let D=0,G=n.length;D<G;++D){const w=n[D];u&&this._EvaluateVaryingParameters(D);var z=void 0;p?(z=g?w.GetObjectClass().GetFamilyBehaviorOffset(k):0,z=r.apply(w.GetBehaviorInstances()[m+z].GetSdkInstance(),q)):z=r.apply(w.GetSdkInstance(),q);f.xor(z,t)?c._PushInstance(w):x&&c._PushElseInstance(w)}d.FinishCondition(!0);c._SetSelectAll(!1);
d.ApplySolToContainer();return c.HasAnyInstances()}_RunObject_NextFilter(c){const d=this._objectClass;var g=d.IsFamily();const k=d.GetFamilyIndex(),m=d.IsInContainer(),p=this._behaviorIndex,n=0<=p,u=this._anyParamVariesPerInstance,q=this._results,r=this._func,t=this._isInverted,x=this._isInOrBlock&&!this._isTrigger,z=c._GetOwnInstances(),D=c._GetOwnElseInstances(),G=x&&!this._eventBlock.IsFirstConditionOfType(this),w=G?D:z;let B=0,I=!1;for(let E=0,J=w.length;E<J;++E){const O=w[E];u&&this._EvaluateVaryingParameters(E);
var P=void 0;n?(P=g?O.GetObjectClass().GetFamilyBehaviorOffset(k):0,P=r.apply(O.GetBehaviorInstances()[p+P].GetSdkInstance(),q)):P=r.apply(O.GetSdkInstance(),q);f.xor(P,t)?(I=!0,G?(z.push(O),m&&O._PushSiblingsToSolInstances()):(w[B]=O,m&&O._SetSiblingsToSolInstancesIndex(B),++B)):G?(w[B]=O,m&&O._SetSiblingsToSolElseInstancesIndex(B),++B):x&&(D.push(O),m&&O._PushSiblingsToSolElseInstances())}f.truncateArray(w,B);m&&d._TruncateContainerSols(G,B);g=I;G&&!I&&(I=this._OrBlockCheckInstances(z));d.FinishCondition(g||
x);return x?I:c.HasAnyInstances()}_OrBlockCheckInstances(c){var d=this._objectClass;const g=d.IsFamily();d=d.GetFamilyIndex();const k=this._anyParamVariesPerInstance,m=this._behaviorIndex,p=0<=m,n=this._results,u=this._func,q=this._isInverted;for(let t=0,x=c.length;t<x;++t){var r=c[t];k&&this._EvaluateVaryingParameters(t);if(p){const z=g?r.GetObjectClass().GetFamilyBehaviorOffset(d):0;r=u.apply(r.GetBehaviorInstances()[m+z].GetSdkInstance(),n)}else r=u.apply(r.GetSdkInstance(),n);if(f.xor(r,q))return!0}return!1}ReevaluateParameter(c,
d){return this._parameters[c].Get(d)}GetFastTriggerValue(){const c=this._parameters;if(!c.length)throw Error("no parameters");return c[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const c={};for(const [d,g]of this._savedData.entries()){let k=g;"collmemory"===d&&(k=[...g.entries()].map(m=>[m[0].GetUID(),m[1].GetUID(),m[2]]));c[d]=k}return{ex:c}}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);if(c){var d=this._runtime,
g=c.ex;if(g){c=this.GetSavedDataMap();c.clear();for(const [k,m]of Object.entries(g))g=m,"collmemory"===k&&(g=f.New(f.PairMap,m.map(p=>[d.GetInstanceByUID(p[0]),d.GetInstanceByUID(p[1]),p[2]]).filter(p=>p[0]&&p[1]))),c.set(k,g)}}}}}"use strict";
{const f=self.C3;function b(d,g){for(let k=0,m=d.length;k<m;++k)g[k]=d[k].Get(0)}const a=[],e=function(){},c=function*(){};f.Action=class extends f.DefendedBase{constructor(d,g,k){super();this._eventBlock=d;this._runtime=d=d.GetRuntime();this._index=k;this._sid=4<=g.length?g[3]:-1;this._actionReturnType=5<=g.length?g[4]:0;this._behaviorType=this._objectClass=this._func=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._combinedSolModifiers=this._callEventBlock=null;
this.DebugRun=this.Run=e;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const m=(k=-3===g[0])?g[2]:g[5];this._debugData=d.IsDebug()||k?{isBreakpoint:m[0],canDebug:m[1],index:m[2]}:null;-1===g[0]?(this._systemPlugin=d.GetSystemPlugin(),this._func=d.GetObjectReference(g[1])):-2===g[0]?this._callFunctionName=g[1]:k?(this._func=d.GetObjectReference(g[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=
1):(this._func=d.GetObjectReference(g[1]),this._objectClass=d.GetObjectClassByIndex(g[0]),g[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(g[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(g[2])));if(7===g.length){g=g[6];for(const p of g)this._parameters.push(f.Parameter.Create(this,p,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(d,
g,k){return f.New(f.Action,d,g,k)}_PostInit(){for(var d of this._parameters)d._PostInit(),d.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){d=this._func;const g=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=d.bind(null,this._runtime.GetIRuntime(),
g)}else this._behaviorType?this.IsAsync()?(this.Run=this._RunBehavior_Async,this.DebugRun=this._DebugRunBehavior_Async):(this.Run=this._RunBehavior,this.DebugRun=this._DebugRunBehavior):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this.IsAsync()?(this.Run=this._RunObject_Async,this.DebugRun=this._DebugRunObject_Async):this._parameters.length?this._parameters.every(g=>g.VariesPerInstance())?(this.Run=this._RunObject_AllParamsVary,
this.DebugRun=this._DebugRunObject_AllParamsVary):this._anyParamVariesPerInstance?(this.Run=this._RunObject_SomeParamsVary,this.DebugRun=this._DebugRunObject_SomeParamsVary):this._parameters.every(g=>g.IsConstant())?(b(this._parameters,this._results),this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst):(this.Run=this._RunObject_ParamsDontVary,this.DebugRun=this._DebugRunObject_ParamsDontVary):(this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const d=this._objectClass.GetPlugin(),g=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(d,g,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const d=this._eventBlock.GetEventSheetManager(),g=d.GetFunctionBlockByName(this._callFunctionName);g.IsEnabled()?(this._callEventBlock=g.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],
this._combinedSolModifiers=d._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=f.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=e,this.DebugRun=c)}_SetRunMethodForBoundFunc(d,g,k){const m=this._func,p=this._parameters;if(0===p.length)this.Run=d._GetBoundACEMethod(m,g);else if(1===p.length){const n=p[0];if(n.IsConstant())this.Run=d._GetBoundACEMethod_1param(m,g,n.Get(0));
else{const u=d._GetBoundACEMethod(m,g);this.Run=function(){return u(n.Get(0))}}}else if(2===p.length){const n=p[0],u=p[1];if(n.IsConstant()&&u.IsConstant())this.Run=d._GetBoundACEMethod_2params(m,g,n.Get(0),u.Get(0));else{const q=d._GetBoundACEMethod(m,g);this.Run=function(){return q(n.Get(0),u.Get(0))}}}else if(3===p.length){const n=p[0],u=p[1],q=p[2];if(n.IsConstant()&&u.IsConstant()&&q.IsConstant())this.Run=d._GetBoundACEMethod_3params(m,g,n.Get(0),u.Get(0),q.Get(0));else{const r=d._GetBoundACEMethod(m,
g);this.Run=function(){return r(n.Get(0),u.Get(0),q.Get(0))}}}else this.Run=k}GetSID(){return this._sid}IsAsync(){return 1===this._actionReturnType}CanBailOut(){return 2===this._actionReturnType}HasReturnType(){return 0!==this._actionReturnType}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}GetCombinedSolModifiers(){return this._combinedSolModifiers}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(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 this._func.apply(this._systemPlugin,d)}*_DebugRunSystem(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const d=this._results;b(this._parameters,d);return yield*this._func.apply(this._systemPlugin,d)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const d=this._results;b(this._parameters,d);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),
d)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const d=this._results;b(this._parameters,d);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),d)}return this.Run()}_RunObject_ParamsConst(){const d=this._results,g=this._objectClass.GetCurrentSol().GetInstances();for(let k=0,m=g.length;k<m;++k)this._func.apply(g[k].GetSdkInstance(),d)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const d=this._results,g=this._objectClass.GetCurrentSol().GetInstances();for(let k=0,m=g.length;k<m;++k)yield*this._func.apply(g[k].GetSdkInstance(),d)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const d=this._results;b(this._parameters,d);const g=this._objectClass.GetCurrentSol().GetInstances();for(let k=0,m=g.length;k<m;++k)this._func.apply(g[k].GetSdkInstance(),d)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const d=this._results;b(this._parameters,d);const g=this._objectClass.GetCurrentSol().GetInstances();for(let k=0,m=g.length;k<m;++k)yield*this._func.apply(g[k].GetSdkInstance(),d)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const d=this._parameters,g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances();for(let p=0,n=m.length;p<n;++p){const u=m[p];for(let q=0,r=d.length;q<r;++q)g[q]=
d[q].Get(p);k.apply(u.GetSdkInstance(),g)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const d=this._parameters,g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances();for(let p=0,n=m.length;p<n;++p){const u=m[p];for(let q=0,r=d.length;q<r;++q)g[q]=d[q].Get(p);yield*k.apply(u.GetSdkInstance(),g)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const d=this._parameters,
g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances();for(let n=0,u=d.length;n<u;++n){var p=d[n];p.VariesPerInstance()||(g[n]=p.Get(0))}for(let n=0,u=m.length;n<u;++n){p=m[n];for(let q=0,r=d.length;q<r;++q){const t=d[q];t.VariesPerInstance()&&(g[q]=t.Get(n))}k.apply(p.GetSdkInstance(),g)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const g=this._parameters,k=this._results,m=this._func,
p=this._objectClass.GetCurrentSol().GetInstances();for(let n=0,u=g.length;n<u;++n){var d=g[n];d.VariesPerInstance()||(k[n]=d.Get(0))}for(let n=0,u=p.length;n<u;++n){d=p[n];for(let q=0,r=g.length;q<r;++q){const t=g[q];t.VariesPerInstance()&&(k[q]=t.Get(n))}yield*m.apply(d.GetSdkInstance(),k)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var d=this._objectClass;const g=d.IsFamily(),k=d.GetFamilyIndex(),m=this._parameters,p=this._anyParamVariesPerInstance,n=this._results,u=this._func,q=this._behaviorIndex;
d=d.GetCurrentSol().GetInstances();for(let x=0,z=m.length;x<z;++x){var r=m[x];r.VariesPerInstance()||(n[x]=r.Get(0))}for(let x=0,z=d.length;x<z;++x){r=d[x];if(p)for(let D=0,G=m.length;D<G;++D){var t=m[D];t.VariesPerInstance()&&(n[D]=t.Get(x))}t=g?r.GetObjectClass().GetFamilyBehaviorOffset(k):0;u.apply(r.GetBehaviorInstances()[q+t].GetSdkInstance(),n)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var d=this._objectClass;const m=
d.IsFamily(),p=d.GetFamilyIndex(),n=this._parameters,u=this._anyParamVariesPerInstance,q=this._results,r=this._func,t=this._behaviorIndex;d=d.GetCurrentSol().GetInstances();for(let x=0,z=n.length;x<z;++x){var g=n[x];g.VariesPerInstance()||(q[x]=g.Get(0))}for(let x=0,z=d.length;x<z;++x){g=d[x];if(u)for(let D=0,G=n.length;D<G;++D){var k=n[D];k.VariesPerInstance()&&(q[D]=k.Get(x))}k=m?g.GetObjectClass().GetFamilyBehaviorOffset(p):0;yield*r.apply(g.GetBehaviorInstances()[t+k].GetSdkInstance(),q)}}else this._RunBehavior()}_RunObject_Async(){const d=
this._parameters,g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances(),p=[];for(let n=0,u=m.length;n<u;++n){const q=m[n];for(let r=0,t=d.length;r<t;++r)g[r]=d[r].Get(n);p.push(k.apply(q.GetSdkInstance(),g))}return Promise.all(p)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const d=this._parameters,g=this._results,k=this._func,m=this._objectClass.GetCurrentSol().GetInstances(),p=[];for(let n=0,
u=m.length;n<u;++n){const q=m[n];for(let r=0,t=d.length;r<t;++r)g[r]=d[r].Get(n);p.push(yield*k.apply(q.GetSdkInstance(),g))}return Promise.all(p)}return this._RunObject_Async()}_RunBehavior_Async(){var d=this._objectClass;const g=d.IsFamily(),k=d.GetFamilyIndex(),m=this._parameters,p=this._results,n=this._func,u=this._behaviorIndex;d=d.GetCurrentSol().GetInstances();const q=[];for(let r=0,t=d.length;r<t;++r){const x=d[r];for(let D=0,G=m.length;D<G;++D)p[D]=m[D].Get(r);const z=g?x.GetObjectClass().GetFamilyBehaviorOffset(k):
0;q.push(n.apply(x.GetBehaviorInstances()[u+z].GetSdkInstance(),p))}return Promise.all(q)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var d=this._objectClass;const g=d.IsFamily(),k=d.GetFamilyIndex(),m=this._parameters,p=this._results,n=this._func,u=this._behaviorIndex;d=d.GetCurrentSol().GetInstances();const q=[];for(let r=0,t=d.length;r<t;++r){const x=d[r];for(let D=0,G=m.length;D<G;++D)p[D]=m[D].Get(r);const z=g?
x.GetObjectClass().GetFamilyBehaviorOffset(k):0;q.push(yield*n.apply(x.GetBehaviorInstances()[u+z].GetSdkInstance(),p))}return Promise.all(q)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(d){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;",d),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
f.EventScript.HadUserScriptException()||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),f.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{ex:f.ToSuperJSON(this._savedData)}:null}_LoadFromJson(d){this._savedData&&
(this._savedData.clear(),this._savedData=null);d&&(d=d.ex)&&(this._savedData=f.FromSuperJSON(d))}}}"use strict";
{const f=self.C3,b=new f.Color;function a(L,N){return f.compare(this.GetWorldInfo().GetX(),L,N)}function e(L,N){return f.compare(this.GetWorldInfo().GetY(),L,N)}function c(){const L=this.GetWorldInfo();return L.IsInViewport(L.GetLayer().GetViewport())}function d(){var L=this.GetWorldInfo();const N=L.GetLayout();L=L.GetBoundingBox();return 0>L.getRight()||0>L.getBottom()||L.getLeft()>N.GetWidth()||L.getTop()>N.GetHeight()}function g(L,N,V){const aa=this.GetCurrentSol(),fa=aa.GetInstances();if(!fa.length)return!1;
let ha=fa[0];var da=ha.GetWorldInfo();let sa=ha,ta=f.distanceSquared(da.GetX(),da.GetY(),N,V);for(let ya=1,Ha=fa.length;ya<Ha;++ya)if(ha=fa[ya],da=ha.GetWorldInfo(),da=f.distanceSquared(da.GetX(),da.GetY(),N,V),0===L&&da<ta||1===L&&da>ta)ta=da,sa=ha;aa.PickOne(sa);return!0}function k(L){const N=this.GetWorldInfo();N.GetX()!==L&&(N.SetX(L),N.SetBboxChanged())}function m(L){const N=this.GetWorldInfo();N.GetY()!==L&&(N.SetY(L),N.SetBboxChanged())}function p(L,N){const V=this.GetWorldInfo();V.EqualsXY(L,
N)||(V.SetXY(L,N),V.SetBboxChanged())}function n(L,N){if(L&&(L=L.GetPairedInstance(this._inst))){var [V,aa]=L.GetImagePoint(N);N=this.GetWorldInfo();if(N.GetX()!==V||N.GetY()!==aa)N.SetXY(V,aa),N.SetBboxChanged()}}function u(L){if(0!==L){var N=this.GetWorldInfo();N.OffsetXY(N.GetCosAngle()*L,N.GetSinAngle()*L);N.SetBboxChanged()}}function q(L,N){if(0!==N){var V=this.GetWorldInfo();L=f.toRadians(L);V.OffsetXY(Math.cos(L)*N,Math.sin(L)*N);V.SetBboxChanged()}}function r(){return this.GetWorldInfo().GetX()}
function t(){return this.GetWorldInfo().GetY()}function x(){return this._runtime.GetDt(this._inst)}function z(L,N){return f.compare(this.GetWorldInfo().GetWidth(),L,N)}function D(L,N){return f.compare(this.GetWorldInfo().GetHeight(),L,N)}function G(L){const N=this.GetWorldInfo();N.GetWidth()!==L&&(N.SetWidth(L),N.SetBboxChanged())}function w(L){const N=this.GetWorldInfo();N.GetHeight()!==L&&(N.SetHeight(L),N.SetBboxChanged())}function B(L,N){const V=this.GetWorldInfo();if(V.GetWidth()!==L||V.GetHeight()!==
N)V.SetSize(L,N),V.SetBboxChanged()}function I(){return this.GetWorldInfo().GetWidth()}function P(){return this.GetWorldInfo().GetHeight()}function E(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function J(){return this.GetWorldInfo().GetBoundingBox().getTop()}function O(){return this.GetWorldInfo().GetBoundingBox().getRight()}function R(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function T(L,N){return f.angleDiff(this.GetWorldInfo().GetAngle(),f.toRadians(N))<=f.toRadians(L)}
function Y(L){return f.angleClockwise(this.GetWorldInfo().GetAngle(),f.toRadians(L))}function W(L,N){L=f.toRadians(L);N=f.toRadians(N);const V=this.GetWorldInfo().GetAngle();return f.angleClockwise(N,L)?f.angleClockwise(V,L)&&!f.angleClockwise(V,N):!(!f.angleClockwise(V,L)&&f.angleClockwise(V,N))}function ea(L){const N=this.GetWorldInfo();L=f.clampAngle(f.toRadians(L));isNaN(L)||N.GetAngle()===L||(N.SetAngle(L),N.SetBboxChanged())}function qa(L){if(!isNaN(L)&&0!==L){var N=this.GetWorldInfo();N.SetAngle(N.GetAngle()+
f.toRadians(L));N.SetBboxChanged()}}function ja(L){if(!isNaN(L)&&0!==L){var N=this.GetWorldInfo();N.SetAngle(N.GetAngle()-f.toRadians(L));N.SetBboxChanged()}}function xa(L,N){const V=this.GetWorldInfo(),aa=V.GetAngle();L=f.angleRotate(aa,f.toRadians(N),f.toRadians(L));isNaN(L)||aa===L||(V.SetAngle(L),V.SetBboxChanged())}function ua(L,N,V){const aa=this.GetWorldInfo(),fa=aa.GetAngle();N-=aa.GetX();V-=aa.GetY();L=f.angleRotate(fa,Math.atan2(V,N),f.toRadians(L));isNaN(L)||fa===L||(aa.SetAngle(L),aa.SetBboxChanged())}
function Da(L,N){const V=this.GetWorldInfo(),aa=V.GetAngle();L-=V.GetX();N-=V.GetY();N=Math.atan2(N,L);isNaN(N)||aa===N||(V.SetAngle(N),V.SetBboxChanged())}function Ea(){return f.toDegrees(this.GetWorldInfo().GetAngle())}function Ba(L,N){return f.compare(f.round6dp(100*this.GetWorldInfo().GetOpacity()),L,N)}function Aa(){return this.GetWorldInfo().IsVisible()}function ia(L){const N=this.GetWorldInfo();L=2===L?!N.IsVisible():0!==L;N.IsVisible()!==L&&(N.SetVisible(L),this._runtime.UpdateRender())}function Fa(L){L=
f.clamp(L/100,0,1);const N=this.GetWorldInfo();N.GetOpacity()!==L&&(N.SetOpacity(L),this._runtime.UpdateRender())}function wa(L){b.setFromRgbValue(L);L=this.GetWorldInfo();L.GetUnpremultipliedColor().equalsIgnoringAlpha(b)||(L.SetUnpremultipliedColor(b),this._runtime.UpdateRender())}function Ca(){const L=this.GetWorldInfo().GetUnpremultipliedColor();return f.PackRGBAEx(L.getR(),L.getG(),L.getB(),L.getA())}function Pa(){return f.round6dp(100*this.GetWorldInfo().GetOpacity())}function Qa(L){return L?
this.GetWorldInfo().GetLayer()===L:!1}function Ra(L){const N=this.GetCurrentSol(),V=N.GetInstances();if(!V.length)return!1;let aa=V[0];for(let fa=1,ha=V.length;fa<ha;++fa){const da=V[fa],sa=da.GetWorldInfo(),ta=aa.GetWorldInfo(),ya=sa.GetLayer().GetIndex(),Ha=ta.GetLayer().GetIndex();if(0===L){if(ya>Ha||ya===Ha&&sa.GetZIndex()>ta.GetZIndex())aa=da}else if(ya<Ha||ya===Ha&&sa.GetZIndex()<ta.GetZIndex())aa=da}N.PickOne(aa);return!0}function Ja(L,N,V){const aa=this.GetWorldInfo();L=0===L?aa.GetZElevation():
aa.GetTotalZElevation();return f.compare(L,N,V)}function Sa(){this.GetWorldInfo().ZOrderMoveToTop()}function Ta(){this.GetWorldInfo().ZOrderMoveToBottom()}function Ua(L){L&&this.GetWorldInfo().ZOrderMoveToLayer(L)}function Va(L,N){L=0===L;N&&(N=N.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(N,L)}function Wa(L){const N=this.GetWorldInfo();N.GetZElevation()!==L&&(N.SetZElevation(L),this._runtime.UpdateRender())}function Xa(){return this.GetWorldInfo().GetLayer().GetIndex()}
function Ya(){return this.GetWorldInfo().GetLayer().GetName()}function Ka(){return this.GetWorldInfo().GetZIndex()}function Za(){return this.GetWorldInfo().GetZElevation()}function $a(){return this.GetWorldInfo().GetTotalZElevation()}function ab(L,N){if(N=this.GetObjectClass().GetEffectList().GetEffectTypeByName(N)){N=N.GetIndex();L=1===L;var V=this.GetWorldInfo().GetInstanceEffectList();V.IsEffectIndexActive(N)!==L&&(V.SetEffectIndexActive(N,L),V.UpdateActiveEffects(),this._runtime.UpdateRender())}}
function bb(L,N,V){var aa=this.GetObjectClass().GetEffectList().GetEffectTypeByName(L);if(aa){L=aa.GetIndex();var fa=this.GetWorldInfo().GetInstanceEffectList(),ha=fa.GetEffectParametersForIndex(L);N=Math.floor(N);if(!(0>N||N>=ha.length)){aa=aa.GetShaderProgram().GetParameterType(N);if("color"===aa){b.setFromRgbValue(V);N=ha[N];if(b.equalsIgnoringAlpha(N))return;N.copyRgb(b)}else{"percent"===aa&&(V/=100);if(ha[N]===V)return;ha[N]=V}fa.IsEffectIndexActive(L)&&this._runtime.UpdateRender()}}}function cb(){return this.GetWorldInfo().HasParent()}
function db(){return this.GetWorldInfo().HasChildren()}function eb(L,N){const V=this.GetCurrentSol().GetInstances();if(0===V.length)return!1;const aa=L.GetCurrentSol();var fa=aa.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ha=new Set;for(let sa=0,ta=V.length;sa<ta;++sa){var da=V[sa];if(1===N)for(const ya of da.parents())ya.BelongsToObjectClass(L)&&fa.has(ya)&&ha.add(ya);else{if(0===N){if(da=da.GetParent(),null===da)continue}else da=da.GetTopParent();da.BelongsToObjectClass(L)&&fa.has(da)&&
ha.add(da)}}if(0===ha.size)return!1;aa.SetSetPicked(ha);L.ApplySolToContainer();return!0}function fb(L,N){const V=this.GetCurrentSol().GetInstances();if(0===V.length)return!1;const aa=L.GetCurrentSol();var fa=aa.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ha=new Set;for(let da=0,sa=V.length;da<sa;++da){const ta=V[da];2===N&&!ta.HasChildren()&&ta.BelongsToObjectClass(L)&&fa.has(ta)&&ha.add(ta);for(const ya of 0===N?ta.children():ta.allChildren())2===N&&ya.HasChildren()||ya.BelongsToObjectClass(L)&&
fa.has(ya)&&ha.add(ya)}if(0===ha.size)return!1;aa.SetSetPicked(ha);L.ApplySolToContainer();return!0}function gb(L,N){const V=this.GetCurrentSol().GetInstances();if(0===V.length)return!1;const aa=L.GetCurrentSol();var fa=aa.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ha=[];for(let da=0,sa=V.length;da<sa;++da){const ta=V[da].GetChildAt(N);null!==ta&&ta.BelongsToObjectClass(L)&&fa.has(ta)&&ha.push(ta)}if(0===ha.length)return!1;aa.SetArrayPicked(ha);L.ApplySolToContainer();return!0}
function hb(L,N){return f.compare(this._inst.GetChildCount(),L,N)}function ib(L,N,V,aa,fa,ha,da,sa){const ta=this._inst,ya=this._runtime.GetCurrentAction().GetObjectClass();for(const Ha of L.allCorrespondingInstances(ta,ya)){if(!Ha.GetPlugin().SupportsSceneGraph())break;ta.AddChild(Ha,{transformX:N,transformY:V,transformWidth:aa,transformHeight:fa,transformAngle:ha,transformZElevation:da,destroyWithParent:sa})}}function jb(L){const N=this._inst,V=this._runtime.GetCurrentAction().GetObjectClass();
for(const aa of L.allCorrespondingInstances(N,V))N.RemoveChild(aa)}function ma(){this._inst.HasParent()&&this._inst.GetParent().RemoveChild(this._inst)}function Ga(){return this._inst.GetChildCount()}function kb(L,N){L=Math.floor(L);N=Math.floor(N);const V=this.GetWorldInfo();2>L||2>N||!isFinite(L)||!isFinite(N)?(V.ReleaseMesh(),V.SetBboxChanged()):V.CreateMesh(L,N)}function lb(L,N,V,aa,fa,ha,da){const sa=this.GetWorldInfo();sa.SetMeshPoint(L,N,{mode:0===V?"absolute":"relative",x:aa,y:fa,u:ha,v:da})&&
sa.SetBboxChanged()}function mb(){const L=this.GetWorldInfo();return L.HasMesh()?L.GetSourceMesh().GetHSize():0}function nb(){const L=this.GetWorldInfo();return L.HasMesh()?L.GetSourceMesh().GetVSize():0}function ob(L){const N=this.GetWorldInfo();L=2===L?!N.IsVisible():0!==L;N.IsVisible()!==L&&N.SetVisible(L)}function pb(L,N){this.SetElementCSSStyle(L,N)}function La(L,N){this.SetElementAttribute(L,""+N)}function Ma(L){this.RemoveElementAttribute(L)}function Na(){this.FocusElement()}function Oa(){this.BlurElement()}
function Ia(){return this.IsElementFocused()}function h(L){this._SetEnabled(0!==L)}function l(){return this._IsEnabled()}function v(L,N,V){return f.compare(this.GetInstance().GetInstanceVariableValue(L),N,V)}function y(L){return!!this.GetInstance().GetInstanceVariableValue(L)}function A(L,N){const V=this.GetCurrentSol(),aa=V.GetInstances();if(!aa.length)return!1;let fa=aa[0],ha=fa,da=fa.GetInstanceVariableValue(N);for(let sa=1,ta=aa.length;sa<ta;++sa){fa=aa[sa];const ya=fa.GetInstanceVariableValue(N);
if(0===L&&ya<da||1===L&&ya>da)da=ya,ha=fa}V.PickOne(ha);return!0}function C(L){return this._runtime.GetCurrentCondition().IsInverted()?H(this,L):F(this,L)}function F(L,N){N=L.GetRuntime().GetInstanceByUID(N);if(!N)return!1;const V=L.GetCurrentSol();if(!V.IsSelectAll()&&!V._GetOwnInstances().includes(N))return!1;if(L.IsFamily()){if(N.GetObjectClass().BelongsToFamily(L))return V.PickOne(N),L.ApplySolToContainer(),!0}else if(N.GetObjectClass()===L)return V.PickOne(N),L.ApplySolToContainer(),!0;return!1}
function H(L,N){const V=L.GetCurrentSol();if(V.IsSelectAll()){V._SetSelectAll(!1);V.ClearArrays();var aa=L.GetInstances();for(let ha=0,da=aa.length;ha<da;++ha){var fa=aa[ha];fa.GetUID()===N?V._PushElseInstance(fa):V._PushInstance(fa)}L.ApplySolToContainer();return!!V._GetOwnInstances().length}aa=V._GetOwnInstances();fa=0;for(let ha=0,da=aa.length;ha<da;++ha){const sa=aa[ha];aa[fa]=sa;sa.GetUID()===N?V._PushElseInstance(sa):++fa}f.truncateArray(aa,fa);L.ApplySolToContainer();return!!aa.length}function K(){this._runtime.DestroyInstance(this._inst)}
function M(){return!0}function Q(){return!0}function S(L,N){this.GetInstance().SetInstanceVariableValue(L,N)}function X(L,N){const V=this.GetInstance(),aa=V.GetInstanceVariableValue(L);"number"===typeof aa&&"number"!==typeof N?N=parseFloat(N):"string"===typeof aa&&"string"!==typeof N&&(N=N.toString());V.SetInstanceVariableValue(L,aa+N)}function U(L,N){const V=this.GetInstance(),aa=V.GetInstanceVariableValue(L);"number"===typeof aa&&("number"!==typeof N&&(N=parseFloat(N)),V.SetInstanceVariableValue(L,
aa-N))}function ca(L,N){this.GetInstance().SetInstanceVariableValue(L,N?1:0)}function ba(L){const N=this.GetInstance();N.SetInstanceVariableValue(L,0===N.GetInstanceVariableValue(L)?1:0)}function Z(L){let N;try{N=JSON.parse(L)}catch(V){console.error("Failed to load from JSON string: ",V);return}this.GetInstance().LoadFromJson(N,"state")}function ra(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function la(){return this.GetInstance().GetObjectClass().GetName()}function oa(){const L=
this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let N=L.GetInstanceCount();const V=this._runtime._GetInstancesPendingCreate();for(const aa of V)L.IsFamily()?aa.GetObjectClass().BelongsToFamily(L)&&++N:aa.GetObjectClass()===L&&++N;return N}function pa(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}function na(){return this._inst.GetIID()}function za(){return this._inst.GetUID()}f.AddCommonACEs=function(L,N){const V=
L[1],aa=L[4],fa=L[5],ha=L[6],da=L[7],sa=L[8],ta=L[10],ya=L[11],Ha=L[12],qb=L[13],rb=L[14],va=N.Cnds,ka=N.Acts;N=N.Exps;L[3]&&(va.CompareX=a,va.CompareY=e,va.IsOnScreen=c,va.IsOutsideLayout=d,va.PickDistance=g,ka.SetX=k,ka.SetY=m,ka.SetPos=p,ka.SetPosToObject=n,ka.MoveForward=u,ka.MoveAtAngle=q,N.X=r,N.Y=t,N.dt=x);aa&&(va.CompareWidth=z,va.CompareHeight=D,ka.SetWidth=G,ka.SetHeight=w,ka.SetSize=B,N.Width=I,N.Height=P,N.BBoxLeft=E,N.BBoxTop=J,N.BBoxRight=O,N.BBoxBottom=R);fa&&(va.AngleWithin=T,va.IsClockwiseFrom=
Y,va.IsBetweenAngles=W,ka.SetAngle=ea,ka.RotateClockwise=qa,ka.RotateCounterclockwise=ja,ka.RotateTowardAngle=xa,ka.RotateTowardPosition=ua,ka.SetTowardPosition=Da,N.Angle=Ea);ha&&(va.IsVisible=Aa,va.CompareOpacity=Ba,ka.SetVisible=ia,ka.SetOpacity=Fa,ka.SetDefaultColor=wa,N.Opacity=Pa,N.ColorValue=Ca);da&&(va.IsOnLayer=Qa,va.PickTopBottom=Ra,va.CompareZElevation=Ja,ka.MoveToTop=Sa,ka.MoveToBottom=Ta,ka.MoveToLayer=Ua,ka.ZMoveToObject=Va,ka.SetZElevation=Wa,N.LayerNumber=Xa,N.LayerName=Ya,N.ZIndex=
Ka,N.ZElevation=Za,N.TotalZElevation=$a);sa&&(ka.SetEffectEnabled=ab,ka.SetEffectParam=bb);qb&&(va.HasParent=cb,va.HasChildren=db,va.PickParent=eb,va.PickChildren=fb,va.PickNthChild=gb,va.CompareChildCount=hb,ka.AddChild=ib,ka.RemoveChild=jb,ka.RemoveFromParent=ma,N.ChildCount=Ga);rb&&(ka.SetMeshSize=kb,ka.SetMeshPoint=lb,N.MeshColumns=mb,N.MeshRows=nb);ta&&(va.IsVisible=Aa,ka.SetVisible=ob,ka.SetCSSStyle=pb,ka.SetElemAttribute=La,ka.RemoveElemAttribute=Ma);ya&&(va.IsFocused=Ia,ka.SetFocus=Na,ka.SetBlur=
Oa);Ha&&(va.IsEnabled=l,ka.SetEnabled=h);V||(va.CompareInstanceVar=v,va.IsBoolInstanceVarSet=y,va.PickInstVarHiLow=A,va.PickByUID=C,ka.SetInstanceVar=S,ka.AddInstanceVar=X,ka.SubInstanceVar=U,ka.SetBoolInstanceVar=ca,ka.ToggleBoolInstanceVar=ba,va.OnCreated=M,va.OnDestroyed=Q,ka.Destroy=K,ka.LoadFromJsonString||(ka.LoadFromJsonString=Z),N.AsJSON||(N.AsJSON=ra),N.Count=oa,N.PickedCount=pa,N.IID=na,N.UID=za,N.ObjectTypeName=la)}}"use strict";
{const f=self.C3;f.ScheduledWait=class extends f.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._type="";this._time=-1;this._signalTag="";this._isSignalled=!1;this._event=null;this._actIndex=0;this._solModifiers=[];this._sols=new Map;this._callingFunctionBlock=null;this._asyncId=-1;this._functionParameters=null;this._shouldRelease=!1}Release(){this._type="";this._time=-1;this._signalTag="";this._functionParameters=this._callingFunctionBlock=this._event=null;this._asyncId=-1;f.clearArray(this._solModifiers);
for(const b of this._sols.values())b.Release();this._sols.clear()}_Init(){var b=this._eventSheetManager,a=b.GetRuntime().GetAllObjectClasses();const e=b.GetCurrentEventStackFrame();this._event=e.GetCurrentEvent();this._actIndex=e.GetActionIndex()+1;if(b=b.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=b,this._functionParameters=b.CaptureFunctionParameters(),b.IsAsync()&&(this._asyncId=b.PauseCurrentAsyncFunction());for(const c of a)if(a=c.GetCurrentSol(),!a.IsSelectAll()||this._event.HasSolModifier(c))this._solModifiers.push(c),
this._sols.set(c,f.New(f.SolState,a))}InitTimer(b){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+b}InitSignal(b){this._type="signal";this._Init();this._signalTag=b.toLowerCase()}InitPromise(b){this._type="promise";this._Init();b.then(()=>this.SetSignalled()).catch(a=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",a);this.SetSignalled()})}IsTimer(){return"timer"===this._type}IsSignal(){return"signal"===this._type}IsPromise(){return"promise"===
this._type}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=!0}_ShouldRun(){return this.IsTimer()?this._time<=this._eventSheetManager.GetRuntime().GetGameTime():this.IsSignalled()}_RestoreState(b){b._Restore(this._event,this._actIndex);for(const [a,e]of this._sols.entries())b=a.GetCurrentSol(),e._Restore(b);if(b=this._callingFunctionBlock)b.SetFunctionParameters(this._functionParameters),b.IsAsync()&&b.ResumeAsyncFunction(this._asyncId)}_Run(b){this._RestoreState(b);
this._event._ResumeActionsAndSubEvents(b);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}async _DebugRun(b){this._RestoreState(b);for(const a of this._event._DebugResumeActionsAndSubEvents(b))await this._eventSheetManager.GetRuntime().DebugBreak(a);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);
this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(b){for(const a of this._sols.values())a.RemoveInstances(b)}_SaveToJson(){const b={},a={t:this._time,st:this._signalTag,s:this._isSignalled,ev:this._event.GetSID(),sm:this._solModifiers.map(e=>e.GetSID()),sols:b};this._event._HasActionIndex(this._actIndex)&&(a.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [e,c]of this._sols)b[e.GetSID().toString()]=
c._SaveToJson();return a}static _CreateFromJson(b,a){const e=b.GetRuntime();var c=b.GetEventBlockBySID(a.ev);if(!c)return null;let d=0;if(a.hasOwnProperty("act")){var g=b.GetActionBySID(a.act);if(!g)return null;d=g.GetIndex()}g=f.New(f.ScheduledWait,b);g._time=a.t;g._type=-1===g._time?"signal":"timer";g._signalTag=a.st;g._isSignalled=a.s;g._event=c;g._actIndex=d;for(var k of a.sm)(c=e.GetObjectClassBySID(k))&&g._solModifiers.push(c);for(const [m,p]of Object.entries(a.sols))if(a=parseInt(m,10),a=e.GetObjectClassBySID(a))k=
f.New(f.SolState,null),k._LoadFromJson(b,p),g._sols.set(a,k);return g}}}"use strict";
{const f=self.C3;f.SolState=class extends f.DefendedBase{constructor(b){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];b&&(this._objectClass=b.GetObjectClass(),this._isSelectAll=b.IsSelectAll(),f.shallowAssignArray(this._instances,b._GetOwnInstances()))}Release(){this._objectClass=null;f.clearArray(this._instances)}_Restore(b){b._SetSelectAll(this._isSelectAll);f.shallowAssignArray(b._GetOwnInstances(),this._instances)}RemoveInstances(b){f.arrayRemoveAllInSet(this._instances,
b)}_SaveToJson(){return{sa:this._isSelectAll,insts:this._instances.map(b=>b.GetUID())}}_LoadFromJson(b,a){b=b.GetRuntime();this._isSelectAll=!!a.sa;f.clearArray(this._instances);for(const e of a.insts)(a=b.GetInstanceByUID(e))&&this._instances.push(a)}}}"use strict";
{const f=self.C3;function b(a,e){let c=a.get(e);c||(c=new Map,a.set(e,c));return c}f.SDKPluginBase=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._isSingleGlobal=!!a.isSingleGlobal;this._isWorldType=!!a.isWorld;this._isRotatable=!!a.isRotatable;this._mustPredraw=!!a.mustPredraw;this._hasEffects=!!a.hasEffects;this._supportsSceneGraph=!!a.supportsSceneGraph;this._supportsMesh=!!a.supportsMesh;this._singleGlobalObjectClass=null;this._boundACEMethodCache=new Map;this._boundACEMethodCache_1param=
new Map;this._boundACEMethodCache_2params=new Map;this._boundACEMethodCache_3params=new Map}Release(){this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}IsSingleGlobal(){return this._isSingleGlobal}IsWorldType(){return this._isWorldType}IsRotatable(){return this._isRotatable}MustPreDraw(){return this._mustPredraw}HasEffects(){return this._hasEffects}SupportsSceneGraph(){return this._supportsSceneGraph}SupportsMesh(){return this._supportsMesh}_GetBoundACEMethod(a,e){if(!e)throw Error("missing 'this' binding");
let c=this._boundACEMethodCache.get(a);if(c)return c;c=a.bind(e);this._boundACEMethodCache.set(a,c);return c}_GetBoundACEMethod_1param(a,e,c){if(!e)throw Error("missing 'this' binding");const d=b(this._boundACEMethodCache_1param,a);let g=d.get(c);if(g)return g;g=a.bind(e,c);d.set(c,g);return g}_GetBoundACEMethod_2params(a,e,c,d){if(!e)throw Error("missing 'this' binding");var g=b(this._boundACEMethodCache_2params,a);g=b(g,c);let k=g.get(d);if(k)return k;k=a.bind(e,c,d);g.set(d,k);return k}_GetBoundACEMethod_3params(a,
e,c,d,g){if(!e)throw Error("missing 'this' binding");var k=b(this._boundACEMethodCache_3params,a);k=b(k,c);k=b(k,d);let m=k.get(g);if(m)return m;m=a.bind(e,c,d,g);k.set(g,m);return m}_SetSingleGlobalObjectClass(a){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");this._singleGlobalObjectClass=a}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");
return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}}"use strict";
{const f=self.C3;f.SDKDOMPluginBase=class extends f.SDKPluginBase{constructor(b,a){super(b);this._domComponentId=a;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",e=>e._OnElemFocused());this.AddElementMessageHandler("elem-blurred",e=>{e&&e._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,e=>{const c=this._instMap.get(e.elementId);a(c,e)})}}}"use strict";{const f=self.C3;f.SDKTypeBase=class extends f.DefendedBase{constructor(b){super();this._objectClass=b;this._runtime=b.GetRuntime();this._plugin=b.GetPlugin()}Release(){this._plugin=this._runtime=this._objectClass=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}FinishCondition(b){}LoadTextures(b){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(b){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}}}"use strict";
{const f=self.C3;f.SDKInstanceBase=class extends f.DefendedBase{constructor(b,a){super();this._inst=b;this._domComponentId=a;this._runtime=b.GetRuntime();this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._tick2Func=this._tickFunc=null;this._isTicking2=this._isTicking=!1;this._disposables=null;this._wasReleased=!1}Release(){this._wasReleased=!0;this._StopTicking();this._StopTicking2();this._tick2Func=this._tickFunc=null;this._disposables&&(this._disposables.Release(),
this._disposables=null);this._sdkType=this._objectClass=this._runtime=this._inst=null}WasReleased(){return this._wasReleased}GetInstance(){return this._inst}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetPlugin(){return this._sdkType.GetPlugin()}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._inst.GetInterfaceClass()}Trigger(b){return this._runtime.Trigger(b,this._inst,null)}DebugTrigger(b){return this._runtime.DebugTrigger(b,this._inst,null)}TriggerAsync(b){return this._runtime.TriggerAsync(b,
this._inst,null)}FastTrigger(b,a){return this._runtime.FastTrigger(b,this._inst,a)}DebugFastTrigger(b,a){return this._runtime.DebugFastTrigger(b,this._inst,a)}ScheduleTriggers(b){return this._runtime.ScheduleTriggers(b)}AddDOMMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,b,a)}AddDOMMessageHandlers(b){for(const [a,e]of b)this.AddDOMMessageHandler(a,e)}PostToDOM(b,a){this._runtime.PostComponentMessageToDOM(this._domComponentId,b,a)}PostToDOMAsync(b,a){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,
b,a)}_PostToDOMMaybeSync(b,a){if(this._runtime.IsInWorker())this.PostToDOM(b,a);else return window.c3_runtimeInterface._OnMessageFromRuntime({type:"event",component:this._domComponentId,handler:b,data:a,responseId:null})}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){var b=this.GetCurrentImageInfo();return b&&(b=b.GetTexture())?[b.GetWidth(),b.GetHeight()]:[100,100]}GetCurrentTexRect(){const b=this.GetCurrentImageInfo();return b?b.GetTexRect():null}GetImagePoint(b){b=this._inst.GetWorldInfo();
return[b.GetX(),b.GetY()]}Tick(){}Tick2(){}_StartTicking(){this._isTicking||(this._tickFunc||(this._tickFunc=()=>this.Tick()),this._runtime.Dispatcher().addEventListener("tick",this._tickFunc),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._tick2Func||(this._tick2Func=()=>this.Tick2()),this._runtime.Dispatcher().addEventListener("tick2",
this._tick2Func),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(b){}LoadTilemapData(b,a,e){}TestPointOverlapTile(b,a){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var e=this.GetPropertyValueByIndex(b);if("number"!==typeof e)throw Error("expected number");
this.SetPropertyValueByIndex(b,e+a)}}SetPropertyColorOffsetValueByIndex(b,a,e,c){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}}}"use strict";
{const f=self.C3;f.SDKWorldInstanceBase=class extends f.SDKInstanceBase{constructor(b,a){super(b,a);this._worldInfo=b.GetWorldInfo();this._webglcontextrestored_handler=this._webglcontextlost_handler=null}Release(){if(this._webglcontextlost_handler){const b=this._runtime.Dispatcher();b.removeEventListener("webglcontextlost",this._webglcontextlost_handler);b.removeEventListener("webglcontextrestored",this._webglcontextrestored_handler);this._webglcontextrestored_handler=this._webglcontextlost_handler=
null}this._worldInfo=null;super.Release()}HandleWebGLContextLoss(){if(!this._webglcontextlost_handler){this._webglcontextlost_handler=()=>this.OnWebGLContextLost();this._webglcontextrestored_handler=()=>this.OnWebGLContextRestored();var b=this._runtime.Dispatcher();b.addEventListener("webglcontextlost",this._webglcontextlost_handler);b.addEventListener("webglcontextrestored",this._webglcontextrestored_handler)}}OnWebGLContextLost(){}OnWebGLContextRestored(){}GetWorldInfo(){return this._worldInfo}}}"use strict";
{const f=self.C3,b=f.New(f.Rect);f.SDKDOMInstanceBase=class extends f.SDKWorldInstanceBase{constructor(a,e){super(a,e);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=this._elemHasFocus=!1;this._lastRect=f.New(f.Rect,0,0,-1,-1);a=this._runtime.GetCanvasManager();this._lastWindowWidth=a.GetLastWidth();this._lastWindowHeight=a.GetLastHeight();this._isPendingUpdateState=!1;this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId);
this.PostToDOMElement("destroy");this._elementId=-1;super.Release()}_GetElementInDOMMode(){if(this._runtime.IsInWorker())throw Error("not valid in worker mode");return this._PostToDOMElementMaybeSync("get-element")}PostToDOMElement(a,e){e||(e={});e.elementId=this._elementId;this.PostToDOM(a,e)}_PostToDOMElementMaybeSync(a,e){e||(e={});e.elementId=this._elementId;return this._PostToDOMMaybeSync(a,e)}PostToDOMElementAsync(a,e){e||(e={});e.elementId=this._elementId;return this.PostToDOMAsync(a,e)}CreateElement(a){a||
(a={});const e=this.GetWorldInfo().IsVisible();a.elementId=this._elementId;a.isVisible=e;Object.assign(a,this.GetElementState());this._isElementShowing=!!a.isVisible;this._PostToDOMMaybeSync("create",a);this._UpdatePosition(!0)}SetElementVisible(a){a=!!a;this._isElementShowing!==a&&(this._isElementShowing=a,this.PostToDOMElement("set-visible",{isVisible:a}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const a=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===f.Platform.OS&&
("scale-inner"===a||"scale-outer"===a||"crop"===a)}_UpdatePosition(a){var e=this.GetWorldInfo();const c=e.GetLayer();var d=e.GetX(),g=e.GetY();let [k,m]=c.LayerToCanvasCss(d,g),[p,n]=c.LayerToCanvasCss(d+e.GetWidth(),g+e.GetHeight());d=this._runtime.GetCanvasManager();g=d.GetCssWidth();const u=d.GetCssHeight();if(e.IsVisible()&&c.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=p||0>=n||k>=g||m>=u){this.SetElementVisible(!1);return}1>k&&(k=1);1>m&&(m=1);p>=g&&(p=g-1);n>=u&&(n=u-1)}b.set(k,m,
p,n);e=d.GetLastWidth();g=d.GetLastHeight();!a&&b.equals(this._lastRect)&&this._lastWindowWidth===e&&this._lastWindowHeight===g?this.SetElementVisible(!0):(this._lastRect.copy(b),this._lastWindowWidth=e,this._lastWindowHeight=g,this.SetElementVisible(!0),a=null,this._autoFontSize&&(a=c.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+d.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+d.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,e){this.PostToDOMElement("set-css-style",{prop:f.CSSToCamelCase(a),val:e})}SetElementAttribute(a,e){this.PostToDOMElement("set-attribute",
{name:a,val:e})}RemoveElementAttribute(a){this.PostToDOMElement("remove-attribute",{name:a})}UpdateElementState(){this._isPendingUpdateState||(this._isPendingUpdateState=!0,Promise.resolve().then(()=>{this._isPendingUpdateState=!1;this.PostToDOMElement("update-state",this.GetElementState())}))}GetElementState(){}GetElementId(){return this._elementId}}}"use strict";
{const f=self.C3,b=self.IBehavior;f.SDKBehaviorBase=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._myObjectClasses=f.New(f.ArraySet);this._myInstances=f.New(f.ArraySet);this._iBehavior=null;if(a=a.scriptInterfaceClass){if(this._iBehavior=new a(this),!(this._iBehavior instanceof b))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new b(this)}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=
null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(a){this._myObjectClasses.Add(a)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(a){this._myInstances.Add(a)}_RemoveInstance(a){this._myInstances.Delete(a)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){return this._iBehavior}}}"use strict";
{const f=self.C3;f.SDKBehaviorTypeBase=class extends f.DefendedBase{constructor(b){super();this._runtime=b.GetRuntime();this._behaviorType=b;this._objectClass=b.GetObjectClass();this._behavior=b.GetBehavior();this._behavior._AddObjectClass(this._objectClass)}Release(){this._behavior=this._objectClass=this._behaviorType=this._runtime=null}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}}"use strict";
{const f=self.C3;f.SDKBehaviorInstanceBase=class extends f.DefendedBase{constructor(b,a){super();this._behInst=b;this._domComponentId=a;this._inst=b.GetObjectInstance();this._runtime=b.GetRuntime();this._behaviorType=b.GetBehaviorType();this._sdkType=this._behaviorType.GetSdkType();this._isPostTicking=this._isTicking2=this._isTicking=!1;this._disposables=null}Release(){this._StopTicking();this._StopTicking2();this._StopPostTicking();this._disposables&&(this._disposables.Release(),this._disposables=
null);this._sdkType=this._behaviorType=this._runtime=this._inst=this._behInst=null}GetBehavior(){return this._behaviorType.GetBehavior()}GetBehaviorInstance(){return this._behInst}GetObjectInstance(){return this._inst}GetObjectClass(){return this._inst.GetObjectClass()}GetWorldInfo(){return this._inst.GetWorldInfo()}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._behInst.GetScriptInterface()}Trigger(b){return this._runtime.Trigger(b,
this._inst,this._behaviorType)}DebugTrigger(b){return this._runtime.DebugTrigger(b,this._inst,this._behaviorType)}TriggerAsync(b){return this._runtime.TriggerAsync(b,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){this._isTicking||(this._runtime._AddBehInstToTick(this),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime._RemoveBehInstToTick(this),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._runtime._AddBehInstToTick2(this),
this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime._RemoveBehInstToTick2(this),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}_StartPostTicking(){this._isPostTicking||(this._runtime._AddBehInstToPostTick(this),this._isPostTicking=!0)}_StopPostTicking(){this._isPostTicking&&(this._runtime._RemoveBehInstToPostTick(this),this._isPostTicking=!1)}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,
b,a)}OnSpriteFrameChanged(b,a){}SaveToJson(){return null}LoadFromJson(b){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var e=this.GetPropertyValueByIndex(b);if("number"!==typeof e)throw Error("expected number");this.SetPropertyValueByIndex(b,e+a)}}SetPropertyColorOffsetValueByIndex(b,a,e,c){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}}}"use strict";
{const f=self.C3;f.Plugins={};f.Behaviors={};f.PluginManager=class extends f.DefendedBase{constructor(b){super();this._runtime=b;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._jumpthruBehavior=this._solidBehavior=null}CreatePlugin(b){const a=this._runtime.GetObjectReference(b[0]);if(!a)throw Error("missing plugin");f.AddCommonACEs(b,a);b=f.New(a,{runtime:this._runtime,isSingleGlobal:b[1],isWorld:b[2],isRotatable:b[5],
hasEffects:b[8],mustPredraw:b[9],supportsSceneGraph:b[13],supportsMesh:b[14]});b.OnCreate();this._allPlugins.push(b);this._pluginsByCtor.set(a,b)}CreateSystemPlugin(){this._systemPlugin=f.New(f.Plugins.System,{runtime:this._runtime,isSingleGlobal:!0});this._systemPlugin.OnCreate()}CreateBehavior(b){b=this._runtime.GetObjectReference(b[1]);if(!b)throw Error("missing behavior");const a=f.New(b,{runtime:this._runtime});a.OnCreate();this._allBehaviors.push(a);this._behaviorsByCtor.set(b,a);!this._solidBehavior&&
f.Behaviors.solid&&a instanceof f.Behaviors.solid?this._solidBehavior=a:!this._jumpthruBehavior&&f.Behaviors.jumpthru&&a instanceof f.Behaviors.jumpthru&&(this._jumpthruBehavior=a)}GetPluginByConstructorFunction(b){return this._pluginsByCtor.get(b)||null}HasBehaviorByConstructorFunction(b){return this._behaviorsByCtor.has(b)}GetBehaviorByConstructorFunction(b){return this._behaviorsByCtor.get(b)||null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}}"use strict";
{const f=self.C3,b=new Set;f.ImageInfo=class extends f.DefendedBase{constructor(){super();this._url="";this._height=this._width=this._offsetY=this._offsetX=this._pixelFormat=this._size=0;this._hasMetaData=!1;this._imageAsset=null;this._textureState="";this._rcTex=f.New(f.Rect);b.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;b.delete(this)}static OnWebGLContextLost(){for(const a of b)a._textureState="",a._rcTex.set(0,0,0,0)}LoadData(a){this._url=a[0];this._size=a[1];this._pixelFormat=
a[2];this._offsetX=a[3];this._offsetY=a[4];this._width=a[5];this._height=a[6];this._hasMetaData=!0}LoadAnimationFrameData(a){this._url=a[0];this._size=a[1];this._offsetX=a[2];this._offsetY=a[3];this._width=a[4];this._height=a[5];this._pixelFormat=a[11];this._hasMetaData=!0}LoadDynamicAsset(a,e){if(this._imageAsset)throw Error("already loaded asset");this._url=e;const c={};f.IsAbsoluteURL(e)&&(c.loadPolicy="remote");this.LoadAsset(a,c);return this._imageAsset.Load()}ReplaceWith(a){if(a===this)throw Error("cannot replace with self");
this.ReleaseTexture();this._url=a._url;this._size=a._size;this._pixelFormat=a._pixelFormat;this._offsetX=a._offsetX;this._offsetY=a._offsetY;this._width=a._width;this._height=a._height;this._hasMetaData=a._hasMetaData;this._imageAsset=a._imageAsset;this._textureState=a._textureState;this._rcTex=a._rcTex}GetURL(){return this._url}GetSize(){return this._size}GetPixelFormat(){return this._pixelFormat}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(a,
e){if(this._imageAsset)throw Error("already got asset");e=Object.assign({},e,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=a.LoadImage(e)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,e){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";a=await this._imageAsset.LoadStaticTexture(a,e);if(!a)return this._textureState="",null;this._textureState="loaded";this._hasMetaData||
(this._width=a.GetWidth(),this._height=a.GetHeight(),this._hasMetaData=!0);this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+this._width,this._offsetY+this._height);this._rcTex.divide(a.GetWidth(),a.GetHeight());return a}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,0,0,0))}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}async ExtractImageToCanvas(){const a=
await this._imageAsset.LoadToDrawable(),e=f.CreateCanvas(this._width,this._height);e.getContext("2d").drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return e}}}"use strict";
{const f=self.C3;f.AnimationInfo=class extends f.DefendedBase{constructor(b){super();this._name=b[0];this._speed=b[1];this._isLooping=!!b[2];this._repeatCount=b[3];this._repeatTo=b[4];this._isPingPong=!!b[5];this._sid=b[6];this._frames=b[7].map(a=>f.New(f.AnimationFrameInfo,a))}Release(){for(const b of this._frames)b.Release();f.clearArray(this._frames)}LoadAllAssets(b){for(const a of this._frames)a.GetImageInfo().LoadAsset(b)}LoadAllTextures(b,a){return Promise.all(this._frames.map(e=>e.GetImageInfo().LoadStaticTexture(b,
a)))}ReleaseAllTextures(){for(const b of this._frames)b.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(b){b=Math.floor(b);if(0>b||b>=this._frames.length)throw new RangeError("invalid frame");return this._frames[b]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}}}"use strict";
{const f=self.C3;f.AnimationFrameInfo=class extends f.DefendedBase{constructor(b){super();this._imageInfo=f.New(f.ImageInfo);this._imageInfo.LoadAnimationFrameData(b);this._duration=b[6];this._origin=f.New(f.Vector2,b[7],b[8]);this._imagePoints=b[9].map(a=>f.New(f.ImagePoint,this,a));this._imagePointsByName=new Map;for(const a of this._imagePoints)this._imagePointsByName.set(a.GetName().toLowerCase(),a);this._collisionPoly=null;b=b[10];6<=b.length&&(this._collisionPoly=f.New(f.CollisionPoly,b))}Release(){this._collisionPoly&&
(this._collisionPoly.Release(),this._collisionPoly=null);this._imageInfo.Release();this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(b){return this._imagePointsByName.get(b.toLowerCase())||null}GetImagePointByIndex(b){b=Math.floor(b);return 0>b||b>=this._imagePoints.length?null:this._imagePoints[b]}GetImagePointCount(){return this._imagePoints.length}}}"use strict";
{const f=self.C3;f.ImagePoint=class extends f.DefendedBase{constructor(b,a){super();this._afi=b;this._name=a[0];this._pos=f.New(f.Vector2,a[1],a[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}}"use strict";
{const f=self.C3,b=self.C3Debugger,a=self.IObjectClass;f.ObjectClass=class extends f.DefendedBase{constructor(e,c,d){super();const g=e.GetObjectReference(d[1]);this._runtime=e;this._plugin=e.GetPluginManager().GetPluginByConstructorFunction(g);this._sdkType=null;this._instSdkCtor=g.Instance;this._index=c;this._sid=d[11];this._name=d[0];this._jsPropName=this._runtime.GetJsPropName(d[14]);this._isGlobal=!!d[9];this._isFamily=!!d[2];this._isOnLoaderLayout=!!d[10];this._instVars=d[3].map(k=>({sid:k[0],
type:k[1],name:k[2],jsPropName:e.GetJsPropName(k[3])}));this._behaviorsCount=d[4];this._effectsCount=d[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=f.New(f.SparseGrid,e.GetOriginalViewportWidth(),e.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=d[8].map(k=>f.BehaviorType.Create(this,k));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=f.New(f.SolStack,this);this._defaultInstanceData=null;this._defaultLayerIndex=0;this._isContained=!1;this._animationsBySid=this._animationsByName=this._animations=this._imageInfo=this._container=null;this._textureRefCount=0;this._savedData=
new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=!0;this._plugin.HasEffects()&&(this._effectList=f.New(f.EffectList,this,d[12]));d[6]&&(this._imageInfo=f.New(f.ImageInfo),this._imageInfo.LoadData(d[6]));if(d[7]){this._animations=d[7].map(k=>f.New(f.AnimationInfo,k));this._animationsByName=new Map;this._animationsBySid=new Map;for(const k of this._animations)this._animationsByName.set(k.GetName().toLowerCase(),k),this._animationsBySid.set(k.GetSID(),k)}this._isFamily?(this._familyMembers=
[],this._familyMembersSet=new Set,this._familyIndex=this._runtime._GetNextFamilyIndex()):(this._families=[],this._familiesSet=new Set,this._familyInstVarMap=[],this._familyBehaviorMap=[],this._familyEffectMap=[]);this._sdkType=f.New(g.Type,this,d[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=f.New(f.Event.Dispatcher);if(c=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new c(this),!(this._iObjectClass instanceof a))throw new TypeError("script interface class must derive from IObjectClass");
}else this._iObjectClass=new a(this);d[13]&&(c=d[13])&&this._sdkType.LoadTilemapData(c[0],c[1]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(d))}static Create(e,c,d){return f.New(f.ObjectClass,e,c,d)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const e of this._animations)e.Release();
f.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._runtime=this._container=null}_LoadFamily(e){for(let c=1,d=e.length;c<d;++c){const g=this._runtime.GetObjectClassByIndex(e[c]);this._familyMembers.push(g);this._familyMembersSet.add(g);g._families.push(this);g._familiesSet.add(this)}}_SetContainer(e){this._isInContainer=!0;this._container=e}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var e=
0;if(!this._isFamily)for(var c of this._families)for(var d of c.GetBehaviorTypes()){const m=d.GetName().toLowerCase();this._behaviorsByName.set(m,d);this._behaviorNameToIndex.set(m,e);this._behaviorTypesIncludingInherited.push(d);++e}for(var g of this.GetBehaviorTypes())c=g.GetName().toLowerCase(),this._behaviorsByName.set(c,g),this._behaviorNameToIndex.set(c,e),this._behaviorTypesIncludingInherited.push(g),++e;for(var k of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(k.GetBehavior().constructor);
if(!this._isFamily&&this._families.length){e=this._runtime.GetFamilyCount();f.extendArray(this._familyInstVarMap,e,0);f.extendArray(this._familyBehaviorMap,e,0);f.extendArray(this._familyEffectMap,e,0);e=[];c=k=g=0;for(const m of this._families)if(d=m.GetFamilyIndex(),this._familyInstVarMap[d]=g,g+=m.GetInstanceVariablesCount(),this._familyBehaviorMap[d]=k,k+=m.GetBehaviorTypesCount(),this._familyEffectMap[d]=c,c+=m.GetEffectTypesCount(),(d=m.GetEffectList())&&this._effectList)for(const p of d.GetAllEffectTypes())e.push(p.Clone(this._effectList));
this._effectList&&this._effectList.PrependEffectTypes(e)}}_CreateSingleGlobalInstance(e){const c=this._runtime._GetNewUID(),d=f.New(f.Instance,{runtime:this._runtime,objectType:this,uid:c});d._CreateSdkInstance(e[16],[]);this._runtime._MapInstanceByUID(c,d);this._instances.push(d)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(e){if(this._isFamily)return Promise.resolve();
this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(e)||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(e){return this._isFamily?
Promise.resolve():this._sdkType.PreloadTexturesWithInstances(e)}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(e){return e&&
this._usedBehaviorCtors.has(e)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(e=>e.sid)}GetInstanceVariableIndexBySID(e){return this._instVars.findIndex(c=>c.sid===e)}GetInstanceVariableIndexByName(e){return this._instVars.findIndex(c=>c.name===e)}_GetAllInstanceVariableNames(){return this._instVars.map(e=>e.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(e=>e.jsPropName)}GetInstanceVariableType(e){e=Math.floor(e);
if(0>e||e>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[e].type}GetInstanceVariableName(e){e=Math.floor(e);if(0>e||e>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[e].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(e){return this._behaviorsByName.get(e.toLowerCase())||null}GetBehaviorIndexByName(e){e=
this._behaviorNameToIndex.get(e.toLowerCase());return"undefined"===typeof e?-1:e}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(e){this._defaultInstanceData=e}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(e){this._defaultLayerIndex=
e}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(e){return this._familiesSet.has(e)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(e){return this._familyMembersSet.has(e)}GetFamilyBehaviorOffset(e){return this._familyBehaviorMap[e]}GetFamilyInstanceVariableOffset(e){return this._familyInstVarMap[e]}GetAnimationByName(e){if(!this._animations)throw Error("no animations");
return this._animationsByName.get(e.toLowerCase())||null}GetAnimationBySID(e){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(e)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const e=this.GetFirstAnimationFrame().GetImageInfo();return[e.GetWidth(),e.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 e of this._runtime._GetInstancesPendingCreate())e.GetObjectClass()===this&&(yield e)}GetInstanceCount(){return this._instances.length}_AddInstance(e){this._instances.push(e)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&
!this._isFamily){var e=this._instances,c=0;for(let d=e.length;c<d;++c)e[c]._SetIID(c);e=this._runtime._GetInstancesPendingCreate();for(const d of e)d.GetObjectClass()===this&&d._SetIID(c++);this._iidsStale=!1}}GetInstanceByIID(e){var c=this._instances;if(e<c.length)return c[e];e-=c.length;c=this._runtime._GetInstancesPendingCreate();for(const d of c)if(d.GetObjectClass()===this){if(0===e)return d;--e}return null}GetFirstPicked(e){if(e&&e.IsInContainer()&&e.GetObjectClass()!==this)for(const c of e.siblings())if(c.GetObjectClass()===
this)return c;e=this.GetCurrentSol().GetInstances();return e.length?e[0]:null}GetPairedInstance(e){const c=this.GetCurrentSol().GetInstances();return c.length?c[e.GetIID()%c.length]:null}*allCorrespondingInstances(e,c){const d=this.GetCurrentSol().GetInstances();var g=d.length;const k=c.GetCurrentSol(),m=c.GetCurrentSol().GetInstances(),p=m.length;var n=e.GetIID();if(c.IsFamily()||!k.IsSelectAll())n=m.indexOf(e);e=Math.ceil(g/p);g%=p;0===g||n<g?(n*=e,g=e):(n=g*e+(n-g)*(e-1),g=e-1);for(let u=n,q=n+
g;u<q;++u)yield d[u]}FinishCondition(e){this._sdkType.FinishCondition(e)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var e=this.GetCurrentSol(),c=e._GetOwnInstances(),d=e.IsSelectAll(),g=this._runtime.GetCurrentEventStackFrame();g=g&&g.GetCurrentEvent()&&g.GetCurrentEvent().IsOrBlock();for(const p of this._container.objectTypes())if(p!==this){p._UpdateIIDs();var k=p.GetCurrentSol();k._SetSelectAll(d);if(!d){var m=k._GetOwnInstances();f.clearArray(m);for(const n of c)m.push(p.GetInstanceByIID(n.GetIID()));
if(g){m=e._GetOwnElseInstances();k=k._GetOwnElseInstances();f.clearArray(k);for(const n of m)k.push(p.GetInstanceByIID(n.GetIID()))}}}}}_TruncateContainerSols(e,c){for(const d of this.GetContainer().objectTypes()){const g=d.GetCurrentSol();e?f.truncateArray(g._GetOwnElseInstances(),c):f.truncateArray(g._GetOwnInstances(),c)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(e){this._anyCollisionCellChanged=!!e}_SetAnyInstanceParallaxed(e){this._anyInstanceParallaxed=!!e}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&
this._isWorldType){for(const e of this._instances)e.GetWorldInfo()._UpdateCollisionCell();for(const e of this._runtime._GetInstancesPendingCreate())e.GetObjectClass()===this&&e.GetWorldInfo()._UpdateCollisionCell();this._anyCollisionCellChanged=!1}}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}HasSolidBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.Persist)}_SaveToJson(){const e=
{instances:this._instances.map(c=>c.SaveToJson())};this._savedData&&this._savedData.size&&(e.ex=f.ToSuperJSON(this._savedData));return e}_LoadFromJson(e){this._savedData&&(this._savedData.clear(),this._savedData=null);var c=e.ex;c&&(this._savedData=f.FromSuperJSON(c));c=this._instances;e=e.instances;for(let d=0,g=Math.min(c.length,e.length);d<g;++d)c[d].LoadFromJson(e[d]);for(let d=e.length,g=c.length;d<g;++d)this._runtime.DestroyInstance(c[d]);for(let d=c.length,g=e.length;d<g;++d){c=e[d];let k=
null;if(this.IsWorldType()&&(k=this._runtime.GetMainRunningLayout().GetLayerBySID(c.w.l),!k))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,k,!1,0,0,!0).LoadFromJson(c)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(e){this._instanceUserScriptClass=e}DispatchUserScriptEvent(e){var c=this._runtime;(c=
c.IsDebug()&&!c.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(e);c&&b.AddScriptTime()}}}"use strict";
{const f=self.C3;f.Container=class extends f.DefendedBase{constructor(b,a){super();this._runtime=b;this._objectTypes=a;for(const e of this._objectTypes)e._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(b=>b.IsWorldType())}}}"use strict";
{const f=self.C3,b=self.C3Debugger,a=self.IInstance,e=[];let c=0;const d=new WeakMap,g=new WeakMap;f.Instance=class extends f.DefendedBase{constructor(k){super();this._runtime=k.runtime;this._objectType=k.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=k.uid;this._puid=c++;this._flags=0;this._behaviorInstances=this._instVarValues=e;var m=this._objectType.GetBehaviorTypesIncludingInherited();0<m.length&&(this._behaviorInstances=m.map((p,n)=>f.New(f.BehaviorInstance,
{runtime:this._runtime,behaviorType:p,instance:this,index:n})));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;m=this.GetPlugin();m.MustPreDraw()&&(this._flags|=4);if(m.IsWorldType())if(this._worldInfo=f.New(f.WorldInfo,this,k.layer),k.worldData)this._worldInfo.Init(k.worldData);else{this._worldInfo.InitNoData();const [p,n]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(p,n);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}k.instVarData?
this._LoadInstanceVariableData(k.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var k of this._behaviorInstances)k.Release();f.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(k=d.get(this))k.clear(),d.delete(this);if(k=g.get(this))k.clear(),g.delete(this);this._siblings&&f.clearArray(this._siblings);this._dispatcher&&(this._dispatcher.Release(),
this._dispatcher=null);this._objectType=this._runtime=null;0<this._instVarValues.length&&f.clearArray(this._instVarValues);this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(k){0<k.length&&(this._instVarValues=[],f.shallowAssignArray(this._instVarValues,k))}_LoadDefaultInstanceVariables(){const k=this._objectType.GetInstanceVariablesCount();if(0!==k){this._instVarValues=[];var m=[0,0,""];for(let p=0;p<k;++p)this._instVarValues.push(m[this._objectType.GetInstanceVariableType(p)])}}_CreateSdkInstance(k,
m){if(this._sdkInst)throw Error("already got sdk instance");for(let p=0,n=this._behaviorInstances.length;p<n;++p)this._behaviorInstances[p]._CreateSdkInstance(m?m[p]:null);this._sdkInst=f.New(this._objectType.GetInstanceSdkCtor(),this,k);if(!(this._sdkInst instanceof f.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let p=0,n=this._behaviorInstances.length;p<n;++p)this._behaviorInstances[p].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}GetActiveTimeScale(){const k=
this._timeScale;return-1===k?this.GetRuntime().GetTimeScale():k}SetTimeScale(k){k=+k;if(0>k||!isFinite(k))k=0;this._timeScale=k}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=f.New(f.Event.Dispatcher));return this._dispatcher}Draw(k){this._sdkInst.Draw(k)}OnCreate(k){this._sdkInst.OnCreate(k)}_SetHasTilemap(){this._flags|=2}HasTilemap(){return 0!==(this._flags&2)}_MarkDestroyed(){this._flags|=1}IsDestroyed(){return 0!==(this._flags&1)}MustPreDraw(){return 0!==
(this._flags&4)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(k){this._flags=k?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(k){this._flags=k?this._flags|16:this._flags&-17}SetFlag(k,m){k<<=16;this._flags=m?this._flags|k:this._flags&~k}GetFlag(k){return 0!==(this._flags&k<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetImagePoint(k){return this._sdkInst.GetImagePoint(k)}GetObjectClass(){return this._objectType}BelongsToObjectClass(k){return k.IsFamily()?
k.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===k}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw Error("object does not support scene graph");}HasParent(){return null!==this.GetParent()}GetParent(){var k=this.GetWorldInfo();return k?(k=k.GetParent())?k.GetInstance():null:null}GetTopParent(){var k=this.GetWorldInfo();return k?(k=k.GetTopParent())?k.GetInstance():null:null}*parents(){const k=this.GetWorldInfo();if(k)for(const m of k.parents())yield m.GetInstance()}HasChildren(){const k=
this.GetWorldInfo();return k?k.HasChildren():!1}GetChildren(){const k=this.GetWorldInfo();return k?k.GetChildren().map(m=>m.GetInstance()):[]}*children(){const k=this.GetWorldInfo();if(k)for(const m of k.children())yield m.GetInstance()}*allChildren(){const k=this.GetWorldInfo();if(k)for(const m of k.allChildren())yield m.GetInstance()}GetChildCount(){const k=this.GetWorldInfo();return k?k.GetChildCount():0}GetChildAt(k){const m=this.GetWorldInfo();return m?(k=m.GetChildAt(k))?k.GetInstance():null:
null}AddChild(k,m){this.VerifySupportsSceneGraph();k.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(k.GetWorldInfo(),m||{})}RemoveChild(k){const m=this.GetWorldInfo();m&&m.RemoveChild(k.GetWorldInfo())}GetDestroyWithParent(){const k=this.GetWorldInfo();return k?k.GetDestroyWithParent():!1}SetupInitialSceneGraphConnections(){var k=this.GetWorldInfo();if(k&&(k=k.GetSceneGraphChildrenExportData()))for(const m of k)if(k=this._runtime.GetInstanceByUID(m[0])){const p=m[1];this.AddChild(k,{transformX:!!(p>>
0&1),transformY:!!(p>>1&1),transformWidth:!!(p>>2&1),transformHeight:!!(p>>3&1),transformAngle:!!(p>>4&1),destroyWithParent:!!(p>>5&1),transformZElevation:!!(p>>6&1)})}}IsInContainer(){return null!==this._siblings}_AddSibling(k){this._siblings.push(k)}GetSiblings(){return this._siblings}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const k of this.siblings())k.GetObjectClass().GetCurrentSol().SetSinglePicked(k)}_PushSiblingsToSolInstances(){for(const k of this.siblings())k.GetObjectClass().GetCurrentSol()._PushInstance(k)}_SetSiblingsToSolInstancesIndex(k){for(const m of this.siblings())m.GetObjectClass().GetCurrentSol()._GetOwnInstances()[k]=
m}_PushSiblingsToSolElseInstances(){for(const k of this.siblings())k.GetObjectClass().GetCurrentSol()._PushElseInstance(k)}_SetSiblingsToSolElseInstancesIndex(k){for(const m of this.siblings())m.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[k]=m}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(k){this._iid=k}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(k){if(!k)return null;
for(const m of this._behaviorInstances)if(m.GetBehavior()instanceof k)return m;return null}GetBehaviorSdkInstanceFromCtor(k){return k?(k=this.GetBehaviorInstanceFromCtor(k))?k.GetSdkInstance():null:null}GetBehaviorIndexBySID(k){const m=this._behaviorInstances;for(let p=0,n=m.length;p<n;++p)if(m[p].GetBehaviorType().GetSID()===k)return p;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(k){k|=
0;const m=this._instVarValues;if(0>k||k>=m.length)throw new RangeError("invalid instance variable");return m[k]}_GetInstanceVariableValueUnchecked(k){return this._instVarValues[k]}SetInstanceVariableValue(k,m){k|=0;const p=this._instVarValues;if(0>k||k>=p.length)throw new RangeError("invalid instance variable");const n=p[k];if("number"===typeof n)p[k]="number"===typeof m?m:parseFloat(m);else if("boolean"===typeof n)p[k]="boolean"===typeof m?m:!!m;else if("string"===typeof n)p[k]="string"===typeof m?
m:m.toString();else throw Error("unknown instance variable type");}SetInstanceVariableOffset(k,m){if(0!==m){k|=0;var p=this._instVarValues;if(0>k||k>=p.length)throw new RangeError("invalid instance variable");var n=p[k];if("number"===typeof n)p[k]="number"===typeof m?p[k]+m:p[k]+parseFloat(m);else{if("boolean"===typeof n)throw Error("can not set offset of boolean variable");if("string"===typeof n)throw Error("can not set offset of string variable");throw Error("unknown instance variable type");}}}GetSavedDataMap(){let k=
d.get(this);if(k)return k;k=new Map;d.set(this,k);return k}GetUnsavedDataMap(){let k=g.get(this);if(k)return k;k=new Map;g.set(this,k);return k}_HasAnyCreateDestroyHandler(k){const m=this.GetObjectClass();if(m.UserScriptDispatcher().HasAnyHandlerFor(k))return!0;for(const p of m.GetFamilies())if(p.UserScriptDispatcher().HasAnyHandlerFor(k))return!0;return this._runtime.UserScriptDispatcher().HasAnyHandlerFor(k)?!0:!1}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const k=
this.GetObjectClass(),m=new f.Event("instancecreate");m.instance=this.GetInterfaceClass();k.DispatchUserScriptEvent(m);for(const p of k.GetFamilies())p.DispatchUserScriptEvent(m);this._runtime.DispatchUserScriptEvent(m)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(k){if(this._iScriptInterface){var m=new f.Event("destroy");m.isEndingLayout=
k;this.DispatchUserScriptEvent(m)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){m=this.GetObjectClass();var p=new f.Event("instancedestroy");p.instance=this.GetInterfaceClass();p.isEndingLayout=k;m.DispatchUserScriptEvent(p);for(const n of m.GetFamilies())n.DispatchUserScriptEvent(p);this._runtime.DispatchUserScriptEvent(p)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(k="full"){const m={};"full"===k?m.uid=this.GetUID():m.c3=!0;if("visual-state"!==k){(k=
d.get(this))&&k.size&&(m.ex=f.ToSuperJSON(k));-1!==this.GetTimeScale()&&(m.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){k={};var p=this._objectType.GetInstanceVariableSIDs();for(let u=0,q=this._instVarValues.length;u<q;++u)k[p[u].toString()]=this._instVarValues[u];m.ivs=k}if(this._behaviorInstances.length){k={};for(var n of this._behaviorInstances)(p=n.SaveToJson())&&(k[n.GetBehaviorType().GetSID().toString()]=p);m.behs=k}}this._worldInfo&&(m.w=this._worldInfo._SaveToJson());
(n=this._sdkInst.SaveToJson())&&(m.data=n);return m}LoadFromJson(k,m="full"){if("full"===m)this._uid=k.uid;else if(!k.c3)return;if("visual-state"!==m){var p=d.get(this);p&&(p.clear(),d.delete(this));if(p=k.ex)p=f.FromSuperJSON(p),d.set(this,p);this._timeScale=k.hasOwnProperty("mts")?k.mts:-1;if(p=k.ivs)for(const [q,r]of Object.entries(p))if(p=parseInt(q,10),p=this._objectType.GetInstanceVariableIndexBySID(p),!(0>p||p>=this._instVarValues.length)){var n=r;null===n&&(n=NaN);this._instVarValues[p]=n}}if(this.GetPlugin().IsWorldType()){p=
k.w;var u=p.l;this._worldInfo.GetLayer().GetSID()!==u&&(n=this._worldInfo.GetLayer(),(u=n.GetLayout().GetLayerBySID(u))?(this._worldInfo._SetLayer(u),n._RemoveInstance(this,!0),u._AddInstance(this,!0),u.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===m&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(p)}if("visual-state"!==m&&(m=k.behs))for(const [q,r]of Object.entries(m))m=parseInt(q,10),m=this.GetBehaviorIndexBySID(m),0>m||m>=this._behaviorInstances.length||this._behaviorInstances[m].LoadFromJson(r);
(k=k.data)&&this._sdkInst.LoadFromJson(k)}GetInterfaceClass(){return this._iScriptInterface||this._InitUserScriptInterface()}_InitUserScriptInterface(){var k=this._worldInfo?self.IWorldInstance:a;const m=this._sdkInst.GetScriptInterfaceClass(),p=this._objectType._GetUserScriptInstanceClass(),n=p||m||k;a._Init(this);this._iScriptInterface=new n;a._Init(null);if(m&&!(this._iScriptInterface instanceof k))throw new TypeError(`script interface class '${m.name}' does not extend the right base class '${k.name}'`);
if(p&&(k=m||k,!(this._iScriptInterface instanceof k)))throw new TypeError(`setInstanceClass(): class '${p.name}' does not extend the right base class '${k.name}'`);return this._iScriptInterface}_GetInstVarsScriptDescriptor(k){if(0!==this._instVarValues.length){var m={},p=this._objectType._GetAllInstanceVariableJsPropNames();for(let n=0,u=p.length;n<u;++n)m[p[n]]={configurable:!1,enumerable:!0,get:f.Instance.prototype._GetInstanceVariableValueUnchecked.bind(this,n),set:f.Instance.prototype.SetInstanceVariableValue.bind(this,
n)};m=Object.create(Object.prototype,m);k.instVars={value:m,writable:!1}}}_GetBehaviorsScriptDescriptor(k){var m=this._behaviorInstances;if(0!==m.length){var p={};for(const n of m)p[n.GetBehaviorType().GetJsPropName()]={value:n.GetScriptInterface(),writable:!1};m=Object.create(Object.prototype,p);k.behaviors={value:m,writable:!1}}}DispatchUserScriptEvent(k){k.instance=this.GetInterfaceClass();var m=this._runtime;(m=m.IsDebug()&&!m.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();
this.GetInterfaceClass().dispatchEvent(k);m&&b.AddScriptTime()}}}"use strict";
{const f=self.C3;f.SceneGraphInfo=class extends f.DefendedBase{constructor(b){super();this._owner=b;this._parent=null;this._children=[];this._myStartWidth=b.GetWidth();this._myStartHeight=b.GetHeight();this._parentStartAngle=0}Release(){this._parent=null;f.clearArray(this._children)}SetParent(b){this._parentStartAngle=(this._parent=b)?b.GetAngle():0}GetParent(){return this._parent}HasChildren(){return 0<this._children.length}GetChildren(){return this._children}_GetStartWidth(){return this._myStartWidth}_GetStartHeight(){return this._myStartHeight}GetParentScaleX(){return this._owner.GetTransformWithParentWidth()?this._parent.GetWidth()/
this._parent._GetSceneGraphInfo()._GetStartWidth():1}GetParentScaleY(){return this._owner.GetTransformWithParentHeight()?this._parent.GetHeight()/this._parent._GetSceneGraphInfo()._GetStartHeight():1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(){return{sw:this._myStartWidth,sh:this._myStartHeight,psa:this._parentStartAngle,c:this._children.map(b=>{let a="";b.GetTransformWithParentX()&&(a+="x");b.GetTransformWithParentY()&&(a+="y");b.GetTransformWithParentWidth()&&(a+="w");b.GetTransformWithParentHeight()&&
(a+="h");b.GetTransformWithParentAngle()&&(a+="a");b.GetTransformWithParentZElevation()&&(a+="z");b.GetDestroyWithParent()&&(a+="d");return{uid:b.GetInstance().GetUID(),f:a}})}}_LoadFromJson(b){this._myStartWidth=b.sw;this._myStartHeight=b.sh;this._parentStartAngle=b.psa}_OnAfterLoad(b){const a=this._owner,e=a.GetRuntime();for(const c of b.c){b=e.GetInstanceByUID(c.uid).GetWorldInfo();const d=c.f,g={};g.transformX=d.includes("x");g.transformY=d.includes("y");g.transformWidth=d.includes("w");g.transformHeight=
d.includes("h");g.transformAngle=d.includes("a");g.transformZElevation=d.includes("z");g.destroyWithParent=d.includes("d");a.AddChild(b,g)}}}}"use strict";
{const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad),e=f.New(f.Event,"bboxchange",!1),c=f.New(f.Color,0,0,0,0),d=f.New(f.CollisionPoly),g=f.New(f.Color,1,1,1,1),k=f.New(f.Rect,0,0,-1,-1),m=f.New(f.Rect,0,0,-1,-1),p=new Set(["absolute","relative"]),n=[];let u=!0;f.WorldInfo=class extends f.DefendedBase{constructor(q,r){super();this._inst=q;this._objectClass=q.GetObjectClass();this._runtime=q.GetRuntime();this._layer=r;this._zIndex=-1;this._flags=98331;this._objectClass.GetPlugin().IsRotatable()&&(this._flags|=
128);this._oy=this._ox=this._cosA=this._sinA=this._a=this._h=this._w=this._zElevation=this._y=this._x=NaN;this._boundingBox=f.New(f.Rect);this._boundingQuad=f.New(f.Quad);this._collisionCells=m;this._renderCells=k;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=g;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=f.New(f.InstanceEffectList,this._inst,this));this._sceneGraphInfo=
null;this._sceneGraphFlagsExportData=NaN;this._meshInfo=this._sceneGraphChildrenExportData=null}Release(){this._stateGroup&&(this._runtime.GetRenderer().ReleaseStateGroup(this._stateGroup),this._stateGroup=null);this._sourceCollisionPoly=null;this._transformedPolyInfo&&(this._transformedPolyInfo.poly.Release(),this._transformedPolyInfo=null);this._solidFilterTags&&(this._solidFilterTags.clear(),this._solidFilterTags=null);this.ReleaseMesh();this.HasParent()&&this.GetParent().RemoveChild(this);if(this.HasChildren()){const q=
[...this.GetChildren()];for(const r of q)this.RemoveChild(r)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(q){u=!1;this.SetXY(q[0],q[1]);this.SetZElevation(q[2]);this.SetSize(q[3],q[4]);this.IsRotatable()?this.SetAngle(q[6]):this._a=0;c.setFromJSON(q[7]);this._SetColor(c);this.SetOriginX(q[8]);this.SetOriginY(q[9]);this.SetBlendMode(q[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(q[12]);q[14]&&(this._sceneGraphFlagsExportData=
q[14][0],this._sceneGraphChildrenExportData=q[14][1]);u=!0;this._UpdateRendererStateGroup()}InitNoData(){this._sinA=this._a=this._h=this._w=this._zElevation=this._y=this._x=0;this._cosA=1;this._oy=this._ox=0;this._UpdateRendererStateGroup()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetInstance(){return this._inst}_GetParentOffsetAngle(){return this.GetTransformWithParentAngle()?this.GetParent().GetAngle()-this._sceneGraphInfo.GetParentStartAngle():0}SetX(q){q=+q;
if(this.GetTransformWithParentX()){const r=this._sceneGraphInfo;q-=this.GetX();const t=-this._GetParentOffsetAngle();0===t?this._x+=q/r.GetParentScaleX():(this._x+=Math.cos(t)*q/r.GetParentScaleX(),this.GetTransformWithParentY()&&(this._y+=Math.sin(t)*q/r.GetParentScaleY()))}else this._x=q}OffsetX(q){q=+q;this.GetTransformWithParentX()?this.SetX(this.GetX()+q):this._x+=q}GetX(){if(this.GetTransformWithParentX()){let q=this._x;const r=this._sceneGraphInfo,t=this.GetParent(),x=this._GetParentOffsetAngle();
0===x?q*=r.GetParentScaleX():(q=q*r.GetParentScaleX()*Math.cos(x),this.GetTransformWithParentY()&&(q-=this._y*r.GetParentScaleY()*Math.sin(x)));return t.GetX()+q}return this._x}SetY(q){q=+q;if(this.GetTransformWithParentY()){const r=this._sceneGraphInfo;q-=this.GetY();const t=-this._GetParentOffsetAngle();0===t?this._y+=q/r.GetParentScaleY():(this.GetTransformWithParentX()&&(this._x-=Math.sin(t)*q/r.GetParentScaleX()),this._y+=Math.cos(t)*q/r.GetParentScaleY())}else this._y=q}OffsetY(q){q=+q;this.GetTransformWithParentY()?
this.SetY(this.GetY()+q):this._y+=q}GetY(){if(this.GetTransformWithParentY()){let q=this._y;const r=this._sceneGraphInfo,t=this.GetParent(),x=this._GetParentOffsetAngle();0===x?q*=r.GetParentScaleY():(q=q*r.GetParentScaleY()*Math.cos(x),this.GetTransformWithParentX()&&(q+=this._x*r.GetParentScaleX()*Math.sin(x)));return t.GetY()+q}return this._y}SetXY(q,r){q=+q;r=+r;if(this.GetTransformWithParentXOrY()){const x=this.GetTransformWithParentX(),z=this.GetTransformWithParentY(),D=this._sceneGraphInfo,
G=q-this.GetX(),w=r-this.GetY();var t=-this._GetParentOffsetAngle();if(0===t)this._x=x?this._x+G/D.GetParentScaleX():q,this._y=z?this._y+w/D.GetParentScaleY():r;else{const B=Math.sin(t);t=Math.cos(t);this._x=x?z?this._x+(t*G-B*w)/D.GetParentScaleX():this._x+t*G/D.GetParentScaleX():q;this._y=z?x?this._y+(B*G+t*w)/D.GetParentScaleY():this._y+t*w/D.GetParentScaleY():r}}else this._x=q,this._y=r}OffsetXY(q,r){q=+q;r=+r;this.GetTransformWithParentXOrY()?this.SetXY(this.GetX()+q,this.GetY()+r):(this._x+=
q,this._y+=r)}EqualsXY(q,r){return this.GetX()===q&&this.GetY()===r}SetZElevation(q){q=+q;this.GetTransformWithParentZElevation()&&(q-=this.GetParent().GetZElevation());this._zElevation!==q&&(this._zElevation=q,this._UpdateZElevation(),q=this.GetLayer(),0!==this._zElevation&&q._SetAnyInstanceZElevated(),q.SetZIndicesChanged())}_UpdateZElevation(){this._UpdateRendererStateGroup();if(this.HasChildren()){const q=this.GetChildren();for(let r=0,t=q.length;r<t;r++){const x=q[r];x.GetTransformWithParentZElevation()&&
x._UpdateZElevation()}}}OffsetZElevation(q){this.SetZElevation(this.GetZElevation()+q)}GetZElevation(){return this.GetTransformWithParentZElevation()?this.GetParent().GetZElevation()+this._zElevation:this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(q){q=+q;this.GetTransformWithParentWidth()?this._w*=q/this.GetWidth():this._w=q}OffsetWidth(q){q=+q;this.GetTransformWithParentWidth()?this.SetWidth(this.GetWidth()+q):this._w+=q}GetWidth(){return this.GetTransformWithParentWidth()?
this.GetParent().GetWidth()*this._w:this._w}SetHeight(q){q=+q;this.GetTransformWithParentHeight()?this._h*=q/this.GetHeight():this._h=q}OffsetHeight(q){q=+q;this.GetTransformWithParentHeight()?this.SetHeight(this.GetHeight()+q):this._h+=q}GetHeight(){return this.GetTransformWithParentHeight()?this.GetParent().GetHeight()*this._h:this._h}SetSize(q,r){q=+q;r=+r;this.GetTransformWithParentWidth()?this._w*=q/this.GetWidth():this._w=q;this.GetTransformWithParentHeight()?this._h*=r/this.GetHeight():this._h=
r}GetSceneGraphScale(){if(this.HasParent()){const q=this._sceneGraphInfo;return Math.min(q.GetParentScaleX(),q.GetParentScaleY())}return 1}IsRotatable(){return 0!==(this._flags&128)}SetAngle(q){q=+q;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(q-=this.GetParent().GetAngle()),q=f.clampAngle(q),this._a!==q&&(this._a=q,this._MarkSinCosAngleChanged()))}OffsetAngle(q){q=+q;0!==q&&this.IsRotatable()&&(this._a=f.clampAngle(this._a+q),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|=
131072;if(this.HasChildren()){const q=this.GetChildren();for(let r=0,t=q.length;r<t;r++)q[r]._MarkSinCosAngleChanged()}}GetAngle(){return this.GetTransformWithParentAngle()?f.clampAngle(this.GetParent().GetAngle()+this._a):this._a}_MaybeUpdateSinCosAngle(){const q=this._flags;if(0!==(q&131072)){var r=this.GetAngle();this._sinA=Math.sin(r);this._cosA=Math.cos(r);this._flags=q&-131073}}GetSinAngle(){this._MaybeUpdateSinCosAngle();return this._sinA}GetCosAngle(){this._MaybeUpdateSinCosAngle();return this._cosA}SetOriginX(q){this._ox=
+q}OffsetOriginX(q){this._ox+=+q}GetOriginX(){return this._ox}SetOriginY(q){this._oy=+q}OffsetOriginY(q){this._oy+=+q}GetOriginY(){return this._oy}_SetColor(q){this._color.equals(q)||(this._color===g?(this._color=f.New(f.Color,q),this._colorPremultiplied=f.New(f.Color,q),this._colorPremultiplied.premultiply()):q.equalsRgba(1,1,1,1)?this._colorPremultiplied=this._color=g:(this._color.set(q),this._colorPremultiplied.set(q),this._colorPremultiplied.premultiply()),this._UpdateRendererStateGroup())}SetOpacity(q){q=
f.clamp(+q,0,1);this._color.a!==q&&(c.copyRgb(this._color),c.a=q,this._SetColor(c))}OffsetOpacity(q){this.SetOpacity(this.GetOpacity()+q)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(q){this._color.equalsIgnoringAlpha(q)||(c.copyRgb(q),c.a=this._color.a,this._SetColor(c))}SetUnpremultipliedColorRGB(q,r,t){c.setRgb(q,r,t);this.SetUnpremultipliedColor(c)}OffsetUnpremultipliedColorRGB(q,r,t){if(0!==q||0!==r||0!==t)c.copyRgb(this._color),c.r+=q,c.g+=r,c.b+=t,this.SetUnpremultipliedColor(c)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}GetDestroyWithParent(){return 0!==
(this._flags&256)}SetDestroyWithParent(q){this._SetFlag(256,q)}GetTransformWithParentX(){return 0!==(this._flags&512)}SetTransformWithParentX(q){this._SetFlag(512,q)}GetTransformWithParentY(){return 0!==(this._flags&1024)}GetTransformWithParentXOrY(){return 0!==(this._flags&1536)}SetTransformWithParentY(q){this._SetFlag(1024,q)}GetTransformWithParentWidth(){return 0!==(this._flags&2048)}SetTransformWithParentWidth(q){this._SetFlag(2048,q)}GetTransformWithParentHeight(){return 0!==(this._flags&4096)}SetTransformWithParentHeight(q){this._SetFlag(4096,
q)}GetTransformWithParentAngle(){return 0!==(this._flags&8192)}SetTransformWithParentAngle(q){this._SetFlag(8192,q)}GetTransformWithParentZElevation(){return 0!==(this._flags&16384)}SetTransformWithParentZElevation(q){this._SetFlag(16384,q)}_ClearAllSceneGraphFlags(){this._flags&=-32513}AddChild(q,r){if(q!==this&&!q.HasParent()&&!this._HasChildRecursive(q)&&!this._HasAnyParent(q)){var t=q.GetX(),x=q.GetY(),z=q.GetWidth(),D=q.GetHeight(),G=q.GetAngle(),w=q.GetZElevation();q._SetParent(this);q.SetTransformWithParentX(r.transformX);
q.SetTransformWithParentY(r.transformY);q.SetTransformWithParentWidth(r.transformWidth);q.SetTransformWithParentHeight(r.transformHeight);q.SetTransformWithParentAngle(r.transformAngle);q.SetTransformWithParentZElevation(r.transformZElevation);q.SetDestroyWithParent(r.destroyWithParent);r.transformX&&(q._x=t-this.GetX());r.transformY&&(q._y=x-this.GetY());r.transformWidth&&(q._w=z/this.GetWidth());r.transformHeight&&(q._h=D/this.GetHeight());r.transformAngle&&(q._a=G-this.GetAngle());r.transformZElevation&&
(q._zElevation=w-this.GetZElevation());this._AddChildToSceneGraphInfo(q);this.SetBboxChanged()}}RemoveChild(q){if(q.GetParent()===this){var r=q.GetX(),t=q.GetY(),x=q.GetWidth(),z=q.GetHeight(),D=q.GetAngle(),G=q.GetZElevation();q._SetParent(null);q._ClearAllSceneGraphFlags();q.SetXY(r,t);q.SetSize(x,z);q.SetAngle(D);q.SetZElevation(G);this._RemoveChildFromSceneGraphInfo(q);this.SetBboxChanged()}}_ResetAllSceneGraphState(){for(var q of this.children())this.RemoveChild(q);(q=this.GetParent())&&q.RemoveChild(this);
this._ClearAllSceneGraphFlags()}HasParent(){return null!==this.GetParent()}GetParent(){const q=this._sceneGraphInfo;return null!==q?q.GetParent():null}GetTopParent(){let q=this;for(;q.HasParent();)q=q.GetParent();return q}*parents(){let q=this.GetParent();for(;q;)yield q,q=q.GetParent()}HasChild(q){return this.GetChildren().includes(q)}HasChildren(){const q=this._sceneGraphInfo;return null!==q?q.HasChildren():!1}GetChildren(){const q=this._sceneGraphInfo;return null!==q?q.GetChildren():n}children(){return this.GetChildren()}*allChildren(){for(const q of this.children())yield q,
yield*q.allChildren()}GetChildCount(){return this.GetChildren().length}GetChildAt(q){const r=this.GetChildren();q=Math.floor(+q);return 0>q||q>=r.length?null:r[q]}_CreateSceneGraphInfo(q){this._sceneGraphInfo||(this._sceneGraphInfo=f.New(f.SceneGraphInfo,this));q&&this._sceneGraphInfo.SetParent(q)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&&(this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(q){q?(q._CreateSceneGraphInfo(null),
this._CreateSceneGraphInfo(q)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(q){if(!this.HasParent())return!1;const r=this.GetParent();return r===q?!0:r._HasAnyParent(q)}_HasChildRecursive(q){if(this.HasChild(q))return!0;for(const r of this.GetChildren())if(r._HasChildRecursive(q))return!0;return!1}_AddChildToSceneGraphInfo(q){this._sceneGraphInfo.GetChildren().push(q)}_RemoveChildFromSceneGraphInfo(q){const r=this._sceneGraphInfo.GetChildren(),
t=r.indexOf(q);-1!==t&&r.splice(t,1);0!==r.length||this.HasParent()||this._ReleaseSceneGraphInfo();q.HasChildren()||q._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){return this._sceneGraphChildrenExportData}_UpdateRendererStateGroup(){if(u){var q=this._runtime.GetRenderer();this._stateGroup&&q.ReleaseStateGroup(this._stateGroup);this._stateGroup=q.AcquireStateGroup(q.GetTextureFillShaderProgram()||"<default>",this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===
g}SetBlendMode(q){q|=0;if(0>q||31<q)throw new RangeError("invalid blend mode");this.GetBlendMode()!==q&&(this._flags=this._flags&-2080374785|q<<26,this._UpdateRendererStateGroup())}GetBlendMode(){return(this._flags&2080374784)>>26}_SetLayer(q){this._layer=q;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(q){this._zIndex=q|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(q,
r){this._flags=r?this._flags|q:this._flags&~q}IsVisible(){return 0!==(this._flags&1)}SetVisible(q){this._SetFlag(1,q)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(q){q=!!q;this.IsCollisionEnabled()!==q&&(this._SetFlag(8,q),q?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(q,r){this._SetFlag(32,q);this._solidFilterTags&&this._solidFilterTags.clear();if(r.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const t of r.split(" "))t&&
this._solidFilterTags.add(t.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(q){const r=0!==(this._flags&32),t=this._solidFilterTags;if(!q||!t)return!r;for(const x of t)if(q.has(x))return r;return!r}SetBboxChanged(){this._flags|=32786;this._objectClass._SetAnyCollisionCellChanged(!0);this._runtime.UpdateRender();this._layer.UsesRenderCells()&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags&=-3,this._UpdateRenderCell());0!==(this._flags&4)&&this._inst.Dispatcher().dispatchEvent(e);
if(null!==this._sceneGraphInfo){const q=this._sceneGraphInfo.GetChildren();for(let r=0,t=q.length;r<t;++r)q[r].SetBboxChanged()}}CalculateBbox(q,r,t){const x=this.GetX(),z=this.GetY(),D=this.GetWidth(),G=this.GetHeight(),w=this.GetAngle();q.setWH(x-this._ox*D,z-this._oy*G,D,G);t&&this.HasMesh()&&this._ExpandBboxForMesh(q);0===w?r.setFromRect(q):(q.offset(-x,-z),r.setFromRotatedRectPrecalc(q,this.GetSinAngle(),this.GetCosAngle()),r.offset(x,z),r.getBoundingBox(q));q.normalize()}_UpdateBbox(){const q=
this._flags;0!==(q&2)&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags=q&-3)}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(q){var r=this.GetX(),t=this.GetY();r=Math.round(r)-r;t=Math.round(t)-t;if(0===r&&0===t)return q;a.copy(q);a.offset(r,t);return a}OverwriteBoundingBox(q){this._boundingBox.copy(q);this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell();
this._UpdateRenderCell()}SetBboxChangeEventEnabled(q){this._SetFlag(4,q)}IsBboxChangeEventEnabled(){return 0!==(this._flags&4)}IsInViewport(q){return 0===this.GetZElevation()?q.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const q=this.GetLayer(),r=this.GetTotalZElevation();if(r>=q.GetCameraZ())return!1;q.GetViewportForZ(r,b);return b.intersectsRect(this.GetBoundingBox())}SetSourceCollisionPoly(q){this._sourceCollisionPoly=q;this._DiscardTransformedCollisionPoly();
this.HasMesh()&&(this._meshInfo.meshPoly=null)}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return null!==this._sourceCollisionPoly||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(q,r,t){let x=0,z=1;0!==t&&(x=Math.sin(t),z=Math.cos(t));return this._GetCustomTransformedCollisionPolyPrecalc(q,
r,t,x,z)}_GetCustomTransformedCollisionPolyPrecalc(q,r,t,x,z){let D=this._transformedPolyInfo;null===D&&(this._transformedPolyInfo=D={poly:f.New(f.CollisionPoly),width:NaN,height:NaN,angle:NaN});const G=D.poly;if(D.width===q&&D.height===r&&D.angle===t)return G;const w=this._sourceCollisionPoly;if(this.HasMesh()){const B=this.GetOriginX(),I=this.GetOriginY(),P=this.GetSourceMesh();let E=this._meshInfo.meshPoly;E||(w?(d.copy(w),d.offset(B,I)):d.setDefaultPoints(),E=P.InsertPolyMeshVertices(d),this._meshInfo.meshPoly=
E);P.TransformCollisionPoly(E,G);G.offset(-B,-I);G.transformPrecalc(q,r,x,z)}else w?(G.copy(w),G.transformPrecalc(q,r,x,z)):G.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());D.width=q;D.height=r;D.angle=t;return G}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);const q=this._transformedPolyInfo;null!==q&&(q.width=NaN)}CreateMesh(q,r){q=Math.floor(q);r=Math.floor(r);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();
this._meshInfo={sourceMesh:f.New(f.Gfx.Mesh,q,r),transformedMesh:f.New(f.Gfx.Mesh,q,r),meshPoly:null}}HasMesh(){return null!==this._meshInfo}GetSourceMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(q){this._SetFlag(32768,q)}IsMeshChanged(){return 0!==(this._flags&32768)}SetPhysicsBodyChanged(q){this._SetFlag(65536,q)}IsPhysicsBodyChanged(){return 0!==
(this._flags&65536)}_ExpandBboxForMesh(q){var r=this._meshInfo.sourceMesh;const t=Math.min(r.GetMinX(),0),x=Math.min(r.GetMinY(),0),z=Math.max(r.GetMaxX(),1);r=Math.max(r.GetMaxY(),1);const D=q.width(),G=q.height();q.offsetLeft(t*D);q.offsetTop(x*G);q.offsetRight((z-1)*D);q.offsetBottom((r-1)*G)}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(q,r,t){q=Math.floor(q);
r=Math.floor(r);var x=t.mode||"absolute";if(!p.has(x))throw Error("invalid mode");x="relative"===x;let z=t.x,D=t.y,G="number"===typeof t.u?t.u:x?0:-1;t="number"===typeof t.v?t.v:x?0:-1;if(!this.HasMesh())return!1;const w=this.GetSourceMesh(),B=w.GetMeshPointAt(q,r);if(null===B)return!1;x&&(z+=q/(w.GetHSize()-1),D+=r/(w.GetVSize()-1));-1!==G||x?(x&&(G+=q/(w.GetHSize()-1)),G=f.clamp(G,0,1)):G=B.GetU();-1!==t||x?(x&&(t+=r/(w.GetVSize()-1)),t=f.clamp(t,0,1)):t=B.GetV();if(B.GetX()===z&&B.GetY()===D&&
B.GetU()===G&&B.GetV()===t)return!1;B.SetX(z);B.SetY(D);B.SetU(G);B.SetV(t);this._DiscardTransformedCollisionPoly();return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(q,r){return this.GetBoundingBox().containsPoint(q,r)&&this.GetBoundingQuad().containsPoint(q,r)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(q,r):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(q-this.GetX(),r-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&
16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()){var q=this.GetBoundingBox(),r=this._objectClass._GetCollisionCellGrid(),t=this._collisionCells;b.set(r.XToCell(q.getLeft()),r.YToCell(q.getTop()),r.XToCell(q.getRight()),r.YToCell(q.getBottom()));t.equals(b)||(q=this._inst,t===m?(r.Update(q,null,b),this._collisionCells=f.New(f.Rect,b)):(r.Update(q,t,b),t.copy(b)),this._flags&=-17)}}_RemoveFromCollisionCells(){const q=this._collisionCells;q!==m&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,
q,null),this._collisionCells=m)}_UpdateRenderCell(){const q=this.GetLayer();if(q.UsesRenderCells()){var r=q.GetRenderGrid(),t=this.GetBoundingBox(),x=this._renderCells;b.set(r.XToCell(t.getLeft()),r.YToCell(t.getTop()),r.XToCell(t.getRight()),r.YToCell(t.getBottom()));x.equals(b)||(t=this._inst,x===k?(r.Update(t,null,b),this._renderCells=f.New(f.Rect,b)):(r.Update(t,x,b),x.copy(b)),q.SetRenderListStale())}}_RemoveFromRenderCells(){const q=this._renderCells;q!==k&&(this.GetLayer().GetRenderGrid().Update(this._inst,
q,null),this._renderCells=k)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const q=this._inst,r=this._layer,t=r._GetInstances();t.length&&t[t.length-1]===q||(r._RemoveInstance(q,!1),r._AddInstance(q,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const q=this._inst,r=this._layer,t=r._GetInstances();t.length&&t[0]===q||(r._RemoveInstance(q,!1),r._PrependInstance(q,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(q){const r=this._inst,t=this._layer;if(t.GetLayout()!==q.GetLayout())throw Error("layer from different layout");
q!==t&&(t._RemoveInstance(r,!0),this._SetLayer(q),q._AddInstance(r,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(q,r){const t=this._inst,x=this._layer;if(q.GetUID()!==t.GetUID()){var z=q.GetWorldInfo();if(!z)throw Error("expected world instance");var D=z.GetLayer();z=!1;x.GetIndex()!==D.GetIndex()&&(x._RemoveInstance(t,!0),this._SetLayer(D),D._AddInstance(t,!0),z=!0);q=D.MoveInstanceAdjacent(t,q,!!r);(z||q)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(q){this._SetFlag(64,
q)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(){const q={x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(q.ze=this.GetZElevation());0!==this.GetAngle()&&(q.a=this.GetAngle());this.HasDefaultColor()||(q.c=this._color.toJSON());.5!==this.GetOriginX()&&(q.oX=this.GetOriginX());.5!==this.GetOriginY()&&(q.oY=this.GetOriginY());0!==this.GetBlendMode()&&(q.bm=this.GetBlendMode());this.IsVisible()||
(q.v=this.IsVisible());this.IsCollisionEnabled()||(q.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&(q.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(q.fx=this._instanceEffectList._SaveToJson());const r=0!==(this._flags&32);r&&(q.sfi=r);this._solidFilterTags&&(q.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&(q.sgi=this._sceneGraphInfo._SaveToJson());return q}_LoadFromJson(q){u=!1;this._ResetAllSceneGraphState();this.SetX(q.x);this.SetY(q.y);this.SetWidth(q.w);
this.SetHeight(q.h);this._SetZIndex(q.zi);this.SetZElevation(q.hasOwnProperty("ze")?q.ze:0);this.SetAngle(q.hasOwnProperty("a")?q.a:0);q.hasOwnProperty("c")?c.setFromJSON(q.c):q.hasOwnProperty("o")?(c.copyRgb(this._color),c.a=q.o):c.setRgba(1,1,1,1);this._SetColor(c);this.SetOriginX(q.hasOwnProperty("oX")?q.oX:.5);this.SetOriginY(q.hasOwnProperty("oY")?q.oY:.5);this.SetBlendMode(q.hasOwnProperty("bm")?q.bm:0);this.SetVisible(q.hasOwnProperty("v")?q.v:!0);this.SetCollisionEnabled(q.hasOwnProperty("ce")?
q.ce:!0);this.SetBboxChangeEventEnabled(q.hasOwnProperty("be")?q.be:!1);this.SetSolidCollisionFilter(q.hasOwnProperty("sfi")?q.sfi:!1,q.hasOwnProperty("sft")?q.sft:"");this._instanceEffectList&&q.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(q.fx);if(q.hasOwnProperty("sgi")){this._CreateSceneGraphInfo(null);const r=this._sceneGraphInfo,t=q.sgi;r._LoadFromJson(t);const x=this.GetRuntime().Dispatcher(),z=()=>{x.removeEventListener("afterload",z);r._OnAfterLoad(t)};x.addEventListener("afterload",
z)}this.SetBboxChanged();u=!0;this._UpdateRendererStateGroup()}}}"use strict";
{const f=self.C3;f.BehaviorType=class extends f.DefendedBase{constructor(b,a){super();const e=b.GetRuntime(),c=e.GetPluginManager(),d=e.GetObjectReference(a[1]);c.HasBehaviorByConstructorFunction(d)||c.CreateBehavior(a);this._runtime=e;this._objectClass=b;this._behavior=c.GetBehaviorByConstructorFunction(d);this._sdkType=null;this._instSdkCtor=d.Instance;this._sid=a[2];this._name=a[0];this._jsPropName=this._runtime.GetJsPropName(a[3]);this._sdkType=f.New(d.Type,this);this.OnCreate()}static Create(b,
a){return f.New(f.BehaviorType,b,a)}Release(){this._behavior=this._runtime=null;this._sdkType.Release();this._instSdkCtor=this._sdkType=null}GetSdkType(){return this._sdkType}OnCreate(){this._sdkType.OnCreate()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetBehavior(){return this._behavior}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetSID(){return this._sid}GetJsPropName(){return this._jsPropName}}}"use strict";
{const f=self.C3,b=self.IBehaviorInstance;f.BehaviorInstance=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._behaviorType=a.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=a.instance;this._index=a.index;this._iScriptInterface=this._sdkInst=null;this._behavior._AddInstance(this._inst)}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);this._behavior._RemoveInstance(this._inst);this._sdkInst.Release();
this._inst=this._behavior=this._behaviorType=this._runtime=this._iScriptInterface=this._sdkInst=null}_CreateSdkInstance(a){if(this._sdkInst)throw Error("already got sdk instance");this._sdkInst=f.New(this._behaviorType.GetInstanceSdkCtor(),this,a);this._InitScriptInterface()}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(a,
e){this._sdkInst.OnSpriteFrameChanged(a,e)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(a,e){var c=a.GetObjectInstance(),d=e.GetObjectInstance();const g=c.GetObjectClass().GetIndex(),k=d.GetObjectClass().GetIndex();if(g!==k)return g-k;c=c.GetPUID();d=d.GetPUID();return c!==d?c-d:a.GetBehaviorInstance()._GetIndex()-e.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const a=
this._sdkInst.GetScriptInterfaceClass(),e=a||b;b._Init(this);this._iScriptInterface=new e;b._Init(null);if(a&&!(this._iScriptInterface instanceof b))throw new TypeError(`script interface class '${a.name}' does not extend the right base class '${b.name}'`);}GetScriptInterface(){return this._iScriptInterface}}}"use strict";
{const f=self.C3;f.EffectList=class extends f.DefendedBase{constructor(b,a){super();this._owner=b;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const e of a)b=f.New(f.EffectType,this,e,this._allEffectTypes.length),this._allEffectTypes.push(b),this._effectTypesByName.set(b.GetName().toLowerCase(),b),3<=e.length&&this._effectParams.push(this._LoadSingleEffectParameters(e[2]));this.GetRuntime()._AddEffectList(this)}Release(){f.clearArray(this._allEffectTypes);
f.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();f.clearArray(this._effectParams);this._owner=null}PrependEffectTypes(b){if(b.length){this._allEffectTypes=b.concat(this._allEffectTypes);for(const a of b)this._effectTypesByName.set(a.GetName().toLowerCase(),a);for(let a=0,e=this._allEffectTypes.length;a<e;++a)this._allEffectTypes[a]._SetIndex(a)}}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,e=b.length;a<e;++a){const c=b[a];if(Array.isArray(c)){const d=f.New(f.Color);
d.setFromJSON(c);b[a]=d}}return b}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){f.clearArray(this._activeEffectTypes);let b=!0;for(const a of this._allEffectTypes)a.IsActive()&&(this._activeEffectTypes.push(a),a.GetShaderProgram().PreservesOpaqueness()||(b=!1));this._preservesOpaqueness=b}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return 0<this._allEffectTypes.length}GetEffectTypeByName(b){return this._effectTypesByName.get(b.toLowerCase())||
null}GetEffectTypeByIndex(b){b=Math.floor(+b);if(0>b||b>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[b]}IsEffectIndexActive(b){return this.GetEffectTypeByIndex(b).IsActive()}SetEffectIndexActive(b,a){this.GetEffectTypeByIndex(b).SetActive(a)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return 0<this._activeEffectTypes.length}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(b){return this._effectParams[b]}static SaveFxParamToJson(b){return b&&
b instanceof f.Color?{t:"color",v:b.toJSON()}:b}static LoadFxParamFromJson(b){if("object"===typeof b){if("color"===b.t){const a=f.New(f.Color);a.setFromJSON(b.v);return a}throw Error("invalid effect parameter type");}return b}static SaveFxParamsToJson(b){return b.map(f.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(b){return b.map(f.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(b=>({name:b.GetName(),active:b.IsActive(),params:f.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}LoadFromJson(b){for(const a of b)if(b=
this.GetEffectTypeByName(a.name))b.SetActive(a.active),this._effectParams[b.GetIndex()]=f.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}"use strict";
{const f=self.C3;f.EffectType=class extends f.DefendedBase{constructor(b,a,e){super();this._effectList=b;this._id=a[0];this._name=a[1];this._index=e;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(b){b=f.New(f.EffectType,b,[this._id,this._name],-1);b._shaderProgram=this._shaderProgram;b._isActive=this._isActive;return b}_InitRenderer(b){b=b.GetShaderProgramByName(this._id);if(!b)throw Error("failed to find shader program '"+this._id+"'");this._shaderProgram=
b}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(b){this._index=b}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(b){this._isActive=!!b}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const b=[];for(let a=0,e=this._shaderProgram.GetParameterCount();a<e;++a){const c=this._shaderProgram.GetParameterType(a);if("float"===c||"percent"===
c)b.push(0);else if("color"===c)b.push(f.New(f.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type");}return b}}}"use strict";
{const f=self.C3;f.InstanceEffectList=class extends f.DefendedBase{constructor(b,a,e){super();this._inst=b;this._wi=a;this._effectList=b.GetObjectClass().GetEffectList();this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const c of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){f.clearArray(this._activeEffectFlags);f.clearArray(this._activeEffectTypes);f.clearArray(this._effectParams);
this._effectList=this._inst=null}_LoadEffectParameters(b){for(const a of b)this._effectParams.push(this._LoadSingleEffectParameters(a))}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,e=b.length;a<e;++a){const c=b[a];if(Array.isArray(c)){const d=f.New(f.Color);d.setFromJSON(c);b[a]=d}}return b}LoadDefaultEffectParameters(){for(const b of this._effectList.GetAllEffectTypes())this._effectParams.push(b.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){f.clearArray(this._activeEffectTypes);
const b=this._effectList.GetAllEffectTypes(),a=this._activeEffectTypes,e=this._activeEffectFlags;let c=!0;for(let d=0,g=b.length;d<g;++d)if(e[d]){const k=b[d];a.push(k);k.GetShaderProgram().PreservesOpaqueness()||(c=!1)}this._preservesOpaqueness=c;this._wi._SetHasAnyActiveEffect(!!a.length)}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(b){return this._effectParams[b]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(b=>
b.GetShaderProgram().UsesDest())}IsEffectIndexActive(b){return this._activeEffectFlags[b]}SetEffectIndexActive(b,a){this._activeEffectFlags[b]=!!a}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(b=>({name:b.GetName(),active:this._activeEffectFlags[b.GetIndex()],params:f.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}_LoadFromJson(b){for(const a of b)if(b=this._effectList.GetEffectTypeByName(a.name))this._activeEffectFlags[b.GetIndex()]=
a.active,this._effectParams[b.GetIndex()]=f.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}"use strict";
{const f=self.C3,b=[],a=[],e=[],c=f.New(f.CollisionPoly),d=f.New(f.CollisionPoly),g=f.New(f.Quad),k=f.New(f.Rect),m=f.New(f.Rect);f.CollisionEngine=class extends f.DefendedBase{constructor(p){super();this._runtime=p;this._registeredCollisions=[];this._polyCheckSec=this._polyCheckCount=this._collisionCheckSec=this._collisionCheckCount=0}Release(){this._runtime=null}_Update1sStats(){this._collisionCheckSec=this._collisionCheckCount;this._collisionCheckCount=0;this._polyCheckSec=this._polyCheckCount;
this._polyCheckCount=0}Get1secCollisionChecks(){return this._collisionCheckSec}Get1secPolyChecks(){return this._polyCheckSec}RegisterCollision(p,n){const u=p.GetWorldInfo(),q=n.GetWorldInfo();u&&q&&u.IsCollisionEnabled()&&q.IsCollisionEnabled()&&this._registeredCollisions.push([p,n])}AddRegisteredCollisionCandidates(p,n,u){for(const [q,r]of this._registeredCollisions){let t;if(p===q)t=r;else if(p===r)t=q;else continue;t.BelongsToObjectClass(n)&&(u.includes(t)||u.push(t))}}CheckRegisteredCollision(p,
n){if(!this._registeredCollisions.length)return!1;for(const [u,q]of this._registeredCollisions)if(p===u&&n===q||p===q&&n===u)return!0;return!1}ClearRegisteredCollisions(){f.clearArray(this._registeredCollisions)}TestOverlap(p,n){if(!p||!n||p===n)return!1;p=p.GetWorldInfo();n=n.GetWorldInfo();if(!p.IsCollisionEnabled()||!n.IsCollisionEnabled())return!1;this._collisionCheckCount++;const u=p.GetLayer(),q=n.GetLayer();return u.IsTransformCompatibleWith(q)?this._TestOverlap_SameLayers(p,n):this._TestOverlap_DifferentLayers(p,
n)}_TestOverlap_SameLayers(p,n){if(!p.GetBoundingBox().intersectsRect(n.GetBoundingBox()))return!1;this._polyCheckCount++;if(!p.GetBoundingQuad().intersectsQuad(n.GetBoundingQuad())||p.HasTilemap()&&n.HasTilemap())return!1;if(p.HasTilemap())return this.TestTilemapOverlap(p,n);if(n.HasTilemap())return this.TestTilemapOverlap(n,p);if(!p.HasOwnCollisionPoly()&&!n.HasOwnCollisionPoly())return!0;const u=p.GetTransformedCollisionPoly(),q=n.GetTransformedCollisionPoly();return u.intersectsPoly(q,n.GetX()-
p.GetX(),n.GetY()-p.GetY())}_TestOverlap_DifferentLayers(p,n){var u=p.GetLayer();const q=n.GetLayer();c.copy(p.GetTransformedCollisionPoly());d.copy(n.GetTransformedCollisionPoly());var r=c.pointsArr();for(let t=0,x=r.length;t<x;t+=2){const z=t+1,D=r[z],[G,w]=u.LayerToCanvasCss(r[t]+p.GetX(),D+p.GetY());r[t]=G;r[z]=w}p=d.pointsArr();for(let t=0,x=p.length;t<x;t+=2){u=t+1;r=p[u];const [z,D]=q.LayerToCanvasCss(p[t]+n.GetX(),r+n.GetY());p[t]=z;p[u]=D}c.setBboxChanged();d.setBboxChanged();this._polyCheckCount++;
return c.intersectsPoly(d,0,0)}TestTilemapOverlap(p,n){const u=n.GetBoundingBox(),q=p.GetX(),r=p.GetY();var t=p.GetInstance().GetSdkInstance();p=n.GetX();const x=n.GetY(),z=n.HasOwnCollisionPoly(),D=n.GetBoundingQuad();t.GetCollisionRectCandidates(u,a);for(let B=0,I=a.length;B<I;++B){var G=a[B];t=G.GetRect();this._collisionCheckCount++;if(u.intersectsRectOffset(t,q,r)&&(g.setFromRect(t),g.offset(q,r),g.intersectsQuad(D)))if(z){var w=n.GetTransformedCollisionPoly();if(G=G.GetPoly()){if(this._polyCheckCount++,
G.intersectsPoly(w,p-(q+t.getLeft()),x-(r+t.getTop())))return f.clearArray(a),!0}else if(c.setFromQuad(g,0,0),c.intersectsPoly(w,p,x))return f.clearArray(a),!0}else if(w=G.GetPoly()){if(c.setFromQuad(D,0,0),w.intersectsPoly(c,-(q+t.getLeft()),-(r+t.getTop())))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestAndSelectCanvasPointOverlap(p,n,u,q){const r=p.GetCurrentSol();var t=this._runtime.GetCurrentEvent();if(!t)throw Error("cannot call outside event");t=t.IsOrBlock();
if(r.IsSelectAll()){q||(r._SetSelectAll(!1),f.clearArray(r._GetOwnInstances()));for(var x of p.GetInstances()){var z=x.GetWorldInfo(),D=z.GetLayer();const [G,w]=D.CanvasCssToLayer(n,u,z.GetTotalZElevation());if(z.ContainsPoint(G,w)){if(q)return!1;r._PushInstance(x)}else t&&r._PushElseInstance(x)}}else{x=t?r._GetOwnElseInstances():r._GetOwnInstances();z=0;for(let G=0,w=x.length;G<w;++G){D=x[G];const B=D.GetWorldInfo(),I=B.GetLayer(),[P,E]=I.CanvasCssToLayer(n,u,B.GetTotalZElevation());if(B.ContainsPoint(P,
E)){if(q)return!1;t?r._PushInstance(D):x[z++]=D}else t&&(x[z++]=D)}q||(x.length=z)}p.ApplySolToContainer();return q?!0:r.HasAnyInstances()}GetCollisionCandidates(p,n,u,q){p=p?1!==p.GetParallaxX()||1!==p.GetParallaxY():!1;if(n.IsFamily())for(const r of n.GetFamilyMembers())p||r.IsAnyInstanceParallaxed()?f.appendArray(q,r.GetInstances()):(r._UpdateAllCollisionCells(),r._GetCollisionCellGrid().QueryRange(u,q));else p||n.IsAnyInstanceParallaxed()?f.appendArray(q,n.GetInstances()):(n._UpdateAllCollisionCells(),
n._GetCollisionCellGrid().QueryRange(u,q))}GetObjectClassesCollisionCandidates(p,n,u,q){for(const r of n)this.GetCollisionCandidates(p,r,u,q)}GetSolidCollisionCandidates(p,n,u){const q=this._runtime.GetSolidBehavior();q&&this.GetObjectClassesCollisionCandidates(p,q.GetObjectClasses(),n,u)}GetJumpthruCollisionCandidates(p,n,u){const q=this._runtime.GetJumpthruBehavior();q&&this.GetObjectClassesCollisionCandidates(p,q.GetObjectClasses(),n,u)}IsSolidCollisionAllowed(p,n){return p._IsSolidEnabled()&&
(!n||n.GetWorldInfo().IsSolidCollisionAllowed(p.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(p){const n=p.GetWorldInfo();this.GetSolidCollisionCandidates(n.GetLayer(),n.GetBoundingBox(),b);for(const u of b)if(this.IsSolidCollisionAllowed(u,p)&&this.TestOverlap(p,u))return f.clearArray(b),u;f.clearArray(b);return null}TestRectOverlapSolid(p,n){this.GetSolidCollisionCandidates(null,p,b);for(const u of b)if(this.IsSolidCollisionAllowed(u,n)&&this.TestRectOverlap(p,u))return f.clearArray(b),
u;f.clearArray(b);return null}TestOverlapJumpthru(p,n){let u=null;n&&(u=e,f.clearArray(u));const q=p.GetWorldInfo();this.GetJumpthruCollisionCandidates(q.GetLayer(),q.GetBoundingBox(),b);for(const r of b)if(r._IsJumpthruEnabled()&&this.TestOverlap(p,r))if(n)u.push(r);else return f.clearArray(b),r;f.clearArray(b);return u}PushOut(p,n,u,q,r){q=q||50;const t=p.GetWorldInfo(),x=t.GetX(),z=t.GetY();for(let D=0;D<q;++D)if(t.SetXY(x+n*D,z+u*D),t.SetBboxChanged(),!this.TestOverlap(p,r))return!0;t.SetXY(x,
z);t.SetBboxChanged();return!1}PushOutSolid(p,n,u,q,r,t){q=q||50;const x=p.GetWorldInfo(),z=x.GetX(),D=x.GetY();let G=null,w=null;for(let B=0;B<q;++B)if(x.SetXY(z+n*B,D+u*B),x.SetBboxChanged(),!this.TestOverlap(p,G))if(G=this.TestOverlapSolid(p))w=G;else if(r&&(G=t?this.TestOverlap(p,t)?t:null:this.TestOverlapJumpthru(p))&&(w=G),!G)return w&&this.PushInFractional(p,n,u,w,16,!0),!0;x.SetXY(z,D);x.SetBboxChanged();return!1}PushOutSolidAxis(p,n,u,q){q=q||50;const r=p.GetWorldInfo(),t=r.GetX(),x=r.GetY();
let z=null,D=null;for(let G=0;G<q;++G)for(let w=0;2>w;++w){const B=2*w-1;r.SetXY(t+n*G*B,x+u*G*B);r.SetBboxChanged();if(!this.TestOverlap(p,z))if(z=this.TestOverlapSolid(p))D=z;else return D&&this.PushInFractional(p,n*B,u*B,D,16,!0),!0}r.SetXY(t,x);r.SetBboxChanged();return!1}PushInFractional(p,n,u,q,r,t){let x=2,z=!1;var D=!1;const G=p.GetWorldInfo();let w=G.GetX(),B=G.GetY();for(;x<=r;)D=1/x,x*=2,G.OffsetXY(n*D*(z?1:-1),u*D*(z?1:-1)),G.SetBboxChanged(),this.TestOverlap(p,q)||t&&this.TestOverlapSolid(p)?
D=z=!0:(D=z=!1,w=G.GetX(),B=G.GetY());D&&(G.SetXY(w,B),G.SetBboxChanged())}PushOutSolidNearest(p,n=100){let u=0;const q=p.GetWorldInfo(),r=q.GetX(),t=q.GetY();let x=0,z=this.TestOverlapSolid(p);if(!z)return!0;for(;u<=n;){let D=0,G=0;switch(x){case 0:D=0;G=-1;u++;break;case 1:D=1;G=-1;break;case 2:D=1;G=0;break;case 3:G=D=1;break;case 4:D=0;G=1;break;case 5:D=-1;G=1;break;case 6:D=-1;G=0;break;case 7:G=D=-1}x=(x+1)%8;q.SetXY(Math.floor(r+D*u),Math.floor(t+G*u));q.SetBboxChanged();if(!this.TestOverlap(p,
z)&&(z=this.TestOverlapSolid(p),!z))return!0}q.SetXY(r,t);q.SetBboxChanged();return!1}CalculateBounceAngle(p,n,u,q){const r=p.GetWorldInfo(),t=r.GetX(),x=r.GetY(),z=Math.max(10,f.distanceTo(n,u,t,x));var D=f.angleTo(n,u,t,x),G=q||this.TestOverlapSolid(p);if(!G)return f.clampAngle(D+Math.PI);let w=G;var B=0,I=0;const P=f.toRadians(5);let E;for(E=1;36>E;++E){const J=D-E*P;r.SetXY(n+Math.cos(J)*z,u+Math.sin(J)*z);r.SetBboxChanged();if(!this.TestOverlap(p,w)&&(w=q?null:this.TestOverlapSolid(p),!w)){B=
J;break}}36===E&&(B=f.clampAngle(D+Math.PI));w=G;for(E=1;36>E;++E)if(G=D+E*P,r.SetXY(n+Math.cos(G)*z,u+Math.sin(G)*z),r.SetBboxChanged(),!this.TestOverlap(p,w)&&(w=q?null:this.TestOverlapSolid(p),!w)){I=G;break}36===E&&(I=f.clampAngle(D+Math.PI));r.SetXY(t,x);r.SetBboxChanged();if(I===B)return I;p=f.angleDiff(I,B)/2;p=f.angleClockwise(I,B)?f.clampAngle(B+p+Math.PI):f.clampAngle(I+p);B=Math.cos(D);D=Math.sin(D);I=Math.cos(p);p=Math.sin(p);n=B*I+D*p;return f.angleTo(0,0,B-2*n*I,D-2*n*p)}TestSegmentOverlap(p,
n,u,q,r){if(!r)return!1;const t=r.GetWorldInfo();if(!t.IsCollisionEnabled())return!1;this._collisionCheckCount++;k.set(Math.min(p,u),Math.min(n,q),Math.max(p,u),Math.max(n,q));if(!t.GetBoundingBox().intersectsRect(k))return!1;if(r.HasTilemap())return this._TestSegmentOverlapTilemap(p,n,u,q,r,t);this._polyCheckCount++;return t.GetBoundingQuad().intersectsSegment(p,n,u,q)?t.HasOwnCollisionPoly()?t.GetTransformedCollisionPoly().intersectsSegment(t.GetX(),t.GetY(),p,n,u,q):!0:!1}_TestSegmentOverlapTilemap(p,
n,u,q,r,t){const x=t.GetX();t=t.GetY();r=r.GetSdkInstance();m.set(p,n,u,q);m.normalize();r.GetCollisionRectCandidates(m,a);for(let D=0,G=a.length;D<G;++D){var z=a[D];r=z.GetRect();this._collisionCheckCount++;if(k.intersectsRectOffset(r,x,t)&&(g.setFromRect(r),g.offset(x,t),g.intersectsSegment(p,n,u,q)))if(z=z.GetPoly()){if(this._polyCheckCount++,z.intersectsSegment(x+r.getLeft(),t+r.getTop(),p,n,u,q))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestRectOverlap(p,
n){if(!n)return!1;const u=n.GetWorldInfo();if(!u.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!u.GetBoundingBox().intersectsRect(p))return!1;if(n.HasTilemap())return this._TestRectOverlapTilemap(p,n,u);this._polyCheckCount++;g.setFromRect(p);if(!u.GetBoundingQuad().intersectsQuad(g))return!1;if(!u.HasOwnCollisionPoly())return!0;c.setFromRect(p,u.GetX(),u.GetY());p=u.GetTransformedCollisionPoly();return c.intersectsPoly(p,0,0)}_TestRectOverlapTilemap(p,n,u){const q=u.GetX();u=u.GetY();
n.GetSdkInstance().GetCollisionRectCandidates(p,a);for(let t=0,x=a.length;t<x;++t){var r=a[t];n=r.GetRect();this._collisionCheckCount++;if(p.intersectsRectOffset(n,q,u))if(r=r.GetPoly()){if(this._polyCheckCount++,c.setFromRect(p,0,0),r.intersectsPoly(c,-(q+n.getLeft()),-(u+n.getTop())))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestRayIntersectsInstance(p,n){if(p){var u=p.GetWorldInfo();u.IsCollisionEnabled()&&(this._collisionCheckCount++,u.GetBoundingBox().intersectsRect(n.rect)&&
(p.HasTilemap()?this._TestRayIntersectsTilemap(p,u,n):(this._polyCheckCount++,u.HasOwnCollisionPoly()?n.TestInstancePoly(p,u.GetX(),u.GetY(),u.GetTransformedCollisionPoly()):n.TestInstanceQuad(p,u.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(p,n,u){const q=n.GetX(),r=n.GetY();p.GetSdkInstance().GetCollisionRectCandidates(u.rect,a);for(let x=0,z=a.length;x<z;x++){var t=a[x];const D=t.GetRect();this._collisionCheckCount++;u.rect.intersectsRectOffset(D,q,r)&&(t=t.GetPoly(),this._polyCheckCount++,
t?u.TestInstancePoly(p,q+D.getLeft(),r+D.getTop(),t):u.TestInstanceRect(p,n.GetX(),n.GetY(),D))}f.clearArray(a)}}}"use strict";
{const f=self.C3;f.SparseGrid=class extends f.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=f.New(f.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,e){let c=this._cells.Get(b,a);return c?c:e?(c=f.New(f.GridCell,this,b,a),this._cells.Set(b,a,c),c):null}XToCell(b){b=Math.floor(b/this._cellWidth);return isFinite(b)?b:0}YToCell(b){b=Math.floor(b/this._cellHeight);return isFinite(b)?b:0}Update(b,a,e){if(a)for(let c=a.getLeft(),d=a.getRight();c<=
d;++c)for(let g=a.getTop(),k=a.getBottom();g<=k;++g){if(e&&e.containsPoint(c,g))continue;const m=this.GetCell(c,g,!1);m&&(m.Remove(b),m.IsEmpty()&&this._cells.Delete(c,g))}if(e)for(let c=e.getLeft(),d=e.getRight();c<=d;++c)for(let g=e.getTop(),k=e.getBottom();g<=k;++g)a&&a.containsPoint(c,g)||this.GetCell(c,g,!0).Insert(b)}QueryRange(b,a){let e=this.XToCell(b.getLeft());const c=this.YToCell(b.getTop()),d=this.XToCell(b.getRight());b=this.YToCell(b.getBottom());if(isFinite(d)&&isFinite(b))for(;e<=
d;++e)for(let g=c;g<=b;++g){const k=this.GetCell(e,g,!1);k&&k.Dump(a)}}}}"use strict";{const f=self.C3;f.GridCell=class extends f.DefendedBase{constructor(b,a,e){super();this._grid=b;this._x=a;this._y=e;this._instances=f.New(f.ArraySet)}Release(){this._instances.Release();this._grid=this._instances=null}IsEmpty(){return this._instances.IsEmpty()}Insert(b){this._instances.Add(b)}Remove(b){this._instances.Delete(b)}Dump(b){f.appendArray(b,this._instances.GetArray())}}}"use strict";
{const f=self.C3;f.Ray=class{constructor(){this.dy=this.dx=this.y2=this.x2=this.y1=this.x1=0;this.rect=new f.Rect;this.hitFraction=2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0}DidCollide(){return 1.000001>this.hitFraction}Set(b,a,e,c){this.x1=b;this.y1=a;this.x2=e;this.y2=c;this.dx=e-b;this.dy=c-a;this.rect.set(b,a,e,c);this.rect.normalize();this.hitFraction=2;this.hitUid=
null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0;return this}Complete(){if(!1!==this.DidCollide()){var b=this.dx*this.hitFraction,a=this.dy*this.hitFraction,e=Math.sqrt(b*b+a*a);b/=e;a/=e;this.distance=e-.000001;this.hitX=this.x1+b*this.distance;this.hitY=this.y1+a*this.distance;this.hitNormal=Math.atan2(this.hitNormalDy,this.hitNormalDx)+Math.PI/2;this.normalX=Math.cos(this.hitNormal);this.normalY=
Math.sin(this.hitNormal);e=b*this.normalX+a*this.normalY;this.reflectionX=b-2*this.normalX*e;this.reflectionY=a-2*this.normalY*e;0<e&&(this.hitNormal=f.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(b,a,e,c,d){const g=f.rayIntersect(this.x1,this.y1,this.x2,this.y2,a,e,c,d);0<=g&&g<this.hitFraction&&(this.hitFraction=g,this.hitUid=b.GetUID(),this.hitNormalDx=a-c,this.hitNormalDy=e-d)}TestInstanceRect(b,a,e,c){const d=a+c.getLeft();a+=
c.getRight();const g=e+c.getTop();e+=c.getBottom();this.TestInstanceSegment(b,d,g,a,g);this.TestInstanceSegment(b,a,g,a,e);this.TestInstanceSegment(b,a,e,d,e);this.TestInstanceSegment(b,d,e,d,g)}TestInstanceQuad(b,a){const e=a.getTlx(),c=a.getTly(),d=a.getTrx(),g=a.getTry(),k=a.getBrx(),m=a.getBry(),p=a.getBlx();a=a.getBly();this.TestInstanceSegment(b,e,c,d,g);this.TestInstanceSegment(b,d,g,k,m);this.TestInstanceSegment(b,k,m,p,a);this.TestInstanceSegment(b,p,a,e,c)}TestInstancePoly(b,a,e,c){c=c.pointsArr();
for(let d=0,g=c.length;d<g;d+=2){const k=(d+2)%g;this.TestInstanceSegment(b,c[d]+a,c[d+1]+e,c[k]+a,c[k+1]+e)}}}}"use strict";
{const f=self.C3,b=new Set("off crop scale-inner scale-outer letterbox-scale letterbox-integer-scale".split(" ")),a=new Set(["high","low"]),e=f.New(f.Quad),c=f.New(f.Rect);f.CanvasManager=class extends f.DefendedBase{constructor(d){super();this._runtime=d;this._webglRenderer=this._canvas=null;this._gpuPreference="high-performance";this._canvasCssOffsetY=this._canvasCssOffsetX=this._canvasDeviceHeight=this._canvasDeviceWidth=this._canvasCssHeight=this._canvasCssWidth=this._windowInnerHeight=this._windowInnerWidth=
0;this._enableMipmaps=!0;this._drawHeight=this._drawWidth=0;this._documentFullscreenMode=this._fullscreenMode="letterbox-scale";this._deviceTransformOffY=this._deviceTransformOffX=0;this._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=!1;this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets=new Set;this._gpuFrameTimingsBuffer=this._shaderData=null;this._gpuTimeEndFrame=this._gpuTimeStartFrame=0;this._gpuCurUtilisation=NaN;this._gpuLastUtilisation=
0;this._layersGpuProfile=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=f.New(f.Rect);this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=g=>this._loadingProgress=g.progress;this._loadingLogoAsset=this._percentText=null;this._splashTextures={logo:null,powered:null,website:null};this._splashFadeOutStartTime=this._splashFadeInFinishTime=this._splashFrameNumber=0;
this._splashState="fade-in";this._splashDoneResolve=null;this._splashDonePromise=new Promise(g=>this._splashDoneResolve=g)}_SetGPUPowerPreference(d){this._gpuPreference=d}async CreateCanvas(d){this._canvas=d.canvas;this._canvas.addEventListener("webglcontextlost",k=>this._OnWebGLContextLost(k));this._canvas.addEventListener("webglcontextrestored",k=>this._OnWebGLContextRestored(k));const g={powerPreference:this._gpuPreference,enableGpuProfiling:!0};"Android"===f.Platform.OS&&"Chromium"===f.Platform.BrowserEngine&&
75>f.Platform.BrowserVersionNumber&&(console.warn("[Construct 3] Disabling WebGL 2 because this device appears to be affected by crbug.com/934823. Install software updates to avoid this."),g.maxWebGLVersion=1);"standard"===this._runtime.GetCompositingMode()?g.alpha=!0:(g.alpha=!1,g.lowLatency=!0);this._webglRenderer=f.New(f.Gfx.WebGLRenderer,this._canvas,g);await this._webglRenderer.InitState();this._webglRenderer.SupportsGPUProfiling()||(this._gpuLastUtilisation=NaN);this._runtime.AddDOMComponentMessageHandler("runtime",
"window-resize",k=>this._OnWindowResize(k));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",k=>this._OnFullscreenChange(k));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",k=>this._OnFullscreenError(k));this._isDocumentFullscreen=!!d.isFullscreen;this.SetSize(d.windowInnerWidth,d.windowInnerHeight,!0);this._shaderData=self.C3_Shaders;await this._LoadShaderPrograms();d=!1;for(const k of this._runtime._GetAllEffectLists()){for(const m of k.GetAllEffectTypes())m._InitRenderer(this._webglRenderer),
m.GetShaderProgram().UsesDest()&&(d=!0);k.UpdateActiveEffects()}this._runtime._SetUsesAnyBackgroundBlending(d);this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=f.New(f.Gfx.WebGLQueryResultBuffer,this._webglRenderer));this._webglRenderer.SetMipmapsEnabled(this._enableMipmaps)}async _LoadShaderPrograms(){if(this._shaderData){var d=[];for(const [g,k]of Object.entries(this._shaderData)){const m=f.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource(this._webglRenderer.Is3D());d.push(this._webglRenderer.CreateShaderProgram(k,
m,g))}await Promise.all(d);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}}Release(){this._canvas=this._webglRenderer=this._runtime=null}_OnWindowResize(d){const g=d.devicePixelRatio;this._runtime.IsInWorker()&&(self.devicePixelRatio=g);this._runtime._SetDevicePixelRatio(g);this.SetSize(d.innerWidth,d.innerHeight);this._runtime.UpdateRender()}_OnFullscreenChange(d){this._isDocumentFullscreen=!!d.isFullscreen;this.SetSize(d.innerWidth,d.innerHeight,!0);this._runtime.UpdateRender()}_OnFullscreenError(d){this._isDocumentFullscreen=
!!d.isFullscreen;this.SetSize(d.innerWidth,d.innerHeight,!0);this._runtime.UpdateRender()}SetSize(d,g,k=!1){d=Math.floor(d);g=Math.floor(g);if(0>=d||0>=g)throw Error("invalid size");if(this._windowInnerWidth!==d||this._windowInnerHeight!==g||k)this._windowInnerWidth=d,this._windowInnerHeight=g,k=this.GetCurrentFullscreenMode(),"letterbox-scale"===k?this._CalculateLetterboxScale(d,g):"letterbox-integer-scale"===k?this._CalculateLetterboxIntegerScale(d,g):"off"===k?this._CalculateFixedSizeCanvas(d,
g):this._CalculateFullsizeCanvas(d,g),this._UpdateFullscreenScalingQuality(k),this._canvas.width=this._canvasDeviceWidth,this._canvas.height=this._canvasDeviceHeight,this._runtime.PostComponentMessageToDOM("canvas","update-size",{marginLeft:this._canvasCssOffsetX,marginTop:this._canvasCssOffsetY,styleWidth:this._canvasCssWidth,styleHeight:this._canvasCssHeight}),this._webglRenderer.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0)}_CalculateLetterboxScale(d,g){const k=this._runtime.GetDevicePixelRatio(),
m=this._runtime.GetOriginalViewportWidth(),p=this._runtime.GetOriginalViewportHeight(),n=m/p;d/g>n?(this._canvasCssWidth=Math.round(g*n),this._canvasCssHeight=g,this._canvasCssOffsetX=Math.floor((d-this._canvasCssWidth)/2),this._canvasCssOffsetY=0):(this._canvasCssWidth=d,this._canvasCssHeight=Math.round(d/n),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((g-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*k);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*
k);this._runtime.SetViewportSize(m,p)}_CalculateLetterboxIntegerScale(d,g){const k=this._runtime.GetDevicePixelRatio();1!==k&&(d+=1,g+=1);const m=this._runtime.GetOriginalViewportWidth(),p=this._runtime.GetOriginalViewportHeight();var n=m/p;n=d/g>n?g*n*k/m:d/n*k/p;1<n?n=Math.floor(n):1>n&&(n=1/Math.ceil(1/n));this._canvasDeviceWidth=Math.round(m*n);this._canvasDeviceHeight=Math.round(p*n);this._canvasCssWidth=this._canvasDeviceWidth/k;this._canvasCssHeight=this._canvasDeviceHeight/k;this._canvasCssOffsetX=
Math.max(Math.floor((d-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((g-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(m,p)}_CalculateFullsizeCanvas(d,g){const k=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=d;this._canvasCssHeight=g;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*k);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*k);this._canvasCssOffsetY=this._canvasCssOffsetX=0;d=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/
d,this._canvasCssHeight/d)}_CalculateFixedSizeCanvas(d,g){const k=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth*k);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*k);this.IsDocumentFullscreen()?(this._canvasCssOffsetX=Math.floor((d-this._canvasCssWidth)/2),this._canvasCssOffsetY=Math.floor((g-this._canvasCssHeight)/2)):this._canvasCssOffsetY=
this._canvasCssOffsetX=0;this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(d){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let k;if("off"===this.GetCurrentFullscreenMode()){var g=this._runtime.GetViewportWidth();k=this._runtime.GetViewportHeight()}else g=this._runtime.GetOriginalViewportWidth(),
k=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<g&&this._canvasDeviceHeight<k?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"):(this._drawWidth=g,this._drawHeight=k,this._fullscreenScalingQuality="low","scale-inner"===d?(d=g/k,g=this._windowInnerWidth/this._windowInnerHeight,g<d?this._drawWidth=this._drawHeight*g:g>d&&(this._drawHeight=this._drawWidth/g)):"scale-outer"===d&&(d=g/k,g=this._windowInnerWidth/
this._windowInnerHeight,g>d?this._drawWidth=this._drawHeight*g:g<d&&(this._drawHeight=this._drawWidth/g)))}}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(d){if(!b.has(d))throw Error("invalid fullscreen mode");this._fullscreenMode=d}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(d){if(!b.has(d))throw Error("invalid fullscreen mode");this._documentFullscreenMode=d}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?
this.GetDocumentFullscreenMode():this.GetFullscreenMode()}SetFullscreenScalingQuality(d){if(!a.has(d))throw Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=d}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(d){switch(d){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(d){this._enableMipmaps=!!d}IsWebGLContextLost(){return this._webglRenderer.IsContextLost()}_OnWebGLContextLost(d){console.log("[Construct 3] WebGL context lost");d.preventDefault();this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets.clear();
this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(d){await this._webglRenderer.OnContextRestored();await this._LoadShaderPrograms();for(const g of this._runtime._GetAllEffectLists())for(const k of g.GetAllEffectTypes())k._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored();console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?
1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const d=this.GetCurrentFullscreenMode();if("off"===d||"crop"===d)return 1;const g=this._runtime.GetOriginalViewportWidth(),k=this._runtime.GetOriginalViewportHeight(),m=g/k,p=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==d&&p>m||"scale-inner"===d&&p<m?this._canvasCssHeight/k:this._canvasCssWidth/g}SetDeviceTransformOffset(d,g){this._deviceTransformOffX=d;this._deviceTransformOffY=g}SetDeviceTransform(d,
g,k){g=(g||this._drawWidth)/2+this._deviceTransformOffX;k=(k||this._drawHeight)/2+this._deviceTransformOffY;d.SetCameraXYZ(g,k,100*this._runtime.GetDevicePixelRatio());d.SetLookXYZ(g,k,0);d.ResetModelView();d.UpdateModelView()}SetCssTransform(d){const g=this._canvasCssWidth/2,k=this._canvasCssHeight/2;d.SetCameraXYZ(g,k,100);d.SetLookXYZ(g,k,0);d.ResetModelView();d.UpdateModelView()}GetDeviceWidth(){return this._canvasDeviceWidth}GetDeviceHeight(){return this._canvasDeviceHeight}GetCssWidth(){return this._canvasCssWidth}GetCssHeight(){return this._canvasCssHeight}GetCanvasClientX(){return this._canvasCssOffsetX}GetCanvasClientY(){return this._canvasCssOffsetY}GetAdditionalRenderTarget(d){const g=
this._availableAdditionalRenderTargets,k=g.findIndex(p=>p.IsCompatibleWithOptions(d));let m;-1!==k?(m=g[k],g.splice(k,1)):m=this._webglRenderer.CreateRenderTarget(d);this._usedAdditionalRenderTargets.add(m);return m}ReleaseAdditionalRenderTarget(d){if(!this._usedAdditionalRenderTargets.has(d))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(d);this._availableAdditionalRenderTargets.push(d)}*activeLayersGpuProfiles(){for(const d of this._runtime.GetLayoutManager().runningLayouts())for(const g of d.GetLayers()){const k=
this._layersGpuProfile.get(g);k&&(yield k)}}GetLayerTimingsBuffer(d){if(!this._webglRenderer.SupportsGPUProfiling())return null;let g=this._layersGpuProfile.get(d);g||(g={name:d.GetName(),timingsBuffer:f.New(f.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(d,g));return g.timingsBuffer}_Update1sFrameRange(){if(this._webglRenderer.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=this._webglRenderer.GetFrameNumber();
this._gpuCurUtilisation=NaN;for(const d of this.activeLayersGpuProfiles())d.curUtilisation=NaN}}_UpdateTick(){if(this._webglRenderer.SupportsGPUProfiling()&&isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const d of this.activeLayersGpuProfiles())if(d.curUtilisation=d.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,
this._gpuTimeEndFrame),isNaN(d.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const d of this.activeLayersGpuProfiles())d.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),d.lastUtilisation=Math.min(d.curUtilisation,1);self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;
this._gpuTimeEndFrame=0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(d,g,k,m,p,n){this._snapshotFormat=d;this._snapshotQuality=g;this._snapshotArea.setWH(k,m,p,n);return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(u=>{this._snapshotResolve=u})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var d=this._canvas,g=this._snapshotArea,k=f.clamp(Math.floor(g.getLeft()),0,d.width),m=f.clamp(Math.floor(g.getTop()),
0,d.height),p=g.width();p=0===p?d.width-k:f.clamp(Math.floor(p),0,d.width-k);g=g.height();g=0===g?d.height-m:f.clamp(Math.floor(g),0,d.height-m);(0!==k||0!==m||p!==d.width||g!==d.height)&&0<p&&0<g&&(d=f.CreateCanvas(p,g),d.getContext("2d").drawImage(this._canvas,k,m,p,g,0,0,p,g));f.CanvasToBlob(d,this._snapshotFormat,this._snapshotQuality).then(n=>{this._snapshotUrl=URL.createObjectURL(n);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat="";this._snapshotQuality=
1}}GetCanvasSnapshotUrl(){return this._snapshotUrl}InitLoadingScreen(d){if(2===d)this._percentText=f.New(f.Gfx.RendererText,this._webglRenderer),this._percentText.SetIsAsync(!1),this._percentText.SetFontName("Arial"),this._percentText.SetFontSize(16),this._percentText.SetHorizontalAlignment("center"),this._percentText.SetVerticalAlignment("center"),this._percentText.SetSize(300,200);else if(0===d){const g=this._runtime.GetLoadingLogoFilename();d=this._runtime.GetAssetManager();let k;if(this._runtime.IsPreview()){if(!d._HasLocalUrlBlob(g))return;
k=d.GetLocalUrlAsBlobUrl(g)}else k=d.GetIconsSubfolder()+g;this._loadingLogoAsset=d.LoadImage({url:k});this._loadingLogoAsset.LoadStaticTexture(this._webglRenderer).catch(m=>console.warn(`[C3 runtime] Failed to load '${g}' for loading screen. Check the project has an icon with that name.`,m))}else 4===d&&(this._LoadSvgSplashImage("data:image/svg+xml;base64, ").then(g=>
{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.logo=g}).catch(g=>console.warn("Failed to load splash image: ",g)),this._LoadBitmapSplashImage("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(g=>
{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.powered=g}).catch(g=>console.warn("Failed to load splash image: ",g)),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(g=>
{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.website=g}).catch(g=>console.warn("Failed to load splash image: ",g)))}async _LoadSvgSplashImage(d){d=(new URL(d,this._runtime.GetBaseURL())).toString();d=await f.FetchBlob(d);d=await this._runtime.RasterSvgImage(d,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(d,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(d){d=(new URL(d,this._runtime.GetBaseURL())).toString();d=await f.FetchBlob(d);
return await this._webglRenderer.CreateStaticTextureAsync(d,{mipMapQuality:"high"})}HideCordovaSplashScreen(){this._runtime.PostComponentMessageToDOM("runtime","hide-cordova-splash")}StartLoadingScreen(){this._loaderStartTime=Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen());3!==this._runtime.GetLoaderStyle()&&this.HideCordovaSplashScreen()}async EndLoadingScreen(){this._loadingProgress=
1;const d=this._runtime.GetLoaderStyle();4===d&&await this._splashDonePromise;this._splashDonePromise=this._splashDoneResolve=null;-1!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=-1);this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler);this._loadingprogress_handler=null;this._percentText&&(this._percentText.Release(),this._percentText=null);this._loadingLogoAsset&&(this._loadingLogoAsset.Release(),this._loadingLogoAsset=null);this._webglRenderer.Start();
this._splashTextures.logo&&(this._webglRenderer.DeleteTexture(this._splashTextures.logo),this._splashTextures.logo=null);this._splashTextures.powered&&(this._webglRenderer.DeleteTexture(this._splashTextures.powered),this._splashTextures.powered=null);this._splashTextures.website&&(this._webglRenderer.DeleteTexture(this._splashTextures.website),this._splashTextures.website=null);this._webglRenderer.ClearRgba(0,0,0,0);this._webglRenderer.Finish();this._splashState="done";this._gpuTimeStartFrame=this._webglRenderer.GetFrameNumber();
3===d&&this.HideCordovaSplashScreen()}_DrawLoadingScreen(){if(-1!==this._rafId){var d=this._webglRenderer;d.Start();this._rafId=-1;var g=this._runtime.GetAssetManager().HasHadErrorLoading(),k=this._runtime.GetLoaderStyle();3!==k&&(this.SetCssTransform(d),d.ClearRgba(0,0,0,0),d.ResetColor(),d.SetTextureFillMode(),d.SetTexture(null));if(0===k)this._DrawProgressBarAndLogoLoadingScreen(g);else if(1===k)this._DrawProgressBarLoadingScreen(g,120,0);else if(2===k)this._DrawPercentTextLoadingScreen(g);else if(3===
k)f.noop();else if(4===k)this._DrawSplashLoadingScreen(g);else throw Error("invalid loader style");d.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}_DrawPercentTextLoadingScreen(d){d?this._percentText.SetColorRgb(1,0,0):this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(100*this._loadingProgress)+"%");d=this._canvasCssWidth/2;const g=this._canvasCssHeight/2;e.setRect(d-150,g-100,d+150,g+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());
this._webglRenderer.Quad3(e,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(d,g,k){const m=this._webglRenderer;m.SetColorFillMode();d?m.SetColorRgba(1,0,0,1):m.SetColorRgba(.118,.565,1,1);d=this._canvasCssWidth/2;const p=this._canvasCssHeight/2,n=g/2;c.setWH(d-n,p-4+k,Math.floor(g*this._loadingProgress),8);m.Rect(c);c.setWH(d-n,p-4+k,g,8);c.offset(-.5,-.5);c.inflate(.5,.5);m.SetColorRgba(0,0,0,1);m.LineRect2(c);c.inflate(1,1);m.SetColorRgba(1,1,1,1);m.LineRect2(c)}_DrawProgressBarAndLogoLoadingScreen(d){if(this._loadingLogoAsset){var g=
this._loadingLogoAsset.GetTexture();if(g){var k=g.GetWidth(),m=g.GetHeight(),p=this._canvasCssWidth/2,n=this._canvasCssHeight/2,u=k/2;m/=2;e.setRect(p-u,n-m,p+u,n+m);this._webglRenderer.SetTexture(g);this._webglRenderer.Quad(e);this._DrawProgressBarLoadingScreen(d,k,m+16)}else this._DrawProgressBarLoadingScreen(d,120,0)}else this._DrawProgressBarLoadingScreen(d,120,0)}_DrawSplashLoadingScreen(d){const g=this._webglRenderer,k=this._splashTextures.logo,m=this._splashTextures.powered,p=this._splashTextures.website,
n=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=n);const u=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),q=u?0:200,r=u?0:3E3;let t=1;"fade-in"===this._splashState?t=Math.min((n-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&(t=Math.max(1-(n-this._splashFadeOutStartTime)/300,0));g.SetColorFillMode();g.SetColorRgba(.231*t,.251*t,.271*t,t);c.set(0,0,this._canvasCssWidth,this._canvasCssHeight);g.Rect(c);const x=Math.ceil(this._canvasCssWidth),
z=Math.ceil(this._canvasCssHeight);let D;256<this._canvasCssHeight?(g.SetColorRgba(.302*t,.334*t,.365*t,t),D=Math.max(.005*z,2),c.setWH(0,.8*z-D/2,x,D),g.Rect(c),d?g.SetColorRgba(t,0,0,t):g.SetColorRgba(.161*t,.953*t,.816*t,t),d=x*this._loadingProgress,c.setWH(.5*x-d/2,.8*z-D/2,d,D),g.Rect(c),g.SetColorRgba(t,t,t,t),g.SetTextureFillMode(),m&&(d=1.5*f.clamp(.22*z,105,.6*x),D=d/8,c.setWH(.5*x-d/2,.2*z-D/2,d,D),g.SetTexture(m),g.Rect(c)),k&&(D=d=Math.min(.395*z,.95*x),c.setWH(.5*x-d/2,.485*z-D/2,d,D),
g.SetTexture(k),g.Rect(c)),p&&(d=1.5*f.clamp(.22*z,105,.6*x),D=d/8,c.setWH(.5*x-d/2,.868*z-D/2,d,D),g.SetTexture(p),g.Rect(c))):(g.SetColorRgba(.302*t,.334*t,.365*t,t),D=Math.max(.005*z,2),c.setWH(0,.85*z-D/2,x,D),g.Rect(c),d?g.SetColorRgba(t,0,0,t):g.SetColorRgba(.161*t,.953*t,.816*t,t),d=x*this._loadingProgress,c.setWH(.5*x-d/2,.85*z-D/2,d,D),g.Rect(c),g.SetColorRgba(t,t,t,t),g.SetTextureFillMode(),k&&(D=d=.55*z,c.setWH(.5*x-d/2,.45*z-D/2,d,D),g.SetTexture(k),g.Rect(c)));this._splashFrameNumber++;
"fade-in"===this._splashState&&300<=n-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=n);"wait"===this._splashState&&n-this._splashFadeInFinishTime>=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=n);("fade-out"===this._splashState&&n-this._splashFadeOutStartTime>=300+q||u&&1<=this._loadingProgress&&500>n-this._loaderStartTime)&&this._splashDoneResolve()}}}"use strict";
{const f=self.C3,b=self.C3Debugger,a={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let e=!0;f.Runtime=class extends f.DefendedBase{constructor(c){c=Object.assign({},a,c);super();this._messagePort=c.messagePort;this._baseUrl=c.baseUrl;this._isHeadless=!!c.headless;this._hasDom=!!c.hasDom;this._isInWorker=!!c.isInWorker;e=c.ife;this._useAudio=!!c.useAudio;this._exportType=c.exportType;this._isiOSCordova=!!c.isiOSCordova;this._isiOSWebView=
!!c.isiOSWebView;this._isFBInstantAvailable=!!c.isFBInstantAvailable;this._opusWasmScriptUrl=c.opusWasmScriptUrl;this._opusWasmBinaryUrl=c.opusWasmBinaryUrl;this._dataJsonFilename="data.json";this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!c.isDebug);this._debuggingDisabled=0;const d=c.previewImageBlobs;var g=c.previewProjectFileBlobs;g&&Object.assign(d,g);(g=c.projectData)&&(d[this._dataJsonFilename]=g);this._additionalLoadPromises=[];this._additionalCreatePromises=
[];this._isUsingCreatePromises=!1;this._appId=this._projectUniqueId=this._projectVersion=this._projectName="";this._originalViewportHeight=this._originalViewportWidth=0;this._devicePixelRatio=self.devicePixelRatio;this._loaderStyle=this._viewportHeight=this._viewportWidth=this._parallaxYorigin=this._parallaxXorigin=0;this._usesLoaderLayout=!1;this._isLoading=!0;this._usesAnyBackgroundBlending=!1;this._loadingLogoFilename="loading-logo.png";this._assetManager=f.New(f.AssetManager,this,{defaultLoadPolicy:"html5"===
this._exportType||"scirra-arcade"===this._exportType||"instant-games"===this._exportType?"remote":"local",localUrlBlobs:d,isCordova:"cordova"===this._exportType,isiOSCordova:this._isiOSCordova,supportedAudioFormats:c.supportedAudioFormats});this._layoutManager=f.New(f.LayoutManager,this);this._eventSheetManager=f.New(f.EventSheetManager,this);this._pluginManager=f.New(f.PluginManager,this);this._collisionEngine=f.New(f.CollisionEngine,this);this._timelineManager=f.New(f.TimelineManager,this);this._transitionManager=
f.New(f.TransitionManager,this);this._allObjectClasses=[];this._objectClassesByName=new Map;this._objectClassesBySid=new Map;this._familyCount=0;this._allContainers=[];this._allEffectLists=[];this._currentLayoutStack=[];this._instancesPendingCreate=[];this._instancesPendingDestroy=new Map;this._isFlushingPendingInstances=this._hasPendingInstances=!1;this._nextUid=this._objectCount=0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick=new Set;this._instancesToReleaseAffectedObjectClasses=
new Set;this._objectReferenceTable=[];this._jsPropNameTable=[];this._canvasManager=null;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._tickCallbacks={normal:k=>{this._ruafId=this._rafId=-1;this.Tick(k)},tickOnly:k=>{this._ruafId=-1;this.Tick(k,!1,"skip-render")},renderOnly:()=>{this._rafId=-1;this.Render()}};this._ruafId=this._rafId=-1;this._execCount=this._tickCountNoSave=
this._tickCount=0;this._hasStartedTicking=this._isInTick=this._hasStarted=!1;this._isLayoutFirstTick=!0;this._suspendCount=0;this._scheduleTriggersThrottle=new f.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=f.New(f.KahanSum);this._wallTime=f.New(f.KahanSum);this._fpsFrameCount=-1;this._mainThreadTime=this._mainThreadTimeCounter=this._fps=this._fpsLastTime=0;this._isLoadingState=
!1;this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null;this._lastSaveJson="";this._triggerOnCreateAfterLoad=[];this._savegamesStorage=this._projectStorage=null;this._dispatcher=f.New(f.Event.Dispatcher);this._domEventHandlers=new Map;this._pendingResponsePromises=new Map;this._nextDomResponseId=0;this._isReadyToHandleEvents=this._didRequestDeviceMotionEvent=this._didRequestDeviceOrientationEvent=!1;this._waitingToHandleEvents=[];this._eventObjects={pretick:f.New(f.Event,"pretick",
!1),tick:f.New(f.Event,"tick",!1),tick2:f.New(f.Event,"tick2",!1),instancedestroy:f.New(f.Event,"instancedestroy",!1),beforelayoutchange:f.New(f.Event,"beforelayoutchange",!1),layoutchange:f.New(f.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=f.New(f.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);
this._behInstsToTick2=f.New(f.RedBlackSet,f.BehaviorInstance.SortByTickSequence);this._jobScheduler=f.New(f.JobSchedulerRuntime,this,c.jobScheduler);c.canvas&&(this._canvasManager=f.New(f.CanvasManager,this));this._messagePort.onmessage=k=>this._OnMessageFromDOM(k.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",k=>this._OnVisibilityChange(k));this.AddDOMComponentMessageHandler("runtime","opus-decode",k=>this._WasmDecodeWebMOpus(k.arrayBuffer));this.AddDOMComponentMessageHandler("runtime",
"get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",k=>this._InvokeFunctionFromJS(k));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",k=>this._OnWindowBlur(k));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus());this._timelineManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=
new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(c){return f.New(f.Runtime,c)}Release(){f.clearArray(this._allObjectClasses);this._objectClassesByName.clear();this._objectClassesBySid.clear();this._layoutManager.Release();this._layoutManager=null;this._eventSheetManager.Release();this._eventSheetManager=null;this._pluginManager.Release();this._pluginManager=null;this._assetManager.Release();this._assetManager=null;this._collisionEngine.Release();this._collisionEngine=
null;this._timelineManager.Release();this._timelineManager=null;this._transitionManager.Release();this._transitionManager=null;this._canvasManager&&(this._canvasManager.Release(),this._canvasManager=null);this._dispatcher.Release();this._tickEvent=this._dispatcher=null}["_OnMessageFromDOM"](c){const d=c.type;if("event"===d)this._OnEventFromDOM(c);else if("result"===d)this._OnResultFromDOM(c);else throw Error(`unknown message '${d}'`);}_OnEventFromDOM(c){if(this._isReadyToHandleEvents){var d=c.component,
g=c.handler,k=c.data,m=c.dispatchOpts,p=!(!m||!m.dispatchRuntimeEvent);m=!(!m||!m.dispatchUserScriptEvent);var n=c.responseId;if("runtime"===d&&(p&&(c=new f.Event(g),c.data=k,this._dispatcher.dispatchEventAndWaitAsyncSequential(c)),m)){c=new f.Event(g,!0);for(const [u,q]of Object.entries(k))c[u]=q;this.DispatchUserScriptEvent(c)}if(c=this._domEventHandlers.get(d))if(c=c.get(g)){p=null;try{p=c(k)}catch(u){console.error(`Exception in '${d}' handler '${g}':`,u);null!==n&&this._PostResultToDOM(n,!1,""+
u);return}null!==n&&(p&&p.then?p.then(u=>this._PostResultToDOM(n,!0,u)).catch(u=>{console.error(`Rejection from '${d}' handler '${g}':`,u);this._PostResultToDOM(n,!1,""+u)}):this._PostResultToDOM(n,!0,p))}else p||m||console.warn(`[Runtime] No DOM handler '${g}' for component '${d}'`);else p||m||console.warn(`[Runtime] No DOM event handlers for component '${d}'`)}else this._waitingToHandleEvents.push(c)}_PostResultToDOM(c,d,g){this._messagePort.postMessage({type:"result",responseId:c,isOk:d,result:g})}_OnResultFromDOM(c){const d=
c.responseId,g=c.isOk;c=c.result;const k=this._pendingResponsePromises.get(d);g?k.resolve(c):k.reject(c);this._pendingResponsePromises.delete(d)}AddDOMComponentMessageHandler(c,d,g){let k=this._domEventHandlers.get(c);k||(k=new Map,this._domEventHandlers.set(c,k));if(k.has(d))throw Error(`[Runtime] Component '${c}' already has handler '${d}'`);k.set(d,g)}PostComponentMessageToDOM(c,d,g){this._messagePort.postMessage({type:"event",component:c,handler:d,data:g,responseId:null})}PostComponentMessageToDOMAsync(c,
d,g){const k=this._nextDomResponseId++,m=new Promise((p,n)=>{this._pendingResponsePromises.set(k,{resolve:p,reject:n})});this._messagePort.postMessage({type:"event",component:c,handler:d,data:g,responseId:k});return m}PostToDebugger(c){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",c)}async Init(c){this.IsDebug()?await b.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);var [d]=await Promise.all([this._assetManager.FetchJson(this._dataJsonFilename),
this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(d);await this._InitialiseCanvas(c);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");(d=this.GetWebGLRenderer())?(console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${d.GetWebGLVersionNumber()} [${d.GetUnmaskedRenderer()}] (${d.IsDesynchronized()?"desynchronized":"standard"} compositing)`),d.HasMajorPerformanceCaveat()&&
console.warn("[C3 runtime] WebGL indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.")):console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, headless`);this._isReadyToHandleEvents=!0;for(const g of this._waitingToHandleEvents)this._OnEventFromDOM(g);f.clearArray(this._waitingToHandleEvents);this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const g of c.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(g));
await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);f.clearArray(this._additionalLoadPromises);if(this._assetManager.HasHadErrorLoading())this._canvasManager&&this._canvasManager.HideCordovaSplashScreen();else return this._canvasManager&&await this._canvasManager.EndLoadingScreen(),await this._dispatcher.dispatchEventAndWaitAsync(new f.Event("beforeruntimestart")),await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(c){try{await c(this._iRuntime)}catch(d){console.error("[C3 runtime] Error in runOnStartup function: ",
d)}}_LoadDataJson(c){c=c.project;this._projectName=c[0];this._projectVersion=c[16];this._projectUniqueId=c[31];this._appId=c[38];this._loadingLogoFilename=c[39];this._isPixelRoundingEnabled=!!c[9];this._originalViewportWidth=this._viewportWidth=c[10];this._originalViewportHeight=this._viewportHeight=c[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=c[36];this._framerateMode=c[37];"low-latency"===this._compositingMode&&
this.IsAndroidWebView()&&77>=f.Platform.BrowserVersionNumber&&(console.warn("[C3 runtime] Desynchronized (low-latency) compositing is enabled, but is disabled in the Android WebView <=77 due to crbug.com/1008842. Reverting to synchronized (standard) compositing."),this._compositingMode="standard");this._sampling=c[14];this._usesLoaderLayout=!!c[18];this._loaderStyle=c[19];this._nextUid=c[21];this._pauseOnBlur=c[22];this._assetManager._SetAudioFiles(c[7],c[25]);this._assetManager._SetMediaSubfolder(c[8]);
this._assetManager._SetFontsSubfolder(c[32]);this._assetManager._SetIconsSubfolder(c[28]);this._assetManager._SetWebFonts(c[29]);this._canvasManager&&(this._canvasManager.SetFullscreenMode(f.CanvasManager._FullscreenModeNumberToString(c[12])),this._canvasManager.SetFullscreenScalingQuality(c[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==c[24]),this._canvasManager._SetGPUPowerPreference(c[34]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();
for(var d of c[2])this._pluginManager.CreatePlugin(d);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var g of c[3])d=f.ObjectClass.Create(this,this._allObjectClasses.length,g),this._allObjectClasses.push(d),this._objectClassesByName.set(d.GetName().toLowerCase(),d),this._objectClassesBySid.set(d.GetSID(),d);for(const p of c[4])this._allObjectClasses[p[0]]._LoadFamily(p);for(var k of c[27])g=k.map(p=>this._allObjectClasses[p]),this._allContainers.push(f.New(f.Container,
this,g));for(const p of this._allObjectClasses)p._OnAfterCreate();for(const p of c[5])this._layoutManager.Create(p);(k=c[1])&&(k=this._layoutManager.GetLayoutByName(k))&&this._layoutManager.SetFirstLayout(k);for(var m of c[33])this._timelineManager.Create(m);for(const p of c[35])this._transitionManager.Create(p);this._InitScriptInterfaces();for(const p of c[6])this._eventSheetManager.Create(p);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();f.clearArray(this._objectReferenceTable);
this.FlushPendingInstances();m="any";c=c[20];1===c?m="portrait":2===c&&(m="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:m})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(c){this._additionalLoadPromises.push(c)}SetUsingCreatePromises(c){this._isUsingCreatePromises=!!c}AddCreatePromise(c){this._isUsingCreatePromises&&this._additionalCreatePromises.push(c)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(c){this._allEffectLists.push(c)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(c){this._canvasManager&&
(await this._canvasManager.CreateCanvas(c),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var c=null,d=null;try{this.IsiOSCordova()&&"file:"===location.protocol?d=await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):c=await this._assetManager.FetchBlob(this._opusWasmBinaryUrl)}catch(g){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",
g);return}d?this.AddJobWorkerBuffer(d,"opus-decoder-wasm"):this.AddJobWorkerBlob(c,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(c){return await this.AddJob("OpusDecode",{arrayBuffer:c},[c])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var c of this._allObjectClasses)c.IsFamily()||c.IsOnLoaderLayout()||!c.IsWorldType()||c.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=
!1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&b.RuntimeInit(e);for(const d of this._layoutManager.GetAllLayouts())d._CreateGlobalNonWorlds();c=this._layoutManager.GetFirstLayout();await c._Load(null,this.GetWebGLRenderer());await c._StartRunning(!0);this._fpsLastTime=performance.now();this._usesLoaderLayout||this._OnLoadFinished();(await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking")).isSuspended?this._suspendCount++:
this.Tick()}_OnLoadFinished(){this.Trigger(f.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(c){c=Math.floor(c);const d=this._objectReferenceTable;if(0>c||c>=d.length)throw Error("invalid object reference");return d[c]}_LoadJsPropNameTable(){for(const c of self.C3_JsPropNameTable){const d=f.first(Object.keys(c));this._jsPropNameTable.push(d)}}GetJsPropName(c){c=Math.floor(c);const d=this._jsPropNameTable;if(0>c||c>=d.length)throw Error("invalid prop reference");
return d[c]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetBaseURL(){return this._baseUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return 0===
this.GetCurrentEventStackFrame().GetConditionIndex()}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(c){c=Math.floor(c);if(0>c||c>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[c]}GetObjectClassByName(c){return this._objectClassesByName.get(c.toLowerCase())||null}GetObjectClassBySID(c){return this._objectClassesBySid.get(c)||
null}GetSingleGlobalObjectClassByCtor(c){return(c=this._pluginManager.GetPluginByConstructorFunction(c))?c.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(c){c.runtime=this.GetIRuntime();const d=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();d&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(c);d&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(c){c.runtime=
this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(c)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(c,d){this._originalViewportWidth=c;this._originalViewportHeight=d}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(c,d){this._viewportWidth=c;this._viewportHeight=d}_SetDevicePixelRatio(c){this._devicePixelRatio=
c}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){return this._canvasManager?this._canvasManager.GetDrawWidth():this._viewportWidth}GetDrawHeight(){return this._canvasManager?this._canvasManager.GetDrawHeight():this._viewportHeight}GetRenderScale(){return this._canvasManager?this._canvasManager.GetRenderScale():1}GetDisplayScale(){return this._canvasManager?
this._canvasManager.GetDisplayScale():1}GetCanvasClientX(){return this._canvasManager?this._canvasManager.GetCanvasClientX():0}GetCanvasClientY(){return this._canvasManager?this._canvasManager.GetCanvasClientY():0}GetCanvasCssWidth(){return this._canvasManager?this._canvasManager.GetCssWidth():0}GetCanvasCssHeight(){return this._canvasManager?this._canvasManager.GetCssHeight():0}GetFullscreenMode(){return this._canvasManager?this._canvasManager.GetFullscreenMode():"off"}GetAdditionalRenderTarget(c){return this._canvasManager?
this._canvasManager.GetAdditionalRenderTarget(c):null}ReleaseAdditionalRenderTarget(c){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(c)}_SetUsesAnyBackgroundBlending(c){this._usesAnyBackgroundBlending=!!c}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}GetGPUUtilisation(){return this._canvasManager?this._canvasManager.GetGPUUtilisation():NaN}IsLinearSampling(){return"nearest"!==this.GetSampling()}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoFilename(){return this._loadingLogoFilename}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetAssetManager(){return this._assetManager}LoadImage(c){return this._assetManager.LoadImage(c)}CreateInstance(c,
d,g,k){return this.CreateInstanceFromData(c,d,!1,g,k)}CreateInstanceFromData(c,d,g,k,m,p){let n=null,u=null;if(c instanceof f.ObjectClass){u=c;if(u.IsFamily()){c=u.GetFamilyMembers();var q=Math.floor(this.Random()*c.length);u=c[q]}n=u.GetDefaultInstanceData()}else n=c,u=this.GetObjectClassByIndex(n[1]);const r=u.GetPlugin().IsWorldType();if(this._isLoading&&r&&!u.IsOnLoaderLayout())return null;const t=d;r||(d=null);var x=g&&!p&&n&&!this._instancesByUid.has(n[2])?n[2]:this._nextUid++;q=n?n[0]:null;
c=f.New(f.Instance,{runtime:this,objectType:u,layer:d,worldData:q,instVarData:n?n[3]:null,uid:x});this._instancesByUid.set(x,c);x=null;r&&(x=c.GetWorldInfo(),"undefined"!==typeof k&&"undefined"!==typeof m&&(x.SetX(k),x.SetY(m)),u._SetAnyCollisionCellChanged(!0));d&&(d._AddInstance(c,!0),1===d.GetParallaxX()&&1===d.GetParallaxY()||u._SetAnyInstanceParallaxed(!0),d.GetLayout().MaybeLoadTexturesFor(u));this._objectCount++;if(u.IsInContainer()&&!g&&!p){for(var z of u.GetContainer().objectTypes())z!==
u&&(d=this.CreateInstanceFromData(z,t,!1,x?x.GetX():k,x?x.GetY():m,!0),c._AddSibling(d));for(const D of c.siblings()){D._AddSibling(c);for(const G of c.siblings())D!==G&&D._AddSibling(G)}}u._SetIIDsStale();k=n?f.cloneArray(n[5]):null;m=n?n[4].map(D=>f.cloneArray(D)):null;(z=r&&q&&14===q.length)&&c._SetHasTilemap();c._CreateSdkInstance(k,m);z&&(k=q[13],c.GetSdkInstance().LoadTilemapData(k[2],k[0],k[1]));this._instancesPendingCreate.push(c);this._hasPendingInstances=!0;this.IsDebug()&&b.InstanceCreated(c);
return c}DestroyInstance(c){if(!this._instancesToReleaseAtEndOfTick.has(c)){var d=c.GetObjectClass(),g=this._instancesPendingDestroy.get(d);if(g){if(g.has(c))return;g.add(c)}else g=new Set,g.add(c),this._instancesPendingDestroy.set(d,g);this.IsDebug()&&b.InstanceDestroyed(c);c._MarkDestroyed();this._hasPendingInstances=!0;if(c.IsInContainer())for(const k of c.siblings())this.DestroyInstance(k);for(const k of c.children())k.GetDestroyWithParent()&&this.DestroyInstance(k);this._layoutManager.IsEndingLayout()||
this._isLoadingState||(d=this.GetEventSheetManager(),d.BlockFlushingInstances(!0),c._TriggerOnDestroyed(),d.BlockFlushingInstances(!1));c._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances=this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const c of this._instancesPendingCreate){const d=
c.GetObjectClass();d._AddInstance(c);for(const g of d.GetFamilies())g._AddInstance(c),g._SetIIDsStale()}f.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [c,d]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(c,d),d.clear();this._instancesPendingDestroy.clear();this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(c,d){for(const k of d){var g=
this._eventObjects.instancedestroy;g.instance=k;this._dispatcher.dispatchEvent(g);this._instancesByUid.delete(k.GetUID());if(g=k.GetWorldInfo())g._RemoveFromCollisionCells(),g._RemoveFromRenderCells();this._instancesToReleaseAtEndOfTick.add(k);this._objectCount--}f.arrayRemoveAllInSet(c.GetInstances(),d);c._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(c);0===c.GetInstances().length&&c._SetAnyInstanceParallaxed(!1);for(const k of c.GetFamilies())f.arrayRemoveAllInSet(k.GetInstances(),
d),k._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(k);if(c.GetPlugin().IsWorldType()){c=new Set([...d].map(k=>k.GetWorldInfo().GetLayer()));for(const k of c)k._RemoveAllInstancesInSet(d)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(c,d){this._instancesByUid.set(c,d)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(f.New(f.Event,"webglcontextlost"));this.SetSuspended(!0);for(var c of this._allObjectClasses)!c.IsFamily()&&
c.HasLoadedTextures()&&c.ReleaseTextures();(c=this.GetMainRunningLayout())&&c._OnWebGLContextLost();f.ImageInfo.OnWebGLContextLost();f.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,this.GetWebGLRenderer());this._dispatcher.dispatchEvent(f.New(f.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(c){this.SetSuspended(c.hidden)}_OnWindowBlur(c){this.IsPreview()&&this._pauseOnBlur&&!f.Platform.IsMobile&&
!c.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const c=this._tickCallbacks;"vsync"===this._framerateMode?-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=f.RequestUnlimitedAnimationFrame(c.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.renderOnly))):
-1===this._ruafId&&(this._ruafId=f.RequestUnlimitedAnimationFrame(c.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(f.CancelUnlimitedAnimationFrame(this._ruafId),this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(c){var d=this.IsSuspended();this._suspendCount+=c?1:-1;0>this._suspendCount&&(this._suspendCount=0);c=this.IsSuspended();!d&&c?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),
this._dispatcher.dispatchEvent(f.New(f.Event,"suspend")),this.Trigger(f.Plugins.System.Cnds.OnSuspend,null,null)):d&&!c&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=d=performance.now(),this._mainThreadTimeCounter=this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(f.New(f.Event,"resume")),this.Trigger(f.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(d))}_AddBehInstToTick(c){this._behInstsToTick.Add(c)}_AddBehInstToPostTick(c){this._behInstsToPostTick.Add(c)}_AddBehInstToTick2(c){this._behInstsToTick2.Add(c)}_RemoveBehInstToTick(c){this._behInstsToTick.Remove(c)}_RemoveBehInstToPostTick(c){this._behInstsToPostTick.Remove(c)}_RemoveBehInstToTick2(c){this._behInstsToTick2.Remove(c)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);
for(const c of this._behInstsToTick)c.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick)c.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2)c.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const c of this._behInstsToTick){const d=
c.Tick();f.IsIterator(d)&&(yield*d)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick){const d=c.PostTick();f.IsIterator(d)&&(yield*d)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2){const d=c.Tick2();f.IsIterator(d)&&(yield*d)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(c,d,
g){this._hasStartedTicking=!0;const k="background-wake"===g;g="background-wake"!==g&&"skip-render"!==g;this._hasStarted&&(!this.IsSuspended()||d||k)&&(d=performance.now(),this._isInTick=!0,c||(c=d),this._MeasureDt(c),c=this.Step_BeforePreTick(),this.IsDebugging()&&await c,c=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),c instanceof Promise&&await c,c=this.Step_AfterPreTick(),this.IsDebugging()&&await c,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),
this.GetLayoutManager().IsPendingChangeMainLayout()&&await this._MaybeChangeLayout(),c=this.Step_RunEventsEtc(),this.IsDebugging()&&await c,g&&this.Render(),this.IsSuspended()||k||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-d)}async Step_BeforePreTick(){const c=this._eventSheetManager,d=this.IsDebug();this.FlushPendingInstances();c.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());
d&&b.StartMeasuringTime();this.IsDebugging()?await c.DebugRunScheduledWaits():c.RunScheduledWaits();d&&b.AddEventsTime();this.PopCurrentLayout();c.BlockFlushingInstances(!1);this.FlushPendingInstances();c.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const c=this.IsDebug(),d=this.IsDebugging(),g=this._dispatcher,k=this._eventObjects,m=this._userScriptEventObjects;c&&b.StartMeasuringTime();d?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();d?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):
this._BehaviorPostTick();c&&b.AddBehaviorTickTime();c&&b.StartMeasuringTime();d?await this.DebugFireGeneratorEventAndBreak(k.tick):g.dispatchEvent(k.tick);c&&b.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(m.tick)}async Step_RunEventsEtc(){const c=this._eventSheetManager,d=this._dispatcher,g=this._eventObjects,k=this.IsDebug(),m=this.IsDebugging();k&&b.StartMeasuringTime();m?await c.DebugRunEvents(this._layoutManager):c.RunEvents(this._layoutManager);
k&&b.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();if(0<this._instancesToReleaseAtEndOfTick.size){d.SetDelayRemoveEventsEnabled(!0);for(const p of this._instancesToReleaseAffectedObjectClasses)p.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const p of this._instancesToReleaseAtEndOfTick)p.Release();this._instancesToReleaseAtEndOfTick.clear();
d.SetDelayRemoveEventsEnabled(!1)}this._isLayoutFirstTick=!1;c.BlockFlushingInstances(!0);k&&b.StartMeasuringTime();m?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();k&&b.AddBehaviorTickTime();k&&b.StartMeasuringTime();m?await this.DebugFireGeneratorEventAndBreak(g.tick2):d.dispatchEvent(g.tick2);k&&b.AddPluginTickTime();c.BlockFlushingInstances(!1);m&&await c.RunQueuedDebugTriggersAsync()}async _MaybeChangeLayout(){const c=this.GetLayoutManager();let d=0;for(;c.IsPendingChangeMainLayout()&&
10>d++;)await this._DoChangeLayout(c.GetPendingChangeMainLayout())}_MeasureDt(c){if(0!==this._lastTickTime){this._dt1=Math.max(c-this._lastTickTime,0)/1E3;const d=1/this._minimumFramerate;.5<this._dt1?this._dt1=0:this._dt1>d&&(this._dt1=d)}this._lastTickTime=c;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=c-this._fpsLastTime&&(this._fpsLastTime+=1E3,1E3<=c-this._fpsLastTime&&(this._fpsLastTime=
c),this._fps=this._fpsFrameCount,this._fpsFrameCount=0,this._mainThreadTime=Math.min(this._mainThreadTimeCounter/1E3,1),this._mainThreadTimeCounter=0,this._canvasManager&&this._canvasManager._Update1sFrameRange(),this._collisionEngine._Update1sStats(),this.IsDebug()&&b.Update1sPerfStats());this._fpsFrameCount++}async _DoChangeLayout(c){const d=this._dispatcher,g=this.GetLayoutManager().GetMainRunningLayout();await g._StopRunning();g._Unload(c,this.GetWebGLRenderer());g===c&&this._eventSheetManager.ClearAllScheduledWaits();
this._collisionEngine.ClearRegisteredCollisions();d.dispatchEvent(this._eventObjects.beforelayoutchange);f.Asyncify.SetHighThroughputMode(!0);await c._Load(g,this.GetWebGLRenderer());f.Asyncify.SetHighThroughputMode(!1);await c._StartRunning(!1);d.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender=!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}GetRenderer(){return this.GetWebGLRenderer()}Render(){if(this._canvasManager&&
!this._canvasManager.IsWebGLContextLost()){var c=this.GetWebGLRenderer();c.Start();c.CheckForQueryResults();if(this._needRender){var d=this.IsDebug();d&&b.StartMeasuringTime();this._needRender=!1;var g=null;c.SupportsGPUProfiling()&&(g=this._canvasManager.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),c.StartQuery(g));c.SetTextureFillMode();c.SetAlphaBlend();c.SetColorRgba(1,1,1,1);c.SetRenderTarget(null);c.SetTexture(null);this._layoutManager.GetMainRunningLayout().Draw(c);g&&c.EndQuery(g);c.Finish();
d&&(b.AddDrawCallsTime(),b.UpdateInspectHighlight());this._canvasManager&&this._canvasManager._MaybeTakeSnapshot()}else c.IncrementFrameNumber()}}Trigger(c,d,g){if(!this._hasStarted)return!1;var k=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let m=0;k&&(m=performance.now());const p=this.IsDebug();p&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._Trigger(this._layoutManager,c,d,g);k&&(k=performance.now()-m,this._mainThreadTimeCounter+=k,p&&b.AddTriggersTime(k));p&&this.SetDebuggingEnabled(!0);
return c}DebugTrigger(c,d,g){if(!this.IsDebug())return this.Trigger(c,d,g);if(this.HitBreakpoint())throw Error("called DebugTrigger() while stopped on breakpoint");if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,c,d,g)}async TriggerAsync(c,d,g){if(!this.IsDebugging())return this.Trigger(c,d,g);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(c,
d,g);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(c,d,g);const k=performance.now();c=this._eventSheetManager._DebugTrigger(this._layoutManager,c,d,g);for(d=c.next();!d.done;)await this.DebugBreak(d.value),d=c.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-k;return d.value}FastTrigger(c,
d,g){const k=this.IsDebug();k&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._FastTrigger(this._layoutManager,c,d,g);k&&this.SetDebuggingEnabled(!0);return c}DebugFastTrigger(c,d,g){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,c,d,g)}ScheduleTriggers(c){return this._scheduleTriggersThrottle.Add(c)}PushCurrentLayout(c){this._currentLayoutStack.push(c)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty");this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?
this._currentLayoutStack[this._currentLayoutStack.length-1]:this.GetMainRunningLayout()}GetDt(c){return c&&-1!==c.GetTimeScale()?this._dt1*c.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(c){if(isNaN(c)||0>c)c=0;this._timeScale=c}SetMinimumFramerate(c){this._minimumFramerate=f.clamp(c,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}IncrementExecCount(){++this._execCount}GetExecCount(){return this._execCount}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(c){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event");
return this._instancesByUid.get(c)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const c of this._allObjectClasses)if(!c.IsFamily())for(const d of c.GetInstances())this._instancesByUid.set(d.GetUID(),d)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===f.Platform.OS&&("cordova"===this._exportType||"playable-ad"===this._exportType||"instant-games"===
this._exportType)}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(c){c=!!c;this._isPixelRoundingEnabled!==c&&(this._isPixelRoundingEnabled=c,this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(c){this._saveToSlotName=
c}LoadFromSlot(c){this._loadFromSlotName=c}LoadFromJsonString(c){this._loadFromJson=c}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!(!this._saveToSlotName&&!this._loadFromSlotName&&null===this._loadFromJson)}async _HandleSaveOrLoad(){this._saveToSlotName&&(this.FlushPendingInstances(),await this._DoSaveToSlot(this._saveToSlotName),this._ClearSaveOrLoad());this._loadFromSlotName&&(await this._DoLoadFromSlot(this._loadFromSlotName),this._ClearSaveOrLoad(),this.IsDebug()&&
b.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(c){console.error("[Construct 3] Failed to load state from JSON string: ",c),await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._loadFromSlotName=this._saveToSlotName=
"";this._loadFromJson=null}_GetProjectStorage(){this._projectStorage||(this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._projectStorage}_GetSavegamesStorage(){this._savegamesStorage||(this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._savegamesStorage}async _DoSaveToSlot(c){const d=await this._SaveToJsonString();
try{await this._GetSavegamesStorage().setItem(c,d),console.log("[Construct 3] Saved state to storage ("+d.length+" chars)"),this._lastSaveJson=d,await this.TriggerAsync(f.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(g){console.error("[Construct 3] Failed to save state to storage: ",g),await this.TriggerAsync(f.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(c){try{const d=await this._GetSavegamesStorage().getItem(c);if(!d)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+
d.length+" chars)");await this._DoLoadFromJsonString(d);this._lastSaveJson=d;await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(d){console.error("[Construct 3] Failed to load state from storage: ",d),await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const c={c3save:!0,version:1,rt:{time:this.GetGameTime(),walltime:this.GetWallTime(),timescale:this.GetTimeScale(),tickcount:this.GetTickCount(),execcount:this.GetExecCount(),
next_uid:this._nextUid,running_layout:this.GetMainRunningLayout().GetSID(),start_time_offset:Date.now()-this._startTime},types:{},layouts:{},events:this._eventSheetManager._SaveToJson(),timelines:this._timelineManager._SaveToJson(),user_script_data:null};for(var d of this._allObjectClasses)d.IsFamily()||d.HasNoSaveBehavior()||(c.types[d.GetSID().toString()]=d._SaveToJson());for(const g of this._layoutManager.GetAllLayouts())c.layouts[g.GetSID().toString()]=g._SaveToJson();d=this._CreateUserScriptEvent("save");
d.saveData=null;await this.DispatchUserScriptEventAsyncWait(d);c.user_script_data=d.saveData;return JSON.stringify(c)}IsLoadingState(){return this._isLoadingState}_TriggerOnCreateAfterLoad(c){f.shallowAssignArray(this._triggerOnCreateAfterLoad,c)}async _DoLoadFromJsonString(c){c=JSON.parse(c);if(c.c2save)throw Error("C2 saves are incompatible with C3 runtime");if(!c.c3save)throw Error("not valid C3 save data");if(1<c.version)throw Error("C3 save data from future version");this._isLoadingState=!0;
var d=c.rt;this._gameTime.Set(d.time);this._wallTime.Set(d.walltime);this._timeScale=d.timescale;this._tickCount=d.tickcount;this._execCount=d.execcount;this._startTime=Date.now()-d.start_time_offset;var g=d.running_layout;if(g!==this.GetMainRunningLayout().GetSID())if(g=this._layoutManager.GetLayoutBySID(g))await this._DoChangeLayout(g);else return;for(const [p,n]of Object.entries(c.types))g=parseInt(p,10),g=this.GetObjectClassBySID(g),!g||g.IsFamily()||g.HasNoSaveBehavior()||g._LoadFromJson(n);
this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=d.next_uid;for(const [p,n]of Object.entries(c.layouts))d=parseInt(p,10),(d=this._layoutManager.GetLayoutBySID(d))&&d._LoadFromJson(n);this._eventSheetManager._LoadFromJson(c.events);for(var k of this._triggerOnCreateAfterLoad)k._TriggerOnCreated(),k.SetupInitialSceneGraphConnections();f.clearArray(this._triggerOnCreateAfterLoad);for(var m of this._allObjectClasses)if(!m.IsFamily()&&m.IsInContainer())for(const p of m.GetInstances()){k=
p.GetIID();for(const n of m.GetContainer().objectTypes())if(n!==m){d=n.GetInstances();if(0>k||k>=d.length)throw Error("missing sibling instance");p._AddSibling(d[k])}}this._timelineManager._LoadFromJson(c.timelines);this._dispatcher.dispatchEvent(f.New(f.Event,"afterload"));m=this._CreateUserScriptEvent("load");m.saveData=c.user_script_data;await this.DispatchUserScriptEventAsyncWait(m);this.UpdateRender()}async AddJobWorkerScripts(c){c=(await Promise.all(c.map(d=>this._assetManager.FetchBlob(d)))).map(d=>
URL.createObjectURL(d));this._jobScheduler.ImportScriptsToJobWorkers(c)}AddJobWorkerBlob(c,d){this._jobScheduler.SendBlobToJobWorkers(c,d)}AddJobWorkerBuffer(c,d){this._jobScheduler.SendBufferToJobWorkers(c,d)}AddJob(c,d,g){return this._jobScheduler.AddJob(c,d,g)}BroadcastJob(c,d,g){return this._jobScheduler.BroadcastJob(c,d,g)}InvokeDownload(c,d){this.PostComponentMessageToDOM("runtime","invoke-download",{url:c,filename:d})}async RasterSvgImage(c,d,g,k,m,p){k=k||d;m=m||g;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime",
"raster-svg-image",{blob:c,imageWidth:d,imageHeight:g,surfaceWidth:k,surfaceHeight:m,imageBitmapOpts:p})).imageBitmap;c=await self.C3_RasterSvgImageBlob(c,d,g,k,m);return p?await self.createImageBitmap(c,p):c}async GetSvgImageSize(c){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{blob:c}):await self.C3_GetSvgImageSize(c)}RequestDeviceOrientationEvent(){this._didRequestDeviceOrientationEvent||(this._didRequestDeviceOrientationEvent=!0,this.PostComponentMessageToDOM("runtime",
"enable-device-orientation"))}RequestDeviceMotionEvent(){this._didRequestDeviceMotionEvent||(this._didRequestDeviceMotionEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-motion"))}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(c){this._randomNumberCallback=c}_GetRemotePreviewStatusInfo(){return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:this.GetWebGLRenderer().GetUnmaskedRenderer()}}HitBreakpoint(){return this.IsDebug()?
b.HitBreakpoint():!1}DebugBreak(c){return this.IsDebugging()?b.DebugBreak(c):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?b.BreakNext():!1}SetDebugBreakpointsEnabled(c){this._breakpointsEnabled=!!c;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(c){c?this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&
this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&b.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetWebGLRenderer().SupportsGPUProfiling()&&b.IsGPUProfiling()}async DebugIterateAndBreak(c){if(c)for(const d of c)await this.DebugBreak(d)}DebugFireGeneratorEventAndBreak(c){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(c))}_InvokeFunctionFromJS(c){return this._eventSheetManager._InvokeFunctionFromJS(c.name,c.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(c){c=
f.New(f.Event,c,!1);c.runtime=this._iRuntime;return c}_InitScriptInterfaces(){var c={};for(const d of this._allObjectClasses)c[d.GetJsPropName()]={value:d.GetIObjectClass(),enumerable:!0,writable:!1};c=Object.create(Object.prototype,c);this._iRuntime=new self.IRuntime(this,c);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const c={};for(const d of this.GetEventSheetManager().GetAllGlobalVariables())c[d.GetJsPropName()]=d._GetScriptInterfaceDescriptor();
this._iRuntime._InitGlobalVars(c)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(c,d){this._interfaceMap.set(c,d)}_UnwrapScriptInterface(c){return this._interfaceMap.get(c)}};self.C3_CreateRuntime=f.Runtime.Create;self.C3_InitRuntime=(c,d)=>c.Init(d)}"use strict";
{const f=self.C3;f.JobSchedulerRuntime=class extends f.DefendedBase{constructor(b,a){super();this._runtime=b;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=a.inputPort;a.outputPort.onmessage=e=>this._OnJobWorkerMessage(e);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,e,c,d){e||(e=[]);const g=this._nextJobId++;b={type:b,isBroadcast:!1,jobId:g,params:a,transferables:e};a=new Promise((k,m)=>{this._jobPromises.set(g,{resolve:k,progress:c,reject:m,cancelled:!1})});d&&d.SetAction(()=>this._CancelJob(g));this._inputPort.postMessage(b,e);this._MaybeCreateExtraWorker();return a}BroadcastJob(b,a,e){e||(e=[]);const c=this._nextJobId++;this._inputPort.postMessage({type:b,
isBroadcast:!0,jobId:c,params:a,transferables:e},e)}_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,e=b.jobId;switch(a){case "result":this._OnJobResult(e,b.result);break;case "progress":this._OnJobProgress(e,b.progress);break;case "error":this._OnJobError(e,b.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${a}'`);
}}_OnJobResult(b,a){const e=this._jobPromises.get(b);if(!e)throw Error("invalid job ID");e.cancelled||e.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 e=this._jobPromises.get(b);if(!e)throw Error("invalid job ID");e.cancelled||e.reject(a);this._jobPromises.delete(b)}_OnJobWorkerReady(){this._isCreatingWorker&&(this._isCreatingWorker=!1,this._jobWorkerCount++,this._jobWorkerCount<
this._maxNumWorkers?this._MaybeCreateExtraWorker():this._inputPort.postMessage({type:"_no_more_workers"}))}async _MaybeCreateExtraWorker(){if(!(this._jobWorkerCount>=this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._jobPromises.size<=this._jobWorkerCount))try{this._isCreatingWorker=!0,(await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker")).outputPort.onmessage=b=>this._OnJobWorkerMessage(b)}catch(b){this._hadErrorCreatingWorker=!0,this._isCreatingWorker=
!1,console.error(`[Construct 3] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,b)}}}}self.C3_Shaders={};"use strict";
{const f=self.C3;let b=null,a="",e="",c=[],d="",g="",k="";const m=f.New(f.ArrayStack);function p(n,u){n=n[1];u=u[1];if("number"===typeof n&&"number"===typeof u)return n-u;n=""+n;u=""+u;return n<u?-1:n>u?1:0}f.Plugins.System=class extends f.SDKPluginBase{constructor(n){super(n);this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingComplete=this._imagesLoadingTotal=0;this._functionMaps=new Map}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(n){this._runtime.Trigger(n,
null,null)}GetRegex(n,u){b&&n===a&&u===e||(b=new RegExp(n,u),a=n,e=u);b.lastIndex=0;return b}GetRegexMatches(n,u,q){if(n===d&&u===g&&q===k)return c;const r=this.GetRegex(u,q);c=n.match(r);d=n;g=u;k=q;return c}async _LoadTexturesForObjectClasses(n,u){if(u.length){this._imagesLoadingTotal+=u.length;var q=[];for(const r of u)q.push(n.MaybeLoadTexturesFor(r));await f.PromiseAllWithProgress(q,()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&
(this._runtime.Trigger(f.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(n,u){for(const q of u)0===q.GetInstanceCount()&&n.MaybeUnloadTexturesFor(q)}_GetForEachStack(){return m}_Repeat(n){var u=this._runtime.GetEventSheetManager();const q=u.GetEventStack(),r=q.GetCurrentStackFrame(),t=r.GetCurrentEvent(),x=t.GetSolModifiers();var z=r.IsSolModifierAfterCnds();const D=q.Push(t),G=u.GetLoopStack(),w=G.Push();
w.SetEnd(n);if(z)for(z=0;z<n&&!w.IsStopped();++z)u.PushCopySol(x),w.SetIndex(z),t.Retrigger(r,D),u.PopSol(x);else for(u=0;u<n&&!w.IsStopped();++u)w.SetIndex(u),t.Retrigger(r,D);q.Pop();G.Pop();return!1}*_DebugRepeat(n){var u=this._runtime.GetEventSheetManager();const q=u.GetEventStack(),r=q.GetCurrentStackFrame(),t=r.GetCurrentEvent(),x=t.GetSolModifiers();var z=r.IsSolModifierAfterCnds();const D=q.Push(t),G=u.GetLoopStack(),w=G.Push();w.SetEnd(n);if(z)for(z=0;z<n&&!w.IsStopped();++z)u.PushCopySol(x),
w.SetIndex(z),yield*t.DebugRetrigger(r,D),u.PopSol(x);else for(u=0;u<n&&!w.IsStopped();++u)w.SetIndex(u),yield*t.DebugRetrigger(r,D);q.Pop();G.Pop();return!1}_While(){var n=this._runtime.GetEventSheetManager();const u=n.GetEventStack(),q=u.GetCurrentStackFrame(),r=q.GetCurrentEvent(),t=r.GetSolModifiers();var x=q.IsSolModifierAfterCnds();const z=u.Push(r),D=n.GetLoopStack(),G=D.Push();if(x)for(x=0;!G.IsStopped();++x)n.PushCopySol(t),G.SetIndex(x),r.Retrigger(q,z)||G.Stop(),n.PopSol(t);else for(n=
0;!G.IsStopped();++n)G.SetIndex(n),r.Retrigger(q,z)||G.Stop();u.Pop();D.Pop();return!1}*_DebugWhile(){var n=this._runtime.GetEventSheetManager();const u=n.GetEventStack(),q=u.GetCurrentStackFrame(),r=q.GetCurrentEvent(),t=r.GetSolModifiers();var x=q.IsSolModifierAfterCnds();const z=u.Push(r),D=n.GetLoopStack(),G=D.Push();if(x)for(x=0;!G.IsStopped();++x)n.PushCopySol(t),G.SetIndex(x),(yield*r.DebugRetrigger(q,z))||G.Stop(),n.PopSol(t);else for(n=0;!G.IsStopped();++n)G.SetIndex(n),(yield*r.DebugRetrigger(q,
z))||G.Stop();u.Pop();D.Pop();return!1}_For(n,u,q){var r=this._runtime.GetEventSheetManager();const t=r.GetEventStack(),x=t.GetCurrentStackFrame(),z=x.GetCurrentEvent(),D=z.GetSolModifiers(),G=x.IsSolModifierAfterCnds(),w=t.Push(z),B=r.GetLoopStack(),I=B.Push();I.SetName(n);I.SetEnd(q);if(q<u)if(G)for(n=u;n>=q&&!I.IsStopped();--n)r.PushCopySol(D),I.SetIndex(n),z.Retrigger(x,w),r.PopSol(D);else for(r=u;r>=q&&!I.IsStopped();--r)I.SetIndex(r),z.Retrigger(x,w);else if(G)for(n=u;n<=q&&!I.IsStopped();++n)r.PushCopySol(D),
I.SetIndex(n),z.Retrigger(x,w),r.PopSol(D);else for(r=u;r<=q&&!I.IsStopped();++r)I.SetIndex(r),z.Retrigger(x,w);t.Pop();B.Pop();return!1}*_DebugFor(n,u,q){var r=this._runtime.GetEventSheetManager();const t=r.GetEventStack(),x=t.GetCurrentStackFrame(),z=x.GetCurrentEvent(),D=z.GetSolModifiers(),G=x.IsSolModifierAfterCnds(),w=t.Push(z),B=r.GetLoopStack(),I=B.Push();I.SetName(n);I.SetEnd(q);if(q<u)if(G)for(n=u;n>=q&&!I.IsStopped();--n)r.PushCopySol(D),I.SetIndex(n),yield*z.DebugRetrigger(x,w),r.PopSol(D);
else for(r=u;r>=q&&!I.IsStopped();--r)I.SetIndex(r),yield*z.DebugRetrigger(x,w);else if(G)for(n=u;n<=q&&!I.IsStopped();++n)r.PushCopySol(D),I.SetIndex(n),yield*z.DebugRetrigger(x,w),r.PopSol(D);else for(r=u;r<=q&&!I.IsStopped();++r)I.SetIndex(r),yield*z.DebugRetrigger(x,w);t.Pop();B.Pop();return!1}_ForEach(n){var u=this._runtime.GetEventSheetManager();const q=u.GetEventStack(),r=q.GetCurrentStackFrame(),t=r.GetCurrentEvent(),x=t.GetSolModifiers();var z=r.IsSolModifierAfterCnds();const D=q.Push(t),
G=u.GetLoopStack(),w=G.Push(),B=n.IsInContainer(),I=n.GetCurrentSol(),P=m.Push();f.shallowAssignArray(P,I.GetInstances());w.SetEnd(P.length);if(z)for(let E=0,J=P.length;E<J&&!w.IsStopped();++E)u.PushCopySol(x),z=P[E],n.GetCurrentSol().SetSinglePicked(z),B&&z.SetSiblingsSinglePicked(),w.SetIndex(E),t.Retrigger(r,D),u.PopSol(x);else{I._SetSelectAll(!1);n=I._GetOwnInstances();f.clearArray(n);n.push(null);for(let E=0,J=P.length;E<J&&!w.IsStopped();++E)u=P[E],n[0]=u,B&&u.SetSiblingsSinglePicked(),w.SetIndex(E),
t.Retrigger(r,D)}q.Pop();G.Pop();f.clearArray(P);m.Pop();return!1}*_DebugForEach(n){var u=this._runtime.GetEventSheetManager();const q=u.GetEventStack(),r=q.GetCurrentStackFrame(),t=r.GetCurrentEvent(),x=t.GetSolModifiers();var z=r.IsSolModifierAfterCnds();const D=q.Push(t),G=u.GetLoopStack(),w=G.Push(),B=n.IsInContainer(),I=n.GetCurrentSol(),P=m.Push();f.shallowAssignArray(P,I.GetInstances());w.SetEnd(P.length);if(z)for(let E=0,J=P.length;E<J&&!w.IsStopped();++E)u.PushCopySol(x),z=P[E],n.GetCurrentSol().SetSinglePicked(z),
B&&z.SetSiblingsSinglePicked(),w.SetIndex(E),yield*t.DebugRetrigger(r,D),u.PopSol(x);else{I._SetSelectAll(!1);n=I._GetOwnInstances();f.clearArray(n);n.push(null);for(let E=0,J=P.length;E<J&&!w.IsStopped();++E)u=P[E],n[0]=u,B&&u.SetSiblingsSinglePicked(),w.SetIndex(E),yield*t.DebugRetrigger(r,D)}q.Pop();G.Pop();f.clearArray(P);m.Pop();return!1}_ForEachOrdered(n,u){var q=this._runtime.GetEventSheetManager();const r=q.GetEventStack(),t=q.GetCurrentCondition(),x=r.GetCurrentStackFrame(),z=x.GetCurrentEvent(),
D=z.GetSolModifiers(),G=x.IsSolModifierAfterCnds(),w=r.Push(z),B=q.GetLoopStack(),I=B.Push(),P=n.IsInContainer(),E=n.GetCurrentSol(),J=m.Push();f.clearArray(J);const O=E.GetInstances();I.SetEnd(O.length);for(let R=0,T=O.length;R<T;++R)J.push([O[R],t.ReevaluateParameter(1,R)]);J.sort(p);1===u&&J.reverse();if(G)for(let R=0,T=J.length;R<T&&!I.IsStopped();++R)q.PushCopySol(D),u=J[R][0],n.GetCurrentSol().SetSinglePicked(u),P&&u.SetSiblingsSinglePicked(),I.SetIndex(R),z.Retrigger(x,w),q.PopSol(D);else{E._SetSelectAll(!1);
n=E._GetOwnInstances();f.clearArray(n);n.push(null);for(let R=0,T=J.length;R<T&&!I.IsStopped();++R)q=J[R][0],n[0]=q,P&&q.SetSiblingsSinglePicked(),I.SetIndex(R),z.Retrigger(x,w)}r.Pop();B.Pop();f.clearArray(J);m.Pop();return!1}*_DebugForEachOrdered(n,u){var q=this._runtime.GetEventSheetManager();const r=q.GetEventStack(),t=q.GetCurrentCondition(),x=r.GetCurrentStackFrame(),z=x.GetCurrentEvent(),D=z.GetSolModifiers(),G=x.IsSolModifierAfterCnds(),w=r.Push(z),B=q.GetLoopStack(),I=B.Push(),P=n.IsInContainer(),
E=n.GetCurrentSol(),J=m.Push();f.clearArray(J);const O=E.GetInstances();I.SetEnd(O.length);for(let R=0,T=O.length;R<T;++R)J.push([O[R],t.ReevaluateParameter(1,R)]);J.sort(p);1===u&&J.reverse();if(G)for(let R=0,T=J.length;R<T&&!I.IsStopped();++R)q.PushCopySol(D),u=J[R][0],n.GetCurrentSol().SetSinglePicked(u),P&&u.SetSiblingsSinglePicked(),I.SetIndex(R),yield*z.DebugRetrigger(x,w),q.PopSol(D);else{E._SetSelectAll(!1);n=E._GetOwnInstances();f.clearArray(n);n.push(null);for(let R=0,T=J.length;R<T&&!I.IsStopped();++R)q=
J[R][0],n[0]=q,P&&q.SetSiblingsSinglePicked(),I.SetIndex(R),yield*z.DebugRetrigger(x,w)}r.Pop();B.Pop();f.clearArray(J);m.Pop();return!1}_GetFunctionMap(n,u){let q=this._functionMaps.get(n);if(q)return q;if(!u)return null;q={defaultFunc:null,strMap:new Map};this._functionMaps.set(n,q);return q}_DoCallMappedFunction(n,u,q,r,t){u.GetEventBlock().RunAsMappedFunctionCall(q);r&&n.PopSol(t)}*_DebugDoCallMappedFunction(n,u,q,r,t){yield*u.GetEventBlock().DebugRunAsMappedFunctionCall(q);r&&n.PopSol(t)}}}"use strict";
{const f=self.C3;f.Plugins.System.Type=class extends f.DefendedBase{constructor(b){super();this._objectClass=b;this._runtime=b.GetRuntime();this._plugin=b.GetPlugin()}OnCreate(){}Release(){this._plugin=this._runtime=this._objectClass=null}}}"use strict";
{const f=self.C3;f.Plugins.System.Instance=class extends f.DefendedBase{constructor(b,a){super();this._inst=b;this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._runtime=this._inst.GetRuntime()}Release(){this._runtime=this._sdkType=this._objectClass=this._inst=null}}}"use strict";
{const f=self.C3,b=[];f.Plugins.System.Cnds={EveryTick(){return!0},OnLayoutStart(){return!0},OnLayoutEnd(){return!0},OnSuspend(){return!0},OnResume(){return!0},IsSuspended(){return this._runtime.IsSuspended()},Else(){const a=this._runtime.GetCurrentEventStackFrame();return a.GetElseBranchRan()?!1:!a.GetLastEventTrue()},TriggerOnce(){const a=this._runtime.GetCurrentCondition().GetSavedDataMap();let e=a.get("TriggerOnce_lastTick");"undefined"===typeof e&&(e=-1,a.set("TriggerOnce_lastTick",-1));const c=
this._runtime.GetTickCount();a.set("TriggerOnce_lastTick",c);return this._runtime.IsLayoutFirstTick()||e!==c-1},Every(a){const e=this._runtime.GetCurrentCondition().GetSavedDataMap(),c=e.get("Every_lastTime")||0,d=this._runtime.GetGameTime();e.has("Every_seconds")||e.set("Every_seconds",a);const g=e.get("Every_seconds");if(d>=c+g)return e.set("Every_lastTime",c+g),d>=e.get("Every_lastTime")+.04&&e.set("Every_lastTime",d),e.set("Every_seconds",a),!0;d<c-.1&&e.set("Every_lastTime",d);return!1},IsGroupActive(a){return(a=
this._runtime.GetEventSheetManager().GetEventGroupByName(a))&&a.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return f.Platform.IsMobile},OnLoadFinished(){return!0},OnCanvasSnapshot(){return!0},EffectsSupported(){return!0},OnSaveComplete(){return!0},OnSaveFailed(){return!0},OnLoadComplete(){return!0},OnLoadFailed(){return!0},ObjectUIDExists(a){return!!this._runtime.GetInstanceByUID(a)},IsOnPlatform(a){switch(a){case 0:return"browser"===f.Platform.Context;case 1:return"iOS"===
f.Platform.OS;case 2:return"Android"===f.Platform.OS;case 8:return"cordova"===f.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===f.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(a,e,c){return this.GetRegex(e,c).test(a)},Compare(a,e,c){return f.compare(a,e,c)},CompareBetween(a,e,c){return a>=e&&a<=c},CompareVar(a,e,c){return f.compare(a.GetValue(),e,c)},CompareBoolVar(a){return!!a.GetValue()},
CompareTime(a,e){const c=this._runtime.GetGameTime();return 0===a?(a=this._runtime.GetCurrentCondition().GetSavedDataMap(),!a.get("CompareTime_executed")&&c>=e?(a.set("CompareTime_executed",!0),!0):!1):f.compare(c,a,e)},IsNaN(a){return isNaN(a)},AngleWithin(a,e,c){return f.angleDiff(f.toRadians(a),f.toRadians(c))<=f.toRadians(e)},IsClockwiseFrom(a,e){return f.angleClockwise(f.toRadians(a),f.toRadians(e))},IsBetweenAngles(a,e,c){a=f.toRadians(a);e=f.toRadians(e);c=f.toRadians(c);return f.angleClockwise(c,
e)?f.angleClockwise(a,e)&&!f.angleClockwise(a,c):!(!f.angleClockwise(a,e)&&f.angleClockwise(a,c))},IsValueType(a,e){return"number"===typeof a?0===e:1===e},EvaluateExpression(a){return!!a},PickByComparison(a,e,c,d){if(!a)return!1;const g=this._GetForEachStack(),k=g.Push(),m=a.GetCurrentSol();f.shallowAssignArray(k,m.GetInstances());m.IsSelectAll()&&f.clearArray(m._GetOwnElseInstances());const p=this._runtime.GetCurrentCondition();let n=0;for(let u=0,q=k.length;u<q;++u){const r=k[u];k[n]=r;e=p.ReevaluateParameter(1,
u);d=p.ReevaluateParameter(3,u);f.compare(e,c,d)?++n:m._PushElseInstance(r)}f.truncateArray(k,n);m.SetArrayPicked(k);e=!!k.length;f.clearArray(k);g.Pop();a.ApplySolToContainer();return e},PickByEvaluate(a,e){if(!a)return!1;const c=this._GetForEachStack(),d=c.Push(),g=a.GetCurrentSol();f.shallowAssignArray(d,g.GetInstances());g.IsSelectAll()&&f.clearArray(g._GetOwnElseInstances());const k=this._runtime.GetCurrentCondition();let m=0;for(let p=0,n=d.length;p<n;++p){const u=d[p];d[m]=u;(e=k.ReevaluateParameter(1,
p))?++m:g._PushElseInstance(u)}f.truncateArray(d,m);g.SetArrayPicked(d);e=!!d.length;f.clearArray(d);c.Pop();a.ApplySolToContainer();return e},PickNth(a,e){if(!a)return!1;const c=a.GetCurrentSol(),d=c.GetInstances();e=Math.floor(e);if(e>=d.length)return!1;c.PickOne(d[e]);a.ApplySolToContainer();return!0},PickRandom(a){if(!a)return!1;const e=a.GetCurrentSol(),c=e.GetInstances(),d=Math.floor(this._runtime.Random()*c.length);if(d>=c.length)return!1;e.PickOne(c[d]);a.ApplySolToContainer();return!0},PickAll(a){if(!a||
!a.GetInstanceCount())return!1;a.GetCurrentSol()._SetSelectAll(!0);a.ApplySolToContainer();return!0},PickOverlappingPoint(a,e,c){if(!a)return!1;const d=a.GetCurrentSol();var g=d.GetInstances();const k=this._runtime.GetCurrentEvent().IsOrBlock(),m=this._runtime.GetCurrentCondition().IsInverted();d.IsSelectAll()?(f.shallowAssignArray(b,g),d.ClearArrays(),d._SetSelectAll(!1)):k?(f.shallowAssignArray(b,d._GetOwnElseInstances()),f.clearArray(d._GetOwnElseInstances())):(f.shallowAssignArray(b,d._GetOwnInstances()),
f.clearArray(d._GetOwnInstances()));for(let p=0,n=b.length;p<n;++p)g=b[p],f.xor(g.GetWorldInfo().ContainsPoint(e,c),m)?d._PushInstance(g):d._PushElseInstance(g);a.ApplySolToContainer();return f.xor(!!d._GetOwnInstances().length,m)},PickLastCreated(a){if(!a)return!1;var e=a.IsFamily();let c=null;const d=this._runtime._GetInstancesPendingCreate();for(let g=d.length-1;0<=g;--g){const k=d[g];if(e){if(k.GetObjectClass().BelongsToFamily(a)){c=k;break}}else if(k.GetObjectClass()===a){c=k;break}}c||(e=a.GetInstances(),
e.length&&(c=e[e.length-1]));if(!c)return!1;a.GetCurrentSol().PickOne(c);a.ApplySolToContainer();return!0},Repeat(a){return this._runtime.IsDebugging()?this._DebugRepeat(a):this._Repeat(a)},While(){return this._runtime.IsDebugging()?this._DebugWhile():this._While()},For(a,e,c){return this._runtime.IsDebugging()?this._DebugFor(a,e,c):this._For(a,e,c)},ForEach(a){return this._runtime.IsDebugging()?this._DebugForEach(a):this._ForEach(a)},ForEachOrdered(a,e,c){return this._runtime.IsDebugging()?this._DebugForEachOrdered(a,
c):this._ForEachOrdered(a,c)},LayerVisible(a){return a?a.IsVisible():!1},LayerEmpty(a){return a?!a.GetInstanceCount():!1},LayerCmpOpacity(a,e,c){return a?f.compare(100*a.GetOpacity(),e,c):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}}"use strict";
{const f=self.C3;function b(k,m){const p=k[0]-m[0];return 0!==p?p:k[1]-m[1]}function a(k,m){return k[1]-m[1]}const e=[],c=[],d=f.New(f.Rect),g=f.New(f.Color);f.Plugins.System.Acts={SetVar(k,m){k.SetValue(m)},AddVar(k,m){k.IsNumber()&&"number"!==typeof m&&(m=parseFloat(m));k.SetValue(k.GetValue()+m)},SubVar(k,m){k.IsNumber()&&k.SetValue(k.GetValue()-m)},SetBoolVar(k,m){k.SetValue(!!m)},ToggleBoolVar(k){k.SetValue(!k.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},
CreateObject(k,m,p,n){if(k&&m&&(m=this._runtime.CreateInstance(k,m,p,n))){p=this._runtime.GetEventSheetManager();p.BlockFlushingInstances(!0);m._TriggerOnCreated();if(m.IsInContainer())for(const u of m.siblings())u._TriggerOnCreated();p.BlockFlushingInstances(!1);k.GetCurrentSol().SetSinglePicked(m);m.IsInContainer()&&m.SetSiblingsSinglePicked()}},CreateObjectByName(k,m,p,n){k&&m&&(k=this._runtime.GetObjectClassByName(k))&&f.Plugins.System.Acts.CreateObject.call(this,k,m,p,n)},RecreateInitialObjects(k,
m,p,n,u,q,r,t,x){if(k){var z=this._runtime.GetCurrentLayout();if(q&&(z=this._runtime.GetLayoutManager().GetLayoutByName(q),!z))return;q=null;if("number"!==typeof r||0<=r)if(q=z.GetLayer(r),!q)return;d.set(m,p,n,u);m=z.RecreateInitialObjects(k,d,q,t,x);k.GetCurrentSol().SetArrayPicked(m);k.ApplySolToContainer()}},StopLoop(){const k=this._loopStack;k.IsInLoop()&&k.GetCurrent().Stop()},SetGroupActive(k,m){(k=this._runtime.GetEventSheetManager().GetEventGroupByName(k))&&(0===m?k.SetGroupActive(!1):1===
m?k.SetGroupActive(!0):k.SetGroupActive(!k.IsGroupActive()))},SetTimescale(k){this._runtime.SetTimeScale(k)},SetObjectTimescale(k,m){0>m&&(m=0);if(k){k=k.GetCurrentSol().GetInstances();for(const p of k)p.SetTimeScale(m)}},RestoreObjectTimescale(k){if(k){k=k.GetCurrentSol().GetInstances();for(const m of k)m.RestoreTimeScale()}},Wait(k){if(!(0>k))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(k),!0},WaitForSignal(k){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(k);
return!0},WaitForPreviousActions(){const k=this._runtime.GetEventSheetManager();k.AddScheduledWait().InitPromise(k.GetPromiseForAllAsyncActions());return!0},Signal(k){k=k.toLowerCase();for(const m of this._runtime.GetEventSheetManager().scheduledWaits())m.IsSignal()&&m.GetSignalTag()===k&&m.SetSignalled()},async SnapshotCanvas(k,m,p,n,u,q){const r=this._runtime.GetCanvasManager();r&&(this.UpdateRender(),await r.SnapshotCanvas(0===k?"image/png":"image/jpeg",m/100,p,n,u,q),await this._runtime.TriggerAsync(f.Plugins.System.Cnds.OnCanvasSnapshot,
null))},SetCanvasSize(k,m){if(!(0>=k||0>=m)){this._runtime.SetViewportSize(k,m);var p=this._runtime.GetCurrentLayout();p.BoundScrolling();for(const n of p.GetLayers())n.UpdateViewport();if(p=this._runtime.GetCanvasManager())"off"!==p.GetCurrentFullscreenMode()&&this._runtime.SetOriginalViewportSize(k,m),p.SetSize(p.GetLastWidth(),p.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(k){const m=this._runtime.GetCanvasManager();m&&"off"!==m.GetCurrentFullscreenMode()&&(m.SetFullscreenScalingQuality(0!==
k?"high":"low"),m.SetSize(m.GetLastWidth(),m.GetLastHeight(),!0))},SaveState(k){this._runtime.SaveToSlot(k)},LoadState(k){this._runtime.LoadFromSlot(k)},LoadStateJSON(k){this._runtime.LoadFromJsonString(k)},SetHalfFramerateMode(k){},ResetPersisted(){for(const k of this._runtime.GetLayoutManager().GetAllLayouts())k.ResetPersistData()},SetPixelRounding(k){this._runtime.SetPixelRoundingEnabled(0!==k)},SetMinimumFramerate(k){this._runtime.SetMinimumFramerate(k)},SortZOrderByInstVar(k,m){if(k){var p=k.GetCurrentSol().GetInstances(),
n=this._runtime.GetCurrentLayout(),u=k.IsFamily();k=k.GetFamilyIndex();for(let r=0,t=p.length;r<t;++r){var q=p[r];const x=q.GetWorldInfo();if(!x)continue;let z;z=u?q.GetInstanceVariableValue(m+q.GetObjectClass().GetFamilyInstanceVariableOffset(k)):q.GetInstanceVariableValue(m);e.push([x.GetLayer().GetIndex(),x.GetZIndex()]);c.push([q,z])}if(e.length){e.sort(b);c.sort(a);m=!1;for(let r=0,t=e.length;r<t;++r)p=c[r][0],u=n.GetLayerByIndex(e[r][0]),k=e[r][1],q=u._GetInstances(),q[k]!==p&&(q[k]=p,p.GetWorldInfo()._SetLayer(u),
u.SetZIndicesChanged(),m=!0);m&&this._runtime.UpdateRender();f.clearArray(e);f.clearArray(c)}}},GoToLayout(k){if(!this._runtime.IsLoading()){var m=this._runtime.GetLayoutManager();m.IsPendingChangeMainLayout()||m.ChangeMainLayout(k)}},GoToLayoutByName(k){if(!this._runtime.IsLoading()){var m=this._runtime.GetLayoutManager();m.IsPendingChangeMainLayout()||(k=m.GetLayoutByName(k))&&m.ChangeMainLayout(k)}},NextPrevLayout(k){if(!this._runtime.IsLoading()){var m=this._runtime.GetLayoutManager();if(!m.IsPendingChangeMainLayout()){var p=
m.GetAllLayouts(),n=p.indexOf(m.GetMainRunningLayout());k&&0===n||(k||n!==p.length-1)&&m.ChangeMainLayout(p[n+(k?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var k=this._runtime.GetLayoutManager();k.IsPendingChangeMainLayout()||(k.ChangeMainLayout(k.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(k,m){k&&k.SetVisible(m)},SetLayerOpacity(k,m){k&&k.SetOpacity(m/100)},SetLayerScale(k,m){k&&k.SetOwnScale(m)},SetLayerScaleRate(k,
m){k&&k.SetScaleRate(m)},SetLayerAngle(k,m){k&&(m=f.clampAngle(f.toRadians(+m)),k.GetOwnAngle()!==m&&(k.SetAngle(m),this.UpdateRender()))},SetLayerParallax(k,m,p){k&&k.SetParallax(m/100,p/100)},SetLayerZElevation(k,m){k&&k.SetZElevation(m)},SetLayerBackground(k,m){k&&(g.setFromRgbValue(m),g.clamp(),k=k.GetBackgroundColor(),k.equalsIgnoringAlpha(g)||(k.copyRgb(g),this.UpdateRender()))},SetLayerTransparent(k,m){k&&(m=!!m,k.IsTransparent()!==m&&(k.SetTransparent(m),this.UpdateRender()))},SetLayerBlendMode(k,
m){k&&k.GetBlendMode()!==m&&(k.SetBlendMode(m),this.UpdateRender())},SetLayerEffectEnabled(k,m,p){k&&(k=k.GetEffectList(),p=k.GetEffectTypeByName(p))&&(m=1===m,p.IsActive()!==m&&(p.SetActive(m),k.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(k,m,p,n){if(k&&(k=k.GetEffectList(),m=k.GetEffectTypeByName(m))){var u=m.GetIndex();k=k.GetEffectParametersForIndex(u);p=Math.floor(p);if(!(0>p||p>=k.length)){u=m.GetShaderProgram().GetParameterType(p);if("color"===u){g.setFromRgbValue(n);
p=k[p];if(g.equalsIgnoringAlpha(p))return;p.copyRgb(g)}else{"percent"===u&&(n/=100);if(k[p]===n)return;k[p]=n}m.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(k,m){k&&(m=!!m,k.IsForceOwnTexture()!==m&&(k.SetForceOwnTexture(m),this.UpdateRender()))},SetLayoutScale(k){const m=this._runtime.GetCurrentLayout();m.GetScale()!==k&&(m.SetScale(k),this.UpdateRender())},SetLayoutAngle(k){k=f.clampAngle(f.toRadians(+k));const m=this._runtime.GetCurrentLayout();m.GetAngle()!==k&&(m.SetAngle(k),
this.UpdateRender())},SetLayoutEffectEnabled(k,m){const p=this._runtime.GetCurrentLayout().GetEffectList();if(m=p.GetEffectTypeByName(m))k=1===k,m.IsActive()!==k&&(m.SetActive(k),p.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(k,m,p){var n=this._runtime.GetCurrentLayout().GetEffectList();if(k=n.GetEffectTypeByName(k)){var u=k.GetIndex();n=n.GetEffectParametersForIndex(u);m=Math.floor(m);if(!(0>m||m>=n.length)){u=k.GetShaderProgram().GetParameterType(m);if("color"===u){g.setFromRgbValue(p);
m=n[m];if(g.equalsIgnoringAlpha(m))return;m.copyRgb(g)}else{"percent"===u&&(p/=100);if(n[m]===p)return;n[m]=p}k.IsActive()&&this._runtime.UpdateRender()}}},ScrollX(k){this._runtime.GetCurrentLayout().SetScrollX(k)},ScrollY(k){this._runtime.GetCurrentLayout().SetScrollY(k)},Scroll(k,m){const p=this._runtime.GetCurrentLayout();p.SetScrollX(k);p.SetScrollY(m)},ScrollToObject(k){if(k&&(k=k.GetFirstPicked())&&(k=k.GetWorldInfo())){var m=this._runtime.GetCurrentLayout();m.SetScrollX(k.GetX());m.SetScrollY(k.GetY())}},
async LoadObjectTextures(k){const m=this._runtime.GetMainRunningLayout();m&&k&&!this._runtime.IsLoading()&&(k=k.IsFamily()?k.GetFamilyMembers():[k],await this._LoadTexturesForObjectClasses(m,k))},async LoadObjectTexturesByName(k){await f.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(k))},UnloadObjectTextures(k){const m=this._runtime.GetMainRunningLayout();m&&k&&(k=k.IsFamily()?k.GetFamilyMembers():[k],this._UnloadTexturesForObjectClasses(m,k))},UnloadObjectTexturesByName(k){f.Plugins.System.Acts.UnloadObjectTexturesByName.call(this,
this._runtime.GetObjectClassByName(k))},UnloadUnusedTextures(){const k=this._runtime.GetMainRunningLayout();if(k){var m=k._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(k,m)}},async LoadLayoutTextures(k){const m=this._runtime.GetMainRunningLayout();k&&m&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(m,k._GetInitialObjectClasses())},async LoadLayoutTexturesByName(k){const m=this._runtime.GetMainRunningLayout();(k=this._runtime.GetLayoutManager().GetLayoutByName(k))&&
m&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(m,k._GetInitialObjectClasses())},SetFunctionReturnValue(k){const m=this._eventStack.GetCurrentExpFuncStackFrame();if(m)switch(m.GetFunctionReturnType()){case 1:"number"===typeof k&&m.SetFunctionReturnValue(k);break;case 2:"string"===typeof k&&m.SetFunctionReturnValue(k);break;case 3:m.SetFunctionReturnValue(k)}},MapFunction(k,m,p){var n=this._GetFunctionMap(k.toLowerCase(),!0);const u=n.strMap,q=m.toLowerCase();u.has(q)&&console.warn(`[Construct 3] Function map '${k}' string '${m}' already in map; overwriting entry`);
if(n=f.first(u.values())||n.defaultFunc){n=0!==n.GetReturnType();const r=0!==p.GetReturnType();if(n!==r){console.error(`[Construct 3] Function map '${k}' string '${m}' function return type not compatible with other functions in the map; entry ignored`);return}}u.set(q,p)},MapFunctionDefault(k,m){const p=this._GetFunctionMap(k.toLowerCase(),!0);p.defaultFunc&&console.warn(`[Construct 3] Function map '${k}' already has a default; overwriting entry`);var n=f.first(p.strMap.values())||p.defaultFunc;if(n){n=
0!==n.GetReturnType();const u=0!==m.GetReturnType();if(n!==u){console.error(`[Construct 3] Function map '${k}' default: function return type not compatible with other functions in the map; entry ignored`);return}}p.defaultFunc=m},CallMappedFunction(k,m,p){p=Math.floor(p);var n=this._GetFunctionMap(k.toLowerCase(),!1);if(n){var u=n.strMap.get(m.toLowerCase());if(!u)if(n.defaultFunc)u=n.defaultFunc,p=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${k}' string '${m}'; call ignored (consider setting a default)`);
return}if(u.IsEnabled())if(0!==u.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${k}' string '${m}' has a return type so cannot be called`);else{k=this._runtime;m=k.GetEventSheetManager();var q=m.GetCurrentEvent();n=q.GetSolModifiersIncludingParents();var r=0<n.length;r&&m.PushCleanSol(n);var t=[];if(q=m.FindFirstFunctionBlockParent(q)){q=q.GetFunctionParameters();for(let x=p,z=q.length;x<z;++x)t.push(q[x].GetValue())}p=u.GetFunctionParameters();for(let x=t.length,z=p.length;x<
z;++x)t.push(p[x].GetInitialValue());return k.IsDebugging()?this._DebugDoCallMappedFunction(m,u,t,r,n):this._DoCallMappedFunction(m,u,t,r,n)}}else console.warn(`[Construct 3] Call mapped function: map name '${k}' not found; call ignored`)}}}"use strict";
{const f=self.C3;f.Plugins.System.Exps={int:function(b){"string"===typeof b&&(b=parseInt(b,10),isNaN(b)&&(b=0));return Math.floor(b)},float:function(b){"string"===typeof b&&(b=parseFloat(b),isNaN(b)&&(b=0));return b},str(b){return b.toString()},len(b){return"string"===typeof b?b.length:0},random(b,a){return"undefined"===typeof a?this._runtime.Random()*b:this._runtime.Random()*(a-b)+b},choose(...b){const a=Math.floor(this._runtime.Random()*b.length);return b[a]},pi(){return Math.PI},infinity(){return Infinity},
sqrt(b){return Math.sqrt(b)},abs(b){return Math.abs(b)},round(b){return Math.round(b)},floor(b){return Math.floor(b)},ceil(b){return Math.ceil(b)},sign(b){return Math.sign(b)},sin(b){return Math.sin(f.toRadians(b))},cos(b){return Math.cos(f.toRadians(b))},tan(b){return Math.tan(f.toRadians(b))},asin(b){return f.toDegrees(Math.asin(b))},acos(b){return f.toDegrees(Math.acos(b))},atan(b){return f.toDegrees(Math.atan(b))},exp(b){return Math.exp(b)},ln(b){return Math.log(b)},log10(b){return Math.log(b)/
Math.LN10},max(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let e=1,c=b.length;e<c;++e){let d=b[e];"number"===typeof d&&a<d&&(a=d)}return a},min(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let e=1,c=b.length;e<c;++e){let d=b[e];"number"===typeof d&&a>d&&(a=d)}return a},clamp(b,a,e){return f.clamp(b,a,e)},distance(b,a,e,c){return f.distanceTo(b,a,e,c)},angle(b,a,e,c){return f.toDegrees(f.angleTo(b,a,e,c))},lerp(b,a,e){return f.lerp(b,a,e)},unlerp(b,a,e){return f.unlerp(b,a,e)},qarp(b,a,e,c){return f.qarp(b,
a,e,c)},cubic(b,a,e,c,d){return f.cubic(b,a,e,c,d)},cosp(b,a,e){return f.cosp(b,a,e)},anglediff(b,a){return f.toDegrees(f.angleDiff(f.toRadians(b),f.toRadians(a)))},anglelerp(b,a,e){return f.toDegrees(f.angleLerp(f.toRadians(b),f.toRadians(a),e))},anglerotate(b,a,e){return f.toDegrees(f.angleRotate(f.toRadians(b),f.toRadians(a),f.toRadians(e)))},setbit(b,a,e){a|=0;return(b|0)&~(1<<a)|(0!==e?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,e){return"string"!==typeof b?"":0>e?b.substr(a):b.substr(a,e)},right(b,a){return"string"===typeof b?b.substr(b.length-a):""},trim(b){return"string"===typeof b?b.trim():""},tokenat(b,a,e){if("string"!==typeof b||"string"!==typeof e)return"";b=b.split(e);a=Math.floor(a);return 0>a||a>=b.length?"":b[a]},tokencount(b,a){return"string"===typeof b&&"string"===
typeof a&&b.length?b.split(a).length:0},find(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(f.EscapeRegex(a),"i")):-1},findcase(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(f.EscapeRegex(a),"")):-1},replace(b,a,e){return"string"===typeof b&&"string"===typeof a&&"string"===typeof e?b.replace(new RegExp(f.EscapeRegex(a),"gi"),e):"string"===typeof b?b:""},regexsearch(b,a,e){a=this.GetRegex(a,e);return b?b.search(a):-1},regexreplace(b,a,e,c){a=this.GetRegex(a,
e);return b?b.replace(a,c):""},regexmatchcount(b,a,e){return(b=this.GetRegexMatches(b.toString(),a,e))?b.length:0},regexmatchat(b,a,e,c){c=Math.floor(c);b=this.GetRegexMatches(b.toString(),a,e);return!b||0>c||c>=b.length?"":b[c]},zeropad(b,a){let e=0>b?"-":"";0>b&&(b=-b);e+="0".repeat(Math.max(a-b.toString().length,0));return e+b.toString()},urlencode(b){return encodeURIComponent(b)},urldecode(b){return decodeURIComponent(b)},dt(){return this._runtime._GetDtFast()},timescale(){return this._runtime.GetTimeScale()},
wallclocktime(){return(Date.now()-this._runtime.GetStartTime())/1E3},unixtime(){return Date.now()},time(){return this._runtime.GetGameTime()},tickcount(){return this._runtime.GetTickCount()},objectcount(){return this._runtime.GetObjectCount()},fps(){return this._runtime.GetFPS()},cpuutilisation(){return this._runtime.GetMainThreadTime()},gpuutilisation(){return this._runtime.GetGPUUtilisation()},windowwidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()},windowheight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},
originalwindowwidth(){return this._runtime.GetOriginalViewportWidth()},originalwindowheight(){return this._runtime.GetOriginalViewportHeight()},originalviewportwidth(){return this._runtime.GetOriginalViewportWidth()},originalviewportheight(){return this._runtime.GetOriginalViewportHeight()},scrollx(){return this._runtime.GetCurrentLayout().GetScrollX()},scrolly(){return this._runtime.GetCurrentLayout().GetScrollY()},layoutname(){return this._runtime.GetCurrentLayout().GetName()},layoutscale(){return this._runtime.GetCurrentLayout().GetScale()},
layoutangle(){return f.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},viewportleft(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().getLeft():0},viewporttop(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().getTop():0},viewportright(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().getRight():
0},viewportbottom(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().getBottom():0},viewportwidth(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().width():0},viewportheight(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport().height():0},canvastolayerx(b,a,e){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,e)[0]:0},canvastolayery(b,a,e){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,
e)[1]:0},layertocanvasx(b,a,e){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,e)[0]:0},layertocanvasy(b,a,e){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,e)[1]:0},layerscale(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetOwnScale():0},layerangle(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?f.toDegrees(b.GetOwnAngle()):0},layeropacity(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetOpacity():
0},layerscalerate(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScaleRate():0},layerparallaxx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetParallaxX():0},layerparallaxy(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetParallaxY():0},layerzelevation(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetZElevation():0},layerindex(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetIndex():-1},canvassnapshot(){const b=this._runtime.GetCanvasManager();
return b?b.GetCanvasSnapshotUrl():""},loopindex(b){const a=this._loopStack;return a.IsInLoop()?b?(b=a.FindByName(b))?b.GetIndex():0:a.GetCurrent().GetIndex():0},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(b,a,...e){var c=this._GetFunctionMap(b.toLowerCase(),!1);if(!c)return console.warn(`[Construct 3] Call mapped function: map name '${b}' not found; returning 0`),0;var d=c.strMap.get(a.toLowerCase());if(!d)if(c.defaultFunc)d=c.defaultFunc;else return console.warn(`[Construct 3] Call mapped function: no function associated with map '${b}' string '${a}'; returning 0 (consider setting a default)`),
0;c=d.GetReturnType();const g=d.GetDefaultReturnValue();if(0===c)return console.warn(`[Construct 3] Call mapped function: map '${b}' string '${a}' has no return type so cannot be called from an expression; returning 0`),0;if(!d.IsEnabled())return g;b=this._runtime.GetEventSheetManager();a=b.GetCurrentEvent().GetSolModifiersIncludingParents();const k=0<a.length;k&&b.PushCleanSol(a);const m=d.GetFunctionParameters();for(let p=e.length,n=m.length;p<n;++p)e.push(m[p].GetInitialValue());d=d.GetEventBlock();
e=d.RunAsExpressionFunctionCall(d.GetSolModifiersIncludingParents(),c,g,...e);k&&b.PopSol(a);return e},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return"webgl"},rendererdetail(){return this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let b=this._runtime.GetWebGLRenderer().GetEstimatedTextureMemoryUsage();return Math.round(100*
b/1048576)/100},rgb(b,a,e){return f.PackRGB(b,a,e)},rgbex(b,a,e){return f.PackRGBEx(b/100,a/100,e/100)},rgba(b,a,e,c){return f.PackRGBAEx(b/100,a/100,e/100,c/100)},rgbex255(b,a,e){return f.PackRGBEx(b/255,a/255,e/255)},rgba255(b,a,e,c){return f.PackRGBAEx(b/255,a/255,e/255,c/255)},projectname(){return this._runtime.GetProjectName()},projectversion(){return this._runtime.GetProjectVersion()},currenteventsheetname(){return this._runtime.GetCurrentEvent().GetEventSheet().GetName()},currenteventnumber(){return this._runtime.GetCurrentEvent().GetDisplayNumber()}}}"use strict";
{const f=self.C3;f.Plugins.Text=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Plugins.Text.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}LoadTextures(b){}ReleaseTextures(){}}}"use strict";
{const f=self.C3,b=[0,0,0],a=["left","center","right"],e=["top","center","bottom"],c=new f.Rect,d=new f.Quad;f.Plugins.Text.Instance=class extends f.SDKWorldInstanceBase{constructor(n,u){super(n);this._text="";this._enableBBcode=!0;this._faceName="Arial";this._ptSize=12;this._lineHeightOffset=0;this._isItalic=this._isBold=!1;this._color=f.New(f.Color);this._verticalAlign=this._horizontalAlign=0;this._wrapByWord=!0;this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._rendererText=
f.New(f.Gfx.RendererText,this._runtime.GetWebGLRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(!1);u&&(this._text=u[0],this._enableBBcode=!!u[1],this._faceName=u[2],this._ptSize=u[3],this._lineHeightOffset=u[4],this._isBold=!!u[5],this._isItalic=!!u[6],this._horizontalAlign=u[8],this._verticalAlign=u[9],this._wrapByWord=0===u[10],n=u[7],this._color.setRgb(n[0],n[1],n[2]),this.GetWorldInfo().SetVisible(u[11]));this._UpdateTextSettings()}Release(){this._CancelTypewriter();
this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const n=this._rendererText;n.SetText(this._text);n.SetBBCodeEnabled(this._enableBBcode);n.SetFontName(this._faceName);n.SetLineHeight(this._lineHeightOffset);n.SetBold(this._isBold);n.SetItalic(this._isItalic);n.SetColor(this._color);n.SetHorizontalAlignment(a[this._horizontalAlign]);n.SetVerticalAlignment(e[this._verticalAlign]);n.SetWordWrapMode(this._wrapByWord?"word":"character")}_UpdateTextSize(){const n=
this.GetWorldInfo();this._rendererText.SetFontSize(this._ptSize*n.GetSceneGraphScale());var u=n.GetLayer();u=u.GetRenderScale()*u.Get2DScaleFactorToZ(n.GetTotalZElevation());this._rendererText.SetSize(n.GetWidth(),n.GetHeight(),u)}Draw(n){var u=this.GetWorldInfo();this._UpdateTextSize();const q=this._rendererText.GetTexture();if(q){var r=u.GetLayer(),t=u.GetBoundingQuad();if(0===u.GetAngle()&&0===u.GetLayer().GetAngle()&&0===u.GetTotalZElevation()){const [x,z]=r.LayerToDrawSurface(t.getTlx(),t.getTly()),
[D,G]=r.LayerToDrawSurface(t.getBrx(),t.getBry());t=x-Math.round(x);u=z-Math.round(z);c.set(x,z,D,G);c.offset(-t,-u);d.setFromRect(c);const [w,B]=n.GetRenderTargetSize(n.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(n,w,B);n.SetTexture(q);n.Quad3(d,this._rendererText.GetTexRect());r._SetTransform(n)}else{u=r=0;this._runtime.IsPixelRoundingEnabled()&&(r=t.getTlx()-Math.round(t.getTlx()),u=t.getTly()-Math.round(t.getTly()));if(0!==r||0!==u)d.copy(t),d.offset(-r,-u),t=d;n.SetTexture(q);
n.Quad3(t,this._rendererText.GetTexRect())}}}SaveToJson(){const n={t:this._text,c:this._color.toJSON(),fn:this._faceName,ps:this._ptSize};this._enableBBcode&&(n.bbc=this._enableBBcode);0!==this._horizontalAlign&&(n.ha=this._horizontalAlign);0!==this._verticalAlign&&(n.va=this._verticalAlign);this._wrapByWord||(n.wr=this._wrapByWord);0!==this._lineHeightOffset&&(n.lho=this._lineHeightOffset);this._isBold&&(n.b=this._isBold);this._isItalic&&(n.i=this._isItalic);-1!==this._typewriterEndTime&&(n.tw={st:this._typewriterStartTime,
en:this._typewriterEndTime,l:this._typewriterLength});return n}LoadFromJson(n){this._CancelTypewriter();this._text=n.t;this._color.setFromJSON(n.c);this._faceName=n.fn;this._ptSize=n.ps;this._enableBBcode=n.hasOwnProperty("bbc")?n.bbc:!1;this._horizontalAlign=n.hasOwnProperty("ha")?n.ha:0;this._verticalAlign=n.hasOwnProperty("va")?n.va:0;this._wrapByWord=n.hasOwnProperty("wr")?n.wr:!0;this._lineHeightOffset=n.hasOwnProperty("lho")?n.lho:0;this._isBold=n.hasOwnProperty("b")?n.b:!1;this._isItalic=n.hasOwnProperty("i")?
n.i:!1;n.hasOwnProperty("tw")&&(n=n.tw,this._typewriterStartTime=n.st,this._typewriterEndTime=n.en,this._typewriterLength=n.l);this._UpdateTextSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(n){switch(n){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._faceName;case 3:return this._ptSize;case 4:return this._lineHeightOffset;case 5:return this._isBold;case 6:return this._isItalic;case 7:return b[0]=this._color.getR(),b[1]=this._color.getG(),
b[2]=this._color.getB(),b;case 8:return this._horizontalAlign;case 9:return this._verticalAlign;case 10:return this._wrapByWord?1:0}}SetPropertyValueByIndex(n,u){switch(n){case 0:if(this._text===u)break;this._text=u;this._UpdateTextSettings();break;case 1:if(this._enableBBcode===!!u)break;this._enableBBcode=!!u;this._UpdateTextSettings();break;case 2:if(this._faceName===u)break;this._faceName=u;this._UpdateTextSettings();break;case 3:if(this._ptSize===u)break;this._ptSize=u;this._UpdateTextSettings();
break;case 4:if(this._lineHeightOffset===u)break;this._lineHeightOffset=u;this._UpdateTextSettings();break;case 5:if(this._isBold===!!u)break;this._isBold=!!u;this._UpdateTextSettings();break;case 6:if(this._isItalic===!!u)break;this._isItalic=!!u;this._UpdateTextSettings();break;case 7:n=this._color;if(n.getR()===u[0]&&n.getG()===u[1]&&n.getB()===u[2])break;this._color.setRgb(u[0],u[1],u[2]);this._UpdateTextSettings();break;case 8:if(this._horizontalAlign===u)break;this._horizontalAlign=u;this._UpdateTextSettings();
break;case 9:if(this._verticalAlign===u)break;this._verticalAlign=u;this._UpdateTextSettings();break;case 10:this._wrapByWord!==(0===u)&&(this._wrapByWord=0===u,this._UpdateTextSettings())}}SetPropertyColorOffsetValueByIndex(n,u,q,r){if(0!==u||0!==q||0!==r)switch(n){case 7:this._color.addRgb(u,q,r),this._UpdateTextSettings()}}_SetText(n){this._text!==n&&(this._text=n,this._rendererText.SetText(n),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(n,u){this._SetText(n);this._typewriterStartTime=
this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+u/this.GetInstance().GetActiveTimeScale();this._typewriterLength=f.BBString.StripAnyTags(n).length;this._rendererText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._rendererText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(f.Plugins.Text.Cnds.OnTypewriterTextFinished),
this._runtime.UpdateRender())}_SetFontFace(n){this._faceName!==n&&(this._faceName=n,this._rendererText.SetFontName(n),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(n){n=!!n;this._isBold!==n&&(this._isBold=n,this._rendererText.SetBold(n),this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(n){n=!!n;this._isItalic!==n&&(this._isItalic=n,this._rendererText.SetItalic(n),this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(n){this._ptSize!==
n&&(this._ptSize=n,this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetLineHeight(n){this._lineHeightOffset!==n&&(this._lineHeightOffset=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(n){this._horizontalAlign!==n&&(this._horizontalAlign=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(n){this._verticalAlign!==n&&(this._verticalAlign=n,this._UpdateTextSettings(),
this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(n){n=!!n;this._wrapByWord!==n&&(this._wrapByWord=n,this._UpdateTextSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){var n=this._runtime.GetWallTime();n>=this._typewriterEndTime?(this._CancelTypewriter(),this.Trigger(f.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(n=f.relerp(this._typewriterStartTime,this._typewriterEndTime,n,0,this._typewriterLength),
n=Math.floor(n),n!==this._rendererText.GetDrawMaxCharacterCount()&&(this._rendererText.SetDrawMaxCharacterCount(n),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.text.name",properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:n=>this._SetText(n)}]}]}GetScriptInterfaceClass(){return self.ITextInstance}};const g=new WeakMap,k=new Map([["left",0],["center",1],["right",2]]),m=new Map([["top",0],["center",1],["bottom",2]]),p=new Map([["word",!0],
["character",!1]]);self.ITextInstance=class extends self.IWorldInstance{constructor(){super();g.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return g.get(this).GetText()}set text(n){const u=g.get(this);u._CancelTypewriter();u._SetText(n)}typewriterText(n,u){const q=g.get(this);q._CancelTypewriter();q._StartTypewriter(n,u)}typewriterFinish(){g.get(this)._FinishTypewriter()}set fontFace(n){g.get(this)._SetFontFace(n)}get fontFace(){return g.get(this)._GetFontFace()}set isBold(n){g.get(this)._SetBold(n)}get isBold(){return g.get(this)._IsBold()}set isItalic(n){g.get(this)._SetItalic(n)}get isItalic(){return g.get(this)._IsItalic()}set sizePt(n){g.get(this)._SetFontSize(n)}get sizePt(){return g.get(this)._GetFontSize()}set lineHeight(n){g.get(this)._SetLineHeight(n)}get lineHeight(){return g.get(this)._GetLineHeight()}set horizontalAlign(n){n=
k.get(n);if("undefined"===typeof n)throw Error("invalid mode");g.get(this)._SetHAlign(n)}get horizontalAlign(){return a[g.get(this)._GetHAlign()]}set verticalAlign(n){n=m.get(n);if("undefined"===typeof n)throw Error("invalid mode");g.get(this)._SetVAlign(n)}get verticalAlign(){return e[g.get(this)._GetVAlign()]}set wordWrapMode(n){n=p.get(n);if("undefined"===typeof n)throw Error("invalid mode");g.get(this)._SetWrapByWord(n)}get wordWrapMode(){return g.get(this)._IsWrapByWord()?"word":"character"}}}"use strict";
{const f=self.C3;f.Plugins.Text.Cnds={CompareText(b,a){return a?this._text===b:f.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}"use strict";
{const f=self.C3,b=f.New(f.Color);f.Plugins.Text.Acts={SetText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._SetText(a.toString())},AppendText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);(a=a.toString())&&this._SetText(this._text+a)},TypewriterText(a,e){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._StartTypewriter(a.toString(),e)},SetFontFace(a,e){let c=!1,d=!1;switch(e){case 1:c=
!0;break;case 2:d=!0;break;case 3:d=c=!0}if(a!==this._faceName||c!==this._isBold||d!==this._isItalic)this._SetFontFace(a),this._SetBold(c),this._SetItalic(d)},SetFontSize(a){this._SetFontSize(a)},SetFontColor(a){b.setFromRgbValue(a);b.clamp();this._color.equalsIgnoringAlpha(b)||(this._color.copyRgb(b),this._rendererText.SetColor(this._color),this._runtime.UpdateRender())},SetWebFont(a,e){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);
this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()},SetLineHeight(a){this._SetLineHeight(a)},SetHAlign(a){this._SetHAlign(a)},SetVAlign(a){this._SetVAlign(a)},SetWrapping(a){this._SetWrapByWord(0===a)}}}"use strict";
{const f=self.C3;f.Plugins.Text.Exps={Text(){return this._text},PlainText(){return this._enableBBcode?f.BBString.StripAnyTags(this._text):this._text},FaceName(){return this._faceName},FaceSize(){return this._ptSize},TextWidth(){this._UpdateTextSize();return this._rendererText.GetTextWidth()},TextHeight(){this._UpdateTextSize();return this._rendererText.GetTextHeight()},LineHeight(){return this._lineHeightOffset}}}"use strict";{const f=self.C3;f.Plugins.Sprite=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Sprite.Type=class extends f.SDKTypeBase{constructor(b){super(b);this._animations=b.GetAnimations()}Release(){f.clearArray(this._animations);super.Release()}OnCreate(){for(const b of this._animations)b.LoadAllAssets(this._runtime)}LoadTextures(b){const a={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(e=>e.LoadAllTextures(b,a)))}ReleaseTextures(){for(const b of this._animations)b.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const b of this._objectClass.instancesIncludingPendingCreate())b.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(b){f.Plugins.Sprite._FinishCondition(this,
b)}}}"use strict";
{const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad),e=f.New(f.Vector2);f.Plugins.Sprite.Instance=class extends f.SDKWorldInstanceBase{constructor(g,k){super(g);let m=!0,p="",n=0,u=!0;k&&(m=!!k[0],p=k[1],n=k[2],u=k[3]);this._currentAnimation=this._objectClass.GetAnimationByName(p)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=f.clamp(n,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);k=this._currentAnimationFrame.GetImageInfo();
this._currentTexture=k.GetTexture();this._currentRcTex=k.GetTexRect();this.HandleWebGLContextLoss();g.SetFlag(2,!0);g.SetFlag(1,0<=this._currentAnimation.GetSpeed());this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo();this._animationTimer=f.New(f.KahanSum);this._animationRepeats=this._frameStartTime=0;this._animTriggerName="";this._changeAnimFrameIndex=-1;this._changeAnimationName="";this._changeAnimationFrom=
0;g=this.GetWorldInfo();this._bquadRef=g.GetBoundingQuad();g.SetVisible(m);g.SetCollisionEnabled(u);g.SetOriginX(this._currentAnimationFrame.GetOriginX());g.SetOriginY(this._currentAnimationFrame.GetOriginY());g.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly());g.SetBboxChanged();1===this._objectClass.GetAnimationCount()&&1===this._objectClass.GetAnimations()[0].GetFrameCount()||0===this._currentAnimationSpeed||this._StartTicking()}Release(){this._animationTimer=this._currentTexture=
this._currentAnimationFrame=this._currentAnimation=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(g){var k=this._currentTexture;null!==k&&(g.SetTexture(k),k=this.GetWorldInfo(),k.HasMesh()?this._DrawMesh(k,g):this._DrawStandard(k,g))}_DrawStandard(g,k){let m=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));k.Quad3(m,this._currentRcTex)}_DrawMesh(g,
k){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(b,a,!1);let p=a;this._runtime.IsPixelRoundingEnabled()&&(p=g.PixelRoundQuad(p));m.CalculateTransformedMesh(g.GetSourceMesh(),p,this._currentRcTex);g.SetMeshChanged(!1)}m.Draw(k)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(2)}SetAnimationPlaying(g){this._inst.SetFlag(2,g)}IsPlayingForwards(){return this._inst.GetFlag(1)}SetPlayingForwards(g){this._inst.SetFlag(1,g)}IsInAnimationTrigger(){return this._inst.GetFlag(4)}SetInAnimationTrigger(g){this._inst.SetFlag(4,
g)}Tick(){this._changeAnimationName&&this._DoChangeAnimation();0<=this._changeAnimFrameIndex&&this._DoChangeAnimFrame();const g=this._currentAnimationSpeed;if(this.IsAnimationPlaying()&&0!==g){var k=this._runtime.GetDt(this._inst);this._animationTimer.Add(k);k=this.GetAnimationTime();var m=this._currentAnimationFrame,p=m.GetDuration()/g;if(!(k<this._frameStartTime+p)){var n=this._currentAnimation,u=this._currentAnimationRepeatTo,q=n.GetFrameCount(),r=n.GetRepeatCount(),t=n.IsLooping(),x=n.IsPingPong();
this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=p;this._currentFrameIndex>=q&&(x?(this.SetPlayingForwards(!1),this._currentFrameIndex=q-2):t?this._currentFrameIndex=u:(this._animationRepeats++,this._animationRepeats>=r?this._FinishAnimation(!1):this._currentFrameIndex=u));0>this._currentFrameIndex&&(x?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),t||(this._animationRepeats++,this._animationRepeats>=r&&this._FinishAnimation(!0))):t?this._currentFrameIndex=
u:(this._animationRepeats++,this._animationRepeats>=r?this._FinishAnimation(!0):this._currentFrameIndex=u));this._currentFrameIndex=f.clamp(this._currentFrameIndex,0,q-1);p=n.GetFrameAt(this._currentFrameIndex);k>this._frameStartTime+p.GetDuration()/g&&(this._frameStartTime=k);this._OnFrameChanged(m,p)}}else this._StopTicking()}_FinishAnimation(g){this._currentFrameIndex=g?0:this._currentAnimation.GetFrameCount()-1;this.SetAnimationPlaying(!1);this._animTriggerName=this._currentAnimation.GetName();
this.SetInAnimationTrigger(!0);this.Trigger(f.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(f.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(g,k){if(g!==k){var m=this.GetWorldInfo(),p=g.GetImageInfo(),n=k.GetImageInfo(),u=p.GetWidth();p=p.GetHeight();var q=n.GetWidth(),r=n.GetHeight();u!==q&&m.SetWidth(m.GetWidth()*(q/u));p!==r&&m.SetHeight(m.GetHeight()*(r/p));m.SetOriginX(k.GetOriginX());m.SetOriginY(k.GetOriginY());m.SetSourceCollisionPoly(k.GetCollisionPoly());
m.SetBboxChanged();this._currentAnimationFrame=k;this._currentTexture=n.GetTexture();this._currentRcTex=n.GetTexRect();m=this.GetInstance().GetBehaviorInstances();for(let t=0,x=m.length;t<x;++t)m[t].OnSpriteFrameChanged(g,k);this.Trigger(f.Plugins.Sprite.Cnds.OnFrameChanged);this._runtime.UpdateRender()}}_StartAnim(g){this.SetAnimationPlaying(!0);this._frameStartTime=this.GetAnimationTime();1===g&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,this.IsInAnimationTrigger()||this._DoChangeAnimFrame());
this._StartTicking()}_SetAnim(g,k){this._changeAnimationName=g;this._changeAnimationFrom=k;this._StartTicking();this.IsInAnimationTrigger()||this._DoChangeAnimation()}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(g){isFinite(g)&&(this._changeAnimFrameIndex=g,this.IsInAnimationTrigger()||this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(g){this._currentAnimationSpeed=Math.abs(g);
this.SetPlayingForwards(0<=g);0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(g){this._currentAnimationRepeatTo=g=f.clamp(Math.floor(g),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const g=this._currentAnimationFrame;var k=this._objectClass.GetAnimationByName(this._changeAnimationName);this._changeAnimationName=
"";!k||k===this._currentAnimation&&this.IsAnimationPlaying()||(this._currentAnimation=k,this.SetPlayingForwards(0<=k.GetSpeed()),this._currentAnimationSpeed=Math.abs(k.GetSpeed()),this._currentAnimationRepeatTo=k.GetRepeatTo(),this._currentFrameIndex=f.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex=0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),k=this._currentAnimation.GetFrameAt(this._currentFrameIndex),
this._OnFrameChanged(g,k))}_DoChangeAnimFrame(){const g=this._currentAnimationFrame;var k=this._currentFrameIndex;this._currentFrameIndex=f.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;k!==this._currentFrameIndex&&(k=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,k),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const g=this._currentAnimationFrame.GetImageInfo();this._currentTexture=
g.GetTexture();this._currentRcTex=g.GetTexRect();this.GetWorldInfo().SetMeshChanged(!0)}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(g){const k=this._currentAnimationFrame,m=this.GetWorldInfo();if("string"===typeof g)g=k.GetImagePointByName(g);else if("number"===typeof g)g=k.GetImagePointByIndex(g-1);else throw new TypeError("expected string or number");if(!g)return[m.GetX(),m.GetY()];e.copy(g.GetVec2());if(m.HasMesh()){const [p,n]=m.GetSourceMesh().TransformPoint(e.getX(),
e.getY());e.set(p,n)}e.offset(-k.GetOriginX(),-k.GetOriginY());e.scale(m.GetWidth(),m.GetHeight());e.rotate(m.GetAngle());e.offset(m.GetX(),m.GetY());return[e.getX(),e.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(g){g=Math.floor(g);const k=this.GetWorldInfo();var m=k.GetTransformedCollisionPoly();const p=m.pointCount();g===p&&(g=0);if(0>g||g>=p)return[0,0];m=m.pointsArr();return[m[2*g]+k.GetX(),m[2*g+1]+k.GetY()]}GetDebuggerProperties(){const g=
f.Plugins.Sprite.Acts;return[{title:"plugins.sprite.debugger.animation-properties.title",properties:[{name:"plugins.sprite.debugger.animation-properties.current-animation",value:this._currentAnimation.GetName(),onedit:k=>this.CallAction(g.SetAnim,k,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",value:this._currentFrameIndex,onedit:k=>this.CallAction(g.SetAnimFrame,k)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:k=>
k?this.CallAction(g.StartAnim,0):this.CallAction(g.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:k=>this.CallAction(g.SetAnimSpeed,k)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:k=>this._animationRepeats=k}]}]}SaveToJson(){const g={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&(g.fs=this._frameStartTime);var k=this.GetAnimationTime();0!==k&&(g.at=k);0!==this._currentFrameIndex&&
(g.f=this._currentFrameIndex);0!==this._currentAnimationSpeed&&(g.cas=this._currentAnimationSpeed);1!==this._animationRepeats&&(g.ar=this._animationRepeats);0!==this._currentAnimationRepeatTo&&(g.rt=this._currentAnimationRepeatTo);this.IsAnimationPlaying()||(g.ap=this.IsAnimationPlaying());this.IsPlayingForwards()||(g.af=this.IsPlayingForwards());k=this.GetWorldInfo();k.IsCollisionEnabled()&&(g.ce=k.IsCollisionEnabled());return g}LoadFromJson(g){var k=this.GetObjectClass().GetAnimationBySID(g.a);
k&&(this._currentAnimation=k);this._frameStartTime=g.hasOwnProperty("fs")?g.fs:0;this._animationTimer.Set(g.hasOwnProperty("at")?g.at:0);k=g.hasOwnProperty("f")?g.f:0;this._currentFrameIndex=f.clamp(k,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=g.hasOwnProperty("cas")?g.cas:0;this._animationRepeats=g.hasOwnProperty("ar")?g.ar:1;k=g.hasOwnProperty("rt")?g.rt:0;this._currentAnimationRepeatTo=f.clamp(k,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(g.hasOwnProperty("ap")?
!!g.ap:!0);this.SetPlayingForwards(g.hasOwnProperty("af")?!!g.af:!0);this._currentAnimationFrame=k=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._UpdateCurrentTexture();const m=this.GetWorldInfo();m.SetOriginX(k.GetOriginX());m.SetOriginY(k.GetOriginY());m.SetSourceCollisionPoly(k.GetCollisionPoly());m.SetCollisionEnabled(!!g.ce)}GetPropertyValueByIndex(g){const k=this.GetWorldInfo();switch(g){case 3:return k.IsCollisionEnabled();case 2:return f.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-
1)}}SetPropertyValueByIndex(g,k){var m=this.GetWorldInfo();switch(g){case 3:m.SetCollisionEnabled(!!k);break;case 2:this.SetAnimationPlaying(!1);g=this._currentAnimation.GetFrameCount()-1;m=k=f.clamp(k,0,g);k=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const p=this._currentAnimation.GetFrameAt(m);this._OnFrameChanged(k,p);this._currentFrameIndex=f.clamp(m,0,g)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const c=new WeakMap,d=new Map([["current-frame",0],["beginning",1]]);
self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();c.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return c.get(this).GetImagePointCount()}getImagePointX(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return c.get(this).GetImagePoint(g)[0]}getImagePointY(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return c.get(this).GetImagePoint(g)[1]}getImagePoint(g){if("string"!==
typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return c.get(this).GetImagePoint(g)}getPolyPointCount(){return c.get(this).GetCollisionPolyPointCount()}getPolyPointX(g){return c.get(this).GetCollisionPolyPoint(g)[0]}getPolyPointY(g){return c.get(this).GetCollisionPolyPoint(g)[1]}getPolyPoint(g){return c.get(this).GetCollisionPolyPoint(g)}stopAnimation(){c.get(this).SetAnimationPlaying(!1)}startAnimation(g="current-frame"){g=d.get(g);if("undefined"===typeof g)throw Error("invalid mode");
c.get(this)._StartAnim(g)}setAnimation(g,k="beginning"){k=d.get(k);if("undefined"===typeof k)throw Error("invalid mode");c.get(this)._SetAnim(g,k)}get animationName(){return c.get(this)._GetCurrentAnimationName()}set animationFrame(g){c.get(this)._SetAnimFrame(g)}get animationFrame(){return c.get(this)._GetAnimFrame()}set animationSpeed(g){c.get(this)._SetAnimSpeed(g)}get animationSpeed(){return c.get(this)._GetAnimSpeed()}set animationRepeatToFrame(g){c.get(this)._SetAnimRepeatToFrame(g)}get animationRepeatToFrame(){return c.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return c.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return c.get(this).GetCurrentImageInfo().GetHeight()}}}"use strict";
{const f=self.C3,b=f.New(f.Rect),a=[],e=[];let c=!1,d=null,g=!1;const k=new Set;function m(t,x,z,D){const G=x.GetUID(),w=z.GetUID();G<w?t.Set(x,z,D):t.Set(z,x,D)}function p(t,x,z){const D=x.GetUID(),G=z.GetUID();D<G?t.Delete(x,z):t.Delete(z,x)}function n(t,x){t.DeleteEither(x)}function u(t,x,z){const D=x.GetUID(),G=z.GetUID();return D<G?t.Get(x,z):t.Get(z,x)}function q(t,x,z,D){if(!x)return!1;t=t.GetInstance();const G=0!==z||0!==D,w=t.GetWorldInfo(),B=t.GetRuntime(),I=B.GetCollisionEngine();var P=
B.GetCurrentCondition();const E=P.GetEventBlock().IsOrBlock();var J=P.GetObjectClass();P=P.IsInverted();const O=x.GetCurrentSol();J=J!==x;d=x;c=J&&!P;g=!1;let R=0,T=0,Y=!1;O.IsSelectAll()?(b.copy(w.GetBoundingBox()),b.offset(z,D),I.GetCollisionCandidates(w.GetLayer(),x,b,e),x=e):E?B.IsCurrentConditionFirst()&&!O._GetOwnElseInstances().length&&O._GetOwnInstances().length?x=O._GetOwnInstances():(x=O._GetOwnElseInstances(),g=!0):x=O._GetOwnInstances();G&&(R=w.GetX(),T=w.GetY(),w.OffsetXY(z,D),w.SetBboxChanged());
for(const W of x)if(I.TestOverlap(t,W)){Y=!0;if(P)break;J&&k.add(W)}G&&(w.SetXY(R,T),w.SetBboxChanged());f.clearArray(e);return Y}function r(t){t=t.GetRuntime().GetCurrentEvent().IsOrBlock();const x=d.GetCurrentSol(),z=x._GetOwnInstances(),D=x._GetOwnElseInstances();x.IsSelectAll()?(x.SetSetPicked(k),t&&(f.clearArray(D),x.AddElseInstances(k,d.GetInstances()))):t?g?x.TransferElseInstancesToOwn(k):(x.AddElseInstances(k,z),x.SetSetPicked(k)):x.SetSetPicked(k);d.ApplySolToContainer()}f.Plugins.Sprite._FinishCondition=
function(t,x){c&&(x&&r(t),k.clear(),d=null,c=!1)};f.Plugins.Sprite.Cnds={OnCollision(t){if(this._runtime.IsDebugging())return f.Plugins.Sprite.Cnds.DebugOnCollision.call(this,t);if(!t)return!1;var x=this._runtime;const z=x.GetCollisionEngine(),D=x.GetEventSheetManager(),G=D.GetEventStack();var w=D.GetCurrentCondition();const B=w.GetObjectClass();var I=w.GetSavedDataMap(),P=w.GetUnsavedDataMap();w=G.GetCurrentStackFrame();const E=x.GetTickCount(),J=E-1,O=w.GetCurrentEvent(),R=G.Push(O);let T=I.get("collmemory");
T||(T=f.New(f.PairMap),I.set("collmemory",T));P.get("spriteCreatedDestroyCallback")||(P.set("spriteCreatedDestroyCallback",!0),x.Dispatcher().addEventListener("instancedestroy",qa=>n(T,qa.instance)));I=B.GetCurrentSol();x=t.GetCurrentSol();I=I.GetInstances();P=null;for(let qa=0;qa<I.length;++qa){const ja=I[qa];x.IsSelectAll()?(z.GetCollisionCandidates(ja.GetWorldInfo().GetLayer(),t,ja.GetWorldInfo().GetBoundingBox(),a),P=a,z.AddRegisteredCollisionCandidates(ja,t,P)):P=x.GetInstances();for(let xa=
0;xa<P.length;++xa){const ua=P[xa];if(z.TestOverlap(ja,ua)||z.CheckRegisteredCollision(ja,ua)){var Y=u(T,ja,ua),W=!1,ea=-2;"number"===typeof Y&&(W=!0,ea=Y);Y=!W||ea<J;m(T,ja,ua,E);Y&&(Y=O.GetSolModifiers(),D.PushCopySol(Y),ea=B.GetCurrentSol(),W=t.GetCurrentSol(),ea._SetSelectAll(!1),W._SetSelectAll(!1),B===t?(W=ea._GetOwnInstances(),f.clearArray(W),W.push(ja),W.push(ua),B.ApplySolToContainer()):(ea=ea._GetOwnInstances(),W=W._GetOwnInstances(),f.clearArray(ea),f.clearArray(W),ea.push(ja),W.push(ua),
B.ApplySolToContainer(),t.ApplySolToContainer()),O.Retrigger(w,R),D.PopSol(Y))}else p(T,ja,ua)}f.clearArray(a)}G.Pop();return!1},*DebugOnCollision(t){if(!t)return!1;var x=this._runtime;const z=x.GetCollisionEngine(),D=x.GetEventSheetManager(),G=D.GetEventStack(),w=G.GetCurrentStackFrame(),B=x.GetTickCount(),I=B-1,P=w.GetCurrentEvent(),E=G.Push(P);var J=D.GetCurrentCondition();const O=J.GetObjectClass();var R=J.GetSavedDataMap();J=J.GetUnsavedDataMap();let T=R.get("collmemory");T||(T=f.New(f.PairMap),
R.set("collmemory",T));J.get("spriteCreatedDestroyCallback")||(J.set("spriteCreatedDestroyCallback",!0),x.Dispatcher().addEventListener("instancedestroy",qa=>n(T,qa.instance)));R=O.GetCurrentSol();x=t.GetCurrentSol();R=R.GetInstances();J=null;for(let qa=0;qa<R.length;++qa){const ja=R[qa];x.IsSelectAll()?(z.GetCollisionCandidates(ja.GetWorldInfo().GetLayer(),t,ja.GetWorldInfo().GetBoundingBox(),a),J=a,z.AddRegisteredCollisionCandidates(ja,t,J)):J=x.GetInstances();for(let xa=0;xa<J.length;++xa){const ua=
J[xa];if(z.TestOverlap(ja,ua)||z.CheckRegisteredCollision(ja,ua)){var Y=u(T,ja,ua),W=!1,ea=-2;"number"===typeof Y&&(W=!0,ea=Y);Y=!W||ea<I;m(T,ja,ua,B);Y&&(Y=P.GetSolModifiers(),D.PushCopySol(Y),ea=O.GetCurrentSol(),W=t.GetCurrentSol(),ea._SetSelectAll(!1),W._SetSelectAll(!1),O===t?(W=ea._GetOwnInstances(),f.clearArray(W),W.push(ja),W.push(ua),O.ApplySolToContainer()):(ea=ea._GetOwnInstances(),W=W._GetOwnInstances(),f.clearArray(ea),f.clearArray(W),ea.push(ja),W.push(ua),O.ApplySolToContainer(),t.ApplySolToContainer()),
yield*P.DebugRetrigger(w,E),D.PopSol(Y))}else p(T,ja,ua)}f.clearArray(a)}G.Pop();return!1},IsOverlapping(t){return q(this,t,0,0)},IsOverlappingOffset(t,x,z){return q(this,t,x,z)},IsAnimPlaying(t){return f.equalsNoCase(this._GetCurrentAnimationName(),t)},CompareFrame(t,x){return f.compare(this._currentFrameIndex,t,x)},CompareAnimSpeed(t,x){return f.compare(this._GetAnimSpeed(),t,x)},OnAnimFinished(t){return f.equalsNoCase(this._animTriggerName,t)},OnAnyAnimFinished(){return!0},OnFrameChanged(){return!0},
IsMirrored(){return 0>this.GetWorldInfo().GetWidth()},IsFlipped(){return 0>this.GetWorldInfo().GetHeight()},OnURLLoaded(){return!0},OnURLFailed(){return!0},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}}"use strict";
{const f=self.C3;f.Plugins.Sprite.Acts={Spawn(b,a,e){if(b&&a){var [c,d]=this.GetImagePoint(e);if(a=this._runtime.CreateInstance(b,a,c,d)){b.GetPlugin().IsRotatable()&&(e=a.GetWorldInfo(),e.SetAngle(this.GetWorldInfo().GetAngle()),e.SetBboxChanged());e=this._runtime.GetEventSheetManager();e.BlockFlushingInstances(!0);a._TriggerOnCreated();if(a.IsInContainer())for(var g of a.siblings())g._TriggerOnCreated();e.BlockFlushingInstances(!1);e=this._runtime.GetCurrentAction().GetSavedDataMap();g=!1;if(!e.has("Spawn_LastExec")||
e.get("Spawn_LastExec")<this._runtime.GetExecCount())g=!0,e.set("Spawn_LastExec",this._runtime.GetExecCount());if(b!==this.GetObjectClass()&&(b=b.GetCurrentSol(),b._SetSelectAll(!1),b=b._GetOwnInstances(),g&&f.clearArray(b),b.push(a),a.IsInContainer()))for(const k of a.siblings())b=k.GetObjectClass().GetCurrentSol(),g?b.SetSinglePicked(k):(b._SetSelectAll(!1),b._PushInstance(k))}}},StopAnim(){this.SetAnimationPlaying(!1)},StartAnim(b){this._StartAnim(b)},SetAnim(b,a){this._SetAnim(b,a)},SetAnimFrame(b){this._SetAnimFrame(b)},
SetAnimSpeed(b){this._SetAnimSpeed(b)},SetAnimRepeatToFrame(b){this._SetAnimRepeatToFrame(b)},SetMirrored(b){const a=this.GetWorldInfo(),e=a.GetWidth();b=Math.abs(e)*(0===b?-1:1);e!==b&&(a.SetWidth(b),a.SetBboxChanged())},SetFlipped(b){const a=this.GetWorldInfo(),e=a.GetHeight();b=Math.abs(e)*(0===b?-1:1);e!==b&&(a.SetHeight(b),a.SetBboxChanged())},SetScale(b){const a=this._currentAnimationFrame.GetImageInfo(),e=this.GetWorldInfo();var c=0>e.GetWidth()?-1:1;const d=0>e.GetHeight()?-1:1;c*=a.GetWidth()*
b;b=a.GetHeight()*b*d;if(e.GetWidth()!==c||e.GetHeight()!==b)e.SetSize(c,b),e.SetBboxChanged()},async LoadURL(b,a,e){e=this._currentAnimationFrame.GetImageInfo();const c=this.GetWorldInfo(),d=this._runtime;if(e.GetURL()===b)0===a&&(c.SetSize(e.GetWidth(),e.GetHeight()),c.SetBboxChanged()),this.Trigger(f.Plugins.Sprite.Cnds.OnURLLoaded);else{var g=f.New(f.ImageInfo);await g.LoadDynamicAsset(d,b);g.IsLoaded()?(await g.LoadStaticTexture(d.GetWebGLRenderer(),{sampling:this._runtime.GetSampling()}),e.ReplaceWith(g),
this._sdkType._UpdateAllCurrentTexture(),this.WasReleased()||0!==a||(c.SetSize(e.GetWidth(),e.GetHeight()),c.SetBboxChanged()),d.UpdateRender(),this.WasReleased()||await this.TriggerAsync(f.Plugins.Sprite.Cnds.OnURLLoaded)):this.Trigger(f.Plugins.Sprite.Cnds.OnURLFailed)}},SetCollisions(b){this.GetWorldInfo().SetCollisionEnabled(b)},SetSolidCollisionFilter(b,a){this.GetWorldInfo().SetSolidCollisionFilter(0===b,a)},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()}}}"use strict";
self.C3.Plugins.Sprite.Exps={AnimationFrame(){return this._currentFrameIndex},AnimationFrameCount(){return this._currentAnimation.GetFrameCount()},AnimationName(){return this._currentAnimation.GetName()},AnimationSpeed(){return this._GetAnimSpeed()},OriginalAnimationSpeed(){return this._currentAnimation.GetSpeed()},ImagePointX(f){return this.GetImagePoint(f)[0]},ImagePointY(f){return this.GetImagePoint(f)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},
ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(f){return this.GetCollisionPolyPoint(f)[0]},PolyPointYAt(f){return this.GetCollisionPolyPoint(f)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};"use strict";{const f=self.C3;f.Plugins.Arr=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";{const f=self.C3;f.Plugins.Arr.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}"use strict";
{const f=self.C3,b=self.IInstance;function a(c,d,g){if(d<c.length)f.truncateArray(c,d);else if(d>c.length)if("function"===typeof g)for(var k=c.length;k<d;++k)c.push(g());else for(k=c.length;k<d;++k)c.push(g)}f.Plugins.Arr.Instance=class extends f.SDKInstanceBase{constructor(c,d){super(c);this._cx=10;this._cz=this._cy=1;this._arr=null;this._forX=[];this._forY=[];this._forZ=[];this._forDepth=-1;d&&(this._cx=d[0],this._cy=d[1],this._cz=d[2]);this._arr=f.MakeFilledArray(this._cx,()=>f.MakeFilledArray(this._cy,
()=>f.MakeFilledArray(this._cz,0)))}Release(){this._arr=null;super.Release()}At(c,d,g){c=Math.floor(c);d=Math.floor(d);g=Math.floor(g);return 0<=c&&c<this._cx&&0<=d&&d<this._cy&&0<=g&&g<this._cz?this._arr[c][d][g]:0}Set(c,d,g,k){c=Math.floor(c);d=Math.floor(d);g=Math.floor(g);0<=c&&c<this._cx&&0<=d&&d<this._cy&&0<=g&&g<this._cz&&(this._arr[c][d][g]=k)}SetSize(c,d,g){c=Math.floor(c);d=Math.floor(d);g=Math.floor(g);0>c&&(c=0);0>d&&(d=0);0>g&&(g=0);if(this._cx!==c||this._cy!==d||this._cz!==g){this._cx=
c;this._cy=d;this._cz=g;var k=this._arr;a(k,c,()=>f.MakeFilledArray(d,()=>f.MakeFilledArray(g,0)));for(let m=0;m<c;++m){a(k[m],d,()=>f.MakeFilledArray(g,0));for(let p=0;p<d;++p)a(k[m][p],g,0)}}}GetWidth(){return this._cx}GetHeight(){return this._cy}GetDepth(){return this._cz}GetDebuggerProperties(){const c=[{title:"plugins.arr.debugger.array-properties.title",properties:[{name:"plugins.arr.properties.width.name",value:this._cx,onedit:g=>this.SetSize(g,this._cy,this._cz)},{name:"plugins.arr.properties.height.name",
value:this._cy,onedit:g=>this.SetSize(this._cx,g,this._cz)},{name:"plugins.arr.properties.depth.name",value:this._cz,onedit:g=>this.SetSize(this._cx,this._cy,g)},{name:"plugins.arr.properties.elements.name",value:this._cx*this._cy*this._cz}]}],d=[];if(1===this._cy&&1===this._cz)for(let g=0;g<this._cx;++g)d.push({name:"$"+g,value:this._arr[g][0][0],onedit:k=>this._arr[g][0][0]=k});else for(let g=0;g<this._cx;++g)d.push({name:"$"+g,value:this._arr[g].toString()});d.length&&c.push({title:"plugins.arr.debugger.array-data.title",
properties:d});return c}GetAsJsonString(){return JSON.stringify({c2array:!0,size:[this._cx,this._cy,this._cz],data:this._arr})}SaveToJson(){return{size:[this._cx,this._cy,this._cz],data:this._arr}}LoadFromJson(c){const d=c.size;this._cx=d[0];this._cy=d[1];this._cz=d[2];this._arr=c.data}_GetForX(){return 0<=this._forDepth&&this._forDepth<this._forX.length?this._forX[this._forDepth]:0}_GetForY(){return 0<=this._forDepth&&this._forDepth<this._forY.length?this._forY[this._forDepth]:0}_GetForZ(){return 0<=
this._forDepth&&this._forDepth<this._forZ.length?this._forZ[this._forDepth]:0}GetScriptInterfaceClass(){return self.IArrayInstance}};const e=new WeakMap;self.IArrayInstance=class extends b{constructor(){super();e.set(this,b._GetInitInst().GetSdkInstance())}get width(){return e.get(this).GetWidth()}get height(){return e.get(this).GetHeight()}get depth(){return e.get(this).GetDepth()}setSize(c,d=1,g=1){e.get(this).SetSize(c,d,g)}getAt(c,d=0,g=0){return e.get(this).At(c,d,g)}setAt(c,d,g=0,k=0){if("number"!==
typeof c&&"string"!==typeof c)throw new TypeError("invalid type");e.get(this).Set(d,g,k,c)}}}"use strict";
{const f=self.C3;function b(a,e,c,d,g){a.PushCopySol(c);e.Retrigger(d,g);a.PopSol(c)}f.Plugins.Arr.Cnds={CompareX(a,e,c){return f.compare(this.At(a,0,0),e,c)},CompareXY(a,e,c,d){return f.compare(this.At(a,e,0),c,d)},CompareXYZ(a,e,c,d,g){return f.compare(this.At(a,e,c),d,g)},ArrForEach(a){const e=this._runtime,c=e.GetEventSheetManager(),d=e.GetCurrentEvent(),g=d.GetSolModifiers(),k=e.GetEventStack(),m=k.GetCurrentStackFrame(),p=k.Push(d),n=++this._forDepth,u=this._forX;var q=this._forY,r=this._forZ;
const t=this._cx,x=this._cy;var z=this._cz;n===this._forX.length?(u.push(0),q.push(0),r.push(0)):(u[n]=0,q[n]=0,r[n]=0);e.SetDebuggingEnabled(!1);if(0===a)for(a=0;a<t;++a)for(let D=0;D<x;++D)for(let G=0;G<z;++G)u[n]=a,q[n]=D,r[n]=G,b(c,d,g,m,p);else if(1===a)for(r=0;r<t;++r)for(z=0;z<x;++z)u[n]=r,q[n]=z,b(c,d,g,m,p);else for(q=0;q<t;++q)u[n]=q,b(c,d,g,m,p);e.SetDebuggingEnabled(!0);this._forDepth--;k.Pop();return!1},CompareCurrent(a,e){return f.compare(this.At(this._GetForX(),this._GetForY(),this._GetForZ()),
a,e)},Contains(a){const e=this._cx,c=this._cy,d=this._cz,g=this._arr;for(let k=0;k<e;++k)for(let m=0;m<c;++m)for(let p=0;p<d;++p)if(g[k][m][p]===a)return!0;return!1},IsEmpty(){return 0===this._cx||0===this._cy||0===this._cz},CompareSize(a,e,c){let d=0;switch(a){case 0:d=this._cx;break;case 1:d=this._cy;break;case 2:d=this._cz}return f.compare(d,e,c)}}}"use strict";
{const f=self.C3;function b(a,e){if("number"===typeof a&&"number"===typeof e)return a-e;a=a.toString();e=e.toString();return a<e?-1:a>e?1:0}f.Plugins.Arr.Acts={Clear(a){const e=this._cx,c=this._cy,d=this._cz,g=this._arr;for(let k=0;k<e;++k)for(let m=0;m<c;++m)for(let p=0;p<d;++p)g[k][m][p]=a},SetSize(a,e,c){this.SetSize(a,e,c)},SetX(a,e){this.Set(a,0,0,e)},SetXY(a,e,c){this.Set(a,e,0,c)},SetXYZ(a,e,c,d){this.Set(a,e,c,d)},Push(a,e,c){var d=this._cx,g=this._cy;const k=this._cz,m=this._arr;if(0===c)d=
f.MakeFilledArray(g,()=>f.MakeFilledArray(k,e)),0===a?m.push(d):m.unshift(d),this._cx++;else if(1===c){for(g=0;g<d;++g)c=f.MakeFilledArray(k,e),0===a?m[g].push(c):m[g].unshift(c);this._cy++}else{for(c=0;c<d;++c)for(let p=0;p<g;++p)0===a?m[c][p].push(e):m[c][p].unshift(e);this._cz++}},Pop(a,e){const c=this._cx;var d=this._cy,g=this._cz;const k=this._arr;if(0===e)0!==c&&(0===a?k.pop():k.shift(),this._cx--);else if(1===e){if(0!==d){for(d=0;d<c;++d)0===a?k[d].pop():k[d].shift();this._cy--}}else if(0!==
g){for(e=0;e<c;++e)for(g=0;g<d;++g)0===a?k[e][g].pop():k[e][g].shift();this._cz--}},Reverse(a){const e=this._cx;var c=this._cy,d=this._cz;const g=this._arr;if(0!==e&&0!==c&&0!==d)if(0===a)g.reverse();else if(1===a)for(c=0;c<e;++c)g[c].reverse();else for(a=0;a<e;++a)for(d=0;d<c;++d)g[a][d].reverse()},Sort(a){const e=this._cx;var c=this._cy,d=this._cz;const g=this._arr;if(0!==e&&0!==c&&0!==d)if(0===a)g.sort((k,m)=>b(k[0][0],m[0][0]));else if(1===a)for(c=0;c<e;++c)g[c].sort((k,m)=>b(k[0],m[0]));else for(a=
0;a<e;++a)for(d=0;d<c;++d)g[a][d].sort(b)},Delete(a,e){a=Math.floor(a);if(!(0>a)){var c=this._cx,d=this._cy,g=this._cz,k=this._arr;if(0===e)a>=c||(k.splice(a,1),this._cx--);else if(1===e){if(!(a>=d)){for(d=0;d<c;++d)k[d].splice(a,1);this._cy--}}else if(!(a>=g)){for(e=0;e<c;++e)for(g=0;g<d;++g)k[e][g].splice(a,1);this._cz--}}},Insert(a,e,c){e=Math.floor(e);if(!(0>e)){var d=this._cx,g=this._cy,k=this._cz,m=this._arr;if(0===c)e>d||(m.splice(e,0,f.MakeFilledArray(g,()=>f.MakeFilledArray(k,a))),this._cx++);
else if(1===c){if(!(e>g)){for(g=0;g<d;++g)m[g].splice(e,0,f.MakeFilledArray(k,a));this._cy++}}else if(!(e>k)){for(c=0;c<d;++c)for(let p=0;p<g;++p)m[c][p].splice(e,0,a);this._cz++}}},JSONLoad(a){let e=null;try{e=JSON.parse(a)}catch(c){console.error("[Construct 3] Failed to parse JSON: ",c);return}e.c2array&&(a=e.size,this._cx=a[0],this._cy=a[1],this._cz=a[2],this._arr=e.data)},JSONDownload(a){const e=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(e,
a)}}}"use strict";
self.C3.Plugins.Arr.Exps={At(f,b,a){return this.At(f,b||0,a||0)},Width(){return this._cx},Height(){return this._cy},Depth(){return this._cz},CurX(){return this._GetForX()},CurY(){return this._GetForY()},CurZ(){return this._GetForZ()},CurValue(){return this.At(this._GetForX(),this._GetForY(),this._GetForZ())},Front(){return this.At(0,0,0)},Back(){return this.At(this._cx-1,0,0)},IndexOf(f){const b=this._arr;for(let a=0,e=this._cx;a<e;++a)if(b[a][0][0]===f)return a;return-1},LastIndexOf(f){const b=this._arr;
for(let a=this._cx-1;0<=a;--a)if(b[a][0][0]===f)return a;return-1},AsJSON(){return this.GetAsJsonString()}};"use strict";{const f=self.C3;f.Plugins.Mouse=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Mouse.Type=class extends f.SDKTypeBase{constructor(e){super(e)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IMouseObjectType}};let b=null;function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.IMouseObjectType=class extends self.IObjectClass{constructor(e){super(e);b=e;e.GetRuntime()._GetCommonScriptInterfaces().mouse=this}getMouseX(e){return a().GetMousePositionForLayer(e)[0]}getMouseY(e){return a().GetMousePositionForLayer(e)[1]}getMousePosition(e){return a().GetMousePositionForLayer(e)}isMouseButtonDown(e){return a().IsMouseButtonDown(e)}}}"use strict";
{const f=self.C3;f.Plugins.Mouse.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b,"mouse");this._buttonMap=[!1,!1,!1];this._triggerDir=this._triggerType=this._triggerButton=this._mouseYcanvas=this._mouseXcanvas=0;b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"pointermove",e=>this._OnPointerMove(e.data)),f.Disposable.From(b,"pointerdown",e=>this._OnPointerDown(e.data)),f.Disposable.From(b,"pointerup",e=>this._OnPointerUp(e.data)),
f.Disposable.From(b,"dblclick",e=>this._OnDoubleClick(e.data)),f.Disposable.From(b,"wheel",e=>this._OnMouseWheel(e.data)),f.Disposable.From(b,"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnPointerDown(b){"mouse"===b.pointerType&&(this._mouseXcanvas=b.pageX-this._runtime.GetCanvasClientX(),this._mouseYcanvas=b.pageY-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(b.lastButtons,b.buttons))}_OnPointerMove(b){"mouse"===b.pointerType&&(this._mouseXcanvas=b.pageX-this._runtime.GetCanvasClientX(),
this._mouseYcanvas=b.pageY-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(b.lastButtons,b.buttons))}_OnPointerUp(b){"mouse"===b.pointerType&&this._CheckButtonChanges(b.lastButtons,b.buttons)}_CheckButtonChanges(b,a){this._CheckButtonChange(b,a,1,0);this._CheckButtonChange(b,a,4,1);this._CheckButtonChange(b,a,2,2)}_CheckButtonChange(b,a,e,c){!(b&e)&&a&e?this._OnMouseDown(c):b&e&&!(a&e)&&this._OnMouseUp(c)}_OnMouseDown(b){this._buttonMap[b]=!0;this.Trigger(f.Plugins.Mouse.Cnds.OnAnyClick);
this._triggerButton=b;this._triggerType=0;this.Trigger(f.Plugins.Mouse.Cnds.OnClick);this.Trigger(f.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseUp(b){this._buttonMap[b]&&(this._buttonMap[b]=!1,this._triggerButton=b,this.Trigger(f.Plugins.Mouse.Cnds.OnRelease))}_OnDoubleClick(b){this._triggerButton=b.button;this._triggerType=1;this.Trigger(f.Plugins.Mouse.Cnds.OnClick);this.Trigger(f.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseWheel(b){this._triggerDir=0>b.deltaY?1:0;this.Trigger(f.Plugins.Mouse.Cnds.OnWheel)}_OnWindowBlur(){for(let b=
0,a=this._buttonMap.length;b<a&&this._buttonMap[b];++b)this._buttonMap[b]=!1,this._triggerButton=b,this.Trigger(f.Plugins.Mouse.Cnds.OnRelease)}GetMousePositionForLayer(b){const a=this._runtime.GetMainRunningLayout(),e=this._mouseXcanvas,c=this._mouseYcanvas;return"undefined"===typeof b?a.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(e,c):(b=a.GetLayer(b))?b.CanvasCssToLayer(e,c):[0,0]}IsMouseButtonDown(b){b=Math.floor(b);return!!this._buttonMap[b]}_IsMouseOverCanvas(){return 0<=this._mouseXcanvas&&
0<=this._mouseYcanvas&&this._mouseXcanvas<this._runtime.GetCanvasCssWidth()&&this._mouseYcanvas<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.mouse.name",properties:[{name:"plugins.mouse.debugger.absolute-position",value:this._mouseXcanvas+","+this._mouseYcanvas},{name:"plugins.mouse.debugger.left-button",value:this._buttonMap[0]},{name:"plugins.mouse.debugger.middle-button",value:this._buttonMap[1]},{name:"plugins.mouse.debugger.right-button",value:this._buttonMap[2]}]},
{title:"plugins.mouse.debugger.position-on-each-layer",properties:this._runtime.GetMainRunningLayout().GetLayers().map(b=>({name:"$"+b.GetName(),value:b.CanvasCssToLayer(this._mouseXcanvas,this._mouseYcanvas).join(", ")}))}]}}}"use strict";
{const f=self.C3;f.Plugins.Mouse.Cnds={OnClick(b,a){return this._triggerButton===b&&this._triggerType===a},OnAnyClick(){return!0},IsButtonDown(b){return this._buttonMap[b]},OnRelease(b){return this._triggerButton===b},IsOverObject(b){if(!this._IsMouseOverCanvas())return!1;const a=this._runtime.GetCurrentCondition().IsInverted(),e=this._mouseXcanvas,c=this._mouseYcanvas;return f.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,e,c,a),a)},OnObjectClicked(b,a,e){if(b!==this._triggerButton||
a!==this._triggerType||!this._IsMouseOverCanvas())return!1;b=this._mouseXcanvas;a=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(e,b,a,!1)},OnWheel(b){return this._triggerDir===b}}}"use strict";
{const f=self.C3;let b=null;const a="auto pointer text crosshair move help wait none".split(" ");f.Plugins.Mouse.Acts={SetCursor(e){e=a[e];b!==e&&(b=e,this.PostToDOM("cursor",e))},SetCursorSprite(e){if(!f.Platform.IsMobile&&e&&(e=e.GetFirstPicked())){var c=e.GetWorldInfo(),d=e.GetCurrentImageInfo();c&&d&&b!==d&&(b=d,d.ExtractImageToCanvas().then(g=>f.CanvasToBlob(g)).then(g=>{g=`url(${URL.createObjectURL(g)}) ${Math.round(c.GetOriginX()*d.GetWidth())} ${Math.round(c.GetOriginY()*d.GetHeight())}, auto`;
this.PostToDOM("cursor","");this.PostToDOM("cursor",g)}))}}}}"use strict";self.C3.Plugins.Mouse.Exps={X(f){return this.GetMousePositionForLayer(f)[0]},Y(f){return this.GetMousePositionForLayer(f)[1]},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas}};"use strict";{const f=self.C3;f.Plugins.Audio=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}"use strict";
{const f=self.C3;f.Plugins.Audio.Type=class extends f.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};function b(){if(self.C3Audio_DOMInterface)return self.C3Audio_DOMInterface;throw Error("audio scripting API cannot be used here - make sure the project is using DOM mode, not worker mode");}self.IAudioObjectType=class extends self.IObjectClass{constructor(a){super(a)}get audioContext(){return b().GetAudioContext()}get destinationNode(){return b().GetDestinationNode()}}}"use strict";
{const f=self.C3,b=["interactive","balanced","playback"];f.Plugins.Audio.Instance=class extends f.SDKInstanceBase{constructor(a,e){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";e&&(this._timeScaleMode=e[0],this._saveLoadMode=e[1],this._playInBackground=e[2],a=b[e[3]],this._panningModel=e[4],this._distanceModel=e[5],this._listenerZ=-e[6],this._referenceDistance=e[7],this._maxDistance=e[8],this._rolloffFactor=e[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=
[];this.AddDOMMessageHandlers([["state",c=>this._OnUpdateState(c)],["fxstate",c=>this._OnUpdateFxState(c)],["trigger",c=>this._OnTrigger(c)]]);e=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(e,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)),f.Disposable.From(e,"afterload",()=>this._OnAfterLoad()),f.Disposable.From(e,"suspend",()=>this._OnSuspend()),f.Disposable.From(e,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",
{preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(c=>({originalUrl:c.originalUrl,url:c.url,type:c.type,fileSize:c.fileSize})),isiOSCordova:this._runtime.IsiOSCordova(),timeScaleMode:this._timeScaleMode,latencyHint:a,panningModel:this._panningModel,distanceModel:this._distanceModel,refDistance:this._referenceDistance,maxDistance:this._maxDistance,rolloffFactor:this._rolloffFactor,listenerPos:[this._listenerX,this._listenerY,this._listenerZ]}).then(c=>{this._sampleRate=c.sampleRate}));
this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_OnInstanceDestroyed(a){this._listenerInst===a&&(this._listenerInst=null)}DbToLinearNoCap(a){return Math.pow(10,a/20)}DbToLinear(a){a=this.DbToLinearNoCap(a);return isFinite(a)?Math.max(Math.min(a,1),0):0}LinearToDbNoCap(a){return Math.log(a)/Math.log(10)*20}LinearToDb(a){return this.LinearToDbNoCap(Math.max(Math.min(a,1),0))}_OnSuspend(){this._playInBackground||this.PostToDOM("set-suspended",{isSuspended:!0})}_OnResume(){this._playInBackground||
this.PostToDOM("set-suspended",{isSuspended:!1})}_OnUpdateState(a){const e=a.tickCount,c=this._lastAIState.filter(d=>d.hasOwnProperty("placeholder")&&(d.placeholder>e||-1===d.placeholder));this._lastAIState=a.audioInstances;this._lastAnalysersData=a.analysers;0<c.length&&f.appendArray(this._lastAIState,c)}_OnUpdateFxState(a){this._lastFxState=a.fxstate}_GetFirstAudioStateByTag(a){for(const e of this._lastAIState)if(f.equalsNoCase(e.tag,a))return e;return null}_IsTagPlaying(a){return this._lastAIState.some(e=>
f.equalsNoCase(a,e.tag)&&e.isPlaying)}_MaybeMarkAsPlaying(a,e,c,d){if(this._IsTagPlaying(a))return null;a={tag:a,duration:0,volume:d,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:e,isLooping:c,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(a);return a}async _OnTrigger(a){const e=a.type;this._triggerTag=a.tag;a=a.aiid;if("ended"===e){for(const c of this._lastAIState)if(c.aiid===a){c.isPlaying=!1;break}await this.TriggerAsync(f.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"===
e&&await this.TriggerAsync(f.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const a={timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTime(),instPans:this.GetInstancePans(),tickCount:this._runtime.GetTickCountNoSave()};if(this._listenerInst){const e=this._listenerInst.GetWorldInfo();this._listenerX=e.GetX();this._listenerY=e.GetY();a.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(a,e,c,d,g){if(0===c)return[a,e];const k=Math.sin(c);
c=Math.cos(c);a-=d;e-=g;const m=a*k;a=a*c-e*k;return[a+d,e*c+m+g]}GetInstancePans(){return this._lastAIState.filter(a=>-1!==a.uid).map(a=>this._runtime.GetInstanceByUID(a.uid)).filter(a=>a).map(a=>{const e=a.GetWorldInfo(),c=e.GetLayer().GetAngle(),[d,g]=this.rotatePtAround(e.GetX(),e.GetY(),-c,this._listenerX,this._listenerY);return{uid:a.GetUID(),x:d,y:g,angle:e.GetAngle()-c}})}GetAnalyserData(a,e){for(const c of this._lastAnalysersData)if(c.index===e&&f.equalsNoCase(c.tag,a))return c;return null}_IncrementEffectCount(a){this._effectCount.set(a,
(this._effectCount.get(a)||0)+1)}_ShouldSave(a){return a.hasOwnProperty("placeholder")||3===this._saveLoadMode?!1:a.isMusic&&1===this._saveLoadMode?!1:a.isMusic||2!==this._saveLoadMode?!0:!1}SaveToJson(){return{isSilent:this._isSilent,masterVolume:this._masterVolume,listenerZ:this._listenerZ,listenerUid:this._listenerInst?this._listenerInst.GetUID():-1,remoteUrls:[...this._remoteUrls.entries()],playing:this._lastAIState.filter(a=>this._ShouldSave(a)),effects:this._lastFxState,analysers:this._lastAnalysersData}}LoadFromJson(a){this._isSilent=
a.isSilent;this._masterVolume=a.masterVolume;this._listenerZ=a.listenerZ;this._listenerInst=null;this._loadListenerUid=a.listenerUid;this._remoteUrls.clear();if(a.remoteUrls)for(const [e,c]of a.remoteUrls)this._remoteUrls.set(e,c);this._lastAIState=a.playing;this._lastFxState=a.effects;this._lastAnalysersData=a.analysers}_OnAfterLoad(){if(-1!==this._loadListenerUid&&(this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid),this._loadListenerUid=-1,this._listenerInst)){var a=this._listenerInst.GetWorldInfo();
this._listenerX=a.GetX();this._listenerY=a.GetY()}for(var e of this._lastAIState)(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e.bufferOriginalUrl))?(e.bufferUrl=a.url,e.bufferType=a.type):e.bufferUrl=null;for(const c of Object.values(this._lastFxState))for(const d of c)d.hasOwnProperty("bufferOriginalUrl")&&(e=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d.bufferOriginalUrl))&&(d.bufferUrl=e.url,d.bufferType=e.type);this.PostToDOM("load-state",{saveLoadMode:this._saveLoadMode,
timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTime(),listenerPos:[this._listenerX,this._listenerY,this._listenerZ],isSilent:this._isSilent,masterVolume:this._masterVolume,playing:this._lastAIState.filter(c=>null!==c.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const a=[];for(const [e,c]of Object.entries(this._lastFxState))a.push({name:"$"+e,value:c.map(d=>d.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((e,c)=>({name:"$#"+c,value:`${e.bufferOriginalUrl} ("${e.tag}") ${Math.round(10*e.playbackTime)/10} / ${Math.round(10*e.duration)/10}`}))]}]}}}"use strict";
{const f=self.C3;f.Plugins.Audio.Cnds={OnEnded(b){return f.equalsNoCase(this._triggerTag,b)},OnFadeEnded(b){return f.equalsNoCase(this._triggerTag,b)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return!0},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const b of this._lastAIState)if(b.isPlaying)return!0;return!1},IsTagPlaying(b){return this._IsTagPlaying(b)}}}"use strict";
{const f=self.C3,b="lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ");f.Plugins.Audio.Acts={async Play(a,e,c,d){if(!this._isSilent){var g=a[1],k=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(k){var m=this._nextPlayTime;this._nextPlayTime=0;var p=this._MaybeMarkAsPlaying(d.toLowerCase(),g,0!==e,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:k.url,type:k.type,isMusic:g,tag:d.toLowerCase(),isLooping:0!==e,vol:this.DbToLinear(c),
pos:0,off:m,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{p&&(p.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,e,c,d,g,k,m,p,n,u){if(!this._isSilent){var q=a[1],r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(r){var t=this._nextPlayTime;this._nextPlayTime=0;var x=this._MaybeMarkAsPlaying(u.toLowerCase(),q,0!==e,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:r.url,type:r.type,isMusic:q,tag:u.toLowerCase(),isLooping:0!==
e,vol:this.DbToLinear(c),pos:0,off:t,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:d,y:g,angle:f.toRadians(k),innerAngle:f.toRadians(m),outerAngle:f.toRadians(p),outerGain:this.DbToLinear(n)}})}finally{x&&(x.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,e,c,d,g,k,m,p){if(!this._isSilent&&d&&(d=d.GetFirstPicked())&&d.GetWorldInfo()){var n=d.GetWorldInfo(),u=n.GetLayer().GetAngle(),[q,r]=this.rotatePtAround(n.GetX(),n.GetY(),-u,this._listenerX,this._listenerY),
t=a[1],x=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(x){var z=this._nextPlayTime;this._nextPlayTime=0;var D=this._MaybeMarkAsPlaying(p.toLowerCase(),t,0!==e,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:x.url,type:x.type,isMusic:t,tag:p.toLowerCase(),isLooping:0!==e,vol:this.DbToLinear(c),pos:0,off:z,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:q,y:r,angle:n.GetAngle()-u,innerAngle:f.toRadians(g),outerAngle:f.toRadians(k),outerGain:this.DbToLinear(m),
uid:d.GetUID()}})}finally{D&&(D.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(a,e,c,d,g){if(!this._isSilent){a=1===a;var k=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase());if(k){var m=this._nextPlayTime;this._nextPlayTime=0;var p=this._MaybeMarkAsPlaying(g.toLowerCase(),a,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:e,url:k.url,type:k.type,isMusic:a,tag:g.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),
pos:0,off:m,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{p&&(p.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,e,c,d,g,k,m,p,n,u,q){if(!this._isSilent){a=1===a;var r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase());if(r){var t=this._nextPlayTime;this._nextPlayTime=0;var x=this._MaybeMarkAsPlaying(q.toLowerCase(),a,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:e,url:r.url,type:r.type,
isMusic:a,tag:q.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:t,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:g,y:k,angle:f.toRadians(m),innerAngle:f.toRadians(p),outerAngle:f.toRadians(n),outerGain:this.DbToLinear(u)}})}finally{x&&(x.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,e,c,d,g,k,m,p,n){if(!this._isSilent&&!this._isSilent&&g&&(g=g.GetFirstPicked())&&g.GetWorldInfo()){var u=g.GetWorldInfo(),q=u.GetLayer().GetAngle(),[r,t]=this.rotatePtAround(u.GetX(),
u.GetY(),-q,this._listenerX,this._listenerY);a=1===a;var x=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase());if(x){var z=this._nextPlayTime;this._nextPlayTime=0;var D=this._MaybeMarkAsPlaying(n.toLowerCase(),a,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:e,url:x.url,type:x.type,isMusic:a,tag:n.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:z,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:r,y:t,
angle:u.GetAngle()-q,innerAngle:f.toRadians(k),outerAngle:f.toRadians(m),outerGain:this.DbToLinear(p),uid:g.GetUID()}})}finally{D&&(D.placeholder=this._runtime.GetTickCountNoSave())}}}},SetLooping(a,e){this.PostToDOM("set-looping",{tag:a.toLowerCase(),isLooping:0===e})},SetMuted(a,e){this.PostToDOM("set-muted",{tag:a.toLowerCase(),isMuted:0===e})},SetVolume(a,e){this.PostToDOM("set-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(e)})},FadeVolume(a,e,c,d){this.PostToDOM("fade-volume",{tag:a.toLowerCase(),
vol:this.DbToLinear(e),duration:c,stopOnEnd:0===d})},async Preload(a){const e=a[1],c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:a[0],url:c.url,type:c.type,isMusic:e}),this._preloadCount++)},async PreloadByName(a,e){a=1===a;const c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase());c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:e,url:c.url,
type:c.type,isMusic:a}),this._preloadCount++)},SetPlaybackRate(a,e){this.PostToDOM("set-playback-rate",{tag:a.toLowerCase(),rate:Math.max(e,0)})},Stop(a){this.PostToDOM("stop",{tag:a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,e){this.PostToDOM("set-paused",{tag:a.toLowerCase(),paused:0===e})},Seek(a,e){this.PostToDOM("seek",{tag:a.toLowerCase(),pos:e})},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,e,c,d,g,k,m){a=a.toLowerCase();e=b[e];this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"filter",tag:a,params:[e,c,d,g,k,f.clamp(m/100,0,1)]})},AddDelayEffect(a,e,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"delay",tag:a,params:[e,this.DbToLinear(c),f.clamp(d/100,0,1)]})},AddFlangerEffect(a,e,
c,d,g,k){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"flanger",tag:a,params:[e/1E3,c/1E3,d,g/100,f.clamp(k/100,0,1)]})},AddPhaserEffect(a,e,c,d,g,k,m){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"phaser",tag:a,params:[e,c,d,g,k,f.clamp(m/100,0,1)]})},AddConvolutionEffect(a,e,c,d){a=a.toLowerCase();const g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e[0]);g&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect",
{type:"convolution",tag:a,bufferOriginalUrl:e[0],bufferUrl:g.url,bufferType:g.type,params:[0===c,f.clamp(d/100,0,1)]}))},AddGainEffect(a,e){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[this.DbToLinear(e)]})},AddMuteEffect(a){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[0]})},AddTremoloEffect(a,e,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"tremolo",
tag:a,params:[e,f.clamp(c/100,0,1)]})},AddRingModEffect(a,e,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"ringmod",tag:a,params:[e,f.clamp(c/100,0,1)]})},AddDistortionEffect(a,e,c,d,g,k){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"distortion",tag:a,params:[this.DbToLinearNoCap(e),this.DbToLinearNoCap(c),d,this.DbToLinearNoCap(g),f.clamp(k/100,0,1)]})},AddCompressorEffect(a,e,c,d,g,k){a=a.toLowerCase();this._IncrementEffectCount(a);
this.PostToDOM("add-effect",{type:"compressor",tag:a,params:[e,c,d,g/1E3,k/1E3]})},AddAnalyserEffect(a,e,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"analyser",tag:a,params:[e,c]})},RemoveEffects(a){a=a.toLowerCase();this._effectCount.set(a,0);this.PostToDOM("remove-effects",{tag:a});this._lastFxState={}},SetEffectParameter(a,e,c,d,g,k){this.PostToDOM("set-effect-param",{tag:a.toLowerCase(),index:Math.floor(e),param:c,value:d,ramp:g,time:k})},SetListenerObject(a){a&&
(a=a.GetFirstPicked())&&a.GetWorldInfo()&&(this._listenerInst=a)},SetListenerZ(a){this._listenerZ=a},ScheduleNextPlay(a){this._nextPlayTime=Math.max(a,0)},UnloadAudio(a){const e=a[1];(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]))&&this.PostToDOM("unload",{url:a.url,type:a.type,isMusic:e})},UnloadAudioByName(a,e){a=1===a;(e=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase()))&&this.PostToDOM("unload",{url:e.url,type:e.type,isMusic:a})},
UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(a,e,c){this._remoteUrls.set(c.toLowerCase(),{url:a,type:e})}}}"use strict";
self.C3.Plugins.Audio.Exps={Duration(f){return(f=this._GetFirstAudioStateByTag(f))?f.duration:0},PlaybackTime(f){return(f=this._GetFirstAudioStateByTag(f))?f.playbackTime:0},PlaybackRate(f){return(f=this._GetFirstAudioStateByTag(f))?f.playbackRate:0},Volume(f){return(f=this._GetFirstAudioStateByTag(f))?this.LinearToDb(f.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(f){return this._effectCount.get(f.toLowerCase())||0},AnalyserFreqBinCount(f,b){return(f=this.GetAnalyserData(f,
Math.floor(b)))?f.binCount:0},AnalyserFreqBinAt(f,b,a){f=this.GetAnalyserData(f,Math.floor(b));if(!f)return 0;a=Math.floor(a);return 0>a||a>=f.binCount?0:f.freqBins[a]},AnalyserPeakLevel(f,b){return(f=this.GetAnalyserData(f,Math.floor(b)))?f.peak:0},AnalyserRMSLevel(f,b){return(f=this.GetAnalyserData(f,Math.floor(b)))?f.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/1E3}};"use strict";
{const f=self.C3;self.C3_GetObjectRefTable=function(){return[f.Plugins.Text,f.Plugins.Sprite,f.Plugins.Arr,f.Plugins.Mouse,f.Plugins.Audio,f.Plugins.System.Cnds.OnLayoutStart,f.Plugins.System.Acts.SetLayerVisible,f.Plugins.Text.Acts.SetVisible,f.Plugins.Mouse.Cnds.OnObjectClicked,f.Plugins.Sprite.Acts.Destroy,f.Plugins.Sprite.Acts.SetVisible,f.Plugins.System.Cnds.Compare,f.Plugins.System.Acts.GoToLayout,f.Plugins.System.Cnds.IsGroupActive,f.Plugins.Arr.Acts.SetXY,f.Plugins.System.Acts.SetVar,f.Plugins.Arr.Acts.Clear,
f.Plugins.Arr.Exps.IndexOf,f.Plugins.Arr.Exps.At,f.Plugins.Text.Acts.TypewriterText,f.Plugins.System.Acts.Wait,f.Plugins.System.Acts.AddVar,f.Plugins.System.Cnds.EvaluateExpression,f.Plugins.System.Cnds.CompareVar,f.Plugins.System.Acts.CreateObject,f.Plugins.Audio.Acts.Play,f.Plugins.System.Cnds.TriggerOnce]};self.C3_JsPropNameTable=[{Dialogue:0},{Char1:0},{Char2:0},{DialogueBox:0},{DialogueContainer:0},{NameLeft:0},{NameRight:0},{NametagLeft:0},{NametagRight:0},{noClick:0},{joey1:0},{player1:0},
{drawing:0},{magicBinderClosed:0},{magicBinderOpen:0},{rockfront:0},{braceletExpand:0},{magicBinderClosed2:0},{CreditsText:0},{title:0},{TitleText:0},{PlayText:0},{Mouse:0},{Object:0},{Arrow:0},{attic1280x:0},{messyroom:0},{GoToRoom:0},{Text:0},{Audio:0},{credits:0},{scrapbook_drawing:0},{scrapbook_cards:0},{scrapbook_rock:0},{scrapbook_empty:0},{scrapbook_full:0},{TextCount:0},{InDialogue:0},{ArrayLength:0},{DialogueAdvancing:0},{Character:0},{TextCount2:0},{InDialogue2:0},{ArrayLength2:0},{DialogueAdvancing2:0},
{Character2:0},{DrawingClicked:0},{RockClicked:0},{BraceletClicked:0},{CardsClicked:0},{CurrentObject:0}]}"use strict";
self.C3_ExpressionFuncs=[()=>2,f=>{const b=f._GetNode(0).GetVar();return()=>b.GetValue()},()=>0,()=>"DialogueBoxes",()=>"What's this, a scrapbook?",()=>1,()=>"What was that noise? Sounds like somone fell.",()=>"... Must be Joey.",f=>{const b=f._GetNode(0);return()=>b.ExpObject(0)},f=>{const b=f._GetNode(0),a=f._GetNode(1).GetVar();return()=>b.ExpObject(a.GetValue(),1)},f=>{const b=f._GetNode(0),a=f._GetNode(1).GetVar();return()=>b.ExpObject(a.GetValue(),0)},f=>{const b=f._GetNode(0).GetVar(),a=f._GetNode(1).GetVar();
return()=>b.GetValue()<a.GetValue()?1:0},()=>"drawing",()=>"bracelet",()=>"cards",()=>"rock",()=>"end",()=>642,()=>233,()=>"DialogueBoxes2",()=>"... Ugly drawing. (Oh yeah, how could I forget this? Joey got these new markers from his mom and decided to test them out by drawing me.)",()=>"It\u2019s\u2026 pretty bad. I remember laughing at him in his face when he showed me, he got really embarrassed. But he worked hard on it, so we put it in the book.",()=>"(This was one of Joey\u2019s favorite things, he wanted to make us matching friendship bracelets before he left\u2026 It even has our names on it. Do I still have mine?)",
()=>"Trading cards...? (Joey must've given me these. He was super obsessed with these back in the day.)",()=>"My cards! You kept them.\n... They were the cruddy ones, though.",()=>"Rock...? Pet... Rock...? This was Joey\u2019s dumb pet rock\u2026 He always carried this stupid thing with him wherever he went\u2026",()=>"Hey, that's my rock! Give it back!",()=>"Why are you such a downer nowadays? You used to be fun.",()=>"Shut up! I still am fun! (What <i>is</i> wrong with me...)",()=>"Haha, that's more like you.",
()=>3,()=>"... Glad to have you back.",()=>1.5,()=>511,()=>466,()=>"background"];"use strict";self.C3.ScriptsInEvents={};runOnStartup(async f=>{f.addEventListener("beforeprojectstart",()=>OnBeforeProjectStart(f))});async function OnBeforeProjectStart(f){f.addEventListener("tick",()=>Tick(f))}function Tick(f){};