Files
monkeygg2.github.io/games/ovo/2.0.2alpha/scripts/c3runtime.js
T
2023-10-22 16:15:54 -04:00

8826 lines
1.1 MiB
Plaintext

// Generated by Construct 3, the game and app creator :: https://www.construct.net
"use strict";
// c3/3rdparty/glmatrix.js
(function(e,t){if('object'==typeof exports&&'object'==typeof module)module.exports=t();else if('function'==typeof define&&define.amd)define([],t);else{var r=t();for(var a in r)('object'==typeof exports?exports:e)[a]=r[a]}})(this,function(){var e=Math.acos,t=Math.round,r=Math.min,o=Math.floor,l=Math.ceil,n=Math.sqrt,s=Math.pow,d=Math.cos,u=Math.sin,i=Math.max,m=Math.abs,c=Math.PI;return function(e){function t(r){if(a[r])return a[r].exports;var o=a[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var a={};return t.m=e,t.c=a,t.d=function(e,a,r){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var a=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(a,'a',a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='',t(t.s=4)}([function(e,t){'use strict';Object.defineProperty(t,'__esModule',{value:!0}),t.setMatrixArrayType=function(e){t.ARRAY_TYPE=a=e},t.toRadian=function(e){return e*l},t.equals=function(e,t){return m(e-t)<=r*i(1,m(e),m(t))};var r=t.EPSILON=1e-6,a=t.ARRAY_TYPE='undefined'==typeof Float32Array?Array:Float32Array,o=t.RANDOM=Math.random,l=c/180},function(e,t,a){'use strict';function r(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=t[4],d=t[5],u=t[6],i=t[7],c=t[8],m=a[0],f=a[1],P=a[2],p=a[3],E=a[4],y=a[5],A=a[6],O=a[7],R=a[8];return e[0]=m*r+f*s+P*u,e[1]=m*o+f*n+P*i,e[2]=m*l+f*d+P*c,e[3]=p*r+E*s+y*u,e[4]=p*o+E*n+y*i,e[5]=p*l+E*d+y*c,e[6]=A*r+O*s+R*u,e[7]=A*o+O*n+R*i,e[8]=A*l+O*d+R*c,e}function o(e,t,a){return e[0]=t[0]-a[0],e[1]=t[1]-a[1],e[2]=t[2]-a[2],e[3]=t[3]-a[3],e[4]=t[4]-a[4],e[5]=t[5]-a[5],e[6]=t[6]-a[6],e[7]=t[7]-a[7],e[8]=t[8]-a[8],e}Object.defineProperty(t,'__esModule',{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new c.ARRAY_TYPE(9);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},t.clone=function(e){var t=new c.ARRAY_TYPE(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},t.fromValues=function(e,t,a,r,o,l,s,n,d){var u=new c.ARRAY_TYPE(9);return u[0]=e,u[1]=t,u[2]=a,u[3]=r,u[4]=o,u[5]=l,u[6]=s,u[7]=n,u[8]=d,u},t.set=function(e,t,a,r,o,l,s,n,d,u){return e[0]=t,e[1]=a,e[2]=r,e[3]=o,e[4]=l,e[5]=s,e[6]=n,e[7]=d,e[8]=u,e},t.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.transpose=function(e,t){if(e===t){var a=t[1],r=t[2],o=t[5];e[1]=t[3],e[2]=t[6],e[3]=a,e[5]=t[7],e[6]=r,e[7]=o}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},t.invert=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=t[4],n=t[5],d=t[6],u=t[7],i=t[8],c=i*s-n*u,m=-i*l+n*d,f=u*l-s*d,P=a*c+r*m+o*f;return P?(P=1/P,e[0]=c*P,e[1]=(-i*r+o*u)*P,e[2]=(n*r-o*s)*P,e[3]=m*P,e[4]=(i*a-o*d)*P,e[5]=(-n*a+o*l)*P,e[6]=f*P,e[7]=(-u*a+r*d)*P,e[8]=(s*a-r*l)*P,e):null},t.adjoint=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=t[4],n=t[5],d=t[6],u=t[7],i=t[8];return e[0]=s*i-n*u,e[1]=o*u-r*i,e[2]=r*n-o*s,e[3]=n*d-l*i,e[4]=a*i-o*d,e[5]=o*l-a*n,e[6]=l*u-s*d,e[7]=r*d-a*u,e[8]=a*s-r*l,e},t.determinant=function(e){var t=e[0],a=e[1],r=e[2],o=e[3],l=e[4],s=e[5],n=e[6],d=e[7],u=e[8];return t*(u*l-s*d)+a*(-u*o+s*n)+r*(d*o-l*n)},t.multiply=r,t.translate=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=t[4],d=t[5],u=t[6],i=t[7],c=t[8],m=a[0],f=a[1];return e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=n,e[5]=d,e[6]=m*r+f*s+u,e[7]=m*o+f*n+i,e[8]=m*l+f*d+c,e},t.rotate=function(e,t,a){var r=t[0],o=t[1],l=t[2],n=t[3],i=t[4],m=t[5],f=t[6],P=t[7],p=t[8],E=u(a),s=d(a);return e[0]=s*r+E*n,e[1]=s*o+E*i,e[2]=s*l+E*m,e[3]=s*n-E*r,e[4]=s*i-E*o,e[5]=s*m-E*l,e[6]=f,e[7]=P,e[8]=p,e},t.scale=function(e,t,a){var r=a[0],o=a[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=o*t[3],e[4]=o*t[4],e[5]=o*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},t.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},t.fromRotation=function(e,t){var a=u(t),r=d(t);return e[0]=r,e[1]=a,e[2]=0,e[3]=-a,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.fromMat2d=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},t.fromQuat=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=a+a,n=r+r,d=o+o,u=a*s,i=r*s,c=r*n,m=o*s,f=o*n,P=o*d,p=l*s,E=l*n,y=l*d;return e[0]=1-c-P,e[3]=i-y,e[6]=m+E,e[1]=i+y,e[4]=1-u-P,e[7]=f-p,e[2]=m-E,e[5]=f+p,e[8]=1-u-c,e},t.normalFromMat4=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=t[4],n=t[5],d=t[6],u=t[7],i=t[8],c=t[9],m=t[10],f=t[11],P=t[12],p=t[13],E=t[14],y=t[15],A=a*n-r*s,O=a*d-o*s,R=a*u-l*s,L=r*d-o*n,S=r*u-l*n,_=o*u-l*d,N=i*p-c*P,I=i*E-m*P,Y=i*y-f*P,q=c*E-m*p,g=c*y-f*p,M=m*y-f*E,v=A*M-O*g+R*q+L*Y-S*I+_*N;return v?(v=1/v,e[0]=(n*M-d*g+u*q)*v,e[1]=(d*Y-s*M-u*I)*v,e[2]=(s*g-n*Y+u*N)*v,e[3]=(o*g-r*M-l*q)*v,e[4]=(a*M-o*Y+l*I)*v,e[5]=(r*Y-a*g-l*N)*v,e[6]=(p*_-E*S+y*L)*v,e[7]=(E*R-P*_-y*O)*v,e[8]=(P*S-p*R+y*A)*v,e):null},t.projection=function(e,t,a){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/a,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},t.str=function(e){return'mat3('+e[0]+', '+e[1]+', '+e[2]+', '+e[3]+', '+e[4]+', '+e[5]+', '+e[6]+', '+e[7]+', '+e[8]+')'},t.frob=function(e){return n(s(e[0],2)+s(e[1],2)+s(e[2],2)+s(e[3],2)+s(e[4],2)+s(e[5],2)+s(e[6],2)+s(e[7],2)+s(e[8],2))},t.add=function(e,t,a){return e[0]=t[0]+a[0],e[1]=t[1]+a[1],e[2]=t[2]+a[2],e[3]=t[3]+a[3],e[4]=t[4]+a[4],e[5]=t[5]+a[5],e[6]=t[6]+a[6],e[7]=t[7]+a[7],e[8]=t[8]+a[8],e},t.subtract=o,t.multiplyScalar=function(e,t,a){return e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e[3]=t[3]*a,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*a,e},t.multiplyScalarAndAdd=function(e,t,a,r){return e[0]=t[0]+a[0]*r,e[1]=t[1]+a[1]*r,e[2]=t[2]+a[2]*r,e[3]=t[3]+a[3]*r,e[4]=t[4]+a[4]*r,e[5]=t[5]+a[5]*r,e[6]=t[6]+a[6]*r,e[7]=t[7]+a[7]*r,e[8]=t[8]+a[8]*r,e},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},t.equals=function(e,t){var a=e[0],r=e[1],o=e[2],l=e[3],s=e[4],n=e[5],d=e[6],u=e[7],f=e[8],P=t[0],p=t[1],E=t[2],y=t[3],A=t[4],O=t[5],R=t[6],L=t[7],S=t[8];return m(a-P)<=c.EPSILON*i(1,m(a),m(P))&&m(r-p)<=c.EPSILON*i(1,m(r),m(p))&&m(o-E)<=c.EPSILON*i(1,m(o),m(E))&&m(l-y)<=c.EPSILON*i(1,m(l),m(y))&&m(s-A)<=c.EPSILON*i(1,m(s),m(A))&&m(n-O)<=c.EPSILON*i(1,m(n),m(O))&&m(d-R)<=c.EPSILON*i(1,m(d),m(R))&&m(u-L)<=c.EPSILON*i(1,m(u),m(L))&&m(f-S)<=c.EPSILON*i(1,m(f),m(S))};var l=a(0),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(l);var f=t.mul=r,P=t.sub=o},function(a,s,f){'use strict';function P(){var e=new Y.ARRAY_TYPE(3);return e[0]=0,e[1]=0,e[2]=0,e}function p(e){var t=e[0],a=e[1],r=e[2];return n(t*t+a*a+r*r)}function E(e,t,a){var r=new Y.ARRAY_TYPE(3);return r[0]=e,r[1]=t,r[2]=a,r}function y(e,t,a){return e[0]=t[0]-a[0],e[1]=t[1]-a[1],e[2]=t[2]-a[2],e}function A(e,t,a){return e[0]=t[0]*a[0],e[1]=t[1]*a[1],e[2]=t[2]*a[2],e}function O(e,t,a){return e[0]=t[0]/a[0],e[1]=t[1]/a[1],e[2]=t[2]/a[2],e}function R(e,t){var a=t[0]-e[0],r=t[1]-e[1],o=t[2]-e[2];return n(a*a+r*r+o*o)}function L(e,t){var a=t[0]-e[0],r=t[1]-e[1],o=t[2]-e[2];return a*a+r*r+o*o}function S(e){var t=e[0],a=e[1],r=e[2];return t*t+a*a+r*r}function _(e,t){var a=t[0],r=t[1],o=t[2],l=a*a+r*r+o*o;return 0<l&&(l=1/n(l),e[0]=t[0]*l,e[1]=t[1]*l,e[2]=t[2]*l),e}function N(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}Object.defineProperty(s,'__esModule',{value:!0}),s.forEach=s.sqrLen=s.len=s.sqrDist=s.dist=s.div=s.mul=s.sub=void 0,s.create=P,s.clone=function(e){var t=new Y.ARRAY_TYPE(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},s.length=p,s.fromValues=E,s.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},s.set=function(e,t,a,r){return e[0]=t,e[1]=a,e[2]=r,e},s.add=function(e,t,a){return e[0]=t[0]+a[0],e[1]=t[1]+a[1],e[2]=t[2]+a[2],e},s.subtract=y,s.multiply=A,s.divide=O,s.ceil=function(e,t){return e[0]=l(t[0]),e[1]=l(t[1]),e[2]=l(t[2]),e},s.floor=function(e,t){return e[0]=o(t[0]),e[1]=o(t[1]),e[2]=o(t[2]),e},s.min=function(e,t,a){return e[0]=r(t[0],a[0]),e[1]=r(t[1],a[1]),e[2]=r(t[2],a[2]),e},s.max=function(e,t,a){return e[0]=i(t[0],a[0]),e[1]=i(t[1],a[1]),e[2]=i(t[2],a[2]),e},s.round=function(e,r){return e[0]=t(r[0]),e[1]=t(r[1]),e[2]=t(r[2]),e},s.scale=function(e,t,a){return e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e},s.scaleAndAdd=function(e,t,a,r){return e[0]=t[0]+a[0]*r,e[1]=t[1]+a[1]*r,e[2]=t[2]+a[2]*r,e},s.distance=R,s.squaredDistance=L,s.squaredLength=S,s.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},s.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},s.normalize=_,s.dot=N,s.cross=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=a[0],n=a[1],d=a[2];return e[0]=o*d-l*n,e[1]=l*s-r*d,e[2]=r*n-o*s,e},s.lerp=function(e,r,a,o){var t=r[0],l=r[1],s=r[2];return e[0]=t+o*(a[0]-t),e[1]=l+o*(a[1]-l),e[2]=s+o*(a[2]-s),e},s.hermite=function(e,r,a,o,l,s){var t=s*s,n=t*(2*s-3)+1,d=t*(s-2)+s,u=t*(s-1),i=t*(3-2*s);return e[0]=r[0]*n+a[0]*d+o[0]*u+l[0]*i,e[1]=r[1]*n+a[1]*d+o[1]*u+l[1]*i,e[2]=r[2]*n+a[2]*d+o[2]*u+l[2]*i,e},s.bezier=function(e,r,a,o,l,s){var t=1-s,n=t*t,d=s*s,u=n*t,i=3*s*n,c=3*d*t,m=d*s;return e[0]=r[0]*u+a[0]*i+o[0]*c+l[0]*m,e[1]=r[1]*u+a[1]*i+o[1]*c+l[1]*m,e[2]=r[2]*u+a[2]*i+o[2]*c+l[2]*m,e},s.random=function(e,t){t=t||1;var a=2*Y.RANDOM()*c,r=2*Y.RANDOM()-1,o=n(1-r*r)*t;return e[0]=d(a)*o,e[1]=u(a)*o,e[2]=r*t,e},s.transformMat4=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=a[3]*r+a[7]*o+a[11]*l+a[15];return s=s||1,e[0]=(a[0]*r+a[4]*o+a[8]*l+a[12])/s,e[1]=(a[1]*r+a[5]*o+a[9]*l+a[13])/s,e[2]=(a[2]*r+a[6]*o+a[10]*l+a[14])/s,e},s.transformMat3=function(e,t,a){var r=t[0],o=t[1],l=t[2];return e[0]=r*a[0]+o*a[3]+l*a[6],e[1]=r*a[1]+o*a[4]+l*a[7],e[2]=r*a[2]+o*a[5]+l*a[8],e},s.transformQuat=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=a[0],n=a[1],d=a[2],u=a[3],i=u*r+n*l-d*o,c=u*o+d*r-s*l,m=u*l+s*o-n*r,f=-s*r-n*o-d*l;return e[0]=i*u+f*-s+c*-d-m*-n,e[1]=c*u+f*-n+m*-s-i*-d,e[2]=m*u+f*-d+i*-n-c*-s,e},s.rotateX=function(e,t,a,o){var l=[],s=[];return l[0]=t[0]-a[0],l[1]=t[1]-a[1],l[2]=t[2]-a[2],s[0]=l[0],s[1]=l[1]*d(o)-l[2]*u(o),s[2]=l[1]*u(o)+l[2]*d(o),e[0]=s[0]+a[0],e[1]=s[1]+a[1],e[2]=s[2]+a[2],e},s.rotateY=function(e,t,a,o){var l=[],s=[];return l[0]=t[0]-a[0],l[1]=t[1]-a[1],l[2]=t[2]-a[2],s[0]=l[2]*u(o)+l[0]*d(o),s[1]=l[1],s[2]=l[2]*d(o)-l[0]*u(o),e[0]=s[0]+a[0],e[1]=s[1]+a[1],e[2]=s[2]+a[2],e},s.rotateZ=function(e,t,a,o){var l=[],s=[];return l[0]=t[0]-a[0],l[1]=t[1]-a[1],l[2]=t[2]-a[2],s[0]=l[0]*d(o)-l[1]*u(o),s[1]=l[0]*u(o)+l[1]*d(o),s[2]=l[2],e[0]=s[0]+a[0],e[1]=s[1]+a[1],e[2]=s[2]+a[2],e},s.angle=function(t,a){var r=E(t[0],t[1],t[2]),o=E(a[0],a[1],a[2]);_(r,r),_(o,o);var l=N(r,o);return 1<l?0:-1>l?c:e(l)},s.str=function(e){return'vec3('+e[0]+', '+e[1]+', '+e[2]+')'},s.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},s.equals=function(e,t){var a=e[0],r=e[1],o=e[2],l=t[0],s=t[1],n=t[2];return m(a-l)<=Y.EPSILON*i(1,m(a),m(l))&&m(r-s)<=Y.EPSILON*i(1,m(r),m(s))&&m(o-n)<=Y.EPSILON*i(1,m(o),m(n))};var I=f(0),Y=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(I),q=s.sub=y,g=s.mul=A,M=s.div=O,v=s.dist=R,h=s.sqrDist=L,T=s.len=p,b=s.sqrLen=S,x=s.forEach=function(){var e=P();return function(t,a,o,s,n,d){var u,i;for(a||(a=3),o||(o=0),i=s?r(s*a+o,t.length):t.length,u=o;u<i;u+=a)e[0]=t[u],e[1]=t[u+1],e[2]=t[u+2],n(e,e,d),t[u]=e[0],t[u+1]=e[1],t[u+2]=e[2];return t}}()},function(e,a,s){'use strict';function d(){var e=new L.ARRAY_TYPE(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function u(e,t,a){return e[0]=t[0]-a[0],e[1]=t[1]-a[1],e[2]=t[2]-a[2],e[3]=t[3]-a[3],e}function c(e,t,a){return e[0]=t[0]*a[0],e[1]=t[1]*a[1],e[2]=t[2]*a[2],e[3]=t[3]*a[3],e}function f(e,t,a){return e[0]=t[0]/a[0],e[1]=t[1]/a[1],e[2]=t[2]/a[2],e[3]=t[3]/a[3],e}function P(e,t,a){return e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e[3]=t[3]*a,e}function p(e,t){var a=t[0]-e[0],r=t[1]-e[1],o=t[2]-e[2],l=t[3]-e[3];return n(a*a+r*r+o*o+l*l)}function E(e,t){var a=t[0]-e[0],r=t[1]-e[1],o=t[2]-e[2],l=t[3]-e[3];return a*a+r*r+o*o+l*l}function y(e){var t=e[0],a=e[1],r=e[2],o=e[3];return n(t*t+a*a+r*r+o*o)}function A(e){var t=e[0],a=e[1],r=e[2],o=e[3];return t*t+a*a+r*r+o*o}function O(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=a*a+r*r+o*o+l*l;return 0<s&&(s=1/n(s),e[0]=a*s,e[1]=r*s,e[2]=o*s,e[3]=l*s),e}Object.defineProperty(a,'__esModule',{value:!0}),a.forEach=a.sqrLen=a.len=a.sqrDist=a.dist=a.div=a.mul=a.sub=void 0,a.create=d,a.clone=function(e){var t=new L.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},a.fromValues=function(e,t,a,r){var o=new L.ARRAY_TYPE(4);return o[0]=e,o[1]=t,o[2]=a,o[3]=r,o},a.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},a.set=function(e,t,a,r,o){return e[0]=t,e[1]=a,e[2]=r,e[3]=o,e},a.add=function(e,t,a){return e[0]=t[0]+a[0],e[1]=t[1]+a[1],e[2]=t[2]+a[2],e[3]=t[3]+a[3],e},a.subtract=u,a.multiply=c,a.divide=f,a.ceil=function(e,t){return e[0]=l(t[0]),e[1]=l(t[1]),e[2]=l(t[2]),e[3]=l(t[3]),e},a.floor=function(e,t){return e[0]=o(t[0]),e[1]=o(t[1]),e[2]=o(t[2]),e[3]=o(t[3]),e},a.min=function(e,t,a){return e[0]=r(t[0],a[0]),e[1]=r(t[1],a[1]),e[2]=r(t[2],a[2]),e[3]=r(t[3],a[3]),e},a.max=function(e,t,a){return e[0]=i(t[0],a[0]),e[1]=i(t[1],a[1]),e[2]=i(t[2],a[2]),e[3]=i(t[3],a[3]),e},a.round=function(e,r){return e[0]=t(r[0]),e[1]=t(r[1]),e[2]=t(r[2]),e[3]=t(r[3]),e},a.scale=P,a.scaleAndAdd=function(e,t,a,r){return e[0]=t[0]+a[0]*r,e[1]=t[1]+a[1]*r,e[2]=t[2]+a[2]*r,e[3]=t[3]+a[3]*r,e},a.distance=p,a.squaredDistance=E,a.length=y,a.squaredLength=A,a.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},a.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},a.normalize=O,a.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},a.lerp=function(e,r,a,o){var t=r[0],l=r[1],s=r[2],n=r[3];return e[0]=t+o*(a[0]-t),e[1]=l+o*(a[1]-l),e[2]=s+o*(a[2]-s),e[3]=n+o*(a[3]-n),e},a.random=function(e,t){return t=t||1,e[0]=L.RANDOM(),e[1]=L.RANDOM(),e[2]=L.RANDOM(),e[3]=L.RANDOM(),O(e,e),P(e,e,t),e},a.transformMat4=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3];return e[0]=a[0]*r+a[4]*o+a[8]*l+a[12]*s,e[1]=a[1]*r+a[5]*o+a[9]*l+a[13]*s,e[2]=a[2]*r+a[6]*o+a[10]*l+a[14]*s,e[3]=a[3]*r+a[7]*o+a[11]*l+a[15]*s,e},a.transformQuat=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=a[0],n=a[1],d=a[2],u=a[3],i=u*r+n*l-d*o,c=u*o+d*r-s*l,m=u*l+s*o-n*r,f=-s*r-n*o-d*l;return e[0]=i*u+f*-s+c*-d-m*-n,e[1]=c*u+f*-n+m*-s-i*-d,e[2]=m*u+f*-d+i*-n-c*-s,e[3]=t[3],e},a.str=function(e){return'vec4('+e[0]+', '+e[1]+', '+e[2]+', '+e[3]+')'},a.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},a.equals=function(e,t){var a=e[0],r=e[1],o=e[2],l=e[3],s=t[0],n=t[1],d=t[2],u=t[3];return m(a-s)<=L.EPSILON*i(1,m(a),m(s))&&m(r-n)<=L.EPSILON*i(1,m(r),m(n))&&m(o-d)<=L.EPSILON*i(1,m(o),m(d))&&m(l-u)<=L.EPSILON*i(1,m(l),m(u))};var R=s(0),L=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(R),S=a.sub=u,_=a.mul=c,N=a.div=f,I=a.dist=p,Y=a.sqrDist=E,q=a.len=y,g=a.sqrLen=A,M=a.forEach=function(){var e=d();return function(t,a,o,s,n,d){var u,i;for(a||(a=4),o||(o=0),i=s?r(s*a+o,t.length):t.length,u=o;u<i;u+=a)e[0]=t[u],e[1]=t[u+1],e[2]=t[u+2],e[3]=t[u+3],n(e,e,d),t[u]=e[0],t[u+1]=e[1],t[u+2]=e[2],t[u+3]=e[3];return t}}()},function(e,t,a){'use strict';function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}Object.defineProperty(t,'__esModule',{value:!0}),t.vec4=t.vec3=t.vec2=t.quat=t.mat4=t.mat3=t.mat2d=t.mat2=t.glMatrix=void 0;var o=a(0),l=r(o),s=a(5),n=r(s),d=a(6),u=r(d),i=a(1),c=r(i),m=a(7),f=r(m),P=a(8),p=r(P),E=a(9),y=r(E),A=a(2),O=r(A),R=a(3),L=r(R);t.glMatrix=l,t.mat2=n,t.mat2d=u,t.mat3=c,t.mat4=f,t.quat=p,t.vec2=y,t.vec3=O,t.vec4=L},function(e,t,a){'use strict';function r(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=a[0],d=a[1],u=a[2],i=a[3];return e[0]=r*n+l*d,e[1]=o*n+s*d,e[2]=r*u+l*i,e[3]=o*u+s*i,e}function o(e,t,a){return e[0]=t[0]-a[0],e[1]=t[1]-a[1],e[2]=t[2]-a[2],e[3]=t[3]-a[3],e}Object.defineProperty(t,'__esModule',{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new c.ARRAY_TYPE(4);return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},t.clone=function(e){var t=new c.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},t.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},t.fromValues=function(e,t,a,r){var o=new c.ARRAY_TYPE(4);return o[0]=e,o[1]=t,o[2]=a,o[3]=r,o},t.set=function(e,t,a,r,o){return e[0]=t,e[1]=a,e[2]=r,e[3]=o,e},t.transpose=function(e,t){if(e===t){var a=t[1];e[1]=t[2],e[2]=a}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e},t.invert=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=a*l-o*r;return s?(s=1/s,e[0]=l*s,e[1]=-r*s,e[2]=-o*s,e[3]=a*s,e):null},t.adjoint=function(e,t){var a=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=a,e},t.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},t.multiply=r,t.rotate=function(e,t,a){var r=t[0],o=t[1],l=t[2],n=t[3],i=u(a),m=d(a);return e[0]=r*m+l*i,e[1]=o*m+n*i,e[2]=r*-i+l*m,e[3]=o*-i+n*m,e},t.scale=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=a[0],d=a[1];return e[0]=r*n,e[1]=o*n,e[2]=l*d,e[3]=s*d,e},t.fromRotation=function(e,t){var a=u(t),r=d(t);return e[0]=r,e[1]=a,e[2]=-a,e[3]=r,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e},t.str=function(e){return'mat2('+e[0]+', '+e[1]+', '+e[2]+', '+e[3]+')'},t.frob=function(e){return n(s(e[0],2)+s(e[1],2)+s(e[2],2)+s(e[3],2))},t.LDU=function(e,t,r,o){return e[2]=o[2]/o[0],r[0]=o[0],r[1]=o[1],r[3]=o[3]-e[2]*r[1],[e,t,r]},t.add=function(e,t,a){return e[0]=t[0]+a[0],e[1]=t[1]+a[1],e[2]=t[2]+a[2],e[3]=t[3]+a[3],e},t.subtract=o,t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},t.equals=function(e,t){var a=e[0],r=e[1],o=e[2],l=e[3],s=t[0],n=t[1],d=t[2],u=t[3];return m(a-s)<=c.EPSILON*i(1,m(a),m(s))&&m(r-n)<=c.EPSILON*i(1,m(r),m(n))&&m(o-d)<=c.EPSILON*i(1,m(o),m(d))&&m(l-u)<=c.EPSILON*i(1,m(l),m(u))},t.multiplyScalar=function(e,t,a){return e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e[3]=t[3]*a,e},t.multiplyScalarAndAdd=function(e,t,a,r){return e[0]=t[0]+a[0]*r,e[1]=t[1]+a[1]*r,e[2]=t[2]+a[2]*r,e[3]=t[3]+a[3]*r,e};var l=a(0),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(l),f=t.mul=r,P=t.sub=o},function(e,t,a){'use strict';function r(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=t[4],d=t[5],u=a[0],i=a[1],c=a[2],m=a[3],f=a[4],P=a[5];return e[0]=r*u+l*i,e[1]=o*u+s*i,e[2]=r*c+l*m,e[3]=o*c+s*m,e[4]=r*f+l*P+n,e[5]=o*f+s*P+d,e}function o(e,t,a){return e[0]=t[0]-a[0],e[1]=t[1]-a[1],e[2]=t[2]-a[2],e[3]=t[3]-a[3],e[4]=t[4]-a[4],e[5]=t[5]-a[5],e}Object.defineProperty(t,'__esModule',{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new f.ARRAY_TYPE(6);return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},t.clone=function(e){var t=new f.ARRAY_TYPE(6);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},t.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},t.fromValues=function(e,t,a,r,o,l){var s=new f.ARRAY_TYPE(6);return s[0]=e,s[1]=t,s[2]=a,s[3]=r,s[4]=o,s[5]=l,s},t.set=function(e,t,a,r,o,l,s){return e[0]=t,e[1]=a,e[2]=r,e[3]=o,e[4]=l,e[5]=s,e},t.invert=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=t[4],n=t[5],d=a*l-r*o;return d?(d=1/d,e[0]=l*d,e[1]=-r*d,e[2]=-o*d,e[3]=a*d,e[4]=(o*n-l*s)*d,e[5]=(r*s-a*n)*d,e):null},t.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},t.multiply=r,t.rotate=function(e,t,a){var r=t[0],o=t[1],l=t[2],n=t[3],i=t[4],m=t[5],f=u(a),P=d(a);return e[0]=r*P+l*f,e[1]=o*P+n*f,e[2]=r*-f+l*P,e[3]=o*-f+n*P,e[4]=i,e[5]=m,e},t.scale=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=t[4],d=t[5],u=a[0],i=a[1];return e[0]=r*u,e[1]=o*u,e[2]=l*i,e[3]=s*i,e[4]=n,e[5]=d,e},t.translate=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=t[4],d=t[5],u=a[0],i=a[1];return e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=r*u+l*i+n,e[5]=o*u+s*i+d,e},t.fromRotation=function(e,t){var a=u(t),r=d(t);return e[0]=r,e[1]=a,e[2]=-a,e[3]=r,e[4]=0,e[5]=0,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e},t.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e},t.str=function(e){return'mat2d('+e[0]+', '+e[1]+', '+e[2]+', '+e[3]+', '+e[4]+', '+e[5]+')'},t.frob=function(e){return n(s(e[0],2)+s(e[1],2)+s(e[2],2)+s(e[3],2)+s(e[4],2)+s(e[5],2)+1)},t.add=function(e,t,a){return e[0]=t[0]+a[0],e[1]=t[1]+a[1],e[2]=t[2]+a[2],e[3]=t[3]+a[3],e[4]=t[4]+a[4],e[5]=t[5]+a[5],e},t.subtract=o,t.multiplyScalar=function(e,t,a){return e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e[3]=t[3]*a,e[4]=t[4]*a,e[5]=t[5]*a,e},t.multiplyScalarAndAdd=function(e,t,a,r){return e[0]=t[0]+a[0]*r,e[1]=t[1]+a[1]*r,e[2]=t[2]+a[2]*r,e[3]=t[3]+a[3]*r,e[4]=t[4]+a[4]*r,e[5]=t[5]+a[5]*r,e},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]},t.equals=function(e,t){var a=e[0],r=e[1],o=e[2],l=e[3],s=e[4],n=e[5],d=t[0],u=t[1],c=t[2],P=t[3],p=t[4],E=t[5];return m(a-d)<=f.EPSILON*i(1,m(a),m(d))&&m(r-u)<=f.EPSILON*i(1,m(r),m(u))&&m(o-c)<=f.EPSILON*i(1,m(o),m(c))&&m(l-P)<=f.EPSILON*i(1,m(l),m(P))&&m(s-p)<=f.EPSILON*i(1,m(s),m(p))&&m(n-E)<=f.EPSILON*i(1,m(n),m(E))};var l=a(0),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(l),c=t.mul=r,P=t.sub=o},function(e,t,a){'use strict';function r(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=t[4],d=t[5],u=t[6],i=t[7],c=t[8],m=t[9],f=t[10],P=t[11],p=t[12],E=t[13],y=t[14],A=t[15],O=a[0],R=a[1],L=a[2],S=a[3];return e[0]=O*r+R*n+L*c+S*p,e[1]=O*o+R*d+L*m+S*E,e[2]=O*l+R*u+L*f+S*y,e[3]=O*s+R*i+L*P+S*A,O=a[4],R=a[5],L=a[6],S=a[7],e[4]=O*r+R*n+L*c+S*p,e[5]=O*o+R*d+L*m+S*E,e[6]=O*l+R*u+L*f+S*y,e[7]=O*s+R*i+L*P+S*A,O=a[8],R=a[9],L=a[10],S=a[11],e[8]=O*r+R*n+L*c+S*p,e[9]=O*o+R*d+L*m+S*E,e[10]=O*l+R*u+L*f+S*y,e[11]=O*s+R*i+L*P+S*A,O=a[12],R=a[13],L=a[14],S=a[15],e[12]=O*r+R*n+L*c+S*p,e[13]=O*o+R*d+L*m+S*E,e[14]=O*l+R*u+L*f+S*y,e[15]=O*s+R*i+L*P+S*A,e}function o(e,t,a){return e[0]=t[0]-a[0],e[1]=t[1]-a[1],e[2]=t[2]-a[2],e[3]=t[3]-a[3],e[4]=t[4]-a[4],e[5]=t[5]-a[5],e[6]=t[6]-a[6],e[7]=t[7]-a[7],e[8]=t[8]-a[8],e[9]=t[9]-a[9],e[10]=t[10]-a[10],e[11]=t[11]-a[11],e[12]=t[12]-a[12],e[13]=t[13]-a[13],e[14]=t[14]-a[14],e[15]=t[15]-a[15],e}var l=Math.tan;Object.defineProperty(t,'__esModule',{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new P.ARRAY_TYPE(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.clone=function(e){var t=new P.ARRAY_TYPE(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.fromValues=function(e,t,a,r,o,l,s,n,d,u,i,c,m,f,p,E){var y=new P.ARRAY_TYPE(16);return y[0]=e,y[1]=t,y[2]=a,y[3]=r,y[4]=o,y[5]=l,y[6]=s,y[7]=n,y[8]=d,y[9]=u,y[10]=i,y[11]=c,y[12]=m,y[13]=f,y[14]=p,y[15]=E,y},t.set=function(e,t,a,r,o,l,s,n,d,u,i,c,m,f,P,p,E){return e[0]=t,e[1]=a,e[2]=r,e[3]=o,e[4]=l,e[5]=s,e[6]=n,e[7]=d,e[8]=u,e[9]=i,e[10]=c,e[11]=m,e[12]=f,e[13]=P,e[14]=p,e[15]=E,e},t.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.transpose=function(e,t){if(e===t){var a=t[1],r=t[2],o=t[3],l=t[6],s=t[7],n=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=a,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=l,e[11]=t[14],e[12]=o,e[13]=s,e[14]=n}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},t.invert=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=t[4],n=t[5],d=t[6],u=t[7],i=t[8],c=t[9],m=t[10],f=t[11],P=t[12],p=t[13],E=t[14],y=t[15],A=a*n-r*s,O=a*d-o*s,R=a*u-l*s,L=r*d-o*n,S=r*u-l*n,_=o*u-l*d,N=i*p-c*P,I=i*E-m*P,Y=i*y-f*P,q=c*E-m*p,g=c*y-f*p,M=m*y-f*E,v=A*M-O*g+R*q+L*Y-S*I+_*N;return v?(v=1/v,e[0]=(n*M-d*g+u*q)*v,e[1]=(o*g-r*M-l*q)*v,e[2]=(p*_-E*S+y*L)*v,e[3]=(m*S-c*_-f*L)*v,e[4]=(d*Y-s*M-u*I)*v,e[5]=(a*M-o*Y+l*I)*v,e[6]=(E*R-P*_-y*O)*v,e[7]=(i*_-m*R+f*O)*v,e[8]=(s*g-n*Y+u*N)*v,e[9]=(r*Y-a*g-l*N)*v,e[10]=(P*S-p*R+y*A)*v,e[11]=(c*R-i*S-f*A)*v,e[12]=(n*I-s*q-d*N)*v,e[13]=(a*q-r*I+o*N)*v,e[14]=(p*O-P*L-E*A)*v,e[15]=(i*L-c*O+m*A)*v,e):null},t.adjoint=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=t[4],n=t[5],d=t[6],u=t[7],i=t[8],c=t[9],m=t[10],f=t[11],P=t[12],p=t[13],E=t[14],y=t[15];return e[0]=n*(m*y-f*E)-c*(d*y-u*E)+p*(d*f-u*m),e[1]=-(r*(m*y-f*E)-c*(o*y-l*E)+p*(o*f-l*m)),e[2]=r*(d*y-u*E)-n*(o*y-l*E)+p*(o*u-l*d),e[3]=-(r*(d*f-u*m)-n*(o*f-l*m)+c*(o*u-l*d)),e[4]=-(s*(m*y-f*E)-i*(d*y-u*E)+P*(d*f-u*m)),e[5]=a*(m*y-f*E)-i*(o*y-l*E)+P*(o*f-l*m),e[6]=-(a*(d*y-u*E)-s*(o*y-l*E)+P*(o*u-l*d)),e[7]=a*(d*f-u*m)-s*(o*f-l*m)+i*(o*u-l*d),e[8]=s*(c*y-f*p)-i*(n*y-u*p)+P*(n*f-u*c),e[9]=-(a*(c*y-f*p)-i*(r*y-l*p)+P*(r*f-l*c)),e[10]=a*(n*y-u*p)-s*(r*y-l*p)+P*(r*u-l*n),e[11]=-(a*(n*f-u*c)-s*(r*f-l*c)+i*(r*u-l*n)),e[12]=-(s*(c*E-m*p)-i*(n*E-d*p)+P*(n*m-d*c)),e[13]=a*(c*E-m*p)-i*(r*E-o*p)+P*(r*m-o*c),e[14]=-(a*(n*E-d*p)-s*(r*E-o*p)+P*(r*d-o*n)),e[15]=a*(n*m-d*c)-s*(r*m-o*c)+i*(r*d-o*n),e},t.determinant=function(e){var t=e[0],a=e[1],r=e[2],o=e[3],l=e[4],s=e[5],n=e[6],d=e[7],u=e[8],i=e[9],c=e[10],m=e[11],f=e[12],P=e[13],p=e[14],E=e[15];return(t*s-a*l)*(c*E-m*p)-(t*n-r*l)*(i*E-m*P)+(t*d-o*l)*(i*p-c*P)+(a*n-r*s)*(u*E-m*f)-(a*d-o*s)*(u*p-c*f)+(r*d-o*n)*(u*P-i*f)},t.multiply=r,t.translate=function(e,t,a){var r=a[0],o=a[1],l=a[2],s=void 0,n=void 0,d=void 0,u=void 0,i=void 0,c=void 0,m=void 0,f=void 0,P=void 0,p=void 0,E=void 0,y=void 0;return t===e?(e[12]=t[0]*r+t[4]*o+t[8]*l+t[12],e[13]=t[1]*r+t[5]*o+t[9]*l+t[13],e[14]=t[2]*r+t[6]*o+t[10]*l+t[14],e[15]=t[3]*r+t[7]*o+t[11]*l+t[15]):(s=t[0],n=t[1],d=t[2],u=t[3],i=t[4],c=t[5],m=t[6],f=t[7],P=t[8],p=t[9],E=t[10],y=t[11],e[0]=s,e[1]=n,e[2]=d,e[3]=u,e[4]=i,e[5]=c,e[6]=m,e[7]=f,e[8]=P,e[9]=p,e[10]=E,e[11]=y,e[12]=s*r+i*o+P*l+t[12],e[13]=n*r+c*o+p*l+t[13],e[14]=d*r+m*o+E*l+t[14],e[15]=u*r+f*o+y*l+t[15]),e},t.scale=function(e,t,a){var r=a[0],o=a[1],l=a[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*l,e[9]=t[9]*l,e[10]=t[10]*l,e[11]=t[11]*l,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.rotate=function(e,r,a,o){var l=o[0],i=o[1],f=o[2],p=n(l*l+i*i+f*f),E=void 0,s=void 0,c=void 0,t=void 0,y=void 0,A=void 0,O=void 0,R=void 0,L=void 0,S=void 0,_=void 0,N=void 0,I=void 0,Y=void 0,q=void 0,g=void 0,M=void 0,v=void 0,h=void 0,T=void 0,b=void 0,x=void 0,D=void 0,k=void 0;return m(p)<P.EPSILON?null:(p=1/p,l*=p,i*=p,f*=p,E=u(a),s=d(a),c=1-s,t=r[0],y=r[1],A=r[2],O=r[3],R=r[4],L=r[5],S=r[6],_=r[7],N=r[8],I=r[9],Y=r[10],q=r[11],g=l*l*c+s,M=i*l*c+f*E,v=f*l*c-i*E,h=l*i*c-f*E,T=i*i*c+s,b=f*i*c+l*E,x=l*f*c+i*E,D=i*f*c-l*E,k=f*f*c+s,e[0]=t*g+R*M+N*v,e[1]=y*g+L*M+I*v,e[2]=A*g+S*M+Y*v,e[3]=O*g+_*M+q*v,e[4]=t*h+R*T+N*b,e[5]=y*h+L*T+I*b,e[6]=A*h+S*T+Y*b,e[7]=O*h+_*T+q*b,e[8]=t*x+R*D+N*k,e[9]=y*x+L*D+I*k,e[10]=A*x+S*D+Y*k,e[11]=O*x+_*D+q*k,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)},t.rotateX=function(e,t,a){var r=u(a),o=d(a),l=t[4],s=t[5],n=t[6],i=t[7],c=t[8],m=t[9],f=t[10],P=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=l*o+c*r,e[5]=s*o+m*r,e[6]=n*o+f*r,e[7]=i*o+P*r,e[8]=c*o-l*r,e[9]=m*o-s*r,e[10]=f*o-n*r,e[11]=P*o-i*r,e},t.rotateY=function(e,t,a){var r=u(a),o=d(a),l=t[0],s=t[1],n=t[2],i=t[3],c=t[8],m=t[9],f=t[10],P=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=l*o-c*r,e[1]=s*o-m*r,e[2]=n*o-f*r,e[3]=i*o-P*r,e[8]=l*r+c*o,e[9]=s*r+m*o,e[10]=n*r+f*o,e[11]=i*r+P*o,e},t.rotateZ=function(e,t,a){var r=u(a),o=d(a),l=t[0],s=t[1],n=t[2],i=t[3],c=t[4],m=t[5],f=t[6],P=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=l*o+c*r,e[1]=s*o+m*r,e[2]=n*o+f*r,e[3]=i*o+P*r,e[4]=c*o-l*r,e[5]=m*o-s*r,e[6]=f*o-n*r,e[7]=P*o-i*r,e},t.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.fromRotation=function(e,a,r){var o=r[0],l=r[1],i=r[2],f=n(o*o+l*l+i*i),p=void 0,s=void 0,c=void 0;return m(f)<P.EPSILON?null:(f=1/f,o*=f,l*=f,i*=f,p=u(a),s=d(a),c=1-s,e[0]=o*o*c+s,e[1]=l*o*c+i*p,e[2]=i*o*c-l*p,e[3]=0,e[4]=o*l*c-i*p,e[5]=l*l*c+s,e[6]=i*l*c+o*p,e[7]=0,e[8]=o*i*c+l*p,e[9]=l*i*c-o*p,e[10]=i*i*c+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},t.fromXRotation=function(e,t){var a=u(t),r=d(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=a,e[7]=0,e[8]=0,e[9]=-a,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.fromYRotation=function(e,t){var a=u(t),r=d(t);return e[0]=r,e[1]=0,e[2]=-a,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=a,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.fromZRotation=function(e,t){var a=u(t),r=d(t);return e[0]=r,e[1]=a,e[2]=0,e[3]=0,e[4]=-a,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.fromRotationTranslation=function(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=r+r,d=o+o,u=l+l,i=r*n,c=r*d,m=r*u,f=o*d,P=o*u,p=l*u,E=s*n,y=s*d,A=s*u;return e[0]=1-(f+p),e[1]=c+A,e[2]=m-y,e[3]=0,e[4]=c-A,e[5]=1-(i+p),e[6]=P+E,e[7]=0,e[8]=m+y,e[9]=P-E,e[10]=1-(i+f),e[11]=0,e[12]=a[0],e[13]=a[1],e[14]=a[2],e[15]=1,e},t.getTranslation=function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},t.getScaling=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[4],s=t[5],d=t[6],u=t[8],i=t[9],c=t[10];return e[0]=n(a*a+r*r+o*o),e[1]=n(l*l+s*s+d*d),e[2]=n(u*u+i*i+c*c),e},t.getRotation=function(e,t){var a=t[0]+t[5]+t[10],r=0;return 0<a?(r=2*n(a+1),e[3]=.25*r,e[0]=(t[6]-t[9])/r,e[1]=(t[8]-t[2])/r,e[2]=(t[1]-t[4])/r):t[0]>t[5]&t[0]>t[10]?(r=2*n(1+t[0]-t[5]-t[10]),e[3]=(t[6]-t[9])/r,e[0]=.25*r,e[1]=(t[1]+t[4])/r,e[2]=(t[8]+t[2])/r):t[5]>t[10]?(r=2*n(1+t[5]-t[0]-t[10]),e[3]=(t[8]-t[2])/r,e[0]=(t[1]+t[4])/r,e[1]=.25*r,e[2]=(t[6]+t[9])/r):(r=2*n(1+t[10]-t[0]-t[5]),e[3]=(t[1]-t[4])/r,e[0]=(t[8]+t[2])/r,e[1]=(t[6]+t[9])/r,e[2]=.25*r),e},t.fromRotationTranslationScale=function(e,t,a,r){var o=t[0],l=t[1],s=t[2],n=t[3],d=o+o,u=l+l,i=s+s,c=o*d,m=o*u,f=o*i,P=l*u,p=l*i,E=s*i,y=n*d,A=n*u,O=n*i,R=r[0],L=r[1],S=r[2];return e[0]=(1-(P+E))*R,e[1]=(m+O)*R,e[2]=(f-A)*R,e[3]=0,e[4]=(m-O)*L,e[5]=(1-(c+E))*L,e[6]=(p+y)*L,e[7]=0,e[8]=(f+A)*S,e[9]=(p-y)*S,e[10]=(1-(c+P))*S,e[11]=0,e[12]=a[0],e[13]=a[1],e[14]=a[2],e[15]=1,e},t.fromRotationTranslationScaleOrigin=function(e,t,a,r,l){var o=t[0],s=t[1],n=t[2],d=t[3],u=o+o,i=s+s,c=n+n,m=o*u,f=o*i,P=o*c,p=s*i,E=s*c,y=n*c,A=d*u,O=d*i,R=d*c,L=r[0],S=r[1],_=r[2],N=l[0],I=l[1],Y=l[2];return e[0]=(1-(p+y))*L,e[1]=(f+R)*L,e[2]=(P-O)*L,e[3]=0,e[4]=(f-R)*S,e[5]=(1-(m+y))*S,e[6]=(E+A)*S,e[7]=0,e[8]=(P+O)*_,e[9]=(E-A)*_,e[10]=(1-(m+p))*_,e[11]=0,e[12]=a[0]+N-(e[0]*N+e[4]*I+e[8]*Y),e[13]=a[1]+I-(e[1]*N+e[5]*I+e[9]*Y),e[14]=a[2]+Y-(e[2]*N+e[6]*I+e[10]*Y),e[15]=1,e},t.fromQuat=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=a+a,n=r+r,d=o+o,u=a*s,i=r*s,c=r*n,m=o*s,f=o*n,P=o*d,p=l*s,E=l*n,y=l*d;return e[0]=1-c-P,e[1]=i+y,e[2]=m-E,e[3]=0,e[4]=i-y,e[5]=1-u-P,e[6]=f+p,e[7]=0,e[8]=m+E,e[9]=f-p,e[10]=1-u-c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.frustum=function(e,t,a,r,o,l,s){var n=1/(a-t),d=1/(o-r),u=1/(l-s);return e[0]=2*l*n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*l*d,e[6]=0,e[7]=0,e[8]=(a+t)*n,e[9]=(o+r)*d,e[10]=(s+l)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*(s*l)*u,e[15]=0,e},t.perspective=function(e,t,a,r,o){var s=1/l(t/2),n=1/(r-o);return e[0]=s/a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(o+r)*n,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*o*r*n,e[15]=0,e},t.perspectiveFromFieldOfView=function(e,t,a,r){var o=l(t.upDegrees*c/180),s=l(t.downDegrees*c/180),n=l(t.leftDegrees*c/180),d=l(t.rightDegrees*c/180),u=2/(n+d),i=2/(o+s);return e[0]=u,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=-(.5*((n-d)*u)),e[9]=.5*((o-s)*i),e[10]=r/(a-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*a/(a-r),e[15]=0,e},t.ortho=function(e,t,a,r,o,l,s){var n=1/(t-a),d=1/(r-o),u=1/(l-s);return e[0]=-2*n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+a)*n,e[13]=(o+r)*d,e[14]=(s+l)*u,e[15]=1,e},t.lookAt=function(e,t,a,r){var o=void 0,l=void 0,s=void 0,d=void 0,u=void 0,i=void 0,c=void 0,f=void 0,p=void 0,E=void 0,y=t[0],A=t[1],O=t[2],R=r[0],L=r[1],S=r[2],_=a[0],N=a[1],I=a[2];return m(y-_)<P.EPSILON&&m(A-N)<P.EPSILON&&m(O-I)<P.EPSILON?mat4.identity(e):(c=y-_,f=A-N,p=O-I,E=1/n(c*c+f*f+p*p),c*=E,f*=E,p*=E,o=L*p-S*f,l=S*c-R*p,s=R*f-L*c,E=n(o*o+l*l+s*s),E?(E=1/E,o*=E,l*=E,s*=E):(o=0,l=0,s=0),d=f*s-p*l,u=p*o-c*s,i=c*l-f*o,E=n(d*d+u*u+i*i),E?(E=1/E,d*=E,u*=E,i*=E):(d=0,u=0,i=0),e[0]=o,e[1]=d,e[2]=c,e[3]=0,e[4]=l,e[5]=u,e[6]=f,e[7]=0,e[8]=s,e[9]=i,e[10]=p,e[11]=0,e[12]=-(o*y+l*A+s*O),e[13]=-(d*y+u*A+i*O),e[14]=-(c*y+f*A+p*O),e[15]=1,e)},t.targetTo=function(e,t,a,r){var o=t[0],l=t[1],s=t[2],d=r[0],u=r[1],i=r[2],c=o-a[0],m=l-a[1],f=s-a[2],P=c*c+m*m+f*f;0<P&&(P=1/n(P),c*=P,m*=P,f*=P);var p=u*f-i*m,E=i*c-d*f,y=d*m-u*c;return e[0]=p,e[1]=E,e[2]=y,e[3]=0,e[4]=m*y-f*E,e[5]=f*p-c*y,e[6]=c*E-m*p,e[7]=0,e[8]=c,e[9]=m,e[10]=f,e[11]=0,e[12]=o,e[13]=l,e[14]=s,e[15]=1,e},t.str=function(e){return'mat4('+e[0]+', '+e[1]+', '+e[2]+', '+e[3]+', '+e[4]+', '+e[5]+', '+e[6]+', '+e[7]+', '+e[8]+', '+e[9]+', '+e[10]+', '+e[11]+', '+e[12]+', '+e[13]+', '+e[14]+', '+e[15]+')'},t.frob=function(e){return n(s(e[0],2)+s(e[1],2)+s(e[2],2)+s(e[3],2)+s(e[4],2)+s(e[5],2)+s(e[6],2)+s(e[7],2)+s(e[8],2)+s(e[9],2)+s(e[10],2)+s(e[11],2)+s(e[12],2)+s(e[13],2)+s(e[14],2)+s(e[15],2))},t.add=function(e,t,a){return e[0]=t[0]+a[0],e[1]=t[1]+a[1],e[2]=t[2]+a[2],e[3]=t[3]+a[3],e[4]=t[4]+a[4],e[5]=t[5]+a[5],e[6]=t[6]+a[6],e[7]=t[7]+a[7],e[8]=t[8]+a[8],e[9]=t[9]+a[9],e[10]=t[10]+a[10],e[11]=t[11]+a[11],e[12]=t[12]+a[12],e[13]=t[13]+a[13],e[14]=t[14]+a[14],e[15]=t[15]+a[15],e},t.subtract=o,t.multiplyScalar=function(e,t,a){return e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e[3]=t[3]*a,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12]*a,e[13]=t[13]*a,e[14]=t[14]*a,e[15]=t[15]*a,e},t.multiplyScalarAndAdd=function(e,t,a,r){return e[0]=t[0]+a[0]*r,e[1]=t[1]+a[1]*r,e[2]=t[2]+a[2]*r,e[3]=t[3]+a[3]*r,e[4]=t[4]+a[4]*r,e[5]=t[5]+a[5]*r,e[6]=t[6]+a[6]*r,e[7]=t[7]+a[7]*r,e[8]=t[8]+a[8]*r,e[9]=t[9]+a[9]*r,e[10]=t[10]+a[10]*r,e[11]=t[11]+a[11]*r,e[12]=t[12]+a[12]*r,e[13]=t[13]+a[13]*r,e[14]=t[14]+a[14]*r,e[15]=t[15]+a[15]*r,e},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},t.equals=function(e,t){var a=e[0],r=e[1],o=e[2],l=e[3],s=e[4],n=e[5],d=e[6],u=e[7],c=e[8],f=e[9],p=e[10],E=e[11],y=e[12],A=e[13],O=e[14],R=e[15],L=t[0],S=t[1],_=t[2],N=t[3],I=t[4],Y=t[5],q=t[6],g=t[7],M=t[8],v=t[9],h=t[10],T=t[11],b=t[12],x=t[13],D=t[14],k=t[15];return m(a-L)<=P.EPSILON*i(1,m(a),m(L))&&m(r-S)<=P.EPSILON*i(1,m(r),m(S))&&m(o-_)<=P.EPSILON*i(1,m(o),m(_))&&m(l-N)<=P.EPSILON*i(1,m(l),m(N))&&m(s-I)<=P.EPSILON*i(1,m(s),m(I))&&m(n-Y)<=P.EPSILON*i(1,m(n),m(Y))&&m(d-q)<=P.EPSILON*i(1,m(d),m(q))&&m(u-g)<=P.EPSILON*i(1,m(u),m(g))&&m(c-M)<=P.EPSILON*i(1,m(c),m(M))&&m(f-v)<=P.EPSILON*i(1,m(f),m(v))&&m(p-h)<=P.EPSILON*i(1,m(p),m(h))&&m(E-T)<=P.EPSILON*i(1,m(E),m(T))&&m(y-b)<=P.EPSILON*i(1,m(y),m(b))&&m(A-x)<=P.EPSILON*i(1,m(A),m(x))&&m(O-D)<=P.EPSILON*i(1,m(O),m(D))&&m(R-k)<=P.EPSILON*i(1,m(R),m(k))};var f=a(0),P=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(f);var p=t.mul=r,E=t.sub=o},function(t,a,r){'use strict';function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}function l(){var e=new E.ARRAY_TYPE(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function s(e,t,a){a*=.5;var r=u(a);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=d(a),e}function i(e,t,a){var r=t[0],o=t[1],l=t[2],s=t[3],n=a[0],d=a[1],u=a[2],i=a[3];return e[0]=r*i+s*n+o*u-l*d,e[1]=o*i+s*d+l*n-r*u,e[2]=l*i+s*u+r*d-o*n,e[3]=s*i-r*n-o*d-l*u,e}function f(r,o,a,l){var t=o[0],s=o[1],n=o[2],d=o[3],i=a[0],c=a[1],m=a[2],f=a[3],P=void 0,p=void 0,E=void 0,y=void 0,A=void 0;return p=t*i+s*c+n*m+d*f,0>p&&(p=-p,i=-i,c=-c,m=-m,f=-f),1e-6<1-p?(P=e(p),E=u(P),y=u((1-l)*P)/E,A=u(l*P)/E):(y=1-l,A=l),r[0]=y*t+A*i,r[1]=y*s+A*c,r[2]=y*n+A*m,r[3]=y*d+A*f,r}function P(e,t){var a=t[0]+t[4]+t[8],r=void 0;if(0<a)r=n(a+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var o=0;t[4]>t[0]&&(o=1),t[8]>t[3*o+o]&&(o=2);var l=(o+1)%3,s=(o+2)%3;r=n(t[3*o+o]-t[3*l+l]-t[3*s+s]+1),e[o]=.5*r,r=.5/r,e[3]=(t[3*l+s]-t[3*s+l])*r,e[l]=(t[3*l+o]+t[3*o+l])*r,e[s]=(t[3*s+o]+t[3*o+s])*r}return e}Object.defineProperty(a,'__esModule',{value:!0}),a.setAxes=a.sqlerp=a.rotationTo=a.equals=a.exactEquals=a.normalize=a.sqrLen=a.squaredLength=a.len=a.length=a.lerp=a.dot=a.scale=a.mul=a.add=a.set=a.copy=a.fromValues=a.clone=void 0,a.create=l,a.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},a.setAxisAngle=s,a.getAxisAngle=function(t,a){var r=2*e(a[3]),o=u(r/2);return 0==o?(t[0]=1,t[1]=0,t[2]=0):(t[0]=a[0]/o,t[1]=a[1]/o,t[2]=a[2]/o),r},a.multiply=i,a.rotateX=function(e,t,a){a*=.5;var r=t[0],o=t[1],l=t[2],s=t[3],n=u(a),i=d(a);return e[0]=r*i+s*n,e[1]=o*i+l*n,e[2]=l*i-o*n,e[3]=s*i-r*n,e},a.rotateY=function(e,t,a){a*=.5;var r=t[0],o=t[1],l=t[2],s=t[3],n=u(a),i=d(a);return e[0]=r*i-l*n,e[1]=o*i+s*n,e[2]=l*i+r*n,e[3]=s*i-o*n,e},a.rotateZ=function(e,t,a){a*=.5;var r=t[0],o=t[1],l=t[2],s=t[3],n=u(a),i=d(a);return e[0]=r*i+o*n,e[1]=o*i-r*n,e[2]=l*i+s*n,e[3]=s*i-l*n,e},a.calculateW=function(e,t){var a=t[0],r=t[1],o=t[2];return e[0]=a,e[1]=r,e[2]=o,e[3]=n(m(1-a*a-r*r-o*o)),e},a.slerp=f,a.invert=function(e,t){var a=t[0],r=t[1],o=t[2],l=t[3],s=a*a+r*r+o*o+l*l,n=s?1/s:0;return e[0]=-a*n,e[1]=-r*n,e[2]=-o*n,e[3]=l*n,e},a.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},a.fromMat3=P,a.fromEuler=function(e,t,a,r){var o=.5*c/180;t*=o,a*=o,r*=o;var l=u(t),s=d(t),n=u(a),i=d(a),m=u(r),f=d(r);return e[0]=l*i*f-s*n*m,e[1]=s*n*f+l*i*m,e[2]=s*i*m-l*n*f,e[3]=s*i*f+l*n*m,e},a.str=function(e){return'quat('+e[0]+', '+e[1]+', '+e[2]+', '+e[3]+')'};var p=r(0),E=o(p),y=r(1),A=o(y),O=r(2),R=o(O),L=r(3),S=o(L),_=a.clone=S.clone,N=a.fromValues=S.fromValues,I=a.copy=S.copy,Y=a.set=S.set,q=a.add=S.add,g=a.mul=i,M=a.scale=S.scale,v=a.dot=S.dot,h=a.lerp=S.lerp,T=a.length=S.length,b=a.len=T,x=a.squaredLength=S.squaredLength,D=a.sqrLen=x,k=a.normalize=S.normalize,w=a.exactEquals=S.exactEquals,V=a.equals=S.equals,j=a.rotationTo=function(){var e=R.create(),t=R.fromValues(1,0,0),r=R.fromValues(0,1,0);return function(o,l,a){var n=R.dot(l,a);return-.999999>n?(R.cross(e,t,l),1e-6>R.len(e)&&R.cross(e,r,l),R.normalize(e,e),s(o,e,Math.PI),o):.999999<n?(o[0]=0,o[1]=0,o[2]=0,o[3]=1,o):(R.cross(e,l,a),o[0]=e[0],o[1]=e[1],o[2]=e[2],o[3]=1+n,k(o,o))}}(),z=a.sqlerp=function(){var e=l(),r=l();return function(o,l,a,s,n,d){return f(e,l,n,d),f(r,a,s,d),f(o,e,r,2*d*(1-d)),o}}(),Q=a.setAxes=function(){var e=A.create();return function(t,a,r,o){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=o[0],e[4]=o[1],e[7]=o[2],e[2]=-a[0],e[5]=-a[1],e[8]=-a[2],k(t,P(t,e))}}()},function(e,a,s){'use strict';function f(){var e=new S.ARRAY_TYPE(2);return e[0]=0,e[1]=0,e}function P(e,t,a){return e[0]=t[0]-a[0],e[1]=t[1]-a[1],e}function p(e,t,a){return e[0]=t[0]*a[0],e[1]=t[1]*a[1],e}function E(e,t,a){return e[0]=t[0]/a[0],e[1]=t[1]/a[1],e}function y(e,t){var a=t[0]-e[0],r=t[1]-e[1];return n(a*a+r*r)}function A(e,t){var a=t[0]-e[0],r=t[1]-e[1];return a*a+r*r}function O(e){var t=e[0],a=e[1];return n(t*t+a*a)}function R(e){var t=e[0],a=e[1];return t*t+a*a}Object.defineProperty(a,'__esModule',{value:!0}),a.forEach=a.sqrLen=a.sqrDist=a.dist=a.div=a.mul=a.sub=a.len=void 0,a.create=f,a.clone=function(e){var t=new S.ARRAY_TYPE(2);return t[0]=e[0],t[1]=e[1],t},a.fromValues=function(e,t){var a=new S.ARRAY_TYPE(2);return a[0]=e,a[1]=t,a},a.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},a.set=function(e,t,a){return e[0]=t,e[1]=a,e},a.add=function(e,t,a){return e[0]=t[0]+a[0],e[1]=t[1]+a[1],e},a.subtract=P,a.multiply=p,a.divide=E,a.ceil=function(e,t){return e[0]=l(t[0]),e[1]=l(t[1]),e},a.floor=function(e,t){return e[0]=o(t[0]),e[1]=o(t[1]),e},a.min=function(e,t,a){return e[0]=r(t[0],a[0]),e[1]=r(t[1],a[1]),e},a.max=function(e,t,a){return e[0]=i(t[0],a[0]),e[1]=i(t[1],a[1]),e},a.round=function(e,r){return e[0]=t(r[0]),e[1]=t(r[1]),e},a.scale=function(e,t,a){return e[0]=t[0]*a,e[1]=t[1]*a,e},a.scaleAndAdd=function(e,t,a,r){return e[0]=t[0]+a[0]*r,e[1]=t[1]+a[1]*r,e},a.distance=y,a.squaredDistance=A,a.length=O,a.squaredLength=R,a.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},a.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},a.normalize=function(e,t){var a=t[0],r=t[1],o=a*a+r*r;return 0<o&&(o=1/n(o),e[0]=t[0]*o,e[1]=t[1]*o),e},a.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},a.cross=function(e,t,a){var r=t[0]*a[1]-t[1]*a[0];return e[0]=e[1]=0,e[2]=r,e},a.lerp=function(e,r,a,o){var t=r[0],l=r[1];return e[0]=t+o*(a[0]-t),e[1]=l+o*(a[1]-l),e},a.random=function(e,t){t=t||1;var a=2*S.RANDOM()*c;return e[0]=d(a)*t,e[1]=u(a)*t,e},a.transformMat2=function(e,t,a){var r=t[0],o=t[1];return e[0]=a[0]*r+a[2]*o,e[1]=a[1]*r+a[3]*o,e},a.transformMat2d=function(e,t,a){var r=t[0],o=t[1];return e[0]=a[0]*r+a[2]*o+a[4],e[1]=a[1]*r+a[3]*o+a[5],e},a.transformMat3=function(e,t,a){var r=t[0],o=t[1];return e[0]=a[0]*r+a[3]*o+a[6],e[1]=a[1]*r+a[4]*o+a[7],e},a.transformMat4=function(e,t,a){var r=t[0],o=t[1];return e[0]=a[0]*r+a[4]*o+a[12],e[1]=a[1]*r+a[5]*o+a[13],e},a.str=function(e){return'vec2('+e[0]+', '+e[1]+')'},a.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]},a.equals=function(e,t){var a=e[0],r=e[1],o=t[0],l=t[1];return m(a-o)<=S.EPSILON*i(1,m(a),m(o))&&m(r-l)<=S.EPSILON*i(1,m(r),m(l))};var L=s(0),S=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(L);var _=a.len=O,N=a.sub=P,I=a.mul=p,Y=a.div=E,q=a.dist=y,g=a.sqrDist=A,M=a.sqrLen=R,v=a.forEach=function(){var e=f();return function(t,a,o,s,n,d){var u,i;for(a||(a=2),o||(o=0),i=s?r(s*a+o,t.length):t.length,u=o;u<i;u+=a)e[0]=t[u],e[1]=t[u+1],n(e,e,d),t[u]=e[0],t[u+1]=e[1];return t}}()}])});
// c3/3rdparty/poly-decomp.js
"use strict";{function c(a,b,c){c=c||0;var d,e,f,g,h,j,k,l=[0,0];return d=a[1][1]-a[0][1],e=a[0][0]-a[1][0],f=d*a[0][0]+e*a[0][1],g=b[1][1]-b[0][1],h=b[0][0]-b[1][0],j=g*b[0][0]+h*b[0][1],k=d*h-g*e,v(k,0,c)||(l[0]=(h*f-e*j)/k,l[1]=(d*j-g*f)/k),l}function d(a,b,c,d){var e=b[0]-a[0],f=b[1]-a[1],g=d[0]-c[0],h=d[1]-c[1];if(0==g*f-h*e)return!1;var i=(e*(c[1]-a[1])+f*(a[0]-c[0]))/(g*f-h*e),j=(g*(a[1]-c[1])+h*(c[0]-a[0]))/(h*e-g*f);return 0<=i&&1>=i&&0<=j&&1>=j}function e(d,a,b){return(a[0]-d[0])*(b[1]-d[1])-(b[0]-d[0])*(a[1]-d[1])}function a(d,a,b){return 0<e(d,a,b)}function f(d,a,b){return 0<=e(d,a,b)}function b(d,a,b){return 0>e(d,a,b)}function g(d,a,b){return 0>=e(d,a,b)}function h(d,a,b,c){var f=Math.sqrt;if(!c)return 0===e(d,a,b);var g=tmpPoint1,h=tmpPoint2;g[0]=a[0]-d[0],g[1]=a[1]-d[1],h[0]=b[0]-a[0],h[1]=b[1]-a[1];var i=g[0]*h[0]+g[1]*h[1],j=f(g[0]*g[0]+g[1]*g[1]),k=f(h[0]*h[0]+h[1]*h[1]),l=Math.acos(i/(j*k));return l<c}function k(c,a){var b=a[0]-c[0],d=a[1]-c[1];return b*b+d*d}function l(a,b){var c=a.length;return a[0>b?b%c+c:b%c]}function m(a){a.length=0}function n(a,b,c,d){for(var e=c;e<d;e++)a.push(b[e])}function j(a){for(var b=[],c=a.length,d=0;d!==c;d++)b.push(a.pop());for(var d=0;d!==c;d++)a[d]=b[d]}function o(a,c){return b(l(a,c-1),l(a,c),l(a,c+1))}function p(d,e,a){var b,h,j=tmpLine1,m=tmpLine2;if(f(l(d,e+1),l(d,e),l(d,a))&&g(l(d,e-1),l(d,e),l(d,a)))return!1;h=k(l(d,e),l(d,a));for(var n=0;n!==d.length;++n)if((n+1)%d.length!==e&&n!==e&&f(l(d,e),l(d,a),l(d,n+1))&&g(l(d,e),l(d,a),l(d,n))&&(j[0]=l(d,e),j[1]=l(d,a),m[0]=l(d,n),m[1]=l(d,n+1),b=c(j,m),k(l(d,e),b)<h))return!1;return!0}function q(c,e,a){for(var b=0;b!==c.length;++b)if(b!==e&&b!==a&&(b+1)%c.length!==e&&(b+1)%c.length!==a&&d(l(c,e),l(c,a),l(c,b),l(c,b+1)))return!1;return!0}function r(a,b,c,d){var e=d||[];if(m(e),b<c)for(var f=b;f<=c;f++)e.push(a[f]);else{for(var f=0;f<=c;f++)e.push(a[f]);for(var f=b;f<a.length;f++)e.push(a[f])}return e}function s(a){for(var b=[],c=[],d=[],e=[],f=Number.MAX_VALUE,g=0;g<a.length;++g)if(o(a,g))for(var h=0;h<a.length;++h)if(p(a,g,h)){c=s(r(a,g,h,e)),d=s(r(a,h,g,e));for(var i=0;i<d.length;i++)c.push(d[i]);c.length<f&&(b=c,f=c.length,b.push([l(a,g),l(a,h)]))}return b}function i(a,b){if(0===b.length)return[a];if(b instanceof Array&&b.length&&b[0]instanceof Array&&2===b[0].length&&b[0][0]instanceof Array){for(var c,d=[a],e=0;e<b.length;e++){c=b[e];for(var f=0;f<d.length;f++){var g=d[f],h=i(g,c);if(h){d.splice(f,1),d.push(h[0],h[1]);break}}}return d}var c=b,e=a.indexOf(c[0]),f=a.indexOf(c[1]);return-1!==e&&-1!==f&&[r(a,e,f),r(a,f,e)]}function t(a,b,c,d,e){e=e||0;var f=b[1]-a[1],g=a[0]-b[0],h=f*a[0]+g*a[1],i=d[1]-c[1],j=c[0]-d[0],k=i*c[0]+j*c[1],l=f*j-i*g;return v(l,0,e)?[0,0]:[(j*h-g*k)/l,(f*k-i*h)/l]}function u(c,e,h,m,r,s,w){var x=Number.MAX_VALUE;s=s||100,w=w||0,r=r||25,e="undefined"==typeof e?[]:e,h=h||[],m=m||[];var y=[0,0],z=[0,0],A=[0,0],p=0,B=0,C=0,d=0,D=0,E=0,F=0,G=[],H=[],I=c,J=c;if(3>J.length)return e;if(w++,w>s)return console.warn("quickDecomp: max level ("+s+") reached."),e;for(var v=0;v<c.length;++v)if(o(I,v)){h.push(I[v]),p=B=x;for(var i=0;i<c.length;++i)a(l(I,v-1),l(I,v),l(I,i))&&g(l(I,v-1),l(I,v),l(I,i-1))&&(A=t(l(I,v-1),l(I,v),l(I,i),l(I,i-1)),b(l(I,v+1),l(I,v),A)&&(C=k(I[v],A),C<B&&(B=C,z=A,E=i))),a(l(I,v+1),l(I,v),l(I,i+1))&&g(l(I,v+1),l(I,v),l(I,i))&&(A=t(l(I,v+1),l(I,v),l(I,i),l(I,i+1)),a(l(I,v-1),l(I,v),A)&&(C=k(I[v],A),C<p&&(p=C,y=A,D=i)));if(E===(D+1)%c.length)A[0]=(z[0]+y[0])/2,A[1]=(z[1]+y[1])/2,m.push(A),v<D?(n(G,I,v,D+1),G.push(A),H.push(A),0!==E&&n(H,I,E,I.length),n(H,I,0,v+1)):(0!==v&&n(G,I,v,I.length),n(G,I,0,D+1),G.push(A),H.push(A),n(H,I,E,v+1));else{if(E>D&&(D+=c.length),d=x,D<E)return e;for(var i=E;i<=D;++i)f(l(I,v-1),l(I,v),l(I,i))&&g(l(I,v+1),l(I,v),l(I,i))&&(C=k(l(I,v),l(I,i)),C<d&&q(I,v,i)&&(d=C,F=i%c.length));v<F?(n(G,I,v,F+1),0!=F&&n(H,I,F,J.length),n(H,I,0,v+1)):(0!==v&&n(G,I,v,J.length),n(G,I,0,F+1),n(H,I,F,v+1))}return G.length<H.length?(u(G,e,h,m,r,s,w),u(H,e,h,m,r,s,w)):(u(H,e,h,m,r,s,w),u(G,e,h,m,r,s,w)),e}return e.push(c),e}function v(c,a,b){return b=b||0,Math.abs(c-a)<=b}function w(c,a,b){return v(c[0],a[0],b)&&v(c[1],a[1],b)}var tmpPoint1=[],tmpPoint2=[],tmpLine1=[],tmpLine2=[];self.polyDecomp={decomp:function(a){var b=s(a);return 0<b.length?i(a,b):[a]},quickDecomp:u,isSimple:function(a){var b,c=a;for(b=0;b<c.length-1;b++)for(var e=0;e<b-1;e++)if(d(c[b],c[b+1],c[e],c[e+1]))return!1;for(b=1;b<c.length-2;b++)if(d(c[0],c[c.length-1],c[b],c[b+1]))return!1;return!0},removeCollinearPoints:function(a,b){for(var c=0,d=a.length-1;3<a.length&&0<=d;--d)h(l(a,d-1),l(a,d),l(a,d+1),b)&&(a.splice(d%a.length,1),c++);return c},removeDuplicatePoints:function(a,b){for(var c,d=a.length-1;1<=d;--d){c=a[d];for(var e=d-1;0<=e;--e)if(w(c,a[e],b)){a.splice(d,1);continue}}},makeCCW:function(b){for(var c=0,d=b,e=1;e<b.length;++e)(d[e][1]<d[c][1]||d[e][1]===d[c][1]&&d[e][0]>d[c][0])&&(c=e);return!a(l(b,c-1),l(b,c),l(b,c+1))&&(j(b),!0)}}}
// c3/lib/c3.js
"use strict";{let a=!1,b=!1,c="dev";self.C3=class{constructor(){throw TypeError("static class can't be instantiated")}static SetReady(){a=!0}static IsReady(){return a}static SetAppStarted(){b=!0}static HasAppStarted(){return b}static SetBuildMode(a){c=a}static GetBuildMode(){return c}static IsReleaseBuild(){return"final"===c}},C3.isDebug=!1,C3.isDebugDefend=!1,C3.hardwareConcurrency=navigator.hardwareConcurrency||2}
// ../lib/queryParser.js
"use strict";C3.QueryParser=class{constructor(a){this._queryString=a,this._parameters=new Map,this._Parse()}_Parse(){let a=this._queryString;(a.startsWith("?")||a.startsWith("#"))&&(a=a.substr(1));const b=a.split("&");for(const a of b)this._ParseParameter(a)}_ParseParameter(a){if(a){if(!a.includes("="))return void this._parameters.set(a,null);const b=a.indexOf("="),c=decodeURIComponent(a.substring(0,b)),d=decodeURIComponent(a.substring(b+1));this._parameters.set(c,d)}}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){const b=this._parameters.get(a);return"undefined"==typeof b?null:b}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(a){this._queryString=a,this._parameters.clear(),this._Parse()}},C3.QueryString=new C3.QueryParser(location.search),C3.LocationHashString=new C3.QueryParser(location.hash),"dev"!==C3.QueryString.Get("mode")&&C3.SetBuildMode("final");
// ../lib/detect/detect.js
"use strict";{function a(a,b,c){if(!0===b){c();o.set(a,!0)}else if(b&&b.length){c(b[0]);o.set(a,!0)}else;}const b=navigator.userAgent;let c={linux:/linux|openbsd|freebsd|netbsd/i.test(b),chromeOS:/CrOS/.test(b),windowsTizen:/trident|iemobile|msie|tizen/i.test(b),genericMS:/trident|iemobile|msie|edge\//i.test(b),opera:/OPR\//.test(b),blackberry:/bb10/i.test(b),edge:/edge\//i.test(b),trident:/trident/i.test(b),webkit:/webkit/i.test(b),safari:/safari\//i.test(b),chrome:/chrome\//i.test(b),chromium:/chromium\//i.test(b),crosswalk:/crosswalk|xwalk/i.test(b),nwjs:/nwjs/i.test(b),amazonwebapp:/amazonwebappplatform/i.test(b),webview:/wv\)/.test(b),android:/android/i.test(b),nokia:/nokiabrowser\/[0-9.]+/i.test(b)},d={windows:/windows\s+nt\s+\d+\.\d+/i.exec(b),OSX:/mac\s+os\s+x\s+[0-9_]+/i.exec(b),android:/android\s+[0-9.]+/i.exec(b),opera:/OPR\/[0-9.]+/.exec(b),tizen:/tizen\s+[0-9.]+/i.exec(b),iphone:/iphone\s+os\s+[0-9_]+/i.exec(b),ipad:/ipad[^)]*os\s+[0-9_]+/i.exec(b),winPhone:/windows\s+phone\s+[0-9.]+/i.exec(b),winPhoneOS:/windows\s+phone\s+os\s+[0-9.]+/i.exec(b),chrome:/chrome\/[0-9.]+/i.exec(b),chromium:/chromium\/[0-9.]+/i.exec(b),nwjs:/nwjs\/[0-9.]+/i.exec(b),firefox:/firefox\/[0-9.]+/i.exec(b),ie:/msie\s+[0-9.]+/i.exec(b),edge:/edge\/[0-9.]+/i.exec(b),edgeChromium:/edg\/[0-9.]+/i.exec(b),silk:/silk\/[0-9.]+/i.exec(b)},e="(unknown)",f="(unknown)",g="(unknown)",h="(unknown)",i="(unknown)",j="(unknown)",k="(unknown)",l="browser",m=!1,n=!1,o=new Map;a("isWindows",d.windows,(a)=>{e="Windows";const b=a.split(" ")[2];b&&("5.0"===b?f="2000":"5.1"===b?f="XP":"5.2"===b?f="XP":"6.0"===b?f="Vista":"6.1"===b?f="7":"6.2"===b?f="8":"6.3"===b?f="8.1":"10.0"===b?f="10":void 0)}),a("isOSX",d.OSX,(a)=>{e="Mac OS X";const b=a.split(" ")[3];b&&(f=b.replace("_","."))}),a("isLinux",c.linux,()=>{e="Linux"}),a("isChromeOS",c.chromeOS,()=>{e="Chrome OS"}),a("isAndroid",!c.windowsTizen&&d.android,(a)=>{e="Android";const b=a.split(" ")[1];b&&(f=b)}),a("isTizen",d.tizen,(a)=>{e="Tizen";const b=a.split(" ")[1];b&&(f=b)}),a("isIPhone",!c.windowsTizen&&d.iphone,(a)=>{e="iOS";const b=a.split(" ")[2];b&&(f=b.replace("_","."))}),a("isIPad",!c.windowsTizen&&d.ipad,(a)=>{e="iOS";const b=a.split(" ")[3];b&&(f=b.replace("_","."))}),a("isWindowsPhone",d.winPhone,(a)=>{e="Windows Phone";const b=a.split(" ")[2];b&&(f=b)}),a("isWindowsPhoneOS",d.winPhoneOS,(a)=>{e="Windows Phone";const b=a.split(" ")[3];b&&(f=b)}),a("isBlackberry",c.blackberry,()=>{e="Blackberry",f="10",h="stock",k="webkit"}),a("isChrome",!c.edge&&!c.opera&&d.chrome,(a)=>{h="Chrome",k="Chromium";const b=a.split("/")[1];b&&(i=b)}),a("isOpera",d.opera,(a)=>{h="Opera",k="Chromium";const b=a.split("/")[1];b&&(i=b)}),a("isChromium",d.chromium,(a)=>{h="Chromium",k="Chromium";const b=a.split("/")[1];b&&(i=b)}),a("isFirefox",d.firefox,(a)=>{h="Firefox",k="Gecko";const b=a.split("/")[1];b&&(i=b)}),a("isInternetExplorer",d.ie,(a)=>{h="Internet Explorer",k="Trident";const b=a.split(" ")[1];b&&(i=b)}),a("isTrident","Internet Explorer"!=h&&c.trident,()=>{k="Trident";const a=/rv:[0-9.]+/i.exec(b);if(a&&a.length){h="Internet Explorer";const b=a[0].split(":")[1];b&&(i=b)}}),a("isEdge",d.edge,(a)=>{h="Edge",k="Edge";const b=a.split("/")[1];b&&(i=b)}),a("isEdgeChromium",d.edgeChromium,(a)=>{h="Edge",k="Chromium";const b=a.split("/")[1];b&&(i=b)}),a("isSafari",c.safari&&!c.nokia&&!c.chrome&&!c.chromium&&!c.genericIE&&!c.blackberry,()=>{h="Safari",k="WebKit";const a=/version\/[0-9.]+/i.exec(b),c=/crios\/[0-9.]+/i.exec(b),d=/fxios\/[0-9.]+/i.exec(b);if(a&&a.length){const b=a[0].split("/")[1];b&&(i=b)}if(c&&c.length){h="Chrome for iOS";const a=c[0].split("/")[1];a&&(i=a)}if(d&&d.length){h="Firefox for iOS";const a=d[0].split("/")[1];a&&(i=a)}}),a("isSilk",d.silk,(a)=>{h="Silk";const b=a.split("/")[1];b&&(i=b)}),a("isCrosswalk",c.crosswalk,()=>l="crosswalk"),a("isCordova",self["device"]&&(self["device"]["cordova"]||self["device"]["phonegap"]),()=>l="cordova"),a("isNWJS",d.nwjs,(a)=>{l="nwjs",h="NW.js",k="Chromium";const b=a.split("/")[1];b&&(i=b)}),a("isAmazonWebApp",c.amazonwebapp,()=>l="webapp"),a("isHomeScreenWebApp","nwjs"!=l&&"undefined"!=typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator["standalone"]),()=>l="webapp"),a("isFalseSafari","Safari"==h&&("Android"==e||"Tizen"==e||"Blackberry"==e),()=>h="stock"),a("isAndroidWebview","Chrome"==h&&"browser"==l&&c.webview,()=>l="webview"),a("isFirefoxOS","Firefox"==h&&e=="(unknown)",()=>e="Firefox OS"),a("isAndroidFallback",e=="(unknown)"&&!c.windowsTizen&&c.android,()=>e="Android"),a("isTridentFallback",e=="(unknown)"&&c.trident,()=>k="Trident"),a("isWebkitFallback",e=="(unknown)"&&c.webkit,()=>k="WebKit"),a("is64Bit",((a)=>a.test(b)||a.test(navigator.platform)||"x64"===navigator.cpuClass)(/x86_64|x86-64|win64|x64;|x64\)|x64_|amd64|wow64|ia64|arm64|arch64|sparc64|ppc64|irix64/i),()=>g="64-bit"),a("is32Bit",((a)=>a.test(b)||a.test(navigator.platform)||"x86"===navigator.cpuClass)(/x86;|x86\)|i86|i386|i486|i586|i686|armv1|armv2|armv3|armv4|armv5|armv6|armv7/i),()=>g="32-bit"),a("is64BitFallback",g=="(unknown)"&&"Mac OS X"==e&&10.7<=parseFloat(f),()=>g="64-bit"),a("is32BitFallback",g=="(unknown)"&&"Windows"==e||"Android"==e&&5>parseFloat(f),()=>g="32-bit"),a("is32BitBrowser","32-bit"==g||/wow64/i.test(b),()=>j="32-bit"),a("is64BitBrowser",/win64/i.test(b),()=>j="64-bit"),a("isDesktop",(()=>"Windows"==e||"Mac OS X"==e||"Linux"==e||"Chrome OS"==e||"nwjs"==l)(),()=>m=!0),"Edge"==k&&"undefined"!=typeof Windows&&"undefined"!=typeof Windows["System"]&&(l="windows-store"),n="nwjs"==l;const p="Mac OS X"==e&&navigator["maxTouchPoints"]&&2<navigator["maxTouchPoints"];p&&(e="iOS",f=i,m=!1,n=!1),C3.Platform={OS:e,OSVersion:f,OSArchitecture:g,Browser:h,BrowserVersion:i,BrowserVersionNumber:parseFloat(i),BrowserArchitecture:j,BrowserEngine:k,Context:l,IsDesktop:m,IsMobile:!m,IsDesktopApp:n,IsChromeWebStore:!!(self["chrome"]&&self["chrome"]["runtime"]&&self["chrome"]["runtime"]["id"]),IsAppleOS:"Mac OS X"==e||"iOS"==e,IsIpadOS:p}}
// ../lib/storage/kvStorage.js
"use strict";{function a(a){return new Promise((b,c)=>{a.onsuccess=()=>b(a.result),a.onerror=()=>c(a.error)})}function b(a){return new Promise((b,c)=>{a.oncomplete=()=>b(),a.onerror=()=>c(a.error),a.onabort=()=>c(a.error)})}function c(a,b){return e(a,b)}function d(a,b){return e(a,b,!0)}async function e(a,b,c=!1,d=!0){const g=await f(a);try{const a=g.transaction([k],c?"readwrite":"readonly");return b(a)}catch(f){if(d&&"InvalidStateError"===f["name"])return l.delete(a),e(a,b,c,!1);throw f}}function f(a){h(a);let b=l.get(a);return b instanceof Promise||(b=g(a),l.set(a,b),b.catch(()=>l.delete(a))),b}async function g(b){h(b);const c=indexedDB.open(b,j);return c.addEventListener("upgradeneeded",(a)=>{try{const b=a.target.result;b.createObjectStore(k)}catch(a){console.error(`Failed to create objectstore for database ${b}`,a)}}),a(c)}function h(a){if("string"!=typeof a)throw new TypeError("expected string")}function i(a,b){const c=a.objectStore(k).openCursor();return new Promise((a)=>{const d=[];c.onsuccess=(c)=>{const e=c.target.result;e?("entries"===b?d.push([e.key,e.value]):"keys"===b?d.push(e.key):"values"===b?d.push(e.value):void 0,e.continue()):a(d)}})}const j=2,k="keyvaluepairs",l=new Map,m="undefined"!=typeof IDBObjectStore&&"function"==typeof IDBObjectStore.prototype.getAll,n="undefined"!=typeof IDBObjectStore&&"function"==typeof IDBObjectStore.prototype.getAllKeys;self.KVStorageContainer=class{constructor(a){h(a),this.name=a}async ready(){await f(this.name)}set(c,e){return h(c),d(this.name,async(d)=>{const f=d.objectStore("keyvaluepairs").put(e,c),g=a(f),h=b(d);await Promise.all([h,g])})}get(d){return h(d),c(this.name,async(c)=>{const e=c.objectStore("keyvaluepairs").get(d),f=a(e),g=b(c),[h,i]=await Promise.all([g,f]);return i})}delete(c){return h(c),d(this.name,async(d)=>{const e=d.objectStore("keyvaluepairs").delete(c),f=a(e),g=b(d);await Promise.all([g,f])})}clear(){return d(this.name,async(c)=>{const d=c.objectStore("keyvaluepairs").clear(),e=a(d),f=b(c);await Promise.all([f,e])})}keys(){return c(this.name,async(c)=>{let d;if(n){const b=c.objectStore("keyvaluepairs").getAllKeys();d=a(b)}else d=i(c,"keys");const e=b(c),[f,g]=await Promise.all([e,d]);return g})}values(){return c(this.name,async(c)=>{let d;if(m){const b=c.objectStore("keyvaluepairs").getAll();d=a(b)}else d=i(c,"values");const e=b(c),[f,g]=await Promise.all([e,d]);return g})}entries(){return c(this.name,async(a)=>{const c=i(a,"entries"),d=b(a),[e,f]=await Promise.all([d,c]);return f})}}}
// ../lib/storage/localForageAdaptor.js
"use strict";{function a(a){throw new Error(`"${a}" is not implemented`)}function b(a){if("function"==typeof a)throw new Error(`localforage callback API is not implemented; please use the promise API instead`)}function c(a){return"object"==typeof a?new Promise((b)=>{const{port1:c,port2:d}=new MessageChannel;d.onmessage=(a)=>b(a.data),c.postMessage(a)}):Promise.resolve(a)}const d=[/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],e=new WeakMap;let f=!1;"undefined"==typeof indexedDB&&(f=!0,console.warn("Unable to use local storage because indexedDB is not defined"));class g{constructor(a){this._inst=a,e.set(this,new Map)}_MaybeSwitchToMemoryFallback(a){if(!f)for(const b of d)if(a&&b.test(a.message)){console.error("Unable to use local storage, reverting to in-memory store: ",a,a.message),f=!0;break}}async _getItemFallback(a){const b=e.get(this).get(a),d=await c(b);return"undefined"==typeof d?null:d}async _setItemFallback(a,b){b=await c(b),e.get(this).set(a,b)}_removeItemFallback(a){e.get(this).delete(a)}_clearFallback(){e.get(this).clear()}_keysFallback(){return Array.from(e.get(this).keys())}IsUsingFallback(){return f}async getItem(a,c){if(b(c),f)return await this._getItemFallback(a);let d;try{d=await this._inst.get(a)}catch(b){return this._MaybeSwitchToMemoryFallback(b),f?await this._getItemFallback(a):(console.error(`Error reading '${a}' from storage, returning null: `,b),null)}return"undefined"==typeof d?null:d}async setItem(a,c,d){if(b(d),"undefined"==typeof c&&(c=null),f)return void(await this._setItemFallback(a,c));try{await this._inst.set(a,c)}catch(b){if(this._MaybeSwitchToMemoryFallback(b),f)await this._setItemFallback(a,c);else throw b}}async removeItem(a,c){if(b(c),f)return void this._removeItemFallback(a);try{await this._inst.delete(a)}catch(b){this._MaybeSwitchToMemoryFallback(b),f?this._removeItemFallback(a):console.error(`Error removing '${a}' from storage: `,b)}}async clear(a){if(b(a),f)return void this._clearFallback();try{await this._inst.clear()}catch(a){this._MaybeSwitchToMemoryFallback(a),f?this._clearFallback():console.error(`Error clearing storage: `,a)}}async keys(a){if(b(a),f)return this._keysFallback();let c=[];try{c=await this._inst.keys()}catch(a){if(this._MaybeSwitchToMemoryFallback(a),f)return this._keysFallback();console.error(`Error getting storage keys: `,a)}return c}ready(a){return b(a),f?Promise.resolve(!0):this._inst.ready()}createInstance(a){if("object"!=typeof a)throw new TypeError("invalid options object");const b=a["name"];if("string"!=typeof b)throw new TypeError("invalid store name");const c=new KVStorageContainer(b);return new g(c)}length(){a("localforage.length()")}key(){a("localforage.key()")}iterate(){a("localforage.iterate()")}setDriver(){a("localforage.setDriver()")}config(){a("localforage.config()")}defineDriver(){a("localforage.defineDriver()")}driver(){a("localforage.driver()")}supports(){a("localforage.supports()")}dropInstance(){a("localforage.dropInstance()")}disableMemoryMode(){f=!1}}self.localforage=new g(new KVStorageContainer("localforage"))}
// ../lib/misc/supports.js
"use strict";{if(C3.Supports={},C3.Supports.WebAnimations=(()=>{try{if("Safari"===C3.Platform.Browser)return!1;if("undefined"==typeof document)return!1;const a=document.createElement("div");if("undefined"==typeof a.animate)return!1;const b=a.animate([{opacity:"0"},{opacity:"1"}],1e3);return"undefined"!=typeof b.reverse}catch(a){return!1}})(),C3.Supports.DialogElement="undefined"!=typeof HTMLDialogElement,C3.Supports.RequestIdleCallback=!!self.requestIdleCallback,C3.Supports.ImageBitmap=!!self.createImageBitmap,C3.Supports.ImageBitmapOptions=!1,C3.Supports.ImageBitmap)try{self.createImageBitmap(new ImageData(32,32),{premultiplyAlpha:"none"}).then(()=>{C3.Supports.ImageBitmapOptions=!0}).catch(()=>{C3.Supports.ImageBitmapOptions=!1})}catch(a){C3.Supports.ImageBitmapOptions=!1}C3.Supports.ClipboardReadText=!!(navigator["clipboard"]&&navigator["clipboard"]["readText"]&&"Firefox"!==C3.Platform.Browser),C3.Supports.Proxies="undefined"!=typeof Proxy,C3.Supports.DownloadAttribute=(()=>{if("undefined"==typeof document)return!1;const b=document.createElement("a");return"undefined"!=typeof b.download})(),C3.Supports.CanvasToBlob=(()=>"undefined"!=typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)(),C3.Supports.CSSElement="undefined"!=typeof CSS&&CSS.supports("background","element(#test)"),C3.Supports.Fetch="function"==typeof fetch,C3.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==C3.Platform.Browser&&navigator["storage"]&&navigator["storage"]["persist"]),C3.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&navigator["storage"]&&navigator["storage"]["estimate"]),C3.Supports.Fullscreen=(()=>{if("undefined"==typeof document)return!1;if("iOS"===C3.Platform.OS)return!1;const a=document.documentElement;return!!(a.requestFullscreen||a.msRequestFullscreen||a.mozRequestFullScreen||a.webkitRequestFullscreen)})();const a=[{name:"A",value:12},{name:"B",value:13},{name:"C",value:13},{name:"D",value:13},{name:"E",value:13},{name:"F",value:13},{name:"G",value:14},{name:"H",value:12},{name:"I",value:12},{name:"J",value:13},{name:"K",value:14}],b=Math.ceil(496/a.length),c=(b+"").length,d=[];for(const e of a)for(let a=0;a<=b;a++)d.push({name:e.name+(a+"")["padStart"](c,"0"),value:e.value});d.sort((c,a)=>a.value-c.value);const e=d.reduce((a,b)=>{const c=b.name.slice(0,1),d=a.slice(-1);return d===c?a:a+c},"");C3.Supports.ArraySortProbablyStable="GKBCDEFJAHI"===e}
// ../lib/misc/polyfills.js
"use strict";{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,"")}}if(Array.prototype.values||(Array.prototype.values=function*(){for(const a of this)yield a}),!Array.prototype.flat){function a(b,c){return b.reduce((b,d)=>0<c&&Array.isArray(d)?(Array.prototype.push.apply(b,a(d,c-1)),b):(b.push(d),b),[])}Array.prototype.flat=function(b=1){return a(this,b)}}RegExp.escape||(RegExp.escape=function(a){return(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"]((b,c)=>a({"usage":b,"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}}});if("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,c=-1,d=new Uint8Array(3*b),e=0,f=0,g=0;g!==b;){if(e=a.charCodeAt(g),g+=1,55296<=e&&56319>=e){if(g===b){d[c+=1]=239,d[c+=1]=191,d[c+=1]=189;break}if(f=a.charCodeAt(g),!(56320<=f&&57343>=f)){d[c+=1]=239,d[c+=1]=191,d[c+=1]=189;continue}else if(e=1024*(e-55296)+f-56320+65536,g+=1,65535<e){d[c+=1]=240|e>>>18,d[c+=1]=128|63&e>>>12,d[c+=1]=128|63&e>>>6,d[c+=1]=128|63&e;continue}}127>=e?d[c+=1]=0|e:2047>=e?(d[c+=1]=192|e>>>6,d[c+=1]=128|63&e):(d[c+=1]=224|e>>>12,d[c+=1]=128|63&e>>>6,d[c+=1]=128|63&e)}return new Uint8Array(d.buffer.slice(0,c+1))}toString(){return"[object TextEncoder]"}},TextEncoder[Symbol.toStringTag]="TextEncoder"),"undefined"==typeof TextDecoder){function a(a){const b=a[Symbol.iterator]();return{next:()=>b.next(),[Symbol.iterator](){return this}}}function b(a){const b=a.next();if(b.done)throw new Error("unexpected end of input");if(0!=(128^192&b.value))throw new Error("invalid byte");return 63&b.value}const c=new Map;c.set("utf-8",(c,d)=>{let e;if(c.buffer)e=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);else if(e instanceof ArrayBuffer)e=new Uint8Array(c);else throw new Error("Invalid parameter");const f=a(e),g=[];try{for(const a of f){let c;if(127>a)c=127&a;else if(223>a)c=(31&a)<<6|b(f);else if(239>a)c=(15&a)<<12|b(f)<<6|b(f);else if(247>a)c=(7&a)<<18|b(f)<<12|b(f)<<6|b(f);else throw new Error("Invalid character");g.push(String.fromCodePoint(c))}}catch(a){if(d)throw a;g.push("\uFFFD")}return g.join("")}),c.set("utf8",c.get("utf-8")),c.set("utf-16le",()=>{throw new Error("utf-16le decoder not implemented")}),self.TextDecoder=class{constructor(a="utf-8",b={}){const d=c.get(a);if(!d)throw new Error(`TextDecoder polyfill does not support "${a}"`);Object.defineProperty(this,"fatal",{"value":!0===b["fatal"],"writable":!1}),Object.defineProperty(this,"_decoder",{"value":d,"writable":!1}),Object.defineProperty(this,"encoding",{"value":a,"writable":!1})}decode(a){return this["_decoder"](a,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)}
// c3/lib/misc/assert.js
"use strict";{function a(a){let b=C3.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+b)}self.assert=function(b,c){b||a(c)}}
// ../lib/misc/typeChecks.js
"use strict";{C3.IsNumber=function(a){return"number"==typeof a},C3.IsFiniteNumber=function(a){return C3.IsNumber(a)&&isFinite(a)},C3.RequireNumber=function(a){if(!C3.IsNumber(a))throw new TypeError("expected number")},C3.RequireOptionalNumber=function(a){C3.IsNullOrUndefined(a)},C3.RequireNumberInRange=function(a,b,c){if(!C3.IsNumber(a)||isNaN(a)||b>a||c<a)throw new RangeError("number outside of range")},C3.RequireAllNumber=function(...b){for(let c of b);},C3.RequireFiniteNumber=function(a){if(!C3.IsFiniteNumber(a))throw new TypeError("expected finite number")},C3.RequireOptionalFiniteNumber=function(a){C3.IsNullOrUndefined(a)},C3.RequireAllFiniteNumber=function(...b){for(let c of b);},C3.IsString=function(a){return"string"==typeof a},C3.RequireString=function(a){if(!C3.IsString(a))throw new TypeError("expected string")},C3.RequireOptionalString=function(a){C3.IsNullOrUndefined(a)},C3.RequireAllString=function(...b){for(let c of b);},C3.IsSimpleObject=function(a){if("object"!=typeof a||null===a)return!1;let b=Object.getPrototypeOf(a);return b?b.constructor===Object:null===b},C3.RequireSimpleObject=function(a){if(!C3.IsSimpleObject(a))throw new TypeError("expected simple object")},C3.RequireOptionalSimpleObject=function(a){if(!C3.IsNullOrUndefined(a)&&!C3.IsSimpleObject(a))throw new TypeError("expected simple object")},C3.IsObject=function(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)},C3.RequireObject=function(a){if(!C3.IsObject(a))throw new TypeError("expected object")},C3.RequireOptionalObject=function(a){C3.IsNullOrUndefined(a)},C3.RequireAllObject=function(...b){for(let c of b);},C3.IsFileLike=function(a){return C3.IsInstanceOf(a,Blob)&&"string"==typeof a["name"]},C3.RequireFileLike=function(a){if(!C3.IsFileLike(a))throw new TypeError("expected file")},C3.RequireOptionalFileLike=function(a){C3.IsNullOrUndefined(a)},C3.IsArray=function(a){return Array.isArray(a)},C3.RequireArray=function(a){if(!C3.IsArray(a))throw new TypeError("expected array")},C3.RequireOptionalArray=function(a){C3.IsNullOrUndefined(a)},C3.RequireAllArray=function(...b){for(let c of b);},C3.Is2DArray=function(a){return!!C3.IsArray(a)&&(!a.length||!!C3.IsArray(a[0]))},C3.Require2DArray=function(a){if(!C3.Is2DArray(a))throw new TypeError("expected 2d array");for(let b of a)if(!C3.IsArray(b))throw new TypeError("expected 2d array")},C3.RequireOptional2DArray=function(a){C3.IsNullOrUndefined(a)},C3.IsFunction=function(a){return"function"==typeof a},C3.RequireFunction=function(a,b){if(!C3.IsFunction(a))throw new TypeError("expected function");if(!C3.IsNullOrUndefined(b)&&a!==b)throw new TypeError("expected same function reference")},C3.RequireOptionalFunction=function(a){C3.IsNullOrUndefined(a)},C3.RequireAllFunction=function(...b){for(let c of b);},C3.RequireAnyFunction=function(b,...c){if(!C3.IsFunction(b))throw new TypeError("expected function");if(!c.length)throw new Error("missing comparison functions");for(let d of c)if(!C3.IsNullOrUndefined(d)&&b===d)return;throw new TypeError("expected same function reference")},C3.RequireOptionalAllFunction=function(...b){if(!C3.IsNullOrUndefined(b))for(let c of b);},C3.IsInstanceOf=function(a,b){return a instanceof b},C3.IsInstanceOfAny=function(a,...b){for(let c of b)if(C3.IsInstanceOf(a,c))return!0;return!1},C3.RequireInstanceOf=function(a,b){if(!C3.IsInstanceOf(a,b))throw new TypeError("unexpected type")},C3.RequireOptionalInstanceOf=function(a){C3.IsNullOrUndefined(a)},C3.RequireAllInstanceOf=function(a,...b){for(let c of b);},C3.RequireAnyInstanceOf=function(a,...b){if(!C3.IsInstanceOfAny(a,...b))throw new TypeError("unexpected type")},C3.RequireAnyOptionalInstanceOf=function(a,...b){if(!C3.IsNullOrUndefined(a)&&!C3.IsInstanceOfAny(a,...b))throw new TypeError("unexpected type")},C3.IsArrayOf=function(a,b){for(let c of a)if(!C3.IsInstanceOf(c,b))return!1;return!0},C3.IsArrayOfFiniteNumbers=function(a){for(let b of a)if(!C3.IsFiniteNumber(b))return!1;return!0},C3.RequireArrayOf=function(a){for(let b of a);},C3.RequireOptionalArrayOf=function(a){if(!C3.IsNullOrUndefined(a))for(let b of a);},C3.RequireArrayOfAny=function(a,...b){for(let c of a);},C3.RequireOptionalArrayOfAny=function(a,...b){if(!C3.IsNullOrUndefined(a))for(let b of a);},C3.IsDOMNode=function(a,b){return!C3.IsNullOrUndefined(a)&&C3.IsString(a.nodeName)&&(!b||C3.equalsNoCase(a.nodeName,b))},C3.RequireDOMNode=function(a,b){if(C3.IsNullOrUndefined(a)||!C3.IsString(a.nodeName))throw new TypeError("expected DOM node");if(b&&!C3.equalsNoCase(a.nodeName,b))throw new TypeError(`expected DOM '${b}' node`)},C3.RequireOptionalDOMNode=function(a){C3.IsNullOrUndefined(a)},C3.IsHTMLElement=function(a,b){return!C3.IsNullOrUndefined(a)&&C3.IsString(a.tagName)&&(!b||C3.equalsNoCase(a.tagName,b))},C3.RequireHTMLElement=function(a,b){if(C3.IsNullOrUndefined(a)||!C3.IsString(a.tagName))throw new TypeError("expected HTML element");if(b&&!C3.equalsNoCase(a.tagName,b))throw new TypeError(`expected HTML '${b}' element`)},C3.RequireOptionalHTMLElement=function(a){C3.IsNullOrUndefined(a)},C3.IsDrawable=function(a){return C3.IsHTMLElement(a,"img")||C3.IsHTMLElement(a,"canvas")||C3.IsHTMLElement(a,"video")||"undefined"!=typeof OffscreenCanvas&&a instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&a instanceof ImageBitmap},C3.RequireDrawable=function(a){if(!C3.IsDrawable(a))throw new TypeError("expected drawable")},C3.RequireOptionalDrawable=function(a){C3.IsNullOrUndefined(a)},C3.IsDrawableOrImageData=function(a){return!!(a instanceof ImageData)||C3.IsDrawable(a)},C3.RequireDrawableOrImageData=function(a){if(!C3.IsDrawableOrImageData(a))throw new TypeError("expected drawable or image data")},C3.RequireOptionalDrawableOrImageData=function(a){if(!C3.IsNullOrUndefined(a)&&!C3.IsDrawableOrImageData(a))throw new TypeError("expected drawable or image data")},C3.IsStringLike=function(a){return"string"==typeof a||a instanceof C3.HtmlString||a instanceof C3.BBString},C3.RequireStringLike=function(a){if(!C3.IsStringLike(a))throw new TypeError("expected string-like")},C3.RequireOptionalStringLike=function(a){C3.IsNullOrUndefined(a)},C3.RequireAllStringLike=function(...b){for(let c of b);},C3.RequireOverride=function(){throw new Error("must be overridden")},C3.NotYetImplemented=function(){throw new Error("not yet implemented")},C3.IsDefined=function(a,...b){let c=a;if("undefined"==typeof c)return!1;for(let d of b){if("undefined"==typeof c[d])return!1;c=c[d]}return!0},C3.IsNullOrUndefined=function(a){return"undefined"==typeof a||null===a},C3.AreArrayElementsOfSameType=function(a){let b=a[0].constructor;for(let c of a)if(c.constructor!==b)return!1;return b},C3.AreArrayElementsOfType=function(a,b){for(let c of a)if(!(c instanceof b))return!1;return!0};const a=Object.getPrototypeOf(Uint8Array);C3.IsTypedArray=function(b){return C3.IsInstanceOf(b,a)},C3.RequireTypedArray=function(){},C3.WeakRequireTypedArray=function(b){C3.WeakRequireInstanceOf(b,a)},C3.WeakRequireAnyInstanceOf=function(a,...b){if(!C3.WeakIsAnyInstanceOf(a,...b))throw new TypeError("unexpected type")},C3.WeakIsAnyInstanceOf=function(a,...b){for(const c of b)if(C3.WeakIsInstanceOf(a,c))return!0;return!1},C3.WeakRequireInstanceOf=function(a,b){if(!C3.WeakIsInstanceOf(a,b))throw new TypeError("unexpected type")},C3.WeakIsInstanceOf=function(a,b){for(;a=Object.getPrototypeOf(a);)if(a.constructor.name===b.name)return!0;return!1}}
// ../lib/misc/jsutil.js
"use strict";{function a(a,b){let c=C3.getType(a),d=C3.getType(b);return!("null"!==c&&"null"!==d)||"undefined"!==c&&"undefined"!==d&&c===d}function b(a){console.warn("[Defence] "+a+" @",C3.GetCallStack())}function c(){if(k=-1,0<f.size||0<g.size){let a=new Set([...f.keys()].map((a)=>C3.getName(a))),b=[...a].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: ${b}`),f.clear(),g.clear()}}function d(a){let b=new Set;for(let c in a)b.add(c);return b}function e(a,b){let c=d(b),e=l.get(a);if(e){let b=[];for(let a of e.values())c.has(a)?c.delete(a):b.push(a);C3.appendArray(b,[...c]),b.length&&console.warn(`[Defence] '${C3.getName(a)}' constructor creates inconsistent properties: ${b.join(", ")}`)}else l.set(a,c)}C3.GetCallStack=function(){return new Error().stack},C3.Debugger=function(){debugger},C3.cast=function(a,b){return a&&a instanceof b?a:null},C3.getName=function(a){return"undefined"==typeof a?"undefined":null===a?"null":"boolean"==typeof a?"<boolean>":C3.IsNumber(a)?"<number>":C3.IsString(a)?"<string>":C3.IsArray(a)?"<array>":"symbol"==typeof a?"<"+a.toString()+">":C3.IsFunction(a)?a.name&&"Function"!==a.name?a.name:"<anonymous function>":"object"==typeof a?a.constructor&&a.constructor.name&&"Object"!==a.constructor.name?a.constructor.name:"<anonymous object>":"<unknown>"},C3.getType=function(a){return null===a?"null":Array.isArray(a)?"array":typeof a},C3.range=function*(c,a){if(!isFinite(Math.abs(c-a)))throw new Error("Invalid parameters");if(c>a)for(let b=c-1;b>=a;b--)yield b;else for(let b=c;b<a;b++)yield b};let f=new Map,g=new Map,h=new WeakMap,i=new WeakMap;C3.DefendHandler={};const j=new Set(["then","splice"]);C3.DefendHandler.get=function(a,c){return c in a||"symbol"==typeof c||j.has(c)||b(`Accessed missing property '${c}' from defended object '${C3.getName(a)}', returning undefined`),i.has(a)&&"symbol"!=typeof c&&!j.has(c)&&b(`Accessed property '${c}' on a released object '${C3.getName(a)}'\nObject was originally released at: ${i.get(a)})\nCall stack at access: `),a[c]},C3.DefendHandler.set=function(c,d,e){return d in c||f.has(c)||b(`Set non-existent property '${d}' to '${e}' on defended object '${C3.getName(c)}'`),a(c[d],e)||f.has(c)||b(`Set '${C3.getType(c[d])}' property '${d}' to type '${C3.getType(e)}' on defended object '${C3.getName(c)}'`),i.has(c)&&b(`Set property '${d}' on a released object '${C3.getName(c)}'\nObject was originally released at: ${i.get(c)})\nCall stack at access: `),c[d]=e,!0},C3.DefendHandler.deleteProperty=function(a,b){throw new ReferenceError(`Cannot delete property '${b}' from defended object '${C3.getName(a)}'`)},C3.DefendHandler.defineProperty=function(a,b){throw new ReferenceError(`Cannot define property '${b}' on defended object '${C3.getName(a)}'`)},C3.DefendHandler.enumerate=function(a){throw new ReferenceError(`Cannot enumerate defended object '${C3.getName(a)}'`)};let k=-1;C3.DefendedBase=class{constructor(){if(C3.isDebugDefend&&C3.Supports.Proxies){let a=new.target,b=Object.create(a.prototype),d=new Proxy(b,C3.DefendHandler);return f.set(b,d),g.set(d,b),h.set(d,b),-1===k&&(k=requestAnimationFrame(c)),d}}},C3.debugDefend=function(a){if(C3.isDebugDefend&&C3.Supports.Proxies&&a instanceof C3.DefendedBase){if(!g.has(a))return a;let b=g.get(a);return g.delete(a),f.delete(b),a}return C3.isDebug?Object.seal(a):a},C3.New=function(a,...b){let c;try{c=new a(...b)}catch(a){throw g.clear(),f.clear(),a}return C3.isDebugDefend&&e(a,c),C3.debugDefend(c)},C3.Release=function(a){let b=h.get(a);b&&i.set(b,C3.GetCallStack())},C3.WasReleased=function(a){let b=h.get(a);return!!b&&!!i.get(b)};let l=new Map;C3.PerfMark=class{constructor(a){this._name="",a&&this.start(a)}start(a){this._name=a,performance.mark(this._name+"-Start")}end(){performance.mark(this._name+"-End"),performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(a){this.end(),this._name=a,performance.mark(this._name+"-Start")}}}
// ../lib/misc/mathutil.js
"use strict";{function a(a){return 0===a&&0>1/a}const b=2*Math.PI,c=Math.PI/180,d=180/Math.PI;C3.wrap=function(a,b,c){var d=Math.floor;if(a=d(a),b=d(b),c=d(c),a<b){let d=c-(b-a)%(c-b);return d===c?0:d}return b+(a-b)%(c-b)},C3.mapToRange=function(a,b,c,d,e){return(a-b)*(e-d)/(c-b)+d},C3.normalize=function(a,b,c){return(a-b)/(c-b)},C3.clamp=function(c,d,a){return c<d?d:c>a?a:c},C3.clampAngle=function(c){return c%=b,0>c&&(c+=b),c},C3.toRadians=function(a){return a*c},C3.toDegrees=function(a){return a*d},C3.distanceTo=function(a,b,c,d){return Math.hypot(c-a,d-b)},C3.distanceSquared=function(a,b,c,d){const e=c-a,f=d-b;return e*e+f*f},C3.angleTo=function(a,b,c,d){return Math.atan2(d-b,c-a)},C3.angleDiff=function(a,b){var c=Math.cos,d=Math.sin;if(a===b)return 0;let e=d(a),f=c(a),g=d(b),h=c(b),i=e*g+f*h;return 1<=i?0:-1>=i?Math.PI:Math.acos(i)},C3.angleRotate=function(a,b,c){var d=Math.cos,e=Math.sin;let f=e(a),g=d(a),h=e(b),i=d(b);return Math.acos(f*h+g*i)>c?0<g*h-f*i?C3.clampAngle(a+c):C3.clampAngle(a-c):C3.clampAngle(b)},C3.angleClockwise=function(a,b){var c=Math.cos,d=Math.sin;let e=d(a),f=c(a),g=d(b),h=c(b);return 0>=f*g-e*h},C3.angleLerp=function(c,a,b){let d=C3.angleDiff(c,a);return C3.angleClockwise(a,c)?C3.clampAngle(c+d*b):C3.clampAngle(c-d*b)},C3.lerp=function(c,a,b){return c+b*(a-c)},C3.unlerp=function(c,a,b){return c===a?0:(b-c)/(a-c)},C3.relerp=function(e,a,b,f,c){return C3.lerp(f,c,C3.unlerp(e,a,b))},C3.qarp=function(d,a,b,c){return C3.lerp(C3.lerp(d,a,c),C3.lerp(a,b,c),c)},C3.cubic=function(e,a,b,c,d){return C3.lerp(C3.qarp(e,a,b,d),C3.qarp(a,b,c,d),d)},C3.cosp=function(c,a,b){return(c+a+(c-a)*Math.cos(b*Math.PI))/2},C3.isPOT=function(a){return 0<a&&0==(a-1&a)},C3.nextHighestPowerOfTwo=function(a){--a;for(let b=1;32>b;b<<=1)a|=a>>b;return a+1},C3.roundToNearestFraction=function(a,b){return Math.round(a*b)/b},C3.floorToNearestFraction=function(a,b){return Math.floor(a*b)/b},C3.round6dp=function(a){return Math.round(1e6*a)/1e6},C3.toFixed=function(a,b){let c=a.toFixed(b),d=c.length-1;for(;0<=d&&"0"===c.charAt(d);--d);return 0<=d&&"."===c.charAt(d)&&--d,0>d?c:c.substr(0,d+1)},C3.PackRGB=function(a,b,c){return C3.clamp(a,0,255)|C3.clamp(b,0,255)<<8|C3.clamp(c,0,255)<<16};const e=1024;C3.PackRGBAEx=function(a,b,c,d){var f=Math.floor;return a=C3.clamp(f(1024*a),-8192,8191),b=C3.clamp(f(1024*b),-8192,8191),c=C3.clamp(f(1024*c),-8192,8191),d=C3.clamp(f(1023*d),0,1023),0>a&&(a+=16384),0>b&&(b+=16384),0>c&&(c+=16384),-(16384*(16384*a)*e+16384*b*e+c*e+d)},C3.PackRGBEx=function(a,b,c){return C3.PackRGBAEx(a,b,c,1)},C3.GetRValue=function(a){if(0<=a)return(255&a)/255;else{let b=Math.floor(-a/274877906944);return 8191<b&&(b-=16384),b/1024}},C3.GetGValue=function(a){if(0<=a)return((65280&a)>>8)/255;else{let b=Math.floor(-a%274877906944/16777216);return 8191<b&&(b-=16384),b/1024}},C3.GetBValue=function(a){if(0<=a)return((16711680&a)>>16)/255;else{let b=Math.floor(-a%16777216/e);return 8191<b&&(b-=16384),b/1024}},C3.GetAValue=function(b){if(a(b))return 0;if(0<=b)return 1;else{const a=Math.floor(-b%e);return a/1023}},C3.greatestCommonDivisor=function(c,a){var b=Math.floor;for(c=b(c),a=b(a);0!==a;){let b=a;a=c%a,c=b}return c};const f=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];C3.getAspectRatio=function(a,b){var c=Math.abs,d=Math.floor;if(a=d(a),b=d(b),a===b)return[1,1];for(let d of f){let e=a/d[0]*d[1];if(1>c(b-e))return d.slice(0);if(e=a/d[1]*d[0],1>c(b-e))return[d[1],d[0]]}let e=C3.greatestCommonDivisor(a,b);return[a/e,b/e]},C3.segmentsIntersect=function(a,b,c,e,f,g,h,i){var j=Math.abs;let k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;if(a<c?(l=a,k=c):(l=c,k=a),f<h?(p=f,o=h):(p=h,o=f),k<p||l>o)return!1;if(b<e?(n=b,m=e):(n=e,m=b),g<i?(r=g,q=i):(r=i,q=g),m<r||n>q)return!1;let s=f-a+h-c,t=g-b+i-e,u=c-a,v=e-b,w=h-f,x=i-g,y=j(v*w-x*u);if(j(w*t-x*s)>y)return!1;return j(u*t-v*s)<=y},C3.segmentsIntersectPreCalc=function(a,b,c,e,f,g,h,i,j,k,l,m){var n=Math.abs;let o=0,p=0,q=0,r=0;if(j<l?(p=j,o=l):(p=l,o=j),g<p||f>o)return!1;if(k<m?(r=k,q=m):(r=m,q=k),i<r||h>q)return!1;let s=j-a+l-c,t=k-b+m-e,u=c-a,v=e-b,w=l-j,x=m-k,y=n(v*w-x*u);if(n(w*t-x*s)>y)return!1;return n(u*t-v*s)<=y},C3.segmentIntersectsQuad=function(a,b,c,d,e){let f=0,g=0,h=0,i=0;a<c?(f=a,g=c):(f=c,g=a),b<d?(h=b,i=d):(h=d,i=b);const j=e.getTlx(),k=e.getTly(),l=e.getTrx(),m=e.getTry(),n=e.getBrx(),o=e.getBry(),p=e.getBlx(),q=e.getBly();return C3.segmentsIntersectPreCalc(a,b,c,d,f,g,h,i,j,k,l,m)||C3.segmentsIntersectPreCalc(a,b,c,d,f,g,h,i,l,m,n,o)||C3.segmentsIntersectPreCalc(a,b,c,d,f,g,h,i,n,o,p,q)||C3.segmentsIntersectPreCalc(a,b,c,d,f,g,h,i,p,q,j,k)},C3.segmentIntersectsAnyN=function(a,b,c,d,e){let f=0,g=0,h=0,j=0;a<c?(f=a,g=c):(f=c,g=a),b<d?(h=b,j=d):(h=d,j=b);let k=0;for(let i=e.length-4;k<=i;k+=2)if(C3.segmentsIntersectPreCalc(a,b,c,d,f,g,h,j,e[k],e[k+1],e[k+2],e[k+3]))return!0;return C3.segmentsIntersectPreCalc(a,b,c,d,f,g,h,j,e[k],e[k+1],e[0],e[1])};C3.rayIntersect=function(a,b,c,d,e,f,g,h){const i=c-a,j=h-f,k=i*j-(d-b)*(g-e);if(0==k)return 2;const l=((b-d)*(g-a)+i*(h-b))/k;return 0<l&&l<1+1e-6?(j*(g-a)+(e-g)*(h-b))/k:2}}
// ../lib/misc/miscutil.js
"use strict";{let a=null,b="";if("undefined"!=typeof document){a=document;const c=document.querySelector("base");b=c&&c.hasAttribute("href")?c.getAttribute("href"):"",b&&(b.startsWith("/")&&(b=b.substr(1)),!b.endsWith("/")&&(b+="/"))}C3.GetBaseURL=function(){if(!a)return"";const c=a.location;return C3.GetPathFromURL(c.origin+c.pathname)+b},C3.GetPathFromURL=function(a){if(!a.length)return a;if(a.endsWith("/")||a.endsWith("\\"))return a;const b=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));return-1===b?"":a.substr(0,b+1)},C3.GetFilenameFromURL=function(a){if(!a.length)return a;if(a.endsWith("/")||a.endsWith("\\"))return"";const b=Math.max(a.lastIndexOf("/"),a.lastIndexOf("\\"));return-1===b?a:a.substr(b+1)},C3.DataTransferHasFiles=function(a){if(a.types)for(let b=0;b<a.types.length;b++)if("Files"===a.types[b]||"application/x-c3-file"===a.types[b])return!0;return!1},C3.DataTransferFilterFiles=async function(a,b){const c=Array.from(a.files).filter((a)=>0!==a.size).filter((a)=>b(a)).map(async(a)=>{try{return await C3.CloneFile(a)}catch(a){return null}}),d=await Promise.all(c);return d.filter((a)=>a)},C3.IsFileAnImage=function(a){return-1!==a.type.search(/image\/.*/)},C3.IsFileAnSVG=function(a){return"image/svg+xml"===a.type},C3.GetFileExtension=function(a){let b=a.lastIndexOf(".");return 1>b?"":a.substr(b)},C3.GetFileNamePart=function(a){let b=a.lastIndexOf(".");return 1>b?a:a.substr(0,b)},C3.NormalizeFileSeparator=function(a){return a.replace(/\\/g,"/")},C3.ParseFilePath=function(a){a=C3.NormalizeFileSeparator(a);let b=/^\w\:\//.exec(a);b?(b=b[0],a=a.slice(3),"/"!==a[0]&&(a="/"+a)):b="",a=a.replace(/\/{2,}/g,"/"),1<a.length&&"/"===a.slice(-1)&&(a=a.slice(0,-1));const c=a.lastIndexOf("/")+1;let d,e="",f=a,g="";0<c&&(e=a.slice(0,c),f=a.slice(c)),d=f;const h=f.lastIndexOf(".");0<h&&(g=f.slice(h),d=f.slice(0,-g.length));const i=b+e+f;return{dir:e,base:f,name:d,root:b,ext:g,full:i}},C3.Wait=function(a,b){return new Promise((c)=>{self.setTimeout(c,a,b)})},C3.swallowException=function(a){try{a()}catch(a){C3.isDebug&&console.warn("Swallowed exception: ",a)}},C3.noop=function(){},C3.equalsNoCase=function(c,d){return"string"==typeof c&&"string"==typeof d&&(!(c!==d)||(c=c.normalize(),d=d.normalize(),c.length===d.length&&c.toLowerCase()===d.toLowerCase()))},C3.equalsCase=function(c,d){return"string"==typeof c&&"string"==typeof d&&(!(c!==d)||c.normalize()===d.normalize())},C3.stableSort=function(a,c){if(C3.Supports.ArraySortProbablyStable)return void a.sort(c);const b=a.map((a,b)=>[a,b]);b.sort((d,a)=>{const b=c(d[0],a[0]);return 0===b?d[1]-a[1]:b});for(let d=0,e=a.length;d<e;++d)a[d]=b[d][0]},C3.typedArraySet16=function(a,b,c){a[c++]=b[0],a[c++]=b[1],a[c++]=b[2],a[c++]=b[3],a[c++]=b[4],a[c++]=b[5],a[c++]=b[6],a[c++]=b[7],a[c++]=b[8],a[c++]=b[9],a[c++]=b[10],a[c++]=b[11],a[c++]=b[12],a[c++]=b[13],a[c++]=b[14],a[c]=b[15]},C3.truncateArray=function(a,b){a.length=b},C3.clearArray=function(a){a&&0!==a.length&&C3.truncateArray(a,0)},C3.clear2DArray=function(b){if(b){for(let c,a=0;a<b.length;a++)c=b[a],C3.truncateArray(c,0);C3.truncateArray(b,0)}},C3.extendArray=function(a,b,c){b|=0;const d=a.length;if(!(b<=d))for(let e=d;e<b;++e)a.push(c)},C3.resizeArray=function(a,b,c){b|=0;const d=a.length;b<d?C3.truncateArray(a,b):b>d&&C3.extendArray(a,b,c)},C3.shallowAssignArray=function(a,b){C3.clearArray(a),C3.appendArray(a,b)},C3.appendArray=function(c,a){if(1e4>a.length)c.push(...a);else for(let b=0,d=a.length;b<d;++b)c.push(a[b])},C3.arrayRemove=function(a,b){if(b=Math.floor(b),!(0>b||b>=a.length)){let c=a.length-1;for(let d=b;d<c;++d)a[d]=a[d+1];C3.truncateArray(a,c)}},C3.arrayFindRemove=function(b,a){let c=b.indexOf(a);0<=c&&b.splice(c,1)},C3.arraysEqual=function(c,a){let b=c.length;if(a.length!==b)return!1;for(let d=0;d<b;++d)if(c[d]!==a[d])return!1;return!0},C3.arrayFilterOut=function(a,b){let c=[],d=0;for(let e,f=0,g=a.length;f<g;++f)e=a[f],b(e)?c.push(e):(a[d]=e,++d);return C3.truncateArray(a,d),c},C3.arrayRemoveAllInSet=function(a,b){const c=a.length;let d=0;for(let c,e=0,f=a.length;e<f;++e)c=a[e],b.has(c)||(a[d++]=c);return C3.truncateArray(a,d),c-d},C3.isArrayIndexInBounds=function(a,b){return!(a!==Math.floor(a))&&0<=a&&a<b.length},C3.validateArrayIndex=function(a,b){if(!C3.isArrayIndexInBounds(a,b))throw new RangeError("array index out of bounds")},C3.cloneArray=function(a){return a.slice()},C3.deepCloneArray=function(a,b){let c=[];for(let d of a)if(C3.IsObject(d)){let a=b(d);if(!a)throw new Error("missing clone");if(a.constructor!==d.constructor)throw new Error("object is not a clone");c.push(a)}else C3.IsArray(d)?c.push(C3.deepCloneArray(d,b)):c.push(d);return c},C3.clone2DArray=function(a){let b=[];for(let c of a)b.push(c.slice());return b},C3.mergeSets=function(a,b){return new Set([...a,...b])},C3.first=function(a){for(let b of a)return b;return null},C3.xor=function(a,b){return!a!=!b},C3.compare=function(a,b,c){return 0===b?a===c:1===b?a!==c:2===b?a<c:3===b?a<=c:4===b?a>c:!(5!=b)&&a>=c},C3.hasAnyOwnProperty=function(a){for(let b in a)if(a.hasOwnProperty(b))return!0;return!1},C3.PromiseAllWithProgress=function(a,b){return a.length?new Promise((c,d)=>{const e=[];let f=0,g=!1;for(let h=0,i=a.length;h<i;++h)e.push(void 0),a[h].then((d)=>{g||(e[h]=d,++f,f===a.length?c(e):b(f,a.length))}).catch((a)=>{g=!0,d(a)})}):Promise.resolve([])};let c=[];C3.AddLibraryMemoryCallback=function(a){c.push(a)},C3.GetEstimatedLibraryMemoryUsage=function(){let a=0;for(let b of c){let c=b();a+=c}return Math.floor(a)};const d=new MessageChannel;d.port2.onmessage=function(a){const b=a.data,c=f.get(b);f.delete(b),c&&c(a.timeStamp)};let e=1;const f=new Map;C3.RequestUnlimitedAnimationFrame=function(a){const b=e++;return f.set(b,a),d.port1.postMessage(b),b},C3.CancelUnlimitedAnimationFrame=function(a){f.delete(a)},C3.PostTask=C3.RequestUnlimitedAnimationFrame,C3.WaitForNextTask=function(){return new Promise((a)=>C3.PostTask(a))};const g=new Set;C3.RequestPostAnimationFrame=function(a){const b=self.requestAnimationFrame(async(c)=>{await C3.WaitForNextTask(),g.has(b)&&(g.delete(b),a(c))});return g.add(b),b},C3.CancelPostAnimationFrame=function(a){g.has(a)&&(self.cancelAnimationFrame(a),g.delete(a))}}
// c3/lib/misc/runtimeutil.js
"use strict";C3.IsAbsoluteURL=function(a){return /^(?:[a-z]+:)?\/\//.test(a)||"data:"===a.substr(0,5)||"blob:"===a.substr(0,5)},C3.IsRelativeURL=function(a){return!C3.IsAbsoluteURL(a)},C3.ThrowIfNotOk=function(a){if(!a.ok)throw new Error(`fetch '${a.url}' response returned ${a.status} ${a.statusText}`)},C3.FetchOk=function(a,b){return fetch(a,b).then((a)=>(C3.ThrowIfNotOk(a),a))},C3.FetchText=function(a){return C3.FetchOk(a).then((a)=>a.text())},C3.FetchJson=function(a){return C3.FetchOk(a).then((a)=>a.json())},C3.FetchBlob=function(a){return C3.FetchOk(a).then((a)=>a.blob())},C3.FetchArrayBuffer=function(a){return C3.FetchOk(a).then((a)=>a.arrayBuffer())},C3.FetchImage=function(a){return new Promise((b,c)=>{const d=new Image;d.onload=()=>b(d),d.onerror=(a)=>c(a),d.src=a})},C3.BlobToArrayBuffer=function(a){return new Promise((b,c)=>{const d=new FileReader;d.onload=()=>b(d.result),d.onerror=()=>c(d.error),d.readAsArrayBuffer(a)})},C3.BlobToString=function(a){return new Promise((b,c)=>{const d=new FileReader;d.onload=()=>b(d.result),d.onerror=()=>c(d.error),d.readAsText(a)})},C3.BlobToJson=function(a){return C3.BlobToString(a).then((a)=>JSON.parse(a))},C3.BlobToImage=async function(a,b){let c=URL.createObjectURL(a);try{const a=await C3.FetchImage(c);return URL.revokeObjectURL(c),c="",b&&"function"==typeof a["decode"]&&(await a["decode"]()),a}finally{c&&URL.revokeObjectURL(c)}},C3.CreateCanvas=function(a,b){if("undefined"!=typeof document&&"function"==typeof document.createElement){const c=document.createElement("canvas");return c.width=a,c.height=b,c}return new OffscreenCanvas(a,b)},C3.CanvasToBlob=function(a,b,c){return"number"!=typeof c&&(c=1),b=b||"image/png",c=C3.clamp(c,0,1),a.toBlob?new Promise((d)=>a.toBlob(d,b,c)):a["convertToBlob"]?a["convertToBlob"]({"type":b,"quality":c}):C3.Asyncify(()=>C3.CanvasToBlobSync(a,b,c))},C3.CanvasToBlobSync=function(a,b,c){return"number"!=typeof c&&(c=1),b=b||"image/png",c=C3.clamp(c,0,1),C3.DataURIToBinaryBlobSync(a.toDataURL(b,c))},C3.DataURIToBinaryBlobSync=function(a){const b=C3.ParseDataURI(a);return C3.BinaryStringToBlob(b.data,b.mime_type)},C3.ParseDataURI=function(a){if("data:"!==a.substr(0,5))throw new URIError("expected data: uri");let b=a.indexOf(",");if(0>b)throw new URIError("expected comma in data: uri");let c,d=a.substring(5,b),e=a.substring(b+1),f=d.split(";"),g=f[0]||"",h=f[1],i=f[2];return c="base64"===h||"base64"===i?atob(e):decodeURIComponent(e),{mime_type:g,data:c}},C3.BinaryStringToBlob=function(a,b){let c,d,e=a.length,f=e>>2,g=new Uint8Array(e),h=new Uint32Array(g.buffer,0,f);for(c=0,d=0;c<f;++c)h[c]=a.charCodeAt(d++)|a.charCodeAt(d++)<<8|a.charCodeAt(d++)<<16|a.charCodeAt(d++)<<24;for(let c=3&e;c--;)g[d]=a.charCodeAt(d),++d;return b?new Blob([g],{"type":b}):new Blob([g])},C3.DrawableToBlob=function(a,b,c){const d=C3.CreateCanvas(a.width,a.height),e=d.getContext("2d");return e.drawImage(a,0,0),C3.CanvasToBlob(d,b,c)},C3.ImageDataToBlobSync=function(a,b,c){const d=C3.CreateCanvas(a.width,a.height),e=d.getContext("2d");return e.putImageData(a,0,0),C3.CanvasToBlobSync(d,b,c)},C3.ImageDataToBlob=function(a,b,c){if(C3.Supports.ImageBitmapOptions)return createImageBitmap(a,{"premultiplyAlpha":"none"}).then((a)=>C3.DrawableToBlob(a,b,c));if(C3.Supports.ImageBitmap)return createImageBitmap(a).then((a)=>C3.DrawableToBlob(a,b,c));else{const d=C3.CreateCanvas(a.width,a.height),e=d.getContext("2d");return e.putImageData(a,0,0),C3.CanvasToBlob(d,b,c)}},C3.CopySet=function(a,b){a.clear();for(const c of b)a.add(c)},C3.MapToObject=function(a){const b=Object.create(null);for(const[c,d]of a.entries())b[c]=d;return b},C3.ObjectToMap=function(a,b){b.clear();for(const[c,d]of Object.entries(a))b.set(c,d)},C3.ToSuperJSON=function a(b){if("object"==typeof b&&null!==b){if(b instanceof Set)return{"_c3type_":"set","data":[...b].map((b)=>a(b))};if(b instanceof Map)return{"_c3type_":"map","data":[...b].map((b)=>[b[0],a(b[1])])};else{const c=Object.create(null);for(const[d,e]of Object.entries(b))c[d]=a(e);return c}}return b},C3.FromSuperJSON=function a(b){if("object"==typeof b&null!==b){if("set"===b["_c3type_"])return new Set(b["data"].map((b)=>a(b)));if("map"===b["_c3type_"])return new Map(b["data"].map((b)=>[b[0],a(b[1])]));else{const c=Object.create(null);for(const[d,e]of Object.entries(b))c[d]=a(e);return c}}return b},C3.CSSToCamelCase=function(a){let b="",c=!1;for(const d of a)"-"===d?c=!0:c?(b+=d.toUpperCase(),c=!1):b+=d;return b},C3.IsIterator=function(a){return"object"==typeof a&&"function"==typeof a.next};
// ../lib/misc/color.js
"use strict";{function a(a){return 0===a.length?"00":1===a.length?"0"+a:a}function c(a,b,c){return 0>c&&(c+=1),1<c&&(c-=1),c<1/6?a+6*(b-a)*c:c<1/2?b:c<2/3?a+6*((b-a)*(2/3-c)):a}const b=/([0-9.]+),([0-9.]+)\%?,([0-9.]+)\%?/i,d=/([0-9.]+),([0-9.]+)\%?,([0-9.]+)\%?,([0-9.])/i;C3.Color=class{constructor(c,d,e,b){this._r=NaN,this._g=NaN,this._b=NaN,this._a=NaN,this._r=0,this._g=0,this._b=0,this._a=0,c instanceof C3.Color?this.set(c):this.setRgba(c||0,d||0,e||0,b||0)}setRgb(a,c,d){return this._r=+a,this._g=+c,this._b=+d,this.clamp(),this}setRgba(c,d,e,f){return this._r=+c,this._g=+d,this._b=+e,this._a=+f,this.clamp(),this}set(a){return this._r=a._r,this._g=a._g,this._b=a._b,this._a=a._a,this}copy(a){return this.set(a)}add(a){this._r+=a._r,this._g+=a._g,this._b+=a._b,this._a+=a._a,this.clamp()}addRgb(c,d,e,f=0){this._r+=+c,this._g+=+d,this._b+=+e,this._a+=+f,this.clamp()}diff(a){var b=Math.min,c=Math.max;this.setR(c(this._r,a._r)-b(this._r,a._r)),this.setG(c(this._g,a._g)-b(this._g,a._g)),this.setB(c(this._b,a._b)-b(this._b,a._b)),this.setA(c(this._a,a._a)-b(this._a,a._a)),this.clamp()}copyRgb(a){this._r=a._r,this._g=a._g,this._b=a._b}setR(a){this._r=C3.clamp(+a,0,1)}getR(){return this._r}setG(a){this._g=C3.clamp(+a,0,1)}getG(){return this._g}setB(a){this._b=C3.clamp(+a,0,1)}getB(){return this._b}setA(b){this._a=C3.clamp(+b,0,1)}getA(){return this._a}clone(){return C3.New(C3.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(a,b){a[b++]=this._r,a[b++]=this._g,a[b++]=this._b,a[b]=this._a}equals(a){return this._r===a._r&&this._g===a._g&&this._b===a._b&&this._a===a._a}equalsIgnoringAlpha(a){return this._r===a._r&&this._g===a._g&&this._b===a._b}equalsRgb(a,c,d){return this._r===a&&this._g===c&&this._b===d}equalsRgba(c,d,e,b){return this._r===c&&this._g===d&&this._b===e&&this._a===b}multiply(a){this._r*=a._r,this._g*=a._g,this._b*=a._b,this._a*=a._a}multiplyAlpha(b){this._r*=b,this._g*=b,this._b*=b,this._a*=b}premultiply(){return this._r*=this._a,this._g*=this._a,this._b*=this._a,this}unpremultiply(){return this._r/=this._a,this._g/=this._a,this._b/=this._a,this}clamp(){return this._r=C3.clamp(this._r,0,1),this._g=C3.clamp(this._g,0,1),this._b=C3.clamp(this._b,0,1),this._a=C3.clamp(this._a,0,1),this}setFromRgbValue(a){this._r=C3.GetRValue(a),this._g=C3.GetGValue(a),this._b=C3.GetBValue(a),this._a=C3.GetAValue(a)}getCssRgb(a,c,d){const e=C3.IsFiniteNumber(a)?a:this.getR(),f=C3.IsFiniteNumber(c)?c:this.getG(),g=C3.IsFiniteNumber(d)?d:this.getB();return`rgb(${100*e}%, ${100*f}%, ${100*g}%)`}getCssRgba(c,d,e,f){const h=C3.IsFiniteNumber(c)?c:this.getR(),i=C3.IsFiniteNumber(d)?d:this.getG(),g=C3.IsFiniteNumber(e)?e:this.getB(),b=C3.IsFiniteNumber(f)?f:this.getA();return`rgba(${100*h}%, ${100*i}%, ${100*g}%, ${b})`}toHexString(){var b=Math.round;const c=b(255*this.getR()),d=b(255*this.getG()),e=b(255*this.getB());return"#"+a(c.toString(16))+a(d.toString(16))+a(e.toString(16))}parseHexString(a){if("string"!=typeof a)return!1;a=a.trim(),"#"===a.charAt(0)&&(a=a.substr(1));let b,c,d;if(3===a.length)b=parseInt(a[0],16)/15,c=parseInt(a[1],16)/15,d=parseInt(a[2],16)/15;else if(6===a.length)b=parseInt(a.substr(0,2),16)/255,c=parseInt(a.substr(2,2),16)/255,d=parseInt(a.substr(4,2),16)/255;else return!1;return isFinite(b)&&this.setR(b),isFinite(c)&&this.setG(c),isFinite(d)&&this.setB(d),this.setA(1),!0}toCommaSeparatedRgb(){var a=Math.round;const b=a(255*this.getR()),c=a(255*this.getG()),d=a(255*this.getB());return`${b}, ${c}, ${d}`}toRgbArray(){var a=Math.round;const b=a(255*this.getR()),c=a(255*this.getG()),d=a(255*this.getB());return[b,c,d]}parseCommaSeparatedRgb(a){if("string"!=typeof a)return!1;a=a.replace(/^rgb\(|\)|%/,"");const b=a.split(",");if(3>b.length)return!1;const c=parseInt(b[0].trim(),10)/255,d=parseInt(b[1].trim(),10)/255,e=parseInt(b[2].trim(),10)/255;return isFinite(c)&&this.setR(c),isFinite(d)&&this.setG(d),isFinite(e)&&this.setB(e),this.setA(1),!0}parseCommaSeparatedPercentageRgb(a){if("string"!=typeof a)return!1;a=a.replace(/^rgb\(|\)|%/,"");const b=a.split(",");if(3>b.length)return!1;const c=parseInt(b[0].trim(),10)/100,d=parseInt(b[1].trim(),10)/100,e=parseInt(b[2].trim(),10)/100;return isFinite(c)&&this.setR(c),isFinite(d)&&this.setG(d),isFinite(e)&&this.setB(e),this.setA(1),!0}parseCommaSeparatedRgba(a){if("string"!=typeof a)return!1;a=a.replace(/^rgba\(|\)|%/,"");const b=a.split(",");if(4>b.length)return!1;const c=parseInt(b[0].trim(),10)/255,d=parseInt(b[1].trim(),10)/255,e=parseInt(b[2].trim(),10)/255,f=parseFloat(b[3].trim());return isFinite(c)&&this.setR(c),isFinite(d)&&this.setG(d),isFinite(e)&&this.setB(e),isFinite(f)&&this.setA(f),!0}parseCommaSeparatedPercentageRgba(a){if("string"!=typeof a)return!1;a=a.replace(/^rgba\(|\)|%/,"");const b=a.split(",");if(4>b.length)return!1;const c=parseInt(b[0].trim(),10)/100,d=parseInt(b[1].trim(),10)/100,e=parseInt(b[2].trim(),10)/100,f=parseFloat(b[3].trim());return isFinite(c)&&this.setR(c),isFinite(d)&&this.setG(d),isFinite(e)&&this.setB(e),isFinite(f)&&this.setA(f),!0}parseString(a){if("string"!=typeof a)return!1;if(a=a.replace(/\s+/,""),a.includes(",")){if(a.startsWith("rgb("))return a.includes("%")?this.parseCommaSeparatedPercentageRgb(a):this.parseCommaSeparatedRgb(a);if(a.startsWith("rgba("))return a.includes("%")?this.parseCommaSeparatedPercentageRgba(a):this.parseCommaSeparatedRgba(a);if(a.startsWith("hsl(")||a.startsWith("hsla("))return this.parseHSLString(a);else{const b=a.split(",");return a.includes("%")?3===b.length?this.parseCommaSeparatedPercentageRgb(a):4===b.length&&this.parseCommaSeparatedPercentageRgba(a):3===b.length?this.parseCommaSeparatedRgb(a):4===b.length&&this.parseCommaSeparatedRgba(a)}}else return this.parseHexString(a)}toJSON(){return[this._r,this._g,this._b,this._a]}setFromHSLA(d,e,f,h){let a,i,g;if(d%=360,e=C3.clamp(e,0,100),f=C3.clamp(f,0,100),h=C3.clamp(h,0,1),d/=360,e/=100,f/=100,0===e)a=i=g=f;else{const b=.5>f?f*(1+e):f+e-f*e,h=2*f-b;a=c(h,b,d+1/3),i=c(h,b,d),g=c(h,b,d-1/3)}return this.setR(a),this.setG(i),this.setB(g),this.setA(h),this}parseHSLString(a){const c=a.replace(/ |hsl|hsla|\(|\)|;/gi,""),e=b.exec(c),f=d.exec(c);return e&&4===e.length?(this.setFromHSLA(+e[1],+e[2],+e[3],1),!0):!!(f&&5===f.length)&&(this.setFromHSLA(+e[1],+e[2],+e[3],+e[4]),!0)}toHSLAString(){const c=this._r,d=this._g,e=this._b,b=this._a,a=C3.Color.GetHue(c,d,e),f=C3.Color.GetSaturation(c,d,e),g=C3.Color.GetLuminosity(c,d,e);return`hsla(${a}, ${f}%, ${g}%, ${b})`}toHSLAArray(){const a=this._r,c=this._g,d=this._b;return[C3.Color.GetHue(a,c,d),C3.Color.GetSaturation(a,c,d),C3.Color.GetLuminosity(a,c,d),this._a]}setFromJSON(a){!Array.isArray(a)||3>a.length||(this._r=a[0],this._g=a[1],this._b=a[2],this._a=4<=a.length?a[3]:1)}set r(a){this.setR(a)}get r(){return this.getR()}set g(a){this.setG(a)}get g(){return this.getG()}set b(a){this.setB(a)}get b(){return this.getB()}set a(b){this.setA(b)}get a(){return this.getA()}setAtIndex(a,b){switch(a){case 0:this.setR(b);break;case 1:this.setG(b);break;case 2:this.setB(b);break;case 3:this.setA(b);break;default:throw new RangeError("invalid color index");}}getAtIndex(a){switch(a){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 Diff(a,b){var c=Math.min,d=Math.max;const e=new C3.Color;return e.setR(d(a._r,b._r)-c(a._r,b._r)),e.setG(d(a._g,b._g)-c(a._g,b._g)),e.setB(d(a._b,b._b)-c(a._b,b._b)),e.setA(d(a._a,b._a)-c(a._a,b._a)),e}static GetHue(a,c,d){const b=Math.max(a,c,d),e=Math.min(a,c,d);if(b===e)return 0;let f=0;return b===a?f=(c-d)/(b-e)+(c<d?6:0):b===c?f=(d-a)/(b-e)+2:b===d?f=(a-c)/(b-e)+4:void 0,Math.round(360*(f/6))}static GetSaturation(a,c,e){const b=Math.max(a,c,e),f=Math.min(a,c,e);if(b===f)return 0;const g=b-f,d=.5<(b+f)/2?g/(2-b-f):g/(b+f);return Math.round(100*d)}static GetLuminosity(a,c,d){const b=Math.max(a,c,d),e=Math.min(a,c,d);return b?Math.round(100*((b+e)/2)):0}},C3.Color.White=Object.freeze(C3.New(C3.Color,1,1,1,1)),C3.Color.Black=Object.freeze(C3.New(C3.Color,0,0,0,1)),C3.Color.TransparentBlack=Object.freeze(C3.New(C3.Color,0,0,0,0))}
// ../lib/misc/vector2.js
"use strict";C3.Vector2=class{constructor(a,b){this._x=0,this._y=0,a instanceof C3.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}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}round(){var a=Math.round;this._x=a(this._x),this._y=a(this._y)}floor(){var a=Math.floor;this._x=a(this._x),this._y=a(this._y)}ceil(){var a=Math.ceil;this._x=a(this._x),this._y=a(this._y)}angle(){return C3.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 c=this._x*b-this._y*a;this._y=this._y*b+this._x*a,this._x=c}rotate(b){0===b||this.rotatePrecalc(Math.sin(b),Math.cos(b))}rotateAbout(b,a,c){0===b||a===this._x&&c===this._y||(this._x-=a,this._y-=c,this.rotatePrecalc(Math.sin(b),Math.cos(b)),this._x+=+a,this._y+=+c)}move(b,a){0===a||(this._x+=Math.cos(b)*a,this._y+=Math.sin(b)*a)}normalize(){const a=this.length();0!==a&&1!==a&&(this._x/=a,this._y/=a)}clamp(a,b){this._x=C3.clamp(this._x,a,b),this._y=C3.clamp(this._y,a,b)}};
// ../lib/misc/rect.js
"use strict";C3.Rect=class{constructor(a,b,c,d){this._left=NaN,this._top=NaN,this._right=NaN,this._bottom=NaN,this._left=0,this._top=0,this._right=0,this._bottom=0,a instanceof C3.Rect?this.copy(a):this.set(a||0,b||0,c||0,d||0)}set(a,b,c,d){this._left=+a,this._top=+b,this._right=+c,this._bottom=+d}setWH(a,b,c,d){a=+a,b=+b,this._left=a,this._top=b,this._right=a+ +c,this._bottom=b+ +d}copy(a){this._left=+a._left,this._top=+a._top,this._right=+a._right,this._bottom=+a._bottom}clone(){return new C3.Rect(this._left,this._top,this._right,this._bottom)}static Merge(a,b){var c=Math.max,d=Math.min;const e=new C3.Rect;return e.setLeft(d(a._left,b._left)),e.setTop(d(a._top,b._top)),e.setRight(c(a._right,b._right)),e.setBottom(c(a._bottom,b._bottom)),e}static FromObject(a){return new C3.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}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}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){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 new 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){this._left-=a,this._top-=b,this._right+=+a,this._bottom+=+b}deflate(a,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(){var a=Math.round;this._left=a(this._left),this._top=a(this._top),this._right=a(this._right),this._bottom=a(this._bottom)}roundInner(){var a=Math.floor,b=Math.ceil;this._left=b(this._left),this._top=b(this._top),this._right=a(this._right),this._bottom=a(this._bottom)}roundOuter(){var a=Math.floor,b=Math.ceil;this._left=a(this._left),this._top=a(this._top),this._right=b(this._right),this._bottom=b(this._bottom)}floor(){var a=Math.floor;this._left=a(this._left),this._top=a(this._top),this._right=a(this._right),this._bottom=a(this._bottom)}ceil(){var a=Math.ceil;this._left=a(this._left),this._top=a(this._top),this._right=a(this._right),this._bottom=a(this._bottom)}clamp(a,c,d,e){this._left<a&&(this._left=+a),this._top<c&&(this._top=+c),this._right>d&&(this._right=+d),this._bottom>e&&(this._bottom=+e)}clampFlipped(a,c,d,e){this._left<a&&(this._left=+a),this._top>c&&(this._top=+c),this._right>d&&(this._right=+d),this._bottom<e&&(this._bottom=+e)}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,c){return!(a._right+b<this._left||a._bottom+c<this._top||a._left+b>this._right||a._top+c>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=C3.lerp(a._left,a._right,this._left),this._top=C3.lerp(a._top,a._bottom,this._top),this._right=C3.lerp(a._left,a._right,this._right),this._bottom=C3.lerp(a._top,a._bottom,this._bottom)}};
// ../lib/misc/quad.js
"use strict";{function a(g,a,b,c){g<a?b<c?(e=g<b?g:b,f=a>c?a:c):(e=g<c?g:c,f=a>b?a:b):b<c?(e=a<b?a:b,f=g>c?g:c):(e=a<c?a:c,f=g>b?g:b)}let e=0,f=0;C3.Quad=class{constructor(a,b,c,d,e,f,g,h){this._tlx=NaN,this._tly=NaN,this._trx=NaN,this._try=NaN,this._brx=NaN,this._bry=NaN,this._blx=NaN,this._bly=NaN,this._tlx=0,this._tly=0,this._trx=0,this._try=0,this._brx=0,this._bry=0,this._blx=0,this._bly=0,a instanceof C3.Quad?this.copy(a):this.set(a||0,b||0,c||0,d||0,e||0,f||0,g||0,h||0)}set(a,b,c,d,e,f,g,h){this._tlx=+a,this._tly=+b,this._trx=+c,this._try=+d,this._brx=+e,this._bry=+f,this._blx=+g,this._bly=+h}setRect(a,b,c,d){this.set(a,b,c,b,c,d,a,d)}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,c){a[b++]=this._tlx,a[b++]=this._tly,a[b++]=c,a[b++]=this._trx,a[b++]=this._try,a[b++]=c,a[b++]=this._brx,a[b++]=this._bry,a[b++]=c,a[b++]=this._blx,a[b++]=this._bly,a[b]=c}offset(a,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(){var a=Math.round;this._tlx=a(this._tlx),this._tly=a(this._tly),this._trx=a(this._trx),this._try=a(this._try),this._brx=a(this._brx),this._bry=a(this._bry),this._blx=a(this._blx),this._bly=a(this._bly)}floor(){var a=Math.floor;this._tlx=a(this._tlx),this._tly=a(this._tly),this._trx=a(this._trx),this._try=a(this._try),this._brx=a(this._brx),this._bry=a(this._bry),this._blx=a(this._blx),this._bly=a(this._bly)}ceil(){var a=Math.ceil;this._tlx=a(this._tlx),this._tly=a(this._tly),this._trx=a(this._trx),this._try=a(this._try),this._brx=a(this._brx),this._bry=a(this._bry),this._blx=a(this._blx),this._bly=a(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(b,c){0===c?this.setFromRect(b):this.setFromRotatedRectPrecalc(b,Math.sin(c),Math.cos(c))}setFromRotatedRectPrecalc(a,b,c){const d=a._left*b,e=a._top*b,f=a._right*b,g=a._bottom*b,h=a._left*c,i=a._top*c,j=a._right*c,k=a._bottom*c;this._tlx=h-e,this._tly=i+d,this._trx=j-e,this._try=i+f,this._brx=j-g,this._bry=k+f,this._blx=h-g,this._bly=k+d}getBoundingBox(b){a(this._tlx,this._trx,this._brx,this._blx),b._left=e,b._right=f,a(this._tly,this._try,this._bry,this._bly),b._top=e,b._bottom=f}containsPoint(a,b){let c=this._trx-this._tlx,d=this._try-this._tly;const e=this._brx-this._tlx,f=this._bry-this._tly,g=a-this._tlx,h=b-this._tly;let i=c*c+d*d,j=c*e+d*f,k=c*g+d*h;const l=e*e+f*f,m=e*g+f*h;let n=1/(i*l-j*j),o=(l*k-j*m)*n,p=(i*m-j*k)*n;return!!(0<=o&&0<p&&1>o+p)||(c=this._blx-this._tlx,d=this._bly-this._tly,i=c*c+d*d,j=c*e+d*f,k=c*g+d*h,n=1/(i*l-j*j),o=(l*k-j*m)*n,p=(i*m-j*k)*n,0<=o&&0<p&&1>o+p)}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,c,d){return!!(this.containsPoint(a,b)||this.containsPoint(c,d))||C3.segmentIntersectsQuad(a,b,c,d,this)}intersectsQuad(a){let b=a.midX(),c=a.midY();if(this.containsPoint(b,c))return!0;if(b=this.midX(),c=this.midY(),a.containsPoint(b,c))return!0;const d=this._tlx,e=this._tly,f=this._trx,g=this._try,h=this._brx,i=this._bry,j=this._blx,k=this._bly;return C3.segmentIntersectsQuad(d,e,f,g,a)||C3.segmentIntersectsQuad(f,g,h,i,a)||C3.segmentIntersectsQuad(h,i,j,k,a)||C3.segmentIntersectsQuad(j,k,d,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 c=this._getAtIndex(a);this._setAtIndex(a,this._getAtIndex(b)),this._setAtIndex(b,c)}_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){switch(b=+b,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");}}}}
// c3/lib/misc/collisionPoly.js
"use strict";{const a=[0,0,1,0,1,1,0,1],b=C3.New(C3.Quad);C3.CollisionPoly=class extends C3.DefendedBase{constructor(b,c=!0){super(),b||(b=a);this._ptsArr=Float64Array.from(b),this._bbox=new C3.Rect,this._isBboxChanged=!0,this._enabled=c}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(a){this._ptsArr.length===a.length?this._ptsArr.set(a):this._ptsArr=Float64Array.from(a),this._isBboxChanged=!0}copy(a){this.setPoints(a._ptsArr)}setBboxChanged(){this._isBboxChanged=!0}_updateBbox(){if(!this._isBboxChanged)return;const a=this._ptsArr;let b=a[0],c=a[1],d=b,e=c;for(let f=0,g=a.length;f<g;f+=2){const g=a[f],h=a[f+1];g<b&&(b=g),g>d&&(d=g),h<c&&(c=h),h>e&&(e=h)}this._bbox.set(b,c,d,e),this._isBboxChanged=!1}setFromRect(a,b,c){let d=this._ptsArr;8!==d.length&&(d=new Float64Array(8),this._ptsArr=d),d[0]=a.getLeft()-b,d[1]=a.getTop()-c,d[2]=a.getRight()-b,d[3]=a.getTop()-c,d[4]=a.getRight()-b,d[5]=a.getBottom()-c,d[6]=a.getLeft()-b,d[7]=a.getBottom()-c,this._bbox.copy(a),(0!==b||0!==c)&&this._bbox.offset(-b,-c),this._isBboxChanged=!1}setFromQuad(a,c,d){b.copy(a),b.offset(c,d),this.setPoints(b.toArray()),this._isBboxChanged=!0}transform(b,c,d){let a=0,e=1;0!==d&&(a=Math.sin(d),e=Math.cos(d)),this.transformPrecalc(b,c,a,e)}transformPrecalc(a,b,c,d){const e=this._ptsArr;for(let f=0,g=e.length;f<g;f+=2){const g=f+1,h=e[f]*a,i=e[g]*b;e[f]=h*d-i*c,e[g]=i*d+h*c}this._isBboxChanged=!0}offset(a,b){const c=this._ptsArr;for(let d=0,e=c.length;d<e;d+=2)c[d]+=a,c[d+1]+=b}containsPoint(a,b){const c=this._ptsArr;if(a===c[0]&&b===c[1])return!0;this._updateBbox();const d=this._bbox,e=d.getLeft()-110,f=d.getTop()-101,g=d.getRight()+131,h=d.getBottom()+120;let k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e<a?(k=e,m=a):(k=a,m=e),f<b?(l=f,n=b):(l=b,n=f),g<a?(o=g,q=a):(o=a,q=g),h<b?(p=h,r=b):(p=b,r=h);let s=0,t=0;for(let d=0,i=c.length;d<i;d+=2){const u=(d+2)%i,j=c[d],v=c[d+1],w=c[u],x=c[u+1];C3.segmentsIntersectPreCalc(e,f,a,b,k,m,l,n,j,v,w,x)&&++s,C3.segmentsIntersectPreCalc(g,h,a,b,o,q,p,r,j,v,w,x)&&++t}return 1==s%2||1==t%2}intersectsPoly(a,b,c){const d=a._ptsArr,e=this._ptsArr;if(this.containsPoint(d[0]+b,d[1]+c))return!0;if(a.containsPoint(e[0]-b,e[1]-c))return!0;for(let f=0,g=e.length;f<g;f+=2){const a=(f+2)%g,h=e[f],i=e[f+1],j=e[a],m=e[a+1];let n=0,o=0,p=0,q=0;h<j?(n=h,p=j):(n=j,p=h),i<m?(o=i,q=m):(o=m,q=i);for(let a=0,e=d.length;a<e;a+=2){const f=(a+2)%e,g=d[a]+b,k=d[a+1]+c,l=d[f]+b,r=d[f+1]+c;if(C3.segmentsIntersectPreCalc(h,i,j,m,n,p,o,q,g,k,l,r))return!0}}return!1}intersectsSegment(a,b,c,d,e,f){if(this.containsPoint(c-a,d-b))return!0;if(this.containsPoint(e-a,f-b))return!0;let g=0,h=0,k=0,l=0;c<e?(g=c,k=e):(g=e,k=c),d<f?(h=d,l=f):(h=f,l=d);const m=this._ptsArr;for(let n=0,i=m.length;n<i;n+=2){const o=(n+2)%i,j=m[n]+a,p=m[n+1]+b,q=m[o]+a,r=m[o+1]+b;if(C3.segmentsIntersectPreCalc(c,d,e,f,g,k,h,l,j,p,q,r))return!0}return!1}mirror(a){const b=this._ptsArr;for(let c=0,d=b.length;c<d;c+=2)b[c]=2*a-b[c];this._isBboxChanged=!0}flip(a){const b=this._ptsArr;for(let c=0,d=b.length;c<d;c+=2){const d=c+1;b[d]=2*a-b[d]}this._isBboxChanged=!0}diag(){const a=this._ptsArr;for(let b=0,c=a.length;b<c;b+=2){const c=b+1,d=a[b];a[b]=a[c],a[c]=d}this._isBboxChanged=!0}GetMidX(){const a=this._ptsArr;let b=0;for(let c=0,d=a.length;c<d;c+=2)b+=a[c];return b/this.pointCount()}GetMidY(){const a=this._ptsArr;let b=0;for(let c=0,d=a.length;c<d;c+=2)b+=a[c+1];return b/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}}
// c3/lib/misc/pairMap.js
"use strict";C3.PairMap=class extends C3.DefendedBase{constructor(a){if(super(),this._firstMap=new Map,a)for(const[b,c,d]of a)this.Set(b,c,d)}Release(){this.Clear(),this._firstMap=null}Clear(){const a=this._firstMap;for(const b of a.values())b.clear();a.clear()}Set(a,b,c){const d=this._firstMap;let e=d.get(a);e||(e=new Map,d.set(a,e)),e.set(b,c)}Get(a,b){const c=this._firstMap.get(a);return c?c.get(b):c}Has(a,b){const c=this._firstMap.get(a);return!!c&&c.has(b)}Delete(a,b){const c=this._firstMap,d=c.get(a);if(!d)return!1;const e=d.delete(b);return e&&0===d.size&&c.delete(a),e}DeleteEither(a){const b=this._firstMap,c=b.get(a);c&&(c.clear(),b.delete(a));for(const[c,d]of b.entries())d.delete(a)&&0===d.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 c of b.keys())yield[a,c]}*entries(){for(const[a,b]of this._firstMap.entries())for(const[c,d]of b.entries())yield[a,c,d]}};
// c3/lib/misc/arraySet.js
"use strict";C3.ArraySet=class extends C3.DefendedBase{constructor(){super(),this._set=new Set,this._arr=[],this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear(),C3.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(){return this._needToRebuildArray&&(this._RebuildArray(),this._needToRebuildArray=!1),this._arr}_RebuildArray(){const a=this._arr;C3.clearArray(a);for(const b of this._set)a.push(b)}};
// ../lib/misc/ease.js
"use strict";(function(){var e=Math.asin,f=Math.abs,g=Math.sqrt,h=Math.pow,i=Math.sin,j=Math.cos,k=Math.PI;const d=new Map,l=new Map,m=new Map,n=new Map,o=new Map;o.set("linear","noease"),o.set("default","noease"),self.Ease=class s{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEaseNames(...a){return this._CreateEaseMap(),[...l.keys()].concat([...m.keys()]).filter((b)=>!a.includes(b))}static IsNamePredefined(a){return this._CreateEaseMap(),[...l.keys()].includes(a)}static GetEase(a){this._CreateEaseMap();const b=o.get(a);return b?d.get(b):d.get(a)}static GetEaseFromIndex(a){this._CreateEaseMap();const b=this.GetEaseNames();return b[a]}static GetIndexForEase(a){this._CreateEaseMap();const b=this.GetEaseNames();return b.indexOf(a)}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(a,b){s._AddEase(a,b,"predefined")}static _AddPrivateCustomEase(a,b){s._AddEase(a,b,"private")}static AddCustomEase(a,b){this._CreateEaseMap(),s._AddEase(a,b,"custom")}static RemoveCustomEase(a){this.IsNamePredefined(a)||[...n.keys()].includes(a)||(m.delete(a),d.delete(a))}static _AddEase(a,b,c){switch(d.set(a,b),c){case"predefined":l.set(a,b);break;case"custom":m.set(a,b);break;case"private":n.set(a,b);break;default:throw new Error("unexpected ease mode");}}static NoEase(a,e,b,c){return b*a/c+e}static EaseInQuad(a,e,b,c){return b*(a/=c)*a+e}static EaseOutQuad(a,e,b,f){return-b*(a/=f)*(a-2)+e}static EaseInOutQuad(a,e,b,f){return 1>(a/=f/2)?b/2*a*a+e:-b/2*(--a*(a-2)-1)+e}static EaseInCubic(a,e,b,c){return b*(a/=c)*a*a+e}static EaseOutCubic(a,e,b,c){return b*((a=a/c-1)*a*a+1)+e}static EaseInOutCubic(a,e,b,c){return 1>(a/=c/2)?b/2*a*a*a+e:b/2*((a-=2)*a*a+2)+e}static EaseInQuart(a,e,b,c){return b*(a/=c)*a*a*a+e}static EaseOutQuart(a,e,b,f){return-b*((a=a/f-1)*a*a*a-1)+e}static EaseInOutQuart(a,e,b,f){return 1>(a/=f/2)?b/2*a*a*a*a+e:-b/2*((a-=2)*a*a*a-2)+e}static EaseInQuint(a,e,b,c){return b*(a/=c)*a*a*a*a+e}static EaseOutQuint(a,e,b,c){return b*((a=a/c-1)*a*a*a*a+1)+e}static EaseInOutQuint(a,e,b,c){return 1>(a/=c/2)?b/2*a*a*a*a*a+e:b/2*((a-=2)*a*a*a*a+2)+e}static EaseInSine(a,e,b,f){return-b*j(a/f*(k/2))+b+e}static EaseOutSine(a,e,b,c){return b*i(a/c*(k/2))+e}static EaseInOutSine(a,e,b,f){return-b/2*(j(k*a/f)-1)+e}static EaseInExpo(a,e,b,c){return 0===a?e:b*h(2,10*(a/c-1))+e}static EaseOutExpo(a,e,b,c){return a===c?e+b:b*(-h(2,-10*a/c)+1)+e}static EaseInOutExpo(a,e,b,c){return 0===a?e:a===c?e+b:1>(a/=c/2)?b/2*h(2,10*(a-1))+e:b/2*(-h(2,-10*--a)+2)+e}static EaseInCirc(a,e,b,f){return-b*(g(1-(a/=f)*a)-1)+e}static EaseOutCirc(a,e,b,c){return b*g(1-(a=a/c-1)*a)+e}static EaseInOutCirc(a,e,b,f){return 1>(a/=f/2)?-b/2*(g(1-a*a)-1)+e:b/2*(g(1-(a-=2)*a)+1)+e}static EaseInElastic(g,j,b,c){let d=1.70158,l=0,m=b;return 0===g?j:1===(g/=c)?j+b:(l||(l=.3*c),m<f(b)?(m=b,d=l/4):d=l/(2*k)*e(b/m),-(m*h(2,10*(g-=1))*i((g*c-d)*(2*k)/l))+j)}static EaseOutElastic(g,j,b,c){let d=1.70158,l=0,m=b;return 0===g?j:1===(g/=c)?j+b:(l||(l=.3*c),m<f(b)?(m=b,d=l/4):d=l/(2*k)*e(b/m),m*h(2,-10*g)*i((g*c-d)*(2*k)/l)+b+j)}static EaseInOutElastic(g,j,b,c){let d=1.70158,l=0,m=b;return 0===g?j:2==(g/=c/2)?j+b:(l||(l=c*(1.5*.3)),m<f(b)?(m=b,d=l/4):d=l/(2*k)*e(b/m),1>g?-.5*(m*h(2,10*(g-=1))*i((g*c-d)*(2*k)/l))+j:.5*(m*h(2,-10*(g-=1))*i((g*c-d)*(2*k)/l))+b+j)}static EaseInBack(a,e,b,c,d){return void 0===d&&(d=1.70158),b*(a/=c)*a*((d+1)*a-d)+e}static EaseOutBack(a,e,b,c,d){return void 0===d&&(d=1.70158),b*((a=a/c-1)*a*((d+1)*a+d)+1)+e}static EaseInOutBack(a,e,b,c,d){return void 0===d&&(d=1.70158),1>(a/=c/2)?b/2*(a*a*(((d*=1.525)+1)*a-d))+e:b/2*((a-=2)*a*(((d*=1.525)+1)*a+d)+2)+e}static EaseInBounce(a,e,b,c){return b-s.EaseOutBounce(c-a,0,b,c)+e}static EaseOutBounce(a,e,b,c){return(a/=c)<1/2.75?b*(7.5625*a*a)+e:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+.75)+e:a<2.5/2.75?b*(7.5625*(a-=2.25/2.75)*a+.9375)+e:b*(7.5625*(a-=2.625/2.75)*a+.984375)+e}static EaseInOutBounce(a,e,b,c){return a<c/2?.5*s.EaseInBounce(2*a,0,b,c)+e:.5*s.EaseOutBounce(2*a-c,0,b,c)+.5*b+e}static EaseCubicBezier(a,b,c,d,e){return b+3*a*(c-b)+3*a**2*(b+d-2*c)+a**3*(e-b+3*c-3*d)}static EaseSpline(d,e,f,g,h,i,j,k,l,m){const n=u(d,e,g,i,k,m),o=r(f,h,j,l),p=a(f,h,j,l),q=b(f,h,j,l);return c(n,o,p,q)}static GetBezierSamples(d,e,f,g){const h=[],j=r(d,e,f,g),k=a(d,e,f,g),l=b(d,e,f,g);for(let a=0;a<p;++a){const b=c(a*q,j,k,l);h.push(b)}return h}};const p=11,q=1/10,r=(a,b,c,d)=>d-3*c+3*b-a,a=(a,b,c)=>3*c-6*b+3*a,b=(a,b)=>3*(b-a),c=(d,e,a,b)=>((e*d+a)*d+b)*d,s=(d,e,a,b)=>3*e*d*d+2*a*d+b,u=(d,e,g,h,i,j)=>{if(1==d)return 1;let k=0,l=1,m=j[l],n=j[10];for(;l!=10&&m<=d;)l++,m=j[l],k+=q;l--,m=j[l];const o=(d-m)/(j[l+1]-m);let p=k+o*q;const t=r(e,g,h,i),u=a(e,g,h,i),v=b(e,g,h,i),w=s(p,t,u,v);if(0===w)return p;if(w>=.02){for(let a=0;4>a;++a){const a=c(p,t,u,v)-d,b=s(p,t,u,v);p-=a/b}return p}else{let a,b,e=k,g=k+q,h=0;do{p=e+(g-e)/2;let i=c(p,t,u,v)-d;0<i?g=p:e=p,a=f(i)>1e-7,b=10>++h}while(a&&b);return p}}})();
// ../lib/misc/probability.js
"use strict";{function a(a){if(!C3.IsString(a));}C3.ProbabilityTable=class{constructor(){this._items=[],this._totalWeight=0}Release(){this.Clear(),this._items=null}Clear(){C3.clear2DArray(this._items),this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(a=Math.random()*this.GetTotalWeight()){let b=0;for(const[c,d]of this._items)if(b+=c,a<b)return d;return 0}AddItem(b,c){a(c),this._totalWeight+=b,this._items.push([b,c])}RemoveItem(b,c){a(c);for(let a=0;a<this._items.length;a++){const d=this._items[a],e=0===b||d[0]===b,f=d[1]===c;if(e&&f){this._items.splice(a,1),this._totalWeight-=d[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(a){const b=new C3.ProbabilityTable,c=JSON.parse(a);for(const d of c){const a=d[0],c=d[1];b.AddItem(a,c)}return b}}}
// ../lib/events/event.js
"use strict";C3.Event=class{constructor(a,b){this.type=a,this.cancelable=!!b,this.defaultPrevented=!1,this.propagationStopped=!1,this.isAsync=!1}preventDefault(){if(!this.cancelable)throw new Error(`event '${this.type}' is not cancelable`);this.defaultPrevented=!0}stopPropagation(){if(!this.cancelable)throw new Error(`event '${this.type}' cannot be stopped`);if(this.isAsync)throw new Error(`cannot stop async event '${this.type}' propagation`);this.propagationStopped=!0}};
// ../lib/events/handler.js
"use strict";C3.Event.Handler=class extends C3.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||(C3.clearArray(this._captureListeners),this._captureListenersSet.clear(),C3.clearArray(this._listeners),this._listenersSet.clear(),C3.clearArray(this._queueAddListeners),C3.clearArray(this._queueRemoveCaptureListeners),C3.clearArray(this._queueRemoveListeners),C3.Release(this))}_AddListener(a,b){if(this._IsFiring())return void this._queueAddListeners.push([a,b]);if(b){if(this._captureListenersSet.has(a))return;this._captureListeners.push(a),this._captureListenersSet.add(a)}else{if(this._listenersSet.has(a))return;this._listeners.push(a),this._listenersSet.add(a)}}_RemoveListener(a,b){return this._IsFiring()?void(b?this._queueRemoveCaptureListeners.push(a):this._queueRemoveListeners.push(a)):void(b?this._captureListenersSet.has(a)&&(this._captureListenersSet.delete(a),C3.arrayFindRemove(this._captureListeners,a)):this._listenersSet.has(a)&&(this._listenersSet.delete(a),C3.arrayFindRemove(this._listeners,a)))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){for(let a of this._queueAddListeners)this._AddListener(...a);C3.clearArray(this._queueAddListeners);for(const a of this._queueRemoveListeners)this._listenersSet.delete(a);for(const a of this._queueRemoveCaptureListeners)this._captureListenersSet.delete(a);const a=new Set(this._queueRemoveListeners),b=new Set(this._queueRemoveCaptureListeners);C3.arrayRemoveAllInSet(this._listeners,a),C3.arrayRemoveAllInSet(this._captureListeners,b),C3.clearArray(this._queueRemoveCaptureListeners),C3.clearArray(this._queueRemoveListeners)}_FireCancellable(a){this._IncreaseFireDepth();let b=!1;for(let c=0,d=this._captureListeners.length;c<d;++c)if(this._captureListeners[c](a),a.propagationStopped){b=!0;break}if(!b)for(let b=0,c=this._listeners.length;b<c&&(this._listeners[b](a),!a.propagationStopped);++b);return this._DecreaseFireDepth(),!a.defaultPrevented}_FireNonCancellable(a){this._IncreaseFireDepth();for(let b=0,c=this._captureListeners.length;b<c;++b)this._captureListeners[b](a);for(let b=0,c=this._listeners.length;b<c;++b)this._listeners[b](a);return this._DecreaseFireDepth(),!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 c,d=0,e=this._captureListeners.length;d<e;++d)c=this._captureListeners[d],b.push(C3.Asyncify(()=>c(a)));for(let c,d=0,e=this._listeners.length;d<e;++d)c=this._listeners[d],b.push(C3.Asyncify(()=>c(a)));return Promise.all(b).then(()=>!a.defaultPrevented)}_FireAndWait_AsyncOptional(a){const b=[];this._IncreaseFireDepth();for(let c=0,d=this._captureListeners.length;c<d;++c){const d=this._captureListeners[c](a);d instanceof Promise&&b.push(d)}for(let c=0,d=this._listeners.length;c<d;++c){const d=this._listeners[c](a);d instanceof Promise&&b.push(d)}return this._DecreaseFireDepth(),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 b=0,c=this._captureListeners.length;b<c;++b){const c=this._captureListeners[b](a);c instanceof Promise&&(await c)}for(let b=0,c=this._listeners.length;b<c;++b){const c=this._listeners[b](a);c instanceof Promise&&(await c)}return this._DecreaseFireDepth(),!a.defaultPrevented}*_FireAsGenerator(a){this._IncreaseFireDepth();for(let b=0,c=this._captureListeners.length;b<c;++b){const c=this._captureListeners[b](a);C3.IsIterator(c)&&(yield*c)}for(let b=0,c=this._listeners.length;b<c;++b){const c=this._listeners[b](a);C3.IsIterator(c)&&(yield*c)}this._DecreaseFireDepth()}};
// ../lib/events/dispatcher.js
"use strict";C3.Event.Dispatcher=class extends C3.DefendedBase{constructor(){super(),this._eventHandlers=new Map,this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw new Error("already released");this.ClearEvents(),this._dispatcherWasReleased=!0,C3.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let a of this._eventHandlers.values())a.Release();this._eventHandlers.clear()}_GetHandlerByType(a,b){let c=this._eventHandlers.get(a);return c?c:b?(c=C3.New(C3.Event.Handler,a),this._eventHandlers.set(a,c),c):null}addEventListener(a,b,c){let d=this._GetHandlerByType(a,!0);d._AddListener(b,!!c)}removeEventListener(a,b,c){let d=this._GetHandlerByType(a,!1);d&&(d._RemoveListener(b,!!c),d._IsEmpty()&&this._eventHandlers.delete(a))}dispatchEvent(a){const b=this._GetHandlerByType(a.type,!1);return!b||(a.cancelable?b._FireCancellable(a):b._FireNonCancellable(a))}dispatchEventAsync(a){const b=this._GetHandlerByType(a.type,!1);return b?(a.isAsync=!0,b._FireAsync(a)):Promise.resolve(!0)}async dispatchEventAndClearAsync(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return!0;this._eventHandlers.delete(a.type),a.isAsync=!0;const c=await b._FireAsync(a);return b.Release(),c}async dispatchEventAndWaitAsync(a){const b=this._GetHandlerByType(a.type,!1);return!b||(await b._FireAndWaitAsync(a))}dispatchEventAndWait_AsyncOptional(a){const b=this._GetHandlerByType(a.type,!1);return!b||b._FireAndWait_AsyncOptional(a)}async dispatchEventAndWaitAsyncSequential(a){const b=this._GetHandlerByType(a.type,!1);return!b||(await b._FireAndWaitAsyncSequential(a))}dispatchGeneratorEvent(a){const b=this._GetHandlerByType(a.type,!1);if(!b)return null;if(a.cancelable)throw new Error("not supported");else return b._FireAsGenerator(a)}SetDelayRemoveEventsEnabled(a){for(const b of this._eventHandlers.values())b.SetDelayRemoveEventsEnabled(a)}};
// ../lib/util/asyncify.js
"use strict";{function a(a){i=g&&0===j?requestIdleCallback(b,{timeout:f}):setTimeout(b,0<j?1:a)}function b(b){if(i=-1,!h.length)return;let f=performance.now(),k=f,l=0,m=0;do c(h.shift()),k=performance.now(),++l,m=1.1*((k-f)/l);while(h.length&&(g&&0===j&&"undefined"!=typeof b?m<b["timeRemaining"]():k-f+m<d));if(-1===i&&h.length){let b=k-f,c=Math.max(e-b,4);a(c)}}function c(a){let b;try{b=a.func()}catch(b){return void a.reject(b)}a.resolve(b)}const d=12,e=16,f=35,g="undefined"!=typeof requestIdleCallback;let h=[],i=-1,j=0;let k=C3.QueryString.Has("disable-asyncify");k&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously."),C3.Asyncify=function(b){let d=null;return C3.isDebug&&(d=C3.GetCallStack()),new Promise((e,f)=>(h.push({func:b,resolve:e,reject:f,stack:d}),k?void c(h.pop()):void(-1===i&&a(16))))},C3.Asyncify.SetHighThroughputMode=function(a){if(a)++j;else if(--j,0>j)throw new Error("already turned off high throughput mode")}}
// ../lib/util/idleTimeout.js
"use strict";{function a(){e=-1}function b(){f=-1,g=-1;let a=Date.now();for(let b of h)if(b._CheckTimeout(a)){let a=b._GetDeadline();(-1===g||a<g)&&(g=a)}else h.delete(b);if(-1!==g){let e=Math.max(g-a+d,c);f=self.setTimeout(b,e)}}const c=1e3,d=100;let e=-1;C3.FastGetDateNow=function(){return-1===e&&(e=Date.now(),self.setTimeout(a,16)),e};let f=-1,g=-1,h=new Set;C3.IdleTimeout=class{constructor(a,b){this._callback=a,this._timeout=1e3*b,this._deadline=0,this._isActive=!1}Reset(){let a=C3.FastGetDateNow();this._deadline=a+this._timeout,this._isActive||(h.add(this),this._isActive=!0),-1===f?(g=this._deadline,f=self.setTimeout(b,this._timeout+100)):this._deadline<g&&g>a+c&&(self.clearTimeout(f),g=this._deadline,f=self.setTimeout(b,this._timeout+100))}_CheckTimeout(a){return!(a>=this._deadline)||(this._callback()?(this._deadline=a+this._timeout,!0):(this._isActive=!1,!1))}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(h.delete(this),this._isActive=!1,0===h.size&&-1!==f&&(self.clearTimeout(f),f=-1,g=-1))}Release(){this.Cancel(),this._callback=null}}}
// ../lib/util/disposable.js
"use strict";C3.Disposable=class a{constructor(a){this._disposed=!1,this._disposeAction=a}Dispose(){this._disposed||(this._disposed=!0,this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(b){return new a(()=>b.Release())}static From(a,b,c,d,e){if("undefined"==typeof d||null===d)d=!1;else if("boolean"!=typeof d&&"object"!=typeof d)throw new TypeError("invalid event listener options");if(e&&(c=c.bind(e)),b.includes(" ")){b=b.split(" ");const e=new C3.CompositeDisposable;for(let f of b)a.addEventListener(f,c,d),e.Add(C3.New(C3.Disposable,()=>a.removeEventListener(f,c,d)));return e}return a.addEventListener(b,c,d),C3.New(C3.Disposable,()=>a.removeEventListener(b,c,d))}},C3.StubDisposable=class extends C3.Disposable{SetAction(a){this._disposeAction=a}},C3.CompositeDisposable=class extends C3.Disposable{constructor(...a){super(),this._disposables=new Set;for(let b of a)this.Add(b)}Add(...a){if(this._disposed)throw new Error("already disposed");for(let b of a)this._disposables.add(b)}Remove(a){if(this._disposed)throw new Error("already disposed");this._disposables.delete(a)}RemoveAll(){if(this._disposed)throw new 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 new Error("already disposed");this._disposed=!0;for(let a of this._disposables)a.Dispose();this._disposables.clear(),this._disposables=null}Release(){this.Dispose()}};
// c3/lib/util/kahanSum.js
"use strict";C3.KahanSum=class extends C3.DefendedBase{constructor(){super(),this._c=0,this._y=0,this._t=0,this._sum=0}Add(a){a=+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._c=0,this._y=0,this._t=0,this._sum=0}Set(a){this._c=0,this._y=0,this._t=0,this._sum=+a}Release(){}};
// c3/lib/util/redblackset.js
"use strict";{const a={};a.RBnode=function(a){this.tree=a,this.right=this.tree.sentinel,this.left=this.tree.sentinel,this.parent=null,this.color=!1,this.key=null},a.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(c,a){return c<a?-1:a<c?1:0},a.RedBlackSet.prototype.clone=function(){var b=new a.RedBlackSet(this.compare);return b.insertAll(this),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(a){var b=a.right;a.right=b.left,b.left!=this.sentinel&&(b.left.parent=a),b.parent=a.parent,a.parent==this.sentinel?this.root=b:a==a.parent.left?a.parent.left=b:a.parent.right=b,b.left=a,a.parent=b},a.RedBlackSet.prototype.rightRotate=function(a){var b=a.left;a.left=b.right,b.right!=this.sentinel&&(b.right.parent=a),b.parent=a.parent,a.parent==this.sentinel?this.root=b:a==a.parent.right?a.parent.right=b:a.parent.left=b,b.right=a,a.parent=b},a.RedBlackSet.prototype.insert=function(b){if(!this.contains(b)){var c=new a.RBnode(this);c.key=b;for(var d=this.sentinel,e=this.root;e!=this.sentinel;)d=e,e=0>this.compare(c.key,e.key)?e.left:e.right;c.parent=d,d==this.sentinel?this.root=c:0>this.compare(c.key,d.key)?d.left=c:d.right=c,c.left=this.sentinel,c.right=this.sentinel,c.color=!0,this.insertFixup(c),this.size++}else{var f=this.get_(b);f.key=b}},a.RedBlackSet.prototype.insertFixup=function(a){for(;a!=this.sentinel&&a!=this.root&&a.parent.color==!0;)if(a.parent==a.parent.parent.left){var b=a.parent.parent.right;b.color==!0?(a.parent.color=!1,b.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.right&&(a=a.parent,this.leftRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.rightRotate(a.parent.parent))}else{var b=a.parent.parent.left;b.color==!0?(a.parent.color=!1,b.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.left&&(a=a.parent,this.rightRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.leftRotate(a.parent.parent))}this.root.color=!1},a.RedBlackSet.prototype.delete_=function(a){var b,c;b=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a),c=b.left==this.sentinel?b.right:b.left,c.parent=b.parent,b.parent==this.sentinel?this.root=c:b==b.parent.left?b.parent.left=c:b.parent.right=c,b!=a&&(a.key=b.key),b.color==!1&&this.deleteFixup(c),this.size--},a.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&a.color==!1;)if(a==a.parent.left){var b=a.parent.right;b.color==!0&&(b.color=!1,a.parent.color=!0,this.leftRotate(a.parent),b=a.parent.right),b.left.color==!1&&b.right.color==!1?(b.color=!0,a=a.parent):(b.right.color==!1&&(b.left.color=!1,b.color=!0,this.rightRotate(b),b=a.parent.right),b.color=a.parent.color,a.parent.color=!1,b.right.color=!1,this.leftRotate(a.parent),a=this.root)}else{var b=a.parent.left;b.color==!0&&(b.color=!1,a.parent.color=!0,this.rightRotate(a.parent),b=a.parent.left),b.right.color==!1&&b.left.color==!1?(b.color=!0,a=a.parent):(b.left.color==!1&&(b.right.color=!1,b.color=!0,this.leftRotate(b),b=a.parent.left),b.color=a.parent.color,a.parent.color=!1,b.left.color=!1,this.rightRotate(a.parent),a=this.root)}a.color=!1},a.RedBlackSet.prototype.remove=function(a){var b=this.get_(a);if(b!=this.sentinel){var c=b.key;return this.delete_(b),c}return null},a.RedBlackSet.prototype.removeSwapped=function(a,b){this.remove(b)},a.RedBlackSet.prototype.min=function(a){for(;a.left!=this.sentinel;)a=a.left;return a},a.RedBlackSet.prototype.max=function(a){for(;a.right!=this.sentinel;)a=a.right;return a},a.RedBlackSet.prototype.successor_=function(a){if(a.right!=this.sentinel)return this.min(a.right);for(var b=a.parent;b!=this.sentinel&&a==b.right;)a=b,b=b.parent;return b},a.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var b=a.parent;b!=this.sentinel&&a==b.left;)a=b,b=b.parent;return b},a.RedBlackSet.prototype.successor=function(a){if(0<this.size){var b=this.get_(a);if(b==this.sentinel)return null;if(b.right!=this.sentinel)return this.min(b.right).key;for(var c=b.parent;c!=this.sentinel&&b==c.right;)b=c,c=c.parent;return c==this.sentinel?null:c.key}return null},a.RedBlackSet.prototype.predecessor=function(a){if(0<this.size){var b=this.get_(a);if(b==this.sentinel)return null;if(b.left!=this.sentinel)return this.max(b.left).key;for(var c=b.parent;c!=this.sentinel&&b==c.left;)b=c,c=c.parent;return c==this.sentinel?null:c.key}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(a){for(var b=this.root;b!=this.sentinel&&0!=this.compare(b.key,a);)b=0>this.compare(a,b.key)?b.left:b.right;return b},a.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key},a.RedBlackSet.prototype.getValues=function(){var a=[];return this.forEach(function(b){a.push(b)}),a},a.RedBlackSet.prototype.insertAll=function(b){if("array"==a.typeOf(b))for(var c=0;c<b.length;c++)this.insert(b[c]);else if("function"==a.typeOf(b.forEach))b.forEach(this.insert,this);else if("function"==a.typeOf(b.getValues))for(var d=b.getValues(),c=0;c<d.length;c++)this.insert(d[c]);else if("object"==a.typeOf(b))for(var e in b)this.insert(b[e])},a.RedBlackSet.prototype.removeAll=function(b){if("array"==a.typeOf(b))for(var c=0;c<b.length;c++)this.remove(b[c]);else if("function"==a.typeOf(b.forEach))b.forEach(this.removeSwapped,this);else if("function"==a.typeOf(b.getValues))for(var d=b.getValues(),c=0;c<d.length;c++)this.remove(d[c]);else if("object"==a.typeOf(b))for(var e in b)this.remove(b[e])},a.RedBlackSet.prototype.containsAll=function(b){if("array"==a.typeOf(b)){for(var c=0;c<b.length;c++)if(!this.contains(b[c]))return!1;return!0}if("function"==a.typeOf(b.forEach))return b.every(this.contains,this);if("function"==a.typeOf(b.getValues)){for(var d=b.getValues(),c=0;c<d.length;c++)if(!this.contains(d[c]))return!1;return!0}if("object"==a.typeOf(b)){for(var e in b)if(!this.contains(b[e]))return!1;return!0}},a.RedBlackSet.prototype.range=function(a,b){var c=[];return this.traverseFromTo(function(a){c.push(a)},a,b),c},a.RedBlackSet.prototype.traverse=function(a,b){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;){if(a.call(b,c.key,this))return;c=this.successor_(c)}},a.RedBlackSet.prototype.traverseFrom=function(a,b,c){if(!this.isEmpty())for(var d=this.get_(b);d!=this.sentinel;){if(a.call(c,d.key,this))return;d=this.successor_(d)}},a.RedBlackSet.prototype.traverseTo=function(a,b,c){if(!this.isEmpty())for(var d=this.min(this.root),e=this.get_(b);d!=e;){if(a.call(c,d.key,this))return;d=this.successor_(d)}},a.RedBlackSet.prototype.traverseFromTo=function(a,b,c,d){if(!this.isEmpty())for(var e=this.get_(b),f=this.get_(c);e!=f;){if(a.call(d,e.key,this))return;e=this.successor_(e)}},a.RedBlackSet.prototype.traverseBackwards=function(a,b){if(!this.isEmpty())for(var c=this.max(this.root);c!=this.sentinel;){if(a.call(b,c.key,this))return;c=this.predeccessor_(c)}},a.RedBlackSet.prototype.forEach=function(a,b){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.call(b,c.key,c.key,this)},a.RedBlackSet.prototype.some=function(a,b){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(a.call(b,c.key,c.key,this))return!0;return!1},a.RedBlackSet.prototype.every=function(a,b){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(!a.call(b,c.key,c.key,this))return!1;return!0},a.RedBlackSet.prototype.map=function(a,b){var c=[];if(this.isEmpty())return c;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))c.push(a.call(b,d.key,d.key,this));return c},a.RedBlackSet.prototype.filter=function(a,b){var c=[];if(this.isEmpty())return c;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))a.call(b,d.key,d.key,this)&&c.push(d.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 c=a.getCount(b);if(this.getCount()>c)return!1;var d=0;if(this.isEmpty())return!0;for(var e=this.min(this.root);e!=this.sentinel;e=this.successor_(e))a.contains.call(b,b,e.key)&&d++;return d==this.getCount()},a.RedBlackSet.prototype.intersection=function(b){var c=new a.RedBlackSet(this.compare);if(this.isEmpty())return c;for(var d=this.min(this.root);d!=this.sentinel;d=this.successor_(d))b.contains.call(b,d.key,d.key,this)&&c.insert(d.key);return c},C3.RedBlackSet=class extends C3.DefendedBase{constructor(b){super();this._rbSet=new a.RedBlackSet(b),this._enableQueue=!1,this._queueInsert=new Set,this._queueRemove=new Set}Add(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.delete(a):this._queueInsert.add(a):this._rbSet.insert(a)}Remove(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.add(a):this._queueInsert.delete(a):this._rbSet.remove(a)}Has(a){return this._enableQueue?!!this._queueInsert.has(a)||!this._queueRemove.has(a)&&this._rbSet.contains(a):this._rbSet.contains(a)}Clear(){this._rbSet.clear(),this._queueInsert.clear(),this._queueRemove.clear()}toArray(){if(this._enableQueue)throw new 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 new Error("empty set");if(this._enableQueue)throw new Error("cannot be used in queueing mode");const a=this._rbSet,b=a.min(a.root);return b.key}Shift(){if(this.IsEmpty())throw new Error("empty set");if(this._enableQueue)throw new Error("cannot be used in queueing mode");const a=this.Front();return this.Remove(a),a}SetQueueingEnabled(a){if((a=!!a,this._enableQueue!==a)&&(this._enableQueue=a,!a)){for(const a of this._queueRemove)this._rbSet.remove(a);this._queueRemove.clear();for(const a of this._queueInsert)this._rbSet.insert(a);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){const a=this._rbSet;for(let b=a.min(a.root);b!=a.sentinel;b=a.successor_(b))yield b.key}}[Symbol.iterator](){return this.values()}}}
// ../lib/util/promiseThrottle.js
"use strict";C3.PromiseThrottle=class{constructor(a=C3.hardwareConcurrency){this._maxParallel=a,this._queue=[],this._activeCount=0}Add(a){return new Promise((b,c)=>{this._queue.push({func:a,resolve:b,reject:c}),this._MaybeStartNext()})}_FindInQueue(a){for(let b=0,c=this._queue.length;b<c;++b)if(this._queue[b].func===a)return b;return-1}RemoveAndResolve(a,b){const c=this._FindInQueue(a);if(-1===c)throw new Error("cannot find promise to resolve");this._queue[c].resolve(b),this._queue.splice(c,1)}RemoveAndReject(a,b){const c=this._FindInQueue(a);if(-1===c)throw new Error("cannot find promise to reject");this._queue[c].reject(b),this._queue.splice(c,1)}async _MaybeStartNext(){if(this._queue.length&&!(this._activeCount>=this._maxParallel)){this._activeCount++;const 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 c=[];let d=!1;const e=async()=>{for(let a;a=b.pop();){if(d)return;try{c.push((await a()))}catch(a){throw d=!0,a}}},f=[];for(;a--;)f.push(e());return await Promise.all(f),c}};
// ../lib/util/rateLimiter.js
"use strict";C3.RateLimiter=class{constructor(a,b,c){this._callback=a,this._interval=b,this._intervalOnBattery=c||2*b,this._timerId=-1,this._lastCallTime=-Infinity,this._timerCallFunc=()=>this._OnTimer(),this._ignoreReset=!1,this._canRunImmediate=!1,this._callbackArguments=null}SetCanRunImmediate(a){this._canRunImmediate=!!a}_GetInterval(){return"undefined"!=typeof C3.Battery&&C3.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...a){if(-1===this._timerId){this._callbackArguments=a;let b=C3.FastGetDateNow(),c=b-this._lastCallTime,d=this._GetInterval();c>=d&&this._canRunImmediate?(this._lastCallTime=b,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(d-c,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=C3.FastGetDateNow())}_OnTimer(){this._timerId=-1,this._lastCallTime=C3.FastGetDateNow(),this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer(),this._callback=null,this._callbackArguments=null,this._timerCallFunc=null}};
// ../lib/util/svgRaster/svgRasterManager.js
"use strict";C3.SVGRasterManager=class{constructor(){this._images=new Map,this._allowNpotSurfaces=!1,this._getBaseSizeCallback=null,this._rasterAtSizeCallback=null,this._releaseResultCallback=null,this._redrawCallback=null}SetNpotSurfaceAllowed(b){this._allowNpotSurfaces=!!b}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(a){this._getBaseSizeCallback=a}GetBaseSize(a){if(!this._getBaseSizeCallback)throw new Error("no get base size callback set");return this._getBaseSizeCallback(a)}SetRasterAtSizeCallback(a){this._rasterAtSizeCallback=a}RasterAtSize(a,b,c,d,e,f){if(!this._rasterAtSizeCallback)throw new Error("no raster at size callback set");return this._rasterAtSizeCallback(a,b,c,d,e,f)}SetReleaseResultCallback(a){this._releaseResultCallback=a}ReleaseResult(a){if(!this._releaseResultCallback)throw new Error("no release result callback set");this._releaseResultCallback(a)}SetRedrawCallback(a){this._redrawCallback=a}Redraw(){if(!this._redrawCallback)throw new Error("no redraw callback set");this._redrawCallback()}AddImage(a){let b=this._images.get(a);return b||(b=C3.New(C3.SVGRasterImage,this,a),this._images.set(a,b)),b.IncReference(),b}_RemoveImage(a){this._images.delete(a.GetDataSource())}};
// ../lib/util/svgRaster/svgRasterImage.js
"use strict";{const a=2048;C3.SVGRasterImage=class{constructor(a,b){this._manager=a,this._dataSource=b,this._refCount=0,this._baseWidth=0,this._baseHeight=0,this._getBaseSizePromise=this._manager.GetBaseSize(b).then((a)=>{this._baseWidth=a[0],this._baseHeight=a[1],this._manager.Redraw()}).catch((a)=>{console.error("[SVG] Error loading SVG: ",a),this._hadError=!0,this._manager.Redraw()}),this._rasterSurfaceWidth=0,this._rasterSurfaceHeight=0,this._rasterImageWidth=0,this._rasterImageHeight=0,this._isRasterizing=!1,this._rasterizedResult=null,this._forceRaster=!1,this._hadError=!1}Release(){if(0>=this._refCount)throw new Error("already released");this._refCount--,0===this._refCount&&this._Release()}_Release(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null),this._manager._RemoveImage(this),this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return 0<this._refCount}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=!0}async StartRasterForSize(b,c,d){var e=Math.min,f=Math.ceil;if(0===c||0===d||this._hadError)return;if(this._isRasterizing)return;let g=C3.nextHighestPowerOfTwo(f(c)),h=C3.nextHighestPowerOfTwo(f(d));const i=Math.max(g,h);if(i>a){const b=a/i;c*=b,d*=b,g=e(f(g*b),a),h=e(f(h*b),a)}if(c<g&&d<h){const a=c/d,b=g/h;b>a?(c=h*a,d=h):(c=g,d=g/a)}if(this._manager.IsNpotSurfaceAllowed()&&(g=f(c),h=f(d)),!(g<=this._rasterSurfaceWidth&&h<=this._rasterSurfaceHeight&&!this._forceRaster)){this._isRasterizing=!0,this._rasterSurfaceWidth=g,this._rasterSurfaceHeight=h;const a=await this._manager.RasterAtSize(this._dataSource,b,this._rasterSurfaceWidth,this._rasterSurfaceHeight,c,d);this._rasterizedResult&&this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=a,this._rasterImageWidth=c,this._rasterImageHeight=d,this._isRasterizing=!1,this._forceRaster=!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}}}
// ../lib/str/str.js
"use strict";{function a(a){return e.get(a)}C3.UTF8_BOM="\uFEFF";const b=new Set([..."0123456789"]);C3.IsNumericChar=function(a){return b.has(a)};const d=new Set([..." \t\n\r\xA0\x85\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2028\u2029\u202F\u205F\u3000"]);C3.IsWhitespaceChar=function(a){return d.has(a)},C3.FilterWhitespace=function(a){return[...a].filter((a)=>!C3.IsWhitespaceChar(a)).join("")},C3.IsStringAllWhitespace=function(a){for(const b of a)if(!C3.IsWhitespaceChar(b))return!1;return!0},C3.IsUnprintableChar=function(a){return 1===a.length&&32>a.charCodeAt(0)},C3.FilterUnprintableChars=function(a){return[...a].filter((a)=>!C3.IsUnprintableChar(a)).join("")};const c=new Set([..."0123456789.+-e"]);C3.IsStringNumber=function(a){if(a=a.trim(),!a.length)return!1;let d=a.charAt(0);if("-"!==d&&!b.has(d))return!1;for(let b of a)if(!c.has(b))return!1;return!0},C3.RemoveTrailingDigits=function(a){let b=a.length;for(;0<b;){let c=a.charAt(b-1);if(!C3.IsNumericChar(c))break;--b}return a.substr(0,b)},C3.IncrementNumberAtEndOf=function(a){let b=C3.RemoveTrailingDigits(a),c=a.substr(b.length);return c=c?(parseInt(c,10)+1).toString():"2",b+c};const e=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],["\"","&quot;"],["'","&#39;"]]);const f=/[&<>"']/g;C3.EscapeHTML=function(b){return b.replace(f,a)},C3.EscapeJS=function(a){let b=C3.ReplaceAll(a,"\\","\\\\");return b=C3.ReplaceAll(b,"\"","\\\""),b=C3.ReplaceAll(b,"\t","\\t"),b=C3.ReplaceAll(b,"\r",""),C3.ReplaceAll(b,"\n","\\n")},C3.EscapeXML=function(a){let b=C3.ReplaceAll(a,"&","&amp;");return b=C3.ReplaceAll(b,"<","&lt;"),b=C3.ReplaceAll(b,">","&gt;"),C3.ReplaceAll(b,"\"","&quot;")};const g=/[-[\]{}()*+?.,\\^$|#\s]/g;C3.EscapeRegex=function(a){return a.replace(g,"\\$&")},C3.FindAll=function(a,b,c=!1){if(!b)return[];c||(a=a.toLowerCase(),b=b.toLowerCase());const d=b.length;let e=0,f=0,g=[];for(;-1<(f=a.indexOf(b,e));)g.push(f),e=f+d;return g},C3.ReplaceAll=function(a,b,c){return a.replace(new RegExp(C3.EscapeRegex(b),"g"),()=>c)},C3.ReplaceAllCaseInsensitive=function(a,b,c){return a.replace(new RegExp(C3.EscapeRegex(b),"gi"),()=>c)},C3.SetElementContent=function(a,b){"string"==typeof b?a.textContent=b:b.isPlainText()?a.textContent=b.toString():(a.innerHTML=b.toHTML(),b instanceof C3.BBString&&b.attachLinkHandlers(a))},C3.StringLikeEquals=function(c,a){return c instanceof C3.HtmlString||c instanceof C3.BBString?c.equals(a):a instanceof C3.HtmlString||a instanceof C3.BBString?a.equals(c):c===a},C3.StringSubstitute=function(a,...b){let c=a;for(let d=0,e=b.length;d<e;++d){const e=`{${d}}`;if(!a.includes(e))throw new Error(`missing placeholder '${e}' in string substitution`);c=c.replace(e,b[d].toString())}return c},C3.StringSubstituteAllowMissing=function(a,...b){let c=a,d=-1,e=-1;for(let f=0,g=b.length;f<g;++f){const g=`{${f}}`;a.includes(g)?(e=f,c=c.replace(g,b[f].toString())):-1===d&&(d=f)}if(0<=d&&0<=e&&d<e)throw new Error(`missing placeholder '${d}' in string substitution`);return c},C3.StringSubstituteMap=function(a,b){let c=a;for(let[d,e]of Object.entries(b))c=C3.ReplaceAll(c,d,e.toString());return c},C3.SortAZCaseInsensitive=function(c,a){let b=c.toLowerCase(),d=a.toLowerCase();return b>d?1:b<d?-1:0};const h=1024;C3.FormatDataSize=function(a,b){var c=Math.round;let d="common."+(b?"dataRates":"dataSizes")+".";if(a<h)return langSub(d+"bytes",a);if(1048576>a){let b=a/h;return b=10>b?c(10*b)/10:c(b),langSub(d+"kilobytes",b)}if(1073741824>a){let b=a/1048576;return b=10>b?c(10*b)/10:c(b),langSub(d+"megabytes",b)}if(1099511627776>a){let b=a/1073741824;return b=10>b?c(10*b)/10:c(b),langSub(d+"gigabytes",b)}else{let b=a/1099511627776;return b=10>b?c(10*b)/10:c(b),langSub(d+"terabytes",b)}};const i={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};C3.FormatTime=function(a,b){var c=Math.floor;b=Object.assign({},i,b),C3.Lang.PushContext("common.time");const d=[];if(b.days){const b=c(a/86400);0<b&&(a-=3600*(24*b),d.push(langPluralSub(".days",null,b)))}if(b.hours){const b=c(a/3600);(0<b||d.length)&&(a-=3600*b,d.push(langPluralSub(".hours",null,b)))}if(b.minutes){const e=c(a/60);(0<e||d.length||!b.seconds)&&(a-=60*e,d.push(langPluralSub(".minutes",null,e)))}if(b.seconds){const b=c(a%60);d.push(langPluralSub(".seconds",null,b))}const e=(b.approximate?lang(".approx-prefix"):"")+d.join(lang(".separator"));return C3.Lang.PopContext(),e},C3.ZeroPad=function(a,b){let c=0>a?"-":"";a=Math.abs(a);let d=a.toString(),e=b-d.length;for(let d=0;d<e;++d)c+="0";return c+d},C3.StringToTitleCase=function(a){return a.toLowerCase().replace(/\b\w/g,(a)=>a.toUpperCase())},C3.CompareVersionStrings=function(a,b){let c=a.split(".").map((a)=>a.trim()),d=b.split(".").map((a)=>a.trim());C3.resizeArray(c,4,"0"),C3.resizeArray(d,4,"0"),c=c.map((a)=>parseInt(a,10)),d=d.map((a)=>parseInt(a,10));for(let e=0;4>e;++e){const a=c[e]-d[e];if(0!=a)return 0>a?-1:1}return 0},C3.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(a)=>{const b=Math.floor(16*Math.random()),c="x"===a?b:8|3&b;return c.toString(16)})},C3.StringHammingDistance=function(c,a){if(c.length!==a.length)throw new Error("strings must be same length");let b=0;for(let d=0,e=c.length;d<e;++d)c.charAt(d)!==a.charAt(d)&&++b;return b},C3.StringLevenshteinDistance=function(c,a){var b=Math.min;if(0===c.length)return a.length;if(0===a.length)return c.length;let d,e,f,g,h,i;for(c.length>a.length&&(d=c,c=a,a=d),i=Array(c.length+1),e=0;e<=c.length;e++)i[e]=e;for(e=1;e<=a.length;e++){for(g=e,f=1;f<=c.length;f++)h=a[e-1]===c[f-1]?i[f-1]:b(i[f-1]+1,b(g+1,i[f]+1)),i[f-1]=g,g=h;i[c.length]=g}return i[c.length]}}
// ../lib/str/bbstring.js
"use strict";{function a(a,c,d){const g=b.get(d);if(!g)return"class"===d?c?"</span>":`<span class="bbclass${f++}">`:a;else if("string"!=typeof g){if(Array.isArray(g)){let a=g[0],b=g[1];return c?"</"+a+">":`<${a} class="${b}">`}}else if("a"===g&&!c){const a=parseInt(d.substring(1),10)-1;if(0>a||a>=e.length)throw new Error("invalid bbcode link substitution");const b=e[a];if("string"==typeof b)return`<a href="${e[a]}">`;if("function"==typeof b)return`<a class="bblink${a}">`;throw new TypeError("invalid bbcode link action")}else return"<"+c+g+">"}const b=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]],["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]),c=/\[(\/?)([a-zA-Z0-9]+)\]/g,d=/\[(\/?)(.*?)\]/g;let e=null,f=0;const g=/\n/g;C3.BBString=class{constructor(a,b){if(this._bbstr=b&&b.noEscape?a:C3.EscapeHTML(a),this._htmlstr="",this._convertLineBreaks=!1,this._linkActions=[],b&&(this._convertLineBreaks=!!b.convertLineBreaks,b.links)){if(9<b.links.length)throw new Error("too many links");this._linkActions=b.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(c,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let b=this._bbstr;this._hasAnyBBtags&&(f=0,e=this._linkActions,b=b.replace(c,a),e=null),this._needsLineBreakConversion&&(b=b.replace(g,"<br>")),this._htmlstr=b}return this._htmlstr}attachLinkHandlers(a){if(this._linkActions.length)for(let b=0,c=this._linkActions.length;b<c;++b){const c=this._linkActions[b];if("function"!=typeof c)continue;const d=a.querySelector(".bblink"+b);if(!d)throw new Error("unable to attach BBString link handler");d.onclick=c}}equals(a){return a instanceof C3.HtmlString?this.toHTML()===a.toHTML():a instanceof C3.BBString?this._bbstr===a._bbstr:this._bbstr===a}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const a=this._bbstr,b=[];d.lastIndex=0;let c=0,e=null;for(;null!==(e=d.exec(a));){const d=e.index;if(0<d&&"\\"===a.charAt(d-1))continue;const f=e[0],g=e[1],h=e[2],i=a.substring(c,d);if(c=d+f.length,i&&this._fragments.push({text:i,styles:b.slice(0)}),h)if(g){const a=h.toLowerCase();for(let c=b.length-1;0<=c;--c)if(b[c].tag===a){b.splice(c,1);break}}else{let a=h,c=null;const d=h.indexOf("=");-1===d?a=a.toLowerCase():(a=h.substring(0,d).toLowerCase(),c=h.substring(d+1)),b.push({tag:a,param:c})}}c<a.length&&this._fragments.push({text:a.substring(c),styles:b.slice(0)});for(const a of this._fragments)a.text=this._ProcessBBCodeEscapeSequences(a.text);return this._hasParsedFragments=!0,this._fragments}_ProcessBBCodeEscapeSequences(a){return a=C3.ReplaceAll(a,"\\[","["),C3.ReplaceAll(a,"\\\\","\\")}static StripTags(a){return C3.New(C3.BBString,a,{noEscape:!0}).toPlainText()}static StripAnyTags(a){return a.replace(d,"")}}}
// ../lib/str/wordWrap.js
"use strict";C3.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(a,b){let c=0,d=0;for(const e of a){if(-1===e.width){const a=b(e.text,e.styles);e.width=a.width,e.height=a.height}c+=e.width,d=Math.max(d,e.height)}return{width:c,height:d}}_AddLine(a,b,c){this._lines.push({fragments:a,width:b,height:c})}WordWrap(a,b,c,d,e){if("string"==typeof a&&(a=[{text:a,styles:[]}]),C3.clearArray(this._lines),!a.length||1===a.length&&!a[0].text.length||2>c)return;if(1===a.length){const d=a[0],f=d.text,g=d.styles;if(100>=f.length&&!f.includes("\n")){let{width:a,height:d}=b(f,g);if(a+=e,a<=c)return void this._AddLine([{text:f,styles:g,width:a,height:d}],a,d)}}let f;if("word"===d)f=this._TokeniseWords(a);else{f=[];for(const b of a)C3.appendArray(f,[...b.text].map((a)=>[{text:a,styles:b.styles}]))}this._WrapText(f,b,c,e)}_TokeniseWords(a){const b=[];let c=[],d=!1;for(const e of a){const a=e.text,f=e.styles;for(const e of a)if("\n"===e)0<c.length&&b.push(c),b.push([{text:"\n",styles:f}]),c=[];else if(0===c.length)c.push({text:e,styles:f}),d=C3.IsWhitespaceChar(e);else{const a=C3.IsWhitespaceChar(e);if(a===d){const a=c[c.length-1];a.styles===f?a.text+=e:c.push({text:e,styles:f})}else b.push(c),c=[],c.push({text:e,styles:f}),d=a}}return 0<c.length&&b.push(c),b}_CopyLine(a){return a.map((a)=>({text:a.text,styles:a.styles,width:a.width,height:a.height}))}_AddWordToLine(a,b){const c=a.length?a[a.length-1]:null;let d=0;c&&b[0].styles===c.styles&&(c.text+=b[0].text,c.width=-1,c.height=-1,d=1);for(let c=b.length;d<c;++d){const c=b[d];a.push({text:c.text,styles:c.styles,width:-1,height:-1})}}_WrapText(a,b,c,d){let e=[],f=0,g=0;for(const h of a){if(1===h.length&&"\n"===h[0].text){0===g&&(g=b(" ",h[0].styles).height),this._AddLine(e,f,g),e=[],f=0,g=0;continue}const a=this._CopyLine(e);this._AddWordToLine(a,h);const d=this._MeasureLine(a,b),i=d.width,j=d.height;if(!(i>=c))e=a,f=i,g=j;else if(0<e.length&&this._AddLine(e,f,g),e=[],C3.IsStringAllWhitespace(h[0].text))f=0,g=0;else{this._AddWordToLine(e,h);const a=this._MeasureLine(e,b);f=a.width,g=a.height}}0<e.length&&this._AddLine(e,f,g),this._TrimLinesTrailingWhitespace(b,d)}_TrimLinesTrailingWhitespace(a,b){for(const c of this._lines){const d=c.fragments;if(!d.length)continue;let e=d[d.length-1];const f=e.text,g=f.trimEnd();if(!g)c.width-=e.width,d.pop();else if(g.length<f.length){const b=a(g,e.styles).width,d=e.width-b;e.width=b,e.text=g,c.width-=d}0!==b&&0<d.length&&(e=d[d.length-1],e.width+=b,c.width+=b)}}Clear(){C3.clearArray(this._lines)}GetMaxLineWidth(){let a=0;for(const b of this._lines){const c=b.width;a<c&&(a=c)}return a}};
// ../lib/gfx/gfx.js
"use strict";C3.Gfx={};
// ../lib/gfx/rendererBase.js
"use strict";{const a=[0,0,0,0,0,0,0,0],b=vec3.fromValues(0,0,0);C3.Gfx.RendererBase=class{constructor(){this._width=0,this._height=0,this._cam=vec3.fromValues(0,0,100),this._look=vec3.fromValues(0,0,0),this._up=vec3.fromValues(0,1,0),this._worldScale=vec3.fromValues(1,1,1),this._matP=mat4.create(),this._matMV=mat4.create(),this._lastMV=mat4.create(),this._allShaderPrograms=[],this._shaderProgramsByName=new Map,this._spTextureFill=null,this._stateGroups=new Map,this._currentStateGroup=null,this._blendModeTable=[],this._namedBlendModeMap=new Map,this._frameNumber=0}FillIndexBufferData(a){for(let b=0,c=a.length,d=0;b<c;)a[b++]=d,a[b++]=d+1,a[b++]=d+2,a[b++]=d,a[b++]=d+2,a[b++]=d+3,d+=4}Project(b,c,d,e,f){const g=this._matMV,h=this._matP;for(let g=0,h=a.length;g<h;++g)a[g]=0;a[0]=g[0]*b+g[4]*c+g[12],a[1]=g[1]*b+g[5]*c+g[13],a[2]=g[2]*b+g[6]*c+g[14],a[3]=g[3]*b+g[7]*c+g[15],a[4]=h[0]*a[0]+h[4]*a[1]+h[8]*a[2]+h[12]*a[3],a[5]=h[1]*a[0]+h[5]*a[1]+h[9]*a[2]+h[13]*a[3],a[6]=h[2]*a[0]+h[6]*a[1]+h[10]*a[2]+h[14]*a[3],a[7]=-a[2];0===a[7]||(a[7]=1/a[7],a[4]*=a[7],a[5]*=a[7],a[6]*=a[7],f[0]=(.5*a[4]+.5)*d,f[1]=(.5*a[5]+.5)*e)}GetWidth(){return this._width}GetHeight(){return this._height}GetNearZ(){return 1}GetFarZ(){return 10000}SetCameraXYZ(a,b,c){this._cam[0]=a*this._worldScale[0],this._cam[1]=b*this._worldScale[1],this._cam[2]=c}SetLookXYZ(a,b,c){this._look[0]=a*this._worldScale[0],this._look[1]=b*this._worldScale[1],this._look[2]=c}ResetModelView(a){mat4.lookAt(this._matMV,this._cam,this._look,a||this._up),mat4.scale(this._matMV,this._matMV,this._worldScale)}Translate(a,c){0===a&&0===c||(b[0]=a,b[1]=c,b[2]=0,mat4.translate(this._matMV,this._matMV,b))}Scale(a,c){1===a&&1===c||(b[0]=a,b[1]=c,b[2]=1,mat4.scale(this._matMV,this._matMV,b))}RotateZ(b){0===b||mat4.rotateZ(this._matMV,this._matMV,b)}_AddShaderProgram(a){this._allShaderPrograms.push(a),this._shaderProgramsByName.set(a.GetName(),a)}_RemoveShaderProgram(a){const b=this._allShaderPrograms.indexOf(a);-1!==b&&this._allShaderPrograms.splice(b,1),this._shaderProgramsByName.delete(a.GetName())}_ClearAllShaderPrograms(){C3.clearArray(this._allShaderPrograms),this._shaderProgramsByName.clear()}GetShaderProgramByName(a){return this._shaderProgramsByName.get(a)||null}GetTextureFillShaderProgram(){return this._spTextureFill}_SetCurrentStateGroup(a){this._currentStateGroup=a}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(a,b,c,d,e){const f=C3.Gfx.StateGroup.MakeKey(a,b,c,d,e);let g=this._stateGroups.get(f);return g||(g=C3.New(C3.Gfx.StateGroup,this,a,b,c,d,e),this._stateGroups.set(f,g)),g.AddRef(),g}ReleaseStateGroup(a){a.DecRef(),0===a._GetRefCount()&&(this._currentStateGroup===a&&(this._currentStateGroup=null),this._stateGroups.delete(a.GetKey()),a.Release())}_InitBlendModeData(a){C3.clearArray(this._blendModeTable),this._namedBlendModeMap.clear();for(const b of a){const a=b[0],c=b[1],d=b[2];this._blendModeTable.push([c,d]),this._namedBlendModeMap.set(a,{srcBlend:c,destBlend:d})}}_GetBlendByIndex(a){const b=this._blendModeTable;if(0>a||a>=b.length)throw new RangeError("invalid blend index");return b[a]}GetSrcBlendByIndex(a){return this._GetBlendByIndex(a)[0]}GetDestBlendByIndex(a){return this._GetBlendByIndex(a)[1]}GetNamedBlend(a){const b=this._namedBlendModeMap.get(a);if("undefined"==typeof b)throw new Error("invalid blend name");return b}Finish(){this.EndBatch(),this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}}}
// ../lib/gfx/stateGroup.js
"use strict";C3.Gfx.StateGroup=class{constructor(a,b,c,d,e,f){this._renderer=a,this._refCount=0,this._shaderProgram=null,this._shaderProgramName="",this._srcBlend=c,this._destBlend=d,this._color=C3.New(C3.Color),this._color.set(e),this._zElevation=f,"string"==typeof b?this._shaderProgramName=b:(this._shaderProgram=b,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(0<this._refCount)throw new Error("releasing state group still in use");this._renderer=null,this._shaderProgram=null,this._shaderProgramName=""}Apply(){const a=this._renderer;a.SetProgram(this._shaderProgram),a.SetBlend(this._srcBlend,this._destBlend),a.SetColor(this._color),a.SetCurrentZ(this._zElevation),a._SetCurrentStateGroup(this)}GetKey(){return C3.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._srcBlend,this._destBlend,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram=null}OnContextRestored(a){if(this._shaderProgram=a.GetShaderProgramByName(this._shaderProgramName),!this._shaderProgram)throw new Error("failed to restore shader program")}static MakeKey(a,b,d,e,c){const f="string"==typeof a?a:a.GetName();return f+","+b+","+d+","+e.getR()+","+e.getG()+","+e.getB()+","+e.getA()+","+c}};
// ../lib/gfx/webgl/texture.js
"use strict";{function a(a,b){let c,d,e,f;switch(a){case"rgba8":c=b.RGBA8,d=b.RGBA,e=b.RGBA,f=b.UNSIGNED_BYTE;break;case"rgb8":c=b.RGB8,d=b.RGB,e=b.RGB,f=b.UNSIGNED_BYTE;break;case"rgba4":c=b.RGBA4,d=b.RGBA,e=b.RGBA,f=b.UNSIGNED_SHORT_4_4_4_4;break;case"rgb5_a1":c=b.RGB5_A1,d=b.RGBA,e=b.RGBA,f=b.UNSIGNED_SHORT_5_5_5_1;break;case"rgb565":c=b.RGB565,d=b.RGB,e=b.RGB,f=b.UNSIGNED_SHORT_5_6_5;break;default:throw new Error("invalid pixel format");}return{sizedinternalformat:c,internalformat:d,format:e,type:f}}const b=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),c=new Set(["nearest","bilinear","trilinear"]),d=new Set(["default","low","high"]);const e={isTiled:!1,tileType:"repeat",sampling:"trilinear",pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},f={premultiplyAlpha:!0},g=new Set;C3.Gfx.WebGLRendererTexture=class{constructor(a){this._renderer=a,this._texture=null,this._width=0,this._height=0,this._isStatic=!0,this._isTiled=!1,this._tileType="repeat",this._sampling="trilinear",this._pixelFormat="rgba8",this._isMipMapped=!1,this._mipMapQuality="default",this._refCount=0}_CreateStatic(f,h){if(("undefined"==typeof HTMLImageElement||!(f instanceof HTMLImageElement))&&("undefined"==typeof HTMLCanvasElement||!(f instanceof HTMLCanvasElement))&&("undefined"==typeof ImageBitmap||!(f instanceof ImageBitmap))&&("undefined"==typeof OffscreenCanvas||!(f instanceof OffscreenCanvas))&&!(f instanceof ImageData)&&!(f instanceof ArrayBuffer)&&null!==f)throw new Error("invalid texture source");if(h=Object.assign({},e,h),this._texture)throw new Error("already created texture");if(this._isTiled=!!h.isTiled,this._tileType=h.tileType,this._sampling=h.sampling,this._pixelFormat=h.pixelFormat,this._isMipMapped=!!h.mipMap,this._mipMapQuality=h.mipMapQuality,!c.has(this._sampling))throw new Error("invalid sampling");if(!b.has(this._pixelFormat))throw new Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw new Error("invalid mipmap quality");if(this._isStatic=!0,!(f instanceof ArrayBuffer||null===f||h.isSvg))this._width=f.width,this._height=f.height;else if(this._width=h.width,this._height=h.height,f instanceof ArrayBuffer&&f.byteLength!==4*(this._width*this._height))throw new Error("ArrayBuffer wrong size");if(0>=this._width||0>=this._height)throw new Error("invalid texture data size");if(h.isSvg){const a=C3.CreateCanvas(this._width,this._height),b=a.getContext("2d");b.drawImage(f,0,0,this._width,this._height),f=a}const i=C3.isPOT(this._width)&&C3.isPOT(this._height),j=this._renderer.GetMaxTextureSize();if(this._width>j||this._height>j)throw new Error("texture data exceeds maximum texture size");const k=this._renderer.GetContext(),l=this._renderer.GetWebGLVersionNumber();this._texture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,this._texture),k.pixelStorei(k["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],h.premultiplyAlpha);const m=a(this._pixelFormat,k);if(!this._renderer.SupportsNPOTTextures()&&!i&&this._isTiled){if(null===f)throw new Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");if(f instanceof ArrayBuffer&&(f=new ImageData(new Uint8ClampedArray(f),this._width,this._height)),f instanceof ImageData){const a=C3.CreateCanvas(this._width,this._height),b=a.getContext("2d");b.putImageData(f,0,0),f=a}const a=C3.CreateCanvas(C3.nextHighestPowerOfTwo(this._width),C3.nextHighestPowerOfTwo(this._height)),b=a.getContext("2d");b.imageSmoothingEnabled="nearest"!==this._sampling,b.drawImage(f,0,0,this._width,this._height,0,0,a.width,a.height),k.texImage2D(k.TEXTURE_2D,0,m.internalformat,m.format,m.type,a)}else if(2<=l){let a;a=this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,k.texStorage2D(k.TEXTURE_2D,a,m.sizedinternalformat,this._width,this._height),f instanceof ArrayBuffer?k.texSubImage2D(k.TEXTURE_2D,0,0,0,this._width,this._height,m.format,m.type,new Uint8Array(f)):null!==f&&k.texSubImage2D(k.TEXTURE_2D,0,0,0,m.format,m.type,f)}else f instanceof ArrayBuffer?k.texImage2D(k.TEXTURE_2D,0,m.internalformat,this._width,this._height,0,m.format,m.type,new Uint8Array(f)):null===f?k.texImage2D(k.TEXTURE_2D,0,m.internalformat,this._width,this._height,0,m.format,m.type,null):k.texImage2D(k.TEXTURE_2D,0,m.internalformat,m.format,m.type,f);null!==f&&this._SetTextureParameters(k),k.bindTexture(k.TEXTURE_2D,null),this._renderer._ResetLastTexture(),this._refCount=1,g.add(this)}_CreateDynamic(f,h,i){var j=Math.floor;if(i=Object.assign({},e,i),this._texture)throw new Error("already created texture");if(this._isTiled=!!i.isTiled,this._tileType=i.tileType,this._sampling=i.sampling,this._pixelFormat=i.pixelFormat,this._isMipMapped=!!i.mipMap,this._mipMapQuality=i.mipMapQuality,!c.has(this._sampling))throw new Error("invalid sampling");if(!b.has(this._pixelFormat))throw new Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw new Error("invalid mipmap quality");this._isStatic=!1,this._width=j(f),this._height=j(h);const k=C3.isPOT(this._width)&&C3.isPOT(this._height),l=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw new Error("invalid texture size");if(this._width>l||this._height>l)throw new Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._isTiled&&!k)throw new Error("non-power-of-two tiled textures not supported");const m=this._renderer.GetContext(),n=this._renderer.GetWebGLVersionNumber();this._texture=m.createTexture(),m.bindTexture(m.TEXTURE_2D,this._texture),m.pixelStorei(m["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],i.premultiplyAlpha);const o=a(this._pixelFormat,m),p=2<=n?o.sizedinternalformat:o.internalformat;m.texImage2D(m.TEXTURE_2D,0,p,this._width,this._height,0,o.format,o.type,null),this._SetTextureParameters(m),m.bindTexture(m.TEXTURE_2D,null),this._renderer._ResetLastTexture(),this._refCount=1,g.add(this)}_GetMipMapHint(a){if("default"===this._mipMapQuality)return this._isStatic?a.NICEST:a.FASTEST;if("low"===this._mipMapQuality)return a.FASTEST;if("high"===this._mipMapQuality)return a.NICEST;throw new Error("invalid mipmap quality")}_SetTextureParameters(a){const b=C3.isPOT(this._width)&&C3.isPOT(this._height);if(!this._isTiled)a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);else if("repeat-x"===this._tileType)a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);else if("repeat-y"===this._tileType)a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.REPEAT);else if("repeat"===this._tileType)a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.REPEAT);else throw new Error("invalid tile type");if("nearest"===this._sampling)a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),this._isMipMapped=!1;else if(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),(b||this._renderer.SupportsNPOTTextures())&&this._isMipMapped){a.hint(a.GENERATE_MIPMAP_HINT,this._GetMipMapHint(a)),a.generateMipmap(a.TEXTURE_2D);const b="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat();a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,b?a.LINEAR_MIPMAP_LINEAR:a.LINEAR_MIPMAP_NEAREST)}else a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),this._isMipMapped=!1}_Update(b,c){if(("undefined"==typeof HTMLImageElement||!(b instanceof HTMLImageElement))&&("undefined"==typeof HTMLVideoElement||!(b instanceof HTMLVideoElement))&&("undefined"==typeof HTMLCanvasElement||!(b instanceof HTMLCanvasElement))&&("undefined"==typeof ImageBitmap||!(b instanceof ImageBitmap))&&("undefined"==typeof OffscreenCanvas||!(b instanceof OffscreenCanvas))&&!(b instanceof ImageData))throw new Error("invalid texture source");if(!this._texture||0>=this._refCount)throw new Error("texture not created");if(this._isStatic)throw new Error("cannot update static texture");c=Object.assign({},f,c);const d=b.width||b.videoWidth,e=b.height||b.videoHeight,g=this._renderer.GetWebGLVersionNumber(),h=this._renderer.GetContext();h.bindTexture(h.TEXTURE_2D,this._texture),h.pixelStorei(h["UNPACK_PREMULTIPLY_ALPHA_WEBGL"],c.premultiplyAlpha);const i=a(this._pixelFormat,h),j=2<=g?i.sizedinternalformat:i.internalformat;try{if(this._width===d&&this._height===e){const a=C3.isPOT(this._width)&&C3.isPOT(this._height);h.texSubImage2D(h.TEXTURE_2D,0,0,0,i.format,i.type,b),(a||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(h.hint(h.GENERATE_MIPMAP_HINT,this._GetMipMapHint(h)),h.generateMipmap(h.TEXTURE_2D))}else{this._width=d,this._height=e;const a=C3.isPOT(this._width)&&C3.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._isTiled&&!a)throw new Error("non-power-of-two tiled textures not supported");h.texImage2D(h.TEXTURE_2D,0,j,i.format,i.type,b),(a||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(h.hint(h.GENERATE_MIPMAP_HINT,this._GetMipMapHint(h)),h.generateMipmap(h.TEXTURE_2D))}}catch(a){console.error("Error updating WebGL texture: ",a)}h.bindTexture(h.TEXTURE_2D,null),this._renderer._ResetLastTexture()}_Delete(){if(0<this._refCount)throw new Error("texture still has references");if(!this._texture)throw new Error("already deleted texture");g.delete(this);const a=this._renderer.GetContext();a.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 new Error("no more references");this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let a=this._width*this._height;switch(this._pixelFormat){case"rgba8":a*=4;break;case"rgb8":a*=3;break;case"rgba4":case"rgb5_a1":case"rgb565":a*=2;}return this._isMipMapped&&(a+=Math.floor(a/3)),a}static OnContextLost(){g.clear()}static allTextures(){return g.values()}}}
// ../lib/gfx/webgl/renderTarget.js
"use strict";{const a=new Set(["nearest","bilinear","trilinear"]),b={sampling:"trilinear",alpha:!0,readback:!0,isDefaultSize:!0,multisampling:0},c=new Set;C3.Gfx.WebGLRenderTarget=class{constructor(a){this._renderer=a,this._frameBuffer=null,this._texture=null,this._renderBuffer=null,this._width=0,this._height=0,this._isDefaultSize=!0,this._sampling="trilinear",this._alpha=!0,this._readback=!0,this._multisampling=0}_Create(d,e,f){f=Object.assign({},b,f);const g=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw new Error("already created render target");if(this._sampling=f.sampling,this._alpha=!!f.alpha,this._readback=!!f.readback,this._isDefaultSize=!!f.isDefaultSize,this._multisampling=f.multisampling,!a.has(this._sampling))throw new Error("invalid sampling");if(0<this._multisampling&&(2>g||this._readback))throw new Error("invalid use of multisampling");if(2>g&&(this._readback=!0),this._width=d,this._height=e,0>=this._width||0>=this._height)throw new Error("invalid render target size");const h=this._renderer.GetContext();if(this._frameBuffer=h.createFramebuffer(),h.bindFramebuffer(h.FRAMEBUFFER,this._frameBuffer),this._readback){this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1});const a=this._texture._GetTexture();h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,a,0)}else{this._renderBuffer=h.createRenderbuffer(),h.bindRenderbuffer(h.RENDERBUFFER,this._renderBuffer);const a=this._alpha?h.RGBA8:h.RGB8;if(0<this._multisampling){const b=h.getInternalformatParameter(h.RENDERBUFFER,a,h.SAMPLES);if(b&&b[0]){const a=b[0];this._multisampling>a&&(this._multisampling=a)}else this._multisampling=0}0===this._multisampling?h.renderbufferStorage(h.RENDERBUFFER,a,this._width,this._height):h.renderbufferStorageMultisample(h.RENDERBUFFER,this._multisampling,a,this._width,this._height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.RENDERBUFFER,this._renderBuffer),h.bindRenderbuffer(h.RENDERBUFFER,null)}h.bindFramebuffer(h.FRAMEBUFFER,null),c.add(this)}_Resize(a,b){if(this._width!==a||this._height!==b){this._width=a,this._height=b;const c=this._renderer.GetContext();c.bindFramebuffer(c.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(c.bindRenderbuffer(c.RENDERBUFFER,this._renderBuffer),c.renderbufferStorage(c.RENDERBUFFER,this._alpha?c.RGBA8:c.RGB8,this._width,this._height),c.bindRenderbuffer(c.RENDERBUFFER,null)),c.bindFramebuffer(c.FRAMEBUFFER,null)}}_Delete(){if(!this._texture&&!this._renderBuffer)throw new Error("already deleted render target");c.delete(this);const a=this._renderer.GetContext();a.bindFramebuffer(a.FRAMEBUFFER,this._frameBuffer),this._texture?(a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,null,0),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,null),a.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null),a.bindFramebuffer(a.FRAMEBUFFER,null),2<=this._renderer.GetWebGLVersionNumber()&&(a.bindFramebuffer(a.READ_FRAMEBUFFER,null),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,null)),a.deleteFramebuffer(this._frameBuffer),this._renderer.GetBatchState().currentFramebuffer=null,this._frameBuffer=null}_GetFramebuffer(){return this._frameBuffer}GetWebGLRenderer(){return this._renderer}GetTexture(){return this._texture}IsLinearSampling(){return"nearest"!==this._sampling}HasAlpha(){return this._alpha}IsReadback(){return this._readback}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const a={sampling:this._sampling,alpha:this._alpha,readback:this._readback};return this._isDefaultSize||(a.width=this._width,a.height=this._height),a}IsCompatibleWithOptions(a){return a=Object.assign({},b,a),"nearest"!==a.sampling===this.IsLinearSampling()&&!!a.alpha===this.HasAlpha()&&!(2<=this._renderer.GetWebGLVersionNumber()&&!!a.readback!==this.IsReadback())&&("number"==typeof a.width||"number"==typeof a.height?!this.IsDefaultSize()&&this.GetWidth()===a.width&&this.GetHeight()===a.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(a,b){const c=await a.ReadBackRenderTargetToImageData(b,!0);return await C3.ImageDataToBlob(c)}static OnContextLost(){c.clear()}static allRenderTargets(){return c.values()}static ResizeAll(a,b){for(const d of c)d.IsDefaultSize()&&d._Resize(a,b)}}}
// ../lib/gfx/webgl/shaderProgram.js
"use strict";{const 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"]);C3.Gfx.WebGLShaderProgram=class{static async Compile(a,b,c,d){const e=a.GetContext(),f=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(f,b),e.compileShader(f);const g=e.createShader(e.VERTEX_SHADER);e.shaderSource(g,c),e.compileShader(g);const h=e.createProgram();e.attachShader(h,f),e.attachShader(h,g),e.bindAttribLocation(h,0,"aPos"),e.bindAttribLocation(h,1,"aTex"),e.bindAttribLocation(h,2,"aPoints"),e.linkProgram(h);const i=a._GetParallelShaderCompileExtension();if(i?await a._WaitForObjectReady(()=>e.getProgramParameter(h,i["COMPLETION_STATUS_KHR"])):await C3.Wait(5),!e.getShaderParameter(f,e.COMPILE_STATUS)){const a=e.getShaderInfoLog(f);throw e.deleteShader(f),e.deleteShader(g),e.deleteProgram(h),new Error("Error compiling fragment shader: "+a)}if(!e.getShaderParameter(g,e.COMPILE_STATUS)){const a=e.getShaderInfoLog(g);throw e.deleteShader(f),e.deleteShader(g),e.deleteProgram(h),new Error("Error compiling vertex shader: "+a)}if(!e.getProgramParameter(h,e.LINK_STATUS)){const a=e.getProgramInfoLog(h);throw e.deleteShader(f),e.deleteShader(g),e.deleteProgram(h),new Error("Error linking shader program: "+a)}const j=C3.FilterUnprintableChars(e.getProgramInfoLog(h)||"").trim();return j&&!C3.IsStringAllWhitespace(j)&&console.info(`[WebGL] Shader program '${d}' compilation log: `,j),e.deleteShader(f),e.deleteShader(g),h}static async Create(a,b,c,d){const e=await C3.Gfx.WebGLShaderProgram.Compile(a,b.src,c,d);return new C3.Gfx.WebGLShaderProgram(a,e,b,d)}constructor(a,b,c,d){const e=a.GetContext(),f=a.GetBatchState();a.EndBatch(),e.useProgram(b),this._gl=e,this._renderer=a,this._name=d,this._shaderProgram=b,this._isDeviceTransform="<default-device-transform>"===d;const g=e.getAttribLocation(b,"aPos"),h=e.getAttribLocation(b,"aTex"),i=e.getAttribLocation(b,"aPoints");-1!==g&&(e.bindBuffer(e.ARRAY_BUFFER,a._vertexBuffer),e.vertexAttribPointer(g,a.GetNumVertexComponents(),e.FLOAT,!1,0,0),e.enableVertexAttribArray(g)),-1!==h&&(e.bindBuffer(e.ARRAY_BUFFER,a._texcoordBuffer),e.vertexAttribPointer(h,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(h)),-1!==i&&(e.bindBuffer(e.ARRAY_BUFFER,a._pointBuffer),e.vertexAttribPointer(i,4,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i)),e.bindBuffer(e.ARRAY_BUFFER,null),this._uMatP=new C3.Gfx.WebGLShaderUniform(this,"matP","mat4"),this._uMatMV=new C3.Gfx.WebGLShaderUniform(this,"matMV","mat4"),this._uColor=new C3.Gfx.WebGLShaderUniform(this,"color","vec4"),this._uSamplerFront=new C3.Gfx.WebGLShaderUniform(this,"samplerFront","sampler"),this._uPointTexStart=new C3.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2"),this._uPointTexEnd=new C3.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2"),this._uZElevation=new C3.Gfx.WebGLShaderUniform(this,"zElevation","float"),this._uTileSize=new C3.Gfx.WebGLShaderUniform(this,"tileSize","vec2"),this._uTileSpacing=new C3.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2"),this._uColor2=new C3.Gfx.WebGLShaderUniform(this,"color2_","vec4"),this._uOutlineThickness=new C3.Gfx.WebGLShaderUniform(this,"outlineThickness","float"),this._uSamplerBack=new C3.Gfx.WebGLShaderUniform(this,"samplerBack","sampler"),this._uDestStart=new C3.Gfx.WebGLShaderUniform(this,"destStart","vec2"),this._uDestEnd=new C3.Gfx.WebGLShaderUniform(this,"destEnd","vec2"),this._uSrcStart=new C3.Gfx.WebGLShaderUniform(this,"srcStart","vec2"),this._uSrcEnd=new C3.Gfx.WebGLShaderUniform(this,"srcEnd","vec2"),this._uSrcOriginStart=new C3.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2"),this._uSrcOriginEnd=new C3.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2"),this._uPixelSize=new C3.Gfx.WebGLShaderUniform(this,"pixelSize","vec2"),this._uSeconds=new C3.Gfx.WebGLShaderUniform(this,"seconds","float"),this._uLayerScale=new C3.Gfx.WebGLShaderUniform(this,"layerScale","float"),this._uLayerAngle=new C3.Gfx.WebGLShaderUniform(this,"layerAngle","float"),this._uLayoutStart=new C3.Gfx.WebGLShaderUniform(this,"layoutStart","vec2"),this._uLayoutEnd=new C3.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;const j=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._hasCurrentMatP=!1,this._hasCurrentMatMV=!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 e of j){const a=e[0],b=e[2],c=new C3.Gfx.WebGLShaderUniform(this,a,b);"color"===b?c.Init3f(0,0,0):c.Init1f(0),this._uCustomParameters.push(c)}this._isDeviceTransform?this._UpdateDeviceTransformUniforms(f.currentMatP):(this.UpdateMatP(f.currentMatP,!0),this.UpdateMatMV(f.currentMV,!0));const k=f.currentShader;e.useProgram(k?k._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram),this._shaderProgram=null,this._renderer._RemoveShaderProgram(this),this._gl=null,this._renderer=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(a){return this._uCustomParameters[a].GetType()}AreCustomParametersAlreadySetInBatch(a){for(let b=0,c=a.length;b<c;++b)if(!this._uCustomParameters[b].IsSetToCustomInBatch(a[b]))return!1;return!0}SetCustomParametersInBatch(a){for(let b=0,c=a.length;b<c;++b)this._uCustomParameters[b].SetBatchValueCustom(a[b])}AreOptionalUniformsAlreadySetInBatch(a,b,c,d,e,f,g,h,i){return!this._uSamplerBack.IsUsed()&&(!this._uPixelSize.IsUsed()||this._uPixelSize.IsSetTo2InBatch(e,f))&&(!this._uDestStart.IsUsed()||this._uDestStart.IsSetTo2InBatch(a.getLeft(),a.getTop()))&&(!this._uDestEnd.IsUsed()||this._uDestEnd.IsSetTo2InBatch(a.getRight(),a.getBottom()))&&(!this._uLayerScale.IsUsed()||this._uLayerScale.IsSetTo1InBatch(g))&&(!this._uLayerAngle.IsUsed()||this._uLayerAngle.IsSetTo1InBatch(h))&&(!this._uSrcStart.IsUsed()||this._uSrcStart.IsSetTo2InBatch(b.getLeft(),b.getTop()))&&(!this._uSrcEnd.IsUsed()||this._uSrcEnd.IsSetTo2InBatch(b.getRight(),b.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(d.getLeft(),d.getTop()))&&(!this._uLayoutEnd.IsUsed()||this._uLayoutEnd.IsSetTo2InBatch(d.getTop(),d.getBottom()))&&(!this._uSeconds.IsUsed()||this._uSeconds.IsSetTo1InBatch(i))}SetOptionalUniformsInBatch(a,b,c,d,e,f,g,h,i){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(e,f),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(a.getLeft(),a.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(a.getRight(),a.getBottom()),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(g),this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(h),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(b.getLeft(),b.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(b.getRight(),b.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(d.getLeft(),d.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(d.getTop(),d.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(i))}IsAnimated(){return this._animated}UpdateMatP(a,b){this._hasCurrentMatP&&!b||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(a),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(a,b){this._hasCurrentMatMV&&!b||this._isDeviceTransform||(this._uMatMV.IsUsed()&&this._uMatMV.UpdateMatrix4fv(a),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(a){if(!this._isDeviceTransform)throw new Error("not device transform shader");this._uMatP.UpdateMatrix4fv(a);const b=this._renderer,c=b.GetWidth()/2,d=b.GetHeight()/2,e=b._worldScale,f=vec3.fromValues(c*e[0],d*e[1],100*self.devicePixelRatio),g=vec3.fromValues(c*e[0],d*e[1],0),h=mat4.create();mat4.lookAt(h,f,g,b._up),mat4.scale(h,h,e),this._uMatMV.UpdateMatrix4fv(h)}UpdateColor(a){this._uColor.IsUsed()&&this._uColor.Update4f(a[0],a[1],a[2],a[3])}static GetReservedUniformNames(){return a}static GetDefaultVertexShaderSource(a,b){const c=b?"highmedp":"mediump";return[`#ifdef GL_FRAGMENT_PRECISION_HIGH`,`#define highmedp highp`,`#else`,`#define highmedp mediump`,`#endif`,`attribute highp ${a?"vec3":"vec2"} aPos;`,`attribute ${c} vec2 aTex;`,`varying ${c} vec2 vTex;`,`uniform highp mat4 matP;`,`uniform highp mat4 matMV;`,`void main(void) {`,` gl_Position = matP * matMV * vec4(aPos, ${a?"":"0.0,"} 1.0);`,` vTex = aTex;`,`}`].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}"}}}
// ../lib/gfx/webgl/shaderUniform.js
"use strict";{function a(c,a){return c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]&&c[3]===a[3]&&c[4]===a[4]&&c[5]===a[5]&&c[6]===a[6]&&c[7]===a[7]&&c[8]===a[8]&&c[9]===a[9]&&c[10]===a[10]&&c[11]===a[11]&&c[12]===a[12]&&c[13]===a[13]&&c[14]===a[14]&&c[15]===a[15]}const b=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);C3.Gfx.WebGLShaderUniform=class{constructor(a,c,d){if(!b.has(d))throw new Error("invalid uniform type");this._owner=a,this._gl=this._owner.GetWebGLContext(),this._name=c,this._type=d,this._isColorType="color"===this._type,this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),c),this._isUsed=!!this._location;const e=b.get(d);this._lastValue=new Float32Array(e),this._lastBatchValue=new Float32Array(e)}Release(){this._owner=null,this._gl=null,this._location=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(a){this.IsUsed()&&(this._lastValue[0]=a,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,a))}Init1i(a){this.IsUsed()&&(this._lastValue[0]=a,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,a))}Init2f(a,b){this.IsUsed()&&(this._lastValue[0]=a,this._lastValue[1]=b,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,a,b))}Init3f(a,b,c){this.IsUsed()&&(this._lastValue[0]=a,this._lastValue[1]=b,this._lastValue[2]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,a,b,c))}Init4f(a,b,c,d){this.IsUsed()&&(this._lastValue[0]=a,this._lastValue[1]=b,this._lastValue[2]=c,this._lastValue[3]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,a,b,c,d))}Update1f(a){a=Math.fround(a);const b=this._lastValue;b[0]===a||(b[0]=a,this._gl.uniform1f(this._location,a))}Update1i(a){const b=this._lastValue;b[0]===a||(b[0]=a,this._gl.uniform1i(this._location,a))}Update2f(a,b){var c=Math.fround;a=c(a),b=c(b);const d=this._lastValue;d[0]===a&&d[1]===b||(d[0]=a,d[1]=b,this._gl.uniform2f(this._location,a,b))}Update3f(a,b,c){var d=Math.fround;a=d(a),b=d(b),c=d(c);const e=this._lastValue;e[0]===a&&e[1]===b&&e[2]===c||(e[0]=a,e[1]=b,e[2]=c,this._gl.uniform3f(this._location,a,b,c))}Update4f(a,b,c,d){var e=Math.fround;a=e(a),b=e(b),c=e(c),d=e(d);const f=this._lastValue;f[0]===a&&f[1]===b&&f[2]===c&&f[3]===d||(f[0]=a,f[1]=b,f[2]=c,f[3]=d,this._gl.uniform4f(this._location,a,b,c,d))}UpdateMatrix4fv(b){const c=this._lastValue;a(c,b)||(C3.typedArraySet16(c,b,0),this._gl.uniformMatrix4fv(this._location,!1,b))}IsSetToCustomInBatch(a){var b=Math.fround;const c=this._lastBatchValue;return this.IsColorType()?c[0]===b(a.getR())&&c[1]===b(a.getG())&&c[2]===b(a.getB()):c[0]===b(a)}SetBatchValueCustom(a){const b=this._lastBatchValue;this.IsColorType()?(b[0]=a.getR(),b[1]=a.getG(),b[2]=a.getB()):b[0]=a}IsSetTo1InBatch(a){return this._lastBatchValue[0]===Math.fround(a)}IsSetTo2InBatch(a,b){var c=Math.fround;const d=this._lastBatchValue;return d[0]===c(a)&&d[1]===c(b)}SetBatch1(a){this._lastBatchValue[0]=a}SetBatch2(a,b){const c=this._lastBatchValue;c[0]=a,c[1]=b}}}
// ../lib/gfx/webgl/batchJob.js
"use strict";{C3.Gfx.BatchState=class{constructor(a){this.renderer=a,this.currentMV=mat4.create(),this.currentMatP=mat4.create(),this.currentFramebuffer=null,this.currentColor=vec4.fromValues(1,1,1,1),this.currentShader=null,this.pointTexCoords=new C3.Rect,this.clearColor=C3.New(C3.Color,0,0,0,0)}},C3.Gfx.WebGLBatchJob=class{constructor(a){const b=new ArrayBuffer(96);this._type=0,this._batchState=a,this._gl=a.renderer.GetContext(),this._startIndex=0,this._indexCount=0,this._texParam=null,this._mat4param=new Float32Array(b,0,16),this._colorParam=new Float32Array(b,64,4),this._srcOriginRect=new Float32Array(b,80,4),this._shaderParams=[]}InitQuad(a,b){this._type=1,this._startIndex=a,this._indexCount=b}DoQuad(){const a=this._gl;a.drawElements(a.TRIANGLES,this._indexCount,a.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(a){this._type=2,this._texParam=a}DoSetTexture(){const a=this._gl,b=this._texParam;a.bindTexture(a.TEXTURE_2D,b?b._GetTexture():null)}InitSetColor(a){this._type=3,a.writeToTypedArray(this._colorParam,0)}DoSetColor(){const a=this._colorParam,b=this._batchState;vec4.copy(b.currentColor,a),b.currentShader.UpdateColor(a)}InitSetGradientColor(a){this._type=19,a.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const a=this._colorParam,b=this._batchState.currentShader;b._uColor2.IsUsed()&&b._uColor2.Update4f(a[0],a[1],a[2],a[3])}InitSetBlend(a,b){this._type=4,this._startIndex=a,this._indexCount=b}DoSetBlend(){this._gl.blendFunc(this._startIndex,this._indexCount)}InitUpdateModelView(a){this._type=5,mat4.copy(this._mat4param,a)}DoUpdateModelView(){const a=this._batchState,b=a.renderer._allShaderPrograms,c=a.currentShader,d=this._mat4param;for(let a=0,e=b.length;a<e;++a){const e=b[a];e===c?e.UpdateMatMV(d,!0):e.SetMatMVStale()}mat4.copy(a.currentMV,d)}InitSetRenderTarget(a,b,c){this._type=6,this._texParam=a,this._startIndex=b?1:0,b&&mat4.copy(this._mat4param,c)}DoSetRenderTarget(){const a=this._gl,b=this._texParam,c=0!==this._startIndex,d=this._mat4param,e=this._batchState,f=e.renderer;let g,h;if(b){const c=b._GetFramebuffer();e.currentFramebuffer=c,a.bindFramebuffer(a.FRAMEBUFFER,c),g=b.GetWidth(),h=b.GetHeight()}else e.currentFramebuffer=null,a.bindFramebuffer(a.FRAMEBUFFER,null),g=f.GetScissoredViewportWidth(),h=f.GetScissoredViewportHeight();c&&f._UpdateViewportBatch(g,h,d)}InitClearSurface(a){this._type=7,a.writeToTypedArray(this._mat4param,0)}InitClearSurface2(d,e,f,b){this._type=7;const a=this._mat4param;a[0]=d,a[1]=e,a[2]=f,a[3]=b}DoClearSurface(){const c=this._gl,d=this._mat4param,e=this._batchState,f=e.renderer,h=e.clearColor,i=f._isScissorViewport&&C3.isDebug;i&&c.disable(c.SCISSOR_TEST);const j=d[0],k=d[1],g=d[2],b=d[3];h.equalsRgba(j,k,g,b)||(c.clearColor(j,k,g,b),h.setRgba(j,k,g,b)),c.clear(c.COLOR_BUFFER_BIT),i&&c.enable(c.SCISSOR_TEST)}InitClearRect(c,d,e,f,h,i,g,b){this._type=8;const a=this._mat4param;a[0]=c,a[1]=d,a[2]=e,a[3]=f,a[4]=h,a[5]=i,a[6]=g,a[7]=b}DoClearRectangle(){const c=this._gl,d=this._mat4param,e=this._batchState,f=e.renderer,h=e.clearColor;f._isScissorViewport||c.enable(c.SCISSOR_TEST),c.scissor(d[0],d[1],d[2],d[3]);const i=d[4],j=d[5],g=d[6],b=d[7];h.equalsRgba(i,j,g,b)||(c.clearColor(i,j,g,b),h.setRgba(i,j,g,b)),c.clear(c.COLOR_BUFFER_BIT),f._isScissorViewport?c.scissor(0,0,f._viewportScissorWidth,f._viewportScissorHeight):c.disable(c.SCISSOR_TEST)}InitSetPointTexCoords(a){this._type=13,a.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const a=this._mat4param;this._batchState.pointTexCoords.set(a[0],a[1],a[2],a[3])}InitPoints(a,b){this._type=9,this._startIndex=a,this._indexCount=1,this._mat4param[0]=b}DoPoints(){const a=this._gl,b=this._batchState,c=b.renderer,d=c._spPoints;a.useProgram(d._shaderProgram),d.UpdateMatP(b.currentMatP,!1),d.UpdateMatMV(b.currentMV,!1);const e=b.pointTexCoords;d._uPointTexStart.IsUsed()&&d._uPointTexStart.Update2f(e.getLeft(),e.getTop()),d._uPointTexEnd.IsUsed()&&d._uPointTexEnd.Update2f(e.getRight(),e.getBottom());const f=this._mat4param[0];if(d._uZElevation.IsUsed()&&d._uZElevation.Update1f(f),d._uColor.IsUsed()){const a=b.currentColor;d._uColor.Update4f(a[0],a[1],a[2],a[3])}a.drawArrays(a.POINTS,this._startIndex/4,this._indexCount),a.useProgram(b.currentShader._shaderProgram)}InitSetProgram(a){this._type=10,this._texParam=a}DoSetProgram(){const a=this._gl,b=this._batchState,d=this._texParam;if(b.currentShader=d,a.useProgram(d._shaderProgram),d.UpdateMatP(b.currentMatP,!1),d.UpdateMatMV(b.currentMV,!1),d._uColor.IsUsed()){const a=b.currentColor;d._uColor.Update4f(a[0],a[1],a[2],a[3])}}InitSetProgramParameters(){this._type=11}DoSetProgramParameters(){const a=this._batchState.currentShader;a._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(a),a._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(a)}_DoSetOptionalUniformProgramParameters(a){const b=this._gl,c=this._mat4param,d=this._colorParam,e=this._srcOriginRect;if(a._uSamplerBack.IsUsed()){const a=this._batchState.renderer,c=this._texParam;a._lastTexture1!==c&&(b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,c?c._GetTexture():null),a._lastTexture1=c,b.activeTexture(b.TEXTURE0))}a._uPixelSize.IsUsed()&&a._uPixelSize.Update2f(c[0],c[1]),a._uDestStart.IsUsed()&&a._uDestStart.Update2f(c[2],c[3]),a._uDestEnd.IsUsed()&&a._uDestEnd.Update2f(c[4],c[5]),a._uLayerScale.IsUsed()&&a._uLayerScale.Update1f(c[6]),a._uLayerAngle.IsUsed()&&a._uLayerAngle.Update1f(c[7]),a._uSrcStart.IsUsed()&&a._uSrcStart.Update2f(c[12],c[13]),a._uSrcEnd.IsUsed()&&a._uSrcEnd.Update2f(c[14],c[15]),a._uSrcOriginStart.IsUsed()&&a._uSrcOriginStart.Update2f(e[0],e[1]),a._uSrcOriginEnd.IsUsed()&&a._uSrcOriginEnd.Update2f(e[2],e[3]),a._uLayoutStart.IsUsed()&&a._uLayoutStart.Update2f(d[0],d[1]),a._uLayoutEnd.IsUsed()&&a._uLayoutEnd.Update2f(d[2],d[3]),a._uSeconds.IsUsed()&&a._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(a){const b=a._uCustomParameters,c=this._shaderParams;for(let d=0,e=b.length;d<e;++d){const a=b[d],e=c[d];a.IsColorType()?a.Update3f(e.getR(),e.getG(),e.getB()):a.Update1f(e)}}InitInvalidateFramebuffer(a){this._type=12,this._texParam=a}DoInvalidateFramebuffer(){const a=this._gl,b=this._texParam,c=this._batchState.currentFramebuffer;b!==c&&a.bindFramebuffer(a.FRAMEBUFFER,b),a.invalidateFramebuffer(a.FRAMEBUFFER,[a.COLOR_ATTACHMENT0]),b!==c&&a.bindFramebuffer(a.FRAMEBUFFER,c)}InitBlitFramebuffer(a,b,c){this._type=15;const d=this._mat4param,e=this._batchState.renderer;d[0]=a.GetWidth(),d[1]=a.GetHeight(),d[2]=b?b.GetWidth():e.GetWidth(),d[3]=b?b.GetHeight():e.GetHeight(),d[4]=a.IsLinearSampling()?1:0,d[5]="stretch"===c;const f=this._shaderParams;C3.clearArray(f),f.push(a._GetFramebuffer()),f.push(b?b._GetFramebuffer():null)}DoBlitFramebuffer(){var a=Math.max,b=Math.min;const c=this._mat4param,d=this._shaderParams,e=this._gl,f=c[0],g=c[1],i=c[2],j=c[3],h=0!==c[4],k=0!==c[5],l=d[0],m=d[1];if(e.bindFramebuffer(e.READ_FRAMEBUFFER,l),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,m),k)e.blitFramebuffer(0,0,f,g,0,0,i,j,e.COLOR_BUFFER_BIT,h?e.LINEAR:e.NEAREST);else{const c=b(f,i),d=b(g,j),h=a(g-j,0),k=a(j-g,0);e.blitFramebuffer(0,h,c,d+h,0,k,c,d+k,e.COLOR_BUFFER_BIT,e.NEAREST)}}InitStartQuery(a){this._type=16,this._texParam=a}DoStartQuery(){this._texParam.BeginTimeElapsed(),this._texParam=null}InitEndQuery(a){this._type=17,this._texParam=a}DoEndQuery(){this._texParam.EndTimeElapsed(),this._texParam=null}InitSetEllipseParams(a,b,c){this._type=18;const d=this._mat4param;d[0]=a,d[1]=b,d[2]=c}DoSetEllipseParams(){const a=this._batchState.currentShader,b=this._mat4param;a._uPixelSize.IsUsed()&&a._uPixelSize.Update2f(b[0],b[1]),a._uOutlineThickness.IsUsed()&&a._uOutlineThickness.Update1f(b[2])}InitSetTilemapInfo(a,b,c,d,e,f,g){this._type=14;const h=this._mat4param;a.writeToTypedArray(h,0),h[4]=1/b,h[5]=1/c,h[6]=d/b,h[7]=e/c,h[8]=f/b,h[9]=g/c}DoSetTilemapInfo(){const a=this._batchState.currentShader,b=this._mat4param;a._uSrcStart.IsUsed()&&a._uSrcStart.Update2f(b[0],b[1]),a._uPixelSize.IsUsed()&&a._uPixelSize.Update2f(b[4],b[5]),a._uTileSize.IsUsed()&&a._uTileSize.Update2f(b[6],b[7]),a._uTileSpacing.IsUsed()&&a._uTileSpacing.Update2f(b[8],b[9])}Run(){switch(this._type){case 1:return void this.DoQuad();case 2:return void this.DoSetTexture();case 3:return void this.DoSetColor();case 4:return void this.DoSetBlend();case 5:return void this.DoUpdateModelView();case 6:return void this.DoSetRenderTarget();case 7:return void this.DoClearSurface();case 8:return void this.DoClearRectangle();case 9:return void this.DoPoints();case 10:return void this.DoSetProgram();case 11:return void this.DoSetProgramParameters();case 12:return void this.DoInvalidateFramebuffer();case 13:return void this.DoSetPointTextureCoords();case 14:return void this.DoSetTilemapInfo();case 15:return void this.DoBlitFramebuffer();case 16:return void this.DoStartQuery();case 17:return void this.DoEndQuery();case 18:return void this.DoSetEllipseParams();case 19:return void this.DoSetGradientColor();}}}}
// ../lib/gfx/webgl/text.js
"use strict";{function a(a,b,c,d,e,f){b?"Gecko"===C3.Platform.BrowserEngine?a.strokeText(c,d,e,f):a.strokeText(c,d,e):"Gecko"===C3.Platform.BrowserEngine?a.fillText(c,d,e,f):a.fillText(c,d,e)}function b(a,b,c,d,e,f){b?a.strokeRect(c,d,e,f):a.fillRect(c,d,e,f)}function c(a){return a*(4/3)}const d={timeout:60},e=new C3.Color(0,0,0,1),f=new Set(["left","center","right"]),g=new Set(["top","center","bottom"]),h=new Set(["word","character"]),i=new Set;C3.FontManager&&C3.FontManager.addEventListener("fontload",(a)=>{const b=a.font.GetName();for(const c of i)(c.IsBBCodeEnabled()||C3.equalsNoCase(c.GetFontName(),b))&&c._SetTextChanged()}),C3.Gfx.WebGLText=class{constructor(a,b){b=Object.assign({},d,b),this._renderer=a,this._fontName="Arial",this._fontSize=16,this._lineHeight=0,this._isBold=!1,this._isItalic=!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=C3.New(C3.WordWrap),this._wrapMode="word",this._textChanged=!1,this._isUpdating=!1,this._isAsync=!0,this._drawMaxCharCount=-1,this._drawCharCount=0,this._cssWidth=0,this._cssHeight=0,this._width=0,this._height=0,this._zoom=1,this._changed=!1,this._textCanvas=null,this._textContext=null,this._measureContext=null,this._lastCanvasWidth=-1,this._lastCanvasHeight=-1,this._lastTextCanvasFont="",this._lastMeasureCanvasFont="",this._lastTextCanvasFillStyle="",this._lastTextCanvasOpacity=1,this._lastTextCanvasLineWidth=1,this._measureTextCallback=(a,b)=>this._MeasureText(a,b),this._texture=null,this._textureWidth=0,this._textureHeight=0,this._rcTex=new C3.Rect,this._scaleFactor=1,this._needToRecreateTexture=!1,this._textureTimeout=new C3.IdleTimeout(()=>{this.ReleaseTexture(),this._SetTextCanvasSize(8,8)},b.timeout),this.ontextureupdate=null,this._wasReleased=!1,i.add(this)}Release(){this.onloadfont=null,this._alreadyLoadedFonts.clear(),this._bbString=null,this._textCanvas=null,this._textContext=null,this._measureContext=null,this._measureTextCallback=null,this._textureTimeout.Release(),this.ontextureupdate=null,this.ReleaseTexture(),this._wrappedText.Clear(),this._wrappedText=null,this._renderer=null,this._wasReleased=!0,i.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged(),this._wrappedText.Clear(),this._textChanged=!0}SetIsAsync(b){this._isAsync=!!b}IsAsync(){return this._isAsync}SetBBCodeEnabled(a){a=!!a;this._isBBcodeEnabled===a||(this._isBBcodeEnabled=a,this._textContext&&(this._textContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top"),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(a){a||(a="serif");this._fontName===a||(this._fontName=a,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(a){.1>a&&(a=.1);this._fontSize===a||(this._fontSize=a,this._SetTextChanged())}SetLineHeight(a){this._lineHeight===a||(this._lineHeight=a,this._SetChanged())}SetBold(a){a=!!a;this._isBold===a||(this._isBold=a,this._SetTextChanged())}SetItalic(a){a=!!a;this._isItalic===a||(this._isItalic=a,this._SetTextChanged())}SetDrawMaxCharacterCount(a){a=Math.floor(a);this._drawMaxCharCount===a||(this._drawMaxCharCount=a,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(a,b){for(let c=a.length-1;0<=c;--c){const d=a[c];if(d.tag===b)return d}return null}_HasStyleTag(a,b){return!!this._GetStyleTag(a,b)}_GetFontString(a,b){let c="";(this._isBold||this._HasStyleTag(b,"b"))&&(c+="bold"),(this._isItalic||this._HasStyleTag(b,"i"))&&(c+=" italic");const d=this._GetStyleTag(b,"size"),e=d?parseFloat(d.param):this._fontSize;c+=a?" "+e+"pt":" "+e*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt";let f=this._fontName;const g=this._GetStyleTag(b,"font");return g&&g.param&&(f=g.param,this.onloadfont&&!this._alreadyLoadedFonts.has(f)&&(this.onloadfont(f),this._alreadyLoadedFonts.add(f))),f&&(c+=" \""+f+"\""),c}SetColor(a){a instanceof C3.Color&&(a=a.getCssRgb());this._colorStr===a||(this._colorStr=a,this._SetChanged())}SetColorRgb(a,c,d){e.setRgb(a,c,d),this.SetColor(e)}SetHorizontalAlignment(a){if(!f.has(a))throw new Error("invalid horizontal alignment");this._horizontalAlign===a||(this._horizontalAlign=a,this._SetChanged())}SetVerticalAlignment(a){if(!g.has(a))throw new Error("invalid vertical alignment");this._verticalAlign===a||(this._verticalAlign=a,this._SetChanged())}SetWordWrapMode(a){if(!h.has(a))throw new Error("invalid word wrap mode");this._wrapMode===a||(this._wrapMode=a,this._SetTextChanged())}SetText(a){this._text===a||(this._text=a,this._SetTextChanged())}SetSize(a,b,c){var d=Math.min;if("undefined"==typeof c&&(c=1),0>=a||0>=a)return;if(this._cssWidth===a&&this._cssHeight===b&&this._zoom===c)return;1===this._zoom!=(1===c)&&(this._needToRecreateTexture=!0);const e=this._cssWidth,f=this._zoom;this._cssWidth=a,this._cssHeight=b,this._zoom=c;const g=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*g,this._height=this._cssHeight*this._zoom*g;const h=Math.max(this._width,this._height),i=d(this._renderer.GetMaxTextureSize(),2048);let j=1;h>i&&(j=i/h,this._width=d(this._width*j,i),this._height=d(this._height*j,i)),this._scaleFactor=j,0<this._textureWidth&&0<this._textureHeight&&this._zoom===f&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight),this._cssWidth===e?this._SetChanged():this._SetTextChanged()}GetWidth(){return this._width}GetHeight(){return this._height}GetTextWidth(){return this._MaybeWrapText(),this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();const a=c(this._fontSize)+4;return this._wrappedText.GetLineCount()*(a+this._lineHeight)-this._lineHeight}GetTexture(){return this._textureTimeout.Reset(),this._MaybeUpdate(),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?C3.Asyncify(()=>this._DoUpdate()):this._DoUpdate())}_DoUpdate(){var a=Math.ceil;this._wasReleased||(this._SetTextCanvasSize(a(this._width),a(this._height)),this._MaybeWrapText(),this._DrawTextToCanvas(),this._UpdateTexture(),this._textureTimeout.Reset(),this._isUpdating=!1)}_SetTextCanvasSize(a,b){this._textCanvas||(this._textCanvas=C3.CreateCanvas(16,16));let c=!1;(this._lastCanvasWidth!==a||this._lastCanvasHeight!==b)&&(this._lastCanvasWidth=a,this._lastCanvasHeight=b,this._textCanvas.width=a,this._textCanvas.height=b,c=!0),this._textContext||(this._textContext=this._textCanvas.getContext("2d"),c=!0),c?(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,a,b)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=C3.CreateCanvas(16,16).getContext("2d"))}_SetMeasureFontString(a){this._lastMeasureCanvasFont===a||(this._lastMeasureCanvasFont=a,this._measureContext.font=a)}_MaybeWrapText(){this._textChanged&&(this._MaybeCreateMeasureContext(),this._isBBcodeEnabled&&(!this._bbString||this._bbString.toString()!==this._text)&&(this._bbString=new C3.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(a,b){this._SetMeasureFontString(this._GetFontString(!0,b));const d=this._GetStyleTag(b,"size"),e=d?parseFloat(d.param):this._fontSize;return{width:this._measureContext.measureText(a).width,height:c(e)}}_SetDrawFontString(a){this._lastTextCanvasFont===a||(this._lastTextCanvasFont=a,this._textContext.font=a)}_SetDrawCanvasColor(a){this._lastTextCanvasFillStyle===a||(this._lastTextCanvasFillStyle=a,this._textContext.fillStyle=a,this._textContext.strokeStyle=a)}_SetDrawCanvasOpacity(a){this._lastTextCanvasOpacity===a||(this._lastTextCanvasOpacity=a,this._textContext.globalAlpha=a)}_SetDrawCanvasLineWith(a){this._lastTextCanvasLineWidth===a||(this._lastTextCanvasLineWidth=a,this._textContext.lineWidth=a)}_DrawTextToCanvas(){this._drawCharCount=0;const b=this._scaleFactor*this._zoom*self.devicePixelRatio,c=(4+this._lineHeight)*b;let a=0;const d=this._wrappedText.GetLines(),e=d.reduce((d,a)=>d+a.height*b+c,0)-this._lineHeight*b;"center"===this._verticalAlign?a=Math.max(this._height/2-e/2,0):"bottom"===this._verticalAlign&&(a=this._height-e-2);for(let e=0,f=d.length;e<f;++e){const f=d[e],g=f.height*b,h=a;if(this._isBBcodeEnabled){if(a+=g,0<e&&a>this._height-4*b)break;}else if(0<e&&a>=this._height-g)break;0<=h&&this._DrawTextLine(f,a,b),this._isBBcodeEnabled||(a+=g),a+=c}}_DrawTextLine(a,b,c){let d=0;"center"===this._horizontalAlign?d=(this._width-a.width*c)/2:"right"===this._horizontalAlign&&(d=this._width-a.width*c);for(const e of a.fragments)this._DrawTextFragment(e,d,b,c,a.height),d+=e.width*c}_DrawTextFragment(c,d,e,f,g){const h=this._textContext,i=g/16;let j=c.width*f;const k=c.height*f,l=c.height/16,m=(4+this._lineHeight)*f,n=c.styles;let o=c.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+o.length>this._drawMaxCharCount&&(o=o.substr(0,this._drawMaxCharCount-this._drawCharCount),j=this._MeasureText(o,n).width*f),this._drawCharCount+=o.length}const p=this._GetStyleTag(n,"background"),q=this._HasStyleTag(n,"u"),r=this._HasStyleTag(n,"s");if((!C3.IsStringAllWhitespace(o)||p||q||r)&&!this._HasStyleTag(n,"hide")){const c=this._GetStyleTag(n,"offsetx");d+=c?parseFloat(c.param)*f:0;const g=this._GetStyleTag(n,"offsety");e+=g?parseFloat(g.param)*f:0,p&&(this._SetDrawCanvasColor(p.param),h.fillRect(d,e-k,j,k+m));const s=this._GetStyleTag(n,"color");this._SetDrawCanvasColor(s?s.param:this._colorStr);const t=this._GetStyleTag(n,"opacity");this._SetDrawCanvasOpacity(t?parseFloat(t.param)/100:1);const u=this._HasStyleTag(n,"stroke");if(u&&this._SetDrawCanvasLineWith(l*this._scaleFactor*this._zoom),q&&b(h,u,d,e+f*i,j,f*i),r&&b(h,u,d,e-k/4,j,f*l),this._SetDrawFontString(this._GetFontString(!1,n)),a(h,u,o,d,e,j),!u){this._SetDrawCanvasLineWith(l*this._scaleFactor*this._zoom);const b=this._GetStyleTag(n,"outline");b&&(this._SetDrawCanvasColor(b.param),a(h,!0,o,d,e,j))}}}_UpdateTexture(){var a=Math.ceil;this._renderer.IsContextLost()||(this._textureWidth=a(this._width),this._textureHeight=a(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 a of i)a.ReleaseTexture()}static GetAll(){return i.values()}}}
// ../lib/gfx/webgl/query.js
"use strict";{class a{constructor(a){this._gl=a.GetContext(),this._version=a.GetWebGLVersionNumber(),this._timerExt=a._GetDisjointTimerQueryExtension(),this._query=null,this._isActive=!1,this._hasResult=!1,this._result=0,this._query=1===this._version?this._timerExt["createQueryEXT"]():this._gl["createQuery"]()}Release(){this._DeleteQueryObject(),this._gl=null,this._timerExt=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 new 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 new 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)return;let a=!1;a=1===this._version?this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_AVAILABLE_EXT"]):this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT_AVAILABLE"]);const b=this._gl.getParameter(this._timerExt["GPU_DISJOINT_EXT"]);a&&!b&&(this._result=1===this._version?this._timerExt["getQueryObjectEXT"](this._query,this._timerExt["QUERY_RESULT_EXT"]):this._gl["getQueryParameter"](this._query,this._gl["QUERY_RESULT"]),this._result/=1e9,this._hasResult=!0),(a||b)&&this._DeleteQueryObject()}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw new Error("no result available");return this._result}}C3.Gfx.WebGLTimeElapsedQuery=class{constructor(a){this._renderer=a,this._frameNumber=a.GetFrameNumber(),this._isActive=!1,this._parentQuery=null,this._isNested=!1,this._realQuery=null,this._queries=[]}Release(){for(const b of this._queries)b instanceof a&&b.Release();C3.clearArray(this._queries),this._parentQuery=null,this._realQuery=null,this._renderer=null}BeginTimeElapsed(){if(this._isActive)throw new Error("query already active");const a=this._renderer._GetTimeQueryStack();0<a.length?(this._isNested=!0,this._parentQuery=a[a.length-1],this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null),this._isActive=!0,a.push(this),this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw new Error("query not active");const a=this._renderer._GetTimeQueryStack().pop();if(a!==this)throw new Error("can only end most nested query");this._isActive=!1,this._EndReal(),this._parentQuery&&(this._parentQuery._StartReal(),this._parentQuery=null)}_StartReal(){this._realQuery=C3.New(a,this._renderer),this._queries.push(this._realQuery),this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed(),this._realQuery=null}CheckForResult(){for(const a of this._queries)a.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every((a)=>a.HasResult())}GetResult(){return this._queries.reduce((b,a)=>b+a.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}}
// ../lib/gfx/webgl/queryResultBuffer.js
"use strict";C3.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();C3.clearArray(this._buffer)}AddTimeElapsedQuery(){const a=new C3.Gfx.WebGLTimeElapsedQuery(this._renderer);if(this._buffer.push(a),this._buffer.length>this._maxQueries){const a=this._buffer.shift();a.Release()}return a}CheckForResults(a){for(const b of this._buffer){if(b.GetFrameNumber()>=a)return;if(b.IsNested())return;b.CheckForResult()}}GetFrameRangeResultSum(a,b){if(b<=a)return NaN;let c=0;for(const d of this._buffer){if(d.GetFrameNumber()>=b)break;if(!(d.GetFrameNumber()<a))if(d.HasResult())c+=d.GetResult();else return NaN}return c}DeleteAllBeforeFrameNumber(a){for(let b=0,c=this._buffer.length;b<c;++b){const c=this._buffer[b];if(c.GetFrameNumber()<a)c.Release();else return void(0<b&&this._buffer.splice(0,b))}}};
// ../lib/gfx/webgl/webglRenderer.js
"use strict";{function e(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function t(){p=-1;for(const e of c)e.checkFunc()&&(e.resolve(),c.delete(e));0<c.size&&(p=self.requestAnimationFrame(t))}function r(e,t,r){let a=null;if(2.1<=r&&(a=e.getContext("webgl2-compute",t),a))return{gl:a,version:2.1};if(2<=r&&(a=e.getContext("webgl2",t),a))return{gl:a,version:2};if(a=e.getContext("webgl",t),!a)try{a=e.getContext("experimental-webgl",t)}catch(e){console.warn("Error requesting 'experimental-webgl' context: ",e)}return{gl:a,version:1}}const a={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,maxWebGLVersion:2},i=new Set(["default","low-power","high-performance"]);const n=new C3.Quad(0,0,1,0,1,1,0,1),_=vec3.fromValues(0,0,0),l=vec3.fromValues(0,0,0),o=mat4.create(),s=new C3.Quad,d=new C3.Rect;let u=null;C3.isDebug&&(self.debug_lose_context=function(){return u?void u.loseContext():void console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=function(){return u?void u.restoreContext():void console.warn("WEBGL_lose_context not supported")});const c=new Set;let p=-1;C3.Gfx.WebGLRenderer=class extends C3.Gfx.RendererBase{constructor(e,t){if(super(),t=Object.assign({},a,t),!i.has(t.powerPreference))throw new Error("invalid power preference");let n=!1;const _={"alpha":!!t.alpha,"depth":!1,"antialias":!1,"powerPreference":t.powerPreference,"failIfMajorPerformanceCaveat":!0};t.lowLatency&&(_["desynchronized"]=!0,_["preserveDrawingBuffer"]=!0);let l=r(e,_,t.maxWebGLVersion);if(l.gl||(n=!0,_["failIfMajorPerformanceCaveat"]=!1,l=r(e,_,t.maxWebGLVersion)),!l.gl)throw new Error("failed to initialise WebGL context");const o=l.gl;this._gl=o,this._attribs=o.getContextAttributes(),t.lowLatency&&!this._attribs["desynchronized"]&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here"),this._versionString=o.getParameter(o.VERSION),this._version=l.version,this._is3d=!0,this._lastBackbufferWidth=0,this._lastBackbufferHeight=0,this._vertexBuffer=null,this._texcoordBuffer=null,this._indexBuffer=null,this._pointBuffer=null,this._vertexData=new Float32Array(8000*this.GetNumVertexComponents()),this._indexData=new Uint16Array(12000),this._texcoordData=new Float32Array(16000),this._pointData=new Float32Array(32000),this._vertexPtr=0,this._texPtr=0,this._pointPtr=0,this._lastVertexPtr=0,this._lastProgram=null,this._spDeviceTransformTextureFill=null,this._spColorFill=null,this._spLinearGradientFill=null,this._spHardEllipseFill=null,this._spHardEllipseOutline=null,this._spSmoothEllipseFill=null,this._spSmoothEllipseOutline=null,this._spSmoothLineFill=null,this._spPoints=null,this._spTilemapFill=null,this._batch=[],this._batchPtr=0,this._topOfBatch=0,this._currentRenderTarget=null,this._baseZ=0,this._currentZ=0,this._lastPointZ=0,this._batchState=C3.New(C3.Gfx.BatchState,this),this._lastColor=C3.New(C3.Color,1,1,1,1),this._lastTexture0=null,this._lastTexture1=null,this._lastSrcBlend=0,this._lastDestBlend=0,this._lineWidth=1,this._lineWidthStack=[this._lineWidth],this._lineCap=1,this._lineCapStack=[this._lineCap],this._lineOffset=.5,this._lineOffsetStack=[this._lineOffset],this._isScissorViewport=!1,this._viewportScissorWidth=-1,this._viewportScissorHeight=-1,this._lastPointTexCoords=new C3.Rect,this._maxTextureSize=-1,this._minPointSize=0,this._maxPointSize=0,this._highpPrecision=0,this._unmaskedVendor="(unavailable)",this._unmaskedRenderer="(unavailable)",this._extensions=[],this._hasMajorPerformanceCaveat=n,this._isInitialisingAfterContextRestored=!1,this._parallelShaderCompileExt=null,this._isGpuProfilingEnabled=!!t.enableGpuProfiling,this._timerExt=null,this._allQueryResultBuffers=new Set,this._timeQueryStack=[],this.FillIndexBufferData(this._indexData)}async InitState(){const e=this._gl,t=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1),this._lastTexture0=null,this._lastTexture1=null,this._vertexPtr=0,this._pointPtr=0,this._lastVertexPtr=8000*t-4*t,C3.clearArray(this._batch),this._batchPtr=0,this._topOfBatch=0,this._lastProgram=null,this._currentRenderTarget=null,this._lastPointTexCoords.set(0,0,1,1),this._baseZ=0,this._currentZ=0,this._lastPointZ=0;const r=this._batchState;r.currentShader=null,r.currentFramebuffer=null,vec4.set(r.currentColor,1,1,1,1),r.clearColor.setRgba(0,0,0,0),r.pointTexCoords.set(0,0,1,1),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),this._lastSrcBlend=e.ONE,this._lastDestBlend=e.ONE_MINUS_SRC_ALPHA,this._InitBlendModes(e),e.disable(e.CULL_FACE),e.disable(e.STENCIL_TEST),e.disable(e.DITHER),e.disable(e.DEPTH_TEST),this._pointBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._pointBuffer),e.bufferData(e.ARRAY_BUFFER,this._pointData.byteLength,e.DYNAMIC_DRAW),this._vertexBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this._vertexData.byteLength,e.DYNAMIC_DRAW),this._texcoordBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._texcoordBuffer),e.bufferData(e.ARRAY_BUFFER,this._texcoordData.byteLength,e.DYNAMIC_DRAW),this._indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this._indexData,e.STATIC_DRAW),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),this._maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE);const a=e.getParameter(e.ALIASED_POINT_SIZE_RANGE);this._minPointSize=a[0],this._maxPointSize=a[1];const i=e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT),n=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT);this._highpPrecision=i&&n?Math.min(i["precision"],n["precision"]):0,2048<this._maxPointSize&&(this._maxPointSize=2048),this._extensions=e.getSupportedExtensions();const _=e.getExtension("WEBGL_debug_renderer_info");_&&(this._unmaskedVendor=e.getParameter(_["UNMASKED_VENDOR_WEBGL"]),this._unmaskedRenderer=e.getParameter(_["UNMASKED_RENDERER_WEBGL"])),this._parallelShaderCompileExt=e.getExtension("KHR_parallel_shader_compile"),C3.isDebug&&(u=e.getExtension("WEBGL_lose_context")),this._isGpuProfilingEnabled&&(1===this.GetWebGLVersionNumber()?("Chromium"!==C3.Platform.BrowserEngine||81<=C3.Platform.BrowserVersionNumber||"undefined"!=typeof document)&&(this._timerExt=e.getExtension("EXT_disjoint_timer_query")):this._timerExt=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query")),this._ClearAllShaderPrograms();const l=C3.Gfx.WebGLShaderProgram,o=l.GetDefaultVertexShaderSource(this._is3d,!1),s=[[l.GetTextureFillFragmentShaderSource(),o,"<default>"],[l.GetTextureFillFragmentShaderSource(),o,"<default-device-transform>"],[l.GetPointFragmentShaderSource(),l.GetPointVertexShaderSource(),"<point>"],[l.GetColorFillFragmentShaderSource(),o,"<fill>"],[l.GetLinearGradientFillFragmentShaderSource(),o,"<lineargradient>"],[l.GetHardEllipseFillFragmentShaderSource(),o,"<hardellipse>"],[l.GetHardEllipseOutlineFragmentShaderSource(),o,"<hardellipseoutline>"],[l.GetSmoothEllipseFillFragmentShaderSource(),o,"<smoothellipse>"],[l.GetSmoothEllipseOutlineFragmentShaderSource(),o,"<smoothellipseoutline>"],[l.GetSmoothLineFillFragmentShaderSource(),o,"<smoothline>"],[l.GetTilemapFragmentShaderSource(),l.GetDefaultVertexShaderSource(this._is3d,!0),"<tilemap>"]],d=await Promise.all(s.map((e)=>this.CreateShaderProgram({src:e[0]},e[1],e[2])));this._spTextureFill=d[0],this._spDeviceTransformTextureFill=d[1],this._spPoints=d[2],this._spColorFill=d[3],this._spLinearGradientFill=d[4],this._spHardEllipseFill=d[5],this._spHardEllipseOutline=d[6],this._spSmoothEllipseFill=d[7],this._spSmoothEllipseOutline=d[8],this._spSmoothLineFill=d[9],this._spTilemapFill=d[10],this._currentStateGroup=null,this.SetTextureFillMode()}Is3D(){return this._is3d}GetNumVertexComponents(){return this._is3d?3:2}SetBaseZ(e){this._baseZ=e}GetBaseZ(){return this._baseZ}SetCurrentZ(e){this._currentZ=e,this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}async CreateShaderProgram(e,t,r){const a=await C3.Gfx.WebGLShaderProgram.Create(this,e,t,r);return this._AddShaderProgram(a),a}ResetLastProgram(){this._lastProgram=null}SetSize(e,t,r){if(this._width!==e||this._height!==t||r){this.EndBatch();const r=this._gl,a=this._batchState;this._width=e,this._height=t;const i=this.GetScissoredViewportWidth(),n=this.GetScissoredViewportHeight();this._UpdateViewportRenderer(i,n,this._width,this._height),this._UpdateViewportBatch(i,n,this._matP),this._spDeviceTransformTextureFill&&(r.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),this._lastProgram=this._spDeviceTransformTextureFill,this._batchState.currentShader=this._spDeviceTransformTextureFill),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,null),r.activeTexture(r.TEXTURE0),this._lastTexture0=null,this._lastTexture1=null,this._currentRenderTarget&&this._currentRenderTarget._Resize(this._width,this._height),r.bindFramebuffer(r.FRAMEBUFFER,null),this._currentRenderTarget=null,a.currentFramebuffer=null}}_UpdateViewportRenderer(e,t,r,a){this._cam[2]=100,mat4.lookAt(this._matMV,this._cam,this._look,this._up),mat4.perspective(this._matP,45,e/t,this.GetNearZ(),this.GetFarZ());const i=[0,0],n=[0,0],_=self.devicePixelRatio;this.Project(0,0,e,t,i),this.Project(1,1,e,t,n),this._worldScale[0]=_/(n[0]-i[0]),this._worldScale[1]=-_/(n[1]-i[1]),this._lastBackbufferWidth=r,this._lastBackbufferHeight=a}_UpdateViewportBatch(e,t,r){const a=this._gl,i=this._batchState;a.viewport(0,0,e,t);const n=this._allShaderPrograms,_=i.currentShader;for(let a=0,i=n.length;a<i;++a){const e=n[a];e===_?e.UpdateMatP(r,!0):e.SetMatPStale()}mat4.copy(i.currentMatP,r)}SetViewportScissor(e,t){const r=this._gl;return this._width===e&&this._height===t?void(this._isScissorViewport&&(this.EndBatch(),r.disable(r.SCISSOR_TEST),this._isScissorViewport=!1,this._viewportScissorWidth=-1,this._viewportScissorHeight=-1,this.SetSize(this._width,this._height,!0))):void(!this._isScissorViewport&&(this.EndBatch(),r.enable(r.SCISSOR_TEST),this._isScissorViewport=!0),(this._viewportScissorWidth!==e||this._viewportScissorHeight!==t)&&(this.EndBatch(),r.scissor(0,0,e,t),this._viewportScissorWidth=e,this._viewportScissorHeight=t,this.SetSize(this._width,this._height,!0)))}RemoveViewportScissor(){const e=this._gl;this._isScissorViewport&&(this.EndBatch(),e.disable(e.SCISSOR_TEST),this._isScissorViewport=!1),this._viewportScissorWidth=-1,this._viewportScissorHeight=-1}GetScissoredViewportWidth(){return this._isScissorViewport?this._viewportScissorWidth:this.GetWidth()}GetScissoredViewportHeight(){return this._isScissorViewport?this._viewportScissorHeight:this.GetHeight()}UpdateModelView(){if(!e(this._lastMV,this._matMV)){const e=this.PushBatch();e.InitUpdateModelView(this._matMV),mat4.copy(this._lastMV,this._matMV),this._topOfBatch=0}}GetBatchState(){return this._batchState}PushBatch(){const e=this._batch;return this._batchPtr===e.length&&e.push(new C3.Gfx.WebGLBatchJob(this._batchState)),e[this._batchPtr++]}EndBatch(){0===this._batchPtr||this.IsContextLost()||(this._WriteBuffers(),this._ExecuteBatch(),this._batchPtr=0,this._vertexPtr=0,this._texPtr=0,this._pointPtr=0,this._topOfBatch=0)}_WriteBuffers(){const e=this._gl;0<this._pointPtr&&(e.bindBuffer(e.ARRAY_BUFFER,this._pointBuffer),e.bufferSubData(e.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr))),0<this._vertexPtr&&(e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer),e.bufferSubData(e.ARRAY_BUFFER,0,this._vertexData.subarray(0,this._vertexPtr)),e.bindBuffer(e.ARRAY_BUFFER,this._texcoordBuffer),e.bufferSubData(e.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const e=this._batch;for(let t=0,r=this._batchPtr;t<r;++t)e[t].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(e,t,r,i){const a=this._lastColor;if(!a.equalsRgba(e,t,r,i)){a.setRgba(e,t,r,i);const n=this.PushBatch();n.InitSetColor(a),this._topOfBatch=0,this._currentStateGroup=null}}SetOpacity(e){const t=this._lastColor;if(t.getA()!==e){t.setA(e);const r=this.PushBatch();r.InitSetColor(t),this._topOfBatch=0,this._currentStateGroup=null}}SetColor(e){const t=this._lastColor;if(!t.equals(e)){t.set(e);const r=this.PushBatch();r.InitSetColor(t),this._topOfBatch=0,this._currentStateGroup=null}}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(e){if(e!==this._lastTexture0){const t=this.PushBatch();t.InitSetTexture(e),this._lastTexture0=e,this._topOfBatch=0}}_ResetLastTexture(){this._lastTexture0=null}SetBlend(e,t){if(e!==this._lastSrcBlend||t!==this._lastDestBlend){const r=this.PushBatch();r.InitSetBlend(e,t),this._lastSrcBlend=e,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(e){this.Rect2(e.getLeft(),e.getTop(),e.getRight(),e.getBottom())}Rect2(e,t,r,a){this.Quad2(e,t,r,t,r,a,e,a)}_ExtendQuadBatch(){let e=this._vertexPtr;if(e>=this._lastVertexPtr&&(this.EndBatch(),e=0),1===this._topOfBatch)this._batch[this._batchPtr-1]._indexCount+=6;else{const t=this.PushBatch();t.InitQuad(this._is3d?e:3*(e/2),6),this._topOfBatch=1}}_WriteQuadToVertexBuffer(e){e.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+this._currentZ),this._vertexPtr+=12}Quad(e){this._ExtendQuadBatch(),this._WriteQuadToVertexBuffer(e),n.writeToTypedArray(this._texcoordData,this._texPtr),this._texPtr+=8}Quad2(e,t,r,a,i,_,l,o){this._ExtendQuadBatch();const s=this._vertexData;let d=this._vertexPtr;const u=this._baseZ+this._currentZ;this._is3d?(s[d++]=e,s[d++]=t,s[d++]=u,s[d++]=r,s[d++]=a,s[d++]=u,s[d++]=i,s[d++]=_,s[d++]=u,s[d++]=l,s[d++]=o,s[d++]=u):(s[d++]=e,s[d++]=t,s[d++]=r,s[d++]=a,s[d++]=i,s[d++]=_,s[d++]=l,s[d++]=o),this._vertexPtr=d,n.writeToTypedArray(this._texcoordData,this._texPtr),this._texPtr+=8}Quad3(e,t){this._ExtendQuadBatch(),this._WriteQuadToVertexBuffer(e),t.writeAsQuadToTypedArray(this._texcoordData,this._texPtr),this._texPtr+=8}Quad4(e,t){this._ExtendQuadBatch(),this._WriteQuadToVertexBuffer(e),t.writeToTypedArray(this._texcoordData,this._texPtr),this._texPtr+=8}FullscreenQuad(e,t){var r=Math.max,a=Math.min;if(mat4.copy(o,this._lastMV),vec3.copy(_,this._cam),vec3.copy(l,this._look),this._cam[0]=0,this._cam[1]=0,this._cam[2]=100*self.devicePixelRatio,this._look[0]=0,this._look[1]=0,this._look[2]=0,this.ResetModelView(),this.UpdateModelView(),this._isScissorViewport){const e=this._viewportScissorWidth/2,t=this._viewportScissorHeight/2;d.set(-e,t,-e+this._viewportScissorWidth,t-this._viewportScissorHeight),s.setFromRect(d),d.set(0,0,this._viewportScissorWidth/this._width,this._viewportScissorHeight/this._height),this.Quad3(s,d)}else if("crop"===e&&this._currentRenderTarget&&t){const e=this._width/2,i=this._height/2,n=t.GetWidth(),_=t.GetHeight(),l=this._currentRenderTarget.GetWidth(),o=this._currentRenderTarget.GetHeight(),u=a(l,n),c=a(o,_),p=r(_-o,0),f=r(o-_,0);d.set(-e,i-f,-e+u,i-c-f),s.setFromRect(d),d.set(0,p,u,c+p),d.divide(n,_),this.Quad3(s,d)}else{let[e,t]=this.GetRenderTargetSize(this._currentRenderTarget);const r=e/2,a=t/2;this.Rect2(-r,a,r,-a)}mat4.copy(this._matMV,o),vec3.copy(this._cam,_),vec3.copy(this._look,l),this.UpdateModelView()}ConvexPoly(e){const t=e.length/2;if(3>t)throw new Error("need at least 3 points");const r=t-2,a=e[0],n=e[1];for(let t=0;t<r;t+=2){const i=2*t,_=e[i+2],l=e[i+3],o=e[i+4],s=e[i+5];if(t==r-1)this.Quad2(a,n,_,l,o,s,o,s);else{const t=e[i+6],r=e[i+7];this.Quad2(a,n,_,l,o,s,t,r)}}}Line(e,t,r,i){const n=C3.angleTo(e,t,r,i),a=Math.sin(n),_=Math.cos(n),l=.5*this._lineWidth,o=a*l,s=_*l,d=this._lineCap;2===d?this.LinePreCalc_LineCap2(e,t,r,i,o,s):1===d?this.LinePreCalc_LineCap1(e,t,r,i,o,s):this.LinePreCalc_LineCap0(e,t,r,i,o,s)}LinePreCalc_LineCap2(e,t,r,a,i,n){const _=this._lineOffset,l=e+_-n,o=t+_-i,s=r+_+n,d=a+_+i,u=2*n,c=2*i;this.Quad2(l+i,o-n,s+i,d-n,s-i-u,d+n-c,l-i+u,o+n+c)}LinePreCalc_LineCap1(e,t,r,a,i,n){const _=this._lineOffset,l=e+_-n,o=t+_-i,s=r+_+n,d=a+_+i;this.Quad2(l+i,o-n,s+i,d-n,s-i,d+n,l-i,o+n)}LinePreCalc_LineCap0(e,t,r,a,i,n){const _=this._lineOffset,l=e+_,o=t+_,s=r+_,d=a+_;this.Quad2(l+i,o-n,s+i,d-n,s-i,d+n,l-i,o+n)}TexturedLine(e,t,r,i,n,_){const l=C3.angleTo(e,t,r,i),a=Math.sin(l),o=Math.cos(l),s=.5*this._lineWidth,d=a*s,u=o*s,c=this._lineCap;2===c?this.TexturedLinePreCalc_LineCap2(e,t,r,i,d,u,n,_):1===c?this.TexturedLinePreCalc_LineCap1(e,t,r,i,d,u,n,_):this.TexturedLinePreCalc_LineCap0(e,t,r,i,d,u,n,_)}TexturedLinePreCalc_LineCap2(e,t,r,a,i,n,_,l){const o=this._lineOffset,u=e+o-n,c=t+o-i,p=r+o+n,f=a+o+i,h=2*n,g=2*i;s.set(u+i,c-n,p+i,f-n,p-i-h,f+n-g,u-i+h,c+n+g),d.set(_,0,l,0),this.Quad3(s,d)}TexturedLinePreCalc_LineCap1(e,t,r,a,i,n,_,l){const o=this._lineOffset,u=e+o-n,c=t+o-i,p=r+o+n,f=a+o+i;s.set(u+i,c-n,p+i,f-n,p-i,f+n,u-i,c+n),d.set(_,0,l,0),this.Quad3(s,d)}TexturedLinePreCalc_LineCap0(e,t,r,a,i,n,_,l){const o=this._lineOffset,u=e+o,c=t+o,p=r+o,f=a+o;s.set(u+i,c-n,p+i,f-n,p-i,f+n,u-i,c+n),d.set(_,0,l,0),this.Quad3(s,d)}LineRect(e,t,r,a){const i=.5*this._lineWidth,n=this._lineCap;2===n?this._LineRectPreCalc_LineCap2(e,t,r,a,i):1===n?this._LineRectPreCalc_LineCap1(e,t,r,a,i):this._LineRectPreCalc_LineCap0(e,t,r,a,i)}_LineRectPreCalc_LineCap2(e,t,r,a,i){this.LinePreCalc_LineCap2(e,t,r,t,0,i),this.LinePreCalc_LineCap2(r,t,r,a,i,0),this.LinePreCalc_LineCap2(r,a,e,a,0,-i),this.LinePreCalc_LineCap2(e,a,e,t,-i,0)}_LineRectPreCalc_LineCap1(e,t,r,a,i){this.LinePreCalc_LineCap1(e,t,r,t,0,i),this.LinePreCalc_LineCap1(r,t,r,a,i,0),this.LinePreCalc_LineCap1(r,a,e,a,0,-i),this.LinePreCalc_LineCap1(e,a,e,t,-i,0)}_LineRectPreCalc_LineCap0(e,t,r,a,i){this.LinePreCalc_LineCap0(e,t,r,t,0,i),this.LinePreCalc_LineCap0(r,t,r,a,i,0),this.LinePreCalc_LineCap0(r,a,e,a,0,-i),this.LinePreCalc_LineCap0(e,a,e,t,-i,0)}LineRect2(e){this.LineRect(e.getLeft(),e.getTop(),e.getRight(),e.getBottom())}LineQuad(e){const t=C3.angleTo(e.getTlx(),e.getTly(),e.getTrx(),e.getTry()),r=Math.sin(t),a=Math.cos(t),i=.5*this._lineWidth,n=r*i,_=a*i,l=this._lineCap;2===l?this._LineQuadPreCalc_LineCap2(e,n,_):1===l?this._LineQuadPreCalc_LineCap1(e,n,_):this._LineQuadPreCalc_LineCap0(e,n,_)}_LineQuadPreCalc_LineCap2(e,t,r){this.LinePreCalc_LineCap2(e.getTlx(),e.getTly(),e.getTrx(),e.getTry(),t,r),this.LinePreCalc_LineCap2(e.getTrx(),e.getTry(),e.getBrx(),e.getBry(),r,-t),this.LinePreCalc_LineCap2(e.getBrx(),e.getBry(),e.getBlx(),e.getBly(),-t,-r),this.LinePreCalc_LineCap2(e.getBlx(),e.getBly(),e.getTlx(),e.getTly(),-r,t)}_LineQuadPreCalc_LineCap1(e,t,r){this.LinePreCalc_LineCap1(e.getTlx(),e.getTly(),e.getTrx(),e.getTry(),t,r),this.LinePreCalc_LineCap1(e.getTrx(),e.getTry(),e.getBrx(),e.getBry(),r,-t),this.LinePreCalc_LineCap1(e.getBrx(),e.getBry(),e.getBlx(),e.getBly(),-t,-r),this.LinePreCalc_LineCap1(e.getBlx(),e.getBly(),e.getTlx(),e.getTly(),-r,t)}_LineQuadPreCalc_LineCap0(e,t,r){this.LinePreCalc_LineCap0(e.getTlx(),e.getTly(),e.getTrx(),e.getTry(),t,r),this.LinePreCalc_LineCap0(e.getTrx(),e.getTry(),e.getBrx(),e.getBry(),r,-t),this.LinePreCalc_LineCap0(e.getBrx(),e.getBry(),e.getBlx(),e.getBly(),-t,-r),this.LinePreCalc_LineCap0(e.getBlx(),e.getBly(),e.getTlx(),e.getTly(),-r,t)}SetLineWidth(e){this._lineWidth=e,this._lineWidthStack[this._lineWidthStack.length-1]=e}GetLineWidth(){return this._lineWidth}PushLineWidth(e){if(100<=this._lineWidthStack.length)throw new Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(e),this._lineWidth=e}PopLineWidth(){if(1>=this._lineWidthStack.length)throw new 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(e){if("butt"===e)this.PushLineCapButt();else if("square"===e)this.PushLineCapSquare();else if("zag"===e)this.PushLineCapZag();else throw new Error("invalid line cap")}PushLineCapButt(){if(100<=this._lineCapStack.length)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0),this._lineCap=0}PushLineCapSquare(){if(100<=this._lineCapStack.length)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1),this._lineCap=1}PushLineCapZag(){if(100<=this._lineCapStack.length)throw new Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(2),this._lineCap=2}PopLineCap(){if(1>=this._lineCapStack.length)throw new Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop(),this._lineCap=this._lineCapStack[this._lineCapStack.length-1]}SetLineOffset(e){this._lineOffset=e,this._lineOffsetStack[this._lineOffsetStack.length-1]=e}GetLineOffset(){return this._lineOffset}PushLineOffset(e){if(100<=this._lineOffsetStack.length)throw new Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(e),this._lineOffset=e}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw new Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop(),this._lineOffset=this._lineOffsetStack[this._lineOffsetStack.length-1]}SetPointTextureCoords(e){if(!this._lastPointTexCoords.equals(e)){this._lastPointTexCoords.copy(e);const t=this.PushBatch();t.InitSetPointTexCoords(e),this._topOfBatch=0}}Point(e,t,r,a){this._pointPtr>=7996&&this.EndBatch();let i=this._pointPtr;const n=this._baseZ+this._currentZ;if(2===this._topOfBatch&&this._lastPointZ===n)this._batch[this._batchPtr-1]._indexCount++;else{const e=this.PushBatch();e.InitPoints(i,n),this._topOfBatch=2,this._lastPointZ=n}const _=this._pointData;_[i++]=e,_[i++]=t,_[i++]=r,_[i++]=a,this._pointPtr=i}SetProgram(e){if(this._lastProgram!==e){const t=this.PushBatch();t.InitSetProgram(e),this._lastProgram=e,this._topOfBatch=0,this._currentStateGroup=null}}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetGradientColor(e){const t=this.PushBatch();t.InitSetGradientColor(e),this._topOfBatch=0}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetEllipseParams(e,t,r=1){const a=this.PushBatch();a.InitSetEllipseParams(e,t,r),this._topOfBatch=0}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetTilemapInfo(e,t,r,a,i,n,_){if(this._lastProgram!==this._spTilemapFill)throw new Error("must set tilemap fill mode first");const l=this.PushBatch();l.InitSetTilemapInfo(e,t,r,a,i,n,_),this._topOfBatch=0}SetProgramParameters(e,t,r,a,i,n,_,l,o,d,u){const c=this._lastProgram,s=c._hasAnyOptionalUniforms,p=!!u.length;if(s&&!c.AreOptionalUniformsAlreadySetInBatch(t,r,a,i,n,_,l,o,d)||p&&!c.AreCustomParametersAlreadySetInBatch(u)){const f=this.PushBatch();if(f.InitSetProgramParameters(),s){c.SetOptionalUniformsInBatch(t,r,a,i,n,_,l,o,d);const s=f._mat4param;s[0]=n,s[1]=_,t.writeToTypedArray(s,2),s[6]=l,s[7]=o,r.writeToTypedArray(s,12);const u=f._colorParam;i.writeToTypedArray(u,0);const p=u[1];u[1]=u[3],u[3]=p,a.writeToTypedArray(f._srcOriginRect,0),f._startIndex=d,f._texParam=c._uSamplerBack.IsUsed()?e?e.GetTexture():null:null}p&&(c.SetCustomParametersInBatch(u),C3.shallowAssignArray(f._shaderParams,u)),this._topOfBatch=0}}ClearRgba(e,t,r,i){const a=this.PushBatch();a.InitClearSurface2(e,t,r,i),this._topOfBatch=0}Clear(e){const t=this.PushBatch();t.InitClearSurface(e),this._topOfBatch=0}ClearRect(e,t,r,a){this.ClearRect4(e,t,r,a,0,0,0,0)}ClearRect2(e){this.ClearRect4(e.getLeft(),e.getTop(),e.width(),e.height(),0,0,0,0)}ClearRect3(e,t){this.ClearRect4(e.getLeft(),e.getTop(),e.width(),e.height(),t.getR(),t.getG(),t.getB(),t.getA())}ClearRect4(e,t,i,n,_,r,l,o){if(!(0>i||0>n)){const a=this.PushBatch();a.InitClearRect(e,t,i,n,_,r,l,o),this._topOfBatch=0}}Start(){}Finish(){super.Finish(),this._gl.flush()}CheckForQueryResults(){for(const e of this._allQueryResultBuffers)e.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){C3.Gfx.WebGLRendererTexture.OnContextLost(),C3.Gfx.WebGLRenderTarget.OnContextLost(),C3.Gfx.WebGLText.OnContextLost();for(const e of this._allQueryResultBuffers)e.Clear();this._extensions=[],this._timerExt=null,this._parallelShaderCompileExt=null,this._unmaskedVendor="(unavailable)",this._unmaskedRenderer="(unavailable)",this._lastProgram=null,this._spTextureFill=null,this._spDeviceTransformTextureFill=null,this._spColorFill=null,this._spLinearGradientFill=null,this._spHardEllipseFill=null,this._spHardEllipseOutline=null,this._spSmoothEllipseFill=null,this._spSmoothEllipseOutline=null,this._spSmoothLineFill=null,this._spPoints=null,this._spTilemapFill=null;for(const e of this._stateGroups.values())e.OnContextLost();for(const e of this._allShaderPrograms)e.Release();this._ClearAllShaderPrograms()}async OnContextRestored(){this._isInitialisingAfterContextRestored=!0,await this.InitState(),this._isInitialisingAfterContextRestored=!1;for(const e of this._stateGroups.values())e.OnContextRestored(this);this.SetSize(this._width,this._height,!0)}CreateStaticTexture(e,t){if(this.IsContextLost())throw new Error("context lost");this.EndBatch();const r=C3.New(C3.Gfx.WebGLRendererTexture,this);return r._CreateStatic(e,t),r}CreateStaticTextureAsync(e,t){return this.IsContextLost()?Promise.reject("context lost"):(t=Object.assign({},t),C3.Supports.ImageBitmapOptions&&(this.SupportsNPOTTextures()||!t.isTiled)?(t.premultiplyAlpha=!1,createImageBitmap(e,{"premultiplyAlpha":"premultiply"}).then((e)=>C3.Asyncify(()=>this.CreateStaticTexture(e,t)))):C3.Supports.ImageBitmap?createImageBitmap(e).then((e)=>C3.Asyncify(()=>this.CreateStaticTexture(e,t))):e instanceof Blob?C3.BlobToImage(e,!0).then((e)=>this.CreateStaticTextureAsync(e,t)):"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement&&"function"==typeof e["decode"]?e["decode"]().then(()=>C3.Asyncify(()=>this.CreateStaticTexture(e,t))):C3.Asyncify(()=>this.CreateStaticTexture(e,t)))}CreateDynamicTexture(e,t,r){this.EndBatch();const a=C3.New(C3.Gfx.WebGLRendererTexture,this);return a._CreateDynamic(e,t,r),a}UpdateTexture(e,t,r){this.EndBatch(),t._Update(e,r)}DeleteTexture(e){e&&(e.SubtractReference(),0<e.GetReferenceCount()||(this.EndBatch(),e===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),e===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),e._Delete()))}CreateRenderTarget(e){let t=this._width,r=this._height,a=!0;if(e&&("number"==typeof e.width&&(t=e.width,a=!1),"number"==typeof e.height&&(r=e.height,a=!1)),0>=t||0>=r)throw new Error("invalid size");this.EndBatch();const i=C3.New(C3.Gfx.WebGLRenderTarget,this);return i._Create(t,r,Object.assign({isDefaultSize:a},e)),this._currentRenderTarget=null,this._batchState.currentFramebuffer=null,i}SetRenderTarget(e){if(e===this._currentRenderTarget)return;let t,r,a,i;e?(e.IsDefaultSize()&&e._Resize(this._width,this._height),a=e.GetWidth(),i=e.GetHeight(),t=a,r=i):(a=this._width,i=this._height,t=this.GetScissoredViewportWidth(),r=this.GetScissoredViewportHeight());const n=this._lastBackbufferWidth!==a||this._lastBackbufferHeight!==i;n&&this._UpdateViewportRenderer(t,r,a,i);const _=this.PushBatch();_.InitSetRenderTarget(e,n,this._matP),this._currentRenderTarget=e,this._topOfBatch=0}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(e){return e?[e.GetWidth(),e.GetHeight()]:[this._width,this._height]}CopyRenderTarget(e,t="stretch"){if(2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling())this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(e,t);else{const r=this.PushBatch();r.InitBlitFramebuffer(e,this._currentRenderTarget,t),this._topOfBatch=0}}DrawRenderTarget(e,t="stretch"){const r=e.GetTexture();if(!r)throw new Error("not a texture-backed render target");this.SetTexture(r),this.FullscreenQuad(t,r)}InvalidateRenderTarget(e){if(!(2>this._version)){const t=this.PushBatch();t.InitInvalidateFramebuffer(e._GetFramebuffer()),this._topOfBatch=0}}DeleteRenderTarget(e){this.SetRenderTarget(null),this.EndBatch();const t=e.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),e._Delete()}async ReadBackRenderTargetToImageData(e,t){this.EndBatch();const r=this._currentRenderTarget;let a,i,n;e?(a=e.GetWidth(),i=e.GetHeight(),n=e._GetFramebuffer()):(a=this.GetWidth(),i=this.GetHeight(),n=null);const _=this._gl;_.bindFramebuffer(_.FRAMEBUFFER,n);const l=()=>{_.bindFramebuffer(_.FRAMEBUFFER,null),this._currentRenderTarget=null,this._batchState.currentFramebuffer=null,this.SetRenderTarget(r)};let o;if(!t&&2<=this.GetWebGLVersionNumber()){_.bindFramebuffer(_.READ_FRAMEBUFFER,n);const e=_.createBuffer(),t=4*(a*i),r=_["PIXEL_PACK_BUFFER"];_.bindBuffer(r,e),_.bufferData(r,t,_["STREAM_READ"]),_.readPixels(0,0,a,i,_.RGBA,_.UNSIGNED_BYTE,0),_.bindFramebuffer(_.READ_FRAMEBUFFER,null),_.bindBuffer(r,null),l();const s=_["fenceSync"](_["SYNC_GPU_COMMANDS_COMPLETE"],0);await this._WaitForObjectReady(()=>_["getSyncParameter"](s,_["SYNC_STATUS"])===_["SIGNALED"]),_["deleteSync"](s),o=new ImageData(a,i),_.bindBuffer(r,e),_["getBufferSubData"](r,0,new Uint8Array(o.data.buffer),0,t),_.bindBuffer(r,null),_.deleteBuffer(e)}else o=new ImageData(a,i),_.readPixels(0,0,a,i,_.RGBA,_.UNSIGNED_BYTE,new Uint8Array(o.data.buffer)),l();return o}StartQuery(e){if(this.SupportsGPUProfiling()){const t=this.PushBatch();t.InitStartQuery(e),this._topOfBatch=0}}EndQuery(e){if(this.SupportsGPUProfiling()){const t=this.PushBatch();t.InitEndQuery(e),this._topOfBatch=0}}_WaitForObjectReady(e){const r=new Promise((t)=>c.add({resolve:t,checkFunc:e}));return-1===p&&(p=self.requestAnimationFrame(t)),r}IsDesynchronized(){return!!this._attribs["desynchronized"]}GetEstimatedBackBufferMemoryUsage(){return this._width*this._height*(this._attribs["alpha"]?4:3)}GetEstimatedRenderBufferMemoryUsage(){let e=0;for(const r of C3.Gfx.WebGLRenderTarget.allRenderTargets())r.GetTexture()||(e+=r.GetEstimatedMemoryUsage());return e}GetEstimatedTextureMemoryUsage(){let e=0;for(const r of C3.Gfx.WebGLRendererTexture.allTextures())e+=r.GetEstimatedMemoryUsage();return e}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}SupportsNPOTTextures(){return 2<=this.GetWebGLVersionNumber()}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return 0!==this._highpPrecision}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetExtensions(){return this._extensions}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_AddQueryResultBuffer(e){this._allQueryResultBuffers.add(e)}_RemoveQueryResultBuffer(e){this._allQueryResultBuffers.delete(e)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(e){this._InitBlendModeData([["normal",e.ONE,e.ONE_MINUS_SRC_ALPHA],["additive",e.ONE,e.ONE],["xor",e.ONE,e.ONE_MINUS_SRC_ALPHA],["copy",e.ONE,e.ZERO],["destination-over",e.ONE_MINUS_DST_ALPHA,e.ONE],["source-in",e.DST_ALPHA,e.ZERO],["destination-in",e.ZERO,e.SRC_ALPHA],["source-out",e.ONE_MINUS_DST_ALPHA,e.ZERO],["destination-out",e.ZERO,e.ONE_MINUS_SRC_ALPHA],["source-atop",e.DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],["destination-atop",e.ONE_MINUS_DST_ALPHA,e.SRC_ALPHA]])}CreateWebGLText(){return C3.New(C3.Gfx.WebGLText,this)}}}
// c3/assets/assetManager.js
"use strict";{function a(a){if(!a)return"";const b=a.split(".");if(2>b.length)return"";const c=b[b.length-1].toLowerCase();return d.get(c)||""}function b(a){return new Promise((b,c)=>{const d=document.createElement("script");d.onload=b,d.onerror=c,d.async=!1,d.src=a,document.head.appendChild(d)})}const c=new Set(["local","remote"]),d=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"]]);C3.AssetManager=class extends C3.DefendedBase{constructor(a,b){if(super(),!c.has(b.defaultLoadPolicy))throw new Error("invalid load policy");if(this._runtime=a,this._localUrlBlobs=new Map,this._localBlobUrlCache=new Map,this._isCordova=!!b.isCordova,this._isiOSCordova=!!b.isiOSCordova,this._supportedAudioFormats=b.supportedAudioFormats||{},this._audioFiles=new Map,this._preloadSounds=!1,this._mediaSubfolder="",this._fontsSubfolder="",this._iconsSubfolder="",this._defaultLoadPolicy=b.defaultLoadPolicy,this._allAssets=[],this._assetsByUrl=new Map,this._webFonts=[],this._loadPromises=[],this._hasFinishedInitialLoad=!1,this._totalAssetSizeToLoad=0,this._assetSizeLoaded=0,this._lastLoadProgress=0,this._hasHadErrorLoading=!1,this._loadingRateLimiter=C3.New(C3.RateLimiter,()=>this._FireLoadingProgressEvent(),50),this._promiseThrottle=new C3.PromiseThrottle(Math.max(C3.hardwareConcurrency,8)),b.localUrlBlobs)for(const[a,c]of Object.entries(b.localUrlBlobs))this._localUrlBlobs.set(a.toLowerCase(),c);this._iAssetManager=new IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const a of this._localBlobUrlCache.values())URL.revokeObjectURL(a);this._localBlobUrlCache.clear();for(const a of this._allAssets)a.Release();C3.clearArray(this._allAssets),this._assetsByUrl.clear(),C3.clearArray(this._loadPromises),this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(a){this._mediaSubfolder=a}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(a){this._fontsSubfolder=a}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(a){this._iconsSubfolder=a}GetIconsSubfolder(){return this._iconsSubfolder}_HasLocalUrlBlob(a){return this._localUrlBlobs.has(a.toLowerCase())}_GetLocalUrlBlob(a){return this._localUrlBlobs.get(a.toLowerCase())||null}GetLocalUrlAsBlobUrl(a){const b=this._GetLocalUrlBlob(a);if(!b)return a;let c=this._localBlobUrlCache.get(b);return c||(c=URL.createObjectURL(b),this._localBlobUrlCache.set(b,c)),c}FetchBlob(a,b){b=b||this._defaultLoadPolicy;const c=this._GetLocalUrlBlob(a);if(c)return Promise.resolve(c);if(C3.IsRelativeURL(a)){const c=a.toLowerCase();return this._isCordova?this.CordovaFetchLocalFileAsBlob(c):"local"===b?this._promiseThrottle.Add(()=>C3.FetchBlob(c)):C3.FetchBlob(c)}return C3.FetchBlob(a)}FetchArrayBuffer(a){const b=this._GetLocalUrlBlob(a);if(b)return C3.BlobToArrayBuffer(b);if(C3.IsRelativeURL(a)){const b=a.toLowerCase();return this._isCordova?this.CordovaFetchLocalFileAsArrayBuffer(b):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>C3.FetchArrayBuffer(b)):C3.FetchArrayBuffer(b)}return C3.FetchArrayBuffer(a)}FetchText(a){const b=this._GetLocalUrlBlob(a);if(b)return C3.BlobToString(b);if(C3.IsRelativeURL(a)){const b=a.toLowerCase();return this._isCordova?this.CordovaFetchLocalFileAsText(b):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>C3.FetchText(b)):C3.FetchText(b)}return C3.FetchText(a)}async FetchJson(a){const b=await this.FetchText(a);return JSON.parse(b)}_CordovaFetchLocalFileAs(a,b){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{"filename":a,"as":b})}CordovaFetchLocalFileAsText(a){return this._CordovaFetchLocalFileAs(a,"text")}async CordovaFetchLocalFileAsBlob(b){const c=await this._CordovaFetchLocalFileAs(b,"buffer"),d=a(b);return new Blob([c],{"type":d})}async CordovaFetchLocalFileAsBlobURL(a){a=a.toLowerCase();let b=this._localBlobUrlCache.get(a);if(b)return b;const c=await this.CordovaFetchLocalFileAsBlob(a);return b=URL.createObjectURL(c),this._localBlobUrlCache.set(a,b),b}CordovaFetchLocalFileAsArrayBuffer(a){return this._CordovaFetchLocalFileAs(a,"buffer")}GetMediaFileUrl(a){return this._HasLocalUrlBlob(a)?this.GetLocalUrlAsBlobUrl(a):this._mediaSubfolder+a.toLowerCase()}GetProjectFileUrl(a,b=""){if(C3.IsAbsoluteURL(a)){if(b)throw new Error("cannot specify subfolder with remote URL");return Promise.resolve(a)}return this._HasLocalUrlBlob(a)?Promise.resolve(this.GetLocalUrlAsBlobUrl(a)):this._isCordova?this.CordovaFetchLocalFileAsBlobURL(b+a):Promise.resolve(b+a.toLowerCase())}LoadProjectFileUrl(a){return this.GetProjectFileUrl(a)}LoadImage(a){if(a.loadPolicy&&!c.has(a.loadPolicy))throw new Error("invalid load policy");let b=this._assetsByUrl.get(a.url);return b?b:(b=C3.New(C3.ImageAsset,this,{url:a.url,size:a.size||0,loadPolicy:a.loadPolicy||this._defaultLoadPolicy}),this._allAssets.push(b),this._assetsByUrl.set(b.GetURL(),b),this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=b.GetSize(),this._loadPromises.push(b.Load().then(()=>this._AddLoadedSize(b.GetSize())))),b)}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(a){console.error("Error loading: ",a),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(a){this._assetSizeLoaded+=a,this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const a=C3.New(C3.Event,"loadingprogress");this._lastLoadProgress=C3.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1),a.progress=this._lastLoadProgress,this._runtime.Dispatcher().dispatchEvent(a)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(a){C3.shallowAssignArray(this._webFonts,a),this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"==typeof FontFace)return Promise.resolve();const a=[];for(const[b,c,d]of this._webFonts)this._totalAssetSizeToLoad+=d,a.push(this._LoadWebFont(b,c).then(()=>this._AddLoadedSize(d)));return Promise.all(a)}async _LoadWebFont(a,b){try{const c=await this.GetProjectFileUrl(b,this._fontsSubfolder),d=new FontFace(a,`url('${c}')`);this._runtime.IsInWorker()?self.fonts.add(d):document.fonts.add(d),await d.load()}catch(b){console.warn(`[C3 runtime] Failed to load web font '${a}': `,b)}}IsAudioFormatSupported(a){return!!this._supportedAudioFormats[a]}_SetAudioFiles(a,b){this._preloadSounds=!!b;for(const[c,d,e]of a)this._audioFiles.set(c,{fileName:c,formats:d.map((a)=>({type:a[0],fileExtension:a[1],fullName:c+a[1],fileSize:a[2]})),isMusic:e})}GetPreferredAudioFile(a){const b=this._audioFiles.get(a.toLowerCase());if(!b)return null;let c=null;for(const d of b.formats)if(c||"audio/webm; codecs=opus"!==d.type||(c=d),this.IsAudioFormatSupported(d.type))return d;return c}GetProjectAudioFileUrl(a){const b=this.GetPreferredAudioFile(a);return b?{url:this.GetMediaFileUrl(b.fullName),type:b.type}:null}GetAudioToPreload(){if(this._preloadSounds){const a=[];for(const b of this._audioFiles.values()){if(b.isMusic)continue;const c=this.GetPreferredAudioFile(b.fileName);c&&a.push({originalUrl:b.fileName,url:this.GetMediaFileUrl(c.fullName),type:c.type,fileSize:c.fileSize})}return a}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...a){const c=await Promise.all(a.map((a)=>this.GetProjectFileUrl(a)));this._runtime.IsInWorker()?importScripts(...c):await Promise.all(c.map((a)=>b(a)))}async CompileWebAssembly(a){if(WebAssembly.compileStreaming){const b=await this.GetProjectFileUrl(a);return await WebAssembly.compileStreaming(fetch(b))}else{const b=await C3.FetchArrayBuffer(a);return await WebAssembly.compile(b)}}async LoadStyleSheet(a){const b=await this.GetProjectFileUrl(a);return await this._runtime.PostComponentMessageToDOMAsync("runtime","add-stylesheet",{"url":b})}}}
// c3/assets/asset.js
"use strict";C3.Asset=class extends C3.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._loadPromise=null,this._assetManager=null,this._runtime=null,this._blob=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,this._blob=a}).catch((a)=>console.error("Error loading resource: ",a)),this._loadPromise)}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._assetManager.FetchBlob(this._url,this._loadPolicy)}};
// c3/assets/imageAsset.js
"use strict";{const a=new C3.PromiseThrottle,b=new Set;C3.ImageAsset=class extends C3.Asset{constructor(a,c){super(a,c),this._texturePromise=null,this._webglTexture=null,this._refCount=0,this._imageWidth=-1,this._imageHeight=-1,b.add(this)}Release(){if(this.ReleaseTexture(),0!==this._refCount)throw new Error("released image asset which still has texture references");this._texturePromise=null,b.delete(this),super.Release()}static OnWebGLContextLost(){for(const a of b)a._texturePromise=null,a._webglTexture=null,a._refCount=0}LoadStaticTexture(b,c){return(this._refCount++,this._webglTexture)?Promise.resolve(this._webglTexture):this._texturePromise?this._texturePromise:(this._texturePromise=this.GetBlob().then((d)=>a.Add(()=>b.CreateStaticTextureAsync(d,c).then((a)=>(this._texturePromise=null,0===this._refCount)?(b.DeleteTexture(a),null):(this._webglTexture=a,this._imageWidth=a.GetWidth(),this._imageHeight=a.GetHeight(),this._webglTexture)))).catch((a)=>{throw console.error("Failed to load texture: ",a),a}),this._texturePromise)}ReleaseTexture(){if(0>=this._refCount)throw new Error("texture released too many times");if(this._refCount--,0===this._refCount&&this._webglTexture){const a=this._webglTexture.GetRenderer();a.DeleteTexture(this._webglTexture),this._webglTexture=null}}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const a=await this.GetBlob();return C3.Supports.ImageBitmapOptions?await createImageBitmap(a,{"premultiplyAlpha":"none"}):C3.Supports.ImageBitmap?await createImageBitmap(a):await C3.BlobToImage(a)}}}
// c3/layouts/renderCell.js
"use strict";{function a(c,a){return c.GetWorldInfo()._GetLastCachedZIndex()-a.GetWorldInfo()._GetLastCachedZIndex()}C3.RenderCell=class extends C3.DefendedBase{constructor(a,b,c){super(),this._grid=a,this._x=b,this._y=c,this._instances=[],this._isSorted=!0,this._pendingRemoval=new Set,this._isAnyPendingRemoval=!1}Release(){C3.clearArray(this._instances),this._pendingRemoval.clear(),this._grid=null}Reset(){C3.clearArray(this._instances),this._isSorted=!0,this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1}SetChanged(){this._isSorted=!1}IsEmpty(){return!this._instances.length||!(this._instances.length>this._pendingRemoval.size)&&(this._FlushPending(),!0)}Insert(a){return this._pendingRemoval.has(a)?(this._pendingRemoval.delete(a),void(0===this._pendingRemoval.size&&(this._isAnyPendingRemoval=!1))):void(this._instances.push(a),this._isSorted=1===this._instances.length)}Remove(a){this._pendingRemoval.add(a),this._isAnyPendingRemoval=!0,50<=this._pendingRemoval.size&&this._FlushPending()}_FlushPending(){return this._isAnyPendingRemoval?this._instances.length===this._pendingRemoval.size?void this.Reset():void(C3.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1):void 0}_EnsureSorted(){this._isSorted||(this._instances.sort(a),this._isSorted=!0)}Dump(a){this._FlushPending(),this._EnsureSorted(),this._instances.length&&a.push(this._instances)}}}
// c3/layouts/renderGrid.js
"use strict";C3.RenderGrid=class extends C3.DefendedBase{constructor(a,b){super(),this._cellWidth=a,this._cellHeight=b,this._cells=C3.New(C3.PairMap)}Release(){this._cells.Release(),this._cells=null}GetCell(a,b,c){let d=this._cells.Get(a,b);return d?d:c?(d=C3.New(C3.RenderCell,this,a,b),this._cells.Set(a,b,d),d):null}XToCell(a){return Math.floor(a/this._cellWidth)}YToCell(a){return Math.floor(a/this._cellHeight)}Update(a,b,c){if(b)for(let d=b.getLeft(),e=b.getRight();d<=e;++d)for(let e=b.getTop(),f=b.getBottom();e<=f;++e){if(c&&c.containsPoint(d,e))continue;const b=this.GetCell(d,e,!1);b&&(b.Remove(a),b.IsEmpty()&&this._cells.Delete(d,e))}if(c)for(let d=c.getLeft(),e=c.getRight();d<=e;++d)for(let e=c.getTop(),f=c.getBottom();e<=f;++e)b&&b.containsPoint(d,e)||this.GetCell(d,e,!0).Insert(a)}QueryRange(a,b){let c=this.XToCell(a.getLeft());for(const d=this.YToCell(a.getTop()),e=this.XToCell(a.getRight()),f=this.YToCell(a.getBottom());c<=e;++c)for(let a=d;a<=f;++a){const d=this.GetCell(c,a,!1);d&&d.Dump(b)}}MarkRangeChanged(a){let b=a.getLeft();for(const c=a.getTop(),d=a.getRight(),e=a.getBottom();b<=d;++b)for(let a=c;a<=e;++a){const c=this.GetCell(b,a,!1);c&&c.SetChanged()}}};
// c3/layouts/layer.js
"use strict";{function a(c,a){return c.GetWorldInfo()._GetLastCachedZIndex()-a.GetWorldInfo()._GetLastCachedZIndex()}function b(c,a){return c.GetWorldInfo().GetZElevation()-a.GetWorldInfo().GetZElevation()}const c=new C3.Rect,d=new C3.Quad,e=[],f=new C3.Rect,g=new C3.Rect,h=vec3.fromValues(0,1,0);C3.Layer=class extends C3.DefendedBase{constructor(a,b,c){super(),this._layout=a,this._runtime=a.GetRuntime(),this._name=c[0],this._index=b,this._sid=c[2],this._isVisible=!!c[3],this._backgroundColor=C3.New(C3.Color),this._backgroundColor.setFromJSON(c[4].map((a)=>a/255)),this._isTransparent=!!c[5],this._parallaxX=c[6],this._parallaxY=c[7],this._color=C3.New(C3.Color,1,1,1,c[8]),this._premultipliedColor=C3.New(C3.Color),this._isForceOwnTexture=c[9],this._useRenderCells=c[10],this._scaleRate=c[11],this._blendMode=c[12],this._srcBlend=0,this._destBlend=0,this._curRenderTarget=null,this._scale=1,this._zElevation=c[16],this._angle=0,this._isAngleEnabled=!0,this._viewport=C3.New(C3.Rect),this._viewportZ0=C3.New(C3.Rect),this._startupInitialInstances=[],this._initialInstances=[],this._createdGlobalUids=[],this._instances=[],this._zIndicesUpToDate=!1,this._anyInstanceZElevated=!1,this._effectList=C3.New(C3.EffectList,this,c[15]),this._renderGrid=null,this._lastRenderList=[],this._isRenderListUpToDate=!1,this._lastRenderCells=C3.New(C3.Rect,0,0,-1,-1),this._curRenderCells=C3.New(C3.Rect,0,0,-1,-1),this._iLayer=new ILayer(this),this._UpdatePremultipliedColor(),this._useRenderCells&&(this._renderGrid=C3.New(C3.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight()));for(const d of c[14]){const a=this._runtime.GetObjectClassByIndex(d[1]);this._layout._AddInitialObjectClass(a),a.GetDefaultInstanceData()||(a.SetDefaultInstanceData(d),a._SetDefaultLayerIndex(this._index)),this._initialInstances.push(d)}C3.shallowAssignArray(this._startupInitialInstances,this._initialInstances)}static Create(a,b,c){return C3.New(C3.Layer,a,b,c)}Release(){this._layout=null,this._runtime=null}CreateInitialInstances(a){const b=this._layout.IsFirstVisit();let c=0;const d=this._initialInstances;for(let e=0,f=d.length;e<f;++e){const f=d[e],g=this._runtime.GetObjectClassByIndex(f[1]);let h=!0;if(!g.HasPersistBehavior()||b){const b=this._runtime.CreateInstanceFromData(f,this,!0);a.push(b),g.IsGlobal()&&(h=!1,this._createdGlobalUids.push(b.GetUID()))}h&&(d[c]=d[e],++c)}C3.truncateArray(d,c),this._runtime.FlushPendingInstances(),this.SetZIndicesChanged()}_AddInstance(a,b){const c=a.GetWorldInfo();if(c.GetLayer()!==this)throw new Error("instance added to wrong layer");this._instances.push(a),0!==c.GetZElevation()&&(this._anyInstanceZElevated=!0),b&&this._useRenderCells&&a.GetWorldInfo().SetBboxChanged(),this.SetZIndicesChanged()}_MaybeAddInstance(a){this._instances.includes(a)||(this._instances.push(a),0!==a.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(a,b){const c=a.GetWorldInfo();if(c.GetLayer()!==this)throw new Error("instance added to wrong layer");this._instances.unshift(a),0!==c.GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged(),b&&this._useRenderCells&&a.GetWorldInfo().SetBboxChanged()}_RemoveInstance(a,b){const c=this._instances.indexOf(a);0>c||(b&&this._useRenderCells&&a.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(c,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(b){if(b){const a=new Set;for(const b of this._instances){const c=b.GetWorldInfo()._GetLastCachedZIndex();0<=c&&a.add(c)}let b=-1;for(const c of this._instances){const d=c.GetWorldInfo();if(!(0<=d._GetLastCachedZIndex())){for(++b;a.has(b);)++b;d._SetZIndex(b)}}}this._instances.sort(a)}_Start(){this.SetBlendMode(this.GetBlendMode(),!0)}_End(){for(const a of this._instances)a.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(a);this._runtime.FlushPendingInstances(),C3.clearArray(this._instances),this._anyInstanceZElevated=!1,this.SetZIndicesChanged()}RecreateInitialObjects(a,b){const c=this._runtime.GetEventSheetManager(),d=this._runtime.GetAllObjectClasses(),e=a.IsFamily();for(const f of this._initialInstances){const g=f[0],h=g[0],i=g[1];if(!b.containsPoint(h,i))continue;const j=d[f[1]];if(j!==a)if(!e)continue;else if(!a.FamilyHasMember(j))continue;const k=this._runtime.CreateInstanceFromData(f,this,!1);if(c.BlockFlushingInstances(!0),k._TriggerOnCreated(),k.IsInContainer())for(const a of k.siblings())a._TriggerOnCreated();c.BlockFlushingInstances(!1)}}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(a){a=!!a;this._isVisible===a||(this._isVisible=a,this._runtime.UpdateRender())}GetViewport(){return this._viewport}GetViewportForZ(a,b){const c=this._viewportZ0;if(0===a)b.copy(c);else{const d=this.Get2DScaleFactorToZ(a),e=c.midX(),f=c.midY(),g=.5*c.width()/d,h=.5*c.height()/d;b.set(e-g,f-h,e+g,f+h)}}GetOpacity(){return this._color.getA()}SetOpacity(a){a=C3.clamp(a,0,1);this._color.getA()===a||(this._color.setA(a),this._UpdatePremultipliedColor(),this._runtime.UpdateRender())}_UpdatePremultipliedColor(){this._premultipliedColor.copy(this._color),this._premultipliedColor.premultiply()}GetPremultipliedColor(){return this._premultipliedColor}HasDefaultColor(){return this._color.equalsRgba(1,1,1,1)}GetScaleRate(){return this._scaleRate}SetScaleRate(a){this._scaleRate===a||(this._scaleRate=a,this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(a,b){if((this._parallaxX!==a||this._parallaxY!==b)&&(this._parallaxX=a,this._parallaxY=b,this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY))for(const a of this._instances)a.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(a){this.SetParallax(a,this.GetParallaxY())}SetParallaxY(a){this.SetParallax(this.GetParallaxX(),a)}SetZElevation(a){this._zElevation=+a}GetZElevation(){return this._zElevation}SetAngle(b){this._angle=C3.clampAngle(b)}GetAngle(){return this._isAngleEnabled?C3.clampAngle(this._layout.GetAngle()+this._angle):0}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(a){this._isTransparent=!!a}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(a){this._isForceOwnTexture=!!a}SetBlendMode(a,b){if(this._blendMode!==a||b){this._blendMode=a;const b=this._runtime.GetWebGLRenderer();b&&(this._srcBlend=b.GetSrcBlendByIndex(a),this._destBlend=b.GetDestBlendByIndex(a)),this._runtime.UpdateRender()}}GetBlendMode(){return this._blendMode}GetSrcBlend(){return this._srcBlend}GetDestBlend(){return this._destBlend}_IsCollisionCompatibleWith(a){return this._parallaxX===a._parallaxX&&this._parallaxY===a._parallaxY&&this._scale===a._scale&&this._scaleRate===a._scaleRate&&this._angle===a._angle}_RemoveAllInstancesInSet(a){if(0!==a.size){const b=C3.arrayRemoveAllInSet(this._instances,a);0<b&&(this._MaybeResetAnyInstanceZElevatedFlag(),this.SetZIndicesChanged())}}SetZIndicesChanged(){this._zIndicesUpToDate=!1,this._isRenderListUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){if(C3.stableSort(this._instances,b),this._useRenderCells)for(let a=0,b=this._instances.length;a<b;++a){const b=this._instances[a].GetWorldInfo();b._SetZIndex(a),this._renderGrid.MarkRangeChanged(b.GetRenderCellRange())}else for(let a=0,b=this._instances.length;a<b;++a)this._instances[a].GetWorldInfo()._SetZIndex(a);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(a,b,c){const d=a.GetWorldInfo(),e=b.GetWorldInfo();if(d.GetLayer()!==this||e.GetLayer()!==this)throw new Error("can't arrange Z order unless both objects on this layer");const f=d.GetZIndex();let g=e.GetZIndex();C3.arrayRemove(this._instances,f),f<g&&g--,c&&g++,g===this._instances.length?this._instances.push(a):this._instances.splice(g,0,a),this.SetZIndicesChanged()}_MergeSortedZArrays(c,a){const b=[];let d=0,e=0,f=c.length,g=a.length;for(;d<f&&e<g;){const f=c[d],g=a[e];f.GetWorldInfo()._GetLastCachedZIndex()<g.GetWorldInfo()._GetLastCachedZIndex()?(b.push(f),++d):(b.push(g),++e)}for(;d<f;++d)b.push(c[d]);for(;e<g;++e)b.push(a[e]);return b}_MergeAllSortedZArrays_pass(a){const b=[],c=a.length;for(let d=0;d<c-1;d+=2){const c=a[d],e=a[d+1];b.push(this._MergeSortedZArrays(c,e))}return 1==c%2&&b.push(a[c-1]),b}_MergeAllSortedZArrays(a){for(;1<a.length;)a=this._MergeAllSortedZArrays_pass(a);return a[0]}_GetRenderCellInstancesToDraw(){return this._UpdateZIndices(),C3.clearArray(e),this._renderGrid.QueryRange(this._viewport,e),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(a){if(0===a.length)return!0;if(2<=a.length)return!1;const b=a[0],c=b.GetShaderProgram();return!c.MustPreDraw()&&!c.UsesDest()&&!c.UsesCrossSampling()&&this.HasDefaultColor()}Get2DScaleFactorToZ(a){const b=this.GetCameraZ();return b/(b-a)}GetCameraZ(){return 100/this.GetNormalScale()}_SetTransform(b,c=0,d=0){const e=this._runtime.GetRenderScale(),f=(this._viewport.midX()+c)*e,g=(this._viewport.midY()+d)*e,i=this.GetCameraZ();b.SetCameraXYZ(f,g,i),b.SetLookXYZ(f,g,i-100);const j=this.GetAngle(),a=h;0===j?vec3.set(a,0,1,0):vec3.set(a,Math.sin(j),Math.cos(j),0),b.ResetModelView(a),b.Scale(e,e),b.UpdateModelView()}Draw(a,b,c){const d=this._runtime.GetCanvasManager(),e=this.UsesOwnTexture();let f=null,g=null;if(this._runtime.IsGPUProfiling()&&a.SupportsGPUProfiling()){const b=d.GetLayerTimingsBuffer(this);b&&(g=b.AddTimeElapsedQuery(),a.StartQuery(g))}if(e){const b={sampling:this._runtime.GetSampling()};"low"===d.GetCurrentFullscreenScalingQuality()&&(b.width=d.GetDrawWidth(),b.height=d.GetDrawHeight()),f=this._runtime.GetAdditionalRenderTarget(b),a.SetRenderTarget(f),this.IsTransparent()&&a.ClearRgba(0,0,0,0)}else a.SetRenderTarget(b);if(this.IsTransparent()||a.Clear(this._backgroundColor),this._curRenderTarget=f||b,this._SetTransform(a),a.SetBaseZ(this.GetZElevation()),this.GetNormalScale()>Number.EPSILON){this._UpdateZIndices();const b=this._useRenderCells&&0===this.GetZElevation()&&!this._anyInstanceZElevated;b?this._DrawInstances_RenderCells(a):this._DrawInstances(a,this._instances)}a.SetBaseZ(0),a.SetCurrentZ(0),a.SetCameraXYZ(0,0,100),a.SetLookXYZ(0,0,0),e&&this._DrawLayerOwnTextureToRenderTarget(a,f,b,c),g&&a.EndQuery(g),this._curRenderTarget=null}_DrawInstances(a,b){const c=this._viewport,d=this._curRenderTarget;let e=null;for(let f=0,g=b.length;f<g;++f){const g=b[f];if(g===e)continue;e=g;const h=g.GetWorldInfo();h.IsVisible()&&h.IsInViewport(c)&&(h.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(g,h,a,d):this._DrawInstance(g,h,a))}}_DrawInstances_RenderCells(a){const b=this._renderGrid,c=this._curRenderCells,d=this._lastRenderCells,e=this._viewport;let f;c.set(b.XToCell(e.getLeft()),b.YToCell(e.getTop()),b.XToCell(e.getRight()),b.YToCell(e.getBottom())),this._isRenderListUpToDate&&c.equals(d)?f=this._lastRenderList:(f=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,d.copy(c)),this._DrawInstances(a,f),f!==this._lastRenderList&&C3.shallowAssignArray(this._lastRenderList,f)}_DrawInstance(a,b,c){const d=b.GetWebGLStateGroup();c.GetCurrentStateGroup()!==d&&d.Apply(),a.Draw(c)}_DrawInstanceWithEffectsAndRestore(a,b,c,d){this._DrawInstanceWithEffects(a,b,c,d,null)&&this._SetTransform(c)}_DrawInstanceWithEffects(a,b,c,d,e){const f=b.GetInstanceEffectList().GetActiveEffectTypes();if(1===f.length){const d=f[0],e=d.GetShaderProgram();if(!e.NeedsPostDrawOrExtendsBox()&&b.HasDefaultColor()&&!a.MustPreDraw())return this._DrawInstanceWithEffects_FastPath(a,b,d,e,c),!1}const g=C3.RenderEffectChain(c,this._runtime,a,d,f,e);return c.SetBaseZ(this.GetZElevation()),g}_DrawInstanceWithEffects_FastPath(a,b,c,d,e){e.SetProgram(d),e.SetBlend(b.GetSrcBlend(),b.GetDestBlend()),d.IsAnimated()&&this._runtime.UpdateRender();let h=0,i=0;if(d.UsesAnySrcRectOrPixelSize()){const b=a.GetCurrentImageInfo();if(b){g.copy(b.GetTexRect());const a=b.GetTexture();a&&(h=1/a.GetWidth(),i=1/a.GetHeight())}else g.set(0,0,0,0)}const j=b.GetInstanceEffectList().GetEffectParametersForIndex(c.GetIndex());e.SetCurrentZ(b.GetZElevation()),e.SetProgramParameters(null,f,g,g,b.GetBoundingBox(),h,i,this.GetOwnScale(),this.GetAngle(),this._runtime.GetGameTime(),j),a.Draw(e)}_DrawLayerOwnTextureToRenderTarget(a,b,c,d){const e=this._effectList.GetActiveEffectTypes(),h=this._runtime;if(this._CanFastPathDrawLayer(e)){if(a.SetRenderTarget(c),1===e.length){const b=e[0],c=b.GetShaderProgram();a.SetProgram(c),g.set(0,0,1,1);const d=this._effectList.GetEffectParametersForIndex(b.GetIndex());a.SetProgramParameters(null,f,g,g,this._viewport,1/h.GetDrawWidth(),1/h.GetDrawHeight(),this.GetNormalScale(),this.GetAngle(),h.GetGameTime(),d),c.IsAnimated()&&h.UpdateRender()}else a.SetTextureFillMode();d&&0===this._blendMode&&this.HasDefaultColor()&&0===e.length?a.CopyRenderTarget(b):(a.SetBlend(this._srcBlend,this._destBlend),a.SetColor(this._premultipliedColor),a.DrawRenderTarget(b)),a.InvalidateRenderTarget(b),h.ReleaseAdditionalRenderTarget(b)}else C3.RenderEffectChain(a,h,this,c,e)}GetOwnScale(){return this._scale}SetOwnScale(a){this._scale===a||(this._scale=a,this._layout.BoundScrolling(),this._runtime.UpdateRender())}GetRenderScale(){return this.GetNormalScale()*this._runtime.GetRenderScale()}GetDisplayScale(){return this.GetNormalScale()*this._runtime.GetDisplayScale()}GetNormalScale(){return(this._scale*this._layout.GetScale()-1)*this._scaleRate+1}UpdateViewport(){var a=Math.round;this._isAngleEnabled=!1;let[b,e]=this.CanvasCssToLayer(0,0);this._isAngleEnabled=!0,this._runtime.IsPixelRoundingEnabled()&&(b=a(b),e=a(e));const f=1/this.GetNormalScale(),g=this._viewportZ0;g.set(b,e,b+this._runtime.GetViewportWidth()*f,e+this._runtime.GetViewportHeight()*f);const h=this.GetAngle();0!==h&&(c.copy(g),c.offset(-g.midX(),-g.midY()),d.setFromRotatedRect(c,h),d.getBoundingBox(c),c.offset(g.midX(),g.midY()),g.copy(c)),this.GetViewportForZ(this._zElevation,this._viewport)}CanvasCssToLayer(a,b,c=0){return this._CanvasToLayer(a,b,c,this.GetDisplayScale())}DrawSurfaceToLayer(a,b,c=0){return this._CanvasToLayer(a,b,c,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(b,c,d,e){const f=this._runtime.GetParallaxXOrigin(),g=this._runtime.GetParallaxYOrigin(),h=(this._layout.GetScrollX()-f)*this._parallaxX+f,i=(this._layout.GetScrollY()-g)*this._parallaxY+g,j=this.GetNormalScale(),k=this._runtime.GetViewportWidth()/j,l=this._runtime.GetViewportHeight()/j;let m=h-k/2+b/e,n=i-l/2+c/e;const o=this.GetAngle();if(0!==o){m-=h,n-=i;const a=Math.cos(o),b=Math.sin(o),c=m*a-n*b;n=n*a+m*b,m=c,m+=h,n+=i}if(0!==d){const a=this._viewportZ0.midX(),b=this._viewportZ0.midY(),c=this.Get2DScaleFactorToZ(d);m=(m-a)/c+a,n=(n-b)/c+b}return[m,n]}CanvasCssToLayer_DefaultTransform(a,b){const c=this._scale,d=this._scaleRate,e=this._parallaxX,f=this._parallaxY,g=this._angle;this._scale=1,this._scaleRate=1,this._parallaxX=1,this._parallaxY=1,this._angle=0;const h=this.CanvasCssToLayer(a,b);return this._scale=c,this._scaleRate=d,this._parallaxX=e,this._parallaxY=f,this._angle=g,h}LayerToCanvasCss(a,b,c=0){return this._LayerToCanvas(a,b,c,this.GetDisplayScale())}LayerToDrawSurface(a,b,c=0){return this._LayerToCanvas(a,b,c,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(b,c,d,e){const f=this._runtime,g=this._layout;if(0!==d){const a=this._viewportZ0.midX(),e=this._viewportZ0.midY(),f=this.Get2DScaleFactorToZ(d);b=(b-a)*f+a,c=(c-e)*f+e}const h=f.GetParallaxXOrigin(),i=f.GetParallaxYOrigin(),j=(g.GetScrollX()-h)*this._parallaxX+h,k=(g.GetScrollY()-i)*this._parallaxY+i,l=this.GetAngle();if(0!==l){b-=j,c-=k;const d=Math.cos(-l),e=Math.sin(-l),f=b*d-c*e;c=c*d+b*e,b=f,b+=j,c+=k}const m=this.GetNormalScale(),n=f.GetViewportWidth()/m,o=f.GetViewportHeight()/m,p=b-(j-n/2),q=c-(k-o/2);return[p*e,q*e]}_GetLayerToDrawSurfaceScale(a,b){return a*=this.GetRenderScale()*this.GetDevicePixelRatio(),0!==b&&(a*=this.Get2DScaleFactorToZ(b)),a}_SaveToJson(){const a={"s":this.GetOwnScale(),"a":this.GetOwnAngle(),"vl":this._viewport.getLeft(),"vt":this._viewport.getTop(),"vr":this._viewport.getRight(),"vb":this._viewport.getBottom(),"v":this.IsVisible(),"bc":this._backgroundColor.toJSON(),"t":this.IsTransparent(),"px":this.GetParallaxX(),"py":this.GetParallaxY(),"c":this._color.toJSON(),"sr":this.GetScaleRate(),"fx":this._effectList.SaveToJson(),"cg":this._createdGlobalUids};return a}_LoadFromJson(a){this._scale=a["s"],this._angle=a["a"],this._viewport.set(a["vl"],a["vt"],a["vr"],a["vb"]),this._isVisible=!!a["v"],this._backgroundColor.setFromJSON(a["bc"]),this._isTransparent=!!a["t"],this._parallaxX=a["px"],this._parallaxY=a["py"],this._color.setFromJSON(a["c"]),this._scaleRate=a["sr"],C3.shallowAssignArray(this._createdGlobalUids,a["cg"]),C3.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const b=new Set(this._createdGlobalUids);let c=0;for(let d=0,e=this._initialInstances.length;d<e;++d)b.has(this._initialInstances[d][2])||(this._initialInstances[c]=this._initialInstances[d],++c);C3.truncateArray(this._initialInstances,c),this._effectList.LoadFromJson(a["fx"]),this._SortInstancesByLastCachedZIndex(!1),this.SetZIndicesChanged()}GetILayer(){return this._iLayer}}}
// c3/layouts/layout.js
"use strict";{const a=C3.New(C3.Rect),b=C3.New(C3.Rect),c=C3.New(C3.Rect),d=C3.New(C3.Rect);C3.Layout=class extends C3.DefendedBase{constructor(a,b,c){super(),this._layoutManager=a,this._runtime=a.GetRuntime(),this._name=c[0],this._originalWidth=c[1],this._originalHeight=c[2],this._width=c[1],this._height=c[2],this._isUnboundedScrolling=!!c[3],this._eventSheetName=c[4],this._eventSheet=null,this._sid=c[5],this._index=b,this._scrollX=0,this._scrollY=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=C3.New(C3.EffectList,this,c[8]),this._curRenderTarget=null,this._persistData={},this._isFirstVisit=!0,this._iLayout=new ILayout(this),this._userScriptDispatcher=C3.New(C3.Event.Dispatcher);for(const d of c[6]){const a=C3.Layer.Create(this,this._layers.length,d);this._layers.push(a),this._layersByName.set(a.GetName().toLowerCase(),a),this._layersBySid.set(a.GetSID(),a)}for(const d of c[7]){const a=this._runtime.GetObjectClassByIndex(d[1]);if(!a)throw new Error("missing nonworld object class");a.GetDefaultInstanceData()||a.SetDefaultInstanceData(d),this._initialNonWorld.push(d),this._AddInitialObjectClass(a)}}Release(){for(const a of this._layers)a.Release();C3.clearArray(this._layers),this._textureLoadPendingPromises.clear(),this._eventSheet=null,this._layoutManager=null,this._runtime=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetMinLayerScale(){let a=this._layers[0].GetNormalScale();for(let b=1,c=this._layers.length;b<c;++b){const c=this._layers[b];0===c.GetParallaxX()&&0===c.GetParallaxY()||(a=Math.min(a,c.GetNormalScale()))}return a}SetScrollX(a){if(!this._isUnboundedScrolling){const b=this._runtime.GetViewportWidth()*(1/this.GetMinLayerScale())/2;a>this._width-b&&(a=this._width-b),a<b&&(a=b)}this._scrollX!==a&&(this._scrollX=a,this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(a){if(!this._isUnboundedScrolling){const b=this._runtime.GetViewportHeight()*(1/this.GetMinLayerScale())/2;a>this._height-b&&(a=this._height-b),a<b&&(a=b)}this._scrollY!==a&&(this._scrollY=a,this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}BoundScrolling(){this.SetScrollX(this.GetScrollX()),this.SetScrollY(this.GetScrollY())}GetScale(){return this._scale}SetScale(a){a=+a;this._scale===a||(this._scale=a,this.BoundScrolling())}SetAngle(b){this._angle=C3.clampAngle(b)}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(a){!isFinite(a)||1>a||(this._width=a)}GetHeight(){return this._height}SetHeight(a){!isFinite(a)||1>a||(this._height=a)}GetEventSheet(){return this._eventSheet}GetLayers(){return this._layers}GetLayerCount(){return this._layers.length}GetLayer(a){return"number"==typeof a?this.GetLayerByIndex(a):this.GetLayerByName(a.toString())}GetLayerByIndex(a){return a=C3.clamp(Math.floor(a),0,this._layers.length-1),this._layers[a]}GetLayerByName(a){return this._layersByName.get(a.toLowerCase())||null}GetLayerBySID(a){return this._layersBySid.get(a)||null}HasOpaqueBottomLayer(){for(const a of this._layers)if(a.ShouldDraw())return a._IsOpaque();return!1}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(a){if(a.IsInContainer())for(const b of a.GetContainer().GetObjectTypes())this._initialObjectClasses.add(b);else this._initialObjectClasses.add(a)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(a,b){if(a===this||!b)return Promise.resolve();a&&(C3.CopySet(this._textureLoadedTypes,a._textureLoadedTypes),a._textureLoadedTypes.clear());const c=[];for(const d of this._initialObjectClasses)this._textureLoadedTypes.has(d)||(c.push(d.LoadTextures(b)),this._textureLoadedTypes.add(d));return Promise.all(c)}async MaybeLoadTexturesFor(a){if(a.IsFamily())throw new Error("cannot load textures for family");const b=this._runtime.GetWebGLRenderer();if(!(!b||b.IsContextLost()||this._textureLoadedTypes.has(a))){this._textureLoadedTypes.add(a);const c=a.LoadTextures(b);this._AddPendingTextureLoadPromise(c),await c,a.OnDynamicTextureLoadComplete(),this._runtime.UpdateRender()}}_AddPendingTextureLoadPromise(a){this._textureLoadPendingPromises.add(a),a.then(()=>this._textureLoadPendingPromises.delete(a)).catch(()=>this._textureLoadPendingPromises.delete(a))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(a){if(a.IsFamily()||0<a.GetInstanceCount())throw new Error("cannot unload textures");const b=this._runtime.GetWebGLRenderer();b&&this._textureLoadedTypes.has(a)&&(this._textureLoadedTypes.delete(a),a.ReleaseTextures(b))}_Unload(a,b){if(a!==this&&b)for(const b of this._textureLoadedTypes)b.IsGlobal()||a._initialObjectClasses.has(b)||(b.ReleaseTextures(),this._textureLoadedTypes.delete(b))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(a){const b=this._runtime,c=this._layoutManager,d=b.GetEventSheetManager();if(this._eventSheetName&&(this._eventSheet=d.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes()),c._SetMainRunningLayout(this),this._width=this._originalWidth,this._height=this._originalHeight,this._scrollX=b.GetOriginalViewportWidth()/2,this._scrollY=b.GetOriginalViewportHeight()/2,this.BoundScrolling(),this._MoveGlobalObjectsToThisLayout(a),this._CreateInitialInstances(),this._isFirstVisit||this._CreatePersistedInstances(),this._CreateAndLinkContainerInstances(this._createdInstances),this._CreateInitialNonWorldInstances(),c.ClearPendingChangeLayout(),b.FlushPendingInstances(),b.IsLoadingState())b._TriggerOnCreateAfterLoad(this._createdInstances);else for(const a of this._createdInstances)a._TriggerOnCreated();C3.clearArray(this._createdInstances),await Promise.all([...this._initialObjectClasses].map((a)=>a.PreloadTexturesWithInstances(this._runtime.GetWebGLRenderer()))),a&&(b.Dispatcher().dispatchEvent(new C3.Event("beforefirstlayoutstart")),await b.DispatchUserScriptEventAsyncWait(new C3.Event("beforeprojectstart"))),await this.DispatchUserScriptEventAsyncWait(new C3.Event("beforelayoutstart")),b.IsLoadingState()||(await b.TriggerAsync(C3.Plugins.System.Cnds.OnLayoutStart,null,null)),await this.DispatchUserScriptEventAsyncWait(new C3.Event("afterlayoutstart")),a&&(b.Dispatcher().dispatchEvent(new C3.Event("afterfirstlayoutstart")),await b.DispatchUserScriptEventAsyncWait(new C3.Event("afterprojectstart"))),d._RunQueuedTriggers(c),await this.WaitForPendingTextureLoadsToComplete(),this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(a){for(const b of this._runtime.GetAllObjectClasses())if(!b.IsFamily()&&b.IsWorldType())for(const a of b.GetInstances()){const b=a.GetWorldInfo(),c=b.GetLayer(),d=C3.clamp(c.GetIndex(),0,this._layers.length-1),e=this._layers[d];b._SetLayer(e),e._MaybeAddInstance(a)}if(!a)for(const a of this._layers)a._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const a of this._layers)a.CreateInitialInstances(this._createdInstances),a.UpdateViewport(),a._Start()}_CreatePersistedInstances(){let a=!1;for(const[b,c]of Object.entries(this._persistData)){const d=this._runtime.GetObjectClassBySID(parseInt(b,10));if(d&&!d.IsFamily()&&d.HasPersistBehavior()){for(const b of c){let c=null;if(d.IsWorldType()&&(c=this.GetLayerBySID(b["w"]["l"]),!c))continue;const e=this._runtime.CreateInstanceFromData(d,c,!1,0,0,!0);e.LoadFromJson(b),a=!0,this._createdInstances.push(e)}C3.clearArray(c)}}for(const a of this._layers)a._SortInstancesByLastCachedZIndex(!0),a.SetZIndicesChanged();a&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(a){for(const b of a){if(!b.IsInContainer())continue;const c=b.GetWorldInfo(),d=b.GetIID();for(const e of b.GetObjectClass().GetContainer().objectTypes()){if(e===b.GetObjectClass())continue;const f=e.GetInstances();if(f.length>d)b._AddSibling(f[d]);else{let d;d=c?this._runtime.CreateInstanceFromData(e,c.GetLayer(),!0,c.GetX(),c.GetY(),!0):this._runtime.CreateInstanceFromData(e,null,!0,0,0,!0),this._runtime.FlushPendingInstances(),e._UpdateIIDs(),b._AddSibling(d),a.push(d)}}}}_CreateInitialNonWorldInstances(){for(const a of this._initialNonWorld){const b=this._runtime.GetObjectClassByIndex(a[1]);b.IsInContainer()||this._runtime.CreateInstanceFromData(a,null,!0)}}_CreateGlobalNonWorlds(){const a=[],b=this._initialNonWorld;let c=0;for(let d=0,e=b.length;d<e;++d){const e=b[d],f=this._runtime.GetObjectClassByIndex(e[1]);f.IsGlobal()?(!f.IsInContainer()||!f.GetContainer().HasAnyWorldType())&&a.push(this._runtime.CreateInstanceFromData(e,null,!0)):(b[c]=e,++c)}C3.truncateArray(b,c),this._runtime.FlushPendingInstances(),this._CreateAndLinkContainerInstances(a)}RecreateInitialObjects(b,c,d,e,f){a.set(c,d,e,f);for(const g of this._layers)g.RecreateInitialObjects(b,a)}async _StopRunning(){const a=this._layoutManager;this._runtime.IsLoadingState()||(await this._runtime.TriggerAsync(C3.Plugins.System.Cnds.OnLayoutEnd,null,null)),a.SetIsEndingLayout(!0),this._runtime.GetEventSheetManager().ClearAllScheduledWaits(),this._isFirstVisit||this._SavePersistData();for(const a of this._layers)a._End();for(const a of this._runtime.GetAllObjectClasses())if(!(a.IsGlobal()||a.IsWorldType()||a.GetPlugin().IsSingleGlobal()||a.IsFamily())){for(const b of a.GetInstances())this._runtime.DestroyInstance(b);this._runtime.FlushPendingInstances()}a.SetIsEndingLayout(!1),a.GetMainRunningLayout()===this&&a._SetMainRunningLayout(null)}_SaveInstanceToPersist(a){const b=a.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(b)||(this._persistData[b]=[]);const c=this._persistData[b];c.push(a.SaveToJson())}_SavePersistData(){for(const a of this._layers){a._UpdateZIndices();for(const b of a._GetInstances()){const a=b.GetObjectClass();!a.IsGlobal()&&a.HasPersistBehavior()&&this._SaveInstanceToPersist(b)}}}ResetPersistData(){this._persistData={},this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){return"low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()||this._runtime.UsesAnyBackgroundBlending()||"low-latency"===this._runtime.GetCompositingMode()||this._effectList.HasAnyActiveEffect()}_CanFastPathDrawLayout(a){if(0===a.length)return!0;if(2<=a.length)return!1;const b=a[0],c=b.GetShaderProgram();return!c.MustPreDraw()}Draw(a){const b=this._runtime.GetCanvasManager(),c=this.UsesOwnTexture();let d=null;if(c){"low-latency"!==this._runtime.GetCompositingMode()&&(a.SetRenderTarget(null),a.ClearRgba(0,0,0,0));const c={sampling:this._runtime.GetSampling(),readback:this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()};"low"===b.GetCurrentFullscreenScalingQuality()&&(c.width=b.GetDrawWidth(),c.height=b.GetDrawHeight()),d=this._runtime.GetAdditionalRenderTarget(c),a.SetRenderTarget(d)}else a.SetRenderTarget(null);this.HasOpaqueBottomLayer()||a.ClearRgba(0,0,0,0),this._curRenderTarget=d;let e=!0;for(const b of this._layers)b.UpdateViewport(),b.ShouldDraw()&&(b.Draw(a,d,e),e=!1);c&&this._DrawLayoutOwnTextureToRenderTarget(a,d),this._curRenderTarget=null}_DrawLayoutOwnTextureToRenderTarget(a,e){const f=this._effectList.GetActiveEffectTypes(),g=this._runtime;if(this._CanFastPathDrawLayout(f)){if(a.SetRenderTarget(null),1===f.length){const e=f[0],h=e.GetShaderProgram();a.SetProgram(h),c.set(0,0,1,1),d.set(0,0,g.GetViewportWidth(),g.GetViewportHeight());const i=this._effectList.GetEffectParametersForIndex(e.GetIndex());a.SetProgramParameters(null,b,c,c,d,1/g.GetDrawWidth(),1/g.GetDrawHeight(),this.GetScale(),this.GetAngle(),g.GetGameTime(),i),h.IsAnimated()&&g.UpdateRender()}else a.SetTextureFillMode();0===f.length?a.CopyRenderTarget(e):(a.SetAlphaBlend(),a.ResetColor(),a.DrawRenderTarget(e)),a.InvalidateRenderTarget(e),g.ReleaseAdditionalRenderTarget(e)}else C3.RenderEffectChain(a,g,this,null,f)}_SaveToJson(){const a={"sx":this.GetScrollX(),"sy":this.GetScrollY(),"s":this.GetScale(),"a":this.GetAngle(),"w":this.GetWidth(),"h":this.GetHeight(),"fv":this._isFirstVisit,"persist":this._persistData,"fx":this._effectList.SaveToJson(),"layers":{}};for(const b of this._layers)a["layers"][b.GetSID().toString()]=b._SaveToJson();return a}_LoadFromJson(a){this._scrollX=a["sx"],this._scrollY=a["sy"],this._scale=a["s"],this._angle=a["a"],this._width=a["w"],this._height=a["h"],this._isFirstVisit=!!a["fv"],this._persistData=a["persist"],this._effectList.LoadFromJson(a["fx"]);for(const[b,c]of Object.entries(a["layers"])){const a=parseInt(b,10),d=this.GetLayerBySID(a);d&&d._LoadFromJson(c)}}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(a){const b=this._runtime,c=b.IsDebug()&&!b.GetEventSheetManager().IsInEventEngine();c&&C3Debugger.StartMeasuringScriptTime(),this._userScriptDispatcher.dispatchEvent(a),c&&C3Debugger.AddScriptTime()}DispatchUserScriptEventAsyncWait(a){return this._userScriptDispatcher.dispatchEventAndWaitAsync(a)}}}
// c3/layouts/layoutManager.js
"use strict";C3.LayoutManager=class extends C3.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._runtime=null,this._mainRunningLayout=null,this._firstLayout=null,this._pendingChangeLayout=null,C3.clearArray(this._allLayouts),this._layoutsByName.clear(),this._layoutsBySid.clear(),C3.clearArray(this._runningSubLayouts)}Create(a){const b=C3.New(C3.Layout,this,this._allLayouts.length,a);this._allLayouts.push(b),this._layoutsByName.set(b.GetName().toLowerCase(),b),this._layoutsBySid.set(b.GetSID(),b)}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 new Error("no first layout")}GetLayoutByName(a){return this._layoutsByName.get(a.toLowerCase())||null}GetLayoutBySID(a){return this._layoutsBySid.get(a)||null}GetLayoutByIndex(a){return a=C3.clamp(Math.floor(a),0,this._allLayouts.length-1),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 new Error("layout already running");this._runningSubLayouts.push(a)}_RemoveRunningSubLayout(a){const b=this._runningSubLayouts.indexOf(a);if(-1===b)throw new Error("layout not running");this._runningSubLayouts.splice(b,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 new 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}};
// c3/layouts/renderEffectChain.js
"use strict";{function a(){return k===j.length&&j.push(new i),j[k++]}function b(a){a.ReleaseEffectRenderTargets(),a.Clear(),k--}async function c(a,b,c){const d=await C3.Gfx.WebGLRenderTarget.DebugReadPixelsToBlob(b,c),e=URL.createObjectURL(d);console.log("[FX] "+a+" "+(c?"":" [to display]")+": ",e)}function d(a,b){var c=Math.max,d=Math.min;for(let c=0,d=b.length;c<d;++c){const d=b[c].GetShaderProgram();a.boxExtendHorizontal+=d.GetBoxExtendHorizontal(),a.boxExtendVertical+=d.GetBoxExtendVertical()}const e=a.wi,f=e.GetLayer(),g=f.GetAngle(),h=e.GetBoundingBox(),i=e.GetTotalZElevation();let[j,k]=f.LayerToDrawSurface(h.getLeft(),h.getTop(),i),[l,m]=f.LayerToDrawSurface(h.getRight(),h.getBottom(),i);if(0!==g){const[a,b]=f.LayerToDrawSurface(h.getRight(),h.getTop(),i),[e,g]=f.LayerToDrawSurface(h.getLeft(),h.getBottom(),i);let n=d(j,l,a,e);l=c(j,l,a,e),j=n,n=d(k,m,b,g),m=c(k,m,b,g),k=n}const n=a.screenRect,o=a.rcTexOrigin,p=a.rcTexDest,q=a.clearRect,r=a.rcTexBounce;n.set(j,k,l,m),n.shuntY(a.drawHeight),o.copy(n),o.divide(a.surfaceWidth,a.surfaceHeight),o.swapTopBottom(),n.inflate(a.boxExtendHorizontal,a.boxExtendVertical),p.copy(n),p.divide(a.surfaceWidth,a.surfaceHeight),p.swapTopBottom(),q.copy(n),q.roundOuter(),q.inflate(a.boxExtendHorizontal+1,a.boxExtendVertical+1),n.clamp(0,0,a.drawWidth,a.drawHeight),q.clamp(0,0,a.drawWidth,a.drawHeight),r.copy(n),r.divide(a.surfaceWidth,a.surfaceHeight),r.swapTopBottom()}function e(a){const b=a.renderer;b.SetTextureFillMode();const d=a.GetEffectRenderTarget(a.fxIndex);b.SetRenderTarget(d);const e=a.opts;if(e&&e.preTransform&&e.preTransform(),!1,b.ClearRect2(a.clearRect),a.inst)b.SetColor(a.wi.GetPremultipliedColor()),b.SetCurrentZ(a.wi.GetTotalZElevation()),a.inst.Draw(b),b.SetCurrentZ(0);else{const c=(a.layer||a.layout).GetRenderTarget();a.layer?b.SetColor(a.layer.GetPremultipliedColor()):b.ResetColor(),b.DrawRenderTarget(c),b.InvalidateRenderTarget(c),a.runtime.GetCanvasManager().ReleaseAdditionalRenderTarget(c)}a.rcTexDest.clampFlipped(0,1,1,0),a.fxIndex=1,a.otherFxIndex=0,m&&c("Pre-draw",b,d)}function f(a,b){const d=a.renderer,e=a.runtime,f=a.GetEffectRenderTarget(a.fxIndex);d.SetRenderTarget(f);const g=a.opts;if(g&&g.preTransform&&g.preTransform(),!1,d.ClearRect2(a.clearRect),a.inst){let g=100,h=100;const i=a.inst.GetCurrentImageInfo();if(i){a.srcRect.copy(i.GetTexRect());const b=i.GetTexture();b&&(g=b.GetWidth(),h=b.GetHeight())}else a.srcRect.set(0,0,0,0);const j=a.wi.GetInstanceEffectList().GetEffectParametersForIndex(b.GetIndex());d.SetProgramParameters(a.renderTarget,a.rcTexDest,a.srcRect,a.srcRect,a.layoutRect,1/g,1/h,a.layerScale,a.layerAngle,e.GetGameTime(),j),d.SetCurrentZ(a.wi.GetTotalZElevation()),a.inst.Draw(d),d.SetCurrentZ(0),a.rcTexDest.clampFlipped(0,1,1,0),a.screenRect.shuntY(a.drawHeight),m&&c("First bounce",d,f)}else{const g=(a.layer||a.layout).GetEffectList().GetEffectParametersForIndex(b.GetIndex());d.SetProgramParameters(a.renderTarget,a.rcTexDest,a.rcTexBounce,a.rcTexOrigin,a.layoutRect,1/a.drawWidth,1/a.drawHeight,a.layerScale,a.layerAngle,e.GetGameTime(),g);const h=(a.layer||a.layout).GetRenderTarget();m&&c("Layer target",d,h),d.DrawRenderTarget(h),d.InvalidateRenderTarget(h),e.GetCanvasManager().ReleaseAdditionalRenderTarget(h),m&&c("First bounce",d,f)}}function g(a,b,d,e){const f=a.renderer,g=a.runtime;let h,i;0===e&&a.preDraw&&a.inst&&a.screenRect.shuntY(a.drawHeight),d?(a.inst?f.SetBlend(a.wi.GetSrcBlend(),a.wi.GetDestBlend()):a.layer&&f.SetBlend(a.layer.GetSrcBlend(),a.layer.GetDestBlend()),h=a.renderTarget,f.SetRenderTarget(h)):(h=a.GetEffectRenderTarget(a.fxIndex),f.SetRenderTarget(h),!1,f.ClearRect2(a.clearRect)),i=a.inst?a.wi.GetInstanceEffectList().GetEffectParametersForIndex(b.GetIndex()):(a.layer||a.layout).GetEffectList().GetEffectParametersForIndex(b.GetIndex()),f.SetProgramParameters(a.renderTarget,a.rcTexDest,a.rcTexBounce,a.rcTexOrigin,a.layoutRect,1/a.surfaceWidth,1/a.surfaceHeight,a.layerScale,a.layerAngle,g.GetGameTime(),i);const j=a.GetEffectRenderTarget(a.otherFxIndex);f.SetTexture(j.GetTexture()),g.GetCanvasManager().SetDeviceTransform(f),a.didChangeTransform=!0,l.setFromRect(a.screenRect),f.Quad3(l,a.rcTexBounce),a.inst||f.InvalidateRenderTarget(j),m&&c("Bounce "+e,f,h)}function h(a){const b=a.renderer;if(a.layout){b.SetTextureFillMode(),b.SetRenderTarget(a.renderTarget);const c=a.GetEffectRenderTarget(a.otherFxIndex);return b.CopyRenderTarget(c),void b.InvalidateRenderTarget(c)}const d=a.runtime.GetCanvasManager();"low"===d.GetCurrentFullscreenScalingQuality()?(b.SetTextureFillMode(),d.SetDeviceTransform(b,d.GetDrawWidth(),d.GetDrawHeight()),a.didChangeTransform=!0):b.SetDeviceTransformTextureFillMode(),a.inst?b.SetBlend(a.wi.GetSrcBlend(),a.wi.GetDestBlend()):a.layer&&b.SetBlend(a.layer.GetSrcBlend(),a.layer.GetDestBlend()),b.SetRenderTarget(a.renderTarget);const e=a.GetEffectRenderTarget(a.otherFxIndex);b.SetTexture(e.GetTexture()),l.setFromRect(a.screenRect),b.Quad3(l,a.rcTexBounce),a.inst||b.InvalidateRenderTarget(e),m&&c("Post-draw",b,a.renderTarget)}class i{constructor(){this.renderer=null,this.runtime=null,this.drawWidth=0,this.drawHeight=0,this.surfaceWidth=0,this.surfaceHeight=0,this.layoutRect=new C3.Rect,this.rcTexBounce=new C3.Rect,this.rcTexDest=new C3.Rect,this.rcTexOrigin=new C3.Rect,this.screenRect=new C3.Rect,this.clearRect=new C3.Rect,this.srcRect=new C3.Rect,this.fxTex=[null,null],this.fxIndex=0,this.otherFxIndex=1,this.boxExtendHorizontal=0,this.boxExtendVertical=0,this.layerScale=0,this.layerAngle=0,this.layout=null,this.layer=null,this.inst=null,this.wi=null,this.renderTarget=null,this.preDraw=!1,this.postDraw=!1,this.didChangeTransform=!1,this.opts=null}Clear(){this.renderer=null,this.runtime=null,this.layout=null,this.layer=null,this.inst=null,this.wi=null,this.renderTarget=null,this.opts=null}ShouldPreDraw(a){const b=a.GetShaderProgram();if(b.MustPreDraw())return!0;return this.inst?b.UsesDest()&&0!==this.wi.GetAngle()||0!==this.boxExtendHorizontal||0!==this.boxExtendVertical||!this.wi.HasDefaultColor()||this.inst.MustPreDraw():this.layer?!this.layer.HasDefaultColor():void 0}ShouldPostDraw(a){const b=a.GetShaderProgram();return b.UsesDest()||b.UsesCrossSampling()||this.layout&&"low"===this.runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality()}GetEffectRenderTarget(a){if(0!==a&&1!==a)throw new Error("invalid effect target");const b=this.fxTex;if(!b[a]){const c=this.runtime,d=c.GetCanvasManager(),e={sampling:c.GetSampling()};"low"===d.GetCurrentFullscreenScalingQuality()&&(e.width=d.GetDrawWidth(),e.height=d.GetDrawHeight()),b[a]=d.GetAdditionalRenderTarget(e)}return b[a]}ReleaseEffectRenderTargets(){const a=this.fxTex,b=this.runtime.GetCanvasManager();a[0]&&(b.ReleaseAdditionalRenderTarget(a[0]),a[0]=null),a[1]&&(b.ReleaseAdditionalRenderTarget(a[1]),a[1]=null)}}const j=[];let k=0;const l=new C3.Quad;let m=!1;C3.RenderEffectChain=function(c,j,i,k,l,n){const o=a();if(o.renderer=c,o.runtime=j,i instanceof C3.Instance)o.inst=i,o.wi=o.inst.GetWorldInfo();else if(i instanceof C3.Layer)o.layer=i;else if(i instanceof C3.Layout)o.layout=i;else throw new Error("invalid effects object");const p=j.GetCanvasManager();if(o.renderTarget=k,o.drawWidth=p.GetDrawWidth(),o.drawHeight=p.GetDrawHeight(),o.surfaceWidth=o.drawWidth,o.surfaceHeight=o.drawHeight,o.fxIndex=0,o.otherFxIndex=1,o.boxExtendHorizontal=0,o.boxExtendVertical=0,o.screenRect.set(0,0,o.drawWidth,o.drawHeight),o.clearRect.set(0,0,o.drawWidth,o.drawHeight),o.didChangeTransform=!1,o.opts=n,o.inst){const a=o.wi;o.layerScale=a.GetLayer().GetRenderScale(),o.layerAngle=a.GetLayer().GetAngle(),o.layoutRect.copy(a.GetBoundingBox())}else if(o.layer){const a=o.layer;o.layerScale=a.GetRenderScale(),o.layerAngle=a.GetAngle(),o.layoutRect.copy(a.GetViewport())}else{const a=o.layout;o.layerScale=a.GetScale(),o.layerAngle=a.GetAngle(),o.layoutRect.set(0,0,o.drawWidth,o.drawHeight)}o.inst?d(o,l):(o.rcTexBounce.set(0,0,o.drawWidth/o.surfaceWidth,o.drawHeight/o.surfaceHeight),o.rcTexDest.copy(o.rcTexBounce),o.rcTexOrigin.copy(o.rcTexBounce),o.rcTexBounce.swapTopBottom(),o.rcTexDest.swapTopBottom(),o.rcTexOrigin.swapTopBottom()),c.SetAlphaBlend(),c.ResetColor(),c.SetBaseZ(0),c.SetCurrentZ(0),o.preDraw=o.ShouldPreDraw(l[0]),o.preDraw&&e(o),c.ResetColor();const q=l.length-1;o.postDraw=o.ShouldPostDraw(l[q]);for(let a=0,b=l.length;a<b;++a){const b=l[a],d=b.GetShaderProgram();if(c.SetProgram(d),d.IsAnimated()&&j.UpdateRender(),0===a&&!o.preDraw)f(o,b);else{c.SetCopyBlend();const d=a===q&&!o.postDraw;g(o,b,d,a)}0===o.fxIndex?(o.fxIndex=1,o.otherFxIndex=0):(o.fxIndex=0,o.otherFxIndex=1)}o.postDraw&&h(o,l);const r=o.didChangeTransform;return b(o),m=!1,r}}
// c3/timelines/timelineManager.js
"use strict";{const a=/<(.+?)>/g;C3.TimelineManager=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a,this._timelineDataManager=C3.New(C3.TimelineDataManager),this._pluginInstance=null,this._timelines=[],this._timelinesByName=new Map,this._objectClassToTimelineMap=new Map,this._timelinesCreatedByTemplate=new Map,this._scheduledTimelines=[],this._playingTimelines=[],this._hasRuntimeListeners=!1,this._changingLayout=!1,this._isTickingTimelines=!1,this._tickFunc=()=>this._OnTick(),this._tick2Func=()=>this._OnTick2(),this._beforeLayoutChange=()=>this._OnBeforeChangeLayout(),this._layoutChange=()=>this._OnAfterChangeLayout(),this._instanceDestroy=(a)=>this._OnInstanceDestroy(a.instance)}Release(){this.RemoveRuntimeListeners(),this._tickFunc=null,this._tick2Func=null,this._beforeLayoutChange=null,this._layoutChange=null,this._instanceDestroy=null;for(const a of this._timelines)a.Stop(),a.Release();C3.clearArray(this._timelines),this._timelines=null,this._timelineDataManager.Release(),this._timelineDataManager=null,C3.clearArray(this._scheduledTimelines),this._scheduledTimelines=null,C3.clearArray(this._playingTimelines),this._playingTimelines=null,this._timelinesByName.clear(),this._timelinesByName=null,this._objectClassToTimelineMap.clear(),this._objectClassToTimelineMap=null,this._timelinesCreatedByTemplate.clear(),this._timelinesCreatedByTemplate=null,this._runtime=null}AddRuntimeListeners(){const a=this._runtime.Dispatcher();a.addEventListener("pretick",this._tickFunc),a.addEventListener("tick2",this._tick2Func),a.addEventListener("beforelayoutchange",this._beforeLayoutChange),a.addEventListener("layoutchange",this._layoutChange),a.addEventListener("instancedestroy",this._instanceDestroy)}RemoveRuntimeListeners(){const a=this._runtime.Dispatcher();a.removeEventListener("pretick",this._tickFunc),a.removeEventListener("tick2",this._tick2Func),a.removeEventListener("beforelayoutchange",this._beforeLayoutChange),a.removeEventListener("layoutchange",this._layoutChange),a.removeEventListener("instancedestroy",this._instanceDestroy)}Create(a){this._timelineDataManager.Add(a);const b=C3.TimelineState.CreateInitial(a,this);this.Add(b),this.SetTimelineObjectClassesToMap(b),this._timelinesCreatedByTemplate.set(b.GetName(),0)}CreateFromTemplate(a){const b=this.GetTimelineDataManager(),c=a.GetTemplateName(),d=b.Get(c),e=C3.TimelineState.CreateFromTemplate(`${c}:${this._timelinesCreatedByTemplate.get(c)}`,d,this);return this._IncreaseTemplateTimelinesCount(c),this.Add(e),e}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const b=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(b)}}_ClearCreatedTemplateTimelinesCount(){for(const a of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(a,0)}Add(a){this._timelines.push(a),this._timelinesByName.set(a.GetName().toLowerCase(),a)}Remove(a){a.IsTemplate()||(this._RemoveFromArray(this._timelines,a),this._RemoveFromArray(this._scheduledTimelines,a),this._RemoveFromArray(this._playingTimelines,a),this._timelinesByName.delete(a.GetName().toLowerCase()),this.RemoveTimelineFromObjectClassMap(a),a.Release())}_RemoveFromArray(a,b){const c=a.indexOf(b);-1!==c&&a.splice(c,1)}Trigger(a){this._runtime.Trigger(a,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(a){this._pluginInstance=a}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const a of this._timelines)yield a}SetTimelineObjectClassToMap(a,b){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set),this._objectClassToTimelineMap.get(a).add(b)}SetTimelineObjectClassesToMap(a){for(const b of a.GetObjectClasses())this.SetTimelineObjectClassToMap(b,a)}RemoveTimelineFromObjectClassMap(a){for(const[b,c]of this._objectClassToTimelineMap.entries())c.has(a)&&(c.delete(a),0===c.size&&this._objectClassToTimelineMap.delete(b))}GetTimelinesForObjectClass(a){return this._objectClassToTimelineMap.has(a)?this._objectClassToTimelineMap.get(a):void 0}GetTimelineOfTemplateForInstances(a,b){if(b)for(const c of this._timelines){const d=b.every((a)=>c.HasTrackInstance(a.instance,a.trackId));if(d&&c.GetName().includes(a.GetName()))return c}}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const b of this._scheduledTimelines)if(b.GetName()===a)return b;for(const b of this._playingTimelines)if(b.GetName()===a)return b;return null}*GetTimelinesByName(b){if(a.test(b)){a.lastIndex=0;let c;const d=new Set;do if(c=a.exec(b),c){const a=c[1].split(",");for(const b of a)d.add(b)}while(c);for(const a of d.values()){const b=this.GetTimelineByName(a);b&&(yield b)}d.clear()}else{const a=this.GetTimelineByName(b);a&&(yield a)}}*GetTimelinesByTags(a){for(const b of this._timelines)b.HasTags(a)&&(yield b)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a),this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){this._RemoveFromArray(this._playingTimelines,a),this._MaybeDisableRuntimeListeners()}ScheduleTimeline(a){a.SetPlaying(!1),a.SetScheduled(!0),a.SetMarkedForRemoval(!1),this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a),this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(a){a.SetPlaying(!1),a.SetScheduled(!1),a.ResolvePlayPromise(),this._RemoveFromArray(this._scheduledTimelines,a),this._MaybeDisableRuntimeListeners()}CompleteTimeline(a){a.SetPlaying(!1),a.SetScheduled(!1),a.SetMarkedForRemoval(!0)}CompleteTimelineAndResolve(a){this.CompleteTimeline(a),a.ResolvePlayPromise()}_OnTick(){if(!this._hasRuntimeListeners)return;if(this._changingLayout)return;let a=!1;for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){const a=this._scheduledTimelines.pop();a.SetInitialState(),this._playingTimelines.push(a)}const b=this._runtime.GetDt(),c=this._runtime.GetTimeScale();for(const d of this._playingTimelines){if(d.IsMarkedForRemoval())continue;const e=d.Tick(b,c);!a&&e&&(a=!0)}this._isTickingTimelines=!1,a&&this.GetRuntime().UpdateRender()}_OnTick2(){if(this._hasRuntimeListeners){for(const a of this._playingTimelines)a.IsMarkedForRemoval()&&(this._MaybeExecuteTimelineFinishTriggers(a),this._RemoveFromArray(this._playingTimelines,a));this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(a){a.IsReleased()||!a.HasValidTracks()||a.IsComplete()&&a.InitialStateSet()&&a.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._playingTimelines.length||this._scheduledTimelines.length||this._isTickingTimelines||(this._hasRuntimeListeners=!1)}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop());for(;this._playingTimelines.length;){const a=this._playingTimelines.pop();a.IsReleased()||(this.CompleteTimeline(a),a.Reset(!1))}this._MaybeDisableRuntimeListeners();for(const a of this._timelines)a.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(a){const b=a.GetObjectClass(),c=this.GetTimelinesForObjectClass(b);if(c)for(const a of c)a.IsTemplate()||a.HasValidTracks()||(this._MaybeExecuteTimelineFinishTriggers(a),this.Remove(a))}_SaveToJson(){return{"timelinesJson":this._SaveTimelinesToJson(),"scheduledTimelinesJson":this._SaveScheduledTimelinesToJson(),"playingTimelinesJson":this._SavePlayingTimelinesToJson(),"hasRuntimeListeners":this._hasRuntimeListeners,"changingLayout":this._changingLayout,"isTickingTimelines":this._isTickingTimelines}}_LoadFromJson(a){a&&(this._ClearCreatedTemplateTimelinesCount(),this._LoadTimelinesFromJson(a["timelinesJson"]),this._LoadScheduledTimelinesFromJson(a["scheduledTimelinesJson"]),this._LoadPlayingTimelinesFromJson(a["playingTimelinesJson"]),this._hasRuntimeListeners=!a["hasRuntimeListeners"],this._changingLayout=!!a["changingLayout"],this._isTickingTimelines=!!a["isTickingTimelines"],this._SetCreatedTemplateTimelinesCount(),this._MaybeEnableRuntimeListeners(),this._MaybeDisableRuntimeListeners())}_SaveTimelinesToJson(){return this._timelines.map((a)=>a._SaveToJson())}_LoadTimelinesFromJson(a){for(const b of a){let a=this.GetTimelineByName(b["name"]);if(a)a._LoadFromJson(b);else{const c=this._GetTemplateNameFromJson(b);if(!c)continue;const d=this.GetTimelineByName(c);a=this.CreateFromTemplate(d),a._LoadFromJson(b)}a.HasTracks()||this.Remove(a)}}_GetTemplateNameFromJson(a){const b=a["name"],c=b.split(":");return c&&2===c.length?c[0]:null}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(a){this._LoadTimelines(a,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(a){this._LoadTimelines(a,this._playingTimelines)}_IsTimelineInJson(a,b){for(const c of b)if(c===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map((a)=>a.GetName())}_LoadTimelines(a,b){const c=(a)=>(b)=>b.GetName()===a;for(const c of b)this._IsTimelineInJson(c,a)||this._RemoveFromArray(b,c);for(const d of a){const a=this.GetTimelineByName(d);if(a){const e=b.find(c(d));e||b.push(a)}}}}}
// c3/timelines/state/timelineState.js
"use strict";{const a=0;C3.TimelineState=class extends C3.DefendedBase{constructor(b,c,d){super(),this._runtime=d.GetRuntime(),this._timelineManager=d,this._timelineDataItem=c,this._name=b,this._tracks=[];for(const a of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(C3.TrackState.Create(this,a));this._playPromise=null,this._playResolve=null,this._playheadTime=C3.New(C3.KahanSum),this._playheadTime.Set(0),this._playbackRate=1,this._pingPongState=a,this._currentRepeatCount=1,this._isPlaying=!1,this._isScheduled=!1,this._initialStateSet=!1,this._complete=!0,this._released=!1,this._markedForRemoval=!1,this._completedTick=-1,this._implicitPause=!1,this._isTemplate=!1,this._finishedTriggers=!1,this._tags=[""],this._stringTags="",this._tagsChanged=!1}static CreateInitial(a,b){const c=b.GetTimelineDataManager(),d=c.GetNameId(),e=c.Get(a[d]),f=C3.New(C3.TimelineState,a[d],e,b);return f.SetIsTemplate(!0),f}static CreateFromTemplate(a,b,c){return C3.New(C3.TimelineState,a,b,c)}static get WORLD_INSTANCE_BOX_CHANGE(){return 1}static get LAYOUT_RENDER_CHANGE(){return C3.nextHighestPowerOfTwo(1)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this),this._timelineManager.CompleteTimelineAndResolve(this);for(const a of this._tracks)a.Release();C3.clearArray(this._tracks),this._tracks=null,this._playheadTime.Release(),this._playheadTime=null,this._runtime=null,this._timelineManager=null,this._timelineDataItem=null,this._released=!0,this._playPromise=null,this._playResolve=null}}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}HasTracks(){return!!this._tracks.length}GetTrackById(a){for(const b of this._tracks)if(C3.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()}GetPingPong(){return this._timelineDataItem.GetPingPong()}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(a){return this._playbackRate=a}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return!this.IsPlaying()||0<this._playbackRate}GetPlayPromise(){return this._playPromise?this._playPromise:(this._playPromise=new Promise((a)=>{this._playResolve=a}),this._playPromise)}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playPromise=null,this._playResolve=null)}SetTags(a){this._tags=C3.TimelineState._GetTagArray(a),this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){return this._tagsChanged&&(this._stringTags=this._tags.join(" ")),this._tagsChanged=!1,this._stringTags}HasTags(a){if(!this._tags)return!1;if(!this._tags.length)return!1;const b=C3.TimelineState._GetTagArray(a);return!!b&&!!b.length&&b.every(C3.TimelineState._HasTag,this)}OnStarted(){C3.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStarted),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStartedByName),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineStartedByTags),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyTimelineStarted),C3.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,C3.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnAnyTimelineFinished),C3.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(a){this._isPlaying=a}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(){return!!this.IsCompletedTick()||this._isPlaying}SetScheduled(a){this._isScheduled=a}IsScheduled(){return this._isScheduled}SetComplete(a){this._complete=a;const b=this.GetTime();(0>=b||b>=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){this._SetTime(a),this.SetComplete(!1),this.IsComplete()||this.SetImplicitPause(!0),(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());let b=!1;for(const c of this._tracks){c.SetResumeState();const a=c.Interpolate(this._playheadTime.Get(),!1,!0);!b&&a&&(b=!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(){C3.Plugins.Timeline&&this.constructor===C3.TimelineState&&(C3.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(C3.Plugins.Timeline.Cnds.OnTimeSetByTags),C3.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}Resume(){if(!this.IsReleased()){if(this.IsForwardPlayBack()){if(this._playheadTime.Get()>=this.GetTotalTime())return;}else if(0>=this._playheadTime.Get())return;this.Play(!0)}}Play(a=!1){return!this.IsReleased()&&!this.IsScheduled()&&(this.IsPlaying()&&this.IsCompletedTick()?this._SchedulePlayingTimeline():!this.IsPlaying()&&!!(this.IsComplete()||a||this.IsImplicitPause())&&this._ScheduleStoppedTimeline())}_SchedulePlayingTimeline(){return this.SetImplicitPause(!1),this._timelineManager.RemovePlayingTimeline(this),this._timelineManager.ScheduleTimeline(this),this.GetPlayPromise(),!0}_ScheduleStoppedTimeline(){return this.SetImplicitPause(!1),this._timelineManager.ScheduleTimeline(this),this.GetPlayPromise(),!0}Stop(a=!1){this.IsReleased()||(this.SetComplete(a),this._timelineManager.CompleteTimeline(this),this.IsComplete()&&this.ResolvePlayPromise())}Reset(a=!0){if(this.IsReleased())return;if(!this.IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(this.IsComplete())return;this.Stop(!0),this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());let b=!1;for(const c of this._tracks){const a=c.Interpolate(this._playheadTime.Get());!b&&a&&(b=!0)}a&&this._OnSetTime(),b&&a&&this.GetRuntime().UpdateRender()}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(b){if(!this.IsMarkedForRemoval())if(b){this._initialStateSet=!0;for(const a of this._tracks)a.SetInitialState()}else if(this.SetPlaying(!0),this.SetScheduled(!1),this.OnStarted(),this.IsComplete()){this._completedTick=-1,this._pingPongState=a,this._currentRepeatCount=1,this._complete=!1,this._finishedTriggers=!1,this._initialStateSet=!0,this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());for(const a of this._tracks)a.SetInitialState()}else for(const a of this._tracks)a.SetResumeState()}Tick(a,b){this._playheadTime.Add(a*b*this._playbackRate);let c;if(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(),c){for(const a of this._tracks)a.SetEndState();return this.Stop(!0),this.OnCompleted(),!0}else{let a=!1;for(const b of this._tracks){const c=b.Interpolate(this._playheadTime.Get(),!0);!a&&c&&(a=!0)}return a}}_SimpleCompleteCheck(){if(this.IsForwardPlayBack()){if(this._playheadTime.Get()>=this.GetTotalTime())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(0);else return this._SetTime(this.GetTotalTime()),!0;}else if(0>=this._playheadTime.Get())if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._SetTime(this.GetTotalTime());else return this._SetTime(0),!0;return!1}_LoopCompleteCheck(){return this.IsForwardPlayBack()?this._playheadTime.Get()>=this.GetTotalTime()&&this._SetTime(0):0>=this._playheadTime.Get()&&this._SetTime(this.GetTotalTime()),!1}_PingPongCompleteCheck(){if(this.IsForwardPlayBack()){if(this._playheadTime.Get()>=this.GetTotalTime())if(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1!==this._pingPongState)this._pingPongState===a&&(this._pingPongState=1);else if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=a;else return!0;}else if(0>=this._playheadTime.Get())if(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),1!==this._pingPongState)this._pingPongState===a&&(this._pingPongState=1);else if(this._currentRepeatCount<this.GetRepeatCount())this._currentRepeatCount++,this._pingPongState=a;else return!0;return!1}_LoopPingPongCompleteCheck(){return this.IsForwardPlayBack()?this._playheadTime.Get()>=this.GetTotalTime()&&(this._SetTime(this.GetTotalTime()),this.SetPlaybackRate(-1*this.GetPlaybackRate())):0>=this._playheadTime.Get()&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate())),!1}AddTrack(){const a=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem(),b=C3.TrackState.Create(this,a);return this._tracks.push(b),b}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 c of this._tracks)if(a){if(c.GetId()!==a)continue;c.SetInstance(b),this._timelineManager.SetTimelineObjectClassToMap(b.GetObjectClass(),this);break}else{if(c.HasInstance())continue;c.SetInstance(b),this._timelineManager.SetTimelineObjectClassToMap(b.GetObjectClass(),this);break}}HasTrackInstance(a,b){for(const c of this._tracks)if(b){if(b===c.GetId()&&a===c.GetInstance())return!0;}else if(a===c.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some((a)=>a.CanInstanceBeValid())}GetPropertyTrack(a){for(const b of this.GetTracks())for(const c of b.GetPropertyTracks())if(c.GetPropertyName()===a)return c}GetKeyframeWithTags(a){let b=a?a.split(" "):[];const c=new Set(b.map((a)=>a.toLowerCase().trim()));b=[...c.values()];for(const c of this.GetTracks())for(const a of c.GetKeyframeDataItems()){const c=b.every((b)=>a.HasTag(b));if(c)return a}}GetObjectClasses(){const a=[];for(const b of this.GetTracks())a.push(b.GetObjectClass());return a.filter((a)=>a)}_SaveToJson(){return{"tracksJson":this._SaveTracksToJson(),"name":this._name,"playheadTime":this._playheadTime.Get(),"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}}_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"],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"])}_SaveTracksToJson(){return this._tracks.map((a)=>a._SaveToJson())}_LoadTracksFromJson(a){a.forEach((a,b)=>{const c=this._tracks[b];c._LoadFromJson(a)}),this._tracks.filter((a)=>a.CanInstanceBeValid())}static _HasTag(a){const b=this.GetTags();return""===a?1===b.length&&""===b[0]:b.includes(a)}static _GetTagArray(a){return C3.IsArray(a)?a.slice(0):C3.IsString(a)?a.split(" "):void 0}}}
// c3/timelines/state/trackState.js
"use strict";C3.TrackState=class extends C3.DefendedBase{constructor(a,b){super(),this._timeline=a,this._trackDataItem=b,this._trackData=b.GetTrackData(),this._instanceUid=NaN,this._objectClassIndex=NaN,this._instance=null,this._worldInfo=null,this._lastKeyframeDataItem=null,this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray(),this._propertyTracks=[];for(const c of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(C3.PropertyTrackState.Create(this,c))}static Create(a,b){return C3.New(C3.TrackState,a,b)}Release(){this._keyframeDataItems=null;for(const a of this._propertyTracks)a.Release();C3.clearArray(this._propertyTracks),this._propertyTracks=null,this._timeline=null,this._instance=null,this._worldInfo=null,this._trackDataItem=null,this._lastKeyframeDataItem=null}CleanCaches(){for(const a of this._propertyTracks)a.CleanCaches();this._instance=null,this._worldInfo=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){return this._keyframeDataItems?this._keyframeDataItems:(this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray(),this._keyframeDataItems)}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()}CanInstanceBeValid(){const a=this.GetInstanceUID(),b=this.GetRuntime().GetInstanceByUID(a);return!!b&&!b.IsDestroyed()}GetObjectClass(){const a=this.GetObjectClassIndex();return-1===a?void 0: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),this._instance}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 a of this.propertyTrackItems()){const b=a.propertyTrack,c=a.sourceAdapter,d=b.GetSourceAdapterId();switch(d){case"instance-variable":{const b=c.GetEditorIndex(),d=inst.GetObjectClass(),e=d.GetInstanceVariableIndexByName(a.name),f=d.GetInstanceVariableName(e),g=d.GetInstanceVariableType(e);f===a.name&&g===a.type&&c.UpdateInstanceVariableIndex(e);break}case"behavior":{const b=a.behaviorType,d=this.GetObjectClass(),e=inst.GetObjectClass(),f=c.GetBehaviorType(e);if(b&&f){const a=b.GetName(),g=d.GetBehaviorIndexByName(a),h=e.GetBehaviorIndexByName(a),i=c.GetEditorIndex();c.UpdateBehaviorTypeSid(f.GetSID())}break}}}}}*propertyTrackItems(){for(const a of this._propertyTracks){const b=a.GetSourceAdapter(),c=this.GetObjectClass(),d={propertyTrack:a,sourceAdapter:b};switch(a.GetSourceAdapterId()){case"world-instance":{d.property=a.GetPropertyName();break}case"instance-variable":{const a=b.GetEditorIndex();d.name=c.GetInstanceVariableName(a),d.type=c.GetInstanceVariableType(a);break}case"effect":{const a=c.GetEffectList(),e=b.GetEffectType(a);d.effectType=e;break}case"behavior":{const a=b.GetBehaviorType(c);d.behaviorType=a;break}case"plugin":{d.plugin=c.GetPlugin();break}}yield d}}GetWorldInfo(){if(this._worldInfo&&this.IsInstanceValid())return this._worldInfo;const a=this.GetInstance();return a&&(this._worldInfo=a.GetWorldInfo()),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()}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)}SetInitialState(){if(this.MaybeGetInstance(),!!this.IsInstanceValid()){for(const a of this._propertyTracks)a.SetInitialState();const a=this.GetTimeline(),b=a.IsForwardPlayBack(),c=a.GetTotalTime(),d=b?0:c;this._lastKeyframeDataItem=this._trackData.GetKeyFrameDataItemAtTime(d,this._trackDataItem),this.Interpolate(d)}}SetResumeState(){if(this.MaybeGetInstance(),!!this.IsInstanceValid()){const a=this._timeline.IsForwardPlayBack(),b=this._timeline.GetTime();this._timeline.IsForwardPlayBack()?this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem):(this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemHigherOrEqualThan(b,this._trackDataItem),!this._lastKeyframeDataItem&&(this._lastKeyframeDataItem=this._trackData.GetLastKeyframeDataItem(this._trackDataItem)));for(const a of this._propertyTracks)a.SetResumeState()}}SetEndState(){if(!this.GetTimeline().IsComplete()&&(this.MaybeGetInstance(),!!this.IsInstanceValid())){const a=this._timeline.GetTime(),b=this._timeline.GetTotalTime();a>=b?this.Interpolate(b,!0):0>=a&&this.Interpolate(0,!0)}}Interpolate(a,b=!1,c=!1){if(this.MaybeGetInstance(),!this.IsInstanceValid())return!1;this._lastKeyframeDataItem=this.MaybeTriggerKeyframeReachedConditions(a,b);let d=!1,e=!1;for(const f of this._propertyTracks){const b=f.Interpolate(a,c);d||0==(b&C3.TimelineState.WORLD_INSTANCE_BOX_CHANGE)||(d=!0),e||0==(b&C3.TimelineState.LAYOUT_RENDER_CHANGE)||(e=!0)}if(d){const a=this.GetWorldInfo();a&&a.SetBboxChanged()}return e}MaybeTriggerKeyframeReachedConditions(a,b){if(!b)return;const c=this.GetTimeline();let d=this._trackData.GetKeyFrameDataItemAtTime(a,this._trackDataItem);return d?this.OnKeyframeReached(d):(d=c.IsForwardPlayBack()?this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(a,this._trackDataItem):this._trackData.GetFirstKeyFrameDataItemHigherOrEqualThan(a,this._trackDataItem),d!==this._lastKeyframeDataItem&&this.OnKeyframeReached(d)),d}OnKeyframeReached(a){if(C3.Plugins.Timeline&&this.GetTimeline().constructor===C3.TimelineState){const b=this.GetTimeline();C3.Plugins.Timeline.Cnds.SetTriggerTimeline(b),C3.Plugins.Timeline.Cnds.SetTriggerKeyframe(a);const c=b.GetTimelineManager();c.Trigger(C3.Plugins.Timeline.Cnds.OnAnyKeyframeReached),c.Trigger(C3.Plugins.Timeline.Cnds.OnKeyframeReached),C3.Plugins.Timeline.Cnds.SetTriggerTimeline(null),C3.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}}AddKeyframe(){const a=this._trackDataItem.GetKeyframeData(),b=a.AddEmptyKeyframeDataItem();return b}AddPropertyTrack(){const a=this._trackDataItem.GetPropertyTrackData(),b=a.AddEmptyPropertyTrackDataItem(),c=C3.PropertyTrackState.Create(this,b);return this._propertyTracks.push(c),c}DeleteKeyframes(a){const b=this._trackDataItem.GetKeyframeData();b.DeleteKeyframeDataItems(a)}DeletePropertyKeyframes(a){for(const b of this._propertyTracks)b.DeletePropertyKeyframes(a)}SaveState(){for(const a of this._propertyTracks)a.SaveState()}CompareInitialStateWithCurrent(){if(this.MaybeGetInstance(),!!this.IsInstanceValid())for(const a of this._propertyTracks)a.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){if(this.MaybeGetInstance(),!this.IsInstanceValid())return;let a=!1;for(const b of this._propertyTracks){const c=b.CompareSaveStateWithCurrent();!a&&c&&(a=!0)}if(a){const a=this.AddKeyframe();a.SetTime(this.GetTimeline().GetTime()),a.SetEase("noease"),a.SetEnable(!0),a.SetTags("")}}_SaveToJson(){return{"propertyTracksJson":this._SavePropertyTracksToJson(),"lastKeyframeDataItemJson":this._SaveLastKeyframeDataItemToJson(),"instanceUid":this._instanceUid}}_LoadFromJson(a){a&&(this._LoadPropertyTracksFromJson(a["propertyTracksJson"]),this._LoadLastKeyframeDataItemFromJson(a["lastKeyframeDataItemJson"]),this._LoadInstanceFromJson(a["instanceUid"]))}_SaveLastKeyframeDataItemToJson(){const a=this._trackDataItem.GetKeyframeData();return a.GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map((a)=>a._SaveToJson())}_LoadPropertyTracksFromJson(a){a.forEach((a,b)=>{const c=this._propertyTracks[b];c._LoadFromJson(a)})}_LoadInstanceFromJson(a){if(C3.IsFiniteNumber(a)){const b=this.GetRuntime().GetInstanceByUID(a);if(b){const a=this.GetTimeline();a.ClearTrackInstances(),a.SetTrackInstance(this._trackDataItem.GetId(),b)}}}_LoadLastKeyframeDataItemFromJson(a){const b=this._trackDataItem.GetKeyframeData();this._lastKeyframeDataItem=b.GetKeyframeDataItemFromIndex(a)}};
// c3/timelines/state/propertyTrackState.js
"use strict";C3.PropertyTrackState=class extends C3.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 C3.New(C3.PropertyTrackState,a,b)}Release(){this._track=null,this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=null),this._propertyKeyframeDataItems=null,this._propertyTrackDataItem=null,this._propertyTrackData=null}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;const a=this._propertyTrackDataItem.GetSourceAdapterId();let b;return"behavior"===a?b=new C3.PropertyTrackState.BehaviorSourceAdapter(this):"effect"===a?b=new C3.PropertyTrackState.EffectSourceAdapter(this):"instance-variable"===a?b=new C3.PropertyTrackState.InstanceVariableSourceAdapter(this):"plugin"===a?b=new C3.PropertyTrackState.PluginSourceAdapter(this):"world-instance"===a?b=new C3.PropertyTrackState.WorldInstanceSourceAdapter(this):"value"===a?b=new C3.PropertyTrackState.ValueSourceAdapter(this):void 0,this._sourceAdapter=b,this._sourceAdapter}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(),this._propertyKeyframeDataItems)}*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()}Interpolate(a,b=!1){const c=this._propertyTrackDataItem;let d,e=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(a,c);return e?d=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherThan(a,c):(e=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,c),d=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,c)),this.GetSourceAdapter().Interpolate(a,e,d,b)}static GetStartPropertyKeyframeForTime(a,b){const c=b.GetPropertyTrackDataItem(),d=b._propertyTrackData;let e=d.GetPropertyKeyFrameDataItemAtTime(a,c);return e||(e=d.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,c)),e}static GetEndPropertyKeyframeForTime(a,b){const c=b.GetPropertyTrackDataItem(),d=b._propertyTrackData;let e=d.GetPropertyKeyFrameDataItemAtTime(a,c);return e?d.GetFirstPropertyKeyFrameDataItemHigherThan(a,c):d.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,c)}AddPropertyKeyframe(){const a=this._propertyTrackDataItem.GetPropertyKeyframeData(),b=a.AddEmptyPropertyKeyframeDataItem();return b}DeletePropertyKeyframes(a){const b=this._propertyTrackDataItem.GetPropertyKeyframeData();b.DeletePropertyKeyframeDataItems(a)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){const a=this.GetSourceAdapter().CompareInitialStateWithCurrent();if(a){const a=this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),b=this.GetSourceAdapter().GetCurrentState();a.SetAbsoluteValue(b)}}CompareSaveStateWithCurrent(){const a=this.GetSourceAdapter().CompareSaveStateWithCurrent();return a&&this.AddPropertyKeyframeAtCurrentTime(),this.GetSourceAdapter().ClearSaveState(),a}AddPropertyKeyframeAtCurrentTime(){const a=this.GetTimeline().GetTime(),b=this.GetSourceAdapter(),c=C3.PropertyTrackState.GetStartPropertyKeyframeForTime(a,this),d=this.AddPropertyKeyframe();d.SetType(c.GetType()),d.SetTime(a),d.SetEase(c.GetEase()),d.SetEnable(!0),d.SetValue(b.GetValueAtTime()),d.SetAbsoluteValue(b.GetCurrentState())}_SaveToJson(){return{"sourceAdapterJson":this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(a){a&&this.GetSourceAdapter()._LoadFromJson(a["sourceAdapterJson"])}};
// c3/timelines/state/propertySourceAdapters/propertySourceAdapter.js
"use strict";{const a=C3.PropertyTrackState;a.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(),this._propertyAdapter)}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}Interpolate(b,c,d,e){const f=a.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack),g=f(b,c,d,this._propertyTrack);return this.GetPropertyAdapter().ChangeProperty(b,g,c,d,e)}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 a.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_CreatePropertyAdapter(){const b=this._propertyTrack.GetPropertyType(),c=this._propertyTrack.GetPropertyKeyframeType();return"combo"===c||"boolean"===c||"text"===c||"string"===c?new a.PropertyInterpolationAdapter.NoInterpolationAdapter(this):"numeric"===c||"number"===c||"angle"===c?"combo"===b?new a.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new a.PropertyInterpolationAdapter.NumericInterpolationAdapter(this):"color"===c||"offsetColor"===c?new a.PropertyInterpolationAdapter.ColorInterpolationAdapter(this):void 0}_SaveToJson(){return{"propertyAdapterJson":this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(a){a&&this.GetPropertyAdapter()._LoadFromJson(a["propertyAdapterJson"])}static GetValueAtTime(b){const c=b.GetTrack(),d=c.GetTimeline().GetTime(),e=a.GetStartPropertyKeyframeForTime(d,b),f=a.GetEndPropertyKeyframeForTime(d,b),g=a.PropertySourceAdapter.GetInterpolateFunc(b);return g(d,e,f,b)}static GetValue(a,b,c){let d=a.GetResultMode();return"combo"===a.GetPropertyType()&&(d="absolute"),"relative"===d?b+c:"absolute"===d?c:void 0}static GetInterpolateFunc(b){const c=b.GetPropertyKeyframeType();return"numeric"===c?a.NumericTypeAdapter.Interpolate:"angle"===c?a.AngleTypeAdapter.Interpolate:"boolean"===c?a.BooleanTypeAdapter.Interpolate:"color"===c?a.ColorTypeAdapter.Interpolate:"text"===c?a.TextTypeAdapter.Interpolate:void 0}static GetWillChangeFunc(b){const c=b.GetPropertyKeyframeType();return"numeric"===c?a.NumericTypeAdapter.WillChange:"angle"===c?a.AngleTypeAdapter.WillChange:"boolean"===c?a.BooleanTypeAdapter.WillChange:"color"===c?a.ColorTypeAdapter.WillChange:"text"===c?a.TextTypeAdapter.WillChange:void 0}}}
// c3/timelines/state/propertySourceAdapters/worldInstanceSourceAdapter.js
"use strict";{class a extends C3.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}}C3.PropertyTrackState.WorldInstanceSourceAdapter=a}
// c3/timelines/state/propertySourceAdapters/instanceVariableSourceAdapter.js
"use strict";{const a=0;class b extends C3.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a),this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[a]}GetIndex(){return this._updatedIndex?this._updatedIndex:super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(b){const c=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[a];c===b||(this._updatedIndex=b)}Interpolate(a,b,c,d){this.GetPropertyAdapter().CanChange(b.GetValue())&&super.Interpolate(a,b,c,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"index":this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a["index"])}}C3.PropertyTrackState.InstanceVariableSourceAdapter=b}
// c3/timelines/state/propertySourceAdapters/behaviorSourceAdapter.js
"use strict";{const a=0;class b extends C3.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a),this._sid=NaN}GetEditorIndex(){const a=this._propertyTrack.GetPropertyTrackDataItem();return a.GetSourceAdapterArguments()[1]}GetTarget(){const b=this._propertyTrack.GetPropertyTrackDataItem(),c=this._propertyTrack.GetTrack(),d=this._sid?this._sid:b.GetSourceAdapterArguments()[a],e=c.GetInstance(),f=e.GetBehaviorIndexBySID(d),g=e.GetBehaviorInstances()[f];return g.GetSdkInstance()}GetBehaviorType(a){const b=this._propertyTrack.GetPropertyTrackDataItem(),c=b.GetSourceAdapterArguments()[2];return a.GetBehaviorTypeByName(c)}UpdateBehaviorTypeSid(b){const c=this._propertyTrack.GetPropertyTrackDataItem();c.GetSourceAdapterArguments()[a]===b||(this._sid=b)}Interpolate(a,b,c,d){const e=this._propertyTrack.GetTrack(),f=e.GetInstance();this.GetBehaviorType(f.GetObjectClass())&&super.Interpolate(a,b,c,d)}_SaveToJson(){return Object.assign(super._SaveToJson(),{"sid":this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._sid=a["sid"])}}C3.PropertyTrackState.BehaviorSourceAdapter=b}
// c3/timelines/state/propertySourceAdapters/effectSourceAdapter.js
"use strict";{class a extends C3.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const a=this._propertyTrack,b=a.GetTrack(),c=b.GetWorldInfo(),d=c.GetInstanceEffectList(),e=d.GetEffectList(),f=this.GetEffectType(e),g=f.GetIndex();return d.IsEffectIndexActive(g)?d.GetEffectParametersForIndex(g):null}GetEffectType(a){const b=this._propertyTrack,c=b.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];return a.GetEffectTypeByName(c)}Interpolate(a,b,c,d){this._IsEffectActive()&&super.Interpolate(a,b,c,d)}_IsEffectActive(){const a=this._propertyTrack,b=a.GetTrack(),c=b.GetWorldInfo(),d=c.GetInstanceEffectList(),e=d.GetEffectList(),f=this.GetEffectType(e);if(f){const a=f.GetIndex();return d.IsEffectIndexActive(a)}}}C3.PropertyTrackState.EffectSourceAdapter=a}
// c3/timelines/state/propertySourceAdapters/pluginSourceAdapter.js
"use strict";{class a extends C3.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(a,b,c,d){const e=this._propertyTrack.GetTrack(),f=e.GetObjectClass().GetPlugin(),g=e.GetInstance().GetObjectClass().GetPlugin();f!==g||super.Interpolate(a,b,c,d)}}C3.PropertyTrackState.PluginSourceAdapter=a}
// c3/timelines/state/propertySourceAdapters/valueSourceAdapter.js
"use strict";{class a extends C3.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a),this._value=0}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let b=this._propertyTrack.GetPropertyTrackDataItem();b=a.GetFirstPropertyKeyframeDataItem(b),this._value=b.GetValueWithResultMode()}SetResumeState(){}GetValue(){return this._value}Interpolate(a,b,c){const d=C3.PropertyTrackState.NumericTypeAdapter.Interpolate;this._value=d(a,b,c,this._propertyTrack)}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{"value":this._value}}_LoadFromJson(a){a&&(this._value=a["value"])}}C3.PropertyTrackState.ValueSourceAdapter=a}
// c3/timelines/state/propertyInterpolationAdapters/propertyInterpolationAdapter.js
"use strict";C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(a){this._sourceAdapter=a,this._propertyTrack=a.GetPropertyTrack(),this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo(),this._property=this._propertyTrack.GetPropertyName(),this._firstAbsoluteUpdate=!1,this._saveState=null,this._target=null}Release(){this._sourceAdapter=null,this._propertyTrack=null,this._worldInfo=null,this._saveState=null,this._target=null}CleanCaches(){this._worldInfo=null,this._saveState=null,this._target=null}GetWorldInfo(){return this._worldInfo?this._worldInfo:(this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo(),this._worldInfo)}SetFirstAbsoluteUpdate(a){this._firstAbsoluteUpdate=!!a}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(a){const b=typeof this._Getter();return b==typeof a}ChangeProperty(){}_FirstKeyframeGetter(){const a=this._PickTimelinePlaybackMode(()=>{const a=this._propertyTrack.GetPropertyTrackDataItem(),b=this._propertyTrack.GetPropertyTrackData();return b.GetFirstPropertyKeyframeDataItem(a)},()=>{const a=this._propertyTrack.GetPropertyTrackDataItem(),b=this._propertyTrack.GetPropertyTrackData();return b.GetLastPropertyKeyframeDataItem(a)});return a.GetAbsoluteValue()}_CurrentKeyframeGetter(){const a=this._propertyTrack.GetTimeline(),b=a.GetTime(),c=this._PickTimelinePlaybackMode(()=>{const a=this._propertyTrack.GetPropertyTrackDataItem(),c=this._propertyTrack.GetPropertyTrackData();return c.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,a)},()=>{const a=this._propertyTrack.GetPropertyTrackDataItem(),c=this._propertyTrack.GetPropertyTrackData(),d=c.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,a);return d?d:c.GetLastPropertyKeyframeDataItem(a)});return c.GetAbsoluteValue()}_PickTimelinePlaybackMode(a,b){const c=this._propertyTrack.GetTimeline();return c.IsForwardPlayBack()?a():b()}_PickResultMode(a,b){const c=this._propertyTrack.GetResultMode();return"relative"===c?a():b()}_PickFirstAbsoluteUpdate(a,b){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),a()):b()}_GetAbsoluteInitialValue(){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:(this._target=this._sourceAdapter.GetTarget(),this._target)}_PickSource(a,b,c,d,e){const f=this._propertyTrack.GetSourceAdapterId();return"behavior"===f?a():"effect"===f?b():"instance-variable"===f?c():"plugin"===f?d():"world-instance"===f?e():void 0}_SaveToJson(){return{"firstAbsoluteUpdate":this._firstAbsoluteUpdate,"saveState":this._saveState}}_LoadFromJson(a){a&&(this._firstAbsoluteUpdate=a["firstAbsoluteUpdate"],this._saveState=a["saveState"])}};
// c3/timelines/state/propertyInterpolationAdapters/colorInterpolationAdapter.js
"use strict";{class a extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(a){super(a),this._lastValueR=0,this._lastValueG=0,this._lastValueB=0}SetInitialState(){this.SetFirstAbsoluteUpdate(!0);const a=this._GetAbsoluteInitialValue(this._FirstKeyframeGetter());this._lastValueR=a.getR(),this._lastValueG=a.getG(),this._lastValueB=a.getB()}SetResumeState(){if(!this._CompareColors(this._FirstKeyframeGetter(),this._CurrentKeyframeGetter())){this.SetFirstAbsoluteUpdate(!0);const a=this._GetAbsoluteInitialValue(this._CurrentKeyframeGetter());this._lastValueR=a.getR(),this._lastValueG=a.getG(),this._lastValueB=a.getB()}}GetCurrentState(){const a=this._propertyTrack.GetSourceAdapterId(),b=this._GetTarget(),c=this._GetIndex();switch(a){case"behavior":b.GetPropertyValueByIndex(c);break;case"effect":return b[c].toArray().slice(0,3);case"plugin":return b.GetPropertyValueByIndex(c);case"world-instance":return this._Getter().toArray().slice(0,3);}}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return!this._CompareColors(a,this._Getter())}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&!this._CompareColors(this._saveState,this._Getter())}_CompareColors(a,b){return a.equalsIgnoringAlpha(b)}_FirstKeyframeGetter(){const a=super._FirstKeyframeGetter();return this._GetColorFromArray(a)}_CurrentKeyframeGetter(){const a=super._CurrentKeyframeGetter();return this._GetColorFromArray(a)}_GetAbsoluteInitialValue(a){const b=this._GetColorFromArray(a);return C3.Color.Diff(b,this._Getter())}_GetColorFromArray(a){return C3.IsInstanceOf(a,C3.Color)?a:new C3.Color(a[0],a[1],a[2])}CanChange(){return!0}ChangeProperty(a,c){const d=c[0],e=c[1],f=c[2],b=this._lastValueR,g=this._lastValueG,h=this._lastValueB;return this._PickFirstAbsoluteUpdate(()=>{this._Setter(-b,-g,-h)},()=>{this._Setter(-b+d,-g+e,-h+f)}),this._lastValueR=d,this._lastValueG=e,this._lastValueB=f,C3.TimelineState.LAYOUT_RENDER_CHANGE}_Getter(){const a=this._propertyTrack.GetSourceAdapterId(),b=this._GetTarget(),c=this._GetIndex();return"behavior"===a?this._GetColorFromArray(b.GetPropertyValueByIndex(c)):"effect"===a?b[c].clone():"plugin"===a?this._GetColorFromArray(b.GetPropertyValueByIndex(c)):"world-instance"===a?this.GetWorldInfo().GetUnpremultipliedColor().clone():void 0}_Setter(a,c,d){const b=this._propertyTrack.GetSourceAdapterId(),e=this._GetTarget(),f=this._GetIndex();"behavior"===b?e.SetPropertyColorOffsetValueByIndex(f,a,c,d):"effect"===b?e[f].addRgb(a,c,d):"plugin"===b?e.SetPropertyColorOffsetValueByIndex(f,a,c,d):"world-instance"===b?this.GetWorldInfo().OffsetUnpremultipliedColorRGB(a,c,d):void 0}_SaveToJson(){return Object.assign(super._SaveToJson(),{"r":this._lastValueR,"g":this._lastValueG,"b":this._lastValueB})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._lastValueR=a["r"],this._lastValueG=a["g"],this._lastValueB=a["b"])}}C3.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=a}
// c3/timelines/state/propertyInterpolationAdapters/noInterpolationAdapter.js
"use strict";{class a extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(a){super(a)}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a,b){const c=C3.PropertyTrackState.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack),d=this._propertyTrack.GetSourceAdapterId(),e=c(this._GetIndex(),this._GetTarget(),b,d);if(e)return this._Setter(b),"behavior"===d||"effect"===d||"instance-variable"===d?void 0:"plugin"===d?C3.TimelineState.LAYOUT_RENDER_CHANGE:void 0}_Getter(){const a=this._propertyTrack.GetSourceAdapterId(),b=this._GetTarget(),c=this._GetIndex();switch(a){case"behavior":return b.GetPropertyValueByIndex(c);case"effect":return b[c];case"instance-variable":return b.GetInstanceVariableValue(c);case"plugin":return b.GetPropertyValueByIndex(c);;}}_Setter(a){const b=this._propertyTrack.GetSourceAdapterId(),c=this._GetTarget(),d=this._GetIndex();"behavior"===b?c.SetPropertyValueByIndex(d,a):"effect"===b?c[d]=a:"instance-variable"===b?c.SetInstanceVariableValue(d,a):"plugin"===b?c.SetPropertyValueByIndex(d,a):void 0}}C3.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=a}
// c3/timelines/state/propertyInterpolationAdapters/numericInterpolationAdapter.js
"use strict";{const a=new Map,b=(b,c,d,e)=>a.set(b,{setter:c,getter:d,round:e});b("offsetX",(a,b)=>a.OffsetX(b),(a)=>a.GetX(),!0),b("offsetY",(a,b)=>a.OffsetY(b),(a)=>a.GetY(),!0),b("offsetWidth",(a,b)=>a.OffsetWidth(b),(a)=>a.GetWidth(),!0),b("offsetHeight",(a,b)=>a.OffsetHeight(b),(a)=>a.GetHeight(),!0),b("offsetAngle",(a,b)=>a.OffsetAngle(b),(a)=>a.GetAngle(),!1),b("offsetOpacity",(a,b)=>a.OffsetOpacity(b),(a)=>a.GetOpacity(),!1),b("offsetOriginX",(a,b)=>a.OffsetOriginX(b),(a)=>a.GetOriginX(),!1),b("offsetOriginY",(a,b)=>a.OffsetOriginY(b),(a)=>a.GetOriginY(),!1),b("offsetZElevation",(a,b)=>a.OffsetZElevation(b),(a)=>a.GetZElevation(),!0);class c extends C3.PropertyTrackState.PropertyInterpolationAdapter{constructor(b){super(b),this._lastValue=0,this._instance_getter=null,this._instance_setter=null,this._round=!1;const c=this._propertyTrack.GetPropertyName();if("world-instance"===this._propertyTrack.GetSourceAdapterId()){const b=a.get(c);this._instance_getter=b.getter,this._instance_setter=b.setter,this._round=b.round}}Release(){this._instance_getter=null,this._instance_setter=null,super.Release()}SetInitialState(){this._lastValue=this._PickResultMode(()=>this._PickTimelinePlaybackMode(()=>0,()=>C3.PropertyTrackState.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)),()=>(this.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(this._FirstKeyframeGetter())))}SetResumeState(){this._FirstKeyframeGetter()===this._CurrentKeyframeGetter()||this._PickResultMode(()=>{},()=>{this.SetFirstAbsoluteUpdate(!0),this._lastValue=this._GetAbsoluteInitialValue(this._CurrentKeyframeGetter())})}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}_GetAbsoluteInitialValue(a){return a-this.GetCurrentState()}ChangeProperty(a,b,c,d,e){return this._PickResultMode(()=>{this._Setter(b-this._lastValue,c,d),this._lastValue=b,this._MaybeEnsureValue(a,c,d,e,this._lastValue,b)},()=>{this._PickFirstAbsoluteUpdate(()=>{this._Setter(this._lastValue,c,d),this._lastValue=b},()=>{this._Setter(b-this._lastValue,c,d),this._lastValue=b,this._MaybeEnsureValue(a,c,d,e,this._lastValue,b)})}),this._PickSource(()=>{},()=>C3.TimelineState.LAYOUT_RENDER_CHANGE,()=>{},()=>C3.TimelineState.LAYOUT_RENDER_CHANGE,()=>C3.TimelineState.LAYOUT_RENDER_CHANGE)}_Getter(){const a=this._GetTarget(),b=this._GetIndex();return this._PickSource(()=>a.GetPropertyValueByIndex(b),()=>a[b],()=>a.GetInstanceVariableValue(b),()=>a.GetPropertyValueByIndex(b),()=>this._instance_getter(this.GetWorldInfo()))}_Setter(a){const b=this._GetTarget(),c=this._GetIndex();this._PickSource(()=>b.OffsetPropertyValueByIndex(c,a),()=>b[c]+=a,()=>b.SetInstanceVariableOffset(c,a),()=>b.OffsetPropertyValueByIndex(c,a),()=>this._instance_setter(this.GetWorldInfo(),a))}_MaybeEnsureValue(a,b,c,d,e,f){d?b&&a===b.GetTime()?this._AddDelta(b.GetValueWithResultMode(),b,c):c&&a===c.GetTime()?this._AddDelta(c.GetValueWithResultMode(),b,c):!c&&this._AddDelta(b.GetValueWithResultMode(),b,c):b&&a===b.GetTime()?this._AddDelta(b.GetValueWithResultMode(),b,c):c&&a===c.GetTime()?this._AddDelta(c.GetValueWithResultMode(),b,c):0==f-e&&this._AddDelta(b.GetValueWithResultMode(),b,c)}_AddDelta(a,b,c){const d=a.toString(),e=d.split(".")[1]||"",f=e.length,g=this._Getter();let h;h=0===f?this._round?Math.round(g):g:C3.toFixed(g,f),this._Setter(h-g,b,c),this._lastValue+=h-g}_SaveToJson(){return Object.assign(super._SaveToJson(),{"v":this._lastValue})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._lastValue=a["v"])}}C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=c}
// c3/timelines/state/propertyTypeAdapters/numericTypeAdapter.js
"use strict";C3.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(a,b,c,d){let e;return"behavior"===d?e=b.GetPropertyValueByIndex(a):"effect"===d?e=b[a]:"instance-variable"===d?e=b.GetInstanceVariableValue(a):"plugin"===d?e=b.GetPropertyValueByIndex(a):void 0,e!==c}static Interpolate(a,b,c,d){var f=Math.floor;if(!c){let a=d.GetPropertyTrackDataItem();const b=d.GetPropertyTrackData();return a=b.GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode()}let g=d.GetInterpolationMode();if("default"===g&&(g="continuous"),"combo"===d.GetPropertyType()&&(g="discrete"),"discrete"===g)return b.GetValueWithResultMode();if("continuous"===g||"step"===g){if("step"===g){const b=d.GetTimeline().GetStep();if(0!==b){const c=1/b;a=f(a*c)/c}}const h=b.GetTime(),i=c.GetTime(),j=b.GetValueWithResultMode(),k=c.GetValueWithResultMode();if(j===k)return j;const l=C3.normalize(a,h,i),m=b.GetEase();let e;const n=b.GetAddOn("cubic-bezier"),o=c.GetAddOn("cubic-bezier");if(n&&n.GetStartEnable()&&o&&o.GetEndEnable()){const a=i-h;e=Ease.GetEase(m)(a*l,0,1,a),e=Ease.GetEase("cubicbezier")(e,j,j+n.GetStartAnchor(),k+o.GetEndAnchor(),k)}else e=Ease.GetEase(m)((i-h)*l,j,k-j,i-h);return"integer"===d.GetPropertyType()?f(e):e}}};
// c3/timelines/state/propertyTypeAdapters/angleTypeAdapter.js
"use strict";C3.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(a,b,c,d){let e;return"behavior"===d?e=b.GetPropertyValueByIndex(a):"effect"===d?e=b[a]:"instance-variable"===d?e=b.GetInstanceVariableValue(a):"plugin"===d?e=b.GetPropertyValueByIndex(a):void 0,e!==c}static Interpolate(a,b,c,d){if(!c){let a=d.GetPropertyTrackDataItem();const b=d.GetPropertyTrackData();return a=b.GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode()}let e=d.GetInterpolationMode();if("default"===e&&(e="continuous"),"combo"===d.GetPropertyType()&&(e="discrete"),"discrete"===e)return b.GetValueWithResultMode();if("continuous"===e||"step"===e){if("step"===e){const b=d.GetTimeline().GetStep();if(0!==b){const c=1/b;a=Math.floor(a*c)/c}}const f=b.GetTime(),g=c.GetTime(),h=b.GetValueWithResultMode(),i=c.GetValueWithResultMode();if(h===i)return h;let j=C3.normalize(a,f,g);const k=Ease.GetEase(b.GetEase());return C3.angleLerp(h,i,k(j,0,1,1))}}};
// c3/timelines/state/propertyTypeAdapters/booleanTypeAdapter.js
"use strict";C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(a,b,c,d){let e;return"behavior"===d?e=b.GetPropertyValueByIndex(a):"effect"===d?e=b[a]:"instance-variable"===d?e=b.GetInstanceVariableValue(a):"plugin"===d?e=b.GetPropertyValueByIndex(a):void 0,!!e!=!!c}static Interpolate(a,b,c,d){if(!c){let a=d.GetPropertyTrackDataItem();const b=d.GetPropertyTrackData();return a=b.GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode()?1:0}return b.GetValueWithResultMode()?1:0}};
// c3/timelines/state/propertyTypeAdapters/colorTypeAdapter.js
"use strict";{const a=[0,0,0],b=[0,0,0];C3.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(c,d,e,f){var g=Math.floor;let h;return"behavior"===f?h=d.GetPropertyValueByIndex(c):"effect"===f?h=d[c]:"instance-variable"===f?h=d.GetInstanceVariableValue(c):"plugin"===f?h=d.GetPropertyValueByIndex(c):void 0,Array.isArray(e)?(a[0]=e[0],a[1]=e[1],a[2]=e[2]):(TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(e),a[0]=g(255*TEMP_COLOR_ARRAY_3.getR()),a[1]=g(255*TEMP_COLOR_ARRAY_3.getG()),a[2]=g(255*TEMP_COLOR_ARRAY_3.getB())),Array.isArray(h)?(b[0]=h[0],b[1]=h[1],b[2]=h[2]):(TEMP_COLOR_ARRAY_3.parseCommaSeparatedRgb(h),b[0]=g(255*TEMP_COLOR_ARRAY_3.getR()),b[1]=g(255*TEMP_COLOR_ARRAY_3.getG()),b[2]=g(255*TEMP_COLOR_ARRAY_3.getB())),a[0]!==b[0]||a[1]!==b[1]||a[2]!==b[2]}static Interpolate(b,c,f,d){if(!f){let b=d.GetPropertyTrackDataItem();const c=d.GetPropertyTrackData();b=c.GetLastPropertyKeyframeDataItem(b);const e=b.GetValueWithResultMode();return a[0]=e[0],a[1]=e[1],a[2]=e[2],a}let g=d.GetInterpolationMode();if("default"===g&&(g="continuous"),"discrete"===g){const b=c.GetValueWithResultMode();return a[0]=b[0],a[1]=b[1],a[2]=b[2],a}if("continuous"===g||"step"===g){if("step"===g){const a=d.GetTimeline().GetStep();if(0!==a){const c=1/a;b=Math.floor(b*c)/c}}const h=c.GetTime(),i=f.GetTime(),j=c.GetValueWithResultMode(),k=f.GetValueWithResultMode(),l=C3.normalize(b,h,i),m=c.GetEase(),e=j[0],n=j[1],o=j[2],p=k[0],q=k[1],r=k[2],s=Ease.GetEase(m),t=i-h,u=t*l;return a[0]=e===p?e:s(u,e,p-e,t),a[1]=n===q?n:s(u,n,q-n,t),a[2]=o===r?o:s(u,o,r-o,t),a}}}}
// c3/timelines/state/propertyTypeAdapters/textTypeAdapter.js
"use strict";C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(a,b,c,d){let e;return"behavior"===d?e=b.GetPropertyValueByIndex(a):"effect"===d?e=b[a]:"instance-variable"===d?e=b.GetInstanceVariableValue(a):"plugin"===d?e=b.GetPropertyValueByIndex(a):void 0,e!==c}static Interpolate(a,b,c,d){if(!c){let a=d.GetPropertyTrackDataItem();const b=d.GetPropertyTrackData();return a=b.GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode()}return b.GetValueWithResultMode()}};
// c3/timelines/data/timelineDataManager.js
"use strict";C3.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){const b=new C3.TimelineDataItem(a),c=b.GetName();this._timelineDataItems.set(c,b)}Get(a){return this._timelineDataItems.get(a)}GetNameId(){return 0}static _CreateDataItems(a,b,c,d){if(b)for(const e of b)C3.TimelineDataManager._CreateDataItem("create",e,a,c,d)}static _LoadDataItemsFromJson(a,b,c,d){a.length?b.forEach((b,c)=>{a[c]._LoadFromJson(b)}):b.forEach((b)=>{C3.TimelineDataManager._CreateDataItem("load",b,a,c,d)})}static _CreateDataItem(a,b,c,d,e){let f;if("function"==typeof d)"load"===a?f=new d(null,e):"create"===a?f=new d(b,e):void 0;else if("object"==typeof d){const c=d.prop,g=b[c],h=d.map.get(g);"load"===a?f=new h(null,e):"create"===a?f=new h(b,e):void 0}switch(a){case"load":f._LoadFromJson(b),c.push(f);break;case"create":if("function"==typeof f.GetEnable&&!f.GetEnable())return f.Release();c.push(f);}}};
// c3/timelines/data/timelineData.js
"use strict";{C3.TimelineDataItem=class{constructor(a){this._name="",this._totalTime=NaN,this._step=0,this._interpolationMode="default",this._resultMode="default",this._loop=!1,this._pingPong=!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 C3.TrackData(a[5],this))}Release(){this._trackData.Release(),this._trackData=null}GetTrackData(){return this._trackData||(this._trackData=new C3.TrackData(null,this)),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}GetPingPong(){return this._pingPong}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"])}}}
// c3/timelines/data/trackData.js
"use strict";{const a=0;class b{constructor(b,c){this._trackData=c,this._instanceData=null,this._instanceUid=NaN,this._objectClassIndex=NaN,this._interpolationMode="default",this._resultMode="default",this._enabled=!1,this._keyframeData=null,this._propertyTrackData=null,this._id="";b&&(this._instanceData=b[a],this._instanceUid=b[a][2],this._objectClassIndex=b[a][1],this._interpolationMode=b[1],this._resultMode=b[2],this._enabled=!!b[3],b[6]&&(this._id=b[6]),this._keyframeData=new C3.KeyframeData(b[4],this),this._propertyTrackData=new C3.PropertyTrackData(b[5],this))}Release(){this._trackData=null,this._keyframeData&&(this._keyframeData.Release(),this._keyframeData=null),this._propertyTrackData&&(this._propertyTrackData.Release(),this._propertyTrackData=null)}GetTrackData(){return this._trackData}GetKeyframeData(){return this._keyframeData||(this._keyframeData=new C3.KeyframeData(null,this)),this._keyframeData}GetPropertyTrackData(){return this._propertyTrackData||(this._propertyTrackData=new C3.PropertyTrackData(null,this)),this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(a){this._objectClassIndex=a}GetInstanceUID(){return this._instanceUid}SetInstanceUID(a){this._instanceUid=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}GetId(){return this._id}_SaveToJson(){return{"keyframeDataJson":this._keyframeData._SaveToJson(),"propertyTrackDataJson":this._propertyTrackData._SaveToJson(),"instanceData":this._instanceData,"instanceUid":this._instanceUid,"objectClassIndex":this._objectClassIndex,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled,"id":this._id}}_LoadFromJson(a){a&&(this._instanceData=a["instanceData"],this._instanceUid=a["instanceUid"],this._objectClassIndex=a["objectClassIndex"],this._interpolationMode=a["interpolationMode"],this._resultMode=a["resultMode"],this._enabled=a["enabled"],this._id=a["id"],this.GetKeyframeData()._LoadFromJson(a["keyframeDataJson"]),this.GetPropertyTrackData()._LoadFromJson(a["propertyTrackDataJson"]))}}C3.TrackData=class{constructor(a,c){this._timelineData=c,this._trackDataItems=[],this._keyframeTimeMap=new Map,C3.TimelineDataManager._CreateDataItems(this._trackDataItems,a,b,this)}Release(){this._timelineData=null;for(const a of this._trackDataItems)a.Release();C3.clearArray(this._trackDataItems),this._trackDataItems=null,this._keyframeTimeMap.clear(),this._keyframeTimeMap=null}AddEmptyTrackDataItem(){const a=new b(null,this);return this._trackDataItems.push(a),a}GetFirstKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(a){const b=a.GetKeyframeData().GetKeyframeDataItemArray();return b[b.length-1]}GetKeyFrameDataItemAtTime(a,b){const c=this._keyframeTimeMap.get(b);if(!!c&&c.has(a))return c.get(a);for(const d of b.GetKeyframeData().keyframeDataItems())if(d.GetTime()===a)return c||this._keyframeTimeMap.set(b,new Map),this._keyframeTimeMap.get(b).set(a,d),d}GetFirstKeyFrameDataItemHigherThan(a,b){for(const c of b.GetKeyframeData().keyframeDataItems())if(c.GetTime()>a)return c}GetFirstKeyFrameDataItemHigherOrEqualThan(a,b){for(const c of b.GetKeyframeData().keyframeDataItems())if(c.GetTime()>=a)return c}GetFirstKeyFrameDataItemLowerOrEqualThan(a,b){for(const c of b.GetKeyframeData().keyframeDataItemsReverse())if(c.GetTime()<=a)return c}*trackDataItems(){for(const a of this._trackDataItems)yield a}_SaveToJson(){return{"trackDataItemsJson":this._trackDataItems.map((a)=>a._SaveToJson())}}_LoadFromJson(a){a&&C3.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,a["trackDataItemsJson"],b,this)}}}
// c3/timelines/data/propertyTrackData.js
"use strict";{const a=0;class b{constructor(b,c){this._propertyTrackData=c,this._sourceAdapterId="",this._sourceAdapterArguments=null,this._property=null,this._type=null,this._min=NaN,this._max=NaN,this._interpolationMode="default",this._resultMode="default",this._enabled=!1,this._propertyKeyframeData=null;b&&(this._sourceAdapterId=b[a][0],this._sourceAdapterArguments=b[a].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 C3.PropertyKeyframeData(b[8],this))}Release(){this._propertyKeyframeData.Release(),this._propertyKeyframeData=null,this._propertyTrackData=null,this._sourceAdapterArguments=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){return this._propertyKeyframeData||(this._propertyKeyframeData=new C3.PropertyKeyframeData(null,this)),this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(a){this._sourceAdapterId=a}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(a){this._sourceAdapterArguments=a}GetProperty(){return this._property}SetProperty(a){this._property=a}GetType(){return this._type}SetType(a){this._type=a}GetMin(){return this._min}SetMin(a){this._min=a}GetMax(){return this._max}SetMax(a){this._max=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}_SaveToJson(){return{"propertyKeyframeDataJson":this._propertyKeyframeData._SaveToJson(),"sourceAdapterId":this._sourceAdapterId,"sourceAdapterArguments":this._sourceAdapterArguments,"property":this._property,"type":this._type,"min":this._min,"max":this._max,"interpolationMode":this._interpolationMode,"resultMode":this._resultMode,"enabled":this._enabled}}_LoadFromJson(a){a&&(this._sourceAdapterId=a["sourceAdapterId"],this._sourceAdapterArguments=a["sourceAdapterArguments"],this._property=a["property"],this._type=a["type"],this._min=a["min"],this._max=a["max"],this._interpolationMode=a["interpolationMode"],this._resultMode=a["resultMode"],this._enabled=a["enabled"],this.GetPropertyKeyframeData()._LoadFromJson(a["propertyKeyframeDataJson"]))}}C3.PropertyTrackData=class{constructor(a,c){this._trackDataItem=c,this._propertyTrackDataItems=[],this._propertyKeyframeTimeMap=new Map,C3.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,a,b,this)}Release(){this._trackDataItem=null;for(const a of this._propertyTrackDataItems)a.Release();C3.clearArray(this._propertyTrackDataItems),this._propertyTrackDataItems=null,this._propertyKeyframeTimeMap.clear(),this._propertyKeyframeTimeMap=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const a=new b(null,this);return this._propertyTrackDataItems.push(a),a}GetFirstPropertyKeyframeDataItem(a){const b=a.GetPropertyKeyframeData();return b.GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(a){const b=a.GetPropertyKeyframeData(),c=b.GetPropertyKeyframeDataItemArray();return c[c.length-1]}GetPropertyKeyFrameDataItemAtTime(a,b){const c=this._propertyKeyframeTimeMap.get(b);if(!!c&&c.has(a))return c.get(a);const d=b.GetPropertyKeyframeData();for(const e of d.propertyKeyframeDataItems())if(e.GetTime()===a)return c||this._propertyKeyframeTimeMap.set(b,new Map),this._propertyKeyframeTimeMap.get(b).set(a,e),e}GetFirstPropertyKeyFrameDataItemHigherThan(a,b){const c=b.GetPropertyKeyframeData();for(const d of c.propertyKeyframeDataItems())if(d.GetTime()>a)return d}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,b){const c=b.GetPropertyKeyframeData();for(const d of c.propertyKeyframeDataItems())if(d.GetTime()>=a)return d}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,b){const c=b.GetPropertyKeyframeData();for(const d of c.propertyKeyframeDataItemsReverse())if(d.GetTime()<=a)return d}*propertyTrackDataItems(){for(const a of this._propertyTrackDataItems)yield a}_SaveToJson(){return{"propertyTrackDataItemsJson":this._propertyTrackDataItems.map((a)=>a._SaveToJson())}}_LoadFromJson(a){a&&C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,a["propertyTrackDataItemsJson"],b,this)}}}
// c3/timelines/data/keyframeData.js
"use strict";{class a{constructor(a,b){if(this._keyframeData=b,this._time=-1,this._ease="noease",this._enable=!1,this._tags=null,this._lowerTags=null,!!a){this._time=a[0],this._ease=a[1],this._enable=!!a[2];const b=a[3];this._tags=b?b.split(" "):[],this._lowerTags=new Set(this._tags.map((a)=>a.toLowerCase()))}}Release(){this._keyframeData=null,C3.clearArray(this._tags),this._tags=null,this._lowerTags.clear(),this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetTime(){return this._time}SetTime(a){this._time=a}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetTags(){return this._tags}SetTags(a){this._tags=a?a.split(" "):[],this._lowerTags=new Set(this._tags.map((a)=>a.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(a){return this._lowerTags.has(a.toLowerCase())}_SaveToJson(){return{"time":this._time,"ease":this._ease,"enable":this._enable,"tags":this._tags}}_LoadFromJson(a){a&&(this._time=a["time"],this._ease=a["ease"],this._enable=a["enable"],this._tags=a["tags"],this._lowerTags=new Set(this._tags.map((a)=>a.toLowerCase())))}}C3.KeyframeData=class{constructor(b,c){this._trackDataItem=c,this._keyframeDataItems=[],C3.TimelineDataManager._CreateDataItems(this._keyframeDataItems,b,a,this)}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();C3.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);return this._keyframeDataItems.push(b),b}DeleteKeyframeDataItems(a){for(const b of this._keyframeDataItems){if(!a(b))continue;const c=this._keyframeDataItems.indexOf(b);-1===c||(b.Release(),this._keyframeDataItems.splice(c,1))}this.SortKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((c,a)=>c.GetTime()-a.GetTime())}GetKeyframeDataItemIndex(a){return this._keyframeDataItems.indexOf(a)}GetKeyframeDataItemFromIndex(a){return this._keyframeDataItems[a]}*keyframeDataItems(){for(const a of this._keyframeDataItems)yield a}*keyframeDataItemsReverse(){for(let a=this._keyframeDataItems.length-1;0<=a;a--)yield this._keyframeDataItems[a]}_SaveToJson(){return{"keyframeDataItemsJson":this._keyframeDataItems.map((a)=>a._SaveToJson())}}_LoadFromJson(b){b&&C3.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,b["keyframeDataItemsJson"],a,this)}}}
// c3/timelines/data/propertyKeyframeData.js
"use strict";{const a=0;class b{constructor(b,c){this._propertyKeyframeData=c,this._value=null,this._aValue=null,this._type="",this._time=NaN,this._ease="noease",this._enable=!1,this._addonData=null;b&&(this._value=b[a][0],this._aValue=b[a][1],this._type=b[a][2],this._time=b[1],this._ease=b[2],this._enable=!!b[3],this._addonData=null,!!b[4]&&(this._addonData=new C3.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(a){"color"===this._type&&C3.IsFiniteNumber(a)?(this._value[0]=C3.GetRValue(a),this._value[1]=C3.GetGValue(a),this._value[2]=C3.GetBValue(a)):this._value=a}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(a){"color"===this._type&&C3.IsFiniteNumber(a)?(this._aValue[0]=C3.GetRValue(a),this._aValue[1]=C3.GetGValue(a),this._aValue[2]=C3.GetBValue(a)):this._aValue=a}GetValueWithResultMode(){const a=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if("relative"===a)return this.GetValue();return"absolute"===a?this.GetAbsoluteValue():void 0}GetType(){return this._type}SetType(a){this._type=a}GetTime(){return this._time}SetTime(a){this._time=a}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetAddOn(a){if(this.GetAddonData())for(const b of this.GetAddonData().addonDataItems())if(b.GetId()===a)return b}_SaveToJson(){const a=this._addonData;return{"addonDataJson":a?a._SaveToJson():a,"value":this._value,"aValue":this._aValue,"type":this._type,"time":this._time,"ease":this._ease,"enable":this._enable}}_LoadFromJson(a){a&&(a["addonDataJson"]&&this._addonData._SetFromJson(a["addonDataJson"]),this._value=a["value"],this._aValue=a["aValue"],this._type=a["type"],this._time=a["time"],this._ease=a["ease"],this._enable=a["enable"])}}C3.PropertyKeyframeData=class{constructor(a,c){this._propertyTrackDataItem=c,this._propertyKeyframeDataItems=[],C3.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,a,b,this)}Release(){this._propertyTrackDataItem=null;for(const a of this._propertyKeyframeDataItems)a.Release();C3.clearArray(this._propertyKeyframeDataItems),this._propertyKeyframeDataItems=null}AddEmptyPropertyKeyframeDataItem(){const a=new b(null,this);return this._propertyKeyframeDataItems.push(a),a}DeletePropertyKeyframeDataItems(a){for(const b of this._propertyKeyframeDataItems){if(!a(b))continue;const c=this._propertyKeyframeDataItems.indexOf(b);-1===c||(b.Release(),this._propertyKeyframeDataItems.splice(c,1))}this.SortPropertyKeyFrameDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((c,a)=>c.GetTime()-a.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){this._propertyKeyframeDataItems.length}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const a of this._propertyKeyframeDataItems)yield a}*propertyKeyframeDataItemsReverse(){for(let a=this._propertyKeyframeDataItems.length-1;0<=a;a--)yield this._propertyKeyframeDataItems[a]}_SaveToJson(){return{"propertyKeyframeDataItemsJson":this._propertyKeyframeDataItems.map((a)=>a._SaveToJson())}}_LoadFromJson(a){a&&C3.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a["propertyKeyframeDataItemsJson"],b,this)}}}
// c3/timelines/data/propertyKeyframeAddonData.js
"use strict";{class a{constructor(a,b){this._addonData=b,this._id=a[0],this._data=a[1]}Release(){this._addonData=null,this._data=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{"id":this._id,"data":this._data}}_LoadFromJson(a){a&&(this._id=a["id"],this._data=a["data"])}}class b extends a{constructor(a,b){super(a,b),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(a){a&&(super._LoadFromJson(a),this._startAnchor=a["startAnchor"],this._startEnable=!!a["startEnable"],this._endAnchor=a["endAnchor"],this._endEnable=!!a["endEnable"])}}C3.AddonData=class{constructor(a,c){this._propertyKeyframeDataItem=c,this._addonDataItems=[],C3.TimelineDataManager._CreateDataItems(this._addonDataItems,a,{prop:0,map:new Map([["cubic-bezier",b]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const a of this._addonDataItems)a.Release();C3.clearArray(this._addonDataItems),this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}*addonDataItems(){for(const a of this._addonDataItems)yield a}_SaveToJson(){return{"addonDataItemsJson":this._addonDataItems.map((a)=>a._SaveToJson())}}_LoadFromJson(a){a&&C3.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,a["addonDataItemsJson"],{prop:"id",map:new Map([["cubic-bezier",b]])},this)}}}
// c3/timelines/tweens/tween.js
"use strict";{let a=0;C3.Tween=class extends C3.TimelineState{constructor(b,c){super(`tween-${a++}`,b,c),this._id="",this._destroyInstanceOnComplete=!1,this._initialValueMode="start-value",this._on_completed_callbacks=null,this._on_started_callbacks=null}GetInstance(){const a=this.GetTracks();if(a&&a.length){const b=a[0];if(b){const a=b.GetInstance();return b.IsInstanceValid()?a:null}}}AddStartedCallback(a){this._on_started_callbacks||(this._on_started_callbacks=[]),this._on_started_callbacks.push(a)}AddCompletedCallback(a){this._on_completed_callbacks||(this._on_completed_callbacks=[]),this._on_completed_callbacks.push(a)}RemoveStartedCallback(a){if(this._on_started_callbacks){const b=this._on_started_callbacks.indexOf(a);-1!==b&&this._on_started_callbacks.splice(b,1)}}RemoveCompletedCallback(a){if(this._on_completed_callbacks){const b=this._on_completed_callbacks.indexOf(a);-1!==b&&this._on_completed_callbacks.splice(b,1)}}SetStartValue(a,b){for(const c of this._tracks)for(const d of c._propertyTracks){if(d.GetPropertyName()!==b)continue;const c=d.GetPropertyTrackData(),e=d.GetPropertyTrackDataItem(),f=c.GetFirstPropertyKeyframeDataItem(e);f.SetValue(a),f.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const b of this._tracks)for(const c of b._propertyTracks)if(c.GetPropertyName()===a)return c}BeforeSetEndValues(a,b){for(const c of b){const a=this._GetPropertyTrackState(c);this.SetStartValue(a.GetCurrentState(),c)}this.IsForwardPlayBack()?(this.SetTotalTime(this.GetTotalTime()-this.GetTime()),this._SetTime(0)):(this.SetTotalTime(this.GetTime()),this._SetTime(this.GetTotalTime())),this.SetInitialStateFromSetTime()}SetEndValue(a,b){const c=this._GetPropertyTrackState(b),d=c.GetPropertyTrackData(),e=c.GetPropertyTrackDataItem(),f=d.GetLastPropertyKeyframeDataItem(e);f.SetTime(this.GetTotalTime()),f.SetValue(a),f.SetAbsoluteValue(a)}SetId(a){this._id=a}GetId(){return this._id}SetInitialValueMode(a){this._initialValueMode=a}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(a){this._destroyInstanceOnComplete=a}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const a of this._on_started_callbacks)a(this);if(!this.IsComplete())for(const a of this._tracks)a.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(!this._finishedTriggers&&(this._finishedTriggers=!0,this._on_completed_callbacks))for(const a of this._on_completed_callbacks)a(this)}SetTime(a){this._DeleteIntermediateKeyframes(),super.SetTime(a)}SetInitialState(a){if(!this.InitialStateSet()&&this.GetInitialValueMode()==="current-state")for(const a of this._tracks)a.CompareInitialStateWithCurrent();super.SetInitialState(a)}Stop(a=!1){if(super.Stop(a),!this.IsComplete())for(const a of this._tracks)a.SaveState()}Reset(){this._DeleteIntermediateKeyframes(),super.Reset()}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const b=(a)=>{const b=a.GetTime(),c=this.GetTotalTime();return 0!==b&&b!==c};a.DeleteKeyframes(b),a.DeletePropertyKeyframes(b)}}MaybeTriggerKeyframeReachedConditions(){}Tick(){const a=this.GetInstance(),b=this.GetRuntime().GetDt(a);super.Tick(b,1)}_SaveToJson(){const a=super._SaveToJson(),b=this.GetTimelineDataItem();return Object.assign(a,{"tweenDataItemJson":b._SaveToJson(),"id":this._id,"destroyInstanceOnComplete":this._destroyInstanceOnComplete,"initialValueMode":this._initialValueMode})}_LoadFromJson(a){if(a){const b=this.GetTimelineDataItem();b._LoadFromJson(a["tweenDataItemJson"]),super._LoadFromJson(a),this._id=a["id"],this._destroyInstanceOnComplete=a["destroyInstanceOnComplete"],this._initialValueMode=a["initialValueMode"]}}static IsPlaying(a){return a.IsPlaying()}static Build(a){const b=a.runtime.GetTimelineManager(),c=new C3.TimelineDataItem;if(a.json){c._LoadFromJson(a.json["tweenDataItemJson"]);const d=new C3.Tween(c,b);return d._LoadFromJson(a.json),d}else{const d=new C3.Tween(c,b);C3.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]),d.SetId(a.id),d.SetTags(a.tags),d.SetInitialValueMode(a.initialValueMode),d.SetDestroyInstanceOnComplete(a.releaseOnComplete),d.SetTotalTime(a.time),d.SetStep(0),d.SetInterpolationMode("default"),d.SetResultMode(a.propertyTracksConfig[0].resultMode);const e=d.AddTrack();e.SetInstanceUID(a.instance.GetUID()),e.SetInterpolationMode("default"),e.SetResultMode(a.propertyTracksConfig[0].resultMode),e.SetEnable(!0),e.SetObjectClassIndex(a.instance.GetObjectClass().GetIndex());const f=e.AddKeyframe();f.SetTime(0),f.SetEase("noease"),f.SetEnable(!0),f.SetTags("");const g=e.AddKeyframe();g.SetTime(a.time),g.SetEase("noease"),g.SetEnable(!0),g.SetTags("");for(const b of a.propertyTracksConfig){const c=e.AddPropertyTrack();c.SetSourceAdapterId(b.sourceId),c.SetSourceAdapterArgs(b.sourceArgs),c.SetPropertyName(b.property),c.SetPropertyType(b.type),c.SetMin(NaN),c.SetMax(NaN),c.SetInterpolationMode("default"),c.SetResultMode(b.resultMode),c.SetEnable(!0);const d=c.AddPropertyKeyframe();d.SetType(b.valueType),d.SetTime(0),d.SetEase(b.ease),d.SetEnable(!0),d.SetValue(b.startValue),d.SetAbsoluteValue(b.startValue);const f=c.AddPropertyKeyframe();f.SetType(b.valueType),f.SetTime(a.time),f.SetEase(b.ease),f.SetEnable(!0),f.SetValue(b.endValue),f.SetAbsoluteValue(b.endValue)}return d}}}}
// c3/timelines/transitions/transition.js
"use strict";{C3.Transition=class extends C3.DefendedBase{constructor(a){super(),this._name=a[0],this._transitionKeyframes=[];for(const b of a[1]){const a=C3.TransitionKeyframe.Create(this,b);this._transitionKeyframes.push(a)}this._precalculatedSamples=new Map,this._transitionKeyframeCache=new Map,this._PreCalcSamples(),Ease.AddCustomEase(this._name,(a,b,c,d)=>this.Interpolate(a,b,c,d))}static Create(a){return C3.New(C3.Transition,a)}Release(){for(const a of this._transitionKeyframes)a.Release();C3.clearArray(this._transitionKeyframes),this._transitionKeyframes=null,this._precalculatedSamples.clear(),this._precalculatedSamples=null,this._transitionKeyframeCache.clear(),this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(a){const b=this._transitionKeyframeCache.get(a);if(b)return b;for(const b of this._transitionKeyframes)if(b.GetValueX()===a)return this._transitionKeyframeCache.set(a,b),b}GetFirstTransitionKeyFrameHigherThan(a){for(const b of this._transitionKeyframes)if(b.GetValueX()>a)return b}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const b of this._transitionKeyframes)if(b.GetValueX()>=a)return b}GetFirstTransitionKeyFrameLowerOrEqualThan(a){for(let b=this._transitionKeyframes.length-1;0<=b;b--){const c=this._transitionKeyframes[b];if(c.GetValueX()<=a)return c}}Interpolate(a,b,c,d){const e=a/d;let f=this.GetTransitionKeyFrameAt(e),g=null;f?g=this.GetFirstTransitionKeyFrameHigherThan(e):(f=this.GetFirstTransitionKeyFrameLowerOrEqualThan(e),g=this.GetFirstTransitionKeyFrameHigherOrEqualThan(e));const h=g.GetValueX()-f.GetValueX(),i=C3.mapToRange(e,f.GetValueX(),g.GetValueX(),0,h),j=f.GetValueX(),k=f.GetValueY(),l=f.GetValueX()+f.GetStartAnchorX(),m=f.GetValueY()+f.GetStartAnchorY(),n=g.GetValueX()+g.GetEndAnchorX(),o=g.GetValueY()+g.GetEndAnchorY(),p=g.GetValueX(),q=g.GetValueY();let r=Ease.GetEase("spline")(i,j,k,l,m,n,o,p,q,this._precalculatedSamples.get(f));return r+=f.GetValueY(),(1-r)*b+r*(b+c)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let a=0;a<this._transitionKeyframes.length-1;a++){const b=this._transitionKeyframes[a];if(!b.GetStartEnable())continue;const c=b,d=this._transitionKeyframes[a+1],e=c.GetValueX(),f=c.GetValueX()+c.GetStartAnchorX(),g=d.GetValueX()+d.GetEndAnchorX(),h=d.GetValueX();this._precalculatedSamples.set(c,Ease.GetBezierSamples(e,f,g,h))}}}}
// c3/timelines/transitions/transitionKeyframe.js
"use strict";{C3.TransitionKeyframe=class extends C3.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 C3.New(C3.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}}}
// c3/timelines/transitions/transitionManager.js
"use strict";C3.TransitionManager=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a,this._transitions=[]}Release(){for(const a of this._transitions)a.Release();C3.clearArray(this._transitions),this._transitions=null}Create(a){this._transitions.push(C3.Transition.Create(a))}};
// c3/events/stacks/solStack.js
"use strict";C3.SolStack=class extends C3.DefendedBase{constructor(a){super(),this._objectClass=a,this._stack=[],this._stack.push(C3.New(C3.Sol,this)),this._index=0,this._current=this._stack[0]}Release(){for(const a of this._stack)a.Release();C3.clearArray(this._stack),this._current=null,this._objectClass=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){const a=this._stack,b=++this._index;if(b===a.length){const b=C3.New(C3.Sol,this);a.push(b),this._current=b}else{const c=a[b];c.Reset(),this._current=c}}PushCopy(){const a=this._stack,b=++this._index;b===a.length&&a.push(C3.New(C3.Sol,this));const c=a[b];c.Copy(a[b-1]),this._current=c}Pop(){this._current=this._stack[--this._index]}RemoveInstances(a){const b=this._stack;for(let c=0,d=b.length;c<d;++c)b[c].RemoveInstances(a)}};
// c3/events/stacks/sol.js
"use strict";C3.Sol=class extends C3.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._stack=null,this._objectClass=null,this._eventStack=null}ClearArrays(){C3.clearArray(this._instances),C3.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,C3.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(a){a.IsSelectAll()?this.Reset():(this._selectAll=!1,C3.shallowAssignArray(this._instances,a._instances),C3.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,C3.clearArray(this._instances),this._instances.push(a)}SetArrayPicked(a){this._selectAll=!1,C3.shallowAssignArray(this._instances,a)}PickOne(a){if(a)if(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()){this.IsSelectAll()&&(C3.clearArray(this._instances),C3.shallowAssignArray(this._elseInstances,a.GetObjectClass().GetInstances()),this._selectAll=!1);const b=this._elseInstances.indexOf(a);-1!==b&&(this._instances.push(this._elseInstances[b]),this._elseInstances.splice(b,1))}else this.SetSinglePicked(a)}RemoveInstances(a){C3.arrayRemoveAllInSet(this._instances,a),C3.arrayRemoveAllInSet(this._elseInstances,a)}};
// c3/events/stacks/eventStack.js
"use strict";C3.EventStack=class extends C3.DefendedBase{constructor(a){super(),this._eventSheetManager=a,this._runtime=this._eventSheetManager.GetRuntime(),this._stack=[],this._stack.push(C3.New(C3.EventStackFrame,this,null)),this._index=0,this._expFuncStack=[]}Release(){for(const a of this._stack)a.Release();C3.clearArray(this._stack),C3.clearArray(this._expFuncStack),this._eventSheetManager=null,this._runtime=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}Push(a){const b=this._stack,c=++this._index;if(c===b.length){const c=C3.New(C3.EventStackFrame,this,a);return b.push(c),c}else{const d=b[c];return d.Reset(a),d}}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]}};
// c3/events/stacks/eventStackFrame.js
"use strict";C3.EventStackFrame=class extends C3.DefendedBase{constructor(a,b){super(),this._stack=a,this._runtime=this._stack.GetRuntime(),this._currentEvent=b,this._cndIndex=0,this._actIndex=0,this._lastEventTrue=!1,this._elseBranchRan=!1,this._expressionObjectClass=null,this._functionReturnType=0,this._functionReturnValue=0}Release(){this.Reset(null),this._stack=null,this._runtime=null}Reset(a){this._currentEvent=a,this._cndIndex=0,this._actIndex=0,this._lastEventTrue=!1,this._elseBranchRan=!1}_Restore(a,b){this._currentEvent=a,this._cndIndex=0,this._actIndex=b}ResetQuick(){this._cndIndex=0,this._actIndex=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()||!!(this._cndIndex<a.GetConditionCount()-1)&&!!a.GetSolModifiers().length}};
// c3/events/stacks/localVarStack.js
"use strict";C3.LocalVarStack=class extends C3.DefendedBase{constructor(a){super(),this._eventSheetManager=a,this._runtime=this._eventSheetManager.GetRuntime(),this._stack=[],this._index=-1,this._current=null,this._initialValues=[]}Release(){C3.clearArray(this._stack),this._eventSheetManager=null,this._runtime=null}_SetInitialValues(a){this._initialValues=a;const b=this._initialValues.slice(0);this._stack.push(b),this._index=0,this._current=b}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const a=++this._index,b=this._stack;a===b.length?b.push(this._initialValues.slice(0)):C3.shallowAssignArray(b[a],this._initialValues),this._current=b[a]}Pop(){this._current=this._stack[--this._index]}};
// c3/events/stacks/loopStack.js
"use strict";C3.LoopStack=class extends C3.DefendedBase{constructor(a){super(),this._eventSheetManager=a,this._runtime=this._eventSheetManager.GetRuntime(),this._stack=[],this._index=-1}Release(){C3.clearArray(this._stack),this._eventSheetManager=null,this._runtime=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}IsInLoop(){return 0<=this._index}GetCurrent(){return this._stack[this._index]}Push(){if(++this._index,this._index===this._stack.length){const a=C3.New(C3.Loop,this);return this._stack.push(a),a}else{const a=this._stack[this._index];return a.Reset(),a}}Pop(){--this._index}FindByName(a){const b=this._stack;for(let c=this._index;0<=c;--c){const d=b[c];if(d.GetName()===a)return d}return null}_GetStack(){return this._stack.slice(0,this._index+1)}};
// c3/events/stacks/loop.js
"use strict";C3.Loop=class extends C3.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}};
// c3/events/stacks/arrayStack.js
"use strict";C3.ArrayStack=class extends C3.DefendedBase{constructor(){super(),this._stack=[],this._index=-1}Release(){C3.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){if(++this._index,this._index===this._stack.length){const a=[];return this._stack.push(a),a}return this._stack[this._index]}Pop(){--this._index}};
// c3/events/eventSheetManager.js
"use strict";{function a(c,a){return c.GetIndex()-a.GetIndex()}function b(c,a){for(let b=0,d=c.length;b<d;++b)if(c[b]!==a[b])return!1;return!0}C3.EventSheetManager=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a,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=C3.New(C3.EventStack,this),this._localVarStack=C3.New(C3.LocalVarStack,this),this._loopStack=C3.New(C3.LoopStack,this),this._triggersToPostInit=[],this._queuedTriggers=[],this._queuedDebugTriggers=[],this._runningEventsDepth=0,this._executingTriggerDepth=0,this._blockFlushingDepth=0,this._scheduledWaits=[],this._asyncActionPromises=[],self["c3_callFunction"]=(a,b)=>this._InvokeFunctionFromJS(a,b)}Release(){this.ClearAllScheduledWaits(),this._eventStack.Release(),this._eventStack=null,this._localVarStack.Release(),this._localVarStack=null,C3.clearArray(this._queuedTriggers),C3.clearArray(this._queuedDebugTriggers),this._runtime=null,C3.clearArray(this._allSheets),this._sheetsByName.clear()}Create(a){const b=C3.New(C3.EventSheet,this,a);this._allSheets.push(b),this._sheetsByName.set(b.GetName().toLowerCase(),b)}_AddTriggerToPostInit(a){this._triggersToPostInit.push(a)}_PostInit(){for(const a of this._functionBlocksByName.values())a._PostInit(!1);for(const a of this._allSheets)a._PostInit();for(const a of this._allSheets)a._UpdateDeepIncludes();for(const a of this._triggersToPostInit)a._PostInit(!1);C3.clearArray(this._triggersToPostInit),this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(a){return this._sheetsByName.get(a.toLowerCase())||null}_RegisterGroup(a){this._allGroups.push(a),this._groupsByName.set(a.GetGroupName(),a)}_RegisterEventBlock(a){this._blocksBySid.set(a.GetSID(),a)}_RegisterCondition(a){this._cndsBySid.set(a.GetSID(),a)}_RegisterAction(a){this._actsBySid.set(a.GetSID(),a)}_RegisterFunctionBlock(a){this._functionBlocksByName.set(a.GetFunctionName().toLowerCase(),a)}_RegisterEventVariable(a){this._eventVarsBySid.set(a.GetSID(),a),a.IsGlobal()?this._allGlobalVars.push(a):this._allLocalVars.push(a)}_DeduplicateSolModifierList(c){2<=c.length&&c.sort(a);let d=this._allUniqueSolModifiers.get(c.length);d||(d=[],this._allUniqueSolModifiers.set(c.length,d));for(let a=0,e=d.length;a<e;++a){const e=d[a];if(b(c,e))return e}return d.push(c),c}_GetNextLocalVarIndex(a){return this._localVarInitialValues.push(a.GetInitialValue()),this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const a=this.GetCurrentEventStackFrame(),b=a.GetCurrentEvent();return b.GetConditionAt(a.GetConditionIndex())}GetCurrentAction(){const a=this.GetCurrentEventStackFrame(),b=a.GetCurrentEvent();return b.GetActionAt(a.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetEventVariableByName(a,b){for(b=b.GetScopeParent();b;){const c=b._GetEventVariableNameInScope(a);if(c)return c;b=b.GetScopeParent()}for(const c of this._allGlobalVars)if(C3.equalsNoCase(a,c.GetName()))return c;return null}GetAllLocalVariablesInScope(a){const b=[];for(a=a.GetScopeParent();a;)C3.appendArray(b,a._GetAllLocalVariablesInScope()),a=a.GetScopeParent();return b}_GetLocalVariablesScriptInterface(a){const b={};for(const c of this.GetAllLocalVariablesInScope(a))b[c.GetJsPropName()]=c._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,b)}GetEventVariableBySID(a){return this._eventVarsBySid.get(a)||null}GetEventBlockBySID(a){return this._blocksBySid.get(a)||null}GetConditionBySID(a){return this._cndsBySid.get(a)||null}GetActionBySID(a){return this._actsBySid.get(a)||null}GetFunctionBlockByName(a){return this._functionBlocksByName.get(a.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const a of this._allGlobalVars)a.ResetToInitialValue()}GetEventGroupByName(a){return this._groupsByName.get(a.toLowerCase())||null}GetEventGroupBySID(a){const b=this._blocksBySid.get(a);return b&&b.IsGroup()?b:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const a of this._allGroups)a.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const a of this._allSheets)a._ResetHasRunFlag()}RunEvents(a){this._ResetAllHasRunFlags(),this._runningEventsDepth++;for(const b of a.runningLayouts()){const a=b.GetEventSheet();a&&(this._runtime.PushCurrentLayout(b),a.Run(),this._runtime.PopCurrentLayout())}this._runningEventsDepth--}async DebugRunEvents(a){this._ResetAllHasRunFlags(),this._runningEventsDepth++;for(const b of this._DebugRunEventsGen(a))await this._runtime.DebugBreak(b);this._runningEventsDepth--}*_DebugRunEventsGen(a){for(const b of a.runningLayouts()){const a=b.GetEventSheet();a&&(this._runtime.PushCurrentLayout(b),yield*a.DebugRun(),this._runtime.PopCurrentLayout())}}_Trigger(a,b,c,d){let e=!1;if(!a.GetMainRunningLayout())return this.QueueTrigger(b,c,d);this._executingTriggerDepth++;for(const f of a.runningLayouts()){const a=f.GetEventSheet();if(!a)continue;this._runtime.PushCurrentLayout(f);for(const f of a.deepIncludes()){const a=f._Trigger(b,c,d);e=e||a}const g=a._Trigger(b,c,d);e=e||g,this._runtime.PopCurrentLayout()}return this._executingTriggerDepth--,e}*_DebugTrigger(a,b,c,d){let e=!1;if(!a.GetMainRunningLayout())return this.QueueTrigger(b,c,d);this._executingTriggerDepth++;for(const f of a.runningLayouts()){const a=f.GetEventSheet();if(!a)continue;this._runtime.PushCurrentLayout(f);for(const f of a.deepIncludes()){const a=yield*f._DebugTrigger(b,c,d);e=e||a}const g=yield*a._DebugTrigger(b,c,d);e=e||g,this._runtime.PopCurrentLayout()}return this._executingTriggerDepth--,e}QueueTrigger(a,b,c){return this._queuedTriggers.push([a,b,c]),!1}QueueDebugTrigger(a,b,c){let d=null;const e=new Promise((a)=>d=a);return this._queuedDebugTriggers.push([a,b,c,d]),e}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw new Error("should not be in breakpoint");for(const a=this._runtime.GetLayoutManager();this._queuedDebugTriggers.length;){const[b,c,d,e]=this._queuedDebugTriggers.shift(),f=yield*this._DebugTrigger(a,b,c,d);e(f)}}async RunQueuedDebugTriggersAsync(){for(const a of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(a)}_FastTrigger(a,b,c,d){let e=!1;const f=a.GetMainRunningLayout(),g=f.GetEventSheet();if(g){this._executingTriggerDepth++,this._runtime.PushCurrentLayout(f);const a=g.deepIncludes();for(let f=0,g=a.length;f<g;++f){const g=a[f]._FastTrigger(b,c,d);e=e||g}const h=g._FastTrigger(b,c,d);return e=e||h,this._runtime.PopCurrentLayout(),this._executingTriggerDepth--,e}}*_DebugFastTrigger(a,b,c,d){let e=!1;const f=a.GetMainRunningLayout(),g=f.GetEventSheet();if(g){this._executingTriggerDepth++,this._runtime.PushCurrentLayout(f);const a=g.deepIncludes();for(let f=0,g=a.length;f<g;++f){const g=yield*a[f]._DebugFastTrigger(b,c,d);e=e||g}const h=yield*g._DebugFastTrigger(b,c,d);return e=e||h,this._runtime.PopCurrentLayout(),this._executingTriggerDepth--,e}}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(a){for(const[b,c,d]of this._queuedTriggers)this._Trigger(a,b,c,d);C3.clearArray(this._queuedTriggers)}BlockFlushingInstances(a){a?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(a){for(let b=0,c=a.length;b<c;++b)a[b].GetSolStack().Clear()}PushCleanSol(a){for(let b=0,c=a.length;b<c;++b)a[b].GetSolStack().PushClean()}PushCopySol(a){for(let b=0,c=a.length;b<c;++b)a[b].GetSolStack().PushCopy()}PopSol(a){for(let b=0,c=a.length;b<c;++b)a[b].GetSolStack().Pop()}AddScheduledWait(){const a=C3.New(C3.ScheduledWait,this);return this._scheduledWaits.push(a),a}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(!this._scheduledWaits.length)return;const a=this.GetCurrentEventStackFrame();let b=!1;this._runningEventsDepth++;for(let c=0,d=this._scheduledWaits.length;c<d;++c){const d=this._scheduledWaits[c];d._ShouldRun()&&d._Run(a),d.ShouldRelease()&&(b=!0)}b&&this._FilterScheduledWaitsToRelease(),this._runningEventsDepth--}async DebugRunScheduledWaits(){if(!this._scheduledWaits.length)return;const a=this.GetCurrentEventStackFrame();let b=!1;this._runningEventsDepth++;for(let c=0,d=this._scheduledWaits.length;c<d;++c){const d=this._scheduledWaits[c];d._ShouldRun()&&(await d._DebugRun(a)),d.ShouldRelease()&&(b=!0)}b&&this._FilterScheduledWaitsToRelease(),this._runningEventsDepth--}_FilterScheduledWaitsToRelease(){const a=C3.arrayFilterOut(this._scheduledWaits,(a)=>a.ShouldRelease());for(const b of a)b.Release()}ClearAllScheduledWaits(){for(const a of this._scheduledWaits)a.Release();C3.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(a){for(const b of this._scheduledWaits)b.RemoveInstances(a)}AddAsyncActionPromise(a){this._asyncActionPromises.push(a)}ClearAsyncActionPromises(){C3.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const a=Promise.all(this._asyncActionPromises);return this._asyncActionPromises=[],a}_SaveToJson(){return{"groups":this._SaveGroupsToJson(),"cnds":this._SaveCndsToJson(),"acts":this._SaveActsToJson(),"vars":this._SaveVarsToJson(),"waits":this._SaveScheduledWaitsToJson()}}_LoadFromJson(a){this._LoadGroupsFromJson(a["groups"]),this._LoadCndsFromJson(a["cnds"]),this._LoadActsFromJson(a["acts"]),this._LoadVarsFromJson(a["vars"]),this._LoadScheduledWaitsFromJson(a["waits"])}_SaveGroupsToJson(){const a={};for(const b of this.GetAllGroups())a[b.GetSID().toString()]=b.IsGroupActive();return a}_LoadGroupsFromJson(a){for(const[b,c]of Object.entries(a)){const a=parseInt(b,10),d=this.GetEventGroupBySID(a);d&&d.SetGroupActive(c)}}_SaveCndsToJson(){const a={};for(const[b,c]of this._cndsBySid){const d=c._SaveToJson();d&&(a[b.toString()]=d)}return a}_LoadCndsFromJson(a){for(const[b,c]of Object.entries(a)){const a=parseInt(b,10),d=this.GetConditionBySID(a);d&&d._LoadFromJson(c)}}_SaveActsToJson(){const a={};for(const[b,c]of this._actsBySid){const d=c._SaveToJson();d&&(a[b.toString()]=d)}return a}_LoadActsFromJson(a){for(const[b,c]of Object.entries(a)){const a=parseInt(b,10),d=this.GetActionBySID(a);d&&d._LoadFromJson(c)}}_SaveVarsToJson(){const a={};for(const[b,c]of this._eventVarsBySid)!c.IsConstant()&&(c.IsGlobal()||c.IsStatic())&&(a[b.toString()]=c.GetValue());return a}_LoadVarsFromJson(a){for(const[b,c]of Object.entries(a)){const a=parseInt(b,10),d=this.GetEventVariableBySID(a);d&&d.SetValue(c)}}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter((a)=>!a.IsPromise()).map((a)=>a._SaveToJson())}_LoadScheduledWaitsFromJson(a){this.ClearAllScheduledWaits();for(const b of a){const a=C3.ScheduledWait._CreateFromJson(this,b);a&&this._scheduledWaits.push(a)}}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map((a)=>a.GetEventSheet()).filter((a)=>a).map((a)=>a._GetPerfRecord())}FindFirstFunctionBlockParent(a){for(;a;){const b=a.GetScopeParent();if(b instanceof C3.FunctionBlock)return b;a=a.GetParent()}return null}_InvokeFunctionFromJS(a,b){Array.isArray(b)||(b=[]);const c=this.GetFunctionBlockByName(a.toLowerCase());if(!c)return null;if(!c.IsEnabled())return c.GetDefaultReturnValue();const d=c.GetFunctionParameters();if(b.length<d.length){b=b.slice(0);do b.push(d[b.length].GetInitialValue());while(b.length<d.length)}const e=c.GetEventBlock();return e.RunAsExpressionFunctionCall(e.GetSolModifiersIncludingParents(),c.GetReturnType(),c.GetDefaultReturnValue(),...b)}}}
// c3/events/eventSheet.js
"use strict";C3.EventSheet=class extends C3.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 c of b[1])this._CreateEvent(c,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0,children:[]}:null}Release(){this._eventSheetManager=null,this._runtime=null}_CreateEvent(a,b,c){switch(a[0]){case 0:case 3:this._CreateEventBlock(a,b,c);break;case 1:this._CreateEventVariable(a,b,c);break;case 2:this._CreateInclude(a,b,c);break;case 4:this._CreateFunctionBlock(a,b);break;case 5:this._CreateScriptBlock(a,b,c);break;default:throw new Error("invalid event type");}}_CreateEventBlock(a,b,c){const d=C3.EventBlock.Create(this,b,a);if(d.IsOrBlock()){c.push(d);const a=d.GetConditions();for(let b=0,c=a.length;b<c;++b)a[b].IsTrigger()&&this._InitTrigger(d,b)}else d.IsTrigger()?this._InitTrigger(d,0):c.push(d)}_CreateFunctionBlock(a,b){const c=C3.FunctionBlock.Create(this,b,a);this._eventSheetManager._RegisterFunctionBlock(c)}_CreateEventVariable(a,b,c){const d=C3.EventVariable.Create(this,b,a);c.push(d)}_CreateInclude(a,b,c){const d=C3.EventInclude.Create(this,b,a);c.push(d)}_CreateScriptBlock(a,b,c){const d=C3.EventScript.Create(this,b,a);c.push(d)}_InitTrigger(a,b){a.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(a);const c=a.GetConditionAt(b),d=c._GetFunc(),e=c.GetObjectClass();if(c.IsFastTrigger()){let f=this._fastTriggers.get(e);f||(f=new Map,this._fastTriggers.set(e,f));const g=c.GetFastTriggerValue().toLowerCase();let h=f.get(d);h||(h=new Map,f.set(d,h));let i=h.get(g);i||(i=[],h.set(g,i)),i.push([a,b])}else{let f=this._triggers.get(e);f||(f={methodMap:new Map,behaviors:new Map},this._triggers.set(e,f));const g=c.GetBehaviorType();let h;g?(h=f.behaviors.get(g),!h&&(h=new Map,f.behaviors.set(g,h))):h=f.methodMap;let i=h.get(d);i||(i=[],h.set(d,i)),i.push([a,b])}}_PostInit(){const a=this._events;for(let b=0,c=a.length;b<c;++b){const d=b<c-1&&a[b+1]instanceof C3.EventBlock&&a[b+1].IsElseBlock();a[b]._PostInit(d)}}_AddShallowInclude(a){this._shallowIncludes.push(a)}_UpdateDeepIncludes(){C3.clearArray(this._deepIncludes),this._AddDeepIncludes(this),this._alreadyIncludedSheets.clear()}_AddDeepIncludes(a){const b=a._deepIncludes,c=a._alreadyIncludedSheets;for(const d of this._shallowIncludes){const e=d.GetIncludeSheet();!d.IsActive()||a===e||c.has(e)||(c.add(e),e._AddDeepIncludes(a),b.push(e))}}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){const a=this._runtime,b=a.IsCPUProfiling(),c=b?performance.now():0;this._hasRun=!0;const d=this.GetEventSheetManager(),f=d.GetCurrentEventStackFrame();for(const b of this._events)b.Run(f),d.ClearSol(b.GetSolModifiers()),d.ClearAsyncActionPromises(),a.FlushPendingInstances();f.Reset(null),b&&(this._perfRecord.totalTimeCounter+=performance.now()-c)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;const a=this._runtime,b=this.GetEventSheetManager(),c=b.GetCurrentEventStackFrame();for(const d of this._events)yield*d.DebugRun(c),b.ClearSol(d.GetSolModifiers()),b.ClearAsyncActionPromises(),a.FlushPendingInstances();c.Reset(null)}}_Trigger(a,b,c){if(b){const d=b.GetObjectClass();let e=!1,f=this._TriggerForClass(a,b,d,c);e=e||f;for(const g of d.GetFamilies())f=this._TriggerForClass(a,b,g,c),e=e||f}else return this._TriggerForClass(a,b,null,null)}_TriggerForClass(a,b,c,d){const e=this._triggers.get(c);if(!e)return!1;const f=d?e.behaviors.get(d):e.methodMap;if(!f)return!1;const g=f.get(a);if(!g)return!1;let h=!1;for(const[e,f]of g){const a=this._ExecuteTrigger(b,e,f);h=h||a}return h}*_DebugTrigger(a,b,c){if(b){const d=b.GetObjectClass();let e=!1,f=yield*this._DebugTriggerForClass(a,b,d,c);e=e||f;for(const g of d.GetFamilies())f=yield*this._DebugTriggerForClass(a,b,g,c),e=e||f}else return yield*this._DebugTriggerForClass(a,b,null,null)}*_DebugTriggerForClass(a,b,c,d){const e=this._triggers.get(c);if(!e)return!1;const f=d?e.behaviors.get(d):e.methodMap;if(!f)return!1;const g=f.get(a);if(!g)return!1;let h=!1;for(const[e,f]of g){let a;a=e.DebugCanRunFast()?this._ExecuteTrigger(b,e,f):yield*this._DebugExecuteTrigger(b,e,f),h=h||a}return h}_FastTrigger(a,b,c){const d=b.GetObjectClass(),e=this._fastTriggers.get(d);if(!e)return!1;const f=e.get(a);if(!f)return!1;const g=f.get(c);if(!g)return!1;let h=!1;for(let d=0,e=g.length;d<e;++d){const a=g[d],b=this._ExecuteTrigger(null,a[0],a[1]);h=h||b}return h}*_DebugFastTrigger(a,b,c){const d=b.GetObjectClass(),e=this._fastTriggers.get(d);if(!e)return!1;const f=e.get(a);if(!f)return!1;const g=f.get(c);if(!g)return!1;let h=!1;for(let d=0,e=g.length;d<e;++d){const a=g[d],b=a[0],c=a[1];let e;e=b.DebugCanRunFast()?this._ExecuteTrigger(null,b,c):yield*this._DebugExecuteTrigger(null,b,c),h=h||e}return h}_ExecuteTrigger(a,b,c){const d=this._runtime,e=this._eventSheetManager,f=e.GetCurrentEvent(),g=e.GetEventStack(),h=e.GetTriggerDepth();let i=!1;f&&e.PushCleanSol(f.GetSolModifiersIncludingParents()),e.PushCleanSol(b.GetSolModifiersIncludingParents());const j=1<h;j&&e.GetLocalVarStack().Push();const k=g.Push(b);if(a){const d=b.GetConditions()[c].GetObjectClass(),e=d.GetCurrentSol();e.SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked()}let l=!0;if(b.GetParent()){const a=b.GetTriggerParents();for(let b=0,c=a.length;b<c;++b)if(!a[b].RunPreTrigger(k)){l=!1;break}}return l&&(d.IncrementExecCount(),b.IsOrBlock()?b.RunOrBlockTrigger(k,c):b.Run(k),i=k.GetLastEventTrue()),g.Pop(),j&&e.GetLocalVarStack().Pop(),e.PopSol(b.GetSolModifiersIncludingParents()),f&&e.PopSol(f.GetSolModifiersIncludingParents()),f||1!==h||e.IsFlushingBlocked()||d.FlushPendingInstances(),i}*_DebugExecuteTrigger(a,b,c){const d=this._runtime,e=this._eventSheetManager,f=e.GetCurrentEvent(),g=e.GetEventStack(),h=e.GetTriggerDepth();let i=!1;f&&e.PushCleanSol(f.GetSolModifiersIncludingParents()),e.PushCleanSol(b.GetSolModifiersIncludingParents());const j=1<h;j&&e.GetLocalVarStack().Push();const k=g.Push(b);if(a){const d=b.GetConditions()[c].GetObjectClass(),e=d.GetCurrentSol();e.SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked()}let l=!0;if(b.GetParent()){const a=b.GetTriggerParents();for(let b=0,c=a.length;b<c;++b)if(!(yield*a[b].DebugRunPreTrigger(k))){l=!1;break}}return l&&(d.IncrementExecCount(),b.IsOrBlock()?yield*b.DebugRunOrBlockTrigger(k,c):yield*b.DebugRun(k),i=k.GetLastEventTrue()),g.Pop(),j&&e.GetLocalVarStack().Pop(),e.PopSol(b.GetSolModifiersIncludingParents()),f&&e.PopSol(f.GetSolModifiersIncludingParents()),f||1!==h||e.IsFlushingBlocked()||d.FlushPendingInstances(),i}_GetPerfRecord(){return this._perfRecord}};
// c3/events/eventBlock.js
"use strict";{function a(){return!0}function*b(){return!0}const c=[];C3.EventBlock=class extends C3.DefendedBase{constructor(d,e,f){super(),this._eventSheet=d,this._runtime=d.GetRuntime(),this._parent=e,this._scopeParent=null,this._eventStack=this._runtime.GetEventSheetManager().GetEventStack(),this._solModifiers=[],this._solModifiersIncludingParents=[],this._hasGotSolModifiersIncludingParents=!1,this._isSolWriterAfterCnds=!1,this._isTopLevelGroup=!1,this._hasElseBlock=!1,this._isOrBlock=!!f[2],this._isElseBlock=!1,this._triggerParents=null,this._conditions=[],this._actions=[],this._subEvents=[],this._RunActions=a,this._DebugRunActions=b,this._isGroup=!1,this._isInitiallyActive=!1,this._groupName="",this._isGroupActive=!1,this._containedIncludes=null,this._perfRecord=null,this._sid=f[4],this._displayNumber=f[5],this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber),this._debugData=this._runtime.IsDebug()?{isBreakpoint:f[3][0],isBreakable:f[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null,this.GetEventSheetManager()._RegisterEventBlock(this),3===f[0]&&this._InitGroup(f[1]);let g=0;for(const a of f[6]){const b=C3.Condition.Create(this,a,g++);this._conditions.push(b),this._AddSolModifier(b.GetObjectClass())}g=0;for(const a of f[7]){const b=C3.Action.Create(this,a,g++);this._actions.push(b)}if(9===f.length){const a=f[8];for(const b of a)this._eventSheet._CreateEvent(b,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&&this._conditions[0]._GetFunc()===C3.Plugins.System.Cnds.Else),0===this._conditions.length&&(this._conditions=c),0===this._actions.length&&(this._actions=c),0===this._subEvents.length&&(this._subEvents=c)}static Create(a,b,c){return C3.New(C3.EventBlock,a,b,c)}_InitGroup(a){this._isGroup=!0,this._isInitiallyActive=!!a[0],this._isGroupActive=this._isInitiallyActive,this._groupName=a[1].toLowerCase(),this._containedIncludes=[],this.GetEventSheetManager()._RegisterGroup(this),this._runtime.IsDebug()&&(this._perfRecord={type:"group",name:a[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(a){this._containedIncludes.push(a)}_AddContainerSolModifierToList(a,b){for(const c of a.GetContainer().objectTypes())b.includes(c)||b.push(c)}_AddSolModifierToList(a,b){if(a)if(b.includes(a)||b.push(a),a.IsFamily())for(const c of a.GetFamilyMembers())c.IsInContainer()&&this._AddContainerSolModifierToList(c,b);else a.IsInContainer()&&this._AddContainerSolModifierToList(a,b)}_AddSolModifier(a){this._AddSolModifierToList(a,this._solModifiers)}_AddParentSolModifier(a){this._AddSolModifierToList(a,this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(a){this._hasElseBlock=!!a,this._IdentifyTopLevelGroup(),this._IdentifyTriggerParents();for(const b of this._conditions)b._PostInit();if(0<this._actions.length){let b=!1;for(const c of this._actions)c._PostInit(),c.HasReturnType()&&(b=!0);b?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions=this._DebugRunActions_Fast)}const b=this._subEvents;for(let c=0,d=b.length;c<d;++c){const a=c<d-1&&b[c+1]instanceof C3.EventBlock&&b[c+1].IsElseBlock();b[c]._PostInit(a)}this._debugData&&this._UpdateCanRunFast(),this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){for(let a=this.GetParent();a;){if(a.IsGroup())return a;a=a.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const a=this._debugData;a.canRunAllConditionsFast=this._conditions.every((a)=>a.DebugCanRunFast()),a.canRunAllActionsFast=this._actions.every((b)=>b.DebugCanRunFast()),a.canRunAllSubEventsFast=this._subEvents.every((a)=>a.DebugCanRunFast()),a.canRunSelfFast=a.canRunAllConditionsFast&&a.canRunAllActionsFast&&a.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let a=this;do a._UpdateCanRunFast(),a=a.GetParent();while(a)}_IdentifyTopLevelGroup(){if(!this.IsGroup())return;let a=this.GetParent();for(this._isTopLevelGroup=!0;a;){if(!a.IsGroup()){this._isTopLevelGroup=!1;break}a=a.GetParent()}}_IdentifySolModifiersIncludingParents(){const a=this._runtime.GetAllObjectClasses();if(this._solModifiers===a)this._solModifiersIncludingParents=a;else{this._solModifiersIncludingParents=C3.cloneArray(this._solModifiers);for(let a=this.GetParent();a;){for(const b of a._solModifiers)this._AddParentSolModifier(b);a=a.GetParent()}const a=this.GetEventSheetManager();this._solModifiers=a._DeduplicateSolModifierList(this._solModifiers),this._solModifiersIncludingParents=a._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=[];for(let a=this.GetParent();a;)this._triggerParents.push(a),a=a.GetParent();this._triggerParents.reverse()}}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds=!0,this._parent&&this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){return this._hasGotSolModifiersIncludingParents||(this._hasGotSolModifiersIncludingParents=!0,this._IdentifySolModifiersIncludingParents()),this._solModifiersIncludingParents}HasSolModifier(a){return this._solModifiers.includes(a)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(a){this._scopeParent=a}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(a){this._debugData.isBreakpoint=!!a,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(b){if(b=!!b,!this._isGroup)throw new Error("not a group");if(this._isGroupActive!==b){this._isGroupActive=b;for(const a of this._containedIncludes)a.UpdateActive();if(this._containedIncludes.length){const a=this._runtime.GetCurrentLayout(),b=a.GetEventSheet();b&&b._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 C3.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||this._conditions.some((a)=>a.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(a){if(a=Math.floor(a),0>a||a>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[a]}GetConditionByDebugIndex(a){return this.GetConditionAt(a)}IsFirstConditionOfType(a){let b=a.GetIndex();if(0===b)return!0;for(--b;0<=b;--b)if(this._conditions[b].GetObjectClass()===a.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(a){if(a=Math.floor(a),0>a||a>=this._actions.length)throw new RangeError("invalid action index");return this._actions[a]}GetActionByDebugIndex(b){b=Math.floor(b);const a=this._actions.find((c)=>c.GetDebugIndex()===b);if(!a)throw new RangeError("invalid action debug index");return a}_HasActionIndex(a){return a=Math.floor(a),0<=a&&a<this._actions.length}GetSubEvents(){return this._subEvents}_GetEventVariableNameInScope(a){for(const b of this._subEvents)if(b instanceof C3.EventVariable&&C3.equalsNoCase(a,b.GetName()))return b;return null}_GetAllLocalVariablesInScope(){return this._subEvents.filter((a)=>a instanceof C3.EventVariable)}RunPreTrigger(a){a.SetCurrentEvent(this);let b=!1;const d=this._conditions;for(let e=0,c=d.length;e<c;++e){const f=d[e];if(a.SetConditionIndex(e),f.IsLooping())throw new Error("trigger cannot be used as sub-event to a loop");if(f.Run())b=!0;else if(!this._isOrBlock)return!1}return!this._isOrBlock||b}RunOrBlockTrigger(a,b){a.SetCurrentEvent(this),this._conditions[b].Run()&&(this._RunActions(a,0)&&this._RunSubEvents(a),a.SetLastEventTrue(!0))}*DebugRunPreTrigger(a){a.SetCurrentEvent(this);let b=!1;const d=this._conditions;for(let e=0,c=d.length;e<c;++e){const f=d[e];if(a.SetConditionIndex(e),f.IsLooping())throw new Error("trigger cannot be used as sub-event to a loop");let c;if(c=f.DebugCanRunFast()?f.Run():yield*f.DebugRun(),c)b=!0;else if(!this._isOrBlock)return!1}return!this._isOrBlock||b}*DebugRunOrBlockTrigger(a,b){a.SetCurrentEvent(this);const d=this._conditions[b];let c;if(c=d.DebugCanRunFast()?d.Run():yield*d.DebugRun(),c){let b;b=this.DebugCanRunActionsFast()?this._RunActions(a,0):yield*this._DebugRunActions(a,0),b&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),a.SetLastEventTrue(!0)}}Run(a){a.SetCurrentEvent(this),this._isElseBlock||a.SetElseBranchRan(!1),this._isOrBlock?this._RunOrBlock(a):this._RunAndBlock(a)}*DebugRun(a){(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),a.SetCurrentEvent(this),this._isElseBlock||a.SetElseBranchRan(!1),this._isOrBlock?yield*this._DebugRunOrBlock(a):yield*this._DebugRunAndBlock(a)}_RunOrBlock(a){const b=this._conditions;let d=0===b.length;for(let e=0,c=b.length;e<c;++e){const f=b[e];if(f.IsTrigger())continue;a.SetConditionIndex(e);const c=f.Run();d=d||c}a.SetLastEventTrue(d),d&&(this._RunActions(a,0)&&this._RunSubEvents(a),this._hasElseBlock&&a.SetElseBranchRan(!0))}*_DebugRunOrBlock(a){const b=this._conditions;let d=0===b.length;for(let e=0,c=b.length;e<c;++e){const f=b[e];if(f.IsTrigger())continue;a.SetConditionIndex(e);let c;c=f.DebugCanRunFast()?f.Run():yield*f.DebugRun(),d=d||c}if(a.SetLastEventTrue(d),d){let b;b=this.DebugCanRunActionsFast()?this._RunActions(a,0):yield*this._DebugRunActions(a,0),b&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&a.SetElseBranchRan(!0)}}_RunAndBlock(a){const b=this._conditions;for(let d=0,c=b.length;d<c;++d){const e=b[d];a.SetConditionIndex(d);const c=e.Run();if(!c)return void a.SetLastEventTrue(!1)}a.SetLastEventTrue(!0),this._RunActions(a,0)&&this._RunSubEvents(a),a.GetLastEventTrue()&&this._hasElseBlock&&a.SetElseBranchRan(!0)}*_DebugRunAndBlock(a){const b=this._conditions;for(let d=0,c=b.length;d<c;++d){const e=b[d];a.SetConditionIndex(d);let c;if(c=e.DebugCanRunFast()?e.Run():yield*e.DebugRun(),!c)return void a.SetLastEventTrue(!1)}a.SetLastEventTrue(!0);let c;c=this.DebugCanRunActionsFast()?this._RunActions(a,0):yield*this._DebugRunActions(a,0),c&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),a.GetLastEventTrue()&&this._hasElseBlock&&a.SetElseBranchRan(!0)}_RunActions_Fast(b,a){const c=this._actions;for(let d=a,e=c.length;d<e;++d){const e=c[d];b.SetActionIndex(d),e.Run()}return!0}*_DebugRunActions_Fast(b,a){const c=this._actions;for(let d=a,e=c.length;d<e;++d){const e=c[d];b.SetActionIndex(d),e.DebugCanRunFast()?e.Run():yield*e.DebugRun()}return!0}_RunActions_ReturnValue(b,a){const c=this.GetEventSheetManager(),d=this._actions;for(let e=a,f=d.length;e<f;++e){const f=d[e];b.SetActionIndex(e);const a=f.Run();if(f.CanBailOut()&&!0===a)return!1;f.IsAsync()&&a instanceof Promise&&c.AddAsyncActionPromise(a)}return!0}*_DebugRunActions_ReturnValue(b,a){const c=this.GetEventSheetManager(),d=this._actions;for(let e=a,f=d.length;e<f;++e){const f=d[e];b.SetActionIndex(e);let a;if(a=f.DebugCanRunFast()?f.Run():yield*f.DebugRun(),f.CanBailOut()&&!0===a)return!1;f.IsAsync()&&a instanceof Promise&&c.AddAsyncActionPromise(a)}return!0}_ResumeActionsAndSubEvents(a){this._RunActions(a,a.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(a){(yield*this._DebugRunActions(a,a.GetActionIndex()))&&(yield*this._DebugRunSubEvents())}_RunSubEvents(){if(this._subEvents.length){const a=this.IsGroup()&&this._runtime.IsCPUProfiling(),b=a?performance.now():0,c=this._eventStack,d=c.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(d):this._RunSubEvents_Fast(d),c.Pop(),a&&(this._perfRecord.totalTimeCounter+=performance.now()-b)}}_RunSubEvents_SolWriterAfterCnds(a){const b=this._isGroup,c=this._isTopLevelGroup,d=this.GetEventSheetManager(),f=this._subEvents;for(let g=0,h=f.length;g<h;++g){const i=f[g],e=i.GetSolModifiers(),j=!c||!b&&g<h-1;j&&d.PushCopySol(e),i.Run(a),j?d.PopSol(e):d.ClearSol(e)}}_RunSubEvents_Fast(a){const b=this._subEvents;for(let c=0,d=b.length;c<d;++c)b[c].Run(a)}*_DebugRunSubEvents(){if(this._subEvents.length){const a=this._eventStack,b=a.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(b):yield*this._DebugRunSubEvents_Fast(b),a.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(a){const b=this._isGroup,c=this._isTopLevelGroup,d=this.GetEventSheetManager(),f=this._subEvents;for(let g=0,h=f.length;g<h;++g){const i=f[g],e=i.GetSolModifiers(),j=!c||!b&&g<h-1;j&&d.PushCopySol(e),yield*i.DebugRun(a),j?d.PopSol(e):d.ClearSol(e)}}*_DebugRunSubEvents_Fast(a){const b=this._subEvents;for(let c=0,d=b.length;c<d;++c)yield*b[c].DebugRun(a)}Retrigger(a,b){this._runtime.IncrementExecCount(),b.ResetQuick();const d=this._conditions;if(!this.IsOrBlock())for(let e=a.GetConditionIndex()+1,c=d.length;e<c;++e){const a=d[e];b.SetConditionIndex(e);const c=a.Run();if(!c)return!1}return this._RunActions(b,0)&&this._RunSubEvents(b),!0}*DebugRetrigger(a,b){this._runtime.IncrementExecCount(),b.ResetQuick();const d=this._conditions;if(!this.IsOrBlock())for(let e=a.GetConditionIndex()+1,c=d.length;e<c;++e){const a=d[e];b.SetConditionIndex(e);let c;if(c=a.DebugCanRunFast()?a.Run():yield*a.DebugRun(),!c)return!1}let c;return c=this.DebugCanRunActionsFast()?this._RunActions(b,0):yield*this._DebugRunActions(b,0),c&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),!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(a){if(this.GetParent()){const b=this.GetTriggerParents();for(let c=0,d=b.length;c<d;++c)if(!b[c].RunPreTrigger(a))return!1}return!0}*_DebugCheckParentsOKToRun(a){if(this.GetParent()){const b=this.GetTriggerParents();for(let c=0,d=b.length;c<d;++c)if(!(yield*b[c].DebugRunPreTrigger(a)))return!1}return!0}_EvaluateFunctionCallParameters(a,b,c){if(!(0<b.length))c&&a.GetLocalVarStack().Push();else if(c){const c=b.map((a)=>a.Get(0));a.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(c)}else this._scopeParent.EvaluateFunctionParameters(b)}RunAsFunctionCall(a,b){let c,d;const e=0<a.length,f=this._runtime,g=this._eventStack,h=f.GetEventSheetManager(),i=h._IncTriggerDepth(),j=1<i;this._EvaluateFunctionCallParameters(h,b,j),e&&h.PushCleanSol(a);const k=g.Push(this);if(this._CheckParentsOKToRun(k)){f.IncrementExecCount(),k.SetCurrentEvent(this);const a=this._scopeParent.IsAsync();a&&([d,c]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(k),a&&this._scopeParent.MaybeFinishAsyncFunctionCall(d)}return g.Pop(),j&&h.GetLocalVarStack().Pop(),e&&h.PopSol(a),h._DecTriggerDepth(),c}*DebugRunAsFunctionCall(a,b){let c,d;(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())&&(yield this);const e=0<a.length,f=this._runtime,g=this._eventStack,h=f.GetEventSheetManager(),i=h._IncTriggerDepth(),j=1<i;this._EvaluateFunctionCallParameters(h,b,j),e&&h.PushCleanSol(a);const k=g.Push(this);if(yield*this._DebugCheckParentsOKToRun(k)){f.IncrementExecCount(),k.SetCurrentEvent(this);const a=this._scopeParent.IsAsync();a&&([d,c]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(k),a&&this._scopeParent.MaybeFinishAsyncFunctionCall(d)}return g.Pop(),j&&h.GetLocalVarStack().Pop(),e&&h.PopSol(a),h._DecTriggerDepth(),c}RunAsMappedFunctionCall(a){const b=this.GetSolModifiersIncludingParents(),c=0<b.length,d=this._runtime,e=this._eventStack,f=d.GetEventSheetManager(),g=f._IncTriggerDepth(),h=1<g;h&&f.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(a),c&&f.PushCleanSol(b);const i=e.Push(this);this._CheckParentsOKToRun(i)&&(d.IncrementExecCount(),i.SetCurrentEvent(this),this._RunAndBlock(i)),e.Pop(),h&&f.GetLocalVarStack().Pop(),c&&f.PopSol(b),f._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(a){(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())&&(yield this);const b=this.GetSolModifiersIncludingParents(),c=0<b.length,d=this._runtime,e=this._eventStack,f=d.GetEventSheetManager(),g=f._IncTriggerDepth(),h=1<g;h&&f.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(a),c&&f.PushCleanSol(b);const i=e.Push(this);(yield*this._DebugCheckParentsOKToRun(i))&&(d.IncrementExecCount(),i.SetCurrentEvent(this),yield*this._DebugRunAndBlock(i)),e.Pop(),h&&f.GetLocalVarStack().Pop(),c&&f.PopSol(b),f._DecTriggerDepth()}RunAsExpressionFunctionCall(a,b,c,...d){let e,f;const g=0<a.length,h=this._runtime,i=this._eventStack,j=h.GetEventSheetManager(),k=j._IncTriggerDepth(),l=1<k;l&&j.GetLocalVarStack().Push(),0<d.length&&this._scopeParent.SetFunctionParameters(d),g&&j.PushCleanSol(a);const m=i.Push(this);if(m.InitCallFunctionExpression(b,c),i.PushExpFunc(m),h.SetDebuggingEnabled(!1),this._CheckParentsOKToRun(m)){h.IncrementExecCount(),m.SetCurrentEvent(this);const a=this._scopeParent.IsAsync();a&&([f,e]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(m),a&&this._scopeParent.MaybeFinishAsyncFunctionCall(f)}return h.SetDebuggingEnabled(!0),i.Pop(),i.PopExpFunc(),l&&j.GetLocalVarStack().Pop(),g&&j.PopSol(a),j._DecTriggerDepth(),e||m.GetFunctionReturnValue()}}}
// c3/events/eventScript.js
"use strict";{const a=[];let b=!1;C3.EventScript=class extends C3.DefendedBase{constructor(a,b,c){super();const d=a.GetRuntime(),e=a.GetEventSheetManager();this._eventSheet=a,this._eventSheetManager=e,this._runtime=a.GetRuntime(),this._parent=b;const f=d.GetObjectReference(c[1]);this._func=f,this._displayNumber=c[2],this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber),this._debugData=d.IsDebug()?{isBreakpoint:c[3][0],isBreakable:c[3][1]}:null}static Create(a,b,c){return C3.New(C3.EventScript,a,b,c)}_PostInit(){const a=this._func,b=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=a.bind(null,this._runtime.GetIRuntime(),b)}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(a){this._debugData.isBreakpoint=!!a}IsElseBlock(){return!1}GetSolModifiers(){return a}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():a}Run(a){a.SetCurrentEvent(this),this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(a){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",a),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(a){a.SetCurrentEvent(this),(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this.Run(a)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return b}static SetHadUserScriptException(){b=!0}}}
// c3/events/functionBlock.js
"use strict";C3.FunctionBlock=class extends C3.DefendedBase{constructor(a,b,c){super(),this._eventSheet=a,this._runtime=a.GetRuntime(),this._parent=b;const d=c[1];this._functionName=d[0],this._returnType=d[1],this._functionParameters=d[2].map((b)=>C3.EventVariable.Create(a,this,b)),this._isEnabled=d[3],this._isAsync=d[4],this._nextAsyncId=0,this._currentAsyncId=-1,this._asyncMap=new Map,this._eventBlock=C3.EventBlock.Create(a,b,c),this._eventBlock._SetScopeParent(this)}static Create(a,b,c){return C3.New(C3.FunctionBlock,a,b,c)}_PostInit(){for(const a of this._functionParameters)a._PostInit();this._eventBlock._PostInit(!1)}_GetEventVariableNameInScope(a){for(const b of this._functionParameters)if(C3.equalsNoCase(a,b.GetName()))return b;return null}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}EvaluateFunctionParameters(a){const b=this._functionParameters;for(let c=0,d=b.length;c<d;++c)b[c].SetValue(a[c].Get(0))}SetFunctionParameters(a){const b=this._functionParameters;for(let c=0,d=b.length;c<d;++c)b[c].SetValue(a[c])}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 c=new Promise((a)=>b=a);return this._asyncMap.set(a,{resolve:b,pauseCount:0}),[a,c]}MaybeFinishAsyncFunctionCall(a){const b=this._asyncMap.get(a);0===b.pauseCount&&(b.resolve(),this._asyncMap.delete(a));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){const a=this._asyncMap.get(this._currentAsyncId);return a.pauseCount++,this._currentAsyncId}ResumeAsyncFunction(a){this._currentAsyncId=a;const b=this._asyncMap.get(a);b.pauseCount--}};
// c3/events/eventVariable.js
"use strict";{const a=[];C3.EventVariable=class extends C3.DefendedBase{constructor(a,b,c){super();const d=a.GetEventSheetManager();this._eventSheet=a,this._eventSheetManager=d,this._runtime=a.GetRuntime(),this._parent=b,this._localVarStack=d.GetLocalVarStack(),this._name=c[1],this._type=c[2],this._initialValue=c[3],this._isStatic=!!c[4],this._isConstant=!!c[5],this._isFunctionParameter=b instanceof C3.FunctionBlock,this._sid=c[6],this._jsPropName=this._runtime.GetJsPropName(c[8]),this._scriptSetter=(a)=>this.SetValue(a),this._scriptGetter=()=>this.GetValue(),this._hasSingleValue=!this._parent||this._isStatic||this._isConstant,this._value=this._initialValue,this._localIndex=-1,this.IsBoolean()&&(this._value=this._value?1:0),!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=d._GetNextLocalVarIndex(this)),d._RegisterEventVariable(this)}static Create(a,b,c){return C3.New(C3.EventVariable,a,b,c)}_PostInit(){}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return 0===this._type}IsString(){return 1===this._type}IsBoolean(){return 2===this._type}IsElseBlock(){return!1}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return a}Run(){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(a){this.Run(a)}SetValue(a){this.IsNumber()?"number"!=typeof a&&(a=parseFloat(a)):this.IsString()?"string"!=typeof a&&(a=a.toString()):this.IsBoolean()&&(a=a?1:0),this._hasSingleValue?this._value=a:this._localVarStack.GetCurrent()[this._localIndex]=a}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let a=this.GetValue();return this.IsBoolean()&&(a=!!a),a}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}}
// c3/events/eventInclude.js
"use strict";{const a=[];C3.EventInclude=class extends C3.DefendedBase{constructor(a,b,c){super();const d=a.GetEventSheetManager();this._eventSheet=a,this._eventSheetManager=d,this._runtime=a.GetRuntime(),this._parent=b,this._includeSheet=null,this._includeSheetName=c[1],this._isActive=!0}static Create(a,b,c){return C3.New(C3.EventInclude,a,b,c)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);for(let a=this.GetParent();a;)a instanceof C3.EventBlock&&a.IsGroup()&&a._AddContainedInclude(this),a=a.GetParent();this.UpdateActive(),this._runtime.IsDebug()&&this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return a}GetIncludeSheet(){return this._includeSheet}Run(){const a=!!this.GetParent(),b=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(b),this._includeSheet.Run(),a&&this._eventSheetManager.PopSol(b)}*DebugRun(){const a=!!this.GetParent(),b=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(b),yield*this._includeSheet.DebugRun(),a&&this._eventSheetManager.PopSol(b)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){for(let a=this.GetParent();a;){if(a instanceof C3.EventBlock&&a.IsGroup()&&!a.IsGroupActive())return void(this._isActive=!1);a=a.GetParent()}this._isActive=!0}}}
// c3/events/expNode.js
"use strict";{function a(a,b){return a>=b?a%b:0>a?(a<=-b&&(a%=b),0>a&&(a+=b),a):a}C3.ExpNode=class extends C3.DefendedBase{constructor(a){super(),this._owner=a,this._runtime=a.GetRuntime()}_PostInit(){}static CreateNode(a,h){const i=h[0];return C3.New([f,d,e,g,b,c][i],a,h)}};class b extends C3.ExpNode{constructor(a,b){super(a),this._systemPlugin=this._runtime.GetSystemPlugin(),this._func=this._runtime.GetObjectReference(b[1]);(this._func===C3.Plugins.System.Exps.random||this._func===C3.Plugins.System.Exps.choose)&&this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,this._systemPlugin)}}class c extends C3.ExpNode{constructor(a,b){super(a),this._functionBlock=null,this._functionName=b[1],this._owner.SetVariesPerInstance()}_PostInit(){const a=this._runtime.GetEventSheetManager();this._functionBlock=a.GetFunctionBlockByName(this._functionName);this._functionName=null;const b=this._owner.GetEventBlock(),c=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...b.GetSolModifiersIncludingParents(),...c.GetSolModifiersIncludingParents()])],this._combinedSolModifiers=a._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const a=this._functionBlock;if(a.IsEnabled()){const b=a.GetEventBlock();return C3.EventBlock.prototype.RunAsExpressionFunctionCall.bind(b,this._combinedSolModifiers,a.GetReturnType(),a.GetDefaultReturnValue())}else{const b=a.GetDefaultReturnValue();return()=>b}}}class d extends C3.ExpNode{constructor(a,b){super(a),this._objectClass=this._runtime.GetObjectClassByIndex(b[1]),this._func=this._runtime.GetObjectReference(b[2]);this._returnsString=!!b[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(...b){const c=this._objectClass,d=c.GetCurrentSol().GetExpressionInstances(),e=d.length;if(0===e)return this._returnsString?"":0;const f=a(this._owner.GetSolIndex(),e);return this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(c),this._func.apply(d[f].GetSdkInstance(),b)}ExpObject_InstExpr(b,...c){const d=this._objectClass,e=d.GetInstances(),f=e.length;if(0===f)return this._returnsString?"":0;const g=a(b,f);return this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(d),this._func.apply(e[g].GetSdkInstance(),c)}}class e extends C3.ExpNode{constructor(a,b){super(a),this._objectClass=this._runtime.GetObjectClassByIndex(b[1]),this._varIndex=b[3],this._returnsString=!!b[2],this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const b=this._objectClass.GetCurrentSol().GetExpressionInstances(),c=b.length;if(0===c)return this._returnsString?"":0;const d=a(this._owner.GetSolIndex(),c);return b[d]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){const b=this._objectClass,c=b.GetCurrentSol().GetExpressionInstances(),d=c.length;if(0===d)return this._returnsString?"":0;const e=a(this._owner.GetSolIndex(),d),f=c[e],g=f.GetObjectClass().GetFamilyInstanceVariableOffset(b.GetFamilyIndex());return f._GetInstanceVariableValueUnchecked(this._varIndex+g)}ExpInstVar_InstExpr(b){const c=this._objectClass,d=c.GetInstances(),e=d.length;if(0===e)return this._returnsString?"":0;const f=a(b,e),g=d[f];let h=0;return c.IsFamily()&&(h=g.GetObjectClass().GetFamilyInstanceVariableOffset(c.GetFamilyIndex())),g._GetInstanceVariableValueUnchecked(this._varIndex+h)}}class f extends C3.ExpNode{constructor(a,b){super(a),this._objectClass=this._runtime.GetObjectClassByIndex(b[1]),this._behaviorType=this._objectClass.GetBehaviorTypeByName(b[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(b[2]),this._func=this._runtime.GetObjectReference(b[3]);this._returnsString=!!b[4],this._eventStack=this._runtime.GetEventSheetManager().GetEventStack(),this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...b){const c=this._objectClass,d=c.GetCurrentSol().GetExpressionInstances(),e=d.length;if(0===e)return this._returnsString?"":0;const f=a(this._owner.GetSolIndex(),e);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(c);const g=d[f];let h=0;return c.IsFamily()&&(h=g.GetObjectClass().GetFamilyBehaviorOffset(c.GetFamilyIndex())),this._func.apply(g.GetBehaviorInstances()[this._behaviorIndex+h].GetSdkInstance(),b)}ExpBehavior_InstExpr(b,...c){const d=this._objectClass,e=d.GetInstances(),f=e.length;if(0===f)return this._returnsString?"":0;const g=a(b,f);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(d);const h=e[g];let i=0;return d.IsFamily()&&(i=h.GetObjectClass().GetFamilyBehaviorOffset(d.GetFamilyIndex())),this._func.apply(h.GetBehaviorInstances()[this._behaviorIndex+i].GetSdkInstance(),c)}}class g extends C3.ExpNode{constructor(a,b){super(a),this._eventVar=null,this._eventVarName=b[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableByName(this._eventVarName,this._owner.GetEventBlock());this._eventVarName=null}GetVar(){return this._eventVar}}}
// c3/events/parameter.js
"use strict";{function a(a){const b=self.C3_ExpressionFuncs[a];if(!b)throw new Error("invalid expression number");return b}C3.Parameter=class extends C3.DefendedBase{constructor(a,b,c){super(),this._owner=a,this._index=c,this._type=b,this.Get=null,this._variesPerInstance=!1,this._isConstant=!1}static Create(a,p,q){const r=p[0];return C3.New([b,c,j,e,g,d,h,b,e,e,k,l,j,n,c,i,f,m,o][r],a,r,q,p)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(a){!this._variesPerInstance&&a&&(a.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}};class b extends C3.Parameter{constructor(b,c,d,e){super(b,c,d),this._solIndex=0;const f=e[1];this._expressionNumber=f[0],this._numberedNodes=[],this._expressionFunc=null;for(let a=1,g=f.length;a<g;++a)this._numberedNodes.push(C3.ExpNode.CreateNode(this,f[a]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=a(this._expressionNumber),this._isConstant=!0)}_GetNode(a){if(0>a||a>=this._numberedNodes.length)throw new RangeError("invalid numbered node");return this._numberedNodes[a]}_PostInit(){for(const a of this._numberedNodes)a._PostInit();const b=a(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?b(this):b}GetSolIndex(){return this._solIndex}GetExpression(a){return this._solIndex=a,this._expressionFunc()}}class c extends b{constructor(a,b,c,d){super(a,b,c,d),this.Get=this.GetStringExpression,14===b&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof C3.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(a){this._solIndex=a;const b=this._expressionFunc();return"string"==typeof b?b:""}_GetFastTriggerValue(){return a(this._expressionNumber)()}}class d extends b{constructor(a,b,c,d){super(a,b,c,d),this.Get=this.GetLayer,this._isConstant=!1}GetLayer(a){this._solIndex=a;const b=this._expressionFunc(),c=this.GetRuntime().GetCurrentLayout();return c.GetLayer(b)}}class e extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._combo=d[1],this.Get=this.GetCombo,this._isConstant=!0}GetCombo(){return this._combo}}class f extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._bool=d[1],this.Get=this.GetBoolean,this._isConstant=!0}GetBoolean(){return this._bool}}class g extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._objectClass=this.GetRuntime().GetObjectClassByIndex(d[1]);this.Get=this.GetObjectClass;const e=this.GetEventBlock();e._AddSolModifier(this._objectClass),this._owner instanceof C3.Action?e.SetSolWriterAfterCnds():e.GetParent()&&e.GetParent().SetSolWriterAfterCnds(),this._isConstant=!0}GetObjectClass(){return this._objectClass}}class h extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(d[1]),this.Get=this.GetLayout,this._isConstant=!0}GetLayout(){return this._layout}}class i extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(d[1]),this.Get=this.GetTimeline,this._isConstant=!0}GetTimeline(){return this._timeline}}class j extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._fileInfo=d[1],this.Get=this.GetFile,this._isConstant=!0}GetFile(){return this._fileInfo}}class k extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._instVarIndex=d[1];const e=this._owner.GetObjectClass();e&&e.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(a){a=a||0;const b=this._owner.GetObjectClass(),c=b.GetCurrentSol(),d=c.GetInstances();let e=null;if(d.length)e=d[a%d.length].GetObjectClass();else if(c.HasAnyElseInstances()){const b=c.GetElseInstances();e=b[a%b.length].GetObjectClass()}else if(0<b.GetInstanceCount()){const c=b.GetInstances();e=c[a%c.length].GetObjectClass()}else return 0;return this._instVarIndex+e.GetFamilyInstanceVariableOffset(b.GetFamilyIndex())}}class l extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._eventVarName=d[1],this._eventVar=null,this.Get=this.GetEventVariable,this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableByName(this._eventVarName,this.GetEventBlock());this._eventVarName=null}GetEventVariable(){return this._eventVar}}class m extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._functionBlockName=d[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 n extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._subParams=[],this._variadicRet=[],this._isConstant=!0;for(let e=1,f=d.length;e<f;++e){const a=C3.Parameter.Create(this._owner,d[e],0);this._subParams.push(a),this._variadicRet.push(0),a.IsConstant()||(this._isConstant=!1)}this.Get=this.GetVariadic}_PostInit(){for(const a of this._subParams)a._PostInit()}GetVariadic(){const a=this._subParams,b=this._variadicRet;for(let c=0,d=a.length;c<d;++c)b[c]=a[c].Get(0);return b}}class o extends C3.Parameter{constructor(a,b,c,d){super(a,b,c),this._easeIndex=d[1],this.Get=this.GetEase,this._isConstant=!0}GetEase(){return this._easeIndex}}}
// c3/events/condition.js
"use strict";{function a(a,b){for(let c=0,d=a.length;c<d;++c)b[c]=a[c].Get(0)}const b=[],c=function(){};C3.Condition=class extends C3.DefendedBase{constructor(a,d,e){if(super(),this._eventBlock=a,this._runtime=a.GetRuntime(),this._index=e,this._func=this._runtime.GetObjectReference(d[1]),this._isTrigger=0<d[3],this._isFastTrigger=2===d[3],this._isLooping=!!d[4],this._isInverted=!!d[5],this._isStatic=!!d[6],this._sid=d[7],this._isInOrBlock=this._eventBlock.IsOrBlock(),this._objectClass=null,this._behaviorType=null,this._behaviorIndex=-1,this._systemPlugin=null,this.Run=c,this.DebugRun=c,this._parameters=[],this._results=[],this._anyParamVariesPerInstance=!1,this._savedData=null,this._unsavedData=null,this._debugData=this._runtime.IsDebug()?{isBreakpoint:d[8][0],canDebug:d[8][1]}:null,(-1===d[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(d[0]),d[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(d[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(d[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds()),10===d.length)){let a=d[9];for(let b of a)this._parameters.push(C3.Parameter.Create(this,b,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._parameters=b,this._results=b),this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(a,b,c){return C3.New(C3.Condition,a,b,c)}_PostInit(){for(const a of this._parameters)a._PostInit(),a.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(){const a=this._systemPlugin,b=this._systemPlugin;this._SetRunMethodForBoundFunc(a,b,this._RunSystem)}_SetSingleGlobalRunMethod(){const a=this._objectClass.GetPlugin(),b=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(a,b,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(a,b,c){const d=this._func,e=this._isInverted,f=this._parameters;if(0===f.length){const c=a._GetBoundACEMethod(d,b);this.Run=e?function(){return C3.xor(c(),e)}:c}else if(1===f.length){const c=f[0];if(!e&&c.IsConstant())this.Run=a._GetBoundACEMethod_1param(d,b,c.Get(0));else{const f=a._GetBoundACEMethod(d,b);this.Run=function(){return C3.xor(f(c.Get(0)),e)}}}else if(2===f.length){const c=f[0],g=f[1];if(!e&&c.IsConstant()&&g.IsConstant())this.Run=a._GetBoundACEMethod_2params(d,b,c.Get(0),g.Get(0));else{const f=a._GetBoundACEMethod(d,b);this.Run=function(){return C3.xor(f(c.Get(0),g.Get(0)),e)}}}else if(3===f.length){const c=f[0],g=f[1],h=f[2];if(!e&&c.IsConstant()&&g.IsConstant()&&h.IsConstant())this.Run=a._GetBoundACEMethod_3params(d,b,c.Get(0),g.Get(0),h.Get(0));else{const f=a._GetBoundACEMethod(d,b);this.Run=function(){return C3.xor(f(c.Get(0),g.Get(0),h.Get(0)),e)}}}else this.Run=c}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(a){this._debugData.isBreakpoint=!!a,this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){return this._savedData||(this._savedData=new Map),this._savedData}GetUnsavedDataMap(){return this._unsavedData||(this._unsavedData=new Map),this._unsavedData}_RunSystem(){const b=this._results;return a(this._parameters,b),C3.xor(this._func.apply(this._systemPlugin,b),this._isInverted)}*_DebugRunSystem(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const b=this._results;a(this._parameters,b);let c=this._func.apply(this._systemPlugin,b);return C3.IsIterator(c)&&(c=yield*c),C3.xor(c,this._isInverted)}return this.Run()}_RunSingleGlobal(){const b=this._results;a(this._parameters,b);const c=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return C3.xor(this._func.apply(c,b),this._isInverted)}*_DebugRunSingleGlobal(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const b=this._results;a(this._parameters,b);const c=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();let d=this._func.apply(c,b);return C3.IsIterator(d)&&(d=yield*d),C3.xor(d,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){return(this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),!0}_RunStatic(){const b=this._results;a(this._parameters,b);const c=this._func.apply(this._behaviorType||this._objectClass,b);return this._objectClass.ApplySolToContainer(),c}*_DebugRunStatic(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const b=this._results;a(this._parameters,b);let c=this._func.apply(this._behaviorType||this._objectClass,b);return C3.IsIterator(c)&&(c=yield*c),this._objectClass.ApplySolToContainer(),c}return this.Run()}_RunObject(){const a=this._parameters,b=this._results,c=this._objectClass.GetCurrentSol();for(let c=0,d=a.length;c<d;++c){const d=a[c];d.VariesPerInstance()||(b[c]=d.Get(0))}return c.IsSelectAll()?this._RunObject_FirstFilter(c):this._RunObject_NextFilter(c)}*_DebugRunObject(){return(this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._RunObject()}_EvaluateVaryingParameters(a){const b=this._parameters,c=this._results;for(let d=0,e=b.length;d<e;++d){const e=b[d];e.VariesPerInstance()&&(c[d]=e.Get(a))}}_RunObject_FirstFilter(a){const b=this._objectClass,c=b.IsFamily(),d=b.GetFamilyIndex(),e=this._behaviorIndex,f=b.GetInstances(),g=this._anyParamVariesPerInstance,h=this._results,j=this._func,k=this._isInverted,l=this._isInOrBlock&&!this._isTrigger;a.ClearArrays();for(let b=0,i=f.length;b<i;++b){const i=f[b];g&&this._EvaluateVaryingParameters(b);let m;if(0<=e){const a=c?i.GetObjectClass().GetFamilyBehaviorOffset(d):0;m=j.apply(i.GetBehaviorInstances()[e+a].GetSdkInstance(),h)}else m=j.apply(i.GetSdkInstance(),h);C3.xor(m,k)?a._PushInstance(i):l&&a._PushElseInstance(i)}return b.FinishCondition(!0),a._SetSelectAll(!1),b.ApplySolToContainer(),a.HasAnyInstances()}_RunObject_NextFilter(a){const b=this._objectClass,c=b.IsFamily(),d=b.GetFamilyIndex(),e=b.IsInContainer(),f=this._behaviorIndex,g=this._anyParamVariesPerInstance,h=this._results,j=this._func,l=this._isInverted,m=this._isInOrBlock&&!this._isTrigger,n=a._GetOwnInstances(),o=a._GetOwnElseInstances(),p=m&&!this._eventBlock.IsFirstConditionOfType(this),q=p?o:n;let r=0,k=!1;for(let b=0,i=q.length;b<i;++b){const a=q[b];g&&this._EvaluateVaryingParameters(b);let i;if(0<=f){const b=c?a.GetObjectClass().GetFamilyBehaviorOffset(d):0;i=j.apply(a.GetBehaviorInstances()[f+b].GetSdkInstance(),h)}else i=j.apply(a.GetSdkInstance(),h);C3.xor(i,l)?(k=!0,p?(n.push(a),e&&a._PushSiblingsToSolInstances()):(q[r]=a,e&&a._SetSiblingsToSolInstancesIndex(r),++r)):p?(q[r]=a,e&&a._SetSiblingsToSolElseInstancesIndex(r),++r):m&&(o.push(a),e&&a._PushSiblingsToSolElseInstances())}C3.truncateArray(q,r),e&&b._TruncateContainerSols(p,r);const i=k;return p&&!k&&(k=this._OrBlockCheckInstances(n)),b.FinishCondition(i||m),m?k:a.HasAnyInstances()}_OrBlockCheckInstances(a){const b=this._objectClass,c=b.IsFamily(),d=b.GetFamilyIndex(),e=this._anyParamVariesPerInstance,f=this._behaviorIndex,g=this._results,h=this._func,j=this._isInverted;for(let b=0,i=a.length;b<i;++b){const i=a[b];e&&this._EvaluateVaryingParameters(b);let k;if(0<=f){const a=c?i.GetObjectClass().GetFamilyBehaviorOffset(d):0;k=h.apply(i.GetBehaviorInstances()[f+a].GetSdkInstance(),g)}else k=h.apply(i.GetSdkInstance(),g);if(C3.xor(k,j))return!0}return!1}ReevaluateParameter(a,b){return this._parameters[a].Get(b)}GetFastTriggerValue(){const a=this._parameters;if(!a.length)throw new Error("no parameters");return a[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const a={};for(const[b,c]of this._savedData.entries()){let d=c;"collmemory"===b&&(d=[...c.entries()].map((a)=>[a[0].GetUID(),a[1].GetUID(),a[2]])),a[b]=d}return{"ex":a}}_LoadFromJson(a){const b=this._runtime,c=a["ex"];if(c){const a=this.GetSavedDataMap();a.clear();for(const[d,e]of Object.entries(c)){let c=e;"collmemory"===d&&(c=C3.New(C3.PairMap,e.map((a)=>[b.GetInstanceByUID(a[0]),b.GetInstanceByUID(a[1]),a[2]]).filter((a)=>a[0]&&a[1]))),a.set(d,c)}}else this._savedData&&(this._savedData.clear(),this._savedData=null)}}}
// c3/events/action.js
"use strict";{function a(a,b){for(let c=0,d=a.length;c<d;++c)b[c]=a[c].Get(0)}const b=[],c=function(){},d=function*(){};C3.Action=class extends C3.DefendedBase{constructor(a,d,e){super(),this._eventBlock=a;const f=a.GetRuntime();this._runtime=f,this._index=e,this._sid=4<=d.length?d[3]:-1,this._actionReturnType=5<=d.length?d[4]:0,this._func=null,this._objectClass=null,this._behaviorType=null,this._behaviorIndex=-1,this._systemPlugin=null,this._callFunctionName="",this._callEventBlock=null,this._combinedSolModifiers=null,this.Run=c,this.DebugRun=c,this._parameters=[],this._results=[],this._anyParamVariesPerInstance=!1,this._savedData=null,this._unsavedData=null;const g=-3===d[0],h=g?d[2]:d[5];if(this._debugData=f.IsDebug()||g?{isBreakpoint:h[0],canDebug:h[1],index:h[2]}:null,-1===d[0])this._systemPlugin=f.GetSystemPlugin(),this._func=f.GetObjectReference(d[1]);else if(-2===d[0])this._callFunctionName=d[1];else if(g){const a=f.GetObjectReference(d[1]);this._func=a,this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=1}else this._func=f.GetObjectReference(d[1]),this._objectClass=f.GetObjectClassByIndex(d[0]),d[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(d[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(d[2]));if(7===d.length){const a=d[6];for(const b of a)this._parameters.push(C3.Parameter.Create(this,b,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._parameters=b,this._results=b),this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(a,b,c){return C3.New(C3.Action,a,b,c)}_PostInit(){for(const a of this._parameters)a._PostInit(),a.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){const a=this._func,b=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=a.bind(null,this._runtime.GetIRuntime(),b)}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((a)=>a.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((a)=>a.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(){const a=this._systemPlugin,b=this._systemPlugin;this._SetRunMethodForBoundFunc(a,b,this._RunSystem)}_SetSingleGlobalRunMethod(){const a=this._objectClass.GetPlugin(),b=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(a,b,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const a=this._eventBlock.GetEventSheetManager(),b=a.GetFunctionBlockByName(this._callFunctionName);b.IsEnabled()?(this._callEventBlock=b.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],this._combinedSolModifiers=a._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=C3.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=c,this.DebugRun=d)}_SetRunMethodForBoundFunc(a,b,c){const d=this._func,e=this._parameters;if(0===e.length)this.Run=a._GetBoundACEMethod(d,b);else if(1===e.length){const c=e[0];if(c.IsConstant())this.Run=a._GetBoundACEMethod_1param(d,b,c.Get(0));else{const e=a._GetBoundACEMethod(d,b);this.Run=function(){return e(c.Get(0))}}}else if(2===e.length){const c=e[0],f=e[1];if(c.IsConstant()&&f.IsConstant())this.Run=a._GetBoundACEMethod_2params(d,b,c.Get(0),f.Get(0));else{const e=a._GetBoundACEMethod(d,b);this.Run=function(){return e(c.Get(0),f.Get(0))}}}else if(3===e.length){const c=e[0],f=e[1],g=e[2];if(c.IsConstant()&&f.IsConstant()&&g.IsConstant())this.Run=a._GetBoundACEMethod_3params(d,b,c.Get(0),f.Get(0),g.Get(0));else{const e=a._GetBoundACEMethod(d,b);this.Run=function(){return e(c.Get(0),f.Get(0),g.Get(0))}}}else this.Run=c}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(a){this._debugData.isBreakpoint=!!a,this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){return this._savedData||(this._savedData=new Map),this._savedData}GetUnsavedDataMap(){return this._unsavedData||(this._unsavedData=new Map),this._unsavedData}_RunSystem(){const b=this._results;return a(this._parameters,b),this._func.apply(this._systemPlugin,b)}*_DebugRunSystem(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const b=this._results;a(this._parameters,b);const c=yield*this._func.apply(this._systemPlugin,b);return c}return this.Run()}*_DebugRunCallFunction(){(this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this);const a=yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters);return a}_RunSingleGlobal(){const b=this._results;return a(this._parameters,b),this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),b)}*_DebugRunSingleGlobal(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const b=this._results;a(this._parameters,b);const c=yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),b);return c}return this.Run()}_RunObject_ParamsConst(){const a=this._results,b=this._objectClass.GetCurrentSol().GetInstances();for(let c=0,d=b.length;c<d;++c)this._func.apply(b[c].GetSdkInstance(),a)}*_DebugRunObject_ParamsConst(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const a=this._results,b=this._objectClass.GetCurrentSol().GetInstances();for(let c=0,d=b.length;c<d;++c)yield*this._func.apply(b[c].GetSdkInstance(),a)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const b=this._results;a(this._parameters,b);const c=this._objectClass.GetCurrentSol().GetInstances();for(let a=0,d=c.length;a<d;++a)this._func.apply(c[a].GetSdkInstance(),b)}*_DebugRunObject_ParamsDontVary(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const b=this._results;a(this._parameters,b);const c=this._objectClass.GetCurrentSol().GetInstances();for(let a=0,d=c.length;a<d;++a)yield*this._func.apply(c[a].GetSdkInstance(),b)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const a=this._parameters,b=this._results,c=this._func,d=this._objectClass.GetCurrentSol().GetInstances();for(let e=0,f=d.length;e<f;++e){const f=d[e];for(let c=0,d=a.length;c<d;++c)b[c]=a[c].Get(e);c.apply(f.GetSdkInstance(),b)}}*_DebugRunObject_AllParamsVary(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const a=this._parameters,b=this._results,c=this._func,d=this._objectClass.GetCurrentSol().GetInstances();for(let e=0,f=d.length;e<f;++e){const f=d[e];for(let c=0,d=a.length;c<d;++c)b[c]=a[c].Get(e);yield*c.apply(f.GetSdkInstance(),b)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const a=this._parameters,b=this._results,c=this._func,d=this._objectClass.GetCurrentSol().GetInstances();for(let c=0,d=a.length;c<d;++c){const d=a[c];d.VariesPerInstance()||(b[c]=d.Get(0))}for(let e=0,f=d.length;e<f;++e){const f=d[e];for(let c=0,d=a.length;c<d;++c){const d=a[c];d.VariesPerInstance()&&(b[c]=d.Get(e))}c.apply(f.GetSdkInstance(),b)}}*_DebugRunObject_SomeParamsVary(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const a=this._parameters,b=this._results,c=this._func,d=this._objectClass.GetCurrentSol().GetInstances();for(let c=0,d=a.length;c<d;++c){const d=a[c];d.VariesPerInstance()||(b[c]=d.Get(0))}for(let e=0,f=d.length;e<f;++e){const f=d[e];for(let c=0,d=a.length;c<d;++c){const d=a[c];d.VariesPerInstance()&&(b[c]=d.Get(e))}yield*c.apply(f.GetSdkInstance(),b)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){const a=this._objectClass,b=a.IsFamily(),c=a.GetFamilyIndex(),d=this._parameters,e=this._anyParamVariesPerInstance,f=this._results,g=this._func,h=this._behaviorIndex,j=a.GetCurrentSol().GetInstances();for(let a=0,b=d.length;a<b;++a){const b=d[a];b.VariesPerInstance()||(f[a]=b.Get(0))}for(let a=0,i=j.length;a<i;++a){const i=j[a];if(e)for(let b=0,c=d.length;b<c;++b){const c=d[b];c.VariesPerInstance()&&(f[b]=c.Get(a))}const k=b?i.GetObjectClass().GetFamilyBehaviorOffset(c):0;g.apply(i.GetBehaviorInstances()[h+k].GetSdkInstance(),f)}}*_DebugRunBehavior(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const a=this._objectClass,b=a.IsFamily(),c=a.GetFamilyIndex(),d=this._parameters,e=this._anyParamVariesPerInstance,f=this._results,g=this._func,h=this._behaviorIndex,j=a.GetCurrentSol().GetInstances();for(let a=0,b=d.length;a<b;++a){const b=d[a];b.VariesPerInstance()||(f[a]=b.Get(0))}for(let a=0,i=j.length;a<i;++a){const i=j[a];if(e)for(let b=0,c=d.length;b<c;++b){const c=d[b];c.VariesPerInstance()&&(f[b]=c.Get(a))}const k=b?i.GetObjectClass().GetFamilyBehaviorOffset(c):0;yield*g.apply(i.GetBehaviorInstances()[h+k].GetSdkInstance(),f)}}else this._RunBehavior()}_RunObject_Async(){const a=this._parameters,b=this._results,c=this._func,d=this._objectClass.GetCurrentSol().GetInstances(),e=[];for(let f=0,g=d.length;f<g;++f){const g=d[f];for(let c=0,d=a.length;c<d;++c)b[c]=a[c].Get(f);e.push(c.apply(g.GetSdkInstance(),b))}return Promise.all(e)}*_DebugRunObject_Async(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const a=this._parameters,b=this._results,c=this._func,d=this._objectClass.GetCurrentSol().GetInstances(),e=[];for(let f=0,g=d.length;f<g;++f){const g=d[f];for(let c=0,d=a.length;c<d;++c)b[c]=a[c].Get(f);e.push((yield*c.apply(g.GetSdkInstance(),b)))}return Promise.all(e)}return this._RunObject_Async()}_RunBehavior_Async(){const a=this._objectClass,b=a.IsFamily(),c=a.GetFamilyIndex(),d=this._parameters,e=this._results,f=this._func,g=this._behaviorIndex,h=a.GetCurrentSol().GetInstances(),j=[];for(let a=0,i=h.length;a<i;++a){const i=h[a];for(let b=0,c=d.length;b<c;++b)e[b]=d[b].Get(a);const k=b?i.GetObjectClass().GetFamilyBehaviorOffset(c):0;j.push(f.apply(i.GetBehaviorInstances()[g+k].GetSdkInstance(),e))}return Promise.all(j)}*_DebugRunBehavior_Async(){if((this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this._DebugReturnsGenerator()){const a=this._objectClass,b=a.IsFamily(),c=a.GetFamilyIndex(),d=this._parameters,e=this._results,f=this._func,g=this._behaviorIndex,h=a.GetCurrentSol().GetInstances(),j=[];for(let a=0,i=h.length;a<i;++a){const i=h[a];for(let b=0,c=d.length;b<c;++b)e[b]=d[b].Get(a);const k=b?i.GetObjectClass().GetFamilyBehaviorOffset(c):0;j.push((yield*f.apply(i.GetBehaviorInstances()[g+k].GetSdkInstance(),e)))}return Promise.all(j)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(a){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;",a),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),C3.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"),C3.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){return(this.IsBreakpoint()||this._runtime.DebugBreakNext())&&(yield this),this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{"ex":C3.ToSuperJSON(this._savedData)}:null}_LoadFromJson(a){this._savedData&&(this._savedData.clear(),this._savedData=null);const b=a["ex"];b&&(this._savedData=C3.FromSuperJSON(b))}}}
// c3/events/commonACEs.js
"use strict";{function a(a,b){return C3.compare(this.GetWorldInfo().GetX(),a,b)}function b(a,b){return C3.compare(this.GetWorldInfo().GetY(),a,b)}function c(){const a=this.GetWorldInfo();return a.IsInViewport(a.GetLayer().GetViewport())}function d(){const a=this.GetWorldInfo(),b=a.GetLayout(),c=a.GetBoundingBox();return 0>c.getRight()||0>c.getBottom()||c.getLeft()>b.GetWidth()||c.getTop()>b.GetHeight()}function e(a,b,c){const d=this.GetCurrentSol(),e=d.GetInstances();if(!e.length)return!1;let f=e[0],g=f.GetWorldInfo(),h=f,j=C3.distanceSquared(g.GetX(),g.GetY(),b,c);for(let d=1,i=e.length;d<i;++d){f=e[d],g=f.GetWorldInfo();const i=C3.distanceSquared(g.GetX(),g.GetY(),b,c);(0===a&&i<j||1===a&&i>j)&&(j=i,h=f)}return d.PickOne(h),!0}function f(a){const b=this.GetWorldInfo();b.GetX()===a||(b.SetX(a),b.SetBboxChanged())}function g(a){const b=this.GetWorldInfo();b.GetY()===a||(b.SetY(a),b.SetBboxChanged())}function h(a,b){const c=this.GetWorldInfo();c.EqualsXY(a,b)||(c.SetXY(a,b),c.SetBboxChanged())}function i(a,b){if(a){const c=a.GetPairedInstance(this._inst);if(c){const[a,d]=c.GetImagePoint(b),e=this.GetWorldInfo();e.GetX()===a&&e.GetY()===d||(e.SetXY(a,d),e.SetBboxChanged())}}}function j(a){if(0!==a){const b=this.GetWorldInfo();b.OffsetXY(b.GetCosAngle()*a,b.GetSinAngle()*a),b.SetBboxChanged()}}function k(b,a){if(0!==a){const c=this.GetWorldInfo();b=C3.toRadians(b),c.OffsetXY(Math.cos(b)*a,Math.sin(b)*a),c.SetBboxChanged()}}function l(){return this.GetWorldInfo().GetX()}function m(){return this.GetWorldInfo().GetY()}function n(){return this._runtime.GetDt(this._inst)}function o(a,b){return C3.compare(this.GetWorldInfo().GetWidth(),a,b)}function p(a,b){return C3.compare(this.GetWorldInfo().GetHeight(),a,b)}function q(a){const b=this.GetWorldInfo();b.GetWidth()===a||(b.SetWidth(a),b.SetBboxChanged())}function r(a){const b=this.GetWorldInfo();b.GetHeight()===a||(b.SetHeight(a),b.SetBboxChanged())}function s(a,b){const c=this.GetWorldInfo();c.GetWidth()===a&&c.GetHeight()===b||(c.SetSize(a,b),c.SetBboxChanged())}function t(){return this.GetWorldInfo().GetWidth()}function u(){return this.GetWorldInfo().GetHeight()}function v(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function w(){return this.GetWorldInfo().GetBoundingBox().getTop()}function x(){return this.GetWorldInfo().GetBoundingBox().getRight()}function y(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function z(b,c){return C3.angleDiff(this.GetWorldInfo().GetAngle(),C3.toRadians(c))<=C3.toRadians(b)}function A(b){return C3.angleClockwise(this.GetWorldInfo().GetAngle(),C3.toRadians(b))}function B(c,a){const b=C3.toRadians(c),d=C3.toRadians(a),e=this.GetWorldInfo().GetAngle(),f=!C3.angleClockwise(d,b);return f?C3.angleClockwise(e,b)||!C3.angleClockwise(e,d):C3.angleClockwise(e,b)&&!C3.angleClockwise(e,d)}function C(b){const a=this.GetWorldInfo(),c=C3.clampAngle(C3.toRadians(b));isNaN(c)||a.GetAngle()===c||(a.SetAngle(c),a.SetBboxChanged())}function D(b){if(!(isNaN(b)||0===b)){const a=this.GetWorldInfo();a.SetAngle(a.GetAngle()+C3.toRadians(b)),a.SetBboxChanged()}}function E(b){if(!(isNaN(b)||0===b)){const a=this.GetWorldInfo();a.SetAngle(a.GetAngle()-C3.toRadians(b)),a.SetBboxChanged()}}function F(b,c){const d=this.GetWorldInfo(),e=d.GetAngle(),a=C3.angleRotate(e,C3.toRadians(c),C3.toRadians(b));isNaN(a)||e===a||(d.SetAngle(a),d.SetBboxChanged())}function G(b,c,d){const e=this.GetWorldInfo(),f=e.GetAngle(),a=c-e.GetX(),g=d-e.GetY(),h=Math.atan2(g,a),i=C3.angleRotate(f,h,C3.toRadians(b));isNaN(i)||f===i||(e.SetAngle(i),e.SetBboxChanged())}function H(b,c){const d=this.GetWorldInfo(),e=d.GetAngle(),a=b-d.GetX(),f=c-d.GetY(),g=Math.atan2(f,a);isNaN(g)||e===g||(d.SetAngle(g),d.SetBboxChanged())}function I(){return C3.toDegrees(this.GetWorldInfo().GetAngle())}function J(a,b){return C3.compare(C3.round6dp(100*this.GetWorldInfo().GetOpacity()),a,b)}function K(){return this.GetWorldInfo().IsVisible()}function L(a){const b=this.GetWorldInfo();a=2===a?!b.IsVisible():0!=a;b.IsVisible()===a||(b.SetVisible(a),this._runtime.UpdateRender())}function M(a){const b=C3.clamp(a/100,0,1),c=this.GetWorldInfo();c.GetOpacity()===b||(c.SetOpacity(b),this._runtime.UpdateRender())}function N(a){ya.setFromRgbValue(a);const b=this.GetWorldInfo();b.GetUnpremultipliedColor().equalsIgnoringAlpha(ya)||(b.SetUnpremultipliedColor(ya),this._runtime.UpdateRender())}function O(){const a=this.GetWorldInfo().GetUnpremultipliedColor();return C3.PackRGBAEx(a.getR(),a.getG(),a.getB(),a.getA())}function P(){return C3.round6dp(100*this.GetWorldInfo().GetOpacity())}function Q(a){return!!a&&this.GetWorldInfo().GetLayer()===a}function R(a){const b=this.GetCurrentSol(),c=b.GetInstances();if(!c.length)return!1;let d=c[0],e=d;for(let b=1,d=c.length;b<d;++b){const d=c[b],f=d.GetWorldInfo(),g=e.GetWorldInfo(),h=f.GetLayer().GetIndex(),i=g.GetLayer().GetIndex();0===a?(h>i||h===i&&f.GetZIndex()>g.GetZIndex())&&(e=d):(h<i||h===i&&f.GetZIndex()<g.GetZIndex())&&(e=d)}return b.PickOne(e),!0}function S(a,b,c){const d=this.GetWorldInfo(),e=0===a?d.GetZElevation():d.GetTotalZElevation();return C3.compare(e,b,c)}function T(){this.GetWorldInfo().ZOrderMoveToTop()}function U(){this.GetWorldInfo().ZOrderMoveToBottom()}function V(a){a&&this.GetWorldInfo().ZOrderMoveToLayer(a)}function W(a,b){if(b){const c=b.GetFirstPicked(this.GetInstance());c&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(c,0===a)}}function X(a){const b=this.GetWorldInfo();b.GetZElevation()===a||(b.SetZElevation(a),this._runtime.UpdateRender())}function Y(){return this.GetWorldInfo().GetLayer().GetIndex()}function Z(){return this.GetWorldInfo().GetLayer().GetName()}function $(){return this.GetWorldInfo().GetZIndex()}function _(){return this.GetWorldInfo().GetZElevation()}function aa(){return this.GetWorldInfo().GetTotalZElevation()}function ba(a,b){const c=this.GetObjectClass().GetEffectList().GetEffectTypeByName(b);if(c){const b=c.GetIndex(),d=1===a,e=this.GetWorldInfo().GetInstanceEffectList();e.IsEffectIndexActive(b)===d||(e.SetEffectIndexActive(b,d),e.UpdateActiveEffects(),this._runtime.UpdateRender())}}function ca(a,b,c){const d=this.GetObjectClass().GetEffectList().GetEffectTypeByName(a);if(d){const a=d.GetIndex(),e=this.GetWorldInfo().GetInstanceEffectList(),f=e.GetEffectParametersForIndex(a);if(b=Math.floor(b),!(0>b||b>=f.length)){const g=d.GetShaderProgram().GetParameterType(b);if("color"===g){ya.setFromRgbValue(c);const a=f[b];if(ya.equalsIgnoringAlpha(a))return;a.copyRgb(ya)}else{if("percent"===g&&(c/=100),f[b]===c)return;f[b]=c}e.IsEffectIndexActive(a)&&this._runtime.UpdateRender()}}}function da(a,b,c){return C3.compare(this.GetInstance().GetInstanceVariableValue(a),b,c)}function ea(a){return!!this.GetInstance().GetInstanceVariableValue(a)}function fa(a,b){const c=this.GetCurrentSol(),d=c.GetInstances();if(!d.length)return!1;let e=d[0],f=e,g=e.GetInstanceVariableValue(b);for(let c=1,h=d.length;c<h;++c){e=d[c];const h=e.GetInstanceVariableValue(b);(0===a&&h<g||1===a&&h>g)&&(g=h,f=e)}return c.PickOne(f),!0}function ga(a){return this._runtime.GetCurrentCondition().IsInverted()?ia(this,a):ha(this,a)}function ha(a,b){const c=a.GetRuntime().GetInstanceByUID(b);if(!c)return!1;const d=a.GetCurrentSol();if(!d.IsSelectAll()&&!d._GetOwnInstances().includes(c))return!1;if(a.IsFamily()){if(c.GetObjectClass().BelongsToFamily(a))return d.PickOne(c),a.ApplySolToContainer(),!0;}else if(c.GetObjectClass()===a)return d.PickOne(c),a.ApplySolToContainer(),!0;return!1}function ia(a,b){const c=a.GetCurrentSol();if(c.IsSelectAll()){c._SetSelectAll(!1),c.ClearArrays();const d=a.GetInstances();for(let a=0,e=d.length;a<e;++a){const e=d[a];e.GetUID()===b?c._PushElseInstance(e):c._PushInstance(e)}return a.ApplySolToContainer(),!!c._GetOwnInstances().length}else{const d=c._GetOwnInstances();let e=0;for(let a=0,f=d.length;a<f;++a){const f=d[a];d[e]=f,f.GetUID()===b?c._PushElseInstance(f):++e}return C3.truncateArray(d,e),a.ApplySolToContainer(),!!d.length}}function ja(){this._runtime.DestroyInstance(this._inst)}function ka(){return!0}function la(){return!0}function ma(a,b){this.GetInstance().SetInstanceVariableValue(a,b)}function na(a,b){const c=this.GetInstance(),d=c.GetInstanceVariableValue(a);"number"==typeof d&&"number"!=typeof b?b=parseFloat(b):"string"==typeof d&&"string"!=typeof b&&(b=b.toString()),c.SetInstanceVariableValue(a,d+b)}function oa(a,b){const c=this.GetInstance(),d=c.GetInstanceVariableValue(a);"number"!=typeof d||("number"!=typeof b&&(b=parseFloat(b)),c.SetInstanceVariableValue(a,d-b))}function pa(a,b){this.GetInstance().SetInstanceVariableValue(a,b?1:0)}function qa(a){const b=this.GetInstance();b.SetInstanceVariableValue(a,0===b.GetInstanceVariableValue(a)?1:0)}function ra(a){let b;try{b=JSON.parse(a)}catch(a){return void console.error("Failed to load from JSON string: ",a)}this.GetInstance().LoadFromJson(b,"state")}function sa(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function ta(){return this.GetInstance().GetObjectClass().GetName()}function ua(){const a=this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let b=a.GetInstanceCount();const c=this._runtime._GetInstancesPendingCreate();for(const d of c)a.IsFamily()?d.GetObjectClass().BelongsToFamily(a)&&++b:d.GetObjectClass()===a&&++b;return b}function va(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}function wa(){return this._inst.GetIID()}function xa(){return this._inst.GetUID()}const ya=new C3.Color;C3.AddCommonACEs=function(ha,ia){const ya=ha[1],za=ha[3],Aa=ha[4],Ba=ha[5],Ca=ha[6],Da=ha[7],Ea=ha[8],Fa=ia.Cnds,Ga=ia.Acts,Ha=ia.Exps;za&&(Fa.CompareX=a,Fa.CompareY=b,Fa.IsOnScreen=c,Fa.IsOutsideLayout=d,Fa.PickDistance=e,Ga.SetX=f,Ga.SetY=g,Ga.SetPos=h,Ga.SetPosToObject=i,Ga.MoveForward=j,Ga.MoveAtAngle=k,Ha.X=l,Ha.Y=m,Ha.dt=n),Aa&&(Fa.CompareWidth=o,Fa.CompareHeight=p,Ga.SetWidth=q,Ga.SetHeight=r,Ga.SetSize=s,Ha.Width=t,Ha.Height=u,Ha.BBoxLeft=v,Ha.BBoxTop=w,Ha.BBoxRight=x,Ha.BBoxBottom=y),Ba&&(Fa.AngleWithin=z,Fa.IsClockwiseFrom=A,Fa.IsBetweenAngles=B,Ga.SetAngle=C,Ga.RotateClockwise=D,Ga.RotateCounterclockwise=E,Ga.RotateTowardAngle=F,Ga.RotateTowardPosition=G,Ga.SetTowardPosition=H,Ha.Angle=I),Ca&&(Fa.IsVisible=K,Fa.CompareOpacity=J,Ga.SetVisible=L,Ga.SetOpacity=M,Ga.SetDefaultColor=N,Ha.Opacity=P,Ha.ColorValue=O),Da&&(Fa.IsOnLayer=Q,Fa.PickTopBottom=R,Fa.CompareZElevation=S,Ga.MoveToTop=T,Ga.MoveToBottom=U,Ga.MoveToLayer=V,Ga.ZMoveToObject=W,Ga.SetZElevation=X,Ha.LayerNumber=Y,Ha.LayerName=Z,Ha.ZIndex=$,Ha.ZElevation=_,Ha.TotalZElevation=aa),Ea&&(Ga.SetEffectEnabled=ba,Ga.SetEffectParam=ca),ya||(Fa.CompareInstanceVar=da,Fa.IsBoolInstanceVarSet=ea,Fa.PickInstVarHiLow=fa,Fa.PickByUID=ga,Ga.SetInstanceVar=ma,Ga.AddInstanceVar=na,Ga.SubInstanceVar=oa,Ga.SetBoolInstanceVar=pa,Ga.ToggleBoolInstanceVar=qa,Fa.OnCreated=ka,Fa.OnDestroyed=la,Ga.Destroy=ja,!Ga.LoadFromJsonString&&(Ga.LoadFromJsonString=ra),!Ha.AsJSON&&(Ha.AsJSON=sa),Ha.Count=ua,Ha.PickedCount=va,Ha.IID=wa,Ha.UID=xa,Ha.ObjectTypeName=ta)}}
// c3/events/scheduledWait.js
"use strict";C3.ScheduledWait=class extends C3.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._functionParameters=null,this._shouldRelease=!1}Release(){this._type="",this._time=-1,this._signalTag="",this._event=null,this._callingFunctionBlock=null,this._functionParameters=null,this._asyncId=-1,C3.clearArray(this._solModifiers);for(const a of this._sols.values())a.Release();this._sols.clear()}_Init(){const a=this._eventSheetManager,b=a.GetRuntime().GetAllObjectClasses(),c=a.GetCurrentEventStackFrame();this._event=c.GetCurrentEvent(),this._actIndex=c.GetActionIndex()+1;const d=a.FindFirstFunctionBlockParent(this._event);d&&(this._callingFunctionBlock=d,this._functionParameters=d.CaptureFunctionParameters(),d.IsAsync()&&(this._asyncId=d.PauseCurrentAsyncFunction()));for(const a of b){const b=a.GetCurrentSol();b.IsSelectAll()&&!this._event.HasSolModifier(a)||(this._solModifiers.push(a),this._sols.set(a,C3.New(C3.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((a)=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",a),this.SetSignalled()})}IsTimer(){return"timer"===this._type}IsSignal(){return"signal"===this._type}IsPromise(){return"promise"===this._type}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=!0}_ShouldRun(){return this.IsTimer()?this._time<=this._eventSheetManager.GetRuntime().GetGameTime():this.IsSignalled()}_RestoreState(a){a._Restore(this._event,this._actIndex);for(const[b,c]of this._sols.entries()){const a=b.GetCurrentSol();c._Restore(a)}const b=this._callingFunctionBlock;b&&(b.SetFunctionParameters(this._functionParameters),b.IsAsync()&&b.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((a)=>a.GetSID()),"sols":a};this._event._HasActionIndex(this._actIndex)&&(b["act"]=this._event.GetActionAt(this._actIndex).GetSID());for(const[b,c]of this._sols)a[b.GetSID().toString()]=c._SaveToJson();return b}static _CreateFromJson(a,b){const c=a.GetRuntime(),d=a.GetEventBlockBySID(b["ev"]);if(!d)return null;let e=0;if(b.hasOwnProperty("act")){const c=a.GetActionBySID(b["act"]);if(!c)return null;e=c.GetIndex()}const f=C3.New(C3.ScheduledWait,a);f._time=b["t"],f._type=-1===f._time?"signal":"timer",f._signalTag=b["st"],f._isSignalled=b["s"],f._event=d,f._actIndex=e;for(const d of b["sm"]){const a=c.GetObjectClassBySID(d);a&&f._solModifiers.push(a)}for(const[d,e]of Object.entries(b["sols"])){const b=parseInt(d,10),g=c.GetObjectClassBySID(b);if(!g)continue;const h=C3.New(C3.SolState,null);h._LoadFromJson(a,e),f._sols.set(g,h)}return f}};
// c3/events/solState.js
"use strict";C3.SolState=class extends C3.DefendedBase{constructor(a){super(),this._objectClass=null,this._isSelectAll=!0,this._instances=[],a&&(this._objectClass=a.GetObjectClass(),this._isSelectAll=a.IsSelectAll(),C3.shallowAssignArray(this._instances,a._GetOwnInstances()))}Release(){this._objectClass=null,C3.clearArray(this._instances)}_Restore(a){a._SetSelectAll(this._isSelectAll),C3.shallowAssignArray(a._GetOwnInstances(),this._instances)}RemoveInstances(a){C3.arrayRemoveAllInSet(this._instances,a)}_SaveToJson(){return{"sa":this._isSelectAll,"insts":this._instances.map((a)=>a.GetUID())}}_LoadFromJson(a,b){const c=a.GetRuntime();this._isSelectAll=!!b["sa"],C3.clearArray(this._instances);for(const d of b["insts"]){const a=c.GetInstanceByUID(d);a&&this._instances.push(a)}}};
// c3/sdk/sdkPluginBase.js
"use strict";{function a(a,b){let c=a.get(b);return c||(c=new Map,a.set(b,c)),c}C3.SDKPluginBase=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a.runtime,this._isSingleGlobal=!!a.isSingleGlobal,this._isWorldType=!!a.isWorld,this._isRotatable=!!a.isRotatable,this._mustPredraw=!!a.mustPredraw,this._hasEffects=!!a.hasEffects,this._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}_GetBoundACEMethod(a,b){if(!b)throw new Error("missing 'this' binding");let c=this._boundACEMethodCache.get(a);return c?c:(c=a.bind(b),this._boundACEMethodCache.set(a,c),c)}_GetBoundACEMethod_1param(b,c,d){if(!c)throw new Error("missing 'this' binding");const e=a(this._boundACEMethodCache_1param,b);let f=e.get(d);return f?f:(f=b.bind(c,d),e.set(d,f),f)}_GetBoundACEMethod_2params(b,c,d,e){if(!c)throw new Error("missing 'this' binding");const f=a(this._boundACEMethodCache_2params,b),g=a(f,d);let h=g.get(e);return h?h:(h=b.bind(c,d,e),g.set(e,h),h)}_GetBoundACEMethod_3params(b,c,d,e,f){if(!c)throw new Error("missing 'this' binding");const g=a(this._boundACEMethodCache_3params,b),h=a(g,d),i=a(h,e);let j=i.get(f);return j?j:(j=b.bind(c,d,e,f),i.set(f,j),j)}_SetSingleGlobalObjectClass(a){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");this._singleGlobalObjectClass=a}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw new Error("must be single-global plugin");return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}}
// c3/sdk/sdkDOMPluginBase.js
"use strict";C3.SDKDOMPluginBase=class extends C3.SDKPluginBase{constructor(a,b){super(a),this._domComponentId=b,this._nextElementId=0,this._instMap=new Map}Release(){super.Release()}_AddElement(a){const b=this._nextElementId++;return this._instMap.set(b,a),b}_RemoveElement(a){this._instMap.delete(a)}AddElementMessageHandler(a,b){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,a,(a)=>{const c=this._instMap.get(a["elementId"]);b(c,a)})}};
// c3/sdk/sdkTypeBase.js
"use strict";C3.SDKTypeBase=class extends C3.DefendedBase{constructor(a){super(),this._objectClass=a,this._runtime=a.GetRuntime(),this._plugin=a.GetPlugin()}Release(){this._objectClass=null,this._runtime=null,this._plugin=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}FinishCondition(){}LoadTextures(){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(){}LoadTilePolyData(){}GetScriptInterfaceClass(){return null}};
// c3/sdk/sdkInstanceBase.js
"use strict";C3.SDKInstanceBase=class extends C3.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._tickFunc=null,this._tick2Func=null,this._isTicking=!1,this._isTicking2=!1,this._disposables=null,this._wasReleased=!1}Release(){this._wasReleased=!0,this._StopTicking(),this._StopTicking2(),this._tickFunc=null,this._tick2Func=null,this._disposables&&(this._disposables.Release(),this._disposables=null),this._inst=null,this._runtime=null,this._objectClass=null,this._sdkType=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,c]of a)this.AddDOMMessageHandler(b,c)}PostToDOM(a,b){this._runtime.PostComponentMessageToDOM(this._domComponentId,a,b)}PostToDOMAsync(a,b){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,a,b)}_PostToDOMMaybeSync(a,b){this._runtime.IsInWorker()?this.PostToDOM(a,b):window["c3_runtimeInterface"]["_OnMessageFromRuntime"]({"type":"event","component":this._domComponentId,"handler":a,"data":b,"responseId":null})}GetCurrentImageInfo(){return null}GetImagePoint(){const a=this._inst.GetWorldInfo();return[a.GetX(),a.GetY()]}Tick(){}Tick2(){}_StartTicking(){this._isTicking||(!this._tickFunc&&(this._tickFunc=()=>this.Tick()),this._runtime.Dispatcher().addEventListener("tick",this._tickFunc),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(!this._tick2Func&&(this._tick2Func=()=>this.Tick2()),this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(){}LoadTilemapData(){}TestPointOverlapTile(){}GetPropertyValueByIndex(){}SetPropertyValueByIndex(){}OffsetPropertyValueByIndex(a,b){if(0!==b){const c=this.GetPropertyValueByIndex(a);if("number"!=typeof c)throw new Error("expected number");this.SetPropertyValueByIndex(a,c+b)}}SetPropertyColorOffsetValueByIndex(){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}GetScriptInterfaceClass(){return null}};
// c3/sdk/sdkWorldInstanceBase.js
"use strict";C3.SDKWorldInstanceBase=class extends C3.SDKInstanceBase{constructor(a,b){super(a,b),this._worldInfo=a.GetWorldInfo(),this._webglcontextlost_handler=null,this._webglcontextrestored_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._webglcontextlost_handler=null,this._webglcontextrestored_handler=null}this._worldInfo=null,super.Release()}HandleWebGLContextLoss(){if(!this._webglcontextlost_handler){this._webglcontextlost_handler=()=>this.OnWebGLContextLost(),this._webglcontextrestored_handler=()=>this.OnWebGLContextRestored();const a=this._runtime.Dispatcher();a.addEventListener("webglcontextlost",this._webglcontextlost_handler),a.addEventListener("webglcontextrestored",this._webglcontextrestored_handler)}}OnWebGLContextLost(){}OnWebGLContextRestored(){}GetWorldInfo(){return this._worldInfo}};
// c3/sdk/sdkDOMInstanceBase.js
"use strict";{const a=C3.New(C3.Rect);C3.SDKDOMInstanceBase=class extends C3.SDKWorldInstanceBase{constructor(a,b){super(a,b),this._elementId=this.GetPlugin()._AddElement(this),this._isElementShowing=!0,this._autoFontSize=!1,this._lastRect=C3.New(C3.Rect,0,0,-1,-1);const c=this._runtime.GetCanvasManager();this._lastWindowWidth=c.GetLastWidth(),this._lastWindowHeight=c.GetLastHeight(),this._isPendingUpdateState=!1,this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId),this.PostToDOMElement("destroy"),this._elementId=-1,super.Release()}PostToDOMElement(a,b){b||(b={}),b["elementId"]=this._elementId,this.PostToDOM(a,b)}_PostToDOMElementMaybeSync(a,b){b||(b={}),b["elementId"]=this._elementId,this._PostToDOMMaybeSync(a,b)}PostToDOMElementAsync(a,b){return b||(b={}),b["elementId"]=this._elementId,this.PostToDOMAsync(a,b)}CreateElement(a){a||(a={});const b=this.GetWorldInfo().IsVisible();a["elementId"]=this._elementId,a["isVisible"]=b,Object.assign(a,this.GetElementState()),this._isElementShowing=!!a["isVisible"],this.PostToDOM("create",a),this._UpdatePosition(!0)}SetElementVisible(a){a=!!a;this._isElementShowing===a||(this._isElementShowing=a,this.PostToDOMElement("set-visible",{"isVisible":a}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const a=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===C3.Platform.OS&&("scale-inner"===a||"scale-outer"===a||"crop"===a)}_UpdatePosition(b){var c=Math.round;const d=this.GetWorldInfo(),e=d.GetLayer(),f=d.GetX(),g=d.GetY();let[h,i]=e.LayerToCanvasCss(f,g),[j,k]=e.LayerToCanvasCss(f+d.GetWidth(),g+d.GetHeight());const l=this._runtime.GetCanvasManager(),m=l.GetCssWidth(),n=l.GetCssHeight();if(!d.IsVisible()||!e.IsVisible())return void this.SetElementVisible(!1);if(!this._ShouldPreserveElement()){if(0>=j||0>=k||h>=m||i>=n)return void this.SetElementVisible(!1);1>h&&(h=1),1>i&&(i=1),j>=m&&(j=m-1),k>=n&&(k=n-1)}a.set(h,i,j,k);const o=l.GetLastWidth(),p=l.GetLastHeight();if(!b&&a.equals(this._lastRect)&&this._lastWindowWidth===o&&this._lastWindowHeight===p)return void this.SetElementVisible(!0);this._lastRect.copy(a),this._lastWindowWidth=o,this._lastWindowHeight=p,this.SetElementVisible(!0);let q=null;this._autoFontSize&&(q=e.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{"left":c(this._lastRect.getLeft())+l.GetCanvasClientX(),"top":c(this._lastRect.getTop())+l.GetCanvasClientY(),"width":c(this._lastRect.width()),"height":c(this._lastRect.height()),"fontSize":q})}FocusElement(){this.PostToDOMElement("focus",{"focus":!0})}BlurElement(){this.PostToDOMElement("focus",{"focus":!1})}SetElementCSSStyle(a,b){this.PostToDOMElement("set-css-style",{"prop":C3.CSSToCamelCase(a),"val":b})}UpdateElementState(){this._isPendingUpdateState||(this._isPendingUpdateState=!0,Promise.resolve().then(()=>{this._isPendingUpdateState=!1,this.PostToDOMElement("update-state",this.GetElementState())}))}GetElementState(){}GetElementId(){return this._elementId}}}
// c3/sdk/sdkBehaviorBase.js
"use strict";C3.SDKBehaviorBase=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a.runtime,this._myObjectClasses=C3.New(C3.ArraySet),this._myInstances=C3.New(C3.ArraySet),this._iBehavior=null;const b=a.scriptInterfaceClass;if(!b)this._iBehavior=new IBehavior(this);else if(this._iBehavior=new b(this),!(this._iBehavior instanceof IBehavior))throw new TypeError("script interface class must derive from IBehavior")}Release(){this._myInstances.Release(),this._myObjectClasses.Release(),this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(a){this._myObjectClasses.Add(a)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(a){this._myInstances.Add(a)}_RemoveInstance(a){this._myInstances.Delete(a)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){return this._iBehavior}};
// c3/sdk/sdkBehaviorTypeBase.js
"use strict";C3.SDKBehaviorTypeBase=class extends C3.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._runtime=null,this._behaviorType=null,this._objectClass=null,this._behavior=null}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}};
// c3/sdk/sdkBehaviorInstanceBase.js
"use strict";C3.SDKBehaviorInstanceBase=class extends C3.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._isTicking=!1,this._isTicking2=!1,this._isPostTicking=!1,this._disposables=null}Release(){this._StopTicking(),this._StopTicking2(),this._StopPostTicking(),this._disposables&&(this._disposables.Release(),this._disposables=null),this._behInst=null,this._inst=null,this._runtime=null,this._behaviorType=null,this._sdkType=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}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(){}SaveToJson(){return null}LoadFromJson(){}GetPropertyValueByIndex(){}SetPropertyValueByIndex(){}OffsetPropertyValueByIndex(a,b){if(0!==b){const c=this.GetPropertyValueByIndex(a);if("number"!=typeof c)throw new Error("expected number");this.SetPropertyValueByIndex(a,c+b)}}SetPropertyColorOffsetValueByIndex(){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}GetScriptInterfaceClass(){return null}};
// c3/interfaces/IRuntime.js
"use strict";{function a(c,a){const b=c[0],d=a[0],e=b-d;if(0!=e)return e;const f=c[1],g=a[1];return f-g}let b=null;const c=new Set;const d=[],e=[];let f=!1;self.IRuntime=class{constructor(a,d){b=a,Object.defineProperties(this,{assets:{value:b.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:d,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:b.GetProjectName(),writable:!1},projectVersion:{value:b.GetProjectVersion(),writable:!1},storage:{value:new IStorage(b),writable:!1},isInWorker:{value:b.IsInWorker(),writable:!1}}),b.UserScriptDispatcher().addEventListener("keydown",(a)=>c.has(a["key"])?void a.stopPropagation():void c.add(a["key"])),b.UserScriptDispatcher().addEventListener("keyup",(a)=>c.delete(a["key"])),b.Dispatcher().addEventListener("window-blur",()=>c.clear()),b.IsInWorker()&&(self["alert"]=(a)=>(f||(f=!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.")),this.alert(a)))}_InitGlobalVars(a){Object.defineProperties(this.globalVars,a)}addEventListener(a,c){b.UserScriptDispatcher().addEventListener(a,c)}removeEventListener(a,c){b.UserScriptDispatcher().removeEventListener(a,c)}callFunction(a,...c){const d=b.GetEventSheetManager(),e=d.GetFunctionBlockByName(a);if(!e)throw new Error(`cannot find function name '${a}'`);if(!e.IsEnabled())return e.GetDefaultReturnValue();if(c.length<e.GetFunctionParameterCount())throw new Error(`not enough function parameters passed for '${a}' (${c.length} passed, ${e.GetFunctionParameterCount()} expected)`);const f=e.GetEventBlock();let g=null;const h=d.GetCurrentEvent();if(h){const a=h.GetSolModifiersIncludingParents();0<a.length&&(g=a,d.PushCleanSol(a))}const i=f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),e.GetReturnType(),e.GetDefaultReturnValue(),...c);return g&&d.PopSol(g),i}setReturnValue(a){const c=b.GetEventStack().GetCurrentExpFuncStackFrame();if(!c)throw new Error("not in a function which returns a value");switch(c.GetFunctionReturnType()){case 1:"number"==typeof a&&c.SetFunctionReturnValue(a);break;case 2:"string"==typeof a&&c.SetFunctionReturnValue(a);break;case 3:("number"==typeof a||"string"==typeof a)&&c.SetFunctionReturnValue(a);}}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(a){const c=b.GetLayoutManager();let d=null;if("number"==typeof a||"string"==typeof a)d=c.GetLayout(a);else throw new TypeError("expected string or number");if(!d)throw new Error("invalid layout");return d.GetILayout()}getAllLayouts(){return b.GetLayoutManager().GetAllLayouts().map((a)=>a.GetILayout())}goToLayout(a){const c=b.GetLayoutManager();let d=null;if("number"==typeof a||"string"==typeof a)d=c.GetLayout(a);else throw new TypeError("expected string or number");if(!d)throw new Error("invalid layout");c.IsPendingChangeMainLayout()||c.ChangeMainLayout(d)}get keyboard(){const a=b._GetCommonScriptInterfaces().keyboard;if(!a)throw new Error("runtime.keyboard used but Keyboard object missing - add it to your project first");return a}get mouse(){const a=b._GetCommonScriptInterfaces().mouse;if(!a)throw new Error("runtime.mouse used but Mouse object missing - add it to your project first");return a}get touch(){const a=b._GetCommonScriptInterfaces().touch;if(!a)throw new Error("runtime.touch used but Touch object missing - add it to your project first");return a}invokeDownload(a,c){b.InvokeDownload(a,c)}getInstanceByUid(a){const c=b.GetInstanceByUID(a);return c?c.GetInterfaceClass():null}sortZOrder(c,f){const g=b.GetCurrentLayout();for(const a of c){const c=b._UnwrapScriptInterface(a);if(!c||!c.GetWorldInfo())throw new Error("invalid instance");const f=c.GetWorldInfo();d.push([f.GetLayer().GetIndex(),f.GetZIndex()]),e.push(c)}if(0===d.length)return;d.sort(a),e.sort((c,a)=>f(c.GetInterfaceClass(),a.GetInterfaceClass()));let h=!1;for(let a=0,b=d.length;a<b;++a){const b=e[a],c=g.GetLayerByIndex(d[a][0]),f=d[a][1],i=c._GetInstances();i[f]!==b&&(i[f]=b,b.GetWorldInfo()._SetLayer(c),c.SetZIndicesChanged(),h=!0)}h&&b.UpdateRender(),C3.clearArray(d),C3.clearArray(e)}alert(a){return b.PostComponentMessageToDOMAsync("runtime","alert",{"message":a})}}}
// c3/interfaces/IAssetManager.js
"use strict";{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){return C3.IsRelativeURL(b)&&(b=b.toLowerCase()),a.GetMediaFileUrl(b,a.GetMediaSubfolder())}get mediaFolder(){return a.GetMediaSubfolder()}async decodeWebMOpus(b,c){if(this.isWebMOpusSupported)throw new Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");const d=await a.GetRuntime()._WasmDecodeWebMOpus(c),e=new Float32Array(d),f=b["createBuffer"](1,e.length,48e3),g=f["getChannelData"](0);return g.set(e),f}loadScripts(...b){return a.LoadScripts(...b)}compileWebAssembly(b){return a.CompileWebAssembly(b)}loadStyleSheet(b){return a.LoadStyleSheet(b)}}}
// c3/interfaces/IStorage.js
"use strict";self.IStorage=class{constructor(a){this._storage=a._GetProjectStorage()}getItem(a){return this._storage.getItem(a)}setItem(a,b){return this._storage.setItem(a,b)}removeItem(a){return this._storage.removeItem(a)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}};
// c3/interfaces/IObjectClass.js
"use strict";{const 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)}getAllInstances(){return a.get(this).GetInstances().map((a)=>a.GetInterfaceClass())}getFirstInstance(){const b=a.get(this).GetInstances();return 0<b.length?b[0].GetInterfaceClass():null}getPickedInstances(){return a.get(this).GetCurrentSol().GetInstances().map((a)=>a.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){const c=a.get(this);if(0<c.GetInstanceCount())throw new Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");a.get(this)._SetUserScriptInstanceClass(b)}createInstance(b,c,d){if("number"!=typeof b&&"string"!=typeof b)throw new TypeError("invalid layer parameter");const e=a.get(this),f=e.GetRuntime(),g=f.GetMainRunningLayout().GetLayer(b);if(!g)throw new Error("invalid layer");const h=f.CreateInstance(e,g,c,d),i=f.GetEventSheetManager();if(i.BlockFlushingInstances(!0),h._TriggerOnCreated(),h.IsInContainer())for(const a of h.siblings())a._TriggerOnCreated();return i.BlockFlushingInstances(!1),h.GetInterfaceClass()}}}
// c3/interfaces/ILayout.js
"use strict";{const a=new WeakMap;self.ILayout=class{constructor(b){a.set(this,b),Object.defineProperties(this,{name:{value:b.GetName(),writable:!1},index:{value:b.GetIndex(),writable:!1}})}addEventListener(b,c){a.get(this).UserScriptDispatcher().addEventListener(b,c)}removeEventListener(b,c){a.get(this).UserScriptDispatcher().removeEventListener(b,c)}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)}scrollTo(b,c){const d=a.get(this);d.SetScrollX(b),d.SetScrollY(c)}getLayer(b){const c=a.get(this);let d=null;if("number"==typeof b||"string"==typeof b)d=c.GetLayer(b);else throw new TypeError("expected string or number");if(!d)throw new Error("invalid layer");return d.GetILayer()}getAllLayers(){return a.get(this).GetLayers().map((a)=>a.GetILayer())}}}
// c3/interfaces/ILayer.js
"use strict";{const a=new WeakMap;self.ILayer=class{constructor(b){a.set(this,b),Object.defineProperties(this,{name:{value:b.GetName(),writable:!1},index:{value:b.GetIndex(),writable:!1},layout:{value:b.GetLayout().GetILayout(),writable:!1}})}static _Unwrap(b){return a.get(b)}get isVisible(){return a.get(this).IsVisible()}set isVisible(b){a.get(this).SetVisible(b)}get opacity(){return a.get(this).GetOpacity()}set opacity(b){b=C3.clamp(+b,0,1);isNaN(b)||a.get(this).SetOpacity(b)}getViewport(){return a.get(this).GetViewport().toDOMRect()}}}
// c3/interfaces/IInstance.js
"use strict";{function a(a){let b=c.get(a);return b?b:(b=C3.New(C3.Event.Dispatcher),c.set(a,b),b)}const b=new WeakMap,c=new WeakMap;let d=null;self.IInstance=class{constructor(){b.set(this,d);const a={runtime:{value:d.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:d.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:d.GetUID(),writable:!1}};d._GetInstVarsScriptDescriptor(a),d._GetBehaviorsScriptDescriptor(a),Object.defineProperties(this,a),d.GetRuntime()._MapScriptInterface(this,d)}static _Init(a){d=a}static _GetInitInst(){return d}_Release(){const a=c.get(this);a&&(a.Release(),c.delete(this)),b.delete(this)}addEventListener(b,c,d){a(this).addEventListener(b,c,d)}removeEventListener(b,c,d){a(this).removeEventListener(b,c,d)}dispatchEvent(b){a(this).dispatchEvent(b)}destroy(){const a=b.get(this);a.GetRuntime().DestroyInstance(a)}}}
// c3/interfaces/IWorldInstance.js
"use strict";{const d=new WeakMap,a=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]]),b=new Map([...a.entries()].map((b)=>[b[1],b[0]])),c=C3.New(C3.Color);self.IWorldInstance=class extends IInstance{constructor(){super();const a=IInstance._GetInitInst();d.set(this,a);const b=[],c=a.GetWorldInfo(),e=c.GetInstanceEffectList();if(e){const a=c.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let d=0;d<a;++d)b.push(new IEffectInstance(c,d))}Object.defineProperties(this,{effects:{value:b,writable:!1}})}get layout(){return d.get(this).GetWorldInfo().GetLayout().GetILayout()}get layer(){return d.get(this).GetWorldInfo().GetLayer().GetILayer()}get x(){return d.get(this).GetWorldInfo().GetX()}set x(a){a=+a;const b=d.get(this).GetWorldInfo();isNaN(a)||b.GetX()===a||(b.SetX(a),b.SetBboxChanged())}get y(){return d.get(this).GetWorldInfo().GetY()}set y(a){a=+a;const b=d.get(this).GetWorldInfo();isNaN(a)||b.GetY()===a||(b.SetY(a),b.SetBboxChanged())}get zElevation(){return d.get(this).GetWorldInfo().GetZElevation()}set zElevation(a){a=+a;const b=d.get(this),c=b.GetWorldInfo();c.GetZElevation()===a||(c.SetZElevation(a),b.GetRuntime().UpdateRender())}get totalZElevation(){return d.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return d.get(this).GetWorldInfo().GetWidth()}set width(a){a=+a;const b=d.get(this).GetWorldInfo();isNaN(a)||b.GetWidth()===a||(b.SetWidth(a),b.SetBboxChanged())}get height(){return d.get(this).GetWorldInfo().GetHeight()}set height(a){a=+a;const b=d.get(this).GetWorldInfo();isNaN(a)||b.GetHeight()===a||(b.SetHeight(a),b.SetBboxChanged())}get angle(){return d.get(this).GetWorldInfo().GetAngle()}set angle(b){b=C3.clampAngle(+b);const c=d.get(this).GetWorldInfo();isNaN(b)||c.GetAngle()===b||(c.SetAngle(b),c.SetBboxChanged())}get angleDegrees(){return C3.toDegrees(this.angle)}set angleDegrees(b){this.angle=C3.toRadians(b)}getBoundingBox(){return d.get(this).GetWorldInfo().GetBoundingBox().toDOMRect()}getBoundingQuad(){return d.get(this).GetWorldInfo().GetBoundingQuad().toDOMQuad()}get isVisible(){return d.get(this).GetWorldInfo().IsVisible()}set isVisible(a){a=!!a;const b=d.get(this),c=b.GetWorldInfo();c.IsVisible()===a||(c.SetVisible(a),b.GetRuntime().UpdateRender())}get opacity(){return d.get(this).GetWorldInfo().GetOpacity()}set opacity(a){a=C3.clamp(+a,0,1);const b=d.get(this),c=b.GetWorldInfo();isNaN(a)||c.GetOpacity()===a||(c.SetOpacity(a),b.GetRuntime().UpdateRender())}set colorRgb(a){if(3>a.length)throw new Error("expected 3 elements");c.setRgb(a[0],a[1],a[2]);const b=d.get(this),e=b.GetWorldInfo();e.GetUnpremultipliedColor().equalsIgnoringAlpha(c)||(e.SetUnpremultipliedColor(c),b.GetRuntime().UpdateRender())}get colorRgb(){const a=d.get(this).GetWorldInfo().GetUnpremultipliedColor();return[a.getR(),a.getG(),a.getB()]}set blendMode(b){const c=a.get(b);if("number"!=typeof c)throw new Error("invalid blend mode");const e=d.get(this),f=e.GetWorldInfo();f.SetBlendMode(c),e.GetRuntime().UpdateRender()}get blendMode(){return b.get(d.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){d.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){d.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(a){const b=ILayer._Unwrap(a);if(!b)throw new Error("invalid layer");d.get(this).GetWorldInfo().ZOrderMoveToLayer(b)}moveAdjacentToInstance(a,b){d.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(d.get(a),b)}containsPoint(a,b){return d.get(this).GetWorldInfo().ContainsPoint(+a,+b)}testOverlap(c){const e=d.get(this),a=d.get(c);return e.GetRuntime().GetCollisionEngine().TestOverlap(e,a)}testOverlapSolid(){const a=d.get(this),b=a.GetRuntime().GetCollisionEngine().TestOverlapSolid(a);return b?b.GetInterfaceClass():null}}}
// c3/interfaces/IDOMInstance.js
"use strict";{const a=new WeakMap;self.IDOMInstance=class extends IWorldInstance{constructor(){super(),a.set(this,IInstance._GetInitInst())}focus(){a.get(this).GetSdkInstance().FocusElement()}blur(){a.get(this).GetSdkInstance().BlurElement()}setCssStyle(b,c){a.get(this).GetSdkInstance().SetElementCSSStyle(b,c)}}}
// c3/interfaces/IBehaviorInstance.js
"use strict";{const a=new WeakMap;let b=null;self.IBehaviorInstance=class{constructor(){a.set(this,b);const c={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:b.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,c)}static _Init(a){b=a}static _GetInitInst(){return b}get instance(){return a.get(this).GetObjectInstance().GetInterfaceClass()}}}
// c3/interfaces/IBehavior.js
"use strict";{const a=new WeakMap;self.IBehavior=class{constructor(b){a.set(this,b);const c={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,c)}getAllInstances(){return a.get(this).GetInstances().map((a)=>a.GetInterfaceClass())}}}
// c3/interfaces/IEffectInstance.js
"use strict";{const b=new WeakMap;self.IEffectInstance=class{constructor(a,c){b.set(this,a);Object.defineProperties(this,{index:{value:c,writable:!1}})}get name(){const a=b.get(this),c=a.GetObjectClass().GetEffectList().GetAllEffectTypes();return c[this.index].GetName()}get isActive(){const a=b.get(this),c=a.GetInstanceEffectList();return c.IsEffectIndexActive(this.index)}set isActive(c){c=!!c;const d=b.get(this),e=d.GetInstanceEffectList();e.IsEffectIndexActive(this.index)===c||(e.SetEffectIndexActive(this.index,c),e.UpdateActiveEffects(),d.GetRuntime().UpdateRender())}setParameter(a,c){a=Math.floor(+a);const d=b.get(this),e=d.GetInstanceEffectList(),f=e.GetEffectParametersForIndex(this.index);if(0>a||a>=f.length)throw new RangeError("invalid effect parameter index");const h=f[a];if(h instanceof C3.Color){if(!Array.isArray(c)||3>c.length)throw new TypeError("expected array with 3 elements");const a=c[0],d=c[1],e=c[2];if(h.equalsRgb(a,d,e))return;h.setRgb(a,d,e)}else{if("number"!=typeof c)throw new TypeError("expected number");if(h===c)return;f[a]=c}e.IsEffectIndexActive(this.index)&&d.GetRuntime().UpdateRender()}getParameter(a){a=Math.floor(+a);const c=b.get(this),d=c.GetInstanceEffectList(),e=d.GetEffectParametersForIndex(this.index);if(0>a||a>=e.length)throw new RangeError("invalid effect parameter index");const f=e[a];return f instanceof C3.Color?[f.getR(),f.getG(),f.getB()]:f}}}
// c3/objects/pluginManager.js
"use strict";C3.Plugins={},C3.Behaviors={},C3.PluginManager=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a,this._allPlugins=[],this._pluginsByCtor=new Map,this._systemPlugin=null,this._allBehaviors=[],this._behaviorsByCtor=new Map,this._solidBehavior=null,this._jumpthruBehavior=null}CreatePlugin(a){const b=this._runtime.GetObjectReference(a[0]);if(!b)throw new Error("missing plugin");C3.AddCommonACEs(a,b);const c=C3.New(b,{runtime:this._runtime,isSingleGlobal:a[1],isWorld:a[2],isRotatable:a[5],hasEffects:a[8],mustPredraw:a[9]});c.OnCreate(),this._allPlugins.push(c),this._pluginsByCtor.set(b,c)}CreateSystemPlugin(){this._systemPlugin=C3.New(C3.Plugins.System,{runtime:this._runtime,isSingleGlobal:!0}),this._systemPlugin.OnCreate()}CreateBehavior(a){const b=this._runtime.GetObjectReference(a[1]);if(!b)throw new Error("missing behavior");const c=C3.New(b,{runtime:this._runtime});c.OnCreate(),this._allBehaviors.push(c),this._behaviorsByCtor.set(b,c),!this._solidBehavior&&C3.Behaviors.solid&&c instanceof C3.Behaviors.solid?this._solidBehavior=c:!this._jumpthruBehavior&&C3.Behaviors.jumpthru&&c instanceof C3.Behaviors.jumpthru&&(this._jumpthruBehavior=c)}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}};
// c3/objects/imageInfo.js
"use strict";{const a=new Set;C3.ImageInfo=class extends C3.DefendedBase{constructor(){super(),this._url="",this._size=0,this._pixelFormat=0,this._offsetX=0,this._offsetY=0,this._width=0,this._height=0,this._hasMetaData=!1,this._imageAsset=null,this._textureState="",this._rcTex=C3.New(C3.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(a){this._url=a[0],this._size=a[1],this._pixelFormat=a[2],this._offsetX=a[3],this._offsetY=a[4],this._width=a[5],this._height=a[6],this._hasMetaData=!0}LoadAnimationFrameData(a){this._url=a[0],this._size=a[1],this._offsetX=a[2],this._offsetY=a[3],this._width=a[4],this._height=a[5],this._pixelFormat=a[11],this._hasMetaData=!0}LoadDynamicAsset(a,b){if(this._imageAsset)throw new Error("already loaded asset");this._url=b;const c={};return C3.IsAbsoluteURL(b)&&(c.loadPolicy="remote"),this.LoadAsset(a,c),this._imageAsset.Load()}ReplaceWith(a){if(a===this)throw new Error("cannot replace with self");this.ReleaseTexture(),this._url=a._url,this._size=a._size,this._pixelFormat=a._pixelFormat,this._offsetX=a._offsetX,this._offsetY=a._offsetY,this._width=a._width,this._height=a._height,this._hasMetaData=a._hasMetaData,this._imageAsset=a._imageAsset,this._textureState=a._textureState,this._rcTex=a._rcTex}GetURL(){return this._url}GetSize(){return this._size}GetPixelFormat(){return this._pixelFormat}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(a,b){if(this._imageAsset)throw new Error("already got asset");b=Object.assign({},b,{url:this.GetURL(),size:this.GetSize()}),this._imageAsset=a.LoadImage(b)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,b){if(!this._imageAsset)throw new Error("no asset");if(this._textureState)throw new Error("already loaded texture");this._textureState="loading";const c=await this._imageAsset.LoadStaticTexture(a,b);return c?(this._textureState="loaded",this._hasMetaData||(this._width=c.GetWidth(),this._height=c.GetHeight(),this._hasMetaData=!0),this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+this._width,this._offsetY+this._height),this._rcTex.divide(c.GetWidth(),c.GetHeight()),c):(this._textureState="",null)}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,0,0,0))}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}async ExtractImageToCanvas(){const a=await this._imageAsset.LoadToDrawable(),b=C3.CreateCanvas(this._width,this._height),c=b.getContext("2d");return c.drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height),b}}}
// c3/objects/animationInfo.js
"use strict";C3.AnimationInfo=class extends C3.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((a)=>C3.New(C3.AnimationFrameInfo,a))}Release(){for(const a of this._frames)a.Release();C3.clearArray(this._frames)}LoadAllAssets(a){for(const b of this._frames)b.GetImageInfo().LoadAsset(a)}LoadAllTextures(a,b){return Promise.all(this._frames.map((c)=>c.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){if(a=Math.floor(a),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}};
// c3/objects/animationFrameInfo.js
"use strict";C3.AnimationFrameInfo=class extends C3.DefendedBase{constructor(a){super(),this._imageInfo=C3.New(C3.ImageInfo),this._imageInfo.LoadAnimationFrameData(a),this._duration=a[6],this._origin=C3.New(C3.Vector2,a[7],a[8]),this._imagePoints=a[9].map((a)=>C3.New(C3.ImagePoint,this,a)),this._imagePointsByName=new Map;for(const b of this._imagePoints)this._imagePointsByName.set(b.GetName().toLowerCase(),b);this._collisionPoly=null;const b=a[10];6<=b.length&&(this._collisionPoly=C3.New(C3.CollisionPoly,b))}Release(){this._collisionPoly&&(this._collisionPoly.Release(),this._collisionPoly=null),this._imageInfo.Release(),this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(a){return this._imagePointsByName.get(a.toLowerCase())||null}GetImagePointByIndex(a){return a=Math.floor(a),0>a||a>=this._imagePoints.length?null:this._imagePoints[a]}GetImagePointCount(){return this._imagePoints.length}};
// c3/objects/imagePoint.js
"use strict";C3.ImagePoint=class extends C3.DefendedBase{constructor(a,b){super(),this._afi=a,this._name=b[0],this._pos=C3.New(C3.Vector2,b[1],b[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}};
// c3/objects/objectClass.js
"use strict";C3.ObjectClass=class extends C3.DefendedBase{constructor(a,b,c){super();const d=a.GetObjectReference(c[1]);if(this._runtime=a,this._plugin=a.GetPluginManager().GetPluginByConstructorFunction(d),this._sdkType=null,this._instSdkCtor=d.Instance,this._index=b,this._sid=c[11],this._name=c[0],this._jsPropName=this._runtime.GetJsPropName(c[14]),this._isGlobal=!!c[9],this._isFamily=!!c[2],this._isOnLoaderLayout=!!c[10],this._instVars=c[3].map((b)=>({sid:b[0],type:b[1],name:b[2],jsPropName:a.GetJsPropName(b[3])})),this._behaviorsCount=c[4],this._effectsCount=c[5],this._isWorldType=this._plugin.IsWorldType(),this._effectList=null,this._collisionGrid=C3.New(C3.SparseGrid,a.GetOriginalViewportWidth(),a.GetOriginalViewportHeight()),this._anyCollisionCellChanged=!0,this._anyInstanceParallaxed=!1,this._familyMembers=null,this._familyMembersSet=null,this._familyIndex=-1,this._families=null,this._familiesSet=null,this._familyInstVarMap=null,this._familyBehaviorMap=null,this._familyEffectMap=null,this._isInContainer=!1,this._container=null,this._behaviorTypes=c[8].map((a)=>C3.BehaviorType.Create(this,a)),this._behaviorTypesIncludingInherited=[],this._behaviorsByName=new Map,this._behaviorNameToIndex=new Map,this._usedBehaviorCtors=new Set,this._solStack=C3.New(C3.SolStack,this),this._defaultInstanceData=null,this._defaultLayerIndex=0,this._isContained=!1,this._container=null,this._imageInfo=null,this._animations=null,this._animationsByName=null,this._animationsBySid=null,this._textureRefCount=0,this._savedData=new Map,this._unsavedData=new Map,this._instances=[],this._iidsStale=!0,this._plugin.HasEffects()&&(this._effectList=C3.New(C3.EffectList,this,c[12])),c[6]&&(this._imageInfo=C3.New(C3.ImageInfo),this._imageInfo.LoadData(c[6])),c[7]){this._animations=c[7].map((a)=>C3.New(C3.AnimationInfo,a)),this._animationsByName=new Map,this._animationsBySid=new Map;for(const a of this._animations)this._animationsByName.set(a.GetName().toLowerCase(),a),this._animationsBySid.set(a.GetSID(),a)}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=C3.New(d.Type,this),this._iObjectClass=null,this._instanceUserScriptClass=null;const e=this._sdkType.GetScriptInterfaceClass();if(!e)this._iObjectClass=new IObjectClass(this);else if(this._iObjectClass=new e(this),!(this._iObjectClass instanceof IObjectClass))throw new TypeError("script interface class must derive from IObjectClass");c[13]&&c[13].length&&this._sdkType.LoadTilePolyData(c[13]),(!this._runtime.UsesLoaderLayout()||this._isFamily||this._isOnLoaderLayout||!this._isWorldType)&&this.OnCreate(),this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(c))}static Create(a,b,c){return C3.New(C3.ObjectClass,a,b,c)}Release(){if(this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null),this._animations){for(const b of this._animations)b.Release();C3.clearArray(this._animations),this._animationsByName.clear(),this._animationsBySid.clear()}this._solStack.Release(),this._solStack=null,this._savedData.clear(),this._unsavedData.clear(),this._container=null,this._runtime=null}_LoadFamily(a){for(let b=1,c=a.length;b<c;++b){const c=this._runtime.GetObjectClassByIndex(a[b]);this._familyMembers.push(c),this._familyMembersSet.add(c),c._families.push(this),c._familiesSet.add(this)}}_SetContainer(a){this._isInContainer=!0,this._container=a}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){let a=0;if(!this._isFamily)for(const b of this._families)for(const c of b.GetBehaviorTypes()){const b=c.GetName().toLowerCase();this._behaviorsByName.set(b,c),this._behaviorNameToIndex.set(b,a),this._behaviorTypesIncludingInherited.push(c),++a}for(const b of this.GetBehaviorTypes()){const c=b.GetName().toLowerCase();this._behaviorsByName.set(c,b),this._behaviorNameToIndex.set(c,a),this._behaviorTypesIncludingInherited.push(b),++a}for(const a of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(a.GetBehavior().constructor);if(!this._isFamily&&this._families.length){const a=this._runtime.GetFamilyCount();C3.extendArray(this._familyInstVarMap,a,0),C3.extendArray(this._familyBehaviorMap,a,0),C3.extendArray(this._familyEffectMap,a,0);const b=[];let c=0,d=0,e=0;for(const a of this._families){const f=a.GetFamilyIndex();this._familyInstVarMap[f]=c,c+=a.GetInstanceVariablesCount(),this._familyBehaviorMap[f]=d,d+=a.GetBehaviorTypesCount(),this._familyEffectMap[f]=e,e+=a.GetEffectTypesCount();const g=a.GetEffectList();if(g&&this._effectList)for(const a of g.GetAllEffectTypes())b.push(a.Clone(this._effectList))}this._effectList&&this._effectList.PrependEffectTypes(b)}}_CreateSingleGlobalInstance(a){const b=this._runtime._GetNewUID(),c=C3.New(C3.Instance,{runtime:this._runtime,objectType:this,uid:b});c._CreateSdkInstance(a[15],[]),this._runtime._MapInstanceByUID(b,c),this._instances.push(c)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(a){return this._isFamily?Promise.resolve():(this._textureRefCount++,1===this._textureRefCount?this._sdkType.LoadTextures(a):Promise.resolve())}ReleaseTextures(){if(!this._isFamily){if(this._textureRefCount--,0>this._textureRefCount)throw new Error("released textures too many times");0===this._textureRefCount&&this._sdkType.ReleaseTextures()}}OnDynamicTextureLoadComplete(){if(this._isFamily)throw new Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(a){return this._isFamily?Promise.resolve():this._sdkType.PreloadTexturesWithInstances(a)}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(a){return a&&this._usedBehaviorCtors.has(a)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map((a)=>a.sid)}GetInstanceVariableIndexBySID(a){return this._instVars.findIndex((b)=>b.sid===a)}GetInstanceVariableIndexByName(a){return this._instVars.findIndex((b)=>b.name===a)}_GetAllInstanceVariableNames(){return this._instVars.map((a)=>a.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map((a)=>a.jsPropName)}GetInstanceVariableType(a){if(a=Math.floor(a),0>a||a>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[a].type}GetInstanceVariableName(a){if(a=Math.floor(a),0>a||a>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[a].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(a){return this._behaviorsByName.get(a.toLowerCase())||null}GetBehaviorIndexByName(a){const b=this._behaviorNameToIndex.get(a.toLowerCase());return"undefined"==typeof b?-1:b}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(a){this._defaultInstanceData=a}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(a){this._defaultLayerIndex=a}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(a){return this._familiesSet.has(a)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(a){return this._familyMembersSet.has(a)}GetFamilyBehaviorOffset(a){return this._familyBehaviorMap[a]}GetFamilyInstanceVariableOffset(a){return this._familyInstVarMap[a]}GetAnimationByName(a){if(!this._animations)throw new Error("no animations");return this._animationsByName.get(a.toLowerCase())||null}GetAnimationBySID(a){if(!this._animations)throw new Error("no animations");return this._animationsBySid.get(a)||null}GetFirstAnimationFrame(){if(!this._animations)throw new Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const a=this.GetFirstAnimationFrame().GetImageInfo();return[a.GetWidth(),a.GetHeight()]}return this._imageInfo?[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()]:[100,100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw new Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances;for(const a of this._runtime._GetInstancesPendingCreate())a.GetObjectClass()===this&&(yield a)}GetInstanceCount(){return this._instances.length}_AddInstance(a){this._instances.push(a)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&!this._isFamily){const a=this._instances;let b=0;for(let c=a.length;b<c;++b)a[b]._SetIID(b);const c=this._runtime._GetInstancesPendingCreate();for(const a of c)a.GetObjectClass()===this&&a._SetIID(b++);this._iidsStale=!1}}GetInstanceByIID(a){const b=this._instances;if(a<b.length)return b[a];a-=b.length;const c=this._runtime._GetInstancesPendingCreate();for(const b of c)if(b.GetObjectClass()===this){if(0===a)return b;--a}return null}GetFirstPicked(a){if(a&&a.IsInContainer()&&a.GetObjectClass()!==this)for(const b of a.siblings())if(b.GetObjectClass()===this)return b;const b=this.GetCurrentSol().GetInstances();return b.length?b[0]:null}GetPairedInstance(a){const b=this.GetCurrentSol().GetInstances();return b.length?b[a.GetIID()%b.length]:null}FinishCondition(a){this._sdkType.FinishCondition(a)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();const a=this.GetCurrentSol(),b=a._GetOwnInstances(),c=a.IsSelectAll(),d=this._runtime.GetCurrentEventStackFrame(),e=d&&d.GetCurrentEvent()&&d.GetCurrentEvent().IsOrBlock();for(const d of this._container.objectTypes()){if(d===this)continue;d._UpdateIIDs();const f=d.GetCurrentSol();if(f._SetSelectAll(c),!c){const c=f._GetOwnInstances();C3.clearArray(c);for(const a of b)c.push(d.GetInstanceByIID(a.GetIID()));if(e){const b=a._GetOwnElseInstances(),c=f._GetOwnElseInstances();C3.clearArray(c);for(const a of b)c.push(d.GetInstanceByIID(a.GetIID()))}}}}}_TruncateContainerSols(a,b){for(const c of this.GetContainer().objectTypes()){const d=c.GetCurrentSol();a?C3.truncateArray(d._GetOwnElseInstances(),b):C3.truncateArray(d._GetOwnInstances(),b)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(a){this._anyCollisionCellChanged=!!a}_SetAnyInstanceParallaxed(a){this._anyInstanceParallaxed=!!a}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&this._isWorldType){for(const a of this._instances)a.GetWorldInfo()._UpdateCollisionCell();for(const a of this._runtime._GetInstancesPendingCreate())a.GetObjectClass()===this&&a.GetWorldInfo()._UpdateCollisionCell();this._anyCollisionCellChanged=!1}}GetSavedDataMap(){return this._savedData||(this._savedData=new Map),this._savedData}GetUnsavedDataMap(){return this._unsavedData||(this._unsavedData=new Map),this._unsavedData}HasSolidBehavior(){return this.UsesBehaviorByCtor(C3.Behaviors.solid)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(C3.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(C3.Behaviors.Persist)}_SaveToJson(){const a={"instances":this._instances.map((a)=>a.SaveToJson())};return this._savedData&&this._savedData.size&&(a["ex"]=C3.ToSuperJSON(this._savedData)),a}_LoadFromJson(a){this._savedData&&(this._savedData.clear(),this._savedData=null);const b=a["ex"];b&&(this._savedData=C3.FromSuperJSON(b));const c=this._instances,d=a["instances"];for(let b=0,e=Math.min(c.length,d.length);b<e;++b)c[b].LoadFromJson(d[b]);for(let b=d.length,e=c.length;b<e;++b)this._runtime.DestroyInstance(c[b]);for(let b=c.length,e=d.length;b<e;++b){const a=d[b];let c=null;if(this.IsWorldType()&&(c=this._runtime.GetMainRunningLayout().GetLayerBySID(a["w"]["l"]),!c))continue;const e=this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,c,!1,0,0,!0);e.LoadFromJson(a)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(a){this._instanceUserScriptClass=a}};
// c3/objects/container.js
"use strict";C3.Container=class extends C3.DefendedBase{constructor(a,b){super(),this._runtime=a,this._objectTypes=b;for(const c of this._objectTypes)c._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some((a)=>a.IsWorldType())}};
// c3/objects/instance.js
"use strict";{const a=[];let b=0;const c=new WeakMap,d=new WeakMap;C3.Instance=class extends C3.DefendedBase{constructor(c){super(),this._runtime=c.runtime,this._objectType=c.objectType,this._worldInfo=null,this._sdkInst=null,this._iScriptInterface=null,this._iid=0,this._uid=c.uid,this._puid=b++,this._flags=0,this._instVarValues=a,this._behaviorInstances=a;const d=this._objectType.GetBehaviorTypesIncludingInherited();0<d.length&&(this._behaviorInstances=d.map((a,b)=>C3.New(C3.BehaviorInstance,{runtime:this._runtime,behaviorType:a,instance:this,index:b}))),this._siblings=this._objectType.IsInContainer()?[]:null,this._timeScale=-1,this._dispatcher=null;const e=this.GetPlugin();if(e.MustPreDraw()&&(this._flags|=4),e.IsWorldType())if(this._worldInfo=C3.New(C3.WorldInfo,this,c.layer),c.worldData)this._worldInfo.Init(c.worldData);else{this._worldInfo.InitNoData();const[a,b]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(a,b),this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}c.instVarData?this._LoadInstanceVariableData(c.instVarData):this._LoadDefaultInstanceVariables()}Release(){if(this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null),0<this._behaviorInstances.length){for(const a of this._behaviorInstances)a.Release();C3.clearArray(this._behaviorInstances)}this._sdkInst.Release(),this._sdkInst=null;const a=c.get(this);a&&(a.clear(),c.delete(this));const b=d.get(this);b&&(b.clear(),d.delete(this)),this._siblings&&C3.clearArray(this._siblings),this._dispatcher&&(this._dispatcher.Release(),this._dispatcher=null),this._runtime=null,this._objectType=null,0<this._instVarValues.length&&C3.clearArray(this._instVarValues),this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(a){0<a.length&&(this._instVarValues=[],C3.shallowAssignArray(this._instVarValues,a))}_LoadDefaultInstanceVariables(){const a=this._objectType.GetInstanceVariablesCount();if(0!==a){this._instVarValues=[];const b=[0,0,""];for(let c=0;c<a;++c)this._instVarValues.push(b[this._objectType.GetInstanceVariableType(c)])}}_CreateSdkInstance(a,b){if(this._sdkInst)throw new Error("already got sdk instance");for(let c=0,d=this._behaviorInstances.length;c<d;++c){const a=this._behaviorInstances[c];a._CreateSdkInstance(b?b[c]:null)}if(this._sdkInst=C3.New(this._objectType.GetInstanceSdkCtor(),this,a),!(this._sdkInst instanceof C3.SDKInstanceBase))throw new Error("sdk type must derive from SDKInstanceBase");for(let c=0,d=this._behaviorInstances.length;c<d;++c)this._behaviorInstances[c].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}SetTimeScale(a){a=+a,(0>a||!isFinite(a))&&(a=0),this._timeScale=a}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){return this._dispatcher||(this._dispatcher=C3.New(C3.Event.Dispatcher)),this._dispatcher}Draw(a){this._sdkInst.Draw(a)}OnCreate(a){this._sdkInst.OnCreate(a)}_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(a){a?this._flags|=8:this._flags&=-9}_IsJumpthruEnabled(){return 0!=(this._flags&16)}_SetJumpthruEnabled(a){a?this._flags|=16:this._flags&=-17}SetFlag(a,b){a<<=16,b?this._flags|=a:this._flags&=~a}GetFlag(a){return 0!=(this._flags&a<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetImagePoint(a){return this._sdkInst.GetImagePoint(a)}GetObjectClass(){return this._objectType}BelongsToObjectClass(a){return a.IsFamily()?a.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===a}IsInContainer(){return null!==this._siblings}_AddSibling(a){this._siblings.push(a)}GetSiblings(){return this._siblings}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const a of this.siblings())a.GetObjectClass().GetCurrentSol().SetSinglePicked(a)}_PushSiblingsToSolInstances(){for(const a of this.siblings())a.GetObjectClass().GetCurrentSol()._PushInstance(a)}_SetSiblingsToSolInstancesIndex(a){for(const b of this.siblings())b.GetObjectClass().GetCurrentSol()._GetOwnInstances()[a]=b}_PushSiblingsToSolElseInstances(){for(const a of this.siblings())a.GetObjectClass().GetCurrentSol()._PushElseInstance(a)}_SetSiblingsToSolElseInstancesIndex(a){for(const b of this.siblings())b.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[a]=b}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(a){this._iid=a}GetIID(){return this._objectType._UpdateIIDs(),this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(a){if(!a)return null;for(const b of this._behaviorInstances)if(b.GetBehavior()instanceof a)return b;return null}GetBehaviorSdkInstanceFromCtor(a){if(!a)return null;const b=this.GetBehaviorInstanceFromCtor(a);return b?b.GetSdkInstance():null}GetBehaviorIndexBySID(a){const b=this._behaviorInstances;for(let c=0,d=b.length;c<d;++c)if(b[c].GetBehaviorType().GetSID()===a)return c;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(a){a|=0;const b=this._instVarValues;if(0>a||a>=b.length)throw new RangeError("invalid instance variable");return b[a]}_GetInstanceVariableValueUnchecked(a){return this._instVarValues[a]}SetInstanceVariableValue(a,b){a|=0;const c=this._instVarValues;if(0>a||a>=c.length)throw new RangeError("invalid instance variable");const d=c[a];if("number"==typeof d)c[a]="number"==typeof b?b:parseFloat(b);else if("boolean"==typeof d)c[a]="boolean"==typeof b?b:!!b;else if("string"==typeof d)c[a]="string"==typeof b?b:b.toString();else throw new Error("unknown instance variable type")}SetInstanceVariableOffset(a,b){if(0!==b){a|=0;const c=this._instVarValues;if(0>a||a>=c.length)throw new RangeError("invalid instance variable");const d=c[a];if("number"==typeof d)c[a]+="number"==typeof b?b:parseFloat(b);else if("boolean"==typeof d)throw new Error("can not set offset of boolean variable");else if("string"==typeof d)throw new Error("can not set offset of string variable");else throw new Error("unknown instance variable type")}}GetSavedDataMap(){let a=c.get(this);return a?a:(a=new Map,c.set(this,a),a)}GetUnsavedDataMap(){let a=d.get(this);return a?a:(a=new Map,d.set(this,a),a)}_TriggerOnCreated(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(a="full"){const b={};if("full"===a?b["uid"]=this.GetUID():b["c3"]=!0,"visual-state"!==a){const a=c.get(this);if(a&&a.size&&(b["ex"]=C3.ToSuperJSON(a)),-1!==this.GetTimeScale()&&(b["mts"]=this.GetTimeScale()),0<this._objectType.GetInstanceVariablesCount()){const a={},c=this._objectType.GetInstanceVariableSIDs();for(let b=0,d=this._instVarValues.length;b<d;++b)a[c[b].toString()]=this._instVarValues[b];b["ivs"]=a}if(this._behaviorInstances.length){const a={};for(const b of this._behaviorInstances){const c=b.SaveToJson();c&&(a[b.GetBehaviorType().GetSID().toString()]=c)}b["behs"]=a}}this._worldInfo&&(b["w"]=this._worldInfo._SaveToJson());const d=this._sdkInst.SaveToJson();return d&&(b["data"]=d),b}LoadFromJson(a,b="full"){if("full"===b)this._uid=a["uid"];else if(!a["c3"])return;if("visual-state"!==b){let b=c.get(this);b&&(b.clear(),c.delete(this));const d=a["ex"];d&&(b=C3.FromSuperJSON(d),c.set(this,b)),this._timeScale=a.hasOwnProperty("mts")?a["mts"]:-1;const e=a["ivs"];if(e)for(const[a,b]of Object.entries(e)){const c=parseInt(a,10),d=this._objectType.GetInstanceVariableIndexBySID(c);if(0>d||d>=this._instVarValues.length)continue;let e=b;null===e&&(e=NaN),this._instVarValues[d]=e}}if(this.GetPlugin().IsWorldType()){const c=a["w"],d=c["l"];if(this._worldInfo.GetLayer().GetSID()!==d){const a=this._worldInfo.GetLayer(),c=a.GetLayout().GetLayerBySID(d);c?(this._worldInfo._SetLayer(c),a._RemoveInstance(this,!0),c._AddInstance(this,!0),c.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===b&&this._runtime.DestroyInstance(this)}this._worldInfo._LoadFromJson(c)}if("visual-state"!==b){const b=a["behs"];if(b)for(const[a,c]of Object.entries(b)){const b=parseInt(a,10),d=this.GetBehaviorIndexBySID(b);0>d||d>=this._behaviorInstances.length||this._behaviorInstances[d].LoadFromJson(c)}}const d=a["data"];d&&this._sdkInst.LoadFromJson(d)}GetInterfaceClass(){return this._iScriptInterface||this._InitUserScriptInterface()}_InitUserScriptInterface(){const a=this._worldInfo?IWorldInstance:IInstance,b=this._sdkInst.GetScriptInterfaceClass(),c=this._objectType._GetUserScriptInstanceClass();if(IInstance._Init(this),this._iScriptInterface=new(c||b||a),IInstance._Init(null),b&&!(this._iScriptInterface instanceof a))throw new TypeError(`script interface class '${b.name}' does not extend the right base class '${a.name}'`);if(c){const d=b||a;if(!(this._iScriptInterface instanceof d))throw new TypeError(`setInstanceClass(): class '${c.name}' does not extend the right base class '${d.name}'`)}return this._iScriptInterface}_GetInstVarsScriptDescriptor(a){if(0!==this._instVarValues.length){const b={},c=this._objectType._GetAllInstanceVariableJsPropNames();for(let a=0,d=c.length;a<d;++a)b[c[a]]={configurable:!1,enumerable:!0,get:C3.Instance.prototype._GetInstanceVariableValueUnchecked.bind(this,a),set:C3.Instance.prototype.SetInstanceVariableValue.bind(this,a)};const d=Object.create(Object.prototype,b);a.instVars={value:d,writable:!1}}}_GetBehaviorsScriptDescriptor(a){const b=this._behaviorInstances;if(0!==b.length){const c={};for(const a of b)c[a.GetBehaviorType().GetJsPropName()]={value:a.GetScriptInterface(),writable:!1};const d=Object.create(Object.prototype,c);a.behaviors={value:d,writable:!1}}}}}
// c3/objects/worldInfo.js
"use strict";{const a=C3.New(C3.Rect),b=C3.New(C3.Rect),c=C3.New(C3.Event,"bboxchange",!1),d=C3.New(C3.Color,0,0,0,0),e=C3.New(C3.Color,1,1,1,1),f=C3.New(C3.Rect,0,0,-1,-1),g=C3.New(C3.Rect,0,0,-1,-1);let h=!0;const i=1;C3.WorldInfo=class extends C3.DefendedBase{constructor(a,b){super(),this._inst=a,this._objectClass=a.GetObjectClass(),this._runtime=a.GetRuntime(),this._layer=b,this._zIndex=-1,this._flags=27,this._x=NaN,this._y=NaN,this._zElevation=NaN,this._w=NaN,this._h=NaN,this._a=NaN,this._sinA=NaN,this._cosA=NaN,this._ox=NaN,this._oy=NaN,this._boundingBox=C3.New(C3.Rect),this._boundingQuad=C3.New(C3.Quad),this._collisionCells=g,this._renderCells=f,this._sourceCollisionPoly=null,this._transformedPolyInfo=null,this._solidFilterTags=null,this._color=e,this._colorPremultiplied=e,this._blendMode=-1,this._stateGroup=null,this._instanceEffectList=null,this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=C3.New(C3.InstanceEffectList,this._inst,this)),h=!1,this.SetBlendMode(0),h=!0}Release(){this._stateGroup&&(this._runtime.GetWebGLRenderer().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._inst=null,this._objectClass=null,this._runtime=null,this._layer=null}Init(a){h=!1,this.SetXY(a[0],a[1]),this.SetZElevation(a[2]),this.SetSize(a[3],a[4]),this.SetAngle(a[6]),d.setFromJSON(a[7]),this._SetColor(d),this.SetOriginX(a[8]),this.SetOriginY(a[9]),this.SetBlendMode(a[10]),this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(a[12]),h=!0,this._UpdateWebGLStateGroup()}InitNoData(){this._x=0,this._y=0,this._zElevation=0,this._w=0,this._h=0,this._a=0,this._sinA=0,this._cosA=1,this._ox=0,this._oy=0,this._UpdateWebGLStateGroup()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetInstance(){return this._inst}SetX(a){this._x=+a}OffsetX(a){this._x+=+a}GetX(){return this._x}SetY(a){this._y=+a}OffsetY(a){this._y+=+a}GetY(){return this._y}SetXY(a,b){this._x=+a,this._y=+b}OffsetXY(a,b){this._x+=+a,this._y+=+b}EqualsXY(a,b){return this._x===a&&this._y===b}SetZElevation(a){if(a=+a,this._zElevation!==a){this._zElevation=a,this._UpdateWebGLStateGroup();const b=this.GetLayer();0!==this._zElevation&&b._SetAnyInstanceZElevated(),b.SetZIndicesChanged()}}OffsetZElevation(a){this.SetZElevation(this.GetZElevation()+a)}GetZElevation(){return this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(a){this._w=+a}OffsetWidth(a){this._w+=+a}GetWidth(){return this._w}SetHeight(a){this._h=+a}OffsetHeight(a){this._h+=+a}GetHeight(){return this._h}SetSize(a,b){this._w=+a,this._h=+b}SetAngle(b){b=C3.clampAngle(+b);this._a===b||(this._a=b,this._sinA=Math.sin(b),this._cosA=Math.cos(b))}OffsetAngle(b){b=+b;0===b||(this._a=C3.clampAngle(this._a+b),this._sinA=Math.sin(this._a),this._cosA=Math.cos(this._a))}GetAngle(){return this._a}GetSinAngle(){return this._sinA}GetCosAngle(){return this._cosA}SetOriginX(a){this._ox=+a}OffsetOriginX(a){this._ox+=+a}GetOriginX(){return this._ox}SetOriginY(a){this._oy=+a}OffsetOriginY(a){this._oy+=+a}GetOriginY(){return this._oy}_SetColor(a){this._color.equals(a)||(this._color===e?(this._color=C3.New(C3.Color,a),this._colorPremultiplied=C3.New(C3.Color,a),this._colorPremultiplied.premultiply()):a.equalsRgba(1,1,1,1)?(this._color=e,this._colorPremultiplied=e):(this._color.set(a),this._colorPremultiplied.set(a),this._colorPremultiplied.premultiply()),this._UpdateWebGLStateGroup())}SetOpacity(a){a=C3.clamp(+a,0,1);this._color.a===a||(d.copyRgb(this._color),d.a=a,this._SetColor(d))}OffsetOpacity(a){this.SetOpacity(this.GetOpacity()+a)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(a){this._color.equalsIgnoringAlpha(a)||(d.copyRgb(a),d.a=this._color.a,this._SetColor(d))}SetUnpremultipliedColorRGB(a,c,e){d.setRgb(a,c,e),this.SetUnpremultipliedColor(d)}OffsetUnpremultipliedColorRGB(a,c,e){0===a&&0===c&&0===e||(d.copyRgb(this._color),d.r+=a,d.g+=c,d.b+=e,this.SetUnpremultipliedColor(d))}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}_UpdateWebGLStateGroup(){if(h){const a=this._runtime.GetWebGLRenderer();this._stateGroup&&a.ReleaseStateGroup(this._stateGroup),this._stateGroup=a.AcquireStateGroup(a.GetTextureFillShaderProgram()||"<default>",this.GetSrcBlend(),this.GetDestBlend(),this._colorPremultiplied,this._zElevation)}}GetWebGLStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===e}SetBlendMode(a){this._blendMode===a||(this._blendMode=a,this._UpdateWebGLStateGroup())}GetBlendMode(){return this._blendMode}GetSrcBlend(){return this._runtime.GetWebGLRenderer().GetSrcBlendByIndex(this._blendMode)}GetDestBlend(){return this._runtime.GetWebGLRenderer().GetDestBlendByIndex(this._blendMode)}_SetLayer(a){this._layer=a,0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(a){this._zIndex=0|a}GetZIndex(){return this._layer._UpdateZIndices(),this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(a,b){b?this._flags|=a:this._flags&=~a}IsVisible(){return 0!=(this._flags&i)}SetVisible(a){this._SetFlag(i,a)}IsCollisionEnabled(){return 0!=(this._flags&8)}SetCollisionEnabled(a){a=!!a;this.IsCollisionEnabled()===a||(this._SetFlag(8,a),a?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(a,b){if(this._SetFlag(32,a),this._solidFilterTags&&this._solidFilterTags.clear(),!b.trim())return void(this._solidFilterTags=null);this._solidFilterTags||(this._solidFilterTags=new Set);for(const c of b.split(" "))c&&this._solidFilterTags.add(c.toLowerCase())}IsSolidCollisionAllowed(a){const b=0!=(this._flags&32),c=this._solidFilterTags;if(!a||!c)return!b;for(const d of c)if(a.has(d))return b;return!b}SetBboxChanged(){this._flags|=18,this._objectClass._SetAnyCollisionCellChanged(!0),this._runtime.UpdateRender(),this._layer.UsesRenderCells()&&(this._CalculateBbox(),this._UpdateRenderCell()),0!=(this._flags&4)&&this._inst.Dispatcher().dispatchEvent(c)}_CalculateBbox(){const a=this._boundingBox,b=this._boundingQuad,c=this._x,d=this._y,e=this._w,f=this._h;a.setWH(c-this._ox*e,d-this._oy*f,e,f),0===this._a?b.setFromRect(a):(a.offset(-c,-d),b.setFromRotatedRectPrecalc(a,this._sinA,this._cosA),b.offset(c,d),b.getBoundingBox(a)),a.normalize(),this._flags&=-3}_UpdateBbox(){0!=(this._flags&2)&&this._CalculateBbox()}GetBoundingBox(){return this._UpdateBbox(),this._boundingBox}GetBoundingQuad(){return this._UpdateBbox(),this._boundingQuad}OverwriteBoundingBox(a){this._boundingBox.copy(a),this._boundingQuad.setFromRect(this._boundingBox),this._flags&=-3,this._UpdateCollisionCell(),this._UpdateRenderCell()}SetBboxChangeEventEnabled(a){this._SetFlag(4,a)}IsBboxChangeEventEnabled(){return 0!=(this._flags&4)}IsInViewport(a){return 0===this._zElevation?a.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const a=this.GetLayer(),c=this.GetTotalZElevation();return!(c>=a.GetCameraZ())&&(a.GetViewportForZ(c,b),b.intersectsRect(this.GetBoundingBox()))}SetSourceCollisionPoly(a){this._sourceCollisionPoly=a;const b=this._transformedPolyInfo;b&&(b.width=-1,b.height=-1,b.angle=0)}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return!!this._sourceCollisionPoly}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(b,c,d){let a=0,e=1;return 0!==d&&(a=Math.sin(d),e=Math.cos(d)),this._GetCustomTransformedCollisionPolyPrecalc(b,c,d,a,e)}_GetCustomTransformedCollisionPolyPrecalc(b,c,d,a,e){let f=this._transformedPolyInfo;return(null===f&&(f={poly:C3.New(C3.CollisionPoly),width:-1,height:-1,angle:0},this._transformedPolyInfo=f),f.width===b&&f.height===c&&f.angle===d)?f.poly:(this._sourceCollisionPoly?(f.poly.copy(this._sourceCollisionPoly),f.poly.transformPrecalc(b,c,a,e)):f.poly.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY()),f.width=b,f.height=c,f.angle=d,f.poly)}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(a,b){return!!this.GetBoundingBox().containsPoint(a,b)&&!!this.GetBoundingQuad().containsPoint(a,b)&&(this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(a,b):!this.HasOwnCollisionPoly()||this.GetTransformedCollisionPoly().containsPoint(a-this.GetX(),b-this.GetY()))}_IsCollisionCellChanged(){return 0!=(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()){const b=this.GetBoundingBox(),c=this._objectClass._GetCollisionCellGrid(),d=this._collisionCells;if(a.set(c.XToCell(b.getLeft()),c.YToCell(b.getTop()),c.XToCell(b.getRight()),c.YToCell(b.getBottom())),!d.equals(a)){const b=this._inst;d===g?(c.Update(b,null,a),this._collisionCells=C3.New(C3.Rect,a)):(c.Update(b,d,a),d.copy(a)),this._flags&=-17}}}_RemoveFromCollisionCells(){const a=this._collisionCells;a===g||(this._objectClass._GetCollisionCellGrid().Update(this._inst,a,null),this._collisionCells=g)}_UpdateRenderCell(){const b=this.GetLayer();if(b.UsesRenderCells()){const c=b.GetRenderGrid(),d=this.GetBoundingBox(),e=this._renderCells;if(a.set(c.XToCell(d.getLeft()),c.YToCell(d.getTop()),c.XToCell(d.getRight()),c.YToCell(d.getBottom())),!e.equals(a)){const d=this._inst;e===f?(c.Update(d,null,a),this._renderCells=C3.New(C3.Rect,a)):(c.Update(d,e,a),e.copy(a)),b.SetRenderListStale()}}}_RemoveFromRenderCells(){const a=this._renderCells;a===f||(this.GetLayer().GetRenderGrid().Update(this._inst,a,null),this._renderCells=f)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const a=this._inst,b=this._layer,c=b._GetInstances();c.length&&c[c.length-1]===a||(b._RemoveInstance(a,!1),b._AddInstance(a,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const a=this._inst,b=this._layer,c=b._GetInstances();c.length&&c[0]===a||(b._RemoveInstance(a,!1),b._PrependInstance(a,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(a){const b=this._inst,c=this._layer;if(c.GetLayout()!==a.GetLayout())throw new Error("layer from different layout");a===c||(c._RemoveInstance(b,!0),this._SetLayer(a),a._AddInstance(b,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(a,b){const c=this._inst,d=this._layer;if(a.GetUID()!==c.GetUID()){const e=a.GetWorldInfo();if(!e)throw new Error("expected world instance");const f=e.GetLayer();d.GetIndex()!==f.GetIndex()&&(d._RemoveInstance(c,!0),this._SetLayer(f),f._AddInstance(c,!0)),f.MoveInstanceAdjacent(c,a,!!b),this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(a){this._SetFlag(64,a)}HasAnyActiveEffect(){return 0!=(this._flags&64)}_SaveToJson(){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 b=0!=(32&this._flags);return b&&(a["sfi"]=b),this._solidFilterTags&&(a["sft"]=[...this._solidFilterTags].join(" ")),a}_LoadFromJson(a){h=!1,this.SetX(a["x"]),this.SetY(a["y"]),this.SetWidth(a["w"]),this.SetHeight(a["h"]),this._SetZIndex(a["zi"]),this.SetZElevation(a.hasOwnProperty("ze")?a["ze"]:0),this.SetAngle(a.hasOwnProperty("a")?a["a"]:0),a.hasOwnProperty("c")?d.setFromJSON(a["c"]):a.hasOwnProperty("o")?(d.copyRgb(this._color),d.a=a["o"]):d.setRgba(1,1,1,1),this._SetColor(d),this.SetOriginX(a.hasOwnProperty("oX")?a["oX"]:.5),this.SetOriginY(a.hasOwnProperty("oY")?a["oY"]:.5),this.SetBlendMode(a.hasOwnProperty("bm")?a["bm"]:0),this.SetVisible(!a.hasOwnProperty("v")||a["v"]),this.SetCollisionEnabled(!a.hasOwnProperty("ce")||a["ce"]),this.SetBboxChangeEventEnabled(!!a.hasOwnProperty("be")&&a["be"]),this.SetSolidCollisionFilter(!!a.hasOwnProperty("sfi")&&a["sfi"],a.hasOwnProperty("sft")?a["sft"]:""),this._instanceEffectList&&a.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(a["fx"]),this.SetBboxChanged(),h=!0,this._UpdateWebGLStateGroup()}}}
// c3/objects/behaviorType.js
"use strict";C3.BehaviorType=class extends C3.DefendedBase{constructor(a,b){super();const c=a.GetRuntime(),d=c.GetPluginManager(),e=c.GetObjectReference(b[1]);d.HasBehaviorByConstructorFunction(e)||d.CreateBehavior(b),this._runtime=c,this._objectClass=a,this._behavior=d.GetBehaviorByConstructorFunction(e),this._sdkType=null,this._instSdkCtor=e.Instance,this._sid=b[2],this._name=b[0],this._jsPropName=this._runtime.GetJsPropName(b[3]),this._sdkType=C3.New(e.Type,this);this.OnCreate()}static Create(a,b){return C3.New(C3.BehaviorType,a,b)}Release(){this._runtime=null,this._behavior=null,this._sdkType.Release(),this._sdkType=null,this._instSdkCtor=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}};
// c3/objects/behaviorInstance.js
"use strict";C3.BehaviorInstance=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a.runtime,this._behaviorType=a.behaviorType,this._behavior=this._behaviorType.GetBehavior(),this._inst=a.instance,this._index=a.index,this._sdkInst=null,this._iScriptInterface=null,this._behavior._AddInstance(this._inst)}Release(){this._behavior._RemoveInstance(this._inst),this._sdkInst.Release(),this._sdkInst=null,this._iScriptInterface=null,this._runtime=null,this._behaviorType=null,this._behavior=null,this._inst=null}_CreateSdkInstance(a){if(this._sdkInst)throw new Error("already got sdk instance");this._sdkInst=C3.New(this._behaviorType.GetInstanceSdkCtor(),this,a);this._InitScriptInterface()}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(a,b){this._sdkInst.OnSpriteFrameChanged(a,b)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(c,a){const b=c.GetObjectInstance(),d=a.GetObjectInstance(),e=b.GetObjectClass().GetIndex(),f=d.GetObjectClass().GetIndex();if(e!==f)return e-f;const g=b.GetPUID(),h=d.GetPUID();return g===h?c.GetBehaviorInstance()._GetIndex()-a.GetBehaviorInstance()._GetIndex():g-h}_InitScriptInterface(){const a=IBehaviorInstance,b=this._sdkInst.GetScriptInterfaceClass();if(IBehaviorInstance._Init(this),this._iScriptInterface=new(b||a),IBehaviorInstance._Init(null),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}};
// c3/objects/effectList.js
"use strict";C3.EffectList=class extends C3.DefendedBase{constructor(a,b){super(),this._owner=a,this._allEffectTypes=[],this._activeEffectTypes=[],this._effectTypesByName=new Map,this._effectParams=[],this._preservesOpaqueness=!0;for(const c of b){const a=C3.New(C3.EffectType,this,c,this._allEffectTypes.length);this._allEffectTypes.push(a),this._effectTypesByName.set(a.GetName().toLowerCase(),a),3<=c.length&&this._effectParams.push(this._LoadSingleEffectParameters(c[2]))}this.GetRuntime()._AddEffectList(this)}Release(){C3.clearArray(this._allEffectTypes),C3.clearArray(this._activeEffectTypes),this._effectTypesByName.clear(),C3.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 a=0,b=this._allEffectTypes.length;a<b;++a)this._allEffectTypes[a]._SetIndex(a)}}_LoadSingleEffectParameters(a){const b=a.slice(0);for(let d=0,c=b.length;d<c;++d){const a=b[d];if(Array.isArray(a)){const e=C3.New(C3.Color);e.setFromJSON(a),b[d]=e}}return b}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){C3.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}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 C3.Color?{"t":"color","v":a.toJSON()}:a}static LoadFxParamFromJson(a){if("object"==typeof a){const b=a["t"];if("color"===b){const b=C3.New(C3.Color);return b.setFromJSON(a["v"]),b}throw new Error("invalid effect parameter type")}else return a}static SaveFxParamsToJson(a){return a.map(C3.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(a){return a.map(C3.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map((a)=>({"name":a.GetName(),"active":a.IsActive(),"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[a.GetIndex()])}))}LoadFromJson(a){for(const b of a){const a=this.GetEffectTypeByName(b["name"]);a&&(a.SetActive(b["active"]),this._effectParams[a.GetIndex()]=C3.EffectList.LoadFxParamsFromJson(b["params"]))}this.UpdateActiveEffects()}};
// c3/objects/effectType.js
"use strict";C3.EffectType=class extends C3.DefendedBase{constructor(a,b,c){super(),this._effectList=a,this._id=b[0],this._name=b[1],this._index=c,this._shaderProgram=null,this._isActive=!0}Release(){this._effectList=null,this._shaderProgram=null}Clone(a){const b=C3.New(C3.EffectType,a,[this._id,this._name],-1);return b._shaderProgram=this._shaderProgram,b._isActive=this._isActive,b}_InitRenderer(a){const b=a.GetShaderProgramByName(this._id);if(!b)throw new Error("failed to find shader program '"+this._id+"'");this._shaderProgram=b}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(b){this._isActive=!!b}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const a=[];for(let b=0,c=this._shaderProgram.GetParameterCount();b<c;++b){const c=this._shaderProgram.GetParameterType(b);if("float"===c||"percent"===c)a.push(0);else if("color"===c)a.push(C3.New(C3.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type")}return a}};
// c3/objects/instanceEffectList.js
"use strict";C3.InstanceEffectList=class extends C3.DefendedBase{constructor(a,b){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(){C3.clearArray(this._activeEffectFlags),C3.clearArray(this._activeEffectTypes),C3.clearArray(this._effectParams),this._inst=null,this._effectList=null}_LoadEffectParameters(a){for(const b of a)this._effectParams.push(this._LoadSingleEffectParameters(b))}_LoadSingleEffectParameters(a){const b=a.slice(0);for(let d=0,c=b.length;d<c;++d){const a=b[d];if(Array.isArray(a)){const e=C3.New(C3.Color);e.setFromJSON(a),b[d]=e}}return b}LoadDefaultEffectParameters(){for(const a of this._effectList.GetAllEffectTypes())this._effectParams.push(a.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}UpdateActiveEffects(){C3.clearArray(this._activeEffectTypes);const a=this._effectList.GetAllEffectTypes(),b=this._activeEffectTypes,c=this._activeEffectFlags;let d=!0;for(let e=0,f=a.length;e<f;++e)if(c[e]){const c=a[e];b.push(c),c.GetShaderProgram().PreservesOpaqueness()||(d=!1)}this._preservesOpaqueness=d,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}_SaveToJson(){return this._effectList.GetAllEffectTypes().map((a)=>({"name":a.GetName(),"active":this._activeEffectFlags[a.GetIndex()],"params":C3.EffectList.SaveFxParamsToJson(this._effectParams[a.GetIndex()])}))}_LoadFromJson(a){for(const b of a){const a=this._effectList.GetEffectTypeByName(b["name"]);a&&(this._activeEffectFlags[a.GetIndex()]=b["active"],this._effectParams[a.GetIndex()]=C3.EffectList.LoadFxParamsFromJson(b["params"]))}this.UpdateActiveEffects()}};
// c3/collisions/collisionEngine.js
"use strict";{const a=[],b=[],c=[],d=C3.New(C3.CollisionPoly),e=C3.New(C3.CollisionPoly),f=C3.New(C3.Quad),g=C3.New(C3.Rect),h=C3.New(C3.Rect);C3.CollisionEngine=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a,this._registeredCollisions=[],this._collisionCheckCount=0,this._collisionCheckSec=0,this._polyCheckCount=0,this._polyCheckSec=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(c,a){const b=c.GetWorldInfo(),d=a.GetWorldInfo();b&&d&&b.IsCollisionEnabled()&&d.IsCollisionEnabled()&&this._registeredCollisions.push([c,a])}AddRegisteredCollisionCandidates(c,d,e){for(const[f,a]of this._registeredCollisions){let b=null;if(c===f)b=a;else if(c===a)b=f;else continue;b.BelongsToObjectClass(d)&&!e.includes(b)&&e.push(b)}}CheckRegisteredCollision(e,a){if(!this._registeredCollisions.length)return!1;for(const[b,c]of this._registeredCollisions)if(e===b&&a===c||e===c&&a===b)return!0;return!1}ClearRegisteredCollisions(){C3.clearArray(this._registeredCollisions)}TestOverlap(c,d){if(!c||!d||c===d)return!1;const e=c.GetWorldInfo(),f=d.GetWorldInfo();if(!e.IsCollisionEnabled()||!f.IsCollisionEnabled())return!1;this._collisionCheckCount++;const g=e.GetLayer(),h=f.GetLayer(),i=g!==h&&!g._IsCollisionCompatibleWith(h);return i?this._TestOverlap_DifferentLayers(e,f):this._TestOverlap_SameLayers(e,f)}_TestOverlap_SameLayers(a,b){if(!a.GetBoundingBox().intersectsRect(b.GetBoundingBox()))return!1;if(this._polyCheckCount++,!a.GetBoundingQuad().intersectsQuad(b.GetBoundingQuad()))return!1;if(a.HasTilemap()&&b.HasTilemap())return!1;if(a.HasTilemap())return this.TestTilemapOverlap(a,b);if(b.HasTilemap())return this.TestTilemapOverlap(b,a);if(!a.HasOwnCollisionPoly()&&!b.HasOwnCollisionPoly())return!0;const c=a.GetTransformedCollisionPoly(),d=b.GetTransformedCollisionPoly();return c.intersectsPoly(d,b.GetX()-a.GetX(),b.GetY()-a.GetY())}_TestOverlap_DifferentLayers(a,b){const c=a.GetLayer(),f=b.GetLayer();d.copy(a.GetTransformedCollisionPoly()),e.copy(b.GetTransformedCollisionPoly());const g=d.pointsArr();for(let d=0,e=g.length;d<e;d+=2){const b=d+1,e=g[d],f=g[b],[h,i]=c.LayerToCanvasCss(e+a.GetX(),f+a.GetY());g[d]=h,g[b]=i}const h=e.pointsArr();for(let c=0,d=h.length;c<d;c+=2){const a=c+1,d=h[c],e=h[a],[g,i]=f.LayerToCanvasCss(d+b.GetX(),e+b.GetY());h[c]=g,h[a]=i}return d.setBboxChanged(),e.setBboxChanged(),this._polyCheckCount++,d.intersectsPoly(e,0,0)}TestTilemapOverlap(a,e){const g=e.GetBoundingBox(),h=a.GetX(),j=a.GetY(),c=a.GetInstance().GetSdkInstance(),i=e.GetX(),k=e.GetY(),l=e.HasOwnCollisionPoly(),m=e.GetBoundingQuad(),n=b;c.GetCollisionRectCandidates(g,n);for(let b=0,c=n.length;b<c;++b){const a=n[b],c=a.GetRect();if(this._collisionCheckCount++,g.intersectsRectOffset(c,h,j)&&(f.setFromRect(c),f.offset(h,j),f.intersectsQuad(m)))if(l){const b=e.GetTransformedCollisionPoly(),g=a.GetPoly();if(g){if(this._polyCheckCount++,g.intersectsPoly(b,i-(h+c.getLeft()),k-(j+c.getTop())))return C3.clearArray(n),!0;}else if(d.setFromQuad(f,0,0),d.intersectsPoly(b,i,k))return C3.clearArray(n),!0}else{const b=a.GetPoly();if(!b)return C3.clearArray(n),!0;if(d.setFromQuad(m,0,0),b.intersectsPoly(d,-(h+c.getLeft()),-(j+c.getTop())))return C3.clearArray(n),!0}}return C3.clearArray(n),!1}TestAndSelectCanvasPointOverlap(a,b,c,d){const e=a.GetCurrentSol(),f=this._runtime.GetCurrentEvent();if(!f)throw new Error("cannot call outside event");const g=f.IsOrBlock();if(e.IsSelectAll()){d||(e._SetSelectAll(!1),C3.clearArray(e._GetOwnInstances()));for(const f of a.GetInstances()){const a=f.GetWorldInfo(),h=a.GetLayer(),[i,j]=h.CanvasCssToLayer(b,c,a.GetTotalZElevation());if(a.ContainsPoint(i,j)){if(d)return!1;e._PushInstance(f)}else g&&e._PushElseInstance(f)}}else{const a=g?e._GetOwnElseInstances():e._GetOwnInstances();let f=0;for(let h=0,i=a.length;h<i;++h){const i=a[h],j=i.GetWorldInfo(),k=j.GetLayer(),[l,m]=k.CanvasCssToLayer(b,c,j.GetTotalZElevation());if(j.ContainsPoint(l,m)){if(d)return!1;g?e._PushInstance(i):a[f++]=i}else g&&(a[f++]=i)}d||(a.length=f)}return a.ApplySolToContainer(),!!d||e.HasAnyInstances()}GetCollisionCandidates(a,b,c,d){const e=!!a&&(1!==a.GetParallaxX()||1!==a.GetParallaxY());if(b.IsFamily())for(const a of b.GetFamilyMembers())e||a.IsAnyInstanceParallaxed()?C3.appendArray(d,a.GetInstances()):(a._UpdateAllCollisionCells(),a._GetCollisionCellGrid().QueryRange(c,d));else e||b.IsAnyInstanceParallaxed()?C3.appendArray(d,b.GetInstances()):(b._UpdateAllCollisionCells(),b._GetCollisionCellGrid().QueryRange(c,d))}GetObjectClassesCollisionCandidates(a,b,c,d){for(const e of b)this.GetCollisionCandidates(a,e,c,d)}GetSolidCollisionCandidates(a,b,c){const d=this._runtime.GetSolidBehavior();d&&this.GetObjectClassesCollisionCandidates(a,d.GetObjectClasses(),b,c)}GetJumpthruCollisionCandidates(a,b,c){const d=this._runtime.GetJumpthruBehavior();d&&this.GetObjectClassesCollisionCandidates(a,d.GetObjectClasses(),b,c)}IsSolidCollisionAllowed(a,b){return a._IsSolidEnabled()&&(!b||b.GetWorldInfo().IsSolidCollisionAllowed(a.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(b){const c=b.GetWorldInfo();this.GetSolidCollisionCandidates(c.GetLayer(),c.GetBoundingBox(),a);for(const c of a)if(this.IsSolidCollisionAllowed(c,b)&&this.TestOverlap(b,c))return C3.clearArray(a),c;return C3.clearArray(a),null}TestRectOverlapSolid(b,c){this.GetSolidCollisionCandidates(null,b,a);for(const d of a)if(this.IsSolidCollisionAllowed(d,c)&&this.TestRectOverlap(b,d))return C3.clearArray(a),d;return C3.clearArray(a),null}TestOverlapJumpthru(b,d){let e=null;d&&(e=c,C3.clearArray(e));const f=b.GetWorldInfo();this.GetJumpthruCollisionCandidates(f.GetLayer(),f.GetBoundingBox(),a);for(const c of a)if(c._IsJumpthruEnabled()&&this.TestOverlap(b,c))if(d)e.push(c);else return C3.clearArray(a),c;return C3.clearArray(a),e}PushOut(a,b,c,d,e){d=d||50;const f=a.GetWorldInfo(),g=f.GetX(),h=f.GetY();for(let j=0;j<d;++j)if(f.SetXY(g+b*j,h+c*j),f.SetBboxChanged(),!this.TestOverlap(a,e))return!0;return f.SetXY(g,h),f.SetBboxChanged(),!1}PushOutSolid(a,b,c,d,e,f){d=d||50;const g=a.GetWorldInfo(),h=g.GetX(),j=g.GetY();let k=null,l=null;for(let m=0;m<d;++m)if(g.SetXY(h+b*m,j+c*m),g.SetBboxChanged(),!this.TestOverlap(a,k))if(k=this.TestOverlapSolid(a),k)l=k;else if(e&&(k=f?this.TestOverlap(a,f)?f:null:this.TestOverlapJumpthru(a),k&&(l=k)),!k)return l&&this.PushInFractional(a,b,c,l,16,!0),!0;return g.SetXY(h,j),g.SetBboxChanged(),!1}PushOutSolidAxis(a,b,c,d){d=d||50;const e=a.GetWorldInfo(),f=e.GetX(),g=e.GetY();let h=null,j=null;for(let k=0;k<d;++k)for(let d=0;2>d;++d){const i=2*d-1;if(e.SetXY(f+b*k*i,g+c*k*i),e.SetBboxChanged(),!this.TestOverlap(a,h))if(h=this.TestOverlapSolid(a),h)j=h;else return j&&this.PushInFractional(a,b*i,c*i,j,16,!0),!0}return e.SetXY(f,g),e.SetBboxChanged(),!1}PushInFractional(a,b,c,d,e,f){let g=2,h=!1,i=!1;const j=a.GetWorldInfo();let k=j.GetX(),l=j.GetY();for(;g<=e;){const e=1/g;g*=2,j.OffsetXY(b*e*(h?1:-1),c*e*(h?1:-1)),j.SetBboxChanged(),this.TestOverlap(a,d)||f&&this.TestOverlapSolid(a)?(h=!0,i=!0):(h=!1,i=!1,k=j.GetX(),l=j.GetY())}i&&(j.SetXY(k,l),j.SetBboxChanged())}PushOutSolidNearest(a,b=100){var c=Math.floor;let d=0;const e=a.GetWorldInfo(),f=e.GetX(),g=e.GetY();let h=0,i=this.TestOverlapSolid(a);if(!i)return!0;for(;d<=b;){let b=0,j=0;if(0==h?(b=0,j=-1,d++):1==h?(b=1,j=-1):2==h?(b=1,j=0):3==h?(b=1,j=1):4==h?(b=0,j=1):5==h?(b=-1,j=1):6==h?(b=-1,j=0):7==h?(b=-1,j=-1):void 0,h=(h+1)%8,e.SetXY(c(f+b*d),c(g+j*d)),e.SetBboxChanged(),!this.TestOverlap(a,i)&&(i=this.TestOverlapSolid(a),!i))return!0}return e.SetXY(f,g),e.SetBboxChanged(),!1}CalculateBounceAngle(a,b,c,d){var e=Math.sin,f=Math.cos,g=Math.PI;const h=a.GetWorldInfo(),j=h.GetX(),k=h.GetY(),l=Math.max(10,C3.distanceTo(b,c,j,k)),m=C3.angleTo(b,c,j,k),n=d||this.TestOverlapSolid(a);if(!n)return C3.clampAngle(m+g);let o=n,p=0,q=0;const r=C3.toRadians(5);let s;for(s=1;36>s;++s){const g=m-s*r;if(h.SetXY(b+f(g)*l,c+e(g)*l),h.SetBboxChanged(),!this.TestOverlap(a,o)&&(o=d?null:this.TestOverlapSolid(a),!o)){p=g;break}}for(36===s&&(p=C3.clampAngle(m+g)),o=n,s=1;36>s;++s){const g=m+s*r;if(h.SetXY(b+f(g)*l,c+e(g)*l),h.SetBboxChanged(),!this.TestOverlap(a,o)&&(o=d?null:this.TestOverlapSolid(a),!o)){q=g;break}}if(36===s&&(q=C3.clampAngle(m+g)),h.SetXY(j,k),h.SetBboxChanged(),q===p)return q;const i=C3.angleDiff(q,p)/2;let t=C3.angleClockwise(q,p)?C3.clampAngle(p+i+g):C3.clampAngle(q+i);const u=f(m),v=e(m),w=f(t),x=e(t),y=u*w+v*x;return C3.angleTo(0,0,u-2*y*w,v-2*y*x)}TestSegmentOverlap(a,b,c,d,e){var f=Math.min,h=Math.max;if(!e)return!1;const i=e.GetWorldInfo();if(!i.IsCollisionEnabled())return!1;if(this._collisionCheckCount++,g.set(f(a,c),f(b,d),h(a,c),h(b,d)),!i.GetBoundingBox().intersectsRect(g))return!1;if(e.HasTilemap())return this._TestSegmentOverlapTilemap(a,b,c,d,e,i);if(this._polyCheckCount++,!i.GetBoundingQuad().intersectsSegment(a,b,c,d))return!1;if(!i.HasOwnCollisionPoly())return!0;const j=i.GetTransformedCollisionPoly();return j.intersectsSegment(i.GetX(),i.GetY(),a,b,c,d)}_TestSegmentOverlapTilemap(a,d,e,j,c,i){const k=i.GetX(),l=i.GetY(),m=c.GetSdkInstance(),n=b;h.set(a,d,e,j),h.normalize(),m.GetCollisionRectCandidates(h,n);for(let b=0,h=n.length;b<h;++b){const h=n[b],c=h.GetRect();if(this._collisionCheckCount++,g.intersectsRectOffset(c,k,l)&&(f.setFromRect(c),f.offset(k,l),f.intersectsSegment(a,d,e,j))){const b=h.GetPoly();if(!b)return C3.clearArray(n),!0;if(this._polyCheckCount++,b.intersectsSegment(k+c.getLeft(),l+c.getTop(),a,d,e,j))return C3.clearArray(n),!0}}return C3.clearArray(n),!1}TestRectOverlap(a,b){if(!b)return!1;const c=b.GetWorldInfo();if(!c.IsCollisionEnabled())return!1;if(this._collisionCheckCount++,!c.GetBoundingBox().intersectsRect(a))return!1;if(b.HasTilemap())return this._TestRectOverlapTilemap(a,b,c);if(this._polyCheckCount++,f.setFromRect(a),!c.GetBoundingQuad().intersectsQuad(f))return!1;if(!c.HasOwnCollisionPoly())return!0;const e=d;e.setFromRect(a,c.GetX(),c.GetY());const g=c.GetTransformedCollisionPoly();return e.intersectsPoly(g,0,0)}_TestRectOverlapTilemap(a,c,e){const f=e.GetX(),g=e.GetY(),h=c.GetSdkInstance(),j=b;h.GetCollisionRectCandidates(a,j);for(let b=0,h=j.length;b<h;++b){const e=j[b],c=e.GetRect();if(this._collisionCheckCount++,a.intersectsRectOffset(c,f,g)){const b=e.GetPoly();if(!b)return C3.clearArray(j),!0;if(this._polyCheckCount++,d.setFromRect(a,0,0),b.intersectsPoly(d,-(f+c.getLeft()),-(g+c.getTop())))return C3.clearArray(j),!0}}return C3.clearArray(j),!1}TestRayIntersectsInstance(a,b){if(a){const c=a.GetWorldInfo();if(c.IsCollisionEnabled())return this._collisionCheckCount++,c.GetBoundingBox().intersectsRect(b.rect)?a.HasTilemap()?void this._TestRayIntersectsTilemap(a,c,b):void(this._polyCheckCount++,c.HasOwnCollisionPoly()?b.TestInstancePoly(a,c.GetX(),c.GetY(),c.GetTransformedCollisionPoly()):b.TestInstanceQuad(a,c.GetBoundingQuad())):void 0}}_TestRayIntersectsTilemap(a,d,e){const f=d.GetX(),g=d.GetY(),h=b;a.GetSdkInstance().GetCollisionRectCandidates(e.rect,h);for(let b=0,c=h.length;b<c;b++){const i=h[b],c=i.GetRect();if(this._collisionCheckCount++,e.rect.intersectsRectOffset(c,f,g)){const b=i.GetPoly();this._polyCheckCount++,b?e.TestInstancePoly(a,f+c.getLeft(),g+c.getTop(),b):e.TestInstanceRect(a,d.GetX(),d.GetY(),c)}}C3.clearArray(h)}}}
// c3/collisions/sparseGrid.js
"use strict";C3.SparseGrid=class extends C3.DefendedBase{constructor(a,b){super(),this._cellWidth=a,this._cellHeight=b,this._cells=C3.New(C3.PairMap)}Release(){this._cells.Release(),this._cells=null}GetCell(a,b,c){let d=this._cells.Get(a,b);return d?d:c?(d=C3.New(C3.GridCell,this,a,b),this._cells.Set(a,b,d),d):null}XToCell(a){const b=Math.floor(a/this._cellWidth);return isFinite(b)?b:0}YToCell(a){const b=Math.floor(a/this._cellHeight);return isFinite(b)?b:0}Update(a,b,c){if(b)for(let d=b.getLeft(),e=b.getRight();d<=e;++d)for(let e=b.getTop(),f=b.getBottom();e<=f;++e){if(c&&c.containsPoint(d,e))continue;const b=this.GetCell(d,e,!1);b&&(b.Remove(a),b.IsEmpty()&&this._cells.Delete(d,e))}if(c)for(let d=c.getLeft(),e=c.getRight();d<=e;++d)for(let e=c.getTop(),f=c.getBottom();e<=f;++e)b&&b.containsPoint(d,e)||this.GetCell(d,e,!0).Insert(a)}QueryRange(a,b){let c=this.XToCell(a.getLeft());const d=this.YToCell(a.getTop()),e=this.XToCell(a.getRight()),f=this.YToCell(a.getBottom());if(isFinite(e)&&isFinite(f))for(;c<=e;++c)for(let a=d;a<=f;++a){const d=this.GetCell(c,a,!1);d&&d.Dump(b)}}};
// c3/collisions/gridCell.js
"use strict";C3.GridCell=class extends C3.DefendedBase{constructor(a,b,c){super(),this._grid=a,this._x=b,this._y=c,this._instances=C3.New(C3.ArraySet)}Release(){this._instances.Release(),this._instances=null,this._grid=null}IsEmpty(){return this._instances.IsEmpty()}Insert(a){this._instances.Add(a)}Remove(a){this._instances.Delete(a)}Dump(a){C3.appendArray(a,this._instances.GetArray())}};
// c3/collisions/ray.js
"use strict";{const a=1e-6;C3.Ray=class{constructor(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.dx=0,this.dy=0,this.rect=new C3.Rect,this.hitFraction=2,this.hitUid=null,this.hitNormal=0,this.hitNormalDx=0,this.hitNormalDy=0,this.hitX=0,this.hitY=0,this.distance=0,this.normalX=1,this.normalY=0,this.reflectionX=1,this.reflectionY=0}DidCollide(){return this.hitFraction<1+a}Set(a,b,c,d){return this.x1=a,this.y1=b,this.x2=c,this.y2=d,this.dx=c-a,this.dy=d-b,this.rect.set(a,b,c,d),this.rect.normalize(),this.hitFraction=2,this.hitUid=null,this.hitNormal=0,this.hitNormalDx=0,this.hitNormalDy=0,this.hitX=0,this.hitY=0,this.distance=0,this.normalX=1,this.normalY=0,this.reflectionX=1,this.reflectionY=0,this}Complete(){var b=Math.PI;if(!1!==this.DidCollide()){const c=this.dx*this.hitFraction,d=this.dy*this.hitFraction,e=Math.sqrt(c*c+d*d),f=c/e,g=d/e;this.distance=e-a,this.hitX=this.x1+f*this.distance,this.hitY=this.y1+g*this.distance,this.hitNormal=Math.atan2(this.hitNormalDy,this.hitNormalDx)+b/2,this.normalX=Math.cos(this.hitNormal),this.normalY=Math.sin(this.hitNormal);const h=f*this.normalX+g*this.normalY;if(this.reflectionX=f-2*this.normalX*h,this.reflectionY=g-2*this.normalY*h,0<h){this.hitNormal=C3.clampAngle(this.hitNormal+b),this.normalX=-this.normalX,this.normalY=-this.normalY}}}TestInstanceSegment(a,b,c,d,e){const f=C3.rayIntersect(this.x1,this.y1,this.x2,this.y2,b,c,d,e);0<=f&&f<this.hitFraction&&(this.hitFraction=f,this.hitUid=a.GetUID(),this.hitNormalDx=b-d,this.hitNormalDy=c-e)}TestInstanceRect(a,b,c,d){const e=b+d.getLeft(),f=b+d.getRight(),g=c+d.getTop(),h=c+d.getBottom();this.TestInstanceSegment(a,e,g,f,g),this.TestInstanceSegment(a,f,g,f,h),this.TestInstanceSegment(a,f,h,e,h),this.TestInstanceSegment(a,e,h,e,g)}TestInstanceQuad(a,b){const c=b.getTlx(),d=b.getTly(),e=b.getTrx(),f=b.getTry(),g=b.getBrx(),h=b.getBry(),i=b.getBlx(),j=b.getBly();this.TestInstanceSegment(a,c,d,e,f),this.TestInstanceSegment(a,e,f,g,h),this.TestInstanceSegment(a,g,h,i,j),this.TestInstanceSegment(a,i,j,c,d)}TestInstancePoly(a,b,c,d){const e=d.pointsArr();for(let f=0,g=e.length;f<g;f+=2){const d=(f+2)%g,h=e[f]+b,i=e[f+1]+c,j=e[d]+b,k=e[d+1]+c;this.TestInstanceSegment(a,h,i,j,k)}}}}
// c3/canvasManager.js
"use strict";{const a=new Set(["off","crop","scale-inner","scale-outer","letterbox-scale","letterbox-integer-scale"]),b=new Set(["high","low"]),c=C3.New(C3.Quad),d=C3.New(C3.Rect);C3.CanvasManager=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a,this._canvas=null,this._webglRenderer=null,this._gpuPreference="high-performance",this._windowInnerWidth=0,this._windowInnerHeight=0,this._canvasCssWidth=0,this._canvasCssHeight=0,this._canvasDeviceWidth=0,this._canvasDeviceHeight=0,this._canvasCssOffsetX=0,this._canvasCssOffsetY=0,this._drawWidth=0,this._drawHeight=0,this._fullscreenMode="letterbox-scale",this._documentFullscreenMode="letterbox-scale",this._deviceTransformOffX=0,this._deviceTransformOffY=0,this._wantFullscreenScalingQuality="high",this._fullscreenScalingQuality=this._wantFullscreenScalingQuality,this._isDocumentFullscreen=!1,this._availableAdditionalRenderTargets=[],this._usedAdditionalRenderTargets=new Set,this._shaderData=null,this._gpuFrameTimingsBuffer=null,this._gpuTimeStartFrame=0,this._gpuTimeEndFrame=0,this._gpuCurUtilisation=NaN,this._gpuLastUtilisation=0,this._layersGpuProfile=new Map,this._snapshotFormat="",this._snapshotQuality=1,this._snapshotUrl="",this._snapshotPromise=null,this._snapshotResolve=null,this._loaderStartTime=0,this._rafId=-1,this._loadingProgress=0,this._loadingprogress_handler=(a)=>this._loadingProgress=a.progress,this._webglPercentText=null,this._loadingLogoAsset=null,this._splashTextures={logo:null,powered:null,website:null},this._splashFrameNumber=0,this._splashFadeInFinishTime=0,this._splashFadeOutStartTime=0,this._splashState="fade-in",this._splashDoneResolve=null,this._splashDonePromise=new Promise((a)=>this._splashDoneResolve=a)}_SetGPUPowerPreference(a){this._gpuPreference=a}async CreateCanvas(a){this._canvas=a["canvas"],this._canvas.addEventListener("webglcontextlost",(a)=>this._OnWebGLContextLost(a)),this._canvas.addEventListener("webglcontextrestored",(a)=>this._OnWebGLContextRestored(a));const b={powerPreference:this._gpuPreference,enableGpuProfiling:!0};"Android"===C3.Platform.OS&&"Chromium"===C3.Platform.BrowserEngine&&75>C3.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."),b.maxWebGLVersion=1),"standard"===this._runtime.GetCompositingMode()?b.alpha=!0:(b.alpha=!1,b.lowLatency=!0),this._webglRenderer=C3.New(C3.Gfx.WebGLRenderer,this._canvas,b),await this._webglRenderer.InitState(),this._webglRenderer.SupportsGPUProfiling()||(this._gpuLastUtilisation=NaN),this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",(a)=>this._OnWindowResize(a)),this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",(a)=>this._OnFullscreenChange(a)),this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",(a)=>this._OnFullscreenError(a)),this._isDocumentFullscreen=!!a["isFullscreen"],this.SetSize(a["windowInnerWidth"],a["windowInnerHeight"],!0),this._shaderData=self["C3_Shaders"],await this._LoadShaderPrograms();let c=!1;for(const b of this._runtime._GetAllEffectLists()){for(const a of b.GetAllEffectTypes())a._InitRenderer(this._webglRenderer),a.GetShaderProgram().UsesDest()&&(c=!0);b.UpdateActiveEffects()}this._runtime._SetUsesAnyBackgroundBlending(c),this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=C3.New(C3.Gfx.WebGLQueryResultBuffer,this._webglRenderer))}async _LoadShaderPrograms(){if(this._shaderData){const a=[];for(const[b,c]of Object.entries(this._shaderData)){const d=C3.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource(this._webglRenderer.Is3D());a.push(this._webglRenderer.CreateShaderProgram(c,d,b))}await Promise.all(a),this._webglRenderer.ResetLastProgram(),this._webglRenderer.SetTextureFillMode()}}Release(){this._runtime=null,this._webglRenderer=null,this._canvas=null}_OnWindowResize(a){const b=a["devicePixelRatio"];this._runtime.IsInWorker()&&(self.devicePixelRatio=b),this._runtime._SetDevicePixelRatio(b),this.SetSize(a["innerWidth"],a["innerHeight"]),this._runtime.UpdateRender()}_OnFullscreenChange(a){this._isDocumentFullscreen=!!a["isFullscreen"],this.SetSize(a["innerWidth"],a["innerHeight"],!0),this._runtime.UpdateRender()}_OnFullscreenError(a){this._isDocumentFullscreen=!!a["isFullscreen"],this.SetSize(a["innerWidth"],a["innerHeight"],!0),this._runtime.UpdateRender()}SetSize(a,b,c=!1){var d=Math.floor;if(a=d(a),b=d(b),0>=a||0>=b)throw new Error("invalid size");if(this._windowInnerWidth!==a||this._windowInnerHeight!==b||c){this._windowInnerWidth=a,this._windowInnerHeight=b;const c=this.GetCurrentFullscreenMode();"letterbox-scale"===c?this._CalculateLetterboxScale(a,b):"letterbox-integer-scale"===c?this._CalculateLetterboxIntegerScale(a,b):"off"===c?this._CalculateFixedSizeCanvas(a,b):this._CalculateFullsizeCanvas(a,b),this._UpdateFullscreenScalingQuality(c),this._canvas.width=this._canvasDeviceWidth,this._canvas.height=this._canvasDeviceHeight,this._runtime.PostComponentMessageToDOM("canvas","update-size",{"marginLeft":this._canvasCssOffsetX,"marginTop":this._canvasCssOffsetY,"styleWidth":this._canvasCssWidth,"styleHeight":this._canvasCssHeight}),this._webglRenderer.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0)}}_CalculateLetterboxScale(a,b){var c=Math.round,d=Math.floor;const e=this._runtime.GetDevicePixelRatio(),f=this._runtime.GetOriginalViewportWidth(),g=this._runtime.GetOriginalViewportHeight(),h=f/g;if(a/b>h){this._canvasCssWidth=c(b*h),this._canvasCssHeight=b,this._canvasCssOffsetX=d((a-this._canvasCssWidth)/2),this._canvasCssOffsetY=0}else{this._canvasCssWidth=a,this._canvasCssHeight=c(a/h),this._canvasCssOffsetX=0,this._canvasCssOffsetY=d((b-this._canvasCssHeight)/2)}this._canvasDeviceWidth=c(this._canvasCssWidth*e),this._canvasDeviceHeight=c(this._canvasCssHeight*e),this._runtime.SetViewportSize(f,g)}_CalculateLetterboxIntegerScale(a,b){var c=Math.max,d=Math.round,e=Math.floor;const f=this._runtime.GetDevicePixelRatio();1!==f&&(a+=1,b+=1);const g=this._runtime.GetOriginalViewportWidth(),h=this._runtime.GetOriginalViewportHeight(),i=g/h,j=a/b;let k;if(j>i){const a=b*i;k=a*f/g}else{const b=a/i;k=b*f/h}1<k?k=e(k):1>k&&(k=1/Math.ceil(1/k)),this._canvasDeviceWidth=d(g*k),this._canvasDeviceHeight=d(h*k),this._canvasCssWidth=this._canvasDeviceWidth/f,this._canvasCssHeight=this._canvasDeviceHeight/f,this._canvasCssOffsetX=c(e((a-this._canvasCssWidth)/2),0),this._canvasCssOffsetY=c(e((b-this._canvasCssHeight)/2),0),this._runtime.SetViewportSize(g,h)}_CalculateFullsizeCanvas(a,b){var c=Math.round;const d=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=a,this._canvasCssHeight=b,this._canvasDeviceWidth=c(this._canvasCssWidth*d),this._canvasDeviceHeight=c(this._canvasCssHeight*d),this._canvasCssOffsetX=0,this._canvasCssOffsetY=0;const e=this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/e,this._canvasCssHeight/e)}_CalculateFixedSizeCanvas(a,b){var c=Math.round,d=Math.floor;const e=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth(),this._canvasCssHeight=this._runtime.GetViewportHeight(),this._canvasDeviceWidth=c(this._canvasCssWidth*e),this._canvasDeviceHeight=c(this._canvasCssHeight*e),this.IsDocumentFullscreen()?(this._canvasCssOffsetX=d((a-this._canvasCssWidth)/2),this._canvasCssOffsetY=d((b-this._canvasCssHeight)/2)):(this._canvasCssOffsetX=0,this._canvasCssOffsetY=0),this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(a){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let b,c;if("off"===this.GetCurrentFullscreenMode()?(b=this._runtime.GetViewportWidth(),c=this._runtime.GetViewportHeight()):(b=this._runtime.GetOriginalViewportWidth(),c=this._runtime.GetOriginalViewportHeight()),this._canvasDeviceWidth<b&&this._canvasDeviceHeight<c)this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else if(this._drawWidth=b,this._drawHeight=c,this._fullscreenScalingQuality="low","scale-inner"===a){const a=b/c,d=this._windowInnerWidth/this._windowInnerHeight;d<a?this._drawWidth=this._drawHeight*d:d>a&&(this._drawHeight=this._drawWidth/d)}else if("scale-outer"===a){const a=b/c,d=this._windowInnerWidth/this._windowInnerHeight;d>a?this._drawWidth=this._drawHeight*d:d<a&&(this._drawHeight=this._drawWidth/d)}}}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(b){if(!a.has(b))throw new Error("invalid fullscreen mode");this._fullscreenMode=b}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(b){if(!a.has(b))throw new Error("invalid fullscreen mode");this._documentFullscreenMode=b}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?this.GetDocumentFullscreenMode():this.GetFullscreenMode()}SetFullscreenScalingQuality(a){if(!b.has(a))throw new Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=a}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(a){switch(a){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 new Error("invalid fullscreen mode");}}GetLastWidth(){return this._windowInnerWidth}GetLastHeight(){return this._windowInnerHeight}GetDrawWidth(){return this._drawWidth}GetDrawHeight(){return this._drawHeight}IsWebGLContextLost(){return this._webglRenderer.IsContextLost()}_OnWebGLContextLost(a){console.log("[Construct 3] WebGL context lost"),a.preventDefault(),this._availableAdditionalRenderTargets=[],this._usedAdditionalRenderTargets.clear(),this._webglRenderer.OnContextLost(),this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(){await this._webglRenderer.OnContextRestored(),await this._LoadShaderPrograms();for(const a of this._runtime._GetAllEffectLists())for(const b of a.GetAllEffectTypes())b._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored(),console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const a=this.GetCurrentFullscreenMode();if("off"===a||"crop"===a)return 1;const b=this._runtime.GetOriginalViewportWidth(),c=this._runtime.GetOriginalViewportHeight(),d=b/c,e=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==a&&e>d||"scale-inner"===a&&e<d?this._canvasCssHeight/c:this._canvasCssWidth/b}SetDeviceTransformOffset(a,b){this._deviceTransformOffX=a,this._deviceTransformOffY=b}SetDeviceTransform(a,b,c){const d=(b||this._drawWidth)/2+this._deviceTransformOffX,e=(c||this._drawHeight)/2+this._deviceTransformOffY;a.SetCameraXYZ(d,e,100*this._runtime.GetDevicePixelRatio()),a.SetLookXYZ(d,e,0),a.ResetModelView(),a.UpdateModelView()}SetCssTransform(a){const b=this._canvasCssWidth/2,c=this._canvasCssHeight/2;a.SetCameraXYZ(b,c,100),a.SetLookXYZ(b,c,0),a.ResetModelView(),a.UpdateModelView()}GetDeviceWidth(){return this._canvasDeviceWidth}GetDeviceHeight(){return this._canvasDeviceHeight}GetCssWidth(){return this._canvasCssWidth}GetCssHeight(){return this._canvasCssHeight}GetCanvasClientX(){return this._canvasCssOffsetX}GetCanvasClientY(){return this._canvasCssOffsetY}GetAdditionalRenderTarget(a){const b=this._availableAdditionalRenderTargets,c=b.findIndex((b)=>b.IsCompatibleWithOptions(a));let d;return-1===c?d=this._webglRenderer.CreateRenderTarget(a):(d=b[c],b.splice(c,1)),this._usedAdditionalRenderTargets.add(d),d}ReleaseAdditionalRenderTarget(a){if(!this._usedAdditionalRenderTargets.has(a))throw new Error("render target not in use");this._usedAdditionalRenderTargets.delete(a),this._availableAdditionalRenderTargets.push(a)}*activeLayersGpuProfiles(){for(const a of this._runtime.GetLayoutManager().runningLayouts())for(const b of a.GetLayers()){const a=this._layersGpuProfile.get(b);a&&(yield a)}}GetLayerTimingsBuffer(a){if(!this._webglRenderer.SupportsGPUProfiling())return null;let b=this._layersGpuProfile.get(a);return b||(b={name:a.GetName(),timingsBuffer:C3.New(C3.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(a,b)),b.timingsBuffer}_Update1sFrameRange(){if(this._webglRenderer.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=this._webglRenderer.GetFrameNumber(),this._gpuCurUtilisation=NaN;for(const a of this.activeLayersGpuProfiles())a.curUtilisation=NaN}}_UpdateTick(){var a=Math.min;if(this._webglRenderer.SupportsGPUProfiling()&&isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const a of this.activeLayersGpuProfiles())if(a.curUtilisation=a.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),isNaN(a.curUtilisation))return;if(this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),this._gpuLastUtilisation=a(this._gpuCurUtilisation,1),this._runtime.IsDebug()){for(const b of this.activeLayersGpuProfiles())b.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),b.lastUtilisation=a(b.curUtilisation,1);C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame,this._gpuTimeEndFrame=0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(a,b){return(this._snapshotFormat=a,this._snapshotQuality=b,this._snapshotPromise)?this._snapshotPromise:(this._snapshotPromise=new Promise((a)=>{this._snapshotResolve=a}),this._snapshotPromise)}_MaybeTakeSnapshot(){this._snapshotFormat&&(C3.CanvasToBlob(this._canvas,this._snapshotFormat,this._snapshotQuality).then((a)=>{this._snapshotUrl=URL.createObjectURL(a),this._snapshotPromise=null,this._snapshotResolve(this._snapshotUrl)}),this._snapshotFormat="",this._snapshotQuality=1)}GetCanvasSnapshotUrl(){return this._snapshotUrl}InitLoadingScreen(a){if(2===a)this._webglPercentText=C3.New(C3.Gfx.WebGLText,this._webglRenderer),this._webglPercentText.SetIsAsync(!1),this._webglPercentText.SetFontName("Arial"),this._webglPercentText.SetFontSize(16),this._webglPercentText.SetHorizontalAlignment("center"),this._webglPercentText.SetVerticalAlignment("center"),this._webglPercentText.SetSize(300,200);else if(0===a){const a=this._runtime.GetAssetManager();let b;if(this._runtime.IsPreview()){if(!a._HasLocalUrlBlob("loading-logo.png"))return;b=a.GetLocalUrlAsBlobUrl("loading-logo.png")}else b=a.GetIconsSubfolder()+"loading-logo.png";this._loadingLogoAsset=a.LoadImage({url:b}),this._loadingLogoAsset.LoadStaticTexture(this._webglRenderer).catch(()=>console.warn(`[C3 runtime] Failed to load 'loading-logo.png' for loading screen. Check the project has an icon with that name.`))}else 4===a&&(this._LoadSvgSplashImage("splash-images/splash-logo.svg").then((a)=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(a):this._splashTextures.logo=a}).catch((a)=>console.warn("Failed to load splash image: ",a)),this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then((a)=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(a):this._splashTextures.powered=a}).catch((a)=>console.warn("Failed to load splash image: ",a)),this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then((a)=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(a):this._splashTextures.website=a}).catch((a)=>console.warn("Failed to load splash image: ",a)))}async _LoadSvgSplashImage(a){a=new URL(a,this._runtime.GetBaseURL()).toString();const b=await C3.FetchBlob(a),c=await this._runtime.RasterSvgImage(b,2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(c,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(a){a=new URL(a,this._runtime.GetBaseURL()).toString();const b=await C3.FetchBlob(a);return await this._webglRenderer.CreateStaticTextureAsync(b,{mipMapQuality:"high"})}StartLoadingScreen(){this._loaderStartTime=Date.now(),this._runtime.Dispatcher().addEventListener("loadingprogress",this._loadingprogress_handler),this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}async EndLoadingScreen(){this._loadingProgress=1,4===this._runtime.GetLoaderStyle()&&(await this._splashDonePromise),this._splashDoneResolve=null,this._splashDonePromise=null,-1!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=-1),this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler),this._loadingprogress_handler=null,this._webglPercentText&&(this._webglPercentText.Release(),this._webglPercentText=null),this._loadingLogoAsset&&(this._loadingLogoAsset.Release(),this._loadingLogoAsset=null),this._webglRenderer.Start(),this._splashTextures.logo&&(this._webglRenderer.DeleteTexture(this._splashTextures.logo),this._splashTextures.logo=null),this._splashTextures.powered&&(this._webglRenderer.DeleteTexture(this._splashTextures.powered),this._splashTextures.powered=null),this._splashTextures.website&&(this._webglRenderer.DeleteTexture(this._splashTextures.website),this._splashTextures.website=null),this._webglRenderer.ClearRgba(0,0,0,0),this._webglRenderer.Finish(),this._splashState="done",this._gpuTimeStartFrame=this._webglRenderer.GetFrameNumber()}_DrawLoadingScreen(){if(-1!==this._rafId){const a=this._webglRenderer;a.Start(),this._rafId=-1;const b=this._runtime.GetAssetManager().HasHadErrorLoading(),c=this._runtime.GetLoaderStyle();if(3!==c&&(this.SetCssTransform(a),a.ClearRgba(0,0,0,0),a.ResetColor(),a.SetTextureFillMode(),a.SetTexture(null)),0===c)this._DrawProgressBarAndLogoLoadingScreen(b);else if(1===c)this._DrawProgressBarLoadingScreen(b,120,0);else if(2===c)this._DrawPercentTextLoadingScreen(b);else if(3===c)C3.noop();else if(4===c)this._DrawSplashLoadingScreen(b);else throw new Error("invalid loader style");a.Finish(),this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}_DrawPercentTextLoadingScreen(a){a?this._webglPercentText.SetColorRgb(1,0,0):this._webglPercentText.SetColorRgb(.6,.6,.6),this._webglPercentText.SetText(Math.round(100*this._loadingProgress)+"%");const b=this._canvasCssWidth/2,d=this._canvasCssHeight/2;c.setRect(b-150,d-100,b+150,d+100),this._webglRenderer.SetTexture(this._webglPercentText.GetTexture()),this._webglRenderer.Quad3(c,this._webglPercentText.GetTexRect())}_DrawProgressBarLoadingScreen(a,b,c){const e=this._webglRenderer;e.SetColorFillMode(),a?e.SetColorRgba(1,0,0,1):e.SetColorRgba(.118,.565,1,1);const f=this._canvasCssWidth/2,g=this._canvasCssHeight/2,h=b/2;d.setWH(f-h,g-4+c,Math.floor(b*this._loadingProgress),8),e.Rect(d),d.setWH(f-h,g-4+c,b,8),d.offset(-.5,-.5),d.inflate(.5,.5),e.SetColorRgba(0,0,0,1),e.LineRect2(d),d.inflate(1,1),e.SetColorRgba(1,1,1,1),e.LineRect2(d)}_DrawProgressBarAndLogoLoadingScreen(a){if(!this._loadingLogoAsset)return void this._DrawProgressBarLoadingScreen(a,120,0);const b=this._loadingLogoAsset.GetTexture();if(!b)return void this._DrawProgressBarLoadingScreen(a,120,0);const d=b.GetWidth(),e=b.GetHeight(),f=this._canvasCssWidth/2,g=this._canvasCssHeight/2,h=d/2,i=e/2;c.setRect(f-h,g-i,f+h,g+i),this._webglRenderer.SetTexture(b),this._webglRenderer.Quad(c),this._DrawProgressBarLoadingScreen(a,d,i+16)}_DrawSplashLoadingScreen(b){var c=Math.min,e=Math.max,f=Math.ceil;const g=this._webglRenderer,i=this._splashTextures.logo,j=this._splashTextures.powered,k=this._splashTextures.website,l=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=l);const m=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),n=m?0:200,o=m?0:3000;let p=1;"fade-in"===this._splashState?p=c((l-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&(p=e(1-(l-this._splashFadeOutStartTime)/300,0)),g.SetColorFillMode(),g.SetColorRgba(.231*p,.251*p,.271*p,p),d.set(0,0,this._canvasCssWidth,this._canvasCssHeight),g.Rect(d);const a=f(this._canvasCssWidth),q=f(this._canvasCssHeight);let h,r;256<this._canvasCssHeight?(g.SetColorRgba(.302*p,.334*p,.365*p,p),h=a,r=e(.005*q,2),d.setWH(0,.8*q-r/2,h,r),g.Rect(d),b?g.SetColorRgba(p,0,0,p):g.SetColorRgba(.161*p,.953*p,.816*p,p),h=a*this._loadingProgress,d.setWH(.5*a-h/2,.8*q-r/2,h,r),g.Rect(d),g.SetColorRgba(p,p,p,p),g.SetTextureFillMode(),j&&(h=1.5*C3.clamp(.22*q,105,.6*a),r=h/8,d.setWH(.5*a-h/2,.2*q-r/2,h,r),g.SetTexture(j),g.Rect(d)),i&&(h=c(.395*q,.95*a),r=h,d.setWH(.5*a-h/2,.485*q-r/2,h,r),g.SetTexture(i),g.Rect(d)),k&&(h=1.5*C3.clamp(.22*q,105,.6*a),r=h/8,d.setWH(.5*a-h/2,.868*q-r/2,h,r),g.SetTexture(k),g.Rect(d))):(g.SetColorRgba(.302*p,.334*p,.365*p,p),h=a,r=e(.005*q,2),d.setWH(0,.85*q-r/2,h,r),g.Rect(d),b?g.SetColorRgba(p,0,0,p):g.SetColorRgba(.161*p,.953*p,.816*p,p),h=a*this._loadingProgress,d.setWH(.5*a-h/2,.85*q-r/2,h,r),g.Rect(d),g.SetColorRgba(p,p,p,p),g.SetTextureFillMode(),i&&(h=.55*q,r=h,d.setWH(.5*a-h/2,.45*q-r/2,h,r),g.SetTexture(i),g.Rect(d))),this._splashFrameNumber++,"fade-in"===this._splashState&&l-this._loaderStartTime>=300&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=l),"wait"===this._splashState&&l-this._splashFadeInFinishTime>=o&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=l),("fade-out"===this._splashState&&l-this._splashFadeOutStartTime>=300+n||m&&1<=this._loadingProgress&&500>l-this._loaderStartTime)&&this._splashDoneResolve()}}}
// c3/runtime.js
"use strict";{const e={"messagePort":null,"baseUrl":"","headless":!1,"hasDom":!0,"isInWorker":!1,"useAudio":!0,"projectData":"","exportType":""};let a=!0;C3.Runtime=class extends C3.DefendedBase{constructor(n){n=Object.assign({},e,n);super(),this._messagePort=n["messagePort"],this._baseUrl=n["baseUrl"],this._isHeadless=!!n["headless"],this._hasDom=!!n["hasDom"],this._isInWorker=!!n["isInWorker"],a=n["ife"],this._useAudio=!!n["useAudio"],this._exportType=n["exportType"],this._isiOSCordova=!!n["isiOSCordova"],this._isiOSWebView=!!n["isiOSWebView"],this._isFBInstantAvailable=!!n["isFBInstantAvailable"],this._opusWasmScriptUrl=n["opusWasmScriptUrl"],this._opusWasmBinaryUrl=n["opusWasmBinaryUrl"],this._dataJsonFilename="data.json",this._isDebug=!!("preview"===this._exportType&&n["isDebug"]),this._breakpointsEnabled=this._isDebug,this._isDebugging=this._isDebug,this._debuggingDisabled=0;const t=n["previewImageBlobs"],s=n["previewProjectFileBlobs"];s&&Object.assign(t,s);const i=n["projectData"];i&&(t[this._dataJsonFilename]=i),this._additionalLoadPromises=[],this._projectName="",this._projectVersion="",this._projectUniqueId="",this._appId="",this._originalViewportWidth=0,this._originalViewportHeight=0,this._devicePixelRatio=self.devicePixelRatio,this._parallaxXorigin=0,this._parallaxYorigin=0,this._viewportWidth=0,this._viewportHeight=0,this._loaderStyle=0,this._usesLoaderLayout=!1,this._isLoading=!0,this._usesAnyBackgroundBlending=!1;const r="html5"===this._exportType||"scirra-arcade"===this._exportType||"instant-games"===this._exportType;this._assetManager=C3.New(C3.AssetManager,this,{defaultLoadPolicy:r?"remote":"local",localUrlBlobs:t,isCordova:"cordova"===this._exportType,isiOSCordova:this._isiOSCordova,supportedAudioFormats:n["supportedAudioFormats"]}),this._layoutManager=C3.New(C3.LayoutManager,this),this._eventSheetManager=C3.New(C3.EventSheetManager,this),this._pluginManager=C3.New(C3.PluginManager,this),this._collisionEngine=C3.New(C3.CollisionEngine,this),this._timelineManager=C3.New(C3.TimelineManager,this),this._transitionManager=C3.New(C3.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._hasPendingInstances=!1,this._isFlushingPendingInstances=!1,this._objectCount=0,this._nextUid=0,this._instancesByUid=new Map,this._instancesToReleaseAtEndOfTick=new Set,this._instancesToReleaseAffectedObjectClasses=new Set,this._objectReferenceTable=[],this._jsPropNameTable=[],this._canvasManager=null,this._framerateMode="vsync",this._compositingMode="standard",this._sampling="trilinear",this._isPixelRoundingEnabled=!1,this._needRender=!0,this._pauseOnBlur=!1,this._isPausedOnBlur=!1,this._tickCallbacks={normal:(e)=>{this._rafId=-1,this._ruafId=-1,this.Tick(e)},tickOnly:(e)=>{this._ruafId=-1,this.Tick(e,!1,"skip-render")},renderOnly:()=>{this._rafId=-1,this.Render()}},this._rafId=-1,this._ruafId=-1,this._tickCount=0,this._tickCountNoSave=0,this._execCount=0,this._hasStarted=!1,this._isInTick=!1,this._hasStartedTicking=!1,this._isLayoutFirstTick=!0,this._suspendCount=0,this._scheduleTriggersThrottle=new C3.PromiseThrottle(1),this._randomNumberCallback=()=>Math.random(),this._startTime=0,this._lastTickTime=0,this._dt1=0,this._dt=0,this._timeScale=1,this._minimumFramerate=30,this._gameTime=C3.New(C3.KahanSum),this._wallTime=C3.New(C3.KahanSum),this._fpsFrameCount=-1,this._fpsLastTime=0,this._fps=0,this._mainThreadTimeCounter=0,this._mainThreadTime=0,this._isLoadingState=!1,this._saveToSlotName="",this._loadFromSlotName="",this._loadFromJson=null,this._lastSaveJson="",this._triggerOnCreateAfterLoad=[],this._projectStorage=null,this._savegamesStorage=null,this._dispatcher=C3.New(C3.Event.Dispatcher),this._domEventHandlers=new Map,this._pendingResponsePromises=new Map,this._nextDomResponseId=0,this._didRequestDeviceOrientationEvent=!1,this._didRequestDeviceMotionEvent=!1,this._isReadyToHandleEvents=!1,this._waitingToHandleEvents=[],this._eventObjects={"pretick":C3.New(C3.Event,"pretick",!1),"tick":C3.New(C3.Event,"tick",!1),"tick2":C3.New(C3.Event,"tick2",!1),"instancedestroy":C3.New(C3.Event,"instancedestroy",!1),"beforelayoutchange":C3.New(C3.Event,"beforelayoutchange",!1),"layoutchange":C3.New(C3.Event,"layoutchange",!1)},this._eventObjects["instancedestroy"].instance=null,this._userScriptDispatcher=C3.New(C3.Event.Dispatcher),this._userScriptEventObjects=null,this._behInstsToTick=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence),this._behInstsToPostTick=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence),this._behInstsToTick2=C3.New(C3.RedBlackSet,C3.BehaviorInstance.SortByTickSequence),this._jobScheduler=C3.New(C3.JobSchedulerRuntime,this,n["jobScheduler"]),n["canvas"]&&(this._canvasManager=C3.New(C3.CanvasManager,this)),this._messagePort.onmessage=(a)=>this["_OnMessageFromDOM"](a.data),this.AddDOMComponentMessageHandler("runtime","visibilitychange",(a)=>this._OnVisibilityChange(a)),this.AddDOMComponentMessageHandler("runtime","opus-decode",(a)=>this._WasmDecodeWebMOpus(a["arrayBuffer"])),this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo()),this.AddDOMComponentMessageHandler("runtime","js-invoke-function",(a)=>this._InvokeFunctionFromJS(a)),this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self["goToLastErrorScript"]),this._dispatcher.addEventListener("window-blur",(a)=>this._OnWindowBlur(a)),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(e){return C3.New(C3.Runtime,e)}Release(){C3.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._dispatcher=null,this._tickEvent=null}["_OnMessageFromDOM"](e){const a=e["type"];if("event"===a)this._OnEventFromDOM(e);else if("result"===a)this._OnResultFromDOM(e);else throw new Error(`unknown message '${a}'`)}_OnEventFromDOM(a){if(!this._isReadyToHandleEvents)return void this._waitingToHandleEvents.push(a);const e=a["component"],n=a["handler"],t=a["data"],s=a["dispatchOpts"],i=!!(s&&s["dispatchRuntimeEvent"]),r=!!(s&&s["dispatchUserScriptEvent"]),o=a["responseId"];if("runtime"===e){if(i){const e=new C3.Event(n);e.data=t,this._dispatcher.dispatchEventAndWaitAsyncSequential(e)}if(r){const e=new C3.Event(n,!0);for(const[a,n]of Object.entries(t))e[a]=n;this.DispatchUserScriptEvent(e)}}const d=this._domEventHandlers.get(e);if(!d)return void(i||r||console.warn(`[Runtime] No DOM event handlers for component '${e}'`));const _=d.get(n);if(!_)return void(i||r||console.warn(`[Runtime] No DOM handler '${n}' for component '${e}'`));let l=null;try{l=_(t)}catch(a){return console.error(`Exception in '${e}' handler '${n}':`,a),void(null!==o&&this._PostResultToDOM(o,!1,""+a))}null!==o&&(l&&l.then?l.then((e)=>this._PostResultToDOM(o,!0,e)).catch((a)=>{console.error(`Rejection from '${e}' handler '${n}':`,a),this._PostResultToDOM(o,!1,""+a)}):this._PostResultToDOM(o,!0,l))}_PostResultToDOM(e,a,n){this._messagePort.postMessage({"type":"result","responseId":e,"isOk":a,"result":n})}_OnResultFromDOM(e){const a=e["responseId"],n=e["isOk"],t=e["result"],s=this._pendingResponsePromises.get(a);n?s.resolve(t):s.reject(t),this._pendingResponsePromises.delete(a)}AddDOMComponentMessageHandler(e,a,n){let t=this._domEventHandlers.get(e);if(t||(t=new Map,this._domEventHandlers.set(e,t)),t.has(a))throw new Error(`[Runtime] Component '${e}' already has handler '${a}'`);t.set(a,n)}PostComponentMessageToDOM(e,a,n){this._messagePort.postMessage({"type":"event","component":e,"handler":a,"data":n,"responseId":null})}PostComponentMessageToDOMAsync(e,a,n){const t=this._nextDomResponseId++,s=new Promise((e,a)=>{this._pendingResponsePromises.set(t,{resolve:e,reject:a})});return this._messagePort.postMessage({"type":"event","component":e,"handler":a,"data":n,"responseId":t}),s}PostToDebugger(e){if(!this.IsDebug())throw new Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",e)}async Init(e){this.IsDebug()?await C3Debugger.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);const[a]=await Promise.all([this._assetManager.FetchJson(this._dataJsonFilename),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(a),await this._InitialiseCanvas(e),this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");const n=this.GetWebGLRenderer();n?(console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${n.GetWebGLVersionNumber()} [${n.GetUnmaskedRenderer()}] (${n.IsDesynchronized()?"desynchronized":"standard"} compositing)`),n.HasMajorPerformanceCaveat()&&console.warn("[C3 runtime] WebGL indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.")):console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, headless`),this._isReadyToHandleEvents=!0;for(const a of this._waitingToHandleEvents)this._OnEventFromDOM(a);C3.clearArray(this._waitingToHandleEvents),this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const a of e["runOnStartupFunctions"])this._additionalLoadPromises.push(this._RunOnStartupFunction(a));if(await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]),C3.clearArray(this._additionalLoadPromises),!this._assetManager.HasHadErrorLoading())return this._canvasManager&&(await this._canvasManager.EndLoadingScreen()),await this._dispatcher.dispatchEventAndWaitAsync(new C3.Event("beforeruntimestart")),await this.Start(),this._messagePort.postMessage({"type":"runtime-ready"}),this}async _RunOnStartupFunction(e){try{await e(this._iRuntime)}catch(e){console.error("[C3 runtime] Error in runOnStartup function: ",e)}}_LoadDataJson(e){const a=e["project"];this._projectName=a[0],this._projectVersion=a[16],this._projectUniqueId=a[31],this._appId=a[38],this._isPixelRoundingEnabled=!!a[9],this._originalViewportWidth=this._viewportWidth=a[10],this._originalViewportHeight=this._viewportHeight=a[11],this._parallaxXorigin=this._originalViewportWidth/2,this._parallaxYorigin=this._originalViewportHeight/2,this._compositingMode=a[36],this._framerateMode=a[37],"low-latency"===this._compositingMode&&this.IsAndroidWebView()&&77>=C3.Platform.BrowserVersionNumber&&(console.warn("[C3 runtime] Desynchronized (low-latency) compositing is enabled, but is disabled in the Android WebView <=77 due to crbug.com/1008842. Reverting to synchronized (standard) compositing."),this._compositingMode="standard"),this._sampling=a[14],this._usesLoaderLayout=!!a[18],this._loaderStyle=a[19],this._nextUid=a[21],this._pauseOnBlur=a[22],this._assetManager._SetAudioFiles(a[7],a[25]),this._assetManager._SetMediaSubfolder(a[8]),this._assetManager._SetFontsSubfolder(a[32]),this._assetManager._SetIconsSubfolder(a[28]),this._assetManager._SetWebFonts(a[29]),this._canvasManager&&(this._canvasManager.SetFullscreenMode(C3.CanvasManager._FullscreenModeNumberToString(a[12])),this._canvasManager.SetFullscreenScalingQuality(a[23]?"high":"low"),this._canvasManager._SetGPUPowerPreference(a[34])),this._pluginManager.CreateSystemPlugin(),this._objectReferenceTable=self.C3_GetObjectRefTable();for(const n of a[2])this._pluginManager.CreatePlugin(n);this._objectReferenceTable=self.C3_GetObjectRefTable(),this._LoadJsPropNameTable();for(const n of a[3]){const e=C3.ObjectClass.Create(this,this._allObjectClasses.length,n);this._allObjectClasses.push(e),this._objectClassesByName.set(e.GetName().toLowerCase(),e),this._objectClassesBySid.set(e.GetSID(),e)}for(const n of a[4]){const e=this._allObjectClasses[n[0]];e._LoadFamily(n)}for(const n of a[27]){const e=n.map((e)=>this._allObjectClasses[e]);this._allContainers.push(C3.New(C3.Container,this,e))}for(const a of this._allObjectClasses)a._OnAfterCreate();for(const n of a[5])this._layoutManager.Create(n);const n=a[1];if(n){const e=this._layoutManager.GetLayoutByName(n);e&&this._layoutManager.SetFirstLayout(e)}for(const n of a[33])this._timelineManager.Create(n);for(const n of a[35])this._transitionManager.Create(n);this._InitScriptInterfaces();for(const n of a[6])this._eventSheetManager.Create(n);this._eventSheetManager._PostInit(),this._InitGlobalVariableScriptInterface(),C3.clearArray(this._objectReferenceTable),this.FlushPendingInstances();let t="any";const s=a[20];1===s?t="portrait":2===s&&(t="landscape"),this.PostComponentMessageToDOM("runtime","set-target-orientation",{"targetOrientation":t})}GetLoaderStyle(){return this._loaderStyle}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(e){this._additionalLoadPromises.push(e)}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(e){this._allEffectLists.push(e)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(e){this._canvasManager&&(await this._canvasManager.CreateCanvas(e),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus"))return;let e=null,a=null;try{this.IsiOSCordova()?a=await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):e=await this._assetManager.FetchBlob(this._opusWasmBinaryUrl)}catch(e){return void console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",e)}a?this.AddJobWorkerBuffer(a,"opus-decoder-wasm"):this.AddJobWorkerBlob(e,"opus-decoder-wasm"),await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}async _WasmDecodeWebMOpus(e){const a=await this.AddJob("OpusDecode",{"arrayBuffer":e},[e]);return a}async Start(){if(this._hasStarted=!0,this._startTime=Date.now(),this._usesLoaderLayout){for(const e of this._allObjectClasses)e.IsFamily()||e.IsOnLoaderLayout()||!e.IsWorldType()||e.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=!1,this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished(),this.IsDebug()&&C3Debugger.RuntimeInit(a);for(const e of this._layoutManager.GetAllLayouts())e._CreateGlobalNonWorlds();const e=this._layoutManager.GetFirstLayout();await e._Load(null,this.GetWebGLRenderer()),await e._StartRunning(!0),this._fpsLastTime=performance.now(),this._usesLoaderLayout||this._OnLoadFinished();const n=await this.PostComponentMessageToDOMAsync("runtime","before-start-ticking");n["isSuspended"]?this._suspendCount++:this.Tick()}_OnLoadFinished(){this.Trigger(C3.Plugins.System.Cnds.OnLoadFinished,null,null),this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(e){e=Math.floor(e);const a=this._objectReferenceTable;if(0>e||e>=a.length)throw new Error("invalid object reference");return a[e]}_LoadJsPropNameTable(){for(const e of self.C3_JsPropNameTable){const a=C3.first(Object.keys(e));this._jsPropNameTable.push(a)}}GetJsPropName(e){e=Math.floor(e);const a=this._jsPropNameTable;if(0>e||e>=a.length)throw new Error("invalid prop reference");return a[e]}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(e){if(e=Math.floor(e),0>e||e>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[e]}GetObjectClassByName(e){return this._objectClassesByName.get(e.toLowerCase())||null}GetObjectClassBySID(e){return this._objectClassesBySid.get(e)||null}GetSingleGlobalObjectClassByCtor(e){const a=this._pluginManager.GetPluginByConstructorFunction(e);return a?a.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(a){const e=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();e&&C3Debugger.StartMeasuringScriptTime(),this._userScriptDispatcher.dispatchEvent(a),e&&C3Debugger.AddScriptTime()}DispatchUserScriptEventAsyncWait(a){return this._userScriptDispatcher.dispatchEventAndWaitAsync(a)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(e,a){this._originalViewportWidth=e,this._originalViewportHeight=a}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(e,a){this._viewportWidth=e,this._viewportHeight=a}_SetDevicePixelRatio(e){this._devicePixelRatio=e}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(e){return this._canvasManager?this._canvasManager.GetAdditionalRenderTarget(e):null}ReleaseAdditionalRenderTarget(e){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(e)}_SetUsesAnyBackgroundBlending(e){this._usesAnyBackgroundBlending=!!e}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}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetAssetManager(){return this._assetManager}LoadImage(e){return this._assetManager.LoadImage(e)}CreateInstance(e,a,n,t){return this.CreateInstanceFromData(e,a,!1,n,t)}CreateInstanceFromData(e,a,n,t,s,i){let r=null,o=null;if(e instanceof C3.ObjectClass){if(o=e,o.IsFamily()){const e=o.GetFamilyMembers(),a=Math.floor(this.Random()*e.length);o=e[a]}r=o.GetDefaultInstanceData()}else r=e,o=this.GetObjectClassByIndex(r[1]);const d=o.GetPlugin().IsWorldType();if(this._isLoading&&d&&!o.IsOnLoaderLayout())return null;const _=a;d||(a=null);let l=n&&!i&&r&&!this._instancesByUid.has(r[2])?r[2]:this._nextUid++;const g=r?r[0]:null,c=C3.New(C3.Instance,{runtime:this,objectType:o,layer:a,worldData:g,instVarData:r?r[3]:null,uid:l});this._instancesByUid.set(l,c);let u=null;if(d&&(u=c.GetWorldInfo(),"undefined"!=typeof t&&"undefined"!=typeof s&&(u.SetX(t),u.SetY(s)),o._SetAnyCollisionCellChanged(!0)),a&&(a._AddInstance(c,!0),(1!==a.GetParallaxX()||1!==a.GetParallaxY())&&o._SetAnyInstanceParallaxed(!0),a.GetLayout().MaybeLoadTexturesFor(o)),(this._objectCount++,o.IsInContainer()&&!n&&!i)){for(const e of o.GetContainer().objectTypes()){if(e===o)continue;const a=this.CreateInstanceFromData(e,_,!1,u?u.GetX():t,u?u.GetY():s,!0);c._AddSibling(a)}for(const e of c.siblings()){e._AddSibling(c);for(const a of c.siblings())e!==a&&e._AddSibling(a)}}o._SetIIDsStale();const m=r?C3.cloneArray(r[5]):null,p=r?r[4].map((e)=>C3.cloneArray(e)):null;if(c._CreateSdkInstance(m,p),d&&g&&14===g.length){const e=g[13];c._SetHasTilemap(),c.GetSdkInstance().LoadTilemapData(e[2],e[0],e[1])}return this._instancesPendingCreate.push(c),this._hasPendingInstances=!0,this.IsDebug()&&C3Debugger.InstanceCreated(c),c}DestroyInstance(e){if(this._instancesToReleaseAtEndOfTick.has(e))return;const a=e.GetObjectClass();let n=this._instancesPendingDestroy.get(a);if(n){if(n.has(e))return;n.add(e)}else n=new Set,n.add(e),this._instancesPendingDestroy.set(a,n);if(this.IsDebug()&&C3Debugger.InstanceDestroyed(e),e._MarkDestroyed(),this._hasPendingInstances=!0,e.IsInContainer())for(const a of e.siblings())this.DestroyInstance(a);if(this._isFlushingPendingInstances&&C3.NotYetImplemented(),!this._layoutManager.IsEndingLayout()){const a=this.GetEventSheetManager();a.BlockFlushingInstances(!0),e._TriggerOnDestroyed(),a.BlockFlushingInstances(!1)}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._isFlushingPendingInstances=!1,this._hasPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const e of this._instancesPendingCreate){const a=e.GetObjectClass();a._AddInstance(e);for(const n of a.GetFamilies())n._AddInstance(e),n._SetIIDsStale()}C3.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const[e,a]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(e,a),a.clear();this._instancesPendingDestroy.clear(),this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(e,a){C3.arrayRemoveAllInSet(e.GetInstances(),a),e._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(e),0===e.GetInstances().length&&e._SetAnyInstanceParallaxed(!1);for(const n of e.GetFamilies())C3.arrayRemoveAllInSet(n.GetInstances(),a),n._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(n);if(e.GetPlugin().IsWorldType()){const e=new Set([...a].map((e)=>e.GetWorldInfo().GetLayer()));for(const n of e)n._RemoveAllInstancesInSet(a)}for(const n of a){const e=this._eventObjects["instancedestroy"];e.instance=n,this._dispatcher.dispatchEvent(e),this._instancesByUid.delete(n.GetUID());const a=n.GetWorldInfo();a&&(a._RemoveFromCollisionCells(),a._RemoveFromRenderCells()),this._instancesToReleaseAtEndOfTick.add(n),this._objectCount--}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(e,a){this._instancesByUid.set(e,a)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(C3.New(C3.Event,"webglcontextlost")),this.SetSuspended(!0);for(const e of this._allObjectClasses)!e.IsFamily()&&e.HasLoadedTextures()&&e.ReleaseTextures();this.GetMainRunningLayout()._OnWebGLContextLost(),C3.ImageInfo.OnWebGLContextLost(),C3.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,this.GetWebGLRenderer()),this._dispatcher.dispatchEvent(C3.New(C3.Event,"webglcontextrestored")),this.SetSuspended(!1),this.UpdateRender()}_OnVisibilityChange(a){this.SetSuspended(a["hidden"])}_OnWindowBlur(a){this.IsPreview()&&this._pauseOnBlur&&!C3.Platform.IsMobile&&(a.data["parentHasFocus"]||(this.SetSuspended(!0),this._isPausedOnBlur=!0))}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const e=this._tickCallbacks;"vsync"===this._framerateMode?-1===this._rafId&&(this._rafId=self.requestAnimationFrame(e.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=C3.RequestUnlimitedAnimationFrame(e.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(e.renderOnly))):-1===this._ruafId&&(this._ruafId=C3.RequestUnlimitedAnimationFrame(e.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1),-1!==this._ruafId&&(C3.CancelUnlimitedAnimationFrame(this._ruafId),this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(e){const a=this.IsSuspended();this._suspendCount+=e?1:-1,0>this._suspendCount&&(this._suspendCount=0);const n=this.IsSuspended();if(!a&&n)console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(C3.New(C3.Event,"suspend")),this.Trigger(C3.Plugins.System.Cnds.OnSuspend,null,null);else if(a&&!n){console.log("[Construct 3] Resuming");const e=performance.now();this._lastTickTime=e,this._fpsLastTime=e,this._fpsFrameCount=0,this._fps=0,this._mainThreadTime=0,this._mainThreadTimeCounter=0,this._dispatcher.dispatchEvent(C3.New(C3.Event,"resume")),this.Trigger(C3.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(e)}}_AddBehInstToTick(e){this._behInstsToTick.Add(e)}_AddBehInstToPostTick(e){this._behInstsToPostTick.Add(e)}_AddBehInstToTick2(e){this._behInstsToTick2.Add(e)}_RemoveBehInstToTick(e){this._behInstsToTick.Remove(e)}_RemoveBehInstToPostTick(e){this._behInstsToPostTick.Remove(e)}_RemoveBehInstToTick2(e){this._behInstsToTick2.Remove(e)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const e of this._behInstsToTick)e.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const e of this._behInstsToPostTick)e.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const e of this._behInstsToTick2)e.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const e of this._behInstsToTick){const a=e.Tick();C3.IsIterator(a)&&(yield*a)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const e of this._behInstsToPostTick){const a=e.PostTick();C3.IsIterator(a)&&(yield*a)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const e of this._behInstsToTick2){const a=e.Tick2();C3.IsIterator(a)&&(yield*a)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(e,a,n){this._hasStartedTicking=!0;const t="background-wake"===n;if(this._hasStarted&&(!this.IsSuspended()||a||t)){const a=performance.now();this._isInTick=!0,e||(e=a),this._MeasureDt(e);const s=this.Step_BeforePreTick();this.IsDebugging()&&(await s);const i=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects["pretick"]);i instanceof Promise&&(await i);const r=this.Step_AfterPreTick();this.IsDebugging()&&(await r),this._NeedsHandleSaveOrLoad()&&(await this._HandleSaveOrLoad()),this.GetLayoutManager().IsPendingChangeMainLayout()&&(await this._MaybeChangeLayout());const o=this.Step_RunEventsEtc();this.IsDebugging()&&(await o),"background-wake"!==n&&"skip-render"!==n&&this.Render(),this.IsSuspended()||t||this._RequestAnimationFrame(),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-a}}async Step_BeforePreTick(){const e=this._eventSheetManager,a=this.IsDebug();this.FlushPendingInstances(),e.BlockFlushingInstances(!0),this.PushCurrentLayout(this.GetMainRunningLayout()),a&&C3Debugger.StartMeasuringTime(),this.IsDebugging()?await e.DebugRunScheduledWaits():e.RunScheduledWaits(),a&&C3Debugger.AddEventsTime(),this.PopCurrentLayout(),e.BlockFlushingInstances(!1),this.FlushPendingInstances(),e.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const e=this.IsDebug(),a=this.IsDebugging(),n=this._dispatcher,t=this._eventObjects,s=this._userScriptEventObjects;e&&C3Debugger.StartMeasuringTime(),a?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick(),a?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):this._BehaviorPostTick(),e&&C3Debugger.AddBehaviorTickTime(),e&&C3Debugger.StartMeasuringTime(),a?await this.DebugFireGeneratorEventAndBreak(t["tick"]):n.dispatchEvent(t["tick"]),e&&C3Debugger.AddPluginTickTime(),this._eventSheetManager.BlockFlushingInstances(!1),this.DispatchUserScriptEvent(s["tick"])}async Step_RunEventsEtc(){const e=this._eventSheetManager,a=this._dispatcher,n=this._eventObjects,t=this.IsDebug(),s=this.IsDebugging();if(t&&C3Debugger.StartMeasuringTime(),s?await e.DebugRunEvents(this._layoutManager):e.RunEvents(this._layoutManager),t&&C3Debugger.AddEventsTime(),this._collisionEngine.ClearRegisteredCollisions(),0<this._instancesToReleaseAtEndOfTick.size){a.SetDelayRemoveEventsEnabled(!0);for(const e of this._instancesToReleaseAffectedObjectClasses)e.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear(),this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);for(const e of this._instancesToReleaseAtEndOfTick)e.Release();this._instancesToReleaseAtEndOfTick.clear(),a.SetDelayRemoveEventsEnabled(!1)}this._isLayoutFirstTick=!1,e.BlockFlushingInstances(!0),t&&C3Debugger.StartMeasuringTime(),s?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2(),t&&C3Debugger.AddBehaviorTickTime(),t&&C3Debugger.StartMeasuringTime(),s?await this.DebugFireGeneratorEventAndBreak(n["tick2"]):a.dispatchEvent(n["tick2"]),t&&C3Debugger.AddPluginTickTime(),e.BlockFlushingInstances(!1),s&&(await e.RunQueuedDebugTriggersAsync())}async _MaybeChangeLayout(){const e=this.GetLayoutManager();for(let a=0;e.IsPendingChangeMainLayout()&&10>a++;)await this._DoChangeLayout(e.GetPendingChangeMainLayout())}_MeasureDt(e){if(0!==this._lastTickTime){const a=Math.max(e-this._lastTickTime,0);this._dt1=a/1e3;const n=1/this._minimumFramerate;.5<this._dt1?this._dt1=0:this._dt1>n&&(this._dt1=n)}this._lastTickTime=e,this._dt=this._dt1*this._timeScale,this._gameTime.Add(this._dt),this._wallTime.Add(this._dt1),this._canvasManager&&this._canvasManager._UpdateTick(),1e3<=e-this._fpsLastTime&&(this._fpsLastTime+=1e3,1e3<=e-this._fpsLastTime&&(this._fpsLastTime=e),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()&&C3Debugger.Update1sPerfStats()),this._fpsFrameCount++}async _DoChangeLayout(e){const a=this._dispatcher,n=this.GetLayoutManager(),t=n.GetMainRunningLayout();await t._StopRunning(),t._Unload(e,this.GetWebGLRenderer()),t===e&&this._eventSheetManager.ClearAllScheduledWaits(),this._collisionEngine.ClearRegisteredCollisions(),a.dispatchEvent(this._eventObjects["beforelayoutchange"]),C3.Asyncify.SetHighThroughputMode(!0),await e._Load(t,this.GetWebGLRenderer()),C3.Asyncify.SetHighThroughputMode(!1),await e._StartRunning(!1),a.dispatchEvent(this._eventObjects["layoutchange"]),this.UpdateRender(),this._isLayoutFirstTick=!0,this.FlushPendingInstances()}UpdateRender(){this._needRender=!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}Render(){if(!this._canvasManager||this._canvasManager.IsWebGLContextLost())return;const e=this.GetWebGLRenderer();if(e.Start(),e.CheckForQueryResults(),!this._needRender)return void e.IncrementFrameNumber();const a=this.IsDebug();a&&C3Debugger.StartMeasuringTime(),this._needRender=!1;let n=null;e.SupportsGPUProfiling()&&(n=this._canvasManager.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),e.StartQuery(n)),e.SetTextureFillMode(),e.SetAlphaBlend(),e.SetColorRgba(1,1,1,1),e.SetRenderTarget(null),e.SetTexture(null);const t=this._layoutManager.GetMainRunningLayout();t.Draw(e),n&&e.EndQuery(n),e.Finish(),a&&(C3Debugger.AddDrawCallsTime(),C3Debugger.UpdateInspectHighlight()),this._canvasManager&&this._canvasManager._MaybeTakeSnapshot()}Trigger(e,a,n){if(!this._hasStarted)return!1;const t=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let s=0;t&&(s=performance.now());const i=this.IsDebug();i&&this.SetDebuggingEnabled(!1);const r=this._eventSheetManager._Trigger(this._layoutManager,e,a,n);if(t){const e=performance.now()-s;this._mainThreadTimeCounter+=e,i&&C3Debugger.AddTriggersTime(e)}return i&&this.SetDebuggingEnabled(!0),r}DebugTrigger(e,a,n){if(!this.IsDebug())return this.Trigger(e,a,n);if(this.HitBreakpoint())throw new Error("called DebugTrigger() while stopped on breakpoint");if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw new Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,e,a,n)}async TriggerAsync(e,a,n){if(!this.IsDebugging())return this.Trigger(e,a,n);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(e,a,n);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(e,a,n);const t=performance.now(),s=this._eventSheetManager._DebugTrigger(this._layoutManager,e,a,n);let i=s.next();for(;!i.done;)await this.DebugBreak(i.value),i=s.next();return this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame()),this._mainThreadTimeCounter+=performance.now()-t,i.value}FastTrigger(e,a,n){const t=this.IsDebug();t&&this.SetDebuggingEnabled(!1);const s=this._eventSheetManager._FastTrigger(this._layoutManager,e,a,n);return t&&this.SetDebuggingEnabled(!0),s}DebugFastTrigger(e,a,n){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,e,a,n)}ScheduleTriggers(e){return this._scheduleTriggersThrottle.Add(e)}PushCurrentLayout(e){this._currentLayoutStack.push(e)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw new Error("layout stack empty");this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?this._currentLayoutStack[this._currentLayoutStack.length-1]:this.GetMainRunningLayout()}GetDt(e){return e&&-1!==e.GetTimeScale()?this._dt1*e.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(e){(isNaN(e)||0>e)&&(e=0),this._timeScale=e}SetMinimumFramerate(e){this._minimumFramerate=C3.clamp(e,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}IncrementExecCount(){++this._execCount}GetExecCount(){return this._execCount}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(e){if(this._isLoadingState)throw new Error("cannot call while loading state - wait until afterload event");return this._instancesByUid.get(e)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const e of this._allObjectClasses)if(!e.IsFamily())for(const a of e.GetInstances())this._instancesByUid.set(a.GetUID(),a)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===C3.Platform.OS&&("cordova"===this._exportType||"playable-ad"===this._exportType||"instant-games"===this._exportType)}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(a){a=!!a;this._isPixelRoundingEnabled===a||(this._isPixelRoundingEnabled=a,this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(e){this._saveToSlotName=e}LoadFromSlot(e){this._loadFromSlotName=e}LoadFromJsonString(e){this._loadFromJson=e}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!!(this._saveToSlotName||this._loadFromSlotName||null!==this._loadFromJson)}async _HandleSaveOrLoad(){if(this._saveToSlotName&&(this.FlushPendingInstances(),await this._DoSaveToSlot(this._saveToSlotName),this._ClearSaveOrLoad()),this._loadFromSlotName&&(await this._DoLoadFromSlot(this._loadFromSlotName),this._ClearSaveOrLoad(),this.IsDebug()&&C3Debugger.StepIfPausedInDebugger()),null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(e){console.error("[Construct 3] Failed to load state from JSON string: ",e),await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._saveToSlotName="",this._loadFromSlotName="",this._loadFromJson=null}_GetProjectStorage(){return this._projectStorage||(this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()})),this._projectStorage}_GetSavegamesStorage(){return this._savegamesStorage||(this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+this.GetProjectUniqueId(),description:this.GetProjectName()})),this._savegamesStorage}async _DoSaveToSlot(e){const a=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(e,a),console.log("[Construct 3] Saved state to storage ("+a.length+" chars)"),this._lastSaveJson=a,await this.TriggerAsync(C3.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(e){console.error("[Construct 3] Failed to save state to storage: ",e),await this.TriggerAsync(C3.Plugins.System.Cnds.OnSaveFailed,null)}}async _DoLoadFromSlot(e){try{const a=await this._GetSavegamesStorage().getItem(e);if(!a)throw new Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+a.length+" chars)"),await this._DoLoadFromJsonString(a),this._lastSaveJson=a,await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(e){console.error("[Construct 3] Failed to load state from storage: ",e),await this.TriggerAsync(C3.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const e={"c3save":!0,"version":1,"rt":{"time":this.GetGameTime(),"walltime":this.GetWallTime(),"timescale":this.GetTimeScale(),"tickcount":this.GetTickCount(),"execcount":this.GetExecCount(),"next_uid":this._nextUid,"running_layout":this.GetMainRunningLayout().GetSID(),"start_time_offset":Date.now()-this._startTime},"types":{},"layouts":{},"events":this._eventSheetManager._SaveToJson(),"timelines":this._timelineManager._SaveToJson(),"user_script_data":null};for(const a of this._allObjectClasses)a.IsFamily()||a.HasNoSaveBehavior()||(e["types"][a.GetSID().toString()]=a._SaveToJson());for(const a of this._layoutManager.GetAllLayouts())e["layouts"][a.GetSID().toString()]=a._SaveToJson();const a=this._CreateUserScriptEvent("save");return a.saveData=null,await this.DispatchUserScriptEventAsyncWait(a),e["user_script_data"]=a.saveData,JSON.stringify(e)}IsLoadingState(){return this._isLoadingState}_TriggerOnCreateAfterLoad(e){C3.shallowAssignArray(this._triggerOnCreateAfterLoad,e)}async _DoLoadFromJsonString(e){const a=JSON.parse(e);if(a["c2save"])throw new Error("C2 saves are incompatible with C3 runtime");if(!a["c3save"])throw new Error("not valid C3 save data");if(1<a["version"])throw new Error("C3 save data from future version");this._isLoadingState=!0;const n=a["rt"];this._gameTime.Set(n["time"]),this._wallTime.Set(n["walltime"]),this._timeScale=n["timescale"],this._tickCount=n["tickcount"],this._execCount=n["execcount"],this._startTime=Date.now()-n["start_time_offset"];const t=n["running_layout"];if(t!==this.GetMainRunningLayout().GetSID()){const e=this._layoutManager.GetLayoutBySID(t);if(e)await this._DoChangeLayout(e);else return}for(const[n,t]of Object.entries(a["types"])){const e=parseInt(n,10),a=this.GetObjectClassBySID(e);!a||a.IsFamily()||a.HasNoSaveBehavior()||a._LoadFromJson(t)}this.FlushPendingInstances(),this._RefreshUidMap(),this._isLoadingState=!1,this._nextUid=n["next_uid"];for(const[n,t]of Object.entries(a["layouts"])){const e=parseInt(n,10),a=this._layoutManager.GetLayoutBySID(e);a&&a._LoadFromJson(t)}this._eventSheetManager._LoadFromJson(a["events"]);for(const a of this._triggerOnCreateAfterLoad)a._TriggerOnCreated();C3.clearArray(this._triggerOnCreateAfterLoad);for(const a of this._allObjectClasses)if(!a.IsFamily()&&a.IsInContainer())for(const e of a.GetInstances()){const n=e.GetIID();for(const t of a.GetContainer().objectTypes()){if(t===a)continue;const s=t.GetInstances();if(0>n||n>=s.length)throw new Error("missing sibling instance");e._AddSibling(s[n])}}this._timelineManager._LoadFromJson(a["timelines"]),this._dispatcher.dispatchEvent(C3.New(C3.Event,"afterload"));const s=this._CreateUserScriptEvent("load");s.saveData=a["user_script_data"],await this.DispatchUserScriptEventAsyncWait(s),this.UpdateRender()}async AddJobWorkerScripts(e){const a=await Promise.all(e.map((e)=>this._assetManager.FetchBlob(e))),n=a.map((e)=>URL.createObjectURL(e));this._jobScheduler.ImportScriptsToJobWorkers(n)}AddJobWorkerBlob(e,a){this._jobScheduler.SendBlobToJobWorkers(e,a)}AddJobWorkerBuffer(e,a){this._jobScheduler.SendBufferToJobWorkers(e,a)}AddJob(e,a,n){return this._jobScheduler.AddJob(e,a,n)}BroadcastJob(e,a,n){return this._jobScheduler.BroadcastJob(e,a,n)}InvokeDownload(e,a){this.PostComponentMessageToDOM("runtime","invoke-download",{"url":e,"filename":a})}async RasterSvgImage(e,a,n,t,s,i){if(t=t||a,s=s||n,this.IsInWorker()){const r=await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{"blob":e,"imageWidth":a,"imageHeight":n,"surfaceWidth":t,"surfaceHeight":s,"imageBitmapOpts":i});return r["imageBitmap"]}else{const r=await self["C3_RasterSvgImageBlob"](e,a,n,t,s);return i?await self.createImageBitmap(r,i):r}}async GetSvgImageSize(e){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime","get-svg-image-size",{"blob":e}):await self["C3_GetSvgImageSize"](e)}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(e){this._randomNumberCallback=e}_GetRemotePreviewStatusInfo(){return{"fps":this.GetFPS(),"cpu":this.GetMainThreadTime(),"gpu":this.GetGPUUtilisation(),"layout":this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"","renderer":this.GetWebGLRenderer().GetUnmaskedRenderer()}}HitBreakpoint(){return!!this.IsDebug()&&C3Debugger.HitBreakpoint()}DebugBreak(e){return this.IsDebugging()?C3Debugger.DebugBreak(e):Promise.resolve()}DebugBreakNext(){return!!this.IsDebugging()&&C3Debugger.BreakNext()}SetDebugBreakpointsEnabled(a){this._breakpointsEnabled=!!a,this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(e){e?this._debuggingDisabled--:this._debuggingDisabled++,this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&C3Debugger.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetWebGLRenderer().SupportsGPUProfiling()&&C3Debugger.IsGPUProfiling()}async DebugIterateAndBreak(e){if(e)for(const a of e)await this.DebugBreak(a)}DebugFireGeneratorEventAndBreak(e){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(e))}_InvokeFunctionFromJS(a){return this._eventSheetManager._InvokeFunctionFromJS(a["name"],a["params"])}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(a){const n=C3.New(C3.Event,a,!1);return n.runtime=this._iRuntime,n}_InitScriptInterfaces(){const e={};for(const a of this._allObjectClasses)e[a.GetJsPropName()]={value:a.GetIObjectClass(),enumerable:!0,writable:!1};const a=Object.create(Object.prototype,e);this._iRuntime=new IRuntime(this,a),this._userScriptEventObjects={"tick":this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const e={};for(const a of this.GetEventSheetManager().GetAllGlobalVariables())e[a.GetJsPropName()]=a._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(e)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(e,a){this._interfaceMap.set(e,a)}_UnwrapScriptInterface(e){return this._interfaceMap.get(e)}},self["C3_CreateRuntime"]=C3.Runtime.Create,self["C3_InitRuntime"]=(e,a)=>e.Init(a)}
// c3/workers/jobSchedulerRuntime.js
"use strict";C3.JobSchedulerRuntime=class extends C3.DefendedBase{constructor(a,b){super(),this._runtime=a,this._jobPromises=new Map,this._nextJobId=0,this._inputPort=b["inputPort"],b["outputPort"].onmessage=(a)=>this._OnJobWorkerMessage(a),this._maxNumWorkers=b["maxNumWorkers"],this._jobWorkerCount=1,this._isCreatingWorker=!1,this._hadErrorCreatingWorker=!1,this._isBroken=!1,this._testOkResolve=null}async Init(){await this._TestMessageChannelWorks()}ImportScriptsToJobWorkers(a){this._isBroken||this._inputPort.postMessage({"type":"_import_scripts","scripts":a})}SendBlobToJobWorkers(a,b){this._isBroken||this._inputPort.postMessage({"type":"_send_blob","blob":a,"id":b})}SendBufferToJobWorkers(a,b){this._isBroken||this._inputPort.postMessage({"type":"_send_buffer","buffer":a,"id":b},[a])}AddJob(a,b,c,d,e){if(this._isBroken)return Promise.reject("messagechannels broken");c||(c=[]);const f=this._nextJobId++,g={"type":a,"isBroadcast":!1,"jobId":f,"params":b,"transferables":c},h=new Promise((a,b)=>{this._jobPromises.set(f,{resolve:a,progress:d,reject:b,cancelled:!1})});return e&&e.SetAction(()=>this._CancelJob(f)),this._inputPort.postMessage(g,c),this._MaybeCreateExtraWorker(),h}BroadcastJob(a,b,c){if(!this._isBroken){c||(c=[]);const d=this._nextJobId++,e={"type":a,"isBroadcast":!0,"jobId":d,"params":b,"transferables":c};this._inputPort.postMessage(e,c)}}_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){const b=a.data,c=b["type"],d=b["jobId"];switch(c){case"result":this._OnJobResult(d,b["result"]);break;case"progress":this._OnJobProgress(d,b["progress"]);break;case"error":this._OnJobError(d,b["error"]);break;case"ready":this._OnJobWorkerReady();break;case"_testMessageChannelOk":this._OnTestMessageChannelOk();break;default:throw new Error(`unknown message from worker '${c}'`);}}_OnJobResult(a,b){const c=this._jobPromises.get(a);if(!c)throw new Error("invalid job ID");c.cancelled||c.resolve(b),this._jobPromises.delete(a)}_OnJobProgress(a,b){const c=this._jobPromises.get(a);if(!c)throw new Error("invalid job ID");!c.cancelled&&c.progress&&c.progress(b)}_OnJobError(a,b){const c=this._jobPromises.get(a);if(!c)throw new Error("invalid job ID");c.cancelled||c.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;const a=await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker");a["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)}}_TestMessageChannelWorks(){return this._inputPort.postMessage({"type":"_testMessageChannel"}),self.setTimeout(()=>this._CheckMessageChannelTestTimedOut(),2e3),new Promise((a)=>this._testOkResolve=a)}_OnTestMessageChannelOk(){this._testOkResolve(),this._testOkResolve=null}_CheckMessageChannelTestTimedOut(){this._testOkResolve&&(console.warn("MessageChannel determined to be broken. Job scheduler disabled."),this._isBroken=!0,this._testOkResolve(),this._testOkResolve=null)}};
self["C3_Shaders"] = {};
self["C3_Shaders"]["subtract"] = {
src: "varying mediump vec2 vTex;\nuniform lowp sampler2D samplerFront;\nuniform mediump vec2 srcStart;\nuniform mediump vec2 srcEnd;\nuniform lowp sampler2D samplerBack;\nuniform mediump vec2 destStart;\nuniform mediump vec2 destEnd;\nvoid main(void)\n{\nlowp vec4 front = texture2D(samplerFront, vTex);\nfront.rgb /= front.a;\nmediump vec2 tex = (vTex - srcStart) / (srcEnd - srcStart);\nlowp vec4 back = texture2D(samplerBack, mix(destStart, destEnd, tex));\nback.rgb /= back.a;\nfront.rgb = max(back.rgb - front.rgb, vec3(0.0, 0.0, 0.0));\nfront.rgb *= front.a;\ngl_FragColor = front * back.a;\n}",
extendBoxHorizontal: 0,
extendBoxVertical: 0,
crossSampling: false,
mustPreDraw: false,
preservesOpaqueness: false,
animated: false,
parameters: []
};
"use strict";{function a(c,a){const b=c[1],d=a[1];if("number"==typeof b&&"number"==typeof d)return b-d;else{const a=""+b,c=""+d;return a<c?-1:a>c?1:0}}let b=null,c="",d="",e=[],f="",g="",h="";const i=C3.New(C3.ArrayStack);C3.Plugins.System=class extends C3.SDKPluginBase{constructor(a){super(a),this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack(),this._eventStack=this._runtime.GetEventSheetManager().GetEventStack(),this._imagesLoadingTotal=0,this._imagesLoadingComplete=0,this._functionMaps=new Map}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(a){this._runtime.Trigger(a,null,null)}GetRegex(a,e){return b&&a===c&&e===d||(b=new RegExp(a,e),c=a,d=e),b.lastIndex=0,b}GetRegexMatches(a,b,c){if(a===f&&b===g&&c===h)return e;const d=this.GetRegex(b,c);return e=a.match(d),f=a,g=b,h=c,e}async _LoadTexturesForObjectClasses(a,b){if(b.length){this._imagesLoadingTotal+=b.length;const c=[];for(const d of b)c.push(a.MaybeLoadTexturesFor(d));await C3.PromiseAllWithProgress(c,()=>{this._imagesLoadingComplete++}),this._imagesLoadingComplete++,this._imagesLoadingComplete===this._imagesLoadingTotal&&(this._runtime.Trigger(C3.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingComplete=0,this._imagesLoadingTotal=0)}}_UnloadTexturesForObjectClasses(a,b){for(const c of b)0===c.GetInstanceCount()&&a.MaybeUnloadTexturesFor(c)}_GetForEachStack(){return i}_Repeat(a){const b=this._runtime.GetEventSheetManager(),c=b.GetEventStack(),d=c.GetCurrentStackFrame(),e=d.GetCurrentEvent(),f=e.GetSolModifiers(),g=d.IsSolModifierAfterCnds(),h=c.Push(e),i=b.GetLoopStack(),j=i.Push();if(j.SetEnd(a),g)for(let c=0;c<a&&!j.IsStopped();++c)b.PushCopySol(f),j.SetIndex(c),e.Retrigger(d,h),b.PopSol(f);else for(let b=0;b<a&&!j.IsStopped();++b)j.SetIndex(b),e.Retrigger(d,h);return c.Pop(),i.Pop(),!1}*_DebugRepeat(a){const b=this._runtime.GetEventSheetManager(),c=b.GetEventStack(),d=c.GetCurrentStackFrame(),e=d.GetCurrentEvent(),f=e.GetSolModifiers(),g=d.IsSolModifierAfterCnds(),h=c.Push(e),i=b.GetLoopStack(),j=i.Push();if(j.SetEnd(a),g)for(let c=0;c<a&&!j.IsStopped();++c)b.PushCopySol(f),j.SetIndex(c),yield*e.DebugRetrigger(d,h),b.PopSol(f);else for(let b=0;b<a&&!j.IsStopped();++b)j.SetIndex(b),yield*e.DebugRetrigger(d,h);return c.Pop(),i.Pop(),!1}_While(){const a=this._runtime.GetEventSheetManager(),b=a.GetEventStack(),c=b.GetCurrentStackFrame(),d=c.GetCurrentEvent(),e=d.GetSolModifiers(),f=c.IsSolModifierAfterCnds(),g=b.Push(d),h=a.GetLoopStack(),j=h.Push();if(f)for(let b=0;!j.IsStopped();++b)a.PushCopySol(e),j.SetIndex(b),d.Retrigger(c,g)||j.Stop(),a.PopSol(e);else for(let a=0;!j.IsStopped();++a)j.SetIndex(a),d.Retrigger(c,g)||j.Stop();return b.Pop(),h.Pop(),!1}*_DebugWhile(){const a=this._runtime.GetEventSheetManager(),b=a.GetEventStack(),c=b.GetCurrentStackFrame(),d=c.GetCurrentEvent(),e=d.GetSolModifiers(),f=c.IsSolModifierAfterCnds(),g=b.Push(d),h=a.GetLoopStack(),j=h.Push();if(f)for(let b=0;!j.IsStopped();++b){a.PushCopySol(e),j.SetIndex(b);const f=yield*d.DebugRetrigger(c,g);f||j.Stop(),a.PopSol(e)}else for(let a=0;!j.IsStopped();++a){j.SetIndex(a);const b=yield*d.DebugRetrigger(c,g);b||j.Stop()}return b.Pop(),h.Pop(),!1}_For(a,b,c){const d=this._runtime.GetEventSheetManager(),e=d.GetEventStack(),f=e.GetCurrentStackFrame(),g=f.GetCurrentEvent(),h=g.GetSolModifiers(),i=f.IsSolModifierAfterCnds(),j=e.Push(g),k=d.GetLoopStack(),l=k.Push();if(l.SetName(a),l.SetEnd(c),c<b){if(i)for(let a=b;a>=c&&!l.IsStopped();--a)d.PushCopySol(h),l.SetIndex(a),g.Retrigger(f,j),d.PopSol(h);else for(let a=b;a>=c&&!l.IsStopped();--a)l.SetIndex(a),g.Retrigger(f,j);}else if(i)for(let a=b;a<=c&&!l.IsStopped();++a)d.PushCopySol(h),l.SetIndex(a),g.Retrigger(f,j),d.PopSol(h);else for(let a=b;a<=c&&!l.IsStopped();++a)l.SetIndex(a),g.Retrigger(f,j);return e.Pop(),k.Pop(),!1}*_DebugFor(a,b,c){const d=this._runtime.GetEventSheetManager(),e=d.GetEventStack(),f=e.GetCurrentStackFrame(),g=f.GetCurrentEvent(),h=g.GetSolModifiers(),i=f.IsSolModifierAfterCnds(),j=e.Push(g),k=d.GetLoopStack(),l=k.Push();if(l.SetName(a),l.SetEnd(c),c<b){if(i)for(let a=b;a>=c&&!l.IsStopped();--a)d.PushCopySol(h),l.SetIndex(a),yield*g.DebugRetrigger(f,j),d.PopSol(h);else for(let a=b;a>=c&&!l.IsStopped();--a)l.SetIndex(a),yield*g.DebugRetrigger(f,j);}else if(i)for(let a=b;a<=c&&!l.IsStopped();++a)d.PushCopySol(h),l.SetIndex(a),yield*g.DebugRetrigger(f,j),d.PopSol(h);else for(let a=b;a<=c&&!l.IsStopped();++a)l.SetIndex(a),yield*g.DebugRetrigger(f,j);return e.Pop(),k.Pop(),!1}_ForEach(a){const b=this._runtime.GetEventSheetManager(),c=b.GetEventStack(),d=c.GetCurrentStackFrame(),e=d.GetCurrentEvent(),f=e.GetSolModifiers(),g=d.IsSolModifierAfterCnds(),h=c.Push(e),j=b.GetLoopStack(),k=j.Push(),l=a.IsInContainer(),m=a.GetCurrentSol(),n=i.Push();if(C3.shallowAssignArray(n,m.GetInstances()),k.SetEnd(n.length),g)for(let c=0,g=n.length;c<g&&!k.IsStopped();++c){b.PushCopySol(f);const g=n[c];a.GetCurrentSol().SetSinglePicked(g),l&&g.SetSiblingsSinglePicked(),k.SetIndex(c),e.Retrigger(d,h),b.PopSol(f)}else{m._SetSelectAll(!1);const a=m._GetOwnInstances();C3.clearArray(a),a.push(null);for(let b=0,c=n.length;b<c&&!k.IsStopped();++b){const c=n[b];a[0]=c,l&&c.SetSiblingsSinglePicked(),k.SetIndex(b),e.Retrigger(d,h)}}return c.Pop(),j.Pop(),C3.clearArray(n),i.Pop(),!1}*_DebugForEach(a){const b=this._runtime.GetEventSheetManager(),c=b.GetEventStack(),d=c.GetCurrentStackFrame(),e=d.GetCurrentEvent(),f=e.GetSolModifiers(),g=d.IsSolModifierAfterCnds(),h=c.Push(e),j=b.GetLoopStack(),k=j.Push(),l=a.IsInContainer(),m=a.GetCurrentSol(),n=i.Push();if(C3.shallowAssignArray(n,m.GetInstances()),k.SetEnd(n.length),g)for(let c=0,g=n.length;c<g&&!k.IsStopped();++c){b.PushCopySol(f);const g=n[c];a.GetCurrentSol().SetSinglePicked(g),l&&g.SetSiblingsSinglePicked(),k.SetIndex(c),yield*e.DebugRetrigger(d,h),b.PopSol(f)}else{m._SetSelectAll(!1);const a=m._GetOwnInstances();C3.clearArray(a),a.push(null);for(let b=0,c=n.length;b<c&&!k.IsStopped();++b){const c=n[b];a[0]=c,l&&c.SetSiblingsSinglePicked(),k.SetIndex(b),yield*e.DebugRetrigger(d,h)}}return c.Pop(),j.Pop(),C3.clearArray(n),i.Pop(),!1}_ForEachOrdered(b,c){const d=this._runtime.GetEventSheetManager(),e=d.GetEventStack(),f=d.GetCurrentCondition(),g=e.GetCurrentStackFrame(),h=g.GetCurrentEvent(),j=h.GetSolModifiers(),k=g.IsSolModifierAfterCnds(),l=e.Push(h),m=d.GetLoopStack(),n=m.Push(),o=b.IsInContainer(),p=b.GetCurrentSol(),q=i.Push();C3.clearArray(q);const r=p.GetInstances();n.SetEnd(r.length);for(let a=0,d=r.length;a<d;++a)q.push([r[a],f.ReevaluateParameter(1,a)]);if(q.sort(a),1===c&&q.reverse(),k)for(let a=0,c=q.length;a<c&&!n.IsStopped();++a){d.PushCopySol(j);const c=q[a][0];b.GetCurrentSol().SetSinglePicked(c),o&&c.SetSiblingsSinglePicked(),n.SetIndex(a),h.Retrigger(g,l),d.PopSol(j)}else{p._SetSelectAll(!1);const a=p._GetOwnInstances();C3.clearArray(a),a.push(null);for(let b=0,c=q.length;b<c&&!n.IsStopped();++b){const c=q[b][0];a[0]=c,o&&c.SetSiblingsSinglePicked(),n.SetIndex(b),h.Retrigger(g,l)}}return e.Pop(),m.Pop(),C3.clearArray(q),i.Pop(),!1}*_DebugForEachOrdered(b,c){const d=this._runtime.GetEventSheetManager(),e=d.GetEventStack(),f=d.GetCurrentCondition(),g=e.GetCurrentStackFrame(),h=g.GetCurrentEvent(),j=h.GetSolModifiers(),k=g.IsSolModifierAfterCnds(),l=e.Push(h),m=d.GetLoopStack(),n=m.Push(),o=b.IsInContainer(),p=b.GetCurrentSol(),q=i.Push();C3.clearArray(q);const r=p.GetInstances();n.SetEnd(r.length);for(let a=0,d=r.length;a<d;++a)q.push([r[a],f.ReevaluateParameter(1,a)]);if(q.sort(a),1===c&&q.reverse(),k)for(let a=0,c=q.length;a<c&&!n.IsStopped();++a){d.PushCopySol(j);const c=q[a][0];b.GetCurrentSol().SetSinglePicked(c),o&&c.SetSiblingsSinglePicked(),n.SetIndex(a),yield*h.DebugRetrigger(g,l),d.PopSol(j)}else{p._SetSelectAll(!1);const a=p._GetOwnInstances();C3.clearArray(a),a.push(null);for(let b=0,c=q.length;b<c&&!n.IsStopped();++b){const c=q[b][0];a[0]=c,o&&c.SetSiblingsSinglePicked(),n.SetIndex(b),yield*h.DebugRetrigger(g,l)}}return e.Pop(),m.Pop(),C3.clearArray(q),i.Pop(),!1}_GetFunctionMap(a,b){let c=this._functionMaps.get(a);return c?c:b?(c={defaultFunc:null,strMap:new Map},this._functionMaps.set(a,c),c):null}_DoCallMappedFunction(a,b,c,d,e){b.GetEventBlock().RunAsMappedFunctionCall(c),d&&a.PopSol(e)}*_DebugDoCallMappedFunction(a,b,c,d,e){yield*b.GetEventBlock().DebugRunAsMappedFunctionCall(c),d&&a.PopSol(e)}}}
"use strict";C3.Plugins.System.Type=class extends C3.DefendedBase{constructor(a){super(),this._objectClass=a,this._runtime=a.GetRuntime(),this._plugin=a.GetPlugin()}OnCreate(){}Release(){this._objectClass=null,this._runtime=null,this._plugin=null}};
"use strict";C3.Plugins.System.Instance=class extends C3.DefendedBase{constructor(a){super(),this._inst=a,this._objectClass=this._inst.GetObjectClass(),this._sdkType=this._objectClass.GetSdkType(),this._runtime=this._inst.GetRuntime()}Release(){this._inst=null,this._objectClass=null,this._sdkType=null,this._runtime=null}};
"use strict";{const a=[];C3.Plugins.System.Cnds={EveryTick(){return!0},OnLayoutStart(){return!0},OnLayoutEnd(){return!0},OnSuspend(){return!0},OnResume(){return!0},IsSuspended(){return this._runtime.IsSuspended()},Else(){const a=this._runtime.GetCurrentEventStackFrame();return!a.GetElseBranchRan()&&!a.GetLastEventTrue()},TriggerOnce(){const a=this._runtime.GetCurrentCondition(),b=a.GetSavedDataMap();let c=b.get("TriggerOnce_lastTick");"undefined"==typeof c&&(c=-1,b.set("TriggerOnce_lastTick",-1));const d=this._runtime.GetTickCount();return b.set("TriggerOnce_lastTick",d),this._runtime.IsLayoutFirstTick()||c!==d-1},Every(a){const b=this._runtime.GetCurrentCondition(),c=b.GetSavedDataMap(),d=c.get("Every_lastTime")||0,e=this._runtime.GetGameTime();c.has("Every_seconds")||c.set("Every_seconds",a);const f=c.get("Every_seconds");return e>=d+f?(c.set("Every_lastTime",d+f),e>=c.get("Every_lastTime")+.04&&c.set("Every_lastTime",e),c.set("Every_seconds",a),!0):(e<d-.1&&c.set("Every_lastTime",e),!1)},IsGroupActive(a){const b=this._runtime.GetEventSheetManager().GetEventGroupByName(a);return b&&b.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return C3.Platform.IsMobile},OnLoadFinished(){return!0},OnCanvasSnapshot(){return!0},EffectsSupported(){return!0},OnSaveComplete(){return!0},OnSaveFailed(){return!0},OnLoadComplete(){return!0},OnLoadFailed(){return!0},ObjectUIDExists(a){return!!this._runtime.GetInstanceByUID(a)},IsOnPlatform(a){return 0===a?"browser"===C3.Platform.Context:1===a?"iOS"===C3.Platform.OS:2===a?"Android"===C3.Platform.OS:8===a?"cordova"===C3.Platform.Context:9===a?"scirra-arcade"===this._runtime.GetExportType():10===a?"nwjs"===C3.Platform.Context:!(13!=a)&&"windows-uwp"===this._runtime.GetExportType()},RegexTest(a,b,c){const d=this.GetRegex(b,c);return d.test(a)},Compare(a,b,c){return C3.compare(a,b,c)},CompareBetween(c,d,a){return c>=d&&c<=a},CompareVar(a,b,c){return C3.compare(a.GetValue(),b,c)},CompareBoolVar(a){return!!a.GetValue()},CompareTime(a,b){const c=this._runtime.GetGameTime();if(0===a){const a=this._runtime.GetCurrentCondition(),d=a.GetSavedDataMap();return!(d.get("CompareTime_executed")||!(c>=b))&&(d.set("CompareTime_executed",!0),!0)}return C3.compare(c,a,b)},IsNaN(a){return isNaN(a)},AngleWithin(a,b,c){return C3.angleDiff(C3.toRadians(a),C3.toRadians(c))<=C3.toRadians(b)},IsClockwiseFrom(a,b){return C3.angleClockwise(C3.toRadians(a),C3.toRadians(b))},IsBetweenAngles(b,a,c){let d=C3.toRadians(b),e=C3.toRadians(a),f=C3.toRadians(c),g=!C3.angleClockwise(f,e);return g?C3.angleClockwise(d,e)||!C3.angleClockwise(d,f):C3.angleClockwise(d,e)&&!C3.angleClockwise(d,f)},IsValueType(a,b){return"number"==typeof a?0===b:1===b},PickByComparison(a,b,c,d){if(!a)return!1;const e=this._GetForEachStack(),f=e.Push(),g=a.GetCurrentSol();C3.shallowAssignArray(f,g.GetInstances()),g.IsSelectAll()&&C3.clearArray(g._GetOwnElseInstances());const h=this._runtime.GetCurrentCondition();let j=0;for(let e=0,i=f.length;e<i;++e){const a=f[e];f[j]=a,b=h.ReevaluateParameter(1,e),d=h.ReevaluateParameter(3,e),C3.compare(b,c,d)?++j:g._PushElseInstance(a)}C3.truncateArray(f,j),g.SetArrayPicked(f);const i=!!f.length;return C3.clearArray(f),e.Pop(),a.ApplySolToContainer(),i},PickByEvaluate(a,b){if(!a)return!1;const c=this._GetForEachStack(),d=c.Push(),e=a.GetCurrentSol();C3.shallowAssignArray(d,e.GetInstances()),e.IsSelectAll()&&C3.clearArray(e._GetOwnElseInstances());const f=this._runtime.GetCurrentCondition();let g=0;for(let c=0,h=d.length;c<h;++c){const a=d[c];d[g]=a,b=f.ReevaluateParameter(1,c),b?++g:e._PushElseInstance(a)}C3.truncateArray(d,g),e.SetArrayPicked(d);const h=!!d.length;return C3.clearArray(d),c.Pop(),a.ApplySolToContainer(),h},PickNth(a,b){if(!a)return!1;const c=a.GetCurrentSol(),d=c.GetInstances();if(b=Math.floor(b),b>=d.length)return!1;const e=d[b];return c.PickOne(e),a.ApplySolToContainer(),!0},PickRandom(a){if(!a)return!1;const b=a.GetCurrentSol(),c=b.GetInstances(),d=Math.floor(this._runtime.Random()*c.length);if(d>=c.length)return!1;const e=c[d];return b.PickOne(e),a.ApplySolToContainer(),!0},PickAll(a){if(!a)return!1;if(!a.GetInstanceCount())return!1;const b=a.GetCurrentSol();return b._SetSelectAll(!0),a.ApplySolToContainer(),!0},PickOverlappingPoint(b,c,d){if(!b)return!1;const e=b.GetCurrentSol(),f=e.GetInstances(),g=this._runtime.GetCurrentEvent(),h=g.IsOrBlock(),j=this._runtime.GetCurrentCondition().IsInverted();e.IsSelectAll()?(C3.shallowAssignArray(a,f),e.ClearArrays(),e._SetSelectAll(!1)):h?(C3.shallowAssignArray(a,e._GetOwnElseInstances()),C3.clearArray(e._GetOwnElseInstances())):(C3.shallowAssignArray(a,e._GetOwnInstances()),C3.clearArray(e._GetOwnInstances()));for(let f=0,g=a.length;f<g;++f){const b=a[f];C3.xor(b.GetWorldInfo().ContainsPoint(c,d),j)?e._PushInstance(b):e._PushElseInstance(b)}return b.ApplySolToContainer(),C3.xor(!!e._GetOwnInstances().length,j)},PickLastCreated(a){if(!a)return!1;const b=a.IsFamily();let c=null;const d=this._runtime._GetInstancesPendingCreate();for(let e=d.length-1;0<=e;--e){const f=d[e];if(b){if(f.GetObjectClass().BelongsToFamily(a)){c=f;break}}else if(f.GetObjectClass()===a){c=f;break}}if(!c){const b=a.GetInstances();b.length&&(c=b[b.length-1])}if(!c)return!1;const e=a.GetCurrentSol();return e.PickOne(c),a.ApplySolToContainer(),!0},Repeat(a){return this._runtime.IsDebugging()?this._DebugRepeat(a):this._Repeat(a)},While(){return this._runtime.IsDebugging()?this._DebugWhile():this._While()},For(a,b,c){return this._runtime.IsDebugging()?this._DebugFor(a,b,c):this._For(a,b,c)},ForEach(a){return this._runtime.IsDebugging()?this._DebugForEach(a):this._ForEach(a)},ForEachOrdered(a,b,c){return this._runtime.IsDebugging()?this._DebugForEachOrdered(a,c):this._ForEachOrdered(a,c)},LayerVisible(a){return!!a&&a.IsVisible()},LayerEmpty(a){return!!a&&!a.GetInstanceCount()},LayerCmpOpacity(a,b,c){return!!a&&C3.compare(100*a.GetOpacity(),b,c)},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}}
"use strict";{function a(c,a){const b=c[0],d=a[0],e=b-d;if(0!=e)return e;const f=c[1],g=a[1];return f-g}function b(c,a){return c[1]-a[1]}const c=[],d=[],e=C3.New(C3.Color);C3.Plugins.System.Acts={SetVar(a,b){a.SetValue(b)},AddVar(a,b){a.IsNumber()&&"number"!=typeof b&&(b=parseFloat(b)),a.SetValue(a.GetValue()+b)},SubVar(a,b){a.IsNumber()&&a.SetValue(a.GetValue()-b)},SetBoolVar(a,b){a.SetValue(!!b)},ToggleBoolVar(a){a.SetValue(!a.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},CreateObject(a,b,c,d){if(a&&b){const e=this._runtime.CreateInstance(a,b,c,d);if(e){const b=this._runtime.GetEventSheetManager();if(b.BlockFlushingInstances(!0),e._TriggerOnCreated(),e.IsInContainer())for(const a of e.siblings())a._TriggerOnCreated();b.BlockFlushingInstances(!1),a.GetCurrentSol().SetSinglePicked(e),e.IsInContainer()&&e.SetSiblingsSinglePicked()}}},CreateObjectByName(a,b,c,d){if(a&&b){const e=this._runtime.GetObjectClassByName(a);e&&C3.Plugins.System.Acts.CreateObject.call(this,e,b,c,d)}},RecreateInitialObjects(a,b,c,d,e){a&&this._runtime.GetCurrentLayout().RecreateInitialObjects(a,b,c,d,e)},StopLoop(){const a=this._loopStack;a.IsInLoop()&&a.GetCurrent().Stop()},SetGroupActive(b,c){const a=this._runtime.GetEventSheetManager().GetEventGroupByName(b);a&&(0===c?a.SetGroupActive(!1):1===c?a.SetGroupActive(!0):a.SetGroupActive(!a.IsGroupActive()))},SetTimescale(a){this._runtime.SetTimeScale(a)},SetObjectTimescale(a,b){if(0>b&&(b=0),!!a){const c=a.GetCurrentSol(),d=c.GetInstances();for(const a of d)a.SetTimeScale(b)}},RestoreObjectTimescale(a){if(a){const b=a.GetCurrentSol(),c=b.GetInstances();for(const a of c)a.RestoreTimeScale()}},Wait(a){if(!(0>a))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(a),!0},WaitForSignal(a){return this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(a),!0},WaitForPreviousActions(){const a=this._runtime.GetEventSheetManager();return a.AddScheduledWait().InitPromise(a.GetPromiseForAllAsyncActions()),!0},Signal(a){const b=a.toLowerCase();for(const c of this._runtime.GetEventSheetManager().scheduledWaits())c.IsSignal()&&c.GetSignalTag()===b&&c.SetSignalled()},async SnapshotCanvas(a,b){const c=this._runtime.GetCanvasManager();c&&(this.UpdateRender(),await c.SnapshotCanvas(0===a?"image/png":"image/jpeg",b/100),await this._runtime.TriggerAsync(C3.Plugins.System.Cnds.OnCanvasSnapshot,null))},SetCanvasSize(a,b){if(!(0>=a||0>=b)){this._runtime.SetViewportSize(a,b);const c=this._runtime.GetCurrentLayout();c.BoundScrolling();for(const a of c.GetLayers())a.UpdateViewport();const d=this._runtime.GetCanvasManager();d&&("off"===d.GetCurrentFullscreenMode()?d.SetSize(d.GetLastWidth(),d.GetLastHeight(),!0):(this._runtime.SetOriginalViewportSize(a,b),d.SetSize(d.GetLastWidth(),d.GetLastHeight(),!0)),this._runtime.UpdateRender())}},SetFullscreenQuality(a){const b=this._runtime.GetCanvasManager();b&&"off"!==b.GetCurrentFullscreenMode()&&(b.SetFullscreenScalingQuality(0===a?"low":"high"),b.SetSize(b.GetLastWidth(),b.GetLastHeight(),!0))},SaveState(a){this._runtime.SaveToSlot(a)},LoadState(a){this._runtime.LoadFromSlot(a)},LoadStateJSON(a){this._runtime.LoadFromJsonString(a)},SetHalfFramerateMode(){},ResetPersisted(){for(const a of this._runtime.GetLayoutManager().GetAllLayouts())a.ResetPersistData()},SetPixelRounding(a){this._runtime.SetPixelRoundingEnabled(0!==a)},SetMinimumFramerate(a){this._runtime.SetMinimumFramerate(a)},SortZOrderByInstVar(e,f){if(!e)return;const g=e.GetCurrentSol(),h=g.GetInstances(),j=c,k=d,l=this._runtime.GetCurrentLayout(),m=e.IsFamily(),n=e.GetFamilyIndex();for(let a=0,b=h.length;a<b;++a){const b=h[a],c=b.GetWorldInfo();if(!c)continue;let d;d=m?b.GetInstanceVariableValue(f+b.GetObjectClass().GetFamilyInstanceVariableOffset(n)):b.GetInstanceVariableValue(f),j.push([c.GetLayer().GetIndex(),c.GetZIndex()]),k.push([b,d])}if(!j.length)return;j.sort(a),k.sort(b);let o=!1;for(let a=0,b=j.length;a<b;++a){const b=k[a][0],c=l.GetLayerByIndex(j[a][0]),d=j[a][1],e=c._GetInstances();e[d]!==b&&(e[d]=b,b.GetWorldInfo()._SetLayer(c),c.SetZIndicesChanged(),o=!0)}o&&this._runtime.UpdateRender(),C3.clearArray(c),C3.clearArray(d)},GoToLayout(a){if(!this._runtime.IsLoading()){const b=this._runtime.GetLayoutManager();b.IsPendingChangeMainLayout()||b.ChangeMainLayout(a)}},GoToLayoutByName(a){if(!this._runtime.IsLoading()){const b=this._runtime.GetLayoutManager();if(!b.IsPendingChangeMainLayout()){const c=b.GetLayoutByName(a);c&&b.ChangeMainLayout(c)}}},NextPrevLayout(a){if(!this._runtime.IsLoading()){const b=this._runtime.GetLayoutManager();if(!b.IsPendingChangeMainLayout()){const c=b.GetAllLayouts(),d=c.indexOf(b.GetMainRunningLayout());if(!(a&&0===d)&&(a||d!==c.length-1)){const e=c[d+(a?-1:1)];b.ChangeMainLayout(e)}}}},RestartLayout(){if(!this._runtime.IsLoading()){const a=this._runtime.GetLayoutManager();a.IsPendingChangeMainLayout()||(a.ChangeMainLayout(a.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(a,b){a&&a.SetVisible(b)},SetLayerOpacity(a,b){a&&a.SetOpacity(b/100)},SetLayerScale(a,b){a&&a.SetOwnScale(b)},SetLayerScaleRate(a,b){a&&a.SetScaleRate(b)},SetLayerAngle(b,c){b&&(c=C3.clampAngle(C3.toRadians(+c)),b.GetOwnAngle()===c||(b.SetAngle(c),this.UpdateRender()))},SetLayerParallax(a,b,c){a&&a.SetParallax(b/100,c/100)},SetLayerZElevation(a,b){a&&a.SetZElevation(b)},SetLayerBackground(a,b){if(a){e.setFromRgbValue(b),e.clamp();const c=a.GetBackgroundColor();c.equalsIgnoringAlpha(e)||(c.copyRgb(e),this.UpdateRender())}},SetLayerTransparent(a,b){a&&(b=!!b,a.IsTransparent()===b||(a.SetTransparent(b),this.UpdateRender()))},SetLayerBlendMode(a,b){a&&a.GetBlendMode()!==b&&(a.SetBlendMode(b),this.UpdateRender())},SetLayerEffectEnabled(a,b,c){if(a){const d=a.GetEffectList(),f=d.GetEffectTypeByName(c);if(f){const a=1===b;f.IsActive()===a||(f.SetActive(a),d.UpdateActiveEffects(),this._runtime.UpdateRender())}}},SetLayerEffectParam(a,b,c,d){if(a){const f=a.GetEffectList(),g=f.GetEffectTypeByName(b);if(g){const a=g.GetIndex(),b=f.GetEffectParametersForIndex(a);if(c=Math.floor(c),!(0>c||c>=b.length)){const a=g.GetShaderProgram().GetParameterType(c);if("color"===a){e.setFromRgbValue(d);const a=b[c];if(e.equalsIgnoringAlpha(a))return;a.copyRgb(e)}else{if("percent"===a&&(d/=100),b[c]===d)return;b[c]=d}g.IsActive()&&this._runtime.UpdateRender()}}}},SetLayerForceOwnTexture(a,b){a&&(b=!!b,a.IsForceOwnTexture()===b||(a.SetForceOwnTexture(b),this.UpdateRender()))},SetLayoutScale(a){const b=this._runtime.GetCurrentLayout();b.GetScale()===a||(b.SetScale(a),this.UpdateRender())},SetLayoutAngle(b){b=C3.clampAngle(C3.toRadians(+b));const c=this._runtime.GetCurrentLayout();c.GetAngle()===b||(c.SetAngle(b),this.UpdateRender())},SetLayoutEffectEnabled(a,b){const c=this._runtime.GetCurrentLayout(),d=c.GetEffectList(),f=d.GetEffectTypeByName(b);if(f){const b=1===a;f.IsActive()===b||(f.SetActive(b),d.UpdateActiveEffects(),this._runtime.UpdateRender())}},SetLayoutEffectParam(a,b,c){const d=this._runtime.GetCurrentLayout(),f=d.GetEffectList(),g=f.GetEffectTypeByName(a);if(g){const a=g.GetIndex(),d=f.GetEffectParametersForIndex(a);if(b=Math.floor(b),!(0>b||b>=d.length)){const a=g.GetShaderProgram().GetParameterType(b);if("color"===a){e.setFromRgbValue(c);const a=d[b];if(e.equalsIgnoringAlpha(a))return;a.copyRgb(e)}else{if("percent"===a&&(c/=100),d[b]===c)return;d[b]=c}g.IsActive()&&this._runtime.UpdateRender()}}},ScrollX(a){const b=this._runtime.GetCurrentLayout();b.SetScrollX(a)},ScrollY(a){const b=this._runtime.GetCurrentLayout();b.SetScrollY(a)},Scroll(a,b){const c=this._runtime.GetCurrentLayout();c.SetScrollX(a),c.SetScrollY(b)},ScrollToObject(a){if(a){const b=a.GetFirstPicked();if(b){const a=b.GetWorldInfo();if(a){const b=this._runtime.GetCurrentLayout();b.SetScrollX(a.GetX()),b.SetScrollY(a.GetY())}}}},async LoadObjectTextures(a){const b=this._runtime.GetMainRunningLayout();if(b&&a&&!this._runtime.IsLoading()){const c=a.IsFamily()?a.GetFamilyMembers():[a];await this._LoadTexturesForObjectClasses(b,c)}},async LoadObjectTexturesByName(a){await C3.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(a))},UnloadObjectTextures(a){const b=this._runtime.GetMainRunningLayout();if(b&&a){const c=a.IsFamily()?a.GetFamilyMembers():[a];this._UnloadTexturesForObjectClasses(b,c)}},UnloadObjectTexturesByName(a){C3.Plugins.System.Acts.UnloadObjectTexturesByName.call(this,this._runtime.GetObjectClassByName(a))},UnloadUnusedTextures(){const a=this._runtime.GetMainRunningLayout();if(a){const b=a._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(a,b)}},async LoadLayoutTextures(a){const b=this._runtime.GetMainRunningLayout();a&&b&&!this._runtime.IsLoading()&&(await this._LoadTexturesForObjectClasses(b,a._GetInitialObjectClasses()))},async LoadLayoutTexturesByName(a){const b=this._runtime.GetMainRunningLayout(),c=this._runtime.GetLayoutManager().GetLayoutByName(a);c&&b&&!this._runtime.IsLoading()&&(await this._LoadTexturesForObjectClasses(b,c._GetInitialObjectClasses()))},SetFunctionReturnValue(a){const b=this._eventStack.GetCurrentExpFuncStackFrame();if(b)switch(b.GetFunctionReturnType()){case 1:"number"==typeof a&&b.SetFunctionReturnValue(a);break;case 2:"string"==typeof a&&b.SetFunctionReturnValue(a);break;case 3:b.SetFunctionReturnValue(a);}},MapFunction(a,b,c){const d=this._GetFunctionMap(a.toLowerCase(),!0),e=d.strMap,f=b.toLowerCase();e.has(f)&&console.warn(`[Construct 3] Function map '${a}' string '${b}' already in map; overwriting entry`);const g=C3.first(e.values())||d.defaultFunc;if(g){const d=0!==g.GetReturnType(),e=0!==c.GetReturnType();if(d!=e)return void console.error(`[Construct 3] Function map '${a}' string '${b}' function return type not compatible with other functions in the map; entry ignored`)}e.set(f,c)},MapFunctionDefault(a,b){const c=this._GetFunctionMap(a.toLowerCase(),!0);c.defaultFunc&&console.warn(`[Construct 3] Function map '${a}' already has a default; overwriting entry`);const d=C3.first(c.strMap.values())||c.defaultFunc;if(d){const c=0!==d.GetReturnType(),e=0!==b.GetReturnType();if(c!=e)return void console.error(`[Construct 3] Function map '${a}' default: function return type not compatible with other functions in the map; entry ignored`)}c.defaultFunc=b},CallMappedFunction(a,b,c){c=Math.floor(c);const d=this._GetFunctionMap(a.toLowerCase(),!1);if(!d)return void console.warn(`[Construct 3] Call mapped function: map name '${a}' not found; call ignored`);let e=d.strMap.get(b.toLowerCase());if(!e)if(d.defaultFunc)e=d.defaultFunc,c=0;else return void console.warn(`[Construct 3] Call mapped function: no function associated with map '${a}' string '${b}'; call ignored (consider setting a default)`);if(e.IsEnabled()){if(0!==e.GetReturnType())return void console.warn(`[Construct 3] Call mapped function: map '${a}' string '${b}' has a return type so cannot be called`);const d=this._runtime,f=d.GetEventSheetManager(),g=f.GetCurrentEvent(),h=g.GetSolModifiersIncludingParents(),i=0<h.length;i&&f.PushCleanSol(h);const j=[],k=f.FindFirstFunctionBlockParent(g);if(k){const a=k.GetFunctionParameters();for(let b=c,d=a.length;b<d;++b)j.push(a[b].GetValue())}const l=e.GetFunctionParameters();for(let a=j.length,b=l.length;a<b;++a)j.push(l[a].GetInitialValue());return d.IsDebugging()?this._DebugDoCallMappedFunction(f,e,j,i,h):this._DoCallMappedFunction(f,e,j,i,h)}}}}
"use strict";C3.Plugins.System.Exps={int:function(a){return"string"==typeof a&&(a=parseInt(a,10),isNaN(a)&&(a=0)),Math.floor(a)},float:function(a){return"string"==typeof a&&(a=parseFloat(a),isNaN(a)&&(a=0)),a},str(a){return a.toString()},len(a){return"string"==typeof a?a.length:0},random(c,a){return"undefined"==typeof a?this._runtime.Random()*c:this._runtime.Random()*(a-c)+c},choose(...a){const b=Math.floor(this._runtime.Random()*a.length);return a[b]},pi(){return Math.PI},infinity(){return 1/0},sqrt(a){return Math.sqrt(a)},abs(a){return Math.abs(a)},round(a){return Math.round(a)},floor(a){return Math.floor(a)},ceil(a){return Math.ceil(a)},sign(a){return Math.sign(a)},sin(a){return Math.sin(C3.toRadians(a))},cos(a){return Math.cos(C3.toRadians(a))},tan(a){return Math.tan(C3.toRadians(a))},asin(a){return C3.toDegrees(Math.asin(a))},acos(a){return C3.toDegrees(Math.acos(a))},atan(a){return C3.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 c,d=1,e=a.length;d<e;++d)c=a[d],"number"==typeof c&&b<c&&(b=c);return b},min(...a){let b=a[0];"number"!=typeof b&&(b=0);for(let c,d=1,e=a.length;d<e;++d)c=a[d],"number"==typeof c&&b>c&&(b=c);return b},clamp(a,b,c){return C3.clamp(a,b,c)},distance(a,b,c,d){return C3.distanceTo(a,b,c,d)},angle(a,b,c,d){return C3.toDegrees(C3.angleTo(a,b,c,d))},lerp(c,a,b){return C3.lerp(c,a,b)},unlerp(c,a,b){return C3.unlerp(c,a,b)},qarp(d,a,b,c){return C3.qarp(d,a,b,c)},cubic(e,a,b,c,d){return C3.cubic(e,a,b,c,d)},cosp(c,a,b){return C3.cosp(c,a,b)},anglediff(c,a){return C3.toDegrees(C3.angleDiff(C3.toRadians(c),C3.toRadians(a)))},anglelerp(c,a,b){return C3.toDegrees(C3.angleLerp(C3.toRadians(c),C3.toRadians(a),b))},anglerotate(d,a,b){return C3.toDegrees(C3.angleRotate(C3.toRadians(d),C3.toRadians(a),C3.toRadians(b)))},setbit(a,c,b){return a|=0,c|=0,b=0===b?0:1,a&~(1<<c)|b<<c},togglebit(a,c){return a|=0,c|=0,a^1<<c},getbit(a,c){return a|=0,c|=0,a&1<<c?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,c){return"string"==typeof a?0>c?a.substr(b):a.substr(b,c):""},right(a,b){return"string"==typeof a?a.substr(a.length-b):""},trim(a){return"string"==typeof a?a.trim():""},tokenat(a,b,c){if("string"!=typeof a||"string"!=typeof c)return"";let d=a.split(c);return b=Math.floor(b),0>b||b>=d.length?"":d[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(C3.EscapeRegex(b),"i")):-1},findcase(a,b){return"string"==typeof a&&"string"==typeof b?a.search(new RegExp(C3.EscapeRegex(b),"")):-1},replace(a,b,c){return"string"==typeof a&&"string"==typeof b&&"string"==typeof c?a.replace(new RegExp(C3.EscapeRegex(b),"gi"),c):"string"==typeof a?a:""},regexsearch(a,b,c){const d=this.GetRegex(b,c);return a?a.search(d):-1},regexreplace(a,b,c,d){const e=this.GetRegex(b,c);return a?a.replace(e,d):""},regexmatchcount(a,b,c){const d=this.GetRegexMatches(a.toString(),b,c);return d?d.length:0},regexmatchat(a,b,c,d){d=Math.floor(d);const e=this.GetRegexMatches(a.toString(),b,c);return!e||0>d||d>=e.length?"":e[d]},zeropad(a,b){let c=0>a?"-":"";0>a&&(a=-a);const d=b-a.toString().length;return c+="0".repeat(Math.max(d,0)),c+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 C3.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},viewportleft(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetViewport().getLeft():0},viewporttop(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetViewport().getTop():0},viewportright(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetViewport().getRight():0},viewportbottom(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetViewport().getBottom():0},viewportwidth(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetViewport().width():0},viewportheight(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetViewport().height():0},canvastolayerx(a,b,c){const d=this._runtime.GetCurrentLayout().GetLayer(a);return d?d.CanvasCssToLayer(b,c)[0]:0},canvastolayery(a,b,c){const d=this._runtime.GetCurrentLayout().GetLayer(a);return d?d.CanvasCssToLayer(b,c)[1]:0},layertocanvasx(a,b,c){const d=this._runtime.GetCurrentLayout().GetLayer(a);return d?d.LayerToCanvasCss(b,c)[0]:0},layertocanvasy(a,b,c){const d=this._runtime.GetCurrentLayout().GetLayer(a);return d?d.LayerToCanvasCss(b,c)[1]:0},layerscale(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetOwnScale():0},layerangle(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?C3.toDegrees(b.GetOwnAngle()):0},layeropacity(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?100*b.GetOpacity():0},layerscalerate(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetScaleRate():0},layerparallaxx(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?100*b.GetParallaxX():0},layerparallaxy(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?100*b.GetParallaxY():0},layerzelevation(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetZElevation():0},layerindex(a){const b=this._runtime.GetCurrentLayout().GetLayer(a);return b?b.GetIndex():-1},canvassnapshot(){const a=this._runtime.GetCanvasManager();return a?a.GetCanvasSnapshotUrl():""},loopindex(a){const b=this._loopStack;if(!b.IsInLoop())return 0;if(a){const c=b.FindByName(a);return c?c.GetIndex():0}return b.GetCurrent().GetIndex()},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(a,b,...c){const d=this._GetFunctionMap(a.toLowerCase(),!1);if(!d)return console.warn(`[Construct 3] Call mapped function: map name '${a}' not found; returning 0`),0;let e=d.strMap.get(b.toLowerCase());if(!e)if(d.defaultFunc)e=d.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;const f=e.GetReturnType(),g=e.GetDefaultReturnValue();if(0===f)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(!e.IsEnabled())return g;const h=this._runtime,i=h.GetEventSheetManager(),j=i.GetCurrentEvent(),k=j.GetSolModifiersIncludingParents(),l=0<k.length;l&&i.PushCleanSol(k);const m=e.GetFunctionParameters();for(let d=c.length,e=m.length;d<e;++d)c.push(m[d].GetInitialValue());const n=e.GetEventBlock(),o=n.RunAsExpressionFunctionCall(n.GetSolModifiersIncludingParents(),f,g,...c);return l&&i.PopSol(k),o},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return"webgl"},rendererdetail(){return this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let a=this._runtime.GetWebGLRenderer().GetEstimatedTextureMemoryUsage();return Math.round(100*a/1048576)/100},rgb(a,c,d){return C3.PackRGB(a,c,d)},rgbex(a,c,d){return C3.PackRGBEx(a/100,c/100,d/100)},rgba(c,d,e,b){return C3.PackRGBAEx(c/100,d/100,e/100,b/100)},rgbex255(a,c,d){return C3.PackRGBEx(a/255,c/255,d/255)},rgba255(c,d,e,b){return C3.PackRGBAEx(c/255,d/255,e/255,b/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";
{
C3.Plugins.SkymenInputManager = class SingleGlobalPlugin extends C3.SDKPluginBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.SkymenInputManager.Type = class SingleGlobalType extends C3.SDKTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{
}
};
}
"use strict";
{
C3.Plugins.SkymenInputManager.Instance = class SingleGlobalInstance extends C3.SDKInstanceBase
{
constructor(inst, properties)
{
super(inst);
this.inputs = {};
this.lastTrigger = "";
}
Release()
{
super.Release();
}
SaveToJson()
{
return {
inputs: JSON.stringify(this.inputs),
lastTrigger: this.lastTrigger
};
}
LoadFromJson(o)
{
this.inputs = JSON.parse(o.inputs);
this.lastTrigger = o.lastTrigger;
}
};
}
"use strict";
{
C3.Plugins.SkymenInputManager.Cnds = {
IsDown(input)
{
return this.inputs[input];
},
OnDown(input)
{
return this.lastTrigger === input;
},
OnUp(input)
{
return this.lastTrigger === input;
},
AnyUp()
{
return true;
},
AnyDown()
{
return true;
}
};
}
"use strict";
{
C3.Plugins.SkymenInputManager.Acts = {
SetUp(input)
{
if(this.inputs[input]){
this.inputs[input] = false;
this.lastTrigger = input;
this.Trigger(C3.Plugins.SkymenInputManager.Cnds.OnUp);
this.Trigger(C3.Plugins.SkymenInputManager.Cnds.AnyUp);
}
},
SetDown(input)
{
if(!this.inputs[input]){
this.inputs[input] = true;
this.lastTrigger = input;
this.Trigger(C3.Plugins.SkymenInputManager.Cnds.OnDown);
this.Trigger(C3.Plugins.SkymenInputManager.Cnds.AnyDown);
}
},
SimulateDownTrigger(input)
{
this.lastTrigger = input;
this.Trigger(C3.Plugins.SkymenInputManager.Cnds.OnDown);
this.Trigger(C3.Plugins.SkymenInputManager.Cnds.AnyDown);
},
SimulateUpTrigger(input)
{
this.lastTrigger = input;
this.Trigger(C3.Plugins.SkymenInputManager.Cnds.OnUp);
this.Trigger(C3.Plugins.SkymenInputManager.Cnds.AnyUp);
}
};
}
"use strict";
{
C3.Plugins.SkymenInputManager.Exps = {
GetLast()
{
return this.lastTrigger;
}
};
}
"use strict";C3.Plugins.Keyboard=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";{function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}C3.Plugins.Keyboard.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return IKeyboardObjectType}};let b=null;self.IKeyboardObjectType=class extends IObjectClass{constructor(a){super(a),b=a,a.GetRuntime()._GetCommonScriptInterfaces().keyboard=this}isKeyDown(b){const c=a();if("string"==typeof b)return c.IsKeyDown(b);if("number"==typeof b)return c.IsKeyCodeDown(b);throw new TypeError("expected string or number")}}}
"use strict";C3.Plugins.Keyboard.Instance=class extends C3.SDKInstanceBase{constructor(a){super(a),this._keysDownByString=new Set,this._keysDownByWhich=new Set,this._triggerWhich=0,this._triggerString="",this._triggerTypedKey="";const b=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(b,"keydown",(a)=>this._OnKeyDown(a.data)),C3.Disposable.From(b,"keyup",(a)=>this._OnKeyUp(a.data)),C3.Disposable.From(b,"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnKeyDown(a){const b=a["which"],c=a["code"]||b.toString(),d=a["key"];this._keysDownByString.has(c)||(this._keysDownByString.add(c),this._keysDownByWhich.add(b),this._triggerString=c,this._triggerWhich=b,this._triggerTypedKey=d,this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKey),this.Trigger(C3.Plugins.Keyboard.Cnds.OnKey),this.Trigger(C3.Plugins.Keyboard.Cnds.OnLeftRightKeyPressed),this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCode))}_OnKeyUp(a){const b=a["which"],c=a["code"]||b.toString(),d=a["key"];this._keysDownByString.delete(c),this._keysDownByWhich.delete(b),this._triggerString=c,this._triggerWhich=b,this._triggerTypedKey=d,this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyReleased),this.Trigger(C3.Plugins.Keyboard.Cnds.OnLeftRightKeyReleased),this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}_OnWindowBlur(){for(const a of this._keysDownByWhich)this._keysDownByWhich.delete(a),this._triggerWhich=a,this.Trigger(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased),this.Trigger(C3.Plugins.Keyboard.Cnds.OnKeyReleased),this.Trigger(C3.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:C3.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerWhich)},{name:"plugins.keyboard.debugger.last-typed-key",value:this._triggerTypedKey}]}]}};
"use strict";{const a=["ShiftLeft","ShiftRight","ControlLeft","ControlRight","AltLeft","AltRight","MetaLeft","MetaRight"];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){return a=Math.floor(a),this._keysDownByWhich.has(a)},OnKeyCode(a){return this._triggerWhich===a},OnKeyCodeReleased(a){return this._triggerWhich===a},OnLeftRightKeyPressed(b){const c=a[b];return this._triggerString===c},OnLeftRightKeyReleased(b){const c=a[b];return this._triggerString===c},IsLeftRightKeyDown(b){const c=a[b];return this._keysDownByString.has(c)}}}
"use strict";C3.Plugins.Keyboard.Acts={};
"use strict";{function a(a){return a=Math.floor(a),8===a?"backspace":9===a?"tab":13===a?"enter":16===a?"shift":17===a?"control":18===a?"alt":19===a?"pause":20===a?"capslock":27===a?"esc":33===a?"pageup":34===a?"pagedown":35===a?"end":36===a?"home":37===a?"\u2190":38===a?"\u2191":39===a?"\u2192":40===a?"\u2193":45===a?"insert":46===a?"del":91===a?"left window key":92===a?"right window key":93===a?"select":96===a?"numpad 0":97===a?"numpad 1":98===a?"numpad 2":99===a?"numpad 3":100===a?"numpad 4":101===a?"numpad 5":102===a?"numpad 6":103===a?"numpad 7":104===a?"numpad 8":105===a?"numpad 9":106===a?"numpad *":107===a?"numpad +":109===a?"numpad -":110===a?"numpad .":111===a?"numpad /":112===a?"F1":113===a?"F2":114===a?"F3":115===a?"F4":116===a?"F5":117===a?"F6":118===a?"F7":119===a?"F8":120===a?"F9":121===a?"F10":122===a?"F11":123===a?"F12":144===a?"numlock":145===a?"scroll lock":186===a?";":187===a?"=":188===a?",":189===a?"-":190===a?".":191===a?"/":192===a?"'":219===a?"[":220===a?"\\":221===a?"]":222===a?"#":223===a?"`":String.fromCharCode(a)}C3.Plugins.Keyboard.Exps={LastKeyCode(){return this._triggerWhich},StringFromKeyCode(b){return a(b)},TypedKey(){return this._triggerTypedKey}}}
"use strict";C3.Plugins.Arr=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Arr.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{function a(a,b){const c=[];if("function"==typeof b)for(let d=0;d<a;++d)c.push(b());else for(let d=0;d<a;++d)c.push(b);return c}function b(a,b,c){if(b<a.length)C3.truncateArray(a,b);else if(b>a.length)if("function"==typeof c)for(let d=a.length;d<b;++d)a.push(c());else for(let d=a.length;d<b;++d)a.push(c)}C3.Plugins.Arr.Instance=class extends C3.SDKInstanceBase{constructor(b,c){super(b),this._cx=10,this._cy=1,this._cz=1,this._arr=null,this._forX=[],this._forY=[],this._forZ=[],this._forDepth=-1,c&&(this._cx=c[0],this._cy=c[1],this._cz=c[2]),this._arr=a(this._cx,()=>a(this._cy,()=>a(this._cz,0)))}Release(){this._arr=null,super.Release()}At(a,b,c){var d=Math.floor;return a=d(a),b=d(b),c=d(c),0<=a&&a<this._cx&&0<=b&&b<this._cy&&0<=c&&c<this._cz?this._arr[a][b][c]:0}Set(a,b,c,d){var e=Math.floor;a=e(a),b=e(b),c=e(c),0<=a&&a<this._cx&&0<=b&&b<this._cy&&0<=c&&c<this._cz&&(this._arr[a][b][c]=d)}SetSize(c,e,f){var d=Math.floor;if(c=d(c),e=d(e),f=d(f),0>c&&(c=0),0>e&&(e=0),0>f&&(f=0),this._cx!==c||this._cy!==e||this._cz!==f){this._cx=c,this._cy=e,this._cz=f;const d=this._arr;b(d,c,()=>a(e,()=>a(f,0)));for(let g=0;g<c;++g){b(d[g],e,()=>a(f,0));for(let a=0;a<e;++a)b(d[g][a],f,0)}}}GetWidth(){return this._cx}GetHeight(){return this._cy}GetDepth(){return this._cz}GetDebuggerProperties(){const a=[{title:"plugins.arr.debugger.array-properties.title",properties:[{name:"plugins.arr.properties.width.name",value:this._cx,onedit:(a)=>this.SetSize(a,this._cy,this._cz)},{name:"plugins.arr.properties.height.name",value:this._cy,onedit:(a)=>this.SetSize(this._cx,a,this._cz)},{name:"plugins.arr.properties.depth.name",value:this._cz,onedit:(a)=>this.SetSize(this._cx,this._cy,a)},{name:"plugins.arr.properties.elements.name",value:this._cx*this._cy*this._cz}]}],b=[];if(1===this._cy&&1===this._cz)for(let a=0;a<this._cx;++a)b.push({name:"$"+a,value:this._arr[a][0][0],onedit:(b)=>this._arr[a][0][0]=b});else for(let a=0;a<this._cx;++a)b.push({name:"$"+a,value:this._arr[a].toString()});return b.length&&a.push({title:"plugins.arr.debugger.array-data.title",properties:b}),a}GetAsJsonString(){return JSON.stringify({"c2array":!0,"size":[this._cx,this._cy,this._cz],"data":this._arr})}SaveToJson(){return{"size":[this._cx,this._cy,this._cz],"data":this._arr}}LoadFromJson(a){const b=a["size"];this._cx=b[0],this._cy=b[1],this._cz=b[2],this._arr=a["data"]}_GetForX(){return 0<=this._forDepth&&this._forDepth<this._forX.length?this._forX[this._forDepth]:0}_GetForY(){return 0<=this._forDepth&&this._forDepth<this._forY.length?this._forY[this._forDepth]:0}_GetForZ(){return 0<=this._forDepth&&this._forDepth<this._forZ.length?this._forZ[this._forDepth]:0}GetScriptInterfaceClass(){return IArrayInstance}};const c=new WeakMap;self.IArrayInstance=class extends IInstance{constructor(){super(),c.set(this,IInstance._GetInitInst().GetSdkInstance())}get width(){return c.get(this).GetWidth()}get height(){return c.get(this).GetHeight()}get depth(){return c.get(this).GetDepth()}setSize(a,b=1,e=1){c.get(this).SetSize(a,b,e)}getAt(a,b=0,d=0){return c.get(this).At(a,b,d)}setAt(a,b,d=0,e=0){if("number"!=typeof a&&"string"!=typeof a)throw new TypeError("invalid type");c.get(this).Set(b,d,e,a)}}}
"use strict";{function a(a,b,c,d,e){a.PushCopySol(c),b.Retrigger(d,e),a.PopSol(c)}C3.Plugins.Arr.Cnds={CompareX(a,b,c){return C3.compare(this.At(a,0,0),b,c)},CompareXY(a,b,c,d){return C3.compare(this.At(a,b,0),c,d)},CompareXYZ(a,b,c,d,e){return C3.compare(this.At(a,b,c),d,e)},ArrForEach(b){const c=this._runtime,d=c.GetEventSheetManager(),e=c.GetCurrentEvent(),f=e.GetSolModifiers(),g=c.GetEventStack(),h=g.GetCurrentStackFrame(),i=g.Push(e),j=++this._forDepth,k=this._forX,l=this._forY,m=this._forZ,n=this._cx,o=this._cy,p=this._cz;if(j===this._forX.length?(k.push(0),l.push(0),m.push(0)):(k[j]=0,l[j]=0,m[j]=0),c.SetDebuggingEnabled(!1),0===b)for(let b=0;b<n;++b)for(let c=0;c<o;++c)for(let g=0;g<p;++g)k[j]=b,l[j]=c,m[j]=g,a(d,e,f,h,i);else if(1===b)for(let b=0;b<n;++b)for(let c=0;c<o;++c)k[j]=b,l[j]=c,a(d,e,f,h,i);else for(let b=0;b<n;++b)k[j]=b,a(d,e,f,h,i);return c.SetDebuggingEnabled(!0),this._forDepth--,g.Pop(),!1},CompareCurrent(a,b){return C3.compare(this.At(this._GetForX(),this._GetForY(),this._GetForZ()),a,b)},Contains(a){const b=this._cx,c=this._cy,d=this._cz,e=this._arr;for(let f=0;f<b;++f)for(let b=0;b<c;++b)for(let c=0;c<d;++c)if(e[f][b][c]===a)return!0;return!1},IsEmpty(){return 0===this._cx||0===this._cy||0===this._cz},CompareSize(a,b,c){let d=0;return 0===a?d=this._cx:1===a?d=this._cy:2===a?d=this._cz:void 0,C3.compare(d,b,c)}}}
"use strict";{function a(a,b){const c=[];if("function"==typeof b)for(let d=0;d<a;++d)c.push(b());else for(let d=0;d<a;++d)c.push(b);return c}function c(a,b){if("number"==typeof a&&"number"==typeof b)return a-b;else{const c=a.toString(),d=b.toString();return c<d?-1:c>d?1:0}}C3.Plugins.Arr.Acts={Clear(a){const b=this._cx,c=this._cy,d=this._cz,e=this._arr;for(let f=0;f<b;++f)for(let b=0;b<c;++b)for(let c=0;c<d;++c)e[f][b][c]=a},SetSize(a,b,c){this.SetSize(a,b,c)},SetX(a,b){this.Set(a,0,0,b)},SetXY(a,b,c){this.Set(a,b,0,c)},SetXYZ(a,b,c,d){this.Set(a,b,c,d)},Push(b,c,d){const e=this._cx,f=this._cy,g=this._cz,h=this._arr;if(0===d){const d=a(f,()=>a(g,c));0===b?h.push(d):h.unshift(d),this._cx++}else if(1===d){for(let d=0;d<e;++d){const e=a(g,c);0===b?h[d].push(e):h[d].unshift(e)}this._cy++}else{for(let a=0;a<e;++a)for(let d=0;d<f;++d)0===b?h[a][d].push(c):h[a][d].unshift(c);this._cz++}},Pop(a,b){const c=this._cx,d=this._cy,e=this._cz,f=this._arr;if(0===b){if(0===c)return;0===a?f.pop():f.shift(),this._cx--}else if(1===b){if(0===d)return;for(let b=0;b<c;++b)0===a?f[b].pop():f[b].shift();this._cy--}else{if(0===e)return;for(let b=0;b<c;++b)for(let c=0;c<d;++c)0===a?f[b][c].pop():f[b][c].shift();this._cz--}},Reverse(a){const b=this._cx,c=this._cy,d=this._cz,e=this._arr;if(0!==b&&0!==c&&0!==d)if(0===a)e.reverse();else if(1===a)for(let a=0;a<b;++a)e[a].reverse();else for(let a=0;a<b;++a)for(let b=0;b<c;++b)e[a][b].reverse()},Sort(a){const b=this._cx,d=this._cy,e=this._cz,f=this._arr;if(0!==b&&0!==d&&0!==e)if(0===a)f.sort((d,a)=>c(d[0][0],a[0][0]));else if(1===a)for(let a=0;a<b;++a)f[a].sort((d,a)=>c(d[0],a[0]));else for(let a=0;a<b;++a)for(let b=0;b<d;++b)f[a][b].sort(c)},Delete(a,b){if(a=Math.floor(a),!(0>a)){const c=this._cx,d=this._cy,e=this._cz,f=this._arr;if(0===b){if(a>=c)return;f.splice(a,1),this._cx--}else if(1===b){if(a>=d)return;for(let b=0;b<c;++b)f[b].splice(a,1);this._cy--}else{if(a>=e)return;for(let b=0;b<c;++b)for(let c=0;c<d;++c)f[b][c].splice(a,1);this._cz--}}},Insert(b,c,d){if(c=Math.floor(c),0>c)return;const e=this._cx,f=this._cy,g=this._cz,h=this._arr;if(0===d){if(c>e)return;h.splice(c,0,a(f,()=>a(g,b))),this._cx++}else if(1===d){if(c>f)return;for(let d=0;d<e;++d)h[d].splice(c,0,a(g,b));this._cy++}else{if(c>g)return;for(let a=0;a<e;++a)for(let d=0;d<f;++d)h[a][d].splice(c,0,b);this._cz++}},JSONLoad(a){let b=null;try{b=JSON.parse(a)}catch(a){return void console.error("[Construct 3] Failed to parse JSON: ",a)}if(b["c2array"]){const a=b["size"];this._cx=a[0],this._cy=a[1],this._cz=a[2],this._arr=b["data"]}},JSONDownload(a){const b=URL.createObjectURL(new Blob([this.GetAsJsonString()],{type:"application/json"}));this._runtime.InvokeDownload(b,a)}}}
"use strict";C3.Plugins.Arr.Exps={At(a,b,c){return this.At(a,b||0,c||0)},Width(){return this._cx},Height(){return this._cy},Depth(){return this._cz},CurX(){return this._GetForX()},CurY(){return this._GetForY()},CurZ(){return this._GetForZ()},CurValue(){return this.At(this._GetForX(),this._GetForY(),this._GetForZ())},Front(){return this.At(0,0,0)},Back(){return this.At(this._cx-1,0,0)},IndexOf(a){const b=this._arr;for(let c=0,d=this._cx;c<d;++c)if(b[c][0][0]===a)return c;return-1},LastIndexOf(a){const b=this._arr;for(let c=this._cx-1;0<=c;--c)if(b[c][0][0]===a)return c;return-1},AsJSON(){return this.GetAsJsonString()}};
{
C3.Plugins.Globals = class GlobalsPlugin extends C3.SDKPluginBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.Globals.Type = class GlobalsType extends C3.SDKTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{
}
};
}
"use strict";
{
C3.Plugins.Globals.Instance = class GlobalsInstance extends C3.SDKInstanceBase //SDKInstanceBase
{
constructor(inst)
{
super(inst);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.Globals.Cnds = {};
}
"use strict";
{
C3.Plugins.Globals.Acts = {};
}
"use strict";
{
C3.Plugins.Globals.Exps = {};
}
"use strict";C3.Plugins.Mouse=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";{function a(){return b.GetSingleGlobalInstance().GetSdkInstance()}C3.Plugins.Mouse.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return IMouseObjectType}};let b=null;self.IMouseObjectType=class extends IObjectClass{constructor(a){super(a),b=a,a.GetRuntime()._GetCommonScriptInterfaces().mouse=this}getMouseX(b){return a().GetMousePositionForLayer(b)[0]}getMouseY(b){return a().GetMousePositionForLayer(b)[1]}getMousePosition(b){return a().GetMousePositionForLayer(b)}isMouseButtonDown(b){return a().IsMouseButtonDown(b)}}}
"use strict";{C3.Plugins.Mouse.Instance=class extends C3.SDKInstanceBase{constructor(a){super(a,"mouse"),this._buttonMap=[!1,!1,!1],this._mouseXcanvas=0,this._mouseYcanvas=0,this._triggerButton=0,this._triggerType=0,this._triggerDir=0;const b=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(b,"pointermove",(a)=>this._OnPointerMove(a.data)),C3.Disposable.From(b,"pointerdown",(a)=>this._OnPointerDown(a.data)),C3.Disposable.From(b,"pointerup",(a)=>this._OnPointerUp(a.data)),C3.Disposable.From(b,"dblclick",(a)=>this._OnDoubleClick(a.data)),C3.Disposable.From(b,"wheel",(a)=>this._OnMouseWheel(a.data)),C3.Disposable.From(b,"window-blur",()=>this._OnWindowBlur()))}Release(){super.Release()}_OnPointerDown(a){"mouse"!==a["pointerType"]||(this._mouseXcanvas=a["clientX"]-this._runtime.GetCanvasClientX(),this._mouseYcanvas=a["clientY"]-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(a["lastButtons"],a["buttons"]))}_OnPointerMove(a){"mouse"!==a["pointerType"]||(this._mouseXcanvas=a["clientX"]-this._runtime.GetCanvasClientX(),this._mouseYcanvas=a["clientY"]-this._runtime.GetCanvasClientY(),this._CheckButtonChanges(a["lastButtons"],a["buttons"]))}_OnPointerUp(a){"mouse"!==a["pointerType"]||this._CheckButtonChanges(a["lastButtons"],a["buttons"])}_CheckButtonChanges(a,b){this._CheckButtonChange(a,b,1,0),this._CheckButtonChange(a,b,4,1),this._CheckButtonChange(a,b,2,2)}_CheckButtonChange(a,b,c,d){!(a&c)&&b&c?this._OnMouseDown(d):a&c&&!(b&c)&&this._OnMouseUp(d)}_OnMouseDown(a){this._buttonMap[a]=!0,this.Trigger(C3.Plugins.Mouse.Cnds.OnAnyClick),this._triggerButton=a,this._triggerType=0,this.Trigger(C3.Plugins.Mouse.Cnds.OnClick),this.Trigger(C3.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseUp(a){this._buttonMap[a]&&(this._buttonMap[a]=!1,this._triggerButton=a,this.Trigger(C3.Plugins.Mouse.Cnds.OnRelease))}_OnDoubleClick(a){this._triggerButton=a["button"],this._triggerType=1,this.Trigger(C3.Plugins.Mouse.Cnds.OnClick),this.Trigger(C3.Plugins.Mouse.Cnds.OnObjectClicked)}_OnMouseWheel(a){this._triggerDir=0>a["deltaY"]?1:0,this.Trigger(C3.Plugins.Mouse.Cnds.OnWheel)}_OnWindowBlur(){for(let a=0,b=this._buttonMap.length;a<b;++a){if(!this._buttonMap[a])return;this._buttonMap[a]=!1,this._triggerButton=a,this.Trigger(C3.Plugins.Mouse.Cnds.OnRelease)}}GetMousePositionForLayer(a){const b=this._runtime.GetMainRunningLayout(),c=this._mouseXcanvas,d=this._mouseYcanvas;if("undefined"==typeof a){const a=b.GetLayerByIndex(0);return a.CanvasCssToLayer_DefaultTransform(c,d)}else{const e=b.GetLayer(a);return e?e.CanvasCssToLayer(c,d):[0,0]}}IsMouseButtonDown(a){return a=Math.floor(a),!!this._buttonMap[a]}_IsMouseOverCanvas(){return 0<=this._mouseXcanvas&&0<=this._mouseYcanvas&&this._mouseXcanvas<this._runtime.GetCanvasCssWidth()&&this._mouseYcanvas<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.mouse.name",properties:[{name:"plugins.mouse.debugger.absolute-position",value:this._mouseXcanvas+","+this._mouseYcanvas},{name:"plugins.mouse.debugger.left-button",value:this._buttonMap[0]},{name:"plugins.mouse.debugger.middle-button",value:this._buttonMap[1]},{name:"plugins.mouse.debugger.right-button",value:this._buttonMap[2]}]},{title:"plugins.mouse.debugger.position-on-each-layer",properties:this._runtime.GetMainRunningLayout().GetLayers().map((a)=>({name:"$"+a.GetName(),value:a.CanvasCssToLayer(this._mouseXcanvas,this._mouseYcanvas).join(", ")}))}]}}}
"use strict";C3.Plugins.Mouse.Cnds={OnClick(a,b){return this._triggerButton===a&&this._triggerType===b},OnAnyClick(){return!0},IsButtonDown(a){return this._buttonMap[a]},OnRelease(a){return this._triggerButton===a},IsOverObject(a){if(!this._IsMouseOverCanvas())return!1;const b=this._runtime.GetCurrentCondition(),c=b.IsInverted(),d=this._mouseXcanvas,e=this._mouseYcanvas;return C3.xor(this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,d,e,c),c)},OnObjectClicked(a,b,c){if(a!==this._triggerButton||b!==this._triggerType)return!1;if(!this._IsMouseOverCanvas())return!1;const d=this._mouseXcanvas,e=this._mouseYcanvas;return this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(c,d,e,!1)},OnWheel(a){return this._triggerDir===a}};
"use strict";{let a=null;const b=["auto","pointer","text","crosshair","move","help","wait","none"];C3.Plugins.Mouse.Acts={SetCursor(d){const c=b[d];a===c||(a=c,this.PostToDOM("cursor",c))},SetCursorSprite(b){if(C3.Platform.IsMobile||!b)return;const c=b.GetFirstPicked();if(!c)return;const d=c.GetWorldInfo(),e=c.GetCurrentImageInfo();d&&e&&a!==e&&(a=e,e.ExtractImageToCanvas().then((a)=>C3.CanvasToBlob(a)).then((a)=>{var b=Math.round;const c=URL.createObjectURL(a),f=`url(${c}) ${b(d.GetOriginX()*e.GetWidth())} ${b(d.GetOriginY()*e.GetHeight())}, auto`;this.PostToDOM("cursor",""),this.PostToDOM("cursor",f)}))}}}
"use strict";C3.Plugins.Mouse.Exps={X(a){return this.GetMousePositionForLayer(a)[0]},Y(a){return this.GetMousePositionForLayer(a)[1]},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas}};
"use strict";C3.Plugins.Browser=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Browser.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{C3.Plugins.Browser.Instance=class extends C3.SDKInstanceBase{constructor(a){super(a,"browser"),this._initLocationStr="",this._isOnline=!1,this._referrer="",this._docTitle="",this._isCookieEnabled=!1,this._screenWidth=0,this._screenHeight=0,this._windowOuterWidth=0,this._windowOuterHeight=0,this._isScirraArcade=!1,this.AddDOMMessageHandler("online-state",(a)=>this._OnOnlineStateChanged(a)),this.AddDOMMessageHandler("backbutton",()=>this._OnBackButton()),this.AddDOMMessageHandler("sw-message",(a)=>this._OnSWMessage(a));const b=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(b,"afterfirstlayoutstart",()=>this._OnAfterFirstLayoutStart()),C3.Disposable.From(b,"window-resize",()=>this._OnWindowResize()),C3.Disposable.From(b,"suspend",()=>this._OnSuspend()),C3.Disposable.From(b,"resume",()=>this._OnResume())),this._runtime.AddLoadPromise(this.PostToDOMAsync("get-initial-state",{"exportType":this._runtime.GetExportType()}).then((a)=>{this._initLocationStr=a["location"],this._isOnline=a["isOnline"],this._referrer=a["referrer"],this._docTitle=a["title"],this._isCookieEnabled=a["isCookieEnabled"],this._screenWidth=a["screenWidth"],this._screenHeight=a["screenHeight"],this._windowOuterWidth=a["windowOuterWidth"],this._windowOuterHeight=a["windowOuterHeight"],this._isScirraArcade=a["isScirraArcade"]}))}Release(){super.Release()}_OnAfterFirstLayoutStart(){this.PostToDOM("ready-for-sw-messages")}async _OnOnlineStateChanged(a){const b=!!a["isOnline"];this._isOnline===b||(this._isOnline=b,this._isOnline?await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnOnline):await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnOffline))}async _OnWindowResize(){await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnResize)}_OnSuspend(){this.Trigger(C3.Plugins.Browser.Cnds.OnPageHidden)}_OnResume(){this.Trigger(C3.Plugins.Browser.Cnds.OnPageVisible)}async _OnBackButton(){await this.TriggerAsync(C3.Plugins.Browser.Cnds.OnBackButton)}_OnSWMessage(a){const b=a["type"];"downloading-update"===b?this.Trigger(C3.Plugins.Browser.Cnds.OnUpdateFound):"update-ready"===b||"update-pending"===b?this.Trigger(C3.Plugins.Browser.Cnds.OnUpdateReady):"offline-ready"===b&&this.Trigger(C3.Plugins.Browser.Cnds.OnOfflineReady)}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";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(a){const b=this._runtime.GetCanvasManager().GetLastWidth(),c=this._runtime.GetCanvasManager().GetLastHeight(),d=b<=c?0:1;return d===a},OnUpdateFound(){return!0},OnUpdateReady(){return!0},OnOfflineReady(){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 ORIENTATIONS=["portrait","landscape","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];C3.Plugins.Browser.Acts={Alert(a){this.PostToDOM("alert",{"message":a.toString()})},Close(){this._isScirraArcade||(this._runtime.IsDebug()?C3Debugger.CloseWindow():this.PostToDOM("close"))},Focus(){this.PostToDOM("set-focus",{"isFocus":!0})},Blur(){this.PostToDOM("set-focus",{"isFocus":!1})},GoBack(){this._isScirraArcade||this.PostToDOM("navigate",{"type":"back"})},GoForward(){this._isScirraArcade||this.PostToDOM("navigate",{"type":"forward"})},GoHome(){this._isScirraArcade||this.PostToDOM("navigate",{"type":"home"})},Reload(){this._isScirraArcade||this.PostToDOM("navigate",{"type":"reload"})},GoToURL(a,b){this._PostToDOMMaybeSync("navigate",{"type":"url","url":a,"target":b,"exportType":this._runtime.GetExportType()})},GoToURLWindow(a,b){this._PostToDOMMaybeSync("navigate",{"type":"new-window","url":a,"tag":b,"exportType":this._runtime.GetExportType()})},RequestFullScreen(a,b){2<=a&&(a+=1),6===a&&(a=2),1===a&&(a=0);const c=C3.CanvasManager._FullscreenModeNumberToString(a);this._runtime.GetCanvasManager().SetDocumentFullscreenMode(c),this._PostToDOMMaybeSync("request-fullscreen",{"navUI":b})},CancelFullScreen(){this._PostToDOMMaybeSync("exit-fullscreen")},Vibrate(a){const b=a.split(",");for(let c=0,d=b.length;c<d;++c)b[c]=parseInt(b[c],10);this._PostToDOMMaybeSync("vibrate",{"pattern":b})},async InvokeDownload(a,b){if(b){const c=await this._runtime.GetAssetManager().GetProjectFileUrl(a);this._runtime.InvokeDownload(c,b)}},InvokeDownloadString(a,b,c){if(c){const d=`data:${b},${encodeURIComponent(a)}`;this._runtime.InvokeDownload(d,c)}},ConsoleLog(a,b){b=b.toString(),0===a?console.log(b):1===a?console.warn(b):2==a&&console.error(b)},ConsoleGroup(a){console.group(a)},ConsoleGroupEnd(){console.groupEnd()},ExecJs(jsStr){try{eval(jsStr)}catch(a){console.error("Error executing JavaScript: ",a)}},LockOrientation(a){if(a=Math.floor(a),!(0>a||a>=ORIENTATIONS.length)){const b=ORIENTATIONS[a];this._PostToDOMMaybeSync("lock-orientation",{"orientation":b})}},UnlockOrientation(){this._PostToDOMMaybeSync("unlock-orientation")},LoadStyleSheet(a){this._runtime.GetAssetManager().LoadStyleSheet(a)}}}
'use strict';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},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(a){const b=this._runtime.IsInWorker()?new URL(this._initLocationStr).search:location.search,c=RegExp('[?&]'+a+'=([^&]*)').exec(b);return c?decodeURIComponent(c[1].replace(/\+/g,' ')):''},Referrer(){return this._referrer},Title(){return this._docTitle},Language(){return navigator.language},Platform(){return navigator.platform},UserAgent(){return navigator.userAgent},ExecJS(jsStr){let result=0;try{result=eval(jsStr)}catch(a){console.error('Error executing JavaScript: ',a)}return'number'==typeof result||'string'==typeof result?result:'boolean'==typeof result?result?1:0:0},Name(){return navigator.appName},Version(){return navigator.appVersion},Product(){return navigator.product},Vendor(){return navigator.vendor},BatteryLevel(){return 1},BatteryTimeLeft(){return 1/0},Bandwidth(){const a=navigator['connection'];return a?a['downlink']||a['downlinkMax']||a['bandwidth']||1/0:1/0},ConnectionType(){const a=navigator['connection'];return a?a['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";C3.Plugins.Audio=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";{function a(){if(self["C3Audio_DOMInterface"])return self["C3Audio_DOMInterface"];throw new Error("audio scripting API cannot be used here - make sure the project is using DOM mode, not worker mode")}C3.Plugins.Audio.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return IAudioObjectType}},self.IAudioObjectType=class extends IObjectClass{constructor(a){super(a)}get audioContext(){return a().GetAudioContext()}get destinationNode(){return a().GetDestinationNode()}}}
"use strict";{const a=["interactive","balanced","playback"];C3.Plugins.Audio.Instance=class extends C3.SDKInstanceBase{constructor(b,c){super(b,"audio"),this._nextPlayTime=0,this._triggerTag="",this._timeScaleMode=0,this._saveLoadMode=0,this._playInBackground=!1,this._panningModel=1,this._distanceModel=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._preloadTotal=0,this._preloadCount=0;let d="interactive";c&&(this._timeScaleMode=c[0],this._saveLoadMode=c[1],this._playInBackground=c[2],d=a[c[3]],this._panningModel=c[4],this._distanceModel=c[5],this._listenerZ=-c[6],this._referenceDistance=c[7],this._maxDistance=c[8],this._rolloffFactor=c[9]),this._lastAIState=[],this._lastFxState=[],this._lastAnalysersData=[],this.AddDOMMessageHandlers([["state",(a)=>this._OnUpdateState(a)],["fxstate",(a)=>this._OnUpdateFxState(a)],["trigger",(a)=>this._OnTrigger(a)]]);const e=this.GetRuntime().Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(e,"instancedestroy",(a)=>this._OnInstanceDestroyed(a.instance)),C3.Disposable.From(e,"afterload",()=>this._OnAfterLoad()),C3.Disposable.From(e,"suspend",()=>this._OnSuspend()),C3.Disposable.From(e,"resume",()=>this._OnResume())),this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",{"preloadList":this._runtime.GetAssetManager().GetAudioToPreload().map((a)=>({"originalUrl":a.originalUrl,"url":a.url,"type":a.type,"fileSize":a.fileSize})),"isiOSCordova":this._runtime.IsiOSCordova(),"timeScaleMode":this._timeScaleMode,"latencyHint":d,"panningModel":this._panningModel,"distanceModel":this._distanceModel,"refDistance":this._referenceDistance,"maxDistance":this._maxDistance,"rolloffFactor":this._rolloffFactor,"listenerPos":[this._listenerX,this._listenerY,this._listenerZ]}).then((a)=>{this._sampleRate=a["sampleRate"]})),this._StartTicking()}Release(){this._listenerInst=null,super.Release()}_OnInstanceDestroyed(a){this._listenerInst===a&&(this._listenerInst=null)}DbToLinearNoCap(a){return Math.pow(10,a/20)}DbToLinear(a){const b=this.DbToLinearNoCap(a);return isFinite(b)?Math.max(Math.min(b,1),0):0}LinearToDbNoCap(a){return 20*(Math.log(a)/2.302585092994046)}LinearToDb(a){return this.LinearToDbNoCap(Math.max(Math.min(a,1),0))}_OnSuspend(){this._playInBackground||this.PostToDOM("set-suspended",{"isSuspended":!0})}_OnResume(){this._playInBackground||this.PostToDOM("set-suspended",{"isSuspended":!1})}_OnUpdateState(a){const b=a["tickCount"],c=this._lastAIState.filter((a)=>a.hasOwnProperty("placeholder")&&(a["placeholder"]>b||-1===a["placeholder"]));this._lastAIState=a["audioInstances"],this._lastAnalysersData=a["analysers"],0<c.length&&C3.appendArray(this._lastAIState,c)}_OnUpdateFxState(a){this._lastFxState=a["fxstate"]}_GetFirstAudioStateByTag(b){for(const c of this._lastAIState)if(C3.equalsNoCase(c["tag"],b))return c;return null}_IsTagPlaying(a){return this._lastAIState.some((b)=>C3.equalsNoCase(a,b["tag"])&&b["isPlaying"])}_MaybeMarkAsPlaying(a,b,c,d){if(this._IsTagPlaying(a))return null;const e={"tag":a,"duration":0,"volume":d,"isPlaying":!0,"playbackTime":0,"playbackRate":1,"uid":-1,"bufferOriginalUrl":"","bufferUrl":"","bufferType":"","isMusic":b,"isLooping":c,"isMuted":!1,"resumePosition":0,"pan":null,"placeholder":-1};return this._lastAIState.push(e),e}async _OnTrigger(a){const b=a["type"];this._triggerTag=a["tag"];const c=a["aiid"];if("ended"===b){for(const a of this._lastAIState)if(a["aiid"]===c){a["isPlaying"]=!1;break}await this.TriggerAsync(C3.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"===b&&(await this.TriggerAsync(C3.Plugins.Audio.Cnds.OnFadeEnded))}Tick(){const a={"timeScale":this._runtime.GetTimeScale(),"gameTime":this._runtime.GetGameTime(),"instPans":this.GetInstancePans(),"tickCount":this._runtime.GetTickCountNoSave()};if(this._listenerInst){const b=this._listenerInst.GetWorldInfo();this._listenerX=b.GetX(),this._listenerY=b.GetY(),a["listenerPos"]=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(b,c,d,a,e){if(0===d)return[b,c];const f=Math.sin(d),g=Math.cos(d);b-=a,c-=e;const h=b*f,i=c*f,j=b*g,k=c*g;return b=j-i,c=k+h,b+=a,c+=e,[b,c]}GetInstancePans(){return this._lastAIState.filter((a)=>-1!==a["uid"]).map((a)=>this._runtime.GetInstanceByUID(a["uid"])).filter((a)=>a).map((a)=>{const b=a.GetWorldInfo(),c=b.GetLayer().GetAngle(),[d,e]=this.rotatePtAround(b.GetX(),b.GetY(),-c,this._listenerX,this._listenerY);return{"uid":a.GetUID(),"x":d,"y":e,"angle":b.GetAngle()-c}})}GetAnalyserData(a,b){for(const c of this._lastAnalysersData)if(c.index===b&&C3.equalsNoCase(c.tag,a))return c;return null}_IncrementEffectCount(a){this._effectCount.set(a,(this._effectCount.get(a)||0)+1)}_ShouldSave(a){return!a.hasOwnProperty("placeholder")&&3!==this._saveLoadMode&&!(a["isMusic"]&&1===this._saveLoadMode)&&!!(a["isMusic"]||2!==this._saveLoadMode)}SaveToJson(){return{"isSilent":this._isSilent,"masterVolume":this._masterVolume,"listenerZ":this._listenerZ,"listenerUid":this._listenerInst?this._listenerInst.GetUID():-1,"playing":this._lastAIState.filter((a)=>this._ShouldSave(a)),"effects":this._lastFxState,"analysers":this._lastAnalysersData}}LoadFromJson(a){this._isSilent=a["isSilent"],this._masterVolume=a["masterVolume"],this._listenerZ=a["listenerZ"],this._listenerInst=null,this._loadListenerUid=a["listenerUid"],this._lastAIState=a["playing"],this._lastFxState=a["effects"],this._lastAnalysersData=a["analysers"]}_OnAfterLoad(){if(-1!==this._loadListenerUid&&(this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid),this._loadListenerUid=-1,this._listenerInst)){const a=this._listenerInst.GetWorldInfo();this._listenerX=a.GetX(),this._listenerY=a.GetY()}for(const a of this._lastAIState){const b=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a["bufferOriginalUrl"]);b?(a["bufferUrl"]=b.url,a["bufferType"]=b.type):a["bufferUrl"]=null}for(const a of Object.values(this._lastFxState))for(const b of a)if(b.hasOwnProperty("bufferOriginalUrl")){const a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b["bufferOriginalUrl"]);a&&(b["bufferUrl"]=a.url,b["bufferType"]=a.type)}this.PostToDOM("load-state",{"saveLoadMode":this._saveLoadMode,"timeScale":this._runtime.GetTimeScale(),"gameTime":this._runtime.GetGameTime(),"listenerPos":[this._listenerX,this._listenerY,this._listenerZ],"isSilent":this._isSilent,"masterVolume":this._masterVolume,"playing":this._lastAIState.filter((a)=>null!==a["bufferUrl"]),"effects":this._lastFxState})}GetDebuggerProperties(){var a=Math.round;const b=[];for(const[a,c]of Object.entries(this._lastFxState))b.push({name:"$"+a,value:c.map((a)=>a["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((b,c)=>({name:"$#"+c,value:`${b["bufferOriginalUrl"]} ("${b["tag"]}") ${a(10*b["playbackTime"])/10} / ${a(10*b["duration"])/10}`}))]}]}}}
"use strict";C3.Plugins.Audio.Cnds={OnEnded(a){return C3.equalsNoCase(this._triggerTag,a)},OnFadeEnded(a){return C3.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 a=["lowpass","highpass","bandpass","lowshelf","highshelf","peaking","notch","allpass"];C3.Plugins.Audio.Acts={async Play(a,b,c,d){if(!this._isSilent){const e=a[1],f=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(f){const g=this._nextPlayTime;this._nextPlayTime=0;const h=this._MaybeMarkAsPlaying(d.toLowerCase(),e,0!==b,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{"originalUrl":a[0],"url":f.url,"type":f.type,"isMusic":e,"tag":d.toLowerCase(),"isLooping":0!==b,"vol":this.DbToLinear(c),"pos":0,"off":g,"trueClock":!!self["C3_GetAudioContextCurrentTime"]})}finally{h&&(h["placeholder"]=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,b,c,d,e,f,g,h,i,j){if(!this._isSilent){const k=a[1],l=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(l){const m=this._nextPlayTime;this._nextPlayTime=0;const n=this._MaybeMarkAsPlaying(j.toLowerCase(),k,0!==b,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{"originalUrl":a[0],"url":l.url,"type":l.type,"isMusic":k,"tag":j.toLowerCase(),"isLooping":0!==b,"vol":this.DbToLinear(c),"pos":0,"off":m,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":d,"y":e,"angle":C3.toRadians(f),"innerAngle":C3.toRadians(g),"outerAngle":C3.toRadians(h),"outerGain":this.DbToLinear(i)}})}finally{n&&(n["placeholder"]=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,b,c,d,e,f,g,h){if(!this._isSilent&&d){const i=d.GetFirstPicked();if(i&&i.GetWorldInfo()){const d=i.GetWorldInfo(),j=d.GetLayer().GetAngle(),[k,l]=this.rotatePtAround(d.GetX(),d.GetY(),-j,this._listenerX,this._listenerY),m=a[1],n=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(n){const o=this._nextPlayTime;this._nextPlayTime=0;const p=this._MaybeMarkAsPlaying(h.toLowerCase(),m,0!==b,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{"originalUrl":a[0],"url":n.url,"type":n.type,"isMusic":m,"tag":h.toLowerCase(),"isLooping":0!==b,"vol":this.DbToLinear(c),"pos":0,"off":o,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":k,"y":l,"angle":d.GetAngle()-j,"innerAngle":C3.toRadians(e),"outerAngle":C3.toRadians(f),"outerGain":this.DbToLinear(g),"uid":i.GetUID()}})}finally{p&&(p["placeholder"]=this._runtime.GetTickCountNoSave())}}}}},async PlayByName(a,b,c,d,e){if(!this._isSilent){const f=1===a,g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);if(g){const a=this._nextPlayTime;this._nextPlayTime=0;const h=this._MaybeMarkAsPlaying(e.toLowerCase(),f,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{"originalUrl":b,"url":g.url,"type":g.type,"isMusic":f,"tag":e.toLowerCase(),"isLooping":0!==c,"vol":this.DbToLinear(d),"pos":0,"off":a,"trueClock":!!self["C3_GetAudioContextCurrentTime"]})}finally{h&&(h["placeholder"]=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,b,c,d,e,f,g,h,i,j,k){if(!this._isSilent){const l=1===a,m=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);if(m){const a=this._nextPlayTime;this._nextPlayTime=0;const n=this._MaybeMarkAsPlaying(k.toLowerCase(),l,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{"originalUrl":b,"url":m.url,"type":m.type,"isMusic":l,"tag":k.toLowerCase(),"isLooping":0!==c,"vol":this.DbToLinear(d),"pos":0,"off":a,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":e,"y":f,"angle":C3.toRadians(g),"innerAngle":C3.toRadians(h),"outerAngle":C3.toRadians(i),"outerGain":this.DbToLinear(j)}})}finally{n&&(n["placeholder"]=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,b,c,d,e,f,g,h,i){if(!this._isSilent&&!this._isSilent&&e){const j=e.GetFirstPicked();if(j&&j.GetWorldInfo()){const e=j.GetWorldInfo(),k=e.GetLayer().GetAngle(),[l,m]=this.rotatePtAround(e.GetX(),e.GetY(),-k,this._listenerX,this._listenerY),n=1===a,o=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);if(o){const a=this._nextPlayTime;this._nextPlayTime=0;const p=this._MaybeMarkAsPlaying(i.toLowerCase(),n,0!==c,this.DbToLinear(d));try{await this.PostToDOMAsync("play",{"originalUrl":b,"url":o.url,"type":o.type,"isMusic":n,"tag":i.toLowerCase(),"isLooping":0!==c,"vol":this.DbToLinear(d),"pos":0,"off":a,"trueClock":!!self["C3_GetAudioContextCurrentTime"],"panning":{"x":l,"y":m,"angle":e.GetAngle()-k,"innerAngle":C3.toRadians(f),"outerAngle":C3.toRadians(g),"outerGain":this.DbToLinear(h),"uid":j.GetUID()}})}finally{p&&(p["placeholder"]=this._runtime.GetTickCountNoSave())}}}}},SetLooping(a,b){this.PostToDOM("set-looping",{"tag":a.toLowerCase(),"isLooping":0===b})},SetMuted(a,b){this.PostToDOM("set-muted",{"tag":a.toLowerCase(),"isMuted":0===b})},SetVolume(a,b){this.PostToDOM("set-volume",{"tag":a.toLowerCase(),"vol":this.DbToLinear(b)})},FadeVolume(a,b,c,d){this.PostToDOM("fade-volume",{"tag":a.toLowerCase(),"vol":this.DbToLinear(b),"duration":c,"stopOnEnd":0===d})},async Preload(a){const b=a[1],c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{"originalUrl":a[0],"url":c.url,"type":c.type,"isMusic":b}),this._preloadCount++)},async PreloadByName(a,b){const c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{"originalUrl":b,"url":c.url,"type":c.type,"isMusic":1===a}),this._preloadCount++)},SetPlaybackRate(a,b){this.PostToDOM("set-playback-rate",{"tag":a.toLowerCase(),"rate":Math.max(b,0)})},Stop(a){this.PostToDOM("stop",{"tag":a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,b){this.PostToDOM("set-paused",{"tag":a.toLowerCase(),"paused":0===b})},Seek(a,b){this.PostToDOM("seek",{"tag":a.toLowerCase(),"pos":b})},SetSilent(a){2===a&&(a=this._isSilent?1:0),a=0===a;this._isSilent===a||(this._isSilent=a,this.PostToDOM("set-silent",{"isSilent":a}))},SetMasterVolume(a){const b=this.DbToLinear(a);this._masterVolume===b||(this._masterVolume=b,this.PostToDOM("set-master-volume",{"vol":b}))},AddFilterEffect(b,c,d,e,f,g,h){b=b.toLowerCase();const i=a[c];this._IncrementEffectCount(b),this.PostToDOM("add-effect",{"type":"filter","tag":b,"params":[i,d,e,f,g,C3.clamp(h/100,0,1)]})},AddDelayEffect(a,b,c,d){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"delay","tag":a,"params":[b,this.DbToLinear(c),C3.clamp(d/100,0,1)]})},AddFlangerEffect(a,b,c,d,e,f){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"flanger","tag":a,"params":[b/1e3,c/1e3,d,e/100,C3.clamp(f/100,0,1)]})},AddPhaserEffect(a,b,c,d,e,f,g){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"phaser","tag":a,"params":[b,c,d,e,f,C3.clamp(g/100,0,1)]})},AddConvolutionEffect(a,b,c,d){a=a.toLowerCase();const e=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b[0]);e&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"convolution","tag":a,"bufferOriginalUrl":b[0],"bufferUrl":e.url,"bufferType":e.type,"params":[0===c,C3.clamp(d/100,0,1)]}))},AddGainEffect(a,b){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"gain","tag":a,"params":[this.DbToLinear(b)]})},AddMuteEffect(a){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"gain","tag":a,"params":[0]})},AddTremoloEffect(a,b,c){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"tremolo","tag":a,"params":[b,C3.clamp(c/100,0,1)]})},AddRingModEffect(a,b,c){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"ringmod","tag":a,"params":[b,C3.clamp(c/100,0,1)]})},AddDistortionEffect(a,b,c,d,e,f){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"distortion","tag":a,"params":[this.DbToLinearNoCap(b),this.DbToLinearNoCap(c),d,this.DbToLinearNoCap(e),C3.clamp(f/100,0,1)]})},AddCompressorEffect(a,b,c,d,e,f){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"compressor","tag":a,"params":[b,c,d,e/1e3,f/1e3]})},AddAnalyserEffect(a,b,c){a=a.toLowerCase(),this._IncrementEffectCount(a),this.PostToDOM("add-effect",{"type":"analyser","tag":a,"params":[b,c]})},RemoveEffects(a){a=a.toLowerCase(),this._effectCount.set(a,0),this.PostToDOM("remove-effects",{"tag":a}),this._lastFxState={}},SetEffectParameter(a,b,c,d,e,f){this.PostToDOM("set-effect-param",{"tag":a.toLowerCase(),"index":Math.floor(b),"param":c,"value":d,"ramp":e,"time":f})},SetListenerObject(a){if(a){const b=a.GetFirstPicked();b&&b.GetWorldInfo()&&(this._listenerInst=b)}},SetListenerZ(a){this._listenerZ=a},ScheduleNextPlay(a){this._nextPlayTime=Math.max(a,0)},UnloadAudio(a){const b=a[1],c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);c&&this.PostToDOM("unload",{"url":c.url,"type":c.type,"isMusic":b})},UnloadAudioByName(a,b){const c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(b);c&&this.PostToDOM("unload",{"url":c.url,"type":c.type,"isMusic":1===a})},UnloadAll(){this.PostToDOM("unload-all")}}}
"use strict";C3.Plugins.Audio.Exps={Duration(b){const c=this._GetFirstAudioStateByTag(b);return c?c["duration"]:0},PlaybackTime(b){const c=this._GetFirstAudioStateByTag(b);return c?c["playbackTime"]:0},PlaybackRate(b){const c=this._GetFirstAudioStateByTag(b);return c?c["playbackRate"]:0},Volume(b){const c=this._GetFirstAudioStateByTag(b);return c?this.LinearToDb(c["volume"]):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(a){return this._effectCount.get(a.toLowerCase())||0},AnalyserFreqBinCount(a,b){const c=this.GetAnalyserData(a,Math.floor(b));return c?c["binCount"]:0},AnalyserFreqBinAt(a,b,c){var d=Math.floor;const e=this.GetAnalyserData(a,d(b));return e?(c=d(c),0>c||c>=e["binCount"]?0:e["freqBins"][c]):0},AnalyserPeakLevel(a,b){const c=this.GetAnalyserData(a,Math.floor(b));return c?c["peak"]:0},AnalyserRMSLevel(a,b){const c=this.GetAnalyserData(a,Math.floor(b));return c?c["rms"]:0},SampleRate(){return this._sampleRate},CurrentTime(){return self["C3_GetAudioContextCurrentTime"]?self["C3_GetAudioContextCurrentTime"]():performance.now()/1e3}};
"use strict";
var CMath = {};
// Lerp function
CMath.lerp = function(a, b, x)
{
return a + (b - a) * x;
};
// Cubic function
CMath.cubic = function(a, b, c, d, x)
{
return this.lerp(this.lerp(this.lerp(a, b, x), this.lerp(b, c, x), x), this.lerp(this.lerp(b, c, x), this.lerp(c, d, x), x), x);
}
// Clamp function
CMath.clamp = function(x, min, max)
{
if (x < min)
{
return min;
}
else if (x > max)
{
return max;
}
return x;
};
// Transition class
function Transition(Type, Duration, Param1, Param2, Param3, Param4)
{
// Standard properties
this.type = Type;
this.duration = Duration;
this.param1 = Param1;
this.param2 = Param2;
this.param3 = Param3;
this.param4 = Param4;
// Working values
this.progress = 0;
}
// Camera class or something
function Camera(Name, X, Y, Scale, Global)
{
// Standard properties
this.global = Global;
this.name = Name;
this.x = X;
this.y = Y;
this.scale = Scale;
// Following
this.following = false;
this.followedObjects = [];
this.followedObjectUIDs = [];
this.objectWeights = [];
this.followedObjectIPs = [];
this.followLag = 1;
// Zoom to contain
this.zoomToContain = false;
this.zoomMarginH = 0;
this.zoomMarginV = 0;
this.zoomBoundU = -1;
this.zoomBoundL = -1;
// Camera transitions
this.transitions = [];
this.moveTransFinished = false;
this.zoomTransFinished = false;
// Camera shake
this.isShaking = false;
this.shakeX = 0;
this.shakeY = 0;
this.shakeZoom = 0;
this.shakeTimer = 0;
this.shakeStrength = 0;
this.shakeMaxDeviation = 0;
this.shakeMaxZoomDeviation = 0;
this.shakeLength = 0;
this.shakeBuildTime = 0;
this.shakeDropTime = 0;
}
Camera.prototype.GetName = function()
{
return this.name;
};
Camera.prototype.GetX = function()
{
return this.x;
};
Camera.prototype.SetX = function(value)
{
this.x = value;
};
Camera.prototype.GetY = function()
{
return this.y;
};
Camera.prototype.SetY = function(value)
{
this.y = value;
};
Camera.prototype.GetShakeX = function()
{
return this.shakeX;
};
Camera.prototype.GetShakeY = function()
{
return this.shakeY;
};
Camera.prototype.SetFollowedObject = function(fObject)
{
this.followedObject = fObject;
};
Camera.prototype.ShakeCamera = function(dt)
{
// Check if the camera should be shaking
if (this.isShaking)
{
this.shakeTimer += dt;
if (this.shakeTimer < this.shakeLength)
{
var shakeStrength = 0;
if (this.shakeTimer < this.shakeBuildTime)
{
shakeStrength = CMath.lerp(0, this.shakeStrength, this.shakeTimer / this.shakeBuildTime);
}
else
{
shakeStrength = this.shakeStrength;
}
if (this.shakeTimer > this.shakeDropTime)
{
shakeStrength = CMath.lerp(this.shakeStrength, 0, (this.shakeTimer - this.shakeDropTime) / (this.shakeLength - this.shakeDropTime));
}
var shakeAngle = Math.floor(Math.random() * 361) / 57.2958;
var shakeX = CMath.lerp(0, Math.cos(shakeAngle) * this.shakeMaxDeviation, shakeStrength);
var shakeY = CMath.lerp(0, Math.sin(shakeAngle) * this.shakeMaxDeviation, shakeStrength);
var shakeZoom = CMath.lerp(0, (Math.floor(Math.random() * 201 - 100) / 100) * this.shakeMaxZoomDeviation, shakeStrength);
this.shakeX = CMath.lerp(this.shakeX, shakeX, shakeStrength);
this.shakeY = CMath.lerp(this.shakeY, shakeY, shakeStrength);
this.shakeZoom = CMath.lerp(this.shakeZoom, shakeZoom, shakeStrength);
}
else
{
this.isShaking = false;
this.shakeX = 0;
this.shakeY = 0;
this.shakeZoom = 0;
}
}
}
Camera.prototype.ProcessTransitions = function(dt)
{
// Reset the transition finished values
this.moveTransFinished = false;
this.zoomTransFinished = false;
// Temporary value
var transition;
// Camera transitions
for (var i = 0; i < this.transitions.length;)
{
transition = this.transitions[i];
transition.progress = CMath.clamp(transition.progress + (1.0 / transition.duration * dt), 0.0, 1.0);
if (transition.type == "MOVE")
{
this.x = CMath.cubic(transition.param3, transition.param3, transition.param1, transition.param1, transition.progress);
this.y = CMath.cubic(transition.param4, transition.param4, transition.param2, transition.param2, transition.progress);
}
else if (transition.type == "SCALE")
{
this.scale = CMath.cubic(transition.param2, transition.param2, transition.param1, transition.param1, transition.progress);
}
if (transition.progress == 1)
{
// Check the transition type and mark it as finished
if (transition.type == "MOVE")
{
this.moveTransFinished = true;
}
else if (transition.type == "SCALE")
{
this.zoomTransFinished = true;
}
this.transitions.splice(i, 1);
}
else
{
i++;
}
}
};
Camera.prototype.UpdateCameraTarget = function(dt, targetCamera)
{
// Update the transition stuff
for (var i = 0; i < this.transitions.length; i++)
{
var transition = this.transitions[i];
if (transition.type == "MOVE")
{
transition.param1 = targetCamera.GetX();
transition.param2 = targetCamera.GetY();
}
else if (transition.type == "SCALE")
{
transition.param1 = targetCamera.scale;
}
}
};
Camera.prototype.ProcessFollowing = function(dt, screenWidth, screenHeight, layout)
{
// Followed objects
var followed = this.followedObjects;
var followedObjectIPs = this.followedObjectIPs;
// Object following
if (this.following && followed.length > 0)
{
// Temporary position
var tempX = 0,
tempY = 0,
tempScale = 0;
// Perform a weighted follow if the camera is not set to zoom to contain
if (!this.zoomToContain)
{
var sumX = 0,
sumY = 0,
sumW = 0;
for (var i = 0; i < followed.length; i++)
{
sumX += followed[i].GetImagePoint(followedObjectIPs[i], true)[0] * this.objectWeights[i];
sumY += followed[i].GetImagePoint(followedObjectIPs[i], false)[1] * this.objectWeights[i];
sumW += this.objectWeights[i];
}
// Set the temporary position
tempX = sumX / sumW;
tempY = sumY / sumW;
}
else
{
var minX = 0,
maxX = 0,
minY = 0,
maxY = 0;
var minXChanged = false,
maxXChanged = false,
minYChanged = false,
maxYChanged = false;
for (var i = 0; i < followed.length; i++)
{
var fObject = followed[i];
fObject.GetWorldInfo()._UpdateBbox();
if (minXChanged)
{
minX = Math.min(minX, fObject.GetWorldInfo().GetBoundingBox().getLeft());
}
else
{
minX = fObject.GetWorldInfo().GetBoundingBox().getRight();
minXChanged = true;
}
if (maxXChanged)
{
maxX = Math.max(maxX, fObject.GetWorldInfo().GetBoundingBox().getRight());
}
else
{
maxX = fObject.GetWorldInfo().GetBoundingBox().getRight();
maxXChanged = true;
}
if (minYChanged)
{
minY = Math.min(minY, fObject.GetWorldInfo().GetBoundingBox().getTop());
}
else
{
minY = fObject.GetWorldInfo().GetBoundingBox().getTop();
minYChanged = true;
}
if (maxYChanged)
{
maxY = Math.max(maxY, fObject.GetWorldInfo().GetBoundingBox().getBottom());
}
else
{
maxY = fObject.GetWorldInfo().GetBoundingBox().getBottom();
maxYChanged = true;
}
}
// Zoom
var tempXScale = (screenWidth - this.zoomMarginH * 2) / (maxX - minX);
var tempYScale = (screenHeight - this.zoomMarginV * 2) / (maxY - minY);
// Scroll to the middle
tempX = CMath.lerp(minX, maxX, 0.5);
tempY = CMath.lerp(minY, maxY, 0.5);
// Check if the view is going over the layout bound
if (this.x < ((screenWidth / 2) / tempXScale))
{
tempXScale = (screenWidth - this.zoomMarginH) / maxX;
tempX = (screenWidth / tempXScale) / 2;
}
if (this.x > (layout.GetWidth() - (screenWidth / 2) / tempXScale))
{
tempXScale = (screenWidth - this.zoomMarginH) / (layout.GetWidth() - minX);
tempX = layout.GetWidth() - (screenWidth / tempXScale) / 2;
}
// Check if the view is going over the layout bound
if (this.y < ((screenHeight / 2) / tempYScale))
{
tempYScale = (screenHeight - this.zoomMarginV) / maxY;
tempY = (screenHeight / tempYScale) / 2;
}
if (this.y > (layout.GetHeight() - (screenHeight / 2) / tempYScale))
{
tempYScale = (screenHeight - this.zoomMarginV) / (layout.GetHeight() - minY);
tempY = layout.GetHeight() - (screenHeight / tempYScale) / 2;
}
// Set the calculated temp scale
tempScale = Math.min(tempXScale, tempYScale);
// Ensure that tempScale is bounded properly
if (this.zoomBoundL != -1)
{
if (tempScale < this.zoomBoundL)
{
tempScale = this.zoomBoundL;
}
}
if (this.zoomBoundU != -1)
{
if (tempScale > this.zoomBoundU)
{
tempScale = this.zoomBoundU;
}
}
}
// Scroll
if (this.followLag == 1)
{
this.x = tempX;
this.y = tempY;
// Scale if zoom to contain is enabled
if (this.zoomToContain)
{
this.scale = tempScale;
}
}
else
{
var lag = (this.followLag * 4.0 * dt) * Math.sqrt(1.0 / dt);
this.x = CMath.lerp(this.x, tempX, lag);
this.y = CMath.lerp(this.y, tempY, lag);
// Scale if zoom to contain is enabled
if (this.zoomToContain)
{
this.scale = CMath.lerp(this.scale, tempScale, lag);
}
}
}
};
{
C3.Plugins.MagiCam = class MagiCamPlugin extends C3.SDKPluginBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.MagiCam.Type = class MagiCamType extends C3.SDKTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{}
};
}
"use strict";
{
C3.Plugins.MagiCam.Instance = class MagiCamInstance extends C3.SDKWorldInstanceBase //SDKInstanceBase
{
constructor(inst, properties)
{
super(inst);
const b = this._runtime.Dispatcher();
this._disposables = new C3.CompositeDisposable(C3.Disposable.From(b, "layoutchange", () => this._OnLayoutChange()), C3.Disposable.From(b, "afterload", () => this._OnAfterLoad()))
// Initialise object properties
// Local cameras
this.localCameras = [];
this.localCameraCount = 0;
this.localCameraCountOld = 0;
// Transition cameras
this.transCamera = null;
this.transTarget = null;
this.isSwitchingCameras = false;
// Global cameras
this.globalCameras = [];
// Active camera
this.activeCamera = null;
//this._runtime.tickMe(this);
if (properties) // note properties may be null in some cases
{
}
this._inst.GetTimeScale();
this._StartTicking();
}
Release()
{
super.Release();
}
SaveToJson()
{
// Throw the trans camera on top of local cameras list
if (null != this.transCamera)
{
this.localCameras.push(this.transCamera);
}
var o = {
"lcc": this.localCameraCount,
"olcc": this.localCameraCountOld,
"alcc": this.localCameras.length,
"agcc": this.globalCameras.length,
"tcnn": (this.transCamera == null ? false : true)
};
for (var i = 0; i < this.localCameras.length; i++)
{
o["lc" + i + "g"] = this.localCameras[i].global;
o["lc" + i + "n"] = this.localCameras[i].name;
o["lc" + i + "x"] = this.localCameras[i].x;
o["lc" + i + "y"] = this.localCameras[i].y;
o["lc" + i + "s"] = this.localCameras[i].scale;
o["lc" + i + "f"] = this.localCameras[i].following;
o["lc" + i + "foc"] = this.localCameras[i].followedObjects.length;
for (var f = 0; f < this.localCameras[i].followedObjects.length; f++)
{
o["lc" + i + "fo" + f] = this.localCameras[i].followedObjects[f].GetUID();
}
for (var w = 0; w < this.localCameras[i].objectWeights.length; w++)
{
o["lc" + i + "fow" + w] = this.localCameras[i].objectWeights[w];
}
for (var ip = 0; ip < this.localCameras[i].followedObjectIPs.length; ip++)
{
o["lc" + i + "foip" + ip] = this.localCameras[i].followedObjectIPs[ip];
}
o["lc" + i + "fl"] = this.localCameras[i].followLag;
o["lc" + i + "ztc"] = this.localCameras[i].zoomToContain;
o["lc" + i + "zmh"] = this.localCameras[i].zoomMarginH;
o["lc" + i + "zmv"] = this.localCameras[i].zoomMarginV;
o["lc" + i + "zbu"] = this.localCameras[i].zoomBoundU;
o["lc" + i + "zbl"] = this.localCameras[i].zoomBoundL;
o["lc" + i + "tc"] = this.localCameras[i].transitions.length;
for (var t = 0; t < this.localCameras[i].transitions.length; t++)
{
o["lc" + i + "t" + t + "tp"] = this.localCameras[i].transitions[t].type;
o["lc" + i + "t" + t + "d"] = this.localCameras[i].transitions[t].duration;
o["lc" + i + "t" + t + "p1"] = this.localCameras[i].transitions[t].param1;
o["lc" + i + "t" + t + "p2"] = this.localCameras[i].transitions[t].param2;
o["lc" + i + "t" + t + "p3"] = this.localCameras[i].transitions[t].param3;
o["lc" + i + "t" + t + "p4"] = this.localCameras[i].transitions[t].param4;
o["lc" + i + "t" + t + "pr"] = this.localCameras[i].transitions[t].progress;
}
o["lc" + i + "mtf"] = this.localCameras[i].moveTransFinished;
o["lc" + i + "ztf"] = this.localCameras[i].zoomTransFinished;
o["lc" + i + "csis"] = this.localCameras[i].isShaking;
o["lc" + i + "cssx"] = this.localCameras[i].shakeX;
o["lc" + i + "cssy"] = this.localCameras[i].shakeY;
o["lc" + i + "cssz"] = this.localCameras[i].shakeZoom;
o["lc" + i + "csst"] = this.localCameras[i].shakeTimer;
o["lc" + i + "csss"] = this.localCameras[i].shakeStrength;
o["lc" + i + "cssmd"] = this.localCameras[i].shakeMaxDeviation;
o["lc" + i + "cssmzd"] = this.localCameras[i].shakeMaxZoomDeviation;
o["lc" + i + "cssl"] = this.localCameras[i].shakeLength;
o["lc" + i + "cssbt"] = this.localCameras[i].shakeBuildTime;
o["lc" + i + "cssdt"] = this.localCameras[i].shakeDropTime;
}
for (var i = 0; i < this.globalCameras.length; i++)
{
o["gc" + i + "g"] = this.globalCameras[i].global;
o["gc" + i + "n"] = this.globalCameras[i].name;
o["gc" + i + "x"] = this.globalCameras[i].x;
o["gc" + i + "y"] = this.globalCameras[i].y;
o["gc" + i + "s"] = this.globalCameras[i].scale;
o["gc" + i + "f"] = this.globalCameras[i].following;
o["gc" + i + "foc"] = this.globalCameras[i].followedObjects.length;
for (var f = 0; f < this.globalCameras[i].followedObjects.length; f++)
{
o["gc" + i + "fo" + f] = this.globalCameras[i].followedObjects[f].GetUID();
}
for (var w = 0; w < this.globalCameras[i].objectWeights.length; w++)
{
o["gc" + i + "fow" + w] = this.globalCameras[i].objectWeights[w];
}
for (var ip = 0; ip < this.globalCameras[i].followedObjectIPs.length; ip++)
{
o["gc" + i + "foip" + ip] = this.globalCameras[i].followedObjectIPs[ip];
}
o["gc" + i + "fl"] = this.globalCameras[i].followLag;
o["gc" + i + "ztc"] = this.globalCameras[i].zoomToContain;
o["gc" + i + "zmh"] = this.globalCameras[i].zoomMarginH;
o["gc" + i + "zmv"] = this.globalCameras[i].zoomMarginV;
o["gc" + i + "zbu"] = this.globalCameras[i].zoomBoundU;
o["gc" + i + "zbl"] = this.globalCameras[i].zoomBoundL;
o["gc" + i + "tc"] = this.globalCameras[i].transitions.length;
for (var t = 0; t < this.globalCameras[i].transitions.length; t++)
{
o["gc" + i + "t" + t + "tp"] = this.globalCameras[i].transitions[t].type;
o["gc" + i + "t" + t + "d"] = this.globalCameras[i].transitions[t].duration;
o["gc" + i + "t" + t + "p1"] = this.globalCameras[i].transitions[t].param1;
o["gc" + i + "t" + t + "p2"] = this.globalCameras[i].transitions[t].param2;
o["gc" + i + "t" + t + "p3"] = this.globalCameras[i].transitions[t].param3;
o["gc" + i + "t" + t + "p4"] = this.globalCameras[i].transitions[t].param4;
}
o["gc" + i + "mtf"] = this.globalCameras[i].moveTransFinished;
o["gc" + i + "ztf"] = this.globalCameras[i].zoomTransFinished;
o["gc" + i + "csis"] = this.globalCameras[i].isShaking;
o["gc" + i + "cssx"] = this.globalCameras[i].shakeX;
o["gc" + i + "cssy"] = this.globalCameras[i].shakeY;
o["gc" + i + "cssz"] = this.globalCameras[i].shakeZoom;
o["gc" + i + "csst"] = this.globalCameras[i].shakeTimer;
o["gc" + i + "csss"] = this.globalCameras[i].shakeStrength;
o["gc" + i + "cssmd"] = this.globalCameras[i].shakeMaxDeviation;
o["gc" + i + "cssmzd"] = this.globalCameras[i].shakeMaxZoomDeviation;
o["gc" + i + "cssl"] = this.globalCameras[i].shakeLength;
o["gc" + i + "cssbt"] = this.globalCameras[i].shakeBuildTime;
o["gc" + i + "cssdt"] = this.globalCameras[i].shakeDropTime;
}
if (null != this.activeCamera)
{
o["ac"] = this.activeCamera.name;
}
else
{
o["ac"] = "null";
}
if (null != this.transTarget)
{
o["tt"] = this.transTarget.name;
}
return o;
}
LoadFromJson(o)
{
this.localCameras = [];
this.globalCameras = [];
this.localCameraCount = o["lcc"];
this.localCameraCountOld = o["olcc"];
var localCamCount = o["alcc"];
for (var i = 0; i < localCamCount; i++)
{
var tempCam = new Camera("", 0, 0, 0, false);
tempCam.global = o["lc" + i + "g"];
tempCam.name = o["lc" + i + "n"];
tempCam.x = o["lc" + i + "x"];
tempCam.y = o["lc" + i + "y"];
tempCam.scale = o["lc" + i + "s"];
tempCam.following = o["lc" + i + "f"];
var foCount = o["lc" + i + "foc"];
for (var f = 0; f < foCount; f++)
{
tempCam.followedObjectUIDs.push(o["lc" + i + "fo" + f]);
}
for (var w = 0; w < foCount; w++)
{
tempCam.objectWeights.push(o["lc" + i + "fow" + w]);
}
for (var ip = 0; ip < foCount; ip++)
{
tempCam.followedObjectIPs.push(o["lc" + i + "foip" + ip]);
}
tempCam.followLag = o["lc" + i + "fl"];
tempCam.zoomToContain = o["lc" + i + "ztc"];
tempCam.zoomMarginH = o["lc" + i + "zmh"];
tempCam.zoomMarginV = o["lc" + i + "zmv"];
tempCam.zoomBoundU = o["lc" + i + "zbu"];
tempCam.zoomBoundL = o["lc" + i + "zbl"];
var transCount = o["lc" + i + "tc"];
for (var t = 0; t < transCount; t++)
{
var tempTrans = new Transition("", 0, 0, 0, 0);
tempTrans.type = o["lc" + i + "t" + t + "tp"];
tempTrans.duration = o["lc" + i + "t" + t + "d"];
tempTrans.param1 = o["lc" + i + "t" + t + "p1"];
tempTrans.param2 = o["lc" + i + "t" + t + "p2"];
tempTrans.param3 = o["lc" + i + "t" + t + "p3"];
tempTrans.param4 = o["lc" + i + "t" + t + "p4"];
tempTrans.progress = o["lc" + i + "t" + t + "pr"];
tempCam.transitions.push(tempTrans);
}
tempCam.moveTransFinished = o["lc" + i + "mtf"];
tempCam.zoomTransFinished = o["lc" + i + "ztf"];
tempCam.isShaking = o["lc" + i + "csis"];
tempCam.shakeX = o["lc" + i + "cssx"];
tempCam.shakeY = o["lc" + i + "cssy"];
tempCam.shakeZoom = o["lc" + i + "cssz"];
tempCam.shakeTimer = o["lc" + i + "csst"];
tempCam.shakeStrength = o["lc" + i + "csss"];
tempCam.shakeMaxDeviation = o["lc" + i + "cssmd"];
tempCam.shakeMaxZoomDeviation = o["lc" + i + "cssmzd"];
tempCam.shakeLength = o["lc" + i + "cssl"];
tempCam.shakeBuildTime = o["lc" + i + "cssbt"];
tempCam.shakeDropTime = o["lc" + i + "cssdt"];
this.localCameras.push(tempCam);
var activeCam = o["ac"];
if (activeCam == "null")
{
this.activeCamera = null;
}
else
{
this.activeCamera = this.GetCamera(activeCam);
}
var hasTransCam = o["tcnn"];
if (hasTransCam)
{
this.transCamera = this.localCameras.pop();
this.transTarget = this.GetCamera(o["tt"]);
}
}
}
_OnLayoutChange()
{
// Get rid of the old local cameras
for (var i = 0; i < this.localCameraCountOld; i++)
{
this.localCameras.shift();
}
this.localCameraCount -= this.localCameraCountOld;
}
_OnAfterLoad()
{
for (var i = 0; i < this.localCameras.length; i++)
{
for (var o = 0; o < this.localCameras[i].followedObjectUIDs.length; o++)
{
this.localCameras[i].followedObjects.push(this._runtime.GetInstanceByUID(this.localCameras[i].followedObjectUIDs[o]));
}
}
for (var i = 0; i < this.globalCameras.length; i++)
{
for (var o = 0; o < this.globalCameras[i].followedObjectUIDs.length; o++)
{
this.globalCameras[i].followedObjects.push(this._runtime.GetInstanceByUID(this.globalCameras[i].followedObjectUIDs[o]));
}
}
}
GetCamera(Name)
{
// Return the active camera if Name is blank
if (Name == "")
{
return this.activeCamera;
}
// Search through the global cameras first
for (var i = (this.globalCameras.length - 1); i >= 0; i--)
{
if (this.globalCameras[i].GetName() == Name)
{
return this.globalCameras[i];
}
}
// Search through the local cameras second
for (var i = (this.localCameras.length - 1); i >= 0; i--)
{
if (this.localCameras[i].GetName() == Name)
{
return this.localCameras[i];
}
}
return null;
}
Tick()
{
// Update the old camera count
this.localCameraCountOld = this.localCameraCount;
//var dt = this.runtime.getDt(this);
var dt = this._runtime.GetDt(this._inst);
if (dt == 0)
{
dt = 0.1;
}
// Update all of the global cameras
for (var i = 0; i < this.globalCameras.length; i++)
{
this.globalCameras[i].ProcessTransitions(dt);
this.globalCameras[i].ProcessFollowing(dt, this._runtime.GetOriginalViewportWidth(), this._runtime.GetOriginalViewportHeight(), this._runtime.GetMainRunningLayout());
this.globalCameras[i].ShakeCamera(dt);
}
// Update all of the local cameras
for (var i = 0; i < this.localCameras.length; i++)
{
this.localCameras[i].ProcessTransitions(dt);
this.localCameras[i].ProcessFollowing(dt, this._runtime.GetOriginalViewportWidth(), this._runtime.GetOriginalViewportHeight(), this._runtime.GetMainRunningLayout());
this.localCameras[i].ShakeCamera(dt);
}
// Update the transition camera
if (null != this.transCamera)
{
this.transCamera.UpdateCameraTarget(dt, this.transTarget);
this.transCamera.ProcessTransitions(dt);
if (this.transCamera.moveTransFinished)
{
this.activeCamera = this.transTarget;
this.transCamera = null;
}
}
// If there is an active camera, set the scroll and scale values of the layout to match
if (this.activeCamera != null)
{
// Scroll
this._runtime.GetMainRunningLayout().SetScrollX(this.activeCamera.GetX() + this.activeCamera.GetShakeX());
this._runtime.GetMainRunningLayout().SetScrollY(this.activeCamera.GetY() + this.activeCamera.GetShakeY());
// Set the scale
this._runtime.GetMainRunningLayout().SetScale(this.activeCamera.scale + this.activeCamera.shakeZoom);
// Have the layout redrawn
this.GetRuntime().UpdateRender();
}
}
};
}
"use strict";
{
C3.Plugins.MagiCam.Cnds = {
TransitionFinished(CameraName, Transition)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Check the type of transition specified
if (Transition == 0)
{
return camera.moveTransFinished;
}
else if (Transition == 1)
{
return camera.zoomTransFinished;
}
}
// Return false by default
return false;
},
TransitionIsInProgress(CameraName, Transition)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Check if there is a transition of the type specified in progress
for (var i = 0; i < camera.transitions.length; i++)
{
if (camera.transitions[i].type == "MOVE" && Transition == 0)
{
return true;
}
else if (camera.transitions[i].type == "SCALE" && Transition == 1)
{
return true;
}
}
}
// Return false by default
return false;
}
};
}
"use strict";
{
C3.Plugins.MagiCam.Acts = {
FollowObject(CameraName, FollowedObject, ObjectWeight, ImagePoint)
{
// Make sure an object was picked
if (!FollowedObject)
{
return;
}
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Get the first picked instance of the specified object type
var followedObject = FollowedObject.GetFirstPicked();
// Check to ensure that if the camera is global and the object isn't that the object isn't followed
if (camera.global && !FollowedObject.global) // todo fix it
{
alert("MagiCam:\n\nObject not global - global cameras must follow global objects.");
return;
}
// Follow the specified object
camera.followedObjects.push(followedObject);
camera.objectWeights.push(ObjectWeight);
camera.followedObjectIPs.push(ImagePoint);
}
},
SetFollowLag(CameraName, FollowLag)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Set the follow lag for this object
camera.followLag = 1 - FollowLag / 100;
}
},
ZoomToContain(CameraName, Zoom, ZoomMarginH, ZoomMarginV, ZoomBoundU, ZoomBoundL)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Set the zoom value of the camera
if (Zoom == 0)
{
camera.zoomToContain = true;
camera.zoomMarginH = ZoomMarginH;
camera.zoomMarginV = ZoomMarginV;
camera.zoomBoundU = ZoomBoundU;
camera.zoomBoundL = ZoomBoundL;
}
else
{
camera.zoomToContain = false;
}
}
},
EnableFollowing(CameraName, Following)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Set the following state
if (Following == 0)
{
camera.following = true;
}
else
{
camera.following = false;
}
}
},
UnfollowObject(CameraName, FollowedObject)
{
// Make sure an object was picked
if (!FollowedObject)
{
return;
}
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Get the first picked instance of the specified object type
var followedObject = FollowedObject.GetFirstPicked();
// Check if this object is being followed
for (var i = 0; i < camera.followedObjects.length; i++)
{
if (camera.followedObjects[i] == followedObject)
{
// Un-follow
camera.followedObjects.splice(i, 1);
break;
}
}
}
},
CreateLocalCamera(cameraName, cameraX, cameraY, cameraScale, Active)
{
// Make sure that the name isn't blank
if (cameraName == "")
{
alert("Camera name must not be blank.");
return;
}
// Add a new camera to the list
this.localCameras.push(new Camera(cameraName, cameraX, cameraY, cameraScale, false));
this.localCameraCount++;
// Check if the camera should be made active
if (Active == 1)
{
this.activeCamera = this.localCameras[this.localCameras.length - 1];
this._runtime.GetMainRunningLayout().SetScale(this.activeCamera.scale);
}
else
{
var x = this.localCameras[this.localCameras.length - 1];
}
},
CreateGlobalCamera(cameraName, cameraX, cameraY, cameraScale, Active)
{
// Make sure that the name isn't blank
if (cameraName == "")
{
alert("Camera name must not be blank.");
return;
}
else if (this.GetCamera(cameraName) != null)
{
return;
}
// Add a new camera to the list
this.globalCameras.push(new Camera(cameraName, cameraX, cameraY, cameraScale, true));
// Check if the camera should be made active
if (Active == 1)
{
this.activeCamera = this.globalCameras[this.globalCameras.length - 1];
this._runtime.GetMainRunningLayout().SetScrollX(this.activeCamera.GetX());
this._runtime.GetMainRunningLayout().SetScrollY(this.activeCamera.GetY());
this._runtime.GetMainRunningLayout().SetScale(this.activeCamera.scale);
}
},
SetActiveCamera(CameraName)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Set the new active camera
this.activeCamera = camera;
// Setup the layout to match
this._runtime.GetMainRunningLayout().SetScrollX(camera.GetX());
this._runtime.GetMainRunningLayout().SetScrollY(camera.GetY());
this._runtime.GetMainRunningLayout().SetScale(camera.scale);
}
},
SetScrollSmoothing(CameraName)
{},
SetXPosition(CameraName, X)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Set the camera position
camera.SetX(X);
}
},
SetYPosition(CameraName, Y)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Set the camera position
camera.SetY(Y);
}
},
SetPosition(CameraName, X, Y)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Set the camera position
camera.SetX(X);
camera.SetY(Y);
}
},
SetZoom(CameraName, Zoom)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Set the camera position
camera.scale = Zoom;
}
},
TransitionToPoint(CameraName, X, Y, Duration)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Check if there is already a movement transition in progress
for (var i = 0; i < camera.transitions.length; i++)
{
if (camera.transitions[i].type == "MOVE")
{
camera.transitions.splice(i, 1);
break;
}
}
// Add the new transition
camera.transitions.push(new Transition("MOVE", Duration, X, Y, camera.GetX(), camera.GetY()));
// Disable following and zoom to contain
camera.following = false;
camera.zoomToContain = false;
}
},
TransitionToZoom(CameraName, Zoom, Duration)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Check if there is already a scale transition in progress
for (var i = 0; i < camera.transitions.length; i++)
{
if (camera.transitions[i].type == "SCALE")
{
camera.transitions.splice(i, 1);
break;
}
}
// Add the new transition
camera.transitions.push(new Transition("SCALE", Duration, Zoom, camera.scale, null, null));
// Disable zoom to contain
camera.zoomToContain = false;
}
},
TransitionToCamera(CameraName, Duration)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Setup the transition
this.transTarget = camera;
this.transCamera = new Camera("transCamera", this.activeCamera.GetX(), this.activeCamera.GetY(), this.activeCamera.scale, false);
this.transCamera.transitions.push(new Transition("MOVE", Duration, this.transTarget.GetX(), this.transTarget.GetY(), this.transCamera.GetX(), this.transCamera.GetY()));
this.transCamera.transitions.push(new Transition("SCALE", Duration, this.transTarget.scale, this.transCamera.scale, null, null));
// Switch the active camera to the transition camera
this.activeCamera = this.transCamera;
this.isSwitchingCameras = true;
}
},
ShakeCamera(CameraName, Strength, MaxDeviation, MaxZoomDeviation, BuildLength, DropTime, Duration)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (camera != null)
{
// Setup the shake
camera.isShaking = true;
camera.shakeStrength = Strength / 100;
camera.shakeMaxDeviation = MaxDeviation;
camera.shakeMaxZoomDeviation = MaxZoomDeviation;
camera.shakeBuildTime = BuildLength;
camera.shakeDropTime = DropTime;
camera.shakeLength = Duration;
camera.shakeTimer = 0;
}
}
};
}
"use strict";
{
C3.Plugins.MagiCam.Exps = {
GetActiveCamera(ret)
{
// Check that a camera was found
if (null != this.activeCamera)
{
return this.activeCamera.name;
}
// Return 0 by default
return "null";
},
GetX(CameraName)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (null != camera)
{
return camera.x;
}
// Return 0 by default
return 0;
},
GetY(CameraName)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (null != camera)
{
return camera.y;
}
// Return 0 by default
return 0;
},
GetZoom(CameraName)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (null != camera)
{
return camera.scale;
}
// Return 0 by default
return 0;
},
MovementTransitionProgress(CameraName)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (null != camera)
{
// Check if there is already a movement transition in progress
for (var i = 0; i < camera.transitions.length; i++)
{
if (camera.transitions[i].type == "MOVE")
{
return camera.transitions[i].progress;
}
}
}
// Return 0 by default
return 0;
},
ZoomTransitionProgress(CameraName)
{
// Retrieve the specified camera
var camera = this.GetCamera(CameraName);
// Check that a camera was found
if (null != camera)
{
// Check if there is already a movement transition in progress
for (var i = 0; i < camera.transitions.length; i++)
{
if (camera.transitions[i].type == "SCALE")
{
return camera.transitions[i].progress;
}
}
}
// Return 0 by default
return 0;
}
};
}
{
C3.Plugins.skymen_skinsCore = class skymen_skinsCorePlugin extends C3.SDKPluginBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.skymen_skinsCore.Type = class skymen_skinsCoreType extends C3.SDKTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{
}
};
}
"use strict";
{
C3.Plugins.skymen_skinsCore.Instance = class skymen_skinsCoreInstance extends C3.SDKInstanceBase //SDKInstanceBase
{
constructor(inst, properties)
{
super(inst);
this.skins = {};
this.lastSkin;
this.lastSubSkin;
this.curSkin;
this.curSubSkin;
this.tag = properties[0];
this.instances = [];
this.init = false;
if (C3.SkymenSkinCore == undefined) {
C3.SkymenSkinCore = {}
}
C3.SkymenSkinCore[this.tag] = this;
}
Release()
{
super.Release();
}
addInstance(inst) {
this.instances.push(inst);
}
trigger (subskin = false) {
if (subskin) {
this.Trigger(C3.Plugins.skymen_skinsCore.Cnds.OnSubSkin)
this.Trigger(C3.Plugins.skymen_skinsCore.Cnds.OnAnySubSkin)
this.Trigger(C3.Plugins.skymen_skinsCore.Cnds.OnAnySubAnySkin)
} else {
this.Trigger(C3.Plugins.skymen_skinsCore.Cnds.OnSkin)
this.Trigger(C3.Plugins.skymen_skinsCore.Cnds.OnAnySkin)
}
}
};
}
"use strict";
{
C3.Plugins.skymen_skinsCore.Cnds = {
IsEmpty(){
return Object.keys(this.skins).length === 0 && this.skins.constructor === Object;
},
HasSkin(){
return this.skins[skin] != undefined;
},
HasSubSkin(){
return this.skins[skin] != undefined && this.skins[skin][subskin] != undefined;
},
OnSkin(){
return skin == this.lastSkin;
},
OnSubSkin(){
return skin == this.lastSkin && subskin == this.lastSubskin;
},
OnAnySkin(){
return true;
},
OnAnySubSkin(){
return skin == this.lastSkin;
},
OnAnySubAnySkin(){
return true;
},
ForEachSkin(){
const runtime = this._runtime;
const eventSheetManager = runtime.GetEventSheetManager();
const currentEvent = runtime.GetCurrentEvent();
const solModifiers = currentEvent.GetSolModifiers();
const eventStack = runtime.GetEventStack();
const oldFrame = eventStack.GetCurrentStackFrame();
const newFrame = eventStack.Push(currentEvent);
Object.keys(this.skins).forEach(k => {
// ... optionally update state here ...
this.curSkin = k;
// Push a copy of the current SOL
eventSheetManager.PushCopySol(solModifiers);
// Retrigger the current event, running a single loop iteration
currentEvent.Retrigger(oldFrame, newFrame);
// Pop the current SOL
eventSheetManager.PopSol(solModifiers);
})
// Pop the event stack frame
eventStack.Pop();
// Return false since event already executed
return false;
},
ForEachSubSkin(){
const runtime = this._runtime;
const eventSheetManager = runtime.GetEventSheetManager();
const currentEvent = runtime.GetCurrentEvent();
const solModifiers = currentEvent.GetSolModifiers();
const eventStack = runtime.GetEventStack();
const oldFrame = eventStack.GetCurrentStackFrame();
const newFrame = eventStack.Push(currentEvent);
if (this.skins[skin] == undefined) return false;
Object.keys(this.skins[skin]).forEach(k => {
// ... optionally update state here ...
this.curSubSkin = k;
// Push a copy of the current SOL
eventSheetManager.PushCopySol(solModifiers);
// Retrigger the current event, running a single loop iteration
currentEvent.Retrigger(oldFrame, newFrame);
// Pop the current SOL
eventSheetManager.PopSol(solModifiers);
})
// Pop the event stack frame
eventStack.Pop();
// Return false since event already executed
return false;
},
};
}
"use strict";
{
C3.Plugins.skymen_skinsCore.Acts = {
AddSkin(obj, skin, mode, anim, subskin){
if (this.skins[skin] == undefined) {
this.skins[skin] = {};
}
this.lastSkin = skin
this.trigger()
if (mode == 0) {
for (var i = 0; i < obj._animations.length; i++) {
var anim = obj._animations[i].GetName();
this.skins[skin][anim] = {
"type": obj,
"anim": anim
}
this.lastSubSkin = anim;
this.trigger(true);
}
} else {
this.skins[skin][subskin] = {
"type": obj,
"anim": anim
}
this.lastSubSkin = anim;
this.trigger(true);
}
},
AddSubSkin(obj, skin, subskin, anim){
if (this.skins[skin] == undefined) {
this.skins[skin] = {};
}
this.skins[skin][subskin] = {
"type": obj,
"anim": anim
}
this.lastSubSkin = anim;
this.trigger(true);
},
RemoveSkin(skin){
if (this.skins[skin] != undefined) {
delete this.skins[skin];
}
},
RemoveSubSkin(skin, subskin){
if (this.skins[skin] != undefined && this.skins[skin][subskin] != undefined) {
delete this.skins[skin][subskin];
}
},
Init(){
if (this.init) return;
for (var i = 0; i < this.instances.length; i++) {
this.instances[i].updateSkin();
}
this.init = true;
},
};
}
"use strict";
{
C3.Plugins.skymen_skinsCore.Exps = {
CurSkin(){
return this.curSkin;
},
CurSubSkin(){
return this.curSubSkin;
},
LastSkin(){
return this.lastSkin;
},
LastSubSkin(){
return this.lastSubSkin;
},
RandomSkin(){
var keys = Object.keys(this.skins)
var res = keys[keys.length * Math.random() << 0];
if (typeof res == "string")
return res;
else
return "";
},
RandomSubSkin(skin){
if (this.skins[skin]) {
var keys = Object.keys(this.skins[skin])
var res = keys[keys.length * Math.random() << 0];
if (typeof res == "string")
return res;
else
return "";
} else {
console.warn("The skin " + skin + " doesn't exist")
return "";
}
},
};
}
"use strict";
{
C3.Plugins.skymen_GlobalRuntime = class GlobalRuntimePlugin extends C3.SDKPluginBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.skymen_GlobalRuntime.Type = class GlobalRuntimeType extends C3.SDKTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{
}
};
}
"use strict";
{
C3.Plugins.skymen_GlobalRuntime.Instance = class GlobalRuntimeInstance extends C3.SDKInstanceBase
{
constructor(inst, properties)
{
super(inst);
this.name = "sdk_runtime"
if (properties)
{
this.name = properties[0];
}
globalThis[this.name] = this._runtime;
}
Release()
{
super.Release();
}
SaveToJson()
{
return {
name: this.name
};
}
LoadFromJson(o)
{
this.name = o.name;
globalThis[this.name] = this._runtime;
// load state for savegames
}
GetDebuggerProperties()
{
return [{
title: "GlobalRuntime",
properties: [
//{name: ".current-animation", value: this._currentAnimation.GetName(), onedit: v => this.CallAction(Acts.SetAnim, v, 0) },
]
}];
}
};
}
"use strict";
{
C3.Plugins.skymen_GlobalRuntime.Cnds = {
};
}
"use strict";
{
C3.Plugins.skymen_GlobalRuntime.Acts = {
};
}
"use strict";
{
C3.Plugins.skymen_GlobalRuntime.Exps = {
};
}
"use strict";C3.Plugins.Sprite=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Sprite.Type=class extends C3.SDKTypeBase{constructor(a){super(a),this._animations=a.GetAnimations()}Release(){C3.clearArray(this._animations),super.Release()}OnCreate(){for(const b of this._animations)b.LoadAllAssets(this._runtime)}LoadTextures(b){const c={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map((d)=>d.LoadAllTextures(b,c)))}ReleaseTextures(){for(const b of this._animations)b.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const a of this._objectClass.instancesIncludingPendingCreate())a.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(a){C3.Plugins.Sprite._FinishCondition(this,a)}};
"use strict";{const a=C3.New(C3.Quad),b=C3.New(C3.Vector2);C3.Plugins.Sprite.Instance=class extends C3.SDKWorldInstanceBase{constructor(a,b){super(a);let c=!0,d="",e=0,f=!0;b&&(c=!!b[0],d=b[1],e=b[2],f=b[3]),this._currentAnimation=this._objectClass.GetAnimationByName(d)||this._objectClass.GetAnimations()[0],this._currentFrameIndex=C3.clamp(e,0,this._currentAnimation.GetFrameCount()-1),this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const g=this._currentAnimationFrame.GetImageInfo();this._currentTexture=g.GetTexture(),this._currentRcTex=g.GetTexRect(),this.HandleWebGLContextLoss(),a.SetFlag(2,!0),a.SetFlag(1,0<=this._currentAnimation.GetSpeed()),this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed()),this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo(),this._animationTimer=C3.New(C3.KahanSum),this._frameStartTime=0,this._animationRepeats=0,this._animTriggerName="",this._changeAnimFrameIndex=-1,this._changeAnimationName="",this._changeAnimationFrom=0;const h=this.GetWorldInfo();this._bquadRef=h.GetBoundingQuad(),h.SetVisible(c),h.SetCollisionEnabled(f),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._currentAnimation=null,this._currentAnimationFrame=null,this._currentTexture=null,this._animationTimer=null,super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(b){var c=Math.round;const d=this._currentTexture;if(null!==d){const e=this._bquadRef,f=this._currentRcTex;if(b.SetTexture(d),this._runtime.IsPixelRoundingEnabled()){const d=this.GetWorldInfo(),g=c(d.GetX())-d.GetX(),h=c(d.GetY())-d.GetY();a.copy(e),a.offset(g,h),b.Quad3(a,f)}else b.Quad3(e,f)}}_DrawCollisionPoly(a){const b=this.GetWorldInfo(),c=b.GetTransformedCollisionPoly();a.SetColorFillMode(),a.SetColorRgba(1,0,0,1);const d=c.pointsArr(),e=b.GetX(),f=b.GetY();for(let b=0,c=d.length;b<c;b+=2){const g=(b+2)%c,h=d[b]+e,i=d[b+1]+f,j=d[g]+e,k=d[g+1]+f;a.Line(h,i,j,k)}a.SetTextureFillMode(),a.SetColorRgba(1,1,1,1)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(2)}SetAnimationPlaying(a){this._inst.SetFlag(2,a)}IsPlayingForwards(){return this._inst.GetFlag(1)}SetPlayingForwards(a){this._inst.SetFlag(1,a)}IsInAnimationTrigger(){return this._inst.GetFlag(4)}SetInAnimationTrigger(a){this._inst.SetFlag(4,a)}Tick(){this._changeAnimationName&&this._DoChangeAnimation(),0<=this._changeAnimFrameIndex&&this._DoChangeAnimFrame();const a=this._currentAnimationSpeed;if(!this.IsAnimationPlaying()||0===a)return void this._StopTicking();const b=this._runtime.GetDt(this._inst);this._animationTimer.Add(b);const c=this.GetAnimationTime(),d=this._currentAnimationFrame,e=d.GetDuration()/a;if(!(c<this._frameStartTime+e)){const b=this._currentAnimation,f=this._currentAnimationRepeatTo,g=b.GetFrameCount(),h=b.GetRepeatCount(),i=b.IsLooping(),j=b.IsPingPong();this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--,this._frameStartTime+=e,this._currentFrameIndex>=g&&(j?(this.SetPlayingForwards(!1),this._currentFrameIndex=g-2):i?this._currentFrameIndex=f:(this._animationRepeats++,this._animationRepeats>=h?this._FinishAnimation(!1):this._currentFrameIndex=f)),0>this._currentFrameIndex&&(j?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),!i&&(this._animationRepeats++,this._animationRepeats>=h&&this._FinishAnimation(!0))):i?this._currentFrameIndex=f:(this._animationRepeats++,this._animationRepeats>=h?this._FinishAnimation(!0):this._currentFrameIndex=f)),this._currentFrameIndex=C3.clamp(this._currentFrameIndex,0,g-1);const k=b.GetFrameAt(this._currentFrameIndex);c>this._frameStartTime+k.GetDuration()/a&&(this._frameStartTime=c),this._OnFrameChanged(d,k)}}_FinishAnimation(a){this._currentFrameIndex=a?0:this._currentAnimation.GetFrameCount()-1,this.SetAnimationPlaying(!1),this._animTriggerName=this._currentAnimation.GetName(),this.SetInAnimationTrigger(!0),this.Trigger(C3.Plugins.Sprite.Cnds.OnAnyAnimFinished),this.Trigger(C3.Plugins.Sprite.Cnds.OnAnimFinished),this.SetInAnimationTrigger(!1),this._animationRepeats=0}_OnFrameChanged(a,b){const c=this.GetWorldInfo(),d=a.GetImageInfo(),e=b.GetImageInfo(),f=d.GetWidth(),g=d.GetHeight(),h=e.GetWidth(),i=e.GetHeight();f!==h&&c.SetWidth(c.GetWidth()*(h/f)),g!==i&&c.SetHeight(c.GetHeight()*(i/g)),c.SetOriginX(b.GetOriginX()),c.SetOriginY(b.GetOriginY()),c.SetSourceCollisionPoly(b.GetCollisionPoly()),c.SetBboxChanged(),this._currentAnimationFrame=b,this._currentTexture=e.GetTexture(),this._currentRcTex=e.GetTexRect();const j=this.GetInstance().GetBehaviorInstances();for(let c=0,d=j.length;c<d;++c)j[c].OnSpriteFrameChanged(a,b);this.Trigger(C3.Plugins.Sprite.Cnds.OnFrameChanged),this._runtime.UpdateRender()}_StartAnim(a){this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),1===a&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,!this.IsInAnimationTrigger()&&this._DoChangeAnimFrame()),this._StartTicking()}_SetAnim(a,b){this._changeAnimationName=a,this._changeAnimationFrom=b,this._StartTicking(),this.IsInAnimationTrigger()||this._DoChangeAnimation()}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(a){isFinite(a)&&(this._changeAnimFrameIndex=a,!this.IsInAnimationTrigger()&&this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(a){this._currentAnimationSpeed=Math.abs(a),this.SetPlayingForwards(0<=a),0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(a){a=C3.clamp(Math.floor(a),0,this._currentAnimation.GetFrameCount()-1),this._currentAnimationRepeatTo=a}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const a=this._currentAnimationFrame,b=this._objectClass.GetAnimationByName(this._changeAnimationName);if((this._changeAnimationName="",!!b)&&!(b===this._currentAnimation&&this.IsAnimationPlaying())){this._currentAnimation=b,this.SetPlayingForwards(0<=b.GetSpeed()),this._currentAnimationSpeed=Math.abs(b.GetSpeed()),this._currentAnimationRepeatTo=b.GetRepeatTo(),this._currentFrameIndex=C3.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex=0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime();const c=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._OnFrameChanged(a,c)}}_DoChangeAnimFrame(){const a=this._currentAnimationFrame,b=this._currentFrameIndex;if(this._currentFrameIndex=C3.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1),this._changeAnimFrameIndex=-1,b!==this._currentFrameIndex){const b=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._OnFrameChanged(a,b),this._frameStartTime=this.GetAnimationTime()}}_UpdateCurrentTexture(){const a=this._currentAnimationFrame.GetImageInfo();this._currentTexture=a.GetTexture(),this._currentRcTex=a.GetTexRect()}GetImagePoint(a){const c=this._currentAnimationFrame,d=this.GetWorldInfo();let e=null;if("string"==typeof a)e=c.GetImagePointByName(a);else if("number"==typeof a)e=c.GetImagePointByIndex(a-1);else throw new TypeError("expected string or number");return e?(b.copy(e.GetVec2()),b.offset(-c.GetOriginX(),-c.GetOriginY()),b.scale(d.GetWidth(),d.GetHeight()),b.rotate(d.GetAngle()),b.offset(d.GetX(),d.GetY()),[b.getX(),b.getY()]):[d.GetX(),d.GetY()]}GetDebuggerProperties(){const a=C3.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:(b)=>this.CallAction(a.SetAnim,b,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",value:this._currentFrameIndex,onedit:(b)=>this.CallAction(a.SetAnimFrame,b)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:(b)=>b?this.CallAction(a.StartAnim,0):this.CallAction(a.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:(b)=>this.CallAction(a.SetAnimSpeed,b)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:(a)=>this._animationRepeats=a}]}]}SaveToJson(){const a={"a":this._currentAnimation.GetSID()};0!==this._frameStartTime&&(a["fs"]=this._frameStartTime);const b=this.GetAnimationTime();0!==b&&(a["at"]=b),0!==this._currentFrameIndex&&(a["f"]=this._currentFrameIndex),0!==this._currentAnimationSpeed&&(a["cas"]=this._currentAnimationSpeed),1!==this._animationRepeats&&(a["ar"]=this._animationRepeats),0!==this._currentAnimationRepeatTo&&(a["rt"]=this._currentAnimationRepeatTo),this.IsAnimationPlaying()||(a["ap"]=this.IsAnimationPlaying()),this.IsPlayingForwards()||(a["af"]=this.IsPlayingForwards());const c=this.GetWorldInfo();return c.IsCollisionEnabled()&&(a["ce"]=c.IsCollisionEnabled()),a}LoadFromJson(a){const b=this.GetObjectClass().GetAnimationBySID(a["a"]);b&&(this._currentAnimation=b),this._frameStartTime=a.hasOwnProperty("fs")?a["fs"]:0,this._animationTimer.Set(a.hasOwnProperty("at")?a["at"]:0);const c=a.hasOwnProperty("f")?a["f"]:0;this._currentFrameIndex=C3.clamp(c,0,this._currentAnimation.GetFrameCount()-1),this._currentAnimationSpeed=a.hasOwnProperty("cas")?a["cas"]:0,this._animationRepeats=a.hasOwnProperty("ar")?a["ar"]:1;const d=a.hasOwnProperty("rt")?a["rt"]:0;this._currentAnimationRepeatTo=C3.clamp(d,0,this._currentAnimation.GetFrameCount()-1),this.SetAnimationPlaying(!a.hasOwnProperty("ap")||!!a["ap"]),this.SetPlayingForwards(!a.hasOwnProperty("af")||!!a["af"]);const e=this._currentAnimation.GetFrameAt(this._currentFrameIndex),f=e.GetImageInfo();this._currentAnimationFrame=e,this._currentTexture=f.GetTexture(),this._currentRcTex=f.GetTexRect();const g=this.GetWorldInfo();g.SetOriginX(e.GetOriginX()),g.SetOriginY(e.GetOriginY()),g.SetSourceCollisionPoly(e.GetCollisionPoly()),g.SetCollisionEnabled(!!a["ce"])}GetPropertyValueByIndex(a){const b=this.GetWorldInfo();return 3===a?b.IsCollisionEnabled():void 0}SetPropertyValueByIndex(a,b){const c=this.GetWorldInfo();3===a?c.SetCollisionEnabled(!!b):void 0}GetScriptInterfaceClass(){return ISpriteInstance}};const c=new WeakMap,d=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends IWorldInstance{constructor(){super(),c.set(this,IInstance._GetInitInst().GetSdkInstance())}getImagePointX(a){if("string"!=typeof a&&"number"!=typeof a)throw new TypeError("expected string or number");return c.get(this).GetImagePoint(a)[0]}getImagePointY(a){if("string"!=typeof a&&"number"!=typeof a)throw new TypeError("expected string or number");return c.get(this).GetImagePoint(a)[1]}stopAnimation(){c.get(this).SetAnimationPlaying(!1)}startAnimation(a="current-frame"){const b=d.get(a);if("undefined"==typeof b)throw new Error("invalid mode");c.get(this)._StartAnim(b)}setAnimation(a,b="beginning"){const e=d.get(b);if("undefined"==typeof e)throw new Error("invalid mode");c.get(this)._SetAnim(a,e)}get animationName(){return c.get(this)._GetCurrentAnimationName()}set animationFrame(a){c.get(this)._SetAnimFrame(a)}get animationFrame(){return c.get(this)._GetAnimFrame()}set animationSpeed(a){c.get(this)._SetAnimSpeed(a)}get animationSpeed(){return c.get(this)._GetAnimSpeed()}set animationRepeatToFrame(a){c.get(this)._SetAnimRepeatToFrame(a)}get animationRepeatToFrame(){return c.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return c.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return c.get(this).GetCurrentImageInfo().GetHeight()}}}
"use strict";{function a(c,d,a,b){const e=d.GetUID(),f=a.GetUID();e<f?c.Set(d,a,b):c.Set(a,d,b)}function b(c,d,a){const b=d.GetUID(),e=a.GetUID();b<e?c.Delete(d,a):c.Delete(a,d)}function c(a,b){a.DeleteEither(b)}function d(c,d,a){const b=d.GetUID(),e=a.GetUID();return b<e?c.Get(d,a):c.Get(a,d)}function e(a,b,c,d){if(!b)return!1;const e=a.GetInstance(),f=0!==c||0!==d,h=e.GetWorldInfo(),m=e.GetRuntime(),n=m.GetCollisionEngine(),o=m.GetCurrentCondition(),p=o.GetEventBlock().IsOrBlock(),q=o.GetObjectClass(),r=o.IsInverted(),s=b.GetCurrentSol(),t=q!==b;k=b,j=t&&!r;let u,v=0,w=0,x=!1;s.IsSelectAll()?(g.copy(h.GetBoundingBox()),g.offset(c,d),n.GetCollisionCandidates(h.GetLayer(),b,g,i),u=i):p?m.IsCurrentConditionFirst()&&!s._GetOwnElseInstances().length&&s._GetOwnInstances().length?u=s._GetOwnInstances():u=s._GetOwnElseInstances():u=s._GetOwnInstances(),f&&(v=h.GetX(),w=h.GetY(),h.OffsetXY(c,d),h.SetBboxChanged());for(const f of u)if(n.TestOverlap(e,f)){if(x=!0,r)break;t&&l.add(f)}return f&&(h.SetXY(v,w),h.SetBboxChanged()),C3.clearArray(i),x}function f(a){const b=a.GetRuntime().GetCurrentEvent().IsOrBlock(),c=k.GetCurrentSol(),d=c._GetOwnInstances(),e=c._GetOwnElseInstances();if(c.IsSelectAll()){if(c._SetSelectAll(!1),C3.shallowAssignArray(d,[...l]),b){C3.clearArray(e);for(const a of k.GetInstances())l.has(a)||c._PushElseInstance(a)}}else if(b)for(const a of l)d.push(a),C3.arrayFindRemove(e,a);else C3.shallowAssignArray(d,[...l]);k.ApplySolToContainer()}const g=C3.New(C3.Rect),h=[],i=[];let j=!1,k=null;const l=new Set;C3.Plugins.Sprite._FinishCondition=function(a,b){j&&(b&&f(a),l.clear(),k=null,j=!1)},C3.Plugins.Sprite.Cnds={OnCollision(e){if(this._runtime.IsDebugging())return C3.Plugins.Sprite.Cnds.DebugOnCollision.call(this,e);if(!e)return!1;const f=this._runtime,g=f.GetCollisionEngine(),i=f.GetEventSheetManager(),j=i.GetEventStack(),k=i.GetCurrentCondition(),l=k.GetObjectClass(),m=k.GetSavedDataMap(),n=k.GetUnsavedDataMap(),o=j.GetCurrentStackFrame(),p=f.GetTickCount(),q=o.GetCurrentEvent(),r=j.Push(q);let s=m.get("collmemory");s||(s=C3.New(C3.PairMap),m.set("collmemory",s)),n.get("spriteCreatedDestroyCallback")||(n.set("spriteCreatedDestroyCallback",!0),f.Dispatcher().addEventListener("instancedestroy",(a)=>c(s,a.instance)));const t=l.GetCurrentSol(),u=e.GetCurrentSol(),v=t.GetInstances();let w=null;for(let c=0;c<v.length;++c){const f=v[c];u.IsSelectAll()?(g.GetCollisionCandidates(f.GetWorldInfo().GetLayer(),e,f.GetWorldInfo().GetBoundingBox(),h),w=h,g.AddRegisteredCollisionCandidates(f,e,w)):w=u.GetInstances();for(let c=0;c<w.length;++c){const h=w[c];if(g.TestOverlap(f,h)||g.CheckRegisteredCollision(f,h)){const b=d(s,f,h);let c=!1,g=-2;"number"==typeof b&&(c=!0,g=b);const j=!c||g<p-1;if(a(s,f,h,p),j){const a=q.GetSolModifiers();i.PushCopySol(a);const b=l.GetCurrentSol(),c=e.GetCurrentSol();if(b._SetSelectAll(!1),c._SetSelectAll(!1),l===e){const a=b._GetOwnInstances();C3.clearArray(a),a.push(f),a.push(h),l.ApplySolToContainer()}else{const a=b._GetOwnInstances(),d=c._GetOwnInstances();C3.clearArray(a),C3.clearArray(d),a.push(f),d.push(h),l.ApplySolToContainer(),e.ApplySolToContainer()}q.Retrigger(o,r),i.PopSol(a)}}else b(s,f,h)}C3.clearArray(h)}return j.Pop(),!1},*DebugOnCollision(e){if(!e)return!1;const f=this._runtime,g=f.GetCollisionEngine(),i=f.GetEventSheetManager(),j=i.GetEventStack(),k=j.GetCurrentStackFrame(),l=f.GetTickCount(),m=k.GetCurrentEvent(),n=j.Push(m),o=i.GetCurrentCondition(),p=o.GetObjectClass(),q=o.GetSavedDataMap(),r=o.GetUnsavedDataMap();let s=q.get("collmemory");s||(s=C3.New(C3.PairMap),q.set("collmemory",s)),r.get("spriteCreatedDestroyCallback")||(r.set("spriteCreatedDestroyCallback",!0),f.Dispatcher().addEventListener("instancedestroy",(a)=>c(s,a.instance)));const t=p.GetCurrentSol(),u=e.GetCurrentSol(),v=t.GetInstances();let w=null;for(let c=0;c<v.length;++c){const f=v[c];u.IsSelectAll()?(g.GetCollisionCandidates(f.GetWorldInfo().GetLayer(),e,f.GetWorldInfo().GetBoundingBox(),h),w=h,g.AddRegisteredCollisionCandidates(f,e,w)):w=u.GetInstances();for(let c=0;c<w.length;++c){const h=w[c];if(g.TestOverlap(f,h)||g.CheckRegisteredCollision(f,h)){const b=d(s,f,h);let c=!1,g=-2;"number"==typeof b&&(c=!0,g=b);const j=!c||g<l-1;if(a(s,f,h,l),j){const a=m.GetSolModifiers();i.PushCopySol(a);const b=p.GetCurrentSol(),c=e.GetCurrentSol();if(b._SetSelectAll(!1),c._SetSelectAll(!1),p===e){const a=b._GetOwnInstances();C3.clearArray(a),a.push(f),a.push(h),p.ApplySolToContainer()}else{const a=b._GetOwnInstances(),d=c._GetOwnInstances();C3.clearArray(a),C3.clearArray(d),a.push(f),d.push(h),p.ApplySolToContainer(),e.ApplySolToContainer()}yield*m.DebugRetrigger(k,n),i.PopSol(a)}}else b(s,f,h)}C3.clearArray(h)}return j.Pop(),!1},IsOverlapping(a){return e(this,a,0,0)},IsOverlappingOffset(a,b,c){return e(this,a,b,c)},IsAnimPlaying(a){return C3.equalsNoCase(this._GetCurrentAnimationName(),a)},CompareFrame(a,b){return C3.compare(this._currentFrameIndex,a,b)},CompareAnimSpeed(a,b){return C3.compare(this._GetAnimSpeed(),a,b)},OnAnimFinished(a){return C3.equalsNoCase(this._animTriggerName,a)},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";C3.Plugins.Sprite.Acts={Spawn(a,b,c){if(!a||!b)return;const[d,e]=this.GetImagePoint(c),f=this._runtime.CreateInstance(a,b,d,e);if(!f)return;if(a.GetPlugin().IsRotatable()){const a=f.GetWorldInfo();a.SetAngle(this.GetWorldInfo().GetAngle()),a.SetBboxChanged()}const g=this._runtime.GetEventSheetManager();if(g.BlockFlushingInstances(!0),f._TriggerOnCreated(),f.IsInContainer())for(const a of f.siblings())a._TriggerOnCreated();g.BlockFlushingInstances(!1);const h=this._runtime.GetCurrentAction(),i=h.GetSavedDataMap();let j=!1;if((!i.has("Spawn_LastExec")||i.get("Spawn_LastExec")<this._runtime.GetExecCount())&&(j=!0,i.set("Spawn_LastExec",this._runtime.GetExecCount())),a!==this.GetObjectClass()){const b=a.GetCurrentSol();b._SetSelectAll(!1);const c=b._GetOwnInstances();if(j?(C3.clearArray(c),c.push(f)):c.push(f),f.IsInContainer())for(const a of f.siblings()){const b=a.GetObjectClass().GetCurrentSol();j?b.SetSinglePicked(a):(b._SetSelectAll(!1),b._PushInstance(a))}}},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(),c=b.GetWidth(),d=Math.abs(c)*(0===a?-1:1);c===d||(b.SetWidth(d),b.SetBboxChanged())},SetFlipped(a){const b=this.GetWorldInfo(),c=b.GetHeight(),d=Math.abs(c)*(0===a?-1:1);c===d||(b.SetHeight(d),b.SetBboxChanged())},SetScale(a){const b=this._currentAnimationFrame,c=b.GetImageInfo(),d=this.GetWorldInfo(),e=0>d.GetWidth()?-1:1,f=0>d.GetHeight()?-1:1,g=c.GetWidth()*a*e,h=c.GetHeight()*a*f;(d.GetWidth()!==g||d.GetHeight()!==h)&&(d.SetSize(g,h),d.SetBboxChanged())},async LoadURL(a,b){const c=this._currentAnimationFrame,d=c.GetImageInfo(),e=this.GetWorldInfo(),f=this._runtime;if(d.GetURL()===a)return 0===b&&(e.SetSize(d.GetWidth(),d.GetHeight()),e.SetBboxChanged()),void this.Trigger(C3.Plugins.Sprite.Cnds.OnURLLoaded);const g=C3.New(C3.ImageInfo);return await g.LoadDynamicAsset(f,a),g.IsLoaded()?void(await g.LoadStaticTexture(f.GetWebGLRenderer(),{sampling:this._runtime.GetSampling()}),d.ReplaceWith(g),this._sdkType._UpdateAllCurrentTexture(),!this.WasReleased()&&0===b&&(e.SetSize(d.GetWidth(),d.GetHeight()),e.SetBboxChanged()),f.UpdateRender(),!this.WasReleased()&&(await this.TriggerAsync(C3.Plugins.Sprite.Cnds.OnURLLoaded))):void this.Trigger(C3.Plugins.Sprite.Cnds.OnURLFailed)},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";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(a){return this.GetImagePoint(a)[0]},ImagePointY(a){return this.GetImagePoint(a)[1]},ImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()}};
"use strict";C3.Plugins.TiledBg=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.TiledBg.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling(),isTiled:!0})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}};
"use strict";{const a=C3.New(C3.Quad),b=C3.New(C3.Rect),c=C3.New(C3.Quad);C3.Plugins.TiledBg.Instance=class extends C3.SDKWorldInstanceBase{constructor(a,b){super(a),this._imageOffsetX=0,this._imageOffsetY=0,this._imageScaleX=1,this._imageScaleY=1,this._imageAngle=0,this._ownImageInfo=null,b&&(this.GetWorldInfo().SetVisible(!!b[0]),this._imageOffsetX=b[2],this._imageOffsetY=b[3],this._imageScaleX=b[4],this._imageScaleY=b[5],this._imageAngle=C3.toRadians(b[6]))}Release(){this._ReleaseOwnImage(),super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}Draw(d){var e=Math.round;const f=this.GetCurrentImageInfo(),g=f.GetTexture();if(!g)return;const h=this.GetWorldInfo();let i=h.GetBoundingQuad();d.SetTexture(g);const j=f.GetWidth(),k=f.GetHeight(),l=this._imageOffsetX/j,m=this._imageOffsetY/k;if(b.set(0,0,h.GetWidth()/(j*this._imageScaleX),h.GetHeight()/(k*this._imageScaleY)),b.offset(-l,-m),this._runtime.IsPixelRoundingEnabled()){const b=e(h.GetX())-h.GetX(),c=e(h.GetY())-h.GetY();a.copy(i),a.offset(b,c),i=a}0===this._imageAngle?d.Quad3(i,b):(c.setFromRotatedRect(b,-this._imageAngle),d.Quad4(i,c))}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}_SetImageOffsetX(a){this._imageOffsetX===a||(this._imageOffsetX=a,this._runtime.UpdateRender())}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(a){this._imageOffsetY===a||(this._imageOffsetY=a,this._runtime.UpdateRender())}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(a){this._imageScaleX===a||(this._imageScaleX=a,this._runtime.UpdateRender())}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(a){this._imageScaleY===a||(this._imageScaleY=a,this._runtime.UpdateRender())}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(b){this._imageAngle===b||(this._imageAngle=b,this._runtime.UpdateRender())}_GetImageAngle(){return this._imageAngle}GetPropertyValueByIndex(a){return 2===a?this._GetImageOffsetX():3===a?this._GetImageOffsetY():4===a?this._GetImageScaleX():5===a?this._GetImageScaleY():6===a?this._GetImageAngle():void 0}SetPropertyValueByIndex(a,b){2===a?this._SetImageOffsetX(b):3===a?this._SetImageOffsetY(b):4===a?this._SetImageScaleX(b):5===a?this._SetImageScaleY(b):6===a?this._SetImageAngle(b):void 0}GetScriptInterfaceClass(){return ITiledBackgroundInstance}};const d=new WeakMap;self.ITiledBackgroundInstance=class extends IWorldInstance{constructor(){super(),d.set(this,IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(a){d.get(this)._SetImageOffsetX(a)}get imageOffsetX(){return d.get(this)._GetImageOffsetX()}set imageOffsetY(a){d.get(this)._SetImageOffsetY(a)}get imageOffsetY(){return d.get(this)._GetImageOffsetY()}set imageScaleX(a){d.get(this)._SetImageScaleX(a)}get imageScaleX(){return d.get(this)._GetImageScaleX()}set imageScaleY(a){d.get(this)._SetImageScaleY(a)}get imageScaleY(){return d.get(this)._GetImageScaleY()}set imageAngle(b){d.get(this)._SetImageAngle(b)}get imageAngle(){return d.get(this)._GetImageAngle()}set imageAngleDegrees(b){d.get(this)._SetImageAngle(C3.toRadians(b))}get imageAngleDegrees(){return C3.toDegrees(d.get(this)._GetImageAngle())}}}
"use strict";C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}};
"use strict";C3.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(b){this._SetImageAngle(C3.toRadians(b))},SetEffect(a){this.GetWorldInfo().SetBlendMode(a),this._runtime.UpdateRender()},async LoadURL(a){if(!(this._ownImageInfo&&this._ownImageInfo.GetURL()===a)){const b=this._runtime,c=C3.New(C3.ImageInfo);if(await c.LoadDynamicAsset(b,a),!c.IsLoaded())return void this.Trigger(C3.Plugins.TiledBg.Cnds.OnURLFailed);if(this.WasReleased())return c.Release(),null;const d=await c.LoadStaticTexture(b.GetWebGLRenderer(),{sampling:this._runtime.GetSampling(),isTiled:!0});return d?this.WasReleased()?void c.Release():void(this._ReleaseOwnImage(),this._ownImageInfo=c,b.UpdateRender(),await this.TriggerAsync(C3.Plugins.TiledBg.Cnds.OnURLLoaded)):void 0}}};
"use strict";C3.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 C3.toDegrees(this._imageAngle)}};
"use strict";C3.Plugins.Spritefont2=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Spritefont2.Type=class extends C3.SDKTypeBase{constructor(a){super(a),this._spriteFont=C3.New(SpriteFont)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling(),isTiled:!0})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}GetSpriteFont(){return this._spriteFont}UpdateSettings(a,b,c,d){const e=this.GetImageInfo(),f=this._spriteFont;f.SetWidth(e.GetWidth()),f.SetHeight(e.GetHeight()),f.SetCharacterWidth(a),f.SetCharacterHeight(b),f.SetCharacterSet(c),f.SetSpacingData(d),f.UpdateCharacterMap()}};
"use strict";{const a=["left","center","right"],b=["top","center","bottom"],c=C3.New(C3.Quad);C3.Plugins.Spritefont2.Instance=class extends C3.SDKWorldInstanceBase{constructor(a,b){super(a),this._text="",this._enableBBcode=!0,this._characterWidth=16,this._characterHeight=16,this._characterSet="";let c=[];if(this._characterScale=1,this._characterSpacing=0,this._lineHeight=0,this._horizontalAlign=0,this._verticalAlign=0,this._wrapByWord=!0,this._spriteFontText=null,this._typewriterStartTime=-1,this._typewriterEndTime=-1,this._typewriterLength=0,b){this._text=b[0],this._enableBBcode=b[1],this._characterWidth=b[2],this._characterHeight=b[3],this._characterSet=b[4],c=b[5],this._characterScale=b[6],this._characterSpacing=b[7],this._lineHeight=b[8],this._horizontalAlign=b[9],this._verticalAlign=b[10],this._wrapByWord=0===b[11];const a=this.GetWorldInfo();a.SetVisible(b[12])}this._sdkType.UpdateSettings(this._characterWidth,this._characterHeight,this._characterSet,c),this._spriteFontText=C3.New(SpriteFontText,this._sdkType.GetSpriteFont());const d=this.GetWorldInfo();this._spriteFontText.SetSize(d.GetWidth(),d.GetHeight()),this._UpdateSettings()}Release(){this._CancelTypewriter(),this._spriteFontText.Release(),this._spriteFontText=null,super.Release()}_UpdateSettings(){const c=this._spriteFontText;c&&(c.SetBBCodeEnabled(this._enableBBcode),c.SetText(this._text),c.SetWordWrapMode(this._wrapByWord?"word":"character"),c.SetHorizontalAlign(a[this._horizontalAlign]),c.SetVerticalAlign(b[this._verticalAlign]),c.SetScale(this._characterScale),c.SetSpacing(this._characterSpacing),c.SetLineHeight(this._lineHeight))}Draw(a){var b=Math.round;const d=this._objectClass.GetImageInfo(),e=d.GetTexture();if(!e)return;a.SetTexture(e);const f=this.GetWorldInfo();let g=f.GetBoundingQuad();const h=this._spriteFontText;if(this._runtime.IsPixelRoundingEnabled()){const a=b(f.GetX())-f.GetX(),d=b(f.GetY())-f.GetY();c.copy(g),c.offset(a,d),g=c}h.SetSize(f.GetWidth(),f.GetHeight()),h.GetSpriteFont().SetTexRect(d.GetTexRect()),h.SetColor(f.GetUnpremultipliedColor()),h.Draw(a,g.getTlx(),g.getTly(),f.GetAngle())}SaveToJson(){const a={"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()};return-1!==this._typewriterEndTime&&(o["tw"]={"st":this._typewriterStartTime,"en":this._typewriterEndTime,"l":this._typewriterLength}),a}LoadFromJson(a){if(this._CancelTypewriter(),this._text=a["t"],this._enableBBcode=a["ebbc"],this._characterScale=a["csc"],this._characterSpacing=a["csp"],this._lineHeight=a["lh"],this._horizontalAlign=a["ha"],this._verticalAlign=a["va"],this._wrapByWord=a["w"],a.hasOwnProperty("tw")){const b=a["tw"];this._typewriterStartTime=b["st"],this._typewriterEndTime=b["en"],this._typewriterLength=a["l"]}const b=this._sdkType.GetSpriteFont();b.SetCharacterWidth(a["cw"]),b.SetCharacterHeight(a["ch"]),b.SetCharacterSet(a["cs"]),b.SetSpacingData(a["sd"]),this._UpdateSettings(),-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(a){return a===0?this._text:1===a?this._enableBBcode:2===a?this._sdkType.GetSpriteFont().GetCharacterWidth():3===a?this._sdkType.GetSpriteFont().GetCharacterHeight():4===a?this._sdkType.GetSpriteFont().GetCharacterSet():5===a?this._sdkType.GetSpriteFont().GetSpacingData():6===a?this._characterScale:7===a?this._characterSpacing:8===a?this._lineHeight:9===a?this._horizontalAlign:10===a?this._verticalAlign:11===a?this._wrapByWord?1:0:void 0}SetPropertyValueByIndex(a,b){switch(a){case 0:if(this._text===b)return;this._text=b,this._UpdateSettings();break;case 1:if(this._enableBBcode===!!b)return;this._enableBBcode=!!b,this._UpdateSettings();break;case 2:this._sdkType.GetSpriteFont().SetCharacterWidth(b);break;case 3:this._sdkType.GetSpriteFont().SetCharacterHeight(b);break;case 4:this._sdkType.GetSpriteFont().SetCharacterSet(b);break;case 5:this._sdkType.GetSpriteFont().SetSpacingData(b);break;case 6:if(this._characterScale===b)return;this._characterScale=b,this._UpdateSettings();break;case 7:if(this._characterSpacing===b)return;this._characterSpacing=b,this._UpdateSettings();break;case 8:if(this._lineHeight===b)return;this._lineHeight=b,this._UpdateSettings();break;case 9:if(this._horizontalAlign===b)return;this._horizontalAlign=b,this._UpdateSettings();break;case 10:if(this._verticalAlign===b)return;this._verticalAlign=b,this._UpdateSettings();break;case 11:if(this._wrapByWord===(b===0))return;this._wrapByWord=b===0,this._UpdateSettings();}}_SetText(a){this._text===a||(this._text=a,this._spriteFontText.SetText(a),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(a,b){this._SetText(a),this._typewriterStartTime=this._runtime.GetGameTime(),this._typewriterEndTime=this._typewriterStartTime+b,this._typewriterLength=C3.BBString.StripAnyTags(a).length,this._spriteFontText.SetDrawMaxCharacterCount(0),this._StartTicking()}_CancelTypewriter(){this._typewriterStartTime=-1,this._typewriterEndTime=-1,this._typewriterLength=0,this._spriteFontText.SetDrawMaxCharacterCount(-1),this._StopTicking()}_FinishTypewriter(){-1===this._typewriterEndTime||(this._CancelTypewriter(),this.Trigger(C3.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetScale(a){this._characterScale===a||(this._characterScale=a,this._spriteFontText.SetScale(this._characterScale),this._runtime.UpdateRender())}_GetScale(){return this._characterScale}_SetCharacterSpacing(a){this._characterSpacing===a||(this._characterSpacing=a,this._spriteFontText.SetSpacing(this._characterSpacing),this._runtime.UpdateRender())}_GetCharacterSpacing(){return this._characterSpacing}_SetLineHeight(a){this._lineHeight===a||(this._lineHeight=a,this._spriteFontText.SetLineHeight(this._lineHeight),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeight}_SetHAlign(a){this._horizontalAlign===a||(this._horizontalAlign=a,this._UpdateSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(a){this._verticalAlign===a||(this._verticalAlign=a,this._UpdateSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(a){a=!!a;this._wrapByWord===a||(this._wrapByWord=a,this._UpdateSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){const a=this._runtime.GetGameTime();if(a>=this._typewriterEndTime)this._CancelTypewriter(),this.Trigger(C3.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender();else{let b=C3.relerp(this._typewriterStartTime,this._typewriterEndTime,a,0,this._typewriterLength);b=Math.floor(b),b!==this._spriteFontText.GetDrawMaxCharacterCount()&&(this._spriteFontText.SetDrawMaxCharacterCount(b),this._runtime.UpdateRender())}}GetDebuggerProperties(){return[{title:"plugins.spritefont2.name",properties:[{name:"plugins.spritefont2.properties.text.name",value:this._text,onedit:(a)=>this._SetText(a)}]}]}GetScriptInterfaceClass(){return ISpriteFontInstance}};const d=new WeakMap,e=new Map([["left",0],["center",1],["right",2]]),f=new Map([["top",0],["center",1],["bottom",2]]),g=new Map([["word",!0],["character",!1]]);self.ISpriteFontInstance=class extends IWorldInstance{constructor(){super(),d.set(this,IInstance._GetInitInst().GetSdkInstance())}get text(){return d.get(this).GetText()}set text(a){const b=d.get(this);b._CancelTypewriter(),b._SetText(a)}typewriterText(a,b){const c=d.get(this);c._CancelTypewriter(),c._StartTypewriter(a,b)}typewriterFinish(){d.get(this)._FinishTypewriter()}set characterScale(a){d.get(this)._SetScale(a)}get characterScale(){return d.get(this)._GetScale()}set characterSpacing(a){d.get(this)._SetCharacterSpacing(a)}get characterSpacing(){return d.get(this)._GetCharacterSpacing()}set lineHeight(a){d.get(this)._SetLineHeight(a)}get lineHeight(){return d.get(this)._GetLineHeight()}set horizontalAlign(a){const b=e.get(a);if("undefined"==typeof b)throw new Error("invalid mode");d.get(this)._SetHAlign(b)}get horizontalAlign(){return a[d.get(this)._GetHAlign()]}set verticalAlign(a){const b=f.get(a);if("undefined"==typeof b)throw new Error("invalid mode");d.get(this)._SetVAlign(b)}get verticalAlign(){return b[d.get(this)._GetVAlign()]}set wordWrapMode(a){const b=g.get(a);if("undefined"==typeof b)throw new Error("invalid mode");d.get(this)._SetWrapByWord(b)}get wordWrapMode(){return d.get(this)._IsWrapByWord()?"word":"character"}}}
"use strict";C3.Plugins.Spritefont2.Cnds={CompareText(a,b){return b?this._text===a:C3.equalsNoCase(this._text,a)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}};
"use strict";C3.Plugins.Spritefont2.Acts={SetText(a){this._CancelTypewriter(),"number"==typeof a&&1e9>a&&(a=Math.round(1e10*a)/1e10),this._SetText(a.toString())},AppendText(a){this._CancelTypewriter(),"number"==typeof a&&1e9>a&&(a=Math.round(1e10*a)/1e10),a=a.toString();a&&this._SetText(this._text+a)},TypewriterText(a,b){this._CancelTypewriter(),"number"==typeof a&&1e9>a&&(a=Math.round(1e10*a)/1e10),this._StartTypewriter(a.toString(),b)},TypewriterFinish(){this._FinishTypewriter()},SetScale(a){this._SetScale(a)},SetCharacterSpacing(a){this._SetCharacterSpacing(a)},SetLineHeight(a){this._SetLineHeight(a)},SetCharacterWidth(a,b){let c=!1;const d=this._sdkType.GetSpriteFont();for(const e of a)if(" "===e)d.SetSpaceWidth(b),c=!0;else{const a=d.GetCharacter(e);a&&(a.SetDisplayWidth(b),c=!0)}c&&d.SetCharacterWidthsChanged(),this._runtime.UpdateRender()},SetEffect(a){this.GetWorldInfo().SetBlendMode(a),this._runtime.UpdateRender()},SetHAlign(a){this._SetHAlign(a)},SetVAlign(a){this._SetVAlign(a)},SetWrapping(a){this._SetWrapByWord(0===a)}};
"use strict";C3.Plugins.Spritefont2.Exps={CharacterWidth(a){const b=this._sdkType.GetSpriteFont().GetCharacter(a);return b?b.GetDisplayWidth():this._sdkType.GetSpriteFont().GetCharacterWidth()},CharacterHeight(){return this._characterHeight},CharacterScale(){return this._characterScale},CharacterSpacing(){return this._characterSpacing},LineHeight(){return this._lineHeight},Text(){return this._text},PlainText(){return this._enableBBcode?C3.BBString.StripAnyTags(this._text):this._text},TextWidth(){const a=this.GetWorldInfo();return this._spriteFontText.SetSize(a.GetWidth(),a.GetHeight()),this._spriteFontText.GetTextWidth()},TextHeight(){const a=this.GetWorldInfo();return this._spriteFontText.SetSize(a.GetWidth(),a.GetHeight()),this._spriteFontText.GetTextHeight()}};
"use strict";{const a={width:256,height:256,characterWidth:16,characterHeight:16,characterSet:""};self.SpriteFont=class{constructor(b){if(b=Object.assign({},a,b),0>=b.width||0>=b.height||0>=b.characterWidth||0>=b.characterHeight)throw new 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 C3.Rect(0,0,1,1),this._characterMap=new Map,this._mapChanged=!0,this._allTexts=new Set}Release(){this._texRect=null,this._ReleaseCharacters(),this._characterMap=null,this._allTexts&&this._allTexts.clear(),this._allTexts=null}_ReleaseCharacters(){for(let a of this._characterMap.values())a.Release();this._characterMap.clear()}_AddSpriteFontText(a){this._allTexts.add(a)}_RemoveSpriteFontText(a){this._allTexts.delete(a)}UpdateCharacterMap(){var a=Math.floor;if(this._mapChanged){this._ReleaseCharacters();let b=[...this._characterSet],c=a(this._width/this._characterWidth),d=a(this._height/this._characterHeight);for(let e=0,f=b.length;e<f&&!(e>=c*d);++e){let d=e%c,f=a(e/c),g=b[e];this._characterMap.set(g,C3.New(SpriteFontCharacter,this,g,d*this._characterWidth,f*this._characterHeight))}if(this._hasAnyCustomWidths=!1,this._spaceWidth=-1,Array.isArray(this._spacingParsed))for(let a of this._spacingParsed){if(!Array.isArray(a))continue;if(2!==a.length)continue;let b=a[0],c=a[1];if("number"==typeof b&&isFinite(b)&&"string"==typeof c&&b!==this._characterWidth)for(let a of c){let c=this._characterMap.get(a);c?(c.SetDisplayWidth(b),this._hasAnyCustomWidths=!0):" "===a&&(this._spaceWidth=b,this._hasAnyCustomWidths=!0)}}this._mapChanged=!1;for(let a of this._allTexts)a._SetWrapChanged()}}SetCharacterWidthsChanged(){this._hasAnyCustomWidths=!0;for(const a of this._allTexts)a._SetWrapChanged()}GetCharacter(a){return this.UpdateCharacterMap(),this._characterMap.get(a)||null}HasAnyCustomWidths(){return this._hasAnyCustomWidths}SetWidth(a){if(a=Math.floor(a),0>=a)throw new Error("invalid size");this._width===a||(this._width=a,this._mapChanged=!0)}GetWidth(){return this._width}SetHeight(a){if(a=Math.floor(a),0>=a)throw new Error("invalid size");this._height===a||(this._height=a,this._mapChanged=!0)}GetHeight(){return this._height}SetTexRect(a){if(!this._texRect.equals(a)){this._texRect.copy(a);for(const a of this._characterMap.values())a._UpdateTexRect()}}GetTexRect(){return this._texRect}SetCharacterWidth(a){if(a=Math.floor(a),0>=a)throw new Error("invalid size");this._characterWidth===a||(this._characterWidth=a,this._mapChanged=!0)}GetCharacterWidth(){return this._characterWidth}SetCharacterHeight(a){if(a=Math.floor(a),0>=a)throw new Error("invalid size");this._characterHeight===a||(this._characterHeight=a,this._mapChanged=!0)}GetCharacterHeight(){return this._characterHeight}SetCharacterSet(a){this._characterSet===a||(this._characterSet=a,this._mapChanged=!0)}GetCharacterSet(){return this._characterSet}SetSpacingData(a){if(this._spacingData!==a&&(this._spacingData=a,this._mapChanged=!0,this._spacingParsed=null,this._spacingData.length))try{this._spacingParsed=JSON.parse(this._spacingData)}catch(a){this._spacingParsed=null}}GetSpacingData(){return this._spacingData}SetSpaceWidth(a){0>a&&(a=-1);this._spaceWidth===a||(this._spaceWidth=a,0<=this._spaceWidth&&(this._hasAnyCustomWidths=!0))}GetSpaceWidth(){return 0>this._spaceWidth?this._characterWidth:this._spaceWidth}}}
"use strict";self.SpriteFontCharacter=class{constructor(a,b,c,d){let e=a.GetCharacterWidth(),f=a.GetCharacterHeight();this._spriteFont=a,this._char=b,this._pxRect=new C3.Rect(c,d,c+e,d+f),this._texRect=new C3.Rect,this._displayWidth=-1,this._UpdateTexRect()}Release(){this._spriteFont=null,this._pxRect=null,this._texRect=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 a=new C3.Rect,b=new C3.Quad,c=new C3.Color,d=new Set(["left","center","right"]),e=new Set(["top","center","bottom"]),f=new Set(["word","character"]);self.SpriteFontText=class{constructor(a){this._spriteFont=a,this._cssWidth=0,this._cssHeight=0,this._text="",this._isBBcodeEnabled=!1,this._bbString=null,this._wrappedText=C3.New(C3.WordWrap),this._wrapMode="word",this._wrapChanged=!1,this._horizontalAlign="left",this._verticalAlign="top",this._scale=1,this._spacing=0,this._lineHeight=0,this._color=C3.New(C3.Color),this._drawMaxCharCount=-1,this._drawCharCount=0,this._measureTextCallback=(a,b)=>this._MeasureText(a,b),this._spriteFont._AddSpriteFontText(this)}Release(){this._spriteFont._RemoveSpriteFontText(this),this._color=null,this._measureTextCallback=null,this._wrappedText.Clear(),this._wrappedText=null,this._spriteFont=null,this._bbString=null}_MeasureText(a,b){const c=this._GetStyleTag(b,"scale"),d=c?parseFloat(c.param):this._scale,e=this._GetStyleTag(b,"scalex"),f=(e?parseFloat(e.param):1)*d,g=this._GetStyleTag(b,"scaley"),h=(g?parseFloat(g.param):1)*d,i=this._spriteFont.GetCharacterHeight()*h+this._lineHeight,j=this.GetSpriteFont(),k=j.GetCharacterWidth()*f,l=this.GetSpacing();if(j.HasAnyCustomWidths()){let b=0,c=0;for(const d of a){let a=k;const e=j.GetCharacter(d);e?a=e.GetDisplayWidth()*f:" "===d&&(a=j.GetSpaceWidth()*f),c+=a,++b}return{width:c+b*l,height:i}}else{const b=[...a].length,c=Math.max(b,0);return{width:k*b+c*l,height:i}}}_SetWrapChanged(){this._wrapChanged=!0,this._wrappedText.Clear()}SetSize(a,b){0>=a||0>=b||this._cssWidth===a&&this._cssHeight===b||(this._cssWidth!==a&&this._SetWrapChanged(),this._cssWidth=a,this._cssHeight=b)}SetDrawMaxCharacterCount(a){this._drawMaxCharCount=Math.floor(a)}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(a,b){for(let c=a.length-1;0<=c;--c){const d=a[c];if(d.tag===b)return d}return null}_HasStyleTag(a,b){return!!this._GetStyleTag(a,b)}_MaybeWrapText(){if(this._wrapChanged){this._isBBcodeEnabled&&(!this._bbString||this._bbString.toString()!==this._text)&&(this._bbString=new C3.BBString(this._text,{noEscape:!0}));const a=-this.GetSpacing();this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,a),this._wrapChanged=!1}}Draw(a,b,c,d){var e=Math.floor;this._MaybeWrapText(),this._drawCharCount=0;let f=0;const g=this._lineHeight,h=C3.cloneArray(this._wrappedText.GetLines()),j=Math.sin(d),k=Math.cos(d),i=h.reduce((b,a)=>b+a.height,0)-g;"center"===this._verticalAlign?f=Math.max(e(this._cssHeight/2-i/2),0):"bottom"===this._verticalAlign&&(f=e(this._cssHeight-i));for(let e=0,i=h.length;e<i;++e){const d=h[e],i=d.height;if(0<e&&f>this._cssHeight-(i-g))break;0<=f&&this._DrawLine(a,d,b,c,f,j,k),f+=i}}_DrawLine(a,b,c,d,e,f,g){var h=Math.floor,i=Math.max;const j=b.height;let k=0;"center"===this._horizontalAlign?k=i(h((this._cssWidth-b.width)/2),0):"right"===this._horizontalAlign&&(k=i(h(this._cssWidth-b.width),0));for(const h of b.fragments)this._DrawFragment(a,h,c,d,k,e,f,g,j),k+=h.width}_DrawFragment(d,e,f,g,h,i,j,k,l){let m=e.text,n=e.width;const o=e.styles;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+m.length>this._drawMaxCharCount&&(m=m.substr(0,this._drawMaxCharCount-this._drawCharCount),n=this._MeasureText(m,o).width),this._drawCharCount+=m.length}const p=this._GetStyleTag(o,"background");if(!(C3.IsStringAllWhitespace(m)&&!p||this._HasStyleTag(o,"hide"))){const e=this._GetStyleTag(o,"scale"),q=e?parseFloat(e.param):this._scale,r=this._GetStyleTag(o,"scalex"),s=(r?parseFloat(r.param):1)*q,t=this._GetStyleTag(o,"scaley"),u=(t?parseFloat(t.param):1)*q,v=this._spriteFont.GetCharacterHeight()*u,w=this._lineHeight;i+=l-w-v;const x=this._GetStyleTag(o,"offsetx");h+=x?parseFloat(x.param):0;const y=this._GetStyleTag(o,"offsety");i+=y?parseFloat(y.param):0,p&&(d.SetColorFillMode(),c.parseString(p.param),c.setA(1),d.SetColor(c),a.set(h,i,h+n,i+v),a.getRight()>this._cssWidth&&a.setRight(this._cssWidth),b.setFromRotatedRectPrecalc(a,j,k),b.offset(f,g),d.Quad(b),d.SetTextureFillMode());const z=this._GetStyleTag(o,"color");z?(c.parseString(z.param),c.setA(this._color.getA())):c.copy(this._color);const A=this._GetStyleTag(o,"opacity");A&&c.setA(c.getA()*parseFloat(A.param)/100),c.premultiply(),d.SetColor(c);const B=this._spriteFont.GetCharacterWidth()*s,C=Math.abs(this.GetSpacing());for(const c of m){const e=this._spriteFont.GetCharacter(c);if(e){const c=e.GetDisplayWidth()*s;if(h+c>this._cssWidth+C+1e-5)return;a.set(h,i,h+B,i+v),b.setFromRotatedRectPrecalc(a,j,k),b.offset(f,g),d.Quad3(b,e.GetTexRect()),h+=c+this._spacing}else h+=this._spriteFont.GetSpaceWidth()*s+this._spacing}}}GetSpriteFont(){return this._spriteFont}SetBBCodeEnabled(a){a=!!a;this._isBBcodeEnabled===a||(this._isBBcodeEnabled=a,this._SetWrapChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetText(a){this._text===a||(this._text=a,this._SetWrapChanged())}SetWordWrapMode(a){if(!f.has(a))throw new Error("invalid word wrap mode");this._wrapMode===a||(this._wrapMode=a,this._SetWrapChanged())}SetHorizontalAlign(b){if(!d.has(b))throw new Error("invalid alignment");this._horizontalAlign=b}SetVerticalAlign(b){if(!e.has(b))throw new Error("invalid alignment");this._verticalAlign=b}SetScale(a){this._scale===a||(this._scale=a,this._SetWrapChanged())}GetScale(){return this._scale}SetSpacing(a){this._spacing===a||(this._spacing=a,this._SetWrapChanged())}GetSpacing(){return this._spacing}SetLineHeight(a){this._lineHeight=a,this._SetWrapChanged()}GetLineHeight(){return this._lineHeight}SetOpacity(a){a=C3.clamp(a,0,1),this._color.a=a}SetColor(a){this._color.equals(a)||this._color.copy(a)}GetColor(){return this._color}GetTextWidth(){return this._MaybeWrapText(),this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();const a=this._spriteFont.GetCharacterHeight()*this._scale,b=this._lineHeight;return this._wrappedText.GetLineCount()*(a+b)-b}}}
"use strict";C3.Plugins.Json=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Json.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";C3.Plugins.Json.Instance=class extends C3.SDKInstanceBase{constructor(a){super(a),this._valueCache=[null,null],this._locationCache=[null,null],this._data={},this._path=[],this._currentKey="",this._currentValue=0}Release(){super.Release()}_InvalidateValueCache(){this._valueCache[0]=null,this._valueCache[1]=null}_HasValueCache(a){return null!==a&&null!==this._valueCache[0]&&(this._valueCache[0]===a||C3.arraysEqual(this._valueCache[0],a))}_GetValueCache(){return this._valueCache[1]}_UpdateValueCache(a,b){this._valueCache[0]=a,this._valueCache[1]=b}_InvalidateLocationCache(){this._locationCache[0]=null,this._locationCache[1]=null}_HasLocationCache(a){return this._locationCache[0]===a}_GetLocationCache(){return this._locationCache[1]}_UpdateLocationCache(a,b){this._locationCache[0]=a,this._locationCache[1]=b}_SetData(a){this._data=a,this._InvalidateValueCache()}_SetPath(a){this._path=this._ParsePathUnsafe(a),this._InvalidateLocationCache()}_ParsePath(a){return C3.cloneArray(this._ParsePathUnsafe(a))}_ParsePathUnsafe(a){const b=[];let d,e=!1;if(this._HasLocationCache(a))return this._GetLocationCache();"."===a[0]?(d=C3.cloneArray(this._path),a=a.slice(1)):d=[];for(const f of a)e?(b.push(f),e=!1):"\\"===f?e=!0:"."===f?(d.push(b.join("")),C3.clearArray(b)):b.push(f);return 0!==b.length&&d.push(b.join("")),this._UpdateLocationCache(a,d),d}_GetValueAtFullPath(a,b){if(this._HasValueCache(a))return this._GetValueCache();let c=this._data;for(const d of a)if(Array.isArray(c)){const a=parseInt(d,10);if(0>a||a>=c.length||!isFinite(a)){c=null;break}c=c[a]}else if("object"!=typeof c||null===c){c=null;break}else if(c.hasOwnProperty(d))c=c[d];else if(b){const a={};c[d]=a,c=a}else{c=null;break}return this._UpdateValueCache(a,c),c}_GetValue(a){const b=this._ParsePath(a);if(!b.length)return this._data;const c=b.pop(),d=this._GetValueAtFullPath(b,!1);if(Array.isArray(d)){const a=parseInt(c,10);return 0<=a&&a<d.length?d[a]:null}return"object"==typeof d&&null!==d?d.hasOwnProperty(c)?d[c]:null:null}_JSONTypeOf(a){return null===a?"null":Array.isArray(a)?"array":typeof a}_GetTypeOf(a){const b=this._GetValue(a);return this._JSONTypeOf(b)}_ToSafeValue(a){const b=typeof a;return"number"==b||"string"==b?a:"boolean"==b?a?1:0:0}_GetSafeValue(a){return this._ToSafeValue(this._GetValue(a))}_HasKey(a){const b=this._ParsePath(a);if(!b.length)return!1;const c=b.pop(),d=this._GetValueAtFullPath(b,!1);if(Array.isArray(d)){const a=parseInt(c,10);return 0<=a&&a<d.length}return"object"==typeof d&&null!==d&&d.hasOwnProperty(c)}_SetValue(a,b){const c=this._ParsePath(a);if(!c.length)return!1;this._HasValueCache(c)&&this._InvalidateValueCache();const d=c.pop(),e=this._GetValueAtFullPath(c,!0);if(Array.isArray(e)){const a=parseInt(d,10);return!(!isFinite(a)||0>a||a>=e.length)&&(e[a]=b,!0)}return"object"==typeof e&&null!==e&&(e[d]=b,!0)}_DeleteKey(a){const b=this._ParsePath(a);if(!b.length)return!1;this._HasValueCache(b)&&this._InvalidateValueCache();const c=b.pop(),d=this._GetValueAtFullPath(b,!1);return!Array.isArray(d)&&"object"==typeof d&&null!==d&&(delete d[c],!0)}SaveToJson(){return{"path":this._path,"data":this._data}}LoadFromJson(a){this._InvalidateValueCache(),this._InvalidateLocationCache(),this._path=a["path"],this._data=a["data"]}_SanitizeValue(a){return"number"==typeof a?isFinite(a)?a:0:"object"==typeof a?JSON.stringify(a):a+""}GetDebuggerProperties(){let a;try{a=this._SanitizeValue(this._data)}catch(b){a="\"invalid\""}return[{title:"plugins.json.debugger.title",properties:[{name:"plugins.json.debugger.data",value:a,onedit:(a)=>{try{const b=JSON.parse(a);this._SetData(b)}catch(a){}}},{name:"plugins.json.debugger.path",value:this._path.map((a)=>a.replace(/\./g,"\\.")).join(".")}]}]}};
"use strict";{const a=["null","boolean","number","string","object","array"];C3.Plugins.Json.Cnds={HasKey(a){return this._HasKey(a)},CompareType(b,c){return this._GetTypeOf(b)===a[c]},CompareValue(a,b,c){return C3.compare(this._GetSafeValue(a),b,c)},IsBooleanSet(a){return!0===this._GetValue(a)},ForEach(a){const b=this._GetValue(a);if("object"!=typeof b||null===b)return!1;const c=this._runtime,d=c.GetEventSheetManager(),e=c.GetCurrentEvent(),f=e.GetSolModifiers(),g=c.GetEventStack(),h=g.GetCurrentStackFrame(),i=g.Push(e),j=this._path,k=this._currentKey,l=this._currentValue,m=this._ParsePathUnsafe(a);c.SetDebuggingEnabled(!1);for(const[c,g]of Object.entries(b))this._path=C3.cloneArray(m),this._path.push(c),this._currentKey=c,this._currentValue=g,d.PushCopySol(f),e.Retrigger(h,i),d.PopSol(f);return c.SetDebuggingEnabled(!0),this._path=j,this._currentKey=k,this._currentValue=l,g.Pop(),!1},OnParseError(){return!0}}}
"use strict";C3.Plugins.Json.Acts={Parse(a){try{this._SetData(JSON.parse(a))}catch(a){console.warn("[JSON plugin] Failed to parse JSON data: ",a),this._SetData({}),this.Trigger(C3.Plugins.Json.Cnds.OnParseError)}},SetPath(a){this._SetPath(a)},SetValue(a,b){this._SetValue(a,b)},SetArray(a,b){let c=this._GetValue(a);Array.isArray(c)?C3.resizeArray(c,b,0):(c=[],C3.extendArray(c,b,0),this._SetValue(a,c))},SetObject(a){this._SetValue(a,{})},SetJSON(a,b){let c=null;try{c=JSON.parse(b)}catch(a){console.warn("[JSON plugin] Failed to parse JSON data: ",a),this.Trigger(C3.Plugins.Json.Cnds.OnParseError)}this._SetValue(a,c)},SetNull(a){this._SetValue(a,null)},SetBoolean(a,b){this._SetValue(a,0!==b)},ToggleBoolean(a){const b=this._GetValue(a);"boolean"==typeof b&&this._SetValue(a,!b)},AddTo(a,b){const c=this._GetValue(a);"number"==typeof c&&this._SetValue(a,c+b)},SubtractFrom(a,b){const c=this._GetValue(a);"number"==typeof c&&this._SetValue(a,c-b)},DeleteKey(a){this._DeleteKey(a)},PushValue(a,b,c){const d=this._GetValue(b);Array.isArray(d)&&(0===a?d.push(c):d.unshift(c))},PopValue(a,b){const c=this._GetValue(b);Array.isArray(c)&&(0===a?c.pop():c.shift())},InsertValue(a,b,c){const d=this._GetValue(b);Array.isArray(d)&&d.splice(c,0,a)},RemoveValues(a,b,c){const d=this._GetValue(b);Array.isArray(d)&&d.splice(c,a)}};
"use strict";C3.Plugins.Json.Exps={ToCompactString(){try{return JSON.stringify(this._data)}catch(a){return""}},ToBeautifiedString(){try{return JSON.stringify(this._data,null,4)}catch(a){return""}},Get(a){return this._GetSafeValue(a)},GetAsCompactString(a){const b=this._GetValue(a);return JSON.stringify(b)},GetAsBeautifiedString(a){const b=this._GetValue(a);return JSON.stringify(b,null,4)},Front(a){const b=this._GetValue(a);if(Array.isArray(b)){const a=b[0];return this._ToSafeValue(a)}return-1},Back(a){const b=this._GetValue(a);if(Array.isArray(b)){const a=b[b.length-1];return this._ToSafeValue(a)}return-1},Type(a){return this._GetTypeOf(a)},ArraySize(a){const b=this._GetValue(a);return Array.isArray(b)?b.length:-1},Path(){return this._path.map((a)=>a.replace(/\./g,"\\.")).join(".")},CurrentKey(){return this._currentKey},CurrentValue(){return this._ToSafeValue(this._currentValue)},CurrentType(){return this._JSONTypeOf(this._currentValue)}};
"use strict";C3.Plugins.Timeline=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Timeline.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";C3.Plugins.Timeline.Instance=class extends C3.SDKInstanceBase{constructor(a){super(a),this.GetRuntime().GetTimelineManager().SetPluginInstance(a)}Release(){super.Release()}};
"use strict";{let a=null,b=null;C3.Plugins.Timeline.Cnds={SetTriggerTimeline(b){a=b},GetTriggerTimeline(){return a},SetTriggerKeyframe(a){b=a},GetTriggerKeyframe(){return b},OnTimelineStarted(b){return a===b},OnTimelineStartedByName(b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByName(b))if(C3.equalsNoCase(a.GetName(),d.GetName()))return!0;return!1},OnTimelineStartedByTags(b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByTags(b))if(d.HasTags(a.GetTags()))return!0;return!1},OnAnyTimelineStarted(){return!0},OnTimelineFinished(b){return a===b},OnTimelineFinishedByName(b){for(const c of timelineManager.GetTimelinesByName(b))if(C3.equalsNoCase(a.GetName(),c.GetName()))return!0;return!1},OnTimelineFinishedByTags(b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByTags(b))if(d.HasTags(a.GetTags()))return!0;return!1},OnAnyTimelineFinished(){return!0},IsPlaying(a){return a.IsPlaying()},IsPlayingByName(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByName(a))if(c.IsPlaying())return!0;return!1},IsPlayingByTags(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByTags(a))if(c.IsPlaying())return!0;return!1},IsAnyPlaying(){const a=[...this._runtime.GetTimelineManager().GetTimelines()];return a?a.some((a)=>a.IsPlaying()):void 0},OnTimeSet(b){return a===b},OnTimeSetByName(b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByName(b))if(a===d)return!0;return!1},OnTimeSetByTags(b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByTags(b))if(a===d)return!0;return!1},OnAnyKeyframeReached(){return!!b},OnKeyframeReached(a,c){if(!b)return!1;if(0===b.GetTags().length||!a)return!1;const d=a?a.split(" "):[];if(0===c){for(const a of d)if(b.HasTag(a))return!0;return!1}for(const e of d)if(!b.HasTag(e))return!1;return!0}}}
"use strict";{const a=new Map,b=(a,b)=>{for(const c of a)b.SetTrackInstance(c.trackId,c.instance)},c=()=>{const b=[];for(const[c,d]of a.entries()){const a=c.GetCurrentSol().GetInstances(),e=d.trackIds.length;for(let c=0;c<e;c++)a[d.startIndex+c]&&b.push({trackId:d.trackIds[c],instance:a[d.startIndex+c]});d.startIndex+=e}return b};C3.Plugins.Timeline.Acts={async PlayTimeline(d,e,f){if(!d)return void(f||a.clear());const g=this._runtime.GetTimelineManager();let h;const i=[];if(a.size){let a=c();do a.length&&(h=g.GetTimelineOfTemplateForInstances(d,a),!h&&(h=g.CreateFromTemplate(d),h.ClearTrackInstances(),b(a,h)),h.SetTags(e),h.Play()&&i.push(h.GetPlayPromise()),a=c());while(a.length)}else d.SetTags(e),d.Play()&&i.push(d.GetPlayPromise());f||a.clear(),await Promise.all(i)},async PlayTimelineByName(b,c){const d=this._runtime.GetTimelineManager(),e=[];for(const a of d.GetTimelinesByName(b))e.push(C3.Plugins.Timeline.Acts.PlayTimeline.call(this,a,c,!0));a.clear(),await Promise.all(e)},async PlayAllTimelines(){const b=this._runtime.GetTimelineManager(),c=[];for(const a of b.GetTimelines())a.Play()&&c.push(a.GetPlayPromise());a.clear(),await Promise.all(c)},PauseTimeline(a){a&&a.Stop()},PauseTimelineByName(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByName(a))C3.Plugins.Timeline.Acts.PauseTimeline.call(this,c)},PauseTimelineByTags(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByTags(a))C3.Plugins.Timeline.Acts.PauseTimeline.call(this,c)},PauseAllTimelines(){const a=this._runtime.GetTimelineManager();for(const b of a.GetTimelines())b.Stop()},ResumeTimeline(a){a&&a.Resume()},ResumeTimelineByName(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByName(a))C3.Plugins.Timeline.Acts.ResumeTimeline.call(this,c)},ResumeTimelineByTags(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByTags(a))C3.Plugins.Timeline.Acts.ResumeTimeline.call(this,c)},ResumeAllTimelines(){const a=this._runtime.GetTimelineManager();for(const b of a.GetTimelines())b.Resume()},StopTimeline(a){a&&a.Reset()},StopTimelineByName(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByName(a))C3.Plugins.Timeline.Acts.StopTimeline.call(this,c)},StopTimelineByTags(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByTags(a))C3.Plugins.Timeline.Acts.StopTimeline.call(this,c)},StopAllTimelines(){const a=this._runtime.GetTimelineManager();for(const b of a.GetTimelines())b.Reset()},SetTimelineTime(a,b){if(a)if(C3.IsFiniteNumber(b))a.SetTime(b);else if(C3.IsString(b)){const c=a.GetKeyframeWithTags(b);c?a.SetTime(c.GetTime()):C3.Plugins.Timeline.Acts.SetTimelineTime.call(this,a,+b)}},SetTimelineTimeByName(a,b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByName(a))C3.Plugins.Timeline.Acts.SetTimelineTime.call(this,d,b)},SetTimelineTimeByTags(a,b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByTags(a))C3.Plugins.Timeline.Acts.SetTimelineTime.call(this,d,b)},SetTimelinePlaybackRate(a,b){a&&a.SetPlaybackRate(b)},SetTimelinePlaybackRateByName(a,b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByName(a))C3.Plugins.Timeline.Acts.SetTimelinePlaybackRate.call(this,d,b)},SetTimelinePlaybackRateByTags(a,b){const c=this._runtime.GetTimelineManager();for(const d of c.GetTimelinesByTags(a))C3.Plugins.Timeline.Acts.SetTimelinePlaybackRate.call(this,d,b)},SetInstance(b,c){a.has(b)||a.set(b,{startIndex:0,trackIds:[]}),a.get(b).trackIds.push(c)}}}
"use strict";C3.Plugins.Timeline.Exps={Time(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByName(a))return c.GetTime();for(const c of b.GetTimelinesByTags(a))return c.GetTime();return 0},TotalTime(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByName(a))return c.GetTotalTime();for(const c of b.GetTimelinesByTags(a))return c.GetTotalTime();return 0},Progress(a){const b=this._runtime.GetTimelineManager();for(const c of b.GetTimelinesByName(a))return c.GetTime()/c.GetTotalTime();for(const c of b.GetTimelinesByTags(a))return c.GetTime()/c.GetTotalTime();return 0},KeyframeTags(){const a=C3.Plugins.Timeline.Cnds.GetTriggerKeyframe();return a?a.GetTags().join(" "):""},TimelineName(){const a=C3.Plugins.Timeline.Cnds.GetTriggerTimeline();return a?a.GetName():""},TimelineTags(){const a=C3.Plugins.Timeline.Cnds.GetTriggerTimeline();return a?a.GetStringTags():""}};
"use strict";
{
C3.Plugins.CV_Process = class SingleGlobalPlugin extends C3.SDKPluginBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.CV_Process.Type = class SingleGlobalType extends C3.SDKTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{
}
};
}
"use strict";
{
C3.Plugins.CV_Process.Instance = class SingleGlobalInstance extends C3.SDKInstanceBase
{
constructor(inst, properties)
{
super(inst);
// Initialise object properties
this.DebugMode = false;
if (properties)
{
/////// References
this.DebugMode = properties[0] === 0 ? true : false;
/////// References
this.Conditions = C3.Plugins.CV_Process.Cnds;;
/////// Memory
this.C3Memory = {
TaskStack : [],
FuncStack : [],
Processes : {},
CompletedProcess : [],
CurrentProcess : "",
ProcessDictionary : {},
Current : ""
};
var self = this;
//// .... Call Trigger
this.Call = function (_path) {
const trigger = _path;
self.Trigger(trigger);
};
}
}
Release()
{
super.Release();
}
SaveToJson()
{
return {};
}
LoadFromJson(o)
{
}
///////////////////////////////////////
///// CUSTOM PROTOTYPE FUNCTIONS
DebugLog (_log)
{
if (this.DebugMode) { console.log(_log); }
}
HasObject (_obj)
{
return typeof _obj !== "undefined";
}
HasProperty (_obj, _target)
{
return _obj.hasOwnProperty(_target);
}
CountProperties (_obj)
{
var count = 0;
for (var o in _obj)
{
if (this.HasProperty(_obj, o))
count++;
}
return count;
}
ClampPercentage (_percentage)
{
if (_percentage < 0)
{
return 0;
}
else if (_percentage > 100)
{
return 100;
}
else
{
return _percentage;
}
}
StartProgress (_process)
{
var base = this.C3Memory.Processes[_process];
for (var o in base)
{
if (this.HasProperty(base, o))
{
//.... Function Call
var fnc = base[o].FunctionName;
if (fnc !== "")
{
if (window["c3_callFunction"])
{
window["c3_callFunction"](fnc, []);
}
this.C3Memory.Current = fnc;
this.Call(this.Conditions.OnTaskFunction);
}
}
}
}
EvaluateProgress (_process)
{
var base = this.C3Memory.Processes[_process];
var baseCount = this.CountProperties(base);
var targetTotal = 0;
for (var o in base)
{
if (this.HasProperty(base, o))
{
//.... Get Total Progress Data
targetTotal += base[o].Percentage;
}
}
////////////////////////////
///// READY ARRAY DATA
//.... Base Total
var baseTotal = 100 * baseCount;
//.... Set Total Percentage
var totalPercentage = (targetTotal / baseTotal) * 100;
this.DebugLog("Target Total :: ");
this.DebugLog(targetTotal);
this.DebugLog("Base Total :: ");
this.DebugLog(baseTotal);
this.DebugLog("Total Percentage :: ");
this.DebugLog(targetTotal);
//////////////////////////////////
///// RETURN TOTAL PERCENTAGE DATA
return totalPercentage;
}
HasArrayValue (_value, _array)
{
return _array.indexOf(_value) >= 0;
}
///////////////////////////////////////
};
}
"use strict";
{
C3.Plugins.CV_Process.Cnds =
{
HasTask (_process, _task)
{
var process = _process.toLowerCase();
var task = _task.toLowerCase();
var base = this.C3Memory.Processes;
if ( !this.HasObject(base[process]) ) { return false; }
return this.HasObject(base[process][task]);
},
OnTaskCompleted (_process)
{
var process = _process.toLowerCase();
var base = this.C3Memory.CurrentProcess;
return base === process;
},
OnAnyTaskCompleted () { return true; },
OnProgress (_process)
{
var process = _process.toLowerCase();
var base = this.C3Memory.CurrentProcess;
return base === process;
},
OnAnyProgress () { return true; },
OnProcessCompleted (_process)
{
var process = _process.toLowerCase();
var base = this.C3Memory.CurrentProcess;
return base === process;
},
OnAnyProcessCompleted () { return true; },
OnStartProcess (_process)
{
var process = _process.toLowerCase();
var base = this.C3Memory.CurrentProcess;
return base === process;
},
OnAnyStartProcess () { return true; },
IsProcessing (_process)
{
var process = _process.toLowerCase();
var base = this.C3Memory.CurrentProcess;
if ( base !== process ) { return false; }
else if ( !this.HasObject( this.C3Memory.ProcessDictionary[process] ) ) { return false; }
else if ( !this.HasObject( this.C3Memory.ProcessDictionary[process].IsProcessing) ) { return false; }
else
{
var toggle = this.C3Memory.ProcessDictionary[process].IsProcessing;
return toggle;
}
},
IsCompleted (_process)
{
var process = _process.toLowerCase();
var base = this.C3Memory.CompletedProcess;
return (this.HasArrayValue(process, base) );
},
OnTaskFunction (_func)
{
const func = _func.toLowerCase();
return this.C3Memory.Current === func;
}
};
}
"use strict";
{
C3.Plugins.CV_Process.Acts =
{
AddTask (_task)
{
var task = _task.toLowerCase();
this.C3Memory.TaskStack.push(task);
this.C3Memory.FuncStack.push("");
},
AddSpecialTask (_task, _func)
{
var task = _task.toLowerCase();
var func = _func.toLowerCase();
this.C3Memory.TaskStack.push(task);
this.C3Memory.FuncStack.push(func);
},
SetTaskState (_process, _task, _percentage)
{
//////////////////////////
//// PROCESS ARGUMENT DATA
var percentage = this.ClampPercentage(_percentage);
var process = _process.toLowerCase();
var task = _task.toLowerCase();
//////////////////////////
//// ERROR CHECKING
if ( !this.HasObject(this.C3Memory.Processes[process]) )
{
this.DebugLog("SET TASK STATE :: Cancelled due to the process \"" + process + "\" not existing.");
return;
}
if ( !this.HasObject(this.C3Memory.Processes[process][task]) )
{
this.DebugLog("SET TASK STATE :: Cancelled due to the task \"" + task + "\" of the process \"" + process + "\", not existing.");
return;
}
//////////////////////////
//// GET OLD DATA
var oldPercentage = this.C3Memory.Processes[process][task].Percentage;
var oldTotalPercentage = this.C3Memory.ProcessDictionary[process].TotalPercentage;
//////////////////////////
//// GET OTHER DATA
var functionName = this.C3Memory.Processes[process][task].FunctionName;
//////////////////////////
//// WRITE DATA [TASK PERCENTAGE]
this.C3Memory.Processes[process][task].Percentage = percentage;
//////////////////////////
//// RE-EVALUATE PROCESS DATA
var data = this.EvaluateProgress(process);
var totalPercentage = data;
/////////////////////////////////
//// LOG DATA TO CONSOLE TO DEBUG
this.DebugLog(this.C3Memory);
//////////////////////////
//// ASSESS PROCESS DATA
if (oldTotalPercentage !== totalPercentage)
{
////////////////////////////////////////////
//// STORE MEMORY [CURRENT PROCESS]
this.C3Memory.CurrentProcess = process;
////////////////////////////////////////////
//// STORE PROCESS MEMORY [TOTAL PERCENTAGE]
this.C3Memory.ProcessDictionary[process].TotalPercentage = totalPercentage;
/////////////////////////////////////////////////
//// STORE PROCESS TASK MEMORY [TOTAL PERCENTAGE]
this.C3Memory.ProcessDictionary[process].CurrentTask = task;
this.C3Memory.ProcessDictionary[process].CurrentTaskPercentage = percentage;
this.C3Memory.ProcessDictionary[process].CurrentTaskFunction = functionName;
this.Call(this.Conditions.OnProgress);
this.Call(this.Conditions.OnAnyProgress);
}
//////////////////////////
//// TRIGGER TASK COMPLETE [If Applicable]
if ( (oldPercentage !== percentage) && percentage === 100)
{
this.Call(this.Conditions.OnTaskCompleted);
this.Call(this.Conditions.OnAnyTaskCompleted);
}
//////////////////////////
//// TRIGGER PROCESS COMPLETE [If Applicable]
if ( (oldTotalPercentage !== totalPercentage) && totalPercentage === 100)
{
this.C3Memory.ProcessDictionary[process].IsProcessing = false;
//////////////////////////////////
//// ADD PROCESS TO COMPLETED LIST
this.C3Memory.CompletedProcess.push(process);
this.Call(this.Conditions.OnProcessCompleted);
this.Call(this.Conditions.OnAnyProcessCompleted);
}
},
StartProcess (_process)
{
//////////////////////////
//// PROCESS ARGUMENT DATA
var process = _process.toLowerCase();
//////////////////////////
//// REMOVE FROM COMPLETED
//// PROCESS LIST
var base = this.C3Memory.CompletedProcess;
if (this.HasArrayValue(process, base))
{
var index = base.indexOf(process);
this.C3Memory.CompletedProcess.splice(index);
}
var tasks = this.C3Memory.TaskStack;
var funcs = this.C3Memory.FuncStack;
//....... Optional Error Check :: Start
if (!tasks.length === funcs.length) { return; }
if (tasks.length === 0) { return; }
//....... Optional Error Check :: End
////////////////////////////////////////////
//// STORE MEMORY [CURRENT PROCESS]
this.C3Memory.CurrentProcess = process;
///////////////////////////////////////
//// CREATE OR CLEAR PROCESS DICTIONARY
this.C3Memory.Processes[process] = {};
this.C3Memory.ProcessDictionary[process] = {};
this.C3Memory.ProcessDictionary[process].TotalPercentage = 0;
this.C3Memory.ProcessDictionary[process].CurrentTask = "";
this.C3Memory.ProcessDictionary[process].CurrentTaskPercentage = 0;
this.C3Memory.ProcessDictionary[process].CurrentTaskFunction = "";
this.C3Memory.ProcessDictionary[process].IsProcessing = false;
for (var i = 0 ; i < tasks.length ; i++)
{
var curTask = tasks[i];
var curFunc = funcs[i];
this.C3Memory.Processes[process][curTask] = {};
this.C3Memory.Processes[process][curTask].Percentage = 0;
this.C3Memory.Processes[process][curTask].FunctionName = curFunc;
}
//..... Clear
this.C3Memory.TaskStack = [];
this.C3Memory.FuncStack = [];
/////////////////////////////
///// Start Process
//..... Signal Processing toggle
this.C3Memory.ProcessDictionary[process].IsProcessing = true;
//..... Update
this.StartProgress(process);
//..... Trigger Start
this.Call(this.Conditions.OnStartProcess);
this.Call(this.Conditions.OnAnyStartProcess);
}
};
}
"use strict";
{
C3.Plugins.CV_Process.Exps =
{
CurrentTask (_process)
{
var fallback = "";
var process = _process.toLowerCase();
if ( !this.HasObject( this.C3Memory.ProcessDictionary[process] ) ) { return (fallback); }
else if ( !this.HasObject( this.C3Memory.ProcessDictionary[process].CurrentTask) ) { return (fallback); }
else
{
var output = this.C3Memory.ProcessDictionary[process].CurrentTask;
return ( output );
}
},
CurrentPercentage (_process)
{
var fallback = 0;
var process = _process.toLowerCase();
if ( !this.HasObject( this.C3Memory.ProcessDictionary[process] ) ) { return (fallback); }
else if ( !this.HasObject( this.C3Memory.ProcessDictionary[process].CurrentTaskPercentage) ) { return (fallback); }
else
{
var output = this.C3Memory.ProcessDictionary[process].CurrentTaskPercentage;
return ( output );
}
},
CurrentFunction (_process)
{
var fallback = "";
var process = _process.toLowerCase();
if ( !this.HasObject( this.C3Memory.ProcessDictionary[process] ) ) { return (fallback); }
else if ( !this.HasObject( this.C3Memory.ProcessDictionary[process].CurrentTaskFunction) ) { return (fallback); }
else
{
var output = this.C3Memory.ProcessDictionary[process].CurrentTaskFunction;
return ( output );
}
},
CurrentProcess ()
{
var output = this.C3Memory.CurrentProcess;
return ( output );
},
TotalPercentage (_process)
{
var fallback = 0;
var process = _process.toLowerCase();
if ( !this.HasObject( this.C3Memory.ProcessDictionary[process] ) ) { return (fallback); }
else if ( !this.HasObject( this.C3Memory.ProcessDictionary[process].TotalPercentage) ) { return (fallback); }
else
{
var output = this.C3Memory.ProcessDictionary[process].TotalPercentage;
return ( output );
}
}
};
}
"use strict";
{
C3.Plugins.CV_Tick = class CV_TickPlugin extends C3.SDKPluginBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.CV_Tick.Type = class CV_TickType extends C3.SDKTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{}
};
}
"use strict";
{
C3.Plugins.CV_Tick.Instance = class CV_TickInstance extends C3.SDKInstanceBase
{
constructor(inst, properties)
{
super(inst);
if (properties)
{}
}
Release()
{
super.Release();
}
SaveToJson()
{
return {};
}
LoadFromJson(o)
{}
GetDebuggerProperties()
{
return [];
}
};
}
"use strict";
{
C3.Plugins.CV_Tick.Cnds = {
EveryXTicks(tickInterval)
{
const rounded = Math.round(tickInterval);
const ticks = rounded < 1 ? 1 : rounded;
return this.GetRuntime().GetTickCount() % ticks === 0;
}
};
}
"use strict";
{
C3.Plugins.CV_Tick.Acts = {
};
}
"use strict";
{
C3.Plugins.CV_Tick.Exps = {
};
}
"use strict";
{
C3.Plugins.CV_Engine = class CV_EnginePlugin extends C3.SDKPluginBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Plugins.CV_Engine.Type = class CV_EngineType extends C3.SDKTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{}
};
}
"use strict";
{
C3.Plugins.CV_Engine.Instance = class CV_EngineInstance extends C3.SDKInstanceBase
{
constructor(inst, properties)
{
super(inst);
if (properties)
{}
}
Release()
{
super.Release();
}
SaveToJson()
{
return {
// data to be saved for savegames
};
}
LoadFromJson(o)
{
// load state for savegames
}
GetDebuggerProperties()
{
return [];
}
};
}
"use strict";
{
C3.Plugins.CV_Engine.Cnds = {
};
}
"use strict";
{
C3.Plugins.CV_Engine.Acts = {
};
}
"use strict";
{
C3.Plugins.CV_Engine.Exps = {
Map(value, fromLow, fromHigh, toLow, toHigh)
{
return (value - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow;
},
AngleToRad(degrees)
{
return degrees * (Math.PI / 180);
},
RadToAngle(radians)
{
return radians * (180 / Math.PI);
},
Trim2(text)
{
return text.replace(/\s/g, "");
}
};
}
"use strict";{C3.Plugins.TextBox=class extends C3.SDKDOMPluginBase{constructor(a){super(a,"text-input"),this.AddElementMessageHandler("click",(a,b)=>a._OnClick(b)),this.AddElementMessageHandler("dblclick",(a,b)=>a._OnDoubleClick(b)),this.AddElementMessageHandler("change",(a,b)=>a._OnChange(b))}Release(){super.Release()}}}
"use strict";C3.Plugins.TextBox.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{const a=0,b=["text","password","email","number","tel","url","textarea","search"];C3.Plugins.TextBox.Instance=class extends C3.SDKDOMInstanceBase{constructor(c,d){super(c,"text-input"),this._text="",this._placeholder="",this._title="",this._isEnabled=!0,this._isReadOnly=!1,this._spellCheck=!1,this._type="text",this._autoFontSize=!0,this._id="",d&&(this._text=d[a],this._placeholder=d[1],this._title=d[2],this.GetWorldInfo().SetVisible(d[3]),this._isEnabled=d[4],this._isReadOnly=d[5],this._spellCheck=d[6],this._type=b[d[7]],this._autoFontSize=d[8],this._id=d[9]),this.CreateElement({"type":this._type,"id":this._id})}Release(){super.Release()}GetElementState(){return{"text":this._text,"placeholder":this._placeholder,"title":this._title,"isEnabled":this._isEnabled,"isReadOnly":this._isReadOnly,"spellCheck":this._spellCheck}}async _OnClick(){this.GetScriptInterface().dispatchEvent(C3.New(C3.Event,"click",!0)),await this.TriggerAsync(C3.Plugins.TextBox.Cnds.OnClicked)}async _OnDoubleClick(){this.GetScriptInterface().dispatchEvent(C3.New(C3.Event,"dblclick",!0)),await this.TriggerAsync(C3.Plugins.TextBox.Cnds.OnDoubleClicked)}async _OnChange(a){this._text=a["text"],this.GetScriptInterface().dispatchEvent(C3.New(C3.Event,"change",!0)),await this.TriggerAsync(C3.Plugins.TextBox.Cnds.OnTextChanged)}_SetText(a){this._text===a||(this._text=a,this.UpdateElementState())}_GetText(){return this._text}_SetPlaceholder(a){this._placeholder===a||(this._placeholder=a,this.UpdateElementState())}_GetPlaceholder(){return this._placeholder}_SetTooltip(a){this._title===a||(this._title=a,this.UpdateElementState())}_GetTooltip(){return this._title}_SetEnabled(a){a=!!a;this._isEnabled===a||(this._isEnabled=a,this.UpdateElementState())}_IsEnabled(){return this._isEnabled}_SetReadOnly(a){a=!!a;this._isReadOnly===a||(this._isReadOnly=a,this.UpdateElementState())}_IsReadOnly(){return this._isReadOnly}_ScrollToBottom(){this.PostToDOMElement("scroll-to-bottom")}Draw(){}SaveToJson(){return{"t":this._text,"p":this._placeholder,"ti":this._title,"e":this._isEnabled,"r":this._isReadOnly,"sp":this._spellCheck,"type":this._type,"id":this._id}}LoadFromJson(a){this._text=a["t"],this._placeholder=a["p"],this._title=a["ti"],this._isEnabled=a["e"],this._isReadOnly=a["r"],this._spellCheck=a["sp"],this._type=a["type"],this._id=a["id"],this.UpdateElementState()}GetPropertyValueByIndex(a){return a===0?this._text:1===a?this._placeholder:2===a?this._title:4===a?this._isEnabled:5===a?this._isReadOnly:6===a?this._spellCheck:8===a?this._autoFontSize:9===a?this._id:void 0}SetPropertyValueByIndex(b,c){switch(b){case a:if(this._text===c)return;this._text=c,this.UpdateElementState();break;case 1:if(this._placeholder===c)return;this._placeholder=c,this.UpdateElementState();break;case 2:if(this._title===c)return;this._title=c,this.UpdateElementState();break;case 4:if(this._isEnabled===!!c)return;this._isEnabled=!!c,this.UpdateElementState();break;case 5:if(this._isReadOnly===!!c)return;this._isReadOnly=!!c,this.UpdateElementState();break;case 6:if(this._spellCheck===!!c)return;this._spellCheck=!!c,this.UpdateElementState();break;case 8:this._autoFontSize=!!c;break;case 9:if(this._id===c)return;this._id=c,this.UpdateElementState();}}GetDebuggerProperties(){const a=C3.Plugins.TextBox.Acts;return[{title:"plugins.textbox.name",properties:[{name:"plugins.textbox.properties.text.name",value:this._text,onedit:(b)=>this.CallAction(a.SetText,b)},{name:"plugins.textbox.properties.enabled.name",value:this._isEnabled,onedit:(b)=>this.CallAction(a.SetEnabled,b)},{name:"plugins.textbox.properties.read-only.name",value:this._isReadOnly,onedit:(b)=>this.CallAction(a.SetReadOnly,b)}]}]}GetScriptInterfaceClass(){return ITextInputInstance}};const c=new WeakMap;self.ITextInputInstance=class extends IDOMInstance{constructor(){super(),c.set(this,IInstance._GetInitInst().GetSdkInstance())}set text(a){c.get(this)._SetText(a)}get text(){return c.get(this)._GetText()}set placeholder(a){c.get(this)._SetPlaceholder(a)}get placeholder(){return c.get(this)._GetPlaceholder()}set tooltip(a){c.get(this)._SetTooltip(a)}get tooltip(){return c.get(this)._GetTooltip()}set isEnabled(a){c.get(this)._SetEnabled(a)}get isEnabled(){return c.get(this)._IsEnabled()}set isReadOnly(a){c.get(this)._SetReadOnly(a)}get isReadOnly(){return c.get(this)._IsReadOnly()}scrollToBottom(){c.get(this)._ScrollToBottom()}}}
"use strict";C3.Plugins.TextBox.Cnds={CompareText(a,b){return 0===b?C3.equalsNoCase(this._text,a):this._text===a},OnTextChanged(){return!0},OnClicked(){return!0},OnDoubleClicked(){return!0}};
"use strict";C3.Plugins.TextBox.Acts={SetText(a){this._SetText(a)},SetPlaceholder(a){this._SetPlaceholder(a)},SetTooltip(a){this._SetTooltip(a)},SetVisible(a){const b=this.GetWorldInfo();a=0!==a;b.IsVisible()===a||b.SetVisible(a)},SetEnabled(a){this._SetEnabled(0!==a)},SetReadOnly(a){this._SetReadOnly(0===a)},SetFocus(){this.FocusElement()},SetBlur(){this.BlurElement()},SetCSSStyle(a,b){this.SetElementCSSStyle(a,b)},ScrollToBottom(){this._ScrollToBottom()}};
"use strict";C3.Plugins.TextBox.Exps={Text(){return this._text}};
"use strict";C3.Plugins.Text=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Text.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}LoadTextures(){}ReleaseTextures(){}};
"use strict";{const a=[0,0,0],b=["left","center","right"],c=["top","center","bottom"],d=new C3.Rect,e=new C3.Quad;C3.Plugins.Text.Instance=class extends C3.SDKWorldInstanceBase{constructor(a,b){if(super(a),this._text="",this._enableBBcode=!0,this._faceName="Arial",this._ptSize=12,this._lineHeightOffset=0,this._isBold=!1,this._isItalic=!1,this._color=C3.New(C3.Color),this._horizontalAlign=0,this._verticalAlign=0,this._wrapByWord=!0,this._typewriterStartTime=-1,this._typewriterEndTime=-1,this._typewriterLength=0,this._webglText=C3.New(C3.Gfx.WebGLText,this._runtime.GetWebGLRenderer(),{timeout:5}),this._webglText.ontextureupdate=()=>this._runtime.UpdateRender(),this._webglText.SetIsAsync(!1),b){this._text=b[0],this._enableBBcode=!!b[1],this._faceName=b[2],this._ptSize=b[3],this._lineHeightOffset=b[4],this._isBold=!!b[5],this._isItalic=!!b[6],this._horizontalAlign=b[8],this._verticalAlign=b[9],this._wrapByWord=0===b[10];const a=b[7];this._color.setRgb(a[0],a[1],a[2]),this.GetWorldInfo().SetVisible(b[11])}this._UpdateTextSettings()}Release(){this._CancelTypewriter(),this._webglText.Release(),this._webglText=null,super.Release()}_UpdateTextSettings(){const a=this._webglText;a.SetText(this._text),a.SetBBCodeEnabled(this._enableBBcode),a.SetFontName(this._faceName),a.SetFontSize(this._ptSize),a.SetLineHeight(this._lineHeightOffset),a.SetBold(this._isBold),a.SetItalic(this._isItalic),a.SetColor(this._color),a.SetHorizontalAlignment(b[this._horizontalAlign]),a.SetVerticalAlignment(c[this._verticalAlign]),a.SetWordWrapMode(this._wrapByWord?"word":"character")}_UpdateTextSize(){const a=this.GetWorldInfo(),b=a.GetLayer(),c=b.GetRenderScale()*b.Get2DScaleFactorToZ(a.GetTotalZElevation());this._webglText.SetSize(a.GetWidth(),a.GetHeight(),c)}Draw(a){var b=Math.round;const c=this.GetWorldInfo();this._UpdateTextSize();const f=this._webglText.GetTexture();if(!f)return;const g=c.GetLayer();let h=c.GetBoundingQuad();if(0===c.GetAngle()&&0===c.GetLayer().GetAngle()&&0===c.GetTotalZElevation()){const[c,i]=g.LayerToDrawSurface(h.getTlx(),h.getTly()),[j,k]=g.LayerToDrawSurface(h.getBrx(),h.getBry()),l=c-b(c),m=i-b(i);d.set(c,i,j,k),d.offset(-l,-m),e.setFromRect(d);const[n,o]=a.GetRenderTargetSize(a.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(a,n,o),a.SetTexture(f),a.Quad3(e,this._webglText.GetTexRect()),g._SetTransform(a)}else{let c=0,d=0;this._runtime.IsPixelRoundingEnabled()&&(c=h.getTlx()-b(h.getTlx()),d=h.getTly()-b(h.getTly())),(0!=c||0!=d)&&(e.copy(h),e.offset(-c,-d),h=e),a.SetTexture(f),a.Quad3(h,this._webglText.GetTexRect())}}SaveToJson(){const a={"t":this._text,"c":this._color.toJSON(),"fn":this._faceName,"ps":this._ptSize};return this._enableBBcode&&(a["bbc"]=this._enableBBcode),0!==this._horizontalAlign&&(a["ha"]=this._horizontalAlign),0!==this._verticalAlign&&(a["va"]=this._verticalAlign),this._wrapByWord||(a["wr"]=this._wrapByWord),0!==this._lineHeightOffset&&(a["lho"]=this._lineHeightOffset),this._isBold&&(a["b"]=this._isBold),this._isItalic&&(a["i"]=this._isItalic),-1!==this._typewriterEndTime&&(a["tw"]={"st":this._typewriterStartTime,"en":this._typewriterEndTime,"l":this._typewriterLength}),a}LoadFromJson(a){if(this._CancelTypewriter(),this._text=a["t"],this._color.setFromJSON(a["c"]),this._faceName=a["fn"],this._ptSize=a["ps"],this._enableBBcode=!!a.hasOwnProperty("bbc")&&a["bbc"],this._horizontalAlign=a.hasOwnProperty("ha")?a["ha"]:0,this._verticalAlign=a.hasOwnProperty("va")?a["va"]:0,this._wrapByWord=!a.hasOwnProperty("wr")||a["wr"],this._lineHeightOffset=a.hasOwnProperty("lho")?a["lho"]:0,this._isBold=!!a.hasOwnProperty("b")&&a["b"],this._isItalic=!!a.hasOwnProperty("i")&&a["i"],a.hasOwnProperty("tw")){const b=a["tw"];this._typewriterStartTime=b["st"],this._typewriterEndTime=b["en"],this._typewriterLength=b["l"]}this._UpdateTextSettings(),-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(b){return 0===b?this._text:1===b?this._enableBBcode:2===b?this._faceName:3===b?this._ptSize:4===b?this._lineHeightOffset:5===b?this._isBold:6===b?this._isItalic:7===b?(a[0]=this._color.getR(),a[1]=this._color.getG(),a[2]=this._color.getB(),a):8===b?this._horizontalAlign:9===b?this._verticalAlign:10===b?this._wrapByWord?1:0:void 0}SetPropertyValueByIndex(a,b){switch(a){case 0:if(this._text===b)return;this._text=b,this._UpdateTextSettings();break;case 1:if(this._enableBBcode===!!b)return;this._enableBBcode=!!b,this._UpdateTextSettings();break;case 2:if(this._faceName===b)return;this._faceName=b,this._UpdateTextSettings();break;case 3:if(this._ptSize===b)return;this._ptSize=b,this._UpdateTextSettings();break;case 4:if(this._lineHeightOffset===b)return;this._lineHeightOffset=b,this._UpdateTextSettings();break;case 5:if(this._isBold===!!b)return;this._isBold=!!b,this._UpdateTextSettings();break;case 6:if(this._isItalic===!!b)return;this._isItalic=!!b,this._UpdateTextSettings();break;case 7:const d=this._color,c=b;if(d.getR()===c[0]&&d.getG()===c[1]&&d.getB()===c[2])return;this._color.setRgb(c[0],c[1],c[2]),this._UpdateTextSettings();break;case 8:if(this._horizontalAlign===b)return;this._horizontalAlign=b,this._UpdateTextSettings();break;case 9:if(this._verticalAlign===b)return;this._verticalAlign=b,this._UpdateTextSettings();break;case 10:if(this._wrapByWord===(b===0))return;this._wrapByWord=b===0,this._UpdateTextSettings();}}SetPropertyColorOffsetValueByIndex(a,c,d,e){(0!==c||0!==d||0!==e)&&(7===a?(this._color.addRgb(c,d,e),this._UpdateTextSettings()):void 0)}_SetText(a){this._text===a||(this._text=a,this._webglText.SetText(a),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(a,b){this._SetText(a),this._typewriterStartTime=this._runtime.GetGameTime(),this._typewriterEndTime=this._typewriterStartTime+b,this._typewriterLength=C3.BBString.StripAnyTags(a).length,this._webglText.SetDrawMaxCharacterCount(0),this._StartTicking()}_CancelTypewriter(){this._typewriterStartTime=-1,this._typewriterEndTime=-1,this._typewriterLength=0,this._webglText.SetDrawMaxCharacterCount(-1),this._StopTicking()}_FinishTypewriter(){-1===this._typewriterEndTime||(this._CancelTypewriter(),this.Trigger(C3.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetFontFace(a){this._faceName===a||(this._faceName=a,this._webglText.SetFontName(a),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(a){a=!!a;this._isBold===a||(this._isBold=a,this._webglText.SetBold(a),this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(a){a=!!a;this._isItalic===a||(this._isItalic=a,this._webglText.SetItalic(a),this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(a){this._ptSize===a||(this._ptSize=a,this._webglText.SetFontSize(this._ptSize),this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetLineHeight(a){this._lineHeightOffset===a||(this._lineHeightOffset=a,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(a){this._horizontalAlign===a||(this._horizontalAlign=a,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(a){this._verticalAlign===a||(this._verticalAlign=a,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(a){a=!!a;this._wrapByWord===a||(this._wrapByWord=a,this._UpdateTextSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){const a=this._runtime.GetGameTime();if(a>=this._typewriterEndTime)this._CancelTypewriter(),this.Trigger(C3.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender();else{let b=C3.relerp(this._typewriterStartTime,this._typewriterEndTime,a,0,this._typewriterLength);b=Math.floor(b),b!==this._webglText.GetDrawMaxCharacterCount()&&(this._webglText.SetDrawMaxCharacterCount(b),this._runtime.UpdateRender())}}GetDebuggerProperties(){return[{title:"plugins.text.name",properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:(a)=>this._SetText(a)}]}]}GetScriptInterfaceClass(){return ITextInstance}};const f=new WeakMap,g=new Map([["left",0],["center",1],["right",2]]),h=new Map([["top",0],["center",1],["bottom",2]]),i=new Map([["word",!0],["character",!1]]);self.ITextInstance=class extends IWorldInstance{constructor(){super(),f.set(this,IInstance._GetInitInst().GetSdkInstance())}get text(){return f.get(this).GetText()}set text(a){const b=f.get(this);b._CancelTypewriter(),b._SetText(a)}typewriterText(a,b){const c=f.get(this);c._CancelTypewriter(),c._StartTypewriter(a,b)}typewriterFinish(){f.get(this)._FinishTypewriter()}set fontFace(a){f.get(this)._SetFontFace(a)}get fontFace(){return f.get(this)._GetFontFace()}set isBold(a){f.get(this)._SetBold(a)}get isBold(){return f.get(this)._IsBold()}set isItalic(a){f.get(this)._SetItalic(a)}get isItalic(){return f.get(this)._IsItalic()}set sizePt(a){f.get(this)._SetFontSize(a)}get sizePt(){return f.get(this)._GetFontSize()}set lineHeight(a){f.get(this)._SetLineHeight(a)}get lineHeight(){return f.get(this)._GetLineHeight()}set horizontalAlign(a){const b=g.get(a);if("undefined"==typeof b)throw new Error("invalid mode");f.get(this)._SetHAlign(b)}get horizontalAlign(){return b[f.get(this)._GetHAlign()]}set verticalAlign(a){const b=h.get(a);if("undefined"==typeof b)throw new Error("invalid mode");f.get(this)._SetVAlign(b)}get verticalAlign(){return c[f.get(this)._GetVAlign()]}set wordWrapMode(a){const b=i.get(a);if("undefined"==typeof b)throw new Error("invalid mode");f.get(this)._SetWrapByWord(b)}get wordWrapMode(){return f.get(this)._IsWrapByWord()?"word":"character"}}}
"use strict";C3.Plugins.Text.Cnds={CompareText(a,b){return b?this._text===a:C3.equalsNoCase(this._text,a)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}};
"use strict";{const a=C3.New(C3.Color);C3.Plugins.Text.Acts={SetText(a){this._CancelTypewriter(),"number"==typeof a&&1e9>a&&(a=Math.round(1e10*a)/1e10),this._SetText(a.toString())},AppendText(a){this._CancelTypewriter(),"number"==typeof a&&1e9>a&&(a=Math.round(1e10*a)/1e10),a=a.toString();a&&this._SetText(this._text+a)},TypewriterText(a,b){this._CancelTypewriter(),"number"==typeof a&&1e9>a&&(a=Math.round(1e10*a)/1e10),this._StartTypewriter(a.toString(),b)},SetFontFace(a,b){let c=!1,d=!1;1===b?c=!0:2===b?d=!0:3===b?(c=!0,d=!0):void 0;a===this._faceName&&c===this._isBold&&d===this._isItalic||(this._SetFontFace(a),this._SetBold(c),this._SetItalic(d))},SetFontSize(a){this._SetFontSize(a)},SetFontColor(b){a.setFromRgbValue(b),a.clamp();this._color.equalsIgnoringAlpha(a)||(this._color.copyRgb(a),this._webglText.SetColor(this._color),this._runtime.UpdateRender())},SetWebFont(){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(a){this.GetWorldInfo().SetBlendMode(a),this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()},SetLineHeight(a){this._SetLineHeight(a)},SetHAlign(a){this._SetHAlign(a)},SetVAlign(a){this._SetVAlign(a)},SetWrapping(a){this._SetWrapByWord(0===a)}}}
"use strict";C3.Plugins.Text.Exps={Text(){return this._text},PlainText(){return this._enableBBcode?C3.BBString.StripAnyTags(this._text):this._text},FaceName(){return this._faceName},FaceSize(){return this._ptSize},TextWidth(){return this._UpdateTextSize(),this._webglText.GetTextWidth()},TextHeight(){return this._UpdateTextSize(),this._webglText.GetTextHeight()},LineHeight(){return this._lineHeightOffset}};
"use strict";C3.Plugins.NinePatch=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.NinePatch.Type=class extends C3.SDKTypeBase{constructor(a){super(a),this._textureSet=null,this._drawable=null}Release(){this.ReleaseTextures(),super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}async LoadTextures(){const a=this.GetImageInfo();this._drawable=await a.ExtractImageToCanvas()}CreatePatch(a,b,c,d){this._textureSet||!this._drawable||(this._textureSet=new NinePatchTextureSet(this),this._textureSet.CreateTextures(this._drawable,a,b,c,d))}ReleaseTextures(){this._textureSet&&(this._textureSet.Release(),this._textureSet=null)}GetTextureSet(){return this._textureSet}};
"use strict";{const a=C3.New(C3.Rect),b=C3.New(C3.Quad);C3.Plugins.NinePatch.Instance=class extends C3.SDKWorldInstanceBase{constructor(a,b){super(a),this._leftMargin=16,this._rightMargin=16,this._topMargin=16,this._bottomMargin=16,this._edges=1,this._fill=1,this._isSeamless=!0,b&&(this._leftMargin=b[0],this._rightMargin=b[1],this._topMargin=b[2],this._bottomMargin=b[3],this._edges=b[4],this._fill=b[5],this._isSeamless=!!b[8],this.GetWorldInfo().SetVisible(!!b[6])),this._sdkType.CreatePatch(this._leftMargin,this._rightMargin,this._topMargin,this._bottomMargin)}Release(){super.Release()}Draw(a){let b=this._sdkType.GetTextureSet();if(b||(this._sdkType.CreatePatch(this._leftMargin,this._rightMargin,this._topMargin,this._bottomMargin),b=this._sdkType.GetTextureSet(),!!b)){const c=this.GetWorldInfo(),d=this._leftMargin,e=this._rightMargin,f=this._topMargin,g=this._bottomMargin,h=b.GetImageWidth(),i=b.GetImageHeight(),j=h-e,k=i-g,l=c.GetBoundingQuad(),m=l.getTlx(),n=l.getTly(),o=c.GetWidth(),p=c.GetHeight(),q=this._isSeamless?1:0,r=this._edges,s=this._fill;if(0<d&&0<f&&this._DrawPatch(a,b.GetTexture(),0,0,d+q,f+q,m,n,d+q,f+q),0<e&&0<f&&this._DrawPatch(a,b.GetTexture(),j-q,0,e+q,f+q,m+o-e-q,n,e+q,f+q),0<e&&0<g&&this._DrawPatch(a,b.GetTexture(),j-q,k-q,e+q,g+q,m+o-e-q,n+p-g-q,e+q,g+q),0<d&&0<g&&this._DrawPatch(a,b.GetTexture(),0,k-q,d+q,g+q,m,n+p-g-q,d+q,g+q),0===r){const c=2===s?0:q;0<d&&k>f&&this._TilePatch(a,b.GetLeftTexture(),m,n+f,d+c,p-f-g,0,0),0<e&&k>f&&this._TilePatch(a,b.GetRightTexture(),m+o-e-c,n+f,e+c,p-f-g,c,0),0<f&&j>d&&this._TilePatch(a,b.GetTopTexture(),m+d,n,o-d-e,f+c,0,0),0<g&&j>d&&this._TilePatch(a,b.GetBottomTexture(),m+d,n+p-g-c,o-d-e,g+c,0,c)}else 1===r&&(0<d&&k>f&&this._DrawPatch(a,b.GetTexture(),0,f,d,k-f,m,n+f,d,p-f-g),0<e&&k>f&&this._DrawPatch(a,b.GetTexture(),j,f,e,k-f,m+o-e,n+f,e,p-f-g),0<f&&j>d&&this._DrawPatch(a,b.GetTexture(),d,0,j-d,f,m+d,n,o-d-e,f),0<g&&j>d&&this._DrawPatch(a,b.GetTexture(),d,k,j-d,g,m+d,n+p-g,o-d-e,g));k>f&&j>d&&(0===s?this._TilePatch(a,b.GetFillTexture(),m+d,n+f,o-d-e,p-f-g,0,0):1===s&&this._DrawPatch(a,b.GetTexture(),d,f,j-d,k-f,m+d,n+f,o-d-e,p-f-g))}}_DrawPatch(c,d,e,f,g,h,i,j,k,l){const m=d.GetWidth(),n=d.GetHeight();c.SetTexture(d);const o=this.GetWorldInfo(),p=o.GetBoundingQuad(),q=p.getTlx(),r=p.getTly();a.set(i,j,i+k,j+l),a.offset(-q,-r),b.setFromRotatedRect(a,o.GetAngle()),b.offset(q,r),a.set(e/m,f/n,(e+g)/m,(f+h)/n),c.Quad3(b,a)}_TilePatch(c,d,e,f,g,h,i,j){const k=d.GetWidth(),l=d.GetHeight();c.SetTexture(d);const m=this.GetWorldInfo(),n=m.GetBoundingQuad(),o=n.getTlx(),p=n.getTly();a.set(e,f,e+g,f+h),a.offset(-o,-p),b.setFromRotatedRect(a,m.GetAngle()),b.offset(o,p),a.set(-i/k,-j/l,(g-i)/k,(h-j)/l),c.Quad3(b,a)}GetCurrentImageInfo(){this._objectClass.GetImageInfo()}GetPropertyValueByIndex(){}SetPropertyValueByIndex(){}}}
"use strict";C3.Plugins.NinePatch.Cnds={};
"use strict";C3.Plugins.NinePatch.Acts={SetEffect(a){this.GetWorldInfo().SetBlendMode(a),this._runtime.UpdateRender()}};
"use strict";C3.Plugins.NinePatch.Exps={};
"use strict";{function a(a){const b=C3.CreateCanvas(a.width,a.height),c=b.getContext("2d");return c.drawImage(a,0,0),b}self.NinePatchTextureSet=class{constructor(a){this._sdkType=a,this._runtime=this._sdkType.GetRuntime(),this._texture=null,this._fillTexture=null,this._leftTexture=null,this._rightTexture=null,this._topTexture=null,this._bottomTexture=null,this._imageWidth=0,this._imageHeight=0,this._renderer=this._runtime.GetWebGLRenderer(),this._isLoading=!1,this._wasReleased=!1}Release(){this._renderer.IsContextLost()||(this._renderer.DeleteTexture(this._texture),this._renderer.DeleteTexture(this._fillTexture),this._renderer.DeleteTexture(this._leftTexture),this._renderer.DeleteTexture(this._rightTexture),this._renderer.DeleteTexture(this._topTexture),this._renderer.DeleteTexture(this._bottomTexture)),this._texture=null,this._fillTexture=null,this._leftTexture=null,this._rightTexture=null,this._topTexture=null,this._bottomTexture=null,this._sdkType=null,this._renderer=null,this._wasReleased=!0}WasReleased(){return this._wasReleased}CreateTextures(a,b,c,d,e){this._SliceImage(a,b,c,d,e)}HasCreatedTextures(){return!!this._texture}_SliceImage(b,c,d,e,f){if(!this._wasReleased){const g=b.width,h=b.height;this._imageWidth=g,this._imageHeight=h;const i=g-d,j=h-f,k=this._runtime.GetSampling();this._texture=this._renderer.CreateStaticTexture(a(b),{isTiled:!1,sampling:k}),i>c&&j>e&&(this._fillTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(a(b),c,e,i,j),{isTiled:!0,sampling:k})),0<c&&j>e&&(this._leftTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(a(b),0,e,c,j),{isTiled:!0,tileType:"repeat-y",sampling:k})),0<d&&j>e&&(this._rightTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(a(b),i,e,g,j),{isTiled:!0,tileType:"repeat-y",sampling:k})),0<e&&i>c&&(this._topTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(a(b),c,0,i,e),{isTiled:!0,tileType:"repeat-x",sampling:k})),0<f&&i>c&&(this._bottomTexture=this._renderer.CreateStaticTexture(this._SliceSubImage(a(b),c,j,i,h),{isTiled:!0,tileType:"repeat-x",sampling:k}))}}_SliceSubImage(a,b,c,d,e){const f=d-b,g=e-c,h=C3.CreateCanvas(f,g),i=h.getContext("2d");return i.drawImage(a,b,c,f,g,0,0,f,g),h}GetImageWidth(){return this._imageWidth}GetImageHeight(){return this._imageHeight}GetTexture(){return this._texture}GetFillTexture(){return this._fillTexture}GetLeftTexture(){return this._leftTexture}GetRightTexture(){return this._rightTexture}GetTopTexture(){return this._topTexture}GetBottomTexture(){return this._bottomTexture}}}
"use strict";C3.Plugins.Particles=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Particles.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling(),isTiled:!0})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}};
"use strict";{const a=C3.New(C3.Rect);C3.Plugins.Particles.Instance=class extends C3.SDKWorldInstanceBase{constructor(a,b){super(a),this._isFirstTick=!0;const c=C3.New(ParticleEngine);this._particleEngine=c,c.ononeshotfinish=()=>this._OnOneShotFinish(),this._spawnObjectClass=null,this._particleUpdateCallback=(a,b,c,d,e,f)=>this._OnParticleUpdate(a,b,c,d,e,f),this._particleDestroyCallback=(a)=>this._OnParticleDestroy(a),this._hasAnyDefaultParticle=!0,b&&(c.SetRate(b[0]),c.SetSprayCone(C3.toRadians(b[1])),c.SetSprayType(b[2]?"one-shot":"continuous-spray"),this._SetParticleObjectClass(this._runtime.GetObjectClassBySID(b[3])),c.SetInitSpeed(b[4]),c.SetInitSize(b[5]),c.SetInitOpacity(b[6]/100),c.SetGrowRate(b[7]),c.SetInitXRandom(b[8]),c.SetInitYRandom(b[9]),c.SetInitSpeedRandom(b[10]),c.SetInitSizeRandom(b[11]),c.SetGrowRandom(b[12]),c.SetAcceleration(b[13]),c.SetGravity(b[14]),c.SetLifeAngleRandom(b[15]),c.SetLifeSpeedRandom(b[16]),c.SetLifeOpacityRandom(b[17]),c.SetDestroyModeIndex(b[18]),c.SetTimeout(b[19])),this._UpdateEngineParameters(),this._spawnObjectClass&&(this._hasAnyDefaultParticle=!1),"one-shot"===c.GetSprayType()?c.CreateOneShotSpray():c.SetSpraying(!0);const d=this.GetWorldInfo();d.SetBboxChangeEventEnabled(!0),this._inst.Dispatcher().addEventListener("bboxchange",()=>{d.OverwriteBoundingBox(this._particleEngine.GetBoundingBox())}),this._StartTicking()}Release(){this._particleEngine.Release(),this._particleEngine=null,this._particleUpdateCallback=null,this._particleDestroyCallback=null,super.Release()}_SetParticleObjectClass(a){a===this.GetObjectClass()&&(a=null),this._spawnObjectClass=a,this._particleEngine.onparticlecreate=a?(a)=>this._OnParticleCreate(a):null,this._spawnObjectClass||(this._hasAnyDefaultParticle=!0)}_UpdateEngineParameters(){const a=this._particleEngine,b=this.GetWorldInfo();a.SetMasterOpacity(b.GetOpacity()),a.SetPixelRounding(this._runtime.IsPixelRoundingEnabled()),a.SetSpawnX(b.GetX()),a.SetSpawnY(b.GetY()),a.SetSpawnAngle(b.GetAngle())}_OnOneShotFinish(){this._runtime.DestroyInstance(this._inst)}Draw(b){if(this._hasAnyDefaultParticle){const c=this._objectClass.GetImageInfo(),d=c.GetTexture();if(d){const e=this.GetWorldInfo(),f=e.GetLayer(),g=a;f.GetViewportForZ(e.GetTotalZElevation(),g),b.SetTexture(d);const h=f.Get2DScaleFactorToZ(e.GetTotalZElevation());this._particleEngine.SetParticleScale(f.GetRenderScale()*h),this._particleEngine.Draw(b,c.GetTexRect(),g)}}}SaveToJson(){const a=this._particleEngine;return{"r":a.GetRate(),"sc":a.GetSprayCone(),"st":a.GetSprayType(),"isp":a.GetInitSpeed(),"isz":a.GetInitSize(),"io":a.GetInitOpacity(),"gr":a.GetGrowRate(),"xr":a.GetInitXRandom(),"yr":a.GetInitYRandom(),"spr":a.GetInitSpeedRandom(),"szr":a.GetInitSizeRandom(),"grnd":a.GetGrowRandom(),"acc":a.GetAcceleration(),"g":a.GetGravity(),"lar":a.GetLifeAngleRandom(),"lsr":a.GetLifeSpeedRandom(),"lor":a.GetLifeOpacityRandom(),"dm":a.GetDestroyModeIndex(),"to":a.GetTimeout(),"s":a.IsSpraying(),"pcc":a._GetCreateCounter(),"ft":this._isFirstTick,"p":a.GetParticles().map((a)=>a.toJSON())}}LoadFromJson(a){const b=this._particleEngine;b.SetRate(a["r"]),b.SetSprayCone(a["sc"]),b.SetSprayType(a["st"]),b.SetInitSpeed(a["isp"]),b.SetInitSize(a["isz"]),b.SetInitOpacity(a["io"]),b.SetGrowRate(a["gr"]),b.SetInitXRandom(a["xr"]),b.SetInitYRandom(a["yr"]),b.SetInitSpeedRandom(a["spr"]),b.SetInitSizeRandom(a["szr"]),b.SetGrowRandom(a["grnd"]),b.SetAcceleration(a["acc"]),b.SetGravity(a["g"]),b.SetLifeAngleRandom(a["lar"]),b.SetLifeSpeedRandom(a["lsr"]),b.SetLifeOpacityRandom(a["lor"]),b.SetDestroyModeIndex(a["dm"]),b.SetTimeout(a["to"]),b.SetSpraying(a["s"]),b._SetCreateCounter(a["pcc"]),this._isFirstTick=a["ft"];const c=a["p"];b.SetParticleCount(c.length);const d=b.GetParticles();for(let b=0,e=d.length;b<e;++b)d[b].setFromJSON(c[b])}Tick(){const a=this._runtime.GetDt(this._inst);this._UpdateEngineParameters(),this._isFirstTick&&"one-shot"===this._particleEngine.GetSprayType()&&this._particleEngine.ReInitAllParticles(),this._particleEngine.Tick(a),this._particleEngine.IsSpraying()&&this._runtime.UpdateRender(),this.GetWorldInfo().SetBboxChanged(),this._isFirstTick=!1}_OnParticleCreate(a){const b=this._runtime.CreateInstance(this._spawnObjectClass,this.GetWorldInfo().GetLayer(),a.GetX(),a.GetY()),c=b.GetWorldInfo();return c.SetSize(a.GetSize(),a.GetSize()),c.SetAngle(a.GetAngle()),c.SetOpacity(a.GetOpacity()),c.SetBboxChanged(),c.ZOrderMoveAdjacentToInstance(this.GetInstance(),!0),b._TriggerOnCreated(),a.SetUpdateCallback(this._particleUpdateCallback),a.SetDestroyCallback(this._particleDestroyCallback),b}_OnParticleUpdate(a,b,c,d,e,f){if(!a.IsDestroyed()){const g=a.GetWorldInfo();g.OffsetXY(b,c),g.SetSize(g.GetWidth()+d,g.GetHeight()+d),g.SetAngle(g.GetAngle()+e),g.SetOpacity(g.GetOpacity()+f),g.SetBboxChanged()}}_OnParticleDestroy(a){a.IsDestroyed()||this._runtime.DestroyInstance(a)}GetPropertyValueByIndex(a){const b=this._particleEngine;return a===0?b.GetRate():1===a?C3.toDegrees(b.GetSprayCone()):2===a?"one-shot"===b.GetSprayType()?1:0:4===a?b.GetInitSpeed():5===a?b.GetInitSize():6===a?100*b.GetInitOpacity():7===a?b.GetGrowRate():8===a?b.GetInitXRandom():9===a?b.GetInitYRandom():10===a?b.GetInitSpeedRandom():11===a?b.GetInitSizeRandom():12===a?b.GetGrowRandom():13===a?b.GetAcceleration():14===a?b.GetGravity():15===a?b.GetLifeAngleRandom():16===a?b.GetLifeSpeedRandom():17===a?b.GetLifeOpacityRandom():18===a?b.GetDestroyModeIndex():19===a?b.GetTimeout():void 0}SetPropertyValueByIndex(a,b){const c=this._particleEngine;a===0?c.SetRate(b):1===a?c.SetSprayCone(C3.toRadians(b)):2===a?c.SetSprayType(b?"one-shot":"continuous-spray"):4===a?c.SetInitSpeed(b):5===a?c.SetInitSize(b):6===a?c.SetInitOpacity(b/100):7===a?c.SetGrowRate(b):8===a?c.SetInitXRandom(b):9===a?c.SetInitYRandom(b):10===a?c.SetInitSpeedRandom(b):11===a?c.SetInitSizeRandom(b):12===a?c.SetGrowRandom(b):13===a?c.SetAcceleration(b):14===a?c.SetGravity(b):15===a?c.SetLifeAngleRandom(b):16===a?c.SetLifeSpeedRandom(b):17===a?c.SetLifeOpacityRandom(b):18===a?c.SetDestroyModeIndex(b):19===a?c.SetTimeout(b):void 0}GetDebuggerProperties(){const a=this._particleEngine;return[{title:"plugins.particles.name",properties:[{name:"plugins.particles.debugger.particle-count",value:a.GetParticleCount()},{name:"plugins.particles.properties.type.name",value:["plugins.particles.properties.type.items."+a.GetSprayType()]},{name:"plugins.particles.debugger.is-spraying",value:a.IsSpraying(),onedit:(b)=>a.SetSpraying(b)},{name:"plugins.particles.properties.rate.name",value:a.GetRate(),onedit:(b)=>a.SetRate(b)},{name:"plugins.particles.properties.spray-cone.name",value:C3.toDegrees(a.GetSprayCone()),onedit:(b)=>a.SetSprayCone(C3.toRadians(b))},{name:"plugins.particles.properties.speed.name",value:a.GetInitSpeed(),onedit:(b)=>a.SetInitSpeed(b)},{name:"plugins.particles.properties.size.name",value:a.GetInitSize(),onedit:(b)=>a.SetInitSize(b)},{name:"plugins.particles.properties.opacity.name",value:a.GetInitOpacity(),onedit:(b)=>a.SetInitOpacity(b)},{name:"plugins.particles.properties.grow-rate.name",value:a.GetGrowRate(),onedit:(b)=>a.SetGrowRate(b)},{name:"plugins.particles.properties.x-randomiser.name",value:a.GetInitXRandom(),onedit:(b)=>a.SetInitXRandom(b)},{name:"plugins.particles.properties.y-randomiser.name",value:a.GetInitYRandom(),onedit:(b)=>a.SetInitYRandom(b)},{name:"plugins.particles.properties.initial-speed-randomiser.name",value:a.GetInitSpeedRandom(),onedit:(b)=>a.SetInitSpeedRandom(b)},{name:"plugins.particles.properties.size-randomiser.name",value:a.GetInitSizeRandom(),onedit:(b)=>a.SetInitSizeRandom(b)},{name:"plugins.particles.properties.grow-rate-randomiser.name",value:a.GetGrowRandom(),onedit:(b)=>a.SetGrowRandom(b)},{name:"plugins.particles.properties.acceleration.name",value:a.GetAcceleration(),onedit:(b)=>a.SetAcceleration(b)},{name:"plugins.particles.properties.gravity.name",value:a.GetGravity(),onedit:(b)=>a.SetGravity(b)},{name:"plugins.particles.properties.angle-randomiser.name",value:a.GetLifeAngleRandom(),onedit:(b)=>a.SetLifeAngleRandom(b)},{name:"plugins.particles.properties.life-speed-randomiser.name",value:a.GetLifeSpeedRandom(),onedit:(b)=>a.SetLifeSpeedRandom(b)},{name:"plugins.particles.properties.opacity-randomiser.name",value:a.GetLifeOpacityRandom(),onedit:(b)=>a.SetLifeOpacityRandom(b)},{name:"plugins.particles.properties.timeout.name",value:a.GetTimeout(),onedit:(b)=>a.SetTimeout(b)}]}]}}}
"use strict";C3.Plugins.Particles.Cnds={IsSpraying(){return this._particleEngine.IsSpraying()}};
"use strict";C3.Plugins.Particles.Acts={SetSpraying(a){this._particleEngine.SetSpraying(0!==a)},SetRate(a){this._particleEngine.SetRate(a),"one-shot"===this._particleEngine.GetSprayType()&&this._isFirstTick&&this._particleEngine.SetParticleCount(a)},SetParticleObject(a){this._SetParticleObjectClass(a)},UnsetParticleObject(){this._SetParticleObjectClass(null)},SetSprayCone(a){this._particleEngine.SetSprayCone(C3.toRadians(a))},SetInitSpeed(a){this._particleEngine.SetInitSpeed(a)},SetInitSize(a){this._particleEngine.SetInitSize(a)},SetInitOpacity(a){this._particleEngine.SetInitOpacity(a/100)},SetGrowRate(a){this._particleEngine.SetGrowRate(a)},SetXRandomiser(a){this._particleEngine.SetInitXRandom(a)},SetYRandomiser(a){this._particleEngine.SetInitYRandom(a)},SetSpeedRandomiser(a){this._particleEngine.SetInitSpeedRandom(a)},SetSizeRandomiser(a){this._particleEngine.SetInitSizeRandom(a)},SetGrowRateRandomiser(a){this._particleEngine.SetGrowRandom(a)},SetParticleAcc(a){this._particleEngine.SetAcceleration(a)},SetGravity(a){this._particleEngine.SetGravity(a)},SetAngleRandomiser(a){this._particleEngine.SetLifeAngleRandom(a)},SetLifeSpeedRandomiser(a){this._particleEngine.SetLifeSpeedRandom(a)},SetOpacityRandomiser(a){this._particleEngine.SetLifeOpacityRandom(a)},SetTimeout(a){this._particleEngine.SetTimeout(a)},SetEffect(a){this.GetWorldInfo().SetBlendMode(a),this._runtime.UpdateRender()}};
"use strict";C3.Plugins.Particles.Exps={ParticleCount(){return this._particleEngine.GetParticleCount()},Rate(){return this._particleEngine.GetRate()},SprayCone(){return C3.toDegrees(this._particleEngine.GetSprayCone())},InitSpeed(){return this._particleEngine.GetInitSpeed()},InitSize(){return this._particleEngine.GetInitSize()},InitOpacity(){return 100*this._particleEngine.GetInitOpacity()},InitGrowRate(){return this._particleEngine.GetGrowRate()},XRandom(){return this._particleEngine.GetInitXRandom()},YRandom(){return this._particleEngine.GetInitYRandom()},InitSpeedRandom(){return this._particleEngine.GetInitSpeedRandom()},InitGrowRandom(){return this._particleEngine.GetGrowRandom()},ParticleAcceleration(){return this._particleEngine.GetAcceleration()},Gravity(){return this._particleEngine.GetGravity()},ParticleAngleRandom(){return this._particleEngine.GetLifeAngleRandom()},ParticleSpeedRandom(){return this._particleEngine.GetLifeSpeedRandom()},ParticleOpacityRandom(){return this._particleEngine.GetLifeOpacityRandom()},Timeout(){return this._particleEngine.GetTimeout()}};
"use strict";{function b(a){return Math.random()*a-a/2}const a=new C3.Quad,c=new C3.Color,d=self.devicePixelRatio||1;let e=!1;self.Particle=class{constructor(a){this._engine=a,this._isActive=!1,this._x=0,this._y=0,this._speed=0,this._angle=0,this._opacity=1,this._lastOpacity=0,this._grow=0,this._size=0,this._halfSize=0,this._gs=0,this._age=0,this._bbox=new C3.Rect,this._userData=null,this._updateCallback=null,this._destroyCallback=null}SetEngine(a){this._engine=a}Init(a){this._isActive=!0,this._x=this._engine.GetSpawnX()+b(this._engine.GetInitXRandom()),this._y=this._engine.GetSpawnY()+b(this._engine.GetInitYRandom()),this._speed=this._engine.GetInitSpeed()+b(this._engine.GetInitSpeedRandom()),this._angle=this._engine.GetInitAngle()+b(this._engine.GetSprayCone()),this._opacity=this._engine.GetInitOpacity(),this._lastOpacity=this._opacity,this._size=this._engine.GetInitSize()+b(this._engine.GetInitSizeRandom()),this._halfSize=this._size/2,this._grow=this._engine.GetGrowRate()+b(this._engine.GetGrowRandom()),this._gs=0,this._age=0,this._UpdateBoundingBox(),a?!this._userData&&(this._userData=a(this)):(this._userData=null,this._updateCallback=null,this._destroyCallback=null)}SetUpdateCallback(a){this._updateCallback=a}SetDestroyCallback(a){this._destroyCallback=a}Destroy(){const a=this._destroyCallback;a&&a(this._userData),this._userData=null,this._updateCallback=null,this._destroyCallback=null}toJSON(){return[this._x,this._y,this._speed,this._angle,this._opacity,this._grow,this._size,this._gs,this._age]}setFromJSON(a){this._x=a[0],this._y=a[1],this._speed=a[2],this._angle=a[3],this._opacity=a[4],this._grow=a[5],this._size=a[6],this._gs=a[7],this._age=a[8],this._halfSize=this._size/2,this._UpdateBoundingBox()}Tick(c){const d=this._engine,e=this._speed*c,f=this._angle,a=Math.cos(f)*e,g=Math.sin(f)*e+this._gs*c;this._x+=a,this._y+=g;const h=this._grow*c;this._size+=h,this._halfSize=this._size/2,this._speed+=d.GetAcceleration()*c,this._gs+=d.GetGravity()*c,this._age+=c,this._UpdateBoundingBox();const i=d.GetLifeAngleRandom(),j=d.GetLifeSpeedRandom(),k=d.GetLifeOpacityRandom();let l=0;0!==i&&(l=b(i*c),this._angle+=l);0!==j&&(this._speed+=b(j*c)),0!==k&&(this._opacity=C3.clamp(this._opacity+b(k*c),0,1));const m=1<=this._size&&(2===d.GetDestroyModeIndex()?0<this._speed:this._age<d.GetTimeout()),n=this._updateCallback;if(n&&m){let b=d.GetMasterOpacity()*this._opacity;0===d.GetDestroyModeIndex()&&(b*=1-this._age/d.GetTimeout());const c=b-this._lastOpacity;this._lastOpacity=b,n(this._userData,a,g,h,l,c)}this._isActive=m}IsActive(){return this._isActive}GetBoundingBox(){return this._bbox}_UpdateBoundingBox(){const a=this._x,b=this._y,c=this._halfSize;this._bbox.set(a-c,b-c,a+c,b+c)}Draw(b,f){if(this._userData)return;const g=this._engine;let h=g.GetMasterOpacity()*this._opacity;if(0===g.GetDestroyModeIndex()&&(h*=1-this._age/g.GetTimeout()),0>=h)return;const i=this._size,j=i*g.GetParticleScale()*d;if(1>j)return;let k=this._x,l=this._y;g.IsPixelRounding()&&(k=0|k+.5,l=0|l+.5),j>b.GetMaxPointSize()||j<b.GetMinPointSize()?(c.copy(g.GetColor()),c.multiplyAlpha(h),b.SetColor(c),e=!0,a.setFromRect(this._bbox),b.Quad3(a,f)):(e&&(b.SetColor(g.GetColor()),e=!1),b.Point(k,l,j,h))}GetUserData(){return this._userData}GetX(){return this._x}GetY(){return this._y}GetSize(){return this._size}GetAngle(){return this._angle}GetOpacity(){return this._opacity}}}
"use strict";{const a=[],b=new Set(["continuous-spray","one-shot"]),c=["fade-to-invisible","timeout-expired","particle-stopped"];self.ParticleEngine=class{constructor(){this._rate=0,this._sprayCone=0,this._sprayType="continuous-spray",this._isSpraying=!1,this._masterOpacity=0,this._isPixelRounding=!1,this._spawnX=0,this._spawnY=0,this._spawnAngle=0,this._initSpeed=0,this._initSize=0,this._initOpacity=0,this._growRate=0,this._xRandom=0,this._yRandom=0,this._initSpeedRandom=0,this._initSizeRandom=0,this._growRandom=0,this._acceleration=0,this._gravity=0,this._lifeAngleRandom=0,this._lifeSpeedRandom=0,this._lifeOpacityRandom=0,this._destroyMode=0,this._timeout=0,this._createCounter=0,this._particleScale=1,this.ononeshotfinish=null,this.onparticlecreate=null,this._particles=[],this._boundingBox=new C3.Rect,this._color=new C3.Color}Release(){this.Cancel(),C3.clearArray(this._particles),this._particles=null,this.ononeshotfinish=null,this.onparticlecreate=null,this._boundingBox=null,this._boundingBox=null,this._color=null}Cancel(){const b=this._particles;for(let a=0,c=b.length;a<c;++a)b[a].Destroy();C3.appendArray(a,b),C3.clearArray(b),a.length>1000&&C3.truncateArray(a,1000),this._isSpraying=!1}CreateOneShotSpray(){for(let a=0,b=this._rate;a<b;++a)this._CreateParticle();this._particles.length&&(this._isSpraying=!0)}_CreateParticle(){let b=null;return a.length?(b=a.pop(),b.SetEngine(this)):b=C3.New(Particle,this),this._particles.push(b),b.Init(this.onparticlecreate),b}ReInitAllParticles(){const a=this._particles,b=this.onparticlecreate;for(let c=0,d=a.length;c<d;++c)a[c].Init(b)}SetParticleCount(b){const c=this._particles;if(b<c.length){const d=c.length-b;for(let b=0;b<d;++b){const b=c.pop();b.Destroy(),a.push(b)}a.length>1000&&C3.truncateArray(a,1000)}else if(b>c.length){const a=b-c.length;for(let b=0;b<a;++b)this._CreateParticle()}}GetParticles(){return this._particles}GetParticleCount(){return this._particles.length}Tick(a){this._SpawnContinuous(a),this._TickParticles(a),this._MaybeFinishOneShot()}_SpawnContinuous(a){if("continuous-spray"===this._sprayType&&this._isSpraying){this._createCounter+=a*this._rate;const b=Math.floor(this._createCounter);this._createCounter-=b;for(let a=0;a<b;++a)this._CreateParticle()}}_SetCreateCounter(a){this._createCounter=a}_GetCreateCounter(){return this._createCounter}_TickParticles(b){const c=this._boundingBox;c.set(this._spawnX,this._spawnY,this._spawnX,this._spawnY);const d=this._particles;let e=0;for(let f=0,g=d.length;f<g;++f){const g=d[f];d[e]=g,g.Tick(b),g.IsActive()?(++e,c.expandToContain(g.GetBoundingBox())):(g.Destroy(),a.push(g))}C3.truncateArray(d,e),a.length>1000&&C3.truncateArray(a,1000)}_MaybeFinishOneShot(){"one-shot"===this._sprayType&&0===this._particles.length&&this._isSpraying&&(this.ononeshotfinish&&this.ononeshotfinish(),this._isSpraying=!1)}Draw(a,b,c){a.SetPointTextureCoords(b),this._color.copy(a.GetColor());const d=this._particles;for(let e=0,f=d.length;e<f;++e){const f=d[e];c.intersectsRect(f.GetBoundingBox())&&f.Draw(a,b)}}GetColor(){return this._color}SetRate(a){this._rate=+a}GetRate(){return this._rate}SetSprayCone(a){this._sprayCone=+a}GetSprayCone(){return this._sprayCone}SetSprayType(a){if(!b.has(a))throw new Error("invalid spray type");this._sprayType=a}GetSprayType(){return this._sprayType}SetSpraying(a){this._isSpraying=!!a}IsSpraying(){return this._isSpraying}SetMasterOpacity(a){this._masterOpacity=+a}GetMasterOpacity(){return this._masterOpacity}SetPixelRounding(a){this._isPixelRounding=!!a}IsPixelRounding(){return this._isPixelRounding}SetSpawnX(a){this._spawnX=+a}GetSpawnX(){return this._spawnX}SetSpawnY(a){this._spawnY=+a}GetSpawnY(){return this._spawnY}SetSpawnAngle(b){this._spawnAngle=+b}GetInitAngle(){return this._spawnAngle}SetInitSpeed(a){this._initSpeed=+a}GetInitSpeed(){return this._initSpeed}SetInitSize(a){this._initSize=+a}GetInitSize(){return this._initSize}SetInitOpacity(a){this._initOpacity=+a}GetInitOpacity(){return this._initOpacity}SetGrowRate(a){this._growRate=+a}GetGrowRate(){return this._growRate}SetInitXRandom(a){this._xRandom=+a}GetInitXRandom(){return this._xRandom}SetInitYRandom(a){this._yRandom=+a}GetInitYRandom(){return this._yRandom}SetInitSpeedRandom(a){this._initSpeedRandom=+a}GetInitSpeedRandom(){return this._initSpeedRandom}SetInitSizeRandom(a){this._initSizeRandom=+a}GetInitSizeRandom(){return this._initSizeRandom}SetGrowRandom(a){this._growRandom=+a}GetGrowRandom(){return this._growRandom}SetAcceleration(b){this._acceleration=+b}GetAcceleration(){return this._acceleration}SetGravity(a){this._gravity=+a}GetGravity(){return this._gravity}SetLifeAngleRandom(b){this._lifeAngleRandom=+b}GetLifeAngleRandom(){return this._lifeAngleRandom}SetLifeSpeedRandom(a){this._lifeSpeedRandom=+a}GetLifeSpeedRandom(){return this._lifeSpeedRandom}SetLifeOpacityRandom(a){this._lifeOpacityRandom=+a}GetLifeOpacityRandom(){return this._lifeOpacityRandom}SetDestroyMode(a){let b=c.indexOf(a);if(-1===b)throw new Error("invalid destroy mode");this._destroyMode=b}SetDestroyModeIndex(a){this.SetDestroyMode(c[a])}GetDestroyMode(){return c[this._destroyMode]}GetDestroyModeIndex(){return this._destroyMode}SetTimeout(a){this._timeout=+a}GetTimeout(){return this._timeout}SetParticleScale(a){this._particleScale=+a}GetParticleScale(){return this._particleScale}GetBoundingBox(){return this._boundingBox}}}
"use strict";C3.Behaviors.Platform=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Platform.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{function a(a,b,c,d,e){return C3.clamp(a*e+.5*d*e*e,b*e,c*e)}C3.Behaviors.Platform.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a,b){super(a),this._keyboardDisposables=null,this._leftKey=!1,this._rightKey=!1,this._jumpKey=!1,this._jumped=!1,this._doubleJumped=!1,this._canDoubleJump=!1,this._ignoreInput=!1,this._simLeft=!1,this._simRight=!1,this._simJump=!1,this._lastFloorObject=null,this._loadFloorUid=-1,this._lastFloorX=0,this._lastFloorY=0,this._floorIsJumpthru=!1,this._wasOnFloor=!1,this._wasOverJumpthru=!!this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst),this._loadJumpthruUid=-1,this._animMode="stopped",this._fallThrough=0,this._isFirstTick=!0,this._dx=0,this._dy=0,this._downX=0,this._downY=0,this._rightX=0,this._rightY=0,this._g=0,this._g1=0,this._ga=C3.toRadians(90),this._maxSpeed=330,this._acc=1500,this._dec=1500,this._jumpStrength=650,this._maxFall=1e3,this._enableDoubleJump=!1,this._jumpSustain=0,this._sustainTime=0,this._defaultControls=!0,this._ceilingCollisionMode=0,this._isEnabled=!0,b&&(this._maxSpeed=b[0],this._acc=b[1],this._dec=b[2],this._jumpStrength=b[3],this._g=b[4],this._maxFall=b[5],this._enableDoubleJump=!!b[6],this._jumpSustain=b[7]/1e3,this._defaultControls=!!b[8],this._isEnabled=!!b[9]);const c=this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(c,"instancedestroy",(a)=>this._OnInstanceDestroyed(a.instance)),C3.Disposable.From(c,"afterload",()=>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._lastFloorObject=null,this._wasOverJumpthru=null,super.Release()}_BindEvents(){if(!this._keyboardDisposables){const a=this._runtime.Dispatcher();this._keyboardDisposables=new C3.CompositeDisposable(C3.Disposable.From(a,"keydown",(a)=>this._OnKeyDown(a.data)),C3.Disposable.From(a,"keyup",(a)=>this._OnKeyUp(a.data)),C3.Disposable.From(a,"window-blur",()=>this._OnWindowBlur()))}}_UnBindEvents(){this._keyboardDisposables&&(this._keyboardDisposables.Release(),this._keyboardDisposables=null)}_OnInstanceDestroyed(a){this._lastFloorObject===a&&(this._lastFloorObject=null),this._wasOverJumpthru===a&&(this._wasOverJumpthru=null)}_OnKeyDown(a){switch(a["key"]){case"ArrowLeft":this._leftKey=!0;break;case"ArrowRight":this._rightKey=!0;break;case"ArrowUp":this._jumpKey=!0;}}_OnKeyUp(a){switch(a["key"]){case"ArrowLeft":this._leftKey=!1;break;case"ArrowRight":this._rightKey=!1;break;case"ArrowUp":this._jumpKey=!1,this._jumped=!1;}}_OnWindowBlur(){this._leftKey=!1,this._rightKey=!1,this._jumpKey=!1,this._jumped=!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(a){this._ignoreInput=a["ii"],this._lastFloorX=a["lfx"],this._lastFloorY=a["lfy"],this._loadFloorUid=a["lfo"],this._animMode=a["am"];const b=a["en"];this._fallThrough=a["fall"],this._isFirstTick=a["ft"],this._dx=a["dx"],this._dy=a["dy"],this._maxSpeed=a["ms"],this._acc=a["acc"],this._dec=a["dec"],this._jumpStrength=a["js"],this._g=a["g"],this._g1=a["g1"],this._maxFall=a["mf"],this._wasOnFloor=a["wof"],this._loadJumpthruUid=a["woj"],this._ga=a["ga"],this._enableDoubleJump=a["edj"],this._canDoubleJump=a["cdj"],this._doubleJumped=a["dj"],this._jumpSustain=a["sus"],this._defaultControls=a["dc"],this._ceilingCollisionMode=a["cc"]||0,this._leftKey=!1,this._rightKey=!1,this._jumpKey=!1,this._jumped=!1,this._simLeft=!1,this._simRight=!1,this._simJump=!1,this._sustainTime=0,this._defaultControls?this._BindEvents():this._UnBindEvents(),this._SetEnabled(b),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(){var a=Math.PI,b=Math.sin,c=Math.cos;this._downX=c(this._ga),this._downY=b(this._ga),this._rightX=c(this._ga-a/2),this._rightY=b(this._ga-a/2),this._downX=C3.round6dp(this._downX),this._downY=C3.round6dp(this._downY),this._rightX=C3.round6dp(this._rightX),this._rightY=C3.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(){const a=this._inst.GetWorldInfo(),b=this._runtime.GetCollisionEngine(),c=this._inst,d=this._lastFloorObject,e=a.GetX(),f=a.GetY();if(a.OffsetXY(this._downX,this._downY),a.SetBboxChanged(),d&&b.TestOverlap(c,d)&&(!d.GetObjectClass().HasSolidBehavior()||b.IsSolidCollisionAllowed(d,c)))return a.SetXY(e,f),a.SetBboxChanged(),d;else{let d=b.TestOverlapSolid(c),g=null;if(d||0!==this._fallThrough||(g=b.TestOverlapJumpthru(c,!0)),a.SetXY(e,f),a.SetBboxChanged(),d)return b.TestOverlap(c,d)?null:(this._floorIsJumpthru=!1,d);if(g&&g.length){let a=0;for(let d=0,e=g.length;d<e;++d)g[a]=g[d],b.TestOverlap(c,g[d])||++a;if(1<=a)return this._floorIsJumpthru=!0,g[0]}return null}}PostTick(){if(!this._isEnabled)return;const a=this._runtime.GetDt(this._inst);this._jumpKey||this._simJump||(this._jumped=!1);let b=this._leftKey||this._simLeft,c=this._rightKey||this._simRight,d=this._jumpKey||this._simJump,e=d&&!this._jumped;this._simLeft=!1,this._simRight=!1,this._simJump=!1,this._ignoreInput&&(b=!1,c=!1,d=!1,e=!1),d||(this._sustainTime=0),this._HandleFirstTick();const[f,g,h]=this._TrackMovingPlatform(),i=this._IsOnFloor(),j=i&&!this._wasOnFloor,k=this._MaybePushOutSolid();if(k)return;this._TrackFloor(i,h,f,d),e=this._HandleJump(i,e,d),i||this._ApplyJumpGravity(e,d,a),this._wasOnFloor=!!i;const l=this._ApplyHorizontalAcceleration(b,c,a);let m=!1,n=0;if(0!==this._dx&&(m=this._HandleHorizontalMovement(a,l,i,e)),0!==this._dy){const[b,c]=this._HandleVerticalMovement(a,i);m=m||b,n=c}!m&&j&&0>this._dy&&0<n&&(this._dy=0,m=!0),this._HandleAnimationTriggers(i,m,e),0<this._fallThrough&&this._fallThrough--,this._wasOverJumpthru=this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst)}_HandleFirstTick(){if(this._isFirstTick){const a=this._inst,b=this._runtime.GetCollisionEngine();(b.TestOverlapSolid(a)||b.TestOverlapJumpthru(a))&&b.PushOutSolid(a,-this._downX,-this._downY,4,!0),this._isFirstTick=!1}}_TrackMovingPlatform(){const a=this._lastFloorObject,b=a?a.GetWorldInfo():null;let c=0,d=0,e=!1;if(a&&0===this._dy&&(b.GetY()!==this._lastFloorY||b.GetX()!==this._lastFloorX)){const a=this._inst,f=a.GetWorldInfo(),g=this._runtime.GetCollisionEngine(),h=b.GetX(),i=b.GetY();c=h-this._lastFloorX,d=i-this._lastFloorY,f.OffsetXY(c,d),f.SetBboxChanged(),this._lastFloorX=h,this._lastFloorY=i,e=!0,g.TestOverlapSolid(a)&&g.PushOutSolid(a,-c,-d,2.5*Math.hypot(c,d))}return[c,d,e]}_MaybePushOutSolid(){var a=Math.abs;const b=this._inst,c=b.GetWorldInfo(),d=this._runtime.GetCollisionEngine(),e=d.TestOverlapSolid(b);if(!e)return!1;const f=a(c.GetWidth()),g=a(c.GetHeight());return b.GetSavedDataMap().get("inputPredicted")?(d.PushOutSolid(b,-this._downX,-this._downY,10,!1),!1):d.PushOutSolidAxis(b,-this._downX,-this._downY,g/8)?(d.RegisterCollision(b,e),!1):d.PushOutSolidAxis(b,this._rightX,this._rightY,f/2)?(d.RegisterCollision(b,e),!1):d.PushOutSolidAxis(b,this._downX,this._downY,g/2)?(d.RegisterCollision(b,e),!1):!d.PushOutSolidNearest(b,Math.max(f,g)/2)||(d.RegisterCollision(b,e),!1)}_TrackFloor(a,b,c,d){const e=this._inst,f=this._runtime.GetCollisionEngine();if(a){const d=this._downX,g=this._downY,h=this._rightX,i=this._rightY;if(this._doubleJumped=!1,this._canDoubleJump=!1,0<this._dy&&(!this._wasOnFloor&&(f.PushInFractional(e,-d,-g,a,16),this._wasOnFloor=!0),this._dy=0),this._lastFloorObject!==a){this._lastFloorObject=a;const b=a.GetWorldInfo();this._lastFloorX=b.GetX(),this._lastFloorY=b.GetY(),f.RegisterCollision(e,a)}else if(b){const a=f.TestOverlapSolid(e);a&&(f.RegisterCollision(e,a),0!==c&&(0<c?f.PushOutSolid(e,-h,-i):f.PushOutSolid(e,h,i)),f.PushOutSolid(e,-d,-g))}}else d||(this._canDoubleJump=!0)}_HandleJump(a,b,c){if(a&&b||!a&&this._enableDoubleJump&&c&&this._canDoubleJump&&!this._doubleJumped){const c=this._inst,d=c.GetWorldInfo(),e=this._runtime.GetCollisionEngine(),f=d.GetX(),g=d.GetY();d.OffsetXY(-this._downX,-this._downY),d.SetBboxChanged(),e.TestOverlapSolid(c)?b=!1:(this._sustainTime=this._jumpSustain,this.Trigger(C3.Behaviors.Platform.Cnds.OnJump),this._animMode="jumping",this._dy=-this._jumpStrength,b=!0,a?this._jumped=!0:this._doubleJumped=!0),d.SetXY(f,g),d.SetBboxChanged()}return b}_ApplyJumpGravity(a,b,c){b&&0<this._sustainTime?(this._dy=-this._jumpStrength,this._sustainTime-=c):(this._lastFloorObject=null,this._dy+=this._g*c,this._dy>this._maxFall&&(this._dy=this._maxFall)),a&&(this._jumped=!0)}_ApplyHorizontalAcceleration(a,b,c){const d=this._acc,e=this._dec;a===b&&(0>this._dx?(this._dx+=e*c,0<this._dx&&(this._dx=0)):0<this._dx&&(this._dx-=e*c,0>this._dx&&(this._dx=0)));let f=0;return a&&!b&&(0<this._dx?f=-(d+e):f=-d),b&&!a&&(0>this._dx?f=d+e:f=d),this._dx+=f*c,this._dx=C3.clamp(this._dx,-this._maxSpeed,this._maxSpeed),f}_HandleHorizontalMovement(b,c,d,e){var f=Math.abs;const g=this._inst,h=g.GetWorldInfo(),i=this._runtime.GetCollisionEngine(),j=this._downX,k=this._downY,l=this._rightX,m=this._rightY,n=this._maxSpeed;let o=!1,p=h.GetX(),q=h.GetY();const r=a(this._dx,-n,n,c,b)*l,t=a(this._dx,-n,n,c,b)*m;h.OffsetXY(l*(1<this._dx?1:-1)-j,m*(1<this._dx?1:-1)-k),h.SetBboxChanged();let u=!1;const v=i.TestOverlapSolid(g);h.SetXY(p+r,q+t),h.SetBboxChanged();let w=i.TestOverlapSolid(g);if(!w&&d&&(w=i.TestOverlapJumpthru(g),w&&(h.SetXY(p,q),h.SetBboxChanged(),i.TestOverlap(g,w)?(w=null,u=!1):u=!0,h.SetXY(p+r,q+t),h.SetBboxChanged())),w){let a=f(this._dx*b)+2;v||!i.PushOutSolid(g,-j,-k,a,u,w)?(i.RegisterCollision(g,w),a=Math.max(f(2.5*(this._dx*b)),30),i.PushOutSolid(g,l*(0>this._dx?1:-1),m*(0>this._dx?1:-1),a,!1)?d&&!u&&!this._floorIsJumpthru&&(p=h.GetX(),q=h.GetY(),h.OffsetXY(j,k),i.TestOverlapSolid(g)?!i.PushOutSolid(g,-j,-k,3,!1)&&(h.SetXY(p,q),h.SetBboxChanged()):(h.SetXY(p,q),h.SetBboxChanged())):(h.SetXY(p,q),h.SetBboxChanged()),!u&&(this._dx=0)):!v&&!e&&f(this._dy)<f(this._jumpStrength/4)&&(this._dy=0,!d&&(o=!0))}else{const a=this._IsOnFloor();if(d&&!a){const a=Math.ceil(f(this._dx*b))+2;p=h.GetX(),q=h.GetY(),h.OffsetXY(j*a,k*a),h.SetBboxChanged(),i.TestOverlapSolid(g)||i.TestOverlapJumpthru(g)?i.PushOutSolid(g,-j,-k,a+2,!0):(h.SetXY(p,q),h.SetBboxChanged())}else if(a){if(!d&&this._floorIsJumpthru){this._lastFloorObject=a;const b=a.GetWorldInfo();this._lastFloorX=b.GetX(),this._lastFloorY=b.GetY(),this._dy=0,o=!0}0===this._dy&&i.PushInFractional(g,-j,-k,a,16)}}return o}_HandleVerticalMovement(b,c){const d=this._inst,e=d.GetWorldInfo(),f=this._runtime.GetCollisionEngine(),g=this._downX,h=this._downY;let i=!1,k=e.GetX(),l=e.GetY();const j=a(this._dy,-Infinity,this._maxFall,this._g,b);e.OffsetXY(j*g,j*h);const m=e.GetX(),n=e.GetY();e.SetBboxChanged();let o=f.TestOverlapSolid(d),p=!1;if(!o&&0<this._dy&&!c){const a=0<this._fallThrough?null:f.TestOverlapJumpthru(d,!0);if(a&&a.length){if(this._wasOverJumpthru){e.SetXY(k,l),e.SetBboxChanged();let b=0;for(let c=0,e=a.length;c<e;++c)a[b]=a[c],f.TestOverlap(d,a[c])||++b;C3.truncateArray(a,b),e.SetXY(m,n),e.SetBboxChanged()}1<=a.length&&(o=a[0])}p=!!o}if(o){f.RegisterCollision(d,o),this._sustainTime=0;const a=Math.max(Math.abs(1.1*(this._dy*b)),2);if(!f.PushOutSolid(d,g*(0>this._dy?1:-1),h*(0>this._dy?1:-1),a,p,o))e.SetXY(k,l),e.SetBboxChanged(),this._wasOnFloor=!0,p||(this._dy=0);else{this._lastFloorObject=o;const a=o.GetWorldInfo();this._lastFloorX=a.GetX(),this._lastFloorY=a.GetY(),this._floorIsJumpthru=p,p&&(i=!0),(0<this._dy||0===this._ceilingCollisionMode)&&(this._dy=0),0>this._dy&&1===this._ceilingCollisionMode&&f.PushInFractional(d,g,h,o,32)}}return[i,j]}_HandleAnimationTriggers(a,b,c){"falling"!==this._animMode&&0<this._dy&&!a&&(this.Trigger(C3.Behaviors.Platform.Cnds.OnFall),this._animMode="falling"),(a||b)&&0<=this._dy&&("falling"===this._animMode||b||c&&0===this._dy?(this.Trigger(C3.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(C3.Behaviors.Platform.Cnds.OnStop),this._animMode="stopped"),"moving"!==this._animMode&&(0!==this._dx||0!==this._dy)&&!c&&(this.Trigger(C3.Behaviors.Platform.Cnds.OnMove),this._animMode="moving")))}_CheckIfStandingOnFloor(){if(0!==this._dy)return!1;const a=this._inst,b=this.GetWorldInfo(),c=this._runtime.GetCollisionEngine(),d=b.GetX(),e=b.GetY();b.OffsetXY(this._downX,this._downY),b.SetBboxChanged();const f=c.TestOverlapSolid(a);let g=null;if(f||0!==this._fallThrough||(g=c.TestOverlapJumpthru(a,!0)),b.SetXY(d,e),b.SetBboxChanged(),f)return!c.TestOverlap(a,f);if(g&&g.length){let b=0;for(let d=0,e=g.length;d<e;++d)g[b]=g[d],c.TestOverlap(a,g[d])||b++;if(1<=b)return!0}return!1}_IsByWall(a){const b=this._inst,c=this.GetWorldInfo(),d=this._runtime.GetCollisionEngine(),e=c.GetX(),f=c.GetY();if(0===a?c.OffsetXY(2*-this._rightX,2*-this._rightY):c.OffsetXY(2*this._rightX,2*this._rightY),c.SetBboxChanged(),!d.TestOverlapSolid(b))return c.SetXY(e,f),c.SetBboxChanged(),!1;c.OffsetXY(3*-this._downX,3*-this._downY),c.SetBboxChanged();const g=!!d.TestOverlapSolid(b);return c.SetXY(e,f),c.SetBboxChanged(),g}_FallThroughJumpThru(){const a=this.GetWorldInfo(),b=a.GetX(),c=a.GetY();a.OffsetXY(this._downX,this._downY),a.SetBboxChanged();const d=this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst,!1);a.SetXY(b,c),a.SetBboxChanged();d&&(this._fallThrough=3,this._lastFloorObject=null)}_ResetDoubleJump(a){this._doubleJumped=!a}_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(a){this._maxSpeed=Math.max(a,0)}_GetMaxSpeed(){return this._maxSpeed}_SetAcceleration(a){this._acc=Math.max(a,0)}_GetAcceleration(){return this._acc}_SetDeceleration(a){this._dec=Math.max(a,0)}_GetDeceleration(){return this._dec}_SetJumpStrength(a){this._jumpStrength=Math.max(a,0)}_GetJumpStrength(){return this._jumpStrength}_SetMaxFallSpeed(a){this._maxFall=Math.max(a,0)}_GetMaxFallSpeed(){return this._maxFall}_SetGravity(a){if(this._g1!==a){this._g=a,this._UpdateGravity();const b=this._runtime.GetCollisionEngine(),c=this.GetWorldInfo();b.TestOverlapSolid(this._inst)&&(b.PushOutSolid(this._inst,this._downX,this._downY,10),c.OffsetXY(2*this._downX,2*this._downY),c.SetBboxChanged()),this._lastFloorObject=null}}_GetGravity(){return this._g}_SetGravityAngle(b){b=C3.clampAngle(b);this._ga===b||(this._ga=b,this._UpdateGravity(),this._lastFloorObject=null)}_GetGravityAngle(){return this._ga}_SetDoubleJumpEnabled(a){this._enableDoubleJump=!!a}_IsDoubleJumpEnabled(){return this._enableDoubleJump}_SetJumpSustain(a){this._jumpSustain=a}_GetJumpSustain(){return this._jumpSustain}_SetCeilingCollisionMode(a){this._ceilingCollisionMode=a}_GetCeilingCollisionMode(){return this._ceilingCollisionMode}_SetVectorX(a){this._dx=a}_GetVectorX(){return this._dx}_SetVectorY(a){this._dy=a}_GetVectorY(){return this._dy}_SimulateControl(a){this._isEnabled&&(0===a?this._simLeft=!0:1===a?this._simRight=!0:2===a?this._simJump=!0:void 0)}_SetDefaultControls(a){a=!!a;this._defaultControls===a||(this._defaultControls=a,this._defaultControls?this._BindEvents():(this._UnBindEvents(),this._OnWindowBlur()))}_IsDefaultControls(){return this._defaultControls}_SetIgnoreInput(a){this._ignoreInput=!!a}_IsIgnoreInput(){return this._ignoreInput}_SetEnabled(a){a=!!a;this._isEnabled===a||(this._isEnabled=a,this._isEnabled?this._StartPostTicking():(this._StopPostTicking(),this._lastFloorObject=null,this._simLeft=!1,this._simRight=!1,this._simJump=!1))}_IsEnabled(){return this._isEnabled}GetPropertyValueByIndex(a){return a===0?this._GetMaxSpeed():1===a?this._GetAcceleration():2===a?this._GetDeceleration():3===a?this._GetJumpStrength():4===a?this._GetGravity():5===a?this._GetMaxFallSpeed():6===a?this._IsDoubleJumpEnabled():7===a?1e3*this._GetJumpSustain():8===a?this._IsDefaultControls():9===a?this._IsEnabled():void 0}SetPropertyValueByIndex(a,b){a===0?this._SetMaxSpeed(b):1===a?this._SetAcceleration(b):2===a?this._SetDeceleration(b):3===a?this._SetJumpStrength(b):4===a?this._SetGravity(b):5===a?this._SetMaxFallSpeed(b):6===a?this._SetDoubleJumpEnabled(!!b):7===a?this._SetJumpSustain(b/1e3):8===a?this._SetDefaultControls(!!b):9===a?this._SetEnabled(!!b):void 0}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.platform.debugger.vector-x",value:this._GetVectorX(),onedit:(a)=>this._SetVectorX(a)},{name:"behaviors.platform.debugger.vector-y",value:this._GetVectorY(),onedit:(a)=>this._SetVectorY(a)},{name:"behaviors.platform.properties.max-speed.name",value:this._GetMaxSpeed(),onedit:(a)=>this._SetMaxSpeed(a)},{name:"behaviors.platform.properties.acceleration.name",value:this._GetAcceleration(),onedit:(a)=>this._SetAcceleration(a)},{name:"behaviors.platform.properties.deceleration.name",value:this._GetDeceleration(),onedit:(a)=>this._SetDeceleration(a)},{name:"behaviors.platform.properties.jump-strength.name",value:this._GetJumpStrength(),onedit:(a)=>this._SetJumpStrength(a)},{name:"behaviors.platform.properties.gravity.name",value:this._GetGravity(),onedit:(a)=>this._SetGravity(a)},{name:"behaviors.platform.debugger.gravity-angle",value:C3.toDegrees(this._GetGravityAngle()),onedit:(a)=>this._SetGravityAngle(C3.toRadians(a))},{name:"behaviors.platform.properties.max-fall-speed.name",value:this._GetMaxFallSpeed(),onedit:(a)=>this._SetMaxFallSpeed(a)},{name:"behaviors.platform.debugger.animation-mode",value:["behaviors.platform.debugger.anim-"+this._animMode]},{name:"behaviors.platform.properties.enabled.name",value:this._IsEnabled(),onedit:(a)=>this._SetEnabled(a)}]}]}GetScriptInterfaceClass(){return IPlatformBehaviorInstance}};const b=new WeakMap,c=new Map([["left",0],["right",1],["jump",2]]);self.IPlatformBehaviorInstance=class extends IBehaviorInstance{constructor(){super(),b.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}fallThrough(){b.get(this)._FallThroughJumpThru()}resetDoubleJump(a){b.get(this)._ResetDoubleJump(!!a)}simulateControl(a){const d=c.get(a);if("number"!=typeof d)throw new Error("invalid control");b.get(this)._SimulateControl(d)}get speed(){return b.get(this)._GetSpeed()}get maxSpeed(){return b.get(this)._GetMaxSpeed()}set maxSpeed(a){b.get(this)._SetMaxSpeed(a)}get acceleration(){return b.get(this)._GetAcceleration()}set acceleration(c){b.get(this)._SetAcceleration(c)}get deceleration(){return b.get(this)._GetDeceleration()}set deceleration(a){b.get(this)._GetDeceleration(a)}get jumpStrength(){return b.get(this)._GetJumpStrength()}set jumpStrength(a){b.get(this)._SetJumpStrength(s)}get maxFallSpeed(){return b.get(this)._GetMaxFallSpeed()}set maxFallSpeed(a){b.get(this)._SetMaxFallSpeed(a)}get gravity(){return b.get(this)._GetGravity()}set gravity(a){b.get(this)._SetGravity(a)}get gravityAngle(){return b.get(this)._GetGravityAngle()}set gravityAngle(a){b.get(this)._SetGravityAngle(a)}get isDoubleJumpEnabled(){return b.get(this)._IsDoubleJumpEnabled()}set isDoubleJumpEnabled(a){b.get(this)._SetDoubleJumpEnabled(!!a)}get jumpSustain(){return b.get(this)._GetJumpSustain()}set jumpSustain(a){b.get(this)._SetJumpSustain(a)}get ceilingCollisionMode(){const a=b.get(this)._GetCeilingCollisionMode();return 0===a?"stop":"preserve-momentum"}set ceilingCollisionMode(a){const c=b.get(this);if("stop"===a)c._SetCeilingCollisionMode(0);else if("preserve-momentum"===a)c._SetCeilingCollisionMode(1);else throw new Error("invalid mode")}get isOnFloor(){return b.get(this)._CheckIfStandingOnFloor()}isByWall(a){const c=b.get(this);if("left"===a)return c._IsByWall(0);if("right"===a)return c._IsByWall(1);throw new Error("invalid side")}get isJumping(){return b.get(this)._IsJumping()}get isFalling(){return b.get(this)._IsFalling()}get vectorX(){return b.get(this)._GetVectorX()}set vectorX(a){b.get(this)._SetVectorX(a)}get vectorY(){return b.get(this)._GetVectorY()}set vectorY(a){b.get(this)._SetVectorY(a)}get isDefaultControls(){return b.get(this)._IsDefaultControls()}set isDefaultControls(a){b.get(this)._SetDefaultControls(!!a)}get isIgnoringInput(){return b.get(this)._IsIgnoreInput()}set isIgnoringInput(a){b.get(this)._SetIgnoreInput(!!a)}get isEnabled(){return b.get(this)._IsEnabled()}set isEnabled(a){b.get(this)._SetEnabled(!!a)}}}
"use strict";C3.Behaviors.Platform.Cnds={IsMoving(){return 0!==this._GetVectorX()||0!==this._GetVectorY()},CompareSpeed(a,b){return C3.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";C3.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(b){this._SetGravityAngle(C3.toRadians(b))},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";C3.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 C3.toDegrees(this._GetGravityAngle())},MaxFallSpeed(){return this._GetMaxFallSpeed()},MovingAngle(){return C3.toDegrees(this._GetMovingAngle())},VectorX(){return this._GetVectorX()},VectorY(){return this._GetVectorY()},JumpSustain(){return 1e3*this._GetJumpSustain()}};
"use strict";C3.Behaviors.Timer=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Timer.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";C3.Behaviors.Timer.SingleTimer=class{constructor(a,b,c,d){this._current=C3.New(C3.KahanSum),this._current.Set(a||0),this._total=C3.New(C3.KahanSum),this._total.Set(b||0),this._duration=c||0,this._isRegular=!!d,this._isPaused=!1}GetCurrentTime(){return this._current.Get()}GetTotalTime(){return this._total.Get()}GetDuration(){return this._duration}SetPaused(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"]}},C3.Behaviors.Timer.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a){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,c]of this._timers.entries())a[b]=c.SaveToJson();return a}LoadFromJson(a){this._timers.clear();for(const[b,c]of Object.entries(a)){const a=new C3.Behaviors.Timer.SingleTimer;a.LoadFromJson(c),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()){const c=b.Update();c&&this._timers.delete(a)}}GetDebuggerProperties(){var a=Math.round;return[{title:"behaviors.timer.debugger.timers",properties:[...this._timers.entries()].map((b)=>({name:"$"+b[0],value:`${a(10*b[1].GetCurrentTime())/10} / ${a(10*b[1].GetDuration())/10}`}))}]}};
"use strict";C3.Behaviors.Timer.Cnds={OnTimer(a){const b=this._timers.get(a.toLowerCase());return!!b&&b.HasFinished()},IsTimerRunning(a){return this._timers.has(a.toLowerCase())},IsTimerPaused(a){const b=this._timers.get(a.toLowerCase());return b&&b.IsPaused()}};
"use strict";C3.Behaviors.Timer.Acts={StartTimer(a,b,c){const d=new C3.Behaviors.Timer.SingleTimer(0,0,a,1===b);this._timers.set(c.toLowerCase(),d),this._UpdateTickState()},StopTimer(a){this._timers.delete(a.toLowerCase()),this._UpdateTickState()},PauseResumeTimer(a,b){const c=this._timers.get(a.toLowerCase());c&&c.SetPaused(0===b)}};
"use strict";C3.Behaviors.Timer.Exps={CurrentTime(a){const b=this._timers.get(a.toLowerCase());return b?b.GetCurrentTime():0},TotalTime(a){const b=this._timers.get(a.toLowerCase());return b?b.GetTotalTime():0},Duration(a){const b=this._timers.get(a.toLowerCase());return b?b.GetDuration():0}};
"use strict";C3.Behaviors.LOS=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.LOS.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a),this._obstacleTypes=[]}Release(){C3.clearArray(this._obstacleTypes),super.Release()}OnCreate(){}GetObstacleTypes(){return this._obstacleTypes}FindLOSBehavior(a){const b=this.GetBehaviorType();for(const c of a.GetBehaviorInstances())if(c.GetBehaviorType()===b)return c.GetSdkInstance();return null}};
"use strict";{const a=[];C3.Behaviors.LOS.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a,b){super(a),this._obstacleMode=0,this._range=1e4,this._cone=C3.toRadians(360),this._useCollisionCells=!0,this._ray=new C3.Ray,b&&(this._obstacleMode=b[0],this._range=b[1],this._cone=C3.toRadians(b[2]),this._useCollisionCells=b[3])}Release(){super.Release()}SaveToJson(){return{"r":this._range,"c":this._cone,"om":this._obstacleMode,"ucc":this._useCollisionCells,"t":this.GetSdkType().GetObstacleTypes().map((a)=>a.GetSID())}}LoadFromJson(a){this._range=a["r"],this._cone=a["c"],this._obstacleMode=a["om"]||0,this._useCollisionCells=!!a["ucc"];const b=this.GetSdkType().GetObstacleTypes();C3.clearArray(b);for(const c of a["t"]){const a=this._runtime.GetObjectClassBySID(c);a&&b.push(a)}}HasLOSToInstance(a){const b=a.GetUID(),c=a.GetWorldInfo(),d=this.HasLOSTo(c.GetX(),c.GetY());return d||this._ray.hitUid===b}HasLOSTo(a,b){const c=this.GetWorldInfo();let d=c.GetAngle();return 0>c.GetWidth()&&(d+=Math.PI),this.HasLOSBetweenPositions(c.GetX(),c.GetY(),d,a,b)}HasLOSBetweenPositions(b,c,d,e,f){const g=this._range;if(C3.distanceSquared(b,c,e,f)>g*g)return!1;const h=C3.angleTo(b,c,e,f);if(C3.angleDiff(d,h)>this._cone/2)return!1;const a=this.CastRay(b,c,e,f,this._useCollisionCells);return!a.DidCollide()}_GetCollisionCandidates(b,c){if(c){const c=this.GetWorldInfo().GetLayer(),d=this._runtime.GetCollisionEngine();return 0===this._obstacleMode?d.GetSolidCollisionCandidates(c,b.rect,a):d.GetObjectClassesCollisionCandidates(c,this._GetObstacleTypes(),b.rect,a),a}if(0===this._obstacleMode){const b=this._runtime.GetSolidBehavior();return b?b.GetInstances():a}for(const d of this._GetObstacleTypes())C3.appendArray(a,d.GetInstances());return a}_GetObstacleTypes(){return this.GetSdkType().GetObstacleTypes()}CastRay(b,c,d,e,f){const g=this._ray.Set(b,c,d,e),h=this._GetCollisionCandidates(g,f),j=this._runtime.GetCollisionEngine(),k=0===this._obstacleMode,l=this._inst;for(let a=0,i=h.length;a<i;++a){const b=h[a];b===l||k&&!j.IsSolidCollisionAllowed(b,l)||j.TestRayIntersectsInstance(b,g)}return g.Complete(),C3.clearArray(a),g}GetPropertyValueByIndex(a){return a===0?this._obstacleMode:1===a?this._range:2===a?C3.toDegrees(this._cone):3===a?this._useCollisionCells:void 0}SetPropertyValueByIndex(a,b){a===0?this._obstacleMode=b:1===a?this._range=b:2===a?this._cone=C3.toRadians(b):3===a?this._useCollisionCells=!!b:void 0}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.los.properties.range.name",value:this._range,onedit:(a)=>this._range=a},{name:"behaviors.los.properties.cone-of-view.name",value:C3.toDegrees(this._cone),onedit:(a)=>this._cone=C3.toRadians(a)}]}]}}}
"use strict";{const a=new Set,b=new Set;C3.Behaviors.LOS.Cnds={HasLOSToPosition(a,b){return this.HasLOSTo(a,b)},RayIntersected(){return this._ray.DidCollide()},HasLOSBetweenPositions(a,b,c,d,e){return this.HasLOSBetweenPositions(a,b,C3.toRadians(c),d,e)},HasLOSToObject(c){if(!c)return!1;const d=this._runtime.GetCurrentCondition(),e=d.GetObjectClass().GetCurrentSol(),f=c.GetCurrentSol(),g=e.GetInstances(),h=f.GetInstances();e.IsSelectAll()&&C3.clearArray(e._GetOwnElseInstances()),f.IsSelectAll()&&C3.clearArray(f._GetOwnElseInstances());const i=d.IsInverted(),j=this.GetSdkType();for(const d of g){let c=!1;const e=j.FindLOSBehavior(d);for(const a of h)d!==a&&C3.xor(e.HasLOSToInstance(a),i)&&(c=!0,b.add(a));c&&a.add(d)}return e.SetArrayPicked([...a]),f.SetArrayPicked([...b]),a.clear(),b.clear(),e.HasAnyInstances()}}}
"use strict";C3.Behaviors.LOS.Acts={SetRange(a){this._range=a},SetCone(a){this._cone=C3.toRadians(a)},CastRay(a,b,c,d,e){this.CastRay(a,b,c,d,e)},AddObstacle(a){const b=this.GetSdkType().GetObstacleTypes();if(!b.includes(a)){for(const c of b)if(c.IsFamily()&&c.FamilyHasMember(a))return;b.push(a)}},ClearObstacles(){C3.clearArray(this.GetSdkType().GetObstacleTypes())}};
"use strict";C3.Behaviors.LOS.Exps={Range(){return this._range},ConeOfView(){return C3.toDegrees(this._cone)},HitX(){const a=this._ray;return a.DidCollide()?a.hitX:0},HitY(){const a=this._ray;return a.DidCollide()?a.hitY:0},HitDistance(){const a=this._ray;return a.DidCollide()?a.distance:0},HitUID(){const a=this._ray;return a.DidCollide()?a.hitUid:-1},NormalX(a){const b=this._ray;return b.DidCollide()?b.hitX+a*b.normalX:0},NormalY(a){const b=this._ray;return b.DidCollide()?b.hitY+a*b.normalY:0},NormalAngle(){const a=this._ray;return a.DidCollide()?C3.toDegrees(a.hitNormal):0},ReflectionX(a){const b=this._ray;return b.DidCollide()?b.hitX+a*b.reflectionX:0},ReflectionY(a){const b=this._ray;return b.DidCollide()?b.hitY+a*b.reflectionY:0},ReflectionAngle(){const a=this._ray;return a.DidCollide()?C3.toDegrees(Math.atan2(a.reflectionY,a.reflectionX)):0}};
"use strict";C3.Behaviors.solid=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.solid.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{const a=new Set;C3.Behaviors.solid.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a,b){super(a),this.SetEnabled(!0),b&&(this.SetEnabled(b[0]),this.SetTags(b[1]))}Release(){super.Release()}SetEnabled(a){this._inst._SetSolidEnabled(!!a)}IsEnabled(){return this._inst._IsSolidEnabled()}SetTags(a){const b=this._inst.GetSavedDataMap();if(!a.trim())return void b.delete("solidTags");let c=b.get("solidTags");c||(c=new Set,b.set("solidTags",c)),c.clear();for(const b of a.split(" "))b&&c.add(b.toLowerCase())}GetTags(){return this._inst.GetSavedDataMap().get("solidTags")||a}SaveToJson(){return{"e":this.IsEnabled()}}LoadFromJson(a){this.SetEnabled(a["e"])}GetPropertyValueByIndex(a){return a===0?this.IsEnabled():void 0}SetPropertyValueByIndex(a,b){a===0?this.SetEnabled(b):void 0}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.solid.properties.enabled.name",value:this.IsEnabled(),onedit:(a)=>this.SetEnabled(a)}]}]}}}
"use strict";C3.Behaviors.solid.Cnds={IsEnabled(){return this.IsEnabled()}};
"use strict";C3.Behaviors.solid.Acts={SetEnabled(a){this.SetEnabled(a)},SetTags(a){this.SetTags(a)}};
"use strict";C3.Behaviors.solid.Exps={};
"use strict";C3.Behaviors.Persist=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Persist.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";C3.Behaviors.Persist.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Persist.Cnds={};
"use strict";C3.Behaviors.Persist.Acts={};
"use strict";C3.Behaviors.Persist.Exps={};
"use strict";C3.Behaviors.Bullet=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Bullet.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{C3.Behaviors.Bullet.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(b,c){var d=Math.abs;super(b);const e=this.GetWorldInfo();this._speed=0,this._acc=0,this._g=0,this._bounceOffSolid=!1,this._setAngle=!1,this._isStepping=!1,this._isEnabled=!0,this._dx=0,this._dy=0,this._lastX=e.GetX(),this._lastY=e.GetY(),this._lastKnownAngle=e.GetAngle(),this._travelled=0,this._stepSize=Math.min(d(e.GetWidth()),d(e.GetHeight())/2),this._stopStepping=!1,c&&(this._speed=c[0],this._acc=c[1],this._g=c[2],this._bounceOffSolid=!!c[3],this._setAngle=!!c[4],this._isStepping=!!c[5],this._isEnabled=!!c[6]);const f=e.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 a={"dx":this._dx,"dy":this._dy,"lx":this._lastX,"ly":this._lastY,"lka":this._lastKnownAngle,"t":this._travelled};return 0!==this._acc&&(a["acc"]=this._acc),0!==this._g&&(a["g"]=this._g),this._isStepping&&(a["st"]=this._isStepping),this._isEnabled||(a["e"]=this._isEnabled),this._bounceOffSolid&&(a["bos"]=this._bounceOffSolid),this._setAngle&&(a["sa"]=this._setAngle),a}LoadFromJson(a){this._dx=a["dx"],this._dy=a["dy"],this._lastX=a["lx"],this._lastY=a["ly"],this._lastKnownAngle=a["lka"],this._travelled=a["t"],this._acc=a.hasOwnProperty("acc")?a["acc"]:0,this._g=a.hasOwnProperty("g")?a["g"]:0,this._isStepping=!!a.hasOwnProperty("st")&&a["st"],this._bounceOffSolid=!!a.hasOwnProperty("bos")&&a["bos"],this._setAngle=!!a.hasOwnProperty("sa")&&a["sa"],this._SetEnabled(!a.hasOwnProperty("e")||a["e"])}Tick(){var b=Math.sin,c=Math.cos;if(!this._isEnabled)return;const d=this._runtime.GetDt(this._inst),e=this._inst.GetWorldInfo();if(e.GetAngle()!==this._lastKnownAngle){const a=e.GetAngle();if(this._setAngle){const d=C3.distanceTo(0,0,this._dx,this._dy);this._dx=c(a)*d,this._dy=b(a)*d}this._lastKnownAngle=a}let f=0,g=0;if(0!==this._acc){let h=C3.distanceTo(0,0,this._dx,this._dy),i=0;i=0===this._dx&&0===this._dy?e.GetAngle():C3.angleTo(0,0,this._dx,this._dy),h+=this._acc*d,f=c(i)*this._acc,g=b(i)*this._acc,0>h&&(h=0,f=0,g=0),this._dx=c(i)*h,this._dy=b(i)*h}if(0!==this._g&&(this._dy+=this._g*d,g+=this._g),this._lastX=e.GetX(),this._lastY=e.GetY(),0!==this._dx||0!==this._dy){const b=this._dx*d+.5*f*d*d,c=this._dy*d+.5*g*d*d,a=C3.distanceTo(0,0,b,c);if(this._MoveBy(b,c,a),this._travelled+=a,this._setAngle&&(0!=b||0!=c)){const d=C3.angleTo(0,0,b,c);e.SetAngle(d),this._lastKnownAngle=e.GetAngle()}e.SetBboxChanged()}}_MoveBy(b,c,d){const e=this.GetWorldInfo();if(!this._isStepping||d<=this._stepSize)return e.OffsetXY(b,c),e.SetBboxChanged(),void(this._isStepping&&this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep));this._stopStepping=!1;const f=e.GetX(),g=e.GetY(),h=C3.angleTo(0,0,b,c),a=Math.cos(h)*this._stepSize,j=Math.sin(h)*this._stepSize,k=Math.floor(d/this._stepSize);for(let h=1;h<=k;++h)if(e.SetXY(f+a*h,g+j*h),e.SetBboxChanged(),this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep),this._inst.IsDestroyed()||this._stopStepping)return;e.SetXY(f+b,g+c),e.SetBboxChanged(),this.Trigger(C3.Behaviors.Bullet.Cnds.OnStep)}PostTick(){if(this._isEnabled&&this._bounceOffSolid&&(0!==this._dx||0!==this._dy)){const a=this._runtime.GetDt(this._inst),b=this._inst.GetWorldInfo(),c=this._runtime.GetCollisionEngine(),d=c.TestOverlapSolid(this._inst);if(d){c.RegisterCollision(this._inst,d);const e=C3.distanceTo(0,0,this._dx,this._dy),f=c.CalculateBounceAngle(this._inst,this._lastX,this._lastY);this._dx=Math.cos(f)*e,this._dy=Math.sin(f)*e,b.OffsetXY(this._dx*a,this._dy*a),b.SetBboxChanged(),this._setAngle&&(b.SetAngle(f),this._lastKnownAngle=b.GetAngle(),b.SetBboxChanged()),c.PushOutSolid(this._inst,this._dx/e,this._dy/e,Math.max(2.5*e*a,30))||c.PushOutSolidNearest(this._inst,100)}}}GetPropertyValueByIndex(a){return a===0?this._GetSpeed():1===a?this._GetAcceleration():2===a?this._GetGravity():4===a?this._setAngle:5===a?this._isStepping:6===a?this._IsEnabled():void 0}SetPropertyValueByIndex(a,b){a===0?this._SetSpeed(b):1===a?this._acc=b:2===a?this._g=b:4===a?this._setAngle=!!b:5===a?this._isStepping=!!b:6===a?this._SetEnabled(!!b):void 0}_SetSpeed(b){const c=C3.angleTo(0,0,this._dx,this._dy);this._dx=Math.cos(c)*b,this._dy=Math.sin(c)*b}_GetSpeed(){return C3.round6dp(C3.distanceTo(0,0,this._dx,this._dy))}_SetAcceleration(b){this._acc=b}_GetAcceleration(){return this._acc}_SetGravity(a){this._g=a}_GetGravity(){return this._g}_SetAngleOfMotion(b){const a=C3.distanceTo(0,0,this._dx,this._dy);this._dx=Math.cos(b)*a,this._dy=Math.sin(b)*a}_GetAngleOfMotion(){return C3.angleTo(0,0,this._dx,this._dy)}_SetBounceOffSolids(a){a=!!a;this._bounceOffSolid===a||(this._bounceOffSolid=a,this._isEnabled&&(this._bounceOffSolid?this._StartPostTicking():this._StopPostTicking()))}_IsBounceOffSolids(){return this._bounceOffSolid}_SetDistanceTravelled(a){this._travelled=a}_GetDistanceTravelled(){return this._travelled}_SetEnabled(a){this._isEnabled=!!a,this._isEnabled?(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:(a)=>this._dx=a},{name:"behaviors.bullet.debugger.vector-y",value:this._dy,onedit:(a)=>this._dy=a},{name:"behaviors.bullet.properties.speed.name",value:this._GetSpeed(),onedit:(a)=>this._SetSpeed(a)},{name:"behaviors.bullet.debugger.angle-of-motion",value:C3.toDegrees(this._GetAngleOfMotion())},{name:"behaviors.bullet.properties.gravity.name",value:this._GetGravity(),onedit:(a)=>this._SetGravity(a)},{name:"behaviors.bullet.properties.acceleration.name",value:this._GetAcceleration(),onedit:(a)=>this._SetAcceleration(a)},{name:"behaviors.bullet.debugger.distance-travelled",value:this._GetDistanceTravelled()},{name:"behaviors.bullet.properties.enabled.name",value:this._IsEnabled(),onedit:(a)=>this._SetEnabled(a)}]}]}GetScriptInterfaceClass(){return IBulletBehaviorInstance}};const c=new WeakMap;self.IBulletBehaviorInstance=class extends IBehaviorInstance{constructor(){super(),c.set(this,IBehaviorInstance._GetInitInst().GetSdkInstance())}get speed(){return c.get(this)._GetSpeed()}set speed(a){c.get(this)._SetSpeed(a)}get acceleration(){return c.get(this)._GetAcceleration()}set acceleration(b){c.get(this)._SetAcceleration(b)}get gravity(){return c.get(this)._GetGravity()}set gravity(a){c.get(this)._SetGravity(a)}get angleOfMotion(){return c.get(this)._GetAngleOfMotion()}set angleOfMotion(b){c.get(this)._SetAngleOfMotion(b)}get bounceOffSolids(){return c.get(this)._IsBounceOffSolids()}set bounceOffSolids(a){c.get(this)._SetBounceOffSolids(!!a)}get distanceTravelled(){return c.get(this)._GetDistanceTravelled()}set distanceTravelled(a){c.get(this)._SetDistanceTravelled(a)}get isEnabled(){return c.get(this)._IsEnabled()}set isEnabled(a){c.get(this)._SetEnabled(a)}}}
"use strict";C3.Behaviors.Bullet.Cnds={CompareSpeed(a,b){const c=Math.sqrt(this._dx*this._dx+this._dy*this._dy);return C3.compare(c,a,b)},CompareTravelled(a,b){return C3.compare(this._GetDistanceTravelled(),a,b)},OnStep(){return!0},IsEnabled(){return this._IsEnabled()}};
"use strict";C3.Behaviors.Bullet.Acts={SetSpeed(a){this._SetSpeed(a)},SetAcceleration(b){this._SetAcceleration(b)},SetGravity(a){this._SetGravity(a)},SetAngleOfMotion(b){this._SetAngleOfMotion(C3.toRadians(b))},Bounce(a){var b=Math.max;if(a){const c=a.GetFirstPicked(this._inst);if(c){const a=this._inst.GetWorldInfo(),d=this._runtime.GetCollisionEngine(),e=this._runtime.GetDt(this._inst),f=C3.distanceTo(0,0,this._dx,this._dy),g=d.CalculateBounceAngle(this._inst,this._lastX,this._lastY,c);this._dx=Math.cos(g)*f,this._dy=Math.sin(g)*f,a.OffsetXY(this._dx*e,this._dy*e),a.SetBboxChanged(),this._setAngle&&(a.SetAngle(g),this._lastKnownAngle=a.GetAngle(),a.SetBboxChanged()),0!==f&&(this._bounceOffSolid?!d.PushOutSolid(this._inst,this._dx/f,this._dy/f,b(2.5*f*e,30))&&d.PushOutSolidNearest(this._inst,100):d.PushOut(this._inst,this._dx/f,this._dy/f,b(2.5*f*e,30),c))}}},SetBounceOffSolids(a){this._SetBounceOffSolids(a)},SetDistanceTravelled(a){this._SetDistanceTravelled(a)},SetEnabled(a){this._SetEnabled(a)},StopStepping(){this._stopStepping=!0}};
"use strict";C3.Behaviors.Bullet.Exps={Speed(){return this._GetSpeed()},Acceleration(){return this._GetAcceleration()},AngleOfMotion(){return C3.toDegrees(this._GetAngleOfMotion())},DistanceTravelled(){return this._GetDistanceTravelled()},Gravity(){return this._GetGravity()}};
"use strict";C3.Behaviors.Fade=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Fade.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{C3.Behaviors.Fade.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a,b){super(a),this._fadeInTime=0,this._waitTime=0,this._fadeOutTime=0,this._destroy=!0,this._activeAtStart=!0,this._setMaxOpacity=!1,this._stage=0,this._stageTime=C3.New(C3.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._activeAtStart=!!b[4],this._stage=this._activeAtStart?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(){const a=this._runtime.GetDt(this._inst);this._stageTime.Add(a);const b=this._inst.GetWorldInfo();0===this._stage&&(b.SetOpacity(this._stageTime.Get()/this._fadeInTime)*this._maxOpacity,this._runtime.UpdateRender(),b.GetOpacity()>=this._maxOpacity&&(b.SetOpacity(this._maxOpacity),this._stage=1,this._stageTime.Reset(),this.Trigger(C3.Behaviors.Fade.Cnds.OnFadeInEnd))),1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(C3.Behaviors.Fade.Cnds.OnWaitEnd)),2===this._stage&&0!==this._fadeOutTime&&(b.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity),this._runtime.UpdateRender(),0>=b.GetOpacity()&&(this._stage=3,this._stageTime.Reset(),this.Trigger(C3.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){return a===0?this._fadeInTime:1===a?this._waitTime:2===a?this._fadeOutTime:3===a?this._destroy:void 0}SetPropertyValueByIndex(a,b){a===0?this._fadeInTime=b:1===a?this._waitTime=b:2===a?this._fadeOutTime=b:3===a?this._destroy=!!b:void 0}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";C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return!0},OnFadeInEnd(){return!0},OnWaitEnd(){return!0}};
"use strict";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(a){0>a&&(a=0),this._fadeInTime=a},SetWaitTime(a){0>a&&(a=0),this._waitTime=a},SetFadeOutTime(a){0>a&&(a=0),this._fadeOutTime=a}};
"use strict";C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}};
"use strict";
{
C3.Behaviors.aekiro_gameobject = class MyBehavior extends C3.SDKBehaviorBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
function EventManager(inst){
this.map = {};
this.inst = inst;
}
EventManager.prototype.constructor = EventManager;
EventManager.prototype.on = function (eventName,callback) {
if(!this.map[eventName]){
this.map[eventName] = [];
}
this.map[eventName].push(callback);
};
EventManager.prototype.emit = function (eventName,options) {
var callbacks = this.map[eventName];
if(callbacks){
for (var i = 0,l=callbacks.length; i < l; i++) {
callbacks[i](options);
}
}
//bubble the event up the hierarchy
if(this.inst){
var go = this.inst.GetUnsavedDataMap().aekiro_gameobject;
if(go.parent){
go.parent.GetUnsavedDataMap().aekiro_gameobject.eventManager.emit(eventName,options);
}
}
};
var aekiro_goManager = {
gos : {},
haltNext:false,
isRegistering:false,
eventManager: new EventManager(),
lastLayout:0,
init : function(runtime,beh){
if(this.runtime)return;
this.runtime = runtime;
var _self = this;
//this is used instead of Release(), because Release() comes after beforelayoutstart and clears everything that was setup.
this.runtime.Dispatcher().addEventListener("instancedestroy", function(e){
//if(!runtime.GetLayoutManager().IsEndingLayout())return;
var go = e.instance.GetUnsavedDataMap().aekiro_gameobject;
if(go){
go.Release2();
}
});
var layouts = this.runtime.GetLayoutManager().GetAllLayouts();
for (var i = 0, l= layouts.length; i < l; i++) {
layouts[i]._iLayout.addEventListener("beforelayoutstart",function(){
console.log("aekiro_goManager: beforelayoutstart");
//console.log(_self.gos);
_self.register();
});
}
},
clean : function(){
var key;
for(key in this.gos){
if(this.gos[key].IsDestroyed()){
console.log("az");
this.removeGO(key);
}
}
},
clean2 : function(){
var key;
for(key in this.gos){
if(!this.gos[key].GetObjectClass().IsGlobal()){
this.removeGO(key);
//remove from its parent's children list
//this.removeFromParent();
/*var runtime = this.GetRuntime();
for (var i = 0, l= this.children.length; i < l; i++) {
runtime.DestroyInstance(this.children[i]);
}
this.children.length = 0;*/
}
}
},
addGO : function(inst){
if(this.haltNext)return;
if(!inst)return;
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(!aekiro_gameobject.name){
aekiro_gameobject.name = "o"+inst.GetUID();
}
/*if(!name){
console.error("Aekiro Hierarchy: object of uid=%s has no name !",inst.uid);
return;
}*/
var name = aekiro_gameobject.name;
if(this.gos.hasOwnProperty(name)){
console.error("Aekiro Hierarchy: GameObject already exist with name: %s !",name);
return;
}
this.gos[name] = inst;
},
removeGO : function(name){
delete this.gos[name];
},
createInstance : function (objectClass,layer,x,y){
var inst = this.runtime.CreateInstance(objectClass,layer,x,y);
const b = this.runtime.GetEventSheetManager();
b.BlockFlushingInstances(!0);
//inst._TriggerOnCreated();
b.BlockFlushingInstances(!1),
//if(!doNotChangeCurrentSelection){
objectClass.GetCurrentSol().SetSinglePicked(inst);
return inst;
},
clone : function (template,name,parent,layer, x, y){
if(this.gos[name]){
console.error("Aekiro GameObject: GameObject already exist with name: %s !",name);
return;
}
if (typeof parent === 'string'){
parent = this.gos[parent];
}
//the x,y are global and clone expect locals, so transform xy into locals in parent space
if(parent){
var wp = parent.GetWorldInfo();
var res = this.globalToLocal3(x,y,0,wp.GetX("g"),wp.GetY("g"),wp.GetAngle("g"));
x = res.x;
y = res.y;
}
var inst = this._clone(template,name,parent,layer,x,y);
inst.GetUnsavedDataMap().aekiro_gameobject.children_update();
return inst;
},
_clone : function (t_node,name,parent,layer, x, y){
//haltNext is used to skip some functions executed on the instance creation
this.haltNext = true;
var inst = this.createInstance(t_node.type, layer);
this.haltNext = false;
var b;
try {
b = JSON.parse(t_node.json);
} catch (a) {
return void console.error("Failed to load from JSON string: ", a);
}
inst.LoadFromJson(b,!0);
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
inst.GetUnsavedDataMap().zindex = t_node.zindex;
inst.GetSdkInstance().CallAction(aekiro_gameobject.acts.MoveToLayer,layer);
aekiro_gameobject.name = "";
if(name)aekiro_gameobject.name = name;
aekiro_gameobject.onCreateInit();
if(parent){
parent.GetUnsavedDataMap().aekiro_gameobject.children_add(inst);
}
var wi = inst.GetWorldInfo();
wi.SetX(x);
wi.SetY(y);
wi.SetBboxChanged();
//we put the trigger after the json state is applied, so that any modif happening in the eventsheet onCreated wont be overrided by the LoadFromJsonString
inst._TriggerOnCreated();
var child;
for (var i = 0, l= t_node.children.length; i < l; i++) {
child = t_node.children[i];
this._clone(child,null,inst, layer, child.x, child.y);
}
return inst;
},
globalToLocal3: function(x,y,a,p_x,p_y,p_angle){
var res = {};
res.x = (x-p_x)*Math.cos(p_angle) + (y-p_y)*Math.sin(p_angle);
res.y = -(x-p_x)*Math.sin(p_angle) + (y-p_y)*Math.cos(p_angle);
res.angle = a - p_angle;
return res;
},
register:function(){
/*if(this.isRegistering)return;
this.isRegistering = true;*/
//console.log(this.gos);
var key, go, aekiro_gameobject;
var parentSameLayer = {};
for(key in this.gos){
go = this.gos[key];
aekiro_gameobject = go.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parentName && this.gos[aekiro_gameobject.parentName]){
this.gos[aekiro_gameobject.parentName].GetUnsavedDataMap().aekiro_gameobject.children_add(go);
}
if(aekiro_gameobject.parentSameLayer){
parentSameLayer[key] = go;
}
}
for(key in parentSameLayer){
go = parentSameLayer[key];
aekiro_gameobject = go.GetUnsavedDataMap().aekiro_gameobject;
aekiro_gameobject.children_addFromLayer(aekiro_gameobject.GetWorldInfo().GetLayer());
}
//the onCreated trigger is executed before the children_register; so when a modif is applied to the parent on the trigger, the chidlren dont get updated
for(key in this.gos){
this.gos[key].GetUnsavedDataMap().aekiro_gameobject.children_update();
}
console.log("childrenRegistred");
this.eventManager.emit("childrenRegistred");
}
}
"use strict";
{
C3.Behaviors.aekiro_gameobject.Type = class MyBehaviorType extends C3.SDKBehaviorTypeBase
{
constructor(behaviorType)
{
super(behaviorType);
}
Release()
{
super.Release();
}
OnCreate()
{
}
};
}
"use strict";
{
C3.Behaviors.aekiro_gameobject.Instance = class MyBehaviorInstance extends C3.SDKBehaviorInstanceBase {
constructor(behInst, properties)
{
super(behInst);
//properties
if (properties){
this.name = properties[0];
this.parentName = properties[1];
this.parentSameLayer = properties[2];
}
//********************
var self = this;
this.GetObjectInstance().GetUnsavedDataMap().aekiro_gameobject = this;
this.inst = this.GetObjectInstance();
this.wi = this.GetWorldInfo();
this.acts = this.GetObjectInstance().GetPlugin().constructor.Acts;
this.eventManager = new EventManager(this.inst);
this.goManager = aekiro_goManager;
/*this.eventManager.on("childrenAdded",function(){
console.log("onChildrenAdded " + self.GetObjectInstance().GetUID());
});*/
this.userName = this.name?this.name:null;
this.areChildrenRegistred = false;
this.children = [];
this.parent = null;
this.local = {
x : this.wi.GetX("g"),
y : this.wi.GetY("g"),
angle: this.wi.GetAngle("g"),
_sinA: Math.sin(this.wi.GetAngle("g")),
_cosA: Math.cos(this.wi.GetAngle("g"))
};
this.overrideBuiltin = true;
this.updateHierarchy = true;
this.overrideWorldInfo();
this.goManager.init(this.GetRuntime(),this.GetBehaviorType().GetBehavior());
//if(this.goManager.haltNext)return;
this.goManager.addGO(this.inst);
this.prev = {
x : this.wi.GetX("g"),
y : this.wi.GetY("g"),
angle : this.wi.GetAngle("g"),
width: this.wi.GetWidth(),
height: this.wi.GetHeight()
};
//console.log(this.GetBehaviorType().GetBehavior().GetInstances());
//console.log(this);
this._StartTicking()
console.log("constructor gameobject");
}
PostCreate(){
//console.log("PostCreate gameobject");
}
overrideWorldInfo(){
if(this.isWorldInfoOverrided)return;
this.isWorldInfoOverrided = true;
var inst = this.GetObjectInstance();
var wi = inst.GetWorldInfo();
wi.SetX_old = wi.SetX;
wi.SetX = function (x,space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent){
var y = this.GetY();
if(space){ //local
aekiro_gameobject.local.x = x;
x = aekiro_gameobject.localToGlobal_x();
y = aekiro_gameobject.localToGlobal_y();
}
this.SetXY_old(x,y);
}else{
this.SetX_old(x);
}
aekiro_gameobject.children_update();
};
wi.SetY_old = wi.SetY;
wi.SetY = function (y,space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent){
var x = this.GetX();
if(space){//local
aekiro_gameobject.local.y = y;
x = aekiro_gameobject.localToGlobal_x();
y = aekiro_gameobject.localToGlobal_y();
}
this.SetXY_old(x,y);
}else{
this.SetY_old(y);
}
aekiro_gameobject.children_update();
};
wi.SetXY_old = wi.SetXY;
wi.SetXY = function (x,y,space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent){
if(space){ //local
aekiro_gameobject.local.x = x;
aekiro_gameobject.local.y = y;
x = aekiro_gameobject.localToGlobal_x();
y = aekiro_gameobject.localToGlobal_y();
}
this.SetXY_old(x,y);
}else{
this.SetXY_old(x,y);
}
aekiro_gameobject.children_update();
//console.log("az");
};
wi.OffsetX_old = wi.OffsetX;
wi.OffsetX = function (_x,space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent){
var x = this.GetX();
var y = this.GetY();
if(space){ //local
aekiro_gameobject.local.x += _x;
x = aekiro_gameobject.localToGlobal_x();
y = aekiro_gameobject.localToGlobal_y();
}else{
x += _x;
}
this.SetXY_old(x,y);
}else{
this.OffsetX_old(_x);
}
aekiro_gameobject.children_update();
};
wi.OffsetY_old = wi.OffsetY;
wi.OffsetY = function (_y,space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent){
var x = this.GetX();
var y = this.GetY();
if(space){ //local
aekiro_gameobject.local.y += _y;
x = aekiro_gameobject.localToGlobal_x();
y = aekiro_gameobject.localToGlobal_y();
}else{
y += _y;
}
this.SetXY_old(x,y);
}else{
this.OffsetY_old(_y);
}
aekiro_gameobject.children_update();
};
wi.OffsetXY_old = wi.OffsetXY;
wi.OffsetXY = function (_x,_y,space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent){
var x = this.GetX();
var y = this.GetY();
if(space){ //local
aekiro_gameobject.local.x += _x;
aekiro_gameobject.local.y += _y;
x = aekiro_gameobject.localToGlobal_x();
y = aekiro_gameobject.localToGlobal_y();
}else{
x += _x;
y += _y;
}
this.SetXY_old(x,y);
}else{
this.OffsetXY_old(_x,_y);
}
aekiro_gameobject.children_update();
};
wi.SetAngle_old = wi.SetAngle;
wi.SetAngle = function (angle,space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent){
if(space){ //local
aekiro_gameobject.local.angle = angle;
aekiro_gameobject.local._sinA = Math.sin(angle);
aekiro_gameobject.local._cosA = Math.cos(angle);
angle = aekiro_gameobject.localToGlobal_angle();
}
this.SetAngle_old(angle);
}else{
this.SetAngle_old(angle);
}
aekiro_gameobject.children_update();
//console.log("az");
};
wi.GetX_old = wi.GetX;
wi.GetX = function (space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent && space !== undefined){
return aekiro_gameobject.local.x;
}
return this.GetX_old();
};
wi.GetY_old = wi.GetY;
wi.GetY = function (space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent && space !== undefined){
return aekiro_gameobject.local.y;
}
return this.GetY_old();
};
wi.GetAngle_old = wi.GetAngle;
wi.GetAngle = function (space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent && space){
return aekiro_gameobject.local.angle;
}
return this.GetAngle_old();
};
wi.GetCosAngle_old = wi.GetCosAngle;
wi.GetCosAngle = function (space){
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent && space){
return aekiro_gameobject.local._cosA;
}
return this.GetCosAngle_old();
};
wi.GetSinAngle_old = wi.GetSinAngle;
wi.GetSinAngle = function (space){
//console.log("eee");
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject.parent && space){
return aekiro_gameobject.local._sinA;
}
return this.GetSinAngle_old();
};
wi.SetWidth_old = wi.SetWidth;
wi.SetWidth = function (v,onlyNode){
if(onlyNode)this.SetWidth_old(v);
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
/*if(!aekiro_gameobject.areChildrenRegistred)
aekiro_gameobject.children_register();*/
v = v==0?0.1:v;
var f = v/this.GetWidth();
this.SetWidth_old(v);
var h = aekiro_gameobject.children;
for (var i = 0, l= h.length; i < l; i++) {
wi = h[i].GetWorldInfo();
wi.SetWidth(wi.GetWidth()*f);
wi.SetX(wi.GetX("g")*f, "g");
wi.SetBboxChanged();
}
};
wi.SetHeight_old = wi.SetHeight;
wi.SetHeight = function (v,onlyNode){
if(onlyNode)this.SetHeight_old(v);
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
/*if(!aekiro_gameobject.areChildrenRegistred)
aekiro_gameobject.children_register();*/
v = v==0?0.1:v;
var f = v/this.GetHeight();
this.SetHeight_old(v);
var h = aekiro_gameobject.children;
for (var i = 0, l= h.length; i < l; i++) {
wi = h[i].GetWorldInfo();
wi.SetHeight(wi.GetHeight()*f);
wi.SetY(wi.GetY("g")*f, "g");
wi.SetBboxChanged();
}
};
wi.SetSize_old = wi.SetSize;
wi.SetSize = function (w,h,onlyNode){
if(onlyNode)this.SetSize_old(w,h);
var inst = this.GetInstance();
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
/*if(!aekiro_gameobject.areChildrenRegistred)
aekiro_gameobject.children_register();*/
w = w==0?0.1:w;
h = h==0?0.1:h;
var fw = h/this.GetHeight();
var fh = w/this.GetWidth();
this.SetSize_old(w,h);
var c = aekiro_gameobject.children;
for (var i = 0, l= c.length; i < l; i++) {
wi = c[i].GetWorldInfo();
wi.SetSize(wi.GetWidth()*fw,wi.GetHeight()*fh);
wi.SetX(wi.GetX("g")*fw, "g");
wi.SetY(wi.GetY("g")*fh, "g");
wi.SetBboxChanged();
}
};
}
//**********************************************
children_update(){
if(!this.children.length)
return;
var inst,wi;
for (var i = 0, l= this.children.length; i < l; i++) {
inst = this.children[i];
wi = inst.GetWorldInfo();
if (!inst.prevFrame) {
inst.prevFrame = {
x: wi.GetX(),
y: wi.GetY(),
angle: wi.GetAngle()
}
}
//updating the child's global coordinates when the parent global coordinates changes.
wi.SetXY(wi.GetX("g") + wi.GetX() - inst.prevFrame.x, wi.GetY("g") + wi.GetY() - inst.prevFrame.y, "g");
wi.SetAngle(wi.GetAngle("g") + wi.GetAngle() - inst.prevFrame.angle, "g");
wi.SetBboxChanged();
inst.prevFrame = {
x: wi.GetX(),
y: wi.GetY(),
angle: wi.GetAngle()
}
}
}
children_add(inst){
var name,aekiro_gameobject;
if (typeof inst === 'string'){ //add by child name
name = inst;
inst = null;
}else{
aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(!aekiro_gameobject){
console.error("Aekiro GameObject: You're adding a child (uid=%s) without a gameobject behavior on it.",inst.GetUID());
return;
}
name = aekiro_gameobject.name;
}
//check if gameobject is correctly registred in the gomanager
inst = aekiro_goManager.gos[name];
if(inst == this.GetObjectInstance()){ //can't add itself
return;
}
if(!inst){
console.error("Aekiro GameObject: Object of name : %s not found !",name);
return;
}
if(name == this.parentName){
console.error("Aekiro GameObject: Cannot add %s as a child of %s, because %s is its parent !",name,this.name,name);
return;
}
if(this.children.indexOf(inst) > -1){
console.error("Aekiro GameObject: Object %s already have a child named %s !",this.name,name);
return;
}
aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
aekiro_gameobject.removeFromParent(); //if inst is already a child of another parent then remove it from its parent.
aekiro_gameobject.parentName = this.name;
aekiro_gameobject.parent = this.GetObjectInstance();
var res = this.globalToLocal(inst,this.GetObjectInstance());
aekiro_gameobject.local.x = res.x;
aekiro_gameobject.local.y = res.y
aekiro_gameobject.local.angle = res.angle;
this.children.push(inst);
this.eventManager.emit("childrenAdded",inst);
}
children_addFromLayer (layer){
var insts = layer._instances;
var myInst = this.GetObjectInstance();
var inst,aekiro_gameobject;
for (var i = 0, l = insts.length; i < l; i++) {
inst = insts[i];
aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
if(inst != myInst && aekiro_gameobject && aekiro_gameobject.parentName==""){
this.children_add(inst);
}
}
}
children_addFromType (type){
var insts = type.GetCurrentSol().GetInstances();
for (var i = 0, l = insts.length; i < l; i++) {
this.children_add(insts[i]);
}
}
children_remove(inst){
var index = -1;
if (typeof inst === 'string'){ //remove by child name
for (var i = 0, l= this.children.length; i < l; i++) {
if(this.children[i].GetUnsavedDataMap().aekiro_gameobject.name==inst){
index = i;
break;
}
}
}else{
index = this.children.indexOf(inst);
}
if(index!=-1){
var aekiro_gameobject = this.children[index].GetUnsavedDataMap().aekiro_gameobject;
aekiro_gameobject.parentName = "";
aekiro_gameobject.parent = null;
this.children.splice(index, 1);
}
}
children_removeFromType (type){
var insts = type.GetCurrentSol().GetInstances();
for (var i = 0, l = insts.length; i < l; i++) {
this.children_remove(insts[i]);
}
}
removeAllChildren(){
if(!this.children.length)
return;
var aekiro_gameobject;
for (var i = 0, l= this.children.length; i < l; i++) {
aekiro_gameobject = this.children[i].GetUnsavedDataMap().aekiro_gameobject;
aekiro_gameobject.parentName = "";
aekiro_gameobject.parent = null;
}
this.children.length = 0;
}
//**********************************************
removeFromParent(){
//var parent = this.parent_get();
var parent = this.parent;
var inst = this.GetObjectInstance();
if(parent){
var aekiro_gameobject = parent.GetUnsavedDataMap().aekiro_gameobject;
if(aekiro_gameobject){
aekiro_gameobject.children_remove(inst);
}
}
}
destroyHierarchy(){
var runtime = this.GetRuntime();
runtime.DestroyInstance(this.GetObjectInstance());
for (var i = 0, l= this.children.length; i < l; i++) {
this.children[i].GetUnsavedDataMap().aekiro_gameobject.destroyHierarchy()
}
this.children.length = 0;
}
parent_get(){
if(!this.parent && this.parentName && this.name){
this.parent = aekiro_goManager.gos[this.parentName];
}
return this.parent;
}
getTemplate(node){
if(!node){
node = this._inst;
}
var template = {
type: node.GetObjectClass(),
x: node.GetWorldInfo().GetX("g"),
y: node.GetWorldInfo().GetY("g"),
zindex:node.GetWorldInfo().GetZIndex()+node.GetWorldInfo().GetLayer().GetIndex()*100,
json:JSON.stringify(node.SaveToJson(!0)),
children:[]
};
var children = node.GetUnsavedDataMap().aekiro_gameobject.children;
for (var i = 0, l= children.length; i < l; i++) {
template.children.push(this.getTemplate(children[i]));
}
return template;
}
hierarchyToArray(node,ar){
if(!node){
node = this.GetObjectInstance();
}
if(!ar){
ar = [];
}
ar.push(node);
var children = node.GetUnsavedDataMap().aekiro_gameobject.children;
for (var i = 0, l= children.length; i < l; i++) {
this.hierarchyToArray(children[i],ar);
}
return ar;
}
updateZindex(){
var children = this.hierarchyToArray();
children.sort(function(a, b) {
return a.GetUnsavedDataMap().zindex - b.GetUnsavedDataMap().zindex;
});
//console.log(children);
var layer = children[0].GetWorldInfo().GetLayer();
//layer.moveInstanceAdjacent(children[0], children[children.length-1], true);
for (var i = 1, l= children.length; i < l; i++) {
layer.MoveInstanceAdjacent(children[i], children[i-1], true);
}
this.GetRuntime().UpdateRender();
}
Tick(){
this.children_update()
}
Release2(){
this.goManager.removeGO(this.name);
this.removeFromParent();
//this is necesserary when a parent have global children that still keep a reference to the parent.
//when changing layout this reference need to be deleted
for (var i = 0, l= this.children.length; i < l; i++) {
this.children_remove(this.children[i]);
}
super.Release();
}
SaveToJson(){
return {
};
}
LoadFromJson(o){
}
GetDebuggerProperties(){
var children = [];
for (var i = 0,l=this.children.length; i < l; i++) {
children.push(this.children[i].GetUnsavedDataMap().aekiro_gameobject.name);
}
var children_str = JSON.stringify(children,null,"\t");
var objects = [];
Object.keys(aekiro_goManager.gos).forEach(function(key) {
objects.push(key);
});
var objects_str = JSON.stringify(objects,null,"\t");
return [{
title: "aekiro_gameobject",
properties: [
{name: "name", value: this.name},
{name: "parentName", value: this.parentName},
{name: "children", value: children_str},
{name: "local_x", value: this.local.x},
{name: "local_y",value: this.local.y},
{name: "local_angle",value: this.local.angle},
{name: "gameobjects", value: objects_str}
]
}];
}
//**********************************************
applyActionToHierarchy(action,v){
this.GetObjectInstance().GetSdkInstance().CallAction(action,v);
var h = this.children;
for (var i = 0, l= h.length; i < l; i++) {
h[i].GetUnsavedDataMap().aekiro_gameobject.applyActionToHierarchy(action,v);
}
}
SetBlendMode(bm){
this.wi.SetBlendMode(bm);
var h = this.children;
for (var i = 0, l= h.length; i < l; i++) {
h[i].GetWorldInfo().SetBlendMode(bm);
}
}
//**********************************************
//transform global coordinates of inst to local coordinates in parent space
globalToLocal(inst,parent_inst){
var wip = parent_inst.GetWorldInfo();
return this.globalToLocal2(inst,wip.GetX(),wip.GetY(),wip.GetAngle());
}
globalToLocal2(inst,p_x,p_y,p_angle){
var res = {};
var wi = inst.GetWorldInfo();
res.x = (wi.GetX()-p_x)*Math.cos(p_angle) + (wi.GetY()-p_y)*Math.sin(p_angle);
res.y = -(wi.GetX()-p_x)*Math.sin(p_angle) + (wi.GetY()-p_y)*Math.cos(p_angle);
res.angle = wi.GetAngle() - p_angle;
return res;
}
//transform local coordinates of inst in parent space to global coordinates
localToGlobal(inst,p_x,p_y,p_angle){
var res = {};
var aekiro_gameobject = inst.GetUnsavedDataMap().aekiro_gameobject;
res.x = p_x + aekiro_gameobject.local.x*Math.cos(p_angle) - aekiro_gameobject.local.y*Math.sin(p_angle);
res.y = p_y + aekiro_gameobject.local.x*Math.sin(p_angle) + aekiro_gameobject.local.y*Math.cos(p_angle);
res.angle = p_angle + aekiro_gameobject.local.angle;
return res;
}
localToGlobal_x(){
var parent = this.parent_get();
if(parent){
//console.log(this.GetObjectInstance().GetUID());
var wp = parent.GetWorldInfo();
var x = wp.GetX() + this.local.x*Math.cos(wp.GetAngle()) - this.local.y*Math.sin(wp.GetAngle());
return x;
}else{
return this.local.x;
}
}
localToGlobal_y(){
var parent = this.parent_get();
if(parent){
var wp = parent.GetWorldInfo();
var y = wp.GetY() + this.local.x*Math.sin(wp.GetAngle()) + this.local.y*Math.cos(wp.GetAngle());
return y;
}else{
return this.local.y;
}
}
localToGlobal_angle(){
var parent = this.parent_get();
if(parent){
var wp = parent.GetWorldInfo();
var angle = wp.GetAngle() + this.local.angle;
return angle;
}else{
return this.local.angle;
}
}
};
}
"use strict";
{
C3.Behaviors.aekiro_gameobject.Cnds = {
IsName(name){ return name == this.name; },
IsParentName(name){return name == this.parentName; },
OnCloned(){ return false; }
};
}
"use strict";
{
C3.Behaviors.aekiro_gameobject.Acts = {
Clone(layer,x,y,name,parentName){
var template = this.getTemplate();
var inst = aekiro_goManager.clone(template,name,parentName,layer,x,y);
inst.GetUnsavedDataMap().aekiro_gameobject.updateZindex();
//this.cloneUID = inst.uid;
}
,
AddChildrenFromLayer(layer){
this.children_addFromLayer(layer);
},
AddChildrenFromType(type){
this.children_addFromType(type);
}
,
AddChildByName(name){
this.children_add(name);
},
RemoveChildByName(name){
this.children_remove(name);
},
RemoveChildByType(type){
this.children_removeFromType(type);
},
RemoveFromParent(){
this.removeFromParent();
},
RemoveAllchildren(){
this.removeAllChildren();
},
SetGlobalX(x){
},
SetOpacity(v){
this.applyActionToHierarchy(this.acts.SetOpacity,v);
},
SetVisible(v){
this.applyActionToHierarchy(this.acts.SetVisible,v);
},
SetColor(v){
this.applyActionToHierarchy(this.acts.SetDefaultColor,v);
},
SetMirrored(v){
this.applyActionToHierarchy(this.acts.SetMirrored,v);
},
SetFlipped(v){
this.applyActionToHierarchy(this.acts.SetFlipped,v);
},
MoveToLayer(v){
this.applyActionToHierarchy(this.acts.MoveToLayer,v);
},
SetZElevation(v){
this.applyActionToHierarchy(this.acts.SetZElevation,v);
},
SetEffect(v){
this.SetBlendMode(v);
},
SetWidth(v){
this.wi.SetWidth(v,true);
this.wi.SetBboxChanged();
},
SetHeight(v){
this.wi.SetHeight(v,true);
this.wi.SetBboxChanged();
},
Destroy(){
this.destroyHierarchy();
}
};
}
"use strict";
{
C3.Behaviors.aekiro_gameobject.Exps = {
name(){ return this.name; },
parent(){ return this.parentName; },
globalX(){ return this.GetObjectInstance().GetWorldInfo().GetX_old();},
globalY(){ return this.GetObjectInstance().GetWorldInfo().GetY_old();},
globalAngle(){ return this.GetObjectInstance().GetWorldInfo().GetAngle_old();}
};
}
"use strict";C3.Behaviors.jumpthru=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.jumpthru.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{C3.Behaviors.jumpthru.Instance=class extends C3.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){return a===0?this.IsEnabled():void 0}SetPropertyValueByIndex(a,b){a===0?this.SetEnabled(b):void 0}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.jumpthru.properties.enabled.name",value:this.IsEnabled(),onedit:(a)=>this.SetEnabled(a)}]}]}}}
"use strict";C3.Behaviors.jumpthru.Cnds={IsEnabled(){return this.IsEnabled()}};
"use strict";C3.Behaviors.jumpthru.Acts={SetEnabled(a){this.SetEnabled(a)}};
"use strict";C3.Behaviors.jumpthru.Exps={};
"use strict";C3.Behaviors.Tween=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Tween.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{const a=C3.Behaviors.Tween;a.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a,b){super(a),this._allowMultiple=!1,this._enabled=!0,b&&(this._allowMultiple=!1,this._enabled=!!b[0]),this._activeTweens=new Map,this._disabledTweens=[],this._waitingForReleaseTweens=new Map,this._finishingTween=null,this._activeTweensJson=null,this._disabledTweensJson=null,this._waitingForReleaseTweensJson=null,this._finishingTweenName="",this._enabled&&this._StartTicking2(),this._afterLoad=(a)=>this._OnAfterLoad(a),this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad),this._afterLoad=null,this._finishingTween&&(this.ReleaseAndCompleteTween(this._finishingTween),this._finishingTween=null),this.ReleaseAndCompleteTweens(),this._tweens=null,this.ClearDisabledList(),this._disabledTweens=null,this._ReleaseWaitingTweens(),this._waitingForReleaseTweens=null,super.Release()}SetEnabled(a){this._enabled=a,this._enabled?this._StartTicking2():this._StopTicking2()}GetEnabled(){return this._enabled}AddToDisabledList(a){this._disabledTweens.push(a)}IsInDisabledList(a){return this._disabledTweens.includes(a)}ClearDisabledList(){C3.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const a=this.GetObjectInstance();return!!a&&!a.IsDestroyed()}GetTween(a,b,c=!1){const d=b?this.PropertyTweens(b,c):this.AllTweens(c);if(d&&d.length)for(const b of d)if(b.HasTags(a))return b}GetTweenIncludingWaitingForRelease(a,b){return this.GetTween(a,b,!0)}*GetTweens(a,b,c=!1){const d=b?this.PropertyTweens(b,c):this.AllTweens(c);if(d&&d.length)for(const b of d)b.HasTags(a)&&(yield b)}*GetTweensIncludingWaitingForRelease(a,b){yield*this.GetTweens(a,b,!0)}PropertyTweens(a,b){if(b){let b=this._activeTweens.get(a),c=this._waitingForReleaseTweens.get(a);return b||(b=[]),c||(c=[]),b.concat(c).filter((a)=>a)}else{let b=this._activeTweens.get(a);return b||(b=[]),b.filter((a)=>a)}}AllTweens(a){if(a){const a=[...this._activeTweens.values()].flat(),b=[...this._waitingForReleaseTweens.values()].flat();return a.concat(b).filter((a)=>a)}else{const a=[...this._activeTweens.values()].flat();return a.filter((a)=>a)}}AllTweensIncludingWaitingForRelease(){return this.AllTweens(!0)}SaveToJson(){return{"s":!1,"e":!!this._enabled,"at":this._SaveActiveTweensToJson(),"dt":this._SaveDisabledTweensToJson(),"wt":this._SaveWaitingForReleaseTweensToJson(),"ft":this._SaveFinishingTweenToJson()}}LoadFromJson(a){a&&(this._activeTweensJson=a["at"],this._disabledTweensJson=a["dt"],this._waitingForReleaseTweensJson=a["wt"],this._finishingTweenName=a["ft"],this._allowMultiple=!1,this._enabled=!!a["e"])}_OnAfterLoad(){const a=this.GetRuntime().GetTimelineManager();if(this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,a),this._disabledTweensJson){C3.clearArray(this._disabledTweens);for(const b of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,b,a)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,a),this._finishingTween=this._GetTween(this._finishingTweenName,a),this._enabled?this._StartTicking2():this._StopTicking2()}_PopulateTweenMap(a,b,c){if(a)for(const d in a){let e=b.get(d);e?C3.clearArray(e):e=[];const f=a[d];for(const a of f){const b=this._PopulateTweenArray(e,a["name"],c);if(!b){const b=C3.Tween.Build({runtime:this.GetRuntime(),json:a});b.AddCompletedCallback((a)=>this._FinishTriggers(a)),c.AddScheduledTimeline(b),this._PopulateTweenArray(e,b,c)}else this._LoadTweenFromJson(a["name"],a,c)}b.set(d,e)}}_GetTween(a,b){return b.GetScheduledOrPlayingTimelineByName(a)}_PopulateTweenArray(a,b,c){if("string"==typeof b){const d=this._GetTween(b,c);if(d)return!!a.push(d)}else return!!a.push(b);return!1}_LoadTweenFromJson(a,b,c){if("string"==typeof a){const d=this._GetTween(a,c);d&&d._LoadFromJson(b)}else a._LoadFromJson(b)}_SaveActiveTweensToJson(){const a={};for(const[b,c]of this._activeTweens)a[b]=c.map((a)=>a._SaveToJson());return a}_SaveDisabledTweensToJson(){return this._disabledTweens.map((a)=>a.GetName())}_SaveWaitingForReleaseTweensToJson(){const a={};for(const[b,c]of this._waitingForReleaseTweens)a[b]=c.map((a)=>a._SaveToJson());return a}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(b){const c=a.Config.GetPropertyTracksConfig(b.property,b.startValue,b.endValue,b.ease,b.resultMode,this.GetObjectInstance()),d=a.Maps.GetPropertyFromIndex(b.property);a.Maps.IsValueId(d)||this.ReleaseTweens(b.property);const e=C3.Tween.Build({runtime:this.GetRuntime(),id:d,tags:b.tags,time:b.time,instance:this.GetObjectInstance(),releaseOnComplete:!!b.releaseOnComplete,initialValueMode:b.initialValueMode,propertyTracksConfig:c});return e.AddCompletedCallback((a)=>this._FinishTriggers(a)),this._AddTween(e,b.property),e}ReleaseTween(a,b=!1){const c=a.GetId();if(this._activeTweens.has(c)){const b=this._activeTweens.get(c);if(b){const c=b.indexOf(a);-1!==c&&b.splice(c,1)}}a.IsReleased()||this._IsInWaitingList(a)||(a.Stop(b),this._AddToWaitingList(a))}ReleaseTweens(b,c=!1){if(C3.IsFiniteNumber(b)){const d=a.Maps.GetPropertyFromIndex(b);if(!this._activeTweens.has(d))return;const e=this._activeTweens.get(d),f=this.GetFinishingTween();for(const a of e)a!==f&&(a.IsReleased()||this._IsInWaitingList(a)||(a.Stop(c),a.Release()));C3.clearArray(e)}else{const a=this.GetFinishingTween();for(const b of this.AllTweens())b!==a&&(b.IsReleased()||this._IsInWaitingList(b)||(b.Stop(c),b.Release()));for(const a of this._activeTweens.keys())C3.clearArray(this._activeTweens.get(a)),this._activeTweens.delete(a);this._activeTweens.clear()}}ReleaseAndCompleteTween(a){this.ReleaseTween(a,!0)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,!0)}GetPropertyValueByIndex(a){return 0===a?this._enabled:void 0}SetPropertyValueByIndex(a,b){0===a?this._enabled=!!b:void 0}_FinishTriggers(b){this.GetRuntime()&&(this._finishingTween=b,a.Cnds.SetFinishingTween(b),this.Trigger(a.Cnds.OnTweensFinished),this.Trigger(a.Cnds.OnAnyTweensFinished),a.Cnds.SetFinishingTween(null),this._finishingTween=null,this.ReleaseTween(b),b.GetDestroyInstanceOnComplete()&&this.GetRuntime().DestroyInstance(this.GetObjectInstance()))}_AddTween(b,c){const d=a.Maps.GetPropertyFromIndex(c);this._activeTweens.has(d)||this._activeTweens.set(d,[]);const e=this._activeTweens.get(d);e.push(b)}_AddToWaitingList(a){const b=a.GetId();this._waitingForReleaseTweens.has(b)||this._waitingForReleaseTweens.set(b,[]),this._waitingForReleaseTweens.get(b).push(a)}_IsInWaitingList(a){const b=a.GetId();return!!this._waitingForReleaseTweens.has(b)&&this._waitingForReleaseTweens.get(b).includes(a)}_ReleaseWaitingTweens(){if(this._waitingForReleaseTweens.size){for(const a of this._waitingForReleaseTweens.values()){for(const b of a)b.IsReleased()||b.Release();C3.clearArray(a)}this._waitingForReleaseTweens.clear()}}}}
"use strict";{let a=null;C3.Behaviors.Tween.Cnds={SetFinishingTween(b){a=b},OnTweensFinished(b){return a.HasTags(b)},OnAnyTweensFinished(){return!0},IsPlaying(a){const b=[...this.GetTweensIncludingWaitingForRelease(a)];return!!b&&!!b.length&&b.some(C3.Tween.IsPlaying)},IsAnyPlaying(){const a=[...this.AllTweensIncludingWaitingForRelease()];return!!a&&!!a.length&&a.some(C3.Tween.IsPlaying)}}}
"use strict";{const a=C3.Behaviors.Tween;a.Acts={SetEnabled(a){this.SetEnabled(!!a);for(const b of this.AllTweens())!a?((b.IsPlaying()||b.IsScheduled())&&this.AddToDisabledList(b),b.Stop()):this.IsInDisabledList(b)&&b.Resume();a&&this.ClearDisabledList()},async TweenOneProperty(...b){if(this.GetEnabled()&&this.IsInstanceValid()){const c=this.CreateTween(a.TweenArguments.OneProperty(this,...b));c.Play()&&(await c.GetPlayPromise())}},async TweenTwoProperties(...b){if(this.GetEnabled()&&this.IsInstanceValid()){const c=this.CreateTween(a.TweenArguments.TwoProperties(this,...b));c.Play()&&(await c.GetPlayPromise())}},async TweenValue(...b){if(this.GetEnabled()&&this.IsInstanceValid()){const c=this.CreateTween(a.TweenArguments.ValueProperty(this,...b));c.Play()&&(await c.GetPlayPromise())}},PauseTweens(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.GetTweens(a))b.Stop()},PauseAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const a of this.AllTweens())a.Stop()},ResumeTweens(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.GetTweens(a))b.Resume()},ResumeAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const a of this.AllTweens())a.Resume()},StopTweens(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.GetTweens(a))this.ReleaseTween(b)},StopAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const a of this.AllTweens())this.ReleaseTween(a)},SetOnePropertyTweensEndValue(a,b,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.GetTweens(a))d.BeforeSetEndValues([b],[c]),d.SetEndValue(b,c)},SetTwoPropertiesTweensEndValue(a,b,c,d){if(this.GetEnabled()&&this.IsInstanceValid()){const e=C3.Behaviors.Tween.Maps.GetRealProperties(b);for(const b of this.GetTweens(a))b.BeforeSetEndValues([c,d],e),b.SetEndValue(c,e[0]),b.SetEndValue(d,e[1])}},SetValuePropertyTweensStartValue(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a,"value"))c.SetStartValue(b,"value")},SetValuePropertyTweensEndValue(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a,"value"))c.BeforeSetEndValue([b],[value]),c.SetEndValue(b,"value")},SetTweensEase(a,b){if(this.GetEnabled()&&this.IsInstanceValid()){const c=Ease.GetEaseFromIndex(b);for(const b of this.GetTweens(a))b.SetEase(c)}},SetAllTweensEase(a){if(this.GetEnabled()&&this.IsInstanceValid()){const b=Ease.GetEaseFromIndex(a);for(const a of this.AllTweens())a.SetEase(b)}},SetTweensTime(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a))c.SetTime(b)},SetAllTweensTime(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.AllTweens())b.SetTime(a)},SetTweensPlaybackRate(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a))c.SetPlaybackRate(b)},SetAllTweensPlaybackRate(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.AllTweens())b.SetPlaybackRate(a)},SetTweensDestroyOnComplete(a,b){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(a))c.SetDestroyInstanceOnComplete(!!b)},SetAllTweensDestroyOnComplete(a){if(this.GetEnabled()&&this.IsInstanceValid())for(const b of this.AllTweens())b.SetDestroyInstanceOnComplete(!!a)}}}
"use strict";C3.Behaviors.Tween.Exps={Time(a){const b=this.GetTweenIncludingWaitingForRelease(a);return b?b.GetTime():0},Progress(a){const b=this.GetTweenIncludingWaitingForRelease(a);return b?b.GetTime()/b.GetTotalTime():0},Value(a){const b=this.GetTweenIncludingWaitingForRelease(a,"value");return b?b.GetPropertyTrack("value").GetSourceAdapterValue():0},Tags(){return this.GetFinishingTween()?this.GetFinishingTween().GetStringTags():""}};
"use strict";{const a=["position","size"],b=["offsetX","offsetY","offsetWidth","offsetHeight","offsetAngle","offsetOpacity","offsetColor","offsetZElevation"],c=["value"],d=[].concat(a).concat(b).concat(c),e={"position":["offsetX","offsetY"],"size":["offsetWidth","offsetHeight"]},f=Object.assign({},d.reduce((a,b)=>Object.assign({},a,{[b]:[b]}),{}),e);C3.Behaviors.Tween.Maps=class{constructor(){}static GetEases(){return[...Ease.GetEaseNames()]}static GetEaseFromIndex(a){return[...Ease.GetEaseNames()][a]}static GetPropertyFromIndex(a){return d[a]}static GetPropertyIndexFromName(a){return d.indexOf(a)}static GetPairPropertyFromIndex(b){return a[b]}static GetSinglePropertyFromIndex(a){return b[a]}static GetValuePropertyFromIndex(a){return c[a]}static GetPairProperties(a){return e[a]}static GetRealProperties(a){return C3.IsString(a)?f[a]:f[d[a]]}static IsPairId(a){return!!e[a]}static IsColorId(a){return"offsetColor"===a}static IsAngleId(a){return"offsetAngle"===a}static IsOpacityId(a){return"offsetOpacity"===a}static IsValueId(a){return"value"===a}}}
"use strict";{const a=C3.Behaviors.Tween,b=new Map;a.Config=class{constructor(){}static GetPropertyTracksConfig(c,d,e,f,g,h){0===b.size&&this._CreateConfigObjects();const i=a.PropertyTypes.Pick(c);let j=b.get(i);return C3.IsFiniteNumber(c)&&(c=a.Maps.GetPropertyFromIndex(c)),this._GetConfig(j,c,d,e,f,g,h)}static TransformValue(a,b){const c=C3.Behaviors.Tween.GetPropertyTracksConfig(a);return c.valueGetter(b)}static _CreateConfigObjects(){const b=a.PropertyTypes,c=a.ValueGetters;this._AddConfigObject(b.PAIR,this._GetPairConfig,c._GetPropertyValue),this._AddConfigObject(b.COLOR,this._GetColorConfig,c._GetColorPropertyValue),this._AddConfigObject(b.ANGLE,this._GetAngleConfig,c._GetPropertyAngleValue),this._AddConfigObject(b.VALUE,this._GetValueConfig,c._GetPropertyValue),this._AddConfigObject(b.OTHER,this._GetCommonConfig,c._GetPropertyValue)}static _AddConfigObject(a,c,d){b.set(a,this._CreateConfigObject(a,c,d))}static _CreateConfigObject(a,b,c){return{name:a,configFunc:b,valueGetter:c}}static _GetConfig(a,b,c,d,e,f,g){return a.configFunc(b,a.valueGetter(c),a.valueGetter(d),e,f,g)}static _GetPairConfig(b,c,d,e,f){const g=a.Maps.GetPairProperties(b);return g.map((b,g)=>({sourceId:"world-instance",property:b,type:"float",valueType:"numeric",startValue:c[g],endValue:d[g],ease:a.Maps.GetEaseFromIndex(e),resultMode:f}))}static _GetColorConfig(b,c,d,e,f,g){return C3.Plugins.Text&&g.GetPlugin()instanceof C3.Plugins.Text?{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:c,endValue:d,ease:a.Maps.GetEaseFromIndex(e),resultMode:f}:{sourceId:"world-instance",property:b,type:"color",valueType:"color",startValue:c,endValue:d,ease:a.Maps.GetEaseFromIndex(e),resultMode:f}}static _GetAngleConfig(b,c,d,e,f){return{sourceId:"world-instance",property:b,type:"angle",valueType:"angle",startValue:c,endValue:d,ease:a.Maps.GetEaseFromIndex(e),resultMode:f}}static _GetCommonConfig(b,c,d,e,f){return{sourceId:"world-instance",property:b,type:"float",valueType:"numeric",startValue:c,endValue:d,ease:a.Maps.GetEaseFromIndex(e),resultMode:f}}static _GetValueConfig(b,c,d,e,f){return{sourceId:"value",property:b,type:"float",valueType:"numeric",startValue:c,endValue:d,ease:a.Maps.GetEaseFromIndex(e),resultMode:f}}}}
"use strict";{const a=C3.Behaviors.Tween,b=Object.assign({},{resultMode:"absolute"},{tags:"",property:"",time:0,ease:0,releaseOnComplete:0}),c=Object.assign({},b,{initialValueMode:"current-state",startValue:0,endValue:0}),d=Object.assign({},b,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]}),e=Object.assign({},b,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]}),f=Object.assign({},c,{initialValueMode:"start-value"});a.TweenArguments=class{constructor(){}static _SetCommonProperties(a,b,c,d,e){a.tags=b,a.time=c,a.ease=d,a.releaseOnComplete=e}static OneProperty(b,d,f,g,h,i,j){const k=a.Maps.GetSinglePropertyFromIndex(f),l=a.Maps.IsColorId(k)?e:c;return this._SetCommonProperties(l,d,h,i,j),a.Maps.IsColorId(k)?(e.endValue[0]=C3.GetRValue(g),e.endValue[1]=C3.GetGValue(g),e.endValue[2]=C3.GetBValue(g),e.property=a.Maps.GetPropertyIndexFromName(k)):a.Maps.IsOpacityId(k)?c.endValue=g/100:c.endValue=g,l.property=a.Maps.GetPropertyIndexFromName(k),l}static TwoProperties(b,c,e,f,g,h,i,j){this._SetCommonProperties(d,c,h,i,j);const k=a.Maps.GetPairPropertyFromIndex(e);return d.endValue[0]=f,d.endValue[1]=g,d.property=a.Maps.GetPropertyIndexFromName(k),d}static ValueProperty(b,c,d,e,g,h,i){return this._SetCommonProperties(f,c,g,h,i),f.startValue=d,f.endValue=e,f.property=a.Maps.GetPropertyIndexFromName("value"),f}}}
"use strict";{const a=C3.Behaviors.Tween,b=[];a.PropertyTypes=class{constructor(){}static Pick(c){if(0===b.length){const c=b;c.push({checkFunc:a.Maps.IsPairId,result:this.PAIR}),c.push({checkFunc:a.Maps.IsColorId,result:this.COLOR}),c.push({checkFunc:a.Maps.IsAngleId,result:this.ANGLE}),c.push({checkFunc:a.Maps.IsValueId,result:this.VALUE}),c.push({checkFunc:()=>!0,result:this.OTHER})}C3.IsFiniteNumber(c)&&(c=C3.Behaviors.Tween.Maps.GetPropertyFromIndex(c));for(const a of b)if(a.checkFunc(c))return a.result}static get PAIR(){return"pair"}static get COLOR(){return"color"}static get ANGLE(){return"angle"}static get VALUE(){return"value"}static get OTHER(){return"other"}}}
"use strict";{const a=C3.Behaviors.Tween;a.ValueGetters=class{constructor(){}static _GetPropertyAngleValue(a){const b=C3.toRadians(parseFloat(a));return C3.clampAngle(b)}static _GetColorPropertyValue(a){return a.slice(0)}static _GetPropertyValue(a){return a}}}
"use strict";C3.Behaviors.Turret=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Turret.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a),this._targetTypes=[]}Release(){C3.clearArray(this._targetTypes),super.Release()}OnCreate(){}GetTargetTypes(){return this._targetTypes}};
"use strict";{const a=0,b=C3.New(C3.Rect),c=[];C3.Behaviors.Turret.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(b,c){super(b),this._range=300,this._rateOfFire=1,this._isRotateEnabled=!0,this._rotateSpeed=C3.toRadians(180),this._targetMode=0,this._predictiveAim=!1,this._projectileSpeed=500,this._useCollisionCells=!0,this._isEnabled=!0,this._lastCheckTime=0,this._fireTimeCount=0,this._currentTarget=null,this._loadTargetUid=-1,this._oldTargetX=0,this._oldTargetY=0,this._lastSpeeds=[0,0,0,0],this._speedsCount=0,this._firstTickWithTarget=!0,c&&(this._range=c[a],this._rateOfFire=c[1],this._isRotateEnabled=!!c[2],this._rotateSpeed=C3.toRadians(c[3]),this._targetMode=c[4],this._predictiveAim=!!c[5],this._projectileSpeed=c[6],this._useCollisionCells=!!c[7],this._isEnabled=!!c[8]),this._fireTimeCount=this._rateOfFire;const d=this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(d,"instancedestroy",(a)=>this._OnInstanceDestroyed(a.instance)),C3.Disposable.From(d,"afterload",()=>this._OnAfterLoad())),this._isEnabled&&this._StartTicking()}Release(){this._currentTarget=null,super.Release()}_OnAfterLoad(){this._currentTarget=-1===this._loadTargetUid?null:this._runtime.GetInstanceByUID(this._loadTargetUid)}_OnInstanceDestroyed(a){this._currentTarget===a&&(this._currentTarget=null)}SaveToJson(){return{"r":this._range,"rof":this._rateOfFire,"re":this._isRotateEnabled,"rs":this._rotateSpeed,"tm":this._targetMode,"pa":this._predictiveAim,"ps":this._projectileSpeed,"ucc":this._useCollisionCells,"e":this._isEnabled,"lct":this._lastCheckTime,"ftc":this._fireTimeCount,"t":this._currentTarget?this._currentTarget.GetUID():-1,"ox":this._oldTargetX,"oy":this._oldTargetY,"ls":this._lastSpeeds,"sc":this._speedsCount,"targs":this.GetSdkType().GetTargetTypes().map((a)=>a.GetSID())}}LoadFromJson(a){this._range=a["r"],this._rateOfFire=a["rof"],this._isRotateEnabled=a["re"],this._rotateSpeed=a["rs"],this._targetMode=a["tm"],this._predictiveAim=a["pa"],this._projectileSpeed=a["ps"],this._useCollisionCells=a["ucc"],this._SetEnabled(a["e"]),this._lastCheckTime=a["lct"],this._fireTimeCount=a["ftc"],this._loadTargetUid=a["t"],this._oldTargetX=a["ox"],this._oldTargetY=a["oy"],this._lastSpeeds=a["ls"],this._speedsCount=a["sc"];const b=this.GetSdkType().GetTargetTypes();C3.clearArray(b);for(const c of a["targs"]){const a=this._runtime.GetObjectClassBySID(c);a&&b.push(a)}}AddSpeed(a){4>this._speedsCount?(this._lastSpeeds[this._speedsCount]=a,this._speedsCount++):(this._lastSpeeds.shift(),this._lastSpeeds.push(a))}GetSpeed(){let a=0;for(let b=0;b<this._speedsCount;++b)a+=this._lastSpeeds[b];return a/this._speedsCount}IsInRange(a){const b=this.GetWorldInfo(),c=a.GetWorldInfo(),d=c.GetX()-b.GetX(),e=c.GetY()-b.GetY();return d*d+e*e<=this._range*this._range}LookForFirstTarget(){const a=this.GetWorldInfo(),d=this.GetSdkType().GetTargetTypes(),e=this._runtime.GetCollisionEngine();if(this._useCollisionCells)b.set(a.GetX()-this._range,a.GetY()-this._range,a.GetX()+this._range,a.GetY()+this._range),e.GetObjectClassesCollisionCandidates(null,d,b,c);else for(const a of d)C3.appendArray(c,a.GetInstances());for(const a of c)if(this.IsInRange(a))return this._currentTarget=a,void C3.clearArray(c);C3.clearArray(c)}LookForNearestTarget(){const a=this.GetWorldInfo(),d=this.GetSdkType().GetTargetTypes(),e=this._runtime.GetCollisionEngine(),f=a.GetX(),g=a.GetY();let h=this._range*this._range;if(this._currentTarget=null,this._useCollisionCells)b.set(f-this._range,g-this._range,f+this._range,g+this._range),e.GetObjectClassesCollisionCandidates(null,d,b,c);else for(const a of d)C3.appendArray(c,a.GetInstances());for(const a of c){const b=a.GetWorldInfo(),c=f-b.GetX(),d=g-b.GetY(),e=c*c+d*d;e<h&&(this._currentTarget=a,h=e)}C3.clearArray(c)}_OnTargetAcquired(){this._speedsCount=0,this._firstTickWithTarget=!0;const a=this._currentTarget.GetWorldInfo();this._oldTargetX=a.GetX(),this._oldTargetY=a.GetY(),this.Trigger(C3.Behaviors.Turret.Cnds.OnTargetAcquired)}Tick(){if(this._isEnabled){const b=this._runtime.GetDt(this._inst),a=this._runtime.GetGameTime(),c=this.GetWorldInfo();if(this._currentTarget&&!this.IsInRange(this._currentTarget)&&(this._currentTarget=null,this._speedsCount=0,this._firstTickWithTarget=!0),a>=this._lastCheckTime+.1)if(this._lastCheckTime=a,0===this._targetMode&&!this._currentTarget)this.LookForFirstTarget(),this._currentTarget&&this._OnTargetAcquired();else if(1===this._targetMode){const a=this._currentTarget;this.LookForNearestTarget(),this._currentTarget&&this._currentTarget!==a&&this._OnTargetAcquired()}if(this._fireTimeCount+=b,this._currentTarget){let d=this._currentTarget.GetWorldInfo(),e=C3.angleTo(c.GetX(),c.GetY(),d.GetX(),d.GetY());if(this._predictiveAim){const f=c.GetX(),g=c.GetY(),i=d.GetX(),j=d.GetY(),k=C3.angleTo(i,j,this._oldTargetX,this._oldTargetY);this._firstTickWithTarget||this.AddSpeed(C3.distanceTo(i,j,this._oldTargetX,this._oldTargetY)/b);const h=this.GetSpeed(),l=j-g,m=i-f,n=(h*Math.sin(k)*(f-i)-h*Math.cos(k)*(g-j))/this._projectileSpeed,o=Math.asin(n/Math.sqrt(l*l+m*m))-Math.atan2(l,-m)+Math.PI;isNaN(o)||(e=o)}this._isRotateEnabled&&(c.SetAngle(C3.angleRotate(c.GetAngle(),e,this._rotateSpeed*b)),c.SetBboxChanged()),this._fireTimeCount>=this._rateOfFire&&(!this._isRotateEnabled||.1>=C3.toDegrees(C3.angleDiff(c.GetAngle(),e)))&&(!this._predictiveAim||4<=this._speedsCount)&&(this._fireTimeCount-=this._rateOfFire,this._fireTimeCount>=this._rateOfFire&&(this._fireTimeCount=0),this.Trigger(C3.Behaviors.Turret.Cnds.OnShoot)),this._currentTarget&&(d=this._currentTarget.GetWorldInfo(),this._oldTargetX=d.GetX(),this._oldTargetY=d.GetY()),this._firstTickWithTarget=!1}this._fireTimeCount>this._rateOfFire&&(this._fireTimeCount=this._rateOfFire)}}GetPropertyValueByIndex(a){return a===0?this._range:1===a?this._rateOfFire:2===a?this._isRotateEnabled:3===a?C3.toDegrees(this._rotateSpeed):4===a?this._targetMode:5===a?this._predictiveAim:6===a?this._projectileSpeed:7===a?this._useCollisionCells:8===a?this._isEnabled:void 0}SetPropertyValueByIndex(b,c){switch(b){case a:this._range=c;break;case 1:this._rateOfFire=c;break;case 2:this._isRotateEnabled=!!c;break;case 3:if(!this._isRotateEnabled)return;this._rotateSpeed=C3.toRadians(c);break;case 4:this._targetMode=c;break;case 5:this._predictiveAim=!!c;break;case 6:if(!this._predictiveAim)return;this._projectileSpeed=c;break;case 7:this._useCollisionCells=!!c;break;case 8:this._SetEnabled(c);}}_SetEnabled(a){this._isEnabled=!!a,this._isEnabled?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.turret.properties.range.name",value:this._range,onedit:(a)=>this._range=a},{name:"behaviors.turret.properties.rate-of-fire.name",value:this._rateOfFire,onedit:(a)=>this._rateOfFire=a},{name:"behaviors.turret.properties.rotate-speed.name",value:C3.toDegrees(this._rotateSpeed),onedit:(a)=>this._rotateSpeed=C3.toRadians(a)},{name:"behaviors.turret.properties.predictive-aim.name",value:this._predictiveAim,onedit:(a)=>this._predictiveAim=a},{name:"behaviors.turret.properties.projectile-speed.name",value:this._projectileSpeed,onedit:(a)=>this._projectileSpeed=a},{name:"behaviors.turret.debugger.has-target",value:!!this._currentTarget},{name:"behaviors.turret.debugger.target-uid",value:this._currentTarget?this._currentTarget.GetUID():0},{name:"behaviors.turret.properties.enabled.name",value:this._isEnabled,onedit:(a)=>this._SetEnabled(a)}]}]}}}
"use strict";C3.Behaviors.Turret.Cnds={HasTarget(){return!!this._currentTarget},OnShoot(){return!0},OnTargetAcquired(){return!0},IsEnabled(){return this._isEnabled}};
"use strict";C3.Behaviors.Turret.Acts={AcquireTarget(a){if(a){const b=a.GetCurrentSol().GetInstances();for(const a of b)if(this._currentTarget!==a&&this.IsInRange(a)){this._currentTarget=a,this._OnTargetAcquired();break}}},AddTarget(a){const b=this.GetSdkType().GetTargetTypes();if(!b.includes(a)){for(const c of b)if(c.IsFamily()&&c.FamilyHasMember(a))return;b.push(a)}},ClearTargets(){C3.clearArray(this.GetSdkType().GetTargetTypes())},UnacquireTarget(){this._currentTarget=null,this._speedsCount=0,this._firstTickWithTarget=!0},SetEnabled(a){this._SetEnabled(0!==a)},SetRange(a){this._range=a},SetRateOfFire(a){this._rateOfFire=a},SetRotate(a){this._isRotateEnabled=0!==a},SetRotateSpeed(a){this._rotateSpeed=C3.toRadians(a)},SetTargetMode(a){this._targetMode=a},SetPredictiveAim(a){this._predictiveAim=0!==a},SetProjectileSpeed(a){this._projectileSpeed=a}};
"use strict";C3.Behaviors.Turret.Exps={TargetUID(){return this._currentTarget?this._currentTarget.GetUID():0},Range(){return this._range},RateOfFire(){return this._rateOfFire},RotateSpeed(){return C3.toDegrees(this._rotateSpeed)}};
"use strict";
{
C3.Behaviors.skymen_Skymen_SpritefontDX = class Skymen_SpritefontDXBehavior extends C3.SDKBehaviorBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Behaviors.skymen_Skymen_SpritefontDX.Type = class Skymen_SpritefontDXType extends C3.SDKBehaviorTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{}
};
}
"use strict";
const easingNames = ["linear", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInQuint", "easeOutQuint", "easeInOutQuint", "easeInSine", "easeOutSine", "easeInOutSine", "easeInExpo", "easeOutExpo", "easeInOutExpo", "easeInCirc", "easeOutCirc", "easeInOutCirc", "easeOutBounce", "easeInBack", "easeOutBack", "easeInOutBack", "elastic", "swingFromTo", "swingFrom", "swingTo", "bounce", "bouncePast", "easeFromTo", "easeFrom", "easeTo"]
var EasingFunctions = {
// no easing, no acceleration
linear: function(t)
{
return t
},
// accelerating from zero velocity
easeInQuad: function(t)
{
return t * t
},
// decelerating to zero velocity
easeOutQuad: function(t)
{
return t * (2 - t)
},
// acceleration until halfway, then deceleration
easeInOutQuad: function(t)
{
return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t
},
// accelerating from zero velocity
easeInCubic: function(t)
{
return t * t * t
},
// decelerating to zero velocity
easeOutCubic: function(t)
{
return (--t) * t * t + 1
},
// acceleration until halfway, then deceleration
easeInOutCubic: function(t)
{
return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1
},
// accelerating from zero velocity
easeInQuart: function(t)
{
return t * t * t * t
},
// decelerating to zero velocity
easeOutQuart: function(t)
{
return 1 - (--t) * t * t * t
},
// acceleration until halfway, then deceleration
easeInOutQuart: function(t)
{
return t < .5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t
},
// accelerating from zero velocity
easeInQuint: function(t)
{
return t * t * t * t * t
},
// decelerating to zero velocity
easeOutQuint: function(t)
{
return 1 + (--t) * t * t * t * t
},
// acceleration until halfway, then deceleration
easeInOutQuint: function(t)
{
return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t
},
easeInSine: function(pos)
{
return -Math.cos(pos * (Math.PI / 2)) + 1;
},
easeOutSine: function(pos)
{
return Math.sin(pos * (Math.PI / 2));
},
easeInOutSine: function(pos)
{
return (-0.5 * (Math.cos(Math.PI * pos) - 1));
},
easeInExpo: function(pos)
{
return (pos === 0) ? 0 : Math.pow(2, 10 * (pos - 1));
},
easeOutExpo: function(pos)
{
return (pos === 1) ? 1 : -Math.pow(2, -10 * pos) + 1;
},
easeInOutExpo: function(pos)
{
if (pos === 0) return 0;
if (pos === 1) return 1;
if ((pos /= 0.5) < 1) return 0.5 * Math.pow(2, 10 * (pos - 1));
return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
},
easeInCirc: function(pos)
{
return -(Math.sqrt(1 - (pos * pos)) - 1);
},
easeOutCirc: function(pos)
{
return Math.sqrt(1 - Math.pow((pos - 1), 2));
},
easeInOutCirc: function(pos)
{
if ((pos /= 0.5) < 1) return -0.5 * (Math.sqrt(1 - pos * pos) - 1);
return 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1);
},
easeOutBounce: function(pos)
{
if ((pos) < (1 / 2.75))
{
return (7.5625 * pos * pos);
}
else if (pos < (2 / 2.75))
{
return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
}
else if (pos < (2.5 / 2.75))
{
return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
}
else
{
return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
}
},
easeInBack: function(pos)
{
var s = 1.70158;
return (pos) * pos * ((s + 1) * pos - s);
},
easeOutBack: function(pos)
{
var s = 1.70158;
return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1;
},
easeInOutBack: function(pos)
{
var s = 1.70158;
if ((pos /= 0.5) < 1) return 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s));
return 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
},
elastic: function(pos)
{
return -1 * Math.pow(4, -8 * pos) * Math.sin((pos * 6 - 1) * (2 * Math.PI) / 2) + 1;
},
swingFromTo: function(pos)
{
var s = 1.70158;
return ((pos /= 0.5) < 1) ? 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s)) :
0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
},
swingFrom: function(pos)
{
var s = 1.70158;
return pos * pos * ((s + 1) * pos - s);
},
swingTo: function(pos)
{
var s = 1.70158;
return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;
},
bounce: function(pos)
{
if (pos < (1 / 2.75))
{
return (7.5625 * pos * pos);
}
else if (pos < (2 / 2.75))
{
return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
}
else if (pos < (2.5 / 2.75))
{
return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
}
else
{
return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
}
},
bouncePast: function(pos)
{
if (pos < (1 / 2.75))
{
return (7.5625 * pos * pos);
}
else if (pos < (2 / 2.75))
{
return 2 - (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
}
else if (pos < (2.5 / 2.75))
{
return 2 - (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
}
else
{
return 2 - (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
}
},
easeFromTo: function(pos)
{
if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 4);
return -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2);
},
easeFrom: function(pos)
{
return Math.pow(pos, 4);
},
easeTo: function(pos)
{
return Math.pow(pos, 0.25);
}
}
function cos(x)
{
return Math.cos(x * Math.PI / 180);
}
function sin(x)
{
return Math.sin(x * Math.PI / 180);
}
function random(x)
{
return Math.random() * x;
}
function hslToRgb(hue, saturation, lightness)
{
// based on algorithm from http://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB
if (hue == undefined)
{
return [0, 0, 0];
}
var chroma = (1 - Math.abs((2 * lightness) - 1)) * saturation;
var huePrime = hue / 60;
var secondComponent = chroma * (1 - Math.abs((huePrime % 2) - 1));
huePrime = Math.floor(huePrime);
var red;
var green;
var blue;
if (huePrime === 0)
{
red = chroma;
green = secondComponent;
blue = 0;
}
else if (huePrime === 1)
{
red = secondComponent;
green = chroma;
blue = 0;
}
else if (huePrime === 2)
{
red = 0;
green = chroma;
blue = secondComponent;
}
else if (huePrime === 3)
{
red = 0;
green = secondComponent;
blue = chroma;
}
else if (huePrime === 4)
{
red = secondComponent;
green = 0;
blue = chroma;
}
else if (huePrime === 5)
{
red = chroma;
green = 0;
blue = secondComponent;
}
var lightnessAdjustment = lightness - (chroma / 2);
red += lightnessAdjustment;
green += lightnessAdjustment;
blue += lightnessAdjustment;
return [Math.round(red * 255), Math.round(green * 255), Math.round(blue * 255)];
};
var hsltorgb = hslToRgb;
function colorToHex(color)
{
if (color.startsWith("#"))
{
return color
}
if (color.startsWith("hsl"))
{
let[h, s, l] = color.split('(')[1].split(')')[0].split(',').map(x => {
return x.trim()
})
color = 'rgb(' + hslToRgb(h, s / 100, l / 100).join(',') + ')'
}
if (color.startsWith("rgb"))
{
let[r, g, b] = color.split('(')[1].split(')')[0].split(',').map(x => {
x = parseInt(x.trim()).toString(16);
return (x.length == 1) ? "0" + x : x;
})
return "#" + r + g + b
}
}
var colortohex = colorToHex;
function lerpColor(a, b, x)
{
return lerpHexColor(colorToHex(a), colorToHex(b), x)
}
var lerpcolor = lerpColor;
function lerpHexColor(a, b, amount)
{
var ah = parseInt(a.replace(/#/g, ''), 16),
ar = ah >> 16,
ag = ah >> 8 & 0xff,
ab = ah & 0xff,
bh = parseInt(b.replace(/#/g, ''), 16),
br = bh >> 16,
bg = bh >> 8 & 0xff,
bb = bh & 0xff,
rr = ar + amount * (br - ar),
rg = ag + amount * (bg - ag),
rb = ab + amount * (bb - ab);
return '#' + ((1 << 24) + (rr << 16) + (rg << 8) + rb | 0).toString(16).slice(1);
}
var lerphexcolor = lerpHexColor;
function lerpUnlerp(minOutput, maxOutput, minInput, maxInput, x, clamp = false)
{
if (clamp)
{
if (x > maxInput) x = maxInput
if (x < minInput) x = minInput
}
return minOutput + ((x - minInput) / (maxInput - minInput)) * (maxOutput - minOutput);
}
var lerpunlerp = lerpUnlerp;
function unlerp(min, max, x, clamp = false)
{
if (clamp)
{
if (x > max) x = max
if (x < min) x = min
}
if (min === max && x >= max) return 1
return (x - min) / (max - min);
}
function lerp(min, max, x)
{
let a = typeof min
let b = typeof max
if (a === b)
{
if (a === "number")
{
return x * (max - min) + min;
}
else
{
return lerpColor(min, max, x)
}
}
else
{
if (a === "number")
{
max = parseFloat(max)
}
else
{
min = parseFloat(min)
}
return x * (max - min) + min;
}
}
{
C3.Behaviors.skymen_Skymen_SpritefontDX.Instance = class Skymen_SpritefontDXInstance extends C3.SDKBehaviorInstanceBase
{
constructor(behInst, properties)
{
super(behInst);
if (properties)
{
this.TWParams = properties[0];
this.TWParamsOBJ = this.parseTypewriterParams(this.TWParams);
this.TWEasing = easingNames[properties[1]];
}
this.curTypedWidth = ""
this.curTypedHeight = ""
this.text = ""
this.typewriterPaused = false;
this.typewriterActive = false;
this.LastLetterID = 0;
this.typePauseTime = 0;
this.typewriterTagData = [];
this.nextLetterTime = 0;
this.typewriterWait = false;
this.firstFrame = true;
this.animated = false;
this.SetTextCall = false;
this.linkedDictionnaryUID = -1
this.AnimFunctions = {}
if (!this._inst._objectType._SFDXAliasFunctions) this._inst._objectType._SFDXAliasFunctions = {}
this._StartTicking2()
// Opt-in to getting calls to Tick()
// this._StartTicking();
}
Release()
{
super.Release();
}
specialJSONstringify(obj)
{
var placeholder = '____PLACEHOLDER____';
var fns = [];
var json = JSON.stringify(obj, function(key, value)
{
if (typeof value === 'function')
{
fns.push(value);
return placeholder;
}
return value;
}, 2);
json = json.replace(new RegExp('"' + placeholder + '"', 'g'), function(_)
{
return fns.shift();
});
return json;
};
specialJSONparse(str)
{
let val;
eval('val =' + str + ';');
return val;
}
SaveToJson()
{
return {
curTypedWidth: this.curTypedWidth,
curTypedHeight: this.curTypedHeight,
text: this.text,
typewriterPaused: this.typewriterPaused,
typewriterActive: this.typewriterActive,
LastLetterID: this.LastLetterID,
typePauseTime: this.typePauseTime,
nextLetterTime: this.nextLetterTime,
typewriterWait: this.typewriterWait,
firstFrame: this.firstFrame,
animated: this.animated,
SetTextCall: this.SetTextCall,
lastKnown: this.lastKnown,
TWTime: this.TWTime,
TWEasing: this.TWEasing,
typewriterTagData: JSON.stringify(this.typewriterTagData),
TWData: JSON.stringify(this.TWData),
TWParamsOBJ: JSON.stringify(this.TWParamsOBJ),
AnimFunctions: this.specialJSONstringify(this.AnimFunctions),
parsedText: this.specialJSONstringify(this.parsedText),
_SFDXAliasFunctions: this.specialJSONstringify(this._inst._objectType._SFDXAliasFunctions),
linkedDictionnaryUID: this.linkedDictionnaryUID
};
}
LoadFromJson(o)
{
this.curTypedHeight = o.curTypedHeight
this.curTypedWidth = o.curTypedWidth
this.text = o.text
this.typewriterPaused = o.typewriterPaused
this.typewriterActive = o.typewriterActive
this.LastLetterID = o.LastLetterID
this.typePauseTime = o.typePauseTime
this.nextLetterTime = o.nextLetterTime
this.typewriterWait = o.typewriterWait
this.firstFrame = o.firstFrame
this.animated = o.animated
this.SetTextCall = o.SetTextCall
this.lastKnown = o.lastKnown
this.TWTime = o.TWTime
this.TWEasing = o.TWEasing
this.typewriterTagData = JSON.parse(o.typewriterTagData)
this.TWData = JSON.parse(o.TWData)
this.TWParamsOBJ = JSON.parse(o.TWParamsOBJ)
this.AnimFunctions = this.specialJSONparse(o.AnimFunctions)
this.parsedText = this.specialJSONparse(o.parsedText)
this._SFDXAliasFunctions = this.specialJSONparse(o._SFDXAliasFunctions)
this.linkedDictionnaryUID = o.linkedDictionnaryUID
}
parseTypewriterParams(params)
{
var paramsA = params.trim().split(';');
var defaultParams = {
"value": {},
"duration": {
"type": 5,
"fade": 10
}
}
paramsA.forEach(param => {
var paramA = param.trim().split(' ');
let mode = paramA.shift().toLowerCase();
let tag = paramA.shift().toLowerCase();
let value = paramA.join();
if (this.isANumber(value)) value = parseFloat(value)
switch (mode)
{
case "value":
defaultParams["value"][tag] = value
break;
case "duration":
switch (tag)
{
case "type":
defaultParams["duration"]["type"] = value
break;
case "fade":
defaultParams["duration"]["fade"] = value
break;
default:
console.warn(tag + " is not a recognised typewriter parameter for " + mode + ".")
break;
}
break
default:
console.warn(mode + " is not a recognised typewriter parameter.")
break;
}
});
return defaultParams
}
getDefault(tag)
{
switch (tag)
{
case "offsetx":
case "offsety":
return 0;
case "opacity":
return 100;
case "scale":
case "scalex":
case "scaley":
return 1;
case "color":
return '#FFFFFF';
default:
return 0;
}
}
Tick2()
{
//Check if dictionnary is linked after load
if (this.linkedDictionnaryUID != -1 && !this.linkedDictionnary)
{
this.linkedDictionnary = this._runtime.GetInstanceByUID(this.linkedDictionnaryUID)
}
//If instance action Set Text is called
if (!this.SetTextCall && this.animated && this._inst._sdkInst._text != this.lastKnown)
{
this.animated = false;
}
if (this.SetTextCall) this.SetTextCall = false
if (this.animated)
{
const time = this._runtime.GetGameTime();
var str = ""
var word = false
if (this.typewriterActive)
{
let id = 0
this.parsedText.forEach(el => {
for (let i = 0; i < el[1].length; i++)
{
let tags = {}
el[0].forEach(tag => {
if (typeof tag[1] === "function") tags[tag[0]] = tag[1](time, i)
else tags[tag[0]] = tag[1]
})
if (this.TWTime >= this.TWData.start[id][0] && this.TWData.data[id].hasOwnProperty("pause"))
{
this.typewriterPaused = true
delete this.TWData.data[id].pause;
this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwPause)
}
if (this.TWTime >= this.TWData.start[id][0] && this.TWData.data[id].hasOwnProperty("fn"))
{
let fnData = this.TWData.data[id].fn.split(' ')
let fnName = fnData.shift()
let fnParams = JSON.parse("[" + fnData.join(' ') + "]") || []
c3_callFunction(fnName, fnParams)
delete this.TWData.data[id].fn;
}
Object.keys(this.TWData.data[id]).forEach(tag => {
if (!tags.hasOwnProperty(tag))
{
tags[tag] = this.getDefault(tag)
}
tags[tag] = lerp(this.TWData.data[id][tag], tags[tag], EasingFunctions[this.TWEasing](unlerp(this.TWData.start[id][0], this.TWData.start[id][1], this.TWTime, true)))
})
let end = ""
Object.keys(tags).forEach(tag => {
if (!["wait", "fade", "type", "pause"].includes(tag))
{
str += "[" + tag + "=" + tags[tag] + "]"
end = "[/" + tag + "]" + end
}
})
let innerText = ""
let tmp = el[1][i]
if (typeof tmp != "string")
{
innerText += tmp()
}
else
{
innerText = tmp
}
str += innerText + end
if (this.TWTime >= this.TWData.start[id][0] && this.LastLetterID < id)
{
this.LastLetterID = id
this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnLetterTyped)
word = true
this.curTypedWidth = str
}
if (word)
{
this.curTypedHeight = str
if (el[1][i] === " ") word = false
}
id++
}
})
if (this.TWTime >= this.TWData.start[this.TWData.start.length - 1][1])
{
//TW END
this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwStop)
this.typewriterActive = false
}
if (!this.typewriterPaused) this.TWTime += this._runtime.GetDt(this._inst)
}
else
{
this.parsedText.forEach(el => {
if (el[0].length == 0)
{
let innerText = ""
let tmp = el[1]
if (typeof tmp != "string")
{
tmp.forEach(f => {
innerText += f()
})
}
else
{
innerText = tmp
}
//console.log(innerText)
str += innerText
}
else
{
for (let i = 0; i < el[1].length; i++)
{
let end = ""
el[0].forEach(tag => {
let val
if (typeof tag[1] === "function") val = tag[1](time, i)
else val = tag[1]
str += "[" + tag[0] + "=" + val + "]"
end = "[/" + tag[0] + "]" + end
})
let innerText = ""
let tmp = el[1][i]
if (typeof tmp != "string")
{
innerText += tmp()
}
else
{
innerText = tmp
}
str += innerText + end
}
}
})
}
this.lastKnown = str
//console.log(str)
this._inst._sdkInst.CallAction(C3.Plugins.Spritefont2.Acts.SetText, str)
}
}
Typewriter(text)
{
if (text === "")
{
this._inst._sdkInst.CallAction(C3.Plugins.Spritefont2.Acts.SetText, "");
this.lastKnown = "";
this.animated = false;
this.typewriterActive = false
return;
}
this.SetTextCall = true
this.text = this.getTextWithNoTW(text)
this.parseText()
text = this.text
this.LastLetterID = -1;
this.typewriterActive = true
this.animated = true
this.typewriterPaused = false
this.TWTime = 0;
this.curTypedWidth = ""
this.curTypedHeight = ""
let pureText = this.getTextWithNoTags(this.text)
let start = 0;
this.TWData = {
start: [],
data: []
}
for (let i = 0; i < pureText.length; i++)
{
var curData = {}
Object.assign(curData, this.TWParamsOBJ.value);
Object.assign(curData, this.TWParamsOBJ.duration);
for (let j = 0; j < this.typewriterTagData.length; j++)
{
let el = this.typewriterTagData[j]
if (el.id > i) break;
let data = el.data.split(' ')
let tag = data[0].toLowerCase()
if ((tag === "wait" || tag === "pause" || tag === "fn") && el.id != i) continue;
if (tag === "fn")
{
data.shift()
curData[tag] = data.join(' ')
}
else if (this.isANumber(data[1])) curData[tag] = parseFloat(data[1])
else curData[tag] = data[1]
}
let special = false
if (curData.hasOwnProperty("wait"))
{
start += curData.wait
}
if (curData.hasOwnProperty("pause"))
{
start += curData.fade
}
this.TWData.start.push([start, start + curData.fade])
start += curData.type
this.TWData.data.push(curData);
}
console.log(this.TWData)
this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwStart)
}
isAString(text)
{
var regex = /(["'])(\\?.)*?\1/g; //"
var match = regex.exec(text);
return match != null && match[0] === text;
}
isANumber(text)
{
return parseFloat(text).toString() === text;
}
SkipTypewriterToNextPause(toEnd)
{
if (!this.typewriterActive) return;
let i = 0;
while (this.TWTime > this.TWData.start[i][0])
{
i++
}
while (i < this.TWData.data.length && (toEnd || !this.TWData.data[i].hasOwnProperty("pause")))
{
if (this.TWData.data[i].hasOwnProperty("fn"))
{
let fnData = this.TWData.data[id].fn.split(' ')
let fnName = fnData.shift()
let fnParams = JSON.parse("[" + fnData.join(' ') + "]") || []
c3_callFunction(fnName, fnParams)
}
i++
}
if (i === this.TWData.data.length)
{
this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwStop)
this.typewriterActive = false
}
else
{
this.TWTime = this.TWData.start[i][0]
}
}
getTextWithNoTags(text)
{
let regex = /\[\/?((?!\/?tw|fn|text)[^\]]*)(=[^\]]*)?\]/gi;
text = text.replace(regex, "");
regex = /\[\/?((?!\/?tw)[^\]]*)(=[^\]]*)?\]/gi;
var match;
while ((match = regex.exec(text)) !== null)
{
let str = text
let a = match[1].split('=')
let b = a[1] || ""
let c = b.split(' ')
let len = parseInt(c[1]) || 0
let str2 = ""
for (let i = 0; i < len; i++)
{
str2 += "0"
}
text = text.replace(match[0], str2)
regex.lastIndex = 0;
}
return text;
}
getTextWithNoTW(text)
{
let regex = /\[tw=([^\]]*)?\]/gi;
var match;
var offset = 0
this.typewriterTagData = []
text = this.getVars(text)
var noTag = this.getTextWithNoTags(text)
while ((match = regex.exec(noTag)) !== null)
{
this.typewriterTagData.push(
{
data: match[1].trim(),
id: match.index - offset
})
offset += match[0].length
}
return text.replace(regex, "");
}
getAnimFunction(tag)
{
if (!this.AnimFunctions.hasOwnProperty(tag))
{
let regex = /^[\d\w]+(\([^()]*\))?$/g;
tag = tag.trim()
if (regex.test(tag))
{
var arr = tag.split('(')
var name = arr[0].trim().toLowerCase()
var fn = this._inst._objectType._SFDXAliasFunctions[name];
if (arr.length > 1)
{
var params = arr[1].slice(0, -1).split(',').map(function(s)
{
return s.trim()
});;
for (let i = 0; i < params.length; i++)
{
if (!isNaN(Number(params[i])))
{
params[i] = Number(params[i])
}
}
params.unshift(null)
this.AnimFunctions[tag] = fn.bind.apply(fn, params)
}
else
{
this.AnimFunctions[tag] = fn
}
}
else
{
this.AnimFunctions[tag] = new Function("t", "i", "return " + tag.toLowerCase() + ";");
}
}
return this.AnimFunctions[tag]
}
parseText()
{
var res = [];
var stack = 0;
var currentTag = []
var currentText = ""
var tagParam = false;
var self = this;
if (typeof this.linkedDictionnary !== "undefined")
{
this.replaceVars()
}
var text = this.text
var regex = /\[\/?((?!\/?sfdx|text|fn)[^\]]*)\]/gi //Matches for tags that are neither sfdx nor text
var match;
while ((match = regex.exec(text)) !== null)
{
let str = text
if (match[0].includes('='))
{
let a = match[1].split('=')
text = text.replace(match[0], "[sfdx=" + a[0] + " \"" + a[1] + "\"]")
}
else
{
text = text.replace(match[0], "[/sfdx]")
}
regex.lastIndex = 0;
}
this.text = text
for (let i = 0; i < text.length; i++)
{
if (tagParam)
{
if (text[i] === "]")
{
tagParam = false;
currentText = ""
}
else
{
currentTag[stack - 1] += text[i]
}
}
else
{
if (text.substring(i).toLowerCase().startsWith("[sfdx="))
{
push(JSON.parse(JSON.stringify(currentTag)), currentText)
stack++;
currentTag.push("");
tagParam = true;
i += 5
}
else if (text.substring(i).toLowerCase().startsWith("[/sfdx]"))
{
stack--;
push(JSON.parse(JSON.stringify(currentTag)), currentText)
currentTag.pop();
currentText = ""
i += 6
}
else if (text.substring(i).toLowerCase().startsWith("[text="))
{
push(JSON.parse(JSON.stringify(currentTag)), currentText)
currentText = ""
i += 6
while (text[i] !== "]")
{
currentText += text[i]
i++
}
let textParam = currentText.split(' ')
let obj = []
let textName = textParam[0]
let length = parseInt(textParam[1]) || 0
for (let i = 0; i < length; i++)
{
obj.push(this.getChar.bind(this, textName, i, false))
}
push(JSON.parse(JSON.stringify(currentTag)), obj)
currentText = ""
}
else if (text.substring(i).toLowerCase().startsWith("[fn="))
{
push(JSON.parse(JSON.stringify(currentTag)), currentText)
currentText = ""
i += 4
while (text[i] !== "]")
{
currentText += text[i]
i++
}
let textParam = currentText.split(' ')
let obj = []
let textName = textParam[0]
let length = parseInt(textParam[1]) || 0
for (let i = 0; i < length; i++)
{
obj.push(this.getChar.bind(this, textName, i, true))
}
push(JSON.parse(JSON.stringify(currentTag)), obj)
currentText = ""
}
else
{
currentText += text[i]
}
}
}
push(JSON.parse(JSON.stringify(currentTag)), currentText)
function push(tag, text)
{
if (text == "") return
var tagArray = []
tag.forEach(t => {
var arr = t.split(' ')
var firstTag = arr.shift();
var tagfn = arr.join(' ');
var fn
if (self.isAString(tagfn))
{
fn = tagfn.substring(1, tagfn.length - 1)
}
else
{
fn = self.getAnimFunction(tagfn);
}
tagArray.push([firstTag, fn])
})
res.push([tagArray, text])
}
//console.log(res)
this.parsedText = res
}
getChar(name, i, fn)
{
if (fn)
{
name = name.toLowerCase()
let str = c3_callFunction(name) || "";
if (i < str.length)
{
return str[i]
}
else
{
return " "
}
}
else
{
name = name.toLowerCase()
if (this.linkedDictionnary.has(name))
{
let val = this.linkedDictionnary.get(name)
return i < val.length ? val[i] : " "
}
else
{
return " "
}
}
}
replaceVars()
{
this.text = this.getVars(this.text)
}
getVars(text)
{
var regex = /\[(var|varfn)=([\d\w]+)\]/gi
var match;
while ((match = regex.exec(text)) !== null)
{
let isVar = match[1].trim().toLowerCase() === "var";
let varName = match[2].toLowerCase();
//console.log(match)
if (isVar)
{
if (this.linkedDictionnary.has(varName))
{
text = text.replace(match[0], this.linkedDictionnary.get(varName))
regex.lastIndex = 0;
}
}
else
{
let str = c3_callFunction(varName) || ""
text = text.replace(match[0], str)
regex.lastIndex = 0;
}
}
return text;
}
};
}
"use strict";
{
C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds = {
IsTyping()
{
return this.typewriterActive && !this.typewriterPaused
},
OnLetterTyped()
{
return true;
},
OnTwPause()
{
return true;
},
OnTwResume()
{
return true;
},
OnTwStart()
{
return true;
},
OnTwStop()
{
return true;
}
};
}
"use strict";
{
C3.Behaviors.skymen_Skymen_SpritefontDX.Acts = {
SetAlias(name, params, body)
{
body = "return " + body + ";";
var arr = [];
if (params.trim() != "")
{
params = params.split(',').map(function(s)
{
return s.trim()
});
arr = arr.concat([Function], params, ['t', 'i'], [body]);
}
else
{
arr = arr.concat([Function], ['t', 'i'], [body]);
}
var fn = new(Function.bind.apply(Function, arr))();
this._inst._objectType._SFDXAliasFunctions[name.toLowerCase().trim()] = fn;
},
SetText(text)
{
this.text = text;
this.SetTextCall = true
this.parseText()
this.animated = true;
},
PauseTw()
{
this.typewriterPaused = true
this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwPause)
},
ResumeTw()
{
this.typewriterPaused = false
this.Trigger(C3.Behaviors.skymen_Skymen_SpritefontDX.Cnds.OnTwResume)
},
SetTwEasing(easing)
{
this.TWEasing = easingNames[easing];
},
SetTwParams(params)
{
this.TWParams = params;
this.TWParamsOBJ = this.parseTypewriterParams(this.TWParams);
},
SkipTw(mode)
{
this.SkipTypewriterToNextPause(mode === 0)
},
Typewrite(text)
{
this.Typewriter(text)
},
LinkDictionary(dictionary)
{
this.linkedDictionnary = dictionary.GetInstanceByIID(0)._sdkInst.GetDataMap()
this.linkedDictionnaryUID = dictionary.GetInstanceByIID(0)._uid
}
};
}
"use strict";
{
C3.Behaviors.skymen_Skymen_SpritefontDX.Exps = {
LastLetterIndex()
{
return this.LastLetterID;
},
TypewriterEasing()
{
return this.TWEasing;
},
TypewriterParams()
{
return this.TWParams;
},
TypedTextWidth()
{
let b
if (this.typewriterActive)
{
let a = this._inst._sdkInst._text;
this._inst._sdkInst.CallAction(C3.Plugins.Spritefont2.Acts.SetText, this.curTypedWidth)
b = this._inst._sdkInst.CallExpression(C3.Plugins.Spritefont2.Exps.TextWidth);
this._inst._sdkInst.CallAction(C3.Plugins.Spritefont2.Acts.SetText, a);
}
else
{
b = this._inst._sdkInst.CallExpression(C3.Plugins.Spritefont2.Exps.TextWidth);
}
return b
},
TypedTextHeight()
{
let b
if (this.typewriterActive)
{
let a = this._inst._sdkInst._text;
this._inst._sdkInst.CallAction(C3.Plugins.Spritefont2.Acts.SetText, this.curTypedHeight)
b = this._inst._sdkInst.CallExpression(C3.Plugins.Spritefont2.Exps.TextHeight);
this._inst._sdkInst.CallAction(C3.Plugins.Spritefont2.Acts.SetText, a);
}
else
{
b = this._inst._sdkInst.CallExpression(C3.Plugins.Spritefont2.Exps.TextHeight);
}
return b
}
};
}
"use strict";C3.Behaviors.Sin=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Sin.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{const a=2*Math.PI,b=Math.PI/2,c=3*Math.PI/2,d=[0,1,8,3,4,2,5,6,9,7];C3.Behaviors.Sin.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(b,c){super(b),this._i=0,this._movement=0,this._wave=0,this._period=0,this._mag=0,this._isEnabled=!0,this._basePeriod=0,this._basePeriodOffset=0,this._baseMag=0,this._periodRandom=0,this._periodOffsetRandom=0,this._magnitudeRandom=0,this._initialValue=0,this._initialValue2=0,this._lastKnownValue=0,this._lastKnownValue2=0,this._ratio=0,c&&(this._movement=d[c[0]],this._wave=c[1],this._periodRandom=this._runtime.Random()*c[3],this._basePeriod=c[2],this._period=c[2],this._period+=this._periodRandom,this._basePeriodOffset=c[4],0!==this._period&&(this._periodOffsetRandom=this._runtime.Random()*c[5],this._i=c[4]/this._period*a,this._i+=this._periodOffsetRandom/this._period*a),this._magnitudeRandom=this._runtime.Random()*c[7],this._baseMag=c[6],this._mag=c[6],this._mag+=this._magnitudeRandom,this._isEnabled=!!c[8]),this._movement===5&&(this._mag=C3.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(a){this._i=a["i"],this._SetEnabled(a["e"]),this._movement=a["mv"],this._wave=a["w"],this._period=a["p"],this._mag=a["mag"],this._initialValue=a["iv"],this._initialValue2=a["iv2"],this._ratio=a["r"],this._lastKnownValue=a["lkv"],this._lastKnownValue2=a["lkv2"]}Init(){const a=this._inst.GetWorldInfo();switch(this._movement){case 0:this._initialValue=a.GetX();break;case 1:this._initialValue=a.GetY();break;case 2:this._initialValue=a.GetWidth(),this._ratio=a.GetHeight()/a.GetWidth();break;case 3:this._initialValue=a.GetWidth();break;case 4:this._initialValue=a.GetHeight();break;case 5:this._initialValue=a.GetAngle();break;case 6:this._initialValue=a.GetOpacity();break;case 7:this._initialValue=0;break;case 8:this._initialValue=a.GetX(),this._initialValue2=a.GetY();break;case 9:this._initialValue=a.GetZElevation();break;default:;}this._lastKnownValue=this._initialValue,this._lastKnownValue2=this._initialValue2}WaveFunc(d){var e=Math.PI;switch(d%=a,this._wave){case 0:return Math.sin(d);case 1:return d<=b?d/b:d<=c?1-2*(d-b)/e:(d-c)/b-1;case 2:return 2*d/a-1;case 3:return-2*d/a+1;case 4:return d<e?-1:1;}return 0}Tick(){const b=this._runtime.GetDt(this._inst);this._isEnabled&&0!==b&&(this._i=0===this._period?0:(this._i+b/this._period*a)%a,this._UpdateFromPhase())}_UpdateFromPhase(){const a=this._inst.GetWorldInfo();switch(this._movement){case 0:a.GetX()!==this._lastKnownValue&&(this._initialValue+=a.GetX()-this._lastKnownValue),a.SetX(this._initialValue+this.WaveFunc(this._i)*this._mag),this._lastKnownValue=a.GetX();break;case 1:a.GetY()!==this._lastKnownValue&&(this._initialValue+=a.GetY()-this._lastKnownValue),a.SetY(this._initialValue+this.WaveFunc(this._i)*this._mag),this._lastKnownValue=a.GetY();break;case 2:a.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag),a.SetHeight(a.GetWidth()*this._ratio);break;case 3:a.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 4:a.SetHeight(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 5:a.GetAngle()!==this._lastKnownValue&&(this._initialValue=C3.clampAngle(this._initialValue+(a.GetAngle()-this._lastKnownValue))),a.SetAngle(this._initialValue+this.WaveFunc(this._i)*this._mag),this._lastKnownValue=a.GetAngle();break;case 6:a.SetOpacity(this._initialValue+this.WaveFunc(this._i)*this._mag/100);break;case 8:a.GetX()!==this._lastKnownValue&&(this._initialValue+=a.GetX()-this._lastKnownValue),a.GetY()!==this._lastKnownValue2&&(this._initialValue2+=a.GetY()-this._lastKnownValue2),a.SetX(this._initialValue+Math.cos(a.GetAngle())*this.WaveFunc(this._i)*this._mag),a.SetY(this._initialValue2+Math.sin(a.GetAngle())*this.WaveFunc(this._i)*this._mag),this._lastKnownValue=a.GetX(),this._lastKnownValue2=a.GetY();break;case 9:a.SetZElevation(this._initialValue+this.WaveFunc(this._i)*this._mag);}a.SetBboxChanged()}_OnSpriteFrameChanged(){}_SetEnabled(a){this._isEnabled=!!a,this._isEnabled?this._StartTicking():this._StopTicking()}GetPropertyValueByIndex(a){return a===0?this._movement:1===a?this._wave:2===a?this._basePeriod:6===a?this._baseMag:8===a?this._isEnabled:void 0}SetPropertyValueByIndex(b,c){b===0?(this._movement=d[c],this.Init()):1===b?this._wave=c:2===b?(this._basePeriod=c,this._period=this._basePeriod+this._periodRandom,this._isEnabled||(0===this._period?this._i=0:(this._i=this._basePeriodOffset/this._period*a,this._i+=this._periodOffsetRandom/this._period*a))):6===b?(this._baseMag=c,this._mag=this._baseMag+this._magnitudeRandom,5===this._movement&&(this._mag=C3.toRadians(this._mag))):8===b?this._isEnabled=!!c:void 0}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.sin.properties.enabled.name",value:this._isEnabled,onedit:(a)=>this._SetEnabled(a)},{name:"behaviors.sin.properties.period.name",value:this._period,onedit:(a)=>this._period=a},{name:"behaviors.sin.properties.magnitude.name",value:this._mag,onedit:(a)=>this._mag=a},{name:"behaviors.sin.debugger.value",value:this.WaveFunc(this._i)*this._mag}]}]}}}
"use strict";C3.Behaviors.Sin.Cnds={IsEnabled(){return this._isEnabled},CompareMovement(a){return this._movement===a},ComparePeriod(a,b){return C3.compare(this._period,a,b)},CompareMagnitude(a,b){return 5===this._movement?C3.compare(this._mag,a,C3.toRadians(b)):C3.compare(this._mag,a,b)},CompareWave(a){return this._wave===a}};
"use strict";C3.Behaviors.Sin.Acts={SetEnabled(a){this._SetEnabled(0!==a)},SetPeriod(a){this._period=a},SetMagnitude(a){this._mag=a,5===this._movement&&(this._mag=C3.toRadians(this._mag))},SetMovement(a){5===this._movement&&5!==a&&(this._mag=C3.toDegrees(this._mag)),this._movement=a,this.Init()},SetWave(a){this._wave=a},SetPhase(a){const b=2*Math.PI;this._i=a*b%b,this._UpdateFromPhase()},UpdateInitialState(){this.Init()}};
"use strict";C3.Behaviors.Sin.Exps={CyclePosition(){return this._i/(2*Math.PI)},Period(){return this._period},Magnitude(){return 5===this._movement?C3.toDegrees(this._mag):this._mag},Value(){return this.WaveFunc(this._i)*this._mag}};
"use strict";C3.Behaviors.Pin=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Pin.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";C3.Behaviors.Pin.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a,b){super(a),this._pinInst=null,this._pinUid=-1,this._mode="",this._propSet=new Set,this._pinDist=0,this._pinAngle=0,this._pinImagePoint=0,this._dx=0,this._dy=0,this._dWidth=0,this._dHeight=0,this._dAngle=0,this._dz=0,this._lastKnownAngle=0,this._destroy=!1,b&&(this._destroy=b[0]);const c=this._runtime.Dispatcher();this._disposables=new C3.CompositeDisposable(C3.Disposable.From(c,"instancedestroy",(a)=>this._OnInstanceDestroyed(a.instance)),C3.Disposable.From(c,"afterload",()=>this._OnAfterLoad()))}Release(){this._pinInst=null,super.Release()}_SetPinInst(a){a?(this._pinInst=a,this._StartTicking2()):(this._pinInst=null,this._StopTicking2())}_Pin(a,b,c){if(a){const d=a.GetFirstPicked(this._inst);if(d){this._mode=b,this._SetPinInst(d);const a=this._inst.GetWorldInfo(),e=d.GetWorldInfo();if("properties"===this._mode){const b=this._propSet;b.clear();for(const a of c)b.add(a);this._dx=a.GetX()-e.GetX(),this._dy=a.GetY()-e.GetY(),this._dAngle=a.GetAngle()-e.GetAngle(),this._lastKnownAngle=a.GetAngle(),this._dz=a.GetZElevation()-e.GetZElevation(),b.has("x")&&b.has("y")&&(this._pinAngle=C3.angleTo(e.GetX(),e.GetY(),a.GetX(),a.GetY())-e.GetAngle(),this._pinDist=C3.distanceTo(e.GetX(),e.GetY(),a.GetX(),a.GetY())),b.has("width-abs")?this._dWidth=a.GetWidth()-e.GetWidth():b.has("width-scale")&&(this._dWidth=a.GetWidth()/e.GetWidth()),b.has("height-abs")?this._dHeight=a.GetHeight()-e.GetHeight():b.has("height-scale")&&(this._dHeight=a.GetHeight()/e.GetHeight())}else this._pinDist=C3.distanceTo(e.GetX(),e.GetY(),a.GetX(),a.GetY())}}}SaveToJson(){const a=this._propSet,b=this._mode,c={"uid":this._pinInst?this._pinInst.GetUID():-1,"m":b};return"rope"===b||"bar"===b?c["pd"]=this._pinDist:"properties"===b&&(c["ps"]=[...this._propSet],a.has("imagepoint")?c["ip"]=this._pinImagePoint:a.has("x")&&a.has("y")?(c["pa"]=this._pinAngle,c["pd"]=this._pinDist):(a.has("x")&&(c["dx"]=this._dx),a.has("y")&&(c["dy"]=this._dy)),a.has("angle")&&(c["da"]=this._dAngle,c["lka"]=this._lastKnownAngle),(a.has("width-abs")||a.has("width-scale"))&&(c["dw"]=this._dWidth),(a.has("height-abs")||a.has("height-scale"))&&(c["dh"]=this._dHeight),a.has("z")&&(c["dz"]=this._dz)),c}LoadFromJson(a){const b=a["m"],c=this._propSet;if(c.clear(),this._pinUid=a["uid"],"number"==typeof b)return void this._LoadFromJson_Legacy(a);if(this._mode=b,"rope"===b||"bar"===b)this._pinDist=a["pd"];else if("properties"===b){for(const b of a["ps"])c.add(b);c.has("imagepoint")?this._pinImagePoint=a["ip"]:c.has("x")&&c.has("y")?(this._pinAngle=a["pa"],this._pinDist=a["pd"]):(c.has("x")&&(this._dx=a["dx"]),c.has("y")&&(this._dy=a["dy"])),c.has("angle")&&(this._dAngle=a["da"],this._lastKnownAngle=a["lka"]||0),(c.has("width-abs")||c.has("width-scale"))&&(this._dWidth=a["dw"]),(c.has("height-abs")||c.has("height-scale"))&&(this._dHeight=a["dh"]),c.has("z")&&(this._dz=a["dz"])}}_LoadFromJson_Legacy(a){const b=this._propSet,c=a["msa"],d=a["tsa"],e=a["pa"],f=a["pd"],g=a["m"];0===g?(this._mode="properties",b.add("x").add("y").add("angle"),this._pinAngle=e,this._pinDist=f,this._dAngle=c-d,this._lastKnownAngle=a["lka"]):1===g?(this._mode="properties",b.add("x").add("y"),this._pinAngle=e,this._pinDist=f):2===g?(this._mode="properties",b.add("angle"),this._dAngle=c-d,this._lastKnownAngle=a["lka"]):3===g?(this._mode="rope",this._pinDist=a["pd"]):4===g?(this._mode="bar",this._pinDist=a["pd"]):void 0}_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 b=Math.sin,c=Math.cos;const a=this._pinInst;if(!a)return;const d=a.GetWorldInfo(),e=this._inst,f=e.GetWorldInfo(),g=this._mode;let h=!1;if("rope"===g||"bar"===g){const a=C3.distanceTo(f.GetX(),f.GetY(),d.GetX(),d.GetY());if(a>this._pinDist||"bar"===g&&a<this._pinDist){const e=C3.angleTo(d.GetX(),d.GetY(),f.GetX(),f.GetY());f.SetXY(d.GetX()+c(e)*this._pinDist,d.GetY()+b(e)*this._pinDist),h=!0}}else{const e=this._propSet;let g=0;if(e.has("imagepoint")){const[b,c]=a.GetImagePoint(this._pinImagePoint);f.EqualsXY(b,c)||(f.SetXY(b,c),h=!0)}else if(e.has("x")&&e.has("y")){const a=d.GetX()+c(d.GetAngle()+this._pinAngle)*this._pinDist,e=d.GetY()+b(d.GetAngle()+this._pinAngle)*this._pinDist;f.EqualsXY(a,e)||(f.SetXY(a,e),h=!0)}else g=d.GetX()+this._dx,e.has("x")&&g!==f.GetX()&&(f.SetX(g),h=!0),g=d.GetY()+this._dy,e.has("y")&&g!==f.GetY()&&(f.SetY(g),h=!0);e.has("angle")&&(this._lastKnownAngle!==f.GetAngle()&&(this._dAngle=C3.clampAngle(this._dAngle+(f.GetAngle()-this._lastKnownAngle))),g=C3.clampAngle(d.GetAngle()+this._dAngle),g!==f.GetAngle()&&(f.SetAngle(g),h=!0),this._lastKnownAngle=f.GetAngle()),e.has("width-abs")&&(g=d.GetWidth()+this._dWidth,g!==f.GetWidth()&&(f.SetWidth(g),h=!0)),e.has("width-scale")&&(g=d.GetWidth()*this._dWidth,g!==f.GetWidth()&&(f.SetWidth(g),h=!0)),e.has("height-abs")&&(g=d.GetHeight()+this._dHeight,g!==f.GetHeight()&&(f.SetHeight(g),h=!0)),e.has("height-scale")&&(g=d.GetHeight()*this._dHeight,g!==f.GetHeight()&&(f.SetHeight(g),h=!0)),e.has("z")&&(g=d.GetZElevation()+this._dz,g!==f.GetZElevation()&&(f.SetZElevation(g),this._runtime.UpdateRender()))}h&&f.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";C3.Behaviors.Pin.Cnds={IsPinned(){return!!this._pinInst},WillDestroy(){return this._destroy}};
"use strict";C3.Behaviors.Pin.Acts={PinByDistance(a,b){this._Pin(a,0===b?"rope":"bar")},PinByProperties(a,b,c,d,e,f,g){const h=[];b&&h.push("x"),c&&h.push("y"),d&&h.push("angle"),g&&h.push("z"),1===e?h.push("width-abs"):2==e&&h.push("width-scale"),1===f?h.push("height-abs"):2==f&&h.push("height-scale");0===h.length||this._Pin(a,"properties",h)},PinByImagePoint(a,b,c,d,e,f){const g=["imagepoint"];c&&g.push("angle"),f&&g.push("z"),1===d?g.push("width-abs"):2==d&&g.push("width-scale"),1===e?g.push("height-abs"):2==e&&g.push("height-scale"),this._pinImagePoint=b,this._Pin(a,"properties",g)},SetPinDistance(a){("rope"===this._mode||"bar"===this._mode)&&(this._pinDist=Math.max(a,0))},SetDestroy(a){this._destroy=a},Unpin(){this._SetPinInst(null),this._mode="",this._propSet.clear(),this._pinImagePoint=""},Pin(a,b){0===b?this._Pin(a,"properties",["x","y","angle"]):1===b?this._Pin(a,"properties",["x","y"]):2===b?this._Pin(a,"properties",["angle"]):3===b?this._Pin(a,"rope"):4===b?this._Pin(a,"bar"):void 0}};
"use strict";C3.Behaviors.Pin.Exps={PinnedUID(){return this._pinInst?this._pinInst.GetUID():-1}};
"use strict";C3.Behaviors.scrollto=class extends C3.SDKBehaviorBase{constructor(a){super(a),this._shakeMag=0,this._shakeStart=0,this._shakeEnd=0,this._shakeMode=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";C3.Behaviors.scrollto.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{C3.Behaviors.scrollto.Instance=class extends C3.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._isEnabled?this._StartTicking2():this._StopTicking2()}IsEnabled(){return this._isEnabled}Tick2(){if(!this.IsEnabled())return;const a=this._runtime.GetDt(this._inst),b=this.GetBehavior(),c=b.GetInstances();let d=0,e=0,f=0;for(const a of c){const b=a.GetBehaviorInstanceFromCtor(C3.Behaviors.scrollto);if(!b||!b.GetSdkInstance().IsEnabled())continue;const c=a.GetWorldInfo();d+=c.GetX(),e+=c.GetY(),++f}const g=this._inst.GetWorldInfo().GetLayout(),h=this._runtime.GetGameTime();let i=0,j=0;if(h>=b.GetShakeStart()&&h<b.GetShakeEnd()){let c=b.GetShakeMagnitude()*Math.min(this._runtime.GetTimeScale(),1);0===b.GetShakeMode()&&(c*=1-(h-b.GetShakeStart())/(b.GetShakeEnd()-b.GetShakeStart()));const e=2*(this._runtime.Random()*Math.PI),a=this._runtime.Random()*c;i=Math.cos(e)*a,j=Math.sin(e)*a}g.SetScrollX(d/f+i),g.SetScrollY(e/f+j)}GetPropertyValueByIndex(a){return a===0?this._isEnabled:void 0}SetPropertyValueByIndex(a,b){a===0?(this._isEnabled=!!b,this._isEnabled?this._StartTicking2():this._StopTicking2()):void 0}}}
"use strict";C3.Behaviors.scrollto.Cnds={IsEnabled(){return this._isEnabled}};
"use strict";C3.Behaviors.scrollto.Acts={Shake(a,b,c){const d=this.GetBehavior();d.SetShakeMagnitude(a),d.SetShakeStart(this._runtime.GetGameTime()),d.SetShakeEnd(this._runtime.GetGameTime()+b),d.SetShakeMode(c)},SetEnabled(a){this._isEnabled=0!==a,this._isEnabled?this._StartTicking2():this._StopTicking2()}};
"use strict";C3.Behaviors.scrollto.Exps={};
{
C3.Behaviors.SkymenSkin = class SkymenSkinBehavior extends C3.SDKBehaviorBase
{
constructor(opts)
{
super(opts);
}
Release()
{
super.Release();
}
};
}
"use strict";
{
C3.Behaviors.SkymenSkin.Type = class SkymenSkinType extends C3.SDKBehaviorTypeBase
{
constructor(objectClass)
{
super(objectClass);
}
Release()
{
super.Release();
}
OnCreate()
{
}
};
}
"use strict";
{
C3.Behaviors.SkymenSkin.Instance = class SkymenSkinInstance extends C3.SDKBehaviorInstanceBase //SDKInstanceBase
{
constructor(inst, properties)
{
super(inst);
// Load properties
this.skinBaseTag = properties[0];
// object is sealed after this call, so make sure any properties you'll ever need are created, e.g.
if (C3.SkymenSkinCore == undefined) {
alert("Skin base plugin needed, please create it.");
} else if (C3.SkymenSkinCore[this.skinBaseTag] == undefined) {
alert("Skin base with tag " + this.skinBaseTag + " cannot be found.");
} else {
this.skinBase = C3.SkymenSkinCore[this.skinBaseTag];
this.skinBase.addInstance(this);
}
//Properties ======
this.skinTag = properties[1];
this.subSkinTag = properties[2];
this.oldSkinTag = properties[1];
this.oldSubSkinTag = properties[2];
this.syncWithAnim = properties[3] === 0 || properties[3] === 2;
this.syncWithFrame = properties[3] === 1 || properties[3] === 2;
this.default = properties[4] === 0; //0 = Yes, 1 = No
this.hideDefault = properties[5] === 0; //0 = Yes, 1 = No
this.imagePoint = properties[6];
this.syncZOrder = properties[7] === 0; //0 = Yes, 1 = No
this.syncSize = properties[8] === 1;
this.syncScale = properties[8] === 2;
this.firstFrame = true;
this.widthRatio = 1;
this.heightRatio = 1;
this.lastLayout = this._runtime.running_layout
//Object
this.object = null;
if (!this._inst.behaviorSkins) {
this._inst.behaviorSkins = [];
}
var found = false
for (let index = 0; index < this._inst.behaviorSkins.length; index++) {
const behavior = this._inst.behaviorSkins[index];
if (this === behavior) {
found = true
this.behaviorId = index
}
}
if (!found) {
this.behaviorId = this._inst.behaviorSkins.length;
this._inst.behaviorSkins.push(this);
}
//Init
if (this.skinBase.init) {
this.updateSkin();
}
this._StartTicking2();
}
SaveToJSON()
{
return {
skinTag: this.skinTag,
subSkinTag: this.subSkinTag,
oldSkinTag: this.oldSkinTag,
oldSubSkinTag: this.oldSubSkinTag,
syncWithAnim: this.syncWithAnim,
syncWithFrame: this.syncWithFrame,
default: this.default,
hideDefault: this.hideDefault,
imagePoint: this.imagePoint,
syncZOrder: this.syncZOrder,
syncSize: this.syncSize,
syncScale: this.syncScale,
firstFrame: this.firstFrame,
skinBaseTag: this.skinBaseTag,
behaviorId: this.behaviorId
};
}
LoadToJSON(o)
{
this.skinTag = o.skinTag;
this.subSkinTag = o.subSkinTag;
this.oldSkinTag = o.oldSkinTag;
this.oldSubSkinTag = o.oldSubSkinTag;
this.syncWithAnim = o.syncWithAnim;
this.syncWithFrame = o.syncWithFrame;
this.default = o.default;
this.hideDefault = o.hideDefault;
this.imagePoint = o.imagePoint;
this.syncZOrder = o.syncZOrder;
this.firstFrame = o.firstFrame;
this.skinBaseTag = o.skinBaseTag;
this.behaviorId = o.behaviorId;
this.syncSize = o.syncSize;
this.syncScale = o.syncScale;
}
Tick()
{
if (this.firstFrame) {
if (this.syncWithAnim) {
this.subSkinTag = this.getCurAnim(this._inst);
this.oldsubSkinTag = this.getCurAnim(this._inst);
}
this.firstFrame = false;
}
this._StopTicking();
}
Tick2()
{
if (this.object == null) return;
//console.log(this._inst.GetImagePoint(this.imagePoint))
var [newx, newy] = this._inst.GetImagePoint(this.imagePoint);
var worldInfo = this.GetWorldInfo();
var objectWorldInfo = this.object.GetWorldInfo();
var angle = worldInfo.GetAngle();
var inst = {
angle: worldInfo.GetAngle(),
x: worldInfo.GetX(),
y: worldInfo.GetY(),
width: worldInfo.GetWidth(),
height: worldInfo.GetHeight()
}
var object = {
angle: objectWorldInfo.GetAngle(),
x: objectWorldInfo.GetX(),
y: objectWorldInfo.GetY(),
width: objectWorldInfo.GetWidth(),
height: objectWorldInfo.GetHeight()
}
var anim = this.getCurAnim(this._inst);
if (this.syncSize || this.syncScale) {
if (object.width != inst.width * this.widthRatio) {
objectWorldInfo.SetWidth(inst.width * this.widthRatio)
}
if (object.height != inst.height * this.heightRatio) {
objectWorldInfo.SetHeight(inst.height * this.heightRatio)
}
} else {
var mirrorred = (inst.width < 0);
var selfMirrorred = (object.width < 0);
var flipped = (inst.height < 0);
var selfFlipped = (object.height < 0);
if (mirrorred != selfMirrorred) {
objectWorldInfo.SetWidth(Math.abs(object.width) * (mirrorred ? -1 : 1));
}
if (flipped != selfFlipped) {
objectWorldInfo.SetHeight(Math.abs(object.height) * (flipped ? -1 : 1));
}
}
var other = this._inst;
if (this.behaviorId != 0) {
var i = this.behaviorId - 1;
while (i >= 0 && this._inst.behaviorSkins[i].object == null) {
i--;
}
if (i >= 0) {
other = this._inst.behaviorSkins[i].object;
}
}
if (this.syncZOrder && objectWorldInfo.GetZIndex() !== other.GetWorldInfo().GetZIndex() + 1) {
this.setZorder();
}
if (object.x != newx) {
objectWorldInfo.SetX(newx);
}
if (object.y != newy) {
objectWorldInfo.SetY(newy);
}
if (object.angle != angle) {
objectWorldInfo.SetAngle(angle);
}
objectWorldInfo.SetBboxChanged();
if (this.syncWithAnim && this.subSkinTag != anim) {
this.subSkinTag = anim;
}
if (this.syncWithFrame && this._inst._sdkInst._currentFrameIndex != this.object._sdkInst._currentFrameIndex) {
this.object._sdkInst.CallAction(C3.Plugins.Sprite.Acts.SetAnimFrame, this._inst._sdkInst._currentFrameIndex);
}
if (this.skinTag != this.oldSkinTag || this.subSkinTag != this.oldSubSkinTag) {
this.oldSkinTag = this.skinTag;
this.oldSubSkinTag = this.subSkinTag;
this.updateSkin();
}
}
Release()
{
super.Release();
}
updateSkin() {
if (this._inst._sdkInst == null) return;
var instInfo = this._inst.GetWorldInfo();
if (this.default) {
if (this.object != null) {
this.destroy();
}
if (this.hideDefault && !instInfo.IsVisible()) {
instInfo.SetVisible(true);
this._runtime.UpdateRender();
}
return;
} else {
if (this.hideDefault && instInfo.IsVisible()) {
instInfo.SetVisible(false);
this._runtime.UpdateRender();
}
}
if (this.object == null) {
if (this._inst && this._inst._sdkInst._currentAnimation) {
var anim = this.getCurAnim(this._inst)
if (this.syncWithAnim && this.subSkinTag != anim) {
this.subSkinTag = anim;
}
}
var type = this.getType(this.skinTag, this.subSkinTag);
if (type == null) {
console.warn("Cannot assign subskin " + this.subSkinTag + " of skin " + this.skinTag + " because it doesn't exist. Reverting back to default.");
this.default = true;
this.updateSkin();
return;
}
if (this.syncWithAnim) {
this.subSkinTag = this.getCurAnim(this._inst)
}
var [x, y] = this._inst.GetImagePoint(this.imagePoint);
this.object = this._runtime.CreateInstance(type, this._inst.GetWorldInfo().GetLayer(), x, y)
var objectInfo = this.object.GetWorldInfo();
if (this.syncScale) {
this.widthRatio = objectInfo.GetWidth() / instInfo.GetWidth();
this.heightRatio = objectInfo.GetHeight() / instInfo.GetHeight();
} else if (this.syncSize) {
this.widthRatio = 1;
this.heightRatio = 1;
objectInfo.SetWidth(instInfo.GetWidth());
objectInfo.SetHeight(instInfo.GetHeight());
}
var anim = this.getAnim(this.skinTag, this.subSkinTag);
this.object._sdkInst.CallAction(C3.Plugins.Sprite.Acts.SetAnim, anim, 0)
if (this.syncWithFrame) {
this.object._sdkInst.CallAction(C3.Plugins.Sprite.Acts.SetAnimSpeed, 0);
}
this.setZorder();
this.object._sdkInst.CallAction(C3.Plugins.Sprite.Acts.SetCollisions, 0);
} else {
if (this.object.GetObjectClass() == this.getType(this.skinTag, this.subSkinTag)) {
if (this.syncWithAnim) {
this.subSkinTag = this.getCurAnim(this._inst);
}
anim = this.getAnim(this.skinTag, this.subSkinTag);
this.object._sdkInst.CallAction(C3.Plugins.Sprite.Acts.SetAnim, anim, 0)
if (this.syncWithFrame) {
this.object._sdkInst.CallAction(C3.Plugins.Sprite.Acts.SetAnimSpeed, 0);
}
if (this.syncZOrder) this.setZorder();
this.object._sdkInst.CallAction(C3.Plugins.Sprite.Acts.SetCollisions, 0);
} else {
this.destroy();
this.updateSkin();
return
}
}
}
destroy() {
if (this.object === null) return;
if (this.object.behaviorSkins) {
for (var i = 0; i < this.object.behaviorSkins.length; i++) {
this.object.behaviorSkins[i].destroy();
}
}
this._runtime.DestroyInstance(this.object);
this.object = null;
}
setZorder() {
var other = this._inst;
//You can layer multiple skins addons on top of each other and their z order
//will order in the order you set them in the editor from top to bottom.
//If this is not the first behavior, get the behavior below it to give you the object to be on top of.
//If the behavior below doesn't have an active skin, just go the one below etc
if (this.behaviorId != 0) {
var i = this.behaviorId - 1;
while (i >= 0 && this._inst.behaviorSkins[i].object == null) {
i--;
}
if (i >= 0) {
other = this._inst.behaviorSkins[i].object;
}
}
//Once you get the "other" instance, just get the info, and change the z order.
var otherInfo = other.GetWorldInfo()
var objectInfo = this.object.GetWorldInfo()
var objectLayer = objectInfo.GetLayer();
var otherLayer = otherInfo.GetLayer();
// And this is the part I copied from the system action's code
// First move to same layer as other object if different
if (objectLayer.GetIndex() !== otherLayer.GetIndex()) {
objectLayer._RemoveInstance(this.object, true);
objectInfo._SetLayer(otherLayer);
otherLayer._AddInstance(this.object, true);
objectLayer = objectInfo.GetLayer();
}
objectLayer.MoveInstanceAdjacent(this.object, other, true);
this._runtime.UpdateRender()
}
getType(skin, subSkin) {
if (this.skinBase.skins[skin] == undefined || this.skinBase.skins[skin][subSkin] == undefined) {
return null;
}
return this.skinBase.skins[skin][subSkin].type;
}
getAnim(skin, subSkin) {
if (this.skinBase.skins[skin] == undefined || this.skinBase.skins[skin][subSkin] == undefined) {
return null;
}
return this.skinBase.skins[skin][subSkin].anim;
}
getCurAnim(obj) {
return obj._sdkInst._currentAnimation.GetName();
}
};
}
"use strict";
{
C3.Behaviors.SkymenSkin.Cnds = {
IsDefault () {
return this.default;
},
IsSkin(skin){
return this.skinTag == skin;
},
IsSubSkin(subSkin){
return this.subSkinTag == subSkin;
},
IsDefaultHidden(){
return this.hideDefault;
},
};
}
"use strict";
{
C3.Behaviors.SkymenSkin.Acts = {
SetSkin(skin){
if (this.default) {
this.default = false;
}
this.skinTag = skin;
this.updateSkin();
},
SetSubSkin(subSkin){
this.subSkinTag = subSkin;
this.updateSkin();
},
Setup(skin, subSkin){
this.default = false;
this.skinTag = skin;
this.subSkinTag = subSkin;
this.updateSkin();
},
UseDefault(){
this.default = true;
this.updateSkin();
},
HideDefault(hide){
this.hideDefault = hide === 1; //0 = No, 1 = Yes
this.updateSkin();
},
SetImagePoint(ip){
this.imagePoint = ip;
},
SyncMode(mode){
this.syncWithAnim = mode === 0 || mode === 2;
this.syncWithFrame = mode === 1 || mode === 2;
if (this.syncWithAnim) {
this.subSkinTag = this.getCurAnim(this._inst);
}
},
SyncZOrder(mode){
this.syncZOrder = mode === 0;
},
UpdateZOrder(){
if (this.object) {
this.setZorder();
}
},
};
}
"use strict";
{
C3.Behaviors.SkymenSkin.Exps = {
Skin(){
return this.skinTag;
},
SubSkin(){
return this.subSkinTag;
},
SkinBaseTag(){
return this.skinBaseTag;
},
};
}
"use strict"
self.C3_GetObjectRefTable = function () {
return [
C3.Plugins.SkymenInputManager,
C3.Plugins.Keyboard,
C3.Plugins.Arr,
C3.Plugins.Globals,
C3.Plugins.Mouse,
C3.Plugins.Browser,
C3.Plugins.Audio,
C3.Plugins.MagiCam,
C3.Plugins.skymen_skinsCore,
C3.Plugins.skymen_GlobalRuntime,
C3.Plugins.Sprite,
C3.Behaviors.Platform,
C3.Behaviors.Timer,
C3.Behaviors.LOS,
C3.Plugins.TiledBg,
C3.Behaviors.solid,
C3.Behaviors.Persist,
C3.Behaviors.Bullet,
C3.Behaviors.Fade,
C3.Behaviors.aekiro_gameobject,
C3.Behaviors.jumpthru,
C3.Behaviors.Tween,
C3.Behaviors.Turret,
C3.Plugins.Spritefont2,
C3.Behaviors.skymen_Skymen_SpritefontDX,
C3.Behaviors.Sin,
C3.Plugins.Json,
C3.Behaviors.Pin,
C3.Plugins.Timeline,
C3.Plugins.CV_Process,
C3.Plugins.CV_Tick,
C3.Plugins.CV_Engine,
C3.Plugins.TextBox,
C3.Plugins.Text,
C3.Plugins.NinePatch,
C3.Plugins.Particles,
C3.Behaviors.scrollto,
C3.Behaviors.SkymenSkin,
C3.Plugins.System.Cnds.OnLayoutStart,
C3.Plugins.System.Cnds.IsGroupActive,
C3.Plugins.System.Acts.SetVar,
C3.Plugins.Sprite.Cnds.PickByUID,
C3.Plugins.Sprite.Acts.SetInstanceVar,
C3.Plugins.Sprite.Acts.SetMirrored,
C3.Plugins.Sprite.Cnds.IsBoolInstanceVarSet,
C3.Plugins.Browser.Acts.ConsoleLog,
C3.Plugins.System.Cnds.CompareBetween,
C3.Behaviors.Platform.Exps.GravityAngle,
C3.Plugins.System.Acts.SetFunctionReturnValue,
C3.Plugins.System.Cnds.Else,
C3.Plugins.Sprite.Cnds.CompareInstanceVar,
C3.Plugins.SkymenInputManager.Cnds.IsDown,
C3.Behaviors.LOS.Acts.CastRay,
C3.Plugins.Sprite.Exps.X,
C3.Plugins.Sprite.Exps.Y,
C3.Plugins.Sprite.Exps.Height,
C3.Behaviors.LOS.Cnds.RayIntersected,
C3.Plugins.System.Cnds.Compare,
C3.Behaviors.LOS.Exps.NormalAngle,
C3.Plugins.Sprite.Acts.SetPos,
C3.Plugins.Sprite.Exps.ImagePointX,
C3.Plugins.Sprite.Exps.ImagePointY,
C3.Plugins.Sprite.Acts.SetAngle,
C3.Plugins.System.Exps.anglelerp,
C3.Plugins.Sprite.Exps.Angle,
C3.Plugins.System.Exps.dt,
C3.Plugins.Sprite.Acts.SetPosToObject,
C3.Plugins.System.Cnds.TriggerOnce,
C3.Plugins.System.Exps.time,
C3.Plugins.System.Cnds.PickAll,
C3.Behaviors.Bullet.Acts.SetAngleOfMotion,
C3.Behaviors.Bullet.Acts.SetSpeed,
C3.Behaviors.Bullet.Acts.SetAcceleration,
C3.Behaviors.Fade.Exps.FadeOutTime,
C3.Behaviors.Bullet.Acts.SetEnabled,
C3.Behaviors.Fade.Acts.StartFade,
C3.Behaviors.Platform.Acts.SetEnabled,
C3.Plugins.System.Acts.Wait,
C3.Plugins.System.Acts.RestartLayout,
C3.ScriptsInEvents.Player_Event213,
C3.Plugins.Sprite.Cnds.IsOverlapping,
C3.Plugins.Sprite.Acts.AddInstanceVar,
C3.ScriptsInEvents.Player_Event216,
C3.Plugins.Sprite.Exps.BBoxBottom,
C3.Plugins.Sprite.Exps.BBoxTop,
C3.Behaviors.LOS.Exps.HitDistance,
C3.Plugins.Sprite.Exps.BBoxLeft,
C3.Plugins.Sprite.Exps.BBoxRight,
C3.Plugins.Sprite.Exps.Width,
C3.Plugins.System.Exps.timescale,
C3.Plugins.Globals.Cnds.IsBoolInstanceVarSet,
C3.Plugins.Keyboard.Cnds.OnKeyCode,
C3.Plugins.System.Cnds.IsMobile,
C3.Plugins.Browser.Acts.Vibrate,
C3.Plugins.SkymenInputManager.Acts.SetDown,
C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased,
C3.Plugins.SkymenInputManager.Acts.SetUp,
C3.Plugins.SkymenInputManager.Cnds.OnDown,
C3.Behaviors.Platform.Cnds.IsOnFloor,
C3.Behaviors.Platform.Cnds.IsJumping,
C3.Plugins.Globals.Acts.SetBoolInstanceVar,
C3.Behaviors.Platform.Exps.VectorX,
C3.Plugins.Sprite.Acts.SetBoolInstanceVar,
C3.Plugins.Arr.Cnds.CompareSize,
C3.Behaviors.Platform.Acts.SetDeceleration,
C3.Behaviors.Platform.Acts.SetVectorY,
C3.Behaviors.Platform.Exps.JumpStrength,
C3.Plugins.Sprite.Exps.UID,
C3.Behaviors.Platform.Exps.VectorY,
C3.Behaviors.Platform.Exps.Gravity,
C3.Behaviors.Platform.Cnds.IsByWall,
C3.Plugins.System.Cnds.Repeat,
C3.Plugins.Arr.Acts.Push,
C3.Plugins.Arr.Acts.SetSize,
C3.Plugins.System.Cnds.CompareVar,
C3.Behaviors.Platform.Acts.SimulateControl,
C3.Behaviors.Platform.Exps.MaxSpeed,
C3.Behaviors.Platform.Acts.SetIgnoreInput,
C3.Behaviors.Timer.Cnds.IsTimerRunning,
C3.Behaviors.Timer.Acts.StartTimer,
C3.Behaviors.Platform.Exps.Speed,
C3.Behaviors.Platform.Acts.SetMaxSpeed,
C3.Plugins.System.Cnds.Every,
C3.Plugins.SkymenInputManager.Acts.SimulateDownTrigger,
C3.Plugins.Arr.Exps.At,
C3.Plugins.Arr.Acts.Pop,
C3.Behaviors.Timer.Cnds.OnTimer,
C3.Plugins.Sprite.Acts.SetAnimFrame,
C3.Behaviors.Platform.Acts.SetVectorX,
C3.Plugins.Audio.Acts.Stop,
C3.Behaviors.Timer.Acts.StopTimer,
C3.Behaviors.Platform.Cnds.IsMoving,
C3.Plugins.System.Acts.SetBoolVar,
C3.Plugins.System.Cnds.CompareBoolVar,
C3.Behaviors.Platform.Acts.SetMaxFallSpeed,
C3.Behaviors.jumpthru.Acts.SetEnabled,
C3.Behaviors.solid.Acts.SetEnabled,
C3.Plugins.Sprite.Cnds.CompareFrame,
C3.Plugins.Sprite.Acts.SetY,
C3.Plugins.MagiCam.Acts.ShakeCamera,
C3.Plugins.Sprite.Cnds.IsBetweenAngles,
C3.Plugins.Sprite.Acts.Spawn,
C3.Behaviors.Platform.Cnds.IsFalling,
C3.Plugins.System.Cnds.ForEachOrdered,
C3.Plugins.Sprite.Acts.ZMoveToObject,
C3.Plugins.System.Exps.find,
C3.Plugins.System.Exps.layoutname,
C3.Plugins.MagiCam.Acts.CreateLocalCamera,
C3.Plugins.MagiCam.Acts.FollowObject,
C3.Plugins.MagiCam.Acts.EnableFollowing,
C3.Plugins.MagiCam.Acts.SetFollowLag,
C3.Plugins.System.Acts.Scroll,
C3.Plugins.System.Exps.windowwidth,
C3.Plugins.System.Exps.windowheight,
C3.Plugins.Sprite.Acts.RotateTowardAngle,
C3.Behaviors.Platform.Acts.SetGravityAngle,
C3.Plugins.System.Cnds.PickNth,
C3.Plugins.Sprite.Acts.SetSize,
C3.Plugins.Sprite.Acts.SetOpacity,
C3.Plugins.Sprite.Cnds.OnCreated,
C3.Plugins.Sprite.Acts.Destroy,
C3.Plugins.Arr.Acts.JSONLoad,
C3.Plugins.Arr.Cnds.CompareXY,
C3.Plugins.Browser.Acts.ExecJs,
C3.Plugins.System.Exps.layoutheight,
C3.Plugins.System.Exps.layoutwidth,
C3.Plugins.System.Acts.CreateObject,
C3.Plugins.TiledBg.Acts.SetSize,
C3.Plugins.TiledBg.Acts.SetOpacity,
C3.Plugins.TiledBg.Acts.SetAngle,
C3.Plugins.Globals.Acts.SetInstanceVar,
C3.Plugins.Spritefont2.Cnds.CompareInstanceVar,
C3.Behaviors.skymen_Skymen_SpritefontDX.Acts.SetText,
C3.Plugins.Sprite.Exps.Count,
C3.Plugins.Arr.Acts.SetXY,
C3.Plugins.Arr.Exps.Width,
C3.Plugins.Sprite.Exps.AnimationFrame,
C3.Plugins.System.Cnds.IsPreview,
C3.Plugins.Keyboard.Cnds.OnKey,
C3.Plugins.Arr.Exps.AsJSON,
C3.Plugins.Sprite.Acts.SetVisible,
C3.Plugins.Sprite.Exps.IID,
C3.Plugins.Sprite.Exps.LayerName,
C3.Plugins.NinePatch.Exps.Count,
C3.Plugins.NinePatch.Acts.SetVisible,
C3.Plugins.TiledBg.Acts.SetVisible,
C3.Plugins.skymen_skinsCore.Exps.RandomSkin,
C3.Plugins.System.Cnds.OnLayoutEnd,
C3.Plugins.Globals.Acts.ToggleBoolInstanceVar,
C3.Plugins.Keyboard.Cnds.OnAnyKey,
C3.Plugins.Keyboard.Exps.LastKeyCode,
C3.Plugins.Sprite.Cnds.OnCollision,
C3.Plugins.System.Exps.max,
C3.Behaviors.Bullet.Exps.Gravity,
C3.Plugins.System.Exps.int,
C3.Plugins.System.Exps.tokenat,
C3.Plugins.System.Acts.GoToLayoutByName,
C3.ScriptsInEvents.Gameplay_Event34_Act3,
C3.ScriptsInEvents.Gameplay_Event36_Act3,
C3.Plugins.System.Cnds.ForEach,
C3.ScriptsInEvents.Gameplay_Event38_Act6,
C3.Plugins.Globals.Cnds.CompareInstanceVar,
C3.Plugins.System.Cnds.While,
C3.Plugins.System.Exps.tokencount,
C3.Plugins.System.Exps.lowercase,
C3.Behaviors.Tween.Acts.TweenTwoProperties,
C3.Plugins.System.Exps.left,
C3.Plugins.System.Exps.float,
C3.Plugins.System.Exps.right,
C3.Plugins.System.Exps.len,
C3.Behaviors.Tween.Acts.TweenOneProperty,
C3.Behaviors.Tween.Acts.TweenValue,
C3.Behaviors.Tween.Cnds.IsPlaying,
C3.Behaviors.Tween.Exps.Value,
C3.Plugins.TiledBg.Acts.Destroy,
C3.Behaviors.Turret.Acts.AddTarget,
C3.Behaviors.LOS.Cnds.HasLOSToObject,
C3.Behaviors.Turret.Acts.SetEnabled,
C3.Behaviors.LOS.Acts.AddObstacle,
C3.Behaviors.Turret.Acts.SetPredictiveAim,
C3.Plugins.Sprite.Acts.SetAnim,
C3.Behaviors.Turret.Cnds.OnShoot,
C3.Plugins.Sprite.Acts.SetHeight,
C3.Plugins.Sprite.Acts.SetDefaultColor,
C3.Plugins.System.Cnds.For,
C3.Plugins.System.Exps.loopindex,
C3.Behaviors.LOS.Exps.Range,
C3.Behaviors.LOS.Exps.HitX,
C3.Behaviors.LOS.Exps.HitY,
C3.Plugins.Particles.Acts.SetAngle,
C3.ScriptsInEvents.Gameplay_Event86_Act4,
C3.Behaviors.Bullet.Exps.Speed,
C3.Plugins.Sprite.Acts.SetWidth,
C3.Plugins.System.Cnds.EveryTick,
C3.Plugins.Sprite.Cnds.IsAnimPlaying,
C3.Plugins.Sprite.Acts.RotateTowardPosition,
C3.Plugins.System.Cnds.PickByComparison,
C3.Plugins.Sprite.Cnds.OnDestroyed,
C3.Behaviors.Bullet.Cnds.CompareTravelled,
C3.Plugins.Sprite.Cnds.IsOverlappingOffset,
C3.Plugins.Sprite.Cnds.PickDistance,
C3.Plugins.Sprite.Acts.SetCollisions,
C3.Behaviors.Platform.Exps.MovingAngle,
C3.Behaviors.Bullet.Exps.AngleOfMotion,
C3.Behaviors.Platform.Acts.SetGravity,
C3.Plugins.System.Cnds.PickOverlappingPoint,
C3.Plugins.TiledBg.Exps.ZIndex,
C3.Plugins.TiledBg.Cnds.IsBoolInstanceVarSet,
C3.Plugins.TiledBg.Exps.Angle,
C3.Plugins.NinePatch.Acts.SetPos,
C3.Plugins.NinePatch.Acts.SetSize,
C3.Plugins.NinePatch.Acts.SetAngle,
C3.Plugins.NinePatch.Acts.SetOpacity,
C3.Plugins.NinePatch.Exps.Width,
C3.Behaviors.Pin.Acts.Pin,
C3.Plugins.Spritefont2.Acts.SetSize
];
};
self.C3_JsPropNameTable = [
{InputManager: 0},
{Keyboard: 0},
{InputBuffer: 0},
{LeftInput: 0},
{UpInput: 0},
{RightInput: 0},
{DownInput: 0},
{Listening: 0},
{Next: 0},
{Inputs: 0},
{Mouse: 0},
{Browser: 0},
{Audio: 0},
{Down: 0},
{PerLevel: 0},
{StartTime: 0},
{ScoreBase: 0},
{StartOfGame: 0},
{BlowSave: 0},
{Skin: 0},
{NbLevels: 0},
{DebugMode: 0},
{RandomSkin: 0},
{TestMode: 0},
{LastLayout: 0},
{Record: 0},
{EasyMode: 0},
{Globals: 0},
{MagiCam: 0},
{RecordedPlayer: 0},
{SkinGroup: 0},
{GlobalRuntime: 0},
{State: 0},
{Walljump: 0},
{HasSmallWalljumped: 0},
{Side: 0},
{CanSlide: 0},
{Sliding: 0},
{SlideTime: 0},
{SlideRefresh: 0},
{Plunge: 0},
{Pound: 0},
{CanPoundLongJump: 0},
{PoundLongJump: 0},
{Stun: 0},
{LongJump: 0},
{WallRun: 0},
{CanWallRun: 0},
{WallRunTime: 0},
{Falling: 0},
{HitBuffer: 0},
{HitBufferCount: 0},
{Slipping: 0},
{Ghost: 0},
{GhostData: 0},
{ColBuffer: 0},
{ColBufferCount: 0},
{NormalAngle: 0},
{MaxSpeed: 0},
{TopCrushSize: 0},
{RightCrushSize: 0},
{LeftCrushSize: 0},
{BottomCrushSize: 0},
{wavebounce: 0},
{Platform: 0},
{Timer: 0},
{LineOfSight: 0},
{Collider: 0},
{Solid: 0},
{ID: 0},
{active: 0},
{PersistAfterDeath: 0},
{InitX: 0},
{InitY: 0},
{InitAngle: 0},
{Repeatable: 0},
{OnActivate: 0},
{Persist: 0},
{ButtonTrigger: 0},
{CoinID: 0},
{Bullet: 0},
{Fade: 0},
{Coin: 0},
{NextLevel: 0},
{EndFlag: 0},
{GroundPoundSolid: 0},
{Force: 0},
{Decel: 0},
{GameObject: 0},
{JumpBoost: 0},
{Jumpthru: 0},
{JumpThrough: 0},
{AutoStart: 0},
{Movement: 0},
{curMovement: 0},
{waiting: 0},
{Tween: 0},
{MoveArea: 0},
{Target: 0},
{ForceAngle: 0},
{ForcedAngle: 0},
{ForceSpeed: 0},
{ForcedSpeed: 0},
{Portal: 0},
{destroyOnTouch: 0},
{Parent: 0},
{Smart: 0},
{PortalUID: 0},
{Rocket: 0},
{Laser: 0},
{AlternateAiming: 0},
{RocketSpeed: 0},
{Range: 0},
{RateOfFire: 0},
{RotateSpeed: 0},
{CanShoot: 0},
{MultiBullets: 0},
{Turret: 0},
{RocketLauncher: 0},
{Solid2: 0},
{Solid3: 0},
{SolidMove: 0},
{hardOnly: 0},
{Spike: 0},
{Spike2: 0},
{Tiledbackground: 0},
{Name: 0},
{needSlope: 0},
{LayoutNameHolder: 0},
{id: 0},
{SpritefontDeluxe: 0},
{TimerTick: 0},
{Zordering: 0},
{OX: 0},
{OY: 0},
{an: 0},
{dist: 0},
{Body: 0},
{Head: 0},
{LeftArm: 0},
{LeftFoot: 0},
{LeftHand: 0},
{LeftLeg: 0},
{RightArm: 0},
{RightFoot: 0},
{RightHand: 0},
{RightLeg: 0},
{Sine: 0},
{Sine2: 0},
{OvO2Logo: 0},
{UIText: 0},
{Border: 0},
{CurrentLevel: 0},
{CurrentCourse: 0},
{Hover: 0},
{HoverAnim: 0},
{Pressed: 0},
{PressAnim: 0},
{ReleaseAnim: 0},
{Text: 0},
{UIButton: 0},
{Pin: 0},
{UIButtonOutline: 0},
{Timeline: 0},
{UIBackground: 0},
{UIBackgroundGradient: 0},
{menu: 0},
{MenuCamera: 0},
{Process: 0},
{Tick: 0},
{Engine: 0},
{debugSprite: 0},
{TextInput: 0},
{Sprite: 0},
{Sprite2: 0},
{tuyautop: 0},
{RealJumpThrough: 0},
{DestructibleFloor: 0},
{parent: 0},
{Sprite3: 0},
{Sprite4: 0},
{Sprite5: 0},
{Sprite6: 0},
{Sprite7: 0},
{Vector: 0},
{Sprite8: 0},
{OverwriteAngle: 0},
{OverWriteGravity: 0},
{ForcedGravity: 0},
{GravityZone: 0},
{tarx: 0},
{tary: 0},
{Particles_LaserWarmup: 0},
{Particles_LaserActive: 0},
{Particles_LaserHit: 0},
{ScrollTo: 0},
{PlayerRig: 0},
{Enemies: 0},
{Solids: 0},
{UIElements: 0},
{GameObjects: 0},
{CrushSolids: 0},
{VibratePtrn: 0},
{Inverted: 0},
{UID: 0},
{Parameter0: 0},
{targetX: 0},
{Reload: 0},
{oldTopCrush: 0},
{oldBotCrush: 0},
{oldRightCrush: 0},
{oldLeftCrush: 0},
{Length: 0},
{Input: 0},
{Parameter1: 0},
{check: 0},
{vecX: 0},
{vecY: 0},
{HasMoved: 0},
{lastX: 0},
{lastY: 0},
{lastA: 0},
{GhostOpacity: 0},
{levelWidth: 0},
{levelHeight: 0},
{BORDERWIDTH: 0},
{BORDEROPA: 0},
{Value: 0},
{UnlockAchievement: 0},
{currentMovement: 0},
{currentCommand: 0},
{temp: 0},
{temp2: 0},
{mustwait: 0},
{Intervalle: 0},
{JustCollided: 0},
{speed: 0},
{newAngle: 0},
{BaseGravity: 0},
{gravityAngle: 0},
{gravityOverwritten: 0},
{startAngle: 0},
{vx: 0},
{vy: 0}
];
"use strict";
{
function unaryminus(n)
{
return (typeof n === "number" ? -n : n);
}
function bothNumbers(a, b)
{
return typeof a === "number" && typeof b === "number";
}
function add(l, r)
{
if (bothNumbers(l, r))
return l + r;
else
return l;
}
function subtract(l, r)
{
if (bothNumbers(l, r))
return l - r;
else
return l;
}
function multiply(l, r)
{
if (bothNumbers(l, r))
return l * r;
else
return l;
}
function divide(l, r)
{
if (bothNumbers(l, r))
return l / r;
else
return l;
}
function mod(l, r)
{
if (bothNumbers(l, r))
return l % r;
else
return l;
}
function pow(l, r)
{
if (bothNumbers(l, r))
return Math.pow(l, r);
else
return l;
}
function and(l, r)
{
if (typeof l === "string" || typeof r === "string")
{
// & with either side string does string concatenation
let lstr, rstr;
if (typeof l === "number")
lstr = (Math.round(l * 1e10) / 1e10).toString();
else
lstr = l;
if (typeof r === "number")
rstr = (Math.round(r * 1e10) / 1e10).toString();
else
rstr = r;
return lstr + rstr;
}
else
{
// & with neither side a string does logical AND
return (l && r ? 1 : 0);
}
}
function or(l, r)
{
if (bothNumbers(l, r))
return (l || r ? 1 : 0);
else
return l;
}
self.C3_ExpressionFuncs = [
() => "Player",
() => "Player > API",
p => {
const v0 = p._GetNode(0).GetVar();
return () => v0.GetValue();
},
() => -1,
() => 1,
() => "Update Controls",
() => 0,
p => {
const n0 = p._GetNode(0);
return () => n0.ExpBehavior();
},
() => 181,
() => 359,
() => -20,
() => 20,
() => 340,
() => 380,
() => 160,
() => 200,
() => "Right",
() => "Left",
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject();
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() + (n1.ExpObject() / 4));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
return () => f0(n1.ExpBehavior());
},
() => "Player > Animations",
() => "idle",
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(2);
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), n2.ExpObject(), ((0.2 * f3()) * 60));
},
() => "Head",
() => "LeftA",
() => "RightA",
() => "LeftL",
() => "RightL",
() => "wavebounce",
p => {
const n0 = p._GetNode(0);
return () => n0.ExpInstVar();
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => C3.lerp(n0.ExpObject(), ((360 - n1.ExpInstVar()) % 360), ((0.1 * f2()) * 60));
},
() => "wall",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((n2.ExpInstVar() * 280) + n3.ExpObject()), ((0.1 * f4()) * 60));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() - (n1.ExpInstVar() * 20));
},
() => "wallback",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((n2.ExpInstVar() * 60) + n3.ExpObject()), ((0.1 * f4()) * 60));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() - (n1.ExpInstVar() * 30));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (((-n2.ExpInstVar()) * 30) + n3.ExpObject()), ((0.1 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 30)), ((0.2 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 60)), ((0.2 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * 10)), ((0.2 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 10)), ((0.2 * f4()) * 60));
},
() => "run",
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
const n2 = p._GetNode(2);
return () => ((n0.ExpInstVar() * (15 + (5 * Math.sin(C3.toRadians(((f1() * 60) * 15)))))) + n2.ExpObject());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => (n0.ExpObject() + (n1.ExpInstVar() * (10 * Math.cos(C3.toRadians(((f2() * 60) * 20))))));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
const n4 = p._GetNode(4);
return () => (((((n0.ExpInstVar()) === ("ada") ? 1 : 0)) ? ((n1.ExpInstVar() * 120)) : (((n2.ExpInstVar() * 45) - (45 * Math.cos(C3.toRadians(((f3() * 60) * 10))))))) + n4.ExpObject());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => ((((n0.ExpInstVar()) === ("ada") ? 1 : 0)) ? (n1.ExpObject()) : (((n2.ExpObject() - (n3.ExpInstVar() * 90)) - (45 * Math.cos(C3.toRadians(((f4() * 60) * 10)))))));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
const n3 = p._GetNode(3);
return () => (((((n0.ExpInstVar()) === ("ada") ? 1 : 0)) ? ((n1.ExpInstVar() * 120)) : (((-45) * Math.cos(C3.toRadians((180 + ((f2() * 60) * 10))))))) + n3.ExpObject());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => ((((n0.ExpInstVar()) === ("ada") ? 1 : 0)) ? (n1.ExpObject()) : (((n2.ExpObject() - (n3.ExpInstVar() * 90)) - (45 * Math.cos(C3.toRadians((180 + ((f4() * 60) * 10))))))));
},
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
const n2 = p._GetNode(2);
return () => (((n0.ExpInstVar() * 90) * Math.cos(C3.toRadians(((f1() * 60) * 10)))) + n2.ExpObject());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => (n0.ExpObject() + (n1.ExpInstVar() * (90 + (90 * Math.sin(C3.toRadians(((f2() * 60) * 10)))))));
},
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
const n2 = p._GetNode(2);
return () => (((n0.ExpInstVar() * 90) * Math.cos(C3.toRadians((180 + ((f1() * 60) * 10))))) + n2.ExpObject());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => (n0.ExpObject() + (n1.ExpInstVar() * (90 + (90 * Math.sin(C3.toRadians((180 + ((f2() * 60) * 10))))))));
},
() => "jump",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (((-n2.ExpInstVar()) * 10) + n3.ExpObject()), ((0.05 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * 20)), ((0.05 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 5)), ((0.1 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 280)), ((0.1 * f4()) * 60));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() + (n1.ExpInstVar() * 30));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() + (n1.ExpInstVar() * 20));
},
() => "poundFloor",
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => C3.lerp(n0.ExpObject(), n1.ExpObject(2), ((0.1 * f2()) * 60));
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpObject(2) + 8);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() + (120 * n1.ExpInstVar()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() - (120 * n1.ExpInstVar()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() - (90 * n1.ExpInstVar()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() + (90 * n1.ExpInstVar()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), n2.ExpObject(), ((0.1 * f3()) * 60));
},
() => "gpjump",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (30 * n3.ExpInstVar())), ((0.2 * f4()) * 60));
},
() => "fall",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((n2.ExpInstVar() * 10) + n3.ExpObject()), ((0.05 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 20)), ((0.05 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 300)), ((0.05 * f4()) * 60));
},
() => "wallslide",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), ((-n2.ExpInstVar()) * 40), ((0.05 * f3()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpInstVar() * 300), ((0.05 * f3()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpInstVar() * 280), ((0.1 * f3()) * 60));
},
() => "wallslideback",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((n2.ExpInstVar() * 10) + n3.ExpObject()), ((0.1 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), ((-n2.ExpInstVar()) * 5), ((0.1 * f3()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * 30)), ((0.1 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpInstVar() * 90), ((0.1 * f3()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * 40)), ((0.1 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpInstVar() * 300), ((0.1 * f3()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 160)), ((0.1 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpInstVar() * 350), ((0.1 * f3()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 90)), ((0.1 * f4()) * 60));
},
() => "wallrun",
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
return () => ((n0.ExpInstVar() * 300) + (Math.sin(C3.toRadians(((f1() * 60) * 15))) * 45));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => ((n0.ExpObject() - (n1.ExpInstVar() * 20)) + (Math.cos(C3.toRadians(((f2() * 60) * 15))) * 20));
},
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
return () => ((n0.ExpInstVar() * 280) + (Math.cos(C3.toRadians(((f1() * 60) * 15))) * 45));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => ((n0.ExpObject() - (n1.ExpInstVar() * 20)) + (Math.sin(C3.toRadians(((f2() * 60) * 15))) * 20));
},
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
return () => ((n0.ExpInstVar() * 300) + (Math.cos(C3.toRadians(((f1() * 60) * 15))) * 45));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => ((n0.ExpObject() + (n1.ExpInstVar() * 30)) + (Math.sin(C3.toRadians(((f2() * 60) * 5))) * 15));
},
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
return () => ((n0.ExpInstVar() * 280) + (Math.sin(C3.toRadians(((f1() * 60) * 15))) * 45));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => ((n0.ExpObject() + (n1.ExpInstVar() * 20)) + (Math.cos(C3.toRadians(((f2() * 60) * 5))) * 15));
},
() => "wallrunlongjump",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (((-n2.ExpInstVar()) * 20) + n3.ExpObject()), ((0.2 * 60) * f4()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), ((-n2.ExpInstVar()) * 40), ((0.2 * 60) * f3()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpInstVar() * 90), ((0.2 * 60) * f3()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * 10)), ((0.2 * 60) * f4()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpInstVar() * 80), ((0.2 * 60) * f3()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 20)), ((0.2 * 60) * f4()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (((-n2.ExpInstVar()) * 120) + n3.ExpObject()), ((0.2 * 60) * f4()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 60)), ((0.2 * 60) * f4()));
},
() => "slide",
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => C3.lerp(n0.ExpObject(), n1.ExpObject(2), 0.5);
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((n2.ExpInstVar() * (-80)) + n3.ExpObject()), ((0.5 * f4()) * 60));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => (n0.ExpObject() + (n1.ExpInstVar() * ((5 * Math.cos(C3.toRadians(((f2() * 60) * 10)))) + 45)));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((n2.ExpObject() - (n3.ExpInstVar() * 10)) - 20), ((0.5 * f4()) * 60));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() - (n1.ExpInstVar() * 40));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * 10)), ((0.5 * f4()) * 60));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((n0.ExpObject() - (n1.ExpInstVar() * 40)) + 10);
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * (-20))), ((0.5 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpObject(), n2.ExpObject(), ((0.5 * f3()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * (-45))), ((0.5 * f4()) * 60));
},
() => "plunge",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
const n5 = p._GetNode(5);
return () => (f0((n1.ExpObject() - n2.ExpObject()), (n3.ExpInstVar() * 120), ((0.05 * f4()) * 60)) + n5.ExpObject());
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * ((5 * Math.cos(C3.toRadians(((f4() * 60) * 10)))) + 50))), 0.3);
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((-n2.ExpObject()) - (n3.ExpInstVar() * 10)), ((0.5 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 30)), ((0.5 * f4()) * 60));
},
() => "slip",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((n2.ExpInstVar() * 120) + n3.ExpObject()), ((0.05 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (((-90) + n2.ExpObject()) + (n3.ExpInstVar() * 120)), ((0.1 * f4()) * 60));
},
() => "pound",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpInstVar() * (150 + n3.ExpObject())), ((0.2 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((-n2.ExpInstVar()) * (150 + n3.ExpObject())), ((0.2 * f4()) * 60));
},
() => "stun",
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
return () => C3.lerp(n0.ExpObject(), (n1.ExpObject() - (Math.sin(C3.toRadians(n2.ExpObject())) * (((n3.ExpObject() / 2) - (n4.ExpObject() / 2)) - 2))), 0.5);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
return () => C3.lerp(n0.ExpObject(), (n1.ExpObject() + (Math.cos(C3.toRadians(n2.ExpObject())) * (((n3.ExpObject() / 2) - (n4.ExpObject() / 2)) - 2))), 0.5);
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), ((n2.ExpInstVar() * 40) + n3.ExpObject()), ((0.1 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => (f0(n1.ExpObject(), n2.ExpObject(), 0.5) + (Math.sin(C3.toRadians(((f3() * 60) * 30))) * 5));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * 25)), ((0.1 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 45)), ((0.2 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() + (n3.ExpInstVar() * 90)), ((0.2 * f4()) * 60));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(n1.ExpObject(), (n2.ExpObject() - (n3.ExpInstVar() * 45)), ((0.5 * f4()) * 60));
},
() => "Player > Death",
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
return () => C3.toDegrees(C3.angleTo(n0.ExpInstVar_Family(), n1.ExpInstVar_Family(), n2.ExpObject(), n3.ExpObject()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
return () => C3.distanceTo(n0.ExpInstVar_Family(), n1.ExpInstVar_Family(), n2.ExpObject(), n3.ExpObject());
},
() => "dead",
p => {
const n0 = p._GetNode(0);
return () => n0.ExpInstVar_Family();
},
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
return () => (n0.ExpInstVar_Family() / f1());
},
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
const n2 = p._GetNode(2);
return () => ((((-n0.ExpInstVar_Family()) / f1()) / n2.ExpBehavior()) / 2);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() - (n1.ExpObject() / 4));
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpObject() - 1);
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpObject() + 1);
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpInstVar() - 1);
},
p => {
const n0 = p._GetNode(0);
return () => (5 * (n0.ExpObject() / 6));
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpObject() / 2);
},
() => "Player > Controls",
() => "Player > Controls > Inputs",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
return () => f0();
},
() => "Jump",
() => 10,
() => 5,
() => "Down",
() => 0.05,
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => ((n0.ExpObject() + n1.ExpObject()) + (n2.ExpBehavior() * f3()));
},
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpBehavior()) * 0.8);
},
() => 0.15,
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
const n5 = p._GetNode(5);
return () => f0(((n1.ExpObject() + n2.ExpObject()) + (n3.ExpBehavior() * f4())), n5.ExpObject());
},
() => 0.4,
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const f3 = p._GetNode(3).GetBoundMethod();
return () => ((n0.ExpObject() + (n1.ExpObject() * 1.35)) + (n2.ExpBehavior() * f3()));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
const n5 = p._GetNode(5);
return () => f0(((n1.ExpObject() + (n2.ExpObject() * 1.35)) + (n3.ExpBehavior() * f4())), n5.ExpObject());
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpBehavior() / 10);
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
return () => f0(n1.ExpObject());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((((n0.ExpInstVar()) >= (0.1) ? 1 : 0)) ? ((n1.ExpInstVar() / 2)) : (0));
},
p => {
const v0 = p._GetNode(0).GetVar();
const v1 = p._GetNode(1).GetVar();
const v2 = p._GetNode(2).GetVar();
return () => ((((v0.GetValue()) === (0) ? 1 : 0)) ? (v1.GetValue()) : (v2.GetValue()));
},
() => "Player > Controls > Special Movements",
() => 660,
() => "perfectJump",
() => 0.013333333333333334,
() => 3000,
() => 0.03,
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(0);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((n0.ExpBehavior() * 0.8) * n1.ExpInstVar());
},
() => 1320,
() => "slideEnd",
() => 0.1,
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((n0.ExpBehavior() * 0.7) * n1.ExpInstVar());
},
() => 2000,
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpBehavior()) * 0.7);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((n0.ExpBehavior() * 2) * n1.ExpInstVar());
},
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpBehavior()) * 0.65);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpInstVar() * n1.ExpBehavior());
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpInstVar() / 2);
},
p => {
const n0 = p._GetNode(0);
return () => (-n0.ExpBehavior());
},
() => 0.02,
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpBehavior() * 2);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() + Math.abs(n1.ExpObject()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject() - Math.abs(n1.ExpObject()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => (n0.ExpObject() + ((n1.ExpObject() * 2) - n2.ExpBehavior()));
},
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpBehavior()) * 1.1);
},
() => 30,
() => 0.2,
() => "poundGoDown",
() => "canStillCancel",
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpBehavior()) / 5);
},
() => 0.3,
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpBehavior() / 3);
},
p => {
const v0 = p._GetNode(0).GetVar();
return () => Math.abs(v0.GetValue());
},
p => {
const v0 = p._GetNode(0).GetVar();
return () => (v0.GetValue() * 0.7);
},
p => {
const v0 = p._GetNode(0).GetVar();
return () => (Math.abs(v0.GetValue()) * 0.7);
},
p => {
const v0 = p._GetNode(0).GetVar();
return () => ((-Math.abs(v0.GetValue())) * 0.7);
},
() => 45,
() => 315,
() => 360,
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((-n0.ExpBehavior()) * n1.ExpInstVar());
},
() => 1400,
() => 1000,
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpInstVar()) * 100);
},
p => {
const n0 = p._GetNode(0);
return () => C3.clamp((n0.ExpBehavior() * (-0.6)), (-660), 660);
},
() => 50,
() => 0.25,
() => 0.5,
() => "bottom",
() => "Player > WallSlide/Jump",
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpBehavior() / 1.5);
},
() => "walljump",
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpBehavior()) * 0.6);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((n0.ExpInstVar() * 3) * (n1.ExpBehavior() / 4));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((-n0.ExpInstVar()) * n1.ExpBehavior());
},
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpBehavior()) * 1.2);
},
() => "Walljump",
p => {
const n0 = p._GetNode(0);
return () => ((-n0.ExpBehavior()) * 0.75);
},
() => "Walljump Off",
() => "Player > Initialisation",
() => "reordered",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
return () => f0(f1(), "Level");
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
return () => (f0() / 2);
},
() => "Player > Mirroring",
() => "Player > States",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
return () => f0((n1.ExpObject() - (3 * (n2.ExpObject() / 5))), n3.ExpObject());
},
() => "Player > Slopes",
() => 270,
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject("leftRay");
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject("bottomLeftRay") + (n1.ExpObject() / 6));
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject("bottomLeftRay");
},
() => 220,
() => 320,
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject("rightRay");
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject("bottomRightRay") + (n1.ExpObject() / 6));
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject("bottomRightRay");
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
return () => ((and(((n0.ExpBehavior()) >= (220) ? 1 : 0), ((n1.ExpBehavior()) <= (320) ? 1 : 0))) ? ((n2.ExpBehavior() + n3.ExpInstVar())) : ((270 * 2)));
},
p => {
const n0 = p._GetNode(0);
return () => (270 + n0.ExpInstVar());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpObject("Bottom") + (n1.ExpObject() / 6));
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject("Bottom");
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
return () => (((and(((n0.ExpBehavior()) >= (220) ? 1 : 0), ((n1.ExpBehavior()) <= (320) ? 1 : 0))) ? ((n2.ExpBehavior() + n3.ExpInstVar())) : ((270 * 3))) / 3);
},
p => {
const n0 = p._GetNode(0);
return () => (((270 * 2) + n0.ExpInstVar()) / 4);
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpInstVar() + 90);
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpInstVar() + 180);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
return () => C3.distanceTo(n0.ExpObject(), n1.ExpObject(), (n2.ExpObject("bottomLeftRay") + (n3.ExpObject() / 6)), n4.ExpObject("bottomLeftRay"));
},
() => 2,
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
return () => C3.toDegrees(C3.angleTo(n0.ExpObject(), n1.ExpObject(), (n2.ExpObject("bottomLeftRay") + (n3.ExpObject() / 6)), n4.ExpObject("bottomLeftRay")));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
return () => C3.distanceTo(n0.ExpObject(), n1.ExpObject(), (n2.ExpObject("bottomRightRay") + (n3.ExpObject() / 6)), n4.ExpObject("bottomRightRay"));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
return () => C3.toDegrees(C3.angleTo(n0.ExpObject(), n1.ExpObject(), (n2.ExpObject("bottomRightRay") + (n3.ExpObject() / 6)), n4.ExpObject("bottomRightRay")));
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject("BodyPos");
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
return () => C3.distanceTo(n0.ExpObject(), n1.ExpObject(), (n2.ExpObject("Bottom") + (n3.ExpObject() / 6)), n4.ExpObject("Bottom"));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
return () => C3.toDegrees(C3.angleTo(n0.ExpObject(), n1.ExpObject(), (n2.ExpObject("Bottom") + (n3.ExpObject() / 6)), n4.ExpObject("Bottom")));
},
() => "",
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(0, 0);
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(0, 1);
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(0, 2);
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(0, 3);
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(0, 4);
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(0, 5);
},
() => "globalThis.sdk_runtime = this._runtime",
() => "Layer 0",
() => 84,
() => 100,
() => -90,
() => 180,
() => 90,
() => "Level 1-1",
() => "Level dlc",
() => "Level dlc2",
() => "time",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
return () => (((("Your time is: " + "\n") + "[sfdx=offsety 8*sin(t * 360 + i * 90)]") + ((Math.round(((f0() - n1.ExpInstVar()) * 100)) / 100)).toString()) + " seconds[/sfdx]");
},
() => "Debug",
() => 6,
() => 3,
() => 4,
p => {
const n0 = p._GetNode(0);
return () => (3 - n0.ExpObject());
},
() => "Inputs",
() => "Inputs > Listen",
() => "Inputs > API",
() => "Enemies",
() => "Enemies > Spikes",
() => "Jump Boost",
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => ((n0.ExpBehavior() * n1.ExpInstVar()) * Math.sin(C3.toRadians((n2.ExpObject() + 270))));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
return () => f0(((n1.ExpBehavior() * n2.ExpInstVar()) * Math.cos(C3.toRadians((n3.ExpObject() + 270)))), 660);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
return () => (((n0.ExpBehavior() * n1.ExpInstVar()) * Math.cos(C3.toRadians((n2.ExpObject() + 270)))) + n3.ExpBehavior());
},
p => {
const n0 = p._GetNode(0);
return () => (270 + n0.ExpObject());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => (n0.ExpBehavior() * n1.ExpInstVar());
},
() => "TP",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
const f2 = p._GetNode(2).GetBoundMethod();
return () => f0(f1(f2(), 1, " "));
},
() => 8,
() => 24,
() => 32,
() => 40,
() => "Buttons",
p => {
const n0 = p._GetNode(0);
return () => (1 - n0.ExpInstVar());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => ((((n0.ExpInstVar()) === ((-1)) ? 1 : 0)) ? (n1.ExpObject()) : (n2.ExpInstVar()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => ((((n0.ExpInstVar()) === (999) ? 1 : 0)) ? (n1.ExpObject()) : (n2.ExpInstVar()));
},
() => "MovingArea",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
return () => f0(n1.ExpInstVar(), "\n");
},
() => "wait",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => f0(n1.ExpInstVar(), n2.ExpInstVar(), "\n");
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
const v2 = p._GetNode(2).GetVar();
return () => f0(f1(v2.GetValue(), 0, " "));
},
() => "move",
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => and(((n0.ExpObject()).toString() + "-"), n1.ExpInstVar());
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
const v2 = p._GetNode(2).GetVar();
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
const f5 = p._GetNode(5).GetBoundMethod();
const f6 = p._GetNode(6).GetBoundMethod();
const v7 = p._GetNode(7).GetVar();
const f8 = p._GetNode(8).GetBoundMethod();
const f9 = p._GetNode(9).GetBoundMethod();
const v10 = p._GetNode(10).GetVar();
const f11 = p._GetNode(11).GetBoundMethod();
const f12 = p._GetNode(12).GetBoundMethod();
const v13 = p._GetNode(13).GetVar();
return () => ((((f0(f1(v2.GetValue(), 1, " "), 1)) === ("~") ? 1 : 0)) ? ((n3.ExpObject() + f4(f5(f6(v7.GetValue(), 1, " "), (f8(f9(v10.GetValue(), 1, " ")) - 1))))) : (f11(f12(v13.GetValue(), 1, " "))));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
const v2 = p._GetNode(2).GetVar();
const n3 = p._GetNode(3);
const f4 = p._GetNode(4).GetBoundMethod();
const f5 = p._GetNode(5).GetBoundMethod();
const f6 = p._GetNode(6).GetBoundMethod();
const v7 = p._GetNode(7).GetVar();
const f8 = p._GetNode(8).GetBoundMethod();
const f9 = p._GetNode(9).GetBoundMethod();
const v10 = p._GetNode(10).GetVar();
const f11 = p._GetNode(11).GetBoundMethod();
const f12 = p._GetNode(12).GetBoundMethod();
const v13 = p._GetNode(13).GetVar();
return () => ((((f0(f1(v2.GetValue(), 2, " "), 1)) === ("~") ? 1 : 0)) ? ((n3.ExpObject() + f4(f5(f6(v7.GetValue(), 2, " "), (f8(f9(v10.GetValue(), 2, " ")) - 1))))) : (f11(f12(v13.GetValue(), 2, " "))));
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
const f2 = p._GetNode(2).GetBoundMethod();
const v3 = p._GetNode(3).GetVar();
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(f1(f2(v3.GetValue(), 3, " ")), f4());
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const v1 = p._GetNode(1).GetVar();
const f2 = p._GetNode(2).GetBoundMethod();
const f3 = p._GetNode(3).GetBoundMethod();
const v4 = p._GetNode(4).GetVar();
const f5 = p._GetNode(5).GetBoundMethod();
const f6 = p._GetNode(6).GetBoundMethod();
const f7 = p._GetNode(7).GetBoundMethod();
const v8 = p._GetNode(8).GetVar();
const f9 = p._GetNode(9).GetBoundMethod();
return () => ((or(((f0(v1.GetValue(), " ")) <= (4) ? 1 : 0), f2(f3(v4.GetValue(), 4, " ")))) ? (f5(f6(f7(v8.GetValue(), 3, " ")), f9())) : (0));
},
() => "movex",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
const f2 = p._GetNode(2).GetBoundMethod();
const v3 = p._GetNode(3).GetVar();
const f4 = p._GetNode(4).GetBoundMethod();
return () => f0(f1(f2(v3.GetValue(), 2, " ")), f4());
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const v1 = p._GetNode(1).GetVar();
const f2 = p._GetNode(2).GetBoundMethod();
const f3 = p._GetNode(3).GetBoundMethod();
const v4 = p._GetNode(4).GetVar();
const f5 = p._GetNode(5).GetBoundMethod();
const f6 = p._GetNode(6).GetBoundMethod();
const f7 = p._GetNode(7).GetBoundMethod();
const v8 = p._GetNode(8).GetVar();
const f9 = p._GetNode(9).GetBoundMethod();
return () => ((or(((f0(v1.GetValue(), " ")) <= (3) ? 1 : 0), f2(f3(v4.GetValue(), 3, " ")))) ? (f5(f6(f7(v8.GetValue(), 2, " ")), f9())) : (0));
},
() => "movey",
() => "angle",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
const v2 = p._GetNode(2).GetVar();
return () => f0(f1(v2.GetValue(), 1, " "));
},
() => "goto",
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const f1 = p._GetNode(1).GetBoundMethod();
const v2 = p._GetNode(2).GetVar();
return () => (f0(f1(v2.GetValue(), 1, " ")) - 1);
},
p => {
const n0 = p._GetNode(0);
return () => n0.ExpBehavior("angle");
},
() => "GroudPoundSolid",
() => "RocketLauncher",
() => "PredictiveLaser",
() => "PredictiveDefault",
() => "Laser",
() => "Default",
() => "Aiming",
() => -281474976711679,
() => 0.7,
() => "Locked",
() => "particles",
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpObject() / 30);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
const f5 = p._GetNode(5).GetBoundMethod();
return () => C3.lerp(n0.ExpObject(), (n1.ExpObject() + (n2.ExpObject() * Math.cos(C3.toRadians(n3.ExpObject())))), C3.unlerp(0, (n4.ExpObject() / 30), f5()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const n3 = p._GetNode(3);
const n4 = p._GetNode(4);
const f5 = p._GetNode(5).GetBoundMethod();
return () => C3.lerp(n0.ExpObject(), (n1.ExpObject() + (n2.ExpObject() * Math.sin(C3.toRadians(n3.ExpObject())))), C3.unlerp(0, (n4.ExpObject() / 30), f5()));
},
() => "Shooting",
() => -281483567170559,
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject(1);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => (n0.ExpObject(1) + (Math.cos(C3.toRadians(n1.ExpObject())) * n2.ExpBehavior()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => (n0.ExpObject(1) + (Math.sin(C3.toRadians(n1.ExpObject())) * n2.ExpBehavior()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
return () => ((n0.ExpInstVar()) ? ("MultiBullet") : (((n1.ExpInstVar()) ? ("Smart") : ("Default"))));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => ((((n0.ExpInstVar()) !== ((-1)) ? 1 : 0)) ? (n1.ExpInstVar()) : (n2.ExpBehavior()));
},
() => "Rocket",
() => "MultiBullet",
() => "Coin",
() => "Portal",
p => {
const n0 = p._GetNode(0);
const f1 = p._GetNode(1).GetBoundMethod();
return () => (n0.ExpBehavior() * f1());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => ((n0.ExpInstVar()) ? (0) : ((n1.ExpBehavior() * f2())));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => ((n0.ExpInstVar()) ? (n1.ExpInstVar()) : (n2.ExpBehavior()));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const v3 = p._GetNode(3).GetVar();
const n4 = p._GetNode(4);
return () => ((n0.ExpInstVar()) ? (n1.ExpInstVar()) : ((((n2.ExpBehavior() + v3.GetValue()) + n4.ExpObject()) + 180)));
},
p => {
const v0 = p._GetNode(0).GetVar();
const v1 = p._GetNode(1).GetVar();
return () => (Math.cos(C3.toRadians(v0.GetValue())) * v1.GetValue());
},
p => {
const v0 = p._GetNode(0).GetVar();
const v1 = p._GetNode(1).GetVar();
return () => (Math.sin(C3.toRadians(v0.GetValue())) * v1.GetValue());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => ((Math.cos(C3.toRadians(n0.ExpBehavior())) * n1.ExpBehavior()) * f2());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => ((Math.sin(C3.toRadians(n0.ExpBehavior())) * n1.ExpBehavior()) * f2());
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
const v3 = p._GetNode(3).GetVar();
const n4 = p._GetNode(4);
return () => ((n0.ExpInstVar()) ? (n1.ExpInstVar()) : (((((-n2.ExpBehavior()) + v3.GetValue()) + n4.ExpObject()) + 180)));
},
() => "GravityZone",
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpObject() + 90);
},
p => {
const n0 = p._GetNode(0);
return () => (n0.ExpBehavior() - 90);
},
p => {
const f0 = p._GetNode(0).GetBoundMethod();
const n1 = p._GetNode(1);
const v2 = p._GetNode(2).GetVar();
const f3 = p._GetNode(3).GetBoundMethod();
return () => f0(n1.ExpBehavior(), v2.GetValue(), ((0.2 * f3()) * 60));
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const f2 = p._GetNode(2).GetBoundMethod();
return () => ((C3.distanceTo(0, 0, n0.ExpBehavior(), n1.ExpBehavior()) * f2()) * 5);
},
p => {
const n0 = p._GetNode(0);
const n1 = p._GetNode(1);
const n2 = p._GetNode(2);
return () => (C3.toDegrees(C3.angleTo(0, 0, n0.ExpBehavior(), n1.ExpBehavior())) + n2.ExpObject());
},
p => {
const n0 = p._GetNode(0);
return () => C3.lerp(0, 100, C3.unlerp(0, 20, n0.ExpObject()));
},
p => {
const v0 = p._GetNode(0).GetVar();
const v1 = p._GetNode(1).GetVar();
const n2 = p._GetNode(2);
const v3 = p._GetNode(3).GetVar();
const v4 = p._GetNode(4).GetVar();
const n5 = p._GetNode(5);
return () => ((v0.GetValue() * Math.cos(C3.toRadians((v1.GetValue() - n2.ExpBehavior())))) - (v3.GetValue() * Math.sin(C3.toRadians((v4.GetValue() - n5.ExpBehavior())))));
},
p => {
const v0 = p._GetNode(0).GetVar();
const v1 = p._GetNode(1).GetVar();
const n2 = p._GetNode(2);
const v3 = p._GetNode(3).GetVar();
const v4 = p._GetNode(4).GetVar();
const n5 = p._GetNode(5);
return () => ((v0.GetValue() * Math.cos(C3.toRadians((v1.GetValue() - n2.ExpBehavior())))) + (v3.GetValue() * Math.sin(C3.toRadians((v4.GetValue() - n5.ExpBehavior())))));
}
];
}
"use strict";
{
const scriptsInEvents = {
async Player_Event213(runtime, localVars)
{
const player = runtime.objects.Collider.getFirstPickedInstance();
const bbox = player && player.getBoundingBox();
if (player && player.instVars.state !== "dead"
&& (bbox.left > runtime.globalVars.levelWidth
|| bbox.bottom < 0
|| bbox.top > runtime.globalVars.levelHeight
|| bbox.right < 0)
) {
runtime.callFunction("GameplayDeath");
}
},
async Player_Event216(runtime, localVars)
{
let collisionEngine = globalThis.sdk_runtime.GetCollisionEngine();
let player = globalThis.sdk_runtime.GetInstanceByUID(runtime.objects.Collider.getFirstPickedInstance().uid);
let playerPlatform = player._behaviorInstances.find(x=> x instanceof C3.Behaviors.Platform)._sdkInst;
let b = player.GetWorldInfo();
collisionEngine.PushOutSolid(player, -playerPlatform._downX, -playerPlatform._downY, 10, false)
},
async Gameplay_Event34_Act3(runtime, localVars)
{
const button = runtime.objects.ButtonTrigger.getFirstPickedInstance();
button.Activate()
},
async Gameplay_Event36_Act3(runtime, localVars)
{
const button = runtime.objects.ButtonTrigger.getFirstPickedInstance();
button.Activate()
},
async Gameplay_Event38_Act6(runtime, localVars)
{
const button = runtime.objects.ButtonTrigger.getFirstPickedInstance();
button.Activate = new Function("sdkSelf", "runtime", button.instVars.OnActivate).bind(button, sdk_runtime.GetInstanceByUID(button.uid), runtime);
},
async Gameplay_Event86_Act4(runtime, localVars)
{
runtime.objects.Rocket.getFirstPickedInstance().instVars.Smart = runtime.objects.RocketLauncher.getFirstPickedInstance().instVars.Smart;
}
};
self.C3.ScriptsInEvents = scriptsInEvents;
}
// User script coursesManagement.js
function loadCourse(id)
{
return globalThis.g_runtime.assets.fetchJson(globalThis.courses[id]).then(json => {
globalThis.currentCourse = json;
});
}
function loadChapter(id)
{
globalThis.currentChapter = globalThis.currentCourse.chapters[id];
}
function loadLevel(id)
{
globalThis.currentLevel = globalThis.currentChapter.levels[id];
}
function createCurLevel()
{
globalThis.currentLevel.objects.forEach(object => {
let inst = globalThis.g_runtime.objects[object.name].createInstance(0, object.x, object.y);
inst = {
...inst,
...object,
instVars: {
...inst.instVars,
...object.instVars
}
}
})
}
// User script Buttons.js
function assignButtonsCode(runtime) {
globalThis.moveArea = runtime.callFunction.bind(globalThis.g_runtime, "MoveArea")
globalThis.getButton = (id) => {
return runtime.objects.ButtonTrigger.getAllInstances().find(x=>x.instVars.ID === id);
}
}
//fn
// User script runOnStartup.js
// Put any global functions etc. here
runOnStartup(async runtime =>
{
// Code to run on the loading screen
runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
globalThis.g_runtime = runtime;
assignButtonsCode(runtime);
});
function OnBeforeProjectStart(runtime)
{
// Code to run just before 'On start of layout'
// on the first layout. Initial instances are created
// and available to use here.
runtime.assets.fetchJson("Courses.json").then(json => {
globalThis.courses = json;
//TODO remove later when menus are done.
loadCourse(0).then(()=>{
console.log("course loaded");
loadChapter(0);
loadLevel(0);
//runtime.goToLayout("Level");
});
});
runtime.addEventListener("tick", () => Tick(runtime));
}
function Tick(runtime)
{
// Code to run every tick
}
// User script Timeout.js
/*****=== MODULE: TIMEOUT AND INTERVALS ====**********/
/*****Author: skymen **********/
/*****Description: Exports two functions: **********/
/***** interval: works like setInterval **********/
/***** timeout: works like setTimeout **********/
/***** **********/
/*****Both count time in seconds instead of **********/
/*****milliseconds and respect time scale **********/
/***** **********/
/*****======================================**********/
(function () {
// Init and get runtime
runOnStartup(async runtime =>
{
// Code to run on the loading screen.
// Note layouts, objects etc. are not yet available.
runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
});
function OnBeforeProjectStart(runtime)
{
// Code to run just before 'On start of layout' on
// the first layout. Loading has finished and initial
// instances are created and available to use here.
runtime.addEventListener("tick", () => Tick(runtime));
runtime.getAllLayouts().forEach(layout => {
layout.addEventListener("beforelayoutstart", () => StartOfLayout(layout, runtime))
});
}
// Init local vars
let timeouts = [];
let curTime = 0;
// Export functions to global scope
globalThis.timeout = (callback, duration, isInterval = false) => {
timeouts.push({
callback,
duration,
current: duration,
isInterval
});
}
globalThis.interval = (callback, duration) => {
globalThis.timeout(callback, duration, true);
}
// Local functions for more processing
function StartOfLayout(layout, runtime) {
timeouts = [];
}
function Tick(runtime)
{
let dt = runtime.gameTime - curTime;
curTime = runtime.gameTime
for(let i = 0; i < timeouts.length; i++) {
let cur = timeouts[i];
cur.current -= dt;
if (cur.current <= 0) {
cur.callback()
if (cur.isInterval) {
cur.current = cur.duration;
} else {
timeouts.splice(i, 1);
i--;
}
}
}
}
})()