1
0
forked from sent/waves
waves/public/assets/g/thumbfighter/scripts/c3runtime.js
2025-04-09 17:11:14 -05:00

2156 lines
1.0 MiB

// Generated by Construct 3, the game and app creator :: https://www.construct.net
'use strict';"use strict";
(function(f,b){"object"===typeof exports&&"undefined"!==typeof module?b(exports):"function"===typeof define&&define.amd?define(["exports"],b):(f="undefined"!==typeof globalThis?globalThis:f||self,b(f.glMatrix={}))})(this,function(f){function b(k,n,v){var z=n[0],C=n[1],D=n[2];n=n[3];var G=v[0],K=v[1],M=v[2];v=v[3];k[0]=z*G+D*K;k[1]=C*G+n*K;k[2]=z*M+D*v;k[3]=C*M+n*v;return k}function a(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];return k}function c(k,n,v){var z=n[0],C=n[1],D=
n[2],G=n[3],K=n[4];n=n[5];var M=v[0],O=v[1],R=v[2],T=v[3],Y=v[4];v=v[5];k[0]=z*M+D*O;k[1]=C*M+G*O;k[2]=z*R+D*T;k[3]=C*R+G*T;k[4]=z*Y+D*v+K;k[5]=C*Y+G*v+n;return k}function d(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];return k}function e(){var k=new sa(9);sa!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0);k[0]=1;k[4]=1;k[8]=1;return k}function h(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=v[0],Y=v[1],
X=v[2],fa=v[3],ha=v[4],ba=v[5],qa=v[6],ka=v[7];v=v[8];k[0]=T*z+Y*G+X*O;k[1]=T*C+Y*K+X*R;k[2]=T*D+Y*M+X*n;k[3]=fa*z+ha*G+ba*O;k[4]=fa*C+ha*K+ba*R;k[5]=fa*D+ha*M+ba*n;k[6]=qa*z+ka*G+v*O;k[7]=qa*C+ka*K+v*R;k[8]=qa*D+ka*M+v*n;return k}function g(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];k[6]=n[6]-v[6];k[7]=n[7]-v[7];k[8]=n[8]-v[8];return k}function l(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;
k[13]=0;k[14]=0;k[15]=1;return k}function m(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=n[8],Y=n[9],X=n[10],fa=n[11],ha=n[12],ba=n[13],qa=n[14];n=n[15];var ka=v[0],ta=v[1],ua=v[2],ra=v[3];k[0]=ka*z+ta*K+ua*T+ra*ha;k[1]=ka*C+ta*M+ua*Y+ra*ba;k[2]=ka*D+ta*O+ua*X+ra*qa;k[3]=ka*G+ta*R+ua*fa+ra*n;ka=v[4];ta=v[5];ua=v[6];ra=v[7];k[4]=ka*z+ta*K+ua*T+ra*ha;k[5]=ka*C+ta*M+ua*Y+ra*ba;k[6]=ka*D+ta*O+ua*X+ra*qa;k[7]=ka*G+ta*R+ua*fa+ra*n;ka=v[8];ta=v[9];ua=v[10];ra=v[11];k[8]=ka*z+ta*K+
ua*T+ra*ha;k[9]=ka*C+ta*M+ua*Y+ra*ba;k[10]=ka*D+ta*O+ua*X+ra*qa;k[11]=ka*G+ta*R+ua*fa+ra*n;ka=v[12];ta=v[13];ua=v[14];ra=v[15];k[12]=ka*z+ta*K+ua*T+ra*ha;k[13]=ka*C+ta*M+ua*Y+ra*ba;k[14]=ka*D+ta*O+ua*X+ra*qa;k[15]=ka*G+ta*R+ua*fa+ra*n;return k}function u(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=z+z,M=C+C,O=D+D;n=z*K;var R=z*M;z*=O;var T=C*M;C*=O;D*=O;K*=G;M*=G;G*=O;k[0]=1-(T+D);k[1]=R+G;k[2]=z-M;k[3]=0;k[4]=R-G;k[5]=1-(n+D);k[6]=C+K;k[7]=0;k[8]=z+M;k[9]=C-K;k[10]=1-(n+T);k[11]=0;k[12]=v[0];k[13]=
v[1];k[14]=v[2];k[15]=1;return k}function w(k,n){k[0]=n[12];k[1]=n[13];k[2]=n[14];return k}function q(k,n){var v=n[4],z=n[5],C=n[6],D=n[8],G=n[9],K=n[10];k[0]=Math.hypot(n[0],n[1],n[2]);k[1]=Math.hypot(v,z,C);k[2]=Math.hypot(D,G,K);return k}function t(k,n){var v=new sa(3);q(v,n);var z=1/v[0],C=1/v[1],D=1/v[2],G=n[0]*z;v=n[1]*C;var K=n[2]*D,M=n[4]*z,O=n[5]*C,R=n[6]*D;z*=n[8];C*=n[9];n=n[10]*D;D=G+O+n;0<D?(G=2*Math.sqrt(D+1),k[3]=.25*G,k[0]=(R-C)/G,k[1]=(z-K)/G,k[2]=(v-M)/G):G>O&&G>n?(G=2*Math.sqrt(1+
G-O-n),k[3]=(R-C)/G,k[0]=.25*G,k[1]=(v+M)/G,k[2]=(z+K)/G):O>n?(G=2*Math.sqrt(1+O-G-n),k[3]=(z-K)/G,k[0]=(v+M)/G,k[1]=.25*G,k[2]=(R+C)/G):(G=2*Math.sqrt(1+n-G-O),k[3]=(v-M)/G,k[0]=(z+K)/G,k[1]=(R+C)/G,k[2]=.25*G);return k}function p(k,n,v,z,C){n=1/Math.tan(n/2);k[0]=n/v;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[11]=-1;k[12]=0;k[13]=0;k[15]=0;null!=C&&Infinity!==C?(v=1/(z-C),k[10]=(C+z)*v,k[14]=2*C*z*v):(k[10]=-1,k[14]=-2*z);return k}function r(k,n,v,z,C,D,G){var K=1/(n-v),M=
1/(z-C),O=1/(D-G);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=2*O;k[11]=0;k[12]=(n+v)*K;k[13]=(C+z)*M;k[14]=(G+D)*O;k[15]=1;return k}function x(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];k[6]=n[6]-v[6];k[7]=n[7]-v[7];k[8]=n[8]-v[8];k[9]=n[9]-v[9];k[10]=n[10]-v[10];k[11]=n[11]-v[11];k[12]=n[12]-v[12];k[13]=n[13]-v[13];k[14]=n[14]-v[14];k[15]=n[15]-v[15];return k}function y(){var k=new sa(3);sa!=Float32Array&&
(k[0]=0,k[1]=0,k[2]=0);return k}function E(k){return Math.hypot(k[0],k[1],k[2])}function H(k,n,v){var z=new sa(3);z[0]=k;z[1]=n;z[2]=v;return z}function A(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];return k}function F(k,n,v){k[0]=n[0]*v[0];k[1]=n[1]*v[1];k[2]=n[2]*v[2];return k}function J(k,n,v){k[0]=n[0]/v[0];k[1]=n[1]/v[1];k[2]=n[2]/v[2];return k}function B(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2])}function I(k,n){var v=n[0]-k[0],z=n[1]-k[1];k=n[2]-k[2];return v*v+z*z+k*k}function L(k){var n=
k[0],v=k[1];k=k[2];return n*n+v*v+k*k}function P(k,n){var v=n[0],z=n[1],C=n[2];v=v*v+z*z+C*C;0<v&&(v=1/Math.sqrt(v));k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;return k}function S(k,n){return k[0]*n[0]+k[1]*n[1]+k[2]*n[2]}function U(k,n,v){var z=n[0],C=n[1];n=n[2];var D=v[0],G=v[1];v=v[2];k[0]=C*v-n*G;k[1]=n*D-z*v;k[2]=z*G-C*D;return k}function V(){var k=new sa(4);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[3]=0);return k}function Z(k){var n=new sa(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n}function ma(k,
n,v,z){var C=new sa(4);C[0]=k;C[1]=n;C[2]=v;C[3]=z;return C}function va(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k}function Na(k,n,v,z,C){k[0]=n;k[1]=v;k[2]=z;k[3]=C;return k}function Ea(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];return k}function Ia(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];return k}function Ma(k,n,v){k[0]=n[0]*v[0];k[1]=n[1]*v[1];k[2]=n[2]*v[2];k[3]=n[3]*v[3];return k}function Fa(k,n,v){k[0]=n[0]/v[0];k[1]=n[1]/v[1];k[2]=
n[2]/v[2];k[3]=n[3]/v[3];return k}function ya(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;return k}function na(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2],n[3]-k[3])}function Va(k,n){var v=n[0]-k[0],z=n[1]-k[1],C=n[2]-k[2];k=n[3]-k[3];return v*v+z*z+C*C+k*k}function xa(k){return Math.hypot(k[0],k[1],k[2],k[3])}function Ga(k){var n=k[0],v=k[1],z=k[2];k=k[3];return n*n+v*v+z*z+k*k}function bb(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=v*v+z*z+C*C+n*n;0<D&&(D=1/Math.sqrt(D));k[0]=
v*D;k[1]=z*D;k[2]=C*D;k[3]=n*D;return k}function Xa(k,n){return k[0]*n[0]+k[1]*n[1]+k[2]*n[2]+k[3]*n[3]}function ob(k,n,v,z){var C=n[0],D=n[1],G=n[2];n=n[3];k[0]=C+z*(v[0]-C);k[1]=D+z*(v[1]-D);k[2]=G+z*(v[2]-G);k[3]=n+z*(v[3]-n);return k}function pb(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]}function cb(){var k=new sa(4);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0);k[3]=1;return k}function qb(k,n,v){v*=.5;var z=Math.sin(v);k[0]=z*n[0];k[1]=z*n[1];k[2]=z*n[2];k[3]=Math.cos(v);return k}
function rb(k,n,v){var z=n[0],C=n[1],D=n[2];n=n[3];var G=v[0],K=v[1],M=v[2];v=v[3];k[0]=z*v+n*G+C*M-D*K;k[1]=C*v+n*K+D*G-z*M;k[2]=D*v+n*M+z*K-C*G;k[3]=n*v-z*G-C*K-D*M;return k}function sb(k,n,v){v*=.5;var z=n[0],C=n[1],D=n[2];n=n[3];var G=Math.sin(v);v=Math.cos(v);k[0]=z*v+n*G;k[1]=C*v+D*G;k[2]=D*v-C*G;k[3]=n*v-z*G;return k}function tb(k,n,v){v*=.5;var z=n[0],C=n[1],D=n[2];n=n[3];var G=Math.sin(v);v=Math.cos(v);k[0]=z*v-D*G;k[1]=C*v+n*G;k[2]=D*v+z*G;k[3]=n*v-C*G;return k}function ub(k,n,v){v*=.5;
var z=n[0],C=n[1],D=n[2];n=n[3];var G=Math.sin(v);v=Math.cos(v);k[0]=z*v+C*G;k[1]=C*v-z*G;k[2]=D*v+n*G;k[3]=n*v-D*G;return k}function vb(k,n){var v=n[0],z=n[1],C=n[2],D=Math.sqrt(v*v+z*z+C*C);n=Math.exp(n[3]);var G=0<D?n*Math.sin(D)/D:0;k[0]=v*G;k[1]=z*G;k[2]=C*G;k[3]=n*Math.cos(D);return k}function wb(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=Math.sqrt(v*v+z*z+C*C);D=0<D?Math.atan2(D,n)/D:0;k[0]=v*D;k[1]=z*D;k[2]=C*D;k[3]=.5*Math.log(v*v+z*z+C*C+n*n);return k}function db(k,n,v,z){var C=n[0],D=n[1],
G=n[2];n=n[3];var K=v[0],M=v[1],O=v[2];v=v[3];var R=C*K+D*M+G*O+n*v;0>R&&(R=-R,K=-K,M=-M,O=-O,v=-v);if(1E-6<1-R){var T=Math.acos(R);var Y=Math.sin(T);R=Math.sin((1-z)*T)/Y;z=Math.sin(z*T)/Y}else R=1-z;k[0]=R*C+z*K;k[1]=R*D+z*M;k[2]=R*G+z*O;k[3]=R*n+z*v;return k}function xb(k,n){var v=n[0]+n[4]+n[8];if(0<v)v=Math.sqrt(v+1),k[3]=.5*v,v=.5/v,k[0]=(n[5]-n[7])*v,k[1]=(n[6]-n[2])*v,k[2]=(n[1]-n[3])*v;else{var z=0;n[4]>n[0]&&(z=1);n[8]>n[3*z+z]&&(z=2);var C=(z+1)%3,D=(z+2)%3;v=Math.sqrt(n[3*z+z]-n[3*C+C]-
n[3*D+D]+1);k[z]=.5*v;v=.5/v;k[3]=(n[3*C+D]-n[3*D+C])*v;k[C]=(n[3*C+z]+n[3*z+C])*v;k[D]=(n[3*D+z]+n[3*z+D])*v}return k}function yb(k,n,v){var z=.5*v[0],C=.5*v[1];v=.5*v[2];var D=n[0],G=n[1],K=n[2];n=n[3];k[0]=D;k[1]=G;k[2]=K;k[3]=n;k[4]=z*n+C*K-v*G;k[5]=C*n+v*D-z*K;k[6]=v*n+z*G-C*D;k[7]=-z*D-C*G-v*K;return k}function zb(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];return k}function eb(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=v[4],M=v[5],O=v[6],R=v[7],T=n[4],
Y=n[5],X=n[6];n=n[7];var fa=v[0],ha=v[1],ba=v[2];v=v[3];k[0]=z*v+G*fa+C*ba-D*ha;k[1]=C*v+G*ha+D*fa-z*ba;k[2]=D*v+G*ba+z*ha-C*fa;k[3]=G*v-z*fa-C*ha-D*ba;k[4]=z*R+G*K+C*O-D*M+T*v+n*fa+Y*ba-X*ha;k[5]=C*R+G*M+D*K-z*O+Y*v+n*ha+X*fa-T*ba;k[6]=D*R+G*O+z*M-C*K+X*v+n*ba+T*ha-Y*fa;k[7]=G*R-z*K-C*M-D*O+n*v-T*fa-Y*ha-X*ba;return k}function Wa(){var k=new sa(2);sa!=Float32Array&&(k[0]=0,k[1]=0);return k}function fb(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];return k}function gb(k,n,v){k[0]=n[0]*v[0];k[1]=n[1]*v[1];
return k}function Ya(k,n,v){k[0]=n[0]/v[0];k[1]=n[1]/v[1];return k}function hb(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1])}function Ta(k,n){var v=n[0]-k[0];k=n[1]-k[1];return v*v+k*k}function ib(k){return Math.hypot(k[0],k[1])}function jb(k){var n=k[0];k=k[1];return n*n+k*k}var sa="undefined"!==typeof Float32Array?Float32Array:Array,Sa=Math.random,Ab=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var k=0,n=arguments.length;n--;)k+=arguments[n]*arguments[n];return Math.sqrt(k)});var Db=Object.freeze({__proto__:null,
EPSILON:1E-6,get ARRAY_TYPE(){return sa},RANDOM:Sa,ANGLE_ORDER:"zyx",setMatrixArrayType:function(k){sa=k},toRadian:function(k){return k*Ab},equals:function(k,n){return Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))}}),Eb=Object.freeze({__proto__:null,create:function(){var k=new sa(4);sa!=Float32Array&&(k[1]=0,k[2]=0);k[0]=1;k[3]=1;return k},clone:function(k){var n=new sa(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k},
identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;return k},fromValues:function(k,n,v,z){var C=new sa(4);C[0]=k;C[1]=n;C[2]=v;C[3]=z;return C},set:function(k,n,v,z,C){k[0]=n;k[1]=v;k[2]=z;k[3]=C;return k},transpose:function(k,n){if(k===n){var v=n[1];k[1]=n[2];k[2]=v}else k[0]=n[0],k[1]=n[2],k[2]=n[1],k[3]=n[3];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=v*n-C*z;if(!D)return null;D=1/D;k[0]=n*D;k[1]=-z*D;k[2]=-C*D;k[3]=v*D;return k},adjoint:function(k,n){var v=n[0];k[0]=n[3];
k[1]=-n[1];k[2]=-n[2];k[3]=v;return k},determinant:function(k){return k[0]*k[3]-k[2]*k[1]},multiply:b,rotate:function(k,n,v){var z=n[0],C=n[1],D=n[2];n=n[3];var G=Math.sin(v);v=Math.cos(v);k[0]=z*v+D*G;k[1]=C*v+n*G;k[2]=z*-G+D*v;k[3]=C*-G+n*v;return k},scale:function(k,n,v){var z=n[1],C=n[2],D=n[3],G=v[0];v=v[1];k[0]=n[0]*G;k[1]=z*G;k[2]=C*v;k[3]=D*v;return k},fromRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=-v;k[3]=n;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=
0;k[2]=0;k[3]=n[1];return k},str:function(k){return"mat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3])},LDU:function(k,n,v,z){k[2]=z[2]/z[0];v[0]=z[0];v[1]=z[1];v[3]=z[3]-k[2]*v[1];return[k,n,v]},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];return k},subtract:a,exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]},equals:function(k,n){var v=k[0],z=k[1],C=k[2];k=k[3];var D=n[0],G=n[1],
K=n[2];n=n[3];return Math.abs(v-D)<=1E-6*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(z-G)<=1E-6*Math.max(1,Math.abs(z),Math.abs(G))&&Math.abs(C-K)<=1E-6*Math.max(1,Math.abs(C),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;return k},mul:b,sub:a}),Fb=Object.freeze({__proto__:null,
create:function(){var k=new sa(6);sa!=Float32Array&&(k[1]=0,k[2]=0,k[4]=0,k[5]=0);k[0]=1;k[3]=1;return k},clone:function(k){var n=new sa(6);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;return k},fromValues:function(k,n,v,z,C,D){var G=new sa(6);G[0]=k;G[1]=n;G[2]=v;G[3]=z;G[4]=C;G[5]=D;return G},set:function(k,n,v,z,C,D,G){k[0]=
n;k[1]=v;k[2]=z;k[3]=C;k[4]=D;k[5]=G;return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4];n=n[5];var K=v*D-z*C;if(!K)return null;K=1/K;k[0]=D*K;k[1]=-z*K;k[2]=-C*K;k[3]=v*K;k[4]=(C*n-D*G)*K;k[5]=(z*G-v*n)*K;return k},determinant:function(k){return k[0]*k[3]-k[1]*k[2]},multiply:c,rotate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4];n=n[5];var M=Math.sin(v);v=Math.cos(v);k[0]=z*v+D*M;k[1]=C*v+G*M;k[2]=z*-M+D*v;k[3]=C*-M+G*v;k[4]=K;k[5]=n;return k},scale:function(k,n,v){var z=
n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=v[0];v=v[1];k[0]=n[0]*M;k[1]=z*M;k[2]=C*v;k[3]=D*v;k[4]=G;k[5]=K;return k},translate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4];n=n[5];var M=v[0];v=v[1];k[0]=z;k[1]=C;k[2]=D;k[3]=G;k[4]=z*M+D*v+K;k[5]=C*M+G*v+n;return k},fromRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=-v;k[3]=n;k[4]=0;k[5]=0;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=n[1];k[4]=0;k[5]=0;return k},fromTranslation:function(k,n){k[0]=1;
k[1]=0;k[2]=0;k[3]=1;k[4]=n[0];k[5]=n[1];return k},str:function(k){return"mat2d("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],1)},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];return k},subtract:d,multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+
v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;k[4]=n[4]+v[4]*z;k[5]=n[5]+v[5]*z;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],D=k[3],G=k[4];k=k[5];var K=n[0],M=n[1],O=n[2],R=n[3],T=n[4];n=n[5];return Math.abs(v-K)<=1E-6*Math.max(1,Math.abs(v),Math.abs(K))&&Math.abs(z-M)<=1E-6*Math.max(1,Math.abs(z),Math.abs(M))&&Math.abs(C-O)<=1E-6*Math.max(1,Math.abs(C),Math.abs(O))&&
Math.abs(D-R)<=1E-6*Math.max(1,Math.abs(D),Math.abs(R))&&Math.abs(G-T)<=1E-6*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:c,sub:d}),Gb=Object.freeze({__proto__:null,create:e,fromMat4:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[4];k[4]=n[5];k[5]=n[6];k[6]=n[8];k[7]=n[9];k[8]=n[10];return k},clone:function(k){var n=new sa(9);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];return n},copy:function(k,
n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromValues:function(k,n,v,z,C,D,G,K,M){var O=new sa(9);O[0]=k;O[1]=n;O[2]=v;O[3]=z;O[4]=C;O[5]=D;O[6]=G;O[7]=K;O[8]=M;return O},set:function(k,n,v,z,C,D,G,K,M,O){k[0]=n;k[1]=v;k[2]=z;k[3]=C;k[4]=D;k[5]=G;k[6]=K;k[7]=M;k[8]=O;return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},transpose:function(k,n){if(k===n){var v=n[1],z=n[2],C=n[5];k[1]=n[3];
k[2]=n[6];k[3]=v;k[5]=n[7];k[6]=z;k[7]=C}else k[0]=n[0],k[1]=n[3],k[2]=n[6],k[3]=n[1],k[4]=n[4],k[5]=n[7],k[6]=n[2],k[7]=n[5],k[8]=n[8];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=n[6],O=n[7];n=n[8];var R=n*G-K*O,T=-n*D+K*M,Y=O*D-G*M,X=v*R+z*T+C*Y;if(!X)return null;X=1/X;k[0]=R*X;k[1]=(-n*z+C*O)*X;k[2]=(K*z-C*G)*X;k[3]=T*X;k[4]=(n*v-C*M)*X;k[5]=(-K*v+C*D)*X;k[6]=Y*X;k[7]=(-O*v+z*M)*X;k[8]=(G*v-z*D)*X;return k},adjoint:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],
G=n[4],K=n[5],M=n[6],O=n[7];n=n[8];k[0]=G*n-K*O;k[1]=C*O-z*n;k[2]=z*K-C*G;k[3]=K*M-D*n;k[4]=v*n-C*M;k[5]=C*D-v*K;k[6]=D*O-G*M;k[7]=z*M-v*O;k[8]=v*G-z*D;return k},determinant:function(k){var n=k[3],v=k[4],z=k[5],C=k[6],D=k[7],G=k[8];return k[0]*(G*v-z*D)+k[1]*(-G*n+z*C)+k[2]*(D*n-v*C)},multiply:h,translate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=v[0];v=v[1];k[0]=z;k[1]=C;k[2]=D;k[3]=G;k[4]=K;k[5]=M;k[6]=T*z+v*G+O;k[7]=T*C+v*K+R;k[8]=T*D+v*M+n;return k},
rotate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=Math.sin(v);v=Math.cos(v);k[0]=v*z+T*G;k[1]=v*C+T*K;k[2]=v*D+T*M;k[3]=v*G-T*z;k[4]=v*K-T*C;k[5]=v*M-T*D;k[6]=O;k[7]=R;k[8]=n;return k},scale:function(k,n,v){var z=v[0];v=v[1];k[0]=z*n[0];k[1]=z*n[1];k[2]=z*n[2];k[3]=v*n[3];k[4]=v*n[4];k[5]=v*n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=n[0];k[7]=n[1];k[8]=1;return k},fromRotation:function(k,
n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=0;k[3]=-v;k[4]=n;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=n[1];k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromMat2d:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=0;k[3]=n[2];k[4]=n[3];k[5]=0;k[6]=n[4];k[7]=n[5];k[8]=1;return k},fromQuat:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=v+v,G=z+z,K=C+C;v*=D;var M=z*D;z*=G;var O=C*D,R=C*G;C*=K;D*=n;G*=n;n*=K;k[0]=1-z-C;k[3]=M-n;k[6]=O+G;k[1]=M+n;k[4]=
1-v-C;k[7]=R-D;k[2]=O-G;k[5]=R+D;k[8]=1-v-z;return k},normalFromMat4:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*G,ka=v*M-C*G,ta=v*O-D*G,ua=z*M-C*K,ra=z*O-D*K,za=C*O-D*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa;R=R*n-X*fa;var Ca=T*ba-Y*ha;T=T*n-X*ha;Y=Y*n-X*ba;X=qa*Y-ka*T+ta*Ca+ua*R-ra*Ba+za*Aa;if(!X)return null;X=1/X;k[0]=(K*Y-M*T+O*Ca)*X;k[1]=(M*R-G*Y-O*Ba)*X;k[2]=(G*T-K*R+O*Aa)*X;k[3]=(C*T-z*Y-D*Ca)*X;
k[4]=(v*Y-C*R+D*Ba)*X;k[5]=(z*R-v*T-D*Aa)*X;k[6]=(ha*za-ba*ra+n*ua)*X;k[7]=(ba*ta-fa*za-n*ka)*X;k[8]=(fa*ra-ha*ta+n*qa)*X;return k},projection:function(k,n,v){k[0]=2/n;k[1]=0;k[2]=0;k[3]=0;k[4]=-2/v;k[5]=0;k[6]=-1;k[7]=1;k[8]=1;return k},str:function(k){return"mat3("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+", "+k[8]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8])},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];
k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];k[6]=n[6]+v[6];k[7]=n[7]+v[7];k[8]=n[8]+v[8];return k},subtract:g,multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;k[6]=n[6]*v;k[7]=n[7]*v;k[8]=n[8]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;k[4]=n[4]+v[4]*z;k[5]=n[5]+v[5]*z;k[6]=n[6]+v[6]*z;k[7]=n[7]+v[7]*z;k[8]=n[8]+v[8]*z;return k},exactEquals:function(k,n){return k[0]===
n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]&&k[8]===n[8]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],D=k[3],G=k[4],K=k[5],M=k[6],O=k[7];k=k[8];var R=n[0],T=n[1],Y=n[2],X=n[3],fa=n[4],ha=n[5],ba=n[6],qa=n[7];n=n[8];return Math.abs(v-R)<=1E-6*Math.max(1,Math.abs(v),Math.abs(R))&&Math.abs(z-T)<=1E-6*Math.max(1,Math.abs(z),Math.abs(T))&&Math.abs(C-Y)<=1E-6*Math.max(1,Math.abs(C),Math.abs(Y))&&Math.abs(D-X)<=1E-6*Math.max(1,Math.abs(D),Math.abs(X))&&
Math.abs(G-fa)<=1E-6*Math.max(1,Math.abs(G),Math.abs(fa))&&Math.abs(K-ha)<=1E-6*Math.max(1,Math.abs(K),Math.abs(ha))&&Math.abs(M-ba)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ba))&&Math.abs(O-qa)<=1E-6*Math.max(1,Math.abs(O),Math.abs(qa))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:h,sub:g}),Hb=Object.freeze({__proto__:null,create:function(){var k=new sa(16);sa!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[4]=0,k[6]=0,k[7]=0,k[8]=0,k[9]=0,k[11]=0,k[12]=0,k[13]=0,k[14]=0);k[0]=1;k[5]=1;k[10]=
1;k[15]=1;return k},clone:function(k){var n=new sa(16);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];n[9]=k[9];n[10]=k[10];n[11]=k[11];n[12]=k[12];n[13]=k[13];n[14]=k[14];n[15]=k[15];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];k[9]=n[9];k[10]=n[10];k[11]=n[11];k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},fromValues:function(k,n,v,z,C,D,G,K,M,O,R,T,Y,X,fa,ha){var ba=new sa(16);
ba[0]=k;ba[1]=n;ba[2]=v;ba[3]=z;ba[4]=C;ba[5]=D;ba[6]=G;ba[7]=K;ba[8]=M;ba[9]=O;ba[10]=R;ba[11]=T;ba[12]=Y;ba[13]=X;ba[14]=fa;ba[15]=ha;return ba},set:function(k,n,v,z,C,D,G,K,M,O,R,T,Y,X,fa,ha,ba){k[0]=n;k[1]=v;k[2]=z;k[3]=C;k[4]=D;k[5]=G;k[6]=K;k[7]=M;k[8]=O;k[9]=R;k[10]=T;k[11]=Y;k[12]=X;k[13]=fa;k[14]=ha;k[15]=ba;return k},identity:l,transpose:function(k,n){if(k===n){var v=n[1],z=n[2],C=n[3],D=n[6],G=n[7],K=n[11];k[1]=n[4];k[2]=n[8];k[3]=n[12];k[4]=v;k[6]=n[9];k[7]=n[13];k[8]=z;k[9]=D;k[11]=n[14];
k[12]=C;k[13]=G;k[14]=K}else k[0]=n[0],k[1]=n[4],k[2]=n[8],k[3]=n[12],k[4]=n[1],k[5]=n[5],k[6]=n[9],k[7]=n[13],k[8]=n[2],k[9]=n[6],k[10]=n[10],k[11]=n[14],k[12]=n[3],k[13]=n[7],k[14]=n[11],k[15]=n[15];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*G,ka=v*M-C*G,ta=v*O-D*G,ua=z*M-C*K,ra=z*O-D*K,za=C*O-D*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa,Ca=R*n-X*fa,Ja=T*ba-Y*ha,Pa=T*n-X*ha,Qa=Y*n-X*ba,
Da=qa*Qa-ka*Pa+ta*Ja+ua*Ca-ra*Ba+za*Aa;if(!Da)return null;Da=1/Da;k[0]=(K*Qa-M*Pa+O*Ja)*Da;k[1]=(C*Pa-z*Qa-D*Ja)*Da;k[2]=(ha*za-ba*ra+n*ua)*Da;k[3]=(Y*ra-T*za-X*ua)*Da;k[4]=(M*Ca-G*Qa-O*Ba)*Da;k[5]=(v*Qa-C*Ca+D*Ba)*Da;k[6]=(ba*ta-fa*za-n*ka)*Da;k[7]=(R*za-Y*ta+X*ka)*Da;k[8]=(G*Pa-K*Ca+O*Aa)*Da;k[9]=(z*Ca-v*Pa-D*Aa)*Da;k[10]=(fa*ra-ha*ta+n*qa)*Da;k[11]=(T*ta-R*ra-X*qa)*Da;k[12]=(K*Ba-G*Ja-M*Aa)*Da;k[13]=(v*Ja-z*Ba+C*Aa)*Da;k[14]=(ha*ka-fa*ua-ba*qa)*Da;k[15]=(R*ua-T*ka+Y*qa)*Da;return k},adjoint:function(k,
n){var v=n[0],z=n[1],C=n[2],D=n[3],G=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*G,ka=v*M-C*G,ta=v*O-D*G,ua=z*M-C*K,ra=z*O-D*K,za=C*O-D*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa,Ca=R*n-X*fa,Ja=T*ba-Y*ha,Pa=T*n-X*ha,Qa=Y*n-X*ba;k[0]=K*Qa-M*Pa+O*Ja;k[1]=C*Pa-z*Qa-D*Ja;k[2]=ha*za-ba*ra+n*ua;k[3]=Y*ra-T*za-X*ua;k[4]=M*Ca-G*Qa-O*Ba;k[5]=v*Qa-C*Ca+D*Ba;k[6]=ba*ta-fa*za-n*ka;k[7]=R*za-Y*ta+X*ka;k[8]=G*Pa-K*Ca+O*Aa;k[9]=z*Ca-v*Pa-D*Aa;k[10]=fa*ra-ha*ta+n*qa;k[11]=
T*ta-R*ra-X*qa;k[12]=K*Ba-G*Ja-M*Aa;k[13]=v*Ja-z*Ba+C*Aa;k[14]=ha*ka-fa*ua-ba*qa;k[15]=R*ua-T*ka+Y*qa;return k},determinant:function(k){var n=k[0],v=k[1],z=k[2],C=k[4],D=k[5],G=k[6],K=k[8],M=k[9],O=k[10],R=k[12],T=k[13],Y=k[14],X=n*D-v*C,fa=n*G-z*C,ha=v*G-z*D,ba=K*T-M*R,qa=K*Y-O*R,ka=M*Y-O*T;return k[7]*(n*ka-v*qa+z*ba)-k[3]*(C*ka-D*qa+G*ba)+k[15]*(K*ha-M*fa+O*X)-k[11]*(R*ha-T*fa+Y*X)},multiply:m,translate:function(k,n,v){var z=v[0],C=v[1];v=v[2];if(n===k)k[12]=n[0]*z+n[4]*C+n[8]*v+n[12],k[13]=n[1]*
z+n[5]*C+n[9]*v+n[13],k[14]=n[2]*z+n[6]*C+n[10]*v+n[14],k[15]=n[3]*z+n[7]*C+n[11]*v+n[15];else{var D=n[0];var G=n[1];var K=n[2];var M=n[3];var O=n[4];var R=n[5];var T=n[6];var Y=n[7];var X=n[8];var fa=n[9];var ha=n[10];var ba=n[11];k[0]=D;k[1]=G;k[2]=K;k[3]=M;k[4]=O;k[5]=R;k[6]=T;k[7]=Y;k[8]=X;k[9]=fa;k[10]=ha;k[11]=ba;k[12]=D*z+O*C+X*v+n[12];k[13]=G*z+R*C+fa*v+n[13];k[14]=K*z+T*C+ha*v+n[14];k[15]=M*z+Y*C+ba*v+n[15]}return k},scale:function(k,n,v){var z=v[0],C=v[1];v=v[2];k[0]=n[0]*z;k[1]=n[1]*z;
k[2]=n[2]*z;k[3]=n[3]*z;k[4]=n[4]*C;k[5]=n[5]*C;k[6]=n[6]*C;k[7]=n[7]*C;k[8]=n[8]*v;k[9]=n[9]*v;k[10]=n[10]*v;k[11]=n[11]*v;k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},rotate:function(k,n,v,z){var C=z[0],D=z[1];z=z[2];var G=Math.hypot(C,D,z);if(1E-6>G)return null;G=1/G;C*=G;D*=G;z*=G;var K=Math.sin(v);var M=Math.cos(v);var O=1-M;v=n[0];G=n[1];var R=n[2];var T=n[3];var Y=n[4];var X=n[5];var fa=n[6];var ha=n[7];var ba=n[8];var qa=n[9];var ka=n[10];var ta=n[11];var ua=C*C*O+M;var ra=D*
C*O+z*K;var za=z*C*O-D*K;var Aa=C*D*O-z*K;var Ba=D*D*O+M;var Ca=z*D*O+C*K;var Ja=C*z*O+D*K;C=D*z*O-C*K;D=z*z*O+M;k[0]=v*ua+Y*ra+ba*za;k[1]=G*ua+X*ra+qa*za;k[2]=R*ua+fa*ra+ka*za;k[3]=T*ua+ha*ra+ta*za;k[4]=v*Aa+Y*Ba+ba*Ca;k[5]=G*Aa+X*Ba+qa*Ca;k[6]=R*Aa+fa*Ba+ka*Ca;k[7]=T*Aa+ha*Ba+ta*Ca;k[8]=v*Ja+Y*C+ba*D;k[9]=G*Ja+X*C+qa*D;k[10]=R*Ja+fa*C+ka*D;k[11]=T*Ja+ha*C+ta*D;n!==k&&(k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);return k},rotateX:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[4],D=
n[5],G=n[6],K=n[7],M=n[8],O=n[9],R=n[10],T=n[11];n!==k&&(k[0]=n[0],k[1]=n[1],k[2]=n[2],k[3]=n[3],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[4]=C*v+M*z;k[5]=D*v+O*z;k[6]=G*v+R*z;k[7]=K*v+T*z;k[8]=M*v-C*z;k[9]=O*v-D*z;k[10]=R*v-G*z;k[11]=T*v-K*z;return k},rotateY:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[0],D=n[1],G=n[2],K=n[3],M=n[8],O=n[9],R=n[10],T=n[11];n!==k&&(k[4]=n[4],k[5]=n[5],k[6]=n[6],k[7]=n[7],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=C*v-M*z;k[1]=D*v-O*
z;k[2]=G*v-R*z;k[3]=K*v-T*z;k[8]=C*z+M*v;k[9]=D*z+O*v;k[10]=G*z+R*v;k[11]=K*z+T*v;return k},rotateZ:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[0],D=n[1],G=n[2],K=n[3],M=n[4],O=n[5],R=n[6],T=n[7];n!==k&&(k[8]=n[8],k[9]=n[9],k[10]=n[10],k[11]=n[11],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=C*v+M*z;k[1]=D*v+O*z;k[2]=G*v+R*z;k[3]=K*v+T*z;k[4]=M*v-C*z;k[5]=O*v-D*z;k[6]=R*v-G*z;k[7]=T*v-K*z;return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;
k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=n[0];k[13]=n[1];k[14]=n[2];k[15]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n[1];k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=n[2];k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotation:function(k,n,v){var z=v[0],C=v[1];v=v[2];var D=Math.hypot(z,C,v);if(1E-6>D)return null;D=1/D;z*=D;C*=D;v*=D;D=Math.sin(n);n=Math.cos(n);var G=1-n;k[0]=z*z*G+n;k[1]=C*z*G+v*D;k[2]=v*z*G-C*D;k[3]=0;k[4]=z*C*G-v*D;k[5]=C*C*G+n;k[6]=v*C*G+z*
D;k[7]=0;k[8]=z*v*G+C*D;k[9]=C*v*G-z*D;k[10]=v*v*G+n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromXRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=v;k[7]=0;k[8]=0;k[9]=-v;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromYRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=0;k[2]=-v;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=v;k[9]=0;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromZRotation:function(k,
n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=0;k[3]=0;k[4]=-v;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotationTranslation:u,fromQuat2:function(k,n){var v=new sa(3),z=-n[0],C=-n[1],D=-n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=z*z+C*C+D*D+G*G;0<T?(v[0]=2*(K*G+R*z+M*D-O*C)/T,v[1]=2*(M*G+R*C+O*z-K*D)/T,v[2]=2*(O*G+R*D+K*C-M*z)/T):(v[0]=2*(K*G+R*z+M*D-O*C),v[1]=2*(M*G+R*C+O*z-K*D),v[2]=2*(O*G+R*D+K*C-M*z));u(k,n,v);return k},getTranslation:w,
getScaling:q,getRotation:t,decompose:function(k,n,v,z){n[0]=z[12];n[1]=z[13];n[2]=z[14];var C=z[0],D=z[1],G=z[2],K=z[4],M=z[5],O=z[6],R=z[8];n=z[9];z=z[10];v[0]=Math.hypot(C,D,G);v[1]=Math.hypot(K,M,O);v[2]=Math.hypot(R,n,z);var T=1/v[0],Y=1/v[1],X=1/v[2];v=C*T;D*=Y;G*=X;K*=T;M*=Y;O*=X;R*=T;n*=Y;z*=X;Y=v+M+z;0<Y?(z=2*Math.sqrt(Y+1),k[3]=.25*z,k[0]=(O-n)/z,k[1]=(R-G)/z,k[2]=(D-K)/z):v>M&&v>z?(z=2*Math.sqrt(1+v-M-z),k[3]=(O-n)/z,k[0]=.25*z,k[1]=(D+K)/z,k[2]=(R+G)/z):M>z?(z=2*Math.sqrt(1+M-v-z),k[3]=
(R-G)/z,k[0]=(D+K)/z,k[1]=.25*z,k[2]=(O+n)/z):(z=2*Math.sqrt(1+z-v-M),k[3]=(D-K)/z,k[0]=(R+G)/z,k[1]=(O+n)/z,k[2]=.25*z);return k},fromRotationTranslationScale:function(k,n,v,z){var C=n[0],D=n[1],G=n[2],K=n[3],M=C+C,O=D+D,R=G+G;n=C*M;var T=C*O;C*=R;var Y=D*O;D*=R;G*=R;M*=K;O*=K;K*=R;R=z[0];var X=z[1];z=z[2];k[0]=(1-(Y+G))*R;k[1]=(T+K)*R;k[2]=(C-O)*R;k[3]=0;k[4]=(T-K)*X;k[5]=(1-(n+G))*X;k[6]=(D+M)*X;k[7]=0;k[8]=(C+O)*z;k[9]=(D-M)*z;k[10]=(1-(n+Y))*z;k[11]=0;k[12]=v[0];k[13]=v[1];k[14]=v[2];k[15]=1;
return k},fromRotationTranslationScaleOrigin:function(k,n,v,z,C){var D=n[0],G=n[1],K=n[2],M=n[3],O=D+D,R=G+G,T=K+K;n=D*O;var Y=D*R,X=D*T;D=G*R;G*=T;var fa=K*T;K=M*O;R*=M;var ha=M*T,ba=z[0],qa=z[1];T=z[2];z=C[0];M=C[1];C=C[2];O=(1-(D+fa))*ba;var ka=(Y+ha)*ba;ba*=X-R;Y=(Y-ha)*qa;fa=(1-(n+fa))*qa;qa*=G+K;X=(X+R)*T;G=(G-K)*T;n=(1-(n+D))*T;k[0]=O;k[1]=ka;k[2]=ba;k[3]=0;k[4]=Y;k[5]=fa;k[6]=qa;k[7]=0;k[8]=X;k[9]=G;k[10]=n;k[11]=0;k[12]=v[0]+z-(O*z+Y*M+X*C);k[13]=v[1]+M-(ka*z+fa*M+G*C);k[14]=v[2]+C-(ba*z+
qa*M+n*C);k[15]=1;return k},fromQuat:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=v+v,G=z+z,K=C+C;v*=D;var M=z*D;z*=G;var O=C*D,R=C*G;C*=K;D*=n;G*=n;n*=K;k[0]=1-z-C;k[1]=M+n;k[2]=O-G;k[3]=0;k[4]=M-n;k[5]=1-v-C;k[6]=R+D;k[7]=0;k[8]=O+G;k[9]=R-D;k[10]=1-v-z;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},frustum:function(k,n,v,z,C,D,G){var K=1/(v-n),M=1/(C-z),O=1/(D-G);k[0]=2*D*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2*D*M;k[6]=0;k[7]=0;k[8]=(v+n)*K;k[9]=(C+z)*M;k[10]=(G+D)*O;k[11]=-1;k[12]=0;k[13]=
0;k[14]=G*D*2*O;k[15]=0;return k},perspectiveNO:p,perspective:p,perspectiveZO:function(k,n,v,z,C){n=1/Math.tan(n/2);k[0]=n/v;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[11]=-1;k[12]=0;k[13]=0;k[15]=0;null!=C&&Infinity!==C?(v=1/(z-C),k[10]=C*v,k[14]=C*z*v):(k[10]=-1,k[14]=-z);return k},perspectiveFromFieldOfView:function(k,n,v,z){var C=Math.tan(n.upDegrees*Math.PI/180),D=Math.tan(n.downDegrees*Math.PI/180),G=Math.tan(n.leftDegrees*Math.PI/180);n=Math.tan(n.rightDegrees*Math.PI/
180);var K=2/(G+n),M=2/(C+D);k[0]=K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=M;k[6]=0;k[7]=0;k[8]=-((G-n)*K*.5);k[9]=(C-D)*M*.5;k[10]=z/(v-z);k[11]=-1;k[12]=0;k[13]=0;k[14]=z*v/(v-z);k[15]=0;return k},orthoNO:r,ortho:r,orthoZO:function(k,n,v,z,C,D,G){var K=1/(n-v),M=1/(z-C);G=1/(D-G);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=G;k[11]=0;k[12]=(n+v)*K;k[13]=(C+z)*M;k[14]=D*G;k[15]=1;return k},lookAt:function(k,n,v,z){var C=n[0],D=n[1];n=n[2];var G=z[0];var K=z[1];var M=
z[2];var O=v[0];z=v[1];var R=v[2];if(1E-6>Math.abs(C-O)&&1E-6>Math.abs(D-z)&&1E-6>Math.abs(n-R))return l(k);v=C-O;z=D-z;O=n-R;var T=1/Math.hypot(v,z,O);v*=T;z*=T;O*=T;R=K*O-M*z;M=M*v-G*O;G=G*z-K*v;(T=Math.hypot(R,M,G))?(T=1/T,R*=T,M*=T,G*=T):G=M=R=0;K=z*G-O*M;var Y=O*R-v*G;var X=v*M-z*R;(T=Math.hypot(K,Y,X))?(T=1/T,K*=T,Y*=T,X*=T):X=Y=K=0;k[0]=R;k[1]=K;k[2]=v;k[3]=0;k[4]=M;k[5]=Y;k[6]=z;k[7]=0;k[8]=G;k[9]=X;k[10]=O;k[11]=0;k[12]=-(R*C+M*D+G*n);k[13]=-(K*C+Y*D+X*n);k[14]=-(v*C+z*D+O*n);k[15]=1;return k},
targetTo:function(k,n,v,z){var C=n[0],D=n[1];n=n[2];var G=z[0],K=z[1],M=z[2];z=C-v[0];var O=D-v[1];v=n-v[2];var R=z*z+O*O+v*v;0<R&&(R=1/Math.sqrt(R),z*=R,O*=R,v*=R);var T=K*v-M*O;M=M*z-G*v;G=G*O-K*z;R=T*T+M*M+G*G;0<R&&(R=1/Math.sqrt(R),T*=R,M*=R,G*=R);k[0]=T;k[1]=M;k[2]=G;k[3]=0;k[4]=O*G-v*M;k[5]=v*T-z*G;k[6]=z*M-O*T;k[7]=0;k[8]=z;k[9]=O;k[10]=v;k[11]=0;k[12]=C;k[13]=D;k[14]=n;k[15]=1;return k},str:function(k){return"mat4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+
", "+k[8]+", "+k[9]+", "+k[10]+", "+k[11]+", "+k[12]+", "+k[13]+", "+k[14]+", "+k[15]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15])},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];k[6]=n[6]+v[6];k[7]=n[7]+v[7];k[8]=n[8]+v[8];k[9]=n[9]+v[9];k[10]=n[10]+v[10];k[11]=n[11]+v[11];k[12]=n[12]+v[12];k[13]=n[13]+v[13];k[14]=n[14]+v[14];k[15]=n[15]+v[15];return k},
subtract:x,multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;k[6]=n[6]*v;k[7]=n[7]*v;k[8]=n[8]*v;k[9]=n[9]*v;k[10]=n[10]*v;k[11]=n[11]*v;k[12]=n[12]*v;k[13]=n[13]*v;k[14]=n[14]*v;k[15]=n[15]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;k[4]=n[4]+v[4]*z;k[5]=n[5]+v[5]*z;k[6]=n[6]+v[6]*z;k[7]=n[7]+v[7]*z;k[8]=n[8]+v[8]*z;k[9]=n[9]+v[9]*z;k[10]=n[10]+v[10]*z;k[11]=n[11]+v[11]*
z;k[12]=n[12]+v[12]*z;k[13]=n[13]+v[13]*z;k[14]=n[14]+v[14]*z;k[15]=n[15]+v[15]*z;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]&&k[8]===n[8]&&k[9]===n[9]&&k[10]===n[10]&&k[11]===n[11]&&k[12]===n[12]&&k[13]===n[13]&&k[14]===n[14]&&k[15]===n[15]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],D=k[3],G=k[4],K=k[5],M=k[6],O=k[7],R=k[8],T=k[9],Y=k[10],X=k[11],fa=k[12],ha=k[13],ba=k[14];k=k[15];var qa=n[0],
ka=n[1],ta=n[2],ua=n[3],ra=n[4],za=n[5],Aa=n[6],Ba=n[7],Ca=n[8],Ja=n[9],Pa=n[10],Qa=n[11],Da=n[12],Bb=n[13],Cb=n[14];n=n[15];return Math.abs(v-qa)<=1E-6*Math.max(1,Math.abs(v),Math.abs(qa))&&Math.abs(z-ka)<=1E-6*Math.max(1,Math.abs(z),Math.abs(ka))&&Math.abs(C-ta)<=1E-6*Math.max(1,Math.abs(C),Math.abs(ta))&&Math.abs(D-ua)<=1E-6*Math.max(1,Math.abs(D),Math.abs(ua))&&Math.abs(G-ra)<=1E-6*Math.max(1,Math.abs(G),Math.abs(ra))&&Math.abs(K-za)<=1E-6*Math.max(1,Math.abs(K),Math.abs(za))&&Math.abs(M-Aa)<=
1E-6*Math.max(1,Math.abs(M),Math.abs(Aa))&&Math.abs(O-Ba)<=1E-6*Math.max(1,Math.abs(O),Math.abs(Ba))&&Math.abs(R-Ca)<=1E-6*Math.max(1,Math.abs(R),Math.abs(Ca))&&Math.abs(T-Ja)<=1E-6*Math.max(1,Math.abs(T),Math.abs(Ja))&&Math.abs(Y-Pa)<=1E-6*Math.max(1,Math.abs(Y),Math.abs(Pa))&&Math.abs(X-Qa)<=1E-6*Math.max(1,Math.abs(X),Math.abs(Qa))&&Math.abs(fa-Da)<=1E-6*Math.max(1,Math.abs(fa),Math.abs(Da))&&Math.abs(ha-Bb)<=1E-6*Math.max(1,Math.abs(ha),Math.abs(Bb))&&Math.abs(ba-Cb)<=1E-6*Math.max(1,Math.abs(ba),
Math.abs(Cb))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:m,sub:x}),kb=function(){var k=y();return function(n,v,z,C,D,G){v||(v=3);z||(z=0);for(C=C?Math.min(C*v+z,n.length):n.length;z<C;z+=v)k[0]=n[z],k[1]=n[z+1],k[2]=n[z+2],D(k,k,G),n[z]=k[0],n[z+1]=k[1],n[z+2]=k[2];return n}}();kb=Object.freeze({__proto__:null,create:y,clone:function(k){var n=new sa(3);n[0]=k[0];n[1]=k[1];n[2]=k[2];return n},length:E,fromValues:H,copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];return k},set:function(k,
n,v,z){k[0]=n;k[1]=v;k[2]=z;return k},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];return k},subtract:A,multiply:F,divide:J,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);k[2]=Math.ceil(n[2]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);k[2]=Math.floor(n[2]);return k},min:function(k,n,v){k[0]=Math.min(n[0],v[0]);k[1]=Math.min(n[1],v[1]);k[2]=Math.min(n[2],v[2]);return k},max:function(k,n,v){k[0]=Math.max(n[0],v[0]);k[1]=Math.max(n[1],
v[1]);k[2]=Math.max(n[2],v[2]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);k[2]=Math.round(n[2]);return k},scale:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;return k},scaleAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;return k},distance:B,squaredDistance:I,squaredLength:L,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];k[2]=1/n[2];return k},normalize:P,dot:S,cross:U,lerp:function(k,
n,v,z){var C=n[0],D=n[1];n=n[2];k[0]=C+z*(v[0]-C);k[1]=D+z*(v[1]-D);k[2]=n+z*(v[2]-n);return k},slerp:function(k,n,v,z){var C=Math.acos(Math.min(Math.max(S(n,v),-1),1)),D=Math.sin(C),G=Math.sin((1-z)*C)/D;z=Math.sin(z*C)/D;k[0]=G*n[0]+z*v[0];k[1]=G*n[1]+z*v[1];k[2]=G*n[2]+z*v[2];return k},hermite:function(k,n,v,z,C,D){var G=D*D,K=G*(2*D-3)+1,M=G*(D-2)+D,O=G*(D-1);D=G*(3-2*D);k[0]=n[0]*K+v[0]*M+z[0]*O+C[0]*D;k[1]=n[1]*K+v[1]*M+z[1]*O+C[1]*D;k[2]=n[2]*K+v[2]*M+z[2]*O+C[2]*D;return k},bezier:function(k,
n,v,z,C,D){var G=1-D,K=G*G,M=D*D,O=K*G;K*=3*D;G*=3*M;D*=M;k[0]=n[0]*O+v[0]*K+z[0]*G+C[0]*D;k[1]=n[1]*O+v[1]*K+z[1]*G+C[1]*D;k[2]=n[2]*O+v[2]*K+z[2]*G+C[2]*D;return k},random:function(k,n){n=n||1;var v=2*Sa()*Math.PI,z=2*Sa()-1,C=Math.sqrt(1-z*z)*n;k[0]=Math.cos(v)*C;k[1]=Math.sin(v)*C;k[2]=z*n;return k},transformMat4:function(k,n,v){var z=n[0],C=n[1];n=n[2];var D=v[3]*z+v[7]*C+v[11]*n+v[15];D=D||1;k[0]=(v[0]*z+v[4]*C+v[8]*n+v[12])/D;k[1]=(v[1]*z+v[5]*C+v[9]*n+v[13])/D;k[2]=(v[2]*z+v[6]*C+v[10]*n+
v[14])/D;return k},transformMat3:function(k,n,v){var z=n[0],C=n[1];n=n[2];k[0]=z*v[0]+C*v[3]+n*v[6];k[1]=z*v[1]+C*v[4]+n*v[7];k[2]=z*v[2]+C*v[5]+n*v[8];return k},transformQuat:function(k,n,v){var z=v[0],C=v[1],D=v[2],G=n[0],K=n[1];n=n[2];var M=C*n-D*K,O=D*G-z*n,R=z*K-C*G;v=2*v[3];k[0]=G+M*v+2*(C*R-D*O);k[1]=K+O*v+2*(D*M-z*R);k[2]=n+R*v+2*(z*O-C*M);return k},rotateX:function(k,n,v,z){var C=[],D=[];C[0]=n[0]-v[0];C[1]=n[1]-v[1];C[2]=n[2]-v[2];D[0]=C[0];D[1]=C[1]*Math.cos(z)-C[2]*Math.sin(z);D[2]=C[1]*
Math.sin(z)+C[2]*Math.cos(z);k[0]=D[0]+v[0];k[1]=D[1]+v[1];k[2]=D[2]+v[2];return k},rotateY:function(k,n,v,z){var C=[],D=[];C[0]=n[0]-v[0];C[1]=n[1]-v[1];C[2]=n[2]-v[2];D[0]=C[2]*Math.sin(z)+C[0]*Math.cos(z);D[1]=C[1];D[2]=C[2]*Math.cos(z)-C[0]*Math.sin(z);k[0]=D[0]+v[0];k[1]=D[1]+v[1];k[2]=D[2]+v[2];return k},rotateZ:function(k,n,v,z){var C=[],D=[];C[0]=n[0]-v[0];C[1]=n[1]-v[1];C[2]=n[2]-v[2];D[0]=C[0]*Math.cos(z)-C[1]*Math.sin(z);D[1]=C[0]*Math.sin(z)+C[1]*Math.cos(z);D[2]=C[2];k[0]=D[0]+v[0];k[1]=
D[1]+v[1];k[2]=D[2]+v[2];return k},angle:function(k,n){var v=k[0],z=k[1],C=k[2],D=n[0],G=n[1],K=n[2];k=(v=Math.sqrt((v*v+z*z+C*C)*(D*D+G*G+K*K)))&&S(k,n)/v;return Math.acos(Math.min(Math.max(k,-1),1))},zero:function(k){k[0]=0;k[1]=0;k[2]=0;return k},str:function(k){return"vec3("+k[0]+", "+k[1]+", "+k[2]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]},equals:function(k,n){var v=k[0],z=k[1];k=k[2];var C=n[0],D=n[1];n=n[2];return Math.abs(v-C)<=1E-6*Math.max(1,Math.abs(v),
Math.abs(C))&&Math.abs(z-D)<=1E-6*Math.max(1,Math.abs(z),Math.abs(D))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},sub:A,mul:F,div:J,dist:B,sqrDist:I,len:E,sqrLen:L,forEach:kb});var lb=function(){var k=V();return function(n,v,z,C,D,G){v||(v=4);z||(z=0);for(C=C?Math.min(C*v+z,n.length):n.length;z<C;z+=v)k[0]=n[z],k[1]=n[z+1],k[2]=n[z+2],k[3]=n[z+3],D(k,k,G),n[z]=k[0],n[z+1]=k[1],n[z+2]=k[2],n[z+3]=k[3];return n}}();lb=Object.freeze({__proto__:null,create:V,clone:Z,fromValues:ma,copy:va,
set:Na,add:Ea,subtract:Ia,multiply:Ma,divide:Fa,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);k[2]=Math.ceil(n[2]);k[3]=Math.ceil(n[3]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);k[2]=Math.floor(n[2]);k[3]=Math.floor(n[3]);return k},min:function(k,n,v){k[0]=Math.min(n[0],v[0]);k[1]=Math.min(n[1],v[1]);k[2]=Math.min(n[2],v[2]);k[3]=Math.min(n[3],v[3]);return k},max:function(k,n,v){k[0]=Math.max(n[0],v[0]);k[1]=Math.max(n[1],v[1]);k[2]=Math.max(n[2],v[2]);
k[3]=Math.max(n[3],v[3]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);k[2]=Math.round(n[2]);k[3]=Math.round(n[3]);return k},scale:ya,scaleAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;return k},distance:na,squaredDistance:Va,length:xa,squaredLength:Ga,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=-n[3];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];k[2]=1/n[2];k[3]=1/n[3];return k},normalize:bb,dot:Xa,
cross:function(k,n,v,z){var C=v[0]*z[1]-v[1]*z[0],D=v[0]*z[2]-v[2]*z[0],G=v[0]*z[3]-v[3]*z[0],K=v[1]*z[2]-v[2]*z[1],M=v[1]*z[3]-v[3]*z[1];v=v[2]*z[3]-v[3]*z[2];z=n[0];var O=n[1],R=n[2];n=n[3];k[0]=O*v-R*M+n*K;k[1]=-(z*v)+R*G-n*D;k[2]=z*M-O*G+n*C;k[3]=-(z*K)+O*D-R*C;return k},lerp:ob,random:function(k,n){n=n||1;do{var v=2*Sa()-1;var z=2*Sa()-1;var C=v*v+z*z}while(1<=C);do{var D=2*Sa()-1;var G=2*Sa()-1;var K=D*D+G*G}while(1<=K);C=Math.sqrt((1-C)/K);k[0]=n*v;k[1]=n*z;k[2]=n*D*C;k[3]=n*G*C;return k},
transformMat4:function(k,n,v){var z=n[0],C=n[1],D=n[2];n=n[3];k[0]=v[0]*z+v[4]*C+v[8]*D+v[12]*n;k[1]=v[1]*z+v[5]*C+v[9]*D+v[13]*n;k[2]=v[2]*z+v[6]*C+v[10]*D+v[14]*n;k[3]=v[3]*z+v[7]*C+v[11]*D+v[15]*n;return k},transformQuat:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=v[0],K=v[1],M=v[2];v=v[3];var O=v*z+K*D-M*C,R=v*C+M*z-G*D,T=v*D+G*C-K*z;z=-G*z-K*C-M*D;k[0]=O*v+z*-G+R*-M-T*-K;k[1]=R*v+z*-K+T*-G-O*-M;k[2]=T*v+z*-M+O*-K-R*-G;k[3]=n[3];return k},zero:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=0;return k},
str:function(k){return"vec4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},exactEquals:pb,equals:function(k,n){var v=k[0],z=k[1],C=k[2];k=k[3];var D=n[0],G=n[1],K=n[2];n=n[3];return Math.abs(v-D)<=1E-6*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(z-G)<=1E-6*Math.max(1,Math.abs(z),Math.abs(G))&&Math.abs(C-K)<=1E-6*Math.max(1,Math.abs(C),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},sub:Ia,mul:Ma,div:Fa,dist:na,sqrDist:Va,len:xa,sqrLen:Ga,forEach:lb});var mb=function(){var k=y(),
n=H(1,0,0),v=H(0,1,0);return function(z,C,D){var G=S(C,D);if(-.999999>G)return U(k,n,C),1E-6>E(k)&&U(k,v,C),P(k,k),qb(z,k,Math.PI),z;if(.999999<G)return z[0]=0,z[1]=0,z[2]=0,z[3]=1,z;U(k,C,D);z[0]=k[0];z[1]=k[1];z[2]=k[2];z[3]=1+G;return bb(z,z)}}(),nb=function(){var k=cb(),n=cb();return function(v,z,C,D,G,K){db(k,z,G,K);db(n,C,D,K);db(v,k,n,2*K*(1-K));return v}}(),$a=function(){var k=e();return function(n,v,z,C){k[0]=z[0];k[3]=z[1];k[6]=z[2];k[1]=C[0];k[4]=C[1];k[7]=C[2];k[2]=-v[0];k[5]=-v[1];k[8]=
-v[2];return bb(n,xb(n,k))}}();mb=Object.freeze({__proto__:null,create:cb,identity:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=1;return k},setAxisAngle:qb,getAxisAngle:function(k,n){var v=2*Math.acos(n[3]),z=Math.sin(v/2);1E-6<z?(k[0]=n[0]/z,k[1]=n[1]/z,k[2]=n[2]/z):(k[0]=1,k[1]=0,k[2]=0);return v},getAngle:function(k,n){k=Xa(k,n);return Math.acos(2*k*k-1)},multiply:rb,rotateX:sb,rotateY:tb,rotateZ:ub,calculateW:function(k,n){var v=n[0],z=n[1];n=n[2];k[0]=v;k[1]=z;k[2]=n;k[3]=Math.sqrt(Math.abs(1-v*v-z*
z-n*n));return k},exp:vb,ln:wb,pow:function(k,n,v){wb(k,n);ya(k,k,v);vb(k,k);return k},slerp:db,random:function(k){var n=Sa(),v=Sa(),z=Sa(),C=Math.sqrt(1-n);n=Math.sqrt(n);k[0]=C*Math.sin(2*Math.PI*v);k[1]=C*Math.cos(2*Math.PI*v);k[2]=n*Math.sin(2*Math.PI*z);k[3]=n*Math.cos(2*Math.PI*z);return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var D=v*v+z*z+C*C+n*n;D=D?1/D:0;k[0]=-v*D;k[1]=-z*D;k[2]=-C*D;k[3]=n*D;return k},conjugate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];return k},
fromMat3:xb,fromEuler:function(k,n,v,z){var C=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"zyx",D=Math.PI/360;n*=D;z*=D;v*=D;D=Math.sin(n);var G=Math.cos(n),K=Math.sin(v),M=Math.cos(v),O=Math.sin(z),R=Math.cos(z);switch(C){case "xyz":k[0]=D*M*R+G*K*O;k[1]=G*K*R-D*M*O;k[2]=G*M*O+D*K*R;k[3]=G*M*R-D*K*O;break;case "xzy":k[0]=D*M*R-G*K*O;k[1]=G*K*R-D*M*O;k[2]=G*M*O+D*K*R;k[3]=G*M*R+D*K*O;break;case "yxz":k[0]=D*M*R+G*K*O;k[1]=G*K*R-D*M*O;k[2]=G*M*O-D*K*R;k[3]=G*M*R+D*K*O;break;case "yzx":k[0]=
D*M*R+G*K*O;k[1]=G*K*R+D*M*O;k[2]=G*M*O-D*K*R;k[3]=G*M*R-D*K*O;break;case "zxy":k[0]=D*M*R-G*K*O;k[1]=G*K*R+D*M*O;k[2]=G*M*O+D*K*R;k[3]=G*M*R-D*K*O;break;case "zyx":k[0]=D*M*R-G*K*O;k[1]=G*K*R+D*M*O;k[2]=G*M*O-D*K*R;k[3]=G*M*R+D*K*O;break;default:throw Error("Unknown angle order "+C);}return k},str:function(k){return"quat("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},clone:Z,fromValues:ma,copy:va,set:Na,add:Ea,mul:rb,scale:ya,dot:Xa,lerp:ob,length:xa,len:xa,squaredLength:Ga,sqrLen:Ga,normalize:bb,exactEquals:pb,
equals:function(k,n){return.999999<=Math.abs(Xa(k,n))},rotationTo:mb,sqlerp:nb,setAxes:$a});nb=Object.freeze({__proto__:null,create:function(){var k=new sa(8);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[4]=0,k[5]=0,k[6]=0,k[7]=0);k[3]=1;return k},clone:function(k){var n=new sa(8);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];return n},fromValues:function(k,n,v,z,C,D,G,K){var M=new sa(8);M[0]=k;M[1]=n;M[2]=v;M[3]=z;M[4]=C;M[5]=D;M[6]=G;M[7]=K;return M},fromRotationTranslationValues:function(k,
n,v,z,C,D,G){var K=new sa(8);K[0]=k;K[1]=n;K[2]=v;K[3]=z;C*=.5;D*=.5;G*=.5;K[4]=C*z+D*v-G*n;K[5]=D*z+G*k-C*v;K[6]=G*z+C*n-D*k;K[7]=-C*k-D*n-G*v;return K},fromRotationTranslation:yb,fromTranslation:function(k,n){k[0]=0;k[1]=0;k[2]=0;k[3]=1;k[4]=.5*n[0];k[5]=.5*n[1];k[6]=.5*n[2];k[7]=0;return k},fromRotation:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},fromMat4:function(k,n){var v=cb();t(v,n);var z=new sa(3);w(z,n);yb(k,v,z);return k},copy:zb,identity:function(k){k[0]=
0;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},set:function(k,n,v,z,C,D,G,K,M){k[0]=n;k[1]=v;k[2]=z;k[3]=C;k[4]=D;k[5]=G;k[6]=K;k[7]=M;return k},getReal:va,getDual:function(k,n){k[0]=n[4];k[1]=n[5];k[2]=n[6];k[3]=n[7];return k},setReal:va,setDual:function(k,n){k[4]=n[0];k[5]=n[1];k[6]=n[2];k[7]=n[3];return k},getTranslation:function(k,n){var v=n[4],z=n[5],C=n[6],D=n[7],G=-n[0],K=-n[1],M=-n[2];n=n[3];k[0]=2*(v*n+D*G+z*M-C*K);k[1]=2*(z*n+D*K+C*G-v*M);k[2]=2*(C*n+D*M+v*K-z*G);return k},
translate:function(k,n,v){var z=n[0],C=n[1],D=n[2],G=n[3],K=.5*v[0],M=.5*v[1];v=.5*v[2];var O=n[4],R=n[5],T=n[6];n=n[7];k[0]=z;k[1]=C;k[2]=D;k[3]=G;k[4]=G*K+C*v-D*M+O;k[5]=G*M+D*K-z*v+R;k[6]=G*v+z*M-C*K+T;k[7]=-z*K-C*M-D*v+n;return k},rotateX:function(k,n,v){var z=-n[0],C=-n[1],D=-n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*G+R*z+M*D-O*C,Y=M*G+R*C+O*z-K*D,X=O*G+R*D+K*C-M*z;K=R*G-K*z-M*C-O*D;sb(k,n,v);z=k[0];C=k[1];D=k[2];G=k[3];k[4]=T*G+K*z+Y*D-X*C;k[5]=Y*G+K*C+X*z-T*D;k[6]=X*G+K*D+T*C-Y*z;k[7]=K*
G-T*z-Y*C-X*D;return k},rotateY:function(k,n,v){var z=-n[0],C=-n[1],D=-n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*G+R*z+M*D-O*C,Y=M*G+R*C+O*z-K*D,X=O*G+R*D+K*C-M*z;K=R*G-K*z-M*C-O*D;tb(k,n,v);z=k[0];C=k[1];D=k[2];G=k[3];k[4]=T*G+K*z+Y*D-X*C;k[5]=Y*G+K*C+X*z-T*D;k[6]=X*G+K*D+T*C-Y*z;k[7]=K*G-T*z-Y*C-X*D;return k},rotateZ:function(k,n,v){var z=-n[0],C=-n[1],D=-n[2],G=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*G+R*z+M*D-O*C,Y=M*G+R*C+O*z-K*D,X=O*G+R*D+K*C-M*z;K=R*G-K*z-M*C-O*D;ub(k,n,v);z=k[0];C=k[1];D=k[2];
G=k[3];k[4]=T*G+K*z+Y*D-X*C;k[5]=Y*G+K*C+X*z-T*D;k[6]=X*G+K*D+T*C-Y*z;k[7]=K*G-T*z-Y*C-X*D;return k},rotateByQuatAppend:function(k,n,v){var z=v[0],C=v[1],D=v[2];v=v[3];var G=n[0],K=n[1],M=n[2],O=n[3];k[0]=G*v+O*z+K*D-M*C;k[1]=K*v+O*C+M*z-G*D;k[2]=M*v+O*D+G*C-K*z;k[3]=O*v-G*z-K*C-M*D;G=n[4];K=n[5];M=n[6];O=n[7];k[4]=G*v+O*z+K*D-M*C;k[5]=K*v+O*C+M*z-G*D;k[6]=M*v+O*D+G*C-K*z;k[7]=O*v-G*z-K*C-M*D;return k},rotateByQuatPrepend:function(k,n,v){var z=n[0],C=n[1],D=n[2];n=n[3];var G=v[0],K=v[1],M=v[2],O=
v[3];k[0]=z*O+n*G+C*M-D*K;k[1]=C*O+n*K+D*G-z*M;k[2]=D*O+n*M+z*K-C*G;k[3]=n*O-z*G-C*K-D*M;G=v[4];K=v[5];M=v[6];O=v[7];k[4]=z*O+n*G+C*M-D*K;k[5]=C*O+n*K+D*G-z*M;k[6]=D*O+n*M+z*K-C*G;k[7]=n*O-z*G-C*K-D*M;return k},rotateAroundAxis:function(k,n,v,z){if(1E-6>Math.abs(z))return zb(k,n);var C=Math.hypot(v[0],v[1],v[2]);z*=.5;var D=Math.sin(z),G=D*v[0]/C,K=D*v[1]/C;v=D*v[2]/C;z=Math.cos(z);C=n[0];D=n[1];var M=n[2],O=n[3];k[0]=C*z+O*G+D*v-M*K;k[1]=D*z+O*K+M*G-C*v;k[2]=M*z+O*v+C*K-D*G;k[3]=O*z-C*G-D*K-M*v;
C=n[4];D=n[5];M=n[6];n=n[7];k[4]=C*z+n*G+D*v-M*K;k[5]=D*z+n*K+M*G-C*v;k[6]=M*z+n*v+C*K-D*G;k[7]=n*z-C*G-D*K-M*v;return k},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];k[6]=n[6]+v[6];k[7]=n[7]+v[7];return k},multiply:eb,mul:eb,scale:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;k[6]=n[6]*v;k[7]=n[7]*v;return k},dot:Xa,lerp:function(k,n,v,z){var C=1-z;0>Xa(n,v)&&(z=-z);k[0]=n[0]*C+v[0]*z;k[1]=
n[1]*C+v[1]*z;k[2]=n[2]*C+v[2]*z;k[3]=n[3]*C+v[3]*z;k[4]=n[4]*C+v[4]*z;k[5]=n[5]*C+v[5]*z;k[6]=n[6]*C+v[6]*z;k[7]=n[7]*C+v[7]*z;return k},invert:function(k,n){var v=Ga(n);k[0]=-n[0]/v;k[1]=-n[1]/v;k[2]=-n[2]/v;k[3]=n[3]/v;k[4]=-n[4]/v;k[5]=-n[5]/v;k[6]=-n[6]/v;k[7]=n[7]/v;return k},conjugate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];k[4]=-n[4];k[5]=-n[5];k[6]=-n[6];k[7]=n[7];return k},length:xa,len:xa,squaredLength:Ga,sqrLen:Ga,normalize:function(k,n){var v=Ga(n);if(0<v){v=Math.sqrt(v);
var z=n[0]/v,C=n[1]/v,D=n[2]/v,G=n[3]/v,K=n[4],M=n[5],O=n[6];n=n[7];var R=z*K+C*M+D*O+G*n;k[0]=z;k[1]=C;k[2]=D;k[3]=G;k[4]=(K-z*R)/v;k[5]=(M-C*R)/v;k[6]=(O-D*R)/v;k[7]=(n-G*R)/v}return k},str:function(k){return"quat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],D=k[3],G=k[4],K=k[5],
M=k[6];k=k[7];var O=n[0],R=n[1],T=n[2],Y=n[3],X=n[4],fa=n[5],ha=n[6];n=n[7];return Math.abs(v-O)<=1E-6*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(z-R)<=1E-6*Math.max(1,Math.abs(z),Math.abs(R))&&Math.abs(C-T)<=1E-6*Math.max(1,Math.abs(C),Math.abs(T))&&Math.abs(D-Y)<=1E-6*Math.max(1,Math.abs(D),Math.abs(Y))&&Math.abs(G-X)<=1E-6*Math.max(1,Math.abs(G),Math.abs(X))&&Math.abs(K-fa)<=1E-6*Math.max(1,Math.abs(K),Math.abs(fa))&&Math.abs(M-ha)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ha))&&Math.abs(k-n)<=
1E-6*Math.max(1,Math.abs(k),Math.abs(n))}});$a=function(){var k=Wa();return function(n,v,z,C,D,G){v||(v=2);z||(z=0);for(C=C?Math.min(C*v+z,n.length):n.length;z<C;z+=v)k[0]=n[z],k[1]=n[z+1],D(k,k,G),n[z]=k[0],n[z+1]=k[1];return n}}();$a=Object.freeze({__proto__:null,create:Wa,clone:function(k){var n=new sa(2);n[0]=k[0];n[1]=k[1];return n},fromValues:function(k,n){var v=new sa(2);v[0]=k;v[1]=n;return v},copy:function(k,n){k[0]=n[0];k[1]=n[1];return k},set:function(k,n,v){k[0]=n;k[1]=v;return k},add:function(k,
n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];return k},subtract:fb,multiply:gb,divide:Ya,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);return k},min:function(k,n,v){k[0]=Math.min(n[0],v[0]);k[1]=Math.min(n[1],v[1]);return k},max:function(k,n,v){k[0]=Math.max(n[0],v[0]);k[1]=Math.max(n[1],v[1]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);return k},scale:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*
v;return k},scaleAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;return k},distance:hb,squaredDistance:Ta,length:ib,squaredLength:jb,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];return k},normalize:function(k,n){var v=n[0],z=n[1];v=v*v+z*z;0<v&&(v=1/Math.sqrt(v));k[0]=n[0]*v;k[1]=n[1]*v;return k},dot:function(k,n){return k[0]*n[0]+k[1]*n[1]},cross:function(k,n,v){n=n[0]*v[1]-n[1]*v[0];k[0]=k[1]=0;k[2]=n;return k},lerp:function(k,n,v,
z){var C=n[0];n=n[1];k[0]=C+z*(v[0]-C);k[1]=n+z*(v[1]-n);return k},random:function(k,n){n=n||1;var v=2*Sa()*Math.PI;k[0]=Math.cos(v)*n;k[1]=Math.sin(v)*n;return k},transformMat2:function(k,n,v){var z=n[0];n=n[1];k[0]=v[0]*z+v[2]*n;k[1]=v[1]*z+v[3]*n;return k},transformMat2d:function(k,n,v){var z=n[0];n=n[1];k[0]=v[0]*z+v[2]*n+v[4];k[1]=v[1]*z+v[3]*n+v[5];return k},transformMat3:function(k,n,v){var z=n[0];n=n[1];k[0]=v[0]*z+v[3]*n+v[6];k[1]=v[1]*z+v[4]*n+v[7];return k},transformMat4:function(k,n,v){var z=
n[0];n=n[1];k[0]=v[0]*z+v[4]*n+v[12];k[1]=v[1]*z+v[5]*n+v[13];return k},rotate:function(k,n,v,z){var C=n[0]-v[0];n=n[1]-v[1];var D=Math.sin(z);z=Math.cos(z);k[0]=C*z-n*D+v[0];k[1]=C*D+n*z+v[1];return k},angle:function(k,n){var v=k[0];k=k[1];var z=n[0];n=n[1];var C=Math.sqrt((v*v+k*k)*(z*z+n*n));return Math.acos(Math.min(Math.max(C&&(v*z+k*n)/C,-1),1))},zero:function(k){k[0]=0;k[1]=0;return k},str:function(k){return"vec2("+k[0]+", "+k[1]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]},
equals:function(k,n){var v=k[0];k=k[1];var z=n[0];n=n[1];return Math.abs(v-z)<=1E-6*Math.max(1,Math.abs(v),Math.abs(z))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},len:ib,sub:fb,mul:gb,div:Ya,dist:hb,sqrDist:Ta,sqrLen:jb,forEach:$a});f.glMatrix=Db;f.mat2=Eb;f.mat2d=Fb;f.mat3=Gb;f.mat4=Hb;f.quat=mb;f.quat2=nb;f.vec2=$a;f.vec3=kb;f.vec4=lb;Object.defineProperty(f,"__esModule",{value:!0})});
{"use strict";function f(B,I,L){var P=[0,0];var S=B[1][1]-B[0][1];var U=B[0][0]-B[1][0];B=S*B[0][0]+U*B[0][1];var V=I[1][1]-I[0][1];var Z=I[0][0]-I[1][0];I=V*I[0][0]+Z*I[0][1];var ma=S*Z-V*U;F(ma,0,L||0)||(P[0]=(Z*B-U*I)/ma,P[1]=(S*I-V*B)/ma);return P}function b(B,I,L,P){var S=I[0]-B[0];I=I[1]-B[1];var U=P[0]-L[0],V=P[1]-L[1];if(0===U*I-V*S)return!1;P=(S*(L[1]-B[1])+I*(B[0]-L[0]))/(U*I-V*S);B=(U*(B[1]-L[1])+V*(L[0]-B[0]))/(V*S-U*I);return 0<=P&&1>=P&&0<=B&&1>=B}function a(B,I,L){return(I[0]-B[0])*
(L[1]-B[1])-(L[0]-B[0])*(I[1]-B[1])}function c(B,I,L){return 0<a(B,I,L)}function d(B,I,L){return 0<=a(B,I,L)}function e(B,I,L){return 0>a(B,I,L)}function h(B,I,L){return 0>=a(B,I,L)}var tmpPoint1$$module$str$c3runtime=[],tmpPoint2$$module$str$c3runtime=[];function g(B,I,L,P){if(P){var S=tmpPoint1$$module$str$c3runtime,U=tmpPoint2$$module$str$c3runtime;S[0]=I[0]-B[0];S[1]=I[1]-B[1];U[0]=L[0]-I[0];U[1]=L[1]-I[1];return Math.acos((S[0]*U[0]+S[1]*U[1])/(Math.sqrt(S[0]*S[0]+S[1]*S[1])*Math.sqrt(U[0]*U[0]+
U[1]*U[1])))<P}return 0===a(B,I,L)}function l(B,I){var L=I[0]-B[0];B=I[1]-B[1];return L*L+B*B}function m(B,I){var L=B.length;return B[0>I?I%L+L:I%L]}function u(B){B.length=0}function w(B,I,L,P){for(;L<P;L++)B.push(I[L])}function q(B){for(var I=[],L=B.length,P=0;P!==L;P++)I.push(B.pop());for(P=0;P!==L;P++)B[P]=I[P]}function t(B,I){return e(m(B,I-1),m(B,I),m(B,I+1))}var tmpLine1$$module$str$c3runtime=[],tmpLine2$$module$str$c3runtime=[];function p(B,I,L){var P=tmpLine1$$module$str$c3runtime,S=tmpLine2$$module$str$c3runtime;
if(d(m(B,I+1),m(B,I),m(B,L))&&h(m(B,I-1),m(B,I),m(B,L)))return!1;var U=l(m(B,I),m(B,L));for(var V=0;V!==B.length;++V)if((V+1)%B.length!==I&&V!==I&&d(m(B,I),m(B,L),m(B,V+1))&&h(m(B,I),m(B,L),m(B,V))){P[0]=m(B,I);P[1]=m(B,L);S[0]=m(B,V);S[1]=m(B,V+1);var Z=f(P,S);if(l(m(B,I),Z)<U)return!1}return!0}function r(B,I,L){for(var P=0;P!==B.length;++P)if(P!==I&&P!==L&&(P+1)%B.length!==I&&(P+1)%B.length!==L&&b(m(B,I),m(B,L),m(B,P),m(B,P+1)))return!1;return!0}function x(B,I,L,P){P=P||[];u(P);if(I<L)for(var S=
I;S<=L;S++)P.push(B[S]);else{for(S=0;S<=L;S++)P.push(B[S]);for(S=I;S<B.length;S++)P.push(B[S])}return P}function y(B){for(var I=[],L,P,S=[],U=Number.MAX_VALUE,V=0;V<B.length;++V)if(t(B,V))for(var Z=0;Z<B.length;++Z)if(p(B,V,Z)){L=y(x(B,V,Z,S));P=y(x(B,Z,V,S));for(var ma=0;ma<P.length;ma++)L.push(P[ma]);L.length<U&&(I=L,U=L.length,I.push([m(B,V),m(B,Z)]))}return I}function E(B,I){if(0===I.length)return[B];if(I instanceof Array&&I.length&&I[0]instanceof Array&&2===I[0].length&&I[0][0]instanceof Array){B=
[B];for(var L=0;L<I.length;L++)for(var P=I[L],S=0;S<B.length;S++){var U=E(B[S],P);if(U){B.splice(S,1);B.push(U[0],U[1]);break}}return B}P=I;L=B.indexOf(P[0]);S=B.indexOf(P[1]);return-1!==L&&-1!==S?[x(B,L,S),x(B,S,L)]:!1}function H(B,I,L,P,S){var U=I[1]-B[1];I=B[0]-I[0];B=U*B[0]+I*B[1];var V=P[1]-L[1];P=L[0]-P[0];L=V*L[0]+P*L[1];var Z=U*P-V*I;return F(Z,0,S||0)?[0,0]:[(P*B-I*L)/Z,(U*L-V*B)/Z]}function A(B,I,L,P,S,U,V){U=U||100;V=V||0;S=S||25;I="undefined"!==typeof I?I:[];L=L||[];P=P||[];var Z=[0,0],
ma=[0,0],va=[0,0],Na,Ea=0,Ia=0,Ma=0,Fa=[],ya=[];if(3>B.length)return I;V++;if(V>U)return console.warn("quickDecomp: max level ("+U+") reached."),I;for(var na=0;na<B.length;++na)if(t(B,na)){L.push(B[na]);var Va=Na=Number.MAX_VALUE;for(var xa=0;xa<B.length;++xa){if(c(m(B,na-1),m(B,na),m(B,xa))&&h(m(B,na-1),m(B,na),m(B,xa-1))&&(va=H(m(B,na-1),m(B,na),m(B,xa),m(B,xa-1)),e(m(B,na+1),m(B,na),va))){var Ga=l(B[na],va);Ga<Na&&(Na=Ga,ma=va,Ia=xa)}c(m(B,na+1),m(B,na),m(B,xa+1))&&h(m(B,na+1),m(B,na),m(B,xa))&&
(va=H(m(B,na+1),m(B,na),m(B,xa),m(B,xa+1)),c(m(B,na-1),m(B,na),va)&&(Ga=l(B[na],va),Ga<Va&&(Va=Ga,Z=va,Ea=xa)))}if(Ia===(Ea+1)%B.length)va[0]=(ma[0]+Z[0])/2,va[1]=(ma[1]+Z[1])/2,P.push(va),na<Ea?(w(Fa,B,na,Ea+1),Fa.push(va),ya.push(va),0!==Ia&&w(ya,B,Ia,B.length),w(ya,B,0,na+1)):(0!==na&&w(Fa,B,na,B.length),w(Fa,B,0,Ea+1),Fa.push(va),ya.push(va),w(ya,B,Ia,na+1));else{Ia>Ea&&(Ea+=B.length);Z=Number.MAX_VALUE;if(Ea<Ia)return I;for(xa=Ia;xa<=Ea;++xa)d(m(B,na-1),m(B,na),m(B,xa))&&h(m(B,na+1),m(B,na),
m(B,xa))&&(Ga=l(m(B,na),m(B,xa)),Ga<Z&&r(B,na,xa)&&(Z=Ga,Ma=xa%B.length));na<Ma?(w(Fa,B,na,Ma+1),0!==Ma&&w(ya,B,Ma,B.length),w(ya,B,0,na+1)):(0!==na&&w(Fa,B,na,B.length),w(Fa,B,0,Ma+1),w(ya,B,Ma,na+1))}Fa.length<ya.length?(A(Fa,I,L,P,S,U,V),A(ya,I,L,P,S,U,V)):(A(ya,I,L,P,S,U,V),A(Fa,I,L,P,S,U,V));return I}I.push(B);return I}function F(B,I,L){return Math.abs(B-I)<=(L||0)}function J(B,I,L){return F(B[0],I[0],L)&&F(B[1],I[1],L)}self.polyDecomp={decomp:function(B){var I=y(B);return 0<I.length?E(B,I):
[B]},quickDecomp:A,isSimple:function(B){var I;for(I=0;I<B.length-1;I++)for(var L=0;L<I-1;L++)if(b(B[I],B[I+1],B[L],B[L+1]))return!1;for(I=1;I<B.length-2;I++)if(b(B[0],B[B.length-1],B[I],B[I+1]))return!1;return!0},removeCollinearPoints:function(B,I){for(var L=0,P=B.length-1;3<B.length&&0<=P;--P)g(m(B,P-1),m(B,P),m(B,P+1),I)&&(B.splice(P%B.length,1),L++);return L},removeDuplicatePoints:function(B,I){for(var L=B.length-1;1<=L;--L)for(var P=B[L],S=L-1;0<=S;--S)J(P,B[S],I)&&B.splice(L,1)},makeCCW:function(B){for(var I=
0,L=1;L<B.length;++L)if(B[L][1]<B[I][1]||B[L][1]===B[I][1]&&B[L][0]>B[I][0])I=L;if(c(m(B,I-1),m(B,I),m(B,I+1)))return!1;q(B);return!0}}}
{"use strict";let f=!1,b=!1,a="dev";const c=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(d){a=d}static GetBuildMode(){return a}static IsReleaseBuild(){return"final"===a}};c.isDebug=!1;c.isDebugDefend=!1;c.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}}
{"use strict";const 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("="),c=decodeURIComponent(b.substring(0,a));b=decodeURIComponent(b.substring(a+1));this._parameters.set(c,b)}else this._parameters.set(b,null)}LogAll(){for(const b of this._parameters)console.log("[QueryParser] Parameter '"+
b[0]+"' = "+(null===b[1]?"null":"'"+b[1]+"'"))}Has(b){return this._parameters.has(b)}Get(b){b=this._parameters.get(b);return"undefined"===typeof b?null:b}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(b){this._queryString=b;this._parameters.clear();this._Parse()}};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_2=/windows\s+nt\s+\d+\.\d+/i.exec(b),JSCompiler_object_inline_OSX_3=/mac\s+os\s+x\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_android_4=/android\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_opera_5=/OPR\/[0-9.]+/.exec(b),JSCompiler_object_inline_tizen_6=/tizen\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_iphone_7=/iphone\s+os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_ipad_8=
/ipad[^)]*os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_winPhone_9=/windows\s+phone\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_winPhoneOS_10=/windows\s+phone\s+os\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_chrome_11=/chrome\/[0-9.]+/i.exec(b),JSCompiler_object_inline_chromium_12=/chromium\/[0-9.]+/i.exec(b),JSCompiler_object_inline_nwjs_13=/nwjs\/[0-9.]+/i.exec(b),JSCompiler_object_inline_firefox_14=/firefox\/[0-9.]+/i.exec(b),JSCompiler_object_inline_ie_15=/msie\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_edge_16=
/edge\/[0-9.]+/i.exec(b),JSCompiler_object_inline_edgeChromium_17=/edg\/[0-9.]+/i.exec(b),JSCompiler_object_inline_silk_18=/silk\/[0-9.]+/i.exec(b);let c="(unknown)",d="(unknown)",e="(unknown)",h="(unknown)",g="(unknown)",l="browser",m=!1,u=!1,w=new Map;function q(p,r,x){!0===r?(x(),w.set(p,!0)):r&&r.length&&(x(r[0]),w.set(p,!0))}q("isWindows",JSCompiler_object_inline_windows_2,p=>{c="Windows";if(p=p.split(" ")[2])switch(p){case "5.0":d="2000";break;case "5.1":d="XP";break;case "5.2":d="XP";break;
case "6.0":d="Vista";break;case "6.1":d="7";break;case "6.2":d="8";break;case "6.3":d="8.1";break;case "10.0":d="10"}});q("isOSX",JSCompiler_object_inline_OSX_3,p=>{c="Mac OS X";(p=p.split(" ")[3])&&(d=p.replace("_","."))});q("isLinux",a.linux,()=>{c="Linux"});q("isChromeOS",a.chromeOS,()=>{c="Chrome OS"});q("isAndroid",!a.windowsTizen&&JSCompiler_object_inline_android_4,p=>{c="Android";(p=p.split(" ")[1])&&(d=p)});q("isTizen",JSCompiler_object_inline_tizen_6,p=>{c="Tizen";(p=p.split(" ")[1])&&(d=
p)});q("isIPhone",!a.windowsTizen&&JSCompiler_object_inline_iphone_7,p=>{c="iOS";(p=p.split(" ")[2])&&(d=p.replace("_","."))});q("isIPad",!a.windowsTizen&&JSCompiler_object_inline_ipad_8,p=>{c="iOS";(p=p.split(" ")[3])&&(d=p.replace("_","."))});q("isWindowsPhone",JSCompiler_object_inline_winPhone_9,p=>{c="Windows Phone";(p=p.split(" ")[2])&&(d=p)});q("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_10,p=>{c="Windows Phone";(p=p.split(" ")[3])&&(d=p)});q("isBlackberry",a.blackberry,()=>{c="Blackberry";
d="10";e="stock";g="webkit"});q("isChrome",!a.edge&&!a.opera&&JSCompiler_object_inline_chrome_11,p=>{e="Chrome";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isOpera",JSCompiler_object_inline_opera_5,p=>{e="Opera";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isChromium",JSCompiler_object_inline_chromium_12,p=>{g=e="Chromium";(p=p.split("/")[1])&&(h=p)});q("isFirefox",JSCompiler_object_inline_firefox_14,p=>{e="Firefox";g="Gecko";(p=p.split("/")[1])&&(h=p)});q("isInternetExplorer",JSCompiler_object_inline_ie_15,
p=>{e="Internet Explorer";g="Trident";(p=p.split(" ")[1])&&(h=p)});q("isTrident","Internet Explorer"!==e&&a.trident,()=>{g="Trident";var p=/rv:[0-9.]+/i.exec(b);p&&p.length&&(e="Internet Explorer",(p=p[0].split(":")[1])&&(h=p))});q("isEdge",JSCompiler_object_inline_edge_16,p=>{g=e="Edge";(p=p.split("/")[1])&&(h=p)});q("isEdgeChromium",JSCompiler_object_inline_edgeChromium_17,p=>{e="Edge";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isSafari",a.safari&&!a.nokia&&!a.chrome&&!a.chromium&&!a.genericIE&&
!a.blackberry,()=>{e="Safari";g="WebKit";var p=/version\/[0-9.]+/i.exec(b),r=/crios\/[0-9.]+/i.exec(b),x=/fxios\/[0-9.]+/i.exec(b);p&&p.length&&(p=p[0].split("/")[1])&&(h=p);r&&r.length&&(e="Chrome for iOS",(r=r[0].split("/")[1])&&(h=r));x&&x.length&&(e="Firefox for iOS",(x=x[0].split("/")[1])&&(h=x))});q("isSilk",JSCompiler_object_inline_silk_18,p=>{e="Silk";(p=p.split("/")[1])&&(h=p)});q("isCrosswalk",a.crosswalk,()=>l="crosswalk");q("isCordova",self.device&&(self.device.cordova||self.device.phonegap),
()=>l="cordova");q("isNWJS",JSCompiler_object_inline_nwjs_13,p=>{l="nwjs";e="NW.js";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isAmazonWebApp",a.amazonwebapp,()=>l="webapp");q("isHomeScreenWebApp","nwjs"!==l&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>l="webapp");q("isFalseSafari","Safari"===e&&("Android"===c||"Tizen"===c||"Blackberry"===c),()=>e="stock");q("isAndroidWebview","Chrome"===e&&"browser"===l&&a.webview,
()=>l="webview");q("isFirefoxOS","Firefox"===e&&"(unknown)"===c,()=>c="Firefox OS");q("isAndroidFallback","(unknown)"===c&&!a.windowsTizen&&a.android,()=>c="Android");q("isTridentFallback","(unknown)"===c&&a.trident,()=>g="Trident");q("isWebkitFallback","(unknown)"===c&&a.webkit,()=>g="WebKit");q("isDesktop",(()=>"Windows"===c||"Mac OS X"===c||"Linux"===c||"Chrome OS"===c||"nwjs"===l)(),()=>m=!0);u="nwjs"===l;const t="Mac OS X"===c&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;t&&(c="iOS",
d=h,u=m=!1);f.Platform={OS:c,OSVersion:d,Browser:e,BrowserVersion:h,BrowserVersionNumber:parseFloat(h),BrowserEngine:g,Context:l,IsDesktop:m,IsMobile:!m,IsDesktopApp:u,IsChromeWebStore:!!(self.chrome&&self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===c||"iOS"===c,IsIpadOS:t,IsLinux:"Linux"===c}}"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 c(t){return new Promise((p,r)=>{t.onsuccess=()=>p(t.result);t.onerror=()=>r(t.error)})}function d(t){return new Promise((p,r)=>{t.oncomplete=()=>p();t.onerror=()=>r(t.error);t.onabort=()=>r(t.error)})}function e(t,p){return g(t,p)}function h(t,p){return g(t,p,!0)}async function g(t,p,r=!1,
x=!0){const y=await l(t);try{const E=y.transaction(["keyvaluepairs"],r?"readwrite":"readonly");return p(E)}catch(E){if(x&&"InvalidStateError"===E.name)return f.delete(t),g(t,p,r,!1);throw E;}}function l(t){u(t);let p=f.get(t);p instanceof Promise||(p=m(t),f.set(t,p),p.catch(r=>f.delete(t)));return p}async function m(t){u(t);const p=indexedDB.open(t,2);p.addEventListener("upgradeneeded",r=>{try{r.target.result.createObjectStore("keyvaluepairs")}catch(x){console.error(`Failed to create objectstore for database ${t}`,
x)}});return c(p)}function u(t){if("string"!==typeof t)throw new TypeError("expected string");}function w(t,p){const r=t.objectStore("keyvaluepairs").openCursor();return new Promise(x=>{const y=[];r.onsuccess=E=>{if(E=E.target.result){switch(p){case "entries":y.push([E.key,E.value]);break;case "keys":y.push(E.key);break;case "values":y.push(E.value)}E.continue()}else x(y)}})}class q{constructor(t){u(t);this.name=t}async ready(){await l(this.name)}set(t,p){u(t);return h(this.name,async r=>{var x=r.objectStore("keyvaluepairs").put(p,
t);x=c(x);r=d(r);await Promise.all([r,x])})}get(t){u(t);return e(this.name,async p=>{var r=p.objectStore("keyvaluepairs").get(t);r=c(r);p=d(p);[,p]=await Promise.all([p,r]);return p})}delete(t){u(t);return h(this.name,async p=>{var r=p.objectStore("keyvaluepairs").delete(t);r=c(r);p=d(p);await Promise.all([p,r])})}clear(){return h(this.name,async t=>{var p=t.objectStore("keyvaluepairs").clear();p=c(p);t=d(t);await Promise.all([t,p])})}keys(){return e(this.name,async t=>{if(a){var p=t.objectStore("keyvaluepairs").getAllKeys();
p=c(p)}else p=w(t,"keys");t=d(t);[,t]=await Promise.all([t,p]);return t})}values(){return e(this.name,async t=>{if(b){var p=t.objectStore("keyvaluepairs").getAll();p=c(p)}else p=w(t,"values");t=d(t);[,t]=await Promise.all([t,p]);return t})}entries(){return e(this.name,async t=>{var p=w(t,"entries");t=d(t);[,p]=await Promise.all([t,p]);return p})}}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 c=!1;"undefined"===typeof indexedDB&&(c=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function d(l){throw Error(`"${l}" is not implemented`);
}function e(l){if("function"===typeof l)throw Error("localforage callback API is not implemented; please use the promise API instead");}function h(l){return"object"===typeof l?new Promise(m=>{const {port1:u,port2:w}=new MessageChannel;w.onmessage=q=>m(q.data);u.postMessage(l)}):Promise.resolve(l)}class g{constructor(l){this._inst=l;a.set(this,new Map)}_MaybeSwitchToMemoryFallback(l){if(!c)for(const m of b)if(l&&m.test(l.message)){console.error("Unable to use local storage, reverting to in-memory store: ",
l,l.message);c=!0;break}}async _getItemFallback(l){l=a.get(this).get(l);l=await h(l);return"undefined"===typeof l?null:l}async _setItemFallback(l,m){m=await h(m);a.get(this).set(l,m)}_removeItemFallback(l){a.get(this).delete(l)}_clearFallback(){a.get(this).clear()}_keysFallback(){return Array.from(a.get(this).keys())}IsUsingFallback(){return c}async getItem(l,m){e(m);if(c)return await this._getItemFallback(l);let u;try{u=await this._inst.get(l)}catch(w){this._MaybeSwitchToMemoryFallback(w);if(c)return await this._getItemFallback(l);
console.error(`Error reading '${l}' from storage, returning null: `,w);return null}return"undefined"===typeof u?null:u}async setItem(l,m,u){e(u);"undefined"===typeof m&&(m=null);if(c)await this._setItemFallback(l,m);else try{await this._inst.set(l,m)}catch(w){if(this._MaybeSwitchToMemoryFallback(w),c)await this._setItemFallback(l,m);else throw w;}}async removeItem(l,m){e(m);if(c)this._removeItemFallback(l);else try{await this._inst.delete(l)}catch(u){this._MaybeSwitchToMemoryFallback(u),c?this._removeItemFallback(l):
console.error(`Error removing '${l}' from storage: `,u)}}async clear(l){e(l);if(c)this._clearFallback();else try{await this._inst.clear()}catch(m){this._MaybeSwitchToMemoryFallback(m),c?this._clearFallback():console.error("Error clearing storage: ",m)}}async keys(l){e(l);if(c)return this._keysFallback();l=[];try{l=await this._inst.keys()}catch(m){this._MaybeSwitchToMemoryFallback(m);if(c)return this._keysFallback();console.error("Error getting storage keys: ",m)}return l}ready(l){e(l);return c?Promise.resolve(!0):
this._inst.ready()}createInstance(l){if("object"!==typeof l)throw new TypeError("invalid options object");l=l.name;if("string"!==typeof l)throw new TypeError("invalid store name");l=new f(l);return new g(l)}length(l){d("localforage.length()")}key(l,m){d("localforage.key()")}iterate(l,m){d("localforage.iterate()")}setDriver(l){d("localforage.setDriver()")}config(l){d("localforage.config()")}defineDriver(l){d("localforage.defineDriver()")}driver(){d("localforage.driver()")}supports(l){d("localforage.supports()")}dropInstance(){d("localforage.dropInstance()")}disableMemoryMode(){c=
!1}}self.localforage=new g(new 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&&"Safari"!==
f.Platform.Browser;f.Supports.ImageBitmapOptions=!1;if(f.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{resizeWidth:10,resizeHeight:10,premultiplyAlpha:"none"}).then(b=>{f.Supports.ImageBitmapOptions=10===b.width&&10===b.height?!0:!1}).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,c){return a.reduce((d,e)=>{0<c&&Array.isArray(e)?Array.prototype.push.apply(d,b(e,c-1)):d.push(e);return d},[])}Array.prototype.flat=function(a=1){return b(this,a)}}Array.prototype.at||(Array.prototype.at=function(b){b=Math.trunc(b)||0;0>
b&&(b+=this.length);if(!(0>b||b>=this.length))return this[b]});String.prototype.at||(String.prototype.at=function(b){b=Math.trunc(b)||0;0>b&&(b+=this.length);if(!(0>b||b>=this.length))return this[b]});RegExp.escape||(RegExp.escape=function(b){return String(b).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")});navigator.storage&&!navigator.storage.estimate&&navigator.webkitTemporaryStorage&&navigator.webkitTemporaryStorage.queryUsageAndQuota&&(navigator.storage.estimate=function(){return new Promise((b,a)=>navigator.webkitTemporaryStorage.queryUsageAndQuota((c,
d)=>b({usage:c,quota:d}),a))});"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}{"use strict";const f=self.C3;function b(a){let c=f.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+c)}self.assert=function(a,c){a||b(c)}}
{"use strict";const f=self.C3,b=self.C3X;f.IsNumber=function(c){return"number"===typeof c};f.IsFiniteNumber=function(c){return f.IsNumber(c)&&isFinite(c)};f.RequireNumber=function(c){if(!f.IsNumber(c))throw new TypeError("expected number");};f.RequireOptionalNumber=function(c){f.IsNullOrUndefined(c)};f.RequireNumberInRange=function(c,d,e){if(!f.IsNumber(c)||isNaN(c)||d>c||e<c)throw new RangeError("number outside of range");};f.RequireAllNumber=function(...c){for(let d of c);};f.RequireFiniteNumber=
function(c){if(!f.IsFiniteNumber(c))throw new TypeError("expected finite number");};f.RequireOptionalFiniteNumber=function(c){f.IsNullOrUndefined(c)};f.RequireAllFiniteNumber=function(...c){for(let d of c);};f.IsString=function(c){return"string"===typeof c};f.RequireString=function(c){if(!f.IsString(c))throw new TypeError("expected string");};f.RequireOptionalString=function(c){f.IsNullOrUndefined(c)};f.RequireAllString=function(...c){for(let d of c);};f.IsSimpleObject=function(c){return"object"!==
typeof c||null===c?!1:(c=Object.getPrototypeOf(c))?c.constructor===Object:null===c};f.RequireSimpleObject=function(c){if(!f.IsSimpleObject(c))throw new TypeError("expected simple object");};f.RequireOptionalSimpleObject=function(c){if(!f.IsNullOrUndefined(c)&&!f.IsSimpleObject(c))throw new TypeError("expected simple object");};f.IsObject=function(c){return"object"===typeof c&&null!==c&&!Array.isArray(c)};f.RequireObject=function(c){if(!f.IsObject(c))throw new TypeError("expected object");};f.RequireOptionalObject=
function(c){f.IsNullOrUndefined(c)};f.RequireAllObject=function(...c){for(let d of c);};f.IsFileLike=function(c){return f.IsInstanceOf(c,Blob)&&"string"===typeof c.name};f.RequireFileLike=function(c){if(!f.IsFileLike(c))throw new TypeError("expected file");};f.RequireOptionalFileLike=function(c){f.IsNullOrUndefined(c)};f.IsArray=function(c){return Array.isArray(c)};f.RequireArray=function(c){if(!f.IsArray(c))throw new TypeError("expected array");};f.RequireOptionalArray=function(c){f.IsNullOrUndefined(c)};
f.RequireAllArray=function(...c){for(let d of c);};f.Is2DArray=function(c){return f.IsArray(c)?c.length?f.IsArray(c[0])?!0:!1:!0:!1};f.Require2DArray=function(c){if(!f.Is2DArray(c))throw new TypeError("expected 2d array");for(let d of c)if(!f.IsArray(d))throw new TypeError("expected 2d array");};f.RequireOptional2DArray=function(c){f.IsNullOrUndefined(c)};f.IsFunction=function(c){return"function"===typeof c};f.RequireFunction=function(c,d){if(!f.IsFunction(c))throw new TypeError("expected function");
if(!f.IsNullOrUndefined(d)&&c!==d)throw new TypeError("expected same function reference");};f.RequireOptionalFunction=function(c){f.IsNullOrUndefined(c)};f.RequireAllFunction=function(...c){for(let d of c);};f.RequireAnyFunction=function(c,...d){if(!f.IsFunction(c))throw new TypeError("expected function");if(!d.length)throw Error("missing comparison functions");for(let e of d)if(!f.IsNullOrUndefined(e)&&c===e)return;throw new TypeError("expected same function reference");};f.RequireOptionalAllFunction=
function(...c){if(!f.IsNullOrUndefined(c))for(let d of c);};f.IsInstanceOf=function(c,d){return c instanceof d};f.IsInstanceOfAny=function(c,...d){for(let e of d)if(f.IsInstanceOf(c,e))return!0;return!1};f.RequireInstanceOf=function(c,d){if(!f.IsInstanceOf(c,d))throw new TypeError("unexpected type");};f.RequireOptionalInstanceOf=function(c,d){f.IsNullOrUndefined(c)};f.RequireAllInstanceOf=function(c,...d){for(let e of d);};f.RequireAnyInstanceOf=function(c,...d){if(!f.IsInstanceOfAny(c,...d))throw new TypeError("unexpected type");
};f.RequireAnyOptionalInstanceOf=function(c,...d){if(!f.IsNullOrUndefined(c)&&!f.IsInstanceOfAny(c,...d))throw new TypeError("unexpected type");};f.IsArrayOf=function(c,d){for(let e of c)if(!f.IsInstanceOf(e,d))return!1;return!0};f.IsArrayOfFiniteNumbers=function(c){for(let d of c)if(!f.IsFiniteNumber(d))return!1;return!0};f.RequireArrayOf=function(c,d){for(let e of c);};f.RequireOptionalArrayOf=function(c,d){if(!f.IsNullOrUndefined(c))for(let e of c);};f.RequireArrayOfAny=function(c,...d){for(let e of c);
};f.RequireOptionalArrayOfAny=function(c,...d){if(!f.IsNullOrUndefined(c))for(let e of c);};f.IsDOMNode=function(c,d){return f.IsNullOrUndefined(c)||!f.IsString(c.nodeName)?!1:!d||f.equalsNoCase(c.nodeName,d)};f.RequireDOMNode=function(c,d){if(f.IsNullOrUndefined(c)||!f.IsString(c.nodeName))throw new TypeError("expected DOM node");if(d&&!f.equalsNoCase(c.nodeName,d))throw new TypeError(`expected DOM '${d}' node`);};f.RequireOptionalDOMNode=function(c,d){f.IsNullOrUndefined(c)};f.IsHTMLElement=function(c,
d){return f.IsNullOrUndefined(c)||!f.IsString(c.tagName)?!1:!d||f.equalsNoCase(c.tagName,d)};f.RequireHTMLElement=function(c,d){if(f.IsNullOrUndefined(c)||!f.IsString(c.tagName))throw new TypeError("expected HTML element");if(d&&!f.equalsNoCase(c.tagName,d))throw new TypeError(`expected HTML '${d}' element`);};f.RequireOptionalHTMLElement=function(c,d){f.IsNullOrUndefined(c)};f.IsDrawable=function(c){return f.IsHTMLElement(c,"img")||f.IsHTMLElement(c,"canvas")||f.IsHTMLElement(c,"video")||"undefined"!==
typeof OffscreenCanvas&&c instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&c instanceof ImageBitmap};f.RequireDrawable=function(c){if(!f.IsDrawable(c))throw new TypeError("expected drawable");};f.RequireOptionalDrawable=function(c){f.IsNullOrUndefined(c)};f.IsDrawableOrImageData=function(c){return c instanceof ImageData?!0:f.IsDrawable(c)};f.RequireDrawableOrImageData=function(c){if(!f.IsDrawableOrImageData(c))throw new TypeError("expected drawable or image data");};f.RequireOptionalDrawableOrImageData=
function(c){if(!f.IsNullOrUndefined(c)&&!f.IsDrawableOrImageData(c))throw new TypeError("expected drawable or image data");};f.IsStringLike=function(c){return"string"===typeof c||c instanceof f.HtmlString||c instanceof f.BBString};f.RequireStringLike=function(c){if(!f.IsStringLike(c))throw new TypeError("expected string-like");};f.RequireOptionalStringLike=function(c){f.IsNullOrUndefined(c)};f.RequireAllStringLike=function(...c){for(let d of c);};f.RequireOverride=function(){throw Error("must be overridden");
};f.NotYetImplemented=function(){throw Error("not yet implemented");};f.IsDefined=function(c,...d){if("undefined"===typeof c)return!1;for(let e of d){if("undefined"===typeof c[e])return!1;c=c[e]}return!0};f.IsNullOrUndefined=function(c){return"undefined"===typeof c||null===c};f.AreArrayElementsOfSameType=function(c){let d=c[0].constructor;for(let e of c)if(e.constructor!==d)return!1;return d};f.AreArrayElementsOfType=function(c,d){for(let e of c)if(!(e instanceof d))return!1;return!0};const a=Object.getPrototypeOf(Uint8Array);
f.IsTypedArray=function(c){return f.IsInstanceOf(c,a)};f.RequireTypedArray=function(c){};f.WeakRequireTypedArray=function(c){f.WeakRequireInstanceOf(c,a)};f.WeakRequireAnyInstanceOf=function(c,...d){if(!f.WeakIsAnyInstanceOf(c,...d))throw new TypeError("unexpected type");};f.WeakIsAnyInstanceOf=function(c,...d){for(const e of d)if(f.WeakIsInstanceOf(c,e))return!0;return!1};f.WeakRequireInstanceOf=function(c,d){if(!f.WeakIsInstanceOf(c,d))throw new TypeError("unexpected type");};f.WeakIsInstanceOf=
function(c,d){for(;c=Object.getPrototypeOf(c);)if(c.constructor.name===d.name)return!0;return!1};b.RequireNumber=f.RequireNumber;b.RequireOptionalNumber=f.RequireOptionalNumber;b.RequireFiniteNumber=f.RequireFiniteNumber;b.RequireOptionalFiniteNumber=f.RequireOptionalFiniteNumber;b.RequireString=f.RequireString;b.RequireOptionalString=f.RequireOptionalString;b.RequireObject=f.RequireObject;b.RequireOptionalObject=f.RequireOptionalObject;b.RequireArray=f.RequireArray;b.RequireOptionalArray=f.RequireOptionalArray;
b.RequireFunction=f.RequireFunction;b.RequireOptionalFunction=f.RequireOptionalFunction;b.RequireInstanceOf=f.RequireInstanceOf;b.RequireOptionalInstanceOf=f.RequireOptionalInstanceOf;b.IsNullOrUndefined=f.IsNullOrUndefined}
{"use strict";const f=self.C3,b=new Map;f.RafLog=function(r,...x){b.has(r)||b.set(r,-1);-1===b.get(r)&&b.set(r,requestAnimationFrame(()=>{console.log(`%c${r}`,"font-weight: bold",...x);b.set(r,-1)}))};let a;f.StartMeasure=function(r){performance.mark(r);a||(a=new Map);a.has(r)||a.set(r,{current:0,total:0,average:0,calls:1,toString:function(){return`current => ${this.current.toPrecision(3)} :: average => ${this.average.toPrecision(3)} :: calls => ${this.calls}`}})};f.EndMeasure=function(r){performance.measure("measure",
r);const x=performance.getEntriesByName("measure")[0];r=a.get(r);r.current=x.duration;r.total+=r.current;r.average=r.total/r.calls;r.calls++;console.log(r.toString());performance.clearMarks();performance.clearMeasures()};f.GetCallStack=function(){return Error().stack};f.Debugger=function(){debugger};f.cast=function(r,x){return r&&r instanceof x?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,x){if(!isFinite(Math.abs(r-x)))throw Error("Invalid parameters");if(r>x)for(--r;r>=x;r--)yield r;else for(;r<x;r++)yield r};
function c(r,x){r=f.getType(r);x=f.getType(x);return"null"===r||"null"===x?!0:"undefined"===r||"undefined"===x?!1:r===x}let d=new Map,e=new Map,h=new WeakMap,g=new WeakMap;f.DefendHandler={};const l=new Set(["then","splice"]);function m(r){console.warn("[Defence] "+r+" @",f.GetCallStack())}f.DefendHandler.get=function(r,x){x in r||"symbol"===typeof x||l.has(x)||m(`Accessed missing property '${x}' from defended object '${f.getName(r)}', returning undefined`);g.has(r)&&"symbol"!==typeof x&&!l.has(x)&&
m(`Accessed property '${x}' on a released object '${f.getName(r)}'\nObject was originally released at: ${g.get(r)})\nCall stack at access: `);return r[x]};f.DefendHandler.set=function(r,x,y){x in r||d.has(r)||m(`Set non-existent property '${x}' to '${y}' on defended object '${f.getName(r)}'`);c(r[x],y)||d.has(r)||m(`Set '${f.getType(r[x])}' property '${x}' to type '${f.getType(y)}' on defended object '${f.getName(r)}'`);g.has(r)&&m(`Set property '${x}' on a released object '${f.getName(r)}'\nObject was originally released at: ${g.get(r)})\nCall stack at access: `);
r[x]=y;return!0};f.DefendHandler.deleteProperty=function(r,x){throw new ReferenceError(`Cannot delete property '${x}' from defended object '${f.getName(r)}'`);};f.DefendHandler.defineProperty=function(r,x,y){throw new ReferenceError(`Cannot define property '${x}' on defended object '${f.getName(r)}'`);};f.DefendHandler.enumerate=function(r){throw new ReferenceError(`Cannot enumerate defended object '${f.getName(r)}'`);};let u=-1;function w(){u=-1;if(0<d.size||0<e.size){let r=[...new Set([...d.keys()].map(x=>
f.getName(x)))].join();console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${r}`);d.clear();e.clear()}}f.DefendedBase=class{constructor(){if(f.isDebugDefend&&f.Supports.Proxies){var r=new.target;r=Object.create(r.prototype);var x=new Proxy(r,f.DefendHandler);d.set(r,x);e.set(x,r);h.set(x,r);-1===u&&(u=requestAnimationFrame(w));return x}}};f.debugDefend=function(r){if(f.isDebugDefend&&
f.Supports.Proxies&&r instanceof f.DefendedBase){if(!e.has(r))return r;let x=e.get(r);e.delete(r);d.delete(x);return r}return f.isDebug?Object.seal(r):r};f.New=function(r,...x){let y;try{y=new r(...x)}catch(E){throw e.clear(),d.clear(),E;}f.isDebugDefend&&p(r,y);return f.debugDefend(y)};f.Release=function(r){(r=h.get(r))&&g.set(r,f.GetCallStack())};f.WasReleased=function(r){return(r=h.get(r))?!!g.get(r):!1};let q=new Map;function t(r){let x=new Set;for(let y in r)x.add(y);return x}function p(r,x){x=
t(x);let y=q.get(r);if(y){let E=[];for(let H of y.values())x.has(H)?x.delete(H):E.push(H);f.appendArray(E,[...x]);E.length&&console.warn(`[Defence] '${f.getName(r)}' constructor creates inconsistent properties: ${E.join(", ")}`)}else q.set(r,x)}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,c=180/Math.PI;f.wrap=function(h,g,l){h=Math.floor(h);g=Math.floor(g);l=Math.floor(l);return h<g?(h=l-(g-h)%(l-g),h===l?0:h):g+(h-g)%(l-g)};f.mapToRange=function(h,g,l,m,u){return(h-g)*(u-m)/(l-g)+m};f.normalize=function(h,g,l){return(h-g)/(l-g)};f.clamp=function(h,g,l){return h<g?g:h>l?l:h};f.clampAngle=function(h){h%=b;0>h&&(h+=b);return h};f.toRadians=function(h){return h*a};f.toDegrees=function(h){return h*c};f.distanceTo=function(h,g,l,m){return Math.hypot(l-
h,m-g)};f.distanceSquared=function(h,g,l,m){h=l-h;g=m-g;return h*h+g*g};f.angleTo=function(h,g,l,m){return Math.atan2(m-g,l-h)};f.angleDiff=function(h,g){if(h===g)return 0;h=Math.sin(h)*Math.sin(g)+Math.cos(h)*Math.cos(g);return 1<=h?0:-1>=h?Math.PI:Math.acos(h)};f.angleRotate=function(h,g,l){let m=Math.sin(h),u=Math.cos(h),w=Math.sin(g),q=Math.cos(g);return Math.acos(m*w+u*q)>l?0<u*w-m*q?f.clampAngle(h+l):f.clampAngle(h-l):f.clampAngle(g)};f.angleClockwise=function(h,g){return 0>=Math.cos(h)*Math.sin(g)-
Math.sin(h)*Math.cos(g)};f.angleLerp=function(h,g,l,m=0){let u=f.angleDiff(h,g);m*=b;return f.angleClockwise(g,h)?f.clampAngle(h+(u+m)*l):f.clampAngle(h-(u+m)*l)};f.angleLerpClockwise=function(h,g,l,m=0){const u=f.angleDiff(h,g);m*=b;return f.angleClockwise(g,h)?f.clampAngle(h+(u+m)*l):f.clampAngle((b-u+m)*l)};f.angleLerpAntiClockwise=function(h,g,l,m=0){const u=f.angleDiff(h,g);m*=b;return f.angleClockwise(g,h)?f.clampAngle((-b+u-m)*l):f.clampAngle(h-(u+m)*l)};f.lerp=function(h,g,l){return h+l*(g-
h)};f.unlerp=function(h,g,l){return h===g?0:(l-h)/(g-h)};f.relerp=function(h,g,l,m,u){return f.lerp(m,u,f.unlerp(h,g,l))};f.qarp=function(h,g,l,m){return f.lerp(f.lerp(h,g,m),f.lerp(g,l,m),m)};f.cubic=function(h,g,l,m,u){return f.lerp(f.qarp(h,g,l,u),f.qarp(g,l,m,u),u)};f.cosp=function(h,g,l){return(h+g+(h-g)*Math.cos(l*Math.PI))/2};f.isPOT=function(h){return 0<h&&0===(h-1&h)};f.nextHighestPowerOfTwo=function(h){--h;for(let g=1;32>g;g<<=1)h|=h>>g;return h+1};f.roundToNearestFraction=function(h,g){return Math.round(h*
g)/g};f.floorToNearestFraction=function(h,g){return Math.floor(h*g)/g};f.round6dp=function(h){return Math.round(1E6*h)/1E6};f.toFixed=function(h,g){h=h.toFixed(g);for(g=h.length-1;0<=g&&"0"===h.charAt(g);--g);0<=g&&"."===h.charAt(g)&&--g;return 0>g?h:h.substr(0,g+1)};f.PackRGB=function(h,g,l){return f.clamp(h,0,255)|f.clamp(g,0,255)<<8|f.clamp(l,0,255)<<16};f.PackRGBAEx=function(h,g,l,m){h=f.clamp(Math.floor(1024*h),-8192,8191);g=f.clamp(Math.floor(1024*g),-8192,8191);l=f.clamp(Math.floor(1024*l),
-8192,8191);m=f.clamp(Math.floor(1023*m),0,1023);0>h&&(h+=16384);0>g&&(g+=16384);0>l&&(l+=16384);return-(274877906944*h+16777216*g+1024*l+m)};f.PackRGBEx=function(h,g,l){return f.PackRGBAEx(h,g,l,1)};function d(h){return 0===h&&0>1/h}f.GetRValue=function(h){if(0<=h)return(h&255)/255;h=Math.floor(-h/274877906944);8191<h&&(h-=16384);return h/1024};f.GetGValue=function(h){if(0<=h)return((h&65280)>>8)/255;h=Math.floor(-h%274877906944/16777216);8191<h&&(h-=16384);return h/1024};f.GetBValue=function(h){if(0<=
h)return((h&16711680)>>16)/255;h=Math.floor(-h%16777216/1024);8191<h&&(h-=16384);return h/1024};f.GetAValue=function(h){return d(h)?0:0<=h?1:Math.floor(-h%1024)/1023};f.greatestCommonDivisor=function(h,g){h=Math.floor(h);for(g=Math.floor(g);0!==g;){let l=g;g=h%g;h=l}return h};const e=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];f.getAspectRatio=function(h,g){h=Math.floor(h);g=Math.floor(g);if(h===g)return[1,1];for(var l of e){let m=h/l[0]*l[1];if(1>Math.abs(g-m))return l.slice(0);
m=h/l[1]*l[0];if(1>Math.abs(g-m))return[l[1],l[0]]}l=f.greatestCommonDivisor(h,g);return[h/l,g/l]};f.segmentsIntersect=function(h,g,l,m,u,w,q,t){var p=Math.min(h,l),r=Math.max(u,q);if(Math.max(h,l)<Math.min(u,q)||p>r)return!1;p=Math.min(g,m);r=Math.max(w,t);if(Math.max(g,m)<Math.min(w,t)||p>r)return!1;p=u-h+q-l;r=w-g+t-m;h=l-h;g=m-g;u=q-u;w=t-w;t=Math.abs(g*u-w*h);return Math.abs(u*r-w*p)>t?!1:Math.abs(h*r-g*p)<=t};f.segmentsIntersectPreCalc=function(h,g,l,m,u,w,q,t,p,r,x,y){const E=Math.max(p,x);
if(w<Math.min(p,x)||u>E)return!1;u=Math.max(r,y);if(t<Math.min(r,y)||q>u)return!1;q=p-h+x-l;t=r-g+y-m;h=l-h;g=m-g;p=x-p;r=y-r;y=Math.abs(g*p-r*h);return Math.abs(p*t-r*q)>y?!1:Math.abs(h*t-g*q)<=y};f.segmentIntersectsQuad=function(h,g,l,m,u){const w=Math.min(h,l),q=Math.max(h,l),t=Math.min(g,m),p=Math.max(g,m),r=u.getTlx(),x=u.getTly(),y=u.getTrx(),E=u.getTry(),H=u.getBrx(),A=u.getBry(),F=u.getBlx();u=u.getBly();return f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,r,x,y,E)||f.segmentsIntersectPreCalc(h,
g,l,m,w,q,t,p,y,E,H,A)||f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,H,A,F,u)||f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,F,u,r,x)};f.segmentIntersectsAnyN=function(h,g,l,m,u){const w=Math.min(h,l),q=Math.max(h,l),t=Math.min(g,m),p=Math.max(g,m);let r=0;for(let x=u.length-4;r<=x;r+=2)if(f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,u[r],u[r+1],u[r+2],u[r+3]))return!0;return f.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,u[r],u[r+1],u[0],u[1])};f.rayIntersect=function(h,g,l,m,u,w,q,t){l-=h;w=t-w;const p=l*
w-(m-g)*(q-u);if(0===p)return 2;m=((g-m)*(q-h)+l*(t-g))/p;return 0<m&&1.000001>m?(w*(q-h)+(u-q)*(t-g))/p:2};f.rayIntersectExtended=function(h,g,l,m,u,w,q,t,p){const r=(q-u)*p;p*=t-w;return f.rayIntersect(h,g,l,m,u-r,w-p,q+r,t+p)};f.isPointInTriangleInclusive=function(h,g,l,m,u,w,q,t){u-=l;w-=m;q-=l;t-=m;h-=l;l=g-m;g=u*u+w*w;m=u*q+w*t;u=u*h+w*l;w=q*q+t*t;q=q*h+t*l;t=1/(g*w-m*m);w=(w*u-m*q)*t;u=(g*q-m*u)*t;return 0<=w&&0<=u&&1>=w+u};f.triangleCartesianToBarycentric=function(h,g,l,m,u,w,q,t){u-=l;w-=
m;q-=l;t-=m;h-=l;const p=g-m;g=u*u+w*w;m=u*q+w*t;l=q*q+t*t;u=h*u+p*w;w=h*q+p*t;q=g*l-m*m;t=(l*u-m*w)/q;u=(g*w-m*u)/q;return[1-t-u,t,u]};f.triangleBarycentricToCartesian=function(h,g,l,m,u,w,q,t,p){return[h*m+g*w+l*t,h*u+g*q+l*p]}}
{"use strict";const f=self.C3;let b=null,a="";if("undefined"!==typeof document){b=document;const l=document.querySelector("base");if(a=l&&l.hasAttribute("href")?l.getAttribute("href"):"")a.startsWith("/")&&(a=a.substr(1)),a.endsWith("/")||(a+="/")}f.GetBaseHref=function(){return a};f.GetBaseURL=function(){if(!b)return"";const l=b.location;return f.GetPathFromURL(l.origin+l.pathname)+a};f.GetPathFromURL=function(l){if(!l.length||l.endsWith("/")||l.endsWith("\\"))return l;const m=Math.max(l.lastIndexOf("/"),
l.lastIndexOf("\\"));return-1===m?"":l.substr(0,m+1)};f.GetFilenameFromURL=function(l){if(!l.length)return l;if(l.endsWith("/")||l.endsWith("\\"))return"";const m=Math.max(l.lastIndexOf("/"),l.lastIndexOf("\\"));return-1===m?l:l.substr(m+1)};f.GetFileExtension=function(l){let m=l.lastIndexOf(".");return 1>m?"":l.substr(m)};f.GetFileNamePart=function(l){let m=l.lastIndexOf(".");return 1>m?l:l.substr(0,m)};f.NormalizeFileSeparator=function(l){return l.replace(/\\/g,"/")};f.IsFileExtension=function(l,
m){l=l?f.GetFileExtension(l).slice(1):"";return m===l};f.FileNameEquals=function(l,m){let u,w;f.IsFileLike(l)&&(u=f.GetFileNamePart(l.name));f.IsString(l)&&(u=f.GetFileNamePart(l));f.IsFileLike(m)&&(w=f.GetFileNamePart(m.name));f.IsString(m)&&(w=f.GetFileNamePart(m));return u===w};f.ParseFilePath=function(l){l=f.NormalizeFileSeparator(l);let m=/^\w:\//.exec(l);m?(m=m[0],l=l.slice(3),"/"!==l[0]&&(l="/"+l)):m="";l=l.replace(/\/{2,}/g,"/");1<l.length&&"/"===l.slice(-1)&&(l=l.slice(0,-1));var u=l.lastIndexOf("/")+
1;let w="",q=l,t="";0<u&&(w=l.slice(0,u),q=l.slice(u));l=q;u=q.lastIndexOf(".");0<u&&(t=q.slice(u),l=q.slice(0,-t.length));return{dir:w,base:q,name:l,root:m,ext:t,full:m+w+q}};f.Wait=function(l,m){return new Promise((u,w)=>{self.setTimeout(u,l,m)})};f.swallowException=function(l){try{l()}catch(m){f.isDebug&&console.warn("Swallowed exception: ",m)}};f.noop=function(){};f.equalsNoCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m||l.normalize().toLowerCase()===m.normalize().toLowerCase()};
f.equalsCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m?!0:l.normalize()===m.normalize()};f.typedArraySet16=function(l,m,u){l[u++]=m[0];l[u++]=m[1];l[u++]=m[2];l[u++]=m[3];l[u++]=m[4];l[u++]=m[5];l[u++]=m[6];l[u++]=m[7];l[u++]=m[8];l[u++]=m[9];l[u++]=m[10];l[u++]=m[11];l[u++]=m[12];l[u++]=m[13];l[u++]=m[14];l[u]=m[15]};f.truncateArray=function(l,m){l.length=m};f.clearArray=function(l){l&&0!==l.length&&f.truncateArray(l,0)};f.clear2DArray=function(l){if(l){for(let m=0;m<
l.length;m++)f.truncateArray(l[m],0);f.truncateArray(l,0)}};f.extendArray=function(l,m,u){m|=0;var w=l.length;if(!(m<=w))for(;w<m;++w)l.push(u)};f.resizeArray=function(l,m,u){m|=0;const w=l.length;m<w?f.truncateArray(l,m):m>w&&f.extendArray(l,m,u)};f.shallowAssignArray=function(l,m){f.clearArray(l);f.appendArray(l,m)};f.appendArray=function(l,m){if(1E4>m.length)l.push(...m);else for(let u=0,w=m.length;u<w;++u)l.push(m[u])};f.arrayRemove=function(l,m){m=Math.floor(m);if(!(0>m||m>=l.length)){for(var u=
l.length-1;m<u;++m)l[m]=l[m+1];f.truncateArray(l,u)}};f.arrayFindRemove=function(l,m){m=l.indexOf(m);0<=m&&l.splice(m,1)};f.arraysEqual=function(l,m){let u=l.length;if(m.length!==u)return!1;for(let w=0;w<u;++w)if(l[w]!==m[w])return!1;return!0};f.arrayFilterOut=function(l,m){let u=[],w=0;for(let q=0,t=l.length;q<t;++q){let p=l[q];m(p)?u.push(p):(l[w]=p,++w)}f.truncateArray(l,w);return u};f.arrayRemoveAllInSet=function(l,m){const u=l.length;let w=0;for(let q=0,t=l.length;q<t;++q){let p=l[q];m.has(p)||
(l[w++]=p)}f.truncateArray(l,w);return u-w};f.isArrayIndexInBounds=function(l,m){return l!==Math.floor(l)?!1:0<=l&&l<m.length};f.validateArrayIndex=function(l,m){if(!f.isArrayIndexInBounds(l,m))throw new RangeError("array index out of bounds");};f.cloneArray=function(l){return l.slice()};f.deepCloneArray=function(l,m){let u=[];for(let w of l)if(f.IsObject(w)){l=m(w);if(!l)throw Error("missing clone");if(l.constructor!==w.constructor)throw Error("object is not a clone");u.push(l)}else f.IsArray(w)?
u.push(f.deepCloneArray(w,m)):u.push(w);return u};f.clone2DArray=function(l){let m=[];for(let u of l)m.push(u.slice());return m};f.mergeSets=function(l,m){return new Set([...l,...m])};f.mergeSetsInPlace=function(l,m){for(const u of m)l.add(u);return l};f.first=function(l){for(let m of l)return m;return null};f.xor=function(l,m){return!l!==!m};f.compare=function(l,m,u){switch(m){case 0:return l===u;case 1:return l!==u;case 2:return l<u;case 3:return l<=u;case 4:return l>u;case 5:return l>=u;default:return!1}};
f.hasAnyOwnProperty=function(l){for(let m in l)if(l.hasOwnProperty(m))return!0;return!1};f.PromiseAllWithProgress=function(l,m){return l.length?new Promise((u,w)=>{const q=[];let t=0,p=!1;for(let r=0,x=l.length;r<x;++r)q.push(void 0),l[r].then(y=>{p||(q[r]=y,++t,t===l.length?u(q):m(t,l.length))}).catch(y=>{p=!0;w(y)})}):Promise.resolve([])};let c=[];f.AddLibraryMemoryCallback=function(l){c.push(l)};f.GetEstimatedLibraryMemoryUsage=function(){let l=0;for(let m of c){let u=m();l+=u}return Math.floor(l)};
let d=1;const e=new Map,h=new MessageChannel;h.port2.onmessage=function(l){l=l.data;const m=e.get(l);e.delete(l);m&&m(performance.now())};f.RequestUnlimitedAnimationFrame=function(l){const m=d++;e.set(m,l);h.port1.postMessage(m);return m};f.CancelUnlimitedAnimationFrame=function(l){e.delete(l)};f.PostTask=f.RequestUnlimitedAnimationFrame;f.WaitForNextTask=function(){return new Promise(l=>f.PostTask(l))};const g=new Set;f.RequestPostAnimationFrame=function(l){const m=self.requestAnimationFrame(async u=>
{await f.WaitForNextTask();g.has(m)&&(g.delete(m),l(u))});g.add(m);return m};f.CancelPostAnimationFrame=function(l){g.has(l)&&(self.cancelAnimationFrame(l),g.delete(l))}}
{"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(c=>{f.ThrowIfNotOk(c);return c})};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,c)=>{const d=new Image;d.onload=()=>a(d);d.onerror=e=>c(e);d.src=b})};f.BlobToArrayBuffer=function(b){return"function"===typeof b.arrayBuffer?b.arrayBuffer():new Promise((a,c)=>{const d=new FileReader;d.onload=()=>a(d.result);d.onerror=()=>c(d.error);d.readAsArrayBuffer(b)})};f.BlobToString=function(b){return"function"===
typeof b.text?b.text():new Promise((a,c)=>{const d=new FileReader;d.onload=()=>a(d.result);d.onerror=()=>c(d.error);d.readAsText(b)})};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 c=await f.FetchImage(b);URL.revokeObjectURL(b);b="";a&&"function"===typeof c.decode&&await c.decode();return c}finally{b&&URL.revokeObjectURL(b)}};f.CreateCanvas=function(b,a){if("undefined"!==typeof document&&"function"===
typeof document.createElement){const c=document.createElement("canvas");c.width=b;c.height=a;return c}return new OffscreenCanvas(b,a)};f.CanvasToBlob=function(b,a,c){"number"!==typeof c&&(c=1);a=a||"image/png";c=f.clamp(c,0,1);return b.toBlob?new Promise(d=>b.toBlob(d,a,c)):b.convertToBlob?b.convertToBlob({type:a,quality:c}):f.Asyncify(()=>f.CanvasToBlobSync(b,a,c))};f.CanvasToBlobSync=function(b,a,c){"number"!==typeof c&&(c=1);a=a||"image/png";c=f.clamp(c,0,1);return f.DataURIToBinaryBlobSync(b.toDataURL(a,
c))};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 c=b.substring(5,a);b=b.substring(a+1);a=c.split(";");c=a[0]||"";let d=a[2];b="base64"===a[1]||"base64"===d?atob(b):decodeURIComponent(b);return{mime_type:c,data:b}};f.BinaryStringToBlob=function(b,a){var c=b.length;
let d=c>>2,e=new Uint8Array(c),h=new Uint32Array(e.buffer,0,d),g,l;for(l=g=0;g<d;++g)h[g]=b.charCodeAt(l++)|b.charCodeAt(l++)<<8|b.charCodeAt(l++)<<16|b.charCodeAt(l++)<<24;for(c&=3;c--;)e[l]=b.charCodeAt(l),++l;return a?new Blob([e],{type:a}):new Blob([e])};f.DrawableToBlob=function(b,a,c){const d=f.CreateCanvas(b.width,b.height);d.getContext("2d").drawImage(b,0,0);return f.CanvasToBlob(d,a,c)};f.ImageDataToBlobSync=function(b,a,c){const d=f.CreateCanvas(b.width,b.height);d.getContext("2d").putImageData(b,
0,0);return f.CanvasToBlobSync(d,a,c)};f.ImageDataToBlob=function(b,a,c){if(f.Supports.ImageBitmapOptions)return createImageBitmap(b,{premultiplyAlpha:"none"}).then(d=>f.DrawableToBlob(d,a,c));if(f.Supports.ImageBitmap)return createImageBitmap(b).then(d=>f.DrawableToBlob(d,a,c));{const d=f.CreateCanvas(b.width,b.height);d.getContext("2d").putImageData(b,0,0);return f.CanvasToBlob(d,a,c)}};f.CopySet=function(b,a){b.clear();for(const c of a)b.add(c)};f.MapToObject=function(b){const a=Object.create(null);
for(const [c,d]of b.entries())a[c]=d;return a};f.ObjectToMap=function(b,a){a.clear();for(const [c,d]of Object.entries(b))a.set(c,d)};f.ToSuperJSON=function c(a){if("object"===typeof a&&null!==a){if(a instanceof Set)return{_c3type_:"set",data:[...a].map(d=>c(d))};if(a instanceof Map)return{_c3type_:"map",data:[...a].map(d=>[d[0],c(d[1])])};{const d=Object.create(null);for(const [e,h]of Object.entries(a))d[e]=c(h);return d}}return a};f.FromSuperJSON=function d(c){if("object"===typeof c&null!==c){if("set"===
c._c3type_)return new Set(c.data.map(e=>d(e)));if("map"===c._c3type_)return new Map(c.data.map(e=>[e[0],d(e[1])]));{const e=Object.create(null);for(const [h,g]of Object.entries(c))e[h]=d(g);return e}}return c};f.CSSToCamelCase=function(c){let d="",e=!1;for(const h of c)"-"===h?e=!0:e?(d+=h.toUpperCase(),e=!1):d+=h;return d};f.IsIterator=function(c){return"object"===typeof c&&"function"===typeof c.next};f.MakeFilledArray=function(c,d){const e=[];if("function"===typeof d)for(var h=0;h<c;++h)e.push(d());
else for(h=0;h<c;++h)e.push(d);return e}}
{"use strict";const f=self.C3,b=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,a=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;function c(e){return 0===e.length?"00":1===e.length?"0"+e:e}function d(e,h,g){0>g&&(g+=1);1<g&&--g;return g<1/6?e+6*(h-e)*g:.5>g?h:g<2/3?e+(h-e)*(2/3-g)*6:e}f.Color=class{constructor(e,h,g,l){this._a=this._b=this._g=this._r=0;e instanceof f.Color?this.set(e):this.setRgba(e||0,h||0,g||0,l||0)}setRgb(e,h,g){this._r=+e;this._g=+h;this._b=+g;this.clamp();return this}setRgba(e,h,g,l){this._r=
+e;this._g=+h;this._b=+g;this._a=+l;this.clamp();return this}set(e){this._r=e._r;this._g=e._g;this._b=e._b;this._a=e._a;return this}copy(e){return this.set(e)}add(e){this._r+=e._r;this._g+=e._g;this._b+=e._b;this._a+=e._a;this.clamp()}addRgb(e,h,g,l=0){this._r+=+e;this._g+=+h;this._b+=+g;this._a+=+l;this.clamp()}diff(e){this.setR(Math.max(this._r,e._r)-Math.min(this._r,e._r));this.setG(Math.max(this._g,e._g)-Math.min(this._g,e._g));this.setB(Math.max(this._b,e._b)-Math.min(this._b,e._b));this.setA(Math.max(this._a,
e._a)-Math.min(this._a,e._a));this.clamp()}copyRgb(e){this._r=e._r;this._g=e._g;this._b=e._b}setR(e){this._r=f.clamp(+e,0,1)}getR(){return this._r}setG(e){this._g=f.clamp(+e,0,1)}getG(){return this._g}setB(e){this._b=f.clamp(+e,0,1)}getB(){return this._b}setA(e){this._a=f.clamp(+e,0,1)}getA(){return this._a}clone(){return f.New(f.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(e,h){e[h++]=
this._r;e[h++]=this._g;e[h++]=this._b;e[h]=this._a}writeRGBToTypedArray(e,h){e[h++]=this._r;e[h++]=this._g;e[h]=this._b}equals(e){return this._r===e._r&&this._g===e._g&&this._b===e._b&&this._a===e._a}equalsIgnoringAlpha(e){return this._r===e._r&&this._g===e._g&&this._b===e._b}equalsRgb(e,h,g){return this._r===e&&this._g===h&&this._b===g}equalsRgba(e,h,g,l){return this._r===e&&this._g===h&&this._b===g&&this._a===l}equalsF32Array(e,h){return e[h]===Math.fround(this._r)&&e[h+1]===Math.fround(this._g)&&
e[h+2]===Math.fround(this._b)&&e[h+3]===Math.fround(this._a)}equalsRGBF32Array(e,h){return e[h]===Math.fround(this._r)&&e[h+1]===Math.fround(this._g)&&e[h+2]===Math.fround(this._b)}multiply(e){this._r*=e._r;this._g*=e._g;this._b*=e._b;this._a*=e._a}multiplyAlpha(e){this._r*=e;this._g*=e;this._b*=e;this._a*=e}premultiply(){this._r*=this._a;this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=f.clamp(this._r,0,1);
this._g=f.clamp(this._g,0,1);this._b=f.clamp(this._b,0,1);this._a=f.clamp(this._a,0,1);return this}setFromRgbValue(e){this._r=f.GetRValue(e);this._g=f.GetGValue(e);this._b=f.GetBValue(e);this._a=f.GetAValue(e)}getCssRgb(e,h,g){e=f.IsFiniteNumber(e)?e:this.getR();h=f.IsFiniteNumber(h)?h:this.getG();g=f.IsFiniteNumber(g)?g:this.getB();return`rgb(${100*e}%, ${100*h}%, ${100*g}%)`}getCssRgba(e,h,g,l){e=f.IsFiniteNumber(e)?e:this.getR();h=f.IsFiniteNumber(h)?h:this.getG();g=f.IsFiniteNumber(g)?g:this.getB();
l=f.IsFiniteNumber(l)?l:this.getA();return`rgba(${100*e}%, ${100*h}%, ${100*g}%, ${l})`}toHexString(){const e=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return"#"+c(e.toString(16))+c(h.toString(16))+c(g.toString(16))}parseHexString(e){if("string"!==typeof e)return!1;e=e.trim();"#"===e.charAt(0)&&(e=e.substr(1));let h,g;if(3===e.length)h=parseInt(e[0],16)/15,g=parseInt(e[1],16)/15,e=parseInt(e[2],16)/15;else if(6===e.length)h=parseInt(e.substr(0,2),16)/
255,g=parseInt(e.substr(2,2),16)/255,e=parseInt(e.substr(4,2),16)/255;else return!1;isFinite(h)&&this.setR(h);isFinite(g)&&this.setG(g);isFinite(e)&&this.setB(e);this.setA(1);return!0}toCommaSeparatedRgb(){const e=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return`${e}, ${h}, ${g}`}toRgbArray(){const e=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return[e,h,g]}parseCommaSeparatedRgb(e){if("string"!==typeof e)return!1;
e=e.replace(/^rgb\(|\)|%/,"");var h=e.split(",");if(3>h.length)return!1;e=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255;h=parseInt(h[2].trim(),10)/255;isFinite(e)&&this.setR(e);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(e){if("string"!==typeof e)return!1;e=e.replace(/^rgb\(|\)|%/,"");var h=e.split(",");if(3>h.length)return!1;e=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100;h=parseInt(h[2].trim(),
10)/100;isFinite(e)&&this.setR(e);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedRgba(e){if("string"!==typeof e)return!1;e=e.replace(/^rgba\(|\)|%/,"");var h=e.split(",");if(4>h.length)return!1;e=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255,l=parseInt(h[2].trim(),10)/255;h=parseFloat(h[3].trim());isFinite(e)&&this.setR(e);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseCommaSeparatedPercentageRgba(e){if("string"!==
typeof e)return!1;e=e.replace(/^rgba\(|\)|%/,"");var h=e.split(",");if(4>h.length)return!1;e=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100,l=parseInt(h[2].trim(),10)/100;h=parseFloat(h[3].trim());isFinite(e)&&this.setR(e);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseString(e){if("string"!==typeof e)return!1;e=e.replace(/\s+/,"");if(e.includes(",")){if(e.startsWith("rgb("))return e.includes("%")?this.parseCommaSeparatedPercentageRgb(e):
this.parseCommaSeparatedRgb(e);if(e.startsWith("rgba("))return e.includes("%")?this.parseCommaSeparatedPercentageRgba(e):this.parseCommaSeparatedRgba(e);if(e.startsWith("hsl(")||e.startsWith("hsla("))return this.parseHSLString(e);{const h=e.split(",");if(e.includes("%")){if(3===h.length)return this.parseCommaSeparatedPercentageRgb(e);if(4===h.length)return this.parseCommaSeparatedPercentageRgba(e)}else{if(3===h.length)return this.parseCommaSeparatedRgb(e);if(4===h.length)return this.parseCommaSeparatedRgba(e)}return!1}}return this.parseHexString(e)}toJSON(){return[this._r,
this._g,this._b,this._a]}setFromHSLA(e,h,g,l){e%=360;h=f.clamp(h,0,100);g=f.clamp(g,0,100);l=f.clamp(l,0,1);e/=360;h/=100;g/=100;if(0===h)g=h=e=g;else{const m=.5>g?g*(1+h):g+h-g*h,u=2*g-m;g=d(u,m,e+1/3);h=d(u,m,e);e=d(u,m,e-1/3)}this.setR(g);this.setG(h);this.setB(e);this.setA(l);return this}parseHSLString(e){var h=e.replace(/ |hsl|hsla|\(|\)|;/gi,"");e=b.exec(h);h=a.exec(h);return e&&4===e.length?(this.setFromHSLA(+e[1],+e[2],+e[3],1),!0):h&&5===h.length?(this.setFromHSLA(+e[1],+e[2],+e[3],+e[4]),
!0):!1}toHSLAString(){var e=this._r;const h=this._g,g=this._b,l=this._a,m=f.Color.GetHue(e,h,g),u=f.Color.GetSaturation(e,h,g);e=f.Color.GetLuminosity(e,h,g);return`hsla(${m}, ${u}%, ${e}%, ${l})`}toHSLAArray(){const e=this._r,h=this._g,g=this._b;return[f.Color.GetHue(e,h,g),f.Color.GetSaturation(e,h,g),f.Color.GetLuminosity(e,h,g),this._a]}setFromJSON(e){!Array.isArray(e)||3>e.length||(this._r=e[0],this._g=e[1],this._b=e[2],this._a=4<=e.length?e[3]:1)}set r(e){this.setR(e)}get r(){return this.getR()}set g(e){this.setG(e)}get g(){return this.getG()}set b(e){this.setB(e)}get b(){return this.getB()}set a(e){this.setA(e)}get a(){return this.getA()}setAtIndex(e,
h){switch(e){case 0:this.setR(h);break;case 1:this.setG(h);break;case 2:this.setB(h);break;case 3:this.setA(h);break;default:throw new RangeError("invalid color index");}}getAtIndex(e){switch(e){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static Equals(e,h){let g;if(Array.isArray(e))g=new f.Color,g.setFromJSON(e);else if(e instanceof f.Color)g=e;else throw Error("unexpected type");if(Array.isArray(h))e=
new f.Color,e.setFromJSON(h);else if(h instanceof f.Color)e=h;else throw Error("unexpected type");return g.equals(e)}static DiffChannel(e,h){return f.clamp(Math.max(e,h)-Math.min(e,h),0,1)}static Diff(e,h){const g=new f.Color;g.setR(Math.max(e._r,h._r)-Math.min(e._r,h._r));g.setG(Math.max(e._g,h._g)-Math.min(e._g,h._g));g.setB(Math.max(e._b,h._b)-Math.min(e._b,h._b));g.setA(Math.max(e._a,h._a)-Math.min(e._a,h._a));return g}static DiffNoAlpha(e,h){const g=new f.Color(0,0,0,1);g.setR(Math.max(e._r,
h._r)-Math.min(e._r,h._r));g.setG(Math.max(e._g,h._g)-Math.min(e._g,h._g));g.setB(Math.max(e._b,h._b)-Math.min(e._b,h._b));return g}static GetHue(e,h,g){const l=Math.max(e,h,g),m=Math.min(e,h,g);if(l===m)return 0;let u=0;switch(l){case e:u=(h-g)/(l-m)+(h<g?6:0);break;case h:u=(g-e)/(l-m)+2;break;case g:u=(e-h)/(l-m)+4}return Math.round(u/6*360)}static GetSaturation(e,h,g){const l=Math.max(e,h,g);e=Math.min(e,h,g);if(l===e)return 0;h=l-e;return Math.round(100*(.5<(l+e)/2?h/(2-l-e):h/(l+e)))}static GetLuminosity(e,
h,g){const l=Math.max(e,h,g);return l?Math.round((l+Math.min(e,h,g))/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}equalsValues(b,a){return this._x===b&&this._y===a}equalsF32Array(b,a){return b[a]===Math.fround(this._x)&&b[a+1]===Math.fround(this._y)}setX(b){this._x=+b}getX(){return this._x}setY(b){this._y=+b}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,
a){b[a++]=this._x;b[a]=this._y}offset(b,a){this._x+=+b;this._y+=+a}scale(b,a){this._x*=b;this._y*=a}divide(b,a){this._x/=b;this._y/=a}round(){this._x=Math.round(this._x);this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x);this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y)}angle(){return 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 c=this._x*
a-this._y*b;this._y=this._y*a+this._x*b;this._x=c}rotate(b){0!==b&&this.rotatePrecalc(Math.sin(b),Math.cos(b))}rotateAbout(b,a,c){0===b||a===this._x&&c===this._y||(this._x-=a,this._y-=c,this.rotatePrecalc(Math.sin(b),Math.cos(b)),this._x+=+a,this._y+=+c)}move(b,a){0!==a&&(this._x+=Math.cos(b)*a,this._y+=Math.sin(b)*a)}normalize(){const b=this.length();0!==b&&1!==b&&(this._x/=b,this._y/=b)}clamp(b,a){this._x=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,c,d){this._bottom=this._right=this._top=this._left=0;b instanceof f.Rect?this.copy(b):this.set(b||0,a||0,c||0,d||0)}set(b,a,c,d){this._left=+b;this._top=+a;this._right=+c;this._bottom=+d}setWH(b,a,c,d){b=+b;a=+a;this._left=b;this._top=a;this._right=b+ +c;this._bottom=a+ +d}copy(b){this._left=+b._left;this._top=+b._top;this._right=+b._right;this._bottom=+b._bottom}clone(){return new f.Rect(this._left,this._top,this._right,this._bottom)}static Merge(b,
a){const c=new f.Rect;c.setLeft(Math.min(b._left,a._left));c.setTop(Math.min(b._top,a._top));c.setRight(Math.max(b._right,a._right));c.setBottom(Math.max(b._bottom,a._bottom));return c}static FromObject(b){return new 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}equalsWH(b,a,c,d){return this._left===b&&this._top===a&&this.width()===c&&this.height()===d}equalsF32Array(b,a){return b[a]===Math.fround(this._left)&&
b[a+1]===Math.fround(this._top)&&b[a+2]===Math.fround(this._right)&&b[a+3]===Math.fround(this._bottom)}setLeft(b){this._left=+b}getLeft(){return this._left}setTop(b){this._top=+b}getTop(){return this._top}setRight(b){this._right=+b}getRight(){return this._right}setBottom(b){this._bottom=+b}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),
this.height())}writeToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a]=this._bottom}writeAsQuadToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a++]=this._top;b[a++]=this._right;b[a++]=this._bottom;b[a++]=this._left;b[a]=this._bottom}writeAsQuadToTypedArray3D(b,a,c){b[a++]=this._left;b[a++]=this._top;b[a++]=c;b[a++]=this._right;b[a++]=this._top;b[a++]=c;b[a++]=this._right;b[a++]=this._bottom;b[a++]=c;b[a++]=this._left;b[a++]=this._bottom;b[a]=c}width(){return this._right-
this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right+=b;this._bottom+=a}offsetLeft(b){this._left+=+b}offsetTop(b){this._top+=+b}offsetRight(b){this._right+=+b}offsetBottom(b){this._bottom+=+b}toSquare(b){if("x"!==b)throw Error("invalid axis, only 'x' supported");this._bottom=this._top<this._bottom?this._left<this._right?this._top+this.width():this._top-this.width():
this._left<this._right?this._top-this.width():this._top+this.width()}inflate(b,a){b=+b;a=+a;this._left-=b;this._top-=a;this._right+=b;this._bottom+=a}deflate(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right-=b;this._bottom-=a}multiply(b,a){this._left*=b;this._top*=a;this._right*=b;this._bottom*=a}divide(b,a){this._left/=b;this._top/=a;this._right/=b;this._bottom/=a}mirrorAround(b){this._left=+b-this._left;this._right=+b-this._right}flipAround(b){this._top=+b-this._top;this._bottom=+b-this._bottom}swapLeftRight(){const b=
this._left;this._left=this._right;this._right=b}swapTopBottom(){const b=this._top;this._top=this._bottom;this._bottom=b}shuntY(b){const a=this._top;this._top=+b-this._bottom;this._bottom=+b-a}round(){this._left=Math.round(this._left);this._top=Math.round(this._top);this._right=Math.round(this._right);this._bottom=Math.round(this._bottom)}roundInner(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}roundOuter(){this._left=
Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}floor(){this._left=Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}ceil(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}clamp(b,a,c,d){this._left<b&&(this._left=+b);this._top<a&&(this._top=+a);this._right>
c&&(this._right=+c);this._bottom>d&&(this._bottom=+d)}clampFlipped(b,a,c,d){this._left<b&&(this._left=+b);this._top>a&&(this._top=+a);this._right>c&&(this._right=+c);this._bottom<d&&(this._bottom=+d)}normalize(){this._left>this._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(b){return!(b._right<this._left||b._bottom<this._top||b._left>this._right||b._top>this._bottom)}intersectsRectOffset(b,a,c){return!(b._right+a<this._left||b._bottom+c<this._top||b._left+
a>this._right||b._top+c>this._bottom)}containsPoint(b,a){return b>=this._left&&b<=this._right&&a>=this._top&&a<=this._bottom}containsRect(b){return b._left>=this._left&&b._top>=this._top&&b._right<=this._right&&b._bottom<=this._bottom}expandToContain(b){b._left<this._left&&(this._left=+b._left);b._top<this._top&&(this._top=+b._top);b._right>this._right&&(this._right=+b._right);b._bottom>this._bottom&&(this._bottom=+b._bottom)}lerpInto(b){this._left=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,c,d,e,h,g,l){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,c||0,d||0,e||0,h||0,g||0,l||0)}set(b,a,c,d,e,h,g,l){this._tlx=+b;this._tly=+a;this._trx=+c;this._try=+d;this._brx=+e;this._bry=+h;this._blx=+g;this._bly=+l}setRect(b,a,c,d){this.set(b,a,c,a,c,d,b,d)}copy(b){this._tlx=b._tlx;this._tly=b._tly;this._trx=b._trx;this._try=b._try;this._brx=b._brx;this._bry=
b._bry;this._blx=b._blx;this._bly=b._bly}equals(b){return this._tlx===b._tlx&&this._tly===b._tly&&this._trx===b._trx&&this._try===b._try&&this._brx===b._brx&&this._bry===b._bry&&this._blx===b._blx&&this._bly===b._bly}setTlx(b){this._tlx=+b}getTlx(){return this._tlx}setTly(b){this._tly=+b}getTly(){return this._tly}setTrx(b){this._trx=+b}getTrx(){return this._trx}setTry(b){this._try=+b}getTry(){return this._try}setBrx(b){this._brx=+b}getBrx(){return this._brx}setBry(b){this._bry=+b}getBry(){return this._bry}setBlx(b){this._blx=
+b}getBlx(){return this._blx}setBly(b){this._bly=+b}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}toArray(){return[this._tlx,this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,a){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=this._trx;b[a++]=this._try;b[a++]=this._brx;
b[a++]=this._bry;b[a++]=this._blx;b[a]=this._bly}writeToTypedArray3D(b,a,c){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=c;b[a++]=this._trx;b[a++]=this._try;b[a++]=c;b[a++]=this._brx;b[a++]=this._bry;b[a++]=c;b[a++]=this._blx;b[a++]=this._bly;b[a]=c}offset(b,a){b=+b;a=+a;this._tlx+=b;this._tly+=a;this._trx+=b;this._try+=a;this._brx+=b;this._bry+=a;this._blx+=b;this._bly+=a}round(){this._tlx=Math.round(this._tlx);this._tly=Math.round(this._tly);this._trx=Math.round(this._trx);this._try=Math.round(this._try);
this._brx=Math.round(this._brx);this._bry=Math.round(this._bry);this._blx=Math.round(this._blx);this._bly=Math.round(this._bly)}floor(){this._tlx=Math.floor(this._tlx);this._tly=Math.floor(this._tly);this._trx=Math.floor(this._trx);this._try=Math.floor(this._try);this._brx=Math.floor(this._brx);this._bry=Math.floor(this._bry);this._blx=Math.floor(this._blx);this._bly=Math.floor(this._bly)}ceil(){this._tlx=Math.ceil(this._tlx);this._tly=Math.ceil(this._tly);this._trx=Math.ceil(this._trx);this._try=
Math.ceil(this._try);this._brx=Math.ceil(this._brx);this._bry=Math.ceil(this._bry);this._blx=Math.ceil(this._blx);this._bly=Math.ceil(this._bly)}setFromRect(b){this._tlx=b._left;this._tly=b._top;this._trx=b._right;this._try=b._top;this._brx=b._right;this._bry=b._bottom;this._blx=b._left;this._bly=b._bottom}setFromRotatedRect(b,a){0===a?this.setFromRect(b):this.setFromRotatedRectPrecalc(b,Math.sin(a),Math.cos(a))}setFromRotatedRectPrecalc(b,a,c){const d=b._left*a,e=b._top*a,h=b._right*a;a*=b._bottom;
const g=b._left*c,l=b._top*c,m=b._right*c;b=b._bottom*c;this._tlx=g-e;this._tly=l+d;this._trx=m-e;this._try=l+h;this._brx=m-a;this._bry=b+h;this._blx=g-a;this._bly=b+d}getBoundingBox(b){b.set(Math.min(this._tlx,this._trx,this._brx,this._blx),Math.min(this._tly,this._try,this._bry,this._bly),Math.max(this._tlx,this._trx,this._brx,this._blx),Math.max(this._tly,this._try,this._bry,this._bly))}containsPoint(b,a){var c=this._trx-this._tlx,d=this._try-this._tly;const e=this._brx-this._tlx,h=this._bry-this._tly;
b-=this._tlx;a-=this._tly;var g=c*c+d*d;let l=c*e+d*h;d=c*b+d*a;const m=e*e+h*h,u=e*b+h*a;let w=1/(g*m-l*l);c=(m*d-l*u)*w;g=(g*u-l*d)*w;if(0<=c&&0<g&&1>c+g)return!0;c=this._blx-this._tlx;d=this._bly-this._tly;g=c*c+d*d;l=c*e+d*h;d=c*b+d*a;w=1/(g*m-l*l);c=(m*d-l*u)*w;g=(g*u-l*d)*w;return 0<=c&&0<g&&1>c+g}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(b,a,c,d){return this.containsPoint(b,a)||this.containsPoint(c,d)?
!0:f.segmentIntersectsQuad(b,a,c,d,this)}intersectsQuad(b){var a=b.midX(),c=b.midY();if(this.containsPoint(a,c))return!0;a=this.midX();c=this.midY();if(b.containsPoint(a,c))return!0;a=this._tlx;c=this._tly;const d=this._trx,e=this._try,h=this._brx,g=this._bry,l=this._blx,m=this._bly;return f.segmentIntersectsQuad(a,c,d,e,b)||f.segmentIntersectsQuad(d,e,h,g,b)||f.segmentIntersectsQuad(h,g,l,m,b)||f.segmentIntersectsQuad(l,m,a,c,b)}rotatePointsAnticlockwise(){const b=this._tlx,a=this._tly;this._tlx=
this._trx;this._tly=this._try;this._trx=this._brx;this._try=this._bry;this._brx=this._blx;this._bry=this._bly;this._blx=b;this._bly=a}mirror(){this._swap(0,2);this._swap(1,3);this._swap(6,4);this._swap(7,5)}flip(){this._swap(0,6);this._swap(1,7);this._swap(2,4);this._swap(3,5)}diag(){this._swap(2,6);this._swap(3,7)}_swap(b,a){const c=this._getAtIndex(b);this._setAtIndex(b,this._getAtIndex(a));this._setAtIndex(a,c)}_getAtIndex(b){switch(b){case 0:return this._tlx;case 1:return this._tly;case 2:return this._trx;
case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index");}}_setAtIndex(b,a){a=+a;switch(b){case 0:this._tlx=a;break;case 1:this._tly=a;break;case 2:this._trx=a;break;case 3:this._try=a;break;case 4:this._brx=a;break;case 5:this._bry=a;break;case 6:this._blx=a;break;case 7:this._bly=a;break;default:throw new RangeError("invalid quad point index");}}}}
{"use strict";const f=self.C3,b=[0,0,1,0,1,1,0,1],a=f.New(f.Quad);f.CollisionPoly=class extends f.DefendedBase{constructor(c,d=!0){super();c||(c=b);this._ptsArr=Float64Array.from(c);this._bbox=new f.Rect;this._isBboxChanged=!0;this._enabled=d}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(c){this._ptsArr.length===c.length?this._ptsArr.set(c):this._ptsArr=Float64Array.from(c);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(b)}copy(c){this.setPoints(c._ptsArr)}setBboxChanged(){this._isBboxChanged=
!0}_updateBbox(){if(this._isBboxChanged){var c=this._ptsArr,d=c[0],e=c[1],h=d,g=e;for(let l=0,m=c.length;l<m;l+=2){const u=c[l],w=c[l+1];u<d&&(d=u);u>h&&(h=u);w<e&&(e=w);w>g&&(g=w)}this._bbox.set(d,e,h,g);this._isBboxChanged=!1}}setFromRect(c,d,e){let h=this._ptsArr;8!==h.length&&(this._ptsArr=h=new Float64Array(8));h[0]=c.getLeft()-d;h[1]=c.getTop()-e;h[2]=c.getRight()-d;h[3]=c.getTop()-e;h[4]=c.getRight()-d;h[5]=c.getBottom()-e;h[6]=c.getLeft()-d;h[7]=c.getBottom()-e;this._bbox.copy(c);0===d&&0===
e||this._bbox.offset(-d,-e);this._isBboxChanged=!1}setFromQuad(c,d,e){a.copy(c);a.offset(d,e);this.setPoints(a.toArray());this._isBboxChanged=!0}transform(c,d,e){let h=0,g=1;0!==e&&(h=Math.sin(e),g=Math.cos(e));this.transformPrecalc(c,d,h,g)}transformPrecalc(c,d,e,h){const g=this._ptsArr;for(let l=0,m=g.length;l<m;l+=2){const u=l+1,w=g[l]*c,q=g[u]*d;g[l]=w*h-q*e;g[u]=q*h+w*e}this._isBboxChanged=!0}offset(c,d){const e=this._ptsArr;for(let h=0,g=e.length;h<g;h+=2)e[h]+=c,e[h+1]+=d}containsPoint(c,d){const e=
this._ptsArr;if(c===e[0]&&d===e[1])return!0;this._updateBbox();var h=this._bbox;const g=h.getLeft()-110,l=h.getTop()-101,m=h.getRight()+131;h=h.getBottom()+120;let u,w,q,t,p,r,x,y;g<c?(u=g,q=c):(u=c,q=g);l<d?(w=l,t=d):(w=d,t=l);m<c?(p=m,x=c):(p=c,x=m);h<d?(r=h,y=d):(r=d,y=h);let E=0,H=0;for(let F=0,J=e.length;F<J;F+=2){var A=(F+2)%J;const B=e[F],I=e[F+1],L=e[A];A=e[A+1];f.segmentsIntersectPreCalc(g,l,c,d,u,q,w,t,B,I,L,A)&&++E;f.segmentsIntersectPreCalc(m,h,c,d,p,x,r,y,B,I,L,A)&&++H}return 1===E%2||
1===H%2}intersectsPoly(c,d,e){const h=c._ptsArr,g=this._ptsArr;if(this.containsPoint(h[0]+d,h[1]+e)||c.containsPoint(g[0]-d,g[1]-e))return!0;for(let m=0,u=g.length;m<u;m+=2){var l=(m+2)%u;c=g[m];const w=g[m+1],q=g[l];l=g[l+1];let t,p,r,x;c<q?(t=c,r=q):(t=q,r=c);w<l?(p=w,x=l):(p=l,x=w);for(let y=0,E=h.length;y<E;y+=2){const H=(y+2)%E;if(f.segmentsIntersectPreCalc(c,w,q,l,t,r,p,x,h[y]+d,h[y+1]+e,h[H]+d,h[H+1]+e))return!0}}return!1}intersectsSegment(c,d,e,h,g,l){if(this.containsPoint(e-c,h-d)||this.containsPoint(g-
c,l-d))return!0;let m,u,w,q;e<g?(m=e,w=g):(m=g,w=e);h<l?(u=h,q=l):(u=l,q=h);const t=this._ptsArr;for(let p=0,r=t.length;p<r;p+=2){const x=(p+2)%r;if(f.segmentsIntersectPreCalc(e,h,g,l,m,w,u,q,t[p]+c,t[p+1]+d,t[x]+c,t[x+1]+d))return!0}return!1}mirror(c){const d=this._ptsArr;for(let e=0,h=d.length;e<h;e+=2)d[e]=2*c-d[e];this._isBboxChanged=!0}flip(c){const d=this._ptsArr;for(let e=0,h=d.length;e<h;e+=2){const g=e+1;d[g]=2*c-d[g]}this._isBboxChanged=!0}diag(){const c=this._ptsArr;for(let d=0,e=c.length;d<
e;d+=2){const h=d+1,g=c[d];c[d]=c[h];c[h]=g}this._isBboxChanged=!0}GetMidX(){const c=this._ptsArr;let d=0;for(let e=0,h=c.length;e<h;e+=2)d+=c[e];return d/this.pointCount()}GetMidY(){const c=this._ptsArr;let d=0;for(let e=0,h=c.length;e<h;e+=2)d+=c[e+1];return d/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,c,d]of b)this.Set(a,c,d)}Release(){this.Clear();this._firstMap=null}Clear(){const b=this._firstMap;for(const a of b.values())a.clear();b.clear()}Set(b,a,c){const d=this._firstMap;let e=d.get(b);e||(e=new Map,d.set(b,e));e.set(a,c)}Get(b,a){return(b=this._firstMap.get(b))?b.get(a):b}Has(b,a){return(b=this._firstMap.get(b))?b.has(a):!1}Delete(b,a){const c=this._firstMap,
d=c.get(b);if(!d)return!1;(a=d.delete(a))&&0===d.size&&c.delete(b);return a}DeleteEither(b){const a=this._firstMap,c=a.get(b);c&&(c.clear(),a.delete(b));for(const [d,e]of a.entries())e.delete(b)&&0===e.size&&a.delete(d)}GetSize(){let b=0;for(const a of this._firstMap.values())b+=a.size;return b}*values(){for(const b of this._firstMap.values())yield*b.values()}*keyPairs(){for(const [b,a]of this._firstMap.entries())for(const c of a.keys())yield[b,c]}*entries(){for(const [b,a]of this._firstMap.entries())for(const [c,
d]of a.entries())yield[b,c,d]}}}
{"use strict";const 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,c=new Map,d=new Map,e=new Map;e.set("linear","noease");e.set("default","noease");self.Ease=class q{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(t,...p){this._CreateEaseMap();a.has(t)||a.set(t,new Map);t=[...a.get(t).keys()];t.sort();return[...b.keys()].concat(t).filter(r=>!p.includes(r))}static GetRuntimeEaseNames(){this._CreateEaseMap();const t=[...c.keys()];t.sort();return[...b.keys()].concat(t)}static IsNamePredefined(t){this._CreateEaseMap();
return[...b.keys()].includes(t)}static _GetEase(t){const p=e.get(t);if(p)return f.get(p);if(q.IsNamePredefined(t))return f.get(t);if(d.has(t))return d.get(t)}static GetEditorEase(t,p){this._CreateEaseMap();const r=q._GetEase(t);return r?r:a.get(p).get(t)}static GetRuntimeEase(t){this._CreateEaseMap();const p=q._GetEase(t);return p?p:c.get(t)}static GetEaseFromIndex(t){this._CreateEaseMap();return this.GetRuntimeEaseNames()[t]}static GetIndexForEase(t,p){this._CreateEaseMap();return this.GetEditorEaseNames(p).indexOf(t)}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(t,p){q._AddEase(t,p,"predefined")}static _AddPrivateCustomEase(t,
p){q._AddEase(t,p,"private")}static AddCustomEase(t,p,r){this._CreateEaseMap();q._AddEase(t,p,"custom",r)}static RemoveCustomEase(t,p){this.IsNamePredefined(t)||[...d.keys()].includes(t)||(p=a.get(p))&&p.delete(t)}static _AddEase(t,p,r,x){switch(r){case "predefined":f.set(t,p);b.set(t,p);break;case "custom":x?(a.has(x)||a.set(x,new Map),a.get(x).set(t,p)):c.set(t,p);break;case "private":f.set(t,p);d.set(t,p);break;default:throw Error("unexpected ease mode");}}static NoEase(t,p,r,x){return r*t/x+p}static EaseInQuad(t,
p,r,x){return r*(t/=x)*t+p}static EaseOutQuad(t,p,r,x){return-r*(t/=x)*(t-2)+p}static EaseInOutQuad(t,p,r,x){return 1>(t/=x/2)?r/2*t*t+p:-r/2*(--t*(t-2)-1)+p}static EaseInCubic(t,p,r,x){return r*(t/=x)*t*t+p}static EaseOutCubic(t,p,r,x){return r*((t=t/x-1)*t*t+1)+p}static EaseInOutCubic(t,p,r,x){return 1>(t/=x/2)?r/2*t*t*t+p:r/2*((t-=2)*t*t+2)+p}static EaseInQuart(t,p,r,x){return r*(t/=x)*t*t*t+p}static EaseOutQuart(t,p,r,x){return-r*((t=t/x-1)*t*t*t-1)+p}static EaseInOutQuart(t,p,r,x){return 1>(t/=
x/2)?r/2*t*t*t*t+p:-r/2*((t-=2)*t*t*t-2)+p}static EaseInQuint(t,p,r,x){return r*(t/=x)*t*t*t*t+p}static EaseOutQuint(t,p,r,x){return r*((t=t/x-1)*t*t*t*t+1)+p}static EaseInOutQuint(t,p,r,x){return 1>(t/=x/2)?r/2*t*t*t*t*t+p:r/2*((t-=2)*t*t*t*t+2)+p}static EaseInSine(t,p,r,x){return-r*Math.cos(t/x*(Math.PI/2))+r+p}static EaseOutSine(t,p,r,x){return r*Math.sin(t/x*(Math.PI/2))+p}static EaseInOutSine(t,p,r,x){return-r/2*(Math.cos(Math.PI*t/x)-1)+p}static EaseInExpo(t,p,r,x){return 0===t?p:r*Math.pow(2,
10*(t/x-1))+p}static EaseOutExpo(t,p,r,x){return t===x?p+r:r*(-Math.pow(2,-10*t/x)+1)+p}static EaseInOutExpo(t,p,r,x){return 0===t?p:t===x?p+r:1>(t/=x/2)?r/2*Math.pow(2,10*(t-1))+p:r/2*(-Math.pow(2,-10*--t)+2)+p}static EaseInCirc(t,p,r,x){return-r*(Math.sqrt(1-(t/=x)*t)-1)+p}static EaseOutCirc(t,p,r,x){return r*Math.sqrt(1-(t=t/x-1)*t)+p}static EaseInOutCirc(t,p,r,x){return 1>(t/=x/2)?-r/2*(Math.sqrt(1-t*t)-1)+p:r/2*(Math.sqrt(1-(t-=2)*t)+1)+p}static EaseInElastic(t,p,r,x){let y=0,E=r;if(0===t)return p;
if(1===(t/=x))return p+r;y||(y=.3*x);E<Math.abs(r)?(E=r,r=y/4):r=y/(2*Math.PI)*Math.asin(r/E);return-(E*Math.pow(2,10*--t)*Math.sin(2*(t*x-r)*Math.PI/y))+p}static EaseOutElastic(t,p,r,x){let y,E=0,H=r;if(0===t)return p;if(1===(t/=x))return p+r;E||(E=.3*x);H<Math.abs(r)?(H=r,y=E/4):y=E/(2*Math.PI)*Math.asin(r/H);return H*Math.pow(2,-10*t)*Math.sin(2*(t*x-y)*Math.PI/E)+r+p}static EaseInOutElastic(t,p,r,x){let y,E=0,H=r;if(0===t)return p;if(2===(t/=x/2))return p+r;E||(E=.3*x*1.5);H<Math.abs(r)?(H=r,
y=E/4):y=E/(2*Math.PI)*Math.asin(r/H);return 1>t?-.5*H*Math.pow(2,10*--t)*Math.sin(2*(t*x-y)*Math.PI/E)+p:H*Math.pow(2,-10*--t)*Math.sin(2*(t*x-y)*Math.PI/E)*.5+r+p}static EaseInBack(t,p,r,x,y){void 0===y&&(y=1.70158);return r*(t/=x)*t*((y+1)*t-y)+p}static EaseOutBack(t,p,r,x,y){void 0===y&&(y=1.70158);return r*((t=t/x-1)*t*((y+1)*t+y)+1)+p}static EaseInOutBack(t,p,r,x,y){void 0===y&&(y=1.70158);return 1>(t/=x/2)?r/2*t*t*(((y*=1.525)+1)*t-y)+p:r/2*((t-=2)*t*(((y*=1.525)+1)*t+y)+2)+p}static EaseInBounce(t,
p,r,x){return r-q.EaseOutBounce(x-t,0,r,x)+p}static EaseOutBounce(t,p,r,x){return(t/=x)<1/2.75?7.5625*r*t*t+p:t<2/2.75?r*(7.5625*(t-=1.5/2.75)*t+.75)+p:t<2.5/2.75?r*(7.5625*(t-=2.25/2.75)*t+.9375)+p:r*(7.5625*(t-=2.625/2.75)*t+.984375)+p}static EaseInOutBounce(t,p,r,x){return t<x/2?.5*q.EaseInBounce(2*t,0,r,x)+p:.5*q.EaseOutBounce(2*t-x,0,r,x)+.5*r+p}static EaseCubicBezier(t,p,r,x,y){return p+3*t*(r-p)+3*t**2*(p+x-2*r)+t**3*(y-p+3*r-3*x)}static EaseSpline(t,p,r,x,y,E,H,A,F,J){if(x===y&&E===H)return t;
t=w(t,p,x,E,A,J);p=h(r,y,H,F);x=g(r,y,H,F);r=l(r,y,H,F);return m(t,p,x,r)}static GetBezierSamples(t,p,r,x){const y=[],E=h(t,p,r,x),H=g(t,p,r,x);t=l(t,p,r,x);for(p=0;11>p;++p)r=m(.1*p,E,H,t),y.push(r);return y}};const h=(q,t,p,r)=>r-3*p+3*t-q,g=(q,t,p,r)=>3*p-6*t+3*q,l=(q,t,p,r)=>3*(t-q),m=(q,t,p,r)=>((t*q+p)*q+r)*q,u=(q,t,p,r)=>3*t*q*q+2*p*q+r,w=(q,t,p,r,x,y)=>{if(1==q)return 1;for(var E=0,H=1,A=y[H];10!=H&&A<=q;)H++,A=y[H],E+=.1;H--;A=y[H];y=E+(q-A)/(y[H+1]-A)*.1;H=h(t,p,r,x);A=g(t,p,r,x);t=l(t,
p,r,x);p=u(y,H,A,t);if(0!==p)if(.02<=p)for(E=0;4>E;++E)p=m(y,H,A,t)-q,r=u(y,H,A,t),y-=p/r;else{p=E;E+=.1;r=0;let F;do y=p+(E-p)/2,x=m(y,H,A,t)-q,0<x?E=y:p=y,x=1E-7<Math.abs(x),F=10>++r;while(x&&F)}return y}}
{"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 c=0;for(const [d,e]of this._items)if(c+=d,a<c)return e;return 0}AddItem(a,c){b(c);this._totalWeight+=a;this._items.push([a,c])}RemoveItem(a,c){b(c);const d=0===a;for(let e=0;e<this._items.length;e++){const h=
this._items[e],g=h[1]===c;if((d||h[0]===a)&&g){this._items.splice(e,1);this._totalWeight-=h[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(a){const c=new f.ProbabilityTable;a=JSON.parse(a);for(const d of a)c.AddItem(d[0],d[1]);return c}}}"use strict";
self.C3.Event=class{constructor(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._queueModifyListeners=[]}Release(){0<this._fireDepth||(f.clearArray(this._captureListeners),this._captureListenersSet.clear(),f.clearArray(this._listeners),this._listenersSet.clear(),f.clearArray(this._queueModifyListeners),f.Release(this))}_AddListener(b,a){this._IsFiring()?
this._queueModifyListeners.push({op:"add",func:b,capture:a}):a?this._captureListenersSet.has(b)||(this._captureListeners.push(b),this._captureListenersSet.add(b)):this._listenersSet.has(b)||(this._listeners.push(b),this._listenersSet.add(b))}_RemoveListener(b,a){this._IsFiring()?this._queueModifyListeners.push({op:"remove",func:b,capture:a}):a?this._captureListenersSet.has(b)&&(this._captureListenersSet.delete(b),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(){const b=new Set,a=new Set;for(const c of this._queueModifyListeners)if("add"===c.op)this._AddListener(c.func,c.capture),c.capture?a.delete(c.func):b.delete(c.func);else if("remove"===c.op)c.capture?(this._captureListenersSet.delete(c.func),a.add(c.func)):(this._listenersSet.delete(c.func),b.add(c.func));else throw Error("invalid op");
f.arrayRemoveAllInSet(this._listeners,b);f.arrayRemoveAllInSet(this._captureListeners,a);f.clearArray(this._queueModifyListeners)}_FireCancellable(b){this._IncreaseFireDepth();let a=!1;for(let c=0,d=this._captureListeners.length;c<d;++c)if(this._captureListeners[c](b),b.propagationStopped){a=!0;break}if(!a)for(let c=0,d=this._listeners.length;c<d&&(this._listeners[c](b),!b.propagationStopped);++c);this._DecreaseFireDepth();return!b.defaultPrevented}_FireNonCancellable(b){this._IncreaseFireDepth();
for(let a=0,c=this._captureListeners.length;a<c;++a)this._captureListeners[a](b);for(let a=0,c=this._listeners.length;a<c;++a)this._listeners[a](b);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&0<this._queueModifyListeners.length&&this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(b){b?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(b){let a=[];for(let c=0,d=this._captureListeners.length;c<
d;++c){let e=this._captureListeners[c];a.push(f.Asyncify(()=>e(b)))}for(let c=0,d=this._listeners.length;c<d;++c){let e=this._listeners[c];a.push(f.Asyncify(()=>e(b)))}return Promise.all(a).then(()=>!b.defaultPrevented)}_FireAndWait_AsyncOptional(b){const a=[];this._IncreaseFireDepth();for(let d=0,e=this._captureListeners.length;d<e;++d){var c=this._captureListeners[d](b);c instanceof Promise&&a.push(c)}for(let d=0,e=this._listeners.length;d<e;++d)c=this._listeners[d](b),c instanceof Promise&&a.push(c);
this._DecreaseFireDepth();return a.length?Promise.all(a).then(()=>!b.defaultPrevented):!b.defaultPrevented}async _FireAndWaitAsync(b){return await this._FireAndWait_AsyncOptional(b)}async _FireAndWaitAsyncSequential(b){this._IncreaseFireDepth();for(let c=0,d=this._captureListeners.length;c<d;++c){var a=this._captureListeners[c](b);a instanceof Promise&&await a}for(let c=0,d=this._listeners.length;c<d;++c)a=this._listeners[c](b),a instanceof Promise&&await a;this._DecreaseFireDepth();return!b.defaultPrevented}*_FireAsGenerator(b){this._IncreaseFireDepth();
for(let c=0,d=this._captureListeners.length;c<d;++c){var a=this._captureListeners[c](b);f.IsIterator(a)&&(yield*a)}for(let c=0,d=this._listeners.length;c<d;++c)a=this._listeners[c](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 c=this._eventHandlers.get(b);return c?
c:a?(c=f.New(f.Event.Handler,b),this._eventHandlers.set(b,c),c):null}HasAnyHandlerFor(b){return this._eventHandlers.has(b)}addEventListener(b,a,c){this._GetHandlerByType(b,!0)._AddListener(a,!!c)}removeEventListener(b,a,c){let d=this._GetHandlerByType(b,!1);d&&(d._RemoveListener(a,!!c),d._IsEmpty()&&this._eventHandlers.delete(b))}dispatchEvent(b){const a=this._GetHandlerByType(b.type,!1);return a?b.cancelable?a._FireCancellable(b):a._FireNonCancellable(b):!0}dispatchEventAsync(b){const a=this._GetHandlerByType(b.type,
!1);if(!a)return Promise.resolve(!0);b.isAsync=!0;return a._FireAsync(b)}async dispatchEventAndClearAsync(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return!0;this._eventHandlers.delete(b.type);b.isAsync=!0;b=await a._FireAsync(b);a.Release();return b}async dispatchEventAndWaitAsync(b){const a=this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsync(b):!0}dispatchEventAndWait_AsyncOptional(b){const a=this._GetHandlerByType(b.type,!1);return a?a._FireAndWait_AsyncOptional(b):!0}async dispatchEventAndWaitAsyncSequential(b){const a=
this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsyncSequential(b):!0}dispatchGeneratorEvent(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return null;if(b.cancelable)throw Error("not supported");return a._FireAsGenerator(b)}SetDelayRemoveEventsEnabled(b){for(const a of this._eventHandlers.values())a.SetDelayRemoveEventsEnabled(b)}}}
{"use strict";const f=self.C3,b="undefined"!==typeof requestIdleCallback;let a=[],c=-1,d=0;function e(m){c=b&&0===d?requestIdleCallback(h,{timeout:35}):setTimeout(h,0<d?1:m)}function h(m){c=-1;if(a.length){var u=performance.now(),w=0;do{g(a.shift());var q=performance.now();++w;var t=(q-u)/w*1.1}while(a.length&&(b&&0===d&&"undefined"!==typeof m?t<m.timeRemaining():12>q-u+t));-1===c&&a.length&&e(Math.max(16-(q-u),4))}}function g(m){let u;try{u=m.func()}catch(w){m.reject(w);return}m.resolve(u)}let l=
f.QueryString.Has("disable-asyncify");l&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously.");f.Asyncify=function(m){let u=null;f.isDebug&&(u=f.GetCallStack());return new Promise((w,q)=>{a.push({func:m,resolve:w,reject:q,stack:u});l?g(a.pop()):-1===c&&e(16)})};f.Asyncify.SetHighThroughputMode=function(m){if(m)++d;else if(--d,0>d)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 c=-1,d=-1,e=new Set;function h(){d=c=-1;let g=Date.now();for(let l of e)if(l._CheckTimeout(g)){let m=l._GetDeadline();if(-1===d||m<d)d=m}else e.delete(l);-1!==d&&(c=self.setTimeout(h,Math.max(d-g+100,1E3)))}f.IdleTimeout=class{constructor(g,l){this._callback=g;this._timeout=1E3*l;this._deadline=0;this._isActive=!1}Reset(){let g=f.FastGetDateNow();this._deadline=
g+this._timeout;this._isActive||(e.add(this),this._isActive=!0);-1===c?(d=this._deadline,c=self.setTimeout(h,this._timeout+100)):this._deadline<d&&d>g+1E3&&(self.clearTimeout(c),d=this._deadline,c=self.setTimeout(h,this._timeout+100))}_CheckTimeout(g){return g>=this._deadline?this._callback()?(this._deadline=g+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(e.delete(this),this._isActive=!1,0===e.size&&-1!==c&&(self.clearTimeout(c),d=c=-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,c,d,e,h){if("undefined"===typeof e||null===e)e=!1;else if("boolean"!==typeof e&&"object"!==typeof e)throw new TypeError("invalid event listener options");h&&
(d=d.bind(h));if(c.includes(" ")){c=c.split(" ");h=new f.CompositeDisposable;for(let g of c)a.addEventListener(g,d,e),h.Add(f.New(f.Disposable,()=>a.removeEventListener(g,d,e)));return h}a.addEventListener(c,d,e);return f.New(f.Disposable,()=>a.removeEventListener(c,d,e))}};f.StubDisposable=class extends f.Disposable{SetAction(b){this._disposeAction=b}};f.CompositeDisposable=class extends f.Disposable{constructor(...b){super();this._disposables=new Set;for(let a of b)this.Add(a)}Add(...b){if(this._disposed)throw Error("already disposed");
for(let a of b)this._disposables.add(a)}Remove(b){if(this._disposed)throw Error("already disposed");this._disposables.delete(b)}RemoveAll(){if(this._disposed)throw Error("already disposed");if(this._disposables){for(let b of this._disposables)b.Dispose();this._disposables.clear()}}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw Error("already disposed");this._disposed=!0;for(let b of this._disposables)b.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}}
{"use strict";const f=self.C3;f.KahanSum=class extends f.DefendedBase{constructor(){super();this._sum=this._t=this._y=this._c=0}Add(b){this._y=+b-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(b){this._sum-=+b}Get(){return this._sum}Reset(){this._sum=this._t=this._y=this._c=0}Set(b){this._t=this._y=this._c=0;this._sum=+b}Release(){}}}
{"use strict";const f=self.C3,b={RBnode:function(a){this.tree=a;this.left=this.right=this.tree.sentinel;this.parent=null;this.color=!1;this.key=null},RedBlackSet:function(a){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=a||this.default_compare}};b.RedBlackSet.prototype.default_compare=function(a,c){return a<c?-1:c<a?1:0};b.RedBlackSet.prototype.clone=function(){var a=new b.RedBlackSet(this.compare);a.insertAll(this);
return a};b.RedBlackSet.prototype.clear=function(){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel};b.RedBlackSet.prototype.leftRotate=function(a){var c=a.right;a.right=c.left;c.left!=this.sentinel&&(c.left.parent=a);c.parent=a.parent;a.parent==this.sentinel?this.root=c:a==a.parent.left?a.parent.left=c:a.parent.right=c;c.left=a;a.parent=c};b.RedBlackSet.prototype.rightRotate=function(a){var c=a.left;a.left=c.right;c.right!=
this.sentinel&&(c.right.parent=a);c.parent=a.parent;a.parent==this.sentinel?this.root=c:a==a.parent.right?a.parent.right=c:a.parent.left=c;c.right=a;a.parent=c};b.RedBlackSet.prototype.insert=function(a){if(this.contains(a))this.get_(a).key=a;else{var c=new b.RBnode(this);c.key=a;a=this.sentinel;for(var d=this.root;d!=this.sentinel;)a=d,d=0>this.compare(c.key,d.key)?d.left:d.right;c.parent=a;a==this.sentinel?this.root=c:0>this.compare(c.key,a.key)?a.left=c:a.right=c;c.left=this.sentinel;c.right=this.sentinel;
c.color=!0;this.insertFixup(c);this.size++}};b.RedBlackSet.prototype.insertFixup=function(a){for(;a!=this.sentinel&&a!=this.root&&1==a.parent.color;)if(a.parent==a.parent.parent.left){var c=a.parent.parent.right;1==c.color?(a.parent.color=!1,c.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.right&&(a=a.parent,this.leftRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.rightRotate(a.parent.parent))}else c=a.parent.parent.left,1==c.color?(a.parent.color=
!1,c.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.left&&(a=a.parent,this.rightRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.leftRotate(a.parent.parent));this.root.color=!1};b.RedBlackSet.prototype.delete_=function(a){var c=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a);var d=c.left!=this.sentinel?c.left:c.right;d.parent=c.parent;c.parent==this.sentinel?this.root=d:c==c.parent.left?c.parent.left=d:c.parent.right=
d;c!=a&&(a.key=c.key);0==c.color&&this.deleteFixup(d);this.size--};b.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&0==a.color;)if(a==a.parent.left){var c=a.parent.right;1==c.color&&(c.color=!1,a.parent.color=!0,this.leftRotate(a.parent),c=a.parent.right);0==c.left.color&&0==c.right.color?(c.color=!0,a=a.parent):(0==c.right.color&&(c.left.color=!1,c.color=!0,this.rightRotate(c),c=a.parent.right),c.color=a.parent.color,a.parent.color=!1,c.right.color=!1,this.leftRotate(a.parent),
a=this.root)}else c=a.parent.left,1==c.color&&(c.color=!1,a.parent.color=!0,this.rightRotate(a.parent),c=a.parent.left),0==c.right.color&&0==c.left.color?(c.color=!0,a=a.parent):(0==c.left.color&&(c.right.color=!1,c.color=!0,this.leftRotate(c),c=a.parent.left),c.color=a.parent.color,a.parent.color=!1,c.left.color=!1,this.rightRotate(a.parent),a=this.root);a.color=!1};b.RedBlackSet.prototype.remove=function(a){a=this.get_(a);if(a!=this.sentinel){var c=a.key;this.delete_(a);return c}return null};b.RedBlackSet.prototype.removeSwapped=
function(a,c){this.remove(c)};b.RedBlackSet.prototype.min=function(a){for(;a.left!=this.sentinel;)a=a.left;return a};b.RedBlackSet.prototype.max=function(a){for(;a.right!=this.sentinel;)a=a.right;return a};b.RedBlackSet.prototype.successor_=function(a){if(a.right!=this.sentinel)return this.min(a.right);for(var c=a.parent;c!=this.sentinel&&a==c.right;)a=c,c=c.parent;return c};b.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var c=a.parent;c!=this.sentinel&&
a==c.left;)a=c,c=c.parent;return c};b.RedBlackSet.prototype.successor=function(a){if(0<this.size){a=this.get_(a);if(a==this.sentinel)return null;if(a.right!=this.sentinel)return this.min(a.right).key;for(var c=a.parent;c!=this.sentinel&&a==c.right;)a=c,c=c.parent;return c!=this.sentinel?c.key:null}return null};b.RedBlackSet.prototype.predecessor=function(a){if(0<this.size){a=this.get_(a);if(a==this.sentinel)return null;if(a.left!=this.sentinel)return this.max(a.left).key;for(var c=a.parent;c!=this.sentinel&&
a==c.left;)a=c,c=c.parent;return c!=this.sentinel?c.key:null}return null};b.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};b.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key};b.RedBlackSet.prototype.get_=function(a){for(var c=this.root;c!=this.sentinel&&0!=this.compare(c.key,a);)c=0>this.compare(a,c.key)?c.left:c.right;return c};b.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key};b.RedBlackSet.prototype.getValues=function(){var a=
[];this.forEach(function(c){a.push(c)});return a};b.RedBlackSet.prototype.insertAll=function(a){if("array"==b.typeOf(a))for(var c=0;c<a.length;c++)this.insert(a[c]);else if("function"==b.typeOf(a.forEach))a.forEach(this.insert,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),c=0;c<a.length;c++)this.insert(a[c]);else if("object"==b.typeOf(a))for(c in a)this.insert(a[c])};b.RedBlackSet.prototype.removeAll=function(a){if("array"==b.typeOf(a))for(var c=0;c<a.length;c++)this.remove(a[c]);
else if("function"==b.typeOf(a.forEach))a.forEach(this.removeSwapped,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),c=0;c<a.length;c++)this.remove(a[c]);else if("object"==b.typeOf(a))for(c in a)this.remove(a[c])};b.RedBlackSet.prototype.containsAll=function(a){if("array"==b.typeOf(a)){for(var c=0;c<a.length;c++)if(!this.contains(a[c]))return!1;return!0}if("function"==b.typeOf(a.forEach))return a.every(this.contains,this);if("function"==b.typeOf(a.getValues)){a=a.getValues();for(c=
0;c<a.length;c++)if(!this.contains(a[c]))return!1;return!0}if("object"==b.typeOf(a)){for(c in a)if(!this.contains(a[c]))return!1;return!0}};b.RedBlackSet.prototype.range=function(a,c){var d=[];this.traverseFromTo(function(e){d.push(e)},a,c);return d};b.RedBlackSet.prototype.traverse=function(a,c){if(!this.isEmpty())for(var d=this.min(this.root);d!=this.sentinel&&!a.call(c,d.key,this);)d=this.successor_(d)};b.RedBlackSet.prototype.traverseFrom=function(a,c,d){if(!this.isEmpty())for(c=this.get_(c);c!=
this.sentinel&&!a.call(d,c.key,this);)c=this.successor_(c)};b.RedBlackSet.prototype.traverseTo=function(a,c,d){if(!this.isEmpty()){var e=this.min(this.root);for(c=this.get_(c);e!=c&&!a.call(d,e.key,this);)e=this.successor_(e)}};b.RedBlackSet.prototype.traverseFromTo=function(a,c,d,e){if(!this.isEmpty())for(c=this.get_(c),d=this.get_(d);c!=d&&!a.call(e,c.key,this);)c=this.successor_(c)};b.RedBlackSet.prototype.traverseBackwards=function(a,c){if(!this.isEmpty())for(var d=this.max(this.root);d!=this.sentinel&&
!a.call(c,d.key,this);)d=this.predeccessor_(d)};b.RedBlackSet.prototype.forEach=function(a,c){if(!this.isEmpty())for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))a.call(c,d.key,d.key,this)};b.RedBlackSet.prototype.some=function(a,c){if(this.isEmpty())return!1;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))if(a.call(c,d.key,d.key,this))return!0;return!1};b.RedBlackSet.prototype.every=function(a,c){if(this.isEmpty())return!1;for(var d=this.min(this.root);d!=this.sentinel;d=
this.successor_(d))if(!a.call(c,d.key,d.key,this))return!1;return!0};b.RedBlackSet.prototype.map=function(a,c){var d=[];if(this.isEmpty())return d;for(var e=this.min(this.root);e!=this.sentinel;e=this.successor_(e))d.push(a.call(c,e.key,e.key,this));return d};b.RedBlackSet.prototype.filter=function(a,c){var d=[];if(this.isEmpty())return d;for(var e=this.min(this.root);e!=this.sentinel;e=this.successor_(e))a.call(c,e.key,e.key,this)&&d.push(e.key);return d};b.RedBlackSet.prototype.getCount=function(){return this.size};
b.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};b.RedBlackSet.prototype.isSubsetOf=function(a){var c=b.getCount(a);if(this.getCount()>c)return!1;c=0;if(this.isEmpty())return!0;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))b.contains.call(a,a,d.key)&&c++;return c==this.getCount()};b.RedBlackSet.prototype.intersection=function(a){var c=new b.RedBlackSet(this.compare);if(this.isEmpty())return c;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))a.contains.call(a,
d.key,d.key,this)&&c.insert(d.key);return c};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 c of this._queueRemove)this._rbSet.remove(c);this._queueRemove.clear();for(const c of this._queueInsert)this._rbSet.insert(c);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){var a=
this._rbSet;for(let c=a.min(a.root);c!=a.sentinel;c=a.successor_(c))yield c.key}}[Symbol.iterator](){return this.values()}}}
{"use strict";const f=self.C3;f.PromiseThrottle=class{constructor(b=f.hardwareConcurrency){this._maxParallel=b;this._queue=[];this._activeCount=0}Add(b){return new Promise((a,c)=>{this._queue.push({func:b,resolve:a,reject:c});this._MaybeStartNext()})}_FindInQueue(b){for(let a=0,c=this._queue.length;a<c;++a)if(this._queue[a].func===b)return a;return-1}RemoveAndResolve(b,a){b=this._FindInQueue(b);if(-1===b)throw Error("cannot find promise to resolve");this._queue[b].resolve(a);this._queue.splice(b,
1)}RemoveAndReject(b,a){b=this._FindInQueue(b);if(-1===b)throw Error("cannot find promise to reject");this._queue[b].reject(a);this._queue.splice(b,1)}async _MaybeStartNext(){if(this._queue.length&&!(this._activeCount>=this._maxParallel)){this._activeCount++;var b=this._queue.shift();try{const a=await b.func();b.resolve(a)}catch(a){b.reject(a)}this._activeCount--;this._MaybeStartNext()}}static async Batch(b,a){const c=[];let d=!1;const e=async g=>{for(;(g=a.pop())&&!d;)try{c.push(await g())}catch(l){throw d=
!0,l;}},h=[];for(;b--;)h.push(e());await Promise.all(h);return c}}}
{"use strict";const f=self.C3;f.RateLimiter=class{constructor(b,a,c){this._callback=b;this._interval=a;this._intervalOnBattery=c||2*a;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._canRunImmediate=this._ignoreReset=!1;this._callbackArguments=null}SetCanRunImmediate(b){this._canRunImmediate=!!b}_GetInterval(){return"undefined"!==typeof 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,c=this._GetInterval();a>=c&&this._canRunImmediate?(this._lastCallTime=b,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(c-a,4))}}_RunCallback(){this._ignoreReset=!0;const b=this._callbackArguments;this._callbackArguments=null;b?this._callback(...b):this._callback();this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=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,c,d,e,h){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(b,a,c,d,e,h)}SetReleaseResultCallback(b){this._releaseResultCallback=b}ReleaseResult(b){if(!this._releaseResultCallback)throw Error("no release result callback set");this._releaseResultCallback(b)}SetRedrawCallback(b){this._redrawCallback=b}Redraw(){if(!this._redrawCallback)throw Error("no redraw callback set");this._redrawCallback()}AddImage(b){let a=this._images.get(b);
a||(a=f.New(f.SVGRasterImage,this,b),this._images.set(b,a));a.IncReference();return a}_RemoveImage(b){this._images.delete(b.GetDataSource())}OnTexturesChanged(){for(const b of this._images.values())b.ReleaseRasterizedResult(),b.ForceRasterAgain()}}}
{"use strict";const 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(c=>{this._baseWidth=c[0];this._baseHeight=c[1];this._manager.Redraw()}).catch(c=>{console.error("[SVG] Error loading SVG: ",c);this._hadError=!0;this._manager.Redraw()});this._rasterImageHeight=this._rasterImageWidth=this._rasterSurfaceHeight=this._rasterSurfaceWidth=0;this._isRasterizing=
!1;this._rasterizedResult=null;this._hadError=this._forceRaster=!1}Release(){if(0>=this._refCount)throw Error("already released");this._refCount--;0===this._refCount&&this._Release()}ReleaseRasterizedResult(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null)}_Release(){this.ReleaseRasterizedResult();this._manager._RemoveImage(this);this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return 0<
this._refCount}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=!0}async StartRasterForSize(b,a,c){if(0!==a&&0!==c&&!this._hadError&&!this._isRasterizing){var d=f.nextHighestPowerOfTwo(Math.ceil(a)),e=f.nextHighestPowerOfTwo(Math.ceil(c)),h=Math.max(d,e);2048<h&&(h=2048/h,a*=h,c*=h,d=Math.min(Math.ceil(d*h),2048),e=Math.min(Math.ceil(e*h),2048));a<d&&c<e&&(c=a/c,d/e>c?(a=e*c,c=e):(a=d,c=d/c));this._manager.IsNpotSurfaceAllowed()&&(d=Math.ceil(a),e=Math.ceil(c));
d<=this._rasterSurfaceWidth&&e<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=!0,this._rasterSurfaceWidth=d,this._rasterSurfaceHeight=e,b=await this._manager.RasterAtSize(this._dataSource,b,this._rasterSurfaceWidth,this._rasterSurfaceHeight,a,c),this._manager&&(this.ReleaseRasterizedResult(),this._rasterizedResult=b,this._rasterImageWidth=a,this._rasterImageHeight=c,this._forceRaster=this._isRasterizing=!1,this._manager.Redraw()))}}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}}
{"use strict";const f=self.C3;f.UTF8_BOM="\ufeff";const b=new Set([..."0123456789"]);f.IsNumericChar=function(m){return b.has(m)};const a=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);f.IsWhitespaceChar=function(m){return a.has(m)};f.FilterWhitespace=function(m){return[...m].filter(u=>!f.IsWhitespaceChar(u)).join("")};f.IsStringAllWhitespace=function(m){for(const u of m)if(!f.IsWhitespaceChar(u))return!1;return!0};
f.IsUnprintableChar=function(m){return 1===m.length&&32>m.charCodeAt(0)};f.FilterUnprintableChars=function(m){return[...m].filter(u=>!f.IsUnprintableChar(u)).join("")};const c=new Set([..."0123456789.+-e"]);f.IsStringNumber=function(m){m=m.trim();if(!m.length)return!1;let u=m.charAt(0);if("-"!==u&&!b.has(u))return!1;for(let w of m)if(!c.has(w))return!1;return!0};f.RemoveTrailingDigits=function(m){let u=m.length;for(;0<u;){let w=m.charAt(u-1);if(!f.IsNumericChar(w))break;--u}return m.substr(0,u)};
f.IncrementNumberAtEndOf=function(m){let u=f.RemoveTrailingDigits(m);m=(m=m.substr(u.length))?(parseInt(m,10)+1).toString():"2";return u+m};const d=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#39;"]]);function e(m){return d.get(m)}const h=/[&<>"']/g;f.EscapeHTML=function(m){return m.replace(h,e)};f.EscapeJS=function(m){m=f.ReplaceAll(m,"\\","\\\\");m=f.ReplaceAll(m,'"','\\"');m=f.ReplaceAll(m,"\t","\\t");m=f.ReplaceAll(m,"\r","");return f.ReplaceAll(m,"\n","\\n")};f.EscapeXML=
function(m){m=f.ReplaceAll(m,"&","&amp;");m=f.ReplaceAll(m,"<","&lt;");m=f.ReplaceAll(m,">","&gt;");return f.ReplaceAll(m,'"',"&quot;")};const g=/[-[\]{}()*+?.,\\^$|#\s]/g;f.EscapeRegex=function(m){return m.replace(g,"\\$&")};f.FindAll=function(m,u,w=!1){if(!u)return[];w||(m=m.toLowerCase(),u=u.toLowerCase());w=u.length;var q=0;let t=[];for(;-1<(q=m.indexOf(u,q));)t.push(q),q+=w;return t};f.ReplaceAll=function(m,u,w){return m.replaceAll(u,()=>w)};f.ReplaceAllCaseInsensitive=function(m,u,w){return m.replace(new RegExp(f.EscapeRegex(u),
"gi"),()=>w)};f.SetElementContent=function(m,u){"string"===typeof u?m.textContent=u:u.isPlainText()?m.textContent=u.toString():(m.innerHTML=u.toHTML(),u instanceof f.BBString&&u.attachLinkHandlers(m))};f.StringLikeEquals=function(m,u){return m instanceof f.HtmlString||m instanceof f.BBString?m.equals(u):u instanceof f.HtmlString||u instanceof f.BBString?u.equals(m):m===u};f.StringSubstitute=function(m,...u){let w=m;for(let q=0,t=u.length;q<t;++q){const p=`{${q}}`;if(!m.includes(p))throw Error(`missing placeholder '${p}' in string substitution`);
w=w.replace(p,u[q].toString())}return w};f.StringSubstituteAllowMissing=function(m,...u){let w=m,q=-1,t=-1;for(let p=0,r=u.length;p<r;++p){const x=`{${p}}`;m.includes(x)?(t=p,w=w.replace(x,u[p].toString())):-1===q&&(q=p)}if(0<=q&&0<=t&&q<t)throw Error(`missing placeholder '${q}' in string substitution`);return w};f.StringSubstituteMap=function(m,u){for(let [w,q]of Object.entries(u))m=m.replaceAll(w,q.toString());return m};f.SortAZCaseInsensitive=function(m,u){m=m.toLowerCase();u=u.toLowerCase();return m>
u?1:m<u?-1:0};f.FormatDataSize=function(m,u){u="common."+(u?"dataRates":"dataSizes")+".";const w=self.langSub;if(1024>m)return w(u+"bytes",m);if(1048576>m)return m/=1024,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"kilobytes",m);if(1073741824>m)return m/=1048576,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"megabytes",m);if(1099511627776>m)return m/=1073741824,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"gigabytes",m);m/=1099511627776;m=10>m?Math.round(10*m)/10:Math.round(m);return w(u+"terabytes",
m)};const l={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};f.FormatTime=function(m,u){u=Object.assign({},l,u);f.Lang.PushContext("common.time");const w=[],q=self.lang,t=self.langPluralSub;if(u.days){var p=Math.floor(m/86400);0<p&&(m-=86400*p,w.push(t(".days",null,p)))}u.hours&&(p=Math.floor(m/3600),0<p||w.length)&&(m-=3600*p,w.push(t(".hours",null,p)));u.minutes&&(p=Math.floor(m/60),0<p||w.length||!u.seconds)&&(m-=60*p,w.push(t(".minutes",null,p)));u.seconds&&w.push(t(".seconds",null,Math.floor(m%
60)));m=(u.approximate?q(".approx-prefix"):"")+w.join(q(".separator"));f.Lang.PopContext();return m};f.ZeroPad=function(m,u){let w=0>m?"-":"";m=Math.abs(m);m=m.toString();u-=m.length;for(let q=0;q<u;++q)w+="0";return w+m};f.StringToTitleCase=function(m){return m.toLowerCase().replace(/\b\w/g,u=>u.toUpperCase())};f.CompareVersionStrings=function(m,u){m=m.split(".").map(w=>w.trim());u=u.split(".").map(w=>w.trim());f.resizeArray(m,4,"0");f.resizeArray(u,4,"0");m=m.map(w=>parseInt(w,10));u=u.map(w=>parseInt(w,
10));for(let w=0;4>w;++w){const q=m[w]-u[w];if(0!==q)return 0>q?-1:1}return 0};f.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,m=>{const u=Math.floor(16*Math.random());return("x"===m?u:u&3|8).toString(16)})};f.StringHammingDistance=function(m,u){if(m.length!==u.length)throw Error("strings must be same length");let w=0;for(let q=0,t=m.length;q<t;++q)m.charAt(q)!==u.charAt(q)&&++w;return w};f.StringLevenshteinDistance=function(m,u){if(0===m.length)return u.length;
if(0===u.length)return m.length;let w,q,t,p;if(m.length>u.length){var r=m;m=u;u=r}p=Array(m.length+1);for(r=0;r<=m.length;r++)p[r]=r;for(r=1;r<=u.length;r++){q=r;for(w=1;w<=m.length;w++)t=u[r-1]===m[w-1]?p[w-1]:Math.min(p[w-1]+1,Math.min(q+1,p[w]+1)),p[w-1]=q,q=t;p[m.length]=q}return p[m.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,
c=/\[(\/?)([^\[\n]*?)\]/g;let d=null,e=0;function h(l,m,u){var w=b.get(u);if(w){if("string"===typeof w){if("a"!==w||m)return"<"+m+w+">";m=parseInt(u.substring(1),10)-1;if(0>m||m>=d.length)throw Error("invalid bbcode link substitution");w=d[m];if("string"===typeof w)return`<a href="${d[m]}">`;if("function"===typeof w)return`<a class="bblink${m}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(w))return l=w[0],w=w[1],m?"</"+l+">":`<${l} class="${w}">`}else return"class"===u?m?
"</span>":`<span class="bbclass${e++}">`:l}const g=/\n/g;f.BBString=class{constructor(l,m){this._bbstr=m&&m.noEscape?l:f.EscapeHTML(l);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(m&&(this._convertLineBreaks=!!m.convertLineBreaks,m.links)){if(9<m.links.length)throw Error("too many links");this._linkActions=m.links}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion=this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&
!this._needsLineBreakConversion&&!this._bbstr.includes("&");this._hasParsedFragments=!1;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){return this._hasAnyBBtags?this._bbstr.replace(a,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let l=this._bbstr;this._hasAnyBBtags&&(e=0,d=this._linkActions,l=l.replace(a,h),d=null);this._needsLineBreakConversion&&(l=l.replace(g,"<br>"));this._htmlstr=
l}return this._htmlstr}attachLinkHandlers(l){if(this._linkActions.length)for(let m=0,u=this._linkActions.length;m<u;++m){const w=this._linkActions[m];if("function"!==typeof w)continue;const q=l.querySelector(".bblink"+m);if(!q)throw Error("unable to attach BBString link handler");q.onclick=w}}equals(l){return l instanceof f.HtmlString?this.toHTML()===l.toHTML():l instanceof f.BBString?this._bbstr===l._bbstr:this._bbstr===l}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const l=
this._bbstr,m=[];let u=c.lastIndex=0;for(var w;null!==(w=c.exec(l));){var q=w.index;if(0<q&&"\\"===l.charAt(q-1))continue;var t=w[0],p=w[1];w=w[2];const r=l.substring(u,q);u=q+t.length;r&&this._fragments.push({text:r,styles:m.slice(0)});if(w)if(p)for(w=w.toLowerCase(),q=m.length-1;0<=q;--q){if(m[q].tag===w){m.splice(q,1);break}}else q=w,t=null,p=w.indexOf("="),-1!==p?(q=w.substring(0,p).toLowerCase(),t=w.substring(p+1)):q=q.toLowerCase(),m.push({tag:q,param:t})}u<l.length&&this._fragments.push({text:l.substring(u),
styles:m.slice(0)});for(const r of this._fragments)r.text=this._ProcessBBCodeEscapeSequences(r.text);this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(l){l=f.ReplaceAll(l,"\\[","[");return f.ReplaceAll(l,"\\\\","\\")}static StripTags(l){return f.New(f.BBString,l,{noEscape:!0}).toPlainText()}static StripAnyTags(l){return l.replace(c,"")}}}
{"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 c=0,d=0,e=0,h=0,g=0;for(const l of b)-1===l.width&&(b=a(l.text,l.styles),l.width=b.width,l.height=b.height,l.fontBoundingBoxAscent=b.fontBoundingBoxAscent||0,l.fontBoundingBoxDescent=b.fontBoundingBoxDescent||0,l.topToAlphabeticDistance=b.topToAlphabeticDistance||0),c+=l.width,d=Math.max(d,l.height),e=Math.max(e,l.fontBoundingBoxAscent),
h=Math.max(h,l.fontBoundingBoxDescent),g=Math.max(g,l.topToAlphabeticDistance);return{width:c,height:d,fontBoundingBoxAscent:e,fontBoundingBoxDescent:h,topToAlphabeticDistance:g}}_AddLine(b,a,c,d,e,h){this._lines.push({fragments:b,width:a,height:c,fontBoundingBoxAscent:d,fontBoundingBoxDescent:e,topToAlphabeticDistance:h})}WordWrap(b,a,c,d,e){"string"===typeof b&&(b=[{text:b,styles:[]}]);f.clearArray(this._lines);if(!(!b.length||1===b.length&&!b[0].text.length||2>c)){if(1===b.length){var h=b[0];const g=
h.text;h=h.styles;if(100>=g.length&&!g.includes("\n")){let {width:l,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:w,topToAlphabeticDistance:q}=a(g,h);l+=e;u=u||0;w=w||0;q=q||0;if(l<=c){this._AddLine([{text:g,styles:h,width:l,height:m,fontBoundingBoxAscent:u,fontBoundingBoxDescent:w,topToAlphabeticDistance:q}],l,m,u,w,q);return}}}if("word"===d)d=this._TokeniseWords(b);else{d=[];for(const g of b)f.appendArray(d,[...g.text].map(l=>[{text:l,styles:g.styles}]))}this._WrapText(d,a,c,e)}}_TokeniseWords(b){const a=
[];let c=[],d=!1;for(const h of b){var e=h.text;b=h.styles;for(const g of e)"\n"===g?(0<c.length&&a.push(c),a.push([{text:"\n",styles:b}]),c=[]):0===c.length?(c.push({text:g,styles:b}),d=f.IsWhitespaceChar(g)):(e=f.IsWhitespaceChar(g),e===d?(e=c.at(-1),e.styles===b?e.text+=g:c.push({text:g,styles:b})):(a.push(c),c=[],c.push({text:g,styles:b}),d=e))}0<c.length&&a.push(c);return a}_CopyLine(b){return b.map(a=>({text:a.text,styles:a.styles,width:a.width,height:a.height,fontBoundingBoxAscent:a.fontBoundingBoxAscent,
fontBoundingBoxDescent:a.fontBoundingBoxDescent,topToAlphabeticDistance:a.topToAlphabeticDistance}))}_AddWordToLine(b,a){var c=b.length?b.at(-1):null;let d=0;c&&a[0].styles===c.styles&&(c.text+=a[0].text,c.width=-1,c.height=-1,c.fontBoundingBoxAscent=-1,c.fontBoundingBoxDescent=-1,c.topToAlphabeticDistance=-1,d=1);for(c=a.length;d<c;++d){const e=a[d];b.push({text:e.text,styles:e.styles,width:-1,height:-1,fontBoundingBoxAscent:-1,fontBoundingBoxDescent:-1,topToAlphabeticDistance:-1})}}_WrapText(b,
a,c,d){let e=[],h=0,g=0,l=0,m=0;var u=0;for(const w of b){if(1===w.length&&"\n"===w[0].text){0===g&&(u=a(" ",w[0].styles),g=u.height,l=u.fontBoundingBoxAscent||0,m=u.fontBoundingBoxDescent||0,u=u.topToAlphabeticDistance||0);this._AddLine(e,h,g,l,m,u);e=[];u=m=l=g=h=0;continue}b=this._CopyLine(e);this._AddWordToLine(b,w);const q=this._MeasureLine(b,a),t=q.width;t>=c?(0<e.length&&this._AddLine(e,h,g,l,m,u),e=[],f.IsStringAllWhitespace(w[0].text)?u=m=l=g=h=0:(this._AddWordToLine(e,w),u=this._MeasureLine(e,
a),h=u.width,g=u.height,l=u.fontBoundingBoxAscent,m=u.fontBoundingBoxDescent,u=u.topToAlphabeticDistance)):(e=b,h=t,g=q.height,l=q.fontBoundingBoxAscent,m=q.fontBoundingBoxDescent,u=q.topToAlphabeticDistance)}0<e.length&&this._AddLine(e,h,g,l,m,u);this._TrimLinesTrailingWhitespace(a,d)}_TrimLinesTrailingWhitespace(b,a){for(const d of this._lines){const e=d.fragments;if(!e.length)continue;let h=e.at(-1);var c=h.text;const g=c.trimEnd();if(!g)d.width-=h.width,e.pop();else if(g.length<c.length){c=b(g,
h.styles).width;const l=h.width-c;h.width=c;h.text=g;d.width-=l}0!==a&&0<e.length&&(h=e.at(-1),h.width+=a,d.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";const f=self.C3,b=self.glMatrix,a=b.vec3,c=b.vec4,d=b.mat4,e=a.create(),h=a.create(),g=a.create(),l=c.create(),m=d.create(),u=a.create(),w=a.create(),q=a.create(),t=a.create(),p=a.create(),r=a.create(),x=a.create(),y=a.create(),E=c.fromValues(0,0,1,1);f.Gfx={Project(B,I,L,P,S,U,V){const Z=P[0]*B+P[4]*I+P[8]*L+P[12],ma=P[1]*B+P[5]*I+P[9]*L+P[13],va=P[2]*B+P[6]*I+P[10]*L+P[14];P=P[3]*B+P[7]*I+P[11]*L+P[15];B=S[0]*Z+S[4]*ma+S[8]*va+S[12]*P;I=S[1]*Z+S[5]*ma+S[9]*va+S[13]*P;L=S[2]*Z+S[6]*
ma+S[10]*va+S[14]*P;S=S[3]*Z+S[7]*ma+S[11]*va+S[15]*P;if(0===S)return!1;S=1/S;V[0]=(B*S*.5+.5)*U[2]+U[0];V[1]=(I*S*.5+.5)*U[3]+U[1];V[2]=.5*(1+L*S);return!0},Unproject(B,I,L,P,S,U,V){d.multiply(m,S,P);if(null===d.invert(m,m))return!1;l[0]=(B-U[0])/U[2]*2-1;l[1]=(I-U[1])/U[3]*2-1;l[2]=2*L-1;l[3]=1;c.transformMat4(l,l,m);if(0===l[3])return!1;l[3]=1/l[3];V[0]=l[0]*l[3];V[1]=l[1]*l[3];V[2]=l[2]*l[3];return!0},UnprojectScreenToWorldZ(B,I,L,P,S,U,V){if(!f.Gfx.Unproject(B,I,0,P,S,U,e)||!f.Gfx.Unproject(B,
I,1,P,S,U,h))return!1;a.subtract(h,h,e);a.set(g,0,0,1);B=-L;I=a.dot(g,h);L=0;if(0===I){if(0!==a.dot(g,e)+B)return!1}else if(L=-(a.dot(e,g)+B)/I,0>L)return!1;a.scaleAndAdd(V,e,h,L);return!0}};function H(B,I,L,P){a.subtract(e,L,I);a.subtract(h,B,I);a.cross(g,e,h);a.normalize(g,g);P.set(g[0],g[1],g[2],a.dot(B,g))}function A(B,I,L,P,S,U,V){const Z=V.x,ma=V.y,va=V.z,Na=V.w,Ea=V.xF,Ia=V.yF;V=V.zF;const Ma=1-Ea,Fa=1-Ia,ya=1-V;return Z*B*Ea+Z*P*Ma+ma*I*Ia+ma*S*Fa+va*L*V+va*U*ya>=Na?!0:Z*P*Ea+Z*B*Ma+ma*S*
Ia+ma*I*Fa+va*U*V+va*L*ya>Na}function F(B,I,L,P){return P.x*B+P.y*I+P.z*L>=P.w}class J{constructor(){this.zF=this.yF=this.xF=this.w=this.z=this.y=this.x=NaN}set(B,I,L,P){this.x=B;this.y=I;this.z=L;this.w=P;this.xF=0<B?1:0;this.yF=0<I?1:0;this.zF=0<L?1:0}}f.Gfx.ViewFrustum=class{constructor(){this._leftP=new J;this._topP=new J;this._rightP=new J;this._bottomP=new J;this._nearP=new J;this._farP=new J}CalculatePlanes(B,I){f.Gfx.Unproject(0,1,0,B,I,E,u);f.Gfx.Unproject(1,1,0,B,I,E,w);f.Gfx.Unproject(0,
0,0,B,I,E,q);f.Gfx.Unproject(1,0,0,B,I,E,t);f.Gfx.Unproject(0,1,1,B,I,E,p);f.Gfx.Unproject(1,1,1,B,I,E,r);f.Gfx.Unproject(0,0,1,B,I,E,x);f.Gfx.Unproject(1,0,1,B,I,E,y);H(q,u,p,this._leftP);H(u,w,r,this._topP);H(w,t,y,this._rightP);H(t,q,x,this._bottomP);H(x,p,r,this._farP);H(t,w,u,this._nearP)}ContainsAABB(B,I,L,P,S,U){return A(B,I,L,P,S,U,this._leftP)&&A(B,I,L,P,S,U,this._topP)&&A(B,I,L,P,S,U,this._rightP)&&A(B,I,L,P,S,U,this._bottomP)&&A(B,I,L,P,S,U,this._nearP)&&A(B,I,L,P,S,U,this._farP)}IsBehindNearPlane(B,
I,L){return!F(B,I,L,this._nearP)}}}
{"use strict";const f=self.C3,b=self.glMatrix,a=b.vec3,c=b.vec4,d=b.mat4,e=d.create(),h=a.fromValues(0,0,0),g=a.fromValues(0,0,0),l=a.fromValues(0,0,0),m=a.fromValues(0,1,0);c.fromValues(0,0,0,0);const u=new f.Quad,w=new f.Rect,q=new f.Quad(0,0,1,0,1,1,0,1);f.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._fovY=f.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=d.create();this._matMV=d.create();this._allShaderPrograms=[];this._shaderProgramsByName=new Map;this._spSmoothLineFill=
this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._currentZ=this._baseZ=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];this._lineOffset=.5;this._lineOffsetStack=
[this._lineOffset];this._frameNumber=0;this._enableMipmaps=!0;this._hasMajorPerformanceCaveat=!1}FillIndexBufferData(t){let p=0,r=t.length,x=0;for(;p<r;)t[p++]=x,t[p++]=x+1,t[p++]=x+2,t[p++]=x,t[p++]=x+2,t[p++]=x+3,x+=4}_ClearState(){this._currentZ=this._baseZ=0;this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._ClearAllShaderPrograms()}InitState(){this._ClearState();
this._currentStateGroup=null}OnDeviceOrContextLost(){for(const t of this._allShaderPrograms)t.Release();this._ClearState()}GetWidth(){return this._width}GetHeight(){return this._height}GetDefaultCameraZ(){return 100}GetNearZ(){return 1}GetFarZ(){return 1E4}GetFovY(){return this._fovY}_GetTanFovYDiv2(){return this._tan_fovY_2}CalculatePerspectiveMatrix(t,p,r=.5,x=.5){const y=this.GetNearZ(),E=this.GetFarZ();var H=this.GetFovY();if(.5===r&&.5===x)this.IsWebGPU()?d.perspectiveZO(t,H,p,y,E):d.perspective(t,
H,p,y,E);else{r=1-r;H=2*r-2;r*=2;const A=2*x-2;x*=2;const F=this._GetTanFovYDiv2()*y;p*=F;d.frustum(t,H*p,r*p,A*F,x*F,y,E)}}CalculateOrthographicMatrix(t,p,r,x=1){var y=self.devicePixelRatio;const E=2*this.GetDefaultCameraZ()*y*this._GetTanFovYDiv2()/r;p=p*E/(2*y*x);r=r*E/(2*y*x);x=-p;y=-r;this.IsWebGPU()?d.orthoZO(t,x,p,y,r,this.GetNearZ(),this.GetFarZ()):d.ortho(t,x,p,y,r,this.GetNearZ(),this.GetFarZ())}CalculateLookAtModelView(t,p,r,x,y=this.GetHeight()){y=2*this.GetDefaultCameraZ()*self.devicePixelRatio*
this._GetTanFovYDiv2()/y;a.set(l,y,-y,1);a.multiply(h,p,l);a.multiply(g,r,l);d.lookAt(t,h,g,x||m);d.scale(t,t,l)}CalculateLookAtModelView2(t,p,r,x,y,E,H){a.set(h,t,p,r);a.set(g,x,y,E);this.CalculateLookAtModelView(e,h,g,m,H);return e}_AddShaderProgram(t){this._allShaderPrograms.push(t);this._shaderProgramsByName.set(t.GetName(),t)}_RemoveShaderProgram(t){const p=this._allShaderPrograms.indexOf(t);-1!==p&&this._allShaderPrograms.splice(p,1);this._shaderProgramsByName.delete(t.GetName())}_ClearAllShaderPrograms(){f.clearArray(this._allShaderPrograms);
this._shaderProgramsByName.clear()}GetShaderProgramByName(t){return this._shaderProgramsByName.get(t)||null}GetTextureFillShaderProgram(){return this._spTextureFill}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}GetPointsRenderingProgram(){return this._spPoints}SetPointsRenderingProgram(){this.SetProgram(this._spPoints)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}_SetCurrentStateGroup(t){this._currentStateGroup=
t}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(t,p,r,x){const y=f.Gfx.StateGroup.MakeKey(t,p,r,x);let E=this._stateGroups.get(y);E||(E=f.New(f.Gfx.StateGroup,this,t,p,r,x),this._stateGroups.set(y,E));E.AddRef();return E}ReleaseStateGroup(t){t.DecRef();0===t._GetRefCount()&&(this._currentStateGroup===t&&(this._currentStateGroup=null),this._stateGroups.delete(t.GetKey()),t.Release())}_InitBlendModeData(t){f.clearArray(this._blendModeTable);this._namedBlendModeMap.clear();
let p=0;for(const r of t){t=r[0];const x=r[1],y=r[2];this._blendModeTable.push([x,y]);this._namedBlendModeMap.set(t,{number:p,srcBlend:x,destBlend:y});p++}}_GetBlendByIndex(t){return this._blendModeTable[t]}GetSrcBlendByIndex(t){return this._GetBlendByIndex(t)[0]}GetDestBlendByIndex(t){return this._GetBlendByIndex(t)[1]}GetNamedBlend(t){t=this._namedBlendModeMap.get(t);if("undefined"===typeof t)throw Error("invalid blend name");return t}NamedBlendToNumber(t){t=this._namedBlendModeMap.get(t);if("undefined"===
typeof t)throw Error("invalid blend name");return t.number}SetBaseZ(t){this._baseZ=t}GetBaseZ(){return this._baseZ}SetCurrentZ(t){this._currentZ=t;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}Line(t,p,r,x){var y=f.angleTo(t,p,r,x),E=.5*this._lineWidth;const H=Math.sin(y)*E;y=Math.cos(y)*E;E=this._lineCap;2===E?this.LinePreCalc_LineCap2(t,p,0,r,x,0,H,y):1===E?this.LinePreCalc_LineCap1(t,p,0,r,x,0,H,y):this.LinePreCalc_LineCap0(t,p,0,r,x,0,H,y)}Line3D(t,p,r,x,y,E){var H=f.angleTo(t,
p,x,y),A=.5*this._lineWidth;const F=Math.sin(H)*A;H=Math.cos(H)*A;A=this._lineCap;2===A?this.LinePreCalc_LineCap2(t,p,r,x,y,E,F,H):1===A?this.LinePreCalc_LineCap1(t,p,r,x,y,E,F,H):this.LinePreCalc_LineCap0(t,p,r,x,y,E,F,H)}LinePreCalc_LineCap2(t,p,r,x,y,E,H,A){var F=this._lineOffset;t=t+F-A;p=p+F-H;x=x+F+A;y=y+F+H;F=2*A;const J=2*H;this.Quad3D2(t+H,p-A,r,x+H,y-A,E,x-H-F,y+A-J,E,t-H+F,p+A+J,r,q)}LinePreCalc_LineCap1(t,p,r,x,y,E,H,A){const F=this._lineOffset;t=t+F-A;p=p+F-H;x=x+F+A;y=y+F+H;this.Quad3D2(t+
H,p-A,r,x+H,y-A,E,x-H,y+A,E,t-H,p+A,r,q)}LinePreCalc_LineCap0(t,p,r,x,y,E,H,A){const F=this._lineOffset;t+=F;p+=F;x+=F;y+=F;this.Quad3D2(t+H,p-A,r,x+H,y-A,E,x-H,y+A,E,t-H,p+A,r,q)}TexturedLine(t,p,r,x,y,E){var H=f.angleTo(t,p,r,x),A=.5*this._lineWidth;const F=Math.sin(H)*A;H=Math.cos(H)*A;A=this._lineCap;2===A?this.TexturedLinePreCalc_LineCap2(t,p,r,x,F,H,y,E):1===A?this.TexturedLinePreCalc_LineCap1(t,p,r,x,F,H,y,E):this.TexturedLinePreCalc_LineCap0(t,p,r,x,F,H,y,E)}TexturedLinePreCalc_LineCap2(t,
p,r,x,y,E,H,A){var F=this._lineOffset;t=t+F-E;p=p+F-y;r=r+F+E;x=x+F+y;F=2*E;const J=2*y;u.set(t+y,p-E,r+y,x-E,r-y-F,x+E-J,t-y+F,p+E+J);w.set(H,0,A,0);this.Quad3(u,w)}TexturedLinePreCalc_LineCap1(t,p,r,x,y,E,H,A){const F=this._lineOffset;t=t+F-E;p=p+F-y;r=r+F+E;x=x+F+y;u.set(t+y,p-E,r+y,x-E,r-y,x+E,t-y,p+E);w.set(H,0,A,0);this.Quad3(u,w)}TexturedLinePreCalc_LineCap0(t,p,r,x,y,E,H,A){const F=this._lineOffset;t+=F;p+=F;r+=F;x+=F;u.set(t+y,p-E,r+y,x-E,r-y,x+E,t-y,p+E);w.set(H,0,A,0);this.Quad3(u,w)}LineRect(t,
p,r,x){const y=.5*this._lineWidth,E=this._lineCap;2===E?this._LineRectPreCalc_LineCap2(t,p,r,x,y):1===E?this._LineRectPreCalc_LineCap1(t,p,r,x,y):this._LineRectPreCalc_LineCap0(t,p,r,x,y)}_LineRectPreCalc_LineCap2(t,p,r,x,y){this.LinePreCalc_LineCap2(t,p,0,r,p,0,0,y);this.LinePreCalc_LineCap2(r,p,0,r,x,0,y,0);this.LinePreCalc_LineCap2(r,x,0,t,x,0,0,-y);this.LinePreCalc_LineCap2(t,x,0,t,p,0,-y,0)}_LineRectPreCalc_LineCap1(t,p,r,x,y){this.LinePreCalc_LineCap1(t,p,0,r,p,0,0,y);this.LinePreCalc_LineCap1(r,
p,0,r,x,0,y,0);this.LinePreCalc_LineCap1(r,x,0,t,x,0,0,-y);this.LinePreCalc_LineCap1(t,x,0,t,p,0,-y,0)}_LineRectPreCalc_LineCap0(t,p,r,x,y){this.LinePreCalc_LineCap0(t,p,0,r,p,0,0,y);this.LinePreCalc_LineCap0(r,p,0,r,x,0,y,0);this.LinePreCalc_LineCap0(r,x,0,t,x,0,0,-y);this.LinePreCalc_LineCap0(t,x,0,t,p,0,-y,0)}LineRect2(t){this.LineRect(t.getLeft(),t.getTop(),t.getRight(),t.getBottom())}LineQuad(t){var p=f.angleTo(t.getTlx(),t.getTly(),t.getTrx(),t.getTry()),r=.5*this._lineWidth;const x=Math.sin(p)*
r;p=Math.cos(p)*r;r=this._lineCap;2===r?this._LineQuadPreCalc_LineCap2(t,x,p):1===r?this._LineQuadPreCalc_LineCap1(t,x,p):this._LineQuadPreCalc_LineCap0(t,x,p)}_LineQuadPreCalc_LineCap2(t,p,r){this.LinePreCalc_LineCap2(t.getTlx(),t.getTly(),0,t.getTrx(),t.getTry(),0,p,r);this.LinePreCalc_LineCap2(t.getTrx(),t.getTry(),0,t.getBrx(),t.getBry(),0,r,-p);this.LinePreCalc_LineCap2(t.getBrx(),t.getBry(),0,t.getBlx(),t.getBly(),0,-p,-r);this.LinePreCalc_LineCap2(t.getBlx(),t.getBly(),0,t.getTlx(),t.getTly(),
0,-r,p)}_LineQuadPreCalc_LineCap1(t,p,r){this.LinePreCalc_LineCap1(t.getTlx(),t.getTly(),0,t.getTrx(),t.getTry(),0,p,r);this.LinePreCalc_LineCap1(t.getTrx(),t.getTry(),0,t.getBrx(),t.getBry(),0,r,-p);this.LinePreCalc_LineCap1(t.getBrx(),t.getBry(),0,t.getBlx(),t.getBly(),0,-p,-r);this.LinePreCalc_LineCap1(t.getBlx(),t.getBly(),0,t.getTlx(),t.getTly(),0,-r,p)}_LineQuadPreCalc_LineCap0(t,p,r){this.LinePreCalc_LineCap0(t.getTlx(),t.getTly(),0,t.getTrx(),t.getTry(),0,p,r);this.LinePreCalc_LineCap0(t.getTrx(),
t.getTry(),0,t.getBrx(),t.getBry(),0,r,-p);this.LinePreCalc_LineCap0(t.getBrx(),t.getBry(),0,t.getBlx(),t.getBly(),0,-p,-r);this.LinePreCalc_LineCap0(t.getBlx(),t.getBly(),0,t.getTlx(),t.getTly(),0,-r,p)}SetLineWidth(t){this._lineWidth=t;this._lineWidthStack[this._lineWidthStack.length-1]=t}GetLineWidth(){return this._lineWidth}PushLineWidth(t){if(100<=this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(t);this._lineWidth=t}PopLineWidth(){if(1>=
this._lineWidthStack.length)throw Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack.at(-1)}SetLineCapButt(){this._lineCap=0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(t){if("butt"===t)this.PushLineCapButt();else if("square"===t)this.PushLineCapSquare();
else if("zag"===t)this.PushLineCapZag();else throw Error("invalid line cap");}PushLineCapButt(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");
this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(1>=this._lineCapStack.length)throw Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=this._lineCapStack.at(-1)}SetLineOffset(t){this._lineOffset=t;this._lineOffsetStack[this._lineOffsetStack.length-1]=t}GetLineOffset(){return this._lineOffset}PushLineOffset(t){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(t);this._lineOffset=
t}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack.at(-1)}ConvexPoly(t){var p=t.length/2;if(3>p)throw Error("need at least 3 points");p-=2;const r=p-1,x=t[0],y=t[1];for(let E=0;E<p;E+=2){const H=2*E,A=t[H+2],F=t[H+3],J=t[H+4],B=t[H+5];E===r?this.Quad2(x,y,A,F,J,B,J,B):this.Quad2(x,y,A,F,J,B,t[H+6],t[H+7])}}GetNumVertexComponents(){return 3}Finish(){this.EndBatch(!0);
this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(t){this._enableMipmaps=!!t}AreMipmapsEnabled(){return this._enableMipmaps}SetHasMajorPerformanceCaveat(t){this._hasMajorPerformanceCaveat=!!t}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}IsWebGL(){return!1}IsWebGPU(){return!1}}}"use strict";
self.C3.Gfx.ShaderProgramBase=class{constructor(f,b,a){this._name=b;this._renderer=f;this._extendBoxHorizontal=a.extendBoxHorizontal||0;this._extendBoxVertical=a.extendBoxVertical||0;this._crossSampling=!!a.crossSampling;this._mustPreDraw=!!a.mustPreDraw;this._preservesOpaqueness=!!a.preservesOpaqueness;this._animated=!!a.animated;this._blendsBackground=!!a.blendsBackground;this._usesDepth=!!a.usesDepth;this._usesAnySrcRectOrPixelSize=!1;this._needsPostDrawOrExtendBox=this._crossSampling||this._blendsBackground||
0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}Release(){this._renderer=null}GetRenderer(){return this._renderer}GetName(){return this._name}ExtendsBox(){return 0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}IsAnimated(){return this._animated}BlendsBackground(){return this._blendsBackground}UsesDepth(){return this._usesDepth}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}};
{"use strict";const f=self.C3;f.Gfx.StateGroup=class{constructor(b,a,c,d,e){this._renderer=b;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=c;this._color=f.New(f.Color);this._color.set(d);this._zElevation=e;"string"===typeof a?this._shaderProgramName=a:(this._shaderProgram=a,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(0<this._refCount)throw Error("releasing state group still in use");this._shaderProgram=this._renderer=null;this._shaderProgramName=
""}Apply(){const b=this._renderer;b.SetProgram(this._shaderProgram);b.SetBlendMode(this._blendMode);b.SetColor(this._color);b.SetCurrentZ(this._zElevation);b._SetCurrentStateGroup(this)}GetKey(){return f.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram=null}OnContextRestored(b){this._shaderProgram=b.GetShaderProgramByName(this._shaderProgramName);
if(!this._shaderProgram)throw Error("failed to restore shader program");}static MakeKey(b,a,c,d){return("string"===typeof b?b:b.GetName())+","+a+","+c.getR()+","+c.getG()+","+c.getB()+","+c.getA()+","+d}}}
{"use strict";const f=self.C3,b=f.New(f.Quad);function a(c,d,e){const h=e.getTlx(),g=e.getTly(),l=e.getTrx()-h,m=e.getTry()-g,u=e.getBlx()-h;e=e.getBly()-g;return[h+l*c+u*d,g+m*c+e*d]}f.Gfx.MeshPoint=class{constructor(c,d,e){this._mesh=c;this._col=d;this._row=e;this._v=this._u=this._zElevation=this._y=this._x=0}_Init(c,d,e,h){this._x=c;this._y=d;this._u=e;this._v=h}GetX(){return this._x}SetX(c){this._x!==c&&(this._x=c,this._mesh._SetPointsChanged())}GetY(){return this._y}SetY(c){this._y!==c&&(this._y=
c,this._mesh._SetPointsChanged())}GetZElevation(){return this._zElevation}SetZElevation(c){this._zElevation!==c&&(this._zElevation=Math.max(c,0),this._mesh._SetPointsChanged())}GetU(){return this._u}SetU(c){this._u=c}GetV(){return this._v}SetV(c){this._v=c}_Interpolate_TexRect(c,d,e){[this._x,this._y]=a(c._x,c._y,d);this._zElevation=c._zElevation;this._u=f.lerp(e.getLeft(),e.getRight(),c._u);this._v=f.lerp(e.getTop(),e.getBottom(),c._v)}_Interpolate_TexQuad(c,d,e){[this._x,this._y]=a(c._x,c._y,d);
this._zElevation=c._zElevation;[this._u,this._v]=a(c._u,c._v,e)}SaveToJson(){return{x:this.GetX(),y:this.GetY(),z:this.GetZElevation(),u:this.GetU(),v:this.GetV()}}LoadFromJson(c){this.SetX(c.x);this.SetY(c.y);c.hasOwnProperty("z")&&this.SetZElevation(c.z);this.SetU(c.u);this.SetV(c.v)}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}};f.Gfx.Mesh=class{constructor(c,d,e){if(2>c||2>d)throw Error("invalid mesh size");this._hsize=c;this._vsize=d;this._owner=e||null;
this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._maxZ=0;this._pointsChanged=!1;e=c-1;const h=d-1;for(let g=0;g<d;++g){const l=[];for(let m=0;m<c;++m){const u=f.New(f.Gfx.MeshPoint,this,m,g),w=m/e,q=g/h;u._Init(w,q,w,q);l.push(u)}this._pts.push(l)}}Release(){f.clearArray(this._pts)}GetHSize(){return this._hsize}GetVSize(){return this._vsize}GetOwner(){return this._owner}_GetPoints(){return this._pts}_SetPointsChanged(){this._pointsChanged=!0}_MaybeComputeBounds(){if(this._pointsChanged){var c=
Infinity,d=Infinity,e=-Infinity,h=-Infinity,g=0;for(const l of this._pts)for(const m of l){const u=m.GetX(),w=m.GetY();c=Math.min(c,u);d=Math.min(d,w);e=Math.max(e,u);h=Math.max(h,w);g=Math.max(g,m.GetZElevation())}this._minX=c;this._minY=d;this._maxX=e;this._maxY=h;this._maxZ=g;this._pointsChanged=!1}}GetMinX(){this._MaybeComputeBounds();return this._minX}GetMinY(){this._MaybeComputeBounds();return this._minY}GetMaxX(){this._MaybeComputeBounds();return this._maxX}GetMaxY(){this._MaybeComputeBounds();
return this._maxY}GetMaxZ(){this._MaybeComputeBounds();return this._maxZ}HasAnyZElevation(){return 0<this.GetMaxZ()}GetMeshPointAt(c,d){c=Math.floor(c);d=Math.floor(d);return 0>c||c>=this._hsize||0>d||d>=this._vsize?null:this._pts[d][c]}CalculateTransformedMesh(c,d,e){const h=e instanceof f.Rect;if(c.GetHSize()!==this.GetHSize()||c.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");c=c._pts;const g=this._pts;for(let l=0,m=g.length;l<m;++l){const u=c[l],w=g[l];for(let q=0,t=w.length;q<
t;++q){const p=u[q],r=w[q];h?r._Interpolate_TexRect(p,d,e):r._Interpolate_TexQuad(p,d,e)}}}Draw(c){const d=this._pts;let e=d[0];for(let h=1,g=d.length;h<g;++h){const l=d[h];let m=e[0],u=l[0];for(let w=1,q=l.length;w<q;++w){const t=e[w],p=l[w];b.set(m.GetU(),m.GetV(),t.GetU(),t.GetV(),p.GetU(),p.GetV(),u.GetU(),u.GetV());c.Quad3D2(m.GetX(),m.GetY(),m.GetZElevation(),t.GetX(),t.GetY(),t.GetZElevation(),p.GetX(),p.GetY(),p.GetZElevation(),u.GetX(),u.GetY(),u.GetZElevation(),b);m=t;u=p}e=l}}Outline(c,
d){d||(d=(g,l,m)=>[g,l,m]);const e=this._pts;let h=e[0];for(let g=1,l=e.length;g<l;++g){const m=e[g];let u=h[0],w=m[0];for(let q=1,t=m.length;q<t;++q){const p=h[q],r=m[q],[x,y,E]=d(u.GetX(),u.GetY(),u.GetZElevation()),[H,A,F]=d(p.GetX(),p.GetY(),p.GetZElevation()),[J,B,I]=d(r.GetX(),r.GetY(),r.GetZElevation()),[L,P,S]=d(w.GetX(),w.GetY(),w.GetZElevation());c.Line3D(x,y,E,H,A,F);c.Line3D(x,y,E,J,B,I);c.Line3D(x,y,E,L,P,S);q===t-1&&c.Line3D(H,A,F,J,B,I);g===l-1&&c.Line3D(L,P,S,J,B,I);u=p;w=r}h=m}}InsertPolyMeshVertices(c){c=
c.pointsArr();const d=[],e=this.GetHSize()-1,h=this.GetVSize()-1,g=1/e,l=1/h,m=e-1,u=h-1;let w=c[0],q=c[1],t=f.clamp(Math.floor(w*e),0,m),p=f.clamp(Math.floor(q*h),0,u),r=0,x=0,y=0;var E=-1;const H=()=>{w=f.clamp(f.lerp(w,r,y),0,1);q=f.clamp(f.lerp(q,x,y),0,1);d.push(w,q)};for(let A=0,F=c.length;A<F;A+=2)for(w=c[A],q=c[A+1],d.push(w,q),t=f.clamp(Math.floor(w*e),0,m),p=f.clamp(Math.floor(q*h),0,u),E=(A+2)%F,r=c[E],x=c[E+1],E=-1;;){if(1E6<d.length)throw Error("Too many mesh poly points");const J=t*
g,B=p*l,I=(t+1)*g,L=(p+1)*l;f.isPointInTriangleInclusive(w,q,J,B,I,B,I,L);if(0!==E&&(y=f.rayIntersectExtended(w,q,r,x,J,B,I,L,-.001),0<=y&&.99999999>=y)){H();E=0;continue}if(0<p&&2!==E&&(y=f.rayIntersectExtended(w,q,r,x,J,B,I,B,.001),0<=y&&.99999999>=y)){H();p--;E=4;continue}if(t<m&&3!==E&&(y=f.rayIntersectExtended(w,q,r,x,I,B,I,L,.001),0<=y&&.99999999>=y)){H();t++;E=1;continue}if(0<t&&1!==E&&(y=f.rayIntersectExtended(w,q,r,x,J,B,J,L,.001),0<=y&&.99999999>=y)){H();t--;E=3;continue}if(p<u&&4!==E&&
(y=f.rayIntersectExtended(w,q,r,x,J,L,I,L,.001),0<=y&&.99999999>=y)){H();p++;E=2;continue}break}return f.New(f.CollisionPoly,d)}TransformCollisionPoly(c,d){c=this._TransformPolyPoints(c);this._SimplifyPoly(c);d.setPoints(c)}_TransformPolyPoints(c){const d=[];c=c.pointsArr();for(let e=0,h=c.length;e<h;e+=2){const [g,l]=this.TransformPoint(c[e],c[e+1]);d.push(g,l)}return d}TransformPoint(c,d){var e=this.GetHSize()-1,h=this.GetVSize()-1,g=1/e,l=1/h;e=f.clamp(Math.floor(c*e),0,e-1);const m=f.clamp(Math.floor(d*
h),0,h-1);h=e*g;const u=m*l,w=(e+1)*g,q=(m+1)*l,t=this.GetMeshPointAt(e,m),p=this.GetMeshPointAt(e+1,m+1),r=f.isPointInTriangleInclusive(c,d,h,u,w,u,w,q);g=r?h+g:h;l=r?u:u+l;e=this.GetMeshPointAt(e+(r?1:0),m+(r?0:1));const [x,y,E]=f.triangleCartesianToBarycentric(c,d,h,u,g,l,w,q);return f.triangleBarycentricToCartesian(x,y,E,t.GetX(),t.GetY(),e.GetX(),e.GetY(),p.GetX(),p.GetY())}_SimplifyPoly(c){const d=[];let e=c[0],h=c[1],g=e-c.at(-2),l=h-c.at(-1);for(let u=0,w=c.length;u<w;u+=2){var m=(u+2)%w;
const q=c[m];m=c[m+1];const t=q-e,p=m-h,r=1E-7>Math.abs(p)&&1E-7>Math.abs(l)&&Math.sign(t)===Math.sign(g);(!(1E-7>Math.abs(t)&&1E-7>Math.abs(g)&&Math.sign(p)===Math.sign(l)||r)&&1E-7<Math.abs(t/g-p/l)||0==t&&0===p)&&d.push(e,h);e=q;h=m;g=t;l=p}6<=d.length&&d.length<c.length&&f.shallowAssignArray(c,d)}SaveToJson(){return{cols:this.GetHSize(),rows:this.GetVSize(),points:this._pts.map(c=>c.map(d=>d.SaveToJson()))}}LoadFromJson(c){const d=this.GetHSize(),e=this.GetVSize();if(c.cols!==d||c.rows!==e)throw Error("mesh data wrong size");
c=c.points;for(let h=0;h<e;++h){const g=c[h];for(let l=0;l<d;++l)this.GetMeshPointAt(l,h).LoadFromJson(g[l])}}}}
{"use strict";const f=self.C3,b=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),a=new Set(["nearest","bilinear","trilinear"]),c=new Set(["default","low","high"]),d=new Set(["clamp-to-edge","repeat","mirror-repeat"]);function e(m,u){let w,q;switch(m){case "rgba8":m=u.RGBA8;q=w=u.RGBA;u=u.UNSIGNED_BYTE;break;case "rgb8":m=u.RGB8;q=w=u.RGB;u=u.UNSIGNED_BYTE;break;case "rgba4":m=u.RGBA4;q=w=u.RGBA;u=u.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":m=u.RGB5_A1;q=w=u.RGBA;u=u.UNSIGNED_SHORT_5_5_5_1;break;
case "rgb565":m=u.RGB565;q=w=u.RGB;u=u.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:m,internalformat:w,format:q,type:u}}const h={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",sampling:"trilinear",anisotropy:0,pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},g={premultiplyAlpha:!0,flipY:!1},l=new Set;f.Gfx.WebGLRendererTexture=class{constructor(m){this._renderer=m;this._texture=null;this._height=
this._width=0;this._isStatic=!0;this._wrapY=this._wrapX="clamp-to-edge";this._sampling="trilinear";this._anisotropy=0;this._pixelFormat="rgba8";this._isMipMapped=!1;this._mipMapQuality="default";this._refCount=0}_CreateStatic(m,u){if(!("undefined"!==typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||
m instanceof ImageData||m instanceof ArrayBuffer)&&null!==m)throw Error("invalid texture source");u=Object.assign({},h,u);if(this._texture)throw Error("already created texture");this._wrapX=u.wrapX;this._wrapY=u.wrapY;this._sampling=u.sampling;this._anisotropy=u.anisotropy;this._pixelFormat=u.pixelFormat;this._isMipMapped=!!u.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=u.mipMapQuality;if(!d.has(this._wrapX)||!d.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");
if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!c.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(m instanceof ArrayBuffer||null===m||u.isSvg){if(this._width=u.width,this._height=u.height,m instanceof ArrayBuffer&&m.byteLength!==this._width*this._height*4)throw Error("ArrayBuffer wrong size");}else this._width=m.width,this._height=m.height;if(0>=this._width||0>=this._height)throw Error("invalid texture data size");if(u.isSvg){var w=f.CreateCanvas(this._width,
this._height);w.getContext("2d").drawImage(m,0,0,this._width,this._height);m=w}var q=f.isPOT(this._width)&&f.isPOT(this._height);w=this._renderer.GetMaxTextureSize();if(this._width>w||this._height>w)throw Error("texture data exceeds maximum texture size");w=this._renderer.GetContext();var t=this._renderer.GetWebGLVersionNumber();this._texture=w.createTexture();w.bindTexture(w.TEXTURE_2D,this._texture);w.pixelStorei(w.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);w.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,
!1);u=e(this._pixelFormat,w);if(this._renderer.SupportsNPOTTextures()||q||!this._IsTiled())2<=t?(w.texStorage2D(w.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,u.sizedinternalformat,this._width,this._height),m instanceof ArrayBuffer?w.texSubImage2D(w.TEXTURE_2D,0,0,0,this._width,this._height,u.format,u.type,new Uint8Array(m)):null!==m&&w.texSubImage2D(w.TEXTURE_2D,0,0,0,u.format,u.type,m)):m instanceof ArrayBuffer?w.texImage2D(w.TEXTURE_2D,0,u.internalformat,
this._width,this._height,0,u.format,u.type,new Uint8Array(m)):null===m?w.texImage2D(w.TEXTURE_2D,0,u.internalformat,this._width,this._height,0,u.format,u.type,null):w.texImage2D(w.TEXTURE_2D,0,u.internalformat,u.format,u.type,m);else{if(null===m)throw Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");m instanceof ArrayBuffer&&(m=new ImageData(new Uint8ClampedArray(m),this._width,this._height));m instanceof ImageData&&(q=f.CreateCanvas(this._width,this._height),
q.getContext("2d").putImageData(m,0,0),m=q);q=f.CreateCanvas(f.nextHighestPowerOfTwo(this._width),f.nextHighestPowerOfTwo(this._height));t=q.getContext("2d");t.imageSmoothingEnabled="nearest"!==this._sampling;t.drawImage(m,0,0,this._width,this._height,0,0,q.width,q.height);w.texImage2D(w.TEXTURE_2D,0,u.internalformat,u.format,u.type,q)}null!==m&&this._SetTextureParameters(w);w.bindTexture(w.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_CreateDynamic(m,u,w){w=Object.assign({},
h,w);if(this._texture)throw Error("already created texture");this._wrapX=w.wrapX;this._wrapY=w.wrapY;this._sampling=w.sampling;this._pixelFormat=w.pixelFormat;this._isMipMapped=!!w.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=w.mipMapQuality;if(!d.has(this._wrapX)||!d.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!c.has(this._mipMapQuality))throw Error("invalid mipmap quality");
this._isStatic=!1;this._width=Math.floor(m);this._height=Math.floor(u);m=f.isPOT(this._width)&&f.isPOT(this._height);u=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>u||this._height>u)throw Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!m)throw Error("non-power-of-two tiled textures not supported");m=this._renderer.GetContext();u=this._renderer.GetWebGLVersionNumber();
this._texture=m.createTexture();m.bindTexture(m.TEXTURE_2D,this._texture);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,!1);w=e(this._pixelFormat,m);m.texImage2D(m.TEXTURE_2D,0,2<=u?w.sizedinternalformat:w.internalformat,this._width,this._height,0,w.format,w.type,null);this._SetTextureParameters(m);m.bindTexture(m.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_GetMipMapHint(m){if("default"===this._mipMapQuality)return this._isStatic?
m.NICEST:m.FASTEST;if("low"===this._mipMapQuality)return m.FASTEST;if("high"===this._mipMapQuality)return m.NICEST;throw Error("invalid mipmap quality");}_IsTiled(){return"clamp-to-edge"!==this._wrapX||"clamp-to-edge"!==this._wrapY}_GetTextureWrapMode(m,u){if("clamp-to-edge"===u)return m.CLAMP_TO_EDGE;if("repeat"===u)return m.REPEAT;if("mirror-repeat"===u)return m.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(m){var u=f.isPOT(this._width)&&f.isPOT(this._height);m.texParameteri(m.TEXTURE_2D,
m.TEXTURE_WRAP_S,this._GetTextureWrapMode(m,this._wrapX));m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,this._GetTextureWrapMode(m,this._wrapY));"nearest"===this._sampling?(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),this._isMipMapped=!1):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR),(u||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(m.hint(m.GENERATE_MIPMAP_HINT,this._GetMipMapHint(m)),m.generateMipmap(m.TEXTURE_2D),
u="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,u?m.LINEAR_MIPMAP_LINEAR:m.LINEAR_MIPMAP_NEAREST)):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),this._isMipMapped=!1));(u=this._renderer._GetAnisotropicExtension())&&0<this._anisotropy&&"nearest"!==this._sampling&&m.texParameterf(m.TEXTURE_2D,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(m,u){if(!("undefined"!==
typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLVideoElement&&m instanceof HTMLVideoElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||m instanceof ImageData))throw Error("invalid texture source");if(!this._texture||0>=this._refCount)throw Error("texture not created");if(this._isStatic)throw Error("cannot update static texture");
u=Object.assign({},g,u);const w=m.width||m.videoWidth,q=m.height||m.videoHeight;var t=this._renderer.GetWebGLVersionNumber();const p=this._renderer.GetContext();p.bindTexture(p.TEXTURE_2D,this._texture);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!!u.flipY);u=e(this._pixelFormat,p);t=2<=t?u.sizedinternalformat:u.internalformat;try{if(this._width===w&&this._height===q){const r=f.isPOT(this._width)&&f.isPOT(this._height);p.texSubImage2D(p.TEXTURE_2D,
0,0,0,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(p.hint(p.GENERATE_MIPMAP_HINT,this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D))}else{this._width=w;this._height=q;const r=f.isPOT(this._width)&&f.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!r)throw Error("non-power-of-two tiled textures not supported");p.texImage2D(p.TEXTURE_2D,0,t,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(p.hint(p.GENERATE_MIPMAP_HINT,
this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D))}}catch(r){console.error("Error updating WebGL texture: ",r)}p.bindTexture(p.TEXTURE_2D,null);this._renderer._ResetLastTexture()}_Delete(){if(0<this._refCount)throw Error("texture still has references");if(!this._texture)throw Error("already deleted texture");l.delete(this);this._renderer.GetContext().deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(0>=
this._refCount)throw Error("no more references");this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let m=this._width*this._height;switch(this._pixelFormat){case "rgba8":m*=4;break;case "rgb8":m*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":m*=2}this._isMipMapped&&(m+=Math.floor(m/3));return m}static OnContextLost(){l.clear()}static allTextures(){return l.values()}}}
{"use strict";const f=self.C3,b=self.glMatrix.mat4,a=new Set(["nearest","bilinear","trilinear"]),c={sampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,isDefaultSize:!0,multisampling:0},d=new Set;f.Gfx.WebGLRenderTarget=class{constructor(e){this._renderer=e;this._renderBuffer=this._texture=this._frameBufferNoDepth=this._frameBuffer=null;this._height=this._width=0;this._isDefaultSize=!0;this._sampling="trilinear";this._alpha=!0;this._depth=!1;this._isSampled=!0;this._multisampling=0;this._projectionMatrix=
b.create()}_Create(e,h,g){g=Object.assign({},c,g);const l=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw Error("already created render target");this._sampling=g.sampling;this._alpha=!!g.alpha;this._depth=!!g.depth;this._isSampled=!!g.isSampled;this._isDefaultSize=!!g.isDefaultSize;this._multisampling=g.multisampling;if(!a.has(this._sampling))throw Error("invalid sampling");if(0<this._multisampling&&(2>l||this._isSampled))throw Error("invalid use of multisampling");
2>l&&(this._isSampled=!0);this._width=e;this._height=h;if(0>=this._width||0>=this._height)throw Error("invalid render target size");this._CalculateProjection();e=this._renderer.GetContext();this._frameBuffer=e.createFramebuffer();this._depth&&(this._frameBufferNoDepth=e.createFramebuffer());this._isSampled?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),h=this._texture._GetTexture(),e.bindFramebuffer(e.FRAMEBUFFER,
this._frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h,0),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h,0))):(this._renderBuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this._renderBuffer),h=this._alpha?e.RGBA8:e.RGB8,0<this._multisampling&&((g=e.getInternalformatParameter(e.RENDERBUFFER,h,e.SAMPLES))&&g[0]?(g=g[0],this._multisampling>g&&(this._multisampling=
g)):this._multisampling=0),0===this._multisampling?e.renderbufferStorage(e.RENDERBUFFER,h,this._width,this._height):e.renderbufferStorageMultisample(e.RENDERBUFFER,this._multisampling,h,this._width,this._height),e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,this._renderBuffer),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,
this._renderBuffer)),e.bindRenderbuffer(e.RENDERBUFFER,null));h=this._renderer._GetDepthBuffer();this._depth&&h&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),this._renderer._CanSampleDepth()?e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,h,0):e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,h));e.bindFramebuffer(e.FRAMEBUFFER,null);d.add(this)}_Resize(e,h){if(this._width!==e||this._height!==h)this._width=e,this._height=h,this._CalculateProjection(),
e=this._renderer.GetContext(),e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(e.bindRenderbuffer(e.RENDERBUFFER,this._renderBuffer),e.renderbufferStorage(e.RENDERBUFFER,this._alpha?e.RGBA8:e.RGB8,this._width,this._height),e.bindRenderbuffer(e.RENDERBUFFER,null)),h=this._renderer._GetDepthBuffer(),this._depth&&h&&(this._renderer._CanSampleDepth()?e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,
h,0):e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,h)),e.bindFramebuffer(e.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw Error("already deleted render target");d.delete(this);var e=this._renderer.GetContext();this._texture?(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferTexture2D(e.FRAMEBUFFER,
e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0)),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,null),this._depth&&(e.bindFramebuffer(e.FRAMEBUFFER,this._frameBufferNoDepth),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,null)),e.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);e.bindFramebuffer(e.FRAMEBUFFER,
null);2<=this._renderer.GetWebGLVersionNumber()&&(e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null));e.deleteFramebuffer(this._frameBuffer);this._depth&&e.deleteFramebuffer(this._frameBufferNoDepth);e=this._renderer.GetBatchState();e.currentFramebuffer=null;this._frameBuffer=e.currentFramebufferNoDepth=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height)}_GetFramebuffer(){return this._frameBuffer}_GetFramebufferNoDepth(){return this._frameBufferNoDepth}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){return this._projectionMatrix}IsLinearSampling(){return"nearest"!==
this._sampling}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const e={sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};this._isDefaultSize||(e.width=this._width,e.height=this._height);return e}IsCompatibleWithOptions(e){e=Object.assign({},c,e);return"nearest"!==
e.sampling!==this.IsLinearSampling()||!!e.alpha!==this.HasAlpha()||!!e.depth!==this.HasDepthBuffer()||2<=this._renderer.GetWebGLVersionNumber()&&!!e.isSampled!==this.IsSampled()?!1:"number"===typeof e.width||"number"===typeof e.height?!this.IsDefaultSize()&&this.GetWidth()===e.width&&this.GetHeight()===e.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(e,h){e=await e.ReadBackRenderTargetToImageData(h,!0);return await f.ImageDataToBlob(e)}static OnContextLost(){d.clear()}static allRenderTargets(){return d.values()}static ResizeAll(e,h){for(const g of d)g.IsDefaultSize()&&g._Resize(e,h)}}}
{"use strict";const f=self.C3,b=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack samplerDepth destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds devicePixelRatio layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));f.Gfx.WebGLShaderProgram=class extends f.Gfx.ShaderProgramBase{static async Compile(a,c,d,e){const h=a.GetContext(),g=h.createShader(h.FRAGMENT_SHADER);
h.shaderSource(g,c);h.compileShader(g);c=h.createShader(h.VERTEX_SHADER);h.shaderSource(c,d);h.compileShader(c);const l=h.createProgram();h.attachShader(l,g);h.attachShader(l,c);h.bindAttribLocation(l,0,"aPos");h.bindAttribLocation(l,1,"aTex");h.bindAttribLocation(l,2,"aPoints");h.linkProgram(l);const m=a._GetParallelShaderCompileExtension();m?await a._WaitForObjectReady(()=>h.getProgramParameter(l,m.COMPLETION_STATUS_KHR)):await f.Wait(5);if(!h.getShaderParameter(g,h.COMPILE_STATUS))throw e=h.getShaderInfoLog(g),
h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error compiling fragment shader: "+e);if(!h.getShaderParameter(c,h.COMPILE_STATUS))throw e=h.getShaderInfoLog(c),h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error compiling vertex shader: "+e);if(!h.getProgramParameter(l,h.LINK_STATUS))throw e=h.getProgramInfoLog(l),h.deleteShader(g),h.deleteShader(c),h.deleteProgram(l),Error("Error linking shader program: "+e);(a=f.FilterUnprintableChars(h.getProgramInfoLog(l)||"").trim())&&
!f.IsStringAllWhitespace(a)&&console.info(`[WebGL] Shader program '${e}' compilation log: `,a);h.deleteShader(g);h.deleteShader(c);return l}static async Create(a,c,d,e){d=await f.Gfx.WebGLShaderProgram.Compile(a,c.src,d,e);return new f.Gfx.WebGLShaderProgram(a,d,c,e)}constructor(a,c,d,e){super(a,e,d);const h=a.GetContext();var g=a.GetBatchState();a.EndBatch();h.useProgram(c);this._gl=h;this._shaderProgram=c;this._isDeviceTransform="<default-device-transform>"===e;e=h.getAttribLocation(c,"aPos");const l=
h.getAttribLocation(c,"aTex");this._locAPoints=h.getAttribLocation(c,"aPoints");-1!==e&&(h.bindBuffer(h.ARRAY_BUFFER,a._vertexBuffer),h.vertexAttribPointer(e,a.GetNumVertexComponents(),h.FLOAT,!1,0,0),h.enableVertexAttribArray(e));-1!==l&&(h.bindBuffer(h.ARRAY_BUFFER,a._texcoordBuffer),h.vertexAttribPointer(l,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(l));-1!==this._locAPoints&&(h.bindBuffer(h.ARRAY_BUFFER,a._pointBuffer),h.vertexAttribPointer(this._locAPoints,4,h.FLOAT,!1,0,0),h.enableVertexAttribArray(this._locAPoints));
h.bindBuffer(h.ARRAY_BUFFER,null);this._uMatP=new 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._uSamplerDepth=new f.Gfx.WebGLShaderUniform(this,"samplerDepth","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._uDevicePixelRatio=new f.Gfx.WebGLShaderUniform(this,"devicePixelRatio","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._uDevicePixelRatio.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());a=d.parameters||[];this._uCustomParameters=[];this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();
this._hasCurrentMatMV=this._hasCurrentMatP=!1;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0);this._uSamplerBack.Init1i(1);this._uSamplerDepth.Init1i(2);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0,0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,
0);this._uPixelSize.Init2f(0,0);this._uDevicePixelRatio.Init1f(1);this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const m of a)a=m[2],c=new f.Gfx.WebGLShaderUniform(this,m[0],a),"color"===a?c.Init3f(0,0,0):c.Init1f(0),this._uCustomParameters.push(c);this._isDeviceTransform?this._UpdateDeviceTransformUniforms(g.currentMatP):(this.UpdateMatP(g.currentMatP,!0),this.UpdateMatMV(g.currentMV,
!0));g=g.currentShader;h.useProgram(g?g._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._gl=null;super.Release()}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(a){return this._uCustomParameters[a].GetType()}AreCustomParametersAlreadySetInBatch(a){for(let c=0,d=a.length;c<d;++c)if(!this._uCustomParameters[c].IsSetToCustomInBatch(a[c]))return!1;
return!0}SetCustomParametersInBatch(a){for(let c=0,d=a.length;c<d;++c)this._uCustomParameters[c].SetBatchValueCustom(a[c])}AreOptionalUniformsAlreadySetInBatch(a,c,d,e,h,g,l,m,u,w){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(h,g)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(a.getLeft(),a.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(a.getRight(),a.getBottom())||this._uDevicePixelRatio.IsUsed()&&!this._uDevicePixelRatio.IsSetTo1InBatch(l)||
this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(m)||this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(u)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(c.getLeft(),c.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(c.getRight(),c.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(d.getLeft(),d.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(d.getRight(),d.getBottom())||this._uLayoutStart.IsUsed()&&
!this._uLayoutStart.IsSetTo2InBatch(e.getLeft(),e.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(e.getTop(),e.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(w)?!1:!0}SetOptionalUniformsInBatch(a,c,d,e,h,g,l,m,u,w){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(h,g),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(a.getLeft(),a.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(a.getRight(),a.getBottom()),
this._uDevicePixelRatio.IsUsed()&&this._uDevicePixelRatio.SetBatch1(l),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(m),this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(u),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(c.getLeft(),c.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(c.getRight(),c.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(d.getLeft(),d.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(d.getRight(),
d.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(e.getLeft(),e.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(e.getTop(),e.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(w))}UpdateMatP(a,c){this._hasCurrentMatP&&!c||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(a),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(a,c){this._hasCurrentMatMV&&!c||this._isDeviceTransform||(this._uMatMV.IsUsed()&&
this._uMatMV.UpdateMatrix4fv(a),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(a){if(!this._isDeviceTransform)throw Error("not device transform shader");this._uMatP.UpdateMatrix4fv(a);a=this._renderer;const c=a.GetWidth()/2,d=a.GetHeight()/2;a=a.CalculateLookAtModelView2(c,d,a.GetDefaultCameraZ()*self.devicePixelRatio,c,d,0);this._uMatMV.UpdateMatrix4fv(a)}UpdateColor(a){this._uColor.IsUsed()&&this._uColor.Update4f(a[0],a[1],a[2],a[3])}static GetReservedUniformNames(){return b}static GetDefaultVertexShaderSource(a){a=
a?"highmedp":"mediump";return["#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nattribute highp vec3 aPos;",`attribute ${a} vec2 aTex;`,`varying ${a} vec2 vTex;`,"uniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos, 1.0);\n\tvTex = aTex;\n}"].join("\n")}static GetTextureFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex) * color;\n}"}static GetTilemapFragmentShaderSource(){return"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nvarying highmedp vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nuniform highmedp vec2 srcStart;\nuniform highmedp vec2 pixelSize;\nuniform highmedp vec2 tileSize;\nuniform highmedp vec2 tileSpacing;\nvoid main(void) {\n\thighmedp vec2 tile = floor(vTex);\n\thighmedp vec2 tex = fract(vTex);\n\thighmedp vec2 tileOrigin = srcStart + tile * (tileSize + tileSpacing);\n\thighmedp vec2 lowerBound = tileOrigin + pixelSize / 2.0;\n\thighmedp vec2 upperBound = tileOrigin + tileSize - pixelSize / 2.0;\n\tgl_FragColor = texture2D(samplerFront, clamp(tex, lowerBound, upperBound), -16.0) * color;\n}"}static GetPointVertexShaderSource(a){return f.Gfx.WebGLShaderProgram.GetPointVertexShaderSource_WebGL1()}static GetPointFragmentShaderSource(a){return f.Gfx.WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1()}static GetPointVertexShaderSource_WebGL1(){return"attribute vec4 aPoints;\nvarying float pointOpacity;\nuniform float zElevation;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);\n\tgl_PointSize = aPoints.z;\n\tpointOpacity = aPoints.w;\n}"}static GetPointFragmentShaderSource_WebGL1(){return"uniform lowp sampler2D samplerFront;\nvarying lowp float pointOpacity;\nuniform mediump vec2 pointTexStart;\nuniform mediump vec2 pointTexEnd;\nuniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, mix(pointTexStart, pointTexEnd, gl_PointCoord)) * color * pointOpacity;\n}"}static GetColorFillFragmentShaderSource(){return"uniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = color;\n}"}static GetLinearGradientFillFragmentShaderSource(){return"precision lowp float;\nvarying mediump vec2 vTex;\nuniform vec4 color;\nuniform vec4 color2_;\nvec3 fromLinear(vec3 linearRGB)\n{\n\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));\n\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);\n\tvec3 lower = linearRGB * vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvec3 toLinear(vec3 sRGB)\n{\n\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));\n\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));\n\tvec3 lower = sRGB/vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvoid main(void) {\n\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);\n\tfloat a = mix(color.a, color2_.a, vTex.x);\n\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);\n}"}static GetSmoothLineFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float f = step(diffSq.x + diffSq.y, 0.25);\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump float innerF = step(distSq, 0.25);\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}static GetSmoothEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);\n\tgl_FragColor = color * f;\n}"}static GetSmoothEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 pxNorm = pixelSize * norm;\n\tmediump vec2 innerEdge1 = halfNorm - pxNorm;\n\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;\n\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);\n\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;\n\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;\n\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);\n\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;\n\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}}}
{"use strict";const f=self.C3,b=self.glMatrix.mat4,a=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);f.Gfx.WebGLShaderUniform=class{constructor(c,d,e){if(!a.has(e))throw Error("invalid uniform type");this._owner=c;this._gl=this._owner.GetWebGLContext();this._name=d;this._type=e;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),d);this._isUsed=!!this._location;c=a.get(e);this._lastValue=
new Float32Array(c);this._lastBatchValue=new Float32Array(c)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(c){this.IsUsed()&&(this._lastValue[0]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,c))}Init1i(c){this.IsUsed()&&(this._lastValue[0]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,c))}Init2f(c,d){this.IsUsed()&&(this._lastValue[0]=
c,this._lastValue[1]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,c,d))}Init3f(c,d,e){this.IsUsed()&&(this._lastValue[0]=c,this._lastValue[1]=d,this._lastValue[2]=e,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,c,d,e))}Init4f(c,d,e,h){this.IsUsed()&&(this._lastValue[0]=c,this._lastValue[1]=d,this._lastValue[2]=e,this._lastValue[3]=h,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,c,d,e,h))}Update1f(c){c=Math.fround(c);
const d=this._lastValue;d[0]!==c&&(d[0]=c,this._gl.uniform1f(this._location,c))}Update1i(c){const d=this._lastValue;d[0]!==c&&(d[0]=c,this._gl.uniform1i(this._location,c))}Update2f(c,d){c=Math.fround(c);d=Math.fround(d);const e=this._lastValue;if(e[0]!==c||e[1]!==d)e[0]=c,e[1]=d,this._gl.uniform2f(this._location,c,d)}Update3f(c,d,e){c=Math.fround(c);d=Math.fround(d);e=Math.fround(e);const h=this._lastValue;if(h[0]!==c||h[1]!==d||h[2]!==e)h[0]=c,h[1]=d,h[2]=e,this._gl.uniform3f(this._location,c,d,
e)}Update4f(c,d,e,h){c=Math.fround(c);d=Math.fround(d);e=Math.fround(e);h=Math.fround(h);const g=this._lastValue;if(g[0]!==c||g[1]!==d||g[2]!==e||g[3]!==h)g[0]=c,g[1]=d,g[2]=e,g[3]=h,this._gl.uniform4f(this._location,c,d,e,h)}UpdateMatrix4fv(c){const d=this._lastValue;b.exactEquals(d,c)||(f.typedArraySet16(d,c,0),this._gl.uniformMatrix4fv(this._location,!1,c))}IsSetToCustomInBatch(c){const d=this._lastBatchValue;return this.IsColorType()?d[0]===Math.fround(c.getR())&&d[1]===Math.fround(c.getG())&&
d[2]===Math.fround(c.getB()):d[0]===Math.fround(c)}SetBatchValueCustom(c){const d=this._lastBatchValue;this.IsColorType()?(d[0]=c.getR(),d[1]=c.getG(),d[2]=c.getB()):d[0]=c}IsSetTo1InBatch(c){return this._lastBatchValue[0]===Math.fround(c)}IsSetTo2InBatch(c,d){const e=this._lastBatchValue;return e[0]===Math.fround(c)&&e[1]===Math.fround(d)}SetBatch1(c){this._lastBatchValue[0]=c}SetBatch2(c,d){const e=this._lastBatchValue;e[0]=c;e[1]=d}}}
{"use strict";const f=self.C3,b=self.glMatrix,a=b.vec4,c=b.mat4;f.Gfx.BatchState=class{constructor(d){this.renderer=d;this.currentMV=c.create();this.currentMatP=c.create();this.currentFramebufferNoDepth=this.currentFramebuffer=null;this.isDepthSamplingEnabled=!1;this.currentColor=a.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new f.Rect;this.clearColor=f.New(f.Color,0,0,0,0)}};f.Gfx.WebGLBatchJob=class{constructor(d){const e=new ArrayBuffer(96);this._type=0;this._batchState=d;this._gl=
d.renderer.GetContext();this._indexCount=this._startIndex=0;this._texParam=null;this._mat4param=new Float32Array(e,0,16);this._colorParam=new Float32Array(e,64,4);this._srcOriginRect=new Float32Array(e,80,4);this._shaderParams=[]}InitQuad(d,e){this._type=1;this._startIndex=d;this._indexCount=e}DoQuad(){const d=this._gl;d.drawElements(d.TRIANGLES,this._indexCount,d.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(d){this._type=2;this._texParam=d}DoSetTexture(){const d=this._gl,e=this._texParam;d.bindTexture(d.TEXTURE_2D,
e?e._GetTexture():null)}InitSetColor(d){this._type=3;d.writeToTypedArray(this._colorParam,0)}DoSetColor(){const d=this._colorParam,e=this._batchState;a.copy(e.currentColor,d);e.currentShader.UpdateColor(d)}InitSetGradientColor(d){this._type=20;d.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const d=this._colorParam,e=this._batchState.currentShader;e._uColor2.IsUsed()&&e._uColor2.Update4f(d[0],d[1],d[2],d[3])}InitSetBlend(d,e){this._type=4;this._startIndex=d;this._indexCount=e}DoSetBlend(){this._gl.blendFunc(this._startIndex,
this._indexCount)}InitSetViewport(d,e,h,g){this._type=5;const l=this._colorParam;l[0]=d;l[1]=e;l[2]=h;l[3]=g}DoSetViewport(){const d=this._colorParam;this._gl.viewport(d[0],d[1],d[2],d[3])}InitSetProjection(d){this._type=6;c.copy(this._mat4param,d)}DoSetProjection(){const d=this._batchState,e=d.renderer._allShaderPrograms,h=d.currentShader,g=this._mat4param;for(let l=0,m=e.length;l<m;++l){const u=e[l];u===h?u.UpdateMatP(g,!0):u.SetMatPStale()}c.copy(d.currentMatP,g)}InitSetModelView(d){this._type=
7;c.copy(this._mat4param,d)}DoSetModelView(){const d=this._batchState,e=d.renderer._allShaderPrograms,h=d.currentShader,g=this._mat4param;for(let l=0,m=e.length;l<m;++l){const u=e[l];u===h?u.UpdateMatMV(g,!0):u.SetMatMVStale()}c.copy(d.currentMV,g)}InitSetRenderTarget(d){this._type=8;this._texParam=d}DoSetRenderTarget(){const d=this._gl,e=this._texParam,h=this._batchState;e?(h.currentFramebuffer=e._GetFramebuffer(),h.currentFramebufferNoDepth=e._GetFramebufferNoDepth(),h.isDepthSamplingEnabled&&h.currentFramebufferNoDepth?
d.bindFramebuffer(d.FRAMEBUFFER,h.currentFramebufferNoDepth):d.bindFramebuffer(d.FRAMEBUFFER,h.currentFramebuffer)):(h.currentFramebuffer=null,h.currentFramebufferNoDepth=null,d.bindFramebuffer(d.FRAMEBUFFER,null))}InitClearSurface(d){this._type=9;d.writeToTypedArray(this._mat4param,0)}InitClearSurface2(d,e,h,g){this._type=9;const l=this._mat4param;l[0]=d;l[1]=e;l[2]=h;l[3]=g}DoClearSurface(){const d=this._gl;var e=this._mat4param;const h=this._batchState.clearColor,g=e[0],l=e[1],m=e[2];e=e[3];h.equalsRgba(g,
l,m,e)||(d.clearColor(g,l,m,e),h.setRgba(g,l,m,e));d.clear(d.COLOR_BUFFER_BIT)}InitSetPointTexCoords(d){this._type=14;d.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const d=this._mat4param;this._batchState.pointTexCoords.set(d[0],d[1],d[2],d[3])}InitPoints(d,e){this._type=10;this._startIndex=d;this._indexCount=1;this._mat4param[0]=e}DoPoints(){const d=this._gl,e=this._batchState,h=e.renderer._spPoints;d.useProgram(h._shaderProgram);h.UpdateMatP(e.currentMatP,!1);h.UpdateMatMV(e.currentMV,
!1);var g=e.pointTexCoords;h._uPointTexStart.IsUsed()&&h._uPointTexStart.Update2f(g.getLeft(),g.getTop());h._uPointTexEnd.IsUsed()&&h._uPointTexEnd.Update2f(g.getRight(),g.getBottom());g=this._mat4param[0];h._uZElevation.IsUsed()&&h._uZElevation.Update1f(g);h._uColor.IsUsed()&&(g=e.currentColor,h._uColor.Update4f(g[0],g[1],g[2],g[3]));d.drawArrays(d.POINTS,this._startIndex/4,this._indexCount);d.useProgram(e.currentShader._shaderProgram)}InitSetProgram(d){this._type=11;this._texParam=d}DoSetProgram(){var d=
this._gl;const e=this._batchState,h=this._texParam;e.currentShader=h;d.useProgram(h._shaderProgram);h.UpdateMatP(e.currentMatP,!1);h.UpdateMatMV(e.currentMV,!1);h._uColor.IsUsed()&&(d=e.currentColor,h._uColor.Update4f(d[0],d[1],d[2],d[3]))}InitSetProgramParameters(){this._type=12}DoSetProgramParameters(){const d=this._batchState.currentShader;d._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(d);d._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(d)}_DoSetOptionalUniformProgramParameters(d){const e=
this._gl,h=this._mat4param,g=this._colorParam,l=this._srcOriginRect;if(d._uSamplerBack.IsUsed()){const m=this._batchState.renderer,u=this._texParam;m._lastTexture1!==u&&(e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,u?u._GetTexture():null),m._lastTexture1=u,e.activeTexture(e.TEXTURE0))}d._uPixelSize.IsUsed()&&d._uPixelSize.Update2f(h[0],h[1]);d._uDestStart.IsUsed()&&d._uDestStart.Update2f(h[2],h[3]);d._uDestEnd.IsUsed()&&d._uDestEnd.Update2f(h[4],h[5]);d._uDevicePixelRatio.IsUsed()&&d._uDevicePixelRatio.Update1f(this._indexCount);
d._uLayerScale.IsUsed()&&d._uLayerScale.Update1f(h[6]);d._uLayerAngle.IsUsed()&&d._uLayerAngle.Update1f(h[7]);d._uSrcStart.IsUsed()&&d._uSrcStart.Update2f(h[12],h[13]);d._uSrcEnd.IsUsed()&&d._uSrcEnd.Update2f(h[14],h[15]);d._uSrcOriginStart.IsUsed()&&d._uSrcOriginStart.Update2f(l[0],l[1]);d._uSrcOriginEnd.IsUsed()&&d._uSrcOriginEnd.Update2f(l[2],l[3]);d._uLayoutStart.IsUsed()&&d._uLayoutStart.Update2f(g[0],g[1]);d._uLayoutEnd.IsUsed()&&d._uLayoutEnd.Update2f(g[2],g[3]);d._uSeconds.IsUsed()&&d._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(d){d=
d._uCustomParameters;const e=this._shaderParams;for(let h=0,g=d.length;h<g;++h){const l=d[h],m=e[h];l.IsColorType()?l.Update3f(m.getR(),m.getG(),m.getB()):l.Update1f(m)}}InitInvalidateFramebuffer(d){this._type=13;this._texParam=d}DoInvalidateFramebuffer(){const d=this._gl,e=this._texParam,h=this._batchState.currentFramebuffer;e!==h&&d.bindFramebuffer(d.FRAMEBUFFER,e);d.invalidateFramebuffer(d.FRAMEBUFFER,[d.COLOR_ATTACHMENT0]);e!==h&&d.bindFramebuffer(d.FRAMEBUFFER,h)}InitBlitFramebuffer(d,e,h){this._type=
16;const g=this._mat4param,l=this._batchState.renderer;g[0]=d.GetWidth();g[1]=d.GetHeight();g[2]=e?e.GetWidth():l.GetWidth();g[3]=e?e.GetHeight():l.GetHeight();g[4]=d.IsLinearSampling()?1:0;g[5]="stretch"===h;h=this._shaderParams;f.clearArray(h);h.push(d._GetFramebuffer());h.push(e?e._GetFramebuffer():null)}DoBlitFramebuffer(){var d=this._mat4param,e=this._shaderParams;const h=this._gl;var g=d[0],l=d[1],m=d[2];const u=d[3],w=0!==d[4];d=0!==d[5];const q=e[1];h.bindFramebuffer(h.READ_FRAMEBUFFER,e[0]);
h.bindFramebuffer(h.DRAW_FRAMEBUFFER,q);d?h.blitFramebuffer(0,0,g,l,0,0,m,u,h.COLOR_BUFFER_BIT,w?h.LINEAR:h.NEAREST):(e=Math.min(g,m),g=Math.min(l,u),m=Math.max(l-u,0),l=Math.max(u-l,0),h.blitFramebuffer(0,m,e,g+m,0,l,e,g+l,h.COLOR_BUFFER_BIT,h.NEAREST))}InitStartQuery(d){this._type=17;this._texParam=d}DoStartQuery(){this._texParam.BeginTimeElapsed();this._texParam=null}InitEndQuery(d){this._type=18;this._texParam=d}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(d,
e,h){this._type=19;const g=this._mat4param;g[0]=d;g[1]=e;g[2]=h}DoSetEllipseParams(){const d=this._batchState.currentShader,e=this._mat4param;d._uPixelSize.IsUsed()&&d._uPixelSize.Update2f(e[0],e[1]);d._uOutlineThickness.IsUsed()&&d._uOutlineThickness.Update1f(e[2])}InitSetTilemapInfo(d,e,h,g,l,m,u){this._type=15;const w=this._mat4param;d.writeToTypedArray(w,0);w[4]=1/e;w[5]=1/h;w[6]=g/e;w[7]=l/h;w[8]=m/e;w[9]=u/h}DoSetTilemapInfo(){const d=this._batchState.currentShader,e=this._mat4param;d._uSrcStart.IsUsed()&&
d._uSrcStart.Update2f(e[0],e[1]);d._uPixelSize.IsUsed()&&d._uPixelSize.Update2f(e[4],e[5]);d._uTileSize.IsUsed()&&d._uTileSize.Update2f(e[6],e[7]);d._uTileSpacing.IsUsed()&&d._uTileSpacing.Update2f(e[8],e[9])}InitClearDepth(d){this._type=21;this._startIndex=d?1:0}DoClearDepth(){const d=this._gl,e=0!==this._startIndex;e||d.depthMask(!0);d.clear(d.DEPTH_BUFFER_BIT);e||d.depthMask(!1)}InitSetDepthEnabled(d){this._type=22;this._startIndex=d?1:0}DoSetDepthEnabled(){const d=this._gl;0===this._startIndex?
(d.disable(d.DEPTH_TEST),d.depthMask(!1)):(d.enable(d.DEPTH_TEST),d.depthMask(!0))}InitSetDepthSamplingEnabled(d){this._type=23;this._startIndex=d?1:0}DoSetDepthSamplingEnabled(){const d=this._gl,e=this._batchState,h=e.renderer,g=0!==this._startIndex;e.isDepthSamplingEnabled=g;d.activeTexture(d.TEXTURE2);g?(e.currentFramebufferNoDepth&&d.bindFramebuffer(d.FRAMEBUFFER,e.currentFramebufferNoDepth),d.bindTexture(d.TEXTURE_2D,h._GetDepthBuffer())):(d.bindTexture(d.TEXTURE_2D,null),e.currentFramebufferNoDepth&&
d.bindFramebuffer(d.FRAMEBUFFER,e.currentFramebuffer));d.activeTexture(d.TEXTURE0)}InitCoplanarStartStencilPass(){this._type=24}DoCoplanarStartStencilPass(){const d=this._gl;d.clear(d.STENCIL_BUFFER_BIT);d.enable(d.STENCIL_TEST);d.stencilFunc(d.ALWAYS,1,1);d.stencilOp(d.KEEP,d.KEEP,d.REPLACE);d.colorMask(!1,!1,!1,!1)}InitCoplanarStartColorPass(){this._type=25}DoCoplanarStartColorPass(){const d=this._gl;d.colorMask(!0,!0,!0,!0);d.stencilFunc(d.EQUAL,1,1);d.stencilOp(d.KEEP,d.KEEP,d.KEEP)}InitCoplanarRestore(){this._type=
26}DoCoplanarRestore(){const d=this._gl;d.disable(d.STENCIL_TEST)}Run(){switch(this._type){case 1:this.DoQuad();break;case 2:this.DoSetTexture();break;case 3:this.DoSetColor();break;case 4:this.DoSetBlend();break;case 5:this.DoSetViewport();break;case 6:this.DoSetProjection();break;case 7:this.DoSetModelView();break;case 8:this.DoSetRenderTarget();break;case 9:this.DoClearSurface();break;case 10:this.DoPoints();break;case 11:this.DoSetProgram();break;case 12:this.DoSetProgramParameters();break;case 13:this.DoInvalidateFramebuffer();
break;case 14:this.DoSetPointTextureCoords();break;case 15:this.DoSetTilemapInfo();break;case 16:this.DoBlitFramebuffer();break;case 17:this.DoStartQuery();break;case 18:this.DoEndQuery();break;case 19:this.DoSetEllipseParams();break;case 20:this.DoSetGradientColor();break;case 21:this.DoClearDepth();break;case 22:this.DoSetDepthEnabled();break;case 23:this.DoSetDepthSamplingEnabled();break;case 24:this.DoCoplanarStartStencilPass();break;case 25:this.DoCoplanarStartColorPass();break;case 26:this.DoCoplanarRestore()}}}}
{"use strict";const f=self.C3,b={timeout:60},a=new f.Color(0,0,0,1),c=new Set(["left","center","right"]),d=new Set(["top","center","bottom"]),e=new Set(["word","character"]),h=new Set;f.FontManager&&f.FontManager.addEventListener("fontload",q=>{q=q.font.GetName();for(const t of h)(t.IsBBCodeEnabled()||f.equalsNoCase(t.GetFontName(),q))&&t._SetTextChanged()});function g(q,t,p,r,x,y){t?"Gecko"===f.Platform.BrowserEngine?q.strokeText(p,r,x,y):q.strokeText(p,r,x):"Gecko"===f.Platform.BrowserEngine?q.fillText(p,
r,x,y):q.fillText(p,r,x)}function l(q,t,p,r,x,y){t?q.strokeRect(p,r,x,y):q.fillRect(p,r,x,y)}function m(q){return 4/3*q}let u=!1,w=!1;f.Gfx.RendererText=class{constructor(q,t){t=Object.assign({},b,t);this._renderer=q;this._fontName="Arial";this._fontSize=16;this._fontSizeScale=1;this._lineHeight=0;this._isItalic=this._isBold=!1;this._colorStr="black";this._isBBcodeEnabled=!1;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text="";
this._bbString=null;this._wrappedText=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._measureContextTop=this._measureContext=this._textContext=this._textCanvas=null;this._lastCanvasHeight=this._lastCanvasWidth=-1;this._lastTextCanvasFillStyle=this._lastMeasureCanvasFont=this._lastTextCanvasFont="";this._lastTextCanvasLineWidth=
this._lastTextCanvasOpacity=1;this._measureTextCallback=(p,r)=>this._MeasureText(p,r);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new f.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new f.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},t.timeout);this.ontextureupdate=null;this._wasReleased=!1;h.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._measureTextCallback=this._measureContextTop=this._measureContext=
this._textContext=this._textCanvas=this._bbString=null;this._textureTimeout.Release();this.ontextureupdate=null;this.ReleaseTexture();this._wrappedText.Clear();this._renderer=this._wrappedText=null;this._wasReleased=!0;h.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=!0}SetIsAsync(q){this._isAsync=!!q}IsAsync(){return this._isAsync}SetBBCodeEnabled(q){q=!!q;this._isBBcodeEnabled!==q&&(q=(this._isBBcodeEnabled=q)?"alphabetic":
"top",this._textContext&&(this._textContext.textBaseline=q),this._measureContext&&(this._measureContext.textBaseline=q),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(q){q||(q="serif");this._fontName!==q&&(this._fontName=q,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(q){.1>q&&(q=.1);this._fontSize!==q&&(this._fontSize=q,this._SetTextChanged())}SetFontSizeScale(q){this._fontSizeScale!==q&&(this._fontSizeScale=q,this._SetTextChanged())}SetLineHeight(q){this._lineHeight!==
q&&(this._lineHeight=q,this._SetChanged())}SetBold(q){q=!!q;this._isBold!==q&&(this._isBold=q,this._SetTextChanged())}SetItalic(q){q=!!q;this._isItalic!==q&&(this._isItalic=q,this._SetTextChanged())}SetDrawMaxCharacterCount(q){q=Math.floor(q);this._drawMaxCharCount!==q&&(this._drawMaxCharCount=q,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(q,t){for(let p=q.length-1;0<=p;--p){const r=q[p];if(r.tag===t)return r}return null}_HasStyleTag(q,t){return!!this._GetStyleTag(q,
t)}_GetFontString(q,t){let p=[];(this._isBold||this._HasStyleTag(t,"b"))&&p.push("bold");(this._isItalic||this._HasStyleTag(t,"i"))&&p.push("italic");var r=this._GetStyleTag(t,"size");r=(r?parseFloat(r.param):this._fontSize)*this._fontSizeScale;q?p.push(r+"pt"):p.push(r*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");q=this._fontName;(t=this._GetStyleTag(t,"font"))&&t.param&&(q=t.param,this.onloadfont&&!this._alreadyLoadedFonts.has(q)&&(this.onloadfont(q),this._alreadyLoadedFonts.add(q)));
q&&p.push('"'+q+'"');return p.join(" ")}SetColor(q){q instanceof f.Color&&(q=q.getCssRgb());this._colorStr!==q&&(this._colorStr=q,this._SetChanged())}SetColorRgb(q,t,p){a.setRgb(q,t,p);this.SetColor(a)}SetHorizontalAlignment(q){if(!c.has(q))throw Error("invalid horizontal alignment");this._horizontalAlign!==q&&(this._horizontalAlign=q,this._SetChanged())}SetVerticalAlignment(q){if(!d.has(q))throw Error("invalid vertical alignment");this._verticalAlign!==q&&(this._verticalAlign=q,this._SetChanged())}SetWordWrapMode(q){if(!e.has(q))throw Error("invalid word wrap mode");
this._wrapMode!==q&&(this._wrapMode=q,this._SetTextChanged())}SetText(q){this._text!==q&&(this._text=q,this._SetTextChanged())}SetSize(q,t,p){"undefined"===typeof p&&(p=1);if(!(0>=q||0>=q||this._cssWidth===q&&this._cssHeight===t&&this._zoom===p)){1===this._zoom!==(1===p)&&(this._needToRecreateTexture=!0);var r=this._cssWidth,x=this._zoom;this._cssWidth=q;this._cssHeight=t;this._zoom=p;q=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*q;this._height=this._cssHeight*this._zoom*q;q=Math.max(this._width,
this._height);t=Math.min(this._renderer.GetMaxTextureSize(),2048);p=1;q>t&&(p=t/q,this._width=Math.min(this._width*p,t),this._height=Math.min(this._height*p,t));this._scaleFactor=p;0<this._textureWidth&&0<this._textureHeight&&this._zoom===x&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);this._cssWidth!==r?this._SetTextChanged():this._SetChanged()}}GetWidth(){return this._width}GetHeight(){return this._height}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();
return this._wrappedText.GetTotalLineHeight()+this._wrappedText.GetLineCount()*(this._lineHeight+4)-this._lineHeight}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();return this._texture}_MaybeUpdate(){this._texture&&!this._changed&&!this._textChanged||this._isUpdating||0>=this._width||0>=this._height||(this._changed=!1,this._isUpdating=!0,this._isAsync?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(q,t){this._textCanvas||(this._textCanvas=f.CreateCanvas(16,16));let p=!1;if(this._lastCanvasWidth!==q||this._lastCanvasHeight!==t)this._lastCanvasWidth=q,this._lastCanvasHeight=t,this._textCanvas.width=q,this._textCanvas.height=t,p=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),p=!0);p?(this._textContext.textBaseline=this._isBBcodeEnabled?
"alphabetic":"top",this._textContext.font=this._lastTextCanvasFont,this._textContext.fillStyle=this._lastTextCanvasFillStyle,this._textContext.strokeStyle=this._lastTextCanvasFillStyle,this._textContext.globalAlpha=this._lastTextCanvasOpacity,this._textContext.lineWidth=this._lastTextCanvasLineWidth):this._textContext.clearRect(0,0,q,t)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=f.CreateCanvas(16,16).getContext("2d"),this._measureContextTop=f.CreateCanvas(16,16).getContext("2d"),
this._measureContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._measureContextTop.textBaseline="top")}_SetMeasureFontString(q){this._lastMeasureCanvasFont!==q&&(this._lastMeasureCanvasFont=q,this._measureContext.font=q,this._measureContextTop.font=q)}_SupportsFontBoundingBoxMeasurements(){if(!u){u=!0;this._MaybeCreateMeasureContext();const q=this._measureContext.measureText("test");w="number"===typeof q.fontBoundingBoxAscent&&"number"===typeof q.fontBoundingBoxDescent}return w}_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(q,t){this._SetMeasureFontString(this._GetFontString(!0,t));t=this._GetStyleTag(t,"size");t=(t?parseFloat(t.param):this._fontSize)*this._fontSizeScale;
const p=this._measureContext.measureText(q);let r=0;this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements()&&(q=this._measureContextTop.measureText(q),r=p.fontBoundingBoxAscent-q.fontBoundingBoxAscent);return{width:p.width,height:m(t),fontBoundingBoxAscent:p.fontBoundingBoxAscent||0,fontBoundingBoxDescent:p.fontBoundingBoxDescent||0,topToAlphabeticDistance:r}}_SetDrawFontString(q){this._lastTextCanvasFont!==q&&(this._lastTextCanvasFont=q,this._textContext.font=q)}_SetDrawCanvasColor(q){this._lastTextCanvasFillStyle!==
q&&(this._lastTextCanvasFillStyle=q,this._textContext.fillStyle=q,this._textContext.strokeStyle=q)}_SetDrawCanvasOpacity(q){this._lastTextCanvasOpacity!==q&&(this._lastTextCanvasOpacity=q,this._textContext.globalAlpha=q)}_SetDrawCanvasLineWith(q){this._lastTextCanvasLineWidth!==q&&(this._lastTextCanvasLineWidth=q,this._textContext.lineWidth=q)}_DrawTextToCanvas(){this._drawCharCount=0;const q=this._scaleFactor*this._zoom*self.devicePixelRatio,t=(4+this._lineHeight)*q;var p=0;const r=this._wrappedText.GetLines();
if(0!==r.length){var x=this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements(),y=r[0].height*q;"center"===this._verticalAlign?(p=r.reduce((E,H)=>E+H.height*q+t,0)-t,p=Math.max(this._height/2-p/2,0),x&&(y=r[0].topToAlphabeticDistance*q)):"bottom"===this._verticalAlign&&(p=r.reduce((E,H)=>E+H.height*q+t,0)-this._lineHeight*q,x=x?r.at(-1).fontBoundingBoxDescent*q:0,p=this._height-p-x-2);for(let E=0,H=r.length;E<H;++E){x=r[E];const A=x.height*q,F=p;if(this._isBBcodeEnabled){if(p+=0===E?y:A,
0<E&&p>this._height-4*q)break}else if(0<E&&p>=this._height-A)break;0<=F&&this._DrawTextLine(x,p,q);this._isBBcodeEnabled||(p+=A);p+=t}}}_DrawTextLine(q,t,p){let r=0;"center"===this._horizontalAlign?r=(this._width-q.width*p)/2:"right"===this._horizontalAlign&&(r=this._width-q.width*p);for(const x of q.fragments)this._DrawTextFragment(x,r,t,p,q.height),r+=x.width*p}_DrawTextFragment(q,t,p,r,x){const y=this._textContext,E=x/16;x=q.width*r;const H=q.height*r,A=q.height/16;var F=(4+this._lineHeight)*r,
J=q.styles;q=q.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+q.length>this._drawMaxCharCount&&(q=q.substr(0,this._drawMaxCharCount-this._drawCharCount),x=this._MeasureText(q,J).width*r);this._drawCharCount+=q.length}var B=this._GetStyleTag(J,"background");const I=this._HasStyleTag(J,"u"),L=this._HasStyleTag(J,"s");if((!f.IsStringAllWhitespace(q)||B||I||L)&&!this._HasStyleTag(J,"hide")){var P=this._GetStyleTag(J,"offsetx");t+=P?parseFloat(P.param)*
r:0;P=this._GetStyleTag(J,"offsety");p+=P?parseFloat(P.param)*r:0;B&&(this._SetDrawCanvasColor(B.param),y.fillRect(t,p-H,x,H+F));F=this._GetStyleTag(J,"color");this._SetDrawCanvasColor(F?F.param:this._colorStr);B=this._GetStyleTag(J,"opacity");this._SetDrawCanvasOpacity(B?parseFloat(B.param)/100:1);B=(B=this._GetStyleTag(J,"linethickness"))?parseFloat(B.param):1;(P=this._HasStyleTag(J,"stroke"))&&this._SetDrawCanvasLineWith(.5*A*B*this._scaleFactor*this._zoom*self.devicePixelRatio);this._SetDrawFontString(this._GetFontString(!1,
J));g(y,P,q,t,p,x);!P&&(this._SetDrawCanvasLineWith(.5*A*B*this._scaleFactor*this._zoom*self.devicePixelRatio),J=this._GetStyleTag(J,"outline"))&&(this._SetDrawCanvasColor(J.param),g(y,!0,q,t,p,x));this._SetDrawCanvasColor(F?F.param:this._colorStr);I&&l(y,P,t,p+r*E,x,r*E*B);L&&(r*=A,y.fillRect(t,p-H/4+r/2-r*B/2,x,r*B))}}_UpdateTexture(){if(!this._renderer.IsContextLost()&&(this._textureWidth=Math.ceil(this._width),this._textureHeight=Math.ceil(this._height),this._rcTex.set(0,0,this._width/this._textureWidth,
this._height/this._textureHeight),this._needToRecreateTexture&&(this.ReleaseTexture(),this._needToRecreateTexture=!1),this._texture||(this._texture=this._renderer.CreateDynamicTexture(this._textureWidth,this._textureHeight,{mipMap:1===this._zoom,mipMapQuality:"high"})),this._renderer.UpdateTexture(this._textCanvas,this._texture),this.ontextureupdate))this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){this._texture&&(this._renderer.IsContextLost()||this._renderer.DeleteTexture(this._texture),
this._texture=null)}static OnContextLost(){for(const q of h)q.ReleaseTexture()}static GetAll(){return h.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 c=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);a&&!c&&(this._result=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT),this._result/=1E9,this._hasResult=!0);(a||
c)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}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.at(-1),this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null);this._isActive=!0;a.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");if(this._renderer._GetTimeQueryStack().pop()!==this)throw Error("can only end most nested query");this._isActive=!1;this._EndReal();this._parentQuery&&(this._parentQuery._StartReal(),
this._parentQuery=null)}_StartReal(){this._realQuery=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,c)=>a+c.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 c=0;for(const d of this._buffer){if(d.GetFrameNumber()>=a)break;if(!(d.GetFrameNumber()<b))if(d.HasResult())c+=d.GetResult();else return NaN}return c}DeleteAllBeforeFrameNumber(b){for(let a=0,c=this._buffer.length;a<c;++a){const d=this._buffer[a];if(d.GetFrameNumber()<b)d.Release();else{0<a&&this._buffer.splice(0,a);break}}}}}
{"use strict";const f=self.C3,b=self.glMatrix,a=b.vec4,c=b.mat4,d={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,depth:!1,canSampleDepth:!1,maxWebGLVersion:2,failIfMajorPerformanceCaveat:!1},e=new Set(["default","low-power","high-performance"]),h=new f.Quad(0,0,1,0,1,1,0,1),g=c.create(),l=c.create(),m=new f.Quad,u=new f.Rect;let w=null;f.isDebug&&(self.debug_lose_context=function(){w?w.loseContext():console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=
function(){w?w.restoreContext():console.warn("WEBGL_lose_context not supported")});const q=new Set;let t=-1;function p(){t=-1;for(const r of q)r.checkFunc()&&(r.resolve(),q.delete(r));0<q.size&&(t=self.requestAnimationFrame(p))}f.Gfx.WebGLRenderer=class extends f.Gfx.RendererBase{constructor(r,x){super();x=Object.assign({},d,x);if(!e.has(x.powerPreference))throw Error("invalid power preference");const y={alpha:!!x.alpha,depth:!1,antialias:!1,powerPreference:x.powerPreference,failIfMajorPerformanceCaveat:!!x.failIfMajorPerformanceCaveat};
x.lowLatency&&(y.desynchronized=!0,y.preserveDrawingBuffer=!0);let E=null,H=0;2<=x.maxWebGLVersion&&(E=r.getContext("webgl2",y),H=2);E||(E=r.getContext("webgl",y),H=1);if(!E)throw Error("failed to initialise WebGL context");this._gl=E;this._attribs=E.getContextAttributes();x.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=E.getParameter(E.VERSION);this._version=H;this._viewport=a.create();this._didChangeTransform=
!1;this._bbProjectionMatrix=c.create();this._usesDepthBuffer=!!x.depth;this._canSampleDepth=!(!x.depth||!x.canSampleDepth);this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=!1;this._depthBuffer=null;this._isAutoSizeDepthBuffer=!0;this._depthBufferHeight=this._depthBufferWidth=0;this._pointBuffer=this._indexBuffer=this._texcoordBuffer=this._vertexBuffer=null;this._vertexData=new Float32Array(8E3*this.GetNumVertexComponents());this._indexData=new Uint16Array(12E3);this._texcoordData=
new Float32Array(16E3);this._pointData=new Float32Array(32E3);this._lastVertexPtr=this._pointPtr=this._texPtr=this._vertexPtr=0;this._spDeviceTransformTextureFill=this._lastProgram=null;this._batch=[];this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=null;this._lastPointZ=0;this._batchState=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._lastPointTexCoords=new f.Rect;this._maxTextureSize=
-1;this._highpPrecision=this._maxPointSize=this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._isInitialisingAfterContextRestored=!1;this._depthTextureExt=this._anisotropicExt=this._parallelShaderCompileExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled=!!x.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return!0}async InitState(){super.InitState();
var r=this._gl,x=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*x-4*x;f.clearArray(this._batch);this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;x=this._batchState;x.currentShader=null;x.currentFramebuffer=null;x.currentFramebufferNoDepth=null;a.set(x.currentColor,1,1,1,1);x.clearColor.setRgba(0,
0,0,0);x.pointTexCoords.set(0,0,1,1);r.clearColor(0,0,0,0);r.clear(r.COLOR_BUFFER_BIT);r.enable(r.BLEND);r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=r.ONE;this._lastDestBlend=r.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(r);r.disable(r.CULL_FACE);r.disable(r.STENCIL_TEST);r.disable(r.DITHER);this._usesDepthBuffer?(r.enable(r.DEPTH_TEST),r.depthMask(!0),r.depthFunc(r.LEQUAL)):(r.disable(r.DEPTH_TEST),r.depthMask(!1));this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=
!1;this._pointBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer);r.bufferData(r.ARRAY_BUFFER,this._pointData.byteLength,r.DYNAMIC_DRAW);this._vertexBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer);r.bufferData(r.ARRAY_BUFFER,this._vertexData.byteLength,r.DYNAMIC_DRAW);this._texcoordBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer);r.bufferData(r.ARRAY_BUFFER,this._texcoordData.byteLength,r.DYNAMIC_DRAW);this._indexBuffer=r.createBuffer();
r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this._indexBuffer);r.bufferData(r.ELEMENT_ARRAY_BUFFER,this._indexData,r.STATIC_DRAW);r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,null);this._maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE);x=r.getParameter(r.ALIASED_POINT_SIZE_RANGE);this._minPointSize=x[0];this._maxPointSize=x[1];x=r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT);const y=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);this._highpPrecision=x&&y?Math.min(x.precision,
y.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=r.getSupportedExtensions();if(x=r.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor=r.getParameter(x.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=r.getParameter(x.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=r.getExtension("KHR_parallel_shader_compile");f.isDebug&&(w=r.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=r.getExtension("EXT_disjoint_timer_query")}else this._timerExt=r.getExtension("EXT_disjoint_timer_query_webgl2")||r.getExtension("EXT_disjoint_timer_query");this._maxAnisotropy=(this._anisotropicExt=r.getExtension("EXT_texture_filter_anisotropic"))?r.getParameter(this._anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;if(2>this.GetWebGLVersionNumber()&&this._usesDepthBuffer&&this._canSampleDepth&&(this._depthTextureExt=
r.getExtension("WEBGL_depth_texture"),!this._depthTextureExt))throw Error("no depth texture support");r=f.Gfx.WebGLShaderProgram;x=r.GetDefaultVertexShaderSource(!1);r=[[r.GetTextureFillFragmentShaderSource(),x,"<default>"],[r.GetTextureFillFragmentShaderSource(),x,"<default-device-transform>"],[r.GetPointFragmentShaderSource(this._version),r.GetPointVertexShaderSource(this._version),"<point>"],[r.GetColorFillFragmentShaderSource(),x,"<fill>"],[r.GetLinearGradientFillFragmentShaderSource(),x,"<lineargradient>"],
[r.GetHardEllipseFillFragmentShaderSource(),x,"<hardellipse>"],[r.GetHardEllipseOutlineFragmentShaderSource(),x,"<hardellipseoutline>"],[r.GetSmoothEllipseFillFragmentShaderSource(),x,"<smoothellipse>"],[r.GetSmoothEllipseOutlineFragmentShaderSource(),x,"<smoothellipseoutline>"],[r.GetSmoothLineFillFragmentShaderSource(),x,"<smoothline>"],[r.GetTilemapFragmentShaderSource(),r.GetDefaultVertexShaderSource(!0),"<tilemap>"]];r=await Promise.all(r.map(E=>this.CreateShaderProgram({src:E[0]},E[1],E[2])));
this._spTextureFill=r[0];this._spDeviceTransformTextureFill=r[1];this._spPoints=r[2];this._spColorFill=r[3];this._spLinearGradientFill=r[4];this._spHardEllipseFill=r[5];this._spHardEllipseOutline=r[6];this._spSmoothEllipseFill=r[7];this._spSmoothEllipseOutline=r[8];this._spSmoothLineFill=r[9];this._spTilemapFill=r[10];this.SetTextureFillMode()}async CreateShaderProgram(r,x,y){r=await f.Gfx.WebGLShaderProgram.Create(this,r,x,y);this._AddShaderProgram(r);return r}ResetLastProgram(){this._lastProgram=
null}SetSize(r,x,y){if(this._width!==r||this._height!==x||y){this.EndBatch();y=this._gl;var E=this._batchState;this._width=r;this._height=x;this._SetViewport(0,0,r,x);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,r/x);this.SetProjectionMatrix(this._bbProjectionMatrix);this._spDeviceTransformTextureFill&&(y.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,
this._batchState.currentShader=this._spDeviceTransformTextureFill);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE1);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE0);this._lastTexture1=this._lastTexture0=null;this._usesDepthBuffer&&this._isAutoSizeDepthBuffer&&this._SetDepthBufferSize(this._width,this._height);this._currentRenderTarget&&this._currentRenderTarget._Resize(this._width,this._height);y.bindFramebuffer(y.FRAMEBUFFER,null);this._currentRenderTarget=null;E.currentFramebuffer=
null;E.currentFramebufferNoDepth=null}}_SetDepthBufferSize(r,x){const y=this._gl;this._depthBuffer&&this._depthBufferWidth===r&&this._depthBufferHeight===x||(this._canSampleDepth?(this._depthBuffer&&y.deleteTexture(this._depthBuffer),this._depthBuffer=y.createTexture(),y.bindTexture(y.TEXTURE_2D,this._depthBuffer),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),
y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),2<=this.GetWebGLVersionNumber()?y.texImage2D(y.TEXTURE_2D,0,y.DEPTH24_STENCIL8,r,x,0,y.DEPTH_STENCIL,y.UNSIGNED_INT_24_8,null):this._depthTextureExt&&y.texImage2D(y.TEXTURE_2D,0,y.DEPTH_STENCIL,r,x,0,y.DEPTH_STENCIL,this._depthTextureExt.UNSIGNED_INT_24_8_WEBGL,null),y.bindTexture(y.TEXTURE_2D,null)):(this._depthBuffer&&y.deleteRenderbuffer(this._depthBuffer),this._depthBuffer=y.createRenderbuffer(),y.bindRenderbuffer(y.RENDERBUFFER,this._depthBuffer),
y.renderbufferStorage(y.RENDERBUFFER,2<=this._version?y.DEPTH24_STENCIL8:y.DEPTH_STENCIL,r,x),y.bindRenderbuffer(y.RENDERBUFFER,null)),this._depthBufferWidth=r,this._depthBufferHeight=x)}SetFixedSizeDepthBuffer(r,x){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!1,this._SetDepthBufferSize(r,x))}SetAutoSizeDepthBuffer(){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!0,this._SetDepthBufferSize(this._width,this._height))}_SetViewport(r,x,y,E){const H=this._viewport;if(H[0]!==r||H[1]!==x||
H[2]!==y||H[3]!==E)this.PushBatch().InitSetViewport(r,x,y,E),a.set(H,r,x,y,E),this._topOfBatch=0}SetProjectionMatrix(r){c.exactEquals(this._matP,r)||(this.PushBatch().InitSetProjection(r),c.copy(this._matP,r),this._topOfBatch=0,this._didChangeTransform=!0)}SetDefaultRenderTargetProjectionState(){let r,x;var y=this._currentRenderTarget;null===y?(r=this._bbProjectionMatrix,x=this.GetWidth(),y=this.GetHeight()):(r=y.GetProjectionMatrix(),x=y.GetWidth(),y=y.GetHeight());this.SetProjectionMatrix(r);this._SetViewport(0,
0,x,y)}SetModelViewMatrix(r){c.exactEquals(this._matMV,r)||(this.PushBatch().InitSetModelView(r),c.copy(this._matMV,r),this._topOfBatch=0,this._didChangeTransform=!0)}ResetDidChangeTransformFlag(){this._didChangeTransform=!1}DidChangeTransform(){return this._didChangeTransform}GetBatchState(){return this._batchState}PushBatch(){const r=this._batch;this._batchPtr===r.length&&r.push(new f.Gfx.WebGLBatchJob(this._batchState));return r[this._batchPtr++]}EndBatch(){0===this._batchPtr||this.IsContextLost()||
(this._WriteBuffers(),this._ExecuteBatch(),this._topOfBatch=this._pointPtr=this._texPtr=this._vertexPtr=this._batchPtr=0)}_WriteBuffers(){const r=this._gl;0<this._pointPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr)));0<this._vertexPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr)),r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer),r.bufferSubData(r.ARRAY_BUFFER,
0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const r=this._batch;for(let x=0,y=this._batchPtr;x<y;++x)r[x].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(r,x,y,E){const H=this._lastColor;H.equalsRgba(r,x,y,E)||(H.setRgba(r,x,y,E),this.PushBatch().InitSetColor(H),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(r){const x=this._lastColor;x.getA()!==r&&(x.setA(r),this.PushBatch().InitSetColor(x),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(r){const x=
this._lastColor;x.equals(r)||(x.set(r),this.PushBatch().InitSetColor(x),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(r){r!==this._lastTexture0&&(this.PushBatch().InitSetTexture(r),this._lastTexture0=r,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(r){r=this._GetBlendByIndex(r);this._SetBlend(r[0],r[1])}SetNamedBlendMode(r){r=this.GetNamedBlend(r);this._SetBlend(r.srcBlend,r.destBlend)}_SetBlend(r,
x){if(r!==this._lastSrcBlend||x!==this._lastDestBlend)this.PushBatch().InitSetBlend(r,x),this._lastSrcBlend=r,this._lastDestBlend=x,this._topOfBatch=0,this._currentStateGroup=null}IsPremultipliedAlphaBlend(){return this._lastSrcBlend===this._gl.ONE&&this._lastDestBlend===this._gl.ONE_MINUS_SRC_ALPHA}SetAlphaBlend(){this._SetBlend(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA)}SetNoPremultiplyAlphaBlend(){this._SetBlend(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA)}SetCopyBlend(){this._SetBlend(this._gl.ONE,
this._gl.ZERO)}Rect(r){this.Rect2(r.getLeft(),r.getTop(),r.getRight(),r.getBottom())}Rect2(r,x,y,E){this.Quad2(r,x,y,x,y,E,r,E)}_ExtendQuadBatch(){let r=this._vertexPtr;r>=this._lastVertexPtr&&(this.EndBatch(),r=0);1===this._topOfBatch?this._batch[this._batchPtr-1]._indexCount+=6:(this.PushBatch().InitQuad(r,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(r){r.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(r){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);
h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(r,x,y,E,H,A,F,J){this._ExtendQuadBatch();const B=this._vertexData;let I=this._vertexPtr;const L=this._baseZ+this._currentZ;B[I++]=r;B[I++]=x;B[I++]=L;B[I++]=y;B[I++]=E;B[I++]=L;B[I++]=H;B[I++]=A;B[I++]=L;B[I++]=F;B[I++]=J;B[I++]=L;this._vertexPtr=I;h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(r,x){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);x.writeAsQuadToTypedArray(this._texcoordData,
this._texPtr);this._texPtr+=8}Quad4(r,x){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);x.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(r,x,y,E,H,A,F,J,B,I,L,P,S){this._ExtendQuadBatch();const U=this._vertexData;let V=this._vertexPtr;const Z=this._baseZ+this._currentZ;U[V++]=r;U[V++]=x;U[V++]=Z+y;U[V++]=E;U[V++]=H;U[V++]=Z+A;U[V++]=F;U[V++]=J;U[V++]=Z+B;U[V++]=I;U[V++]=L;U[V++]=Z+P;this._vertexPtr=V;S.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=
8}Quad3D2(r,x,y,E,H,A,F,J,B,I,L,P,S){this._ExtendQuadBatch();const U=this._vertexData;let V=this._vertexPtr;const Z=this._baseZ+this._currentZ;U[V++]=r;U[V++]=x;U[V++]=Z+y;U[V++]=E;U[V++]=H;U[V++]=Z+A;U[V++]=F;U[V++]=J;U[V++]=Z+B;U[V++]=I;U[V++]=L;U[V++]=Z+P;this._vertexPtr=V;S.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(r,x){c.copy(g,this._matP);c.copy(l,this._matMV);this.SetDefaultRenderTargetProjectionState();const [y,E]=this.GetRenderTargetSize(this._currentRenderTarget);
var H=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0,E);this.SetModelViewMatrix(H);if("crop"===r&&this._currentRenderTarget&&x){r=this._width/2;H=this._height/2;const J=x.GetWidth();x=x.GetHeight();var A=this._currentRenderTarget.GetWidth(),F=this._currentRenderTarget.GetHeight();A=Math.min(A,J);const B=Math.min(F,x),I=Math.max(x-F,0);F=Math.max(F-x,0);u.set(-r,H-F,-r+A,H-B-F);m.setFromRect(u);u.set(0,I,A,B+I);u.divide(J,x);this.Quad3(m,u)}else r=y/2,H=E/2,
this.Rect2(-r,H,r,-H);this.SetProjectionMatrix(g);this.SetModelViewMatrix(l)}StartRenderingPoints(r){this._lastPointTexCoords.equals(r)||(this._lastPointTexCoords.copy(r),this.PushBatch().InitSetPointTexCoords(r),this._topOfBatch=0)}FinishRenderingPoints(){}Point(r,x,y,E){7996<=this._pointPtr&&this.EndBatch();let H=this._pointPtr;var A=this._baseZ+this._currentZ;2===this._topOfBatch&&this._lastPointZ===A?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(H,A),this._topOfBatch=
2,this._lastPointZ=A);A=this._pointData;A[H++]=r;A[H++]=x;A[H++]=y;A[H++]=E;this._pointPtr=H}SetProgram(r){this._lastProgram!==r&&(this.PushBatch().InitSetProgram(r),this._lastProgram=r,this._topOfBatch=0,this._currentStateGroup=null)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(r){this.PushBatch().InitSetGradientColor(r);this._topOfBatch=0}SetEllipseParams(r,x,y=1){this.PushBatch().InitSetEllipseParams(r,x,y);this._topOfBatch=0}SetTilemapInfo(r,
x,y,E,H,A,F){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(r,x,y,E,H,A,F);this._topOfBatch=0}SetProgramParameters(r,x,y,E,H,A,F,J,B,I,L,P){const S=this._lastProgram;var U=S._hasAnyOptionalUniforms;const V=!!P.length;if(U&&!S.AreOptionalUniformsAlreadySetInBatch(x,y,E,H,A,F,J,B,I,L)||V&&!S.AreCustomParametersAlreadySetInBatch(P)){var Z=this.PushBatch();Z.InitSetProgramParameters();U&&(S.SetOptionalUniformsInBatch(x,y,
E,H,A,F,J,B,I,L),U=Z._mat4param,U[0]=A,U[1]=F,x.writeToTypedArray(U,2),U[6]=B,U[7]=I,y.writeToTypedArray(U,12),x=Z._colorParam,H.writeToTypedArray(x,0),H=x[1],x[1]=x[3],x[3]=H,E.writeToTypedArray(Z._srcOriginRect,0),Z._startIndex=L,Z._indexCount=J,S._uSamplerBack.IsUsed()?Z._texParam=r?r.GetTexture():null:Z._texParam=null);V&&(S.SetCustomParametersInBatch(P),f.shallowAssignArray(Z._shaderParams,P));this._topOfBatch=0}}ClearRgba(r,x,y,E){this.PushBatch().InitClearSurface2(r,x,y,E);this._topOfBatch=
0}Clear(r){this.PushBatch().InitClearSurface(r);this._topOfBatch=0}Start(){}Finish(){super.Finish();this._gl.flush()}ClearDepth(){this._usesDepthBuffer&&this._currentRenderTarget&&this._currentRenderTarget.HasDepthBuffer()&&(this.PushBatch().InitClearDepth(this._isDepthEnabled),this._topOfBatch=0)}SetDepthEnabled(r){r=!!r;this._isDepthEnabled!==r&&this._usesDepthBuffer&&(this._isDepthEnabled=r,this.PushBatch().InitSetDepthEnabled(r),this._topOfBatch=0)}IsDepthEnabled(){return this._isDepthEnabled}_GetDepthBuffer(){return this._depthBuffer}_CanSampleDepth(){return this._canSampleDepth}SetDepthSamplingEnabled(r){r=
!!r;if(this._canSampleDepth&&this._isDepthSamplingEnabled!==r){if(r&&this.IsDepthEnabled())throw Error("depth still enabled");this._isDepthSamplingEnabled=r;this.PushBatch().InitSetDepthSamplingEnabled(r);this._topOfBatch=0}}CheckForQueryResults(){for(const r of this._allQueryResultBuffers)r.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();f.Gfx.WebGLRendererTexture.OnContextLost();
f.Gfx.WebGLRenderTarget.OnContextLost();f.Gfx.RendererText.OnContextLost();for(const r of this._allQueryResultBuffers)r.Clear();this._extensions=[];this._depthTextureExt=this._anisotropicExt=this._parallelShaderCompileExt=this._timerExt=null;this._maxAnisotropy=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._depthBuffer=this._spDeviceTransformTextureFill=this._lastProgram=null;for(const r of this._stateGroups.values())r.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored=
!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const r of this._stateGroups.values())r.OnContextRestored(this);this.SetSize(this._width,this._height,!0)}CreateStaticTexture(r,x){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const y=f.New(f.Gfx.WebGLRendererTexture,this);y._CreateStatic(r,x);return y}CreateStaticTextureAsync(r,x){if(this.IsContextLost())return Promise.reject("context lost");x=Object.assign({},x);const y=x.wrapX&&"clamp-to-edge"!==x.wrapX||
x.wrapY&&"clamp-to-edge"!==x.wrapY;if(!f.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&y)return f.Supports.ImageBitmap?createImageBitmap(r).then(E=>f.Asyncify(()=>this.CreateStaticTexture(E,x))):r instanceof Blob?f.BlobToImage(r,!0).then(E=>this.CreateStaticTextureAsync(E,x)):"undefined"!==typeof HTMLImageElement&&r instanceof HTMLImageElement&&"function"===typeof r.decode?r.decode().then(()=>f.Asyncify(()=>this.CreateStaticTexture(r,x))):f.Asyncify(()=>this.CreateStaticTexture(r,x));
x.premultiplyAlpha=!1;return createImageBitmap(r,{premultiplyAlpha:"premultiply"}).then(E=>f.Asyncify(()=>this.CreateStaticTexture(E,x)))}CreateDynamicTexture(r,x,y){this.EndBatch();const E=f.New(f.Gfx.WebGLRendererTexture,this);E._CreateDynamic(r,x,y);return E}UpdateTexture(r,x,y){this.EndBatch();x._Update(r,y)}DeleteTexture(r){r&&(r.SubtractReference(),0<r.GetReferenceCount()||(this.EndBatch(),r===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),r===this._lastTexture1&&
(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=null),r._Delete()))}CreateRenderTarget(r){let x=this._width,y=this._height,E=!0;r&&("number"===typeof r.width&&(x=r.width,E=!1),"number"===typeof r.height&&(y=r.height,E=!1));if(0>=x||0>=y)throw Error("invalid size");this.EndBatch();const H=f.New(f.Gfx.WebGLRenderTarget,this);H._Create(x,y,Object.assign({isDefaultSize:E},r));this._currentRenderTarget=
null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;return H}SetRenderTarget(r,x=!0){r!==this._currentRenderTarget&&(r&&r.IsDefaultSize()&&r._Resize(this._width,this._height),this.PushBatch().InitSetRenderTarget(r),this._currentRenderTarget=r,this._topOfBatch=0,x&&this.SetDefaultRenderTargetProjectionState())}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(r){return r?[r.GetWidth(),r.GetHeight()]:[this._width,this._height]}CopyRenderTarget(r,
x="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(r,x)):(this.PushBatch().InitBlitFramebuffer(r,this._currentRenderTarget,x),this._topOfBatch=0)}DrawRenderTarget(r,x="stretch"){r=r.GetTexture();if(!r)throw Error("not a texture-backed render target");this.SetTexture(r);this.FullscreenQuad(x,r)}InvalidateRenderTarget(r){2>this._version||(this.PushBatch().InitInvalidateFramebuffer(r._GetFramebuffer()),
this._topOfBatch=0)}DeleteRenderTarget(r){this.SetRenderTarget(null);this.EndBatch();const x=r.GetTexture();x===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);x===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=null);r._Delete()}async ReadBackRenderTargetToImageData(r,x,y){this.EndBatch();const E=this._currentRenderTarget;if(r){var H=
r.GetWidth();var A=r.GetHeight();var F=r._GetFramebuffer()}else H=this.GetWidth(),A=this.GetHeight(),F=null;let J=r=0;var B=H,I=A;y&&(r=f.clamp(Math.floor(y.getLeft()),0,H-1),J=f.clamp(Math.floor(y.getTop()),0,A-1),B=y.width(),B=0===B?H-r:f.clamp(Math.floor(B),0,H-r),I=y.height(),I=0===I?A-J:f.clamp(Math.floor(I),0,A-J),J=A-(J+I));const L=this._gl;L.bindFramebuffer(L.FRAMEBUFFER,F);A=()=>{L.bindFramebuffer(L.FRAMEBUFFER,null);this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;
this._batchState.currentFramebufferNoDepth=null;this.SetRenderTarget(E)};if(!x&&2<=this.GetWebGLVersionNumber()){L.bindFramebuffer(L.READ_FRAMEBUFFER,F);F=L.createBuffer();y=B*I*4;H=L.PIXEL_PACK_BUFFER;L.bindBuffer(H,F);L.bufferData(H,y,L.STREAM_READ);L.readPixels(r,J,B,I,L.RGBA,L.UNSIGNED_BYTE,0);L.bindFramebuffer(L.READ_FRAMEBUFFER,null);L.bindBuffer(H,null);A();const P=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>L.getSyncParameter(P,L.SYNC_STATUS)===L.SIGNALED);
L.deleteSync(P);x=new ImageData(B,I);L.bindBuffer(H,F);L.getBufferSubData(H,0,new Uint8Array(x.data.buffer),0,y);L.bindBuffer(H,null);L.deleteBuffer(F)}else x=new ImageData(B,I),L.readPixels(r,J,B,I,L.RGBA,L.UNSIGNED_BYTE,new Uint8Array(x.data.buffer)),A();return x}CoplanarStartStencilPass(){this.SetDepthEnabled(!0);this.PushBatch().InitCoplanarStartStencilPass();this._topOfBatch=0}CoplanarStartColorPass(){this.SetDepthEnabled(!1);this.PushBatch().InitCoplanarStartColorPass();this._topOfBatch=0}CoplanarRestoreStandardRendering(){this.SetDepthEnabled(!0);
this.PushBatch().InitCoplanarRestore();this._topOfBatch=0}StartQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitStartQuery(r),this._topOfBatch=0)}EndQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(r),this._topOfBatch=0)}_WaitForObjectReady(r){const x=new Promise(y=>q.add({resolve:y,checkFunc:r}));-1===t&&(t=self.requestAnimationFrame(p));return x}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*
(this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let r=0;for(const x of f.Gfx.WebGLRenderTarget.allRenderTargets())x.GetTexture()||(r+=x.GetEstimatedMemoryUsage());return r}GetEstimatedTextureMemoryUsage(){let r=0;for(const x of f.Gfx.WebGLRendererTexture.allTextures())r+=x.GetEstimatedMemoryUsage();return r}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}GetDisplayName(){return"webgl"+
this.GetWebGLVersionNumber()}SupportsNPOTTextures(){return 2<=this.GetWebGLVersionNumber()}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return 0!==this._highpPrecision}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetExtensions(){return this._extensions}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_GetAnisotropicExtension(){return this._anisotropicExt}_GetMaxAnisotropy(){return this._maxAnisotropy}_AddQueryResultBuffer(r){this._allQueryResultBuffers.add(r)}_RemoveQueryResultBuffer(r){this._allQueryResultBuffers.delete(r)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(r){this._InitBlendModeData([["normal",
r.ONE,r.ONE_MINUS_SRC_ALPHA],["additive",r.ONE,r.ONE],["xor",r.ONE,r.ONE_MINUS_SRC_ALPHA],["copy",r.ONE,r.ZERO],["destination-over",r.ONE_MINUS_DST_ALPHA,r.ONE],["source-in",r.DST_ALPHA,r.ZERO],["destination-in",r.ZERO,r.SRC_ALPHA],["source-out",r.ONE_MINUS_DST_ALPHA,r.ZERO],["destination-out",r.ZERO,r.ONE_MINUS_SRC_ALPHA],["source-atop",r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],["destination-atop",r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA]])}CreateRendererText(){return f.New(f.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}}
{"use strict";const f={getDrawSize:null,getRenderTarget:null,releaseRenderTarget:null,getTime:null,redraw:null};self.C3.Gfx.EffectChainManager=class{constructor(b){b=Object.assign({},f,b);this._cbGetDrawSize=b.getDrawSize;this._cbGetRenderTarget=b.getRenderTarget;this._cbReleaseRenderTarget=b.releaseRenderTarget;this._cbGetTime=b.getTime;this._cbRedraw=b.redraw}GetDrawSize(b){return this._cbGetDrawSize?this._cbGetDrawSize(b):[b.GetWidth(),b.GetHeight()]}GetRenderTarget(b){return this._cbGetRenderTarget(b)}ReleaseRenderTarget(b,
a){this._cbReleaseRenderTarget(b,a)}GetTime(){return this._cbGetTime()}Redraw(b){this._cbRedraw(b)}}}
{"use strict";const f=self.C3,b=self.glMatrix.mat4,a=f.New(f.Rect),c=f.New(f.Rect),d=f.New(f.Rect),e=f.New(f.Rect),h=b.create(),g=b.create(),l={drawContent:null,getSourceTextureInfo:null,getShaderParameters:null,invalidateRenderTargets:!1},m={indexMap:null,forcePreDraw:!1,forcePostDraw:!1,is3D:!1,isSourceTextureRotated:!1,isRotatedOrNegativeSizeInstance:!1,useFullSurface:!1},u={contentObject:null,contextObject:null,blendMode:0,devicePixelRatio:1,layerScale:1,layerAngle:0,layoutRect:null,drawSurfaceRect:null,
drawContentHook:null,compositOffX:0,compositOffY:0,updateOwnProjection:!1};f.Gfx.EffectChain=class{constructor(w,q){q=Object.assign({},l,q);this._manager=w;this._cbDrawContent=q.drawContent;this._cbGetSourceTextureInfo=q.getSourceTextureInfo;this._cbGetShaderParameters=q.getShaderParameters;this._cbDrawContentHook=null;this._shaderProgramList=[];this._shaderProgramIndices=[];this._steps=[];this._blendMode=0;this._isSourceTextureRotated=this._useFullSurface=this._canUseFastPath=this._depthEnabledAtStart=
this._didChangeTransform=this._isAnyShaderDepthSampling=this._isAnyShaderAnimated=!1;this._numTempSurfacesRequired=0;this._renderTargets=[null,null,null];this._invalidateRenderTargets=!!q.invalidateRenderTargets;this._drawHeight=this._drawWidth=this._boxExtendVertical=this._boxExtendHorizontal=0;this._contextObject=this._contentObject=null;this._layoutRect=f.New(f.Rect);this._drawSurfaceRect=f.New(f.Rect);this._rcTexOriginal=f.New(f.Rect);this._rcTexBounce=f.New(f.Rect);this._rcTexDest=f.New(f.Rect);
this._layerScale=this._devicePixelRatio=1;this._time=this._layerAngle=0;this._destRenderTarget=null;this._compositOffY=this._compositOffX=0;this._updateOwnProjection=!1;this._projectionMatrix=b.create();this._modelViewMatrix=b.create()}Release(){f.clearArray(this._steps);f.clearArray(this._shaderProgramList);f.clearArray(this._shaderProgramIndices);this._cbGetShaderParameters=this._cbGetSourceTextureInfo=this._cbDrawContent=this._contextObject=this._contentObject=null}BuildSteps(w,q){q=Object.assign({},
m,q);f.clearArray(this._steps);this._boxExtendVertical=this._boxExtendHorizontal=0;this._isAnyShaderDepthSampling=this._isAnyShaderAnimated=!1;this._numTempSurfacesRequired=0;this._isSourceTextureRotated=!!q.isSourceTextureRotated;this._useFullSurface=!!q.useFullSurface;f.shallowAssignArray(this._shaderProgramList,w);if(0!==w.length){if(q.indexMap){if(q.indexMap.length!==w.length)throw Error("incorrect indexMap length");f.shallowAssignArray(this._shaderProgramIndices,q.indexMap)}else{f.clearArray(this._shaderProgramIndices);
for(let r=0,x=w.length;r<x;++r)this._shaderProgramIndices.push(r)}for(var t of w)this._boxExtendHorizontal+=t.GetBoxExtendHorizontal(),this._boxExtendVertical+=t.GetBoxExtendVertical(),t.IsAnimated()&&(this._isAnyShaderAnimated=!0),t.UsesDepth()&&(this._isAnyShaderDepthSampling=!0);if(1!==w.length||w[0].BlendsBackground()||w[0].UsesCrossSampling()||!q.useFullSurface&&w[0].ExtendsBox()||q.forcePreDraw||w[0].MustPreDraw()||q.forcePostDraw||q.is3D||!this._useFullSurface&&w[0].UsesDepth()){this._canUseFastPath=
!1;t=this._ShouldPreDraw(w[0],q);q=this._ShouldPostDraw(w.at(-1),q);var p=0;t&&(this._numTempSurfacesRequired=1,this._steps.push(f.New(f.Gfx.EffectChain.Step.PreDraw,this,-1,1)),p=1);for(let r=0,x=w.length;r<x;++r)0!==r||t?(w=1===p?2:1,r!==x-1||q||(w=0),this._numTempSurfacesRequired=Math.max(this._numTempSurfacesRequired,w),this._steps.push(f.New(f.Gfx.EffectChain.Step.Bounce,this,p,w,r)),p=w):(this._numTempSurfacesRequired=1,this._steps.push(f.New(f.Gfx.EffectChain.Step.FirstBounce,this,-1,1,r)),
p=1);q&&this._steps.push(f.New(f.Gfx.EffectChain.Step.PostDraw,this,p,0))}else this._canUseFastPath=!0}}_ShouldPreDraw(w,q){return q.forcePreDraw||q.is3D||!this._useFullSurface&&w.UsesDepth()||w.MustPreDraw()||w.BlendsBackground()&&(q.isRotatedOrNegativeSizeInstance||w.GetRenderer().IsWebGL()&&q.isSourceTextureRotated)||0!==this._boxExtendHorizontal||0!==this._boxExtendVertical}_ShouldPostDraw(w,q){return q.forcePostDraw||w.BlendsBackground()||w.UsesCrossSampling()}Render(w,q,t){t=Object.assign({},
u,t);w.IsWebGPU()&&null===q&&(q=w.GetBackbufferRenderTarget());this._destRenderTarget=q;this._contentObject=t.contentObject;this._contextObject=t.contextObject;this._blendMode=t.blendMode;this._devicePixelRatio=t.devicePixelRatio;this._layerScale=t.layerScale;this._layerAngle=t.layerAngle;this._time=this._manager.GetTime();this._didChangeTransform=!1;w.ResetDidChangeTransformFlag();this._isAnyShaderAnimated&&this._Redraw();if(this._canUseFastPath)this._Render_FastPath(w,t);else{var [p,r]=this._manager.GetDrawSize(w);
this._SetDrawSize(w,p,r);this._CalculateRectangles(t);w.ResetColor();w.SetBaseZ(0);w.SetCurrentZ(0);this._cbDrawContentHook=t.drawContentHook;this._compositOffX=t.compositOffX||0;this._compositOffY=t.compositOffY||0;this._updateOwnProjection=!!t.updateOwnProjection;this._OnBeforeStartEffectChain(w);this._renderTargets[0]=q;this._renderTargets[1]=1<=this._numTempSurfacesRequired?this._GetRenderTarget():null;this._renderTargets[2]=2===this._numTempSurfacesRequired?this._GetRenderTarget():null;for(const x of this._steps)q=
this._GetRenderTargetForId(x.GetSrcTargetId()),t=this._GetRenderTargetForId(x.GetDestTargetId()),w.IsWebGPU()?x.Run_WebGPU(w,q,t):x.Run_WebGL(w,q,t);this._renderTargets[1]&&this._ReleaseRenderTarget(this._renderTargets[1]);this._renderTargets[2]&&this._ReleaseRenderTarget(this._renderTargets[2]);this._renderTargets.fill(null);this._OnAfterEndEffectChain(w);this._cbDrawContentHook=this._contextObject=this._contentObject=this._destRenderTarget=null}}_SetDrawSize(w,q,t){if(0>=q||0>=t)throw Error("invalid draw size");
this._drawWidth===q&&this._drawHeight===t||this._CalculateDeviceTransformMatrices(w,q,t,0,0,this._projectionMatrix,this._modelViewMatrix);this._drawWidth=q;this._drawHeight=t}_CalculateDeviceTransformMatrices(w,q,t,p,r,x,y){p=q/2+p;r=t/2+r;w.CalculatePerspectiveMatrix(x,q/t);w=w.CalculateLookAtModelView2(p,r,w.GetDefaultCameraZ()*self.devicePixelRatio,p,r,0,t);b.copy(y,w)}_CalculateRectangles(w){this._layoutRect.copy(w.layoutRect);w.drawSurfaceRect?this._drawSurfaceRect.copy(w.drawSurfaceRect):this._drawSurfaceRect.set(0,
0,this._drawWidth,this._drawHeight);this._rcTexOriginal.copy(this._drawSurfaceRect);this._rcTexOriginal.divide(this._drawWidth,this._drawHeight);w=w.layerScale*w.devicePixelRatio;this._drawSurfaceRect.inflate(this._boxExtendHorizontal*w,this._boxExtendVertical*w);this._rcTexDest.copy(this._drawSurfaceRect);this._rcTexDest.divide(this._drawWidth,this._drawHeight);this._drawSurfaceRect.clamp(0,0,this._drawWidth,this._drawHeight);this._rcTexBounce.copy(this._drawSurfaceRect);this._rcTexBounce.divide(this._drawWidth,
this._drawHeight)}_OnBeforeStartEffectChain(w){this._depthEnabledAtStart=w.IsDepthEnabled();this._useFullSurface&&(w.SetDepthEnabled(!1),this._isAnyShaderDepthSampling&&w.SetDepthSamplingEnabled(!0));w.IsWebGPU()&&!this._useFullSurface&&(a.copy(this._drawSurfaceRect),a.roundOuter(),w.SetScissorRect(a.getLeft(),a.getTop(),a.width(),a.height()))}_OnAfterEffectChainDrawContent(w){w.ResetColor();this._useFullSurface||(w.SetDepthEnabled(!1),this._isAnyShaderDepthSampling&&w.SetDepthSamplingEnabled(!0));
w.IsWebGPU()&&w.SetNormalizedCoordsProgramVariant(!0)}_OnAfterEndEffectChain(w){w.SetDepthSamplingEnabled(!1);w.SetDepthEnabled(this._depthEnabledAtStart);w.IsWebGPU()&&!this._useFullSurface&&w.RemoveScissorRect();w.IsWebGPU()&&w.SetNormalizedCoordsProgramVariant(!1);this._didChangeTransform=w.DidChangeTransform()}_ClampRcTexDest(){this._rcTexDest.clamp(0,0,1,1)}_GetRenderTargetForId(w){return 0>w?null:this._renderTargets[w]}_GetRenderTarget(){return this._manager.GetRenderTarget(this)}_GetDestRenderTarget(){return this._destRenderTarget}_ReleaseRenderTarget(w){this._manager.ReleaseRenderTarget(w,
this)}_GetShaderProgramAt(w){return this._shaderProgramList[w]}_DrawContent(w){this._cbDrawContentHook?this._cbDrawContentHook(this,w,()=>this._cbDrawContent(w,this)):this._cbDrawContent(w,this);this._canUseFastPath||this._OnAfterEffectChainDrawContent(w)}_IsRenderTargetSameSizeAndOffset(w){if(this._useFullSurface)return!0;if(0!==this._compositOffX||0!==this._compositOffY)return!1;const [q,t]=w.GetRenderTargetSize(w.GetRenderTarget());return q!==this._drawWidth||t!==this._drawHeight?!1:!0}_SetDeviceTransform(w,
q){let t=this._projectionMatrix,p=this._modelViewMatrix;if(q&&!this._IsRenderTargetSameSizeAndOffset(w)){t=h;p=g;const [r,x]=w.GetRenderTargetSize(w.GetRenderTarget());this._CalculateDeviceTransformMatrices(w,r,x,this._compositOffX,this._compositOffY,t,p);w.IsWebGPU()&&!this._useFullSurface&&w.RemoveScissorRect()}w.SetProjectionMatrix(t);w.SetModelViewMatrix(p)}_Redraw(){this._manager.Redraw(this)}_GetShaderParameters(w){return this._cbGetShaderParameters(this._shaderProgramIndices[w])}_SetProgramParameters(w,
q){let t=this._rcTexDest,p=this._rcTexBounce,r=this._rcTexOriginal;w.IsWebGL()&&(c.copy(t),c.flipAround(1),t=c,d.copy(p),d.flipAround(1),p=d,e.copy(r),e.flipAround(1),r=e);this._DoSetProgramParameters(w,q,p,r,t,1/this._drawWidth,1/this._drawHeight)}_SetFirstBounceProgramParameters(w,q){let t=this._rcTexBounce,p=this._rcTexOriginal,r=1/this._drawWidth,x=1/this._drawHeight;if(this._cbGetSourceTextureInfo){let {srcTexRect:E,srcWidth:H,srcHeight:A}=this._cbGetSourceTextureInfo(this._contentObject);E||
(a.set(0,0,0,0),E=a);H||(H=this._drawWidth);A||(A=this._drawHeight);p=t=E;r=1/H;x=1/A}else w.IsWebGL()&&(d.copy(t),d.flipAround(1),t=d,e.copy(p),e.flipAround(1),p=e);let y=this._rcTexDest;w.IsWebGL()&&(y=c,y.copy(this._rcTexDest),y.flipAround(1));this._DoSetProgramParameters(w,q,t,p,y,r,x);w.IsWebGPU()&&this._shaderProgramList[0].BlendsBackground()&&w.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated)}_DoSetProgramParameters(w,q,t,p,r,x,y){q=this._GetShaderParameters(q);w.SetProgramParameters(this._destRenderTarget,
r,t,p,this._layoutRect,x,y,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time,q)}_Render_FastPath(w,q){var t=this._shaderProgramList[0];const p=w.IsDepthEnabled(),r=t.UsesDepth();r&&(w.SetDepthEnabled(!1),w.SetDepthSamplingEnabled(!0),this._rcTexDest.set(0,0,1,1),this._rcTexOriginal.set(0,0,1,1));w.SetProgram(t);w.SetBlendMode(this._blendMode);w.SetRenderTarget(this._destRenderTarget);let x;this._rcTexOriginal.set(0,0,1,1);if(t.UsesAnySrcRectOrPixelSize()&&this._cbGetSourceTextureInfo){const {srcTexRect:y,
srcWidth:E,srcHeight:H}=this._cbGetSourceTextureInfo(this._contentObject);y&&this._rcTexOriginal.copy(y);t=Number.isFinite(E)?1/E:0;x=Number.isFinite(H)?1/H:0}else{const [y,E]=this._manager.GetDrawSize(w);t=1/y;x=1/E}q.layoutRect?this._layoutRect.copy(q.layoutRect):this._layoutRect.set(0,0,0,0);q=this._GetShaderParameters(0);w.SetProgramParameters(null,this._rcTexDest,this._rcTexOriginal,this._rcTexOriginal,this._layoutRect,t,x,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time,q);
w.SetBaseZ(0);this._DrawContent(w);r&&(w.SetDepthSamplingEnabled(!1),w.SetDepthEnabled(p))}IsFastPath(){return this._canUseFastPath}UseFullSurface(){return this._useFullSurface}GetContentObject(){return this._contentObject}GetContextObject(){return this._contextObject}_GetBlendMode(){return this._blendMode}_UpdateOwnProjection(){return this._updateOwnProjection}DidChangeTransform(){return this._didChangeTransform}_GetDrawSurfaceRect(){return this._drawSurfaceRect}_GetRcTexBounce(){return this._rcTexBounce}_ShouldInvalidateRenderTargets(){return this._invalidateRenderTargets}async DebugLogRenderTargetContents(w,
q,t){}}}"use strict";self.C3.Gfx.EffectChain.Step=class{constructor(f,b,a,c=-1){this._effectChain=f;this._srcTargetId=b;this._destTargetId=a;this._index=c}GetEffectChain(){return this._effectChain}GetSrcTargetId(){return this._srcTargetId}GetDestTargetId(){return this._destTargetId}GetIndex(){return this._index}GetShaderProgram(){return this.GetEffectChain()._GetShaderProgramAt(this.GetIndex())}Run_WebGL(f,b,a){}Run_WebGPU(f,b,a){}};
{"use strict";const f=self.C3;f.Gfx.EffectChain.Step.PreDraw=class extends f.Gfx.EffectChain.Step{constructor(b,a,c,d){super(b,a,c,d)}Run_WebGL(b,a,c){a=this.GetEffectChain();b.SetAlphaBlend();b.SetTextureFillMode();b.SetRenderTarget(c,a._UpdateOwnProjection());b.ClearRgba(0,0,0,0);a._DrawContent(b);a._ClampRcTexDest()}Run_WebGPU(b,a,c){a=this.GetEffectChain();b.SetAlphaBlend();b.SetTextureFillMode();b.SetRenderTarget(c,!1);b.ClearRgba(0,0,0,0);a._DrawContent(b);a._ClampRcTexDest()}}}
{"use strict";const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad);f.Gfx.EffectChain.Step.PostDraw=class extends f.Gfx.EffectChain.Step{constructor(c,d,e,h){super(c,d,e,h)}Run_WebGL(c,d,e){const h=this.GetEffectChain();c.SetTextureFillMode();c.SetRenderTarget(e);h._SetDeviceTransform(c,!0);c.SetBlendMode(h._GetBlendMode());c.SetTexture(d.GetTexture());a.setFromRect(h._GetDrawSurfaceRect());b.copy(h._GetRcTexBounce());b.flipAround(1);c.Quad3(a,b);h._ShouldInvalidateRenderTargets()&&c.InvalidateRenderTarget(d)}Run_WebGPU(c,
d,e){const h=this.GetEffectChain();c.SetTextureFillMode();c.SetRenderTarget(e,!1);h._IsRenderTargetSameSizeAndOffset(c)?a.setFromRect(h._GetRcTexBounce()):(c.SetNormalizedCoordsProgramVariant(!1),h._SetDeviceTransform(c,!0),a.setFromRect(h._GetDrawSurfaceRect()));c.SetBackTexture(null);c.SetBlendMode(h._GetBlendMode());c.SetTexture(d.GetTexture());h.UseFullSurface()?c.FullscreenQuad():c.Quad3(a,h._GetRcTexBounce())}}}
{"use strict";const f=self.C3;f.Gfx.EffectChain.Step.FirstBounce=class extends f.Gfx.EffectChain.Step{constructor(b,a,c,d){super(b,a,c,d)}Run_WebGL(b,a,c){a=this.GetEffectChain();b.SetRenderTarget(c,a._UpdateOwnProjection());b.ClearRgba(0,0,0,0);b.SetCopyBlend();b.SetProgram(this.GetShaderProgram());a._SetFirstBounceProgramParameters(b,this.GetIndex());a._DrawContent(b);a._ClampRcTexDest()}Run_WebGPU(b,a,c){a=this.GetEffectChain();b.SetRenderTarget(c,!1);b.ClearRgba(0,0,0,0);b.SetCopyBlend();b.SetProgram(this.GetShaderProgram());
a._SetFirstBounceProgramParameters(b,this.GetIndex());a._DrawContent(b);a._ClampRcTexDest()}}}
{"use strict";const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad);f.Gfx.EffectChain.Step.Bounce=class extends f.Gfx.EffectChain.Step{constructor(c,d,e,h){super(c,d,e,h)}Run_WebGL(c,d,e){const h=this.GetEffectChain();c.SetRenderTarget(e);(e=0===this.GetDestTargetId())?c.SetBlendMode(h._GetBlendMode()):(c.ClearRgba(0,0,0,0),c.SetCopyBlend());c.SetProgram(this.GetShaderProgram());h._SetProgramParameters(c,this.GetIndex());c.SetTexture(d.GetTexture());h._SetDeviceTransform(c,e);a.setFromRect(h._GetDrawSurfaceRect());
b.copy(h._GetRcTexBounce());b.flipAround(1);c.Quad3(a,b);h._ShouldInvalidateRenderTargets()&&c.InvalidateRenderTarget(d)}Run_WebGPU(c,d,e){const h=this.GetEffectChain();c.SetRenderTarget(e,!1);0===this.GetDestTargetId()?(c.SetBlendMode(h._GetBlendMode()),c.SetBackTexture(null),h._IsRenderTargetSameSizeAndOffset(c)?a.setFromRect(h._GetRcTexBounce()):(c.SetNormalizedCoordsProgramVariant(!1),h._SetDeviceTransform(c,!0),a.setFromRect(h._GetDrawSurfaceRect()))):(c.ClearRgba(0,0,0,0),c.SetCopyBlend(),a.setFromRect(h._GetRcTexBounce()));
c.SetProgram(this.GetShaderProgram());h._SetProgramParameters(c,this.GetIndex());c.SetTexture(d.GetTexture());h.UseFullSurface()?c.FullscreenQuad():c.Quad3(a,h._GetRcTexBounce())}}}
{"use strict";const f=self.C3,b=self.C3X;let a=null;const c=new Set;function d(l,m){const u=l[0]-m[0];return 0!==u?u:l[1]-m[1]}const e=[],h=[];let g=!1;self.IRuntime=class{constructor(l,m){a=l;Object.defineProperties(this,{assets:{value:a.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:m,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:a.GetProjectName(),writable:!1},projectVersion:{value:a.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(a),writable:!1},
isInWorker:{value:a.IsInWorker(),writable:!1}});a.UserScriptDispatcher().addEventListener("keydown",u=>{c.has(u.key)?u.stopPropagation():c.add(u.key)});a.UserScriptDispatcher().addEventListener("keyup",u=>c.delete(u.key));a.Dispatcher().addEventListener("window-blur",()=>c.clear());a.IsInWorker()&&(self.alert=u=>{g||(g=!0,console.warn("[Construct 3] alert() was called from a Web Worker, because the project 'Use worker' setting is enabled. This method is not normally available in a Web Worker. Construct has implemented the alert for you, but note that other features may be missing in worker mode. You may wish to disable 'Use worker', or use a more convenient function like console.log(). For more information please refer to the scripting section of the manual."));
return this.alert(u)})}_InitGlobalVars(l){Object.defineProperties(this.globalVars,l)}addEventListener(l,m){a.UserScriptDispatcher().addEventListener(l,m)}removeEventListener(l,m){a.UserScriptDispatcher().removeEventListener(l,m)}callFunction(l,...m){b.RequireString(l);const u=a.GetEventSheetManager(),w=u.GetFunctionBlockByName(l);if(!w)throw Error(`cannot find function name '${l}'`);if(!w.IsEnabled())return w.GetDefaultReturnValue();if(m.length<w.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${l}' (${m.length} passed, ${w.GetFunctionParameterCount()} expected)`);
const q=w.GetEventBlock();l=null;var t=u.GetCurrentEvent();t&&(t=t.GetSolModifiersIncludingParents(),0<t.length&&(l=t,u.PushCleanSol(t)));m=q.RunAsExpressionFunctionCall(q.GetSolModifiersIncludingParents(),w.GetReturnType(),w.GetDefaultReturnValue(),...m);l&&u.PopSol(l);return m}setReturnValue(l){const m=a.GetEventStack().GetCurrentExpFuncStackFrame();if(!m)throw Error("not in a function which returns a value");switch(m.GetFunctionReturnType()){case 1:"number"===typeof l&&m.SetFunctionReturnValue(l);
break;case 2:"string"===typeof l&&m.SetFunctionReturnValue(l);break;case 3:"number"!==typeof l&&"string"!==typeof l||m.SetFunctionReturnValue(l)}}get dt(){return a.GetDt()}get gameTime(){return a.GetGameTime()}get wallTime(){return a.GetWallTime()}random(){return a.Random()}get layout(){return a.GetMainRunningLayout().GetILayout()}getLayout(l){const m=a.GetLayoutManager();if("number"===typeof l||"string"===typeof l)l=m.GetLayout(l);else throw new TypeError("expected string or number");if(!l)throw Error("invalid layout");
return l.GetILayout()}getAllLayouts(){return a.GetLayoutManager().GetAllLayouts().map(l=>l.GetILayout())}goToLayout(l){const m=a.GetLayoutManager();if("number"===typeof l||"string"===typeof l)l=m.GetLayout(l);else throw new TypeError("expected string or number");if(!l)throw Error("invalid layout");m.IsPendingChangeMainLayout()||m.ChangeMainLayout(l)}get keyboard(){const l=a._GetCommonScriptInterfaces().keyboard;if(!l)throw Error("runtime.keyboard used but Keyboard object missing - add it to your project first");
return l}get mouse(){const l=a._GetCommonScriptInterfaces().mouse;if(!l)throw Error("runtime.mouse used but Mouse object missing - add it to your project first");return l}get touch(){const l=a._GetCommonScriptInterfaces().touch;if(!l)throw Error("runtime.touch used but Touch object missing - add it to your project first");return l}invokeDownload(l,m){b.RequireString(l);b.RequireString(m);a.InvokeDownload(l,m)}getInstanceByUid(l){b.RequireFiniteNumber(l);return(l=a.GetInstanceByUID(l))?l.GetInterfaceClass():
null}sortZOrder(l,m){b.RequireFunction(m);const u=a.GetCurrentLayout();for(var w of l){l=a._UnwrapIWorldInstance(w);var q=l.GetWorldInfo();e.push([q.GetLayer().GetIndex(),q.GetZIndex()]);h.push(l)}if(0!==e.length){e.sort(d);h.sort((t,p)=>m(t.GetInterfaceClass(),p.GetInterfaceClass()));w=!1;for(let t=0,p=e.length;t<p;++t){l=h[t];q=u.GetLayerByIndex(e[t][0]);const r=e[t][1],x=q._GetInstances();x[r]!==l&&(x[r]=l,l.GetWorldInfo()._SetLayer(q),q.SetZIndicesChanged(),w=!0)}w&&a.UpdateRender();f.clearArray(e);
f.clearArray(h)}}alert(l){return a.PostComponentMessageToDOMAsync("runtime","alert",{message:l+(a.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,
c){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");c=await b.GetRuntime()._WasmDecodeWebMOpus(c);c=new Float32Array(c);a=a.createBuffer(1,c.length,48E3);a.getChannelData(0).set(c);return a}loadScripts(...a){return b.LoadScripts(...a)}compileWebAssembly(a){return b.CompileWebAssembly(a)}loadStyleSheet(a){return b.LoadStyleSheet(a)}}}
{"use strict";const f=self.C3X;self.IStorage=class{constructor(b){this._storage=b._GetProjectStorage()}getItem(b){f.RequireString(b);return this._storage.getItem(b)}setItem(b,a){f.RequireString(b);return this._storage.setItem(b,a)}removeItem(b){f.RequireString(b);return this._storage.removeItem(b)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}}}
{"use strict";const f=self.C3X,b=new WeakMap;self.IObjectClass=class{constructor(a){b.set(this,a);Object.defineProperties(this,{name:{value:a.GetName(),writable:!1}});a.GetRuntime()._MapScriptInterface(this,a)}addEventListener(a,c){f.RequireString(a);f.RequireFunction(c);b.get(this).UserScriptDispatcher().addEventListener(a,c)}removeEventListener(a,c){f.RequireString(a);f.RequireFunction(c);b.get(this).UserScriptDispatcher().removeEventListener(a,c)}getAllInstances(){return b.get(this).GetInstances().map(a=>
a.GetInterfaceClass())}getFirstInstance(){const a=b.get(this).GetInstances();return 0<a.length?a[0].GetInterfaceClass():null}getPickedInstances(){return b.get(this).GetCurrentSol().GetInstances().map(a=>a.GetInterfaceClass())}getFirstPickedInstance(){const a=b.get(this).GetCurrentSol().GetInstances();return 0<a.length?a[0].GetInterfaceClass():null}*instances(){for(const a of b.get(this).GetInstances())yield a.GetInterfaceClass()}*pickedInstances(){for(const a of b.get(this).GetCurrentSol().GetInstances())yield a.GetInterfaceClass()}setInstanceClass(a){f.RequireFunction(a);
if(0<b.get(this).GetInstanceCount())throw Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");b.get(this)._SetUserScriptInstanceClass(a)}createInstance(a,c,d,e){f.RequireNumber(c);f.RequireNumber(d);if("number"!==typeof a&&"string"!==typeof a)throw new TypeError("invalid layer parameter");const h=b.get(this),g=h.GetRuntime();a=g.GetMainRunningLayout().GetLayer(a);if(!a)throw Error("invalid layer");c=g.CreateInstance(h,a,c,d,e);e&&a.SortAndAddInstancesByZIndex(c);
e=g.GetEventSheetManager();e.BlockFlushingInstances(!0);c._TriggerOnCreatedOnSelfAndRelated();e.BlockFlushingInstances(!1);return c.GetInterfaceClass()}}}
{"use strict";const f=self.C3X,b=new WeakMap;self.ILayout=class{constructor(a){b.set(this,a);const c=[],d=a.GetEffectList(),e=d.GetAllEffectTypes().length;for(let h=0;h<e;++h)c.push(new self.IEffectInstance(d,h));Object.defineProperties(this,{name:{value:a.GetName(),writable:!1},index:{value:a.GetIndex(),writable:!1},effects:{value:c,writable:!1}})}addEventListener(a,c){f.RequireString(a);f.RequireFunction(c);b.get(this).UserScriptDispatcher().addEventListener(a,c)}removeEventListener(a,c){f.RequireString(a);
f.RequireFunction(c);b.get(this).UserScriptDispatcher().removeEventListener(a,c)}get width(){return b.get(this).GetWidth()}set width(a){b.get(this).SetWidth(a)}get height(){return b.get(this).GetHeight()}set height(a){b.get(this).SetHeight(a)}set scale(a){f.RequireFiniteNumber(a);b.get(this).SetScale(a)}get scale(){return b.get(this).GetScale()}set angle(a){f.RequireFiniteNumber(a);b.get(this).SetAngle(a)}get angle(){return b.get(this).GetAngle()}set scrollX(a){f.RequireNumber(a);b.get(this).SetScrollX(a)}get scrollX(){return b.get(this).GetScrollX()}set scrollY(a){f.RequireNumber(a);
b.get(this).SetScrollY(a)}get scrollY(){return b.get(this).GetScrollY()}scrollTo(a,c){f.RequireNumber(a);f.RequireNumber(c);const d=b.get(this);d.SetScrollX(a);d.SetScrollY(c)}getLayer(a){const c=b.get(this);if("number"===typeof a||"string"===typeof a)a=c.GetLayer(a);else throw new TypeError("expected string or number");return a?a.GetILayer():null}getAllLayers(){return b.get(this).GetLayers().map(a=>a.GetILayer())}setVanishingPoint(a,c){f.RequireFiniteNumber(a);f.RequireFiniteNumber(c);b.get(this).SetVanishingPointXY(a,
c)}getVanishingPoint(){return b.get(this)._GetVanishingPoint()}set projection(a){f.RequireString(a);const c=b.get(this);if("perspective"===a)c.SetPerspectiveProjection();else if("orthographic"===a)c.SetOrthographicProjection();else throw Error("invalid projection");}get projection(){return b.get(this).IsOrthographicProjection()?"orthographic":"perspective"}}}
{"use strict";const f=self.C3,b=self.C3X,a=new WeakMap,c=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]),d=new Map([...c.entries()].map(h=>[h[1],h[0]])),e=f.New(f.Color);self.ILayer=class{constructor(h){a.set(this,h);const g=[],l=h.GetEffectList(),m=l.GetAllEffectTypes().length;for(let u=0;u<m;++u)g.push(new self.IEffectInstance(l,u));Object.defineProperties(this,
{name:{value:h.GetName(),writable:!1},index:{value:h.GetIndex(),writable:!1},layout:{value:h.GetLayout().GetILayout(),writable:!1},effects:{value:g,writable:!1}})}static _Unwrap(h){return a.get(h)}get isVisible(){return a.get(this).IsVisible()}set isVisible(h){a.get(this).SetVisible(h)}get opacity(){return a.get(this).GetOpacity()}set opacity(h){h=f.clamp(+h,0,1);isNaN(h)||a.get(this).SetOpacity(h)}set scale(h){b.RequireFiniteNumber(h);a.get(this).SetOwnScale(h)}get scale(){return a.get(this).GetOwnScale()}set scaleRate(h){b.RequireFiniteNumber(h);
a.get(this).SetScaleRate(h)}get scaleRate(){return a.get(this).GetScaleRate()}set angle(h){b.RequireFiniteNumber(h);a.get(this).SetAngle(h)}get angle(){return a.get(this).GetOwnAngle()}set parallaxX(h){b.RequireFiniteNumber(h);a.get(this).SetParallaxX(h)}get parallaxX(){return a.get(this).GetParallaxX()}set parallaxY(h){b.RequireFiniteNumber(h);a.get(this).SetParallaxY(h)}get parallaxY(){return a.get(this).GetParallaxY()}set zElevation(h){b.RequireFiniteNumber(h);a.get(this).SetZElevation(h)}get zElevation(){return a.get(this).GetZElevation()}set isTransparent(h){a.get(this).SetTransparent(h)}get isTransparent(){return a.get(this).IsTransparent()}set isForceOwnTexture(h){a.get(this).SetForceOwnTexture(h)}get isForceOwnTexture(){return a.get(this).IsForceOwnTexture()}set blendMode(h){b.RequireString(h);
h=c.get(h);if("number"!==typeof h)throw Error("invalid blend mode");a.get(this).SetBlendMode(h)}get blendMode(){return d.get(a.get(this).GetBlendMode())}set backgroundColor(h){b.RequireArray(h);if(3>h.length)throw Error("expected 3 elements");e.setRgb(h[0],h[1],h[2]);h=a.get(this);const g=h.GetBackgroundColor();g.equalsIgnoringAlpha(e)||(g.copyRgb(e),h.GetRuntime().UpdateRender())}get backgroundColor(){const h=a.get(this).GetBackgroundColor();return[h.getR(),h.getG(),h.getB()]}set scrollX(h){b.RequireNumber(h);
const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollX(h)}get scrollX(){return a.get(this).GetScrollX()}set scrollY(h){b.RequireNumber(h);const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollY(h)}get scrollY(){return a.get(this).GetScrollY()}scrollTo(h,g){b.RequireNumber(h);b.RequireNumber(g);const l=a.get(this);l.SetOwnScrollPositionEnabled(!0);l.SetScrollX(h);l.SetScrollY(g)}restoreScrollPosition(){a.get(this).SetOwnScrollPositionEnabled(!1)}getViewport(){return a.get(this).GetViewport().toDOMRect()}cssPxToLayer(h,
g,l=0){b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);const m=a.get(this),u=m.GetRuntime();return m.CanvasCssToLayer(h-u.GetCanvasClientX(),g-u.GetCanvasClientY(),l)}layerToCssPx(h,g,l=0){b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);const m=a.get(this),u=m.GetRuntime(),[w,q]=m.LayerToCanvasCss(h,g,l);return[w+u.GetCanvasClientX(),q+u.GetCanvasClientY()]}}}
{"use strict";const f=self.C3,b=self.C3X,a=new WeakMap,c=new WeakMap;function d(h){let g=c.get(h);if(g)return g;g=f.New(f.Event.Dispatcher);c.set(h,g);return g}let e=null;self.IInstance=class{constructor(){a.set(this,e);const h={runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:e.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:e.GetUID(),writable:!1}};e._GetInstVarsScriptDescriptor(h);e._GetBehaviorsScriptDescriptor(h);Object.defineProperties(this,h);e.GetRuntime()._MapScriptInterface(this,
e)}static _Init(h){e=h}static _GetInitInst(){return e}_Release(){const h=c.get(this);h&&(h.Release(),c.delete(this));a.delete(this)}addEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).addEventListener(h,g,l)}removeEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).removeEventListener(h,g,l)}dispatchEvent(h){d(this).dispatchEvent(h)}destroy(){const h=a.get(this);h.GetRuntime().DestroyInstance(h)}}}
{"use strict";const f=self.C3,b=self.C3X,a=self.IInstance,c=self.ILayer,d=new WeakMap,e=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]),h=new Map([...e.entries()].map(l=>[l[1],l[0]])),g=f.New(f.Color);self.IWorldInstance=class l extends a{constructor(){super();var m=a._GetInitInst();d.set(this,m);const u=[];var w=m.GetWorldInfo();if(m=w.GetInstanceEffectList()){w=
w.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let q=0;q<w;++q)u.push(new self.IEffectInstance(m,q))}Object.defineProperties(this,{effects:{value:u,writable:!1}})}get layout(){return d.get(this).GetWorldInfo().GetLayout().GetILayout()}get layer(){return d.get(this).GetWorldInfo().GetLayer().GetILayer()}get x(){return d.get(this).GetWorldInfo().GetX()}set x(m){m=+m;const u=d.get(this).GetWorldInfo();isNaN(m)||u.GetX()===m||(u.SetX(m),u.SetBboxChanged())}get y(){return d.get(this).GetWorldInfo().GetY()}set y(m){m=
+m;const u=d.get(this).GetWorldInfo();isNaN(m)||u.GetY()===m||(u.SetY(m),u.SetBboxChanged())}get zElevation(){return d.get(this).GetWorldInfo().GetZElevation()}set zElevation(m){m=+m;const u=d.get(this),w=u.GetWorldInfo();isNaN(m)||w.GetZElevation()===m||(w.SetZElevation(m),u.GetRuntime().UpdateRender())}get totalZElevation(){return d.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return d.get(this).GetWorldInfo().GetWidth()}set width(m){m=+m;const u=d.get(this).GetWorldInfo();isNaN(m)||
u.GetWidth()===m||(u.SetWidth(m),u.SetBboxChanged())}get height(){return d.get(this).GetWorldInfo().GetHeight()}set height(m){m=+m;const u=d.get(this).GetWorldInfo();isNaN(m)||u.GetHeight()===m||(u.SetHeight(m),u.SetBboxChanged())}get angle(){return d.get(this).GetWorldInfo().GetAngle()}set angle(m){m=f.clampAngle(+m);const u=d.get(this).GetWorldInfo();isNaN(m)||u.GetAngle()===m||(u.SetAngle(m),u.SetBboxChanged())}get angleDegrees(){return f.toDegrees(this.angle)}set angleDegrees(m){this.angle=f.toRadians(m)}getBoundingBox(){return d.get(this).GetWorldInfo().GetBoundingBox().toDOMRect()}getBoundingQuad(){return d.get(this).GetWorldInfo().GetBoundingQuad().toDOMQuad()}get isVisible(){return d.get(this).GetWorldInfo().IsVisible()}set isVisible(m){m=
!!m;const u=d.get(this),w=u.GetWorldInfo();w.IsVisible()!==m&&(w.SetVisible(m),u.GetRuntime().UpdateRender())}get opacity(){return d.get(this).GetWorldInfo().GetOpacity()}set opacity(m){m=f.clamp(+m,0,1);const u=d.get(this),w=u.GetWorldInfo();isNaN(m)||w.GetOpacity()===m||(w.SetOpacity(m),u.GetRuntime().UpdateRender())}set colorRgb(m){b.RequireArray(m);if(3>m.length)throw Error("expected 3 elements");g.setRgb(m[0],m[1],m[2]);m=d.get(this);const u=m.GetWorldInfo();u.GetUnpremultipliedColor().equalsIgnoringAlpha(g)||
(u.SetUnpremultipliedColor(g),m.GetRuntime().UpdateRender())}get colorRgb(){const m=d.get(this).GetWorldInfo().GetUnpremultipliedColor();return[m.getR(),m.getG(),m.getB()]}set blendMode(m){b.RequireString(m);m=e.get(m);if("number"!==typeof m)throw Error("invalid blend mode");const u=d.get(this);u.GetWorldInfo().SetBlendMode(m);u.GetRuntime().UpdateRender()}get blendMode(){return h.get(d.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){d.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){d.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(m){b.RequireInstanceOf(m,
c);m=c._Unwrap(m);if(!m)throw Error("invalid layer");d.get(this).GetWorldInfo().ZOrderMoveToLayer(m)}moveAdjacentToInstance(m,u){b.RequireInstanceOf(m,l);d.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(d.get(m),u)}get zIndex(){return d.get(this).GetWorldInfo().GetZIndex()}containsPoint(m,u){b.RequireNumber(m);b.RequireNumber(u);return d.get(this).GetWorldInfo().ContainsPoint(+m,+u)}testOverlap(m){b.RequireInstanceOf(m,l);const u=d.get(this);m=d.get(m);return u.GetRuntime().GetCollisionEngine().TestOverlap(u,
m)}testOverlapSolid(){var m=d.get(this);return(m=m.GetRuntime().GetCollisionEngine().TestOverlapSolid(m))?m.GetInterfaceClass():null}getParent(){const m=d.get(this).GetParent();return m?m.GetInterfaceClass():null}getTopParent(){const m=d.get(this).GetTopParent();return m?m.GetInterfaceClass():null}*parents(){for(const m of d.get(this).parents())yield m.GetInterfaceClass()}getChildCount(){return d.get(this).GetChildCount()}getChildAt(m){return(m=d.get(this).GetChildAt(m))?m.GetInterfaceClass():null}*children(){for(const m of d.get(this).children())yield m.GetInterfaceClass()}*allChildren(){for(const m of d.get(this).allChildren())yield m.GetInterfaceClass()}addChild(m,
u){b.RequireInstanceOf(m,l);b.RequireOptionalObject(u);u||(u={});const w=d.get(this);m=d.get(m);w.AddChild(m,u)}removeChild(m){b.RequireInstanceOf(m,l);const u=d.get(this);m=d.get(m);u.RemoveChild(m)}removeFromParent(){const m=d.get(this);m.HasParent()&&m.GetParent().RemoveChild(m)}createMesh(m,u){b.RequireFiniteNumber(m);b.RequireFiniteNumber(u);d.get(this).GetWorldInfo().CreateMesh(m,u)}releaseMesh(){const m=d.get(this).GetWorldInfo();m.ReleaseMesh();m.SetBboxChanged()}setMeshPoint(m,u,w){b.RequireFiniteNumber(m);
b.RequireFiniteNumber(u);b.RequireObject(w);const q=d.get(this).GetWorldInfo();q.SetMeshPoint(m,u,w)&&q.SetBboxChanged()}getMeshSize(){var m=d.get(this).GetWorldInfo();if(!m.HasMesh())return[0,0];m=m.GetSourceMesh();return[m.GetHSize(),m.GetVSize()]}}}
{"use strict";const f=self.C3X,b=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();b.set(this,self.IInstance._GetInitInst())}getElement(){return b.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){b.get(this).GetSdkInstance().FocusElement()}blur(){b.get(this).GetSdkInstance().BlurElement()}setCssStyle(a,c){f.RequireString(a);b.get(this).GetSdkInstance().SetElementCSSStyle(a,c)}}}
{"use strict";const f=self.C3,b=self.C3X,a=new WeakMap,c=new WeakMap;function d(h){let g=c.get(h);if(g)return g;g=f.New(f.Event.Dispatcher);c.set(h,g);return g}let e=null;self.IBehaviorInstance=class{constructor(){a.set(this,e);const h={runtime:{value:e.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:e.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,h)}static _Init(h){e=h}static _GetInitInst(){return e}get instance(){return a.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const h=
c.get(this);h&&(h.Release(),c.delete(this));a.delete(this)}addEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).addEventListener(h,g,l)}removeEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);d(this).removeEventListener(h,g,l)}dispatchEvent(h){d(this).dispatchEvent(h)}}}
{"use strict";const 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=self.C3X,a=new WeakMap;self.IEffectInstance=class{constructor(c,d){a.set(this,c);Object.defineProperties(this,{index:{value:d,writable:!1}})}get name(){return a.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return a.get(this).IsEffectIndexActive(this.index)}set isActive(c){c=!!c;const d=a.get(this);d.IsEffectIndexActive(this.index)!==c&&(d.SetEffectIndexActive(this.index,c),d.UpdateActiveEffects(),d.GetRuntime().UpdateRender())}setParameter(c,d){b.RequireFiniteNumber(c);
c=Math.floor(+c);const e=a.get(this);var h=e.GetEffectParametersForIndex(this.index);if(0>c||c>=h.length)throw new RangeError("invalid effect parameter index");const g=h[c];if(g instanceof f.Color){if(!Array.isArray(d)||3>d.length)throw new TypeError("expected array with 3 elements");c=d[0];h=d[1];d=d[2];if(g.equalsRgb(c,h,d))return;g.setRgb(c,h,d)}else{if("number"!==typeof d)throw new TypeError("expected number");if(g===d)return;h[c]=d}e.IsEffectIndexActive(this.index)&&e.GetRuntime().UpdateRender()}getParameter(c){b.RequireFiniteNumber(c);
c=Math.floor(+c);const d=a.get(this).GetEffectParametersForIndex(this.index);if(0>c||c>=d.length)throw new RangeError("invalid effect parameter index");c=d[c];return c instanceof f.Color?[c.getR(),c.getG(),c.getB()]:c}}}
{"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 c(e){if(!e)return"";e=e.split(".");if(2>e.length)return"";e=e.at(-1).toLowerCase();return a.get(e)||""}function d(e){return new Promise((h,g)=>{const l=document.createElement("script");l.onload=h;l.onerror=g;l.async=!1;l.type="module";
l.src=e;document.head.appendChild(l)})}f.AssetManager=class extends f.DefendedBase{constructor(e,h){super();var g=h.exportType;this._runtime=e;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova="cordova"===g;this._isiOSCordova=!!h.isiOSCordova;this._isFileProtocol=!!h.isFileProtocol;this._swClientId=h.swClientId;this._supportedAudioFormats=h.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=this._fontsSubfolder=
this._mediaSubfolder="";this._defaultLoadPolicy="html5"===g||"scirra-arcade"===g||"instant-games"===g?"remote":"local";this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=!1;this._lastLoadProgress=this._assetSizeLoaded=this._totalAssetSizeToLoad=0;this._hasHadErrorLoading=!1;this._loadingRateLimiter=f.New(f.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new f.PromiseThrottle(Math.max(f.hardwareConcurrency,8));
if(e=h.previewImageBlobs){(g=h.previewProjectFileBlobs)&&Object.assign(e,g);(g=h.projectData)&&(e["data.json"]=g);for(const [l,m]of Object.entries(e))this._localUrlBlobs.set(l.toLowerCase(),m)}if(h=h.previewProjectFileSWUrls)for(const [l,m]of Object.entries(h))this._localBlobSWUrls.set(l,m);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const e of this._localBlobUrlCache.values())e.startsWith("blob:")&&URL.revokeObjectURL(e);this._localBlobUrlCache.clear();
for(const e of this._allAssets)e.Release();f.clearArray(this._allAssets);this._assetsByUrl.clear();f.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(e){this._mediaSubfolder=e}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(e){this._fontsSubfolder=e}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(e){this._iconsSubfolder=e}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(e){return this._localUrlBlobs.has(e.toLowerCase())}_GetLocalUrlBlob(e){return this._localUrlBlobs.get(e.toLowerCase())||
null}GetLocalUrlAsBlobUrl(e){if(!this._HasLocalUrlBlob(e))return e;e=e.toLowerCase();var h=this._localBlobUrlCache.get(e);h||(h=this._GetLocalUrlBlob(e),h=URL.createObjectURL(h),this._localBlobUrlCache.set(e,h));return h}FetchBlob(e,h){h=h||this._defaultLoadPolicy;const g=this._GetLocalUrlBlob(e);if(g)return Promise.resolve(g);if(f.IsRelativeURL(e)){const l=e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(l):"local"===h?this._promiseThrottle.Add(()=>f.FetchBlob(l)):
f.FetchBlob(l)}return f.FetchBlob(e)}FetchArrayBuffer(e){const h=this._GetLocalUrlBlob(e);if(h)return f.BlobToArrayBuffer(h);if(f.IsRelativeURL(e)){const g=e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>f.FetchArrayBuffer(g)):f.FetchArrayBuffer(g)}return f.FetchArrayBuffer(e)}FetchText(e){const h=this._GetLocalUrlBlob(e);if(h)return f.BlobToString(h);if(f.IsRelativeURL(e)){const g=
e.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>f.FetchText(g)):f.FetchText(g)}return f.FetchText(e)}async FetchJson(e){e=await this.FetchText(e);return JSON.parse(e)}_CordovaFetchLocalFileAs(e,h){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:e,as:h})}CordovaFetchLocalFileAsText(e){return this._CordovaFetchLocalFileAs(e,"text")}async CordovaFetchLocalFileAsBlob(e){const h=
await this._CordovaFetchLocalFileAs(e,"buffer");e=c(e);return new Blob([h],{type:e})}async CordovaFetchLocalFileAsBlobURL(e){e=e.toLowerCase();var h=this._localBlobUrlCache.get(e);if(h)return h;h=await this.CordovaFetchLocalFileAsBlob(e);h=URL.createObjectURL(h);this._localBlobUrlCache.set(e,h);return h}CordovaFetchLocalFileAsArrayBuffer(e){return this._CordovaFetchLocalFileAs(e,"buffer")}GetMediaFileUrl(e){return this._HasLocalUrlBlob(e)?this.GetLocalUrlAsBlobUrl(e):this._mediaSubfolder+e.toLowerCase()}GetProjectFileUrl(e,
h=""){if(f.IsAbsoluteURL(e)){if(h)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(e)}return this._HasLocalUrlBlob(e)?Promise.resolve(this.GetLocalUrlAsBlobUrl(e)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h+e):Promise.resolve(h+e.toLowerCase())}GetProjectFileIframeUrl(e){if(f.IsAbsoluteURL(e))return Promise.resolve(e);var h=e.indexOf("?"),g=-1===h?"":e.substr(h);h=-1===h?e:e.substr(0,h);return this._HasLocalUrlBlob(h)?(e=this._localBlobSWUrls.get(h)||
this.GetLocalUrlAsBlobUrl(h),!e.startsWith("blob:")&&this._swClientId&&(e=new URL(e),g=new URLSearchParams(g),g.set("__c3_client_id",this._swClientId),e.search=g.toString(),e=e.toString()),Promise.resolve(e)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h):Promise.resolve(e.toLowerCase())}LoadProjectFileUrl(e){return this.GetProjectFileUrl(e)}LoadImage(e){if(e.loadPolicy&&!b.has(e.loadPolicy))throw Error("invalid load policy");let h=this._assetsByUrl.get(e.url);if(h)return h;
h=f.New(f.ImageAsset,this,{url:e.url,size:e.size||0,loadPolicy:e.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(h);this._assetsByUrl.set(h.GetURL(),h);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=h.GetSize(),this._loadPromises.push(h.Load().then(()=>this._AddLoadedSize(h.GetSize()))));return h}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(e){console.error("Error loading: ",e),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=
!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(e){this._assetSizeLoaded+=e;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const e=f.New(f.Event,"loadingprogress");this._lastLoadProgress=f.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);e.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(e)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(e){f.shallowAssignArray(this._webFonts,e);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"===
typeof FontFace)return Promise.resolve();const e=[];for(const [h,g,l]of this._webFonts)this._totalAssetSizeToLoad+=l,e.push(this._LoadWebFont(h,g).then(()=>this._AddLoadedSize(l)));return Promise.all(e)}async _LoadWebFont(e,h){try{const g=await this.GetProjectFileUrl(h,this._fontsSubfolder),l=new FontFace(e,`url('${g}')`);this._runtime.IsInWorker()?self.fonts.add(l):document.fonts.add(l);await l.load()}catch(g){console.warn(`[C3 runtime] Failed to load web font '${e}': `,g)}}IsAudioFormatSupported(e){return!!this._supportedAudioFormats[e]}_SetAudioFiles(e,
h){this._preloadSounds=!!h;for(const [g,l,m]of e)this._audioFiles.set(g,{fileName:g,formats:l.map(u=>({type:u[0],fileExtension:u[1],fullName:g+u[1],fileSize:u[2]})),isMusic:m})}GetPreferredAudioFile(e){e=this._audioFiles.get(e.toLowerCase());if(!e)return null;let h=null;for(const g of e.formats)if(h||"audio/webm; codecs=opus"!==g.type||(h=g),this.IsAudioFormatSupported(g.type))return g;return h}GetProjectAudioFileUrl(e){return(e=this.GetPreferredAudioFile(e))?{url:this.GetMediaFileUrl(e.fullName),
type:e.type}:null}GetAudioToPreload(){if(this._preloadSounds){const e=[];for(const h of this._audioFiles.values()){if(h.isMusic)continue;const g=this.GetPreferredAudioFile(h.fileName);g&&e.push({originalUrl:h.fileName,url:this.GetMediaFileUrl(g.fullName),type:g.type,fileSize:g.fileSize})}return e}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...e){const h=await Promise.all(e.map(g=>this.GetProjectFileUrl(g)));this._runtime.IsInWorker()?1===e.length?(e=e[0],await self.c3_import((f.IsRelativeURL(e)?
"./":"")+e)):(e=e.map(g=>`import "${f.IsRelativeURL(g)?"./":""}${g}";`).join("\n"),e=URL.createObjectURL(new Blob([e],{type:"application/javascript"})),await self.c3_import(e)):await Promise.all(h.map(g=>d(g)))}async CompileWebAssembly(e){if(WebAssembly.compileStreaming)return e=await this.GetProjectFileUrl(e),await WebAssembly.compileStreaming(fetch(e));e=await f.FetchArrayBuffer(e);return await WebAssembly.compile(e)}async LoadStyleSheet(e){e=await this.GetProjectFileUrl(e);return await this._runtime.PostComponentMessageToDOMAsync("runtime",
"add-stylesheet",{url:e})}}}
{"use strict";const f=self.C3;f.Asset=class extends f.DefendedBase{constructor(b,a){super();this._assetManager=b;this._runtime=b.GetRuntime();this._url=a.url;this._size=a.size;this._loadPolicy=a.loadPolicy;this._blob=null;this._isLoaded=!1;this._loadPromise=null}Release(){this._blob=this._runtime=this._assetManager=this._loadPromise=null}GetURL(){return this._url}GetSize(){return this._size}Load(){return"local"===this._loadPolicy||this._blob?(this._isLoaded=!0,Promise.resolve()):this._loadPromise?
this._loadPromise:this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(b=>{this._isLoaded=!0;this._loadPromise=null;return this._blob=b}).catch(b=>console.error("Error loading resource: ",b))}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._loadPromise?this._loadPromise:this._assetManager.FetchBlob(this._url,this._loadPolicy)}}}
{"use strict";const f=self.C3,b=new f.PromiseThrottle,a=new Set;f.ImageAsset=class extends f.Asset{constructor(c,d){super(c,d);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;a.add(this)}Release(){this.ReleaseTexture();if(0!==this._refCount)throw Error("released image asset which still has texture references");this._texturePromise=null;a.delete(this);super.Release()}static OnWebGLContextLost(){for(const c of a)c._texturePromise=null,c._webglTexture=
null,c._refCount=0}LoadStaticTexture(c,d){d=d||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;d.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();return this._texturePromise=this.GetBlob().then(e=>b.Add(()=>c.CreateStaticTextureAsync(e,d).then(h=>{this._texturePromise=null;if(0===this._refCount)return c.DeleteTexture(h),null;this._webglTexture=h;this._imageWidth=h.GetWidth();this._imageHeight=
h.GetHeight();return this._webglTexture}))).catch(e=>{console.error("Failed to load texture: ",e);throw e;})}ReleaseTexture(){if(0>=this._refCount)throw Error("texture released too many times");this._refCount--;0===this._refCount&&this._webglTexture&&(this._webglTexture.GetRenderer().DeleteTexture(this._webglTexture),this._webglTexture=null)}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const c=await this.GetBlob();
return f.Supports.ImageBitmapOptions?await createImageBitmap(c,{premultiplyAlpha:"none"}):f.Supports.ImageBitmap?await createImageBitmap(c):await f.BlobToImage(c)}}}
{"use strict";const f=self.C3;function b(a,c){return a.GetWorldInfo()._GetLastCachedZIndex()-c.GetWorldInfo()._GetLastCachedZIndex()}f.RenderCell=class extends f.DefendedBase{constructor(a,c,d){super();this._grid=a;this._x=c;this._y=d;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){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,c){let d=this._cells.Get(b,a);return d?d:c?(d=f.New(f.RenderCell,this,b,a),this._cells.Set(b,a,d),d):null}XToCell(b){return Math.floor(b/this._cellWidth)}YToCell(b){return Math.floor(b/this._cellHeight)}Update(b,a,c){if(a)for(let d=a.getLeft(),e=a.getRight();d<=e;++d)for(let h=
a.getTop(),g=a.getBottom();h<=g;++h){if(c&&c.containsPoint(d,h))continue;const l=this.GetCell(d,h,!1);l&&(l.Remove(b),l.IsEmpty()&&this._cells.Delete(d,h))}if(c)for(let d=c.getLeft(),e=c.getRight();d<=e;++d)for(let h=c.getTop(),g=c.getBottom();h<=g;++h)a&&a.containsPoint(d,h)||this.GetCell(d,h,!0).Insert(b)}QueryRange(b,a){let c=this.XToCell(b.getLeft());const d=this.YToCell(b.getTop()),e=this.XToCell(b.getRight());for(b=this.YToCell(b.getBottom());c<=e;++c)for(let h=d;h<=b;++h){const g=this.GetCell(c,
h,!1);g&&g.Dump(a)}}MarkRangeChanged(b){let a=b.getLeft();const c=b.getTop(),d=b.getRight();for(b=b.getBottom();a<=d;++a)for(let e=c;e<=b;++e){const h=this.GetCell(a,e,!1);h&&h.SetChanged()}}}}
{"use strict";const f=self.C3,b=new f.Rect,a=new f.Quad,c=[];new f.Rect;new f.Rect;const d=self.glMatrix,e=d.vec3,h=d.vec4,g=d.mat4,l=g.create(),m=e.create(),u=h.create(),w=e.create(),q=e.create(),t=e.create(),p=f.New(f.Vector2);f.New(f.Rect);function r(A,F){return A.GetWorldInfo()._GetLastCachedZIndex()-F.GetWorldInfo()._GetLastCachedZIndex()}function x(A,F){return A.GetWorldInfo().GetZElevation()-F.GetWorldInfo().GetZElevation()}const y=[],E=[],H=[];f.Layer=class extends f.DefendedBase{constructor(A,
F,J){super();this._layout=A;this._runtime=A.GetRuntime();this._parentLayer=F;this._name=J[0];this._index=-1;this._sid=J[2];this._isVisible=!!J[3];this._backgroundColor=f.New(f.Color);this._backgroundColor.setFromJSON(J[4].map(I=>I/255));this._isTransparent=!!J[5];this._parallaxX=J[6];this._parallaxY=J[7];this._color=f.New(f.Color,1,1,1,J[8]);this._premultipliedColor=f.New(f.Color);this._isForceOwnTexture=J[9];this._renderAs3d=J[17];this._useCameraDistanceDrawOrder=J[18];this._useRenderCells=J[10];
this._scaleRate=J[11];this._blendMode=J[12];this._curRenderTarget=null;this._scale=1;this._zElevation=J[16];this._scrollY=this._scrollX=this._angle=0;this._hasOwnScrollPosition=!1;this._viewport=f.New(f.Rect);this._viewportZ0=f.New(f.Rect);this._viewport3D=f.New(f.Rect);this._projectionMatrix=g.create();this._isProjectionMatrixChanged=!0;this._modelViewMatrix=g.create();this._isMVMatrixChanged=!0;this._viewFrustum=f.New(f.Gfx.ViewFrustum);this._isViewFrustumChanged=!0;this._startupInitialInstances=
[];this._initialInstancesData=J[14];this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;const B=this._runtime.GetCanvasManager();this._effectList=f.New(f.EffectList,this,J[15]);this._effectChain=f.New(f.Gfx.EffectChain,B.GetEffectChainManager(),{drawContent:(I,L)=>{L=L.GetContentObject();const P=L.GetRenderTarget();I.SetColor(L.GetPremultipliedColor());I.DrawRenderTarget(P);I.InvalidateRenderTarget(P);
B.ReleaseAdditionalRenderTarget(P)},getShaderParameters:I=>this.GetEffectList().GetEffectParametersForIndex(I)});this._wasDefaultColor=this._needsRebuildEffectChainSteps=!0;this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=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.UsesRenderCells()&&(this._renderGrid=f.New(f.RenderGrid,this._runtime.GetOriginalViewportWidth(),
this._runtime.GetOriginalViewportHeight()));this._subLayers=J[19].map(I=>f.New(f.Layer,this._layout,this,I))}_Init(){for(const A of this._initialInstancesData){const F=this._runtime.GetObjectClassByIndex(A[1]);this._layout._AddInitialObjectClass(F);F.GetDefaultInstanceData()||(F.SetDefaultInstanceData(A),F._SetDefaultLayerIndex(this._index));this._initialInstances.push(A);this._initialUIDsToInstanceData.set(A[2],A)}f.shallowAssignArray(this._startupInitialInstances,this._initialInstances);this._initialInstancesData=
null}Release(){this._runtime=this._layout=null}GetInitialInstanceData(A){return this._initialUIDsToInstanceData.get(A)}CreateInitialInstances(A){const F=this._layout.IsFirstVisit();let J=0;const B=this._initialInstances;for(let L=0,P=B.length;L<P;++L){var I=B[L];const S=this._runtime.GetObjectClassByIndex(I[1]);let U=!0;if(!S.HasPersistBehavior()||F)I=this._runtime.CreateInstanceFromData(I,this,!0),A.push(I),S.IsGlobal()&&(U=!1,this._createdGlobalUids.push(I.GetUID()));U&&(B[J]=B[L],++J)}f.truncateArray(B,
J);this._runtime.FlushPendingInstances();this.SetZIndicesChanged()}_AddInstance(A,F){const J=A.GetWorldInfo();if(J.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.push(A);0!==J.GetZElevation()&&(this._anyInstanceZElevated=!0);F&&this.UsesRenderCells()&&A.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(A){this._instances.includes(A)||(this._instances.push(A),0!==A.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(A,
F){const J=A.GetWorldInfo();if(J.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(A);0!==J.GetZElevation()&&(this._anyInstanceZElevated=!0);this.SetZIndicesChanged();F&&this.UsesRenderCells()&&A.GetWorldInfo().SetBboxChanged()}_RemoveInstance(A,F){const J=this._instances.indexOf(A);0>J||(F&&this.UsesRenderCells()&&A.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(J,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=
!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(A){if(A){A=new Set;for(var F of this._instances){var J=F.GetWorldInfo()._GetLastCachedZIndex();0<=J&&A.add(J)}F=-1;for(const B of this._instances)if(J=B.GetWorldInfo(),!(0<=J._GetLastCachedZIndex())){for(++F;A.has(F);)++F;J._SetZIndex(F)}}this._instances.sort(r)}_Start(){}_End(){for(const A of this._instances)A.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(A);
this._runtime.FlushPendingInstances();f.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(A,F,J,B,I){const L=this._runtime.GetEventSheetManager(),P=this._runtime.GetAllObjectClasses(),S=A.IsFamily(),U=[];for(const ma of this._initialInstances){var V=ma[0];if(F.containsPoint(V[0],V[1])){V=P[ma[1]];if(V!==A)if(S){if(!A.FamilyHasMember(V))continue}else continue;V=this;var Z=this._runtime.GetCurrentLayout();this.GetLayout()!==Z&&((V=Z.GetLayerByName(this.GetName()))||
(V=Z.GetLayerByIndex(this.GetIndex())));Z=this._runtime.CreateInstanceFromData(ma,V,!1,void 0,void 0,!1,I);V.SortAndAddInstancesByZIndex(Z);V=Z.GetWorldInfo();V.OffsetXY(J,B);V.SetBboxChanged();L.BlockFlushingInstances(!0);Z._TriggerOnCreatedOnSelfAndRelated();L.BlockFlushingInstances(!1);U.push(Z)}}return U}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}_SetIndex(A){this._index=A}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}_MaybeRebuildEffectChainSteps(){const A=this.HasDefaultColor();if(this._needsRebuildEffectChainSteps||A!==this._wasDefaultColor){var F=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(F.map(J=>J.GetShaderProgram()),{indexMap:F.map(J=>J.GetIndex()),forcePreDraw:!A,useFullSurface:!0});this._needsRebuildEffectChainSteps=!1;this._wasDefaultColor=A}}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();this._needsRebuildEffectChainSteps=!0}UsesRenderCells(){return this._useRenderCells&&
!this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=!1}IsVisible(){for(const A of this.selfAndParentLayers())if(!A._IsVisibleFlagSet())return!1;return!0}_IsVisibleFlagSet(){return this._isVisible}SetVisible(A){A=!!A;this._isVisible!==A&&(this._isVisible=A,this._runtime.UpdateRender())}SetOwnScrollPositionEnabled(A){A=!!A;if(this._hasOwnScrollPosition!==A){if(this._hasOwnScrollPosition=A)A=this.GetLayout(),this._scrollX=A.GetScrollX(),
this._scrollY=A.GetScrollY();this._SetMVMatrixChanged();this._runtime.UpdateRender()}}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(A){var F=this.GetLayout();const J=F.GetScrollLeftBound();F=F.GetScrollRightBound();A>F&&(A=F);A<J&&(A=J);this._scrollX!==A&&(this._scrollX=A,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}SetScrollY(A){var F=this.GetLayout();const J=F.GetScrollTopBound();F=F.GetScrollBottomBound();A>F&&(A=F);A<
J&&(A=J);this._scrollY!==A&&(this._scrollY=A,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}GetScrollX(){return this.IsOwnScrollPositionEnabled()?this._scrollX:this.GetLayout().GetScrollX()}GetScrollY(){return this.IsOwnScrollPositionEnabled()?this._scrollY:this.GetLayout().GetScrollY()}GetViewport(){return this._viewport}GetViewport3D(){return this._viewport3D}_GetVanishingPoint(){const A=this.GetLayout();return[A.GetVanishingPointX(),A.GetVanishingPointY()]}GetViewportForZ(A,
F){var J=this._viewportZ0;if(0===A)F.copy(J);else{let P=J.midX(),S=J.midY();var B=this.Get2DScaleFactorToZ(A);const U=J.width()/B;J=J.height()/B;const [V,Z]=this._GetVanishingPoint();if(.5!==V||.5!==Z){const ma=this.GetCameraZ();var I=this._runtime,L=100/ma;B=(V-.5)*I.GetViewportWidth()/L;I=(Z-.5)*I.GetViewportHeight()/L;L=this.GetAngle();0!==L&&(p.set(B,I),p.rotate(L),B=p.getX(),I=p.getY());A=f.unlerp(ma,0,A);P+=f.lerp(B,0,A);S+=f.lerp(I,0,A)}F.set(P-U/2,S-J/2,P+U/2,S+J/2)}}GetOpacity(){return this._color.getA()}SetOpacity(A){A=
f.clamp(A,0,1);this._color.getA()!==A&&(this._color.setA(A),this._UpdatePremultipliedColor(),this._runtime.UpdateRender())}_UpdatePremultipliedColor(){this._premultipliedColor.copy(this._color);this._premultipliedColor.premultiply()}GetPremultipliedColor(){return this._premultipliedColor}HasDefaultColor(){return this._color.equalsRgba(1,1,1,1)}GetScaleRate(){return this._scaleRate}SetScaleRate(A){this._scaleRate!==A&&(this._scaleRate=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(A,
F){if(this._parallaxX!==A||this._parallaxY!==F)if(this._parallaxX=A,this._parallaxY=F,this._SetMVMatrixChanged(),this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const J of this._instances)J.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(A){this.SetParallax(A,this.GetParallaxY())}SetParallaxY(A){this.SetParallax(this.GetParallaxX(),A)}SetZElevation(A){this._zElevation!==A&&(this._zElevation=A,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(A){A=
f.clampAngle(A);this._angle!==A&&(this._angle=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetAngle(){return f.clampAngle(this._layout.GetAngle()+this._angle)}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}_GetInstancesInDrawOrder(){return this.RendersIn3DMode()&&this._useCameraDistanceDrawOrder?(f.shallowAssignArray(H,this._GetInstances()),H.sort((A,F)=>this._SortInstancesByCameraDistance(A,F)),H):this._GetInstances()}_AppendAllInstancesIncludingSubLayersInDrawOrder(A){f.appendArray(A,
this._GetInstancesInDrawOrder());for(const F of this._subLayers)F.IsVisible()&&0<F.GetOpacity()&&F._AppendAllInstancesIncludingSubLayersInDrawOrder(A)}_SortInstancesByCameraDistance(A,F){var J=this.GetLayout().Get3DCameraPosition(),B=J[0],I=J[1];J=J[2];var L=A.GetWorldInfo();const P=F.GetWorldInfo();F=L.GetX()-B;A=L.GetY()-I;L=L.GetZElevation()-J;B=P.GetX()-B;I=P.GetY()-I;J=P.GetZElevation()-J;return B*B+I*I+J*J-(F*F+A*A+L*L)}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(A){A=
!!A;this._isTransparent!==A&&(this._isTransparent=A,this._runtime.UpdateRender())}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(A){A=!!A;this._isForceOwnTexture!==A&&(this._isForceOwnTexture=A,this._runtime.UpdateRender())}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()||!this._renderAs3d}RendersIn3DMode(){return!this.RendersIn2DMode()}Has3DCamera(){return this.RendersIn3DMode()&&this.GetLayout().Is3DCameraEnabled()}SelfAndAllSubLayersHave3DCamera(){if(!this.Has3DCamera())return!1;
for(const A of this._subLayers)if(!A.SelfAndAllSubLayersHave3DCamera())return!1;return!0}SetBlendMode(A){this._blendMode!==A&&(this._blendMode=A,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}IsRootLayer(){return!this._parentLayer}GetParentLayer(){return this._parentLayer}GetSubLayers(){return this._subLayers}HasAnySubLayers(){return 0<this._subLayers.length}HasAnyVisibleSubLayer(){for(const A of this._subLayers)if(A.ShouldDraw())return!0;return!1}*selfAndAllSubLayers(){for(const A of this._subLayers)yield*A.selfAndAllSubLayers();
yield this}*parentLayers(){let A=this.GetParentLayer();for(;A;)yield A,A=A.GetParentLayer()}*selfAndParentLayers(){yield this;yield*this.parentLayers()}IsTransformCompatibleWith(A){return this===A||this._parallaxX===A._parallaxX&&this._parallaxY===A._parallaxY&&this._scale===A._scale&&this._scaleRate===A._scaleRate&&this._angle===A._angle&&this.GetScrollX()===A.GetScrollX()&&this.GetScrollY()===A.GetScrollY()}SaveTransform(){return{parallaxX:this.GetParallaxX(),parallaxY:this.GetParallaxY(),scale:this.GetOwnScale(),
scaleRate:this.GetScaleRate(),angle:this.GetOwnAngle(),hasOwnScroll:this.IsOwnScrollPositionEnabled(),scrollX:this.GetScrollX(),scrollY:this.GetScrollY()}}RestoreTransform(A){this.SetParallax(A.parallaxX,A.parallaxY);this.SetOwnScale(A.scale);this.SetScaleRate(A.scaleRate);this.SetAngle(A.angle);this.SetOwnScrollPositionEnabled(A.hasOwnScroll);this.SetScrollX(A.scrollX);this.SetScrollY(A.scrollY)}_RemoveAllInstancesInSet(A){0!==A.size&&0<f.arrayRemoveAllInSet(this._instances,A)&&(this._MaybeResetAnyInstanceZElevatedFlag(),
this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){this._instances.sort(x);if(this.UsesRenderCells())for(let A=0,F=this._instances.length;A<F;++A){const J=this._instances[A].GetWorldInfo();J._SetZIndex(A);this._renderGrid.MarkRangeChanged(J.GetRenderCellRange())}else for(let A=0,F=this._instances.length;A<F;++A)this._instances[A].GetWorldInfo()._SetZIndex(A);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(A,
F,J){var B=A.GetWorldInfo();F=F.GetWorldInfo();if(B.GetLayer()!==this||F.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");B=B.GetZIndex();F=F.GetZIndex();if(B===F+(J?1:-1))return!1;f.arrayRemove(this._instances,B);B<F&&F--;J&&F++;F===this._instances.length?this._instances.push(A):this._instances.splice(F,0,A);this.SetZIndicesChanged();return!0}_MergeSortedZArrays(A,F){const J=[];let B=0,I=0,L=A.length,P=F.length;for(;B<L&&I<P;){const S=A[B],U=F[I];S.GetWorldInfo()._GetLastCachedZIndex()<
U.GetWorldInfo()._GetLastCachedZIndex()?(J.push(S),++B):(J.push(U),++I)}for(;B<L;++B)J.push(A[B]);for(;I<P;++I)J.push(F[I]);return J}_MergeAllSortedZArrays_pass(A){const F=[],J=A.length;for(let B=0;B<J-1;B+=2)F.push(this._MergeSortedZArrays(A[B],A[B+1]));1===J%2&&F.push(A[J-1]);return F}_MergeAllSortedZArrays(A){for(;1<A.length;)A=this._MergeAllSortedZArrays_pass(A);return A[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();f.clearArray(c);this._renderGrid.QueryRange(this._viewport,c);return c.length?
1===c.length?c[0]:this._MergeAllSortedZArrays(c):[]}ShouldDraw(){return this.IsVisible()&&0<this.GetOpacity()&&this._DrawsAnyContentInSelfOrSubLayers()}_DrawsAnyContentInSelfOrSubLayers(){if(this.HasInstances()||!this.IsTransparent())return!0;for(const A of this._subLayers)if(A._DrawsAnyContentInSelfOrSubLayers())return!0;return!1}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||0!==this.GetBlendMode()||this._effectList.HasAnyActiveEffect()}SelfOrAnySubLayerUsesOwnTexture(){if(this.UsesOwnTexture())return!0;
for(const A of this._subLayers)if(A.SelfOrAnySubLayerUsesOwnTexture())return!0;return!1}GetRenderTarget(){return this._curRenderTarget}Get2DScaleFactorToZ(A){if(this._layout.IsOrthographicProjection())return 1;{const F=this.GetCameraZ();return F/(F-A)}}GetCameraZ(){return 100/this.GetNormalScale()}_SetMVMatrixChanged(){this._isViewFrustumChanged=this._isMVMatrixChanged=!0}_GetModelViewMatrix(A){this._isMVMatrixChanged&&(this._CalculateModelViewMatrix(A,this._modelViewMatrix,0,0,null),this._isMVMatrixChanged=
!1);return this._modelViewMatrix}GetCameraPosition(){if(this.Has3DCamera()){const A=this.GetLayout().Get3DCameraPosition();return[A[0],A[1],A[2]]}return this._Get2DCameraPosition()}_Get2DCameraPosition(A=0,F=0){var J=this._runtime,B=this.GetLayout(),I=J.GetRenderScale(),L=J.GetParallaxXOrigin(),P=J.GetParallaxYOrigin();L=(this.GetScrollX()-L)*this._parallaxX+L;P=(this.GetScrollY()-P)*this._parallaxY+P;J.IsPixelRoundingEnabled()&&(L=Math.round(L),P=Math.round(P));A=(L+A)*I;F=(P+F)*I;B=B.IsOrthographicProjection()?
100:this.GetCameraZ();const [S,U]=this._GetVanishingPoint();if(.5!==S||.5!==U)L=100/B,P=(S-.5)*J.GetViewportWidth()*I/L,J=(U-.5)*J.GetViewportHeight()*I/L,I=this.GetAngle(),0!==I&&(p.set(P,J),p.rotate(I),P=p.getX(),J=p.getY()),A+=P,F+=J;return[A,F,B]}_CalculateModelViewMatrix(A,F,J,B,I){const L=this._runtime;var P=this.GetLayout();const S=L.GetRenderScale();if(this.Has3DCamera()){e.copy(w,P.Get3DCameraPosition());e.copy(q,P.Get3DCameraLookAt());e.copy(t,P.Get3DCameraUpVector());J=L.GetParallaxXOrigin();
B=L.GetParallaxYOrigin();P=q[0]-w[0];const U=q[1]-w[1],V=q[2]-w[2];w[0]=(w[0]-J)*this._parallaxX+J;w[1]=(w[1]-B)*this._parallaxY+B;w[2]*=Math.max(this._parallaxX,this._parallaxY);q[0]=w[0]+P;q[1]=w[1]+U;q[2]=w[2]+V;e.set(m,S,S,1);e.multiply(w,w,m);e.multiply(q,q,m)}else{const [U,V,Z]=this._Get2DCameraPosition(J,B);e.set(w,U,V,Z);e.set(q,U,V,Z-100);J=this.GetAngle();0===J?e.set(t,0,1,0):e.set(t,Math.sin(J),Math.cos(J),0)}A.CalculateLookAtModelView(F,w,q,t,I||L.GetCanvasManager().GetDrawHeight());1!==
S&&(e.set(m,S,S,1),g.scale(F,F,m))}_SetProjectionMatrixChanged(){this._isViewFrustumChanged=this._isProjectionMatrixChanged=!0}_GetProjectionMatrix(A){this._isProjectionMatrixChanged&&(this._CalculateProjectionMatrix(A),this._isProjectionMatrixChanged=!1);return this._projectionMatrix}_CalculateProjectionMatrix(A){var F=this._runtime.GetCanvasManager();const [J,B]=this._GetVanishingPoint();if(this._layout.IsOrthographicProjection())A.CalculateOrthographicMatrix(this._projectionMatrix,F.GetDrawWidth(),
F.GetDrawHeight());else if(.5===J&&.5===B)g.copy(this._projectionMatrix,F.GetDefaultProjectionMatrix());else{const I=F.GetDrawWidth();F=F.GetDrawHeight();A.CalculatePerspectiveMatrix(this._projectionMatrix,I/F,J,B)}}_SetTransform(A,F=!0,J=0,B=0,I=0){F&&A.SetProjectionMatrix(this._GetProjectionMatrix(A));0===J&&0===B&&0===I?F=this._GetModelViewMatrix(A):(this._CalculateModelViewMatrix(A,l,J,B,I),F=l);A.SetModelViewMatrix(F)}PrepareForDraw(A){this._SetTransform(A);A.SetBaseZ(this.GetZElevation())}Draw(A,
F,J){var B=this._runtime.GetCanvasManager();const I=this.UsesOwnTexture();var L=null;let P=null;if(this._runtime.IsGPUProfiling())if(A.IsWebGL()){const S=B.GetLayerTimingsBuffer(this);S&&(P=S.AddTimeElapsedQuery(),A.StartQuery(P))}else A.IsWebGPU()&&A.WriteTimestamp(2*(this.GetIndex()+1));I?(L={sampling:this._runtime.GetSampling()},"low"===B.GetCurrentFullscreenScalingQuality()&&(L.width=B.GetDrawWidth(),L.height=B.GetDrawHeight()),this._curRenderTarget=L=this._runtime.GetAdditionalRenderTarget(L),
A.SetRenderTarget(L),this.IsTransparent()&&A.ClearRgba(0,0,0,0)):(this._curRenderTarget=F,A.SetRenderTarget(F));this.IsTransparent()||A.Clear(this._backgroundColor);this._layout._DrawLayerList(A,this._curRenderTarget,this._subLayers,I&&this.IsTransparent());this._SetTransform(A);A.SetBaseZ(this.GetZElevation());A.SetDepthEnabled(this.RendersIn3DMode());this.GetNormalScale()>Number.EPSILON&&(this._UpdateZIndices(),B=this.UsesRenderCells()&&0===this.GetZElevation()&&!this._anyInstanceZElevated,this.Has3DCamera()?
this._DrawInstances_3DCamera(A):B?this._DrawInstances_RenderCells(A):this._DrawInstances(A,this._GetInstancesInDrawOrder()));A.SetBaseZ(0);A.SetCurrentZ(0);I&&(A.SetDepthEnabled(!1),this._DrawLayerOwnTextureToRenderTarget(A,L,F,J));P&&A.EndQuery(P);this._runtime.IsGPUProfiling()&&A.IsWebGPU()&&A.WriteTimestamp(2*(this.GetIndex()+1)+1);this._curRenderTarget=null}_DrawInstances(A,F){const J=this._viewport,B=this._curRenderTarget,I=this.GetLayout().IsOrthographicProjection(),L=this.GetLayout().HasVanishingPointOutsideViewport();
let P=null;for(let S=0,U=F.length;S<U;++S){const V=F[S];if(V===P)continue;P=V;const Z=V.GetWorldInfo();Z.IsVisible()&&Z.IsInViewport(J,L,I)&&this._DrawInstanceMaybeWithEffects(V,Z,A,B)}}_DrawInstances_3DCamera(A){const F=this._curRenderTarget,J=this._GetViewFrustum(),B=this._GetInstancesInDrawOrder();for(let S=0,U=B.length;S<U;){var I=B[S],L=I.GetWorldInfo();if(!L.IsVisible()||!L.IsInViewport3D(J)){++S;continue}(!I.RendersToOwnZPlane()||0<L.GetDepth())&&E.push(I);var P=I.GetWorldInfo().GetTotalZElevation();
y.push(I);let V=S+1;for(;V<U;++V){const Z=B[V],ma=Z.GetWorldInfo();if(ma.IsVisible()&&ma.IsInViewport3D(J)){if(ma.GetTotalZElevation()!==P)break;Z.RendersToOwnZPlane()?(0<ma.GetDepth()&&E.push(Z),y.push(Z)):E.push(Z)}}if(1!==y.length||y[0].MustMitigateZFighting()){this._DrawCoplanarInstances_3DCamera(A,y);for(let Z=0,ma=E.length;Z<ma;++Z)I=E[Z],L=I.GetWorldInfo(),L._SetDrawNonBackFacesOnly(!0),this._DrawInstanceMaybeWithEffects(I,L,A,F),L._SetDrawNonBackFacesOnly(!1)}else{this._DrawInstanceMaybeWithEffects(I,
L,A,F);for(let Z=0,ma=E.length;Z<ma;++Z)L=E[Z],L!==I&&(P=L.GetWorldInfo(),P.GetLayer()._DrawInstanceMaybeWithEffects(L,P,A,F))}S=V;f.clearArray(y);f.clearArray(E)}}_DrawCoplanarInstances_3DCamera(A,F){const J=this._curRenderTarget;A.CoplanarStartStencilPass();for(let L=0,P=F.length;L<P;++L){var B=F[L],I=B.GetWorldInfo();I._SetDrawBackFaceOnly(!0);this._DrawInstance(B,I,A)}A.CoplanarStartColorPass();for(let L=0,P=F.length;L<P;++L)B=F[L],I=B.GetWorldInfo(),this._DrawInstanceMaybeWithEffects(B,I,A,J),
I._SetDrawBackFaceOnly(!1);A.CoplanarRestoreStandardRendering()}_DrawInstances_RenderCells(A){var F=this._renderGrid;const J=this._curRenderCells,B=this._lastRenderCells,I=this._viewport;J.set(F.XToCell(I.getLeft()),F.YToCell(I.getTop()),F.XToCell(I.getRight()),F.YToCell(I.getBottom()));this._isRenderListUpToDate&&J.equals(B)?F=this._lastRenderList:(F=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,B.copy(J));this._DrawInstances(A,F);F!==this._lastRenderList&&f.shallowAssignArray(this._lastRenderList,
F)}_DrawInstanceMaybeWithEffects(A,F,J,B){F.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(A,F,J,B):this._DrawInstance(A,F,J)}_DrawInstance(A,F,J){F=F.GetRendererStateGroup();J.GetCurrentStateGroup()!==F&&F.Apply();A.Draw(J)}_DrawInstanceWithEffectsAndRestore(A,F,J,B){this._DrawInstanceWithEffects(A,F,J,B,null)&&this._SetTransform(J)}_DrawInstanceWithEffects(A,F,J,B,I){const L=F.GetInstanceEffectList().GetEffectChain();L.Render(J,B,{contentObject:A,blendMode:F.GetBlendMode(),devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),
layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetNormalScale(),layerAngle:this.GetAngle(),layoutRect:F.GetBoundingBox(),drawSurfaceRect:L.IsFastPath()?null:this._InstanceBoxToDrawSurface(F),drawContentHook:I&&I.drawContentHook,compositOffX:I&&I.compositOffX,compositOffY:I&&I.compositOffY,updateOwnProjection:I&&I.updateOwnProjection});J.SetBaseZ(this.GetZElevation());return L.DidChangeTransform()}_DrawLayerOwnTextureToRenderTarget(A,F,J,B){const I=this._effectList.GetActiveEffectTypes(),
L=this._runtime;0===I.length?(A.SetRenderTarget(J),A.SetTextureFillMode(),B&&0===this._blendMode&&this.HasDefaultColor()?A.CopyRenderTarget(F):(A.SetBlendMode(this._blendMode),A.SetColor(this._premultipliedColor),A.DrawRenderTarget(F)),A.InvalidateRenderTarget(F),L.ReleaseAdditionalRenderTarget(F)):this.GetEffectChain().Render(A,J,{contentObject:this,blendMode:this.GetBlendMode(),devicePixelRatio:L.GetEffectDevicePixelRatioParam(),layerScale:L.GetEffectLayerScaleParam()*this.GetNormalScale(),layerAngle:this.GetAngle(),
layoutRect:this.GetViewport(),drawSurfaceRect:null,invalidateRenderTargets:!0})}GetOwnScale(){return this._scale}SetOwnScale(A){this._scale!==A&&(this._scale=A,this._layout.BoundScrolling(),this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetRenderScale(){return this.GetNormalScale()*this._runtime.GetRenderScale()}GetDisplayScale(){return this.GetNormalScale()*this._runtime.GetDisplayScale()}GetNormalScale(){return(this._scale*this._layout.GetScale()-1)*this._scaleRate+1}UpdateViewport(){var A=
this._runtime.GetParallaxXOrigin(),F=this._runtime.GetParallaxYOrigin(),J=(this.GetScrollX()-A)*this._parallaxX+A,B=(this.GetScrollY()-F)*this._parallaxY+F;A=this.GetNormalScale();F=this._runtime.GetViewportWidth()/A;A=this._runtime.GetViewportHeight()/A;J-=F/2;let I=B-A/2;this._runtime.IsPixelRoundingEnabled()&&(J=Math.round(J),I=Math.round(I));B=this._viewportZ0;B.set(J,I,J+F,I+A);F=this.GetAngle();0!==F&&(b.copy(B),b.offset(-B.midX(),-B.midY()),a.setFromRotatedRect(b,F),a.getBoundingBox(b),b.offset(B.midX(),
B.midY()),B.copy(b));F=this._zElevation;this.GetViewportForZ(F,this._viewport);this.Has3DCamera()?this.CalculateViewport3D(F,this._viewport3D):this._viewport3D.copy(this._viewport)}CalculateViewport3D(A,F){var J=this._runtime.GetCanvasManager(),B=J.GetCssWidth();J=J.GetCssHeight();const [I,L]=this.CanvasCssToLayer(0,0,A),[P,S]=this.CanvasCssToLayer(B,0,A),[U,V]=this.CanvasCssToLayer(B,J,A),[Z,ma]=this.CanvasCssToLayer(0,J,A);A=Math.min(I,P,U,Z);B=Math.min(L,S,V,ma);J=Math.max(I,P,U,Z);let va=Math.max(L,
S,V,ma);isFinite(A)||(A=-Infinity);isFinite(B)||(B=-Infinity);isFinite(J)||(J=Infinity);isFinite(va)||(va=Infinity);F.set(A,B,J,va)}CanvasCssToLayer(A,F,J=0){return this._CanvasToLayer(A,F,J,this.GetDisplayScale())}DrawSurfaceToLayer(A,F,J=0){return this._CanvasToLayer(A,F,J,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(A,F,J,B){var I=this._runtime,L=I.GetRenderer();const P=this.GetNormalScale(),S=I.GetViewportWidth()/P;I=I.GetViewportHeight()/P;h.set(u,0,0,S,I);A/=B;F=u[3]-F/B;
B=this._GetProjectionMatrix(L);L=this._GetModelViewMatrix(L);return f.Gfx.UnprojectScreenToWorldZ(A,F,J,L,B,u,m)?[m[0],m[1]]:[NaN,NaN]}CanvasCssToLayer_DefaultTransform(A,F){const J=this._scale,B=this._scaleRate,I=this._parallaxX,L=this._parallaxY,P=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;this._SetMVMatrixChanged();A=this.CanvasCssToLayer(A,F);this._scale=J;this._scaleRate=B;this._parallaxX=I;this._parallaxY=L;this._angle=P;this._SetMVMatrixChanged();
return A}LayerToCanvasCss(A,F,J=0){return this._LayerToCanvas(A,F,J,this.GetDisplayScale())}LayerToDrawSurface(A,F,J=0){return this._LayerToCanvas(A,F,J,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(A,F,J,B){var I=this._runtime,L=I.GetRenderer();const P=this.GetNormalScale();var S=I.GetViewportWidth()/P;I=I.GetViewportHeight()/P;h.set(u,0,0,S,I);S=this._GetProjectionMatrix(L);L=this._GetModelViewMatrix(L);return f.Gfx.Project(A,F,J,L,S,u,m)?[m[0]*B,(u[3]-m[1])*B]:[NaN,NaN]}_GetLayerToDrawSurfaceScale(A,
F){A*=this.GetRenderScale()*this.GetDevicePixelRatio();0!==F&&(A*=this.Get2DScaleFactorToZ(F));return A}_InstanceBoxToDrawSurface(A){var F=A.GetBoundingBox(),J=A.GetTotalZElevation();A=A.GetDepth();const B=J+A,I=F.getLeft(),L=F.getTop(),P=F.getRight();F=F.getBottom();if(this.Has3DCamera()){if(this._IsPointBehindNearPlane(I,L,J)||this._IsPointBehindNearPlane(P,L,J)||this._IsPointBehindNearPlane(P,F,J)||this._IsPointBehindNearPlane(I,F,J)||0<A&&(this._IsPointBehindNearPlane(I,L,B)||this._IsPointBehindNearPlane(P,
L,B)||this._IsPointBehindNearPlane(P,F,B)||this._IsPointBehindNearPlane(I,F,B)))return null}else if(B>=this.GetCameraZ())return null;let [S,U]=this.LayerToDrawSurface(I,L,J),[V,Z]=this.LayerToDrawSurface(P,F,J);if(0!==this.GetAngle()||0<A){const [ma,va]=this.LayerToDrawSurface(P,L,J),[Na,Ea]=this.LayerToDrawSurface(I,F,J);if(0<A){const [Ia,Ma]=this.LayerToDrawSurface(I,L,B),[Fa,ya]=this.LayerToDrawSurface(P,L,B),[na,Va]=this.LayerToDrawSurface(P,F,B),[xa,Ga]=this.LayerToDrawSurface(I,F,B);J=Math.min(S,
V,ma,Na,Ia,Fa,na,xa);V=Math.max(S,V,ma,Na,Ia,Fa,na,xa);S=J;J=Math.min(U,Z,va,Ea,Ma,ya,Va,Ga);Z=Math.max(U,Z,va,Ea,Ma,ya,Va,Ga);U=J}else J=Math.min(S,V,ma,Na),V=Math.max(S,V,ma,Na),S=J,J=Math.min(U,Z,va,Ea),Z=Math.max(U,Z,va,Ea),U=J}b.set(S,U,V,Z);return b}_GetViewFrustum(){this._isViewFrustumChanged&&(this._UpdateViewFrustum(),this._isViewFrustumChanged=!1);return this._viewFrustum}_UpdateViewFrustum(){var A=this._runtime.GetRenderer();const F=this._GetProjectionMatrix(A);A=this._GetModelViewMatrix(A);
this._viewFrustum.CalculatePlanes(A,F)}_IsPointBehindNearPlane(A,F,J){return this._GetViewFrustum().IsBehindNearPlane(A,F,J)}_SaveToJson(){return{s:this.GetOwnScale(),a:this.GetOwnAngle(),vl:this._viewport.getLeft(),vt:this._viewport.getTop(),vr:this._viewport.getRight(),vb:this._viewport.getBottom(),v:this._IsVisibleFlagSet(),bc:this._backgroundColor.toJSON(),t:this.IsTransparent(),sx:this._scrollX,sy:this._scrollY,hosp:this._hasOwnScrollPosition,px:this.GetParallaxX(),py:this.GetParallaxY(),c:this._color.toJSON(),
sr:this.GetScaleRate(),fx:this._effectList.SaveToJson(),cg:this._createdGlobalUids}}_LoadFromJson(A){this._scale=A.s;this._angle=A.a;this._viewport.set(A.vl,A.vt,A.vr,A.vb);this._isVisible=!!A.v;this._backgroundColor.setFromJSON(A.bc);this._isTransparent=!!A.t;A.hasOwnProperty("sx")&&(this._scrollX=A.sx);A.hasOwnProperty("sy")&&(this._scrollY=A.sy);A.hasOwnProperty("hosp")&&(this._hasOwnScrollPosition=!!A.hosp);this._parallaxX=A.px;this._parallaxY=A.py;this._color.setFromJSON(A.c);this._scaleRate=
A.sr;f.shallowAssignArray(this._createdGlobalUids,A.cg);f.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const F=new Set(this._createdGlobalUids);let J=0;for(let B=0,I=this._initialInstances.length;B<I;++B)F.has(this._initialInstances[B][2])||(this._initialInstances[J]=this._initialInstances[B],++J);f.truncateArray(this._initialInstances,J);this._effectList.LoadFromJson(A.fx);this._needsRebuildEffectChainSteps=!0;this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}SortAndAddInstancesByZIndex(A){if(!this._instances.includes(A))if(A.HasChildren()){var F=
[...A.allChildren()];F.push(A);F.sort((B,I)=>{B=B.GetWorldInfo().GetSceneGraphZIndex();I=I.GetWorldInfo().GetSceneGraphZIndex();return B-I});for(var J of F)if(J.IsInContainer())for(const B of J.siblings())F.includes(B)||(A=[...B.allChildren()],A.push(B),A.sort((I,L)=>{I=I.GetWorldInfo().GetSceneGraphZIndex();L=L.GetWorldInfo().GetSceneGraphZIndex();return I-L}),A&&A.length&&F.splice(F.length,0,...A));for(const B of F)this._AddInstance(B,!0)}else if(this._AddInstance(A,!0),A.IsInContainer())for(F of A.siblings())if(J=
[...F.allChildren()],J.push(F),J.sort((B,I)=>{B=B.GetWorldInfo().GetSceneGraphZIndex();I=I.GetWorldInfo().GetSceneGraphZIndex();return B-I}),J&&J.length)for(const B of J)this._AddInstance(B,!0)}}}
{"use strict";const f=self.C3,b=self.C3Debugger;f.New(f.Rect);f.New(f.Rect);const a=f.New(f.Rect),c=f.New(f.Color),d=self.glMatrix.vec3,e=[],h=[],g=[],l=[];function m(q,t,p,r){return q[0]===Math.fround(t)&&q[1]===Math.fround(p)&&q[2]===Math.fround(r)}let u=null;function w(q,t){u!==q&&(q.PrepareForDraw(t),u=q)}f.Layout=class extends f.DefendedBase{constructor(q,t,p){super();this._layoutManager=q;this._runtime=q.GetRuntime();this._name=p[0];this._originalWidth=p[1];this._originalHeight=p[2];this._width=
p[1];this._height=p[2];this._isUnboundedScrolling=!!p[3];this._isOrthographicProjection=!!p[4];this._vanishingPointX=p[5];this._vanishingPointY=p[6];this._eventSheetName=p[7];this._eventSheet=null;this._sid=p[8];this._index=t;this._scrollY=this._scrollX=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._initialNonWorld=[];this._is3dCameraEnabled=!1;this._cam3dposition=d.create();
this._cam3dlook=d.create();this._cam3dup=d.create();this._rootLayers=[];this._allLayersFlat=[];this._layersByName=new Map;this._layersBySid=new Map;const r=this._runtime.GetCanvasManager();this._effectList=f.New(f.EffectList,this,p[11]);this._effectChain=f.New(f.Gfx.EffectChain,r.GetEffectChainManager(),{drawContent:(x,y)=>{y=y.GetContentObject().GetRenderTarget();x.ResetColor();x.DrawRenderTarget(y);x.InvalidateRenderTarget(y);r.ReleaseAdditionalRenderTarget(y)},getShaderParameters:x=>this.GetEffectList().GetEffectParametersForIndex(x)});
this._needsRebuildEffectChainSteps=!0;this._wasFullScreenQualityLow=!1;this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=f.New(f.Event.Dispatcher);for(const x of p[9])this._rootLayers.push(f.New(f.Layer,this,null,x));this._allLayersFlat=[...this.allLayers()];for(let x=0,y=this._allLayersFlat.length;x<y;++x)q=this._allLayersFlat[x],q._SetIndex(x),q._Init(),this._layersByName.set(q.GetName().toLowerCase(),q),this._layersBySid.set(q.GetSID(),
q);for(const x of p[10]){p=this._runtime.GetObjectClassByIndex(x[1]);if(!p)throw Error("missing nonworld object class");p.GetDefaultInstanceData()||p.SetDefaultInstanceData(x);this._initialNonWorld.push(x);this._AddInitialObjectClass(p)}}Release(){for(const q of this._allLayersFlat)q.Release();f.clearArray(this._allLayersFlat);this._textureLoadPendingPromises.clear();this._runtime=this._layoutManager=this._eventSheet=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}_MaybeRebuildEffectChainSteps(){const q="low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality();if(this._needsRebuildEffectChainSteps||this._wasFullScreenQualityLow!==q){var t=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(t.map(p=>p.GetShaderProgram()),{indexMap:t.map(p=>p.GetIndex()),forcePostDraw:q,useFullSurface:!0});this._needsRebuildEffectChainSteps=!1;this._wasFullScreenQualityLow=q}}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();
this._needsRebuildEffectChainSteps=!0}GetMinLayerScale(){let q=this._allLayersFlat[0].GetNormalScale();for(let t=1,p=this._allLayersFlat.length;t<p;++t){const r=this._allLayersFlat[t];if(0!==r.GetParallaxX()||0!==r.GetParallaxY())q=Math.min(q,r.GetNormalScale())}return q}_GetScrollBoundMarginHorizontal(){return.5*this._runtime.GetViewportWidth()/this.GetMinLayerScale()}_GetScrollBoundMarginVertical(){return.5*this._runtime.GetViewportHeight()/this.GetMinLayerScale()}GetScrollLeftBound(){return this.IsUnboundedScrolling()?
-Infinity:this._GetScrollBoundMarginHorizontal()}GetScrollRightBound(){return this.IsUnboundedScrolling()?Infinity:this.GetWidth()-this._GetScrollBoundMarginHorizontal()}GetScrollTopBound(){return this.IsUnboundedScrolling()?-Infinity:this._GetScrollBoundMarginVertical()}GetScrollBottomBound(){return this.IsUnboundedScrolling()?Infinity:this.GetHeight()-this._GetScrollBoundMarginVertical()}SetScrollX(q){const t=this.GetScrollLeftBound(),p=this.GetScrollRightBound();q>p&&(q=p);q<t&&(q=t);this._scrollX!==
q&&(this._scrollX=q,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(q){const t=this.GetScrollTopBound(),p=this.GetScrollBottomBound();q>p&&(q=p);q<t&&(q=t);this._scrollY!==q&&(this._scrollY=q,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}IsUnboundedScrolling(){return this._isUnboundedScrolling}BoundScrolling(){this.SetScrollX(this.GetScrollX());this.SetScrollY(this.GetScrollY());for(const q of this._allLayersFlat)q.IsOwnScrollPositionEnabled()&&
(q.SetScrollX(q.GetScrollX()),q.SetScrollY(q.GetScrollY()))}SetVanishingPointXY(q,t){if(this._vanishingPointX!==q||this._vanishingPointY!==t)this._vanishingPointX=q,this._vanishingPointY=t,this.IsPerspectiveProjection()&&(this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetVanishingPointX(){return this.IsOrthographicProjection()?.5:this._vanishingPointX}GetVanishingPointY(){return this.IsOrthographicProjection()?.5:this._vanishingPointY}HasVanishingPointOutsideViewport(){const q=
this.GetVanishingPointX(),t=this.GetVanishingPointY();return 0>q||1<q||0>t||1<t}SetPerspectiveProjection(){this._isOrthographicProjection&&(this._isOrthographicProjection=!1,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}SetOrthographicProjection(){this._isOrthographicProjection||(this._isOrthographicProjection=!0,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}IsOrthographicProjection(){return this._isOrthographicProjection}IsPerspectiveProjection(){return!this.IsOrthographicProjection()}Set3DCameraEnabled(q){q=
!!q;this._is3dCameraEnabled!==q&&(this._is3dCameraEnabled=q,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}Is3DCameraEnabled(){return this._is3dCameraEnabled}Set3DCameraOrientation(q,t,p,r,x,y,E,H,A){m(this._cam3dposition,q,t,p)&&m(this._cam3dlook,r,x,y)&&m(this._cam3dup,E,H,A)||(d.set(this._cam3dposition,q,t,p),d.set(this._cam3dlook,r,x,y),d.set(this._cam3dup,E,H,A),this.Set3DCameraChanged())}Set3DCameraChanged(){this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Get3DCameraPosition(){return this._cam3dposition}Get3DCameraLookAt(){return this._cam3dlook}Get3DCameraUpVector(){return this._cam3dup}GetScale(){return this._scale}SetScale(q){this._scale!==
q&&(this._scale=q,this._SetAllLayersMVChanged(),this.BoundScrolling(),this._runtime.UpdateRender())}SetAngle(q){q=f.clampAngle(q);this._angle!==q&&(this._angle=q,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(q){!isFinite(q)||1>q||(this._width=q)}GetHeight(){return this._height}SetHeight(q){!isFinite(q)||1>q||(this._height=q)}GetEventSheet(){return this._eventSheet}*allLayers(){for(const q of this._rootLayers)yield*q.selfAndAllSubLayers()}GetLayers(){return this._allLayersFlat}GetLayerCount(){return this._allLayersFlat.length}GetLayer(q){return"number"===
typeof q?this.GetLayerByIndex(q):this.GetLayerByName(q.toString())}GetLayerByIndex(q){q=f.clamp(Math.floor(q),0,this._allLayersFlat.length-1);return this._allLayersFlat[q]}GetLayerByName(q){return this._layersByName.get(q.toLowerCase())||null}GetLayerBySID(q){return this._layersBySid.get(q)||null}_SetAllLayersProjectionChanged(){for(const q of this._allLayersFlat)q._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const q of this._allLayersFlat)q._SetMVMatrixChanged()}SaveTransform(){return{scrollX:this.GetScrollX(),
scrollY:this.GetScrollY(),scale:this.GetScale(),angle:this.GetAngle(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY()}}RestoreTransform(q){this.SetScrollX(q.scrollX);this.SetScrollY(q.scrollY);this.SetScale(q.scale);this.SetAngle(q.angle);this.SetVanishingPointXY(q.vpX,q.vpY)}GetLayoutBackgroundColor(){let q=this._rootLayers.filter(t=>t.ShouldDraw())[0];for(;q;){if(!q.IsTransparent())return c.copyRgb(q.GetBackgroundColor()),c.setA(1),c;if(q.UsesOwnTexture())return c.setRgba(0,0,0,0),c;
q=q.GetSubLayers().filter(t=>t.ShouldDraw())[0]}c.setRgba(0,0,0,0);return c}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(q){if(q.IsInContainer())for(const t of q.GetContainer().GetObjectTypes())this._initialObjectClasses.add(t);else this._initialObjectClasses.add(q)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(q,t){if(q===this||!t)return Promise.resolve();q&&(f.CopySet(this._textureLoadedTypes,
q._textureLoadedTypes),q._textureLoadedTypes.clear());q=[];for(const p of this._initialObjectClasses)this._textureLoadedTypes.has(p)||(q.push(p.LoadTextures(t)),this._textureLoadedTypes.add(p));return Promise.all(q)}async MaybeLoadTexturesFor(q){if(q.IsFamily())throw Error("cannot load textures for family");var t=this._runtime.GetRenderer();!t||t.IsContextLost()||this._textureLoadedTypes.has(q)||(this._textureLoadedTypes.add(q),t=q.LoadTextures(t),this._AddPendingTextureLoadPromise(t),await t,q.OnDynamicTextureLoadComplete(),
this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(q){this._textureLoadPendingPromises.add(q);q.then(()=>this._textureLoadPendingPromises.delete(q)).catch(()=>this._textureLoadPendingPromises.delete(q))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(q){if(q.IsFamily()||0<q.GetInstanceCount())throw Error("cannot unload textures");const t=this._runtime.GetRenderer();t&&this._textureLoadedTypes.has(q)&&(this._textureLoadedTypes.delete(q),
q.ReleaseTextures(t))}_Unload(q,t){if(q!==this&&t)for(const p of this._textureLoadedTypes)p.IsGlobal()||q._initialObjectClasses.has(p)||(p.ReleaseTextures(),this._textureLoadedTypes.delete(p))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(q){const t=this._runtime,p=this._layoutManager,r=t.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=r.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());p._SetMainRunningLayout(this);this._width=
this._originalWidth;this._height=this._originalHeight;this._scrollX=t.GetOriginalViewportWidth()/2;this._scrollY=t.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(q);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();p.ClearPendingChangeLayout();t.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);
const x=this._runtime.GetCreatePromises();await Promise.all(x);f.clearArray(x);if(!t.IsLoadingState()){for(const y of this._createdInstances)y.SetupInitialSceneGraphConnections();for(const y of this._createdInstances)y._TriggerOnCreated()}f.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(y=>y.PreloadTexturesWithInstances(this._runtime.GetRenderer())));q&&(t.Dispatcher().dispatchEvent(new f.Event("beforefirstlayoutstart")),await t.DispatchUserScriptEventAsyncWait(new f.Event("beforeprojectstart")));
await this.DispatchUserScriptEventAsyncWait(new f.Event("beforelayoutstart"));t.IsLoadingState()||await t.TriggerAsync(f.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new f.Event("afterlayoutstart"));q&&(t.Dispatcher().dispatchEvent(new f.Event("afterfirstlayoutstart")),await t.DispatchUserScriptEventAsyncWait(new f.Event("afterprojectstart")));r._RunQueuedTriggers(p);await this.WaitForPendingTextureLoadsToComplete();this._SetAllLayersProjectionChanged();
this._SetAllLayersMVChanged();this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(q){for(const p of this._runtime.GetAllObjectClasses())if(!p.IsFamily()&&p.IsWorldType())for(const r of p.GetInstances()){const x=r.GetWorldInfo();var t=x.GetLayer();t=f.clamp(t.GetIndex(),0,this._allLayersFlat.length-1);t=this._allLayersFlat[t];x._SetLayer(t);t._MaybeAddInstance(r)}if(!q)for(const p of this._allLayersFlat)p._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const q of this._allLayersFlat)q.CreateInitialInstances(this._createdInstances),
q.UpdateViewport(),q._Start()}_CreatePersistedInstances(){let q=!1;for(const [p,r]of Object.entries(this._persistData)){const x=this._runtime.GetObjectClassBySID(parseInt(p,10));if(x&&!x.IsFamily()&&x.HasPersistBehavior()){for(const y of r){var t=null;if(x.IsWorldType()&&(t=this.GetLayerBySID(y.w.l),!t))continue;t=this._runtime.CreateInstanceFromData(x,t,!1,0,0,!0);t.LoadFromJson(y);q=!0;this._createdInstances.push(t)}f.clearArray(r)}}for(const p of this._allLayersFlat)p._SortInstancesByLastCachedZIndex(!0),
p.SetZIndicesChanged();q&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(q){for(const p of q){if(!p.IsInContainer())continue;const r=p.GetWorldInfo(),x=p.GetIID();for(const y of p.GetObjectClass().GetContainer().objectTypes())if(y!==p.GetObjectClass()){var t=y.GetInstances();t.length>x?p._AddSibling(t[x]):(t=r?this._runtime.CreateInstanceFromData(y,r.GetLayer(),!0,r.GetX(),r.GetY(),!0):this._runtime.CreateInstanceFromData(y,null,!0,0,0,!0),
this._runtime.FlushPendingInstances(),y._UpdateIIDs(),p._AddSibling(t),q.push(t))}}}_CreateInitialNonWorldInstances(){for(const q of this._initialNonWorld)this._runtime.GetObjectClassByIndex(q[1]).IsInContainer()||this._runtime.CreateInstanceFromData(q,null,!0)}_CreateGlobalNonWorlds(){const q=[],t=this._initialNonWorld;let p=0;for(let r=0,x=t.length;r<x;++r){const y=t[r],E=this._runtime.GetObjectClassByIndex(y[1]);E.IsGlobal()?E.IsInContainer()&&E.GetContainer().HasAnyWorldType()||q.push(this._runtime.CreateInstanceFromData(y,
null,!0)):(t[p]=y,++p)}f.truncateArray(t,p);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(q)}RecreateInitialObjects(q,t,p,r,x,y){if(p)return p.RecreateInitialObjects(q,t,r,x,y);p=[];for(const E of this._allLayersFlat)p.push(E.RecreateInitialObjects(q,t,r,x,y));return p.flat()}async _StopRunning(){const q=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(f.Plugins.System.Cnds.OnLayoutEnd,null,null);q.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();
this._isFirstVisit||this._SavePersistData();for(const t of this._allLayersFlat)t._End();for(const t of this._runtime.GetAllObjectClasses())if(!(t.IsGlobal()||t.IsWorldType()||t.GetPlugin().IsSingleGlobal()||t.IsFamily())){for(const p of t.GetInstances())this._runtime.DestroyInstance(p);this._runtime.FlushPendingInstances()}q.SetIsEndingLayout(!1);q.GetMainRunningLayout()===this&&q._SetMainRunningLayout(null)}_SaveInstanceToPersist(q){const t=q.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(t)||
(this._persistData[t]=[]);this._persistData[t].push(q.SaveToJson())}_SavePersistData(){for(const q of this._allLayersFlat){q._UpdateZIndices();for(const t of q._GetInstances()){const p=t.GetObjectClass();!p.IsGlobal()&&p.HasPersistBehavior()&&this._SaveInstanceToPersist(t)}}}ResetPersistData(){this._persistData={};this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){const q=this._runtime,t=q.GetRenderer().IsWebGL();return"low"===q.GetCanvasManager().GetCurrentFullscreenScalingQuality()||
t&&q.UsesAnyBackgroundBlending()||"low-latency"===q.GetCompositingMode()||this._effectList.HasAnyActiveEffect()||t&&q.Uses3DFeatures()}Draw(q){const t=this._runtime.GetCanvasManager(),p=this.UsesOwnTexture();if(p){"low-latency"!==this._runtime.GetCompositingMode()&&(q.SetRenderTarget(null),q.ClearRgba(0,0,0,0));const r={sampling:this._runtime.GetSampling(),isSampled:q.IsWebGPU()||this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()};"low"===t.GetCurrentFullscreenScalingQuality()&&
(r.width=t.GetDrawWidth(),r.height=t.GetDrawHeight());this._curRenderTarget=this._runtime.GetAdditionalRenderTarget(r)}else this._curRenderTarget=null;q.SetRenderTarget(this._curRenderTarget);q.Clear(this.GetLayoutBackgroundColor());this._runtime.Uses3DFeatures()&&q.ClearDepth();for(const r of this._allLayersFlat)r.UpdateViewport();this._DrawLayerList(q,this._curRenderTarget,this._rootLayers,!0);p&&(q.SetDepthEnabled(!1),this._DrawLayoutOwnTextureToRenderTarget(q,this._curRenderTarget));this._curRenderTarget=
null}_DrawLayerList(q,t,p,r){p=p.filter(x=>x.ShouldDraw());for(let x=0,y=p.length;x<y;){const E=p[x];if(E.SelfAndAllSubLayersHave3DCamera()&&!E.SelfOrAnySubLayerUsesOwnTexture()){e.push(E);for(let H=x+1;H<y;++H){const A=p[H];if(A.SelfAndAllSubLayersHave3DCamera()&&!A.SelfOrAnySubLayerUsesOwnTexture())e.push(p[H]);else break}if(2<=e.length||1===e.length&&e[0].HasAnyVisibleSubLayer()){this._Draw3DLayers(q,t,e);x+=e.length;f.clearArray(e);continue}f.clearArray(e)}E.Draw(q,t,r&&0===x);++x}}_DrawLayoutOwnTextureToRenderTarget(q,
t){const p=this._effectList.GetActiveEffectTypes(),r=this._runtime;0===p.length?(q.SetRenderTarget(null),q.SetTextureFillMode(),q.CopyRenderTarget(t),q.InvalidateRenderTarget(t),r.ReleaseAdditionalRenderTarget(t)):(a.set(0,0,r.GetViewportWidth(),r.GetViewportHeight()),this.GetEffectChain().Render(q,null,{contentObject:this,blendMode:3,devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetScale(),layerAngle:this.GetAngle(),layoutRect:a,
drawSurfaceRect:null,invalidateRenderTargets:!0}))}_Draw3DLayers(q,t,p){p[0].IsTransparent()||(c.copyRgb(p[0].GetBackgroundColor()),c.setA(1),q.Clear(c));var r=this._runtime.GetCanvasManager();q.SetDepthEnabled(!0);for(var x of p)x._UpdateZIndices(),x._AppendAllInstancesIncludingSubLayersInDrawOrder(h);p=p[0];x=null;if(this._runtime.IsGPUProfiling())if(q.IsWebGL()){if(r=r.GetLayerTimingsBuffer(p))x=r.AddTimeElapsedQuery(),q.StartQuery(x)}else q.IsWebGPU()&&q.WriteTimestamp(2*(p.GetIndex()+1));for(let F=
0,J=h.length;F<J;){var y=h[F],E=y.GetWorldInfo(),H=E.GetLayer();if(E.IsVisible()&&E.IsInViewport3D(H._GetViewFrustum())){(!y.RendersToOwnZPlane()||0<E.GetDepth())&&l.push(y);var A=y.GetWorldInfo().GetTotalZElevation();g.push(y);for(r=F+1;r<J;++r){const B=h[r],I=B.GetWorldInfo();if(I.IsVisible()&&I.IsInViewport3D(I.GetLayer()._GetViewFrustum())){if(I.GetTotalZElevation()!==A)break;B.RendersToOwnZPlane()?(0<I.GetDepth()&&l.push(B),g.push(B)):l.push(B)}}if(1!==g.length||g[0].MustMitigateZFighting()){this._Draw3DLayersCoplanarInstances(q,
t,g);for(let B=0,I=l.length;B<I;++B)y=l[B],E=y.GetWorldInfo(),H=E.GetLayer(),E._SetDrawNonBackFacesOnly(!0),w(H,q),H._DrawInstanceMaybeWithEffects(y,E,q,t),E._SetDrawNonBackFacesOnly(!1)}else{w(H,q);H._DrawInstanceMaybeWithEffects(y,E,q,t);for(let B=0,I=l.length;B<I;++B)E=l[B],E!==y&&(H=E.GetWorldInfo(),A=H.GetLayer(),w(A,q),A._DrawInstanceMaybeWithEffects(E,H,q,t))}F=r;f.clearArray(g);f.clearArray(l)}else++F}x&&q.EndQuery(x);this._runtime.IsGPUProfiling()&&q.IsWebGPU()&&q.WriteTimestamp(2*(p.GetIndex()+
1)+1);f.clearArray(h);u=null}_Draw3DLayersCoplanarInstances(q,t,p){q.CoplanarStartStencilPass();for(let E=0,H=p.length;E<H;++E){var r=p[E],x=r.GetWorldInfo(),y=x.GetLayer();x._SetDrawBackFaceOnly(!0);w(y,q);y._DrawInstance(r,x,q)}q.CoplanarStartColorPass();for(let E=0,H=p.length;E<H;++E)r=p[E],x=r.GetWorldInfo(),y=x.GetLayer(),w(y,q),y._DrawInstanceMaybeWithEffects(r,x,q,t),x._SetDrawBackFaceOnly(!1);q.CoplanarRestoreStandardRendering()}_SaveToJson(){const q={sx:this.GetScrollX(),sy:this.GetScrollY(),
s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),ortho:this.IsOrthographicProjection(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(),layers:{}};for(const t of this._allLayersFlat)q.layers[t.GetSID().toString()]=t._SaveToJson();return q}_LoadFromJson(q){this._scrollX=q.sx;this._scrollY=q.sy;this._scale=q.s;this._angle=q.a;this._width=q.w;this._height=q.h;this._isOrthographicProjection=
!!q.ortho;q.hasOwnProperty("vpX")&&(this._vanishingPointX=q.vpX);q.hasOwnProperty("vpY")&&(this._vanishingPointY=q.vpY);this._isFirstVisit=!!q.fv;this._persistData=q.persist;this._effectList.LoadFromJson(q.fx);this._needsRebuildEffectChainSteps=!0;for(const [t,p]of Object.entries(q.layers))q=parseInt(t,10),(q=this.GetLayerBySID(q))&&q._LoadFromJson(p);this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged()}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(q){q.layout=
this.GetILayout();var t=this._runtime;(t=t.IsDebug()&&!t.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(q);t&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(q){q.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(q)}}}
{"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}SetAllLayerProjectionChanged(){const b=this.GetMainRunningLayout();b&&b._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const b=this.GetMainRunningLayout();b&&b._SetAllLayersMVChanged()}}}
{"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._markedForRemovalTimelines=[];this._isTickingTimelines=this._changingLayout=this._hasRuntimeListeners=!1;
this._tickFunc=()=>this._OnTick();this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=c=>this._OnInstanceDestroy(c.instance);this._afterLoad=c=>this._OnAfterLoad();this._destroyedWhileLoadingState=[];this._renderChange=0}Release(){this.RemoveRuntimeListeners();this._afterLoad=this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const a of this._timelines)a.Stop(),
a.Release();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;f.clearArray(this._markedForRemovalTimelines);this._markedForRemovalTimelines=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 c=this.GetTimelineDataManager();a=a.GetTemplateName();c=c.Get(a);c=f.TimelineState.CreateFromTemplate(`${a}:${this._timelinesCreatedByTemplate.get(a)}`,c,this);this._IncreaseTemplateTimelinesCount(a);this.Add(c);return c}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const c=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(c)}}_ClearCreatedTemplateTimelinesCount(){for(const a of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(a,
0)}Add(a){this._timelines.push(a);this._timelinesByName.set(a.GetName().toLowerCase(),a)}Remove(a){a.Removed();a.IsTemplate()||(f.arrayFindRemove(this._timelines,a),f.arrayFindRemove(this._scheduledTimelines,a),f.arrayFindRemove(this._playingTimelines,a),f.arrayFindRemove(this._markedForRemovalTimelines,a),this._timelinesByName.delete(a.GetName().toLowerCase()),this.RemoveTimelineFromObjectClassMap(a),a.IsReleased()||a.Release())}Trigger(a){this._runtime.Trigger(a,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(a){this._pluginInstance=
a}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const a of this._timelines)yield a}SetTimelineObjectClassToMap(a,c){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set);this._objectClassToTimelineMap.get(a).add(c)}SetTimelineObjectClassesToMap(a){for(const c of a.GetObjectClasses())this.SetTimelineObjectClassToMap(c,a)}RemoveTimelineFromObjectClassMap(a){for(const [c,d]of this._objectClassToTimelineMap.entries())d.has(a)&&(d.delete(a),0===d.size&&
this._objectClassToTimelineMap.delete(c))}GetTimelinesForObjectClass(a){if(this._objectClassToTimelineMap.has(a))return this._objectClassToTimelineMap.get(a)}GetTimelineOfTemplateForInstances(a,c){if(c)for(const d of this._timelines)if(c.every(e=>d.HasTrackInstance(e.instance,e.trackId))&&d.GetName().includes(a.GetName()))return d}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const c of this._scheduledTimelines)if(c.GetName()===
a)return c;for(const c of this._playingTimelines)if(c.GetName()===a)return c;return null}*GetTimelinesByName(a){if(b.test(a)){b.lastIndex=0;let d;var c=new Set;do if(d=b.exec(a)){const e=d[1].split(",");for(const h of e)c.add(h)}while(d);for(const e of c.values())(a=this.GetTimelineByName(e))&&(yield a);c.clear()}else(c=this.GetTimelineByName(a))&&(yield c)}*GetTimelinesByTags(a){for(const c of this._timelines)c.HasTags(a)&&(yield c)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a);
this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){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);this._markedForRemovalTimelines.push(a);f.arrayFindRemove(this._playingTimelines,a)}CompleteTimelineBeforeChangeOfLayout(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!1);a.SetPlaybackRate(1);f.arrayFindRemove(this._playingTimelines,a)}CompleteTimelineAndResolve(a){this.CompleteTimeline(a);a.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&&
this._hasRuntimeListeners&&!this._changingLayout){for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var a=this._scheduledTimelines.pop();a.SetInitialState();0!==a.GetRenderChange()&&(this._renderChange=1);this._playingTimelines.push(a)}a=this._runtime._GetDtFast();var c=this._runtime.GetDt1(),d=this._runtime.GetTimeScale();for(let e=this._playingTimelines.length-1;0<=e;e--)this._playingTimelines[e].Tick(a,d,c);this._isTickingTimelines=!1;0!==this._renderChange&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&
this._hasRuntimeListeners&&!this._changingLayout){var a;for(let c=0,d=this._markedForRemovalTimelines.length;c<d;c++){const e=this._markedForRemovalTimelines[c];a||(a=new Set);e.Removed();this._MaybeExecuteTimelineFinishTriggers(e);a.add(e)}if(a){f.arrayRemoveAllInSet(this._markedForRemovalTimelines,a);this._renderChange=0;for(let c=0,d=this._playingTimelines.length;c<d;c++)if(0!==this._playingTimelines[c].GetRenderChange()){this._renderChange=1;break}}this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(a){a.IsReleased()||
a.HasValidTracks()&&a.IsComplete()&&a.InitialStateSet()&&a.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._markedForRemovalTimelines.length||this._playingTimelines.length||this._scheduledTimelines.length||this._isTickingTimelines||(this._hasRuntimeListeners=!1)}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop());const a=
new Set;for(const c of this._playingTimelines)c._OnBeforeChangeLayout()&&(c.Removed(),a.add(c));f.arrayRemoveAllInSet(this._playingTimelines,a);a.clear();for(const c of this._markedForRemovalTimelines)c._OnBeforeChangeLayout()&&(c.Removed(),a.add(c));f.arrayRemoveAllInSet(this._markedForRemovalTimelines,a);this._MaybeDisableRuntimeListeners();for(const c of this._timelines)c.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(a){var c=a.GetObjectClass();if(c=this.GetTimelinesForObjectClass(c))if(this._runtime.IsLoadingState())this._destroyedWhileLoadingState.push(a);
else for(const d of c)d.IsTemplate()||(d.IsReleased()?this.Remove(d):d.HasValidTracks()||(this._MaybeExecuteTimelineFinishTriggers(d),this.Remove(d)))}_OnAfterLoad(){for(const a of this._destroyedWhileLoadingState)this._OnInstanceDestroy(a);f.clearArray(this._destroyedWhileLoadingState)}_SaveToJson(){return{timelinesJson:this._SaveTimelinesToJson(),scheduledTimelinesJson:this._SaveScheduledTimelinesToJson(),playingTimelinesJson:this._SavePlayingTimelinesToJson(),markedForRemovalTimelinesJson:this._SaveMarkedForRemovalTimelinesToJson(),
hasRuntimeListeners:this._hasRuntimeListeners,changingLayout:this._changingLayout,isTickingTimelines:this._isTickingTimelines}}_LoadFromJson(a){a&&(this._ClearCreatedTemplateTimelinesCount(),this._LoadTimelinesFromJson(a.timelinesJson),this._LoadScheduledTimelinesFromJson(a.scheduledTimelinesJson),this._LoadPlayingTimelinesFromJson(a.playingTimelinesJson),this._LoadMarkedForRemovalTimelinesFromJson(a.markedForRemovalTimelinesJson),this._hasRuntimeListeners=!a.hasRuntimeListeners,this._changingLayout=
!!a.changingLayout,this._isTickingTimelines=!!a.isTickingTimelines,this._SetCreatedTemplateTimelinesCount(),this._MaybeEnableRuntimeListeners(),this._MaybeDisableRuntimeListeners())}_SaveTimelinesToJson(){return this._timelines.map(a=>a._SaveToJson())}_LoadTimelinesFromJson(a){for(const c of a){a=this.GetTimelineByName(c.name);if(!a){a=this._GetTemplateNameFromJson(c);if(!a)continue;a=this.GetTimelineByName(a);a=this.CreateFromTemplate(a)}a._LoadFromJson(c);a.HasTracks()||this.Remove(a)}}_GetTemplateNameFromJson(a){return(a=
a.name.split(":"))&&2===a.length?a[0]:null}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(a){this._LoadTimelines(a,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(a){this._LoadTimelines(a,this._playingTimelines)}_SaveMarkedForRemovalTimelinesToJson(){return this._SaveTimelines(this._markedForRemovalTimelines)}_LoadMarkedForRemovalTimelinesFromJson(a){this._LoadTimelines(a,
this._markedForRemovalTimelines)}_IsTimelineInJson(a,c){for(const d of c)if(d===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map(c=>c.GetName())}_LoadTimelines(a,c){var d=new Set;for(const e of c)this._IsTimelineInJson(e,a)||d.add(e);f.arrayRemoveAllInSet(c,d);d=e=>h=>h.GetName()===e;for(const e of a)(a=this.GetTimelineByName(e))&&(c.find(d(e))||c.push(a))}}}
{"use strict";const f=self.C3;f.TimelineState=class extends f.DefendedBase{constructor(b,a,c){super();this._runtime=c.GetRuntime();this._timelineManager=c;this._timelineDataItem=a;this._name=b;this._tracks=[];this._tracksLength=0;this._beforeAndAfterTracks=null;this._beforeAndAfterTracksLength=0;this.CreateTrackStates();this._playResolve=this._playPromise=null;this._playheadTime=0;this._playbackRate=1;this._pingPongState=0;this._currentRepeatCount=1;this._initialStateSet=this._isScheduled=this._isPlaying=
!1;this._complete=!0;this._markedForRemoval=this._released=!1;this._completedTick=-1;this._firstTick=this._finishedTriggers=this._isTemplate=this._implicitPause=!1;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=!1;this._hasNestedContent=this._renderChange=0}static CreateInitial(b,a){var c=a.GetTimelineDataManager();const d=c.GetNameId();c=c.Get(b[d]);b=f.New(f.TimelineState,b[d],c,a);b.SetIsTemplate(!0);return b}static CreateFromTemplate(b,a,c){return f.New(f.TimelineState,
b,a,c)}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._timelineDataItem=this._timelineManager=this._runtime=this._tracks=null;this._released=!0;this._playResolve=this._playPromise=null}}CreateTrackStates(){for(const b of this._timelineDataItem.GetTrackData().trackDataItems())this._tracksLength=this._tracks.push(f.TrackState.Create(this,b))}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(b,
a,c){if(this._hasNestedContent){var d;for(let h=0;h<this._tracks.length;h++){var e=this._tracks[h];b===e.GetInstance()&&(e=e.GetPropertyTrack(c))&&a.constructor===e.GetSourceAdapter().constructor&&(d||(d=[]),d.push(e))}return d}}HasTracks(){return!!this._tracks.length}GetTrackById(b){for(const a of this._tracks)if(f.equalsNoCase(a.GetId(),b))return a;return null}GetTrackByName(b){for(const a of this._tracks)if(!a.IsInstanceTrack()&&f.equalsNoCase(a.GetName(),b))return a;return null}SetName(b){this._name=
b}GetName(){return this._name}GetTimelineDataItem(){return this._timelineDataItem}GetTemplateName(){return this._timelineDataItem.GetName()}GetTotalTime(){return this._timelineDataItem.GetTotalTime()}SetTotalTime(b){this._timelineDataItem.SetTotalTime(b)}GetStep(){return this._timelineDataItem.GetStep()}SetStep(b){this._timelineDataItem.SetStep(b)}GetInterpolationMode(){return this._timelineDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._timelineDataItem.SetInterpolationMode(b)}GetResultMode(){return this._timelineDataItem.GetResultMode()}SetResultMode(b){this._timelineDataItem.GetResultMode(b)}SetEase(b){for(const a of this.GetTracks())a.SetEase(b)}GetLoop(){return this._timelineDataItem.GetLoop()}SetLoop(b){return this._timelineDataItem.SetLoop(b)}GetPingPong(){return this._timelineDataItem.GetPingPong()}SetPingPong(b){return this._timelineDataItem.SetPingPong(b)}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(b){return this._playbackRate=
b}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return this.IsPlaying()?0<this._playbackRate:!0}GetPlayPromise(){return this._playPromise?this._playPromise:this._playPromise=new Promise(b=>{this._playResolve=b})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(b){this._tags=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}SetTime(b){const a=
this.GetTime();this._SetTime(b);this.SetComplete(!1);this.IsComplete()||this.SetImplicitPause(!0);if(this._IsPlaying()||this.IsScheduled()||!this._initialStateSet)this._IsPlaying()||this.IsScheduled()||this._initialStateSet?this._IsPlaying()?this.Stop():this.IsScheduled()&&(this._timelineManager.DeScheduleTimeline(this),this.SetInitialStateFromSetTime()):this.SetInitialStateFromSetTime();this._SetUpdateStateBefore();this._Interpolate(b,!1,!0,!0,a);this._SetUpdateStateAfter();this._renderChange&&this.GetRuntime().UpdateRender();
this._OnSetTime()}_SetTime(b){0>b?this._playheadTime=0:b>=this.GetTotalTime()?this._playheadTime=this.GetTotalTime():this._playheadTime=b}_OnSetTime(){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 c=this.GetTime();this._SetUpdateStateBefore();a?this._InterpolateBeforeChangeLayout(c):this._Interpolate(c,!1,!1,!0);b&&this._OnSetTime();this._SetUpdateStateAfter();this._renderChange&&b&&this.GetRuntime().UpdateRender()}}}ResetBeforeChangeLayout(){this.Reset(!1,
!0)}_InterpolateBeforeChangeLayout(b){this._Interpolate(b,!1,!1,!0,NaN,!1,!0)}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(this.HasValidGlobalTracks())return!1;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(b){if(!this.IsMarkedForRemoval()){if(b){this._firstTick=this._initialStateSet=!0;this._SetUpdateStateBefore();for(const a of this._tracks)a.SetInitialState()}else if(this.SetPlaying(!0),
this.SetScheduled(!1),this.OnStarted(),this.IsComplete()){this._completedTick=-1;this._pingPongState=0;this._currentRepeatCount=1;this._finishedTriggers=this._complete=!1;this._firstTick=this._initialStateSet=!0;this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());this._SetUpdateStateBefore();for(const a of this._tracks)a.SetInitialState()}else{this._firstTick=!0;this._SetUpdateStateBefore();for(const a of this._tracks)a.SetResumeState()}this._SetUpdateStateAfter()}}GetRenderChange(){return this._renderChange}_SetUpdateStateBefore(){this._hasNestedContent=
0;for(const b of this._tracks)b.IsNested()&&(this._hasNestedContent=1)}_SetUpdateStateAfter(){this._renderChange=0;for(const b of this._tracks)b._SetUpdateState(),0===this._renderChange&&1===b.GetRenderChange()&&(this._renderChange=1),this._beforeAndAfterTracks||1!==b.GetNeedsBeforeAndAfter()||(this._beforeAndAfterTracks||(this._beforeAndAfterTracks=[]),this._beforeAndAfterTracksLength=this._beforeAndAfterTracks.push(b))}Tick(b,a,c){if(0!==b||0!==this._lastDelta){this._lastDelta=b;c=this._playheadTime;
a=c+b*a*this._playbackRate;b=this._timelineDataItem._totalTime;this._playheadTime=0>a?0:a>=b?b:a;var d=!1;a=this.GetLoop();var e=this.GetPingPong();a||e?a&&!e?0<this._playbackRate?this._playheadTime>=b&&this._SetTime(0):0>=this._playheadTime&&this._SetTime(b):!a&&e?0<this._playbackRate?this._playheadTime>=b&&(this._SetTime(b),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):d=!0:
0===this._pingPongState&&(this._pingPongState=1)):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):d=!0:0===this._pingPongState&&(this._pingPongState=1)):a&&e&&(0<this._playbackRate?this._playheadTime>=b&&(this._SetTime(b),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()))):
0<this._playbackRate?this._playheadTime>=b&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTime(0)):(this._SetTime(b),d=!0)):0>=this._playheadTime&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTime(b)):(this._SetTime(0),d=!0));a=this._tracksLength;if(d){for(d=0;d<a;d++)this._tracks[d].SetEndState();this.Stop(!0);this.OnCompleted()}else{e=this._beforeAndAfterTracksLength;for(d=0;d<e;d++)this._beforeAndAfterTracks[d].BeforeInterpolate();
if(1===this._hasNestedContent)for(d=0;d<a;d++){const h=this._tracks[d],g=h.GetStartOffset(),l=c-g;0>this._playheadTime-g&&0<l?(this._playheadTime=0>g?0:g>=b?b:g,h.Interpolate(g,!0,!1,!1,this._firstTick,!1)):h.Interpolate(this._playheadTime,!0,!1,!1,this._firstTick,!1)}else for(d=0;d<a;d++)this._tracks[d].Interpolate(this._playheadTime,!0,!1,!1,this._firstTick,!1);for(d=0;d<e;d++)this._beforeAndAfterTracks[d].AfterInterpolate();this._firstTick&&(this._firstTick=!1)}}}_Interpolate(b,a=!1,c=!1,d=!1,
e=NaN,h=!1,g=!1){for(var l of this._tracks)l.BeforeInterpolate();for(const m of this._tracks){l=b;if("number"===typeof e){const u=this.GetTime()-m.GetStartOffset(),w=e-m.GetStartOffset();0>u&&0<w&&(l=m.GetStartOffset(),this._SetTime(l))}m.Interpolate(l,a,c,d,this._firstTick,g)}for(const m of this._tracks)m.AfterInterpolate();this._firstTick&&h&&(this._firstTick=!1)}AddTrack(){var b=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();b=f.TrackState.Create(this,b);this._tracksLength=this._tracks.push(b);
return b}Removed(){if(!this.IsReleased())for(const b of this._tracks)b.TimelineRemoved()}CleanCaches(){for(const b of this._tracks)b.CleanCaches()}ClearTrackInstances(){for(const b of this._tracks)b.ClearInstance()}SetTrackInstance(b,a){if(a)for(const c of this._tracks)if(c.IsInstanceTrack()){if(b){if(c.GetId()!==b)continue}else if(c.HasInstance())continue;c.SetInstance(a);this._timelineManager.SetTimelineObjectClassToMap(a.GetObjectClass(),this);break}}HasTrackInstance(b,a){for(const c of this._tracks)if(c.IsInstanceTrack())if(a){if(a===
c.GetId()&&b===c.GetInstance())return!0}else if(b===c.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some(b=>b.IsInstanceTrack()?b.CanInstanceBeValid():!0)}HasValidGlobalTracks(){return this._tracks.some(b=>b.IsInstanceTrack()?b.CanInstanceBeValid()?(b=b.GetObjectClass())?b.IsGlobal():!1:!1:!1)}GetPropertyTrack(b){for(const a of this.GetTracks())for(const c of a.GetPropertyTracks())if(c.GetPropertyName()===b)return c}GetTrackFromInstance(b){for(const a of this._tracks)if(b===
a.GetInstance())return a;return null}GetKeyframeWithTags(b){b=b?b.split(" "):[];b=[...(new Set(b.map(a=>a.toLowerCase().trim()))).values()];for(const a of this.GetTracks())for(const c of a.GetKeyframeDataItems())if(b.every(d=>c.HasTag(d)))return c}GetObjectClasses(){const b=[];for(const a of this.GetTracks())b.push(a.GetObjectClass());return b.filter(a=>a)}_SaveToJson(){return{tracksJson:this._SaveTracksToJson(),name:this._name,playheadTime:this.GetTime(),playbackRate:this._playbackRate,pingPongState:this._pingPongState,
currentRepeatCount:this._currentRepeatCount,isPlaying:this._isPlaying,isScheduled:this._isScheduled,initialStateSet:this._initialStateSet,finishedTriggers:this._finishedTriggers,complete:this._complete,released:this._released,markedForRemoval:this._markedForRemoval,completedTick:this._completedTick,implicitPause:this._implicitPause,isTemplate:this._isTemplate,tags:this._tags.join(" "),stringTags:this._stringTags,tagsChanged:this._tagsChanged,firstTick:this._firstTick}}_LoadFromJson(b){b&&(this._LoadTracksFromJson(b.tracksJson),
this._name=b.name,this._playheadTime=b.playheadTime,this._playbackRate=b.playbackRate,this._pingPongState=b.pingPongState,this._currentRepeatCount=b.currentRepeatCount,this._isPlaying=!!b.isPlaying,this._isScheduled=!!b.isScheduled,this._initialStateSet=!!b.initialStateSet,this._finishedTriggers=b.hasOwnProperty("finishedTriggers")?!!b.finishedTriggers:!1,this._complete=!!b.complete,this._released=!!b.released,this._markedForRemoval=!!b.markedForRemoval,this._completedTick=b.completedTick,this._implicitPause=
!!b.implicitPause,this._isTemplate=!!b.isTemplate,this._tags=b.tags.split(" "),this._stringTags=b.stringTags,this._tagsChanged=!!b.tagsChanged,this._firstTick=!!b.firstTick)}_SaveTracksToJson(){return this._tracks.map(b=>b._SaveToJson())}_LoadTracksFromJson(b){b.forEach((a,c)=>{this._tracks[c]._LoadFromJson(a)});this._tracks.filter(a=>a.CanInstanceBeValid())}static _HasTag(b){const a=this.GetTags();return""===b?1===a.length&&""===a[0]:a.includes(b)}static _GetTagArray(b){if(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=[];this.CreatePropertyTrackStates();
this._needsBeforeAndAfter=this._renderChange=this._worldInfoChange=0}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}CreatePropertyTrackStates(){for(const b of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(f.PropertyTrackState.Create(this,
b))}TimelineRemoved(){for(const b of this._propertyTracks)b.TimelineRemoved()}CleanCaches(){for(const b of this._propertyTracks)b.CleanCaches();this._worldInfo=this._instance=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){return this._keyframeDataItems?this._keyframeDataItems:this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(b){for(let a=
0;a<this._propertyTracks.length;a++){const c=this._propertyTracks[a];if(c.GetPropertyName()===b)return c}}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){if(!this.IsInstanceTrack())return!1;var b=this.GetInstanceUID();return(b=this.GetRuntime().GetInstanceByUID(b))?!b.IsDestroyed():!1}GetObjectClass(){if(this.IsInstanceTrack()){var b=this.GetObjectClassIndex();if(-1!==b)return this.GetRuntime().GetObjectClassByIndex(b)}}ClearInstance(){this._instance=
null;this._instanceUid=-1;this._worldInfo=null;this._objectClassIndex=-1}HasInstance(){return!!this._instance}GetInstance(){if(this._instance&&this.IsInstanceValid())return this._instance;const b=this.GetInstanceUID();return this._instance=this.GetRuntime().GetInstanceByUID(b)}SetInstance(b){if(this._instance!==b){this.CleanCaches();this._instance=b;this._objectClassIndex=b.GetObjectClass().GetIndex();this._instanceUid=b.GetUID();this._worldInfo=b.GetWorldInfo();for(const h of this.propertyTrackItems()){const g=
h.sourceAdapter;switch(h.propertyTrack.GetSourceAdapterId()){case "instance-variable":g.GetEditorIndex();var a=b.GetObjectClass(),c=a.GetInstanceVariableIndexByName(h.name),d=a.GetInstanceVariableName(c);a=a.GetInstanceVariableType(c);d===h.name&&a===h.type&&g.UpdateInstanceVariableIndex(c);break;case "behavior":var e=h.behaviorType;c=this.GetObjectClass();d=b.GetObjectClass();a=g.GetBehaviorType(d);e&&a&&(e=e.GetName(),c.GetBehaviorIndexByName(e),d.GetBehaviorIndexByName(e),g.GetEditorIndex(),g.UpdateBehaviorTypeSid(a.GetSID()))}}}}*propertyTrackItems(){for(const c of this._propertyTracks){var b=
c.GetSourceAdapter(),a=this.GetObjectClass();const d={propertyTrack:c,sourceAdapter:b};switch(c.GetSourceAdapterId()){case "world-instance":d.property=c.GetPropertyName();break;case "instance-variable":b=b.GetEditorIndex();d.name=a.GetInstanceVariableName(b);d.type=a.GetInstanceVariableType(b);break;case "effect":a=a.GetEffectList();b=b.GetEffectType(a);d.effectType=b;break;case "behavior":b=b.GetBehaviorType(a);d.behaviorType=b;break;case "plugin":d.plugin=a.GetPlugin()}yield d}}GetWorldInfo(){if(this._worldInfo&&
this.IsInstanceValid())return this._worldInfo;const b=this.GetInstance();b&&(this._worldInfo=b.GetWorldInfo());return this._worldInfo}GetTrackDataItem(){return this._trackDataItem}GetInstanceUID(){return this._instanceUid?this._instanceUid:this._trackDataItem.GetInstanceUID()}SetInstanceUID(b){this._trackDataItem.SetInstanceUID(b)}GetInterpolationMode(){return this._trackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._trackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._trackDataItem.GetResultMode()}GetId(){return this._trackDataItem.GetId()}GetStartOffset(){return this._trackDataItem.GetStartOffset()}GetLocalTotalTime(){return this._trackDataItem.GetLocalTotalTime()}SetLocalTotalTime(b){this._trackDataItem.SetLocalTotalTime(b)}SetResultMode(b){this._trackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetKeyframeDataItems())a.SetEase(b);
for(const a of this.GetPropertyTracks())a.SetEase(b)}GetEnable(){return this._trackDataItem.GetEnable()}SetEnable(b){this._trackDataItem.SetEnable(b)}GetObjectClassIndex(){return isNaN(this._objectClassIndex)?this._trackDataItem.GetObjectClassIndex():this._objectClassIndex}SetObjectClassIndex(b){this._trackDataItem.SetObjectClassIndex(b)}SetOriginalWidth(b){this._trackDataItem.SetOriginalWidth(b)}GetOriginalWidth(){const b=this.GetInstance();return b&&b.GetSdkInstance().IsOriginalSizeKnown()?b.GetSdkInstance().GetOriginalWidth():
this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(b){this._trackDataItem.SetOriginalHeight(b)}GetOriginalHeight(){const b=this.GetInstance();return b&&b.GetSdkInstance().IsOriginalSizeKnown()?b.GetSdkInstance().GetOriginalHeight():this._trackDataItem.GetOriginalHeight()}GetType(){return this._trackDataItem.GetType()}GetName(){return this._trackDataItem.GetName()}IsInstanceTrack(){return 0===this.GetType()}IsValueTrack(){return 1===this.GetType()}IsAudioTrack(){return 2===this.GetType()}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}IsNested(){return this._isNested}SetInitialState(){this.MaybeGetInstance();
if(this.IsInstanceValid()||!this.IsInstanceTrack()){var b=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();for(const a of this._propertyTracks)a.SetInitialState(b),0===this._worldInfoChange&&1===a.GetWorldInfoChange()&&(this._worldInfoChange=1),0===this._renderChange&&1===a.GetRenderChange()&&(this._renderChange=1);this._needsBeforeAndAfter=0;this._propertyTracks.some(a=>a.GetNeedsBeforeAndAfter())&&(this._needsBeforeAndAfter=1);this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(b);
this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(b)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack()){this._timeline.IsForwardPlayBack();var b=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(b);for(const a of this._propertyTracks)a.SetResumeState(b)}}SetEndState(){if(!(this.GetTimeline().IsComplete()||(this.MaybeGetInstance(),!this.IsInstanceValid()&&this.IsInstanceTrack()||
this._isNested))){const b=this._timeline.GetTime(),a=this.GetStartOffset()+this.GetLocalTotalTime();b>=a?this.Interpolate(this.GetLocalTotalTime(),!0,!1,!0):0>=b&&this.Interpolate(0,!0,!1,!0)}}_SetUpdateState(){for(let b=0,a=this._propertyTracks.length;b<a;b++){const c=this._propertyTracks[b];c._SetUpdateState();0===this._worldInfoChange&&1===c.GetWorldInfoChange()&&(this._worldInfoChange=1);0===this._renderChange&&1===c.GetRenderChange()&&(this._renderChange=1)}}BeforeInterpolate(){const b=this._propertyTracks.length;
for(let a=0;a<b;a++)this._propertyTracks[a].BeforeInterpolate()}Interpolate(b,a=!1,c=!1,d=!1,e=!1,h=!1){this._instance||this.GetInstance();const g=this._instance&&!this._instance.IsDestroyed(),l=0===this._trackDataItem._type;if(!(!g&&l||h&&l&&this.GetObjectClass().IsGlobal()||(b-=this.GetStartOffset(),0>b))){this.MaybeSetInitialStateOfNestedTrack(b,a);this.MaybeTriggerKeyframeReachedConditions(b,a,e);for(let m=0,u=this._propertyTracks.length;m<u;m++)this._propertyTracks[m].Interpolate(b,c,d);this.MaybeSetEndStateOfNestedTrack(b,
a);0!==this._worldInfoChange&&(this._worldInfo||(this._worldInfo=this._instance.GetWorldInfo()),this._worldInfo&&this._worldInfo.SetBboxChanged())}}AfterInterpolate(){const b=this._propertyTracks.length;for(let a=0;a<b;a++)this._propertyTracks[a].AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>b)return;for(const c of this._propertyTracks)c.Interpolate(0,!1,!0)}else{if(b>this.GetLocalTotalTime())return;
for(const c of this._propertyTracks)c.Interpolate(this.GetLocalTotalTime(),!1,!0)}for(const c of this._propertyTracks)c.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(b>=this.GetLocalTotalTime()){for(const c of this._propertyTracks)c.Interpolate(this.GetLocalTotalTime(),!1,!0);this._endStateOfNestedSet=!0}}else if(0>=b){for(const c of this._propertyTracks)c.Interpolate(0,
!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(b,a,c){if(!c&&a&&f.Plugins.Timeline){a=this.GetTimeline();c=this._lastKeyframeDataItem.GetNext();var d=this._lastKeyframeDataItem.GetTime(),e=c?c.GetTime():a.GetTotalTime();if(b<=d||b>=e)this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem),a.IsForwardPlayBack()?c&&this.OnKeyframeReached(this._lastKeyframeDataItem):this._lastKeyframeDataItem.GetNext()&&this.OnKeyframeReached(this._lastKeyframeDataItem)}}_GetLastKeyFrameBeforeTime(b){const a=
this._trackData.GetKeyFrameDataItemAtTime(b,this._trackDataItem);return a?a:this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem)}OnKeyframeReached(b){const a=this.GetTimeline();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()||!this.IsInstanceTrack())for(const b of this._propertyTracks)b.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();
if(this.IsInstanceValid()||!this.IsInstanceTrack()){var b=!1;for(const a of this._propertyTracks){const c=a.CompareSaveStateWithCurrent();!b&&c&&(b=!0)}b&&(b=this.AddKeyframe(),b.SetTime(this.GetTimeline().GetTime()),b.SetEase("noease"),b.SetEnable(!0),b.SetTags(""))}}_SaveToJson(){var b=this.GetInstance();b=b?b.GetUID():this.GetInstanceUID();return{propertyTracksJson:this._SavePropertyTracksToJson(),lastKeyframeDataItemJson:this._SaveLastKeyframeDataItemToJson(),initialStateOfNestedSet:this._initialStateOfNestedSet,
endStateOfNestedSet:this._endStateOfNestedSet,instanceUid:b}}_LoadFromJson(b){b&&(this._LoadPropertyTracksFromJson(b.propertyTracksJson),this._LoadLastKeyframeDataItemFromJson(b.lastKeyframeDataItemJson),this._LoadInstanceFromJson(b.instanceUid),this._initialStateOfNestedSet=!1,b.hasOwnProperty.initialStateOfNestedSet&&(this._initialStateOfNestedSet=b.initialStateOfNestedSet),this._endStateOfNestedSet=!1,b.hasOwnProperty.endStateOfNestedSet&&(this._endStateOfNestedSet=b.endStateOfNestedSet))}_SaveLastKeyframeDataItemToJson(){return this._trackDataItem.GetKeyframeData().GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(b=>
b._SaveToJson())}_LoadPropertyTracksFromJson(b){b.forEach((a,c)=>{this._propertyTracks[c]._LoadFromJson(a)})}_LoadInstanceFromJson(b){if(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._needsBeforeAndAfter=this._renderChange=this._worldInfoChange=0;this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();this._absoluteValueObject=this._lastPropertyKeyframeDataItem=null}static Create(b,
a){return 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}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}HasAbsoluteValueObject(){return!!this._absoluteValueObject}SetAbsoluteValueObject(b){this._absoluteValueObject=b}GetAbsoluteValueObject(){return this._absoluteValueObject}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;
let b;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":b=new f.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":b=new f.PropertyTrackState.EffectSourceAdapter(this);this._renderChange=1;break;case "instance-variable":b=new f.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":b=new f.PropertyTrackState.PluginSourceAdapter(this);this._renderChange=1;break;case "world-instance":b=new f.PropertyTrackState.PropertySourceAdapter(this);this._worldInfoChange=
this._renderChange=1;break;case "value":b=new f.PropertyTrackState.ValueSourceAdapter(this);break;case "audio":b=new f.PropertyTrackState.AudioSourceAdapter(this)}return this._sourceAdapter=b}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(b){this._propertyTrackDataItem.SetSourceAdapterId(b)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(b){this._propertyTrackDataItem.SetSourceAdapterArguments(b)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(b){this._propertyTrackDataItem.SetProperty(b)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(b){this._propertyTrackDataItem.SetType(b)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(b){this._propertyTrackDataItem.SetMin(b)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(b){this._propertyTrackDataItem.SetMax(b)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(b){this._propertyTrackDataItem.SetEnable(b)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._propertyTrackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(b){this._propertyTrackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetPropertyKeyframeDataItems())a.SetEase(b)}CanHavePropertyKeyframes(){return this._propertyTrackDataItem.CanHavePropertyKeyframes()}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems?
this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const b of this.GetPropertyKeyframeDataItems())yield b.GetValueWithResultMode()}TimelineRemoved(){this.GetSourceAdapter().TimelineRemoved()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(b){this.GetSourceAdapter().SetInitialState();
this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(b);this._SetUpdateState()}SetResumeState(b){this.GetSourceAdapter().SetResumeState();this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(b)}_SetUpdateState(){var b=this.GetTrack();this._needsBeforeAndAfter=0;if(b.IsInstanceTrack()){var a=this.GetTimeline();b=b.GetInstance();const c=this.GetSourceAdapter(),d=this.GetPropertyName();c.MayNeedBeforeAndAfterInterpolate()?(a=a.GetSimilarPropertyTracks(b,c,
d))&&a.length&&(this._needsBeforeAndAfter=1):this._needsBeforeAndAfter=0}}_GetLastPropertyKeyFrameBeforeTime(b){const a=this.GetTimeline(),c=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(b,this._propertyTrackDataItem);return c?c:a.IsForwardPlayBack()?this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem):this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,this._propertyTrackDataItem)}BeforeInterpolate(){this._sourceAdapter.BeforeInterpolate()}Interpolate(b,
a=!1,c=!1){let d;if(a)var e=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){var h=this.GetTimeline();const g=this._lastPropertyKeyframeDataItem.GetNext();e=this._lastPropertyKeyframeDataItem.GetTime();h=g?g.GetTime():h.GetTotalTime();if(b<=e||b>=h)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=
this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);e=this._lastPropertyKeyframeDataItem}e&&(d=e.GetNext());this._sourceAdapter.Interpolate(b,e,d,a,c)}GetInterpolatedValue(b){if(this._lastPropertyKeyframeDataItem){var a=this.GetTimeline();const d=this._lastPropertyKeyframeDataItem.GetNext();var c=this._lastPropertyKeyframeDataItem.GetTime();a=d?d.GetTime():a.GetTotalTime();if(b<=c||b>=a)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,
this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);c=this._lastPropertyKeyframeDataItem;a=c.GetNext();return this._sourceAdapter.GetInterpolatedValue(b,c,a)}AfterInterpolate(){this._sourceAdapter.AfterInterpolate()}static GetStartPropertyKeyframeForTime(b,a){const c=a.GetPropertyTrackDataItem();return a._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,c)}static GetEndPropertyKeyframeForTime(b,
a){const c=a.GetPropertyTrackDataItem();return a._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,c)}AddPropertyKeyframe(){const b=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;return b}DeletePropertyKeyframes(b){this._lastPropertyKeyframeDataItem=null;this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){if(this.GetSourceAdapter().CompareInitialStateWithCurrent()){const b=
this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),a=this.GetSourceAdapter().GetCurrentState();b.SetAbsoluteValue(a)}}CompareSaveStateWithCurrent(){const b=this.GetSourceAdapter().CompareSaveStateWithCurrent();b&&this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return b}AddPropertyKeyframeAtCurrentTime(){const b=this.GetTimeline().GetTime(),a=this.GetSourceAdapter(),c=f.PropertyTrackState.GetStartPropertyKeyframeForTime(b,this),d=
this.AddPropertyKeyframe();d.SetType(c.GetType());d.SetTime(b);d.SetEase(c.GetEase());d.SetEnable(!0);d.SetValue(a.GetValueAtTime());d.SetAbsoluteValue(a.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson)}}}
{"use strict";const f=self.C3.PropertyTrackState;f.PropertySourceAdapter=class{constructor(b){this._propertyTrack=b;this._propertyAdapter=null;this.GetPropertyAdapter()}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}MayNeedBeforeAndAfterInterpolate(){return this._propertyAdapter.MayNeedBeforeAndAfterInterpolate()}GetPropertyTrack(){return this._propertyTrack}TimelineRemoved(){this._propertyAdapter&&this._propertyAdapter.TimelineRemoved()}CleanCaches(){this._propertyAdapter&&
this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter?this._propertyAdapter:this._propertyAdapter=this._CreatePropertyAdapter()}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this._propertyAdapter.BeforeChangeProperty()}Interpolate(b,a,c,d,e){let h;switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":h=
f.NumericTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "angle":h=f.AngleTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "boolean":h=f.BooleanTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "color":h=f.ColorTypeAdapter.Interpolate(b,a,c,this._propertyTrack);break;case "text":h=f.TextTypeAdapter.Interpolate(b,a,c,this._propertyTrack)}this._propertyAdapter.ChangeProperty(b,h,a,c,d,e)}GetInterpolatedValue(b,a,c){switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":return f.NumericTypeAdapter.Interpolate(b,
a,c,this._propertyTrack);case "angle":return f.AngleTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "boolean":return f.BooleanTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "color":return f.ColorTypeAdapter.Interpolate(b,a,c,this._propertyTrack);case "text":return f.TextTypeAdapter.Interpolate(b,a,c,this._propertyTrack)}}AfterInterpolate(){this._propertyAdapter.AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){const b=
this._propertyTrack,a=b.GetTrack().GetTimeline().GetTime(),c=f.GetStartPropertyKeyframeForTime(a,b),d=c.GetNext();switch(b.GetPropertyKeyframeType()){case "numeric":return f.NumericTypeAdapter.Interpolate(a,c,d,b);case "angle":return f.AngleTypeAdapter.Interpolate(a,c,d,b);case "boolean":return f.BooleanTypeAdapter.Interpolate(a,c,d,b);case "color":return f.ColorTypeAdapter.Interpolate(a,c,d,b);case "text":return f.TextTypeAdapter.Interpolate(a,c,d,b)}}_CreatePropertyAdapter(){const b=this._propertyTrack;
switch(b.CanHavePropertyKeyframes()?b.GetPropertyKeyframeType():""){case "combo":case "boolean":case "text":case "string":return new f.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===this._propertyTrack.GetPropertyType()?new f.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new f.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new f.PropertyInterpolationAdapter.ColorInterpolationAdapter(this);
default:return new f.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetPropertyAdapter()._LoadFromJson(b.propertyAdapterJson)}}}
{"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,c,d,e,h){this.GetPropertyAdapter().CanChange(c.GetValue())&&super.Interpolate(a,c,d,e,h)}GetInterpolatedValue(a,c,d){if(this.GetPropertyAdapter().CanChange(c.GetValue()))return super.GetInterpolatedValue(a,c,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a.index)}}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(),c=this._propertyTrack.GetTrack();a=this._sid?this._sid:a.GetSourceAdapterArguments()[0];c=c.GetInstance();a=c.GetBehaviorIndexBySID(a);return c.GetBehaviorInstances()[a].GetSdkInstance()}GetBehaviorType(a){const c=
this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return a.GetBehaviorTypeByName(c)}UpdateBehaviorTypeSid(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._sid=a)}Interpolate(a,c,d,e,h){const g=this._propertyTrack.GetTrack().GetInstance();this.GetBehaviorType(g.GetObjectClass())&&super.Interpolate(a,c,d,e,h)}GetInterpolatedValue(a,c,d){const e=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(e.GetObjectClass()))return super.GetInterpolatedValue(a,
c,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._sid=a.sid)}}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 c=a.GetEffectList();c=this.GetEffectType(c).GetIndex();return a.IsEffectIndexActive(c)?a.GetEffectParametersForIndex(c):null}GetEffectType(a){const c=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];
return a.GetEffectTypeByName(c)}Interpolate(a,c,d,e,h){this._IsEffectActive()&&super.Interpolate(a,c,d,e,h)}GetInterpolatedValue(a,c,d){if(this._IsEffectActive())return super.GetInterpolatedValue(a,c,d)}_IsEffectActive(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var c=a.GetEffectList();if(c=this.GetEffectType(c))return c=c.GetIndex(),a.IsEffectIndexActive(c)}}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,c,d,e,h){var g=this._propertyTrack.GetTrack();const l=g.GetObjectClass().GetPlugin();g=g.GetInstance().GetObjectClass().GetPlugin();l===g&&super.Interpolate(a,c,d,e,h)}GetInterpolatedValue(a,
c,d){var e=this._propertyTrack.GetTrack();const h=e.GetObjectClass().GetPlugin();e=e.GetInstance().GetObjectClass().GetPlugin();if(h===e)return super.GetInterpolatedValue(a,c,d)}}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}MayNeedBeforeAndAfterInterpolate(){return!1}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let c=this._propertyTrack.GetPropertyTrackDataItem();c=a.GetFirstPropertyKeyframeDataItem(c);this._value=c.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(a,c,d,e,
h){this._value=f.PropertyTrackState.NumericTypeAdapter.Interpolate(a,c,d,this._propertyTrack);this._init=!0}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{value:this._value,init:this._init}}_LoadFromJson(a){a&&(this._value=a.value,this._init=a.hasOwnProperty("init")?a.init:!0)}}f.PropertyTrackState.ValueSourceAdapter=b}
{"use strict";const f=self.C3;class b extends f.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._audioPlaybackStarted=!1;this._expressions=this._actions=this._sdkInstance=null;this._timeline=this._propertyTrack.GetTimeline();this._track=this._propertyTrack.GetTrack();this._sourceAdapterArgs=this._propertyTrack.GetSourceAdapterArgs();this._fileArgs=this._sourceAdapterArgs[0];this._startOffsetTime=this._sourceAdapterArgs[1];this._audioTag=this._sourceAdapterArgs[3]?this._sourceAdapterArgs[3]:
Math.random().toString(36).slice(2);this._volume=this._pauseVolume=this._pauseTime=NaN;this._audioSource=null;this._Initialize()}Release(){super.Release();this._audioSource=this._fileArgs=this._sourceAdapterArgs=this._track=this._timeline=this._expressions=this._actions=this._sdkInstance=null}_Initialize(){if(self.C3.Plugins.Audio){var a=this._propertyTrack.GetRuntime().GetObjectClassByName("audio");a&&(this._sdkInstance=a.GetSingleGlobalInstance().GetSdkInstance());this._actions=self.C3.Plugins.Audio.Acts;
this._expressions=self.C3.Plugins.Audio.Exps}}_MaybeSetAudioSource(){if(!this._audioSource){var a=this._propertyTrack.GetTrack().GetPropertyTrack("audioSource");a&&(this._audioSource=a.GetSourceAdapter())}}_GetPauseVolume(){const a=this._propertyTrack.GetTrack().GetPropertyTrack("volume");return a?a.GetSourceAdapter()._pauseVolume:this._pauseVolume}TimelineRemoved(){super.TimelineRemoved();this._audioPlaybackStarted=!1;this._sdkInstance&&(this._expressions&&(this._pauseTime=this._expressions.PlaybackTime.call(this._sdkInstance,
this._audioTag),this._pauseVolume=this._expressions.Volume.call(this._sdkInstance,this._audioTag)),this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag))}GetAudioTag(){return this._audioTag}GetVolume(){return this._volume}SetVolume(a){this._volume=a}SetInitialState(){super.SetInitialState();this._pauseTime=NaN;this._audioPlaybackStarted=!1}SetResumeState(){super.SetResumeState();const a=this._propertyTrack.GetTimeline().GetTime();this._pauseTime=a-this._startOffsetTime;switch(this._propertyTrack.GetPropertyName()){case "volume":this._pauseVolume=
this._propertyTrack.GetInterpolatedValue(a)}this._audioPlaybackStarted=!1}Interpolate(a,c,d,e,h){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case "audioSource":if(!this._timeline.IsForwardPlayBack())break;if(e){this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag);break}if(a<this._startOffsetTime){this._audioPlaybackStarted=!1;break}c=this._expressions.PlaybackRate.call(this._sdkInstance,this._audioTag);d=this._timeline.GetPlaybackRate();d!==c&&this._actions.SetPlaybackRate.call(this._sdkInstance,
this._audioTag,d);if(this._audioPlaybackStarted)break;this._audioPlaybackStarted=!0;if(isNaN(this._pauseTime)){const g=self.performance.now(),l=a-this._startOffsetTime;this._sdkInstance.PostToDOMAsync("get-suspended").then(m=>{if("suspended"===m)this._audioPlaybackStarted=!1;else if(m=(self.performance.now()-g)/1E3,m=l+m,this._actions){let u=this.GetVolume();isNaN(u)?(this.SetVolume(0),u=0):this.SetVolume(u);this._actions.Play.call(this._sdkInstance,this._fileArgs,0,u,this._audioTag,m)}})}else{const g=
this._pauseTime;this._pauseTime=NaN;const l=this._GetPauseVolume();this._pauseVolume=NaN;this._sdkInstance.PostToDOMAsync("get-suspended").then(m=>{"suspended"===m?this._audioPlaybackStarted=!1:this._actions&&(this.SetVolume(l),this._actions.Play.call(this._sdkInstance,this._fileArgs,0,l,this._audioTag,g))})}break;case "volume":this._MaybeSetAudioSource(),super.Interpolate(a,c,d,e,h)}}GetInterpolatedValue(a,c,d){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case "volume":return this._MaybeSetAudioSource(),
super.GetInterpolatedValue(a,c,d)}}Getter(a,c){return this._audioSource?this._audioSource.GetVolume():0}Setter(a,c,d,e){this._audioSource&&this._audioSource.SetVolume(this.Getter()+c);this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),this._audioSource.GetVolume())}AbsoluteSetter(a,c,d){this._audioSource&&this._audioSource.SetVolume(c);this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),
this._audioSource.GetVolume())}DoesRounding(){return!0}_SaveToJson(){return{audioPlaybackStarted:this._audioPlaybackStarted,audioTag:this._audioTag,pauseTime:this._pauseTime,pauseVolume:this._pauseVolume,volume:this._volume}}_LoadFromJson(a){a&&(this._audioPlaybackStarted=a.audioPlaybackStarted,this._audioTag=a.audioTag,this._pauseTime=a.pauseTime,this._pauseVolume=a.pauseVolume,this._volume=a.volume,this._Initialize())}}f.PropertyTrackState.AudioSourceAdapter=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}MayNeedBeforeAndAfterInterpolate(){return!1}TimelineRemoved(){}CleanCaches(){this._target=
this._saveState=this._worldInfo=null}GetSourceAdapter(){return this._sourceAdapter}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo?this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(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,c,d){}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(),c=a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(f,b);return c?c: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,c,d,e){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return f();
case "effect":return b();case "instance-variable":return a();case "plugin":return c();case "world-instance":return d();case "audio":return e()}}_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 c of f){f=c.GetTrack().GetStartOffset();for(const d of c.GetPropertyKeyframeDataItems())b&&0===d.GetTime()?a.push({time:f+
d.GetTime(),value:d.GetAbsoluteValue()}):b||a.push({time:f+d.GetTime(),value:d.GetAbsoluteValue()})}return a.sort((c,d)=>c.time-d.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 c extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(d){super(d)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const d=this._propertyTrack.GetSourceAdapterId(),e=this._GetTarget(),h=this._GetIndex();switch(d){case "behavior":return this._ToColorArray(e.GetPropertyValueByIndex(h));case "effect":return this._ToColorArray(e[h]);case "plugin":return this._ToColorArray(e.GetPropertyValueByIndex(h));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const d=
this._FirstKeyframeGetter();return!this._CompareColors(d,this._Getter())}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(d,e){return d.equalsIgnoringAlpha(e)}_FirstKeyframeGetter(){const d=super._FirstKeyframeGetter();return this._GetColorFromArray(d)}_CurrentKeyframeGetter(){const d=super._CurrentKeyframeGetter();return this._GetColorFromArray(d)}_GetAbsoluteInitialValue(d){}_ToColorArray(d){return f.IsInstanceOf(d,
f.Color)?d.toArray().slice(0,3):d.slice(0,3)}_GetColorFromArray(d){return f.IsInstanceOf(d,f.Color)?d:new f.Color(d[0],d[1],d[2],1)}CanChange(d){return!0}MayNeedBeforeAndAfterInterpolate(){return!0}BeforeChangeProperty(){var d=this._propertyTrack.GetTimeline(),e=this._propertyTrack.GetInstance();const h=this._propertyTrack.GetSourceAdapter();(d=d.GetSimilarPropertyTracks(e,h,this._property))&&1<d.length&&(b.has(e)||b.set(e,new Map),e=b.get(e),d=this._propertyTrack.GetSourceAdapterId(),e.has(d)||e.set(d,
new Map),e=e.get(d),e.has(this._property)||e.set(this._property,{used:!1,color:new f.Color(0,0,0,1)}))}_GetTmpColor(d,e,h){d=b.get(d).get(e).get(h);d.used=!0;return d.color}ChangeProperty(d,e,h,g,l){l=this._propertyTrack.GetTimeline();g=this._propertyTrack.GetTrack();d=this._propertyTrack.GetInstance();var m=this._propertyTrack.GetSourceAdapter();h=this._propertyTrack.GetSourceAdapterId();if((m=l.GetSimilarPropertyTracks(d,m,this._property))&&1<m.length){if(m=this._GetPropertyKeyframeStubs(m,!0),
l=this._GetLastPropertyKeyframeStub(l,l.GetTime(),m))g=g.GetStartOffset(),m=l.time-g,0===m?this._GetTmpColor(d,h,this._property).addRgb(e[0],e[1],e[2]):0>m||(l=e[0],g=e[1],e=e[2],m=this._propertyTrack.Interpolate(m,!1,!0),l=f.Color.DiffChannel(l,m[0]),g=f.Color.DiffChannel(g,m[1]),e=f.Color.DiffChannel(e,m[2]),this._GetTmpColor(d,h,this._property).addRgb(l,g,e))}else this._Setter(e[0],e[1],e[2])}AfterChangeProperty(){const d=this._propertyTrack.GetInstance();if(b.has(d)){var e=b.get(d),h=this._propertyTrack.GetSourceAdapterId();
if(e.has(h)){var g=e.get(h);if(g.has(this._property)){var l=g.get(this._property),m=l.color;l.used&&this._Setter(m.getR(),m.getG(),m.getB());0===g.size&&e.delete(h);0===e.size&&b.delete(d)}}}}_Getter(){const d=this._propertyTrack.GetSourceAdapterId(),e=this._GetTarget(),h=this._GetIndex();switch(d){case "behavior":return this._GetColorFromArray(e.GetPropertyValueByIndex(h));case "effect":return e[h].clone();case "plugin":return this._GetColorFromArray(e.GetPropertyValueByIndex(h));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(d,
e,h){const g=this._propertyTrack.GetSourceAdapterId(),l=this._GetTarget(),m=this._GetIndex();switch(g){case "behavior":a[0]=d;a[1]=e;a[2]=h;l.SetPropertyValueByIndex(m,a);break;case "effect":l[m].setRgb(d,e,h);break;case "plugin":a[0]=d;a[1]=e;a[2]=h;l.SetPropertyValueByIndex(m,a);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(d,e,h)}}_SaveToJson(){}_LoadFromJson(d){}}f.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=c}
{"use strict";const f=self.C3,b=f.PropertyTrackState;class a extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}MayNeedBeforeAndAfterInterpolate(){return!1}ChangeProperty(c,d,e,h,g){e=
this._propertyTrack;const l=e.GetTrack();h=e.GetSourceAdapterId();g=e.GetTimeline();var m=l.GetInstance();const u=e.GetSourceAdapter();(m=g.GetSimilarPropertyTracks(m,u,this._property))&&1<m.length&&(m=this._GetPropertyKeyframeStubs(m),c+=l.GetStartOffset(),c=this._GetLastPropertyKeyframeStub(g,c,m))&&(d=c.value);switch(e.GetPropertyKeyframeType()){case "numeric":if(!b.NumericTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),d,h))return;break;case "angle":if(!b.AngleTypeAdapter.WillChange(this._GetIndex(),
this._GetTarget(),d,h))return;break;case "boolean":if(!b.BooleanTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),d,h))return;break;case "color":if(!b.ColorTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),d,h))return;break;case "text":if(!b.TextTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),d,h))return}this._Setter(d)}_Getter(){const c=this._propertyTrack.GetSourceAdapterId(),d=this._GetTarget(),e=this._GetIndex();switch(c){case "behavior":return d.GetPropertyValueByIndex(e);
case "effect":return d[e];case "instance-variable":return d.GetInstanceVariableValue(e);case "plugin":return d.GetPropertyValueByIndex(e)}}_Setter(c){const d=this._propertyTrack.GetSourceAdapterId(),e=this._GetTarget(),h=this._GetIndex();switch(d){case "behavior":e.SetPropertyValueByIndex(h,c);break;case "effect":e[h]=c;break;case "instance-variable":e.SetInstanceVariableValue(h,c);break;case "plugin":e.SetPropertyValueByIndex(h,c)}}}f.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=
a}
{"use strict";const f=self.C3,b=new Map,a=(d,e,h,g,l)=>b.set(d,{setter:e,absolute_setter:h,getter:g,round:l});a("offsetX",(d,e)=>d.OffsetX(e),(d,e)=>d.SetX(e),d=>d.GetX(),!0);a("offsetY",(d,e)=>d.OffsetY(e),(d,e)=>d.SetY(e),d=>d.GetY(),!0);a("offsetWidth",(d,e)=>d.OffsetWidth(e),(d,e)=>d.SetWidth(e),d=>d.GetWidth(),!0);a("offsetHeight",(d,e)=>d.OffsetHeight(e),(d,e)=>d.SetHeight(e),d=>d.GetHeight(),!0);a("offsetAngle",(d,e)=>d.OffsetAngle(e),(d,e)=>d.SetAngle(e),d=>d.GetAngle(),!1);a("offsetOpacity",(d,
e,h,g)=>{h=d.GetOpacity()+e;0===g._clampAccumulator?(1<h?g._clampAccumulator+=h-1:0>h&&(g._clampAccumulator+=h),d.OffsetOpacity(e)):(d=d.GetOpacity()+e,0<e&&0<g._clampAccumulator?1<d&&(g._clampAccumulator+=d-1):0<e&&0>g._clampAccumulator?(g._clampAccumulator+=e,0<g._clampAccumulator&&(g._clampAccumulator=0)):0>e&&0<g._clampAccumulator?(g._clampAccumulator+=e,0>g._clampAccumulator&&(g._clampAccumulator=0)):0>e&&0>g._clampAccumulator&&0>d&&(g._clampAccumulator+=d))},(d,e)=>{d.SetOpacity(e)},d=>d.GetOpacity(),
!1);a("offsetOriginX",(d,e)=>d.OffsetOriginX(e),(d,e)=>d.SetOriginX(e),d=>d.GetOriginX(),!1);a("offsetOriginY",(d,e)=>d.OffsetOriginY(e),(d,e)=>d.SetOriginY(e),d=>d.GetOriginY(),!1);a("offsetZElevation",(d,e)=>d.OffsetZElevation(e),(d,e)=>d.SetZElevation(e),d=>d.GetZElevation(),!0);a("offsetScaleX",(d,e,h,g)=>{g=0>d.GetWidth()?-1:1;d.GetTransformWithParentWidth();d.OffsetWidth(h.GetOriginalWidth()*g*e)},(d,e,h)=>{d.SetWidth(h.GetOriginalWidth()*e)},(d,e)=>{const h=0>d.GetWidth()?-1:1;if(d.GetTransformWithParentWidth()){var g=
d.GetParent(),l=e.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetWidth()/l.GetOriginalWidth():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetWidth()/l.GetOriginalWidth():1);return d.GetWidth()*h/(e.GetOriginalWidth()*g)}return d.GetWidth()*h/e.GetOriginalWidth()},!1);a("offsetScaleY",(d,e,h,g)=>{g=0>d.GetHeight()?-1:1;d.GetTransformWithParentHeight();d.OffsetHeight(h.GetOriginalHeight()*g*e)},(d,e,h)=>{d.SetHeight(h.GetOriginalHeight()*e)},(d,e)=>{const h=0>d.GetHeight()?
-1:1;if(d.GetTransformWithParentHeight()){var g=d.GetParent(),l=e.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetHeight()/l.GetOriginalHeight():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetHeight()/l.GetOriginalHeight():1);return d.GetHeight()*h/(e.GetOriginalHeight()*g)}return d.GetHeight()*h/e.GetOriginalHeight()},!1);class c extends f.PropertyTrackState.PropertyInterpolationAdapter{constructor(d){super(d);this._clampAccumulator=this._lastValue=0;this._source_adapter_absolute_setter=
this._source_adapter_setter=this._source_adapter_getter=this._instance_absolute_setter=this._instance_setter=this._instance_getter=null;this._round=!1;f.IsInstanceOf(this._propertyTrack.GetTimeline(),f.TweenState)?this._typeAdapter=new f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):this._typeAdapter=new f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);const e=this._propertyTrack.GetPropertyName();switch(this._propertyTrack.GetSourceAdapterId()){case "world-instance":d=
b.get(e);this._instance_getter=d.getter;this._instance_setter=d.setter;this._instance_absolute_setter=d.absolute_setter;this._round=d.round;break;case "audio":this._source_adapter_getter=d.Getter,this._source_adapter_setter=d.Setter,this._source_adapter_absolute_setter=d.AbsoluteSetter,this._round=!!d.DoesRounding()}}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}MayNeedBeforeAndAfterInterpolate(){return this._typeAdapter.MayNeedBeforeAndAfterInterpolate()}GetLastValue(){return this._lastValue}SetLastValue(d){this._lastValue=
d}SetInitialState(){const d=this._typeAdapter.SetInitialState();"number"===typeof d&&(this._lastValue=d);this._clampAccumulator=0}SetResumeState(){const d=this._typeAdapter.SetResumeState();"number"===typeof d&&(this._lastValue=d)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return f.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(d,
e,h,g,l,m,u){return this._typeAdapter.ChangeProperty(d,e,h,g,l,m,u)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const d=this._GetTarget(),e=this._GetIndex(),h=this.GetWorldInfo(),g=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return d.GetPropertyValueByIndex(e);case "effect":return d[e];case "instance-variable":return d.GetInstanceVariableValue(e);case "plugin":return d.GetPropertyValueByIndex(e);case "world-instance":return this._instance_getter(h,
g);case "audio":return this._source_adapter_getter.call(this.GetSourceAdapter(),h,g)}}_Setter(d,e,h){e=this._GetTarget();h=this._GetIndex();const g=this.GetWorldInfo(),l=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":e.OffsetPropertyValueByIndex(h,d);break;case "effect":e[h]+=d;break;case "instance-variable":e.SetInstanceVariableOffset(h,d);break;case "plugin":e.OffsetPropertyValueByIndex(h,d);break;case "world-instance":this._instance_setter(g,d,l,
this);break;case "audio":this._source_adapter_setter.call(this.GetSourceAdapter(),g,d,l,this)}}_SetterAbsolute(d,e,h){e=this._GetTarget();h=this._GetIndex();const g=this.GetWorldInfo(),l=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":e.SetPropertyValueByIndex(h,d);break;case "effect":e[h]=d;break;case "instance-variable":e.SetInstanceVariableValue(h,d);break;case "plugin":e.SetPropertyValueByIndex(h,d);break;case "world-instance":this._instance_absolute_setter(g,
d,l);break;case "audio":this._source_adapter_absolute_setter.call(this.GetSourceAdapter(),g,d,l)}}_MaybeEnsureValue(d,e,h,g,l,m){this._typeAdapter._MaybeEnsureValue(d,e,h,g,l,m)}_AddDelta(d,e,h){var g=(d.toString().split(".")[1]||"").length;d=this._Getter();g=0===g?this._round?Math.round(d):d:f.toFixed(d,g);this._Setter(g-d,e,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue,a:this._clampAccumulator})}_LoadFromJson(d){d&&(super._LoadFromJson(d),this._lastValue=d.v,this._clampAccumulator=
d.a)}}f.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=c}
{"use strict";class f{constructor(a){this._used=!1;this._value=0;this._propertyTracks=a;for(let c=0,d=this._propertyTracks.length;c<d;c++)this._propertyTracks[c].SetAbsoluteValueObject(this)}GetPropertyTracks(){return this._propertyTracks}SetUsed(){this._used=!0}GetUsed(){return this._used}SetValue(a){this._value=a}GetValue(){return this._value}Reset(){this._used=!1;this._value=0}}class b{constructor(a){this._numericInterpolationAdapter=a}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const a=
this._numericInterpolationAdapter;this._numericInterpolationAdapter.GetPropertyTrack();return a._PickResultMode(()=>a._PickTimelinePlaybackMode(()=>0,()=>a.GetSourceAdapter().GetValueAtTime()),()=>{})}SetResumeState(){}MayNeedBeforeAndAfterInterpolate(){switch(this._numericInterpolationAdapter.GetPropertyTrack().GetResultMode()){case "relative":return!1;case "absolute":return!0}}BeforeChangeProperty(){var a=this._numericInterpolationAdapter.GetPropertyTrack(),c=a.GetPropertyName();switch(a.GetResultMode()){case "absolute":if(a.HasAbsoluteValueObject())a.GetAbsoluteValueObject().Reset();
else{const d=a.GetTimeline(),e=a.GetInstance();a=a.GetSourceAdapter();(c=d.GetSimilarPropertyTracks(e,a,c))&&1<c.length&&new f(c)}}}ChangeProperty(a,c,d,e,h,g){var l=this._numericInterpolationAdapter,m=this._numericInterpolationAdapter.GetPropertyTrack();switch(m.GetResultMode()){case "relative":m=l.GetLastValue();l._Setter(c-m,d,e);g&&this._MaybeEnsureValue(a,d,e,h,m,c);l.SetLastValue(c);break;case "absolute":if(e=m.GetTimeline(),d=m.GetTrack(),m.GetInstance(),m.GetSourceAdapter(),m.HasAbsoluteValueObject()){if(a=
m.GetAbsoluteValueObject(),h=a.GetPropertyTracks(),h=l._GetPropertyKeyframeStubs(h,!0),l=l._GetLastPropertyKeyframeStub(e,e.GetTime(),h))d=d.GetStartOffset(),l=l.time-d,0===l?(a.SetUsed(),a.SetValue(a.GetValue()+c)):0>l||(m=m.GetInterpolatedValue(l),a.SetUsed(),a.SetValue(a.GetValue()+(c-m)))}else l._SetterAbsolute(c)}}AfterChangeProperty(){const a=this._numericInterpolationAdapter;var c=this._numericInterpolationAdapter.GetPropertyTrack();switch(c.GetResultMode()){case "absolute":c.HasAbsoluteValueObject()&&
(c=c.GetAbsoluteValueObject(),c.GetUsed()&&a._SetterAbsolute(c.GetValue()))}}_MaybeEnsureValue(a,c,d,e,h,g){const l=this._numericInterpolationAdapter;e||(c&&a===c.GetTime()?l._AddDelta(c.GetValueWithResultMode(),c,d):d&&a===d.GetTime()?l._AddDelta(d.GetValueWithResultMode(),c,d):0===g-h&&l._AddDelta(c.GetValueWithResultMode(),c,d))}}self.C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=b}
{"use strict";class f{constructor(b){this._numericInterpolationAdapter=b}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const b=this._numericInterpolationAdapter;b.SetFirstAbsoluteUpdate(!0);return this._GetAbsoluteInitialValue(b._FirstKeyframeGetter())}SetResumeState(){const b=this._numericInterpolationAdapter;if(b._FirstKeyframeGetter()!==b._CurrentKeyframeGetter())return b.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(b._CurrentKeyframeGetter())}MayNeedBeforeAndAfterInterpolate(){return!1}BeforeChangeProperty(){}ChangeProperty(b,
a,c,d,e,h){const g=this._numericInterpolationAdapter,l=g.GetLastValue();switch(g.GetPropertyTrack().GetResultMode()){case "relative":g._Setter(a-l,c,d);h&&this._MaybeEnsureValue(b,c,d,e,l,a);break;case "absolute":g.GetFirstAbsoluteUpdate()?(g.SetFirstAbsoluteUpdate(!1),g._Setter(l,c,d)):(g._Setter(a-l,c,d),h&&this._MaybeEnsureValue(b,c,d,e,l,a))}g.SetLastValue(a)}AfterChangeProperty(){}_GetAbsoluteInitialValue(b){return b-this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(b,a,c,
d,e,h){const g=this._numericInterpolationAdapter;d?a&&b===a.GetTime()?g._AddDelta(a.GetValueWithResultMode(),a,c):c&&b===c.GetTime()?g._AddDelta(c.GetValueWithResultMode(),a,c):c||g._AddDelta(a.GetValueWithResultMode(),a,c):a&&b===a.GetTime()?g._AddDelta(a.GetValueWithResultMode(),a,c):c&&b===c.GetTime()?g._AddDelta(c.GetValueWithResultMode(),a,c):0===h-e&&g._AddDelta(a.GetValueWithResultMode(),a,c)}}self.C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=f}
{"use strict";const f=self.C3,b=self.Ease;f.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(a,c,d,e){let h;switch(e){case "behavior":h=c.GetPropertyValueByIndex(a);break;case "effect":h=c[a];break;case "instance-variable":h=c.GetInstanceVariableValue(a);break;case "plugin":h=c.GetPropertyValueByIndex(a)}return h===d?!1:!0}static Interpolate(a,c,d,e){if(!d)return d=e.GetPropertyTrackDataItem(),d=e.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(d),d.GetValueWithResultMode();
var h=e.GetInterpolationMode();"default"===h&&(h="continuous");"combo"===e.GetPropertyType()&&(h="discrete");if("discrete"===h)return c.GetValueWithResultMode();if("continuous"===h||"step"===h){"step"===h&&(h=e.GetTimeline().GetStep(),0!==h&&(h=1/h,a=Math.floor(a*h)/h));var g=c.GetTime();const l=d.GetTime();h=c.GetValueWithResultMode();const m=d.GetValueWithResultMode();if(h===m)return h;a=f.normalize(a,g,l);const u=c.GetEase();c=c.GetAddOn("cubic-bezier");d=d.GetAddOn("cubic-bezier");c&&c.GetStartEnable()&&
d&&d.GetEndEnable()?(g=l-g,g=b.GetRuntimeEase(u)(g*a,0,1,g),g=b.GetRuntimeEase("cubicbezier")(g,h,h+c.GetStartAnchor(),m+d.GetEndAnchor(),m)):g=b.GetRuntimeEase(u)((l-g)*a,h,m-h,l-g);return"integer"===e.GetPropertyType()?Math.floor(g):g}}}}
{"use strict";const f=self.C3;f.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(b,a,c,d){let e;switch(d){case "behavior":e=a.GetPropertyValueByIndex(b);break;case "effect":e=a[b];break;case "instance-variable":e=a.GetInstanceVariableValue(b);break;case "plugin":e=a.GetPropertyValueByIndex(b)}return e===c?!1:!0}static Interpolate(b,a,c,d){if(!c)return a=d.GetPropertyTrackDataItem(),a=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode();var e=
d.GetInterpolationMode();"default"===e&&(e="continuous");"combo"===d.GetPropertyType()&&(e="discrete");if("discrete"===e)return a.GetValueWithResultMode();if("continuous"===e||"step"===e){"step"===e&&(d=d.GetTimeline().GetStep(),0!==d&&(d=1/d,b=Math.floor(b*d)/d));const h=a.GetTime(),g=c.GetTime();d=a.GetValueWithResultMode();c=c.GetValueWithResultMode();if(e=a.GetAddOn("angle")){const l=e.GetRevolutions();if(d===c&&0===l)return d;b=f.normalize(b,h,g);a=self.Ease.GetRuntimeEase(a.GetEase())(b,0,1,
1);switch(e.GetDirection()){case "closest":return f.angleLerp(d,c,a,l);case "clockwise":return f.angleLerpClockwise(d,c,a,l);case "anti-clockwise":return f.angleLerpAntiClockwise(d,c,a,l)}}else{if(d===c)return d;b=f.normalize(b,h,g);a=self.Ease.GetRuntimeEase(a.GetEase());return f.angleLerp(d,c,a(b,0,1,1))}}}}}"use strict";
self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(f,b,a,c){let d;switch(c){case "behavior":d=b.GetPropertyValueByIndex(f);break;case "effect":d=b[f];break;case "instance-variable":d=b.GetInstanceVariableValue(f);break;case "plugin":d=b.GetPropertyValueByIndex(f)}return!!d===!!a?!1:!0}static Interpolate(f,b,a,c){return a?b.GetValueWithResultMode()?1:0:(f=c.GetPropertyTrackDataItem(),f=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(f),f.GetValueWithResultMode()?
1:0)}};
{"use strict";const f=self.C3,b=[0,0,0],a=[0,0,0],c=[0,0,0];f.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(d,e,h,g){let l;switch(g){case "behavior":l=e.GetPropertyValueByIndex(d);break;case "effect":l=e[d];break;case "instance-variable":l=e.GetInstanceVariableValue(d);break;case "plugin":l=e.GetPropertyValueByIndex(d)}Array.isArray(h)?(b[0]=h[0],b[1]=h[1],b[2]=h[2]):(c.parseCommaSeparatedRgb(h),b[0]=Math.floor(255*c.getR()),b[1]=Math.floor(255*c.getG()),b[2]=Math.floor(255*c.getB()));
Array.isArray(l)?(a[0]=l[0],a[1]=l[1],a[2]=l[2]):(c.parseCommaSeparatedRgb(l),a[0]=Math.floor(255*c.getR()),a[1]=Math.floor(255*c.getG()),a[2]=Math.floor(255*c.getB()));return b[0]!==a[0]||b[1]!==a[1]||b[2]!==a[2]?!0:!1}static Interpolate(d,e,h,g){if(!h){var l=g.GetPropertyTrackDataItem();l=g.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(l);g=l.GetValueWithResultMode();b[0]=g[0];b[1]=g[1];b[2]=g[2];return b}l=g.GetInterpolationMode();"default"===l&&(l="continuous");if("discrete"===l)return g=
e.GetValueWithResultMode(),b[0]=g[0],b[1]=g[1],b[2]=g[2],b;if("continuous"===l||"step"===l){"step"===l&&(g=g.GetTimeline().GetStep(),0!==g&&(g=1/g,d=Math.floor(d*g)/g));g=e.GetTime();l=h.GetTime();var m=e.GetValueWithResultMode(),u=h.GetValueWithResultMode();d=f.normalize(d,g,l);var w=e.GetEase();e=m[0];h=m[1];m=m[2];const q=u[0],t=u[1];u=u[2];w=self.Ease.GetRuntimeEase(w);g=l-g;l=g*d;b[0]=e===q?e:w(l,e,q-e,g);b[1]=h===t?h:w(l,h,t-h,g);b[2]=m===u?m:w(l,m,u-m,g);return b}}}}"use strict";
self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(f,b,a,c){let d;switch(c){case "behavior":d=b.GetPropertyValueByIndex(f);break;case "effect":d=b[f];break;case "instance-variable":d=b.GetInstanceVariableValue(f);break;case "plugin":d=b.GetPropertyValueByIndex(f)}return d===a?!1:!0}static Interpolate(f,b,a,c){return a?b.GetValueWithResultMode():(f=c.GetPropertyTrackDataItem(),f=c.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,c,d){if(a)for(const e of a)f.TimelineDataManager._CreateDataItem("create",e,b,c,d)}static _LoadDataItemsFromJson(b,
a,c,d){b.length?a.forEach((e,h)=>{b[h]._LoadFromJson(e)}):a.forEach(e=>{f.TimelineDataManager._CreateDataItem("load",e,b,c,d)})}static _CreateDataItem(b,a,c,d,e){let h;if("function"===typeof d)switch(b){case "load":h=new d(null,e);break;case "create":h=new d(a,e)}else if("object"===typeof d)switch(d=d.map.get(a[d.prop]),b){case "load":h=new d(null,e);break;case "create":h=new d(a,e)}switch(b){case "load":h._LoadFromJson(a);c.push(h);break;case "create":if("function"===typeof h.GetEnable&&!h.GetEnable())return h.Release();
c.push(h)}}}}
{"use strict";const 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,c){this._trackData=c;this._additionalInstanceData=this._instanceData=null;this._objectClassIndex=this._instanceUid=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyTrackData=this._keyframeData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();this._type=0;this._name="";a&&(a[0]&&(this._instanceData=a[0],this._instanceUid=a[0][2],
this._objectClassIndex=a[0][1]),this._interpolationMode=a[1],this._resultMode=a[2],this._enabled=!!a[3],a[6]&&(this._id=a[6]),a[7]&&(this._nestedData=a[7],this._startOffset=a[7][0],this._localTotalTime=a[7][1]),a[8]&&(this._additionalInstanceData=a[8]),a[8]&&(this._additionalInstanceData=a[8]),a[9]&&(this._type=a[9]),a[10]&&(this._name=a[10]),this._keyframeData=new 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}SetLocalTotalTime(a){this._localTotalTime=a}GetOriginalWidth(){return this._additionalInstanceData[0]}SetOriginalWidth(a){this._additionalInstanceData||
(this._additionalInstanceData=[]);this._additionalInstanceData[0]=a}GetOriginalHeight(){this._additionalInstanceData||(this._additionalInstanceData=[]);return this._additionalInstanceData[1]}SetOriginalHeight(a){this._additionalInstanceData||(this._additionalInstanceData=[]);this._additionalInstanceData[1]=a}GetType(){return this._type}GetName(){return this._name}_SaveToJson(){return{keyframeDataJson:this._keyframeData._SaveToJson(),propertyTrackDataJson:this._propertyTrackData._SaveToJson(),instanceData:this._instanceData,
additionalInstanceData:this._additionalInstanceData,instanceUid:this._instanceUid,objectClassIndex:this._objectClassIndex,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled,id:this._id,nestedData:this._nestedData,type:this._type,name:this._name}}_LoadFromJson(a){a&&(this._instanceData=a.instanceData,this._instanceUid=a.instanceUid,this._objectClassIndex=a.objectClassIndex,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._enabled=
a.enabled,this._id=a.id,this._type=a.type?a.type:0,this._name=a.name?a.name:"",this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),a.nestedData&&(this._nestedData=a.nestedData,this._startOffset=this._nestedData[0],this._localTotalTime=this._nestedData[1]),a.additionalInstanceData&&(this._additionalInstanceData=a.additionalInstanceData),this.GetKeyframeData()._LoadFromJson(a.keyframeDataJson),this.GetPropertyTrackData()._LoadFromJson(a.propertyTrackDataJson))}}f.TrackData=class{constructor(a,
c){this._timelineDataItem=c;this._trackDataItems=[];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}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const a=new b(null,this);this._trackDataItems.push(a);return a}GetFirstKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray().at(-1)}GetKeyFrameDataItemAtTime(a,
c){c=c.GetKeyframeData().GetKeyframeDataItemArray();const d=c.length;for(let e=0;e<d;e++){const h=c[e];if(h.GetTime()===a)return h}}GetFirstKeyFrameDataItemHigherThan(a,c){c=c.GetKeyframeData().GetKeyframeDataItemArray();const d=c.length;for(let e=0;e<d;e++){const h=c[e];if(h.GetTime()>a)return h}}GetFirstKeyFrameDataItemHigherOrEqualThan(a,c){c=c.GetKeyframeData().GetKeyframeDataItemArray();const d=c.length;for(let e=0;e<d;e++){const h=c[e];if(h.GetTime()>=a)return h}}GetFirstKeyFrameDataItemLowerOrEqualThan(a,
c){c=c.GetKeyframeData().GetKeyframeDataItemArray();for(let d=c.length-1;0<=d;d--){const e=c[d];if(e.GetTime()<=a)return e}}*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,c){this._propertyTrackData=c;this._sourceAdapterId="";this._type=this._property=this._sourceAdapterArguments=null;this._max=this._min=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyKeyframeData=null;this._canHavePropertyKeyframes=!0;a&&(this._sourceAdapterId=a[0][0],this._sourceAdapterArguments=a[0].slice(1),this._property=a[1],this._type=a[2],this._min=a[3],this._max=a[4],this._interpolationMode=a[5],this._resultMode=
a[6],this._enabled=!!a[7],this._propertyKeyframeData=new f.PropertyKeyframeData(a[8],this),this._canHavePropertyKeyframes=a[9])}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new 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}CanHavePropertyKeyframes(){return!!this._canHavePropertyKeyframes}_SaveToJson(){return{propertyKeyframeDataJson:this._propertyKeyframeData._SaveToJson(),sourceAdapterId:this._sourceAdapterId,sourceAdapterArguments:this._sourceAdapterArguments,property:this._property,type:this._type,min:this._min,max:this._max,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled,canHavePropertyKeyframes:this._canHavePropertyKeyframes}}_LoadFromJson(a){a&&
(this._sourceAdapterId=a.sourceAdapterId,this._sourceAdapterArguments=a.sourceAdapterArguments,this._property=a.property,this._type=a.type,this._min=a.min,this._max=a.max,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._enabled=a.enabled,this._canHavePropertyKeyframes=a.canHavePropertyKeyframes,this.GetPropertyKeyframeData()._LoadFromJson(a.propertyKeyframeDataJson))}}f.PropertyTrackData=class{constructor(a,c){this._trackDataItem=c;this._propertyTrackDataItems=[];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}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const a=new b(null,this);this._propertyTrackDataItems.push(a);return a}GetFirstPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray().at(-1)}GetPropertyKeyFrameDataItemAtTime(a,
c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const d=c.length;for(let e=0;e<d;e++){const h=c[e];if(h.GetTime()===a)return h}}GetFirstPropertyKeyFrameDataItemHigherThan(a,c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const d=c.length;for(let e=0;e<d;e++){const h=c[e];if(h.GetTime()>a)return h}}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const d=c.length;for(let e=0;e<d;e++){const h=
c[e];if(h.GetTime()>=a)return h}}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,c){c=c.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();for(let d=c.length-1;0<=d;d--){const e=c[d];if(e.GetTime()<=a)return e}}*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,c){this._keyframeData=c;this._time=-1;this._ease="noease";this._enable=!1;this._lowerTags=this._tags=null;a&&(this._time=a[0],this._ease=a[1],this._enable=!!a[2],this._tags=(a=a[3])?a.split(" "):[],this._lowerTags=new Set(this._tags.map(d=>d.toLowerCase())),this._next=null)}Release(){this._keyframeData=null;f.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetNext(){return this._next}SetNext(a){this._next=a}GetTime(){return this._time}SetTime(a){this._time=
a;this._keyframeData._LinkKeyframeDataItems()}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetTags(){return this._tags}SetTags(a){this._tags=a?a.split(" "):[];this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(a){return this._lowerTags.has(a.toLowerCase())}_SaveToJson(){return{time:this._time,ease:this._ease,enable:this._enable,tags:this._tags}}_LoadFromJson(a){a&&(this._time=
a.time,this._ease=a.ease,this._enable=a.enable,this._tags=a.tags,this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase())))}}f.KeyframeData=class{constructor(a,c){this._trackDataItem=c;this._keyframeDataItems=[];f.TimelineDataManager._CreateDataItems(this._keyframeDataItems,a,b,this);this._LinkKeyframeDataItems()}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();f.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}_LinkKeyframeDataItems(){this._keyframeDataItems.sort((a,
c)=>a.GetTime()-c.GetTime());for(let a=0;a<this._keyframeDataItems.length;a++)this._keyframeDataItems[a].SetNext(this._keyframeDataItems[a+1])}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const a=new b(null,this);this._keyframeDataItems.push(a);this._LinkKeyframeDataItems();return a}DeleteKeyframeDataItems(a){for(const c of this._keyframeDataItems){if(!a(c))continue;
const d=this._keyframeDataItems.indexOf(c);-1!==d&&(c.Release(),this._keyframeDataItems.splice(d,1))}this.SortKeyframeDataItems();this._LinkKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((a,c)=>a.GetTime()-c.GetTime())}GetKeyframeDataItemIndex(a){return this._keyframeDataItems.indexOf(a)}GetKeyframeDataItemFromIndex(a){return this._keyframeDataItems[a]}*keyframeDataItems(){for(const a of this._keyframeDataItems)yield a}*keyframeDataItemsReverse(){for(let a=this._keyframeDataItems.length-
1;0<=a;a--)yield this._keyframeDataItems[a]}_SaveToJson(){return{keyframeDataItemsJson:this._keyframeDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&(f.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,a.keyframeDataItemsJson,b,this),this._LinkKeyframeDataItems())}}}
{"use strict";const f=self.C3;class b{constructor(a,c){this._propertyKeyframeData=c;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;this._addonInstance=void 0;a&&(this._value=a[0][0],this._aValue=a[0][1],this._type=a[0][2],this._time=a[1],this._ease=a[2],this._enable=!!a[3],this._addonData=null,a[4]&&(this._addonData=new f.AddonData(a[4],this)),this._next=null)}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(),
this._addonData=null)}GetAddonData(){return this._addonData}SetNext(a){this._next=a}GetNext(){return this._next}GetValue(){return this._value}SetValue(a){"color"===this._type&&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;this._propertyKeyframeData._LinkPropertyKeyframeDataItems()}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetAddOn(a){if(this._addonData){if(this._addonInstance||
null===this._addonInstance)return this._addonInstance;var c=this._addonData.GetAddDataItemArray();if(!c)return this._addonInstance=null;var d=c.length;for(let e=0;e<d;e++){const h=c[e];if(h.GetId()===a)return this._addonInstance=h}return this._addonInstance=null}}_SaveToJson(){const a=this._addonData;return{addonDataJson:a?a._SaveToJson():a,value:this._value,aValue:this._aValue,type:this._type,time:this._time,ease:this._ease,enable:this._enable}}_LoadFromJson(a){a&&(a.addonDataJson&&this._addonData._SetFromJson(a.addonDataJson),
this._value=a.value,this._aValue=a.aValue,this._type=a.type,this._time=a.time,this._ease=a.ease,this._enable=a.enable)}}f.PropertyKeyframeData=class{constructor(a,c){this._propertyTrackDataItem=c;this._propertyKeyframeDataItems=[];f.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,a,b,this);this._LinkPropertyKeyframeDataItems()}Release(){this._propertyTrackDataItem=null;for(const a of this._propertyKeyframeDataItems)a.Release();f.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=
null}_LinkPropertyKeyframeDataItems(){this._propertyKeyframeDataItems.sort((a,c)=>a.GetTime()-c.GetTime());for(let a=0;a<this._propertyKeyframeDataItems.length;a++)this._propertyKeyframeDataItems[a].SetNext(this._propertyKeyframeDataItems[a+1])}AddEmptyPropertyKeyframeDataItem(){const a=new b(null,this);this._propertyKeyframeDataItems.push(a);this._LinkPropertyKeyframeDataItems();return a}DeletePropertyKeyframeDataItems(a){for(const c of this._propertyKeyframeDataItems){if(!a(c))continue;const d=
this._propertyKeyframeDataItems.indexOf(c);-1!==d&&(c.Release(),this._propertyKeyframeDataItems.splice(d,1))}this.SortPropertyKeyFrameDataItems();this._LinkPropertyKeyframeDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a,c)=>a.GetTime()-c.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const a of this._propertyKeyframeDataItems)yield a}*propertyKeyframeDataItemsReverse(){for(let a=
this._propertyKeyframeDataItems.length-1;0<=a;a--)yield this._propertyKeyframeDataItems[a]}_SaveToJson(){return{propertyKeyframeDataItemsJson:this._propertyKeyframeDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&(f.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a.propertyKeyframeDataItemsJson,b,this),this._LinkPropertyKeyframeDataItems())}}}
{"use strict";const f=self.C3;class b{constructor(d,e){this._addonData=e;this._id=d[0];this._data=d[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(d){d&&(this._id=d.id,this._data=d.data)}}class a extends b{constructor(d,e){super(d,e);this._startAnchor=this._data[0];this._startEnable=!!this._data[1];this._endAnchor=this._data[2];this._endEnable=!!this._data[3]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),
{startAnchor:this._startAnchor,startEnable:!!this._startEnable,endAnchor:this._endAnchor,endEnable:!!this._endEnable})}_LoadFromJson(d){d&&(super._LoadFromJson(d),this._startAnchor=d.startAnchor,this._startEnable=!!d.startEnable,this._endAnchor=d.endAnchor,this._endEnable=!!d.endEnable)}}class c extends b{constructor(d,e){super(d,e);this._direction=this._data[0];this._revolutions=this._data[1]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),
{direction:this._direction,revolutions:this._revolutions})}_LoadFromJson(d){d&&(super._LoadFromJson(d),this._direction=d.direction,this._revolutions=d.revolutions)}}f.AddonData=class{constructor(d,e){this._propertyKeyframeDataItem=e;this._addonDataItems=[];f.TimelineDataManager._CreateDataItems(this._addonDataItems,d,{prop:0,map:new Map([["cubic-bezier",a],["angle",c]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const d of this._addonDataItems)d.Release();f.clearArray(this._addonDataItems);
this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}GetAddDataItemArray(){return this._addonDataItems}*addonDataItems(){for(const d of this._addonDataItems)yield d}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(d=>d._SaveToJson())}}_LoadFromJson(d){d&&f.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,d.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",a],["angle",c]])},this)}}}
{"use strict";const f=self.C3;let b=0;f.TweenState=class extends f.TimelineState{constructor(a,c){super(`tween-${b++}`,a,c);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._track=this._on_started_callbacks=this._on_completed_callbacks=this._instance=null}CreateTrackStates(){for(const a of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(f.TweenTrackState.Create(this,a));this._track=this._tracks[0]}AddTrack(){var a=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();
a=f.TweenTrackState.Create(this,a);this._tracks.push(a);this._track=this._tracks[0];return a}GetPropertyTrack(a){return this._track.GetPropertyTracks()[0]}SetPropertyType(a){this._propertyType=a}GetInstance(){var a=this.GetTracks();if(a&&a.length&&(this._track=a=a[0])){var c=a.GetInstance();return a.IsInstanceValid()?c:void 0}}AddStartedCallback(a){this._on_started_callbacks||(this._on_started_callbacks=[]);this._on_started_callbacks.push(a)}AddCompletedCallback(a){this._on_completed_callbacks||(this._on_completed_callbacks=
[]);this._on_completed_callbacks.push(a)}RemoveStartedCallback(a){this._on_started_callbacks&&(a=this._on_started_callbacks.indexOf(a),-1!==a&&this._on_started_callbacks.splice(a,1))}RemoveCompletedCallback(a){this._on_completed_callbacks&&(a=this._on_completed_callbacks.indexOf(a),-1!==a&&this._on_completed_callbacks.splice(a,1))}SetStartValue(a,c){for(const e of this._tracks)for(const h of e._propertyTracks){if(h.GetPropertyName()!==c)continue;var d=h.GetPropertyTrackData();const g=h.GetPropertyTrackDataItem();
d=d.GetFirstPropertyKeyframeDataItem(g);d.SetValue(a);d.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const c of this._tracks)for(const d of c._propertyTracks)if(d.GetPropertyName()===a)return d}BeforeSetEndValues(a){for(const e of a)a=this._GetPropertyTrackState(e),this.SetStartValue(a.GetCurrentState(),e);if(this.IsForwardPlayBack()){var c=this.GetTotalTime()-this.GetTime();this.SetTotalTime(c);for(var d of this._tracks)d.SetLocalTotalTime(c);this._SetTime(0)}else{d=this.GetTime();this.SetTotalTime(d);
for(c of this._tracks)c.SetLocalTotalTime(d);this._SetTime(d)}this.SetInitialStateFromSetTime()}SetEndValue(a,c){var d=this._GetPropertyTrackState(c);c=d.GetPropertyTrackData();d=d.GetPropertyTrackDataItem();c=c.GetLastPropertyKeyframeDataItem(d);c.SetTime(this.GetTotalTime());c.SetValue(a);c.SetAbsoluteValue(a)}SetId(a){this._id=a}GetId(){return this._id}SetInitialValueMode(a){this._initialValueMode=a}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(a){this._destroyInstanceOnComplete=
a}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const a of this._on_started_callbacks)a(this);if(!this.IsComplete())for(const a of this._tracks)a.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(!this._finishedTriggers&&(this._finishedTriggers=!0,this._on_completed_callbacks))for(const a of this._on_completed_callbacks)a(this)}SetTime(a){this._DeleteIntermediateKeyframes();
super.SetTime(a)}SetInitialState(a){if(!this.InitialStateSet()&&"current-state"===this.GetInitialValueMode())for(const c of this._tracks)c.CompareInitialStateWithCurrent();super.SetInitialState(a)}Stop(a=!1){super.Stop(a);if(!this.IsComplete())for(const c of this._tracks)c.SaveState()}Reset(a=!0,c=!1){this._DeleteIntermediateKeyframes();super.Reset(a,c)}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const c=d=>{d=d.GetTime();const e=this.GetTotalTime();return 0!==d&&d!==e};a.DeleteKeyframes(c);
a.DeletePropertyKeyframes(c)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const a=this.GetInstance();if(a&&a.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return!0}Tick(a,c,d){this._instance||(this._instance=this.GetInstance());if(this._instance&&!this._instance.IsDestroyed()&&(c=this._instance.GetTimeScale(),-1!==c&&(a=d*c),0!==a||0!==this._lastDelta)){this._lastDelta=a;d=this._playheadTime+a*this._playbackRate;
a=this._timelineDataItem._totalTime;this._playheadTime=0>d?0:d>=a?a:d;d=!1;c=this.GetLoop();var e=this.GetPingPong();c||e?c&&!e?0<this._playbackRate?this._playheadTime>=a&&this._SetTime(0):0>=this._playheadTime&&this._SetTime(a):!c&&e?0<this._playbackRate?this._playheadTime>=a&&(this._SetTime(a),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):d=!0:0===this._pingPongState&&(this._pingPongState=
1)):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):d=!0:0===this._pingPongState&&(this._pingPongState=1)):c&&e&&(0<this._playbackRate?this._playheadTime>=a&&(this._SetTime(a),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()))):0<this._playbackRate?this._playheadTime>=
a&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTime(0)):(this._SetTime(a),d=!0)):0>=this._playheadTime&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTime(a)):(this._SetTime(0),d=!0));d?(this._track.SetEndState(),this.Stop(!0),this.OnCompleted()):(this._track.Interpolate(this._playheadTime,!0,!1,!1,this._firstTick,!1),this._firstTick&&(this._firstTick=!1))}}_SaveToJson(){const a=super._SaveToJson(),c=this.GetTimelineDataItem();
return Object.assign(a,{tweenDataItemJson:c._SaveToJson(),id:this._id,destroyInstanceOnComplete:this._destroyInstanceOnComplete,initialValueMode:this._initialValueMode})}_LoadFromJson(a){a&&(this.GetTimelineDataItem()._LoadFromJson(a.tweenDataItemJson),super._LoadFromJson(a),this._id=a.id,this._destroyInstanceOnComplete=a.destroyInstanceOnComplete,this._initialValueMode=a.initialValueMode)}static IsPlaying(a){return a.IsPlaying()}static IsPaused(a){return a.IsPaused()}static Build(a){var c=a.runtime.GetTimelineManager(),
d=new f.TimelineDataItem;if(a.json){d._LoadFromJson(a.json.tweenDataItemJson);var e=new f.TweenState(d,c);e._LoadFromJson(a.json);return e}c=new f.TweenState(d,c);f.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]);c.SetId(a.id);c.SetTags(a.tags);c.SetInitialValueMode(a.initialValueMode);c.SetDestroyInstanceOnComplete(a.releaseOnComplete);c.SetLoop(a.loop);c.SetPingPong(a.pingPong);c.SetTotalTime(a.time);c.SetStep(0);c.SetInterpolationMode("default");c.SetResultMode(a.propertyTracksConfig[0].resultMode);
d=c.AddTrack();d.SetInstanceUID(a.instance.GetUID());d.SetInterpolationMode("default");d.SetResultMode(a.propertyTracksConfig[0].resultMode);d.SetEnable(!0);d.SetObjectClassIndex(a.instance.GetObjectClass().GetIndex());var h=a.instance.GetSdkInstance(),g=h.IsOriginalSizeKnown()?h.GetOriginalWidth():a.instance.GetWorldInfo().GetWidth();h=h.IsOriginalSizeKnown()?h.GetOriginalHeight():a.instance.GetWorldInfo().GetHeight();d.SetOriginalWidth(g);d.SetOriginalHeight(h);g=d.AddKeyframe();g.SetTime(0);g.SetEase("noease");
g.SetEnable(!0);g.SetTags("");g=d.AddKeyframe();g.SetTime(a.time);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");for(e of a.propertyTracksConfig)g=d.AddPropertyTrack(),g.SetSourceAdapterId(e.sourceId),g.SetSourceAdapterArgs(e.sourceArgs),g.SetPropertyName(e.property),g.SetPropertyType(e.type),g.SetMin(NaN),g.SetMax(NaN),g.SetInterpolationMode("default"),g.SetResultMode(e.resultMode),g.SetEnable(!0),h=g.AddPropertyKeyframe(),h.SetType(e.valueType),h.SetTime(0),h.SetEase(e.ease),h.SetEnable(!0),
h.SetValue(e.startValue),h.SetAbsoluteValue(e.startValue),h=g.AddPropertyKeyframe(),h.SetType(e.valueType),h.SetTime(a.time),h.SetEase(e.ease),h.SetEnable(!0),h.SetValue(e.endValue),h.SetAbsoluteValue(e.endValue),g.GetSourceAdapter();return c}}}
{"use strict";const f=self.C3;f.TweenTrackState=class extends f.TrackState{constructor(b,a){super(b,a);this._secondPropertyTrack=this._firstPropertyTrack=null}static Create(b,a){return f.New(f.TweenTrackState,b,a)}_CachePropertyTracks(){1===this._propertyTracks.length?this._firstPropertyTrack=this._propertyTracks[0]:(this._firstPropertyTrack=this._propertyTracks[0],this._secondPropertyTrack=this._propertyTracks[1])}CreatePropertyTrackStates(){for(const b of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(f.TweenPropertyTrackState.Create(this,
b));this._CachePropertyTracks()}AddPropertyTrack(){var b=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=f.TweenPropertyTrackState.Create(this,b);this._propertyTracks.push(b);this._CachePropertyTracks();return b}BeforeInterpolate(){}Interpolate(b,a,c=!1,d=!1,e,h=!1){this._instance||this.GetInstance();if(this._instance){if(this._instance.IsDestroyed()||h&&this.GetObjectClass().IsGlobal())return!1;this._secondPropertyTrack?(this._firstPropertyTrack.Interpolate(b,c,d),this._secondPropertyTrack.Interpolate(b,
c,d)):this._firstPropertyTrack.Interpolate(b,c,d);0!==this._firstPropertyTrack.GetWorldInfoChange()&&(this._worldInfo||(this._worldInfo=this._instance.GetWorldInfo()),this._worldInfo&&this._worldInfo.SetBboxChanged())}}AfterInterpolate(){}_LoadFromJson(b){super._LoadFromJson(b);this._CachePropertyTracks()}}}
{"use strict";const f=self.C3;f.TweenPropertyTrackState=class extends f.PropertyTrackState{constructor(b,a){super(b,a);this._basic=!1}static Create(b,a){return f.New(f.TweenPropertyTrackState,b,a)}Interpolate(b,a=!1,c=!1){if(this._basic){var d=this._propertyKeyframeDataItems[0];var e=this._propertyKeyframeDataItems[1]}else{if(a)d=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){e=this.GetTimeline();
const h=this._lastPropertyKeyframeDataItem.GetNext();d=this._lastPropertyKeyframeDataItem.GetTime();e=h?h.GetTime():e.GetTotalTime();if(b<=d||b>=e)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);d=this._lastPropertyKeyframeDataItem}e=d.GetNext()}this._sourceAdapter.Interpolate(b,
d,e,a,c)}AddPropertyKeyframe(){const b=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;this._basic=2>=this.GetPropertyKeyframeDataItems().length;return b}DeletePropertyKeyframes(b){this._lastPropertyKeyframeDataItem=null;this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b);this._basic=2>=this.GetPropertyKeyframeDataItems().length}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson(),
basic:this._basic}}_LoadFromJson(b){b&&(this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson),this._basic=b.basic)}}}
{"use strict";const f=self.C3,b=self.Ease;f.Transition=class extends f.DefendedBase{constructor(a){super();this._name=a[0];this._transitionKeyframes=[];for(var c of a[1])a=f.TransitionKeyframe.Create(this,c),this._transitionKeyframes.push(a);for(c=0;c<this._transitionKeyframes.length;c++)this._transitionKeyframes[c].SetNext(this._transitionKeyframes[c+1]);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();b.AddCustomEase(this._name,(d,e,h,g)=>this.Interpolate(d,
e,h,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 c=this._transitionKeyframeCache.get(a);if(c)return c;for(const d of this._transitionKeyframes)if(d.GetValueX()===a)return this._transitionKeyframeCache.set(a,
d),d}GetFirstTransitionKeyFrameHigherThan(a){for(const c of this._transitionKeyframes)if(c.GetValueX()>a)return c}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const c of this._transitionKeyframes)if(c.GetValueX()>=a)return c}GetFirstTransitionKeyFrameLowerThan(a){for(let c=this._transitionKeyframes.length-1;0<=c;c--){const d=this._transitionKeyframes[c];if(d.GetValueX()<a)return d}}GetFirstTransitionKeyFrameLowerOrEqualThan(a){for(let c=this._transitionKeyframes.length-1;0<=c;c--){const d=this._transitionKeyframes[c];
if(d.GetValueX()<=a)return d}}Interpolate(a,c,d,e){var h=a/e;a=this.GetFirstTransitionKeyFrameLowerOrEqualThan(h);e=a.GetNext();e||(a=this.GetFirstTransitionKeyFrameLowerThan(h),e=a.GetNext());var g=e.GetValueX()-a.GetValueX();h=f.mapToRange(h,a.GetValueX(),e.GetValueX(),0,g);g=a.GetValueX();const l=a.GetValueY(),m=a.GetValueX()+a.GetStartAnchorX(),u=a.GetValueY()+a.GetStartAnchorY(),w=e.GetValueX()+e.GetEndAnchorX(),q=e.GetValueY()+e.GetEndAnchorY(),t=e.GetValueX();e=e.GetValueY();e=b.GetRuntimeEase("spline")(h,
g,l,m,u,w,q,t,e,this._precalculatedSamples.get(a));e+=a.GetValueY();return(1-e)*c+e*(c+d)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let d=0;d<this._transitionKeyframes.length-1;d++){var a=this._transitionKeyframes[d];if(!a.GetStartEnable())continue;var c=this._transitionKeyframes[d+1];const e=a.GetValueX(),h=a.GetValueX()+a.GetStartAnchorX(),g=c.GetValueX()+c.GetEndAnchorX();c=c.GetValueX();this._precalculatedSamples.set(a,b.GetBezierSamples(e,h,g,c))}}}}
{"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];this._next=null}Release(){this._transition=null}static Create(b,a){return f.New(f.TransitionKeyframe,b,a)}SetNext(b){this._next=b}GetNext(){return this._next}GetValueX(){return this._valueX}GetValueY(){return this._valueY}GetStartAnchorX(){return this._startAnchorX}GetStartAnchorY(){return this._startAnchorY}GetEndAnchorX(){return this._endAnchorX}GetEndAnchorY(){return this._endAnchorY}GetStartEnable(){return this._startEnable}GetEndEnable(){return this._endEnable}}}
{"use strict";const 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 c=b[a];c.Copy(b[a-1]);this._current=c}Pop(){this._current=this._stack[--this._index]}RemoveInstances(b){const a=this._stack;for(let c=0,d=a.length;c<d;++c)a[c].RemoveInstances(b)}}}
{"use strict";const 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 c of a)b.has(c)||this._elseInstances.push(c)}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 c=++this._index;if(c===a.length)return b=f.New(f.EventStackFrame,this,b),a.push(b),b;a=a[c];a.Reset(b);return a}Pop(){--this._index}PushExpFunc(b){this._expFuncStack.push(b)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const b=this._expFuncStack;return 0===b.length?null:b.at(-1)}}}
{"use strict";const 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 c=this._index;0<=c;--c){const d=a[c];if(d.GetName()===b)return d}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}}
{"use strict";const 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(c,d){return c.GetIndex()-d.GetIndex()}function a(c,d){for(let e=0,h=c.length;e<h;++e)if(c[e]!==d[e])return!1;return!0}f.EventSheetManager=class extends f.DefendedBase{constructor(c){super();this._runtime=c;this._allSheets=[];this._sheetsByName=new Map;this._allGroups=[];this._groupsByName=new Map;this._blocksBySid=new Map;this._cndsBySid=new Map;this._actsBySid=new Map;this._allUniqueSolModifiers=new Map;this._eventVarsBySid=new Map;this._nextLocalVarIndex=
0;this._allGlobalVars=[];this._allLocalVars=[];this._localVarInitialValues=[];this._functionBlocksByName=new Map;this._eventStack=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=(d,e)=>this._InvokeFunctionFromJS(d,
e)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;f.clearArray(this._queuedTriggers);f.clearArray(this._queuedDebugTriggers);this._runtime=null;f.clearArray(this._allSheets);this._sheetsByName.clear()}Create(c){c=f.New(f.EventSheet,this,c);this._allSheets.push(c);this._sheetsByName.set(c.GetName().toLowerCase(),c)}_AddTriggerToPostInit(c){this._triggersToPostInit.push(c)}_PostInit(){for(const c of this._functionBlocksByName.values())c._PostInit(!1);
for(const c of this._allSheets)c._PostInit();for(const c of this._allSheets)c._UpdateDeepIncludes();for(const c of this._triggersToPostInit)c._PostInit(!1);f.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(c){return this._sheetsByName.get(c.toLowerCase())||null}_RegisterGroup(c){this._allGroups.push(c);this._groupsByName.set(c.GetGroupName(),c)}_RegisterEventBlock(c){this._blocksBySid.set(c.GetSID(),
c)}_RegisterCondition(c){this._cndsBySid.set(c.GetSID(),c)}_RegisterAction(c){this._actsBySid.set(c.GetSID(),c)}_RegisterFunctionBlock(c){this._functionBlocksByName.set(c.GetFunctionName().toLowerCase(),c)}_RegisterEventVariable(c){this._eventVarsBySid.set(c.GetSID(),c);c.IsGlobal()?this._allGlobalVars.push(c):this._allLocalVars.push(c)}_DeduplicateSolModifierList(c){2<=c.length&&c.sort(b);let d=this._allUniqueSolModifiers.get(c.length);d||(d=[],this._allUniqueSolModifiers.set(c.length,d));for(let e=
0,h=d.length;e<h;++e){const g=d[e];if(a(c,g))return g}d.push(c);return c}_GetNextLocalVarIndex(c){this._localVarInitialValues.push(c.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const c=this.GetCurrentEventStackFrame();return c.GetCurrentEvent().GetConditionAt(c.GetConditionIndex())}GetCurrentAction(){const c=
this.GetCurrentEventStackFrame();return c.GetCurrentEvent().GetActionAt(c.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetAllLocalVariablesInScope(c){const d=[];for(c=c.GetScopeParent();c;)f.appendArray(d,c._GetAllLocalVariablesInScope()),c=c.GetScopeParent();return d}_GetLocalVariablesScriptInterface(c){const d={};for(const e of this.GetAllLocalVariablesInScope(c))d[e.GetJsPropName()]=e._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,
d)}GetEventVariableBySID(c){return this._eventVarsBySid.get(c)||null}GetEventBlockBySID(c){return this._blocksBySid.get(c)||null}GetConditionBySID(c){return this._cndsBySid.get(c)||null}GetActionBySID(c){return this._actsBySid.get(c)||null}GetFunctionBlockByName(c){return this._functionBlocksByName.get(c.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const c of this._allGlobalVars)c.ResetToInitialValue()}GetEventGroupByName(c){return this._groupsByName.get(c.toLowerCase())||
null}GetEventGroupBySID(c){return(c=this._blocksBySid.get(c))&&c.IsGroup()?c:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const c of this._allGroups)c.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const c of this._allSheets)c._ResetHasRunFlag()}RunEvents(c){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const d of c.runningLayouts())if(c=d.GetEventSheet())this._runtime.PushCurrentLayout(d),c.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(c){this._ResetAllHasRunFlags();
this._runningEventsDepth++;for(const d of this._DebugRunEventsGen(c))await this._runtime.DebugBreak(d);this._runningEventsDepth--}*_DebugRunEventsGen(c){for(const d of c.runningLayouts())if(c=d.GetEventSheet())this._runtime.PushCurrentLayout(d),yield*c.DebugRun(),this._runtime.PopCurrentLayout()}_Trigger(c,d,e,h){let g=!1;if(!c.GetMainRunningLayout())return this.QueueTrigger(d,e,h);this._executingTriggerDepth++;for(const l of c.runningLayouts())if(c=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);
for(const m of c.deepIncludes()){const u=m._Trigger(d,e,h);g=g||u}c=c._Trigger(d,e,h);g=g||c;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return g}*_DebugTrigger(c,d,e,h){let g=!1;if(!c.GetMainRunningLayout())return this.QueueTrigger(d,e,h);this._executingTriggerDepth++;for(const l of c.runningLayouts())if(c=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);for(const m of c.deepIncludes()){const u=yield*m._DebugTrigger(d,e,h);g=g||u}c=yield*c._DebugTrigger(d,e,h);g=g||c;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;
return g}QueueTrigger(c,d,e){this._queuedTriggers.push([c,d,e]);return!1}QueueDebugTrigger(c,d,e){let h=null;const g=new Promise(l=>h=l);this._queuedDebugTriggers.push([c,d,e,h]);return g}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const c=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [d,e,h,g]=this._queuedDebugTriggers.shift(),l=yield*this._DebugTrigger(c,d,e,h);g(l)}}async RunQueuedDebugTriggersAsync(){for(const c of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(c)}_FastTrigger(c,
d,e,h){let g=!1;var l=c.GetMainRunningLayout();if(c=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=c.deepIncludes();for(let m=0,u=l.length;m<u;++m){const w=l[m]._FastTrigger(d,e,h);g=g||w}d=c._FastTrigger(d,e,h);g=g||d;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}*_DebugFastTrigger(c,d,e,h){let g=!1;var l=c.GetMainRunningLayout();if(c=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=c.deepIncludes();
for(let m=0,u=l.length;m<u;++m){const w=yield*l[m]._DebugFastTrigger(d,e,h);g=g||w}d=yield*c._DebugFastTrigger(d,e,h);g=g||d;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}GetTriggerDepth(){return this._executingTriggerDepth}IsInTrigger(){return 0<this.GetTriggerDepth()}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return 0<this._runningEventsDepth}IsInEventEngine(){return this.IsRunningEvents()||
this.IsInTrigger()}_RunQueuedTriggers(c){for(const [d,e,h]of this._queuedTriggers)this._Trigger(c,d,e,h);f.clearArray(this._queuedTriggers)}BlockFlushingInstances(c){c?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(c){for(let d=0,e=c.length;d<e;++d)c[d].GetSolStack().Clear()}PushCleanSol(c){for(let d=0,e=c.length;d<e;++d)c[d].GetSolStack().PushClean()}PushCopySol(c){for(let d=0,e=c.length;d<e;++d)c[d].GetSolStack().PushCopy()}PopSol(c){for(let d=
0,e=c.length;d<e;++d)c[d].GetSolStack().Pop()}AddScheduledWait(){const c=f.New(f.ScheduledWait,this);this._scheduledWaits.push(c);return c}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var c=this.GetCurrentEventStackFrame(),d=!1;this._runningEventsDepth++;for(let e=0,h=this._scheduledWaits.length;e<h;++e){const g=this._scheduledWaits[e];g._ShouldRun()&&g._Run(c);g.ShouldRelease()&&(d=!0)}d&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var c=
this.GetCurrentEventStackFrame(),d=!1;this._runningEventsDepth++;for(let e=0,h=this._scheduledWaits.length;e<h;++e){const g=this._scheduledWaits[e];g._ShouldRun()&&await g._DebugRun(c);g.ShouldRelease()&&(d=!0)}d&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const c=f.arrayFilterOut(this._scheduledWaits,d=>d.ShouldRelease());for(const d of c)d.Release()}ClearAllScheduledWaits(){for(const c of this._scheduledWaits)c.Release();f.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(c){for(const d of this._scheduledWaits)d.RemoveInstances(c)}AddAsyncActionPromise(c){this._asyncActionPromises.push(c)}ClearAsyncActionPromises(){f.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const c=
Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return c}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(c){this._LoadGroupsFromJson(c.groups);this._LoadCndsFromJson(c.cnds);this._LoadActsFromJson(c.acts);this._LoadVarsFromJson(c.vars);this._LoadScheduledWaitsFromJson(c.waits)}_SaveGroupsToJson(){const c={};for(const d of this.GetAllGroups())c[d.GetSID().toString()]=
d.IsGroupActive();return c}_LoadGroupsFromJson(c){for(const [d,e]of Object.entries(c))c=parseInt(d,10),(c=this.GetEventGroupBySID(c))&&c.SetGroupActive(e)}_SaveCndsToJson(){const c={};for(const [d,e]of this._cndsBySid){const h=e._SaveToJson();h&&(c[d.toString()]=h)}return c}_LoadCndsFromJson(c){const d=new Map;for(const [e,h]of Object.entries(c))d.set(parseInt(e,10),h);for(const [e,h]of this._cndsBySid)h._LoadFromJson(d.get(e)||null)}_SaveActsToJson(){const c={};for(const [d,e]of this._actsBySid){const h=
e._SaveToJson();h&&(c[d.toString()]=h)}return c}_LoadActsFromJson(c){const d=new Map;for(const [e,h]of Object.entries(c))d.set(parseInt(e,10),h);for(const [e,h]of this._actsBySid)h._LoadFromJson(d.get(e)||null)}_SaveVarsToJson(){const c={};for(const [d,e]of this._eventVarsBySid)e.IsConstant()||!e.IsGlobal()&&!e.IsStatic()||(c[d.toString()]=e.GetValue());return c}_LoadVarsFromJson(c){for(const [d,e]of Object.entries(c))c=parseInt(d,10),(c=this.GetEventVariableBySID(c))&&c.SetValue(e)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(c=>
!c.IsPromise()).map(c=>c._SaveToJson())}_LoadScheduledWaitsFromJson(c){this.ClearAllScheduledWaits();for(const d of c)(c=f.ScheduledWait._CreateFromJson(this,d))&&this._scheduledWaits.push(c)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(c=>c.GetEventSheet()).filter(c=>c).map(c=>c._GetPerfRecord())}FindFirstFunctionBlockParent(c){for(;c;)if(c=c.GetScopeParent(),c instanceof f.FunctionBlock)return c;return null}_InvokeFunctionFromJS(c,d){Array.isArray(d)||(d=[]);
c=this.GetFunctionBlockByName(c.toLowerCase());if(!c)return null;if(!c.IsEnabled())return c.GetDefaultReturnValue();var e=c.GetFunctionParameters();if(d.length<e.length){d=d.slice(0);do d.push(e[d.length].GetInitialValue());while(d.length<e.length)}e=c.GetEventBlock();return e.RunAsExpressionFunctionCall(e.GetSolModifiersIncludingParents(),c.GetReturnType(),c.GetDefaultReturnValue(),...d)}}}
{"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 c of a[1])this._CreateEvent(c,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0,
children:[]}:null}Release(){this._runtime=this._eventSheetManager=null}_CreateEvent(b,a,c){switch(b[0]){case 0:case 3:this._CreateEventBlock(b,a,c);break;case 1:this._CreateEventVariable(b,a,c);break;case 2:this._CreateInclude(b,a,c);break;case 4:this._CreateFunctionBlock(b,a);break;case 5:this._CreateScriptBlock(b,a,c);break;default:throw Error("invalid event type");}}_CreateEventBlock(b,a,c){b=f.EventBlock.Create(this,a,b);if(b.IsOrBlock()){c.push(b);c=b.GetConditions();for(let d=0,e=c.length;d<
e;++d)c[d].IsTrigger()&&this._InitTrigger(b,d)}else b.IsTrigger()?this._InitTrigger(b,0):c.push(b)}_CreateFunctionBlock(b,a){b=f.FunctionBlock.Create(this,a,b);this._eventSheetManager._RegisterFunctionBlock(b)}_CreateEventVariable(b,a,c){b=f.EventVariable.Create(this,a,b);c.push(b)}_CreateInclude(b,a,c){b=f.EventInclude.Create(this,a,b);c.push(b)}_CreateScriptBlock(b,a,c){b=f.EventScript.Create(this,a,b);c.push(b)}_InitTrigger(b,a){b.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(b);var c=
b.GetConditionAt(a),d=c._GetFunc(),e=c.GetObjectClass();if(c.IsFastTrigger()){var h=this._fastTriggers.get(e);h||(h=new Map,this._fastTriggers.set(e,h));c=c.GetFastTriggerValue().toLowerCase();e=h.get(d);e||(e=new Map,h.set(d,e));d=e.get(c);d||(d=[],e.set(c,d));d.push([b,a])}else h=this._triggers.get(e),h||(h={methodMap:new Map,behaviors:new Map},this._triggers.set(e,h)),(e=c.GetBehaviorType())?(c=h.behaviors.get(e),c||(c=new Map,h.behaviors.set(e,c))):c=h.methodMap,h=c.get(d),h||(h=[],c.set(d,h)),
h.push([b,a])}_PostInit(){const b=this._events;for(let a=0,c=b.length;a<c;++a){const d=a<c-1&&b[a+1]instanceof f.EventBlock&&b[a+1].IsElseBlock();b[a]._PostInit(d)}}_AddShallowInclude(b){this._shallowIncludes.push(b)}_UpdateDeepIncludes(){f.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(b){const a=b._deepIncludes,c=b._alreadyIncludedSheets;for(const d of this._shallowIncludes){const e=d.GetIncludeSheet();d.IsActive()&&b!==e&&!c.has(e)&&
(c.add(e),e._AddDeepIncludes(b),a.push(e))}}deepIncludes(){return this._deepIncludes}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetName(){return this._name}_RegisterEventByDisplayNumber(b,a){this._eventsByDisplayNumber.set(a,b)}_GetEventByDisplayNumber(b){return this._eventsByDisplayNumber.get(b)||null}_ResetHasRunFlag(){this._hasRun=!1}Run(){if(!this._hasRun){var b=this._runtime,a=b.IsCPUProfiling(),c=a?performance.now():0;this._hasRun=!0;var d=this.GetEventSheetManager(),
e=d.GetCurrentEventStackFrame();for(const h of this._events)h.Run(e),d.ClearSol(h.GetSolModifiers()),d.ClearAsyncActionPromises(),b.FlushPendingInstances();e.Reset(null);a&&(this._perfRecord.totalTimeCounter+=performance.now()-c)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var b=this._runtime,a=this.GetEventSheetManager(),c=a.GetCurrentEventStackFrame();for(const d of this._events)yield*d.DebugRun(c),a.ClearSol(d.GetSolModifiers()),a.ClearAsyncActionPromises(),b.FlushPendingInstances();c.Reset(null)}}_Trigger(b,
a,c){if(a){const d=a.GetObjectClass();this._TriggerForClass(b,a,d,c);for(const e of d.GetFamilies())this._TriggerForClass(b,a,e,c)}else return this._TriggerForClass(b,a,null,null)}_TriggerForClass(b,a,c,d){c=this._triggers.get(c);if(!c)return!1;d=d?c.behaviors.get(d):c.methodMap;if(!d)return!1;d=d.get(b);if(!d)return!1;b=!1;for(const [e,h]of d)d=this._ExecuteTrigger(a,e,h),b=b||d;return b}*_DebugTrigger(b,a,c){if(a){const d=a.GetObjectClass();yield*this._DebugTriggerForClass(b,a,d,c);for(const e of d.GetFamilies())yield*this._DebugTriggerForClass(b,
a,e,c)}else return yield*this._DebugTriggerForClass(b,a,null,null)}*_DebugTriggerForClass(b,a,c,d){c=this._triggers.get(c);if(!c)return!1;d=d?c.behaviors.get(d):c.methodMap;if(!d)return!1;d=d.get(b);if(!d)return!1;b=!1;for(const [e,h]of d)d=e.DebugCanRunFast()?this._ExecuteTrigger(a,e,h):yield*this._DebugExecuteTrigger(a,e,h),b=b||d;return b}_FastTrigger(b,a,c){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;c=b.get(c);if(!c)return!1;b=!1;for(let d=0,e=c.length;d<
e;++d)a=c[d],a=this._ExecuteTrigger(null,a[0],a[1]),b=b||a;return b}*_DebugFastTrigger(b,a,c){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;c=b.get(c);if(!c)return!1;b=!1;for(let e=0,h=c.length;e<h;++e){var d=c[e];a=d[0];d=d[1];a=a.DebugCanRunFast()?this._ExecuteTrigger(null,a,d):yield*this._DebugExecuteTrigger(null,a,d);b=b||a}return b}_ExecuteTrigger(b,a,c){const d=this._runtime,e=this._eventSheetManager,h=e.GetCurrentEvent(),g=e.GetEventStack(),l=e.GetTriggerDepth();
let m=!1;h&&e.PushCleanSol(h.GetSolModifiersIncludingParents());e.PushCleanSol(a.GetSolModifiersIncludingParents());const u=1<l;u&&e.GetLocalVarStack().Push();const w=g.Push(a);b&&(a.GetConditions()[c].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const q=a.GetTriggerParents();for(let t=0,p=q.length;t<p;++t)if(!q[t].RunPreTrigger(w)){b=!1;break}}b&&(d.IncrementExecCount(),a.IsOrBlock()?a.RunOrBlockTrigger(w,c):a.Run(w),m=
w.GetLastEventTrue());g.Pop();u&&e.GetLocalVarStack().Pop();e.PopSol(a.GetSolModifiersIncludingParents());h&&e.PopSol(h.GetSolModifiersIncludingParents());h||1!==l||(e.ClearAsyncActionPromises(),e.IsFlushingBlocked()||d.FlushPendingInstances());return m}*_DebugExecuteTrigger(b,a,c){const d=this._runtime,e=this._eventSheetManager,h=e.GetCurrentEvent(),g=e.GetEventStack(),l=e.GetTriggerDepth();let m=!1;h&&e.PushCleanSol(h.GetSolModifiersIncludingParents());e.PushCleanSol(a.GetSolModifiersIncludingParents());
const u=1<l;u&&e.GetLocalVarStack().Push();const w=g.Push(a);b&&(a.GetConditions()[c].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const q=a.GetTriggerParents();for(let t=0,p=q.length;t<p;++t)if(!(yield*q[t].DebugRunPreTrigger(w))){b=!1;break}}b&&(d.IncrementExecCount(),a.IsOrBlock()?yield*a.DebugRunOrBlockTrigger(w,c):yield*a.DebugRun(w),m=w.GetLastEventTrue());g.Pop();u&&e.GetLocalVarStack().Pop();e.PopSol(a.GetSolModifiersIncludingParents());
h&&e.PopSol(h.GetSolModifiersIncludingParents());h||1!==l||(e.ClearAsyncActionPromises(),e.IsFlushingBlocked()||d.FlushPendingInstances());return m}_GetPerfRecord(){return this._perfRecord}}}
{"use strict";const f=self.C3,b=[];function a(d,e){return!0}function*c(d,e){return!0}f.EventBlock=class extends f.DefendedBase{constructor(d,e,h){super();this._eventSheet=d;this._runtime=d.GetRuntime();this._parent=e;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=!1;this._isOrBlock=!!h[2];
this._isElseBlock=!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=a;this._DebugRunActions=c;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=h[4];this._displayNumber=h[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:h[3][0],isBreakable:h[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,
canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===h[0]&&this._InitGroup(h[1]);d=0;for(var g of h[6])e=f.Condition.Create(this,g,d++),this._conditions.push(e),this._AddSolModifier(e.GetObjectClass());d=0;for(const l of h[7])g=f.Action.Create(this,l,d++),this._actions.push(g);if(9===h.length){h=h[8];for(const l of h)this._eventSheet._CreateEvent(l,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&&
this._conditions[0]._GetFunc()===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(d,e,h){return f.New(f.EventBlock,d,e,h)}_InitGroup(d){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!d[0];this._groupName=d[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);this._runtime.IsDebug()&&(this._perfRecord={type:"group",
name:d[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(d){this._containedIncludes.push(d)}_AddContainerSolModifierToList(d,e){for(const h of d.GetContainer().objectTypes())e.includes(h)||e.push(h)}_AddSolModifierToList(d,e){if(d)if(e.includes(d)||e.push(d),d.IsFamily())for(const h of d.GetFamilyMembers())h.IsInContainer()&&this._AddContainerSolModifierToList(h,e);else d.IsInContainer()&&this._AddContainerSolModifierToList(d,e)}_AddSolModifier(d){this._AddSolModifierToList(d,this._solModifiers)}_AddParentSolModifier(d){this._AddSolModifierToList(d,
this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(d){this._hasElseBlock=!!d;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const h of this._conditions)h._PostInit();if(0<this._actions.length){d=!1;for(var e of this._actions)e._PostInit(),e.HasReturnType()&&(d=!0);d?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions=
this._DebugRunActions_Fast)}e=this._subEvents;for(let h=0,g=e.length;h<g;++h)d=h<g-1&&e[h+1]instanceof f.EventBlock&&e[h+1].IsElseBlock(),e[h]._PostInit(d);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let d=this.GetParent();for(;d;){if(d.IsGroup())return d;d=d.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const d=this._debugData;d.canRunAllConditionsFast=
this._conditions.every(e=>e.DebugCanRunFast());d.canRunAllActionsFast=this._actions.every(e=>e.DebugCanRunFast());d.canRunAllSubEventsFast=this._subEvents.every(e=>e.DebugCanRunFast());d.canRunSelfFast=d.canRunAllConditionsFast&&d.canRunAllActionsFast&&d.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let d=this;do d._UpdateCanRunFast(),d=d.GetParent();while(d)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var d=this.GetParent();for(this._isTopLevelGroup=!0;d;){if(!d.IsGroup()){this._isTopLevelGroup=
!1;break}d=d.GetParent()}}}_IdentifySolModifiersIncludingParents(){var d=this._runtime.GetAllObjectClasses();if(this._solModifiers===d)this._solModifiersIncludingParents=d;else{this._solModifiersIncludingParents=f.cloneArray(this._solModifiers);for(d=this.GetParent();d;){for(var e of d._solModifiers)this._AddParentSolModifier(e);d=d.GetParent()}e=this.GetEventSheetManager();this._solModifiers=e._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=e._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=
[];for(var d=this.GetParent();d;)this._triggerParents.push(d),d=d.GetParent();this._triggerParents.reverse()}}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds=!0;this._parent&&this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){this._hasGotSolModifiersIncludingParents||(this._hasGotSolModifiersIncludingParents=!0,this._IdentifySolModifiersIncludingParents());return this._solModifiersIncludingParents}HasSolModifier(d){return this._solModifiers.includes(d)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(d){this._scopeParent=
d}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(d){this._debugData.isBreakpoint=!!d;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(d){d=
!!d;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==d){this._isGroupActive=d;for(const e of this._containedIncludes)e.UpdateActive();this._containedIncludes.length&&(d=this._runtime.GetCurrentLayout().GetEventSheet())&&d._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&&this._scopeParent instanceof f.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||
this._conditions.some(d=>d.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(d){d=Math.floor(d);if(0>d||d>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[d]}GetConditionByDebugIndex(d){return this.GetConditionAt(d)}IsFirstConditionOfType(d){let e=d.GetIndex();if(0===e)return!0;for(--e;0<=e;--e)if(this._conditions[e].GetObjectClass()===d.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(d){d=
Math.floor(d);if(0>d||d>=this._actions.length)throw new RangeError("invalid action index");return this._actions[d]}GetActionByDebugIndex(d){d=Math.floor(d);const e=this._actions.find(h=>h.GetDebugIndex()===d);if(!e)throw new RangeError("invalid action debug index");return e}_HasActionIndex(d){d=Math.floor(d);return 0<=d&&d<this._actions.length}GetSubEvents(){return this._subEvents}_GetAllLocalVariablesInScope(){return this._subEvents.filter(d=>d instanceof f.EventVariable)}RunPreTrigger(d){d.SetCurrentEvent(this);
let e=!1;const h=this._conditions;for(let g=0,l=h.length;g<l;++g){const m=h[g];d.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.Run())e=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?e:!0}RunOrBlockTrigger(d,e){d.SetCurrentEvent(this);this._conditions[e].Run()&&(this._RunActions(d,0)&&this._RunSubEvents(d),d.SetLastEventTrue(!0))}*DebugRunPreTrigger(d){d.SetCurrentEvent(this);let e=!1;const h=this._conditions;for(let g=0,l=h.length;g<
l;++g){const m=h[g];d.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.DebugCanRunFast()?m.Run():yield*m.DebugRun())e=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?e:!0}*DebugRunOrBlockTrigger(d,e){d.SetCurrentEvent(this);e=this._conditions[e];if(e.DebugCanRunFast()?e.Run():yield*e.DebugRun())(this.DebugCanRunActionsFast()?this._RunActions(d,0):yield*this._DebugRunActions(d,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():
yield*this._DebugRunSubEvents()),d.SetLastEventTrue(!0)}Run(d){d.SetCurrentEvent(this);this._isElseBlock||d.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(d):this._RunAndBlock(d)}*DebugRun(d){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;d.SetCurrentEvent(this);this._isElseBlock||d.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(d):yield*this._DebugRunAndBlock(d)}_RunOrBlock(d){const e=this._conditions;let h=0===e.length;for(let l=0,m=e.length;l<m;++l){var g=
e[l];g.IsTrigger()||(d.SetConditionIndex(l),g=g.Run(),h=h||g)}d.SetLastEventTrue(h);h&&(this._RunActions(d,0)&&this._RunSubEvents(d),this._hasElseBlock&&d.SetElseBranchRan(!0))}*_DebugRunOrBlock(d){const e=this._conditions;let h=0===e.length;for(let l=0,m=e.length;l<m;++l){var g=e[l];g.IsTrigger()||(d.SetConditionIndex(l),g=g.DebugCanRunFast()?g.Run():yield*g.DebugRun(),h=h||g)}d.SetLastEventTrue(h);h&&((this.DebugCanRunActionsFast()?this._RunActions(d,0):yield*this._DebugRunActions(d,0))&&(this.DebugCanRunSubEventsFast()?
this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&d.SetElseBranchRan(!0))}_RunAndBlock(d){const e=this._conditions;for(let h=0,g=e.length;h<g;++h){const l=e[h];d.SetConditionIndex(h);if(!l.Run()){d.SetLastEventTrue(!1);return}}d.SetLastEventTrue(!0);this._RunActions(d,0)&&this._RunSubEvents(d);d.GetLastEventTrue()&&this._hasElseBlock&&d.SetElseBranchRan(!0)}*_DebugRunAndBlock(d){const e=this._conditions;for(let h=0,g=e.length;h<g;++h){const l=e[h];d.SetConditionIndex(h);if(l.DebugCanRunFast()?
!l.Run():!(yield*l.DebugRun())){d.SetLastEventTrue(!1);return}}d.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(d,0):yield*this._DebugRunActions(d,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());d.GetLastEventTrue()&&this._hasElseBlock&&d.SetElseBranchRan(!0)}_RunActions_Fast(d,e){const h=this._actions;for(let g=e,l=h.length;g<l;++g)e=h[g],d.SetActionIndex(g),e.Run();return!0}*_DebugRunActions_Fast(d,e){const h=this._actions;for(let g=
e,l=h.length;g<l;++g)e=h[g],d.SetActionIndex(g),e.DebugCanRunFast()?e.Run():yield*e.DebugRun();return!0}_RunActions_ReturnValue(d,e){const h=this.GetEventSheetManager(),g=this._actions;for(let l=e,m=g.length;l<m;++l){e=g[l];d.SetActionIndex(l);const u=e.Run();if(e.CanBailOut()&&!0===u)return!1;e.IsAsync()&&u instanceof Promise&&h.AddAsyncActionPromise(u)}return!0}*_DebugRunActions_ReturnValue(d,e){const h=this.GetEventSheetManager(),g=this._actions;for(let l=e,m=g.length;l<m;++l){e=g[l];d.SetActionIndex(l);
let u;u=e.DebugCanRunFast()?e.Run():yield*e.DebugRun();if(e.CanBailOut()&&!0===u)return!1;e.IsAsync()&&u instanceof Promise&&h.AddAsyncActionPromise(u)}return!0}_ResumeActionsAndSubEvents(d){this._RunActions(d,d.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(d){if(yield*this._DebugRunActions(d,d.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var d=this.IsGroup()&&this._runtime.IsCPUProfiling(),e=d?performance.now():0,h=this._eventStack,
g=h.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(g):this._RunSubEvents_Fast(g);h.Pop();d&&(this._perfRecord.totalTimeCounter+=performance.now()-e)}}_RunSubEvents_SolWriterAfterCnds(d){const e=this._isGroup,h=this._isTopLevelGroup,g=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,u=l.length,w=u-1;m<u;++m){const q=l[m],t=q.GetSolModifiers(),p=!h||!e&&m<w;p&&g.PushCopySol(t);q.Run(d);p?g.PopSol(t):g.ClearSol(t)}}_RunSubEvents_Fast(d){const e=this._subEvents;for(let h=
0,g=e.length;h<g;++h)e[h].Run(d)}*_DebugRunSubEvents(){if(this._subEvents.length){var d=this._eventStack,e=d.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(e):yield*this._DebugRunSubEvents_Fast(e);d.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(d){const e=this._isGroup,h=this._isTopLevelGroup,g=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,u=l.length,w=u-1;m<u;++m){const q=l[m],t=q.GetSolModifiers(),p=!h||!e&&m<w;p&&g.PushCopySol(t);yield*q.DebugRun(d);
p?g.PopSol(t):g.ClearSol(t)}}*_DebugRunSubEvents_Fast(d){const e=this._subEvents;for(let h=0,g=e.length;h<g;++h)yield*e[h].DebugRun(d)}Retrigger(d,e){this._runtime.IncrementExecCount();e.ResetQuick();const h=this._conditions;if(!this.IsOrBlock())for(let g=d.GetConditionIndex()+1,l=h.length;g<l;++g)if(d=h[g],e.SetConditionIndex(g),!d.Run())return!1;this._RunActions(e,0)&&this._RunSubEvents(e);return!0}*DebugRetrigger(d,e){this._runtime.IncrementExecCount();e.ResetQuick();const h=this._conditions;if(!this.IsOrBlock())for(let g=
d.GetConditionIndex()+1,l=h.length;g<l;++g)if(d=h[g],e.SetConditionIndex(g),d.DebugCanRunFast()?!d.Run():!(yield*d.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(e,0):yield*this._DebugRunActions(e,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());return!0}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()&&this._debugData.canRunSelfFast}DebugCanRunActionsFast(){return!this._runtime.DebugBreakNext()&&this._debugData.canRunAllActionsFast}DebugCanRunSubEventsFast(){return!this._runtime.DebugBreakNext()&&
this._debugData.canRunAllSubEventsFast}_CheckParentsOKToRun(d){if(this.GetParent()){const e=this.GetTriggerParents();for(let h=0,g=e.length;h<g;++h)if(!e[h].RunPreTrigger(d))return!1}return!0}*_DebugCheckParentsOKToRun(d){if(this.GetParent()){const e=this.GetTriggerParents();for(let h=0,g=e.length;h<g;++h)if(!(yield*e[h].DebugRunPreTrigger(d)))return!1}return!0}_EvaluateFunctionCallParameters(d,e,h){0<e.length?h?(e=e.map(g=>g.Get(0)),d.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(e)):
this._scopeParent.EvaluateFunctionParameters(e):h&&d.GetLocalVarStack().Push()}RunAsFunctionCall(d,e){let h,g;const l=0<d.length;var m=this._runtime;const u=this._eventStack,w=m.GetEventSheetManager(),q=1<w._IncTriggerDepth();this._EvaluateFunctionCallParameters(w,e,q);l&&w.PushCleanSol(d);e=u.Push(this);this._CheckParentsOKToRun(e)&&(m.IncrementExecCount(),e.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&([g,h]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(e),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g));
u.Pop();q&&w.GetLocalVarStack().Pop();l&&w.PopSol(d);w._DecTriggerDepth();return h}*DebugRunAsFunctionCall(d,e){let h,g;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const l=0<d.length;var m=this._runtime;const u=this._eventStack,w=m.GetEventSheetManager(),q=1<w._IncTriggerDepth();this._EvaluateFunctionCallParameters(w,e,q);l&&w.PushCleanSol(d);e=u.Push(this);if(yield*this._DebugCheckParentsOKToRun(e))m.IncrementExecCount(),e.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&
([g,h]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(e),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g);u.Pop();q&&w.GetLocalVarStack().Pop();l&&w.PopSol(d);w._DecTriggerDepth();return h}RunAsMappedFunctionCall(d){const e=this.GetSolModifiersIncludingParents(),h=0<e.length,g=this._runtime,l=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(d);h&&m.PushCleanSol(e);d=l.Push(this);
this._CheckParentsOKToRun(d)&&(g.IncrementExecCount(),d.SetCurrentEvent(this),this._RunAndBlock(d));l.Pop();u&&m.GetLocalVarStack().Pop();h&&m.PopSol(e);m._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(d){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const e=this.GetSolModifiersIncludingParents(),h=0<e.length,g=this._runtime,l=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(d);h&&
m.PushCleanSol(e);d=l.Push(this);if(yield*this._DebugCheckParentsOKToRun(d))g.IncrementExecCount(),d.SetCurrentEvent(this),yield*this._DebugRunAndBlock(d);l.Pop();u&&m.GetLocalVarStack().Pop();h&&m.PopSol(e);m._DecTriggerDepth()}RunAsExpressionFunctionCall(d,e,h,...g){let l,m;const u=0<d.length,w=this._runtime,q=this._eventStack,t=w.GetEventSheetManager(),p=1<t._IncTriggerDepth();p&&t.GetLocalVarStack().Push();0<g.length&&this._scopeParent.SetFunctionParameters(g);u&&t.PushCleanSol(d);g=q.Push(this);
g.InitCallFunctionExpression(e,h);q.PushExpFunc(g);w.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(g)&&(w.IncrementExecCount(),g.SetCurrentEvent(this),(e=this._scopeParent.IsAsync())&&([m,l]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(g),e&&this._scopeParent.MaybeFinishAsyncFunctionCall(m));w.SetDebuggingEnabled(!0);q.Pop();q.PopExpFunc();p&&t.GetLocalVarStack().Pop();u&&t.PopSol(d);t._DecTriggerDepth();return l||g.GetFunctionReturnValue()}}}
{"use strict";const f=self.C3,b=[];let a=!1;f.EventScript=class extends f.DefendedBase{constructor(c,d,e){super();const h=c.GetRuntime(),g=c.GetEventSheetManager();this._eventSheet=c;this._eventSheetManager=g;this._runtime=c.GetRuntime();this._parent=d;this._func=h.GetObjectReference(e[1]);this._displayNumber=e[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=h.IsDebug()?{isBreakpoint:e[3][0],isBreakable:e[3][1]}:null}static Create(c,d,e){return f.New(f.EventScript,
c,d,e)}_PostInit(){const c=this._func,d=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=c.bind(null,this._runtime.GetIRuntime(),d)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(c){this._debugData.isBreakpoint=
!!c}IsElseBlock(){return!1}GetSolModifiers(){return b}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():b}Run(c){c.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(c){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",c),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
a||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),a=!0)}}*DebugRun(c){c.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(c)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return a}static SetHadUserScriptException(){a=!0}}}
{"use strict";const f=self.C3;f.FunctionBlock=class extends f.DefendedBase{constructor(b,a,c){super();this._eventSheet=b;this._runtime=b.GetRuntime();this._parent=a;const d=c[1];this._functionName=d[0];this._returnType=d[1];this._functionParameters=d[2].map(e=>f.EventVariable.Create(b,this,e));this._isEnabled=d[3];this._innerLocalVariables=[];this._isAsync=d[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=f.EventBlock.Create(b,a,c);this._eventBlock._SetScopeParent(this)}static Create(b,
a,c){return f.New(f.FunctionBlock,b,a,c)}_PostInit(){for(const b of this._functionParameters)b._PostInit();this._eventBlock._PostInit(!1)}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(b){this._innerLocalVariables.push(b)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(b){const a=this._functionParameters;
for(let c=0,d=a.length;c<d;++c)a[c].SetValue(b[c].Get(0))}SetFunctionParameters(b){const a=this._functionParameters;for(let c=0,d=a.length;c<d;++c)a[c].SetValue(b[c])}CaptureFunctionParameters(){return this._functionParameters.map(b=>b.GetValue())}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetFunctionName(){return this._functionName}GetReturnType(){return this._returnType}IsEnabled(){return this._isEnabled}GetDefaultReturnValue(){switch(this._returnType){case 0:return null;
case 2:return"";default:return 0}}GetEventBlock(){return this._eventBlock}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const b=this._nextAsyncId++;this._currentAsyncId=b;let a;const c=new Promise(d=>a=d);this._asyncMap.set(b,{resolve:a,pauseCount:0});return[b,c]}MaybeFinishAsyncFunctionCall(b){const a=this._asyncMap.get(b);0===a.pauseCount&&(a.resolve(),this._asyncMap.delete(b));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){this._asyncMap.get(this._currentAsyncId).pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(b){this._currentAsyncId=
b;this._asyncMap.get(b).pauseCount--}}}
{"use strict";const f=self.C3,b=[];f.EventVariable=class extends f.DefendedBase{constructor(a,c,d){super();const e=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=e;this._runtime=a.GetRuntime();this._parent=c;this._localVarStack=e.GetLocalVarStack();this._name=d[1];this._type=d[2];this._initialValue=d[3];this._isStatic=!!d[4];this._isConstant=!!d[5];this._isFunctionParameter=c instanceof f.FunctionBlock;this._sid=d[6];this._jsPropName=this._runtime.GetJsPropName(d[8]);this._scriptSetter=
h=>this.SetValue(h);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;this.IsBoolean()&&(this._value=this._value?1:0);!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=e._GetNextLocalVarIndex(this));e._RegisterEventVariable(this)}static Create(a,c,d){return f.New(f.EventVariable,a,c,d)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const a=
this._eventSheetManager.FindFirstFunctionBlockParent(this);a&&a._RegisterLocalVariable(this)}}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}GetScopeParent(){return this.GetParent()}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return 0===this._type}IsString(){return 1===this._type}IsBoolean(){return 2===
this._type}IsElseBlock(){return!1}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return b}Run(a){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(a){this.Run(a)}SetValue(a){this.IsNumber()?"number"!==typeof a&&(a=parseFloat(a)):this.IsString()?"string"!==typeof a&&(a=a.toString()):this.IsBoolean()&&(a=a?1:0);this._hasSingleValue?this._value=a:this._localVarStack.GetCurrent()[this._localIndex]=
a}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let a=this.GetValue();this.IsBoolean()&&(a=!!a);return a}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}}
{"use strict";const f=self.C3,b=[];f.EventInclude=class extends f.DefendedBase{constructor(a,c,d){super();const e=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=e;this._runtime=a.GetRuntime();this._parent=c;this._includeSheet=null;this._includeSheetName=d[1];this._isActive=!0}static Create(a,c,d){return f.New(f.EventInclude,a,c,d)}_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 c=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(c);this._includeSheet.Run();a&&this._eventSheetManager.PopSol(c)}*DebugRun(a){a=
!!this.GetParent();const c=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(c);yield*this._includeSheet.DebugRun();a&&this._eventSheetManager.PopSol(c)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let a=this.GetParent();for(;a;){if(a instanceof 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(l){super();this._owner=l;this._runtime=l.GetRuntime()}_PostInit(){}static CreateNode(l,m){return f.New([h,d,e,g,b,a][m[0]],l,m)}};class b extends f.ExpNode{constructor(l,m){super(l);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(m[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(l,m){super(l);this._functionBlock=null;this._functionName=m[1];this._owner.SetVariesPerInstance()}_PostInit(){const l=this._runtime.GetEventSheetManager();this._functionBlock=l.GetFunctionBlockByName(this._functionName);this._functionName=null;const m=this._owner.GetEventBlock(),u=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...m.GetSolModifiersIncludingParents(),...u.GetSolModifiersIncludingParents()])];this._combinedSolModifiers=
l._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const l=this._functionBlock;if(l.IsEnabled()){const m=l.GetEventBlock();return f.EventBlock.prototype.RunAsExpressionFunctionCall.bind(m,this._combinedSolModifiers,l.GetReturnType(),l.GetDefaultReturnValue())}{const m=l.GetDefaultReturnValue();return()=>m}}}function c(l,m){if(l>=m)return l%m;0>l&&(l<=-m&&(l%=m),0>l&&(l+=m));return l}class d extends f.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);
this._func=this._runtime.GetObjectReference(m[2]);this._returnsString=!!m[3];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}GetBoundMethod(){return this._objectClass.GetPlugin()._GetBoundACEMethod(this._func,this._objectClass.GetSingleGlobalInstance().GetSdkInstance())}ExpObject(...l){const m=this._objectClass,u=m.GetCurrentSol().GetExpressionInstances();var w=u.length;if(0===w)return this._returnsString?"":0;w=c(this._owner.GetSolIndex(),
w);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);return this._func.apply(u[w].GetSdkInstance(),l)}ExpObject_InstExpr(l,...m){const u=this._objectClass,w=u.GetInstances(),q=w.length;if(0===q)return this._returnsString?"":0;l=c(l,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);return this._func.apply(w[l].GetSdkInstance(),m)}}class e extends f.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._varIndex=m[3];
this._returnsString=!!m[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const l=this._objectClass.GetCurrentSol().GetExpressionInstances();var m=l.length;if(0===m)return this._returnsString?"":0;m=c(this._owner.GetSolIndex(),m);return l[m]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var l=this._objectClass,m=l.GetCurrentSol().GetExpressionInstances(),u=m.length;if(0===u)return this._returnsString?"":0;u=c(this._owner.GetSolIndex(),u);m=m[u];l=m.GetObjectClass().GetFamilyInstanceVariableOffset(l.GetFamilyIndex());
return m._GetInstanceVariableValueUnchecked(this._varIndex+l)}ExpInstVar_InstExpr(l){const m=this._objectClass;var u=m.GetInstances();const w=u.length;if(0===w)return this._returnsString?"":0;l=c(l,w);u=u[l];l=0;m.IsFamily()&&(l=u.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex()));return u._GetInstanceVariableValueUnchecked(this._varIndex+l)}}class h extends f.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(m[2]);
this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(m[2]);this._func=this._runtime.GetObjectReference(m[3]);this._returnsString=!!m[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...l){const m=this._objectClass;var u=m.GetCurrentSol().GetExpressionInstances(),w=u.length;if(0===w)return this._returnsString?"":0;w=c(this._owner.GetSolIndex(),w);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);
u=u[w];w=0;m.IsFamily()&&(w=u.GetObjectClass().GetFamilyBehaviorOffset(m.GetFamilyIndex()));return this._func.apply(u.GetBehaviorInstances()[this._behaviorIndex+w].GetSdkInstance(),l)}ExpBehavior_InstExpr(l,...m){const u=this._objectClass;var w=u.GetInstances();const q=w.length;if(0===q)return this._returnsString?"":0;l=c(l,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);w=w[l];l=0;u.IsFamily()&&(l=w.GetObjectClass().GetFamilyBehaviorOffset(u.GetFamilyIndex()));return this._func.apply(w.GetBehaviorInstances()[this._behaviorIndex+
l].GetSdkInstance(),m)}}class g extends f.ExpNode{constructor(l,m){super(l);this._eventVar=null;this._eventVarSid=m[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}}
{"use strict";const f=self.C3;f.Parameter=class extends f.DefendedBase{constructor(y,E,H){super();this._owner=y;this._index=H;this._type=E;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(y,E,H){const A=E[0];return f.New([a,c,u,e,g,d,l,a,e,e,w,q,u,p,c,m,h,t,r,x][A],y,A,H,E)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(y){this._variesPerInstance||!y||y.GetPlugin().IsSingleGlobal()||(this._variesPerInstance=!0)}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}};
function b(y){y=self.C3_ExpressionFuncs[y];if(!y)throw Error("invalid expression number");return y}class a extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._solIndex=0;y=A[1];this._expressionNumber=y[0];this._numberedNodes=[];this._expressionFunc=null;for(let F=1,J=y.length;F<J;++F)this._numberedNodes.push(f.ExpNode.CreateNode(this,y[F]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=b(this._expressionNumber),this._isConstant=!0)}_GetNode(y){if(0>y||y>=this._numberedNodes.length)throw new RangeError("invalid numbered node");
return this._numberedNodes[y]}_PostInit(){for(var y of this._numberedNodes)y._PostInit();y=b(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?y(this):y}GetSolIndex(){return this._solIndex}GetExpression(y){this._solIndex=y;return this._expressionFunc()}}class c extends a{constructor(y,E,H,A){super(y,E,H,A);this.Get=this.GetStringExpression;14===E&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof f.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(y){this._solIndex=
y;y=this._expressionFunc();return"string"===typeof y?y:""}_GetFastTriggerValue(){return b(this._expressionNumber)()}}class d extends a{constructor(y,E,H,A){super(y,E,H,A);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(y){this._solIndex=y;y=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(y)}}class e extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._combo=A[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class h extends f.Parameter{constructor(y,
E,H,A){super(y,E,H);this._bool=A[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class g extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._objectClass=this.GetRuntime().GetObjectClassByIndex(A[1]);this.Get=this.GetObjectClass;y=this.GetEventBlock();y._AddSolModifier(this._objectClass);this._owner instanceof f.Action?y.SetSolWriterAfterCnds():y.GetParent()&&y.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}}
class l extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(A[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class m extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(A[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class u extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._fileInfo=
A[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class w extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._instVarIndex=A[1];(y=this._owner.GetObjectClass())&&y.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(y){y=y||0;const E=this._owner.GetObjectClass();var H=E.GetCurrentSol();const A=H.GetInstances();
if(A.length)y=A[y%A.length].GetObjectClass();else if(H.HasAnyElseInstances())H=H.GetElseInstances(),y=H[y%H.length].GetObjectClass();else if(0<E.GetInstanceCount())H=E.GetInstances(),y=H[y%H.length].GetObjectClass();else return 0;return this._instVarIndex+y.GetFamilyInstanceVariableOffset(E.GetFamilyIndex())}}class q extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._eventVarSid=A[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}}
class t extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._functionBlockName=A[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=!0}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}}class p extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let F=1,J=A.length;F<
J;++F)y=f.Parameter.Create(this._owner,A[F],0),this._subParams.push(y),this._variadicRet.push(0),y.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const y of this._subParams)y._PostInit()}GetVariadic(){const y=this._subParams,E=this._variadicRet;for(let H=0,A=y.length;H<A;++H)E[H]=y[H].Get(0);return E}}class r extends f.Parameter{constructor(y,E,H,A){super(y,E,H);this._easeIndex=A[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}class x extends f.Parameter{constructor(y,
E,H,A){super(y,E,H);this._brushIndex=A[1];this.Get=this.GetTilemapBrush;this._isConstant=!0}GetTilemapBrush(){return this._brushIndex}}}
{"use strict";const f=self.C3;function b(d,e){for(let h=0,g=d.length;h<g;++h)e[h]=d[h].Get(0)}const a=[],c=function(){};f.Condition=class extends f.DefendedBase{constructor(d,e,h){super();this._eventBlock=d;this._runtime=d.GetRuntime();this._index=h;this._func=this._runtime.GetObjectReference(e[1]);this._isTrigger=0<e[3];this._isFastTrigger=2===e[3];this._isLooping=!!e[4];this._isInverted=!!e[5];this._isStatic=!!e[6];this._sid=e[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType=
this._objectClass=null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=c;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:e[8][0],canDebug:e[8][1]}:null;-1===e[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(e[0]),e[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(e[2]),this._behaviorIndex=
this._objectClass.GetBehaviorIndexByName(e[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===e.length){d=e[9];for(let g of d)this._parameters.push(f.Parameter.Create(this,g,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(d,e,h){return f.New(f.Condition,d,e,h)}_PostInit(){for(const d of this._parameters)d._PostInit(),
d.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);this._isFastTrigger?(this.Run=this._RunFastTrigger,this.DebugRun=this._DebugRunFastTrigger):this._systemPlugin?(this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this._isStatic?(this.Run=this._RunStatic,this.DebugRun=this._DebugRunStatic):(this.Run=this._RunObject,this.DebugRun=this._DebugRunObject)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const d=this._objectClass.GetPlugin(),e=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(d,e,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(d,e,h){const g=this._func,l=this._isInverted,m=this._parameters;if(0===m.length){const u=d._GetBoundACEMethod(g,e);this.Run=l?function(){return f.xor(u(),l)}:u}else if(1===m.length){const u=m[0];if(!l&&u.IsConstant())this.Run=d._GetBoundACEMethod_1param(g,
e,u.Get(0));else{const w=d._GetBoundACEMethod(g,e);this.Run=function(){return f.xor(w(u.Get(0)),l)}}}else if(2===m.length){const u=m[0],w=m[1];if(!l&&u.IsConstant()&&w.IsConstant())this.Run=d._GetBoundACEMethod_2params(g,e,u.Get(0),w.Get(0));else{const q=d._GetBoundACEMethod(g,e);this.Run=function(){return f.xor(q(u.Get(0),w.Get(0)),l)}}}else if(3===m.length){const u=m[0],w=m[1],q=m[2];if(!l&&u.IsConstant()&&w.IsConstant()&&q.IsConstant())this.Run=d._GetBoundACEMethod_3params(g,e,u.Get(0),w.Get(0),
q.Get(0));else{const t=d._GetBoundACEMethod(g,e);this.Run=function(){return f.xor(t(u.Get(0),w.Get(0),q.Get(0)),l)}}}else this.Run=h}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(d){this._debugData.isBreakpoint=
!!d;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const d=this._results;b(this._parameters,d);return f.xor(this._func.apply(this._systemPlugin,d),
this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var d=this._results;b(this._parameters,d);d=this._func.apply(this._systemPlugin,d);f.IsIterator(d)&&(d=yield*d);return f.xor(d,this._isInverted)}return this.Run()}_RunSingleGlobal(){const d=this._results;b(this._parameters,d);const e=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return f.xor(this._func.apply(e,d),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var d=this._results;b(this._parameters,d);const e=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();d=this._func.apply(e,d);f.IsIterator(d)&&(d=yield*d);return f.xor(d,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var d=this._results;b(this._parameters,d);d=this._func.apply(this._behaviorType||
this._objectClass,d);this._objectClass.ApplySolToContainer();return d}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var d=this._results;b(this._parameters,d);d=this._func.apply(this._behaviorType||this._objectClass,d);f.IsIterator(d)&&(d=yield*d);this._objectClass.ApplySolToContainer();return d}return this.Run()}_RunObject(){const d=this._parameters,e=this._results,h=this._objectClass.GetCurrentSol();for(let g=0,l=d.length;g<
l;++g){const m=d[g];m.VariesPerInstance()||(e[g]=m.Get(0))}return h.IsSelectAll()?this._RunObject_FirstFilter(h):this._RunObject_NextFilter(h)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(d){const e=this._parameters,h=this._results;for(let g=0,l=e.length;g<l;++g){const m=e[g];m.VariesPerInstance()&&(h[g]=m.Get(d))}}_RunObject_FirstFilter(d){const e=this._objectClass,h=e.IsFamily(),g=e.GetFamilyIndex(),l=this._behaviorIndex,
m=0<=l,u=e.GetInstances(),w=this._anyParamVariesPerInstance,q=this._results,t=this._func,p=this._isInverted,r=this._isInOrBlock&&!this._isTrigger;d.ClearArrays();for(let y=0,E=u.length;y<E;++y){const H=u[y];w&&this._EvaluateVaryingParameters(y);var x=void 0;m?(x=h?H.GetObjectClass().GetFamilyBehaviorOffset(g):0,x=t.apply(H.GetBehaviorInstances()[l+x].GetSdkInstance(),q)):x=t.apply(H.GetSdkInstance(),q);f.xor(x,p)?d._PushInstance(H):r&&d._PushElseInstance(H)}e.FinishCondition(!0);d._SetSelectAll(!1);
e.ApplySolToContainer();return d.HasAnyInstances()}_RunObject_NextFilter(d){const e=this._objectClass;var h=e.IsFamily();const g=e.GetFamilyIndex(),l=e.IsInContainer(),m=this._behaviorIndex,u=0<=m,w=this._anyParamVariesPerInstance,q=this._results,t=this._func,p=this._isInverted,r=this._isInOrBlock&&!this._isTrigger,x=d._GetOwnInstances(),y=d._GetOwnElseInstances(),E=r&&!this._eventBlock.IsFirstConditionOfType(this),H=E?y:x;let A=0,F=!1;for(let B=0,I=H.length;B<I;++B){const L=H[B];w&&this._EvaluateVaryingParameters(B);
var J=void 0;u?(J=h?L.GetObjectClass().GetFamilyBehaviorOffset(g):0,J=t.apply(L.GetBehaviorInstances()[m+J].GetSdkInstance(),q)):J=t.apply(L.GetSdkInstance(),q);f.xor(J,p)?(F=!0,E?(x.push(L),l&&L._PushSiblingsToSolInstances()):(H[A]=L,l&&L._SetSiblingsToSolInstancesIndex(A),++A)):E?(H[A]=L,l&&L._SetSiblingsToSolElseInstancesIndex(A),++A):r&&(y.push(L),l&&L._PushSiblingsToSolElseInstances())}f.truncateArray(H,A);l&&e._TruncateContainerSols(E,A);h=F;E&&!F&&(F=this._OrBlockCheckInstances(x));e.FinishCondition(h||
r);return r?F:d.HasAnyInstances()}_OrBlockCheckInstances(d){var e=this._objectClass;const h=e.IsFamily();e=e.GetFamilyIndex();const g=this._anyParamVariesPerInstance,l=this._behaviorIndex,m=0<=l,u=this._results,w=this._func,q=this._isInverted;for(let p=0,r=d.length;p<r;++p){var t=d[p];g&&this._EvaluateVaryingParameters(p);if(m){const x=h?t.GetObjectClass().GetFamilyBehaviorOffset(e):0;t=w.apply(t.GetBehaviorInstances()[l+x].GetSdkInstance(),u)}else t=w.apply(t.GetSdkInstance(),u);if(f.xor(t,q))return!0}return!1}ReevaluateParameter(d,
e){return this._parameters[d].Get(e)}GetFastTriggerValue(){const d=this._parameters;if(!d.length)throw Error("no parameters");return d[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const d={};for(const [e,h]of this._savedData.entries()){let g=h;"collmemory"===e&&(g=[...h.entries()].map(l=>[l[0].GetUID(),l[1].GetUID(),l[2]]));d[e]=g}return{ex:d}}_LoadFromJson(d){this._savedData&&(this._savedData.clear(),this._savedData=null);if(d){var e=this._runtime,
h=d.ex;if(h){d=this.GetSavedDataMap();d.clear();for(const [g,l]of Object.entries(h))h=l,"collmemory"===g&&(h=f.New(f.PairMap,l.map(m=>[e.GetInstanceByUID(m[0]),e.GetInstanceByUID(m[1]),m[2]]).filter(m=>m[0]&&m[1]))),d.set(g,h)}}}}}
{"use strict";const f=self.C3;function b(e,h){for(let g=0,l=e.length;g<l;++g)h[g]=e[g].Get(0)}const a=[],c=function(){},d=function*(){};f.Action=class extends f.DefendedBase{constructor(e,h,g){super();this._eventBlock=e;this._runtime=e=e.GetRuntime();this._index=g;this._sid=4<=h.length?h[3]:-1;this._actionReturnType=5<=h.length?h[4]:0;this._behaviorType=this._objectClass=this._func=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._combinedSolModifiers=this._callEventBlock=
null;this.DebugRun=this.Run=c;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const l=(g=-3===h[0])?h[2]:h[5];this._debugData=e.IsDebug()||g?{isBreakpoint:l[0],canDebug:l[1],index:l[2]}:null;-1===h[0]?(this._systemPlugin=e.GetSystemPlugin(),this._func=e.GetObjectReference(h[1])):-2===h[0]?this._callFunctionName=h[1]:g?(this._func=e.GetObjectReference(h[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=
1):(this._func=e.GetObjectReference(h[1]),this._objectClass=e.GetObjectClassByIndex(h[0]),h[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(h[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(h[2])));if(7===h.length){h=h[6];for(const m of h)this._parameters.push(f.Parameter.Create(this,m,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(e,
h,g){return f.New(f.Action,e,h,g)}_PostInit(){for(var e of this._parameters)e._PostInit(),e.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);if(this._systemPlugin)this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem;else if(this._callFunctionName)this._SetCallFunctionRunMethod(),this._callFunctionName="";else if(this.Run===this.RunUserScript){e=this._func;const h=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=e.bind(null,this._runtime.GetIRuntime(),
h)}else this._behaviorType?this.IsAsync()?(this.Run=this._RunBehavior_Async,this.DebugRun=this._DebugRunBehavior_Async):(this.Run=this._RunBehavior,this.DebugRun=this._DebugRunBehavior):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this.IsAsync()?(this.Run=this._RunObject_Async,this.DebugRun=this._DebugRunObject_Async):this._parameters.length?this._parameters.every(h=>h.VariesPerInstance())?(this.Run=this._RunObject_AllParamsVary,
this.DebugRun=this._DebugRunObject_AllParamsVary):this._anyParamVariesPerInstance?(this.Run=this._RunObject_SomeParamsVary,this.DebugRun=this._DebugRunObject_SomeParamsVary):this._parameters.every(h=>h.IsConstant())?(b(this._parameters,this._results),this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst):(this.Run=this._RunObject_ParamsDontVary,this.DebugRun=this._DebugRunObject_ParamsDontVary):(this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const e=this._objectClass.GetPlugin(),h=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(e,h,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const e=this._eventBlock.GetEventSheetManager(),h=e.GetFunctionBlockByName(this._callFunctionName);h.IsEnabled()?(this._callEventBlock=h.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],
this._combinedSolModifiers=e._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=f.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=c,this.DebugRun=d)}_SetRunMethodForBoundFunc(e,h,g){const l=this._func,m=this._parameters;if(0===m.length)this.Run=e._GetBoundACEMethod(l,h);else if(1===m.length){const u=m[0];if(u.IsConstant())this.Run=e._GetBoundACEMethod_1param(l,h,u.Get(0));
else{const w=e._GetBoundACEMethod(l,h);this.Run=function(){return w(u.Get(0))}}}else if(2===m.length){const u=m[0],w=m[1];if(u.IsConstant()&&w.IsConstant())this.Run=e._GetBoundACEMethod_2params(l,h,u.Get(0),w.Get(0));else{const q=e._GetBoundACEMethod(l,h);this.Run=function(){return q(u.Get(0),w.Get(0))}}}else if(3===m.length){const u=m[0],w=m[1],q=m[2];if(u.IsConstant()&&w.IsConstant()&&q.IsConstant())this.Run=e._GetBoundACEMethod_3params(l,h,u.Get(0),w.Get(0),q.Get(0));else{const t=e._GetBoundACEMethod(l,
h);this.Run=function(){return t(u.Get(0),w.Get(0),q.Get(0))}}}else this.Run=g}GetSID(){return this._sid}IsAsync(){return 1===this._actionReturnType}CanBailOut(){return 2===this._actionReturnType}HasReturnType(){return 0!==this._actionReturnType}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}GetCombinedSolModifiers(){return this._combinedSolModifiers}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(e){this._debugData.isBreakpoint=
!!e;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const e=this._results;b(this._parameters,e);return this._func.apply(this._systemPlugin,e)}*_DebugRunSystem(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results;b(this._parameters,e);return yield*this._func.apply(this._systemPlugin,e)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const e=this._results;b(this._parameters,e);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),
e)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results;b(this._parameters,e);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),e)}return this.Run()}_RunObject_ParamsConst(){const e=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)this._func.apply(h[g].GetSdkInstance(),e)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)yield*this._func.apply(h[g].GetSdkInstance(),e)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const e=this._results;b(this._parameters,e);const h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)this._func.apply(h[g].GetSdkInstance(),e)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._results;b(this._parameters,e);const h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)yield*this._func.apply(h[g].GetSdkInstance(),e)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const e=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=l.length;m<u;++m){const w=l[m];for(let q=0,t=e.length;q<t;++q)h[q]=
e[q].Get(m);g.apply(w.GetSdkInstance(),h)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=l.length;m<u;++m){const w=l[m];for(let q=0,t=e.length;q<t;++q)h[q]=e[q].Get(m);yield*g.apply(w.GetSdkInstance(),h)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const e=this._parameters,
h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,w=e.length;u<w;++u){var m=e[u];m.VariesPerInstance()||(h[u]=m.Get(0))}for(let u=0,w=l.length;u<w;++u){m=l[u];for(let q=0,t=e.length;q<t;++q){const p=e[q];p.VariesPerInstance()&&(h[q]=p.Get(u))}g.apply(m.GetSdkInstance(),h)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const h=this._parameters,g=this._results,l=this._func,
m=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,w=h.length;u<w;++u){var e=h[u];e.VariesPerInstance()||(g[u]=e.Get(0))}for(let u=0,w=m.length;u<w;++u){e=m[u];for(let q=0,t=h.length;q<t;++q){const p=h[q];p.VariesPerInstance()&&(g[q]=p.Get(u))}yield*l.apply(e.GetSdkInstance(),g)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var e=this._objectClass;const h=e.IsFamily(),g=e.GetFamilyIndex(),l=this._parameters,m=this._anyParamVariesPerInstance,u=this._results,w=this._func,q=this._behaviorIndex;
e=e.GetCurrentSol().GetInstances();for(let r=0,x=l.length;r<x;++r){var t=l[r];t.VariesPerInstance()||(u[r]=t.Get(0))}for(let r=0,x=e.length;r<x;++r){t=e[r];if(m)for(let y=0,E=l.length;y<E;++y){var p=l[y];p.VariesPerInstance()&&(u[y]=p.Get(r))}p=h?t.GetObjectClass().GetFamilyBehaviorOffset(g):0;w.apply(t.GetBehaviorInstances()[q+p].GetSdkInstance(),u)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var e=this._objectClass;const l=
e.IsFamily(),m=e.GetFamilyIndex(),u=this._parameters,w=this._anyParamVariesPerInstance,q=this._results,t=this._func,p=this._behaviorIndex;e=e.GetCurrentSol().GetInstances();for(let r=0,x=u.length;r<x;++r){var h=u[r];h.VariesPerInstance()||(q[r]=h.Get(0))}for(let r=0,x=e.length;r<x;++r){h=e[r];if(w)for(let y=0,E=u.length;y<E;++y){var g=u[y];g.VariesPerInstance()&&(q[y]=g.Get(r))}g=l?h.GetObjectClass().GetFamilyBehaviorOffset(m):0;yield*t.apply(h.GetBehaviorInstances()[p+g].GetSdkInstance(),q)}}else this._RunBehavior()}_RunObject_Async(){const e=
this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,w=l.length;u<w;++u){const q=l[u];for(let t=0,p=e.length;t<p;++t)h[t]=e[t].Get(u);m.push(g.apply(q.GetSdkInstance(),h))}return Promise.all(m)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const e=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,
w=l.length;u<w;++u){const q=l[u];for(let t=0,p=e.length;t<p;++t)h[t]=e[t].Get(u);m.push(yield*g.apply(q.GetSdkInstance(),h))}return Promise.all(m)}return this._RunObject_Async()}_RunBehavior_Async(){var e=this._objectClass;const h=e.IsFamily(),g=e.GetFamilyIndex(),l=this._parameters,m=this._results,u=this._func,w=this._behaviorIndex;e=e.GetCurrentSol().GetInstances();const q=[];for(let t=0,p=e.length;t<p;++t){const r=e[t];for(let y=0,E=l.length;y<E;++y)m[y]=l[y].Get(t);const x=h?r.GetObjectClass().GetFamilyBehaviorOffset(g):
0;q.push(u.apply(r.GetBehaviorInstances()[w+x].GetSdkInstance(),m))}return Promise.all(q)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var e=this._objectClass;const h=e.IsFamily(),g=e.GetFamilyIndex(),l=this._parameters,m=this._results,u=this._func,w=this._behaviorIndex;e=e.GetCurrentSol().GetInstances();const q=[];for(let t=0,p=e.length;t<p;++t){const r=e[t];for(let y=0,E=l.length;y<E;++y)m[y]=l[y].Get(t);const x=h?
r.GetObjectClass().GetFamilyBehaviorOffset(g):0;q.push(yield*u.apply(r.GetBehaviorInstances()[w+x].GetSdkInstance(),m))}return Promise.all(q)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(e){console.error(`Unhandled exception running script %c${this._eventBlock.GetEventSheet().GetName()}, event ${this._eventBlock.GetDisplayNumber()}, action ${this.GetDebugIndex()+1}:`,"font-size: 1.2em; font-weight: bold;",e),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
f.EventScript.HadUserScriptException()||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),f.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{ex:f.ToSuperJSON(this._savedData)}:null}_LoadFromJson(e){this._savedData&&
(this._savedData.clear(),this._savedData=null);e&&(e=e.ex)&&(this._savedData=f.FromSuperJSON(e))}}}
{"use strict";const f=self.C3,b=new f.Color;function a(N,Q){return f.compare(this.GetWorldInfo().GetX(),N,Q)}function c(N,Q){return f.compare(this.GetWorldInfo().GetY(),N,Q)}function d(){const N=this.GetWorldInfo(),Q=N.GetLayer();return Q.Has3DCamera()?N.IsInViewport3D(Q._GetViewFrustum()):N.IsInViewport(Q.GetViewport(),N.GetLayout().HasVanishingPointOutsideViewport(),N.GetLayout().IsOrthographicProjection())}function e(){var N=this.GetWorldInfo();const Q=N.GetLayout();N=N.GetBoundingBox();return 0>
N.getRight()||0>N.getBottom()||N.getLeft()>Q.GetWidth()||N.getTop()>Q.GetHeight()}function h(N,Q,W){const aa=this.GetCurrentSol(),ea=aa.GetInstances();if(!ea.length)return!1;let ca=ea[0];var ia=ca.GetWorldInfo();let oa=ca,ja=f.distanceSquared(ia.GetX(),ia.GetY(),Q,W);for(let wa=1,Ka=ea.length;wa<Ka;++wa)if(ca=ea[wa],ia=ca.GetWorldInfo(),ia=f.distanceSquared(ia.GetX(),ia.GetY(),Q,W),0===N&&ia<ja||1===N&&ia>ja)ja=ia,oa=ca;aa.PickOne(oa);return!0}function g(N){const Q=this.GetWorldInfo();Q.GetX()!==
N&&(Q.SetX(N),Q.SetBboxChanged())}function l(N){const Q=this.GetWorldInfo();Q.GetY()!==N&&(Q.SetY(N),Q.SetBboxChanged())}function m(N,Q){const W=this.GetWorldInfo();W.EqualsXY(N,Q)||(W.SetXY(N,Q),W.SetBboxChanged())}function u(N,Q){if(N&&(N=N.GetPairedInstance(this._inst))){var [W,aa]=N.GetImagePoint(Q);Q=this.GetWorldInfo();if(Q.GetX()!==W||Q.GetY()!==aa)Q.SetXY(W,aa),Q.SetBboxChanged()}}function w(N){if(0!==N){var Q=this.GetWorldInfo();Q.OffsetXY(Q.GetCosAngle()*N,Q.GetSinAngle()*N);Q.SetBboxChanged()}}
function q(N,Q){if(0!==Q){var W=this.GetWorldInfo();N=f.toRadians(N);W.OffsetXY(Math.cos(N)*Q,Math.sin(N)*Q);W.SetBboxChanged()}}function t(){return this.GetWorldInfo().GetX()}function p(){return this.GetWorldInfo().GetY()}function r(){return this._runtime.GetDt(this._inst)}function x(N,Q){return f.compare(this.GetWorldInfo().GetWidth(),N,Q)}function y(N,Q){return f.compare(this.GetWorldInfo().GetHeight(),N,Q)}function E(N){const Q=this.GetWorldInfo();Q.GetWidth()!==N&&(Q.SetWidth(N),Q.SetBboxChanged())}
function H(N){const Q=this.GetWorldInfo();Q.GetHeight()!==N&&(Q.SetHeight(N),Q.SetBboxChanged())}function A(N,Q){const W=this.GetWorldInfo();if(W.GetWidth()!==N||W.GetHeight()!==Q)W.SetSize(N,Q),W.SetBboxChanged()}function F(){return this.GetWorldInfo().GetWidth()}function J(){return this.GetWorldInfo().GetHeight()}function B(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function I(){return this.GetWorldInfo().GetBoundingBox().getTop()}function L(){return this.GetWorldInfo().GetBoundingBox().getRight()}
function P(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function S(N,Q){return f.angleDiff(this.GetWorldInfo().GetAngle(),f.toRadians(Q))<=f.toRadians(N)}function U(N){return f.angleClockwise(this.GetWorldInfo().GetAngle(),f.toRadians(N))}function V(N,Q){N=f.toRadians(N);Q=f.toRadians(Q);const W=this.GetWorldInfo().GetAngle();return f.angleClockwise(Q,N)?f.angleClockwise(W,N)&&!f.angleClockwise(W,Q):!(!f.angleClockwise(W,N)&&f.angleClockwise(W,Q))}function Z(N){const Q=this.GetWorldInfo();
N=f.clampAngle(f.toRadians(N));isNaN(N)||Q.GetAngle()===N||(Q.SetAngle(N),Q.SetBboxChanged())}function ma(N){if(!isNaN(N)&&0!==N){var Q=this.GetWorldInfo();Q.SetAngle(Q.GetAngle()+f.toRadians(N));Q.SetBboxChanged()}}function va(N){if(!isNaN(N)&&0!==N){var Q=this.GetWorldInfo();Q.SetAngle(Q.GetAngle()-f.toRadians(N));Q.SetBboxChanged()}}function Na(N,Q){const W=this.GetWorldInfo(),aa=W.GetAngle();N=f.angleRotate(aa,f.toRadians(Q),f.toRadians(N));isNaN(N)||aa===N||(W.SetAngle(N),W.SetBboxChanged())}
function Ea(N,Q,W){const aa=this.GetWorldInfo(),ea=aa.GetAngle();Q-=aa.GetX();W-=aa.GetY();N=f.angleRotate(ea,Math.atan2(W,Q),f.toRadians(N));isNaN(N)||ea===N||(aa.SetAngle(N),aa.SetBboxChanged())}function Ia(N,Q){const W=this.GetWorldInfo(),aa=W.GetAngle();N-=W.GetX();Q-=W.GetY();Q=Math.atan2(Q,N);isNaN(Q)||aa===Q||(W.SetAngle(Q),W.SetBboxChanged())}function Ma(){return f.toDegrees(this.GetWorldInfo().GetAngle())}function Fa(N,Q){return f.compare(f.round6dp(100*this.GetWorldInfo().GetOpacity()),
N,Q)}function ya(){return this.GetWorldInfo().IsVisible()}function na(N){const Q=this.GetWorldInfo();N=2===N?!Q.IsVisible():0!==N;Q.IsVisible()!==N&&(Q.SetVisible(N),this._runtime.UpdateRender())}function Va(N){N=f.clamp(N/100,0,1);const Q=this.GetWorldInfo();Q.GetOpacity()!==N&&(Q.SetOpacity(N),this._runtime.UpdateRender())}function xa(N){b.setFromRgbValue(N);N=this.GetWorldInfo();N.GetUnpremultipliedColor().equalsIgnoringAlpha(b)||(N.SetUnpremultipliedColor(b),this._runtime.UpdateRender())}function Ga(){const N=
this.GetWorldInfo().GetUnpremultipliedColor();return f.PackRGBAEx(N.getR(),N.getG(),N.getB(),N.getA())}function bb(){return f.round6dp(100*this.GetWorldInfo().GetOpacity())}function Xa(N){return N?this.GetWorldInfo().GetLayer()===N:!1}function ob(N){const Q=this.GetCurrentSol(),W=Q.GetInstances();if(!W.length)return!1;let aa=W[0];for(let ea=1,ca=W.length;ea<ca;++ea){const ia=W[ea],oa=ia.GetWorldInfo(),ja=aa.GetWorldInfo(),wa=oa.GetLayer().GetIndex(),Ka=ja.GetLayer().GetIndex();if(0===N){if(wa>Ka||
wa===Ka&&oa.GetZIndex()>ja.GetZIndex())aa=ia}else if(wa<Ka||wa===Ka&&oa.GetZIndex()<ja.GetZIndex())aa=ia}Q.PickOne(aa);return!0}function pb(N,Q,W){const aa=this.GetWorldInfo();N=0===N?aa.GetZElevation():aa.GetTotalZElevation();return f.compare(N,Q,W)}function cb(){this.GetWorldInfo().ZOrderMoveToTop()}function qb(){this.GetWorldInfo().ZOrderMoveToBottom()}function rb(N){N&&this.GetWorldInfo().ZOrderMoveToLayer(N)}function sb(N,Q){N=0===N;Q&&(Q=Q.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(Q,
N)}function tb(N){const Q=this.GetWorldInfo();Q.GetZElevation()!==N&&(Q.SetZElevation(N),this._runtime.UpdateRender())}function ub(){return this.GetWorldInfo().GetLayer().GetIndex()}function vb(){return this.GetWorldInfo().GetLayer().GetName()}function wb(){return this.GetWorldInfo().GetZIndex()}function db(){return this.GetWorldInfo().GetZElevation()}function xb(){return this.GetWorldInfo().GetTotalZElevation()}function yb(N,Q){if(Q=this.GetObjectClass().GetEffectList().GetEffectTypeByName(Q)){Q=
Q.GetIndex();N=1===N;var W=this.GetWorldInfo().GetInstanceEffectList();W.IsEffectIndexActive(Q)!==N&&(W.SetEffectIndexActive(Q,N),W.UpdateActiveEffects(),this._runtime.UpdateRender())}}function zb(N,Q,W){var aa=this.GetObjectClass().GetEffectList().GetEffectTypeByName(N);if(aa){N=aa.GetIndex();var ea=this.GetWorldInfo().GetInstanceEffectList(),ca=ea.GetEffectParametersForIndex(N);Q=Math.floor(Q);if(!(0>Q||Q>=ca.length)){aa=aa.GetShaderProgram().GetParameterType(Q);if("color"===aa){b.setFromRgbValue(W);
Q=ca[Q];if(b.equalsIgnoringAlpha(Q))return;Q.copyRgb(b)}else{"percent"===aa&&(W/=100);if(ca[Q]===W)return;ca[Q]=W}ea.IsEffectIndexActive(N)&&this._runtime.UpdateRender()}}}const eb=f.New(f.Rect),Wa=[],fb=[];let gb=!1,Ya=null,hb=!1;const Ta=new Set;function ib(N,Q,W,aa){const ea=Q.GetUID(),ca=W.GetUID();ea<ca?N.Set(Q,W,aa):N.Set(W,Q,aa)}function jb(N,Q,W){const aa=Q.GetUID(),ea=W.GetUID();aa<ea?N.Delete(Q,W):N.Delete(W,Q)}function sa(N,Q){N.DeleteEither(Q)}function Sa(N,Q,W){const aa=Q.GetUID(),ea=
W.GetUID();return aa<ea?N.Get(Q,W):N.Get(W,Q)}function Ab(N,Q,W,aa){if(!Q)return!1;N=N.GetInstance();const ea=0!==W||0!==aa,ca=N.GetWorldInfo(),ia=N.GetRuntime(),oa=ia.GetCollisionEngine();var ja=ia.GetCurrentCondition();const wa=ja.GetEventBlock().IsOrBlock();var Ka=ja.GetObjectClass();ja=ja.IsInverted();const Oa=Q.GetCurrentSol();Ka=Ka!==Q;Ya=Q;gb=Ka&&!ja;hb=!1;let Za=0,La=0,la=!1;Oa.IsSelectAll()?(eb.copy(ca.GetBoundingBox()),eb.offset(W,aa),oa.GetCollisionCandidates(ca.GetLayer(),Q,eb,fb),Q=fb):
wa?ia.IsCurrentConditionFirst()&&!Oa._GetOwnElseInstances().length&&Oa._GetOwnInstances().length?Q=Oa._GetOwnInstances():(Q=Oa._GetOwnElseInstances(),hb=!0):Q=Oa._GetOwnInstances();ea&&(Za=ca.GetX(),La=ca.GetY(),ca.OffsetXY(W,aa),ca.SetBboxChanged());for(const da of Q)if(oa.TestOverlap(N,da)){la=!0;if(ja)break;Ka&&Ta.add(da)}ea&&(ca.SetXY(Za,La),ca.SetBboxChanged());f.clearArray(fb);return la}function Db(N){N=N.GetRuntime().GetCurrentEvent().IsOrBlock();const Q=Ya.GetCurrentSol(),W=Q._GetOwnInstances(),
aa=Q._GetOwnElseInstances();Q.IsSelectAll()?(Q.SetSetPicked(Ta),N&&(f.clearArray(aa),Q.AddElseInstances(Ta,Ya.GetInstances()))):N?hb?Q.TransferElseInstancesToOwn(Ta):(Q.AddElseInstances(Ta,W),Q.SetSetPicked(Ta)):Q.SetSetPicked(Ta);Ya.ApplySolToContainer()}function Eb(N,Q){gb&&(Q&&Db(N),Ta.clear(),Ya=null,gb=!1)}function Fb(N){if(this._runtime.IsDebugging())return Gb.call(this,N);if(!N)return!1;var Q=this._runtime;const W=Q.GetCollisionEngine(),aa=Q.GetEventSheetManager(),ea=aa.GetEventStack();var ca=
aa.GetCurrentCondition();const ia=ca.GetObjectClass();var oa=ca.GetSavedDataMap(),ja=ca.GetUnsavedDataMap();ca=ea.GetCurrentStackFrame();const wa=Q.GetTickCount(),Ka=wa-1,Oa=ca.GetCurrentEvent(),Za=ea.Push(Oa);let La=oa.get("collmemory");La||(La=f.New(f.PairMap),oa.set("collmemory",La));ja.get("collisionCreatedDestroyCallback")||(ja.set("collisionCreatedDestroyCallback",!0),Q.Dispatcher().addEventListener("instancedestroy",Ua=>sa(La,Ua.instance)));oa=ia.GetCurrentSol();Q=N.GetCurrentSol();oa=oa.GetInstances();
ja=null;for(let Ua=0;Ua<oa.length;++Ua){const Ha=oa[Ua];Q.IsSelectAll()?(W.GetCollisionCandidates(Ha.GetWorldInfo().GetLayer(),N,Ha.GetWorldInfo().GetBoundingBox(),Wa),ja=Wa,W.AddRegisteredCollisionCandidates(Ha,N,ja)):ja=Q.GetInstances();for(let ab=0;ab<ja.length;++ab){const Ra=ja[ab];if(W.TestOverlap(Ha,Ra)||W.CheckRegisteredCollision(Ha,Ra)){var la=Sa(La,Ha,Ra),da=!1,pa=-2;"number"===typeof la&&(da=!0,pa=la);la=!da||pa<Ka;ib(La,Ha,Ra,wa);la&&(la=Oa.GetSolModifiers(),aa.PushCopySol(la),pa=ia.GetCurrentSol(),
da=N.GetCurrentSol(),pa._SetSelectAll(!1),da._SetSelectAll(!1),ia===N?(da=pa._GetOwnInstances(),f.clearArray(da),da.push(Ha),da.push(Ra),ia.ApplySolToContainer()):(pa=pa._GetOwnInstances(),da=da._GetOwnInstances(),f.clearArray(pa),f.clearArray(da),pa.push(Ha),da.push(Ra),ia.ApplySolToContainer(),N.ApplySolToContainer()),Oa.Retrigger(ca,Za),aa.PopSol(la))}else jb(La,Ha,Ra)}f.clearArray(Wa)}ea.Pop();return!1}function*Gb(N){if(!N)return!1;var Q=this._runtime;const W=Q.GetCollisionEngine(),aa=Q.GetEventSheetManager(),
ea=aa.GetEventStack();var ca=aa.GetCurrentCondition();const ia=ca.GetObjectClass();var oa=ca.GetSavedDataMap(),ja=ca.GetUnsavedDataMap();ca=ea.GetCurrentStackFrame();const wa=Q.GetTickCount(),Ka=wa-1,Oa=ca.GetCurrentEvent(),Za=ea.Push(Oa);let La=oa.get("collmemory");La||(La=f.New(f.PairMap),oa.set("collmemory",La));ja.get("collisionCreatedDestroyCallback")||(ja.set("collisionCreatedDestroyCallback",!0),Q.Dispatcher().addEventListener("instancedestroy",Ua=>sa(La,Ua.instance)));oa=ia.GetCurrentSol();
Q=N.GetCurrentSol();oa=oa.GetInstances();ja=null;for(let Ua=0;Ua<oa.length;++Ua){const Ha=oa[Ua];Q.IsSelectAll()?(W.GetCollisionCandidates(Ha.GetWorldInfo().GetLayer(),N,Ha.GetWorldInfo().GetBoundingBox(),Wa),ja=Wa,W.AddRegisteredCollisionCandidates(Ha,N,ja)):ja=Q.GetInstances();for(let ab=0;ab<ja.length;++ab){const Ra=ja[ab];if(W.TestOverlap(Ha,Ra)||W.CheckRegisteredCollision(Ha,Ra)){var la=Sa(La,Ha,Ra),da=!1,pa=-2;"number"===typeof la&&(da=!0,pa=la);la=!da||pa<Ka;ib(La,Ha,Ra,wa);la&&(la=Oa.GetSolModifiers(),
aa.PushCopySol(la),pa=ia.GetCurrentSol(),da=N.GetCurrentSol(),pa._SetSelectAll(!1),da._SetSelectAll(!1),ia===N?(da=pa._GetOwnInstances(),f.clearArray(da),da.push(Ha),da.push(Ra),ia.ApplySolToContainer()):(pa=pa._GetOwnInstances(),da=da._GetOwnInstances(),f.clearArray(pa),f.clearArray(da),pa.push(Ha),da.push(Ra),ia.ApplySolToContainer(),N.ApplySolToContainer()),yield*Oa.DebugRetrigger(ca,Za),aa.PopSol(la))}else jb(La,Ha,Ra)}f.clearArray(Wa)}ea.Pop();return!1}function Hb(N){return Ab(this,N,0,0)}function kb(N,
Q,W){return Ab(this,N,Q,W)}function lb(){return this.GetWorldInfo().HasParent()}function mb(){return this.GetWorldInfo().HasChildren()}function nb(N,Q){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(0===ea.length)return!1;ea=new Set(ea);const ca=new Set;for(let oa=0,ja=W.length;oa<ja;++oa){var ia=W[oa];if(1===Q)for(const wa of ia.parents())wa.BelongsToObjectClass(N)&&ea.has(wa)&&ca.add(wa);else{if(0===Q){if(ia=ia.GetParent(),
null===ia)continue}else ia=ia.GetTopParent();ia.BelongsToObjectClass(N)&&ea.has(ia)&&ca.add(ia)}}if(0===ca.size)return!1;aa.SetSetPicked(ca);N.ApplySolToContainer();return!0}function $a(N,Q){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(aa.IsSelectAll()){var ca=[...this._runtime.instancesPendingCreateForObjectClass(N)];0<ca.length&&(ea=ea.concat(ca))}if(0===ea.length)return!1;ea=new Set(ea);ca=new Set;for(let ia=0,oa=W.length;ia<
oa;++ia){const ja=W[ia];2===Q&&!ja.HasChildren()&&ja.BelongsToObjectClass(N)&&ea.has(ja)&&ca.add(ja);for(const wa of 0===Q?ja.children():ja.allChildren())2===Q&&wa.HasChildren()||wa.BelongsToObjectClass(N)&&ea.has(wa)&&ca.add(wa)}if(0===ca.size)return!1;aa.SetSetPicked(ca);N.ApplySolToContainer();return!0}function k(N,Q){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(aa.IsSelectAll()){var ca=[...this._runtime.instancesPendingCreateForObjectClass(N)];
0<ca.length&&(ea=ea.concat(ca))}if(0===ea.length)return!1;ea=new Set(ea);ca=[];for(let ia=0,oa=W.length;ia<oa;++ia){const ja=W[ia].GetChildAt(Q);null!==ja&&ja.BelongsToObjectClass(N)&&ea.has(ja)&&ca.push(ja)}if(0===ca.length)return!1;aa.SetArrayPicked(ca);N.ApplySolToContainer();return!0}function n(N,Q){return f.compare(this._inst.GetChildCount(),N,Q)}function v(N,Q,W,aa,ea,ca,ia,oa){const ja=this._inst,wa=this._runtime.GetCurrentAction().GetObjectClass();for(const Ka of N.allCorrespondingInstances(ja,
wa)){if(!Ka.GetPlugin().SupportsSceneGraph())break;ja.AddChild(Ka,{transformX:Q,transformY:W,transformWidth:aa,transformHeight:ea,transformAngle:ca,transformZElevation:ia,destroyWithParent:oa})}}function z(N){const Q=this._inst,W=this._runtime.GetCurrentAction().GetObjectClass();for(const aa of N.allCorrespondingInstances(Q,W))Q.RemoveChild(aa)}function C(){this._inst.HasParent()&&this._inst.GetParent().RemoveChild(this._inst)}function D(){return this._inst.GetChildCount()}function G(N,Q){N=Math.floor(N);
Q=Math.floor(Q);const W=this.GetWorldInfo();2>N||2>Q||!isFinite(N)||!isFinite(Q)?(W.ReleaseMesh(),W.SetBboxChanged()):W.CreateMesh(N,Q)}function K(N,Q,W,aa,ea,ca,ia,oa){const ja=this.GetWorldInfo();ja.SetMeshPoint(N,Q,{mode:0===W?"absolute":"relative",x:aa,y:ea,zElevation:ca,u:ia,v:oa})&&ja.SetBboxChanged()}function M(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetHSize():0}function O(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetVSize():0}function R(N){const Q=
this.GetWorldInfo();N=2===N?!Q.IsVisible():0!==N;Q.IsVisible()!==N&&Q.SetVisible(N)}function T(N,Q){this.SetElementCSSStyle(N,Q)}function Y(N,Q){this.SetElementAttribute(N,""+Q)}function X(N){this.RemoveElementAttribute(N)}function fa(){this.FocusElement()}function ha(){this.BlurElement()}function ba(){return this.IsElementFocused()}function qa(N){this._SetEnabled(0!==N)}function ka(){return this._IsEnabled()}function ta(N,Q,W){return f.compare(this.GetInstance().GetInstanceVariableValue(N),Q,W)}
function ua(N){return!!this.GetInstance().GetInstanceVariableValue(N)}function ra(N,Q){const W=this.GetCurrentSol(),aa=W.GetInstances();if(!aa.length)return!1;let ea=aa[0],ca=ea,ia=ea.GetInstanceVariableValue(Q);for(let oa=1,ja=aa.length;oa<ja;++oa){ea=aa[oa];const wa=ea.GetInstanceVariableValue(Q);if(0===N&&wa<ia||1===N&&wa>ia)ia=wa,ca=ea}W.PickOne(ca);return!0}function za(N){return this._runtime.GetCurrentCondition().IsInverted()?Ba(this,N):Aa(this,N)}function Aa(N,Q){Q=N.GetRuntime().GetInstanceByUID(Q);
if(!Q)return!1;const W=N.GetCurrentSol();if(!W.IsSelectAll()&&!W._GetOwnInstances().includes(Q))return!1;if(N.IsFamily()){if(Q.GetObjectClass().BelongsToFamily(N))return W.PickOne(Q),N.ApplySolToContainer(),!0}else if(Q.GetObjectClass()===N)return W.PickOne(Q),N.ApplySolToContainer(),!0;return!1}function Ba(N,Q){const W=N.GetCurrentSol();if(W.IsSelectAll()){W._SetSelectAll(!1);W.ClearArrays();var aa=N.GetInstances();for(let ca=0,ia=aa.length;ca<ia;++ca){var ea=aa[ca];ea.GetUID()===Q?W._PushElseInstance(ea):
W._PushInstance(ea)}N.ApplySolToContainer();return!!W._GetOwnInstances().length}aa=W._GetOwnInstances();ea=0;for(let ca=0,ia=aa.length;ca<ia;++ca){const oa=aa[ca];aa[ea]=oa;oa.GetUID()===Q?W._PushElseInstance(oa):++ea}f.truncateArray(aa,ea);N.ApplySolToContainer();return!!aa.length}function Ca(){this._runtime.DestroyInstance(this._inst)}function Ja(){return!0}function Pa(){return!0}function Qa(N,Q){this.GetInstance().SetInstanceVariableValue(N,Q)}function Da(N,Q){const W=this.GetInstance(),aa=W.GetInstanceVariableValue(N);
"number"===typeof aa&&"number"!==typeof Q?Q=parseFloat(Q):"string"===typeof aa&&"string"!==typeof Q&&(Q=Q.toString());W.SetInstanceVariableValue(N,aa+Q)}function Bb(N,Q){const W=this.GetInstance(),aa=W.GetInstanceVariableValue(N);"number"===typeof aa&&("number"!==typeof Q&&(Q=parseFloat(Q)),W.SetInstanceVariableValue(N,aa-Q))}function Cb(N,Q){this.GetInstance().SetInstanceVariableValue(N,Q?1:0)}function Ib(N){const Q=this.GetInstance();Q.SetInstanceVariableValue(N,0===Q.GetInstanceVariableValue(N)?
1:0)}function Jb(N){let Q;try{Q=JSON.parse(N)}catch(W){console.error("Failed to load from JSON string: ",W);return}N=this.GetInstance();N._OnBeforeLoad("state");N.LoadFromJson(Q,"state")}function Kb(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function Lb(){return this.GetInstance().GetObjectClass().GetName()}function Mb(){const N=this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let Q=N.GetInstanceCount();for(const W of this._runtime.instancesPendingCreateForObjectClass(N))++Q;
return Q}function Nb(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}function Ob(){return this._inst.GetIID()}function Pb(){return this._inst.GetUID()}f.AddCommonACEs=function(N,Q){const W=N[1],aa=N[4],ea=N[5],ca=N[6],ia=N[7],oa=N[8],ja=N[10],wa=N[11],Ka=N[12],Oa=N[13],Za=N[14],La=N[15],la=Q.Cnds,da=Q.Acts,pa=Q.Exps;N[3]&&(la.CompareX=a,la.CompareY=c,la.IsOnScreen=d,la.IsOutsideLayout=e,la.PickDistance=h,da.SetX=g,da.SetY=l,da.SetPos=
m,da.SetPosToObject=u,da.MoveForward=w,da.MoveAtAngle=q,pa.X=t,pa.Y=p,pa.dt=r);aa&&(la.CompareWidth=x,la.CompareHeight=y,da.SetWidth=E,da.SetHeight=H,da.SetSize=A,pa.Width=F,pa.Height=J,pa.BBoxLeft=B,pa.BBoxTop=I,pa.BBoxRight=L,pa.BBoxBottom=P);ea&&(la.AngleWithin=S,la.IsClockwiseFrom=U,la.IsBetweenAngles=V,da.SetAngle=Z,da.RotateClockwise=ma,da.RotateCounterclockwise=va,da.RotateTowardAngle=Na,da.RotateTowardPosition=Ea,da.SetTowardPosition=Ia,pa.Angle=Ma);ca&&(la.IsVisible=ya,la.CompareOpacity=
Fa,da.SetVisible=na,da.SetOpacity=Va,da.SetDefaultColor=xa,pa.Opacity=bb,pa.ColorValue=Ga);ia&&(la.IsOnLayer=Xa,la.PickTopBottom=ob,la.CompareZElevation=pb,da.MoveToTop=cb,da.MoveToBottom=qb,da.MoveToLayer=rb,da.ZMoveToObject=sb,da.SetZElevation=tb,pa.LayerNumber=ub,pa.LayerName=vb,pa.ZIndex=wb,pa.ZElevation=db,pa.TotalZElevation=xb);oa&&(da.SetEffectEnabled=yb,da.SetEffectParam=zb);Oa&&(la.HasParent=lb,la.HasChildren=mb,la.PickParent=nb,la.PickChildren=$a,la.PickNthChild=k,la.CompareChildCount=n,
da.AddChild=v,da.RemoveChild=z,da.RemoveFromParent=C,pa.ChildCount=D);Za&&(da.SetMeshSize=G,da.SetMeshPoint=K,pa.MeshColumns=M,pa.MeshRows=O);ja&&(la.IsVisible=ya,da.SetVisible=R,da.SetCSSStyle=T,da.SetElemAttribute=Y,da.RemoveElemAttribute=X);wa&&(la.IsFocused=ba,da.SetFocus=fa,da.SetBlur=ha);Ka&&(la.IsEnabled=ka,da.SetEnabled=qa);La&&(la.OnCollision=Fb,la.IsOverlapping=Hb,la.IsOverlappingOffset=kb,Q.FinishCollisionCondition=Eb);W||(la.CompareInstanceVar=ta,la.IsBoolInstanceVarSet=ua,la.PickInstVarHiLow=
ra,la.PickByUID=za,da.SetInstanceVar=Qa,da.AddInstanceVar=Da,da.SubInstanceVar=Bb,da.SetBoolInstanceVar=Cb,da.ToggleBoolInstanceVar=Ib,la.OnCreated=Ja,la.OnDestroyed=Pa,da.Destroy=Ca,da.LoadFromJsonString||(da.LoadFromJsonString=Jb),pa.AsJSON||(pa.AsJSON=Kb),pa.Count=Mb,pa.PickedCount=Nb,pa.IID=Ob,pa.UID=Pb,pa.ObjectTypeName=Lb)}}
{"use strict";const 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._functionInnerLocalVars=this._functionParameters=null;this._shouldRelease=!1}Release(){this._type="";this._time=-1;this._signalTag="";this._functionInnerLocalVars=this._functionParameters=
this._callingFunctionBlock=this._event=null;this._asyncId=-1;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 c=b.GetCurrentEventStackFrame();this._event=c.GetCurrentEvent();this._actIndex=c.GetActionIndex()+1;if(b=b.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=b,this._functionParameters=b.CaptureFunctionParameters(),this._functionInnerLocalVars=
b._GetAllInnerLocalVariables().map(d=>d.GetValue()),b.IsAsync()&&(this._asyncId=b.PauseCurrentAsyncFunction());for(const d of a)if(a=d.GetCurrentSol(),!a.IsSelectAll()||this._event.HasSolModifier(d))this._solModifiers.push(d),this._sols.set(d,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,c]of this._sols.entries())b=a.GetCurrentSol(),c._Restore(b);if(b=this._callingFunctionBlock)b.SetFunctionParameters(this._functionParameters),b._GetAllInnerLocalVariables().map((a,c)=>a.SetValue(this._functionInnerLocalVars[c])),b.IsAsync()&&b.ResumeAsyncFunction(this._asyncId)}_Run(b){this._RestoreState(b);this._event._ResumeActionsAndSubEvents(b);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);
this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}async _DebugRun(b){this._RestoreState(b);for(const a of this._event._DebugResumeActionsAndSubEvents(b))await this._eventSheetManager.GetRuntime().DebugBreak(a);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(b){for(const a of this._sols.values())a.RemoveInstances(b)}_SaveToJson(){const b=
{},a={t:this._time,st:this._signalTag,s:this._isSignalled,ev:this._event.GetSID(),sm:this._solModifiers.map(c=>c.GetSID()),sols:b};this._event._HasActionIndex(this._actIndex)&&(a.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [c,d]of this._sols)b[c.GetSID().toString()]=d._SaveToJson();return a}static _CreateFromJson(b,a){const c=b.GetRuntime();var d=b.GetEventBlockBySID(a.ev);if(!d)return null;let e=0;if(a.hasOwnProperty("act")){var h=b.GetActionBySID(a.act);if(!h)return null;e=h.GetIndex()}h=
f.New(f.ScheduledWait,b);h._time=a.t;h._type=-1===h._time?"signal":"timer";h._signalTag=a.st;h._isSignalled=a.s;h._event=d;h._actIndex=e;for(var g of a.sm)(d=c.GetObjectClassBySID(g))&&h._solModifiers.push(d);for(const [l,m]of Object.entries(a.sols))if(a=parseInt(l,10),a=c.GetObjectClassBySID(a))g=f.New(f.SolState,null),g._LoadFromJson(b,m),h._sols.set(a,g);return h}}}
{"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 c of a.insts)(a=b.GetInstanceByUID(c))&&this._instances.push(a)}}}
{"use strict";const f=self.C3;function b(a,c){let d=a.get(c);d||(d=new Map,a.set(c,d));return d}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,
c){if(!c)throw Error("missing 'this' binding");let d=this._boundACEMethodCache.get(a);if(d)return d;d=a.bind(c);this._boundACEMethodCache.set(a,d);return d}_GetBoundACEMethod_1param(a,c,d){if(!c)throw Error("missing 'this' binding");const e=b(this._boundACEMethodCache_1param,a);let h=e.get(d);if(h)return h;h=a.bind(c,d);e.set(d,h);return h}_GetBoundACEMethod_2params(a,c,d,e){if(!c)throw Error("missing 'this' binding");var h=b(this._boundACEMethodCache_2params,a);h=b(h,d);let g=h.get(e);if(g)return g;
g=a.bind(c,d,e);h.set(e,g);return g}_GetBoundACEMethod_3params(a,c,d,e,h){if(!c)throw Error("missing 'this' binding");var g=b(this._boundACEMethodCache_3params,a);g=b(g,d);g=b(g,e);let l=g.get(h);if(l)return l;l=a.bind(c,d,e,h);g.set(h,l);return l}_SetSingleGlobalObjectClass(a){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");this._singleGlobalObjectClass=a}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");
return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}}
{"use strict";const 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",c=>c._OnElemFocused());this.AddElementMessageHandler("elem-blurred",c=>{c&&c._OnElemBlurred()})}Release(){super.Release()}_AddElement(b){const a=this._nextElementId++;this._instMap.set(a,b);return a}_RemoveElement(b){this._instMap.delete(b)}AddElementMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,
b,c=>{const d=this._instMap.get(c.elementId);a(d,c)})}}}{"use strict";const 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,c]of b)this.AddDOMMessageHandler(a,c)}PostToDOM(b,a){this._runtime.PostComponentMessageToDOM(this._domComponentId,
b,a)}PostToDOMAsync(b,a){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,b,a)}_PostToDOMMaybeSync(b,a){if(this._runtime.IsInWorker())this.PostToDOM(b,a);else return window.c3_runtimeInterface._OnMessageFromRuntime({type:"event",component:this._domComponentId,handler:b,data:a,responseId:null})}Tick(){}Tick2(){}_StartTicking(){this._isTicking||(this._tickFunc||(this._tickFunc=()=>this.Tick()),this._runtime.Dispatcher().addEventListener("tick",this._tickFunc),this._isTicking=
!0)}_StopTicking(){this._isTicking&&(this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._tick2Func||(this._tick2Func=()=>this.Tick2()),this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(b){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,
a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var c=this.GetPropertyValueByIndex(b);if("number"!==typeof c)throw Error("expected number");this.SetPropertyValueByIndex(b,c+a)}}SetPropertyColorOffsetValueByIndex(b,a,c,d){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(b,a,c){const d=this.GetScriptInterface();b=f.New(f.Event,b,a);b.instance=d;c&&Object.assign(b,c);d.dispatchEvent(b)}}}
{"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}IsOriginalSizeKnown(){return!1}GetOriginalWidth(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");
const b=this.GetCurrentImageInfo();if(b)return b.GetWidth()}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");const b=this.GetCurrentImageInfo();if(b)return b.GetHeight()}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){var b=this.GetCurrentImageInfo();return b&&(b=b.GetTexture())?[b.GetWidth(),b.GetHeight()]:[100,100]}GetCurrentTexRect(){const b=this.GetCurrentImageInfo();return b?b.GetTexRect():null}GetCurrentTexQuad(){const b=this.GetCurrentImageInfo();
return b?b.GetTexQuad():null}IsCurrentTexRotated(){const b=this.GetCurrentImageInfo();return b?b.IsRotated():!1}GetImagePoint(b){b=this._inst.GetWorldInfo();return[b.GetX(),b.GetY()]}LoadTilemapData(b,a,c){}TestPointOverlapTile(b,a){}RendersToOwnZPlane(){return!0}}}
{"use strict";const f=self.C3,b=f.New(f.Rect);f.SDKDOMInstanceBase=class extends f.SDKWorldInstanceBase{constructor(a,c){super(a,c);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,c){c||(c={});c.elementId=this._elementId;this.PostToDOM(a,c)}_PostToDOMElementMaybeSync(a,c){c||(c={});c.elementId=this._elementId;return this._PostToDOMMaybeSync(a,c)}PostToDOMElementAsync(a,c){c||(c={});c.elementId=this._elementId;return this.PostToDOMAsync(a,c)}CreateElement(a){a||
(a={});const c=this.GetWorldInfo().IsVisible();a.elementId=this._elementId;a.isVisible=c;Object.assign(a,this.GetElementState());this._isElementShowing=!!a.isVisible;this._PostToDOMMaybeSync("create",a);this._UpdatePosition(!0)}SetElementVisible(a){a=!!a;this._isElementShowing!==a&&(this._isElementShowing=a,this.PostToDOMElement("set-visible",{isVisible:a}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const a=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===f.Platform.OS&&
("scale-inner"===a||"scale-outer"===a||"crop"===a)}_UpdatePosition(a){var c=this.GetWorldInfo();const d=c.GetLayer();var e=c.GetX(),h=c.GetY();let [g,l]=d.LayerToCanvasCss(e,h),[m,u]=d.LayerToCanvasCss(e+c.GetWidth(),h+c.GetHeight());e=this._runtime.GetCanvasManager();h=e.GetCssWidth();const w=e.GetCssHeight();if(c.IsVisible()&&d.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=m||0>=u||g>=h||l>=w){this.SetElementVisible(!1);return}1>g&&(g=1);1>l&&(l=1);m>=h&&(m=h-1);u>=w&&(u=w-1)}b.set(g,l,
m,u);c=e.GetLastWidth();h=e.GetLastHeight();!a&&b.equals(this._lastRect)&&this._lastWindowWidth===c&&this._lastWindowHeight===h?this.SetElementVisible(!0):(this._lastRect.copy(b),this._lastWindowWidth=c,this._lastWindowHeight=h,this.SetElementVisible(!0),a=null,this._autoFontSize&&(a=d.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+e.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+e.GetCanvasClientY(),width:Math.round(this._lastRect.width()),
height:Math.round(this._lastRect.height()),fontSize:a}))}else this.SetElementVisible(!1)}FocusElement(){this._PostToDOMElementMaybeSync("focus",{focus:!0})}BlurElement(){this._PostToDOMElementMaybeSync("focus",{focus:!1})}_OnElemFocused(){this._elemHasFocus=!0}_OnElemBlurred(){this._elemHasFocus=!1}IsElementFocused(){return this._elemHasFocus}SetElementCSSStyle(a,c){this.PostToDOMElement("set-css-style",{prop:f.CSSToCamelCase(a),val:c})}SetElementAttribute(a,c){this.PostToDOMElement("set-attribute",
{name:a,val:c})}RemoveElementAttribute(a){this.PostToDOMElement("remove-attribute",{name:a})}UpdateElementState(){this._isPendingUpdateState||(this._isPendingUpdateState=!0,Promise.resolve().then(()=>{this._isPendingUpdateState=!1;this.PostToDOMElement("update-state",this.GetElementState())}))}GetElementState(){}GetElementId(){return this._elementId}}}
{"use strict";const 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;this._scriptInterfaceClass=a.scriptInterfaceClass||null}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(a){this._myObjectClasses.Add(a)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(a){this._myInstances.Add(a)}_RemoveInstance(a){this._myInstances.Delete(a)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){if(null===
this._iBehavior){const a=this._scriptInterfaceClass;if(a){if(this._iBehavior=new a(this),!(this._iBehavior instanceof b))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new b(this)}return this._iBehavior}}}
{"use strict";const 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 c=this.GetPropertyValueByIndex(b);if("number"!==typeof c)throw Error("expected number");this.SetPropertyValueByIndex(b,c+a)}}SetPropertyColorOffsetValueByIndex(b,a,c,d){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(b,a,c){const d=
this.GetScriptInterface();b=f.New(f.Event,b,a);b.behaviorInstance=d;b.instance=d.instance;c&&Object.assign(b,c);d.dispatchEvent(b)}}}
{"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._size=0;this._hasMetaData=this._isRotated=!1;this._imageAsset=null;this._textureState="";this._rcTex=f.New(f.Rect);this._quadTex=f.New(f.Quad);b.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;b.delete(this)}static OnWebGLContextLost(){for(const a of b)a._textureState="",a._rcTex.set(0,0,0,0),a._quadTex.setFromRect(a._rcTex)}LoadData(a){this._url=
a[0];this._size=a[1];this._offsetX=a[2];this._offsetY=a[3];this._width=a[4];this._height=a[5];this._isRotated=a[6];this._hasMetaData=!0}LoadDynamicAsset(a,c){if(this._imageAsset)throw Error("already loaded asset");this._url=c;const d={};f.IsAbsoluteURL(c)&&(d.loadPolicy="remote");this.LoadAsset(a,d);return this._imageAsset.Load()}ReplaceWith(a){if(a===this)throw Error("cannot replace with self");this.ReleaseTexture();this._url=a._url;this._size=a._size;this._offsetX=a._offsetX;this._offsetY=a._offsetY;
this._width=a._width;this._height=a._height;this._isRotated=a._isRotated;this._hasMetaData=a._hasMetaData;this._imageAsset=a._imageAsset;this._textureState=a._textureState;this._rcTex=a._rcTex;this._quadTex=a._quadTex}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}IsRotated(){return this._isRotated}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(a,
c){if(this._imageAsset)throw Error("already got asset");c=Object.assign({},c,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=a.LoadImage(c)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,c){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";a=await this._imageAsset.LoadStaticTexture(a,c);if(!a)return this._textureState="",null;this._textureState="loaded";this._hasMetaData||
(this._width=a.GetWidth(),this._height=a.GetHeight(),this._hasMetaData=!0);this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+(this._isRotated?this._height:this._width),this._offsetY+(this._isRotated?this._width:this._height));this._rcTex.divide(a.GetWidth(),a.GetHeight());this._quadTex.setFromRect(this._rcTex);this._isRotated&&this._quadTex.rotatePointsAnticlockwise();return a}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,
0,0,0),this._quadTex.setFromRect(this._rcTex))}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}GetTexQuad(){return this._quadTex}async ExtractImageToCanvas(){const a=await this._imageAsset.LoadToDrawable(),c=f.CreateCanvas(this._width,this._height);c.getContext("2d").drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return c}}}
{"use strict";const 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(c=>
c.GetImageInfo().LoadStaticTexture(b,a)))}ReleaseAllTextures(){for(const b of this._frames)b.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(b){b=Math.floor(b);if(0>b||b>=this._frames.length)throw new RangeError("invalid frame");return this._frames[b]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}}}
{"use strict";const f=self.C3;f.AnimationFrameInfo=class extends f.DefendedBase{constructor(b){super();this._imageInfo=f.New(f.ImageInfo);this._imageInfo.LoadData(b);this._duration=b[7];this._origin=f.New(f.Vector2,b[8],b[9]);this._imagePoints=b[10].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[11];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(c,d,e){super();const h=c.GetObjectReference(e[1]);this._runtime=c;this._plugin=c.GetPluginManager().GetPluginByConstructorFunction(h);this._sdkType=null;this._instSdkCtor=h.Instance;this._index=d;this._sid=e[11];this._name=e[0];this._jsPropName=this._runtime.GetJsPropName(e[14]);this._isGlobal=!!e[9];this._isFamily=!!e[2];this._isOnLoaderLayout=!!e[10];this._instVars=e[3].map(g=>
({sid:g[0],type:g[1],name:g[2],jsPropName:c.GetJsPropName(g[3])}));this._behaviorsCount=e[4];this._effectsCount=e[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=f.New(f.SparseGrid,c.GetOriginalViewportWidth(),c.GetOriginalViewportHeight());this._anyCollisionCellChanged=!0;this._anyInstanceParallaxed=!1;this._familyMembersSet=this._familyMembers=null;this._familyIndex=-1;this._familyEffectMap=this._familyBehaviorMap=this._familyInstVarMap=this._familiesSet=
this._families=null;this._isInContainer=!1;this._container=null;this._behaviorTypes=e[8].map(g=>f.BehaviorType.Create(this,g));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=f.New(f.SolStack,this);this._defaultInstanceData=null;this._defaultLayerIndex=0;this._isContained=!1;this._animationsBySid=this._animationsByName=this._animations=this._imageInfo=this._container=null;this._textureRefCount=
0;this._savedData=new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=!0;this._plugin.HasEffects()&&(this._effectList=f.New(f.EffectList,this,e[12]));e[6]&&(this._imageInfo=f.New(f.ImageInfo),this._imageInfo.LoadData(e[6]));if(e[7]){this._animations=e[7].map(g=>f.New(f.AnimationInfo,g));this._animationsByName=new Map;this._animationsBySid=new Map;for(const g of this._animations)this._animationsByName.set(g.GetName().toLowerCase(),g),this._animationsBySid.set(g.GetSID(),g)}this._isFamily?
(this._familyMembers=[],this._familyMembersSet=new Set,this._familyIndex=this._runtime._GetNextFamilyIndex()):(this._families=[],this._familiesSet=new Set,this._familyInstVarMap=[],this._familyBehaviorMap=[],this._familyEffectMap=[]);this._sdkType=f.New(h.Type,this,e[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=f.New(f.Event.Dispatcher);if(d=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new d(this),!(this._iObjectClass instanceof a))throw new TypeError("script interface class must derive from IObjectClass");
}else this._iObjectClass=new a(this);e[13]&&(d=e[13])&&this._sdkType.LoadTilemapData(d[0],d[1],d[2]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(e))}static Create(c,d,e){return f.New(f.ObjectClass,c,d,e)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const c of this._animations)c.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(c){for(let d=1,e=c.length;d<e;++d){const h=this._runtime.GetObjectClassByIndex(c[d]);this._familyMembers.push(h);this._familyMembersSet.add(h);h._families.push(this);h._familiesSet.add(this)}}_SetContainer(c){this._isInContainer=!0;this._container=c}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var c=
0;if(!this._isFamily)for(var d of this._families)for(var e of d.GetBehaviorTypes()){const l=e.GetName().toLowerCase();this._behaviorsByName.set(l,e);this._behaviorNameToIndex.set(l,c);this._behaviorTypesIncludingInherited.push(e);++c}for(var h of this.GetBehaviorTypes())d=h.GetName().toLowerCase(),this._behaviorsByName.set(d,h),this._behaviorNameToIndex.set(d,c),this._behaviorTypesIncludingInherited.push(h),++c;for(var g of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(g.GetBehavior().constructor);
if(!this._isFamily&&this._families.length){c=this._runtime.GetFamilyCount();f.extendArray(this._familyInstVarMap,c,0);f.extendArray(this._familyBehaviorMap,c,0);f.extendArray(this._familyEffectMap,c,0);c=[];d=g=h=0;for(const l of this._families)if(e=l.GetFamilyIndex(),this._familyInstVarMap[e]=h,h+=l.GetInstanceVariablesCount(),this._familyBehaviorMap[e]=g,g+=l.GetBehaviorTypesCount(),this._familyEffectMap[e]=d,d+=l.GetEffectTypesCount(),(e=l.GetEffectList())&&this._effectList)for(const m of e.GetAllEffectTypes())c.push(m.Clone(this._effectList));
this._effectList&&this._effectList.PrependEffectTypes(c)}}_CreateSingleGlobalInstance(c){const d=this._runtime._GetNewUID(),e=f.New(f.Instance,{runtime:this._runtime,objectType:this,uid:d});e._CreateSdkInstance(c[16],[]);this._runtime._MapInstanceByUID(d,e);this._instances.push(e)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(c){if(this._isFamily)return Promise.resolve();
this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(c)||Promise.resolve():Promise.resolve()}ReleaseTextures(){if(!this._isFamily){this._textureRefCount--;if(0>this._textureRefCount)throw Error("released textures too many times");0===this._textureRefCount&&this._sdkType.ReleaseTextures()}}OnDynamicTextureLoadComplete(){if(this._isFamily)throw Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(c){return this._isFamily?
Promise.resolve():this._sdkType.PreloadTexturesWithInstances(c)}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetIndex(){return this._index}GetSID(){return this._sid}IsFamily(){return this._isFamily}IsGlobal(){return this._isGlobal}IsWorldType(){return this._isWorldType}GetFamilyIndex(){return this._familyIndex}GetBehaviorTypes(){return this._behaviorTypes}GetBehaviorTypesCount(){return this._behaviorsCount}UsesBehaviorByCtor(c){return c&&
this._usedBehaviorCtors.has(c)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(c=>c.sid)}GetInstanceVariableIndexBySID(c){return this._instVars.findIndex(d=>d.sid===c)}GetInstanceVariableIndexByName(c){return this._instVars.findIndex(d=>d.name===c)}_GetAllInstanceVariableNames(){return this._instVars.map(c=>c.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(c=>c.jsPropName)}GetInstanceVariableType(c){c=Math.floor(c);
if(0>c||c>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[c].type}GetInstanceVariableName(c){c=Math.floor(c);if(0>c||c>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[c].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(c){return this._behaviorsByName.get(c.toLowerCase())||null}GetBehaviorIndexByName(c){c=
this._behaviorNameToIndex.get(c.toLowerCase());return"undefined"===typeof c?-1:c}GetEffectList(){return this._effectList}HasEffects(){return this._plugin.HasEffects()}UsesEffects(){return this._effectList&&this._effectList.HasAnyEffectType()}GetSolStack(){return this._solStack}GetCurrentSol(){return this._solStack.GetCurrentSol()}GetImageInfo(){return this._imageInfo}SetDefaultInstanceData(c){this._defaultInstanceData=c}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(c){this._defaultLayerIndex=
c}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(c){return this._familiesSet.has(c)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(c){return this._familyMembersSet.has(c)}GetFamilyBehaviorOffset(c){return this._familyBehaviorMap[c]}GetFamilyInstanceVariableOffset(c){return this._familyInstVarMap[c]}GetAnimationByName(c){if(!this._animations)throw Error("no animations");
return this._animationsByName.get(c.toLowerCase())||null}GetAnimationBySID(c){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(c)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const c=this.GetFirstAnimationFrame().GetImageInfo();return[c.GetWidth(),c.GetHeight()]}return this._imageInfo?[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()]:[100,
100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances;for(const c of this._runtime._GetInstancesPendingCreate())c.GetObjectClass()===this&&(yield c)}GetInstanceCount(){return this._instances.length}_AddInstance(c){this._instances.push(c)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&
!this._isFamily){var c=this._instances,d=0;for(let e=c.length;d<e;++d)c[d]._SetIID(d);c=this._runtime._GetInstancesPendingCreate();for(const e of c)e.GetObjectClass()===this&&e._SetIID(d++);this._iidsStale=!1}}GetInstanceByIID(c){var d=this._instances;if(c<d.length)return d[c];c-=d.length;d=this._runtime._GetInstancesPendingCreate();for(const e of d)if(e.GetObjectClass()===this){if(0===c)return e;--c}return null}GetFirstPicked(c){if(c&&c.IsInContainer()&&c.GetObjectClass()!==this)for(const d of c.siblings())if(d.GetObjectClass()===
this)return d;c=this.GetCurrentSol().GetInstances();return c.length?c[0]:null}GetPairedInstance(c){const d=this.GetCurrentSol().GetInstances();return 0<d.length?d[c.GetIID()%d.length]:null}*allCorrespondingInstances(c,d){const e=this.GetCurrentSol().GetInstances();var h=e.length;const g=d.GetCurrentSol(),l=d.GetCurrentSol().GetInstances(),m=l.length;var u=c.GetIID();if(d.IsFamily()||!g.IsSelectAll())u=l.indexOf(c);c=Math.ceil(h/m);h%=m;0===h||u<h?(u*=c,h=c):(u=h*c+(u-h)*(c-1),h=c-1);for(let w=u,q=
u+h;w<q;++w)yield e[w]}FinishCondition(c){this._sdkType.FinishCondition(c)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var c=this.GetCurrentSol(),d=c._GetOwnInstances(),e=c.IsSelectAll(),h=this._runtime.GetCurrentEventStackFrame();h=h&&h.GetCurrentEvent()&&h.GetCurrentEvent().IsOrBlock();for(const m of this._container.objectTypes())if(m!==this){m._UpdateIIDs();var g=m.GetCurrentSol();g._SetSelectAll(e);if(!e){var l=g._GetOwnInstances();f.clearArray(l);for(const u of d)l.push(m.GetInstanceByIID(u.GetIID()));
if(h){l=c._GetOwnElseInstances();g=g._GetOwnElseInstances();f.clearArray(g);for(const u of l)g.push(m.GetInstanceByIID(u.GetIID()))}}}}}_TruncateContainerSols(c,d){for(const e of this.GetContainer().objectTypes()){const h=e.GetCurrentSol();c?f.truncateArray(h._GetOwnElseInstances(),d):f.truncateArray(h._GetOwnInstances(),d)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(c){this._anyCollisionCellChanged=!!c}_SetAnyInstanceParallaxed(c){this._anyInstanceParallaxed=!!c}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&
this._isWorldType){for(const c of this._instances)c.GetWorldInfo()._UpdateCollisionCell();for(const c of this._runtime._GetInstancesPendingCreate())c.GetObjectClass()===this&&c.GetWorldInfo()._UpdateCollisionCell();this._anyCollisionCellChanged=!1}}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}HasSolidBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(f.Behaviors.Persist)}_SaveToJson(){const c=
{instances:this._instances.map(d=>d.SaveToJson())};this._savedData&&this._savedData.size&&(c.ex=f.ToSuperJSON(this._savedData));return c}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);var d=c.ex;d&&(this._savedData=f.FromSuperJSON(d));d=this._instances;c=c.instances;for(let e=0,h=Math.min(d.length,c.length);e<h;++e)d[e].LoadFromJson(c[e]);for(let e=c.length,h=d.length;e<h;++e)this._runtime.DestroyInstance(d[e]);for(let e=d.length,h=c.length;e<h;++e){d=c[e];let g=
null;if(this.IsWorldType()&&(g=this._runtime.GetMainRunningLayout().GetLayerBySID(d.w.l),!g))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,g,!1,0,0,!0).LoadFromJson(d)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(c){this._instanceUserScriptClass=c}DispatchUserScriptEvent(c){var d=this._runtime;(d=
d.IsDebug()&&!d.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(c);d&&b.AddScriptTime()}}}
{"use strict";const f=self.C3;f.Container=class extends f.DefendedBase{constructor(b,a){super();this._runtime=b;this._objectTypes=a;for(const c of this._objectTypes)c._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(b=>b.IsWorldType())}}}
{"use strict";const f=self.C3,b=self.C3Debugger,a=self.IInstance,c=[];let d=0;const e=new WeakMap,h=new WeakMap;f.Instance=class extends f.DefendedBase{constructor(g){super();this._runtime=g.runtime;this._objectType=g.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=g.uid;this._puid=d++;this._flags=0;this._behaviorInstances=this._instVarValues=c;var l=this._objectType.GetBehaviorTypesIncludingInherited();0<l.length&&(this._behaviorInstances=l.map((m,u)=>f.New(f.BehaviorInstance,
{runtime:this._runtime,behaviorType:m,instance:this,index:u})));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;l=this.GetPlugin();l.MustPreDraw()&&(this._flags|=4);if(l.IsWorldType())if(this._worldInfo=f.New(f.WorldInfo,this,g.layer),g.worldData)this._worldInfo.Init(g.worldData);else{this._worldInfo.InitNoData();const [m,u]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(m,u);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}g.instVarData?
this._LoadInstanceVariableData(g.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var g of this._behaviorInstances)g.Release();f.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(g=e.get(this))g.clear(),e.delete(this);if(g=h.get(this))g.clear(),h.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(g){0<g.length&&(this._instVarValues=[],f.shallowAssignArray(this._instVarValues,g))}_LoadDefaultInstanceVariables(){const g=this._objectType.GetInstanceVariablesCount();if(0!==g){this._instVarValues=[];var l=[0,0,""];for(let m=0;m<g;++m)this._instVarValues.push(l[this._objectType.GetInstanceVariableType(m)])}}_CreateSdkInstance(g,
l){if(this._sdkInst)throw Error("already got sdk instance");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m]._CreateSdkInstance(l?l[m]:null);this._sdkInst=f.New(this._objectType.GetInstanceSdkCtor(),this,g);if(!(this._sdkInst instanceof f.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}GetActiveTimeScale(){const g=
this._timeScale;return-1===g?this.GetRuntime().GetTimeScale():g}SetTimeScale(g){g=+g;if(0>g||!isFinite(g))g=0;this._timeScale=g}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=f.New(f.Event.Dispatcher));return this._dispatcher}Draw(g){this._sdkInst.Draw(g)}OnCreate(g){this._sdkInst.OnCreate(g)}_SetHasTilemap(){this._flags|=2}HasTilemap(){return 0!==(this._flags&2)}_MarkDestroyed(){this._flags|=1}IsDestroyed(){return 0!==(this._flags&1)}MustPreDraw(){return 0!==
(this._flags&4)}SetMustMitigateZFighting(){this._flags|=32}MustMitigateZFighting(){return 0!==(this._flags&32)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(g){this._flags=g?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(g){this._flags=g?this._flags|16:this._flags&-17}SetFlag(g,l){g<<=16;this._flags=l?this._flags|g:this._flags&~g}GetFlag(g){return 0!==(this._flags&g<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetCurrentTexQuad(){return this._sdkInst.GetCurrentTexQuad()}IsCurrentTexRotated(){return this._sdkInst.IsCurrentTexRotated()}GetImagePoint(g){return this._sdkInst.GetImagePoint(g)}GetObjectClass(){return this._objectType}RendersToOwnZPlane(){return this._sdkInst.RendersToOwnZPlane()}BelongsToObjectClass(g){return g.IsFamily()?
g.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===g}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw Error("object does not support scene graph");}HasParent(){return null!==this.GetParent()}GetParent(){var g=this.GetWorldInfo();return g?(g=g.GetParent())?g.GetInstance():null:null}GetTopParent(){var g=this.GetWorldInfo();return g?(g=g.GetTopParent())?g.GetInstance():null:null}*parents(){const g=this.GetWorldInfo();if(g)for(const l of g.parents())yield l.GetInstance()}HasChildren(){const g=
this.GetWorldInfo();return g?g.HasChildren():!1}GetChildren(){const g=this.GetWorldInfo();return g?g.GetChildren().map(l=>l.GetInstance()):[]}*children(){const g=this.GetWorldInfo();if(g)for(const l of g.children())yield l.GetInstance()}*allChildren(){const g=this.GetWorldInfo();if(g)for(const l of g.allChildren())yield l.GetInstance()}GetChildCount(){const g=this.GetWorldInfo();return g?g.GetChildCount():0}GetChildAt(g){const l=this.GetWorldInfo();return l?(g=l.GetChildAt(g))?g.GetInstance():null:
null}AddChild(g,l){this.VerifySupportsSceneGraph();g.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(g.GetWorldInfo(),l||{})}RemoveChild(g){const l=this.GetWorldInfo();l&&l.RemoveChild(g.GetWorldInfo())}GetDestroyWithParent(){const g=this.GetWorldInfo();return g?g.GetDestroyWithParent():!1}SetupInitialSceneGraphConnections(){var g=this.GetWorldInfo();if(g&&(g=g.GetSceneGraphChildrenExportData()))for(const l of g)if(g=this._runtime.GetInstanceByUID(l[2])){const m=l[3];this.AddChild(g,{transformX:!!(m>>
0&1),transformY:!!(m>>1&1),transformWidth:!!(m>>2&1),transformHeight:!!(m>>3&1),transformAngle:!!(m>>4&1),destroyWithParent:!!(m>>5&1),transformZElevation:!!(m>>6&1)})}}IsInContainer(){return null!==this._siblings}_AddSibling(g){this._siblings.push(g)}GetSiblings(){return this._siblings}HasSibling(g){return!!this.GetSibling(g)}GetSibling(g){const l=this.siblings();if(null===l||0===l.length)return!1;for(const m of l)if(m.GetObjectClass()===g)return m;return null}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol().SetSinglePicked(g)}_PushSiblingsToSolInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushInstance(g)}_SetSiblingsToSolInstancesIndex(g){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnInstances()[g]=
l}_PushSiblingsToSolElseInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushElseInstance(g)}_SetSiblingsToSolElseInstancesIndex(g){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[g]=l}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(g){this._iid=g}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(g){if(!g)return null;
for(const l of this._behaviorInstances)if(l.GetBehavior()instanceof g)return l;return null}GetBehaviorSdkInstanceFromCtor(g){return g?(g=this.GetBehaviorInstanceFromCtor(g))?g.GetSdkInstance():null:null}GetBehaviorIndexBySID(g){const l=this._behaviorInstances;for(let m=0,u=l.length;m<u;++m)if(l[m].GetBehaviorType().GetSID()===g)return m;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(g){g|=
0;const l=this._instVarValues;if(0>g||g>=l.length)throw new RangeError("invalid instance variable");return l[g]}_GetInstanceVariableValueUnchecked(g){return this._instVarValues[g]}_GetInstanceVariableTypedValue(g){const l=this._instVarValues[g];return 0===this._objectType.GetInstanceVariableType(g)?!!l:l}SetInstanceVariableValue(g,l){g|=0;const m=this._instVarValues;if(0>g||g>=m.length)throw new RangeError("invalid instance variable");switch(this._objectType.GetInstanceVariableType(g)){case 0:m[g]=
l?1:0;break;case 1:m[g]="number"===typeof l?l:parseFloat(l);break;case 2:m[g]="string"===typeof l?l:l.toString();break;default:throw Error("unknown instance variable type");}}SetInstanceVariableOffset(g,l){if(0!==l){g|=0;var m=this._instVarValues;if(0>g||g>=m.length)throw new RangeError("invalid instance variable");var u=m[g];if("number"===typeof u)m[g]="number"===typeof l?m[g]+l:m[g]+parseFloat(l);else{if("boolean"===typeof u)throw Error("can not set offset of boolean variable");if("string"===typeof u)throw Error("can not set offset of string variable");
throw Error("unknown instance variable type");}}}GetSavedDataMap(){let g=e.get(this);if(g)return g;g=new Map;e.set(this,g);return g}GetUnsavedDataMap(){let g=h.get(this);if(g)return g;g=new Map;h.set(this,g);return g}_HasAnyCreateDestroyHandler(g){const l=this.GetObjectClass();if(l.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;for(const m of l.GetFamilies())if(m.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;return this._runtime.UserScriptDispatcher().HasAnyHandlerFor(g)?!0:!1}_TriggerOnCreatedOnSelfAndRelated(){const g=
new Set;g.add(this);const l=this.GetWorldInfo();if(l&&l.HasChildren())for(const m of this.allChildren())if(g.add(m),m.IsInContainer())for(const u of m.siblings())g.add(u);if(this.IsInContainer())for(const m of this.siblings())g.add(m);for(const m of g.values())m._TriggerOnCreated()}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const g=this.GetObjectClass(),l=new f.Event("instancecreate");l.instance=this.GetInterfaceClass();g.DispatchUserScriptEvent(l);for(const m of g.GetFamilies())m.DispatchUserScriptEvent(l);
this._runtime.DispatchUserScriptEvent(l)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(g){if(this._iScriptInterface){var l=new f.Event("destroy");l.isEndingLayout=g;this.DispatchUserScriptEvent(l)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){l=this.GetObjectClass();var m=new f.Event("instancedestroy");m.instance=this.GetInterfaceClass();
m.isEndingLayout=g;l.DispatchUserScriptEvent(m);for(const u of l.GetFamilies())u.DispatchUserScriptEvent(m);this._runtime.DispatchUserScriptEvent(m)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(g="full"){const l={};"full"===g?l.uid=this.GetUID():l.c3=!0;if("visual-state"!==g){var m=e.get(this);m&&m.size&&(l.ex=f.ToSuperJSON(m));-1!==this.GetTimeScale()&&(l.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){m={};var u=this._objectType.GetInstanceVariableSIDs();
for(let w=0,q=this._instVarValues.length;w<q;++w)m[u[w].toString()]=this._instVarValues[w];l.ivs=m}if(this._behaviorInstances.length){m={};for(const w of this._behaviorInstances)(u=w.SaveToJson())&&(m[w.GetBehaviorType().GetSID().toString()]=u);l.behs=m}}this._worldInfo&&(l.w=this._worldInfo._SaveToJson(g));(g=this._sdkInst.SaveToJson())&&(l.data=g);return l}_OnBeforeLoad(g="full"){this._worldInfo&&this._worldInfo._OnBeforeLoad(g)}LoadFromJson(g,l="full"){if("full"===l)this._uid=g.uid;else if(!g.c3)return;
if("visual-state"!==l){var m=e.get(this);m&&(m.clear(),e.delete(this));if(m=g.ex)m=f.FromSuperJSON(m),e.set(this,m);this._timeScale=g.hasOwnProperty("mts")?g.mts:-1;if(m=g.ivs)for(const [q,t]of Object.entries(m))if(m=parseInt(q,10),m=this._objectType.GetInstanceVariableIndexBySID(m),!(0>m||m>=this._instVarValues.length)){var u=t;null===u&&(u=NaN);this._instVarValues[m]=u}}if(this.GetPlugin().IsWorldType()){m=g.w;var w=m.l;this._worldInfo.GetLayer().GetSID()!==w&&(u=this._worldInfo.GetLayer(),(w=u.GetLayout().GetLayerBySID(w))?
(this._worldInfo._SetLayer(w),u._RemoveInstance(this,!0),w._AddInstance(this,!0),w.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===l&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(m,l)}if("visual-state"!==l&&(l=g.behs))for(const [q,t]of Object.entries(l))l=parseInt(q,10),l=this.GetBehaviorIndexBySID(l),0>l||l>=this._behaviorInstances.length||this._behaviorInstances[l].LoadFromJson(t);(g=g.data)&&this._sdkInst.LoadFromJson(g)}GetInterfaceClass(){return this._iScriptInterface||
this._InitUserScriptInterface()}_InitUserScriptInterface(){var g=this._worldInfo?self.IWorldInstance:a;const l=this._sdkInst.GetScriptInterfaceClass(),m=this._objectType._GetUserScriptInstanceClass(),u=m||l||g;a._Init(this);this._iScriptInterface=new u;a._Init(null);if(l&&!(this._iScriptInterface instanceof g))throw new TypeError(`script interface class '${l.name}' does not extend the right base class '${g.name}'`);if(m&&(g=l||g,!(this._iScriptInterface instanceof g)))throw new TypeError(`setInstanceClass(): class '${m.name}' does not extend the right base class '${g.name}'`);
return this._iScriptInterface}_GetInstVarsScriptDescriptor(g){if(0!==this._instVarValues.length){var l={},m=this._objectType._GetAllInstanceVariableJsPropNames();for(let u=0,w=m.length;u<w;++u)l[m[u]]={configurable:!1,enumerable:!0,get:f.Instance.prototype._GetInstanceVariableTypedValue.bind(this,u),set:f.Instance.prototype.SetInstanceVariableValue.bind(this,u)};l=Object.create(Object.prototype,l);g.instVars={value:l,writable:!1}}}_GetBehaviorsScriptDescriptor(g){var l=this._behaviorInstances;if(0!==
l.length){var m={};for(const u of l)m[u.GetBehaviorType().GetJsPropName()]={value:u.GetScriptInterface(),writable:!1};l=Object.create(Object.prototype,m);g.behaviors={value:l,writable:!1}}}DispatchUserScriptEvent(g){g.instance=this.GetInterfaceClass();var l=this._runtime;(l=l.IsDebug()&&!l.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this.GetInterfaceClass().dispatchEvent(g);l&&b.AddScriptTime()}}}
{"use strict";const f=self.C3;f.SceneGraphInfo=class extends f.DefendedBase{constructor(b){super();this._owner=b;this._parent=null;this._children=[];this._startWidth=b.GetWidth();this._startHeight=b.GetHeight();this._startScaleY=this._startScaleX=1;this._parentStartAngle=0}Release(){this._parent=null;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}GetStartScaleX(){return this._startScaleX}SetStartScaleX(b){this._startScaleX=
b}GetStartScaleY(){return this._startScaleY}SetStartScaleY(b){this._startScaleY=b}_GetStartWidth(){return this._startWidth}_GetStartHeight(){return this._startHeight}GetParentScaleX(){return this._owner.GetTransformWithParentWidth()?this._parent.GetWidth()/this._parent._GetSceneGraphInfo()._GetStartWidth():1}GetParentScaleY(){return this._owner.GetTransformWithParentHeight()?this._parent.GetHeight()/this._parent._GetSceneGraphInfo()._GetStartHeight():1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(){return{sw:this._startWidth,
sh:this._startHeight,sx:this._startScaleX,sy:this._startScaleY,psa:this._parentStartAngle,c:this._children.map(b=>{let a="";b.GetTransformWithParentX()&&(a+="x");b.GetTransformWithParentY()&&(a+="y");b.GetTransformWithParentWidth()&&(a+="w");b.GetTransformWithParentHeight()&&(a+="h");b.GetTransformWithParentAngle()&&(a+="a");b.GetTransformWithParentZElevation()&&(a+="z");b.GetDestroyWithParent()&&(a+="d");return{uid:b.GetInstance().GetUID(),f:a}})}}_LoadFromJson(b){this._startWidth=b.sw;this._startHeight=
b.sh;this._startScaleX=b.sx;this._startScaleY=b.sy;this._parentStartAngle=b.psa}_OnAfterLoad(b){const a=this._owner,c=a.GetRuntime();for(const d of b.c){b=c.GetInstanceByUID(d.uid).GetWorldInfo();const e=d.f,h={};h.transformX=e.includes("x");h.transformY=e.includes("y");h.transformWidth=e.includes("w");h.transformHeight=e.includes("h");h.transformAngle=e.includes("a");h.transformZElevation=e.includes("z");h.destroyWithParent=e.includes("d");a.AddChild(b,h)}}}}
{"use strict";const f=self.C3,b=f.New(f.Rect),a=f.New(f.Quad),c=f.New(f.Event,"bboxchange",!1),d=f.New(f.Color,0,0,0,0),e=f.New(f.CollisionPoly),h=f.New(f.Color,1,1,1,1),g=f.New(f.Rect,0,0,-1,-1),l=f.New(f.Rect,0,0,-1,-1),m=new Set(["absolute","relative"]),u=[];let w=!0;const q=new WeakMap,t=new WeakMap;f.WorldInfo=class extends f.DefendedBase{constructor(p,r){super();this._inst=p;this._objectClass=p.GetObjectClass();this._runtime=p.GetRuntime();this._layer=r;this._zIndex=-1;this._flags=196635;this._objectClass.GetPlugin().IsRotatable()&&
(this._flags|=128);this._oy=this._ox=this._cosA=this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=NaN;this._boundingBox=f.New(f.Rect);this._boundingQuad=f.New(f.Quad);this._collisionCells=l;this._renderCells=g;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=h;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=f.New(f.InstanceEffectList,
this._inst,this));this._meshInfo=this._sceneGraphInfo=null}_MarkDestroyed(){this._flags|=256}Release(){this._stateGroup&&(this._runtime.GetRenderer().ReleaseStateGroup(this._stateGroup),this._stateGroup=null);this._sourceCollisionPoly=null;this._transformedPolyInfo&&(this._transformedPolyInfo.poly.Release(),this._transformedPolyInfo=null);this._solidFilterTags&&(this._solidFilterTags.clear(),this._solidFilterTags=null);this.ReleaseMesh();this.HasParent()&&this.GetParent().RemoveChild(this);if(this.HasChildren()){const p=
[...this.GetChildren()];for(const r of p)this.RemoveChild(r)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(p){w=!1;this.SetXY(p[0],p[1]);this.SetZElevation(p[2]);this.SetSize(p[3],p[4]);this._depth=0;this.IsRotatable()?this.SetAngle(p[6]):this._a=0;d.setFromJSON(p[7]);this._SetColor(d);this.SetOriginX(p[8]);this.SetOriginY(p[9]);this.SetBlendMode(p[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(p[12]);p[14]&&q.set(this,
{childrenData:p[14][1],zIndexData:p[14][2]});if(p[15]){var r=p[15];this.CreateMesh(r[0],r[1]);p=this.GetSourceMesh();r=r[2];for(let x=0,y=r.length;x<y;++x){const E=r[x];for(let H=0,A=E.length;H<A;++H){const F=E[H],J=p.GetMeshPointAt(H,x);J.SetX(F[0]);J.SetY(F[1]);J.SetZElevation(F[2]);J.SetU(F[3]);J.SetV(F[4])}}}w=!0;this._UpdateRendererStateGroup()}InitNoData(){this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=0;this._cosA=1;this._oy=this._ox=0;this._UpdateRendererStateGroup()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetInstance(){return this._inst}_GetParentOffsetAngle(){return this.GetTransformWithParentAngle()?
this.GetParent().GetAngle()-this._sceneGraphInfo.GetParentStartAngle():0}SetX(p){p=+p;if(this.GetTransformWithParentX()){const r=this._sceneGraphInfo;p-=this.GetX();const x=-this._GetParentOffsetAngle();0===x?this._x+=p/r.GetParentScaleX():(this._x+=Math.cos(x)*p/r.GetParentScaleX(),this.GetTransformWithParentY()&&(this._y+=Math.sin(x)*p/r.GetParentScaleY()))}else this._x=p}OffsetX(p){p=+p;this.GetTransformWithParentX()?this.SetX(this.GetX()+p):this._x+=p}GetX(){if(this.GetTransformWithParentX()){let p=
this._x;const r=this._sceneGraphInfo,x=this.GetParent(),y=this._GetParentOffsetAngle();0===y?p*=r.GetParentScaleX():(p=p*r.GetParentScaleX()*Math.cos(y),this.GetTransformWithParentY()&&(p-=this._y*r.GetParentScaleY()*Math.sin(y)));return x.GetX()+p}return this._x}SetY(p){p=+p;if(this.GetTransformWithParentY()){const r=this._sceneGraphInfo;p-=this.GetY();const x=-this._GetParentOffsetAngle();0===x?this._y+=p/r.GetParentScaleY():(this.GetTransformWithParentX()&&(this._x-=Math.sin(x)*p/r.GetParentScaleX()),
this._y+=Math.cos(x)*p/r.GetParentScaleY())}else this._y=p}OffsetY(p){p=+p;this.GetTransformWithParentY()?this.SetY(this.GetY()+p):this._y+=p}GetY(){if(this.GetTransformWithParentY()){let p=this._y;const r=this._sceneGraphInfo,x=this.GetParent(),y=this._GetParentOffsetAngle();0===y?p*=r.GetParentScaleY():(p=p*r.GetParentScaleY()*Math.cos(y),this.GetTransformWithParentX()&&(p+=this._x*r.GetParentScaleX()*Math.sin(y)));return x.GetY()+p}return this._y}SetXY(p,r){p=+p;r=+r;if(this.GetTransformWithParentXOrY()){const y=
this.GetTransformWithParentX(),E=this.GetTransformWithParentY(),H=this._sceneGraphInfo,A=p-this.GetX(),F=r-this.GetY();var x=-this._GetParentOffsetAngle();if(0===x)this._x=y?this._x+A/H.GetParentScaleX():p,this._y=E?this._y+F/H.GetParentScaleY():r;else{const J=Math.sin(x);x=Math.cos(x);this._x=y?E?this._x+(x*A-J*F)/H.GetParentScaleX():this._x+x*A/H.GetParentScaleX():p;this._y=E?y?this._y+(J*A+x*F)/H.GetParentScaleY():this._y+x*F/H.GetParentScaleY():r}}else this._x=p,this._y=r}OffsetXY(p,r){p=+p;r=
+r;this.GetTransformWithParentXOrY()?this.SetXY(this.GetX()+p,this.GetY()+r):(this._x+=p,this._y+=r)}EqualsXY(p,r){return this.GetX()===p&&this.GetY()===r}SetZElevation(p){p=+p;this.GetTransformWithParentZElevation()&&(p-=this.GetParent().GetZElevation());this._zElevation!==p&&(this._zElevation=p,this._UpdateZElevation(),p=this.GetLayer(),0!==this._zElevation&&p._SetAnyInstanceZElevated(),p.SetZIndicesChanged())}_UpdateZElevation(){this._UpdateRendererStateGroup();if(this.HasChildren()){const p=this.GetChildren();
for(let r=0,x=p.length;r<x;r++){const y=p[r];y.GetTransformWithParentZElevation()&&y._UpdateZElevation()}}}OffsetZElevation(p){this.SetZElevation(this.GetZElevation()+p)}GetZElevation(){return this.GetTransformWithParentZElevation()?this.GetParent().GetZElevation()+this._zElevation:this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(p){p=+p;if(this.GetTransformWithParentWidth()){const r=this.GetWidth();this._w=0===r?1E-6:p/r*this._w}else this._w=
p}OffsetWidth(p){p=+p;this.GetTransformWithParentWidth()?this.SetWidth(this.GetWidth()+p):this._w+=p}GetWidth(){return this.GetTransformWithParentWidth()?this.GetParent().GetWidth()*this._w:this._w}SetHeight(p){p=+p;if(this.GetTransformWithParentHeight()){const r=this.GetHeight();this._h=0===r?1E-6:p/r*this._h}else this._h=p}OffsetHeight(p){p=+p;this.GetTransformWithParentHeight()?this.SetHeight(this.GetHeight()+p):this._h+=p}GetHeight(){return this.GetTransformWithParentHeight()?this.GetParent().GetHeight()*
this._h:this._h}SetSize(p,r){p=+p;r=+r;if(this.GetTransformWithParentWidth()){const x=this.GetWidth();this._w=0===x?1E-6:p/x*this._w}else this._w=p;this.GetTransformWithParentHeight()?(p=this.GetHeight(),this._h=0===p?1E-6:r/p*this._h):this._h=r}GetDepth(){return this._depth}SetDepth(p){if(0>p)throw new RangeError("invalid depth");this._depth=p}GetSceneGraphScale(){if(this.HasParent()){const p=this._sceneGraphInfo;return Math.min(p.GetParentScaleX(),p.GetParentScaleY())}return 1}IsRotatable(){return 0!==
(this._flags&128)}SetAngle(p){p=+p;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(p-=this.GetParent().GetAngle()),p=f.clampAngle(p),this._a!==p&&(this._a=p,this._MarkSinCosAngleChanged()))}OffsetAngle(p){p=+p;0!==p&&this.IsRotatable()&&(this._a=f.clampAngle(this._a+p),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|=262144;if(this.HasChildren()){const p=this.GetChildren();for(let r=0,x=p.length;r<x;r++)p[r]._MarkSinCosAngleChanged()}}GetAngle(){return this.GetTransformWithParentAngle()?
f.clampAngle(this.GetParent().GetAngle()+this._a):this._a}_MaybeUpdateSinCosAngle(){const p=this._flags;if(0!==(p&262144)){var r=this.GetAngle();this._sinA=Math.sin(r);this._cosA=Math.cos(r);this._flags=p&-262145}}GetSinAngle(){this._MaybeUpdateSinCosAngle();return this._sinA}GetCosAngle(){this._MaybeUpdateSinCosAngle();return this._cosA}SetOriginX(p){this._ox=+p}OffsetOriginX(p){this._ox+=+p}GetOriginX(){return this._ox}SetOriginY(p){this._oy=+p}OffsetOriginY(p){this._oy+=+p}GetOriginY(){return this._oy}_SetColor(p){this._color.equals(p)||
(this._color===h?(this._color=f.New(f.Color,p),this._colorPremultiplied=f.New(f.Color,p),this._colorPremultiplied.premultiply()):p.equalsRgba(1,1,1,1)?this._colorPremultiplied=this._color=h:(this._color.set(p),this._colorPremultiplied.set(p),this._colorPremultiplied.premultiply()),this._UpdateRendererStateGroup())}SetOpacity(p){p=f.clamp(+p,0,1);this._color.a!==p&&(d.copyRgb(this._color),d.a=p,this._SetColor(d))}OffsetOpacity(p){this.SetOpacity(this.GetOpacity()+p)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(p){this._color.equalsIgnoringAlpha(p)||
(d.copyRgb(p),d.a=this._color.a,this._SetColor(d))}SetUnpremultipliedColorRGB(p,r,x){d.setRgb(p,r,x);this.SetUnpremultipliedColor(d)}OffsetUnpremultipliedColorRGB(p,r,x){if(0!==p||0!==r||0!==x)d.copyRgb(this._color),d.r+=p,d.g+=r,d.b+=x,this.SetUnpremultipliedColor(d)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}GetDestroyWithParent(){return 0!==(this._flags&512)}SetDestroyWithParent(p){this._SetFlag(512,p)}GetTransformWithParentX(){return 0!==
(this._flags&1024)}SetTransformWithParentX(p){this._SetFlag(1024,p)}GetTransformWithParentY(){return 0!==(this._flags&2048)}GetTransformWithParentXOrY(){return 0!==(this._flags&3072)}SetTransformWithParentY(p){this._SetFlag(2048,p)}GetTransformWithParentWidth(){return 0!==(this._flags&4096)}SetTransformWithParentWidth(p){this._SetFlag(4096,p)}GetTransformWithParentHeight(){return 0!==(this._flags&8192)}SetTransformWithParentHeight(p){this._SetFlag(8192,p)}GetTransformWithParentAngle(){return 0!==
(this._flags&16384)}SetTransformWithParentAngle(p){this._SetFlag(16384,p)}GetTransformWithParentZElevation(){return 0!==(this._flags&32768)}SetTransformWithParentZElevation(p){this._SetFlag(32768,p)}_ClearAllSceneGraphFlags(){this._flags&=-65025}AddChild(p,r){if(p!==this&&!p.HasParent()&&!this._HasChildRecursive(p)&&!this._HasAnyParent(p)){var x=p.GetX(),y=p.GetY(),E=p.GetWidth(),H=p.GetHeight(),A=p.GetAngle(),F=p.GetZElevation();p._SetParent(this);p.SetTransformWithParentX(r.transformX);p.SetTransformWithParentY(r.transformY);
p.SetTransformWithParentWidth(r.transformWidth);p.SetTransformWithParentHeight(r.transformHeight);p.SetTransformWithParentAngle(r.transformAngle);p.SetTransformWithParentZElevation(r.transformZElevation);p.SetDestroyWithParent(r.destroyWithParent);r.transformX&&(p._x=x-this.GetX(),r.transformWidth&&(p._x/=this.GetWidth()/this._sceneGraphInfo._GetStartWidth()));r.transformY&&(p._y=y-this.GetY(),r.transformHeight&&(p._y/=this.GetHeight()/this._sceneGraphInfo._GetStartHeight()));r.transformWidth&&(p._w=
E/this.GetWidth(),p._sceneGraphInfo.SetStartScaleX(p._w));r.transformHeight&&(p._h=H/this.GetHeight(),p._sceneGraphInfo.SetStartScaleY(p._h));r.transformAngle&&(p._a=A-this.GetAngle());r.transformZElevation&&(p._zElevation=F-this.GetZElevation());this._AddChildToSceneGraphInfo(p);this.SetBboxChanged()}}RemoveChild(p){if(p.GetParent()===this){var r=p.GetX(),x=p.GetY(),y=p.GetWidth(),E=p.GetHeight(),H=p.GetAngle(),A=p.GetZElevation();p._SetParent(null);p._ClearAllSceneGraphFlags();p.SetXY(r,x);p.SetSize(y,
E);p.SetAngle(H);p.SetZElevation(A);this._RemoveChildFromSceneGraphInfo(p);this.SetBboxChanged()}}_ResetAllSceneGraphState(){for(var p of this.children())this.RemoveChild(p);(p=this.GetParent())&&p.RemoveChild(this);this._ClearAllSceneGraphFlags()}HasParent(){return null!==this.GetParent()}GetParent(){const p=this._sceneGraphInfo;return null!==p?p.GetParent():null}GetTopParent(){let p=this;for(;p.HasParent();)p=p.GetParent();return p}*parents(){let p=this.GetParent();for(;p;)yield p,p=p.GetParent()}HasChild(p){return this.GetChildren().includes(p)}HasChildren(){const p=
this._sceneGraphInfo;return null!==p?p.HasChildren():!1}GetChildren(){const p=this._sceneGraphInfo;return null!==p?p.GetChildren():u}children(){return this.GetChildren()}*allChildren(){for(const p of this.children())yield p,yield*p.allChildren()}GetChildCount(){return this.GetChildren().length}GetChildAt(p){const r=this.GetChildren();p=Math.floor(+p);return 0>p||p>=r.length?null:r[p]}_CreateSceneGraphInfo(p){this._sceneGraphInfo||(this._sceneGraphInfo=f.New(f.SceneGraphInfo,this));p&&this._sceneGraphInfo.SetParent(p)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&&
(this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(p){p?(p._CreateSceneGraphInfo(null),this._CreateSceneGraphInfo(p)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(p){if(!this.HasParent())return!1;const r=this.GetParent();return r===p?!0:r._HasAnyParent(p)}_HasChildRecursive(p){if(this.HasChild(p))return!0;for(const r of this.GetChildren())if(r._HasChildRecursive(p))return!0;return!1}_AddChildToSceneGraphInfo(p){this._sceneGraphInfo.GetChildren().push(p)}_RemoveChildFromSceneGraphInfo(p){const r=
this._sceneGraphInfo.GetChildren(),x=r.indexOf(p);-1!==x&&r.splice(x,1);0!==r.length||this.HasParent()||this._ReleaseSceneGraphInfo();p.HasChildren()||p._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){const p=q.get(this);return p?p.childrenData:null}GetSceneGraphZIndexExportData(){const p=q.get(this);return p?p.zIndexData:NaN}GetSceneGraphZIndex(){return t.get(this)||NaN}SetSceneGraphZIndex(p){t.set(this,p)}SetUsePointsShaderProgram(){this._SetFlag(524288,!0);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(w){var p=
this._runtime.GetRenderer();this._stateGroup&&p.ReleaseStateGroup(this._stateGroup);var r=0!==(this._flags&524288)?p.GetPointsRenderingProgram()||"<point>":p.GetTextureFillShaderProgram()||"<default>";this._stateGroup=p.AcquireStateGroup(r,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===h}SetBlendMode(p){p|=0;if(0>p||31<p)throw new RangeError("invalid blend mode");this.GetBlendMode()!==p&&(this._flags=
this._flags&-2080374785|p<<26,this._UpdateRendererStateGroup())}GetBlendMode(){return(this._flags&2080374784)>>26}_SetLayer(p){this._layer=p;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(p){this._zIndex=p|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(p,r){this._flags=r?this._flags|p:this._flags&~p}IsVisible(){return 0!==(this._flags&
1)}SetVisible(p){this._SetFlag(1,p)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(p){p=!!p;this.IsCollisionEnabled()!==p&&(this._SetFlag(8,p),p?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(p,r){this._SetFlag(32,p);this._solidFilterTags&&this._solidFilterTags.clear();if(r.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const x of r.split(" "))x&&this._solidFilterTags.add(x.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(p){const r=
0!==(this._flags&32),x=this._solidFilterTags;if(!p||!x)return!r;for(const y of x)if(p.has(y))return r;return!r}SetBboxChanged(){this._flags|=65554;this._objectClass._SetAnyCollisionCellChanged(!0);this._runtime.UpdateRender();this._layer.UsesRenderCells()&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags&=-3,this._UpdateRenderCell());0!==(this._flags&4)&&this._inst.Dispatcher().dispatchEvent(c);if(null!==this._sceneGraphInfo){const p=this._sceneGraphInfo.GetChildren();for(let r=
0,x=p.length;r<x;++r)p[r].SetBboxChanged()}}CalculateBbox(p,r,x){const y=this.GetX(),E=this.GetY(),H=this.GetWidth(),A=this.GetHeight(),F=this.GetAngle();p.setWH(y-this._ox*H,E-this._oy*A,H,A);x&&this.HasMesh()&&this._ExpandBboxForMesh(p);0===F?r.setFromRect(p):(p.offset(-y,-E),r.setFromRotatedRectPrecalc(p,this.GetSinAngle(),this.GetCosAngle()),r.offset(y,E),r.getBoundingBox(p));p.normalize()}_UpdateBbox(){const p=this._flags;0!==(p&2)&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),
this._flags=p&-3)}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(p){var r=this.GetX(),x=this.GetY();r=Math.round(r)-r;x=Math.round(x)-x;if(0===r&&0===x)return p;a.copy(p);a.offset(r,x);return a}OverwriteBoundingBox(p){this._boundingBox.copy(p);this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell();this._UpdateRenderCell()}SetBboxChangeEventEnabled(p){this._SetFlag(4,p)}IsBboxChangeEventEnabled(){return 0!==
(this._flags&4)}IsInViewport(p,r,x){return r&&0!==this.GetDepth()?this.IsInViewport3D(this.GetLayer()._GetViewFrustum()):0===this.GetZElevation()||x?p.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const p=this.GetLayer(),r=this.GetTotalZElevation();if(r>=p.GetCameraZ())return!1;p.GetViewportForZ(r,b);return b.intersectsRect(this.GetBoundingBox())}IsInViewport3D(p){var r=this.GetBoundingBox();const x=r.getLeft(),y=r.getRight(),E=r.getTop();r=r.getBottom();
const H=this.GetTotalZElevation(),A=H+this.GetDepth();return p.ContainsAABB(x,E,H,y,r,A)}_SetDrawBackFaceOnly(p){this._SetFlag(1048576,p)}_SetDrawNonBackFacesOnly(p){this._SetFlag(2097152,p)}IsDrawBackFaceOnly(){return 0!==(this._flags&1048576)}IsDrawNonBackFacesOnly(){return 0!==(this._flags&2097152)}SetSourceCollisionPoly(p){this._sourceCollisionPoly=p;this._DiscardTransformedCollisionPoly();this.HasMesh()&&(this._meshInfo.meshPoly=null)}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return null!==
this._sourceCollisionPoly||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(p,r,x){let y=0,E=1;0!==x&&(y=Math.sin(x),E=Math.cos(x));return this._GetCustomTransformedCollisionPolyPrecalc(p,r,x,y,E)}_GetCustomTransformedCollisionPolyPrecalc(p,r,x,y,E){let H=this._transformedPolyInfo;null===H&&(this._transformedPolyInfo=H={poly:f.New(f.CollisionPoly),
width:NaN,height:NaN,angle:NaN});const A=H.poly;if(H.width===p&&H.height===r&&H.angle===x)return A;const F=this._sourceCollisionPoly;if(this.HasMesh()){const J=this.GetOriginX(),B=this.GetOriginY(),I=this.GetSourceMesh();let L=this._meshInfo.meshPoly;L||(F?(e.copy(F),e.offset(J,B)):e.setDefaultPoints(),L=I.InsertPolyMeshVertices(e),this._meshInfo.meshPoly=L);I.TransformCollisionPoly(L,A);A.offset(-J,-B);A.transformPrecalc(p,r,y,E)}else F?(A.copy(F),A.transformPrecalc(p,r,y,E)):A.setFromQuad(this.GetBoundingQuad(),
-this.GetX(),-this.GetY());H.width=p;H.height=r;H.angle=x;return A}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);const p=this._transformedPolyInfo;null!==p&&(p.width=NaN)}CreateMesh(p,r){p=Math.floor(p);r=Math.floor(r);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:f.New(f.Gfx.Mesh,p,r),transformedMesh:f.New(f.Gfx.Mesh,p,r),meshPoly:null}}HasMesh(){return null!==this._meshInfo}GetSourceMesh(){if(!this.HasMesh())throw Error("no mesh");
return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(p){this._SetFlag(65536,p)}IsMeshChanged(){return 0!==(this._flags&65536)}SetPhysicsBodyChanged(p){this._SetFlag(131072,p)}IsPhysicsBodyChanged(){return 0!==(this._flags&131072)}_ExpandBboxForMesh(p){const r=this._meshInfo.sourceMesh,x=Math.min(r.GetMinX(),0),y=Math.min(r.GetMinY(),0),E=Math.max(r.GetMaxX(),1),H=Math.max(r.GetMaxY(),1),A=p.width(),F=p.height();
p.offsetLeft(x*A);p.offsetTop(y*F);p.offsetRight((E-1)*A);p.offsetBottom((H-1)*F);this._depth=r.GetMaxZ()}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(p,r,x){p=Math.floor(p);r=Math.floor(r);var y=x.mode||"absolute";if(!m.has(y))throw Error("invalid mode");y="relative"===y;let E=x.x,H=x.y;const A=x.zElevation;let F="number"===typeof x.u?x.u:y?0:-1;x="number"===typeof x.v?
x.v:y?0:-1;if(!this.HasMesh())return!1;const J=this.GetSourceMesh(),B=J.GetMeshPointAt(p,r);if(null===B)return!1;let I=!1;"number"===typeof A&&B.GetZElevation()!==A&&(B.SetZElevation(A),I=!0);y&&(E+=p/(J.GetHSize()-1),H+=r/(J.GetVSize()-1));-1!==F||y?(y&&(F+=p/(J.GetHSize()-1)),F=f.clamp(F,0,1)):F=B.GetU();-1!==x||y?(y&&(x+=r/(J.GetVSize()-1)),x=f.clamp(x,0,1)):x=B.GetV();if(B.GetX()===E&&B.GetY()===H&&B.GetU()===F&&B.GetV()===x)return I;B.SetX(E);B.SetY(H);B.SetU(F);B.SetV(x);this._DiscardTransformedCollisionPoly();
return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(p,r){return this.GetBoundingBox().containsPoint(p,r)&&this.GetBoundingQuad().containsPoint(p,r)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(p,r):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(p-this.GetX(),r-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()&&0===(this._flags&
256)){var p=this.GetBoundingBox(),r=this._objectClass._GetCollisionCellGrid(),x=this._collisionCells;b.set(r.XToCell(p.getLeft()),r.YToCell(p.getTop()),r.XToCell(p.getRight()),r.YToCell(p.getBottom()));x.equals(b)||(p=this._inst,x===l?(r.Update(p,null,b),this._collisionCells=f.New(f.Rect,b)):(r.Update(p,x,b),x.copy(b)),this._flags&=-17)}}_RemoveFromCollisionCells(){const p=this._collisionCells;p!==l&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,p,null),this._collisionCells=l)}_UpdateRenderCell(){const p=
this.GetLayer();if(p.UsesRenderCells()&&0===(this._flags&256)){var r=p.GetRenderGrid(),x=this.GetBoundingBox(),y=this._renderCells;b.set(r.XToCell(x.getLeft()),r.YToCell(x.getTop()),r.XToCell(x.getRight()),r.YToCell(x.getBottom()));y.equals(b)||(x=this._inst,y===g?(r.Update(x,null,b),this._renderCells=f.New(f.Rect,b)):(r.Update(x,y,b),y.copy(b)),p.SetRenderListStale())}}_RemoveFromRenderCells(){const p=this._renderCells;p!==g&&(this.GetLayer().GetRenderGrid().Update(this._inst,p,null),this._renderCells=
g)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const p=this._inst,r=this._layer,x=r._GetInstances();x.length&&x.at(-1)===p||(r._RemoveInstance(p,!1),r._AddInstance(p,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const p=this._inst,r=this._layer,x=r._GetInstances();x.length&&x[0]===p||(r._RemoveInstance(p,!1),r._PrependInstance(p,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(p){const r=this._inst,x=this._layer;if(x.GetLayout()!==p.GetLayout())throw Error("layer from different layout");
p!==x&&(x._RemoveInstance(r,!0),this._SetLayer(p),p._AddInstance(r,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(p,r){const x=this._inst;let y=!1;const E=this._layer;if(p.GetUID()!==x.GetUID()){var H=p.GetWorldInfo();if(!H)throw Error("expected world instance");H=H.GetLayer();E.GetIndex()!==H.GetIndex()&&(E._RemoveInstance(x,!0),this._SetLayer(H),H._AddInstance(x,!0),y=!0);p=H.MoveInstanceAdjacent(x,p,!!r);(y||p)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(p){this._SetFlag(64,
p)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(p){const r={x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(r.ze=this.GetZElevation());0!==this.GetAngle()&&(r.a=this.GetAngle());this.HasDefaultColor()||(r.c=this._color.toJSON());.5!==this.GetOriginX()&&(r.oX=this.GetOriginX());.5!==this.GetOriginY()&&(r.oY=this.GetOriginY());0!==this.GetBlendMode()&&(r.bm=this.GetBlendMode());this.IsVisible()||
(r.v=this.IsVisible());this.IsCollisionEnabled()||(r.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&(r.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(r.fx=this._instanceEffectList._SaveToJson());const x=0!==(this._flags&32);x&&(r.sfi=x);this._solidFilterTags&&(r.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&"visual-state"!==p&&(r.sgi=this._sceneGraphInfo._SaveToJson());this.HasMesh()&&(r.mesh=this.GetSourceMesh().SaveToJson());return r}_OnBeforeLoad(p){"visual-state"!==
p&&this._ResetAllSceneGraphState()}_LoadFromJson(p,r){w=!1;this.SetX(p.x);this.SetY(p.y);this.SetWidth(p.w);this.SetHeight(p.h);this._SetZIndex(p.zi);this.SetZElevation(p.hasOwnProperty("ze")?p.ze:0);this.SetAngle(p.hasOwnProperty("a")?p.a:0);p.hasOwnProperty("c")?d.setFromJSON(p.c):p.hasOwnProperty("o")?(d.copyRgb(this._color),d.a=p.o):d.setRgba(1,1,1,1);this._SetColor(d);this.SetOriginX(p.hasOwnProperty("oX")?p.oX:.5);this.SetOriginY(p.hasOwnProperty("oY")?p.oY:.5);this.SetBlendMode(p.hasOwnProperty("bm")?
p.bm:0);this.SetVisible(p.hasOwnProperty("v")?p.v:!0);this.SetCollisionEnabled(p.hasOwnProperty("ce")?p.ce:!0);this.SetBboxChangeEventEnabled(p.hasOwnProperty("be")?p.be:!1);this.SetSolidCollisionFilter(p.hasOwnProperty("sfi")?p.sfi:!1,p.hasOwnProperty("sft")?p.sft:"");this._instanceEffectList&&p.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(p.fx);if(p.hasOwnProperty("sgi")&&"visual-state"!==r){this._CreateSceneGraphInfo(null);const x=this._sceneGraphInfo,y=p.sgi;x._LoadFromJson(y);
const E=this.GetRuntime().Dispatcher(),H=()=>{E.removeEventListener("afterload",H);0===(this._flags&256)&&x._OnAfterLoad(y)};E.addEventListener("afterload",H)}p.hasOwnProperty("mesh")?(p=p.mesh,this.CreateMesh(p.cols,p.rows),this.GetSourceMesh().LoadFromJson(p)):this.ReleaseMesh();this.SetBboxChanged();w=!0;this._UpdateRendererStateGroup()}}}
{"use strict";const f=self.C3;f.BehaviorType=class extends f.DefendedBase{constructor(b,a){super();const c=b.GetRuntime(),d=c.GetPluginManager(),e=c.GetObjectReference(a[1]);d.HasBehaviorByConstructorFunction(e)||d.CreateBehavior(a);this._runtime=c;this._objectClass=b;this._behavior=d.GetBehaviorByConstructorFunction(e);this._sdkType=null;this._instSdkCtor=e.Instance;this._sid=a[2];this._name=a[0];this._jsPropName=this._runtime.GetJsPropName(a[3]);this._sdkType=f.New(e.Type,this);this.OnCreate()}static Create(b,
a){return f.New(f.BehaviorType,b,a)}Release(){this._behavior=this._runtime=null;this._sdkType.Release();this._instSdkCtor=this._sdkType=null}GetSdkType(){return this._sdkType}OnCreate(){this._sdkType.OnCreate()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetBehavior(){return this._behavior}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetSID(){return this._sid}GetJsPropName(){return this._jsPropName}}}
{"use strict";const f=self.C3,b=self.IBehaviorInstance;f.BehaviorInstance=class extends f.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._behaviorType=a.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=a.instance;this._index=a.index;this._iScriptInterface=this._sdkInst=null;this._behavior._AddInstance(this._inst)}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);this._behavior._RemoveInstance(this._inst);this._sdkInst.Release();
this._inst=this._behavior=this._behaviorType=this._runtime=this._iScriptInterface=this._sdkInst=null}_CreateSdkInstance(a){if(this._sdkInst)throw Error("already got sdk instance");this._sdkInst=f.New(this._behaviorType.GetInstanceSdkCtor(),this,a);this._InitScriptInterface()}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(a,
c){this._sdkInst.OnSpriteFrameChanged(a,c)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(a,c){var d=a.GetObjectInstance(),e=c.GetObjectInstance();const h=d.GetObjectClass().GetIndex(),g=e.GetObjectClass().GetIndex();if(h!==g)return h-g;d=d.GetPUID();e=e.GetPUID();return d!==e?d-e:a.GetBehaviorInstance()._GetIndex()-c.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const a=
this._sdkInst.GetScriptInterfaceClass(),c=a||b;b._Init(this);this._iScriptInterface=new c;b._Init(null);if(a&&!(this._iScriptInterface instanceof b))throw new TypeError(`script interface class '${a.name}' does not extend the right base class '${b.name}'`);}GetScriptInterface(){return this._iScriptInterface}}}
{"use strict";const 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 c of a)b=f.New(f.EffectType,this,c,this._allEffectTypes.length),this._allEffectTypes.push(b),this._effectTypesByName.set(b.GetName().toLowerCase(),b),3<=c.length&&this._effectParams.push(this._LoadSingleEffectParameters(c[2]));this.GetRuntime()._AddEffectList(this)}Release(){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,c=this._allEffectTypes.length;a<c;++a)this._allEffectTypes[a]._SetIndex(a)}}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,c=b.length;a<c;++a){const d=b[a];if(Array.isArray(d)){const e=f.New(f.Color);
e.setFromJSON(d);b[a]=e}}return b}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){f.clearArray(this._activeEffectTypes);let b=!0;for(const a of this._allEffectTypes)a.IsActive()&&(this._activeEffectTypes.push(a),a.GetShaderProgram().PreservesOpaqueness()||(b=!1));this._preservesOpaqueness=b}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return 0<this._allEffectTypes.length}GetEffectTypeByName(b){return this._effectTypesByName.get(b.toLowerCase())||
null}GetEffectTypeByIndex(b){b=Math.floor(+b);if(0>b||b>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[b]}IsEffectIndexActive(b){return this.GetEffectTypeByIndex(b).IsActive()}SetEffectIndexActive(b,a){this.GetEffectTypeByIndex(b).SetActive(a)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return 0<this._activeEffectTypes.length}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(b){return this._effectParams[b]}static SaveFxParamToJson(b){return b&&
b instanceof f.Color?{t:"color",v:b.toJSON()}:b}static LoadFxParamFromJson(b){if("object"===typeof b){if("color"===b.t){const a=f.New(f.Color);a.setFromJSON(b.v);return a}throw Error("invalid effect parameter type");}return b}static SaveFxParamsToJson(b){return b.map(f.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(b){return b.map(f.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(b=>({name:b.GetName(),active:b.IsActive(),params:f.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}LoadFromJson(b){for(const a of b)if(b=
this.GetEffectTypeByName(a.name))b.SetActive(a.active),this._effectParams[b.GetIndex()]=f.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}
{"use strict";const f=self.C3;f.EffectType=class extends f.DefendedBase{constructor(b,a,c){super();this._effectList=b;this._id=a[0];this._name=a[1];this._index=c;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(b){b=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,c=this._shaderProgram.GetParameterCount();a<c;++a){const d=this._shaderProgram.GetParameterType(a);
if("float"===d||"percent"===d)b.push(0);else if("color"===d)b.push(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){super();this._inst=b;this._wi=a;this._effectList=b.GetObjectClass().GetEffectList();this._wasDefaultColor=this._needsRebuildSteps=!0;this._wasTexRotated=this._wasRotatedOrNegativeSize=this._was3D=!1;this._effectChain=f.New(f.Gfx.EffectChain,b.GetRuntime().GetCanvasManager().GetEffectChainManager(),{drawContent:(c,d)=>{d=d.GetContentObject();const e=d.GetWorldInfo();c.SetColor(e.GetPremultipliedColor());
c.SetCurrentZ(e.GetTotalZElevation());d.Draw(c);c.SetCurrentZ(0)},getSourceTextureInfo:c=>{const d=c.GetCurrentTexRect(),[e,h]=c.GetCurrentSurfaceSize();return{srcTexRect:d,srcWidth:e,srcHeight:h}},getShaderParameters:c=>this.GetEffectParametersForIndex(c)});this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const c of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){this._effectChain.Release();
this._effectChain=null;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,c=b.length;a<c;++a){const d=b[a];if(Array.isArray(d)){const e=f.New(f.Color);e.setFromJSON(d);b[a]=e}}return b}LoadDefaultEffectParameters(){for(const b of this._effectList.GetAllEffectTypes())this._effectParams.push(b.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){f.clearArray(this._activeEffectTypes);const b=this._wi,a=this._effectList.GetAllEffectTypes(),c=this._activeEffectTypes,d=this._activeEffectFlags;let e=!0;for(let h=0,g=a.length;h<g;++h)if(d[h]){const l=a[h];c.push(l);l.GetShaderProgram().PreservesOpaqueness()||(e=!1)}this._preservesOpaqueness=e;b._SetHasAnyActiveEffect(!!c.length);this._needsRebuildSteps=!0}_MaybeRebuildEffectChainSteps(){const b=this._inst;
var a=this._wi;const c=a.HasDefaultColor(),d=0<a.GetDepth();a=0!==a.GetAngle()||0>a.GetWidth()||0>a.GetHeight();const e=b.IsCurrentTexRotated();if(this._needsRebuildSteps||c!==this._wasDefaultColor||d!==this._was3D||a!==this._wasRotatedOrNegativeSize||e!==this._wasTexRotated)this._effectChain.BuildSteps(this._activeEffectTypes.map(h=>h.GetShaderProgram()),{indexMap:this._activeEffectTypes.map(h=>h.GetIndex()),forcePreDraw:!c||b.MustPreDraw(),is3D:d,isSourceTextureRotated:e,isRotatedOrNegativeSizeInstance:a}),
this._needsRebuildSteps=!1,this._wasDefaultColor=c,this._was3D=d,this._wasRotatedOrNegativeSize=a,this._wasTexRotated=e}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(b){return this._effectParams[b]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(b=>b.GetShaderProgram().BlendsBackground())}IsEffectIndexActive(b){return this._activeEffectFlags[b]}SetEffectIndexActive(b,a){this._activeEffectFlags[b]=
!!a}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(b=>({name:b.GetName(),active:this._activeEffectFlags[b.GetIndex()],params: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=[],c=[],d=f.New(f.CollisionPoly),e=f.New(f.CollisionPoly),h=f.New(f.Quad),g=f.New(f.Rect),l=f.New(f.Rect);let m=null,u=null,w=null;f.CollisionEngine=class extends f.DefendedBase{constructor(q){super();this._runtime=q;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(q,t){const p=q.GetWorldInfo(),r=t.GetWorldInfo();p&&r&&p.IsCollisionEnabled()&&r.IsCollisionEnabled()&&this._registeredCollisions.push([q,t])}AddRegisteredCollisionCandidates(q,t,p){for(const [r,x]of this._registeredCollisions){let y;if(q===r)y=x;else if(q===x)y=r;else continue;y.BelongsToObjectClass(t)&&(p.includes(y)||p.push(y))}}CheckRegisteredCollision(q,
t){if(!this._registeredCollisions.length)return!1;for(const [p,r]of this._registeredCollisions)if(q===p&&t===r||q===r&&t===p)return!0;return!1}ClearRegisteredCollisions(){f.clearArray(this._registeredCollisions)}TestOverlap(q,t){if(!q||!t||q===t)return!1;q=q.GetWorldInfo();t=t.GetWorldInfo();if(!q.IsCollisionEnabled()||!t.IsCollisionEnabled())return!1;this._collisionCheckCount++;const p=q.GetLayer(),r=t.GetLayer();return p.IsTransformCompatibleWith(r)?this._TestOverlap_SameLayers(q,t):this._TestOverlap_DifferentLayers(q,
t)}_TestOverlap_SameLayers(q,t){if(!q.GetBoundingBox().intersectsRect(t.GetBoundingBox()))return!1;this._polyCheckCount++;if(!q.GetBoundingQuad().intersectsQuad(t.GetBoundingQuad())||q.HasTilemap()&&t.HasTilemap())return!1;if(q.HasTilemap())return this.TestTilemapOverlap(q,t);if(t.HasTilemap())return this.TestTilemapOverlap(t,q);if(!q.HasOwnCollisionPoly()&&!t.HasOwnCollisionPoly())return!0;const p=q.GetTransformedCollisionPoly(),r=t.GetTransformedCollisionPoly();return p.intersectsPoly(r,t.GetX()-
q.GetX(),t.GetY()-q.GetY())}_TestOverlap_DifferentLayers(q,t){var p=q.HasTilemap(),r=t.HasTilemap();if(p&&!r)return this.TestTilemapOverlapDifferentLayers(q,t);if(r&&!p)return this.TestTilemapOverlapDifferentLayers(t,q);if(r||p)return!1;r=q.GetLayer();p=t.GetLayer();d.copy(q.GetTransformedCollisionPoly());e.copy(t.GetTransformedCollisionPoly());var x=d.pointsArr();for(let y=0,E=x.length;y<E;y+=2){const H=y+1,A=x[H],[F,J]=r.LayerToCanvasCss(x[y]+q.GetX(),A+q.GetY());x[y]=F;x[H]=J}q=e.pointsArr();for(let y=
0,E=q.length;y<E;y+=2){r=y+1;x=q[r];const [H,A]=p.LayerToCanvasCss(q[y]+t.GetX(),x+t.GetY());q[y]=H;q[r]=A}d.setBboxChanged();e.setBboxChanged();this._polyCheckCount++;return d.intersectsPoly(e,0,0)}TestTilemapOverlapDifferentLayers(q,t){var p=q.GetLayer(),r=t.GetLayer();m||(m=f.New(f.CollisionPoly));u||(u=f.New(f.Rect));w||(w=f.New(f.Quad));var x=t.GetX(),y=t.GetY();const [E,H]=r.LayerToCanvasCss(x,y),[A,F]=p.CanvasCssToLayer(E,H);p=A-x;y=F-y;u.copy(t.GetBoundingBox());u.offset(p,y);if(!q.GetBoundingBox().intersectsRect(u))return!1;
w.copy(t.GetBoundingQuad());w.offset(p,y);this._polyCheckCount++;if(!q.GetBoundingQuad().intersectsQuad(w))return!1;m.copy(t.GetTransformedCollisionPoly());r=m.pointsArr();for(let J=0,B=r.length;J<B;J+=2)x=J+1,r[J]+=p,r[x]+=y;m.setBboxChanged();return this.TestTilemapOverlap(q,t,A,F,m,u,w)}TestTilemapOverlap(q,t,p,r,x,y,E){y=void 0!==y?y:t.GetBoundingBox();const H=q.GetX(),A=q.GetY();var F=q.GetInstance().GetSdkInstance();p=void 0!==p?p:t.GetX();r=void 0!==r?r:t.GetY();q=t.HasOwnCollisionPoly();E=
void 0!==E?E:t.GetBoundingQuad();F.GetCollisionRectCandidates(y,a);for(let I=0,L=a.length;I<L;++I){var J=a[I];F=J.GetRect();this._collisionCheckCount++;if(y.intersectsRectOffset(F,H,A)&&(h.setFromRect(F),h.offset(H,A),h.intersectsQuad(E)))if(q){var B=void 0!==x?x:t.GetTransformedCollisionPoly();if(J=J.GetPoly()){if(this._polyCheckCount++,J.intersectsPoly(B,p-(H+F.getLeft()),r-(A+F.getTop())))return f.clearArray(a),!0}else if(d.setFromQuad(h,0,0),d.intersectsPoly(B,p,r))return f.clearArray(a),!0}else if(B=
J.GetPoly()){if(d.setFromQuad(E,0,0),B.intersectsPoly(d,-(H+F.getLeft()),-(A+F.getTop())))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestAndSelectCanvasPointOverlap(q,t,p,r){const x=q.GetCurrentSol();var y=this._runtime.GetCurrentEvent();if(!y)throw Error("cannot call outside event");y=y.IsOrBlock();if(x.IsSelectAll()){r||(x._SetSelectAll(!1),f.clearArray(x._GetOwnInstances()));for(var E of q.GetInstances()){var H=E.GetWorldInfo(),A=H.GetLayer();const [F,J]=
A.CanvasCssToLayer(t,p,H.GetTotalZElevation());if(H.ContainsPoint(F,J)){if(r)return!1;x._PushInstance(E)}else y&&x._PushElseInstance(E)}}else{H=!1;y?this._runtime.IsCurrentConditionFirst()&&!x._GetOwnElseInstances().length&&x._GetOwnInstances().length?E=x._GetOwnInstances():(E=x._GetOwnElseInstances(),H=!0):E=x._GetOwnInstances();A=0;for(let F=0,J=E.length;F<J;++F){const B=E[F],I=B.GetWorldInfo(),L=I.GetLayer(),[P,S]=L.CanvasCssToLayer(t,p,I.GetTotalZElevation());if(I.ContainsPoint(P,S)){if(r)return!1;
H?x._PushInstance(B):E[A++]=B}else H?E[A++]=B:y&&x._PushElseInstance(B)}r||(E.length=A)}q.ApplySolToContainer();return r?!0:x.HasAnyInstances()}GetCollisionCandidates(q,t,p,r){q=q?1!==q.GetParallaxX()||1!==q.GetParallaxY():!1;if(t.IsFamily())for(const x of t.GetFamilyMembers())q||x.IsAnyInstanceParallaxed()?f.appendArray(r,x.GetInstances()):(x._UpdateAllCollisionCells(),x._GetCollisionCellGrid().QueryRange(p,r));else q||t.IsAnyInstanceParallaxed()?f.appendArray(r,t.GetInstances()):(t._UpdateAllCollisionCells(),
t._GetCollisionCellGrid().QueryRange(p,r))}GetObjectClassesCollisionCandidates(q,t,p,r){for(const x of t)this.GetCollisionCandidates(q,x,p,r)}GetSolidCollisionCandidates(q,t,p){const r=this._runtime.GetSolidBehavior();r&&this.GetObjectClassesCollisionCandidates(q,r.GetObjectClasses(),t,p)}GetJumpthruCollisionCandidates(q,t,p){const r=this._runtime.GetJumpthruBehavior();r&&this.GetObjectClassesCollisionCandidates(q,r.GetObjectClasses(),t,p)}IsSolidCollisionAllowed(q,t){return q._IsSolidEnabled()&&
(!t||t.GetWorldInfo().IsSolidCollisionAllowed(q.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(q){const t=q.GetWorldInfo();this.GetSolidCollisionCandidates(t.GetLayer(),t.GetBoundingBox(),b);for(const p of b)if(this.IsSolidCollisionAllowed(p,q)&&this.TestOverlap(q,p))return f.clearArray(b),p;f.clearArray(b);return null}TestRectOverlapSolid(q,t){this.GetSolidCollisionCandidates(null,q,b);for(const p of b)if(this.IsSolidCollisionAllowed(p,t)&&this.TestRectOverlap(q,p))return f.clearArray(b),
p;f.clearArray(b);return null}TestOverlapJumpthru(q,t){let p=null;t&&(p=c,f.clearArray(p));const r=q.GetWorldInfo();this.GetJumpthruCollisionCandidates(r.GetLayer(),r.GetBoundingBox(),b);for(const x of b)if(x._IsJumpthruEnabled()&&this.TestOverlap(q,x))if(t)p.push(x);else return f.clearArray(b),x;f.clearArray(b);return p}PushOut(q,t,p,r,x){r=r||50;const y=q.GetWorldInfo(),E=y.GetX(),H=y.GetY();for(let A=0;A<r;++A)if(y.SetXY(E+t*A,H+p*A),y.SetBboxChanged(),!this.TestOverlap(q,x))return!0;y.SetXY(E,
H);y.SetBboxChanged();return!1}PushOutSolid(q,t,p,r,x,y){r=r||50;const E=q.GetWorldInfo(),H=E.GetX(),A=E.GetY();let F=null,J=null;for(let B=0;B<r;++B)if(E.SetXY(H+t*B,A+p*B),E.SetBboxChanged(),!this.TestOverlap(q,F))if(F=this.TestOverlapSolid(q))J=F;else if(x&&(F=y?this.TestOverlap(q,y)?y:null:this.TestOverlapJumpthru(q))&&(J=F),!F)return J&&this.PushInFractional(q,t,p,J,16,!0),!0;E.SetXY(H,A);E.SetBboxChanged();return!1}PushOutSolidAxis(q,t,p,r){r=r||50;const x=q.GetWorldInfo(),y=x.GetX(),E=x.GetY();
let H=null,A=null;for(let F=0;F<r;++F)for(let J=0;2>J;++J){const B=2*J-1;x.SetXY(y+t*F*B,E+p*F*B);x.SetBboxChanged();if(!this.TestOverlap(q,H))if(H=this.TestOverlapSolid(q))A=H;else return A&&this.PushInFractional(q,t*B,p*B,A,16,!0),!0}x.SetXY(y,E);x.SetBboxChanged();return!1}PushInFractional(q,t,p,r,x,y){let E=2,H=!1;var A=!1;const F=q.GetWorldInfo();let J=F.GetX(),B=F.GetY();for(;E<=x;)A=1/E,E*=2,F.OffsetXY(t*A*(H?1:-1),p*A*(H?1:-1)),F.SetBboxChanged(),this.TestOverlap(q,r)||y&&this.TestOverlapSolid(q)?
A=H=!0:(A=H=!1,J=F.GetX(),B=F.GetY());A&&(F.SetXY(J,B),F.SetBboxChanged())}PushOutSolidNearest(q,t=100){let p=0;const r=q.GetWorldInfo(),x=r.GetX(),y=r.GetY();let E=0,H=this.TestOverlapSolid(q);if(!H)return!0;for(;p<=t;){let A=0,F=0;switch(E){case 0:A=0;F=-1;p++;break;case 1:A=1;F=-1;break;case 2:A=1;F=0;break;case 3:F=A=1;break;case 4:A=0;F=1;break;case 5:A=-1;F=1;break;case 6:A=-1;F=0;break;case 7:F=A=-1}E=(E+1)%8;r.SetXY(Math.floor(x+A*p),Math.floor(y+F*p));r.SetBboxChanged();if(!this.TestOverlap(q,
H)&&(H=this.TestOverlapSolid(q),!H))return!0}r.SetXY(x,y);r.SetBboxChanged();return!1}CalculateBounceAngle(q,t,p,r){const x=q.GetWorldInfo(),y=x.GetX(),E=x.GetY(),H=Math.max(10,f.distanceTo(t,p,y,E));var A=f.angleTo(t,p,y,E),F=r||this.TestOverlapSolid(q);if(!F)return f.clampAngle(A+Math.PI);let J=F;var B=0,I=0;const L=f.toRadians(5);let P;for(P=1;36>P;++P){const S=A-P*L;x.SetXY(t+Math.cos(S)*H,p+Math.sin(S)*H);x.SetBboxChanged();if(!this.TestOverlap(q,J)&&(J=r?null:this.TestOverlapSolid(q),!J)){B=
S;break}}36===P&&(B=f.clampAngle(A+Math.PI));J=F;for(P=1;36>P;++P)if(F=A+P*L,x.SetXY(t+Math.cos(F)*H,p+Math.sin(F)*H),x.SetBboxChanged(),!this.TestOverlap(q,J)&&(J=r?null:this.TestOverlapSolid(q),!J)){I=F;break}36===P&&(I=f.clampAngle(A+Math.PI));x.SetXY(y,E);x.SetBboxChanged();if(I===B)return I;q=f.angleDiff(I,B)/2;q=f.angleClockwise(I,B)?f.clampAngle(B+q+Math.PI):f.clampAngle(I+q);B=Math.cos(A);A=Math.sin(A);I=Math.cos(q);q=Math.sin(q);t=B*I+A*q;return f.angleTo(0,0,B-2*t*I,A-2*t*q)}TestSegmentOverlap(q,
t,p,r,x){if(!x)return!1;const y=x.GetWorldInfo();if(!y.IsCollisionEnabled())return!1;this._collisionCheckCount++;g.set(Math.min(q,p),Math.min(t,r),Math.max(q,p),Math.max(t,r));if(!y.GetBoundingBox().intersectsRect(g))return!1;if(x.HasTilemap())return this._TestSegmentOverlapTilemap(q,t,p,r,x,y);this._polyCheckCount++;return y.GetBoundingQuad().intersectsSegment(q,t,p,r)?y.HasOwnCollisionPoly()?y.GetTransformedCollisionPoly().intersectsSegment(y.GetX(),y.GetY(),q,t,p,r):!0:!1}_TestSegmentOverlapTilemap(q,
t,p,r,x,y){const E=y.GetX();y=y.GetY();x=x.GetSdkInstance();l.set(q,t,p,r);l.normalize();x.GetCollisionRectCandidates(l,a);for(let A=0,F=a.length;A<F;++A){var H=a[A];x=H.GetRect();this._collisionCheckCount++;if(g.intersectsRectOffset(x,E,y)&&(h.setFromRect(x),h.offset(E,y),h.intersectsSegment(q,t,p,r)))if(H=H.GetPoly()){if(this._polyCheckCount++,H.intersectsSegment(E+x.getLeft(),y+x.getTop(),q,t,p,r))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestRectOverlap(q,
t){if(!t)return!1;const p=t.GetWorldInfo();if(!p.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!p.GetBoundingBox().intersectsRect(q))return!1;if(t.HasTilemap())return this._TestRectOverlapTilemap(q,t,p);this._polyCheckCount++;h.setFromRect(q);if(!p.GetBoundingQuad().intersectsQuad(h))return!1;if(!p.HasOwnCollisionPoly())return!0;d.setFromRect(q,p.GetX(),p.GetY());q=p.GetTransformedCollisionPoly();return d.intersectsPoly(q,0,0)}_TestRectOverlapTilemap(q,t,p){const r=p.GetX();p=p.GetY();
t.GetSdkInstance().GetCollisionRectCandidates(q,a);for(let y=0,E=a.length;y<E;++y){var x=a[y];t=x.GetRect();this._collisionCheckCount++;if(q.intersectsRectOffset(t,r,p))if(x=x.GetPoly()){if(this._polyCheckCount++,d.setFromRect(q,0,0),x.intersectsPoly(d,-(r+t.getLeft()),-(p+t.getTop())))return f.clearArray(a),!0}else return f.clearArray(a),!0}f.clearArray(a);return!1}TestRayIntersectsInstance(q,t){if(q){var p=q.GetWorldInfo();p.IsCollisionEnabled()&&(this._collisionCheckCount++,p.GetBoundingBox().intersectsRect(t.rect)&&
(q.HasTilemap()?this._TestRayIntersectsTilemap(q,p,t):(this._polyCheckCount++,p.HasOwnCollisionPoly()?t.TestInstancePoly(q,p.GetX(),p.GetY(),p.GetTransformedCollisionPoly()):t.TestInstanceQuad(q,p.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(q,t,p){const r=t.GetX(),x=t.GetY();q.GetSdkInstance().GetCollisionRectCandidates(p.rect,a);for(let E=0,H=a.length;E<H;E++){var y=a[E];const A=y.GetRect();this._collisionCheckCount++;p.rect.intersectsRectOffset(A,r,x)&&(y=y.GetPoly(),this._polyCheckCount++,
y?p.TestInstancePoly(q,r+A.getLeft(),x+A.getTop(),y):p.TestInstanceRect(q,t.GetX(),t.GetY(),A))}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,c){let d=this._cells.Get(b,a);return d?d:c?(d=f.New(f.GridCell,this,b,a),this._cells.Set(b,a,d),d):null}XToCell(b){b=Math.floor(b/this._cellWidth);return isFinite(b)?b:0}YToCell(b){b=Math.floor(b/this._cellHeight);return isFinite(b)?b:0}Update(b,a,c){if(a)for(let d=a.getLeft(),
e=a.getRight();d<=e;++d)for(let h=a.getTop(),g=a.getBottom();h<=g;++h){if(c&&c.containsPoint(d,h))continue;const l=this.GetCell(d,h,!1);l&&(l.Remove(b),l.IsEmpty()&&this._cells.Delete(d,h))}if(c)for(let d=c.getLeft(),e=c.getRight();d<=e;++d)for(let h=c.getTop(),g=c.getBottom();h<=g;++h)a&&a.containsPoint(d,h)||this.GetCell(d,h,!0).Insert(b)}QueryRange(b,a){let c=this.XToCell(b.getLeft());const d=this.YToCell(b.getTop()),e=this.XToCell(b.getRight());b=this.YToCell(b.getBottom());if(isFinite(e)&&isFinite(b))for(;c<=
e;++c)for(let h=d;h<=b;++h){const g=this.GetCell(c,h,!1);g&&g.Dump(a)}}}}{"use strict";const f=self.C3;f.GridCell=class extends f.DefendedBase{constructor(b,a,c){super();this._grid=b;this._x=a;this._y=c;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,c,d){this.x1=b;this.y1=a;this.x2=c;this.y2=d;this.dx=c-b;this.dy=d-a;this.rect.set(b,a,c,d);this.rect.normalize();this.hitFraction=
2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0;return this}Complete(){if(!1!==this.DidCollide()){var b=this.dx*this.hitFraction,a=this.dy*this.hitFraction,c=Math.sqrt(b*b+a*a);b/=c;a/=c;this.distance=c-1E-6;this.hitX=this.x1+b*this.distance;this.hitY=this.y1+a*this.distance;this.hitNormal=Math.atan2(this.hitNormalDy,this.hitNormalDx)+Math.PI/2;this.normalX=Math.cos(this.hitNormal);
this.normalY=Math.sin(this.hitNormal);c=b*this.normalX+a*this.normalY;this.reflectionX=b-2*this.normalX*c;this.reflectionY=a-2*this.normalY*c;0<c&&(this.hitNormal=f.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(b,a,c,d,e){const h=f.rayIntersect(this.x1,this.y1,this.x2,this.y2,a,c,d,e);0<=h&&h<this.hitFraction&&(this.hitFraction=h,this.hitUid=b.GetUID(),this.hitNormalDx=a-d,this.hitNormalDy=c-e)}TestInstanceRect(b,a,c,d){const e=a+d.getLeft();
a+=d.getRight();const h=c+d.getTop();c+=d.getBottom();this.TestInstanceSegment(b,e,h,a,h);this.TestInstanceSegment(b,a,h,a,c);this.TestInstanceSegment(b,a,c,e,c);this.TestInstanceSegment(b,e,c,e,h)}TestInstanceQuad(b,a){const c=a.getTlx(),d=a.getTly(),e=a.getTrx(),h=a.getTry(),g=a.getBrx(),l=a.getBry(),m=a.getBlx();a=a.getBly();this.TestInstanceSegment(b,c,d,e,h);this.TestInstanceSegment(b,e,h,g,l);this.TestInstanceSegment(b,g,l,m,a);this.TestInstanceSegment(b,m,a,c,d)}TestInstancePoly(b,a,c,d){d=
d.pointsArr();for(let e=0,h=d.length;e<h;e+=2){const g=(e+2)%h;this.TestInstanceSegment(b,d[e]+a,d[e+1]+c,d[g]+a,d[g+1]+c)}}}}
{"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"]),c=self.glMatrix.mat4,d=c.create(),e=f.New(f.Quad),h=f.New(f.Rect);f.CanvasManager=class extends f.DefendedBase{constructor(g){super();this._runtime=g;this._canvas=null;this._isWebGPUEnabled=!1;this._webgpuRenderer=this._webglRenderer=null;this._gpuPreference="high-performance";this._canvasCssOffsetY=this._canvasCssOffsetX=this._canvasDeviceHeight=
this._canvasDeviceWidth=this._canvasCssHeight=this._canvasCssWidth=this._windowInnerHeight=this._windowInnerWidth=0;this._enableMipmaps=!0;this._drawHeight=this._drawWidth=this._textureAnisotropy=0;this._documentFullscreenMode=this._fullscreenMode="letterbox-scale";this._deviceTransformOffY=this._deviceTransformOffX=0;this._defaultProjectionMatrix=c.create();this._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=!1;this._availableAdditionalRenderTargets=
[];this._usedAdditionalRenderTargets=new Set;this._shaderData=self.C3_Shaders;this._effectChainManager=f.New(f.Gfx.EffectChainManager,{getDrawSize:()=>[this.GetDrawWidth(),this.GetDrawHeight()],getRenderTarget:()=>this.GetEffectCompositorRenderTarget(),releaseRenderTarget:l=>this.ReleaseEffectCompositorRenderTarget(l),getTime:()=>this.GetRuntime().GetGameTime(),redraw:()=>this.GetRuntime().UpdateRender()});this._gpuTimeEndFrame=this._gpuTimeStartFrame=0;this._gpuLastUtilisation=NaN;this._gpuFrameTimingsBuffer=
null;this._layersGpuProfile=new Map;this._gpuCurUtilisation=NaN;this._webgpuFrameTimings=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=f.New(f.Rect);this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=this._isPastingToDrawingCanvas=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=l=>this._loadingProgress=l.progress;this._percentText=null;this._splashTextures={logo:null,powered:null,website:null};this._splashFadeOutStartTime=
this._splashFadeInFinishTime=this._splashFrameNumber=0;this._splashState="fade-in";this._splashDoneResolve=null;this._splashDonePromise=new Promise(l=>this._splashDoneResolve=l)}_SetGPUPowerPreference(g){this._gpuPreference=g}_SetWebGPUEnabled(g){this._isWebGPUEnabled=!!g}async CreateCanvas(g){this._canvas=g.canvas;this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",u=>this._OnWindowResize(u));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",u=>this._OnFullscreenChange(u));
this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",u=>this._OnFullscreenError(u));this._canvas.addEventListener("webglcontextlost",u=>this._OnWebGLContextLost(u));this._canvas.addEventListener("webglcontextrestored",u=>this._OnWebGLContextRestored(u));this._isDocumentFullscreen=!!g.isFullscreen;var l=navigator.gpu&&this._isWebGPUEnabled;let m=!1;if(l)try{await this._InitWebGPUContext(!0)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!0)}catch(u){this._webglRenderer=
null}this.GetRenderer()||(m=!0);if(!this.GetRenderer()&&l)try{await this._InitWebGPUContext(!1)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!1)}catch(u){this._webglRenderer=null}l=this.GetRenderer();if(!l)throw Error("failed to acquire a renderer - check WebGL or WebGPU is supported");l.SetHasMajorPerformanceCaveat(m);this.SetSize(g.windowInnerWidth,g.windowInnerHeight,!0);this._webgpuRenderer?await this._InitWebGPU():this._webglRenderer&&await this._InitWebGL();
l.SetMipmapsEnabled(this._enableMipmaps);l.SupportsGPUProfiling()&&(this._gpuLastUtilisation=0);for(const u of this._runtime._GetAllEffectLists()){for(const w of u.GetAllEffectTypes())w._InitRenderer(l);u.UpdateActiveEffects()}}async _InitWebGPUContext(g){g={powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat:g,canSampleBackbuffer:this._runtime.UsesAnyBackgroundBlending(),canSampleDepth:this._runtime.UsesAnyDepthSampling()};this._webgpuRenderer=f.New(f.Gfx.WebGPURenderer);
await this._webgpuRenderer.Create(this._canvas,g)}async _InitWebGLContext(g){g={powerPreference:this._gpuPreference,enableGpuProfiling:!0,depth:this._runtime.Uses3DFeatures(),canSampleDepth:this._runtime.UsesAnyDepthSampling(),failIfMajorPerformanceCaveat:g};"Android"===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()}async _InitWebGPU(){if(this._shaderData){const g=[];for(const [l,m]of Object.entries(this._shaderData)){m.src=m.wgsl;const u=f.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();g.push(this._webgpuRenderer.CreateShaderProgram(m,u,l))}await Promise.all(g)}}async _InitWebGL(){if(this._shaderData){const g=
[];for(const [l,m]of Object.entries(this._shaderData)){m.src=m.glsl;const u=f.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource();g.push(this._webglRenderer.CreateShaderProgram(m,u,l))}await Promise.all(g);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=f.New(f.Gfx.WebGLQueryResultBuffer,this._webglRenderer))}Release(){this._canvas=this._webglRenderer=this._runtime=null}_OnWindowResize(g){const l=
this._runtime,m=g.devicePixelRatio;l.IsInWorker()&&(self.devicePixelRatio=m);l._SetDevicePixelRatio(m);this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight);l.UpdateRender();l.IsDebug()&&(l.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused())&&l.Render()}_OnFullscreenChange(g){this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight,!0);this._runtime.UpdateRender()}_OnFullscreenError(g){this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,
g.innerHeight,!0);this._runtime.UpdateRender()}SetSize(g,l,m=!1){g=Math.floor(g);l=Math.floor(l);if(0>=g||0>=l)throw Error("invalid size");if(this._windowInnerWidth!==g||this._windowInnerHeight!==l||m){this._windowInnerWidth=g;this._windowInnerHeight=l;m=this.GetCurrentFullscreenMode();"letterbox-scale"===m?this._CalculateLetterboxScale(g,l):"letterbox-integer-scale"===m?this._CalculateLetterboxIntegerScale(g,l):"off"===m?this._CalculateFixedSizeCanvas(g,l):this._CalculateFullsizeCanvas(g,l);this._UpdateFullscreenScalingQuality(m);
this._canvas.width=this._canvasDeviceWidth;this._canvas.height=this._canvasDeviceHeight;this._runtime.PostComponentMessageToDOM("canvas","update-size",{marginLeft:this._canvasCssOffsetX,marginTop:this._canvasCssOffsetY,styleWidth:this._canvasCssWidth,styleHeight:this._canvasCssHeight});g=this.GetRenderer();g.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0);for(var u of this._availableAdditionalRenderTargets)g.DeleteRenderTarget(u);f.clearArray(this._availableAdditionalRenderTargets);g.CalculatePerspectiveMatrix(this._defaultProjectionMatrix,
this.GetDrawWidth()/this.GetDrawHeight());u=this._runtime.GetLayoutManager();u.SetAllLayerProjectionChanged();u.SetAllLayerMVChanged()}}GetDefaultProjectionMatrix(){return this._defaultProjectionMatrix}_CalculateLetterboxScale(g,l){const m=this._runtime.GetDevicePixelRatio(),u=this._runtime.GetOriginalViewportWidth(),w=this._runtime.GetOriginalViewportHeight(),q=u/w;g/l>q?(this._canvasCssWidth=Math.round(l*q),this._canvasCssHeight=l,this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY=
0):(this._canvasCssWidth=g,this._canvasCssHeight=Math.round(g/q),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((l-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._runtime.SetViewportSize(u,w)}_CalculateLetterboxIntegerScale(g,l){const m=this._runtime.GetDevicePixelRatio();1!==m&&(g+=1,l+=1);const u=this._runtime.GetOriginalViewportWidth(),w=this._runtime.GetOriginalViewportHeight();
var q=u/w;q=g/l>q?l*q*m/u:g/q*m/w;1<q?q=Math.floor(q):1>q&&(q=1/Math.ceil(1/q));this._canvasDeviceWidth=Math.round(u*q);this._canvasDeviceHeight=Math.round(w*q);this._canvasCssWidth=this._canvasDeviceWidth/m;this._canvasCssHeight=this._canvasDeviceHeight/m;this._canvasCssOffsetX=Math.max(Math.floor((g-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((l-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(u,w)}_CalculateFullsizeCanvas(g,l){const m=this._runtime.GetDevicePixelRatio();
this._canvasCssWidth=g;this._canvasCssHeight=l;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._canvasCssOffsetY=this._canvasCssOffsetX=0;g=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/g,this._canvasCssHeight/g)}_CalculateFixedSizeCanvas(g,l){const m=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();
this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this.IsDocumentFullscreen()?(this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY=Math.floor((l-this._canvasCssHeight)/2)):this._canvasCssOffsetY=this._canvasCssOffsetX=0;this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(g){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=
this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let m;if("off"===this.GetCurrentFullscreenMode()){var l=this._runtime.GetViewportWidth();m=this._runtime.GetViewportHeight()}else l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<l&&this._canvasDeviceHeight<m?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"):
(this._drawWidth=l,this._drawHeight=m,this._fullscreenScalingQuality="low","scale-inner"===g?(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l<g?this._drawWidth=this._drawHeight*l:l>g&&(this._drawHeight=this._drawWidth/l)):"scale-outer"===g&&(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l>g?this._drawWidth=this._drawHeight*l:l<g&&(this._drawHeight=this._drawWidth/l)))}}GetRuntime(){return this._runtime}GetEffectChainManager(){return this._effectChainManager}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(g){if(!b.has(g))throw Error("invalid fullscreen mode");
this._fullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(g){if(!b.has(g))throw Error("invalid fullscreen mode");this._documentFullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?this.GetDocumentFullscreenMode():
this.GetFullscreenMode()}SetFullscreenScalingQuality(g){if(!a.has(g))throw Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=g;this._runtime.GetLayoutManager().SetAllLayerProjectionChanged()}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(g){switch(g){case 0:return"off";case 1:return"crop";case 2:return"scale-inner";case 3:return"scale-outer";
case 4:return"letterbox-scale";case 5:return"letterbox-integer-scale";default:throw Error("invalid fullscreen mode");}}GetLastWidth(){return this._windowInnerWidth}GetLastHeight(){return this._windowInnerHeight}GetDrawWidth(){return this._drawWidth}GetDrawHeight(){return this._drawHeight}SetMipmapsEnabled(g){this._enableMipmaps=!!g}_SetTextureAnisotropy(g){this._textureAnisotropy=g}GetTextureAnisotropy(){return this._textureAnisotropy}IsRendererContextLost(){return this.GetRenderer().IsContextLost()}_OnWebGLContextLost(g){console.log("[Construct 3] WebGL context lost");
g.preventDefault();this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets.clear();this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(g){await this._webglRenderer.OnContextRestored();await this._LoadWebGLShaderPrograms();for(const l of this._runtime._GetAllEffectLists())for(const m of l.GetAllEffectTypes())m._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored();console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetWebGPURenderer(){return this._webgpuRenderer}GetRenderer(){return this._webgpuRenderer||
this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const g=this.GetCurrentFullscreenMode();if("off"===g||"crop"===g)return 1;const l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight(),u=l/m,w=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==g&&w>u||"scale-inner"===g&&w<u?this._canvasCssHeight/m:this._canvasCssWidth/l}GetEffectLayerScaleParam(){return"low"===
this.GetCurrentFullscreenScalingQuality()?1:this.GetDisplayScale()}GetEffectDevicePixelRatioParam(){return"low"===this.GetCurrentFullscreenScalingQuality()?1:this._runtime.GetDevicePixelRatio()}SetDeviceTransformOffset(g,l){this._deviceTransformOffX=g;this._deviceTransformOffY=l}SetDeviceTransform(g,l,m,u=!0){l=l||this._drawWidth;m=m||this._drawHeight;const w=l/2+this._deviceTransformOffX,q=m/2+this._deviceTransformOffY;if(u){u=this.GetDefaultProjectionMatrix();if(l!==this._drawWidth||m!==this._drawHeight)g.CalculatePerspectiveMatrix(d,
l/m),u=d;g.SetProjectionMatrix(u)}l=g.CalculateLookAtModelView2(w,q,g.GetDefaultCameraZ()*this._runtime.GetDevicePixelRatio(),w,q,0,m||this._drawHeight);g.SetModelViewMatrix(l)}SetCssTransform(g,l=!0){const m=this._canvasCssWidth/2,u=this._canvasCssHeight/2;l&&g.SetProjectionMatrix(this.GetDefaultProjectionMatrix());l=g.CalculateLookAtModelView2(m,u,g.GetDefaultCameraZ(),m,u,0);g.SetModelViewMatrix(l)}GetDeviceWidth(){return this._canvasDeviceWidth}GetDeviceHeight(){return this._canvasDeviceHeight}GetCssWidth(){return this._canvasCssWidth}GetCssHeight(){return this._canvasCssHeight}GetCanvasClientX(){return this._canvasCssOffsetX}GetCanvasClientY(){return this._canvasCssOffsetY}GetAdditionalRenderTarget(g){g.depth=
this._runtime.Uses3DFeatures();const l=this._availableAdditionalRenderTargets,m=l.findIndex(w=>w.IsCompatibleWithOptions(g));let u;-1!==m?(u=l[m],l.splice(m,1)):u=this.GetRenderer().CreateRenderTarget(g);this._usedAdditionalRenderTargets.add(u);return u}ReleaseAdditionalRenderTarget(g){if(!this._usedAdditionalRenderTargets.has(g))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(g);this._availableAdditionalRenderTargets.push(g)}GetEffectCompositorRenderTarget(){const g=
{sampling:this._runtime.GetSampling()};"low"===this.GetCurrentFullscreenScalingQuality()&&(g.width=this.GetDrawWidth(),g.height=this.GetDrawHeight());return this.GetAdditionalRenderTarget(g)}ReleaseEffectCompositorRenderTarget(g){this.ReleaseAdditionalRenderTarget(g)}*activeLayersGpuProfiles(){for(const g of this._runtime.GetLayoutManager().runningLayouts())for(const l of g.GetLayers()){const m=this._layersGpuProfile.get(l);m&&(yield m)}}GetLayerTimingsBuffer(g){if(!this.GetRenderer().SupportsGPUProfiling())return null;
let l=this._layersGpuProfile.get(g);l||(l={name:g.GetName(),timingsBuffer:f.New(f.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(g,l));return l.timingsBuffer}_Update1sFrameRange(){const g=this.GetRenderer();if(g.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=g.GetFrameNumber();this._gpuCurUtilisation=NaN;for(const l of this.activeLayersGpuProfiles())l.curUtilisation=NaN}}_UpdateTick(){this._webglRenderer&&this._webglRenderer.SupportsGPUProfiling()&&
this._UpdateTick_WebGL();this._webgpuRenderer&&this._webgpuRenderer.SupportsGPUProfiling()&&this._UpdateTick_WebGPU()}_UpdateTick_WebGL(){if(isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const g of this.activeLayersGpuProfiles())if(g.curUtilisation=g.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),
isNaN(g.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const g of this.activeLayersGpuProfiles())g.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),g.lastUtilisation=Math.min(g.curUtilisation,1);self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=
0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}_UpdateTick_WebGPU(){if(0!==this._gpuTimeEndFrame){for(var g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g){var l=this._webgpuFrameTimings.get(g);if(l&&!l.HasResult())return}l=this._runtime.GetMainRunningLayout();g=f.MakeFilledArray(l.GetLayerCount()+1,0);for(var m=this._gpuTimeStartFrame;m<this._gpuTimeEndFrame;++m){var u=this._webgpuFrameTimings.get(m);if(u){u=u.GetResult();for(let w=0,q=Math.min(g.length,u.length/2);w<q;++w){const t=
u[2*w],p=u[2*w+1];g[w]=0===Number(t)||0===Number(p)?NaN:g[w]+Number(p-t)/1E9}}}this._gpuLastUtilisation=f.clamp(g[0],0,1);if(this._runtime.IsDebug()){m=[];l=l.GetLayers();for(let w=0,q=Math.min(l.length,g.length-1);w<q;++w)m.push({name:l[w].GetName(),lastUtilisation:f.clamp(g[w+1],0,1)});self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,m)}for(g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g)this._webgpuFrameTimings.delete(g);this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=
0}}_AddWebGPUFrameTiming(g){this._webgpuFrameTimings.set(this._webgpuRenderer.GetFrameNumber(),g)}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(g,l,m,u,w,q){this._snapshotFormat=g;this._snapshotQuality=l;this._snapshotArea.setWH(m,u,w,q);return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(t=>{this._snapshotResolve=t})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var g=this._canvas,l=this._snapshotArea,m=f.clamp(Math.floor(l.getLeft()),0,g.width),
u=f.clamp(Math.floor(l.getTop()),0,g.height),w=l.width();w=0===w?g.width-m:f.clamp(Math.floor(w),0,g.width-m);l=l.height();l=0===l?g.height-u:f.clamp(Math.floor(l),0,g.height-u);(0!==m||0!==u||w!==g.width||l!==g.height)&&0<w&&0<l&&(g=f.CreateCanvas(w,l),g.getContext("2d").drawImage(this._canvas,m,u,w,l,0,0,w,l));f.CanvasToBlob(g,this._snapshotFormat,this._snapshotQuality).then(q=>{this._snapshotUrl=URL.createObjectURL(q);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat=
"";this._snapshotQuality=1}}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(g){g?this._isPastingToDrawingCanvas++:this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return 0<this._isPastingToDrawingCanvas}InitLoadingScreen(g){this._webglRenderer&&(2===g?(this._percentText=f.New(f.Gfx.RendererText,this.GetRenderer()),this._percentText.SetIsAsync(!1),this._percentText.SetFontName("Arial"),this._percentText.SetFontSize(16),this._percentText.SetHorizontalAlignment("center"),
this._percentText.SetVerticalAlignment("center"),this._percentText.SetSize(300,200)):0===g?(g=this._runtime.GetLoadingLogoAsset())&&g.LoadStaticTexture(this._webglRenderer).catch(l=>console.warn("[C3 runtime] Failed to create texture for loading logo: ",l)):4===g&&(this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(l=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.logo=l}).catch(l=>console.warn("Failed to load splash image: ",l)),this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(l=>
{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.powered=l}).catch(l=>console.warn("Failed to load splash image: ",l)),this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(l=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.website=l}).catch(l=>console.warn("Failed to load splash image: ",l))))}async _LoadSvgSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await f.FetchBlob(g);g=await this._runtime.RasterSvgImage(g,
2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(g,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await f.FetchBlob(g);return await this._webglRenderer.CreateStaticTextureAsync(g,{mipMapQuality:"high"})}HideCordovaSplashScreen(){this._runtime.PostComponentMessageToDOM("runtime","hide-cordova-splash")}StartLoadingScreen(){this._loaderStartTime=Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",
this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen());3!==this._runtime.GetLoaderStyle()&&this.HideCordovaSplashScreen()}async EndLoadingScreen(){if(this._webglRenderer){this._loadingProgress=1;var g=this._runtime.GetLoaderStyle();4===g&&await this._splashDonePromise;this._splashDonePromise=this._splashDoneResolve=null;-1!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=-1);this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler);
this._loadingprogress_handler=null;this._percentText&&(this._percentText.Release(),this._percentText=null);this._runtime.ReleaseLoadingLogoAsset();this._webglRenderer.Start();this._splashTextures.logo&&(this._webglRenderer.DeleteTexture(this._splashTextures.logo),this._splashTextures.logo=null);this._splashTextures.powered&&(this._webglRenderer.DeleteTexture(this._splashTextures.powered),this._splashTextures.powered=null);this._splashTextures.website&&(this._webglRenderer.DeleteTexture(this._splashTextures.website),
this._splashTextures.website=null);this._webglRenderer.ClearRgba(0,0,0,0);this._webglRenderer.Finish();this._splashState="done";this._gpuTimeStartFrame=this._webglRenderer.GetFrameNumber();3===g&&this.HideCordovaSplashScreen()}}_DrawLoadingScreen(){if(-1!==this._rafId){var g=this._webglRenderer;if(g){g.Start();this._rafId=-1;var l=this._runtime.GetAssetManager().HasHadErrorLoading(),m=this._runtime.GetLoaderStyle();3!==m&&(this.SetCssTransform(g),g.ClearRgba(0,0,0,0),g.ResetColor(),g.SetTextureFillMode(),
g.SetTexture(null));if(0===m)this._DrawProgressBarAndLogoLoadingScreen(l);else if(1===m)this._DrawProgressBarLoadingScreen(l,120,0);else if(2===m)this._DrawPercentTextLoadingScreen(l);else if(3===m)f.noop();else if(4===m)this._DrawSplashLoadingScreen(l);else throw Error("invalid loader style");g.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}}_DrawPercentTextLoadingScreen(g){g?this._percentText.SetColorRgb(1,0,0):this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(100*
this._loadingProgress)+"%");g=this._canvasCssWidth/2;const l=this._canvasCssHeight/2;e.setRect(g-150,l-100,g+150,l+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(e,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(g,l,m){const u=this._webglRenderer;u.SetColorFillMode();g?u.SetColorRgba(1,0,0,1):u.SetColorRgba(.118,.565,1,1);g=this._canvasCssWidth/2;const w=this._canvasCssHeight/2,q=l/2;h.setWH(g-q,w-4+m,Math.floor(l*this._loadingProgress),
8);u.Rect(h);h.setWH(g-q,w-4+m,l,8);h.offset(-.5,-.5);h.inflate(.5,.5);u.SetColorRgba(0,0,0,1);u.LineRect2(h);h.inflate(1,1);u.SetColorRgba(1,1,1,1);u.LineRect2(h)}_DrawProgressBarAndLogoLoadingScreen(g){var l=this._runtime.GetLoadingLogoAsset();if(l)if(l=l.GetTexture()){var m=l.GetWidth(),u=l.GetHeight(),w=this._canvasCssWidth/2,q=this._canvasCssHeight/2,t=m/2;u/=2;e.setRect(w-t,q-u,w+t,q+u);this._webglRenderer.SetTexture(l);this._webglRenderer.Quad(e);this._DrawProgressBarLoadingScreen(g,m,u+16)}else this._DrawProgressBarLoadingScreen(g,
120,0);else this._DrawProgressBarLoadingScreen(g,120,0)}_DrawSplashLoadingScreen(g){const l=this._webglRenderer,m=this._splashTextures.logo,u=this._splashTextures.powered,w=this._splashTextures.website,q=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=q);const t=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),p=t?0:200,r=t?0:3E3;let x=1;"fade-in"===this._splashState?x=Math.min((q-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&
(x=Math.max(1-(q-this._splashFadeOutStartTime)/300,0));l.SetColorFillMode();l.SetColorRgba(.231*x,.251*x,.271*x,x);h.set(0,0,this._canvasCssWidth,this._canvasCssHeight);l.Rect(h);const y=Math.ceil(this._canvasCssWidth),E=Math.ceil(this._canvasCssHeight);let H;256<this._canvasCssHeight?(l.SetColorRgba(.302*x,.334*x,.365*x,x),H=Math.max(.005*E,2),h.setWH(0,.8*E-H/2,y,H),l.Rect(h),g?l.SetColorRgba(x,0,0,x):l.SetColorRgba(.161*x,.953*x,.816*x,x),g=y*this._loadingProgress,h.setWH(.5*y-g/2,.8*E-H/2,g,H),
l.Rect(h),l.SetColorRgba(x,x,x,x),l.SetTextureFillMode(),u&&(g=1.5*f.clamp(.22*E,105,.6*y),H=g/8,h.setWH(.5*y-g/2,.2*E-H/2,g,H),l.SetTexture(u),l.Rect(h)),m&&(H=g=Math.min(.395*E,.95*y),h.setWH(.5*y-g/2,.485*E-H/2,g,H),l.SetTexture(m),l.Rect(h)),w&&(g=1.5*f.clamp(.22*E,105,.6*y),H=g/8,h.setWH(.5*y-g/2,.868*E-H/2,g,H),l.SetTexture(w),l.Rect(h))):(l.SetColorRgba(.302*x,.334*x,.365*x,x),H=Math.max(.005*E,2),h.setWH(0,.85*E-H/2,y,H),l.Rect(h),g?l.SetColorRgba(x,0,0,x):l.SetColorRgba(.161*x,.953*x,.816*
x,x),g=y*this._loadingProgress,h.setWH(.5*y-g/2,.85*E-H/2,g,H),l.Rect(h),l.SetColorRgba(x,x,x,x),l.SetTextureFillMode(),m&&(H=g=.55*E,h.setWH(.5*y-g/2,.45*E-H/2,g,H),l.SetTexture(m),l.Rect(h)));this._splashFrameNumber++;"fade-in"===this._splashState&&300<=q-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=q);"wait"===this._splashState&&q-this._splashFadeInFinishTime>=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=
q);("fade-out"===this._splashState&&q-this._splashFadeOutStartTime>=300+p||t&&1<=this._loadingProgress&&500>q-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 c=!0;f.Runtime=class extends f.DefendedBase{constructor(d){d=Object.assign({},a,d);super();this._messagePort=d.messagePort;this._baseUrl=d.baseUrl;this._isHeadless=!!d.headless;this._hasDom=!!d.hasDom;this._isInWorker=!!d.isInWorker;c=d.ife;this._useAudio=!!d.useAudio;this._exportType=d.exportType;this._isiOSCordova=!!d.isiOSCordova;this._isiOSWebView=
!!d.isiOSWebView;this._isFBInstantAvailable=!!d.isFBInstantAvailable;this._opusWasmScriptUrl=d.opusWasmScriptUrl;this._opusWasmBinaryUrl=d.opusWasmBinaryUrl;this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!d.isDebug);this._debuggingDisabled=0;this._additionalLoadPromises=[];this._additionalCreatePromises=[];this._isUsingCreatePromises=!1;this._appId=this._projectUniqueId=this._projectVersion=this._projectName="";this._originalViewportHeight=this._originalViewportWidth=
0;this._devicePixelRatio=self.devicePixelRatio;this._loaderStyle=this._viewportHeight=this._viewportWidth=this._parallaxYorigin=this._parallaxXorigin=0;this._usesLoaderLayout=!1;this._isLoading=!0;this._usesAnyDepthSampling=this._usesAnyBackgroundBlending=!1;this._loadingLogoAsset=null;this._assetManager=f.New(f.AssetManager,this,d);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._uses3dFeatures=!1;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._tickCallbacks={normal:e=>{this._ruafId=this._rafId=-1;this.Tick(e)},tickOnly:e=>{this._ruafId=-1;this.Tick(e,
!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._gameTimeRaw=
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._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,d.jobScheduler);d.canvas&&(this._canvasManager=f.New(f.CanvasManager,this));this._messagePort.onmessage=e=>this._OnMessageFromDOM(e.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",e=>this._OnVisibilityChange(e));
this.AddDOMComponentMessageHandler("runtime","opus-decode",e=>this._WasmDecodeWebMOpus(e.arrayBuffer));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",e=>this._InvokeFunctionFromJS(e));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",e=>this._OnWindowBlur(e));this._dispatcher.addEventListener("window-focus",
()=>this._OnWindowFocus());this._timelineManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(d){return f.New(f.Runtime,d)}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"](d){const e=d.type;if("event"===e)this._OnEventFromDOM(d);else if("result"===e)this._OnResultFromDOM(d);
else throw Error(`unknown message '${e}'`);}_OnEventFromDOM(d){if(this._isReadyToHandleEvents){var e=d.component,h=d.handler,g=d.data,l=d.dispatchOpts,m=!(!l||!l.dispatchRuntimeEvent);l=!(!l||!l.dispatchUserScriptEvent);var u=d.responseId;if("runtime"===e&&(m&&(d=new f.Event(h),d.data=g,this._dispatcher.dispatchEventAndWaitAsyncSequential(d)),l)){d=new f.Event(h,!0);for(const [w,q]of Object.entries(g))d[w]=q;this.DispatchUserScriptEvent(d)}if(d=this._domEventHandlers.get(e))if(d=d.get(h)){m=null;
try{m=d(g)}catch(w){console.error(`Exception in '${e}' handler '${h}':`,w);null!==u&&this._PostResultToDOM(u,!1,""+w);return}null!==u&&(m&&m.then?m.then(w=>this._PostResultToDOM(u,!0,w)).catch(w=>{console.error(`Rejection from '${e}' handler '${h}':`,w);this._PostResultToDOM(u,!1,""+w)}):this._PostResultToDOM(u,!0,m))}else m||l||console.warn(`[Runtime] No DOM handler '${h}' for component '${e}'`);else m||l||console.warn(`[Runtime] No DOM event handlers for component '${e}'`)}else this._waitingToHandleEvents.push(d)}_PostResultToDOM(d,
e,h){this._messagePort.postMessage({type:"result",responseId:d,isOk:e,result:h})}_OnResultFromDOM(d){const e=d.responseId,h=d.isOk;d=d.result;const g=this._pendingResponsePromises.get(e);h?g.resolve(d):g.reject(d);this._pendingResponsePromises.delete(e)}AddDOMComponentMessageHandler(d,e,h){let g=this._domEventHandlers.get(d);g||(g=new Map,this._domEventHandlers.set(d,g));if(g.has(e))throw Error(`[Runtime] Component '${d}' already has handler '${e}'`);g.set(e,h)}PostComponentMessageToDOM(d,e,h){this._messagePort.postMessage({type:"event",
component:d,handler:e,data:h,responseId:null})}PostComponentMessageToDOMAsync(d,e,h){const g=this._nextDomResponseId++,l=new Promise((m,u)=>{this._pendingResponsePromises.set(g,{resolve:m,reject:u})});this._messagePort.postMessage({type:"event",component:d,handler:e,data:h,responseId:g});return l}PostToDebugger(d){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",d)}async Init(d){this.IsDebug()?await b.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);
var [e]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(e);await this._InitialiseCanvas(d);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");this.GetWebGLRenderer()?(e=this.GetWebGLRenderer(),console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${e.GetWebGLVersionNumber()} [${e.GetUnmaskedRenderer()}] (${e.IsDesynchronized()?
"desynchronized":"standard"} compositing)`)):this.GetWebGPURenderer()&&console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with experimental WebGPU`);this.GetRenderer().HasMajorPerformanceCaveat()&&console.warn("[C3 runtime] The renderer indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.");this._isReadyToHandleEvents=!0;for(const h of this._waitingToHandleEvents)this._OnEventFromDOM(h);f.clearArray(this._waitingToHandleEvents);
this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const h of d.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(h));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);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(d){try{await d(this._iRuntime)}catch(e){console.error("[C3 runtime] Error in runOnStartup function: ",e)}}_LoadDataJson(d){d=d.project;this._projectName=d[0];this._projectVersion=d[16];this._projectUniqueId=d[31];this._appId=d[38];const e=d[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!d[9];this._originalViewportWidth=this._viewportWidth=d[10];this._originalViewportHeight=this._viewportHeight=
d[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=d[36];this._framerateMode=d[37];"low-latency"===this._compositingMode&&this.IsAndroidWebView()&&77>=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._uses3dFeatures=!!d[40];this._sampling=d[14];this._usesAnyBackgroundBlending=d[15];this._usesAnyDepthSampling=d[17];this._usesLoaderLayout=!!d[18];this._loaderStyle=d[19];this._nextUid=d[21];this._pauseOnBlur=d[22];const h=this._assetManager;h._SetAudioFiles(d[7],d[25]);h._SetMediaSubfolder(d[8]);h._SetFontsSubfolder(d[32]);h._SetIconsSubfolder(d[28]);h._SetWebFonts(d[29]);if(0===this._loaderStyle){let w="";this.IsPreview()?h._HasLocalUrlBlob(e)&&(w=h.GetLocalUrlAsBlobUrl(e)):w=h.GetIconsSubfolder()+
e;w&&(this._loadingLogoAsset=h.LoadImage({url:w}))}this._canvasManager&&(this._canvasManager.SetFullscreenMode(f.CanvasManager._FullscreenModeNumberToString(d[12])),this._canvasManager.SetFullscreenScalingQuality(d[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==d[24]),this._canvasManager._SetGPUPowerPreference(d[34]),this._canvasManager._SetTextureAnisotropy(d[41]),this._canvasManager._SetWebGPUEnabled(d[13]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();
for(var g of d[2])this._pluginManager.CreatePlugin(g);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var l of d[3])g=f.ObjectClass.Create(this,this._allObjectClasses.length,l),this._allObjectClasses.push(g),this._objectClassesByName.set(g.GetName().toLowerCase(),g),this._objectClassesBySid.set(g.GetSID(),g);for(const w of d[4])this._allObjectClasses[w[0]]._LoadFamily(w);for(var m of d[27])l=m.map(w=>this._allObjectClasses[w]),this._allContainers.push(f.New(f.Container,
this,l));for(const w of this._allObjectClasses)w._OnAfterCreate();for(const w of d[5])this._layoutManager.Create(w);(m=d[1])&&(m=this._layoutManager.GetLayoutByName(m))&&this._layoutManager.SetFirstLayout(m);for(var u of d[33])this._timelineManager.Create(u);for(const w of d[35])this._transitionManager.Create(w);this._InitScriptInterfaces();for(const w of d[6])this._eventSheetManager.Create(w);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();f.clearArray(this._objectReferenceTable);
this.FlushPendingInstances();u="any";d=d[20];1===d?u="portrait":2===d&&(u="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:u})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(d){this._additionalLoadPromises.push(d)}SetUsingCreatePromises(d){this._isUsingCreatePromises=!!d}AddCreatePromise(d){this._isUsingCreatePromises&&this._additionalCreatePromises.push(d)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(d){this._allEffectLists.push(d)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(d){this._canvasManager&&
(await this._canvasManager.CreateCanvas(d),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var d=null;try{d=this.IsiOSCordova()&&this._assetManager.IsFileProtocol()?await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(e){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",
e);return}d?this.AddJobWorkerBuffer(d,"opus-decoder-wasm"):this.AddJobWorkerBlob(null,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(d){return await this.AddJob("OpusDecode",{arrayBuffer:d},[d])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var d of this._allObjectClasses)d.IsFamily()||d.IsOnLoaderLayout()||!d.IsWorldType()||d.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=
!1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&b.RuntimeInit(c);for(const e of this._layoutManager.GetAllLayouts())e._CreateGlobalNonWorlds();d=this._layoutManager.GetFirstLayout();await d._Load(null,this.GetRenderer());await d._StartRunning(!0);this._fpsLastTime=performance.now();this._usesLoaderLayout||this._OnLoadFinished();(await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking")).isSuspended?this._suspendCount++:
this.Tick()}_OnLoadFinished(){this.Trigger(f.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(d){d=Math.floor(d);const e=this._objectReferenceTable;if(0>d||d>=e.length)throw Error("invalid object reference");return e[d]}_LoadJsPropNameTable(){for(const d of self.C3_JsPropNameTable){const e=f.first(Object.keys(d));this._jsPropNameTable.push(e)}}GetJsPropName(d){d=Math.floor(d);const e=this._jsPropNameTable;if(0>d||d>=e.length)throw Error("invalid prop reference");
return e[d]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetBaseURL(){return this._baseUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return 0===
this.GetCurrentEventStackFrame().GetConditionIndex()}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(d){d=Math.floor(d);if(0>d||d>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[d]}GetObjectClassByName(d){return this._objectClassesByName.get(d.toLowerCase())||null}GetObjectClassBySID(d){return this._objectClassesBySid.get(d)||
null}GetSingleGlobalObjectClassByCtor(d){return(d=this._pluginManager.GetPluginByConstructorFunction(d))?d.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const d of this._allObjectClasses)d.IsFamily()||(yield*d.instances())}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(d){d.runtime=this.GetIRuntime();const e=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();e&&
b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(d);e&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(d){d.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(d)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(d,e){if(this._originalViewportWidth!==d||this._originalViewportHeight!==e)this._originalViewportWidth=d,this._originalViewportHeight=
e,d=this.GetLayoutManager(),d.SetAllLayerProjectionChanged(),d.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(d,e){if(this._viewportWidth!==d||this._viewportHeight!==e)this._viewportWidth=d,this._viewportHeight=e,d=this.GetLayoutManager(),d.SetAllLayerProjectionChanged(),d.SetAllLayerMVChanged()}_SetDevicePixelRatio(d){this._devicePixelRatio=d}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){return this._canvasManager?
this._canvasManager.GetDrawWidth():this._viewportWidth}GetDrawHeight(){return this._canvasManager?this._canvasManager.GetDrawHeight():this._viewportHeight}GetRenderScale(){return this._canvasManager?this._canvasManager.GetRenderScale():1}GetDisplayScale(){return this._canvasManager?this._canvasManager.GetDisplayScale():1}GetEffectLayerScaleParam(){return this._canvasManager?this._canvasManager.GetEffectLayerScaleParam():1}GetEffectDevicePixelRatioParam(){return this._canvasManager?this._canvasManager.GetEffectDevicePixelRatioParam():
1}GetCanvasClientX(){return this._canvasManager?this._canvasManager.GetCanvasClientX():0}GetCanvasClientY(){return this._canvasManager?this._canvasManager.GetCanvasClientY():0}GetCanvasCssWidth(){return this._canvasManager?this._canvasManager.GetCssWidth():0}GetCanvasCssHeight(){return this._canvasManager?this._canvasManager.GetCssHeight():0}GetFullscreenMode(){return this._canvasManager?this._canvasManager.GetFullscreenMode():"off"}GetAdditionalRenderTarget(d){return this._canvasManager?this._canvasManager.GetAdditionalRenderTarget(d):
null}ReleaseAdditionalRenderTarget(d){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(d)}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}UsesAnyDepthSampling(){return this._usesAnyDepthSampling}GetGPUUtilisation(){return this._canvasManager?this._canvasManager.GetGPUUtilisation():NaN}IsLinearSampling(){return"nearest"!==this.GetSampling()}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoAsset(){return this._loadingLogoAsset}ReleaseLoadingLogoAsset(){this._loadingLogoAsset&&
(this._loadingLogoAsset.Release(),this._loadingLogoAsset=null)}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetAssetManager(){return this._assetManager}LoadImage(d){return this._assetManager.LoadImage(d)}CreateInstance(d,e,h,g,l){return this.CreateInstanceFromData(d,e,!1,h,g,!1,l,void 0,l)}CreateInstanceFromData(d,e,h,g,l,
m,u,w,q){var t=null;let p=null;if(d instanceof f.ObjectClass){p=d;if(p.IsFamily()){d=p.GetFamilyMembers();var r=Math.floor(this.Random()*d.length);p=d[r]}t=p.GetDefaultInstanceData()}else t=d,p=this.GetObjectClassByIndex(t[1]);var x=p.GetPlugin().IsWorldType();if(this._isLoading&&x&&!p.IsOnLoaderLayout())return null;const y=e;x||(e=null);var E=h&&!m&&t&&!this._instancesByUid.has(t[2])?t[2]:this._nextUid++;r=t?t[0]:null;d=f.New(f.Instance,{runtime:this,objectType:p,layer:e,worldData:r,instVarData:t?
t[3]:null,uid:E});this._instancesByUid.set(E,d);E=null;x&&(E=d.GetWorldInfo(),"undefined"!==typeof g&&"undefined"!==typeof l&&(E.SetX(g),E.SetY(l)),p._SetAnyCollisionCellChanged(!0));e&&(q||e._AddInstance(d,!0),1===e.GetParallaxX()&&1===e.GetParallaxY()||p._SetAnyInstanceParallaxed(!0),e.GetLayout().MaybeLoadTexturesFor(p));this._objectCount++;let H=!0;if(w){var A=w.GetObjectClass();A.IsInContainer()&&p.IsInContainer()&&(w=p.GetContainer(),A=A.GetContainer(),w===A&&(H=!1))}if(p.IsInContainer()&&!h&&
!m&&H){for(var F of p.GetContainer().objectTypes())F!==p&&(w=this.CreateInstanceFromData(F,y,!1,E?E.GetX():g,E?E.GetY():l,!0,!1,void 0,q),d._AddSibling(w));for(var J of d.siblings()){J._AddSibling(d);for(const B of d.siblings())J!==B&&J._AddSibling(B)}}x&&!h&&u&&this._CreateChildInstancesFromData(d,r,E,e,g,l,q);if(p.IsInContainer()&&!h&&!m&&u)for(const B of d.siblings())if(h=B.GetWorldInfo())F=B.GetPlugin(),J=B.GetObjectClass().GetDefaultInstanceData()[0],F.IsWorldType()?this._CreateChildInstancesFromData(B,
J,h,e,h.GetX(),h.GetY(),q):this._CreateChildInstancesFromData(B,J,h,e,void 0,void 0,q);!m&&u&&("undefined"===typeof g&&(g=r[0]),"undefined"===typeof l&&(l=r[1]),e=E.GetTopParent(),g=g-E.GetX()+e.GetX(),l=l-E.GetY()+e.GetY(),e.SetXY(g,l));p._SetIIDsStale();l=t?f.cloneArray(t[5]):null;t=t?t[4].map(B=>f.cloneArray(B)):null;(x=x&&r&&r[13])&&d._SetHasTilemap();d._CreateSdkInstance(l,t);x&&(r=r[13],d.GetSdkInstance().LoadTilemapData(r[2],r[0],r[1]));this._instancesPendingCreate.push(d);this._hasPendingInstances=
!0;this.IsDebug()&&b.InstanceCreated(d);return d}_CreateChildInstancesFromData(d,e,h,g,l,m,u){var w=h.GetSceneGraphZIndexExportData(),q=h.GetSceneGraphChildrenExportData();d.GetWorldInfo().SetSceneGraphZIndex(w);if(q){"undefined"===typeof l&&(l=e[0]);"undefined"===typeof m&&(m=e[1]);w=new Set;h=e[0];e=e[1];for(const y of q){var t=y[1],p=y[2];q=y[3];var r=!!y[4];const E=y[5];p=this._layoutManager.GetLayoutBySID(y[0]).GetLayer(t).GetInitialInstanceData(p);t=this.GetObjectClassByIndex(p[1]);var x=d.HasSibling(t);
const H=w.has(t);x&&!H&&r?(r=d.GetSibling(t),x=l+p[0][0]-h,p=m+p[0][1]-e,r.GetWorldInfo().SetXY(x,p),r.GetWorldInfo().SetSceneGraphZIndex(E),d.AddChild(r,{transformX:!!(q>>0&1),transformY:!!(q>>1&1),transformWidth:!!(q>>2&1),transformHeight:!!(q>>3&1),transformAngle:!!(q>>4&1),destroyWithParent:!!(q>>5&1),transformZElevation:!!(q>>6&1)}),w.add(t)):(t=this.CreateInstanceFromData(p,g,!1,l+p[0][0]-h,m+p[0][1]-e,!1,!0,d,u),t.GetWorldInfo().SetSceneGraphZIndex(E),d.AddChild(t,{transformX:!!(q>>0&1),transformY:!!(q>>
1&1),transformWidth:!!(q>>2&1),transformHeight:!!(q>>3&1),transformAngle:!!(q>>4&1),destroyWithParent:!!(q>>5&1),transformZElevation:!!(q>>6&1)}))}}}DestroyInstance(d){if(!this._instancesToReleaseAtEndOfTick.has(d)){var e=d.GetObjectClass(),h=this._instancesPendingDestroy.get(e);if(h){if(h.has(d))return;h.add(d)}else h=new Set,h.add(d),this._instancesPendingDestroy.set(e,h);this.IsDebug()&&b.InstanceDestroyed(d);d._MarkDestroyed();this._hasPendingInstances=!0;if(d.IsInContainer())for(const g of d.siblings())this.DestroyInstance(g);
for(const g of d.children())g.GetDestroyWithParent()&&this.DestroyInstance(g);this._layoutManager.IsEndingLayout()||this._isLoadingState||(e=this.GetEventSheetManager(),e.BlockFlushingInstances(!0),d._TriggerOnDestroyed(),e.BlockFlushingInstances(!1));d._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances=
this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const d of this._instancesPendingCreate){const e=d.GetObjectClass();e._AddInstance(d);for(const h of e.GetFamilies())h._AddInstance(d),h._SetIIDsStale()}f.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [d,e]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(d,e),e.clear();this._instancesPendingDestroy.clear();
this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(d,e){for(const g of e){var h=this._eventObjects.instancedestroy;h.instance=g;this._dispatcher.dispatchEvent(h);this._instancesByUid.delete(g.GetUID());if(h=g.GetWorldInfo())h._RemoveFromCollisionCells(),h._RemoveFromRenderCells(),h._MarkDestroyed();this._instancesToReleaseAtEndOfTick.add(g);this._objectCount--}f.arrayRemoveAllInSet(d.GetInstances(),e);d._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(d);
0===d.GetInstances().length&&d._SetAnyInstanceParallaxed(!1);for(const g of d.GetFamilies())f.arrayRemoveAllInSet(g.GetInstances(),e),g._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(g);if(d.GetPlugin().IsWorldType()){d=new Set([...e].map(g=>g.GetWorldInfo().GetLayer()));for(const g of d)g._RemoveAllInstancesInSet(e)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(d){for(const e of this._GetInstancesPendingCreate())d.IsFamily()?
e.GetObjectClass().BelongsToFamily(d)&&(yield e):e.GetObjectClass()===d&&(yield e)}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(d,e){this._instancesByUid.set(d,e)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(f.New(f.Event,"webglcontextlost"));this.SetSuspended(!0);for(var d of this._allObjectClasses)!d.IsFamily()&&d.HasLoadedTextures()&&d.ReleaseTextures();(d=this.GetMainRunningLayout())&&d._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(d){this.SetSuspended(d.hidden)}_OnWindowBlur(d){this.IsPreview()&&this._pauseOnBlur&&!f.Platform.IsMobile&&!d.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const d=this._tickCallbacks;"vsync"===this._framerateMode?
-1===this._rafId&&(this._rafId=self.requestAnimationFrame(d.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=f.RequestUnlimitedAnimationFrame(d.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(d.renderOnly))):-1===this._ruafId&&(this._ruafId=f.RequestUnlimitedAnimationFrame(d.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(d){var e=this.IsSuspended();this._suspendCount+=d?1:-1;0>this._suspendCount&&(this._suspendCount=0);d=this.IsSuspended();!e&&d?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(f.New(f.Event,"suspend")),this.Trigger(f.Plugins.System.Cnds.OnSuspend,null,null)):e&&!d&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=e=performance.now(),this._mainThreadTimeCounter=
this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(f.New(f.Event,"resume")),this.Trigger(f.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(e))}_AddBehInstToTick(d){this._behInstsToTick.Add(d)}_AddBehInstToPostTick(d){this._behInstsToPostTick.Add(d)}_AddBehInstToTick2(d){this._behInstsToTick2.Add(d)}_RemoveBehInstToTick(d){this._behInstsToTick.Remove(d)}_RemoveBehInstToPostTick(d){this._behInstsToPostTick.Remove(d)}_RemoveBehInstToTick2(d){this._behInstsToTick2.Remove(d)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);
for(const d of this._behInstsToTick)d.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const d of this._behInstsToPostTick)d.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const d of this._behInstsToTick2)d.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const d of this._behInstsToTick){const e=
d.Tick();f.IsIterator(e)&&(yield*e)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const d of this._behInstsToPostTick){const e=d.PostTick();f.IsIterator(e)&&(yield*e)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const d of this._behInstsToTick2){const e=d.Tick2();f.IsIterator(e)&&(yield*e)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(d,e,
h){this._hasStartedTicking=!0;const g="background-wake"===h;h="background-wake"!==h&&"skip-render"!==h;this._hasStarted&&(!this.IsSuspended()||e||g)&&(e=performance.now(),this._isInTick=!0,this._MeasureDt(d||0),d=this.Step_BeforePreTick(),this.IsDebugging()&&await d,d=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),d instanceof Promise&&await d,d=this.Step_AfterPreTick(),this.IsDebugging()&&await d,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),this.GetLayoutManager().IsPendingChangeMainLayout()&&
await this._MaybeChangeLayout(),d=this.Step_RunEventsEtc(),this.IsDebugging()&&await d,h&&this.Render(),this.IsSuspended()||g||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-e)}async Step_BeforePreTick(){const d=this._eventSheetManager,e=this.IsDebug();this.FlushPendingInstances();d.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());e&&b.StartMeasuringTime();this.IsDebugging()?
await d.DebugRunScheduledWaits():d.RunScheduledWaits();e&&b.AddEventsTime();this.PopCurrentLayout();d.BlockFlushingInstances(!1);this.FlushPendingInstances();d.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const d=this.IsDebug(),e=this.IsDebugging(),h=this._dispatcher,g=this._eventObjects,l=this._userScriptEventObjects;d&&b.StartMeasuringTime();e?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();e?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):
this._BehaviorPostTick();d&&b.AddBehaviorTickTime();d&&b.StartMeasuringTime();e?await this.DebugFireGeneratorEventAndBreak(g.tick):h.dispatchEvent(g.tick);d&&b.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(l.tick)}async Step_RunEventsEtc(){const d=this._eventSheetManager,e=this._dispatcher,h=this._eventObjects,g=this.IsDebug(),l=this.IsDebugging();g&&b.StartMeasuringTime();l?await d.DebugRunEvents(this._layoutManager):d.RunEvents(this._layoutManager);
g&&b.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=!1;d.BlockFlushingInstances(!0);g&&b.StartMeasuringTime();l?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();g&&b.AddBehaviorTickTime();g&&b.StartMeasuringTime();l?await this.DebugFireGeneratorEventAndBreak(h.tick2):e.dispatchEvent(h.tick2);g&&b.AddPluginTickTime();d.BlockFlushingInstances(!1);l&&await d.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(0!==
this._instancesToReleaseAtEndOfTick.size){var d=this._dispatcher;d.SetDelayRemoveEventsEnabled(!0);for(const e of this._instancesToReleaseAffectedObjectClasses)e.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const e of this._instancesToReleaseAtEndOfTick)e.Release();this._instancesToReleaseAtEndOfTick.clear();d.SetDelayRemoveEventsEnabled(!1)}}async _MaybeChangeLayout(){const d=
this.GetLayoutManager();let e=0;for(;d.IsPendingChangeMainLayout()&&10>e++;)await this._DoChangeLayout(d.GetPendingChangeMainLayout())}_MeasureDt(d){let e=0;0!==this._lastTickTime&&(e=Math.max(d-this._lastTickTime,0)/1E3,.5<e&&(e=0),this._dt1=Math.min(e,1/this._minimumFramerate));this._lastTickTime=d;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(e*this._timeScale);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=d-this._fpsLastTime&&
(this._fpsLastTime+=1E3,1E3<=d-this._fpsLastTime&&(this._fpsLastTime=d),this._fps=this._fpsFrameCount,this._fpsFrameCount=0,this._mainThreadTime=Math.min(this._mainThreadTimeCounter/1E3,1),this._mainThreadTimeCounter=0,this._canvasManager&&this._canvasManager._Update1sFrameRange(),this._collisionEngine._Update1sStats(),this.IsDebug()&&b.Update1sPerfStats());this._fpsFrameCount++}async _DoChangeLayout(d){const e=this._dispatcher,h=this.GetLayoutManager().GetMainRunningLayout();await h._StopRunning();
h._Unload(d,this.GetRenderer());h===d&&this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();e.dispatchEvent(this._eventObjects.beforelayoutchange);f.Asyncify.SetHighThroughputMode(!0);await d._Load(h,this.GetRenderer());f.Asyncify.SetHighThroughputMode(!1);await d._StartRunning(!1);e.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender=
!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}GetWebGPURenderer(){return this._canvasManager?this._canvasManager.GetWebGPURenderer():null}GetRenderer(){return this._canvasManager?this._canvasManager.GetRenderer():null}Render(){const d=this._canvasManager;if(d&&!d.IsRendererContextLost()){var e=this.GetRenderer(),h=e.SupportsGPUProfiling(),g=h&&e.IsWebGL();h=h&&e.IsWebGPU();g&&e.CheckForQueryResults();if(this._needRender){var l=this._layoutManager.GetMainRunningLayout();
e.Start();var m=this.IsDebug();m&&b.StartMeasuringTime();this._needRender=!1;var u=null;g&&(u=d.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),e.StartQuery(u));g=null;h&&(g=e.StartFrameTiming(2*(1+l.GetLayerCount())),e.WriteTimestamp(0));this.Uses3DFeatures()&&"low"===d.GetCurrentFullscreenScalingQuality()?e.SetFixedSizeDepthBuffer(d.GetDrawWidth(),d.GetDrawHeight()):e.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),l);u&&e.EndQuery(u);h&&(e.WriteTimestamp(1),this._canvasManager._AddWebGPUFrameTiming(g));
e.Finish();m&&(b.AddDrawCallsTime(),b.UpdateInspectHighlight());d&&d._MaybeTakeSnapshot()}else e.IncrementFrameNumber()}}_Render(d,e){d.SetTextureFillMode();d.SetAlphaBlend();d.SetColorRgba(1,1,1,1);d.SetRenderTarget(null);d.SetTexture(null);d.SetDepthEnabled(this.Uses3DFeatures());e.Draw(d)}Trigger(d,e,h){if(!this._hasStarted)return!1;var g=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let l=0;g&&(l=performance.now());const m=this.IsDebug();m&&this.SetDebuggingEnabled(!1);d=this._eventSheetManager._Trigger(this._layoutManager,
d,e,h);g&&(g=performance.now()-l,this._mainThreadTimeCounter+=g,m&&b.AddTriggersTime(g));m&&this.SetDebuggingEnabled(!0);return d}DebugTrigger(d,e,h){if(!this.IsDebug())return this.Trigger(d,e,h);if(this.HitBreakpoint())throw Error("called DebugTrigger() while stopped on breakpoint");if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,d,e,
h)}async TriggerAsync(d,e,h){if(!this.IsDebugging())return this.Trigger(d,e,h);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(d,e,h);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(d,e,h);const g=performance.now();d=this._eventSheetManager._DebugTrigger(this._layoutManager,d,e,h);for(e=d.next();!e.done;)await this.DebugBreak(e.value),e=d.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),
this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-g;return e.value}FastTrigger(d,e,h){const g=this.IsDebug();g&&this.SetDebuggingEnabled(!1);d=this._eventSheetManager._FastTrigger(this._layoutManager,d,e,h);g&&this.SetDebuggingEnabled(!0);return d}DebugFastTrigger(d,e,h){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,d,e,h)}ScheduleTriggers(d){return this._scheduleTriggersThrottle.Add(d)}PushCurrentLayout(d){this._currentLayoutStack.push(d)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty");
this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?this._currentLayoutStack.at(-1):this.GetMainRunningLayout()}GetDt(d){return d&&-1!==d.GetTimeScale()?this._dt1*d.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(d){if(isNaN(d)||0>d)d=0;this._timeScale=d}SetMinimumFramerate(d){this._minimumFramerate=f.clamp(d,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetGameTimeRaw(){return this._gameTimeRaw.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}IncrementExecCount(){++this._execCount}GetExecCount(){return this._execCount}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(d){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event");
return this._instancesByUid.get(d)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const d of this._allObjectClasses)if(!d.IsFamily())for(const e of d.GetInstances())this._instancesByUid.set(e.GetUID(),e)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===f.Platform.OS&&("cordova"===this._exportType||"playable-ad"===this._exportType||"instant-games"===
this._exportType)}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}Uses3DFeatures(){return this._uses3dFeatures}GetZScaleFactor(){const d=this.GetRenderer();return this.GetViewportHeight()/2/Math.tan(d.GetFovY()/2)/d.GetDefaultCameraZ()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(d){d=
!!d;this._isPixelRoundingEnabled!==d&&(this._isPixelRoundingEnabled=d,this.GetLayoutManager().SetAllLayerMVChanged(),this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(d){this._saveToSlotName=d}LoadFromSlot(d){this._loadFromSlotName=d}LoadFromJsonString(d){this._loadFromJson=d}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!(!this._saveToSlotName&&!this._loadFromSlotName&&null===this._loadFromJson)}async _HandleSaveOrLoad(){this._saveToSlotName&&
(this.FlushPendingInstances(),await this._DoSaveToSlot(this._saveToSlotName),this._ClearSaveOrLoad());this._loadFromSlotName&&(await this._DoLoadFromSlot(this._loadFromSlotName),this._ClearSaveOrLoad(),this.IsDebug()&&b.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(d){console.error("[Construct 3] Failed to load state from JSON string: ",
d),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(d){const e=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(d,e),console.log("[Construct 3] Saved state to storage ("+e.length+" chars)"),this._lastSaveJson=e,await this.TriggerAsync(f.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(h){console.error("[Construct 3] Failed to save state to storage: ",h),await this.TriggerAsync(f.Plugins.System.Cnds.OnSaveFailed,
null)}}async _DoLoadFromSlot(d){try{const e=await this._GetSavegamesStorage().getItem(d);if(!e)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+e.length+" chars)");await this._DoLoadFromJsonString(e);this._lastSaveJson=e;await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(e){console.error("[Construct 3] Failed to load state from storage: ",e),await this.TriggerAsync(f.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const d=
{c3save:!0,version:1,rt:{time:this.GetGameTime(),timeRaw:this.GetGameTimeRaw(),walltime:this.GetWallTime(),timescale:this.GetTimeScale(),tickcount:this.GetTickCount(),execcount:this.GetExecCount(),next_uid:this._nextUid,running_layout:this.GetMainRunningLayout().GetSID(),start_time_offset:Date.now()-this._startTime},types:{},layouts:{},events:this._eventSheetManager._SaveToJson(),timelines:this._timelineManager._SaveToJson(),user_script_data:null};for(var e of this._allObjectClasses)e.IsFamily()||
e.HasNoSaveBehavior()||(d.types[e.GetSID().toString()]=e._SaveToJson());for(const h of this._layoutManager.GetAllLayouts())d.layouts[h.GetSID().toString()]=h._SaveToJson();e=this._CreateUserScriptEvent("save");e.saveData=null;await this.DispatchUserScriptEventAsyncWait(e);d.user_script_data=e.saveData;return JSON.stringify(d)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(d){var e=this.GetLayoutManager();d=JSON.parse(d);if(d.c2save)throw Error("C2 saves are incompatible with C3 runtime");
if(!d.c3save)throw Error("not valid C3 save data");if(1<d.version)throw Error("C3 save data from future version");this._dispatcher.dispatchEvent(f.New(f.Event,"beforeload"));for(var h of this.allInstances())h._OnBeforeLoad();this._isLoadingState=!0;h=d.rt;this._gameTime.Set(h.time);h.hasOwnProperty("timeRaw")&&this._gameTimeRaw.Set(h.timeRaw);this._wallTime.Set(h.walltime);this._timeScale=h.timescale;this._tickCount=h.tickcount;this._execCount=h.execcount;this._startTime=Date.now()-h.start_time_offset;
var g=h.running_layout;if(g!==this.GetMainRunningLayout().GetSID())if(g=e.GetLayoutBySID(g))await this._DoChangeLayout(g);else return;for(const [l,m]of Object.entries(d.types))g=parseInt(l,10),g=this.GetObjectClassBySID(g),!g||g.IsFamily()||g.HasNoSaveBehavior()||g._LoadFromJson(m);this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=h.next_uid;for(const [l,m]of Object.entries(d.layouts))h=parseInt(l,10),(h=e.GetLayoutBySID(h))&&h._LoadFromJson(m);this._eventSheetManager._LoadFromJson(d.events);
for(const l of this._allObjectClasses)if(!l.IsFamily()&&l.IsInContainer())for(const m of l.GetInstances()){h=m.GetIID();for(const u of l.GetContainer().objectTypes())if(u!==l){g=u.GetInstances();if(0>h||h>=g.length)throw Error("missing sibling instance");m._AddSibling(g[h])}}this._timelineManager._LoadFromJson(d.timelines);e.SetAllLayerProjectionChanged();e.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(f.New(f.Event,"afterload"));e=this._CreateUserScriptEvent("load");e.saveData=d.user_script_data;
await this.DispatchUserScriptEventAsyncWait(e);this.UpdateRender()}async AddJobWorkerScripts(d){d=(await Promise.all(d.map(e=>this._assetManager.FetchBlob(e)))).map(e=>URL.createObjectURL(e));this._jobScheduler.ImportScriptsToJobWorkers(d)}AddJobWorkerBlob(d,e){this._jobScheduler.SendBlobToJobWorkers(d,e)}AddJobWorkerBuffer(d,e){this._jobScheduler.SendBufferToJobWorkers(d,e)}AddJob(d,e,h){return this._jobScheduler.AddJob(d,e,h)}BroadcastJob(d,e,h){return this._jobScheduler.BroadcastJob(d,e,h)}InvokeDownload(d,
e){this.PostComponentMessageToDOM("runtime","invoke-download",{url:d,filename:e})}async RasterSvgImage(d,e,h,g,l,m){g=g||e;l=l||h;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{blob:d,imageWidth:e,imageHeight:h,surfaceWidth:g,surfaceHeight:l,imageBitmapOpts:m})).imageBitmap;d=await self.C3_RasterSvgImageBlob(d,e,h,g,l);return m?await self.createImageBitmap(d,m):d}async GetSvgImageSize(d){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime",
"get-svg-image-size",{blob:d}):await self.C3_GetSvgImageSize(d)}RequestDeviceOrientationEvent(){this._didRequestDeviceOrientationEvent||(this._didRequestDeviceOrientationEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-orientation"))}RequestDeviceMotionEvent(){this._didRequestDeviceMotionEvent||(this._didRequestDeviceMotionEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-motion"))}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(d){this._randomNumberCallback=
d}_GetRemotePreviewStatusInfo(){const d=this.GetWebGLRenderer();return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:d?d.GetUnmaskedRenderer():"<unavailable>"}}HitBreakpoint(){return this.IsDebug()?b.HitBreakpoint():!1}DebugBreak(d){return this.IsDebugging()?b.DebugBreak(d):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?b.BreakNext():!1}SetDebugBreakpointsEnabled(d){this._breakpointsEnabled=
!!d;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(d){d?this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&b.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&&b.IsGPUProfiling()}async DebugIterateAndBreak(d){if(d)for(const e of d)await this.DebugBreak(e)}DebugFireGeneratorEventAndBreak(d){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(d))}_InvokeFunctionFromJS(d){return this._eventSheetManager._InvokeFunctionFromJS(d.name,
d.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(d){d=f.New(f.Event,d,!1);d.runtime=this._iRuntime;return d}_InitScriptInterfaces(){var d={};for(const e of this._allObjectClasses)d[e.GetJsPropName()]={value:e.GetIObjectClass(),enumerable:!0,writable:!1};d=Object.create(Object.prototype,d);this._iRuntime=new self.IRuntime(this,d);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const d={};for(const e of this.GetEventSheetManager().GetAllGlobalVariables())d[e.GetJsPropName()]=
e._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(d)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(d,e){this._interfaceMap.set(d,e)}_UnwrapScriptInterface(d){return this._interfaceMap.get(d)}_UnwrapIObjectClass(d){if(!(d instanceof self.IObjectClass))throw new TypeError("expected IObjectClass");d=this._UnwrapScriptInterface(d);if(!(d&&d instanceof f.ObjectClass))throw Error("invalid IObjectClass");return d}_UnwrapIWorldInstance(d){if(!(d instanceof
self.IWorldInstance))throw new TypeError("expected IWorldInstance");d=this._UnwrapScriptInterface(d);if(!(d&&d instanceof f.Instance))throw Error("invalid IInstance");return d}};self.C3_CreateRuntime=f.Runtime.Create;self.C3_InitRuntime=(d,e)=>d.Init(e)}
{"use strict";const f=self.C3;f.JobSchedulerRuntime=class extends f.DefendedBase{constructor(b,a){super();this._runtime=b;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=a.inputPort;a.outputPort.onmessage=c=>this._OnJobWorkerMessage(c);this._maxNumWorkers=a.maxNumWorkers;this._jobWorkerCount=1;this._hadErrorCreatingWorker=this._isCreatingWorker=!1}async Init(){}ImportScriptsToJobWorkers(b){this._inputPort.postMessage({type:"_import_scripts",scripts:b})}SendBlobToJobWorkers(b,a){this._inputPort.postMessage({type:"_send_blob",
blob:b,id:a})}SendBufferToJobWorkers(b,a){this._inputPort.postMessage({type:"_send_buffer",buffer:b,id:a},[b])}AddJob(b,a,c,d,e){c||(c=[]);const h=this._nextJobId++;b={type:b,isBroadcast:!1,jobId:h,params:a,transferables:c};a=new Promise((g,l)=>{this._jobPromises.set(h,{resolve:g,progress:d,reject:l,cancelled:!1})});e&&e.SetAction(()=>this._CancelJob(h));this._inputPort.postMessage(b,c);this._MaybeCreateExtraWorker();return a}BroadcastJob(b,a,c){c||(c=[]);const d=this._nextJobId++;this._inputPort.postMessage({type:b,
isBroadcast:!0,jobId:d,params:a,transferables:c},c)}_CancelJob(b){const a=this._jobPromises.get(b);a&&(a.cancelled=!0,a.resolve=null,a.progress=null,a.reject=null,this._inputPort.postMessage({type:"_cancel",jobId:b}))}_OnJobWorkerMessage(b){b=b.data;const a=b.type,c=b.jobId;switch(a){case "result":this._OnJobResult(c,b.result);break;case "progress":this._OnJobProgress(c,b.progress);break;case "error":this._OnJobError(c,b.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${a}'`);
}}_OnJobResult(b,a){const c=this._jobPromises.get(b);if(!c)throw Error("invalid job ID");c.cancelled||c.resolve(a);this._jobPromises.delete(b)}_OnJobProgress(b,a){b=this._jobPromises.get(b);if(!b)throw Error("invalid job ID");!b.cancelled&&b.progress&&b.progress(a)}_OnJobError(b,a){const c=this._jobPromises.get(b);if(!c)throw Error("invalid job ID");c.cancelled||c.reject(a);this._jobPromises.delete(b)}_OnJobWorkerReady(){this._isCreatingWorker&&(this._isCreatingWorker=!1,this._jobWorkerCount++,this._jobWorkerCount<
this._maxNumWorkers?this._MaybeCreateExtraWorker():this._inputPort.postMessage({type:"_no_more_workers"}))}async _MaybeCreateExtraWorker(){if(!(this._jobWorkerCount>=this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._jobPromises.size<=this._jobWorkerCount))try{this._isCreatingWorker=!0,(await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker")).outputPort.onmessage=b=>this._OnJobWorkerMessage(b)}catch(b){this._hadErrorCreatingWorker=!0,this._isCreatingWorker=
!1,console.error(`[Construct 3] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,b)}}}}self.C3_Shaders={};
self.C3_Shaders.brightness={glsl:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform lowp float brightness;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\nlowp float a = front.a;\nif (a != 0.0)\nfront.rgb /= front.a;\nfront.rgb += (brightness - 1.0);\nfront.rgb *= a;\ngl_FragColor = front;\n}",wgsl:"%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d<f32>;\n[[block]] struct ShaderParams {\nbrightness : f32;\n};\n%%SHADERPARAMS_BINDING%% var<uniform> shaderParams : ShaderParams;\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\n[[stage(fragment)]]\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar front : vec4<f32> = c3_unpremultiply(textureSample(textureFront, samplerFront, input.fragUV));\nvar output : FragmentOutput;\noutput.color = vec4<f32>((front.rgb + (shaderParams.brightness - 1.0)) * front.a, front.a);\nreturn output;\n}",blendsBackground:!1,
usesDepth:!1,extendBoxHorizontal:0,extendBoxVertical:0,crossSampling:!1,mustPreDraw:!1,preservesOpaqueness:!0,animated:!1,parameters:[["brightness",0,"percent"]]};
self.C3_Shaders.grayscale={glsl:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform lowp float intensity;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\nlowp float gray = front.r * 0.299 + front.g * 0.587 + front.b * 0.114;\ngl_FragColor = mix(front, vec4(gray, gray, gray, front.a), intensity);\n}",wgsl:"%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d<f32>;\n[[block]] struct ShaderParams {\nintensity : f32;\n};\n%%SHADERPARAMS_BINDING%% var<uniform> shaderParams : ShaderParams;\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\n[[stage(fragment)]]\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar front : vec4<f32> = textureSample(textureFront, samplerFront, input.fragUV);\nvar gray : f32 = c3_grayscale(front.rgb);\nvar output : FragmentOutput;\noutput.color = mix(front, vec4<f32>(gray, gray, gray, front.a), shaderParams.intensity);\nreturn output;\n}",
blendsBackground:!1,usesDepth:!1,extendBoxHorizontal:0,extendBoxVertical:0,crossSampling:!1,mustPreDraw:!1,preservesOpaqueness:!0,animated:!1,parameters:[["intensity",0,"percent"]]};
self.C3_Shaders.vignette={glsl:"varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform mediump vec2 srcStart;\nuniform mediump vec2 srcEnd;\nuniform mediump float vignetteStart;\nuniform mediump float vignetteEnd;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\nlowp float a = front.a;\nif (a != 0.0)\nfront.rgb /= a;\nmediump vec2 tex = (vTex - srcStart) / (srcEnd - srcStart);\nlowp float d = distance(tex, vec2(0.5, 0.5));\nfront.rgb *= smoothstep(vignetteEnd, vignetteStart, d);\nfront.rgb *= a;\ngl_FragColor = front;\n}",wgsl:"%%SAMPLERFRONT_BINDING%% var samplerFront : sampler;\n%%TEXTUREFRONT_BINDING%% var textureFront : texture_2d<f32>;\n[[block]] struct ShaderParams {\nvignetteStart : f32;\nvignetteEnd : f32;\n};\n%%SHADERPARAMS_BINDING%% var<uniform> shaderParams : ShaderParams;\n%%C3PARAMS_STRUCT%%\n%%C3_UTILITY_FUNCTIONS%%\n%%FRAGMENTINPUT_STRUCT%%\n%%FRAGMENTOUTPUT_STRUCT%%\nlet center : vec2<f32> = vec2<f32>(0.5);\n[[stage(fragment)]]\nfn main(input : FragmentInput) -> FragmentOutput\n{\nvar front : vec4<f32> = c3_unpremultiply(textureSample(textureFront, samplerFront, input.fragUV));\nvar rgb : vec3<f32> = front.rgb;\nvar tex : vec2<f32> = c3_srcToNorm(input.fragUV);\nvar d : f32 = distance(tex, center);\nrgb = rgb * smoothStep(shaderParams.vignetteEnd, shaderParams.vignetteStart, d);\nvar output : FragmentOutput;\noutput.color = vec4<f32>(rgb * front.a, front.a);\nreturn output;\n}",
blendsBackground:!1,usesDepth:!1,extendBoxHorizontal:0,extendBoxVertical:0,crossSampling:!1,mustPreDraw:!1,preservesOpaqueness:!0,animated:!1,parameters:[["vignetteStart",0,"percent"],["vignetteEnd",0,"percent"]]};
{"use strict";const f=self.C3;let b=null,a="",c="",d=[],e="",h="",g="";const l=f.New(f.ArrayStack);function m(u,w){u=u[1];w=w[1];if("number"===typeof u&&"number"===typeof w)return u-w;u=""+u;w=""+w;return u<w?-1:u>w?1:0}f.Plugins.System=class extends f.SDKPluginBase{constructor(u){super(u);this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingComplete=this._imagesLoadingTotal=0;this._functionMaps=
new Map}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(u){this._runtime.Trigger(u,null,null)}GetRegex(u,w){b&&u===a&&w===c||(b=new RegExp(u,w),a=u,c=w);b.lastIndex=0;return b}GetRegexMatches(u,w,q){if(u===e&&w===h&&q===g)return d;const t=this.GetRegex(w,q);d=u.match(t);e=u;h=w;g=q;return d}async _LoadTexturesForObjectClasses(u,w){if(w.length){this._imagesLoadingTotal+=w.length;var q=[];for(const t of w)q.push(u.MaybeLoadTexturesFor(t));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(u,w){for(const q of w)0===q.GetInstanceCount()&&u.MaybeUnloadTexturesFor(q)}_GetForEachStack(){return l}_Repeat(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(),
p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();const y=q.Push(p),E=w.GetLoopStack(),H=E.Push();H.SetEnd(u);if(x)for(x=0;x<u&&!H.IsStopped();++x)w.PushCopySol(r),H.SetIndex(x),p.Retrigger(t,y),w.PopSol(r);else for(w=0;w<u&&!H.IsStopped();++w)H.SetIndex(w),p.Retrigger(t,y);q.Pop();E.Pop();return!1}*_DebugRepeat(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(),p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();
const y=q.Push(p),E=w.GetLoopStack(),H=E.Push();H.SetEnd(u);if(x)for(x=0;x<u&&!H.IsStopped();++x)w.PushCopySol(r),H.SetIndex(x),yield*p.DebugRetrigger(t,y),w.PopSol(r);else for(w=0;w<u&&!H.IsStopped();++w)H.SetIndex(w),yield*p.DebugRetrigger(t,y);q.Pop();E.Pop();return!1}_While(){var u=this._runtime.GetEventSheetManager();const w=u.GetEventStack(),q=w.GetCurrentStackFrame(),t=q.GetCurrentEvent(),p=t.GetSolModifiers();var r=q.IsSolModifierAfterCnds();const x=w.Push(t),y=u.GetLoopStack(),E=y.Push();
if(r)for(r=0;!E.IsStopped();++r)u.PushCopySol(p),E.SetIndex(r),t.Retrigger(q,x)||E.Stop(),u.PopSol(p);else for(u=0;!E.IsStopped();++u)E.SetIndex(u),t.Retrigger(q,x)||E.Stop();w.Pop();y.Pop();return!1}*_DebugWhile(){var u=this._runtime.GetEventSheetManager();const w=u.GetEventStack(),q=w.GetCurrentStackFrame(),t=q.GetCurrentEvent(),p=t.GetSolModifiers();var r=q.IsSolModifierAfterCnds();const x=w.Push(t),y=u.GetLoopStack(),E=y.Push();if(r)for(r=0;!E.IsStopped();++r)u.PushCopySol(p),E.SetIndex(r),(yield*t.DebugRetrigger(q,
x))||E.Stop(),u.PopSol(p);else for(u=0;!E.IsStopped();++u)E.SetIndex(u),(yield*t.DebugRetrigger(q,x))||E.Stop();w.Pop();y.Pop();return!1}_For(u,w,q){var t=this._runtime.GetEventSheetManager();const p=t.GetEventStack(),r=p.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),E=r.IsSolModifierAfterCnds(),H=p.Push(x),A=t.GetLoopStack(),F=A.Push();F.SetName(u);F.SetEnd(q);if(q<w)if(E)for(u=w;u>=q&&!F.IsStopped();--u)t.PushCopySol(y),F.SetIndex(u),x.Retrigger(r,H),t.PopSol(y);else for(t=
w;t>=q&&!F.IsStopped();--t)F.SetIndex(t),x.Retrigger(r,H);else if(E)for(u=w;u<=q&&!F.IsStopped();++u)t.PushCopySol(y),F.SetIndex(u),x.Retrigger(r,H),t.PopSol(y);else for(t=w;t<=q&&!F.IsStopped();++t)F.SetIndex(t),x.Retrigger(r,H);p.Pop();A.Pop();return!1}*_DebugFor(u,w,q){var t=this._runtime.GetEventSheetManager();const p=t.GetEventStack(),r=p.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),E=r.IsSolModifierAfterCnds(),H=p.Push(x),A=t.GetLoopStack(),F=A.Push();F.SetName(u);F.SetEnd(q);
if(q<w)if(E)for(u=w;u>=q&&!F.IsStopped();--u)t.PushCopySol(y),F.SetIndex(u),yield*x.DebugRetrigger(r,H),t.PopSol(y);else for(t=w;t>=q&&!F.IsStopped();--t)F.SetIndex(t),yield*x.DebugRetrigger(r,H);else if(E)for(u=w;u<=q&&!F.IsStopped();++u)t.PushCopySol(y),F.SetIndex(u),yield*x.DebugRetrigger(r,H),t.PopSol(y);else for(t=w;t<=q&&!F.IsStopped();++t)F.SetIndex(t),yield*x.DebugRetrigger(r,H);p.Pop();A.Pop();return!1}_ForEach(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(),
p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();const y=q.Push(p),E=w.GetLoopStack(),H=E.Push(),A=u.IsInContainer(),F=u.GetCurrentSol(),J=l.Push();f.shallowAssignArray(J,F.GetInstances());H.SetEnd(J.length);if(x)for(let B=0,I=J.length;B<I&&!H.IsStopped();++B)w.PushCopySol(r),x=J[B],u.GetCurrentSol().SetSinglePicked(x),A&&x.SetSiblingsSinglePicked(),H.SetIndex(B),p.Retrigger(t,y),w.PopSol(r);else{F._SetSelectAll(!1);u=F._GetOwnInstances();f.clearArray(u);u.push(null);for(let B=
0,I=J.length;B<I&&!H.IsStopped();++B)w=J[B],u[0]=w,A&&w.SetSiblingsSinglePicked(),H.SetIndex(B),p.Retrigger(t,y)}q.Pop();E.Pop();f.clearArray(J);l.Pop();return!1}*_DebugForEach(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(),p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();const y=q.Push(p),E=w.GetLoopStack(),H=E.Push(),A=u.IsInContainer(),F=u.GetCurrentSol(),J=l.Push();f.shallowAssignArray(J,F.GetInstances());H.SetEnd(J.length);
if(x)for(let B=0,I=J.length;B<I&&!H.IsStopped();++B)w.PushCopySol(r),x=J[B],u.GetCurrentSol().SetSinglePicked(x),A&&x.SetSiblingsSinglePicked(),H.SetIndex(B),yield*p.DebugRetrigger(t,y),w.PopSol(r);else{F._SetSelectAll(!1);u=F._GetOwnInstances();f.clearArray(u);u.push(null);for(let B=0,I=J.length;B<I&&!H.IsStopped();++B)w=J[B],u[0]=w,A&&w.SetSiblingsSinglePicked(),H.SetIndex(B),yield*p.DebugRetrigger(t,y)}q.Pop();E.Pop();f.clearArray(J);l.Pop();return!1}_ForEachOrdered(u,w){var q=this._runtime.GetEventSheetManager();
const t=q.GetEventStack(),p=q.GetCurrentCondition(),r=t.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),E=r.IsSolModifierAfterCnds(),H=t.Push(x),A=q.GetLoopStack(),F=A.Push(),J=u.IsInContainer(),B=u.GetCurrentSol(),I=l.Push();f.clearArray(I);const L=B.GetInstances();F.SetEnd(L.length);for(let P=0,S=L.length;P<S;++P)I.push([L[P],p.ReevaluateParameter(1,P)]);I.sort(m);1===w&&I.reverse();if(E)for(let P=0,S=I.length;P<S&&!F.IsStopped();++P)q.PushCopySol(y),w=I[P][0],u.GetCurrentSol().SetSinglePicked(w),
J&&w.SetSiblingsSinglePicked(),F.SetIndex(P),x.Retrigger(r,H),q.PopSol(y);else{B._SetSelectAll(!1);u=B._GetOwnInstances();f.clearArray(u);u.push(null);for(let P=0,S=I.length;P<S&&!F.IsStopped();++P)q=I[P][0],u[0]=q,J&&q.SetSiblingsSinglePicked(),F.SetIndex(P),x.Retrigger(r,H)}t.Pop();A.Pop();f.clearArray(I);l.Pop();return!1}*_DebugForEachOrdered(u,w){var q=this._runtime.GetEventSheetManager();const t=q.GetEventStack(),p=q.GetCurrentCondition(),r=t.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),
E=r.IsSolModifierAfterCnds(),H=t.Push(x),A=q.GetLoopStack(),F=A.Push(),J=u.IsInContainer(),B=u.GetCurrentSol(),I=l.Push();f.clearArray(I);const L=B.GetInstances();F.SetEnd(L.length);for(let P=0,S=L.length;P<S;++P)I.push([L[P],p.ReevaluateParameter(1,P)]);I.sort(m);1===w&&I.reverse();if(E)for(let P=0,S=I.length;P<S&&!F.IsStopped();++P)q.PushCopySol(y),w=I[P][0],u.GetCurrentSol().SetSinglePicked(w),J&&w.SetSiblingsSinglePicked(),F.SetIndex(P),yield*x.DebugRetrigger(r,H),q.PopSol(y);else{B._SetSelectAll(!1);
u=B._GetOwnInstances();f.clearArray(u);u.push(null);for(let P=0,S=I.length;P<S&&!F.IsStopped();++P)q=I[P][0],u[0]=q,J&&q.SetSiblingsSinglePicked(),F.SetIndex(P),yield*x.DebugRetrigger(r,H)}t.Pop();A.Pop();f.clearArray(I);l.Pop();return!1}_GetFunctionMap(u,w){let q=this._functionMaps.get(u);if(q)return q;if(!w)return null;q={defaultFunc:null,strMap:new Map};this._functionMaps.set(u,q);return q}_DoCallMappedFunction(u,w,q,t,p){w.GetEventBlock().RunAsMappedFunctionCall(q);t&&u.PopSol(p)}*_DebugDoCallMappedFunction(u,
w,q,t,p){yield*w.GetEventBlock().DebugRunAsMappedFunctionCall(q);t&&u.PopSol(p)}}}{"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 c=a.get("TriggerOnce_lastTick");"undefined"===typeof c&&(c=-1,a.set("TriggerOnce_lastTick",
-1));const d=this._runtime.GetTickCount();a.set("TriggerOnce_lastTick",d);return this._runtime.IsLayoutFirstTick()||c!==d-1},Every(a){const c=this._runtime.GetCurrentCondition().GetSavedDataMap(),d=c.get("Every_lastTime")||0,e=this._runtime.GetGameTime();c.has("Every_seconds")||c.set("Every_seconds",a);const h=c.get("Every_seconds");if(e>=d+h)return c.set("Every_lastTime",d+h),e>=c.get("Every_lastTime")+.04&&c.set("Every_lastTime",e),c.set("Every_seconds",a),!0;e<d-.1&&c.set("Every_lastTime",e);return!1},
IsGroupActive(a){return(a=this._runtime.GetEventSheetManager().GetEventGroupByName(a))&&a.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return f.Platform.IsMobile},OnLoadFinished(){return!0},OnCanvasSnapshot(){return!0},EffectsSupported(){return!0},OnSaveComplete(){return!0},OnSaveFailed(){return!0},OnLoadComplete(){return!0},OnLoadFailed(){return!0},ObjectUIDExists(a){return!!this._runtime.GetInstanceByUID(a)},IsOnPlatform(a){switch(a){case 0:return"browser"===f.Platform.Context;
case 1:return"iOS"===f.Platform.OS;case 2:return"Android"===f.Platform.OS;case 8:return"cordova"===f.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===f.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(a,c,d){return this.GetRegex(c,d).test(a)},Compare(a,c,d){return f.compare(a,c,d)},CompareBetween(a,c,d){return a>=c&&a<=d},CompareVar(a,c,d){return f.compare(a.GetValue(),c,d)},CompareBoolVar(a){return!!a.GetValue()},
CompareTime(a,c){const d=this._runtime.GetGameTime();return 0===a?(a=this._runtime.GetCurrentCondition().GetSavedDataMap(),!a.get("CompareTime_executed")&&d>=c?(a.set("CompareTime_executed",!0),!0):!1):f.compare(d,a,c)},IsNaN(a){return isNaN(a)},AngleWithin(a,c,d){return f.angleDiff(f.toRadians(a),f.toRadians(d))<=f.toRadians(c)},IsClockwiseFrom(a,c){return f.angleClockwise(f.toRadians(a),f.toRadians(c))},IsBetweenAngles(a,c,d){a=f.toRadians(a);c=f.toRadians(c);d=f.toRadians(d);return f.angleClockwise(d,
c)?f.angleClockwise(a,c)&&!f.angleClockwise(a,d):!(!f.angleClockwise(a,c)&&f.angleClockwise(a,d))},IsValueType(a,c){return"number"===typeof a?0===c:1===c},EvaluateExpression(a){return!!a},PickByComparison(a,c,d,e){if(!a)return!1;const h=this._GetForEachStack(),g=h.Push(),l=a.GetCurrentSol();f.shallowAssignArray(g,l.GetInstances());l.IsSelectAll()&&f.clearArray(l._GetOwnElseInstances());const m=this._runtime.GetCurrentCondition();let u=0;for(let w=0,q=g.length;w<q;++w){const t=g[w];g[u]=t;c=m.ReevaluateParameter(1,
w);e=m.ReevaluateParameter(3,w);f.compare(c,d,e)?++u:l._PushElseInstance(t)}f.truncateArray(g,u);l.SetArrayPicked(g);c=!!g.length;f.clearArray(g);h.Pop();a.ApplySolToContainer();return c},PickByEvaluate(a,c){if(!a)return!1;const d=this._GetForEachStack(),e=d.Push(),h=a.GetCurrentSol();f.shallowAssignArray(e,h.GetInstances());h.IsSelectAll()&&f.clearArray(h._GetOwnElseInstances());const g=this._runtime.GetCurrentCondition();let l=0;for(let m=0,u=e.length;m<u;++m){const w=e[m];e[l]=w;(c=g.ReevaluateParameter(1,
m))?++l:h._PushElseInstance(w)}f.truncateArray(e,l);h.SetArrayPicked(e);c=!!e.length;f.clearArray(e);d.Pop();a.ApplySolToContainer();return c},PickNth(a,c){if(!a)return!1;const d=a.GetCurrentSol(),e=d.GetInstances();c=Math.floor(c);if(c>=e.length)return!1;d.PickOne(e[c]);a.ApplySolToContainer();return!0},PickRandom(a){if(!a)return!1;const c=a.GetCurrentSol(),d=c.GetInstances(),e=Math.floor(this._runtime.Random()*d.length);if(e>=d.length)return!1;c.PickOne(d[e]);a.ApplySolToContainer();return!0},PickAll(a){if(!a||
!a.GetInstanceCount())return!1;a.GetCurrentSol()._SetSelectAll(!0);a.ApplySolToContainer();return!0},PickOverlappingPoint(a,c,d){if(!a)return!1;const e=a.GetCurrentSol();var h=e.GetInstances();const g=this._runtime.GetCurrentEvent().IsOrBlock(),l=this._runtime.GetCurrentCondition().IsInverted();e.IsSelectAll()?(f.shallowAssignArray(b,h),e.ClearArrays(),e._SetSelectAll(!1)):g?(f.shallowAssignArray(b,e._GetOwnElseInstances()),f.clearArray(e._GetOwnElseInstances())):(f.shallowAssignArray(b,e._GetOwnInstances()),
f.clearArray(e._GetOwnInstances()));for(let m=0,u=b.length;m<u;++m)h=b[m],f.xor(h.GetWorldInfo().ContainsPoint(c,d),l)?e._PushInstance(h):e._PushElseInstance(h);a.ApplySolToContainer();return f.xor(!!e._GetOwnInstances().length,l)},PickLastCreated(a){if(!a)return!1;var c=a.IsFamily();let d=null;const e=this._runtime._GetInstancesPendingCreate();for(let h=e.length-1;0<=h;--h){const g=e[h];if(c){if(g.GetObjectClass().BelongsToFamily(a)){d=g;break}}else if(g.GetObjectClass()===a){d=g;break}}d||(c=a.GetInstances(),
c.length&&(d=c.at(-1)));if(!d)return!1;a.GetCurrentSol().PickOne(d);a.ApplySolToContainer();return!0},Repeat(a){return this._runtime.IsDebugging()?this._DebugRepeat(a):this._Repeat(a)},While(){return this._runtime.IsDebugging()?this._DebugWhile():this._While()},For(a,c,d){return this._runtime.IsDebugging()?this._DebugFor(a,c,d):this._For(a,c,d)},ForEach(a){return this._runtime.IsDebugging()?this._DebugForEach(a):this._ForEach(a)},ForEachOrdered(a,c,d){return this._runtime.IsDebugging()?this._DebugForEachOrdered(a,
d):this._ForEachOrdered(a,d)},LayerVisible(a){return a?a.IsVisible():!1},LayerEmpty(a){return a?!a.GetInstanceCount():!1},LayerCmpOpacity(a,c,d){return a?f.compare(100*a.GetOpacity(),c,d):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}}
{"use strict";const f=self.C3;function b(g,l){const m=g[0]-l[0];return 0!==m?m:g[1]-l[1]}function a(g,l){return g[1]-l[1]}const c=[],d=[],e=f.New(f.Rect),h=f.New(f.Color);f.Plugins.System.Acts={SetVar(g,l){g.SetValue(l)},AddVar(g,l){g.IsNumber()&&"number"!==typeof l&&(l=parseFloat(l));g.SetValue(g.GetValue()+l)},SubVar(g,l){g.IsNumber()&&g.SetValue(g.GetValue()-l)},SetBoolVar(g,l){g.SetValue(!!l)},ToggleBoolVar(g){g.SetValue(!g.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},
CreateObject(g,l,m,u,w){g&&l&&(m=this._runtime.CreateInstance(g,l,m,u,w))&&(w&&l.SortAndAddInstancesByZIndex(m),l=this._runtime.GetEventSheetManager(),l.BlockFlushingInstances(!0),m._TriggerOnCreatedOnSelfAndRelated(),l.BlockFlushingInstances(!1),g.GetCurrentSol().SetSinglePicked(m),m.IsInContainer()&&m.SetSiblingsSinglePicked())},CreateObjectByName(g,l,m,u,w){g&&l&&(g=this._runtime.GetObjectClassByName(g))&&f.Plugins.System.Acts.CreateObject.call(this,g,l,m,u,w)},RecreateInitialObjects(g,l,m,u,w,
q,t,p,r,x){if(g){var y=this._runtime.GetCurrentLayout();if(q&&(y=this._runtime.GetLayoutManager().GetLayoutByName(q),!y))return;q=null;if("number"!==typeof t||0<=t)if(q=y.GetLayer(t),!q)return;e.set(l,m,u,w);l=y.RecreateInitialObjects(g,e,q,p,r,x);g.GetCurrentSol().SetArrayPicked(l);g.ApplySolToContainer()}},StopLoop(){const g=this._loopStack;g.IsInLoop()&&g.GetCurrent().Stop()},SetGroupActive(g,l){(g=this._runtime.GetEventSheetManager().GetEventGroupByName(g))&&(0===l?g.SetGroupActive(!1):1===l?
g.SetGroupActive(!0):g.SetGroupActive(!g.IsGroupActive()))},SetTimescale(g){this._runtime.SetTimeScale(g)},SetObjectTimescale(g,l){0>l&&(l=0);if(g){g=g.GetCurrentSol().GetInstances();for(const m of g)m.SetTimeScale(l)}},RestoreObjectTimescale(g){if(g){g=g.GetCurrentSol().GetInstances();for(const l of g)l.RestoreTimeScale()}},Wait(g){if(!(0>g))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(g),!0},WaitForSignal(g){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(g);
return!0},WaitForPreviousActions(){const g=this._runtime.GetEventSheetManager();g.AddScheduledWait().InitPromise(g.GetPromiseForAllAsyncActions());return!0},Signal(g){g=g.toLowerCase();for(const l of this._runtime.GetEventSheetManager().scheduledWaits())l.IsSignal()&&l.GetSignalTag()===g&&l.SetSignalled()},async SnapshotCanvas(g,l,m,u,w,q){const t=this._runtime.GetCanvasManager();t&&(this.UpdateRender(),await t.SnapshotCanvas(0===g?"image/png":"image/jpeg",l/100,m,u,w,q),await this._runtime.TriggerAsync(f.Plugins.System.Cnds.OnCanvasSnapshot,
null))},SetCanvasSize(g,l){if(!(0>=g||0>=l)){this._runtime.SetViewportSize(g,l);var m=this._runtime.GetCurrentLayout();m.BoundScrolling();for(const u of m.GetLayers())u.UpdateViewport();if(m=this._runtime.GetCanvasManager())"off"!==m.GetCurrentFullscreenMode()&&this._runtime.SetOriginalViewportSize(g,l),m.SetSize(m.GetLastWidth(),m.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(g){const l=this._runtime.GetCanvasManager();l&&"off"!==l.GetCurrentFullscreenMode()&&(l.SetFullscreenScalingQuality(0!==
g?"high":"low"),l.SetSize(l.GetLastWidth(),l.GetLastHeight(),!0))},SaveState(g){this._runtime.SaveToSlot(g)},LoadState(g){this._runtime.LoadFromSlot(g)},LoadStateJSON(g){this._runtime.LoadFromJsonString(g)},SetHalfFramerateMode(g){},ResetPersisted(){for(const g of this._runtime.GetLayoutManager().GetAllLayouts())g.ResetPersistData()},SetPixelRounding(g){this._runtime.SetPixelRoundingEnabled(0!==g)},SetMinimumFramerate(g){this._runtime.SetMinimumFramerate(g)},SortZOrderByInstVar(g,l){if(g){var m=g.GetCurrentSol().GetInstances(),
u=this._runtime.GetCurrentLayout(),w=g.IsFamily();g=g.GetFamilyIndex();for(let t=0,p=m.length;t<p;++t){var q=m[t];const r=q.GetWorldInfo();if(!r)continue;let x;x=w?q.GetInstanceVariableValue(l+q.GetObjectClass().GetFamilyInstanceVariableOffset(g)):q.GetInstanceVariableValue(l);c.push([r.GetLayer().GetIndex(),r.GetZIndex()]);d.push([q,x])}if(c.length){c.sort(b);d.sort(a);l=!1;for(let t=0,p=c.length;t<p;++t)m=d[t][0],w=u.GetLayerByIndex(c[t][0]),g=c[t][1],q=w._GetInstances(),q[g]!==m&&(q[g]=m,m.GetWorldInfo()._SetLayer(w),
w.SetZIndicesChanged(),l=!0);l&&this._runtime.UpdateRender();f.clearArray(c);f.clearArray(d)}}},GoToLayout(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||l.ChangeMainLayout(g)}},GoToLayoutByName(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||(g=l.GetLayoutByName(g))&&l.ChangeMainLayout(g)}},NextPrevLayout(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();if(!l.IsPendingChangeMainLayout()){var m=
l.GetAllLayouts(),u=m.indexOf(l.GetMainRunningLayout());g&&0===u||(g||u!==m.length-1)&&l.ChangeMainLayout(m[u+(g?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var g=this._runtime.GetLayoutManager();g.IsPendingChangeMainLayout()||(g.ChangeMainLayout(g.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(g,l){g&&g.SetVisible(l)},SetLayerOpacity(g,l){g&&g.SetOpacity(l/100)},SetLayerScale(g,l){g&&g.SetOwnScale(l)},SetLayerScaleRate(g,
l){g&&g.SetScaleRate(l)},SetLayerAngle(g,l){g&&g.SetAngle(f.toRadians(+l))},SetLayerScroll(g,l,m){g&&(g.SetOwnScrollPositionEnabled(!0),g.SetScrollX(l),g.SetScrollY(m))},RestoreLayerScroll(g){g&&g.SetOwnScrollPositionEnabled(!1)},SetLayerParallax(g,l,m){g&&g.SetParallax(l/100,m/100)},SetLayerZElevation(g,l){g&&g.SetZElevation(+l)},SetLayerBackground(g,l){g&&(h.setFromRgbValue(l),h.clamp(),g=g.GetBackgroundColor(),g.equalsIgnoringAlpha(h)||(g.copyRgb(h),this.UpdateRender()))},SetLayerTransparent(g,
l){g&&g.SetTransparent(l)},SetLayerBlendMode(g,l){g&&g.SetBlendMode(l)},SetLayerEffectEnabled(g,l,m){g&&(m=g.GetEffectList().GetEffectTypeByName(m))&&(l=1===l,m.IsActive()!==l&&(m.SetActive(l),g.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(g,l,m,u){if(g&&(g=g.GetEffectList(),l=g.GetEffectTypeByName(l))){var w=l.GetIndex();g=g.GetEffectParametersForIndex(w);m=Math.floor(m);if(!(0>m||m>=g.length)){w=l.GetShaderProgram().GetParameterType(m);if("color"===w){h.setFromRgbValue(u);
m=g[m];if(h.equalsIgnoringAlpha(m))return;m.copyRgb(h)}else{"percent"===w&&(u/=100);if(g[m]===u)return;g[m]=u}l.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(g,l){g&&g.SetForceOwnTexture(l)},SetLayoutScale(g){this._runtime.GetCurrentLayout().SetScale(+g)},SetLayoutAngle(g){this._runtime.GetCurrentLayout().SetAngle(f.toRadians(+g))},SetLayoutEffectEnabled(g,l){const m=this._runtime.GetCurrentLayout();if(l=m.GetEffectList().GetEffectTypeByName(l))g=1===g,l.IsActive()!==g&&(l.SetActive(g),
m.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(g,l,m){var u=this._runtime.GetCurrentLayout().GetEffectList();if(g=u.GetEffectTypeByName(g)){var w=g.GetIndex();u=u.GetEffectParametersForIndex(w);l=Math.floor(l);if(!(0>l||l>=u.length)){w=g.GetShaderProgram().GetParameterType(l);if("color"===w){h.setFromRgbValue(m);l=u[l];if(h.equalsIgnoringAlpha(l))return;l.copyRgb(h)}else{"percent"===w&&(m/=100);if(u[l]===m)return;u[l]=m}g.IsActive()&&this._runtime.UpdateRender()}}},SetLayoutVanishingPoint(g,
l){this._runtime.GetCurrentLayout().SetVanishingPointXY(g/100,l/100)},SetLayoutProjection(g){const l=this._runtime.GetCurrentLayout();0===g?l.SetPerspectiveProjection():l.SetOrthographicProjection()},ScrollX(g){this._runtime.GetCurrentLayout().SetScrollX(g)},ScrollY(g){this._runtime.GetCurrentLayout().SetScrollY(g)},Scroll(g,l){const m=this._runtime.GetCurrentLayout();m.SetScrollX(g);m.SetScrollY(l)},ScrollToObject(g){if(g&&(g=g.GetFirstPicked())&&(g=g.GetWorldInfo())){var l=this._runtime.GetCurrentLayout();
l.SetScrollX(g.GetX());l.SetScrollY(g.GetY())}},async LoadObjectTextures(g){const l=this._runtime.GetMainRunningLayout();l&&g&&!this._runtime.IsLoading()&&(g=g.IsFamily()?g.GetFamilyMembers():[g],await this._LoadTexturesForObjectClasses(l,g))},async LoadObjectTexturesByName(g){await f.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(g))},UnloadObjectTextures(g){const l=this._runtime.GetMainRunningLayout();l&&g&&(g=g.IsFamily()?g.GetFamilyMembers():[g],this._UnloadTexturesForObjectClasses(l,
g))},UnloadObjectTexturesByName(g){f.Plugins.System.Acts.UnloadObjectTextures.call(this,this._runtime.GetObjectClassByName(g))},UnloadUnusedTextures(){const g=this._runtime.GetMainRunningLayout();if(g){var l=g._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(g,l)}},async LoadLayoutTextures(g){const l=this._runtime.GetMainRunningLayout();g&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,g._GetInitialObjectClasses())},async LoadLayoutTexturesByName(g){const l=
this._runtime.GetMainRunningLayout();(g=this._runtime.GetLayoutManager().GetLayoutByName(g))&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,g._GetInitialObjectClasses())},SetFunctionReturnValue(g){const l=this._eventStack.GetCurrentExpFuncStackFrame();if(l)switch(l.GetFunctionReturnType()){case 1:"number"===typeof g&&l.SetFunctionReturnValue(g);break;case 2:"string"===typeof g&&l.SetFunctionReturnValue(g);break;case 3:l.SetFunctionReturnValue(g)}},MapFunction(g,l,m){var u=
this._GetFunctionMap(g.toLowerCase(),!0);const w=u.strMap,q=l.toLowerCase();w.has(q)&&console.warn(`[Construct 3] Function map '${g}' string '${l}' already in map; overwriting entry`);if(u=f.first(w.values())||u.defaultFunc){u=0!==u.GetReturnType();const t=0!==m.GetReturnType();if(u!==t){console.error(`[Construct 3] Function map '${g}' string '${l}' function return type not compatible with other functions in the map; entry ignored`);return}}w.set(q,m)},MapFunctionDefault(g,l){const m=this._GetFunctionMap(g.toLowerCase(),
!0);m.defaultFunc&&console.warn(`[Construct 3] Function map '${g}' already has a default; overwriting entry`);var u=f.first(m.strMap.values())||m.defaultFunc;if(u){u=0!==u.GetReturnType();const w=0!==l.GetReturnType();if(u!==w){console.error(`[Construct 3] Function map '${g}' default: function return type not compatible with other functions in the map; entry ignored`);return}}m.defaultFunc=l},CallMappedFunction(g,l,m){m=Math.floor(m);var u=this._GetFunctionMap(g.toLowerCase(),!1);if(u){var w=u.strMap.get(l.toLowerCase());
if(!w)if(u.defaultFunc)w=u.defaultFunc,m=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${g}' string '${l}'; call ignored (consider setting a default)`);return}if(w.IsEnabled())if(0!==w.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${g}' string '${l}' has a return type so cannot be called`);else{g=this._runtime;l=g.GetEventSheetManager();var q=l.GetCurrentEvent();u=q.GetSolModifiersIncludingParents();var t=0<u.length;t&&l.PushCleanSol(u);
var p=[];if(q=l.FindFirstFunctionBlockParent(q)){q=q.GetFunctionParameters();for(let r=m,x=q.length;r<x;++r)p.push(q[r].GetValue())}m=w.GetFunctionParameters();for(let r=p.length,x=m.length;r<x;++r)p.push(m[r].GetInitialValue());return g.IsDebugging()?this._DebugDoCallMappedFunction(l,w,p,t,u):this._DoCallMappedFunction(l,w,p,t,u)}}else console.warn(`[Construct 3] Call mapped function: map name '${g}' 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)},roundtodp(b,a){a=Math.max(Math.floor(a),0);a=Math.pow(10,a);return Math.round((b+Number.EPSILON)*a)/a},floor(b){return Math.floor(b)},ceil(b){return Math.ceil(b)},sign(b){return Math.sign(b)},sin(b){return Math.sin(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 c=1,d=b.length;c<d;++c){let e=b[c];"number"===typeof e&&a<e&&(a=e)}return a},min(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let c=1,d=b.length;c<d;++c){let e=b[c];"number"===typeof e&&a>e&&(a=e)}return a},clamp(b,a,c){return f.clamp(b,a,c)},distance(b,a,c,d){return f.distanceTo(b,a,c,d)},angle(b,a,c,d){return f.toDegrees(f.angleTo(b,a,c,d))},lerp(b,
a,c){return f.lerp(b,a,c)},unlerp(b,a,c){return f.unlerp(b,a,c)},qarp(b,a,c,d){return f.qarp(b,a,c,d)},cubic(b,a,c,d,e){return f.cubic(b,a,c,d,e)},cosp(b,a,c){return f.cosp(b,a,c)},anglediff(b,a){return f.toDegrees(f.angleDiff(f.toRadians(b),f.toRadians(a)))},anglelerp(b,a,c){return f.toDegrees(f.angleLerp(f.toRadians(b),f.toRadians(a),c))},anglerotate(b,a,c){return f.toDegrees(f.angleRotate(f.toRadians(b),f.toRadians(a),f.toRadians(c)))},setbit(b,a,c){a|=0;return(b|0)&~(1<<a)|(0!==c?1:0)<<a},togglebit(b,
a){return(b|0)^1<<(a|0)},getbit(b,a){return(b|0)&1<<(a|0)?1:0},newline(){return"\n"},uppercase(b){return"string"===typeof b?b.toUpperCase():""},lowercase(b){return"string"===typeof b?b.toLowerCase():""},left(b,a){return"string"===typeof b?b.substr(0,a):""},mid(b,a,c){return"string"!==typeof b?"":0>c?b.substr(a):b.substr(a,c)},right(b,a){return"string"===typeof b?b.substr(Math.max(b.length-a,0)):""},trim(b){return"string"===typeof b?b.trim():""},tokenat(b,a,c){if("string"!==typeof b||"string"!==typeof c)return"";
b=b.split(c);a=Math.floor(a);return 0>a||a>=b.length?"":b[a]},tokencount(b,a){return"string"===typeof b&&"string"===typeof a&&b.length?b.split(a).length:0},find(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(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,c){return"string"===typeof b&&"string"===typeof a&&"string"===typeof c?b.replace(new RegExp(f.EscapeRegex(a),"gi"),c):"string"===
typeof b?b:""},regexsearch(b,a,c){a=this.GetRegex(a,c);return b?b.search(a):-1},regexreplace(b,a,c,d){a=this.GetRegex(a,c);return b?b.replace(a,d):""},regexmatchcount(b,a,c){return(b=this.GetRegexMatches(b.toString(),a,c))?b.length:0},regexmatchat(b,a,c,d){d=Math.floor(d);b=this.GetRegexMatches(b.toString(),a,c);return!b||0>d||d>=b.length?"":b[d]},zeropad(b,a){let c=0>b?"-":"";0>b&&(b=-b);c+="0".repeat(Math.max(a-b.toString().length,0));return c+b.toString()},urlencode(b){return encodeURIComponent(b)},
urldecode(b){return decodeURIComponent(b)},dt(){return this._runtime._GetDtFast()},timescale(){return this._runtime.GetTimeScale()},wallclocktime(){return(Date.now()-this._runtime.GetStartTime())/1E3},unixtime(){return Date.now()},time(){return this._runtime.GetGameTime()},tickcount(){return this._runtime.GetTickCount()},objectcount(){return this._runtime.GetObjectCount()},fps(){return this._runtime.GetFPS()},cpuutilisation(){return this._runtime.GetMainThreadTime()},gpuutilisation(){return this._runtime.GetGPUUtilisation()},
windowwidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()},windowheight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},originalwindowwidth(){return this._runtime.GetOriginalViewportWidth()},originalwindowheight(){return this._runtime.GetOriginalViewportHeight()},originalviewportwidth(){return this._runtime.GetOriginalViewportWidth()},originalviewportheight(){return this._runtime.GetOriginalViewportHeight()},scrollx(){return this._runtime.GetCurrentLayout().GetScrollX()},
scrolly(){return this._runtime.GetCurrentLayout().GetScrollY()},layoutname(){return this._runtime.GetCurrentLayout().GetName()},layoutscale(){return this._runtime.GetCurrentLayout().GetScale()},layoutangle(){return 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.GetViewport3D().getLeft():
0},viewporttop(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getTop():0},viewportright(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getRight():0},viewportbottom(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getBottom():0},viewportwidth(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().width():0},viewportheight(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().height():
0},canvastolayerx(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,c)[0]:0},canvastolayery(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,c)[1]:0},layertocanvasx(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,c)[0]:0},layertocanvasy(b,a,c){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,c)[1]:0},layerscale(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetOwnScale():
0},layerangle(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?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},layerscrollx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScrollX():0},layerscrolly(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScrollY():0},layerparallaxx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?
100*b.GetParallaxX():0},layerparallaxy(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetParallaxY():0},layerzelevation(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetZElevation():0},layerindex(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetIndex():-1},canvassnapshot(){const b=this._runtime.GetCanvasManager();return b?b.GetCanvasSnapshotUrl():""},loopindex(b){const a=this._loopStack;return a.IsInLoop()?b?(b=a.FindByName(b))?b.GetIndex():0:a.GetCurrent().GetIndex():
0},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(b,a,...c){var d=this._GetFunctionMap(b.toLowerCase(),!1);if(!d)return console.warn(`[Construct 3] Call mapped function: map name '${b}' not found; returning 0`),0;var e=d.strMap.get(a.toLowerCase());if(!e)if(d.defaultFunc)e=d.defaultFunc;else return console.warn(`[Construct 3] Call mapped function: no function associated with map '${b}' string '${a}'; returning 0 (consider setting a default)`),0;d=e.GetReturnType();const h=
e.GetDefaultReturnValue();if(0===d)return console.warn(`[Construct 3] Call mapped function: map '${b}' string '${a}' has no return type so cannot be called from an expression; returning 0`),0;if(!e.IsEnabled())return h;b=this._runtime.GetEventSheetManager();a=b.GetCurrentEvent().GetSolModifiersIncludingParents();const g=0<a.length;g&&b.PushCleanSol(a);const l=e.GetFunctionParameters();for(let m=c.length,u=l.length;m<u;++m)c.push(l[m].GetInitialValue());e=e.GetEventBlock();c=e.RunAsExpressionFunctionCall(e.GetSolModifiersIncludingParents(),
d,h,...c);g&&b.PopSol(a);return c},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return this._runtime.GetWebGPURenderer()?"webgpu":"webgl"},rendererdetail(){return this._runtime.GetWebGPURenderer()?"<unavailable>":this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let b=this._runtime.GetRenderer().GetEstimatedTextureMemoryUsage();
return Math.round(100*b/1048576)/100},rgb(b,a,c){return f.PackRGB(b,a,c)},rgbex(b,a,c){return f.PackRGBEx(b/100,a/100,c/100)},rgba(b,a,c,d){return f.PackRGBAEx(b/100,a/100,c/100,d/100)},rgbex255(b,a,c){return f.PackRGBEx(b/255,a/255,c/255)},rgba255(b,a,c,d){return f.PackRGBAEx(b/255,a/255,c/255,d/255)},projectname(){return this._runtime.GetProjectName()},projectversion(){return this._runtime.GetProjectVersion()},currenteventsheetname(){return this._runtime.GetCurrentEvent().GetEventSheet().GetName()},
currenteventnumber(){return this._runtime.GetCurrentEvent().GetDisplayNumber()}}}{"use strict";const f=self.C3;f.Plugins.Keyboard=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const f=self.C3;f.Plugins.Keyboard.Type=class extends f.SDKTypeBase{constructor(c){super(c)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let b=null;function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class extends self.IObjectClass{constructor(c){super(c);b=c;c.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(c){const d=a();if("string"===typeof c)return d.IsKeyDown(c);if("number"===
typeof c)return d.IsKeyCodeDown(c);throw new TypeError("expected string or number");}}}
{"use strict";const f=self.C3;f.Plugins.Keyboard.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b);this._keysDownByString=new Set;this._keysDownByWhich=new Set;this._triggerWhich=0;this._triggerTypedKey=this._triggerString="";b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"keydown",c=>this._OnKeyDown(c.data)),f.Disposable.From(b,"keyup",c=>this._OnKeyUp(c.data)),f.Disposable.From(b,"window-blur",()=>this._OnWindowOrKeyboardBlur()),
f.Disposable.From(b,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}Release(){super.Release()}_OnKeyDown(b){const a=b.which,c=b.code||a.toString();b=b.key;this._keysDownByString.has(c)||(this._keysDownByString.add(c),this._keysDownByWhich.add(a),this._triggerString=c,this._triggerWhich=a,this._triggerTypedKey=b,this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKey),this.Trigger(f.Plugins.Keyboard.Cnds.OnKey),this.Trigger(f.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed),this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCode))}_OnKeyUp(b){const a=
b.which,c=b.code||a.toString();b=b.key;this._keysDownByString.delete(c);this._keysDownByWhich.delete(a);this._triggerString=c;this._triggerWhich=a;this._triggerTypedKey=b;this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased);this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowOrKeyboardBlur(){for(const b of this._keysDownByWhich)this._keysDownByWhich.delete(b),this._triggerWhich=
b,this.Trigger(f.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyReleased),this.Trigger(f.Plugins.Keyboard.Cnds.OnKeyCodeReleased);this._keysDownByString.clear()}IsKeyDown(b){return this._keysDownByString.has(b)}IsKeyCodeDown(b){return this._keysDownByWhich.has(b)}SaveToJson(){return{tk:this._triggerWhich,tkk:this._triggerTypedKey}}LoadFromJson(b){this._triggerWhich=b.tk;b.hasOwnProperty("tkk")&&(this._triggerTypedKey=b.tkk)}GetDebuggerProperties(){return[{title:"plugins.keyboard.name",
properties:[{name:"plugins.keyboard.debugger.last-key-code",value:this._triggerWhich},{name:"plugins.keyboard.debugger.last-key-string",value:f.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:"plugins.keyboard.debugger.last-typed-key",value:this._triggerTypedKey}]}]}}}
{"use strict";const f="ShiftLeft ShiftRight ControlLeft ControlRight AltLeft AltRight MetaLeft MetaRight".split(" ");self.C3.Plugins.Keyboard.Cnds={IsKeyDown(b){return this._keysDownByWhich.has(b)},OnKey(b){return this._triggerWhich===b},OnAnyKey(){return!0},OnAnyKeyReleased(){return!0},OnKeyReleased(b){return this._triggerWhich===b},IsKeyCodeDown(b){b=Math.floor(b);return this._keysDownByWhich.has(b)},OnKeyCode(b){return this._triggerWhich===b},OnKeyCodeReleased(b){return this._triggerWhich===b},
OnLeftRightKeyPressed(b){return this._triggerString===f[b]},OnLeftRightKeyReleased(b){return this._triggerString===f[b]},IsLeftRightKeyDown(b){return this._keysDownByString.has(f[b])}}}"use strict";self.C3.Plugins.Keyboard.Acts={};
{"use strict";function f(b){b=Math.floor(b);switch(b){case 8:return"backspace";case 9:return"tab";case 13:return"enter";case 16:return"shift";case 17:return"control";case 18:return"alt";case 19:return"pause";case 20:return"capslock";case 27:return"esc";case 33:return"pageup";case 34:return"pagedown";case 35:return"end";case 36:return"home";case 37:return"\u2190";case 38:return"\u2191";case 39:return"\u2192";case 40:return"\u2193";case 45:return"insert";case 46:return"del";case 91:return"left window key";
case 92:return"right window key";case 93:return"select";case 96:return"numpad 0";case 97:return"numpad 1";case 98:return"numpad 2";case 99:return"numpad 3";case 100:return"numpad 4";case 101:return"numpad 5";case 102:return"numpad 6";case 103:return"numpad 7";case 104:return"numpad 8";case 105:return"numpad 9";case 106:return"numpad *";case 107:return"numpad +";case 109:return"numpad -";case 110:return"numpad .";case 111:return"numpad /";case 112:return"F1";case 113:return"F2";case 114:return"F3";
case 115:return"F4";case 116:return"F5";case 117:return"F6";case 118:return"F7";case 119:return"F8";case 120:return"F9";case 121:return"F10";case 122:return"F11";case 123:return"F12";case 144:return"numlock";case 145:return"scroll lock";case 186:return";";case 187:return"=";case 188:return",";case 189:return"-";case 190:return".";case 191:return"/";case 192:return"'";case 219:return"[";case 220:return"\\";case 221:return"]";case 222:return"#";case 223:return"`";default:return String.fromCharCode(b)}}
self.C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode(b){return f(b)},TypedKey(){return this._triggerTypedKey}}}{"use strict";const f=self.C3;f.Plugins.Touch=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const f=self.C3,b=self.C3X;f.Plugins.Touch.Type=class extends f.SDKTypeBase{constructor(d){super(d)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.ITouchObjectType}};let a=null;function c(){return a.GetSingleGlobalInstance().GetSdkInstance()}self.ITouchObjectType=class extends self.IObjectClass{constructor(d){super(d);a=d;d.GetRuntime()._GetCommonScriptInterfaces().touch=this}requestPermission(d){b.RequireString(d);const e=c();if("orientation"===d)return e._RequestPermission(0);
if("motion"===d)return e._RequestPermission(1);throw Error("invalid type");}}}
{"use strict";const f=self.C3;f.Plugins.Touch.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b,"touch");this._touches=new Map;this._isMouseDown=this._useMouseInput=!1;this._getTouchIndex=this._curTouchY=this._curTouchX=this._triggerPermission=this._triggerId=this._triggerIndex=this._accWithGZ=this._accWithGY=this._accWithGX=this._accZ=this._accY=this._accX=this._orientGamma=this._orientBeta=this._orientAlpha=this._orientCompassHeading=0;this._permissionPromises=[];a&&(this._useMouseInput=
a[0]);this.AddDOMMessageHandler("permission-result",c=>this._OnPermissionResult(c));b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"pointerdown",c=>this._OnPointerDown(c.data)),f.Disposable.From(b,"pointermove",c=>this._OnPointerMove(c.data)),f.Disposable.From(b,"pointerup",c=>this._OnPointerUp(c.data,!1)),f.Disposable.From(b,"pointercancel",c=>this._OnPointerUp(c.data,!0)),f.Disposable.From(b,"deviceorientation",c=>this._OnDeviceOrientation(c.data)),
f.Disposable.From(b,"deviceorientationabsolute",c=>this._OnDeviceOrientationAbsolute(c.data)),f.Disposable.From(b,"devicemotion",c=>this._OnDeviceMotion(c.data)),f.Disposable.From(b,"tick2",c=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(b){if("mouse"===b.pointerType)if(this._useMouseInput)this._isMouseDown=!0;else return;const a=b.pointerId;if(!this._touches.has(a)){var c=b.pageX-this._runtime.GetCanvasClientX();b=b.pageY-this._runtime.GetCanvasClientY();var d=
performance.now(),e=this._touches.size;this._triggerIndex=e;this._triggerId=a;var h=f.New(f.Plugins.Touch.TouchInfo);h.Init(d,c,b,a,e);this._touches.set(a,h);this.Trigger(f.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(f.Plugins.Touch.Cnds.OnTouchStart);this._curTouchX=c;this._curTouchY=b;this.Trigger(f.Plugins.Touch.Cnds.OnTouchObject)}}_OnPointerMove(b){if("mouse"!==b.pointerType||this._isMouseDown){var a=this._touches.get(b.pointerId);if(a){var c=performance.now();if(!(2>c-a.GetTime())){var d=
b.pageX-this._runtime.GetCanvasClientX(),e=b.pageY-this._runtime.GetCanvasClientY();a.Update(c,d,e,b.width,b.height,b.pressure)}}}}_OnPointerUp(b,a){if("mouse"===b.pointerType)if(this._isMouseDown)this._isMouseDown=!1;else return;const c=performance.now();b=b.pointerId;const d=this._touches.get(b);d&&(this._triggerIndex=d.GetStartIndex(),this._triggerId=d.GetId(),this.Trigger(f.Plugins.Touch.Cnds.OnNthTouchEnd),this.Trigger(f.Plugins.Touch.Cnds.OnTouchEnd),a||(a=d.ShouldTriggerTap(c),"single-tap"===
a?(this.Trigger(f.Plugins.Touch.Cnds.OnTapGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnTapGestureObject)):"double-tap"===a&&(this.Trigger(f.Plugins.Touch.Cnds.OnDoubleTapGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnDoubleTapGestureObject))),d.Release(),this._touches.delete(b))}_RequestPermission(b){this._PostToDOMMaybeSync("request-permission",{type:b});return new Promise((a,c)=>{this._permissionPromises.push({type:b,
resolve:a,reject:c})})}_OnPermissionResult(b){const a=b.result,c=b.type;this._triggerPermission=c;b=this._permissionPromises.filter(d=>d.type===c);for(const d of b)d.resolve(a?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(d=>d.type!==c);a?(this.Trigger(f.Plugins.Touch.Cnds.OnPermissionGranted),0===c?this._runtime.RequestDeviceOrientationEvent():this._runtime.RequestDeviceMotionEvent()):this.Trigger(f.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(b){"number"===
typeof b.webkitCompassHeading?this._orientCompassHeading=b.webkitCompassHeading:b.absolute&&(this._orientCompassHeading=b.alpha);this._orientAlpha=b.alpha;this._orientBeta=b.beta;this._orientGamma=b.gamma}_OnDeviceOrientationAbsolute(b){this._orientCompassHeading=b.alpha}_OnDeviceMotion(b){const a=b.acceleration;a&&(this._accX=a.x,this._accY=a.y,this._accZ=a.z);if(b=b.accelerationIncludingGravity)this._accWithGX=b.x,this._accWithGY=b.y,this._accWithGZ=b.z}_OnTick2(){const b=performance.now();let a=
0;for(const c of this._touches.values())c.GetTime()<=b-50&&c._SetLastTime(b),c.ShouldTriggerHold(b)&&(this._triggerIndex=c.GetStartIndex(),this._triggerId=c.GetId(),this._getTouchIndex=a,this.Trigger(f.Plugins.Touch.Cnds.OnHoldGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(f.Plugins.Touch.Cnds.OnHoldGestureObject),this._getTouchIndex=0),++a}_GetTouchByIndex(b){b=Math.floor(b);for(const a of this._touches.values()){if(0===b)return a;--b}return null}_IsClientPosOnCanvas(b,a){return 0<=
b&&0<=a&&b<this._runtime.GetCanvasCssWidth()&&a<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.touch.debugger.touches",properties:[...this._touches.values()].map(b=>({name:"$"+b.GetId(),value:b.GetX()+", "+b.GetY()}))}]}}}
{"use strict";const f=self.C3,b=[];f.Plugins.Touch.Cnds={OnTouchStart(){return!0},OnTouchEnd(){return!0},IsInTouch(){return 0<this._touches.size},OnTouchObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},IsTouchingObject(a){if(!a)return!1;const c=a.GetCurrentSol();var d=c.GetInstances();for(const e of d){d=e.GetWorldInfo();const h=d.GetLayer();for(const g of this._touches.values()){if(!this._IsClientPosOnCanvas(g.GetX(),
g.GetY()))continue;const [l,m]=h.CanvasCssToLayer(g.GetX(),g.GetY(),d.GetTotalZElevation());if(d.ContainsPoint(l,m)){b.push(e);break}}}return b.length?(c.SetArrayPicked(b),a.ApplySolToContainer(),f.clearArray(b),!0):!1},CompareTouchSpeed(a,c,d){return(a=this._GetTouchByIndex(a))?f.compare(a.GetSpeed(),c,d):!1},OrientationSupported(){return!0},MotionSupported(){return!0},CompareOrientation(a,c,d){this._runtime.RequestDeviceOrientationEvent();return f.compare(0===a?this._orientAlpha:1===a?this._orientBeta:
this._orientGamma,c,d)},CompareAcceleration(a,c,d){this._runtime.RequestDeviceMotionEvent();return f.compare(0===a?this._accWithGX:1===a?this._accWithGY:2===a?this._accWithGZ:3===a?this._accX:4===a?this._accY:this._accZ,c,d)},OnNthTouchStart(a){a=Math.floor(a);return a===this._triggerIndex},OnNthTouchEnd(a){a=Math.floor(a);return a===this._triggerIndex},HasNthTouch(a){a=Math.floor(a);return this._touches.size>=a+1},OnHoldGesture(){return!0},OnTapGesture(){return!0},OnDoubleTapGesture(){return!0},
OnHoldGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnTapGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnDoubleTapGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,
this._curTouchX,this._curTouchY,!1):!1},OnPermissionGranted(a){return this._triggerPermission===a},OnPermissionDenied(a){return this._triggerPermission===a}}}"use strict";self.C3.Plugins.Touch.Acts={RequestPermission(f){this._RequestPermission(f)}};
{"use strict";const f=self.C3;f.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(b){const a=this._GetTouchByIndex(this._getTouchIndex);return a?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!0):0},Y(b){const a=this._GetTouchByIndex(this._getTouchIndex);return a?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!1):0},XAt(b,a){return(b=this._GetTouchByIndex(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},YAt(b,a){return(b=this._GetTouchByIndex(b))?
b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},XForID(b,a){return(b=this._touches.get(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},YForID(b,a){return(b=this._touches.get(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},AbsoluteX(){const b=this._GetTouchByIndex(0);return b?b.GetX():0},AbsoluteY(){const b=this._GetTouchByIndex(0);return b?b.GetY():0},AbsoluteXAt(b){return(b=this._GetTouchByIndex(b))?b.GetX():0},AbsoluteYAt(b){return(b=this._GetTouchByIndex(b))?
b.GetY():0},AbsoluteXForID(b){return(b=this._touches.get(b))?b.GetX():0},AbsoluteYForID(b){return(b=this._touches.get(b))?b.GetY():0},SpeedAt(b){return(b=this._GetTouchByIndex(b))?b.GetSpeed():0},SpeedForID(b){return(b=this._touches.get(b))?b.GetSpeed():0},AngleAt(b){return(b=this._GetTouchByIndex(b))?f.toDegrees(b.GetAngle()):0},AngleForID(b){return(b=this._touches.get(b))?f.toDegrees(b.GetAngle()):0},CompassHeading(){this._runtime.RequestDeviceOrientationEvent();return this._orientCompassHeading},
Alpha(){this._runtime.RequestDeviceOrientationEvent();return this._orientAlpha},Beta(){this._runtime.RequestDeviceOrientationEvent();return this._orientBeta},Gamma(){this._runtime.RequestDeviceOrientationEvent();return this._orientGamma},AccelerationXWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGX},AccelerationYWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGY},AccelerationZWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGZ},AccelerationX(){this._runtime.RequestDeviceMotionEvent();
return this._accX},AccelerationY(){this._runtime.RequestDeviceMotionEvent();return this._accY},AccelerationZ(){this._runtime.RequestDeviceMotionEvent();return this._accZ},TouchIndex(){return this._triggerIndex},TouchID(){return this._triggerId},WidthForID(b){return(b=this._touches.get(b))?b.GetWidth():0},HeightForID(b){return(b=this._touches.get(b))?b.GetHeight():0},PressureForID(b){return(b=this._touches.get(b))?b.GetPressure():0}}}
{"use strict";const f=self.C3;let b=-1E3,a=-1E3,c=-1E4;f.Plugins.Touch.TouchInfo=class extends f.DefendedBase{constructor(){super();this._pressure=this._height=this._width=this._lastY=this._lastX=this._y=this._x=this._startY=this._startX=this._lastTime=this._time=this._startTime=this._startIndex=this._pointerId=0;this._isTooFarForHold=this._hasTriggeredHold=!1}Release(){}Init(d,e,h,g,l){this._pointerId=g;this._startIndex=l;this._startTime=this._lastTime=this._time=d;this._startX=e;this._startY=h;
this._x=e;this._y=h;this._lastX=e;this._lastY=h}Update(d,e,h,g,l,m){this._lastTime=this._time;this._time=d;this._lastX=this._x;this._lastY=this._y;this._x=e;this._y=h;this._width=g;this._height=l;this._pressure=m;!this._isTooFarForHold&&15<=f.distanceTo(this._startX,this._startY,this._x,this._y)&&(this._isTooFarForHold=!0)}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(d){this._lastTime=d}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const d=
f.distanceTo(this._x,this._y,this._lastX,this._lastY),e=(this._time-this._lastTime)/1E3;return 0<e?d/e:0}GetAngle(){return f.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(d){return this._hasTriggeredHold?!1:500<=d-this._startTime&&!this._isTooFarForHold&&15>f.distanceTo(this._startX,this._startY,this._x,this._y)?this._hasTriggeredHold=!0:!1}ShouldTriggerTap(d){if(this._hasTriggeredHold)return"";
if(333>=d-this._startTime&&!this._isTooFarForHold&&15>f.distanceTo(this._startX,this._startY,this._x,this._y)){if(666>=d-c&&25>f.distanceTo(b,a,this._x,this._y))return a=b=-1E3,c=-1E4,"double-tap";b=this._x;a=this._y;c=d;return"single-tap"}return""}GetPositionForLayer(d,e,h){return"undefined"===typeof e?d.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(this._x,this._y)[h?0:1]:(d=d.GetLayer(e))?d.CanvasCssToLayer(this._x,this._y)[h?0:1]:0}}}{"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,c){super(a,"audio");this._nextPlayTime=0;this._triggerTag="";this._saveLoadMode=this._timeScaleMode=0;this._playInBackground=!1;this._distanceModel=this._panningModel=1;this._listenerX=this._runtime.GetViewportWidth()/2;this._listenerY=this._runtime.GetViewportHeight()/2;this._listenerZ=-600;this._referenceDistance=600;this._maxDistance=1E4;this._rolloffFactor=
1;this._listenerInst=null;this._loadListenerUid=-1;this._masterVolume=1;this._isSilent=!1;this._sampleRate=0;this._effectCount=new Map;this._preloadCount=this._preloadTotal=0;this._remoteUrls=new Map;a="interactive";c&&(this._timeScaleMode=c[0],this._saveLoadMode=c[1],this._playInBackground=c[2],a=b[c[3]],this._panningModel=c[4],this._distanceModel=c[5],this._listenerZ=-c[6],this._referenceDistance=c[7],this._maxDistance=c[8],this._rolloffFactor=c[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=
[];this.AddDOMMessageHandlers([["state",d=>this._OnUpdateState(d)],["fxstate",d=>this._OnUpdateFxState(d)],["trigger",d=>this._OnTrigger(d)]]);c=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(c,"instancedestroy",d=>this._OnInstanceDestroyed(d.instance)),f.Disposable.From(c,"afterload",()=>this._OnAfterLoad()),f.Disposable.From(c,"suspend",()=>this._OnSuspend()),f.Disposable.From(c,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",
{preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(d=>({originalUrl:d.originalUrl,url:d.url,type:d.type,fileSize:d.fileSize})),isiOSCordova:this._runtime.IsiOSCordova(),timeScaleMode:this._timeScaleMode,latencyHint:a,panningModel:this._panningModel,distanceModel:this._distanceModel,refDistance:this._referenceDistance,maxDistance:this._maxDistance,rolloffFactor:this._rolloffFactor,listenerPos:[this._listenerX,this._listenerY,this._listenerZ]}).then(d=>{this._sampleRate=d.sampleRate}));
this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_OnInstanceDestroyed(a){this._listenerInst===a&&(this._listenerInst=null)}DbToLinearNoCap(a){return Math.pow(10,a/20)}DbToLinear(a){a=this.DbToLinearNoCap(a);return isFinite(a)?Math.max(Math.min(a,1),0):0}LinearToDbNoCap(a){return Math.log(a)/Math.log(10)*20}LinearToDb(a){return this.LinearToDbNoCap(Math.max(Math.min(a,1),0))}_OnSuspend(){this._playInBackground||this.PostToDOM("set-suspended",{isSuspended:!0})}_OnResume(){this._playInBackground||
this.PostToDOM("set-suspended",{isSuspended:!1})}_OnUpdateState(a){const c=a.tickCount,d=this._lastAIState.filter(e=>e.hasOwnProperty("placeholder")&&(e.placeholder>c||-1===e.placeholder));this._lastAIState=a.audioInstances;this._lastAnalysersData=a.analysers;0<d.length&&f.appendArray(this._lastAIState,d)}_OnUpdateFxState(a){this._lastFxState=a.fxstate}_GetFirstAudioStateByTag(a){for(const c of this._lastAIState)if(f.equalsNoCase(c.tag,a))return c;return null}_IsTagPlaying(a){return this._lastAIState.some(c=>
f.equalsNoCase(a,c.tag)&&c.isPlaying)}_MaybeMarkAsPlaying(a,c,d,e){if(this._IsTagPlaying(a))return null;a={tag:a,duration:0,volume:e,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:c,isLooping:d,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(a);return a}async _OnTrigger(a){const c=a.type;this._triggerTag=a.tag;a=a.aiid;if("ended"===c){for(const d of this._lastAIState)if(d.aiid===a){d.isPlaying=!1;break}await this.TriggerAsync(f.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"===
c&&await this.TriggerAsync(f.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const a={timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),instPans:this.GetInstancePans(),tickCount:this._runtime.GetTickCountNoSave()};if(this._listenerInst){const c=this._listenerInst.GetWorldInfo();this._listenerX=c.GetX();this._listenerY=c.GetY();a.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(a,c,d,e,h){if(0===d)return[a,c];const g=Math.sin(d);
d=Math.cos(d);a-=e;c-=h;const l=a*g;a=a*d-c*g;return[a+e,c*d+l+h]}GetInstancePans(){return this._lastAIState.filter(a=>-1!==a.uid).map(a=>this._runtime.GetInstanceByUID(a.uid)).filter(a=>a).map(a=>{const c=a.GetWorldInfo(),d=c.GetLayer().GetAngle(),[e,h]=this.rotatePtAround(c.GetX(),c.GetY(),-d,this._listenerX,this._listenerY);return{uid:a.GetUID(),x:e,y:h,angle:c.GetAngle()-d}})}GetAnalyserData(a,c){for(const d of this._lastAnalysersData)if(d.index===c&&f.equalsNoCase(d.tag,a))return d;return null}_IncrementEffectCount(a){this._effectCount.set(a,
(this._effectCount.get(a)||0)+1)}_ShouldSave(a){return a.hasOwnProperty("placeholder")||3===this._saveLoadMode?!1:a.isMusic&&1===this._saveLoadMode?!1:a.isMusic||2!==this._saveLoadMode?!0:!1}SaveToJson(){return{isSilent:this._isSilent,masterVolume:this._masterVolume,listenerZ:this._listenerZ,listenerUid:this._listenerInst?this._listenerInst.GetUID():-1,remoteUrls:[...this._remoteUrls.entries()],playing:this._lastAIState.filter(a=>this._ShouldSave(a)),effects:this._lastFxState,analysers:this._lastAnalysersData}}LoadFromJson(a){this._isSilent=
a.isSilent;this._masterVolume=a.masterVolume;this._listenerZ=a.listenerZ;this._listenerInst=null;this._loadListenerUid=a.listenerUid;this._remoteUrls.clear();if(a.remoteUrls)for(const [c,d]of a.remoteUrls)this._remoteUrls.set(c,d);this._lastAIState=a.playing;this._lastFxState=a.effects;this._lastAnalysersData=a.analysers}_OnAfterLoad(){if(-1!==this._loadListenerUid&&(this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid),this._loadListenerUid=-1,this._listenerInst)){var a=this._listenerInst.GetWorldInfo();
this._listenerX=a.GetX();this._listenerY=a.GetY()}for(var c of this._lastAIState)(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c.bufferOriginalUrl))?(c.bufferUrl=a.url,c.bufferType=a.type):c.bufferUrl=null;for(const d of Object.values(this._lastFxState))for(const e of d)e.hasOwnProperty("bufferOriginalUrl")&&(c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e.bufferOriginalUrl))&&(e.bufferUrl=c.url,e.bufferType=c.type);this.PostToDOM("load-state",{saveLoadMode:this._saveLoadMode,
timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),listenerPos:[this._listenerX,this._listenerY,this._listenerZ],isSilent:this._isSilent,masterVolume:this._masterVolume,playing:this._lastAIState.filter(d=>null!==d.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const a=[];for(const [c,d]of Object.entries(this._lastFxState))a.push({name:"$"+c,value:d.map(e=>e.type).join(", ")});return[{title:"plugins.audio.debugger.tag-effects",properties:a},{title:"plugins.audio.debugger.currently-playing",
properties:[{name:"plugins.audio.debugger.currently-playing-count",value:this._lastAIState.length},...this._lastAIState.map((c,d)=>({name:"$#"+d,value:`${c.bufferOriginalUrl} ("${c.tag}") ${Math.round(10*c.playbackTime)/10} / ${Math.round(10*c.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,c,d,e,h){if(!this._isSilent){var g=a[1],l=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(l){h=h?h:0;var m=this._nextPlayTime;this._nextPlayTime=0;var u=this._MaybeMarkAsPlaying(e.toLowerCase(),g,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:l.url,type:l.type,isMusic:g,tag:e.toLowerCase(),isLooping:0!==
c,vol:this.DbToLinear(d),pos:h,off:m,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{u&&(u.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,c,d,e,h,g,l,m,u,w){if(!this._isSilent){var q=a[1],t=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(t){var p=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(w.toLowerCase(),q,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:t.url,type:t.type,isMusic:q,
tag:w.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:p,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:e,y:h,angle:f.toRadians(g),innerAngle:f.toRadians(l),outerAngle:f.toRadians(m),outerGain:this.DbToLinear(u)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,c,d,e,h,g,l,m){if(!this._isSilent&&e&&(e=e.GetFirstPicked())&&e.GetWorldInfo()){var u=e.GetWorldInfo(),w=u.GetLayer().GetAngle(),[q,t]=this.rotatePtAround(u.GetX(),u.GetY(),-w,
this._listenerX,this._listenerY),p=a[1],r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(r){var x=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(m.toLowerCase(),p,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:r.url,type:r.type,isMusic:p,tag:m.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(d),pos:0,off:x,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:q,y:t,angle:u.GetAngle()-w,innerAngle:f.toRadians(h),outerAngle:f.toRadians(g),
outerGain:this.DbToLinear(l),uid:e.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(a,c,d,e,h){if(!this._isSilent){a=1===a;var g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(g){var l=this._nextPlayTime;this._nextPlayTime=0;var m=this._MaybeMarkAsPlaying(h.toLowerCase(),a,0!==d,this.DbToLinear(e));try{await this.PostToDOMAsync("play",{originalUrl:c,url:g.url,type:g.type,isMusic:a,tag:h.toLowerCase(),
isLooping:0!==d,vol:this.DbToLinear(e),pos:0,off:l,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{m&&(m.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,c,d,e,h,g,l,m,u,w,q){if(!this._isSilent){a=1===a;var t=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(t){var p=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(q.toLowerCase(),a,0!==d,this.DbToLinear(e));try{await this.PostToDOMAsync("play",
{originalUrl:c,url:t.url,type:t.type,isMusic:a,tag:q.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(e),pos:0,off:p,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:h,y:g,angle:f.toRadians(l),innerAngle:f.toRadians(m),outerAngle:f.toRadians(u),outerGain:this.DbToLinear(w)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,c,d,e,h,g,l,m,u){if(!this._isSilent&&!this._isSilent&&h&&(h=h.GetFirstPicked())&&h.GetWorldInfo()){var w=h.GetWorldInfo(),
q=w.GetLayer().GetAngle(),[t,p]=this.rotatePtAround(w.GetX(),w.GetY(),-q,this._listenerX,this._listenerY);a=1===a;var r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());if(r){var x=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(u.toLowerCase(),a,0!==d,this.DbToLinear(e));try{await this.PostToDOMAsync("play",{originalUrl:c,url:r.url,type:r.type,isMusic:a,tag:u.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(e),pos:0,off:x,trueClock:!!self.C3_GetAudioContextCurrentTime,
panning:{x:t,y:p,angle:w.GetAngle()-q,innerAngle:f.toRadians(g),outerAngle:f.toRadians(l),outerGain:this.DbToLinear(m),uid:h.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},SetLooping(a,c){this.PostToDOM("set-looping",{tag:a.toLowerCase(),isLooping:0===c})},SetMuted(a,c){this.PostToDOM("set-muted",{tag:a.toLowerCase(),isMuted:0===c})},SetVolume(a,c){this.PostToDOM("set-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(c)})},FadeVolume(a,c,d,e){this.PostToDOM("fade-volume",
{tag:a.toLowerCase(),vol:this.DbToLinear(c),duration:d,stopOnEnd:0===e})},async Preload(a){const c=a[1],d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);d&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:a[0],url:d.url,type:d.type,isMusic:c}),this._preloadCount++)},async PreloadByName(a,c){a=1===a;const d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase());d&&(this._preloadTotal++,await this.PostToDOMAsync("preload",
{originalUrl:c,url:d.url,type:d.type,isMusic:a}),this._preloadCount++)},SetPlaybackRate(a,c){this.PostToDOM("set-playback-rate",{tag:a.toLowerCase(),rate:Math.max(c,0)})},Stop(a){this.PostToDOM("stop",{tag:a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,c){this.PostToDOM("set-paused",{tag:a.toLowerCase(),paused:0===c})},Seek(a,c){this.PostToDOM("seek",{tag:a.toLowerCase(),pos:c})},SetSilent(a){2===a&&(a=this._isSilent?1:0);a=0===a;this._isSilent!==a&&(this._isSilent=a,this.PostToDOM("set-silent",
{isSilent:a}))},SetMasterVolume(a){a=this.DbToLinear(a);this._masterVolume!==a&&(this._masterVolume=a,this.PostToDOM("set-master-volume",{vol:a}))},AddFilterEffect(a,c,d,e,h,g,l){a=a.toLowerCase();c=b[c];this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"filter",tag:a,params:[c,d,e,h,g,f.clamp(l/100,0,1)]})},AddDelayEffect(a,c,d,e){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"delay",tag:a,params:[c,this.DbToLinear(d),f.clamp(e/100,0,1)]})},AddFlangerEffect(a,
c,d,e,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"flanger",tag:a,params:[c/1E3,d/1E3,e,h/100,f.clamp(g/100,0,1)]})},AddPhaserEffect(a,c,d,e,h,g,l){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"phaser",tag:a,params:[c,d,e,h,g,f.clamp(l/100,0,1)]})},AddConvolutionEffect(a,c,d,e){a=a.toLowerCase();const h=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c[0]);h&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect",
{type:"convolution",tag:a,bufferOriginalUrl:c[0],bufferUrl:h.url,bufferType:h.type,params:[0===d,f.clamp(e/100,0,1)]}))},AddGainEffect(a,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[this.DbToLinear(c)]})},AddMuteEffect(a){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[0]})},AddTremoloEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"tremolo",
tag:a,params:[c,f.clamp(d/100,0,1)]})},AddRingModEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"ringmod",tag:a,params:[c,f.clamp(d/100,0,1)]})},AddDistortionEffect(a,c,d,e,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"distortion",tag:a,params:[this.DbToLinearNoCap(c),this.DbToLinearNoCap(d),e,this.DbToLinearNoCap(h),f.clamp(g/100,0,1)]})},AddCompressorEffect(a,c,d,e,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);
this.PostToDOM("add-effect",{type:"compressor",tag:a,params:[c,d,e,h/1E3,g/1E3]})},AddAnalyserEffect(a,c,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"analyser",tag:a,params:[c,d]})},RemoveEffects(a){a=a.toLowerCase();this._effectCount.set(a,0);this.PostToDOM("remove-effects",{tag:a});this._lastFxState={}},SetEffectParameter(a,c,d,e,h,g){this.PostToDOM("set-effect-param",{tag:a.toLowerCase(),index:Math.floor(c),param:d,value:e,ramp:h,time:g})},SetListenerObject(a){a&&
(a=a.GetFirstPicked())&&a.GetWorldInfo()&&(this._listenerInst=a)},SetListenerZ(a){this._listenerZ=a},ScheduleNextPlay(a){this._nextPlayTime=Math.max(a,0)},UnloadAudio(a){const c=a[1];(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]))&&this.PostToDOM("unload",{url:a.url,type:a.type,isMusic:c})},UnloadAudioByName(a,c){a=1===a;(c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(c)||this._remoteUrls.get(c.toLowerCase()))&&this.PostToDOM("unload",{url:c.url,type:c.type,isMusic:a})},
UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(a,c,d){this._remoteUrls.set(d.toLowerCase(),{url:a,type:c})}}}"use strict";
self.C3.Plugins.Audio.Exps={Duration(f){return(f=this._GetFirstAudioStateByTag(f))?f.duration:0},PlaybackTime(f){return(f=this._GetFirstAudioStateByTag(f))?f.playbackTime:0},PlaybackRate(f){return(f=this._GetFirstAudioStateByTag(f))?f.playbackRate:0},Volume(f){return(f=this._GetFirstAudioStateByTag(f))?this.LinearToDb(f.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(f){return this._effectCount.get(f.toLowerCase())||0},AnalyserFreqBinCount(f,b){return(f=this.GetAnalyserData(f,
Math.floor(b)))?f.binCount:0},AnalyserFreqBinAt(f,b,a){f=this.GetAnalyserData(f,Math.floor(b));if(!f)return 0;a=Math.floor(a);return 0>a||a>=f.binCount?0:f.freqBins[a]},AnalyserPeakLevel(f,b){return(f=this.GetAnalyserData(f,Math.floor(b)))?f.peak:0},AnalyserRMSLevel(f,b){return(f=this.GetAnalyserData(f,Math.floor(b)))?f.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/1E3}};
{"use strict";const f=self.C3;f.Plugins.Dictionary=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Plugins.Dictionary.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3,b=self.IInstance;f.Plugins.Dictionary.Instance=class extends f.SDKInstanceBase{constructor(c,d){super(c);this._data=new Map;this._curKey=""}Release(){this._data.clear();super.Release()}GetAsJsonString(){return JSON.stringify({c2dictionary:!0,data:f.MapToObject(this._data)})}GetDataMap(){return this._data}SaveToJson(){return f.MapToObject(this._data)}LoadFromJson(c){f.ObjectToMap(c,this._data)}GetDebuggerProperties(){return[{title:"plugins.dictionary.name",properties:[{name:"plugins.dictionary.debugger.key-count",
value:this._data.size},...[...this._data].map(c=>({name:"$"+c[0],value:c[1],onedit:d=>this._data.set(c[0],d)}))]}]}GetScriptInterfaceClass(){return self.IDictionaryInstance}};const a=new WeakMap;self.IDictionaryInstance=class extends b{constructor(){super();a.set(this,b._GetInitInst().GetSdkInstance())}getDataMap(){return a.get(this).GetDataMap()}}}
{"use strict";const f=self.C3;f.Plugins.Dictionary.Cnds={CompareValue(b,a,c){b=this._data.get(b);return"undefined"===typeof b?!1:f.compare(b,a,c)},ForEachKey(){const b=this._runtime,a=b.GetEventSheetManager(),c=b.GetCurrentEvent(),d=c.GetSolModifiers(),e=b.GetEventStack(),h=e.GetCurrentStackFrame(),g=e.Push(c);b.SetDebuggingEnabled(!1);for(const l of this._data.keys())this._curKey=l,a.PushCopySol(d),c.Retrigger(h,g),a.PopSol(d);b.SetDebuggingEnabled(!0);this._curKey="";e.Pop();return!1},CompareCurrentValue(b,
a){const c=this._data.get(this._curKey);return"undefined"===typeof c?!1:f.compare(c,b,a)},HasKey(b){return this._data.has(b)},IsEmpty(){return 0===this._data.size}}}
{"use strict";const f=self.C3;f.Plugins.Dictionary.Acts={AddKey(b,a){this._data.set(b,a)},SetKey(b,a){this._data.has(b)&&this._data.set(b,a)},DeleteKey(b){this._data.delete(b)},Clear(){this._data.clear()},JSONLoad(b){let a=null;try{a=JSON.parse(b)}catch(c){console.error("[Construct 3] Error parsing JSON: ",c);return}a.c2dictionary&&f.ObjectToMap(a.data,this._data)},JSONDownload(b){const a=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(a,
b)}}}"use strict";self.C3.Plugins.Dictionary.Exps={Get(f){f=this._data.get(f);return"undefined"===typeof f?0:f},GetDefault(f,b){f=this._data.get(f);return"undefined"===typeof f?b:f},KeyCount(){return this._data.size},CurrentKey(){return this._curKey},CurrentValue(){return this._data.get(this._curKey)||0},AsJSON(){return this.GetAsJsonString()}};{"use strict";const f=self.C3;f.Plugins.LocalStorage=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const f=self.C3;f.Plugins.LocalStorage.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;f.Plugins.LocalStorage.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b);this._lastValue=this._currentKey="";this._keyNamesList=[];this._errorMessage="";this._pendingSets=this._pendingGets=0;this._storage=this._runtime._GetProjectStorage();this._debugCache=new Map;this._isLoadingDebugCache=!1}Release(){super.Release()}async _TriggerStorageError(b){this._errorMessage=this._GetErrorString(b);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnError)}_GetErrorString(b){return b?
"string"===typeof b?b:"string"===typeof b.message?b.message:"string"===typeof b.name?b.name:"string"===typeof b.data?b.data:"unknown error":"unknown error"}GetDebuggerProperties(){this._isLoadingDebugCache||this._DebugCacheStorage();return[{title:"plugins.localstorage.name",properties:[...this._debugCache.entries()].map(b=>({name:"$"+b[0],value:b[1],onedit:a=>this._storage.setItem(b[0],a)}))}]}async _DebugCacheStorage(){this._isLoadingDebugCache=!0;try{const b=await this._storage.keys();b.sort((c,
d)=>{c=c.toLowerCase();d=d.toLowerCase();return c<d?-1:d<c?1:0});const a=await Promise.all(b.map(c=>this._storage.getItem(c)));this._debugCache.clear();for(let c=0,d=b.length;c<d;++c)this._debugCache.set(b[c],a[c])}catch(b){console.warn("[C3 debugger] Error displaying local storage: ",b)}finally{this._isLoadingDebugCache=!1}}}}
{"use strict";const f=self.C3;f.Plugins.LocalStorage.Cnds={OnItemSet(b){return this._currentKey===b},OnAnyItemSet(){return!0},OnItemGet(b){return this._currentKey===b},OnAnyItemGet(){return!0},OnItemRemoved(b){return this._currentKey===b},OnAnyItemRemoved(){return!0},OnCleared(){return!0},OnAllKeyNamesLoaded(){return!0},OnError(){return!0},OnItemExists(b){return this._currentKey===b},OnItemMissing(b){return this._currentKey===b},CompareKey(b,a){return f.compare(this._currentKey,b,a)},CompareValue(b,
a){return f.compare(this._lastValue,b,a)},IsProcessingSets(){return 0<this._pendingSets},IsProcessingGets(){return 0<this._pendingGets},OnAllSetsComplete(){return!0},OnAllGetsComplete(){return!0}}}
{"use strict";const f=self.C3;function b(a){return"string"===typeof a||"number"===typeof a}f.Plugins.LocalStorage.Acts={async SetItem(a,c){this._pendingSets++;try{const d=await this._storage.setItem(a,c);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=d;await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingSets--,0===this._pendingSets&&
await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},async SetBinaryItem(a,c){if(c&&(c=c.GetFirstPicked(this._inst))&&(c=c.GetSdkInstance())){c=c.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(a,c),await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingSets--,
0===this._pendingSets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},async GetItem(a){this._pendingGets++;try{const c=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=b(c)?c:"";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}},
async GetBinaryItem(a,c){if(c&&(c=c.GetFirstPicked(this._inst))){var d=c.GetSdkInstance();this._pendingGets++;try{let e=await this._storage.getItem(a);e=e instanceof ArrayBuffer?e:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=a;d.SetArrayBufferTransfer(e);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(e){await this._TriggerStorageError(e)}finally{this._pendingGets--,
0===this._pendingGets&&await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},async CheckItemExists(a){try{const c=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;"undefined"===typeof c||null===c?(this._lastValue="",await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=b(c)?c:"",await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(c){await this._TriggerStorageError(c)}},async RemoveItem(a){try{await this._storage.removeItem(a),
await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(c){await this._TriggerStorageError(c)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";f.clearArray(this._keyNamesList);await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnCleared)})}catch(a){await this._TriggerStorageError(a)}},
async GetAllKeyNames(){try{const a=await this._storage.keys();await this.ScheduleTriggers(async()=>{this._keyNamesList=a;await this.TriggerAsync(f.Plugins.LocalStorage.Cnds.OnAllKeyNamesLoaded)})}catch(a){await this._TriggerStorageError(a)}}}}"use strict";self.C3.Plugins.LocalStorage.Exps={ItemValue(){return this._lastValue},Key(){return this._currentKey},KeyCount(){return this._keyNamesList.length},KeyAt(f){f=Math.floor(f);return 0>f||f>=this._keyNamesList.length?"":this._keyNamesList[f]},ErrorMessage(){return this._errorMessage}};
{"use strict";const f=self.C3;f.Plugins.Browser=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Plugins.Browser.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;f.Plugins.Browser.Instance=class extends f.SDKInstanceBase{constructor(b,a){super(b,"browser");this._initLocationStr="";this._isOnline=!1;this._docTitle=this._referrer="";this._isCookieEnabled=!1;this._windowOuterHeight=this._windowOuterWidth=this._screenHeight=this._screenWidth=0;this._isScirraArcade=!1;this.AddDOMMessageHandlers([["online-state",c=>this._OnOnlineStateChanged(c)],["backbutton",()=>this._OnBackButton()],["sw-message",c=>this._OnSWMessage(c)],["hashchange",
c=>this._OnHashChange(c)]]);b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),f.Disposable.From(b,"window-resize",()=>this._OnWindowResize()),f.Disposable.From(b,"suspend",()=>this._OnSuspend()),f.Disposable.From(b,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state",{exportType:this._runtime.GetExportType()}).then(c=>{this._initLocationStr=c.location;
this._isOnline=c.isOnline;this._referrer=c.referrer;this._docTitle=c.title;this._isCookieEnabled=c.isCookieEnabled;this._screenWidth=c.screenWidth;this._screenHeight=c.screenHeight;this._windowOuterWidth=c.windowOuterWidth;this._windowOuterHeight=c.windowOuterHeight;this._isScirraArcade=c.isScirraArcade}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(b){b=!!b.isOnline;this._isOnline!==b&&((this._isOnline=b)?await this.TriggerAsync(f.Plugins.Browser.Cnds.OnOnline):
await this.TriggerAsync(f.Plugins.Browser.Cnds.OnOffline))}async _OnWindowResize(){await this.TriggerAsync(f.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(f.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(f.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(f.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(b){b=b.type;"downloading-update"===b?this.Trigger(f.Plugins.Browser.Cnds.OnUpdateFound):"update-ready"===b||"update-pending"===b?this.Trigger(f.Plugins.Browser.Cnds.OnUpdateReady):
"offline-ready"===b&&this.Trigger(f.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(b){this._initLocationStr=b.location;this.Trigger(f.Plugins.Browser.Cnds.OnHashChange)}GetDebuggerProperties(){return[{title:"plugins.browser.name",properties:[{name:"plugins.browser.debugger.user-agent",value:navigator.userAgent},{name:"plugins.browser.debugger.is-online",value:this._isOnline},{name:"plugins.browser.debugger.is-fullscreen",value:this._runtime.GetCanvasManager().IsDocumentFullscreen()}]}]}}}"use strict";
self.C3.Plugins.Browser.Cnds={IsOnline(){return this._isOnline},OnOnline(){return!0},OnOffline(){return!0},OnResize(){return!0},CookiesEnabled(){return this._isCookieEnabled},IsFullscreen(){return this._runtime.GetCanvasManager().IsDocumentFullscreen()},OnBackButton(){return!0},IsPortraitLandscape(f){const b=this._runtime.GetCanvasManager().GetLastWidth(),a=this._runtime.GetCanvasManager().GetLastHeight();return(b<=a?0:1)===f},OnUpdateFound(){return!0},OnUpdateReady(){return!0},OnOfflineReady(){return!0},
OnHashChange(){return!0},PageVisible(){return!this._runtime.IsSuspended()},OnPageHidden(){return!0},OnPageVisible(){return!0},HasJava(){return!1},IsDownloadingUpdate(){return!1},OnMenuButton(){return!1},OnSearchButton(){return!1},IsMetered(){return!1},IsCharging(){return!0},SupportsFullscreen(){return!0}};
{"use strict";const f=self.C3,b="portrait landscape portrait-primary portrait-secondary landscape-primary landscape-secondary".split(" ");f.Plugins.Browser.Acts={Alert(a){this.PostToDOM("alert",{message:a.toString()})},Close(){this._isScirraArcade||(this._runtime.IsDebug()?self.C3Debugger.CloseWindow():this.PostToDOM("close"))},Focus(){this.PostToDOM("set-focus",{isFocus:!0})},Blur(){this.PostToDOM("set-focus",{isFocus:!1})},GoBack(){this._isScirraArcade||this.PostToDOM("navigate",{type:"back"})},
GoForward(){this._isScirraArcade||this.PostToDOM("navigate",{type:"forward"})},GoHome(){},Reload(){this._isScirraArcade||(this._runtime.IsDebug()?this._runtime.PostToDebugger({type:"reload"}):this.PostToDOM("navigate",{type:"reload"}))},GoToURL(a,c){this._PostToDOMMaybeSync("navigate",{type:"url",url:a,target:c,exportType:this._runtime.GetExportType()})},GoToURLWindow(a,c){this._PostToDOMMaybeSync("navigate",{type:"new-window",url:a,tag:c,exportType:this._runtime.GetExportType()})},RequestFullScreen(a,
c){2<=a&&(a+=1);6===a&&(a=2);1===a&&(a=0);a=f.CanvasManager._FullscreenModeNumberToString(a);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(a);this._PostToDOMMaybeSync("request-fullscreen",{navUI:c})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(a){a=a.split(",");for(let c=0,d=a.length;c<d;++c)a[c]=parseInt(a[c],10);this._PostToDOMMaybeSync("vibrate",{pattern:a})},async InvokeDownload(a,c){a&&c&&(a=await this._runtime.GetAssetManager().GetProjectFileUrl(a),this._runtime.InvokeDownload(a,
c))},InvokeDownloadString(a,c,d){d&&(a=`data:${c},${encodeURIComponent(a)}`,this._runtime.InvokeDownload(a,d))},ConsoleLog(a,c){c=c.toString();0===a?console.log(c):1===a?console.warn(c):2===a&&console.error(c)},ConsoleGroup(a){console.group(a)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(a){try{eval(a)}catch(c){console.error("Error executing JavaScript: ",c)}},LockOrientation(a){a=Math.floor(a);0>a||a>=b.length||this._PostToDOMMaybeSync("lock-orientation",{orientation:b[a]})},UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")},
LoadStyleSheet(a){this._runtime.GetAssetManager().LoadStyleSheet(a)},SetHash(a){this.PostToDOM("set-hash",{hash:a})}}}"use strict";
self.C3.Plugins.Browser.Exps={URL(){return this._runtime.IsInWorker()?this._initLocationStr:location.toString()},Protocol(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).protocol:location.protocol},Domain(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).hostname:location.hostname},Port(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).port:location.port},PathName(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).pathname:
location.pathname},Hash(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).hash:location.hash},QueryString(){return this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search},QueryParam(f){const b=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;return(f=RegExp("[?&]"+f+"=([^&]*)").exec(b))?decodeURIComponent(f[1].replace(/\+/g," ")):""},Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},
Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(f){let b=0;try{b=eval(f)}catch(a){console.error("Error executing JavaScript: ",a)}return"number"===typeof b||"string"===typeof b?b:"boolean"===typeof b?b?1:0:0},Name(){return navigator.appName},Version(){return navigator.appVersion},Product(){return navigator.product},Vendor(){return navigator.vendor},BatteryLevel(){return 1},BatteryTimeLeft(){return Infinity},Bandwidth(){const f=navigator.connection;return f?f.downlink||
f.downlinkMax||f.bandwidth||Infinity:Infinity},ConnectionType(){const f=navigator.connection;return f?f.type||"unknown":"unknown"},DevicePixelRatio(){return self.devicePixelRatio},ScreenWidth(){return this._screenWidth},ScreenHeight(){return this._screenHeight},WindowInnerWidth(){return this._runtime.GetCanvasManager().GetLastWidth()},WindowInnerHeight(){return this._runtime.GetCanvasManager().GetLastHeight()},WindowOuterWidth(){return this._windowOuterWidth},WindowOuterHeight(){return this._windowOuterWidth}};
{"use strict";const f=self.C3;f.Plugins.gamepad=class extends f.SDKPluginBase{constructor(b){super(b);this._isSupported=!1;this._runtime.AddLoadPromise(this._runtime.PostComponentMessageToDOMAsync("gamepad","is-supported").then(a=>this._isSupported=!!a))}Release(){super.Release()}IsSupported(){return this._isSupported}}}{"use strict";const f=self.C3;f.Plugins.gamepad.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;class b{constructor(c,d){this._index=c;this._id=d;this._state=new a;this._oldState=new a;this._buttonsPressed=[];this._buttonsReleased=[]}GetID(){return this._id}Update(c,d){const e=this._oldState;this._oldState=this._state;this._state=e;this._state.Update(c,d);f.resizeArray(this._buttonsPressed,this._state.GetButtonCount(),!1);f.resizeArray(this._buttonsReleased,this._state.GetButtonCount(),!1);for(let h=0,g=this._state.GetButtonCount();h<g;++h)c=this._oldState.GetButtonAt(h),
d=this._state.GetButtonAt(h),.5<=d&&.5>c&&(this._buttonsPressed[h]=!0),.5>d&&.5<=c&&(this._buttonsReleased[h]=!0)}GetButtonCount(){return this._state.GetButtonCount()}GetAxisCount(){return this._state.GetAxisCount()}HasButtonBecomePressed(c){c=Math.floor(c);return 0>c||c>=this._buttonsPressed.length?!1:this._buttonsPressed[c]}HasButtonBecomeReleased(c){c=Math.floor(c);return 0>c||c>=this._buttonsReleased.length?!1:this._buttonsReleased[c]}ResetButtonPressAndReleaseFlags(){this._buttonsPressed.fill(!1);
this._buttonsReleased.fill(!1)}GetButtonAt(c){return this._state.GetButtonAt(c)}IsButtonDown(c){return.5<=this._state.GetButtonAt(c)}GetAxisAt(c){return this._state.GetAxisAt(c)}}class a{constructor(){this._buttons=[];this._axes=[]}Update(c,d){const e=this._buttons;let h=0;for(let g=c.length;h<g;++h){const l=c[h];h===e.length?e.push(l.value):e[h]=l.value}h<e.length&&f.truncateArray(e,h);f.shallowAssignArray(this._axes,d)}GetButtonCount(){return this._buttons.length}GetAxisCount(){return this._axes.length}GetButtonAt(c){c=
Math.floor(c);return 0>c||c>=this._buttons.length?0:this._buttons[c]}GetAxisAt(c){c=Math.floor(c);return 0>c||c>=this._axes.length?0:this._axes[c]}}f.Plugins.gamepad.Instance=class extends f.SDKInstanceBase{constructor(c,d){super(c,"gamepad");this._deadZone=25;this._lastButton=0;this._lastIndex=-1;this._gamepads=new Map;d&&(this._deadZone=d[0]);this.AddDOMMessageHandler("gamepad-connected",e=>this._OnGamepadConnected(e));this.AddDOMMessageHandler("gamepad-disconnected",e=>this._OnGamepadDisconnected(e));
this.AddDOMMessageHandler("input-update",e=>this._OnInputUpdate(e));c=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(c,"tick2",()=>this._OnTick2()));this.PostToDOM("ready")}Release(){super.Release()}_OnGamepadConnected(c){const d=c.index;this._lastIndex=d;c=c.id;this._gamepads.has(d)||(this._gamepads.set(d,new b(d,c)),this.Trigger(f.Plugins.gamepad.Cnds.OnGamepadConnected),this._lastIndex=-1)}_OnGamepadDisconnected(c){this._lastIndex=c=c.index;this.Trigger(f.Plugins.gamepad.Cnds.OnGamepadDisconnected);
this._gamepads.delete(c);this._lastIndex=-1}_OnInputUpdate(c){for(const d of c)this._OnGamepadInputUpdate(d)}_OnGamepadInputUpdate(c){var d=c.index;this._gamepads.has(d)||this._OnGamepadConnected(c);d=this._gamepads.get(d);d.Update(c.buttons,c.axes);for(let e=0,h=d.GetButtonCount();e<h;++e)d.HasButtonBecomePressed(e)&&(this._lastButton=e)}_GetGamepadByIndex(c){return this._gamepads.get(Math.floor(c))||null}_OnTick2(){for(const c of this._gamepads.values())c.ResetButtonPressAndReleaseFlags()}GetDebuggerProperties(){return[{title:"plugins.gamepad.name",
properties:[{name:"plugins.gamepad.debugger.last-button",value:this._lastButton}]}]}}}
{"use strict";const f=self.C3;f.Plugins.gamepad.Cnds={SupportsGamepad(){return this.GetPlugin().IsSupported()},OnGamepadConnected(){return!0},OnGamepadDisconnected(){return!0},IsButtonDown(b,a){b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.IsButtonDown(a))this._lastButton=a;return b},OnButtonDown(b,a){b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.HasButtonBecomePressed(a))this._lastButton=a;return b},OnButtonUp(b,a){b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.HasButtonBecomeReleased(a))this._lastButton=
a;return b},HasGamepads(){return 0<this._gamepads.size},CompareAxis(b,a,c,d){a=Math.floor(a);const e=this._GetGamepadByIndex(b);if(!e)return!1;b=e.GetAxisAt(a);a=0===a%2?e.GetAxisAt(a+1):e.GetAxisAt(a-1);b*=100;Math.hypot(b,100*a)<=this._deadZone&&(b=0);return f.compare(b,c,d)},OnAnyButtonDown(b){b=this._GetGamepadByIndex(b);if(!b)return!1;for(let a=0,c=b.GetButtonCount();a<c;++a)if(b.HasButtonBecomePressed(a))return this._lastButton=a,!0;return!1},OnAnyButtonUp(b){b=this._GetGamepadByIndex(b);if(!b)return!1;
for(let a=0,c=b.GetButtonCount();a<c;++a)if(b.HasButtonBecomeReleased(a))return this._lastButton=a,!0;return!1},IsButtonIndexDown(b,a){a=Math.floor(a);b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.IsButtonDown(a))this._lastButton=a;return b},OnButtonIndexDown(b,a){a=Math.floor(a);b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.HasButtonBecomePressed(a))this._lastButton=a;return b},OnButtonIndexUp(b,a){a=Math.floor(a);b=this._GetGamepadByIndex(b);if(!b)return!1;if(b=b.HasButtonBecomeReleased(a))this._lastButton=
a;return b}}}{"use strict";const f=self.C3;f.Plugins.gamepad.Acts={Vibrate(b,a,c,d){this.PostToDOM("vibrate",{index:b,duration:a,weakMag:f.clamp(c/100,0,1),strongMag:f.clamp(d/100,0,1)})},ResetVibrate(b){this.PostToDOM("reset-vibrate",{index:b})}}}"use strict";
self.C3.Plugins.gamepad.Exps={GamepadCount(){return this._gamepads.size},GamepadID(f){return(f=this._GetGamepadByIndex(f))?f.GetID():""},GamepadIndex(){return this._lastIndex},GamepadAxes(f){f=this._GetGamepadByIndex(f);if(!f)return"";let b="";for(let a=0,c=f.GetAxisCount();a<c;++a)b+=`Axis ${a}: ${Math.round(100*f.GetAxisAt(a))}\n`;return b},GamepadButtons(f){f=this._GetGamepadByIndex(f);if(!f)return"";let b="";for(let a=0,c=f.GetButtonCount();a<c;++a)b+=`Button ${a}: ${Math.round(100*f.GetButtonAt(a))}\n`;
return b},RawButton(f,b){return(f=this._GetGamepadByIndex(f))?f.GetButtonAt(Math.floor(b)):0},RawAxis(f,b){return(f=this._GetGamepadByIndex(f))?f.GetAxisAt(Math.floor(b)):0},RawButtonCount(f){return(f=this._GetGamepadByIndex(f))?f.GetButtonCount():0},RawAxisCount(f){return(f=this._GetGamepadByIndex(f))?f.GetAxisCount():0},Button(f,b){return(f=this._GetGamepadByIndex(f))?100*f.GetButtonAt(Math.floor(b)):0},Axis(f,b){b=Math.floor(b);const a=this._GetGamepadByIndex(f);if(!a)return 0;f=a.GetAxisAt(b);
b=0===b%2?a.GetAxisAt(b+1):a.GetAxisAt(b-1);f*=100;Math.hypot(f,100*b)<=this._deadZone&&(f=0);return f},LastButton(){return this._lastButton}};{"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(c){super(c)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IMouseObjectType}};let b=null;function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.IMouseObjectType=class extends self.IObjectClass{constructor(c){super(c);b=c;c.GetRuntime()._GetCommonScriptInterfaces().mouse=this}getMouseX(c){return a().GetMousePositionForLayer(c)[0]}getMouseY(c){return a().GetMousePositionForLayer(c)[1]}getMousePosition(c){return a().GetMousePositionForLayer(c)}isMouseButtonDown(c){return a().IsMouseButtonDown(c)}}}
{"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;this._hasPointerLock=!1;this._movementY=this._movementX=0;this.AddDOMMessageHandlers([["pointer-lock-change",c=>this._OnPointerLockChange(c)],["pointer-lock-error",c=>this._OnPointerLockError(c)]]);b=this.GetRuntime().Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,
"pointermove",c=>this._OnPointerMove(c.data)),f.Disposable.From(b,"pointerdown",c=>this._OnPointerDown(c.data)),f.Disposable.From(b,"pointerup",c=>this._OnPointerUp(c.data)),f.Disposable.From(b,"dblclick",c=>this._OnDoubleClick(c.data)),f.Disposable.From(b,"wheel",c=>this._OnMouseWheel(c.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){this._movementX=b.movementX;this._movementY=b.movementY;this.Trigger(f.Plugins.Mouse.Cnds.OnMovement);this._movementY=this._movementX=0;"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,c,d){!(b&c)&&a&c?this._OnMouseDown(d):b&c&&!(a&c)&&this._OnMouseUp(d)}_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(),c=this._mouseXcanvas,d=this._mouseYcanvas;return"undefined"===typeof b?a.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(c,d):(b=a.GetLayer(b))?b.CanvasCssToLayer(c,d):[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()}_OnPointerLockChange(b){this._UpdatePointerLockState(b["has-pointer-lock"])}_OnPointerLockError(b){this._UpdatePointerLockState(b["has-pointer-lock"]);
this.Trigger(f.Plugins.Mouse.Cnds.OnPointerLockError)}_UpdatePointerLockState(b){this._hasPointerLock!==b&&((this._hasPointerLock=b)?this.Trigger(f.Plugins.Mouse.Cnds.OnPointerLocked):this.Trigger(f.Plugins.Mouse.Cnds.OnPointerUnlocked))}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(),c=this._mouseXcanvas,d=this._mouseYcanvas;return f.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,c,d,a),a)},OnObjectClicked(b,a,c){if(b!==
this._triggerButton||a!==this._triggerType||!this._IsMouseOverCanvas())return!1;b=this._mouseXcanvas;a=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(c,b,a,!1)},OnWheel(b){return this._triggerDir===b},OnPointerLocked(){return!0},OnPointerUnlocked(){return!0},OnPointerLockError(){return!0},HasPointerLock(){return this._hasPointerLock},OnMovement(){return!0}}}
{"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(c){c=a[c];b!==c&&(b=c,this.PostToDOM("cursor",c))},SetCursorSprite(c){if(!f.Platform.IsMobile&&c&&(c=c.GetFirstPicked())){var d=c.GetWorldInfo(),e=c.GetCurrentImageInfo();d&&e&&b!==e&&(b=e,e.ExtractImageToCanvas().then(h=>f.CanvasToBlob(h)).then(h=>{h=`url(${URL.createObjectURL(h)}) ${Math.round(d.GetOriginX()*e.GetWidth())} ${Math.round(d.GetOriginY()*e.GetHeight())}, auto`;
this.PostToDOM("cursor","");this.PostToDOM("cursor",h)}))}},RequestPointerLock(){this._PostToDOMMaybeSync("request-pointer-lock")},ReleasePointerLock(){this.PostToDOM("release-pointer-lock")}}}"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},MovementX(){return this._movementX},MovementY(){return this._movementY}};
{"use strict";const f=self.C3;f.Plugins.Function=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Plugins.Function.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;class b{constructor(){this.name="";this.retVal=0;this.params=[]}}f.Plugins.Function.Instance=class extends f.SDKInstanceBase{constructor(a,c){super(a);this._isPreview=this._runtime.IsPreview();this._funcStackPtr=-1;this._funcStack=[];a=(d,e)=>this._InvokeFromJS(d,e);self.c2_callFunction=a;self.c3_callFunction=a}Release(){super.Release()}Push(){const a=this._funcStack,c=++this._funcStackPtr;c===a.length&&a.push(new b);return a[c]}Pop(){--this._funcStackPtr}GetCurrent(){const a=
this._funcStackPtr;return 0>a?null:this._funcStack[a]}GetOneAbove(){const a=this._funcStack;return a.length?a[Math.min(this._funcStackPtr+1,a.length-1)]:null}_CallFunction(a,c){const d=this.Push();d.name=a.toLowerCase();d.retVal=0;f.shallowAssignArray(d.params,c);c=this.FastTrigger(f.Plugins.Function.Cnds.OnFunction,d.name);this._isPreview&&!c&&console.warn(`[Construct 3] Function object: called function '${a}' but no event was triggered. Is the function call spelt incorrectly or no longer used?`);
this.Pop()}*_DebugCallFunction(a,c){const d=this.Push();d.name=a.toLowerCase();d.retVal=0;f.shallowAssignArray(d.params,c);c=yield*this.DebugFastTrigger(f.Plugins.Function.Cnds.OnFunction,d.name);this._isPreview&&!c&&console.warn(`[Construct 3] Function object: called function '${a}' but no event was triggered. Is the function call spelt incorrectly or no longer used?`);this.Pop()}_InvokeFromJS(a,c){const d=this.Push();d.name=a.toLowerCase();d.retVal=0;d.params=(c||[]).map(e=>"number"===typeof e||
"string"===typeof e?e:"boolean"===typeof e?e?1:0:0);this.FastTrigger(f.Plugins.Function.Cnds.OnFunction,d.name);this.Pop();return d.retVal}}}
{"use strict";const f=self.C3;f.Plugins.Function.Cnds={OnFunction(b){return!0},CompareParam(b,a,c){const d=this.GetCurrent();if(!d)return this._isPreview&&console.warn("[Construct 3] Function object: used 'Compare parameter' condition when not in a function call"),!1;const e=d.params;b=Math.floor(b);let h=0;0>b||b>=e.length?this._isPreview&&console.warn(`[Construct 3] Function object: in function '${d.name}', compared parameter out of bounds (accessed index ${b} of ${e.length})`):h=e[b];return f.compare(h,
a,c)}}}"use strict";self.C3.Plugins.Function.Acts={CallFunction(f,b){if(this._runtime.IsDebugging())return this._DebugCallFunction(f,b);this._CallFunction(f,b)},SetReturnValue(f){const b=this.GetCurrent();b?b.retVal=f:this._isPreview&&console.warn("[Construct 3] Function object: used 'Set return value' when not in a function call")},CallExpression(f){}};
{"use strict";const f=self.C3;f.Plugins.Function.Exps={ReturnValue(){const b=this.GetOneAbove();return b?b.retVal:0},ParamCount(){const b=this.GetCurrent();if(b)return b.params.length;this._isPreview&&console.warn("[Construct 3] Function object: used 'ParamCount' expression when not in a function call");return 0},Param(b){b=Math.floor(b);const a=this.GetCurrent();if(a){const c=a.params;if(0<=b&&b<c.length)return c[b];this._isPreview&&console.warn(`[Construct 3] Function object: in function '${a.name}', accessed parameter out of bounds (accessed index ${b} of ${c.length})`);
return 0}this._isPreview&&console.warn("[Construct 3] Function object: used 'Param' expression when not in a function call");return 0},Call(b,...a){const c=this.Push();c.name=b.toLowerCase();c.retVal=0;c.params=a;a=this.FastTrigger(f.Plugins.Function.Cnds.OnFunction,c.name);this._isPreview&&!a&&console.warn(`[Construct 3] Function object: expression Function.Call("${b}" ...) was used, but no event was triggered. Is the function call spelt incorrectly or no longer used?`);this.Pop();return c.retVal}}}
{"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(c=>c.LoadAllTextures(b,a)))}ReleaseTextures(){for(const b of this._animations)b.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const b of this._objectClass.instancesIncludingPendingCreate())b.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(b){f.Plugins.Sprite.FinishCollisionCondition(this,
b)}}}
{"use strict";const f=self.C3,b=self.C3X,a=f.New(f.Rect),c=f.New(f.Quad),d=f.New(f.Vector2);f.Plugins.Sprite.Instance=class extends f.SDKWorldInstanceBase{constructor(g,l){super(g);let m=!0,u="",w=0,q=!0;l&&(m=!!l[0],u=l[1],w=l[2],q=l[3]);this._currentAnimation=this._objectClass.GetAnimationByName(u)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=f.clamp(w,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);l=
this._currentAnimationFrame.GetImageInfo();this._currentTexture=l.GetTexture();this._currentRcTex=l.GetTexRect();this._currentQuadTex=l.GetTexQuad();this.HandleWebGLContextLoss();g.SetFlag(2,!0);g.SetFlag(1,0<=this._currentAnimation.GetSpeed());this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo();this._animationTimer=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(q);g.SetOriginX(this._currentAnimationFrame.GetOriginX());g.SetOriginY(this._currentAnimationFrame.GetOriginY());g.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly());g.SetBboxChanged();1===this._objectClass.GetAnimationCount()&&1===this._objectClass.GetAnimations()[0].GetFrameCount()||0===this._currentAnimationSpeed||this._StartTicking()}Release(){this._animationTimer=
this._currentTexture=this._currentAnimationFrame=this._currentAnimation=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}IsOriginalSizeKnown(){return!0}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(g){var l=this._currentTexture;null!==l&&(g.SetTexture(l),l=this.GetWorldInfo(),l.HasMesh()?this._DrawMesh(l,g):this._DrawStandard(l,g))}_DrawStandard(g,l){let m=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&&
(m=g.PixelRoundQuad(m));l.Quad4(m,this._currentQuadTex)}_DrawMesh(g,l){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(a,c,!1);let u=c;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));m.CalculateTransformedMesh(g.GetSourceMesh(),u,this._currentQuadTex);g.SetMeshChanged(!1)}m.Draw(l)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(2)}SetAnimationPlaying(g){this._inst.SetFlag(2,g)}IsPlayingForwards(){return this._inst.GetFlag(1)}SetPlayingForwards(g){this._inst.SetFlag(1,
g)}IsInAnimationTrigger(){return this._inst.GetFlag(4)}SetInAnimationTrigger(g){this._inst.SetFlag(4,g)}Tick(){this._changeAnimationName&&this._DoChangeAnimation();0<=this._changeAnimFrameIndex&&this._DoChangeAnimFrame();const g=this._currentAnimationSpeed;if(this.IsAnimationPlaying()&&0!==g){var l=this._runtime.GetDt(this._inst);this._animationTimer.Add(l);l=this.GetAnimationTime();var m=this._currentAnimationFrame,u=m.GetDuration()/g;if(!(l<this._frameStartTime+u)){var w=this._currentAnimation,
q=this._currentAnimationRepeatTo,t=w.GetFrameCount(),p=w.GetRepeatCount(),r=w.IsLooping(),x=w.IsPingPong();this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=u;this._currentFrameIndex>=t&&(x?(this.SetPlayingForwards(!1),this._currentFrameIndex=t-2):r?this._currentFrameIndex=q:(this._animationRepeats++,this._animationRepeats>=p?this._FinishAnimation(!1):this._currentFrameIndex=q));0>this._currentFrameIndex&&(x?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),
r||(this._animationRepeats++,this._animationRepeats>=p&&this._FinishAnimation(!0))):r?this._currentFrameIndex=q:(this._animationRepeats++,this._animationRepeats>=p?this._FinishAnimation(!0):this._currentFrameIndex=q));this._currentFrameIndex=f.clamp(this._currentFrameIndex,0,t-1);u=w.GetFrameAt(this._currentFrameIndex);l>this._frameStartTime+u.GetDuration()/g&&(this._frameStartTime=l);this._OnFrameChanged(m,u)}}else this._StopTicking()}_FinishAnimation(g){this._currentFrameIndex=g?0:this._currentAnimation.GetFrameCount()-
1;this.SetAnimationPlaying(!1);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(!0);this.DispatchScriptEvent("animationend",!1,{animationName:this._animTriggerName});this.Trigger(f.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(f.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(g,l){if(g!==l){var m=this.GetWorldInfo(),u=g.GetImageInfo(),w=l.GetImageInfo(),q=u.GetWidth();u=u.GetHeight();var t=w.GetWidth(),
p=w.GetHeight();q!==t&&m.SetWidth(m.GetWidth()*(t/q));u!==p&&m.SetHeight(m.GetHeight()*(p/u));m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());m.SetBboxChanged();this._currentAnimationFrame=l;this._currentTexture=w.GetTexture();this._currentRcTex=w.GetTexRect();this._currentQuadTex=w.GetTexQuad();m=this.GetInstance().GetBehaviorInstances();for(let r=0,x=m.length;r<x;++r)m[r].OnSpriteFrameChanged(g,l);this.DispatchScriptEvent("framechange",!1,
{animationName:this._currentAnimation.GetName(),animationFrame:this._currentFrameIndex});this.Trigger(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,l){this._changeAnimationName=g;this._changeAnimationFrom=l;this._StartTicking();this.IsInAnimationTrigger()||
this._DoChangeAnimation()}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(g){isFinite(g)&&(this._changeAnimFrameIndex=g,this.IsInAnimationTrigger()||this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(g){this._currentAnimationSpeed=Math.abs(g);this.SetPlayingForwards(0<=g);0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:
-this._currentAnimationSpeed}_SetAnimRepeatToFrame(g){this._currentAnimationRepeatTo=g=f.clamp(Math.floor(g),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const g=this._currentAnimationFrame;var l=this._objectClass.GetAnimationByName(this._changeAnimationName);this._changeAnimationName="";!l||l===this._currentAnimation&&this.IsAnimationPlaying()||(this._currentAnimation=l,this.SetPlayingForwards(0<=l.GetSpeed()),this._currentAnimationSpeed=
Math.abs(l.GetSpeed()),this._currentAnimationRepeatTo=l.GetRepeatTo(),this._currentFrameIndex=f.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex=0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,l))}_DoChangeAnimFrame(){const g=this._currentAnimationFrame;var l=this._currentFrameIndex;this._currentFrameIndex=
f.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;l!==this._currentFrameIndex&&(l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,l),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const g=this._currentAnimationFrame.GetImageInfo();this._currentTexture=g.GetTexture();this._currentRcTex=g.GetTexRect();this._currentQuadTex=g.GetTexQuad();this.GetWorldInfo().SetMeshChanged(!0)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetTexQuad(){return this._currentQuadTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(g){const l=
this._currentAnimationFrame,m=this.GetWorldInfo();if("string"===typeof g)g=l.GetImagePointByName(g);else if("number"===typeof g)g=l.GetImagePointByIndex(g-1);else throw new TypeError("expected string or number");if(!g)return[m.GetX(),m.GetY()];d.copy(g.GetVec2());if(m.HasMesh()){const [u,w]=m.GetSourceMesh().TransformPoint(d.getX(),d.getY());d.set(u,w)}d.offset(-l.GetOriginX(),-l.GetOriginY());d.scale(m.GetWidth(),m.GetHeight());d.rotate(m.GetAngle());d.offset(m.GetX(),m.GetY());return[d.getX(),d.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(g){g=
Math.floor(g);const l=this.GetWorldInfo();var m=l.GetTransformedCollisionPoly();const u=m.pointCount();g===u&&(g=0);if(0>g||g>=u)return[0,0];m=m.pointsArr();return[m[2*g]+l.GetX(),m[2*g+1]+l.GetY()]}GetDebuggerProperties(){const g=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:l=>this.CallAction(g.SetAnim,l,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",
value:this._currentFrameIndex,onedit:l=>this.CallAction(g.SetAnimFrame,l)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:l=>l?this.CallAction(g.StartAnim,0):this.CallAction(g.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:l=>this.CallAction(g.SetAnimSpeed,l)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:l=>this._animationRepeats=
l}]}]}SaveToJson(){const g={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&(g.fs=this._frameStartTime);var l=this.GetAnimationTime();0!==l&&(g.at=l);0!==this._currentFrameIndex&&(g.f=this._currentFrameIndex);0!==this._currentAnimationSpeed&&(g.cas=this._currentAnimationSpeed);1!==this._animationRepeats&&(g.ar=this._animationRepeats);0!==this._currentAnimationRepeatTo&&(g.rt=this._currentAnimationRepeatTo);this.IsAnimationPlaying()||(g.ap=this.IsAnimationPlaying());this.IsPlayingForwards()||
(g.af=this.IsPlayingForwards());l=this.GetWorldInfo();l.IsCollisionEnabled()&&(g.ce=l.IsCollisionEnabled());return g}LoadFromJson(g){var l=this.GetObjectClass().GetAnimationBySID(g.a);l&&(this._currentAnimation=l);this._frameStartTime=g.hasOwnProperty("fs")?g.fs:0;this._animationTimer.Set(g.hasOwnProperty("at")?g.at:0);l=g.hasOwnProperty("f")?g.f:0;this._currentFrameIndex=f.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=g.hasOwnProperty("cas")?g.cas:0;this._animationRepeats=
g.hasOwnProperty("ar")?g.ar:1;l=g.hasOwnProperty("rt")?g.rt:0;this._currentAnimationRepeatTo=f.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(g.hasOwnProperty("ap")?!!g.ap:!0);this.SetPlayingForwards(g.hasOwnProperty("af")?!!g.af:!0);this._currentAnimationFrame=l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._UpdateCurrentTexture();const m=this.GetWorldInfo();m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());
m.SetCollisionEnabled(!!g.ce)}GetPropertyValueByIndex(g){const l=this.GetWorldInfo();switch(g){case 3:return l.IsCollisionEnabled();case 2:return f.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1)}}SetPropertyValueByIndex(g,l){var m=this.GetWorldInfo();switch(g){case 3:m.SetCollisionEnabled(!!l);break;case 2:this.SetAnimationPlaying(!1);g=this._currentAnimation.GetFrameCount()-1;m=l=f.clamp(l,0,g);l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const u=this._currentAnimation.GetFrameAt(m);
this._OnFrameChanged(l,u);this._currentFrameIndex=f.clamp(m,0,g)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const e=new WeakMap,h=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();e.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return e.get(this).GetImagePointCount()}getImagePointX(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return e.get(this).GetImagePoint(g)[0]}getImagePointY(g){if("string"!==
typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return e.get(this).GetImagePoint(g)[1]}getImagePoint(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return e.get(this).GetImagePoint(g)}getPolyPointCount(){return e.get(this).GetCollisionPolyPointCount()}getPolyPointX(g){b.RequireFiniteNumber(g);return e.get(this).GetCollisionPolyPoint(g)[0]}getPolyPointY(g){b.RequireFiniteNumber(g);return e.get(this).GetCollisionPolyPoint(g)[1]}getPolyPoint(g){b.RequireFiniteNumber(g);
return e.get(this).GetCollisionPolyPoint(g)}stopAnimation(){e.get(this).SetAnimationPlaying(!1)}startAnimation(g="current-frame"){b.RequireString(g);g=h.get(g);if("undefined"===typeof g)throw Error("invalid mode");e.get(this)._StartAnim(g)}setAnimation(g,l="beginning"){b.RequireString(g);b.RequireString(l);l=h.get(l);if("undefined"===typeof l)throw Error("invalid mode");e.get(this)._SetAnim(g,l)}get animationName(){return e.get(this)._GetCurrentAnimationName()}set animationFrame(g){b.RequireFiniteNumber(g);
e.get(this)._SetAnimFrame(g)}get animationFrame(){return e.get(this)._GetAnimFrame()}set animationSpeed(g){b.RequireFiniteNumber(g);e.get(this)._SetAnimSpeed(g)}get animationSpeed(){return e.get(this)._GetAnimSpeed()}set animationRepeatToFrame(g){b.RequireFiniteNumber(g);e.get(this)._SetAnimRepeatToFrame(g)}get animationRepeatToFrame(){return e.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return e.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return e.get(this).GetCurrentImageInfo().GetHeight()}}}
{"use strict";const f=self.C3;f.Plugins.Sprite.Cnds={IsAnimPlaying(b){return f.equalsNoCase(this._GetCurrentAnimationName(),b)},CompareFrame(b,a){return f.compare(this._currentFrameIndex,b,a)},CompareAnimSpeed(b,a){return f.compare(this._GetAnimSpeed(),b,a)},OnAnimFinished(b){return f.equalsNoCase(this._animTriggerName,b)},OnAnyAnimFinished(){return!0},OnFrameChanged(){return!0},IsMirrored(){return 0>this.GetWorldInfo().GetWidth()},IsFlipped(){return 0>this.GetWorldInfo().GetHeight()},OnURLLoaded(){return!0},
OnURLFailed(){return!0},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}}
{"use strict";const f=self.C3;f.Plugins.Sprite.Acts={Spawn(b,a,c,d){if(b&&a){var [e,h]=this.GetImagePoint(c);if(c=this._runtime.CreateInstance(b,a,e,h,d)){d&&a.SortAndAddInstancesByZIndex(c);b.GetPlugin().IsRotatable()&&(a=c.GetWorldInfo(),a.SetAngle(this.GetWorldInfo().GetAngle()),a.SetBboxChanged());a=this._runtime.GetEventSheetManager();a.BlockFlushingInstances(!0);c._TriggerOnCreatedOnSelfAndRelated();a.BlockFlushingInstances(!1);d=this._runtime.GetCurrentAction().GetSavedDataMap();a=!1;if(!d.has("Spawn_LastExec")||
d.get("Spawn_LastExec")<this._runtime.GetExecCount())a=!0,d.set("Spawn_LastExec",this._runtime.GetExecCount());if(b!==this.GetObjectClass()&&(b=b.GetCurrentSol(),b._SetSelectAll(!1),b=b._GetOwnInstances(),a&&f.clearArray(b),b.push(c),c.IsInContainer()))for(const g of c.siblings())c=g.GetObjectClass().GetCurrentSol(),a?c.SetSinglePicked(g):(c._SetSelectAll(!1),c._PushInstance(g))}}},StopAnim(){this.SetAnimationPlaying(!1)},StartAnim(b){this._StartAnim(b)},SetAnim(b,a){this._SetAnim(b,a)},SetAnimFrame(b){this._SetAnimFrame(b)},
SetAnimSpeed(b){this._SetAnimSpeed(b)},SetAnimRepeatToFrame(b){this._SetAnimRepeatToFrame(b)},SetMirrored(b){const a=this.GetWorldInfo(),c=a.GetWidth();b=Math.abs(c)*(0===b?-1:1);c!==b&&(a.SetWidth(b),a.SetBboxChanged())},SetFlipped(b){const a=this.GetWorldInfo(),c=a.GetHeight();b=Math.abs(c)*(0===b?-1:1);c!==b&&(a.SetHeight(b),a.SetBboxChanged())},SetScale(b){const a=this._currentAnimationFrame.GetImageInfo(),c=this.GetWorldInfo();var d=0>c.GetWidth()?-1:1;const e=0>c.GetHeight()?-1:1;d*=a.GetWidth()*
b;b=a.GetHeight()*b*e;if(c.GetWidth()!==d||c.GetHeight()!==b)c.SetSize(d,b),c.SetBboxChanged()},async LoadURL(b,a,c){c=this._currentAnimationFrame.GetImageInfo();const d=this.GetWorldInfo(),e=this._runtime;if(c.GetURL()===b)0===a&&(d.SetSize(c.GetWidth(),c.GetHeight()),d.SetBboxChanged()),this.Trigger(f.Plugins.Sprite.Cnds.OnURLLoaded);else{var h=f.New(f.ImageInfo);try{await h.LoadDynamicAsset(e,b);if(!h.IsLoaded())throw Error("image failed to load");await h.LoadStaticTexture(e.GetRenderer(),{sampling:this._runtime.GetSampling()})}catch(g){console.error("Load image from URL failed: ",
g);this.Trigger(f.Plugins.Sprite.Cnds.OnURLFailed);return}c.ReplaceWith(h);this._sdkType._UpdateAllCurrentTexture();this.WasReleased()||0!==a||(d.SetSize(c.GetWidth(),c.GetHeight()),d.SetBboxChanged());e.UpdateRender();this.WasReleased()||await this.TriggerAsync(f.Plugins.Sprite.Cnds.OnURLLoaded)}},SetCollisions(b){this.GetWorldInfo().SetCollisionEnabled(b)},SetSolidCollisionFilter(b,a){this.GetWorldInfo().SetSolidCollisionFilter(0===b,a)},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()}}}"use strict";
self.C3.Plugins.Sprite.Exps={AnimationFrame(){return this._currentFrameIndex},AnimationFrameCount(){return this._currentAnimation.GetFrameCount()},AnimationName(){return this._currentAnimation.GetName()},AnimationSpeed(){return this._GetAnimSpeed()},OriginalAnimationSpeed(){return this._currentAnimation.GetSpeed()},ImagePointX(f){return this.GetImagePoint(f)[0]},ImagePointY(f){return this.GetImagePoint(f)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},
ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(f){return this.GetCollisionPolyPoint(f)[0]},PolyPointYAt(f){return this.GetCollisionPolyPoint(f)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};{"use strict";const f=self.C3;f.Plugins.TiledBg=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const f=self.C3;function b(a){switch(a){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}f.Plugins.TiledBg.Type=class extends f.SDKTypeBase{constructor(a,c){super(a);this._wrapY=this._wrapX="repeat";c&&(this._wrapX=b(c[0]),this._wrapY=b(c[1]))}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}}
{"use strict";const f=self.C3,b=self.C3X,a=f.New(f.Rect),c=f.New(f.Quad),d=f.New(f.Rect),e=f.New(f.Quad);f.Plugins.TiledBg.Instance=class extends f.SDKWorldInstanceBase{constructor(g,l){super(g);this._imageOffsetY=this._imageOffsetX=0;this._imageScaleY=this._imageScaleX=1;this._imageAngle=0;this._ownImageInfo=null;l&&(this.GetWorldInfo().SetVisible(!!l[0]),this._imageOffsetX=l[4],this._imageOffsetY=l[5],this._imageScaleX=l[6],this._imageScaleY=l[7],this._imageAngle=f.toRadians(l[8]))}Release(){this._ReleaseOwnImage();
super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}CalculateTextureCoordsFor3DFace(g,l,m){var u=this.GetCurrentImageInfo();const w=u.GetWidth();u=u.GetHeight();const q=this._imageOffsetX/w,t=this._imageOffsetY/u,p=this._imageAngle;d.set(0,0,g/(w*this._imageScaleX),l/(u*this._imageScaleY));d.offset(-q,-t);0===p?m.setFromRect(d):m.setFromRotatedRect(d,-p)}Draw(g){var l=this.GetCurrentImageInfo(),m=l.GetTexture();if(null!==m){g.SetTexture(m);
m=l.GetWidth();l=l.GetHeight();var u=this._imageOffsetX/m,w=this._imageOffsetY/l,q=this.GetWorldInfo();d.set(0,0,q.GetWidth()/(m*this._imageScaleX),q.GetHeight()/(l*this._imageScaleY));d.offset(-u,-w);q.HasMesh()?this._DrawMesh(q,g):this._DrawStandard(q,g)}}_DrawStandard(g,l){let m=g.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));0===this._imageAngle?l.Quad3(m,d):(e.setFromRotatedRect(d,-this._imageAngle),l.Quad4(m,e))}_DrawMesh(g,l){const m=g.GetTransformedMesh();
if(g.IsMeshChanged()){g.CalculateBbox(a,c,!1);let u=c;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));let w=d;0!==this._imageAngle&&(e.setFromRotatedRect(d,-this._imageAngle),w=e);m.CalculateTransformedMesh(g.GetSourceMesh(),u,w);g.SetMeshChanged(!1)}m.Draw(l)}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}IsOriginalSizeKnown(){return!0}GetTexture(){return this.GetCurrentImageInfo().GetTexture()}_SetMeshChanged(){this.GetWorldInfo().SetMeshChanged(!0)}_SetImageOffsetX(g){this._imageOffsetX!==
g&&(this._imageOffsetX=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(g){this._imageOffsetY!==g&&(this._imageOffsetY=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(g){this._imageScaleX!==g&&(this._imageScaleX=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(g){this._imageScaleY!==g&&(this._imageScaleY=
g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(g){this._imageAngle!==g&&(this._imageAngle=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageAngle(){return this._imageAngle}GetPropertyValueByIndex(g){switch(g){case 4:return this._GetImageOffsetX();case 5:return this._GetImageOffsetY();case 6:return this._GetImageScaleX();case 7:return this._GetImageScaleY();case 8:return this._GetImageAngle()}}SetPropertyValueByIndex(g,
l){switch(g){case 4:this._SetImageOffsetX(l);break;case 5:this._SetImageOffsetY(l);break;case 6:this._SetImageScaleX(l);break;case 7:this._SetImageScaleY(l);break;case 8:this._SetImageAngle(l)}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const h=new WeakMap;self.ITiledBackgroundInstance=class extends self.IWorldInstance{constructor(){super();h.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(g){b.RequireFiniteNumber(g);h.get(this)._SetImageOffsetX(g)}get imageOffsetX(){return h.get(this)._GetImageOffsetX()}set imageOffsetY(g){b.RequireFiniteNumber(g);
h.get(this)._SetImageOffsetY(g)}get imageOffsetY(){return h.get(this)._GetImageOffsetY()}set imageScaleX(g){b.RequireFiniteNumber(g);h.get(this)._SetImageScaleX(g)}get imageScaleX(){return h.get(this)._GetImageScaleX()}set imageScaleY(g){b.RequireFiniteNumber(g);h.get(this)._SetImageScaleY(g)}get imageScaleY(){return h.get(this)._GetImageScaleY()}set imageAngle(g){b.RequireFiniteNumber(g);h.get(this)._SetImageAngle(g)}get imageAngle(){return h.get(this)._GetImageAngle()}set imageAngleDegrees(g){b.RequireFiniteNumber(g);
h.get(this)._SetImageAngle(f.toRadians(g))}get imageAngleDegrees(){return f.toDegrees(h.get(this)._GetImageAngle())}get imageWidth(){return h.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return h.get(this).GetCurrentImageInfo().GetHeight()}}}"use strict";self.C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}};
{"use strict";const f=self.C3;f.Plugins.TiledBg.Acts={SetImageOffsetX(b){this._SetImageOffsetX(b)},SetImageOffsetY(b){this._SetImageOffsetY(b)},SetImageScaleX(b){this._SetImageScaleX(b/100)},SetImageScaleY(b){this._SetImageScaleY(b/100)},SetImageAngle(b){this._SetImageAngle(f.toRadians(b))},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()},async LoadURL(b,a){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==b){a=this._runtime;var c=f.New(f.ImageInfo);try{await c.LoadDynamicAsset(a,
b);if(!c.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return c.Release(),null;if(!await c.LoadStaticTexture(a.GetRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"}))return}catch(d){console.error("Load image from URL failed: ",d);this.Trigger(f.Plugins.TiledBg.Cnds.OnURLFailed);return}this.WasReleased()?c.Release():(this._ReleaseOwnImage(),this._ownImageInfo=c,a.UpdateRender(),await this.TriggerAsync(f.Plugins.TiledBg.Cnds.OnURLLoaded))}}}}
{"use strict";const f=self.C3;f.Plugins.TiledBg.Exps={ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},ImageOffsetX(){return this._imageOffsetX},ImageOffsetY(){return this._imageOffsetY},ImageScaleX(){return 100*this._imageScaleX},ImageScaleY(){return 100*this._imageScaleY},ImageAngle(){return f.toDegrees(this._imageAngle)}}}{"use strict";const f=self.C3;f.Plugins.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=self.C3X,a=[0,0,0],c=["left","center","right"],d=["top","center","bottom"],e=new f.Rect,h=new f.Quad,g=new f.Color;f.Plugins.Text.Instance=class extends f.SDKWorldInstanceBase{constructor(q,t){super(q);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.GetRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(!1);t&&(this._text=t[0],this._enableBBcode=!!t[1],this._faceName=t[2],this._ptSize=t[3],this._lineHeightOffset=t[4],this._isBold=!!t[5],this._isItalic=!!t[6],this._horizontalAlign=t[8],this._verticalAlign=t[9],this._wrapByWord=0===t[10],q=t[7],this._color.setRgb(q[0],q[1],q[2]),this.GetWorldInfo().SetVisible(t[11]));
this._UpdateTextSettings()}Release(){this._CancelTypewriter();this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const q=this._rendererText;q.SetText(this._text);q.SetBBCodeEnabled(this._enableBBcode);q.SetFontName(this._faceName);q.SetLineHeight(this._lineHeightOffset);q.SetBold(this._isBold);q.SetItalic(this._isItalic);q.SetColor(this._color);q.SetHorizontalAlignment(c[this._horizontalAlign]);q.SetVerticalAlignment(d[this._verticalAlign]);q.SetWordWrapMode(this._wrapByWord?
"word":"character")}_UpdateTextSize(){const q=this.GetWorldInfo();this._rendererText.SetFontSize(this._ptSize);this._rendererText.SetFontSizeScale(q.GetSceneGraphScale());var t=q.GetLayer();t=t.GetRenderScale()*t.Get2DScaleFactorToZ(q.GetTotalZElevation());this._rendererText.SetSize(q.GetWidth(),q.GetHeight(),t)}Draw(q){var t=this.GetWorldInfo();this._UpdateTextSize();const p=this._rendererText.GetTexture();if(p){var r=t.GetLayer();if(0===t.GetAngle()&&0===r.GetAngle()&&0===t.GetTotalZElevation()&&
!t.HasMesh()&&r.RendersIn2DMode()){t=t.GetBoundingQuad();const [x,y]=r.LayerToDrawSurface(t.getTlx(),t.getTly()),[E,H]=r.LayerToDrawSurface(t.getBrx(),t.getBry());t=x-Math.round(x);const A=y-Math.round(y);e.set(x,y,E,H);e.offset(-t,-A);h.setFromRect(e);const [F,J]=q.GetRenderTargetSize(q.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(q,F,J);q.SetTexture(p);q.Quad3(h,this._rendererText.GetTexRect());r._SetTransform(q)}else q.SetTexture(p),t.HasMesh()?this._DrawMesh(t,q):this._DrawStandard(t,
q)}}_DrawStandard(q,t){q=q.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(q=this._PixelRoundQuad(q));t.Quad3(q,this._rendererText.GetTexRect())}_DrawMesh(q,t){const p=q.GetTransformedMesh();if(q.IsMeshChanged()){q.CalculateBbox(e,h,!1);let r=h;this._runtime.IsPixelRoundingEnabled()&&(r=this._PixelRoundQuad(r));p.CalculateTransformedMesh(q.GetSourceMesh(),r,this._rendererText.GetTexRect());q.SetMeshChanged(!1)}p.Draw(t)}_PixelRoundQuad(q){const t=q.getTlx()-Math.round(q.getTlx()),p=q.getTly()-
Math.round(q.getTly());if(0===t&&0===p)return q;h.copy(q);h.offset(-t,-p);return h}SaveToJson(){const q={t:this._text,c:this._color.toJSON(),fn:this._faceName,ps:this._ptSize};this._enableBBcode&&(q.bbc=this._enableBBcode);0!==this._horizontalAlign&&(q.ha=this._horizontalAlign);0!==this._verticalAlign&&(q.va=this._verticalAlign);this._wrapByWord||(q.wr=this._wrapByWord);0!==this._lineHeightOffset&&(q.lho=this._lineHeightOffset);this._isBold&&(q.b=this._isBold);this._isItalic&&(q.i=this._isItalic);
-1!==this._typewriterEndTime&&(q.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return q}LoadFromJson(q){this._CancelTypewriter();this._text=q.t;this._color.setFromJSON(q.c);this._faceName=q.fn;this._ptSize=q.ps;this._enableBBcode=q.hasOwnProperty("bbc")?q.bbc:!1;this._horizontalAlign=q.hasOwnProperty("ha")?q.ha:0;this._verticalAlign=q.hasOwnProperty("va")?q.va:0;this._wrapByWord=q.hasOwnProperty("wr")?q.wr:!0;this._lineHeightOffset=q.hasOwnProperty("lho")?
q.lho:0;this._isBold=q.hasOwnProperty("b")?q.b:!1;this._isItalic=q.hasOwnProperty("i")?q.i:!1;q.hasOwnProperty("tw")&&(q=q.tw,this._typewriterStartTime=q.st,this._typewriterEndTime=q.en,this._typewriterLength=q.l);this._UpdateTextSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(q){switch(q){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._faceName;case 3:return this._ptSize;case 4:return this._lineHeightOffset;case 5:return this._isBold;
case 6:return this._isItalic;case 7:return a[0]=this._color.getR(),a[1]=this._color.getG(),a[2]=this._color.getB(),a;case 8:return this._horizontalAlign;case 9:return this._verticalAlign;case 10:return this._wrapByWord?1:0}}SetPropertyValueByIndex(q,t){switch(q){case 0:if(this._text===t)break;this._text=t;this._UpdateTextSettings();break;case 1:if(this._enableBBcode===!!t)break;this._enableBBcode=!!t;this._UpdateTextSettings();break;case 2:if(this._faceName===t)break;this._faceName=t;this._UpdateTextSettings();
break;case 3:if(this._ptSize===t)break;this._ptSize=t;this._UpdateTextSettings();break;case 4:if(this._lineHeightOffset===t)break;this._lineHeightOffset=t;this._UpdateTextSettings();break;case 5:if(this._isBold===!!t)break;this._isBold=!!t;this._UpdateTextSettings();break;case 6:if(this._isItalic===!!t)break;this._isItalic=!!t;this._UpdateTextSettings();break;case 7:q=this._color;if(q.getR()===t[0]&&q.getG()===t[1]&&q.getB()===t[2])break;this._color.setRgb(t[0],t[1],t[2]);this._UpdateTextSettings();
break;case 8:if(this._horizontalAlign===t)break;this._horizontalAlign=t;this._UpdateTextSettings();break;case 9:if(this._verticalAlign===t)break;this._verticalAlign=t;this._UpdateTextSettings();break;case 10:this._wrapByWord!==(0===t)&&(this._wrapByWord=0===t,this._UpdateTextSettings())}}SetPropertyColorOffsetValueByIndex(q,t,p,r){if(0!==t||0!==p||0!==r)switch(q){case 7:this._color.addRgb(t,p,r),this._UpdateTextSettings()}}_SetText(q){this._text!==q&&(this._text=q,this._rendererText.SetText(q),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(q,
t){this._SetText(q);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+t/this.GetInstance().GetActiveTimeScale();this._typewriterLength=f.BBString.StripAnyTags(q).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(q){this._faceName!==q&&(this._faceName=q,this._rendererText.SetFontName(q),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(q){q=!!q;this._isBold!==q&&(this._isBold=q,this._rendererText.SetBold(q),this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(q){q=!!q;this._isItalic!==q&&(this._isItalic=q,this._rendererText.SetItalic(q),
this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(q){this._ptSize!==q&&(this._ptSize=q,this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetFontColor(q){this._color.equalsIgnoringAlpha(q)||(this._color.copyRgb(q),this._rendererText.SetColor(this._color),this._runtime.UpdateRender())}_GetFontColor(){return this._color}_SetLineHeight(q){this._lineHeightOffset!==q&&(this._lineHeightOffset=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(q){this._horizontalAlign!==
q&&(this._horizontalAlign=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(q){this._verticalAlign!==q&&(this._verticalAlign=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(q){q=!!q;this._wrapByWord!==q&&(this._wrapByWord=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}_GetTextWidth(){this._UpdateTextSize();return this._rendererText.GetTextWidth()}_GetTextHeight(){this._UpdateTextSize();
return this._rendererText.GetTextHeight()}Tick(){var q=this._runtime.GetWallTime();q>=this._typewriterEndTime?(this._CancelTypewriter(),this.Trigger(f.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(q=f.relerp(this._typewriterStartTime,this._typewriterEndTime,q,0,this._typewriterLength),q=Math.floor(q),q!==this._rendererText.GetDrawMaxCharacterCount()&&(this._rendererText.SetDrawMaxCharacterCount(q),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.text.name",
properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:q=>this._SetText(q)}]}]}GetScriptInterfaceClass(){return self.ITextInstance}};const l=new WeakMap,m=new Map([["left",0],["center",1],["right",2]]),u=new Map([["top",0],["center",1],["bottom",2]]),w=new Map([["word",!0],["character",!1]]);self.ITextInstance=class extends self.IWorldInstance{constructor(){super();l.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return l.get(this).GetText()}set text(q){b.RequireString(q);
const t=l.get(this);t._CancelTypewriter();t._SetText(q)}typewriterText(q,t){b.RequireString(q);b.RequireFiniteNumber(t);const p=l.get(this);p._CancelTypewriter();p._StartTypewriter(q,t)}typewriterFinish(){l.get(this)._FinishTypewriter()}set fontFace(q){b.RequireString(q);l.get(this)._SetFontFace(q)}get fontFace(){return l.get(this)._GetFontFace()}set isBold(q){l.get(this)._SetBold(q)}get isBold(){return l.get(this)._IsBold()}set isItalic(q){l.get(this)._SetItalic(q)}get isItalic(){return l.get(this)._IsItalic()}set sizePt(q){b.RequireFiniteNumber(q);
l.get(this)._SetFontSize(q)}get sizePt(){return l.get(this)._GetFontSize()}set fontColor(q){b.RequireArray(q);if(3>q.length)throw Error("expected 3 elements");g.setRgb(q[0],q[1],q[2]);l.get(this)._SetFontColor(g)}get fontColor(){const q=l.get(this)._GetFontColor();return[q.getR(),q.getG(),q.getB()]}set lineHeight(q){b.RequireFiniteNumber(q);l.get(this)._SetLineHeight(q)}get lineHeight(){return l.get(this)._GetLineHeight()}set horizontalAlign(q){b.RequireString(q);q=m.get(q);if("undefined"===typeof q)throw Error("invalid mode");
l.get(this)._SetHAlign(q)}get horizontalAlign(){return c[l.get(this)._GetHAlign()]}set verticalAlign(q){b.RequireString(q);q=u.get(q);if("undefined"===typeof q)throw Error("invalid mode");l.get(this)._SetVAlign(q)}get verticalAlign(){return d[l.get(this)._GetVAlign()]}set wordWrapMode(q){b.RequireString(q);q=w.get(q);if("undefined"===typeof q)throw Error("invalid mode");l.get(this)._SetWrapByWord(q)}get wordWrapMode(){return l.get(this)._IsWrapByWord()?"word":"character"}get textWidth(){return l.get(this)._GetTextWidth()}get textHeight(){return l.get(this)._GetTextHeight()}}}
{"use strict";const 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,c){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._StartTypewriter(a.toString(),c)},SetFontFace(a,c){let d=!1,e=!1;
switch(c){case 1:d=!0;break;case 2:e=!0;break;case 3:e=d=!0}if(a!==this._faceName||d!==this._isBold||e!==this._isItalic)this._SetFontFace(a),this._SetBold(d),this._SetItalic(e)},SetFontSize(a){this._SetFontSize(a)},SetFontColor(a){b.setFromRgbValue(a);b.clamp();this._SetFontColor(b)},SetWebFont(a,c){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()},
SetLineHeight(a){this._SetLineHeight(a)},SetHAlign(a){this._SetHAlign(a)},SetVAlign(a){this._SetVAlign(a)},SetWrapping(a){this._SetWrapByWord(0===a)}}}{"use strict";const 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(){return this._GetTextWidth()},TextHeight(){return this._GetTextHeight()},LineHeight(){return this._lineHeightOffset}}}
{"use strict";const f=self.C3;f.Plugins.NinePatch=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const f=self.C3;f.Plugins.NinePatch.Type=class extends f.SDKTypeBase{constructor(b){super(b);this._drawable=this._textureSet=null}Release(){this.ReleaseTextures();super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}async LoadTextures(b){this._drawable=await this.GetImageInfo().ExtractImageToCanvas()}CreatePatch(b,a,c,d){!this._textureSet&&this._drawable&&(this._textureSet=new self.NinePatchTextureSet(this),this._textureSet.CreateTextures(this._drawable,b,a,c,d))}ReleaseTextures(){this._textureSet&&
(this._textureSet.Release(),this._textureSet=null)}GetTextureSet(){return this._textureSet}}}
{"use strict";const f=self.C3,b=f.New(f.Rect),a=f.New(f.Rect),c=f.New(f.Quad);f.Plugins.NinePatch.Instance=class extends f.SDKWorldInstanceBase{constructor(d,e){super(d);this._bottomMargin=this._topMargin=this._rightMargin=this._leftMargin=16;this._fill=this._edges=1;this._isSeamless=!0;this._callback3d=null;e&&(this._leftMargin=e[0],this._rightMargin=e[1],this._topMargin=e[2],this._bottomMargin=e[3],this._edges=e[4],this._fill=e[5],this._isSeamless=!!e[8],this.GetWorldInfo().SetVisible(!!e[6]));
this._sdkType.CreatePatch(this._leftMargin,this._rightMargin,this._topMargin,this._bottomMargin)}Release(){super.Release()}_Set3DCallback(d){this._callback3d=d}Draw(d){const e=this.GetWorldInfo(),h=e.GetBoundingQuad();this._Draw(d,h.getTlx(),h.getTly(),e.GetWidth(),e.GetHeight())}_Draw(d,e,h,g,l){let m=this._sdkType.GetTextureSet();if(!m&&(this._sdkType.CreatePatch(this._leftMargin,this._rightMargin,this._topMargin,this._bottomMargin),m=this._sdkType.GetTextureSet(),!m))return;const u=this._leftMargin,
w=this._rightMargin,q=this._topMargin,t=this._bottomMargin;var p=m.GetImageWidth(),r=m.GetImageHeight();p-=w;r-=t;var x=this._isSeamless?1:0;const y=this._edges,E=this._fill;0<u&&0<q&&this._DrawPatch(d,m.GetTexture(),0,0,u+x,q+x,e,h,u+x,q+x);0<w&&0<q&&this._DrawPatch(d,m.GetTexture(),p-x,0,w+x,q+x,e+g-w-x,h,w+x,q+x);0<w&&0<t&&this._DrawPatch(d,m.GetTexture(),p-x,r-x,w+x,t+x,e+g-w-x,h+l-t-x,w+x,t+x);0<u&&0<t&&this._DrawPatch(d,m.GetTexture(),0,r-x,u+x,t+x,e,h+l-t-x,u+x,t+x);0===y?(x=2===E?0:x,0<u&&
r>q&&this._TilePatch(d,m.GetLeftTexture(),e,h+q,u+x,l-q-t,0,0),0<w&&r>q&&this._TilePatch(d,m.GetRightTexture(),e+g-w-x,h+q,w+x,l-q-t,x,0),0<q&&p>u&&this._TilePatch(d,m.GetTopTexture(),e+u,h,g-u-w,q+x,0,0),0<t&&p>u&&this._TilePatch(d,m.GetBottomTexture(),e+u,h+l-t-x,g-u-w,t+x,0,x)):1===y&&(0<u&&r>q&&this._DrawPatch(d,m.GetTexture(),0,q,u,r-q,e,h+q,u,l-q-t),0<w&&r>q&&this._DrawPatch(d,m.GetTexture(),p,q,w,r-q,e+g-w,h+q,w,l-q-t),0<q&&p>u&&this._DrawPatch(d,m.GetTexture(),u,0,p-u,q,e+u,h,g-u-w,q),0<t&&
p>u&&this._DrawPatch(d,m.GetTexture(),u,r,p-u,t,e+u,h+l-t,g-u-w,t));r>q&&p>u&&(0===E?this._TilePatch(d,m.GetFillTexture(),e+u,h+q,g-u-w,l-q-t,0,0):1===E&&this._DrawPatch(d,m.GetTexture(),u,q,p-u,r-q,e+u,h+q,g-u-w,l-q-t))}_DrawPatch(d,e,h,g,l,m,u,w,q,t){const p=e.GetWidth(),r=e.GetHeight();d.SetTexture(e);b.set(u,w,u+q,w+t);a.set(h/p,g/r,(h+l)/p,(g+m)/r);null===this._callback3d?(e=this.GetWorldInfo(),g=e.GetBoundingQuad(),h=g.getTlx(),g=g.getTly(),b.offset(-h,-g),c.setFromRotatedRect(b,e.GetAngle()),
c.offset(h,g),d.Quad3(c,a)):this._callback3d(b,a)}_TilePatch(d,e,h,g,l,m,u,w){const q=e.GetWidth(),t=e.GetHeight();d.SetTexture(e);b.set(h,g,h+l,g+m);a.set(-u/q,-w/t,(l-u)/q,(m-w)/t);null===this._callback3d?(e=this.GetWorldInfo(),g=e.GetBoundingQuad(),h=g.getTlx(),g=g.getTly(),b.offset(-h,-g),c.setFromRotatedRect(b,e.GetAngle()),c.offset(h,g),d.Quad3(c,a)):this._callback3d(b,a)}GetCurrentImageInfo(){this._objectClass.GetImageInfo()}GetPropertyValueByIndex(d){}SetPropertyValueByIndex(d,e){}}}"use strict";
self.C3.Plugins.NinePatch.Cnds={};"use strict";self.C3.Plugins.NinePatch.Acts={SetEffect(f){this.GetWorldInfo().SetBlendMode(f);this._runtime.UpdateRender()}};"use strict";self.C3.Plugins.NinePatch.Exps={};
{"use strict";const f=self.C3;function b(a){const c=f.CreateCanvas(a.width,a.height);c.getContext("2d").drawImage(a,0,0);return c}self.NinePatchTextureSet=class{constructor(a){this._sdkType=a;this._runtime=this._sdkType.GetRuntime();this._bottomTexture=this._topTexture=this._rightTexture=this._leftTexture=this._fillTexture=this._texture=null;this._imageHeight=this._imageWidth=0;this._renderer=this._runtime.GetRenderer();this._wasReleased=this._isLoading=!1}Release(){this._renderer.IsContextLost()||
(this._renderer.DeleteTexture(this._texture),this._renderer.DeleteTexture(this._fillTexture),this._renderer.DeleteTexture(this._leftTexture),this._renderer.DeleteTexture(this._rightTexture),this._renderer.DeleteTexture(this._topTexture),this._renderer.DeleteTexture(this._bottomTexture));this._renderer=this._sdkType=this._bottomTexture=this._topTexture=this._rightTexture=this._leftTexture=this._fillTexture=this._texture=null;this._wasReleased=!0}WasReleased(){return this._wasReleased}CreateTextures(a,
c,d,e,h){this._SliceImage(a,c,d,e,h)}HasCreatedTextures(){return!!this._texture}_SliceImage(a,c,d,e,h){if(!this._wasReleased){var g=a.width,l=a.height;this._imageWidth=g;this._imageHeight=l;var m=g-d,u=l-h,w=this._runtime.GetSampling(),q=this._runtime.GetCanvasManager().GetTextureAnisotropy();this._texture=this._renderer.CreateStaticTexture(b(a),{sampling:w,anisotropy:q});m>c&&u>e&&(this._fillTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),c,e,m,u),{wrapX:"repeat",wrapY:"repeat",
sampling:w,anisotropy:q}));0<c&&u>e&&(this._leftTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),0,e,c,u),{wrapY:"repeat",sampling:w,anisotropy:q}));0<d&&u>e&&(this._rightTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),m,e,g,u),{wrapY:"repeat",sampling:w,anisotropy:q}));0<e&&m>c&&(this._topTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),c,0,m,e),{wrapX:"repeat",sampling:w,anisotropy:q}));0<h&&m>c&&(this._bottomTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(b(a),
c,u,m,l),{wrapX:"repeat",sampling:w,anisotropy:q}))}}_SliceSubImage(a,c,d,e,h){e-=c;h-=d;const g=f.CreateCanvas(e,h);g.getContext("2d").drawImage(a,c,d,e,h,0,0,e,h);return g}GetImageWidth(){return this._imageWidth}GetImageHeight(){return this._imageHeight}GetTexture(){return this._texture}GetFillTexture(){return this._fillTexture}GetLeftTexture(){return this._leftTexture}GetRightTexture(){return this._rightTexture}GetTopTexture(){return this._topTexture}GetBottomTexture(){return this._bottomTexture}}}
{"use strict";const f=self.C3;f.Plugins.Particles=class extends f.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Plugins.Particles.Type=class extends f.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(b){return this.GetImageInfo().LoadStaticTexture(b,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}}
{"use strict";const f=self.C3,b=f.New(f.Rect);f.Plugins.Particles.Instance=class extends f.SDKWorldInstanceBase{constructor(a,c){super(a);this._isFirstTick=!0;this._particleEngine=a=f.New(self.ParticleEngine);a.ononeshotfinish=()=>this._OnOneShotFinish();this._spawnObjectClass=null;this._particleUpdateCallback=(e,h,g,l,m,u)=>this._OnParticleUpdate(e,h,g,l,m,u);this._particleDestroyCallback=e=>this._OnParticleDestroy(e);this._hasAnyDefaultParticle=!0;c&&(a.SetRate(c[0]),a.SetSprayCone(f.toRadians(c[1])),
a.SetSprayType(c[2]?"one-shot":"continuous-spray"),this._SetParticleObjectClass(this._runtime.GetObjectClassBySID(c[3])),a.SetInitSpeed(c[4]),a.SetInitSize(c[5]),a.SetInitOpacity(c[6]/100),a.SetGrowRate(c[7]),a.SetInitXRandom(c[8]),a.SetInitYRandom(c[9]),a.SetInitSpeedRandom(c[10]),a.SetInitSizeRandom(c[11]),a.SetGrowRandom(c[12]),a.SetAcceleration(c[13]),a.SetGravity(c[14]),a.SetLifeAngleRandom(c[15]),a.SetLifeSpeedRandom(c[16]),a.SetLifeOpacityRandom(c[17]),a.SetDestroyModeIndex(c[18]),a.SetTimeout(c[19]));
this._UpdateEngineParameters();this._spawnObjectClass&&(this._hasAnyDefaultParticle=!1);"one-shot"===a.GetSprayType()?a.CreateOneShotSpray():a.SetSpraying(!0);const d=this.GetWorldInfo();d.SetBboxChangeEventEnabled(!0);this._inst.Dispatcher().addEventListener("bboxchange",()=>{d.OverwriteBoundingBox(this._particleEngine.GetBoundingBox())});this.GetRuntime().GetRenderer().IsWebGPU()&&d.SetUsePointsShaderProgram();this._afterLoad=e=>this._OnAfterLoad(e);this.GetRuntime().Dispatcher().addEventListener("afterload",
this._afterLoad);this._StartTicking()}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;this._particleEngine.Release();this._particleDestroyCallback=this._particleUpdateCallback=this._particleEngine=null;super.Release()}_SetParticleObjectClass(a){a===this.GetObjectClass()&&(a=null);this._spawnObjectClass=a;this._particleEngine.onparticlecreate=a?c=>this._OnParticleCreate(c):null;this._spawnObjectClass||(this._hasAnyDefaultParticle=!0)}_UpdateEngineParameters(){const a=
this._particleEngine,c=this.GetWorldInfo();a.SetMasterOpacity(c.GetOpacity());a.SetPixelRounding(this._runtime.IsPixelRoundingEnabled());a.SetSpawnX(c.GetX());a.SetSpawnY(c.GetY());a.SetSpawnAngle(c.GetAngle());a.SetInitSizeScale(c.GetSceneGraphScale())}_OnOneShotFinish(){this._runtime.DestroyInstance(this._inst)}Draw(a){if(this._hasAnyDefaultParticle){var c=this._objectClass.GetImageInfo(),d=c.GetTexture();if(d){var e=this.GetWorldInfo(),h=e.GetLayer();this._runtime.GetCanvasManager().IsPastingToDrawingCanvas()?
b.set(-Infinity,-Infinity,Infinity,Infinity):h.Has3DCamera()?h.CalculateViewport3D(e.GetTotalZElevation(),b):h.GetViewportForZ(e.GetTotalZElevation(),b);a.SetTexture(d);d=h.Get2DScaleFactorToZ(e.GetTotalZElevation());this._particleEngine.SetParticleScale(h.GetRenderScale()*d);this._particleEngine.Draw(a,c.GetTexRect(),b,h.Has3DCamera())}}}SaveToJson(){const a=this._particleEngine;return{r:a.GetRate(),sc:a.GetSprayCone(),st:a.GetSprayType(),isp:a.GetInitSpeed(),isz:a.GetInitSize(),io:a.GetInitOpacity(),
gr:a.GetGrowRate(),xr:a.GetInitXRandom(),yr:a.GetInitYRandom(),spr:a.GetInitSpeedRandom(),szr:a.GetInitSizeRandom(),grnd:a.GetGrowRandom(),acc:a.GetAcceleration(),g:a.GetGravity(),lar:a.GetLifeAngleRandom(),lsr:a.GetLifeSpeedRandom(),lor:a.GetLifeOpacityRandom(),dm:a.GetDestroyModeIndex(),to:a.GetTimeout(),s:a.IsSpraying(),pcc:a._GetCreateCounter(),ft:this._isFirstTick,p:a.GetParticles().map(c=>c.toJSON())}}LoadFromJson(a){var c=this._particleEngine;c.SetRate(a.r);c.SetSprayCone(a.sc);c.SetSprayType(a.st);
c.SetInitSpeed(a.isp);c.SetInitSize(a.isz);c.SetInitOpacity(a.io);c.SetGrowRate(a.gr);c.SetInitXRandom(a.xr);c.SetInitYRandom(a.yr);c.SetInitSpeedRandom(a.spr);c.SetInitSizeRandom(a.szr);c.SetGrowRandom(a.grnd);c.SetAcceleration(a.acc);c.SetGravity(a.g);c.SetLifeAngleRandom(a.lar);c.SetLifeSpeedRandom(a.lsr);c.SetLifeOpacityRandom(a.lor);c.SetDestroyModeIndex(a.dm);c.SetTimeout(a.to);c.SetSpraying(a.s);c._SetCreateCounter(a.pcc);this._isFirstTick=a.ft;a=a.p;c.SetParticleCount(a.length);c=c.GetParticles();
for(let e=0,h=c.length;e<h;++e){const g=c[e];g.setFromJSON(a[e]);var d=g.GetUserData();d&&(d=d.GetWorldInfo(),d.SetX(g.GetX()),d.SetY(g.GetY()),d.SetSize(g.GetSize(),g.GetSize()),d.SetOpacity(g.GetOpacity()),d.SetAngle(g.GetAngle()),d.SetUnpremultipliedColor(this.GetWorldInfo().GetUnpremultipliedColor()))}}_OnAfterLoad(){var a=this._particleEngine;if("one-shot"===a.GetSprayType()){a=a.GetParticles();for(let e=0,h=a.length;e<h;++e){var c=a[e],d=c.GetUserData();d&&(d=d.GetWorldInfo())&&(d=d.GetInstance())&&
(c=c.GetUserDataUID(),d=d.GetUID(),"number"!==typeof c||"number"!==typeof d||c!==d)&&(d=this.GetRuntime(),(c=d.GetInstanceByUID(c))&&d.DestroyInstance(c))}}}Tick(){const a=this._runtime.GetDt(this._inst);this._UpdateEngineParameters();this._isFirstTick&&"one-shot"===this._particleEngine.GetSprayType()&&this._particleEngine.ReInitAllParticles();this._particleEngine.Tick(a);this._particleEngine.IsSpraying()&&this._runtime.UpdateRender();this.GetWorldInfo().SetBboxChanged();this._isFirstTick=!1}_OnParticleCreate(a){const c=
this._runtime.CreateInstance(this._spawnObjectClass,this.GetWorldInfo().GetLayer(),a.GetX(),a.GetY()),d=c.GetWorldInfo();d.SetSize(a.GetSize(),a.GetSize());d.SetAngle(a.GetAngle());d.SetOpacity(a.GetOpacity());d.SetUnpremultipliedColor(this.GetWorldInfo().GetUnpremultipliedColor());d.SetBboxChanged();d.ZOrderMoveAdjacentToInstance(this.GetInstance(),!0);c._TriggerOnCreated();a.SetUpdateCallback(this._particleUpdateCallback);a.SetDestroyCallback(this._particleDestroyCallback);return c}_OnParticleUpdate(a,
c,d,e,h,g){a.IsDestroyed()||(a=a.GetWorldInfo(),a.OffsetXY(c,d),a.SetSize(a.GetWidth()+e,a.GetHeight()+e),a.SetAngle(a.GetAngle()+h),a.SetOpacity(a.GetOpacity()+g),a.SetBboxChanged())}_OnParticleDestroy(a){a.IsDestroyed()||this._runtime.DestroyInstance(a)}GetPropertyValueByIndex(a){const c=this._particleEngine;switch(a){case 0:return c.GetRate();case 1:return f.toDegrees(c.GetSprayCone());case 2:return"one-shot"===c.GetSprayType()?1:0;case 4:return c.GetInitSpeed();case 5:return c.GetInitSize();case 6:return 100*
c.GetInitOpacity();case 7:return c.GetGrowRate();case 8:return c.GetInitXRandom();case 9:return c.GetInitYRandom();case 10:return c.GetInitSpeedRandom();case 11:return c.GetInitSizeRandom();case 12:return c.GetGrowRandom();case 13:return c.GetAcceleration();case 14:return c.GetGravity();case 15:return c.GetLifeAngleRandom();case 16:return c.GetLifeSpeedRandom();case 17:return c.GetLifeOpacityRandom();case 18:return c.GetDestroyModeIndex();case 19:return c.GetTimeout()}}SetPropertyValueByIndex(a,c){const d=
this._particleEngine;switch(a){case 0:d.SetRate(c);break;case 1:d.SetSprayCone(f.toRadians(c));break;case 2:d.SetSprayType(c?"one-shot":"continuous-spray");break;case 4:d.SetInitSpeed(c);break;case 5:d.SetInitSize(c);break;case 6:d.SetInitOpacity(c/100);break;case 7:d.SetGrowRate(c);break;case 8:d.SetInitXRandom(c);break;case 9:d.SetInitYRandom(c);break;case 10:d.SetInitSpeedRandom(c);break;case 11:d.SetInitSizeRandom(c);break;case 12:d.SetGrowRandom(c);break;case 13:d.SetAcceleration(c);break;case 14:d.SetGravity(c);
break;case 15:d.SetLifeAngleRandom(c);break;case 16:d.SetLifeSpeedRandom(c);break;case 17:d.SetLifeOpacityRandom(c);break;case 18:d.SetDestroyModeIndex(c);break;case 19:d.SetTimeout(c)}}GetDebuggerProperties(){const a=this._particleEngine;return[{title:"plugins.particles.name",properties:[{name:"plugins.particles.debugger.particle-count",value:a.GetParticleCount()},{name:"plugins.particles.properties.type.name",value:["plugins.particles.properties.type.items."+a.GetSprayType()]},{name:"plugins.particles.debugger.is-spraying",
value:a.IsSpraying(),onedit:c=>a.SetSpraying(c)},{name:"plugins.particles.properties.rate.name",value:a.GetRate(),onedit:c=>a.SetRate(c)},{name:"plugins.particles.properties.spray-cone.name",value:f.toDegrees(a.GetSprayCone()),onedit:c=>a.SetSprayCone(f.toRadians(c))},{name:"plugins.particles.properties.speed.name",value:a.GetInitSpeed(),onedit:c=>a.SetInitSpeed(c)},{name:"plugins.particles.properties.size.name",value:a.GetInitSize(),onedit:c=>a.SetInitSize(c)},{name:"plugins.particles.properties.opacity.name",
value:a.GetInitOpacity(),onedit:c=>a.SetInitOpacity(c)},{name:"plugins.particles.properties.grow-rate.name",value:a.GetGrowRate(),onedit:c=>a.SetGrowRate(c)},{name:"plugins.particles.properties.x-randomiser.name",value:a.GetInitXRandom(),onedit:c=>a.SetInitXRandom(c)},{name:"plugins.particles.properties.y-randomiser.name",value:a.GetInitYRandom(),onedit:c=>a.SetInitYRandom(c)},{name:"plugins.particles.properties.initial-speed-randomiser.name",value:a.GetInitSpeedRandom(),onedit:c=>a.SetInitSpeedRandom(c)},
{name:"plugins.particles.properties.size-randomiser.name",value:a.GetInitSizeRandom(),onedit:c=>a.SetInitSizeRandom(c)},{name:"plugins.particles.properties.grow-rate-randomiser.name",value:a.GetGrowRandom(),onedit:c=>a.SetGrowRandom(c)},{name:"plugins.particles.properties.acceleration.name",value:a.GetAcceleration(),onedit:c=>a.SetAcceleration(c)},{name:"plugins.particles.properties.gravity.name",value:a.GetGravity(),onedit:c=>a.SetGravity(c)},{name:"plugins.particles.properties.angle-randomiser.name",
value:a.GetLifeAngleRandom(),onedit:c=>a.SetLifeAngleRandom(c)},{name:"plugins.particles.properties.life-speed-randomiser.name",value:a.GetLifeSpeedRandom(),onedit:c=>a.SetLifeSpeedRandom(c)},{name:"plugins.particles.properties.opacity-randomiser.name",value:a.GetLifeOpacityRandom(),onedit:c=>a.SetLifeOpacityRandom(c)},{name:"plugins.particles.properties.timeout.name",value:a.GetTimeout(),onedit:c=>a.SetTimeout(c)}]}]}}}"use strict";self.C3.Plugins.Particles.Cnds={IsSpraying(){return this._particleEngine.IsSpraying()}};
{"use strict";const f=self.C3;f.Plugins.Particles.Acts={SetSpraying(b){this._particleEngine.SetSpraying(0!==b)},SetRate(b){this._particleEngine.SetRate(b);"one-shot"===this._particleEngine.GetSprayType()&&this._isFirstTick&&this._particleEngine.SetParticleCount(b)},SetParticleObject(b){this._SetParticleObjectClass(b)},UnsetParticleObject(){this._SetParticleObjectClass(null)},SetSprayCone(b){this._particleEngine.SetSprayCone(f.toRadians(b))},SetInitSpeed(b){this._particleEngine.SetInitSpeed(b)},SetInitSize(b){this._particleEngine.SetInitSize(b)},
SetInitOpacity(b){this._particleEngine.SetInitOpacity(b/100)},SetGrowRate(b){this._particleEngine.SetGrowRate(b)},SetXRandomiser(b){this._particleEngine.SetInitXRandom(b)},SetYRandomiser(b){this._particleEngine.SetInitYRandom(b)},SetSpeedRandomiser(b){this._particleEngine.SetInitSpeedRandom(b)},SetSizeRandomiser(b){this._particleEngine.SetInitSizeRandom(b)},SetGrowRateRandomiser(b){this._particleEngine.SetGrowRandom(b)},SetParticleAcc(b){this._particleEngine.SetAcceleration(b)},SetGravity(b){this._particleEngine.SetGravity(b)},
SetAngleRandomiser(b){this._particleEngine.SetLifeAngleRandom(b)},SetLifeSpeedRandomiser(b){this._particleEngine.SetLifeSpeedRandom(b)},SetOpacityRandomiser(b){this._particleEngine.SetLifeOpacityRandom(b)},SetTimeout(b){this._particleEngine.SetTimeout(b)},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()}}}
{"use strict";const f=self.C3;f.Plugins.Particles.Exps={ParticleCount(){return this._particleEngine.GetParticleCount()},Rate(){return this._particleEngine.GetRate()},SprayCone(){return f.toDegrees(this._particleEngine.GetSprayCone())},InitSpeed(){return this._particleEngine.GetInitSpeed()},InitSize(){return this._particleEngine.GetInitSize()},InitOpacity(){return 100*this._particleEngine.GetInitOpacity()},InitGrowRate(){return this._particleEngine.GetGrowRate()},XRandom(){return this._particleEngine.GetInitXRandom()},
YRandom(){return this._particleEngine.GetInitYRandom()},InitSizeRandom(){return this._particleEngine.GetInitSizeRandom()},InitSpeedRandom(){return this._particleEngine.GetInitSpeedRandom()},InitGrowRandom(){return this._particleEngine.GetGrowRandom()},ParticleAcceleration(){return this._particleEngine.GetAcceleration()},Gravity(){return this._particleEngine.GetGravity()},ParticleAngleRandom(){return this._particleEngine.GetLifeAngleRandom()},ParticleSpeedRandom(){return this._particleEngine.GetLifeSpeedRandom()},
ParticleOpacityRandom(){return this._particleEngine.GetLifeOpacityRandom()},Timeout(){return this._particleEngine.GetTimeout()}}}
{"use strict";const f=self.C3,b=[],a=new Set(["continuous-spray","one-shot"]),c=["fade-to-invisible","timeout-expired","particle-stopped"];self.ParticleEngine=class{constructor(){this._sprayCone=this._rate=0;this._sprayType="continuous-spray";this._isSpraying=!1;this._masterOpacity=0;this._isPixelRounding=!1;this._initSize=this._initSpeed=this._spawnAngle=this._spawnY=this._spawnX=0;this._initSizeScale=1;this._createCounter=this._timeout=this._destroyMode=this._lifeOpacityRandom=this._lifeSpeedRandom=
this._lifeAngleRandom=this._gravity=this._acceleration=this._growRandom=this._initSizeRandom=this._initSpeedRandom=this._yRandom=this._xRandom=this._growRate=this._initOpacity=0;this._particleScale=1;this.onparticlecreate=this.ononeshotfinish=null;this._particles=[];this._boundingBox=new f.Rect;this._color=new f.Color}Release(){this.Cancel();f.clearArray(this._particles);this._color=this._boundingBox=this.onparticlecreate=this.ononeshotfinish=this._particles=null}Cancel(){const d=this._particles;
for(let e=0,h=d.length;e<h;++e)d[e].Destroy();f.appendArray(b,d);f.clearArray(d);1E3<b.length&&f.truncateArray(b,1E3);this._isSpraying=!1}CreateOneShotSpray(){for(let d=0,e=this._rate;d<e;++d)this._CreateParticle();this._particles.length&&(this._isSpraying=!0)}_CreateParticle(){let d;b.length?(d=b.pop(),d.SetEngine(this)):d=f.New(self.Particle,this);this._particles.push(d);d.Init(this.onparticlecreate);return d}ReInitAllParticles(){const d=this._particles,e=this.onparticlecreate;for(let h=0,g=d.length;h<
g;++h)d[h].Init(e)}SetParticleCount(d){var e=this._particles;if(d<e.length){d=e.length-d;for(let h=0;h<d;++h){const g=e.pop();g.Destroy();b.push(g)}1E3<b.length&&f.truncateArray(b,1E3)}else if(d>e.length)for(e=d-e.length,d=0;d<e;++d)this._CreateParticle()}GetParticles(){return this._particles}GetParticleCount(){return this._particles.length}Tick(d){this._SpawnContinuous(d);this._TickParticles(d);this._MaybeFinishOneShot()}_SpawnContinuous(d){if("continuous-spray"===this._sprayType&&this._isSpraying){this._createCounter+=
d*this._rate;d=Math.floor(this._createCounter);this._createCounter-=d;for(let e=0;e<d;++e)this._CreateParticle()}}_SetCreateCounter(d){this._createCounter=d}_GetCreateCounter(){return this._createCounter}_TickParticles(d){const e=this._boundingBox;e.set(this._spawnX,this._spawnY,this._spawnX,this._spawnY);const h=this._particles;let g=0;for(let l=0,m=h.length;l<m;++l){const u=h[l];h[g]=u;u.Tick(d);u.IsActive()?(++g,e.expandToContain(u.GetBoundingBox())):(u.Destroy(),b.push(u))}f.truncateArray(h,g);
1E3<b.length&&f.truncateArray(b,1E3)}_MaybeFinishOneShot(){if("one-shot"===this._sprayType&&0===this._particles.length&&this._isSpraying){if(this.ononeshotfinish)this.ononeshotfinish();this._isSpraying=!1}}Draw(d,e,h,g){d.StartRenderingPoints(e);this._color.copy(d.GetColor());const l=this._particles;for(let m=0,u=l.length;m<u;++m){const w=l[m];h.intersectsRect(w.GetBoundingBox())&&w.Draw(d,e,g)}d.FinishRenderingPoints()}GetColor(){return this._color}SetRate(d){this._rate=+d}GetRate(){return this._rate}SetSprayCone(d){this._sprayCone=
+d}GetSprayCone(){return this._sprayCone}SetSprayType(d){if(!a.has(d))throw Error("invalid spray type");this._sprayType=d}GetSprayType(){return this._sprayType}SetSpraying(d){this._isSpraying=!!d}IsSpraying(){return this._isSpraying}SetMasterOpacity(d){this._masterOpacity=+d}GetMasterOpacity(){return this._masterOpacity}SetPixelRounding(d){this._isPixelRounding=!!d}IsPixelRounding(){return this._isPixelRounding}SetSpawnX(d){this._spawnX=+d}GetSpawnX(){return this._spawnX}SetSpawnY(d){this._spawnY=
+d}GetSpawnY(){return this._spawnY}SetSpawnAngle(d){this._spawnAngle=+d}GetInitAngle(){return this._spawnAngle}SetInitSpeed(d){this._initSpeed=+d}GetInitSpeed(){return this._initSpeed}SetInitSize(d){this._initSize=+d}GetInitSize(){return this._initSize}SetInitSizeScale(d){this._initSizeScale=+d}GetInitSizeScale(){return this._initSizeScale}SetInitOpacity(d){this._initOpacity=+d}GetInitOpacity(){return this._initOpacity}SetGrowRate(d){this._growRate=+d}GetGrowRate(){return this._growRate}SetInitXRandom(d){this._xRandom=
+d}GetInitXRandom(){return this._xRandom}SetInitYRandom(d){this._yRandom=+d}GetInitYRandom(){return this._yRandom}SetInitSpeedRandom(d){this._initSpeedRandom=+d}GetInitSpeedRandom(){return this._initSpeedRandom}SetInitSizeRandom(d){this._initSizeRandom=+d}GetInitSizeRandom(){return this._initSizeRandom}SetGrowRandom(d){this._growRandom=+d}GetGrowRandom(){return this._growRandom}SetAcceleration(d){this._acceleration=+d}GetAcceleration(){return this._acceleration}SetGravity(d){this._gravity=+d}GetGravity(){return this._gravity}SetLifeAngleRandom(d){this._lifeAngleRandom=
+d}GetLifeAngleRandom(){return this._lifeAngleRandom}SetLifeSpeedRandom(d){this._lifeSpeedRandom=+d}GetLifeSpeedRandom(){return this._lifeSpeedRandom}SetLifeOpacityRandom(d){this._lifeOpacityRandom=+d}GetLifeOpacityRandom(){return this._lifeOpacityRandom}SetDestroyMode(d){d=c.indexOf(d);if(-1===d)throw Error("invalid destroy mode");this._destroyMode=d}SetDestroyModeIndex(d){this.SetDestroyMode(c[d])}GetDestroyMode(){return c[this._destroyMode]}GetDestroyModeIndex(){return this._destroyMode}SetTimeout(d){this._timeout=
+d}GetTimeout(){return this._timeout}SetParticleScale(d){this._particleScale=+d}GetParticleScale(){return this._particleScale}GetBoundingBox(){return this._boundingBox}}}
{"use strict";const f=self.C3;function b(h){return Math.random()*h-h/2}const a=new f.Quad,c=new f.Color,d=self.devicePixelRatio||1;let e=!1;self.Particle=class{constructor(h){this._engine=h;this._isActive=!1;this._angle=this._speed=this._y=this._x=0;this._opacity=1;this._age=this._gs=this._halfSize=this._size=this._grow=this._lastOpacity=0;this._bbox=new f.Rect;this._userData=null;this._userDataUid=NaN;this._destroyCallback=this._updateCallback=null}SetEngine(h){this._engine=h}Init(h){const g=this._engine;
this._isActive=!0;this._x=g.GetSpawnX()+b(g.GetInitXRandom());this._y=g.GetSpawnY()+b(g.GetInitYRandom());this._speed=g.GetInitSpeed()+b(g.GetInitSpeedRandom());this._angle=g.GetInitAngle()+b(g.GetSprayCone());this._lastOpacity=this._opacity=g.GetInitOpacity();this._size=(g.GetInitSize()+b(g.GetInitSizeRandom()))*g.GetInitSizeScale();this._halfSize=this._size/2;this._grow=g.GetGrowRate()+b(g.GetGrowRandom());this._age=this._gs=0;this._UpdateBoundingBox();h?this._userData||(this._userData=h(this)):
this._destroyCallback=this._updateCallback=this._userData=null}SetUpdateCallback(h){this._updateCallback=h}SetDestroyCallback(h){this._destroyCallback=h}Destroy(){const h=this._destroyCallback;h&&h(this._userData);this._destroyCallback=this._updateCallback=this._userData=null}toJSON(){let h;this._userData&&(h=this._userData.GetWorldInfo().GetInstance().GetUID());return[this._x,this._y,this._speed,this._angle,this._opacity,this._grow,this._size,this._gs,this._age,h]}setFromJSON(h){this._x=h[0];this._y=
h[1];this._speed=h[2];this._angle=h[3];this._opacity=h[4];this._grow=h[5];this._size=h[6];this._gs=h[7];this._age=h[8];this._userDataUid=h[9];this._halfSize=this._size/2;this._UpdateBoundingBox()}Tick(h){var g=this._engine,l=this._speed*h,m=this._angle;const u=Math.cos(m)*l;l=Math.sin(m)*l+this._gs*h;this._x+=u;this._y+=l;m=this._grow*h;this._size+=m;this._halfSize=this._size/2;this._speed+=g.GetAcceleration()*h;this._gs+=g.GetGravity()*h;this._age+=h;this._UpdateBoundingBox();var w=g.GetLifeAngleRandom(),
q=g.GetLifeSpeedRandom();const t=g.GetLifeOpacityRandom();let p=0;0!==w&&(p=b(w*h),this._angle+=p);0!==q&&(this._speed+=b(q*h));0!==t&&(this._opacity=f.clamp(this._opacity+b(t*h),0,1));h=1<=this._size&&(2===g.GetDestroyModeIndex()?0<this._speed:this._age<g.GetTimeout());(w=this._updateCallback)&&h&&(q=g.GetMasterOpacity()*this._opacity,0===g.GetDestroyModeIndex()&&(q*=1-this._age/g.GetTimeout()),g=q-this._lastOpacity,this._lastOpacity=q,w(this._userData,u,l,m,p,g));this._isActive=h}IsActive(){return this._isActive}GetBoundingBox(){return this._bbox}_UpdateBoundingBox(){const h=
this._x,g=this._y,l=this._halfSize;this._bbox.set(h-l,g-l,h+l,g+l)}Draw(h,g,l){if(!this._userData){var m=this._engine,u=m.GetMasterOpacity()*this._opacity;0===m.GetDestroyModeIndex()&&(u*=1-this._age/m.GetTimeout());if(!(0>=u)){var w=this._size,q=w*m.GetParticleScale()*d;if(!(1>q)){var t=this._x,p=this._y;m.IsPixelRounding()&&(t=t+.5|0,p=p+.5|0);h.IsWebGPU()?h.Point(t,p,w,u):l||q>h.GetMaxPointSize()||q<h.GetMinPointSize()?(c.copy(m.GetColor()),c.multiplyAlpha(u),h.SetColor(c),e=!0,a.setFromRect(this._bbox),
h.Quad3(a,g)):(e&&(h.SetColor(m.GetColor()),e=!1),h.Point(t,p,q,u))}}}}GetUserData(){return this._userData}GetUserDataUID(){return this._userDataUid}GetX(){return this._x}GetY(){return this._y}GetSize(){return this._size}GetAngle(){return this._angle}GetOpacity(){return this._opacity}}}{"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.C3X,a=self.IInstance;function c(e,h,g){if(h<e.length)f.truncateArray(e,h);else if(h>e.length)if("function"===typeof g)for(var l=e.length;l<h;++l)e.push(g());else for(l=e.length;l<h;++l)e.push(g)}f.Plugins.Arr.Instance=class extends f.SDKInstanceBase{constructor(e,h){super(e);this._cx=10;this._cz=this._cy=1;this._arr=null;this._forX=[];this._forY=[];this._forZ=[];this._forDepth=-1;h&&(this._cx=h[0],this._cy=h[1],this._cz=h[2]);this._arr=f.MakeFilledArray(this._cx,
()=>f.MakeFilledArray(this._cy,()=>f.MakeFilledArray(this._cz,0)))}Release(){this._arr=null;super.Release()}At(e,h,g){e=Math.floor(e);h=Math.floor(h);g=Math.floor(g);return 0<=e&&e<this._cx&&0<=h&&h<this._cy&&0<=g&&g<this._cz?this._arr[e][h][g]:0}Set(e,h,g,l){e=Math.floor(e);h=Math.floor(h);g=Math.floor(g);0<=e&&e<this._cx&&0<=h&&h<this._cy&&0<=g&&g<this._cz&&(this._arr[e][h][g]=l)}SetSize(e,h,g){e=Math.floor(e);h=Math.floor(h);g=Math.floor(g);0>e&&(e=0);0>h&&(h=0);0>g&&(g=0);if(this._cx!==e||this._cy!==
h||this._cz!==g){this._cx=e;this._cy=h;this._cz=g;var l=this._arr;c(l,e,()=>f.MakeFilledArray(h,()=>f.MakeFilledArray(g,0)));for(let m=0;m<e;++m){c(l[m],h,()=>f.MakeFilledArray(g,0));for(let u=0;u<h;++u)c(l[m][u],g,0)}}}GetWidth(){return this._cx}GetHeight(){return this._cy}GetDepth(){return this._cz}GetDebuggerProperties(){const e=[{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}]}],h=[];if(1===this._cy&&1===this._cz)for(let g=0;g<this._cx;++g)h.push({name:"$"+g,value:this._arr[g][0][0],onedit:l=>this._arr[g][0][0]=l});else for(let g=0;g<this._cx;++g)h.push({name:"$"+g,value:this._arr[g].toString()});
h.length&&e.push({title:"plugins.arr.debugger.array-data.title",properties:h});return e}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(e){const h=e.size;this._cx=h[0];this._cy=h[1];this._cz=h[2];this._arr=e.data}_GetForX(){return 0<=this._forDepth&&this._forDepth<this._forX.length?this._forX[this._forDepth]:0}_GetForY(){return 0<=this._forDepth&&this._forDepth<
this._forY.length?this._forY[this._forDepth]:0}_GetForZ(){return 0<=this._forDepth&&this._forDepth<this._forZ.length?this._forZ[this._forDepth]:0}GetScriptInterfaceClass(){return self.IArrayInstance}};const d=new WeakMap;self.IArrayInstance=class extends a{constructor(){super();d.set(this,a._GetInitInst().GetSdkInstance())}get width(){return d.get(this).GetWidth()}get height(){return d.get(this).GetHeight()}get depth(){return d.get(this).GetDepth()}setSize(e,h=1,g=1){b.RequireFiniteNumber(e);b.RequireFiniteNumber(h);
b.RequireFiniteNumber(g);d.get(this).SetSize(e,h,g)}getAt(e,h=0,g=0){b.RequireFiniteNumber(e);b.RequireFiniteNumber(h);b.RequireFiniteNumber(g);return d.get(this).At(e,h,g)}setAt(e,h,g=0,l=0){b.RequireFiniteNumber(h);b.RequireFiniteNumber(g);b.RequireFiniteNumber(l);if("number"!==typeof e&&"string"!==typeof e)throw new TypeError("invalid type");d.get(this).Set(h,g,l,e)}}}
{"use strict";const f=self.C3;function b(a,c,d,e,h){a.PushCopySol(d);c.Retrigger(e,h);a.PopSol(d)}f.Plugins.Arr.Cnds={CompareX(a,c,d){return f.compare(this.At(a,0,0),c,d)},CompareXY(a,c,d,e){return f.compare(this.At(a,c,0),d,e)},CompareXYZ(a,c,d,e,h){return f.compare(this.At(a,c,d),e,h)},ArrForEach(a){const c=this._runtime,d=c.GetEventSheetManager(),e=c.GetCurrentEvent(),h=e.GetSolModifiers(),g=c.GetEventStack(),l=g.GetCurrentStackFrame(),m=g.Push(e),u=++this._forDepth,w=this._forX;var q=this._forY,
t=this._forZ;const p=this._cx,r=this._cy;var x=this._cz;u===this._forX.length?(w.push(0),q.push(0),t.push(0)):(w[u]=0,q[u]=0,t[u]=0);c.SetDebuggingEnabled(!1);if(0===a)for(a=0;a<p;++a)for(let y=0;y<r;++y)for(let E=0;E<x;++E)w[u]=a,q[u]=y,t[u]=E,b(d,e,h,l,m);else if(1===a)for(t=0;t<p;++t)for(x=0;x<r;++x)w[u]=t,q[u]=x,b(d,e,h,l,m);else for(q=0;q<p;++q)w[u]=q,b(d,e,h,l,m);c.SetDebuggingEnabled(!0);this._forDepth--;g.Pop();return!1},CompareCurrent(a,c){return f.compare(this.At(this._GetForX(),this._GetForY(),
this._GetForZ()),a,c)},Contains(a){const c=this._cx,d=this._cy,e=this._cz,h=this._arr;for(let g=0;g<c;++g)for(let l=0;l<d;++l)for(let m=0;m<e;++m)if(h[g][l][m]===a)return!0;return!1},IsEmpty(){return 0===this._cx||0===this._cy||0===this._cz},CompareSize(a,c,d){let e=0;switch(a){case 0:e=this._cx;break;case 1:e=this._cy;break;case 2:e=this._cz}return f.compare(e,c,d)}}}
{"use strict";const f=self.C3;function b(a,c){if("number"===typeof a&&"number"===typeof c)return a-c;a=a.toString();c=c.toString();return a<c?-1:a>c?1:0}f.Plugins.Arr.Acts={Clear(a){const c=this._cx,d=this._cy,e=this._cz,h=this._arr;for(let g=0;g<c;++g)for(let l=0;l<d;++l)for(let m=0;m<e;++m)h[g][l][m]=a},SetSize(a,c,d){this.SetSize(a,c,d)},SetX(a,c){this.Set(a,0,0,c)},SetXY(a,c,d){this.Set(a,c,0,d)},SetXYZ(a,c,d,e){this.Set(a,c,d,e)},Push(a,c,d){var e=this._cx,h=this._cy;const g=this._cz,l=this._arr;
if(0===d)e=f.MakeFilledArray(h,()=>f.MakeFilledArray(g,c)),0===a?l.push(e):l.unshift(e),this._cx++;else if(1===d){for(h=0;h<e;++h)d=f.MakeFilledArray(g,c),0===a?l[h].push(d):l[h].unshift(d);this._cy++}else{for(d=0;d<e;++d)for(let m=0;m<h;++m)0===a?l[d][m].push(c):l[d][m].unshift(c);this._cz++}},Pop(a,c){const d=this._cx;var e=this._cy,h=this._cz;const g=this._arr;if(0===c)0!==d&&(0===a?g.pop():g.shift(),this._cx--);else if(1===c){if(0!==e){for(e=0;e<d;++e)0===a?g[e].pop():g[e].shift();this._cy--}}else if(0!==
h){for(c=0;c<d;++c)for(h=0;h<e;++h)0===a?g[c][h].pop():g[c][h].shift();this._cz--}},Reverse(a){const c=this._cx;var d=this._cy,e=this._cz;const h=this._arr;if(0!==c&&0!==d&&0!==e)if(0===a)h.reverse();else if(1===a)for(d=0;d<c;++d)h[d].reverse();else for(a=0;a<c;++a)for(e=0;e<d;++e)h[a][e].reverse()},Sort(a){const c=this._cx;var d=this._cy,e=this._cz;const h=this._arr;if(0!==c&&0!==d&&0!==e)if(0===a)h.sort((g,l)=>b(g[0][0],l[0][0]));else if(1===a)for(d=0;d<c;++d)h[d].sort((g,l)=>b(g[0],l[0]));else for(a=
0;a<c;++a)for(e=0;e<d;++e)h[a][e].sort(b)},Delete(a,c){a=Math.floor(a);if(!(0>a)){var d=this._cx,e=this._cy,h=this._cz,g=this._arr;if(0===c)a>=d||(g.splice(a,1),this._cx--);else if(1===c){if(!(a>=e)){for(e=0;e<d;++e)g[e].splice(a,1);this._cy--}}else if(!(a>=h)){for(c=0;c<d;++c)for(h=0;h<e;++h)g[c][h].splice(a,1);this._cz--}}},Insert(a,c,d){c=Math.floor(c);if(!(0>c)){var e=this._cx,h=this._cy,g=this._cz,l=this._arr;if(0===d)c>e||(l.splice(c,0,f.MakeFilledArray(h,()=>f.MakeFilledArray(g,a))),this._cx++);
else if(1===d){if(!(c>h)){for(h=0;h<e;++h)l[h].splice(c,0,f.MakeFilledArray(g,a));this._cy++}}else if(!(c>g)){for(d=0;d<e;++d)for(let m=0;m<h;++m)l[d][m].splice(c,0,a);this._cz++}}},JSONLoad(a){let c=null;try{c=JSON.parse(a)}catch(d){console.error("[Construct 3] Failed to parse JSON: ",d);return}c.c2array&&(a=c.size,this._cx=a[0],this._cy=a[1],this._cz=a[2],this._arr=c.data)},JSONDownload(a){const c=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(c,
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,c=this._cx;a<c;++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.Behaviors.scrollto=class extends f.SDKBehaviorBase{constructor(b){super(b);this._shakeMode=this._shakeEnd=this._shakeStart=this._shakeMag=0}Release(){super.Release()}SetShakeMagnitude(b){this._shakeMag=b}GetShakeMagnitude(){return this._shakeMag}SetShakeStart(b){this._shakeStart=b}GetShakeStart(){return this._shakeStart}SetShakeEnd(b){this._shakeEnd=b}GetShakeEnd(){return this._shakeEnd}SetShakeMode(b){this._shakeMode=b}GetShakeMode(){return this._shakeMode}}}
{"use strict";const f=self.C3;f.Behaviors.scrollto.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;f.Behaviors.scrollto.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._isEnabled=!0;a&&(this._isEnabled=a[0]);this._isEnabled&&this._StartTicking2()}Release(){super.Release()}SaveToJson(){const b=this.GetBehavior();return{e:this._isEnabled,smg:b.GetShakeMagnitude(),ss:b.GetShakeStart(),se:b.GetShakeEnd(),smd:b.GetShakeMode()}}LoadFromJson(b){const a=this.GetBehavior();a.SetShakeMagnitude(b.smg);a.SetShakeStart(b.ss);a.SetShakeEnd(b.se);
a.SetShakeMode(b.smd);(this._isEnabled=b.e)?this._StartTicking2():this._StopTicking2()}IsEnabled(){return this._isEnabled}Tick2(){if(this.IsEnabled()){this._runtime.GetDt(this._inst);var b=this.GetBehavior(),a=b.GetInstances(),c=0,d=0,e=0;for(var h of a)(a=h.GetBehaviorInstanceFromCtor(f.Behaviors.scrollto))&&a.GetSdkInstance().IsEnabled()&&(a=h.GetWorldInfo(),c+=a.GetX(),d+=a.GetY(),++e);h=this._inst.GetWorldInfo().GetLayout();var g=this._runtime.GetGameTime(),l=a=0;g>=b.GetShakeStart()&&g<b.GetShakeEnd()&&
(a=b.GetShakeMagnitude()*Math.min(this._runtime.GetTimeScale(),1),0===b.GetShakeMode()&&(a*=1-(g-b.GetShakeStart())/(b.GetShakeEnd()-b.GetShakeStart())),b=this._runtime.Random()*Math.PI*2,g=this._runtime.Random()*a,a=Math.cos(b)*g,l=Math.sin(b)*g);h.SetScrollX(c/e+a);h.SetScrollY(d/e+l)}}GetPropertyValueByIndex(b){switch(b){case 0:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:(this._isEnabled=!!a)?this._StartTicking2():this._StopTicking2()}}}}"use strict";
self.C3.Behaviors.scrollto.Cnds={IsEnabled(){return this._isEnabled}};"use strict";self.C3.Behaviors.scrollto.Acts={Shake(f,b,a){const c=this.GetBehavior();c.SetShakeMagnitude(f);c.SetShakeStart(this._runtime.GetGameTime());c.SetShakeEnd(this._runtime.GetGameTime()+b);c.SetShakeMode(a)},SetEnabled(f){(this._isEnabled=0!==f)?this._StartTicking2():this._StopTicking2()}};"use strict";self.C3.Behaviors.scrollto.Exps={};{"use strict";const f=self.C3;f.Behaviors.Sin=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const f=self.C3;f.Behaviors.Sin.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3,b=self.C3X,a=self.IBehaviorInstance,c=2*Math.PI,d=Math.PI/2,e=3*Math.PI/2,h=[0,1,8,3,4,2,5,6,9,7];f.Behaviors.Sin.Instance=class extends f.SDKBehaviorInstanceBase{constructor(u,w){super(u);this._mag=this._period=this._wave=this._movement=this._i=0;this._isEnabled=!0;this._ratio=this._lastKnownValue2=this._lastKnownValue=this._initialValue2=this._initialValue=this._magnitudeRandom=this._periodOffsetRandom=this._periodRandom=this._baseMag=this._basePeriodOffset=this._basePeriod=
0;w&&(this._movement=h[w[0]],this._wave=w[1],this._periodRandom=this._runtime.Random()*w[3],this._basePeriod=w[2],this._period=w[2],this._period+=this._periodRandom,this._basePeriodOffset=w[4],0!==this._period&&(this._periodOffsetRandom=this._runtime.Random()*w[5],this._i=w[4]/this._period*c,this._i+=this._periodOffsetRandom/this._period*c),this._magnitudeRandom=this._runtime.Random()*w[7],this._baseMag=w[6],this._mag=w[6],this._mag+=this._magnitudeRandom,this._isEnabled=!!w[8]);5===this._movement&&
(this._mag=f.toRadians(this._mag));this.Init();this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{i:this._i,e:this._isEnabled,mv:this._movement,w:this._wave,p:this._period,mag:this._mag,iv:this._initialValue,iv2:this._initialValue2,r:this._ratio,lkv:this._lastKnownValue,lkv2:this._lastKnownValue2}}LoadFromJson(u){this._i=u.i;this._SetEnabled(u.e);this._movement=u.mv;this._wave=u.w;this._period=u.p;this._mag=u.mag;this._initialValue=u.iv;this._initialValue2=u.iv2;this._ratio=
u.r;this._lastKnownValue=u.lkv;this._lastKnownValue2=u.lkv2}Init(){const u=this._inst.GetWorldInfo();switch(this._movement){case 0:this._initialValue=u.GetX();break;case 1:this._initialValue=u.GetY();break;case 2:this._initialValue=u.GetWidth();this._ratio=u.GetHeight()/u.GetWidth();break;case 3:this._initialValue=u.GetWidth();break;case 4:this._initialValue=u.GetHeight();break;case 5:this._initialValue=u.GetAngle();break;case 6:this._initialValue=u.GetOpacity();break;case 7:this._initialValue=0;
break;case 8:this._initialValue=u.GetX();this._initialValue2=u.GetY();break;case 9:this._initialValue=u.GetZElevation()}this._lastKnownValue=this._initialValue;this._lastKnownValue2=this._initialValue2}WaveFunc(u){u%=c;switch(this._wave){case 0:return Math.sin(u);case 1:return u<=d?u/d:u<=e?1-2*(u-d)/Math.PI:(u-e)/d-1;case 2:return 2*u/c-1;case 3:return-2*u/c+1;case 4:return u<Math.PI?-1:1}return 0}Tick(){const u=this._runtime.GetDt(this._inst);this._isEnabled&&0!==u&&(this._i=0===this._period?0:
(this._i+u/this._period*c)%c,this._UpdateFromPhase())}_UpdateFromPhase(){const u=this._inst.GetWorldInfo();switch(this._movement){case 0:u.GetX()!==this._lastKnownValue&&(this._initialValue+=u.GetX()-this._lastKnownValue);u.SetX(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetX();break;case 1:u.GetY()!==this._lastKnownValue&&(this._initialValue+=u.GetY()-this._lastKnownValue);u.SetY(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetY();break;
case 2:u.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);u.SetHeight(u.GetWidth()*this._ratio);break;case 3:u.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 4:u.SetHeight(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 5:u.GetAngle()!==this._lastKnownValue&&(this._initialValue=f.clampAngle(this._initialValue+(u.GetAngle()-this._lastKnownValue)));u.SetAngle(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetAngle();
break;case 6:u.SetOpacity(this._initialValue+this.WaveFunc(this._i)*this._mag/100);break;case 8:u.GetX()!==this._lastKnownValue&&(this._initialValue+=u.GetX()-this._lastKnownValue);u.GetY()!==this._lastKnownValue2&&(this._initialValue2+=u.GetY()-this._lastKnownValue2);u.SetX(this._initialValue+Math.cos(u.GetAngle())*this.WaveFunc(this._i)*this._mag);u.SetY(this._initialValue2+Math.sin(u.GetAngle())*this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetX();this._lastKnownValue2=u.GetY();break;
case 9:u.SetZElevation(this._initialValue+this.WaveFunc(this._i)*this._mag)}u.SetBboxChanged()}_OnSpriteFrameChanged(u,w){}_SetPeriod(u){this._period=u}_GetPeriod(){return this._period}_SetMagnitude(u){this._mag=u}_SetMagnitude_ConvertAngle(u){5===this._movement&&(u=f.toRadians(u));this._SetMagnitude(u)}_GetMagnitude(){return this._mag}_GetMagnitude_ConvertAngle(){let u=this._GetMagnitude();5===this._movement&&(u=f.toDegrees(u));return u}_SetMovement(u){5===this._movement&&5!==u&&(this._mag=f.toDegrees(this._mag));
this._movement=u;this.Init()}_GetMovement(){return this._movement}_SetWave(u){this._wave=u}_GetWave(){return this._wave}_SetPhase(u){this._i=f.clamp(u,0,2*Math.PI);this._UpdateFromPhase()}_GetPhase(){return this._i}_SetEnabled(u){(this._isEnabled=!!u)?this._StartTicking():this._StopTicking()}_IsEnabled(){return this._isEnabled}GetPropertyValueByIndex(u){switch(u){case 0:return this._movement;case 1:return this._wave;case 2:return this._basePeriod;case 6:return this._baseMag;case 8:return this._isEnabled}}SetPropertyValueByIndex(u,
w){switch(u){case 0:this._movement=h[w];this.Init();break;case 1:this._wave=w;break;case 2:this._basePeriod=w;this._period=this._basePeriod+this._periodRandom;this._isEnabled||(0!==this._period?(this._i=this._basePeriodOffset/this._period*c,this._i+=this._periodOffsetRandom/this._period*c):this._i=0);break;case 6:this._baseMag=w;this._mag=this._baseMag+this._magnitudeRandom;5===this._movement&&(this._mag=f.toRadians(this._mag));break;case 8:this._isEnabled=!!w}}GetDebuggerProperties(){return[{title:"$"+
this.GetBehaviorType().GetName(),properties:[{name:"behaviors.sin.properties.enabled.name",value:this._IsEnabled(),onedit:u=>this._SetEnabled(u)},{name:"behaviors.sin.properties.period.name",value:this._GetPeriod(),onedit:u=>this._SetPeriod(u)},{name:"behaviors.sin.properties.magnitude.name",value:this._GetMagnitude_ConvertAngle(),onedit:u=>this._SetMagnitude_ConvertAngle(u)},{name:"behaviors.sin.debugger.value",value:this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}]}]}GetScriptInterfaceClass(){return self.ISineBehaviorInstance}};
const g=new WeakMap,l="horizontal vertical size width height angle opacity value-only forwards-backwards z-elevation".split(" "),m=["sine","triangle","sawtooth","reverse-sawtooth","square"];self.ISineBehaviorInstance=class extends a{constructor(){super();g.set(this,a._GetInitInst().GetSdkInstance())}set period(u){b.RequireFiniteNumber(u);g.get(this)._SetPeriod(u)}get period(){return g.get(this)._GetPeriod()}set magnitude(u){b.RequireFiniteNumber(u);g.get(this)._SetMagnitude(u)}get magnitude(){return g.get(this)._GetMagnitude()}set phase(u){g.get(this)._SetPhase(u)}get phase(){return g.get(this)._GetPhase()}set movement(u){b.RequireString(u);
u=l.indexOf(u);if(-1===u)throw Error("invalid movement");g.get(this)._SetMovement(u)}get movement(){return l[g.get(this)._GetMovement()]}set wave(u){b.RequireString(u);u=m.indexOf(u);if(-1===u)throw Error("invalid wave");g.get(this)._SetWave(u)}get wave(){return m[g.get(this)._GetWave()]}get value(){const u=g.get(this);return u.WaveFunc(u._GetPhase())*u._GetMagnitude()}updateInitialState(){g.get(this).Init()}set isEnabled(u){g.get(this)._SetEnabled(!!u)}get isEnabled(){return g.get(this)._IsEnabled()}}}
{"use strict";const f=self.C3;f.Behaviors.Sin.Cnds={IsEnabled(){return this._IsEnabled()},CompareMovement(b){return this._GetMovement()===b},ComparePeriod(b,a){return f.compare(this._GetPeriod(),b,a)},CompareMagnitude(b,a){return f.compare(this._GetMagnitude_ConvertAngle(),b,a)},CompareWave(b){return this._GetWave()===b}}}"use strict";
self.C3.Behaviors.Sin.Acts={SetEnabled(f){this._SetEnabled(0!==f)},SetPeriod(f){this._SetPeriod(f)},SetMagnitude(f){this._SetMagnitude_ConvertAngle(f)},SetMovement(f){this._SetMovement(f)},SetWave(f){this._wave=f},SetPhase(f){const b=2*Math.PI;this._SetPhase(f*b%b)},UpdateInitialState(){this.Init()}};"use strict";
self.C3.Behaviors.Sin.Exps={CyclePosition(){return this._GetPhase()/(2*Math.PI)},Period(){return this._GetPeriod()},Magnitude(){return this._GetMagnitude_ConvertAngle()},Value(){return this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}};{"use strict";const f=self.C3;f.Behaviors.Fade=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Behaviors.Fade.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;f.Behaviors.Fade.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._fadeOutTime=this._waitTime=this._fadeInTime=0;this._activeAtStart=this._destroy=!0;this._setMaxOpacity=!1;this._stage=0;this._stageTime=f.New(f.KahanSum);this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1;a&&(this._fadeInTime=a[0],this._waitTime=a[1],this._fadeOutTime=a[2],this._destroy=!!a[3],this._stage=(this._activeAtStart=!!a[4])?0:3);this._activeAtStart&&(0===
this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender()));this._StartTicking()}Release(){super.Release()}SaveToJson(){return{fit:this._fadeInTime,wt:this._waitTime,fot:this._fadeOutTime,d:this._destroy,s:this._stage,st:this._stageTime.Get(),mo:this._maxOpacity}}LoadFromJson(b){this._fadeInTime=b.fit;this._waitTime=b.wt;this._fadeOutTime=b.fot;this._destroy=b.d;this._stage=b.s;this._stageTime.Set(b.st);this._maxOpacity=
b.mo}Tick(){var b=this._runtime.GetDt(this._inst);this._stageTime.Add(b);b=this._inst.GetWorldInfo();0===this._stage&&(b.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity),this._runtime.UpdateRender(),b.GetOpacity()>=this._maxOpacity&&(b.SetOpacity(this._maxOpacity),this._stage=1,this._stageTime.Reset(),this.Trigger(f.Behaviors.Fade.Cnds.OnFadeInEnd)));1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(f.Behaviors.Fade.Cnds.OnWaitEnd));
2===this._stage&&0!==this._fadeOutTime&&(b.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity),this._runtime.UpdateRender(),0>=b.GetOpacity()&&(this._stage=3,this._stageTime.Reset(),this.Trigger(f.Behaviors.Fade.Cnds.OnFadeOutEnd),this._destroy&&this._runtime.DestroyInstance(this._inst)))}Start(){this._stage=0;this._stageTime.Reset();0===this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender())}GetPropertyValueByIndex(b){switch(b){case 0:return this._fadeInTime;
case 1:return this._waitTime;case 2:return this._fadeOutTime;case 3:return this._destroy}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._fadeInTime=a;break;case 1:this._waitTime=a;break;case 2:this._fadeOutTime=a;break;case 3:this._destroy=!!a}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.fade.properties.fade-in-time.name",value:this._fadeInTime,onedit:b=>this._fadeInTime=b},{name:"behaviors.fade.properties.wait-time.name",value:this._waitTime,
onedit:b=>this._waitTime=b},{name:"behaviors.fade.properties.fade-out-time.name",value:this._fadeOutTime,onedit:b=>this._fadeOutTime=b},{name:"behaviors.fade.debugger.stage",value:["behaviors.fade.debugger."+["fade-in","wait","fade-out","done"][this._stage]]}]}]}}}"use strict";self.C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return!0},OnFadeInEnd(){return!0},OnWaitEnd(){return!0}};"use strict";
self.C3.Behaviors.Fade.Acts={StartFade(){this._activeAtStart||this._setMaxOpacity||(this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1,this._setMaxOpacity=!0);3===this._stage&&this.Start()},RestartFade(){this.Start()},SetFadeInTime(f){0>f&&(f=0);this._fadeInTime=f},SetWaitTime(f){0>f&&(f=0);this._waitTime=f},SetFadeOutTime(f){0>f&&(f=0);this._fadeOutTime=f}};"use strict";self.C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}};
{"use strict";const f=self.C3;f.Behaviors.Pin=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Behaviors.Pin.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;f.Behaviors.Pin.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._pinInst=null;this._pinUid=-1;this._mode="";this._propSet=new Set;this._lastKnownAngle=this._dz=this._dAngle=this._dHeight=this._dWidth=this._dy=this._dx=this._pinImagePoint=this._pinAngle=this._pinDist=0;this._destroy=!1;a&&(this._destroy=a[0]);b=this._runtime.Dispatcher();this._disposables=new f.CompositeDisposable(f.Disposable.From(b,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)),
f.Disposable.From(b,"afterload",c=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(b){b?(this._pinInst=b,this._StartTicking2()):(this._pinInst=null,this._StopTicking2())}_Pin(b,a,c){if(b&&(b=b.GetFirstPicked(this._inst)))if(this._mode=a,this._SetPinInst(b),a=this._inst.GetWorldInfo(),b=b.GetWorldInfo(),"properties"===this._mode){const d=this._propSet;d.clear();for(const e of c)d.add(e);this._dx=a.GetX()-b.GetX();this._dy=a.GetY()-b.GetY();this._dAngle=a.GetAngle()-b.GetAngle();
this._lastKnownAngle=a.GetAngle();this._dz=a.GetZElevation()-b.GetZElevation();d.has("x")&&d.has("y")&&(this._pinAngle=f.angleTo(b.GetX(),b.GetY(),a.GetX(),a.GetY())-b.GetAngle(),this._pinDist=f.distanceTo(b.GetX(),b.GetY(),a.GetX(),a.GetY()));d.has("width-abs")?this._dWidth=a.GetWidth()-b.GetWidth():d.has("width-scale")&&(this._dWidth=a.GetWidth()/b.GetWidth());d.has("height-abs")?this._dHeight=a.GetHeight()-b.GetHeight():d.has("height-scale")&&(this._dHeight=a.GetHeight()/b.GetHeight())}else this._pinDist=
f.distanceTo(b.GetX(),b.GetY(),a.GetX(),a.GetY())}SaveToJson(){const b=this._propSet,a=this._mode,c={uid:this._pinInst?this._pinInst.GetUID():-1,m:a,d:this._destroy};if("rope"===a||"bar"===a)c.pd=this._pinDist;else if("properties"===a){c.ps=[...this._propSet];b.has("imagepoint")?c.ip=this._pinImagePoint:b.has("x")&&b.has("y")?(c.pa=this._pinAngle,c.pd=this._pinDist):(b.has("x")&&(c.dx=this._dx),b.has("y")&&(c.dy=this._dy));b.has("angle")&&(c.da=this._dAngle,c.lka=this._lastKnownAngle);if(b.has("width-abs")||
b.has("width-scale"))c.dw=this._dWidth;if(b.has("height-abs")||b.has("height-scale"))c.dh=this._dHeight;b.has("z")&&(c.dz=this._dz)}return c}LoadFromJson(b){const a=b.m,c=this._propSet;c.clear();this._pinUid=b.uid;if("number"===typeof a)this._LoadFromJson_Legacy(b);else if(this._mode=a,b.hasOwnProperty("d")&&(this._destroy=!!b.d),"rope"===a||"bar"===a)this._pinDist=b.pd;else if("properties"===a){for(const d of b.ps)c.add(d);c.has("imagepoint")?this._pinImagePoint=b.ip:c.has("x")&&c.has("y")?(this._pinAngle=
b.pa,this._pinDist=b.pd):(c.has("x")&&(this._dx=b.dx),c.has("y")&&(this._dy=b.dy));c.has("angle")&&(this._dAngle=b.da,this._lastKnownAngle=b.lka||0);if(c.has("width-abs")||c.has("width-scale"))this._dWidth=b.dw;if(c.has("height-abs")||c.has("height-scale"))this._dHeight=b.dh;c.has("z")&&(this._dz=b.dz)}}_LoadFromJson_Legacy(b){const a=this._propSet,c=b.msa,d=b.tsa,e=b.pa,h=b.pd;switch(b.m){case 0:this._mode="properties";a.add("x").add("y").add("angle");this._pinAngle=e;this._pinDist=h;this._dAngle=
c-d;this._lastKnownAngle=b.lka;break;case 1:this._mode="properties";a.add("x").add("y");this._pinAngle=e;this._pinDist=h;break;case 2:this._mode="properties";a.add("angle");this._dAngle=c-d;this._lastKnownAngle=b.lka;break;case 3:this._mode="rope";this._pinDist=b.pd;break;case 4:this._mode="bar",this._pinDist=b.pd}}_OnAfterLoad(){-1===this._pinUid?this._SetPinInst(null):(this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid)),this._pinUid=-1)}_OnInstanceDestroyed(b){this._pinInst===b&&(this._SetPinInst(null),
this._destroy&&this._runtime.DestroyInstance(this._inst))}Tick2(){var b=this._pinInst;if(b){var a=b.GetWorldInfo(),c=this._inst.GetWorldInfo(),d=this._mode,e=!1;if("rope"===d||"bar"===d){if(b=f.distanceTo(c.GetX(),c.GetY(),a.GetX(),a.GetY()),b>this._pinDist||"bar"===d&&b<this._pinDist)e=f.angleTo(a.GetX(),a.GetY(),c.GetX(),c.GetY()),c.SetXY(a.GetX()+Math.cos(e)*this._pinDist,a.GetY()+Math.sin(e)*this._pinDist),e=!0}else{d=this._propSet;if(d.has("imagepoint")){const [h,g]=b.GetImagePoint(this._pinImagePoint);
c.EqualsXY(h,g)||(c.SetXY(h,g),e=!0)}else if(d.has("x")&&d.has("y")){b=a.GetX()+Math.cos(a.GetAngle()+this._pinAngle)*this._pinDist;const h=a.GetY()+Math.sin(a.GetAngle()+this._pinAngle)*this._pinDist;c.EqualsXY(b,h)||(c.SetXY(b,h),e=!0)}else b=a.GetX()+this._dx,d.has("x")&&b!==c.GetX()&&(c.SetX(b),e=!0),b=a.GetY()+this._dy,d.has("y")&&b!==c.GetY()&&(c.SetY(b),e=!0);d.has("angle")&&(this._lastKnownAngle!==c.GetAngle()&&(this._dAngle=f.clampAngle(this._dAngle+(c.GetAngle()-this._lastKnownAngle))),
b=f.clampAngle(a.GetAngle()+this._dAngle),b!==c.GetAngle()&&(c.SetAngle(b),e=!0),this._lastKnownAngle=c.GetAngle());d.has("width-abs")&&(b=a.GetWidth()+this._dWidth,b!==c.GetWidth()&&(c.SetWidth(b),e=!0));d.has("width-scale")&&(b=a.GetWidth()*this._dWidth,b!==c.GetWidth()&&(c.SetWidth(b),e=!0));d.has("height-abs")&&(b=a.GetHeight()+this._dHeight,b!==c.GetHeight()&&(c.SetHeight(b),e=!0));d.has("height-scale")&&(b=a.GetHeight()*this._dHeight,b!==c.GetHeight()&&(c.SetHeight(b),e=!0));d.has("z")&&(b=
a.GetZElevation()+this._dz,b!==c.GetZElevation()&&(c.SetZElevation(b),this._runtime.UpdateRender()))}e&&c.SetBboxChanged()}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.pin.debugger.is-pinned",value:!!this._pinInst},{name:"behaviors.pin.debugger.pinned-uid",value:this._pinInst?this._pinInst.GetUID():0}]}]}}}"use strict";self.C3.Behaviors.Pin.Cnds={IsPinned(){return!!this._pinInst},WillDestroy(){return this._destroy}};"use strict";
self.C3.Behaviors.Pin.Acts={PinByDistance(f,b){this._Pin(f,0===b?"rope":"bar")},PinByProperties(f,b,a,c,d,e,h){const g=[];b&&g.push("x");a&&g.push("y");c&&g.push("angle");h&&g.push("z");1===d?g.push("width-abs"):2===d&&g.push("width-scale");1===e?g.push("height-abs"):2===e&&g.push("height-scale");0!==g.length&&this._Pin(f,"properties",g)},PinByImagePoint(f,b,a,c,d,e){const h=["imagepoint"];a&&h.push("angle");e&&h.push("z");1===c?h.push("width-abs"):2===c&&h.push("width-scale");1===d?h.push("height-abs"):
2===d&&h.push("height-scale");this._pinImagePoint=b;this._Pin(f,"properties",h)},SetPinDistance(f){if("rope"===this._mode||"bar"===this._mode)this._pinDist=Math.max(f,0)},SetDestroy(f){this._destroy=f},Unpin(){this._SetPinInst(null);this._mode="";this._propSet.clear();this._pinImagePoint=""},Pin(f,b){switch(b){case 0:this._Pin(f,"properties",["x","y","angle"]);break;case 1:this._Pin(f,"properties",["x","y"]);break;case 2:this._Pin(f,"properties",["angle"]);break;case 3:this._Pin(f,"rope");break;case 4:this._Pin(f,
"bar")}}};"use strict";self.C3.Behaviors.Pin.Exps={PinnedUID(){return this._pinInst?this._pinInst.GetUID():-1}};{"use strict";const f=self.C3;f.Behaviors.Persist=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Behaviors.Persist.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;f.Behaviors.Persist.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b)}Release(){super.Release()}}}"use strict";self.C3.Behaviors.Persist.Cnds={};"use strict";self.C3.Behaviors.Persist.Acts={};"use strict";self.C3.Behaviors.Persist.Exps={};{"use strict";const f=self.C3;f.Behaviors.Bullet=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Behaviors.Bullet.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3,b=self.C3X,a=self.IBehaviorInstance;f.Behaviors.Bullet.Instance=class extends f.SDKBehaviorInstanceBase{constructor(d,e){super(d);d=this.GetWorldInfo();this._g=this._acc=this._speed=0;this._isStepping=this._setAngle=this._bounceOffSolid=!1;this._isEnabled=!0;this._dy=this._dx=0;this._lastX=d.GetX();this._lastY=d.GetY();this._lastKnownAngle=d.GetAngle();this._travelled=0;this._stepSize=Math.min(Math.abs(d.GetWidth()),Math.abs(d.GetHeight())/2);this._stopStepping=!1;e&&
(this._speed=e[0],this._acc=e[1],this._g=e[2],this._bounceOffSolid=!!e[3],this._setAngle=!!e[4],this._isStepping=!!e[5],this._isEnabled=!!e[6]);e=d.GetAngle();this._dx=Math.cos(e)*this._speed;this._dy=Math.sin(e)*this._speed;this._isEnabled&&(this._StartTicking(),this._bounceOffSolid&&this._StartPostTicking())}Release(){super.Release()}SaveToJson(){const d={dx:this._dx,dy:this._dy,lx:this._lastX,ly:this._lastY,lka:this._lastKnownAngle,t:this._travelled};0!==this._acc&&(d.acc=this._acc);0!==this._g&&
(d.g=this._g);this._isStepping&&(d.st=this._isStepping);this._isEnabled||(d.e=this._isEnabled);this._bounceOffSolid&&(d.bos=this._bounceOffSolid);this._setAngle&&(d.sa=this._setAngle);return d}LoadFromJson(d){this._dx=d.dx;this._dy=d.dy;this._lastX=d.lx;this._lastY=d.ly;this._lastKnownAngle=d.lka;this._travelled=d.t;this._acc=d.hasOwnProperty("acc")?d.acc:0;this._g=d.hasOwnProperty("g")?d.g:0;this._isStepping=d.hasOwnProperty("st")?d.st:!1;this._bounceOffSolid=d.hasOwnProperty("bos")?d.bos:!1;this._setAngle=
d.hasOwnProperty("sa")?d.sa:!1;this._SetEnabled(d.hasOwnProperty("e")?d.e:!0)}Tick(){if(this._isEnabled){var d=this._runtime.GetDt(this._inst),e=this._inst.GetWorldInfo();if(e.GetAngle()!==this._lastKnownAngle){var h=e.GetAngle();if(this._setAngle){var g=f.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(h)*g;this._dy=Math.sin(h)*g}this._lastKnownAngle=h}h=g=0;if(0!==this._acc){let l=f.distanceTo(0,0,this._dx,this._dy),m;m=0===this._dx&&0===this._dy?e.GetAngle():f.angleTo(0,0,this._dx,this._dy);
l+=this._acc*d;g=Math.cos(m)*this._acc;h=Math.sin(m)*this._acc;0>l&&(h=g=l=0);this._dx=Math.cos(m)*l;this._dy=Math.sin(m)*l}0!==this._g&&(this._dy+=this._g*d,h+=this._g);this._lastX=e.GetX();this._lastY=e.GetY();if(0!==this._dx||0!==this._dy)g=this._dx*d+.5*g*d*d,d=this._dy*d+.5*h*d*d,h=f.distanceTo(0,0,g,d),this._MoveBy(g,d,h),this._travelled+=h,!this._setAngle||0===g&&0===d||(d=f.angleTo(0,0,g,d),e.SetAngle(d),this._lastKnownAngle=e.GetAngle()),e.SetBboxChanged()}}_MoveBy(d,e,h){const g=this.GetWorldInfo();
if(!this._isStepping||h<=this._stepSize)g.OffsetXY(d,e),g.SetBboxChanged(),this._isStepping&&this.Trigger(f.Behaviors.Bullet.Cnds.OnStep);else{this._stopStepping=!1;var l=g.GetX(),m=g.GetY(),u=l+d,w=m+e;e=f.angleTo(0,0,d,e);d=Math.cos(e)*this._stepSize;e=Math.sin(e)*this._stepSize;h=Math.floor(h/this._stepSize);for(let q=1;q<=h;++q)if(g.SetXY(l+d*q,m+e*q),g.SetBboxChanged(),this.Trigger(f.Behaviors.Bullet.Cnds.OnStep),this._inst.IsDestroyed()||this._stopStepping)return;g.SetXY(u,w);g.SetBboxChanged();
this.Trigger(f.Behaviors.Bullet.Cnds.OnStep)}}PostTick(){if(this._isEnabled&&this._bounceOffSolid&&(0!==this._dx||0!==this._dy)){var d=this._runtime.GetDt(this._inst),e=this._inst.GetWorldInfo(),h=this._runtime.GetCollisionEngine(),g=h.TestOverlapSolid(this._inst);if(g){h.RegisterCollision(this._inst,g);g=f.distanceTo(0,0,this._dx,this._dy);const l=h.CalculateBounceAngle(this._inst,this._lastX,this._lastY);this._dx=Math.cos(l)*g;this._dy=Math.sin(l)*g;e.OffsetXY(this._dx*d,this._dy*d);e.SetBboxChanged();
this._setAngle&&(e.SetAngle(l),this._lastKnownAngle=e.GetAngle(),e.SetBboxChanged());h.PushOutSolid(this._inst,this._dx/g,this._dy/g,Math.max(2.5*g*d,30))||h.PushOutSolidNearest(this._inst,100)}}}GetPropertyValueByIndex(d){switch(d){case 0:return this._GetSpeed();case 1:return this._GetAcceleration();case 2:return this._GetGravity();case 4:return this._setAngle;case 5:return this._isStepping;case 6:return this._IsEnabled()}}SetPropertyValueByIndex(d,e){switch(d){case 0:this._SetSpeed(e);break;case 1:this._acc=
e;break;case 2:this._g=e;break;case 4:this._setAngle=!!e;break;case 5:this._isStepping=!!e;break;case 6:this._SetEnabled(!!e)}}_SetSpeed(d){const e=f.angleTo(0,0,this._dx,this._dy);this._dx=Math.cos(e)*d;this._dy=Math.sin(e)*d}_GetSpeed(){return f.round6dp(f.distanceTo(0,0,this._dx,this._dy))}_SetAcceleration(d){this._acc=d}_GetAcceleration(){return this._acc}_SetGravity(d){this._g=d}_GetGravity(){return this._g}_SetAngleOfMotion(d){const e=f.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(d)*
e;this._dy=Math.sin(d)*e}_GetAngleOfMotion(){return f.angleTo(0,0,this._dx,this._dy)}_SetBounceOffSolids(d){d=!!d;this._bounceOffSolid!==d&&(this._bounceOffSolid=d,this._isEnabled&&(this._bounceOffSolid?this._StartPostTicking():this._StopPostTicking()))}_IsBounceOffSolids(){return this._bounceOffSolid}_SetDistanceTravelled(d){this._travelled=d}_GetDistanceTravelled(){return this._travelled}_SetEnabled(d){(this._isEnabled=!!d)?(this._StartTicking(),this._bounceOffSolid&&this._StartPostTicking()):(this._StopTicking(),
this._StopPostTicking())}_IsEnabled(){return this._isEnabled}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.bullet.debugger.vector-x",value:this._dx,onedit:d=>this._dx=d},{name:"behaviors.bullet.debugger.vector-y",value:this._dy,onedit:d=>this._dy=d},{name:"behaviors.bullet.properties.speed.name",value:this._GetSpeed(),onedit:d=>this._SetSpeed(d)},{name:"behaviors.bullet.debugger.angle-of-motion",value:f.toDegrees(this._GetAngleOfMotion())},
{name:"behaviors.bullet.properties.gravity.name",value:this._GetGravity(),onedit:d=>this._SetGravity(d)},{name:"behaviors.bullet.properties.acceleration.name",value:this._GetAcceleration(),onedit:d=>this._SetAcceleration(d)},{name:"behaviors.bullet.debugger.distance-travelled",value:this._GetDistanceTravelled()},{name:"behaviors.bullet.properties.enabled.name",value:this._IsEnabled(),onedit:d=>this._SetEnabled(d)}]}]}GetScriptInterfaceClass(){return self.IBulletBehaviorInstance}};const c=new WeakMap;
self.IBulletBehaviorInstance=class extends a{constructor(){super();c.set(this,a._GetInitInst().GetSdkInstance())}get speed(){return c.get(this)._GetSpeed()}set speed(d){b.RequireFiniteNumber(d);c.get(this)._SetSpeed(d)}get acceleration(){return c.get(this)._GetAcceleration()}set acceleration(d){b.RequireFiniteNumber(d);c.get(this)._SetAcceleration(d)}get gravity(){return c.get(this)._GetGravity()}set gravity(d){b.RequireFiniteNumber(d);c.get(this)._SetGravity(d)}get angleOfMotion(){return c.get(this)._GetAngleOfMotion()}set angleOfMotion(d){b.RequireFiniteNumber(d);
c.get(this)._SetAngleOfMotion(d)}get bounceOffSolids(){return c.get(this)._IsBounceOffSolids()}set bounceOffSolids(d){c.get(this)._SetBounceOffSolids(!!d)}get distanceTravelled(){return c.get(this)._GetDistanceTravelled()}set distanceTravelled(d){b.RequireFiniteNumber(d);c.get(this)._SetDistanceTravelled(d)}get isEnabled(){return c.get(this)._IsEnabled()}set isEnabled(d){c.get(this)._SetEnabled(d)}}}
{"use strict";const f=self.C3;f.Behaviors.Bullet.Cnds={CompareSpeed(b,a){return f.compare(Math.sqrt(this._dx*this._dx+this._dy*this._dy),b,a)},CompareTravelled(b,a){return f.compare(this._GetDistanceTravelled(),b,a)},OnStep(){return!0},IsEnabled(){return this._IsEnabled()}}}
{"use strict";const f=self.C3;f.Behaviors.Bullet.Acts={SetSpeed(b){this._SetSpeed(b)},SetAcceleration(b){this._SetAcceleration(b)},SetGravity(b){this._SetGravity(b)},SetAngleOfMotion(b){this._SetAngleOfMotion(f.toRadians(b))},Bounce(b){if(b&&(b=b.GetFirstPicked(this._inst))){var a=this._inst.GetWorldInfo(),c=this._runtime.GetCollisionEngine(),d=this._runtime.GetDt(this._inst),e=f.distanceTo(0,0,this._dx,this._dy),h=c.CalculateBounceAngle(this._inst,this._lastX,this._lastY,b);this._dx=Math.cos(h)*
e;this._dy=Math.sin(h)*e;a.OffsetXY(this._dx*d,this._dy*d);a.SetBboxChanged();this._setAngle&&(a.SetAngle(h),this._lastKnownAngle=a.GetAngle(),a.SetBboxChanged());0!==e&&(this._bounceOffSolid?c.PushOutSolid(this._inst,this._dx/e,this._dy/e,Math.max(2.5*e*d,30))||c.PushOutSolidNearest(this._inst,100):c.PushOut(this._inst,this._dx/e,this._dy/e,Math.max(2.5*e*d,30),b))}},SetBounceOffSolids(b){this._SetBounceOffSolids(b)},SetDistanceTravelled(b){this._SetDistanceTravelled(b)},SetEnabled(b){this._SetEnabled(b)},
StopStepping(){this._stopStepping=!0}}}{"use strict";const f=self.C3;f.Behaviors.Bullet.Exps={Speed(){return this._GetSpeed()},Acceleration(){return this._GetAcceleration()},AngleOfMotion(){return f.toDegrees(this._GetAngleOfMotion())},DistanceTravelled(){return this._GetDistanceTravelled()},Gravity(){return this._GetGravity()}}}{"use strict";const f=self.C3;f.Behaviors.Rotate=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const f=self.C3;f.Behaviors.Rotate.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;f.Behaviors.Rotate.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._acceleration=this._speed=0;this._isEnabled=!0;a&&(this._speed=f.toRadians(a[0]),this._acceleration=f.toRadians(a[1]),this._isEnabled=a[2]);this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{s:this._speed,a:this._acceleration,e:this._isEnabled}}LoadFromJson(b){this._speed=b.s;this._acceleration=b.a;this._SetEnabled(b.e)}Tick(){if(this._isEnabled){var b=
this._runtime.GetDt(this._inst);if(0!==b&&(0!==this._acceleration&&(this._speed+=this._acceleration*b),0!==this._speed)){const a=this._inst.GetWorldInfo();a.SetAngle(a.GetAngle()+this._speed*b);a.SetBboxChanged()}}}GetPropertyValueByIndex(b){switch(b){case 0:return f.toDegrees(this._speed);case 1:return f.toDegrees(this._acceleration);case 2:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._speed=f.toRadians(a);break;case 1:this._acceleration=f.toRadians(a);break;case 2:this._SetEnabled(a)}}_SetEnabled(b){(this._isEnabled=
!!b)?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.rotate.properties.speed.name",value:f.toDegrees(this._speed),onedit:b=>this._speed=f.toRadians(b)},{name:"behaviors.rotate.properties.acceleration.name",value:f.toDegrees(this._acceleration),onedit:b=>this._acceleration=f.toRadians(b)},{name:"behaviors.rotate.properties.enabled.name",value:this._isEnabled,onedit:b=>this._SetEnabled(b)}]}]}}}"use strict";
self.C3.Behaviors.Rotate.Cnds={IsEnabled(){return this._isEnabled}};{"use strict";const f=self.C3;f.Behaviors.Rotate.Acts={SetSpeed(b){this._speed=f.toRadians(b)},SetAcceleration(b){this._acceleration=f.toRadians(b)},SetEnabled(b){this._SetEnabled(b)}}}{"use strict";const f=self.C3;f.Behaviors.Rotate.Exps={Speed(){return f.toDegrees(this._speed)},Acceleration(){return f.toDegrees(this._acceleration)}}}{"use strict";const f=self.C3;f.Behaviors.Timer=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const f=self.C3;f.Behaviors.Timer.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3;f.Behaviors.Timer.SingleTimer=class{constructor(b,a,c,d){this._current=f.New(f.KahanSum);this._current.Set(b||0);this._total=f.New(f.KahanSum);this._total.Set(a||0);this._duration=c||0;this._isRegular=!!d;this._isPaused=!1}GetCurrentTime(){return this._current.Get()}GetTotalTime(){return this._total.Get()}GetDuration(){return this._duration}SetPaused(b){this._isPaused=!!b}IsPaused(){return this._isPaused}Add(b){this._current.Add(b);this._total.Add(b)}HasFinished(){return this._current.Get()>=
this._duration}Update(){if(this.HasFinished())if(this._isRegular)this._current.Subtract(this._duration);else return!0;return!1}SaveToJson(){return{c:this._current.Get(),t:this._total.Get(),d:this._duration,r:this._isRegular,p:this._isPaused}}LoadFromJson(b){this._current.Set(b.c);this._total.Set(b.t);this._duration=b.d;this._isRegular=!!b.r;this._isPaused=!!b.p}};f.Behaviors.Timer.Instance=class extends f.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._timers=new Map}Release(){this._timers.clear();
super.Release()}_UpdateTickState(){0<this._timers.size?(this._StartTicking(),this._StartTicking2()):(this._StopTicking(),this._StopTicking2())}SaveToJson(){const b={};for(const [a,c]of this._timers.entries())b[a]=c.SaveToJson();return b}LoadFromJson(b){this._timers.clear();for(const [a,c]of Object.entries(b))b=new f.Behaviors.Timer.SingleTimer,b.LoadFromJson(c),this._timers.set(a,b);this._UpdateTickState()}Tick(){const b=this._runtime.GetDt(this._inst);for(const a of this._timers.values())a.IsPaused()||
a.Add(b)}Tick2(){for(const [b,a]of this._timers.entries())a.Update()&&this._timers.delete(b)}GetDebuggerProperties(){return[{title:"behaviors.timer.debugger.timers",properties:[...this._timers.entries()].map(b=>({name:"$"+b[0],value:`${Math.round(10*b[1].GetCurrentTime())/10} / ${Math.round(10*b[1].GetDuration())/10}`}))}]}}}"use strict";
self.C3.Behaviors.Timer.Cnds={OnTimer(f){return(f=this._timers.get(f.toLowerCase()))?f.HasFinished():!1},IsTimerRunning(f){return this._timers.has(f.toLowerCase())},IsTimerPaused(f){return(f=this._timers.get(f.toLowerCase()))&&f.IsPaused()}};
{"use strict";const f=self.C3;f.Behaviors.Timer.Acts={StartTimer(b,a,c){b=new f.Behaviors.Timer.SingleTimer(0,0,b,1===a);this._timers.set(c.toLowerCase(),b);this._UpdateTickState()},StopTimer(b){this._timers.delete(b.toLowerCase());this._UpdateTickState()},PauseResumeTimer(b,a){(b=this._timers.get(b.toLowerCase()))&&b.SetPaused(0===a)}}}"use strict";
self.C3.Behaviors.Timer.Exps={CurrentTime(f){return(f=this._timers.get(f.toLowerCase()))?f.GetCurrentTime():0},TotalTime(f){return(f=this._timers.get(f.toLowerCase()))?f.GetTotalTime():0},Duration(f){return(f=this._timers.get(f.toLowerCase()))?f.GetDuration():0}};{"use strict";const f=self.C3;f.Behaviors.Tween=class extends f.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const f=self.C3;f.Behaviors.Tween.Type=class extends f.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const f=self.C3,b=f.Behaviors.Tween;b.Instance=class extends f.SDKBehaviorInstanceBase{constructor(a,c){super(a);this._allowMultiple=!1;this._enabled=!0;c&&(this._allowMultiple=!1,this._enabled=!!c[0]);this._activeTweens=new Map;this._disabledTweens=[];this._waitingForReleaseTweens=new Map;this._waitingForReleaseTweensJson=this._disabledTweensJson=this._activeTweensJson=this._finishingTween=null;this._finishingTweenName="";this._enabled&&this._StartTicking2();this._afterLoad=d=>this._OnAfterLoad(d);
this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;this._finishingTween&&(this.ReleaseAndCompleteTween(this._finishingTween),this._finishingTween=null);this.ReleaseAndCompleteTweens();this._tweens=null;this.ClearDisabledList();this._disabledTweens=null;this._ReleaseWaitingTweens();this._waitingForReleaseTweens=null;super.Release()}SetEnabled(a){(this._enabled=a)?
this._StartTicking2():this._StopTicking2()}GetEnabled(){return this._enabled}AddToDisabledList(a){this._disabledTweens.push(a)}IsInDisabledList(a){return this._disabledTweens.includes(a)}ClearDisabledList(){f.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const a=this.GetObjectInstance();return a?!a.IsDestroyed():!1}GetTween(a,c,d=!1){if((c=c?this.PropertyTweens(c,d):this.AllTweens(d))&&c.length)for(const e of c)if(e.HasTags(a))return e}GetTweenIncludingWaitingForRelease(a,
c){return this.GetTween(a,c,!0)}*GetTweens(a,c,d=!1){if((c=c?this.PropertyTweens(c,d):this.AllTweens(d))&&c.length)for(const e of c)e.HasTags(a)&&(yield e)}*GetTweensIncludingWaitingForRelease(a,c){yield*this.GetTweens(a,c,!0)}PropertyTweens(a,c){if(c)return c=this._activeTweens.get(a),a=this._waitingForReleaseTweens.get(a),c||(c=[]),a||(a=[]),c.concat(a).filter(d=>d);(a=this._activeTweens.get(a))||(a=[]);return a.filter(d=>d)}AllTweens(a){if(a){a=[...this._activeTweens.values()].flat();const c=[...this._waitingForReleaseTweens.values()].flat();
return a.concat(c).filter(d=>d)}return[...this._activeTweens.values()].flat().filter(c=>c)}AllTweensIncludingWaitingForRelease(){return this.AllTweens(!0)}SaveToJson(){return{s:!1,e:!!this._enabled,at:this._SaveActiveTweensToJson(),dt:this._SaveDisabledTweensToJson(),wt:this._SaveWaitingForReleaseTweensToJson(),ft:this._SaveFinishingTweenToJson()}}LoadFromJson(a){a&&(this._activeTweensJson=a.at,this._disabledTweensJson=a.dt,this._waitingForReleaseTweensJson=a.wt,this._finishingTweenName=a.ft,this._allowMultiple=
!1,this._enabled=!!a.e)}_OnAfterLoad(a){a=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,a);if(this._disabledTweensJson){f.clearArray(this._disabledTweens);for(const c of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,c,a)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,a);this._finishingTween=this._GetTween(this._finishingTweenName,a);this._enabled?this._StartTicking2():this._StopTicking2()}_PopulateTweenMap(a,
c,d){if(a)for(const h in a){let g=c.get(h);g?f.clearArray(g):g=[];var e=a[h];for(const l of e)this._PopulateTweenArray(g,l.name,d)?this._LoadTweenFromJson(l.name,l,d):(e=f.TweenState.Build({runtime:this.GetRuntime(),json:l}),e.AddCompletedCallback(m=>this._FinishTriggers(m)),d.AddScheduledTimeline(e),this._PopulateTweenArray(g,e,d));c.set(h,g)}}_GetTween(a,c){return c.GetScheduledOrPlayingTimelineByName(a)}_PopulateTweenArray(a,c,d){if("string"===typeof c){if(c=this._GetTween(c,d))return!!a.push(c)}else return!!a.push(c);
return!1}_LoadTweenFromJson(a,c,d){"string"===typeof a?(a=this._GetTween(a,d))&&a._LoadFromJson(c):a._LoadFromJson(c)}_SaveActiveTweensToJson(){const a={};for(const [c,d]of this._activeTweens)a[c]=d.map(e=>e._SaveToJson());return a}_SaveDisabledTweensToJson(){return this._disabledTweens.map(a=>a.GetName())}_SaveWaitingForReleaseTweensToJson(){const a={};for(const [c,d]of this._waitingForReleaseTweens)a[c]=d.map(e=>e._SaveToJson());return a}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():
""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(a){var c=b.Config.GetPropertyTracksConfig(a.property,a.startValue,a.endValue,a.ease,a.resultMode,this.GetObjectInstance());const d=b.Maps.GetPropertyFromIndex(a.property);b.Maps.IsValueId(d)||this.ReleaseTweens(a.property);c=f.TweenState.Build({runtime:this.GetRuntime(),id:d,tags:a.tags,time:a.time,instance:this.GetObjectInstance(),releaseOnComplete:!!a.releaseOnComplete,loop:!!a.loop,pingPong:!!a.pingPong,initialValueMode:a.initialValueMode,propertyTracksConfig:c});
c.AddCompletedCallback(e=>this._FinishTriggers(e));this._AddTween(c,a.property);return c}ReleaseTween(a,c=!1){var d=a.GetId();if(this._activeTweens.has(d)&&(d=this._activeTweens.get(d))){const e=d.indexOf(a);-1!==e&&d.splice(e,1)}a.IsReleased()||this._IsInWaitingList(a)||(a.Stop(c),this._AddToWaitingList(a))}ReleaseTweens(a,c=!1){if(f.IsFiniteNumber(a)){var d=b.Maps.GetPropertyFromIndex(a);if(this._activeTweens.has(d)){d=this._activeTweens.get(d);var e=this.GetFinishingTween();for(var h of d)h===
e||h.IsReleased()||this._IsInWaitingList(h)||(h.Stop(c),h.Release());f.clearArray(d)}}else{h=this.GetFinishingTween();for(d of this.AllTweens())d===h||d.IsReleased()||this._IsInWaitingList(d)||(d.Stop(c),d.Release());for(e of this._activeTweens.keys())f.clearArray(this._activeTweens.get(e)),this._activeTweens.delete(e);this._activeTweens.clear()}}ReleaseAndCompleteTween(a){this.ReleaseTween(a,!0)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,!0)}GetPropertyValueByIndex(a){switch(a){case 0:return this._enabled}}SetPropertyValueByIndex(a,
c){switch(a){case 0:this._enabled=!!c}}_GetBehaviorType(a){a=a.GetInstance().GetBehaviorInstances();for(const c of a)if(a=c.GetBehaviorType(),a.GetInstanceSdkCtor()===this.constructor)return a}Trigger(a,c,d,e){return this._runtime?super.Trigger(a):c.Trigger(a,d,e)}_FinishTriggers(a){this._finishingTween=a;b.Cnds.SetFinishingTween(a);let c,d;if(this.GetRuntime())c=this._inst,d=this._runtime,this.Trigger(b.Cnds.OnTweensFinished),this.Trigger(b.Cnds.OnAnyTweensFinished),this.ReleaseTween(a);else{c=a.GetInstance();
if(!c||c&&c.IsDestroyed())return;d=c.GetRuntime();const e=this._GetBehaviorType(a);this.Trigger(b.Cnds.OnTweensFinished,d,c,e);this.Trigger(b.Cnds.OnAnyTweensFinished,d,c,e);a.Stop()}this._finishingTween=null;b.Cnds.SetFinishingTween(null);a.GetDestroyInstanceOnComplete()&&d.DestroyInstance(c)}_AddTween(a,c){c=b.Maps.GetPropertyFromIndex(c);this._activeTweens.has(c)||this._activeTweens.set(c,[]);this._activeTweens.get(c).push(a)}_AddToWaitingList(a){const c=a.GetId();this._waitingForReleaseTweens.has(c)||
this._waitingForReleaseTweens.set(c,[]);this._waitingForReleaseTweens.get(c).push(a)}_IsInWaitingList(a){const c=a.GetId();return this._waitingForReleaseTweens.has(c)?this._waitingForReleaseTweens.get(c).includes(a):!1}_ReleaseWaitingTweens(){if(this._waitingForReleaseTweens.size){for(const a of this._waitingForReleaseTweens.values()){for(const c of a)c.IsReleased()||c.Release();f.clearArray(a)}this._waitingForReleaseTweens.clear()}}}}
{"use strict";const f=self.C3;let b=null;f.Behaviors.Tween.Cnds={SetFinishingTween(a){b=a},OnTweensFinished(a){return b.HasTags(a)},OnAnyTweensFinished(){return!0},IsPlaying(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(f.TweenState.IsPlaying):!1},IsAnyPlaying(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(f.TweenState.IsPlaying):!1},IsPaused(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(f.TweenState.IsPaused):
!1},IsAnyPaused(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(f.TweenState.IsPaused):!1}}}
{"use strict";const f=self.C3,b=self.Ease,a=f.Behaviors.Tween;a.Acts={SetEnabled(c){this.SetEnabled(!!c);for(const d of this.AllTweens())c?this.IsInDisabledList(d)&&d.Resume():((d.IsPlaying()||d.IsScheduled())&&this.AddToDisabledList(d),d.Stop());c&&this.ClearDisabledList()},async TweenOneProperty(...c){this.GetEnabled()&&this.IsInstanceValid()&&(c=this.CreateTween(a.TweenArguments.OneProperty(this,...c)),c.Play()&&await c.GetPlayPromise())},async TweenTwoProperties(...c){this.GetEnabled()&&this.IsInstanceValid()&&
(c=this.CreateTween(a.TweenArguments.TwoProperties(this,...c)),c.Play()&&await c.GetPlayPromise())},async TweenValue(...c){this.GetEnabled()&&this.IsInstanceValid()&&(c=this.CreateTween(a.TweenArguments.ValueProperty(this,...c)),c.Play()&&await c.GetPlayPromise())},PauseTweens(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.GetTweens(c))d.Stop()},PauseAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.Stop()},ResumeTweens(c){if(this.GetEnabled()&&
this.IsInstanceValid())for(const d of this.GetTweens(c))d.Resume()},ResumeAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.Resume()},StopTweens(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.GetTweens(c))this.ReleaseTween(d)},StopAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())this.ReleaseTween(c)},SetOnePropertyTweensEndValue(c,d,e){if(this.GetEnabled()&&this.IsInstanceValid()){d=f.Behaviors.Tween.Maps.GetSinglePropertyFromIndex(d);
for(const h of this.GetTweens(c))h.BeforeSetEndValues([d]),h.SetEndValue(e,d)}},SetTwoPropertiesTweensEndValue(c,d,e,h){if(this.GetEnabled()&&this.IsInstanceValid()){d=f.Behaviors.Tween.Maps.GetRealProperties(d);for(const g of this.GetTweens(c))g.BeforeSetEndValues(d),g.SetEndValue(e,d[0]),g.SetEndValue(h,d[1])}},SetValuePropertyTweensStartValue(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const e of this.GetTweens(c,"value"))e.SetStartValue(d,"value")},SetValuePropertyTweensEndValue(c,d){if(this.GetEnabled()&&
this.IsInstanceValid())for(const e of this.GetTweens(c,"value"))e.BeforeSetEndValues(["value"]),e.SetEndValue(d,"value")},SetTweensEase(c,d){if(this.GetEnabled()&&this.IsInstanceValid()){d=b.GetEaseFromIndex(d);for(const e of this.GetTweens(c))e.SetEase(d)}},SetAllTweensEase(c){if(this.GetEnabled()&&this.IsInstanceValid()){c=b.GetEaseFromIndex(c);for(const d of this.AllTweens())d.SetEase(c)}},SetTweensTime(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const e of this.GetTweens(c))e.SetTime(d)},
SetAllTweensTime(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetTime(c)},SetTweensPlaybackRate(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const e of this.GetTweens(c))e.SetPlaybackRate(d)},SetAllTweensPlaybackRate(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetPlaybackRate(c)},SetTweensDestroyOnComplete(c,d){if(this.GetEnabled()&&this.IsInstanceValid())for(const e of this.GetTweens(c))e.SetDestroyInstanceOnComplete(!!d)},
SetAllTweensDestroyOnComplete(c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.SetDestroyInstanceOnComplete(!!c)}}}"use strict";
self.C3.Behaviors.Tween.Exps={Time(f){return(f=this.GetTweenIncludingWaitingForRelease(f))?f.GetTime():0},Progress(f){return(f=this.GetTweenIncludingWaitingForRelease(f))?f.GetTime()/f.GetTotalTime():0},Value(f){return(f=this.GetTweenIncludingWaitingForRelease(f,"value"))?f.GetPropertyTrack("value").GetSourceAdapterValue():0},Tags(){return this.GetFinishingTween()?this.GetFinishingTween().GetStringTags():""}};
{"use strict";const f=self.C3,b=self.Ease,a=["position","size","scale"],c="offsetX offsetY offsetWidth offsetHeight offsetAngle offsetOpacity offsetColor offsetZElevation offsetScaleX offsetScaleY".split(" "),d=["value"],e=[].concat(a).concat(c).concat(d),h={position:["offsetX","offsetY"],size:["offsetWidth","offsetHeight"],scale:["offsetScaleX","offsetScaleY"]},g=Object.assign({},e.reduce((l,m)=>Object.assign({},l,{[m]:[m]}),{}),h);f.Behaviors.Tween.Maps=class{constructor(){}static GetEases(){return[...b.GetRuntimeEaseNames()]}static GetEaseFromIndex(l){return[...b.GetRuntimeEaseNames()][l]}static GetPropertyFromIndex(l){return e[l]}static GetPropertyIndexFromName(l){return e.indexOf(l)}static GetPairPropertyFromIndex(l){return a[l]}static GetSinglePropertyFromIndex(l){return c[l]}static GetValuePropertyFromIndex(l){return d[l]}static GetPairProperties(l){return h[l]}static GetRealProperties(l){return f.IsString(l)?
g[l]:g[e[l]]}static IsPairId(l){return!!h[l]}static IsColorId(l){return"offsetColor"===l}static IsAngleId(l){return"offsetAngle"===l}static IsOpacityId(l){return"offsetOpacity"===l}static IsValueId(l){return"value"===l}}}
{"use strict";const f=self.C3,b=f.Behaviors.Tween,a=new Map;b.Config=class{constructor(){}static GetPropertyTracksConfig(c,d,e,h,g,l){0===a.size&&this._CreateConfigObjects();var m=b.PropertyTypes.Pick(c);m=a.get(m);f.IsFiniteNumber(c)&&(c=b.Maps.GetPropertyFromIndex(c));return this._GetConfig(m,c,d,e,h,g,l)}static TransformValue(c,d){return f.Behaviors.Tween.GetPropertyTracksConfig(c).valueGetter(d)}static _CreateConfigObjects(){const c=b.PropertyTypes,d=b.ValueGetters;this._AddConfigObject(c.PAIR,
this._GetPairConfig,d._GetPropertyValue);this._AddConfigObject(c.COLOR,this._GetColorConfig,d._GetColorPropertyValue);this._AddConfigObject(c.ANGLE,this._GetAngleConfig,d._GetPropertyAngleValue);this._AddConfigObject(c.VALUE,this._GetValueConfig,d._GetPropertyValue);this._AddConfigObject(c.OTHER,this._GetCommonConfig,d._GetPropertyValue)}static _AddConfigObject(c,d,e){a.set(c,this._CreateConfigObject(c,d,e))}static _CreateConfigObject(c,d,e){return{name:c,configFunc:d,valueGetter:e}}static _GetConfig(c,
d,e,h,g,l,m){return c.configFunc(d,c.valueGetter(e),c.valueGetter(h),g,l,m)}static _GetPairConfig(c,d,e,h,g,l){return b.Maps.GetPairProperties(c).map((m,u)=>({sourceId:"world-instance",property:m,type:"float",valueType:"numeric",startValue:d[u],endValue:e[u],ease:b.Maps.GetEaseFromIndex(h),resultMode:g}))}static _GetColorConfig(c,d,e,h,g,l){return f.Plugins.Text&&l.GetPlugin()instanceof f.Plugins.Text?{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:d,endValue:e,
ease:b.Maps.GetEaseFromIndex(h),resultMode:g}:{sourceId:"world-instance",property:c,type:"color",valueType:"color",startValue:d,endValue:e,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetAngleConfig(c,d,e,h,g,l){return{sourceId:"world-instance",property:c,type:"angle",valueType:"angle",startValue:d,endValue:e,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetCommonConfig(c,d,e,h,g,l){return{sourceId:"world-instance",property:c,type:"float",valueType:"numeric",startValue:d,endValue:e,
ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetValueConfig(c,d,e,h,g,l){return{sourceId:"value",property:c,type:"float",valueType:"numeric",startValue:d,endValue:e,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}}}
{"use strict";const f=self.C3,b=f.Behaviors.Tween,a=Object.assign({},{resultMode:"absolute"},{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:!1,pingPong:!1}),c=Object.assign({},a,{initialValueMode:"current-state",startValue:0,endValue:0}),d=Object.assign({},a,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]}),e=Object.assign({},a,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]}),h=Object.assign({},c,{initialValueMode:"start-value"});b.TweenArguments=
class{constructor(){}static _SetCommonProperties(g,l,m,u,w,q,t){g.tags=l;g.time=m;g.ease=u;g.releaseOnComplete=w;g.loop=q;g.pingPong=t}static OneProperty(g,l,m,u,w,q,t,p,r){g=b.Maps.GetSinglePropertyFromIndex(m);m=b.Maps.IsColorId(g)?e:c;this._SetCommonProperties(m,l,w,q,t,p,r);b.Maps.IsColorId(g)?(e.endValue[0]=f.GetRValue(u),e.endValue[1]=f.GetGValue(u),e.endValue[2]=f.GetBValue(u),e.property=b.Maps.GetPropertyIndexFromName(g)):b.Maps.IsOpacityId(g)?c.endValue=u/100:c.endValue=u;m.property=b.Maps.GetPropertyIndexFromName(g);
return m}static TwoProperties(g,l,m,u,w,q,t,p,r,x){this._SetCommonProperties(d,l,q,t,p,r,x);g=b.Maps.GetPairPropertyFromIndex(m);d.endValue[0]=u;d.endValue[1]=w;d.property=b.Maps.GetPropertyIndexFromName(g);return d}static ValueProperty(g,l,m,u,w,q,t,p,r){this._SetCommonProperties(h,l,w,q,t,p,r);h.startValue=m;h.endValue=u;h.property=b.Maps.GetPropertyIndexFromName("value");return h}}}
{"use strict";const f=self.C3,b=f.Behaviors.Tween,a=[];b.PropertyTypes=class{constructor(){}static Pick(c){0===a.length&&(a.push({checkFunc:b.Maps.IsPairId,result:this.PAIR}),a.push({checkFunc:b.Maps.IsColorId,result:this.COLOR}),a.push({checkFunc:b.Maps.IsAngleId,result:this.ANGLE}),a.push({checkFunc:b.Maps.IsValueId,result:this.VALUE}),a.push({checkFunc:()=>!0,result:this.OTHER}));f.IsFiniteNumber(c)&&(c=f.Behaviors.Tween.Maps.GetPropertyFromIndex(c));for(const d of a)if(d.checkFunc(c))return d.result}static get PAIR(){return"pair"}static get COLOR(){return"color"}static get ANGLE(){return"angle"}static get VALUE(){return"value"}static get OTHER(){return"other"}}}
{"use strict";const f=self.C3;f.Behaviors.Tween.ValueGetters=class{constructor(){}static _GetPropertyAngleValue(b){b=f.toRadians(parseFloat(b));return f.clampAngle(b)}static _GetColorPropertyValue(b){return b.slice(0)}static _GetPropertyValue(b){return b}}}
{const f=self.C3;self.C3_GetObjectRefTable=function(){return[f.Plugins.Keyboard,f.Plugins.Touch,f.Plugins.Audio,f.Plugins.Dictionary,f.Plugins.LocalStorage,f.Plugins.Browser,f.Plugins.gamepad,f.Plugins.Mouse,f.Plugins.Function,f.Plugins.Sprite,f.Behaviors.scrollto,f.Behaviors.Sin,f.Behaviors.Fade,f.Behaviors.Pin,f.Plugins.TiledBg,f.Plugins.Text,f.Plugins.NinePatch,f.Behaviors.Persist,f.Plugins.Particles,f.Plugins.Arr,f.Behaviors.Bullet,f.Behaviors.Rotate,f.Behaviors.Timer,f.Behaviors.Tween,f.Plugins.System.Cnds.OnLayoutStart,
f.Plugins.Browser.Acts.LoadStyleSheet,f.Plugins.System.Cnds.IsGroupActive,f.Plugins.System.Cnds.Compare,f.Plugins.System.Exps.loadingprogress,f.Plugins.System.Cnds.CompareBoolVar,f.Plugins.System.Cnds.TriggerOnce,f.Plugins.System.Acts.Signal,f.Plugins.System.Acts.MapFunction,f.Plugins.System.Acts.SetBoolVar,f.Plugins.System.Acts.WaitForSignal,f.Plugins.System.Acts.Wait,f.Plugins.System.Acts.GoToLayout,f.Plugins.System.Cnds.EveryTick,f.Plugins.TiledBg.Acts.SetWidth,f.Plugins.System.Exps.layoutwidth,
f.Plugins.System.Acts.SetTimescale,f.Plugins.System.Exps.timescale,f.Plugins.System.Exps.dt,f.Plugins.LocalStorage.Acts.CheckItemExists,f.Plugins.LocalStorage.Cnds.OnItemExists,f.Plugins.LocalStorage.Acts.GetItem,f.Plugins.LocalStorage.Cnds.OnItemGet,f.Plugins.System.Acts.SetVar,f.Plugins.LocalStorage.Exps.ItemValue,f.Plugins.Browser.Acts.ConsoleLog,f.Plugins.System.Acts.CallMappedFunction,f.Plugins.System.Acts.SetLayoutScale,f.Plugins.Sprite.Acts.SetPos,f.Plugins.System.Exps.layoutheight,f.Plugins.System.Acts.SetLayerScale,
f.Plugins.System.Exps.layoutname,f.Plugins.TiledBg.Acts.SetImageOffsetX,f.Plugins.System.Exps.int,f.Plugins.TiledBg.Acts.SetImageOffsetY,f.Plugins.TiledBg.Exps.ImageScaleY,f.Plugins.System.Cnds.CompareVar,f.Plugins.TiledBg.Acts.SetVisible,f.Plugins.Arr.Acts.Clear,f.Plugins.Arr.Acts.SetSize,f.Plugins.System.Acts.SetLayerVisible,f.Plugins.Sprite.Acts.SetSize,f.Plugins.Sprite.Acts.SetBoolInstanceVar,f.Plugins.System.Acts.CreateObject,f.Plugins.System.Cnds.OnLayoutEnd,f.Plugins.Audio.Acts.PlayByName,
f.Plugins.System.Exps.choose,f.Plugins.Sprite.Acts.SetInstanceVar,f.Plugins.Sprite.Acts.SetEffectParam,f.Plugins.System.Exps.layoutscale,f.Plugins.Sprite.Cnds.IsBoolInstanceVarSet,f.Plugins.Sprite.Cnds.CompareWidth,f.Plugins.Sprite.Acts.SetWidth,f.Plugins.Sprite.Exps.Width,f.Plugins.Sprite.Acts.SetHeight,f.Plugins.System.Cnds.Else,f.Plugins.Function.Cnds.OnFunction,f.Plugins.Sprite.Exps.ImagePointX,f.Plugins.Sprite.Exps.ImagePointY,f.Plugins.Sprite.Cnds.OnCreated,f.Behaviors.Sin.Acts.SetMovement,
f.Behaviors.Sin.Acts.SetMagnitude,f.Behaviors.Sin.Acts.SetPeriod,f.Behaviors.Sin.Acts.SetEnabled,f.Plugins.Sprite.Acts.SetMirrored,f.Plugins.Sprite.Acts.MoveToBottom,f.Plugins.Sprite.Acts.ZMoveToObject,f.Plugins.Sprite.Cnds.IsAnimPlaying,f.Plugins.Sprite.Acts.SetAngle,f.Plugins.Sprite.Acts.SetAnimFrame,f.Behaviors.Sin.Exps.Period,f.Behaviors.Sin.Acts.SetPhase,f.Behaviors.Sin.Exps.CyclePosition,f.Plugins.Arr.Exps.At,f.Plugins.Arr.Exps.IndexOf,f.Plugins.Sprite.Exps.AnimationFrame,f.Plugins.Sprite.Exps.AnimationFrameCount,
f.Plugins.System.Cnds.ForEach,f.Plugins.Sprite.Cnds.CompareInstanceVar,f.Plugins.Sprite.Acts.MoveToLayer,f.Plugins.NinePatch.Acts.SetPos,f.Plugins.NinePatch.Acts.ZMoveToObject,f.Plugins.Text.Acts.SetPos,f.Plugins.NinePatch.Acts.ToggleBoolInstanceVar,f.Plugins.Text.Acts.SetBoolInstanceVar,f.Plugins.Sprite.Acts.SetVisible,f.Plugins.System.Acts.SetGroupActive,f.Plugins.Sprite.Acts.Destroy,f.Plugins.System.Cnds.For,f.Plugins.System.Exps.random,f.Plugins.Sprite.Acts.SetOpacity,f.Behaviors.Bullet.Acts.SetSpeed,
f.Behaviors.Bullet.Acts.SetAcceleration,f.Plugins.Sprite.Exps.Opacity,f.Plugins.Sprite.Acts.SetScale,f.Plugins.Sprite.Cnds.IsOutsideLayout,f.Plugins.Touch.Cnds.OnTouchObject,f.Plugins.Sprite.Cnds.IsVisible,f.Plugins.Keyboard.Cnds.OnKey,f.Plugins.System.Acts.ToggleBoolVar,f.Plugins.Audio.Acts.SetSilent,f.Plugins.System.Acts.SetObjectTimescale,f.Behaviors.Timer.Acts.StartTimer,f.Plugins.System.Exps.float,f.Plugins.System.Exps.tokenat,f.Plugins.Dictionary.Exps.Get,f.Plugins.Function.Exps.Param,f.Plugins.Audio.Acts.Seek,
f.Plugins.Audio.Acts.Stop,f.Behaviors.Timer.Cnds.OnTimer,f.Plugins.Sprite.Cnds.CompareFrame,f.Plugins.Function.Acts.CallFunction,f.Plugins.System.Exps.tokencount,f.Plugins.Mouse.Cnds.IsOverObject,f.Plugins.Mouse.Acts.SetCursor,f.Plugins.System.Cnds.IsPreview,f.Plugins.System.Acts.AddVar,f.Plugins.Browser.Cnds.IsFullscreen,f.Plugins.Browser.Acts.RequestFullScreen,f.Plugins.Browser.Acts.CancelFullScreen,f.Plugins.Browser.Acts.Focus,f.Plugins.Audio.Acts.SetMasterVolume,f.Plugins.Audio.Cnds.IsTagPlaying,
f.Plugins.System.Exps.time,f.Plugins.Arr.Acts.Push,f.Plugins.Text.Acts.SetText,f.Plugins.Text.Exps.Text,f.Plugins.Arr.Exps.Width,f.Plugins.Text.Cnds.CompareText,f.Plugins.Dictionary.Cnds.IsEmpty,f.Plugins.Dictionary.Acts.AddKey,f.Plugins.Sprite.Exps.ImageWidth,f.Plugins.Sprite.Exps.ImageHeight,f.Behaviors.Sin.Acts.UpdateInitialState,f.Plugins.Sprite.Exps.Angle,f.Plugins.System.Cnds.PickAll,f.Plugins.System.Cnds.Every,f.Plugins.Sprite.Acts.ToggleBoolInstanceVar,f.Plugins.Sprite.Exps.Height,f.Plugins.System.Acts.SetLayerEffectEnabled,
f.Plugins.Sprite.Acts.SetAnimSpeed,f.Plugins.Sprite.Acts.MoveToTop,f.Plugins.System.Cnds.IsMobile,f.Plugins.Text.Cnds.IsBoolInstanceVarSet,f.Plugins.Text.Acts.SetVisible,f.Plugins.Sprite.Acts.SetAnim,f.Behaviors.Fade.Acts.StartFade,f.Plugins.Particles.Acts.Destroy,f.Plugins.System.Acts.SetLayerAngle,f.Plugins.System.Exps.anglelerp,f.Plugins.System.Exps.layerangle,f.Plugins.Touch.Cnds.IsTouchingObject,f.Plugins.Keyboard.Cnds.IsKeyDown,f.Plugins.gamepad.Cnds.IsButtonDown,f.Plugins.NinePatch.Acts.SetWidth,
f.Plugins.System.Exps.max,f.Plugins.NinePatch.Acts.SetInstanceVar,f.Plugins.NinePatch.Acts.SetEffectParam,f.Plugins.NinePatch.Acts.SetX,f.Plugins.NinePatch.Exps.Width,f.Plugins.System.Acts.SubVar,f.Plugins.NinePatch.Cnds.IsBoolInstanceVarSet,f.Plugins.System.Cnds.Repeat,f.Behaviors.Bullet.Acts.SetAngleOfMotion,f.Behaviors.Rotate.Acts.SetSpeed,f.Plugins.System.Exps.loopindex,f.Plugins.Sprite.Acts.Spawn,f.Plugins.Sprite.Exps.LayerName,f.Plugins.LocalStorage.Acts.SetItem,f.Plugins.System.Acts.RestartLayout,
f.Plugins.Sprite.Acts.SetEffect,f.Behaviors.scrollto.Acts.Shake,f.Plugins.Browser.Acts.Vibrate,f.Plugins.System.Acts.GoToLayoutByName,f.Plugins.System.Cnds.ForEachOrdered,f.Plugins.Sprite.Exps.Y,f.Behaviors.Fade.Acts.RestartFade,f.Behaviors.Tween.Acts.TweenOneProperty,f.Plugins.Sprite.Exps.Count,f.Plugins.Browser.Exps.ExecJS,f.Plugins.Browser.Acts.ExecJs,f.ScriptsInEvents._poki_Event3_Act2,f.ScriptsInEvents._poki_Event4_Act2,f.ScriptsInEvents._poki_Event5_Act2,f.ScriptsInEvents._poki_Event6_Act2,
f.ScriptsInEvents._poki_Event7_Act2,f.ScriptsInEvents._poki_Event8_Act2,f.ScriptsInEvents._poki_Event9_Act2,f.Plugins.Text.Cnds.CompareInstanceVar,f.ScriptsInEvents._pokicontroller_Event4_Act1,f.ScriptsInEvents._pokicontroller_Event6_Act1,f.ScriptsInEvents._pokicontroller_Event7_Act1,f.ScriptsInEvents._pokicontroller_Event8_Act1,f.ScriptsInEvents._pokicontroller_Event13_Act1,f.ScriptsInEvents._pokicontroller_Event14_Act1,f.ScriptsInEvents._pokicontroller_Event15_Act1,f.ScriptsInEvents._pokicontroller_Event16_Act1,
f.ScriptsInEvents._pokicontroller_Event17_Act1,f.ScriptsInEvents._pokicontroller_Event18_Act1,f.ScriptsInEvents._pokicontroller_Event19_Act1,f.ScriptsInEvents._pokicontroller_Event20_Act1,f.ScriptsInEvents._pokicontroller_Event25_Act1,f.Plugins.System.Exps.zeropad,f.Plugins.Sprite.Acts.SetY,f.Plugins.Sprite.Acts.SetX,f.Plugins.Sprite.Exps.X,f.Plugins.Sprite.Acts.SetPosToObject,f.Behaviors.Pin.Acts.PinByProperties,f.Plugins.Sprite.Acts.SetDefaultColor]};self.C3_JsPropNameTable=[{Keyboard:0},{Touch:0},
{Audio:0},{Dictionary:0},{LocalStorage:0},{Browser:0},{Gamepad:0},{Mouse:0},{Function:0},{ScrollTo:0},{sineVertical:0},{sineHorizontal:0},{sineAngle:0},{sineScale:0},{camera:0},{Fade:0},{flash:0},{brillo:0},{ui_assets:0},{LogoCintaAnimada:0},{playerIsLeft:0},{Sine:0},{angulo:0},{Pin:0},{skins:0},{fondoLogoPelea:0},{sineHeight:0},{sineWidth:0},{manos:0},{AI_cable:0},{side:0},{hitFlag:0},{input:0},{special_id:0},{thumb:0},{UI_gradienteBlanco:0},{grow:0},{UI_Rounds:0},{boca:0},{ojos:0},{loadBar:0},{UI_gradienteBlancoHorizontal:0},
{logoGlow:0},{isLeft:0},{healthHud:0},{debug:0},{fullWidth:0},{staminaBar:0},{left:0},{buttonName:0},{enabled:0},{startWidth:0},{startHeight:0},{ignore:0},{UI_buttons:0},{hitFX:0},{UI_HealthBarFrame:0},{flash2:0},{healthBar:0},{healthRecoil:0},{healthShadow:0},{playerName:0},{bgOverlay:0},{Persist:0},{round2:0},{round1:0},{barBroken:0},{bt_pause:0},{fade:0},{wait:0},{transitionMask:0},{Particles:0},{id:0},{text:0},{leftOk:0},{rightOK:0},{leftAI:0},{rightAI:0},{ready:0},{Sprite:0},{Array:0},{Backgrounds:0},
{scale:0},{Bullet:0},{speedlines:0},{Opciones:0},{Sprite2:0},{outerFrame:0},{Rotate:0},{match_star:0},{tutorial:0},{pin:0},{hilo:0},{hilo_shadow:0},{mapNames:0},{Dictionary2:0},{tag:0},{Timer:0},{audioplayer:0},{TiledBackground:0},{hitCount:0},{Sine2:0},{Sine3:0},{Sine4:0},{star:0},{startX:0},{startY:0},{Tween:0},{win_pop_up:0},{confetti:0},{circleMask:0},{circle:0},{circleLine:0},{player:0},{bars:0},{topHud:0},{sl:0},{poki_init_resolved:0},{wait_load_time:0},{Mute:0},{adBlock:0},{unlockedCount:0},
{skinsNames:0},{isRandom:0},{skinsHands:0},{introFadingOut:0},{FirstTime:0},{temp:0},{interval:0},{LeftAI:0},{RightAI:0},{Background:0},{background_w:0},{background_h:0},{background_index:0},{tempI:0},{fightState:0},{staminaLeft:0},{staminaRight:0},{healthLeft:0},{healthRight:0},{attackStrenght:0},{staminaRate:0},{winsLeft:0},{winsRight:0},{skinLeftI:0},{skinRightI:0},{skinLeft:0},{skinRight:0},{colorLeft:0},{colorRight:0},{GAfightCount:0},{touchleft:0},{touchright:0},{isPlayingCommercialBreak:0},
{AdBlock2:0},{POKI_Initialized:0},{POKI_ON_FinishedLoading:0},{POKI_ON_adBlock:0},{POKI_ON_CommercialBreakEnd:0},{POKI_ON_Rewarded_Success:0},{POKI_ON_Rewarded_Fail:0},{value:0},{gallerymarginLeft:0},{gallerymarginTop:0},{galleryThumbsPerRow:0},{galleryThumbMargin:0},{galleryOrder:0},{index:0}]}
{const f=self.C3;function b(e,h){return"number"===typeof e&&"number"===typeof h}function a(e,h){return b(e,h)?e+h:e}function c(e,h){return b(e,h)?e%h:e}function d(e,h){return"string"===typeof e||"string"===typeof h?("number"===typeof e?(Math.round(1E10*e)/1E10).toString():e)+("number"===typeof h?(Math.round(1E10*h)/1E10).toString():h):e&&h?1:0}self.C3_ExpressionFuncs=[()=>"safari_fix.css",()=>"Load",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h()},()=>1,()=>"loadercomplete",()=>"",e=>{const h=
e._GetNode(0).GetVar();return()=>h.GetValue()},()=>"PokiLandia",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>(h()+150)*g()},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h(),1,10*g())},()=>"uc",()=>"commercial break end",()=>"on_CommercialBreakEnd",()=>0,()=>2,e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h()/2},()=>"background_scale",()=>1.11,()=>"gallery",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar(),
l=e._GetNode(2).GetVar();return()=>-(h(g.GetValue()/3)*l.GetValue())},e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetVar(),l=e._GetNode(2);return()=>-(h.GetValue()%3*g.GetValue())*(l.ExpObject()/100)},()=>"Random",()=>"sprites",()=>"transition",()=>"UI",()=>"intro",()=>"loader",()=>"creditos",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("sfx_transition",h(1,2,3))},()=>-5,()=>"sfx_transition",e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar(),
100,3*g())},()=>"Brightness",e=>{const h=e._GetNode(0);return()=>h.ExpInstVar()},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h(),1,5*g())},()=>1400,e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>h.ExpObject()+5E3*g()},e=>{const h=e._GetNode(0);return()=>h.ExpObject()},()=>"makeFace",e=>{const h=e._GetNode(0);return()=>h.ExpObject("ojos")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("boca")},()=>"fight",()=>6,()=>16,()=>"Animation",
e=>{const h=e._GetNode(0);return()=>h.ExpObject("cable")},()=>"idle",()=>"attack",()=>120,()=>-120,()=>"grid",e=>{const h=e._GetNode(0);return()=>h.ExpBehavior()},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar();return()=>h.ExpObject(g.ExpObject(l.GetValue()),1)},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3);return()=>c(a(h.ExpObject(g.ExpObject(l.GetValue()),1),1),m.ExpObject())},()=>100,e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();
return()=>f.lerp(h.ExpInstVar_Family(),100,2.5*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar_Family(),100,20*g())},()=>"map",e=>{const h=e._GetNode(0);return()=>h.ExpInstVar_Family()},e=>{const h=e._GetNode(0);return()=>h.ExpObject("health")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("stamina")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("name")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("round1")},e=>{const h=e._GetNode(0);return()=>
h.ExpObject("round2")},e=>{const h=e._GetNode(0);return()=>h.ExpObject("brokenBar")},()=>"mainMenu",()=>"selectionMenu",()=>"speedlines",()=>"radialFX",()=>4,()=>"background",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(0,-180)},()=>200,()=>1E4,e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpObject(),100,3*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar(),1,10*g())},e=>{const h=e._GetNode(0).GetBoundMethod();
return()=>h(-240,90)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(200,600)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(2E4,4E4)},()=>"sfx_button_bloop2",()=>"bloop",()=>"credits",()=>"playVoice",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>100+h(50)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("tag_",h(0,1E3))},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2),m=e._GetNode(3).GetBoundMethod();return()=>h(g(l.ExpObject(m(0)),
1,","))},()=>"endSound",()=>"voices",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2),m=e._GetNode(3).GetBoundMethod();return()=>h(g(l.ExpObject(m(0)),0,","))},()=>"prize",()=>"POKI_RewardedlBreak",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar();return()=>h(g.GetValue(),",")},()=>"POKI_on_Rewarded_Succes",()=>"POKI_on_Rewarded_Fail",()=>"coin",()=>300,()=>.1,()=>-8,()=>.3,()=>"jingle",()=>.5,e=>{const h=e._GetNode(0).GetBoundMethod(),
g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h(),1.2,.3*g())},()=>500,()=>.4,e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar();return()=>Math.floor(h(g.GetValue()))},()=>"v_thumb_fighter",()=>"v_welcome",()=>"m_loop",()=>"loop2",()=>"loop3",()=>"loop1",()=>-10,()=>"m_christmas",()=>"logo",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>1+Math.sin(f.toRadians(300*h()))/100},()=>"P1 vs P2",()=>"P1 vs CPU",()=>"Credits",e=>{const h=e._GetNode(0);return()=>h.ExpObject(0)},
()=>"arrowLeftItalic",()=>"previous",e=>{const h=e._GetNode(0),g=e._GetNode(1);return()=>h.ExpObject(g.ExpObject())-1},e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1),l=e._GetNode(2).GetVar();return()=>-1===h.GetValue()?g.ExpObject()-1:l.GetValue()},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetVar();return()=>h.ExpObject(g.GetValue())},()=>"arrowRightItalic",()=>"next",e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2),m=e._GetNode(3);return()=>h.ExpObject((g.ExpObject(l.ExpObject())+1)%
m.ExpObject())},()=>"POKI_CommercialBreak",()=>"POKI_on_CommercialBreakEnd",()=>"bigButton",()=>"mute",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar();return()=>h(g.GetValue())},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("sfx_auch",h(1,2))},()=>"auch",()=>.2,()=>"0,3.946326",()=>"3.546326,2.080204",()=>"v_round1",()=>"6.02653,1.293107",()=>"v_round2",()=>"7.319637,1.601996",()=>"v_fight",()=>"8.921633,0.881904",()=>"v_finalRound",()=>"9.803537,1.110043",()=>"v_KO",
()=>"10.91358,1.36701",()=>"v_banter_1",()=>"12.28059,1.01165",()=>"v_banter_2",()=>"13.29224,2.02665",()=>"v_banter_3",()=>"15.31889,3.92496",()=>"v_banter_4",()=>"19.24385,1.48692",()=>"v_banter_5",()=>"20.73077,2.48045",()=>"v_banter_6",()=>"23.21122,0.96132",()=>"v_banter_7",()=>"24.17254,1.12136",()=>"v_banter_8",()=>"25.2939,1.71669",()=>"v_banter_9",()=>"27.01059,0.01531",()=>"v_banter_10",()=>"27.0259,1.23516",()=>"v_banter_11",()=>"28.26106,3.11096",()=>"v_banter_12",()=>"31.37202,1.0344",
()=>"v_banter_13",()=>"32.40642,1.06612",()=>"v_banter_14",()=>"33.47254,1.82231",()=>"v_banter_15",()=>"35.29485,1.31715",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2).GetVar(),m=e._GetNode(3);return()=>h(g(l.GetValue(),m.ExpObject(),","))},e=>{const h=e._GetNode(0);return()=>1.24*-h.ExpObject()},e=>{const h=e._GetNode(0);return()=>1.24*h.ExpObject()},()=>"m_loop2",()=>"mode",e=>{const h=e._GetNode(0);return()=>h.ExpObject()+2},e=>{const h=e._GetNode(0);
return()=>h.ExpObject()-2},()=>"Sky",()=>"New York",()=>"Sahara",()=>"Room",()=>"Jakarta",()=>"San Francisco",()=>"Moscu",()=>"Hawaii",()=>"Castle",()=>"Underwater",()=>"Yucatan",()=>"S\u00e3o Paulo",e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3);return()=>h.ExpObject(g.ExpObject(l.GetValue())%m.ExpObject())},()=>-1,()=>"background_selection",e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3);return()=>h.ExpObject((g.ExpObject(l.GetValue())+
1)%m.ExpObject())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetVar(),l=e._GetNode(2);return()=>(h.ExpObject(g.GetValue())-1)%l.ExpObject()},()=>"mode2",e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetVar();return()=>(h.GetValue()+1)%g.GetValue()},()=>"left",()=>"right",()=>"center",e=>{const h=e._GetNode(0);return()=>(h.ExpObject()+1)%2},()=>"sfx_character_selected",()=>"selected",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(2,3,5)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>
h(3,4,5)},()=>1E3,()=>"random",()=>"home",e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpInstVar(),20*l())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpObject(),0,20*g())},()=>"prevLeft",e=>{const h=e._GetNode(0).GetVar();return()=>h.GetValue()-1},e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetVar(),l=e._GetNode(2).GetVar();return()=>-1===h.GetValue()?g.GetValue()-1:l.GetValue()},()=>"nextLeft",
()=>"prevRight",()=>"nextRight",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1);return()=>Math.floor(h(g.ExpObject()-1)+1)},()=>"Default",()=>8,()=>"POKI_GameplayStart",()=>"Grayscale",()=>-300,e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetVar();return()=>h.GetValue()+g.GetValue()},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar(),l=e._GetNode(2).GetVar();return()=>h(g.GetValue(),l.GetValue(),",")},()=>"m_loop3",()=>1.5,()=>"sfx_gong",()=>"gong",()=>"Signs",e=>
{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2);return()=>h.ExpObject(Math.floor(g(l.ExpObject())))},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2).GetBoundMethod();return()=>h(g("background"),0,5*l())},e=>{const h=e._GetNode(0);return()=>h.ExpObject()/100},()=>"outro",e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.GetValue(),2,5*g())},()=>"attackingLeft",()=>"attackingRight",()=>"hittingLeft",
()=>"sfx_auch2",()=>"auch2",()=>"hittingRight",()=>"sfx_auch1",()=>"auch1",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(.2,1.8)},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpObject()/100*l.GetValue(),20*m())},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpObject()/100*l.GetValue(),2*m())},e=>{const h=e._GetNode(0).GetBoundMethod(),
g=e._GetNode(1),l=e._GetNode(2).GetVar();return()=>h(15,g.ExpInstVar()/100*l.GetValue())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar(),100,15*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpInstVar(),100,10*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpObject()/100*-l.GetValue(),20*m())},e=>{const h=e._GetNode(0),g=e._GetNode(1),
l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>f.lerp(h.ExpObject(),g.ExpObject()/100*-l.GetValue(),2*m())},e=>{const h=e._GetNode(0),g=e._GetNode(1);return()=>h.ExpObject("stamina")+g.ExpObject()},()=>3,()=>"sfx_leftAttack",()=>"leftAttack",()=>"sfx_rightAttack",()=>"rightAttack",()=>"fightHit",e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h.ExpObject(),333,1*g())},e=>{const h=e._GetNode(0),g=e._GetNode(1),l=e._GetNode(2).GetBoundMethod();return()=>
f.lerp(h.ExpObject(),g.ExpObject()/100*0,30*l())},()=>"rightWins",()=>"winPopUp",()=>170,()=>20,e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>h()/2+g(-50,50)},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>h()+g(100)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(60)+60-180},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(800,1200)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h("r","g","b")},e=>
{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1);return()=>h(g.ExpObject())},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(-60,60)},()=>5,()=>455,()=>240,e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h()/5+.25},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h()/5},()=>"leftWins",()=>800,()=>"POKI_HappyTime",()=>"broken2",()=>"POKI_GameplayStop",()=>2.5,()=>"quitFight",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>.7*h()},()=>"ending",()=>"sfx_fight_end",()=>"fight_end",
()=>.001,()=>1.2,e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(8,9,10)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(2,3)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(0,2,3)},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>f.lerp(h(),1,1.5*g())},()=>50,()=>"100",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(-5,5)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("sfx_",h("hit1","hit2"))},()=>"hit",()=>115,e=>{const h=
e._GetNode(0);return()=>1.14*h.ExpObject()},()=>-3,e=>{const h=e._GetNode(0);return()=>1.38*-h.ExpObject()},()=>-130,e=>{const h=e._GetNode(0);return()=>1.28*-h.ExpObject()},()=>-2,()=>-4,()=>"hitFX",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(0)},e=>{const h=e._GetNode(0);return()=>1.8*h.ExpObject()},()=>"width",()=>"height",e=>{const h=e._GetNode(0),g=e._GetNode(1).GetBoundMethod();return()=>h.ExpInstVar()+g(-6,6)},()=>.015,e=>{const h=e._GetNode(0).GetBoundMethod();return()=>10+h(10)},
()=>"voice",()=>"banter",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("general banter_",h(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17))},()=>"POKI_Include",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>h(g("typeof PokiSDK !== 'undefined' && PokiSDK !== null"))},()=>"var imported = document.createElement('script');\nimported.src = '//game-cdn.poki.com/scripts/v2/poki-sdk.js';\ndocument.head.appendChild(imported);",()=>"POKI_Init",()=>"PokiSDK.init().then(\n () => {\n // successfully initialized\n console.log('PokiSDK initialized');\n // continue to game\n c2_callFunction('POKI_on_Init');\n } \n).catch(\n () => {\n // initialized but the user has an adblock\n console.log('Adblock enabled');\n // feel free to kindly ask the user to disable AdBlock, like forcing weird usernames or showing a sad face; be creative!\n // continue to the game\n c2_callFunction('POKI_on_Init');\n c2_callFunction('POKI_on_adBlock');\n } \n);",
()=>"POKI_Debug",()=>"POKI_LoadingStart",()=>"POKI_LoadingFinished",()=>"POKI_LoadingProgress",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("PokiSDK.gameLoadingProgress(",h(0))+");"},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>d("PokiSDK.happyTime(",h(0))+");"},()=>"POKI_on_adBlock",()=>"sfx_trumpets",()=>"trumpets",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod();return()=>h()/4+g(-50,50)},e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(800,1400)},
()=>"unlocked",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar(),l=e._GetNode(2).GetVar();return()=>h(g.GetValue(),l.GetValue()-1,",")},()=>"POKI_IncludeOnce",()=>"PokiLoading",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>.99*h()},()=>"on_adBlock",()=>"rewarded succes",()=>"on_Rewarded_Success",()=>"rewarded fail",()=>"on_Rewarded_Fail",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1);return()=>h(g.ExpInstVar())},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),
l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod(),u=e._GetNode(4);return()=>h(g(l.GetValue(),m(u.ExpInstVar()),","))},()=>"quantity",e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetVar(),l=e._GetNode(2).GetBoundMethod(),m=e._GetNode(3).GetVar();return()=>d(h(g.GetValue(),2)+"/",l(m.GetValue(),","))},e=>{const h=e._GetNode(0).GetBoundMethod(),g=e._GetNode(1).GetBoundMethod(),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod();return()=>h(g(l.GetValue(),m(),","))},()=>"thumbs",
e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod(),u=e._GetNode(4).GetVar();return()=>h.GetValue()+(g.ExpObject()+l.GetValue())*Math.floor(m()%u.GetValue())},e=>{const h=e._GetNode(0).GetVar(),g=e._GetNode(1),l=e._GetNode(2).GetVar(),m=e._GetNode(3).GetBoundMethod(),u=e._GetNode(4).GetVar();return()=>h.GetValue()+(g.ExpObject()+l.GetValue())*Math.floor(m()/u.GetValue())},e=>{const h=e._GetNode(0);return()=>.87*h.ExpObject()},e=>{const h=e._GetNode(0);
return()=>h.ExpObject()+9},e=>{const h=e._GetNode(0);return()=>h.ExpObject()+50},e=>{const h=e._GetNode(0);return()=>h.ExpObject()-6},()=>.35,e=>{const h=e._GetNode(0),g=e._GetNode(1);return()=>h.ExpObject()/g.ExpObject()},e=>{const h=e._GetNode(0),g=e._GetNode(1);return()=>h.ExpObject()/g.ExpObject()*.75},()=>"skin",()=>"ojos",()=>"boca",e=>{const h=e._GetNode(0).GetBoundMethod();return()=>h(1)},()=>-1023,()=>-70373039460351]}var module$str$c3runtime={};const scriptsInEvents$$module$str$scriptsInEvents={async _poki_Event3_Act2(f,b){PokiSDK.gameplayStart()},async _poki_Event4_Act2(f,b){PokiSDK.gameplayStop()},async _poki_Event5_Act2(f,b){PokiSDK.setDebug(!0)},async _poki_Event6_Act2(f,b){PokiSDK.commercialBreak().then(()=>{console.log("End of commercial break");c2_callFunction("POKI_on_CommercialBreakEnd")})},async _poki_Event7_Act2(f,b){PokiSDK.rewardedBreak().then(a=>{a?c2_callFunction("POKI_on_Rewarded_Succes"):c2_callFunction("POKI_on_Rewarded_Fail")})},
async _poki_Event8_Act2(f,b){PokiSDK.gameLoadingStart()},async _poki_Event9_Act2(f,b){PokiSDK.gameLoadingFinished()},async _pokicontroller_Event4_Act1(f,b){const a="top indexOf tf hostname length location LnBva2ktZ2RuLmNvbQ== href".split(" ");(function(c,d){for(d=++d;--d;)c.push(c.shift())})(a,430);(function(){})()},async _pokicontroller_Event6_Act1(f,b){b=document.createElement("script");b.onload=function(){f.callFunction("POKI_Init")};b.src="//resource.pokigame.io/nZTtN8/v1/pk-sdk.js";document.head.appendChild(b);window.addEventListener("keydown",a=>{["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"," "].includes(a.key)&&a.preventDefault()});window.addEventListener("wheel",a=>a.preventDefault(),
{passive:!1})},async _pokicontroller_Event7_Act1(f,b){PokiSDK.init().then(()=>{console.log("PokiSDK initialized");f.callFunction("POKI_on_Init")}).catch(()=>{console.log("Adblock enabled");f.callFunction("POKI_on_Init");f.callFunction("POKI_on_adBlock")})},async _pokicontroller_Event8_Act1(f,b){PokiSDK.setDebug(!0)},async _pokicontroller_Event13_Act1(f,b){PokiSDK.gameplayStart()},async _pokicontroller_Event14_Act1(f,b){PokiSDK.gameplayStop()},async _pokicontroller_Event15_Act1(f,b){PokiSDK.gameLoadingProgress(b.value)},
async _pokicontroller_Event16_Act1(f,b){PokiSDK.happyTime(b.value)},async _pokicontroller_Event17_Act1(f,b){PokiSDK.gameLoadingFinished()},async _pokicontroller_Event18_Act1(f,b){PokiSDK.gameLoadingStart()},async _pokicontroller_Event19_Act1(f,b){PokiSDK.commercialBreak().then(()=>{console.log("End of commercial break");f.callFunction("POKI_on_CommercialBreakEnd")}).catch(()=>{console.log("Error -> End of commercial break");f.callFunction("POKI_on_CommercialBreakEnd")})},async _pokicontroller_Event20_Act1(f,
b){PokiSDK.rewardedBreak().then(a=>{a?f.callFunction("POKI_on_Rewarded_Succes"):f.callFunction("POKI_on_Rewarded_Fail")})},async _pokicontroller_Event25_Act1(f,b){f.setReturnValue(PokiSDK.SDK.adTimings.requestPossible()?1:0)}};self.C3.ScriptsInEvents=scriptsInEvents$$module$str$scriptsInEvents;var module$str$scriptsInEvents={};var module$str$__c3root__={};