2004 lines
982 KiB
JavaScript
2004 lines
982 KiB
JavaScript
// Generated by Construct 3, the game and app creator :: https://www.construct.net
|
|
'use strict';"use strict";
|
|
(function(d,a){"object"===typeof exports&&"undefined"!==typeof module?a(exports):"function"===typeof define&&define.amd?define(["exports"],a):(d=d||self,a(d.glMatrix={}))})(this,function(d){function a(k,n,w){var B=n[0],D=n[1],F=n[2];n=n[3];var H=w[0],K=w[1],M=w[2];w=w[3];k[0]=B*H+F*K;k[1]=D*H+n*K;k[2]=B*M+F*w;k[3]=D*M+n*w;return k}function b(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];return k}function e(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=n[4];n=n[5];var M=w[0],P=w[1],
|
|
R=w[2],T=w[3],Z=w[4];w=w[5];k[0]=B*M+F*P;k[1]=D*M+H*P;k[2]=B*R+F*T;k[3]=D*R+H*T;k[4]=B*Z+F*w+K;k[5]=D*Z+H*w+n;return k}function c(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];k[4]=n[4]-w[4];k[5]=n[5]-w[5];return k}function f(){var k=new na(9);na!=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 g(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=n[4],M=n[5],P=n[6],R=n[7];n=n[8];var T=w[0],Z=w[1],V=w[2],da=w[3],ca=w[4],aa=w[5],ra=w[6],ma=
|
|
w[7];w=w[8];k[0]=T*B+Z*H+V*P;k[1]=T*D+Z*K+V*R;k[2]=T*F+Z*M+V*n;k[3]=da*B+ca*H+aa*P;k[4]=da*D+ca*K+aa*R;k[5]=da*F+ca*M+aa*n;k[6]=ra*B+ma*H+w*P;k[7]=ra*D+ma*K+w*R;k[8]=ra*F+ma*M+w*n;return k}function h(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];k[4]=n[4]-w[4];k[5]=n[5]-w[5];k[6]=n[6]-w[6];k[7]=n[7]-w[7];k[8]=n[8]-w[8];return k}function l(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k}function m(k,
|
|
n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=n[4],M=n[5],P=n[6],R=n[7],T=n[8],Z=n[9],V=n[10],da=n[11],ca=n[12],aa=n[13],ra=n[14];n=n[15];var ma=w[0],pa=w[1],qa=w[2],oa=w[3];k[0]=ma*B+pa*K+qa*T+oa*ca;k[1]=ma*D+pa*M+qa*Z+oa*aa;k[2]=ma*F+pa*P+qa*V+oa*ra;k[3]=ma*H+pa*R+qa*da+oa*n;ma=w[4];pa=w[5];qa=w[6];oa=w[7];k[4]=ma*B+pa*K+qa*T+oa*ca;k[5]=ma*D+pa*M+qa*Z+oa*aa;k[6]=ma*F+pa*P+qa*V+oa*ra;k[7]=ma*H+pa*R+qa*da+oa*n;ma=w[8];pa=w[9];qa=w[10];oa=w[11];k[8]=ma*B+pa*K+qa*T+oa*ca;k[9]=ma*D+pa*M+qa*Z+oa*aa;k[10]=ma*
|
|
F+pa*P+qa*V+oa*ra;k[11]=ma*H+pa*R+qa*da+oa*n;ma=w[12];pa=w[13];qa=w[14];oa=w[15];k[12]=ma*B+pa*K+qa*T+oa*ca;k[13]=ma*D+pa*M+qa*Z+oa*aa;k[14]=ma*F+pa*P+qa*V+oa*ra;k[15]=ma*H+pa*R+qa*da+oa*n;return k}function p(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=B+B,M=D+D,P=F+F;n=B*K;var R=B*M;B*=P;var T=D*M;D*=P;F*=P;K*=H;M*=H;H*=P;k[0]=1-(T+F);k[1]=R+H;k[2]=B-M;k[3]=0;k[4]=R-H;k[5]=1-(n+F);k[6]=D+K;k[7]=0;k[8]=B+M;k[9]=D-K;k[10]=1-(n+T);k[11]=0;k[12]=w[0];k[13]=w[1];k[14]=w[2];k[15]=1;return k}function x(k,
|
|
n){k[0]=n[12];k[1]=n[13];k[2]=n[14];return k}function v(k,n){var w=n[4],B=n[5],D=n[6],F=n[8],H=n[9],K=n[10];k[0]=Math.hypot(n[0],n[1],n[2]);k[1]=Math.hypot(w,B,D);k[2]=Math.hypot(F,H,K);return k}function r(k,n){var w=new na(3);v(w,n);var B=1/w[0],D=1/w[1],F=1/w[2],H=n[0]*B;w=n[1]*D;var K=n[2]*F,M=n[4]*B,P=n[5]*D,R=n[6]*F;B*=n[8];D*=n[9];n=n[10]*F;F=H+P+n;0<F?(H=2*Math.sqrt(F+1),k[3]=.25*H,k[0]=(R-D)/H,k[1]=(B-K)/H,k[2]=(w-M)/H):H>P&&H>n?(H=2*Math.sqrt(1+H-P-n),k[3]=(R-D)/H,k[0]=.25*H,k[1]=(w+M)/H,
|
|
k[2]=(B+K)/H):P>n?(H=2*Math.sqrt(1+P-H-n),k[3]=(B-K)/H,k[0]=(w+M)/H,k[1]=.25*H,k[2]=(R+D)/H):(H=2*Math.sqrt(1+n-H-P),k[3]=(w-M)/H,k[0]=(B+K)/H,k[1]=(R+D)/H,k[2]=.25*H);return k}function q(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];k[4]=n[4]-w[4];k[5]=n[5]-w[5];k[6]=n[6]-w[6];k[7]=n[7]-w[7];k[8]=n[8]-w[8];k[9]=n[9]-w[9];k[10]=n[10]-w[10];k[11]=n[11]-w[11];k[12]=n[12]-w[12];k[13]=n[13]-w[13];k[14]=n[14]-w[14];k[15]=n[15]-w[15];return k}function y(){var k=new na(3);na!=Float32Array&&
|
|
(k[0]=0,k[1]=0,k[2]=0);return k}function u(k){return Math.hypot(k[0],k[1],k[2])}function t(k,n,w){var B=new na(3);B[0]=k;B[1]=n;B[2]=w;return B}function A(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];return k}function z(k,n,w){k[0]=n[0]*w[0];k[1]=n[1]*w[1];k[2]=n[2]*w[2];return k}function C(k,n,w){k[0]=n[0]/w[0];k[1]=n[1]/w[1];k[2]=n[2]/w[2];return k}function E(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2])}function J(k,n){var w=n[0]-k[0],B=n[1]-k[1];k=n[2]-k[2];return w*w+B*B+k*k}function G(k){var n=
|
|
k[0],w=k[1];k=k[2];return n*n+w*w+k*k}function I(k,n){var w=n[0],B=n[1],D=n[2];w=w*w+B*B+D*D;0<w&&(w=1/Math.sqrt(w));k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;return k}function L(k,n){return k[0]*n[0]+k[1]*n[1]+k[2]*n[2]}function N(k,n,w){var B=n[0],D=n[1];n=n[2];var F=w[0],H=w[1];w=w[2];k[0]=D*w-n*H;k[1]=n*F-B*w;k[2]=B*H-D*F;return k}function S(){var k=new na(4);na!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[3]=0);return k}function X(k){var n=new na(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n}function U(k,
|
|
n,w,B){var D=new na(4);D[0]=k;D[1]=n;D[2]=w;D[3]=B;return D}function W(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k}function ia(k,n,w,B,D){k[0]=n;k[1]=w;k[2]=B;k[3]=D;return k}function ka(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];return k}function ya(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];k[2]=n[2]-w[2];k[3]=n[3]-w[3];return k}function ta(k,n,w){k[0]=n[0]*w[0];k[1]=n[1]*w[1];k[2]=n[2]*w[2];k[3]=n[3]*w[3];return k}function Ba(k,n,w){k[0]=n[0]/w[0];k[1]=n[1]/w[1];k[2]=
|
|
n[2]/w[2];k[3]=n[3]/w[3];return k}function Ea(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;return k}function Ca(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2],n[3]-k[3])}function Aa(k,n){var w=n[0]-k[0],B=n[1]-k[1],D=n[2]-k[2];k=n[3]-k[3];return w*w+B*B+D*D+k*k}function ja(k){return Math.hypot(k[0],k[1],k[2],k[3])}function Fa(k){var n=k[0],w=k[1],B=k[2];k=k[3];return n*n+w*w+B*B+k*k}function wa(k,n){var w=n[0],B=n[1],D=n[2];n=n[3];var F=w*w+B*B+D*D+n*n;0<F&&(F=1/Math.sqrt(F));k[0]=
|
|
w*F;k[1]=B*F;k[2]=D*F;k[3]=n*F;return k}function Da(k,n){return k[0]*n[0]+k[1]*n[1]+k[2]*n[2]+k[3]*n[3]}function Pa(k,n,w,B){var D=n[0],F=n[1],H=n[2];n=n[3];k[0]=D+B*(w[0]-D);k[1]=F+B*(w[1]-F);k[2]=H+B*(w[2]-H);k[3]=n+B*(w[3]-n);return k}function Qa(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]}function Ra(k,n){var w=k[0],B=k[1],D=k[2];k=k[3];var F=n[0],H=n[1],K=n[2];n=n[3];return Math.abs(w-F)<=1E-6*Math.max(1,Math.abs(w),Math.abs(F))&&Math.abs(B-H)<=1E-6*Math.max(1,Math.abs(B),
|
|
Math.abs(H))&&Math.abs(D-K)<=1E-6*Math.max(1,Math.abs(D),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))}function Ja(){var k=new na(4);na!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0);k[3]=1;return k}function Sa(k,n,w){w*=.5;var B=Math.sin(w);k[0]=B*n[0];k[1]=B*n[1];k[2]=B*n[2];k[3]=Math.cos(w);return k}function Ta(k,n,w){var B=n[0],D=n[1],F=n[2];n=n[3];var H=w[0],K=w[1],M=w[2];w=w[3];k[0]=B*w+n*H+D*M-F*K;k[1]=D*w+n*K+F*H-B*M;k[2]=F*w+n*M+B*K-D*H;k[3]=n*w-B*H-D*K-F*M;return k}function Ua(k,
|
|
n,w){w*=.5;var B=n[0],D=n[1],F=n[2];n=n[3];var H=Math.sin(w);w=Math.cos(w);k[0]=B*w+n*H;k[1]=D*w+F*H;k[2]=F*w-D*H;k[3]=n*w-B*H;return k}function Va(k,n,w){w*=.5;var B=n[0],D=n[1],F=n[2];n=n[3];var H=Math.sin(w);w=Math.cos(w);k[0]=B*w-F*H;k[1]=D*w+n*H;k[2]=F*w+B*H;k[3]=n*w-D*H;return k}function Wa(k,n,w){w*=.5;var B=n[0],D=n[1],F=n[2];n=n[3];var H=Math.sin(w);w=Math.cos(w);k[0]=B*w+D*H;k[1]=D*w-B*H;k[2]=F*w+n*H;k[3]=n*w-F*H;return k}function Xa(k,n){var w=n[0],B=n[1],D=n[2],F=Math.sqrt(w*w+B*B+D*D);
|
|
n=Math.exp(n[3]);var H=0<F?n*Math.sin(F)/F:0;k[0]=w*H;k[1]=B*H;k[2]=D*H;k[3]=n*Math.cos(F);return k}function Ya(k,n){var w=n[0],B=n[1],D=n[2];n=n[3];var F=Math.sqrt(w*w+B*B+D*D);F=0<F?Math.atan2(F,n)/F:0;k[0]=w*F;k[1]=B*F;k[2]=D*F;k[3]=.5*Math.log(w*w+B*B+D*D+n*n);return k}function Ka(k,n,w,B){var D=n[0],F=n[1],H=n[2];n=n[3];var K=w[0],M=w[1],P=w[2];w=w[3];var R=D*K+F*M+H*P+n*w;0>R&&(R=-R,K=-K,M=-M,P=-P,w=-w);if(1E-6<1-R){var T=Math.acos(R);var Z=Math.sin(T);R=Math.sin((1-B)*T)/Z;B=Math.sin(B*T)/
|
|
Z}else R=1-B;k[0]=R*D+B*K;k[1]=R*F+B*M;k[2]=R*H+B*P;k[3]=R*n+B*w;return k}function Za(k,n){var w=n[0]+n[4]+n[8];if(0<w)w=Math.sqrt(w+1),k[3]=.5*w,w=.5/w,k[0]=(n[5]-n[7])*w,k[1]=(n[6]-n[2])*w,k[2]=(n[1]-n[3])*w;else{var B=0;n[4]>n[0]&&(B=1);n[8]>n[3*B+B]&&(B=2);var D=(B+1)%3,F=(B+2)%3;w=Math.sqrt(n[3*B+B]-n[3*D+D]-n[3*F+F]+1);k[B]=.5*w;w=.5/w;k[3]=(n[3*D+F]-n[3*F+D])*w;k[D]=(n[3*D+B]+n[3*B+D])*w;k[F]=(n[3*F+B]+n[3*B+F])*w}return k}function $a(k,n,w){var B=.5*w[0],D=.5*w[1];w=.5*w[2];var F=n[0],H=n[1],
|
|
K=n[2];n=n[3];k[0]=F;k[1]=H;k[2]=K;k[3]=n;k[4]=B*n+D*K-w*H;k[5]=D*n+w*F-B*K;k[6]=w*n+B*H-D*F;k[7]=-B*F-D*H-w*K;return k}function ab(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 bb(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=w[4],M=w[5],P=w[6],R=w[7],T=n[4],Z=n[5],V=n[6];n=n[7];var da=w[0],ca=w[1],aa=w[2];w=w[3];k[0]=B*w+H*da+D*aa-F*ca;k[1]=D*w+H*ca+F*da-B*aa;k[2]=F*w+H*aa+B*ca-D*da;k[3]=H*w-B*da-D*ca-F*aa;k[4]=B*R+H*K+D*P-F*M+T*w+n*da+Z*aa-V*
|
|
ca;k[5]=D*R+H*M+F*K-B*P+Z*w+n*ca+V*da-T*aa;k[6]=F*R+H*P+B*M-D*K+V*w+n*aa+T*ca-Z*da;k[7]=H*R-B*K-D*M-F*P+n*w-T*da-Z*ca-V*aa;return k}function cb(){var k=new na(2);na!=Float32Array&&(k[0]=0,k[1]=0);return k}function db(k,n,w){k[0]=n[0]-w[0];k[1]=n[1]-w[1];return k}function eb(k,n,w){k[0]=n[0]*w[0];k[1]=n[1]*w[1];return k}function fb(k,n,w){k[0]=n[0]/w[0];k[1]=n[1]/w[1];return k}function gb(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1])}function hb(k,n){var w=n[0]-k[0];k=n[1]-k[1];return w*w+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 na="undefined"!==typeof Float32Array?Float32Array:Array,Ga=Math.random,kb=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 lb=Object.freeze({__proto__:null,EPSILON:1E-6,get ARRAY_TYPE(){return na},RANDOM:Ga,setMatrixArrayType:function(k){na=k},toRadian:function(k){return k*kb},equals:function(k,n){return Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))}}),
|
|
mb=Object.freeze({__proto__:null,create:function(){var k=new na(4);na!=Float32Array&&(k[1]=0,k[2]=0);k[0]=1;k[3]=1;return k},clone:function(k){var n=new na(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;return k},fromValues:function(k,n,w,B){var D=new na(4);D[0]=k;D[1]=n;D[2]=w;D[3]=B;return D},set:function(k,n,w,B,D){k[0]=n;k[1]=w;k[2]=B;k[3]=D;return k},transpose:function(k,
|
|
n){if(k===n){var w=n[1];k[1]=n[2];k[2]=w}else k[0]=n[0],k[1]=n[2],k[2]=n[1],k[3]=n[3];return k},invert:function(k,n){var w=n[0],B=n[1],D=n[2];n=n[3];var F=w*n-D*B;if(!F)return null;F=1/F;k[0]=n*F;k[1]=-B*F;k[2]=-D*F;k[3]=w*F;return k},adjoint:function(k,n){var w=n[0];k[0]=n[3];k[1]=-n[1];k[2]=-n[2];k[3]=w;return k},determinant:function(k){return k[0]*k[3]-k[2]*k[1]},multiply:a,rotate:function(k,n,w){var B=n[0],D=n[1],F=n[2];n=n[3];var H=Math.sin(w);w=Math.cos(w);k[0]=B*w+F*H;k[1]=D*w+n*H;k[2]=B*-H+
|
|
F*w;k[3]=D*-H+n*w;return k},scale:function(k,n,w){var B=n[1],D=n[2],F=n[3],H=w[0];w=w[1];k[0]=n[0]*H;k[1]=B*H;k[2]=D*w;k[3]=F*w;return k},fromRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=w;k[2]=-w;k[3]=n;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=n[1];return k},str:function(k){return"mat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3])},LDU:function(k,n,w,B){k[2]=B[2]/B[0];w[0]=B[0];w[1]=B[1];w[3]=B[3]-k[2]*
|
|
w[1];return[k,n,w]},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];return k},subtract:b,exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]},equals:function(k,n){var w=k[0],B=k[1],D=k[2];k=k[3];var F=n[0],H=n[1],K=n[2];n=n[3];return Math.abs(w-F)<=1E-6*Math.max(1,Math.abs(w),Math.abs(F))&&Math.abs(B-H)<=1E-6*Math.max(1,Math.abs(B),Math.abs(H))&&Math.abs(D-K)<=1E-6*Math.max(1,Math.abs(D),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),
|
|
Math.abs(n))},multiplyScalar:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;return k},multiplyScalarAndAdd:function(k,n,w,B){k[0]=n[0]+w[0]*B;k[1]=n[1]+w[1]*B;k[2]=n[2]+w[2]*B;k[3]=n[3]+w[3]*B;return k},mul:a,sub:b}),nb=Object.freeze({__proto__:null,create:function(){var k=new na(6);na!=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 na(6);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];return n},copy:function(k,n){k[0]=
|
|
n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;return k},fromValues:function(k,n,w,B,D,F){var H=new na(6);H[0]=k;H[1]=n;H[2]=w;H[3]=B;H[4]=D;H[5]=F;return H},set:function(k,n,w,B,D,F,H){k[0]=n;k[1]=w;k[2]=B;k[3]=D;k[4]=F;k[5]=H;return k},invert:function(k,n){var w=n[0],B=n[1],D=n[2],F=n[3],H=n[4];n=n[5];var K=w*F-B*D;if(!K)return null;K=1/K;k[0]=F*K;k[1]=-B*K;k[2]=-D*K;k[3]=w*K;k[4]=(D*n-F*H)*K;k[5]=(B*H-w*n)*K;return k},
|
|
determinant:function(k){return k[0]*k[3]-k[1]*k[2]},multiply:e,rotate:function(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=n[4];n=n[5];var M=Math.sin(w);w=Math.cos(w);k[0]=B*w+F*M;k[1]=D*w+H*M;k[2]=B*-M+F*w;k[3]=D*-M+H*w;k[4]=K;k[5]=n;return k},scale:function(k,n,w){var B=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=w[0];w=w[1];k[0]=n[0]*M;k[1]=B*M;k[2]=D*w;k[3]=F*w;k[4]=H;k[5]=K;return k},translate:function(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=n[4];n=n[5];var M=w[0];w=w[1];k[0]=B;k[1]=D;k[2]=F;k[3]=H;k[4]=
|
|
B*M+F*w+K;k[5]=D*M+H*w+n;return k},fromRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=w;k[2]=-w;k[3]=n;k[4]=0;k[5]=0;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=n[1];k[4]=0;k[5]=0;return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=1;k[4]=n[0];k[5]=n[1];return k},str:function(k){return"mat2d("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],1)},add:function(k,n,w){k[0]=
|
|
n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];k[4]=n[4]+w[4];k[5]=n[5]+w[5];return k},subtract:c,multiplyScalar:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;k[4]=n[4]*w;k[5]=n[5]*w;return k},multiplyScalarAndAdd:function(k,n,w,B){k[0]=n[0]+w[0]*B;k[1]=n[1]+w[1]*B;k[2]=n[2]+w[2]*B;k[3]=n[3]+w[3]*B;k[4]=n[4]+w[4]*B;k[5]=n[5]+w[5]*B;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]},equals:function(k,n){var w=
|
|
k[0],B=k[1],D=k[2],F=k[3],H=k[4];k=k[5];var K=n[0],M=n[1],P=n[2],R=n[3],T=n[4];n=n[5];return Math.abs(w-K)<=1E-6*Math.max(1,Math.abs(w),Math.abs(K))&&Math.abs(B-M)<=1E-6*Math.max(1,Math.abs(B),Math.abs(M))&&Math.abs(D-P)<=1E-6*Math.max(1,Math.abs(D),Math.abs(P))&&Math.abs(F-R)<=1E-6*Math.max(1,Math.abs(F),Math.abs(R))&&Math.abs(H-T)<=1E-6*Math.max(1,Math.abs(H),Math.abs(T))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:e,sub:c}),ob=Object.freeze({__proto__:null,create:f,fromMat4:function(k,
|
|
n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[4];k[4]=n[5];k[5]=n[6];k[6]=n[8];k[7]=n[9];k[8]=n[10];return k},clone:function(k){var n=new na(9);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromValues:function(k,n,w,B,D,F,H,K,M){var P=new na(9);P[0]=k;P[1]=n;P[2]=w;P[3]=B;P[4]=D;P[5]=F;P[6]=H;P[7]=K;P[8]=M;return P},set:function(k,n,
|
|
w,B,D,F,H,K,M,P){k[0]=n;k[1]=w;k[2]=B;k[3]=D;k[4]=F;k[5]=H;k[6]=K;k[7]=M;k[8]=P;return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},transpose:function(k,n){if(k===n){var w=n[1],B=n[2],D=n[5];k[1]=n[3];k[2]=n[6];k[3]=w;k[5]=n[7];k[6]=B;k[7]=D}else k[0]=n[0],k[1]=n[3],k[2]=n[6],k[3]=n[1],k[4]=n[4],k[5]=n[7],k[6]=n[2],k[7]=n[5],k[8]=n[8];return k},invert:function(k,n){var w=n[0],B=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=n[6],P=n[7];n=n[8];var R=n*H-K*P,
|
|
T=-n*F+K*M,Z=P*F-H*M,V=w*R+B*T+D*Z;if(!V)return null;V=1/V;k[0]=R*V;k[1]=(-n*B+D*P)*V;k[2]=(K*B-D*H)*V;k[3]=T*V;k[4]=(n*w-D*M)*V;k[5]=(-K*w+D*F)*V;k[6]=Z*V;k[7]=(-P*w+B*M)*V;k[8]=(H*w-B*F)*V;return k},adjoint:function(k,n){var w=n[0],B=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=n[6],P=n[7];n=n[8];k[0]=H*n-K*P;k[1]=D*P-B*n;k[2]=B*K-D*H;k[3]=K*M-F*n;k[4]=w*n-D*M;k[5]=D*F-w*K;k[6]=F*P-H*M;k[7]=B*M-w*P;k[8]=w*H-B*F;return k},determinant:function(k){var n=k[3],w=k[4],B=k[5],D=k[6],F=k[7],H=k[8];return k[0]*(H*
|
|
w-B*F)+k[1]*(-H*n+B*D)+k[2]*(F*n-w*D)},multiply:g,translate:function(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=n[4],M=n[5],P=n[6],R=n[7];n=n[8];var T=w[0];w=w[1];k[0]=B;k[1]=D;k[2]=F;k[3]=H;k[4]=K;k[5]=M;k[6]=T*B+w*H+P;k[7]=T*D+w*K+R;k[8]=T*F+w*M+n;return k},rotate:function(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=n[4],M=n[5],P=n[6],R=n[7];n=n[8];var T=Math.sin(w);w=Math.cos(w);k[0]=w*B+T*H;k[1]=w*D+T*K;k[2]=w*F+T*M;k[3]=w*H-T*B;k[4]=w*K-T*D;k[5]=w*M-T*F;k[6]=P;k[7]=R;k[8]=n;return k},scale:function(k,
|
|
n,w){var B=w[0];w=w[1];k[0]=B*n[0];k[1]=B*n[1];k[2]=B*n[2];k[3]=w*n[3];k[4]=w*n[4];k[5]=w*n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=n[0];k[7]=n[1];k[8]=1;return k},fromRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=w;k[2]=0;k[3]=-w;k[4]=n;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=n[1];k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromMat2d:function(k,
|
|
n){k[0]=n[0];k[1]=n[1];k[2]=0;k[3]=n[2];k[4]=n[3];k[5]=0;k[6]=n[4];k[7]=n[5];k[8]=1;return k},fromQuat:function(k,n){var w=n[0],B=n[1],D=n[2];n=n[3];var F=w+w,H=B+B,K=D+D;w*=F;var M=B*F;B*=H;var P=D*F,R=D*H;D*=K;F*=n;H*=n;n*=K;k[0]=1-B-D;k[3]=M-n;k[6]=P+H;k[1]=M+n;k[4]=1-w-D;k[7]=R-F;k[2]=P-H;k[5]=R+F;k[8]=1-w-B;return k},normalFromMat4:function(k,n){var w=n[0],B=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=n[6],P=n[7],R=n[8],T=n[9],Z=n[10],V=n[11],da=n[12],ca=n[13],aa=n[14];n=n[15];var ra=w*K-B*H,ma=w*M-D*
|
|
H,pa=w*P-F*H,qa=B*M-D*K,oa=B*P-F*K,za=D*P-F*M,O=R*ca-T*da,Q=R*aa-Z*da;R=R*n-V*da;var Y=T*aa-Z*ca;T=T*n-V*ca;Z=Z*n-V*aa;V=ra*Z-ma*T+pa*Y+qa*R-oa*Q+za*O;if(!V)return null;V=1/V;k[0]=(K*Z-M*T+P*Y)*V;k[1]=(M*R-H*Z-P*Q)*V;k[2]=(H*T-K*R+P*O)*V;k[3]=(D*T-B*Z-F*Y)*V;k[4]=(w*Z-D*R+F*Q)*V;k[5]=(B*R-w*T-F*O)*V;k[6]=(ca*za-aa*oa+n*qa)*V;k[7]=(aa*pa-da*za-n*ma)*V;k[8]=(da*oa-ca*pa+n*ra)*V;return k},projection:function(k,n,w){k[0]=2/n;k[1]=0;k[2]=0;k[3]=0;k[4]=-2/w;k[5]=0;k[6]=-1;k[7]=1;k[8]=1;return k},str:function(k){return"mat3("+
|
|
k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+", "+k[8]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8])},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];k[4]=n[4]+w[4];k[5]=n[5]+w[5];k[6]=n[6]+w[6];k[7]=n[7]+w[7];k[8]=n[8]+w[8];return k},subtract:h,multiplyScalar:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;k[4]=n[4]*w;k[5]=n[5]*w;k[6]=n[6]*w;k[7]=n[7]*w;k[8]=n[8]*w;return k},multiplyScalarAndAdd:function(k,
|
|
n,w,B){k[0]=n[0]+w[0]*B;k[1]=n[1]+w[1]*B;k[2]=n[2]+w[2]*B;k[3]=n[3]+w[3]*B;k[4]=n[4]+w[4]*B;k[5]=n[5]+w[5]*B;k[6]=n[6]+w[6]*B;k[7]=n[7]+w[7]*B;k[8]=n[8]+w[8]*B;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]&&k[8]===n[8]},equals:function(k,n){var w=k[0],B=k[1],D=k[2],F=k[3],H=k[4],K=k[5],M=k[6],P=k[7];k=k[8];var R=n[0],T=n[1],Z=n[2],V=n[3],da=n[4],ca=n[5],aa=n[6],ra=n[7];n=n[8];return Math.abs(w-R)<=
|
|
1E-6*Math.max(1,Math.abs(w),Math.abs(R))&&Math.abs(B-T)<=1E-6*Math.max(1,Math.abs(B),Math.abs(T))&&Math.abs(D-Z)<=1E-6*Math.max(1,Math.abs(D),Math.abs(Z))&&Math.abs(F-V)<=1E-6*Math.max(1,Math.abs(F),Math.abs(V))&&Math.abs(H-da)<=1E-6*Math.max(1,Math.abs(H),Math.abs(da))&&Math.abs(K-ca)<=1E-6*Math.max(1,Math.abs(K),Math.abs(ca))&&Math.abs(M-aa)<=1E-6*Math.max(1,Math.abs(M),Math.abs(aa))&&Math.abs(P-ra)<=1E-6*Math.max(1,Math.abs(P),Math.abs(ra))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},
|
|
mul:g,sub:h}),pb=Object.freeze({__proto__:null,create:function(){var k=new na(16);na!=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 na(16);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];n[9]=k[9];n[10]=k[10];n[11]=k[11];n[12]=k[12];n[13]=k[13];n[14]=k[14];n[15]=k[15];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=
|
|
n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];k[9]=n[9];k[10]=n[10];k[11]=n[11];k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},fromValues:function(k,n,w,B,D,F,H,K,M,P,R,T,Z,V,da,ca){var aa=new na(16);aa[0]=k;aa[1]=n;aa[2]=w;aa[3]=B;aa[4]=D;aa[5]=F;aa[6]=H;aa[7]=K;aa[8]=M;aa[9]=P;aa[10]=R;aa[11]=T;aa[12]=Z;aa[13]=V;aa[14]=da;aa[15]=ca;return aa},set:function(k,n,w,B,D,F,H,K,M,P,R,T,Z,V,da,ca,aa){k[0]=n;k[1]=w;k[2]=B;k[3]=D;k[4]=F;k[5]=H;k[6]=K;k[7]=M;k[8]=P;k[9]=R;k[10]=T;k[11]=
|
|
Z;k[12]=V;k[13]=da;k[14]=ca;k[15]=aa;return k},identity:l,transpose:function(k,n){if(k===n){var w=n[1],B=n[2],D=n[3],F=n[6],H=n[7],K=n[11];k[1]=n[4];k[2]=n[8];k[3]=n[12];k[4]=w;k[6]=n[9];k[7]=n[13];k[8]=B;k[9]=F;k[11]=n[14];k[12]=D;k[13]=H;k[14]=K}else k[0]=n[0],k[1]=n[4],k[2]=n[8],k[3]=n[12],k[4]=n[1],k[5]=n[5],k[6]=n[9],k[7]=n[13],k[8]=n[2],k[9]=n[6],k[10]=n[10],k[11]=n[14],k[12]=n[3],k[13]=n[7],k[14]=n[11],k[15]=n[15];return k},invert:function(k,n){var w=n[0],B=n[1],D=n[2],F=n[3],H=n[4],K=n[5],
|
|
M=n[6],P=n[7],R=n[8],T=n[9],Z=n[10],V=n[11],da=n[12],ca=n[13],aa=n[14];n=n[15];var ra=w*K-B*H,ma=w*M-D*H,pa=w*P-F*H,qa=B*M-D*K,oa=B*P-F*K,za=D*P-F*M,O=R*ca-T*da,Q=R*aa-Z*da,Y=R*n-V*da,ba=T*aa-Z*ca,fa=T*n-V*ca,ha=Z*n-V*aa,ea=ra*ha-ma*fa+pa*ba+qa*Y-oa*Q+za*O;if(!ea)return null;ea=1/ea;k[0]=(K*ha-M*fa+P*ba)*ea;k[1]=(D*fa-B*ha-F*ba)*ea;k[2]=(ca*za-aa*oa+n*qa)*ea;k[3]=(Z*oa-T*za-V*qa)*ea;k[4]=(M*Y-H*ha-P*Q)*ea;k[5]=(w*ha-D*Y+F*Q)*ea;k[6]=(aa*pa-da*za-n*ma)*ea;k[7]=(R*za-Z*pa+V*ma)*ea;k[8]=(H*fa-K*Y+P*
|
|
O)*ea;k[9]=(B*Y-w*fa-F*O)*ea;k[10]=(da*oa-ca*pa+n*ra)*ea;k[11]=(T*pa-R*oa-V*ra)*ea;k[12]=(K*Q-H*ba-M*O)*ea;k[13]=(w*ba-B*Q+D*O)*ea;k[14]=(ca*ma-da*qa-aa*ra)*ea;k[15]=(R*qa-T*ma+Z*ra)*ea;return k},adjoint:function(k,n){var w=n[0],B=n[1],D=n[2],F=n[3],H=n[4],K=n[5],M=n[6],P=n[7],R=n[8],T=n[9],Z=n[10],V=n[11],da=n[12],ca=n[13],aa=n[14];n=n[15];k[0]=K*(Z*n-V*aa)-T*(M*n-P*aa)+ca*(M*V-P*Z);k[1]=-(B*(Z*n-V*aa)-T*(D*n-F*aa)+ca*(D*V-F*Z));k[2]=B*(M*n-P*aa)-K*(D*n-F*aa)+ca*(D*P-F*M);k[3]=-(B*(M*V-P*Z)-K*(D*
|
|
V-F*Z)+T*(D*P-F*M));k[4]=-(H*(Z*n-V*aa)-R*(M*n-P*aa)+da*(M*V-P*Z));k[5]=w*(Z*n-V*aa)-R*(D*n-F*aa)+da*(D*V-F*Z);k[6]=-(w*(M*n-P*aa)-H*(D*n-F*aa)+da*(D*P-F*M));k[7]=w*(M*V-P*Z)-H*(D*V-F*Z)+R*(D*P-F*M);k[8]=H*(T*n-V*ca)-R*(K*n-P*ca)+da*(K*V-P*T);k[9]=-(w*(T*n-V*ca)-R*(B*n-F*ca)+da*(B*V-F*T));k[10]=w*(K*n-P*ca)-H*(B*n-F*ca)+da*(B*P-F*K);k[11]=-(w*(K*V-P*T)-H*(B*V-F*T)+R*(B*P-F*K));k[12]=-(H*(T*aa-Z*ca)-R*(K*aa-M*ca)+da*(K*Z-M*T));k[13]=w*(T*aa-Z*ca)-R*(B*aa-D*ca)+da*(B*Z-D*T);k[14]=-(w*(K*aa-M*ca)-H*
|
|
(B*aa-D*ca)+da*(B*M-D*K));k[15]=w*(K*Z-M*T)-H*(B*Z-D*T)+R*(B*M-D*K);return k},determinant:function(k){var n=k[0],w=k[1],B=k[2],D=k[3],F=k[4],H=k[5],K=k[6],M=k[7],P=k[8],R=k[9],T=k[10],Z=k[11],V=k[12],da=k[13],ca=k[14];k=k[15];return(n*H-w*F)*(T*k-Z*ca)-(n*K-B*F)*(R*k-Z*da)+(n*M-D*F)*(R*ca-T*da)+(w*K-B*H)*(P*k-Z*V)-(w*M-D*H)*(P*ca-T*V)+(B*M-D*K)*(P*da-R*V)},multiply:m,translate:function(k,n,w){var B=w[0],D=w[1];w=w[2];if(n===k)k[12]=n[0]*B+n[4]*D+n[8]*w+n[12],k[13]=n[1]*B+n[5]*D+n[9]*w+n[13],k[14]=
|
|
n[2]*B+n[6]*D+n[10]*w+n[14],k[15]=n[3]*B+n[7]*D+n[11]*w+n[15];else{var F=n[0];var H=n[1];var K=n[2];var M=n[3];var P=n[4];var R=n[5];var T=n[6];var Z=n[7];var V=n[8];var da=n[9];var ca=n[10];var aa=n[11];k[0]=F;k[1]=H;k[2]=K;k[3]=M;k[4]=P;k[5]=R;k[6]=T;k[7]=Z;k[8]=V;k[9]=da;k[10]=ca;k[11]=aa;k[12]=F*B+P*D+V*w+n[12];k[13]=H*B+R*D+da*w+n[13];k[14]=K*B+T*D+ca*w+n[14];k[15]=M*B+Z*D+aa*w+n[15]}return k},scale:function(k,n,w){var B=w[0],D=w[1];w=w[2];k[0]=n[0]*B;k[1]=n[1]*B;k[2]=n[2]*B;k[3]=n[3]*B;k[4]=
|
|
n[4]*D;k[5]=n[5]*D;k[6]=n[6]*D;k[7]=n[7]*D;k[8]=n[8]*w;k[9]=n[9]*w;k[10]=n[10]*w;k[11]=n[11]*w;k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},rotate:function(k,n,w,B){var D=B[0],F=B[1];B=B[2];var H=Math.hypot(D,F,B);if(1E-6>H)return null;H=1/H;D*=H;F*=H;B*=H;var K=Math.sin(w);var M=Math.cos(w);var P=1-M;w=n[0];H=n[1];var R=n[2];var T=n[3];var Z=n[4];var V=n[5];var da=n[6];var ca=n[7];var aa=n[8];var ra=n[9];var ma=n[10];var pa=n[11];var qa=D*D*P+M;var oa=F*D*P+B*K;var za=B*D*P-F*K;var O=
|
|
D*F*P-B*K;var Q=F*F*P+M;var Y=B*F*P+D*K;var ba=D*B*P+F*K;D=F*B*P-D*K;F=B*B*P+M;k[0]=w*qa+Z*oa+aa*za;k[1]=H*qa+V*oa+ra*za;k[2]=R*qa+da*oa+ma*za;k[3]=T*qa+ca*oa+pa*za;k[4]=w*O+Z*Q+aa*Y;k[5]=H*O+V*Q+ra*Y;k[6]=R*O+da*Q+ma*Y;k[7]=T*O+ca*Q+pa*Y;k[8]=w*ba+Z*D+aa*F;k[9]=H*ba+V*D+ra*F;k[10]=R*ba+da*D+ma*F;k[11]=T*ba+ca*D+pa*F;n!==k&&(k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);return k},rotateX:function(k,n,w){var B=Math.sin(w);w=Math.cos(w);var D=n[4],F=n[5],H=n[6],K=n[7],M=n[8],P=n[9],R=n[10],T=n[11];
|
|
n!==k&&(k[0]=n[0],k[1]=n[1],k[2]=n[2],k[3]=n[3],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[4]=D*w+M*B;k[5]=F*w+P*B;k[6]=H*w+R*B;k[7]=K*w+T*B;k[8]=M*w-D*B;k[9]=P*w-F*B;k[10]=R*w-H*B;k[11]=T*w-K*B;return k},rotateY:function(k,n,w){var B=Math.sin(w);w=Math.cos(w);var D=n[0],F=n[1],H=n[2],K=n[3],M=n[8],P=n[9],R=n[10],T=n[11];n!==k&&(k[4]=n[4],k[5]=n[5],k[6]=n[6],k[7]=n[7],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=D*w-M*B;k[1]=F*w-P*B;k[2]=H*w-R*B;k[3]=K*w-T*B;k[8]=D*B+M*w;k[9]=F*B+
|
|
P*w;k[10]=H*B+R*w;k[11]=K*B+T*w;return k},rotateZ:function(k,n,w){var B=Math.sin(w);w=Math.cos(w);var D=n[0],F=n[1],H=n[2],K=n[3],M=n[4],P=n[5],R=n[6],T=n[7];n!==k&&(k[8]=n[8],k[9]=n[9],k[10]=n[10],k[11]=n[11],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=D*w+M*B;k[1]=F*w+P*B;k[2]=H*w+R*B;k[3]=K*w+T*B;k[4]=M*w-D*B;k[5]=P*w-F*B;k[6]=R*w-H*B;k[7]=T*w-K*B;return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=n[0];k[13]=
|
|
n[1];k[14]=n[2];k[15]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n[1];k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=n[2];k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotation:function(k,n,w){var B=w[0],D=w[1];w=w[2];var F=Math.hypot(B,D,w);if(1E-6>F)return null;F=1/F;B*=F;D*=F;w*=F;F=Math.sin(n);n=Math.cos(n);var H=1-n;k[0]=B*B*H+n;k[1]=D*B*H+w*F;k[2]=w*B*H-D*F;k[3]=0;k[4]=B*D*H-w*F;k[5]=D*D*H+n;k[6]=w*D*H+B*F;k[7]=0;k[8]=B*w*H+D*F;k[9]=D*w*H-B*F;k[10]=w*w*H+n;k[11]=
|
|
0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromXRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=w;k[7]=0;k[8]=0;k[9]=-w;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromYRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=0;k[2]=-w;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=w;k[9]=0;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromZRotation:function(k,n){var w=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=w;k[2]=
|
|
0;k[3]=0;k[4]=-w;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotationTranslation:p,fromQuat2:function(k,n){var w=new na(3),B=-n[0],D=-n[1],F=-n[2],H=n[3],K=n[4],M=n[5],P=n[6],R=n[7],T=B*B+D*D+F*F+H*H;0<T?(w[0]=2*(K*H+R*B+M*F-P*D)/T,w[1]=2*(M*H+R*D+P*B-K*F)/T,w[2]=2*(P*H+R*F+K*D-M*B)/T):(w[0]=2*(K*H+R*B+M*F-P*D),w[1]=2*(M*H+R*D+P*B-K*F),w[2]=2*(P*H+R*F+K*D-M*B));p(k,n,w);return k},getTranslation:x,getScaling:v,getRotation:r,fromRotationTranslationScale:function(k,
|
|
n,w,B){var D=n[0],F=n[1],H=n[2],K=n[3],M=D+D,P=F+F,R=H+H;n=D*M;var T=D*P;D*=R;var Z=F*P;F*=R;H*=R;M*=K;P*=K;K*=R;R=B[0];var V=B[1];B=B[2];k[0]=(1-(Z+H))*R;k[1]=(T+K)*R;k[2]=(D-P)*R;k[3]=0;k[4]=(T-K)*V;k[5]=(1-(n+H))*V;k[6]=(F+M)*V;k[7]=0;k[8]=(D+P)*B;k[9]=(F-M)*B;k[10]=(1-(n+Z))*B;k[11]=0;k[12]=w[0];k[13]=w[1];k[14]=w[2];k[15]=1;return k},fromRotationTranslationScaleOrigin:function(k,n,w,B,D){var F=n[0],H=n[1],K=n[2],M=n[3],P=F+F,R=H+H,T=K+K;n=F*P;var Z=F*R,V=F*T;F=H*R;H*=T;var da=K*T;K=M*P;R*=M;
|
|
var ca=M*T,aa=B[0],ra=B[1];T=B[2];B=D[0];M=D[1];D=D[2];P=(1-(F+da))*aa;var ma=(Z+ca)*aa;aa*=V-R;Z=(Z-ca)*ra;da=(1-(n+da))*ra;ra*=H+K;V=(V+R)*T;H=(H-K)*T;n=(1-(n+F))*T;k[0]=P;k[1]=ma;k[2]=aa;k[3]=0;k[4]=Z;k[5]=da;k[6]=ra;k[7]=0;k[8]=V;k[9]=H;k[10]=n;k[11]=0;k[12]=w[0]+B-(P*B+Z*M+V*D);k[13]=w[1]+M-(ma*B+da*M+H*D);k[14]=w[2]+D-(aa*B+ra*M+n*D);k[15]=1;return k},fromQuat:function(k,n){var w=n[0],B=n[1],D=n[2];n=n[3];var F=w+w,H=B+B,K=D+D;w*=F;var M=B*F;B*=H;var P=D*F,R=D*H;D*=K;F*=n;H*=n;n*=K;k[0]=1-B-
|
|
D;k[1]=M+n;k[2]=P-H;k[3]=0;k[4]=M-n;k[5]=1-w-D;k[6]=R+F;k[7]=0;k[8]=P+H;k[9]=R-F;k[10]=1-w-B;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},frustum:function(k,n,w,B,D,F,H){var K=1/(w-n),M=1/(D-B),P=1/(F-H);k[0]=2*F*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2*F*M;k[6]=0;k[7]=0;k[8]=(w+n)*K;k[9]=(D+B)*M;k[10]=(H+F)*P;k[11]=-1;k[12]=0;k[13]=0;k[14]=H*F*2*P;k[15]=0;return k},perspective:function(k,n,w,B,D){n=1/Math.tan(n/2);k[0]=n/w;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[11]=-1;
|
|
k[12]=0;k[13]=0;k[15]=0;null!=D&&Infinity!==D?(w=1/(B-D),k[10]=(D+B)*w,k[14]=2*D*B*w):(k[10]=-1,k[14]=-2*B);return k},perspectiveFromFieldOfView:function(k,n,w,B){var D=Math.tan(n.upDegrees*Math.PI/180),F=Math.tan(n.downDegrees*Math.PI/180),H=Math.tan(n.leftDegrees*Math.PI/180);n=Math.tan(n.rightDegrees*Math.PI/180);var K=2/(H+n),M=2/(D+F);k[0]=K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=M;k[6]=0;k[7]=0;k[8]=-((H-n)*K*.5);k[9]=(D-F)*M*.5;k[10]=B/(w-B);k[11]=-1;k[12]=0;k[13]=0;k[14]=B*w/(w-B);k[15]=0;return k},
|
|
ortho:function(k,n,w,B,D,F,H){var K=1/(n-w),M=1/(B-D),P=1/(F-H);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=2*P;k[11]=0;k[12]=(n+w)*K;k[13]=(D+B)*M;k[14]=(H+F)*P;k[15]=1;return k},lookAt:function(k,n,w,B){var D=n[0],F=n[1];n=n[2];var H=B[0];var K=B[1];var M=B[2];var P=w[0];B=w[1];var R=w[2];if(1E-6>Math.abs(D-P)&&1E-6>Math.abs(F-B)&&1E-6>Math.abs(n-R))return l(k);w=D-P;B=F-B;P=n-R;var T=1/Math.hypot(w,B,P);w*=T;B*=T;P*=T;R=K*P-M*B;M=M*w-H*P;H=H*B-K*w;(T=Math.hypot(R,
|
|
M,H))?(T=1/T,R*=T,M*=T,H*=T):H=M=R=0;K=B*H-P*M;var Z=P*R-w*H;var V=w*M-B*R;(T=Math.hypot(K,Z,V))?(T=1/T,K*=T,Z*=T,V*=T):V=Z=K=0;k[0]=R;k[1]=K;k[2]=w;k[3]=0;k[4]=M;k[5]=Z;k[6]=B;k[7]=0;k[8]=H;k[9]=V;k[10]=P;k[11]=0;k[12]=-(R*D+M*F+H*n);k[13]=-(K*D+Z*F+V*n);k[14]=-(w*D+B*F+P*n);k[15]=1;return k},targetTo:function(k,n,w,B){var D=n[0],F=n[1];n=n[2];var H=B[0],K=B[1],M=B[2];B=D-w[0];var P=F-w[1];w=n-w[2];var R=B*B+P*P+w*w;0<R&&(R=1/Math.sqrt(R),B*=R,P*=R,w*=R);var T=K*w-M*P;M=M*B-H*w;H=H*P-K*B;R=T*T+M*
|
|
M+H*H;0<R&&(R=1/Math.sqrt(R),T*=R,M*=R,H*=R);k[0]=T;k[1]=M;k[2]=H;k[3]=0;k[4]=P*H-w*M;k[5]=w*T-B*H;k[6]=B*M-P*T;k[7]=0;k[8]=B;k[9]=P;k[10]=w;k[11]=0;k[12]=D;k[13]=F;k[14]=n;k[15]=1;return k},str:function(k){return"mat4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+", "+k[8]+", "+k[9]+", "+k[10]+", "+k[11]+", "+k[12]+", "+k[13]+", "+k[14]+", "+k[15]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],
|
|
k[15])},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];k[4]=n[4]+w[4];k[5]=n[5]+w[5];k[6]=n[6]+w[6];k[7]=n[7]+w[7];k[8]=n[8]+w[8];k[9]=n[9]+w[9];k[10]=n[10]+w[10];k[11]=n[11]+w[11];k[12]=n[12]+w[12];k[13]=n[13]+w[13];k[14]=n[14]+w[14];k[15]=n[15]+w[15];return k},subtract:q,multiplyScalar:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;k[4]=n[4]*w;k[5]=n[5]*w;k[6]=n[6]*w;k[7]=n[7]*w;k[8]=n[8]*w;k[9]=n[9]*w;k[10]=n[10]*w;k[11]=n[11]*w;k[12]=n[12]*w;k[13]=
|
|
n[13]*w;k[14]=n[14]*w;k[15]=n[15]*w;return k},multiplyScalarAndAdd:function(k,n,w,B){k[0]=n[0]+w[0]*B;k[1]=n[1]+w[1]*B;k[2]=n[2]+w[2]*B;k[3]=n[3]+w[3]*B;k[4]=n[4]+w[4]*B;k[5]=n[5]+w[5]*B;k[6]=n[6]+w[6]*B;k[7]=n[7]+w[7]*B;k[8]=n[8]+w[8]*B;k[9]=n[9]+w[9]*B;k[10]=n[10]+w[10]*B;k[11]=n[11]+w[11]*B;k[12]=n[12]+w[12]*B;k[13]=n[13]+w[13]*B;k[14]=n[14]+w[14]*B;k[15]=n[15]+w[15]*B;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===
|
|
n[6]&&k[7]===n[7]&&k[8]===n[8]&&k[9]===n[9]&&k[10]===n[10]&&k[11]===n[11]&&k[12]===n[12]&&k[13]===n[13]&&k[14]===n[14]&&k[15]===n[15]},equals:function(k,n){var w=k[0],B=k[1],D=k[2],F=k[3],H=k[4],K=k[5],M=k[6],P=k[7],R=k[8],T=k[9],Z=k[10],V=k[11],da=k[12],ca=k[13],aa=k[14];k=k[15];var ra=n[0],ma=n[1],pa=n[2],qa=n[3],oa=n[4],za=n[5],O=n[6],Q=n[7],Y=n[8],ba=n[9],fa=n[10],ha=n[11],ea=n[12],ua=n[13],sa=n[14];n=n[15];return Math.abs(w-ra)<=1E-6*Math.max(1,Math.abs(w),Math.abs(ra))&&Math.abs(B-ma)<=1E-6*
|
|
Math.max(1,Math.abs(B),Math.abs(ma))&&Math.abs(D-pa)<=1E-6*Math.max(1,Math.abs(D),Math.abs(pa))&&Math.abs(F-qa)<=1E-6*Math.max(1,Math.abs(F),Math.abs(qa))&&Math.abs(H-oa)<=1E-6*Math.max(1,Math.abs(H),Math.abs(oa))&&Math.abs(K-za)<=1E-6*Math.max(1,Math.abs(K),Math.abs(za))&&Math.abs(M-O)<=1E-6*Math.max(1,Math.abs(M),Math.abs(O))&&Math.abs(P-Q)<=1E-6*Math.max(1,Math.abs(P),Math.abs(Q))&&Math.abs(R-Y)<=1E-6*Math.max(1,Math.abs(R),Math.abs(Y))&&Math.abs(T-ba)<=1E-6*Math.max(1,Math.abs(T),Math.abs(ba))&&
|
|
Math.abs(Z-fa)<=1E-6*Math.max(1,Math.abs(Z),Math.abs(fa))&&Math.abs(V-ha)<=1E-6*Math.max(1,Math.abs(V),Math.abs(ha))&&Math.abs(da-ea)<=1E-6*Math.max(1,Math.abs(da),Math.abs(ea))&&Math.abs(ca-ua)<=1E-6*Math.max(1,Math.abs(ca),Math.abs(ua))&&Math.abs(aa-sa)<=1E-6*Math.max(1,Math.abs(aa),Math.abs(sa))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:m,sub:q}),La=function(){var k=y();return function(n,w,B,D,F,H){w||(w=3);B||(B=0);for(D=D?Math.min(D*w+B,n.length):n.length;B<D;B+=w)k[0]=n[B],
|
|
k[1]=n[B+1],k[2]=n[B+2],F(k,k,H),n[B]=k[0],n[B+1]=k[1],n[B+2]=k[2];return n}}();La=Object.freeze({__proto__:null,create:y,clone:function(k){var n=new na(3);n[0]=k[0];n[1]=k[1];n[2]=k[2];return n},length:u,fromValues:t,copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];return k},set:function(k,n,w,B){k[0]=n;k[1]=w;k[2]=B;return k},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];return k},subtract:A,multiply:z,divide:C,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);k[2]=
|
|
Math.ceil(n[2]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);k[2]=Math.floor(n[2]);return k},min:function(k,n,w){k[0]=Math.min(n[0],w[0]);k[1]=Math.min(n[1],w[1]);k[2]=Math.min(n[2],w[2]);return k},max:function(k,n,w){k[0]=Math.max(n[0],w[0]);k[1]=Math.max(n[1],w[1]);k[2]=Math.max(n[2],w[2]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);k[2]=Math.round(n[2]);return k},scale:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;return k},scaleAndAdd:function(k,
|
|
n,w,B){k[0]=n[0]+w[0]*B;k[1]=n[1]+w[1]*B;k[2]=n[2]+w[2]*B;return k},distance:E,squaredDistance:J,squaredLength:G,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:I,dot:L,cross:N,lerp:function(k,n,w,B){var D=n[0],F=n[1];n=n[2];k[0]=D+B*(w[0]-D);k[1]=F+B*(w[1]-F);k[2]=n+B*(w[2]-n);return k},hermite:function(k,n,w,B,D,F){var H=F*F,K=H*(2*F-3)+1,M=H*(F-2)+F,P=H*(F-1);F=H*(3-2*F);k[0]=n[0]*K+w[0]*M+B[0]*P+D[0]*
|
|
F;k[1]=n[1]*K+w[1]*M+B[1]*P+D[1]*F;k[2]=n[2]*K+w[2]*M+B[2]*P+D[2]*F;return k},bezier:function(k,n,w,B,D,F){var H=1-F,K=H*H,M=F*F,P=K*H;K*=3*F;H*=3*M;F*=M;k[0]=n[0]*P+w[0]*K+B[0]*H+D[0]*F;k[1]=n[1]*P+w[1]*K+B[1]*H+D[1]*F;k[2]=n[2]*P+w[2]*K+B[2]*H+D[2]*F;return k},random:function(k,n){n=n||1;var w=2*Ga()*Math.PI,B=2*Ga()-1,D=Math.sqrt(1-B*B)*n;k[0]=Math.cos(w)*D;k[1]=Math.sin(w)*D;k[2]=B*n;return k},transformMat4:function(k,n,w){var B=n[0],D=n[1];n=n[2];var F=w[3]*B+w[7]*D+w[11]*n+w[15];F=F||1;k[0]=
|
|
(w[0]*B+w[4]*D+w[8]*n+w[12])/F;k[1]=(w[1]*B+w[5]*D+w[9]*n+w[13])/F;k[2]=(w[2]*B+w[6]*D+w[10]*n+w[14])/F;return k},transformMat3:function(k,n,w){var B=n[0],D=n[1];n=n[2];k[0]=B*w[0]+D*w[3]+n*w[6];k[1]=B*w[1]+D*w[4]+n*w[7];k[2]=B*w[2]+D*w[5]+n*w[8];return k},transformQuat:function(k,n,w){var B=w[0],D=w[1],F=w[2],H=n[0],K=n[1];n=n[2];var M=D*n-F*K,P=F*H-B*n,R=B*K-D*H;w=2*w[3];k[0]=H+M*w+2*(D*R-F*P);k[1]=K+P*w+2*(F*M-B*R);k[2]=n+R*w+2*(B*P-D*M);return k},rotateX:function(k,n,w,B){var D=[],F=[];D[0]=n[0]-
|
|
w[0];D[1]=n[1]-w[1];D[2]=n[2]-w[2];F[0]=D[0];F[1]=D[1]*Math.cos(B)-D[2]*Math.sin(B);F[2]=D[1]*Math.sin(B)+D[2]*Math.cos(B);k[0]=F[0]+w[0];k[1]=F[1]+w[1];k[2]=F[2]+w[2];return k},rotateY:function(k,n,w,B){var D=[],F=[];D[0]=n[0]-w[0];D[1]=n[1]-w[1];D[2]=n[2]-w[2];F[0]=D[2]*Math.sin(B)+D[0]*Math.cos(B);F[1]=D[1];F[2]=D[2]*Math.cos(B)-D[0]*Math.sin(B);k[0]=F[0]+w[0];k[1]=F[1]+w[1];k[2]=F[2]+w[2];return k},rotateZ:function(k,n,w,B){var D=[],F=[];D[0]=n[0]-w[0];D[1]=n[1]-w[1];D[2]=n[2]-w[2];F[0]=D[0]*
|
|
Math.cos(B)-D[1]*Math.sin(B);F[1]=D[0]*Math.sin(B)+D[1]*Math.cos(B);F[2]=D[2];k[0]=F[0]+w[0];k[1]=F[1]+w[1];k[2]=F[2]+w[2];return k},angle:function(k,n){var w=k[0],B=k[1],D=k[2],F=n[0],H=n[1],K=n[2];k=(w=Math.sqrt(w*w+B*B+D*D)*Math.sqrt(F*F+H*H+K*K))&&L(k,n)/w;return Math.acos(Math.min(Math.max(k,-1),1))},zero:function(k){k[0]=0;k[1]=0;k[2]=0;return k},str:function(k){return"vec3("+k[0]+", "+k[1]+", "+k[2]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]},equals:function(k,
|
|
n){var w=k[0],B=k[1];k=k[2];var D=n[0],F=n[1];n=n[2];return Math.abs(w-D)<=1E-6*Math.max(1,Math.abs(w),Math.abs(D))&&Math.abs(B-F)<=1E-6*Math.max(1,Math.abs(B),Math.abs(F))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},sub:A,mul:z,div:C,dist:E,sqrDist:J,len:u,sqrLen:G,forEach:La});var Ma=function(){var k=S();return function(n,w,B,D,F,H){w||(w=4);B||(B=0);for(D=D?Math.min(D*w+B,n.length):n.length;B<D;B+=w)k[0]=n[B],k[1]=n[B+1],k[2]=n[B+2],k[3]=n[B+3],F(k,k,H),n[B]=k[0],n[B+1]=k[1],n[B+
|
|
2]=k[2],n[B+3]=k[3];return n}}();Ma=Object.freeze({__proto__:null,create:S,clone:X,fromValues:U,copy:W,set:ia,add:ka,subtract:ya,multiply:ta,divide:Ba,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);k[2]=Math.ceil(n[2]);k[3]=Math.ceil(n[3]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);k[2]=Math.floor(n[2]);k[3]=Math.floor(n[3]);return k},min:function(k,n,w){k[0]=Math.min(n[0],w[0]);k[1]=Math.min(n[1],w[1]);k[2]=Math.min(n[2],w[2]);k[3]=Math.min(n[3],w[3]);
|
|
return k},max:function(k,n,w){k[0]=Math.max(n[0],w[0]);k[1]=Math.max(n[1],w[1]);k[2]=Math.max(n[2],w[2]);k[3]=Math.max(n[3],w[3]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);k[2]=Math.round(n[2]);k[3]=Math.round(n[3]);return k},scale:Ea,scaleAndAdd:function(k,n,w,B){k[0]=n[0]+w[0]*B;k[1]=n[1]+w[1]*B;k[2]=n[2]+w[2]*B;k[3]=n[3]+w[3]*B;return k},distance:Ca,squaredDistance:Aa,length:ja,squaredLength:Fa,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:wa,dot:Da,cross:function(k,n,w,B){var D=w[0]*B[1]-w[1]*B[0],F=w[0]*B[2]-w[2]*B[0],H=w[0]*B[3]-w[3]*B[0],K=w[1]*B[2]-w[2]*B[1],M=w[1]*B[3]-w[3]*B[1];w=w[2]*B[3]-w[3]*B[2];B=n[0];var P=n[1],R=n[2];n=n[3];k[0]=P*w-R*M+n*K;k[1]=-(B*w)+R*H-n*F;k[2]=B*M-P*H+n*D;k[3]=-(B*K)+P*F-R*D;return k},lerp:Pa,random:function(k,n){n=n||1;do{var w=2*Ga()-1;var B=2*Ga()-1;var D=w*w+B*B}while(1<=D);do{var F=2*Ga()-1;var H=2*Ga()-
|
|
1;var K=F*F+H*H}while(1<=K);D=Math.sqrt((1-D)/K);k[0]=n*w;k[1]=n*B;k[2]=n*F*D;k[3]=n*H*D;return k},transformMat4:function(k,n,w){var B=n[0],D=n[1],F=n[2];n=n[3];k[0]=w[0]*B+w[4]*D+w[8]*F+w[12]*n;k[1]=w[1]*B+w[5]*D+w[9]*F+w[13]*n;k[2]=w[2]*B+w[6]*D+w[10]*F+w[14]*n;k[3]=w[3]*B+w[7]*D+w[11]*F+w[15]*n;return k},transformQuat:function(k,n,w){var B=n[0],D=n[1],F=n[2],H=w[0],K=w[1],M=w[2];w=w[3];var P=w*B+K*F-M*D,R=w*D+M*B-H*F,T=w*F+H*D-K*B;B=-H*B-K*D-M*F;k[0]=P*w+B*-H+R*-M-T*-K;k[1]=R*w+B*-K+T*-H-P*-M;
|
|
k[2]=T*w+B*-M+P*-K-R*-H;k[3]=n[3];return k},zero:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=0;return k},str:function(k){return"vec4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},exactEquals:Qa,equals:Ra,sub:ya,mul:ta,div:Ba,dist:Ca,sqrDist:Aa,len:ja,sqrLen:Fa,forEach:Ma});var Na=function(){var k=y(),n=t(1,0,0),w=t(0,1,0);return function(B,D,F){var H=L(D,F);if(-.999999>H)return N(k,n,D),1E-6>u(k)&&N(k,w,D),I(k,k),Sa(B,k,Math.PI),B;if(.999999<H)return B[0]=0,B[1]=0,B[2]=0,B[3]=1,B;N(k,D,F);B[0]=k[0];B[1]=k[1];
|
|
B[2]=k[2];B[3]=1+H;return wa(B,B)}}(),Oa=function(){var k=Ja(),n=Ja();return function(w,B,D,F,H,K){Ka(k,B,H,K);Ka(n,D,F,K);Ka(w,k,n,2*K*(1-K));return w}}(),Ia=function(){var k=f();return function(n,w,B,D){k[0]=B[0];k[3]=B[1];k[6]=B[2];k[1]=D[0];k[4]=D[1];k[7]=D[2];k[2]=-w[0];k[5]=-w[1];k[8]=-w[2];return wa(n,Za(n,k))}}();Na=Object.freeze({__proto__:null,create:Ja,identity:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=1;return k},setAxisAngle:Sa,getAxisAngle:function(k,n){var w=2*Math.acos(n[3]),B=Math.sin(w/
|
|
2);1E-6<B?(k[0]=n[0]/B,k[1]=n[1]/B,k[2]=n[2]/B):(k[0]=1,k[1]=0,k[2]=0);return w},getAngle:function(k,n){k=Da(k,n);return Math.acos(2*k*k-1)},multiply:Ta,rotateX:Ua,rotateY:Va,rotateZ:Wa,calculateW:function(k,n){var w=n[0],B=n[1];n=n[2];k[0]=w;k[1]=B;k[2]=n;k[3]=Math.sqrt(Math.abs(1-w*w-B*B-n*n));return k},exp:Xa,ln:Ya,pow:function(k,n,w){Ya(k,n);Ea(k,k,w);Xa(k,k);return k},slerp:Ka,random:function(k){var n=Ga(),w=Ga(),B=Ga(),D=Math.sqrt(1-n);n=Math.sqrt(n);k[0]=D*Math.sin(2*Math.PI*w);k[1]=D*Math.cos(2*
|
|
Math.PI*w);k[2]=n*Math.sin(2*Math.PI*B);k[3]=n*Math.cos(2*Math.PI*B);return k},invert:function(k,n){var w=n[0],B=n[1],D=n[2];n=n[3];var F=w*w+B*B+D*D+n*n;F=F?1/F:0;k[0]=-w*F;k[1]=-B*F;k[2]=-D*F;k[3]=n*F;return k},conjugate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];return k},fromMat3:Za,fromEuler:function(k,n,w,B){var D=.5*Math.PI/180;n*=D;w*=D;B*=D;D=Math.sin(n);n=Math.cos(n);var F=Math.sin(w);w=Math.cos(w);var H=Math.sin(B);B=Math.cos(B);k[0]=D*w*B-n*F*H;k[1]=n*F*B+D*w*H;k[2]=n*w*
|
|
H-D*F*B;k[3]=n*w*B+D*F*H;return k},str:function(k){return"quat("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},clone:X,fromValues:U,copy:W,set:ia,add:ka,mul:Ta,scale:Ea,dot:Da,lerp:Pa,length:ja,len:ja,squaredLength:Fa,sqrLen:Fa,normalize:wa,exactEquals:Qa,equals:Ra,rotationTo:Na,sqlerp:Oa,setAxes:Ia});Oa=Object.freeze({__proto__:null,create:function(){var k=new na(8);na!=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 na(8);n[0]=k[0];n[1]=k[1];
|
|
n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];return n},fromValues:function(k,n,w,B,D,F,H,K){var M=new na(8);M[0]=k;M[1]=n;M[2]=w;M[3]=B;M[4]=D;M[5]=F;M[6]=H;M[7]=K;return M},fromRotationTranslationValues:function(k,n,w,B,D,F,H){var K=new na(8);K[0]=k;K[1]=n;K[2]=w;K[3]=B;D*=.5;F*=.5;H*=.5;K[4]=D*B+F*w-H*n;K[5]=F*B+H*k-D*w;K[6]=H*B+D*n-F*k;K[7]=-D*k-F*n-H*w;return K},fromRotationTranslation:$a,fromTranslation:function(k,n){k[0]=0;k[1]=0;k[2]=0;k[3]=1;k[4]=.5*n[0];k[5]=.5*n[1];k[6]=.5*
|
|
n[2];k[7]=0;return k},fromRotation:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},fromMat4:function(k,n){var w=Ja();r(w,n);var B=new na(3);x(B,n);$a(k,w,B);return k},copy:ab,identity:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},set:function(k,n,w,B,D,F,H,K,M){k[0]=n;k[1]=w;k[2]=B;k[3]=D;k[4]=F;k[5]=H;k[6]=K;k[7]=M;return k},getReal:W,getDual:function(k,n){k[0]=n[4];k[1]=n[5];k[2]=n[6];k[3]=n[7];return k},setReal:W,setDual:function(k,
|
|
n){k[4]=n[0];k[5]=n[1];k[6]=n[2];k[7]=n[3];return k},getTranslation:function(k,n){var w=n[4],B=n[5],D=n[6],F=n[7],H=-n[0],K=-n[1],M=-n[2];n=n[3];k[0]=2*(w*n+F*H+B*M-D*K);k[1]=2*(B*n+F*K+D*H-w*M);k[2]=2*(D*n+F*M+w*K-B*H);return k},translate:function(k,n,w){var B=n[0],D=n[1],F=n[2],H=n[3],K=.5*w[0],M=.5*w[1];w=.5*w[2];var P=n[4],R=n[5],T=n[6];n=n[7];k[0]=B;k[1]=D;k[2]=F;k[3]=H;k[4]=H*K+D*w-F*M+P;k[5]=H*M+F*K-B*w+R;k[6]=H*w+B*M-D*K+T;k[7]=-B*K-D*M-F*w+n;return k},rotateX:function(k,n,w){var B=-n[0],
|
|
D=-n[1],F=-n[2],H=n[3],K=n[4],M=n[5],P=n[6],R=n[7],T=K*H+R*B+M*F-P*D,Z=M*H+R*D+P*B-K*F,V=P*H+R*F+K*D-M*B;K=R*H-K*B-M*D-P*F;Ua(k,n,w);B=k[0];D=k[1];F=k[2];H=k[3];k[4]=T*H+K*B+Z*F-V*D;k[5]=Z*H+K*D+V*B-T*F;k[6]=V*H+K*F+T*D-Z*B;k[7]=K*H-T*B-Z*D-V*F;return k},rotateY:function(k,n,w){var B=-n[0],D=-n[1],F=-n[2],H=n[3],K=n[4],M=n[5],P=n[6],R=n[7],T=K*H+R*B+M*F-P*D,Z=M*H+R*D+P*B-K*F,V=P*H+R*F+K*D-M*B;K=R*H-K*B-M*D-P*F;Va(k,n,w);B=k[0];D=k[1];F=k[2];H=k[3];k[4]=T*H+K*B+Z*F-V*D;k[5]=Z*H+K*D+V*B-T*F;k[6]=V*
|
|
H+K*F+T*D-Z*B;k[7]=K*H-T*B-Z*D-V*F;return k},rotateZ:function(k,n,w){var B=-n[0],D=-n[1],F=-n[2],H=n[3],K=n[4],M=n[5],P=n[6],R=n[7],T=K*H+R*B+M*F-P*D,Z=M*H+R*D+P*B-K*F,V=P*H+R*F+K*D-M*B;K=R*H-K*B-M*D-P*F;Wa(k,n,w);B=k[0];D=k[1];F=k[2];H=k[3];k[4]=T*H+K*B+Z*F-V*D;k[5]=Z*H+K*D+V*B-T*F;k[6]=V*H+K*F+T*D-Z*B;k[7]=K*H-T*B-Z*D-V*F;return k},rotateByQuatAppend:function(k,n,w){var B=w[0],D=w[1],F=w[2];w=w[3];var H=n[0],K=n[1],M=n[2],P=n[3];k[0]=H*w+P*B+K*F-M*D;k[1]=K*w+P*D+M*B-H*F;k[2]=M*w+P*F+H*D-K*B;k[3]=
|
|
P*w-H*B-K*D-M*F;H=n[4];K=n[5];M=n[6];P=n[7];k[4]=H*w+P*B+K*F-M*D;k[5]=K*w+P*D+M*B-H*F;k[6]=M*w+P*F+H*D-K*B;k[7]=P*w-H*B-K*D-M*F;return k},rotateByQuatPrepend:function(k,n,w){var B=n[0],D=n[1],F=n[2];n=n[3];var H=w[0],K=w[1],M=w[2],P=w[3];k[0]=B*P+n*H+D*M-F*K;k[1]=D*P+n*K+F*H-B*M;k[2]=F*P+n*M+B*K-D*H;k[3]=n*P-B*H-D*K-F*M;H=w[4];K=w[5];M=w[6];P=w[7];k[4]=B*P+n*H+D*M-F*K;k[5]=D*P+n*K+F*H-B*M;k[6]=F*P+n*M+B*K-D*H;k[7]=n*P-B*H-D*K-F*M;return k},rotateAroundAxis:function(k,n,w,B){if(1E-6>Math.abs(B))return ab(k,
|
|
n);var D=Math.hypot(w[0],w[1],w[2]);B*=.5;var F=Math.sin(B),H=F*w[0]/D,K=F*w[1]/D;w=F*w[2]/D;B=Math.cos(B);D=n[0];F=n[1];var M=n[2],P=n[3];k[0]=D*B+P*H+F*w-M*K;k[1]=F*B+P*K+M*H-D*w;k[2]=M*B+P*w+D*K-F*H;k[3]=P*B-D*H-F*K-M*w;D=n[4];F=n[5];M=n[6];n=n[7];k[4]=D*B+n*H+F*w-M*K;k[5]=F*B+n*K+M*H-D*w;k[6]=M*B+n*w+D*K-F*H;k[7]=n*B-D*H-F*K-M*w;return k},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];k[2]=n[2]+w[2];k[3]=n[3]+w[3];k[4]=n[4]+w[4];k[5]=n[5]+w[5];k[6]=n[6]+w[6];k[7]=n[7]+w[7];return k},multiply:bb,
|
|
mul:bb,scale:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;k[2]=n[2]*w;k[3]=n[3]*w;k[4]=n[4]*w;k[5]=n[5]*w;k[6]=n[6]*w;k[7]=n[7]*w;return k},dot:Da,lerp:function(k,n,w,B){var D=1-B;0>Da(n,w)&&(B=-B);k[0]=n[0]*D+w[0]*B;k[1]=n[1]*D+w[1]*B;k[2]=n[2]*D+w[2]*B;k[3]=n[3]*D+w[3]*B;k[4]=n[4]*D+w[4]*B;k[5]=n[5]*D+w[5]*B;k[6]=n[6]*D+w[6]*B;k[7]=n[7]*D+w[7]*B;return k},invert:function(k,n){var w=Fa(n);k[0]=-n[0]/w;k[1]=-n[1]/w;k[2]=-n[2]/w;k[3]=n[3]/w;k[4]=-n[4]/w;k[5]=-n[5]/w;k[6]=-n[6]/w;k[7]=n[7]/w;return k},conjugate:function(k,
|
|
n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];k[4]=-n[4];k[5]=-n[5];k[6]=-n[6];k[7]=n[7];return k},length:ja,len:ja,squaredLength:Fa,sqrLen:Fa,normalize:function(k,n){var w=Fa(n);if(0<w){w=Math.sqrt(w);var B=n[0]/w,D=n[1]/w,F=n[2]/w,H=n[3]/w,K=n[4],M=n[5],P=n[6];n=n[7];var R=B*K+D*M+F*P+H*n;k[0]=B;k[1]=D;k[2]=F;k[3]=H;k[4]=(K-B*R)/w;k[5]=(M-D*R)/w;k[6]=(P-F*R)/w;k[7]=(n-H*R)/w}return k},str:function(k){return"quat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+")"},
|
|
exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]},equals:function(k,n){var w=k[0],B=k[1],D=k[2],F=k[3],H=k[4],K=k[5],M=k[6];k=k[7];var P=n[0],R=n[1],T=n[2],Z=n[3],V=n[4],da=n[5],ca=n[6];n=n[7];return Math.abs(w-P)<=1E-6*Math.max(1,Math.abs(w),Math.abs(P))&&Math.abs(B-R)<=1E-6*Math.max(1,Math.abs(B),Math.abs(R))&&Math.abs(D-T)<=1E-6*Math.max(1,Math.abs(D),Math.abs(T))&&Math.abs(F-Z)<=1E-6*Math.max(1,Math.abs(F),
|
|
Math.abs(Z))&&Math.abs(H-V)<=1E-6*Math.max(1,Math.abs(H),Math.abs(V))&&Math.abs(K-da)<=1E-6*Math.max(1,Math.abs(K),Math.abs(da))&&Math.abs(M-ca)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ca))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))}});Ia=function(){var k=cb();return function(n,w,B,D,F,H){w||(w=2);B||(B=0);for(D=D?Math.min(D*w+B,n.length):n.length;B<D;B+=w)k[0]=n[B],k[1]=n[B+1],F(k,k,H),n[B]=k[0],n[B+1]=k[1];return n}}();Ia=Object.freeze({__proto__:null,create:cb,clone:function(k){var n=
|
|
new na(2);n[0]=k[0];n[1]=k[1];return n},fromValues:function(k,n){var w=new na(2);w[0]=k;w[1]=n;return w},copy:function(k,n){k[0]=n[0];k[1]=n[1];return k},set:function(k,n,w){k[0]=n;k[1]=w;return k},add:function(k,n,w){k[0]=n[0]+w[0];k[1]=n[1]+w[1];return k},subtract:db,multiply:eb,divide:fb,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);return k},min:function(k,n,w){k[0]=Math.min(n[0],w[0]);k[1]=Math.min(n[1],
|
|
w[1]);return k},max:function(k,n,w){k[0]=Math.max(n[0],w[0]);k[1]=Math.max(n[1],w[1]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);return k},scale:function(k,n,w){k[0]=n[0]*w;k[1]=n[1]*w;return k},scaleAndAdd:function(k,n,w,B){k[0]=n[0]+w[0]*B;k[1]=n[1]+w[1]*B;return k},distance:gb,squaredDistance:hb,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 w=n[0],
|
|
B=n[1];w=w*w+B*B;0<w&&(w=1/Math.sqrt(w));k[0]=n[0]*w;k[1]=n[1]*w;return k},dot:function(k,n){return k[0]*n[0]+k[1]*n[1]},cross:function(k,n,w){n=n[0]*w[1]-n[1]*w[0];k[0]=k[1]=0;k[2]=n;return k},lerp:function(k,n,w,B){var D=n[0];n=n[1];k[0]=D+B*(w[0]-D);k[1]=n+B*(w[1]-n);return k},random:function(k,n){n=n||1;var w=2*Ga()*Math.PI;k[0]=Math.cos(w)*n;k[1]=Math.sin(w)*n;return k},transformMat2:function(k,n,w){var B=n[0];n=n[1];k[0]=w[0]*B+w[2]*n;k[1]=w[1]*B+w[3]*n;return k},transformMat2d:function(k,n,
|
|
w){var B=n[0];n=n[1];k[0]=w[0]*B+w[2]*n+w[4];k[1]=w[1]*B+w[3]*n+w[5];return k},transformMat3:function(k,n,w){var B=n[0];n=n[1];k[0]=w[0]*B+w[3]*n+w[6];k[1]=w[1]*B+w[4]*n+w[7];return k},transformMat4:function(k,n,w){var B=n[0];n=n[1];k[0]=w[0]*B+w[4]*n+w[12];k[1]=w[1]*B+w[5]*n+w[13];return k},rotate:function(k,n,w,B){var D=n[0]-w[0];n=n[1]-w[1];var F=Math.sin(B);B=Math.cos(B);k[0]=D*B-n*F+w[0];k[1]=D*F+n*B+w[1];return k},angle:function(k,n){var w=k[0];k=k[1];var B=n[0];n=n[1];var D=Math.sqrt(w*w+k*
|
|
k)*Math.sqrt(B*B+n*n);return Math.acos(Math.min(Math.max(D&&(w*B+k*n)/D,-1),1))},zero:function(k){k[0]=0;k[1]=0;return k},str:function(k){return"vec2("+k[0]+", "+k[1]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]},equals:function(k,n){var w=k[0];k=k[1];var B=n[0];n=n[1];return Math.abs(w-B)<=1E-6*Math.max(1,Math.abs(w),Math.abs(B))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},len:ib,sub:db,mul:eb,div:fb,dist:gb,sqrDist:hb,sqrLen:jb,forEach:Ia});d.glMatrix=lb;d.mat2=mb;
|
|
d.mat2d=nb;d.mat3=ob;d.mat4=pb;d.quat=Na;d.quat2=Oa;d.vec2=Ia;d.vec3=La;d.vec4=Ma;Object.defineProperty(d,"__esModule",{value:!0})});
|
|
{"use strict";function d(G,I,L){var N=[0,0];var S=G[1][1]-G[0][1];var X=G[0][0]-G[1][0];G=S*G[0][0]+X*G[0][1];var U=I[1][1]-I[0][1];var W=I[0][0]-I[1][0];I=U*I[0][0]+W*I[0][1];var ia=S*W-U*X;E(ia,0,L||0)||(N[0]=(W*G-X*I)/ia,N[1]=(S*I-U*G)/ia);return N}function a(G,I,L,N){var S=I[0]-G[0];I=I[1]-G[1];var X=N[0]-L[0],U=N[1]-L[1];if(0===X*I-U*S)return!1;N=(S*(L[1]-G[1])+I*(G[0]-L[0]))/(X*I-U*S);G=(X*(G[1]-L[1])+U*(L[0]-G[0]))/(U*S-X*I);return 0<=N&&1>=N&&0<=G&&1>=G}function b(G,I,L){return(I[0]-G[0])*
|
|
(L[1]-G[1])-(L[0]-G[0])*(I[1]-G[1])}function e(G,I,L){return 0<b(G,I,L)}function c(G,I,L){return 0<=b(G,I,L)}function f(G,I,L){return 0>b(G,I,L)}function g(G,I,L){return 0>=b(G,I,L)}var tmpPoint1$$module$str$c3runtime=[],tmpPoint2$$module$str$c3runtime=[];function h(G,I,L,N){if(N){var S=tmpPoint1$$module$str$c3runtime,X=tmpPoint2$$module$str$c3runtime;S[0]=I[0]-G[0];S[1]=I[1]-G[1];X[0]=L[0]-I[0];X[1]=L[1]-I[1];return Math.acos((S[0]*X[0]+S[1]*X[1])/(Math.sqrt(S[0]*S[0]+S[1]*S[1])*Math.sqrt(X[0]*X[0]+
|
|
X[1]*X[1])))<N}return 0===b(G,I,L)}function l(G,I){var L=I[0]-G[0];G=I[1]-G[1];return L*L+G*G}function m(G,I){var L=G.length;return G[0>I?I%L+L:I%L]}function p(G){G.length=0}function x(G,I,L,N){for(;L<N;L++)G.push(I[L])}function v(G){for(var I=[],L=G.length,N=0;N!==L;N++)I.push(G.pop());for(N=0;N!==L;N++)G[N]=I[N]}function r(G,I){return f(m(G,I-1),m(G,I),m(G,I+1))}var tmpLine1$$module$str$c3runtime=[],tmpLine2$$module$str$c3runtime=[];function q(G,I,L){var N=tmpLine1$$module$str$c3runtime,S=tmpLine2$$module$str$c3runtime;
|
|
if(c(m(G,I+1),m(G,I),m(G,L))&&g(m(G,I-1),m(G,I),m(G,L)))return!1;var X=l(m(G,I),m(G,L));for(var U=0;U!==G.length;++U)if((U+1)%G.length!==I&&U!==I&&c(m(G,I),m(G,L),m(G,U+1))&&g(m(G,I),m(G,L),m(G,U))){N[0]=m(G,I);N[1]=m(G,L);S[0]=m(G,U);S[1]=m(G,U+1);var W=d(N,S);if(l(m(G,I),W)<X)return!1}return!0}function y(G,I,L){for(var N=0;N!==G.length;++N)if(N!==I&&N!==L&&(N+1)%G.length!==I&&(N+1)%G.length!==L&&a(m(G,I),m(G,L),m(G,N),m(G,N+1)))return!1;return!0}function u(G,I,L,N){N=N||[];p(N);if(I<L)for(var S=
|
|
I;S<=L;S++)N.push(G[S]);else{for(S=0;S<=L;S++)N.push(G[S]);for(S=I;S<G.length;S++)N.push(G[S])}return N}function t(G){for(var I=[],L,N,S=[],X=Number.MAX_VALUE,U=0;U<G.length;++U)if(r(G,U))for(var W=0;W<G.length;++W)if(q(G,U,W)){L=t(u(G,U,W,S));N=t(u(G,W,U,S));for(var ia=0;ia<N.length;ia++)L.push(N[ia]);L.length<X&&(I=L,X=L.length,I.push([m(G,U),m(G,W)]))}return I}function A(G,I){if(0===I.length)return[G];if(I instanceof Array&&I.length&&I[0]instanceof Array&&2===I[0].length&&I[0][0]instanceof Array){G=
|
|
[G];for(var L=0;L<I.length;L++)for(var N=I[L],S=0;S<G.length;S++){var X=A(G[S],N);if(X){G.splice(S,1);G.push(X[0],X[1]);break}}return G}N=I;L=G.indexOf(N[0]);S=G.indexOf(N[1]);return-1!==L&&-1!==S?[u(G,L,S),u(G,S,L)]:!1}function z(G,I,L,N,S){var X=I[1]-G[1];I=G[0]-I[0];G=X*G[0]+I*G[1];var U=N[1]-L[1];N=L[0]-N[0];L=U*L[0]+N*L[1];var W=X*N-U*I;return E(W,0,S||0)?[0,0]:[(N*G-I*L)/W,(X*L-U*G)/W]}function C(G,I,L,N,S,X,U){X=X||100;U=U||0;S=S||25;I="undefined"!==typeof I?I:[];L=L||[];N=N||[];var W=[0,0],
|
|
ia=[0,0],ka=[0,0],ya,ta=0,Ba=0,Ea=0,Ca=[],Aa=[];if(3>G.length)return I;U++;if(U>X)return console.warn("quickDecomp: max level ("+X+") reached."),I;for(var ja=0;ja<G.length;++ja)if(r(G,ja)){L.push(G[ja]);var Fa=ya=Number.MAX_VALUE;for(var wa=0;wa<G.length;++wa){if(e(m(G,ja-1),m(G,ja),m(G,wa))&&g(m(G,ja-1),m(G,ja),m(G,wa-1))&&(ka=z(m(G,ja-1),m(G,ja),m(G,wa),m(G,wa-1)),f(m(G,ja+1),m(G,ja),ka))){var Da=l(G[ja],ka);Da<ya&&(ya=Da,ia=ka,Ba=wa)}e(m(G,ja+1),m(G,ja),m(G,wa+1))&&g(m(G,ja+1),m(G,ja),m(G,wa))&&
|
|
(ka=z(m(G,ja+1),m(G,ja),m(G,wa),m(G,wa+1)),e(m(G,ja-1),m(G,ja),ka)&&(Da=l(G[ja],ka),Da<Fa&&(Fa=Da,W=ka,ta=wa)))}if(Ba===(ta+1)%G.length)ka[0]=(ia[0]+W[0])/2,ka[1]=(ia[1]+W[1])/2,N.push(ka),ja<ta?(x(Ca,G,ja,ta+1),Ca.push(ka),Aa.push(ka),0!==Ba&&x(Aa,G,Ba,G.length),x(Aa,G,0,ja+1)):(0!==ja&&x(Ca,G,ja,G.length),x(Ca,G,0,ta+1),Ca.push(ka),Aa.push(ka),x(Aa,G,Ba,ja+1));else{Ba>ta&&(ta+=G.length);W=Number.MAX_VALUE;if(ta<Ba)return I;for(wa=Ba;wa<=ta;++wa)c(m(G,ja-1),m(G,ja),m(G,wa))&&g(m(G,ja+1),m(G,ja),
|
|
m(G,wa))&&(Da=l(m(G,ja),m(G,wa)),Da<W&&y(G,ja,wa)&&(W=Da,Ea=wa%G.length));ja<Ea?(x(Ca,G,ja,Ea+1),0!==Ea&&x(Aa,G,Ea,G.length),x(Aa,G,0,ja+1)):(0!==ja&&x(Ca,G,ja,G.length),x(Ca,G,0,Ea+1),x(Aa,G,Ea,ja+1))}Ca.length<Aa.length?(C(Ca,I,L,N,S,X,U),C(Aa,I,L,N,S,X,U)):(C(Aa,I,L,N,S,X,U),C(Ca,I,L,N,S,X,U));return I}I.push(G);return I}function E(G,I,L){return Math.abs(G-I)<=(L||0)}function J(G,I,L){return E(G[0],I[0],L)&&E(G[1],I[1],L)}self.polyDecomp={decomp:function(G){var I=t(G);return 0<I.length?A(G,I):
|
|
[G]},quickDecomp:C,isSimple:function(G){var I;for(I=0;I<G.length-1;I++)for(var L=0;L<I-1;L++)if(a(G[I],G[I+1],G[L],G[L+1]))return!1;for(I=1;I<G.length-2;I++)if(a(G[0],G[G.length-1],G[I],G[I+1]))return!1;return!0},removeCollinearPoints:function(G,I){for(var L=0,N=G.length-1;3<G.length&&0<=N;--N)h(m(G,N-1),m(G,N),m(G,N+1),I)&&(G.splice(N%G.length,1),L++);return L},removeDuplicatePoints:function(G,I){for(var L=G.length-1;1<=L;--L)for(var N=G[L],S=L-1;0<=S;--S)J(N,G[S],I)&&G.splice(L,1)},makeCCW:function(G){for(var I=
|
|
0,L=1;L<G.length;++L)if(G[L][1]<G[I][1]||G[L][1]===G[I][1]&&G[L][0]>G[I][0])I=L;if(e(m(G,I-1),m(G,I),m(G,I+1)))return!1;v(G);return!0}}}
|
|
{"use strict";let d=!1,a=!1,b="dev";const e=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){d=!0}static IsReady(){return d}static SetAppStarted(){a=!0}static HasAppStarted(){return a}static SetBuildMode(c){b=c}static GetBuildMode(){return b}static IsReleaseBuild(){return"final"===b}};e.isDebug=!1;e.isDebugDefend=!1;e.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}}
|
|
{"use strict";const d=self.C3;d.QueryParser=class{constructor(a){this._queryString=a;this._parameters=new Map;this._Parse()}_Parse(){var a=this._queryString;if(a.startsWith("?")||a.startsWith("#"))a=a.substr(1);a=a.split("&");for(const b of a)this._ParseParameter(b)}_ParseParameter(a){if(a)if(a.includes("=")){var b=a.indexOf("="),e=decodeURIComponent(a.substring(0,b));a=decodeURIComponent(a.substring(b+1));this._parameters.set(e,a)}else this._parameters.set(a,null)}LogAll(){for(const a of this._parameters)console.log("[QueryParser] Parameter '"+
|
|
a[0]+"' = "+(null===a[1]?"null":"'"+a[1]+"'"))}Has(a){return this._parameters.has(a)}Get(a){a=this._parameters.get(a);return"undefined"===typeof a?null:a}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(a){this._queryString=a;this._parameters.clear();this._Parse()}};d.QueryString=new d.QueryParser(location.search);d.LocationHashString=new d.QueryParser(location.hash);"dev"!==d.QueryString.Get("mode")&&d.SetBuildMode("final")}
|
|
{"use strict";const d=self.C3,a=navigator.userAgent;let b={linux:/linux|openbsd|freebsd|netbsd/i.test(a),chromeOS:/CrOS/.test(a),windowsTizen:/trident|iemobile|msie|tizen/i.test(a),genericMS:/trident|iemobile|msie|edge\//i.test(a),opera:/OPR\//.test(a),blackberry:/bb10/i.test(a),edge:/edge\//i.test(a),trident:/trident/i.test(a),webkit:/webkit/i.test(a),safari:/safari\//i.test(a),chrome:/chrome\//i.test(a),chromium:/chromium\//i.test(a),crosswalk:/crosswalk|xwalk/i.test(a),nwjs:/nwjs/i.test(a),amazonwebapp:/amazonwebappplatform/i.test(a),
|
|
webview:/wv\)/.test(a),android:/android/i.test(a),nokia:/nokiabrowser\/[0-9.]+/i.test(a)};var JSCompiler_object_inline_windows_0=/windows\s+nt\s+\d+\.\d+/i.exec(a),JSCompiler_object_inline_OSX_1=/mac\s+os\s+x\s+[0-9_]+/i.exec(a),JSCompiler_object_inline_android_2=/android\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_opera_3=/OPR\/[0-9.]+/.exec(a),JSCompiler_object_inline_tizen_4=/tizen\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_iphone_5=/iphone\s+os\s+[0-9_]+/i.exec(a),JSCompiler_object_inline_ipad_6=
|
|
/ipad[^)]*os\s+[0-9_]+/i.exec(a),JSCompiler_object_inline_winPhone_7=/windows\s+phone\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_winPhoneOS_8=/windows\s+phone\s+os\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_chrome_9=/chrome\/[0-9.]+/i.exec(a),JSCompiler_object_inline_chromium_10=/chromium\/[0-9.]+/i.exec(a),JSCompiler_object_inline_nwjs_11=/nwjs\/[0-9.]+/i.exec(a),JSCompiler_object_inline_firefox_12=/firefox\/[0-9.]+/i.exec(a),JSCompiler_object_inline_ie_13=/msie\s+[0-9.]+/i.exec(a),JSCompiler_object_inline_edge_14=
|
|
/edge\/[0-9.]+/i.exec(a),JSCompiler_object_inline_edgeChromium_15=/edg\/[0-9.]+/i.exec(a),JSCompiler_object_inline_silk_16=/silk\/[0-9.]+/i.exec(a);let e="(unknown)",c="(unknown)",f="(unknown)",g="(unknown)",h="(unknown)",l="browser",m=!1,p=!1,x=new Map;function v(q,y,u){!0===y?(u(),x.set(q,!0)):y&&y.length&&(u(y[0]),x.set(q,!0))}v("isWindows",JSCompiler_object_inline_windows_0,q=>{e="Windows";if(q=q.split(" ")[2])switch(q){case "5.0":c="2000";break;case "5.1":c="XP";break;case "5.2":c="XP";break;
|
|
case "6.0":c="Vista";break;case "6.1":c="7";break;case "6.2":c="8";break;case "6.3":c="8.1";break;case "10.0":c="10"}});v("isOSX",JSCompiler_object_inline_OSX_1,q=>{e="Mac OS X";(q=q.split(" ")[3])&&(c=q.replace("_","."))});v("isLinux",b.linux,()=>{e="Linux"});v("isChromeOS",b.chromeOS,()=>{e="Chrome OS"});v("isAndroid",!b.windowsTizen&&JSCompiler_object_inline_android_2,q=>{e="Android";(q=q.split(" ")[1])&&(c=q)});v("isTizen",JSCompiler_object_inline_tizen_4,q=>{e="Tizen";(q=q.split(" ")[1])&&(c=
|
|
q)});v("isIPhone",!b.windowsTizen&&JSCompiler_object_inline_iphone_5,q=>{e="iOS";(q=q.split(" ")[2])&&(c=q.replace("_","."))});v("isIPad",!b.windowsTizen&&JSCompiler_object_inline_ipad_6,q=>{e="iOS";(q=q.split(" ")[3])&&(c=q.replace("_","."))});v("isWindowsPhone",JSCompiler_object_inline_winPhone_7,q=>{e="Windows Phone";(q=q.split(" ")[2])&&(c=q)});v("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_8,q=>{e="Windows Phone";(q=q.split(" ")[3])&&(c=q)});v("isBlackberry",b.blackberry,()=>{e="Blackberry";
|
|
c="10";f="stock";h="webkit"});v("isChrome",!b.edge&&!b.opera&&JSCompiler_object_inline_chrome_9,q=>{f="Chrome";h="Chromium";(q=q.split("/")[1])&&(g=q)});v("isOpera",JSCompiler_object_inline_opera_3,q=>{f="Opera";h="Chromium";(q=q.split("/")[1])&&(g=q)});v("isChromium",JSCompiler_object_inline_chromium_10,q=>{h=f="Chromium";(q=q.split("/")[1])&&(g=q)});v("isFirefox",JSCompiler_object_inline_firefox_12,q=>{f="Firefox";h="Gecko";(q=q.split("/")[1])&&(g=q)});v("isInternetExplorer",JSCompiler_object_inline_ie_13,
|
|
q=>{f="Internet Explorer";h="Trident";(q=q.split(" ")[1])&&(g=q)});v("isTrident","Internet Explorer"!==f&&b.trident,()=>{h="Trident";var q=/rv:[0-9.]+/i.exec(a);q&&q.length&&(f="Internet Explorer",(q=q[0].split(":")[1])&&(g=q))});v("isEdge",JSCompiler_object_inline_edge_14,q=>{h=f="Edge";(q=q.split("/")[1])&&(g=q)});v("isEdgeChromium",JSCompiler_object_inline_edgeChromium_15,q=>{f="Edge";h="Chromium";(q=q.split("/")[1])&&(g=q)});v("isSafari",b.safari&&!b.nokia&&!b.chrome&&!b.chromium&&!b.genericIE&&
|
|
!b.blackberry,()=>{f="Safari";h="WebKit";var q=/version\/[0-9.]+/i.exec(a),y=/crios\/[0-9.]+/i.exec(a),u=/fxios\/[0-9.]+/i.exec(a);q&&q.length&&(q=q[0].split("/")[1])&&(g=q);y&&y.length&&(f="Chrome for iOS",(y=y[0].split("/")[1])&&(g=y));u&&u.length&&(f="Firefox for iOS",(u=u[0].split("/")[1])&&(g=u))});v("isSilk",JSCompiler_object_inline_silk_16,q=>{f="Silk";(q=q.split("/")[1])&&(g=q)});v("isCrosswalk",b.crosswalk,()=>l="crosswalk");v("isCordova",self.device&&(self.device.cordova||self.device.phonegap),
|
|
()=>l="cordova");v("isNWJS",JSCompiler_object_inline_nwjs_11,q=>{l="nwjs";f="NW.js";h="Chromium";(q=q.split("/")[1])&&(g=q)});v("isAmazonWebApp",b.amazonwebapp,()=>l="webapp");v("isHomeScreenWebApp","nwjs"!==l&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>l="webapp");v("isFalseSafari","Safari"===f&&("Android"===e||"Tizen"===e||"Blackberry"===e),()=>f="stock");v("isAndroidWebview","Chrome"===f&&"browser"===l&&b.webview,
|
|
()=>l="webview");v("isFirefoxOS","Firefox"===f&&"(unknown)"===e,()=>e="Firefox OS");v("isAndroidFallback","(unknown)"===e&&!b.windowsTizen&&b.android,()=>e="Android");v("isTridentFallback","(unknown)"===e&&b.trident,()=>h="Trident");v("isWebkitFallback","(unknown)"===e&&b.webkit,()=>h="WebKit");v("isDesktop",(()=>"Windows"===e||"Mac OS X"===e||"Linux"===e||"Chrome OS"===e||"nwjs"===l)(),()=>m=!0);p="nwjs"===l;const r="Mac OS X"===e&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;r&&(e="iOS",
|
|
c=g,p=m=!1);d.Platform={OS:e,OSVersion:c,Browser:f,BrowserVersion:g,BrowserVersionNumber:parseFloat(g),BrowserEngine:h,Context:l,IsDesktop:m,IsMobile:!m,IsDesktopApp:p,IsChromeWebStore:!!(self.chrome&&self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===e||"iOS"===e,IsIpadOS:r,IsLinux:"Linux"===e}}"use strict";
|
|
{const d=new Map,a="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAll,b="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAllKeys;function e(r){return new Promise((q,y)=>{r.onsuccess=()=>q(r.result);r.onerror=()=>y(r.error)})}function c(r){return new Promise((q,y)=>{r.oncomplete=()=>q();r.onerror=()=>y(r.error);r.onabort=()=>y(r.error)})}function f(r,q){return h(r,q)}function g(r,q){return h(r,q,!0)}async function h(r,q,y=!1,
|
|
u=!0){const t=await l(r);try{const A=t.transaction(["keyvaluepairs"],y?"readwrite":"readonly");return q(A)}catch(A){if(u&&"InvalidStateError"===A.name)return d.delete(r),h(r,q,y,!1);throw A;}}function l(r){p(r);let q=d.get(r);q instanceof Promise||(q=m(r),d.set(r,q),q.catch(y=>d.delete(r)));return q}async function m(r){p(r);const q=indexedDB.open(r,2);q.addEventListener("upgradeneeded",y=>{try{y.target.result.createObjectStore("keyvaluepairs")}catch(u){console.error(`Failed to create objectstore for database ${r}`,
|
|
u)}});return e(q)}function p(r){if("string"!==typeof r)throw new TypeError("expected string");}function x(r,q){const y=r.objectStore("keyvaluepairs").openCursor();return new Promise(u=>{const t=[];y.onsuccess=A=>{if(A=A.target.result){switch(q){case "entries":t.push([A.key,A.value]);break;case "keys":t.push(A.key);break;case "values":t.push(A.value)}A.continue()}else u(t)}})}class v{constructor(r){p(r);this.name=r}async ready(){await l(this.name)}set(r,q){p(r);return g(this.name,async y=>{var u=y.objectStore("keyvaluepairs").put(q,
|
|
r);u=e(u);y=c(y);await Promise.all([y,u])})}get(r){p(r);return f(this.name,async q=>{var y=q.objectStore("keyvaluepairs").get(r);y=e(y);q=c(q);[,q]=await Promise.all([q,y]);return q})}delete(r){p(r);return g(this.name,async q=>{var y=q.objectStore("keyvaluepairs").delete(r);y=e(y);q=c(q);await Promise.all([q,y])})}clear(){return g(this.name,async r=>{var q=r.objectStore("keyvaluepairs").clear();q=e(q);r=c(r);await Promise.all([r,q])})}keys(){return f(this.name,async r=>{if(b){var q=r.objectStore("keyvaluepairs").getAllKeys();
|
|
q=e(q)}else q=x(r,"keys");r=c(r);[,r]=await Promise.all([r,q]);return r})}values(){return f(this.name,async r=>{if(a){var q=r.objectStore("keyvaluepairs").getAll();q=e(q)}else q=x(r,"values");r=c(r);[,r]=await Promise.all([r,q]);return r})}entries(){return f(this.name,async r=>{var q=x(r,"entries");r=c(r);[,q]=await Promise.all([r,q]);return q})}}self.KVStorageContainer=v}"use strict";
|
|
{const d=self.KVStorageContainer,a=[/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],b=new WeakMap;let e=!1;"undefined"===typeof indexedDB&&(e=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function c(l){throw Error(`"${l}" is not implemented`);
|
|
}function f(l){if("function"===typeof l)throw Error("localforage callback API is not implemented; please use the promise API instead");}function g(l){return"object"===typeof l?new Promise(m=>{const {port1:p,port2:x}=new MessageChannel;x.onmessage=v=>m(v.data);p.postMessage(l)}):Promise.resolve(l)}class h{constructor(l){this._inst=l;b.set(this,new Map)}_MaybeSwitchToMemoryFallback(l){if(!e)for(const m of a)if(l&&m.test(l.message)){console.error("Unable to use local storage, reverting to in-memory store: ",
|
|
l,l.message);e=!0;break}}async _getItemFallback(l){l=b.get(this).get(l);l=await g(l);return"undefined"===typeof l?null:l}async _setItemFallback(l,m){m=await g(m);b.get(this).set(l,m)}_removeItemFallback(l){b.get(this).delete(l)}_clearFallback(){b.get(this).clear()}_keysFallback(){return Array.from(b.get(this).keys())}IsUsingFallback(){return e}async getItem(l,m){f(m);if(e)return await this._getItemFallback(l);let p;try{p=await this._inst.get(l)}catch(x){this._MaybeSwitchToMemoryFallback(x);if(e)return await this._getItemFallback(l);
|
|
console.error(`Error reading '${l}' from storage, returning null: `,x);return null}return"undefined"===typeof p?null:p}async setItem(l,m,p){f(p);"undefined"===typeof m&&(m=null);if(e)await this._setItemFallback(l,m);else try{await this._inst.set(l,m)}catch(x){if(this._MaybeSwitchToMemoryFallback(x),e)await this._setItemFallback(l,m);else throw x;}}async removeItem(l,m){f(m);if(e)this._removeItemFallback(l);else try{await this._inst.delete(l)}catch(p){this._MaybeSwitchToMemoryFallback(p),e?this._removeItemFallback(l):
|
|
console.error(`Error removing '${l}' from storage: `,p)}}async clear(l){f(l);if(e)this._clearFallback();else try{await this._inst.clear()}catch(m){this._MaybeSwitchToMemoryFallback(m),e?this._clearFallback():console.error("Error clearing storage: ",m)}}async keys(l){f(l);if(e)return this._keysFallback();l=[];try{l=await this._inst.keys()}catch(m){this._MaybeSwitchToMemoryFallback(m);if(e)return this._keysFallback();console.error("Error getting storage keys: ",m)}return l}ready(l){f(l);return e?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 d(l);return new h(l)}length(l){c("localforage.length()")}key(l,m){c("localforage.key()")}iterate(l,m){c("localforage.iterate()")}setDriver(l){c("localforage.setDriver()")}config(l){c("localforage.config()")}defineDriver(l){c("localforage.defineDriver()")}driver(){c("localforage.driver()")}supports(l){c("localforage.supports()")}dropInstance(){c("localforage.dropInstance()")}disableMemoryMode(){e=
|
|
!1}}self.localforage=new h(new d("localforage"))}
|
|
{"use strict";const d=self.C3;d.Supports={};d.Supports.WebAnimations=(()=>{try{if("Safari"===d.Platform.Browser||"undefined"===typeof document)return!1;const a=document.createElement("div");return"undefined"===typeof a.animate?!1:"undefined"!==typeof a.animate([{opacity:"0"},{opacity:"1"}],1E3).reverse}catch(a){return!1}})();d.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;d.Supports.RequestIdleCallback=!!self.requestIdleCallback;d.Supports.ImageBitmap=!!self.createImageBitmap;d.Supports.ImageBitmapOptions=
|
|
!1;if(d.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{premultiplyAlpha:"none"}).then(a=>{d.Supports.ImageBitmapOptions=!0}).catch(a=>{d.Supports.ImageBitmapOptions=!1})}catch(a){d.Supports.ImageBitmapOptions=!1}d.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===d.Platform.Browser);d.Supports.PermissionsQuery=!(!navigator.permissions||!navigator.permissions.query);d.Supports.Proxies="undefined"!==typeof Proxy;d.Supports.DownloadAttribute=
|
|
(()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();d.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();d.Supports.Fetch="function"===typeof fetch;d.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==d.Platform.Browser&&navigator.storage&&navigator.storage.persist);d.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);d.Supports.Fullscreen=
|
|
(()=>{if("undefined"===typeof document||"iOS"===d.Platform.OS)return!1;const a=document.documentElement;return!!(a.requestFullscreen||a.msRequestFullscreen||a.mozRequestFullScreen||a.webkitRequestFullscreen)})();d.Supports.ImageDecoder="undefined"!==typeof self.ImageDecoder;d.Supports.NativeFileSystemAPI=!!self.showOpenFilePicker;d.Supports.NavigatorFontsQuery=!(!navigator.fonts||!navigator.fonts.query)}
|
|
{"use strict";const d=self.C3;if(!String.prototype.trimStart){const a=/^[\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(a,"")}}if(!String.prototype.trimEnd){const a=/[\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(a,
|
|
"")}}String.prototype.replaceAll||(String.prototype.replaceAll=function(a,b){return this.replace(new RegExp(d.EscapeRegex(a),"g"),b)});Array.prototype.values||(Array.prototype.values=function*(){for(const a of this)yield a});if(!Array.prototype.flat){function a(b,e){return b.reduce((c,f)=>{0<e&&Array.isArray(f)?Array.prototype.push.apply(c,a(f,e-1)):c.push(f);return c},[])}Array.prototype.flat=function(b=1){return a(this,b)}}RegExp.escape||(RegExp.escape=function(a){return String(a).replace(/[\\^$*+?.()|[\]{}]/g,
|
|
"\\$&")});navigator.storage&&!navigator.storage.estimate&&navigator.webkitTemporaryStorage&&navigator.webkitTemporaryStorage.queryUsageAndQuota&&(navigator.storage.estimate=function(){return new Promise((a,b)=>navigator.webkitTemporaryStorage.queryUsageAndQuota((e,c)=>a({usage:e,quota:c}),b))});"undefined"===typeof HTMLCollection||HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=function(){let a=0;return{next:()=>a>=this.length?{done:!0}:{value:this.item(a++),
|
|
done:!1}}});"undefined"===typeof NodeList||NodeList.prototype[Symbol.iterator]||(NodeList.prototype[Symbol.iterator]=function(){let a=0;return{next:()=>a>=this.length?{done:!0}:{value:this.item(a++),done:!1}}});"undefined"===typeof DOMTokenList||DOMTokenList.prototype[Symbol.iterator]||(DOMTokenList.prototype[Symbol.iterator]=function(){let a=0;return{next:()=>a>=this.length?{done:!0}:{value:this.item(a++),done:!1}}});"undefined"===typeof FileList||FileList.prototype[Symbol.iterator]||(FileList.prototype[Symbol.iterator]=
|
|
function(){let a=0;return{next:()=>a>=this.length?{done:!0}:{value:this.item(a++),done:!1}}});"undefined"===typeof TextEncoder&&(self.TextEncoder=class{constructor(){Object.defineProperty(this,"encoding",{value:"utf-8",writable:!1})}encode(a){for(var b=a.length,e=-1,c=new Uint8Array(3*b),f,g,h=0;h!==b;){f=a.charCodeAt(h);h+=1;if(55296<=f&&56319>=f){if(h===b){c[e+=1]=239;c[e+=1]=191;c[e+=1]=189;break}g=a.charCodeAt(h);if(56320<=g&&57343>=g){if(f=1024*(f-55296)+g-56320+65536,h+=1,65535<f){c[e+=1]=240|
|
|
f>>>18;c[e+=1]=128|f>>>12&63;c[e+=1]=128|f>>>6&63;c[e+=1]=128|f&63;continue}}else{c[e+=1]=239;c[e+=1]=191;c[e+=1]=189;continue}}127>=f?c[e+=1]=0|f:(2047>=f?c[e+=1]=192|f>>>6:(c[e+=1]=224|f>>>12,c[e+=1]=128|f>>>6&63),c[e+=1]=128|f&63)}return new Uint8Array(c.buffer.slice(0,e+1))}toString(){return"[object TextEncoder]"}},TextEncoder[Symbol.toStringTag]="TextEncoder");if("undefined"===typeof TextDecoder){function a(c){const f=c[Symbol.iterator]();return{next:g=>f.next(),[Symbol.iterator](){return this}}}
|
|
function b(c){c=c.next();if(c.done)throw Error("unexpected end of input");if(0!=(c.value&192^128))throw Error("invalid byte");return c.value&63}const e=new Map;e.set("utf-8",(c,f)=>{if(c.buffer)var g=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);else if(g instanceof ArrayBuffer)g=new Uint8Array(c);else throw Error("Invalid parameter");c=a(g);g=[];try{for(const h of c){let l;if(127>h)l=h&127;else if(223>h)l=(h&31)<<6|b(c);else if(239>h)l=(h&15)<<12|b(c)<<6|b(c);else if(247>h)l=(h&7)<<18|b(c)<<
|
|
12|b(c)<<6|b(c);else throw Error("Invalid character");g.push(String.fromCodePoint(l))}}catch(h){if(f)throw h;g.push("\ufffd")}return g.join("")});e.set("utf8",e.get("utf-8"));e.set("utf-16le",(c,f)=>{throw Error("utf-16le decoder not implemented");});self.TextDecoder=class{constructor(c="utf-8",f={}){const g=e.get(c);if(!g)throw Error(`TextDecoder polyfill does not support "${c}"`);Object.defineProperty(this,"fatal",{value:!0===f.fatal,writable:!1});Object.defineProperty(this,"_decoder",{value:g,
|
|
writable:!1});Object.defineProperty(this,"encoding",{value:c,writable:!1})}decode(c){return this._decoder(c,this.fatal)}toString(){return"[object TextDecoder]"}};TextDecoder[Symbol.toStringTag]="TextDecoder"}"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}
|
|
{"use strict";const d=self.C3;function a(b){let e=d.GetCallStack();console.error("Assertion failure: "+b+"\n\nStack trace:\n"+e)}self.assert=function(b,e){b||a(e)}}
|
|
{"use strict";const d=self.C3,a=self.C3X;d.IsNumber=function(e){return"number"===typeof e};d.IsFiniteNumber=function(e){return d.IsNumber(e)&&isFinite(e)};d.RequireNumber=function(e){if(!d.IsNumber(e))throw new TypeError("expected number");};d.RequireOptionalNumber=function(e){d.IsNullOrUndefined(e)};d.RequireNumberInRange=function(e,c,f){if(!d.IsNumber(e)||isNaN(e)||c>e||f<e)throw new RangeError("number outside of range");};d.RequireAllNumber=function(...e){for(let c of e);};d.RequireFiniteNumber=
|
|
function(e){if(!d.IsFiniteNumber(e))throw new TypeError("expected finite number");};d.RequireOptionalFiniteNumber=function(e){d.IsNullOrUndefined(e)};d.RequireAllFiniteNumber=function(...e){for(let c of e);};d.IsString=function(e){return"string"===typeof e};d.RequireString=function(e){if(!d.IsString(e))throw new TypeError("expected string");};d.RequireOptionalString=function(e){d.IsNullOrUndefined(e)};d.RequireAllString=function(...e){for(let c of e);};d.IsSimpleObject=function(e){return"object"!==
|
|
typeof e||null===e?!1:(e=Object.getPrototypeOf(e))?e.constructor===Object:null===e};d.RequireSimpleObject=function(e){if(!d.IsSimpleObject(e))throw new TypeError("expected simple object");};d.RequireOptionalSimpleObject=function(e){if(!d.IsNullOrUndefined(e)&&!d.IsSimpleObject(e))throw new TypeError("expected simple object");};d.IsObject=function(e){return"object"===typeof e&&null!==e&&!Array.isArray(e)};d.RequireObject=function(e){if(!d.IsObject(e))throw new TypeError("expected object");};d.RequireOptionalObject=
|
|
function(e){d.IsNullOrUndefined(e)};d.RequireAllObject=function(...e){for(let c of e);};d.IsFileLike=function(e){return d.IsInstanceOf(e,Blob)&&"string"===typeof e.name};d.RequireFileLike=function(e){if(!d.IsFileLike(e))throw new TypeError("expected file");};d.RequireOptionalFileLike=function(e){d.IsNullOrUndefined(e)};d.IsArray=function(e){return Array.isArray(e)};d.RequireArray=function(e){if(!d.IsArray(e))throw new TypeError("expected array");};d.RequireOptionalArray=function(e){d.IsNullOrUndefined(e)};
|
|
d.RequireAllArray=function(...e){for(let c of e);};d.Is2DArray=function(e){return d.IsArray(e)?e.length?d.IsArray(e[0])?!0:!1:!0:!1};d.Require2DArray=function(e){if(!d.Is2DArray(e))throw new TypeError("expected 2d array");for(let c of e)if(!d.IsArray(c))throw new TypeError("expected 2d array");};d.RequireOptional2DArray=function(e){d.IsNullOrUndefined(e)};d.IsFunction=function(e){return"function"===typeof e};d.RequireFunction=function(e,c){if(!d.IsFunction(e))throw new TypeError("expected function");
|
|
if(!d.IsNullOrUndefined(c)&&e!==c)throw new TypeError("expected same function reference");};d.RequireOptionalFunction=function(e){d.IsNullOrUndefined(e)};d.RequireAllFunction=function(...e){for(let c of e);};d.RequireAnyFunction=function(e,...c){if(!d.IsFunction(e))throw new TypeError("expected function");if(!c.length)throw Error("missing comparison functions");for(let f of c)if(!d.IsNullOrUndefined(f)&&e===f)return;throw new TypeError("expected same function reference");};d.RequireOptionalAllFunction=
|
|
function(...e){if(!d.IsNullOrUndefined(e))for(let c of e);};d.IsInstanceOf=function(e,c){return e instanceof c};d.IsInstanceOfAny=function(e,...c){for(let f of c)if(d.IsInstanceOf(e,f))return!0;return!1};d.RequireInstanceOf=function(e,c){if(!d.IsInstanceOf(e,c))throw new TypeError("unexpected type");};d.RequireOptionalInstanceOf=function(e,c){d.IsNullOrUndefined(e)};d.RequireAllInstanceOf=function(e,...c){for(let f of c);};d.RequireAnyInstanceOf=function(e,...c){if(!d.IsInstanceOfAny(e,...c))throw new TypeError("unexpected type");
|
|
};d.RequireAnyOptionalInstanceOf=function(e,...c){if(!d.IsNullOrUndefined(e)&&!d.IsInstanceOfAny(e,...c))throw new TypeError("unexpected type");};d.IsArrayOf=function(e,c){for(let f of e)if(!d.IsInstanceOf(f,c))return!1;return!0};d.IsArrayOfFiniteNumbers=function(e){for(let c of e)if(!d.IsFiniteNumber(c))return!1;return!0};d.RequireArrayOf=function(e,c){for(let f of e);};d.RequireOptionalArrayOf=function(e,c){if(!d.IsNullOrUndefined(e))for(let f of e);};d.RequireArrayOfAny=function(e,...c){for(let f of e);
|
|
};d.RequireOptionalArrayOfAny=function(e,...c){if(!d.IsNullOrUndefined(e))for(let f of e);};d.IsDOMNode=function(e,c){return d.IsNullOrUndefined(e)||!d.IsString(e.nodeName)?!1:!c||d.equalsNoCase(e.nodeName,c)};d.RequireDOMNode=function(e,c){if(d.IsNullOrUndefined(e)||!d.IsString(e.nodeName))throw new TypeError("expected DOM node");if(c&&!d.equalsNoCase(e.nodeName,c))throw new TypeError(`expected DOM '${c}' node`);};d.RequireOptionalDOMNode=function(e,c){d.IsNullOrUndefined(e)};d.IsHTMLElement=function(e,
|
|
c){return d.IsNullOrUndefined(e)||!d.IsString(e.tagName)?!1:!c||d.equalsNoCase(e.tagName,c)};d.RequireHTMLElement=function(e,c){if(d.IsNullOrUndefined(e)||!d.IsString(e.tagName))throw new TypeError("expected HTML element");if(c&&!d.equalsNoCase(e.tagName,c))throw new TypeError(`expected HTML '${c}' element`);};d.RequireOptionalHTMLElement=function(e,c){d.IsNullOrUndefined(e)};d.IsDrawable=function(e){return d.IsHTMLElement(e,"img")||d.IsHTMLElement(e,"canvas")||d.IsHTMLElement(e,"video")||"undefined"!==
|
|
typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&e instanceof ImageBitmap};d.RequireDrawable=function(e){if(!d.IsDrawable(e))throw new TypeError("expected drawable");};d.RequireOptionalDrawable=function(e){d.IsNullOrUndefined(e)};d.IsDrawableOrImageData=function(e){return e instanceof ImageData?!0:d.IsDrawable(e)};d.RequireDrawableOrImageData=function(e){if(!d.IsDrawableOrImageData(e))throw new TypeError("expected drawable or image data");};d.RequireOptionalDrawableOrImageData=
|
|
function(e){if(!d.IsNullOrUndefined(e)&&!d.IsDrawableOrImageData(e))throw new TypeError("expected drawable or image data");};d.IsStringLike=function(e){return"string"===typeof e||e instanceof d.HtmlString||e instanceof d.BBString};d.RequireStringLike=function(e){if(!d.IsStringLike(e))throw new TypeError("expected string-like");};d.RequireOptionalStringLike=function(e){d.IsNullOrUndefined(e)};d.RequireAllStringLike=function(...e){for(let c of e);};d.RequireOverride=function(){throw Error("must be overridden");
|
|
};d.NotYetImplemented=function(){throw Error("not yet implemented");};d.IsDefined=function(e,...c){if("undefined"===typeof e)return!1;for(let f of c){if("undefined"===typeof e[f])return!1;e=e[f]}return!0};d.IsNullOrUndefined=function(e){return"undefined"===typeof e||null===e};d.AreArrayElementsOfSameType=function(e){let c=e[0].constructor;for(let f of e)if(f.constructor!==c)return!1;return c};d.AreArrayElementsOfType=function(e,c){for(let f of e)if(!(f instanceof c))return!1;return!0};const b=Object.getPrototypeOf(Uint8Array);
|
|
d.IsTypedArray=function(e){return d.IsInstanceOf(e,b)};d.RequireTypedArray=function(e){};d.WeakRequireTypedArray=function(e){d.WeakRequireInstanceOf(e,b)};d.WeakRequireAnyInstanceOf=function(e,...c){if(!d.WeakIsAnyInstanceOf(e,...c))throw new TypeError("unexpected type");};d.WeakIsAnyInstanceOf=function(e,...c){for(const f of c)if(d.WeakIsInstanceOf(e,f))return!0;return!1};d.WeakRequireInstanceOf=function(e,c){if(!d.WeakIsInstanceOf(e,c))throw new TypeError("unexpected type");};d.WeakIsInstanceOf=
|
|
function(e,c){for(;e=Object.getPrototypeOf(e);)if(e.constructor.name===c.name)return!0;return!1};a.RequireNumber=d.RequireNumber;a.RequireOptionalNumber=d.RequireOptionalNumber;a.RequireFiniteNumber=d.RequireFiniteNumber;a.RequireOptionalFiniteNumber=d.RequireOptionalFiniteNumber;a.RequireString=d.RequireString;a.RequireOptionalString=d.RequireOptionalString;a.RequireObject=d.RequireObject;a.RequireOptionalObject=d.RequireOptionalObject;a.RequireArray=d.RequireArray;a.RequireOptionalArray=d.RequireOptionalArray;
|
|
a.RequireFunction=d.RequireFunction;a.RequireOptionalFunction=d.RequireOptionalFunction;a.RequireInstanceOf=d.RequireInstanceOf;a.RequireOptionalInstanceOf=d.RequireOptionalInstanceOf;a.IsNullOrUndefined=d.IsNullOrUndefined}
|
|
{"use strict";const d=self.C3,a=new Map;d.RafLog=function(q,...y){a.has(q)||a.set(q,-1);-1===a.get(q)&&a.set(q,requestAnimationFrame(()=>{console.log(`%c${q}`,"font-weight: bold",...y);a.set(q,-1)}))};d.GetCallStack=function(){return Error().stack};d.Debugger=function(){debugger};d.cast=function(q,y){return q&&q instanceof y?q:null};d.getName=function(q){return"undefined"===typeof q?"undefined":null===q?"null":"boolean"===typeof q?"<boolean>":d.IsNumber(q)?"<number>":d.IsString(q)?"<string>":d.IsArray(q)?
|
|
"<array>":"symbol"===typeof q?"<"+q.toString()+">":d.IsFunction(q)?q.name&&"Function"!==q.name?q.name:"<anonymous function>":"object"===typeof q?q.constructor&&q.constructor.name&&"Object"!==q.constructor.name?q.constructor.name:"<anonymous object>":"<unknown>"};d.getType=function(q){return null===q?"null":Array.isArray(q)?"array":typeof q};d.range=function*(q,y){if(!isFinite(Math.abs(q-y)))throw Error("Invalid parameters");if(q>y)for(--q;q>=y;q--)yield q;else for(;q<y;q++)yield q};function b(q,y){q=
|
|
d.getType(q);y=d.getType(y);return"null"===q||"null"===y?!0:"undefined"===q||"undefined"===y?!1:q===y}let e=new Map,c=new Map,f=new WeakMap,g=new WeakMap;d.DefendHandler={};const h=new Set(["then","splice"]);function l(q){console.warn("[Defence] "+q+" @",d.GetCallStack())}d.DefendHandler.get=function(q,y){y in q||"symbol"===typeof y||h.has(y)||l(`Accessed missing property '${y}' from defended object '${d.getName(q)}', returning undefined`);g.has(q)&&"symbol"!==typeof y&&!h.has(y)&&l(`Accessed property '${y}' on a released object '${d.getName(q)}'\nObject was originally released at: ${g.get(q)})\nCall stack at access: `);
|
|
return q[y]};d.DefendHandler.set=function(q,y,u){y in q||e.has(q)||l(`Set non-existent property '${y}' to '${u}' on defended object '${d.getName(q)}'`);b(q[y],u)||e.has(q)||l(`Set '${d.getType(q[y])}' property '${y}' to type '${d.getType(u)}' on defended object '${d.getName(q)}'`);g.has(q)&&l(`Set property '${y}' on a released object '${d.getName(q)}'\nObject was originally released at: ${g.get(q)})\nCall stack at access: `);q[y]=u;return!0};d.DefendHandler.deleteProperty=function(q,y){throw new ReferenceError(`Cannot delete property '${y}' from defended object '${d.getName(q)}'`);
|
|
};d.DefendHandler.defineProperty=function(q,y,u){throw new ReferenceError(`Cannot define property '${y}' on defended object '${d.getName(q)}'`);};d.DefendHandler.enumerate=function(q){throw new ReferenceError(`Cannot enumerate defended object '${d.getName(q)}'`);};let m=-1;function p(){m=-1;if(0<e.size||0<c.size){let q=[...new Set([...e.keys()].map(y=>d.getName(y)))].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: ${q}`);
|
|
e.clear();c.clear()}}d.DefendedBase=class{constructor(){if(d.isDebugDefend&&d.Supports.Proxies){var q=new.target;q=Object.create(q.prototype);var y=new Proxy(q,d.DefendHandler);e.set(q,y);c.set(y,q);f.set(y,q);-1===m&&(m=requestAnimationFrame(p));return y}}};d.debugDefend=function(q){if(d.isDebugDefend&&d.Supports.Proxies&&q instanceof d.DefendedBase){if(!c.has(q))return q;let y=c.get(q);c.delete(q);e.delete(y);return q}return d.isDebug?Object.seal(q):q};d.New=function(q,...y){let u;try{u=new q(...y)}catch(t){throw c.clear(),
|
|
e.clear(),t;}d.isDebugDefend&&r(q,u);return d.debugDefend(u)};d.Release=function(q){(q=f.get(q))&&g.set(q,d.GetCallStack())};d.WasReleased=function(q){return(q=f.get(q))?!!g.get(q):!1};let x=new Map;function v(q){let y=new Set;for(let u in q)y.add(u);return y}function r(q,y){y=v(y);let u=x.get(q);if(u){let t=[];for(let A of u.values())y.has(A)?y.delete(A):t.push(A);d.appendArray(t,[...y]);t.length&&console.warn(`[Defence] '${d.getName(q)}' constructor creates inconsistent properties: ${t.join(", ")}`)}else x.set(q,
|
|
y)}d.PerfMark=class{constructor(q){this._name="";q&&this.start(q)}start(q){this._name=q;performance.mark(this._name+"-Start")}end(){performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(q){this.end();this._name=q;performance.mark(this._name+"-Start")}}}
|
|
{"use strict";const d=self.C3,a=2*Math.PI,b=Math.PI/180,e=180/Math.PI;d.wrap=function(g,h,l){g=Math.floor(g);h=Math.floor(h);l=Math.floor(l);return g<h?(g=l-(h-g)%(l-h),g===l?0:g):h+(g-h)%(l-h)};d.mapToRange=function(g,h,l,m,p){return(g-h)*(p-m)/(l-h)+m};d.normalize=function(g,h,l){return(g-h)/(l-h)};d.clamp=function(g,h,l){return g<h?h:g>l?l:g};d.clampAngle=function(g){g%=a;0>g&&(g+=a);return g};d.toRadians=function(g){return g*b};d.toDegrees=function(g){return g*e};d.distanceTo=function(g,h,l,m){return Math.hypot(l-
|
|
g,m-h)};d.distanceSquared=function(g,h,l,m){g=l-g;h=m-h;return g*g+h*h};d.angleTo=function(g,h,l,m){return Math.atan2(m-h,l-g)};d.angleDiff=function(g,h){if(g===h)return 0;g=Math.sin(g)*Math.sin(h)+Math.cos(g)*Math.cos(h);return 1<=g?0:-1>=g?Math.PI:Math.acos(g)};d.angleRotate=function(g,h,l){let m=Math.sin(g),p=Math.cos(g),x=Math.sin(h),v=Math.cos(h);return Math.acos(m*x+p*v)>l?0<p*x-m*v?d.clampAngle(g+l):d.clampAngle(g-l):d.clampAngle(h)};d.angleClockwise=function(g,h){return 0>=Math.cos(g)*Math.sin(h)-
|
|
Math.sin(g)*Math.cos(h)};d.angleLerp=function(g,h,l,m=0){let p=d.angleDiff(g,h);m*=a;return d.angleClockwise(h,g)?d.clampAngle(g+(p+m)*l):d.clampAngle(g-(p+m)*l)};d.angleLerpClockwise=function(g,h,l,m=0){const p=d.angleDiff(g,h);m*=a;return d.angleClockwise(h,g)?d.clampAngle(g+(p+m)*l):d.clampAngle((a-p+m)*l)};d.angleLerpAntiClockwise=function(g,h,l,m=0){const p=d.angleDiff(g,h);m*=a;return d.angleClockwise(h,g)?d.clampAngle((-a+p-m)*l):d.clampAngle(g-(p+m)*l)};d.lerp=function(g,h,l){return g+l*(h-
|
|
g)};d.unlerp=function(g,h,l){return g===h?0:(l-g)/(h-g)};d.relerp=function(g,h,l,m,p){return d.lerp(m,p,d.unlerp(g,h,l))};d.qarp=function(g,h,l,m){return d.lerp(d.lerp(g,h,m),d.lerp(h,l,m),m)};d.cubic=function(g,h,l,m,p){return d.lerp(d.qarp(g,h,l,p),d.qarp(h,l,m,p),p)};d.cosp=function(g,h,l){return(g+h+(g-h)*Math.cos(l*Math.PI))/2};d.isPOT=function(g){return 0<g&&0===(g-1&g)};d.nextHighestPowerOfTwo=function(g){--g;for(let h=1;32>h;h<<=1)g|=g>>h;return g+1};d.roundToNearestFraction=function(g,h){return Math.round(g*
|
|
h)/h};d.floorToNearestFraction=function(g,h){return Math.floor(g*h)/h};d.round6dp=function(g){return Math.round(1E6*g)/1E6};d.toFixed=function(g,h){g=g.toFixed(h);for(h=g.length-1;0<=h&&"0"===g.charAt(h);--h);0<=h&&"."===g.charAt(h)&&--h;return 0>h?g:g.substr(0,h+1)};d.PackRGB=function(g,h,l){return d.clamp(g,0,255)|d.clamp(h,0,255)<<8|d.clamp(l,0,255)<<16};d.PackRGBAEx=function(g,h,l,m){g=d.clamp(Math.floor(1024*g),-8192,8191);h=d.clamp(Math.floor(1024*h),-8192,8191);l=d.clamp(Math.floor(1024*l),
|
|
-8192,8191);m=d.clamp(Math.floor(1023*m),0,1023);0>g&&(g+=16384);0>h&&(h+=16384);0>l&&(l+=16384);return-(274877906944*g+16777216*h+1024*l+m)};d.PackRGBEx=function(g,h,l){return d.PackRGBAEx(g,h,l,1)};function c(g){return 0===g&&0>1/g}d.GetRValue=function(g){if(0<=g)return(g&255)/255;g=Math.floor(-g/274877906944);8191<g&&(g-=16384);return g/1024};d.GetGValue=function(g){if(0<=g)return((g&65280)>>8)/255;g=Math.floor(-g%274877906944/16777216);8191<g&&(g-=16384);return g/1024};d.GetBValue=function(g){if(0<=
|
|
g)return((g&16711680)>>16)/255;g=Math.floor(-g%16777216/1024);8191<g&&(g-=16384);return g/1024};d.GetAValue=function(g){return c(g)?0:0<=g?1:Math.floor(-g%1024)/1023};d.greatestCommonDivisor=function(g,h){g=Math.floor(g);for(h=Math.floor(h);0!==h;){let l=h;h=g%h;g=l}return g};const f=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];d.getAspectRatio=function(g,h){g=Math.floor(g);h=Math.floor(h);if(g===h)return[1,1];for(var l of f){let m=g/l[0]*l[1];if(1>Math.abs(h-m))return l.slice(0);
|
|
m=g/l[1]*l[0];if(1>Math.abs(h-m))return[l[1],l[0]]}l=d.greatestCommonDivisor(g,h);return[g/l,h/l]};d.segmentsIntersect=function(g,h,l,m,p,x,v,r){var q=Math.min(g,l),y=Math.max(p,v);if(Math.max(g,l)<Math.min(p,v)||q>y)return!1;q=Math.min(h,m);y=Math.max(x,r);if(Math.max(h,m)<Math.min(x,r)||q>y)return!1;q=p-g+v-l;y=x-h+r-m;g=l-g;h=m-h;p=v-p;x=r-x;r=Math.abs(h*p-x*g);return Math.abs(p*y-x*q)>r?!1:Math.abs(g*y-h*q)<=r};d.segmentsIntersectPreCalc=function(g,h,l,m,p,x,v,r,q,y,u,t){const A=Math.max(q,u);
|
|
if(x<Math.min(q,u)||p>A)return!1;p=Math.max(y,t);if(r<Math.min(y,t)||v>p)return!1;v=q-g+u-l;r=y-h+t-m;g=l-g;h=m-h;q=u-q;y=t-y;t=Math.abs(h*q-y*g);return Math.abs(q*r-y*v)>t?!1:Math.abs(g*r-h*v)<=t};d.segmentIntersectsQuad=function(g,h,l,m,p){const x=Math.min(g,l),v=Math.max(g,l),r=Math.min(h,m),q=Math.max(h,m),y=p.getTlx(),u=p.getTly(),t=p.getTrx(),A=p.getTry(),z=p.getBrx(),C=p.getBry(),E=p.getBlx();p=p.getBly();return d.segmentsIntersectPreCalc(g,h,l,m,x,v,r,q,y,u,t,A)||d.segmentsIntersectPreCalc(g,
|
|
h,l,m,x,v,r,q,t,A,z,C)||d.segmentsIntersectPreCalc(g,h,l,m,x,v,r,q,z,C,E,p)||d.segmentsIntersectPreCalc(g,h,l,m,x,v,r,q,E,p,y,u)};d.segmentIntersectsAnyN=function(g,h,l,m,p){const x=Math.min(g,l),v=Math.max(g,l),r=Math.min(h,m),q=Math.max(h,m);let y=0;for(let u=p.length-4;y<=u;y+=2)if(d.segmentsIntersectPreCalc(g,h,l,m,x,v,r,q,p[y],p[y+1],p[y+2],p[y+3]))return!0;return d.segmentsIntersectPreCalc(g,h,l,m,x,v,r,q,p[y],p[y+1],p[0],p[1])};d.rayIntersect=function(g,h,l,m,p,x,v,r){l-=g;x=r-x;const q=l*
|
|
x-(m-h)*(v-p);if(0===q)return 2;m=((h-m)*(v-g)+l*(r-h))/q;return 0<m&&1.000001>m?(x*(v-g)+(p-v)*(r-h))/q:2};d.rayIntersectExtended=function(g,h,l,m,p,x,v,r,q){const y=(v-p)*q;q*=r-x;return d.rayIntersect(g,h,l,m,p-y,x-q,v+y,r+q)};d.isPointInTriangleInclusive=function(g,h,l,m,p,x,v,r){p-=l;x-=m;v-=l;r-=m;g-=l;l=h-m;h=p*p+x*x;m=p*v+x*r;p=p*g+x*l;x=v*v+r*r;v=v*g+r*l;r=1/(h*x-m*m);x=(x*p-m*v)*r;p=(h*v-m*p)*r;return 0<=x&&0<=p&&1>=x+p};d.triangleCartesianToBarycentric=function(g,h,l,m,p,x,v,r){p-=l;x-=
|
|
m;v-=l;r-=m;g-=l;const q=h-m;h=p*p+x*x;m=p*v+x*r;l=v*v+r*r;p=g*p+q*x;x=g*v+q*r;v=h*l-m*m;r=(l*p-m*x)/v;p=(h*x-m*p)/v;return[1-r-p,r,p]};d.triangleBarycentricToCartesian=function(g,h,l,m,p,x,v,r,q){return[g*m+h*x+l*r,g*p+h*v+l*q]}}
|
|
{"use strict";const d=self.C3;let a=null,b="";if("undefined"!==typeof document){a=document;const l=document.querySelector("base");if(b=l&&l.hasAttribute("href")?l.getAttribute("href"):"")b.startsWith("/")&&(b=b.substr(1)),b.endsWith("/")||(b+="/")}d.GetBaseHref=function(){return b};d.GetBaseURL=function(){if(!a)return"";const l=a.location;return d.GetPathFromURL(l.origin+l.pathname)+b};d.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)};d.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)};d.GetFileExtension=function(l){let m=l.lastIndexOf(".");return 1>m?"":l.substr(m)};d.GetFileNamePart=function(l){let m=l.lastIndexOf(".");return 1>m?l:l.substr(0,m)};d.NormalizeFileSeparator=function(l){return l.replace(/\\/g,"/")};d.IsFileExtension=function(l,
|
|
m){l=l?d.GetFileExtension(l).slice(1):"";return m===l};d.FileNameEquals=function(l,m){let p,x;d.IsFileLike(l)&&(p=d.GetFileNamePart(l.name));d.IsString(l)&&(p=d.GetFileNamePart(l));d.IsFileLike(m)&&(x=d.GetFileNamePart(m.name));d.IsString(m)&&(x=d.GetFileNamePart(m));return p===x};d.ParseFilePath=function(l){l=d.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 p=l.lastIndexOf("/")+
|
|
1;let x="",v=l,r="";0<p&&(x=l.slice(0,p),v=l.slice(p));l=v;p=v.lastIndexOf(".");0<p&&(r=v.slice(p),l=v.slice(0,-r.length));return{dir:x,base:v,name:l,root:m,ext:r,full:m+x+v}};d.Wait=function(l,m){return new Promise((p,x)=>{self.setTimeout(p,l,m)})};d.swallowException=function(l){try{l()}catch(m){d.isDebug&&console.warn("Swallowed exception: ",m)}};d.noop=function(){};d.equalsNoCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m||l.normalize().toLowerCase()===m.normalize().toLowerCase()};
|
|
d.equalsCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m?!0:l.normalize()===m.normalize()};d.typedArraySet16=function(l,m,p){l[p++]=m[0];l[p++]=m[1];l[p++]=m[2];l[p++]=m[3];l[p++]=m[4];l[p++]=m[5];l[p++]=m[6];l[p++]=m[7];l[p++]=m[8];l[p++]=m[9];l[p++]=m[10];l[p++]=m[11];l[p++]=m[12];l[p++]=m[13];l[p++]=m[14];l[p]=m[15]};d.truncateArray=function(l,m){l.length=m};d.clearArray=function(l){l&&0!==l.length&&d.truncateArray(l,0)};d.clear2DArray=function(l){if(l){for(let m=0;m<
|
|
l.length;m++)d.truncateArray(l[m],0);d.truncateArray(l,0)}};d.extendArray=function(l,m,p){m|=0;var x=l.length;if(!(m<=x))for(;x<m;++x)l.push(p)};d.resizeArray=function(l,m,p){m|=0;const x=l.length;m<x?d.truncateArray(l,m):m>x&&d.extendArray(l,m,p)};d.shallowAssignArray=function(l,m){d.clearArray(l);d.appendArray(l,m)};d.appendArray=function(l,m){if(1E4>m.length)l.push(...m);else for(let p=0,x=m.length;p<x;++p)l.push(m[p])};d.arrayRemove=function(l,m){m=Math.floor(m);if(!(0>m||m>=l.length)){for(var p=
|
|
l.length-1;m<p;++m)l[m]=l[m+1];d.truncateArray(l,p)}};d.arrayFindRemove=function(l,m){m=l.indexOf(m);0<=m&&l.splice(m,1)};d.arraysEqual=function(l,m){let p=l.length;if(m.length!==p)return!1;for(let x=0;x<p;++x)if(l[x]!==m[x])return!1;return!0};d.arrayFilterOut=function(l,m){let p=[],x=0;for(let v=0,r=l.length;v<r;++v){let q=l[v];m(q)?p.push(q):(l[x]=q,++x)}d.truncateArray(l,x);return p};d.arrayRemoveAllInSet=function(l,m){const p=l.length;let x=0;for(let v=0,r=l.length;v<r;++v){let q=l[v];m.has(q)||
|
|
(l[x++]=q)}d.truncateArray(l,x);return p-x};d.isArrayIndexInBounds=function(l,m){return l!==Math.floor(l)?!1:0<=l&&l<m.length};d.validateArrayIndex=function(l,m){if(!d.isArrayIndexInBounds(l,m))throw new RangeError("array index out of bounds");};d.cloneArray=function(l){return l.slice()};d.deepCloneArray=function(l,m){let p=[];for(let x of l)if(d.IsObject(x)){l=m(x);if(!l)throw Error("missing clone");if(l.constructor!==x.constructor)throw Error("object is not a clone");p.push(l)}else d.IsArray(x)?
|
|
p.push(d.deepCloneArray(x,m)):p.push(x);return p};d.clone2DArray=function(l){let m=[];for(let p of l)m.push(p.slice());return m};d.mergeSets=function(l,m){return new Set([...l,...m])};d.mergeSetsInPlace=function(l,m){for(const p of m)l.add(p);return l};d.first=function(l){for(let m of l)return m;return null};d.xor=function(l,m){return!l!==!m};d.compare=function(l,m,p){switch(m){case 0:return l===p;case 1:return l!==p;case 2:return l<p;case 3:return l<=p;case 4:return l>p;case 5:return l>=p;default:return!1}};
|
|
d.hasAnyOwnProperty=function(l){for(let m in l)if(l.hasOwnProperty(m))return!0;return!1};d.PromiseAllWithProgress=function(l,m){return l.length?new Promise((p,x)=>{const v=[];let r=0,q=!1;for(let y=0,u=l.length;y<u;++y)v.push(void 0),l[y].then(t=>{q||(v[y]=t,++r,r===l.length?p(v):m(r,l.length))}).catch(t=>{q=!0;x(t)})}):Promise.resolve([])};let e=[];d.AddLibraryMemoryCallback=function(l){e.push(l)};d.GetEstimatedLibraryMemoryUsage=function(){let l=0;for(let m of e){let p=m();l+=p}return Math.floor(l)};
|
|
let c=1;const f=new Map,g=new MessageChannel;g.port2.onmessage=function(l){l=l.data;const m=f.get(l);f.delete(l);m&&m(performance.now())};d.RequestUnlimitedAnimationFrame=function(l){const m=c++;f.set(m,l);g.port1.postMessage(m);return m};d.CancelUnlimitedAnimationFrame=function(l){f.delete(l)};d.PostTask=d.RequestUnlimitedAnimationFrame;d.WaitForNextTask=function(){return new Promise(l=>d.PostTask(l))};const h=new Set;d.RequestPostAnimationFrame=function(l){const m=self.requestAnimationFrame(async p=>
|
|
{await d.WaitForNextTask();h.has(m)&&(h.delete(m),l(p))});h.add(m);return m};d.CancelPostAnimationFrame=function(l){h.has(l)&&(self.cancelAnimationFrame(l),h.delete(l))}}
|
|
{"use strict";const d=self.C3;d.IsAbsoluteURL=function(a){return/^(?:[a-z\-]+:)?\/\//.test(a)||"data:"===a.substr(0,5)||"blob:"===a.substr(0,5)};d.IsRelativeURL=function(a){return!d.IsAbsoluteURL(a)};d.ThrowIfNotOk=function(a){if(!a.ok)throw Error(`fetch '${a.url}' response returned ${a.status} ${a.statusText}`);};d.FetchOk=function(a,b){return fetch(a,b).then(e=>{d.ThrowIfNotOk(e);return e})};d.FetchText=function(a){return d.FetchOk(a).then(b=>b.text())};d.FetchJson=function(a){return d.FetchOk(a).then(b=>
|
|
b.json())};d.FetchBlob=function(a){return d.FetchOk(a).then(b=>b.blob())};d.FetchArrayBuffer=function(a){return d.FetchOk(a).then(b=>b.arrayBuffer())};d.FetchImage=function(a){return new Promise((b,e)=>{const c=new Image;c.onload=()=>b(c);c.onerror=f=>e(f);c.src=a})};d.BlobToArrayBuffer=function(a){return"function"===typeof a.arrayBuffer?a.arrayBuffer():new Promise((b,e)=>{const c=new FileReader;c.onload=()=>b(c.result);c.onerror=()=>e(c.error);c.readAsArrayBuffer(a)})};d.BlobToString=function(a){return"function"===
|
|
typeof a.text?a.text():new Promise((b,e)=>{const c=new FileReader;c.onload=()=>b(c.result);c.onerror=()=>e(c.error);c.readAsText(a)})};d.BlobToJson=function(a){return d.BlobToString(a).then(b=>JSON.parse(b))};d.BlobToImage=async function(a,b){a=URL.createObjectURL(a);try{const e=await d.FetchImage(a);URL.revokeObjectURL(a);a="";b&&"function"===typeof e.decode&&await e.decode();return e}finally{a&&URL.revokeObjectURL(a)}};d.CreateCanvas=function(a,b){if("undefined"!==typeof document&&"function"===
|
|
typeof document.createElement){const e=document.createElement("canvas");e.width=a;e.height=b;return e}return new OffscreenCanvas(a,b)};d.CanvasToBlob=function(a,b,e){"number"!==typeof e&&(e=1);b=b||"image/png";e=d.clamp(e,0,1);return a.toBlob?new Promise(c=>a.toBlob(c,b,e)):a.convertToBlob?a.convertToBlob({type:b,quality:e}):d.Asyncify(()=>d.CanvasToBlobSync(a,b,e))};d.CanvasToBlobSync=function(a,b,e){"number"!==typeof e&&(e=1);b=b||"image/png";e=d.clamp(e,0,1);return d.DataURIToBinaryBlobSync(a.toDataURL(b,
|
|
e))};d.DataURIToBinaryBlobSync=function(a){a=d.ParseDataURI(a);return d.BinaryStringToBlob(a.data,a.mime_type)};d.ParseDataURI=function(a){if("data:"!==a.substr(0,5))throw new URIError("expected data: uri");var b=a.indexOf(",");if(0>b)throw new URIError("expected comma in data: uri");var e=a.substring(5,b);a=a.substring(b+1);b=e.split(";");e=b[0]||"";let c=b[2];a="base64"===b[1]||"base64"===c?atob(a):decodeURIComponent(a);return{mime_type:e,data:a}};d.BinaryStringToBlob=function(a,b){var e=a.length;
|
|
let c=e>>2,f=new Uint8Array(e),g=new Uint32Array(f.buffer,0,c),h,l;for(l=h=0;h<c;++h)g[h]=a.charCodeAt(l++)|a.charCodeAt(l++)<<8|a.charCodeAt(l++)<<16|a.charCodeAt(l++)<<24;for(e&=3;e--;)f[l]=a.charCodeAt(l),++l;return b?new Blob([f],{type:b}):new Blob([f])};d.DrawableToBlob=function(a,b,e){const c=d.CreateCanvas(a.width,a.height);c.getContext("2d").drawImage(a,0,0);return d.CanvasToBlob(c,b,e)};d.ImageDataToBlobSync=function(a,b,e){const c=d.CreateCanvas(a.width,a.height);c.getContext("2d").putImageData(a,
|
|
0,0);return d.CanvasToBlobSync(c,b,e)};d.ImageDataToBlob=function(a,b,e){if(d.Supports.ImageBitmapOptions)return createImageBitmap(a,{premultiplyAlpha:"none"}).then(c=>d.DrawableToBlob(c,b,e));if(d.Supports.ImageBitmap)return createImageBitmap(a).then(c=>d.DrawableToBlob(c,b,e));{const c=d.CreateCanvas(a.width,a.height);c.getContext("2d").putImageData(a,0,0);return d.CanvasToBlob(c,b,e)}};d.CopySet=function(a,b){a.clear();for(const e of b)a.add(e)};d.MapToObject=function(a){const b=Object.create(null);
|
|
for(const [e,c]of a.entries())b[e]=c;return b};d.ObjectToMap=function(a,b){b.clear();for(const [e,c]of Object.entries(a))b.set(e,c)};d.ToSuperJSON=function e(b){if("object"===typeof b&&null!==b){if(b instanceof Set)return{_c3type_:"set",data:[...b].map(c=>e(c))};if(b instanceof Map)return{_c3type_:"map",data:[...b].map(c=>[c[0],e(c[1])])};{const c=Object.create(null);for(const [f,g]of Object.entries(b))c[f]=e(g);return c}}return b};d.FromSuperJSON=function c(e){if("object"===typeof e&null!==e){if("set"===
|
|
e._c3type_)return new Set(e.data.map(f=>c(f)));if("map"===e._c3type_)return new Map(e.data.map(f=>[f[0],c(f[1])]));{const f=Object.create(null);for(const [g,h]of Object.entries(e))f[g]=c(h);return f}}return e};d.CSSToCamelCase=function(e){let c="",f=!1;for(const g of e)"-"===g?f=!0:f?(c+=g.toUpperCase(),f=!1):c+=g;return c};d.IsIterator=function(e){return"object"===typeof e&&"function"===typeof e.next};d.MakeFilledArray=function(e,c){const f=[];if("function"===typeof c)for(var g=0;g<e;++g)f.push(c());
|
|
else for(g=0;g<e;++g)f.push(c);return f}}
|
|
{"use strict";const d=self.C3,a=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,b=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;function e(f){return 0===f.length?"00":1===f.length?"0"+f:f}function c(f,g,h){0>h&&(h+=1);1<h&&--h;return h<1/6?f+6*(g-f)*h:.5>h?g:h<2/3?f+(g-f)*(2/3-h)*6:f}d.Color=class{constructor(f,g,h,l){this._a=this._b=this._g=this._r=0;f instanceof d.Color?this.set(f):this.setRgba(f||0,g||0,h||0,l||0)}setRgb(f,g,h){this._r=+f;this._g=+g;this._b=+h;this.clamp();return this}setRgba(f,g,h,l){this._r=
|
|
+f;this._g=+g;this._b=+h;this._a=+l;this.clamp();return this}set(f){this._r=f._r;this._g=f._g;this._b=f._b;this._a=f._a;return this}copy(f){return this.set(f)}add(f){this._r+=f._r;this._g+=f._g;this._b+=f._b;this._a+=f._a;this.clamp()}addRgb(f,g,h,l=0){this._r+=+f;this._g+=+g;this._b+=+h;this._a+=+l;this.clamp()}diff(f){this.setR(Math.max(this._r,f._r)-Math.min(this._r,f._r));this.setG(Math.max(this._g,f._g)-Math.min(this._g,f._g));this.setB(Math.max(this._b,f._b)-Math.min(this._b,f._b));this.setA(Math.max(this._a,
|
|
f._a)-Math.min(this._a,f._a));this.clamp()}copyRgb(f){this._r=f._r;this._g=f._g;this._b=f._b}setR(f){this._r=d.clamp(+f,0,1)}getR(){return this._r}setG(f){this._g=d.clamp(+f,0,1)}getG(){return this._g}setB(f){this._b=d.clamp(+f,0,1)}getB(){return this._b}setA(f){this._a=d.clamp(+f,0,1)}getA(){return this._a}clone(){return d.New(d.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(f,g){f[g++]=
|
|
this._r;f[g++]=this._g;f[g++]=this._b;f[g]=this._a}equals(f){return this._r===f._r&&this._g===f._g&&this._b===f._b&&this._a===f._a}equalsIgnoringAlpha(f){return this._r===f._r&&this._g===f._g&&this._b===f._b}equalsRgb(f,g,h){return this._r===f&&this._g===g&&this._b===h}equalsRgba(f,g,h,l){return this._r===f&&this._g===g&&this._b===h&&this._a===l}multiply(f){this._r*=f._r;this._g*=f._g;this._b*=f._b;this._a*=f._a}multiplyAlpha(f){this._r*=f;this._g*=f;this._b*=f;this._a*=f}premultiply(){this._r*=this._a;
|
|
this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=d.clamp(this._r,0,1);this._g=d.clamp(this._g,0,1);this._b=d.clamp(this._b,0,1);this._a=d.clamp(this._a,0,1);return this}setFromRgbValue(f){this._r=d.GetRValue(f);this._g=d.GetGValue(f);this._b=d.GetBValue(f);this._a=d.GetAValue(f)}getCssRgb(f,g,h){f=d.IsFiniteNumber(f)?f:this.getR();g=d.IsFiniteNumber(g)?g:this.getG();h=d.IsFiniteNumber(h)?h:this.getB();return`rgb(${100*
|
|
f}%, ${100*g}%, ${100*h}%)`}getCssRgba(f,g,h,l){f=d.IsFiniteNumber(f)?f:this.getR();g=d.IsFiniteNumber(g)?g:this.getG();h=d.IsFiniteNumber(h)?h:this.getB();l=d.IsFiniteNumber(l)?l:this.getA();return`rgba(${100*f}%, ${100*g}%, ${100*h}%, ${l})`}toHexString(){const f=Math.round(255*this.getR()),g=Math.round(255*this.getG()),h=Math.round(255*this.getB());return"#"+e(f.toString(16))+e(g.toString(16))+e(h.toString(16))}parseHexString(f){if("string"!==typeof f)return!1;f=f.trim();"#"===f.charAt(0)&&(f=
|
|
f.substr(1));let g,h;if(3===f.length)g=parseInt(f[0],16)/15,h=parseInt(f[1],16)/15,f=parseInt(f[2],16)/15;else if(6===f.length)g=parseInt(f.substr(0,2),16)/255,h=parseInt(f.substr(2,2),16)/255,f=parseInt(f.substr(4,2),16)/255;else return!1;isFinite(g)&&this.setR(g);isFinite(h)&&this.setG(h);isFinite(f)&&this.setB(f);this.setA(1);return!0}toCommaSeparatedRgb(){const f=Math.round(255*this.getR()),g=Math.round(255*this.getG()),h=Math.round(255*this.getB());return`${f}, ${g}, ${h}`}toRgbArray(){const f=
|
|
Math.round(255*this.getR()),g=Math.round(255*this.getG()),h=Math.round(255*this.getB());return[f,g,h]}parseCommaSeparatedRgb(f){if("string"!==typeof f)return!1;f=f.replace(/^rgb\(|\)|%/,"");var g=f.split(",");if(3>g.length)return!1;f=parseInt(g[0].trim(),10)/255;const h=parseInt(g[1].trim(),10)/255;g=parseInt(g[2].trim(),10)/255;isFinite(f)&&this.setR(f);isFinite(h)&&this.setG(h);isFinite(g)&&this.setB(g);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(f){if("string"!==typeof f)return!1;f=
|
|
f.replace(/^rgb\(|\)|%/,"");var g=f.split(",");if(3>g.length)return!1;f=parseInt(g[0].trim(),10)/100;const h=parseInt(g[1].trim(),10)/100;g=parseInt(g[2].trim(),10)/100;isFinite(f)&&this.setR(f);isFinite(h)&&this.setG(h);isFinite(g)&&this.setB(g);this.setA(1);return!0}parseCommaSeparatedRgba(f){if("string"!==typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var g=f.split(",");if(4>g.length)return!1;f=parseInt(g[0].trim(),10)/255;const h=parseInt(g[1].trim(),10)/255,l=parseInt(g[2].trim(),10)/255;g=
|
|
parseFloat(g[3].trim());isFinite(f)&&this.setR(f);isFinite(h)&&this.setG(h);isFinite(l)&&this.setB(l);isFinite(g)&&this.setA(g);return!0}parseCommaSeparatedPercentageRgba(f){if("string"!==typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var g=f.split(",");if(4>g.length)return!1;f=parseInt(g[0].trim(),10)/100;const h=parseInt(g[1].trim(),10)/100,l=parseInt(g[2].trim(),10)/100;g=parseFloat(g[3].trim());isFinite(f)&&this.setR(f);isFinite(h)&&this.setG(h);isFinite(l)&&this.setB(l);isFinite(g)&&this.setA(g);
|
|
return!0}parseString(f){if("string"!==typeof f)return!1;f=f.replace(/\s+/,"");if(f.includes(",")){if(f.startsWith("rgb("))return f.includes("%")?this.parseCommaSeparatedPercentageRgb(f):this.parseCommaSeparatedRgb(f);if(f.startsWith("rgba("))return f.includes("%")?this.parseCommaSeparatedPercentageRgba(f):this.parseCommaSeparatedRgba(f);if(f.startsWith("hsl(")||f.startsWith("hsla("))return this.parseHSLString(f);{const g=f.split(",");if(f.includes("%")){if(3===g.length)return this.parseCommaSeparatedPercentageRgb(f);
|
|
if(4===g.length)return this.parseCommaSeparatedPercentageRgba(f)}else{if(3===g.length)return this.parseCommaSeparatedRgb(f);if(4===g.length)return this.parseCommaSeparatedRgba(f)}return!1}}return this.parseHexString(f)}toJSON(){return[this._r,this._g,this._b,this._a]}setFromHSLA(f,g,h,l){f%=360;g=d.clamp(g,0,100);h=d.clamp(h,0,100);l=d.clamp(l,0,1);f/=360;g/=100;h/=100;if(0===g)h=g=f=h;else{const m=.5>h?h*(1+g):h+g-h*g,p=2*h-m;h=c(p,m,f+1/3);g=c(p,m,f);f=c(p,m,f-1/3)}this.setR(h);this.setG(g);this.setB(f);
|
|
this.setA(l);return this}parseHSLString(f){var g=f.replace(/ |hsl|hsla|\(|\)|;/gi,"");f=a.exec(g);g=b.exec(g);return f&&4===f.length?(this.setFromHSLA(+f[1],+f[2],+f[3],1),!0):g&&5===g.length?(this.setFromHSLA(+f[1],+f[2],+f[3],+f[4]),!0):!1}toHSLAString(){var f=this._r;const g=this._g,h=this._b,l=this._a,m=d.Color.GetHue(f,g,h),p=d.Color.GetSaturation(f,g,h);f=d.Color.GetLuminosity(f,g,h);return`hsla(${m}, ${p}%, ${f}%, ${l})`}toHSLAArray(){const f=this._r,g=this._g,h=this._b;return[d.Color.GetHue(f,
|
|
g,h),d.Color.GetSaturation(f,g,h),d.Color.GetLuminosity(f,g,h),this._a]}setFromJSON(f){!Array.isArray(f)||3>f.length||(this._r=f[0],this._g=f[1],this._b=f[2],this._a=4<=f.length?f[3]:1)}set r(f){this.setR(f)}get r(){return this.getR()}set g(f){this.setG(f)}get g(){return this.getG()}set b(f){this.setB(f)}get b(){return this.getB()}set a(f){this.setA(f)}get a(){return this.getA()}setAtIndex(f,g){switch(f){case 0:this.setR(g);break;case 1:this.setG(g);break;case 2:this.setB(g);break;case 3:this.setA(g);
|
|
break;default:throw new RangeError("invalid color index");}}getAtIndex(f){switch(f){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static Equals(f,g){let h;if(Array.isArray(f))h=new d.Color,h.setFromJSON(f);else if(f instanceof d.Color)h=f;else throw Error("unexpected type");if(Array.isArray(g))f=new d.Color,f.setFromJSON(g);else if(g instanceof d.Color)f=g;else throw Error("unexpected type");
|
|
return h.equals(f)}static DiffChannel(f,g){return d.clamp(Math.max(f,g)-Math.min(f,g),0,1)}static Diff(f,g){const h=new d.Color;h.setR(Math.max(f._r,g._r)-Math.min(f._r,g._r));h.setG(Math.max(f._g,g._g)-Math.min(f._g,g._g));h.setB(Math.max(f._b,g._b)-Math.min(f._b,g._b));h.setA(Math.max(f._a,g._a)-Math.min(f._a,g._a));return h}static DiffNoAlpha(f,g){const h=new d.Color(0,0,0,1);h.setR(Math.max(f._r,g._r)-Math.min(f._r,g._r));h.setG(Math.max(f._g,g._g)-Math.min(f._g,g._g));h.setB(Math.max(f._b,g._b)-
|
|
Math.min(f._b,g._b));return h}static GetHue(f,g,h){const l=Math.max(f,g,h),m=Math.min(f,g,h);if(l===m)return 0;let p=0;switch(l){case f:p=(g-h)/(l-m)+(g<h?6:0);break;case g:p=(h-f)/(l-m)+2;break;case h:p=(f-g)/(l-m)+4}return Math.round(p/6*360)}static GetSaturation(f,g,h){const l=Math.max(f,g,h);f=Math.min(f,g,h);if(l===f)return 0;g=l-f;return Math.round(100*(.5<(l+f)/2?g/(2-l-f):g/(l+f)))}static GetLuminosity(f,g,h){const l=Math.max(f,g,h);return l?Math.round((l+Math.min(f,g,h))/2*100):0}};d.Color.White=
|
|
Object.freeze(d.New(d.Color,1,1,1,1));d.Color.Black=Object.freeze(d.New(d.Color,0,0,0,1));d.Color.TransparentBlack=Object.freeze(d.New(d.Color,0,0,0,0))}
|
|
{"use strict";const d=self.C3;d.Vector2=class{constructor(a,b){this._y=this._x=0;a instanceof d.Vector2?this.copy(a):this.set(a||0,b||0)}set(a,b){this._x=+a;this._y=+b}copy(a){this._x=a._x;this._y=a._y}equals(a){return this._x===a._x&&this._y===a._y}equalsValues(a,b){return this._x===a&&this._y===b}setX(a){this._x=+a}getX(){return this._x}setY(a){this._y=+a}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(a,b){a[b++]=
|
|
this._x;a[b]=this._y}offset(a,b){this._x+=+a;this._y+=+b}scale(a,b){this._x*=a;this._y*=b}divide(a,b){this._x/=a;this._y/=b}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 d.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}rotatePrecalc(a,b){const e=this._x*b-this._y*
|
|
a;this._y=this._y*b+this._x*a;this._x=e}rotate(a){0!==a&&this.rotatePrecalc(Math.sin(a),Math.cos(a))}rotateAbout(a,b,e){0===a||b===this._x&&e===this._y||(this._x-=b,this._y-=e,this.rotatePrecalc(Math.sin(a),Math.cos(a)),this._x+=+b,this._y+=+e)}move(a,b){0!==b&&(this._x+=Math.cos(a)*b,this._y+=Math.sin(a)*b)}normalize(){const a=this.length();0!==a&&1!==a&&(this._x/=a,this._y/=a)}clamp(a,b){this._x=d.clamp(this._x,a,b);this._y=d.clamp(this._y,a,b)}}}
|
|
{"use strict";const d=self.C3;d.Rect=class{constructor(a,b,e,c){this._bottom=this._right=this._top=this._left=0;a instanceof d.Rect?this.copy(a):this.set(a||0,b||0,e||0,c||0)}set(a,b,e,c){this._left=+a;this._top=+b;this._right=+e;this._bottom=+c}setWH(a,b,e,c){a=+a;b=+b;this._left=a;this._top=b;this._right=a+ +e;this._bottom=b+ +c}copy(a){this._left=+a._left;this._top=+a._top;this._right=+a._right;this._bottom=+a._bottom}clone(){return new d.Rect(this._left,this._top,this._right,this._bottom)}static Merge(a,
|
|
b){const e=new d.Rect;e.setLeft(Math.min(a._left,b._left));e.setTop(Math.min(a._top,b._top));e.setRight(Math.max(a._right,b._right));e.setBottom(Math.max(a._bottom,b._bottom));return e}static FromObject(a){return new d.Rect(a.left,a.top,a.right,a.bottom)}equals(a){return this._left===a._left&&this._top===a._top&&this._right===a._right&&this._bottom===a._bottom}equalsWH(a,b,e,c){return this._left===a&&this._top===b&&this.width()===e&&this.height()===c}setLeft(a){this._left=+a}getLeft(){return this._left}setTop(a){this._top=
|
|
+a}getTop(){return this._top}setRight(a){this._right=+a}getRight(){return this._right}setBottom(a){this._bottom=+a}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(a,b){a[b++]=this._left;a[b++]=this._top;a[b++]=this._right;a[b]=this._bottom}writeAsQuadToTypedArray(a,b){a[b++]=this._left;a[b++]=this._top;
|
|
a[b++]=this._right;a[b++]=this._top;a[b++]=this._right;a[b++]=this._bottom;a[b++]=this._left;a[b]=this._bottom}writeAsQuadToTypedArray3D(a,b,e){a[b++]=this._left;a[b++]=this._top;a[b++]=e;a[b++]=this._right;a[b++]=this._top;a[b++]=e;a[b++]=this._right;a[b++]=this._bottom;a[b++]=e;a[b++]=this._left;a[b++]=this._bottom;a[b]=e}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(a,b){a=+a;b=
|
|
+b;this._left+=a;this._top+=b;this._right+=a;this._bottom+=b}offsetLeft(a){this._left+=+a}offsetTop(a){this._top+=+a}offsetRight(a){this._right+=+a}offsetBottom(a){this._bottom+=+a}toSquare(a){if("x"!==a)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(a,b){a=+a;b=+b;this._left-=a;this._top-=b;this._right+=a;this._bottom+=
|
|
b}deflate(a,b){a=+a;b=+b;this._left+=a;this._top+=b;this._right-=a;this._bottom-=b}multiply(a,b){this._left*=a;this._top*=b;this._right*=a;this._bottom*=b}divide(a,b){this._left/=a;this._top/=b;this._right/=a;this._bottom/=b}mirrorAround(a){this._left=+a-this._left;this._right=+a-this._right}flipAround(a){this._top=+a-this._top;this._bottom=+a-this._bottom}swapLeftRight(){const a=this._left;this._left=this._right;this._right=a}swapTopBottom(){const a=this._top;this._top=this._bottom;this._bottom=
|
|
a}shuntY(a){const b=this._top;this._top=+a-this._bottom;this._bottom=+a-b}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(a,b,e,c){this._left<a&&(this._left=+a);this._top<b&&(this._top=+b);this._right>e&&(this._right=+e);this._bottom>c&&(this._bottom=+c)}clampFlipped(a,b,e,c){this._left<a&&(this._left=+a);this._top>b&&(this._top=+b);this._right>
|
|
e&&(this._right=+e);this._bottom<c&&(this._bottom=+c)}normalize(){this._left>this._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(a){return!(a._right<this._left||a._bottom<this._top||a._left>this._right||a._top>this._bottom)}intersectsRectOffset(a,b,e){return!(a._right+b<this._left||a._bottom+e<this._top||a._left+b>this._right||a._top+e>this._bottom)}containsPoint(a,b){return a>=this._left&&a<=this._right&&b>=this._top&&b<=this._bottom}containsRect(a){return a._left>=
|
|
this._left&&a._top>=this._top&&a._right<=this._right&&a._bottom<=this._bottom}expandToContain(a){a._left<this._left&&(this._left=+a._left);a._top<this._top&&(this._top=+a._top);a._right>this._right&&(this._right=+a._right);a._bottom>this._bottom&&(this._bottom=+a._bottom)}lerpInto(a){this._left=d.lerp(a._left,a._right,this._left);this._top=d.lerp(a._top,a._bottom,this._top);this._right=d.lerp(a._left,a._right,this._right);this._bottom=d.lerp(a._top,a._bottom,this._bottom)}}}
|
|
{"use strict";const d=self.C3;d.Quad=class{constructor(a,b,e,c,f,g,h,l){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;a instanceof d.Quad?this.copy(a):this.set(a||0,b||0,e||0,c||0,f||0,g||0,h||0,l||0)}set(a,b,e,c,f,g,h,l){this._tlx=+a;this._tly=+b;this._trx=+e;this._try=+c;this._brx=+f;this._bry=+g;this._blx=+h;this._bly=+l}setRect(a,b,e,c){this.set(a,b,e,b,e,c,a,c)}copy(a){this._tlx=a._tlx;this._tly=a._tly;this._trx=a._trx;this._try=a._try;this._brx=a._brx;this._bry=
|
|
a._bry;this._blx=a._blx;this._bly=a._bly}equals(a){return this._tlx===a._tlx&&this._tly===a._tly&&this._trx===a._trx&&this._try===a._try&&this._brx===a._brx&&this._bry===a._bry&&this._blx===a._blx&&this._bly===a._bly}setTlx(a){this._tlx=+a}getTlx(){return this._tlx}setTly(a){this._tly=+a}getTly(){return this._tly}setTrx(a){this._trx=+a}getTrx(){return this._trx}setTry(a){this._try=+a}getTry(){return this._try}setBrx(a){this._brx=+a}getBrx(){return this._brx}setBry(a){this._bry=+a}getBry(){return this._bry}setBlx(a){this._blx=
|
|
+a}getBlx(){return this._blx}setBly(a){this._bly=+a}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(a,b){a[b++]=this._tlx;a[b++]=this._tly;a[b++]=this._trx;a[b++]=this._try;a[b++]=this._brx;
|
|
a[b++]=this._bry;a[b++]=this._blx;a[b]=this._bly}writeToTypedArray3D(a,b,e){a[b++]=this._tlx;a[b++]=this._tly;a[b++]=e;a[b++]=this._trx;a[b++]=this._try;a[b++]=e;a[b++]=this._brx;a[b++]=this._bry;a[b++]=e;a[b++]=this._blx;a[b++]=this._bly;a[b]=e}offset(a,b){a=+a;b=+b;this._tlx+=a;this._tly+=b;this._trx+=a;this._try+=b;this._brx+=a;this._bry+=b;this._blx+=a;this._bly+=b}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(a){this._tlx=a._left;this._tly=a._top;this._trx=a._right;this._try=a._top;this._brx=a._right;this._bry=a._bottom;this._blx=a._left;this._bly=a._bottom}setFromRotatedRect(a,b){0===b?this.setFromRect(a):this.setFromRotatedRectPrecalc(a,Math.sin(b),Math.cos(b))}setFromRotatedRectPrecalc(a,b,e){const c=a._left*b,f=a._top*b,g=a._right*b;b*=a._bottom;
|
|
const h=a._left*e,l=a._top*e,m=a._right*e;a=a._bottom*e;this._tlx=h-f;this._tly=l+c;this._trx=m-f;this._try=l+g;this._brx=m-b;this._bry=a+g;this._blx=h-b;this._bly=a+c}getBoundingBox(a){a.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(a,b){var e=this._trx-this._tlx,c=this._try-this._tly;const f=this._brx-this._tlx,g=this._bry-this._tly;
|
|
a-=this._tlx;b-=this._tly;var h=e*e+c*c;let l=e*f+c*g;c=e*a+c*b;const m=f*f+g*g,p=f*a+g*b;let x=1/(h*m-l*l);e=(m*c-l*p)*x;h=(h*p-l*c)*x;if(0<=e&&0<h&&1>e+h)return!0;e=this._blx-this._tlx;c=this._bly-this._tly;h=e*e+c*c;l=e*f+c*g;c=e*a+c*b;x=1/(h*m-l*l);e=(m*c-l*p)*x;h=(h*p-l*c)*x;return 0<=e&&0<h&&1>e+h}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(a,b,e,c){return this.containsPoint(a,b)||this.containsPoint(e,c)?
|
|
!0:d.segmentIntersectsQuad(a,b,e,c,this)}intersectsQuad(a){var b=a.midX(),e=a.midY();if(this.containsPoint(b,e))return!0;b=this.midX();e=this.midY();if(a.containsPoint(b,e))return!0;b=this._tlx;e=this._tly;const c=this._trx,f=this._try,g=this._brx,h=this._bry,l=this._blx,m=this._bly;return d.segmentIntersectsQuad(b,e,c,f,a)||d.segmentIntersectsQuad(c,f,g,h,a)||d.segmentIntersectsQuad(g,h,l,m,a)||d.segmentIntersectsQuad(l,m,b,e,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(a,b){const e=this._getAtIndex(a);this._setAtIndex(a,this._getAtIndex(b));this._setAtIndex(b,e)}_getAtIndex(a){switch(a){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(a,
|
|
b){b=+b;switch(a){case 0:this._tlx=b;break;case 1:this._tly=b;break;case 2:this._trx=b;break;case 3:this._try=b;break;case 4:this._brx=b;break;case 5:this._bry=b;break;case 6:this._blx=b;break;case 7:this._bly=b;break;default:throw new RangeError("invalid quad point index");}}}}
|
|
{"use strict";const d=self.C3,a=[0,0,1,0,1,1,0,1],b=d.New(d.Quad);d.CollisionPoly=class extends d.DefendedBase{constructor(e,c=!0){super();e||(e=a);this._ptsArr=Float64Array.from(e);this._bbox=new d.Rect;this._isBboxChanged=!0;this._enabled=c}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(e){this._ptsArr.length===e.length?this._ptsArr.set(e):this._ptsArr=Float64Array.from(e);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(a)}copy(e){this.setPoints(e._ptsArr)}setBboxChanged(){this._isBboxChanged=
|
|
!0}_updateBbox(){if(this._isBboxChanged){var e=this._ptsArr,c=e[0],f=e[1],g=c,h=f;for(let l=0,m=e.length;l<m;l+=2){const p=e[l],x=e[l+1];p<c&&(c=p);p>g&&(g=p);x<f&&(f=x);x>h&&(h=x)}this._bbox.set(c,f,g,h);this._isBboxChanged=!1}}setFromRect(e,c,f){let g=this._ptsArr;8!==g.length&&(this._ptsArr=g=new Float64Array(8));g[0]=e.getLeft()-c;g[1]=e.getTop()-f;g[2]=e.getRight()-c;g[3]=e.getTop()-f;g[4]=e.getRight()-c;g[5]=e.getBottom()-f;g[6]=e.getLeft()-c;g[7]=e.getBottom()-f;this._bbox.copy(e);0===c&&0===
|
|
f||this._bbox.offset(-c,-f);this._isBboxChanged=!1}setFromQuad(e,c,f){b.copy(e);b.offset(c,f);this.setPoints(b.toArray());this._isBboxChanged=!0}transform(e,c,f){let g=0,h=1;0!==f&&(g=Math.sin(f),h=Math.cos(f));this.transformPrecalc(e,c,g,h)}transformPrecalc(e,c,f,g){const h=this._ptsArr;for(let l=0,m=h.length;l<m;l+=2){const p=l+1,x=h[l]*e,v=h[p]*c;h[l]=x*g-v*f;h[p]=v*g+x*f}this._isBboxChanged=!0}offset(e,c){const f=this._ptsArr;for(let g=0,h=f.length;g<h;g+=2)f[g]+=e,f[g+1]+=c}containsPoint(e,c){const f=
|
|
this._ptsArr;if(e===f[0]&&c===f[1])return!0;this._updateBbox();var g=this._bbox;const h=g.getLeft()-110,l=g.getTop()-101,m=g.getRight()+131;g=g.getBottom()+120;let p,x,v,r,q,y,u,t;h<e?(p=h,v=e):(p=e,v=h);l<c?(x=l,r=c):(x=c,r=l);m<e?(q=m,u=e):(q=e,u=m);g<c?(y=g,t=c):(y=c,t=g);let A=0,z=0;for(let E=0,J=f.length;E<J;E+=2){var C=(E+2)%J;const G=f[E],I=f[E+1],L=f[C];C=f[C+1];d.segmentsIntersectPreCalc(h,l,e,c,p,v,x,r,G,I,L,C)&&++A;d.segmentsIntersectPreCalc(m,g,e,c,q,u,y,t,G,I,L,C)&&++z}return 1===A%2||
|
|
1===z%2}intersectsPoly(e,c,f){const g=e._ptsArr,h=this._ptsArr;if(this.containsPoint(g[0]+c,g[1]+f)||e.containsPoint(h[0]-c,h[1]-f))return!0;for(let m=0,p=h.length;m<p;m+=2){var l=(m+2)%p;e=h[m];const x=h[m+1],v=h[l];l=h[l+1];let r,q,y,u;e<v?(r=e,y=v):(r=v,y=e);x<l?(q=x,u=l):(q=l,u=x);for(let t=0,A=g.length;t<A;t+=2){const z=(t+2)%A;if(d.segmentsIntersectPreCalc(e,x,v,l,r,y,q,u,g[t]+c,g[t+1]+f,g[z]+c,g[z+1]+f))return!0}}return!1}intersectsSegment(e,c,f,g,h,l){if(this.containsPoint(f-e,g-c)||this.containsPoint(h-
|
|
e,l-c))return!0;let m,p,x,v;f<h?(m=f,x=h):(m=h,x=f);g<l?(p=g,v=l):(p=l,v=g);const r=this._ptsArr;for(let q=0,y=r.length;q<y;q+=2){const u=(q+2)%y;if(d.segmentsIntersectPreCalc(f,g,h,l,m,x,p,v,r[q]+e,r[q+1]+c,r[u]+e,r[u+1]+c))return!0}return!1}mirror(e){const c=this._ptsArr;for(let f=0,g=c.length;f<g;f+=2)c[f]=2*e-c[f];this._isBboxChanged=!0}flip(e){const c=this._ptsArr;for(let f=0,g=c.length;f<g;f+=2){const h=f+1;c[h]=2*e-c[h]}this._isBboxChanged=!0}diag(){const e=this._ptsArr;for(let c=0,f=e.length;c<
|
|
f;c+=2){const g=c+1,h=e[c];e[c]=e[g];e[g]=h}this._isBboxChanged=!0}GetMidX(){const e=this._ptsArr;let c=0;for(let f=0,g=e.length;f<g;f+=2)c+=e[f];return c/this.pointCount()}GetMidY(){const e=this._ptsArr;let c=0;for(let f=0,g=e.length;f<g;f+=2)c+=e[f+1];return c/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}}
|
|
{"use strict";const d=self.C3;d.PairMap=class extends d.DefendedBase{constructor(a){super();this._firstMap=new Map;if(a)for(const [b,e,c]of a)this.Set(b,e,c)}Release(){this.Clear();this._firstMap=null}Clear(){const a=this._firstMap;for(const b of a.values())b.clear();a.clear()}Set(a,b,e){const c=this._firstMap;let f=c.get(a);f||(f=new Map,c.set(a,f));f.set(b,e)}Get(a,b){return(a=this._firstMap.get(a))?a.get(b):a}Has(a,b){return(a=this._firstMap.get(a))?a.has(b):!1}Delete(a,b){const e=this._firstMap,
|
|
c=e.get(a);if(!c)return!1;(b=c.delete(b))&&0===c.size&&e.delete(a);return b}DeleteEither(a){const b=this._firstMap,e=b.get(a);e&&(e.clear(),b.delete(a));for(const [c,f]of b.entries())f.delete(a)&&0===f.size&&b.delete(c)}GetSize(){let a=0;for(const b of this._firstMap.values())a+=b.size;return a}*values(){for(const a of this._firstMap.values())yield*a.values()}*keyPairs(){for(const [a,b]of this._firstMap.entries())for(const e of b.keys())yield[a,e]}*entries(){for(const [a,b]of this._firstMap.entries())for(const [e,
|
|
c]of b.entries())yield[a,e,c]}}}
|
|
{"use strict";const d=self.C3;d.ArraySet=class extends d.DefendedBase{constructor(){super();this._set=new Set;this._arr=[];this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear();d.clearArray(this._arr);this._needToRebuildArray=!1}Add(a){this._set.has(a)||(this._set.add(a),this._needToRebuildArray||this._arr.push(a))}Has(a){return this._set.has(a)}Delete(a){this._set.delete(a)&&(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 a=this._arr;d.clearArray(a);for(const b of this._set)a.push(b)}}}
|
|
{"use strict";const d=new Map,a=new Map,b=new Map,e=new Map,c=new Map,f=new Map;f.set("linear","noease");f.set("default","noease");self.Ease=class v{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(r,...q){this._CreateEaseMap();b.has(r)||b.set(r,new Map);r=[...b.get(r).keys()];r.sort();return[...a.keys()].concat(r).filter(y=>!q.includes(y))}static GetRuntimeEaseNames(){this._CreateEaseMap();const r=[...e.keys()];r.sort();return[...a.keys()].concat(r)}static IsNamePredefined(r){this._CreateEaseMap();
|
|
return[...a.keys()].includes(r)}static _GetEase(r){const q=f.get(r);if(q)return d.get(q);if(v.IsNamePredefined(r))return d.get(r);if(c.has(r))return c.get(r)}static GetEditorEase(r,q){this._CreateEaseMap();const y=v._GetEase(r);return y?y:b.get(q).get(r)}static GetRuntimeEase(r){this._CreateEaseMap();const q=v._GetEase(r);return q?q:e.get(r)}static GetEaseFromIndex(r){this._CreateEaseMap();return this.GetRuntimeEaseNames()[r]}static GetIndexForEase(r,q){this._CreateEaseMap();return this.GetEditorEaseNames(q).indexOf(r)}static _CreateEaseMap(){0===
|
|
d.size&&(this._AddPredifinedEase("default",()=>{}),this._AddPredifinedEase("noease",this.NoEase),this._AddPredifinedEase("easeinsine",this.EaseInSine),this._AddPredifinedEase("easeoutsine",this.EaseOutSine),this._AddPredifinedEase("easeinoutsine",this.EaseInOutSine),this._AddPredifinedEase("easeinelastic",this.EaseInElastic),this._AddPredifinedEase("easeoutelastic",this.EaseOutElastic),this._AddPredifinedEase("easeinoutelastic",this.EaseInOutElastic),this._AddPredifinedEase("easeinback",this.EaseInBack),
|
|
this._AddPredifinedEase("easeoutback",this.EaseOutBack),this._AddPredifinedEase("easeinoutback",this.EaseInOutBack),this._AddPredifinedEase("easeinbounce",this.EaseInBounce),this._AddPredifinedEase("easeoutbounce",this.EaseOutBounce),this._AddPredifinedEase("easeinoutbounce",this.EaseInOutBounce),this._AddPredifinedEase("easeincubic",this.EaseInCubic),this._AddPredifinedEase("easeoutcubic",this.EaseOutCubic),this._AddPredifinedEase("easeinoutcubic",this.EaseInOutCubic),this._AddPredifinedEase("easeinquad",
|
|
this.EaseInQuad),this._AddPredifinedEase("easeoutquad",this.EaseOutQuad),this._AddPredifinedEase("easeinoutquad",this.EaseInOutQuad),this._AddPredifinedEase("easeinquart",this.EaseInQuart),this._AddPredifinedEase("easeoutquart",this.EaseOutQuart),this._AddPredifinedEase("easeinoutquart",this.EaseInOutQuart),this._AddPredifinedEase("easeinquint",this.EaseInQuint),this._AddPredifinedEase("easeoutquint",this.EaseOutQuint),this._AddPredifinedEase("easeinoutquint",this.EaseInOutQuint),this._AddPredifinedEase("easeincirc",
|
|
this.EaseInCirc),this._AddPredifinedEase("easeoutcirc",this.EaseOutCirc),this._AddPredifinedEase("easeinoutcirc",this.EaseInOutCirc),this._AddPredifinedEase("easeinexpo",this.EaseInExpo),this._AddPredifinedEase("easeoutexpo",this.EaseOutExpo),this._AddPredifinedEase("easeinoutexpo",this.EaseInOutExpo),this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier),this._AddPrivateCustomEase("spline",this.EaseSpline))}static _AddPredifinedEase(r,q){v._AddEase(r,q,"predefined")}static _AddPrivateCustomEase(r,
|
|
q){v._AddEase(r,q,"private")}static AddCustomEase(r,q,y){this._CreateEaseMap();v._AddEase(r,q,"custom",y)}static RemoveCustomEase(r,q){this.IsNamePredefined(r)||[...c.keys()].includes(r)||(q=b.get(q))&&q.delete(r)}static _AddEase(r,q,y,u){switch(y){case "predefined":d.set(r,q);a.set(r,q);break;case "custom":u?(b.has(u)||b.set(u,new Map),b.get(u).set(r,q)):e.set(r,q);break;case "private":d.set(r,q);c.set(r,q);break;default:throw Error("unexpected ease mode");}}static NoEase(r,q,y,u){return y*r/u+q}static EaseInQuad(r,
|
|
q,y,u){return y*(r/=u)*r+q}static EaseOutQuad(r,q,y,u){return-y*(r/=u)*(r-2)+q}static EaseInOutQuad(r,q,y,u){return 1>(r/=u/2)?y/2*r*r+q:-y/2*(--r*(r-2)-1)+q}static EaseInCubic(r,q,y,u){return y*(r/=u)*r*r+q}static EaseOutCubic(r,q,y,u){return y*((r=r/u-1)*r*r+1)+q}static EaseInOutCubic(r,q,y,u){return 1>(r/=u/2)?y/2*r*r*r+q:y/2*((r-=2)*r*r+2)+q}static EaseInQuart(r,q,y,u){return y*(r/=u)*r*r*r+q}static EaseOutQuart(r,q,y,u){return-y*((r=r/u-1)*r*r*r-1)+q}static EaseInOutQuart(r,q,y,u){return 1>(r/=
|
|
u/2)?y/2*r*r*r*r+q:-y/2*((r-=2)*r*r*r-2)+q}static EaseInQuint(r,q,y,u){return y*(r/=u)*r*r*r*r+q}static EaseOutQuint(r,q,y,u){return y*((r=r/u-1)*r*r*r*r+1)+q}static EaseInOutQuint(r,q,y,u){return 1>(r/=u/2)?y/2*r*r*r*r*r+q:y/2*((r-=2)*r*r*r*r+2)+q}static EaseInSine(r,q,y,u){return-y*Math.cos(r/u*(Math.PI/2))+y+q}static EaseOutSine(r,q,y,u){return y*Math.sin(r/u*(Math.PI/2))+q}static EaseInOutSine(r,q,y,u){return-y/2*(Math.cos(Math.PI*r/u)-1)+q}static EaseInExpo(r,q,y,u){return 0===r?q:y*Math.pow(2,
|
|
10*(r/u-1))+q}static EaseOutExpo(r,q,y,u){return r===u?q+y:y*(-Math.pow(2,-10*r/u)+1)+q}static EaseInOutExpo(r,q,y,u){return 0===r?q:r===u?q+y:1>(r/=u/2)?y/2*Math.pow(2,10*(r-1))+q:y/2*(-Math.pow(2,-10*--r)+2)+q}static EaseInCirc(r,q,y,u){return-y*(Math.sqrt(1-(r/=u)*r)-1)+q}static EaseOutCirc(r,q,y,u){return y*Math.sqrt(1-(r=r/u-1)*r)+q}static EaseInOutCirc(r,q,y,u){return 1>(r/=u/2)?-y/2*(Math.sqrt(1-r*r)-1)+q:y/2*(Math.sqrt(1-(r-=2)*r)+1)+q}static EaseInElastic(r,q,y,u){let t=0,A=y;if(0===r)return q;
|
|
if(1===(r/=u))return q+y;t||(t=.3*u);A<Math.abs(y)?(A=y,y=t/4):y=t/(2*Math.PI)*Math.asin(y/A);return-(A*Math.pow(2,10*--r)*Math.sin(2*(r*u-y)*Math.PI/t))+q}static EaseOutElastic(r,q,y,u){let t,A=0,z=y;if(0===r)return q;if(1===(r/=u))return q+y;A||(A=.3*u);z<Math.abs(y)?(z=y,t=A/4):t=A/(2*Math.PI)*Math.asin(y/z);return z*Math.pow(2,-10*r)*Math.sin(2*(r*u-t)*Math.PI/A)+y+q}static EaseInOutElastic(r,q,y,u){let t,A=0,z=y;if(0===r)return q;if(2===(r/=u/2))return q+y;A||(A=.3*u*1.5);z<Math.abs(y)?(z=y,
|
|
t=A/4):t=A/(2*Math.PI)*Math.asin(y/z);return 1>r?-.5*z*Math.pow(2,10*--r)*Math.sin(2*(r*u-t)*Math.PI/A)+q:z*Math.pow(2,-10*--r)*Math.sin(2*(r*u-t)*Math.PI/A)*.5+y+q}static EaseInBack(r,q,y,u,t){void 0===t&&(t=1.70158);return y*(r/=u)*r*((t+1)*r-t)+q}static EaseOutBack(r,q,y,u,t){void 0===t&&(t=1.70158);return y*((r=r/u-1)*r*((t+1)*r+t)+1)+q}static EaseInOutBack(r,q,y,u,t){void 0===t&&(t=1.70158);return 1>(r/=u/2)?y/2*r*r*(((t*=1.525)+1)*r-t)+q:y/2*((r-=2)*r*(((t*=1.525)+1)*r+t)+2)+q}static EaseInBounce(r,
|
|
q,y,u){return y-v.EaseOutBounce(u-r,0,y,u)+q}static EaseOutBounce(r,q,y,u){return(r/=u)<1/2.75?7.5625*y*r*r+q:r<2/2.75?y*(7.5625*(r-=1.5/2.75)*r+.75)+q:r<2.5/2.75?y*(7.5625*(r-=2.25/2.75)*r+.9375)+q:y*(7.5625*(r-=2.625/2.75)*r+.984375)+q}static EaseInOutBounce(r,q,y,u){return r<u/2?.5*v.EaseInBounce(2*r,0,y,u)+q:.5*v.EaseOutBounce(2*r-u,0,y,u)+.5*y+q}static EaseCubicBezier(r,q,y,u,t){return q+3*r*(y-q)+3*r**2*(q+u-2*y)+r**3*(t-q+3*y-3*u)}static EaseSpline(r,q,y,u,t,A,z,C,E,J){if(u===t&&A===z)return r;
|
|
r=x(r,q,u,A,C,J);q=g(y,t,z,E);u=h(y,t,z,E);y=l(y,t,z,E);return m(r,q,u,y)}static GetBezierSamples(r,q,y,u){const t=[],A=g(r,q,y,u),z=h(r,q,y,u);r=l(r,q,y,u);for(q=0;11>q;++q)y=m(.1*q,A,z,r),t.push(y);return t}};const g=(v,r,q,y)=>y-3*q+3*r-v,h=(v,r,q,y)=>3*q-6*r+3*v,l=(v,r,q,y)=>3*(r-v),m=(v,r,q,y)=>((r*v+q)*v+y)*v,p=(v,r,q,y)=>3*r*v*v+2*q*v+y,x=(v,r,q,y,u,t)=>{if(1==v)return 1;for(var A=0,z=1,C=t[z];10!=z&&C<=v;)z++,C=t[z],A+=.1;z--;C=t[z];t=A+(v-C)/(t[z+1]-C)*.1;z=g(r,q,y,u);C=h(r,q,y,u);r=l(r,
|
|
q,y,u);q=p(t,z,C,r);if(0!==q)if(.02<=q)for(A=0;4>A;++A)q=m(t,z,C,r)-v,y=p(t,z,C,r),t-=q/y;else{q=A;A+=.1;y=0;let E;do t=q+(A-q)/2,u=m(t,z,C,r)-v,0<u?A=t:q=t,u=1E-7<Math.abs(u),E=10>++y;while(u&&E)}return t}}
|
|
{"use strict";const d=self.C3;function a(b){d.IsString(b)}d.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){d.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(b=Math.random()*this.GetTotalWeight()){let e=0;for(const [c,f]of this._items)if(e+=c,b<e)return f;return 0}AddItem(b,e){a(e);this._totalWeight+=b;this._items.push([b,e])}RemoveItem(b,e){a(e);const c=0===b;for(let f=0;f<this._items.length;f++){const g=
|
|
this._items[f],h=g[1]===e;if((c||g[0]===b)&&h){this._items.splice(f,1);this._totalWeight-=g[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(b){const e=new d.ProbabilityTable;b=JSON.parse(b);for(const c of b)e.AddItem(c[0],c[1]);return e}}}"use strict";
|
|
self.C3.Event=class{constructor(d,a){this.type=d;this.cancelable=!!a;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 d=self.C3;d.Event.Handler=class extends d.DefendedBase{constructor(a){super();this._type=a;this._captureListeners=[];this._captureListenersSet=new Set;this._listeners=[];this._listenersSet=new Set;this._fireDepth=0;this._queueAddListeners=[];this._queueRemoveCaptureListeners=[];this._queueRemoveListeners=[]}Release(){0<this._fireDepth||(d.clearArray(this._captureListeners),this._captureListenersSet.clear(),d.clearArray(this._listeners),this._listenersSet.clear(),d.clearArray(this._queueAddListeners),
|
|
d.clearArray(this._queueRemoveCaptureListeners),d.clearArray(this._queueRemoveListeners),d.Release(this))}_AddListener(a,b){this._IsFiring()?this._queueAddListeners.push([a,b]):b?this._captureListenersSet.has(a)||(this._captureListeners.push(a),this._captureListenersSet.add(a)):this._listenersSet.has(a)||(this._listeners.push(a),this._listenersSet.add(a))}_RemoveListener(a,b){this._IsFiring()?b?this._queueRemoveCaptureListeners.push(a):this._queueRemoveListeners.push(a):b?this._captureListenersSet.has(a)&&
|
|
(this._captureListenersSet.delete(a),d.arrayFindRemove(this._captureListeners,a)):this._listenersSet.has(a)&&(this._listenersSet.delete(a),d.arrayFindRemove(this._listeners,a))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){for(var a of this._queueAddListeners)this._AddListener(...a);d.clearArray(this._queueAddListeners);for(var b of this._queueRemoveListeners)this._listenersSet.delete(b);for(const e of this._queueRemoveCaptureListeners)this._captureListenersSet.delete(e);
|
|
a=new Set(this._queueRemoveListeners);b=new Set(this._queueRemoveCaptureListeners);d.arrayRemoveAllInSet(this._listeners,a);d.arrayRemoveAllInSet(this._captureListeners,b);d.clearArray(this._queueRemoveCaptureListeners);d.clearArray(this._queueRemoveListeners)}_FireCancellable(a){this._IncreaseFireDepth();let b=!1;for(let e=0,c=this._captureListeners.length;e<c;++e)if(this._captureListeners[e](a),a.propagationStopped){b=!0;break}if(!b)for(let e=0,c=this._listeners.length;e<c&&(this._listeners[e](a),
|
|
!a.propagationStopped);++e);this._DecreaseFireDepth();return!a.defaultPrevented}_FireNonCancellable(a){this._IncreaseFireDepth();for(let b=0,e=this._captureListeners.length;b<e;++b)this._captureListeners[b](a);for(let b=0,e=this._listeners.length;b<e;++b)this._listeners[b](a);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&(this._queueAddListeners.length||this._queueRemoveCaptureListeners.length||this._queueRemoveListeners.length)&&
|
|
this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(a){a?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(a){let b=[];for(let e=0,c=this._captureListeners.length;e<c;++e){let f=this._captureListeners[e];b.push(d.Asyncify(()=>f(a)))}for(let e=0,c=this._listeners.length;e<c;++e){let f=this._listeners[e];b.push(d.Asyncify(()=>f(a)))}return Promise.all(b).then(()=>!a.defaultPrevented)}_FireAndWait_AsyncOptional(a){const b=[];this._IncreaseFireDepth();for(let c=0,f=this._captureListeners.length;c<
|
|
f;++c){var e=this._captureListeners[c](a);e instanceof Promise&&b.push(e)}for(let c=0,f=this._listeners.length;c<f;++c)e=this._listeners[c](a),e instanceof Promise&&b.push(e);this._DecreaseFireDepth();return b.length?Promise.all(b).then(()=>!a.defaultPrevented):!a.defaultPrevented}async _FireAndWaitAsync(a){return await this._FireAndWait_AsyncOptional(a)}async _FireAndWaitAsyncSequential(a){this._IncreaseFireDepth();for(let e=0,c=this._captureListeners.length;e<c;++e){var b=this._captureListeners[e](a);
|
|
b instanceof Promise&&await b}for(let e=0,c=this._listeners.length;e<c;++e)b=this._listeners[e](a),b instanceof Promise&&await b;this._DecreaseFireDepth();return!a.defaultPrevented}*_FireAsGenerator(a){this._IncreaseFireDepth();for(let e=0,c=this._captureListeners.length;e<c;++e){var b=this._captureListeners[e](a);d.IsIterator(b)&&(yield*b)}for(let e=0,c=this._listeners.length;e<c;++e)b=this._listeners[e](a),d.IsIterator(b)&&(yield*b);this._DecreaseFireDepth()}}}
|
|
{"use strict";const d=self.C3;d.Event.Dispatcher=class extends d.DefendedBase{constructor(){super();this._eventHandlers=new Map;this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw Error("already released");this.ClearEvents();this._dispatcherWasReleased=!0;d.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let a of this._eventHandlers.values())a.Release();this._eventHandlers.clear()}_GetHandlerByType(a,b){let e=this._eventHandlers.get(a);return e?
|
|
e:b?(e=d.New(d.Event.Handler,a),this._eventHandlers.set(a,e),e):null}HasAnyHandlerFor(a){return this._eventHandlers.has(a)}addEventListener(a,b,e){this._GetHandlerByType(a,!0)._AddListener(b,!!e)}removeEventListener(a,b,e){let c=this._GetHandlerByType(a,!1);c&&(c._RemoveListener(b,!!e),c._IsEmpty()&&this._eventHandlers.delete(a))}dispatchEvent(a){const b=this._GetHandlerByType(a.type,!1);return b?a.cancelable?b._FireCancellable(a):b._FireNonCancellable(a):!0}dispatchEventAsync(a){const b=this._GetHandlerByType(a.type,
|
|
!1);if(!b)return Promise.resolve(!0);a.isAsync=!0;return b._FireAsync(a)}async dispatchEventAndClearAsync(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return!0;this._eventHandlers.delete(a.type);a.isAsync=!0;a=await b._FireAsync(a);b.Release();return a}async dispatchEventAndWaitAsync(a){const b=this._GetHandlerByType(a.type,!1);return b?await b._FireAndWaitAsync(a):!0}dispatchEventAndWait_AsyncOptional(a){const b=this._GetHandlerByType(a.type,!1);return b?b._FireAndWait_AsyncOptional(a):!0}async dispatchEventAndWaitAsyncSequential(a){const b=
|
|
this._GetHandlerByType(a.type,!1);return b?await b._FireAndWaitAsyncSequential(a):!0}dispatchGeneratorEvent(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return null;if(a.cancelable)throw Error("not supported");return b._FireAsGenerator(a)}SetDelayRemoveEventsEnabled(a){for(const b of this._eventHandlers.values())b.SetDelayRemoveEventsEnabled(a)}}}
|
|
{"use strict";const d=self.C3,a="undefined"!==typeof requestIdleCallback;let b=[],e=-1,c=0;function f(m){e=a&&0===c?requestIdleCallback(g,{timeout:35}):setTimeout(g,0<c?1:m)}function g(m){e=-1;if(b.length){var p=performance.now(),x=0;do{h(b.shift());var v=performance.now();++x;var r=(v-p)/x*1.1}while(b.length&&(a&&0===c&&"undefined"!==typeof m?r<m.timeRemaining():12>v-p+r));-1===e&&b.length&&f(Math.max(16-(v-p),4))}}function h(m){let p;try{p=m.func()}catch(x){m.reject(x);return}m.resolve(p)}let l=
|
|
d.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.");d.Asyncify=function(m){let p=null;d.isDebug&&(p=d.GetCallStack());return new Promise((x,v)=>{b.push({func:m,resolve:x,reject:v,stack:p});l?h(b.pop()):-1===e&&f(16)})};d.Asyncify.SetHighThroughputMode=function(m){if(m)++c;else if(--c,0>c)throw Error("already turned off high throughput mode");}}
|
|
{"use strict";const d=self.C3;let a=-1;function b(){a=-1}d.FastGetDateNow=function(){-1===a&&(a=Date.now(),self.setTimeout(b,16));return a};let e=-1,c=-1,f=new Set;function g(){c=e=-1;let h=Date.now();for(let l of f)if(l._CheckTimeout(h)){let m=l._GetDeadline();if(-1===c||m<c)c=m}else f.delete(l);-1!==c&&(e=self.setTimeout(g,Math.max(c-h+100,1E3)))}d.IdleTimeout=class{constructor(h,l){this._callback=h;this._timeout=1E3*l;this._deadline=0;this._isActive=!1}Reset(){let h=d.FastGetDateNow();this._deadline=
|
|
h+this._timeout;this._isActive||(f.add(this),this._isActive=!0);-1===e?(c=this._deadline,e=self.setTimeout(g,this._timeout+100)):this._deadline<c&&c>h+1E3&&(self.clearTimeout(e),c=this._deadline,e=self.setTimeout(g,this._timeout+100))}_CheckTimeout(h){return h>=this._deadline?this._callback()?(this._deadline=h+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(f.delete(this),this._isActive=!1,0===f.size&&-1!==e&&(self.clearTimeout(e),c=e=-1))}Release(){this.Cancel();
|
|
this._callback=null}}}
|
|
{"use strict";const d=self.C3;d.Disposable=class a{constructor(b){this._disposed=!1;this._disposeAction=b}Dispose(){this._disposed||(this._disposed=!0,this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(b){return new a(()=>b.Release())}static From(b,e,c,f,g){if("undefined"===typeof f||null===f)f=!1;else if("boolean"!==typeof f&&"object"!==typeof f)throw new TypeError("invalid event listener options");g&&
|
|
(c=c.bind(g));if(e.includes(" ")){e=e.split(" ");g=new d.CompositeDisposable;for(let h of e)b.addEventListener(h,c,f),g.Add(d.New(d.Disposable,()=>b.removeEventListener(h,c,f)));return g}b.addEventListener(e,c,f);return d.New(d.Disposable,()=>b.removeEventListener(e,c,f))}};d.StubDisposable=class extends d.Disposable{SetAction(a){this._disposeAction=a}};d.CompositeDisposable=class extends d.Disposable{constructor(...a){super();this._disposables=new Set;for(let b of a)this.Add(b)}Add(...a){if(this._disposed)throw Error("already disposed");
|
|
for(let b of a)this._disposables.add(b)}Remove(a){if(this._disposed)throw Error("already disposed");this._disposables.delete(a)}RemoveAll(){if(this._disposed)throw Error("already disposed");if(this._disposables){for(let a of this._disposables)a.Dispose();this._disposables.clear()}}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw Error("already disposed");this._disposed=!0;for(let a of this._disposables)a.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}}
|
|
{"use strict";const d=self.C3;d.KahanSum=class extends d.DefendedBase{constructor(){super();this._sum=this._t=this._y=this._c=0}Add(a){this._y=+a-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(a){this._sum-=+a}Get(){return this._sum}Reset(){this._sum=this._t=this._y=this._c=0}Set(a){this._t=this._y=this._c=0;this._sum=+a}Release(){}}}
|
|
{"use strict";const d=self.C3,a={RBnode:function(b){this.tree=b;this.left=this.right=this.tree.sentinel;this.parent=null;this.color=!1;this.key=null},RedBlackSet:function(b){this.size=0;this.sentinel=new a.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=b||this.default_compare}};a.RedBlackSet.prototype.default_compare=function(b,e){return b<e?-1:e<b?1:0};a.RedBlackSet.prototype.clone=function(){var b=new a.RedBlackSet(this.compare);b.insertAll(this);
|
|
return b};a.RedBlackSet.prototype.clear=function(){this.size=0;this.sentinel=new a.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel};a.RedBlackSet.prototype.leftRotate=function(b){var e=b.right;b.right=e.left;e.left!=this.sentinel&&(e.left.parent=b);e.parent=b.parent;b.parent==this.sentinel?this.root=e:b==b.parent.left?b.parent.left=e:b.parent.right=e;e.left=b;b.parent=e};a.RedBlackSet.prototype.rightRotate=function(b){var e=b.left;b.left=e.right;e.right!=
|
|
this.sentinel&&(e.right.parent=b);e.parent=b.parent;b.parent==this.sentinel?this.root=e:b==b.parent.right?b.parent.right=e:b.parent.left=e;e.right=b;b.parent=e};a.RedBlackSet.prototype.insert=function(b){if(this.contains(b))this.get_(b).key=b;else{var e=new a.RBnode(this);e.key=b;b=this.sentinel;for(var c=this.root;c!=this.sentinel;)b=c,c=0>this.compare(e.key,c.key)?c.left:c.right;e.parent=b;b==this.sentinel?this.root=e:0>this.compare(e.key,b.key)?b.left=e:b.right=e;e.left=this.sentinel;e.right=this.sentinel;
|
|
e.color=!0;this.insertFixup(e);this.size++}};a.RedBlackSet.prototype.insertFixup=function(b){for(;b!=this.sentinel&&b!=this.root&&1==b.parent.color;)if(b.parent==b.parent.parent.left){var e=b.parent.parent.right;1==e.color?(b.parent.color=!1,e.color=!1,b.parent.parent.color=!0,b=b.parent.parent):(b==b.parent.right&&(b=b.parent,this.leftRotate(b)),b.parent.color=!1,b.parent.parent.color=!0,b.parent.parent!=this.sentinel&&this.rightRotate(b.parent.parent))}else e=b.parent.parent.left,1==e.color?(b.parent.color=
|
|
!1,e.color=!1,b.parent.parent.color=!0,b=b.parent.parent):(b==b.parent.left&&(b=b.parent,this.rightRotate(b)),b.parent.color=!1,b.parent.parent.color=!0,b.parent.parent!=this.sentinel&&this.leftRotate(b.parent.parent));this.root.color=!1};a.RedBlackSet.prototype.delete_=function(b){var e=b.left==this.sentinel||b.right==this.sentinel?b:this.successor_(b);var c=e.left!=this.sentinel?e.left:e.right;c.parent=e.parent;e.parent==this.sentinel?this.root=c:e==e.parent.left?e.parent.left=c:e.parent.right=
|
|
c;e!=b&&(b.key=e.key);0==e.color&&this.deleteFixup(c);this.size--};a.RedBlackSet.prototype.deleteFixup=function(b){for(;b!=this.root&&0==b.color;)if(b==b.parent.left){var e=b.parent.right;1==e.color&&(e.color=!1,b.parent.color=!0,this.leftRotate(b.parent),e=b.parent.right);0==e.left.color&&0==e.right.color?(e.color=!0,b=b.parent):(0==e.right.color&&(e.left.color=!1,e.color=!0,this.rightRotate(e),e=b.parent.right),e.color=b.parent.color,b.parent.color=!1,e.right.color=!1,this.leftRotate(b.parent),
|
|
b=this.root)}else e=b.parent.left,1==e.color&&(e.color=!1,b.parent.color=!0,this.rightRotate(b.parent),e=b.parent.left),0==e.right.color&&0==e.left.color?(e.color=!0,b=b.parent):(0==e.left.color&&(e.right.color=!1,e.color=!0,this.leftRotate(e),e=b.parent.left),e.color=b.parent.color,b.parent.color=!1,e.left.color=!1,this.rightRotate(b.parent),b=this.root);b.color=!1};a.RedBlackSet.prototype.remove=function(b){b=this.get_(b);if(b!=this.sentinel){var e=b.key;this.delete_(b);return e}return null};a.RedBlackSet.prototype.removeSwapped=
|
|
function(b,e){this.remove(e)};a.RedBlackSet.prototype.min=function(b){for(;b.left!=this.sentinel;)b=b.left;return b};a.RedBlackSet.prototype.max=function(b){for(;b.right!=this.sentinel;)b=b.right;return b};a.RedBlackSet.prototype.successor_=function(b){if(b.right!=this.sentinel)return this.min(b.right);for(var e=b.parent;e!=this.sentinel&&b==e.right;)b=e,e=e.parent;return e};a.RedBlackSet.prototype.predeccessor_=function(b){if(b.left!=this.sentinel)return this.max(b.left);for(var e=b.parent;e!=this.sentinel&&
|
|
b==e.left;)b=e,e=e.parent;return e};a.RedBlackSet.prototype.successor=function(b){if(0<this.size){b=this.get_(b);if(b==this.sentinel)return null;if(b.right!=this.sentinel)return this.min(b.right).key;for(var e=b.parent;e!=this.sentinel&&b==e.right;)b=e,e=e.parent;return e!=this.sentinel?e.key:null}return null};a.RedBlackSet.prototype.predecessor=function(b){if(0<this.size){b=this.get_(b);if(b==this.sentinel)return null;if(b.left!=this.sentinel)return this.max(b.left).key;for(var e=b.parent;e!=this.sentinel&&
|
|
b==e.left;)b=e,e=e.parent;return e!=this.sentinel?e.key:null}return null};a.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};a.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key};a.RedBlackSet.prototype.get_=function(b){for(var e=this.root;e!=this.sentinel&&0!=this.compare(e.key,b);)e=0>this.compare(b,e.key)?e.left:e.right;return e};a.RedBlackSet.prototype.contains=function(b){return null!=this.get_(b).key};a.RedBlackSet.prototype.getValues=function(){var b=
|
|
[];this.forEach(function(e){b.push(e)});return b};a.RedBlackSet.prototype.insertAll=function(b){if("array"==a.typeOf(b))for(var e=0;e<b.length;e++)this.insert(b[e]);else if("function"==a.typeOf(b.forEach))b.forEach(this.insert,this);else if("function"==a.typeOf(b.getValues))for(b=b.getValues(),e=0;e<b.length;e++)this.insert(b[e]);else if("object"==a.typeOf(b))for(e in b)this.insert(b[e])};a.RedBlackSet.prototype.removeAll=function(b){if("array"==a.typeOf(b))for(var e=0;e<b.length;e++)this.remove(b[e]);
|
|
else if("function"==a.typeOf(b.forEach))b.forEach(this.removeSwapped,this);else if("function"==a.typeOf(b.getValues))for(b=b.getValues(),e=0;e<b.length;e++)this.remove(b[e]);else if("object"==a.typeOf(b))for(e in b)this.remove(b[e])};a.RedBlackSet.prototype.containsAll=function(b){if("array"==a.typeOf(b)){for(var e=0;e<b.length;e++)if(!this.contains(b[e]))return!1;return!0}if("function"==a.typeOf(b.forEach))return b.every(this.contains,this);if("function"==a.typeOf(b.getValues)){b=b.getValues();for(e=
|
|
0;e<b.length;e++)if(!this.contains(b[e]))return!1;return!0}if("object"==a.typeOf(b)){for(e in b)if(!this.contains(b[e]))return!1;return!0}};a.RedBlackSet.prototype.range=function(b,e){var c=[];this.traverseFromTo(function(f){c.push(f)},b,e);return c};a.RedBlackSet.prototype.traverse=function(b,e){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel&&!b.call(e,c.key,this);)c=this.successor_(c)};a.RedBlackSet.prototype.traverseFrom=function(b,e,c){if(!this.isEmpty())for(e=this.get_(e);e!=
|
|
this.sentinel&&!b.call(c,e.key,this);)e=this.successor_(e)};a.RedBlackSet.prototype.traverseTo=function(b,e,c){if(!this.isEmpty()){var f=this.min(this.root);for(e=this.get_(e);f!=e&&!b.call(c,f.key,this);)f=this.successor_(f)}};a.RedBlackSet.prototype.traverseFromTo=function(b,e,c,f){if(!this.isEmpty())for(e=this.get_(e),c=this.get_(c);e!=c&&!b.call(f,e.key,this);)e=this.successor_(e)};a.RedBlackSet.prototype.traverseBackwards=function(b,e){if(!this.isEmpty())for(var c=this.max(this.root);c!=this.sentinel&&
|
|
!b.call(e,c.key,this);)c=this.predeccessor_(c)};a.RedBlackSet.prototype.forEach=function(b,e){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))b.call(e,c.key,c.key,this)};a.RedBlackSet.prototype.some=function(b,e){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(b.call(e,c.key,c.key,this))return!0;return!1};a.RedBlackSet.prototype.every=function(b,e){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=
|
|
this.successor_(c))if(!b.call(e,c.key,c.key,this))return!1;return!0};a.RedBlackSet.prototype.map=function(b,e){var c=[];if(this.isEmpty())return c;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))c.push(b.call(e,f.key,f.key,this));return c};a.RedBlackSet.prototype.filter=function(b,e){var c=[];if(this.isEmpty())return c;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))b.call(e,f.key,f.key,this)&&c.push(f.key);return c};a.RedBlackSet.prototype.getCount=function(){return this.size};
|
|
a.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};a.RedBlackSet.prototype.isSubsetOf=function(b){var e=a.getCount(b);if(this.getCount()>e)return!1;e=0;if(this.isEmpty())return!0;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.contains.call(b,b,c.key)&&e++;return e==this.getCount()};a.RedBlackSet.prototype.intersection=function(b){var e=new a.RedBlackSet(this.compare);if(this.isEmpty())return e;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))b.contains.call(b,
|
|
c.key,c.key,this)&&e.insert(c.key);return e};d.RedBlackSet=class extends d.DefendedBase{constructor(b){super();this._rbSet=new a.RedBlackSet(b);this._enableQueue=!1;this._queueInsert=new Set;this._queueRemove=new Set}Add(b){this._enableQueue?this._rbSet.contains(b)?this._queueRemove.delete(b):this._queueInsert.add(b):this._rbSet.insert(b)}Remove(b){this._enableQueue?this._rbSet.contains(b)?this._queueRemove.add(b):this._queueInsert.delete(b):this._rbSet.remove(b)}Has(b){return this._enableQueue?this._queueInsert.has(b)?
|
|
!0:!this._queueRemove.has(b)&&this._rbSet.contains(b):this._rbSet.contains(b)}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 b=this._rbSet;return b.min(b.root).key}Shift(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");const b=this.Front();this.Remove(b);return b}SetQueueingEnabled(b){b=!!b;if(this._enableQueue!==b&&(this._enableQueue=b,!b)){for(const e of this._queueRemove)this._rbSet.remove(e);this._queueRemove.clear();for(const e of this._queueInsert)this._rbSet.insert(e);this._queueInsert.clear()}}ForEach(b){this._rbSet.forEach(b)}*values(){if(!this.IsEmpty()){var b=
|
|
this._rbSet;for(let e=b.min(b.root);e!=b.sentinel;e=b.successor_(e))yield e.key}}[Symbol.iterator](){return this.values()}}}
|
|
{"use strict";const d=self.C3;d.PromiseThrottle=class{constructor(a=d.hardwareConcurrency){this._maxParallel=a;this._queue=[];this._activeCount=0}Add(a){return new Promise((b,e)=>{this._queue.push({func:a,resolve:b,reject:e});this._MaybeStartNext()})}_FindInQueue(a){for(let b=0,e=this._queue.length;b<e;++b)if(this._queue[b].func===a)return b;return-1}RemoveAndResolve(a,b){a=this._FindInQueue(a);if(-1===a)throw Error("cannot find promise to resolve");this._queue[a].resolve(b);this._queue.splice(a,
|
|
1)}RemoveAndReject(a,b){a=this._FindInQueue(a);if(-1===a)throw Error("cannot find promise to reject");this._queue[a].reject(b);this._queue.splice(a,1)}async _MaybeStartNext(){if(this._queue.length&&!(this._activeCount>=this._maxParallel)){this._activeCount++;var a=this._queue.shift();try{const b=await a.func();a.resolve(b)}catch(b){a.reject(b)}this._activeCount--;this._MaybeStartNext()}}static async Batch(a,b){const e=[];let c=!1;const f=async h=>{for(;(h=b.pop())&&!c;)try{e.push(await h())}catch(l){throw c=
|
|
!0,l;}},g=[];for(;a--;)g.push(f());await Promise.all(g);return e}}}
|
|
{"use strict";const d=self.C3;d.RateLimiter=class{constructor(a,b,e){this._callback=a;this._interval=b;this._intervalOnBattery=e||2*b;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._canRunImmediate=this._ignoreReset=!1;this._callbackArguments=null}SetCanRunImmediate(a){this._canRunImmediate=!!a}_GetInterval(){return"undefined"!==typeof d.Battery&&d.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...a){if(-1===this._timerId){this._callbackArguments=
|
|
a;a=d.FastGetDateNow();var b=a-this._lastCallTime,e=this._GetInterval();b>=e&&this._canRunImmediate?(this._lastCallTime=a,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(e-b,4))}}_RunCallback(){this._ignoreReset=!0;const a=this._callbackArguments;this._callbackArguments=null;a?this._callback(...a):this._callback();this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=d.FastGetDateNow())}_OnTimer(){this._timerId=
|
|
-1;this._lastCallTime=d.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 d=self.C3;d.SVGRasterManager=class{constructor(){this._images=new Map;this._allowNpotSurfaces=!1;this._redrawCallback=this._releaseResultCallback=this._rasterAtSizeCallback=this._getBaseSizeCallback=null}SetNpotSurfaceAllowed(a){this._allowNpotSurfaces=!!a}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(a){this._getBaseSizeCallback=a}GetBaseSize(a){if(!this._getBaseSizeCallback)throw Error("no get base size callback set");return this._getBaseSizeCallback(a)}SetRasterAtSizeCallback(a){this._rasterAtSizeCallback=
|
|
a}RasterAtSize(a,b,e,c,f,g){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(a,b,e,c,f,g)}SetReleaseResultCallback(a){this._releaseResultCallback=a}ReleaseResult(a){if(!this._releaseResultCallback)throw Error("no release result callback set");this._releaseResultCallback(a)}SetRedrawCallback(a){this._redrawCallback=a}Redraw(){if(!this._redrawCallback)throw Error("no redraw callback set");this._redrawCallback()}AddImage(a){let b=this._images.get(a);
|
|
b||(b=d.New(d.SVGRasterImage,this,a),this._images.set(a,b));b.IncReference();return b}_RemoveImage(a){this._images.delete(a.GetDataSource())}OnTexturesChanged(){for(const a of this._images.values())a.ReleaseRasterizedResult(),a.ForceRasterAgain()}}}
|
|
{"use strict";const d=self.C3;d.SVGRasterImage=class{constructor(a,b){this._manager=a;this._dataSource=b;this._baseHeight=this._baseWidth=this._refCount=0;this._getBaseSizePromise=this._manager.GetBaseSize(b).then(e=>{this._baseWidth=e[0];this._baseHeight=e[1];this._manager.Redraw()}).catch(e=>{console.error("[SVG] Error loading SVG: ",e);this._hadError=!0;this._manager.Redraw()});this._rasterImageHeight=this._rasterImageWidth=this._rasterSurfaceHeight=this._rasterSurfaceWidth=0;this._isRasterizing=
|
|
!1;this._rasterizedResult=null;this._hadError=this._forceRaster=!1}Release(){if(0>=this._refCount)throw Error("already released");this._refCount--;0===this._refCount&&this._Release()}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(a,b,e){if(0!==b&&0!==e&&!this._hadError&&!this._isRasterizing){var c=d.nextHighestPowerOfTwo(Math.ceil(b)),f=d.nextHighestPowerOfTwo(Math.ceil(e)),g=Math.max(c,f);2048<g&&(g=2048/g,b*=g,e*=g,c=Math.min(Math.ceil(c*g),2048),f=Math.min(Math.ceil(f*g),2048));b<c&&e<f&&(e=b/e,c/f>e?(b=f*e,e=f):(b=c,e=c/e));this._manager.IsNpotSurfaceAllowed()&&(c=Math.ceil(b),f=Math.ceil(e));
|
|
c<=this._rasterSurfaceWidth&&f<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=!0,this._rasterSurfaceWidth=c,this._rasterSurfaceHeight=f,a=await this._manager.RasterAtSize(this._dataSource,a,this._rasterSurfaceWidth,this._rasterSurfaceHeight,b,e),this._manager&&(this.ReleaseRasterizedResult(),this._rasterizedResult=a,this._rasterImageWidth=b,this._rasterImageHeight=e,this._forceRaster=this._isRasterizing=!1,this._manager.Redraw()))}}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}}
|
|
{"use strict";const d=self.C3;d.UTF8_BOM="\ufeff";const a=new Set([..."0123456789"]);d.IsNumericChar=function(m){return a.has(m)};const b=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);d.IsWhitespaceChar=function(m){return b.has(m)};d.FilterWhitespace=function(m){return[...m].filter(p=>!d.IsWhitespaceChar(p)).join("")};d.IsStringAllWhitespace=function(m){for(const p of m)if(!d.IsWhitespaceChar(p))return!1;return!0};
|
|
d.IsUnprintableChar=function(m){return 1===m.length&&32>m.charCodeAt(0)};d.FilterUnprintableChars=function(m){return[...m].filter(p=>!d.IsUnprintableChar(p)).join("")};const e=new Set([..."0123456789.+-e"]);d.IsStringNumber=function(m){m=m.trim();if(!m.length)return!1;let p=m.charAt(0);if("-"!==p&&!a.has(p))return!1;for(let x of m)if(!e.has(x))return!1;return!0};d.RemoveTrailingDigits=function(m){let p=m.length;for(;0<p;){let x=m.charAt(p-1);if(!d.IsNumericChar(x))break;--p}return m.substr(0,p)};
|
|
d.IncrementNumberAtEndOf=function(m){let p=d.RemoveTrailingDigits(m);m=(m=m.substr(p.length))?(parseInt(m,10)+1).toString():"2";return p+m};const c=new Map([["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]]);function f(m){return c.get(m)}const g=/[&<>"']/g;d.EscapeHTML=function(m){return m.replace(g,f)};d.EscapeJS=function(m){m=d.ReplaceAll(m,"\\","\\\\");m=d.ReplaceAll(m,'"','\\"');m=d.ReplaceAll(m,"\t","\\t");m=d.ReplaceAll(m,"\r","");return d.ReplaceAll(m,"\n","\\n")};d.EscapeXML=
|
|
function(m){m=d.ReplaceAll(m,"&","&");m=d.ReplaceAll(m,"<","<");m=d.ReplaceAll(m,">",">");return d.ReplaceAll(m,'"',""")};const h=/[-[\]{}()*+?.,\\^$|#\s]/g;d.EscapeRegex=function(m){return m.replace(h,"\\$&")};d.FindAll=function(m,p,x=!1){if(!p)return[];x||(m=m.toLowerCase(),p=p.toLowerCase());x=p.length;var v=0;let r=[];for(;-1<(v=m.indexOf(p,v));)r.push(v),v+=x;return r};d.ReplaceAll=function(m,p,x){return m.replaceAll(p,()=>x)};d.ReplaceAllCaseInsensitive=function(m,p,x){return m.replace(new RegExp(d.EscapeRegex(p),
|
|
"gi"),()=>x)};d.SetElementContent=function(m,p){"string"===typeof p?m.textContent=p:p.isPlainText()?m.textContent=p.toString():(m.innerHTML=p.toHTML(),p instanceof d.BBString&&p.attachLinkHandlers(m))};d.StringLikeEquals=function(m,p){return m instanceof d.HtmlString||m instanceof d.BBString?m.equals(p):p instanceof d.HtmlString||p instanceof d.BBString?p.equals(m):m===p};d.StringSubstitute=function(m,...p){let x=m;for(let v=0,r=p.length;v<r;++v){const q=`{${v}}`;if(!m.includes(q))throw Error(`missing placeholder '${q}' in string substitution`);
|
|
x=x.replace(q,p[v].toString())}return x};d.StringSubstituteAllowMissing=function(m,...p){let x=m,v=-1,r=-1;for(let q=0,y=p.length;q<y;++q){const u=`{${q}}`;m.includes(u)?(r=q,x=x.replace(u,p[q].toString())):-1===v&&(v=q)}if(0<=v&&0<=r&&v<r)throw Error(`missing placeholder '${v}' in string substitution`);return x};d.StringSubstituteMap=function(m,p){for(let [x,v]of Object.entries(p))m=m.replaceAll(x,v.toString());return m};d.SortAZCaseInsensitive=function(m,p){m=m.toLowerCase();p=p.toLowerCase();return m>
|
|
p?1:m<p?-1:0};d.FormatDataSize=function(m,p){p="common."+(p?"dataRates":"dataSizes")+".";const x=self.langSub;if(1024>m)return x(p+"bytes",m);if(1048576>m)return m/=1024,m=10>m?Math.round(10*m)/10:Math.round(m),x(p+"kilobytes",m);if(1073741824>m)return m/=1048576,m=10>m?Math.round(10*m)/10:Math.round(m),x(p+"megabytes",m);if(1099511627776>m)return m/=1073741824,m=10>m?Math.round(10*m)/10:Math.round(m),x(p+"gigabytes",m);m/=1099511627776;m=10>m?Math.round(10*m)/10:Math.round(m);return x(p+"terabytes",
|
|
m)};const l={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};d.FormatTime=function(m,p){p=Object.assign({},l,p);d.Lang.PushContext("common.time");const x=[],v=self.lang,r=self.langPluralSub;if(p.days){var q=Math.floor(m/86400);0<q&&(m-=86400*q,x.push(r(".days",null,q)))}p.hours&&(q=Math.floor(m/3600),0<q||x.length)&&(m-=3600*q,x.push(r(".hours",null,q)));p.minutes&&(q=Math.floor(m/60),0<q||x.length||!p.seconds)&&(m-=60*q,x.push(r(".minutes",null,q)));p.seconds&&x.push(r(".seconds",null,Math.floor(m%
|
|
60)));m=(p.approximate?v(".approx-prefix"):"")+x.join(v(".separator"));d.Lang.PopContext();return m};d.ZeroPad=function(m,p){let x=0>m?"-":"";m=Math.abs(m);m=m.toString();p-=m.length;for(let v=0;v<p;++v)x+="0";return x+m};d.StringToTitleCase=function(m){return m.toLowerCase().replace(/\b\w/g,p=>p.toUpperCase())};d.CompareVersionStrings=function(m,p){m=m.split(".").map(x=>x.trim());p=p.split(".").map(x=>x.trim());d.resizeArray(m,4,"0");d.resizeArray(p,4,"0");m=m.map(x=>parseInt(x,10));p=p.map(x=>parseInt(x,
|
|
10));for(let x=0;4>x;++x){const v=m[x]-p[x];if(0!==v)return 0>v?-1:1}return 0};d.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,m=>{const p=Math.floor(16*Math.random());return("x"===m?p:p&3|8).toString(16)})};d.StringHammingDistance=function(m,p){if(m.length!==p.length)throw Error("strings must be same length");let x=0;for(let v=0,r=m.length;v<r;++v)m.charAt(v)!==p.charAt(v)&&++x;return x};d.StringLevenshteinDistance=function(m,p){if(0===m.length)return p.length;
|
|
if(0===p.length)return m.length;let x,v,r,q;if(m.length>p.length){var y=m;m=p;p=y}q=Array(m.length+1);for(y=0;y<=m.length;y++)q[y]=y;for(y=1;y<=p.length;y++){v=y;for(x=1;x<=m.length;x++)r=p[y-1]===m[x-1]?q[x-1]:Math.min(q[x-1]+1,Math.min(v+1,q[x]+1)),q[x-1]=v,v=r;q[m.length]=v}return q[m.length]}}
|
|
{"use strict";const d=self.C3,a=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"]]]),b=/\[(\/?)([a-zA-Z0-9]+)\]/g,
|
|
e=/\[(\/?)([^\[]*?)\]/g;let c=null,f=0;function g(l,m,p){var x=a.get(p);if(x){if("string"===typeof x){if("a"!==x||m)return"<"+m+x+">";m=parseInt(p.substring(1),10)-1;if(0>m||m>=c.length)throw Error("invalid bbcode link substitution");x=c[m];if("string"===typeof x)return`<a href="${c[m]}">`;if("function"===typeof x)return`<a class="bblink${m}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(x))return l=x[0],x=x[1],m?"</"+l+">":`<${l} class="${x}">`}else return"class"===p?m?"</span>":
|
|
`<span class="bbclass${f++}">`:l}const h=/\n/g;d.BBString=class{constructor(l,m){this._bbstr=m&&m.noEscape?l:d.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(b,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let l=this._bbstr;this._hasAnyBBtags&&(f=0,c=this._linkActions,l=l.replace(b,g),c=null);this._needsLineBreakConversion&&(l=l.replace(h,"<br>"));this._htmlstr=l}return this._htmlstr}attachLinkHandlers(l){if(this._linkActions.length)for(let m=
|
|
0,p=this._linkActions.length;m<p;++m){const x=this._linkActions[m];if("function"!==typeof x)continue;const v=l.querySelector(".bblink"+m);if(!v)throw Error("unable to attach BBString link handler");v.onclick=x}}equals(l){return l instanceof d.HtmlString?this.toHTML()===l.toHTML():l instanceof d.BBString?this._bbstr===l._bbstr:this._bbstr===l}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const l=this._bbstr,m=[];let p=e.lastIndex=0;for(var x;null!==(x=e.exec(l));){var v=x.index;
|
|
if(0<v&&"\\"===l.charAt(v-1))continue;var r=x[0],q=x[1];x=x[2];const y=l.substring(p,v);p=v+r.length;y&&this._fragments.push({text:y,styles:m.slice(0)});if(x)if(q)for(x=x.toLowerCase(),v=m.length-1;0<=v;--v){if(m[v].tag===x){m.splice(v,1);break}}else v=x,r=null,q=x.indexOf("="),-1!==q?(v=x.substring(0,q).toLowerCase(),r=x.substring(q+1)):v=v.toLowerCase(),m.push({tag:v,param:r})}p<l.length&&this._fragments.push({text:l.substring(p),styles:m.slice(0)});for(const y of this._fragments)y.text=this._ProcessBBCodeEscapeSequences(y.text);
|
|
this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(l){l=d.ReplaceAll(l,"\\[","[");return d.ReplaceAll(l,"\\\\","\\")}static StripTags(l){return d.New(d.BBString,l,{noEscape:!0}).toPlainText()}static StripAnyTags(l){return l.replace(e,"")}}}
|
|
{"use strict";const d=self.C3;d.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(a,b){let e=0,c=0,f=0,g=0,h=0;for(const l of a)-1===l.width&&(a=b(l.text,l.styles),l.width=a.width,l.height=a.height,l.fontBoundingBoxAscent=a.fontBoundingBoxAscent||0,l.fontBoundingBoxDescent=a.fontBoundingBoxDescent||0,l.topToAlphabeticDistance=a.topToAlphabeticDistance||0),e+=l.width,c=Math.max(c,l.height),f=Math.max(f,l.fontBoundingBoxAscent),
|
|
g=Math.max(g,l.fontBoundingBoxDescent),h=Math.max(h,l.topToAlphabeticDistance);return{width:e,height:c,fontBoundingBoxAscent:f,fontBoundingBoxDescent:g,topToAlphabeticDistance:h}}_AddLine(a,b,e,c,f,g){this._lines.push({fragments:a,width:b,height:e,fontBoundingBoxAscent:c,fontBoundingBoxDescent:f,topToAlphabeticDistance:g})}WordWrap(a,b,e,c,f){"string"===typeof a&&(a=[{text:a,styles:[]}]);d.clearArray(this._lines);if(!(!a.length||1===a.length&&!a[0].text.length||2>e)){if(1===a.length){var g=a[0];const h=
|
|
g.text;g=g.styles;if(100>=h.length&&!h.includes("\n")){let {width:l,height:m,fontBoundingBoxAscent:p,fontBoundingBoxDescent:x,topToAlphabeticDistance:v}=b(h,g);l+=f;p=p||0;x=x||0;v=v||0;if(l<=e){this._AddLine([{text:h,styles:g,width:l,height:m,fontBoundingBoxAscent:p,fontBoundingBoxDescent:x,topToAlphabeticDistance:v}],l,m,p,x,v);return}}}if("word"===c)c=this._TokeniseWords(a);else{c=[];for(const h of a)d.appendArray(c,[...h.text].map(l=>[{text:l,styles:h.styles}]))}this._WrapText(c,b,e,f)}}_TokeniseWords(a){const b=
|
|
[];let e=[],c=!1;for(const g of a){var f=g.text;a=g.styles;for(const h of f)"\n"===h?(0<e.length&&b.push(e),b.push([{text:"\n",styles:a}]),e=[]):0===e.length?(e.push({text:h,styles:a}),c=d.IsWhitespaceChar(h)):(f=d.IsWhitespaceChar(h),f===c?(f=e[e.length-1],f.styles===a?f.text+=h:e.push({text:h,styles:a})):(b.push(e),e=[],e.push({text:h,styles:a}),c=f))}0<e.length&&b.push(e);return b}_CopyLine(a){return a.map(b=>({text:b.text,styles:b.styles,width:b.width,height:b.height,fontBoundingBoxAscent:b.fontBoundingBoxAscent,
|
|
fontBoundingBoxDescent:b.fontBoundingBoxDescent,topToAlphabeticDistance:b.topToAlphabeticDistance}))}_AddWordToLine(a,b){var e=a.length?a[a.length-1]:null;let c=0;e&&b[0].styles===e.styles&&(e.text+=b[0].text,e.width=-1,e.height=-1,e.fontBoundingBoxAscent=-1,e.fontBoundingBoxDescent=-1,e.topToAlphabeticDistance=-1,c=1);for(e=b.length;c<e;++c){const f=b[c];a.push({text:f.text,styles:f.styles,width:-1,height:-1,fontBoundingBoxAscent:-1,fontBoundingBoxDescent:-1,topToAlphabeticDistance:-1})}}_WrapText(a,
|
|
b,e,c){let f=[],g=0,h=0,l=0,m=0;var p=0;for(const x of a){if(1===x.length&&"\n"===x[0].text){0===h&&(p=b(" ",x[0].styles),h=p.height,l=p.fontBoundingBoxAscent||0,m=p.fontBoundingBoxDescent||0,p=p.topToAlphabeticDistance||0);this._AddLine(f,g,h,l,m,p);f=[];p=m=l=h=g=0;continue}a=this._CopyLine(f);this._AddWordToLine(a,x);const v=this._MeasureLine(a,b),r=v.width;r>=e?(0<f.length&&this._AddLine(f,g,h,l,m,p),f=[],d.IsStringAllWhitespace(x[0].text)?p=m=l=h=g=0:(this._AddWordToLine(f,x),p=this._MeasureLine(f,
|
|
b),g=p.width,h=p.height,l=p.fontBoundingBoxAscent,m=p.fontBoundingBoxDescent,p=p.topToAlphabeticDistance)):(f=a,g=r,h=v.height,l=v.fontBoundingBoxAscent,m=v.fontBoundingBoxDescent,p=v.topToAlphabeticDistance)}0<f.length&&this._AddLine(f,g,h,l,m,p);this._TrimLinesTrailingWhitespace(b,c)}_TrimLinesTrailingWhitespace(a,b){for(const c of this._lines){const f=c.fragments;if(!f.length)continue;let g=f[f.length-1];var e=g.text;const h=e.trimEnd();if(!h)c.width-=g.width,f.pop();else if(h.length<e.length){e=
|
|
a(h,g.styles).width;const l=g.width-e;g.width=e;g.text=h;c.width-=l}0!==b&&0<f.length&&(g=f[f.length-1],g.width+=b,c.width+=b)}}Clear(){d.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((a,b)=>Math.max(a,b.width),0)}GetTotalLineHeight(){return this._lines.reduce((a,b)=>a+b.height,0)}}}
|
|
{"use strict";const d=self.C3,a=self.glMatrix,b=a.vec3,e=a.vec4,c=a.mat4,f=b.create(),g=b.create(),h=b.create(),l=e.create(),m=c.create(),p=b.create(),x=b.create(),v=b.create(),r=b.create(),q=b.create(),y=b.create(),u=b.create(),t=b.create(),A=e.fromValues(0,0,1,1);d.Gfx={Project(E,J,G,I,L,N,S){const X=I[0]*E+I[4]*J+I[8]*G+I[12],U=I[1]*E+I[5]*J+I[9]*G+I[13];var W=I[2]*E+I[6]*J+I[10]*G+I[14];G=I[3]*E+I[7]*J+I[11]*G+I[15];E=L[0]*X+L[4]*U+L[8]*W+L[12]*G;J=L[1]*X+L[5]*U+L[9]*W+L[13]*G;L=L[2]*X+L[6]*U+
|
|
L[10]*W+L[14]*G;W=-W;if(0===W)return!1;W=1/W;S[0]=(E*W*.5+.5)*N[2]+N[0];S[1]=(J*W*.5+.5)*N[3]+N[1];S[2]=.5*(1+L*W);return!0},Unproject(E,J,G,I,L,N,S){c.multiply(m,L,I);if(null===c.invert(m,m))return!1;l[0]=(E-N[0])/N[2]*2-1;l[1]=(J-N[1])/N[3]*2-1;l[2]=2*G-1;l[3]=1;e.transformMat4(l,l,m);if(0===l[3])return!1;l[3]=1/l[3];S[0]=l[0]*l[3];S[1]=l[1]*l[3];S[2]=l[2]*l[3];return!0},UnprojectScreenToWorldZ(E,J,G,I,L,N,S){if(!d.Gfx.Unproject(E,J,0,I,L,N,f)||!d.Gfx.Unproject(E,J,1,I,L,N,g))return!1;b.subtract(g,
|
|
g,f);b.set(h,0,0,1);E=-G;J=b.dot(h,g);G=0;if(0===J){if(0!==b.dot(h,f)+E)return!1}else if(G=-(b.dot(f,h)+E)/J,0>G)return!1;b.scaleAndAdd(S,f,g,G);return!0}};function z(E,J,G,I){b.subtract(f,G,J);b.subtract(g,E,J);b.cross(h,f,g);b.normalize(h,h);I[0]=h[0];I[1]=h[1];I[2]=h[2];I[3]=b.dot(E,h)}function C(E,J,G,I,L,N,S){const X=S[0],U=S[1],W=S[2];S=S[3];let ia;0<X?(ia=X*E,E=X*I):(ia=X*I,E*=X);0<U?(ia+=U*J,E+=U*L):(ia+=U*L,E+=U*J);0<W?(ia+=W*G,E+=W*N):(ia+=W*N,E+=W*G);return ia>=S||E>S}d.Gfx.ViewFrustum=
|
|
class{constructor(){this._leftP=e.create();this._topP=e.create();this._rightP=e.create();this._bottomP=e.create();this._nearP=e.create();this._farP=e.create()}CalculatePlanes(E,J){d.Gfx.Unproject(0,1,0,E,J,A,p);d.Gfx.Unproject(1,1,0,E,J,A,x);d.Gfx.Unproject(0,0,0,E,J,A,v);d.Gfx.Unproject(1,0,0,E,J,A,r);d.Gfx.Unproject(0,1,1,E,J,A,q);d.Gfx.Unproject(1,1,1,E,J,A,y);d.Gfx.Unproject(0,0,1,E,J,A,u);d.Gfx.Unproject(1,0,1,E,J,A,t);z(v,p,q,this._leftP);z(p,x,y,this._topP);z(x,r,t,this._rightP);z(r,v,u,this._bottomP);
|
|
z(u,q,y,this._farP);z(r,x,p,this._nearP)}ContainsAABB(E,J,G,I,L,N){return C(E,J,G,I,L,N,this._leftP)&&C(E,J,G,I,L,N,this._topP)&&C(E,J,G,I,L,N,this._rightP)&&C(E,J,G,I,L,N,this._bottomP)&&C(E,J,G,I,L,N,this._nearP)&&C(E,J,G,I,L,N,this._farP)}}}
|
|
{"use strict";const d=self.C3,a=self.glMatrix,b=a.vec3,e=a.vec4,c=a.mat4,f=c.create(),g=b.fromValues(0,0,0),h=b.fromValues(0,0,0),l=b.fromValues(0,0,0),m=b.fromValues(0,1,0);e.fromValues(0,0,0,0);const p=new d.Quad,x=new d.Rect,v=new d.Quad(0,0,1,0,1,1,0,1);d.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._fovY=d.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=c.create();this._matMV=c.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}FillIndexBufferData(r){let q=0,y=r.length,u=0;for(;q<y;)r[q++]=u,r[q++]=u+1,r[q++]=u+2,r[q++]=u,r[q++]=u+2,r[q++]=u+3,u+=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 r of this._allShaderPrograms)r.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(r,q,y=.5,u=.5){const t=this.GetNearZ(),A=this.GetFarZ();y=1-y;const z=2*y-2;y*=2;const C=2*u-2;u*=2;const E=this._GetTanFovYDiv2()*t;q*=E;c.frustum(r,
|
|
z*q,y*q,C*E,u*E,t,A)}CalculateLookAtModelView(r,q,y,u,t=this.GetScissoredViewportHeight()){t=2*this.GetDefaultCameraZ()*self.devicePixelRatio*this._GetTanFovYDiv2()/t;b.set(l,t,-t,1);b.multiply(g,q,l);b.multiply(h,y,l);c.lookAt(r,g,h,u||m);c.scale(r,r,l)}CalculateLookAtModelView2(r,q,y,u,t,A,z){b.set(g,r,q,y);b.set(h,u,t,A);this.CalculateLookAtModelView(f,g,h,m,z);return f}_AddShaderProgram(r){this._allShaderPrograms.push(r);this._shaderProgramsByName.set(r.GetName(),r)}_RemoveShaderProgram(r){const q=
|
|
this._allShaderPrograms.indexOf(r);-1!==q&&this._allShaderPrograms.splice(q,1);this._shaderProgramsByName.delete(r.GetName())}_ClearAllShaderPrograms(){d.clearArray(this._allShaderPrograms);this._shaderProgramsByName.clear()}GetShaderProgramByName(r){return this._shaderProgramsByName.get(r)||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(r){this._currentStateGroup=
|
|
r}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(r,q,y,u){const t=d.Gfx.StateGroup.MakeKey(r,q,y,u);let A=this._stateGroups.get(t);A||(A=d.New(d.Gfx.StateGroup,this,r,q,y,u),this._stateGroups.set(t,A));A.AddRef();return A}ReleaseStateGroup(r){r.DecRef();0===r._GetRefCount()&&(this._currentStateGroup===r&&(this._currentStateGroup=null),this._stateGroups.delete(r.GetKey()),r.Release())}_InitBlendModeData(r){d.clearArray(this._blendModeTable);this._namedBlendModeMap.clear();
|
|
for(const q of r){r=q[0];const y=q[1],u=q[2];this._blendModeTable.push([y,u]);this._namedBlendModeMap.set(r,{srcBlend:y,destBlend:u})}}_GetBlendByIndex(r){return this._blendModeTable[r]}GetSrcBlendByIndex(r){return this._GetBlendByIndex(r)[0]}GetDestBlendByIndex(r){return this._GetBlendByIndex(r)[1]}GetNamedBlend(r){r=this._namedBlendModeMap.get(r);if("undefined"===typeof r)throw Error("invalid blend name");return r}SetBaseZ(r){this._baseZ=r}GetBaseZ(){return this._baseZ}SetCurrentZ(r){this._currentZ=
|
|
r;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}Line(r,q,y,u){var t=d.angleTo(r,q,y,u),A=.5*this._lineWidth;const z=Math.sin(t)*A;t=Math.cos(t)*A;A=this._lineCap;2===A?this.LinePreCalc_LineCap2(r,q,0,y,u,0,z,t):1===A?this.LinePreCalc_LineCap1(r,q,0,y,u,0,z,t):this.LinePreCalc_LineCap0(r,q,0,y,u,0,z,t)}Line3D(r,q,y,u,t,A){var z=d.angleTo(r,q,u,t),C=.5*this._lineWidth;const E=Math.sin(z)*C;z=Math.cos(z)*C;C=this._lineCap;2===C?this.LinePreCalc_LineCap2(r,q,y,u,t,A,E,z):1===C?this.LinePreCalc_LineCap1(r,
|
|
q,y,u,t,A,E,z):this.LinePreCalc_LineCap0(r,q,y,u,t,A,E,z)}LinePreCalc_LineCap2(r,q,y,u,t,A,z,C){var E=this._lineOffset;r=r+E-C;q=q+E-z;u=u+E+C;t=t+E+z;E=2*C;const J=2*z;this.Quad3D2(r+z,q-C,y,u+z,t-C,A,u-z-E,t+C-J,A,r-z+E,q+C+J,y,v)}LinePreCalc_LineCap1(r,q,y,u,t,A,z,C){const E=this._lineOffset;r=r+E-C;q=q+E-z;u=u+E+C;t=t+E+z;this.Quad3D2(r+z,q-C,y,u+z,t-C,A,u-z,t+C,A,r-z,q+C,y,v)}LinePreCalc_LineCap0(r,q,y,u,t,A,z,C){const E=this._lineOffset;r+=E;q+=E;u+=E;t+=E;this.Quad3D2(r+z,q-C,y,u+z,t-C,A,u-
|
|
z,t+C,A,r-z,q+C,y,v)}TexturedLine(r,q,y,u,t,A){var z=d.angleTo(r,q,y,u),C=.5*this._lineWidth;const E=Math.sin(z)*C;z=Math.cos(z)*C;C=this._lineCap;2===C?this.TexturedLinePreCalc_LineCap2(r,q,y,u,E,z,t,A):1===C?this.TexturedLinePreCalc_LineCap1(r,q,y,u,E,z,t,A):this.TexturedLinePreCalc_LineCap0(r,q,y,u,E,z,t,A)}TexturedLinePreCalc_LineCap2(r,q,y,u,t,A,z,C){var E=this._lineOffset;r=r+E-A;q=q+E-t;y=y+E+A;u=u+E+t;E=2*A;const J=2*t;p.set(r+t,q-A,y+t,u-A,y-t-E,u+A-J,r-t+E,q+A+J);x.set(z,0,C,0);this.Quad3(p,
|
|
x)}TexturedLinePreCalc_LineCap1(r,q,y,u,t,A,z,C){const E=this._lineOffset;r=r+E-A;q=q+E-t;y=y+E+A;u=u+E+t;p.set(r+t,q-A,y+t,u-A,y-t,u+A,r-t,q+A);x.set(z,0,C,0);this.Quad3(p,x)}TexturedLinePreCalc_LineCap0(r,q,y,u,t,A,z,C){const E=this._lineOffset;r+=E;q+=E;y+=E;u+=E;p.set(r+t,q-A,y+t,u-A,y-t,u+A,r-t,q+A);x.set(z,0,C,0);this.Quad3(p,x)}LineRect(r,q,y,u){const t=.5*this._lineWidth,A=this._lineCap;2===A?this._LineRectPreCalc_LineCap2(r,q,y,u,t):1===A?this._LineRectPreCalc_LineCap1(r,q,y,u,t):this._LineRectPreCalc_LineCap0(r,
|
|
q,y,u,t)}_LineRectPreCalc_LineCap2(r,q,y,u,t){this.LinePreCalc_LineCap2(r,q,0,y,q,0,0,t);this.LinePreCalc_LineCap2(y,q,0,y,u,0,t,0);this.LinePreCalc_LineCap2(y,u,0,r,u,0,0,-t);this.LinePreCalc_LineCap2(r,u,0,r,q,0,-t,0)}_LineRectPreCalc_LineCap1(r,q,y,u,t){this.LinePreCalc_LineCap1(r,q,0,y,q,0,0,t);this.LinePreCalc_LineCap1(y,q,0,y,u,0,t,0);this.LinePreCalc_LineCap1(y,u,0,r,u,0,0,-t);this.LinePreCalc_LineCap1(r,u,0,r,q,0,-t,0)}_LineRectPreCalc_LineCap0(r,q,y,u,t){this.LinePreCalc_LineCap0(r,q,0,y,
|
|
q,0,0,t);this.LinePreCalc_LineCap0(y,q,0,y,u,0,t,0);this.LinePreCalc_LineCap0(y,u,0,r,u,0,0,-t);this.LinePreCalc_LineCap0(r,u,0,r,q,0,-t,0)}LineRect2(r){this.LineRect(r.getLeft(),r.getTop(),r.getRight(),r.getBottom())}LineQuad(r){var q=d.angleTo(r.getTlx(),r.getTly(),r.getTrx(),r.getTry()),y=.5*this._lineWidth;const u=Math.sin(q)*y;q=Math.cos(q)*y;y=this._lineCap;2===y?this._LineQuadPreCalc_LineCap2(r,u,q):1===y?this._LineQuadPreCalc_LineCap1(r,u,q):this._LineQuadPreCalc_LineCap0(r,u,q)}_LineQuadPreCalc_LineCap2(r,
|
|
q,y){this.LinePreCalc_LineCap2(r.getTlx(),r.getTly(),0,r.getTrx(),r.getTry(),0,q,y);this.LinePreCalc_LineCap2(r.getTrx(),r.getTry(),0,r.getBrx(),r.getBry(),0,y,-q);this.LinePreCalc_LineCap2(r.getBrx(),r.getBry(),0,r.getBlx(),r.getBly(),0,-q,-y);this.LinePreCalc_LineCap2(r.getBlx(),r.getBly(),0,r.getTlx(),r.getTly(),0,-y,q)}_LineQuadPreCalc_LineCap1(r,q,y){this.LinePreCalc_LineCap1(r.getTlx(),r.getTly(),0,r.getTrx(),r.getTry(),0,q,y);this.LinePreCalc_LineCap1(r.getTrx(),r.getTry(),0,r.getBrx(),r.getBry(),
|
|
0,y,-q);this.LinePreCalc_LineCap1(r.getBrx(),r.getBry(),0,r.getBlx(),r.getBly(),0,-q,-y);this.LinePreCalc_LineCap1(r.getBlx(),r.getBly(),0,r.getTlx(),r.getTly(),0,-y,q)}_LineQuadPreCalc_LineCap0(r,q,y){this.LinePreCalc_LineCap0(r.getTlx(),r.getTly(),0,r.getTrx(),r.getTry(),0,q,y);this.LinePreCalc_LineCap0(r.getTrx(),r.getTry(),0,r.getBrx(),r.getBry(),0,y,-q);this.LinePreCalc_LineCap0(r.getBrx(),r.getBry(),0,r.getBlx(),r.getBly(),0,-q,-y);this.LinePreCalc_LineCap0(r.getBlx(),r.getBly(),0,r.getTlx(),
|
|
r.getTly(),0,-y,q)}SetLineWidth(r){this._lineWidth=r;this._lineWidthStack[this._lineWidthStack.length-1]=r}GetLineWidth(){return this._lineWidth}PushLineWidth(r){if(100<=this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(r);this._lineWidth=r}PopLineWidth(){if(1>=this._lineWidthStack.length)throw Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack[this._lineWidthStack.length-
|
|
1]}SetLineCapButt(){this._lineCap=0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(r){if("butt"===r)this.PushLineCapButt();else if("square"===r)this.PushLineCapSquare();else if("zag"===r)this.PushLineCapZag();else throw Error("invalid line cap");}PushLineCapButt(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");
|
|
this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(1>=this._lineCapStack.length)throw Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=
|
|
this._lineCapStack[this._lineCapStack.length-1]}SetLineOffset(r){this._lineOffset=r;this._lineOffsetStack[this._lineOffsetStack.length-1]=r}GetLineOffset(){return this._lineOffset}PushLineOffset(r){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(r);this._lineOffset=r}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=
|
|
this._lineOffsetStack[this._lineOffsetStack.length-1]}ConvexPoly(r){var q=r.length/2;if(3>q)throw Error("need at least 3 points");q-=2;const y=q-1,u=r[0],t=r[1];for(let A=0;A<q;A+=2){const z=2*A,C=r[z+2],E=r[z+3],J=r[z+4],G=r[z+5];A===y?this.Quad2(u,t,C,E,J,G,J,G):this.Quad2(u,t,C,E,J,G,r[z+6],r[z+7])}}GetNumVertexComponents(){return 3}Finish(){this.EndBatch(!0);this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(r){this._enableMipmaps=
|
|
!!r}AreMipmapsEnabled(){return this._enableMipmaps}IsWebGL(){return!1}IsWebGPU(){return!1}}}
|
|
{"use strict";const d=self.C3;d.Gfx.StateGroup=class{constructor(a,b,e,c,f){this._renderer=a;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=e;this._color=d.New(d.Color);this._color.set(c);this._zElevation=f;"string"===typeof b?this._shaderProgramName=b:(this._shaderProgram=b,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 a=this._renderer;a.SetProgram(this._shaderProgram);a.SetBlendMode(this._blendMode);a.SetColor(this._color);a.SetCurrentZ(this._zElevation);a._SetCurrentStateGroup(this)}GetKey(){return d.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(a){this._shaderProgram=a.GetShaderProgramByName(this._shaderProgramName);
|
|
if(!this._shaderProgram)throw Error("failed to restore shader program");}static MakeKey(a,b,e,c){return("string"===typeof a?a:a.GetName())+","+b+","+e.getR()+","+e.getG()+","+e.getB()+","+e.getA()+","+c}}}
|
|
{"use strict";const d=self.C3,a=d.New(d.Quad);function b(e,c,f){const g=f.getTlx(),h=f.getTly(),l=f.getTrx()-g,m=f.getTry()-h,p=f.getBlx()-g;f=f.getBly()-h;return[g+l*e+p*c,h+m*e+f*c]}d.Gfx.MeshPoint=class{constructor(e,c,f){this._mesh=e;this._col=c;this._row=f;this._v=this._u=this._zElevation=this._y=this._x=0}_Init(e,c,f,g){this._x=e;this._y=c;this._u=f;this._v=g}GetX(){return this._x}SetX(e){this._x!==e&&(this._x=e,this._mesh._SetPointsChanged())}GetY(){return this._y}SetY(e){this._y!==e&&(this._y=
|
|
e,this._mesh._SetPointsChanged())}GetZElevation(){return this._zElevation}SetZElevation(e){this._zElevation!==e&&(this._zElevation=Math.max(e,0),this._mesh._SetPointsChanged())}GetU(){return this._u}SetU(e){this._u=e}GetV(){return this._v}SetV(e){this._v=e}_Interpolate_TexRect(e,c,f){[this._x,this._y]=b(e._x,e._y,c);this._zElevation=e._zElevation;this._u=d.lerp(f.getLeft(),f.getRight(),e._u);this._v=d.lerp(f.getTop(),f.getBottom(),e._v)}_Interpolate_TexQuad(e,c,f){[this._x,this._y]=b(e._x,e._y,c);
|
|
this._zElevation=e._zElevation;[this._u,this._v]=b(e._u,e._v,f)}SaveToJson(){return{x:this.GetX(),y:this.GetY(),z:this.GetZElevation(),u:this.GetU(),v:this.GetV()}}LoadFromJson(e){this.SetX(e.x);this.SetY(e.y);e.hasOwnProperty("z")&&this.SetZElevation(e.z);this.SetU(e.u);this.SetV(e.v)}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}};d.Gfx.Mesh=class{constructor(e,c,f){if(2>e||2>c)throw Error("invalid mesh size");this._hsize=e;this._vsize=c;this._owner=f||null;
|
|
this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._pointsChanged=this._hasAnyZElevation=!1;f=e-1;const g=c-1;for(let h=0;h<c;++h){const l=[];for(let m=0;m<e;++m){const p=d.New(d.Gfx.MeshPoint,this,m,h),x=m/f,v=h/g;p._Init(x,v,x,v);l.push(p)}this._pts.push(l)}}Release(){d.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 e=
|
|
Infinity,c=Infinity,f=-Infinity,g=-Infinity;this._hasAnyZElevation=!1;for(const h of this._pts)for(const l of h){const m=l.GetX(),p=l.GetY();e=Math.min(e,m);c=Math.min(c,p);f=Math.max(f,m);g=Math.max(g,p);0<l.GetZElevation()&&(this._hasAnyZElevation=!0)}this._minX=e;this._minY=c;this._maxX=f;this._maxY=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}HasAnyZElevation(){this._MaybeComputeBounds();return this._hasAnyZElevation}GetMeshPointAt(e,c){e=Math.floor(e);c=Math.floor(c);return 0>e||e>=this._hsize||0>c||c>=this._vsize?null:this._pts[c][e]}CalculateTransformedMesh(e,c,f){const g=f instanceof d.Rect;if(e.GetHSize()!==this.GetHSize()||e.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");e=e._pts;const h=this._pts;for(let l=0,m=h.length;l<m;++l){const p=e[l],x=h[l];for(let v=0,r=x.length;v<r;++v){const q=p[v],
|
|
y=x[v];g?y._Interpolate_TexRect(q,c,f):y._Interpolate_TexQuad(q,c,f)}}}Draw(e){const c=this._pts;let f=c[0];for(let g=1,h=c.length;g<h;++g){const l=c[g];let m=f[0],p=l[0];for(let x=1,v=l.length;x<v;++x){const r=f[x],q=l[x];a.set(m.GetU(),m.GetV(),r.GetU(),r.GetV(),q.GetU(),q.GetV(),p.GetU(),p.GetV());e.Quad3D2(m.GetX(),m.GetY(),m.GetZElevation(),r.GetX(),r.GetY(),r.GetZElevation(),q.GetX(),q.GetY(),q.GetZElevation(),p.GetX(),p.GetY(),p.GetZElevation(),a);m=r;p=q}f=l}}Outline(e,c){c||(c=(h,l,m)=>[h,
|
|
l,m]);const f=this._pts;let g=f[0];for(let h=1,l=f.length;h<l;++h){const m=f[h];let p=g[0],x=m[0];for(let v=1,r=m.length;v<r;++v){const q=g[v],y=m[v],[u,t,A]=c(p.GetX(),p.GetY(),p.GetZElevation()),[z,C,E]=c(q.GetX(),q.GetY(),q.GetZElevation()),[J,G,I]=c(y.GetX(),y.GetY(),y.GetZElevation()),[L,N,S]=c(x.GetX(),x.GetY(),x.GetZElevation());e.Line3D(u,t,A,z,C,E);e.Line3D(u,t,A,J,G,I);e.Line3D(u,t,A,L,N,S);v===r-1&&e.Line3D(z,C,E,J,G,I);h===l-1&&e.Line3D(L,N,S,J,G,I);p=q;x=y}g=m}}InsertPolyMeshVertices(e){e=
|
|
e.pointsArr();const c=[],f=this.GetHSize()-1,g=this.GetVSize()-1,h=1/f,l=1/g,m=f-1,p=g-1;let x=e[0],v=e[1],r=d.clamp(Math.floor(x*f),0,m),q=d.clamp(Math.floor(v*g),0,p),y=0,u=0,t=0;var A=-1;const z=()=>{x=d.clamp(d.lerp(x,y,t),0,1);v=d.clamp(d.lerp(v,u,t),0,1);c.push(x,v)};for(let C=0,E=e.length;C<E;C+=2)for(x=e[C],v=e[C+1],c.push(x,v),r=d.clamp(Math.floor(x*f),0,m),q=d.clamp(Math.floor(v*g),0,p),A=(C+2)%E,y=e[A],u=e[A+1],A=-1;;){if(1E6<c.length)throw Error("Too many mesh poly points");const J=r*
|
|
h,G=q*l,I=(r+1)*h,L=(q+1)*l;d.isPointInTriangleInclusive(x,v,J,G,I,G,I,L);if(0!==A&&(t=d.rayIntersectExtended(x,v,y,u,J,G,I,L,-.001),0<=t&&.99999999>=t)){z();A=0;continue}if(0<q&&2!==A&&(t=d.rayIntersectExtended(x,v,y,u,J,G,I,G,.001),0<=t&&.99999999>=t)){z();q--;A=4;continue}if(r<m&&3!==A&&(t=d.rayIntersectExtended(x,v,y,u,I,G,I,L,.001),0<=t&&.99999999>=t)){z();r++;A=1;continue}if(0<r&&1!==A&&(t=d.rayIntersectExtended(x,v,y,u,J,G,J,L,.001),0<=t&&.99999999>=t)){z();r--;A=3;continue}if(q<p&&4!==A&&
|
|
(t=d.rayIntersectExtended(x,v,y,u,J,L,I,L,.001),0<=t&&.99999999>=t)){z();q++;A=2;continue}break}return d.New(d.CollisionPoly,c)}TransformCollisionPoly(e,c){e=this._TransformPolyPoints(e);this._SimplifyPoly(e);c.setPoints(e)}_TransformPolyPoints(e){const c=[];e=e.pointsArr();for(let f=0,g=e.length;f<g;f+=2){const [h,l]=this.TransformPoint(e[f],e[f+1]);c.push(h,l)}return c}TransformPoint(e,c){var f=this.GetHSize()-1,g=this.GetVSize()-1,h=1/f,l=1/g;f=d.clamp(Math.floor(e*f),0,f-1);const m=d.clamp(Math.floor(c*
|
|
g),0,g-1);g=f*h;const p=m*l,x=(f+1)*h,v=(m+1)*l,r=this.GetMeshPointAt(f,m),q=this.GetMeshPointAt(f+1,m+1),y=d.isPointInTriangleInclusive(e,c,g,p,x,p,x,v);h=y?g+h:g;l=y?p:p+l;f=this.GetMeshPointAt(f+(y?1:0),m+(y?0:1));const [u,t,A]=d.triangleCartesianToBarycentric(e,c,g,p,h,l,x,v);return d.triangleBarycentricToCartesian(u,t,A,r.GetX(),r.GetY(),f.GetX(),f.GetY(),q.GetX(),q.GetY())}_SimplifyPoly(e){const c=[];let f=e[0],g=e[1],h=f-e[e.length-2],l=g-e[e.length-1];for(let p=0,x=e.length;p<x;p+=2){var m=
|
|
(p+2)%x;const v=e[m];m=e[m+1];const r=v-f,q=m-g,y=1E-7>Math.abs(q)&&1E-7>Math.abs(l)&&Math.sign(r)===Math.sign(h);(!(1E-7>Math.abs(r)&&1E-7>Math.abs(h)&&Math.sign(q)===Math.sign(l)||y)&&1E-7<Math.abs(r/h-q/l)||0==r&&0===q)&&c.push(f,g);f=v;g=m;h=r;l=q}6<=c.length&&c.length<e.length&&d.shallowAssignArray(e,c)}SaveToJson(){return{cols:this.GetHSize(),rows:this.GetVSize(),points:this._pts.map(e=>e.map(c=>c.SaveToJson()))}}LoadFromJson(e){const c=this.GetHSize(),f=this.GetVSize();if(e.cols!==c||e.rows!==
|
|
f)throw Error("mesh data wrong size");e=e.points;for(let g=0;g<f;++g){const h=e[g];for(let l=0;l<c;++l)this.GetMeshPointAt(l,g).LoadFromJson(h[l])}}}}
|
|
{"use strict";const d=self.C3,a=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),b=new Set(["nearest","bilinear","trilinear"]),e=new Set(["default","low","high"]),c=new Set(["clamp-to-edge","repeat","mirror-repeat"]);function f(m,p){let x,v;switch(m){case "rgba8":m=p.RGBA8;v=x=p.RGBA;p=p.UNSIGNED_BYTE;break;case "rgb8":m=p.RGB8;v=x=p.RGB;p=p.UNSIGNED_BYTE;break;case "rgba4":m=p.RGBA4;v=x=p.RGBA;p=p.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":m=p.RGB5_A1;v=x=p.RGBA;p=p.UNSIGNED_SHORT_5_5_5_1;break;
|
|
case "rgb565":m=p.RGB565;v=x=p.RGB;p=p.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:m,internalformat:x,format:v,type:p}}const g={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},h={premultiplyAlpha:!0,flipY:!1},l=new Set;d.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,p){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");p=Object.assign({},g,p);if(this._texture)throw Error("already created texture");this._wrapX=p.wrapX;this._wrapY=p.wrapY;this._sampling=p.sampling;this._anisotropy=p.anisotropy;this._pixelFormat=p.pixelFormat;this._isMipMapped=!!p.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=p.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!b.has(this._sampling))throw Error("invalid sampling");
|
|
if(!a.has(this._pixelFormat))throw Error("invalid pixel format");if(!e.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(m instanceof ArrayBuffer||null===m||p.isSvg){if(this._width=p.width,this._height=p.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(p.isSvg){var x=d.CreateCanvas(this._width,
|
|
this._height);x.getContext("2d").drawImage(m,0,0,this._width,this._height);m=x}var v=d.isPOT(this._width)&&d.isPOT(this._height);x=this._renderer.GetMaxTextureSize();if(this._width>x||this._height>x)throw Error("texture data exceeds maximum texture size");x=this._renderer.GetContext();var r=this._renderer.GetWebGLVersionNumber();this._texture=x.createTexture();x.bindTexture(x.TEXTURE_2D,this._texture);x.pixelStorei(x.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha);x.pixelStorei(x.UNPACK_FLIP_Y_WEBGL,
|
|
!1);p=f(this._pixelFormat,x);if(this._renderer.SupportsNPOTTextures()||v||!this._IsTiled())2<=r?(x.texStorage2D(x.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,p.sizedinternalformat,this._width,this._height),m instanceof ArrayBuffer?x.texSubImage2D(x.TEXTURE_2D,0,0,0,this._width,this._height,p.format,p.type,new Uint8Array(m)):null!==m&&x.texSubImage2D(x.TEXTURE_2D,0,0,0,p.format,p.type,m)):m instanceof ArrayBuffer?x.texImage2D(x.TEXTURE_2D,0,p.internalformat,
|
|
this._width,this._height,0,p.format,p.type,new Uint8Array(m)):null===m?x.texImage2D(x.TEXTURE_2D,0,p.internalformat,this._width,this._height,0,p.format,p.type,null):x.texImage2D(x.TEXTURE_2D,0,p.internalformat,p.format,p.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&&(v=d.CreateCanvas(this._width,this._height),
|
|
v.getContext("2d").putImageData(m,0,0),m=v);v=d.CreateCanvas(d.nextHighestPowerOfTwo(this._width),d.nextHighestPowerOfTwo(this._height));r=v.getContext("2d");r.imageSmoothingEnabled="nearest"!==this._sampling;r.drawImage(m,0,0,this._width,this._height,0,0,v.width,v.height);x.texImage2D(x.TEXTURE_2D,0,p.internalformat,p.format,p.type,v)}null!==m&&this._SetTextureParameters(x);x.bindTexture(x.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_CreateDynamic(m,p,x){x=Object.assign({},
|
|
g,x);if(this._texture)throw Error("already created texture");this._wrapX=x.wrapX;this._wrapY=x.wrapY;this._sampling=x.sampling;this._pixelFormat=x.pixelFormat;this._isMipMapped=!!x.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=x.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!b.has(this._sampling))throw Error("invalid sampling");if(!a.has(this._pixelFormat))throw Error("invalid pixel format");if(!e.has(this._mipMapQuality))throw Error("invalid mipmap quality");
|
|
this._isStatic=!1;this._width=Math.floor(m);this._height=Math.floor(p);m=d.isPOT(this._width)&&d.isPOT(this._height);p=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>p||this._height>p)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();p=this._renderer.GetWebGLVersionNumber();
|
|
this._texture=m.createTexture();m.bindTexture(m.TEXTURE_2D,this._texture);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,x.premultiplyAlpha);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,!1);x=f(this._pixelFormat,m);m.texImage2D(m.TEXTURE_2D,0,2<=p?x.sizedinternalformat:x.internalformat,this._width,this._height,0,x.format,x.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,p){if("clamp-to-edge"===p)return m.CLAMP_TO_EDGE;if("repeat"===p)return m.REPEAT;if("mirror-repeat"===p)return m.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(m){var p=d.isPOT(this._width)&&d.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),(p||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(m.hint(m.GENERATE_MIPMAP_HINT,this._GetMipMapHint(m)),m.generateMipmap(m.TEXTURE_2D),
|
|
p="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,p?m.LINEAR_MIPMAP_LINEAR:m.LINEAR_MIPMAP_NEAREST)):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),this._isMipMapped=!1));(p=this._renderer._GetAnisotropicExtension())&&0<this._anisotropy&&"nearest"!==this._sampling&&m.texParameterf(m.TEXTURE_2D,p.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(m,p){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");
|
|
p=Object.assign({},h,p);const x=m.width||m.videoWidth,v=m.height||m.videoHeight;var r=this._renderer.GetWebGLVersionNumber();const q=this._renderer.GetContext();q.bindTexture(q.TEXTURE_2D,this._texture);q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p.premultiplyAlpha);q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,!!p.flipY);p=f(this._pixelFormat,q);r=2<=r?p.sizedinternalformat:p.internalformat;try{if(this._width===x&&this._height===v){const y=d.isPOT(this._width)&&d.isPOT(this._height);q.texSubImage2D(q.TEXTURE_2D,
|
|
0,0,0,p.format,p.type,m);(y||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(q.hint(q.GENERATE_MIPMAP_HINT,this._GetMipMapHint(q)),q.generateMipmap(q.TEXTURE_2D))}else{this._width=x;this._height=v;const y=d.isPOT(this._width)&&d.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!y)throw Error("non-power-of-two tiled textures not supported");q.texImage2D(q.TEXTURE_2D,0,r,p.format,p.type,m);(y||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(q.hint(q.GENERATE_MIPMAP_HINT,
|
|
this._GetMipMapHint(q)),q.generateMipmap(q.TEXTURE_2D))}}catch(y){console.error("Error updating WebGL texture: ",y)}q.bindTexture(q.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 d=self.C3,a=self.glMatrix.mat4,b=new Set(["nearest","bilinear","trilinear"]),e={sampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,isDefaultSize:!0,multisampling:0},c=new Set;d.Gfx.WebGLRenderTarget=class{constructor(f){this._renderer=f;this._renderBuffer=this._texture=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=a.create()}_Create(f,
|
|
g,h){h=Object.assign({},e,h);const l=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw Error("already created render target");this._sampling=h.sampling;this._alpha=!!h.alpha;this._depth=!!h.depth;this._isSampled=!!h.isSampled;this._isDefaultSize=!!h.isDefaultSize;this._multisampling=h.multisampling;if(!b.has(this._sampling))throw Error("invalid sampling");if(0<this._multisampling&&(2>l||this._isSampled))throw Error("invalid use of multisampling");2>l&&(this._isSampled=
|
|
!0);this._width=f;this._height=g;if(0>=this._width||0>=this._height)throw Error("invalid render target size");this._CalculateProjection();f=this._renderer.GetContext();this._frameBuffer=f.createFramebuffer();f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer);this._isSampled?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),g=this._texture._GetTexture(),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,
|
|
f.TEXTURE_2D,g,0)):(this._renderBuffer=f.createRenderbuffer(),f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),g=this._alpha?f.RGBA8:f.RGB8,0<this._multisampling&&((h=f.getInternalformatParameter(f.RENDERBUFFER,g,f.SAMPLES))&&h[0]?(h=h[0],this._multisampling>h&&(this._multisampling=h)):this._multisampling=0),0===this._multisampling?f.renderbufferStorage(f.RENDERBUFFER,g,this._width,this._height):f.renderbufferStorageMultisample(f.RENDERBUFFER,this._multisampling,g,this._width,this._height),f.framebufferRenderbuffer(f.FRAMEBUFFER,
|
|
f.COLOR_ATTACHMENT0,f.RENDERBUFFER,this._renderBuffer),f.bindRenderbuffer(f.RENDERBUFFER,null));g=this._renderer._GetDepthBuffer();this._depth&&g&&f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,g);f.bindFramebuffer(f.FRAMEBUFFER,null);c.add(this)}_Resize(f,g){if(this._width!==f||this._height!==g)this._width=f,this._height=g,this._CalculateProjection(),f=this._renderer.GetContext(),f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,
|
|
this._height)):(f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),f.renderbufferStorage(f.RENDERBUFFER,this._alpha?f.RGBA8:f.RGB8,this._width,this._height),f.bindRenderbuffer(f.RENDERBUFFER,null)),g=this._renderer._GetDepthBuffer(),this._depth&&g&&f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,g),f.bindFramebuffer(f.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw Error("already deleted render target");c.delete(this);const f=this._renderer.GetContext();
|
|
f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer);this._texture?(f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,null,0),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,null),f.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);f.bindFramebuffer(f.FRAMEBUFFER,null);2<=this._renderer.GetWebGLVersionNumber()&&(f.bindFramebuffer(f.READ_FRAMEBUFFER,null),
|
|
f.bindFramebuffer(f.DRAW_FRAMEBUFFER,null));f.deleteFramebuffer(this._frameBuffer);this._frameBuffer=this._renderer.GetBatchState().currentFramebuffer=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height)}_GetFramebuffer(){return this._frameBuffer}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){return this._projectionMatrix}IsLinearSampling(){return"nearest"!==this._sampling}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const f=
|
|
{sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};this._isDefaultSize||(f.width=this._width,f.height=this._height);return f}IsCompatibleWithOptions(f){f=Object.assign({},e,f);return"nearest"!==f.sampling!==this.IsLinearSampling()||!!f.alpha!==this.HasAlpha()||!!f.depth!==this.HasDepthBuffer()||2<=this._renderer.GetWebGLVersionNumber()&&!!f.isSampled!==this.IsSampled()?!1:"number"===typeof f.width||"number"===typeof f.height?!this.IsDefaultSize()&&this.GetWidth()===f.width&&this.GetHeight()===
|
|
f.height:this.IsDefaultSize()}_GetWebGLTexture(){return this._texture?this._texture._GetTexture():null}GetEstimatedMemoryUsage(){return this._texture?this._texture.GetEstimatedMemoryUsage():this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(f,g){f=await f.ReadBackRenderTargetToImageData(g,!0);return await d.ImageDataToBlob(f)}static OnContextLost(){c.clear()}static allRenderTargets(){return c.values()}static ResizeAll(f,g){for(const h of c)h.IsDefaultSize()&&h._Resize(f,
|
|
g)}}}
|
|
{"use strict";const d=self.C3,a=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));d.Gfx.WebGLShaderProgram=class{static async Compile(b,e,c,f){const g=b.GetContext(),h=g.createShader(g.FRAGMENT_SHADER);g.shaderSource(h,e);g.compileShader(h);e=g.createShader(g.VERTEX_SHADER);g.shaderSource(e,
|
|
c);g.compileShader(e);const l=g.createProgram();g.attachShader(l,h);g.attachShader(l,e);g.bindAttribLocation(l,0,"aPos");g.bindAttribLocation(l,1,"aTex");g.bindAttribLocation(l,2,"aPoints");g.linkProgram(l);const m=b._GetParallelShaderCompileExtension();m?await b._WaitForObjectReady(()=>g.getProgramParameter(l,m.COMPLETION_STATUS_KHR)):await d.Wait(5);if(!g.getShaderParameter(h,g.COMPILE_STATUS))throw f=g.getShaderInfoLog(h),g.deleteShader(h),g.deleteShader(e),g.deleteProgram(l),Error("Error compiling fragment shader: "+
|
|
f);if(!g.getShaderParameter(e,g.COMPILE_STATUS))throw f=g.getShaderInfoLog(e),g.deleteShader(h),g.deleteShader(e),g.deleteProgram(l),Error("Error compiling vertex shader: "+f);if(!g.getProgramParameter(l,g.LINK_STATUS))throw f=g.getProgramInfoLog(l),g.deleteShader(h),g.deleteShader(e),g.deleteProgram(l),Error("Error linking shader program: "+f);(b=d.FilterUnprintableChars(g.getProgramInfoLog(l)||"").trim())&&!d.IsStringAllWhitespace(b)&&console.info(`[WebGL] Shader program '${f}' compilation log: `,
|
|
b);g.deleteShader(h);g.deleteShader(e);return l}static async Create(b,e,c,f){c=await d.Gfx.WebGLShaderProgram.Compile(b,e.src,c,f);return new d.Gfx.WebGLShaderProgram(b,c,e,f)}constructor(b,e,c,f){const g=b.GetContext();var h=b.GetBatchState();b.EndBatch();g.useProgram(e);this._gl=g;this._renderer=b;this._name=f;this._shaderProgram=e;this._isDeviceTransform="<default-device-transform>"===f;f=g.getAttribLocation(e,"aPos");const l=g.getAttribLocation(e,"aTex");e=g.getAttribLocation(e,"aPoints");-1!==
|
|
f&&(g.bindBuffer(g.ARRAY_BUFFER,b._vertexBuffer),g.vertexAttribPointer(f,b.GetNumVertexComponents(),g.FLOAT,!1,0,0),g.enableVertexAttribArray(f));-1!==l&&(g.bindBuffer(g.ARRAY_BUFFER,b._texcoordBuffer),g.vertexAttribPointer(l,2,g.FLOAT,!1,0,0),g.enableVertexAttribArray(l));-1!==e&&(g.bindBuffer(g.ARRAY_BUFFER,b._pointBuffer),g.vertexAttribPointer(e,4,g.FLOAT,!1,0,0),g.enableVertexAttribArray(e));g.bindBuffer(g.ARRAY_BUFFER,null);this._uMatP=new d.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=
|
|
new d.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new d.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new d.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new d.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new d.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new d.Gfx.WebGLShaderUniform(this,"zElevation","float");this._uTileSize=new d.Gfx.WebGLShaderUniform(this,"tileSize","vec2");this._uTileSpacing=
|
|
new d.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new d.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new d.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new d.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uDestStart=new d.Gfx.WebGLShaderUniform(this,"destStart","vec2");this._uDestEnd=new d.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new d.Gfx.WebGLShaderUniform(this,"srcStart","vec2");this._uSrcEnd=
|
|
new d.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new d.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new d.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new d.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new d.Gfx.WebGLShaderUniform(this,"seconds","float");this._uLayerScale=new d.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new d.Gfx.WebGLShaderUniform(this,"layerAngle","float");this._uLayoutStart=
|
|
new d.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new d.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());
|
|
this._extendBoxHorizontal=c.extendBoxHorizontal||0;this._extendBoxVertical=c.extendBoxVertical||0;this._crossSampling=!!c.crossSampling;this._mustPreDraw=!!c.mustPreDraw;this._preservesOpaqueness=!!c.preservesOpaqueness;this._animated=!!c.animated;b=c.parameters||[];this._uCustomParameters=[];this._usesDest=this._uDestStart.IsUsed()||this._uDestEnd.IsUsed();this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||
|
|
this._uSrcOriginEnd.IsUsed();this._needsPostDrawOrExtendBox=this._crossSampling||this._usesDest||0!==this._extendBoxHorizontal||0!==this._extendBoxVertical;this._hasCurrentMatMV=this._hasCurrentMatP=!1;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0);this._uSamplerBack.Init1i(1);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0,0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,
|
|
1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,0);this._uPixelSize.Init2f(0,0);this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const m of b)b=m[2],c=new d.Gfx.WebGLShaderUniform(this,m[0],b),"color"===b?c.Init3f(0,0,0):c.Init1f(0),this._uCustomParameters.push(c);this._isDeviceTransform?this._UpdateDeviceTransformUniforms(h.currentMatP):
|
|
(this.UpdateMatP(h.currentMatP,!0),this.UpdateMatMV(h.currentMV,!0));h=h.currentShader;g.useProgram(h?h._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._renderer=this._gl=null}GetName(){return this._name}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}UsesDest(){return this._usesDest}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}ExtendsBox(){return 0!==
|
|
this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(b){return this._uCustomParameters[b].GetType()}AreCustomParametersAlreadySetInBatch(b){for(let e=0,c=b.length;e<c;++e)if(!this._uCustomParameters[e].IsSetToCustomInBatch(b[e]))return!1;
|
|
return!0}SetCustomParametersInBatch(b){for(let e=0,c=b.length;e<c;++e)this._uCustomParameters[e].SetBatchValueCustom(b[e])}AreOptionalUniformsAlreadySetInBatch(b,e,c,f,g,h,l,m,p){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(g,h)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(b.getLeft(),b.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(b.getRight(),b.getBottom())||this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(l)||
|
|
this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(m)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(e.getLeft(),e.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(e.getRight(),e.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(c.getLeft(),c.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(c.getRight(),c.getBottom())||this._uLayoutStart.IsUsed()&&!this._uLayoutStart.IsSetTo2InBatch(f.getLeft(),
|
|
f.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(f.getTop(),f.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(p)?!1:!0}SetOptionalUniformsInBatch(b,e,c,f,g,h,l,m,p){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(g,h),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(b.getLeft(),b.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(b.getRight(),b.getBottom()),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(l),
|
|
this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(m),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(e.getLeft(),e.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(e.getRight(),e.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(c.getLeft(),c.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(c.getRight(),c.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(f.getLeft(),f.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(f.getTop(),
|
|
f.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(p))}IsAnimated(){return this._animated}UpdateMatP(b,e){this._hasCurrentMatP&&!e||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(b),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(b,e){this._hasCurrentMatMV&&!e||this._isDeviceTransform||(this._uMatMV.IsUsed()&&this._uMatMV.UpdateMatrix4fv(b),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(b){if(!this._isDeviceTransform)throw Error("not device transform shader");
|
|
this._uMatP.UpdateMatrix4fv(b);b=this._renderer;const e=b.GetWidth()/2,c=b.GetHeight()/2;b=b.CalculateLookAtModelView2(e,c,b.GetDefaultCameraZ()*self.devicePixelRatio,e,c,0);this._uMatMV.UpdateMatrix4fv(b)}UpdateColor(b){this._uColor.IsUsed()&&this._uColor.Update4f(b[0],b[1],b[2],b[3])}static GetReservedUniformNames(){return a}static GetDefaultVertexShaderSource(b){b=b?"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 ${b} vec2 aTex;`,`varying ${b} 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(){return"attribute vec4 aPoints;\nvarying float pointOpacity;\nuniform float zElevation;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);\n\tgl_PointSize = aPoints.z;\n\tpointOpacity = aPoints.w;\n}"}static GetPointFragmentShaderSource(){return"uniform lowp sampler2D samplerFront;\nvarying lowp float pointOpacity;\nuniform mediump vec2 pointTexStart;\nuniform mediump vec2 pointTexEnd;\nuniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, mix(pointTexStart, pointTexEnd, gl_PointCoord)) * color * pointOpacity;\n}"}static GetColorFillFragmentShaderSource(){return"uniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = color;\n}"}static GetLinearGradientFillFragmentShaderSource(){return"precision lowp float;\nvarying mediump vec2 vTex;\nuniform vec4 color;\nuniform vec4 color2_;\nvec3 fromLinear(vec3 linearRGB)\n{\n\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));\n\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);\n\tvec3 lower = linearRGB * vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvec3 toLinear(vec3 sRGB)\n{\n\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));\n\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));\n\tvec3 lower = sRGB/vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvoid main(void) {\n\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);\n\tfloat a = mix(color.a, color2_.a, vTex.x);\n\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);\n}"}static GetSmoothLineFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float f = step(diffSq.x + diffSq.y, 0.25);\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump float innerF = step(distSq, 0.25);\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}static GetSmoothEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);\n\tgl_FragColor = color * f;\n}"}static GetSmoothEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 pxNorm = pixelSize * norm;\n\tmediump vec2 innerEdge1 = halfNorm - pxNorm;\n\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;\n\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);\n\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;\n\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;\n\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);\n\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;\n\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}}}
|
|
{"use strict";const d=self.C3,a=self.glMatrix.mat4,b=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);d.Gfx.WebGLShaderUniform=class{constructor(e,c,f){if(!b.has(f))throw Error("invalid uniform type");this._owner=e;this._gl=this._owner.GetWebGLContext();this._name=c;this._type=f;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),c);this._isUsed=!!this._location;e=b.get(f);this._lastValue=
|
|
new Float32Array(e);this._lastBatchValue=new Float32Array(e)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(e){this.IsUsed()&&(this._lastValue[0]=e,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,e))}Init1i(e){this.IsUsed()&&(this._lastValue[0]=e,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,e))}Init2f(e,c){this.IsUsed()&&(this._lastValue[0]=
|
|
e,this._lastValue[1]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,e,c))}Init3f(e,c,f){this.IsUsed()&&(this._lastValue[0]=e,this._lastValue[1]=c,this._lastValue[2]=f,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,e,c,f))}Init4f(e,c,f,g){this.IsUsed()&&(this._lastValue[0]=e,this._lastValue[1]=c,this._lastValue[2]=f,this._lastValue[3]=g,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,e,c,f,g))}Update1f(e){e=Math.fround(e);
|
|
const c=this._lastValue;c[0]!==e&&(c[0]=e,this._gl.uniform1f(this._location,e))}Update1i(e){const c=this._lastValue;c[0]!==e&&(c[0]=e,this._gl.uniform1i(this._location,e))}Update2f(e,c){e=Math.fround(e);c=Math.fround(c);const f=this._lastValue;if(f[0]!==e||f[1]!==c)f[0]=e,f[1]=c,this._gl.uniform2f(this._location,e,c)}Update3f(e,c,f){e=Math.fround(e);c=Math.fround(c);f=Math.fround(f);const g=this._lastValue;if(g[0]!==e||g[1]!==c||g[2]!==f)g[0]=e,g[1]=c,g[2]=f,this._gl.uniform3f(this._location,e,c,
|
|
f)}Update4f(e,c,f,g){e=Math.fround(e);c=Math.fround(c);f=Math.fround(f);g=Math.fround(g);const h=this._lastValue;if(h[0]!==e||h[1]!==c||h[2]!==f||h[3]!==g)h[0]=e,h[1]=c,h[2]=f,h[3]=g,this._gl.uniform4f(this._location,e,c,f,g)}UpdateMatrix4fv(e){const c=this._lastValue;a.exactEquals(c,e)||(d.typedArraySet16(c,e,0),this._gl.uniformMatrix4fv(this._location,!1,e))}IsSetToCustomInBatch(e){const c=this._lastBatchValue;return this.IsColorType()?c[0]===Math.fround(e.getR())&&c[1]===Math.fround(e.getG())&&
|
|
c[2]===Math.fround(e.getB()):c[0]===Math.fround(e)}SetBatchValueCustom(e){const c=this._lastBatchValue;this.IsColorType()?(c[0]=e.getR(),c[1]=e.getG(),c[2]=e.getB()):c[0]=e}IsSetTo1InBatch(e){return this._lastBatchValue[0]===Math.fround(e)}IsSetTo2InBatch(e,c){const f=this._lastBatchValue;return f[0]===Math.fround(e)&&f[1]===Math.fround(c)}SetBatch1(e){this._lastBatchValue[0]=e}SetBatch2(e,c){const f=this._lastBatchValue;f[0]=e;f[1]=c}}}
|
|
{"use strict";const d=self.C3,a=self.glMatrix,b=a.vec4,e=a.mat4;d.Gfx.BatchState=class{constructor(c){this.renderer=c;this.currentMV=e.create();this.currentMatP=e.create();this.currentFramebuffer=null;this.currentColor=b.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new d.Rect;this.clearColor=d.New(d.Color,0,0,0,0)}};d.Gfx.WebGLBatchJob=class{constructor(c){const f=new ArrayBuffer(96);this._type=0;this._batchState=c;this._gl=c.renderer.GetContext();this._indexCount=this._startIndex=
|
|
0;this._texParam=null;this._mat4param=new Float32Array(f,0,16);this._colorParam=new Float32Array(f,64,4);this._srcOriginRect=new Float32Array(f,80,4);this._shaderParams=[]}InitQuad(c,f){this._type=1;this._startIndex=c;this._indexCount=f}DoQuad(){const c=this._gl;c.drawElements(c.TRIANGLES,this._indexCount,c.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(c){this._type=2;this._texParam=c}DoSetTexture(){const c=this._gl,f=this._texParam;c.bindTexture(c.TEXTURE_2D,f?f._GetTexture():null)}InitSetColor(c){this._type=
|
|
3;c.writeToTypedArray(this._colorParam,0)}DoSetColor(){const c=this._colorParam,f=this._batchState;b.copy(f.currentColor,c);f.currentShader.UpdateColor(c)}InitSetGradientColor(c){this._type=21;c.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const c=this._colorParam,f=this._batchState.currentShader;f._uColor2.IsUsed()&&f._uColor2.Update4f(c[0],c[1],c[2],c[3])}InitSetBlend(c,f){this._type=4;this._startIndex=c;this._indexCount=f}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitSetViewport(c,
|
|
f,g,h){this._type=5;const l=this._colorParam;l[0]=c;l[1]=f;l[2]=g;l[3]=h}DoSetViewport(){const c=this._colorParam;this._gl.viewport(c[0],c[1],c[2],c[3])}InitSetProjection(c){this._type=6;e.copy(this._mat4param,c)}DoSetProjection(){const c=this._batchState,f=c.renderer._allShaderPrograms,g=c.currentShader,h=this._mat4param;for(let l=0,m=f.length;l<m;++l){const p=f[l];p===g?p.UpdateMatP(h,!0):p.SetMatPStale()}e.copy(c.currentMatP,h)}InitSetModelView(c){this._type=7;e.copy(this._mat4param,c)}DoSetModelView(){const c=
|
|
this._batchState,f=c.renderer._allShaderPrograms,g=c.currentShader,h=this._mat4param;for(let l=0,m=f.length;l<m;++l){const p=f[l];p===g?p.UpdateMatMV(h,!0):p.SetMatMVStale()}e.copy(c.currentMV,h)}InitSetRenderTarget(c){this._type=8;this._texParam=c}DoSetRenderTarget(){const c=this._gl;var f=this._texParam;const g=this._batchState;f?(f=f._GetFramebuffer(),g.currentFramebuffer=f,c.bindFramebuffer(c.FRAMEBUFFER,f)):(g.currentFramebuffer=null,c.bindFramebuffer(c.FRAMEBUFFER,null))}InitClearSurface(c){this._type=
|
|
9;c.writeToTypedArray(this._mat4param,0)}InitClearSurface2(c,f,g,h){this._type=9;const l=this._mat4param;l[0]=c;l[1]=f;l[2]=g;l[3]=h}DoClearSurface(){const c=this._gl;var f=this._mat4param,g=this._batchState;const h=g.clearColor;(g=g.renderer._isScissorViewport&&d.isDebug)&&c.disable(c.SCISSOR_TEST);const l=f[0],m=f[1],p=f[2];f=f[3];h.equalsRgba(l,m,p,f)||(c.clearColor(l,m,p,f),h.setRgba(l,m,p,f));c.clear(c.COLOR_BUFFER_BIT);g&&c.enable(c.SCISSOR_TEST)}InitClearRect(c,f,g,h,l,m,p,x){this._type=10;
|
|
const v=this._mat4param;v[0]=c;v[1]=f;v[2]=g;v[3]=h;v[4]=l;v[5]=m;v[6]=p;v[7]=x}DoClearRectangle(){const c=this._gl;var f=this._mat4param,g=this._batchState;const h=g.renderer;g=g.clearColor;h._isScissorViewport||c.enable(c.SCISSOR_TEST);c.scissor(f[0],f[1],f[2],f[3]);const l=f[4],m=f[5],p=f[6];f=f[7];g.equalsRgba(l,m,p,f)||(c.clearColor(l,m,p,f),g.setRgba(l,m,p,f));c.clear(c.COLOR_BUFFER_BIT);h._isScissorViewport?c.scissor(0,0,h._viewportScissorWidth,h._viewportScissorHeight):c.disable(c.SCISSOR_TEST)}InitSetPointTexCoords(c){this._type=
|
|
15;c.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const c=this._mat4param;this._batchState.pointTexCoords.set(c[0],c[1],c[2],c[3])}InitPoints(c,f){this._type=11;this._startIndex=c;this._indexCount=1;this._mat4param[0]=f}DoPoints(){const c=this._gl,f=this._batchState,g=f.renderer._spPoints;c.useProgram(g._shaderProgram);g.UpdateMatP(f.currentMatP,!1);g.UpdateMatMV(f.currentMV,!1);var h=f.pointTexCoords;g._uPointTexStart.IsUsed()&&g._uPointTexStart.Update2f(h.getLeft(),h.getTop());
|
|
g._uPointTexEnd.IsUsed()&&g._uPointTexEnd.Update2f(h.getRight(),h.getBottom());h=this._mat4param[0];g._uZElevation.IsUsed()&&g._uZElevation.Update1f(h);g._uColor.IsUsed()&&(h=f.currentColor,g._uColor.Update4f(h[0],h[1],h[2],h[3]));c.drawArrays(c.POINTS,this._startIndex/4,this._indexCount);c.useProgram(f.currentShader._shaderProgram)}InitSetProgram(c){this._type=12;this._texParam=c}DoSetProgram(){var c=this._gl;const f=this._batchState,g=this._texParam;f.currentShader=g;c.useProgram(g._shaderProgram);
|
|
g.UpdateMatP(f.currentMatP,!1);g.UpdateMatMV(f.currentMV,!1);g._uColor.IsUsed()&&(c=f.currentColor,g._uColor.Update4f(c[0],c[1],c[2],c[3]))}InitSetProgramParameters(){this._type=13}DoSetProgramParameters(){const c=this._batchState.currentShader;c._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(c);c._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(c)}_DoSetOptionalUniformProgramParameters(c){const f=this._gl,g=this._mat4param,h=this._colorParam,l=this._srcOriginRect;
|
|
if(c._uSamplerBack.IsUsed()){const m=this._batchState.renderer,p=this._texParam;m._lastTexture1!==p&&(f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,p?p._GetTexture():null),m._lastTexture1=p,f.activeTexture(f.TEXTURE0))}c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(g[0],g[1]);c._uDestStart.IsUsed()&&c._uDestStart.Update2f(g[2],g[3]);c._uDestEnd.IsUsed()&&c._uDestEnd.Update2f(g[4],g[5]);c._uLayerScale.IsUsed()&&c._uLayerScale.Update1f(g[6]);c._uLayerAngle.IsUsed()&&c._uLayerAngle.Update1f(g[7]);
|
|
c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(g[12],g[13]);c._uSrcEnd.IsUsed()&&c._uSrcEnd.Update2f(g[14],g[15]);c._uSrcOriginStart.IsUsed()&&c._uSrcOriginStart.Update2f(l[0],l[1]);c._uSrcOriginEnd.IsUsed()&&c._uSrcOriginEnd.Update2f(l[2],l[3]);c._uLayoutStart.IsUsed()&&c._uLayoutStart.Update2f(h[0],h[1]);c._uLayoutEnd.IsUsed()&&c._uLayoutEnd.Update2f(h[2],h[3]);c._uSeconds.IsUsed()&&c._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(c){c=c._uCustomParameters;const f=this._shaderParams;
|
|
for(let g=0,h=c.length;g<h;++g){const l=c[g],m=f[g];l.IsColorType()?l.Update3f(m.getR(),m.getG(),m.getB()):l.Update1f(m)}}InitInvalidateFramebuffer(c){this._type=14;this._texParam=c}DoInvalidateFramebuffer(){const c=this._gl,f=this._texParam,g=this._batchState.currentFramebuffer;f!==g&&c.bindFramebuffer(c.FRAMEBUFFER,f);c.invalidateFramebuffer(c.FRAMEBUFFER,[c.COLOR_ATTACHMENT0]);f!==g&&c.bindFramebuffer(c.FRAMEBUFFER,g)}InitBlitFramebuffer(c,f,g){this._type=17;const h=this._mat4param,l=this._batchState.renderer;
|
|
h[0]=c.GetWidth();h[1]=c.GetHeight();h[2]=f?f.GetWidth():l.GetWidth();h[3]=f?f.GetHeight():l.GetHeight();h[4]=c.IsLinearSampling()?1:0;h[5]="stretch"===g;g=this._shaderParams;d.clearArray(g);g.push(c._GetFramebuffer());g.push(f?f._GetFramebuffer():null)}DoBlitFramebuffer(){var c=this._mat4param,f=this._shaderParams;const g=this._gl;var h=c[0],l=c[1],m=c[2];const p=c[3],x=0!==c[4];c=0!==c[5];const v=f[1];g.bindFramebuffer(g.READ_FRAMEBUFFER,f[0]);g.bindFramebuffer(g.DRAW_FRAMEBUFFER,v);c?g.blitFramebuffer(0,
|
|
0,h,l,0,0,m,p,g.COLOR_BUFFER_BIT,x?g.LINEAR:g.NEAREST):(f=Math.min(h,m),h=Math.min(l,p),m=Math.max(l-p,0),l=Math.max(p-l,0),g.blitFramebuffer(0,m,f,h+m,0,l,f,h+l,g.COLOR_BUFFER_BIT,g.NEAREST))}InitStartQuery(c){this._type=18;this._texParam=c}DoStartQuery(){this._texParam.BeginTimeElapsed();this._texParam=null}InitEndQuery(c){this._type=19;this._texParam=c}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(c,f,g){this._type=20;const h=this._mat4param;h[0]=c;h[1]=
|
|
f;h[2]=g}DoSetEllipseParams(){const c=this._batchState.currentShader,f=this._mat4param;c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(f[0],f[1]);c._uOutlineThickness.IsUsed()&&c._uOutlineThickness.Update1f(f[2])}InitSetTilemapInfo(c,f,g,h,l,m,p){this._type=16;const x=this._mat4param;c.writeToTypedArray(x,0);x[4]=1/f;x[5]=1/g;x[6]=h/f;x[7]=l/g;x[8]=m/f;x[9]=p/g}DoSetTilemapInfo(){const c=this._batchState.currentShader,f=this._mat4param;c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(f[0],f[1]);c._uPixelSize.IsUsed()&&
|
|
c._uPixelSize.Update2f(f[4],f[5]);c._uTileSize.IsUsed()&&c._uTileSize.Update2f(f[6],f[7]);c._uTileSpacing.IsUsed()&&c._uTileSpacing.Update2f(f[8],f[9])}InitClearDepth(){this._type=22}DoClearDepth(){const c=this._gl;c.clear(c.DEPTH_BUFFER_BIT)}InitSetDepthEnabled(c){this._type=23;this._startIndex=c?1:0}DoSetDepthEnabled(){const c=this._gl;0===this._startIndex?(c.disable(c.DEPTH_TEST),c.depthMask(!1)):(c.enable(c.DEPTH_TEST),c.depthMask(!0))}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.DoClearRectangle();break;case 11:this.DoPoints();break;case 12:this.DoSetProgram();break;case 13:this.DoSetProgramParameters();break;case 14:this.DoInvalidateFramebuffer();break;case 15:this.DoSetPointTextureCoords();break;case 16:this.DoSetTilemapInfo();
|
|
break;case 17:this.DoBlitFramebuffer();break;case 18:this.DoStartQuery();break;case 19:this.DoEndQuery();break;case 20:this.DoSetEllipseParams();break;case 21:this.DoSetGradientColor();break;case 22:this.DoClearDepth();break;case 23:this.DoSetDepthEnabled()}}}}
|
|
{"use strict";const d=self.C3,a={timeout:60},b=new d.Color(0,0,0,1),e=new Set(["left","center","right"]),c=new Set(["top","center","bottom"]),f=new Set(["word","character"]),g=new Set;d.FontManager&&d.FontManager.addEventListener("fontload",v=>{v=v.font.GetName();for(const r of g)(r.IsBBCodeEnabled()||d.equalsNoCase(r.GetFontName(),v))&&r._SetTextChanged()});function h(v,r,q,y,u,t){r?"Gecko"===d.Platform.BrowserEngine?v.strokeText(q,y,u,t):v.strokeText(q,y,u):"Gecko"===d.Platform.BrowserEngine?v.fillText(q,
|
|
y,u,t):v.fillText(q,y,u)}function l(v,r,q,y,u,t){r?v.strokeRect(q,y,u,t):v.fillRect(q,y,u,t)}function m(v){return 4/3*v}let p=!1,x=!1;d.Gfx.RendererText=class{constructor(v,r){r=Object.assign({},a,r);this._renderer=v;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=d.New(d.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=(q,y)=>this._MeasureText(q,y);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new d.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new d.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},r.timeout);this.ontextureupdate=null;this._wasReleased=!1;g.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;g.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=!0}SetIsAsync(v){this._isAsync=!!v}IsAsync(){return this._isAsync}SetBBCodeEnabled(v){v=!!v;this._isBBcodeEnabled!==v&&(v=(this._isBBcodeEnabled=v)?"alphabetic":
|
|
"top",this._textContext&&(this._textContext.textBaseline=v),this._measureContext&&(this._measureContext.textBaseline=v),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(v){v||(v="serif");this._fontName!==v&&(this._fontName=v,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(v){.1>v&&(v=.1);this._fontSize!==v&&(this._fontSize=v,this._SetTextChanged())}SetFontSizeScale(v){this._fontSizeScale!==v&&(this._fontSizeScale=v,this._SetTextChanged())}SetLineHeight(v){this._lineHeight!==
|
|
v&&(this._lineHeight=v,this._SetChanged())}SetBold(v){v=!!v;this._isBold!==v&&(this._isBold=v,this._SetTextChanged())}SetItalic(v){v=!!v;this._isItalic!==v&&(this._isItalic=v,this._SetTextChanged())}SetDrawMaxCharacterCount(v){v=Math.floor(v);this._drawMaxCharCount!==v&&(this._drawMaxCharCount=v,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(v,r){for(let q=v.length-1;0<=q;--q){const y=v[q];if(y.tag===r)return y}return null}_HasStyleTag(v,r){return!!this._GetStyleTag(v,
|
|
r)}_GetFontString(v,r){let q=[];(this._isBold||this._HasStyleTag(r,"b"))&&q.push("bold");(this._isItalic||this._HasStyleTag(r,"i"))&&q.push("italic");var y=this._GetStyleTag(r,"size");y=(y?parseFloat(y.param):this._fontSize)*this._fontSizeScale;v?q.push(y+"pt"):q.push(y*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");v=this._fontName;(r=this._GetStyleTag(r,"font"))&&r.param&&(v=r.param,this.onloadfont&&!this._alreadyLoadedFonts.has(v)&&(this.onloadfont(v),this._alreadyLoadedFonts.add(v)));
|
|
v&&q.push('"'+v+'"');return q.join(" ")}SetColor(v){v instanceof d.Color&&(v=v.getCssRgb());this._colorStr!==v&&(this._colorStr=v,this._SetChanged())}SetColorRgb(v,r,q){b.setRgb(v,r,q);this.SetColor(b)}SetHorizontalAlignment(v){if(!e.has(v))throw Error("invalid horizontal alignment");this._horizontalAlign!==v&&(this._horizontalAlign=v,this._SetChanged())}SetVerticalAlignment(v){if(!c.has(v))throw Error("invalid vertical alignment");this._verticalAlign!==v&&(this._verticalAlign=v,this._SetChanged())}SetWordWrapMode(v){if(!f.has(v))throw Error("invalid word wrap mode");
|
|
this._wrapMode!==v&&(this._wrapMode=v,this._SetTextChanged())}SetText(v){this._text!==v&&(this._text=v,this._SetTextChanged())}SetSize(v,r,q){"undefined"===typeof q&&(q=1);if(!(0>=v||0>=v||this._cssWidth===v&&this._cssHeight===r&&this._zoom===q)){1===this._zoom!==(1===q)&&(this._needToRecreateTexture=!0);var y=this._cssWidth,u=this._zoom;this._cssWidth=v;this._cssHeight=r;this._zoom=q;v=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*v;this._height=this._cssHeight*this._zoom*v;v=Math.max(this._width,
|
|
this._height);r=Math.min(this._renderer.GetMaxTextureSize(),2048);q=1;v>r&&(q=r/v,this._width=Math.min(this._width*q,r),this._height=Math.min(this._height*q,r));this._scaleFactor=q;0<this._textureWidth&&0<this._textureHeight&&this._zoom===u&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);this._cssWidth!==y?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?d.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(v,r){this._textCanvas||(this._textCanvas=d.CreateCanvas(16,16));let q=!1;if(this._lastCanvasWidth!==v||this._lastCanvasHeight!==r)this._lastCanvasWidth=v,this._lastCanvasHeight=r,this._textCanvas.width=v,this._textCanvas.height=r,q=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),q=!0);q?(this._textContext.textBaseline=this._isBBcodeEnabled?
|
|
"alphabetic":"top",this._textContext.font=this._lastTextCanvasFont,this._textContext.fillStyle=this._lastTextCanvasFillStyle,this._textContext.strokeStyle=this._lastTextCanvasFillStyle,this._textContext.globalAlpha=this._lastTextCanvasOpacity,this._textContext.lineWidth=this._lastTextCanvasLineWidth):this._textContext.clearRect(0,0,v,r)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=d.CreateCanvas(16,16).getContext("2d"),this._measureContextTop=d.CreateCanvas(16,16).getContext("2d"),
|
|
this._measureContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._measureContextTop.textBaseline="top")}_SetMeasureFontString(v){this._lastMeasureCanvasFont!==v&&(this._lastMeasureCanvasFont=v,this._measureContext.font=v,this._measureContextTop.font=v)}_SupportsFontBoundingBoxMeasurements(){if(!p){p=!0;this._MaybeCreateMeasureContext();const v=this._measureContext.measureText("test");x="number"===typeof v.fontBoundingBoxAscent&&"number"===typeof v.fontBoundingBoxDescent}return x}_MaybeWrapText(){this._textChanged&&
|
|
(this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||this._bbString&&this._bbString.toString()===this._text||(this._bbString=new d.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(v,r){this._SetMeasureFontString(this._GetFontString(!0,r));r=this._GetStyleTag(r,"size");r=(r?parseFloat(r.param):this._fontSize)*this._fontSizeScale;
|
|
const q=this._measureContext.measureText(v);let y=0;this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements()&&(v=this._measureContextTop.measureText(v),y=q.fontBoundingBoxAscent-v.fontBoundingBoxAscent);return{width:q.width,height:m(r),fontBoundingBoxAscent:q.fontBoundingBoxAscent||0,fontBoundingBoxDescent:q.fontBoundingBoxDescent||0,topToAlphabeticDistance:y}}_SetDrawFontString(v){this._lastTextCanvasFont!==v&&(this._lastTextCanvasFont=v,this._textContext.font=v)}_SetDrawCanvasColor(v){this._lastTextCanvasFillStyle!==
|
|
v&&(this._lastTextCanvasFillStyle=v,this._textContext.fillStyle=v,this._textContext.strokeStyle=v)}_SetDrawCanvasOpacity(v){this._lastTextCanvasOpacity!==v&&(this._lastTextCanvasOpacity=v,this._textContext.globalAlpha=v)}_SetDrawCanvasLineWith(v){this._lastTextCanvasLineWidth!==v&&(this._lastTextCanvasLineWidth=v,this._textContext.lineWidth=v)}_DrawTextToCanvas(){this._drawCharCount=0;const v=this._scaleFactor*this._zoom*self.devicePixelRatio,r=(4+this._lineHeight)*v;var q=0;const y=this._wrappedText.GetLines();
|
|
if(0!==y.length){var u=this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements(),t=y[0].height*v;"center"===this._verticalAlign?(q=y.reduce((A,z)=>A+z.height*v+r,0)-r,q=Math.max(this._height/2-q/2,0),u&&(t=y[0].topToAlphabeticDistance*v)):"bottom"===this._verticalAlign&&(q=y.reduce((A,z)=>A+z.height*v+r,0)-this._lineHeight*v,q=this._height-q-(u?y[y.length-1].fontBoundingBoxDescent*v:0)-2);for(let A=0,z=y.length;A<z;++A){u=y[A];const C=u.height*v,E=q;if(this._isBBcodeEnabled){if(q+=0===A?
|
|
t:C,0<A&&q>this._height-4*v)break}else if(0<A&&q>=this._height-C)break;0<=E&&this._DrawTextLine(u,q,v);this._isBBcodeEnabled||(q+=C);q+=r}}}_DrawTextLine(v,r,q){let y=0;"center"===this._horizontalAlign?y=(this._width-v.width*q)/2:"right"===this._horizontalAlign&&(y=this._width-v.width*q);for(const u of v.fragments)this._DrawTextFragment(u,y,r,q,v.height),y+=u.width*q}_DrawTextFragment(v,r,q,y,u){const t=this._textContext,A=u/16;u=v.width*y;const z=v.height*y,C=v.height/16;var E=(4+this._lineHeight)*
|
|
y;const J=v.styles;v=v.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+v.length>this._drawMaxCharCount&&(v=v.substr(0,this._drawMaxCharCount-this._drawCharCount),u=this._MeasureText(v,J).width*y);this._drawCharCount+=v.length}const G=this._GetStyleTag(J,"background"),I=this._HasStyleTag(J,"u"),L=this._HasStyleTag(J,"s");if((!d.IsStringAllWhitespace(v)||G||I||L)&&!this._HasStyleTag(J,"hide")){var N=this._GetStyleTag(J,"offsetx");r+=N?parseFloat(N.param)*
|
|
y:0;N=this._GetStyleTag(J,"offsety");q+=N?parseFloat(N.param)*y:0;G&&(this._SetDrawCanvasColor(G.param),t.fillRect(r,q-z,u,z+E));E=this._GetStyleTag(J,"color");this._SetDrawCanvasColor(E?E.param:this._colorStr);E=this._GetStyleTag(J,"opacity");this._SetDrawCanvasOpacity(E?parseFloat(E.param)/100:1);(E=this._HasStyleTag(J,"stroke"))&&this._SetDrawCanvasLineWith(C*this._scaleFactor*this._zoom);I&&l(t,E,r,q+y*A,u,y*A);L&&l(t,E,r,q-z/4,u,y*C);this._SetDrawFontString(this._GetFontString(!1,J));h(t,E,v,
|
|
r,q,u);!E&&(this._SetDrawCanvasLineWith(C*this._scaleFactor*this._zoom),y=this._GetStyleTag(J,"outline"))&&(this._SetDrawCanvasColor(y.param),h(t,!0,v,r,q,u))}}_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 v of g)v.ReleaseTexture()}static GetAll(){return g.values()}}}
|
|
{"use strict";const d=self.C3;class a{constructor(b){this._gl=b.GetContext();this._version=b.GetWebGLVersionNumber();this._timerExt=b._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 b=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_AVAILABLE_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT_AVAILABLE);var e=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);b&&!e&&(this._result=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT),this._result/=1E9,this._hasResult=!0);(b||
|
|
e)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}d.Gfx.WebGLTimeElapsedQuery=class{constructor(b){this._renderer=b;this._frameNumber=b.GetFrameNumber();this._isActive=!1;this._parentQuery=null;this._isNested=!1;this._realQuery=null;this._queries=[]}Release(){for(const b of this._queries)b instanceof a&&b.Release();d.clearArray(this._queries);this._renderer=this._realQuery=this._parentQuery=null}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");
|
|
const b=this._renderer._GetTimeQueryStack();0<b.length?(this._isNested=!0,this._parentQuery=b[b.length-1],this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null);this._isActive=!0;b.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=d.New(a,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const b of this._queries)b.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(b=>b.HasResult())}GetResult(){return this._queries.reduce((b,e)=>b+e.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}}
|
|
{"use strict";const d=self.C3;d.Gfx.WebGLQueryResultBuffer=class{constructor(a,b=1E3){this._renderer=a;this._maxQueries=b;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const a of this._buffer)a.Release();d.clearArray(this._buffer)}AddTimeElapsedQuery(){const a=new d.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(a);this._buffer.length>this._maxQueries&&this._buffer.shift().Release();
|
|
return a}CheckForResults(a){for(const b of this._buffer){if(b.GetFrameNumber()>=a)break;if(b.IsNested())break;b.CheckForResult()}}GetFrameRangeResultSum(a,b){if(b<=a)return NaN;let e=0;for(const c of this._buffer){if(c.GetFrameNumber()>=b)break;if(!(c.GetFrameNumber()<a))if(c.HasResult())e+=c.GetResult();else return NaN}return e}DeleteAllBeforeFrameNumber(a){for(let b=0,e=this._buffer.length;b<e;++b){const c=this._buffer[b];if(c.GetFrameNumber()<a)c.Release();else{0<b&&this._buffer.splice(0,b);break}}}}}
|
|
{"use strict";const d=self.C3,a=self.glMatrix,b=a.vec4,e=a.mat4,c={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,depth:!1,maxWebGLVersion:2},f=new Set(["default","low-power","high-performance"]),g=new d.Quad(0,0,1,0,1,1,0,1),h=e.create(),l=e.create(),m=new d.Quad,p=new d.Rect;let x=null;d.isDebug&&(self.debug_lose_context=function(){x?x.loseContext():console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=function(){x?x.restoreContext():console.warn("WEBGL_lose_context not supported")});
|
|
const v=new Set;let r=-1;function q(){r=-1;for(const u of v)u.checkFunc()&&(u.resolve(),v.delete(u));0<v.size&&(r=self.requestAnimationFrame(q))}function y(u,t,A){if(2<=A&&(A=u.getContext("webgl2",t)))return{gl:A,version:2};A=u.getContext("webgl",t);return{gl:A,version:1}}d.Gfx.WebGLRenderer=class extends d.Gfx.RendererBase{constructor(u,t){super();t=Object.assign({},c,t);if(!f.has(t.powerPreference))throw Error("invalid power preference");let A=!1;const z={alpha:!!t.alpha,depth:!1,antialias:!1,powerPreference:t.powerPreference,
|
|
failIfMajorPerformanceCaveat:!0};t.lowLatency&&(z.desynchronized=!0,z.preserveDrawingBuffer=!0);let C=y(u,z,t.maxWebGLVersion);C.gl||(A=!0,z.failIfMajorPerformanceCaveat=!1,C=y(u,z,t.maxWebGLVersion));if(!C.gl)throw Error("failed to initialise WebGL context");this._gl=u=C.gl;this._attribs=u.getContextAttributes();t.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=u.getParameter(u.VERSION);this._version=
|
|
C.version;this._viewport=b.create();this._bbProjectionMatrix=e.create();this._isDepthEnabled=this._usesDepthBuffer=!!t.depth;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=d.New(d.Gfx.BatchState,this);this._lastColor=d.New(d.Color,1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._lastDestBlend=this._lastSrcBlend=0;this._isScissorViewport=!1;this._viewportScissorHeight=this._viewportScissorWidth=-1;this._lastPointTexCoords=new d.Rect;this._maxTextureSize=
|
|
-1;this._highpPrecision=this._maxPointSize=this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._hasMajorPerformanceCaveat=A;this._isInitialisingAfterContextRestored=!1;this._anisotropicExt=this._parallelShaderCompileExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled=!!t.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return!0}async InitState(){super.InitState();
|
|
var u=this._gl,t=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*t-4*t;d.clearArray(this._batch);this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;t=this._batchState;t.currentShader=null;t.currentFramebuffer=null;b.set(t.currentColor,1,1,1,1);t.clearColor.setRgba(0,0,0,0);t.pointTexCoords.set(0,
|
|
0,1,1);u.clearColor(0,0,0,0);u.clear(u.COLOR_BUFFER_BIT);u.enable(u.BLEND);u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=u.ONE;this._lastDestBlend=u.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(u);u.disable(u.CULL_FACE);u.disable(u.STENCIL_TEST);u.disable(u.DITHER);this._usesDepthBuffer?(u.enable(u.DEPTH_TEST),u.depthMask(!0),u.depthFunc(u.LEQUAL)):(u.disable(u.DEPTH_TEST),u.depthMask(!1));this._isDepthEnabled=this._usesDepthBuffer;this._pointBuffer=u.createBuffer();u.bindBuffer(u.ARRAY_BUFFER,
|
|
this._pointBuffer);u.bufferData(u.ARRAY_BUFFER,this._pointData.byteLength,u.DYNAMIC_DRAW);this._vertexBuffer=u.createBuffer();u.bindBuffer(u.ARRAY_BUFFER,this._vertexBuffer);u.bufferData(u.ARRAY_BUFFER,this._vertexData.byteLength,u.DYNAMIC_DRAW);this._texcoordBuffer=u.createBuffer();u.bindBuffer(u.ARRAY_BUFFER,this._texcoordBuffer);u.bufferData(u.ARRAY_BUFFER,this._texcoordData.byteLength,u.DYNAMIC_DRAW);this._indexBuffer=u.createBuffer();u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,this._indexBuffer);u.bufferData(u.ELEMENT_ARRAY_BUFFER,
|
|
this._indexData,u.STATIC_DRAW);u.activeTexture(u.TEXTURE0);u.bindTexture(u.TEXTURE_2D,null);this._maxTextureSize=u.getParameter(u.MAX_TEXTURE_SIZE);t=u.getParameter(u.ALIASED_POINT_SIZE_RANGE);this._minPointSize=t[0];this._maxPointSize=t[1];t=u.getShaderPrecisionFormat(u.VERTEX_SHADER,u.HIGH_FLOAT);const A=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_FLOAT);this._highpPrecision=t&&A?Math.min(t.precision,A.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=u.getSupportedExtensions();
|
|
if(t=u.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor=u.getParameter(t.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=u.getParameter(t.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=u.getExtension("KHR_parallel_shader_compile");d.isDebug&&(x=u.getExtension("WEBGL_lose_context"));if(this._isGpuProfilingEnabled)if(1===this.GetWebGLVersionNumber()){if("Chromium"!==d.Platform.BrowserEngine||81<=d.Platform.BrowserVersionNumber||"undefined"!==typeof document)this._timerExt=u.getExtension("EXT_disjoint_timer_query")}else this._timerExt=
|
|
u.getExtension("EXT_disjoint_timer_query_webgl2")||u.getExtension("EXT_disjoint_timer_query");this._maxAnisotropy=(this._anisotropicExt=u.getExtension("EXT_texture_filter_anisotropic"))?u.getParameter(this._anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;u=d.Gfx.WebGLShaderProgram;t=u.GetDefaultVertexShaderSource(!1);u=[[u.GetTextureFillFragmentShaderSource(),t,"<default>"],[u.GetTextureFillFragmentShaderSource(),t,"<default-device-transform>"],[u.GetPointFragmentShaderSource(),u.GetPointVertexShaderSource(),
|
|
"<point>"],[u.GetColorFillFragmentShaderSource(),t,"<fill>"],[u.GetLinearGradientFillFragmentShaderSource(),t,"<lineargradient>"],[u.GetHardEllipseFillFragmentShaderSource(),t,"<hardellipse>"],[u.GetHardEllipseOutlineFragmentShaderSource(),t,"<hardellipseoutline>"],[u.GetSmoothEllipseFillFragmentShaderSource(),t,"<smoothellipse>"],[u.GetSmoothEllipseOutlineFragmentShaderSource(),t,"<smoothellipseoutline>"],[u.GetSmoothLineFillFragmentShaderSource(),t,"<smoothline>"],[u.GetTilemapFragmentShaderSource(),
|
|
u.GetDefaultVertexShaderSource(!0),"<tilemap>"]];u=await Promise.all(u.map(z=>this.CreateShaderProgram({src:z[0]},z[1],z[2])));this._spTextureFill=u[0];this._spDeviceTransformTextureFill=u[1];this._spPoints=u[2];this._spColorFill=u[3];this._spLinearGradientFill=u[4];this._spHardEllipseFill=u[5];this._spHardEllipseOutline=u[6];this._spSmoothEllipseFill=u[7];this._spSmoothEllipseOutline=u[8];this._spSmoothLineFill=u[9];this._spTilemapFill=u[10];this.SetTextureFillMode()}async CreateShaderProgram(u,
|
|
t,A){u=await d.Gfx.WebGLShaderProgram.Create(this,u,t,A);this._AddShaderProgram(u);return u}ResetLastProgram(){this._lastProgram=null}SetSize(u,t,A){if(this._width!==u||this._height!==t||A){this.EndBatch();A=this._gl;var z=this._batchState;this._width=u;this._height=t;u=this.GetScissoredViewportWidth();t=this.GetScissoredViewportHeight();this._SetViewport(0,0,u,t);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,u/t);this.SetProjectionMatrix(this._bbProjectionMatrix);this._spDeviceTransformTextureFill&&
|
|
(A.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,this._batchState.currentShader=this._spDeviceTransformTextureFill);A.bindTexture(A.TEXTURE_2D,null);A.activeTexture(A.TEXTURE1);A.bindTexture(A.TEXTURE_2D,null);A.activeTexture(A.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);A.bindFramebuffer(A.FRAMEBUFFER,null);this._currentRenderTarget=null;z.currentFramebuffer=null}}_SetDepthBufferSize(u,t){const A=this._gl;if(this._depthBuffer){if(this._depthBufferWidth===u&&this._depthBufferHeight===t)return;A.deleteRenderbuffer(this._depthBuffer)}this._depthBuffer=A.createRenderbuffer();A.bindRenderbuffer(A.RENDERBUFFER,this._depthBuffer);A.renderbufferStorage(A.RENDERBUFFER,2<=
|
|
this._version?A.DEPTH_COMPONENT24:A.DEPTH_COMPONENT16,u,t);A.bindRenderbuffer(A.RENDERBUFFER,null);this._depthBufferWidth=u;this._depthBufferHeight=t}SetFixedSizeDepthBuffer(u,t){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!1,this._SetDepthBufferSize(u,t))}SetAutoSizeDepthBuffer(){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!0,this._SetDepthBufferSize(this._width,this._height))}SetViewportScissor(u,t){const A=this._gl;if(this._width===u&&this._height===t)this._isScissorViewport&&(this.EndBatch(),
|
|
A.disable(A.SCISSOR_TEST),this._isScissorViewport=!1,this._viewportScissorHeight=this._viewportScissorWidth=-1,this.SetSize(this._width,this._height,!0));else if(this._isScissorViewport||(this.EndBatch(),A.enable(A.SCISSOR_TEST),this._isScissorViewport=!0),this._viewportScissorWidth!==u||this._viewportScissorHeight!==t)this.EndBatch(),A.scissor(0,0,u,t),this._viewportScissorWidth=u,this._viewportScissorHeight=t,this.SetSize(this._width,this._height,!0)}RemoveViewportScissor(){const u=this._gl;this._isScissorViewport&&
|
|
(this.EndBatch(),u.disable(u.SCISSOR_TEST),this._isScissorViewport=!1);this._viewportScissorHeight=this._viewportScissorWidth=-1}GetScissoredViewportWidth(){return this._isScissorViewport?this._viewportScissorWidth:this.GetWidth()}GetScissoredViewportHeight(){return this._isScissorViewport?this._viewportScissorHeight:this.GetHeight()}_SetViewport(u,t,A,z){const C=this._viewport;if(C[0]!==u||C[1]!==t||C[2]!==A||C[3]!==z)this.PushBatch().InitSetViewport(u,t,A,z),b.set(C,u,t,A,z),this._topOfBatch=0}SetProjectionMatrix(u){e.exactEquals(this._matP,
|
|
u)||(this.PushBatch().InitSetProjection(u),e.copy(this._matP,u),this._topOfBatch=0)}SetDefaultRenderTargetProjectionState(){let u,t;var A=this._currentRenderTarget;null===A||A.IsDefaultSize()&&this._isScissorViewport?(u=this._bbProjectionMatrix,t=this.GetScissoredViewportWidth(),A=this.GetScissoredViewportHeight()):(u=A.GetProjectionMatrix(),t=A.GetWidth(),A=A.GetHeight());this.SetProjectionMatrix(u);this._SetViewport(0,0,t,A)}SetModelViewMatrix(u){e.exactEquals(this._matMV,u)||(this.PushBatch().InitSetModelView(u),
|
|
e.copy(this._matMV,u),this._topOfBatch=0)}GetBatchState(){return this._batchState}PushBatch(){const u=this._batch;this._batchPtr===u.length&&u.push(new d.Gfx.WebGLBatchJob(this._batchState));return u[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 u=this._gl;0<this._pointPtr&&(u.bindBuffer(u.ARRAY_BUFFER,this._pointBuffer),u.bufferSubData(u.ARRAY_BUFFER,
|
|
0,this._pointData.subarray(0,this._pointPtr)));0<this._vertexPtr&&(u.bindBuffer(u.ARRAY_BUFFER,this._vertexBuffer),u.bufferSubData(u.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr)),u.bindBuffer(u.ARRAY_BUFFER,this._texcoordBuffer),u.bufferSubData(u.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const u=this._batch;for(let t=0,A=this._batchPtr;t<A;++t)u[t].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(u,t,A,z){const C=this._lastColor;C.equalsRgba(u,
|
|
t,A,z)||(C.setRgba(u,t,A,z),this.PushBatch().InitSetColor(C),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(u){const t=this._lastColor;t.getA()!==u&&(t.setA(u),this.PushBatch().InitSetColor(t),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(u){const t=this._lastColor;t.equals(u)||(t.set(u),this.PushBatch().InitSetColor(t),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(u){u!==this._lastTexture0&&
|
|
(this.PushBatch().InitSetTexture(u),this._lastTexture0=u,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(u){u=this._GetBlendByIndex(u);this._SetBlend(u[0],u[1])}SetNamedBlendMode(u){u=this.GetNamedBlend(u);this._SetBlend(u.srcBlend,u.destBlend)}_SetBlend(u,t){if(u!==this._lastSrcBlend||t!==this._lastDestBlend)this.PushBatch().InitSetBlend(u,t),this._lastSrcBlend=u,this._lastDestBlend=t,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(u){this.Rect2(u.getLeft(),u.getTop(),u.getRight(),u.getBottom())}Rect2(u,t,A,z){this.Quad2(u,t,A,t,A,z,u,z)}_ExtendQuadBatch(){let u=this._vertexPtr;u>=this._lastVertexPtr&&(this.EndBatch(),u=0);1===this._topOfBatch?
|
|
this._batch[this._batchPtr-1]._indexCount+=6:(this.PushBatch().InitQuad(u,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(u){u.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ);this._vertexPtr+=12}Quad(u){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(u);g.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(u,t,A,z,C,E,J,G){this._ExtendQuadBatch();const I=this._vertexData;let L=this._vertexPtr;const N=this._baseZ+this._currentZ;I[L++]=u;I[L++]=
|
|
t;I[L++]=N;I[L++]=A;I[L++]=z;I[L++]=N;I[L++]=C;I[L++]=E;I[L++]=N;I[L++]=J;I[L++]=G;I[L++]=N;this._vertexPtr=L;g.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(u,t){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(u);t.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(u,t){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(u);t.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(u,t,A,z,C,E,J,G,I,L,N,S,X){this._ExtendQuadBatch();
|
|
const U=this._vertexData;let W=this._vertexPtr;const ia=this._baseZ+this._currentZ;U[W++]=u;U[W++]=t;U[W++]=ia+A;U[W++]=z;U[W++]=C;U[W++]=ia+E;U[W++]=J;U[W++]=G;U[W++]=ia+I;U[W++]=L;U[W++]=N;U[W++]=ia+S;this._vertexPtr=W;X.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D2(u,t,A,z,C,E,J,G,I,L,N,S,X){this._ExtendQuadBatch();const U=this._vertexData;let W=this._vertexPtr;const ia=this._baseZ+this._currentZ;U[W++]=u;U[W++]=t;U[W++]=ia+A;U[W++]=z;U[W++]=C;U[W++]=ia+E;U[W++]=
|
|
J;U[W++]=G;U[W++]=ia+I;U[W++]=L;U[W++]=N;U[W++]=ia+S;this._vertexPtr=W;X.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(u,t){e.copy(h,this._matP);e.copy(l,this._matMV);this.SetDefaultRenderTargetProjectionState();if(this._isScissorViewport){u=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0);this.SetModelViewMatrix(u);u=this._viewportScissorWidth/2;var A=this._viewportScissorHeight/2;p.set(-u,A,-u+this._viewportScissorWidth,
|
|
A-this._viewportScissorHeight);m.setFromRect(p);p.set(0,0,this._viewportScissorWidth/this._width,this._viewportScissorHeight/this._height);this.Quad3(m,p)}else{const [E,J]=this.GetRenderTargetSize(this._currentRenderTarget);A=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ()*self.devicePixelRatio,0,0,0,J);this.SetModelViewMatrix(A);if("crop"===u&&this._currentRenderTarget&&t){u=this._width/2;A=this._height/2;const G=t.GetWidth();t=t.GetHeight();var z=this._currentRenderTarget.GetWidth(),
|
|
C=this._currentRenderTarget.GetHeight();z=Math.min(z,G);const I=Math.min(C,t),L=Math.max(t-C,0);C=Math.max(C-t,0);p.set(-u,A-C,-u+z,A-I-C);m.setFromRect(p);p.set(0,L,z,I+L);p.divide(G,t);this.Quad3(m,p)}else u=E/2,A=J/2,this.Rect2(-u,A,u,-A)}this.SetProjectionMatrix(h);this.SetModelViewMatrix(l)}StartRenderingPoints(u){this._lastPointTexCoords.equals(u)||(this._lastPointTexCoords.copy(u),this.PushBatch().InitSetPointTexCoords(u),this._topOfBatch=0)}FinishRenderingPoints(){}Point(u,t,A,z){7996<=this._pointPtr&&
|
|
this.EndBatch();let C=this._pointPtr;var E=this._baseZ+this._currentZ;2===this._topOfBatch&&this._lastPointZ===E?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(C,E),this._topOfBatch=2,this._lastPointZ=E);E=this._pointData;E[C++]=u;E[C++]=t;E[C++]=A;E[C++]=z;this._pointPtr=C}SetProgram(u){this._lastProgram!==u&&(this.PushBatch().InitSetProgram(u),this._lastProgram=u,this._topOfBatch=0,this._currentStateGroup=null)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(u){this.PushBatch().InitSetGradientColor(u);
|
|
this._topOfBatch=0}SetEllipseParams(u,t,A=1){this.PushBatch().InitSetEllipseParams(u,t,A);this._topOfBatch=0}SetTilemapInfo(u,t,A,z,C,E,J){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(u,t,A,z,C,E,J);this._topOfBatch=0}SetProgramParameters(u,t,A,z,C,E,J,G,I,L,N){const S=this._lastProgram;var X=S._hasAnyOptionalUniforms;const U=!!N.length;if(X&&!S.AreOptionalUniformsAlreadySetInBatch(t,A,z,C,E,J,G,I,L)||U&&!S.AreCustomParametersAlreadySetInBatch(N)){var W=
|
|
this.PushBatch();W.InitSetProgramParameters();X&&(S.SetOptionalUniformsInBatch(t,A,z,C,E,J,G,I,L),X=W._mat4param,X[0]=E,X[1]=J,t.writeToTypedArray(X,2),X[6]=G,X[7]=I,A.writeToTypedArray(X,12),t=W._colorParam,C.writeToTypedArray(t,0),C=t[1],t[1]=t[3],t[3]=C,z.writeToTypedArray(W._srcOriginRect,0),W._startIndex=L,S._uSamplerBack.IsUsed()?W._texParam=u?u.GetTexture():null:W._texParam=null);U&&(S.SetCustomParametersInBatch(N),d.shallowAssignArray(W._shaderParams,N));this._topOfBatch=0}}ClearRgba(u,t,
|
|
A,z){this.PushBatch().InitClearSurface2(u,t,A,z);this._topOfBatch=0}Clear(u){this.PushBatch().InitClearSurface(u);this._topOfBatch=0}ClearRect(u,t,A,z){this.ClearRect4(u,t,A,z,0,0,0,0)}ClearRect2(u){this.ClearRect4(u.getLeft(),u.getTop(),u.width(),u.height(),0,0,0,0)}ClearRect3(u,t){this.ClearRect4(u.getLeft(),u.getTop(),u.width(),u.height(),t.getR(),t.getG(),t.getB(),t.getA())}ClearRect4(u,t,A,z,C,E,J,G){0>A||0>z||(this.PushBatch().InitClearRect(u,t,A,z,C,E,J,G),this._topOfBatch=0)}Start(){}Finish(){super.Finish();
|
|
this._gl.flush()}ClearDepth(){this._usesDepthBuffer&&this._currentRenderTarget&&this._currentRenderTarget.HasDepthBuffer()&&(this.PushBatch().InitClearDepth(),this._topOfBatch=0)}SetDepthEnabled(u){u=!!u;this._isDepthEnabled!==u&&this._usesDepthBuffer&&(this._isDepthEnabled=u,this.PushBatch().InitSetDepthEnabled(u),this._topOfBatch=0)}_GetDepthBuffer(){return this._depthBuffer}CheckForQueryResults(){for(const u of this._allQueryResultBuffers)u.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||
|
|
this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();d.Gfx.WebGLRendererTexture.OnContextLost();d.Gfx.WebGLRenderTarget.OnContextLost();d.Gfx.RendererText.OnContextLost();for(const u of this._allQueryResultBuffers)u.Clear();this._extensions=[];this._anisotropicExt=this._parallelShaderCompileExt=this._timerExt=null;this._maxAnisotropy=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._depthBuffer=this._spDeviceTransformTextureFill=
|
|
this._lastProgram=null;for(const u of this._stateGroups.values())u.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored=!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const u of this._stateGroups.values())u.OnContextRestored(this);this.SetSize(this._width,this._height,!0)}CreateStaticTexture(u,t){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const A=d.New(d.Gfx.WebGLRendererTexture,this);A._CreateStatic(u,t);return A}CreateStaticTextureAsync(u,
|
|
t){if(this.IsContextLost())return Promise.reject("context lost");t=Object.assign({},t);const A=t.wrapX&&"clamp-to-edge"!==t.wrapX||t.wrapY&&"clamp-to-edge"!==t.wrapY;if(!d.Supports.ImageBitmapOptions||!this.SupportsNPOTTextures()&&A)return d.Supports.ImageBitmap?createImageBitmap(u).then(z=>d.Asyncify(()=>this.CreateStaticTexture(z,t))):u instanceof Blob?d.BlobToImage(u,!0).then(z=>this.CreateStaticTextureAsync(z,t)):"undefined"!==typeof HTMLImageElement&&u instanceof HTMLImageElement&&"function"===
|
|
typeof u.decode?u.decode().then(()=>d.Asyncify(()=>this.CreateStaticTexture(u,t))):d.Asyncify(()=>this.CreateStaticTexture(u,t));t.premultiplyAlpha=!1;return createImageBitmap(u,{premultiplyAlpha:"premultiply"}).then(z=>d.Asyncify(()=>this.CreateStaticTexture(z,t)))}CreateDynamicTexture(u,t,A){this.EndBatch();const z=d.New(d.Gfx.WebGLRendererTexture,this);z._CreateDynamic(u,t,A);return z}UpdateTexture(u,t,A){this.EndBatch();t._Update(u,A)}DeleteTexture(u){u&&(u.SubtractReference(),0<u.GetReferenceCount()||
|
|
(this.EndBatch(),u===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),u===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),u._Delete()))}CreateRenderTarget(u){let t=this._width,A=this._height,z=!0;u&&("number"===typeof u.width&&(t=u.width,z=!1),"number"===typeof u.height&&(A=u.height,z=!1));if(0>=t||0>=A)throw Error("invalid size");
|
|
this.EndBatch();const C=d.New(d.Gfx.WebGLRenderTarget,this);C._Create(t,A,Object.assign({isDefaultSize:z},u));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;return C}SetRenderTarget(u){u!==this._currentRenderTarget&&(u&&u.IsDefaultSize()&&u._Resize(this._width,this._height),this.PushBatch().InitSetRenderTarget(u),this._currentRenderTarget=u,this._topOfBatch=0,this.SetDefaultRenderTargetProjectionState())}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(u){return u?
|
|
[u.GetWidth(),u.GetHeight()]:[this._width,this._height]}CopyRenderTarget(u,t="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(u,t)):(this.PushBatch().InitBlitFramebuffer(u,this._currentRenderTarget,t),this._topOfBatch=0)}DrawRenderTarget(u,t="stretch"){u=u.GetTexture();if(!u)throw Error("not a texture-backed render target");this.SetTexture(u);this.FullscreenQuad(t,u)}InvalidateRenderTarget(u){2>
|
|
this._version||(this.PushBatch().InitInvalidateFramebuffer(u._GetFramebuffer()),this._topOfBatch=0)}DeleteRenderTarget(u){this.SetRenderTarget(null);this.EndBatch();const t=u.GetTexture();t===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);t===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);u._Delete()}async ReadBackRenderTargetToImageData(u,
|
|
t,A){this.EndBatch();const z=this._currentRenderTarget;if(u){var C=u.GetWidth();var E=u.GetHeight();var J=u._GetFramebuffer()}else C=this.GetWidth(),E=this.GetHeight(),J=null;let G=u=0;var I=C,L=E;A&&(u=d.clamp(Math.floor(A.getLeft()),0,C-1),G=d.clamp(Math.floor(A.getTop()),0,E-1),I=A.width(),I=0===I?C-u:d.clamp(Math.floor(I),0,C-u),L=A.height(),L=0===L?E-G:d.clamp(Math.floor(L),0,E-G),G=E-(G+L));const N=this._gl;N.bindFramebuffer(N.FRAMEBUFFER,J);E=()=>{N.bindFramebuffer(N.FRAMEBUFFER,null);this._currentRenderTarget=
|
|
null;this._batchState.currentFramebuffer=null;this.SetRenderTarget(z)};if(!t&&2<=this.GetWebGLVersionNumber()){N.bindFramebuffer(N.READ_FRAMEBUFFER,J);J=N.createBuffer();A=I*L*4;C=N.PIXEL_PACK_BUFFER;N.bindBuffer(C,J);N.bufferData(C,A,N.STREAM_READ);N.readPixels(u,G,I,L,N.RGBA,N.UNSIGNED_BYTE,0);N.bindFramebuffer(N.READ_FRAMEBUFFER,null);N.bindBuffer(C,null);E();const S=N.fenceSync(N.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>N.getSyncParameter(S,N.SYNC_STATUS)===N.SIGNALED);
|
|
N.deleteSync(S);t=new ImageData(I,L);N.bindBuffer(C,J);N.getBufferSubData(C,0,new Uint8Array(t.data.buffer),0,A);N.bindBuffer(C,null);N.deleteBuffer(J)}else t=new ImageData(I,L),N.readPixels(u,G,I,L,N.RGBA,N.UNSIGNED_BYTE,new Uint8Array(t.data.buffer)),E();return t}StartQuery(u){this.SupportsGPUProfiling()&&(this.PushBatch().InitStartQuery(u),this._topOfBatch=0)}EndQuery(u){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(u),this._topOfBatch=0)}_WaitForObjectReady(u){const t=new Promise(A=>
|
|
v.add({resolve:A,checkFunc:u}));-1===r&&(r=self.requestAnimationFrame(q));return t}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*(this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let u=0;for(const t of d.Gfx.WebGLRenderTarget.allRenderTargets())t.GetTexture()||(u+=t.GetEstimatedMemoryUsage());return u}GetEstimatedTextureMemoryUsage(){let u=0;for(const t of d.Gfx.WebGLRendererTexture.allTextures())u+=t.GetEstimatedMemoryUsage();
|
|
return u}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}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_GetAnisotropicExtension(){return this._anisotropicExt}_GetMaxAnisotropy(){return this._maxAnisotropy}_AddQueryResultBuffer(u){this._allQueryResultBuffers.add(u)}_RemoveQueryResultBuffer(u){this._allQueryResultBuffers.delete(u)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(u){this._InitBlendModeData([["normal",
|
|
u.ONE,u.ONE_MINUS_SRC_ALPHA],["additive",u.ONE,u.ONE],["xor",u.ONE,u.ONE_MINUS_SRC_ALPHA],["copy",u.ONE,u.ZERO],["destination-over",u.ONE_MINUS_DST_ALPHA,u.ONE],["source-in",u.DST_ALPHA,u.ZERO],["destination-in",u.ZERO,u.SRC_ALPHA],["source-out",u.ONE_MINUS_DST_ALPHA,u.ZERO],["destination-out",u.ZERO,u.ONE_MINUS_SRC_ALPHA],["source-atop",u.DST_ALPHA,u.ONE_MINUS_SRC_ALPHA],["destination-atop",u.ONE_MINUS_DST_ALPHA,u.SRC_ALPHA]])}CreateRendererText(){return d.New(d.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}}
|
|
{"use strict";const d=self.C3,a=self.C3X;let b=null;const e=new Set;function c(l,m){const p=l[0]-m[0];return 0!==p?p:l[1]-m[1]}const f=[],g=[];let h=!1;self.IRuntime=class{constructor(l,m){b=l;Object.defineProperties(this,{assets:{value:b.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:m,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:b.GetProjectName(),writable:!1},projectVersion:{value:b.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(b),writable:!1},
|
|
isInWorker:{value:b.IsInWorker(),writable:!1}});b.UserScriptDispatcher().addEventListener("keydown",p=>{e.has(p.key)?p.stopPropagation():e.add(p.key)});b.UserScriptDispatcher().addEventListener("keyup",p=>e.delete(p.key));b.Dispatcher().addEventListener("window-blur",()=>e.clear());b.IsInWorker()&&(self.alert=p=>{h||(h=!0,console.warn("[Construct 3] alert() was called from a Web Worker, because the project 'Use worker' setting is enabled. This method is not normally available in a Web Worker. Construct has implemented the alert for you, but note that other features may be missing in worker mode. You may wish to disable 'Use worker', or use a more convenient function like console.log(). For more information please refer to the scripting section of the manual."));
|
|
return this.alert(p)})}_InitGlobalVars(l){Object.defineProperties(this.globalVars,l)}addEventListener(l,m){b.UserScriptDispatcher().addEventListener(l,m)}removeEventListener(l,m){b.UserScriptDispatcher().removeEventListener(l,m)}callFunction(l,...m){a.RequireString(l);const p=b.GetEventSheetManager(),x=p.GetFunctionBlockByName(l);if(!x)throw Error(`cannot find function name '${l}'`);if(!x.IsEnabled())return x.GetDefaultReturnValue();if(m.length<x.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${l}' (${m.length} passed, ${x.GetFunctionParameterCount()} expected)`);
|
|
const v=x.GetEventBlock();l=null;var r=p.GetCurrentEvent();r&&(r=r.GetSolModifiersIncludingParents(),0<r.length&&(l=r,p.PushCleanSol(r)));m=v.RunAsExpressionFunctionCall(v.GetSolModifiersIncludingParents(),x.GetReturnType(),x.GetDefaultReturnValue(),...m);l&&p.PopSol(l);return m}setReturnValue(l){const m=b.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 b.GetDt()}get gameTime(){return b.GetGameTime()}get wallTime(){return b.GetWallTime()}random(){return b.Random()}get layout(){return b.GetMainRunningLayout().GetILayout()}getLayout(l){const m=b.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 b.GetLayoutManager().GetAllLayouts().map(l=>l.GetILayout())}goToLayout(l){const m=b.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=b._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=b._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=b._GetCommonScriptInterfaces().touch;if(!l)throw Error("runtime.touch used but Touch object missing - add it to your project first");return l}invokeDownload(l,m){a.RequireString(l);a.RequireString(m);b.InvokeDownload(l,m)}getInstanceByUid(l){a.RequireFiniteNumber(l);return(l=b.GetInstanceByUID(l))?l.GetInterfaceClass():
|
|
null}sortZOrder(l,m){a.RequireFunction(m);const p=b.GetCurrentLayout();for(var x of l){l=b._UnwrapIWorldInstance(x);var v=l.GetWorldInfo();f.push([v.GetLayer().GetIndex(),v.GetZIndex()]);g.push(l)}if(0!==f.length){f.sort(c);g.sort((r,q)=>m(r.GetInterfaceClass(),q.GetInterfaceClass()));x=!1;for(let r=0,q=f.length;r<q;++r){l=g[r];v=p.GetLayerByIndex(f[r][0]);const y=f[r][1],u=v._GetInstances();u[y]!==l&&(u[y]=l,l.GetWorldInfo()._SetLayer(v),v.SetZIndicesChanged(),x=!0)}x&&b.UpdateRender();d.clearArray(f);
|
|
d.clearArray(g)}}alert(l){return b.PostComponentMessageToDOMAsync("runtime","alert",{message:l+(b.IsInWorker()?" [via Web Worker]":"")})}}}
|
|
{"use strict";const d=self.C3;let a=null;self.IAssetManager=class{constructor(b){a=b;Object.defineProperties(this,{isWebMOpusSupported:{value:a.IsAudioFormatSupported("audio/webm; codecs=opus"),writable:!1}})}fetchText(b){return a.FetchText(b)}fetchJson(b){return a.FetchJson(b)}fetchBlob(b){return a.FetchBlob(b)}fetchArrayBuffer(b){return a.FetchArrayBuffer(b)}getProjectFileUrl(b){return a.GetProjectFileUrl(b)}getMediaFileUrl(b){d.IsRelativeURL(b)&&(b=b.toLowerCase());return a.GetMediaFileUrl(b,a.GetMediaSubfolder())}get mediaFolder(){return a.GetMediaSubfolder()}async decodeWebMOpus(b,
|
|
e){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");e=await a.GetRuntime()._WasmDecodeWebMOpus(e);e=new Float32Array(e);b=b.createBuffer(1,e.length,48E3);b.getChannelData(0).set(e);return b}loadScripts(...b){return a.LoadScripts(...b)}compileWebAssembly(b){return a.CompileWebAssembly(b)}loadStyleSheet(b){return a.LoadStyleSheet(b)}}}
|
|
{"use strict";const d=self.C3X;self.IStorage=class{constructor(a){this._storage=a._GetProjectStorage()}getItem(a){d.RequireString(a);return this._storage.getItem(a)}setItem(a,b){d.RequireString(a);return this._storage.setItem(a,b)}removeItem(a){d.RequireString(a);return this._storage.removeItem(a)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}}}
|
|
{"use strict";const d=self.C3X,a=new WeakMap;self.IObjectClass=class{constructor(b){a.set(this,b);Object.defineProperties(this,{name:{value:b.GetName(),writable:!1}});b.GetRuntime()._MapScriptInterface(this,b)}addEventListener(b,e){d.RequireString(b);d.RequireFunction(e);a.get(this).UserScriptDispatcher().addEventListener(b,e)}removeEventListener(b,e){d.RequireString(b);d.RequireFunction(e);a.get(this).UserScriptDispatcher().removeEventListener(b,e)}getAllInstances(){return a.get(this).GetInstances().map(b=>
|
|
b.GetInterfaceClass())}getFirstInstance(){const b=a.get(this).GetInstances();return 0<b.length?b[0].GetInterfaceClass():null}getPickedInstances(){return a.get(this).GetCurrentSol().GetInstances().map(b=>b.GetInterfaceClass())}getFirstPickedInstance(){const b=a.get(this).GetCurrentSol().GetInstances();return 0<b.length?b[0].GetInterfaceClass():null}*instances(){for(const b of a.get(this).GetInstances())yield b.GetInterfaceClass()}*pickedInstances(){for(const b of a.get(this).GetCurrentSol().GetInstances())yield b.GetInterfaceClass()}setInstanceClass(b){d.RequireFunction(b);
|
|
if(0<a.get(this).GetInstanceCount())throw Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");a.get(this)._SetUserScriptInstanceClass(b)}createInstance(b,e,c,f){d.RequireNumber(e);d.RequireNumber(c);if("number"!==typeof b&&"string"!==typeof b)throw new TypeError("invalid layer parameter");const g=a.get(this),h=g.GetRuntime();b=h.GetMainRunningLayout().GetLayer(b);if(!b)throw Error("invalid layer");e=h.CreateInstance(g,b,e,c,f);f&&b.SortAndAddSceneGraphInstancesByZIndex(e);
|
|
f=h.GetEventSheetManager();f.BlockFlushingInstances(!0);e._TriggerOnCreatedOnSelfAndRelated();f.BlockFlushingInstances(!1);return e.GetInterfaceClass()}}}
|
|
{"use strict";const d=self.C3X,a=new WeakMap;self.ILayout=class{constructor(b){a.set(this,b);const e=[],c=b.GetEffectList(),f=c.GetAllEffectTypes().length;for(let g=0;g<f;++g)e.push(new self.IEffectInstance(c,g));Object.defineProperties(this,{name:{value:b.GetName(),writable:!1},index:{value:b.GetIndex(),writable:!1},effects:{value:e,writable:!1}})}addEventListener(b,e){d.RequireString(b);d.RequireFunction(e);a.get(this).UserScriptDispatcher().addEventListener(b,e)}removeEventListener(b,e){d.RequireString(b);
|
|
d.RequireFunction(e);a.get(this).UserScriptDispatcher().removeEventListener(b,e)}get width(){return a.get(this).GetWidth()}set width(b){a.get(this).SetWidth(b)}get height(){return a.get(this).GetHeight()}set height(b){a.get(this).SetHeight(b)}set scale(b){d.RequireFiniteNumber(b);a.get(this).SetScale(b)}get scale(){return a.get(this).GetScale()}set angle(b){d.RequireFiniteNumber(b);a.get(this).SetAngle(b)}get angle(){return a.get(this).GetAngle()}set scrollX(b){d.RequireNumber(b);a.get(this).SetScrollX(b)}get scrollX(){return a.get(this).GetScrollX()}set scrollY(b){d.RequireNumber(b);
|
|
a.get(this).SetScrollY(b)}get scrollY(){return a.get(this).GetScrollY()}scrollTo(b,e){d.RequireNumber(b);d.RequireNumber(e);const c=a.get(this);c.SetScrollX(b);c.SetScrollY(e)}getLayer(b){const e=a.get(this);if("number"===typeof b||"string"===typeof b)b=e.GetLayer(b);else throw new TypeError("expected string or number");return b?b.GetILayer():null}getAllLayers(){return a.get(this).GetLayers().map(b=>b.GetILayer())}setVanishingPoint(b,e){d.RequireFiniteNumber(b);d.RequireFiniteNumber(e);a.get(this).SetVanishingPointXY(b,
|
|
e)}getVanishingPoint(){const b=a.get(this);return[b.GetVanishingPointX(),b.GetVanishingPointY()]}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=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]]),c=new Map([...e.entries()].map(g=>[g[1],g[0]])),f=d.New(d.Color);self.ILayer=class{constructor(g){b.set(this,g);const h=[],l=g.GetEffectList(),m=l.GetAllEffectTypes().length;for(let p=0;p<m;++p)h.push(new self.IEffectInstance(l,p));Object.defineProperties(this,
|
|
{name:{value:g.GetName(),writable:!1},index:{value:g.GetIndex(),writable:!1},layout:{value:g.GetLayout().GetILayout(),writable:!1},effects:{value:h,writable:!1}})}static _Unwrap(g){return b.get(g)}get isVisible(){return b.get(this).IsVisible()}set isVisible(g){b.get(this).SetVisible(g)}get opacity(){return b.get(this).GetOpacity()}set opacity(g){g=d.clamp(+g,0,1);isNaN(g)||b.get(this).SetOpacity(g)}set scale(g){a.RequireFiniteNumber(g);b.get(this).SetOwnScale(g)}get scale(){return b.get(this).GetOwnScale()}set scaleRate(g){a.RequireFiniteNumber(g);
|
|
b.get(this).SetScaleRate(g)}get scaleRate(){return b.get(this).GetScaleRate()}set angle(g){a.RequireFiniteNumber(g);b.get(this).SetAngle(g)}get angle(){return b.get(this).GetOwnAngle()}set parallaxX(g){a.RequireFiniteNumber(g);b.get(this).SetParallaxX(g)}get parallaxX(){return b.get(this).GetParallaxX()}set parallaxY(g){a.RequireFiniteNumber(g);b.get(this).SetParallaxY(g)}get parallaxY(){return b.get(this).GetParallaxY()}set zElevation(g){a.RequireFiniteNumber(g);b.get(this).SetZElevation(g)}get zElevation(){return b.get(this).GetZElevation()}set isTransparent(g){b.get(this).SetTransparent(g)}get isTransparent(){return b.get(this).IsTransparent()}set isForceOwnTexture(g){b.get(this).SetForceOwnTexture(g)}get isForceOwnTexture(){return b.get(this).IsForceOwnTexture()}set blendMode(g){a.RequireString(g);
|
|
g=e.get(g);if("number"!==typeof g)throw Error("invalid blend mode");b.get(this).SetBlendMode(g)}get blendMode(){return c.get(b.get(this).GetBlendMode())}set backgroundColor(g){a.RequireArray(g);if(3>g.length)throw Error("expected 3 elements");f.setRgb(g[0],g[1],g[2]);g=b.get(this);const h=g.GetBackgroundColor();h.equalsIgnoringAlpha(f)||(h.copyRgb(f),g.GetRuntime().UpdateRender())}get backgroundColor(){const g=b.get(this).GetBackgroundColor();return[g.getR(),g.getG(),g.getB()]}set scrollX(g){a.RequireNumber(g);
|
|
const h=b.get(this);h.SetOwnScrollPositionEnabled(!0);h.SetScrollX(g)}get scrollX(){return b.get(this).GetScrollX()}set scrollY(g){a.RequireNumber(g);const h=b.get(this);h.SetOwnScrollPositionEnabled(!0);h.SetScrollY(g)}get scrollY(){return b.get(this).GetScrollY()}scrollTo(g,h){a.RequireNumber(g);a.RequireNumber(h);const l=b.get(this);l.SetOwnScrollPositionEnabled(!0);l.SetScrollX(g);l.SetScrollY(h)}restoreScrollPosition(){b.get(this).SetOwnScrollPositionEnabled(!1)}getViewport(){return b.get(this).GetViewport().toDOMRect()}cssPxToLayer(g,
|
|
h,l=0){a.RequireNumber(g);a.RequireNumber(h);a.RequireNumber(l);const m=b.get(this),p=m.GetRuntime();return m.CanvasCssToLayer(g-p.GetCanvasClientX(),h-p.GetCanvasClientY(),l)}layerToCssPx(g,h,l=0){a.RequireNumber(g);a.RequireNumber(h);a.RequireNumber(l);const m=b.get(this),p=m.GetRuntime(),[x,v]=m.LayerToCanvasCss(g,h,l);return[x+p.GetCanvasClientX(),v+p.GetCanvasClientY()]}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=new WeakMap,e=new WeakMap;function c(g){let h=e.get(g);if(h)return h;h=d.New(d.Event.Dispatcher);e.set(g,h);return h}let f=null;self.IInstance=class{constructor(){b.set(this,f);const g={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:f.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:f.GetUID(),writable:!1}};f._GetInstVarsScriptDescriptor(g);f._GetBehaviorsScriptDescriptor(g);Object.defineProperties(this,g);f.GetRuntime()._MapScriptInterface(this,
|
|
f)}static _Init(g){f=g}static _GetInitInst(){return f}_Release(){const g=e.get(this);g&&(g.Release(),e.delete(this));b.delete(this)}addEventListener(g,h,l){a.RequireString(g);a.RequireFunction(h);c(this).addEventListener(g,h,l)}removeEventListener(g,h,l){a.RequireString(g);a.RequireFunction(h);c(this).removeEventListener(g,h,l)}dispatchEvent(g){c(this).dispatchEvent(g)}destroy(){const g=b.get(this);g.GetRuntime().DestroyInstance(g)}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=self.IInstance,e=self.ILayer,c=new WeakMap,f=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]),g=new Map([...f.entries()].map(l=>[l[1],l[0]])),h=d.New(d.Color);self.IWorldInstance=class l extends b{constructor(){super();var m=b._GetInitInst();c.set(this,m);const p=[];var x=m.GetWorldInfo();if(m=x.GetInstanceEffectList()){x=
|
|
x.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let v=0;v<x;++v)p.push(new self.IEffectInstance(m,v))}Object.defineProperties(this,{effects:{value:p,writable:!1}})}get layout(){return c.get(this).GetWorldInfo().GetLayout().GetILayout()}get layer(){return c.get(this).GetWorldInfo().GetLayer().GetILayer()}get x(){return c.get(this).GetWorldInfo().GetX()}set x(m){m=+m;const p=c.get(this).GetWorldInfo();isNaN(m)||p.GetX()===m||(p.SetX(m),p.SetBboxChanged())}get y(){return c.get(this).GetWorldInfo().GetY()}set y(m){m=
|
|
+m;const p=c.get(this).GetWorldInfo();isNaN(m)||p.GetY()===m||(p.SetY(m),p.SetBboxChanged())}get zElevation(){return c.get(this).GetWorldInfo().GetZElevation()}set zElevation(m){m=+m;const p=c.get(this),x=p.GetWorldInfo();isNaN(m)||x.GetZElevation()===m||(x.SetZElevation(m),p.GetRuntime().UpdateRender())}get totalZElevation(){return c.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return c.get(this).GetWorldInfo().GetWidth()}set width(m){m=+m;const p=c.get(this).GetWorldInfo();isNaN(m)||
|
|
p.GetWidth()===m||(p.SetWidth(m),p.SetBboxChanged())}get height(){return c.get(this).GetWorldInfo().GetHeight()}set height(m){m=+m;const p=c.get(this).GetWorldInfo();isNaN(m)||p.GetHeight()===m||(p.SetHeight(m),p.SetBboxChanged())}get angle(){return c.get(this).GetWorldInfo().GetAngle()}set angle(m){m=d.clampAngle(+m);const p=c.get(this).GetWorldInfo();isNaN(m)||p.GetAngle()===m||(p.SetAngle(m),p.SetBboxChanged())}get angleDegrees(){return d.toDegrees(this.angle)}set angleDegrees(m){this.angle=d.toRadians(m)}getBoundingBox(){return c.get(this).GetWorldInfo().GetBoundingBox().toDOMRect()}getBoundingQuad(){return c.get(this).GetWorldInfo().GetBoundingQuad().toDOMQuad()}get isVisible(){return c.get(this).GetWorldInfo().IsVisible()}set isVisible(m){m=
|
|
!!m;const p=c.get(this),x=p.GetWorldInfo();x.IsVisible()!==m&&(x.SetVisible(m),p.GetRuntime().UpdateRender())}get opacity(){return c.get(this).GetWorldInfo().GetOpacity()}set opacity(m){m=d.clamp(+m,0,1);const p=c.get(this),x=p.GetWorldInfo();isNaN(m)||x.GetOpacity()===m||(x.SetOpacity(m),p.GetRuntime().UpdateRender())}set colorRgb(m){a.RequireArray(m);if(3>m.length)throw Error("expected 3 elements");h.setRgb(m[0],m[1],m[2]);m=c.get(this);const p=m.GetWorldInfo();p.GetUnpremultipliedColor().equalsIgnoringAlpha(h)||
|
|
(p.SetUnpremultipliedColor(h),m.GetRuntime().UpdateRender())}get colorRgb(){const m=c.get(this).GetWorldInfo().GetUnpremultipliedColor();return[m.getR(),m.getG(),m.getB()]}set blendMode(m){a.RequireString(m);m=f.get(m);if("number"!==typeof m)throw Error("invalid blend mode");const p=c.get(this);p.GetWorldInfo().SetBlendMode(m);p.GetRuntime().UpdateRender()}get blendMode(){return g.get(c.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){c.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){c.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(m){a.RequireInstanceOf(m,
|
|
e);m=e._Unwrap(m);if(!m)throw Error("invalid layer");c.get(this).GetWorldInfo().ZOrderMoveToLayer(m)}moveAdjacentToInstance(m,p){a.RequireInstanceOf(m,l);c.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(c.get(m),p)}get zIndex(){return c.get(this).GetWorldInfo().GetZIndex()}containsPoint(m,p){a.RequireNumber(m);a.RequireNumber(p);return c.get(this).GetWorldInfo().ContainsPoint(+m,+p)}testOverlap(m){a.RequireInstanceOf(m,l);const p=c.get(this);m=c.get(m);return p.GetRuntime().GetCollisionEngine().TestOverlap(p,
|
|
m)}testOverlapSolid(){var m=c.get(this);return(m=m.GetRuntime().GetCollisionEngine().TestOverlapSolid(m))?m.GetInterfaceClass():null}getParent(){const m=c.get(this).GetParent();return m?m.GetInterfaceClass():null}getTopParent(){const m=c.get(this).GetTopParent();return m?m.GetInterfaceClass():null}*parents(){for(const m of c.get(this).parents())yield m.GetInterfaceClass()}getChildCount(){return c.get(this).GetChildCount()}getChildAt(m){return(m=c.get(this).GetChildAt(m))?m.GetInterfaceClass():null}*children(){for(const m of c.get(this).children())yield m.GetInterfaceClass()}*allChildren(){for(const m of c.get(this).allChildren())yield m.GetInterfaceClass()}addChild(m,
|
|
p){a.RequireInstanceOf(m,l);a.RequireOptionalObject(p);p||(p={});const x=c.get(this);m=c.get(m);x.AddChild(m,p)}removeChild(m){a.RequireInstanceOf(m,l);const p=c.get(this);m=c.get(m);p.RemoveChild(m)}removeFromParent(){const m=c.get(this);m.HasParent()&&m.GetParent().RemoveChild(m)}createMesh(m,p){a.RequireFiniteNumber(m);a.RequireFiniteNumber(p);c.get(this).GetWorldInfo().CreateMesh(m,p)}releaseMesh(){const m=c.get(this).GetWorldInfo();m.ReleaseMesh();m.SetBboxChanged()}setMeshPoint(m,p,x){a.RequireFiniteNumber(m);
|
|
a.RequireFiniteNumber(p);a.RequireObject(x);const v=c.get(this).GetWorldInfo();v.SetMeshPoint(m,p,x)&&v.SetBboxChanged()}getMeshSize(){var m=c.get(this).GetWorldInfo();if(!m.HasMesh())return[0,0];m=m.GetSourceMesh();return[m.GetHSize(),m.GetVSize()]}}}
|
|
{"use strict";const d=self.C3X,a=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();a.set(this,self.IInstance._GetInitInst())}getElement(){return a.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){a.get(this).GetSdkInstance().FocusElement()}blur(){a.get(this).GetSdkInstance().BlurElement()}setCssStyle(b,e){d.RequireString(b);a.get(this).GetSdkInstance().SetElementCSSStyle(b,e)}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=new WeakMap,e=new WeakMap;function c(g){let h=e.get(g);if(h)return h;h=d.New(d.Event.Dispatcher);e.set(g,h);return h}let f=null;self.IBehaviorInstance=class{constructor(){b.set(this,f);const g={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:f.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,g)}static _Init(g){f=g}static _GetInitInst(){return f}get instance(){return b.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const g=
|
|
e.get(this);g&&(g.Release(),e.delete(this));b.delete(this)}addEventListener(g,h,l){a.RequireString(g);a.RequireFunction(h);c(this).addEventListener(g,h,l)}removeEventListener(g,h,l){a.RequireString(g);a.RequireFunction(h);c(this).removeEventListener(g,h,l)}dispatchEvent(g){c(this).dispatchEvent(g)}}}
|
|
{"use strict";const d=new WeakMap;self.IBehavior=class{constructor(a){d.set(this,a);a={runtime:{value:a.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,a)}getAllInstances(){return d.get(this).GetInstances().map(a=>a.GetInterfaceClass())}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=new WeakMap;self.IEffectInstance=class{constructor(e,c){b.set(this,e);Object.defineProperties(this,{index:{value:c,writable:!1}})}get name(){return b.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return b.get(this).IsEffectIndexActive(this.index)}set isActive(e){e=!!e;const c=b.get(this);c.IsEffectIndexActive(this.index)!==e&&(c.SetEffectIndexActive(this.index,e),c.UpdateActiveEffects(),c.GetRuntime().UpdateRender())}setParameter(e,c){a.RequireFiniteNumber(e);
|
|
e=Math.floor(+e);const f=b.get(this);var g=f.GetEffectParametersForIndex(this.index);if(0>e||e>=g.length)throw new RangeError("invalid effect parameter index");const h=g[e];if(h instanceof d.Color){if(!Array.isArray(c)||3>c.length)throw new TypeError("expected array with 3 elements");e=c[0];g=c[1];c=c[2];if(h.equalsRgb(e,g,c))return;h.setRgb(e,g,c)}else{if("number"!==typeof c)throw new TypeError("expected number");if(h===c)return;g[e]=c}f.IsEffectIndexActive(this.index)&&f.GetRuntime().UpdateRender()}getParameter(e){a.RequireFiniteNumber(e);
|
|
e=Math.floor(+e);const c=b.get(this).GetEffectParametersForIndex(this.index);if(0>e||e>=c.length)throw new RangeError("invalid effect parameter index");e=c[e];return e instanceof d.Color?[e.getR(),e.getG(),e.getB()]:e}}}
|
|
{"use strict";const d=self.C3,a=new Set(["local","remote"]),b=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"],["html","text/html"]]);function e(f){if(!f)return"";f=f.split(".");if(2>f.length)return"";f=f[f.length-1].toLowerCase();return b.get(f)||""}function c(f){return new Promise((g,h)=>{const l=document.createElement("script");l.onload=g;l.onerror=h;l.async=!1;l.type=
|
|
"module";l.src=f;document.head.appendChild(l)})}d.AssetManager=class extends d.DefendedBase{constructor(f,g){super();var h=g.exportType;this._runtime=f;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova="cordova"===h;this._isiOSCordova=!!g.isiOSCordova;this._isFileProtocol=!!g.isFileProtocol;this._swClientId=g.swClientId;this._supportedAudioFormats=g.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=
|
|
this._fontsSubfolder=this._mediaSubfolder="";this._defaultLoadPolicy="html5"===h||"scirra-arcade"===h||"instant-games"===h?"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=d.New(d.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new d.PromiseThrottle(Math.max(d.hardwareConcurrency,
|
|
8));if(f=g.previewImageBlobs){(h=g.previewProjectFileBlobs)&&Object.assign(f,h);(h=g.projectData)&&(f["data.json"]=h);for(const [l,m]of Object.entries(f))this._localUrlBlobs.set(l.toLowerCase(),m)}if(g=g.previewProjectFileSWUrls)for(const [l,m]of Object.entries(g))this._localBlobSWUrls.set(l,m);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const f of this._localBlobUrlCache.values())f.startsWith("blob:")&&URL.revokeObjectURL(f);this._localBlobUrlCache.clear();
|
|
for(const f of this._allAssets)f.Release();d.clearArray(this._allAssets);this._assetsByUrl.clear();d.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(f){this._mediaSubfolder=f}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(f){this._fontsSubfolder=f}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(f){this._iconsSubfolder=f}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(f){return this._localUrlBlobs.has(f.toLowerCase())}_GetLocalUrlBlob(f){return this._localUrlBlobs.get(f.toLowerCase())||
|
|
null}GetLocalUrlAsBlobUrl(f){if(!this._HasLocalUrlBlob(f))return f;f=f.toLowerCase();var g=this._localBlobUrlCache.get(f);g||(g=this._GetLocalUrlBlob(f),g=URL.createObjectURL(g),this._localBlobUrlCache.set(f,g));return g}FetchBlob(f,g){g=g||this._defaultLoadPolicy;const h=this._GetLocalUrlBlob(f);if(h)return Promise.resolve(h);if(d.IsRelativeURL(f)){const l=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(l):"local"===g?this._promiseThrottle.Add(()=>d.FetchBlob(l)):
|
|
d.FetchBlob(l)}return d.FetchBlob(f)}FetchArrayBuffer(f){const g=this._GetLocalUrlBlob(f);if(g)return d.BlobToArrayBuffer(g);if(d.IsRelativeURL(f)){const h=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(h):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>d.FetchArrayBuffer(h)):d.FetchArrayBuffer(h)}return d.FetchArrayBuffer(f)}FetchText(f){const g=this._GetLocalUrlBlob(f);if(g)return d.BlobToString(g);if(d.IsRelativeURL(f)){const h=
|
|
f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(h):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>d.FetchText(h)):d.FetchText(h)}return d.FetchText(f)}async FetchJson(f){f=await this.FetchText(f);return JSON.parse(f)}_CordovaFetchLocalFileAs(f,g){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:f,as:g})}CordovaFetchLocalFileAsText(f){return this._CordovaFetchLocalFileAs(f,"text")}async CordovaFetchLocalFileAsBlob(f){const g=
|
|
await this._CordovaFetchLocalFileAs(f,"buffer");f=e(f);return new Blob([g],{type:f})}async CordovaFetchLocalFileAsBlobURL(f){f=f.toLowerCase();var g=this._localBlobUrlCache.get(f);if(g)return g;g=await this.CordovaFetchLocalFileAsBlob(f);g=URL.createObjectURL(g);this._localBlobUrlCache.set(f,g);return g}CordovaFetchLocalFileAsArrayBuffer(f){return this._CordovaFetchLocalFileAs(f,"buffer")}GetMediaFileUrl(f){return this._HasLocalUrlBlob(f)?this.GetLocalUrlAsBlobUrl(f):this._mediaSubfolder+f.toLowerCase()}GetProjectFileUrl(f,
|
|
g=""){if(d.IsAbsoluteURL(f)){if(g)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(f)}return this._HasLocalUrlBlob(f)?Promise.resolve(this.GetLocalUrlAsBlobUrl(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(g+f):Promise.resolve(g+f.toLowerCase())}GetProjectFileIframeUrl(f){if(d.IsAbsoluteURL(f))return Promise.resolve(f);var g=f.indexOf("?"),h=-1===g?"":f.substr(g);g=-1===g?f:f.substr(0,g);return this._HasLocalUrlBlob(g)?(f=this._localBlobSWUrls.get(g)||
|
|
this.GetLocalUrlAsBlobUrl(g),!f.startsWith("blob:")&&this._swClientId&&(f=new URL(f),h=new URLSearchParams(h),h.set("__c3_client_id",this._swClientId),f.search=h.toString(),f=f.toString()),Promise.resolve(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(g):Promise.resolve(f.toLowerCase())}LoadProjectFileUrl(f){return this.GetProjectFileUrl(f)}LoadImage(f){if(f.loadPolicy&&!a.has(f.loadPolicy))throw Error("invalid load policy");let g=this._assetsByUrl.get(f.url);if(g)return g;
|
|
g=d.New(d.ImageAsset,this,{url:f.url,size:f.size||0,loadPolicy:f.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(g);this._assetsByUrl.set(g.GetURL(),g);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=g.GetSize(),this._loadPromises.push(g.Load().then(()=>this._AddLoadedSize(g.GetSize()))));return g}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(f){console.error("Error loading: ",f),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=
|
|
!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(f){this._assetSizeLoaded+=f;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const f=d.New(d.Event,"loadingprogress");this._lastLoadProgress=d.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);f.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(f)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(f){d.shallowAssignArray(this._webFonts,f);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"===
|
|
typeof FontFace)return Promise.resolve();const f=[];for(const [g,h,l]of this._webFonts)this._totalAssetSizeToLoad+=l,f.push(this._LoadWebFont(g,h).then(()=>this._AddLoadedSize(l)));return Promise.all(f)}async _LoadWebFont(f,g){try{const h=await this.GetProjectFileUrl(g,this._fontsSubfolder),l=new FontFace(f,`url('${h}')`);this._runtime.IsInWorker()?self.fonts.add(l):document.fonts.add(l);await l.load()}catch(h){console.warn(`[C3 runtime] Failed to load web font '${f}': `,h)}}IsAudioFormatSupported(f){return!!this._supportedAudioFormats[f]}_SetAudioFiles(f,
|
|
g){this._preloadSounds=!!g;for(const [h,l,m]of f)this._audioFiles.set(h,{fileName:h,formats:l.map(p=>({type:p[0],fileExtension:p[1],fullName:h+p[1],fileSize:p[2]})),isMusic:m})}GetPreferredAudioFile(f){f=this._audioFiles.get(f.toLowerCase());if(!f)return null;let g=null;for(const h of f.formats)if(g||"audio/webm; codecs=opus"!==h.type||(g=h),this.IsAudioFormatSupported(h.type))return h;return g}GetProjectAudioFileUrl(f){return(f=this.GetPreferredAudioFile(f))?{url:this.GetMediaFileUrl(f.fullName),
|
|
type:f.type}:null}GetAudioToPreload(){if(this._preloadSounds){const f=[];for(const g of this._audioFiles.values()){if(g.isMusic)continue;const h=this.GetPreferredAudioFile(g.fileName);h&&f.push({originalUrl:g.fileName,url:this.GetMediaFileUrl(h.fullName),type:h.type,fileSize:h.fileSize})}return f}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...f){const g=await Promise.all(f.map(h=>this.GetProjectFileUrl(h)));this._runtime.IsInWorker()?1===f.length?(f=f[0],await self.c3_import((d.IsRelativeURL(f)?
|
|
"./":"")+f)):(f=f.map(h=>`import "${d.IsRelativeURL(h)?"./":""}${h}";`).join("\n"),f=URL.createObjectURL(new Blob([f],{type:"application/javascript"})),await self.c3_import(f)):await Promise.all(g.map(h=>c(h)))}async CompileWebAssembly(f){if(WebAssembly.compileStreaming)return f=await this.GetProjectFileUrl(f),await WebAssembly.compileStreaming(fetch(f));f=await d.FetchArrayBuffer(f);return await WebAssembly.compile(f)}async LoadStyleSheet(f){f=await this.GetProjectFileUrl(f);return await this._runtime.PostComponentMessageToDOMAsync("runtime",
|
|
"add-stylesheet",{url:f})}}}
|
|
{"use strict";const d=self.C3;d.Asset=class extends d.DefendedBase{constructor(a,b){super();this._assetManager=a;this._runtime=a.GetRuntime();this._url=b.url;this._size=b.size;this._loadPolicy=b.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(a=>{this._isLoaded=!0;this._loadPromise=null;return this._blob=a}).catch(a=>console.error("Error loading resource: ",a))}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 d=self.C3,a=new d.PromiseThrottle,b=new Set;d.ImageAsset=class extends d.Asset{constructor(e,c){super(e,c);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;b.add(this)}Release(){this.ReleaseTexture();if(0!==this._refCount)throw Error("released image asset which still has texture references");this._texturePromise=null;b.delete(this);super.Release()}static OnWebGLContextLost(){for(const e of b)e._texturePromise=null,e._webglTexture=
|
|
null,e._refCount=0}LoadStaticTexture(e,c){c=c||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;c.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();return this._texturePromise=this.GetBlob().then(f=>a.Add(()=>e.CreateStaticTextureAsync(f,c).then(g=>{this._texturePromise=null;if(0===this._refCount)return e.DeleteTexture(g),null;this._webglTexture=g;this._imageWidth=g.GetWidth();this._imageHeight=
|
|
g.GetHeight();return this._webglTexture}))).catch(f=>{console.error("Failed to load texture: ",f);throw f;})}ReleaseTexture(){if(0>=this._refCount)throw Error("texture released too many times");this._refCount--;0===this._refCount&&this._webglTexture&&(this._webglTexture.GetRenderer().DeleteTexture(this._webglTexture),this._webglTexture=null)}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const e=await this.GetBlob();
|
|
return d.Supports.ImageBitmapOptions?await createImageBitmap(e,{premultiplyAlpha:"none"}):d.Supports.ImageBitmap?await createImageBitmap(e):await d.BlobToImage(e)}}}
|
|
{"use strict";const d=self.C3;function a(b,e){return b.GetWorldInfo()._GetLastCachedZIndex()-e.GetWorldInfo()._GetLastCachedZIndex()}d.RenderCell=class extends d.DefendedBase{constructor(b,e,c){super();this._grid=b;this._x=e;this._y=c;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){d.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){d.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(b){this._pendingRemoval.has(b)?(this._pendingRemoval.delete(b),0===this._pendingRemoval.size&&(this._isAnyPendingRemoval=!1)):(this._instances.push(b),this._isSorted=1===this._instances.length)}Remove(b){this._pendingRemoval.add(b);this._isAnyPendingRemoval=!0;50<=this._pendingRemoval.size&&this._FlushPending()}_FlushPending(){this._isAnyPendingRemoval&&
|
|
(this._instances.length===this._pendingRemoval.size?this.Reset():(d.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1))}_EnsureSorted(){this._isSorted||(this._instances.sort(a),this._isSorted=!0)}Dump(b){this._FlushPending();this._EnsureSorted();this._instances.length&&b.push(this._instances)}}}
|
|
{"use strict";const d=self.C3;d.RenderGrid=class extends d.DefendedBase{constructor(a,b){super();this._cellWidth=a;this._cellHeight=b;this._cells=d.New(d.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(a,b,e){let c=this._cells.Get(a,b);return c?c:e?(c=d.New(d.RenderCell,this,a,b),this._cells.Set(a,b,c),c):null}XToCell(a){return Math.floor(a/this._cellWidth)}YToCell(a){return Math.floor(a/this._cellHeight)}Update(a,b,e){if(b)for(let c=b.getLeft(),f=b.getRight();c<=f;++c)for(let g=
|
|
b.getTop(),h=b.getBottom();g<=h;++g){if(e&&e.containsPoint(c,g))continue;const l=this.GetCell(c,g,!1);l&&(l.Remove(a),l.IsEmpty()&&this._cells.Delete(c,g))}if(e)for(let c=e.getLeft(),f=e.getRight();c<=f;++c)for(let g=e.getTop(),h=e.getBottom();g<=h;++g)b&&b.containsPoint(c,g)||this.GetCell(c,g,!0).Insert(a)}QueryRange(a,b){let e=this.XToCell(a.getLeft());const c=this.YToCell(a.getTop()),f=this.XToCell(a.getRight());for(a=this.YToCell(a.getBottom());e<=f;++e)for(let g=c;g<=a;++g){const h=this.GetCell(e,
|
|
g,!1);h&&h.Dump(b)}}MarkRangeChanged(a){let b=a.getLeft();const e=a.getTop(),c=a.getRight();for(a=a.getBottom();b<=c;++b)for(let f=e;f<=a;++f){const g=this.GetCell(b,f,!1);g&&g.SetChanged()}}}}
|
|
{"use strict";const d=self.C3,a=new d.Rect,b=new d.Quad,e=[],c=new d.Rect,f=new d.Rect,g=self.glMatrix,h=g.vec3,l=g.vec4,m=g.mat4,p=m.create(),x=h.create(),v=l.create(),r=h.create(),q=h.create(),y=h.create(),u=d.New(d.Vector2);function t(z,C){return z.GetWorldInfo()._GetLastCachedZIndex()-C.GetWorldInfo()._GetLastCachedZIndex()}function A(z,C){return z.GetWorldInfo().GetZElevation()-C.GetWorldInfo().GetZElevation()}d.Layer=class extends d.DefendedBase{constructor(z,C,E){super();this._layout=z;this._runtime=
|
|
z.GetRuntime();this._name=E[0];this._index=C;this._sid=E[2];this._isVisible=!!E[3];this._backgroundColor=d.New(d.Color);this._backgroundColor.setFromJSON(E[4].map(J=>J/255));this._isTransparent=!!E[5];this._parallaxX=E[6];this._parallaxY=E[7];this._color=d.New(d.Color,1,1,1,E[8]);this._premultipliedColor=d.New(d.Color);this._isForceOwnTexture=E[9];this._renderAs3d=E[17];this._useRenderCells=E[10];this._scaleRate=E[11];this._blendMode=E[12];this._curRenderTarget=null;this._scale=1;this._zElevation=
|
|
E[16];this._scrollY=this._scrollX=this._angle=0;this._hasOwnScrollPosition=!1;this._viewport=d.New(d.Rect);this._viewportZ0=d.New(d.Rect);this._projectionMatrix=m.create();this._isProjectionMatrixChanged=!0;this._modelViewMatrix=m.create();this._isMVMatrixChanged=!0;this._viewFrustum=d.New(d.Gfx.ViewFrustum);this._isViewFrustumChanged=!0;this._startupInitialInstances=[];this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._anyInstanceZElevated=
|
|
this._zIndicesUpToDate=!1;this._effectList=d.New(d.EffectList,this,E[15]);this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=d.New(d.Rect,0,0,-1,-1);this._curRenderCells=d.New(d.Rect,0,0,-1,-1);this._iLayer=new self.ILayer(this);this._UpdatePremultipliedColor();this._useRenderCells&&(this._renderGrid=d.New(d.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight()));for(const J of E[14])z=this._runtime.GetObjectClassByIndex(J[1]),
|
|
this._layout._AddInitialObjectClass(z),z.GetDefaultInstanceData()||(z.SetDefaultInstanceData(J),z._SetDefaultLayerIndex(this._index)),this._initialInstances.push(J),this._initialUIDsToInstanceData.set(J[2],J);d.shallowAssignArray(this._startupInitialInstances,this._initialInstances)}static Create(z,C,E){return d.New(d.Layer,z,C,E)}Release(){this._runtime=this._layout=null}GetInitialInstanceData(z){return this._initialUIDsToInstanceData.get(z)}CreateInitialInstances(z){const C=this._layout.IsFirstVisit();
|
|
let E=0;const J=this._initialInstances;for(let I=0,L=J.length;I<L;++I){var G=J[I];const N=this._runtime.GetObjectClassByIndex(G[1]);let S=!0;if(!N.HasPersistBehavior()||C)G=this._runtime.CreateInstanceFromData(G,this,!0),z.push(G),N.IsGlobal()&&(S=!1,this._createdGlobalUids.push(G.GetUID()));S&&(J[E]=J[I],++E)}d.truncateArray(J,E);this._runtime.FlushPendingInstances();this.SetZIndicesChanged()}_AddInstance(z,C){const E=z.GetWorldInfo();if(E.GetLayer()!==this)throw Error("instance added to wrong layer");
|
|
this._instances.push(z);0!==E.GetZElevation()&&(this._anyInstanceZElevated=!0);C&&this._useRenderCells&&z.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(z){this._instances.includes(z)||(this._instances.push(z),0!==z.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(z,C){const E=z.GetWorldInfo();if(E.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(z);0!==E.GetZElevation()&&
|
|
(this._anyInstanceZElevated=!0);this.SetZIndicesChanged();C&&this._useRenderCells&&z.GetWorldInfo().SetBboxChanged()}_RemoveInstance(z,C){const E=this._instances.indexOf(z);0>E||(C&&this._useRenderCells&&z.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(E,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(z){if(z){z=
|
|
new Set;for(var C of this._instances){var E=C.GetWorldInfo()._GetLastCachedZIndex();0<=E&&z.add(E)}C=-1;for(const J of this._instances)if(E=J.GetWorldInfo(),!(0<=E._GetLastCachedZIndex())){for(++C;z.has(C);)++C;E._SetZIndex(C)}}this._instances.sort(t)}_Start(){}_End(){for(const z of this._instances)z.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(z);this._runtime.FlushPendingInstances();d.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(z,
|
|
C,E,J,G){const I=this._runtime.GetEventSheetManager(),L=this._runtime.GetAllObjectClasses(),N=z.IsFamily(),S=[];for(const W of this._initialInstances){var X=W[0];if(C.containsPoint(X[0],X[1])){X=L[W[1]];if(X!==z)if(N){if(!z.FamilyHasMember(X))continue}else continue;X=this;var U=this._runtime.GetCurrentLayout();this.GetLayout()!==U&&((X=U.GetLayerByName(this.GetName()))||(X=U.GetLayerByIndex(this.GetIndex())));U=this._runtime.CreateInstanceFromData(W,X,!1,void 0,void 0,!1,G);X.SortAndAddSceneGraphInstancesByZIndex(U);
|
|
X=U.GetWorldInfo();X.OffsetXY(E,J);X.SetBboxChanged();I.BlockFlushingInstances(!0);U._TriggerOnCreatedOnSelfAndRelated();I.BlockFlushingInstances(!1);S.push(U)}}return S}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}UsesRenderCells(){return this._useRenderCells}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=
|
|
!1}IsVisible(){return this._isVisible}SetVisible(z){z=!!z;this._isVisible!==z&&(this._isVisible=z,this._runtime.UpdateRender())}SetOwnScrollPositionEnabled(z){z=!!z;if(this._hasOwnScrollPosition!==z){if(this._hasOwnScrollPosition=z)z=this.GetLayout(),this._scrollX=z.GetScrollX(),this._scrollY=z.GetScrollY();this._SetMVMatrixChanged();this._runtime.UpdateRender()}}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(z){var C=this.GetLayout();const E=C.GetScrollLeftBound();C=C.GetScrollRightBound();
|
|
z>C&&(z=C);z<E&&(z=E);this._scrollX!==z&&(this._scrollX=z,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}SetScrollY(z){var C=this.GetLayout();const E=C.GetScrollTopBound();C=C.GetScrollBottomBound();z>C&&(z=C);z<E&&(z=E);this._scrollY!==z&&(this._scrollY=z,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}_GetVanishingPoint(){if(this._renderAs3d){const z=this.GetLayout();return[z.GetVanishingPointX(),z.GetVanishingPointY()]}return[.5,.5]}GetViewportForZ(z,C){var E=this._viewportZ0;if(0===z)C.copy(E);else{let L=E.midX(),N=E.midY();var J=this.Get2DScaleFactorToZ(z);const S=E.width()/J;E=E.height()/J;const [X,U]=this._GetVanishingPoint();if(.5!==X||.5!==U){const W=this.GetCameraZ();var G=this._runtime,I=100/W;J=(X-.5)*G.GetViewportWidth()/
|
|
I;G=(U-.5)*G.GetViewportHeight()/I;I=this.GetAngle();0!==I&&(u.set(J,G),u.rotate(I),J=u.getX(),G=u.getY());z=d.unlerp(W,0,z);L+=d.lerp(J,0,z);N+=d.lerp(G,0,z)}C.set(L-S/2,N-E/2,L+S/2,N+E/2)}}GetOpacity(){return this._color.getA()}SetOpacity(z){z=d.clamp(z,0,1);this._color.getA()!==z&&(this._color.setA(z),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(z){this._scaleRate!==z&&(this._scaleRate=z,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(z,C){if(this._parallaxX!==z||this._parallaxY!==C)if(this._parallaxX=z,this._parallaxY=C,this._SetMVMatrixChanged(),this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const E of this._instances)E.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(z){this.SetParallax(z,
|
|
this.GetParallaxY())}SetParallaxY(z){this.SetParallax(this.GetParallaxX(),z)}SetZElevation(z){this._zElevation!==z&&(this._zElevation=z,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(z){z=d.clampAngle(z);this._angle!==z&&(this._angle=z,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetAngle(){return d.clampAngle(this._layout.GetAngle()+this._angle)}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(z){z=
|
|
!!z;this._isTransparent!==z&&(this._isTransparent=z,this._runtime.UpdateRender())}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(z){z=!!z;this._isForceOwnTexture!==z&&(this._isForceOwnTexture=z,this._runtime.UpdateRender())}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()||!this._renderAs3d}SetBlendMode(z){this._blendMode!==z&&(this._blendMode=z,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}IsTransformCompatibleWith(z){return this===z||this._parallaxX===
|
|
z._parallaxX&&this._parallaxY===z._parallaxY&&this._scale===z._scale&&this._scaleRate===z._scaleRate&&this._angle===z._angle&&this.GetScrollX()===z.GetScrollX()&&this.GetScrollY()===z.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(z){this.SetParallax(z.parallaxX,
|
|
z.parallaxY);this.SetOwnScale(z.scale);this.SetScaleRate(z.scaleRate);this.SetAngle(z.angle);this.SetOwnScrollPositionEnabled(z.hasOwnScroll);this.SetScrollX(z.scrollX);this.SetScrollY(z.scrollY)}_RemoveAllInstancesInSet(z){0!==z.size&&0<d.arrayRemoveAllInSet(this._instances,z)&&(this._MaybeResetAnyInstanceZElevatedFlag(),this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){this._instances.sort(A);if(this._useRenderCells)for(let z=
|
|
0,C=this._instances.length;z<C;++z){const E=this._instances[z].GetWorldInfo();E._SetZIndex(z);this._renderGrid.MarkRangeChanged(E.GetRenderCellRange())}else for(let z=0,C=this._instances.length;z<C;++z)this._instances[z].GetWorldInfo()._SetZIndex(z);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(z,C,E){var J=z.GetWorldInfo();C=C.GetWorldInfo();if(J.GetLayer()!==this||C.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");J=J.GetZIndex();C=C.GetZIndex();if(J===
|
|
C+(E?1:-1))return!1;d.arrayRemove(this._instances,J);J<C&&C--;E&&C++;C===this._instances.length?this._instances.push(z):this._instances.splice(C,0,z);this.SetZIndicesChanged();return!0}_MergeSortedZArrays(z,C){const E=[];let J=0,G=0,I=z.length,L=C.length;for(;J<I&&G<L;){const N=z[J],S=C[G];N.GetWorldInfo()._GetLastCachedZIndex()<S.GetWorldInfo()._GetLastCachedZIndex()?(E.push(N),++J):(E.push(S),++G)}for(;J<I;++J)E.push(z[J]);for(;G<L;++G)E.push(C[G]);return E}_MergeAllSortedZArrays_pass(z){const C=
|
|
[],E=z.length;for(let J=0;J<E-1;J+=2)C.push(this._MergeSortedZArrays(z[J],z[J+1]));1===E%2&&C.push(z[E-1]);return C}_MergeAllSortedZArrays(z){for(;1<z.length;)z=this._MergeAllSortedZArrays_pass(z);return z[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();d.clearArray(e);this._renderGrid.QueryRange(this._viewport,e);return e.length?1===e.length?e[0]:this._MergeAllSortedZArrays(e):[]}_IsOpaque(){return!this.UsesOwnTexture()&&!this.IsTransparent()}ShouldDraw(){return this.IsVisible()&&0<this.GetOpacity()&&
|
|
(this.HasInstances()||!this.IsTransparent())}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||0!==this.GetBlendMode()||this._effectList.HasAnyActiveEffect()}GetRenderTarget(){return this._curRenderTarget}_CanFastPathDrawLayer(z){if(0===z.length)return!0;if(2<=z.length)return!1;z=z[0].GetShaderProgram();return!z.MustPreDraw()&&!z.UsesDest()&&!z.UsesCrossSampling()&&this.HasDefaultColor()}Get2DScaleFactorToZ(z){const C=this.GetCameraZ();return C/(C-z)}GetCameraZ(){return 100/
|
|
this.GetNormalScale()}_SetMVMatrixChanged(){this._isViewFrustumChanged=this._isMVMatrixChanged=!0}_GetModelViewMatrix(z){this._isMVMatrixChanged&&(this._CalculateModelViewMatrix(z,this._modelViewMatrix,0,0,null),this._isMVMatrixChanged=!1);return this._modelViewMatrix}_CalculateModelViewMatrix(z,C,E,J,G){const I=this._runtime,L=I.GetRenderScale();var N=I.GetParallaxXOrigin(),S=I.GetParallaxYOrigin();N=(this.GetScrollX()-N)*this._parallaxX+N;S=(this.GetScrollY()-S)*this._parallaxY+S;this._runtime.IsPixelRoundingEnabled()&&
|
|
(N=Math.round(N),S=Math.round(S));E=(N+E)*L;J=(S+J)*L;S=this.GetCameraZ();N=this.GetAngle();const [X,U]=this._GetVanishingPoint();if(.5!==X||.5!==U){var W=100/S;let ia=(X-.5)*I.GetViewportWidth()*L/W;W=(U-.5)*I.GetViewportHeight()*L/W;0!==N&&(u.set(ia,W),u.rotate(N),ia=u.getX(),W=u.getY());E+=ia;J+=W}h.set(r,E,J,S);h.set(q,E,J,S-100);0===N?h.set(y,0,1,0):h.set(y,Math.sin(N),Math.cos(N),0);z.CalculateLookAtModelView(C,r,q,y,G||I.GetCanvasManager().GetDrawHeight());1!==L&&(h.set(x,L,L,1),m.scale(C,
|
|
C,x))}_SetProjectionMatrixChanged(){this._isViewFrustumChanged=this._isProjectionMatrixChanged=!0}_GetProjectionMatrix(z){this._isProjectionMatrixChanged&&(this._CalculateProjectionMatrix(z),this._isProjectionMatrixChanged=!1);return this._projectionMatrix}_CalculateProjectionMatrix(z){var C=this._runtime.GetCanvasManager();const E=C.GetDrawWidth();C=C.GetDrawHeight();const [J,G]=this._GetVanishingPoint();z.CalculatePerspectiveMatrix(this._projectionMatrix,E/C,J,G)}_SetTransform(z,C=!0,E=0,J=0,G=
|
|
0){C&&z.SetProjectionMatrix(this._GetProjectionMatrix(z));0===E&&0===J&&0===G?C=this._GetModelViewMatrix(z):(this._CalculateModelViewMatrix(z,p,E,J,G),C=p);z.SetModelViewMatrix(C)}Draw(z,C,E){const J=this._runtime.GetCanvasManager(),G=this.UsesOwnTexture();var I=null;let L=null;if(this._runtime.IsGPUProfiling())if(z.IsWebGL()){const N=J.GetLayerTimingsBuffer(this);N&&(L=N.AddTimeElapsedQuery(),z.StartQuery(L))}else z.IsWebGPU()&&z.WriteTimestamp(2*(this.GetIndex()+1));G?(I={sampling:this._runtime.GetSampling()},
|
|
"low"===J.GetCurrentFullscreenScalingQuality()&&(I.width=J.GetDrawWidth(),I.height=J.GetDrawHeight()),I=this._runtime.GetAdditionalRenderTarget(I),z.SetRenderTarget(I),this.IsTransparent()?z.ClearRgba(0,0,0,0):z.Clear(this._backgroundColor)):(z.SetRenderTarget(C),this.IsTransparent()||E||z.Clear(this._backgroundColor));this._curRenderTarget=I||C;this._SetTransform(z);z.SetBaseZ(this.GetZElevation());z.SetDepthEnabled(this.GetRuntime().Uses3DFeatures()&&this._renderAs3d);this.GetNormalScale()>Number.EPSILON&&
|
|
(this._UpdateZIndices(),this._useRenderCells&&0===this.GetZElevation()&&!this._anyInstanceZElevated?this._DrawInstances_RenderCells(z):this._DrawInstances(z,this._instances));z.SetBaseZ(0);z.SetCurrentZ(0);G&&(z.SetDepthEnabled(!1),this._DrawLayerOwnTextureToRenderTarget(z,I,C,E));L&&z.EndQuery(L);this._runtime.IsGPUProfiling()&&z.IsWebGPU()&&z.WriteTimestamp(2*(this.GetIndex()+1)+1);this._curRenderTarget=null}_DrawInstances(z,C){const E=this._viewport,J=this._curRenderTarget,G=this.GetLayout().HasVanishingPointOutsideViewport();
|
|
let I=null;for(let L=0,N=C.length;L<N;++L){const S=C[L];if(S===I)continue;I=S;const X=S.GetWorldInfo();X.IsVisible()&&X.IsInViewport(E,G)&&(X.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(S,X,z,J):this._DrawInstance(S,X,z))}}_DrawInstances_RenderCells(z){var C=this._renderGrid;const E=this._curRenderCells,J=this._lastRenderCells,G=this._viewport;E.set(C.XToCell(G.getLeft()),C.YToCell(G.getTop()),C.XToCell(G.getRight()),C.YToCell(G.getBottom()));this._isRenderListUpToDate&&E.equals(J)?
|
|
C=this._lastRenderList:(C=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,J.copy(E));this._DrawInstances(z,C);C!==this._lastRenderList&&d.shallowAssignArray(this._lastRenderList,C)}_DrawInstance(z,C,E){C=C.GetRendererStateGroup();E.GetCurrentStateGroup()!==C&&C.Apply();z.Draw(E)}_DrawInstanceWithEffectsAndRestore(z,C,E,J){this._DrawInstanceWithEffects(z,C,E,J,null)&&this._SetTransform(E)}_DrawInstanceWithEffects(z,C,E,J,G){const I=C.GetInstanceEffectList().GetActiveEffectTypes();
|
|
if(1===I.length){const L=I[0],N=L.GetShaderProgram();if(!N.NeedsPostDrawOrExtendsBox()&&C.HasDefaultColor()&&!z.MustPreDraw())return this._DrawInstanceWithEffects_FastPath(z,C,L,N,E),!1}z=d.RenderEffectChain(E,this._runtime,z,J,I,G);E.SetBaseZ(this.GetZElevation());return z}_DrawInstanceWithEffects_FastPath(z,C,E,J,G){G.SetProgram(J);G.SetBlendMode(C.GetBlendMode());J.IsAnimated()&&this._runtime.UpdateRender();let I=0,L=0;if(J.UsesAnySrcRectOrPixelSize()){const [N,S]=z.GetCurrentSurfaceSize();I=1/
|
|
N;L=1/S;(J=z.GetCurrentTexRect())?f.copy(J):f.set(0,0,0,0)}E=C.GetInstanceEffectList().GetEffectParametersForIndex(E.GetIndex());G.SetCurrentZ(C.GetZElevation());G.SetProgramParameters(null,c,f,f,C.GetBoundingBox(),I,L,this.GetOwnScale(),this.GetAngle(),this._runtime.GetGameTime(),E);z.Draw(G)}_DrawLayerOwnTextureToRenderTarget(z,C,E,J){const G=this._effectList.GetActiveEffectTypes(),I=this._runtime;if(this._CanFastPathDrawLayer(G)){z.SetRenderTarget(E);if(1===G.length){var L=G[0];E=L.GetShaderProgram();
|
|
z.SetProgram(E);f.set(0,0,1,1);L=this._effectList.GetEffectParametersForIndex(L.GetIndex());z.SetProgramParameters(null,c,f,f,this._viewport,1/I.GetDrawWidth(),1/I.GetDrawHeight(),this.GetNormalScale(),this.GetAngle(),I.GetGameTime(),L);E.IsAnimated()&&I.UpdateRender()}else z.SetTextureFillMode();J&&0===this._blendMode&&this.HasDefaultColor()&&0===G.length?z.CopyRenderTarget(C):(z.SetBlendMode(this._blendMode),z.SetColor(this._premultipliedColor),z.DrawRenderTarget(C));z.InvalidateRenderTarget(C);
|
|
I.ReleaseAdditionalRenderTarget(C)}else d.RenderEffectChain(z,I,this,E,G)}GetOwnScale(){return this._scale}SetOwnScale(z){this._scale!==z&&(this._scale=z,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 z=
|
|
this._runtime.GetParallaxXOrigin(),C=this._runtime.GetParallaxYOrigin(),E=(this.GetScrollX()-z)*this._parallaxX+z,J=(this.GetScrollY()-C)*this._parallaxY+C;z=this.GetNormalScale();C=this._runtime.GetViewportWidth()/z;z=this._runtime.GetViewportHeight()/z;E-=C/2;let G=J-z/2;this._runtime.IsPixelRoundingEnabled()&&(E=Math.round(E),G=Math.round(G));J=this._viewportZ0;J.set(E,G,E+C,G+z);C=this.GetAngle();0!==C&&(a.copy(J),a.offset(-J.midX(),-J.midY()),b.setFromRotatedRect(a,C),b.getBoundingBox(a),a.offset(J.midX(),
|
|
J.midY()),J.copy(a));this.GetViewportForZ(this._zElevation,this._viewport)}CanvasCssToLayer(z,C,E=0){return this._CanvasToLayer(z,C,E,this.GetDisplayScale())}DrawSurfaceToLayer(z,C,E=0){return this._CanvasToLayer(z,C,E,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(z,C,E,J){var G=this._runtime,I=G.GetRenderer();const L=this.GetNormalScale(),N=G.GetViewportWidth()/L;G=G.GetViewportHeight()/L;l.set(v,0,0,N,G);z/=J;C=v[3]-C/J;J=this._GetProjectionMatrix(I);I=this._GetModelViewMatrix(I);
|
|
return d.Gfx.UnprojectScreenToWorldZ(z,C,E,I,J,v,x)?[x[0],x[1]]:[NaN,NaN]}CanvasCssToLayer_DefaultTransform(z,C){const E=this._scale,J=this._scaleRate,G=this._parallaxX,I=this._parallaxY,L=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;this._SetMVMatrixChanged();z=this.CanvasCssToLayer(z,C);this._scale=E;this._scaleRate=J;this._parallaxX=G;this._parallaxY=I;this._angle=L;this._SetMVMatrixChanged();return z}LayerToCanvasCss(z,C,E=0){return this._LayerToCanvas(z,
|
|
C,E,this.GetDisplayScale())}LayerToDrawSurface(z,C,E=0){return this._LayerToCanvas(z,C,E,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(z,C,E,J){var G=this._runtime,I=G.GetRenderer();const L=this.GetNormalScale();var N=G.GetViewportWidth()/L;G=G.GetViewportHeight()/L;l.set(v,0,0,N,G);N=this._GetProjectionMatrix(I);I=this._GetModelViewMatrix(I);return d.Gfx.Project(z,C,E,I,N,v,x)?[x[0]*J,(v[3]-x[1])*J]:[NaN,NaN]}_GetLayerToDrawSurfaceScale(z,C){z*=this.GetRenderScale()*this.GetDevicePixelRatio();
|
|
0!==C&&(z*=this.Get2DScaleFactorToZ(C));return z}_GetViewFrustum(){this._isViewFrustumChanged&&(this._UpdateViewFrustum(),this._isViewFrustumChanged=!1);return this._viewFrustum}_UpdateViewFrustum(){var z=this._runtime.GetRenderer();const C=this._GetProjectionMatrix(z);z=this._GetModelViewMatrix(z);this._viewFrustum.CalculatePlanes(z,C)}_SaveToJson(){return{s:this.GetOwnScale(),a:this.GetOwnAngle(),vl:this._viewport.getLeft(),vt:this._viewport.getTop(),vr:this._viewport.getRight(),vb:this._viewport.getBottom(),
|
|
v:this.IsVisible(),bc:this._backgroundColor.toJSON(),t:this.IsTransparent(),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(z){this._scale=z.s;this._angle=z.a;this._viewport.set(z.vl,z.vt,z.vr,z.vb);this._isVisible=!!z.v;this._backgroundColor.setFromJSON(z.bc);this._isTransparent=!!z.t;z.hasOwnProperty("sx")&&(this._scrollX=
|
|
z.sx);z.hasOwnProperty("sy")&&(this._scrollY=z.sy);z.hasOwnProperty("hosp")&&(this._hasOwnScrollPosition=!!z.hosp);this._parallaxX=z.px;this._parallaxY=z.py;this._color.setFromJSON(z.c);this._scaleRate=z.sr;d.shallowAssignArray(this._createdGlobalUids,z.cg);d.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const C=new Set(this._createdGlobalUids);let E=0;for(let J=0,G=this._initialInstances.length;J<G;++J)C.has(this._initialInstances[J][2])||(this._initialInstances[E]=this._initialInstances[J],
|
|
++E);d.truncateArray(this._initialInstances,E);this._effectList.LoadFromJson(z.fx);this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}SortAndAddSceneGraphInstancesByZIndex(z){z.GetWorldInfo();if(!this._instances.includes(z))if(z.HasChildren()){const C=[...z.allChildren()];C.push(z);C.sort((E,J)=>{E=E.GetWorldInfo().GetSceneGraphZIndex();J=J.GetWorldInfo().GetSceneGraphZIndex();return E-J});for(const E of C)this._AddInstance(E,!0)}else this._AddInstance(z,
|
|
!0)}}}
|
|
{"use strict";const d=self.C3,a=self.C3Debugger,b=d.New(d.Rect),e=d.New(d.Rect),c=d.New(d.Rect),f=d.New(d.Color);d.Layout=class extends d.DefendedBase{constructor(g,h,l){super();this._layoutManager=g;this._runtime=g.GetRuntime();this._name=l[0];this._originalWidth=l[1];this._originalHeight=l[2];this._width=l[1];this._height=l[2];this._isUnboundedScrolling=!!l[3];this._vanishingPointX=l[4];this._vanishingPointY=l[5];this._eventSheetName=l[6];this._eventSheet=null;this._sid=l[7];this._index=h;this._scrollY=
|
|
this._scrollX=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._initialNonWorld=[];this._layers=[];this._layersByName=new Map;this._layersBySid=new Map;this._effectList=d.New(d.EffectList,this,l[10]);this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=d.New(d.Event.Dispatcher);for(const m of l[8])g=
|
|
d.Layer.Create(this,this._layers.length,m),this._layers.push(g),this._layersByName.set(g.GetName().toLowerCase(),g),this._layersBySid.set(g.GetSID(),g);for(const m of l[9]){l=this._runtime.GetObjectClassByIndex(m[1]);if(!l)throw Error("missing nonworld object class");l.GetDefaultInstanceData()||l.SetDefaultInstanceData(m);this._initialNonWorld.push(m);this._AddInitialObjectClass(l)}}Release(){for(const g of this._layers)g.Release();d.clearArray(this._layers);this._textureLoadPendingPromises.clear();
|
|
this._runtime=this._layoutManager=this._eventSheet=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetMinLayerScale(){let g=this._layers[0].GetNormalScale();for(let h=1,l=this._layers.length;h<l;++h){const m=this._layers[h];if(0!==m.GetParallaxX()||0!==m.GetParallaxY())g=Math.min(g,m.GetNormalScale())}return g}_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(g){const h=this.GetScrollLeftBound(),l=this.GetScrollRightBound();g>l&&(g=l);g<h&&(g=h);this._scrollX!==g&&(this._scrollX=g,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(g){const h=this.GetScrollTopBound(),l=this.GetScrollBottomBound();g>l&&(g=l);g<h&&(g=h);this._scrollY!==g&&(this._scrollY=g,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}IsUnboundedScrolling(){return this._isUnboundedScrolling}BoundScrolling(){this.SetScrollX(this.GetScrollX());
|
|
this.SetScrollY(this.GetScrollY());for(const g of this._layers)g.IsOwnScrollPositionEnabled()&&(g.SetScrollX(g.GetScrollX()),g.SetScrollY(g.GetScrollY()))}SetVanishingPointXY(g,h){if(this._vanishingPointX!==g||this._vanishingPointY!==h)this._vanishingPointX=g,this._vanishingPointY=h,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender()}GetVanishingPointX(){return this._vanishingPointX}GetVanishingPointY(){return this._vanishingPointY}HasVanishingPointOutsideViewport(){const g=
|
|
this.GetVanishingPointX(),h=this.GetVanishingPointY();return 0>g||1<g||0>h||1<h}GetScale(){return this._scale}SetScale(g){this._scale!==g&&(this._scale=g,this._SetAllLayersMVChanged(),this.BoundScrolling(),this._runtime.UpdateRender())}SetAngle(g){g=d.clampAngle(g);this._angle!==g&&(this._angle=g,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(g){!isFinite(g)||1>g||(this._width=g)}GetHeight(){return this._height}SetHeight(g){!isFinite(g)||
|
|
1>g||(this._height=g)}GetEventSheet(){return this._eventSheet}GetLayers(){return this._layers}GetLayerCount(){return this._layers.length}GetLayer(g){return"number"===typeof g?this.GetLayerByIndex(g):this.GetLayerByName(g.toString())}GetLayerByIndex(g){g=d.clamp(Math.floor(g),0,this._layers.length-1);return this._layers[g]}GetLayerByName(g){return this._layersByName.get(g.toLowerCase())||null}GetLayerBySID(g){return this._layersBySid.get(g)||null}_SetAllLayersProjectionChanged(){for(const g of this._layers)g._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const g of this._layers)g._SetMVMatrixChanged()}SaveTransform(){return{scrollX:this.GetScrollX(),
|
|
scrollY:this.GetScrollY(),scale:this.GetScale(),angle:this.GetAngle(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY()}}RestoreTransform(g){this.SetScrollX(g.scrollX);this.SetScrollY(g.scrollY);this.SetScale(g.scale);this.SetAngle(g.angle);this.SetVanishingPointXY(g.vpX,g.vpY)}HasOpaqueBottomLayer(){for(const g of this._layers)if(g.ShouldDraw())return g._IsOpaque();return!1}GetLayoutBackgroundColor(){for(const g of this._layers)if(g.ShouldDraw()&&g._IsOpaque())return f.copyRgb(g.GetBackgroundColor()),
|
|
f.setA(1),f;f.setRgba(0,0,0,0);return f}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(g){if(g.IsInContainer())for(const h of g.GetContainer().GetObjectTypes())this._initialObjectClasses.add(h);else this._initialObjectClasses.add(g)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(g,h){if(g===this||!h)return Promise.resolve();g&&(d.CopySet(this._textureLoadedTypes,g._textureLoadedTypes),g._textureLoadedTypes.clear());
|
|
g=[];for(const l of this._initialObjectClasses)this._textureLoadedTypes.has(l)||(g.push(l.LoadTextures(h)),this._textureLoadedTypes.add(l));return Promise.all(g)}async MaybeLoadTexturesFor(g){if(g.IsFamily())throw Error("cannot load textures for family");var h=this._runtime.GetRenderer();!h||h.IsContextLost()||this._textureLoadedTypes.has(g)||(this._textureLoadedTypes.add(g),h=g.LoadTextures(h),this._AddPendingTextureLoadPromise(h),await h,g.OnDynamicTextureLoadComplete(),this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(g){this._textureLoadPendingPromises.add(g);
|
|
g.then(()=>this._textureLoadPendingPromises.delete(g)).catch(()=>this._textureLoadPendingPromises.delete(g))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(g){if(g.IsFamily()||0<g.GetInstanceCount())throw Error("cannot unload textures");const h=this._runtime.GetRenderer();h&&this._textureLoadedTypes.has(g)&&(this._textureLoadedTypes.delete(g),g.ReleaseTextures(h))}_Unload(g,h){if(g!==this&&h)for(const l of this._textureLoadedTypes)l.IsGlobal()||
|
|
g._initialObjectClasses.has(l)||(l.ReleaseTextures(),this._textureLoadedTypes.delete(l))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(g){const h=this._runtime,l=this._layoutManager,m=h.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=m.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());l._SetMainRunningLayout(this);this._width=this._originalWidth;this._height=this._originalHeight;this._scrollX=h.GetOriginalViewportWidth()/
|
|
2;this._scrollY=h.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(g);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();l.ClearPendingChangeLayout();h.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);const p=this._runtime.GetCreatePromises();await Promise.all(p);d.clearArray(p);
|
|
if(!h.IsLoadingState()){for(const x of this._createdInstances)x.SetupInitialSceneGraphConnections();for(const x of this._createdInstances)x._TriggerOnCreated()}d.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(x=>x.PreloadTexturesWithInstances(this._runtime.GetRenderer())));g&&(h.Dispatcher().dispatchEvent(new d.Event("beforefirstlayoutstart")),await h.DispatchUserScriptEventAsyncWait(new d.Event("beforeprojectstart")));await this.DispatchUserScriptEventAsyncWait(new d.Event("beforelayoutstart"));
|
|
h.IsLoadingState()||await h.TriggerAsync(d.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new d.Event("afterlayoutstart"));g&&(h.Dispatcher().dispatchEvent(new d.Event("afterfirstlayoutstart")),await h.DispatchUserScriptEventAsyncWait(new d.Event("afterprojectstart")));m._RunQueuedTriggers(l);await this.WaitForPendingTextureLoadsToComplete();this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged();this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(g){for(const l of this._runtime.GetAllObjectClasses())if(!l.IsFamily()&&
|
|
l.IsWorldType())for(const m of l.GetInstances()){const p=m.GetWorldInfo();var h=p.GetLayer();h=d.clamp(h.GetIndex(),0,this._layers.length-1);h=this._layers[h];p._SetLayer(h);h._MaybeAddInstance(m)}if(!g)for(const l of this._layers)l._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const g of this._layers)g.CreateInitialInstances(this._createdInstances),g.UpdateViewport(),g._Start()}_CreatePersistedInstances(){let g=!1;for(const [l,m]of Object.entries(this._persistData)){const p=
|
|
this._runtime.GetObjectClassBySID(parseInt(l,10));if(p&&!p.IsFamily()&&p.HasPersistBehavior()){for(const x of m){var h=null;if(p.IsWorldType()&&(h=this.GetLayerBySID(x.w.l),!h))continue;h=this._runtime.CreateInstanceFromData(p,h,!1,0,0,!0);h.LoadFromJson(x);g=!0;this._createdInstances.push(h)}d.clearArray(m)}}for(const l of this._layers)l._SortInstancesByLastCachedZIndex(!0),l.SetZIndicesChanged();g&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(g){for(const l of g){if(!l.IsInContainer())continue;
|
|
const m=l.GetWorldInfo(),p=l.GetIID();for(const x of l.GetObjectClass().GetContainer().objectTypes())if(x!==l.GetObjectClass()){var h=x.GetInstances();h.length>p?l._AddSibling(h[p]):(h=m?this._runtime.CreateInstanceFromData(x,m.GetLayer(),!0,m.GetX(),m.GetY(),!0):this._runtime.CreateInstanceFromData(x,null,!0,0,0,!0),this._runtime.FlushPendingInstances(),x._UpdateIIDs(),l._AddSibling(h),g.push(h))}}}_CreateInitialNonWorldInstances(){for(const g of this._initialNonWorld)this._runtime.GetObjectClassByIndex(g[1]).IsInContainer()||
|
|
this._runtime.CreateInstanceFromData(g,null,!0)}_CreateGlobalNonWorlds(){const g=[],h=this._initialNonWorld;let l=0;for(let m=0,p=h.length;m<p;++m){const x=h[m],v=this._runtime.GetObjectClassByIndex(x[1]);v.IsGlobal()?v.IsInContainer()&&v.GetContainer().HasAnyWorldType()||g.push(this._runtime.CreateInstanceFromData(x,null,!0)):(h[l]=x,++l)}d.truncateArray(h,l);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(g)}RecreateInitialObjects(g,h,l,m,p,x){if(l)return l.RecreateInitialObjects(g,
|
|
h,m,p,x);l=[];for(const v of this._layers)l.push(v.RecreateInitialObjects(g,h,m,p,x));return l.flat()}async _StopRunning(){const g=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(d.Plugins.System.Cnds.OnLayoutEnd,null,null);g.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();this._isFirstVisit||this._SavePersistData();for(const h of this._layers)h._End();for(const h of this._runtime.GetAllObjectClasses())if(!(h.IsGlobal()||h.IsWorldType()||
|
|
h.GetPlugin().IsSingleGlobal()||h.IsFamily())){for(const l of h.GetInstances())this._runtime.DestroyInstance(l);this._runtime.FlushPendingInstances()}g.SetIsEndingLayout(!1);g.GetMainRunningLayout()===this&&g._SetMainRunningLayout(null)}_SaveInstanceToPersist(g){const h=g.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(h)||(this._persistData[h]=[]);this._persistData[h].push(g.SaveToJson())}_SavePersistData(){for(const g of this._layers){g._UpdateZIndices();for(const h of g._GetInstances()){const l=
|
|
h.GetObjectClass();!l.IsGlobal()&&l.HasPersistBehavior()&&this._SaveInstanceToPersist(h)}}}ResetPersistData(){this._persistData={};this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){return"low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()||this._runtime.UsesAnyBackgroundBlending()||"low-latency"===this._runtime.GetCompositingMode()||this._effectList.HasAnyActiveEffect()||this._runtime.GetRenderer().IsWebGL()&&this._runtime.Uses3DFeatures()}_CanFastPathDrawLayout(g){return 0===
|
|
g.length?!0:2<=g.length?!1:!g[0].GetShaderProgram().MustPreDraw()}Draw(g){var h=this._runtime.GetCanvasManager();const l=this.UsesOwnTexture();var m=null;l?("low-latency"!==this._runtime.GetCompositingMode()&&(g.SetRenderTarget(null),g.ClearRgba(0,0,0,0)),m={sampling:this._runtime.GetSampling(),isSampled:g.IsWebGPU()||this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()},"low"===h.GetCurrentFullscreenScalingQuality()&&(m.width=h.GetDrawWidth(),m.height=h.GetDrawHeight()),
|
|
m=this._runtime.GetAdditionalRenderTarget(m),g.SetRenderTarget(m)):g.SetRenderTarget(null);g.Clear(this.GetLayoutBackgroundColor());this._runtime.Uses3DFeatures()&&g.ClearDepth();this._curRenderTarget=m;h=!0;for(const p of this._layers)p.UpdateViewport(),p.ShouldDraw()&&(p.Draw(g,m,h),h=!1);l&&(g.SetDepthEnabled(!1),this._DrawLayoutOwnTextureToRenderTarget(g,m));this._curRenderTarget=null}_DrawLayoutOwnTextureToRenderTarget(g,h){const l=this._effectList.GetActiveEffectTypes(),m=this._runtime;if(this._CanFastPathDrawLayout(l)){g.SetRenderTarget(null);
|
|
if(1===l.length){var p=l[0];const x=p.GetShaderProgram();g.SetProgram(x);e.set(0,0,1,1);c.set(0,0,m.GetViewportWidth(),m.GetViewportHeight());p=this._effectList.GetEffectParametersForIndex(p.GetIndex());g.SetProgramParameters(null,b,e,e,c,1/m.GetDrawWidth(),1/m.GetDrawHeight(),this.GetScale(),this.GetAngle(),m.GetGameTime(),p);x.IsAnimated()&&m.UpdateRender()}else g.SetTextureFillMode();0===l.length?g.CopyRenderTarget(h):(g.SetAlphaBlend(),g.ResetColor(),g.DrawRenderTarget(h));g.InvalidateRenderTarget(h);
|
|
m.ReleaseAdditionalRenderTarget(h)}else d.RenderEffectChain(g,m,this,null,l)}_SaveToJson(){const g={sx:this.GetScrollX(),sy:this.GetScrollY(),s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(),layers:{}};for(const h of this._layers)g.layers[h.GetSID().toString()]=h._SaveToJson();return g}_LoadFromJson(g){this._scrollX=g.sx;this._scrollY=
|
|
g.sy;this._scale=g.s;this._angle=g.a;this._width=g.w;this._height=g.h;g.hasOwnProperty("vpX")&&(this._vanishingPointX=g.vpX);g.hasOwnProperty("vpY")&&(this._vanishingPointY=g.vpY);this._isFirstVisit=!!g.fv;this._persistData=g.persist;this._effectList.LoadFromJson(g.fx);for(const [h,l]of Object.entries(g.layers))g=parseInt(h,10),(g=this.GetLayerBySID(g))&&g._LoadFromJson(l);this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged()}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(g){g.layout=
|
|
this.GetILayout();var h=this._runtime;(h=h.IsDebug()&&!h.GetEventSheetManager().IsInEventEngine())&&a.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(g);h&&a.AddScriptTime()}DispatchUserScriptEventAsyncWait(g){g.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(g)}}}
|
|
{"use strict";const d=self.C3;d.LayoutManager=class extends d.DefendedBase{constructor(a){super();this._runtime=a;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;d.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear();
|
|
d.clearArray(this._runningSubLayouts)}Create(a){a=d.New(d.Layout,this,this._allLayouts.length,a);this._allLayouts.push(a);this._layoutsByName.set(a.GetName().toLowerCase(),a);this._layoutsBySid.set(a.GetSID(),a)}GetRuntime(){return this._runtime}SetFirstLayout(a){this._firstLayout=a}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw Error("no first layout");}GetLayoutByName(a){return this._layoutsByName.get(a.toLowerCase())||
|
|
null}GetLayoutBySID(a){return this._layoutsBySid.get(a)||null}GetLayoutByIndex(a){a=d.clamp(Math.floor(a),0,this._allLayouts.length-1);return this._allLayouts[a]}GetLayout(a){return"number"===typeof a?this.GetLayoutByIndex(a):this.GetLayoutByName(a.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(a){this._mainRunningLayout=a}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(a){if(this._runningSubLayouts.includes(a))throw Error("layout already running");
|
|
this._runningSubLayouts.push(a)}_RemoveRunningSubLayout(a){a=this._runningSubLayouts.indexOf(a);if(-1===a)throw Error("layout not running");this._runningSubLayouts.splice(a,1)}*runningLayouts(){this._mainRunningLayout&&(yield this._mainRunningLayout);this._runningSubLayouts.length&&(yield*this._runningSubLayouts)}IsLayoutRunning(a){return this._mainRunningLayout===a||this._runningSubLayouts.includes(a)}SetIsEndingLayout(a){if(a)this._isEndingLayout++;else{if(0>=this._isEndingLayout)throw Error("already unset");
|
|
this._isEndingLayout--}}IsEndingLayout(){return 0<this._isEndingLayout}ChangeMainLayout(a){this._pendingChangeLayout=a}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}SetAllLayerProjectionChanged(){const a=this.GetMainRunningLayout();a&&a._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const a=this.GetMainRunningLayout();a&&a._SetAllLayersMVChanged()}}}
|
|
{"use strict";const d=self.C3;class a{constructor(){this.runtime=this.renderer=null;this.surfaceHeight=this.surfaceWidth=this.drawHeight=this.drawWidth=0;this.layoutRect=new d.Rect;this.rcTexBounce=new d.Rect;this.rcTexDest=new d.Rect;this.rcTexOrigin=new d.Rect;this.screenRect=new d.Rect;this.clearRect=new d.Rect;this.srcRect=new d.Rect;this.fxTex=[null,null];this.fxIndex=0;this.otherFxIndex=1;this.layerAngle=this.layerScale=this.boxExtendVertical=this.boxExtendHorizontal=0;this.renderTarget=this.wi=
|
|
this.inst=this.layer=this.layout=null;this.didChangeTransform=this.postDraw=this.preDraw=!1;this.opts=null}Clear(){this.opts=this.renderTarget=this.wi=this.inst=this.layer=this.layout=this.runtime=this.renderer=null}ShouldPreDraw(q){q=q.GetShaderProgram();if(q.MustPreDraw())return!0;if(this.inst)return q.UsesDest()&&(0!==this.wi.GetAngle()||0>this.wi.GetWidth()||0>this.wi.GetHeight())||0!==this.boxExtendHorizontal||0!==this.boxExtendVertical||!this.wi.HasDefaultColor()||this.inst.MustPreDraw();if(this.layer)return!this.layer.HasDefaultColor()}ShouldPostDraw(q){q=
|
|
q.GetShaderProgram();return q.UsesDest()||q.UsesCrossSampling()||this.layout&&"low"===this.runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()}GetEffectRenderTarget(q){if(0!==q&&1!==q)throw Error("invalid effect target");const y=this.fxTex;if(!y[q]){var u=this.runtime;const t=u.GetCanvasManager();u={sampling:u.GetSampling()};"low"===t.GetCurrentFullscreenScalingQuality()&&(u.width=t.GetDrawWidth(),u.height=t.GetDrawHeight());y[q]=t.GetAdditionalRenderTarget(u)}return y[q]}ReleaseEffectRenderTargets(){const q=
|
|
this.fxTex,y=this.runtime.GetCanvasManager();q[0]&&(y.ReleaseAdditionalRenderTarget(q[0]),q[0]=null);q[1]&&(y.ReleaseAdditionalRenderTarget(q[1]),q[1]=null)}}const b=[];let e=0;function c(){e===b.length&&b.push(new a);return b[e++]}function f(q){q.ReleaseEffectRenderTargets();q.Clear();e--}const g=new d.Quad;let h=!1;async function l(q,y,u){y=await d.Gfx.WebGLRenderTarget.DebugReadPixelsToBlob(y,u);y=URL.createObjectURL(y);console.log("[FX] "+q+" "+(u?"":" [to display]")+": ",y)}d.RenderEffectChain=
|
|
function(q,y,u,t,A,z){const C=c();C.renderer=q;C.runtime=y;if(u instanceof d.Instance)C.inst=u,C.wi=C.inst.GetWorldInfo();else if(u instanceof d.Layer)C.layer=u;else if(u instanceof d.Layout)C.layout=u;else throw Error("invalid effects object");u=y.GetCanvasManager();C.renderTarget=t;C.drawWidth=u.GetDrawWidth();C.drawHeight=u.GetDrawHeight();C.surfaceWidth=C.drawWidth;C.surfaceHeight=C.drawHeight;C.fxIndex=0;C.otherFxIndex=1;C.boxExtendHorizontal=0;C.boxExtendVertical=0;C.screenRect.set(0,0,C.drawWidth,
|
|
C.drawHeight);C.clearRect.set(0,0,C.drawWidth,C.drawHeight);C.didChangeTransform=!1;C.opts=z;C.inst?(t=C.wi,C.layerScale=t.GetLayer().GetRenderScale(),C.layerAngle=t.GetLayer().GetAngle(),C.layoutRect.copy(t.GetBoundingBox())):C.layer?(t=C.layer,C.layerScale=t.GetRenderScale(),C.layerAngle=t.GetAngle(),C.layoutRect.copy(t.GetViewport())):(t=C.layout,C.layerScale=t.GetScale(),C.layerAngle=t.GetAngle(),C.layoutRect.set(0,0,C.drawWidth,C.drawHeight));C.inst?m(C,A):(C.rcTexBounce.set(0,0,C.drawWidth/
|
|
C.surfaceWidth,C.drawHeight/C.surfaceHeight),C.rcTexDest.copy(C.rcTexBounce),C.rcTexOrigin.copy(C.rcTexBounce),C.rcTexBounce.swapTopBottom(),C.rcTexDest.swapTopBottom(),C.rcTexOrigin.swapTopBottom());q.SetAlphaBlend();q.ResetColor();q.SetBaseZ(0);q.SetCurrentZ(0);C.preDraw=C.ShouldPreDraw(A[0]);C.preDraw&&p(C);q.ResetColor();t=A.length-1;C.postDraw=C.ShouldPostDraw(A[t]);for(let E=0,J=A.length;E<J;++E)z=A[E],u=z.GetShaderProgram(),q.SetProgram(u),u.IsAnimated()&&y.UpdateRender(),0!==E||C.preDraw?
|
|
(q.SetCopyBlend(),v(C,z,E===t&&!C.postDraw,E)):x(C,z),0===C.fxIndex?(C.fxIndex=1,C.otherFxIndex=0):(C.fxIndex=0,C.otherFxIndex=1);C.postDraw&&r(C,A);q=C.didChangeTransform;f(C);h=!1;return q};function m(q,y){for(let I=0,L=y.length;I<L;++I){var u=y[I].GetShaderProgram();q.boxExtendHorizontal+=u.GetBoxExtendHorizontal();q.boxExtendVertical+=u.GetBoxExtendVertical()}var t=q.wi;y=t.GetLayer();var A=y.GetAngle();u=t.GetBoundingBox();var z=t.GetTotalZElevation();t=t.GetDepth();let [C,E]=y.LayerToDrawSurface(u.getLeft(),
|
|
u.getTop(),z),[J,G]=y.LayerToDrawSurface(u.getRight(),u.getBottom(),z);if(0!==A||0<t){const [I,L]=y.LayerToDrawSurface(u.getRight(),u.getTop(),z),[N,S]=y.LayerToDrawSurface(u.getLeft(),u.getBottom(),z);if(0<t){A=z+t;const [X,U]=y.LayerToDrawSurface(u.getLeft(),u.getTop(),A),[W,ia]=y.LayerToDrawSurface(u.getRight(),u.getTop(),A),[ka,ya]=y.LayerToDrawSurface(u.getRight(),u.getBottom(),A),[ta,Ba]=y.LayerToDrawSurface(u.getLeft(),u.getBottom(),A);y=Math.min(C,J,I,N,X,W,ka,ta);J=Math.max(C,J,I,N,X,W,ka,
|
|
ta);C=y;y=Math.min(E,G,L,S,U,ia,ya,Ba);G=Math.max(E,G,L,S,U,ia,ya,Ba);E=y}else y=Math.min(C,J,I,N),J=Math.max(C,J,I,N),C=y,y=Math.min(E,G,L,S),G=Math.max(E,G,L,S),E=y}y=q.screenRect;u=q.rcTexOrigin;A=q.rcTexDest;z=q.clearRect;t=q.rcTexBounce;y.set(C,E,J,G);y.shuntY(q.drawHeight);u.copy(y);u.divide(q.surfaceWidth,q.surfaceHeight);u.swapTopBottom();y.inflate(q.boxExtendHorizontal,q.boxExtendVertical);A.copy(y);A.divide(q.surfaceWidth,q.surfaceHeight);A.swapTopBottom();z.copy(y);z.roundOuter();z.inflate(q.boxExtendHorizontal+
|
|
1,q.boxExtendVertical+1);y.clamp(0,0,q.drawWidth,q.drawHeight);z.clamp(0,0,q.drawWidth,q.drawHeight);t.copy(y);t.divide(q.surfaceWidth,q.surfaceHeight);t.swapTopBottom()}function p(q){const y=q.renderer;y.SetTextureFillMode();const u=q.GetEffectRenderTarget(q.fxIndex);y.SetRenderTarget(u);var t=q.opts;t&&t.preTransform&&t.preTransform();y.ClearRect2(q.clearRect);q.inst?(y.SetColor(q.wi.GetPremultipliedColor()),y.SetCurrentZ(q.wi.GetTotalZElevation()),q.inst.Draw(y),y.SetCurrentZ(0)):(t=(q.layer||
|
|
q.layout).GetRenderTarget(),q.layer?y.SetColor(q.layer.GetPremultipliedColor()):y.ResetColor(),y.DrawRenderTarget(t),y.InvalidateRenderTarget(t),q.runtime.GetCanvasManager().ReleaseAdditionalRenderTarget(t));q.rcTexDest.clampFlipped(0,1,1,0);q.fxIndex=1;q.otherFxIndex=0;h&&l("Pre-draw",y,u)}function x(q,y){const u=q.renderer,t=q.runtime,A=q.GetEffectRenderTarget(q.fxIndex);u.SetRenderTarget(A);var z=q.opts;z&&z.preTransform&&z.preTransform();u.ClearRect2(q.clearRect);if(q.inst){const [C,E]=q.inst.GetCurrentSurfaceSize();
|
|
(z=q.inst.GetCurrentTexRect())?q.srcRect.copy(z):q.srcRect.set(0,0,0,0);y=q.wi.GetInstanceEffectList().GetEffectParametersForIndex(y.GetIndex());u.SetProgramParameters(q.renderTarget,q.rcTexDest,q.srcRect,q.srcRect,q.layoutRect,1/C,1/E,q.layerScale,q.layerAngle,t.GetGameTime(),y);u.SetCurrentZ(q.wi.GetTotalZElevation());q.inst.Draw(u);u.SetCurrentZ(0);q.rcTexDest.clampFlipped(0,1,1,0);q.screenRect.shuntY(q.drawHeight)}else y=(q.layer||q.layout).GetEffectList().GetEffectParametersForIndex(y.GetIndex()),
|
|
u.SetProgramParameters(q.renderTarget,q.rcTexDest,q.rcTexBounce,q.rcTexOrigin,q.layoutRect,1/q.drawWidth,1/q.drawHeight,q.layerScale,q.layerAngle,t.GetGameTime(),y),q=(q.layer||q.layout).GetRenderTarget(),h&&l("Layer target",u,q),u.DrawRenderTarget(q),u.InvalidateRenderTarget(q),t.GetCanvasManager().ReleaseAdditionalRenderTarget(q);h&&l("First bounce",u,A)}function v(q,y,u,t){const A=q.renderer,z=q.runtime;0===t&&q.preDraw&&q.inst&&q.screenRect.shuntY(q.drawHeight);u?(q.inst?A.SetBlendMode(q.wi.GetBlendMode()):
|
|
q.layer&&A.SetBlendMode(q.layer.GetBlendMode()),u=q.renderTarget,A.SetRenderTarget(u)):(u=q.GetEffectRenderTarget(q.fxIndex),A.SetRenderTarget(u),A.ClearRect2(q.clearRect));y=q.inst?q.wi.GetInstanceEffectList().GetEffectParametersForIndex(y.GetIndex()):(q.layer||q.layout).GetEffectList().GetEffectParametersForIndex(y.GetIndex());A.SetProgramParameters(q.renderTarget,q.rcTexDest,q.rcTexBounce,q.rcTexOrigin,q.layoutRect,1/q.surfaceWidth,1/q.surfaceHeight,q.layerScale,q.layerAngle,z.GetGameTime(),y);
|
|
y=q.GetEffectRenderTarget(q.otherFxIndex);A.SetTexture(y.GetTexture());z.GetCanvasManager().SetDeviceTransform(A);q.didChangeTransform=!0;g.setFromRect(q.screenRect);A.Quad3(g,q.rcTexBounce);q.inst||A.InvalidateRenderTarget(y);h&&l("Bounce "+t,A,u)}function r(q,y){y=q.renderer;if(q.layout)y.SetTextureFillMode(),y.SetRenderTarget(q.renderTarget),q=q.GetEffectRenderTarget(q.otherFxIndex),y.CopyRenderTarget(q),y.InvalidateRenderTarget(q);else{var u=q.runtime.GetCanvasManager();"low"===u.GetCurrentFullscreenScalingQuality()?
|
|
(y.SetTextureFillMode(),u.SetDeviceTransform(y,u.GetDrawWidth(),u.GetDrawHeight()),q.didChangeTransform=!0):y.SetDeviceTransformTextureFillMode();q.inst?y.SetBlendMode(q.wi.GetBlendMode()):q.layer&&y.SetBlendMode(q.layer.GetBlendMode());y.SetRenderTarget(q.renderTarget);u=q.GetEffectRenderTarget(q.otherFxIndex);y.SetTexture(u.GetTexture());g.setFromRect(q.screenRect);y.Quad3(g,q.rcTexBounce);q.inst||y.InvalidateRenderTarget(u);h&&l("Post-draw",y,q.renderTarget)}}}
|
|
{"use strict";const d=self.C3,a=/<(.+?)>/g;d.TimelineManager=class extends d.DefendedBase{constructor(b){super();this._runtime=b;this._timelineDataManager=d.New(d.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._isTickingTimelines=this._changingLayout=this._hasRuntimeListeners=!1;this._tickFunc=()=>this._OnTick();
|
|
this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=e=>this._OnInstanceDestroy(e.instance);this._afterLoad=e=>this._OnAfterLoad();this._destroyedWhileLoadingState=[]}Release(){this.RemoveRuntimeListeners();this._afterLoad=this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const b of this._timelines)b.Stop(),b.Release();d.clearArray(this._timelines);
|
|
this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;d.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;d.clearArray(this._playingTimelines);this._playingTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();this._timelinesCreatedByTemplate=null;d.clearArray(this._destroyedWhileLoadingState);this._runtime=this._destroyedWhileLoadingState=
|
|
null}AddRuntimeListeners(){const b=this._runtime.Dispatcher();b.addEventListener("pretick",this._tickFunc);b.addEventListener("tick2",this._tick2Func);b.addEventListener("beforelayoutchange",this._beforeLayoutChange);b.addEventListener("layoutchange",this._layoutChange);b.addEventListener("instancedestroy",this._instanceDestroy);b.addEventListener("afterload",this._afterLoad)}RemoveRuntimeListeners(){const b=this._runtime.Dispatcher();b.removeEventListener("pretick",this._tickFunc);b.removeEventListener("tick2",
|
|
this._tick2Func);b.removeEventListener("beforelayoutchange",this._beforeLayoutChange);b.removeEventListener("layoutchange",this._layoutChange);b.removeEventListener("instancedestroy",this._instanceDestroy);b.removeEventListener("afterload",this._afterLoad)}Create(b){this._timelineDataManager.Add(b);b=d.TimelineState.CreateInitial(b,this);this.Add(b);this.SetTimelineObjectClassesToMap(b);this._timelinesCreatedByTemplate.set(b.GetName(),0)}CreateFromTemplate(b){var e=this.GetTimelineDataManager();b=
|
|
b.GetTemplateName();e=e.Get(b);e=d.TimelineState.CreateFromTemplate(`${b}:${this._timelinesCreatedByTemplate.get(b)}`,e,this);this._IncreaseTemplateTimelinesCount(b);this.Add(e);return e}_IncreaseTemplateTimelinesCount(b){this._timelinesCreatedByTemplate.set(b,this._timelinesCreatedByTemplate.get(b)+1)}_SetCreatedTemplateTimelinesCount(){for(const b of this._timelines){if(b.IsTemplate())continue;const e=b.GetTemplateName();this._IncreaseTemplateTimelinesCount(e)}}_ClearCreatedTemplateTimelinesCount(){for(const b of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(b,
|
|
0)}Add(b){this._timelines.push(b);this._timelinesByName.set(b.GetName().toLowerCase(),b)}Remove(b){b.IsTemplate()||(d.arrayFindRemove(this._timelines,b),d.arrayFindRemove(this._scheduledTimelines,b),d.arrayFindRemove(this._playingTimelines,b),this._timelinesByName.delete(b.GetName().toLowerCase()),this.RemoveTimelineFromObjectClassMap(b),b.IsReleased()||b.Release())}Trigger(b){this._runtime.Trigger(b,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(b){this._pluginInstance=
|
|
b}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const b of this._timelines)yield b}SetTimelineObjectClassToMap(b,e){this._objectClassToTimelineMap.has(b)||this._objectClassToTimelineMap.set(b,new Set);this._objectClassToTimelineMap.get(b).add(e)}SetTimelineObjectClassesToMap(b){for(const e of b.GetObjectClasses())this.SetTimelineObjectClassToMap(e,b)}RemoveTimelineFromObjectClassMap(b){for(const [e,c]of this._objectClassToTimelineMap.entries())c.has(b)&&(c.delete(b),0===c.size&&
|
|
this._objectClassToTimelineMap.delete(e))}GetTimelinesForObjectClass(b){if(this._objectClassToTimelineMap.has(b))return this._objectClassToTimelineMap.get(b)}GetTimelineOfTemplateForInstances(b,e){if(e)for(const c of this._timelines)if(e.every(f=>c.HasTrackInstance(f.instance,f.trackId))&&c.GetName().includes(b.GetName()))return c}GetTimelineByName(b){return this._timelinesByName.get(b.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(b){for(const e of this._scheduledTimelines)if(e.GetName()===
|
|
b)return e;for(const e of this._playingTimelines)if(e.GetName()===b)return e;return null}*GetTimelinesByName(b){if(a.test(b)){a.lastIndex=0;let c;var e=new Set;do if(c=a.exec(b)){const f=c[1].split(",");for(const g of f)e.add(g)}while(c);for(const f of e.values())(b=this.GetTimelineByName(f))&&(yield b);e.clear()}else(e=this.GetTimelineByName(b))&&(yield e)}*GetTimelinesByTags(b){for(const e of this._timelines)e.HasTags(b)&&(yield e)}AddScheduledTimeline(b){this._scheduledTimelines.includes(b)||this._scheduledTimelines.push(b);
|
|
this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(b){d.arrayFindRemove(this._playingTimelines,b);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(b){this._playingTimelines.includes(b)?(b.SetPlaying(!0),b.SetScheduled(!1),b.SetMarkedForRemoval(!1)):(b.SetPlaying(!1),b.SetScheduled(!0),b.SetMarkedForRemoval(!1),this._scheduledTimelines.includes(b)||this._scheduledTimelines.push(b));this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(b){b.SetPlaying(!1);b.SetScheduled(!1);b.ResolvePlayPromise();
|
|
d.arrayFindRemove(this._scheduledTimelines,b);this._MaybeDisableRuntimeListeners()}CompleteTimeline(b){b.SetPlaying(!1);b.SetScheduled(!1);b.SetMarkedForRemoval(!0)}CompleteTimelineAndResolve(b){this.CompleteTimeline(b);b.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var b=!1;for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var e=this._scheduledTimelines.pop();e.SetInitialState();this._playingTimelines.push(e)}e=
|
|
this._runtime.GetDt();var c=this._runtime.GetTimeScale();for(const f of this._playingTimelines){if(f.IsMarkedForRemoval())continue;const g=f.Tick(e,c);!b&&g&&(b=!0)}this._isTickingTimelines=!1;b&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var b;for(const e of this._playingTimelines)e.IsMarkedForRemoval()&&(b||(b=new Set),this._MaybeExecuteTimelineFinishTriggers(e),b.add(e));b&&d.arrayRemoveAllInSet(this._playingTimelines,
|
|
b);this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(b){b.IsReleased()||b.HasValidTracks()&&b.IsComplete()&&b.InitialStateSet()&&b.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._playingTimelines.length||this._scheduledTimelines.length||this._isTickingTimelines||(this._hasRuntimeListeners=!1)}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop());
|
|
const b=new Set;for(const e of this._playingTimelines)e._OnBeforeChangeLayout()&&b.add(e);d.arrayRemoveAllInSet(this._playingTimelines,b);this._MaybeDisableRuntimeListeners();for(const e of this._timelines)e.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(b){var e=b.GetObjectClass();if(e=this.GetTimelinesForObjectClass(e))if(this._runtime.IsLoadingState())this._destroyedWhileLoadingState.push(b);else for(const c of e)c.IsTemplate()||(c.IsReleased()?this.Remove(c):c.HasValidTracks()||
|
|
(this._MaybeExecuteTimelineFinishTriggers(c),this.Remove(c)))}_OnAfterLoad(){for(const b of this._destroyedWhileLoadingState)this._OnInstanceDestroy(b);d.clearArray(this._destroyedWhileLoadingState)}_SaveToJson(){return{timelinesJson:this._SaveTimelinesToJson(),scheduledTimelinesJson:this._SaveScheduledTimelinesToJson(),playingTimelinesJson:this._SavePlayingTimelinesToJson(),hasRuntimeListeners:this._hasRuntimeListeners,changingLayout:this._changingLayout,isTickingTimelines:this._isTickingTimelines}}_LoadFromJson(b){b&&
|
|
(this._ClearCreatedTemplateTimelinesCount(),this._LoadTimelinesFromJson(b.timelinesJson),this._LoadScheduledTimelinesFromJson(b.scheduledTimelinesJson),this._LoadPlayingTimelinesFromJson(b.playingTimelinesJson),this._hasRuntimeListeners=!b.hasRuntimeListeners,this._changingLayout=!!b.changingLayout,this._isTickingTimelines=!!b.isTickingTimelines,this._SetCreatedTemplateTimelinesCount(),this._MaybeEnableRuntimeListeners(),this._MaybeDisableRuntimeListeners())}_SaveTimelinesToJson(){return this._timelines.map(b=>
|
|
b._SaveToJson())}_LoadTimelinesFromJson(b){for(const e of b){b=this.GetTimelineByName(e.name);if(!b){b=this._GetTemplateNameFromJson(e);if(!b)continue;b=this.GetTimelineByName(b);b=this.CreateFromTemplate(b)}b._LoadFromJson(e);b.HasTracks()||this.Remove(b)}}_GetTemplateNameFromJson(b){return(b=b.name.split(":"))&&2===b.length?b[0]:null}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(b){this._LoadTimelines(b,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(b){this._LoadTimelines(b,
|
|
this._playingTimelines)}_IsTimelineInJson(b,e){for(const c of e)if(c===b.GetName())return!0;return!1}_SaveTimelines(b){return b.map(e=>e.GetName())}_LoadTimelines(b,e){var c=new Set;for(const f of e)this._IsTimelineInJson(f,b)||c.add(f);d.arrayRemoveAllInSet(e,c);c=f=>g=>g.GetName()===f;for(const f of b)(b=this.GetTimelineByName(f))&&(e.find(c(f))||e.push(b))}}}
|
|
{"use strict";const d=self.C3;d.TimelineState=class extends d.DefendedBase{constructor(a,b,e){super();this._runtime=e.GetRuntime();this._timelineManager=e;this._timelineDataItem=b;this._name=a;this._tracks=[];for(const c of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(d.TrackState.Create(this,c));this._playResolve=this._playPromise=null;this._playheadTime=d.New(d.KahanSum);this._playheadTime.Set(0);this._playbackRate=1;this._pingPongState=0;this._currentRepeatCount=1;this._initialStateSet=
|
|
this._isScheduled=this._isPlaying=!1;this._complete=!0;this._markedForRemoval=this._released=!1;this._completedTick=-1;this._firstTick=this._finishedTriggers=this._isTemplate=this._implicitPause=!1;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=!1}static CreateInitial(a,b){var e=b.GetTimelineDataManager();const c=e.GetNameId();e=e.Get(a[c]);a=d.New(d.TimelineState,a[c],e,b);a.SetIsTemplate(!0);return a}static CreateFromTemplate(a,b,e){return d.New(d.TimelineState,a,b,e)}static get WORLD_INSTANCE_BOX_CHANGE(){return 1}static get LAYOUT_RENDER_CHANGE(){return d.nextHighestPowerOfTwo(1)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this);
|
|
this._timelineManager.CompleteTimelineAndResolve(this);for(const a of this._tracks)a.Release();d.clearArray(this._tracks);this._tracks=null;this._playheadTime.Release();this._timelineDataItem=this._timelineManager=this._runtime=this._playheadTime=null;this._released=!0;this._playResolve=this._playPromise=null}}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(a,b,e){const c=[];for(const f of this._tracks){if(a!==
|
|
f.GetInstance())continue;const g=f.GetPropertyTrack(e);g&&b.constructor===g.GetSourceAdapter().constructor&&c.push(g)}return c}HasTracks(){return!!this._tracks.length}GetTrackById(a){for(const b of this._tracks)if(d.equalsNoCase(b.GetId(),a))return b;return null}SetName(a){this._name=a}GetName(){return this._name}GetTimelineDataItem(){return this._timelineDataItem}GetTemplateName(){return this._timelineDataItem.GetName()}GetTotalTime(){return this._timelineDataItem.GetTotalTime()}SetTotalTime(a){this._timelineDataItem.SetTotalTime(a)}GetStep(){return this._timelineDataItem.GetStep()}SetStep(a){this._timelineDataItem.SetStep(a)}GetInterpolationMode(){return this._timelineDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._timelineDataItem.SetInterpolationMode(a)}GetResultMode(){return this._timelineDataItem.GetResultMode()}SetResultMode(a){this._timelineDataItem.GetResultMode(a)}SetEase(a){for(const b of this.GetTracks())b.SetEase(a)}GetLoop(){return this._timelineDataItem.GetLoop()}SetLoop(a){return this._timelineDataItem.SetLoop(a)}GetPingPong(){return this._timelineDataItem.GetPingPong()}SetPingPong(a){return this._timelineDataItem.SetPingPong(a)}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(a){return this._playbackRate=
|
|
a}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return this.IsPlaying()?0<this._playbackRate:!0}GetPlayPromise(){return this._playPromise?this._playPromise:this._playPromise=new Promise(a=>{this._playResolve=a})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(a){this._tags=d.TimelineState._GetTagArray(a);this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){this._tagsChanged&&(this._stringTags=this._tags.join(" "));
|
|
this._tagsChanged=!1;return this._stringTags}HasTags(a){return this._tags&&this._tags.length?(a=d.TimelineState._GetTagArray(a))&&a.length?a.every(d.TimelineState._HasTag,this):!1:!1}OnStarted(){d.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnAnyTimelineStarted);
|
|
d.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,d.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnAnyTimelineFinished),
|
|
d.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(a){this._isPlaying=a}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(a=!1){return this.IsCompletedTick()||this.IsScheduled()&&!a?!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(a){this._isScheduled=a}IsScheduled(){return this._isScheduled}SetComplete(a){this._complete=
|
|
a;a=this.GetTime();if(0>=a||a>=this.GetTotalTime())this._complete=!0}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(a){this._markedForRemoval=a}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(a){this._implicitPause=a}IsImplicitPause(){return this._implicitPause}SetIsTemplate(a){this._isTemplate=!!a}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime.Get()}SetTime(a){const b=
|
|
this.GetTime();this._SetTime(a);this.SetComplete(!1);this.IsComplete()||this.SetImplicitPause(!0);if(this._IsPlaying()||this.IsScheduled()||!this._initialStateSet)this._IsPlaying()||this.IsScheduled()||this._initialStateSet?this._IsPlaying()?this.Stop():this.IsScheduled()&&(this._timelineManager.DeScheduleTimeline(this),this.SetInitialStateFromSetTime()):this.SetInitialStateFromSetTime();this._Interpolate(a,!1,!0,!0,b)&&this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(a){0>a?this._playheadTime.Set(0):
|
|
a>=this.GetTotalTime()?this._playheadTime.Set(this.GetTotalTime()):this._playheadTime.Set(a)}_OnSetTime(){d.Plugins.Timeline&&this.constructor===d.TimelineState&&(d.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(d.Plugins.Timeline.Cnds.OnTimeSetByTags),d.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(a=!1){return this.IsReleased()||this.IsScheduled()?!1:this._IsPlaying()&&this.IsCompletedTick()?this._SchedulePlayingTimeline():this._IsPlaying()||
|
|
!this.IsComplete()&&!a&&!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(a=!1){this.IsReleased()||(this.SetComplete(a),this._timelineManager.CompleteTimeline(this),this.IsComplete()&&
|
|
this.ResolvePlayPromise())}Reset(a=!0,b=!1){if(!this.IsReleased()){if(!this._IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(!this.IsComplete()){this.Stop(!0);this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());var e=this.GetTime();b=b?this._InterpolateBeforeChangeLayout(e):this._Interpolate(e,!1,!1,!0);a&&this._OnSetTime();b&&a&&this.GetRuntime().UpdateRender()}}}ResetBeforeChangeLayout(){this.Reset(!1,!0)}_InterpolateBeforeChangeLayout(a){this._Interpolate(a,
|
|
!1,!1,!0,NaN,!1,!0)}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(this.HasValidGlobalTracks())return!1;this._timelineManager.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(a){if(!this.IsMarkedForRemoval())if(a){this._firstTick=this._initialStateSet=!0;for(const b of this._tracks)b.SetInitialState()}else if(this.SetPlaying(!0),this.SetScheduled(!1),this.OnStarted(),this.IsComplete()){this._completedTick=
|
|
-1;this._pingPongState=0;this._currentRepeatCount=1;this._finishedTriggers=this._complete=!1;this._firstTick=this._initialStateSet=!0;this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());for(const b of this._tracks)b.SetInitialState()}else{this._firstTick=!0;for(const b of this._tracks)b.SetResumeState()}}Tick(a,b){if(0!==a||0!==this._lastDelta){this._lastDelta=a;var e=this.GetTime();this._SetTime(e+a*b*this._playbackRate);var c;this.GetLoop()||this.GetPingPong()?this.GetLoop()&&
|
|
!this.GetPingPong()?c=this._LoopCompleteCheck():!this.GetLoop()&&this.GetPingPong()?c=this._PingPongCompleteCheck():this.GetLoop()&&this.GetPingPong()&&(c=this._LoopPingPongCompleteCheck()):c=this._SimpleCompleteCheck();if(c){for(const f of this._tracks)f.SetEndState();this.Stop(!0);this.OnCompleted();return!0}return this._Interpolate(this.GetTime(),!0,!1,!1,e,!0)}}_Interpolate(a,b=!1,e=!1,c=!1,f=NaN,g=!1,h=!1){let l=!1;for(var m of this._tracks)m.BeforeInterpolate();for(const p of this._tracks){m=
|
|
a;if("number"===typeof f){const x=this.GetTime()-p.GetStartOffset(),v=f-p.GetStartOffset();0>x&&0<v&&(m=p.GetStartOffset(),this._SetTime(m))}m=p.Interpolate(m,b,e,c,this._firstTick,h);!l&&m&&(l=!0)}for(const p of this._tracks)p.AfterInterpolate();this._firstTick&&g&&(this._firstTick=!1);return l}_SimpleCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(0);else return this._SetTime(this.GetTotalTime()),
|
|
!0}else if(0>=this.GetTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(this.GetTotalTime());else return this._SetTime(0),!0;return!1}_LoopCompleteCheck(){this.IsForwardPlayBack()?this.GetTime()>=this.GetTotalTime()&&this._SetTime(0):0>=this.GetTime()&&this._SetTime(this.GetTotalTime());return!1}_PingPongCompleteCheck(){if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())if(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate()),
|
|
1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1)}else if(0>=this.GetTime())if(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1===this._pingPongState)if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=0;else return!0;else 0===this._pingPongState&&(this._pingPongState=1);return!1}_LoopPingPongCompleteCheck(){this.IsForwardPlayBack()?
|
|
this.GetTime()>=this.GetTotalTime()&&(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this.GetTime()&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()));return!1}AddTrack(){var a=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();a=d.TrackState.Create(this,a);this._tracks.push(a);return a}CleanCaches(){for(const a of this._tracks)a.CleanCaches()}ClearTrackInstances(){for(const a of this._tracks)a.ClearInstance()}SetTrackInstance(a,
|
|
b){if(b)for(const e of this._tracks){if(a){if(e.GetId()!==a)continue}else if(e.HasInstance())continue;e.SetInstance(b);this._timelineManager.SetTimelineObjectClassToMap(b.GetObjectClass(),this);break}}HasTrackInstance(a,b){for(const e of this._tracks)if(b){if(b===e.GetId()&&a===e.GetInstance())return!0}else if(a===e.GetInstance())return!0;return!1}GetTrackInstance(a){for(const b of this._tracks)if(a===b.GetInstance())return b;return null}HasValidTracks(){return this._tracks.some(a=>a.CanInstanceBeValid())}HasValidGlobalTracks(){return this._tracks.some(a=>
|
|
a.CanInstanceBeValid()?(a=a.GetObjectClass())?a.IsGlobal():!1:!1)}GetPropertyTrack(a){for(const b of this.GetTracks())for(const e of b.GetPropertyTracks())if(e.GetPropertyName()===a)return e}GetKeyframeWithTags(a){a=a?a.split(" "):[];a=[...(new Set(a.map(b=>b.toLowerCase().trim()))).values()];for(const b of this.GetTracks())for(const e of b.GetKeyframeDataItems())if(a.every(c=>e.HasTag(c)))return e}GetObjectClasses(){const a=[];for(const b of this.GetTracks())a.push(b.GetObjectClass());return a.filter(b=>
|
|
b)}_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(a){a&&(this._LoadTracksFromJson(a.tracksJson),this._name=a.name,this._playheadTime.Set(a.playheadTime),this._playbackRate=a.playbackRate,this._pingPongState=a.pingPongState,this._currentRepeatCount=a.currentRepeatCount,this._isPlaying=!!a.isPlaying,this._isScheduled=!!a.isScheduled,this._initialStateSet=!!a.initialStateSet,this._finishedTriggers=
|
|
a.hasOwnProperty("finishedTriggers")?!!a.finishedTriggers:!1,this._complete=!!a.complete,this._released=!!a.released,this._markedForRemoval=!!a.markedForRemoval,this._completedTick=a.completedTick,this._implicitPause=!!a.implicitPause,this._isTemplate=!!a.isTemplate,this._tags=a.tags.split(" "),this._stringTags=a.stringTags,this._tagsChanged=!!a.tagsChanged,this._firstTick=!!a.firstTick)}_SaveTracksToJson(){return this._tracks.map(a=>a._SaveToJson())}_LoadTracksFromJson(a){a.forEach((b,e)=>{this._tracks[e]._LoadFromJson(b)});
|
|
this._tracks.filter(b=>b.CanInstanceBeValid())}static _HasTag(a){const b=this.GetTags();return""===a?1===b.length&&""===b[0]:b.includes(a)}static _GetTagArray(a){if(d.IsArray(a))return a.slice(0);if(d.IsString(a))return a.split(" ")}}}
|
|
{"use strict";const d=self.C3;d.TrackState=class extends d.DefendedBase{constructor(a,b){super();this._timeline=a;this._trackDataItem=b;this._trackData=b.GetTrackData();this._objectClassIndex=this._instanceUid=NaN;this._worldInfo=this._instance=null;this._isNested=0<b.GetStartOffset();this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();this._propertyTracks=[];for(const e of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(d.PropertyTrackState.Create(this,
|
|
e))}static Create(a,b){return d.New(d.TrackState,a,b)}Release(){this._keyframeDataItems=null;for(const a of this._propertyTracks)a.Release();d.clearArray(this._propertyTracks);this._lastKeyframeDataItem=this._trackDataItem=this._worldInfo=this._instance=this._timeline=this._propertyTracks=null}CleanCaches(){for(const a of this._propertyTracks)a.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(a){for(const b of this._propertyTracks)if(b.GetPropertyName()===a)return b}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){var a=this.GetInstanceUID();return(a=this.GetRuntime().GetInstanceByUID(a))?!a.IsDestroyed():!1}GetObjectClass(){const a=
|
|
this.GetObjectClassIndex();if(-1!==a)return this.GetRuntime().GetObjectClassByIndex(a)}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 a=this.GetInstanceUID();return this._instance=this.GetRuntime().GetInstanceByUID(a)}SetInstance(a){if(this._instance!==a){this.CleanCaches();this._instance=a;this._objectClassIndex=a.GetObjectClass().GetIndex();
|
|
this._instanceUid=a.GetUID();this._worldInfo=a.GetWorldInfo();for(const g of this.propertyTrackItems()){const h=g.sourceAdapter;switch(g.propertyTrack.GetSourceAdapterId()){case "instance-variable":h.GetEditorIndex();var b=a.GetObjectClass(),e=b.GetInstanceVariableIndexByName(g.name),c=b.GetInstanceVariableName(e);b=b.GetInstanceVariableType(e);c===g.name&&b===g.type&&h.UpdateInstanceVariableIndex(e);break;case "behavior":var f=g.behaviorType;e=this.GetObjectClass();c=a.GetObjectClass();b=h.GetBehaviorType(c);
|
|
f&&b&&(f=f.GetName(),e.GetBehaviorIndexByName(f),c.GetBehaviorIndexByName(f),h.GetEditorIndex(),h.UpdateBehaviorTypeSid(b.GetSID()))}}}}*propertyTrackItems(){for(const e of this._propertyTracks){var a=e.GetSourceAdapter(),b=this.GetObjectClass();const c={propertyTrack:e,sourceAdapter:a};switch(e.GetSourceAdapterId()){case "world-instance":c.property=e.GetPropertyName();break;case "instance-variable":a=a.GetEditorIndex();c.name=b.GetInstanceVariableName(a);c.type=b.GetInstanceVariableType(a);break;
|
|
case "effect":b=b.GetEffectList();a=a.GetEffectType(b);c.effectType=a;break;case "behavior":a=a.GetBehaviorType(b);c.behaviorType=a;break;case "plugin":c.plugin=b.GetPlugin()}yield c}}GetWorldInfo(){if(this._worldInfo&&this.IsInstanceValid())return this._worldInfo;const a=this.GetInstance();a&&(this._worldInfo=a.GetWorldInfo());return this._worldInfo}GetTrackDataItem(){return this._trackDataItem}GetInstanceUID(){return this._instanceUid?this._instanceUid:this._trackDataItem.GetInstanceUID()}SetInstanceUID(a){this._trackDataItem.SetInstanceUID(a)}GetInterpolationMode(){return this._trackDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._trackDataItem.SetInterpolationMode(a)}GetResultMode(){return this._trackDataItem.GetResultMode()}GetId(){return this._trackDataItem.GetId()}GetStartOffset(){return this._trackDataItem.GetStartOffset()}GetLocalTotalTime(){return this._trackDataItem.GetLocalTotalTime()}SetLocalTotalTime(a){this._trackDataItem.SetLocalTotalTime(a)}SetResultMode(a){this._trackDataItem.SetResultMode(a)}SetEase(a){for(const b of this.GetKeyframeDataItems())b.SetEase(a);
|
|
for(const b of this.GetPropertyTracks())b.SetEase(a)}GetEnable(){return this._trackDataItem.GetEnable()}SetEnable(a){this._trackDataItem.SetEnable(a)}GetObjectClassIndex(){return isNaN(this._objectClassIndex)?this._trackDataItem.GetObjectClassIndex():this._objectClassIndex}SetObjectClassIndex(a){this._trackDataItem.SetObjectClassIndex(a)}SetOriginalWidth(a){this._trackDataItem.SetOriginalWidth(a)}GetOriginalWidth(){const a=this.GetInstance();return a&&a.GetSdkInstance().IsOriginalSizeKnown()?a.GetSdkInstance().GetOriginalWidth():
|
|
this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(a){this._trackDataItem.SetOriginalHeight(a)}GetOriginalHeight(){const a=this.GetInstance();return a&&a.GetSdkInstance().IsOriginalSizeKnown()?a.GetSdkInstance().GetOriginalHeight():this._trackDataItem.GetOriginalHeight()}SetInitialState(){this.MaybeGetInstance();if(this.IsInstanceValid()){for(var a of this._propertyTracks)a.SetInitialState();a=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(a);
|
|
this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(a)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()){this._timeline.IsForwardPlayBack();var a=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this.GetLastKeyFrameBeforeTime(a);for(const b of this._propertyTracks)b.SetResumeState()}}SetEndState(){if(!this.GetTimeline().IsComplete()&&(this.MaybeGetInstance(),this.IsInstanceValid()&&!this._isNested)){const a=this._timeline.GetTime(),
|
|
b=this.GetStartOffset()+this.GetLocalTotalTime();a>=b?this.Interpolate(this.GetLocalTotalTime(),!0,!1,!0):0>=a&&this.Interpolate(0,!0,!1,!0)}}BeforeInterpolate(){for(const a of this._propertyTracks)a.BeforeInterpolate()}Interpolate(a,b=!1,e=!1,c=!1,f=!1,g=!1){this.MaybeGetInstance();if(!this.IsInstanceValid()||g&&this.GetObjectClass().IsGlobal())return!1;a-=this.GetStartOffset();if(0>a)return!1;this.MaybeSetInitialStateOfNestedTrack(a,b);this.MaybeTriggerKeyframeReachedConditions(a,b,f);f=g=!1;for(const h of this._propertyTracks){const l=
|
|
h.Interpolate(a,e,!1,c);g||0===(l&d.TimelineState.WORLD_INSTANCE_BOX_CHANGE)||(g=!0);f||0===(l&d.TimelineState.LAYOUT_RENDER_CHANGE)||(f=!0)}this.MaybeSetEndStateOfNestedTrack(a,b);g&&(a=this.GetWorldInfo())&&a.SetBboxChanged();return f}AfterInterpolate(){for(const a of this._propertyTracks)a.AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(a,b){if(b&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>a)return;for(const e of this._propertyTracks)e.Interpolate(0,
|
|
!1,!1,!0)}else{if(a>this.GetLocalTotalTime())return;for(const e of this._propertyTracks)e.Interpolate(this.GetLocalTotalTime(),!1,!1,!0)}for(const e of this._propertyTracks)e.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(a,b){if(b&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(a>=this.GetLocalTotalTime()){for(const e of this._propertyTracks)e.Interpolate(this.GetLocalTotalTime(),!1,!1,!0);this._endStateOfNestedSet=!0}}else if(0>=
|
|
a){for(const e of this._propertyTracks)e.Interpolate(0,!1,!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(a,b,e){if(!e&&b)return a=this.GetLastKeyFrameBeforeTime(a),a!==this._lastKeyframeDataItem&&this.OnKeyframeReached(a),this._lastKeyframeDataItem=a}GetLastKeyFrameBeforeTime(a){const b=this.GetTimeline();let e=this._trackData.GetKeyFrameDataItemAtTime(a,this._trackDataItem);return e?e:b.IsForwardPlayBack()?this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(a,this._trackDataItem):
|
|
this._trackData.GetFirstKeyFrameDataItemHigherOrEqualThan(a,this._trackDataItem)}OnKeyframeReached(a){if(d.Plugins.Timeline&&this.GetTimeline().constructor===d.TimelineState){var b=this.GetTimeline();d.Plugins.Timeline.Cnds.SetTriggerTimeline(b);d.Plugins.Timeline.Cnds.SetTriggerKeyframe(a);a=b.GetTimelineManager();a.Trigger(d.Plugins.Timeline.Cnds.OnAnyKeyframeReached);a.Trigger(d.Plugins.Timeline.Cnds.OnKeyframeReached);d.Plugins.Timeline.Cnds.SetTriggerTimeline(null);d.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var a=
|
|
this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();a=d.PropertyTrackState.Create(this,a);this._propertyTracks.push(a);return a}DeleteKeyframes(a){this._trackDataItem.GetKeyframeData().DeleteKeyframeDataItems(a)}DeletePropertyKeyframes(a){for(const b of this._propertyTracks)b.DeletePropertyKeyframes(a)}SaveState(){for(const a of this._propertyTracks)a.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();if(this.IsInstanceValid())for(const a of this._propertyTracks)a.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();
|
|
if(this.IsInstanceValid()){var a=!1;for(const b of this._propertyTracks){const e=b.CompareSaveStateWithCurrent();!a&&e&&(a=!0)}a&&(a=this.AddKeyframe(),a.SetTime(this.GetTimeline().GetTime()),a.SetEase("noease"),a.SetEnable(!0),a.SetTags(""))}}_SaveToJson(){var a=this.GetInstance();a=a?a.GetUID():this.GetInstanceUID();return{propertyTracksJson:this._SavePropertyTracksToJson(),lastKeyframeDataItemJson:this._SaveLastKeyframeDataItemToJson(),initialStateOfNestedSet:this._initialStateOfNestedSet,endStateOfNestedSet:this._endStateOfNestedSet,
|
|
instanceUid:a}}_LoadFromJson(a){a&&(this._LoadPropertyTracksFromJson(a.propertyTracksJson),this._LoadLastKeyframeDataItemFromJson(a.lastKeyframeDataItemJson),this._LoadInstanceFromJson(a.instanceUid),this._initialStateOfNestedSet=!1,a.hasOwnProperty.initialStateOfNestedSet&&(this._initialStateOfNestedSet=a.initialStateOfNestedSet),this._endStateOfNestedSet=!1,a.hasOwnProperty.endStateOfNestedSet&&(this._endStateOfNestedSet=a.endStateOfNestedSet))}_SaveLastKeyframeDataItemToJson(){return this._trackDataItem.GetKeyframeData().GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(a=>
|
|
a._SaveToJson())}_LoadPropertyTracksFromJson(a){a.forEach((b,e)=>{this._propertyTracks[e]._LoadFromJson(b)})}_LoadInstanceFromJson(a){if(d.IsFiniteNumber(a)&&(a=this.GetRuntime().GetInstanceByUID(a))){var b=this.GetTimeline();b.ClearTrackInstances();b.SetTrackInstance(this._trackDataItem.GetId(),a)}}_LoadLastKeyframeDataItemFromJson(a){this._lastKeyframeDataItem=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemFromIndex(a)}}}
|
|
{"use strict";const d=self.C3;d.PropertyTrackState=class extends d.DefendedBase{constructor(a,b){super();this._track=a;this._propertyTrackDataItem=b;this._propertyTrackData=b.GetPropertyTrackData();this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}static Create(a,b){return d.New(d.PropertyTrackState,a,b)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=
|
|
null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;let a;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":a=
|
|
new d.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":a=new d.PropertyTrackState.EffectSourceAdapter(this);break;case "instance-variable":a=new d.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":a=new d.PropertyTrackState.PluginSourceAdapter(this);break;case "world-instance":a=new d.PropertyTrackState.WorldInstanceSourceAdapter(this);break;case "value":a=new d.PropertyTrackState.ValueSourceAdapter(this)}return this._sourceAdapter=a}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(a){this._propertyTrackDataItem.SetSourceAdapterId(a)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(a){this._propertyTrackDataItem.SetSourceAdapterArguments(a)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(a){this._propertyTrackDataItem.SetProperty(a)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(a){this._propertyTrackDataItem.SetType(a)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(a){this._propertyTrackDataItem.SetMin(a)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(a){this._propertyTrackDataItem.SetMax(a)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(a){this._propertyTrackDataItem.SetEnable(a)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(a){this._propertyTrackDataItem.SetInterpolationMode(a)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(a){this._propertyTrackDataItem.SetResultMode(a)}SetEase(a){for(const b of this.GetPropertyKeyframeDataItems())b.SetEase(a)}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems?
|
|
this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const a of this.GetPropertyKeyframeDataItems())yield a.GetValueWithResultMode()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetInitialState(){this.GetSourceAdapter().SetInitialState()}SetResumeState(){this.GetSourceAdapter().SetResumeState()}BeforeInterpolate(){this.GetSourceAdapter().BeforeInterpolate()}Interpolate(a,
|
|
b=!1,e=!1,c=!1){var f=this._propertyTrackDataItem;let g=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(a,f);g?f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(a,f):(g=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,f),f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,f));return this.GetSourceAdapter().Interpolate(a,g,f,b,e,c)}AfterInterpolate(){this.GetSourceAdapter().AfterInterpolate()}static GetStartPropertyKeyframeForTime(a,
|
|
b){const e=b.GetPropertyTrackDataItem();b=b._propertyTrackData;let c=b.GetPropertyKeyFrameDataItemAtTime(a,e);c||(c=b.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,e));return c}static GetEndPropertyKeyframeForTime(a,b){const e=b.GetPropertyTrackDataItem();b=b._propertyTrackData;return b.GetPropertyKeyFrameDataItemAtTime(a,e)?b.GetFirstPropertyKeyFrameDataItemHigherThan(a,e):b.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,e)}AddPropertyKeyframe(){return this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem()}DeletePropertyKeyframes(a){this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(a)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){if(this.GetSourceAdapter().CompareInitialStateWithCurrent()){const a=
|
|
this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),b=this.GetSourceAdapter().GetCurrentState();a.SetAbsoluteValue(b)}}CompareSaveStateWithCurrent(){const a=this.GetSourceAdapter().CompareSaveStateWithCurrent();a&&this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return a}AddPropertyKeyframeAtCurrentTime(){const a=this.GetTimeline().GetTime(),b=this.GetSourceAdapter(),e=d.PropertyTrackState.GetStartPropertyKeyframeForTime(a,this),c=
|
|
this.AddPropertyKeyframe();c.SetType(e.GetType());c.SetTime(a);c.SetEase(e.GetEase());c.SetEnable(!0);c.SetValue(b.GetValueAtTime());c.SetAbsoluteValue(b.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(a){a&&this.GetSourceAdapter()._LoadFromJson(a.sourceAdapterJson)}}}
|
|
{"use strict";const d=self.C3.PropertyTrackState;d.PropertySourceAdapter=class{constructor(a){this._propertyTrack=a;this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}GetPropertyTrack(){return this._propertyTrack}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter?this._propertyAdapter:this._propertyAdapter=this._CreatePropertyAdapter()}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this.GetPropertyAdapter().BeforeChangeProperty()}Interpolate(a,
|
|
b,e,c,f,g){const h=d.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack)(a,b,e,this._propertyTrack);return f?h:this.GetPropertyAdapter().ChangeProperty(a,h,b,e,c,g)}AfterInterpolate(){this.GetPropertyAdapter().AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){return d.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_CreatePropertyAdapter(){const a=
|
|
this._propertyTrack.GetPropertyType();switch(this._propertyTrack.GetPropertyKeyframeType()){case "combo":case "boolean":case "text":case "string":return new d.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===a?new d.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new d.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new d.PropertyInterpolationAdapter.ColorInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(a){a&&
|
|
this.GetPropertyAdapter()._LoadFromJson(a.propertyAdapterJson)}static GetValueAtTime(a){const b=a.GetTrack().GetTimeline().GetTime(),e=d.GetStartPropertyKeyframeForTime(b,a),c=d.GetEndPropertyKeyframeForTime(b,a);return d.PropertySourceAdapter.GetInterpolateFunc(a)(b,e,c,a)}static GetValue(a,b,e){let c=a.GetResultMode();"combo"===a.GetPropertyType()&&(c="absolute");switch(c){case "relative":return b+e;case "absolute":return e}}static GetInterpolateFunc(a){switch(a.GetPropertyKeyframeType()){case "numeric":return d.NumericTypeAdapter.Interpolate;
|
|
case "angle":return d.AngleTypeAdapter.Interpolate;case "boolean":return d.BooleanTypeAdapter.Interpolate;case "color":return d.ColorTypeAdapter.Interpolate;case "text":return d.TextTypeAdapter.Interpolate}}static GetWillChangeFunc(a){switch(a.GetPropertyKeyframeType()){case "numeric":return d.NumericTypeAdapter.WillChange;case "angle":return d.AngleTypeAdapter.WillChange;case "boolean":return d.BooleanTypeAdapter.WillChange;case "color":return d.ColorTypeAdapter.WillChange;case "text":return d.TextTypeAdapter.WillChange}}}}
|
|
{"use strict";const d=self.C3;class a extends d.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b)}}d.PropertyTrackState.WorldInstanceSourceAdapter=a}
|
|
{"use strict";const d=self.C3;class a extends d.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b);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(b){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==b&&(this._updatedIndex=
|
|
b)}Interpolate(b,e,c,f,g,h){if(this.GetPropertyAdapter().CanChange(e.GetValue()))return super.Interpolate(b,e,c,f,g,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(b){b&&(super._LoadFromJson(b),this._updatedIndex=b.index)}}d.PropertyTrackState.InstanceVariableSourceAdapter=a}
|
|
{"use strict";const d=self.C3;class a extends d.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var b=this._propertyTrack.GetPropertyTrackDataItem(),e=this._propertyTrack.GetTrack();b=this._sid?this._sid:b.GetSourceAdapterArguments()[0];e=e.GetInstance();b=e.GetBehaviorIndexBySID(b);return e.GetBehaviorInstances()[b].GetSdkInstance()}GetBehaviorType(b){const e=
|
|
this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return b.GetBehaviorTypeByName(e)}UpdateBehaviorTypeSid(b){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==b&&(this._sid=b)}Interpolate(b,e,c,f,g,h){const l=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(l.GetObjectClass()))return super.Interpolate(b,e,c,f,g,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(b){b&&(super._LoadFromJson(b),
|
|
this._sid=b.sid)}}d.PropertyTrackState.BehaviorSourceAdapter=a}
|
|
{"use strict";const d=self.C3;class a extends d.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const b=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var e=b.GetEffectList();e=this.GetEffectType(e).GetIndex();return b.IsEffectIndexActive(e)?b.GetEffectParametersForIndex(e):null}GetEffectType(b){const e=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];
|
|
return b.GetEffectTypeByName(e)}Interpolate(b,e,c,f,g,h){if(this._IsEffectActive())return super.Interpolate(b,e,c,f,g,h)}_IsEffectActive(){const b=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var e=b.GetEffectList();if(e=this.GetEffectType(e))return e=e.GetIndex(),b.IsEffectIndexActive(e)}}d.PropertyTrackState.EffectSourceAdapter=a}
|
|
{"use strict";const d=self.C3;class a extends d.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(b,e,c,f,g,h){var l=this._propertyTrack.GetTrack();const m=l.GetObjectClass().GetPlugin();l=l.GetInstance().GetObjectClass().GetPlugin();if(m===l)return super.Interpolate(b,e,c,f,g,h)}}d.PropertyTrackState.PluginSourceAdapter=
|
|
a}
|
|
{"use strict";const d=self.C3;class a extends d.PropertyTrackState.PropertySourceAdapter{constructor(b){super(b);this._value=0;this._init=!1}SetInitialState(){const b=this._propertyTrack.GetPropertyTrackData();let e=this._propertyTrack.GetPropertyTrackDataItem();e=b.GetFirstPropertyKeyframeDataItem(e);this._value=e.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(b,e,c,f,g,h){f=d.PropertyTrackState.NumericTypeAdapter.Interpolate;this._value=
|
|
f(b,e,c,this._propertyTrack);this._init=!0}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{value:this._value,init:this._init}}_LoadFromJson(b){b&&(this._value=b.value,this._init=b.hasOwnProperty("init")?b.init:!0)}}d.PropertyTrackState.ValueSourceAdapter=a}"use strict";
|
|
self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(d){this._sourceAdapter=d;this._propertyTrack=d.GetPropertyTrack();this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo();this._property=this._propertyTrack.GetPropertyName();this._firstAbsoluteUpdate=!1;this._target=this._saveState=null}Release(){this._target=this._saveState=this._worldInfo=this._propertyTrack=this._sourceAdapter=null}CleanCaches(){this._target=this._saveState=this._worldInfo=null}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo?
|
|
this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(d){this._firstAbsoluteUpdate=!!d}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(d){return typeof this._Getter()===typeof d}BeforeChangeProperty(){}ChangeProperty(d,a,
|
|
b,e,c){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const d=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(d)},()=>{const d=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(d)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const d=this._propertyTrack.GetTimeline().GetTime()-this._propertyTrack.GetTrack().GetStartOffset();
|
|
return this._PickTimelinePlaybackMode(()=>{const a=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(d,a)},()=>{const a=this._propertyTrack.GetPropertyTrackDataItem(),b=this._propertyTrack.GetPropertyTrackData(),e=b.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(d,a);return e?e:b.GetLastPropertyKeyframeDataItem(a)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(d,a){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?
|
|
d():a()}_PickResultMode(d,a){return"relative"===this._propertyTrack.GetResultMode()?d():a()}_PickFirstAbsoluteUpdate(d,a){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),d()):a()}_GetAbsoluteInitialValue(d){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(d,a,b,e,c){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return d();case "effect":return a();case "instance-variable":return b();
|
|
case "plugin":return e();case "world-instance":return c()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(d){d&&(this._firstAbsoluteUpdate=d.firstAbsoluteUpdate,this._saveState=d.saveState)}_GetPropertyKeyframeStubs(d,a=!1){const b=[];for(const e of d){d=e.GetTrack().GetStartOffset();for(const c of e.GetPropertyKeyframeDataItems())a&&0===c.GetTime()?b.push({time:d+c.GetTime(),value:c.GetAbsoluteValue()}):a||b.push({time:d+c.GetTime(),value:c.GetAbsoluteValue()})}return b.sort((e,
|
|
c)=>e.time-c.time)}_GetLastPropertyKeyframeStub(d,a,b){return this._GetPropertyKeyframeStubLowerThanPlayhead(a,b)}_GetPropertyKeyframeStubLowerThanPlayhead(d,a){for(let b=a.length-1;0<=b;b--)if(a[b].time<=d)return a[b];return null}};
|
|
{"use strict";const d=self.C3,a=new Map,b=[0,0,0];class e extends d.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetInitialState(){}SetResumeState(){}GetCurrentState(){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),g=this._GetIndex();switch(c){case "behavior":return this._ToColorArray(f.GetPropertyValueByIndex(g));case "effect":return this._ToColorArray(f[g]);case "plugin":return this._ToColorArray(f.GetPropertyValueByIndex(g));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const c=
|
|
this._FirstKeyframeGetter();return!this._CompareColors(c,this._Getter())}CompareSaveStateWithCurrent(){return d.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(c,f){return c.equalsIgnoringAlpha(f)}_FirstKeyframeGetter(){const c=super._FirstKeyframeGetter();return this._GetColorFromArray(c)}_CurrentKeyframeGetter(){const c=super._CurrentKeyframeGetter();return this._GetColorFromArray(c)}_GetAbsoluteInitialValue(c){}_ToColorArray(c){return d.IsInstanceOf(c,
|
|
d.Color)?c.toArray().slice(0,3):c.slice(0,3)}_GetColorFromArray(c){return d.IsInstanceOf(c,d.Color)?c:new d.Color(c[0],c[1],c[2],1)}CanChange(c){return!0}BeforeChangeProperty(){var c=this._propertyTrack.GetInstance();a.has(c)||a.set(c,new Map);c=a.get(c);const f=this._propertyTrack.GetSourceAdapterId();c.has(f)||c.set(f,new Map);c=c.get(f);c.has(this._property)||c.set(this._property,{used:!1,color:new d.Color(0,0,0,1)})}_GetTmpColor(c,f,g){c=a.get(c).get(f).get(g);c.used=!0;return c.color}ChangeProperty(c,
|
|
f,g,h,l){l=this._propertyTrack.GetTimeline();h=this._propertyTrack.GetTrack();c=this._propertyTrack.GetInstance();var m=this._propertyTrack.GetSourceAdapter();g=this._propertyTrack.GetSourceAdapterId();m=l.GetSimilarPropertyTracks(c,m,this._property);if(1<m.length){if(m=this._GetPropertyKeyframeStubs(m,!0),l=this._GetLastPropertyKeyframeStub(l,l.GetTime(),m))if(h=h.GetStartOffset(),m=l.time-h,0===m)this._GetTmpColor(c,g,this._property).addRgb(f[0],f[1],f[2]);else{if(0>m)return;l=f[0];h=f[1];f=f[2];
|
|
m=this._propertyTrack.Interpolate(m,!1,!0);l=d.Color.DiffChannel(l,m[0]);h=d.Color.DiffChannel(h,m[1]);f=d.Color.DiffChannel(f,m[2]);this._GetTmpColor(c,g,this._property).addRgb(l,h,f)}}else this._Setter(f[0],f[1],f[2]);return d.TimelineState.LAYOUT_RENDER_CHANGE}AfterChangeProperty(){const c=this._propertyTrack.GetInstance();if(a.has(c)){var f=a.get(c),g=this._propertyTrack.GetSourceAdapterId();if(f.has(g)){var h=f.get(g);if(h.has(this._property)){var l=h.get(this._property),m=l.color;l.used&&this._Setter(m.getR(),
|
|
m.getG(),m.getB());0===h.size&&f.delete(g);0===f.size&&a.delete(c)}}}}_Getter(){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),g=this._GetIndex();switch(c){case "behavior":return this._GetColorFromArray(f.GetPropertyValueByIndex(g));case "effect":return f[g].clone();case "plugin":return this._GetColorFromArray(f.GetPropertyValueByIndex(g));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(c,f,g){const h=this._propertyTrack.GetSourceAdapterId(),
|
|
l=this._GetTarget(),m=this._GetIndex();switch(h){case "behavior":b[0]=c;b[1]=f;b[2]=g;l.SetPropertyValueByIndex(m,b);break;case "effect":l[m].setRgb(c,f,g);break;case "plugin":b[0]=c;b[1]=f;b[2]=g;l.SetPropertyValueByIndex(m,b);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(c,f,g)}}_SaveToJson(){}_LoadFromJson(c){}}d.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=e}
|
|
{"use strict";const d=self.C3;class a extends d.PropertyTrackState.PropertyInterpolationAdapter{constructor(b){super(b)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return d.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}ChangeProperty(b,e,c,f,g){c=d.PropertyTrackState.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);
|
|
var h=this._propertyTrack;const l=h.GetTrack();f=h.GetSourceAdapterId();g=h.GetTimeline();var m=l.GetInstance();h=h.GetSourceAdapter();m=g.GetSimilarPropertyTracks(m,h,this._property);1<m.length&&(m=this._GetPropertyKeyframeStubs(m),b+=l.GetStartOffset(),b=this._GetLastPropertyKeyframeStub(g,b,m))&&(e=b.value);if(c(this._GetIndex(),this._GetTarget(),e,f))switch(this._Setter(e),f){case "plugin":return d.TimelineState.LAYOUT_RENDER_CHANGE}}_Getter(){const b=this._propertyTrack.GetSourceAdapterId(),
|
|
e=this._GetTarget(),c=this._GetIndex();switch(b){case "behavior":return e.GetPropertyValueByIndex(c);case "effect":return e[c];case "instance-variable":return e.GetInstanceVariableValue(c);case "plugin":return e.GetPropertyValueByIndex(c)}}_Setter(b){const e=this._propertyTrack.GetSourceAdapterId(),c=this._GetTarget(),f=this._GetIndex();switch(e){case "behavior":c.SetPropertyValueByIndex(f,b);break;case "effect":c[f]=b;break;case "instance-variable":c.SetInstanceVariableValue(f,b);break;case "plugin":c.SetPropertyValueByIndex(f,
|
|
b)}}}d.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=a}
|
|
{"use strict";const d=self.C3,a=new Map,b=(c,f,g,h,l)=>a.set(c,{setter:f,absolute_setter:g,getter:h,round:l});b("offsetX",(c,f)=>c.OffsetX(f),(c,f)=>c.SetX(f),c=>c.GetX(),!0);b("offsetY",(c,f)=>c.OffsetY(f),(c,f)=>c.SetY(f),c=>c.GetY(),!0);b("offsetWidth",(c,f)=>c.OffsetWidth(f),(c,f)=>c.SetWidth(f),c=>c.GetWidth(),!0);b("offsetHeight",(c,f)=>c.OffsetHeight(f),(c,f)=>c.SetHeight(f),c=>c.GetHeight(),!0);b("offsetAngle",(c,f)=>c.OffsetAngle(f),(c,f)=>c.SetAngle(f),c=>c.GetAngle(),!1);b("offsetOpacity",
|
|
(c,f,g,h)=>{g=c.GetOpacity()+f;0===h._clampAccumulator?(1<g?h._clampAccumulator+=g-1:0>g&&(h._clampAccumulator+=g),c.OffsetOpacity(f)):(c=c.GetOpacity()+f,0<f&&0<h._clampAccumulator?1<c&&(h._clampAccumulator+=c-1):0<f&&0>h._clampAccumulator?(h._clampAccumulator+=f,0<h._clampAccumulator&&(h._clampAccumulator=0)):0>f&&0<h._clampAccumulator?(h._clampAccumulator+=f,0>h._clampAccumulator&&(h._clampAccumulator=0)):0>f&&0>h._clampAccumulator&&0>c&&(h._clampAccumulator+=c))},(c,f)=>{c.SetOpacity(f)},c=>c.GetOpacity(),
|
|
!1);b("offsetOriginX",(c,f)=>c.OffsetOriginX(f),(c,f)=>c.SetOriginX(f),c=>c.GetOriginX(),!1);b("offsetOriginY",(c,f)=>c.OffsetOriginY(f),(c,f)=>c.SetOriginY(f),c=>c.GetOriginY(),!1);b("offsetZElevation",(c,f)=>c.OffsetZElevation(f),(c,f)=>c.SetZElevation(f),c=>c.GetZElevation(),!0);b("offsetScaleX",(c,f,g,h)=>{h=0>c.GetWidth()?-1:1;c.GetTransformWithParentWidth();c.OffsetWidth(g.GetOriginalWidth()*h*f)},(c,f,g)=>{c.SetWidth(g.GetOriginalWidth()*f)},(c,f)=>{const g=0>c.GetWidth()?-1:1;if(c.GetTransformWithParentWidth()){var h=
|
|
c.GetParent(),l=f.GetTimeline().GetTrackInstance(h.GetInstance());l?h=h.GetWidth()/l.GetOriginalWidth():(l=h.GetInstance().GetSdkInstance(),h=l.IsOriginalSizeKnown()?h.GetWidth()/l.GetOriginalWidth():1);return c.GetWidth()*g/(f.GetOriginalWidth()*h)}return c.GetWidth()*g/f.GetOriginalWidth()},!1);b("offsetScaleY",(c,f,g,h)=>{h=0>c.GetHeight()?-1:1;c.GetTransformWithParentHeight();c.OffsetHeight(g.GetOriginalHeight()*h*f)},(c,f,g)=>{c.SetHeight(g.GetOriginalHeight()*f)},(c,f)=>{const g=0>c.GetHeight()?
|
|
-1:1;if(c.GetTransformWithParentHeight()){var h=c.GetParent(),l=f.GetTimeline().GetTrackInstance(h.GetInstance());l?h=h.GetHeight()/l.GetOriginalHeight():(l=h.GetInstance().GetSdkInstance(),h=l.IsOriginalSizeKnown()?h.GetHeight()/l.GetOriginalHeight():1);return c.GetHeight()*g/(f.GetOriginalHeight()*h)}return c.GetHeight()*g/f.GetOriginalHeight()},!1);class e extends d.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c);this._clampAccumulator=this._lastValue=0;this._instance_absolute_setter=
|
|
this._instance_setter=this._instance_getter=null;this._round=!1;d.IsInstanceOf(this._propertyTrack.GetTimeline(),d.Tween)?this._typeAdapter=new d.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):this._typeAdapter=new d.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);c=this._propertyTrack.GetPropertyName();"world-instance"===this._propertyTrack.GetSourceAdapterId()&&(c=a.get(c),this._instance_getter=c.getter,this._instance_setter=
|
|
c.setter,this._instance_absolute_setter=c.absolute_setter,this._round=c.round)}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}GetLastValue(){return this._lastValue}SetLastValue(c){this._lastValue=c}SetInitialState(){const c=this._typeAdapter.SetInitialState();"number"===typeof c&&(this._lastValue=c);this._clampAccumulator=0}SetResumeState(){const c=this._typeAdapter.SetResumeState();"number"===typeof c&&(this._lastValue=
|
|
c)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return d.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(c,f,g,h,l,m,p){return this._typeAdapter.ChangeProperty(c,f,g,h,l,m,p)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const c=this._GetTarget(),
|
|
f=this._GetIndex(),g=this._propertyTrack.GetTrack(),h=this.GetWorldInfo();return this._PickSource(()=>c.GetPropertyValueByIndex(f),()=>c[f],()=>c.GetInstanceVariableValue(f),()=>c.GetPropertyValueByIndex(f),()=>this._instance_getter(h,g))}_Setter(c,f,g){const h=this._GetTarget(),l=this._GetIndex(),m=this._propertyTrack.GetTrack(),p=this.GetWorldInfo();this._PickSource(()=>h.OffsetPropertyValueByIndex(l,c),()=>h[l]+=c,()=>h.SetInstanceVariableOffset(l,c),()=>h.OffsetPropertyValueByIndex(l,c),()=>this._instance_setter(p,
|
|
c,m,this))}_SetterAbsolute(c,f,g){const h=this._GetTarget(),l=this._GetIndex(),m=this._propertyTrack.GetTrack(),p=this.GetWorldInfo();this._PickSource(()=>h.SetPropertyValueByIndex(l,c),()=>h[l]=c,()=>h.SetInstanceVariableValue(l,c),()=>h.SetPropertyValueByIndex(l,c),()=>this._instance_absolute_setter(p,c,m))}_MaybeEnsureValue(c,f,g,h,l,m){this._typeAdapter._MaybeEnsureValue(c,f,g,h,l,m)}_AddDelta(c,f,g){var h=(c.toString().split(".")[1]||"").length;c=this._Getter();h=0===h?this._round?Math.round(c):
|
|
c:d.toFixed(c,h);this._Setter(h-c,f,g)}_SaveToJson(){return Object.assign(super._SaveToJson(),{v:this._lastValue,a:this._clampAccumulator})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._lastValue=c.v,this._clampAccumulator=c.a)}}d.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=e}
|
|
{"use strict";const d=self.C3,a=new Map;class b{constructor(e){this._numericInterpolationAdapter=e}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const e=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack();return e._PickResultMode(()=>e._PickTimelinePlaybackMode(()=>0,()=>d.PropertyTrackState.PropertySourceAdapter.GetValueAtTime(c)),()=>{})}SetResumeState(){}BeforeChangeProperty(){const e=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),
|
|
f=c.GetPropertyName();e._PickResultMode(()=>{},()=>{var g=c.GetInstance();a.has(g)||a.set(g,new Map);g=a.get(g);const h=c.GetSourceAdapterId();g.has(h)||g.set(h,new Map);g=g.get(h);g.has(f)||g.set(f,{used:!1,value:0})})}_GetTmpAbsoluteValueObject(e,c,f){e=a.get(e).get(c).get(f);e.used=!0;return e}ChangeProperty(e,c,f,g,h,l){const m=this._numericInterpolationAdapter,p=this._numericInterpolationAdapter.GetPropertyTrack(),x=p.GetPropertyName();m._PickResultMode(()=>{const v=m.GetLastValue();m._Setter(c-
|
|
v,f,g);l&&this._MaybeEnsureValue(e,f,g,h,v,c);m.SetLastValue(c)},()=>{var v=p.GetTimeline(),r=p.GetTrack();const q=p.GetInstance();var y=p.GetSourceAdapter();const u=p.GetSourceAdapterId();y=v.GetSimilarPropertyTracks(q,y,x);if(1<y.length){if(y=m._GetPropertyKeyframeStubs(y,!0),v=m._GetLastPropertyKeyframeStub(v,v.GetTime(),y))r=r.GetStartOffset(),r=v.time-r,0===r?this._GetTmpAbsoluteValueObject(q,u,x).value+=c:0>r||(r=p.Interpolate(r,!1,!0),this._GetTmpAbsoluteValueObject(q,u,x).value+=c-r)}else m._SetterAbsolute(c)});
|
|
return m._PickSource(()=>{},()=>d.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>d.TimelineState.LAYOUT_RENDER_CHANGE,()=>d.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){const e=this._numericInterpolationAdapter,c=this._numericInterpolationAdapter.GetPropertyTrack(),f=c.GetPropertyName();e._PickResultMode(()=>{},()=>{const g=c.GetInstance();if(a.has(g)){var h=a.get(g),l=c.GetSourceAdapterId();if(h.has(l)){var m=h.get(l);if(m.has(f)){var p=m.get(f),x=p.value;p.used&&e._SetterAbsolute(x);
|
|
m.delete(f);0===m.size&&h.delete(l);0===h.size&&a.delete(g)}}}})}_MaybeEnsureValue(e,c,f,g,h,l){const m=this._numericInterpolationAdapter;g||(c&&e===c.GetTime()?m._AddDelta(c.GetValueWithResultMode(),c,f):f&&e===f.GetTime()?m._AddDelta(f.GetValueWithResultMode(),c,f):0===l-h&&m._AddDelta(c.GetValueWithResultMode(),c,f))}}d.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=b}
|
|
{"use strict";const d=self.C3;new Map;class a{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())}BeforeChangeProperty(){}ChangeProperty(b,
|
|
e,c,f,g,h){const l=this._numericInterpolationAdapter,m=l.GetLastValue();l._PickResultMode(()=>{l._Setter(e-m,c,f);h&&this._MaybeEnsureValue(b,c,f,g,m,e)},()=>{l._PickFirstAbsoluteUpdate(()=>{l._Setter(m,c,f)},()=>{l._Setter(e-m,c,f);h&&this._MaybeEnsureValue(b,c,f,g,m,e)})});l.SetLastValue(e);return l._PickSource(()=>{},()=>d.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>d.TimelineState.LAYOUT_RENDER_CHANGE,()=>d.TimelineState.LAYOUT_RENDER_CHANGE)}AfterChangeProperty(){}_GetAbsoluteInitialValue(b){return b-
|
|
this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(b,e,c,f,g,h){const l=this._numericInterpolationAdapter;f?e&&b===e.GetTime()?l._AddDelta(e.GetValueWithResultMode(),e,c):c&&b===c.GetTime()?l._AddDelta(c.GetValueWithResultMode(),e,c):c||l._AddDelta(e.GetValueWithResultMode(),e,c):e&&b===e.GetTime()?l._AddDelta(e.GetValueWithResultMode(),e,c):c&&b===c.GetTime()?l._AddDelta(c.GetValueWithResultMode(),e,c):0===h-g&&l._AddDelta(e.GetValueWithResultMode(),e,c)}}d.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=
|
|
a}
|
|
{"use strict";const d=self.C3,a=self.Ease;d.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(b,e,c,f){let g;switch(f){case "behavior":g=e.GetPropertyValueByIndex(b);break;case "effect":g=e[b];break;case "instance-variable":g=e.GetInstanceVariableValue(b);break;case "plugin":g=e.GetPropertyValueByIndex(b)}return g===c?!1:!0}static Interpolate(b,e,c,f){if(!c)return c=f.GetPropertyTrackDataItem(),c=f.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(c),c.GetValueWithResultMode();var g=
|
|
f.GetInterpolationMode();"default"===g&&(g="continuous");"combo"===f.GetPropertyType()&&(g="discrete");if("discrete"===g)return e.GetValueWithResultMode();if("continuous"===g||"step"===g){"step"===g&&(g=f.GetTimeline().GetStep(),0!==g&&(g=1/g,b=Math.floor(b*g)/g));var h=e.GetTime();const l=c.GetTime();g=e.GetValueWithResultMode();const m=c.GetValueWithResultMode();if(g===m)return g;b=d.normalize(b,h,l);const p=e.GetEase();e=e.GetAddOn("cubic-bezier");c=c.GetAddOn("cubic-bezier");e&&e.GetStartEnable()&&
|
|
c&&c.GetEndEnable()?(h=l-h,h=a.GetRuntimeEase(p)(h*b,0,1,h),h=a.GetRuntimeEase("cubicbezier")(h,g,g+e.GetStartAnchor(),m+c.GetEndAnchor(),m)):h=a.GetRuntimeEase(p)((l-h)*b,g,m-g,l-h);return"integer"===f.GetPropertyType()?Math.floor(h):h}}}}
|
|
{"use strict";const d=self.C3;d.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(a,b,e,c){let f;switch(c){case "behavior":f=b.GetPropertyValueByIndex(a);break;case "effect":f=b[a];break;case "instance-variable":f=b.GetInstanceVariableValue(a);break;case "plugin":f=b.GetPropertyValueByIndex(a)}return f===e?!1:!0}static Interpolate(a,b,e,c){if(!e)return b=c.GetPropertyTrackDataItem(),b=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(b),b.GetValueWithResultMode();var f=
|
|
c.GetInterpolationMode();"default"===f&&(f="continuous");"combo"===c.GetPropertyType()&&(f="discrete");if("discrete"===f)return b.GetValueWithResultMode();if("continuous"===f||"step"===f){"step"===f&&(c=c.GetTimeline().GetStep(),0!==c&&(c=1/c,a=Math.floor(a*c)/c));const g=b.GetTime(),h=e.GetTime();c=b.GetValueWithResultMode();e=e.GetValueWithResultMode();if(f=b.GetAddOn("angle")){const l=f.GetRevolutions();if(c===e&&0===l)return c;a=d.normalize(a,g,h);b=self.Ease.GetRuntimeEase(b.GetEase())(a,0,1,
|
|
1);switch(f.GetDirection()){case "closest":return d.angleLerp(c,e,b,l);case "clockwise":return d.angleLerpClockwise(c,e,b,l);case "anti-clockwise":return d.angleLerpAntiClockwise(c,e,b,l)}}else{if(c===e)return c;a=d.normalize(a,g,h);b=self.Ease.GetRuntimeEase(b.GetEase());return d.angleLerp(c,e,b(a,0,1,1))}}}}}"use strict";
|
|
self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(d,a,b,e){let c;switch(e){case "behavior":c=a.GetPropertyValueByIndex(d);break;case "effect":c=a[d];break;case "instance-variable":c=a.GetInstanceVariableValue(d);break;case "plugin":c=a.GetPropertyValueByIndex(d)}return!!c===!!b?!1:!0}static Interpolate(d,a,b,e){return b?a.GetValueWithResultMode()?1:0:(d=e.GetPropertyTrackDataItem(),d=e.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(d),d.GetValueWithResultMode()?
|
|
1:0)}};
|
|
{"use strict";const d=self.C3,a=[0,0,0],b=[0,0,0],e=[0,0,0];d.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(c,f,g,h){let l;switch(h){case "behavior":l=f.GetPropertyValueByIndex(c);break;case "effect":l=f[c];break;case "instance-variable":l=f.GetInstanceVariableValue(c);break;case "plugin":l=f.GetPropertyValueByIndex(c)}Array.isArray(g)?(a[0]=g[0],a[1]=g[1],a[2]=g[2]):(e.parseCommaSeparatedRgb(g),a[0]=Math.floor(255*e.getR()),a[1]=Math.floor(255*e.getG()),a[2]=Math.floor(255*e.getB()));
|
|
Array.isArray(l)?(b[0]=l[0],b[1]=l[1],b[2]=l[2]):(e.parseCommaSeparatedRgb(l),b[0]=Math.floor(255*e.getR()),b[1]=Math.floor(255*e.getG()),b[2]=Math.floor(255*e.getB()));return a[0]!==b[0]||a[1]!==b[1]||a[2]!==b[2]?!0:!1}static Interpolate(c,f,g,h){if(!g){var l=h.GetPropertyTrackDataItem();l=h.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(l);h=l.GetValueWithResultMode();a[0]=h[0];a[1]=h[1];a[2]=h[2];return a}l=h.GetInterpolationMode();"default"===l&&(l="continuous");if("discrete"===l)return h=
|
|
f.GetValueWithResultMode(),a[0]=h[0],a[1]=h[1],a[2]=h[2],a;if("continuous"===l||"step"===l){"step"===l&&(h=h.GetTimeline().GetStep(),0!==h&&(h=1/h,c=Math.floor(c*h)/h));h=f.GetTime();l=g.GetTime();var m=f.GetValueWithResultMode(),p=g.GetValueWithResultMode();c=d.normalize(c,h,l);var x=f.GetEase();f=m[0];g=m[1];m=m[2];const v=p[0],r=p[1];p=p[2];x=self.Ease.GetRuntimeEase(x);h=l-h;l=h*c;a[0]=f===v?f:x(l,f,v-f,h);a[1]=g===r?g:x(l,g,r-g,h);a[2]=m===p?m:x(l,m,p-m,h);return a}}}}"use strict";
|
|
self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(d,a,b,e){let c;switch(e){case "behavior":c=a.GetPropertyValueByIndex(d);break;case "effect":c=a[d];break;case "instance-variable":c=a.GetInstanceVariableValue(d);break;case "plugin":c=a.GetPropertyValueByIndex(d)}return c===b?!1:!0}static Interpolate(d,a,b,e){return b?a.GetValueWithResultMode():(d=e.GetPropertyTrackDataItem(),d=e.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(d),d.GetValueWithResultMode())}};
|
|
{"use strict";const d=self.C3;d.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const a of this._timelineDataItems.values())a.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(a){a=new d.TimelineDataItem(a);const b=a.GetName();this._timelineDataItems.set(b,a)}Get(a){return this._timelineDataItems.get(a)}GetNameId(){return 0}static _CreateDataItems(a,b,e,c){if(b)for(const f of b)d.TimelineDataManager._CreateDataItem("create",f,a,e,c)}static _LoadDataItemsFromJson(a,
|
|
b,e,c){a.length?b.forEach((f,g)=>{a[g]._LoadFromJson(f)}):b.forEach(f=>{d.TimelineDataManager._CreateDataItem("load",f,a,e,c)})}static _CreateDataItem(a,b,e,c,f){let g;if("function"===typeof c)switch(a){case "load":g=new c(null,f);break;case "create":g=new c(b,f)}else if("object"===typeof c)switch(c=c.map.get(b[c.prop]),a){case "load":g=new c(null,f);break;case "create":g=new c(b,f)}switch(a){case "load":g._LoadFromJson(b);e.push(g);break;case "create":if("function"===typeof g.GetEnable&&!g.GetEnable())return g.Release();
|
|
e.push(g)}}}}
|
|
{"use strict";const d=self.C3;d.TimelineDataItem=class{constructor(a){this._name="";this._totalTime=NaN;this._step=0;this._resultMode=this._interpolationMode="default";this._pingPong=this._loop=!1;this._repeatCount=1;this._trackData=null;a&&(this._name=a[0],this._totalTime=a[1],this._step=a[2],this._interpolationMode=a[3],this._resultMode=a[4],this._loop=!!a[6],this._pingPong=!!a[7],this._repeatCount=a[8],this._trackData=new d.TrackData(a[5],this))}Release(){this._trackData.Release();this._trackData=
|
|
null}GetTrackData(){this._trackData||(this._trackData=new d.TrackData(null,this));return this._trackData}GetName(){return this._name}SetName(a){this._name=a}GetTotalTime(){return this._totalTime}SetTotalTime(a){this._totalTime=a}GetStep(){return this._step}SetStep(a){this._step=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetLoop(){return this._loop}SetLoop(a){this._loop=
|
|
a}GetPingPong(){return this._pingPong}SetPingPong(a){this._pingPong=a}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(a){a&&(this.GetTrackData()._LoadFromJson(a.trackDataJson),this._name=a.name,this._totalTime=a.totalTime,this._step=
|
|
a.step,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._loop=a.loop,this._pingPong=a.pingPong,this._repeatCount=a.repeatCount)}}}
|
|
{"use strict";const d=self.C3;class a{constructor(b,e){this._trackData=e;this._additionalInstanceData=this._instanceData=null;this._objectClassIndex=this._instanceUid=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyTrackData=this._keyframeData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();b&&(this._instanceData=b[0],this._instanceUid=b[0][2],this._objectClassIndex=b[0][1],this._interpolationMode=
|
|
b[1],this._resultMode=b[2],this._enabled=!!b[3],b[6]&&(this._id=b[6]),b[7]&&(this._nestedData=b[7],this._startOffset=b[7][0],this._localTotalTime=b[7][1]),b[8]&&(this._additionalInstanceData=b[8]),this._keyframeData=new d.KeyframeData(b[4],this),this._propertyTrackData=new d.PropertyTrackData(b[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 d.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new d.PropertyTrackData(null,this));return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(b){this._objectClassIndex=b}GetInstanceUID(){return this._instanceUid}SetInstanceUID(b){this._instanceUid=
|
|
b}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(b){this._interpolationMode=b}GetResultMode(){return this._resultMode}SetResultMode(b){this._resultMode=b}GetEnable(){return this._enabled}SetEnable(b){this._enabled=!!b}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}SetLocalTotalTime(b){this._localTotalTime=b}GetOriginalWidth(){return this._additionalInstanceData[0]}SetOriginalWidth(b){this._additionalInstanceData||
|
|
(this._additionalInstanceData=[]);this._additionalInstanceData[0]=b}GetOriginalHeight(){this._additionalInstanceData||(this._additionalInstanceData=[]);return this._additionalInstanceData[1]}SetOriginalHeight(b){this._additionalInstanceData||(this._additionalInstanceData=[]);this._additionalInstanceData[1]=b}_SaveToJson(){return{keyframeDataJson:this._keyframeData._SaveToJson(),propertyTrackDataJson:this._propertyTrackData._SaveToJson(),instanceData:this._instanceData,additionalInstanceData:this._additionalInstanceData,
|
|
instanceUid:this._instanceUid,objectClassIndex:this._objectClassIndex,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled,id:this._id,nestedData:this._nestedData}}_LoadFromJson(b){b&&(this._instanceData=b.instanceData,this._instanceUid=b.instanceUid,this._objectClassIndex=b.objectClassIndex,this._interpolationMode=b.interpolationMode,this._resultMode=b.resultMode,this._enabled=b.enabled,this._id=b.id,this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),
|
|
b.nestedData&&(this._nestedData=b.nestedData,this._startOffset=this._nestedData[0],this._localTotalTime=this._nestedData[1]),b.additionalInstanceData&&(this._additionalInstanceData=b.additionalInstanceData),this.GetKeyframeData()._LoadFromJson(b.keyframeDataJson),this.GetPropertyTrackData()._LoadFromJson(b.propertyTrackDataJson))}}d.TrackData=class{constructor(b,e){this._timelineDataItem=e;this._trackDataItems=[];this._keyframeTimeMap=new Map;d.TimelineDataManager._CreateDataItems(this._trackDataItems,
|
|
b,a,this)}Release(){this._timelineDataItem=null;for(const b of this._trackDataItems)b.Release();d.clearArray(this._trackDataItems);this._trackDataItems=null;this._keyframeTimeMap.clear();this._keyframeTimeMap=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const b=new a(null,this);this._trackDataItems.push(b);return b}GetFirstKeyframeDataItem(b){return b.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(b){b=b.GetKeyframeData().GetKeyframeDataItemArray();
|
|
return b[b.length-1]}GetKeyFrameDataItemAtTime(b,e){const c=this._keyframeTimeMap.get(e);if(c&&c.has(b))return c.get(b);for(const f of e.GetKeyframeData().keyframeDataItems())if(f.GetTime()===b)return c||this._keyframeTimeMap.set(e,new Map),this._keyframeTimeMap.get(e).set(b,f),f}GetFirstKeyFrameDataItemHigherThan(b,e){for(const c of e.GetKeyframeData().keyframeDataItems())if(c.GetTime()>b)return c}GetFirstKeyFrameDataItemHigherOrEqualThan(b,e){for(const c of e.GetKeyframeData().keyframeDataItems())if(c.GetTime()>=
|
|
b)return c}GetFirstKeyFrameDataItemLowerOrEqualThan(b,e){for(const c of e.GetKeyframeData().keyframeDataItemsReverse())if(c.GetTime()<=b)return c}*trackDataItems(){for(const b of this._trackDataItems)yield b}_SaveToJson(){return{trackDataItemsJson:this._trackDataItems.map(b=>b._SaveToJson())}}_LoadFromJson(b){b&&d.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,b.trackDataItemsJson,a,this)}}}
|
|
{"use strict";const d=self.C3;class a{constructor(b,e){this._propertyTrackData=e;this._sourceAdapterId="";this._type=this._property=this._sourceAdapterArguments=null;this._max=this._min=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyKeyframeData=null;b&&(this._sourceAdapterId=b[0][0],this._sourceAdapterArguments=b[0].slice(1),this._property=b[1],this._type=b[2],this._min=b[3],this._max=b[4],this._interpolationMode=b[5],this._resultMode=b[6],this._enabled=!!b[7],
|
|
this._propertyKeyframeData=new d.PropertyKeyframeData(b[8],this))}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new d.PropertyKeyframeData(null,this));return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(b){this._sourceAdapterId=
|
|
b}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(b){this._sourceAdapterArguments=b}GetProperty(){return this._property}SetProperty(b){this._property=b}GetType(){return this._type}SetType(b){this._type=b}GetMin(){return this._min}SetMin(b){this._min=b}GetMax(){return this._max}SetMax(b){this._max=b}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(b){this._interpolationMode=b}GetResultMode(){return this._resultMode}SetResultMode(b){this._resultMode=
|
|
b}GetEnable(){return this._enabled}SetEnable(b){this._enabled=!!b}_SaveToJson(){return{propertyKeyframeDataJson:this._propertyKeyframeData._SaveToJson(),sourceAdapterId:this._sourceAdapterId,sourceAdapterArguments:this._sourceAdapterArguments,property:this._property,type:this._type,min:this._min,max:this._max,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled}}_LoadFromJson(b){b&&(this._sourceAdapterId=b.sourceAdapterId,this._sourceAdapterArguments=b.sourceAdapterArguments,
|
|
this._property=b.property,this._type=b.type,this._min=b.min,this._max=b.max,this._interpolationMode=b.interpolationMode,this._resultMode=b.resultMode,this._enabled=b.enabled,this.GetPropertyKeyframeData()._LoadFromJson(b.propertyKeyframeDataJson))}}d.PropertyTrackData=class{constructor(b,e){this._trackDataItem=e;this._propertyTrackDataItems=[];this._propertyKeyframeTimeMap=new Map;d.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,b,a,this)}Release(){this._trackDataItem=null;for(const b of this._propertyTrackDataItems)b.Release();
|
|
d.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null;this._propertyKeyframeTimeMap.clear();this._propertyKeyframeTimeMap=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const b=new a(null,this);this._propertyTrackDataItems.push(b);return b}GetFirstPropertyKeyframeDataItem(b){return b.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(b){b=b.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();
|
|
return b[b.length-1]}GetPropertyKeyFrameDataItemAtTime(b,e){const c=this._propertyKeyframeTimeMap.get(e);if(c&&c.has(b))return c.get(b);const f=e.GetPropertyKeyframeData();for(const g of f.propertyKeyframeDataItems())if(g.GetTime()===b)return c||this._propertyKeyframeTimeMap.set(e,new Map),this._propertyKeyframeTimeMap.get(e).set(b,g),g}GetFirstPropertyKeyFrameDataItemHigherThan(b,e){e=e.GetPropertyKeyframeData();for(const c of e.propertyKeyframeDataItems())if(c.GetTime()>b)return c}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,
|
|
e){e=e.GetPropertyKeyframeData();for(const c of e.propertyKeyframeDataItems())if(c.GetTime()>=b)return c}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,e){e=e.GetPropertyKeyframeData();for(const c of e.propertyKeyframeDataItemsReverse())if(c.GetTime()<=b)return c}*propertyTrackDataItems(){for(const b of this._propertyTrackDataItems)yield b}_SaveToJson(){return{propertyTrackDataItemsJson:this._propertyTrackDataItems.map(b=>b._SaveToJson())}}_LoadFromJson(b){b&&d.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,
|
|
b.propertyTrackDataItemsJson,a,this)}}}
|
|
{"use strict";const d=self.C3;class a{constructor(b,e){this._keyframeData=e;this._time=-1;this._ease="noease";this._enable=!1;this._lowerTags=this._tags=null;b&&(this._time=b[0],this._ease=b[1],this._enable=!!b[2],this._tags=(b=b[3])?b.split(" "):[],this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase())))}Release(){this._keyframeData=null;d.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetTime(){return this._time}SetTime(b){this._time=b}GetEase(){return this._ease}SetEase(b){this._ease=
|
|
b}GetEnable(){return this._enable}SetEnable(b){this._enable=!!b}GetTags(){return this._tags}SetTags(b){this._tags=b?b.split(" "):[];this._lowerTags=new Set(this._tags.map(e=>e.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(b){return this._lowerTags.has(b.toLowerCase())}_SaveToJson(){return{time:this._time,ease:this._ease,enable:this._enable,tags:this._tags}}_LoadFromJson(b){b&&(this._time=b.time,this._ease=b.ease,this._enable=b.enable,this._tags=b.tags,this._lowerTags=new Set(this._tags.map(e=>
|
|
e.toLowerCase())))}}d.KeyframeData=class{constructor(b,e){this._trackDataItem=e;this._keyframeDataItems=[];d.TimelineDataManager._CreateDataItems(this._keyframeDataItems,b,a,this)}Release(){this._trackDataItem=null;for(const b of this._keyframeDataItems)b.Release();d.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const b=
|
|
new a(null,this);this._keyframeDataItems.push(b);return b}DeleteKeyframeDataItems(b){for(const e of this._keyframeDataItems){if(!b(e))continue;const c=this._keyframeDataItems.indexOf(e);-1!==c&&(e.Release(),this._keyframeDataItems.splice(c,1))}this.SortKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((b,e)=>b.GetTime()-e.GetTime())}GetKeyframeDataItemIndex(b){return this._keyframeDataItems.indexOf(b)}GetKeyframeDataItemFromIndex(b){return this._keyframeDataItems[b]}*keyframeDataItems(){for(const b of this._keyframeDataItems)yield b}*keyframeDataItemsReverse(){for(let b=
|
|
this._keyframeDataItems.length-1;0<=b;b--)yield this._keyframeDataItems[b]}_SaveToJson(){return{keyframeDataItemsJson:this._keyframeDataItems.map(b=>b._SaveToJson())}}_LoadFromJson(b){b&&d.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,b.keyframeDataItemsJson,a,this)}}}
|
|
{"use strict";const d=self.C3;class a{constructor(b,e){this._propertyKeyframeData=e;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;b&&(this._value=b[0][0],this._aValue=b[0][1],this._type=b[0][2],this._time=b[1],this._ease=b[2],this._enable=!!b[3],this._addonData=null,b[4]&&(this._addonData=new d.AddonData(b[4],this)))}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(),this._addonData=null)}GetAddonData(){return this._addonData}GetValue(){return this._value}SetValue(b){"color"===
|
|
this._type&&d.IsFiniteNumber(b)?(this._value[0]=d.GetRValue(b),this._value[1]=d.GetGValue(b),this._value[2]=d.GetBValue(b)):this._value=b}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(b){"color"===this._type&&d.IsFiniteNumber(b)?(this._aValue[0]=d.GetRValue(b),this._aValue[1]=d.GetGValue(b),this._aValue[2]=d.GetBValue(b)):this._aValue=b}GetValueWithResultMode(){const b=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if("relative"===b)return this.GetValue();if("absolute"===
|
|
b)return this.GetAbsoluteValue()}GetType(){return this._type}SetType(b){this._type=b}GetTime(){return this._time}SetTime(b){this._time=b}GetEase(){return this._ease}SetEase(b){this._ease=b}GetEnable(){return this._enable}SetEnable(b){this._enable=!!b}GetAddOn(b){if(this.GetAddonData())for(const e of this.GetAddonData().addonDataItems())if(e.GetId()===b)return e}_SaveToJson(){const b=this._addonData;return{addonDataJson:b?b._SaveToJson():b,value:this._value,aValue:this._aValue,type:this._type,time:this._time,
|
|
ease:this._ease,enable:this._enable}}_LoadFromJson(b){b&&(b.addonDataJson&&this._addonData._SetFromJson(b.addonDataJson),this._value=b.value,this._aValue=b.aValue,this._type=b.type,this._time=b.time,this._ease=b.ease,this._enable=b.enable)}}d.PropertyKeyframeData=class{constructor(b,e){this._propertyTrackDataItem=e;this._propertyKeyframeDataItems=[];d.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,b,a,this)}Release(){this._propertyTrackDataItem=null;for(const b of this._propertyKeyframeDataItems)b.Release();
|
|
d.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=null}AddEmptyPropertyKeyframeDataItem(){const b=new a(null,this);this._propertyKeyframeDataItems.push(b);return b}DeletePropertyKeyframeDataItems(b){for(const e of this._propertyKeyframeDataItems){if(!b(e))continue;const c=this._propertyKeyframeDataItems.indexOf(e);-1!==c&&(e.Release(),this._propertyKeyframeDataItems.splice(c,1))}this.SortPropertyKeyFrameDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((b,
|
|
e)=>b.GetTime()-e.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const b of this._propertyKeyframeDataItems)yield b}*propertyKeyframeDataItemsReverse(){for(let b=this._propertyKeyframeDataItems.length-1;0<=b;b--)yield this._propertyKeyframeDataItems[b]}_SaveToJson(){return{propertyKeyframeDataItemsJson:this._propertyKeyframeDataItems.map(b=>
|
|
b._SaveToJson())}}_LoadFromJson(b){b&&d.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,b.propertyKeyframeDataItemsJson,a,this)}}}
|
|
{"use strict";const d=self.C3;class a{constructor(c,f){this._addonData=f;this._id=c[0];this._data=c[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(c){c&&(this._id=c.id,this._data=c.data)}}class b extends a{constructor(c,f){super(c,f);this._startAnchor=this._data[0];this._startEnable=!!this._data[1];this._endAnchor=this._data[2];this._endEnable=!!this._data[3]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),
|
|
{startAnchor:this._startAnchor,startEnable:!!this._startEnable,endAnchor:this._endAnchor,endEnable:!!this._endEnable})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._startAnchor=c.startAnchor,this._startEnable=!!c.startEnable,this._endAnchor=c.endAnchor,this._endEnable=!!c.endEnable)}}class e extends a{constructor(c,f){super(c,f);this._direction=this._data[0];this._revolutions=this._data[1]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),
|
|
{direction:this._direction,revolutions:this._revolutions})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._direction=c.direction,this._revolutions=c.revolutions)}}d.AddonData=class{constructor(c,f){this._propertyKeyframeDataItem=f;this._addonDataItems=[];d.TimelineDataManager._CreateDataItems(this._addonDataItems,c,{prop:0,map:new Map([["cubic-bezier",b],["angle",e]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const c of this._addonDataItems)c.Release();d.clearArray(this._addonDataItems);
|
|
this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}*addonDataItems(){for(const c of this._addonDataItems)yield c}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(c=>c._SaveToJson())}}_LoadFromJson(c){c&&d.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,c.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",b],["angle",e]])},this)}}}
|
|
{"use strict";const d=self.C3;let a=0;d.Tween=class extends d.TimelineState{constructor(b,e){super(`tween-${a++}`,b,e);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._on_started_callbacks=this._on_completed_callbacks=null}GetInstance(){var b=this.GetTracks();if(b&&b.length&&(b=b[0])){var e=b.GetInstance();return b.IsInstanceValid()?e:null}}AddStartedCallback(b){this._on_started_callbacks||(this._on_started_callbacks=[]);this._on_started_callbacks.push(b)}AddCompletedCallback(b){this._on_completed_callbacks||
|
|
(this._on_completed_callbacks=[]);this._on_completed_callbacks.push(b)}RemoveStartedCallback(b){this._on_started_callbacks&&(b=this._on_started_callbacks.indexOf(b),-1!==b&&this._on_started_callbacks.splice(b,1))}RemoveCompletedCallback(b){this._on_completed_callbacks&&(b=this._on_completed_callbacks.indexOf(b),-1!==b&&this._on_completed_callbacks.splice(b,1))}SetStartValue(b,e){for(const f of this._tracks)for(const g of f._propertyTracks){if(g.GetPropertyName()!==e)continue;var c=g.GetPropertyTrackData();
|
|
const h=g.GetPropertyTrackDataItem();c=c.GetFirstPropertyKeyframeDataItem(h);c.SetValue(b);c.SetAbsoluteValue(b)}}_GetPropertyTrackState(b){for(const e of this._tracks)for(const c of e._propertyTracks)if(c.GetPropertyName()===b)return c}BeforeSetEndValues(b){for(const f of b)b=this._GetPropertyTrackState(f),this.SetStartValue(b.GetCurrentState(),f);if(this.IsForwardPlayBack()){var e=this.GetTotalTime()-this.GetTime();this.SetTotalTime(e);for(var c of this._tracks)c.SetLocalTotalTime(e);this._SetTime(0)}else{c=
|
|
this.GetTime();this.SetTotalTime(c);for(e of this._tracks)e.SetLocalTotalTime(c);this._SetTime(c)}this.SetInitialStateFromSetTime()}SetEndValue(b,e){var c=this._GetPropertyTrackState(e);e=c.GetPropertyTrackData();c=c.GetPropertyTrackDataItem();e=e.GetLastPropertyKeyframeDataItem(c);e.SetTime(this.GetTotalTime());e.SetValue(b);e.SetAbsoluteValue(b)}SetId(b){this._id=b}GetId(){return this._id}SetInitialValueMode(b){this._initialValueMode=b}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(b){this._destroyInstanceOnComplete=
|
|
b}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const b of this._on_started_callbacks)b(this);if(!this.IsComplete())for(const b of this._tracks)b.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(!this._finishedTriggers&&(this._finishedTriggers=!0,this._on_completed_callbacks))for(const b of this._on_completed_callbacks)b(this)}SetTime(b){this._DeleteIntermediateKeyframes();
|
|
super.SetTime(b)}SetInitialState(b){if(!this.InitialStateSet()&&"current-state"===this.GetInitialValueMode())for(const e of this._tracks)e.CompareInitialStateWithCurrent();super.SetInitialState(b)}Stop(b=!1){super.Stop(b);if(!this.IsComplete())for(const e of this._tracks)e.SaveState()}Reset(b=!0,e=!1){this._DeleteIntermediateKeyframes();super.Reset(b,e)}_DeleteIntermediateKeyframes(){for(const b of this._tracks){const e=c=>{c=c.GetTime();const f=this.GetTotalTime();return 0!==c&&c!==f};b.DeleteKeyframes(e);
|
|
b.DeletePropertyKeyframes(e)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const b=this.GetInstance();if(b&&b.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimeline(this);this.ResetBeforeChangeLayout();return!0}MaybeTriggerKeyframeReachedConditions(){}Tick(b,e){b=this.GetInstance();b=this.GetRuntime().GetDt(b);super.Tick(b,1)}_SaveToJson(){const b=super._SaveToJson(),e=this.GetTimelineDataItem();return Object.assign(b,{tweenDataItemJson:e._SaveToJson(),id:this._id,destroyInstanceOnComplete:this._destroyInstanceOnComplete,
|
|
initialValueMode:this._initialValueMode})}_LoadFromJson(b){b&&(this.GetTimelineDataItem()._LoadFromJson(b.tweenDataItemJson),super._LoadFromJson(b),this._id=b.id,this._destroyInstanceOnComplete=b.destroyInstanceOnComplete,this._initialValueMode=b.initialValueMode)}static IsPlaying(b){return b.IsPlaying()}static IsPaused(b){return b.IsPaused()}static Build(b){var e=b.runtime.GetTimelineManager(),c=new d.TimelineDataItem;if(b.json){c._LoadFromJson(b.json.tweenDataItemJson);var f=new d.Tween(c,e);f._LoadFromJson(b.json);
|
|
return f}e=new d.Tween(c,e);d.IsArray(b.propertyTracksConfig)||(b.propertyTracksConfig=[b.propertyTracksConfig]);e.SetId(b.id);e.SetTags(b.tags);e.SetInitialValueMode(b.initialValueMode);e.SetDestroyInstanceOnComplete(b.releaseOnComplete);e.SetLoop(b.loop);e.SetPingPong(b.pingPong);e.SetTotalTime(b.time);e.SetStep(0);e.SetInterpolationMode("default");e.SetResultMode(b.propertyTracksConfig[0].resultMode);c=e.AddTrack();c.SetInstanceUID(b.instance.GetUID());c.SetInterpolationMode("default");c.SetResultMode(b.propertyTracksConfig[0].resultMode);
|
|
c.SetEnable(!0);c.SetObjectClassIndex(b.instance.GetObjectClass().GetIndex());var g=b.instance.GetSdkInstance(),h=g.IsOriginalSizeKnown()?g.GetOriginalWidth():b.instance.GetWorldInfo().GetWidth();g=g.IsOriginalSizeKnown()?g.GetOriginalHeight():b.instance.GetWorldInfo().GetHeight();c.SetOriginalWidth(h);c.SetOriginalHeight(g);h=c.AddKeyframe();h.SetTime(0);h.SetEase("noease");h.SetEnable(!0);h.SetTags("");h=c.AddKeyframe();h.SetTime(b.time);h.SetEase("noease");h.SetEnable(!0);h.SetTags("");for(f of b.propertyTracksConfig)h=
|
|
c.AddPropertyTrack(),h.SetSourceAdapterId(f.sourceId),h.SetSourceAdapterArgs(f.sourceArgs),h.SetPropertyName(f.property),h.SetPropertyType(f.type),h.SetMin(NaN),h.SetMax(NaN),h.SetInterpolationMode("default"),h.SetResultMode(f.resultMode),h.SetEnable(!0),g=h.AddPropertyKeyframe(),g.SetType(f.valueType),g.SetTime(0),g.SetEase(f.ease),g.SetEnable(!0),g.SetValue(f.startValue),g.SetAbsoluteValue(f.startValue),h=h.AddPropertyKeyframe(),h.SetType(f.valueType),h.SetTime(b.time),h.SetEase(f.ease),h.SetEnable(!0),
|
|
h.SetValue(f.endValue),h.SetAbsoluteValue(f.endValue);return e}}}
|
|
{"use strict";const d=self.C3,a=self.Ease;d.Transition=class extends d.DefendedBase{constructor(b){super();this._name=b[0];this._transitionKeyframes=[];for(const e of b[1])b=d.TransitionKeyframe.Create(this,e),this._transitionKeyframes.push(b);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();a.AddCustomEase(this._name,(e,c,f,g)=>this.Interpolate(e,c,f,g))}static Create(b){return d.New(d.Transition,b)}Release(){for(const b of this._transitionKeyframes)b.Release();
|
|
d.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(b){const e=this._transitionKeyframeCache.get(b);if(e)return e;for(const c of this._transitionKeyframes)if(c.GetValueX()===b)return this._transitionKeyframeCache.set(b,c),c}GetFirstTransitionKeyFrameHigherThan(b){for(const e of this._transitionKeyframes)if(e.GetValueX()>
|
|
b)return e}GetFirstTransitionKeyFrameHigherOrEqualThan(b){for(const e of this._transitionKeyframes)if(e.GetValueX()>=b)return e}GetFirstTransitionKeyFrameLowerOrEqualThan(b){for(let e=this._transitionKeyframes.length-1;0<=e;e--){const c=this._transitionKeyframes[e];if(c.GetValueX()<=b)return c}}Interpolate(b,e,c,f){var g=b/f;(b=this.GetTransitionKeyFrameAt(g))?f=this.GetFirstTransitionKeyFrameHigherThan(g):(b=this.GetFirstTransitionKeyFrameLowerOrEqualThan(g),f=this.GetFirstTransitionKeyFrameHigherOrEqualThan(g));
|
|
var h=f.GetValueX()-b.GetValueX();g=d.mapToRange(g,b.GetValueX(),f.GetValueX(),0,h);h=b.GetValueX();const l=b.GetValueY(),m=b.GetValueX()+b.GetStartAnchorX(),p=b.GetValueY()+b.GetStartAnchorY(),x=f.GetValueX()+f.GetEndAnchorX(),v=f.GetValueY()+f.GetEndAnchorY(),r=f.GetValueX();f=f.GetValueY();f=a.GetRuntimeEase("spline")(g,h,l,m,p,x,v,r,f,this._precalculatedSamples.get(b));f+=b.GetValueY();return(1-f)*e+f*(e+c)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let c=0;c<this._transitionKeyframes.length-
|
|
1;c++){var b=this._transitionKeyframes[c];if(!b.GetStartEnable())continue;var e=this._transitionKeyframes[c+1];const f=b.GetValueX(),g=b.GetValueX()+b.GetStartAnchorX(),h=e.GetValueX()+e.GetEndAnchorX();e=e.GetValueX();this._precalculatedSamples.set(b,a.GetBezierSamples(f,g,h,e))}}}}
|
|
{"use strict";const d=self.C3;d.TransitionKeyframe=class extends d.DefendedBase{constructor(a,b){super();this._transition=a;this._valueX=b[0];this._valueY=b[1];this._startAnchorX=b[2];this._startAnchorY=b[3];this._endAnchorX=b[4];this._endAnchorY=b[5];this._startEnable=b[6];this._endEnable=b[7]}Release(){this._transition=null}static Create(a,b){return d.New(d.TransitionKeyframe,a,b)}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 d=self.C3;d.TransitionManager=class extends d.DefendedBase{constructor(a){super();this._runtime=a;this._transitions=[]}Release(){for(const a of this._transitions)a.Release();d.clearArray(this._transitions);this._transitions=null}Create(a){this._transitions.push(d.Transition.Create(a))}}}
|
|
{"use strict";const d=self.C3;d.SolStack=class extends d.DefendedBase{constructor(a){super();this._objectClass=a;this._stack=[];this._stack.push(d.New(d.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const a of this._stack)a.Release();d.clearArray(this._stack);this._objectClass=this._current=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){var a=this._stack,b=++this._index;b===a.length?(b=d.New(d.Sol,
|
|
this),a.push(b),this._current=b):(a=a[b],a.Reset(),this._current=a)}PushCopy(){const a=this._stack,b=++this._index;b===a.length&&a.push(d.New(d.Sol,this));const e=a[b];e.Copy(a[b-1]);this._current=e}Pop(){this._current=this._stack[--this._index]}RemoveInstances(a){const b=this._stack;for(let e=0,c=b.length;e<c;++e)b[e].RemoveInstances(a)}}}
|
|
{"use strict";const d=self.C3;d.Sol=class extends d.DefendedBase{constructor(a){super();this._stack=a;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(){d.clearArray(this._instances);d.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 a=this.GetInstances();return a.length?a:this._elseInstances}Reset(){this._selectAll=!0;d.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(a){a.IsSelectAll()?this.Reset():(this._selectAll=!1,d.shallowAssignArray(this._instances,
|
|
a._instances),d.clearArray(this._elseInstances))}_PushInstance(a){this._instances.push(a)}_PushElseInstance(a){this._elseInstances.push(a)}_SetSelectAll(a){this._selectAll=!!a}_GetOwnInstances(){return this._instances}_GetOwnElseInstances(){return this._elseInstances}SetSinglePicked(a){this._selectAll=!1;d.clearArray(this._instances);this._instances.push(a)}SetArrayPicked(a){this._selectAll=!1;d.shallowAssignArray(this._instances,a)}SetSetPicked(a){this._selectAll=!1;d.clearArray(this._instances);
|
|
for(const b of a)this._instances.push(b)}AddElseInstances(a,b){for(const e of b)a.has(e)||this._elseInstances.push(e)}TransferElseInstancesToOwn(a){for(const b of a)this._instances.push(b);d.arrayRemoveAllInSet(this._elseInstances,a)}PickOne(a){a&&(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()?(this.IsSelectAll()&&(d.clearArray(this._instances),d.shallowAssignArray(this._elseInstances,a.GetObjectClass().GetInstances()),this._selectAll=!1),a=this._elseInstances.indexOf(a),-1!==
|
|
a&&(this._instances.push(this._elseInstances[a]),this._elseInstances.splice(a,1))):this.SetSinglePicked(a))}RemoveInstances(a){d.arrayRemoveAllInSet(this._instances,a);d.arrayRemoveAllInSet(this._elseInstances,a)}}}
|
|
{"use strict";const d=self.C3;d.EventStack=class extends d.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._stack.push(d.New(d.EventStackFrame,this,null));this._index=0;this._expFuncStack=[]}Release(){for(const a of this._stack)a.Release();d.clearArray(this._stack);d.clearArray(this._expFuncStack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}Push(a){var b=
|
|
this._stack;const e=++this._index;if(e===b.length)return a=d.New(d.EventStackFrame,this,a),b.push(a),a;b=b[e];b.Reset(a);return b}Pop(){--this._index}PushExpFunc(a){this._expFuncStack.push(a)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const a=this._expFuncStack;return 0===a.length?null:a[a.length-1]}}}
|
|
{"use strict";const d=self.C3;d.EventStackFrame=class extends d.DefendedBase{constructor(a,b){super();this._stack=a;this._runtime=this._stack.GetRuntime();this._currentEvent=b;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(a){this._currentEvent=a;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1}_Restore(a,
|
|
b){this._currentEvent=a;this._cndIndex=0;this._actIndex=b}ResetQuick(){this._actIndex=this._cndIndex=0}GetCurrentEvent(){return this._currentEvent}SetCurrentEvent(a){this._currentEvent=a}GetConditionIndex(){return this._cndIndex}SetConditionIndex(a){this._cndIndex=a}GetActionIndex(){return this._actIndex}SetActionIndex(a){this._actIndex=a}SetLastEventTrue(a){this._lastEventTrue=!!a}GetLastEventTrue(){return this._lastEventTrue}SetElseBranchRan(a){this._elseBranchRan=!!a}GetElseBranchRan(){return this._elseBranchRan}SetExpressionObjectClass(a){this._expressionObjectClass=
|
|
a}GetExpressionObjectClass(){return this._expressionObjectClass}InitCallFunctionExpression(a,b){this._functionReturnType=a;this._functionReturnValue=b}GetFunctionReturnType(){return this._functionReturnType}SetFunctionReturnValue(a){this._functionReturnValue=a}GetFunctionReturnValue(){return this._functionReturnValue}IsSolModifierAfterCnds(){const a=this._currentEvent;return a.IsSolWriterAfterCnds()?!0:this._cndIndex<a.GetConditionCount()-1?!!a.GetSolModifiers().length:!1}}}
|
|
{"use strict";const d=self.C3;d.LocalVarStack=class extends d.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1;this._current=null;this._initialValues=[]}Release(){d.clearArray(this._stack);this._runtime=this._eventSheetManager=null}_SetInitialValues(a){this._initialValues=a;a=this._initialValues.slice(0);this._stack.push(a);this._index=0;this._current=a}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const a=
|
|
++this._index,b=this._stack;a===b.length?b.push(this._initialValues.slice(0)):d.shallowAssignArray(b[a],this._initialValues);this._current=b[a]}Pop(){this._current=this._stack[--this._index]}}}
|
|
{"use strict";const d=self.C3;d.LoopStack=class extends d.DefendedBase{constructor(a){super();this._eventSheetManager=a;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1}Release(){d.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 a=
|
|
d.New(d.Loop,this);this._stack.push(a);return a}a=this._stack[this._index];a.Reset();return a}Pop(){--this._index}FindByName(a){const b=this._stack;for(let e=this._index;0<=e;--e){const c=b[e];if(c.GetName()===a)return c}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}}
|
|
{"use strict";const d=self.C3;d.Loop=class extends d.DefendedBase{constructor(a){super();this._loopStack=a;this._name="";this._index=0;this._isStopped=!1;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=!1;this._end=NaN}SetName(a){this._name=a}GetName(){return this._name}SetIndex(a){this._index=a}GetIndex(){return this._index}Stop(){this._isStopped=!0}IsStopped(){return this._isStopped}SetEnd(a){this._end=a}GetEnd(){return this._end}}}
|
|
{"use strict";const d=self.C3;d.ArrayStack=class extends d.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){d.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const a=[];this._stack.push(a);return a}return this._stack[this._index]}Pop(){--this._index}}}
|
|
{"use strict";const d=self.C3;function a(e,c){return e.GetIndex()-c.GetIndex()}function b(e,c){for(let f=0,g=e.length;f<g;++f)if(e[f]!==c[f])return!1;return!0}d.EventSheetManager=class extends d.DefendedBase{constructor(e){super();this._runtime=e;this._allSheets=[];this._sheetsByName=new Map;this._allGroups=[];this._groupsByName=new Map;this._blocksBySid=new Map;this._cndsBySid=new Map;this._actsBySid=new Map;this._allUniqueSolModifiers=new Map;this._eventVarsBySid=new Map;this._nextLocalVarIndex=
|
|
0;this._allGlobalVars=[];this._allLocalVars=[];this._localVarInitialValues=[];this._functionBlocksByName=new Map;this._eventStack=d.New(d.EventStack,this);this._localVarStack=d.New(d.LocalVarStack,this);this._loopStack=d.New(d.LoopStack,this);this._triggersToPostInit=[];this._queuedTriggers=[];this._queuedDebugTriggers=[];this._blockFlushingDepth=this._executingTriggerDepth=this._runningEventsDepth=0;this._scheduledWaits=[];this._asyncActionPromises=[];self.c3_callFunction=(c,f)=>this._InvokeFunctionFromJS(c,
|
|
f)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;d.clearArray(this._queuedTriggers);d.clearArray(this._queuedDebugTriggers);this._runtime=null;d.clearArray(this._allSheets);this._sheetsByName.clear()}Create(e){e=d.New(d.EventSheet,this,e);this._allSheets.push(e);this._sheetsByName.set(e.GetName().toLowerCase(),e)}_AddTriggerToPostInit(e){this._triggersToPostInit.push(e)}_PostInit(){for(const e of this._functionBlocksByName.values())e._PostInit(!1);
|
|
for(const e of this._allSheets)e._PostInit();for(const e of this._allSheets)e._UpdateDeepIncludes();for(const e of this._triggersToPostInit)e._PostInit(!1);d.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(e){return this._sheetsByName.get(e.toLowerCase())||null}_RegisterGroup(e){this._allGroups.push(e);this._groupsByName.set(e.GetGroupName(),e)}_RegisterEventBlock(e){this._blocksBySid.set(e.GetSID(),
|
|
e)}_RegisterCondition(e){this._cndsBySid.set(e.GetSID(),e)}_RegisterAction(e){this._actsBySid.set(e.GetSID(),e)}_RegisterFunctionBlock(e){this._functionBlocksByName.set(e.GetFunctionName().toLowerCase(),e)}_RegisterEventVariable(e){this._eventVarsBySid.set(e.GetSID(),e);e.IsGlobal()?this._allGlobalVars.push(e):this._allLocalVars.push(e)}_DeduplicateSolModifierList(e){2<=e.length&&e.sort(a);let c=this._allUniqueSolModifiers.get(e.length);c||(c=[],this._allUniqueSolModifiers.set(e.length,c));for(let f=
|
|
0,g=c.length;f<g;++f){const h=c[f];if(b(e,h))return h}c.push(e);return e}_GetNextLocalVarIndex(e){this._localVarInitialValues.push(e.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const e=this.GetCurrentEventStackFrame();return e.GetCurrentEvent().GetConditionAt(e.GetConditionIndex())}GetCurrentAction(){const e=
|
|
this.GetCurrentEventStackFrame();return e.GetCurrentEvent().GetActionAt(e.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetAllLocalVariablesInScope(e){const c=[];for(e=e.GetScopeParent();e;)d.appendArray(c,e._GetAllLocalVariablesInScope()),e=e.GetScopeParent();return c}_GetLocalVariablesScriptInterface(e){const c={};for(const f of this.GetAllLocalVariablesInScope(e))c[f.GetJsPropName()]=f._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,
|
|
c)}GetEventVariableBySID(e){return this._eventVarsBySid.get(e)||null}GetEventBlockBySID(e){return this._blocksBySid.get(e)||null}GetConditionBySID(e){return this._cndsBySid.get(e)||null}GetActionBySID(e){return this._actsBySid.get(e)||null}GetFunctionBlockByName(e){return this._functionBlocksByName.get(e.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const e of this._allGlobalVars)e.ResetToInitialValue()}GetEventGroupByName(e){return this._groupsByName.get(e.toLowerCase())||
|
|
null}GetEventGroupBySID(e){return(e=this._blocksBySid.get(e))&&e.IsGroup()?e:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const e of this._allGroups)e.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const e of this._allSheets)e._ResetHasRunFlag()}RunEvents(e){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const c of e.runningLayouts())if(e=c.GetEventSheet())this._runtime.PushCurrentLayout(c),e.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(e){this._ResetAllHasRunFlags();
|
|
this._runningEventsDepth++;for(const c of this._DebugRunEventsGen(e))await this._runtime.DebugBreak(c);this._runningEventsDepth--}*_DebugRunEventsGen(e){for(const c of e.runningLayouts())if(e=c.GetEventSheet())this._runtime.PushCurrentLayout(c),yield*e.DebugRun(),this._runtime.PopCurrentLayout()}_Trigger(e,c,f,g){let h=!1;if(!e.GetMainRunningLayout())return this.QueueTrigger(c,f,g);this._executingTriggerDepth++;for(const l of e.runningLayouts())if(e=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);
|
|
for(const m of e.deepIncludes()){const p=m._Trigger(c,f,g);h=h||p}e=e._Trigger(c,f,g);h=h||e;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return h}*_DebugTrigger(e,c,f,g){let h=!1;if(!e.GetMainRunningLayout())return this.QueueTrigger(c,f,g);this._executingTriggerDepth++;for(const l of e.runningLayouts())if(e=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);for(const m of e.deepIncludes()){const p=yield*m._DebugTrigger(c,f,g);h=h||p}e=yield*e._DebugTrigger(c,f,g);h=h||e;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;
|
|
return h}QueueTrigger(e,c,f){this._queuedTriggers.push([e,c,f]);return!1}QueueDebugTrigger(e,c,f){let g=null;const h=new Promise(l=>g=l);this._queuedDebugTriggers.push([e,c,f,g]);return h}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const e=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [c,f,g,h]=this._queuedDebugTriggers.shift(),l=yield*this._DebugTrigger(e,c,f,g);h(l)}}async RunQueuedDebugTriggersAsync(){for(const e of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(e)}_FastTrigger(e,
|
|
c,f,g){let h=!1;var l=e.GetMainRunningLayout();if(e=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=e.deepIncludes();for(let m=0,p=l.length;m<p;++m){const x=l[m]._FastTrigger(c,f,g);h=h||x}c=e._FastTrigger(c,f,g);h=h||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return h}}*_DebugFastTrigger(e,c,f,g){let h=!1;var l=e.GetMainRunningLayout();if(e=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=e.deepIncludes();
|
|
for(let m=0,p=l.length;m<p;++m){const x=yield*l[m]._DebugFastTrigger(c,f,g);h=h||x}c=yield*e._DebugFastTrigger(c,f,g);h=h||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return h}}GetTriggerDepth(){return this._executingTriggerDepth}IsInTrigger(){return 0<this.GetTriggerDepth()}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return 0<this._runningEventsDepth}IsInEventEngine(){return this.IsRunningEvents()||
|
|
this.IsInTrigger()}_RunQueuedTriggers(e){for(const [c,f,g]of this._queuedTriggers)this._Trigger(e,c,f,g);d.clearArray(this._queuedTriggers)}BlockFlushingInstances(e){e?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(e){for(let c=0,f=e.length;c<f;++c)e[c].GetSolStack().Clear()}PushCleanSol(e){for(let c=0,f=e.length;c<f;++c)e[c].GetSolStack().PushClean()}PushCopySol(e){for(let c=0,f=e.length;c<f;++c)e[c].GetSolStack().PushCopy()}PopSol(e){for(let c=
|
|
0,f=e.length;c<f;++c)e[c].GetSolStack().Pop()}AddScheduledWait(){const e=d.New(d.ScheduledWait,this);this._scheduledWaits.push(e);return e}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var e=this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let f=0,g=this._scheduledWaits.length;f<g;++f){const h=this._scheduledWaits[f];h._ShouldRun()&&h._Run(e);h.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var e=
|
|
this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let f=0,g=this._scheduledWaits.length;f<g;++f){const h=this._scheduledWaits[f];h._ShouldRun()&&await h._DebugRun(e);h.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const e=d.arrayFilterOut(this._scheduledWaits,c=>c.ShouldRelease());for(const c of e)c.Release()}ClearAllScheduledWaits(){for(const e of this._scheduledWaits)e.Release();d.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(e){for(const c of this._scheduledWaits)c.RemoveInstances(e)}AddAsyncActionPromise(e){this._asyncActionPromises.push(e)}ClearAsyncActionPromises(){d.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const e=
|
|
Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return e}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(e){this._LoadGroupsFromJson(e.groups);this._LoadCndsFromJson(e.cnds);this._LoadActsFromJson(e.acts);this._LoadVarsFromJson(e.vars);this._LoadScheduledWaitsFromJson(e.waits)}_SaveGroupsToJson(){const e={};for(const c of this.GetAllGroups())e[c.GetSID().toString()]=
|
|
c.IsGroupActive();return e}_LoadGroupsFromJson(e){for(const [c,f]of Object.entries(e))e=parseInt(c,10),(e=this.GetEventGroupBySID(e))&&e.SetGroupActive(f)}_SaveCndsToJson(){const e={};for(const [c,f]of this._cndsBySid){const g=f._SaveToJson();g&&(e[c.toString()]=g)}return e}_LoadCndsFromJson(e){const c=new Map;for(const [f,g]of Object.entries(e))c.set(parseInt(f,10),g);for(const [f,g]of this._cndsBySid)g._LoadFromJson(c.get(f)||null)}_SaveActsToJson(){const e={};for(const [c,f]of this._actsBySid){const g=
|
|
f._SaveToJson();g&&(e[c.toString()]=g)}return e}_LoadActsFromJson(e){const c=new Map;for(const [f,g]of Object.entries(e))c.set(parseInt(f,10),g);for(const [f,g]of this._actsBySid)g._LoadFromJson(c.get(f)||null)}_SaveVarsToJson(){const e={};for(const [c,f]of this._eventVarsBySid)f.IsConstant()||!f.IsGlobal()&&!f.IsStatic()||(e[c.toString()]=f.GetValue());return e}_LoadVarsFromJson(e){for(const [c,f]of Object.entries(e))e=parseInt(c,10),(e=this.GetEventVariableBySID(e))&&e.SetValue(f)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(e=>
|
|
!e.IsPromise()).map(e=>e._SaveToJson())}_LoadScheduledWaitsFromJson(e){this.ClearAllScheduledWaits();for(const c of e)(e=d.ScheduledWait._CreateFromJson(this,c))&&this._scheduledWaits.push(e)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(e=>e.GetEventSheet()).filter(e=>e).map(e=>e._GetPerfRecord())}FindFirstFunctionBlockParent(e){for(;e;)if(e=e.GetScopeParent(),e instanceof d.FunctionBlock)return e;return null}_InvokeFunctionFromJS(e,c){Array.isArray(c)||(c=[]);
|
|
e=this.GetFunctionBlockByName(e.toLowerCase());if(!e)return null;if(!e.IsEnabled())return e.GetDefaultReturnValue();var f=e.GetFunctionParameters();if(c.length<f.length){c=c.slice(0);do c.push(f[c.length].GetInitialValue());while(c.length<f.length)}f=e.GetEventBlock();return f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),e.GetReturnType(),e.GetDefaultReturnValue(),...c)}}}
|
|
{"use strict";const d=self.C3;d.EventSheet=class extends d.DefendedBase{constructor(a,b){super();this._eventSheetManager=a;this._runtime=a.GetRuntime();this._name=b[0];this._events=[];this._triggers=new Map;this._fastTriggers=new Map;this._eventsByDisplayNumber=new Map;this._hasRun=!1;this._shallowIncludes=[];this._deepIncludes=[];this._alreadyIncludedSheets=new Set;for(const e of b[1])this._CreateEvent(e,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0,
|
|
children:[]}:null}Release(){this._runtime=this._eventSheetManager=null}_CreateEvent(a,b,e){switch(a[0]){case 0:case 3:this._CreateEventBlock(a,b,e);break;case 1:this._CreateEventVariable(a,b,e);break;case 2:this._CreateInclude(a,b,e);break;case 4:this._CreateFunctionBlock(a,b);break;case 5:this._CreateScriptBlock(a,b,e);break;default:throw Error("invalid event type");}}_CreateEventBlock(a,b,e){a=d.EventBlock.Create(this,b,a);if(a.IsOrBlock()){e.push(a);e=a.GetConditions();for(let c=0,f=e.length;c<
|
|
f;++c)e[c].IsTrigger()&&this._InitTrigger(a,c)}else a.IsTrigger()?this._InitTrigger(a,0):e.push(a)}_CreateFunctionBlock(a,b){a=d.FunctionBlock.Create(this,b,a);this._eventSheetManager._RegisterFunctionBlock(a)}_CreateEventVariable(a,b,e){a=d.EventVariable.Create(this,b,a);e.push(a)}_CreateInclude(a,b,e){a=d.EventInclude.Create(this,b,a);e.push(a)}_CreateScriptBlock(a,b,e){a=d.EventScript.Create(this,b,a);e.push(a)}_InitTrigger(a,b){a.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(a);var e=
|
|
a.GetConditionAt(b),c=e._GetFunc(),f=e.GetObjectClass();if(e.IsFastTrigger()){var g=this._fastTriggers.get(f);g||(g=new Map,this._fastTriggers.set(f,g));e=e.GetFastTriggerValue().toLowerCase();f=g.get(c);f||(f=new Map,g.set(c,f));c=f.get(e);c||(c=[],f.set(e,c));c.push([a,b])}else g=this._triggers.get(f),g||(g={methodMap:new Map,behaviors:new Map},this._triggers.set(f,g)),(f=e.GetBehaviorType())?(e=g.behaviors.get(f),e||(e=new Map,g.behaviors.set(f,e))):e=g.methodMap,g=e.get(c),g||(g=[],e.set(c,g)),
|
|
g.push([a,b])}_PostInit(){const a=this._events;for(let b=0,e=a.length;b<e;++b){const c=b<e-1&&a[b+1]instanceof d.EventBlock&&a[b+1].IsElseBlock();a[b]._PostInit(c)}}_AddShallowInclude(a){this._shallowIncludes.push(a)}_UpdateDeepIncludes(){d.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(a){const b=a._deepIncludes,e=a._alreadyIncludedSheets;for(const c of this._shallowIncludes){const f=c.GetIncludeSheet();c.IsActive()&&a!==f&&!e.has(f)&&
|
|
(e.add(f),f._AddDeepIncludes(a),b.push(f))}}deepIncludes(){return this._deepIncludes}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetName(){return this._name}_RegisterEventByDisplayNumber(a,b){this._eventsByDisplayNumber.set(b,a)}_GetEventByDisplayNumber(a){return this._eventsByDisplayNumber.get(a)||null}_ResetHasRunFlag(){this._hasRun=!1}Run(){if(!this._hasRun){var a=this._runtime,b=a.IsCPUProfiling(),e=b?performance.now():0;this._hasRun=!0;var c=this.GetEventSheetManager(),
|
|
f=c.GetCurrentEventStackFrame();for(const g of this._events)g.Run(f),c.ClearSol(g.GetSolModifiers()),c.ClearAsyncActionPromises(),a.FlushPendingInstances();f.Reset(null);b&&(this._perfRecord.totalTimeCounter+=performance.now()-e)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var a=this._runtime,b=this.GetEventSheetManager(),e=b.GetCurrentEventStackFrame();for(const c of this._events)yield*c.DebugRun(e),b.ClearSol(c.GetSolModifiers()),b.ClearAsyncActionPromises(),a.FlushPendingInstances();e.Reset(null)}}_Trigger(a,
|
|
b,e){if(b){const c=b.GetObjectClass();this._TriggerForClass(a,b,c,e);for(const f of c.GetFamilies())this._TriggerForClass(a,b,f,e)}else return this._TriggerForClass(a,b,null,null)}_TriggerForClass(a,b,e,c){e=this._triggers.get(e);if(!e)return!1;c=c?e.behaviors.get(c):e.methodMap;if(!c)return!1;c=c.get(a);if(!c)return!1;a=!1;for(const [f,g]of c)c=this._ExecuteTrigger(b,f,g),a=a||c;return a}*_DebugTrigger(a,b,e){if(b){const c=b.GetObjectClass();yield*this._DebugTriggerForClass(a,b,c,e);for(const f of c.GetFamilies())yield*this._DebugTriggerForClass(a,
|
|
b,f,e)}else return yield*this._DebugTriggerForClass(a,b,null,null)}*_DebugTriggerForClass(a,b,e,c){e=this._triggers.get(e);if(!e)return!1;c=c?e.behaviors.get(c):e.methodMap;if(!c)return!1;c=c.get(a);if(!c)return!1;a=!1;for(const [f,g]of c)c=f.DebugCanRunFast()?this._ExecuteTrigger(b,f,g):yield*this._DebugExecuteTrigger(b,f,g),a=a||c;return a}_FastTrigger(a,b,e){b=b.GetObjectClass();b=this._fastTriggers.get(b);if(!b)return!1;a=b.get(a);if(!a)return!1;e=a.get(e);if(!e)return!1;a=!1;for(let c=0,f=e.length;c<
|
|
f;++c)b=e[c],b=this._ExecuteTrigger(null,b[0],b[1]),a=a||b;return a}*_DebugFastTrigger(a,b,e){b=b.GetObjectClass();b=this._fastTriggers.get(b);if(!b)return!1;a=b.get(a);if(!a)return!1;e=a.get(e);if(!e)return!1;a=!1;for(let f=0,g=e.length;f<g;++f){var c=e[f];b=c[0];c=c[1];b=b.DebugCanRunFast()?this._ExecuteTrigger(null,b,c):yield*this._DebugExecuteTrigger(null,b,c);a=a||b}return a}_ExecuteTrigger(a,b,e){const c=this._runtime,f=this._eventSheetManager,g=f.GetCurrentEvent(),h=f.GetEventStack(),l=f.GetTriggerDepth();
|
|
let m=!1;g&&f.PushCleanSol(g.GetSolModifiersIncludingParents());f.PushCleanSol(b.GetSolModifiersIncludingParents());const p=1<l;p&&f.GetLocalVarStack().Push();const x=h.Push(b);a&&(b.GetConditions()[e].GetObjectClass().GetCurrentSol().SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked());a=!0;if(b.GetParent()){const v=b.GetTriggerParents();for(let r=0,q=v.length;r<q;++r)if(!v[r].RunPreTrigger(x)){a=!1;break}}a&&(c.IncrementExecCount(),b.IsOrBlock()?b.RunOrBlockTrigger(x,e):b.Run(x),m=
|
|
x.GetLastEventTrue());h.Pop();p&&f.GetLocalVarStack().Pop();f.PopSol(b.GetSolModifiersIncludingParents());g&&f.PopSol(g.GetSolModifiersIncludingParents());g||1!==l||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||c.FlushPendingInstances());return m}*_DebugExecuteTrigger(a,b,e){const c=this._runtime,f=this._eventSheetManager,g=f.GetCurrentEvent(),h=f.GetEventStack(),l=f.GetTriggerDepth();let m=!1;g&&f.PushCleanSol(g.GetSolModifiersIncludingParents());f.PushCleanSol(b.GetSolModifiersIncludingParents());
|
|
const p=1<l;p&&f.GetLocalVarStack().Push();const x=h.Push(b);a&&(b.GetConditions()[e].GetObjectClass().GetCurrentSol().SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked());a=!0;if(b.GetParent()){const v=b.GetTriggerParents();for(let r=0,q=v.length;r<q;++r)if(!(yield*v[r].DebugRunPreTrigger(x))){a=!1;break}}a&&(c.IncrementExecCount(),b.IsOrBlock()?yield*b.DebugRunOrBlockTrigger(x,e):yield*b.DebugRun(x),m=x.GetLastEventTrue());h.Pop();p&&f.GetLocalVarStack().Pop();f.PopSol(b.GetSolModifiersIncludingParents());
|
|
g&&f.PopSol(g.GetSolModifiersIncludingParents());g||1!==l||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||c.FlushPendingInstances());return m}_GetPerfRecord(){return this._perfRecord}}}
|
|
{"use strict";const d=self.C3,a=[];function b(c,f){return!0}function*e(c,f){return!0}d.EventBlock=class extends d.DefendedBase{constructor(c,f,g){super();this._eventSheet=c;this._runtime=c.GetRuntime();this._parent=f;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=!1;this._isOrBlock=!!g[2];
|
|
this._isElseBlock=!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=b;this._DebugRunActions=e;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=g[4];this._displayNumber=g[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:g[3][0],isBreakable:g[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,
|
|
canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===g[0]&&this._InitGroup(g[1]);c=0;for(var h of g[6])f=d.Condition.Create(this,h,c++),this._conditions.push(f),this._AddSolModifier(f.GetObjectClass());c=0;for(const l of g[7])h=d.Action.Create(this,l,c++),this._actions.push(h);if(9===g.length){g=g[8];for(const l of g)this._eventSheet._CreateEvent(l,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&&
|
|
this._conditions[0]._GetFunc()===d.Plugins.System.Cnds.Else);0===this._conditions.length&&(this._conditions=a);0===this._actions.length&&(this._actions=a);0===this._subEvents.length&&(this._subEvents=a)}static Create(c,f,g){return d.New(d.EventBlock,c,f,g)}_InitGroup(c){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!c[0];this._groupName=c[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);this._runtime.IsDebug()&&(this._perfRecord={type:"group",
|
|
name:c[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(c){this._containedIncludes.push(c)}_AddContainerSolModifierToList(c,f){for(const g of c.GetContainer().objectTypes())f.includes(g)||f.push(g)}_AddSolModifierToList(c,f){if(c)if(f.includes(c)||f.push(c),c.IsFamily())for(const g of c.GetFamilyMembers())g.IsInContainer()&&this._AddContainerSolModifierToList(g,f);else c.IsInContainer()&&this._AddContainerSolModifierToList(c,f)}_AddSolModifier(c){this._AddSolModifierToList(c,this._solModifiers)}_AddParentSolModifier(c){this._AddSolModifierToList(c,
|
|
this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(c){this._hasElseBlock=!!c;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const g of this._conditions)g._PostInit();if(0<this._actions.length){c=!1;for(var f of this._actions)f._PostInit(),f.HasReturnType()&&(c=!0);c?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions=
|
|
this._DebugRunActions_Fast)}f=this._subEvents;for(let g=0,h=f.length;g<h;++g)c=g<h-1&&f[g+1]instanceof d.EventBlock&&f[g+1].IsElseBlock(),f[g]._PostInit(c);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let c=this.GetParent();for(;c;){if(c.IsGroup())return c;c=c.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const c=this._debugData;c.canRunAllConditionsFast=
|
|
this._conditions.every(f=>f.DebugCanRunFast());c.canRunAllActionsFast=this._actions.every(f=>f.DebugCanRunFast());c.canRunAllSubEventsFast=this._subEvents.every(f=>f.DebugCanRunFast());c.canRunSelfFast=c.canRunAllConditionsFast&&c.canRunAllActionsFast&&c.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let c=this;do c._UpdateCanRunFast(),c=c.GetParent();while(c)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var c=this.GetParent();for(this._isTopLevelGroup=!0;c;){if(!c.IsGroup()){this._isTopLevelGroup=
|
|
!1;break}c=c.GetParent()}}}_IdentifySolModifiersIncludingParents(){var c=this._runtime.GetAllObjectClasses();if(this._solModifiers===c)this._solModifiersIncludingParents=c;else{this._solModifiersIncludingParents=d.cloneArray(this._solModifiers);for(c=this.GetParent();c;){for(var f of c._solModifiers)this._AddParentSolModifier(f);c=c.GetParent()}f=this.GetEventSheetManager();this._solModifiers=f._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=f._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=
|
|
[];for(var c=this.GetParent();c;)this._triggerParents.push(c),c=c.GetParent();this._triggerParents.reverse()}}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds=!0;this._parent&&this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){this._hasGotSolModifiersIncludingParents||(this._hasGotSolModifiersIncludingParents=!0,this._IdentifySolModifiersIncludingParents());return this._solModifiersIncludingParents}HasSolModifier(c){return this._solModifiers.includes(c)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(c){this._scopeParent=
|
|
c}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(c){this._debugData.isBreakpoint=!!c;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(c){c=
|
|
!!c;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==c){this._isGroupActive=c;for(const f of this._containedIncludes)f.UpdateActive();this._containedIncludes.length&&(c=this._runtime.GetCurrentLayout().GetEventSheet())&&c._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&&this._scopeParent instanceof d.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||
|
|
this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(c){c=Math.floor(c);if(0>c||c>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[c]}GetConditionByDebugIndex(c){return this.GetConditionAt(c)}IsFirstConditionOfType(c){let f=c.GetIndex();if(0===f)return!0;for(--f;0<=f;--f)if(this._conditions[f].GetObjectClass()===c.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(c){c=
|
|
Math.floor(c);if(0>c||c>=this._actions.length)throw new RangeError("invalid action index");return this._actions[c]}GetActionByDebugIndex(c){c=Math.floor(c);const f=this._actions.find(g=>g.GetDebugIndex()===c);if(!f)throw new RangeError("invalid action debug index");return f}_HasActionIndex(c){c=Math.floor(c);return 0<=c&&c<this._actions.length}GetSubEvents(){return this._subEvents}_GetAllLocalVariablesInScope(){return this._subEvents.filter(c=>c instanceof d.EventVariable)}RunPreTrigger(c){c.SetCurrentEvent(this);
|
|
let f=!1;const g=this._conditions;for(let h=0,l=g.length;h<l;++h){const m=g[h];c.SetConditionIndex(h);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.Run())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}RunOrBlockTrigger(c,f){c.SetCurrentEvent(this);this._conditions[f].Run()&&(this._RunActions(c,0)&&this._RunSubEvents(c),c.SetLastEventTrue(!0))}*DebugRunPreTrigger(c){c.SetCurrentEvent(this);let f=!1;const g=this._conditions;for(let h=0,l=g.length;h<
|
|
l;++h){const m=g[h];c.SetConditionIndex(h);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.DebugCanRunFast()?m.Run():yield*m.DebugRun())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}*DebugRunOrBlockTrigger(c,f){c.SetCurrentEvent(this);f=this._conditions[f];if(f.DebugCanRunFast()?f.Run():yield*f.DebugRun())(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():
|
|
yield*this._DebugRunSubEvents()),c.SetLastEventTrue(!0)}Run(c){c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(c):this._RunAndBlock(c)}*DebugRun(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(c):yield*this._DebugRunAndBlock(c)}_RunOrBlock(c){const f=this._conditions;let g=0===f.length;for(let l=0,m=f.length;l<m;++l){var h=
|
|
f[l];h.IsTrigger()||(c.SetConditionIndex(l),h=h.Run(),g=g||h)}c.SetLastEventTrue(g);g&&(this._RunActions(c,0)&&this._RunSubEvents(c),this._hasElseBlock&&c.SetElseBranchRan(!0))}*_DebugRunOrBlock(c){const f=this._conditions;let g=0===f.length;for(let l=0,m=f.length;l<m;++l){var h=f[l];h.IsTrigger()||(c.SetConditionIndex(l),h=h.DebugCanRunFast()?h.Run():yield*h.DebugRun(),g=g||h)}c.SetLastEventTrue(g);g&&((this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?
|
|
this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&c.SetElseBranchRan(!0))}_RunAndBlock(c){const f=this._conditions;for(let g=0,h=f.length;g<h;++g){const l=f[g];c.SetConditionIndex(g);if(!l.Run()){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);this._RunActions(c,0)&&this._RunSubEvents(c);c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}*_DebugRunAndBlock(c){const f=this._conditions;for(let g=0,h=f.length;g<h;++g){const l=f[g];c.SetConditionIndex(g);if(l.DebugCanRunFast()?
|
|
!l.Run():!(yield*l.DebugRun())){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}_RunActions_Fast(c,f){const g=this._actions;for(let h=f,l=g.length;h<l;++h)f=g[h],c.SetActionIndex(h),f.Run();return!0}*_DebugRunActions_Fast(c,f){const g=this._actions;for(let h=
|
|
f,l=g.length;h<l;++h)f=g[h],c.SetActionIndex(h),f.DebugCanRunFast()?f.Run():yield*f.DebugRun();return!0}_RunActions_ReturnValue(c,f){const g=this.GetEventSheetManager(),h=this._actions;for(let l=f,m=h.length;l<m;++l){f=h[l];c.SetActionIndex(l);const p=f.Run();if(f.CanBailOut()&&!0===p)return!1;f.IsAsync()&&p instanceof Promise&&g.AddAsyncActionPromise(p)}return!0}*_DebugRunActions_ReturnValue(c,f){const g=this.GetEventSheetManager(),h=this._actions;for(let l=f,m=h.length;l<m;++l){f=h[l];c.SetActionIndex(l);
|
|
let p;p=f.DebugCanRunFast()?f.Run():yield*f.DebugRun();if(f.CanBailOut()&&!0===p)return!1;f.IsAsync()&&p instanceof Promise&&g.AddAsyncActionPromise(p)}return!0}_ResumeActionsAndSubEvents(c){this._RunActions(c,c.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(c){if(yield*this._DebugRunActions(c,c.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var c=this.IsGroup()&&this._runtime.IsCPUProfiling(),f=c?performance.now():0,g=this._eventStack,
|
|
h=g.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(h):this._RunSubEvents_Fast(h);g.Pop();c&&(this._perfRecord.totalTimeCounter+=performance.now()-f)}}_RunSubEvents_SolWriterAfterCnds(c){const f=this._isGroup,g=this._isTopLevelGroup,h=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,p=l.length,x=p-1;m<p;++m){const v=l[m],r=v.GetSolModifiers(),q=!g||!f&&m<x;q&&h.PushCopySol(r);v.Run(c);q?h.PopSol(r):h.ClearSol(r)}}_RunSubEvents_Fast(c){const f=this._subEvents;for(let g=
|
|
0,h=f.length;g<h;++g)f[g].Run(c)}*_DebugRunSubEvents(){if(this._subEvents.length){var c=this._eventStack,f=c.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(f):yield*this._DebugRunSubEvents_Fast(f);c.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(c){const f=this._isGroup,g=this._isTopLevelGroup,h=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,p=l.length,x=p-1;m<p;++m){const v=l[m],r=v.GetSolModifiers(),q=!g||!f&&m<x;q&&h.PushCopySol(r);yield*v.DebugRun(c);
|
|
q?h.PopSol(r):h.ClearSol(r)}}*_DebugRunSubEvents_Fast(c){const f=this._subEvents;for(let g=0,h=f.length;g<h;++g)yield*f[g].DebugRun(c)}Retrigger(c,f){this._runtime.IncrementExecCount();f.ResetQuick();const g=this._conditions;if(!this.IsOrBlock())for(let h=c.GetConditionIndex()+1,l=g.length;h<l;++h)if(c=g[h],f.SetConditionIndex(h),!c.Run())return!1;this._RunActions(f,0)&&this._RunSubEvents(f);return!0}*DebugRetrigger(c,f){this._runtime.IncrementExecCount();f.ResetQuick();const g=this._conditions;if(!this.IsOrBlock())for(let h=
|
|
c.GetConditionIndex()+1,l=g.length;h<l;++h)if(c=g[h],f.SetConditionIndex(h),c.DebugCanRunFast()?!c.Run():!(yield*c.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(f,0):yield*this._DebugRunActions(f,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());return!0}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()&&this._debugData.canRunSelfFast}DebugCanRunActionsFast(){return!this._runtime.DebugBreakNext()&&this._debugData.canRunAllActionsFast}DebugCanRunSubEventsFast(){return!this._runtime.DebugBreakNext()&&
|
|
this._debugData.canRunAllSubEventsFast}_CheckParentsOKToRun(c){if(this.GetParent()){const f=this.GetTriggerParents();for(let g=0,h=f.length;g<h;++g)if(!f[g].RunPreTrigger(c))return!1}return!0}*_DebugCheckParentsOKToRun(c){if(this.GetParent()){const f=this.GetTriggerParents();for(let g=0,h=f.length;g<h;++g)if(!(yield*f[g].DebugRunPreTrigger(c)))return!1}return!0}_EvaluateFunctionCallParameters(c,f,g){0<f.length?g?(f=f.map(h=>h.Get(0)),c.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(f)):
|
|
this._scopeParent.EvaluateFunctionParameters(f):g&&c.GetLocalVarStack().Push()}RunAsFunctionCall(c,f){let g,h;const l=0<c.length;var m=this._runtime;const p=this._eventStack,x=m.GetEventSheetManager(),v=1<x._IncTriggerDepth();this._EvaluateFunctionCallParameters(x,f,v);l&&x.PushCleanSol(c);f=p.Push(this);this._CheckParentsOKToRun(f)&&(m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&([h,g]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(h));
|
|
p.Pop();v&&x.GetLocalVarStack().Pop();l&&x.PopSol(c);x._DecTriggerDepth();return g}*DebugRunAsFunctionCall(c,f){let g,h;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const l=0<c.length;var m=this._runtime;const p=this._eventStack,x=m.GetEventSheetManager(),v=1<x._IncTriggerDepth();this._EvaluateFunctionCallParameters(x,f,v);l&&x.PushCleanSol(c);f=p.Push(this);if(yield*this._DebugCheckParentsOKToRun(f))m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&
|
|
([h,g]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(h);p.Pop();v&&x.GetLocalVarStack().Pop();l&&x.PopSol(c);x._DecTriggerDepth();return g}RunAsMappedFunctionCall(c){const f=this.GetSolModifiersIncludingParents(),g=0<f.length,h=this._runtime,l=this._eventStack,m=h.GetEventSheetManager(),p=1<m._IncTriggerDepth();p&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);g&&m.PushCleanSol(f);c=l.Push(this);
|
|
this._CheckParentsOKToRun(c)&&(h.IncrementExecCount(),c.SetCurrentEvent(this),this._RunAndBlock(c));l.Pop();p&&m.GetLocalVarStack().Pop();g&&m.PopSol(f);m._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const f=this.GetSolModifiersIncludingParents(),g=0<f.length,h=this._runtime,l=this._eventStack,m=h.GetEventSheetManager(),p=1<m._IncTriggerDepth();p&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);g&&
|
|
m.PushCleanSol(f);c=l.Push(this);if(yield*this._DebugCheckParentsOKToRun(c))h.IncrementExecCount(),c.SetCurrentEvent(this),yield*this._DebugRunAndBlock(c);l.Pop();p&&m.GetLocalVarStack().Pop();g&&m.PopSol(f);m._DecTriggerDepth()}RunAsExpressionFunctionCall(c,f,g,...h){let l,m;const p=0<c.length,x=this._runtime,v=this._eventStack,r=x.GetEventSheetManager(),q=1<r._IncTriggerDepth();q&&r.GetLocalVarStack().Push();0<h.length&&this._scopeParent.SetFunctionParameters(h);p&&r.PushCleanSol(c);h=v.Push(this);
|
|
h.InitCallFunctionExpression(f,g);v.PushExpFunc(h);x.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(h)&&(x.IncrementExecCount(),h.SetCurrentEvent(this),(f=this._scopeParent.IsAsync())&&([m,l]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(h),f&&this._scopeParent.MaybeFinishAsyncFunctionCall(m));x.SetDebuggingEnabled(!0);v.Pop();v.PopExpFunc();q&&r.GetLocalVarStack().Pop();p&&r.PopSol(c);r._DecTriggerDepth();return l||h.GetFunctionReturnValue()}}}
|
|
{"use strict";const d=self.C3,a=[];let b=!1;d.EventScript=class extends d.DefendedBase{constructor(e,c,f){super();const g=e.GetRuntime(),h=e.GetEventSheetManager();this._eventSheet=e;this._eventSheetManager=h;this._runtime=e.GetRuntime();this._parent=c;this._func=g.GetObjectReference(f[1]);this._displayNumber=f[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=g.IsDebug()?{isBreakpoint:f[3][0],isBreakable:f[3][1]}:null}static Create(e,c,f){return d.New(d.EventScript,
|
|
e,c,f)}_PostInit(){const e=this._func,c=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=e.bind(null,this._runtime.GetIRuntime(),c)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(e){this._debugData.isBreakpoint=
|
|
!!e}IsElseBlock(){return!1}GetSolModifiers(){return a}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():a}Run(e){e.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(e){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",e),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
|
|
b||(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"),b=!0)}}*DebugRun(e){e.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(e)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return b}static SetHadUserScriptException(){b=!0}}}
|
|
{"use strict";const d=self.C3;d.FunctionBlock=class extends d.DefendedBase{constructor(a,b,e){super();this._eventSheet=a;this._runtime=a.GetRuntime();this._parent=b;const c=e[1];this._functionName=c[0];this._returnType=c[1];this._functionParameters=c[2].map(f=>d.EventVariable.Create(a,this,f));this._isEnabled=c[3];this._innerLocalVariables=[];this._isAsync=c[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=d.EventBlock.Create(a,b,e);this._eventBlock._SetScopeParent(this)}static Create(a,
|
|
b,e){return d.New(d.FunctionBlock,a,b,e)}_PostInit(){for(const a of this._functionParameters)a._PostInit();this._eventBlock._PostInit(!1)}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(a){this._innerLocalVariables.push(a)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(a){const b=this._functionParameters;
|
|
for(let e=0,c=b.length;e<c;++e)b[e].SetValue(a[e].Get(0))}SetFunctionParameters(a){const b=this._functionParameters;for(let e=0,c=b.length;e<c;++e)b[e].SetValue(a[e])}CaptureFunctionParameters(){return this._functionParameters.map(a=>a.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 a=this._nextAsyncId++;this._currentAsyncId=a;let b;const e=new Promise(c=>b=c);this._asyncMap.set(a,{resolve:b,pauseCount:0});return[a,e]}MaybeFinishAsyncFunctionCall(a){const b=this._asyncMap.get(a);0===b.pauseCount&&(b.resolve(),this._asyncMap.delete(a));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){this._asyncMap.get(this._currentAsyncId).pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(a){this._currentAsyncId=
|
|
a;this._asyncMap.get(a).pauseCount--}}}
|
|
{"use strict";const d=self.C3,a=[];d.EventVariable=class extends d.DefendedBase{constructor(b,e,c){super();const f=b.GetEventSheetManager();this._eventSheet=b;this._eventSheetManager=f;this._runtime=b.GetRuntime();this._parent=e;this._localVarStack=f.GetLocalVarStack();this._name=c[1];this._type=c[2];this._initialValue=c[3];this._isStatic=!!c[4];this._isConstant=!!c[5];this._isFunctionParameter=e instanceof d.FunctionBlock;this._sid=c[6];this._jsPropName=this._runtime.GetJsPropName(c[8]);this._scriptSetter=
|
|
g=>this.SetValue(g);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;this.IsBoolean()&&(this._value=this._value?1:0);!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=f._GetNextLocalVarIndex(this));f._RegisterEventVariable(this)}static Create(b,e,c){return d.New(d.EventVariable,b,e,c)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const b=
|
|
this._eventSheetManager.FindFirstFunctionBlockParent(this);b&&b._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 a}Run(b){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(b){this.Run(b)}SetValue(b){this.IsNumber()?"number"!==typeof b&&(b=parseFloat(b)):this.IsString()?"string"!==typeof b&&(b=b.toString()):this.IsBoolean()&&(b=b?1:0);this._hasSingleValue?this._value=b:this._localVarStack.GetCurrent()[this._localIndex]=
|
|
b}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let b=this.GetValue();this.IsBoolean()&&(b=!!b);return b}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}}
|
|
{"use strict";const d=self.C3,a=[];d.EventInclude=class extends d.DefendedBase{constructor(b,e,c){super();const f=b.GetEventSheetManager();this._eventSheet=b;this._eventSheetManager=f;this._runtime=b.GetRuntime();this._parent=e;this._includeSheet=null;this._includeSheetName=c[1];this._isActive=!0}static Create(b,e,c){return d.New(d.EventInclude,b,e,c)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let b=
|
|
this.GetParent();for(;b;)b instanceof d.EventBlock&&b.IsGroup()&&b._AddContainedInclude(this),b=b.GetParent();this.UpdateActive();this._runtime.IsDebug()&&this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return a}GetIncludeSheet(){return this._includeSheet}Run(b){b=!!this.GetParent();const e=this._runtime.GetAllObjectClasses();b&&this._eventSheetManager.PushCleanSol(e);this._includeSheet.Run();b&&this._eventSheetManager.PopSol(e)}*DebugRun(b){b=
|
|
!!this.GetParent();const e=this._runtime.GetAllObjectClasses();b&&this._eventSheetManager.PushCleanSol(e);yield*this._includeSheet.DebugRun();b&&this._eventSheetManager.PopSol(e)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let b=this.GetParent();for(;b;){if(b instanceof d.EventBlock&&b.IsGroup()&&!b.IsGroupActive()){this._isActive=!1;return}b=b.GetParent()}this._isActive=!0}}}
|
|
{"use strict";const d=self.C3;d.ExpNode=class extends d.DefendedBase{constructor(l){super();this._owner=l;this._runtime=l.GetRuntime()}_PostInit(){}static CreateNode(l,m){return d.New([g,c,f,h,a,b][m[0]],l,m)}};class a extends d.ExpNode{constructor(l,m){super(l);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(m[1]);this._func!==d.Plugins.System.Exps.random&&this._func!==d.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,
|
|
this._systemPlugin)}}class b extends d.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(),p=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...m.GetSolModifiersIncludingParents(),...p.GetSolModifiersIncludingParents()])];this._combinedSolModifiers=
|
|
l._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const l=this._functionBlock;if(l.IsEnabled()){const m=l.GetEventBlock();return d.EventBlock.prototype.RunAsExpressionFunctionCall.bind(m,this._combinedSolModifiers,l.GetReturnType(),l.GetDefaultReturnValue())}{const m=l.GetDefaultReturnValue();return()=>m}}}function e(l,m){if(l>=m)return l%m;0>l&&(l<=-m&&(l%=m),0>l&&(l+=m));return l}class c extends d.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,p=m.GetCurrentSol().GetExpressionInstances();var x=p.length;if(0===x)return this._returnsString?"":0;x=e(this._owner.GetSolIndex(),
|
|
x);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);return this._func.apply(p[x].GetSdkInstance(),l)}ExpObject_InstExpr(l,...m){const p=this._objectClass,x=p.GetInstances(),v=x.length;if(0===v)return this._returnsString?"":0;l=e(l,v);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(p);return this._func.apply(x[l].GetSdkInstance(),m)}}class f extends d.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=e(this._owner.GetSolIndex(),m);return l[m]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var l=this._objectClass,m=l.GetCurrentSol().GetExpressionInstances(),p=m.length;if(0===p)return this._returnsString?"":0;p=e(this._owner.GetSolIndex(),p);m=m[p];l=m.GetObjectClass().GetFamilyInstanceVariableOffset(l.GetFamilyIndex());
|
|
return m._GetInstanceVariableValueUnchecked(this._varIndex+l)}ExpInstVar_InstExpr(l){const m=this._objectClass;var p=m.GetInstances();const x=p.length;if(0===x)return this._returnsString?"":0;l=e(l,x);p=p[l];l=0;m.IsFamily()&&(l=p.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex()));return p._GetInstanceVariableValueUnchecked(this._varIndex+l)}}class g extends d.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 p=m.GetCurrentSol().GetExpressionInstances(),x=p.length;if(0===x)return this._returnsString?"":0;x=e(this._owner.GetSolIndex(),x);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);
|
|
p=p[x];x=0;m.IsFamily()&&(x=p.GetObjectClass().GetFamilyBehaviorOffset(m.GetFamilyIndex()));return this._func.apply(p.GetBehaviorInstances()[this._behaviorIndex+x].GetSdkInstance(),l)}ExpBehavior_InstExpr(l,...m){const p=this._objectClass;var x=p.GetInstances();const v=x.length;if(0===v)return this._returnsString?"":0;l=e(l,v);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(p);x=x[l];l=0;p.IsFamily()&&(l=x.GetObjectClass().GetFamilyBehaviorOffset(p.GetFamilyIndex()));return this._func.apply(x.GetBehaviorInstances()[this._behaviorIndex+
|
|
l].GetSdkInstance(),m)}}class h extends d.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 d=self.C3;d.Parameter=class extends d.DefendedBase{constructor(u,t,A){super();this._owner=u;this._index=A;this._type=t;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(u,t,A){const z=t[0];return d.New([b,e,p,f,h,c,l,b,f,f,x,v,p,q,e,m,g,r,y][z],u,z,A,t)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(u){this._variesPerInstance||!u||u.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 a(u){u=self.C3_ExpressionFuncs[u];if(!u)throw Error("invalid expression number");return u}class b extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._solIndex=0;u=z[1];this._expressionNumber=u[0];this._numberedNodes=[];this._expressionFunc=null;for(let C=1,E=u.length;C<E;++C)this._numberedNodes.push(d.ExpNode.CreateNode(this,u[C]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=a(this._expressionNumber),this._isConstant=!0)}_GetNode(u){if(0>u||u>=this._numberedNodes.length)throw new RangeError("invalid numbered node");
|
|
return this._numberedNodes[u]}_PostInit(){for(var u of this._numberedNodes)u._PostInit();u=a(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?u(this):u}GetSolIndex(){return this._solIndex}GetExpression(u){this._solIndex=u;return this._expressionFunc()}}class e extends b{constructor(u,t,A,z){super(u,t,A,z);this.Get=this.GetStringExpression;14===t&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof d.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(u){this._solIndex=
|
|
u;u=this._expressionFunc();return"string"===typeof u?u:""}_GetFastTriggerValue(){return a(this._expressionNumber)()}}class c extends b{constructor(u,t,A,z){super(u,t,A,z);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(u){this._solIndex=u;u=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(u)}}class f extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._combo=z[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class g extends d.Parameter{constructor(u,
|
|
t,A,z){super(u,t,A);this._bool=z[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class h extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._objectClass=this.GetRuntime().GetObjectClassByIndex(z[1]);this.Get=this.GetObjectClass;u=this.GetEventBlock();u._AddSolModifier(this._objectClass);this._owner instanceof d.Action?u.SetSolWriterAfterCnds():u.GetParent()&&u.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}}
|
|
class l extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(z[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class m extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(z[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class p extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._fileInfo=
|
|
z[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class x extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._instVarIndex=z[1];(u=this._owner.GetObjectClass())&&u.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(u){u=u||0;const t=this._owner.GetObjectClass();var A=t.GetCurrentSol();const z=A.GetInstances();
|
|
if(z.length)u=z[u%z.length].GetObjectClass();else if(A.HasAnyElseInstances())A=A.GetElseInstances(),u=A[u%A.length].GetObjectClass();else if(0<t.GetInstanceCount())A=t.GetInstances(),u=A[u%A.length].GetObjectClass();else return 0;return this._instVarIndex+u.GetFamilyInstanceVariableOffset(t.GetFamilyIndex())}}class v extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._eventVarSid=z[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}}
|
|
class r extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._functionBlockName=z[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 q extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let C=1,E=z.length;C<
|
|
E;++C)u=d.Parameter.Create(this._owner,z[C],0),this._subParams.push(u),this._variadicRet.push(0),u.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const u of this._subParams)u._PostInit()}GetVariadic(){const u=this._subParams,t=this._variadicRet;for(let A=0,z=u.length;A<z;++A)t[A]=u[A].Get(0);return t}}class y extends d.Parameter{constructor(u,t,A,z){super(u,t,A);this._easeIndex=z[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}}
|
|
{"use strict";const d=self.C3;function a(c,f){for(let g=0,h=c.length;g<h;++g)f[g]=c[g].Get(0)}const b=[],e=function(){};d.Condition=class extends d.DefendedBase{constructor(c,f,g){super();this._eventBlock=c;this._runtime=c.GetRuntime();this._index=g;this._func=this._runtime.GetObjectReference(f[1]);this._isTrigger=0<f[3];this._isFastTrigger=2===f[3];this._isLooping=!!f[4];this._isInverted=!!f[5];this._isStatic=!!f[6];this._sid=f[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType=
|
|
this._objectClass=null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=e;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:f[8][0],canDebug:f[8][1]}:null;-1===f[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(f[0]),f[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(f[2]),this._behaviorIndex=
|
|
this._objectClass.GetBehaviorIndexByName(f[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===f.length){c=f[9];for(let h of c)this._parameters.push(d.Parameter.Create(this,h,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=b);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(c,f,g){return d.New(d.Condition,c,f,g)}_PostInit(){for(const c of this._parameters)c._PostInit(),
|
|
c.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);this._isFastTrigger?(this.Run=this._RunFastTrigger,this.DebugRun=this._DebugRunFastTrigger):this._systemPlugin?(this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this._isStatic?(this.Run=this._RunStatic,this.DebugRun=this._DebugRunStatic):(this.Run=this._RunObject,this.DebugRun=this._DebugRunObject)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
|
|
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const c=this._objectClass.GetPlugin(),f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(c,f,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(c,f,g){const h=this._func,l=this._isInverted,m=this._parameters;if(0===m.length){const p=c._GetBoundACEMethod(h,f);this.Run=l?function(){return d.xor(p(),l)}:p}else if(1===m.length){const p=m[0];if(!l&&p.IsConstant())this.Run=c._GetBoundACEMethod_1param(h,
|
|
f,p.Get(0));else{const x=c._GetBoundACEMethod(h,f);this.Run=function(){return d.xor(x(p.Get(0)),l)}}}else if(2===m.length){const p=m[0],x=m[1];if(!l&&p.IsConstant()&&x.IsConstant())this.Run=c._GetBoundACEMethod_2params(h,f,p.Get(0),x.Get(0));else{const v=c._GetBoundACEMethod(h,f);this.Run=function(){return d.xor(v(p.Get(0),x.Get(0)),l)}}}else if(3===m.length){const p=m[0],x=m[1],v=m[2];if(!l&&p.IsConstant()&&x.IsConstant()&&v.IsConstant())this.Run=c._GetBoundACEMethod_3params(h,f,p.Get(0),x.Get(0),
|
|
v.Get(0));else{const r=c._GetBoundACEMethod(h,f);this.Run=function(){return d.xor(r(p.Get(0),x.Get(0),v.Get(0)),l)}}}else this.Run=g}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(c){this._debugData.isBreakpoint=
|
|
!!c;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const c=this._results;a(this._parameters,c);return d.xor(this._func.apply(this._systemPlugin,c),
|
|
this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;a(this._parameters,c);c=this._func.apply(this._systemPlugin,c);d.IsIterator(c)&&(c=yield*c);return d.xor(c,this._isInverted)}return this.Run()}_RunSingleGlobal(){const c=this._results;a(this._parameters,c);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return d.xor(this._func.apply(f,c),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||
|
|
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;a(this._parameters,c);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();c=this._func.apply(f,c);d.IsIterator(c)&&(c=yield*c);return d.xor(c,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var c=this._results;a(this._parameters,c);c=this._func.apply(this._behaviorType||
|
|
this._objectClass,c);this._objectClass.ApplySolToContainer();return c}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;a(this._parameters,c);c=this._func.apply(this._behaviorType||this._objectClass,c);d.IsIterator(c)&&(c=yield*c);this._objectClass.ApplySolToContainer();return c}return this.Run()}_RunObject(){const c=this._parameters,f=this._results,g=this._objectClass.GetCurrentSol();for(let h=0,l=c.length;h<
|
|
l;++h){const m=c[h];m.VariesPerInstance()||(f[h]=m.Get(0))}return g.IsSelectAll()?this._RunObject_FirstFilter(g):this._RunObject_NextFilter(g)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(c){const f=this._parameters,g=this._results;for(let h=0,l=f.length;h<l;++h){const m=f[h];m.VariesPerInstance()&&(g[h]=m.Get(c))}}_RunObject_FirstFilter(c){const f=this._objectClass,g=f.IsFamily(),h=f.GetFamilyIndex(),l=this._behaviorIndex,
|
|
m=0<=l,p=f.GetInstances(),x=this._anyParamVariesPerInstance,v=this._results,r=this._func,q=this._isInverted,y=this._isInOrBlock&&!this._isTrigger;c.ClearArrays();for(let t=0,A=p.length;t<A;++t){const z=p[t];x&&this._EvaluateVaryingParameters(t);var u=void 0;m?(u=g?z.GetObjectClass().GetFamilyBehaviorOffset(h):0,u=r.apply(z.GetBehaviorInstances()[l+u].GetSdkInstance(),v)):u=r.apply(z.GetSdkInstance(),v);d.xor(u,q)?c._PushInstance(z):y&&c._PushElseInstance(z)}f.FinishCondition(!0);c._SetSelectAll(!1);
|
|
f.ApplySolToContainer();return c.HasAnyInstances()}_RunObject_NextFilter(c){const f=this._objectClass;var g=f.IsFamily();const h=f.GetFamilyIndex(),l=f.IsInContainer(),m=this._behaviorIndex,p=0<=m,x=this._anyParamVariesPerInstance,v=this._results,r=this._func,q=this._isInverted,y=this._isInOrBlock&&!this._isTrigger,u=c._GetOwnInstances(),t=c._GetOwnElseInstances(),A=y&&!this._eventBlock.IsFirstConditionOfType(this),z=A?t:u;let C=0,E=!1;for(let G=0,I=z.length;G<I;++G){const L=z[G];x&&this._EvaluateVaryingParameters(G);
|
|
var J=void 0;p?(J=g?L.GetObjectClass().GetFamilyBehaviorOffset(h):0,J=r.apply(L.GetBehaviorInstances()[m+J].GetSdkInstance(),v)):J=r.apply(L.GetSdkInstance(),v);d.xor(J,q)?(E=!0,A?(u.push(L),l&&L._PushSiblingsToSolInstances()):(z[C]=L,l&&L._SetSiblingsToSolInstancesIndex(C),++C)):A?(z[C]=L,l&&L._SetSiblingsToSolElseInstancesIndex(C),++C):y&&(t.push(L),l&&L._PushSiblingsToSolElseInstances())}d.truncateArray(z,C);l&&f._TruncateContainerSols(A,C);g=E;A&&!E&&(E=this._OrBlockCheckInstances(u));f.FinishCondition(g||
|
|
y);return y?E:c.HasAnyInstances()}_OrBlockCheckInstances(c){var f=this._objectClass;const g=f.IsFamily();f=f.GetFamilyIndex();const h=this._anyParamVariesPerInstance,l=this._behaviorIndex,m=0<=l,p=this._results,x=this._func,v=this._isInverted;for(let q=0,y=c.length;q<y;++q){var r=c[q];h&&this._EvaluateVaryingParameters(q);if(m){const u=g?r.GetObjectClass().GetFamilyBehaviorOffset(f):0;r=x.apply(r.GetBehaviorInstances()[l+u].GetSdkInstance(),p)}else r=x.apply(r.GetSdkInstance(),p);if(d.xor(r,v))return!0}return!1}ReevaluateParameter(c,
|
|
f){return this._parameters[c].Get(f)}GetFastTriggerValue(){const c=this._parameters;if(!c.length)throw Error("no parameters");return c[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const c={};for(const [f,g]of this._savedData.entries()){let h=g;"collmemory"===f&&(h=[...g.entries()].map(l=>[l[0].GetUID(),l[1].GetUID(),l[2]]));c[f]=h}return{ex:c}}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);if(c){var f=this._runtime,
|
|
g=c.ex;if(g){c=this.GetSavedDataMap();c.clear();for(const [h,l]of Object.entries(g))g=l,"collmemory"===h&&(g=d.New(d.PairMap,l.map(m=>[f.GetInstanceByUID(m[0]),f.GetInstanceByUID(m[1]),m[2]]).filter(m=>m[0]&&m[1]))),c.set(h,g)}}}}}
|
|
{"use strict";const d=self.C3;function a(f,g){for(let h=0,l=f.length;h<l;++h)g[h]=f[h].Get(0)}const b=[],e=function(){},c=function*(){};d.Action=class extends d.DefendedBase{constructor(f,g,h){super();this._eventBlock=f;this._runtime=f=f.GetRuntime();this._index=h;this._sid=4<=g.length?g[3]:-1;this._actionReturnType=5<=g.length?g[4]:0;this._behaviorType=this._objectClass=this._func=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._combinedSolModifiers=this._callEventBlock=
|
|
null;this.DebugRun=this.Run=e;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const l=(h=-3===g[0])?g[2]:g[5];this._debugData=f.IsDebug()||h?{isBreakpoint:l[0],canDebug:l[1],index:l[2]}:null;-1===g[0]?(this._systemPlugin=f.GetSystemPlugin(),this._func=f.GetObjectReference(g[1])):-2===g[0]?this._callFunctionName=g[1]:h?(this._func=f.GetObjectReference(g[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=
|
|
1):(this._func=f.GetObjectReference(g[1]),this._objectClass=f.GetObjectClassByIndex(g[0]),g[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(g[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(g[2])));if(7===g.length){g=g[6];for(const m of g)this._parameters.push(d.Parameter.Create(this,m,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=b);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(f,
|
|
g,h){return d.New(d.Action,f,g,h)}_PostInit(){for(var f of this._parameters)f._PostInit(),f.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);if(this._systemPlugin)this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem;else if(this._callFunctionName)this._SetCallFunctionRunMethod(),this._callFunctionName="";else if(this.Run===this.RunUserScript){f=this._func;const g=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=f.bind(null,this._runtime.GetIRuntime(),
|
|
g)}else this._behaviorType?this.IsAsync()?(this.Run=this._RunBehavior_Async,this.DebugRun=this._DebugRunBehavior_Async):(this.Run=this._RunBehavior,this.DebugRun=this._DebugRunBehavior):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this.IsAsync()?(this.Run=this._RunObject_Async,this.DebugRun=this._DebugRunObject_Async):this._parameters.length?this._parameters.every(g=>g.VariesPerInstance())?(this.Run=this._RunObject_AllParamsVary,
|
|
this.DebugRun=this._DebugRunObject_AllParamsVary):this._anyParamVariesPerInstance?(this.Run=this._RunObject_SomeParamsVary,this.DebugRun=this._DebugRunObject_SomeParamsVary):this._parameters.every(g=>g.IsConstant())?(a(this._parameters,this._results),this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst):(this.Run=this._RunObject_ParamsDontVary,this.DebugRun=this._DebugRunObject_ParamsDontVary):(this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
|
|
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const f=this._objectClass.GetPlugin(),g=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(f,g,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const f=this._eventBlock.GetEventSheetManager(),g=f.GetFunctionBlockByName(this._callFunctionName);g.IsEnabled()?(this._callEventBlock=g.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],
|
|
this._combinedSolModifiers=f._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=d.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=e,this.DebugRun=c)}_SetRunMethodForBoundFunc(f,g,h){const l=this._func,m=this._parameters;if(0===m.length)this.Run=f._GetBoundACEMethod(l,g);else if(1===m.length){const p=m[0];if(p.IsConstant())this.Run=f._GetBoundACEMethod_1param(l,g,p.Get(0));
|
|
else{const x=f._GetBoundACEMethod(l,g);this.Run=function(){return x(p.Get(0))}}}else if(2===m.length){const p=m[0],x=m[1];if(p.IsConstant()&&x.IsConstant())this.Run=f._GetBoundACEMethod_2params(l,g,p.Get(0),x.Get(0));else{const v=f._GetBoundACEMethod(l,g);this.Run=function(){return v(p.Get(0),x.Get(0))}}}else if(3===m.length){const p=m[0],x=m[1],v=m[2];if(p.IsConstant()&&x.IsConstant()&&v.IsConstant())this.Run=f._GetBoundACEMethod_3params(l,g,p.Get(0),x.Get(0),v.Get(0));else{const r=f._GetBoundACEMethod(l,
|
|
g);this.Run=function(){return r(p.Get(0),x.Get(0),v.Get(0))}}}else this.Run=h}GetSID(){return this._sid}IsAsync(){return 1===this._actionReturnType}CanBailOut(){return 2===this._actionReturnType}HasReturnType(){return 0!==this._actionReturnType}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}GetCombinedSolModifiers(){return this._combinedSolModifiers}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(f){this._debugData.isBreakpoint=
|
|
!!f;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const f=this._results;a(this._parameters,f);return this._func.apply(this._systemPlugin,f)}*_DebugRunSystem(){if(this.IsBreakpoint()||
|
|
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;a(this._parameters,f);return yield*this._func.apply(this._systemPlugin,f)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const f=this._results;a(this._parameters,f);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),
|
|
f)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;a(this._parameters,f);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),f)}return this.Run()}_RunObject_ParamsConst(){const f=this._results,g=this._objectClass.GetCurrentSol().GetInstances();for(let h=0,l=g.length;h<l;++h)this._func.apply(g[h].GetSdkInstance(),f)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()||
|
|
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results,g=this._objectClass.GetCurrentSol().GetInstances();for(let h=0,l=g.length;h<l;++h)yield*this._func.apply(g[h].GetSdkInstance(),f)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const f=this._results;a(this._parameters,f);const g=this._objectClass.GetCurrentSol().GetInstances();for(let h=0,l=g.length;h<l;++h)this._func.apply(g[h].GetSdkInstance(),f)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()||
|
|
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;a(this._parameters,f);const g=this._objectClass.GetCurrentSol().GetInstances();for(let h=0,l=g.length;h<l;++h)yield*this._func.apply(g[h].GetSdkInstance(),f)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const f=this._parameters,g=this._results,h=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,p=l.length;m<p;++m){const x=l[m];for(let v=0,r=f.length;v<r;++v)g[v]=
|
|
f[v].Get(m);h.apply(x.GetSdkInstance(),g)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,g=this._results,h=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,p=l.length;m<p;++m){const x=l[m];for(let v=0,r=f.length;v<r;++v)g[v]=f[v].Get(m);yield*h.apply(x.GetSdkInstance(),g)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const f=this._parameters,
|
|
g=this._results,h=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let p=0,x=f.length;p<x;++p){var m=f[p];m.VariesPerInstance()||(g[p]=m.Get(0))}for(let p=0,x=l.length;p<x;++p){m=l[p];for(let v=0,r=f.length;v<r;++v){const q=f[v];q.VariesPerInstance()&&(g[v]=q.Get(p))}h.apply(m.GetSdkInstance(),g)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const g=this._parameters,h=this._results,l=this._func,
|
|
m=this._objectClass.GetCurrentSol().GetInstances();for(let p=0,x=g.length;p<x;++p){var f=g[p];f.VariesPerInstance()||(h[p]=f.Get(0))}for(let p=0,x=m.length;p<x;++p){f=m[p];for(let v=0,r=g.length;v<r;++v){const q=g[v];q.VariesPerInstance()&&(h[v]=q.Get(p))}yield*l.apply(f.GetSdkInstance(),h)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var f=this._objectClass;const g=f.IsFamily(),h=f.GetFamilyIndex(),l=this._parameters,m=this._anyParamVariesPerInstance,p=this._results,x=this._func,v=this._behaviorIndex;
|
|
f=f.GetCurrentSol().GetInstances();for(let y=0,u=l.length;y<u;++y){var r=l[y];r.VariesPerInstance()||(p[y]=r.Get(0))}for(let y=0,u=f.length;y<u;++y){r=f[y];if(m)for(let t=0,A=l.length;t<A;++t){var q=l[t];q.VariesPerInstance()&&(p[t]=q.Get(y))}q=g?r.GetObjectClass().GetFamilyBehaviorOffset(h):0;x.apply(r.GetBehaviorInstances()[v+q].GetSdkInstance(),p)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const l=
|
|
f.IsFamily(),m=f.GetFamilyIndex(),p=this._parameters,x=this._anyParamVariesPerInstance,v=this._results,r=this._func,q=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();for(let y=0,u=p.length;y<u;++y){var g=p[y];g.VariesPerInstance()||(v[y]=g.Get(0))}for(let y=0,u=f.length;y<u;++y){g=f[y];if(x)for(let t=0,A=p.length;t<A;++t){var h=p[t];h.VariesPerInstance()&&(v[t]=h.Get(y))}h=l?g.GetObjectClass().GetFamilyBehaviorOffset(m):0;yield*r.apply(g.GetBehaviorInstances()[q+h].GetSdkInstance(),v)}}else this._RunBehavior()}_RunObject_Async(){const f=
|
|
this._parameters,g=this._results,h=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let p=0,x=l.length;p<x;++p){const v=l[p];for(let r=0,q=f.length;r<q;++r)g[r]=f[r].Get(p);m.push(h.apply(v.GetSdkInstance(),g))}return Promise.all(m)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,g=this._results,h=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let p=0,
|
|
x=l.length;p<x;++p){const v=l[p];for(let r=0,q=f.length;r<q;++r)g[r]=f[r].Get(p);m.push(yield*h.apply(v.GetSdkInstance(),g))}return Promise.all(m)}return this._RunObject_Async()}_RunBehavior_Async(){var f=this._objectClass;const g=f.IsFamily(),h=f.GetFamilyIndex(),l=this._parameters,m=this._results,p=this._func,x=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const v=[];for(let r=0,q=f.length;r<q;++r){const y=f[r];for(let t=0,A=l.length;t<A;++t)m[t]=l[t].Get(r);const u=g?y.GetObjectClass().GetFamilyBehaviorOffset(h):
|
|
0;v.push(p.apply(y.GetBehaviorInstances()[x+u].GetSdkInstance(),m))}return Promise.all(v)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const g=f.IsFamily(),h=f.GetFamilyIndex(),l=this._parameters,m=this._results,p=this._func,x=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const v=[];for(let r=0,q=f.length;r<q;++r){const y=f[r];for(let t=0,A=l.length;t<A;++t)m[t]=l[t].Get(r);const u=g?
|
|
y.GetObjectClass().GetFamilyBehaviorOffset(h):0;v.push(yield*p.apply(y.GetBehaviorInstances()[x+u].GetSdkInstance(),m))}return Promise.all(v)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(f){console.error(`Unhandled exception running script %c${this._eventBlock.GetEventSheet().GetName()}, event ${this._eventBlock.GetDisplayNumber()}, action ${this.GetDebugIndex()+1}:`,"font-size: 1.2em; font-weight: bold;",f),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
|
|
d.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"),d.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{ex:d.ToSuperJSON(this._savedData)}:null}_LoadFromJson(f){this._savedData&&
|
|
(this._savedData.clear(),this._savedData=null);f&&(f=f.ex)&&(this._savedData=d.FromSuperJSON(f))}}}
|
|
{"use strict";const d=self.C3,a=new d.Color;function b(O,Q){return d.compare(this.GetWorldInfo().GetX(),O,Q)}function e(O,Q){return d.compare(this.GetWorldInfo().GetY(),O,Q)}function c(){const O=this.GetWorldInfo();return O.IsInViewport(O.GetLayer().GetViewport(),O.GetLayout().HasVanishingPointOutsideViewport())}function f(){var O=this.GetWorldInfo();const Q=O.GetLayout();O=O.GetBoundingBox();return 0>O.getRight()||0>O.getBottom()||O.getLeft()>Q.GetWidth()||O.getTop()>Q.GetHeight()}function g(O,Q,
|
|
Y){const ba=this.GetCurrentSol(),fa=ba.GetInstances();if(!fa.length)return!1;let ha=fa[0];var ea=ha.GetWorldInfo();let ua=ha,sa=d.distanceSquared(ea.GetX(),ea.GetY(),Q,Y);for(let xa=1,Ha=fa.length;xa<Ha;++xa)if(ha=fa[xa],ea=ha.GetWorldInfo(),ea=d.distanceSquared(ea.GetX(),ea.GetY(),Q,Y),0===O&&ea<sa||1===O&&ea>sa)sa=ea,ua=ha;ba.PickOne(ua);return!0}function h(O){const Q=this.GetWorldInfo();Q.GetX()!==O&&(Q.SetX(O),Q.SetBboxChanged())}function l(O){const Q=this.GetWorldInfo();Q.GetY()!==O&&(Q.SetY(O),
|
|
Q.SetBboxChanged())}function m(O,Q){const Y=this.GetWorldInfo();Y.EqualsXY(O,Q)||(Y.SetXY(O,Q),Y.SetBboxChanged())}function p(O,Q){if(O&&(O=O.GetPairedInstance(this._inst))){var [Y,ba]=O.GetImagePoint(Q);Q=this.GetWorldInfo();if(Q.GetX()!==Y||Q.GetY()!==ba)Q.SetXY(Y,ba),Q.SetBboxChanged()}}function x(O){if(0!==O){var Q=this.GetWorldInfo();Q.OffsetXY(Q.GetCosAngle()*O,Q.GetSinAngle()*O);Q.SetBboxChanged()}}function v(O,Q){if(0!==Q){var Y=this.GetWorldInfo();O=d.toRadians(O);Y.OffsetXY(Math.cos(O)*
|
|
Q,Math.sin(O)*Q);Y.SetBboxChanged()}}function r(){return this.GetWorldInfo().GetX()}function q(){return this.GetWorldInfo().GetY()}function y(){return this._runtime.GetDt(this._inst)}function u(O,Q){return d.compare(this.GetWorldInfo().GetWidth(),O,Q)}function t(O,Q){return d.compare(this.GetWorldInfo().GetHeight(),O,Q)}function A(O){const Q=this.GetWorldInfo();Q.GetWidth()!==O&&(Q.SetWidth(O),Q.SetBboxChanged())}function z(O){const Q=this.GetWorldInfo();Q.GetHeight()!==O&&(Q.SetHeight(O),Q.SetBboxChanged())}
|
|
function C(O,Q){const Y=this.GetWorldInfo();if(Y.GetWidth()!==O||Y.GetHeight()!==Q)Y.SetSize(O,Q),Y.SetBboxChanged()}function E(){return this.GetWorldInfo().GetWidth()}function J(){return this.GetWorldInfo().GetHeight()}function G(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function I(){return this.GetWorldInfo().GetBoundingBox().getTop()}function L(){return this.GetWorldInfo().GetBoundingBox().getRight()}function N(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function S(O,
|
|
Q){return d.angleDiff(this.GetWorldInfo().GetAngle(),d.toRadians(Q))<=d.toRadians(O)}function X(O){return d.angleClockwise(this.GetWorldInfo().GetAngle(),d.toRadians(O))}function U(O,Q){O=d.toRadians(O);Q=d.toRadians(Q);const Y=this.GetWorldInfo().GetAngle();return d.angleClockwise(Q,O)?d.angleClockwise(Y,O)&&!d.angleClockwise(Y,Q):!(!d.angleClockwise(Y,O)&&d.angleClockwise(Y,Q))}function W(O){const Q=this.GetWorldInfo();O=d.clampAngle(d.toRadians(O));isNaN(O)||Q.GetAngle()===O||(Q.SetAngle(O),Q.SetBboxChanged())}
|
|
function ia(O){if(!isNaN(O)&&0!==O){var Q=this.GetWorldInfo();Q.SetAngle(Q.GetAngle()+d.toRadians(O));Q.SetBboxChanged()}}function ka(O){if(!isNaN(O)&&0!==O){var Q=this.GetWorldInfo();Q.SetAngle(Q.GetAngle()-d.toRadians(O));Q.SetBboxChanged()}}function ya(O,Q){const Y=this.GetWorldInfo(),ba=Y.GetAngle();O=d.angleRotate(ba,d.toRadians(Q),d.toRadians(O));isNaN(O)||ba===O||(Y.SetAngle(O),Y.SetBboxChanged())}function ta(O,Q,Y){const ba=this.GetWorldInfo(),fa=ba.GetAngle();Q-=ba.GetX();Y-=ba.GetY();O=
|
|
d.angleRotate(fa,Math.atan2(Y,Q),d.toRadians(O));isNaN(O)||fa===O||(ba.SetAngle(O),ba.SetBboxChanged())}function Ba(O,Q){const Y=this.GetWorldInfo(),ba=Y.GetAngle();O-=Y.GetX();Q-=Y.GetY();Q=Math.atan2(Q,O);isNaN(Q)||ba===Q||(Y.SetAngle(Q),Y.SetBboxChanged())}function Ea(){return d.toDegrees(this.GetWorldInfo().GetAngle())}function Ca(O,Q){return d.compare(d.round6dp(100*this.GetWorldInfo().GetOpacity()),O,Q)}function Aa(){return this.GetWorldInfo().IsVisible()}function ja(O){const Q=this.GetWorldInfo();
|
|
O=2===O?!Q.IsVisible():0!==O;Q.IsVisible()!==O&&(Q.SetVisible(O),this._runtime.UpdateRender())}function Fa(O){O=d.clamp(O/100,0,1);const Q=this.GetWorldInfo();Q.GetOpacity()!==O&&(Q.SetOpacity(O),this._runtime.UpdateRender())}function wa(O){a.setFromRgbValue(O);O=this.GetWorldInfo();O.GetUnpremultipliedColor().equalsIgnoringAlpha(a)||(O.SetUnpremultipliedColor(a),this._runtime.UpdateRender())}function Da(){const O=this.GetWorldInfo().GetUnpremultipliedColor();return d.PackRGBAEx(O.getR(),O.getG(),
|
|
O.getB(),O.getA())}function Pa(){return d.round6dp(100*this.GetWorldInfo().GetOpacity())}function Qa(O){return O?this.GetWorldInfo().GetLayer()===O:!1}function Ra(O){const Q=this.GetCurrentSol(),Y=Q.GetInstances();if(!Y.length)return!1;let ba=Y[0];for(let fa=1,ha=Y.length;fa<ha;++fa){const ea=Y[fa],ua=ea.GetWorldInfo(),sa=ba.GetWorldInfo(),xa=ua.GetLayer().GetIndex(),Ha=sa.GetLayer().GetIndex();if(0===O){if(xa>Ha||xa===Ha&&ua.GetZIndex()>sa.GetZIndex())ba=ea}else if(xa<Ha||xa===Ha&&ua.GetZIndex()<
|
|
sa.GetZIndex())ba=ea}Q.PickOne(ba);return!0}function Ja(O,Q,Y){const ba=this.GetWorldInfo();O=0===O?ba.GetZElevation():ba.GetTotalZElevation();return d.compare(O,Q,Y)}function Sa(){this.GetWorldInfo().ZOrderMoveToTop()}function Ta(){this.GetWorldInfo().ZOrderMoveToBottom()}function Ua(O){O&&this.GetWorldInfo().ZOrderMoveToLayer(O)}function Va(O,Q){O=0===O;Q&&(Q=Q.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(Q,O)}function Wa(O){const Q=this.GetWorldInfo();Q.GetZElevation()!==
|
|
O&&(Q.SetZElevation(O),this._runtime.UpdateRender())}function Xa(){return this.GetWorldInfo().GetLayer().GetIndex()}function Ya(){return this.GetWorldInfo().GetLayer().GetName()}function Ka(){return this.GetWorldInfo().GetZIndex()}function Za(){return this.GetWorldInfo().GetZElevation()}function $a(){return this.GetWorldInfo().GetTotalZElevation()}function ab(O,Q){if(Q=this.GetObjectClass().GetEffectList().GetEffectTypeByName(Q)){Q=Q.GetIndex();O=1===O;var Y=this.GetWorldInfo().GetInstanceEffectList();
|
|
Y.IsEffectIndexActive(Q)!==O&&(Y.SetEffectIndexActive(Q,O),Y.UpdateActiveEffects(),this._runtime.UpdateRender())}}function bb(O,Q,Y){var ba=this.GetObjectClass().GetEffectList().GetEffectTypeByName(O);if(ba){O=ba.GetIndex();var fa=this.GetWorldInfo().GetInstanceEffectList(),ha=fa.GetEffectParametersForIndex(O);Q=Math.floor(Q);if(!(0>Q||Q>=ha.length)){ba=ba.GetShaderProgram().GetParameterType(Q);if("color"===ba){a.setFromRgbValue(Y);Q=ha[Q];if(a.equalsIgnoringAlpha(Q))return;Q.copyRgb(a)}else{"percent"===
|
|
ba&&(Y/=100);if(ha[Q]===Y)return;ha[Q]=Y}fa.IsEffectIndexActive(O)&&this._runtime.UpdateRender()}}}function cb(){return this.GetWorldInfo().HasParent()}function db(){return this.GetWorldInfo().HasChildren()}function eb(O,Q){const Y=this.GetCurrentSol().GetInstances();if(0===Y.length)return!1;const ba=O.GetCurrentSol();var fa=ba.GetInstances();if(0===fa.length)return!1;fa=new Set(fa);const ha=new Set;for(let ua=0,sa=Y.length;ua<sa;++ua){var ea=Y[ua];if(1===Q)for(const xa of ea.parents())xa.BelongsToObjectClass(O)&&
|
|
fa.has(xa)&&ha.add(xa);else{if(0===Q){if(ea=ea.GetParent(),null===ea)continue}else ea=ea.GetTopParent();ea.BelongsToObjectClass(O)&&fa.has(ea)&&ha.add(ea)}}if(0===ha.size)return!1;ba.SetSetPicked(ha);O.ApplySolToContainer();return!0}function fb(O,Q){const Y=this.GetCurrentSol().GetInstances();if(0===Y.length)return!1;const ba=O.GetCurrentSol();var fa=ba.GetInstances();if(ba.IsSelectAll()){var ha=[...this._runtime.instancesPendingCreateForObjectClass(O)];0<ha.length&&(fa=fa.concat(ha))}if(0===fa.length)return!1;
|
|
fa=new Set(fa);ha=new Set;for(let ea=0,ua=Y.length;ea<ua;++ea){const sa=Y[ea];2===Q&&!sa.HasChildren()&&sa.BelongsToObjectClass(O)&&fa.has(sa)&&ha.add(sa);for(const xa of 0===Q?sa.children():sa.allChildren())2===Q&&xa.HasChildren()||xa.BelongsToObjectClass(O)&&fa.has(xa)&&ha.add(xa)}if(0===ha.size)return!1;ba.SetSetPicked(ha);O.ApplySolToContainer();return!0}function gb(O,Q){const Y=this.GetCurrentSol().GetInstances();if(0===Y.length)return!1;const ba=O.GetCurrentSol();var fa=ba.GetInstances();if(ba.IsSelectAll()){var ha=
|
|
[...this._runtime.instancesPendingCreateForObjectClass(O)];0<ha.length&&(fa=fa.concat(ha))}if(0===fa.length)return!1;fa=new Set(fa);ha=[];for(let ea=0,ua=Y.length;ea<ua;++ea){const sa=Y[ea].GetChildAt(Q);null!==sa&&sa.BelongsToObjectClass(O)&&fa.has(sa)&&ha.push(sa)}if(0===ha.length)return!1;ba.SetArrayPicked(ha);O.ApplySolToContainer();return!0}function hb(O,Q){return d.compare(this._inst.GetChildCount(),O,Q)}function ib(O,Q,Y,ba,fa,ha,ea,ua){const sa=this._inst,xa=this._runtime.GetCurrentAction().GetObjectClass();
|
|
for(const Ha of O.allCorrespondingInstances(sa,xa)){if(!Ha.GetPlugin().SupportsSceneGraph())break;sa.AddChild(Ha,{transformX:Q,transformY:Y,transformWidth:ba,transformHeight:fa,transformAngle:ha,transformZElevation:ea,destroyWithParent:ua})}}function jb(O){const Q=this._inst,Y=this._runtime.GetCurrentAction().GetObjectClass();for(const ba of O.allCorrespondingInstances(Q,Y))Q.RemoveChild(ba)}function na(){this._inst.HasParent()&&this._inst.GetParent().RemoveChild(this._inst)}function Ga(){return this._inst.GetChildCount()}
|
|
function kb(O,Q){O=Math.floor(O);Q=Math.floor(Q);const Y=this.GetWorldInfo();2>O||2>Q||!isFinite(O)||!isFinite(Q)?(Y.ReleaseMesh(),Y.SetBboxChanged()):Y.CreateMesh(O,Q)}function lb(O,Q,Y,ba,fa,ha,ea,ua){const sa=this.GetWorldInfo();sa.SetMeshPoint(O,Q,{mode:0===Y?"absolute":"relative",x:ba,y:fa,zElevation:ha,u:ea,v:ua})&&sa.SetBboxChanged()}function mb(){const O=this.GetWorldInfo();return O.HasMesh()?O.GetSourceMesh().GetHSize():0}function nb(){const O=this.GetWorldInfo();return O.HasMesh()?O.GetSourceMesh().GetVSize():
|
|
0}function ob(O){const Q=this.GetWorldInfo();O=2===O?!Q.IsVisible():0!==O;Q.IsVisible()!==O&&Q.SetVisible(O)}function pb(O,Q){this.SetElementCSSStyle(O,Q)}function La(O,Q){this.SetElementAttribute(O,""+Q)}function Ma(O){this.RemoveElementAttribute(O)}function Na(){this.FocusElement()}function Oa(){this.BlurElement()}function Ia(){return this.IsElementFocused()}function k(O){this._SetEnabled(0!==O)}function n(){return this._IsEnabled()}function w(O,Q,Y){return d.compare(this.GetInstance().GetInstanceVariableValue(O),
|
|
Q,Y)}function B(O){return!!this.GetInstance().GetInstanceVariableValue(O)}function D(O,Q){const Y=this.GetCurrentSol(),ba=Y.GetInstances();if(!ba.length)return!1;let fa=ba[0],ha=fa,ea=fa.GetInstanceVariableValue(Q);for(let ua=1,sa=ba.length;ua<sa;++ua){fa=ba[ua];const xa=fa.GetInstanceVariableValue(Q);if(0===O&&xa<ea||1===O&&xa>ea)ea=xa,ha=fa}Y.PickOne(ha);return!0}function F(O){return this._runtime.GetCurrentCondition().IsInverted()?K(this,O):H(this,O)}function H(O,Q){Q=O.GetRuntime().GetInstanceByUID(Q);
|
|
if(!Q)return!1;const Y=O.GetCurrentSol();if(!Y.IsSelectAll()&&!Y._GetOwnInstances().includes(Q))return!1;if(O.IsFamily()){if(Q.GetObjectClass().BelongsToFamily(O))return Y.PickOne(Q),O.ApplySolToContainer(),!0}else if(Q.GetObjectClass()===O)return Y.PickOne(Q),O.ApplySolToContainer(),!0;return!1}function K(O,Q){const Y=O.GetCurrentSol();if(Y.IsSelectAll()){Y._SetSelectAll(!1);Y.ClearArrays();var ba=O.GetInstances();for(let ha=0,ea=ba.length;ha<ea;++ha){var fa=ba[ha];fa.GetUID()===Q?Y._PushElseInstance(fa):
|
|
Y._PushInstance(fa)}O.ApplySolToContainer();return!!Y._GetOwnInstances().length}ba=Y._GetOwnInstances();fa=0;for(let ha=0,ea=ba.length;ha<ea;++ha){const ua=ba[ha];ba[fa]=ua;ua.GetUID()===Q?Y._PushElseInstance(ua):++fa}d.truncateArray(ba,fa);O.ApplySolToContainer();return!!ba.length}function M(){this._runtime.DestroyInstance(this._inst)}function P(){return!0}function R(){return!0}function T(O,Q){this.GetInstance().SetInstanceVariableValue(O,Q)}function Z(O,Q){const Y=this.GetInstance(),ba=Y.GetInstanceVariableValue(O);
|
|
"number"===typeof ba&&"number"!==typeof Q?Q=parseFloat(Q):"string"===typeof ba&&"string"!==typeof Q&&(Q=Q.toString());Y.SetInstanceVariableValue(O,ba+Q)}function V(O,Q){const Y=this.GetInstance(),ba=Y.GetInstanceVariableValue(O);"number"===typeof ba&&("number"!==typeof Q&&(Q=parseFloat(Q)),Y.SetInstanceVariableValue(O,ba-Q))}function da(O,Q){this.GetInstance().SetInstanceVariableValue(O,Q?1:0)}function ca(O){const Q=this.GetInstance();Q.SetInstanceVariableValue(O,0===Q.GetInstanceVariableValue(O)?
|
|
1:0)}function aa(O){let Q;try{Q=JSON.parse(O)}catch(Y){console.error("Failed to load from JSON string: ",Y);return}O=this.GetInstance();O._OnBeforeLoad("state");O.LoadFromJson(Q,"state")}function ra(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function ma(){return this.GetInstance().GetObjectClass().GetName()}function pa(){const O=this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let Q=O.GetInstanceCount();for(const Y of this._runtime.instancesPendingCreateForObjectClass(O))++Q;
|
|
return Q}function qa(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}function oa(){return this._inst.GetIID()}function za(){return this._inst.GetUID()}d.AddCommonACEs=function(O,Q){const Y=O[1],ba=O[4],fa=O[5],ha=O[6],ea=O[7],ua=O[8],sa=O[10],xa=O[11],Ha=O[12],qb=O[13],rb=O[14],va=Q.Cnds,la=Q.Acts;Q=Q.Exps;O[3]&&(va.CompareX=b,va.CompareY=e,va.IsOnScreen=c,va.IsOutsideLayout=f,va.PickDistance=g,la.SetX=h,la.SetY=l,la.SetPos=m,la.SetPosToObject=
|
|
p,la.MoveForward=x,la.MoveAtAngle=v,Q.X=r,Q.Y=q,Q.dt=y);ba&&(va.CompareWidth=u,va.CompareHeight=t,la.SetWidth=A,la.SetHeight=z,la.SetSize=C,Q.Width=E,Q.Height=J,Q.BBoxLeft=G,Q.BBoxTop=I,Q.BBoxRight=L,Q.BBoxBottom=N);fa&&(va.AngleWithin=S,va.IsClockwiseFrom=X,va.IsBetweenAngles=U,la.SetAngle=W,la.RotateClockwise=ia,la.RotateCounterclockwise=ka,la.RotateTowardAngle=ya,la.RotateTowardPosition=ta,la.SetTowardPosition=Ba,Q.Angle=Ea);ha&&(va.IsVisible=Aa,va.CompareOpacity=Ca,la.SetVisible=ja,la.SetOpacity=
|
|
Fa,la.SetDefaultColor=wa,Q.Opacity=Pa,Q.ColorValue=Da);ea&&(va.IsOnLayer=Qa,va.PickTopBottom=Ra,va.CompareZElevation=Ja,la.MoveToTop=Sa,la.MoveToBottom=Ta,la.MoveToLayer=Ua,la.ZMoveToObject=Va,la.SetZElevation=Wa,Q.LayerNumber=Xa,Q.LayerName=Ya,Q.ZIndex=Ka,Q.ZElevation=Za,Q.TotalZElevation=$a);ua&&(la.SetEffectEnabled=ab,la.SetEffectParam=bb);qb&&(va.HasParent=cb,va.HasChildren=db,va.PickParent=eb,va.PickChildren=fb,va.PickNthChild=gb,va.CompareChildCount=hb,la.AddChild=ib,la.RemoveChild=jb,la.RemoveFromParent=
|
|
na,Q.ChildCount=Ga);rb&&(la.SetMeshSize=kb,la.SetMeshPoint=lb,Q.MeshColumns=mb,Q.MeshRows=nb);sa&&(va.IsVisible=Aa,la.SetVisible=ob,la.SetCSSStyle=pb,la.SetElemAttribute=La,la.RemoveElemAttribute=Ma);xa&&(va.IsFocused=Ia,la.SetFocus=Na,la.SetBlur=Oa);Ha&&(va.IsEnabled=n,la.SetEnabled=k);Y||(va.CompareInstanceVar=w,va.IsBoolInstanceVarSet=B,va.PickInstVarHiLow=D,va.PickByUID=F,la.SetInstanceVar=T,la.AddInstanceVar=Z,la.SubInstanceVar=V,la.SetBoolInstanceVar=da,la.ToggleBoolInstanceVar=ca,va.OnCreated=
|
|
P,va.OnDestroyed=R,la.Destroy=M,la.LoadFromJsonString||(la.LoadFromJsonString=aa),Q.AsJSON||(Q.AsJSON=ra),Q.Count=pa,Q.PickedCount=qa,Q.IID=oa,Q.UID=za,Q.ObjectTypeName=ma)}}
|
|
{"use strict";const d=self.C3;d.ScheduledWait=class extends d.DefendedBase{constructor(a){super();this._eventSheetManager=a;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;d.clearArray(this._solModifiers);for(const a of this._sols.values())a.Release();this._sols.clear()}_Init(){var a=this._eventSheetManager,b=a.GetRuntime().GetAllObjectClasses();const e=a.GetCurrentEventStackFrame();this._event=e.GetCurrentEvent();this._actIndex=e.GetActionIndex()+1;if(a=a.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=a,this._functionParameters=a.CaptureFunctionParameters(),this._functionInnerLocalVars=
|
|
a._GetAllInnerLocalVariables().map(c=>c.GetValue()),a.IsAsync()&&(this._asyncId=a.PauseCurrentAsyncFunction());for(const c of b)if(b=c.GetCurrentSol(),!b.IsSelectAll()||this._event.HasSolModifier(c))this._solModifiers.push(c),this._sols.set(c,d.New(d.SolState,b))}InitTimer(a){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+a}InitSignal(a){this._type="signal";this._Init();this._signalTag=a.toLowerCase()}InitPromise(a){this._type="promise";this._Init();
|
|
a.then(()=>this.SetSignalled()).catch(b=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",b);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(a){a._Restore(this._event,
|
|
this._actIndex);for(const [b,e]of this._sols.entries())a=b.GetCurrentSol(),e._Restore(a);if(a=this._callingFunctionBlock)a.SetFunctionParameters(this._functionParameters),a._GetAllInnerLocalVariables().map((b,e)=>b.SetValue(this._functionInnerLocalVars[e])),a.IsAsync()&&a.ResumeAsyncFunction(this._asyncId)}_Run(a){this._RestoreState(a);this._event._ResumeActionsAndSubEvents(a);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);
|
|
this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}async _DebugRun(a){this._RestoreState(a);for(const b of this._event._DebugResumeActionsAndSubEvents(a))await this._eventSheetManager.GetRuntime().DebugBreak(b);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(a){for(const b of this._sols.values())b.RemoveInstances(a)}_SaveToJson(){const a=
|
|
{},b={t:this._time,st:this._signalTag,s:this._isSignalled,ev:this._event.GetSID(),sm:this._solModifiers.map(e=>e.GetSID()),sols:a};this._event._HasActionIndex(this._actIndex)&&(b.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [e,c]of this._sols)a[e.GetSID().toString()]=c._SaveToJson();return b}static _CreateFromJson(a,b){const e=a.GetRuntime();var c=a.GetEventBlockBySID(b.ev);if(!c)return null;let f=0;if(b.hasOwnProperty("act")){var g=a.GetActionBySID(b.act);if(!g)return null;f=g.GetIndex()}g=
|
|
d.New(d.ScheduledWait,a);g._time=b.t;g._type=-1===g._time?"signal":"timer";g._signalTag=b.st;g._isSignalled=b.s;g._event=c;g._actIndex=f;for(var h of b.sm)(c=e.GetObjectClassBySID(h))&&g._solModifiers.push(c);for(const [l,m]of Object.entries(b.sols))if(b=parseInt(l,10),b=e.GetObjectClassBySID(b))h=d.New(d.SolState,null),h._LoadFromJson(a,m),g._sols.set(b,h);return g}}}
|
|
{"use strict";const d=self.C3;d.SolState=class extends d.DefendedBase{constructor(a){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];a&&(this._objectClass=a.GetObjectClass(),this._isSelectAll=a.IsSelectAll(),d.shallowAssignArray(this._instances,a._GetOwnInstances()))}Release(){this._objectClass=null;d.clearArray(this._instances)}_Restore(a){a._SetSelectAll(this._isSelectAll);d.shallowAssignArray(a._GetOwnInstances(),this._instances)}RemoveInstances(a){d.arrayRemoveAllInSet(this._instances,
|
|
a)}_SaveToJson(){return{sa:this._isSelectAll,insts:this._instances.map(a=>a.GetUID())}}_LoadFromJson(a,b){a=a.GetRuntime();this._isSelectAll=!!b.sa;d.clearArray(this._instances);for(const e of b.insts)(b=a.GetInstanceByUID(e))&&this._instances.push(b)}}}
|
|
{"use strict";const d=self.C3;function a(b,e){let c=b.get(e);c||(c=new Map,b.set(e,c));return c}d.SDKPluginBase=class extends d.DefendedBase{constructor(b){super();this._runtime=b.runtime;this._isSingleGlobal=!!b.isSingleGlobal;this._isWorldType=!!b.isWorld;this._isRotatable=!!b.isRotatable;this._mustPredraw=!!b.mustPredraw;this._hasEffects=!!b.hasEffects;this._supportsSceneGraph=!!b.supportsSceneGraph;this._supportsMesh=!!b.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(b,
|
|
e){if(!e)throw Error("missing 'this' binding");let c=this._boundACEMethodCache.get(b);if(c)return c;c=b.bind(e);this._boundACEMethodCache.set(b,c);return c}_GetBoundACEMethod_1param(b,e,c){if(!e)throw Error("missing 'this' binding");const f=a(this._boundACEMethodCache_1param,b);let g=f.get(c);if(g)return g;g=b.bind(e,c);f.set(c,g);return g}_GetBoundACEMethod_2params(b,e,c,f){if(!e)throw Error("missing 'this' binding");var g=a(this._boundACEMethodCache_2params,b);g=a(g,c);let h=g.get(f);if(h)return h;
|
|
h=b.bind(e,c,f);g.set(f,h);return h}_GetBoundACEMethod_3params(b,e,c,f,g){if(!e)throw Error("missing 'this' binding");var h=a(this._boundACEMethodCache_3params,b);h=a(h,c);h=a(h,f);let l=h.get(g);if(l)return l;l=b.bind(e,c,f,g);h.set(g,l);return l}_SetSingleGlobalObjectClass(b){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");this._singleGlobalObjectClass=b}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 d=self.C3;d.SDKDOMPluginBase=class extends d.SDKPluginBase{constructor(a,b){super(a);this._domComponentId=b;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",e=>e._OnElemFocused());this.AddElementMessageHandler("elem-blurred",e=>{e&&e._OnElemBlurred()})}Release(){super.Release()}_AddElement(a){const b=this._nextElementId++;this._instMap.set(b,a);return b}_RemoveElement(a){this._instMap.delete(a)}AddElementMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,
|
|
a,e=>{const c=this._instMap.get(e.elementId);b(c,e)})}}}{"use strict";const d=self.C3;d.SDKTypeBase=class extends d.DefendedBase{constructor(a){super();this._objectClass=a;this._runtime=a.GetRuntime();this._plugin=a.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(a){}LoadTextures(a){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(a){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}}}
|
|
{"use strict";const d=self.C3;d.SDKInstanceBase=class extends d.DefendedBase{constructor(a,b){super();this._inst=a;this._domComponentId=b;this._runtime=a.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(a){return this._runtime.Trigger(a,this._inst,null)}DebugTrigger(a){return this._runtime.DebugTrigger(a,
|
|
this._inst,null)}TriggerAsync(a){return this._runtime.TriggerAsync(a,this._inst,null)}FastTrigger(a,b){return this._runtime.FastTrigger(a,this._inst,b)}DebugFastTrigger(a,b){return this._runtime.DebugFastTrigger(a,this._inst,b)}ScheduleTriggers(a){return this._runtime.ScheduleTriggers(a)}AddDOMMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,a,b)}AddDOMMessageHandlers(a){for(const [b,e]of a)this.AddDOMMessageHandler(b,e)}PostToDOM(a,b){this._runtime.PostComponentMessageToDOM(this._domComponentId,
|
|
a,b)}PostToDOMAsync(a,b){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,a,b)}_PostToDOMMaybeSync(a,b){if(this._runtime.IsInWorker())this.PostToDOM(a,b);else return window.c3_runtimeInterface._OnMessageFromRuntime({type:"event",component:this._domComponentId,handler:a,data:b,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(a){}GetPropertyValueByIndex(a){}SetPropertyValueByIndex(a,
|
|
b){}OffsetPropertyValueByIndex(a,b){if(0!==b){var e=this.GetPropertyValueByIndex(a);if("number"!==typeof e)throw Error("expected number");this.SetPropertyValueByIndex(a,e+b)}}SetPropertyColorOffsetValueByIndex(a,b,e,c){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}GetScriptInterfaceClass(){return null}}}
|
|
{"use strict";const d=self.C3;d.SDKWorldInstanceBase=class extends d.SDKInstanceBase{constructor(a,b){super(a,b);this._worldInfo=a.GetWorldInfo();this._webglcontextrestored_handler=this._webglcontextlost_handler=null}Release(){if(this._webglcontextlost_handler){const a=this._runtime.Dispatcher();a.removeEventListener("webglcontextlost",this._webglcontextlost_handler);a.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 a=this._runtime.Dispatcher();a.addEventListener("webglcontextlost",this._webglcontextlost_handler);a.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 a=this.GetCurrentImageInfo();if(a)return a.GetWidth()}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");const a=this.GetCurrentImageInfo();if(a)return a.GetHeight()}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){var a=this.GetCurrentImageInfo();return a&&(a=a.GetTexture())?[a.GetWidth(),a.GetHeight()]:[100,100]}GetCurrentTexRect(){const a=this.GetCurrentImageInfo();return a?a.GetTexRect():null}GetImagePoint(a){a=this._inst.GetWorldInfo();return[a.GetX(),
|
|
a.GetY()]}LoadTilemapData(a,b,e){}TestPointOverlapTile(a,b){}}}
|
|
{"use strict";const d=self.C3,a=d.New(d.Rect);d.SDKDOMInstanceBase=class extends d.SDKWorldInstanceBase{constructor(b,e){super(b,e);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=this._elemHasFocus=!1;this._lastRect=d.New(d.Rect,0,0,-1,-1);b=this._runtime.GetCanvasManager();this._lastWindowWidth=b.GetLastWidth();this._lastWindowHeight=b.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(b,e){e||(e={});e.elementId=this._elementId;this.PostToDOM(b,e)}_PostToDOMElementMaybeSync(b,e){e||(e={});e.elementId=this._elementId;return this._PostToDOMMaybeSync(b,e)}PostToDOMElementAsync(b,e){e||(e={});e.elementId=this._elementId;return this.PostToDOMAsync(b,e)}CreateElement(b){b||(b={});const e=
|
|
this.GetWorldInfo().IsVisible();b.elementId=this._elementId;b.isVisible=e;Object.assign(b,this.GetElementState());this._isElementShowing=!!b.isVisible;this._PostToDOMMaybeSync("create",b);this._UpdatePosition(!0)}SetElementVisible(b){b=!!b;this._isElementShowing!==b&&(this._isElementShowing=b,this.PostToDOMElement("set-visible",{isVisible:b}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const b=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===d.Platform.OS&&("scale-inner"===
|
|
b||"scale-outer"===b||"crop"===b)}_UpdatePosition(b){var e=this.GetWorldInfo();const c=e.GetLayer();var f=e.GetX(),g=e.GetY();let [h,l]=c.LayerToCanvasCss(f,g),[m,p]=c.LayerToCanvasCss(f+e.GetWidth(),g+e.GetHeight());f=this._runtime.GetCanvasManager();g=f.GetCssWidth();const x=f.GetCssHeight();if(e.IsVisible()&&c.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=m||0>=p||h>=g||l>=x){this.SetElementVisible(!1);return}1>h&&(h=1);1>l&&(l=1);m>=g&&(m=g-1);p>=x&&(p=x-1)}a.set(h,l,m,p);e=f.GetLastWidth();
|
|
g=f.GetLastHeight();!b&&a.equals(this._lastRect)&&this._lastWindowWidth===e&&this._lastWindowHeight===g?this.SetElementVisible(!0):(this._lastRect.copy(a),this._lastWindowWidth=e,this._lastWindowHeight=g,this.SetElementVisible(!0),b=null,this._autoFontSize&&(b=c.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+f.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+f.GetCanvasClientY(),width:Math.round(this._lastRect.width()),height:Math.round(this._lastRect.height()),
|
|
fontSize:b}))}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(b,e){this.PostToDOMElement("set-css-style",{prop:d.CSSToCamelCase(b),val:e})}SetElementAttribute(b,e){this.PostToDOMElement("set-attribute",{name:b,val:e})}RemoveElementAttribute(b){this.PostToDOMElement("remove-attribute",
|
|
{name:b})}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 d=self.C3,a=self.IBehavior;d.SDKBehaviorBase=class extends d.DefendedBase{constructor(b){super();this._runtime=b.runtime;this._myObjectClasses=d.New(d.ArraySet);this._myInstances=d.New(d.ArraySet);this._iBehavior=null;this._scriptInterfaceClass=b.scriptInterfaceClass||null}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(b){this._myObjectClasses.Add(b)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(b){this._myInstances.Add(b)}_RemoveInstance(b){this._myInstances.Delete(b)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){if(null===
|
|
this._iBehavior){const b=this._scriptInterfaceClass;if(b){if(this._iBehavior=new b(this),!(this._iBehavior instanceof a))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new a(this)}return this._iBehavior}}}
|
|
{"use strict";const d=self.C3;d.SDKBehaviorTypeBase=class extends d.DefendedBase{constructor(a){super();this._runtime=a.GetRuntime();this._behaviorType=a;this._objectClass=a.GetObjectClass();this._behavior=a.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 d=self.C3;d.SDKBehaviorInstanceBase=class extends d.DefendedBase{constructor(a,b){super();this._behInst=a;this._domComponentId=b;this._inst=a.GetObjectInstance();this._runtime=a.GetRuntime();this._behaviorType=a.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(a){return this._runtime.Trigger(a,
|
|
this._inst,this._behaviorType)}DebugTrigger(a){return this._runtime.DebugTrigger(a,this._inst,this._behaviorType)}TriggerAsync(a){return this._runtime.TriggerAsync(a,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(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,
|
|
a,b)}OnSpriteFrameChanged(a,b){}SaveToJson(){return null}LoadFromJson(a){}GetPropertyValueByIndex(a){}SetPropertyValueByIndex(a,b){}OffsetPropertyValueByIndex(a,b){if(0!==b){var e=this.GetPropertyValueByIndex(a);if("number"!==typeof e)throw Error("expected number");this.SetPropertyValueByIndex(a,e+b)}}SetPropertyColorOffsetValueByIndex(a,b,e,c){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}GetScriptInterfaceClass(){return null}}}
|
|
{"use strict";const d=self.C3;d.Plugins={};d.Behaviors={};d.PluginManager=class extends d.DefendedBase{constructor(a){super();this._runtime=a;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._jumpthruBehavior=this._solidBehavior=null}CreatePlugin(a){const b=this._runtime.GetObjectReference(a[0]);if(!b)throw Error("missing plugin");d.AddCommonACEs(a,b);a=d.New(b,{runtime:this._runtime,isSingleGlobal:a[1],isWorld:a[2],isRotatable:a[5],
|
|
hasEffects:a[8],mustPredraw:a[9],supportsSceneGraph:a[13],supportsMesh:a[14]});a.OnCreate();this._allPlugins.push(a);this._pluginsByCtor.set(b,a)}CreateSystemPlugin(){this._systemPlugin=d.New(d.Plugins.System,{runtime:this._runtime,isSingleGlobal:!0});this._systemPlugin.OnCreate()}CreateBehavior(a){a=this._runtime.GetObjectReference(a[1]);if(!a)throw Error("missing behavior");const b=d.New(a,{runtime:this._runtime});b.OnCreate();this._allBehaviors.push(b);this._behaviorsByCtor.set(a,b);!this._solidBehavior&&
|
|
d.Behaviors.solid&&b instanceof d.Behaviors.solid?this._solidBehavior=b:!this._jumpthruBehavior&&d.Behaviors.jumpthru&&b instanceof d.Behaviors.jumpthru&&(this._jumpthruBehavior=b)}GetPluginByConstructorFunction(a){return this._pluginsByCtor.get(a)||null}HasBehaviorByConstructorFunction(a){return this._behaviorsByCtor.has(a)}GetBehaviorByConstructorFunction(a){return this._behaviorsByCtor.get(a)||null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}}
|
|
{"use strict";const d=self.C3,a=new Set;d.ImageInfo=class extends d.DefendedBase{constructor(){super();this._url="";this._height=this._width=this._offsetY=this._offsetX=this._pixelFormat=this._size=0;this._hasMetaData=!1;this._imageAsset=null;this._textureState="";this._rcTex=d.New(d.Rect);a.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;a.delete(this)}static OnWebGLContextLost(){for(const b of a)b._textureState="",b._rcTex.set(0,0,0,0)}LoadData(b){this._url=b[0];this._size=b[1];
|
|
this._pixelFormat=b[2];this._offsetX=b[3];this._offsetY=b[4];this._width=b[5];this._height=b[6];this._hasMetaData=!0}LoadAnimationFrameData(b){this._url=b[0];this._size=b[1];this._offsetX=b[2];this._offsetY=b[3];this._width=b[4];this._height=b[5];this._pixelFormat=b[11];this._hasMetaData=!0}LoadDynamicAsset(b,e){if(this._imageAsset)throw Error("already loaded asset");this._url=e;const c={};d.IsAbsoluteURL(e)&&(c.loadPolicy="remote");this.LoadAsset(b,c);return this._imageAsset.Load()}ReplaceWith(b){if(b===
|
|
this)throw Error("cannot replace with self");this.ReleaseTexture();this._url=b._url;this._size=b._size;this._pixelFormat=b._pixelFormat;this._offsetX=b._offsetX;this._offsetY=b._offsetY;this._width=b._width;this._height=b._height;this._hasMetaData=b._hasMetaData;this._imageAsset=b._imageAsset;this._textureState=b._textureState;this._rcTex=b._rcTex}GetURL(){return this._url}GetSize(){return this._size}GetPixelFormat(){return this._pixelFormat}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(b,
|
|
e){if(this._imageAsset)throw Error("already got asset");e=Object.assign({},e,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=b.LoadImage(e)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(b,e){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";b=await this._imageAsset.LoadStaticTexture(b,e);if(!b)return this._textureState="",null;this._textureState="loaded";this._hasMetaData||
|
|
(this._width=b.GetWidth(),this._height=b.GetHeight(),this._hasMetaData=!0);this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+this._width,this._offsetY+this._height);this._rcTex.divide(b.GetWidth(),b.GetHeight());return b}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,0,0,0))}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}async ExtractImageToCanvas(){const b=
|
|
await this._imageAsset.LoadToDrawable(),e=d.CreateCanvas(this._width,this._height);e.getContext("2d").drawImage(b,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return e}}}
|
|
{"use strict";const d=self.C3;d.AnimationInfo=class extends d.DefendedBase{constructor(a){super();this._name=a[0];this._speed=a[1];this._isLooping=!!a[2];this._repeatCount=a[3];this._repeatTo=a[4];this._isPingPong=!!a[5];this._sid=a[6];this._frames=a[7].map(b=>d.New(d.AnimationFrameInfo,b))}Release(){for(const a of this._frames)a.Release();d.clearArray(this._frames)}LoadAllAssets(a){for(const b of this._frames)b.GetImageInfo().LoadAsset(a)}LoadAllTextures(a,b){return Promise.all(this._frames.map(e=>
|
|
e.GetImageInfo().LoadStaticTexture(a,b)))}ReleaseAllTextures(){for(const a of this._frames)a.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(a){a=Math.floor(a);if(0>a||a>=this._frames.length)throw new RangeError("invalid frame");return this._frames[a]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}}}
|
|
{"use strict";const d=self.C3;d.AnimationFrameInfo=class extends d.DefendedBase{constructor(a){super();this._imageInfo=d.New(d.ImageInfo);this._imageInfo.LoadAnimationFrameData(a);this._duration=a[6];this._origin=d.New(d.Vector2,a[7],a[8]);this._imagePoints=a[9].map(b=>d.New(d.ImagePoint,this,b));this._imagePointsByName=new Map;for(const b of this._imagePoints)this._imagePointsByName.set(b.GetName().toLowerCase(),b);this._collisionPoly=null;a=a[10];6<=a.length&&(this._collisionPoly=d.New(d.CollisionPoly,
|
|
a))}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(a){return this._imagePointsByName.get(a.toLowerCase())||null}GetImagePointByIndex(a){a=Math.floor(a);return 0>a||a>=this._imagePoints.length?null:
|
|
this._imagePoints[a]}GetImagePointCount(){return this._imagePoints.length}}}{"use strict";const d=self.C3;d.ImagePoint=class extends d.DefendedBase{constructor(a,b){super();this._afi=a;this._name=b[0];this._pos=d.New(d.Vector2,b[1],b[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}}
|
|
{"use strict";const d=self.C3,a=self.C3Debugger,b=self.IObjectClass;d.ObjectClass=class extends d.DefendedBase{constructor(e,c,f){super();const g=e.GetObjectReference(f[1]);this._runtime=e;this._plugin=e.GetPluginManager().GetPluginByConstructorFunction(g);this._sdkType=null;this._instSdkCtor=g.Instance;this._index=c;this._sid=f[11];this._name=f[0];this._jsPropName=this._runtime.GetJsPropName(f[14]);this._isGlobal=!!f[9];this._isFamily=!!f[2];this._isOnLoaderLayout=!!f[10];this._instVars=f[3].map(h=>
|
|
({sid:h[0],type:h[1],name:h[2],jsPropName:e.GetJsPropName(h[3])}));this._behaviorsCount=f[4];this._effectsCount=f[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=d.New(d.SparseGrid,e.GetOriginalViewportWidth(),e.GetOriginalViewportHeight());this._anyCollisionCellChanged=!0;this._anyInstanceParallaxed=!1;this._familyMembersSet=this._familyMembers=null;this._familyIndex=-1;this._familyEffectMap=this._familyBehaviorMap=this._familyInstVarMap=this._familiesSet=
|
|
this._families=null;this._isInContainer=!1;this._container=null;this._behaviorTypes=f[8].map(h=>d.BehaviorType.Create(this,h));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=d.New(d.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=d.New(d.EffectList,this,f[12]));f[6]&&(this._imageInfo=d.New(d.ImageInfo),this._imageInfo.LoadData(f[6]));if(f[7]){this._animations=f[7].map(h=>d.New(d.AnimationInfo,h));this._animationsByName=new Map;this._animationsBySid=new Map;for(const h of this._animations)this._animationsByName.set(h.GetName().toLowerCase(),h),this._animationsBySid.set(h.GetSID(),h)}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=d.New(g.Type,this,f[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=d.New(d.Event.Dispatcher);if(c=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new c(this),!(this._iObjectClass instanceof b))throw new TypeError("script interface class must derive from IObjectClass");
|
|
}else this._iObjectClass=new b(this);f[13]&&(c=f[13])&&this._sdkType.LoadTilemapData(c[0],c[1]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(f))}static Create(e,c,f){return d.New(d.ObjectClass,e,c,f)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const e of this._animations)e.Release();
|
|
d.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._runtime=this._container=null}_LoadFamily(e){for(let c=1,f=e.length;c<f;++c){const g=this._runtime.GetObjectClassByIndex(e[c]);this._familyMembers.push(g);this._familyMembersSet.add(g);g._families.push(this);g._familiesSet.add(this)}}_SetContainer(e){this._isInContainer=!0;this._container=e}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var e=
|
|
0;if(!this._isFamily)for(var c of this._families)for(var f of c.GetBehaviorTypes()){const l=f.GetName().toLowerCase();this._behaviorsByName.set(l,f);this._behaviorNameToIndex.set(l,e);this._behaviorTypesIncludingInherited.push(f);++e}for(var g of this.GetBehaviorTypes())c=g.GetName().toLowerCase(),this._behaviorsByName.set(c,g),this._behaviorNameToIndex.set(c,e),this._behaviorTypesIncludingInherited.push(g),++e;for(var h of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(h.GetBehavior().constructor);
|
|
if(!this._isFamily&&this._families.length){e=this._runtime.GetFamilyCount();d.extendArray(this._familyInstVarMap,e,0);d.extendArray(this._familyBehaviorMap,e,0);d.extendArray(this._familyEffectMap,e,0);e=[];c=h=g=0;for(const l of this._families)if(f=l.GetFamilyIndex(),this._familyInstVarMap[f]=g,g+=l.GetInstanceVariablesCount(),this._familyBehaviorMap[f]=h,h+=l.GetBehaviorTypesCount(),this._familyEffectMap[f]=c,c+=l.GetEffectTypesCount(),(f=l.GetEffectList())&&this._effectList)for(const m of f.GetAllEffectTypes())e.push(m.Clone(this._effectList));
|
|
this._effectList&&this._effectList.PrependEffectTypes(e)}}_CreateSingleGlobalInstance(e){const c=this._runtime._GetNewUID(),f=d.New(d.Instance,{runtime:this._runtime,objectType:this,uid:c});f._CreateSdkInstance(e[16],[]);this._runtime._MapInstanceByUID(c,f);this._instances.push(f)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(e){if(this._isFamily)return Promise.resolve();
|
|
this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(e)||Promise.resolve():Promise.resolve()}ReleaseTextures(){if(!this._isFamily){this._textureRefCount--;if(0>this._textureRefCount)throw Error("released textures too many times");0===this._textureRefCount&&this._sdkType.ReleaseTextures()}}OnDynamicTextureLoadComplete(){if(this._isFamily)throw Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(e){return this._isFamily?
|
|
Promise.resolve():this._sdkType.PreloadTexturesWithInstances(e)}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetIndex(){return this._index}GetSID(){return this._sid}IsFamily(){return this._isFamily}IsGlobal(){return this._isGlobal}IsWorldType(){return this._isWorldType}GetFamilyIndex(){return this._familyIndex}GetBehaviorTypes(){return this._behaviorTypes}GetBehaviorTypesCount(){return this._behaviorsCount}UsesBehaviorByCtor(e){return e&&
|
|
this._usedBehaviorCtors.has(e)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(e=>e.sid)}GetInstanceVariableIndexBySID(e){return this._instVars.findIndex(c=>c.sid===e)}GetInstanceVariableIndexByName(e){return this._instVars.findIndex(c=>c.name===e)}_GetAllInstanceVariableNames(){return this._instVars.map(e=>e.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(e=>e.jsPropName)}GetInstanceVariableType(e){e=Math.floor(e);
|
|
if(0>e||e>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[e].type}GetInstanceVariableName(e){e=Math.floor(e);if(0>e||e>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[e].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(e){return this._behaviorsByName.get(e.toLowerCase())||null}GetBehaviorIndexByName(e){e=
|
|
this._behaviorNameToIndex.get(e.toLowerCase());return"undefined"===typeof e?-1:e}GetEffectList(){return this._effectList}HasEffects(){return this._plugin.HasEffects()}UsesEffects(){return this._effectList&&this._effectList.HasAnyEffectType()}GetSolStack(){return this._solStack}GetCurrentSol(){return this._solStack.GetCurrentSol()}GetImageInfo(){return this._imageInfo}SetDefaultInstanceData(e){this._defaultInstanceData=e}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(e){this._defaultLayerIndex=
|
|
e}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(e){return this._familiesSet.has(e)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(e){return this._familyMembersSet.has(e)}GetFamilyBehaviorOffset(e){return this._familyBehaviorMap[e]}GetFamilyInstanceVariableOffset(e){return this._familyInstVarMap[e]}GetAnimationByName(e){if(!this._animations)throw Error("no animations");
|
|
return this._animationsByName.get(e.toLowerCase())||null}GetAnimationBySID(e){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(e)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const e=this.GetFirstAnimationFrame().GetImageInfo();return[e.GetWidth(),e.GetHeight()]}return this._imageInfo?[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()]:[100,
|
|
100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances;for(const e of this._runtime._GetInstancesPendingCreate())e.GetObjectClass()===this&&(yield e)}GetInstanceCount(){return this._instances.length}_AddInstance(e){this._instances.push(e)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&
|
|
!this._isFamily){var e=this._instances,c=0;for(let f=e.length;c<f;++c)e[c]._SetIID(c);e=this._runtime._GetInstancesPendingCreate();for(const f of e)f.GetObjectClass()===this&&f._SetIID(c++);this._iidsStale=!1}}GetInstanceByIID(e){var c=this._instances;if(e<c.length)return c[e];e-=c.length;c=this._runtime._GetInstancesPendingCreate();for(const f of c)if(f.GetObjectClass()===this){if(0===e)return f;--e}return null}GetFirstPicked(e){if(e&&e.IsInContainer()&&e.GetObjectClass()!==this)for(const c of e.siblings())if(c.GetObjectClass()===
|
|
this)return c;e=this.GetCurrentSol().GetInstances();return e.length?e[0]:null}GetPairedInstance(e){const c=this.GetCurrentSol().GetInstances();return 0<c.length?c[e.GetIID()%c.length]:null}*allCorrespondingInstances(e,c){const f=this.GetCurrentSol().GetInstances();var g=f.length;const h=c.GetCurrentSol(),l=c.GetCurrentSol().GetInstances(),m=l.length;var p=e.GetIID();if(c.IsFamily()||!h.IsSelectAll())p=l.indexOf(e);e=Math.ceil(g/m);g%=m;0===g||p<g?(p*=e,g=e):(p=g*e+(p-g)*(e-1),g=e-1);for(let x=p,v=
|
|
p+g;x<v;++x)yield f[x]}FinishCondition(e){this._sdkType.FinishCondition(e)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var e=this.GetCurrentSol(),c=e._GetOwnInstances(),f=e.IsSelectAll(),g=this._runtime.GetCurrentEventStackFrame();g=g&&g.GetCurrentEvent()&&g.GetCurrentEvent().IsOrBlock();for(const m of this._container.objectTypes())if(m!==this){m._UpdateIIDs();var h=m.GetCurrentSol();h._SetSelectAll(f);if(!f){var l=h._GetOwnInstances();d.clearArray(l);for(const p of c)l.push(m.GetInstanceByIID(p.GetIID()));
|
|
if(g){l=e._GetOwnElseInstances();h=h._GetOwnElseInstances();d.clearArray(h);for(const p of l)h.push(m.GetInstanceByIID(p.GetIID()))}}}}}_TruncateContainerSols(e,c){for(const f of this.GetContainer().objectTypes()){const g=f.GetCurrentSol();e?d.truncateArray(g._GetOwnElseInstances(),c):d.truncateArray(g._GetOwnInstances(),c)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(e){this._anyCollisionCellChanged=!!e}_SetAnyInstanceParallaxed(e){this._anyInstanceParallaxed=!!e}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&
|
|
this._isWorldType){for(const e of this._instances)e.GetWorldInfo()._UpdateCollisionCell();for(const e of this._runtime._GetInstancesPendingCreate())e.GetObjectClass()===this&&e.GetWorldInfo()._UpdateCollisionCell();this._anyCollisionCellChanged=!1}}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}HasSolidBehavior(){return this.UsesBehaviorByCtor(d.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(d.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(d.Behaviors.Persist)}_SaveToJson(){const e=
|
|
{instances:this._instances.map(c=>c.SaveToJson())};this._savedData&&this._savedData.size&&(e.ex=d.ToSuperJSON(this._savedData));return e}_LoadFromJson(e){this._savedData&&(this._savedData.clear(),this._savedData=null);var c=e.ex;c&&(this._savedData=d.FromSuperJSON(c));c=this._instances;e=e.instances;for(let f=0,g=Math.min(c.length,e.length);f<g;++f)c[f].LoadFromJson(e[f]);for(let f=e.length,g=c.length;f<g;++f)this._runtime.DestroyInstance(c[f]);for(let f=c.length,g=e.length;f<g;++f){c=e[f];let h=
|
|
null;if(this.IsWorldType()&&(h=this._runtime.GetMainRunningLayout().GetLayerBySID(c.w.l),!h))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,h,!1,0,0,!0).LoadFromJson(c)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(e){this._instanceUserScriptClass=e}DispatchUserScriptEvent(e){var c=this._runtime;(c=
|
|
c.IsDebug()&&!c.GetEventSheetManager().IsInEventEngine())&&a.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(e);c&&a.AddScriptTime()}}}
|
|
{"use strict";const d=self.C3;d.Container=class extends d.DefendedBase{constructor(a,b){super();this._runtime=a;this._objectTypes=b;for(const e of this._objectTypes)e._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(a=>a.IsWorldType())}}}
|
|
{"use strict";const d=self.C3,a=self.C3Debugger,b=self.IInstance,e=[];let c=0;const f=new WeakMap,g=new WeakMap;d.Instance=class extends d.DefendedBase{constructor(h){super();this._runtime=h.runtime;this._objectType=h.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=h.uid;this._puid=c++;this._flags=0;this._behaviorInstances=this._instVarValues=e;var l=this._objectType.GetBehaviorTypesIncludingInherited();0<l.length&&(this._behaviorInstances=l.map((m,p)=>d.New(d.BehaviorInstance,
|
|
{runtime:this._runtime,behaviorType:m,instance:this,index:p})));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=d.New(d.WorldInfo,this,h.layer),h.worldData)this._worldInfo.Init(h.worldData);else{this._worldInfo.InitNoData();const [m,p]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(m,p);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}h.instVarData?
|
|
this._LoadInstanceVariableData(h.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var h of this._behaviorInstances)h.Release();d.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(h=f.get(this))h.clear(),f.delete(this);if(h=g.get(this))h.clear(),g.delete(this);this._siblings&&d.clearArray(this._siblings);this._dispatcher&&(this._dispatcher.Release(),
|
|
this._dispatcher=null);this._objectType=this._runtime=null;0<this._instVarValues.length&&d.clearArray(this._instVarValues);this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(h){0<h.length&&(this._instVarValues=[],d.shallowAssignArray(this._instVarValues,h))}_LoadDefaultInstanceVariables(){const h=this._objectType.GetInstanceVariablesCount();if(0!==h){this._instVarValues=[];var l=[0,0,""];for(let m=0;m<h;++m)this._instVarValues.push(l[this._objectType.GetInstanceVariableType(m)])}}_CreateSdkInstance(h,
|
|
l){if(this._sdkInst)throw Error("already got sdk instance");for(let m=0,p=this._behaviorInstances.length;m<p;++m)this._behaviorInstances[m]._CreateSdkInstance(l?l[m]:null);this._sdkInst=d.New(this._objectType.GetInstanceSdkCtor(),this,h);if(!(this._sdkInst instanceof d.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let m=0,p=this._behaviorInstances.length;m<p;++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 h=
|
|
this._timeScale;return-1===h?this.GetRuntime().GetTimeScale():h}SetTimeScale(h){h=+h;if(0>h||!isFinite(h))h=0;this._timeScale=h}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=d.New(d.Event.Dispatcher));return this._dispatcher}Draw(h){this._sdkInst.Draw(h)}OnCreate(h){this._sdkInst.OnCreate(h)}_SetHasTilemap(){this._flags|=2}HasTilemap(){return 0!==(this._flags&2)}_MarkDestroyed(){this._flags|=1}IsDestroyed(){return 0!==(this._flags&1)}MustPreDraw(){return 0!==
|
|
(this._flags&4)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(h){this._flags=h?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(h){this._flags=h?this._flags|16:this._flags&-17}SetFlag(h,l){h<<=16;this._flags=l?this._flags|h:this._flags&~h}GetFlag(h){return 0!==(this._flags&h<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetImagePoint(h){return this._sdkInst.GetImagePoint(h)}GetObjectClass(){return this._objectType}BelongsToObjectClass(h){return h.IsFamily()?
|
|
h.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===h}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw Error("object does not support scene graph");}HasParent(){return null!==this.GetParent()}GetParent(){var h=this.GetWorldInfo();return h?(h=h.GetParent())?h.GetInstance():null:null}GetTopParent(){var h=this.GetWorldInfo();return h?(h=h.GetTopParent())?h.GetInstance():null:null}*parents(){const h=this.GetWorldInfo();if(h)for(const l of h.parents())yield l.GetInstance()}HasChildren(){const h=
|
|
this.GetWorldInfo();return h?h.HasChildren():!1}GetChildren(){const h=this.GetWorldInfo();return h?h.GetChildren().map(l=>l.GetInstance()):[]}*children(){const h=this.GetWorldInfo();if(h)for(const l of h.children())yield l.GetInstance()}*allChildren(){const h=this.GetWorldInfo();if(h)for(const l of h.allChildren())yield l.GetInstance()}GetChildCount(){const h=this.GetWorldInfo();return h?h.GetChildCount():0}GetChildAt(h){const l=this.GetWorldInfo();return l?(h=l.GetChildAt(h))?h.GetInstance():null:
|
|
null}AddChild(h,l){this.VerifySupportsSceneGraph();h.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(h.GetWorldInfo(),l||{})}RemoveChild(h){const l=this.GetWorldInfo();l&&l.RemoveChild(h.GetWorldInfo())}GetDestroyWithParent(){const h=this.GetWorldInfo();return h?h.GetDestroyWithParent():!1}SetupInitialSceneGraphConnections(){var h=this.GetWorldInfo();if(h&&(h=h.GetSceneGraphChildrenExportData()))for(const l of h)if(h=this._runtime.GetInstanceByUID(l[2])){const m=l[3];this.AddChild(h,{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(h){this._siblings.push(h)}GetSiblings(){return this._siblings}HasSibling(h){return!!this.GetSibling(h)}GetSibling(h){const l=this.siblings();if(null===l||0===l.length)return!1;for(const m of l)if(m.GetObjectClass()===h)return m;return null}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const h of this.siblings())h.GetObjectClass().GetCurrentSol().SetSinglePicked(h)}_PushSiblingsToSolInstances(){for(const h of this.siblings())h.GetObjectClass().GetCurrentSol()._PushInstance(h)}_SetSiblingsToSolInstancesIndex(h){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnInstances()[h]=
|
|
l}_PushSiblingsToSolElseInstances(){for(const h of this.siblings())h.GetObjectClass().GetCurrentSol()._PushElseInstance(h)}_SetSiblingsToSolElseInstancesIndex(h){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[h]=l}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(h){this._iid=h}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(h){if(!h)return null;
|
|
for(const l of this._behaviorInstances)if(l.GetBehavior()instanceof h)return l;return null}GetBehaviorSdkInstanceFromCtor(h){return h?(h=this.GetBehaviorInstanceFromCtor(h))?h.GetSdkInstance():null:null}GetBehaviorIndexBySID(h){const l=this._behaviorInstances;for(let m=0,p=l.length;m<p;++m)if(l[m].GetBehaviorType().GetSID()===h)return m;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(h){h|=
|
|
0;const l=this._instVarValues;if(0>h||h>=l.length)throw new RangeError("invalid instance variable");return l[h]}_GetInstanceVariableValueUnchecked(h){return this._instVarValues[h]}_GetInstanceVariableTypedValue(h){const l=this._instVarValues[h];return 0===this._objectType.GetInstanceVariableType(h)?!!l:l}SetInstanceVariableValue(h,l){h|=0;const m=this._instVarValues;if(0>h||h>=m.length)throw new RangeError("invalid instance variable");switch(this._objectType.GetInstanceVariableType(h)){case 0:m[h]=
|
|
l?1:0;break;case 1:m[h]="number"===typeof l?l:parseFloat(l);break;case 2:m[h]="string"===typeof l?l:l.toString();break;default:throw Error("unknown instance variable type");}}SetInstanceVariableOffset(h,l){if(0!==l){h|=0;var m=this._instVarValues;if(0>h||h>=m.length)throw new RangeError("invalid instance variable");var p=m[h];if("number"===typeof p)m[h]="number"===typeof l?m[h]+l:m[h]+parseFloat(l);else{if("boolean"===typeof p)throw Error("can not set offset of boolean variable");if("string"===typeof p)throw Error("can not set offset of string variable");
|
|
throw Error("unknown instance variable type");}}}GetSavedDataMap(){let h=f.get(this);if(h)return h;h=new Map;f.set(this,h);return h}GetUnsavedDataMap(){let h=g.get(this);if(h)return h;h=new Map;g.set(this,h);return h}_HasAnyCreateDestroyHandler(h){const l=this.GetObjectClass();if(l.UserScriptDispatcher().HasAnyHandlerFor(h))return!0;for(const m of l.GetFamilies())if(m.UserScriptDispatcher().HasAnyHandlerFor(h))return!0;return this._runtime.UserScriptDispatcher().HasAnyHandlerFor(h)?!0:!1}_TriggerOnCreatedOnSelfAndRelated(){const h=
|
|
new Set;h.add(this);const l=this.GetWorldInfo();if(l&&l.HasChildren())for(const m of this.allChildren())if(h.add(m),m.IsInContainer())for(const p of m.siblings())h.add(p);if(this.IsInContainer())for(const m of this.siblings())h.add(m);for(const m of h.values())m._TriggerOnCreated()}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const h=this.GetObjectClass(),l=new d.Event("instancecreate");l.instance=this.GetInterfaceClass();h.DispatchUserScriptEvent(l);for(const m of h.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(h){if(this._iScriptInterface){var l=new d.Event("destroy");l.isEndingLayout=h;this.DispatchUserScriptEvent(l)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){l=this.GetObjectClass();var m=new d.Event("instancedestroy");m.instance=this.GetInterfaceClass();
|
|
m.isEndingLayout=h;l.DispatchUserScriptEvent(m);for(const p of l.GetFamilies())p.DispatchUserScriptEvent(m);this._runtime.DispatchUserScriptEvent(m)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(h="full"){const l={};"full"===h?l.uid=this.GetUID():l.c3=!0;if("visual-state"!==h){var m=f.get(this);m&&m.size&&(l.ex=d.ToSuperJSON(m));-1!==this.GetTimeScale()&&(l.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){m={};var p=this._objectType.GetInstanceVariableSIDs();
|
|
for(let x=0,v=this._instVarValues.length;x<v;++x)m[p[x].toString()]=this._instVarValues[x];l.ivs=m}if(this._behaviorInstances.length){m={};for(const x of this._behaviorInstances)(p=x.SaveToJson())&&(m[x.GetBehaviorType().GetSID().toString()]=p);l.behs=m}}this._worldInfo&&(l.w=this._worldInfo._SaveToJson(h));(h=this._sdkInst.SaveToJson())&&(l.data=h);return l}_OnBeforeLoad(h="full"){this._worldInfo&&this._worldInfo._OnBeforeLoad(h)}LoadFromJson(h,l="full"){if("full"===l)this._uid=h.uid;else if(!h.c3)return;
|
|
if("visual-state"!==l){var m=f.get(this);m&&(m.clear(),f.delete(this));if(m=h.ex)m=d.FromSuperJSON(m),f.set(this,m);this._timeScale=h.hasOwnProperty("mts")?h.mts:-1;if(m=h.ivs)for(const [v,r]of Object.entries(m))if(m=parseInt(v,10),m=this._objectType.GetInstanceVariableIndexBySID(m),!(0>m||m>=this._instVarValues.length)){var p=r;null===p&&(p=NaN);this._instVarValues[m]=p}}if(this.GetPlugin().IsWorldType()){m=h.w;var x=m.l;this._worldInfo.GetLayer().GetSID()!==x&&(p=this._worldInfo.GetLayer(),(x=p.GetLayout().GetLayerBySID(x))?
|
|
(this._worldInfo._SetLayer(x),p._RemoveInstance(this,!0),x._AddInstance(this,!0),x.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===l&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(m,l)}if("visual-state"!==l&&(l=h.behs))for(const [v,r]of Object.entries(l))l=parseInt(v,10),l=this.GetBehaviorIndexBySID(l),0>l||l>=this._behaviorInstances.length||this._behaviorInstances[l].LoadFromJson(r);(h=h.data)&&this._sdkInst.LoadFromJson(h)}GetInterfaceClass(){return this._iScriptInterface||
|
|
this._InitUserScriptInterface()}_InitUserScriptInterface(){var h=this._worldInfo?self.IWorldInstance:b;const l=this._sdkInst.GetScriptInterfaceClass(),m=this._objectType._GetUserScriptInstanceClass(),p=m||l||h;b._Init(this);this._iScriptInterface=new p;b._Init(null);if(l&&!(this._iScriptInterface instanceof h))throw new TypeError(`script interface class '${l.name}' does not extend the right base class '${h.name}'`);if(m&&(h=l||h,!(this._iScriptInterface instanceof h)))throw new TypeError(`setInstanceClass(): class '${m.name}' does not extend the right base class '${h.name}'`);
|
|
return this._iScriptInterface}_GetInstVarsScriptDescriptor(h){if(0!==this._instVarValues.length){var l={},m=this._objectType._GetAllInstanceVariableJsPropNames();for(let p=0,x=m.length;p<x;++p)l[m[p]]={configurable:!1,enumerable:!0,get:d.Instance.prototype._GetInstanceVariableTypedValue.bind(this,p),set:d.Instance.prototype.SetInstanceVariableValue.bind(this,p)};l=Object.create(Object.prototype,l);h.instVars={value:l,writable:!1}}}_GetBehaviorsScriptDescriptor(h){var l=this._behaviorInstances;if(0!==
|
|
l.length){var m={};for(const p of l)m[p.GetBehaviorType().GetJsPropName()]={value:p.GetScriptInterface(),writable:!1};l=Object.create(Object.prototype,m);h.behaviors={value:l,writable:!1}}}DispatchUserScriptEvent(h){h.instance=this.GetInterfaceClass();var l=this._runtime;(l=l.IsDebug()&&!l.GetEventSheetManager().IsInEventEngine())&&a.StartMeasuringScriptTime();this.GetInterfaceClass().dispatchEvent(h);l&&a.AddScriptTime()}}}
|
|
{"use strict";const d=self.C3;d.SceneGraphInfo=class extends d.DefendedBase{constructor(a){super();this._owner=a;this._parent=null;this._children=[];this._startWidth=a.GetWidth();this._startHeight=a.GetHeight();this._startScaleY=this._startScaleX=1;this._parentStartAngle=0}Release(){this._parent=null;d.clearArray(this._children)}SetParent(a){this._parentStartAngle=(this._parent=a)?a.GetAngle():0}GetParent(){return this._parent}HasChildren(){return 0<this._children.length}GetChildren(){return this._children}GetStartScaleX(){return this._startScaleX}SetStartScaleX(a){this._startScaleX=
|
|
a}GetStartScaleY(){return this._startScaleY}SetStartScaleY(a){this._startScaleY=a}_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(a=>{let b="";a.GetTransformWithParentX()&&(b+="x");a.GetTransformWithParentY()&&(b+="y");a.GetTransformWithParentWidth()&&(b+="w");a.GetTransformWithParentHeight()&&(b+="h");a.GetTransformWithParentAngle()&&(b+="a");a.GetTransformWithParentZElevation()&&(b+="z");a.GetDestroyWithParent()&&(b+="d");return{uid:a.GetInstance().GetUID(),f:b}})}}_LoadFromJson(a){this._startWidth=a.sw;this._startHeight=
|
|
a.sh;this._startScaleX=a.sx;this._startScaleY=a.sy;this._parentStartAngle=a.psa}_OnAfterLoad(a){const b=this._owner,e=b.GetRuntime();for(const c of a.c){a=e.GetInstanceByUID(c.uid).GetWorldInfo();const f=c.f,g={};g.transformX=f.includes("x");g.transformY=f.includes("y");g.transformWidth=f.includes("w");g.transformHeight=f.includes("h");g.transformAngle=f.includes("a");g.transformZElevation=f.includes("z");g.destroyWithParent=f.includes("d");b.AddChild(a,g)}}}}
|
|
{"use strict";const d=self.C3,a=self.glMatrix,b=a.vec3,e=a.vec4,c=d.New(d.Rect),f=d.New(d.Quad),g=d.New(d.Event,"bboxchange",!1),h=d.New(d.Color,0,0,0,0),l=d.New(d.CollisionPoly),m=d.New(d.Color,1,1,1,1),p=d.New(d.Rect,0,0,-1,-1),x=d.New(d.Rect,0,0,-1,-1),v=new Set(["absolute","relative"]),r=[],q=b.create(),y=e.create();let u=!0;d.WorldInfo=class extends d.DefendedBase{constructor(t,A){super();this._inst=t;this._objectClass=t.GetObjectClass();this._runtime=t.GetRuntime();this._layer=A;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=d.New(d.Rect);this._boundingQuad=d.New(d.Quad);this._collisionCells=x;this._renderCells=p;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=m;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&
|
|
(this._instanceEffectList=d.New(d.InstanceEffectList,this._inst,this));this._sceneGraphInfo=null;this._sceneGraphFlagsExportData=NaN;this._sceneGraphChildrenExportData=null;this._sceneGraphZIndex=this._sceneGraphZIndexExportData=NaN;this._meshInfo=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 t=[...this.GetChildren()];for(const A of t)this.RemoveChild(A)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(t){u=!1;this.SetXY(t[0],t[1]);this.SetZElevation(t[2]);this.SetSize(t[3],t[4]);this._depth=0;this.IsRotatable()?this.SetAngle(t[6]):
|
|
this._a=0;h.setFromJSON(t[7]);this._SetColor(h);this.SetOriginX(t[8]);this.SetOriginY(t[9]);this.SetBlendMode(t[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(t[12]);t[14]&&(this._sceneGraphFlagsExportData=t[14][0],this._sceneGraphChildrenExportData=t[14][1],this._sceneGraphZIndexExportData=t[14][2]);if(t[15]){var A=t[15];this.CreateMesh(A[0],A[1]);t=this.GetSourceMesh();A=A[2];for(let z=0,C=A.length;z<C;++z){const E=A[z];for(let J=0,G=E.length;J<G;++J){const I=E[J],
|
|
L=t.GetMeshPointAt(J,z);L.SetX(I[0]);L.SetY(I[1]);L.SetZElevation(I[2]);L.SetU(I[3]);L.SetV(I[4])}}}u=!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(t){t=+t;if(this.GetTransformWithParentX()){const A=this._sceneGraphInfo;t-=this.GetX();const z=-this._GetParentOffsetAngle();0===z?this._x+=t/A.GetParentScaleX():(this._x+=Math.cos(z)*t/A.GetParentScaleX(),this.GetTransformWithParentY()&&(this._y+=Math.sin(z)*t/A.GetParentScaleY()))}else this._x=t}OffsetX(t){t=+t;this.GetTransformWithParentX()?this.SetX(this.GetX()+t):this._x+=t}GetX(){if(this.GetTransformWithParentX()){let t=this._x;const A=this._sceneGraphInfo,
|
|
z=this.GetParent(),C=this._GetParentOffsetAngle();0===C?t*=A.GetParentScaleX():(t=t*A.GetParentScaleX()*Math.cos(C),this.GetTransformWithParentY()&&(t-=this._y*A.GetParentScaleY()*Math.sin(C)));return z.GetX()+t}return this._x}SetY(t){t=+t;if(this.GetTransformWithParentY()){const A=this._sceneGraphInfo;t-=this.GetY();const z=-this._GetParentOffsetAngle();0===z?this._y+=t/A.GetParentScaleY():(this.GetTransformWithParentX()&&(this._x-=Math.sin(z)*t/A.GetParentScaleX()),this._y+=Math.cos(z)*t/A.GetParentScaleY())}else this._y=
|
|
t}OffsetY(t){t=+t;this.GetTransformWithParentY()?this.SetY(this.GetY()+t):this._y+=t}GetY(){if(this.GetTransformWithParentY()){let t=this._y;const A=this._sceneGraphInfo,z=this.GetParent(),C=this._GetParentOffsetAngle();0===C?t*=A.GetParentScaleY():(t=t*A.GetParentScaleY()*Math.cos(C),this.GetTransformWithParentX()&&(t+=this._x*A.GetParentScaleX()*Math.sin(C)));return z.GetY()+t}return this._y}SetXY(t,A){t=+t;A=+A;if(this.GetTransformWithParentXOrY()){const C=this.GetTransformWithParentX(),E=this.GetTransformWithParentY(),
|
|
J=this._sceneGraphInfo,G=t-this.GetX(),I=A-this.GetY();var z=-this._GetParentOffsetAngle();if(0===z)this._x=C?this._x+G/J.GetParentScaleX():t,this._y=E?this._y+I/J.GetParentScaleY():A;else{const L=Math.sin(z);z=Math.cos(z);this._x=C?E?this._x+(z*G-L*I)/J.GetParentScaleX():this._x+z*G/J.GetParentScaleX():t;this._y=E?C?this._y+(L*G+z*I)/J.GetParentScaleY():this._y+z*I/J.GetParentScaleY():A}}else this._x=t,this._y=A}OffsetXY(t,A){t=+t;A=+A;this.GetTransformWithParentXOrY()?this.SetXY(this.GetX()+t,this.GetY()+
|
|
A):(this._x+=t,this._y+=A)}EqualsXY(t,A){return this.GetX()===t&&this.GetY()===A}SetZElevation(t){t=+t;this.GetTransformWithParentZElevation()&&(t-=this.GetParent().GetZElevation());this._zElevation!==t&&(this._zElevation=t,this._UpdateZElevation(),t=this.GetLayer(),0!==this._zElevation&&t._SetAnyInstanceZElevated(),t.SetZIndicesChanged())}_UpdateZElevation(){this._UpdateRendererStateGroup();if(this.HasChildren()){const t=this.GetChildren();for(let A=0,z=t.length;A<z;A++){const C=t[A];C.GetTransformWithParentZElevation()&&
|
|
C._UpdateZElevation()}}}OffsetZElevation(t){this.SetZElevation(this.GetZElevation()+t)}GetZElevation(){return this.GetTransformWithParentZElevation()?this.GetParent().GetZElevation()+this._zElevation:this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(t){t=+t;this.GetTransformWithParentWidth()?this._w*=t/this.GetWidth():this._w=t}OffsetWidth(t){t=+t;this.GetTransformWithParentWidth()?this.SetWidth(this.GetWidth()+t):this._w+=t}GetWidth(){return this.GetTransformWithParentWidth()?
|
|
this.GetParent().GetWidth()*this._w:this._w}SetHeight(t){t=+t;this.GetTransformWithParentHeight()?this._h*=t/this.GetHeight():this._h=t}OffsetHeight(t){t=+t;this.GetTransformWithParentHeight()?this.SetHeight(this.GetHeight()+t):this._h+=t}GetHeight(){return this.GetTransformWithParentHeight()?this.GetParent().GetHeight()*this._h:this._h}SetSize(t,A){t=+t;A=+A;this.GetTransformWithParentWidth()?this._w*=t/this.GetWidth():this._w=t;this.GetTransformWithParentHeight()?this._h*=A/this.GetHeight():this._h=
|
|
A}GetDepth(){return this._depth}SetDepth(t){if(0>t)throw new RangeError("invalid depth");this._depth=t}GetSceneGraphScale(){if(this.HasParent()){const t=this._sceneGraphInfo;return Math.min(t.GetParentScaleX(),t.GetParentScaleY())}return 1}IsRotatable(){return 0!==(this._flags&128)}SetAngle(t){t=+t;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(t-=this.GetParent().GetAngle()),t=d.clampAngle(t),this._a!==t&&(this._a=t,this._MarkSinCosAngleChanged()))}OffsetAngle(t){t=+t;0!==t&&this.IsRotatable()&&
|
|
(this._a=d.clampAngle(this._a+t),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|=262144;if(this.HasChildren()){const t=this.GetChildren();for(let A=0,z=t.length;A<z;A++)t[A]._MarkSinCosAngleChanged()}}GetAngle(){return this.GetTransformWithParentAngle()?d.clampAngle(this.GetParent().GetAngle()+this._a):this._a}_MaybeUpdateSinCosAngle(){const t=this._flags;if(0!==(t&262144)){var A=this.GetAngle();this._sinA=Math.sin(A);this._cosA=Math.cos(A);this._flags=t&-262145}}GetSinAngle(){this._MaybeUpdateSinCosAngle();
|
|
return this._sinA}GetCosAngle(){this._MaybeUpdateSinCosAngle();return this._cosA}SetOriginX(t){this._ox=+t}OffsetOriginX(t){this._ox+=+t}GetOriginX(){return this._ox}SetOriginY(t){this._oy=+t}OffsetOriginY(t){this._oy+=+t}GetOriginY(){return this._oy}_SetColor(t){this._color.equals(t)||(this._color===m?(this._color=d.New(d.Color,t),this._colorPremultiplied=d.New(d.Color,t),this._colorPremultiplied.premultiply()):t.equalsRgba(1,1,1,1)?this._colorPremultiplied=this._color=m:(this._color.set(t),this._colorPremultiplied.set(t),
|
|
this._colorPremultiplied.premultiply()),this._UpdateRendererStateGroup())}SetOpacity(t){t=d.clamp(+t,0,1);this._color.a!==t&&(h.copyRgb(this._color),h.a=t,this._SetColor(h))}OffsetOpacity(t){this.SetOpacity(this.GetOpacity()+t)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(t){this._color.equalsIgnoringAlpha(t)||(h.copyRgb(t),h.a=this._color.a,this._SetColor(h))}SetUnpremultipliedColorRGB(t,A,z){h.setRgb(t,A,z);this.SetUnpremultipliedColor(h)}OffsetUnpremultipliedColorRGB(t,A,z){if(0!==
|
|
t||0!==A||0!==z)h.copyRgb(this._color),h.r+=t,h.g+=A,h.b+=z,this.SetUnpremultipliedColor(h)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}GetDestroyWithParent(){return 0!==(this._flags&512)}SetDestroyWithParent(t){this._SetFlag(512,t)}GetTransformWithParentX(){return 0!==(this._flags&1024)}SetTransformWithParentX(t){this._SetFlag(1024,t)}GetTransformWithParentY(){return 0!==(this._flags&2048)}GetTransformWithParentXOrY(){return 0!==(this._flags&
|
|
3072)}SetTransformWithParentY(t){this._SetFlag(2048,t)}GetTransformWithParentWidth(){return 0!==(this._flags&4096)}SetTransformWithParentWidth(t){this._SetFlag(4096,t)}GetTransformWithParentHeight(){return 0!==(this._flags&8192)}SetTransformWithParentHeight(t){this._SetFlag(8192,t)}GetTransformWithParentAngle(){return 0!==(this._flags&16384)}SetTransformWithParentAngle(t){this._SetFlag(16384,t)}GetTransformWithParentZElevation(){return 0!==(this._flags&32768)}SetTransformWithParentZElevation(t){this._SetFlag(32768,
|
|
t)}_ClearAllSceneGraphFlags(){this._flags&=-65025}AddChild(t,A){if(t!==this&&!t.HasParent()&&!this._HasChildRecursive(t)&&!this._HasAnyParent(t)){var z=t.GetX(),C=t.GetY(),E=t.GetWidth(),J=t.GetHeight(),G=t.GetAngle(),I=t.GetZElevation();t._SetParent(this);t.SetTransformWithParentX(A.transformX);t.SetTransformWithParentY(A.transformY);t.SetTransformWithParentWidth(A.transformWidth);t.SetTransformWithParentHeight(A.transformHeight);t.SetTransformWithParentAngle(A.transformAngle);t.SetTransformWithParentZElevation(A.transformZElevation);
|
|
t.SetDestroyWithParent(A.destroyWithParent);A.transformX&&(t._x=z-this.GetX(),A.transformWidth&&(t._x/=this.GetWidth()/this._sceneGraphInfo._GetStartWidth()));A.transformY&&(t._y=C-this.GetY(),A.transformHeight&&(t._y/=this.GetHeight()/this._sceneGraphInfo._GetStartHeight()));A.transformWidth&&(t._w=E/this.GetWidth(),t._sceneGraphInfo.SetStartScaleX(t._w));A.transformHeight&&(t._h=J/this.GetHeight(),t._sceneGraphInfo.SetStartScaleY(t._h));A.transformAngle&&(t._a=G-this.GetAngle());A.transformZElevation&&
|
|
(t._zElevation=I-this.GetZElevation());this._AddChildToSceneGraphInfo(t);this.SetBboxChanged()}}RemoveChild(t){if(t.GetParent()===this){var A=t.GetX(),z=t.GetY(),C=t.GetWidth(),E=t.GetHeight(),J=t.GetAngle(),G=t.GetZElevation();t._SetParent(null);t._ClearAllSceneGraphFlags();t.SetXY(A,z);t.SetSize(C,E);t.SetAngle(J);t.SetZElevation(G);this._RemoveChildFromSceneGraphInfo(t);this.SetBboxChanged()}}_ResetAllSceneGraphState(){for(var t of this.children())this.RemoveChild(t);(t=this.GetParent())&&t.RemoveChild(this);
|
|
this._ClearAllSceneGraphFlags()}HasParent(){return null!==this.GetParent()}GetParent(){const t=this._sceneGraphInfo;return null!==t?t.GetParent():null}GetTopParent(){let t=this;for(;t.HasParent();)t=t.GetParent();return t}*parents(){let t=this.GetParent();for(;t;)yield t,t=t.GetParent()}HasChild(t){return this.GetChildren().includes(t)}HasChildren(){const t=this._sceneGraphInfo;return null!==t?t.HasChildren():!1}GetChildren(){const t=this._sceneGraphInfo;return null!==t?t.GetChildren():r}children(){return this.GetChildren()}*allChildren(){for(const t of this.children())yield t,
|
|
yield*t.allChildren()}GetChildCount(){return this.GetChildren().length}GetChildAt(t){const A=this.GetChildren();t=Math.floor(+t);return 0>t||t>=A.length?null:A[t]}_CreateSceneGraphInfo(t){this._sceneGraphInfo||(this._sceneGraphInfo=d.New(d.SceneGraphInfo,this));t&&this._sceneGraphInfo.SetParent(t)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&&(this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(t){t?(t._CreateSceneGraphInfo(null),
|
|
this._CreateSceneGraphInfo(t)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(t){if(!this.HasParent())return!1;const A=this.GetParent();return A===t?!0:A._HasAnyParent(t)}_HasChildRecursive(t){if(this.HasChild(t))return!0;for(const A of this.GetChildren())if(A._HasChildRecursive(t))return!0;return!1}_AddChildToSceneGraphInfo(t){this._sceneGraphInfo.GetChildren().push(t)}_RemoveChildFromSceneGraphInfo(t){const A=this._sceneGraphInfo.GetChildren(),
|
|
z=A.indexOf(t);-1!==z&&A.splice(z,1);0!==A.length||this.HasParent()||this._ReleaseSceneGraphInfo();t.HasChildren()||t._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){return this._sceneGraphChildrenExportData}GetSceneGraphZIndexExportData(){return this._sceneGraphZIndexExportData}GetSceneGraphZIndex(){return this._sceneGraphZIndex}SetSceneGraphZIndex(t){this._sceneGraphZIndex=t}SetUsePointsShaderProgram(){this._SetFlag(524288,!0);this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(u){var t=
|
|
this._runtime.GetRenderer();this._stateGroup&&t.ReleaseStateGroup(this._stateGroup);var A=0!==(this._flags&524288)?t.GetPointsRenderingProgram()||"<point>":t.GetTextureFillShaderProgram()||"<default>";this._stateGroup=t.AcquireStateGroup(A,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===m}SetBlendMode(t){t|=0;if(0>t||31<t)throw new RangeError("invalid blend mode");this.GetBlendMode()!==t&&(this._flags=
|
|
this._flags&-2080374785|t<<26,this._UpdateRendererStateGroup())}GetBlendMode(){return(this._flags&2080374784)>>26}_SetLayer(t){this._layer=t;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(t){this._zIndex=t|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(t,A){this._flags=A?this._flags|t:this._flags&~t}IsVisible(){return 0!==(this._flags&
|
|
1)}SetVisible(t){this._SetFlag(1,t)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(t){t=!!t;this.IsCollisionEnabled()!==t&&(this._SetFlag(8,t),t?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(t,A){this._SetFlag(32,t);this._solidFilterTags&&this._solidFilterTags.clear();if(A.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const z of A.split(" "))z&&this._solidFilterTags.add(z.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(t){const A=
|
|
0!==(this._flags&32),z=this._solidFilterTags;if(!t||!z)return!A;for(const C of z)if(t.has(C))return A;return!A}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(g);if(null!==this._sceneGraphInfo){const t=this._sceneGraphInfo.GetChildren();for(let A=
|
|
0,z=t.length;A<z;++A)t[A].SetBboxChanged()}}CalculateBbox(t,A,z){const C=this.GetX(),E=this.GetY(),J=this.GetWidth(),G=this.GetHeight(),I=this.GetAngle();t.setWH(C-this._ox*J,E-this._oy*G,J,G);z&&this.HasMesh()&&this._ExpandBboxForMesh(t);0===I?A.setFromRect(t):(t.offset(-C,-E),A.setFromRotatedRectPrecalc(t,this.GetSinAngle(),this.GetCosAngle()),A.offset(C,E),A.getBoundingBox(t));t.normalize()}_UpdateBbox(){const t=this._flags;0!==(t&2)&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),
|
|
this._flags=t&-3)}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(t){var A=this.GetX(),z=this.GetY();A=Math.round(A)-A;z=Math.round(z)-z;if(0===A&&0===z)return t;f.copy(t);f.offset(A,z);return f}OverwriteBoundingBox(t){this._boundingBox.copy(t);this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell();this._UpdateRenderCell()}SetBboxChangeEventEnabled(t){this._SetFlag(4,t)}IsBboxChangeEventEnabled(){return 0!==
|
|
(this._flags&4)}IsInViewport(t,A){return A&&0!==this.GetDepth()?this._IsInViewport_3D():0===this.GetZElevation()?t.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const t=this.GetLayer(),A=this.GetTotalZElevation();if(A>=t.GetCameraZ())return!1;t.GetViewportForZ(A,c);return c.intersectsRect(this.GetBoundingBox())}_IsInViewport_3D(){var t=this.GetBoundingBox();const A=t.getLeft(),z=t.getRight(),C=t.getTop();t=t.getBottom();const E=this.GetTotalZElevation(),
|
|
J=E+this.GetDepth();return this.GetLayer()._GetViewFrustum().ContainsAABB(A,C,E,z,t,J)}_ProjectToUnitViewport(t,A,z,C,E){q[0]=NaN;q[1]=NaN;d.Gfx.Project(z,C,E,A,t,y,q);return[q[0],q[1]]}SetSourceCollisionPoly(t){this._sourceCollisionPoly=t;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(t,A,z){let C=0,E=1;0!==z&&(C=Math.sin(z),E=Math.cos(z));return this._GetCustomTransformedCollisionPolyPrecalc(t,A,z,C,E)}_GetCustomTransformedCollisionPolyPrecalc(t,A,z,C,E){let J=this._transformedPolyInfo;null===J&&(this._transformedPolyInfo=J={poly:d.New(d.CollisionPoly),width:NaN,height:NaN,angle:NaN});const G=J.poly;if(J.width===t&&J.height===A&&J.angle===z)return G;const I=this._sourceCollisionPoly;
|
|
if(this.HasMesh()){const L=this.GetOriginX(),N=this.GetOriginY(),S=this.GetSourceMesh();let X=this._meshInfo.meshPoly;X||(I?(l.copy(I),l.offset(L,N)):l.setDefaultPoints(),X=S.InsertPolyMeshVertices(l),this._meshInfo.meshPoly=X);S.TransformCollisionPoly(X,G);G.offset(-L,-N);G.transformPrecalc(t,A,C,E)}else I?(G.copy(I),G.transformPrecalc(t,A,C,E)):G.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());J.width=t;J.height=A;J.angle=z;return G}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);
|
|
const t=this._transformedPolyInfo;null!==t&&(t.width=NaN)}CreateMesh(t,A){t=Math.floor(t);A=Math.floor(A);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:d.New(d.Gfx.Mesh,t,A),transformedMesh:d.New(d.Gfx.Mesh,t,A),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(t){this._SetFlag(65536,t)}IsMeshChanged(){return 0!==(this._flags&65536)}SetPhysicsBodyChanged(t){this._SetFlag(131072,t)}IsPhysicsBodyChanged(){return 0!==(this._flags&131072)}_ExpandBboxForMesh(t){var A=this._meshInfo.sourceMesh;const z=Math.min(A.GetMinX(),0),C=Math.min(A.GetMinY(),0),E=Math.max(A.GetMaxX(),1);A=Math.max(A.GetMaxY(),1);const J=t.width(),G=t.height();t.offsetLeft(z*J);t.offsetTop(C*G);t.offsetRight((E-1)*J);t.offsetBottom((A-
|
|
1)*G)}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(t,A,z){t=Math.floor(t);A=Math.floor(A);var C=z.mode||"absolute";if(!v.has(C))throw Error("invalid mode");C="relative"===C;let E=z.x,J=z.y;const G=z.zElevation;let I="number"===typeof z.u?z.u:C?0:-1;z="number"===typeof z.v?z.v:C?0:-1;if(!this.HasMesh())return!1;const L=this.GetSourceMesh(),N=L.GetMeshPointAt(t,A);
|
|
if(null===N)return!1;let S=!1;"number"===typeof G&&N.GetZElevation()!==G&&(N.SetZElevation(G),S=!0);C&&(E+=t/(L.GetHSize()-1),J+=A/(L.GetVSize()-1));-1!==I||C?(C&&(I+=t/(L.GetHSize()-1)),I=d.clamp(I,0,1)):I=N.GetU();-1!==z||C?(C&&(z+=A/(L.GetVSize()-1)),z=d.clamp(z,0,1)):z=N.GetV();if(N.GetX()===E&&N.GetY()===J&&N.GetU()===I&&N.GetV()===z)return S;N.SetX(E);N.SetY(J);N.SetU(I);N.SetV(z);this._DiscardTransformedCollisionPoly();return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(t,A){return this.GetBoundingBox().containsPoint(t,
|
|
A)&&this.GetBoundingQuad().containsPoint(t,A)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(t,A):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(t-this.GetX(),A-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()&&0===(this._flags&256)){var t=this.GetBoundingBox(),A=this._objectClass._GetCollisionCellGrid(),z=this._collisionCells;c.set(A.XToCell(t.getLeft()),
|
|
A.YToCell(t.getTop()),A.XToCell(t.getRight()),A.YToCell(t.getBottom()));z.equals(c)||(t=this._inst,z===x?(A.Update(t,null,c),this._collisionCells=d.New(d.Rect,c)):(A.Update(t,z,c),z.copy(c)),this._flags&=-17)}}_RemoveFromCollisionCells(){const t=this._collisionCells;t!==x&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,t,null),this._collisionCells=x)}_UpdateRenderCell(){const t=this.GetLayer();if(t.UsesRenderCells()&&0===(this._flags&256)){var A=t.GetRenderGrid(),z=this.GetBoundingBox(),
|
|
C=this._renderCells;c.set(A.XToCell(z.getLeft()),A.YToCell(z.getTop()),A.XToCell(z.getRight()),A.YToCell(z.getBottom()));C.equals(c)||(z=this._inst,C===p?(A.Update(z,null,c),this._renderCells=d.New(d.Rect,c)):(A.Update(z,C,c),C.copy(c)),t.SetRenderListStale())}}_RemoveFromRenderCells(){const t=this._renderCells;t!==p&&(this.GetLayer().GetRenderGrid().Update(this._inst,t,null),this._renderCells=p)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const t=this._inst,A=this._layer,z=A._GetInstances();
|
|
z.length&&z[z.length-1]===t||(A._RemoveInstance(t,!1),A._AddInstance(t,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const t=this._inst,A=this._layer,z=A._GetInstances();z.length&&z[0]===t||(A._RemoveInstance(t,!1),A._PrependInstance(t,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(t){const A=this._inst,z=this._layer;if(z.GetLayout()!==t.GetLayout())throw Error("layer from different layout");t!==z&&(z._RemoveInstance(A,!0),this._SetLayer(t),t._AddInstance(A,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(t,
|
|
A){const z=this._inst;let C=!1;const E=this._layer;if(t.GetUID()!==z.GetUID()){var J=t.GetWorldInfo();if(!J)throw Error("expected world instance");J=J.GetLayer();E.GetIndex()!==J.GetIndex()&&(E._RemoveInstance(z,!0),this._SetLayer(J),J._AddInstance(z,!0),C=!0);t=J.MoveInstanceAdjacent(z,t,!!A);(C||t)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(t){this._SetFlag(64,t)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(t){const A=
|
|
{x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(A.ze=this.GetZElevation());0!==this.GetAngle()&&(A.a=this.GetAngle());this.HasDefaultColor()||(A.c=this._color.toJSON());.5!==this.GetOriginX()&&(A.oX=this.GetOriginX());.5!==this.GetOriginY()&&(A.oY=this.GetOriginY());0!==this.GetBlendMode()&&(A.bm=this.GetBlendMode());this.IsVisible()||(A.v=this.IsVisible());this.IsCollisionEnabled()||(A.ce=this.IsCollisionEnabled());
|
|
this.IsBboxChangeEventEnabled()&&(A.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(A.fx=this._instanceEffectList._SaveToJson());const z=0!==(this._flags&32);z&&(A.sfi=z);this._solidFilterTags&&(A.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&"visual-state"!==t&&(A.sgi=this._sceneGraphInfo._SaveToJson());this.HasMesh()&&(A.mesh=this.GetSourceMesh().SaveToJson());return A}_OnBeforeLoad(t){"visual-state"!==t&&this._ResetAllSceneGraphState()}_LoadFromJson(t,A){u=!1;this.SetX(t.x);
|
|
this.SetY(t.y);this.SetWidth(t.w);this.SetHeight(t.h);this._SetZIndex(t.zi);this.SetZElevation(t.hasOwnProperty("ze")?t.ze:0);this.SetAngle(t.hasOwnProperty("a")?t.a:0);t.hasOwnProperty("c")?h.setFromJSON(t.c):t.hasOwnProperty("o")?(h.copyRgb(this._color),h.a=t.o):h.setRgba(1,1,1,1);this._SetColor(h);this.SetOriginX(t.hasOwnProperty("oX")?t.oX:.5);this.SetOriginY(t.hasOwnProperty("oY")?t.oY:.5);this.SetBlendMode(t.hasOwnProperty("bm")?t.bm:0);this.SetVisible(t.hasOwnProperty("v")?t.v:!0);this.SetCollisionEnabled(t.hasOwnProperty("ce")?
|
|
t.ce:!0);this.SetBboxChangeEventEnabled(t.hasOwnProperty("be")?t.be:!1);this.SetSolidCollisionFilter(t.hasOwnProperty("sfi")?t.sfi:!1,t.hasOwnProperty("sft")?t.sft:"");this._instanceEffectList&&t.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(t.fx);if(t.hasOwnProperty("sgi")&&"visual-state"!==A){this._CreateSceneGraphInfo(null);const z=this._sceneGraphInfo,C=t.sgi;z._LoadFromJson(C);const E=this.GetRuntime().Dispatcher(),J=()=>{E.removeEventListener("afterload",J);0===(this._flags&256)&&
|
|
z._OnAfterLoad(C)};E.addEventListener("afterload",J)}t.hasOwnProperty("mesh")?(t=t.mesh,this.CreateMesh(t.cols,t.rows),this.GetSourceMesh().LoadFromJson(t)):this.ReleaseMesh();this.SetBboxChanged();u=!0;this._UpdateRendererStateGroup()}}}
|
|
{"use strict";const d=self.C3;d.BehaviorType=class extends d.DefendedBase{constructor(a,b){super();const e=a.GetRuntime(),c=e.GetPluginManager(),f=e.GetObjectReference(b[1]);c.HasBehaviorByConstructorFunction(f)||c.CreateBehavior(b);this._runtime=e;this._objectClass=a;this._behavior=c.GetBehaviorByConstructorFunction(f);this._sdkType=null;this._instSdkCtor=f.Instance;this._sid=b[2];this._name=b[0];this._jsPropName=this._runtime.GetJsPropName(b[3]);this._sdkType=d.New(f.Type,this);this.OnCreate()}static Create(a,
|
|
b){return d.New(d.BehaviorType,a,b)}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 d=self.C3,a=self.IBehaviorInstance;d.BehaviorInstance=class extends d.DefendedBase{constructor(b){super();this._runtime=b.runtime;this._behaviorType=b.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=b.instance;this._index=b.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(b){if(this._sdkInst)throw Error("already got sdk instance");this._sdkInst=d.New(this._behaviorType.GetInstanceSdkCtor(),this,b);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(b,
|
|
e){this._sdkInst.OnSpriteFrameChanged(b,e)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(b){return this._sdkInst.LoadFromJson(b)}static SortByTickSequence(b,e){var c=b.GetObjectInstance(),f=e.GetObjectInstance();const g=c.GetObjectClass().GetIndex(),h=f.GetObjectClass().GetIndex();if(g!==h)return g-h;c=c.GetPUID();f=f.GetPUID();return c!==f?c-f:b.GetBehaviorInstance()._GetIndex()-e.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const b=
|
|
this._sdkInst.GetScriptInterfaceClass(),e=b||a;a._Init(this);this._iScriptInterface=new e;a._Init(null);if(b&&!(this._iScriptInterface instanceof a))throw new TypeError(`script interface class '${b.name}' does not extend the right base class '${a.name}'`);}GetScriptInterface(){return this._iScriptInterface}}}
|
|
{"use strict";const d=self.C3;d.EffectList=class extends d.DefendedBase{constructor(a,b){super();this._owner=a;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const e of b)a=d.New(d.EffectType,this,e,this._allEffectTypes.length),this._allEffectTypes.push(a),this._effectTypesByName.set(a.GetName().toLowerCase(),a),3<=e.length&&this._effectParams.push(this._LoadSingleEffectParameters(e[2]));this.GetRuntime()._AddEffectList(this)}Release(){d.clearArray(this._allEffectTypes);
|
|
d.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();d.clearArray(this._effectParams);this._owner=null}PrependEffectTypes(a){if(a.length){this._allEffectTypes=a.concat(this._allEffectTypes);for(const b of a)this._effectTypesByName.set(b.GetName().toLowerCase(),b);for(let b=0,e=this._allEffectTypes.length;b<e;++b)this._allEffectTypes[b]._SetIndex(b)}}_LoadSingleEffectParameters(a){a=a.slice(0);for(let b=0,e=a.length;b<e;++b){const c=a[b];if(Array.isArray(c)){const f=d.New(d.Color);
|
|
f.setFromJSON(c);a[b]=f}}return a}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){d.clearArray(this._activeEffectTypes);let a=!0;for(const b of this._allEffectTypes)b.IsActive()&&(this._activeEffectTypes.push(b),b.GetShaderProgram().PreservesOpaqueness()||(a=!1));this._preservesOpaqueness=a}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return 0<this._allEffectTypes.length}GetEffectTypeByName(a){return this._effectTypesByName.get(a.toLowerCase())||
|
|
null}GetEffectTypeByIndex(a){a=Math.floor(+a);if(0>a||a>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[a]}IsEffectIndexActive(a){return this.GetEffectTypeByIndex(a).IsActive()}SetEffectIndexActive(a,b){this.GetEffectTypeByIndex(a).SetActive(b)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return 0<this._activeEffectTypes.length}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(a){return this._effectParams[a]}static SaveFxParamToJson(a){return a&&
|
|
a instanceof d.Color?{t:"color",v:a.toJSON()}:a}static LoadFxParamFromJson(a){if("object"===typeof a){if("color"===a.t){const b=d.New(d.Color);b.setFromJSON(a.v);return b}throw Error("invalid effect parameter type");}return a}static SaveFxParamsToJson(a){return a.map(d.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(a){return a.map(d.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(a=>({name:a.GetName(),active:a.IsActive(),params:d.EffectList.SaveFxParamsToJson(this._effectParams[a.GetIndex()])}))}LoadFromJson(a){for(const b of a)if(a=
|
|
this.GetEffectTypeByName(b.name))a.SetActive(b.active),this._effectParams[a.GetIndex()]=d.EffectList.LoadFxParamsFromJson(b.params);this.UpdateActiveEffects()}}}
|
|
{"use strict";const d=self.C3;d.EffectType=class extends d.DefendedBase{constructor(a,b,e){super();this._effectList=a;this._id=b[0];this._name=b[1];this._index=e;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(a){a=d.New(d.EffectType,a,[this._id,this._name],-1);a._shaderProgram=this._shaderProgram;a._isActive=this._isActive;return a}_InitRenderer(a){a=a.GetShaderProgramByName(this._id);if(!a)throw Error("failed to find shader program '"+this._id+
|
|
"'");this._shaderProgram=a}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(a){this._index=a}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(a){this._isActive=!!a}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const a=[];for(let b=0,e=this._shaderProgram.GetParameterCount();b<e;++b){const c=this._shaderProgram.GetParameterType(b);
|
|
if("float"===c||"percent"===c)a.push(0);else if("color"===c)a.push(d.New(d.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type");}return a}}}
|
|
{"use strict";const d=self.C3;d.InstanceEffectList=class extends d.DefendedBase{constructor(a,b,e){super();this._inst=a;this._wi=b;this._effectList=a.GetObjectClass().GetEffectList();this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const c of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){d.clearArray(this._activeEffectFlags);d.clearArray(this._activeEffectTypes);d.clearArray(this._effectParams);
|
|
this._effectList=this._inst=null}_LoadEffectParameters(a){for(const b of a)this._effectParams.push(this._LoadSingleEffectParameters(b))}_LoadSingleEffectParameters(a){a=a.slice(0);for(let b=0,e=a.length;b<e;++b){const c=a[b];if(Array.isArray(c)){const f=d.New(d.Color);f.setFromJSON(c);a[b]=f}}return a}LoadDefaultEffectParameters(){for(const a of this._effectList.GetAllEffectTypes())this._effectParams.push(a.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){d.clearArray(this._activeEffectTypes);
|
|
const a=this._effectList.GetAllEffectTypes(),b=this._activeEffectTypes,e=this._activeEffectFlags;let c=!0;for(let f=0,g=a.length;f<g;++f)if(e[f]){const h=a[f];b.push(h);h.GetShaderProgram().PreservesOpaqueness()||(c=!1)}this._preservesOpaqueness=c;this._wi._SetHasAnyActiveEffect(!!b.length)}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(a){return this._effectParams[a]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(a=>
|
|
a.GetShaderProgram().UsesDest())}IsEffectIndexActive(a){return this._activeEffectFlags[a]}SetEffectIndexActive(a,b){this._activeEffectFlags[a]=!!b}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(a=>({name:a.GetName(),active:this._activeEffectFlags[a.GetIndex()],params:d.EffectList.SaveFxParamsToJson(this._effectParams[a.GetIndex()])}))}_LoadFromJson(a){for(const b of a)if(a=this._effectList.GetEffectTypeByName(b.name))this._activeEffectFlags[a.GetIndex()]=
|
|
b.active,this._effectParams[a.GetIndex()]=d.EffectList.LoadFxParamsFromJson(b.params);this.UpdateActiveEffects()}}}
|
|
{"use strict";const d=self.C3,a=[],b=[],e=[],c=d.New(d.CollisionPoly),f=d.New(d.CollisionPoly),g=d.New(d.Quad),h=d.New(d.Rect),l=d.New(d.Rect);let m=null,p=null,x=null;d.CollisionEngine=class extends d.DefendedBase{constructor(v){super();this._runtime=v;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(v,r){const q=v.GetWorldInfo(),y=r.GetWorldInfo();q&&y&&q.IsCollisionEnabled()&&y.IsCollisionEnabled()&&this._registeredCollisions.push([v,r])}AddRegisteredCollisionCandidates(v,r,q){for(const [y,u]of this._registeredCollisions){let t;if(v===y)t=u;else if(v===u)t=y;else continue;t.BelongsToObjectClass(r)&&(q.includes(t)||q.push(t))}}CheckRegisteredCollision(v,
|
|
r){if(!this._registeredCollisions.length)return!1;for(const [q,y]of this._registeredCollisions)if(v===q&&r===y||v===y&&r===q)return!0;return!1}ClearRegisteredCollisions(){d.clearArray(this._registeredCollisions)}TestOverlap(v,r){if(!v||!r||v===r)return!1;v=v.GetWorldInfo();r=r.GetWorldInfo();if(!v.IsCollisionEnabled()||!r.IsCollisionEnabled())return!1;this._collisionCheckCount++;const q=v.GetLayer(),y=r.GetLayer();return q.IsTransformCompatibleWith(y)?this._TestOverlap_SameLayers(v,r):this._TestOverlap_DifferentLayers(v,
|
|
r)}_TestOverlap_SameLayers(v,r){if(!v.GetBoundingBox().intersectsRect(r.GetBoundingBox()))return!1;this._polyCheckCount++;if(!v.GetBoundingQuad().intersectsQuad(r.GetBoundingQuad())||v.HasTilemap()&&r.HasTilemap())return!1;if(v.HasTilemap())return this.TestTilemapOverlap(v,r);if(r.HasTilemap())return this.TestTilemapOverlap(r,v);if(!v.HasOwnCollisionPoly()&&!r.HasOwnCollisionPoly())return!0;const q=v.GetTransformedCollisionPoly(),y=r.GetTransformedCollisionPoly();return q.intersectsPoly(y,r.GetX()-
|
|
v.GetX(),r.GetY()-v.GetY())}_TestOverlap_DifferentLayers(v,r){var q=v.HasTilemap(),y=r.HasTilemap();if(q&&!y)return this.TestTilemapOverlapDifferentLayers(v,r);if(y&&!q)return this.TestTilemapOverlapDifferentLayers(r,v);if(y||q)return!1;y=v.GetLayer();q=r.GetLayer();c.copy(v.GetTransformedCollisionPoly());f.copy(r.GetTransformedCollisionPoly());var u=c.pointsArr();for(let t=0,A=u.length;t<A;t+=2){const z=t+1,C=u[z],[E,J]=y.LayerToCanvasCss(u[t]+v.GetX(),C+v.GetY());u[t]=E;u[z]=J}v=f.pointsArr();for(let t=
|
|
0,A=v.length;t<A;t+=2){y=t+1;u=v[y];const [z,C]=q.LayerToCanvasCss(v[t]+r.GetX(),u+r.GetY());v[t]=z;v[y]=C}c.setBboxChanged();f.setBboxChanged();this._polyCheckCount++;return c.intersectsPoly(f,0,0)}TestTilemapOverlapDifferentLayers(v,r){var q=v.GetLayer(),y=r.GetLayer();m||(m=d.New(d.CollisionPoly));p||(p=d.New(d.Rect));x||(x=d.New(d.Quad));var u=r.GetX(),t=r.GetY();const [A,z]=y.LayerToCanvasCss(u,t),[C,E]=q.CanvasCssToLayer(A,z);q=u-C;t-=E;p.copy(r.GetBoundingBox());p.offset(q,t);if(!v.GetBoundingBox().intersectsRect(p))return!1;
|
|
x.copy(r.GetBoundingQuad());x.offset(q,t);this._polyCheckCount++;if(!v.GetBoundingQuad().intersectsQuad(x))return!1;m.copy(r.GetTransformedCollisionPoly());y=m.pointsArr();for(let J=0,G=y.length;J<G;J+=2)u=J+1,y[J]+=q,y[u]+=t;return this.TestTilemapOverlap(v,r,C,E,m,p,x)}TestTilemapOverlap(v,r,q,y,u,t,A){t=void 0!==t?t:r.GetBoundingBox();const z=v.GetX(),C=v.GetY();var E=v.GetInstance().GetSdkInstance();q=void 0!==q?q:r.GetX();y=void 0!==y?y:r.GetY();v=r.HasOwnCollisionPoly();A=void 0!==A?A:r.GetBoundingQuad();
|
|
E.GetCollisionRectCandidates(t,b);for(let I=0,L=b.length;I<L;++I){var J=b[I];E=J.GetRect();this._collisionCheckCount++;if(t.intersectsRectOffset(E,z,C)&&(g.setFromRect(E),g.offset(z,C),g.intersectsQuad(A)))if(v){var G=void 0!==u?u:r.GetTransformedCollisionPoly();if(J=J.GetPoly()){if(this._polyCheckCount++,J.intersectsPoly(G,q-(z+E.getLeft()),y-(C+E.getTop())))return d.clearArray(b),!0}else if(c.setFromQuad(g,0,0),c.intersectsPoly(G,q,y))return d.clearArray(b),!0}else if(G=J.GetPoly()){if(c.setFromQuad(A,
|
|
0,0),G.intersectsPoly(c,-(z+E.getLeft()),-(C+E.getTop())))return d.clearArray(b),!0}else return d.clearArray(b),!0}d.clearArray(b);return!1}TestAndSelectCanvasPointOverlap(v,r,q,y){const u=v.GetCurrentSol();var t=this._runtime.GetCurrentEvent();if(!t)throw Error("cannot call outside event");t=t.IsOrBlock();if(u.IsSelectAll()){y||(u._SetSelectAll(!1),d.clearArray(u._GetOwnInstances()));for(var A of v.GetInstances()){var z=A.GetWorldInfo(),C=z.GetLayer();const [E,J]=C.CanvasCssToLayer(r,q,z.GetTotalZElevation());
|
|
if(z.ContainsPoint(E,J)){if(y)return!1;u._PushInstance(A)}else t&&u._PushElseInstance(A)}}else{A=t?u._GetOwnElseInstances():u._GetOwnInstances();z=0;for(let E=0,J=A.length;E<J;++E){C=A[E];const G=C.GetWorldInfo(),I=G.GetLayer(),[L,N]=I.CanvasCssToLayer(r,q,G.GetTotalZElevation());if(G.ContainsPoint(L,N)){if(y)return!1;t?u._PushInstance(C):A[z++]=C}else t&&(A[z++]=C)}y||(A.length=z)}v.ApplySolToContainer();return y?!0:u.HasAnyInstances()}GetCollisionCandidates(v,r,q,y){v=v?1!==v.GetParallaxX()||1!==
|
|
v.GetParallaxY():!1;if(r.IsFamily())for(const u of r.GetFamilyMembers())v||u.IsAnyInstanceParallaxed()?d.appendArray(y,u.GetInstances()):(u._UpdateAllCollisionCells(),u._GetCollisionCellGrid().QueryRange(q,y));else v||r.IsAnyInstanceParallaxed()?d.appendArray(y,r.GetInstances()):(r._UpdateAllCollisionCells(),r._GetCollisionCellGrid().QueryRange(q,y))}GetObjectClassesCollisionCandidates(v,r,q,y){for(const u of r)this.GetCollisionCandidates(v,u,q,y)}GetSolidCollisionCandidates(v,r,q){const y=this._runtime.GetSolidBehavior();
|
|
y&&this.GetObjectClassesCollisionCandidates(v,y.GetObjectClasses(),r,q)}GetJumpthruCollisionCandidates(v,r,q){const y=this._runtime.GetJumpthruBehavior();y&&this.GetObjectClassesCollisionCandidates(v,y.GetObjectClasses(),r,q)}IsSolidCollisionAllowed(v,r){return v._IsSolidEnabled()&&(!r||r.GetWorldInfo().IsSolidCollisionAllowed(v.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(v){const r=v.GetWorldInfo();this.GetSolidCollisionCandidates(r.GetLayer(),r.GetBoundingBox(),a);for(const q of a)if(this.IsSolidCollisionAllowed(q,
|
|
v)&&this.TestOverlap(v,q))return d.clearArray(a),q;d.clearArray(a);return null}TestRectOverlapSolid(v,r){this.GetSolidCollisionCandidates(null,v,a);for(const q of a)if(this.IsSolidCollisionAllowed(q,r)&&this.TestRectOverlap(v,q))return d.clearArray(a),q;d.clearArray(a);return null}TestOverlapJumpthru(v,r){let q=null;r&&(q=e,d.clearArray(q));const y=v.GetWorldInfo();this.GetJumpthruCollisionCandidates(y.GetLayer(),y.GetBoundingBox(),a);for(const u of a)if(u._IsJumpthruEnabled()&&this.TestOverlap(v,
|
|
u))if(r)q.push(u);else return d.clearArray(a),u;d.clearArray(a);return q}PushOut(v,r,q,y,u){y=y||50;const t=v.GetWorldInfo(),A=t.GetX(),z=t.GetY();for(let C=0;C<y;++C)if(t.SetXY(A+r*C,z+q*C),t.SetBboxChanged(),!this.TestOverlap(v,u))return!0;t.SetXY(A,z);t.SetBboxChanged();return!1}PushOutSolid(v,r,q,y,u,t){y=y||50;const A=v.GetWorldInfo(),z=A.GetX(),C=A.GetY();let E=null,J=null;for(let G=0;G<y;++G)if(A.SetXY(z+r*G,C+q*G),A.SetBboxChanged(),!this.TestOverlap(v,E))if(E=this.TestOverlapSolid(v))J=E;
|
|
else if(u&&(E=t?this.TestOverlap(v,t)?t:null:this.TestOverlapJumpthru(v))&&(J=E),!E)return J&&this.PushInFractional(v,r,q,J,16,!0),!0;A.SetXY(z,C);A.SetBboxChanged();return!1}PushOutSolidAxis(v,r,q,y){y=y||50;const u=v.GetWorldInfo(),t=u.GetX(),A=u.GetY();let z=null,C=null;for(let E=0;E<y;++E)for(let J=0;2>J;++J){const G=2*J-1;u.SetXY(t+r*E*G,A+q*E*G);u.SetBboxChanged();if(!this.TestOverlap(v,z))if(z=this.TestOverlapSolid(v))C=z;else return C&&this.PushInFractional(v,r*G,q*G,C,16,!0),!0}u.SetXY(t,
|
|
A);u.SetBboxChanged();return!1}PushInFractional(v,r,q,y,u,t){let A=2,z=!1;var C=!1;const E=v.GetWorldInfo();let J=E.GetX(),G=E.GetY();for(;A<=u;)C=1/A,A*=2,E.OffsetXY(r*C*(z?1:-1),q*C*(z?1:-1)),E.SetBboxChanged(),this.TestOverlap(v,y)||t&&this.TestOverlapSolid(v)?C=z=!0:(C=z=!1,J=E.GetX(),G=E.GetY());C&&(E.SetXY(J,G),E.SetBboxChanged())}PushOutSolidNearest(v,r=100){let q=0;const y=v.GetWorldInfo(),u=y.GetX(),t=y.GetY();let A=0,z=this.TestOverlapSolid(v);if(!z)return!0;for(;q<=r;){let C=0,E=0;switch(A){case 0:C=
|
|
0;E=-1;q++;break;case 1:C=1;E=-1;break;case 2:C=1;E=0;break;case 3:E=C=1;break;case 4:C=0;E=1;break;case 5:C=-1;E=1;break;case 6:C=-1;E=0;break;case 7:E=C=-1}A=(A+1)%8;y.SetXY(Math.floor(u+C*q),Math.floor(t+E*q));y.SetBboxChanged();if(!this.TestOverlap(v,z)&&(z=this.TestOverlapSolid(v),!z))return!0}y.SetXY(u,t);y.SetBboxChanged();return!1}CalculateBounceAngle(v,r,q,y){const u=v.GetWorldInfo(),t=u.GetX(),A=u.GetY(),z=Math.max(10,d.distanceTo(r,q,t,A));var C=d.angleTo(r,q,t,A),E=y||this.TestOverlapSolid(v);
|
|
if(!E)return d.clampAngle(C+Math.PI);let J=E;var G=0,I=0;const L=d.toRadians(5);let N;for(N=1;36>N;++N){const S=C-N*L;u.SetXY(r+Math.cos(S)*z,q+Math.sin(S)*z);u.SetBboxChanged();if(!this.TestOverlap(v,J)&&(J=y?null:this.TestOverlapSolid(v),!J)){G=S;break}}36===N&&(G=d.clampAngle(C+Math.PI));J=E;for(N=1;36>N;++N)if(E=C+N*L,u.SetXY(r+Math.cos(E)*z,q+Math.sin(E)*z),u.SetBboxChanged(),!this.TestOverlap(v,J)&&(J=y?null:this.TestOverlapSolid(v),!J)){I=E;break}36===N&&(I=d.clampAngle(C+Math.PI));u.SetXY(t,
|
|
A);u.SetBboxChanged();if(I===G)return I;v=d.angleDiff(I,G)/2;v=d.angleClockwise(I,G)?d.clampAngle(G+v+Math.PI):d.clampAngle(I+v);G=Math.cos(C);C=Math.sin(C);I=Math.cos(v);v=Math.sin(v);r=G*I+C*v;return d.angleTo(0,0,G-2*r*I,C-2*r*v)}TestSegmentOverlap(v,r,q,y,u){if(!u)return!1;const t=u.GetWorldInfo();if(!t.IsCollisionEnabled())return!1;this._collisionCheckCount++;h.set(Math.min(v,q),Math.min(r,y),Math.max(v,q),Math.max(r,y));if(!t.GetBoundingBox().intersectsRect(h))return!1;if(u.HasTilemap())return this._TestSegmentOverlapTilemap(v,
|
|
r,q,y,u,t);this._polyCheckCount++;return t.GetBoundingQuad().intersectsSegment(v,r,q,y)?t.HasOwnCollisionPoly()?t.GetTransformedCollisionPoly().intersectsSegment(t.GetX(),t.GetY(),v,r,q,y):!0:!1}_TestSegmentOverlapTilemap(v,r,q,y,u,t){const A=t.GetX();t=t.GetY();u=u.GetSdkInstance();l.set(v,r,q,y);l.normalize();u.GetCollisionRectCandidates(l,b);for(let C=0,E=b.length;C<E;++C){var z=b[C];u=z.GetRect();this._collisionCheckCount++;if(h.intersectsRectOffset(u,A,t)&&(g.setFromRect(u),g.offset(A,t),g.intersectsSegment(v,
|
|
r,q,y)))if(z=z.GetPoly()){if(this._polyCheckCount++,z.intersectsSegment(A+u.getLeft(),t+u.getTop(),v,r,q,y))return d.clearArray(b),!0}else return d.clearArray(b),!0}d.clearArray(b);return!1}TestRectOverlap(v,r){if(!r)return!1;const q=r.GetWorldInfo();if(!q.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!q.GetBoundingBox().intersectsRect(v))return!1;if(r.HasTilemap())return this._TestRectOverlapTilemap(v,r,q);this._polyCheckCount++;g.setFromRect(v);if(!q.GetBoundingQuad().intersectsQuad(g))return!1;
|
|
if(!q.HasOwnCollisionPoly())return!0;c.setFromRect(v,q.GetX(),q.GetY());v=q.GetTransformedCollisionPoly();return c.intersectsPoly(v,0,0)}_TestRectOverlapTilemap(v,r,q){const y=q.GetX();q=q.GetY();r.GetSdkInstance().GetCollisionRectCandidates(v,b);for(let t=0,A=b.length;t<A;++t){var u=b[t];r=u.GetRect();this._collisionCheckCount++;if(v.intersectsRectOffset(r,y,q))if(u=u.GetPoly()){if(this._polyCheckCount++,c.setFromRect(v,0,0),u.intersectsPoly(c,-(y+r.getLeft()),-(q+r.getTop())))return d.clearArray(b),
|
|
!0}else return d.clearArray(b),!0}d.clearArray(b);return!1}TestRayIntersectsInstance(v,r){if(v){var q=v.GetWorldInfo();q.IsCollisionEnabled()&&(this._collisionCheckCount++,q.GetBoundingBox().intersectsRect(r.rect)&&(v.HasTilemap()?this._TestRayIntersectsTilemap(v,q,r):(this._polyCheckCount++,q.HasOwnCollisionPoly()?r.TestInstancePoly(v,q.GetX(),q.GetY(),q.GetTransformedCollisionPoly()):r.TestInstanceQuad(v,q.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(v,r,q){const y=r.GetX(),u=r.GetY();v.GetSdkInstance().GetCollisionRectCandidates(q.rect,
|
|
b);for(let A=0,z=b.length;A<z;A++){var t=b[A];const C=t.GetRect();this._collisionCheckCount++;q.rect.intersectsRectOffset(C,y,u)&&(t=t.GetPoly(),this._polyCheckCount++,t?q.TestInstancePoly(v,y+C.getLeft(),u+C.getTop(),t):q.TestInstanceRect(v,r.GetX(),r.GetY(),C))}d.clearArray(b)}}}
|
|
{"use strict";const d=self.C3;d.SparseGrid=class extends d.DefendedBase{constructor(a,b){super();this._cellWidth=a;this._cellHeight=b;this._cells=d.New(d.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(a,b,e){let c=this._cells.Get(a,b);return c?c:e?(c=d.New(d.GridCell,this,a,b),this._cells.Set(a,b,c),c):null}XToCell(a){a=Math.floor(a/this._cellWidth);return isFinite(a)?a:0}YToCell(a){a=Math.floor(a/this._cellHeight);return isFinite(a)?a:0}Update(a,b,e){if(b)for(let c=b.getLeft(),
|
|
f=b.getRight();c<=f;++c)for(let g=b.getTop(),h=b.getBottom();g<=h;++g){if(e&&e.containsPoint(c,g))continue;const l=this.GetCell(c,g,!1);l&&(l.Remove(a),l.IsEmpty()&&this._cells.Delete(c,g))}if(e)for(let c=e.getLeft(),f=e.getRight();c<=f;++c)for(let g=e.getTop(),h=e.getBottom();g<=h;++g)b&&b.containsPoint(c,g)||this.GetCell(c,g,!0).Insert(a)}QueryRange(a,b){let e=this.XToCell(a.getLeft());const c=this.YToCell(a.getTop()),f=this.XToCell(a.getRight());a=this.YToCell(a.getBottom());if(isFinite(f)&&isFinite(a))for(;e<=
|
|
f;++e)for(let g=c;g<=a;++g){const h=this.GetCell(e,g,!1);h&&h.Dump(b)}}}}{"use strict";const d=self.C3;d.GridCell=class extends d.DefendedBase{constructor(a,b,e){super();this._grid=a;this._x=b;this._y=e;this._instances=d.New(d.ArraySet)}Release(){this._instances.Release();this._grid=this._instances=null}IsEmpty(){return this._instances.IsEmpty()}Insert(a){this._instances.Add(a)}Remove(a){this._instances.Delete(a)}Dump(a){d.appendArray(a,this._instances.GetArray())}}}
|
|
{"use strict";const d=self.C3;d.Ray=class{constructor(){this.dy=this.dx=this.y2=this.x2=this.y1=this.x1=0;this.rect=new d.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(a,b,e,c){this.x1=a;this.y1=b;this.x2=e;this.y2=c;this.dx=e-a;this.dy=c-b;this.rect.set(a,b,e,c);this.rect.normalize();this.hitFraction=
|
|
2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0;return this}Complete(){if(!1!==this.DidCollide()){var a=this.dx*this.hitFraction,b=this.dy*this.hitFraction,e=Math.sqrt(a*a+b*b);a/=e;b/=e;this.distance=e-1E-6;this.hitX=this.x1+a*this.distance;this.hitY=this.y1+b*this.distance;this.hitNormal=Math.atan2(this.hitNormalDy,this.hitNormalDx)+Math.PI/2;this.normalX=Math.cos(this.hitNormal);
|
|
this.normalY=Math.sin(this.hitNormal);e=a*this.normalX+b*this.normalY;this.reflectionX=a-2*this.normalX*e;this.reflectionY=b-2*this.normalY*e;0<e&&(this.hitNormal=d.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(a,b,e,c,f){const g=d.rayIntersect(this.x1,this.y1,this.x2,this.y2,b,e,c,f);0<=g&&g<this.hitFraction&&(this.hitFraction=g,this.hitUid=a.GetUID(),this.hitNormalDx=b-c,this.hitNormalDy=e-f)}TestInstanceRect(a,b,e,c){const f=b+c.getLeft();
|
|
b+=c.getRight();const g=e+c.getTop();e+=c.getBottom();this.TestInstanceSegment(a,f,g,b,g);this.TestInstanceSegment(a,b,g,b,e);this.TestInstanceSegment(a,b,e,f,e);this.TestInstanceSegment(a,f,e,f,g)}TestInstanceQuad(a,b){const e=b.getTlx(),c=b.getTly(),f=b.getTrx(),g=b.getTry(),h=b.getBrx(),l=b.getBry(),m=b.getBlx();b=b.getBly();this.TestInstanceSegment(a,e,c,f,g);this.TestInstanceSegment(a,f,g,h,l);this.TestInstanceSegment(a,h,l,m,b);this.TestInstanceSegment(a,m,b,e,c)}TestInstancePoly(a,b,e,c){c=
|
|
c.pointsArr();for(let f=0,g=c.length;f<g;f+=2){const h=(f+2)%g;this.TestInstanceSegment(a,c[f]+b,c[f+1]+e,c[h]+b,c[h+1]+e)}}}}
|
|
{"use strict";const d=self.C3,a=new Set("off crop scale-inner scale-outer letterbox-scale letterbox-integer-scale".split(" ")),b=new Set(["high","low"]),e=d.New(d.Quad),c=d.New(d.Rect);d.CanvasManager=class extends d.DefendedBase{constructor(f){super();this._runtime=f;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._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=!1;this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets=new Set;this._shaderData=null;this._gpuLastUtilisation=
|
|
this._gpuTimeEndFrame=this._gpuTimeStartFrame=0;this._gpuFrameTimingsBuffer=null;this._layersGpuProfile=new Map;this._gpuCurUtilisation=NaN;this._webgpuFrameTimings=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=d.New(d.Rect);this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=this._isPastingToDrawingCanvas=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=g=>this._loadingProgress=g.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(g=>this._splashDoneResolve=g)}_SetGPUPowerPreference(f){this._gpuPreference=f}_SetWebGPUEnabled(f){this._isWebGPUEnabled=!!f}async CreateCanvas(f){this._canvas=f.canvas;this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",g=>this._OnWindowResize(g));
|
|
this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",g=>this._OnFullscreenChange(g));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",g=>this._OnFullscreenError(g));this._isDocumentFullscreen=!!f.isFullscreen;if(this._isWebGPUEnabled)if(navigator.gpu)try{await this._InitWebGPU(f)}catch(g){this._webgpuRenderer=null,console.error("Failed to initialise WebGPU, switching to WebGL: ",g)}else console.warn("WebGPU was enabled but is not supported, falling back to WebGL");
|
|
this._webgpuRenderer||await this._InitWebGL(f)}async _InitWebGPU(f){const g={powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures()};this._webgpuRenderer=d.New(d.Gfx.WebGPURenderer);await this._webgpuRenderer.Create(this._canvas,g);this._webgpuRenderer.SupportsGPUProfiling()||(this._gpuLastUtilisation=NaN);this.SetSize(f.windowInnerWidth,f.windowInnerHeight,!0)}async _InitWebGL(f){this._canvas.addEventListener("webglcontextlost",h=>this._OnWebGLContextLost(h));this._canvas.addEventListener("webglcontextrestored",
|
|
h=>this._OnWebGLContextRestored(h));const g={powerPreference:this._gpuPreference,enableGpuProfiling:!0,depth:this._runtime.Uses3DFeatures()};"Android"===d.Platform.OS&&"Chromium"===d.Platform.BrowserEngine&&75>d.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=d.New(d.Gfx.WebGLRenderer,this._canvas,g);await this._webglRenderer.InitState();this._webglRenderer.SupportsGPUProfiling()||(this._gpuLastUtilisation=NaN);this.SetSize(f.windowInnerWidth,f.windowInnerHeight,!0);this._shaderData=self.C3_Shaders;await this._LoadShaderPrograms();f=!1;for(const h of this._runtime._GetAllEffectLists()){for(const l of h.GetAllEffectTypes())l._InitRenderer(this._webglRenderer),l.GetShaderProgram().UsesDest()&&(f=!0);h.UpdateActiveEffects()}this._runtime._SetUsesAnyBackgroundBlending(f);
|
|
this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=d.New(d.Gfx.WebGLQueryResultBuffer,this._webglRenderer));this._webglRenderer.SetMipmapsEnabled(this._enableMipmaps)}async _LoadShaderPrograms(){if(this._shaderData){var f=[];for(const [g,h]of Object.entries(this._shaderData)){const l=d.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource();f.push(this._webglRenderer.CreateShaderProgram(h,l,g))}await Promise.all(f);this._webglRenderer.ResetLastProgram();this._webglRenderer.SetTextureFillMode()}}Release(){this._canvas=
|
|
this._webglRenderer=this._runtime=null}_OnWindowResize(f){const g=this._runtime,h=f.devicePixelRatio;g.IsInWorker()&&(self.devicePixelRatio=h);g._SetDevicePixelRatio(h);this._isDocumentFullscreen=!!f.isFullscreen;this.SetSize(f.innerWidth,f.innerHeight);g.UpdateRender();g.IsDebug()&&(g.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused())&&g.Render()}_OnFullscreenChange(f){this._isDocumentFullscreen=!!f.isFullscreen;this.SetSize(f.innerWidth,f.innerHeight,!0);this._runtime.UpdateRender()}_OnFullscreenError(f){this._isDocumentFullscreen=
|
|
!!f.isFullscreen;this.SetSize(f.innerWidth,f.innerHeight,!0);this._runtime.UpdateRender()}SetSize(f,g,h=!1){f=Math.floor(f);g=Math.floor(g);if(0>=f||0>=g)throw Error("invalid size");if(this._windowInnerWidth!==f||this._windowInnerHeight!==g||h){this._windowInnerWidth=f;this._windowInnerHeight=g;h=this.GetCurrentFullscreenMode();"letterbox-scale"===h?this._CalculateLetterboxScale(f,g):"letterbox-integer-scale"===h?this._CalculateLetterboxIntegerScale(f,g):"off"===h?this._CalculateFixedSizeCanvas(f,
|
|
g):this._CalculateFullsizeCanvas(f,g);this._UpdateFullscreenScalingQuality(h);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});f=this.GetRenderer();f.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0);for(var l of this._availableAdditionalRenderTargets)f.DeleteRenderTarget(l);
|
|
d.clearArray(this._availableAdditionalRenderTargets);l=this._runtime.GetLayoutManager();l.SetAllLayerProjectionChanged();l.SetAllLayerMVChanged()}}_CalculateLetterboxScale(f,g){const h=this._runtime.GetDevicePixelRatio(),l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight(),p=l/m;f/g>p?(this._canvasCssWidth=Math.round(g*p),this._canvasCssHeight=g,this._canvasCssOffsetX=Math.floor((f-this._canvasCssWidth)/2),this._canvasCssOffsetY=0):(this._canvasCssWidth=f,this._canvasCssHeight=
|
|
Math.round(f/p),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((g-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*h);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*h);this._runtime.SetViewportSize(l,m)}_CalculateLetterboxIntegerScale(f,g){const h=this._runtime.GetDevicePixelRatio();1!==h&&(f+=1,g+=1);const l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight();var p=l/m;p=f/g>p?g*p*h/l:f/p*h/m;1<p?p=Math.floor(p):
|
|
1>p&&(p=1/Math.ceil(1/p));this._canvasDeviceWidth=Math.round(l*p);this._canvasDeviceHeight=Math.round(m*p);this._canvasCssWidth=this._canvasDeviceWidth/h;this._canvasCssHeight=this._canvasDeviceHeight/h;this._canvasCssOffsetX=Math.max(Math.floor((f-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((g-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(l,m)}_CalculateFullsizeCanvas(f,g){const h=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=f;this._canvasCssHeight=
|
|
g;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*h);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*h);this._canvasCssOffsetY=this._canvasCssOffsetX=0;f=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/f,this._canvasCssHeight/f)}_CalculateFixedSizeCanvas(f,g){const h=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth*
|
|
h);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*h);this.IsDocumentFullscreen()?(this._canvasCssOffsetX=Math.floor((f-this._canvasCssWidth)/2),this._canvasCssOffsetY=Math.floor((g-this._canvasCssHeight)/2)):this._canvasCssOffsetY=this._canvasCssOffsetX=0;this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(f){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=this._canvasDeviceWidth,this._drawHeight=
|
|
this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let h;if("off"===this.GetCurrentFullscreenMode()){var g=this._runtime.GetViewportWidth();h=this._runtime.GetViewportHeight()}else g=this._runtime.GetOriginalViewportWidth(),h=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<g&&this._canvasDeviceHeight<h?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"):(this._drawWidth=g,this._drawHeight=h,this._fullscreenScalingQuality=
|
|
"low","scale-inner"===f?(f=g/h,g=this._windowInnerWidth/this._windowInnerHeight,g<f?this._drawWidth=this._drawHeight*g:g>f&&(this._drawHeight=this._drawWidth/g)):"scale-outer"===f&&(f=g/h,g=this._windowInnerWidth/this._windowInnerHeight,g>f?this._drawWidth=this._drawHeight*g:g<f&&(this._drawHeight=this._drawWidth/g)))}}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(f){if(!a.has(f))throw Error("invalid fullscreen mode");this._fullscreenMode=f;f=this._runtime.GetLayoutManager();
|
|
f.SetAllLayerProjectionChanged();f.SetAllLayerMVChanged()}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(f){if(!a.has(f))throw Error("invalid fullscreen mode");this._documentFullscreenMode=f;f=this._runtime.GetLayoutManager();f.SetAllLayerProjectionChanged();f.SetAllLayerMVChanged()}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?this.GetDocumentFullscreenMode():this.GetFullscreenMode()}SetFullscreenScalingQuality(f){if(!b.has(f))throw Error("invalid fullscreen scaling quality");
|
|
this._wantFullscreenScalingQuality=f;this._runtime.GetLayoutManager().SetAllLayerProjectionChanged()}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(f){switch(f){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(f){this._enableMipmaps=!!f}_SetTextureAnisotropy(f){this._textureAnisotropy=f}GetTextureAnisotropy(){return this._textureAnisotropy}IsRendererContextLost(){return this.GetRenderer().IsContextLost()}_OnWebGLContextLost(f){console.log("[Construct 3] WebGL context lost");f.preventDefault();this._availableAdditionalRenderTargets=
|
|
[];this._usedAdditionalRenderTargets.clear();this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(f){await this._webglRenderer.OnContextRestored();await this._LoadShaderPrograms();for(const g of this._runtime._GetAllEffectLists())for(const h of g.GetAllEffectTypes())h._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 f=this.GetCurrentFullscreenMode();if("off"===f||"crop"===f)return 1;const g=this._runtime.GetOriginalViewportWidth(),h=this._runtime.GetOriginalViewportHeight(),l=g/h,m=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==f&&m>l||"scale-inner"===f&&m<l?this._canvasCssHeight/h:this._canvasCssWidth/g}SetDeviceTransformOffset(f,
|
|
g){this._deviceTransformOffX=f;this._deviceTransformOffY=g}SetDeviceTransform(f,g,h){g=(g||this._drawWidth)/2+this._deviceTransformOffX;const l=(h||this._drawHeight)/2+this._deviceTransformOffY;h=f.CalculateLookAtModelView2(g,l,f.GetDefaultCameraZ()*this._runtime.GetDevicePixelRatio(),g,l,0,h||this._drawHeight);f.SetModelViewMatrix(h)}SetCssTransform(f){var g=this._canvasCssWidth/2;const h=this._canvasCssHeight/2;g=f.CalculateLookAtModelView2(g,h,f.GetDefaultCameraZ(),g,h,0);f.SetModelViewMatrix(g)}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(f){f.depth=
|
|
this._runtime.Uses3DFeatures();const g=this._availableAdditionalRenderTargets,h=g.findIndex(m=>m.IsCompatibleWithOptions(f));let l;-1!==h?(l=g[h],g.splice(h,1)):l=this.GetRenderer().CreateRenderTarget(f);this._usedAdditionalRenderTargets.add(l);return l}ReleaseAdditionalRenderTarget(f){if(!this._usedAdditionalRenderTargets.has(f))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(f);this._availableAdditionalRenderTargets.push(f)}*activeLayersGpuProfiles(){for(const f of this._runtime.GetLayoutManager().runningLayouts())for(const g of f.GetLayers()){const h=
|
|
this._layersGpuProfile.get(g);h&&(yield h)}}GetLayerTimingsBuffer(f){if(!this.GetRenderer().SupportsGPUProfiling())return null;let g=this._layersGpuProfile.get(f);g||(g={name:f.GetName(),timingsBuffer:d.New(d.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(f,g));return g.timingsBuffer}_Update1sFrameRange(){const f=this.GetRenderer();if(f.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=f.GetFrameNumber();this._gpuCurUtilisation=
|
|
NaN;for(const g of this.activeLayersGpuProfiles())g.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 f of this.activeLayersGpuProfiles())if(f.curUtilisation=
|
|
f.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),isNaN(f.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const f of this.activeLayersGpuProfiles())f.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),f.lastUtilisation=Math.min(f.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 f=this._gpuTimeStartFrame;f<this._gpuTimeEndFrame;++f){var g=this._webgpuFrameTimings.get(f);if(g&&!g.HasResult())return}g=this._runtime.GetMainRunningLayout();f=d.MakeFilledArray(g.GetLayerCount()+1,0);for(var h=this._gpuTimeStartFrame;h<this._gpuTimeEndFrame;++h){var l=
|
|
this._webgpuFrameTimings.get(h);if(l){l=l.GetResult();for(let m=0,p=Math.min(f.length,l.length/2);m<p;++m){const x=l[2*m],v=l[2*m+1];f[m]=0===Number(x)||0===Number(v)?NaN:f[m]+Number(v-x)/1E9}}}this._gpuLastUtilisation=d.clamp(f[0],0,1);if(this._runtime.IsDebug()){h=[];g=g.GetLayers();for(let m=0,p=Math.min(g.length,f.length-1);m<p;++m)h.push({name:g[m].GetName(),lastUtilisation:d.clamp(f[m+1],0,1)});self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,h)}for(f=this._gpuTimeStartFrame;f<this._gpuTimeEndFrame;++f)this._webgpuFrameTimings.delete(f);
|
|
this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=0}}_AddWebGPUFrameTiming(f){this._webgpuFrameTimings.set(this._webgpuRenderer.GetFrameNumber(),f)}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(f,g,h,l,m,p){this._snapshotFormat=f;this._snapshotQuality=g;this._snapshotArea.setWH(h,l,m,p);return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(x=>{this._snapshotResolve=x})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var f=this._canvas,
|
|
g=this._snapshotArea,h=d.clamp(Math.floor(g.getLeft()),0,f.width),l=d.clamp(Math.floor(g.getTop()),0,f.height),m=g.width();m=0===m?f.width-h:d.clamp(Math.floor(m),0,f.width-h);g=g.height();g=0===g?f.height-l:d.clamp(Math.floor(g),0,f.height-l);(0!==h||0!==l||m!==f.width||g!==f.height)&&0<m&&0<g&&(f=d.CreateCanvas(m,g),f.getContext("2d").drawImage(this._canvas,h,l,m,g,0,0,m,g));d.CanvasToBlob(f,this._snapshotFormat,this._snapshotQuality).then(p=>{this._snapshotUrl=URL.createObjectURL(p);this._snapshotPromise=
|
|
null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat="";this._snapshotQuality=1}}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(f){f?this._isPastingToDrawingCanvas++:this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return 0<this._isPastingToDrawingCanvas}InitLoadingScreen(f){this._webglRenderer&&(2===f?(this._percentText=d.New(d.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===f?(f=this._runtime.GetLoadingLogoAsset())&&f.LoadStaticTexture(this._webglRenderer).catch(g=>console.warn("[C3 runtime] Failed to create texture for loading logo: ",g)):4===f&&(this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(g=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.logo=g}).catch(g=>console.warn("Failed to load splash image: ",
|
|
g)),this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(g=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.powered=g}).catch(g=>console.warn("Failed to load splash image: ",g)),this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(g=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(g):this._splashTextures.website=g}).catch(g=>console.warn("Failed to load splash image: ",g))))}async _LoadSvgSplashImage(f){f=
|
|
(new URL(f,this._runtime.GetBaseURL())).toString();f=await d.FetchBlob(f);f=await this._runtime.RasterSvgImage(f,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(f,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(f){f=(new URL(f,this._runtime.GetBaseURL())).toString();f=await d.FetchBlob(f);return await this._webglRenderer.CreateStaticTextureAsync(f,{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 f=this._runtime.GetLoaderStyle();4===f&&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===f&&this.HideCordovaSplashScreen()}}_DrawLoadingScreen(){if(-1!==this._rafId){var f=this._webglRenderer;if(f){f.Start();this._rafId=-1;var g=this._runtime.GetAssetManager().HasHadErrorLoading(),h=this._runtime.GetLoaderStyle();
|
|
3!==h&&(this.SetCssTransform(f),f.ClearRgba(0,0,0,0),f.ResetColor(),f.SetTextureFillMode(),f.SetTexture(null));if(0===h)this._DrawProgressBarAndLogoLoadingScreen(g);else if(1===h)this._DrawProgressBarLoadingScreen(g,120,0);else if(2===h)this._DrawPercentTextLoadingScreen(g);else if(3===h)d.noop();else if(4===h)this._DrawSplashLoadingScreen(g);else throw Error("invalid loader style");f.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}}_DrawPercentTextLoadingScreen(f){f?this._percentText.SetColorRgb(1,
|
|
0,0):this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(100*this._loadingProgress)+"%");f=this._canvasCssWidth/2;const g=this._canvasCssHeight/2;e.setRect(f-150,g-100,f+150,g+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(e,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(f,g,h){const l=this._webglRenderer;l.SetColorFillMode();f?l.SetColorRgba(1,0,0,1):l.SetColorRgba(.118,.565,1,1);f=this._canvasCssWidth/2;const m=
|
|
this._canvasCssHeight/2,p=g/2;c.setWH(f-p,m-4+h,Math.floor(g*this._loadingProgress),8);l.Rect(c);c.setWH(f-p,m-4+h,g,8);c.offset(-.5,-.5);c.inflate(.5,.5);l.SetColorRgba(0,0,0,1);l.LineRect2(c);c.inflate(1,1);l.SetColorRgba(1,1,1,1);l.LineRect2(c)}_DrawProgressBarAndLogoLoadingScreen(f){var g=this._runtime.GetLoadingLogoAsset();if(g)if(g=g.GetTexture()){var h=g.GetWidth(),l=g.GetHeight(),m=this._canvasCssWidth/2,p=this._canvasCssHeight/2,x=h/2;l/=2;e.setRect(m-x,p-l,m+x,p+l);this._webglRenderer.SetTexture(g);
|
|
this._webglRenderer.Quad(e);this._DrawProgressBarLoadingScreen(f,h,l+16)}else this._DrawProgressBarLoadingScreen(f,120,0);else this._DrawProgressBarLoadingScreen(f,120,0)}_DrawSplashLoadingScreen(f){const g=this._webglRenderer,h=this._splashTextures.logo,l=this._splashTextures.powered,m=this._splashTextures.website,p=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=p);const x=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),v=x?0:200,r=x?0:
|
|
3E3;let q=1;"fade-in"===this._splashState?q=Math.min((p-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&(q=Math.max(1-(p-this._splashFadeOutStartTime)/300,0));g.SetColorFillMode();g.SetColorRgba(.231*q,.251*q,.271*q,q);c.set(0,0,this._canvasCssWidth,this._canvasCssHeight);g.Rect(c);const y=Math.ceil(this._canvasCssWidth),u=Math.ceil(this._canvasCssHeight);let t;256<this._canvasCssHeight?(g.SetColorRgba(.302*q,.334*q,.365*q,q),t=Math.max(.005*u,2),c.setWH(0,.8*u-t/2,y,t),g.Rect(c),f?
|
|
g.SetColorRgba(q,0,0,q):g.SetColorRgba(.161*q,.953*q,.816*q,q),f=y*this._loadingProgress,c.setWH(.5*y-f/2,.8*u-t/2,f,t),g.Rect(c),g.SetColorRgba(q,q,q,q),g.SetTextureFillMode(),l&&(f=1.5*d.clamp(.22*u,105,.6*y),t=f/8,c.setWH(.5*y-f/2,.2*u-t/2,f,t),g.SetTexture(l),g.Rect(c)),h&&(t=f=Math.min(.395*u,.95*y),c.setWH(.5*y-f/2,.485*u-t/2,f,t),g.SetTexture(h),g.Rect(c)),m&&(f=1.5*d.clamp(.22*u,105,.6*y),t=f/8,c.setWH(.5*y-f/2,.868*u-t/2,f,t),g.SetTexture(m),g.Rect(c))):(g.SetColorRgba(.302*q,.334*q,.365*
|
|
q,q),t=Math.max(.005*u,2),c.setWH(0,.85*u-t/2,y,t),g.Rect(c),f?g.SetColorRgba(q,0,0,q):g.SetColorRgba(.161*q,.953*q,.816*q,q),f=y*this._loadingProgress,c.setWH(.5*y-f/2,.85*u-t/2,f,t),g.Rect(c),g.SetColorRgba(q,q,q,q),g.SetTextureFillMode(),h&&(t=f=.55*u,c.setWH(.5*y-f/2,.45*u-t/2,f,t),g.SetTexture(h),g.Rect(c)));this._splashFrameNumber++;"fade-in"===this._splashState&&300<=p-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=p);"wait"===this._splashState&&
|
|
p-this._splashFadeInFinishTime>=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=p);("fade-out"===this._splashState&&p-this._splashFadeOutStartTime>=300+v||x&&1<=this._loadingProgress&&500>p-this._loaderStartTime)&&this._splashDoneResolve()}}}
|
|
{"use strict";const d=self.C3,a=self.C3Debugger,b={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let e=!0;d.Runtime=class extends d.DefendedBase{constructor(c){c=Object.assign({},b,c);super();this._messagePort=c.messagePort;this._baseUrl=c.baseUrl;this._isHeadless=!!c.headless;this._hasDom=!!c.hasDom;this._isInWorker=!!c.isInWorker;e=c.ife;this._useAudio=!!c.useAudio;this._exportType=c.exportType;this._isiOSCordova=!!c.isiOSCordova;this._isiOSWebView=
|
|
!!c.isiOSWebView;this._isFBInstantAvailable=!!c.isFBInstantAvailable;this._opusWasmScriptUrl=c.opusWasmScriptUrl;this._opusWasmBinaryUrl=c.opusWasmBinaryUrl;this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!c.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._usesAnyBackgroundBlending=!1;this._loadingLogoAsset=null;this._assetManager=d.New(d.AssetManager,this,c);this._layoutManager=d.New(d.LayoutManager,this);this._eventSheetManager=d.New(d.EventSheetManager,this);this._pluginManager=d.New(d.PluginManager,this);this._collisionEngine=d.New(d.CollisionEngine,
|
|
this);this._timelineManager=d.New(d.TimelineManager,this);this._transitionManager=d.New(d.TransitionManager,this);this._allObjectClasses=[];this._objectClassesByName=new Map;this._objectClassesBySid=new Map;this._familyCount=0;this._allContainers=[];this._allEffectLists=[];this._currentLayoutStack=[];this._instancesPendingCreate=[];this._instancesPendingDestroy=new Map;this._isFlushingPendingInstances=this._hasPendingInstances=!1;this._nextUid=this._objectCount=0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick=
|
|
new Set;this._instancesToReleaseAffectedObjectClasses=new Set;this._objectReferenceTable=[];this._jsPropNameTable=[];this._canvasManager=null;this._uses3dFeatures=!1;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._tickCallbacks={normal:f=>{this._ruafId=this._rafId=-1;this.Tick(f)},tickOnly:f=>{this._ruafId=-1;this.Tick(f,!1,"skip-render")},renderOnly:()=>{this._rafId=
|
|
-1;this.Render()}};this._ruafId=this._rafId=-1;this._execCount=this._tickCountNoSave=this._tickCount=0;this._hasStartedTicking=this._isInTick=this._hasStarted=!1;this._isLayoutFirstTick=!0;this._suspendCount=0;this._scheduleTriggersThrottle=new d.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=d.New(d.KahanSum);this._gameTimeRaw=d.New(d.KahanSum);this._wallTime=d.New(d.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=d.New(d.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:d.New(d.Event,"pretick",!1),tick:d.New(d.Event,"tick",!1),tick2:d.New(d.Event,"tick2",!1),instancedestroy:d.New(d.Event,"instancedestroy",!1),beforelayoutchange:d.New(d.Event,"beforelayoutchange",!1),layoutchange:d.New(d.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=d.New(d.Event.Dispatcher);this._userScriptEventObjects=null;this._behInstsToTick=d.New(d.RedBlackSet,d.BehaviorInstance.SortByTickSequence);
|
|
this._behInstsToPostTick=d.New(d.RedBlackSet,d.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=d.New(d.RedBlackSet,d.BehaviorInstance.SortByTickSequence);this._jobScheduler=d.New(d.JobSchedulerRuntime,this,c.jobScheduler);c.canvas&&(this._canvasManager=d.New(d.CanvasManager,this));this._messagePort.onmessage=f=>this._OnMessageFromDOM(f.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",f=>this._OnVisibilityChange(f));this.AddDOMComponentMessageHandler("runtime","opus-decode",
|
|
f=>this._WasmDecodeWebMOpus(f.arrayBuffer));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",f=>this._InvokeFunctionFromJS(f));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",f=>this._OnWindowBlur(f));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus());
|
|
this._timelineManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(c){return d.New(d.Runtime,c)}Release(){d.clearArray(this._allObjectClasses);this._objectClassesByName.clear();this._objectClassesBySid.clear();this._layoutManager.Release();this._layoutManager=null;this._eventSheetManager.Release();this._eventSheetManager=null;this._pluginManager.Release();this._pluginManager=null;this._assetManager.Release();
|
|
this._assetManager=null;this._collisionEngine.Release();this._collisionEngine=null;this._timelineManager.Release();this._timelineManager=null;this._transitionManager.Release();this._transitionManager=null;this._canvasManager&&(this._canvasManager.Release(),this._canvasManager=null);this._dispatcher.Release();this._tickEvent=this._dispatcher=null}["_OnMessageFromDOM"](c){const f=c.type;if("event"===f)this._OnEventFromDOM(c);else if("result"===f)this._OnResultFromDOM(c);else throw Error(`unknown message '${f}'`);
|
|
}_OnEventFromDOM(c){if(this._isReadyToHandleEvents){var f=c.component,g=c.handler,h=c.data,l=c.dispatchOpts,m=!(!l||!l.dispatchRuntimeEvent);l=!(!l||!l.dispatchUserScriptEvent);var p=c.responseId;if("runtime"===f&&(m&&(c=new d.Event(g),c.data=h,this._dispatcher.dispatchEventAndWaitAsyncSequential(c)),l)){c=new d.Event(g,!0);for(const [x,v]of Object.entries(h))c[x]=v;this.DispatchUserScriptEvent(c)}if(c=this._domEventHandlers.get(f))if(c=c.get(g)){m=null;try{m=c(h)}catch(x){console.error(`Exception in '${f}' handler '${g}':`,
|
|
x);null!==p&&this._PostResultToDOM(p,!1,""+x);return}null!==p&&(m&&m.then?m.then(x=>this._PostResultToDOM(p,!0,x)).catch(x=>{console.error(`Rejection from '${f}' handler '${g}':`,x);this._PostResultToDOM(p,!1,""+x)}):this._PostResultToDOM(p,!0,m))}else m||l||console.warn(`[Runtime] No DOM handler '${g}' for component '${f}'`);else m||l||console.warn(`[Runtime] No DOM event handlers for component '${f}'`)}else this._waitingToHandleEvents.push(c)}_PostResultToDOM(c,f,g){this._messagePort.postMessage({type:"result",
|
|
responseId:c,isOk:f,result:g})}_OnResultFromDOM(c){const f=c.responseId,g=c.isOk;c=c.result;const h=this._pendingResponsePromises.get(f);g?h.resolve(c):h.reject(c);this._pendingResponsePromises.delete(f)}AddDOMComponentMessageHandler(c,f,g){let h=this._domEventHandlers.get(c);h||(h=new Map,this._domEventHandlers.set(c,h));if(h.has(f))throw Error(`[Runtime] Component '${c}' already has handler '${f}'`);h.set(f,g)}PostComponentMessageToDOM(c,f,g){this._messagePort.postMessage({type:"event",component:c,
|
|
handler:f,data:g,responseId:null})}PostComponentMessageToDOMAsync(c,f,g){const h=this._nextDomResponseId++,l=new Promise((m,p)=>{this._pendingResponsePromises.set(h,{resolve:m,reject:p})});this._messagePort.postMessage({type:"event",component:c,handler:f,data:g,responseId:h});return l}PostToDebugger(c){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",c)}async Init(c){this.IsDebug()?await a.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);
|
|
var [f]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(f);await this._InitialiseCanvas(c);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");this.GetWebGLRenderer()?(f=this.GetWebGLRenderer(),console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${f.GetWebGLVersionNumber()} [${f.GetUnmaskedRenderer()}] (${f.IsDesynchronized()?
|
|
"desynchronized":"standard"} compositing)`),f.HasMajorPerformanceCaveat()&&console.warn("[C3 runtime] WebGL indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.")):this.GetWebGPURenderer()&&console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with experimental WebGPU`);this._isReadyToHandleEvents=!0;for(const g of this._waitingToHandleEvents)this._OnEventFromDOM(g);d.clearArray(this._waitingToHandleEvents);
|
|
this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const g of c.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(g));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);d.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 d.Event("beforeruntimestart")),
|
|
await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(c){try{await c(this._iRuntime)}catch(f){console.error("[C3 runtime] Error in runOnStartup function: ",f)}}_LoadDataJson(c){c=c.project;this._projectName=c[0];this._projectVersion=c[16];this._projectUniqueId=c[31];this._appId=c[38];const f=c[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!c[9];this._originalViewportWidth=this._viewportWidth=c[10];this._originalViewportHeight=this._viewportHeight=
|
|
c[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=c[36];this._framerateMode=c[37];"low-latency"===this._compositingMode&&this.IsAndroidWebView()&&77>=d.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=!!c[40];this._sampling=c[14];this._usesLoaderLayout=!!c[18];this._loaderStyle=c[19];this._nextUid=c[21];this._pauseOnBlur=c[22];const g=this._assetManager;g._SetAudioFiles(c[7],c[25]);g._SetMediaSubfolder(c[8]);g._SetFontsSubfolder(c[32]);g._SetIconsSubfolder(c[28]);g._SetWebFonts(c[29]);if(0===this._loaderStyle){let x="";this.IsPreview()?g._HasLocalUrlBlob(f)&&(x=g.GetLocalUrlAsBlobUrl(f)):x=g.GetIconsSubfolder()+f;x&&(this._loadingLogoAsset=g.LoadImage({url:x}))}this._canvasManager&&
|
|
(this._canvasManager.SetFullscreenMode(d.CanvasManager._FullscreenModeNumberToString(c[12])),this._canvasManager.SetFullscreenScalingQuality(c[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==c[24]),this._canvasManager._SetGPUPowerPreference(c[34]),this._canvasManager._SetTextureAnisotropy(c[41]),this._canvasManager._SetWebGPUEnabled(c[13]));this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();for(var h of c[2])this._pluginManager.CreatePlugin(h);
|
|
this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var l of c[3])h=d.ObjectClass.Create(this,this._allObjectClasses.length,l),this._allObjectClasses.push(h),this._objectClassesByName.set(h.GetName().toLowerCase(),h),this._objectClassesBySid.set(h.GetSID(),h);for(const x of c[4])this._allObjectClasses[x[0]]._LoadFamily(x);for(var m of c[27])l=m.map(x=>this._allObjectClasses[x]),this._allContainers.push(d.New(d.Container,this,l));for(const x of this._allObjectClasses)x._OnAfterCreate();
|
|
for(const x of c[5])this._layoutManager.Create(x);(m=c[1])&&(m=this._layoutManager.GetLayoutByName(m))&&this._layoutManager.SetFirstLayout(m);for(var p of c[33])this._timelineManager.Create(p);for(const x of c[35])this._transitionManager.Create(x);this._InitScriptInterfaces();for(const x of c[6])this._eventSheetManager.Create(x);this._eventSheetManager._PostInit();this._InitGlobalVariableScriptInterface();d.clearArray(this._objectReferenceTable);this.FlushPendingInstances();p="any";c=c[20];1===c?
|
|
p="portrait":2===c&&(p="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:p})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(c){this._additionalLoadPromises.push(c)}SetUsingCreatePromises(c){this._isUsingCreatePromises=!!c}AddCreatePromise(c){this._isUsingCreatePromises&&this._additionalCreatePromises.push(c)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(c){this._allEffectLists.push(c)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(c){this._canvasManager&&
|
|
(await this._canvasManager.CreateCanvas(c),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var c=null;try{c=this.IsiOSCordova()&&this._assetManager.IsFileProtocol()?await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(f){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",
|
|
f);return}c?this.AddJobWorkerBuffer(c,"opus-decoder-wasm"):this.AddJobWorkerBlob(null,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(c){return await this.AddJob("OpusDecode",{arrayBuffer:c},[c])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var c of this._allObjectClasses)c.IsFamily()||c.IsOnLoaderLayout()||!c.IsWorldType()||c.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=
|
|
!1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&a.RuntimeInit(e);for(const f of this._layoutManager.GetAllLayouts())f._CreateGlobalNonWorlds();c=this._layoutManager.GetFirstLayout();await c._Load(null,this.GetRenderer());await c._StartRunning(!0);this._fpsLastTime=performance.now();this._usesLoaderLayout||this._OnLoadFinished();(await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking")).isSuspended?this._suspendCount++:
|
|
this.Tick()}_OnLoadFinished(){this.Trigger(d.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(c){c=Math.floor(c);const f=this._objectReferenceTable;if(0>c||c>=f.length)throw Error("invalid object reference");return f[c]}_LoadJsPropNameTable(){for(const c of self.C3_JsPropNameTable){const f=d.first(Object.keys(c));this._jsPropNameTable.push(f)}}GetJsPropName(c){c=Math.floor(c);const f=this._jsPropNameTable;if(0>c||c>=f.length)throw Error("invalid prop reference");
|
|
return f[c]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetBaseURL(){return this._baseUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return 0===
|
|
this.GetCurrentEventStackFrame().GetConditionIndex()}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(c){c=Math.floor(c);if(0>c||c>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[c]}GetObjectClassByName(c){return this._objectClassesByName.get(c.toLowerCase())||null}GetObjectClassBySID(c){return this._objectClassesBySid.get(c)||
|
|
null}GetSingleGlobalObjectClassByCtor(c){return(c=this._pluginManager.GetPluginByConstructorFunction(c))?c.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const c of this._allObjectClasses)c.IsFamily()||(yield*c.instances())}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(c){c.runtime=this.GetIRuntime();const f=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();f&&
|
|
a.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(c);f&&a.AddScriptTime()}DispatchUserScriptEventAsyncWait(c){c.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(c)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(c,f){if(this._originalViewportWidth!==c||this._originalViewportHeight!==f)this._originalViewportWidth=c,this._originalViewportHeight=
|
|
f,c=this.GetLayoutManager(),c.SetAllLayerProjectionChanged(),c.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(c,f){if(this._viewportWidth!==c||this._viewportHeight!==f)this._viewportWidth=c,this._viewportHeight=f,c=this.GetLayoutManager(),c.SetAllLayerProjectionChanged(),c.SetAllLayerMVChanged()}_SetDevicePixelRatio(c){this._devicePixelRatio=c}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){return this._canvasManager?
|
|
this._canvasManager.GetDrawWidth():this._viewportWidth}GetDrawHeight(){return this._canvasManager?this._canvasManager.GetDrawHeight():this._viewportHeight}GetRenderScale(){return this._canvasManager?this._canvasManager.GetRenderScale():1}GetDisplayScale(){return this._canvasManager?this._canvasManager.GetDisplayScale():1}GetCanvasClientX(){return this._canvasManager?this._canvasManager.GetCanvasClientX():0}GetCanvasClientY(){return this._canvasManager?this._canvasManager.GetCanvasClientY():0}GetCanvasCssWidth(){return this._canvasManager?
|
|
this._canvasManager.GetCssWidth():0}GetCanvasCssHeight(){return this._canvasManager?this._canvasManager.GetCssHeight():0}GetFullscreenMode(){return this._canvasManager?this._canvasManager.GetFullscreenMode():"off"}GetAdditionalRenderTarget(c){return this._canvasManager?this._canvasManager.GetAdditionalRenderTarget(c):null}ReleaseAdditionalRenderTarget(c){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(c)}_SetUsesAnyBackgroundBlending(c){this._usesAnyBackgroundBlending=!!c}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}GetGPUUtilisation(){return this._canvasManager?
|
|
this._canvasManager.GetGPUUtilisation():NaN}IsLinearSampling(){return"nearest"!==this.GetSampling()}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}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(c){return this._assetManager.LoadImage(c)}CreateInstance(c,
|
|
f,g,h,l){return this.CreateInstanceFromData(c,f,!1,g,h,!1,l)}CreateInstanceFromData(c,f,g,h,l,m,p){var x=null;let v=null;if(c instanceof d.ObjectClass){v=c;if(v.IsFamily()){c=v.GetFamilyMembers();var r=Math.floor(this.Random()*c.length);v=c[r]}x=v.GetDefaultInstanceData()}else x=c,v=this.GetObjectClassByIndex(x[1]);var q=v.GetPlugin().IsWorldType();if(this._isLoading&&q&&!v.IsOnLoaderLayout())return null;const y=f;q||(f=null);var u=g&&!m&&x&&!this._instancesByUid.has(x[2])?x[2]:this._nextUid++;r=
|
|
x?x[0]:null;c=d.New(d.Instance,{runtime:this,objectType:v,layer:f,worldData:r,instVarData:x?x[3]:null,uid:u});this._instancesByUid.set(u,c);u=null;q&&(u=c.GetWorldInfo(),"undefined"!==typeof h&&"undefined"!==typeof l&&(u.SetX(h),u.SetY(l)),v._SetAnyCollisionCellChanged(!0));f&&(p||f._AddInstance(c,!0),1===f.GetParallaxX()&&1===f.GetParallaxY()||v._SetAnyInstanceParallaxed(!0),f.GetLayout().MaybeLoadTexturesFor(v));this._objectCount++;if(v.IsInContainer()&&!g&&!m){for(var t of v.GetContainer().objectTypes()){if(t===
|
|
v)continue;const C=this.CreateInstanceFromData(t,y,!1,u?u.GetX():h,u?u.GetY():l,!0,!1);c._AddSibling(C)}for(var A of c.siblings()){A._AddSibling(c);for(var z of c.siblings())A!==z&&A._AddSibling(z)}}q&&!g&&p&&this._CreateChildInstancesFromData(c,r,u,f,h,l);if(v.IsInContainer()&&!g&&!m&&p)for(const C of c.siblings())if(t=C.GetWorldInfo())A=C.GetPlugin(),z=C.GetObjectClass().GetDefaultInstanceData()[0],A.IsWorldType()?this._CreateChildInstancesFromData(C,z,t,f,t.GetX(),t.GetY()):this._CreateChildInstancesFromData(C,
|
|
z,t,f);if(p&&!m&&!g&&c.IsInContainer())for(const C of c.siblings())for(const E of C.siblings())c===E&&y._RemoveInstance(C,!0);!m&&p&&("undefined"===typeof h&&(h=r[0]),"undefined"===typeof l&&(l=r[1]),f=u.GetTopParent(),h=h-u.GetX()+f.GetX(),l=l-u.GetY()+f.GetY(),f.SetXY(h,l));v._SetIIDsStale();l=x?d.cloneArray(x[5]):null;x=x?x[4].map(C=>d.cloneArray(C)):null;(q=q&&r&&r[13])&&c._SetHasTilemap();c._CreateSdkInstance(l,x);q&&(r=r[13],c.GetSdkInstance().LoadTilemapData(r[2],r[0],r[1]));this._instancesPendingCreate.push(c);
|
|
this._hasPendingInstances=!0;this.IsDebug()&&a.InstanceCreated(c);return c}_CreateChildInstancesFromData(c,f,g,h,l,m){var p=g.GetSceneGraphZIndexExportData(),x=g.GetSceneGraphChildrenExportData();c.GetWorldInfo().SetSceneGraphZIndex(p);if(x){"undefined"===typeof l&&(l=f[0]);"undefined"===typeof m&&(m=f[1]);p=new Set;g=f[0];f=f[1];for(const u of x){var v=u[1],r=u[2];x=u[3];var q=!!u[4];const t=u[5];r=this._layoutManager.GetLayoutBySID(u[0]).GetLayer(v).GetInitialInstanceData(r);v=this.GetObjectClassByIndex(r[1]);
|
|
var y=c.HasSibling(v);const A=p.has(v);y&&!A&&q?(q=c.GetSibling(v),y=l+r[0][0]-g,r=m+r[0][1]-f,q.GetWorldInfo().SetXY(y,r),q.GetWorldInfo().SetSceneGraphZIndex(t),c.AddChild(q,{transformX:!!(x>>0&1),transformY:!!(x>>1&1),transformWidth:!!(x>>2&1),transformHeight:!!(x>>3&1),transformAngle:!!(x>>4&1),destroyWithParent:!!(x>>5&1),transformZElevation:!!(x>>6&1)}),p.add(v)):(v=this.CreateInstanceFromData(r,h,!1,l+r[0][0]-g,m+r[0][1]-f,!1,!0),v.GetWorldInfo().SetSceneGraphZIndex(t),c.AddChild(v,{transformX:!!(x>>
|
|
0&1),transformY:!!(x>>1&1),transformWidth:!!(x>>2&1),transformHeight:!!(x>>3&1),transformAngle:!!(x>>4&1),destroyWithParent:!!(x>>5&1),transformZElevation:!!(x>>6&1)}))}}}DestroyInstance(c){if(!this._instancesToReleaseAtEndOfTick.has(c)){var f=c.GetObjectClass(),g=this._instancesPendingDestroy.get(f);if(g){if(g.has(c))return;g.add(c)}else g=new Set,g.add(c),this._instancesPendingDestroy.set(f,g);this.IsDebug()&&a.InstanceDestroyed(c);c._MarkDestroyed();this._hasPendingInstances=!0;if(c.IsInContainer())for(const h of c.siblings())this.DestroyInstance(h);
|
|
for(const h of c.children())h.GetDestroyWithParent()&&this.DestroyInstance(h);this._layoutManager.IsEndingLayout()||this._isLoadingState||(f=this.GetEventSheetManager(),f.BlockFlushingInstances(!0),c._TriggerOnDestroyed(),f.BlockFlushingInstances(!1));c._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances=
|
|
this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const c of this._instancesPendingCreate){const f=c.GetObjectClass();f._AddInstance(c);for(const g of f.GetFamilies())g._AddInstance(c),g._SetIIDsStale()}d.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [c,f]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(c,f),f.clear();this._instancesPendingDestroy.clear();
|
|
this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(c,f){for(const h of f){var g=this._eventObjects.instancedestroy;g.instance=h;this._dispatcher.dispatchEvent(g);this._instancesByUid.delete(h.GetUID());if(g=h.GetWorldInfo())g._RemoveFromCollisionCells(),g._RemoveFromRenderCells(),g._MarkDestroyed();this._instancesToReleaseAtEndOfTick.add(h);this._objectCount--}d.arrayRemoveAllInSet(c.GetInstances(),f);c._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(c);
|
|
0===c.GetInstances().length&&c._SetAnyInstanceParallaxed(!1);for(const h of c.GetFamilies())d.arrayRemoveAllInSet(h.GetInstances(),f),h._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(h);if(c.GetPlugin().IsWorldType()){c=new Set([...f].map(h=>h.GetWorldInfo().GetLayer()));for(const h of c)h._RemoveAllInstancesInSet(f)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(c){for(const f of this._GetInstancesPendingCreate())c.IsFamily()?
|
|
f.GetObjectClass().BelongsToFamily(c)&&(yield f):f.GetObjectClass()===c&&(yield f)}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(c,f){this._instancesByUid.set(c,f)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(d.New(d.Event,"webglcontextlost"));this.SetSuspended(!0);for(var c of this._allObjectClasses)!c.IsFamily()&&c.HasLoadedTextures()&&c.ReleaseTextures();(c=this.GetMainRunningLayout())&&c._OnWebGLContextLost();d.ImageInfo.OnWebGLContextLost();d.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,
|
|
this.GetWebGLRenderer());this._dispatcher.dispatchEvent(d.New(d.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(c){this.SetSuspended(c.hidden)}_OnWindowBlur(c){this.IsPreview()&&this._pauseOnBlur&&!d.Platform.IsMobile&&!c.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const c=this._tickCallbacks;"vsync"===this._framerateMode?
|
|
-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=d.RequestUnlimitedAnimationFrame(c.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.renderOnly))):-1===this._ruafId&&(this._ruafId=d.RequestUnlimitedAnimationFrame(c.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(d.CancelUnlimitedAnimationFrame(this._ruafId),
|
|
this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(c){var f=this.IsSuspended();this._suspendCount+=c?1:-1;0>this._suspendCount&&(this._suspendCount=0);c=this.IsSuspended();!f&&c?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(d.New(d.Event,"suspend")),this.Trigger(d.Plugins.System.Cnds.OnSuspend,null,null)):f&&!c&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=f=performance.now(),this._mainThreadTimeCounter=
|
|
this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(d.New(d.Event,"resume")),this.Trigger(d.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(f))}_AddBehInstToTick(c){this._behInstsToTick.Add(c)}_AddBehInstToPostTick(c){this._behInstsToPostTick.Add(c)}_AddBehInstToTick2(c){this._behInstsToTick2.Add(c)}_RemoveBehInstToTick(c){this._behInstsToTick.Remove(c)}_RemoveBehInstToPostTick(c){this._behInstsToPostTick.Remove(c)}_RemoveBehInstToTick2(c){this._behInstsToTick2.Remove(c)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);
|
|
for(const c of this._behInstsToTick)c.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick)c.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2)c.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const c of this._behInstsToTick){const f=
|
|
c.Tick();d.IsIterator(f)&&(yield*f)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick){const f=c.PostTick();d.IsIterator(f)&&(yield*f)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2){const f=c.Tick2();d.IsIterator(f)&&(yield*f)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(c,f,
|
|
g){this._hasStartedTicking=!0;const h="background-wake"===g;g="background-wake"!==g&&"skip-render"!==g;this._hasStarted&&(!this.IsSuspended()||f||h)&&(f=performance.now(),this._isInTick=!0,this._MeasureDt(c||0),c=this.Step_BeforePreTick(),this.IsDebugging()&&await c,c=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick),c instanceof Promise&&await c,c=this.Step_AfterPreTick(),this.IsDebugging()&&await c,this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad(),this.GetLayoutManager().IsPendingChangeMainLayout()&&
|
|
await this._MaybeChangeLayout(),c=this.Step_RunEventsEtc(),this.IsDebugging()&&await c,g&&this.Render(),this.IsSuspended()||h||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-f)}async Step_BeforePreTick(){const c=this._eventSheetManager,f=this.IsDebug();this.FlushPendingInstances();c.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());f&&a.StartMeasuringTime();this.IsDebugging()?
|
|
await c.DebugRunScheduledWaits():c.RunScheduledWaits();f&&a.AddEventsTime();this.PopCurrentLayout();c.BlockFlushingInstances(!1);this.FlushPendingInstances();c.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const c=this.IsDebug(),f=this.IsDebugging(),g=this._dispatcher,h=this._eventObjects,l=this._userScriptEventObjects;c&&a.StartMeasuringTime();f?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();f?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):
|
|
this._BehaviorPostTick();c&&a.AddBehaviorTickTime();c&&a.StartMeasuringTime();f?await this.DebugFireGeneratorEventAndBreak(h.tick):g.dispatchEvent(h.tick);c&&a.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(l.tick)}async Step_RunEventsEtc(){const c=this._eventSheetManager,f=this._dispatcher,g=this._eventObjects,h=this.IsDebug(),l=this.IsDebugging();h&&a.StartMeasuringTime();l?await c.DebugRunEvents(this._layoutManager):c.RunEvents(this._layoutManager);
|
|
h&&a.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=!1;c.BlockFlushingInstances(!0);h&&a.StartMeasuringTime();l?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();h&&a.AddBehaviorTickTime();h&&a.StartMeasuringTime();l?await this.DebugFireGeneratorEventAndBreak(g.tick2):f.dispatchEvent(g.tick2);h&&a.AddPluginTickTime();c.BlockFlushingInstances(!1);l&&await c.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(0!==
|
|
this._instancesToReleaseAtEndOfTick.size){var c=this._dispatcher;c.SetDelayRemoveEventsEnabled(!0);for(const f of this._instancesToReleaseAffectedObjectClasses)f.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const f of this._instancesToReleaseAtEndOfTick)f.Release();this._instancesToReleaseAtEndOfTick.clear();c.SetDelayRemoveEventsEnabled(!1)}}async _MaybeChangeLayout(){const c=
|
|
this.GetLayoutManager();let f=0;for(;c.IsPendingChangeMainLayout()&&10>f++;)await this._DoChangeLayout(c.GetPendingChangeMainLayout())}_MeasureDt(c){let f=0;0!==this._lastTickTime&&(f=Math.max(c-this._lastTickTime,0)/1E3,.5<f&&(f=0),this._dt1=Math.min(f,1/this._minimumFramerate));this._lastTickTime=c;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(f*this._timeScale);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=c-this._fpsLastTime&&
|
|
(this._fpsLastTime+=1E3,1E3<=c-this._fpsLastTime&&(this._fpsLastTime=c),this._fps=this._fpsFrameCount,this._fpsFrameCount=0,this._mainThreadTime=Math.min(this._mainThreadTimeCounter/1E3,1),this._mainThreadTimeCounter=0,this._canvasManager&&this._canvasManager._Update1sFrameRange(),this._collisionEngine._Update1sStats(),this.IsDebug()&&a.Update1sPerfStats());this._fpsFrameCount++}async _DoChangeLayout(c){const f=this._dispatcher,g=this.GetLayoutManager().GetMainRunningLayout();await g._StopRunning();
|
|
g._Unload(c,this.GetRenderer());g===c&&this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();f.dispatchEvent(this._eventObjects.beforelayoutchange);d.Asyncify.SetHighThroughputMode(!0);await c._Load(g,this.GetRenderer());d.Asyncify.SetHighThroughputMode(!1);await c._StartRunning(!1);f.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender=
|
|
!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}GetWebGPURenderer(){return this._canvasManager?this._canvasManager.GetWebGPURenderer():null}GetRenderer(){return this._canvasManager?this._canvasManager.GetRenderer():null}Render(){const c=this._canvasManager;if(c&&!c.IsRendererContextLost()){var f=this.GetRenderer(),g=f.SupportsGPUProfiling(),h=g&&f.IsWebGL();g=g&&f.IsWebGPU();h&&f.CheckForQueryResults();if(this._needRender){var l=this._layoutManager.GetMainRunningLayout();
|
|
f.Start();var m=this.IsDebug();m&&a.StartMeasuringTime();this._needRender=!1;var p=null;h&&(p=c.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),f.StartQuery(p));h=null;g&&(h=f.StartFrameTiming(2*(1+l.GetLayerCount())),f.WriteTimestamp(0));this.Uses3DFeatures()&&"low"===c.GetCurrentFullscreenScalingQuality()?f.SetFixedSizeDepthBuffer(c.GetDrawWidth(),c.GetDrawHeight()):f.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),l);p&&f.EndQuery(p);g&&(f.WriteTimestamp(1),this._canvasManager._AddWebGPUFrameTiming(h));
|
|
f.Finish();m&&(a.AddDrawCallsTime(),a.UpdateInspectHighlight());c&&c._MaybeTakeSnapshot()}else f.IncrementFrameNumber()}}_Render(c,f){c.SetTextureFillMode();c.SetAlphaBlend();c.SetColorRgba(1,1,1,1);c.SetRenderTarget(null);c.SetTexture(null);c.SetDepthEnabled(this.Uses3DFeatures());f.Draw(c)}Trigger(c,f,g){if(!this._hasStarted)return!1;var h=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let l=0;h&&(l=performance.now());const m=this.IsDebug();m&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._Trigger(this._layoutManager,
|
|
c,f,g);h&&(h=performance.now()-l,this._mainThreadTimeCounter+=h,m&&a.AddTriggersTime(h));m&&this.SetDebuggingEnabled(!0);return c}DebugTrigger(c,f,g){if(!this.IsDebug())return this.Trigger(c,f,g);if(this.HitBreakpoint())throw Error("called DebugTrigger() while stopped on breakpoint");if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,c,f,
|
|
g)}async TriggerAsync(c,f,g){if(!this.IsDebugging())return this.Trigger(c,f,g);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(c,f,g);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(c,f,g);const h=performance.now();c=this._eventSheetManager._DebugTrigger(this._layoutManager,c,f,g);for(f=c.next();!f.done;)await this.DebugBreak(f.value),f=c.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),
|
|
this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-h;return f.value}FastTrigger(c,f,g){const h=this.IsDebug();h&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._FastTrigger(this._layoutManager,c,f,g);h&&this.SetDebuggingEnabled(!0);return c}DebugFastTrigger(c,f,g){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,c,f,g)}ScheduleTriggers(c){return this._scheduleTriggersThrottle.Add(c)}PushCurrentLayout(c){this._currentLayoutStack.push(c)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty");
|
|
this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?this._currentLayoutStack[this._currentLayoutStack.length-1]:this.GetMainRunningLayout()}GetDt(c){return c&&-1!==c.GetTimeScale()?this._dt1*c.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(c){if(isNaN(c)||0>c)c=0;this._timeScale=c}SetMinimumFramerate(c){this._minimumFramerate=d.clamp(c,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}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(c){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event");
|
|
return this._instancesByUid.get(c)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const c of this._allObjectClasses)if(!c.IsFamily())for(const f of c.GetInstances())this._instancesByUid.set(f.GetUID(),f)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===d.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}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(c){c=!!c;this._isPixelRoundingEnabled!==c&&(this._isPixelRoundingEnabled=c,this.GetLayoutManager().SetAllLayerMVChanged(),
|
|
this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(c){this._saveToSlotName=c}LoadFromSlot(c){this._loadFromSlotName=c}LoadFromJsonString(c){this._loadFromJson=c}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!(!this._saveToSlotName&&!this._loadFromSlotName&&null===this._loadFromJson)}async _HandleSaveOrLoad(){this._saveToSlotName&&(this.FlushPendingInstances(),await this._DoSaveToSlot(this._saveToSlotName),this._ClearSaveOrLoad());
|
|
this._loadFromSlotName&&(await this._DoLoadFromSlot(this._loadFromSlotName),this._ClearSaveOrLoad(),this.IsDebug()&&a.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(d.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(c){console.error("[Construct 3] Failed to load state from JSON string: ",c),await this.TriggerAsync(d.Plugins.System.Cnds.OnLoadFailed,
|
|
null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null}_GetProjectStorage(){this._projectStorage||(this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._projectStorage}_GetSavegamesStorage(){this._savegamesStorage||(this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));
|
|
return this._savegamesStorage}async _DoSaveToSlot(c){const f=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(c,f),console.log("[Construct 3] Saved state to storage ("+f.length+" chars)"),this._lastSaveJson=f,await this.TriggerAsync(d.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(g){console.error("[Construct 3] Failed to save state to storage: ",g),await this.TriggerAsync(d.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(c){try{const f=
|
|
await this._GetSavegamesStorage().getItem(c);if(!f)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+f.length+" chars)");await this._DoLoadFromJsonString(f);this._lastSaveJson=f;await this.TriggerAsync(d.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(f){console.error("[Construct 3] Failed to load state from storage: ",f),await this.TriggerAsync(d.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const c={c3save:!0,version:1,rt:{time:this.GetGameTime(),
|
|
timeRaw:this.GetGameTimeRaw(),walltime:this.GetWallTime(),timescale:this.GetTimeScale(),tickcount:this.GetTickCount(),execcount:this.GetExecCount(),next_uid:this._nextUid,running_layout:this.GetMainRunningLayout().GetSID(),start_time_offset:Date.now()-this._startTime},types:{},layouts:{},events:this._eventSheetManager._SaveToJson(),timelines:this._timelineManager._SaveToJson(),user_script_data:null};for(var f of this._allObjectClasses)f.IsFamily()||f.HasNoSaveBehavior()||(c.types[f.GetSID().toString()]=
|
|
f._SaveToJson());for(const g of this._layoutManager.GetAllLayouts())c.layouts[g.GetSID().toString()]=g._SaveToJson();f=this._CreateUserScriptEvent("save");f.saveData=null;await this.DispatchUserScriptEventAsyncWait(f);c.user_script_data=f.saveData;return JSON.stringify(c)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(c){var f=this.GetLayoutManager();c=JSON.parse(c);if(c.c2save)throw Error("C2 saves are incompatible with C3 runtime");if(!c.c3save)throw Error("not valid C3 save data");
|
|
if(1<c.version)throw Error("C3 save data from future version");this._dispatcher.dispatchEvent(d.New(d.Event,"beforeload"));for(var g of this.allInstances())g._OnBeforeLoad();this._isLoadingState=!0;g=c.rt;this._gameTime.Set(g.time);g.hasOwnProperty("timeRaw")&&this._gameTimeRaw.Set(g.timeRaw);this._wallTime.Set(g.walltime);this._timeScale=g.timescale;this._tickCount=g.tickcount;this._execCount=g.execcount;this._startTime=Date.now()-g.start_time_offset;var h=g.running_layout;if(h!==this.GetMainRunningLayout().GetSID())if(h=
|
|
f.GetLayoutBySID(h))await this._DoChangeLayout(h);else return;for(const [l,m]of Object.entries(c.types))h=parseInt(l,10),h=this.GetObjectClassBySID(h),!h||h.IsFamily()||h.HasNoSaveBehavior()||h._LoadFromJson(m);this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=g.next_uid;for(const [l,m]of Object.entries(c.layouts))g=parseInt(l,10),(g=f.GetLayoutBySID(g))&&g._LoadFromJson(m);this._eventSheetManager._LoadFromJson(c.events);for(const l of this._allObjectClasses)if(!l.IsFamily()&&
|
|
l.IsInContainer())for(const m of l.GetInstances()){g=m.GetIID();for(const p of l.GetContainer().objectTypes())if(p!==l){h=p.GetInstances();if(0>g||g>=h.length)throw Error("missing sibling instance");m._AddSibling(h[g])}}this._timelineManager._LoadFromJson(c.timelines);f.SetAllLayerProjectionChanged();f.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(d.New(d.Event,"afterload"));f=this._CreateUserScriptEvent("load");f.saveData=c.user_script_data;await this.DispatchUserScriptEventAsyncWait(f);
|
|
this.UpdateRender()}async AddJobWorkerScripts(c){c=(await Promise.all(c.map(f=>this._assetManager.FetchBlob(f)))).map(f=>URL.createObjectURL(f));this._jobScheduler.ImportScriptsToJobWorkers(c)}AddJobWorkerBlob(c,f){this._jobScheduler.SendBlobToJobWorkers(c,f)}AddJobWorkerBuffer(c,f){this._jobScheduler.SendBufferToJobWorkers(c,f)}AddJob(c,f,g){return this._jobScheduler.AddJob(c,f,g)}BroadcastJob(c,f,g){return this._jobScheduler.BroadcastJob(c,f,g)}InvokeDownload(c,f){this.PostComponentMessageToDOM("runtime",
|
|
"invoke-download",{url:c,filename:f})}async RasterSvgImage(c,f,g,h,l,m){h=h||f;l=l||g;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{blob:c,imageWidth:f,imageHeight:g,surfaceWidth:h,surfaceHeight:l,imageBitmapOpts:m})).imageBitmap;c=await self.C3_RasterSvgImageBlob(c,f,g,h,l);return m?await self.createImageBitmap(c,m):c}async GetSvgImageSize(c){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{blob:c}):
|
|
await self.C3_GetSvgImageSize(c)}RequestDeviceOrientationEvent(){this._didRequestDeviceOrientationEvent||(this._didRequestDeviceOrientationEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-orientation"))}RequestDeviceMotionEvent(){this._didRequestDeviceMotionEvent||(this._didRequestDeviceMotionEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-motion"))}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(c){this._randomNumberCallback=c}_GetRemotePreviewStatusInfo(){const c=
|
|
this.GetWebGLRenderer();return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:c?c.GetUnmaskedRenderer():"<unavailable>"}}HitBreakpoint(){return this.IsDebug()?a.HitBreakpoint():!1}DebugBreak(c){return this.IsDebugging()?a.DebugBreak(c):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?a.BreakNext():!1}SetDebugBreakpointsEnabled(c){this._breakpointsEnabled=!!c;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(c){c?
|
|
this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&a.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&&a.IsGPUProfiling()}async DebugIterateAndBreak(c){if(c)for(const f of c)await this.DebugBreak(f)}DebugFireGeneratorEventAndBreak(c){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(c))}_InvokeFunctionFromJS(c){return this._eventSheetManager._InvokeFunctionFromJS(c.name,
|
|
c.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(c){c=d.New(d.Event,c,!1);c.runtime=this._iRuntime;return c}_InitScriptInterfaces(){var c={};for(const f of this._allObjectClasses)c[f.GetJsPropName()]={value:f.GetIObjectClass(),enumerable:!0,writable:!1};c=Object.create(Object.prototype,c);this._iRuntime=new self.IRuntime(this,c);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const c={};for(const f of this.GetEventSheetManager().GetAllGlobalVariables())c[f.GetJsPropName()]=
|
|
f._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(c)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(c,f){this._interfaceMap.set(c,f)}_UnwrapScriptInterface(c){return this._interfaceMap.get(c)}_UnwrapIObjectClass(c){if(!(c instanceof self.IObjectClass))throw new TypeError("expected IObjectClass");c=this._UnwrapScriptInterface(c);if(!(c&&c instanceof d.ObjectClass))throw Error("invalid IObjectClass");return c}_UnwrapIWorldInstance(c){if(!(c instanceof
|
|
self.IWorldInstance))throw new TypeError("expected IWorldInstance");c=this._UnwrapScriptInterface(c);if(!(c&&c instanceof d.Instance))throw Error("invalid IInstance");return c}};self.C3_CreateRuntime=d.Runtime.Create;self.C3_InitRuntime=(c,f)=>c.Init(f)}
|
|
{"use strict";const d=self.C3;d.JobSchedulerRuntime=class extends d.DefendedBase{constructor(a,b){super();this._runtime=a;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=b.inputPort;b.outputPort.onmessage=e=>this._OnJobWorkerMessage(e);this._maxNumWorkers=b.maxNumWorkers;this._jobWorkerCount=1;this._hadErrorCreatingWorker=this._isCreatingWorker=!1}async Init(){}ImportScriptsToJobWorkers(a){this._inputPort.postMessage({type:"_import_scripts",scripts:a})}SendBlobToJobWorkers(a,b){this._inputPort.postMessage({type:"_send_blob",
|
|
blob:a,id:b})}SendBufferToJobWorkers(a,b){this._inputPort.postMessage({type:"_send_buffer",buffer:a,id:b},[a])}AddJob(a,b,e,c,f){e||(e=[]);const g=this._nextJobId++;a={type:a,isBroadcast:!1,jobId:g,params:b,transferables:e};b=new Promise((h,l)=>{this._jobPromises.set(g,{resolve:h,progress:c,reject:l,cancelled:!1})});f&&f.SetAction(()=>this._CancelJob(g));this._inputPort.postMessage(a,e);this._MaybeCreateExtraWorker();return b}BroadcastJob(a,b,e){e||(e=[]);const c=this._nextJobId++;this._inputPort.postMessage({type:a,
|
|
isBroadcast:!0,jobId:c,params:b,transferables:e},e)}_CancelJob(a){const b=this._jobPromises.get(a);b&&(b.cancelled=!0,b.resolve=null,b.progress=null,b.reject=null,this._inputPort.postMessage({type:"_cancel",jobId:a}))}_OnJobWorkerMessage(a){a=a.data;const b=a.type,e=a.jobId;switch(b){case "result":this._OnJobResult(e,a.result);break;case "progress":this._OnJobProgress(e,a.progress);break;case "error":this._OnJobError(e,a.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${b}'`);
|
|
}}_OnJobResult(a,b){const e=this._jobPromises.get(a);if(!e)throw Error("invalid job ID");e.cancelled||e.resolve(b);this._jobPromises.delete(a)}_OnJobProgress(a,b){a=this._jobPromises.get(a);if(!a)throw Error("invalid job ID");!a.cancelled&&a.progress&&a.progress(b)}_OnJobError(a,b){const e=this._jobPromises.get(a);if(!e)throw Error("invalid job ID");e.cancelled||e.reject(b);this._jobPromises.delete(a)}_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=a=>this._OnJobWorkerMessage(a)}catch(a){this._hadErrorCreatingWorker=!0,this._isCreatingWorker=
|
|
!1,console.error(`[Construct 3] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,a)}}}}self.C3_Shaders={};
|
|
{"use strict";const d=self.C3;let a=null,b="",e="",c=[],f="",g="",h="";const l=d.New(d.ArrayStack);function m(p,x){p=p[1];x=x[1];if("number"===typeof p&&"number"===typeof x)return p-x;p=""+p;x=""+x;return p<x?-1:p>x?1:0}d.Plugins.System=class extends d.SDKPluginBase{constructor(p){super(p);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(p){this._runtime.Trigger(p,null,null)}GetRegex(p,x){a&&p===b&&x===e||(a=new RegExp(p,x),b=p,e=x);a.lastIndex=0;return a}GetRegexMatches(p,x,v){if(p===f&&x===g&&v===h)return c;const r=this.GetRegex(x,v);c=p.match(r);f=p;g=x;h=v;return c}async _LoadTexturesForObjectClasses(p,x){if(x.length){this._imagesLoadingTotal+=x.length;var v=[];for(const r of x)v.push(p.MaybeLoadTexturesFor(r));await d.PromiseAllWithProgress(v,
|
|
()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&(this._runtime.Trigger(d.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(p,x){for(const v of x)0===v.GetInstanceCount()&&p.MaybeUnloadTexturesFor(v)}_GetForEachStack(){return l}_Repeat(p){var x=this._runtime.GetEventSheetManager();const v=x.GetEventStack(),r=v.GetCurrentStackFrame(),
|
|
q=r.GetCurrentEvent(),y=q.GetSolModifiers();var u=r.IsSolModifierAfterCnds();const t=v.Push(q),A=x.GetLoopStack(),z=A.Push();z.SetEnd(p);if(u)for(u=0;u<p&&!z.IsStopped();++u)x.PushCopySol(y),z.SetIndex(u),q.Retrigger(r,t),x.PopSol(y);else for(x=0;x<p&&!z.IsStopped();++x)z.SetIndex(x),q.Retrigger(r,t);v.Pop();A.Pop();return!1}*_DebugRepeat(p){var x=this._runtime.GetEventSheetManager();const v=x.GetEventStack(),r=v.GetCurrentStackFrame(),q=r.GetCurrentEvent(),y=q.GetSolModifiers();var u=r.IsSolModifierAfterCnds();
|
|
const t=v.Push(q),A=x.GetLoopStack(),z=A.Push();z.SetEnd(p);if(u)for(u=0;u<p&&!z.IsStopped();++u)x.PushCopySol(y),z.SetIndex(u),yield*q.DebugRetrigger(r,t),x.PopSol(y);else for(x=0;x<p&&!z.IsStopped();++x)z.SetIndex(x),yield*q.DebugRetrigger(r,t);v.Pop();A.Pop();return!1}_While(){var p=this._runtime.GetEventSheetManager();const x=p.GetEventStack(),v=x.GetCurrentStackFrame(),r=v.GetCurrentEvent(),q=r.GetSolModifiers();var y=v.IsSolModifierAfterCnds();const u=x.Push(r),t=p.GetLoopStack(),A=t.Push();
|
|
if(y)for(y=0;!A.IsStopped();++y)p.PushCopySol(q),A.SetIndex(y),r.Retrigger(v,u)||A.Stop(),p.PopSol(q);else for(p=0;!A.IsStopped();++p)A.SetIndex(p),r.Retrigger(v,u)||A.Stop();x.Pop();t.Pop();return!1}*_DebugWhile(){var p=this._runtime.GetEventSheetManager();const x=p.GetEventStack(),v=x.GetCurrentStackFrame(),r=v.GetCurrentEvent(),q=r.GetSolModifiers();var y=v.IsSolModifierAfterCnds();const u=x.Push(r),t=p.GetLoopStack(),A=t.Push();if(y)for(y=0;!A.IsStopped();++y)p.PushCopySol(q),A.SetIndex(y),(yield*r.DebugRetrigger(v,
|
|
u))||A.Stop(),p.PopSol(q);else for(p=0;!A.IsStopped();++p)A.SetIndex(p),(yield*r.DebugRetrigger(v,u))||A.Stop();x.Pop();t.Pop();return!1}_For(p,x,v){var r=this._runtime.GetEventSheetManager();const q=r.GetEventStack(),y=q.GetCurrentStackFrame(),u=y.GetCurrentEvent(),t=u.GetSolModifiers(),A=y.IsSolModifierAfterCnds(),z=q.Push(u),C=r.GetLoopStack(),E=C.Push();E.SetName(p);E.SetEnd(v);if(v<x)if(A)for(p=x;p>=v&&!E.IsStopped();--p)r.PushCopySol(t),E.SetIndex(p),u.Retrigger(y,z),r.PopSol(t);else for(r=
|
|
x;r>=v&&!E.IsStopped();--r)E.SetIndex(r),u.Retrigger(y,z);else if(A)for(p=x;p<=v&&!E.IsStopped();++p)r.PushCopySol(t),E.SetIndex(p),u.Retrigger(y,z),r.PopSol(t);else for(r=x;r<=v&&!E.IsStopped();++r)E.SetIndex(r),u.Retrigger(y,z);q.Pop();C.Pop();return!1}*_DebugFor(p,x,v){var r=this._runtime.GetEventSheetManager();const q=r.GetEventStack(),y=q.GetCurrentStackFrame(),u=y.GetCurrentEvent(),t=u.GetSolModifiers(),A=y.IsSolModifierAfterCnds(),z=q.Push(u),C=r.GetLoopStack(),E=C.Push();E.SetName(p);E.SetEnd(v);
|
|
if(v<x)if(A)for(p=x;p>=v&&!E.IsStopped();--p)r.PushCopySol(t),E.SetIndex(p),yield*u.DebugRetrigger(y,z),r.PopSol(t);else for(r=x;r>=v&&!E.IsStopped();--r)E.SetIndex(r),yield*u.DebugRetrigger(y,z);else if(A)for(p=x;p<=v&&!E.IsStopped();++p)r.PushCopySol(t),E.SetIndex(p),yield*u.DebugRetrigger(y,z),r.PopSol(t);else for(r=x;r<=v&&!E.IsStopped();++r)E.SetIndex(r),yield*u.DebugRetrigger(y,z);q.Pop();C.Pop();return!1}_ForEach(p){var x=this._runtime.GetEventSheetManager();const v=x.GetEventStack(),r=v.GetCurrentStackFrame(),
|
|
q=r.GetCurrentEvent(),y=q.GetSolModifiers();var u=r.IsSolModifierAfterCnds();const t=v.Push(q),A=x.GetLoopStack(),z=A.Push(),C=p.IsInContainer(),E=p.GetCurrentSol(),J=l.Push();d.shallowAssignArray(J,E.GetInstances());z.SetEnd(J.length);if(u)for(let G=0,I=J.length;G<I&&!z.IsStopped();++G)x.PushCopySol(y),u=J[G],p.GetCurrentSol().SetSinglePicked(u),C&&u.SetSiblingsSinglePicked(),z.SetIndex(G),q.Retrigger(r,t),x.PopSol(y);else{E._SetSelectAll(!1);p=E._GetOwnInstances();d.clearArray(p);p.push(null);for(let G=
|
|
0,I=J.length;G<I&&!z.IsStopped();++G)x=J[G],p[0]=x,C&&x.SetSiblingsSinglePicked(),z.SetIndex(G),q.Retrigger(r,t)}v.Pop();A.Pop();d.clearArray(J);l.Pop();return!1}*_DebugForEach(p){var x=this._runtime.GetEventSheetManager();const v=x.GetEventStack(),r=v.GetCurrentStackFrame(),q=r.GetCurrentEvent(),y=q.GetSolModifiers();var u=r.IsSolModifierAfterCnds();const t=v.Push(q),A=x.GetLoopStack(),z=A.Push(),C=p.IsInContainer(),E=p.GetCurrentSol(),J=l.Push();d.shallowAssignArray(J,E.GetInstances());z.SetEnd(J.length);
|
|
if(u)for(let G=0,I=J.length;G<I&&!z.IsStopped();++G)x.PushCopySol(y),u=J[G],p.GetCurrentSol().SetSinglePicked(u),C&&u.SetSiblingsSinglePicked(),z.SetIndex(G),yield*q.DebugRetrigger(r,t),x.PopSol(y);else{E._SetSelectAll(!1);p=E._GetOwnInstances();d.clearArray(p);p.push(null);for(let G=0,I=J.length;G<I&&!z.IsStopped();++G)x=J[G],p[0]=x,C&&x.SetSiblingsSinglePicked(),z.SetIndex(G),yield*q.DebugRetrigger(r,t)}v.Pop();A.Pop();d.clearArray(J);l.Pop();return!1}_ForEachOrdered(p,x){var v=this._runtime.GetEventSheetManager();
|
|
const r=v.GetEventStack(),q=v.GetCurrentCondition(),y=r.GetCurrentStackFrame(),u=y.GetCurrentEvent(),t=u.GetSolModifiers(),A=y.IsSolModifierAfterCnds(),z=r.Push(u),C=v.GetLoopStack(),E=C.Push(),J=p.IsInContainer(),G=p.GetCurrentSol(),I=l.Push();d.clearArray(I);const L=G.GetInstances();E.SetEnd(L.length);for(let N=0,S=L.length;N<S;++N)I.push([L[N],q.ReevaluateParameter(1,N)]);I.sort(m);1===x&&I.reverse();if(A)for(let N=0,S=I.length;N<S&&!E.IsStopped();++N)v.PushCopySol(t),x=I[N][0],p.GetCurrentSol().SetSinglePicked(x),
|
|
J&&x.SetSiblingsSinglePicked(),E.SetIndex(N),u.Retrigger(y,z),v.PopSol(t);else{G._SetSelectAll(!1);p=G._GetOwnInstances();d.clearArray(p);p.push(null);for(let N=0,S=I.length;N<S&&!E.IsStopped();++N)v=I[N][0],p[0]=v,J&&v.SetSiblingsSinglePicked(),E.SetIndex(N),u.Retrigger(y,z)}r.Pop();C.Pop();d.clearArray(I);l.Pop();return!1}*_DebugForEachOrdered(p,x){var v=this._runtime.GetEventSheetManager();const r=v.GetEventStack(),q=v.GetCurrentCondition(),y=r.GetCurrentStackFrame(),u=y.GetCurrentEvent(),t=u.GetSolModifiers(),
|
|
A=y.IsSolModifierAfterCnds(),z=r.Push(u),C=v.GetLoopStack(),E=C.Push(),J=p.IsInContainer(),G=p.GetCurrentSol(),I=l.Push();d.clearArray(I);const L=G.GetInstances();E.SetEnd(L.length);for(let N=0,S=L.length;N<S;++N)I.push([L[N],q.ReevaluateParameter(1,N)]);I.sort(m);1===x&&I.reverse();if(A)for(let N=0,S=I.length;N<S&&!E.IsStopped();++N)v.PushCopySol(t),x=I[N][0],p.GetCurrentSol().SetSinglePicked(x),J&&x.SetSiblingsSinglePicked(),E.SetIndex(N),yield*u.DebugRetrigger(y,z),v.PopSol(t);else{G._SetSelectAll(!1);
|
|
p=G._GetOwnInstances();d.clearArray(p);p.push(null);for(let N=0,S=I.length;N<S&&!E.IsStopped();++N)v=I[N][0],p[0]=v,J&&v.SetSiblingsSinglePicked(),E.SetIndex(N),yield*u.DebugRetrigger(y,z)}r.Pop();C.Pop();d.clearArray(I);l.Pop();return!1}_GetFunctionMap(p,x){let v=this._functionMaps.get(p);if(v)return v;if(!x)return null;v={defaultFunc:null,strMap:new Map};this._functionMaps.set(p,v);return v}_DoCallMappedFunction(p,x,v,r,q){x.GetEventBlock().RunAsMappedFunctionCall(v);r&&p.PopSol(q)}*_DebugDoCallMappedFunction(p,
|
|
x,v,r,q){yield*x.GetEventBlock().DebugRunAsMappedFunctionCall(v);r&&p.PopSol(q)}}}{"use strict";const d=self.C3;d.Plugins.System.Type=class extends d.DefendedBase{constructor(a){super();this._objectClass=a;this._runtime=a.GetRuntime();this._plugin=a.GetPlugin()}OnCreate(){}Release(){this._plugin=this._runtime=this._objectClass=null}}}
|
|
{"use strict";const d=self.C3;d.Plugins.System.Instance=class extends d.DefendedBase{constructor(a,b){super();this._inst=a;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 d=self.C3,a=[];d.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 b=this._runtime.GetCurrentEventStackFrame();return b.GetElseBranchRan()?!1:!b.GetLastEventTrue()},TriggerOnce(){const b=this._runtime.GetCurrentCondition().GetSavedDataMap();let e=b.get("TriggerOnce_lastTick");"undefined"===typeof e&&(e=-1,b.set("TriggerOnce_lastTick",
|
|
-1));const c=this._runtime.GetTickCount();b.set("TriggerOnce_lastTick",c);return this._runtime.IsLayoutFirstTick()||e!==c-1},Every(b){const e=this._runtime.GetCurrentCondition().GetSavedDataMap(),c=e.get("Every_lastTime")||0,f=this._runtime.GetGameTime();e.has("Every_seconds")||e.set("Every_seconds",b);const g=e.get("Every_seconds");if(f>=c+g)return e.set("Every_lastTime",c+g),f>=e.get("Every_lastTime")+.04&&e.set("Every_lastTime",f),e.set("Every_seconds",b),!0;f<c-.1&&e.set("Every_lastTime",f);return!1},
|
|
IsGroupActive(b){return(b=this._runtime.GetEventSheetManager().GetEventGroupByName(b))&&b.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return d.Platform.IsMobile},OnLoadFinished(){return!0},OnCanvasSnapshot(){return!0},EffectsSupported(){return!0},OnSaveComplete(){return!0},OnSaveFailed(){return!0},OnLoadComplete(){return!0},OnLoadFailed(){return!0},ObjectUIDExists(b){return!!this._runtime.GetInstanceByUID(b)},IsOnPlatform(b){switch(b){case 0:return"browser"===d.Platform.Context;
|
|
case 1:return"iOS"===d.Platform.OS;case 2:return"Android"===d.Platform.OS;case 8:return"cordova"===d.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===d.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(b,e,c){return this.GetRegex(e,c).test(b)},Compare(b,e,c){return d.compare(b,e,c)},CompareBetween(b,e,c){return b>=e&&b<=c},CompareVar(b,e,c){return d.compare(b.GetValue(),e,c)},CompareBoolVar(b){return!!b.GetValue()},
|
|
CompareTime(b,e){const c=this._runtime.GetGameTime();return 0===b?(b=this._runtime.GetCurrentCondition().GetSavedDataMap(),!b.get("CompareTime_executed")&&c>=e?(b.set("CompareTime_executed",!0),!0):!1):d.compare(c,b,e)},IsNaN(b){return isNaN(b)},AngleWithin(b,e,c){return d.angleDiff(d.toRadians(b),d.toRadians(c))<=d.toRadians(e)},IsClockwiseFrom(b,e){return d.angleClockwise(d.toRadians(b),d.toRadians(e))},IsBetweenAngles(b,e,c){b=d.toRadians(b);e=d.toRadians(e);c=d.toRadians(c);return d.angleClockwise(c,
|
|
e)?d.angleClockwise(b,e)&&!d.angleClockwise(b,c):!(!d.angleClockwise(b,e)&&d.angleClockwise(b,c))},IsValueType(b,e){return"number"===typeof b?0===e:1===e},EvaluateExpression(b){return!!b},PickByComparison(b,e,c,f){if(!b)return!1;const g=this._GetForEachStack(),h=g.Push(),l=b.GetCurrentSol();d.shallowAssignArray(h,l.GetInstances());l.IsSelectAll()&&d.clearArray(l._GetOwnElseInstances());const m=this._runtime.GetCurrentCondition();let p=0;for(let x=0,v=h.length;x<v;++x){const r=h[x];h[p]=r;e=m.ReevaluateParameter(1,
|
|
x);f=m.ReevaluateParameter(3,x);d.compare(e,c,f)?++p:l._PushElseInstance(r)}d.truncateArray(h,p);l.SetArrayPicked(h);e=!!h.length;d.clearArray(h);g.Pop();b.ApplySolToContainer();return e},PickByEvaluate(b,e){if(!b)return!1;const c=this._GetForEachStack(),f=c.Push(),g=b.GetCurrentSol();d.shallowAssignArray(f,g.GetInstances());g.IsSelectAll()&&d.clearArray(g._GetOwnElseInstances());const h=this._runtime.GetCurrentCondition();let l=0;for(let m=0,p=f.length;m<p;++m){const x=f[m];f[l]=x;(e=h.ReevaluateParameter(1,
|
|
m))?++l:g._PushElseInstance(x)}d.truncateArray(f,l);g.SetArrayPicked(f);e=!!f.length;d.clearArray(f);c.Pop();b.ApplySolToContainer();return e},PickNth(b,e){if(!b)return!1;const c=b.GetCurrentSol(),f=c.GetInstances();e=Math.floor(e);if(e>=f.length)return!1;c.PickOne(f[e]);b.ApplySolToContainer();return!0},PickRandom(b){if(!b)return!1;const e=b.GetCurrentSol(),c=e.GetInstances(),f=Math.floor(this._runtime.Random()*c.length);if(f>=c.length)return!1;e.PickOne(c[f]);b.ApplySolToContainer();return!0},PickAll(b){if(!b||
|
|
!b.GetInstanceCount())return!1;b.GetCurrentSol()._SetSelectAll(!0);b.ApplySolToContainer();return!0},PickOverlappingPoint(b,e,c){if(!b)return!1;const f=b.GetCurrentSol();var g=f.GetInstances();const h=this._runtime.GetCurrentEvent().IsOrBlock(),l=this._runtime.GetCurrentCondition().IsInverted();f.IsSelectAll()?(d.shallowAssignArray(a,g),f.ClearArrays(),f._SetSelectAll(!1)):h?(d.shallowAssignArray(a,f._GetOwnElseInstances()),d.clearArray(f._GetOwnElseInstances())):(d.shallowAssignArray(a,f._GetOwnInstances()),
|
|
d.clearArray(f._GetOwnInstances()));for(let m=0,p=a.length;m<p;++m)g=a[m],d.xor(g.GetWorldInfo().ContainsPoint(e,c),l)?f._PushInstance(g):f._PushElseInstance(g);b.ApplySolToContainer();return d.xor(!!f._GetOwnInstances().length,l)},PickLastCreated(b){if(!b)return!1;var e=b.IsFamily();let c=null;const f=this._runtime._GetInstancesPendingCreate();for(let g=f.length-1;0<=g;--g){const h=f[g];if(e){if(h.GetObjectClass().BelongsToFamily(b)){c=h;break}}else if(h.GetObjectClass()===b){c=h;break}}c||(e=b.GetInstances(),
|
|
e.length&&(c=e[e.length-1]));if(!c)return!1;b.GetCurrentSol().PickOne(c);b.ApplySolToContainer();return!0},Repeat(b){return this._runtime.IsDebugging()?this._DebugRepeat(b):this._Repeat(b)},While(){return this._runtime.IsDebugging()?this._DebugWhile():this._While()},For(b,e,c){return this._runtime.IsDebugging()?this._DebugFor(b,e,c):this._For(b,e,c)},ForEach(b){return this._runtime.IsDebugging()?this._DebugForEach(b):this._ForEach(b)},ForEachOrdered(b,e,c){return this._runtime.IsDebugging()?this._DebugForEachOrdered(b,
|
|
c):this._ForEachOrdered(b,c)},LayerVisible(b){return b?b.IsVisible():!1},LayerEmpty(b){return b?!b.GetInstanceCount():!1},LayerCmpOpacity(b,e,c){return b?d.compare(100*b.GetOpacity(),e,c):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}}
|
|
{"use strict";const d=self.C3;function a(h,l){const m=h[0]-l[0];return 0!==m?m:h[1]-l[1]}function b(h,l){return h[1]-l[1]}const e=[],c=[],f=d.New(d.Rect),g=d.New(d.Color);d.Plugins.System.Acts={SetVar(h,l){h.SetValue(l)},AddVar(h,l){h.IsNumber()&&"number"!==typeof l&&(l=parseFloat(l));h.SetValue(h.GetValue()+l)},SubVar(h,l){h.IsNumber()&&h.SetValue(h.GetValue()-l)},SetBoolVar(h,l){h.SetValue(!!l)},ToggleBoolVar(h){h.SetValue(!h.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},
|
|
CreateObject(h,l,m,p,x){h&&l&&(m=this._runtime.CreateInstance(h,l,m,p,x))&&(x&&l.SortAndAddSceneGraphInstancesByZIndex(m),l=this._runtime.GetEventSheetManager(),l.BlockFlushingInstances(!0),m._TriggerOnCreatedOnSelfAndRelated(),l.BlockFlushingInstances(!1),h.GetCurrentSol().SetSinglePicked(m),m.IsInContainer()&&m.SetSiblingsSinglePicked())},CreateObjectByName(h,l,m,p,x){h&&l&&(h=this._runtime.GetObjectClassByName(h))&&d.Plugins.System.Acts.CreateObject.call(this,h,l,m,p,x)},RecreateInitialObjects(h,
|
|
l,m,p,x,v,r,q,y,u){if(h){var t=this._runtime.GetCurrentLayout();if(v&&(t=this._runtime.GetLayoutManager().GetLayoutByName(v),!t))return;v=null;if("number"!==typeof r||0<=r)if(v=t.GetLayer(r),!v)return;f.set(l,m,p,x);l=t.RecreateInitialObjects(h,f,v,q,y,u);h.GetCurrentSol().SetArrayPicked(l);h.ApplySolToContainer()}},StopLoop(){const h=this._loopStack;h.IsInLoop()&&h.GetCurrent().Stop()},SetGroupActive(h,l){(h=this._runtime.GetEventSheetManager().GetEventGroupByName(h))&&(0===l?h.SetGroupActive(!1):
|
|
1===l?h.SetGroupActive(!0):h.SetGroupActive(!h.IsGroupActive()))},SetTimescale(h){this._runtime.SetTimeScale(h)},SetObjectTimescale(h,l){0>l&&(l=0);if(h){h=h.GetCurrentSol().GetInstances();for(const m of h)m.SetTimeScale(l)}},RestoreObjectTimescale(h){if(h){h=h.GetCurrentSol().GetInstances();for(const l of h)l.RestoreTimeScale()}},Wait(h){if(!(0>h))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(h),!0},WaitForSignal(h){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(h);
|
|
return!0},WaitForPreviousActions(){const h=this._runtime.GetEventSheetManager();h.AddScheduledWait().InitPromise(h.GetPromiseForAllAsyncActions());return!0},Signal(h){h=h.toLowerCase();for(const l of this._runtime.GetEventSheetManager().scheduledWaits())l.IsSignal()&&l.GetSignalTag()===h&&l.SetSignalled()},async SnapshotCanvas(h,l,m,p,x,v){const r=this._runtime.GetCanvasManager();r&&(this.UpdateRender(),await r.SnapshotCanvas(0===h?"image/png":"image/jpeg",l/100,m,p,x,v),await this._runtime.TriggerAsync(d.Plugins.System.Cnds.OnCanvasSnapshot,
|
|
null))},SetCanvasSize(h,l){if(!(0>=h||0>=l)){this._runtime.SetViewportSize(h,l);var m=this._runtime.GetCurrentLayout();m.BoundScrolling();for(const p of m.GetLayers())p.UpdateViewport();if(m=this._runtime.GetCanvasManager())"off"!==m.GetCurrentFullscreenMode()&&this._runtime.SetOriginalViewportSize(h,l),m.SetSize(m.GetLastWidth(),m.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(h){const l=this._runtime.GetCanvasManager();l&&"off"!==l.GetCurrentFullscreenMode()&&(l.SetFullscreenScalingQuality(0!==
|
|
h?"high":"low"),l.SetSize(l.GetLastWidth(),l.GetLastHeight(),!0))},SaveState(h){this._runtime.SaveToSlot(h)},LoadState(h){this._runtime.LoadFromSlot(h)},LoadStateJSON(h){this._runtime.LoadFromJsonString(h)},SetHalfFramerateMode(h){},ResetPersisted(){for(const h of this._runtime.GetLayoutManager().GetAllLayouts())h.ResetPersistData()},SetPixelRounding(h){this._runtime.SetPixelRoundingEnabled(0!==h)},SetMinimumFramerate(h){this._runtime.SetMinimumFramerate(h)},SortZOrderByInstVar(h,l){if(h){var m=h.GetCurrentSol().GetInstances(),
|
|
p=this._runtime.GetCurrentLayout(),x=h.IsFamily();h=h.GetFamilyIndex();for(let r=0,q=m.length;r<q;++r){var v=m[r];const y=v.GetWorldInfo();if(!y)continue;let u;u=x?v.GetInstanceVariableValue(l+v.GetObjectClass().GetFamilyInstanceVariableOffset(h)):v.GetInstanceVariableValue(l);e.push([y.GetLayer().GetIndex(),y.GetZIndex()]);c.push([v,u])}if(e.length){e.sort(a);c.sort(b);l=!1;for(let r=0,q=e.length;r<q;++r)m=c[r][0],x=p.GetLayerByIndex(e[r][0]),h=e[r][1],v=x._GetInstances(),v[h]!==m&&(v[h]=m,m.GetWorldInfo()._SetLayer(x),
|
|
x.SetZIndicesChanged(),l=!0);l&&this._runtime.UpdateRender();d.clearArray(e);d.clearArray(c)}}},GoToLayout(h){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||l.ChangeMainLayout(h)}},GoToLayoutByName(h){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||(h=l.GetLayoutByName(h))&&l.ChangeMainLayout(h)}},NextPrevLayout(h){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();if(!l.IsPendingChangeMainLayout()){var m=
|
|
l.GetAllLayouts(),p=m.indexOf(l.GetMainRunningLayout());h&&0===p||(h||p!==m.length-1)&&l.ChangeMainLayout(m[p+(h?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var h=this._runtime.GetLayoutManager();h.IsPendingChangeMainLayout()||(h.ChangeMainLayout(h.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(h,l){h&&h.SetVisible(l)},SetLayerOpacity(h,l){h&&h.SetOpacity(l/100)},SetLayerScale(h,l){h&&h.SetOwnScale(l)},SetLayerScaleRate(h,
|
|
l){h&&h.SetScaleRate(l)},SetLayerAngle(h,l){h&&h.SetAngle(d.toRadians(+l))},SetLayerScroll(h,l,m){h&&(h.SetOwnScrollPositionEnabled(!0),h.SetScrollX(l),h.SetScrollY(m))},RestoreLayerScroll(h){h&&h.SetOwnScrollPositionEnabled(!1)},SetLayerParallax(h,l,m){h&&h.SetParallax(l/100,m/100)},SetLayerZElevation(h,l){h&&h.SetZElevation(+l)},SetLayerBackground(h,l){h&&(g.setFromRgbValue(l),g.clamp(),h=h.GetBackgroundColor(),h.equalsIgnoringAlpha(g)||(h.copyRgb(g),this.UpdateRender()))},SetLayerTransparent(h,
|
|
l){h&&h.SetTransparent(l)},SetLayerBlendMode(h,l){h&&h.SetBlendMode(l)},SetLayerEffectEnabled(h,l,m){h&&(h=h.GetEffectList(),m=h.GetEffectTypeByName(m))&&(l=1===l,m.IsActive()!==l&&(m.SetActive(l),h.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(h,l,m,p){if(h&&(h=h.GetEffectList(),l=h.GetEffectTypeByName(l))){var x=l.GetIndex();h=h.GetEffectParametersForIndex(x);m=Math.floor(m);if(!(0>m||m>=h.length)){x=l.GetShaderProgram().GetParameterType(m);if("color"===x){g.setFromRgbValue(p);
|
|
m=h[m];if(g.equalsIgnoringAlpha(m))return;m.copyRgb(g)}else{"percent"===x&&(p/=100);if(h[m]===p)return;h[m]=p}l.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(h,l){h&&h.SetForceOwnTexture(l)},SetLayoutScale(h){this._runtime.GetCurrentLayout().SetScale(+h)},SetLayoutAngle(h){this._runtime.GetCurrentLayout().SetAngle(d.toRadians(+h))},SetLayoutEffectEnabled(h,l){const m=this._runtime.GetCurrentLayout().GetEffectList();if(l=m.GetEffectTypeByName(l))h=1===h,l.IsActive()!==h&&(l.SetActive(h),
|
|
m.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(h,l,m){var p=this._runtime.GetCurrentLayout().GetEffectList();if(h=p.GetEffectTypeByName(h)){var x=h.GetIndex();p=p.GetEffectParametersForIndex(x);l=Math.floor(l);if(!(0>l||l>=p.length)){x=h.GetShaderProgram().GetParameterType(l);if("color"===x){g.setFromRgbValue(m);l=p[l];if(g.equalsIgnoringAlpha(l))return;l.copyRgb(g)}else{"percent"===x&&(m/=100);if(p[l]===m)return;p[l]=m}h.IsActive()&&this._runtime.UpdateRender()}}},SetLayoutVanishingPoint(h,
|
|
l){this._runtime.GetCurrentLayout().SetVanishingPointXY(h/100,l/100)},ScrollX(h){this._runtime.GetCurrentLayout().SetScrollX(h)},ScrollY(h){this._runtime.GetCurrentLayout().SetScrollY(h)},Scroll(h,l){const m=this._runtime.GetCurrentLayout();m.SetScrollX(h);m.SetScrollY(l)},ScrollToObject(h){if(h&&(h=h.GetFirstPicked())&&(h=h.GetWorldInfo())){var l=this._runtime.GetCurrentLayout();l.SetScrollX(h.GetX());l.SetScrollY(h.GetY())}},async LoadObjectTextures(h){const l=this._runtime.GetMainRunningLayout();
|
|
l&&h&&!this._runtime.IsLoading()&&(h=h.IsFamily()?h.GetFamilyMembers():[h],await this._LoadTexturesForObjectClasses(l,h))},async LoadObjectTexturesByName(h){await d.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(h))},UnloadObjectTextures(h){const l=this._runtime.GetMainRunningLayout();l&&h&&(h=h.IsFamily()?h.GetFamilyMembers():[h],this._UnloadTexturesForObjectClasses(l,h))},UnloadObjectTexturesByName(h){d.Plugins.System.Acts.UnloadObjectTexturesByName.call(this,
|
|
this._runtime.GetObjectClassByName(h))},UnloadUnusedTextures(){const h=this._runtime.GetMainRunningLayout();if(h){var l=h._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(h,l)}},async LoadLayoutTextures(h){const l=this._runtime.GetMainRunningLayout();h&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,h._GetInitialObjectClasses())},async LoadLayoutTexturesByName(h){const l=this._runtime.GetMainRunningLayout();(h=this._runtime.GetLayoutManager().GetLayoutByName(h))&&
|
|
l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,h._GetInitialObjectClasses())},SetFunctionReturnValue(h){const l=this._eventStack.GetCurrentExpFuncStackFrame();if(l)switch(l.GetFunctionReturnType()){case 1:"number"===typeof h&&l.SetFunctionReturnValue(h);break;case 2:"string"===typeof h&&l.SetFunctionReturnValue(h);break;case 3:l.SetFunctionReturnValue(h)}},MapFunction(h,l,m){var p=this._GetFunctionMap(h.toLowerCase(),!0);const x=p.strMap,v=l.toLowerCase();x.has(v)&&console.warn(`[Construct 3] Function map '${h}' string '${l}' already in map; overwriting entry`);
|
|
if(p=d.first(x.values())||p.defaultFunc){p=0!==p.GetReturnType();const r=0!==m.GetReturnType();if(p!==r){console.error(`[Construct 3] Function map '${h}' string '${l}' function return type not compatible with other functions in the map; entry ignored`);return}}x.set(v,m)},MapFunctionDefault(h,l){const m=this._GetFunctionMap(h.toLowerCase(),!0);m.defaultFunc&&console.warn(`[Construct 3] Function map '${h}' already has a default; overwriting entry`);var p=d.first(m.strMap.values())||m.defaultFunc;if(p){p=
|
|
0!==p.GetReturnType();const x=0!==l.GetReturnType();if(p!==x){console.error(`[Construct 3] Function map '${h}' default: function return type not compatible with other functions in the map; entry ignored`);return}}m.defaultFunc=l},CallMappedFunction(h,l,m){m=Math.floor(m);var p=this._GetFunctionMap(h.toLowerCase(),!1);if(p){var x=p.strMap.get(l.toLowerCase());if(!x)if(p.defaultFunc)x=p.defaultFunc,m=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${h}' string '${l}'; call ignored (consider setting a default)`);
|
|
return}if(x.IsEnabled())if(0!==x.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${h}' string '${l}' has a return type so cannot be called`);else{h=this._runtime;l=h.GetEventSheetManager();var v=l.GetCurrentEvent();p=v.GetSolModifiersIncludingParents();var r=0<p.length;r&&l.PushCleanSol(p);var q=[];if(v=l.FindFirstFunctionBlockParent(v)){v=v.GetFunctionParameters();for(let y=m,u=v.length;y<u;++y)q.push(v[y].GetValue())}m=x.GetFunctionParameters();for(let y=q.length,u=m.length;y<
|
|
u;++y)q.push(m[y].GetInitialValue());return h.IsDebugging()?this._DebugDoCallMappedFunction(l,x,q,r,p):this._DoCallMappedFunction(l,x,q,r,p)}}else console.warn(`[Construct 3] Call mapped function: map name '${h}' not found; call ignored`)}}}
|
|
{"use strict";const d=self.C3;d.Plugins.System.Exps={int:function(a){"string"===typeof a&&(a=parseInt(a,10),isNaN(a)&&(a=0));return Math.floor(a)},float:function(a){"string"===typeof a&&(a=parseFloat(a),isNaN(a)&&(a=0));return a},str(a){return a.toString()},len(a){return"string"===typeof a?a.length:0},random(a,b){return"undefined"===typeof b?this._runtime.Random()*a:this._runtime.Random()*(b-a)+a},choose(...a){const b=Math.floor(this._runtime.Random()*a.length);return a[b]},pi(){return Math.PI},infinity(){return Infinity},
|
|
sqrt(a){return Math.sqrt(a)},abs(a){return Math.abs(a)},round(a){return Math.round(a)},roundtodp(a,b){b=Math.max(Math.floor(b),0);b=Math.pow(10,b);return Math.round((a+Number.EPSILON)*b)/b},floor(a){return Math.floor(a)},ceil(a){return Math.ceil(a)},sign(a){return Math.sign(a)},sin(a){return Math.sin(d.toRadians(a))},cos(a){return Math.cos(d.toRadians(a))},tan(a){return Math.tan(d.toRadians(a))},asin(a){return d.toDegrees(Math.asin(a))},acos(a){return d.toDegrees(Math.acos(a))},atan(a){return d.toDegrees(Math.atan(a))},
|
|
exp(a){return Math.exp(a)},ln(a){return Math.log(a)},log10(a){return Math.log(a)/Math.LN10},max(...a){let b=a[0];"number"!==typeof b&&(b=0);for(let e=1,c=a.length;e<c;++e){let f=a[e];"number"===typeof f&&b<f&&(b=f)}return b},min(...a){let b=a[0];"number"!==typeof b&&(b=0);for(let e=1,c=a.length;e<c;++e){let f=a[e];"number"===typeof f&&b>f&&(b=f)}return b},clamp(a,b,e){return d.clamp(a,b,e)},distance(a,b,e,c){return d.distanceTo(a,b,e,c)},angle(a,b,e,c){return d.toDegrees(d.angleTo(a,b,e,c))},lerp(a,
|
|
b,e){return d.lerp(a,b,e)},unlerp(a,b,e){return d.unlerp(a,b,e)},qarp(a,b,e,c){return d.qarp(a,b,e,c)},cubic(a,b,e,c,f){return d.cubic(a,b,e,c,f)},cosp(a,b,e){return d.cosp(a,b,e)},anglediff(a,b){return d.toDegrees(d.angleDiff(d.toRadians(a),d.toRadians(b)))},anglelerp(a,b,e){return d.toDegrees(d.angleLerp(d.toRadians(a),d.toRadians(b),e))},anglerotate(a,b,e){return d.toDegrees(d.angleRotate(d.toRadians(a),d.toRadians(b),d.toRadians(e)))},setbit(a,b,e){b|=0;return(a|0)&~(1<<b)|(0!==e?1:0)<<b},togglebit(a,
|
|
b){return(a|0)^1<<(b|0)},getbit(a,b){return(a|0)&1<<(b|0)?1:0},newline(){return"\n"},uppercase(a){return"string"===typeof a?a.toUpperCase():""},lowercase(a){return"string"===typeof a?a.toLowerCase():""},left(a,b){return"string"===typeof a?a.substr(0,b):""},mid(a,b,e){return"string"!==typeof a?"":0>e?a.substr(b):a.substr(b,e)},right(a,b){return"string"===typeof a?a.substr(a.length-b):""},trim(a){return"string"===typeof a?a.trim():""},tokenat(a,b,e){if("string"!==typeof a||"string"!==typeof e)return"";
|
|
a=a.split(e);b=Math.floor(b);return 0>b||b>=a.length?"":a[b]},tokencount(a,b){return"string"===typeof a&&"string"===typeof b&&a.length?a.split(b).length:0},find(a,b){return"string"===typeof a&&"string"===typeof b?a.search(new RegExp(d.EscapeRegex(b),"i")):-1},findcase(a,b){return"string"===typeof a&&"string"===typeof b?a.search(new RegExp(d.EscapeRegex(b),"")):-1},replace(a,b,e){return"string"===typeof a&&"string"===typeof b&&"string"===typeof e?a.replace(new RegExp(d.EscapeRegex(b),"gi"),e):"string"===
|
|
typeof a?a:""},regexsearch(a,b,e){b=this.GetRegex(b,e);return a?a.search(b):-1},regexreplace(a,b,e,c){b=this.GetRegex(b,e);return a?a.replace(b,c):""},regexmatchcount(a,b,e){return(a=this.GetRegexMatches(a.toString(),b,e))?a.length:0},regexmatchat(a,b,e,c){c=Math.floor(c);a=this.GetRegexMatches(a.toString(),b,e);return!a||0>c||c>=a.length?"":a[c]},zeropad(a,b){let e=0>a?"-":"";0>a&&(a=-a);e+="0".repeat(Math.max(b-a.toString().length,0));return e+a.toString()},urlencode(a){return encodeURIComponent(a)},
|
|
urldecode(a){return decodeURIComponent(a)},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 d.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},viewportleft(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().getLeft():
|
|
0},viewporttop(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().getTop():0},viewportright(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().getRight():0},viewportbottom(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().getBottom():0},viewportwidth(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().width():0},viewportheight(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetViewport().height():
|
|
0},canvastolayerx(a,b,e){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.CanvasCssToLayer(b,e)[0]:0},canvastolayery(a,b,e){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.CanvasCssToLayer(b,e)[1]:0},layertocanvasx(a,b,e){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.LayerToCanvasCss(b,e)[0]:0},layertocanvasy(a,b,e){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.LayerToCanvasCss(b,e)[1]:0},layerscale(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetOwnScale():
|
|
0},layerangle(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?d.toDegrees(a.GetOwnAngle()):0},layeropacity(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?100*a.GetOpacity():0},layerscalerate(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetScaleRate():0},layerscrollx(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetScrollX():0},layerscrolly(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetScrollY():0},layerparallaxx(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?
|
|
100*a.GetParallaxX():0},layerparallaxy(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?100*a.GetParallaxY():0},layerzelevation(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetZElevation():0},layerindex(a){return(a=this._runtime.GetCurrentLayout().GetLayer(a))?a.GetIndex():-1},canvassnapshot(){const a=this._runtime.GetCanvasManager();return a?a.GetCanvasSnapshotUrl():""},loopindex(a){const b=this._loopStack;return b.IsInLoop()?a?(a=b.FindByName(a))?a.GetIndex():0:b.GetCurrent().GetIndex():
|
|
0},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(a,b,...e){var c=this._GetFunctionMap(a.toLowerCase(),!1);if(!c)return console.warn(`[Construct 3] Call mapped function: map name '${a}' not found; returning 0`),0;var f=c.strMap.get(b.toLowerCase());if(!f)if(c.defaultFunc)f=c.defaultFunc;else return console.warn(`[Construct 3] Call mapped function: no function associated with map '${a}' string '${b}'; returning 0 (consider setting a default)`),0;c=f.GetReturnType();const g=
|
|
f.GetDefaultReturnValue();if(0===c)return console.warn(`[Construct 3] Call mapped function: map '${a}' string '${b}' has no return type so cannot be called from an expression; returning 0`),0;if(!f.IsEnabled())return g;a=this._runtime.GetEventSheetManager();b=a.GetCurrentEvent().GetSolModifiersIncludingParents();const h=0<b.length;h&&a.PushCleanSol(b);const l=f.GetFunctionParameters();for(let m=e.length,p=l.length;m<p;++m)e.push(l[m].GetInitialValue());f=f.GetEventBlock();e=f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),
|
|
c,g,...e);h&&a.PopSol(b);return e},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 a=this._runtime.GetRenderer().GetEstimatedTextureMemoryUsage();
|
|
return Math.round(100*a/1048576)/100},rgb(a,b,e){return d.PackRGB(a,b,e)},rgbex(a,b,e){return d.PackRGBEx(a/100,b/100,e/100)},rgba(a,b,e,c){return d.PackRGBAEx(a/100,b/100,e/100,c/100)},rgbex255(a,b,e){return d.PackRGBEx(a/255,b/255,e/255)},rgba255(a,b,e,c){return d.PackRGBAEx(a/255,b/255,e/255,c/255)},projectname(){return this._runtime.GetProjectName()},projectversion(){return this._runtime.GetProjectVersion()},currenteventsheetname(){return this._runtime.GetCurrentEvent().GetEventSheet().GetName()},
|
|
currenteventnumber(){return this._runtime.GetCurrentEvent().GetDisplayNumber()}}}{"use strict";const d=self.C3;d.Plugins.Sprite=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Sprite.Type=class extends d.SDKTypeBase{constructor(a){super(a);this._animations=a.GetAnimations()}Release(){d.clearArray(this._animations);super.Release()}OnCreate(){for(const a of this._animations)a.LoadAllAssets(this._runtime)}LoadTextures(a){const b={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(e=>e.LoadAllTextures(a,b)))}ReleaseTextures(){for(const a of this._animations)a.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const a of this._objectClass.instancesIncludingPendingCreate())a.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(a){d.Plugins.Sprite._FinishCondition(this,
|
|
a)}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=d.New(d.Rect),e=d.New(d.Quad),c=d.New(d.Vector2);d.Plugins.Sprite.Instance=class extends d.SDKWorldInstanceBase{constructor(h,l){super(h);let m=!0,p="",x=0,v=!0;l&&(m=!!l[0],p=l[1],x=l[2],v=l[3]);this._currentAnimation=this._objectClass.GetAnimationByName(p)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=d.clamp(x,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.HandleWebGLContextLoss();h.SetFlag(2,!0);h.SetFlag(1,0<=this._currentAnimation.GetSpeed());this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo();this._animationTimer=d.New(d.KahanSum);this._animationRepeats=this._frameStartTime=0;this._animTriggerName="";this._changeAnimFrameIndex=-1;this._changeAnimationName=
|
|
"";this._changeAnimationFrom=0;h=this.GetWorldInfo();this._bquadRef=h.GetBoundingQuad();h.SetVisible(m);h.SetCollisionEnabled(v);h.SetOriginX(this._currentAnimationFrame.GetOriginX());h.SetOriginY(this._currentAnimationFrame.GetOriginY());h.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly());h.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(h){var l=this._currentTexture;null!==l&&(h.SetTexture(l),l=this.GetWorldInfo(),l.HasMesh()?this._DrawMesh(l,h):this._DrawStandard(l,h))}_DrawStandard(h,l){let m=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&&
|
|
(m=h.PixelRoundQuad(m));l.Quad3(m,this._currentRcTex)}_DrawMesh(h,l){const m=h.GetTransformedMesh();if(h.IsMeshChanged()){h.CalculateBbox(b,e,!1);let p=e;this._runtime.IsPixelRoundingEnabled()&&(p=h.PixelRoundQuad(p));m.CalculateTransformedMesh(h.GetSourceMesh(),p,this._currentRcTex);h.SetMeshChanged(!1)}m.Draw(l)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(2)}SetAnimationPlaying(h){this._inst.SetFlag(2,h)}IsPlayingForwards(){return this._inst.GetFlag(1)}SetPlayingForwards(h){this._inst.SetFlag(1,
|
|
h)}IsInAnimationTrigger(){return this._inst.GetFlag(4)}SetInAnimationTrigger(h){this._inst.SetFlag(4,h)}Tick(){this._changeAnimationName&&this._DoChangeAnimation();0<=this._changeAnimFrameIndex&&this._DoChangeAnimFrame();const h=this._currentAnimationSpeed;if(this.IsAnimationPlaying()&&0!==h){var l=this._runtime.GetDt(this._inst);this._animationTimer.Add(l);l=this.GetAnimationTime();var m=this._currentAnimationFrame,p=m.GetDuration()/h;if(!(l<this._frameStartTime+p)){var x=this._currentAnimation,
|
|
v=this._currentAnimationRepeatTo,r=x.GetFrameCount(),q=x.GetRepeatCount(),y=x.IsLooping(),u=x.IsPingPong();this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=p;this._currentFrameIndex>=r&&(u?(this.SetPlayingForwards(!1),this._currentFrameIndex=r-2):y?this._currentFrameIndex=v:(this._animationRepeats++,this._animationRepeats>=q?this._FinishAnimation(!1):this._currentFrameIndex=v));0>this._currentFrameIndex&&(u?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),
|
|
y||(this._animationRepeats++,this._animationRepeats>=q&&this._FinishAnimation(!0))):y?this._currentFrameIndex=v:(this._animationRepeats++,this._animationRepeats>=q?this._FinishAnimation(!0):this._currentFrameIndex=v));this._currentFrameIndex=d.clamp(this._currentFrameIndex,0,r-1);p=x.GetFrameAt(this._currentFrameIndex);l>this._frameStartTime+p.GetDuration()/h&&(this._frameStartTime=l);this._OnFrameChanged(m,p)}}else this._StopTicking()}_FinishAnimation(h){this._currentFrameIndex=h?0:this._currentAnimation.GetFrameCount()-
|
|
1;this.SetAnimationPlaying(!1);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(!0);this.Trigger(d.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(d.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(h,l){if(h!==l){var m=this.GetWorldInfo(),p=h.GetImageInfo(),x=l.GetImageInfo(),v=p.GetWidth();p=p.GetHeight();var r=x.GetWidth(),q=x.GetHeight();v!==r&&m.SetWidth(m.GetWidth()*(r/v));p!==q&&m.SetHeight(m.GetHeight()*
|
|
(q/p));m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());m.SetBboxChanged();this._currentAnimationFrame=l;this._currentTexture=x.GetTexture();this._currentRcTex=x.GetTexRect();m=this.GetInstance().GetBehaviorInstances();for(let y=0,u=m.length;y<u;++y)m[y].OnSpriteFrameChanged(h,l);this.Trigger(d.Plugins.Sprite.Cnds.OnFrameChanged);this._runtime.UpdateRender()}}_StartAnim(h){this.SetAnimationPlaying(!0);this._frameStartTime=this.GetAnimationTime();
|
|
1===h&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,this.IsInAnimationTrigger()||this._DoChangeAnimFrame());this._StartTicking()}_SetAnim(h,l){this._changeAnimationName=h;this._changeAnimationFrom=l;this._StartTicking();this.IsInAnimationTrigger()||this._DoChangeAnimation()}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(h){isFinite(h)&&(this._changeAnimFrameIndex=h,this.IsInAnimationTrigger()||this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(h){this._currentAnimationSpeed=
|
|
Math.abs(h);this.SetPlayingForwards(0<=h);0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(h){this._currentAnimationRepeatTo=h=d.clamp(Math.floor(h),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const h=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=d.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(h,l))}_DoChangeAnimFrame(){const h=this._currentAnimationFrame;var l=this._currentFrameIndex;this._currentFrameIndex=d.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;l!==this._currentFrameIndex&&(l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(h,l),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const h=this._currentAnimationFrame.GetImageInfo();this._currentTexture=
|
|
h.GetTexture();this._currentRcTex=h.GetTexRect();this.GetWorldInfo().SetMeshChanged(!0)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(h){const l=this._currentAnimationFrame,m=this.GetWorldInfo();if("string"===typeof h)h=l.GetImagePointByName(h);else if("number"===typeof h)h=l.GetImagePointByIndex(h-1);else throw new TypeError("expected string or number");if(!h)return[m.GetX(),
|
|
m.GetY()];c.copy(h.GetVec2());if(m.HasMesh()){const [p,x]=m.GetSourceMesh().TransformPoint(c.getX(),c.getY());c.set(p,x)}c.offset(-l.GetOriginX(),-l.GetOriginY());c.scale(m.GetWidth(),m.GetHeight());c.rotate(m.GetAngle());c.offset(m.GetX(),m.GetY());return[c.getX(),c.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(h){h=Math.floor(h);const l=this.GetWorldInfo();var m=l.GetTransformedCollisionPoly();const p=m.pointCount();
|
|
h===p&&(h=0);if(0>h||h>=p)return[0,0];m=m.pointsArr();return[m[2*h]+l.GetX(),m[2*h+1]+l.GetY()]}GetDebuggerProperties(){const h=d.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(h.SetAnim,l,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",value:this._currentFrameIndex,onedit:l=>this.CallAction(h.SetAnimFrame,
|
|
l)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:l=>l?this.CallAction(h.StartAnim,0):this.CallAction(h.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:l=>this.CallAction(h.SetAnimSpeed,l)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:l=>this._animationRepeats=l}]}]}SaveToJson(){const h={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&
|
|
(h.fs=this._frameStartTime);var l=this.GetAnimationTime();0!==l&&(h.at=l);0!==this._currentFrameIndex&&(h.f=this._currentFrameIndex);0!==this._currentAnimationSpeed&&(h.cas=this._currentAnimationSpeed);1!==this._animationRepeats&&(h.ar=this._animationRepeats);0!==this._currentAnimationRepeatTo&&(h.rt=this._currentAnimationRepeatTo);this.IsAnimationPlaying()||(h.ap=this.IsAnimationPlaying());this.IsPlayingForwards()||(h.af=this.IsPlayingForwards());l=this.GetWorldInfo();l.IsCollisionEnabled()&&(h.ce=
|
|
l.IsCollisionEnabled());return h}LoadFromJson(h){var l=this.GetObjectClass().GetAnimationBySID(h.a);l&&(this._currentAnimation=l);this._frameStartTime=h.hasOwnProperty("fs")?h.fs:0;this._animationTimer.Set(h.hasOwnProperty("at")?h.at:0);l=h.hasOwnProperty("f")?h.f:0;this._currentFrameIndex=d.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=h.hasOwnProperty("cas")?h.cas:0;this._animationRepeats=h.hasOwnProperty("ar")?h.ar:1;l=h.hasOwnProperty("rt")?h.rt:0;this._currentAnimationRepeatTo=
|
|
d.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(h.hasOwnProperty("ap")?!!h.ap:!0);this.SetPlayingForwards(h.hasOwnProperty("af")?!!h.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(!!h.ce)}GetPropertyValueByIndex(h){const l=this.GetWorldInfo();
|
|
switch(h){case 3:return l.IsCollisionEnabled();case 2:return d.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1)}}SetPropertyValueByIndex(h,l){var m=this.GetWorldInfo();switch(h){case 3:m.SetCollisionEnabled(!!l);break;case 2:this.SetAnimationPlaying(!1);h=this._currentAnimation.GetFrameCount()-1;m=l=d.clamp(l,0,h);l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const p=this._currentAnimation.GetFrameAt(m);this._OnFrameChanged(l,p);this._currentFrameIndex=d.clamp(m,
|
|
0,h)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const f=new WeakMap,g=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();f.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return f.get(this).GetImagePointCount()}getImagePointX(h){if("string"!==typeof h&&"number"!==typeof h)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(h)[0]}getImagePointY(h){if("string"!==
|
|
typeof h&&"number"!==typeof h)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(h)[1]}getImagePoint(h){if("string"!==typeof h&&"number"!==typeof h)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(h)}getPolyPointCount(){return f.get(this).GetCollisionPolyPointCount()}getPolyPointX(h){a.RequireFiniteNumber(h);return f.get(this).GetCollisionPolyPoint(h)[0]}getPolyPointY(h){a.RequireFiniteNumber(h);return f.get(this).GetCollisionPolyPoint(h)[1]}getPolyPoint(h){a.RequireFiniteNumber(h);
|
|
return f.get(this).GetCollisionPolyPoint(h)}stopAnimation(){f.get(this).SetAnimationPlaying(!1)}startAnimation(h="current-frame"){a.RequireString(h);h=g.get(h);if("undefined"===typeof h)throw Error("invalid mode");f.get(this)._StartAnim(h)}setAnimation(h,l="beginning"){a.RequireString(h);a.RequireString(l);l=g.get(l);if("undefined"===typeof l)throw Error("invalid mode");f.get(this)._SetAnim(h,l)}get animationName(){return f.get(this)._GetCurrentAnimationName()}set animationFrame(h){a.RequireFiniteNumber(h);
|
|
f.get(this)._SetAnimFrame(h)}get animationFrame(){return f.get(this)._GetAnimFrame()}set animationSpeed(h){a.RequireFiniteNumber(h);f.get(this)._SetAnimSpeed(h)}get animationSpeed(){return f.get(this)._GetAnimSpeed()}set animationRepeatToFrame(h){a.RequireFiniteNumber(h);f.get(this)._SetAnimRepeatToFrame(h)}get animationRepeatToFrame(){return f.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return f.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return f.get(this).GetCurrentImageInfo().GetHeight()}}}
|
|
{"use strict";const d=self.C3,a=d.New(d.Rect),b=[],e=[];let c=!1,f=null,g=!1;const h=new Set;function l(q,y,u,t){const A=y.GetUID(),z=u.GetUID();A<z?q.Set(y,u,t):q.Set(u,y,t)}function m(q,y,u){const t=y.GetUID(),A=u.GetUID();t<A?q.Delete(y,u):q.Delete(u,y)}function p(q,y){q.DeleteEither(y)}function x(q,y,u){const t=y.GetUID(),A=u.GetUID();return t<A?q.Get(y,u):q.Get(u,y)}function v(q,y,u,t){if(!y)return!1;q=q.GetInstance();const A=0!==u||0!==t,z=q.GetWorldInfo(),C=q.GetRuntime(),E=C.GetCollisionEngine();
|
|
var J=C.GetCurrentCondition();const G=J.GetEventBlock().IsOrBlock();var I=J.GetObjectClass();J=J.IsInverted();const L=y.GetCurrentSol();I=I!==y;f=y;c=I&&!J;g=!1;let N=0,S=0,X=!1;L.IsSelectAll()?(a.copy(z.GetBoundingBox()),a.offset(u,t),E.GetCollisionCandidates(z.GetLayer(),y,a,e),y=e):G?C.IsCurrentConditionFirst()&&!L._GetOwnElseInstances().length&&L._GetOwnInstances().length?y=L._GetOwnInstances():(y=L._GetOwnElseInstances(),g=!0):y=L._GetOwnInstances();A&&(N=z.GetX(),S=z.GetY(),z.OffsetXY(u,t),
|
|
z.SetBboxChanged());for(const U of y)if(E.TestOverlap(q,U)){X=!0;if(J)break;I&&h.add(U)}A&&(z.SetXY(N,S),z.SetBboxChanged());d.clearArray(e);return X}function r(q){q=q.GetRuntime().GetCurrentEvent().IsOrBlock();const y=f.GetCurrentSol(),u=y._GetOwnInstances(),t=y._GetOwnElseInstances();y.IsSelectAll()?(y.SetSetPicked(h),q&&(d.clearArray(t),y.AddElseInstances(h,f.GetInstances()))):q?g?y.TransferElseInstancesToOwn(h):(y.AddElseInstances(h,u),y.SetSetPicked(h)):y.SetSetPicked(h);f.ApplySolToContainer()}
|
|
d.Plugins.Sprite._FinishCondition=function(q,y){c&&(y&&r(q),h.clear(),f=null,c=!1)};d.Plugins.Sprite.Cnds={OnCollision(q){if(this._runtime.IsDebugging())return d.Plugins.Sprite.Cnds.DebugOnCollision.call(this,q);if(!q)return!1;var y=this._runtime;const u=y.GetCollisionEngine(),t=y.GetEventSheetManager(),A=t.GetEventStack();var z=t.GetCurrentCondition();const C=z.GetObjectClass();var E=z.GetSavedDataMap(),J=z.GetUnsavedDataMap();z=A.GetCurrentStackFrame();const G=y.GetTickCount(),I=G-1,L=z.GetCurrentEvent(),
|
|
N=A.Push(L);let S=E.get("collmemory");S||(S=d.New(d.PairMap),E.set("collmemory",S));J.get("spriteCreatedDestroyCallback")||(J.set("spriteCreatedDestroyCallback",!0),y.Dispatcher().addEventListener("instancedestroy",ia=>p(S,ia.instance)));E=C.GetCurrentSol();y=q.GetCurrentSol();E=E.GetInstances();J=null;for(let ia=0;ia<E.length;++ia){const ka=E[ia];y.IsSelectAll()?(u.GetCollisionCandidates(ka.GetWorldInfo().GetLayer(),q,ka.GetWorldInfo().GetBoundingBox(),b),J=b,u.AddRegisteredCollisionCandidates(ka,
|
|
q,J)):J=y.GetInstances();for(let ya=0;ya<J.length;++ya){const ta=J[ya];if(u.TestOverlap(ka,ta)||u.CheckRegisteredCollision(ka,ta)){var X=x(S,ka,ta),U=!1,W=-2;"number"===typeof X&&(U=!0,W=X);X=!U||W<I;l(S,ka,ta,G);X&&(X=L.GetSolModifiers(),t.PushCopySol(X),W=C.GetCurrentSol(),U=q.GetCurrentSol(),W._SetSelectAll(!1),U._SetSelectAll(!1),C===q?(U=W._GetOwnInstances(),d.clearArray(U),U.push(ka),U.push(ta),C.ApplySolToContainer()):(W=W._GetOwnInstances(),U=U._GetOwnInstances(),d.clearArray(W),d.clearArray(U),
|
|
W.push(ka),U.push(ta),C.ApplySolToContainer(),q.ApplySolToContainer()),L.Retrigger(z,N),t.PopSol(X))}else m(S,ka,ta)}d.clearArray(b)}A.Pop();return!1},*DebugOnCollision(q){if(!q)return!1;var y=this._runtime;const u=y.GetCollisionEngine(),t=y.GetEventSheetManager(),A=t.GetEventStack(),z=A.GetCurrentStackFrame(),C=y.GetTickCount(),E=C-1,J=z.GetCurrentEvent(),G=A.Push(J);var I=t.GetCurrentCondition();const L=I.GetObjectClass();var N=I.GetSavedDataMap();I=I.GetUnsavedDataMap();let S=N.get("collmemory");
|
|
S||(S=d.New(d.PairMap),N.set("collmemory",S));I.get("spriteCreatedDestroyCallback")||(I.set("spriteCreatedDestroyCallback",!0),y.Dispatcher().addEventListener("instancedestroy",ia=>p(S,ia.instance)));N=L.GetCurrentSol();y=q.GetCurrentSol();N=N.GetInstances();I=null;for(let ia=0;ia<N.length;++ia){const ka=N[ia];y.IsSelectAll()?(u.GetCollisionCandidates(ka.GetWorldInfo().GetLayer(),q,ka.GetWorldInfo().GetBoundingBox(),b),I=b,u.AddRegisteredCollisionCandidates(ka,q,I)):I=y.GetInstances();for(let ya=
|
|
0;ya<I.length;++ya){const ta=I[ya];if(u.TestOverlap(ka,ta)||u.CheckRegisteredCollision(ka,ta)){var X=x(S,ka,ta),U=!1,W=-2;"number"===typeof X&&(U=!0,W=X);X=!U||W<E;l(S,ka,ta,C);X&&(X=J.GetSolModifiers(),t.PushCopySol(X),W=L.GetCurrentSol(),U=q.GetCurrentSol(),W._SetSelectAll(!1),U._SetSelectAll(!1),L===q?(U=W._GetOwnInstances(),d.clearArray(U),U.push(ka),U.push(ta),L.ApplySolToContainer()):(W=W._GetOwnInstances(),U=U._GetOwnInstances(),d.clearArray(W),d.clearArray(U),W.push(ka),U.push(ta),L.ApplySolToContainer(),
|
|
q.ApplySolToContainer()),yield*J.DebugRetrigger(z,G),t.PopSol(X))}else m(S,ka,ta)}d.clearArray(b)}A.Pop();return!1},IsOverlapping(q){return v(this,q,0,0)},IsOverlappingOffset(q,y,u){return v(this,q,y,u)},IsAnimPlaying(q){return d.equalsNoCase(this._GetCurrentAnimationName(),q)},CompareFrame(q,y){return d.compare(this._currentFrameIndex,q,y)},CompareAnimSpeed(q,y){return d.compare(this._GetAnimSpeed(),q,y)},OnAnimFinished(q){return d.equalsNoCase(this._animTriggerName,q)},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 d=self.C3;d.Plugins.Sprite.Acts={Spawn(a,b,e,c){if(a&&b){var [f,g]=this.GetImagePoint(e);if(e=this._runtime.CreateInstance(a,b,f,g,c)){c&&b.SortAndAddSceneGraphInstancesByZIndex(e);a.GetPlugin().IsRotatable()&&(b=e.GetWorldInfo(),b.SetAngle(this.GetWorldInfo().GetAngle()),b.SetBboxChanged());b=this._runtime.GetEventSheetManager();b.BlockFlushingInstances(!0);e._TriggerOnCreatedOnSelfAndRelated();b.BlockFlushingInstances(!1);c=this._runtime.GetCurrentAction().GetSavedDataMap();
|
|
b=!1;if(!c.has("Spawn_LastExec")||c.get("Spawn_LastExec")<this._runtime.GetExecCount())b=!0,c.set("Spawn_LastExec",this._runtime.GetExecCount());if(a!==this.GetObjectClass()&&(a=a.GetCurrentSol(),a._SetSelectAll(!1),a=a._GetOwnInstances(),b&&d.clearArray(a),a.push(e),e.IsInContainer()))for(const h of e.siblings())e=h.GetObjectClass().GetCurrentSol(),b?e.SetSinglePicked(h):(e._SetSelectAll(!1),e._PushInstance(h))}}},StopAnim(){this.SetAnimationPlaying(!1)},StartAnim(a){this._StartAnim(a)},SetAnim(a,
|
|
b){this._SetAnim(a,b)},SetAnimFrame(a){this._SetAnimFrame(a)},SetAnimSpeed(a){this._SetAnimSpeed(a)},SetAnimRepeatToFrame(a){this._SetAnimRepeatToFrame(a)},SetMirrored(a){const b=this.GetWorldInfo(),e=b.GetWidth();a=Math.abs(e)*(0===a?-1:1);e!==a&&(b.SetWidth(a),b.SetBboxChanged())},SetFlipped(a){const b=this.GetWorldInfo(),e=b.GetHeight();a=Math.abs(e)*(0===a?-1:1);e!==a&&(b.SetHeight(a),b.SetBboxChanged())},SetScale(a){const b=this._currentAnimationFrame.GetImageInfo(),e=this.GetWorldInfo();var c=
|
|
0>e.GetWidth()?-1:1;const f=0>e.GetHeight()?-1:1;c*=b.GetWidth()*a;a=b.GetHeight()*a*f;if(e.GetWidth()!==c||e.GetHeight()!==a)e.SetSize(c,a),e.SetBboxChanged()},async LoadURL(a,b,e){e=this._currentAnimationFrame.GetImageInfo();const c=this.GetWorldInfo(),f=this._runtime;if(e.GetURL()===a)0===b&&(c.SetSize(e.GetWidth(),e.GetHeight()),c.SetBboxChanged()),this.Trigger(d.Plugins.Sprite.Cnds.OnURLLoaded);else{var g=d.New(d.ImageInfo);try{await g.LoadDynamicAsset(f,a);if(!g.IsLoaded())throw Error("image failed to load");
|
|
await g.LoadStaticTexture(f.GetRenderer(),{sampling:this._runtime.GetSampling()})}catch(h){console.error("Load image from URL failed: ",h);this.Trigger(d.Plugins.Sprite.Cnds.OnURLFailed);return}e.ReplaceWith(g);this._sdkType._UpdateAllCurrentTexture();this.WasReleased()||0!==b||(c.SetSize(e.GetWidth(),e.GetHeight()),c.SetBboxChanged());f.UpdateRender();this.WasReleased()||await this.TriggerAsync(d.Plugins.Sprite.Cnds.OnURLLoaded)}},SetCollisions(a){this.GetWorldInfo().SetCollisionEnabled(a)},SetSolidCollisionFilter(a,
|
|
b){this.GetWorldInfo().SetSolidCollisionFilter(0===a,b)},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);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(d){return this.GetImagePoint(d)[0]},ImagePointY(d){return this.GetImagePoint(d)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},
|
|
ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(d){return this.GetCollisionPolyPoint(d)[0]},PolyPointYAt(d){return this.GetCollisionPolyPoint(d)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};{"use strict";const d=self.C3;d.Plugins.TiledBg=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;function a(b){switch(b){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}d.Plugins.TiledBg.Type=class extends d.SDKTypeBase{constructor(b,e){super(b);this._wrapY=this._wrapX="repeat";e&&(this._wrapX=a(e[0]),this._wrapY=a(e[1]))}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(b){return this.GetImageInfo().LoadStaticTexture(b,{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=d.New(d.Rect),e=d.New(d.Quad),c=d.New(d.Rect),f=d.New(d.Quad);d.Plugins.TiledBg.Instance=class extends d.SDKWorldInstanceBase{constructor(h,l){super(h);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=d.toRadians(l[8]))}Release(){this._ReleaseOwnImage();
|
|
super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}CalculateTextureCoordsFor3DFace(h,l,m){var p=this.GetCurrentImageInfo();const x=p.GetWidth();p=p.GetHeight();const v=this._imageOffsetX/x,r=this._imageOffsetY/p,q=this._imageAngle;c.set(0,0,h/(x*this._imageScaleX),l/(p*this._imageScaleY));c.offset(-v,-r);0===q?m.setFromRect(c):m.setFromRotatedRect(c,-q)}Draw(h){var l=this.GetCurrentImageInfo(),m=l.GetTexture();if(null!==m){h.SetTexture(m);
|
|
m=l.GetWidth();l=l.GetHeight();var p=this._imageOffsetX/m,x=this._imageOffsetY/l,v=this.GetWorldInfo();c.set(0,0,v.GetWidth()/(m*this._imageScaleX),v.GetHeight()/(l*this._imageScaleY));c.offset(-p,-x);v.HasMesh()?this._DrawMesh(v,h):this._DrawStandard(v,h)}}_DrawStandard(h,l){let m=h.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(m=h.PixelRoundQuad(m));0===this._imageAngle?l.Quad3(m,c):(f.setFromRotatedRect(c,-this._imageAngle),l.Quad4(m,f))}_DrawMesh(h,l){const m=h.GetTransformedMesh();
|
|
if(h.IsMeshChanged()){h.CalculateBbox(b,e,!1);let p=e;this._runtime.IsPixelRoundingEnabled()&&(p=h.PixelRoundQuad(p));let x=c;0!==this._imageAngle&&(f.setFromRotatedRect(c,-this._imageAngle),x=f);m.CalculateTransformedMesh(h.GetSourceMesh(),p,x);h.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(h){this._imageOffsetX!==
|
|
h&&(this._imageOffsetX=h,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(h){this._imageOffsetY!==h&&(this._imageOffsetY=h,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(h){this._imageScaleX!==h&&(this._imageScaleX=h,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(h){this._imageScaleY!==h&&(this._imageScaleY=
|
|
h,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(h){this._imageAngle!==h&&(this._imageAngle=h,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageAngle(){return this._imageAngle}GetPropertyValueByIndex(h){switch(h){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(h,
|
|
l){switch(h){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 g=new WeakMap;self.ITiledBackgroundInstance=class extends self.IWorldInstance{constructor(){super();g.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(h){a.RequireFiniteNumber(h);g.get(this)._SetImageOffsetX(h)}get imageOffsetX(){return g.get(this)._GetImageOffsetX()}set imageOffsetY(h){a.RequireFiniteNumber(h);
|
|
g.get(this)._SetImageOffsetY(h)}get imageOffsetY(){return g.get(this)._GetImageOffsetY()}set imageScaleX(h){a.RequireFiniteNumber(h);g.get(this)._SetImageScaleX(h)}get imageScaleX(){return g.get(this)._GetImageScaleX()}set imageScaleY(h){a.RequireFiniteNumber(h);g.get(this)._SetImageScaleY(h)}get imageScaleY(){return g.get(this)._GetImageScaleY()}set imageAngle(h){a.RequireFiniteNumber(h);g.get(this)._SetImageAngle(h)}get imageAngle(){return g.get(this)._GetImageAngle()}set imageAngleDegrees(h){a.RequireFiniteNumber(h);
|
|
g.get(this)._SetImageAngle(d.toRadians(h))}get imageAngleDegrees(){return d.toDegrees(g.get(this)._GetImageAngle())}get imageWidth(){return g.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return g.get(this).GetCurrentImageInfo().GetHeight()}}}"use strict";self.C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}};
|
|
{"use strict";const d=self.C3;d.Plugins.TiledBg.Acts={SetImageOffsetX(a){this._SetImageOffsetX(a)},SetImageOffsetY(a){this._SetImageOffsetY(a)},SetImageScaleX(a){this._SetImageScaleX(a/100)},SetImageScaleY(a){this._SetImageScaleY(a/100)},SetImageAngle(a){this._SetImageAngle(d.toRadians(a))},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()},async LoadURL(a,b){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==a){b=this._runtime;var e=d.New(d.ImageInfo);try{await e.LoadDynamicAsset(b,
|
|
a);if(!e.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return e.Release(),null;if(!await e.LoadStaticTexture(b.GetRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"}))return}catch(c){console.error("Load image from URL failed: ",c);this.Trigger(d.Plugins.TiledBg.Cnds.OnURLFailed);return}this.WasReleased()?e.Release():(this._ReleaseOwnImage(),this._ownImageInfo=e,b.UpdateRender(),await this.TriggerAsync(d.Plugins.TiledBg.Cnds.OnURLLoaded))}}}}
|
|
{"use strict";const d=self.C3;d.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 d.toDegrees(this._imageAngle)}}}{"use strict";const d=self.C3;d.Plugins.Keyboard=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Keyboard.Type=class extends d.SDKTypeBase{constructor(e){super(e)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IKeyboardObjectType}};let a=null;function b(){return a.GetSingleGlobalInstance().GetSdkInstance()}self.IKeyboardObjectType=class extends self.IObjectClass{constructor(e){super(e);a=e;e.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(e){const c=b();if("string"===typeof e)return c.IsKeyDown(e);if("number"===
|
|
typeof e)return c.IsKeyCodeDown(e);throw new TypeError("expected string or number");}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Keyboard.Instance=class extends d.SDKInstanceBase{constructor(a,b){super(a);this._keysDownByString=new Set;this._keysDownByWhich=new Set;this._triggerWhich=0;this._triggerTypedKey=this._triggerString="";a=this.GetRuntime().Dispatcher();this._disposables=new d.CompositeDisposable(d.Disposable.From(a,"keydown",e=>this._OnKeyDown(e.data)),d.Disposable.From(a,"keyup",e=>this._OnKeyUp(e.data)),d.Disposable.From(a,"window-blur",()=>this._OnWindowOrKeyboardBlur()),
|
|
d.Disposable.From(a,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}Release(){super.Release()}_OnKeyDown(a){const b=a.which,e=a.code||b.toString();a=a.key;this._keysDownByString.has(e)||(this._keysDownByString.add(e),this._keysDownByWhich.add(b),this._triggerString=e,this._triggerWhich=b,this._triggerTypedKey=a,this.Trigger(d.Plugins.Keyboard.Cnds.OnAnyKey),this.Trigger(d.Plugins.Keyboard.Cnds.OnKey),this.Trigger(d.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed),this.Trigger(d.Plugins.Keyboard.Cnds.OnKeyCode))}_OnKeyUp(a){const b=
|
|
a.which,e=a.code||b.toString();a=a.key;this._keysDownByString.delete(e);this._keysDownByWhich.delete(b);this._triggerString=e;this._triggerWhich=b;this._triggerTypedKey=a;this.Trigger(d.Plugins.Keyboard.Cnds.OnAnyKeyReleased);this.Trigger(d.Plugins.Keyboard.Cnds.OnKeyReleased);this.Trigger(d.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased);this.Trigger(d.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowOrKeyboardBlur(){for(const a of this._keysDownByWhich)this._keysDownByWhich.delete(a),this._triggerWhich=
|
|
a,this.Trigger(d.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(d.Plugins.Keyboard.Cnds.OnKeyReleased),this.Trigger(d.Plugins.Keyboard.Cnds.OnKeyCodeReleased);this._keysDownByString.clear()}IsKeyDown(a){return this._keysDownByString.has(a)}IsKeyCodeDown(a){return this._keysDownByWhich.has(a)}SaveToJson(){return{tk:this._triggerWhich,tkk:this._triggerTypedKey}}LoadFromJson(a){this._triggerWhich=a.tk;a.hasOwnProperty("tkk")&&(this._triggerTypedKey=a.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:d.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:"plugins.keyboard.debugger.last-typed-key",value:this._triggerTypedKey}]}]}}}
|
|
{"use strict";const d="ShiftLeft ShiftRight ControlLeft ControlRight AltLeft AltRight MetaLeft MetaRight".split(" ");self.C3.Plugins.Keyboard.Cnds={IsKeyDown(a){return this._keysDownByWhich.has(a)},OnKey(a){return this._triggerWhich===a},OnAnyKey(){return!0},OnAnyKeyReleased(){return!0},OnKeyReleased(a){return this._triggerWhich===a},IsKeyCodeDown(a){a=Math.floor(a);return this._keysDownByWhich.has(a)},OnKeyCode(a){return this._triggerWhich===a},OnKeyCodeReleased(a){return this._triggerWhich===a},
|
|
OnLeftRightKeyPressed(a){return this._triggerString===d[a]},OnLeftRightKeyReleased(a){return this._triggerString===d[a]},IsLeftRightKeyDown(a){return this._keysDownByString.has(d[a])}}}"use strict";self.C3.Plugins.Keyboard.Acts={};
|
|
{"use strict";function d(a){a=Math.floor(a);switch(a){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(a)}}
|
|
self.C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode(a){return d(a)},TypedKey(){return this._triggerTypedKey}}}{"use strict";const d=self.C3;d.Plugins.Touch=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3,a=self.C3X;d.Plugins.Touch.Type=class extends d.SDKTypeBase{constructor(c){super(c)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.ITouchObjectType}};let b=null;function e(){return b.GetSingleGlobalInstance().GetSdkInstance()}self.ITouchObjectType=class extends self.IObjectClass{constructor(c){super(c);b=c;c.GetRuntime()._GetCommonScriptInterfaces().touch=this}requestPermission(c){a.RequireString(c);const f=e();if("orientation"===c)return f._RequestPermission(0);
|
|
if("motion"===c)return f._RequestPermission(1);throw Error("invalid type");}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Touch.Instance=class extends d.SDKInstanceBase{constructor(a,b){super(a,"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=[];b&&(this._useMouseInput=
|
|
b[0]);this.AddDOMMessageHandler("permission-result",e=>this._OnPermissionResult(e));a=this.GetRuntime().Dispatcher();this._disposables=new d.CompositeDisposable(d.Disposable.From(a,"pointerdown",e=>this._OnPointerDown(e.data)),d.Disposable.From(a,"pointermove",e=>this._OnPointerMove(e.data)),d.Disposable.From(a,"pointerup",e=>this._OnPointerUp(e.data,!1)),d.Disposable.From(a,"pointercancel",e=>this._OnPointerUp(e.data,!0)),d.Disposable.From(a,"deviceorientation",e=>this._OnDeviceOrientation(e.data)),
|
|
d.Disposable.From(a,"deviceorientationabsolute",e=>this._OnDeviceOrientationAbsolute(e.data)),d.Disposable.From(a,"devicemotion",e=>this._OnDeviceMotion(e.data)),d.Disposable.From(a,"tick2",e=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(a){if("mouse"===a.pointerType)if(this._useMouseInput)this._isMouseDown=!0;else return;const b=a.pointerId;if(!this._touches.has(b)){var e=a.pageX-this._runtime.GetCanvasClientX();a=a.pageY-this._runtime.GetCanvasClientY();var c=
|
|
performance.now(),f=this._touches.size;this._triggerIndex=f;this._triggerId=b;var g=d.New(d.Plugins.Touch.TouchInfo);g.Init(c,e,a,b,f);this._touches.set(b,g);this.Trigger(d.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(d.Plugins.Touch.Cnds.OnTouchStart);this._curTouchX=e;this._curTouchY=a;this.Trigger(d.Plugins.Touch.Cnds.OnTouchObject)}}_OnPointerMove(a){if("mouse"!==a.pointerType||this._isMouseDown){var b=this._touches.get(a.pointerId);if(b){var e=performance.now();if(!(2>e-b.GetTime())){var c=
|
|
a.pageX-this._runtime.GetCanvasClientX(),f=a.pageY-this._runtime.GetCanvasClientY();b.Update(e,c,f,a.width,a.height,a.pressure)}}}}_OnPointerUp(a,b){if("mouse"===a.pointerType)if(this._isMouseDown)this._isMouseDown=!1;else return;const e=performance.now();a=a.pointerId;const c=this._touches.get(a);c&&(this._triggerIndex=c.GetStartIndex(),this._triggerId=c.GetId(),this.Trigger(d.Plugins.Touch.Cnds.OnNthTouchEnd),this.Trigger(d.Plugins.Touch.Cnds.OnTouchEnd),b||(b=c.ShouldTriggerTap(e),"single-tap"===
|
|
b?(this.Trigger(d.Plugins.Touch.Cnds.OnTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(d.Plugins.Touch.Cnds.OnTapGestureObject)):"double-tap"===b&&(this.Trigger(d.Plugins.Touch.Cnds.OnDoubleTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(d.Plugins.Touch.Cnds.OnDoubleTapGestureObject))),c.Release(),this._touches.delete(a))}_RequestPermission(a){this._PostToDOMMaybeSync("request-permission",{type:a});return new Promise((b,e)=>{this._permissionPromises.push({type:a,
|
|
resolve:b,reject:e})})}_OnPermissionResult(a){const b=a.result,e=a.type;this._triggerPermission=e;a=this._permissionPromises.filter(c=>c.type===e);for(const c of a)c.resolve(b?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(c=>c.type!==e);b?(this.Trigger(d.Plugins.Touch.Cnds.OnPermissionGranted),0===e?this._runtime.RequestDeviceOrientationEvent():this._runtime.RequestDeviceMotionEvent()):this.Trigger(d.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(a){"number"===
|
|
typeof a.webkitCompassHeading?this._orientCompassHeading=a.webkitCompassHeading:a.absolute&&(this._orientCompassHeading=a.alpha);this._orientAlpha=a.alpha;this._orientBeta=a.beta;this._orientGamma=a.gamma}_OnDeviceOrientationAbsolute(a){this._orientCompassHeading=a.alpha}_OnDeviceMotion(a){const b=a.acceleration;b&&(this._accX=b.x,this._accY=b.y,this._accZ=b.z);if(a=a.accelerationIncludingGravity)this._accWithGX=a.x,this._accWithGY=a.y,this._accWithGZ=a.z}_OnTick2(){const a=performance.now();let b=
|
|
0;for(const e of this._touches.values())e.GetTime()<=a-50&&e._SetLastTime(a),e.ShouldTriggerHold(a)&&(this._triggerIndex=e.GetStartIndex(),this._triggerId=e.GetId(),this._getTouchIndex=b,this.Trigger(d.Plugins.Touch.Cnds.OnHoldGesture),this._curTouchX=e.GetX(),this._curTouchY=e.GetY(),this.Trigger(d.Plugins.Touch.Cnds.OnHoldGestureObject),this._getTouchIndex=0),++b}_GetTouchByIndex(a){a=Math.floor(a);for(const b of this._touches.values()){if(0===a)return b;--a}return null}_IsClientPosOnCanvas(a,b){return 0<=
|
|
a&&0<=b&&a<this._runtime.GetCanvasCssWidth()&&b<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.touch.debugger.touches",properties:[...this._touches.values()].map(a=>({name:"$"+a.GetId(),value:a.GetX()+", "+a.GetY()}))}]}}}
|
|
{"use strict";const d=self.C3,a=[];d.Plugins.Touch.Cnds={OnTouchStart(){return!0},OnTouchEnd(){return!0},IsInTouch(){return 0<this._touches.size},OnTouchObject(b){return b&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,this._curTouchX,this._curTouchY,!1):!1},IsTouchingObject(b){if(!b)return!1;const e=b.GetCurrentSol();var c=e.GetInstances();for(const f of c){c=f.GetWorldInfo();const g=c.GetLayer();for(const h of this._touches.values()){if(!this._IsClientPosOnCanvas(h.GetX(),
|
|
h.GetY()))continue;const [l,m]=g.CanvasCssToLayer(h.GetX(),h.GetY(),c.GetTotalZElevation());if(c.ContainsPoint(l,m)){a.push(f);break}}}return a.length?(e.SetArrayPicked(a),b.ApplySolToContainer(),d.clearArray(a),!0):!1},CompareTouchSpeed(b,e,c){return(b=this._GetTouchByIndex(b))?d.compare(b.GetSpeed(),e,c):!1},OrientationSupported(){return!0},MotionSupported(){return!0},CompareOrientation(b,e,c){this._runtime.RequestDeviceOrientationEvent();return d.compare(0===b?this._orientAlpha:1===b?this._orientBeta:
|
|
this._orientGamma,e,c)},CompareAcceleration(b,e,c){this._runtime.RequestDeviceMotionEvent();return d.compare(0===b?this._accWithGX:1===b?this._accWithGY:2===b?this._accWithGZ:3===b?this._accX:4===b?this._accY:this._accZ,e,c)},OnNthTouchStart(b){b=Math.floor(b);return b===this._triggerIndex},OnNthTouchEnd(b){b=Math.floor(b);return b===this._triggerIndex},HasNthTouch(b){b=Math.floor(b);return this._touches.size>=b+1},OnHoldGesture(){return!0},OnTapGesture(){return!0},OnDoubleTapGesture(){return!0},
|
|
OnHoldGestureObject(b){return b&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,this._curTouchX,this._curTouchY,!1):!1},OnTapGestureObject(b){return b&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,this._curTouchX,this._curTouchY,!1):!1},OnDoubleTapGestureObject(b){return b&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(b,
|
|
this._curTouchX,this._curTouchY,!1):!1},OnPermissionGranted(b){return this._triggerPermission===b},OnPermissionDenied(b){return this._triggerPermission===b}}}"use strict";self.C3.Plugins.Touch.Acts={RequestPermission(d){this._RequestPermission(d)}};
|
|
{"use strict";const d=self.C3;d.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(a){const b=this._GetTouchByIndex(this._getTouchIndex);return b?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},Y(a){const b=this._GetTouchByIndex(this._getTouchIndex);return b?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},XAt(a,b){return(a=this._GetTouchByIndex(a))?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!0):0},YAt(a,b){return(a=this._GetTouchByIndex(a))?
|
|
a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!1):0},XForID(a,b){return(a=this._touches.get(a))?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!0):0},YForID(a,b){return(a=this._touches.get(a))?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!1):0},AbsoluteX(){const a=this._GetTouchByIndex(0);return a?a.GetX():0},AbsoluteY(){const a=this._GetTouchByIndex(0);return a?a.GetY():0},AbsoluteXAt(a){return(a=this._GetTouchByIndex(a))?a.GetX():0},AbsoluteYAt(a){return(a=this._GetTouchByIndex(a))?
|
|
a.GetY():0},AbsoluteXForID(a){return(a=this._touches.get(a))?a.GetX():0},AbsoluteYForID(a){return(a=this._touches.get(a))?a.GetY():0},SpeedAt(a){return(a=this._GetTouchByIndex(a))?a.GetSpeed():0},SpeedForID(a){return(a=this._touches.get(a))?a.GetSpeed():0},AngleAt(a){return(a=this._GetTouchByIndex(a))?d.toDegrees(a.GetAngle()):0},AngleForID(a){return(a=this._touches.get(a))?d.toDegrees(a.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(a){return(a=this._touches.get(a))?a.GetWidth():0},HeightForID(a){return(a=this._touches.get(a))?a.GetHeight():0},PressureForID(a){return(a=this._touches.get(a))?a.GetPressure():0}}}
|
|
{"use strict";const d=self.C3;let a=-1E3,b=-1E3,e=-1E4;d.Plugins.Touch.TouchInfo=class extends d.DefendedBase{constructor(){super();this._pressure=this._height=this._width=this._lastY=this._lastX=this._y=this._x=this._startY=this._startX=this._lastTime=this._time=this._startTime=this._startIndex=this._pointerId=0;this._isTooFarForHold=this._hasTriggeredHold=!1}Release(){}Init(c,f,g,h,l){this._pointerId=h;this._startIndex=l;this._startTime=this._lastTime=this._time=c;this._startX=f;this._startY=g;
|
|
this._x=f;this._y=g;this._lastX=f;this._lastY=g}Update(c,f,g,h,l,m){this._lastTime=this._time;this._time=c;this._lastX=this._x;this._lastY=this._y;this._x=f;this._y=g;this._width=h;this._height=l;this._pressure=m;!this._isTooFarForHold&&15<=d.distanceTo(this._startX,this._startY,this._x,this._y)&&(this._isTooFarForHold=!0)}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(c){this._lastTime=c}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const c=
|
|
d.distanceTo(this._x,this._y,this._lastX,this._lastY),f=(this._time-this._lastTime)/1E3;return 0<f?c/f:0}GetAngle(){return d.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(c){return this._hasTriggeredHold?!1:500<=c-this._startTime&&!this._isTooFarForHold&&15>d.distanceTo(this._startX,this._startY,this._x,this._y)?this._hasTriggeredHold=!0:!1}ShouldTriggerTap(c){if(this._hasTriggeredHold)return"";
|
|
if(333>=c-this._startTime&&!this._isTooFarForHold&&15>d.distanceTo(this._startX,this._startY,this._x,this._y)){if(666>=c-e&&25>d.distanceTo(a,b,this._x,this._y))return b=a=-1E3,e=-1E4,"double-tap";a=this._x;b=this._y;e=c;return"single-tap"}return""}GetPositionForLayer(c,f,g){return"undefined"===typeof f?c.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(this._x,this._y)[g?0:1]:(c=c.GetLayer(f))?c.CanvasCssToLayer(this._x,this._y)[g?0:1]:0}}}{"use strict";const d=self.C3;d.Plugins.Audio=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Audio.Type=class extends d.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};function a(){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(b){super(b)}get audioContext(){return a().GetAudioContext()}get destinationNode(){return a().GetDestinationNode()}}}
|
|
{"use strict";const d=self.C3,a=["interactive","balanced","playback"];d.Plugins.Audio.Instance=class extends d.SDKInstanceBase{constructor(b,e){super(b,"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;b="interactive";e&&(this._timeScaleMode=e[0],this._saveLoadMode=e[1],this._playInBackground=e[2],b=a[e[3]],this._panningModel=e[4],this._distanceModel=e[5],this._listenerZ=-e[6],this._referenceDistance=e[7],this._maxDistance=e[8],this._rolloffFactor=e[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=
|
|
[];this.AddDOMMessageHandlers([["state",c=>this._OnUpdateState(c)],["fxstate",c=>this._OnUpdateFxState(c)],["trigger",c=>this._OnTrigger(c)]]);e=this.GetRuntime().Dispatcher();this._disposables=new d.CompositeDisposable(d.Disposable.From(e,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)),d.Disposable.From(e,"afterload",()=>this._OnAfterLoad()),d.Disposable.From(e,"suspend",()=>this._OnSuspend()),d.Disposable.From(e,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",
|
|
{preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(c=>({originalUrl:c.originalUrl,url:c.url,type:c.type,fileSize:c.fileSize})),isiOSCordova:this._runtime.IsiOSCordova(),timeScaleMode:this._timeScaleMode,latencyHint:b,panningModel:this._panningModel,distanceModel:this._distanceModel,refDistance:this._referenceDistance,maxDistance:this._maxDistance,rolloffFactor:this._rolloffFactor,listenerPos:[this._listenerX,this._listenerY,this._listenerZ]}).then(c=>{this._sampleRate=c.sampleRate}));
|
|
this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_OnInstanceDestroyed(b){this._listenerInst===b&&(this._listenerInst=null)}DbToLinearNoCap(b){return Math.pow(10,b/20)}DbToLinear(b){b=this.DbToLinearNoCap(b);return isFinite(b)?Math.max(Math.min(b,1),0):0}LinearToDbNoCap(b){return Math.log(b)/Math.log(10)*20}LinearToDb(b){return this.LinearToDbNoCap(Math.max(Math.min(b,1),0))}_OnSuspend(){this._playInBackground||this.PostToDOM("set-suspended",{isSuspended:!0})}_OnResume(){this._playInBackground||
|
|
this.PostToDOM("set-suspended",{isSuspended:!1})}_OnUpdateState(b){const e=b.tickCount,c=this._lastAIState.filter(f=>f.hasOwnProperty("placeholder")&&(f.placeholder>e||-1===f.placeholder));this._lastAIState=b.audioInstances;this._lastAnalysersData=b.analysers;0<c.length&&d.appendArray(this._lastAIState,c)}_OnUpdateFxState(b){this._lastFxState=b.fxstate}_GetFirstAudioStateByTag(b){for(const e of this._lastAIState)if(d.equalsNoCase(e.tag,b))return e;return null}_IsTagPlaying(b){return this._lastAIState.some(e=>
|
|
d.equalsNoCase(b,e.tag)&&e.isPlaying)}_MaybeMarkAsPlaying(b,e,c,f){if(this._IsTagPlaying(b))return null;b={tag:b,duration:0,volume:f,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:e,isLooping:c,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(b);return b}async _OnTrigger(b){const e=b.type;this._triggerTag=b.tag;b=b.aiid;if("ended"===e){for(const c of this._lastAIState)if(c.aiid===b){c.isPlaying=!1;break}await this.TriggerAsync(d.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"===
|
|
e&&await this.TriggerAsync(d.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const b={timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),instPans:this.GetInstancePans(),tickCount:this._runtime.GetTickCountNoSave()};if(this._listenerInst){const e=this._listenerInst.GetWorldInfo();this._listenerX=e.GetX();this._listenerY=e.GetY();b.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",b)}rotatePtAround(b,e,c,f,g){if(0===c)return[b,e];const h=Math.sin(c);
|
|
c=Math.cos(c);b-=f;e-=g;const l=b*h;b=b*c-e*h;return[b+f,e*c+l+g]}GetInstancePans(){return this._lastAIState.filter(b=>-1!==b.uid).map(b=>this._runtime.GetInstanceByUID(b.uid)).filter(b=>b).map(b=>{const e=b.GetWorldInfo(),c=e.GetLayer().GetAngle(),[f,g]=this.rotatePtAround(e.GetX(),e.GetY(),-c,this._listenerX,this._listenerY);return{uid:b.GetUID(),x:f,y:g,angle:e.GetAngle()-c}})}GetAnalyserData(b,e){for(const c of this._lastAnalysersData)if(c.index===e&&d.equalsNoCase(c.tag,b))return c;return null}_IncrementEffectCount(b){this._effectCount.set(b,
|
|
(this._effectCount.get(b)||0)+1)}_ShouldSave(b){return b.hasOwnProperty("placeholder")||3===this._saveLoadMode?!1:b.isMusic&&1===this._saveLoadMode?!1:b.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(b=>this._ShouldSave(b)),effects:this._lastFxState,analysers:this._lastAnalysersData}}LoadFromJson(b){this._isSilent=
|
|
b.isSilent;this._masterVolume=b.masterVolume;this._listenerZ=b.listenerZ;this._listenerInst=null;this._loadListenerUid=b.listenerUid;this._remoteUrls.clear();if(b.remoteUrls)for(const [e,c]of b.remoteUrls)this._remoteUrls.set(e,c);this._lastAIState=b.playing;this._lastFxState=b.effects;this._lastAnalysersData=b.analysers}_OnAfterLoad(){if(-1!==this._loadListenerUid&&(this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid),this._loadListenerUid=-1,this._listenerInst)){var b=this._listenerInst.GetWorldInfo();
|
|
this._listenerX=b.GetX();this._listenerY=b.GetY()}for(var e of this._lastAIState)(b=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e.bufferOriginalUrl))?(e.bufferUrl=b.url,e.bufferType=b.type):e.bufferUrl=null;for(const c of Object.values(this._lastFxState))for(const f of c)f.hasOwnProperty("bufferOriginalUrl")&&(e=this._runtime.GetAssetManager().GetProjectAudioFileUrl(f.bufferOriginalUrl))&&(f.bufferUrl=e.url,f.bufferType=e.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(c=>null!==c.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const b=[];for(const [e,c]of Object.entries(this._lastFxState))b.push({name:"$"+e,value:c.map(f=>f.type).join(", ")});return[{title:"plugins.audio.debugger.tag-effects",properties:b},{title:"plugins.audio.debugger.currently-playing",
|
|
properties:[{name:"plugins.audio.debugger.currently-playing-count",value:this._lastAIState.length},...this._lastAIState.map((e,c)=>({name:"$#"+c,value:`${e.bufferOriginalUrl} ("${e.tag}") ${Math.round(10*e.playbackTime)/10} / ${Math.round(10*e.duration)/10}`}))]}]}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Audio.Cnds={OnEnded(a){return d.equalsNoCase(this._triggerTag,a)},OnFadeEnded(a){return d.equalsNoCase(this._triggerTag,a)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return!0},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const a of this._lastAIState)if(a.isPlaying)return!0;return!1},IsTagPlaying(a){return this._IsTagPlaying(a)}}}
|
|
{"use strict";const d=self.C3,a="lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ");d.Plugins.Audio.Acts={async Play(b,e,c,f){if(!this._isSilent){var g=b[1],h=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b[0]);if(h){var l=this._nextPlayTime;this._nextPlayTime=0;var m=this._MaybeMarkAsPlaying(f.toLowerCase(),g,0!==e,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:b[0],url:h.url,type:h.type,isMusic:g,tag:f.toLowerCase(),isLooping:0!==e,vol:this.DbToLinear(c),
|
|
pos:0,off:l,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{m&&(m.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(b,e,c,f,g,h,l,m,p,x){if(!this._isSilent){var v=b[1],r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b[0]);if(r){var q=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(x.toLowerCase(),v,0!==e,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:b[0],url:r.url,type:r.type,isMusic:v,tag:x.toLowerCase(),isLooping:0!==
|
|
e,vol:this.DbToLinear(c),pos:0,off:q,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:f,y:g,angle:d.toRadians(h),innerAngle:d.toRadians(l),outerAngle:d.toRadians(m),outerGain:this.DbToLinear(p)}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(b,e,c,f,g,h,l,m){if(!this._isSilent&&f&&(f=f.GetFirstPicked())&&f.GetWorldInfo()){var p=f.GetWorldInfo(),x=p.GetLayer().GetAngle(),[v,r]=this.rotatePtAround(p.GetX(),p.GetY(),-x,this._listenerX,this._listenerY),
|
|
q=b[1],y=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b[0]);if(y){var u=this._nextPlayTime;this._nextPlayTime=0;var t=this._MaybeMarkAsPlaying(m.toLowerCase(),q,0!==e,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:b[0],url:y.url,type:y.type,isMusic:q,tag:m.toLowerCase(),isLooping:0!==e,vol:this.DbToLinear(c),pos:0,off:u,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:v,y:r,angle:p.GetAngle()-x,innerAngle:d.toRadians(g),outerAngle:d.toRadians(h),outerGain:this.DbToLinear(l),
|
|
uid:f.GetUID()}})}finally{t&&(t.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(b,e,c,f,g){if(!this._isSilent){b=1===b;var h=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase());if(h){var l=this._nextPlayTime;this._nextPlayTime=0;var m=this._MaybeMarkAsPlaying(g.toLowerCase(),b,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:e,url:h.url,type:h.type,isMusic:b,tag:g.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(f),
|
|
pos:0,off:l,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{m&&(m.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(b,e,c,f,g,h,l,m,p,x,v){if(!this._isSilent){b=1===b;var r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase());if(r){var q=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(v.toLowerCase(),b,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:e,url:r.url,type:r.type,
|
|
isMusic:b,tag:v.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(f),pos:0,off:q,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:g,y:h,angle:d.toRadians(l),innerAngle:d.toRadians(m),outerAngle:d.toRadians(p),outerGain:this.DbToLinear(x)}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(b,e,c,f,g,h,l,m,p){if(!this._isSilent&&!this._isSilent&&g&&(g=g.GetFirstPicked())&&g.GetWorldInfo()){var x=g.GetWorldInfo(),v=x.GetLayer().GetAngle(),[r,q]=this.rotatePtAround(x.GetX(),
|
|
x.GetY(),-v,this._listenerX,this._listenerY);b=1===b;var y=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase());if(y){var u=this._nextPlayTime;this._nextPlayTime=0;var t=this._MaybeMarkAsPlaying(p.toLowerCase(),b,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:e,url:y.url,type:y.type,isMusic:b,tag:p.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(f),pos:0,off:u,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:r,y:q,
|
|
angle:x.GetAngle()-v,innerAngle:d.toRadians(h),outerAngle:d.toRadians(l),outerGain:this.DbToLinear(m),uid:g.GetUID()}})}finally{t&&(t.placeholder=this._runtime.GetTickCountNoSave())}}}},SetLooping(b,e){this.PostToDOM("set-looping",{tag:b.toLowerCase(),isLooping:0===e})},SetMuted(b,e){this.PostToDOM("set-muted",{tag:b.toLowerCase(),isMuted:0===e})},SetVolume(b,e){this.PostToDOM("set-volume",{tag:b.toLowerCase(),vol:this.DbToLinear(e)})},FadeVolume(b,e,c,f){this.PostToDOM("fade-volume",{tag:b.toLowerCase(),
|
|
vol:this.DbToLinear(e),duration:c,stopOnEnd:0===f})},async Preload(b){const e=b[1],c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b[0]);c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:b[0],url:c.url,type:c.type,isMusic:e}),this._preloadCount++)},async PreloadByName(b,e){b=1===b;const c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase());c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:e,url:c.url,
|
|
type:c.type,isMusic:b}),this._preloadCount++)},SetPlaybackRate(b,e){this.PostToDOM("set-playback-rate",{tag:b.toLowerCase(),rate:Math.max(e,0)})},Stop(b){this.PostToDOM("stop",{tag:b.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(b,e){this.PostToDOM("set-paused",{tag:b.toLowerCase(),paused:0===e})},Seek(b,e){this.PostToDOM("seek",{tag:b.toLowerCase(),pos:e})},SetSilent(b){2===b&&(b=this._isSilent?1:0);b=0===b;this._isSilent!==b&&(this._isSilent=b,this.PostToDOM("set-silent",{isSilent:b}))},
|
|
SetMasterVolume(b){b=this.DbToLinear(b);this._masterVolume!==b&&(this._masterVolume=b,this.PostToDOM("set-master-volume",{vol:b}))},AddFilterEffect(b,e,c,f,g,h,l){b=b.toLowerCase();e=a[e];this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"filter",tag:b,params:[e,c,f,g,h,d.clamp(l/100,0,1)]})},AddDelayEffect(b,e,c,f){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"delay",tag:b,params:[e,this.DbToLinear(c),d.clamp(f/100,0,1)]})},AddFlangerEffect(b,e,
|
|
c,f,g,h){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"flanger",tag:b,params:[e/1E3,c/1E3,f,g/100,d.clamp(h/100,0,1)]})},AddPhaserEffect(b,e,c,f,g,h,l){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"phaser",tag:b,params:[e,c,f,g,h,d.clamp(l/100,0,1)]})},AddConvolutionEffect(b,e,c,f){b=b.toLowerCase();const g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e[0]);g&&(this._IncrementEffectCount(b),this.PostToDOM("add-effect",
|
|
{type:"convolution",tag:b,bufferOriginalUrl:e[0],bufferUrl:g.url,bufferType:g.type,params:[0===c,d.clamp(f/100,0,1)]}))},AddGainEffect(b,e){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"gain",tag:b,params:[this.DbToLinear(e)]})},AddMuteEffect(b){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"gain",tag:b,params:[0]})},AddTremoloEffect(b,e,c){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"tremolo",
|
|
tag:b,params:[e,d.clamp(c/100,0,1)]})},AddRingModEffect(b,e,c){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"ringmod",tag:b,params:[e,d.clamp(c/100,0,1)]})},AddDistortionEffect(b,e,c,f,g,h){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"distortion",tag:b,params:[this.DbToLinearNoCap(e),this.DbToLinearNoCap(c),f,this.DbToLinearNoCap(g),d.clamp(h/100,0,1)]})},AddCompressorEffect(b,e,c,f,g,h){b=b.toLowerCase();this._IncrementEffectCount(b);
|
|
this.PostToDOM("add-effect",{type:"compressor",tag:b,params:[e,c,f,g/1E3,h/1E3]})},AddAnalyserEffect(b,e,c){b=b.toLowerCase();this._IncrementEffectCount(b);this.PostToDOM("add-effect",{type:"analyser",tag:b,params:[e,c]})},RemoveEffects(b){b=b.toLowerCase();this._effectCount.set(b,0);this.PostToDOM("remove-effects",{tag:b});this._lastFxState={}},SetEffectParameter(b,e,c,f,g,h){this.PostToDOM("set-effect-param",{tag:b.toLowerCase(),index:Math.floor(e),param:c,value:f,ramp:g,time:h})},SetListenerObject(b){b&&
|
|
(b=b.GetFirstPicked())&&b.GetWorldInfo()&&(this._listenerInst=b)},SetListenerZ(b){this._listenerZ=b},ScheduleNextPlay(b){this._nextPlayTime=Math.max(b,0)},UnloadAudio(b){const e=b[1];(b=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b[0]))&&this.PostToDOM("unload",{url:b.url,type:b.type,isMusic:e})},UnloadAudioByName(b,e){b=1===b;(e=this._runtime.GetAssetManager().GetProjectAudioFileUrl(e)||this._remoteUrls.get(e.toLowerCase()))&&this.PostToDOM("unload",{url:e.url,type:e.type,isMusic:b})},
|
|
UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(b,e,c){this._remoteUrls.set(c.toLowerCase(),{url:b,type:e})}}}"use strict";
|
|
self.C3.Plugins.Audio.Exps={Duration(d){return(d=this._GetFirstAudioStateByTag(d))?d.duration:0},PlaybackTime(d){return(d=this._GetFirstAudioStateByTag(d))?d.playbackTime:0},PlaybackRate(d){return(d=this._GetFirstAudioStateByTag(d))?d.playbackRate:0},Volume(d){return(d=this._GetFirstAudioStateByTag(d))?this.LinearToDb(d.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(d){return this._effectCount.get(d.toLowerCase())||0},AnalyserFreqBinCount(d,a){return(d=this.GetAnalyserData(d,
|
|
Math.floor(a)))?d.binCount:0},AnalyserFreqBinAt(d,a,b){d=this.GetAnalyserData(d,Math.floor(a));if(!d)return 0;b=Math.floor(b);return 0>b||b>=d.binCount?0:d.freqBins[b]},AnalyserPeakLevel(d,a){return(d=this.GetAnalyserData(d,Math.floor(a)))?d.peak:0},AnalyserRMSLevel(d,a){return(d=this.GetAnalyserData(d,Math.floor(a)))?d.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/1E3}};
|
|
{"use strict";const d=self.C3;d.Plugins.Spritefont2=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Spritefont2.Type=class extends d.SDKTypeBase{constructor(a){super(a);this._spriteFont=d.New(self.SpriteFont)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}GetSpriteFont(){return this._spriteFont}UpdateSettings(a,b,e,c){const f=this.GetImageInfo(),g=this._spriteFont;g.SetWidth(f.GetWidth());
|
|
g.SetHeight(f.GetHeight());g.SetCharacterWidth(a);g.SetCharacterHeight(b);g.SetCharacterSet(e);g.SetSpacingData(c);g.UpdateCharacterMap()}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=["left","center","right"],e=["top","center","bottom"];d.Plugins.Spritefont2.Instance=class extends d.SDKWorldInstanceBase{constructor(l,m){super(l);this._text="";this._enableBBcode=!0;this._characterHeight=this._characterWidth=16;this._characterSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@\u00b0+=*$\u00a3\u20ac<>";l="";this._characterScale=1;this._verticalAlign=this._horizontalAlign=this._lineHeight=this._characterSpacing=
|
|
0;this._wrapByWord=!0;this._spriteFontText=null;this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;m&&(this._text=m[0],this._enableBBcode=m[1],this._characterWidth=m[2],this._characterHeight=m[3],this._characterSet=m[4],l=m[5],this._characterScale=m[6],this._characterSpacing=m[7],this._lineHeight=m[8],this._horizontalAlign=m[9],this._verticalAlign=m[10],this._wrapByWord=0===m[11],this.GetWorldInfo().SetVisible(m[12]));this._sdkType.UpdateSettings(this._characterWidth,this._characterHeight,
|
|
this._characterSet,l);this._spriteFontText=d.New(self.SpriteFontText,this._sdkType.GetSpriteFont());m=this.GetWorldInfo();this._spriteFontText.SetSize(m.GetWidth(),m.GetHeight());this._UpdateSettings()}Release(){this._CancelTypewriter();this._spriteFontText.Release();this._spriteFontText=null;super.Release()}_UpdateSettings(){const l=this._spriteFontText;l&&(l.SetBBCodeEnabled(this._enableBBcode),l.SetText(this._text),l.SetWordWrapMode(this._wrapByWord?"word":"character"),l.SetHorizontalAlign(b[this._horizontalAlign]),
|
|
l.SetVerticalAlign(e[this._verticalAlign]),l.SetSpacing(this._characterSpacing),l.SetLineHeight(this._lineHeight))}Draw(l){const m=this._objectClass.GetImageInfo();var p=m.GetTexture();if(p){l.SetTexture(p);p=this.GetWorldInfo();var x=p.GetBoundingQuad(),v=this._spriteFontText;v.SetScale(this._characterScale);v.SetSceneGraphScale(p.GetSceneGraphScale());this._runtime.IsPixelRoundingEnabled()&&(x=p.PixelRoundQuad(x));v.SetSize(p.GetWidth(),p.GetHeight());v.GetSpriteFont().SetTexRect(m.GetTexRect());
|
|
v.SetColor(p.GetUnpremultipliedColor());v.Draw(l,x.getTlx(),x.getTly(),p.GetAngle())}}SaveToJson(){const l={t:this._text,ebbc:this._enableBBcode,csc:this._characterScale,csp:this._characterSpacing,lh:this._lineHeight,ha:this._horizontalAlign,va:this._verticalAlign,w:this._wrapByWord,cw:this._sdkType.GetSpriteFont().GetCharacterWidth(),ch:this._sdkType.GetSpriteFont().GetCharacterHeight(),cs:this._sdkType.GetSpriteFont().GetCharacterSet(),sd:this._sdkType.GetSpriteFont().GetSpacingData()};-1!==this._typewriterEndTime&&
|
|
(l.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return l}LoadFromJson(l){this._CancelTypewriter();this._text=l.t;this._enableBBcode=l.ebbc;this._characterScale=l.csc;this._characterSpacing=l.csp;this._lineHeight=l.lh;this._horizontalAlign=l.ha;this._verticalAlign=l.va;this._wrapByWord=l.w;if(l.hasOwnProperty("tw")){var m=l.tw;this._typewriterStartTime=m.st;this._typewriterEndTime=m.en;this._typewriterLength=l.l}m=this._sdkType.GetSpriteFont();m.SetCharacterWidth(l.cw);
|
|
m.SetCharacterHeight(l.ch);m.SetCharacterSet(l.cs);m.SetSpacingData(l.sd);this._UpdateSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(l){switch(l){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._sdkType.GetSpriteFont().GetCharacterWidth();case 3:return this._sdkType.GetSpriteFont().GetCharacterHeight();case 4:return this._sdkType.GetSpriteFont().GetCharacterSet();case 5:return this._sdkType.GetSpriteFont().GetSpacingData();case 6:return this._characterScale;
|
|
case 7:return this._characterSpacing;case 8:return this._lineHeight;case 9:return this._horizontalAlign;case 10:return this._verticalAlign;case 11:return this._wrapByWord?1:0}}SetPropertyValueByIndex(l,m){switch(l){case 0:if(this._text===m)break;this._text=m;this._UpdateSettings();break;case 1:if(this._enableBBcode===!!m)break;this._enableBBcode=!!m;this._UpdateSettings();break;case 2:this._sdkType.GetSpriteFont().SetCharacterWidth(m);break;case 3:this._sdkType.GetSpriteFont().SetCharacterHeight(m);
|
|
break;case 4:this._sdkType.GetSpriteFont().SetCharacterSet(m);break;case 5:this._sdkType.GetSpriteFont().SetSpacingData(m);break;case 6:if(this._characterScale===m)break;this._characterScale=m;this._UpdateSettings();break;case 7:if(this._characterSpacing===m)break;this._characterSpacing=m;this._UpdateSettings();break;case 8:if(this._lineHeight===m)break;this._lineHeight=m;this._UpdateSettings();break;case 9:if(this._horizontalAlign===m)break;this._horizontalAlign=m;this._UpdateSettings();break;case 10:if(this._verticalAlign===
|
|
m)break;this._verticalAlign=m;this._UpdateSettings();break;case 11:this._wrapByWord!==(0===m)&&(this._wrapByWord=0===m,this._UpdateSettings())}}_SetText(l){this._text!==l&&(this._text=l,this._spriteFontText.SetText(l),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(l,m){this._SetText(l);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+m/this.GetInstance().GetActiveTimeScale();this._typewriterLength=d.BBString.StripAnyTags(l).length;
|
|
this._spriteFontText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._spriteFontText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(d.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetScale(l){this._characterScale!==l&&(this._characterScale=l,this._spriteFontText.SetScale(this._characterScale),
|
|
this._runtime.UpdateRender())}_GetScale(){return this._characterScale}_SetCharacterSpacing(l){this._characterSpacing!==l&&(this._characterSpacing=l,this._spriteFontText.SetSpacing(this._characterSpacing),this._runtime.UpdateRender())}_GetCharacterSpacing(){return this._characterSpacing}_SetLineHeight(l){this._lineHeight!==l&&(this._lineHeight=l,this._spriteFontText.SetLineHeight(this._lineHeight),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeight}_SetHAlign(l){this._horizontalAlign!==
|
|
l&&(this._horizontalAlign=l,this._UpdateSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(l){this._verticalAlign!==l&&(this._verticalAlign=l,this._UpdateSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(l){l=!!l;this._wrapByWord!==l&&(this._wrapByWord=l,this._UpdateSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){var l=this._runtime.GetWallTime();l>=this._typewriterEndTime?
|
|
(this._CancelTypewriter(),this.Trigger(d.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(l=d.relerp(this._typewriterStartTime,this._typewriterEndTime,l,0,this._typewriterLength),l=Math.floor(l),l!==this._spriteFontText.GetDrawMaxCharacterCount()&&(this._spriteFontText.SetDrawMaxCharacterCount(l),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.spritefont2.name",properties:[{name:"plugins.spritefont2.properties.text.name",value:this._text,
|
|
onedit:l=>this._SetText(l)}]}]}GetScriptInterfaceClass(){return self.ISpriteFontInstance}};const c=new WeakMap,f=new Map([["left",0],["center",1],["right",2]]),g=new Map([["top",0],["center",1],["bottom",2]]),h=new Map([["word",!0],["character",!1]]);self.ISpriteFontInstance=class extends self.IWorldInstance{constructor(){super();c.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return c.get(this).GetText()}set text(l){a.RequireString(l);const m=c.get(this);m._CancelTypewriter();
|
|
m._SetText(l)}typewriterText(l,m){a.RequireString(l);a.RequireFiniteNumber(m);const p=c.get(this);p._CancelTypewriter();p._StartTypewriter(l,m)}typewriterFinish(){c.get(this)._FinishTypewriter()}set characterScale(l){a.RequireFiniteNumber(l);c.get(this)._SetScale(l)}get characterScale(){return c.get(this)._GetScale()}set characterSpacing(l){a.RequireFiniteNumber(l);c.get(this)._SetCharacterSpacing(l)}get characterSpacing(){return c.get(this)._GetCharacterSpacing()}set lineHeight(l){a.RequireFiniteNumber(l);
|
|
c.get(this)._SetLineHeight(l)}get lineHeight(){return c.get(this)._GetLineHeight()}set horizontalAlign(l){a.RequireString(l);l=f.get(l);if("undefined"===typeof l)throw Error("invalid mode");c.get(this)._SetHAlign(l)}get horizontalAlign(){return b[c.get(this)._GetHAlign()]}set verticalAlign(l){a.RequireString(l);l=g.get(l);if("undefined"===typeof l)throw Error("invalid mode");c.get(this)._SetVAlign(l)}get verticalAlign(){return e[c.get(this)._GetVAlign()]}set wordWrapMode(l){a.RequireString(l);l=h.get(l);
|
|
if("undefined"===typeof l)throw Error("invalid mode");c.get(this)._SetWrapByWord(l)}get wordWrapMode(){return c.get(this)._IsWrapByWord()?"word":"character"}}}{"use strict";const d=self.C3;d.Plugins.Spritefont2.Cnds={CompareText(a,b){return b?this._text===a:d.equalsNoCase(this._text,a)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}"use strict";
|
|
self.C3.Plugins.Spritefont2.Acts={SetText(d){this._CancelTypewriter();"number"===typeof d&&1E9>d&&(d=Math.round(1E10*d)/1E10);this._SetText(d.toString())},AppendText(d){this._CancelTypewriter();"number"===typeof d&&1E9>d&&(d=Math.round(1E10*d)/1E10);(d=d.toString())&&this._SetText(this._text+d)},TypewriterText(d,a){this._CancelTypewriter();"number"===typeof d&&1E9>d&&(d=Math.round(1E10*d)/1E10);this._StartTypewriter(d.toString(),a)},TypewriterFinish(){this._FinishTypewriter()},SetScale(d){this._SetScale(d)},
|
|
SetCharacterSpacing(d){this._SetCharacterSpacing(d)},SetLineHeight(d){this._SetLineHeight(d)},SetCharacterWidth(d,a){let b=!1;const e=this._sdkType.GetSpriteFont();for(const c of d)if(" "===c)e.SetSpaceWidth(a),b=!0;else if(d=e.GetCharacter(c))d.SetDisplayWidth(a),b=!0;b&&e.SetCharacterWidthsChanged();this._runtime.UpdateRender()},SetEffect(d){this.GetWorldInfo().SetBlendMode(d);this._runtime.UpdateRender()},SetHAlign(d){this._SetHAlign(d)},SetVAlign(d){this._SetVAlign(d)},SetWrapping(d){this._SetWrapByWord(0===
|
|
d)}};
|
|
{"use strict";const d=self.C3;d.Plugins.Spritefont2.Exps={CharacterWidth(a){return(a=this._sdkType.GetSpriteFont().GetCharacter(a))?a.GetDisplayWidth():this._sdkType.GetSpriteFont().GetCharacterWidth()},CharacterHeight(){return this._characterHeight},CharacterScale(){return this._characterScale},CharacterSpacing(){return this._characterSpacing},LineHeight(){return this._lineHeight},Text(){return this._text},PlainText(){return this._enableBBcode?d.BBString.StripAnyTags(this._text):this._text},TextWidth(){const a=
|
|
this.GetWorldInfo();this._spriteFontText.SetSize(a.GetWidth(),a.GetHeight());return this._spriteFontText.GetTextWidth()},TextHeight(){const a=this.GetWorldInfo();this._spriteFontText.SetSize(a.GetWidth(),a.GetHeight());return this._spriteFontText.GetTextHeight()}}}
|
|
{"use strict";const d=self.C3;self.SpriteFontCharacter=class{constructor(a,b,e,c){let f=a.GetCharacterWidth(),g=a.GetCharacterHeight();this._spriteFont=a;this._char=b;this._pxRect=new d.Rect(e,c,e+f,c+g);this._texRect=new d.Rect;this._displayWidth=-1;this._UpdateTexRect()}Release(){this._texRect=this._pxRect=this._spriteFont=null}_UpdateTexRect(){let a=this._spriteFont.GetWidth(),b=this._spriteFont.GetHeight();this._texRect.copy(this._pxRect);this._texRect.divide(a,b);this._texRect.lerpInto(this._spriteFont.GetTexRect())}GetSpriteFont(){return this._spriteFont}GetChar(){return this._char}GetTexRect(){return this._texRect}SetDisplayWidth(a){this._displayWidth=
|
|
a}GetDisplayWidth(){return 0>this._displayWidth?this._spriteFont.GetCharacterWidth():this._displayWidth}}}
|
|
{"use strict";const d=self.C3,a=new d.Rect,b=new d.Quad,e=new d.Color,c=new Set(["left","center","right"]),f=new Set(["top","center","bottom"]),g=new Set(["word","character"]);self.SpriteFontText=class{constructor(h){this._spriteFont=h;this._cssHeight=this._cssWidth=0;this._text="";this._isBBcodeEnabled=!1;this._bbString=null;this._wrappedText=d.New(d.WordWrap);this._wrapMode="word";this._wrapChanged=!1;this._horizontalAlign="left";this._verticalAlign="top";this._sceneGraphScale=this._scale=1;this._lineHeight=
|
|
this._spacing=0;this._color=d.New(d.Color);this._drawMaxCharCount=-1;this._drawCharCount=0;this._measureTextCallback=(l,m)=>this._MeasureText(l,m);this._spriteFont._AddSpriteFontText(this)}Release(){this._spriteFont._RemoveSpriteFontText(this);this._measureTextCallback=this._color=null;this._wrappedText.Clear();this._bbString=this._spriteFont=this._wrappedText=null}_MeasureText(h,l){var m=this._GetStyleTag(l,"scale"),p=(m?parseFloat(m.param):this._scale)*this._sceneGraphScale;m=this._GetStyleTag(l,
|
|
"scalex");m=(m?parseFloat(m.param):1)*p;l=this._GetStyleTag(l,"scaley");l=(l?parseFloat(l.param):1)*p;l=this._spriteFont.GetCharacterHeight()*l+this._lineHeight;const x=this.GetSpriteFont();p=x.GetCharacterWidth()*m;const v=this.GetSpacing();if(x.HasAnyCustomWidths()){let q=0,y=0;for(var r of h){h=p;const u=x.GetCharacter(r);u?h=u.GetDisplayWidth()*m:" "===r&&(h=x.GetSpaceWidth()*m);y+=h;++q}return{width:y+q*v,height:l}}r=[...h].length;return{width:p*r+Math.max(r,0)*v,height:l}}_SetWrapChanged(){this._wrapChanged=
|
|
!0;this._wrappedText.Clear()}SetSize(h,l){0>=h||0>=l||this._cssWidth===h&&this._cssHeight===l||(this._cssWidth!==h&&this._SetWrapChanged(),this._cssWidth=h,this._cssHeight=l)}SetDrawMaxCharacterCount(h){this._drawMaxCharCount=Math.floor(h)}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(h,l){for(let m=h.length-1;0<=m;--m){const p=h[m];if(p.tag===l)return p}return null}_HasStyleTag(h,l){return!!this._GetStyleTag(h,l)}_MaybeWrapText(){if(this._wrapChanged){!this._isBBcodeEnabled||
|
|
this._bbString&&this._bbString.toString()===this._text||(this._bbString=new d.BBString(this._text,{noEscape:!0}));var h=-this.GetSpacing();this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,h);this._wrapChanged=!1}}Draw(h,l,m,p){this._MaybeWrapText();let x=this._drawCharCount=0;const v=this._lineHeight,r=d.cloneArray(this._wrappedText.GetLines()),q=Math.sin(p);p=Math.cos(p);var y=r.reduce((u,t)=>u+t.height,
|
|
0)-v;"center"===this._verticalAlign?x=Math.max(Math.floor(this._cssHeight/2-y/2),0):"bottom"===this._verticalAlign&&(x=Math.floor(this._cssHeight-y));for(let u=0,t=r.length;u<t;++u){y=r[u];const A=y.height;if(0<u&&x>this._cssHeight-(A-v))break;0<=x&&this._DrawLine(h,y,l,m,x,q,p);x+=A}}_DrawLine(h,l,m,p,x,v,r){const q=l.height;let y=0;"center"===this._horizontalAlign?y=Math.max(Math.floor((this._cssWidth-l.width)/2),0):"right"===this._horizontalAlign&&(y=Math.max(Math.floor(this._cssWidth-l.width),
|
|
0));for(const u of l.fragments)this._DrawFragment(h,u,m,p,y,x,v,r,q),y+=u.width}_DrawFragment(h,l,m,p,x,v,r,q,y){var u=l.text,t=l.width,A=l.styles;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+u.length>this._drawMaxCharCount&&(u=u.substr(0,this._drawMaxCharCount-this._drawCharCount),t=this._MeasureText(u,A).width);this._drawCharCount+=u.length}var z=this._GetStyleTag(A,"background");if(!(d.IsStringAllWhitespace(u)&&!z||this._HasStyleTag(A,
|
|
"hide"))){l=this._GetStyleTag(A,"scale");var C=(l?parseFloat(l.param):this._scale)*this._sceneGraphScale;l=this._GetStyleTag(A,"scalex");l=(l?parseFloat(l.param):1)*C;var E=this._GetStyleTag(A,"scaley");C*=E?parseFloat(E.param):1;C*=this._spriteFont.GetCharacterHeight();v+=y-this._lineHeight-C;y=this._GetStyleTag(A,"offsetx");x+=y?parseFloat(y.param):0;y=this._GetStyleTag(A,"offsety");v+=y?parseFloat(y.param):0;z&&(h.SetColorFillMode(),e.parseString(z.param),e.setA(1),h.SetColor(e),a.set(x,v,x+t,
|
|
v+C),a.getRight()>this._cssWidth&&a.setRight(this._cssWidth),b.setFromRotatedRectPrecalc(a,r,q),b.offset(m,p),h.Quad(b),h.SetTextureFillMode());(t=this._GetStyleTag(A,"color"))?(e.parseString(t.param),e.setA(this._color.getA())):e.copy(this._color);(t=this._GetStyleTag(A,"opacity"))&&e.setA(e.getA()*parseFloat(t.param)/100);e.premultiply();h.SetColor(e);t=this._spriteFont.GetCharacterWidth()*l;A=Math.abs(this.GetSpacing());for(const J of u)if(u=this._spriteFont.GetCharacter(J)){z=u.GetDisplayWidth()*
|
|
l;if(x+z>this._cssWidth+A+1E-5)break;a.set(x,v,x+t,v+C);b.setFromRotatedRectPrecalc(a,r,q);b.offset(m,p);h.Quad3(b,u.GetTexRect());x+=z+this._spacing}else x+=this._spriteFont.GetSpaceWidth()*l+this._spacing}}GetSpriteFont(){return this._spriteFont}SetBBCodeEnabled(h){h=!!h;this._isBBcodeEnabled!==h&&(this._isBBcodeEnabled=h,this._SetWrapChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetText(h){this._text!==h&&(this._text=h,this._SetWrapChanged())}SetWordWrapMode(h){if(!g.has(h))throw Error("invalid word wrap mode");
|
|
this._wrapMode!==h&&(this._wrapMode=h,this._SetWrapChanged())}SetHorizontalAlign(h){if(!c.has(h))throw Error("invalid alignment");this._horizontalAlign=h}SetVerticalAlign(h){if(!f.has(h))throw Error("invalid alignment");this._verticalAlign=h}SetScale(h){this._scale!==h&&(this._scale=h,this._SetWrapChanged())}GetScale(){return this._scale}SetSceneGraphScale(h){this._sceneGraphScale!==h&&(this._sceneGraphScale=h,this._SetWrapChanged())}GetSceneGraphScale(){return this._sceneGraphScale}SetSpacing(h){this._spacing!==
|
|
h&&(this._spacing=h,this._SetWrapChanged())}GetSpacing(){return this._spacing}SetLineHeight(h){this._lineHeight=h;this._SetWrapChanged()}GetLineHeight(){return this._lineHeight}SetOpacity(h){h=d.clamp(h,0,1);this._color.a=h}SetColor(h){this._color.equals(h)||this._color.copy(h)}GetColor(){return this._color}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();var h=this._spriteFont.GetCharacterHeight()*this._scale;const l=this._lineHeight;
|
|
h+=l;return this._wrappedText.GetLineCount()*h-l}}}
|
|
{"use strict";const d=self.C3,a={width:256,height:256,characterWidth:16,characterHeight:16,characterSet:""};self.SpriteFont=class{constructor(b){b=Object.assign({},a,b);if(0>=b.width||0>=b.height||0>=b.characterWidth||0>=b.characterHeight)throw Error("invalid size");this._width=b.width;this._height=b.height;this._characterWidth=b.characterWidth;this._characterHeight=b.characterHeight;this._characterSet=b.characterSet;this._spacingData="";this._spacingParsed=null;this._hasAnyCustomWidths=!1;this._spaceWidth=
|
|
-1;this._texRect=new d.Rect(0,0,1,1);this._characterMap=new Map;this._mapChanged=!0;this._allTexts=new Set}Release(){this._texRect=null;this._ReleaseCharacters();this._characterMap=null;this._allTexts&&this._allTexts.clear();this._allTexts=null}_ReleaseCharacters(){for(let b of this._characterMap.values())b.Release();this._characterMap.clear()}_AddSpriteFontText(b){this._allTexts.add(b)}_RemoveSpriteFontText(b){this._allTexts.delete(b)}UpdateCharacterMap(){if(this._mapChanged){this._ReleaseCharacters();
|
|
var b=[...this._characterSet],e=Math.floor(this._width/this._characterWidth),c=e*Math.floor(this._height/this._characterHeight);for(let f=0,g=b.length;f<g&&!(f>=c);++f){let h=b[f];this._characterMap.set(h,d.New(self.SpriteFontCharacter,this,h,f%e*this._characterWidth,Math.floor(f/e)*this._characterHeight))}this._hasAnyCustomWidths=!1;this._spaceWidth=-1;if(Array.isArray(this._spacingParsed))for(let f of this._spacingParsed)if(Array.isArray(f)&&2===f.length&&(b=f[0],e=f[1],"number"===typeof b&&isFinite(b)&&
|
|
"string"===typeof e&&b!==this._characterWidth))for(let g of e)(e=this._characterMap.get(g))?(e.SetDisplayWidth(b),this._hasAnyCustomWidths=!0):" "===g&&(this._spaceWidth=b,this._hasAnyCustomWidths=!0);this._mapChanged=!1;for(let f of this._allTexts)f._SetWrapChanged()}}SetCharacterWidthsChanged(){this._hasAnyCustomWidths=!0;for(const b of this._allTexts)b._SetWrapChanged()}GetCharacter(b){this.UpdateCharacterMap();return this._characterMap.get(b)||null}HasAnyCustomWidths(){return this._hasAnyCustomWidths}SetWidth(b){b=
|
|
Math.floor(b);if(0>=b)throw Error("invalid size");this._width!==b&&(this._width=b,this._mapChanged=!0)}GetWidth(){return this._width}SetHeight(b){b=Math.floor(b);if(0>=b)throw Error("invalid size");this._height!==b&&(this._height=b,this._mapChanged=!0)}GetHeight(){return this._height}SetTexRect(b){if(!this._texRect.equals(b)){this._texRect.copy(b);for(const e of this._characterMap.values())e._UpdateTexRect()}}GetTexRect(){return this._texRect}SetCharacterWidth(b){b=Math.floor(b);if(0>=b)throw Error("invalid size");
|
|
this._characterWidth!==b&&(this._characterWidth=b,this._mapChanged=!0)}GetCharacterWidth(){return this._characterWidth}SetCharacterHeight(b){b=Math.floor(b);if(0>=b)throw Error("invalid size");this._characterHeight!==b&&(this._characterHeight=b,this._mapChanged=!0)}GetCharacterHeight(){return this._characterHeight}SetCharacterSet(b){this._characterSet!==b&&(this._characterSet=b,this._mapChanged=!0)}GetCharacterSet(){return this._characterSet}SetSpacingData(b){if(this._spacingData!==b&&(this._spacingData=
|
|
b,this._mapChanged=!0,this._spacingParsed=null,this._spacingData.length))try{this._spacingParsed=JSON.parse(this._spacingData)}catch(e){this._spacingParsed=null}}GetSpacingData(){return this._spacingData}SetSpaceWidth(b){0>b&&(b=-1);this._spaceWidth!==b&&(this._spaceWidth=b,0<=this._spaceWidth&&(this._hasAnyCustomWidths=!0))}GetSpaceWidth(){return 0>this._spaceWidth?this._characterWidth:this._spaceWidth}}}{"use strict";const d=self.C3;d.Plugins.LocalStorage=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Plugins.LocalStorage.Type=class extends d.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Plugins.LocalStorage.Instance=class extends d.SDKInstanceBase{constructor(a,b){super(a);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(a){this._errorMessage=this._GetErrorString(a);await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnError)}_GetErrorString(a){return a?
|
|
"string"===typeof a?a:"string"===typeof a.message?a.message:"string"===typeof a.name?a.name:"string"===typeof a.data?a.data:"unknown error":"unknown error"}GetDebuggerProperties(){this._isLoadingDebugCache||this._DebugCacheStorage();return[{title:"plugins.localstorage.name",properties:[...this._debugCache.entries()].map(a=>({name:"$"+a[0],value:a[1],onedit:b=>this._storage.setItem(a[0],b)}))}]}async _DebugCacheStorage(){this._isLoadingDebugCache=!0;try{const a=await this._storage.keys();a.sort((e,
|
|
c)=>{e=e.toLowerCase();c=c.toLowerCase();return e<c?-1:c<e?1:0});const b=await Promise.all(a.map(e=>this._storage.getItem(e)));this._debugCache.clear();for(let e=0,c=a.length;e<c;++e)this._debugCache.set(a[e],b[e])}catch(a){console.warn("[C3 debugger] Error displaying local storage: ",a)}finally{this._isLoadingDebugCache=!1}}}}
|
|
{"use strict";const d=self.C3;d.Plugins.LocalStorage.Cnds={OnItemSet(a){return this._currentKey===a},OnAnyItemSet(){return!0},OnItemGet(a){return this._currentKey===a},OnAnyItemGet(){return!0},OnItemRemoved(a){return this._currentKey===a},OnAnyItemRemoved(){return!0},OnCleared(){return!0},OnAllKeyNamesLoaded(){return!0},OnError(){return!0},OnItemExists(a){return this._currentKey===a},OnItemMissing(a){return this._currentKey===a},CompareKey(a,b){return d.compare(this._currentKey,a,b)},CompareValue(a,
|
|
b){return d.compare(this._lastValue,a,b)},IsProcessingSets(){return 0<this._pendingSets},IsProcessingGets(){return 0<this._pendingGets},OnAllSetsComplete(){return!0},OnAllGetsComplete(){return!0}}}
|
|
{"use strict";const d=self.C3;function a(b){return"string"===typeof b||"number"===typeof b}d.Plugins.LocalStorage.Acts={async SetItem(b,e){this._pendingSets++;try{const c=await this._storage.setItem(b,e);await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue=c;await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,0===this._pendingSets&&
|
|
await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},async SetBinaryItem(b,e){if(e&&(e=e.GetFirstPicked(this._inst))&&(e=e.GetSdkInstance())){e=e.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(b,e),await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue="";await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,
|
|
0===this._pendingSets&&await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},async GetItem(b){this._pendingGets++;try{const e=await this._storage.getItem(b);await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue=a(e)?e:"";await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(e){await this._TriggerStorageError(e)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}},
|
|
async GetBinaryItem(b,e){if(e&&(e=e.GetFirstPicked(this._inst))){var c=e.GetSdkInstance();this._pendingGets++;try{let f=await this._storage.getItem(b);f=f instanceof ArrayBuffer?f:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=b;c.SetArrayBufferTransfer(f);await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(f){await this._TriggerStorageError(f)}finally{this._pendingGets--,
|
|
0===this._pendingGets&&await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},async CheckItemExists(b){try{const e=await this._storage.getItem(b);await this.ScheduleTriggers(async()=>{this._currentKey=b;"undefined"===typeof e||null===e?(this._lastValue="",await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=a(e)?e:"",await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(e){await this._TriggerStorageError(e)}},async RemoveItem(b){try{await this._storage.removeItem(b),
|
|
await this.ScheduleTriggers(async()=>{this._currentKey=b;this._lastValue="";await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(e){await this._TriggerStorageError(e)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";d.clearArray(this._keyNamesList);await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnCleared)})}catch(b){await this._TriggerStorageError(b)}},
|
|
async GetAllKeyNames(){try{const b=await this._storage.keys();await this.ScheduleTriggers(async()=>{this._keyNamesList=b;await this.TriggerAsync(d.Plugins.LocalStorage.Cnds.OnAllKeyNamesLoaded)})}catch(b){await this._TriggerStorageError(b)}}}}"use strict";self.C3.Plugins.LocalStorage.Exps={ItemValue(){return this._lastValue},Key(){return this._currentKey},KeyCount(){return this._keyNamesList.length},KeyAt(d){d=Math.floor(d);return 0>d||d>=this._keyNamesList.length?"":this._keyNamesList[d]},ErrorMessage(){return this._errorMessage}};
|
|
{"use strict";const d=self.C3;d.Plugins.Tilemap=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};d.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL=-2147483648;d.Plugins.Tilemap.TILE_FLIPPED_VERTICAL=1073741824;d.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL=536870912;d.Plugins.Tilemap.TILE_FLAGS_MASK=3758096384;d.Plugins.Tilemap.TILE_ID_MASK=536870911}
|
|
{"use strict";const d=self.C3,a=d.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,b=d.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,e=d.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,c=d.Plugins.Tilemap.TILE_ID_MASK;d.Plugins.Tilemap.Type=class extends d.SDKTypeBase{constructor(f){super(f);this._tilePolys=[];this._areTilePolysCached=!1;this._maxTileIndex=0}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(f){return this.GetImageInfo().LoadStaticTexture(f,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}OnDynamicTextureLoadComplete(){for(const f of this.GetObjectClass().instancesIncludingPendingCreate())f.GetSdkInstance()._OnDynamicTextureLoadComplete()}LoadTilemapData(f,
|
|
g){this._maxTileIndex=g;for(const h of f)h?this._tilePolys.push({poly:h[0],use:!!h[1],flipmap:[[[null,null],[null,null]],[[null,null],[null,null]]]}):this._tilePolys.push(null)}_ForceCacheOfTileCollisionPolys(f,g){this._areTilePolysCached=!1;this._MaybeCacheTileCollisionPolys(f,g)}_MaybeCacheTileCollisionPolys(f,g){if(!this._areTilePolysCached){this._areTilePolysCached=!0;for(let h=0,l=this._tilePolys.length;h<l;++h)this._tilePolys[h]&&(this._CacheTilePoly(h,f,g,!1,!1,!1),this._CacheTilePoly(h,f,
|
|
g,!1,!1,!0),this._CacheTilePoly(h,f,g,!1,!0,!1),this._CacheTilePoly(h,f,g,!1,!0,!0),this._CacheTilePoly(h,f,g,!0,!1,!1),this._CacheTilePoly(h,f,g,!0,!1,!0),this._CacheTilePoly(h,f,g,!0,!0,!1),this._CacheTilePoly(h,f,g,!0,!0,!0))}}_CacheTilePoly(f,g,h,l,m,p){if(!(0>f||f>=this._tilePolys.length)&&(f=this._tilePolys[f])){var x=d.New(d.CollisionPoly,f.poly,f.use);x.transform(g,h,0);p&&x.diag();l&&x.mirror(g/2);m&&x.flip(h/2);f.flipmap[l?1:0][m?1:0][p?1:0]=null;f.flipmap[l?1:0][m?1:0][p?1:0]=x}}GetTilePoly(f){if(-1===
|
|
f)return null;var g=f&c;return 0>g||g>=this._tilePolys.length?null:(g=this._tilePolys[g])?g.flipmap[f&a?1:0][f&b?1:0][f&e?1:0]:null}IsTilePolyEnabled(f){return f?f.IsEnabled():!0}GetMaxTileIndex(){return this._maxTileIndex}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=d.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,e=d.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,c=d.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,f=d.Plugins.Tilemap.TILE_FLAGS_MASK,g=d.Plugins.Tilemap.TILE_ID_MASK,h=d.New(d.Rect),l=d.New(d.Rect);function m(v){const r=[];v=v.split(",");for(let t=0,A=v.length;t<A;++t){var q=v[t],y=q.indexOf("x");if(-1<y){var u=parseInt(q.substring(0,y),10);q=q.substring(y+1);y=parseInt(q,10);q.includes("h")&&(y|=b);q.includes("v")&&(y|=e);for(q.includes("d")&&
|
|
(y|=c);0<u;--u)r.push(y)}else u=parseInt(q,10),q.includes("h")&&(u|=b),q.includes("v")&&(u|=e),q.includes("d")&&(u|=c),r.push(u)}return r}d.Plugins.Tilemap.Instance=class extends d.SDKWorldInstanceBase{constructor(v,r){super(v);v=this.GetWorldInfo();this._tileHeight=this._tileWidth=32;this._mapHeight=this._mapWidth=this._tileYspacing=this._tileXspacing=this._tileYoffset=this._tileXoffset=0;this._lastWidth=v.GetWidth();this._lastHeight=v.GetHeight();this._cellHeight=this._cellWidth=0;this._tileCells=
|
|
[];this._tileTexQuads=new Map;this._isAnyQuadMapChanged=!0;this._ownImageInfo=null;r&&(v.SetVisible(r[0]),this._tileWidth=Math.max(r[1],1),this._tileHeight=Math.max(r[2],1),this._tileXoffset=r[3],this._tileYoffset=r[4],this._tileXspacing=r[5],this._tileYspacing=r[6]);this._cellWidth=Math.ceil(this._runtime.GetOriginalViewportWidth()/this._tileWidth);this._cellHeight=Math.ceil(this._runtime.GetOriginalViewportHeight()/this._tileHeight);this._sdkType._MaybeCacheTileCollisionPolys(this._tileWidth,this._tileHeight)}Release(){this._ReleaseOwnImage();
|
|
d.clearArray(this._tileCells);this._tileCells=null;this._tileTexQuads.clear();this._tileTexQuads=null;super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}LoadTilemapData(v,r,q){this._mapWidth=r;this._mapHeight=q;this._MaybeResizeTilemap(!0);this.SetTilesFromRLECSV(v);this._MaybeBuildAllQuadMap()}_MaybeResizeTilemap(v){const [r,q]=this.GetMapDisplaySize();if(!(r<=this._mapWidth&&q<=this._mapHeight)||v){if(v){v=Math.ceil(this._mapHeight/this._cellHeight);
|
|
var y=Math.ceil(this._mapWidth/this._cellWidth)}else v=this._tileCells.length,y=Math.ceil(this._mapWidth/this._cellWidth),q>this._mapHeight&&(this._mapHeight=q,v=Math.ceil(this._mapHeight/this._cellHeight)),r>this._mapWidth&&(this._mapWidth=r,y=Math.ceil(this._mapWidth/this._cellWidth)),this._SetAllQuadMapChanged(),this._SetPhysicsChanged(),this._runtime.UpdateRender();var u=this._tileCells;if(u.length<v)for(var t=u.length;t<v;++t)u.push([]);for(t=0;t<v;++t){const A=u[t];for(let z=A.length;z<y;++z)A.push(d.New(d.Plugins.Tilemap.TileCell,
|
|
this,z,t))}}}SetTilesFromRLECSV(v){v=m(v);let r=0;const q=this._mapWidth,y=this._cellWidth,u=this._cellHeight;for(let t=0,A=this._mapHeight;t<A;++t)for(let z=0;z<q;++z){const C=v[r++],E=this.GetCellAt(z,t);E&&E.SetTileAt(z%y,t%u,C)}}GetTilesAsRLECSV(){let v="";if(0>=this._mapWidth||0>=this._mapHeight)return v;let r=1;var q=this.GetTileAt(0,0);const [y,u]=this.GetMapDisplaySize();let t,A,z;for(let C=0;C<u;++C)for(let E=0===C?1:0;E<y;++E){const J=this.GetTileAt(E,C);J===q?++r:(-1===q?(t=-1,q=z=A=!1):
|
|
(t=q&g,A=0!==(q&b),z=0!==(q&e),q=0!==(q&c)),v=1===r?v+(""+t):v+(""+r+"x"+t),A&&(v+="h"),z&&(v+="v"),q&&(v+="d"),v+=",",r=1,q=J)}-1===q?(t=-1,q=z=A=!1):(t=q&g,A=0!==(q&b),z=0!==(q&e),q=0!==(q&c));v=1===r?v+(""+t):v+(""+r+"x"+t);A&&(v+="h");z&&(v+="v");q&&(v+="d");return v}_SetAllQuadMapChanged(){const v=this._tileCells;for(let r=0,q=v.length;r<q;++r){const y=v[r];for(let u=0,t=y.length;u<t;++u)y[u]._SetQuadMapChanged()}this._isAnyQuadMapChanged=!0}_MaybeBuildAllQuadMap(){if(this._isAnyQuadMapChanged){this._isAnyQuadMapChanged=
|
|
!1;var v=this._tileCells;for(let r=0,q=v.length;r<q;++r){const y=v[r];for(let u=0,t=y.length;u<t;++u)y[u].MaybeBuildQuadMap()}}}SetTileChanged(){this._isAnyQuadMapChanged=!0;this._SetPhysicsChanged();this._runtime.UpdateRender()}_SetPhysicsChanged(){this.GetWorldInfo().SetPhysicsBodyChanged(!0)}GetCellAt(v,r){if(0>v||0>r)return null;r=Math.floor(r/this._cellHeight);if(r>=this._tileCells.length)return null;r=this._tileCells[r];v=Math.floor(v/this._cellWidth);return v>=r.length?null:r[v]}GetCellAtIndex(v,
|
|
r){if(0>v||0>r||r>=this._tileCells.length)return null;r=this._tileCells[r];return v>=r.length?null:r[v]}GetTileAt(v,r){v=Math.floor(v);r=Math.floor(r);if(0>v||0>r||v>=this._mapWidth||r>=this._mapHeight)return-1;const q=this.GetCellAt(v,r);return q?q.GetTilesArr()[r%this._cellHeight][v%this._cellWidth]:-1}SetTileAt(v,r,q){v=Math.floor(v);r=Math.floor(r);if(!(0>v||0>r||v>=this._mapWidth||r>=this._mapHeight||-1!==q&&(q&g)>this.GetMaxTileIndex())){var y=this.GetCellAt(v,r);y&&y.SetTileAt(v%this._cellWidth,
|
|
r%this._cellHeight,q)}}GetMaxTileIndex(){return this._sdkType.GetMaxTileIndex()}WorldToCellX(v){return Math.floor((v-this.GetWorldInfo().GetX())/(this._cellWidth*this._tileWidth))}WorldToCellY(v){return Math.floor((v-this.GetWorldInfo().GetY())/(this._cellHeight*this._tileHeight))}WorldToTileX(v){return Math.floor((v-this.GetWorldInfo().GetX())/this._tileWidth)}WorldToTileY(v){return Math.floor((v-this.GetWorldInfo().GetY())/this._tileHeight)}GetMapWidth(){return this._mapWidth}GetMapHeight(){return this._mapHeight}GetMapDisplayWidth(){return Math.floor(this.GetWorldInfo().GetWidth()/
|
|
this.GetTileWidth())}GetMapDisplayHeight(){return Math.floor(this.GetWorldInfo().GetHeight()/this.GetTileHeight())}GetMapDisplaySize(){const v=this.GetWorldInfo();return[Math.floor(v.GetWidth()/this.GetTileWidth()),Math.floor(v.GetHeight()/this.GetTileHeight())]}GetTileWidth(){return this._tileWidth}GetTileHeight(){return this._tileHeight}GetCellWidth(){return this._cellWidth}GetCellHeight(){return this._cellHeight}GetCollisionRectCandidates(v,r){var q=this.WorldToCellX(v.getLeft());const y=this.WorldToCellY(v.getTop()),
|
|
u=this.WorldToCellX(v.getRight());for(v=this.WorldToCellY(v.getBottom());q<=u;++q)for(let t=y;t<=v;++t){const A=this.GetCellAtIndex(q,t);A&&(A.MaybeBuildQuadMap(),d.appendArray(r,A.GetCollisionRects()))}}TestPointOverlapTile(v,r){var q=this.WorldToTileX(v),y=this.WorldToTileY(r);q=this.GetTileAt(q,y);if(-1===q)return!1;q=this._sdkType.GetTilePoly(q);if(!q)return!0;if(!this._sdkType.IsTilePolyEnabled(q))return!1;var u=this.GetWorldInfo();y=Math.floor((v-u.GetX())/this._tileWidth)*this._tileWidth+u.GetX();
|
|
u=Math.floor((r-u.GetY())/this._tileHeight)*this._tileHeight+u.GetY();return q.containsPoint(v-y,r-u)}GetAllCollisionRects(v){const r=this._tileCells;for(let q=0,y=r.length;q<y;++q){const u=r[q];for(let t=0,A=u.length;t<A;++t){const z=u[t];z.MaybeBuildQuadMap();d.appendArray(v,z.GetCollisionRects())}}}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}GetTileUvQuad(v){const r=this._tileTexQuads;var q=r.get(v);if(q)return q;var y=v&g;q=0!==(v&b);const u=0!==(v&e),t=0!==
|
|
(v&c);var A=this.GetCurrentImageInfo(),z=A.GetWidth(),C=this._tileWidth,E=this._tileXspacing;C=Math.floor((Math.floor((z-this._tileXoffset)/(C+E)*C)+E)/C);z=y%C;y=Math.floor(y/C);C=A.GetOffsetX()+this._tileXoffset+(this._tileWidth+this._tileXspacing)*z;E=A.GetOffsetY()+this._tileYoffset+(this._tileHeight+this._tileYspacing)*y;h.setWH(C,E,this._tileWidth,this._tileHeight);h.divide(A.GetSheetWidth(),A.GetSheetHeight());A=d.New(d.Quad);A.setFromRect(h);t&&A.diag();q&&A.mirror();u&&A.flip();A.offset(z,
|
|
y);r.set(v,A);return A}_OnDynamicTextureLoadComplete(){this._tileTexQuads.clear();this._SetAllQuadMapChanged()}Draw(v){var r=this.GetCurrentImageInfo(),q=r.GetTexture();if(q){h.copy(r.GetTexRect());h.offsetLeft(this._tileXoffset/q.GetWidth());h.offsetTop(this._tileYoffset/q.GetHeight());v.SetTilemapFillMode();v.SetTilemapInfo(h,q.GetWidth(),q.GetHeight(),this._tileWidth,this._tileHeight,this._tileXspacing,this._tileYspacing);v.SetTexture(q);q=this.GetWorldInfo();if(q.GetWidth()!==this._lastWidth||
|
|
q.GetHeight()!==this._lastHeight)this._SetPhysicsChanged(),this._SetAllQuadMapChanged(),this._lastWidth=q.GetWidth(),this._lastHeight=q.GetHeight();q.GetLayer().GetViewportForZ(q.GetTotalZElevation(),l);r=q.GetX();q=q.GetY();this._runtime.IsPixelRoundingEnabled()&&(r=Math.round(r),q=Math.round(q));var y=this._cellWidth*this._tileWidth,u=this._cellHeight*this._tileHeight,t=Math.floor((l.getLeft()-r)/y);y=Math.floor((l.getRight()-r)/y);var A=Math.floor((l.getTop()-q)/u);for(u=Math.floor((l.getBottom()-
|
|
q)/u);t<=y;++t)for(let z=A;z<=u;++z){const C=this.GetCellAtIndex(t,z);C&&(C.MaybeBuildQuadMap(),C.Draw(v,l,r,q))}}}SaveToJson(){this._MaybeResizeTilemap();const [v,r]=this.GetMapDisplaySize();return{tw:this._tileWidth,th:this._tileHeight,tox:this._tileXoffset,toy:this._tileYoffset,tsx:this._tileXspacing,tsy:this._tileYspacing,w:v,h:r,d:this.GetTilesAsRLECSV()}}LoadFromJson(v){this._tileWidth=v.tw;this._tileHeight=v.th;this._tileXoffset=v.tox;this._tileYoffset=v.toy;this._tileXspacing=v.tsx;this._tileYspacing=
|
|
v.tsy;this._mapWidth=v.w;this._mapHeight=v.h;this._MaybeResizeTilemap(!0);this.SetTilesFromRLECSV(v.d);this._SetPhysicsChanged();this._SetAllQuadMapChanged()}GetAsJsonString(){this._MaybeResizeTilemap();const [v,r]=this.GetMapDisplaySize();return JSON.stringify({c2tilemap:!0,width:v,height:r,data:this.GetTilesAsRLECSV()})}StateComboToFlags(v){switch(v){case 0:return 0;case 1:return b;case 2:return e;case 3:return b|c;case 4:return b|e;case 5:return e|c;case 6:return b|e|c;case 7:return c;default:return 0}}GetPropertyValueByIndex(v){switch(v){case 1:return this._tileWidth;
|
|
case 2:return this._tileHeight;case 3:return this._tileXoffset;case 4:return this._tileYoffset;case 5:return this._tileXspacing;case 6:return this._tileYspacing}}SetPropertyValueByIndex(v,r){switch(v){case 1:if(this._tileWidth===r)break;this._tileWidth=Math.max(r,1);this._cellWidth=Math.ceil(this._runtime.GetOriginalViewportWidth()/this._tileWidth);this._sdkType._ForceCacheOfTileCollisionPolys();this._UpdateQuadMaps();break;case 2:if(this._tileHeight===r)break;this._tileHeight=Math.max(r,1);this._cellHeight=
|
|
Math.ceil(this._runtime.GetOriginalViewportHeight()/this._tileHeight);this._sdkType._ForceCacheOfTileCollisionPolys();this._UpdateQuadMaps();break;case 3:if(this._tileXoffset===r)break;this._tileXoffset=r;this._UpdateQuadMaps();break;case 4:if(this._tileYoffset===r)break;this._tileYoffset=r;this._UpdateQuadMaps();break;case 5:if(this._tileXspacing===r)break;this._tileXspacing=r;this._UpdateQuadMaps();break;case 6:this._tileYspacing!==r&&(this._tileYspacing=r,this._UpdateQuadMaps())}}_UpdateQuadMaps(){this._tileTexQuads.clear();
|
|
this._SetAllQuadMapChanged();this._MaybeBuildAllQuadMap()}GetScriptInterfaceClass(){return x}};const p=new WeakMap,x=self.ITilemapInstance=class extends self.IWorldInstance{constructor(){super();p.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get mapWidth(){return p.get(this).GetMapWidth()}get mapHeight(){return p.get(this).GetMapHeight()}get mapDisplayWidth(){return p.get(this).GetMapDisplayWidth()}get mapDisplayHeight(){return p.get(this).GetMapDisplayHeight()}get tileWidth(){return p.get(this).GetTileWidth()}get tileHeight(){return p.get(this).GetTileHeight()}getTileAt(v,
|
|
r){a.RequireFiniteNumber(v);a.RequireFiniteNumber(r);return p.get(this).GetTileAt(v,r)}setTileAt(v,r,q){a.RequireFiniteNumber(v);a.RequireFiniteNumber(r);a.RequireFiniteNumber(q);return p.get(this).SetTileAt(v,r,q)}};x.TILE_FLIPPED_HORIZONTAL=b;x.TILE_FLIPPED_VERTICAL=e;x.TILE_FLIPPED_DIAGONAL=c;x.TILE_FLAGS_MASK=f;x.TILE_ID_MASK=g}
|
|
{"use strict";const d=self.C3,a=d.Plugins.Tilemap.TILE_FLAGS_MASK,b=d.Plugins.Tilemap.TILE_ID_MASK;d.Plugins.Tilemap.Cnds={CompareTileAt(e,c,f,g){e=this.GetTileAt(e,c);-1!==e&&(e&=b);return d.compare(e,f,g)},CompareTileStateAt(e,c,f){e=this.GetTileAt(e,c);c=0;-1!==e&&(c=e&a);return c===this.StateComboToFlags(f)},OnURLLoaded(){return!0},OnURLFailed(){return!0}}}
|
|
{"use strict";const d=self.C3,a=d.Plugins.Tilemap.TILE_ID_MASK;d.Plugins.Tilemap.Acts={EraseTile(b,e){this._MaybeResizeTilemap();this.SetTileAt(b,e,-1)},SetTile(b,e,c,f){this._MaybeResizeTilemap();this.SetTileAt(b,e,c&a|this.StateComboToFlags(f))},SetTileState(b,e,c){const f=this.GetTileAt(b,e);-1!==f&&(this._MaybeResizeTilemap(),this.SetTileAt(b,e,f&a|this.StateComboToFlags(c)))},EraseTileRange(b,e,c,f){const g=Math.floor(Math.max(b,0));var h=Math.floor(Math.max(e,0));b=Math.floor(Math.min(b+c,this._mapWidth));
|
|
for(e=Math.floor(Math.min(e+f,this._mapHeight));h<e;++h)for(f=g;f<b;++f)this.SetTileAt(f,h,-1)},SetTileRange(b,e,c,f,g,h){this._MaybeResizeTilemap();const l=Math.floor(Math.max(b,0));var m=Math.floor(Math.max(e,0));b=Math.floor(Math.min(b+c,this._mapWidth));e=Math.floor(Math.min(e+f,this._mapHeight));for(g=g&a|this.StateComboToFlags(h);m<e;++m)for(h=l;h<b;++h)this.SetTileAt(h,m,g)},SetTileStateRange(b,e,c,f,g){this._MaybeResizeTilemap();const h=Math.floor(Math.max(b,0));var l=Math.floor(Math.max(e,
|
|
0));b=Math.floor(Math.min(b+c,this._mapWidth));e=Math.floor(Math.min(e+f,this._mapHeight));for(g=this.StateComboToFlags(g);l<e;++l)for(f=h;f<b;++f)c=this.GetTileAt(f,l),-1!==c&&this.SetTileAt(f,l,c&a|g)},LoadFromJSON(b){let e=null;try{e=JSON.parse(b)}catch(c){console.error("[Construct 3] Failed to parse tilemap JSON: ",c);return}e.c2tilemap?(this._mapWidth=e.width,this._mapHeight=e.height,this._MaybeResizeTilemap(!0),this.SetTilesFromRLECSV(e.data),this._SetAllQuadMapChanged(),this._SetPhysicsChanged()):
|
|
console.error("[Construct 3] Unrecognized JSON data format")},JSONDownload(b){const e=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(e,b)},async LoadURL(b,e){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==b){e=this._runtime;var c=d.New(d.ImageInfo);try{await c.LoadDynamicAsset(e,b);if(!c.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return c.Release(),null;if(!await c.LoadStaticTexture(e.GetRenderer(),{sampling:this._runtime.GetSampling()}))return}catch(f){console.error("Load image from URL failed: ",
|
|
f);this.Trigger(d.Plugins.Tilemap.Cnds.OnURLFailed);return}this.WasReleased()?c.Release():(this._ReleaseOwnImage(),this._ownImageInfo=c,e.UpdateRender(),this._tileTexQuads.clear(),this._SetAllQuadMapChanged(),await this.TriggerAsync(d.Plugins.Tilemap.Cnds.OnURLLoaded))}},SetEffect(b){2<=b&&b++;this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()}}}
|
|
{"use strict";const d=self.C3,a=d.Plugins.Tilemap.TILE_ID_MASK;d.Plugins.Tilemap.Exps={TileAt(b,e){b=this.GetTileAt(b,e);return-1===b?-1:b&a},PositionToTileX(b){return this.WorldToTileX(b)},PositionToTileY(b){return this.WorldToTileY(b)},TileToPositionX(b){return b*this._tileWidth+this.GetWorldInfo().GetX()+this._tileWidth/2},TileToPositionY(b){return b*this._tileHeight+this.GetWorldInfo().GetY()+this._tileHeight/2},SnapX(b){const e=this.GetWorldInfo().GetX();return Math.floor((b-e)/this._tileWidth)*
|
|
this._tileWidth+e+this._tileWidth/2},SnapY(b){const e=this.GetWorldInfo().GetY();return Math.floor((b-e)/this._tileHeight)*this._tileHeight+e+this._tileHeight/2},TilesJSON(){return this.GetAsJsonString()},TileWidth(){return this.GetTileWidth()},TileHeight(){return this.GetTileHeight()},MapDisplayWidth(){return this.GetMapDisplayWidth()},MapDisplayHeight(){return this.GetMapDisplayHeight()}}}
|
|
{"use strict";const d=self.C3,a=d.Plugins.Tilemap.TILE_FLIPPED_HORIZONTAL,b=d.Plugins.Tilemap.TILE_FLIPPED_VERTICAL,e=d.Plugins.Tilemap.TILE_FLIPPED_DIAGONAL,c=d.Plugins.Tilemap.TILE_ID_MASK,f=d.New(d.Rect),g=d.New(d.Quad);d.Plugins.Tilemap.TileQuad=class extends d.DefendedBase{constructor(){super();this._tileId=this._id=-1;this._isDiagFlip=this._isVertFlip=this._isHorizFlip=!1;this._rc=d.New(d.Rect);this._uv=null}Update(h,l,m,p,x,v,r,q){this._id=h;this._tileId=h&c;this._isHorizFlip=0!==(h&a);this._isVertFlip=
|
|
0!==(h&b);this._isDiagFlip=0!==(h&e);this._rc.setWH(p*l+v,x*m+r,l,m);this._uv=q.GetTileUvQuad(this._id)}Draw(h,l,m,p,x){f.copy(this._rc);f.offset(m,p);f.intersectsRect(l)&&(g.setFromRect(f),h.Quad4(g,this._uv))}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Tilemap.TileCollisionRect=class extends d.DefendedBase{constructor(){super();this._id=-1;this._poly=null;this._rc=d.New(d.Rect)}Update(a,b,e,c,f,g,h,l){this._id=a;this._poly=b;this._rc.setWH(f*e+h,g*c+l,e,c)}ExtendRight(a){this._rc.setRight(this._rc.getRight()+a)}GetTileId(){return this._id}HasPoly(){return!!this._poly}GetPoly(){return this._poly}GetRect(){return this._rc}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Tilemap.TileCell=class extends d.DefendedBase{constructor(a,b,e){super();const c=a.GetCellWidth(),f=a.GetCellHeight();this._sdkInst=a;this._x=b;this._y=e;this._left=this._x*c*a.GetTileWidth();this._top=this._y*f*a.GetTileHeight();this._tiles=[];this._quads=[];this._collisionRects=[];this._isQuadMapValid=!1;for(a=0;a<f;++a)b=new Int32Array(c),b.fill(-1),this._tiles.push(b)}Clear(){const a=this._sdkInst.GetCellWidth();var b=this._sdkInst.GetCellHeight();const e=
|
|
this._tiles;if(e.length<b)for(let c=e.length;c<b;++c)e.push(new Int32Array(a));else e.length>b&&d.truncateArray(e,b);for(let c=0,f=e.length;c<f;++c)b=e[c],b.length!==a&&(b=new Int32Array(a),e[c]=b),b.fill(-1)}_SetQuadMapChanged(){this._isQuadMapValid=!1}MaybeBuildQuadMap(){if(!this._isQuadMapValid){var a=this._sdkInst,b=a.GetSdkType(),e=a.GetWorldInfo(),c=a.GetTileWidth(),f=a.GetTileHeight(),g=a.GetCellWidth(),h=a.GetCellHeight(),l=this._left,m=this._top;if(!(0>=c||0>=f)){var p=Math.min(a.GetMapWidth(),
|
|
Math.floor(e.GetWidth()/c));e=Math.min(a.GetMapHeight(),Math.floor(e.GetHeight()/f));p-=l/c;e-=m/f;p>g&&(p=g);e>h&&(e=h);g=this._tiles;h=this._quads;var x=0;for(var v=0;v<e;++v){var r=g[v];for(var q=0;q<p;++q){var y=r[q];if(-1!==y){var u=void 0;x<h.length?u=h[x]:(u=d.New(d.Plugins.Tilemap.TileQuad),h.push(u));u.Update(y,c,f,q,v,l,m,a);++x}}}x<h.length&&d.truncateArray(h,x);h=null;x=!1;a=this._collisionRects;d.clearArray(a);for(v=0;v<e;++v){r=g[v];for(q=0;q<p;++q){y=r[q];u=b.GetTilePoly(y);const t=
|
|
b.IsTilePolyEnabled(u);-1!==y&&t?!h||u||x?(h&&a.push(h),h=d.New(d.Plugins.Tilemap.TileCollisionRect),h.Update(y,u,c,f,q,v,l,m),x=!!u):h.ExtendRight(c):h&&(a.push(h),h=null,x=!1)}h&&(a.push(h),h=null,x=!1)}b=a.length;for(c=0;c<b;++c)if(l=a[c],!l.HasPoly())for(l=l.GetRect(),m=c+1;m<b;++m)p=a[m],e=p.GetRect(),e.getTop()<l.getBottom()||e.getTop()>l.getBottom()||e.getRight()>l.getRight()||e.getLeft()>l.getLeft()||p.HasPoly()||e.getLeft()!==l.getLeft()||e.getRight()!==l.getRight()||(a.splice(m,1),--b,l.setBottom(l.getBottom()+
|
|
f),--m);this._isQuadMapValid=!0}}}SetTileAt(a,b,e){this._tiles[b][a]!==e&&(this._tiles[b][a]=e,this._isQuadMapValid=!1,this._sdkInst.SetTileChanged())}GetTilesArr(){return this._tiles}GetCollisionRects(){return this._collisionRects}Draw(a,b,e,c){const f=this._sdkInst,g=this._quads;for(let h=0,l=g.length;h<l;++h)g[h].Draw(a,b,e,c,f)}}}{"use strict";const d=self.C3;d.Plugins.Browser=class extends d.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Browser.Type=class extends d.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Plugins.Browser.Instance=class extends d.SDKInstanceBase{constructor(a,b){super(a,"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",e=>this._OnOnlineStateChanged(e)],["backbutton",()=>this._OnBackButton()],["sw-message",e=>this._OnSWMessage(e)],["hashchange",
|
|
e=>this._OnHashChange(e)]]);a=this.GetRuntime().Dispatcher();this._disposables=new d.CompositeDisposable(d.Disposable.From(a,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),d.Disposable.From(a,"window-resize",()=>this._OnWindowResize()),d.Disposable.From(a,"suspend",()=>this._OnSuspend()),d.Disposable.From(a,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state",{exportType:this._runtime.GetExportType()}).then(e=>{this._initLocationStr=e.location;
|
|
this._isOnline=e.isOnline;this._referrer=e.referrer;this._docTitle=e.title;this._isCookieEnabled=e.isCookieEnabled;this._screenWidth=e.screenWidth;this._screenHeight=e.screenHeight;this._windowOuterWidth=e.windowOuterWidth;this._windowOuterHeight=e.windowOuterHeight;this._isScirraArcade=e.isScirraArcade}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(a){a=!!a.isOnline;this._isOnline!==a&&((this._isOnline=a)?await this.TriggerAsync(d.Plugins.Browser.Cnds.OnOnline):
|
|
await this.TriggerAsync(d.Plugins.Browser.Cnds.OnOffline))}async _OnWindowResize(){await this.TriggerAsync(d.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(d.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(d.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(d.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(a){a=a.type;"downloading-update"===a?this.Trigger(d.Plugins.Browser.Cnds.OnUpdateFound):"update-ready"===a||"update-pending"===a?this.Trigger(d.Plugins.Browser.Cnds.OnUpdateReady):
|
|
"offline-ready"===a&&this.Trigger(d.Plugins.Browser.Cnds.OnOfflineReady)}_OnHashChange(a){this._initLocationStr=a.location;this.Trigger(d.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(d){const a=this._runtime.GetCanvasManager().GetLastWidth(),b=this._runtime.GetCanvasManager().GetLastHeight();return(a<=b?0:1)===d},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 d=self.C3,a="portrait landscape portrait-primary portrait-secondary landscape-primary landscape-secondary".split(" ");d.Plugins.Browser.Acts={Alert(b){this.PostToDOM("alert",{message:b.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(b,e){this._PostToDOMMaybeSync("navigate",{type:"url",url:b,target:e,exportType:this._runtime.GetExportType()})},GoToURLWindow(b,e){this._PostToDOMMaybeSync("navigate",{type:"new-window",url:b,tag:e,exportType:this._runtime.GetExportType()})},RequestFullScreen(b,
|
|
e){2<=b&&(b+=1);6===b&&(b=2);1===b&&(b=0);b=d.CanvasManager._FullscreenModeNumberToString(b);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(b);this._PostToDOMMaybeSync("request-fullscreen",{navUI:e})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(b){b=b.split(",");for(let e=0,c=b.length;e<c;++e)b[e]=parseInt(b[e],10);this._PostToDOMMaybeSync("vibrate",{pattern:b})},async InvokeDownload(b,e){b&&e&&(b=await this._runtime.GetAssetManager().GetProjectFileUrl(b),this._runtime.InvokeDownload(b,
|
|
e))},InvokeDownloadString(b,e,c){c&&(b=`data:${e},${encodeURIComponent(b)}`,this._runtime.InvokeDownload(b,c))},ConsoleLog(b,e){e=e.toString();0===b?console.log(e):1===b?console.warn(e):2===b&&console.error(e)},ConsoleGroup(b){console.group(b)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(b){try{eval(b)}catch(e){console.error("Error executing JavaScript: ",e)}},LockOrientation(b){b=Math.floor(b);0>b||b>=a.length||this._PostToDOMMaybeSync("lock-orientation",{orientation:a[b]})},UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")},
|
|
LoadStyleSheet(b){this._runtime.GetAssetManager().LoadStyleSheet(b)},SetHash(b){this.PostToDOM("set-hash",{hash:b})}}}"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(d){const a=this._runtime.IsInWorker()?(new URL(this._initLocationStr)).search:location.search;return(d=RegExp("[?&]"+d+"=([^&]*)").exec(a))?decodeURIComponent(d[1].replace(/\+/g," ")):""},Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},
|
|
Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(d){let a=0;try{a=eval(d)}catch(b){console.error("Error executing JavaScript: ",b)}return"number"===typeof a||"string"===typeof a?a:"boolean"===typeof a?a?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 d=navigator.connection;return d?d.downlink||
|
|
d.downlinkMax||d.bandwidth||Infinity:Infinity},ConnectionType(){const d=navigator.connection;return d?d.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 d=self.C3;d.Behaviors.Platform=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const d=self.C3;d.Behaviors.Platform.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=self.IBehaviorInstance;function e(g,h,l,m,p){return d.clamp(g*p+.5*m*p*p,h*p,l*p)}d.Behaviors.Platform.Instance=class extends d.SDKBehaviorInstanceBase{constructor(g,h){super(g);this._keyboardDisposables=null;this._simJump=this._simRight=this._simLeft=this._ignoreInput=this._canDoubleJump=this._doubleJumped=this._jumped=this._jumpKey=this._rightKey=this._leftKey=!1;this._lastFloorObject=null;this._loadFloorUid=-1;this._lastFloorY=this._lastFloorX=0;this._wasOnFloor=
|
|
this._floorIsJumpthru=!1;this._wasOverJumpthru=!!this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst);this._loadJumpthruUid=-1;this._animMode="stopped";this._fallThrough=0;this._isFirstTick=!0;this._rightY=this._rightX=this._downY=this._downX=this._dy=this._dx=0;this._g1=this._g=1500;this._ga=d.toRadians(90);this._maxSpeed=330;this._dec=this._acc=1500;this._jumpStrength=650;this._maxFall=1E3;this._enableDoubleJump=!1;this._sustainTime=this._jumpSustain=0;this._defaultControls=!0;this._ceilingCollisionMode=
|
|
0;this._isEnabled=!0;h&&(this._maxSpeed=h[0],this._acc=h[1],this._dec=h[2],this._jumpStrength=h[3],this._g=h[4],this._maxFall=h[5],this._enableDoubleJump=!!h[6],this._jumpSustain=h[7]/1E3,this._defaultControls=!!h[8],this._isEnabled=!!h[9]);g=this._runtime.Dispatcher();this._disposables=new d.CompositeDisposable(d.Disposable.From(g,"instancedestroy",l=>this._OnInstanceDestroyed(l.instance)),d.Disposable.From(g,"afterload",l=>this._OnAfterLoad()));this._defaultControls&&this._BindEvents();this._isEnabled&&
|
|
this._StartPostTicking();this._UpdateGravity();this._inst.GetUnsavedDataMap().set("isPlatformBehavior",!0)}Release(){this._keyboardDisposables&&(this._keyboardDisposables.Release(),this._keyboardDisposables=null);this._wasOverJumpthru=this._lastFloorObject=null;super.Release()}_BindEvents(){if(!this._keyboardDisposables){var g=this._runtime.Dispatcher();this._keyboardDisposables=new d.CompositeDisposable(d.Disposable.From(g,"keydown",h=>this._OnKeyDown(h.data)),d.Disposable.From(g,"keyup",h=>this._OnKeyUp(h.data)),
|
|
d.Disposable.From(g,"window-blur",()=>this._OnWindowOrKeyboardBlur()),d.Disposable.From(g,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}}_UnBindEvents(){this._keyboardDisposables&&(this._keyboardDisposables.Release(),this._keyboardDisposables=null)}_OnInstanceDestroyed(g){this._lastFloorObject===g&&(this._lastFloorObject=null);this._wasOverJumpthru===g&&(this._wasOverJumpthru=null)}_OnKeyDown(g){switch(g.key){case "ArrowLeft":this._leftKey=!0;break;case "ArrowRight":this._rightKey=!0;break;
|
|
case "ArrowUp":this._jumpKey=!0}}_OnKeyUp(g){switch(g.key){case "ArrowLeft":this._leftKey=!1;break;case "ArrowRight":this._rightKey=!1;break;case "ArrowUp":this._jumped=this._jumpKey=!1}}_OnWindowOrKeyboardBlur(){this._jumped=this._jumpKey=this._rightKey=this._leftKey=!1}SaveToJson(){return{ii:this._ignoreInput,lfx:this._lastFloorX,lfy:this._lastFloorY,lfo:this._lastFloorObject?this._lastFloorObject.GetUID():-1,am:this._animMode,en:this._isEnabled,fall:this._fallThrough,ft:this._isFirstTick,dx:this._dx,
|
|
dy:this._dy,ms:this._maxSpeed,acc:this._acc,dec:this._dec,js:this._jumpStrength,g:this._g,g1:this._g1,mf:this._maxFall,wof:this._wasOnFloor,woj:this._wasOverJumpthru?this._wasOverJumpthru.GetUID():-1,ga:this._ga,edj:this._enableDoubleJump,cdj:this._canDoubleJump,dj:this._doubleJumped,sus:this._jumpSustain,dc:this._defaultControls,cc:this._ceilingCollisionMode}}LoadFromJson(g){this._ignoreInput=g.ii;this._lastFloorX=g.lfx;this._lastFloorY=g.lfy;this._loadFloorUid=g.lfo;this._animMode=g.am;const h=
|
|
g.en;this._fallThrough=g.fall;this._isFirstTick=g.ft;this._dx=g.dx;this._dy=g.dy;this._maxSpeed=g.ms;this._acc=g.acc;this._dec=g.dec;this._jumpStrength=g.js;this._g=g.g;this._g1=g.g1;this._maxFall=g.mf;this._wasOnFloor=g.wof;this._loadJumpthruUid=g.woj;this._ga=g.ga;this._enableDoubleJump=g.edj;this._canDoubleJump=g.cdj;this._doubleJumped=g.dj;this._jumpSustain=g.sus;this._defaultControls=g.dc;this._ceilingCollisionMode=g.cc||0;this._simJump=this._simRight=this._simLeft=this._jumped=this._jumpKey=
|
|
this._rightKey=this._leftKey=!1;this._sustainTime=0;this._defaultControls?this._BindEvents():this._UnBindEvents();this._SetEnabled(h);this._UpdateGravity()}_OnAfterLoad(){this._lastFloorObject=-1===this._loadFloorUid?null:this._runtime.GetInstanceByUID(this._loadFloorUid);this._wasOverJumpthru=-1===this._loadJumpthruUid?null:this._runtime.GetInstanceByUID(this._loadJumpthruUid)}_UpdateGravity(){this._downX=Math.cos(this._ga);this._downY=Math.sin(this._ga);this._rightX=Math.cos(this._ga-Math.PI/2);
|
|
this._rightY=Math.sin(this._ga-Math.PI/2);this._downX=d.round6dp(this._downX);this._downY=d.round6dp(this._downY);this._rightX=d.round6dp(this._rightX);this._rightY=d.round6dp(this._rightY);this._g1=this._g;0>this._g&&(this._downX*=-1,this._downY*=-1,this._g=Math.abs(this._g))}_GetGDir(){return 0>this._g?-1:1}_IsOnFloor(){var g=this._inst.GetWorldInfo();const h=this._runtime.GetCollisionEngine(),l=this._inst;var m=this._lastFloorObject;const p=g.GetX(),x=g.GetY();g.OffsetXY(this._downX,this._downY);
|
|
g.SetBboxChanged();if(m&&h.TestOverlap(l,m)&&(!m.GetObjectClass().HasSolidBehavior()||h.IsSolidCollisionAllowed(m,l)))return g.SetXY(p,x),g.SetBboxChanged(),m;{let v=h.TestOverlapSolid(l);m=null;v||0!==this._fallThrough||(m=h.TestOverlapJumpthru(l,!0));g.SetXY(p,x);g.SetBboxChanged();if(v){if(h.TestOverlap(l,v))return null;this._floorIsJumpthru=!1;return v}if(m&&m.length){g=0;for(let r=0,q=m.length;r<q;++r)m[g]=m[r],h.TestOverlap(l,m[r])||++g;if(1<=g)return this._floorIsJumpthru=!0,m[0]}return null}}PostTick(){if(this._isEnabled){var g=
|
|
this._runtime.GetDt(this._inst);this._jumpKey||this._simJump||(this._jumped=!1);var h=this._leftKey||this._simLeft,l=this._rightKey||this._simRight,m=this._jumpKey||this._simJump,p=m&&!this._jumped;this._simJump=this._simRight=this._simLeft=!1;this._ignoreInput&&(p=m=l=h=!1);m||(this._sustainTime=0);this._HandleFirstTick();var [x,,v]=this._TrackMovingPlatform(),r=this._IsOnFloor(),q=r&&!this._wasOnFloor,y;[y,r]=this._MaybePushOutSolid(r);if(!y){this._TrackFloor(r,v,x,m);p=this._HandleJump(r,p,m);
|
|
r||this._ApplyJumpGravity(p,m,g);this._wasOnFloor=!!r;h=this._ApplyHorizontalAcceleration(h,l,g);l=!1;m=0;0!==this._dx&&(l=this._HandleHorizontalMovement(g,h,r,p));if(0!==this._dy){const [u,t]=this._HandleVerticalMovement(g,r);l=l||u;m=t}!l&&q&&0>this._dy&&0<m&&(this._dy=0,l=!0);this._HandleAnimationTriggers(r,l,p);0<this._fallThrough&&this._fallThrough--;this._wasOverJumpthru=this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst)}}}_HandleFirstTick(){if(this._isFirstTick){var g=this._inst,
|
|
h=this._runtime.GetCollisionEngine();(h.TestOverlapSolid(g)||h.TestOverlapJumpthru(g))&&h.PushOutSolid(g,-this._downX,-this._downY,4,!0);this._isFirstTick=!1}}_TrackMovingPlatform(){var g=this._lastFloorObject,h=g?g.GetWorldInfo():null;let l=0,m=0;var p=!1;if(g&&0===this._dy&&(h.GetY()!==this._lastFloorY||h.GetX()!==this._lastFloorX)){g=this._inst;p=g.GetWorldInfo();const x=this._runtime.GetCollisionEngine(),v=h.GetX();h=h.GetY();l=v-this._lastFloorX;m=h-this._lastFloorY;p.OffsetXY(l,m);p.SetBboxChanged();
|
|
this._lastFloorX=v;this._lastFloorY=h;p=!0;x.TestOverlapSolid(g)&&x.PushOutSolid(g,-l,-m,2.5*Math.hypot(l,m))}return[l,m,p]}_MaybePushOutSolid(g){let h=!1;var l=this._inst,m=l.GetWorldInfo();const p=this._runtime.GetCollisionEngine(),x=p.TestOverlapSolid(l);if(!x)return[!1,g];const v=Math.abs(m.GetWidth());m=Math.abs(m.GetHeight());l.GetSavedDataMap().get("inputPredicted")?p.PushOutSolid(l,-this._downX,-this._downY,10,!1):p.PushOutSolidAxis(l,-this._downX,-this._downY,m/8)?(p.RegisterCollision(l,
|
|
x),this._lastFloorObject=g=x,l=x.GetWorldInfo(),this._lastFloorX=l.GetX(),this._lastFloorY=l.GetY(),this._floorIsJumpthru=!1):p.PushOutSolidAxis(l,this._rightX,this._rightY,v/2)||p.PushOutSolidAxis(l,this._downX,this._downY,m/2)||p.PushOutSolidNearest(l,Math.max(v,m)/2)?p.RegisterCollision(l,x):h=!0;return[h,g]}_TrackFloor(g,h,l,m){const p=this._inst,x=this._runtime.GetCollisionEngine();if(g){m=this._downX;const v=this._downY,r=this._rightX,q=this._rightY;this._canDoubleJump=this._doubleJumped=!1;
|
|
0<this._dy&&(this._wasOnFloor||(x.PushInFractional(p,-m,-v,g,16),this._wasOnFloor=!0),this._dy=0);this._lastFloorObject!==g?(this._lastFloorObject=g,l=g.GetWorldInfo(),this._lastFloorX=l.GetX(),this._lastFloorY=l.GetY(),x.RegisterCollision(p,g)):h&&(g=x.TestOverlapSolid(p))&&(x.RegisterCollision(p,g),0!==l&&(0<l?x.PushOutSolid(p,-r,-q):x.PushOutSolid(p,r,q)),x.PushOutSolid(p,-m,-v))}else m||(this._canDoubleJump=!0)}_HandleJump(g,h,l){if(g&&h||!g&&this._enableDoubleJump&&l&&this._canDoubleJump&&!this._doubleJumped){h=
|
|
this._inst;l=h.GetWorldInfo();const m=this._runtime.GetCollisionEngine(),p=l.GetX(),x=l.GetY();l.OffsetXY(-this._downX,-this._downY);l.SetBboxChanged();m.TestOverlapSolid(h)?h=!1:(this._sustainTime=this._jumpSustain,this.Trigger(d.Behaviors.Platform.Cnds.OnJump),this._animMode="jumping",this._dy=-this._jumpStrength,h=!0,g?this._jumped=!0:this._doubleJumped=!0);l.SetXY(p,x);l.SetBboxChanged()}return h}_ApplyJumpGravity(g,h,l){h&&0<this._sustainTime?(this._dy=-this._jumpStrength,this._sustainTime-=
|
|
l):(this._lastFloorObject=null,this._dy+=this._g*l,this._dy>this._maxFall&&(this._dy=this._maxFall));g&&(this._jumped=!0)}_ApplyHorizontalAcceleration(g,h,l){const m=this._acc,p=this._dec;g===h&&(0>this._dx?(this._dx+=p*l,0<this._dx&&(this._dx=0)):0<this._dx&&(this._dx-=p*l,0>this._dx&&(this._dx=0)));let x=0;g&&!h&&(x=0<this._dx?-(m+p):-m);h&&!g&&(x=0>this._dx?m+p:m);this._dx+=x*l;this._dx=d.clamp(this._dx,-this._maxSpeed,this._maxSpeed);return x}_HandleHorizontalMovement(g,h,l,m){const p=this._inst;
|
|
var x=p.GetWorldInfo();const v=this._runtime.GetCollisionEngine(),r=this._downX,q=this._downY,y=this._rightX,u=this._rightY;var t=this._maxSpeed;let A=!1;var z=x.GetX();let C=x.GetY();var E=e(this._dx,-t,t,h,g)*y;const J=e(this._dx,-t,t,h,g)*u;x.OffsetXY(y*(1<this._dx?1:-1)-r,u*(1<this._dx?1:-1)-q);x.SetBboxChanged();h=!1;t=v.TestOverlapSolid(p);x.SetXY(z+E,C+J);x.SetBboxChanged();let G=v.TestOverlapSolid(p);!G&&l&&(G=v.TestOverlapJumpthru(p))&&(x.SetXY(z,C),x.SetBboxChanged(),v.TestOverlap(p,G)?
|
|
(G=null,h=!1):h=!0,x.SetXY(z+E,C+J),x.SetBboxChanged());G?(E=Math.abs(this._dx*g)+2,t||!v.PushOutSolid(p,-r,-q,E,h,G))?(v.RegisterCollision(p,G),E=Math.max(Math.abs(this._dx*g*2.5),30),v.PushOutSolid(p,y*(0>this._dx?1:-1),u*(0>this._dx?1:-1),E,!1)?!l||h||this._floorIsJumpthru||(z=x.GetX(),C=x.GetY(),x.OffsetXY(r,q),v.TestOverlapSolid(p)?v.PushOutSolid(p,-r,-q,3,!1)||(x.SetXY(z,C),x.SetBboxChanged()):(x.SetXY(z,C),x.SetBboxChanged())):(x.SetXY(z,C),x.SetBboxChanged()),h||(this._dx=0)):!t&&!m&&Math.abs(this._dy)<
|
|
Math.abs(this._jumpStrength/4)&&(this._dy=0,l||(A=!0)):(z=this._IsOnFloor(),l&&!z?(g=Math.ceil(Math.abs(this._dx*g))+2,z=x.GetX(),C=x.GetY(),x.OffsetXY(r*g,q*g),x.SetBboxChanged(),v.TestOverlapSolid(p)||v.TestOverlapJumpthru(p)?v.PushOutSolid(p,-r,-q,g+2,!0):(x.SetXY(z,C),x.SetBboxChanged())):z&&(!l&&this._floorIsJumpthru&&(this._lastFloorObject=z,x=z.GetWorldInfo(),this._lastFloorX=x.GetX(),this._lastFloorY=x.GetY(),this._dy=0,A=!0),0===this._dy&&v.PushInFractional(p,-r,-q,z,16)));return A}_HandleVerticalMovement(g,
|
|
h){const l=this._inst,m=l.GetWorldInfo(),p=this._runtime.GetCollisionEngine(),x=this._downX,v=this._downY;let r=!1,q=m.GetX(),y=m.GetY();const u=e(this._dy,-Infinity,this._maxFall,this._g,g);m.OffsetXY(u*x,u*v);var t=m.GetX();const A=m.GetY();m.SetBboxChanged();let z=p.TestOverlapSolid(l);var C=!1;if(!z&&0<this._dy&&!h){if((C=0<this._fallThrough?null:p.TestOverlapJumpthru(l,!0))&&C.length){if(this._wasOverJumpthru){m.SetXY(q,y);m.SetBboxChanged();h=0;for(let E=0,J=C.length;E<J;++E)C[h]=C[E],p.TestOverlap(l,
|
|
C[E])||++h;d.truncateArray(C,h);m.SetXY(t,A);m.SetBboxChanged()}1<=C.length&&(z=C[0])}C=!!z}if(z)if(p.RegisterCollision(l,z),this._sustainTime=0,t=1.1,C&&!this._wasOverJumpthru&&(t=2),p.PushOutSolid(l,x*(0>this._dy?1:-1),v*(0>this._dy?1:-1),Math.max(Math.abs(this._dy*g*t),2),C,z)){this._lastFloorObject=z;g=z.GetWorldInfo();this._lastFloorX=g.GetX();this._lastFloorY=g.GetY();(this._floorIsJumpthru=C)&&(r=!0);if(0<this._dy||0===this._ceilingCollisionMode)this._dy=0;0>this._dy&&1===this._ceilingCollisionMode&&
|
|
p.PushInFractional(l,x,v,z,32)}else m.SetXY(q,y),m.SetBboxChanged(),this._wasOnFloor=!0,C||(this._dy=0);return[r,u]}_HandleAnimationTriggers(g,h,l){"falling"!==this._animMode&&0<this._dy&&!g&&(this.Trigger(d.Behaviors.Platform.Cnds.OnFall),this._animMode="falling");(g||h)&&0<=this._dy&&("falling"===this._animMode||h||l&&0===this._dy?(this.Trigger(d.Behaviors.Platform.Cnds.OnLand),this._animMode=0===this._dx&&0===this._dy?"stopped":"moving"):("stopped"!==this._animMode&&0===this._dx&&0===this._dy&&
|
|
(this.Trigger(d.Behaviors.Platform.Cnds.OnStop),this._animMode="stopped"),"moving"===this._animMode||0===this._dx&&0===this._dy||l||(this.Trigger(d.Behaviors.Platform.Cnds.OnMove),this._animMode="moving")))}_IsMoving(){return 0!==this._GetVectorX()||0!==this._GetVectorY()}_CheckIfStandingOnFloor(){if(0!==this._dy)return!1;const g=this._inst;var h=this.GetWorldInfo();const l=this._runtime.GetCollisionEngine(),m=h.GetX(),p=h.GetY();h.OffsetXY(this._downX,this._downY);h.SetBboxChanged();const x=l.TestOverlapSolid(g);
|
|
let v=null;x||0!==this._fallThrough||(v=l.TestOverlapJumpthru(g,!0));h.SetXY(m,p);h.SetBboxChanged();if(x)return!l.TestOverlap(g,x);if(v&&v.length){h=0;for(let r=0,q=v.length;r<q;++r)v[h]=v[r],l.TestOverlap(g,v[r])||h++;if(1<=h)return!0}return!1}_IsByWall(g){const h=this._inst,l=this.GetWorldInfo(),m=this._runtime.GetCollisionEngine(),p=l.GetX(),x=l.GetY();0===g?l.OffsetXY(2*-this._rightX,2*-this._rightY):l.OffsetXY(2*this._rightX,2*this._rightY);l.SetBboxChanged();if(!m.TestOverlapSolid(h))return l.SetXY(p,
|
|
x),l.SetBboxChanged(),!1;l.OffsetXY(3*-this._downX,3*-this._downY);l.SetBboxChanged();g=!!m.TestOverlapSolid(h);l.SetXY(p,x);l.SetBboxChanged();return g}_FallThroughJumpThru(){const g=this.GetWorldInfo(),h=g.GetX(),l=g.GetY();g.OffsetXY(this._downX,this._downY);g.SetBboxChanged();const m=this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst,!1);g.SetXY(h,l);g.SetBboxChanged();m&&(this._fallThrough=3,this._lastFloorObject=null)}_ResetDoubleJump(g){this._doubleJumped=!g}_GetSpeed(){return Math.hypot(this._dx,
|
|
this._dy)}_GetMovingAngle(){return Math.atan2(this._dy,this._dx)}_IsJumping(){return 0>this._dy}_IsFalling(){return 0<this._dy}_SetMaxSpeed(g){this._maxSpeed=Math.max(g,0)}_GetMaxSpeed(){return this._maxSpeed}_SetAcceleration(g){this._acc=Math.max(g,0)}_GetAcceleration(){return this._acc}_SetDeceleration(g){this._dec=Math.max(g,0)}_GetDeceleration(){return this._dec}_SetJumpStrength(g){this._jumpStrength=Math.max(g,0)}_GetJumpStrength(){return this._jumpStrength}_SetMaxFallSpeed(g){this._maxFall=
|
|
Math.max(g,0)}_GetMaxFallSpeed(){return this._maxFall}_SetGravity(g){if(this._g1!==g){this._g=g;this._UpdateGravity();g=this._runtime.GetCollisionEngine();var h=this.GetWorldInfo();g.TestOverlapSolid(this._inst)&&(g.PushOutSolid(this._inst,this._downX,this._downY,10),h.OffsetXY(2*this._downX,2*this._downY),h.SetBboxChanged());this._lastFloorObject=null}}_GetGravity(){return this._g}_SetGravityAngle(g){g=d.clampAngle(g);this._ga!==g&&(this._ga=g,this._UpdateGravity(),this._lastFloorObject=null)}_GetGravityAngle(){return this._ga}_SetDoubleJumpEnabled(g){this._enableDoubleJump=
|
|
!!g}_IsDoubleJumpEnabled(){return this._enableDoubleJump}_SetJumpSustain(g){this._jumpSustain=g}_GetJumpSustain(){return this._jumpSustain}_SetCeilingCollisionMode(g){this._ceilingCollisionMode=g}_GetCeilingCollisionMode(){return this._ceilingCollisionMode}_SetVectorX(g){this._dx=g}_GetVectorX(){return this._dx}_SetVectorY(g){this._dy=g}_GetVectorY(){return this._dy}_SimulateControl(g){if(this._isEnabled)switch(g){case 0:this._simLeft=!0;break;case 1:this._simRight=!0;break;case 2:this._simJump=!0}}_SetDefaultControls(g){g=
|
|
!!g;this._defaultControls!==g&&((this._defaultControls=g)?this._BindEvents():(this._UnBindEvents(),this._OnWindowOrKeyboardBlur()))}_IsDefaultControls(){return this._defaultControls}_SetIgnoreInput(g){this._ignoreInput=!!g}_IsIgnoreInput(){return this._ignoreInput}_SetEnabled(g){g=!!g;this._isEnabled!==g&&((this._isEnabled=g)?this._StartPostTicking():(this._StopPostTicking(),this._lastFloorObject=null,this._simJump=this._simRight=this._simLeft=!1))}_IsEnabled(){return this._isEnabled}GetPropertyValueByIndex(g){switch(g){case 0:return this._GetMaxSpeed();
|
|
case 1:return this._GetAcceleration();case 2:return this._GetDeceleration();case 3:return this._GetJumpStrength();case 4:return this._GetGravity();case 5:return this._GetMaxFallSpeed();case 6:return this._IsDoubleJumpEnabled();case 7:return 1E3*this._GetJumpSustain();case 8:return this._IsDefaultControls();case 9:return this._IsEnabled()}}SetPropertyValueByIndex(g,h){switch(g){case 0:this._SetMaxSpeed(h);break;case 1:this._SetAcceleration(h);break;case 2:this._SetDeceleration(h);break;case 3:this._SetJumpStrength(h);
|
|
break;case 4:this._SetGravity(h);break;case 5:this._SetMaxFallSpeed(h);break;case 6:this._SetDoubleJumpEnabled(!!h);break;case 7:this._SetJumpSustain(h/1E3);break;case 8:this._SetDefaultControls(!!h);break;case 9:this._SetEnabled(!!h)}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.platform.debugger.vector-x",value:this._GetVectorX(),onedit:g=>this._SetVectorX(g)},{name:"behaviors.platform.debugger.vector-y",value:this._GetVectorY(),onedit:g=>
|
|
this._SetVectorY(g)},{name:"behaviors.platform.properties.max-speed.name",value:this._GetMaxSpeed(),onedit:g=>this._SetMaxSpeed(g)},{name:"behaviors.platform.properties.acceleration.name",value:this._GetAcceleration(),onedit:g=>this._SetAcceleration(g)},{name:"behaviors.platform.properties.deceleration.name",value:this._GetDeceleration(),onedit:g=>this._SetDeceleration(g)},{name:"behaviors.platform.properties.jump-strength.name",value:this._GetJumpStrength(),onedit:g=>this._SetJumpStrength(g)},{name:"behaviors.platform.properties.gravity.name",
|
|
value:this._GetGravity(),onedit:g=>this._SetGravity(g)},{name:"behaviors.platform.debugger.gravity-angle",value:d.toDegrees(this._GetGravityAngle()),onedit:g=>this._SetGravityAngle(d.toRadians(g))},{name:"behaviors.platform.properties.max-fall-speed.name",value:this._GetMaxFallSpeed(),onedit:g=>this._SetMaxFallSpeed(g)},{name:"behaviors.platform.debugger.animation-mode",value:["behaviors.platform.debugger.anim-"+this._animMode]},{name:"behaviors.platform.properties.enabled.name",value:this._IsEnabled(),
|
|
onedit:g=>this._SetEnabled(g)}]}]}GetScriptInterfaceClass(){return self.IPlatformBehaviorInstance}};const c=new WeakMap,f=new Map([["left",0],["right",1],["jump",2]]);self.IPlatformBehaviorInstance=class extends b{constructor(){super();c.set(this,b._GetInitInst().GetSdkInstance())}fallThrough(){c.get(this)._FallThroughJumpThru()}resetDoubleJump(g){c.get(this)._ResetDoubleJump(!!g)}simulateControl(g){a.RequireString(g);g=f.get(g);if("number"!==typeof g)throw Error("invalid control");c.get(this)._SimulateControl(g)}get speed(){return c.get(this)._GetSpeed()}get maxSpeed(){return c.get(this)._GetMaxSpeed()}set maxSpeed(g){a.RequireFiniteNumber(g);
|
|
c.get(this)._SetMaxSpeed(g)}get acceleration(){return c.get(this)._GetAcceleration()}set acceleration(g){a.RequireFiniteNumber(g);c.get(this)._SetAcceleration(g)}get deceleration(){return c.get(this)._GetDeceleration()}set deceleration(g){a.RequireFiniteNumber(g);c.get(this)._SetDeceleration(g)}get jumpStrength(){return c.get(this)._GetJumpStrength()}set jumpStrength(g){a.RequireFiniteNumber(g);c.get(this)._SetJumpStrength(g)}get maxFallSpeed(){return c.get(this)._GetMaxFallSpeed()}set maxFallSpeed(g){a.RequireFiniteNumber(g);
|
|
c.get(this)._SetMaxFallSpeed(g)}get gravity(){return c.get(this)._GetGravity()}set gravity(g){a.RequireFiniteNumber(g);c.get(this)._SetGravity(g)}get gravityAngle(){return c.get(this)._GetGravityAngle()}set gravityAngle(g){a.RequireFiniteNumber(g);c.get(this)._SetGravityAngle(g)}get isDoubleJumpEnabled(){return c.get(this)._IsDoubleJumpEnabled()}set isDoubleJumpEnabled(g){c.get(this)._SetDoubleJumpEnabled(!!g)}get jumpSustain(){return c.get(this)._GetJumpSustain()}set jumpSustain(g){a.RequireFiniteNumber(g);
|
|
c.get(this)._SetJumpSustain(g)}get ceilingCollisionMode(){return 0===c.get(this)._GetCeilingCollisionMode()?"stop":"preserve-momentum"}set ceilingCollisionMode(g){a.RequireString(g);const h=c.get(this);if("stop"===g)h._SetCeilingCollisionMode(0);else if("preserve-momentum"===g)h._SetCeilingCollisionMode(1);else throw Error("invalid mode");}get isOnFloor(){return c.get(this)._CheckIfStandingOnFloor()}isByWall(g){a.RequireString(g);const h=c.get(this);if("left"===g)return h._IsByWall(0);if("right"===
|
|
g)return h._IsByWall(1);throw Error("invalid side");}get isMoving(){return c.get(this)._IsMoving()}get isJumping(){return c.get(this)._IsJumping()}get isFalling(){return c.get(this)._IsFalling()}get vectorX(){return c.get(this)._GetVectorX()}set vectorX(g){a.RequireFiniteNumber(g);c.get(this)._SetVectorX(g)}get vectorY(){return c.get(this)._GetVectorY()}set vectorY(g){a.RequireFiniteNumber(g);c.get(this)._SetVectorY(g)}get isDefaultControls(){return c.get(this)._IsDefaultControls()}set isDefaultControls(g){c.get(this)._SetDefaultControls(!!g)}get isIgnoringInput(){return c.get(this)._IsIgnoreInput()}set isIgnoringInput(g){c.get(this)._SetIgnoreInput(!!g)}get isEnabled(){return c.get(this)._IsEnabled()}set isEnabled(g){c.get(this)._SetEnabled(!!g)}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Platform.Cnds={IsMoving(){return this._IsMoving()},CompareSpeed(a,b){return d.compare(this._GetSpeed(),a,b)},IsOnFloor(){return this._CheckIfStandingOnFloor()},IsByWall(a){return this._IsByWall(a)},IsJumping(){return this._IsJumping()},IsFalling(){return this._IsFalling()},IsDoubleJumpEnabled(){return this._IsDoubleJumpEnabled()},OnJump(){return!0},OnFall(){return!0},OnStop(){return!0},OnMove(){return!0},OnLand(){return!0},IsEnabled(){return this._IsEnabled()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Platform.Acts={SetMaxSpeed(a){this._SetMaxSpeed(a)},SetAcceleration(a){this._SetAcceleration(a)},SetDeceleration(a){this._SetDeceleration(a)},SetJumpStrength(a){this._SetJumpStrength(a)},SetMaxFallSpeed(a){this._SetMaxFallSpeed(a)},SetGravity(a){this._SetGravity(a)},SimulateControl(a){this._SimulateControl(a)},SetIgnoreInput(a){this._SetIgnoreInput(!!a)},SetVectorX(a){this._SetVectorX(a)},SetVectorY(a){this._SetVectorY(a)},SetGravityAngle(a){this._SetGravityAngle(d.toRadians(a))},
|
|
SetEnabled(a){this._SetEnabled(0!==a)},FallThrough(){this._FallThroughJumpThru()},SetDoubleJumpEnabled(a){this._SetDoubleJumpEnabled(0!==a)},SetJumpSustain(a){this._SetJumpSustain(a/1E3)},SetCeilingCollision(a){this._SetCeilingCollisionMode(a)},SetDefaultControls(a){this._SetDefaultControls(a)},ResetDoubleJump(a){this._ResetDoubleJump(a)}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Platform.Exps={Speed(){return this._GetSpeed()},MaxSpeed(){return this._GetMaxSpeed()},Acceleration(){return this._GetAcceleration()},Deceleration(){return this._GetDeceleration()},JumpStrength(){return this._GetJumpStrength()},Gravity(){return this._GetGravity()},GravityAngle(){return d.toDegrees(this._GetGravityAngle())},MaxFallSpeed(){return this._GetMaxFallSpeed()},MovingAngle(){return d.toDegrees(this._GetMovingAngle())},VectorX(){return this._GetVectorX()},
|
|
VectorY(){return this._GetVectorY()},JumpSustain(){return 1E3*this._GetJumpSustain()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.scrollto=class extends d.SDKBehaviorBase{constructor(a){super(a);this._shakeMode=this._shakeEnd=this._shakeStart=this._shakeMag=0}Release(){super.Release()}SetShakeMagnitude(a){this._shakeMag=a}GetShakeMagnitude(){return this._shakeMag}SetShakeStart(a){this._shakeStart=a}GetShakeStart(){return this._shakeStart}SetShakeEnd(a){this._shakeEnd=a}GetShakeEnd(){return this._shakeEnd}SetShakeMode(a){this._shakeMode=a}GetShakeMode(){return this._shakeMode}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.scrollto.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.scrollto.Instance=class extends d.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._isEnabled=!0;b&&(this._isEnabled=b[0]);this._isEnabled&&this._StartTicking2()}Release(){super.Release()}SaveToJson(){const a=this.GetBehavior();return{e:this._isEnabled,smg:a.GetShakeMagnitude(),ss:a.GetShakeStart(),se:a.GetShakeEnd(),smd:a.GetShakeMode()}}LoadFromJson(a){const b=this.GetBehavior();b.SetShakeMagnitude(a.smg);b.SetShakeStart(a.ss);b.SetShakeEnd(a.se);
|
|
b.SetShakeMode(a.smd);(this._isEnabled=a.e)?this._StartTicking2():this._StopTicking2()}IsEnabled(){return this._isEnabled}Tick2(){if(this.IsEnabled()){this._runtime.GetDt(this._inst);var a=this.GetBehavior(),b=a.GetInstances(),e=0,c=0,f=0;for(var g of b)(b=g.GetBehaviorInstanceFromCtor(d.Behaviors.scrollto))&&b.GetSdkInstance().IsEnabled()&&(b=g.GetWorldInfo(),e+=b.GetX(),c+=b.GetY(),++f);g=this._inst.GetWorldInfo().GetLayout();var h=this._runtime.GetGameTime(),l=b=0;h>=a.GetShakeStart()&&h<a.GetShakeEnd()&&
|
|
(b=a.GetShakeMagnitude()*Math.min(this._runtime.GetTimeScale(),1),0===a.GetShakeMode()&&(b*=1-(h-a.GetShakeStart())/(a.GetShakeEnd()-a.GetShakeStart())),a=this._runtime.Random()*Math.PI*2,h=this._runtime.Random()*b,b=Math.cos(a)*h,l=Math.sin(a)*h);g.SetScrollX(e/f+b);g.SetScrollY(c/f+l)}}GetPropertyValueByIndex(a){switch(a){case 0:return this._isEnabled}}SetPropertyValueByIndex(a,b){switch(a){case 0:(this._isEnabled=!!b)?this._StartTicking2():this._StopTicking2()}}}}"use strict";
|
|
self.C3.Behaviors.scrollto.Cnds={IsEnabled(){return this._isEnabled}};"use strict";self.C3.Behaviors.scrollto.Acts={Shake(d,a,b){const e=this.GetBehavior();e.SetShakeMagnitude(d);e.SetShakeStart(this._runtime.GetGameTime());e.SetShakeEnd(this._runtime.GetGameTime()+a);e.SetShakeMode(b)},SetEnabled(d){(this._isEnabled=0!==d)?this._StartTicking2():this._StopTicking2()}};"use strict";self.C3.Behaviors.scrollto.Exps={};{"use strict";const d=self.C3;d.Behaviors.Sin=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Sin.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=self.IBehaviorInstance,e=2*Math.PI,c=Math.PI/2,f=3*Math.PI/2,g=[0,1,8,3,4,2,5,6,9,7];d.Behaviors.Sin.Instance=class extends d.SDKBehaviorInstanceBase{constructor(p,x){super(p);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;x&&(this._movement=g[x[0]],this._wave=x[1],this._periodRandom=this._runtime.Random()*x[3],this._basePeriod=x[2],this._period=x[2],this._period+=this._periodRandom,this._basePeriodOffset=x[4],0!==this._period&&(this._periodOffsetRandom=this._runtime.Random()*x[5],this._i=x[4]/this._period*e,this._i+=this._periodOffsetRandom/this._period*e),this._magnitudeRandom=this._runtime.Random()*x[7],this._baseMag=x[6],this._mag=x[6],this._mag+=this._magnitudeRandom,this._isEnabled=!!x[8]);5===this._movement&&
|
|
(this._mag=d.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(p){this._i=p.i;this._SetEnabled(p.e);this._movement=p.mv;this._wave=p.w;this._period=p.p;this._mag=p.mag;this._initialValue=p.iv;this._initialValue2=p.iv2;this._ratio=
|
|
p.r;this._lastKnownValue=p.lkv;this._lastKnownValue2=p.lkv2}Init(){const p=this._inst.GetWorldInfo();switch(this._movement){case 0:this._initialValue=p.GetX();break;case 1:this._initialValue=p.GetY();break;case 2:this._initialValue=p.GetWidth();this._ratio=p.GetHeight()/p.GetWidth();break;case 3:this._initialValue=p.GetWidth();break;case 4:this._initialValue=p.GetHeight();break;case 5:this._initialValue=p.GetAngle();break;case 6:this._initialValue=p.GetOpacity();break;case 7:this._initialValue=0;
|
|
break;case 8:this._initialValue=p.GetX();this._initialValue2=p.GetY();break;case 9:this._initialValue=p.GetZElevation()}this._lastKnownValue=this._initialValue;this._lastKnownValue2=this._initialValue2}WaveFunc(p){p%=e;switch(this._wave){case 0:return Math.sin(p);case 1:return p<=c?p/c:p<=f?1-2*(p-c)/Math.PI:(p-f)/c-1;case 2:return 2*p/e-1;case 3:return-2*p/e+1;case 4:return p<Math.PI?-1:1}return 0}Tick(){const p=this._runtime.GetDt(this._inst);this._isEnabled&&0!==p&&(this._i=0===this._period?0:
|
|
(this._i+p/this._period*e)%e,this._UpdateFromPhase())}_UpdateFromPhase(){const p=this._inst.GetWorldInfo();switch(this._movement){case 0:p.GetX()!==this._lastKnownValue&&(this._initialValue+=p.GetX()-this._lastKnownValue);p.SetX(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=p.GetX();break;case 1:p.GetY()!==this._lastKnownValue&&(this._initialValue+=p.GetY()-this._lastKnownValue);p.SetY(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=p.GetY();break;
|
|
case 2:p.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);p.SetHeight(p.GetWidth()*this._ratio);break;case 3:p.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 4:p.SetHeight(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 5:p.GetAngle()!==this._lastKnownValue&&(this._initialValue=d.clampAngle(this._initialValue+(p.GetAngle()-this._lastKnownValue)));p.SetAngle(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=p.GetAngle();
|
|
break;case 6:p.SetOpacity(this._initialValue+this.WaveFunc(this._i)*this._mag/100);break;case 8:p.GetX()!==this._lastKnownValue&&(this._initialValue+=p.GetX()-this._lastKnownValue);p.GetY()!==this._lastKnownValue2&&(this._initialValue2+=p.GetY()-this._lastKnownValue2);p.SetX(this._initialValue+Math.cos(p.GetAngle())*this.WaveFunc(this._i)*this._mag);p.SetY(this._initialValue2+Math.sin(p.GetAngle())*this.WaveFunc(this._i)*this._mag);this._lastKnownValue=p.GetX();this._lastKnownValue2=p.GetY();break;
|
|
case 9:p.SetZElevation(this._initialValue+this.WaveFunc(this._i)*this._mag)}p.SetBboxChanged()}_OnSpriteFrameChanged(p,x){}_SetPeriod(p){this._period=p}_GetPeriod(){return this._period}_SetMagnitude(p){this._mag=p}_SetMagnitude_ConvertAngle(p){5===this._movement&&(p=d.toRadians(p));this._SetMagnitude(p)}_GetMagnitude(){return this._mag}_GetMagnitude_ConvertAngle(){let p=this._GetMagnitude();5===this._movement&&(p=d.toDegrees(p));return p}_SetMovement(p){5===this._movement&&5!==p&&(this._mag=d.toDegrees(this._mag));
|
|
this._movement=p;this.Init()}_GetMovement(){return this._movement}_SetWave(p){this._wave=p}_GetWave(){return this._wave}_SetPhase(p){this._i=d.clamp(p,0,2*Math.PI);this._UpdateFromPhase()}_GetPhase(){return this._i}_SetEnabled(p){(this._isEnabled=!!p)?this._StartTicking():this._StopTicking()}_IsEnabled(){return this._isEnabled}GetPropertyValueByIndex(p){switch(p){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(p,
|
|
x){switch(p){case 0:this._movement=g[x];this.Init();break;case 1:this._wave=x;break;case 2:this._basePeriod=x;this._period=this._basePeriod+this._periodRandom;this._isEnabled||(0!==this._period?(this._i=this._basePeriodOffset/this._period*e,this._i+=this._periodOffsetRandom/this._period*e):this._i=0);break;case 6:this._baseMag=x;this._mag=this._baseMag+this._magnitudeRandom;5===this._movement&&(this._mag=d.toRadians(this._mag));break;case 8:this._isEnabled=!!x}}GetDebuggerProperties(){return[{title:"$"+
|
|
this.GetBehaviorType().GetName(),properties:[{name:"behaviors.sin.properties.enabled.name",value:this._IsEnabled(),onedit:p=>this._SetEnabled(p)},{name:"behaviors.sin.properties.period.name",value:this._GetPeriod(),onedit:p=>this._SetPeriod(p)},{name:"behaviors.sin.properties.magnitude.name",value:this._GetMagnitude_ConvertAngle(),onedit:p=>this._SetMagnitude_ConvertAngle(p)},{name:"behaviors.sin.debugger.value",value:this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}]}]}GetScriptInterfaceClass(){return self.ISineBehaviorInstance}};
|
|
const h=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 b{constructor(){super();h.set(this,b._GetInitInst().GetSdkInstance())}set period(p){a.RequireFiniteNumber(p);h.get(this)._SetPeriod(p)}get period(){return h.get(this)._GetPeriod()}set magnitude(p){a.RequireFiniteNumber(p);h.get(this)._SetMagnitude(p)}get magnitude(){return h.get(this)._GetMagnitude()}set phase(p){h.get(this)._SetPhase(p)}get phase(){return h.get(this)._GetPhase()}set movement(p){a.RequireString(p);
|
|
p=l.indexOf(p);if(-1===p)throw Error("invalid movement");h.get(this)._SetMovement(p)}get movement(){return l[h.get(this)._GetMovement()]}set wave(p){a.RequireString(p);p=m.indexOf(p);if(-1===p)throw Error("invalid wave");h.get(this)._SetWave(p)}get wave(){return m[h.get(this)._GetWave()]}get value(){const p=h.get(this);return p.WaveFunc(p._GetPhase())*p._GetMagnitude()}updateInitialState(){h.get(this).Init()}set isEnabled(p){h.get(this)._SetEnabled(!!p)}get isEnabled(){return h.get(this)._IsEnabled()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Sin.Cnds={IsEnabled(){return this._IsEnabled()},CompareMovement(a){return this._GetMovement()===a},ComparePeriod(a,b){return d.compare(this._GetPeriod(),a,b)},CompareMagnitude(a,b){return d.compare(this._GetMagnitude_ConvertAngle(),a,b)},CompareWave(a){return this._GetWave()===a}}}"use strict";
|
|
self.C3.Behaviors.Sin.Acts={SetEnabled(d){this._SetEnabled(0!==d)},SetPeriod(d){this._SetPeriod(d)},SetMagnitude(d){this._SetMagnitude_ConvertAngle(d)},SetMovement(d){this._SetMovement(d)},SetWave(d){this._wave=d},SetPhase(d){const a=2*Math.PI;this._SetPhase(d*a%a)},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 d=self.C3;d.Behaviors.Timer=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const d=self.C3;d.Behaviors.Timer.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Timer.SingleTimer=class{constructor(a,b,e,c){this._current=d.New(d.KahanSum);this._current.Set(a||0);this._total=d.New(d.KahanSum);this._total.Set(b||0);this._duration=e||0;this._isRegular=!!c;this._isPaused=!1}GetCurrentTime(){return this._current.Get()}GetTotalTime(){return this._total.Get()}GetDuration(){return this._duration}SetPaused(a){this._isPaused=!!a}IsPaused(){return this._isPaused}Add(a){this._current.Add(a);this._total.Add(a)}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(a){this._current.Set(a.c);this._total.Set(a.t);this._duration=a.d;this._isRegular=!!a.r;this._isPaused=!!a.p}};d.Behaviors.Timer.Instance=class extends d.SDKBehaviorInstanceBase{constructor(a,b){super(a);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 a={};for(const [b,e]of this._timers.entries())a[b]=e.SaveToJson();return a}LoadFromJson(a){this._timers.clear();for(const [b,e]of Object.entries(a))a=new d.Behaviors.Timer.SingleTimer,a.LoadFromJson(e),this._timers.set(b,a);this._UpdateTickState()}Tick(){const a=this._runtime.GetDt(this._inst);for(const b of this._timers.values())b.IsPaused()||
|
|
b.Add(a)}Tick2(){for(const [a,b]of this._timers.entries())b.Update()&&this._timers.delete(a)}GetDebuggerProperties(){return[{title:"behaviors.timer.debugger.timers",properties:[...this._timers.entries()].map(a=>({name:"$"+a[0],value:`${Math.round(10*a[1].GetCurrentTime())/10} / ${Math.round(10*a[1].GetDuration())/10}`}))}]}}}"use strict";
|
|
self.C3.Behaviors.Timer.Cnds={OnTimer(d){return(d=this._timers.get(d.toLowerCase()))?d.HasFinished():!1},IsTimerRunning(d){return this._timers.has(d.toLowerCase())},IsTimerPaused(d){return(d=this._timers.get(d.toLowerCase()))&&d.IsPaused()}};
|
|
{"use strict";const d=self.C3;d.Behaviors.Timer.Acts={StartTimer(a,b,e){a=new d.Behaviors.Timer.SingleTimer(0,0,a,1===b);this._timers.set(e.toLowerCase(),a);this._UpdateTickState()},StopTimer(a){this._timers.delete(a.toLowerCase());this._UpdateTickState()},PauseResumeTimer(a,b){(a=this._timers.get(a.toLowerCase()))&&a.SetPaused(0===b)}}}"use strict";
|
|
self.C3.Behaviors.Timer.Exps={CurrentTime(d){return(d=this._timers.get(d.toLowerCase()))?d.GetCurrentTime():0},TotalTime(d){return(d=this._timers.get(d.toLowerCase()))?d.GetTotalTime():0},Duration(d){return(d=this._timers.get(d.toLowerCase()))?d.GetDuration():0}};{"use strict";const d=self.C3;d.Behaviors.Flash=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const d=self.C3;d.Behaviors.Flash.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Flash.Instance=class extends d.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._timeLeft=this._stageTimeLeft=this._stage=this._offTime=this._onTime=0;this._StartTicking()}Release(){super.Release()}SaveToJson(){return{on:this._onTime,off:this._offTime,s:this._stage,stl:this._stageTimeLeft,tl:this._timeLeft}}LoadFromJson(a){this._onTime=a.on;this._offTime=a.off;this._stage=a.s;this._stageTimeLeft=a.stl;this._timeLeft=null===a.tl?Infinity:a.tl}Tick(){if(!(0>=
|
|
this._timeLeft)){var a=this._runtime.GetDt(this._inst);this._timeLeft-=a;if(0>=this._timeLeft)return this._timeLeft=0,this._inst.GetWorldInfo().SetVisible(!0),this._runtime.UpdateRender(),this.DebugTrigger(d.Behaviors.Flash.Cnds.OnFlashEnded);this._stageTimeLeft-=a;0>=this._stageTimeLeft&&(0===this._stage?(this._inst.GetWorldInfo().SetVisible(!1),this._stage=1,this._stageTimeLeft+=this._offTime):(this._inst.GetWorldInfo().SetVisible(!0),this._stage=0,this._stageTimeLeft+=this._onTime),this._runtime.UpdateRender())}}GetDebuggerProperties(){return[{title:"$"+
|
|
this.GetBehaviorType().GetName(),properties:[{name:"behaviors.flash.debugger.on-time",value:this._onTime,onedit:a=>this._onTime=a},{name:"behaviors.flash.debugger.off-time",value:this._offTime,onedit:a=>this._offTime=a},{name:"behaviors.flash.debugger.is-flashing",value:0<this._timeLeft},{name:"behaviors.flash.debugger.time-left",value:this._timeLeft}]}]}}}"use strict";self.C3.Behaviors.Flash.Cnds={IsFlashing(){return 0<this._timeLeft},OnFlashEnded(){return!0}};"use strict";
|
|
self.C3.Behaviors.Flash.Acts={Flash(d,a,b){this._onTime=d;this._offTime=a;this._stage=1;this._stageTimeLeft=a;this._timeLeft=b;this._inst.GetWorldInfo().SetVisible(!1);this._runtime.UpdateRender()},StopFlashing(){this._timeLeft=0;this._inst.GetWorldInfo().SetVisible(!0);this._runtime.UpdateRender()}};"use strict";self.C3.Behaviors.Flash.Exps={};{"use strict";const d=self.C3;d.Behaviors.Fade=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Fade.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Fade.Instance=class extends d.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._fadeOutTime=this._waitTime=this._fadeInTime=0;this._activeAtStart=this._destroy=!0;this._setMaxOpacity=!1;this._stage=0;this._stageTime=d.New(d.KahanSum);this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1;b&&(this._fadeInTime=b[0],this._waitTime=b[1],this._fadeOutTime=b[2],this._destroy=!!b[3],this._stage=(this._activeAtStart=!!b[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(a){this._fadeInTime=a.fit;this._waitTime=a.wt;this._fadeOutTime=a.fot;this._destroy=a.d;this._stage=a.s;this._stageTime.Set(a.st);this._maxOpacity=
|
|
a.mo}Tick(){var a=this._runtime.GetDt(this._inst);this._stageTime.Add(a);a=this._inst.GetWorldInfo();0===this._stage&&(a.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity),this._runtime.UpdateRender(),a.GetOpacity()>=this._maxOpacity&&(a.SetOpacity(this._maxOpacity),this._stage=1,this._stageTime.Reset(),this.Trigger(d.Behaviors.Fade.Cnds.OnFadeInEnd)));1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(d.Behaviors.Fade.Cnds.OnWaitEnd));
|
|
2===this._stage&&0!==this._fadeOutTime&&(a.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity),this._runtime.UpdateRender(),0>=a.GetOpacity()&&(this._stage=3,this._stageTime.Reset(),this.Trigger(d.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(a){switch(a){case 0:return this._fadeInTime;
|
|
case 1:return this._waitTime;case 2:return this._fadeOutTime;case 3:return this._destroy}}SetPropertyValueByIndex(a,b){switch(a){case 0:this._fadeInTime=b;break;case 1:this._waitTime=b;break;case 2:this._fadeOutTime=b;break;case 3:this._destroy=!!b}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.fade.properties.fade-in-time.name",value:this._fadeInTime,onedit:a=>this._fadeInTime=a},{name:"behaviors.fade.properties.wait-time.name",value:this._waitTime,
|
|
onedit:a=>this._waitTime=a},{name:"behaviors.fade.properties.fade-out-time.name",value:this._fadeOutTime,onedit:a=>this._fadeOutTime=a},{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(d){0>d&&(d=0);this._fadeInTime=d},SetWaitTime(d){0>d&&(d=0);this._waitTime=d},SetFadeOutTime(d){0>d&&(d=0);this._fadeOutTime=d}};"use strict";self.C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}};
|
|
{"use strict";const d=self.C3;d.Behaviors.jumpthru=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const d=self.C3;d.Behaviors.jumpthru.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.jumpthru.Instance=class extends d.SDKBehaviorInstanceBase{constructor(a,b){super(a);this.SetEnabled(!0);b&&this.SetEnabled(b[0])}Release(){super.Release()}SetEnabled(a){this._inst._SetJumpthruEnabled(!!a)}IsEnabled(){return this._inst._IsJumpthruEnabled()}SaveToJson(){return{e:this.IsEnabled()}}LoadFromJson(a){this.SetEnabled(a.e)}GetPropertyValueByIndex(a){switch(a){case 0:return this.IsEnabled()}}SetPropertyValueByIndex(a,b){switch(a){case 0:this.SetEnabled(b)}}GetDebuggerProperties(){return[{title:"$"+
|
|
this.GetBehaviorType().GetName(),properties:[{name:"behaviors.jumpthru.properties.enabled.name",value:this.IsEnabled(),onedit:a=>this.SetEnabled(a)}]}]}}}"use strict";self.C3.Behaviors.jumpthru.Cnds={IsEnabled(){return this.IsEnabled()}};"use strict";self.C3.Behaviors.jumpthru.Acts={SetEnabled(d){this.SetEnabled(d)}};"use strict";self.C3.Behaviors.jumpthru.Exps={};{"use strict";const d=self.C3;d.Behaviors.solid=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.solid.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3,a=new Set;d.Behaviors.solid.Instance=class extends d.SDKBehaviorInstanceBase{constructor(b,e){super(b);this.SetEnabled(!0);e&&(this.SetEnabled(e[0]),this.SetTags(e[1]))}Release(){super.Release()}SetEnabled(b){this._inst._SetSolidEnabled(!!b)}IsEnabled(){return this._inst._IsSolidEnabled()}SetTags(b){const e=this._inst.GetSavedDataMap();if(b.trim()){var c=e.get("solidTags");c||(c=new Set,e.set("solidTags",c));c.clear();for(const f of b.split(" "))f&&c.add(f.toLowerCase())}else e.delete("solidTags")}GetTags(){return this._inst.GetSavedDataMap().get("solidTags")||
|
|
a}SaveToJson(){return{e:this.IsEnabled()}}LoadFromJson(b){this.SetEnabled(b.e)}GetPropertyValueByIndex(b){switch(b){case 0:return this.IsEnabled()}}SetPropertyValueByIndex(b,e){switch(b){case 0:this.SetEnabled(e)}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.solid.properties.enabled.name",value:this.IsEnabled(),onedit:b=>this.SetEnabled(b)}]}]}}}"use strict";self.C3.Behaviors.solid.Cnds={IsEnabled(){return this.IsEnabled()}};"use strict";
|
|
self.C3.Behaviors.solid.Acts={SetEnabled(d){this.SetEnabled(d)},SetTags(d){this.SetTags(d)}};"use strict";self.C3.Behaviors.solid.Exps={};{"use strict";const d=self.C3;d.Behaviors.Pin=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const d=self.C3;d.Behaviors.Pin.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Pin.Instance=class extends d.SDKBehaviorInstanceBase{constructor(a,b){super(a);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;b&&(this._destroy=b[0]);a=this._runtime.Dispatcher();this._disposables=new d.CompositeDisposable(d.Disposable.From(a,"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),
|
|
d.Disposable.From(a,"afterload",e=>this._OnAfterLoad()))}Release(){this._pinInst=null;super.Release()}_SetPinInst(a){a?(this._pinInst=a,this._StartTicking2()):(this._pinInst=null,this._StopTicking2())}_Pin(a,b,e){if(a&&(a=a.GetFirstPicked(this._inst)))if(this._mode=b,this._SetPinInst(a),b=this._inst.GetWorldInfo(),a=a.GetWorldInfo(),"properties"===this._mode){const c=this._propSet;c.clear();for(const f of e)c.add(f);this._dx=b.GetX()-a.GetX();this._dy=b.GetY()-a.GetY();this._dAngle=b.GetAngle()-a.GetAngle();
|
|
this._lastKnownAngle=b.GetAngle();this._dz=b.GetZElevation()-a.GetZElevation();c.has("x")&&c.has("y")&&(this._pinAngle=d.angleTo(a.GetX(),a.GetY(),b.GetX(),b.GetY())-a.GetAngle(),this._pinDist=d.distanceTo(a.GetX(),a.GetY(),b.GetX(),b.GetY()));c.has("width-abs")?this._dWidth=b.GetWidth()-a.GetWidth():c.has("width-scale")&&(this._dWidth=b.GetWidth()/a.GetWidth());c.has("height-abs")?this._dHeight=b.GetHeight()-a.GetHeight():c.has("height-scale")&&(this._dHeight=b.GetHeight()/a.GetHeight())}else this._pinDist=
|
|
d.distanceTo(a.GetX(),a.GetY(),b.GetX(),b.GetY())}SaveToJson(){const a=this._propSet,b=this._mode,e={uid:this._pinInst?this._pinInst.GetUID():-1,m:b};if("rope"===b||"bar"===b)e.pd=this._pinDist;else if("properties"===b){e.ps=[...this._propSet];a.has("imagepoint")?e.ip=this._pinImagePoint:a.has("x")&&a.has("y")?(e.pa=this._pinAngle,e.pd=this._pinDist):(a.has("x")&&(e.dx=this._dx),a.has("y")&&(e.dy=this._dy));a.has("angle")&&(e.da=this._dAngle,e.lka=this._lastKnownAngle);if(a.has("width-abs")||a.has("width-scale"))e.dw=
|
|
this._dWidth;if(a.has("height-abs")||a.has("height-scale"))e.dh=this._dHeight;a.has("z")&&(e.dz=this._dz)}return e}LoadFromJson(a){const b=a.m,e=this._propSet;e.clear();this._pinUid=a.uid;if("number"===typeof b)this._LoadFromJson_Legacy(a);else if(this._mode=b,"rope"===b||"bar"===b)this._pinDist=a.pd;else if("properties"===b){for(const c of a.ps)e.add(c);e.has("imagepoint")?this._pinImagePoint=a.ip:e.has("x")&&e.has("y")?(this._pinAngle=a.pa,this._pinDist=a.pd):(e.has("x")&&(this._dx=a.dx),e.has("y")&&
|
|
(this._dy=a.dy));e.has("angle")&&(this._dAngle=a.da,this._lastKnownAngle=a.lka||0);if(e.has("width-abs")||e.has("width-scale"))this._dWidth=a.dw;if(e.has("height-abs")||e.has("height-scale"))this._dHeight=a.dh;e.has("z")&&(this._dz=a.dz)}}_LoadFromJson_Legacy(a){const b=this._propSet,e=a.msa,c=a.tsa,f=a.pa,g=a.pd;switch(a.m){case 0:this._mode="properties";b.add("x").add("y").add("angle");this._pinAngle=f;this._pinDist=g;this._dAngle=e-c;this._lastKnownAngle=a.lka;break;case 1:this._mode="properties";
|
|
b.add("x").add("y");this._pinAngle=f;this._pinDist=g;break;case 2:this._mode="properties";b.add("angle");this._dAngle=e-c;this._lastKnownAngle=a.lka;break;case 3:this._mode="rope";this._pinDist=a.pd;break;case 4:this._mode="bar",this._pinDist=a.pd}}_OnAfterLoad(){-1===this._pinUid?this._SetPinInst(null):(this._SetPinInst(this._runtime.GetInstanceByUID(this._pinUid)),this._pinUid=-1)}_OnInstanceDestroyed(a){this._pinInst===a&&(this._SetPinInst(null),this._destroy&&this._runtime.DestroyInstance(this._inst))}Tick2(){var a=
|
|
this._pinInst;if(a){var b=a.GetWorldInfo(),e=this._inst.GetWorldInfo(),c=this._mode,f=!1;if("rope"===c||"bar"===c){if(a=d.distanceTo(e.GetX(),e.GetY(),b.GetX(),b.GetY()),a>this._pinDist||"bar"===c&&a<this._pinDist)f=d.angleTo(b.GetX(),b.GetY(),e.GetX(),e.GetY()),e.SetXY(b.GetX()+Math.cos(f)*this._pinDist,b.GetY()+Math.sin(f)*this._pinDist),f=!0}else{c=this._propSet;if(c.has("imagepoint")){const [g,h]=a.GetImagePoint(this._pinImagePoint);e.EqualsXY(g,h)||(e.SetXY(g,h),f=!0)}else if(c.has("x")&&c.has("y")){a=
|
|
b.GetX()+Math.cos(b.GetAngle()+this._pinAngle)*this._pinDist;const g=b.GetY()+Math.sin(b.GetAngle()+this._pinAngle)*this._pinDist;e.EqualsXY(a,g)||(e.SetXY(a,g),f=!0)}else a=b.GetX()+this._dx,c.has("x")&&a!==e.GetX()&&(e.SetX(a),f=!0),a=b.GetY()+this._dy,c.has("y")&&a!==e.GetY()&&(e.SetY(a),f=!0);c.has("angle")&&(this._lastKnownAngle!==e.GetAngle()&&(this._dAngle=d.clampAngle(this._dAngle+(e.GetAngle()-this._lastKnownAngle))),a=d.clampAngle(b.GetAngle()+this._dAngle),a!==e.GetAngle()&&(e.SetAngle(a),
|
|
f=!0),this._lastKnownAngle=e.GetAngle());c.has("width-abs")&&(a=b.GetWidth()+this._dWidth,a!==e.GetWidth()&&(e.SetWidth(a),f=!0));c.has("width-scale")&&(a=b.GetWidth()*this._dWidth,a!==e.GetWidth()&&(e.SetWidth(a),f=!0));c.has("height-abs")&&(a=b.GetHeight()+this._dHeight,a!==e.GetHeight()&&(e.SetHeight(a),f=!0));c.has("height-scale")&&(a=b.GetHeight()*this._dHeight,a!==e.GetHeight()&&(e.SetHeight(a),f=!0));c.has("z")&&(a=b.GetZElevation()+this._dz,a!==e.GetZElevation()&&(e.SetZElevation(a),this._runtime.UpdateRender()))}f&&
|
|
e.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(d,a){this._Pin(d,0===a?"rope":"bar")},PinByProperties(d,a,b,e,c,f,g){const h=[];a&&h.push("x");b&&h.push("y");e&&h.push("angle");g&&h.push("z");1===c?h.push("width-abs"):2===c&&h.push("width-scale");1===f?h.push("height-abs"):2===f&&h.push("height-scale");0!==h.length&&this._Pin(d,"properties",h)},PinByImagePoint(d,a,b,e,c,f){const g=["imagepoint"];b&&g.push("angle");f&&g.push("z");1===e?g.push("width-abs"):2===e&&g.push("width-scale");1===c?g.push("height-abs"):
|
|
2===c&&g.push("height-scale");this._pinImagePoint=a;this._Pin(d,"properties",g)},SetPinDistance(d){if("rope"===this._mode||"bar"===this._mode)this._pinDist=Math.max(d,0)},SetDestroy(d){this._destroy=d},Unpin(){this._SetPinInst(null);this._mode="";this._propSet.clear();this._pinImagePoint=""},Pin(d,a){switch(a){case 0:this._Pin(d,"properties",["x","y","angle"]);break;case 1:this._Pin(d,"properties",["x","y"]);break;case 2:this._Pin(d,"properties",["angle"]);break;case 3:this._Pin(d,"rope");break;case 4:this._Pin(d,
|
|
"bar")}}};"use strict";self.C3.Behaviors.Pin.Exps={PinnedUID(){return this._pinInst?this._pinInst.GetUID():-1}};{"use strict";const d=self.C3;d.Behaviors.Bullet=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const d=self.C3;d.Behaviors.Bullet.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3,a=self.C3X,b=self.IBehaviorInstance;d.Behaviors.Bullet.Instance=class extends d.SDKBehaviorInstanceBase{constructor(c,f){super(c);c=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=c.GetX();this._lastY=c.GetY();this._lastKnownAngle=c.GetAngle();this._travelled=0;this._stepSize=Math.min(Math.abs(c.GetWidth()),Math.abs(c.GetHeight())/2);this._stopStepping=!1;f&&
|
|
(this._speed=f[0],this._acc=f[1],this._g=f[2],this._bounceOffSolid=!!f[3],this._setAngle=!!f[4],this._isStepping=!!f[5],this._isEnabled=!!f[6]);f=c.GetAngle();this._dx=Math.cos(f)*this._speed;this._dy=Math.sin(f)*this._speed;this._isEnabled&&(this._StartTicking(),this._bounceOffSolid&&this._StartPostTicking())}Release(){super.Release()}SaveToJson(){const c={dx:this._dx,dy:this._dy,lx:this._lastX,ly:this._lastY,lka:this._lastKnownAngle,t:this._travelled};0!==this._acc&&(c.acc=this._acc);0!==this._g&&
|
|
(c.g=this._g);this._isStepping&&(c.st=this._isStepping);this._isEnabled||(c.e=this._isEnabled);this._bounceOffSolid&&(c.bos=this._bounceOffSolid);this._setAngle&&(c.sa=this._setAngle);return c}LoadFromJson(c){this._dx=c.dx;this._dy=c.dy;this._lastX=c.lx;this._lastY=c.ly;this._lastKnownAngle=c.lka;this._travelled=c.t;this._acc=c.hasOwnProperty("acc")?c.acc:0;this._g=c.hasOwnProperty("g")?c.g:0;this._isStepping=c.hasOwnProperty("st")?c.st:!1;this._bounceOffSolid=c.hasOwnProperty("bos")?c.bos:!1;this._setAngle=
|
|
c.hasOwnProperty("sa")?c.sa:!1;this._SetEnabled(c.hasOwnProperty("e")?c.e:!0)}Tick(){if(this._isEnabled){var c=this._runtime.GetDt(this._inst),f=this._inst.GetWorldInfo();if(f.GetAngle()!==this._lastKnownAngle){var g=f.GetAngle();if(this._setAngle){var h=d.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(g)*h;this._dy=Math.sin(g)*h}this._lastKnownAngle=g}g=h=0;if(0!==this._acc){let l=d.distanceTo(0,0,this._dx,this._dy),m;m=0===this._dx&&0===this._dy?f.GetAngle():d.angleTo(0,0,this._dx,this._dy);
|
|
l+=this._acc*c;h=Math.cos(m)*this._acc;g=Math.sin(m)*this._acc;0>l&&(g=h=l=0);this._dx=Math.cos(m)*l;this._dy=Math.sin(m)*l}0!==this._g&&(this._dy+=this._g*c,g+=this._g);this._lastX=f.GetX();this._lastY=f.GetY();if(0!==this._dx||0!==this._dy)h=this._dx*c+.5*h*c*c,c=this._dy*c+.5*g*c*c,g=d.distanceTo(0,0,h,c),this._MoveBy(h,c,g),this._travelled+=g,!this._setAngle||0===h&&0===c||(c=d.angleTo(0,0,h,c),f.SetAngle(c),this._lastKnownAngle=f.GetAngle()),f.SetBboxChanged()}}_MoveBy(c,f,g){const h=this.GetWorldInfo();
|
|
if(!this._isStepping||g<=this._stepSize)h.OffsetXY(c,f),h.SetBboxChanged(),this._isStepping&&this.Trigger(d.Behaviors.Bullet.Cnds.OnStep);else{this._stopStepping=!1;var l=h.GetX(),m=h.GetY(),p=l+c,x=m+f;f=d.angleTo(0,0,c,f);c=Math.cos(f)*this._stepSize;f=Math.sin(f)*this._stepSize;g=Math.floor(g/this._stepSize);for(let v=1;v<=g;++v)if(h.SetXY(l+c*v,m+f*v),h.SetBboxChanged(),this.Trigger(d.Behaviors.Bullet.Cnds.OnStep),this._inst.IsDestroyed()||this._stopStepping)return;h.SetXY(p,x);h.SetBboxChanged();
|
|
this.Trigger(d.Behaviors.Bullet.Cnds.OnStep)}}PostTick(){if(this._isEnabled&&this._bounceOffSolid&&(0!==this._dx||0!==this._dy)){var c=this._runtime.GetDt(this._inst),f=this._inst.GetWorldInfo(),g=this._runtime.GetCollisionEngine(),h=g.TestOverlapSolid(this._inst);if(h){g.RegisterCollision(this._inst,h);h=d.distanceTo(0,0,this._dx,this._dy);const l=g.CalculateBounceAngle(this._inst,this._lastX,this._lastY);this._dx=Math.cos(l)*h;this._dy=Math.sin(l)*h;f.OffsetXY(this._dx*c,this._dy*c);f.SetBboxChanged();
|
|
this._setAngle&&(f.SetAngle(l),this._lastKnownAngle=f.GetAngle(),f.SetBboxChanged());g.PushOutSolid(this._inst,this._dx/h,this._dy/h,Math.max(2.5*h*c,30))||g.PushOutSolidNearest(this._inst,100)}}}GetPropertyValueByIndex(c){switch(c){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(c,f){switch(c){case 0:this._SetSpeed(f);break;case 1:this._acc=
|
|
f;break;case 2:this._g=f;break;case 4:this._setAngle=!!f;break;case 5:this._isStepping=!!f;break;case 6:this._SetEnabled(!!f)}}_SetSpeed(c){const f=d.angleTo(0,0,this._dx,this._dy);this._dx=Math.cos(f)*c;this._dy=Math.sin(f)*c}_GetSpeed(){return d.round6dp(d.distanceTo(0,0,this._dx,this._dy))}_SetAcceleration(c){this._acc=c}_GetAcceleration(){return this._acc}_SetGravity(c){this._g=c}_GetGravity(){return this._g}_SetAngleOfMotion(c){const f=d.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(c)*
|
|
f;this._dy=Math.sin(c)*f}_GetAngleOfMotion(){return d.angleTo(0,0,this._dx,this._dy)}_SetBounceOffSolids(c){c=!!c;this._bounceOffSolid!==c&&(this._bounceOffSolid=c,this._isEnabled&&(this._bounceOffSolid?this._StartPostTicking():this._StopPostTicking()))}_IsBounceOffSolids(){return this._bounceOffSolid}_SetDistanceTravelled(c){this._travelled=c}_GetDistanceTravelled(){return this._travelled}_SetEnabled(c){(this._isEnabled=!!c)?(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:c=>this._dx=c},{name:"behaviors.bullet.debugger.vector-y",value:this._dy,onedit:c=>this._dy=c},{name:"behaviors.bullet.properties.speed.name",value:this._GetSpeed(),onedit:c=>this._SetSpeed(c)},{name:"behaviors.bullet.debugger.angle-of-motion",value:d.toDegrees(this._GetAngleOfMotion())},
|
|
{name:"behaviors.bullet.properties.gravity.name",value:this._GetGravity(),onedit:c=>this._SetGravity(c)},{name:"behaviors.bullet.properties.acceleration.name",value:this._GetAcceleration(),onedit:c=>this._SetAcceleration(c)},{name:"behaviors.bullet.debugger.distance-travelled",value:this._GetDistanceTravelled()},{name:"behaviors.bullet.properties.enabled.name",value:this._IsEnabled(),onedit:c=>this._SetEnabled(c)}]}]}GetScriptInterfaceClass(){return self.IBulletBehaviorInstance}};const e=new WeakMap;
|
|
self.IBulletBehaviorInstance=class extends b{constructor(){super();e.set(this,b._GetInitInst().GetSdkInstance())}get speed(){return e.get(this)._GetSpeed()}set speed(c){a.RequireFiniteNumber(c);e.get(this)._SetSpeed(c)}get acceleration(){return e.get(this)._GetAcceleration()}set acceleration(c){a.RequireFiniteNumber(c);e.get(this)._SetAcceleration(c)}get gravity(){return e.get(this)._GetGravity()}set gravity(c){a.RequireFiniteNumber(c);e.get(this)._SetGravity(c)}get angleOfMotion(){return e.get(this)._GetAngleOfMotion()}set angleOfMotion(c){a.RequireFiniteNumber(c);
|
|
e.get(this)._SetAngleOfMotion(c)}get bounceOffSolids(){return e.get(this)._IsBounceOffSolids()}set bounceOffSolids(c){e.get(this)._SetBounceOffSolids(!!c)}get distanceTravelled(){return e.get(this)._GetDistanceTravelled()}set distanceTravelled(c){a.RequireFiniteNumber(c);e.get(this)._SetDistanceTravelled(c)}get isEnabled(){return e.get(this)._IsEnabled()}set isEnabled(c){e.get(this)._SetEnabled(c)}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Bullet.Cnds={CompareSpeed(a,b){return d.compare(Math.sqrt(this._dx*this._dx+this._dy*this._dy),a,b)},CompareTravelled(a,b){return d.compare(this._GetDistanceTravelled(),a,b)},OnStep(){return!0},IsEnabled(){return this._IsEnabled()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Bullet.Acts={SetSpeed(a){this._SetSpeed(a)},SetAcceleration(a){this._SetAcceleration(a)},SetGravity(a){this._SetGravity(a)},SetAngleOfMotion(a){this._SetAngleOfMotion(d.toRadians(a))},Bounce(a){if(a&&(a=a.GetFirstPicked(this._inst))){var b=this._inst.GetWorldInfo(),e=this._runtime.GetCollisionEngine(),c=this._runtime.GetDt(this._inst),f=d.distanceTo(0,0,this._dx,this._dy),g=e.CalculateBounceAngle(this._inst,this._lastX,this._lastY,a);this._dx=Math.cos(g)*
|
|
f;this._dy=Math.sin(g)*f;b.OffsetXY(this._dx*c,this._dy*c);b.SetBboxChanged();this._setAngle&&(b.SetAngle(g),this._lastKnownAngle=b.GetAngle(),b.SetBboxChanged());0!==f&&(this._bounceOffSolid?e.PushOutSolid(this._inst,this._dx/f,this._dy/f,Math.max(2.5*f*c,30))||e.PushOutSolidNearest(this._inst,100):e.PushOut(this._inst,this._dx/f,this._dy/f,Math.max(2.5*f*c,30),a))}},SetBounceOffSolids(a){this._SetBounceOffSolids(a)},SetDistanceTravelled(a){this._SetDistanceTravelled(a)},SetEnabled(a){this._SetEnabled(a)},
|
|
StopStepping(){this._stopStepping=!0}}}{"use strict";const d=self.C3;d.Behaviors.Bullet.Exps={Speed(){return this._GetSpeed()},Acceleration(){return this._GetAcceleration()},AngleOfMotion(){return d.toDegrees(this._GetAngleOfMotion())},DistanceTravelled(){return this._GetDistanceTravelled()},Gravity(){return this._GetGravity()}}}{"use strict";const d=self.C3;d.Behaviors.Rotate=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Rotate.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Rotate.Instance=class extends d.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._acceleration=this._speed=0;this._isEnabled=!0;b&&(this._speed=d.toRadians(b[0]),this._acceleration=d.toRadians(b[1]),this._isEnabled=b[2]);this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{s:this._speed,a:this._acceleration,e:this._isEnabled}}LoadFromJson(a){this._speed=a.s;this._acceleration=a.a;this._SetEnabled(a.e)}Tick(){if(this._isEnabled){var a=
|
|
this._runtime.GetDt(this._inst);if(0!==a&&(0!==this._acceleration&&(this._speed+=this._acceleration*a),0!==this._speed)){const b=this._inst.GetWorldInfo();b.SetAngle(b.GetAngle()+this._speed*a);b.SetBboxChanged()}}}GetPropertyValueByIndex(a){switch(a){case 0:return d.toDegrees(this._speed);case 1:return d.toDegrees(this._acceleration);case 2:return this._isEnabled}}SetPropertyValueByIndex(a,b){switch(a){case 0:this._speed=d.toRadians(b);break;case 1:this._acceleration=d.toRadians(b);break;case 2:this._SetEnabled(b)}}_SetEnabled(a){(this._isEnabled=
|
|
!!a)?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.rotate.properties.speed.name",value:d.toDegrees(this._speed),onedit:a=>this._speed=d.toRadians(a)},{name:"behaviors.rotate.properties.acceleration.name",value:d.toDegrees(this._acceleration),onedit:a=>this._acceleration=d.toRadians(a)},{name:"behaviors.rotate.properties.enabled.name",value:this._isEnabled,onedit:a=>this._SetEnabled(a)}]}]}}}"use strict";
|
|
self.C3.Behaviors.Rotate.Cnds={IsEnabled(){return this._isEnabled}};{"use strict";const d=self.C3;d.Behaviors.Rotate.Acts={SetSpeed(a){this._speed=d.toRadians(a)},SetAcceleration(a){this._acceleration=d.toRadians(a)},SetEnabled(a){this._SetEnabled(a)}}}{"use strict";const d=self.C3;d.Behaviors.Rotate.Exps={Speed(){return d.toDegrees(this._speed)},Acceleration(){return d.toDegrees(this._acceleration)}}}{"use strict";const d=self.C3;d.Behaviors.wrap=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.wrap.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3,a=new d.Rect;d.Behaviors.wrap.Instance=class extends d.SDKBehaviorInstanceBase{constructor(b,e){super(b);this._mode=0;e&&(this._mode=e[0]);this._StartTicking()}Release(){super.Release()}SaveToJson(){return{m:this._mode}}LoadFromJson(b){this._mode=b.m}Tick(){const b=this._inst.GetWorldInfo(),e=b.GetLayer(),c=e.GetLayout(),f=b.GetBoundingBox();0===this._mode?a.set(0,0,c.GetWidth(),c.GetHeight()):a.copy(e.GetViewport());f.getRight()<a.getLeft()?(b.SetX(a.getRight()-1+(b.GetX()-
|
|
f.getLeft())),b.SetBboxChanged()):f.getLeft()>a.getRight()?(b.SetX(a.getLeft()+1-(f.getRight()-b.GetX())),b.SetBboxChanged()):f.getBottom()<a.getTop()?(b.SetY(a.getBottom()-1+(b.GetY()-f.getTop())),b.SetBboxChanged()):f.getTop()>a.getBottom()&&(b.SetY(a.getTop()+1-(f.getBottom()-b.GetY())),b.SetBboxChanged())}GetPropertyValueByIndex(b){switch(b){case 0:return this._mode}}SetPropertyValueByIndex(b,e){switch(b){case 0:this._mode=e}}}}"use strict";self.C3.Behaviors.wrap.Cnds={};"use strict";
|
|
self.C3.Behaviors.wrap.Acts={};"use strict";self.C3.Behaviors.wrap.Exps={};{"use strict";const d=self.C3;d.Behaviors.Orbit=class extends d.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}}}{"use strict";const d=self.C3;d.Behaviors.Orbit.Type=class extends d.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Orbit.Instance=class extends d.SDKBehaviorInstanceBase{constructor(a,b){super(a);this._acceleration=this._speed=0;this._isEnabled=!0;this._offsetAngle=this._majorAxis=this._minorAxis=0;this._matchRotation=!1;this._targetY=this._targetX=0;this._targetObject=null;this._targetUid=-1;this._totalAbsoluteRotation=this._totalRotation=this._rotation=0;b&&(this._speed=d.toRadians(b[0]),this._acceleration=d.toRadians(b[1]),this._isEnabled=b[6],this._minorAxis=b[2],
|
|
this._majorAxis=b[3],this._offsetAngle=d.toRadians(b[4]),this._matchRotation=b[5]);a=this._runtime.Dispatcher();this._disposables=new d.CompositeDisposable(d.Disposable.From(a,"instancedestroy",e=>this._OnInstanceDestroyed(e.instance)),d.Disposable.From(a,"afterload",e=>this._OnAfterLoad()));this._SetEnabled(this._isEnabled);a=this._inst.GetWorldInfo();this._targetX=a.GetX();this._targetY=a.GetY();this._rotation=a.GetAngle()}Release(){this._targetObject=null;super.Release()}SaveToJson(){return{s:this._speed,
|
|
a:this._acceleration,r:this._rotation,e:this._isEnabled,a1:this._majorAxis,a2:this._minorAxis,oa:this._offsetAngle,mr:this._matchRotation,tx:this._targetX,ty:this._targetY,tuid:this._targetObject?this._targetObject.GetUID():-1}}LoadFromJson(a){this._speed=a.s;this._acceleration=a.a;this._rotation=a.r;this._majorAxis=a.a1;this._minorAxis=a.a2;this._offsetAngle=a.oa;this._matchRotation=a.mr;this._targetX=a.tx;this._targetY=a.ty;this._targetUid=a.tuid;this._SetEnabled(a.e)}_OnAfterLoad(){-1===this._targetUid?
|
|
this._targetObject=null:(this._targetObject=this._runtime.GetInstanceByUID(this._targetUid),this._targetUid=-1)}_OnInstanceDestroyed(a){this._targetObject===a&&(this._targetObject=null)}_Initialise(){if(this._shouldInitialise){var a=this._inst.GetWorldInfo();this._targetX=a.GetX();this._targetY=a.GetY();this._rotation=a.GetAngle();this._shouldInitialise=!1}}_UpdateTarget(){if(this._targetObject){var a=this._targetObject.GetWorldInfo();this._targetX=a.GetX();this._targetY=a.GetY()}}_ShouldTickLate(){return!!this._targetObject}Tick(){this._TickInternal()}Tick2(){this._TickInternal()}_TickInternal(){if(this._isEnabled){var a=
|
|
this._runtime.GetDt(this._inst);if(0!==a){0!==this._acceleration&&(this._speed+=this._acceleration*a);var b=this._inst.GetWorldInfo();a*=this._speed;this._rotation=d.clampAngle(this._rotation+a);this._totalRotation+=a;this._totalAbsoluteRotation+=Math.abs(a);a=this._minorAxis*Math.cos(this._rotation);var e=this._majorAxis*Math.sin(this._rotation),c=Math.cos(this._offsetAngle),f=Math.sin(this._offsetAngle);this._UpdateTarget();b.SetXY(this._targetX+(a*c-e*f),this._targetY+(a*f+e*c));this._matchRotation&&
|
|
b.SetAngle(this._rotation+this._offsetAngle+.5*Math.PI);b.SetBboxChanged()}}}GetPropertyValueByIndex(a){switch(a){case 0:return d.toDegrees(this._speed);case 1:return d.toDegrees(this._acceleration);case 6:return this._isEnabled;case 2:return this._minorAxis;case 3:return this._majorAxis;case 4:return this._offsetAngle;case 5:return this._matchRotation}}SetPropertyValueByIndex(a,b){switch(a){case 0:this._speed=d.toRadians(b);break;case 1:this._acceleration=d.toRadians(b);break;case 6:this._SetEnabled(b);
|
|
break;case 2:this._minorAxis=b;break;case 3:this._majorAxis=b;break;case 4:this._offsetAngle=b;break;case 5:this._matchRotation=b}}_SetEnabled(a){this._isEnabled=!!a;this._ShouldTickLate()?this._isEnabled?this._StartTicking2():this._StopTicking2():this._isEnabled?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.orbit.debugger.rotation",value:d.toDegrees(this._rotation)},{name:"behaviors.orbit.debugger.total-rotation",
|
|
value:d.toDegrees(this._totalRotation)},{name:"behaviors.orbit.debugger.total-absolute-rotation",value:d.toDegrees(this._totalAbsoluteRotation)},{name:"behaviors.orbit.properties.speed.name",value:d.toDegrees(this._speed),onedit:a=>this._speed=d.toRadians(a)},{name:"behaviors.orbit.properties.acceleration.name",value:d.toDegrees(this._acceleration),onedit:a=>this._acceleration=d.toRadians(a)},{name:"behaviors.orbit.properties.primary-axis.name",value:this._majorAxis,onedit:a=>this._majorAxis=a},{name:"behaviors.orbit.properties.secondary-axis.name",
|
|
value:this._minorAxis,onedit:a=>this._minorAxis=a},{name:"behaviors.orbit.properties.offset-angle.name",value:d.toDegrees(this._offsetAngle),onedit:a=>this._offsetAngle=d.toRadians(a)},{name:"behaviors.orbit.properties.match-rotation.name",value:this._matchRotation,onedit:a=>this._matchRotation=!!a},{name:"behaviors.orbit.properties.enabled.name",value:this._isEnabled,onedit:a=>this._SetEnabled(a)}]}]}}}"use strict";self.C3.Behaviors.Orbit.Cnds={IsEnabled(){return this._isEnabled}};
|
|
{"use strict";const d=self.C3;d.Behaviors.Orbit.Acts={SetSpeed(a){this._speed=d.toRadians(a)},SetTarget(a,b){this._targetObject=null;this._targetX=a;this._targetY=b},SetRotation(a){this._rotation=d.toRadians(a)},SetOffsetAngle(a){this._offsetAngle=d.toRadians(a)},SetRadius(a,b){this._minorAxis=a;this._majorAxis=b},SetMatchRotation(a){this._matchRotation=!!a},Pin(a){if(a&&(a=a.GetFirstPicked(this._inst))&&a.GetWorldInfo()){var b=this._isEnabled;b&&this._SetEnabled(!1);this._targetObject=a;b&&this._SetEnabled(!0)}},
|
|
Unpin(){const a=this._isEnabled;a&&this._SetEnabled(!1);this._targetObject=null;a&&this._SetEnabled(!0)},SetAcceleration(a){this._acceleration=d.toRadians(a)},SetEnabled(a){this._SetEnabled(a)},ResetTotalRotation(){this._totalAbsoluteRotation=this._totalRotation=0}}}
|
|
{"use strict";const d=self.C3;d.Behaviors.Orbit.Exps={Speed(){return d.toDegrees(this._speed)},Acceleration(){return d.toDegrees(this._acceleration)},PrimaryRadius(){return this._majorAxis},SecondaryRadius(){return this._minorAxis},OffsetAngle(){return d.toDegrees(this._offsetAngle)},Rotation(){return d.toDegrees(this._rotation)},TotalRotation(){return d.toDegrees(this._totalRotation)},TotalAbsoluteRotation(){return d.toDegrees(this._totalAbsoluteRotation)},TargetX(){return this._targetX},TargetY(){return this._targetY},
|
|
DistanceToTarget(){return Math.sqrt((this._minorAxis*Math.cos(this._rotation))**2+(this._majorAxis*Math.sin(this._rotation))**2)}}}
|
|
{const d=self.C3;self.C3_GetObjectRefTable=function(){return[d.Plugins.Sprite,d.Behaviors.Platform,d.Behaviors.scrollto,d.Behaviors.Sin,d.Behaviors.Timer,d.Behaviors.Flash,d.Plugins.TiledBg,d.Plugins.Keyboard,d.Behaviors.Fade,d.Behaviors.jumpthru,d.Behaviors.solid,d.Behaviors.Pin,d.Behaviors.Bullet,d.Plugins.Touch,d.Plugins.Audio,d.Behaviors.Rotate,d.Plugins.Spritefont2,d.Plugins.LocalStorage,d.Plugins.Tilemap,d.Behaviors.wrap,d.Behaviors.Orbit,d.Plugins.Browser,d.Plugins.System.Cnds.OnLayoutStart,
|
|
d.Plugins.TiledBg.Acts.SetWidth,d.Plugins.System.Exps.layoutwidth,d.Plugins.System.Acts.CreateObject,d.Plugins.System.Exps.viewportright,d.Plugins.System.Exps.viewportbottom,d.Plugins.Spritefont2.Acts.SetText,d.Plugins.System.Exps.left,d.Plugins.System.Exps.layoutname,d.Plugins.System.Exps.right,d.Plugins.System.Acts.SetLayerBackground,d.Plugins.Sprite.Acts.Destroy,d.Plugins.System.Acts.SetLayerTransparent,d.Plugins.Sprite.Acts.SetVisible,d.Plugins.Sprite.Acts.SetOpacity,d.Plugins.System.Acts.SetVar,
|
|
d.Plugins.TiledBg.Exps.ImageWidth,d.Plugins.Sprite.Acts.SetAnim,d.Behaviors.Platform.Acts.SetEnabled,d.Behaviors.Timer.Acts.StartTimer,d.Plugins.Sprite.Acts.SetInstanceVar,d.Plugins.System.Acts.Wait,d.Plugins.System.Acts.SetGroupActive,d.Behaviors.Platform.Acts.SetIgnoreInput,d.Plugins.System.Cnds.CompareVar,d.Plugins.System.Acts.GoToLayout,d.Plugins.System.Cnds.ForEach,d.Plugins.Sprite.Acts.Spawn,d.Behaviors.Orbit.Acts.SetRadius,d.Plugins.Sprite.Exps.Width,d.Behaviors.Orbit.Acts.SetSpeed,d.Plugins.System.Cnds.Compare,
|
|
d.Behaviors.Flash.Acts.Flash,d.Plugins.System.Cnds.Repeat,d.Plugins.System.Exps.loopindex,d.Plugins.System.Exps.random,d.Plugins.Sprite.Acts.SetMirrored,d.Plugins.TiledBg.Acts.SetPos,d.Plugins.TiledBg.Exps.Width,d.Plugins.System.Exps.layoutheight,d.Plugins.TiledBg.Acts.SetVisible,d.Plugins.TiledBg.Acts.AddInstanceVar,d.Plugins.Touch.Cnds.OnTouchStart,d.Plugins.Keyboard.Cnds.OnAnyKey,d.Plugins.Touch.Cnds.OnTouchObject,d.Plugins.Keyboard.Cnds.OnKey,d.Plugins.System.Cnds.IsGroupActive,d.Behaviors.Platform.Acts.SimulateControl,
|
|
d.Plugins.Audio.Acts.Play,d.Plugins.Keyboard.Cnds.IsKeyDown,d.Plugins.Touch.Cnds.IsTouchingObject,d.Behaviors.Platform.Cnds.IsFalling,d.Behaviors.Platform.Cnds.IsJumping,d.Plugins.Sprite.Cnds.IsAnimPlaying,d.Plugins.Sprite.Cnds.IsOverlapping,d.Plugins.Sprite.Acts.MoveToTop,d.Plugins.Sprite.Cnds.CompareX,d.Plugins.TiledBg.Exps.BBoxLeft,d.Plugins.TiledBg.Exps.BBoxRight,d.Plugins.Sprite.Acts.SetX,d.Plugins.TiledBg.Exps.X,d.Plugins.Sprite.Cnds.CompareInstanceVar,d.Plugins.Sprite.Acts.MoveAtAngle,d.Plugins.System.Cnds.Every,
|
|
d.Behaviors.Platform.Acts.SetMaxFallSpeed,d.Plugins.Keyboard.Cnds.OnKeyReleased,d.Behaviors.Platform.Cnds.OnLand,d.Plugins.Sprite.Acts.SetAnimFrame,d.Behaviors.Platform.Cnds.OnStop,d.Behaviors.Platform.Cnds.IsByWall,d.Behaviors.Platform.Cnds.OnJump,d.Plugins.System.Cnds.TriggerOnce,d.Plugins.System.Cnds.EveryTick,d.Plugins.Sprite.Acts.SetSize,d.Plugins.Sprite.Exps.Height,d.Behaviors.Timer.Cnds.OnTimer,d.Plugins.Sprite.Cnds.IsOnScreen,d.Plugins.Sprite.Cnds.CompareFrame,d.Behaviors.Bullet.Acts.SetAngleOfMotion,
|
|
d.Plugins.Sprite.Exps.Angle,d.Behaviors.Bullet.Acts.SetSpeed,d.Behaviors.Platform.Exps.MaxSpeed,d.Plugins.Sprite.Acts.SetScale,d.Plugins.Sprite.Acts.SetAngle,d.Plugins.Sprite.Cnds.OnCollision,d.Plugins.Sprite.Cnds.IsOutsideLayout,d.Plugins.Sprite.Cnds.CompareY,d.Plugins.Sprite.Exps.BBoxTop,d.Behaviors.Platform.Acts.SetVectorY,d.Plugins.Sprite.Cnds.CompareOpacity,d.Plugins.System.Acts.AddVar,d.Plugins.LocalStorage.Acts.SetItem,d.Plugins.System.Acts.NextPrevLayout,d.Behaviors.jumpthru.Cnds.IsEnabled,
|
|
d.Plugins.Sprite.Cnds.IsVisible,d.Plugins.Sprite.Cnds.IsOverlappingOffset,d.Plugins.Sprite.Exps.X,d.Plugins.System.Cnds.Else,d.Plugins.Sprite.Exps.Count,d.Plugins.System.Exps.choose,d.Plugins.Sprite.Cnds.OnDestroyed,d.Plugins.Sprite.Acts.SetCollisions,d.Plugins.Sprite.Exps.Y,d.Plugins.Sprite.Acts.SetAnimSpeed,d.Plugins.Sprite.Acts.SetEffect,d.Plugins.Sprite.Acts.SubInstanceVar,d.Plugins.Sprite.Acts.StopAnim,d.Plugins.Sprite.Cnds.CompareHeight,d.Plugins.TiledBg.Acts.Destroy,d.Behaviors.Platform.Acts.SetVectorX,
|
|
d.Plugins.TiledBg.Exps.Count,d.Plugins.TiledBg.Cnds.CompareInstanceVar,d.Plugins.System.Cnds.PickByComparison,d.Behaviors.Platform.Cnds.OnFall,d.Behaviors.Flash.Acts.StopFlashing,d.Plugins.System.Exps.dt,d.Behaviors.Fade.Acts.RestartFade,d.Plugins.System.Exps.viewportheight,d.Behaviors.Pin.Acts.Pin,d.Behaviors.Flash.Cnds.IsFlashing,d.Plugins.System.Acts.SetLayerOpacity,d.Behaviors.Sin.Acts.SetEnabled,d.Plugins.System.Exps.layeropacity,d.Plugins.System.Acts.RestartLayout,d.Behaviors.Fade.Acts.SetFadeInTime,
|
|
d.Behaviors.Fade.Acts.SetFadeOutTime,d.Behaviors.jumpthru.Acts.SetEnabled,d.Behaviors.Pin.Acts.PinByProperties,d.Plugins.Spritefont2.Acts.Destroy,d.Plugins.System.Acts.SetLayerVisible,d.Plugins.System.Exps.zeropad,d.Plugins.System.Cnds.IsNaN,d.Plugins.System.Acts.GoToLayoutByName,d.Plugins.Touch.Cnds.OnTapGestureObject,d.Plugins.Audio.Acts.StopAll,d.Plugins.Spritefont2.Acts.SetVisible,d.Plugins.LocalStorage.Acts.CheckItemExists,d.Plugins.System.Exps.loadingprogress,d.Plugins.Touch.Cnds.OnTapGesture,
|
|
d.Plugins.LocalStorage.Cnds.OnItemExists,d.Plugins.LocalStorage.Acts.GetItem,d.Plugins.LocalStorage.Cnds.OnItemGet,d.Plugins.LocalStorage.Exps.ItemValue,d.Plugins.LocalStorage.Cnds.OnItemMissing,d.Plugins.System.Exps.int,d.Plugins.Audio.Cnds.IsAnyPlaying,d.Plugins.Audio.Acts.FadeVolume,d.Plugins.Audio.Acts.PlayByName,d.Plugins.Sprite.Exps.AnimationFrame,d.Plugins.Audio.Acts.Stop,d.Plugins.Audio.Cnds.IsTagPlaying]};self.C3_JsPropNameTable=[{stairs_up:0},{umbrella:0},{dead:0},{lives:0},{count_idle:0},
|
|
{Platform:0},{ScrollTo:0},{Sine:0},{Timer:0},{Flash:0},{player:0},{stair:0},{Keyboard:0},{Fade:0},{Jumpthru:0},{bridge:0},{delay:0},{Solid:0},{button:0},{sideMove:0},{drop:0},{kill:0},{boss:0},{enemy:0},{barrierEnemy:0},{vectorJump:0},{collectItem:0},{trophy:0},{Pin:0},{circle:0},{shotTimer:0},{shoter:0},{Bullet:0},{bullet:0},{moveAngle:0},{plat:0},{platSide:0},{spike:0},{block:0},{spring:0},{active:0},{btn_jump:0},{btn_left:0},{btn_right:0},{Touch:0},{btn_start:0},{Audio:0},{coinCollect:0},{land:0},
|
|
{moveangle:0},{Rotate:0},{trophyEf:0},{hitEff:0},{bg_0:0},{bgfill:0},{intro_:0},{txt_continue:0},{title:0},{txt_info:0},{txt_level:0},{txt_resetLevels:0},{LocalStorage:0},{txt_progress:0},{scenario:0},{bg_1:0},{Wrap:0},{cloud:0},{enemy2:0},{en_spike:0},{isOK:0},{bossLives_ok:0},{bossLives_board:0},{debug:0},{Orbit:0},{plat2:0},{plat_speed:0},{plat2_circle:0},{angle_move:0},{plat3:0},{trophy_arrow:0},{txt_playerSpeach:0},{speach:0},{player_direction:0},{call_speach:0},{btn_music:0},{btn_home:0},{txt_buttons:0},
|
|
{Browser:0},{collect:0},{stairsSpeed:0},{check_input:0},{currentLevel:0},{idleSpeachTiming:0},{storageName:0},{loader_ok:0},{current_music:0},{music_active:0},{prev_music:0}]}
|
|
self.C3_ExpressionFuncs=[d=>{const a=d._GetNode(0).GetBoundMethod();return()=>a()},()=>"HUD",d=>{const a=d._GetNode(0).GetBoundMethod();return()=>a(0)/2},()=>32,()=>60,()=>"ESC",d=>{const a=d._GetNode(0).GetBoundMethod(),b=d._GetNode(1).GetBoundMethod(),e=d._GetNode(2).GetBoundMethod(),c=d._GetNode(3).GetBoundMethod();return()=>a(b(),5)+" "+e(c(),2)},()=>"BG",()=>15132390,()=>"Black",()=>0,d=>{const a=d._GetNode(0);return()=>a.ExpObject()},()=>"Idle",()=>1,()=>"idle",d=>{const a=d._GetNode(0).GetVar();
|
|
return()=>a.GetValue()},()=>.02,()=>"Player Control",()=>"Main",d=>{const a=d._GetNode(0);return()=>a.ExpObject()/2},d=>{const a=d._GetNode(0);return()=>a.ExpInstVar()},()=>"shot",()=>"touch",()=>480,()=>40,()=>215,()=>640,()=>"Level01",()=>.5,()=>.07,d=>{const a=d._GetNode(0).GetBoundMethod();return()=>a()/600*4},()=>"BG0",d=>{const a=d._GetNode(0).GetBoundMethod();return()=>75+150*a()},d=>{const a=d._GetNode(0).GetBoundMethod();return()=>a(64,192)},d=>{const a=d._GetNode(0).GetBoundMethod();return()=>
|
|
a(1)},()=>"Level32",d=>{const a=d._GetNode(0).GetBoundMethod(),b=d._GetNode(1);return()=>a("HUD")/2-b.ExpObject()/2},d=>{const a=d._GetNode(0).GetBoundMethod();return()=>.1*a()},()=>14,d=>{const a=d._GetNode(0),b=d._GetNode(1);return()=>a.ExpObject()+b.ExpObject()},()=>960,()=>"keyboard",()=>"Player",d=>{const a=d._GetNode(0);return()=>0===a.ExpInstVar()?0:-1E3},()=>"",()=>"Walk",d=>{const a=d._GetNode(0);return()=>a.ExpObject()+16},()=>270,()=>.1,()=>-10,()=>.025,()=>125,()=>"Float",()=>3E3,()=>
|
|
"Jump",()=>"Effects",d=>{const a=d._GetNode(0);return()=>1.15*a.ExpObject()},()=>180,()=>1.5,()=>"destroy",d=>{const a=d._GetNode(0);return()=>a.ExpObject()+.5},()=>"Map",()=>"Shot",d=>{const a=d._GetNode(0);return()=>.7*a.ExpBehavior()},()=>.8,d=>{const a=d._GetNode(0),b=d._GetNode(1);return()=>0===a.ExpObject()?1:180===b.ExpObject()?-1:0},()=>"Click",()=>"Let's glide!",()=>-800,()=>"Boing",()=>100,()=>"trz_lowsadv2",d=>{const a=d._GetNode(0).GetVar();return()=>a.GetValue().toString()+"/5"},()=>
|
|
5,d=>{const a=d._GetNode(0),b=d._GetNode(1),e=d._GetNode(2);return()=>90===a.ExpInstVar()?270:270===b.ExpInstVar()?90:0===e.ExpInstVar()?180:0},()=>1.2,d=>{const a=d._GetNode(0);return()=>a.ExpInstVar()/2},d=>{const a=d._GetNode(0),b=d._GetNode(1);return()=>a.ExpObject()+b.ExpObject()/4},d=>{const a=d._GetNode(0),b=d._GetNode(1);return()=>a.ExpObject()-b.ExpObject()/4},()=>"Move",d=>{const a=d._GetNode(0),b=d._GetNode(1);return()=>a.ExpObject()<b.ExpObject()?0:1},d=>{const a=d._GetNode(0),b=d._GetNode(1);
|
|
return()=>a.ExpObject()<b.ExpObject()?180:0},()=>2.5,()=>"Default",d=>{const a=d._GetNode(0);return()=>a.ExpInstVar()+180},d=>{const a=d._GetNode(0),b=d._GetNode(1),e=d._GetNode(2).GetBoundMethod();return()=>a.ExpObject()>b.ExpObject()?e("HUD")-36:36},d=>{const a=d._GetNode(0),b=d._GetNode(1);return()=>a.ExpObject()>b.ExpObject()?0:180},()=>.05,()=>2,()=>"Enemies",d=>{const a=d._GetNode(0).GetBoundMethod();return()=>a(-1,1)},()=>-1,d=>{const a=d._GetNode(0);return()=>-1*a.ExpInstVar()},()=>-300,()=>
|
|
.2,()=>-500,()=>25,()=>45,()=>.15,()=>64,d=>{const a=d._GetNode(0),b=d._GetNode(1);return()=>a.ExpObject()<b.ExpObject()?-1E4:1E4},d=>{const a=d._GetNode(0),b=d._GetNode(1);return()=>a.ExpObject()*b.ExpInstVar()},()=>"Other game over cases",d=>{const a=d._GetNode(0).GetBoundMethod();return()=>1.2*a()},()=>"Functions",d=>{const a=d._GetNode(0).GetBoundMethod();return()=>a("HUD")/2},()=>10,d=>{const a=d._GetNode(0).GetBoundMethod();return()=>36*a()},()=>3,()=>"Hit",()=>-200,d=>{const a=d._GetNode(0).GetBoundMethod();
|
|
return()=>.01*a()},d=>{const a=d._GetNode(0).GetBoundMethod();return()=>a("Black")+1},()=>90,()=>"Hey, watch out!",()=>"Debug",()=>"Level10",()=>.7,()=>"Anybody here?",()=>"left",()=>"right",d=>{const a=d._GetNode(0).GetBoundMethod(),b=d._GetNode(1).GetVar();return()=>"LEVEL:"+a(b.GetValue(),2)+"/32"},()=>33,d=>{const a=d._GetNode(0).GetVar(),b=d._GetNode(1).GetVar();return()=>0===a.GetValue()?1:b.GetValue()},d=>{const a=d._GetNode(0).GetBoundMethod(),b=d._GetNode(1).GetVar();return()=>"Level"+a(b.GetValue(),
|
|
2)},()=>Infinity,d=>{const a=d._GetNode(0).GetBoundMethod(),b=d._GetNode(1).GetBoundMethod(),e=d._GetNode(2).GetBoundMethod(),c=d._GetNode(3).GetBoundMethod(),f=d._GetNode(4).GetBoundMethod(),g=d._GetNode(5).GetBoundMethod(),h=d._GetNode(6).GetBoundMethod(),l=d._GetNode(7).GetBoundMethod();return()=>"Main"===a()?"music_intro":"Level32"===b()?"music_boss":0===e(c(f(),2))%3?"music_3":0===g(h(l(),2))%2?"music_2":"music_1"},d=>{const a=d._GetNode(0).GetBoundMethod();return()=>a("HUD")-32},()=>"M",()=>
|
|
-5,()=>"music_intro",d=>{const a=d._GetNode(0);return()=>0===a.ExpObject()?1:0},d=>{const a=d._GetNode(0).GetVar();return()=>0===a.GetValue()?1:0}];var module$str$c3runtime={};var module$str$__c3root__={};
|