Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
// 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/3rdparty/localforage.js
!function(c){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=c();else if("function"==typeof define&&define.amd)define([],c);else{var a;a="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,a.localforage=c()}}(function(){return function l(m,a,b){function d(e,f){if(!a[e]){if(!m[e]){var g="function"==typeof require&&require;if(!f&&g)return g(e,!0);if(c)return c(e,!0);var i=new Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}var j=a[e]={exports:{}};m[e][0].call(j.exports,function(b){var a=m[e][1][b];return d(a||b)},j,j.exports,l,m,a,b)}return a[e].exports}for(var c="function"==typeof require&&require,e=0;e<b.length;e++)d(b[e]);return d}({1:[function(c,a){"use strict";function b(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}function e(f,a){f=f||[],a=a||{};try{return new Blob(f,a)}catch(e){if("TypeError"!==e.name)throw e;for(var b="undefined"==typeof BlobBuilder?"undefined"==typeof MSBlobBuilder?"undefined"==typeof MozBlobBuilder?WebKitBlobBuilder:MozBlobBuilder:MSBlobBuilder:BlobBuilder,c=new b,d=0;d<f.length;d+=1)c.append(f[d]);return c.getBlob(a.type)}}function C(c,d){d&&c.then(function(b){d(null,b)},function(b){d(b)})}function D(d,a,e){"function"==typeof a&&d.then(a),"function"==typeof e&&d.catch(e)}function g(b){return"string"!=typeof b&&(console.warn(b+" used as a key, but it is not a string."),b=b+""),b}function h(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function d(f){for(var a=f.length,b=new ArrayBuffer(a),c=new Uint8Array(b),d=0;d<a;d++)c[d]=f.charCodeAt(d);return b}function f(f){return new P(function(g){var a=f.transaction(Q,V),b=e([""]);a.objectStore(Q).put(b,"key"),a.onabort=function(b){b.preventDefault(),b.stopPropagation(),g(!1)},a.oncomplete=function(){var b=navigator.userAgent.match(/Chrome\/(\d+)/),d=navigator.userAgent.match(/Edge\//);g(d||!b||43<=parseInt(b[1],10))}}).catch(function(){return!1})}function i(b){return"boolean"==typeof R?P.resolve(R):f(b).then(function(b){return R=b})}function j(d){var a=S[d.name],e={};e.promise=new P(function(c,a){e.resolve=c,e.reject=a}),a.deferredOperations.push(e),a.dbReady=a.dbReady?a.dbReady.then(function(){return e.promise}):e.promise}function k(d){var a=S[d.name],b=a.deferredOperations.pop();if(b)return b.resolve(),b.promise}function l(e,a){var b=S[e.name],c=b.deferredOperations.pop();if(c)return c.reject(a),c.promise}function m(g,a){return new P(function(h,c){if(S[g.name]=S[g.name]||w(),g.db){if(!a)return h(g.db);j(g),g.db.close()}var d=[g.name];a&&d.push(g.version);var e=M.open.apply(M,d);a&&(e.onupgradeneeded=function(a){var b=e.result;try{b.createObjectStore(g.storeName),1>=a.oldVersion&&b.createObjectStore(Q)}catch(b){if("ConstraintError"!==b.name)throw b;console.warn("The database \""+g.name+"\" has been upgraded from version "+a.oldVersion+" to version "+a.newVersion+", but the storage \""+g.storeName+"\" already exists.")}}),e.onerror=function(b){b.preventDefault(),c(e.error)},e.onsuccess=function(){h(e.result),k(g)}})}function n(b){return m(b,!1)}function o(b){return m(b,!0)}function p(g,a){if(!g.db)return!0;var b=!g.db.objectStoreNames.contains(g.storeName),c=g.version<g.db.version,d=g.version>g.db.version;if(c&&(g.version!==a&&console.warn("The database \""+g.name+"\" can't be downgraded from version "+g.db.version+" to version "+g.version+"."),g.version=g.db.version),d||b){if(b){var e=g.db.version+1;e>g.version&&(g.version=e)}return!0}return!1}function q(e){return new P(function(a,b){var c=new FileReader;c.onerror=b,c.onloadend=function(b){var c=btoa(b.target.result||"");a({__local_forage_encoded_blob:!0,data:c,type:e.type})},c.readAsBinaryString(e)})}function r(b){return e([d(atob(b.data))],{type:b.type})}function s(b){return b&&b.__local_forage_encoded_blob}function t(d){var e=this,a=e._initReady().then(function(){var b=S[e._dbInfo.name];if(b&&b.dbReady)return b.dbReady});return D(a,d,d),a}function u(f){j(f);for(var a,g=S[f.name],b=g.forages,c=0;c<b.length;c++)a=b[c],a._dbInfo.db&&(a._dbInfo.db.close(),a._dbInfo.db=null);return f.db=null,n(f).then(function(a){return f.db=a,p(f)?o(f):a}).then(function(a){f.db=g.db=a;for(var c=0;c<b.length;c++)b[c]._dbInfo.db=a}).catch(function(a){throw l(f,a),a})}function v(f,a,b,c){void 0===c&&(c=1);try{var d=f.db.transaction(f.storeName,a);b(null,d)}catch(d){if(0<c&&(!f.db||"InvalidStateError"===d.name||"NotFoundError"===d.name))return P.resolve().then(function(){if(!f.db||"NotFoundError"===d.name&&!f.db.objectStoreNames.contains(f.storeName)&&f.version<=f.db.version)return f.db&&(f.version=f.db.version+1),o(f)}).then(function(){return u(f).then(function(){v(f,a,b,c-1)})}).catch(b);b(d)}}function w(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function x(l){var a,b,c,d,e,f=.75*l.length,g=l.length,h=0;"="===l[l.length-1]&&(f--,"="===l[l.length-2]&&f--);var i=new ArrayBuffer(f),j=new Uint8Array(i);for(a=0;a<g;a+=4)b=X.indexOf(l[a]),c=X.indexOf(l[a+1]),d=X.indexOf(l[a+2]),e=X.indexOf(l[a+3]),j[h++]=b<<2|c>>4,j[h++]=(15&c)<<4|d>>2,j[h++]=(3&d)<<6|63&e;return i}function y(e){var a,b=new Uint8Array(e),c="";for(a=0;a<b.length;a+=3)c+=X[b[a]>>2],c+=X[(3&b[a])<<4|b[a+1]>>4],c+=X[(15&b[a+1])<<2|b[a+2]>>6],c+=X[63&b[a+2]];return 2==b.length%3?c=c.substring(0,c.length-1)+"=":1==b.length%3&&(c=c.substring(0,c.length-2)+"=="),c}function z(e,a,b,c){e.executeSql("CREATE TABLE IF NOT EXISTS "+a.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],b,c)}function A(g,i,b,c,d,e){g.executeSql(b,c,d,function(f,j){j.code===j.SYNTAX_ERR?f.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[i.storeName],function(f,a){a.rows.length?e(f,j):z(f,i,function(){f.executeSql(b,c,d,e)},e)},e):e(f,j)},e)}function B(j,a,i,c){var d=this;j=g(j);var b=new P(function(e,f){d.ready().then(function(){void 0===a&&(a=null);var g=a,h=d._dbInfo;h.serializer.serialize(a,function(a,b){b?f(b):h.db.transaction(function(b){A(b,h,"INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[j,a],function(){e(g)},function(c,a){f(a)})},function(a){if(a.code===a.QUOTA_ERR){if(0<c)return void e(B.apply(d,[j,g,i,c-1]));f(a)}})})}).catch(f)});return C(b,i),b}function E(g){return new P(function(h,d){g.transaction(function(b){b.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(b,c){for(var d=[],i=0;i<c.rows.length;i++)d.push(c.rows.item(i).name);h({db:g,storeNames:d})},function(c,a){d(a)})},function(b){d(b)})})}function F(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(b){return!1}}function G(d,a){var b=d.name+"/";return d.storeName!==a.storeName&&(b+=d.storeName+"/"),b}function H(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(b){return!0}}function I(){return!H()||0<localStorage.length}function J(d,a){d[a]=function(){var b=arguments;return d.ready().then(function(){return d[a].apply(d,b)})}}function K(){for(var d,b=1;b<arguments.length;b++)if(d=arguments[b],d)for(var a in d)d.hasOwnProperty(a)&&(ra(d[a])?arguments[0][a]=d[a].slice():arguments[0][a]=d[a]);return arguments[0]}var L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(b){return typeof b}:function(b){return b&&"function"==typeof Symbol&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},M=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(b){}}();"undefined"==typeof Promise&&c("lie/polyfill");var P=Promise,Q="local-forage-detect-blob-support",R=void 0,S={},T=Object.prototype.toString,U="readonly",V="readwrite",W={_driver:"asyncStorage",_initStorage:function(k){function a(){return P.resolve()}var l=this,c={db:null};if(k)for(var b in k)c[b]=k[b];var d=S[c.name];d||(d=w(),S[c.name]=d),d.forages.push(l),l._initReady||(l._initReady=l.ready,l.ready=t);for(var e,f=[],g=0;g<d.forages.length;g++)e=d.forages[g],e!==l&&f.push(e._initReady().catch(a));var h=d.forages.slice(0);return P.all(f).then(function(){return c.db=d.db,n(c)}).then(function(b){return c.db=b,p(c,l._defaultConfig.version)?o(c):b}).then(function(f){c.db=d.db=f,l._dbInfo=c;for(var a,e=0;e<h.length;e++)a=h[e],a!==l&&(a._dbInfo.db=c.db,a._dbInfo.version=c.version)})},_support:function(){try{if(!M)return!1;var c="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),d="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!c||d)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(b){return!1}}(),iterate:function(f,a){var e=this,b=new P(function(a,b){e.ready().then(function(){v(e._dbInfo,U,function(c,d){if(c)return b(c);try{var j=d.objectStore(e._dbInfo.storeName),g=j.openCursor(),h=1;g.onsuccess=function(){var b=g.result;if(b){var c=b.value;s(c)&&(c=r(c));var d=f(c,b.key,h++);void 0===d?b.continue():a(d)}else a()},g.onerror=function(){b(g.error)}}catch(c){b(c)}})}).catch(b)});return C(b,a),b},getItem:function(e,a){var i=this;e=g(e);var b=new P(function(c,b){i.ready().then(function(){v(i._dbInfo,U,function(a,d){if(a)return b(a);try{var f=d.objectStore(i._dbInfo.storeName),g=f.get(e);g.onsuccess=function(){var b=g.result;void 0===b&&(b=null),s(b)&&(b=r(b)),c(b)},g.onerror=function(){b(g.error)}}catch(c){b(c)}})}).catch(b)});return C(b,a),b},setItem:function(f,h,a){var j=this;f=g(f);var b=new P(function(a,c){var b;j.ready().then(function(){return b=j._dbInfo,"[object Blob]"===T.call(h)?i(b.db).then(function(b){return b?h:q(h)}):h}).then(function(d){v(j._dbInfo,V,function(b,e){if(b)return c(b);try{var g=e.objectStore(j._dbInfo.storeName);null===d&&(d=void 0);var h=g.put(d,f);e.oncomplete=function(){void 0===d&&(d=null),a(d)},e.onabort=e.onerror=function(){var b=h.error?h.error:h.transaction.error;c(b)}}catch(b){c(b)}})}).catch(c)});return C(b,a),b},removeItem:function(e,a){var i=this;e=g(e);var b=new P(function(a,b){i.ready().then(function(){v(i._dbInfo,V,function(c,d){if(c)return b(c);try{var f=d.objectStore(i._dbInfo.storeName),g=f.delete(e);d.oncomplete=function(){a()},d.onerror=function(){b(g.error)},d.onabort=function(){var c=g.error?g.error:g.transaction.error;b(c)}}catch(c){b(c)}})}).catch(b)});return C(b,a),b},clear:function(d){var h=this,a=new P(function(b,i){h.ready().then(function(){v(h._dbInfo,V,function(a,c){if(a)return i(a);try{var d=c.objectStore(h._dbInfo.storeName),e=d.clear();c.oncomplete=function(){b()},c.onabort=c.onerror=function(){var b=e.error?e.error:e.transaction.error;i(b)}}catch(b){i(b)}})}).catch(i)});return C(a,d),a},length:function(d){var h=this,a=new P(function(b,i){h.ready().then(function(){v(h._dbInfo,U,function(a,c){if(a)return i(a);try{var d=c.objectStore(h._dbInfo.storeName),e=d.count();e.onsuccess=function(){b(e.result)},e.onerror=function(){i(e.error)}}catch(b){i(b)}})}).catch(i)});return C(a,d),a},key:function(e,a){var j=this,b=new P(function(a,b){return 0>e?void a(null):void j.ready().then(function(){v(j._dbInfo,U,function(c,d){if(c)return b(c);try{var f=d.objectStore(j._dbInfo.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var b=h.result;return b?void(0===e?a(b.key):g?a(b.key):(g=!0,b.advance(e))):void a(null)},h.onerror=function(){b(h.error)}}catch(c){b(c)}})}).catch(b)});return C(b,a),b},keys:function(d){var i=this,a=new P(function(d,b){i.ready().then(function(){v(i._dbInfo,U,function(a,c){if(a)return b(a);try{var e=c.objectStore(i._dbInfo.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var a=f.result;return a?void(g.push(a.key),a.continue()):void d(g)},f.onerror=function(){b(f.error)}}catch(c){b(c)}})}).catch(b)});return C(a,d),a},dropInstance:function(i,m){m=h.apply(this,arguments);var b=this.config();i="function"!=typeof i&&i||{},i.name||(i.name=i.name||b.name,i.storeName=i.storeName||b.storeName);var c,d=this;if(i.name){var e=i.name===b.name&&d._dbInfo.db,f=e?P.resolve(d._dbInfo.db):n(i).then(function(a){var b=S[i.name],c=b.forages;b.db=a;for(var d=0;d<c.length;d++)c[d]._dbInfo.db=a;return a});c=i.storeName?f.then(function(a){if(a.objectStoreNames.contains(i.storeName)){var h=a.version+1;j(i);var m=S[i.name],d=m.forages;a.close();for(var b,c=0;c<d.length;c++)b=d[c],b._dbInfo.db=null,b._dbInfo.version=h;return new P(function(c,b){var d=M.open(i.name,h);d.onerror=function(c){d.result.close(),b(c)},d.onupgradeneeded=function(){d.result.deleteObjectStore(i.storeName)},d.onsuccess=function(){var b=d.result;b.close(),c(b)}}).then(function(e){m.db=e;for(var a,c=0;c<d.length;c++)a=d[c],a._dbInfo.db=e,k(a._dbInfo)}).catch(function(a){throw(l(i,a)||P.resolve()).catch(function(){}),a})}}):f.then(function(a){j(i);var f=S[i.name],c=f.forages;a.close();for(var b=0;b<c.length;b++)c[b]._dbInfo.db=null;return new P(function(e,f){var c=M.deleteDatabase(i.name);c.onerror=c.onblocked=function(d){var a=c.result;a&&a.close(),f(d)},c.onsuccess=function(){var b=c.result;b&&b.close(),e(b)}}).then(function(d){f.db=d;for(var a=0;a<c.length;a++)k(c[a]._dbInfo)}).catch(function(a){throw(l(i,a)||P.resolve()).catch(function(){}),a})})}else c=P.reject("Invalid arguments");return C(c,m),c}},X="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Y=/^~~local_forage_type~([^~]+)~/,Z="__lfsc__:",$="__lfsc__:".length,_="arbf",aa="blob",ba="si08",ca="ui08",da="uic8",ea="si16",fa="si32",ga="ur16",ha="ui32",ia="fl32",ja="fl64",ka=9+"arbf".length,la=Object.prototype.toString,ma={serialize:function(g,a){var b="";if(g&&(b=la.call(g)),g&&("[object ArrayBuffer]"===b||g.buffer&&"[object ArrayBuffer]"===la.call(g.buffer))){var c,d=Z;g instanceof ArrayBuffer?(c=g,d+=_):(c=g.buffer,"[object Int8Array]"===b?d+=ba:"[object Uint8Array]"===b?d+=ca:"[object Uint8ClampedArray]"===b?d+=da:"[object Int16Array]"===b?d+=ea:"[object Uint16Array]"===b?d+=ga:"[object Int32Array]"===b?d+=fa:"[object Uint32Array]"===b?d+=ha:"[object Float32Array]"===b?d+=ia:"[object Float64Array]"===b?d+=ja:a(new Error("Failed to get type for BinaryArray"))),a(d+y(c))}else if("[object Blob]"===b){var e=new FileReader;e.onload=function(){var b="~~local_forage_type~"+g.type+"~"+y(this.result);a(Z+aa+b)},e.readAsArrayBuffer(g)}else try{a(JSON.stringify(g))}catch(b){console.error("Couldn't convert value into a JSON string: ",g),a(null,b)}},deserialize:function(g){if(g.substring(0,$)!==Z)return JSON.parse(g);var a,h=g.substring(ka),c=g.substring($,ka);if(c===aa&&Y.test(h)){var d=h.match(Y);a=d[1],h=h.substring(d[0].length)}var i=x(h);switch(c){case _:return i;case aa:return e([i],{type:a});case ba:return new Int8Array(i);case ca:return new Uint8Array(i);case da:return new Uint8ClampedArray(i);case ea:return new Int16Array(i);case ga:return new Uint16Array(i);case fa:return new Int32Array(i);case ha:return new Uint32Array(i);case ia:return new Float32Array(i);case ja:return new Float64Array(i);default:throw new Error("Unkown type: "+c);}},stringToBuffer:x,bufferToString:y},na={_driver:"webSQLStorage",_initStorage:function(f){var g=this,b={db:null};if(f)for(var a in f)b[a]="string"==typeof f[a]?f[a]:f[a].toString();var c=new P(function(c,e){try{b.db=openDatabase(b.name,b.version+"",b.description,b.size)}catch(b){return e(b)}b.db.transaction(function(a){z(a,b,function(){g._dbInfo=b,c()},function(c,a){e(a)})},e)});return b.serializer=ma,c},_support:function(){return"function"==typeof openDatabase}(),iterate:function(g,a){var f=this,b=new P(function(a,c){f.ready().then(function(){var b=f._dbInfo;b.db.transaction(function(d){A(d,b,"SELECT * FROM "+b.storeName,[],function(e,c){for(var d=c.rows,f=d.length,k=0;k<f;k++){var h=d.item(k),i=h.value;if(i&&(i=b.serializer.deserialize(i)),void 0!==(i=g(i,h.key,k+1)))return void a(i)}a()},function(d,a){c(a)})})}).catch(c)});return C(b,a),b},getItem:function(f,a){var h=this;f=g(f);var b=new P(function(g,c){h.ready().then(function(){var b=h._dbInfo;b.db.transaction(function(a){A(a,b,"SELECT * FROM "+b.storeName+" WHERE key = ? LIMIT 1",[f],function(e,a){var c=a.rows.length?a.rows.item(0).value:null;c&&(c=b.serializer.deserialize(c)),g(c)},function(d,a){c(a)})})}).catch(c)});return C(b,a),b},setItem:function(d,a,b){return B.apply(this,[d,a,b,1])},removeItem:function(f,a){var h=this;f=g(f);var b=new P(function(a,c){h.ready().then(function(){var b=h._dbInfo;b.db.transaction(function(d){A(d,b,"DELETE FROM "+b.storeName+" WHERE key = ?",[f],function(){a()},function(d,a){c(a)})})}).catch(c)});return C(b,a),b},clear:function(d){var e=this,a=new P(function(b,d){e.ready().then(function(){var a=e._dbInfo;a.db.transaction(function(c){A(c,a,"DELETE FROM "+a.storeName,[],function(){b()},function(c,a){d(a)})})}).catch(d)});return C(a,d),a},length:function(d){var e=this,a=new P(function(f,d){e.ready().then(function(){var a=e._dbInfo;a.db.transaction(function(c){A(c,a,"SELECT COUNT(key) as c FROM "+a.storeName,[],function(a,b){var c=b.rows.item(0).c;f(c)},function(c,a){d(a)})})}).catch(d)});return C(a,d),a},key:function(f,a){var g=this,b=new P(function(e,c){g.ready().then(function(){var a=g._dbInfo;a.db.transaction(function(b){A(b,a,"SELECT key FROM "+a.storeName+" WHERE id = ? LIMIT 1",[f+1],function(b,a){var c=a.rows.length?a.rows.item(0).key:null;e(c)},function(d,a){c(a)})})}).catch(c)});return C(b,a),b},keys:function(d){var e=this,a=new P(function(f,d){e.ready().then(function(){var a=e._dbInfo;a.db.transaction(function(c){A(c,a,"SELECT key FROM "+a.storeName,[],function(a,b){for(var c=[],d=0;d<b.rows.length;d++)c.push(b.rows.item(d).key);f(c)},function(c,a){d(a)})})}).catch(d)});return C(a,d),a},dropInstance:function(f,g){g=h.apply(this,arguments);var i=this.config();f="function"!=typeof f&&f||{},f.name||(f.name=f.name||i.name,f.storeName=f.storeName||i.storeName);var b,c=this;return b=f.name?new P(function(a){var b;b=f.name===i.name?c._dbInfo.db:openDatabase(f.name,"","",0),a(f.storeName?{db:b,storeNames:[f.storeName]}:E(b))}).then(function(d){return new P(function(a,b){d.db.transaction(function(i){function c(d){return new P(function(a,e){i.executeSql("DROP TABLE IF EXISTS "+d,[],function(){a()},function(c,a){e(a)})})}for(var e=[],f=0,g=d.storeNames.length;f<g;f++)e.push(c(d.storeNames[f]));P.all(e).then(function(){a()}).catch(function(c){b(c)})},function(c){b(c)})})}):P.reject("Invalid arguments"),C(b,g),b}},oa={_driver:"localStorageWrapper",_initStorage:function(e){var a=this,b={};if(e)for(var c in e)b[c]=e[c];return b.keyPrefix=G(e,a._defaultConfig),I()?(a._dbInfo=b,b.serializer=ma,P.resolve()):P.reject()},_support:F(),iterate:function(f,a){var k=this,b=k.ready().then(function(){for(var a,c=k._dbInfo,b=c.keyPrefix,d=b.length,e=localStorage.length,i=1,g=0;g<e;g++)if(a=localStorage.key(g),0===a.indexOf(b)){var h=localStorage.getItem(a);if(h&&(h=c.serializer.deserialize(h)),void 0!==(h=f(h,a.substring(d),i++)))return h}});return C(b,a),b},getItem:function(e,a){var f=this;e=g(e);var b=f.ready().then(function(){var a=f._dbInfo,b=localStorage.getItem(a.keyPrefix+e);return b&&(b=a.serializer.deserialize(b)),b});return C(b,a),b},setItem:function(f,a,b){var h=this;f=g(f);var c=h.ready().then(function(){void 0===a&&(a=null);var d=a;return new P(function(c,e){var i=h._dbInfo;i.serializer.serialize(a,function(a,b){if(b)e(b);else try{localStorage.setItem(i.keyPrefix+f,a),c(d)}catch(b){"QuotaExceededError"!==b.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==b.name||e(b),e(b)}})})});return C(c,b),c},removeItem:function(e,a){var f=this;e=g(e);var b=f.ready().then(function(){var a=f._dbInfo;localStorage.removeItem(a.keyPrefix+e)});return C(b,a),b},clear:function(d){var e=this,a=e.ready().then(function(){for(var b,d=e._dbInfo.keyPrefix,a=localStorage.length-1;0<=a;a--)b=localStorage.key(a),0===b.indexOf(d)&&localStorage.removeItem(b)});return C(a,d),a},length:function(d){var a=this,b=a.keys().then(function(b){return b.length});return C(b,d),b},key:function(e,a){var f=this,b=f.ready().then(function(){var a,b=f._dbInfo;try{a=localStorage.key(e)}catch(b){a=null}return a&&(a=a.substring(b.keyPrefix.length)),a});return C(b,a),b},keys:function(d){var g=this,a=g.ready().then(function(){for(var b,f=g._dbInfo,a=localStorage.length,c=[],d=0;d<a;d++)b=localStorage.key(d),0===b.indexOf(f.keyPrefix)&&c.push(b.substring(f.keyPrefix.length));return c});return C(a,d),a},dropInstance:function(f,g){if(g=h.apply(this,arguments),f="function"!=typeof f&&f||{},!f.name){var b=this.config();f.name=f.name||b.name,f.storeName=f.storeName||b.storeName}var c,d=this;return c=f.name?new P(function(a){a(f.storeName?G(f,d._defaultConfig):f.name+"/")}).then(function(d){for(var a,c=localStorage.length-1;0<=c;c--)a=localStorage.key(c),0===a.indexOf(d)&&localStorage.removeItem(a)}):P.reject("Invalid arguments"),C(c,g),c}},pa=function(c,d){return c===d||"number"==typeof c&&"number"==typeof d&&isNaN(c)&&isNaN(d)},qa=function(e,a){for(var b=e.length,c=0;c<b;){if(pa(e[c],a))return!0;c++}return!1},ra=Array.isArray||function(b){return"[object Array]"===Object.prototype.toString.call(b)},sa={},ta={},va={INDEXEDDB:W,WEBSQL:na,LOCALSTORAGE:oa},wa=[va.INDEXEDDB._driver,va.WEBSQL._driver,va.LOCALSTORAGE._driver],ya=["dropInstance"],za=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ya),Aa={description:"",driver:wa.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},Ba=function(){function d(a){for(var g in b(this,d),va)if(va.hasOwnProperty(g)){var c=va[g],e=c._driver;this[g]=e,sa[e]||this.defineDriver(c)}this._defaultConfig=K({},Aa),this._config=K({},this._defaultConfig,a),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(c){if("object"===(void 0===c?"undefined":L(c))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var d in c){if("storeName"==d&&(c[d]=c[d].replace(/\W/g,"_")),"version"==d&&"number"!=typeof c[d])return new Error("Database version must be a number.");this._config[d]=c[d]}return!("driver"in c&&c.driver)||this.setDriver(this._config.driver)}return"string"==typeof c?this._config[c]:this._config},d.prototype.defineDriver=function(h,a,b){var c=new P(function(a,b){try{var l=h._driver,c=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!h._driver)return void b(c);for(var d,e=za.concat("_initStorage"),f=0,g=e.length;f<g;f++)if(d=e[f],(!qa(ya,d)||h[d])&&"function"!=typeof h[d])return void b(c);(function(){for(var a,e=function(d){return function(){var a=new Error("Method "+d+" is not implemented by the current driver"),b=P.reject(a);return C(b,arguments[arguments.length-1]),b}},b=0,c=ya.length;b<c;b++)a=ya[b],h[a]||(h[a]=e(a))})();var i=function(b){sa[l]&&console.info("Redefining LocalForage driver: "+l),sa[l]=h,ta[l]=b,a()};"_support"in h?h._support&&"function"==typeof h._support?h._support().then(i,b):i(!!h._support):i(!0)}catch(c){b(c)}});return D(c,a,b),c},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(e,a,b){var c=sa[e]?P.resolve(sa[e]):P.reject(new Error("Driver not found."));return D(c,a,b),c},d.prototype.getSerializer=function(c){var a=P.resolve(ma);return D(a,c),a},d.prototype.ready=function(d){var a=this,b=a._driverSet.then(function(){return null===a._ready&&(a._ready=a._initDriver()),a._ready});return D(b,d,d),b},d.prototype.setDriver=function(i,a,b){function k(){e._config.driver=e.driver()}function d(b){return e._extend(b),k(),e._ready=e._initStorage(e._config),e._ready}function c(g){return function(){function a(){for(;b<g.length;){var c=g[b];return b++,e._dbInfo=null,e._ready=null,e.getDriver(c).then(d).catch(a)}k();var f=new Error("No available storage method found.");return e._driverSet=P.reject(f),e._driverSet}var b=0;return a()}}var e=this;ra(i)||(i=[i]);var f=this._getSupportedDrivers(i),g=null===this._driverSet?P.resolve():this._driverSet.catch(function(){return P.resolve()});return this._driverSet=g.then(function(){var b=f[0];return e._dbInfo=null,e._ready=null,e.getDriver(b).then(function(b){e._driver=b._driver,k(),e._wrapLibraryMethodsWithReady(),e._initDriver=c(f)})}).catch(function(){k();var b=new Error("No available storage method found.");return e._driverSet=P.reject(b),e._driverSet}),D(this._driverSet,a,b),this._driverSet},d.prototype.supports=function(b){return!!ta[b]},d.prototype._extend=function(b){K(this,b)},d.prototype._getSupportedDrivers=function(f){for(var a,e=[],b=0,c=f.length;b<c;b++)a=f[b],this.supports(a)&&e.push(a);return e},d.prototype._wrapLibraryMethodsWithReady=function(){for(var c=0,a=za.length;c<a;c++)J(this,za[c])},d.prototype.createInstance=function(a){return new d(a)},d}(),Da=new Ba;a.exports=Da},{undefined:void 0}]},{},[1])(1)});
// 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),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="Blink";const b=a.split("/")[1];b&&(i=b)}),a("isOpera",d.opera,(a)=>{h="Opera",k="Blink";const b=a.split("/")[1];b&&(i=b)}),a("isChromium",d.chromium,(a)=>{h="Chromium",k="Blink";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("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||"windows-store"==l,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}}
// ../lib/misc/supports.js
"use strict";{if(C3.Supports={},C3.Supports.WebAnimations=(()=>{try{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="Safari"!==C3.Platform.Browser&&"Firefox"!==C3.Platform.Browser&&!!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;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)}
// 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.IsArrayOfFileLike=function(a){for(let b of a)if(!C3.IsFileLike(b))return!1;return!0},C3.RequireArrayOfFileLike=function(a){if(!C3.IsArrayOfFileLike(a))throw new TypeError("expected array if files")},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 a instanceof Image||C3.IsHTMLElement(a,"canvas")||C3.IsHTMLElement(a,"img")||a instanceof CanvasRenderingContext2D||a instanceof ImageBitmap||C3.IsHTMLElement(a,"video")},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}
// ../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])}}
// ../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;a.charAt(a.length-1);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])return!0;return!1},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)):b="";const c=a.lastIndexOf("/")+1;let d,e="",f=a,g="";0!=c&&(e=a.slice(0,c-1),f=a.slice(c)),d=f;const h=f.lastIndexOf(".");return 0<h&&(g=f.slice(h),d=f.slice(0,-g.length)),{dir:e,base:f,name:d,root:b,ext:g}},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.length!==d.length)&&(!(c!==d)||c.toLowerCase()===d.toLowerCase())},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){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)}}
// 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.DataURIToBinaryBlob(a.toDataURL(b,c))},C3.DataURIToBinaryBlob=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=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(){var c=Math.round;const e=this._r,f=this._g,g=this._b,b=this._a,a=Math.max(e,f,g),i=Math.min(e,f,g);let j,h,k=(a+i)/2;if(a===i)j=h=0;else{const b=a-i;h=.5<k?b/(2-a-i):b/(a+i);a===e?j=(f-g)/b+(f<g?6:0):a===f?j=(g-e)/b+2:a===g?j=(e-f)/b+4:void 0;j/=6}return`hsla(${c(360*j)}, ${c(100*h)}%, ${c(100*k)}%, ${b})`}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}},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=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())}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=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}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){super(),b||(b=a);this._ptsArr=Float64Array.from(b),this._bbox=new C3.Rect,this._isBboxChanged=!0}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()}}}
// 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,a=Math.sqrt,g=Math.pow,h=Math.sin,i=Math.cos,j=Math.PI;const b=new Map,c=new Map;c.set("linear","noease"),self.Ease=class k{constructor(){}static DefaultEase(){return"noease"}static GetEaseNames(){return this._CreateEaseMap(),b.keys()}static GetEase(a){this._CreateEaseMap();const d=c.get(a);return d?b.get(d):b.get(a)}static _CreateEaseMap(){0!==b.size||(b.set("noease",this.NoEase),b.set("easeinsine",this.EaseInSine),b.set("easeoutsine",this.EaseOutSine),b.set("easeinoutsine",this.EaseInOutSine),b.set("easeinelastic",this.EaseInElastic),b.set("easeoutelastic",this.EaseOutElastic),b.set("easeinoutelastic",this.EaseInOutElastic),b.set("easeinback",this.EaseInBack),b.set("easeoutback",this.EaseOutBack),b.set("easeinoutback",this.EaseInOutBack),b.set("easeinbounce",this.EaseInBounce),b.set("easeoutbounce",this.EaseOutBounce),b.set("easeinoutbounce",this.EaseInOutBounce),b.set("easeincubic",this.EaseInCubic),b.set("easeoutcubic",this.EaseOutCubic),b.set("easeinoutcubic",this.EaseInOutCubic),b.set("easeinquad",this.EaseInQuad),b.set("easeoutquad",this.EaseOutQuad),b.set("easeinoutquad",this.EaseInOutQuad),b.set("easeinquart",this.EaseInQuart),b.set("easeoutquart",this.EaseOutQuart),b.set("easeinoutquart",this.EaseInOutQuart),b.set("easeinquint",this.EaseInQuint),b.set("easeoutquint",this.EaseOutQuint),b.set("easeinoutquint",this.EaseInOutQuint),b.set("easeincirc",this.EaseInCirc),b.set("easeoutcirc",this.EaseOutCirc),b.set("easeinoutcirc",this.EaseInOutCirc),b.set("easeinexpo",this.EaseInExpo),b.set("easeoutexpo",this.EaseOutExpo),b.set("easeinoutexpo",this.EaseInOutExpo))}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*i(a/f*(j/2))+b+e}static EaseOutSine(a,e,b,c){return b*h(a/c*(j/2))+e}static EaseInOutSine(a,e,b,f){return-b/2*(i(j*a/f)-1)+e}static EaseInExpo(a,e,b,c){return 0===a?e:b*g(2,10*(a/c-1))+e}static EaseOutExpo(a,e,b,c){return a===c?e+b:b*(-g(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*g(2,10*(a-1))+e:b/2*(-g(2,-10*--a)+2)+e}static EaseInCirc(e,f,b,g){return-b*(a(1-(e/=g)*e)-1)+f}static EaseOutCirc(e,f,b,c){return b*a(1-(e=e/c-1)*e)+f}static EaseInOutCirc(e,f,b,g){return 1>(e/=g/2)?-b/2*(a(1-e*e)-1)+f:b/2*(a(1-(e-=2)*e)+1)+f}static EaseInElastic(i,k,b,c){let d=1.70158,l=0,m=b;return 0===i?k:1===(i/=c)?k+b:(l||(l=.3*c),m<f(b)?(m=b,d=l/4):d=l/(2*j)*e(b/m),-(m*g(2,10*(i-=1))*h((i*c-d)*(2*j)/l))+k)}static EaseOutElastic(i,k,b,c){let d=1.70158,l=0,m=b;return 0===i?k:1===(i/=c)?k+b:(l||(l=.3*c),m<f(b)?(m=b,d=l/4):d=l/(2*j)*e(b/m),m*g(2,-10*i)*h((i*c-d)*(2*j)/l)+b+k)}static EaseInOutElastic(i,k,b,c){let d=1.70158,l=0,m=b;return 0===i?k:2==(i/=c/2)?k+b:(l||(l=c*(1.5*.3)),m<f(b)?(m=b,d=l/4):d=l/(2*j)*e(b/m),1>i?-.5*(m*g(2,10*(i-=1))*h((i*c-d)*(2*j)/l))+k:.5*(m*g(2,-10*(i-=1))*h((i*c-d)*(2*j)/l))+b+k)}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-k.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*k.EaseInBounce(2*a,0,b,c)+e:.5*k.EaseOutBounce(2*a-c,0,b,c)+.5*b+e}}})();
// ../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)}async _FireAndWaitAsync(a){const b=[];this._IncreaseFireDepth();for(let c=0,d=this._captureListeners.length;c<d;++c){const d=this._captureListeners[c](a);d&&b.push(d)}for(let c=0,d=this._listeners.length;c<d;++c){const d=this._listeners[c](a);d&&b.push(d)}return this._DecreaseFireDepth(),b.length&&(await Promise.all(b)),!a.defaultPrevented}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}ClearEventHandlers(a){const b=this._eventHandlers.get(a);b&&(b.Release(),this._eventHandlers.delete(a))}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 dispatchEventAndWaitAsync(a){const b=this._GetHandlerByType(a.type,!1);return!b||(await b._FireAndWaitAsync(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,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){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)}Add(a){this._rbSet.insert(a)}Remove(a){this._rbSet.remove(a)}Has(a){return this._rbSet.contains(a)}Clear(){this._rbSet.clear()}toArray(){return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()}IsEmpty(){return this._rbSet.isEmpty()}ForEach(a){this._rbSet.forEach(a)}Front(){if(this.IsEmpty())throw new Error("empty set");const a=this._rbSet,b=a.min(a.root);return b.key}Shift(){if(this.IsEmpty())throw new Error("empty set");const a=this.Front();return this.Remove(a),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)}_MaybeStartNext(){if(!this._queue.length)return;if(this._activeCount>=this._maxParallel)return;this._activeCount++;const a=this._queue.shift();a.func().then((b)=>{a.resolve(b),this._activeCount--,this._MaybeStartNext()}).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/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 C3.SpreadStringSafe(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 C3.SpreadStringSafe(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)};let h=new WeakMap;C3.SetElementContent=function(a,b,c){let d=h.get(a);if("string"==typeof b){if(!c&&b===d)return;a.textContent=b,h.set(a,b)}else{if(!c&&b.equals(d))return;if(b.isPlainText()){let c=b.toString();a.textContent=c,h.set(a,c)}else a.innerHTML=b.toHTML(),b instanceof C3.BBString&&b.attachLinkHandlers(a),h.set(a,b.toString())}},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;for(let d=0,e=b.length;d<e;++d){const a=`{${d}}`;c=c.replace(a,b[d].toString())}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 i=1024;C3.FormatDataSize=function(a,b){var c=Math.round;let d="common."+(b?"dataRates":"dataSizes")+".";if(a<i)return langSub(d+"bytes",a);if(1048576>a){let b=a/i;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 j={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};C3.FormatTime=function(a,b){var c=Math.floor;b=Object.assign({},j,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.SpreadStringSafe=function(a){return[...a].filter((a)=>"string"==typeof a)}}
// ../lib/str/bbstring.js
"use strict";{function a(a,c,d){const f=b.get(d);if(!f)return a;else if("string"!=typeof f){if(Array.isArray(f)){let a=f[0],b=f[1];return c?"</"+a+">":`<${a} class="${b}">`}}else if("a"===f&&!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+f+">"}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;const f=/\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&&(e=this._linkActions,b=b.replace(c,a),e=null),this._needsLineBreakConversion&&(b=b.replace(f,"<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}_AddLine(a,b,c){this._lines.push({fragments:a,width:b,height:c})}_AddFrag(a,b,c,d,e){a.push({text:b,styles:c,width:d,height:e})}WordWrap(a,b,c,d){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],e=d.text,f=d.styles;if(100>=e.length&&!e.includes("\n")){const a=b(e,f);if(a.width<=c){const b=[];return this._AddFrag(b,e,f,a.width,a.height),void this._AddLine(b,a.width,a.height)}}}let e;e="word"===d?a.map((a)=>({words:this._TokeniseWords(a.text),styles:a.styles})):a.map((a)=>({words:[...a.text],styles:a.styles})),this._WrapText(e,b,c)}_TokeniseWords(a){const b=C3.SpreadStringSafe(a),c=[];let d="",e=!1;for(const f of b)if("\n"===f)d&&c.push(d),c.push("\n"),d="";else if(!d)d=f,e=C3.IsWhitespaceChar(f);else{const a=C3.IsWhitespaceChar(f);a===e?d+=f:(c.push(d),d=f,e=a)}return d&&c.push(d),c}_WrapText(a,b,c){var d=Math.max;let e="",f=0,g=0,h=0,i=0,j=[];for(const k of a){const a=k.styles,l=k.words;for(const k of l){if("\n"===k){0===h&&(h=b(" ",a).height),e&&this._AddFrag(j,e,a,f,g||h),this._AddLine(j,i+f,h),j=[],e="",f=0,g=0,i=0,h=0;continue}const l=e+k,m=b(l,a),n=m.width,o=m.height;if(!(i+n>=c))e=l,f=n,g=d(g,o),h=d(h,o);else if(e&&this._AddFrag(j,e,a,f,g),j.length&&(this._AddLine(j,i+f,h),j=[]),i=0,C3.IsStringAllWhitespace(k))e="",f=0,g=0,h=0;else{e=k;const c=b(k,a);f=c.width,g=c.height,h=c.height}}e&&(this._AddFrag(j,e,a,f,g),i+=f,e="",f=0,g=0)}j.length&&this._AddLine(j,i+f,h);for(const d of this._lines){const a=d.fragments;if(!a.length)continue;const c=a[a.length-1],e=c.text,f=e.trimEnd();if(!f)d.width-=c.width,a.pop();else if(f.length<e.length){const a=b(f,c.styles).width,e=c.width-a;c.width=a,c.text=f,d.width-=e}}}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/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=document.createElement("canvas");a.width=this._width,a.height=this._height;const 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=document.createElement("canvas");a.width=this._width,a.height=this._height;const b=a.getContext("2d");b.putImageData(f,0,0),f=a}const a=document.createElement("canvas");a.width=C3.nextHighestPowerOfTwo(this._width),a.height=C3.nextHighestPowerOfTwo(this._height);const 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/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/shaderProgram.js
"use strict";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 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/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/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._shaderPrograms,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/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.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),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(){var a=Math.max;this._drawCharCount=0;const b=this._scaleFactor*this._zoom*self.devicePixelRatio,d=c(this._fontSize)*b,e=(4+this._lineHeight)*b,f=d+e;let g=0;const h=this._wrappedText.GetLines();"center"===this._verticalAlign?g=a(this._height/2-h.length*f/2,0):"bottom"===this._verticalAlign&&(g=a(this._height-h.length*f-2,0));for(let a=0,c=h.length;a<c;++a){const c=h[a],d=c.height*b;if(this._isBBcodeEnabled){if(g+=d,0<a&&g>this._height-e)break;}else if(0<a&&g>=this._height-(d+e))break;let f=0;"center"===this._horizontalAlign?f=(this._width-c.width*b)/2:"right"===this._horizontalAlign&&(f=this._width-c.width*b),this._DrawTextLine(c,f,g,b),this._isBBcodeEnabled||(g+=d),g+=e}}_DrawTextLine(a,b,c,d){for(const e of a.fragments)this._DrawTextFragment(e,b,c,d,a.height),b+=e.width*d}_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/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/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/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/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(){f=-1;for(const e of p)e.checkFunc()&&(e.resolve(),p.delete(e));0<p.size&&(f=self.requestAnimationFrame(t))}function r(e,t,r){let a=null;return 2.1<=r&&(a=e.getContext("webgl2-compute",t),a)?{gl:a,version:2.1}:2<=r&&(a=e.getContext("webgl2",t),a)?{gl:a,version:2}:(a=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),{gl:a,version:1})}const a={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,maxWebGLVersion:2},i=new Set(["default","low-power","high-performance"]);const n=new C3.Quad(0,0,1,0,1,1,0,1),_=[0,0,0,0,0,0,0,0],l=vec3.fromValues(0,0,0),o=vec3.fromValues(0,0,0),s=mat4.create(),d=new C3.Quad,c=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 p=new Set;let f=-1;C3.Gfx.WebGLRenderer=class{constructor(e,t){if(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};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(),this._versionString=o.getParameter(o.VERSION),this._version=l.version,this._is3d=!0,this._width=0,this._height=0,this._lastBackbufferWidth=0,this._lastBackbufferHeight=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._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._dummyVao=null,this._shaderPrograms=[],this._shaderProgramsByName=new Map,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,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._stateGroups=new Map,this._currentStateGroup=null,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._frameNumber=0,this._timerExt=null,this._allQueryResultBuffers=new Set,this._timeQueryStack=[],this.FillIndexBufferData()}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,e.disable(e.CULL_FACE),e.disable(e.STENCIL_TEST),e.disable(e.DITHER),e.disable(e.DEPTH_TEST),2<=this.GetWebGLVersionNumber()&&(this._dummyVao=e["createVertexArray"](),e["bindVertexArray"](this._dummyVao)),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"])),C3.isDebug&&(this._parallelShaderCompileExt=e.getExtension("KHR_parallel_shader_compile")),C3.isDebug&&(u=e.getExtension("WEBGL_lose_context")),this._isGpuProfilingEnabled&&(1===this.GetWebGLVersionNumber()?this._timerExt=e.getExtension("EXT_disjoint_timer_query"):this._timerExt=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query")),C3.clearArray(this._shaderPrograms),this._shaderProgramsByName.clear();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()}FillIndexBufferData(){const e=this._indexData;for(let t=0,r=0;t<12000;)e[t++]=r,e[t++]=r+1,e[t++]=r+2,e[t++]=r,e[t++]=r+2,e[t++]=r+3,r+=4}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._shaderPrograms.push(a),this._shaderProgramsByName.set(a.GetName(),a),a}GetShaderProgramByName(e){return this._shaderProgramsByName.get(e)||null}GetTextureFillShaderProgram(){return this._spTextureFill}ResetLastProgram(){this._lastProgram=null}_RemoveShaderProgram(e){const t=this._shaderPrograms.indexOf(e);-1!==t&&this._shaderPrograms.splice(t,1),this._shaderProgramsByName.delete(e.GetName())}Project(e,t,r,a,i){const n=this._matMV,l=this._matP;for(let n=0,l=_.length;n<l;++n)_[n]=0;_[0]=n[0]*e+n[4]*t+n[12],_[1]=n[1]*e+n[5]*t+n[13],_[2]=n[2]*e+n[6]*t+n[14],_[3]=n[3]*e+n[7]*t+n[15],_[4]=l[0]*_[0]+l[4]*_[1]+l[8]*_[2]+l[12]*_[3],_[5]=l[1]*_[0]+l[5]*_[1]+l[9]*_[2]+l[13]*_[3],_[6]=l[2]*_[0]+l[6]*_[1]+l[10]*_[2]+l[14]*_[3],_[7]=-_[2];0===_[7]||(_[7]=1/_[7],_[4]*=_[7],_[5]*=_[7],_[6]*=_[7],i[0]=(.5*_[4]+.5)*r,i[1]=(.5*_[5]+.5)*a)}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,1,10000);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._shaderPrograms,_=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)}GetWidth(){return this._width}GetHeight(){return this._height}GetNearZ(){return 1}GetFarZ(){return 10000}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()}SetCameraXYZ(e,t,r){this._cam[0]=e*this._worldScale[0],this._cam[1]=t*this._worldScale[1],this._cam[2]=r}SetLookXYZ(e,t,r){this._look[0]=e*this._worldScale[0],this._look[1]=t*this._worldScale[1],this._look[2]=r}ResetModelView(e){mat4.lookAt(this._matMV,this._cam,this._look,e||this._up),mat4.scale(this._matMV,this._matMV,this._worldScale)}Translate(e,t){0===e&&0===t||(l[0]=e,l[1]=t,l[2]=0,mat4.translate(this._matMV,this._matMV,l))}Scale(e,t){1===e&&1===t||(l[0]=e,l[1]=t,l[2]=1,mat4.scale(this._matMV,this._matMV,l))}RotateZ(e){0===e||mat4.rotateZ(this._matMV,this._matMV,e)}UpdateModelView(){if(!e(this._lastMV,this._matMV)){const e=this.PushBatch();e.InitUpdateModelView(this._matMV),mat4.copy(this._lastMV,this._matMV),this._topOfBatch=0}}_SetCurrentStateGroup(e){this._currentStateGroup=e}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(e,t,r,a,i){const n=C3.Gfx.StateGroup.MakeKey(e,t,r,a,i);let _=this._stateGroups.get(n);return _||(_=C3.New(C3.Gfx.StateGroup,this,e,t,r,a,i),this._stateGroups.set(n,_)),_.AddRef(),_}ReleaseStateGroup(e){e.DecRef(),0===e._GetRefCount()&&(this._currentStateGroup===e&&(this._currentStateGroup=null),this._stateGroups.delete(e.GetKey()),e.Release())}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(s,this._lastMV),vec3.copy(l,this._cam),vec3.copy(o,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;c.set(-e,t,-e+this._viewportScissorWidth,t-this._viewportScissorHeight),d.setFromRect(c),c.set(0,0,this._viewportScissorWidth/this._width,this._viewportScissorHeight/this._height),this.Quad3(d,c)}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(),s=a(l,n),u=a(o,_),p=r(_-o,0),f=r(o-_,0);c.set(-e,i-f,-e+s,i-u-f),d.setFromRect(c),c.set(0,p,s,u+p),c.divide(n,_),this.Quad3(d,c)}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,s),vec3.copy(this._cam,l),vec3.copy(this._look,o),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,s=e+o-n,u=t+o-i,p=r+o+n,f=a+o+i,h=2*n,g=2*i;d.set(s+i,u-n,p+i,f-n,p-i-h,f+n-g,s-i+h,u+n+g),c.set(_,0,l,0),this.Quad3(d,c)}TexturedLinePreCalc_LineCap1(e,t,r,a,i,n,_,l){const o=this._lineOffset,s=e+o-n,u=t+o-i,p=r+o+n,f=a+o+i;d.set(s+i,u-n,p+i,f-n,p-i,f+n,s-i,u+n),c.set(_,0,l,0),this.Quad3(d,c)}TexturedLinePreCalc_LineCap0(e,t,r,a,i,n,_,l){const o=this._lineOffset,s=e+o,u=t+o,p=r+o,f=a+o;d.set(s+i,u-n,p+i,f-n,p-i,f+n,s-i,u+n),c.set(_,0,l,0),this.Quad3(d,c)}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(){2<=this.GetWebGLVersionNumber()&&this._gl["bindVertexArray"](this._dummyVao)}Finish(){this.EndBatch(),2<=this.GetWebGLVersionNumber()&&this._gl["bindVertexArray"](null),this._gl.flush(),this._frameNumber++}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._shaderPrograms)e.Release();C3.clearArray(this._shaderPrograms),this._shaderProgramsByName.clear()}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)=>p.add({resolve:t,checkFunc:e}));return-1===f&&(f=self.requestAnimationFrame(t)),r}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}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}GetContext(){return this._gl}GetNamedBlend(e){const t=this._gl;let r=t.ONE,a=t.ONE_MINUS_SRC_ALPHA;switch(e){case"normal":r=t.ONE,a=t.ONE_MINUS_SRC_ALPHA;break;case"additive":r=t.ONE,a=t.ONE;break;case"copy":r=t.ONE,a=t.ZERO;break;case"destination-over":r=t.ONE_MINUS_DST_ALPHA,a=t.ONE;break;case"source-in":r=t.DST_ALPHA,a=t.ZERO;break;case"destination-in":r=t.ZERO,a=t.SRC_ALPHA;break;case"source-out":r=t.ONE_MINUS_DST_ALPHA,a=t.ZERO;break;case"destination-out":r=t.ZERO,a=t.ONE_MINUS_SRC_ALPHA;break;case"source-atop":r=t.DST_ALPHA,a=t.ONE_MINUS_SRC_ALPHA;break;case"destination-atop":r=t.ONE_MINUS_DST_ALPHA,a=t.SRC_ALPHA;break;default:throw new Error("invalid blend name");}return{srcBlend:r,destBlend:a}}GetBlendByIndex(e){const t=this._gl;let r=t.ONE,a=t.ONE_MINUS_SRC_ALPHA;switch(e){case 0:r=t.ONE,a=t.ONE_MINUS_SRC_ALPHA;break;case 1:r=t.ONE,a=t.ONE;break;case 3:r=t.ONE,a=t.ZERO;break;case 4:r=t.ONE_MINUS_DST_ALPHA,a=t.ONE;break;case 5:r=t.DST_ALPHA,a=t.ZERO;break;case 6:r=t.ZERO,a=t.SRC_ALPHA;break;case 7:r=t.ONE_MINUS_DST_ALPHA,a=t.ZERO;break;case 8:r=t.ZERO,a=t.ONE_MINUS_SRC_ALPHA;break;case 9:r=t.DST_ALPHA,a=t.ONE_MINUS_SRC_ALPHA;break;case 10:r=t.ONE_MINUS_DST_ALPHA,a=t.SRC_ALPHA;break;default:throw new Error("invalid blend index");}return{srcBlend:r,destBlend:a}}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 d=b[b.length-1].toLowerCase();return c.get(d)||""}const b=new Set(["local","remote"]),c=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"]]);C3.AssetManager=class extends C3.DefendedBase{constructor(a,c){if(super(),!b.has(c.defaultLoadPolicy))throw new Error("invalid load policy");if(this._runtime=a,this._localUrlBlobs=new Map,this._localBlobUrlCache=new Map,this._isCordova=!!c.isCordova,this._isWKWebView=!!c.isWKWebView,this._supportedAudioFormats=c.supportedAudioFormats||{},this._audioFiles=new Map,this._preloadSounds=!1,this._mediaSubfolder="",this._fontsSubfolder="",this._iconsSubfolder="",this._defaultLoadPolicy=c.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)),c.localUrlBlobs)for(const[a,b]of Object.entries(c.localUrlBlobs))this._localUrlBlobs.set(a,b)}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}FetchJson(a){return this.FetchBlob(a,this._defaultLoadPolicy).then((a)=>C3.BlobToJson(a))}FetchBlob(a,b){b=b||this._defaultLoadPolicy;const c=this._localUrlBlobs.get(a);return c?Promise.resolve(c):this._isCordova&&C3.IsRelativeURL(a)?this.CordovaFetchLocalFileAsBlob(a):"local"===b?this._promiseThrottle.Add(()=>C3.FetchBlob(a)):C3.FetchBlob(a)}_HasLocalURLBlob(a){return this._localUrlBlobs.has(a)}_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){const b=await this.CordovaFetchLocalFileAsBlob(a);return URL.createObjectURL(b)}CordovaFetchLocalFileAsArrayBuffer(a){return this._CordovaFetchLocalFileAs(a,"buffer")}GetLocalUrlAsBlobUrl(a){const b=this._localUrlBlobs.get(a);if(!b)return a;let c=this._localBlobUrlCache.get(b);return c||(c=URL.createObjectURL(b),this._localBlobUrlCache.set(b,c)),c}GetMediaFileUrl(a){return this._runtime.IsPreview()||"playable-ad"===this._runtime.GetExportType()?this.GetLocalUrlAsBlobUrl(a.toLowerCase()):this._mediaSubfolder+a}GetProjectFileUrl(a){return this._runtime.IsPreview()?this.GetLocalUrlAsBlobUrl(a.toLowerCase()):a}LoadProjectFileUrl(a){return this._runtime.IsPreview()?Promise.resolve(this.GetLocalUrlAsBlobUrl(a.toLowerCase())):this._isCordova?this.CordovaFetchLocalFileAsBlobURL(a.toLowerCase()):Promise.resolve(a.toLowerCase())}LoadImage(a){if(a.loadPolicy&&!b.has(a.loadPolicy))throw new Error("invalid load policy");let c=this._assetsByUrl.get(a.url);return c?c:(c=C3.New(C3.ImageAsset,this,{url:a.url,size:a.size||0,loadPolicy:a.loadPolicy||this._defaultLoadPolicy}),this._allAssets.push(c),this._assetsByUrl.set(c.GetURL(),c),this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=c.GetSize(),this._loadPromises.push(c.Load().then(()=>this._AddLoadedSize(c.GetSize())))),c)}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){const c=await this.LoadProjectFileUrl(this._fontsSubfolder+b),d=new FontFace(a,`url('${c}')`);this._runtime.IsInWorker()?self.fonts.add(d):document.fonts.add(d);try{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[]}}}
// 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._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}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();if(b){const b=this._runtime.GetWebGLRenderer().GetBlendByIndex(a);this._srcBlend=b.srcBlend,this._destBlend=b.destBlend}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()*self.devicePixelRatio)}_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()*self.devicePixelRatio)}_LayerToCanvas(b,c,d,e){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 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.GetAngle();if(0!==j){b-=h,c-=i;const d=Math.cos(-j),e=Math.sin(-j),f=b*d-c*e;c=c*d+b*e,b=f,b+=h,c+=i}const k=this.GetNormalScale(),l=this._runtime.GetViewportWidth()/k,m=this._runtime.GetViewportHeight()/k,n=b-(h-l/2),o=c-(i-m/2);return[n*e,o*e]}_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()}}}
// 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){super(),this._layoutManager=a,this._runtime=a.GetRuntime(),this._name=b[0],this._originalWidth=b[1],this._originalHeight=b[2],this._width=b[1],this._height=b[2],this._isUnboundedScrolling=!!b[3],this._eventSheetName=b[4],this._eventSheet=null,this._sid=b[5],this._scrollX=0,this._scrollY=0,this._scale=1,this._angle=0,this._initialObjectClasses=new Set,this._textureLoadedTypes=new Set,this._createdInstances=[],this._initialNonWorld=[],this._layers=[],this._layersByName=new Map,this._layersBySid=new Map,this._effectList=C3.New(C3.EffectList,this,b[8]),this._curRenderTarget=null,this._persistData={},this._isFirstVisit=!0;for(const c of b[6]){const a=C3.Layer.Create(this,this._layers.length,c);this._layers.push(a),this._layersByName.set(a.GetName().toLowerCase(),a),this._layersBySid.set(a.GetSID(),a)}for(const c of b[7]){const a=this._runtime.GetObjectClassByIndex(c[1]);if(!a)throw new Error("missing nonworld object class");a.GetDefaultInstanceData()||a.SetDefaultInstanceData(c),this._initialNonWorld.push(c),this._AddInitialObjectClass(a)}}Release(){for(const a of this._layers)a.Release();C3.clearArray(this._layers),this._eventSheet=null,this._layoutManager=null,this._runtime=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}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();!b||b.IsContextLost()||this._textureLoadedTypes.has(a)||(this._textureLoadedTypes.add(a),await a.LoadTextures(b),a.OnDynamicTextureLoadComplete(),this._runtime.UpdateRender())}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(),this._runtime.IsLoadingState())this._runtime._TriggerOnCreateAfterLoad(this._createdInstances);else for(const a of this._createdInstances)a._TriggerOnCreated();C3.clearArray(this._createdInstances),a&&this._runtime.Dispatcher().dispatchEvent(new C3.Event("beforefirstlayoutstart")),this._runtime.IsLoadingState()||(await b.TriggerAsync(C3.Plugins.System.Cnds.OnLayoutStart,null)),a&&this._runtime.Dispatcher().dispatchEvent(new C3.Event("afterfirstlayoutstart")),d._RunQueuedTriggers(c),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)),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()||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){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)}}}}
// 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,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=Math.floor(a),this._allLayouts[a]}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):a.screenRect.swapTopBottom()),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),!a.inst&&1==e%2&&a.screenRect.swapTopBottom()):(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()),a.inst||a.preDraw||a.screenRect.swapTopBottom(),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)),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);const r=o.didChangeTransform;return b(o),m=!1,r}}
// c3/timelines/timeline.js
"use strict";{const a=0,b=C3.nextHighestPowerOfTwo(1);C3.Timeline=class extends C3.DefendedBase{constructor(b,c){super(),this._runtime=c.GetRuntime(),this._timelineManager=c,this._name=b[a],this._totalTime=b[1],this._step=b[2],this._interpolationMode=b[3],this._resultMode=b[4],this._tracks=[];for(const a of b[5]){const b=C3.Track.Create(this,a);this._tracks.push(b)}this._playheadTime=C3.New(C3.KahanSum),this._playheadTime.Set(0),this._playbackRate=1,this._isPlaying=!1,this._IsScheduled=!1,this._initialStateSet=!1,this._complete=!0,this._released=!1,this._markedForRemoval=!1,this._completedTick=-1,this._on_completed_callbacks=null,this._on_started_callbacks=null,this._startedTriggers=null,this._finishedTriggers=null}static Create(a,b){const c=C3.New(C3.Timeline,a,b);return c.SetStartedTriggers([C3.Plugins.Timeline.Cnds.OnTimelineStarted,C3.Plugins.Timeline.Cnds.OnTimelineStartedByName,C3.Plugins.Timeline.Cnds.OnAnyTimelineStarted]),c.SetFinishedTriggers([C3.Plugins.Timeline.Cnds.OnTimelineFinished,C3.Plugins.Timeline.Cnds.OnTimelineFinishedByName,C3.Plugins.Timeline.Cnds.OnAnyTimelineFinished]),c}static GetDefaultInitData(){const b=[];return b[a]="",b[1]=0,b[2]=0,b[3]="",b[4]="",b[5]=[],b}static CreateEmpty(a){const b=this.GetDefaultInitData();return this.Create(b,a)}static get WORLD_INSTANCE_BOX_CHANGE(){return 1}static get LAYOUT_RENDER_CHANGE(){return b}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this),this._timelineManager.CompleteTimeline(this);for(const a of this._tracks)a.Release();C3.clearArray(this._tracks),this._tracks=null,this._on_completed_callbacks&&(C3.clearArray(this._on_completed_callbacks),this._on_completed_callbacks=null),this._on_started_callbacks&&(C3.clearArray(this._on_started_callbacks),this._on_started_callbacks=null),this._runtime=null,this._timelineManager=null,this._released=!0}}CleanCaches(){for(const a of this._tracks)a.CleanCaches()}GetRuntime(){return this._runtime}SetName(a){this._name=a}GetName(){return this._name}SetTotalTime(a){this._totalTime=a}GetTotalTime(){return this._totalTime}SetStep(a){this._step=a}GetStep(){return this._step}SetInterpolationMode(a){this._interpolationMode=a}GetInterpolationMode(){return this._interpolationMode}SetResultMode(a){this._resultMode=a}GetResultMode(){return this._resultMode}AddTrack(){const a=C3.Track.CreateEmpty(this);return this._tracks.push(a),a}GetTracks(){return this._tracks}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)}}OnStarted(){if(this._on_started_callbacks)for(const a of this._on_started_callbacks)a(this);if(this._startedTriggers){C3.Plugins.Timeline.Cnds.SetStartingTimeline(this);for(const a of this._startedTriggers)this.Trigger(a);C3.Plugins.Timeline.Cnds.SetStartingTimeline(null)}}OnCompleted(){if(this._completedTick=this._runtime.GetTickCount(),this._on_completed_callbacks)for(const a of this._on_completed_callbacks)a(this);if(this._finishedTriggers){C3.Plugins.Timeline.Cnds.SetFinishingTimeline(this);for(const a of this._finishedTriggers)this.Trigger(a);C3.Plugins.Timeline.Cnds.SetFinishingTimeline(null)}}SetPlaying(a){this._isPlaying=a}IsPlaying(){return!(this._completedTick!==this._runtime.GetTickCount())||this._isPlaying}SetScheduled(a){this._IsScheduled=a}IsScheduled(){return this._IsScheduled}SetComplete(a){this._complete=a;const b=this.GetTime();(0>=b||b>=this._totalTime)&&(this._complete=!0)}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(a){this._markedForRemoval=a}IsMarkedForRemoval(){return this._markedForRemoval}InitialStateSet(){return this._initialStateSet}GetPropertyTrack(a){for(const b of this._tracks)for(const c of b.GetPropertyTracks())if(c.GetPropertyName()===a)return c}Trigger(a){const b=this._timelineManager.GetPluginInstance();this.GetRuntime().Trigger(a,b)}SetStartedTriggers(a){this._startedTriggers=a}SetFinishedTriggers(a){this._finishedTriggers=a}GetTime(){return this._playheadTime.Get()}SetTime(a){if(this._playheadTime.Set(a),0>this._playheadTime.Get()&&this._playheadTime.Set(0),this._playheadTime.Get()>=this._totalTime&&this._playheadTime.Set(this._totalTime),!this.IsPlaying()&&!this.IsScheduled()&&this._initialStateSet)this.SetComplete(!1);else if(!this.IsPlaying()&&!this.IsScheduled()&&!this._initialStateSet){this._initialStateSet=!0;for(const a of this._tracks)a.SetInitialState()}else this.IsPlaying()?this.Stop():this.IsScheduled()&&(this._timelineManager.DeScheduleTimeline(this),this.SetComplete(!1));let b=!1;for(const c of this._tracks){c.SetResumeState();const a=c.Interpolate(this._playheadTime.Get());!b&&a&&(b=!0)}b&&this.GetRuntime().UpdateRender()}SetResultMode(a){this._resultMode=a;for(const b of this._tracks)b.SetResultMode(a)}SetEase(a){this._ease=a;for(const b of this._tracks)b.SetEase(resultMode)}SetPlaybackRate(a){return this._playbackRate=a}IsForwardPlayBack(){return 0<this._playbackRate}Resume(){if(!this.IsReleased()){if(this.IsForwardPlayBack()){if(this._playheadTime.Get()>=this._totalTime)return;}else if(0>=this._playheadTime.Get())return;this.Play(!0)}}Play(a=!1){this.IsReleased()||this.IsScheduled()||this.IsPlaying()||!this.IsComplete()&&!a||this._timelineManager.ScheduleTimeline(this)}Stop(a=!1){this.IsReleased()||(this.SetComplete(a),this._timelineManager.CompleteTimeline(this))}Reset(){if(this.IsReleased())return;if(!this.IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);this.Stop(!0),this._playheadTime.Set(0);let a=!1;for(const b of this._tracks){const c=b.Interpolate(this._playheadTime.Get());!a&&c&&(a=!0)}a&&this.GetRuntime().UpdateRender()}SetInitialState(){if(this.SetPlaying(!0),this.SetScheduled(!1),this.OnStarted(),this.IsComplete()){this._completedTick=-1,this._initialStateSet=!0,this.IsForwardPlayBack()?this._playheadTime.Set(0):this._playheadTime.Set(this._totalTime);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(c=this.IsForwardPlayBack()?this._playheadTime.Get()>=this._totalTime:0>=this._playheadTime.Get(),c){this.IsForwardPlayBack()?this._playheadTime.Set(this._totalTime):this._playheadTime.Set(0);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());!a&&c&&(a=!0)}return a}}}}
// c3/timelines/track.js
"use strict";{const a=0;C3.Track=class extends C3.DefendedBase{constructor(b,c){super(),this._timeline=b,this._instanceUid=c[a][2],this._interpolationMode=c[1],this._resultMode=c[2],this._enabled=!!c[3],this._keyframes=[];for(const a of c[4]){const b=C3.Keyframe.Create(this,a);this._IsKeyFrameEnabled(b)&&this._keyframes.push(b)}this._propertyTracks=[];for(const a of c[5]){const b=C3.PropertyTrack.Create(this,a);b.GetEnable()&&this._propertyTracks.push(b)}this._instance=null,this._worldInfo=null,this._lastPositionSet=!1}static Create(a,b){return C3.New(C3.Track,a,b)}static CreateEmpty(b){const c=[];return c[a]=[],c[a][2]=-1,c[1]="default",c[2]="default",c[3]=1,c[4]=[],c[5]=[],this.Create(b,c)}Release(){this._timeline=null,this._instance=null,this._worldInfo=null;for(const a of this._keyframes)a.Release();C3.clearArray(this._keyframes),this._keyframes=null;for(const a of this._propertyTracks)a.Release();C3.clearArray(this._propertyTracks),this._propertyTracks=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()}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return!!this._instance&&!this._instance.IsDestroyed()}SetInstanceUID(a){this._instanceUid=a}GetInstance(){return this._instance&&this.IsInstanceValid()?this._instance:(this._instance=this.GetRuntime().GetInstanceByUID(this._instanceUid),this._instance)}GetWorldInfo(){return this._worldInfo&&this.IsInstanceValid()?this._worldInfo:(this._worldInfo=this.GetInstance().GetWorldInfo(),this._worldInfo)}SetInterpolationMode(a){this._interpolationMode=a}GetInterpolationMode(){return this._interpolationMode}SetResultMode(a){this._resultMode=a;for(const b of this._propertyTracks)b.SetResultMode(a)}GetResultMode(){return this._resultMode}SetEase(){for(const a of this._keyframes)a.SetEase(resultMode);for(const a of this._propertyTracks)a.SetEase(resultMode)}SetEnable(a){this._enabled=!!a}GetEnable(){return this._enabled}AddKeyframe(){const a=C3.Keyframe.CreateEmpty(this);return this._keyframes.push(a),a}GetKeyframes(){return this._keyframes}SortKeyframes(){this._keyframes.sort((c,a)=>c.GetTime()-a.GetTime())}AddPropertyTrack(a,b){const c=C3.PropertyTrack.CreateEmpty(this,a,b);return this._propertyTracks.push(c),c}GetPropertyTracks(){return this._propertyTracks}SetInitialState(){if(this.MaybeGetInstance(),!!this.IsInstanceValid()){this._lastPositionSet=!1;for(const a of this._propertyTracks)a.SetInitialState();this.GetTimeline().IsForwardPlayBack()?this.Interpolate(0):this.Interpolate(this.GetTimeline().GetTotalTime())}}SetResumeState(){if(this.MaybeGetInstance(),!!this.IsInstanceValid())for(const a of this._propertyTracks)a.SetResumeState()}SetEndState(){if((this.MaybeGetInstance(),!!this.IsInstanceValid())&&!this._lastPositionSet){this._lastPositionSet=!0;const a=this._timeline.GetTime(),b=this._timeline.GetTotalTime();a>=b?this.Interpolate(b):0>=a&&this.Interpolate(0)}}DeleteKeyframes(a){for(const b of this._keyframes){if(!a(b))continue;const c=this._keyframes.indexOf(b);-1!==c&&(b.Release(),this._keyframes.splice(c,1))}this.SortKeyframes()}DeletePropertyKeyframes(a){for(const b of this._propertyTracks)b.DeletePropertyKeyframes(a)}Interpolate(a){if(this.MaybeGetInstance(),!this.IsInstanceValid())return!1;let b=!1,c=!1;for(const d of this._propertyTracks){const e=d.Interpolate(a);b||0==(e&C3.Timeline.WORLD_INSTANCE_BOX_CHANGE)||(b=!0),c||0==(e&C3.Timeline.LAYOUT_RENDER_CHANGE)||(c=!0)}return b&&this.GetWorldInfo().SetBboxChanged(),c}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)}}_IsKeyFrameEnabled(a){return!!this.GetEnable()&&!!a.GetEnable()}}}
// c3/timelines/keyframe.js
"use strict";{const a=0;C3.Keyframe=class extends C3.DefendedBase{constructor(b,c){super(),this._track=b,this._time=c[a],this._ease=c[1],this._enable=!!c[2]}static Create(a,b){return C3.New(C3.Keyframe,a,b)}static CreateEmpty(b){const c=[];return c[a]=0,c[1]="linear",c[2]=1,this.Create(b,c)}Release(){this._track=null}GetRuntime(){return this._track.GetRuntime()}SetTime(a){this._time=a,this._track.SortKeyframes()}GetTime(){return this._time}SetEase(a){this._ease=a}GetEase(){return this._ease}SetEnable(a){this._enable=!!a}GetEnable(){return this._enable}}}
// c3/timelines/propertyTrack.js
"use strict";{const a=0;C3.PropertyTrack=class extends C3.DefendedBase{constructor(b,c){super(),this._track=b,this._sourceAdapter=C3.PropertyTrack.CreateSourceAdapter(this,c[a]),this._property=c[1],this._type=c[2],this._min=c[3],this._max=c[4],this._interpolationMode=c[5],this._resultMode=c[6],this._enabled=!!c[7],this._propertyKeyframes=[];for(const a of c[8]){const b=C3.PropertyKeyframe.Create(this,a);this._IsPropertyKeyFrameEnabled(b)&&this._propertyKeyframes.push(b)}this._BuildPropertyKeyframeTimeMap()}static Create(a,b){return C3.New(C3.PropertyTrack,a,b)}static CreateEmpty(b,c,d){const e=[];if(e[a]=[],e[a][0]=c,d)for(let b=0;b<d.length;b++)e[a][b+1]=d[b];return e[1]="",e[2]="",e[3]=NaN,e[4]=NaN,e[5]="default",e[6]="default",e[7]=1,e[8]=[],this.Create(b,e)}static CreateSourceAdapter(a,b){const c=b[0];return"behavior"===c?C3.New(C3.PropertyTrack.BehaviorSourceAdapter,a,b):"effect"===c?C3.New(C3.PropertyTrack.EffectSourceAdapter,a,b):"instance-variable"===c?C3.New(C3.PropertyTrack.InstanceVariableSourceAdapter,a,b):"plugin"===c?C3.New(C3.PropertyTrack.PluginSourceAdapter,a,b):"world-instance"===c?C3.New(C3.PropertyTrack.WorldInstanceSourceAdapter,a,b):"value"===c?C3.New(C3.PropertyTrack.ValueSourceAdapter,a,b):void 0}Release(){this._track=null,this._sourceAdapter.Release(),this._sourceAdapter=null;for(const a of this._propertyKeyframes)a.Release();C3.clearArray(this._propertyKeyframes),this._propertyKeyframes=null,this._propertyKeyframeTimeMap.clear(),this._propertyKeyframeTimeMap=null}CleanCaches(){this._sourceAdapter.CleanCaches()}GetTrack(){return this._track}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetSourceAdapter(){return this._sourceAdapter}GetSourceAdapterValue(){return this._sourceAdapter.GetValue()}SetPropertyName(a){this._property=a}GetPropertyName(){return this._property}SetPropertyType(a){this._type=a}GetPropertyType(){return this._type}GetPropertyKeyframeType(){return this._GetFirstKeyframe().GetType()}SetMin(a){this._min=a}GetMin(){return this._min}SetMax(a){this._max=a}GetMax(){return this._max}SetEnable(a){this._enabled=!!a}GetEnable(){return this._enabled}SetInterpolationMode(a){this._interpolationMode=a}GetInterpolationMode(){return this._interpolationMode}SetResultMode(a){this._resultMode=a}GetResultMode(){return this._resultMode}SetEase(a){for(const b of this._propertyKeyframes)b.SetEase(a)}AddPropertyKeyframe(){const a=C3.PropertyKeyframe.CreateEmpty(this);return this._propertyKeyframes.push(a),this._BuildPropertyKeyframeTimeMap(),a}GetPropertyKeyframes(){return this._propertyKeyframes}_BuildPropertyKeyframeTimeMap(){this._propertyKeyframeTimeMap||(this._propertyKeyframeTimeMap=new Map),this.SortPropertyKeyFrames();for(const a of this._track.GetKeyframes()){const b=a.GetTime(),c=this._GetKeyFrameAtTime(b);c&&this._propertyKeyframeTimeMap.set(b,c)}}SortPropertyKeyFrames(){this._propertyKeyframes.sort((c,a)=>c.GetTime()-a.GetTime())}_IsPropertyKeyFrameEnabled(a){if(!this.GetEnable())return!1;if(!a.GetEnable())return!1;const b=a.GetMasterKeyframe();if(!b)return!1;const c=this.GetTrack();return!!c._IsKeyFrameEnabled(b)}_GetKeyFrameAtTime(a){for(const b of this._propertyKeyframes)if(b.GetTime()===a)return b}_GetKeyFrameAtTimeFromCache(a){return this._propertyKeyframeTimeMap.get(a)}_GetFirstKeyframe(){return this._propertyKeyframes[0]}_GetLastKeyframe(){return this._propertyKeyframes[this._propertyKeyframes.length-1]}_GetFirstKeyFrameHigherThan(a){for(const b of this._propertyKeyframes)if(b.GetTime()>a)return b}_GetFirstKeyFrameHigherOrEqualThan(a){for(const b of this._propertyKeyframes)if(b.GetTime()>=a)return b}_GetFirstKeyFrameLowerOrEqualThan(a){for(let b=this._propertyKeyframes.length-1;0<=b;b--){const c=this._propertyKeyframes[b];if(c.GetTime()<=a)return c}}SetInitialState(){this._sourceAdapter.SetInitialState()}SetResumeState(){this._sourceAdapter.SetResumeState()}GetStartPropertyKeyframeForTime(a){let b=this._GetKeyFrameAtTimeFromCache(a);return b||(b=this._GetFirstKeyFrameLowerOrEqualThan(a)),b}GetEndPropertyKeyframeForTime(a){const b=this._GetKeyFrameAtTimeFromCache(a);return b?this._GetFirstKeyFrameHigherThan(a):this._GetFirstKeyFrameHigherOrEqualThan(a)}Interpolate(a){let b,c=this._GetKeyFrameAtTimeFromCache(a);return c?b=this._GetFirstKeyFrameHigherThan(a):(c=this._GetFirstKeyFrameLowerOrEqualThan(a),b=this._GetFirstKeyFrameHigherOrEqualThan(a)),this._sourceAdapter.Interpolate(a,c,b)}DeletePropertyKeyframes(a){for(const b of this._propertyKeyframes){if(!a(b))continue;const c=this._propertyKeyframes.indexOf(b);-1!==c&&(b.Release(),this._propertyKeyframes.splice(c,1))}this.SortPropertyKeyFrames()}SaveState(){this._sourceAdapter.SaveState()}CompareInitialStateWithCurrent(){const a=this._sourceAdapter.CompareInitialStateWithCurrent();if(a){const a=this._GetFirstKeyframe(),b=this._sourceAdapter.GetCurrentState();a.SetAbsoluteValue(b)}}CompareSaveStateWithCurrent(){const a=this._sourceAdapter.CompareSaveStateWithCurrent();return a&&this.AddPropertyKeyframeAtCurrentTime(),this._sourceAdapter.ClearSaveState(),a}AddPropertyKeyframeAtCurrentTime(){const a=this.GetTimeline().GetTime(),b=this.GetStartPropertyKeyframeForTime(a),c=this.AddPropertyKeyframe(),d=this.GetSourceAdapter();c.SetValue(d.GetValueAtTime()),c.SetAbsoluteValue(d.GetCurrentState()),c.SetType(b.GetType()),c.SetTime(a),c.SetEase(b.GetEase()),c.SetEnable(!0)}}}
// c3/timelines/propertyKeyframe.js
"use strict";{const a=0;C3.PropertyKeyframe=class extends C3.DefendedBase{constructor(b,c){super(),this._propertyTrack=b,this._value=c[a][0],this._aValue=c[a][1],this._type=c[a][2],this._time=c[1],this._ease=c[2],this._enable=!!c[3],this._masterKeyframe=null;for(let a of this._propertyTrack.GetTrack().GetKeyframes())if(a.GetTime()===this._time){this._masterKeyframe=a;break}}static Create(a,b){return C3.New(C3.PropertyKeyframe,a,b)}static CreateEmpty(b){const c=[];return c[a]=[],c[a][0]=0,c[a][1]=0,c[a][2]="",c[1]=0,c[2]="linear",c[3]=1,this.Create(b,c)}Release(){this._propertyTrack=null,this._masterKeyframe=null}GetRuntime(){return this._propertyTrack.GetRuntime()}SetTime(a){this._time=a,this._propertyTrack._BuildPropertyKeyframeTimeMap()}GetTime(){return this._time}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}GetValue(){return this._value}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}GetAbsoluteValue(){return this._aValue}GetValueWithResultMode(){const a=this._propertyTrack.GetResultMode();if("relative"===a)return this.GetValue();return"absolute"===a?this.GetAbsoluteValue():void 0}SetEase(a){this._ease=a}GetEase(){return this._ease}SetEnable(a){this._enable=!!a}GetEnable(){return this._enable}SetType(a){this._type=a}GetType(){return this._type}GetMasterKeyframe(){return this._masterKeyframe}}}
// c3/timelines/timelineManager.js
"use strict";C3.TimelineManager=class extends C3.DefendedBase{constructor(a){super(),this._runtime=a,this._pluginInstance=null,this._timelines=[],this._timelinesByName=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()}Release(){const a=this._runtime.Dispatcher();a.removeEventListener("tick",this._tickFunc),this._tickFunc=null,a.removeEventListener("tick2",this._tick2Func),this._tick2Func=null,a.removeEventListener("beforelayoutchange",this._beforeLayoutChange),this._beforeLayoutChange=null,a.removeEventListener("layoutchange",this._layoutChange),this._layoutChange=null,this._runtime=null;for(const a of this._timelines)a.Stop(),a.Release();C3.clearArray(this._timelines),this._timelines=null,C3.clearArray(this._scheduledTimelines),this._scheduledTimelines=null,C3.clearArray(this._playingTimelines),this._playingTimelines=null,this._timelinesByName.clear(),this._timelinesByName=null}AddRuntimeListeners(){const a=this._runtime.Dispatcher();a.addEventListener("beforelayoutchange",this._beforeLayoutChange),a.addEventListener("layoutchange",this._layoutChange)}Create(a){this.Add(C3.Timeline.Create(a,this))}Add(a){this._timelines.push(a),this._timelinesByName.set(a.GetName(),a)}GetRuntime(){return this._runtime}SetPluginInstance(a){this._pluginInstance=a}GetPluginInstance(){return this._pluginInstance}GetTimelines(){return this._timelines}GetTimelineByIndex(a){const b=C3.clamp(Math.floor(a),0,this._timelines.length-1);return this._timelines[b]?this._timelines[b]:void 0}GetTimelineByName(a){return this._timelinesByName.has(a)?this._timelinesByName.get(a):void 0}ScheduleTimeline(a){a.SetPlaying(!1),a.SetScheduled(!0),a.SetMarkedForRemoval(!1),this._scheduledTimelines.push(a),this._MaybeAddRuntimeListeners()}DeScheduleTimeline(a){const b=this._scheduledTimelines.indexOf(a);a.SetPlaying(!1),a.SetScheduled(!1);-1===b||(this._scheduledTimelines.splice(b,1),this._MaybeRemoveRuntimeListeners())}CompleteTimeline(a){a.SetPlaying(!1),a.SetScheduled(!1),a.SetMarkedForRemoval(!0)}_OnTick(){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(){for(const a of this._playingTimelines){if(!a.IsMarkedForRemoval())continue;const b=this._playingTimelines.indexOf(a);-1===b||this._playingTimelines.splice(b,1)}this._MaybeRemoveRuntimeListeners()}_MaybeAddRuntimeListeners(){if(!this._hasRuntimeListeners){const a=this._runtime.Dispatcher();a.addEventListener("tick",this._tickFunc),a.addEventListener("tick2",this._tick2Func),this._hasRuntimeListeners=!0}}_MaybeRemoveRuntimeListeners(){if(!this._playingTimelines.length&&!this._scheduledTimelines.length&&!this._isTickingTimelines){const a=this._runtime.Dispatcher();a.removeEventListener("tick",this._tickFunc),a.removeEventListener("tick2",this._tick2Func),this._hasRuntimeListeners=!1}}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop());for(;this._playingTimelines.length;)this.CompleteTimeline(this._playingTimelines.pop());this._MaybeRemoveRuntimeListeners();for(const a of this._timelines)a.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}};
// c3/timelines/propertySourceAdapters/propertySourceAdapter.js
"use strict";C3.PropertyTrack.PropertySourceAdapter=class{constructor(){}static GetValueAtTime(a){const b=a.GetTrack(),c=b.GetTimeline().GetTime(),d=a.GetStartPropertyKeyframeForTime(c),e=a.GetEndPropertyKeyframeForTime(c),f=C3.PropertyTrack.PropertySourceAdapter,g=f.GetInterpolateFunc(a);return g(c,d,e,a)}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(a){const b=a.GetPropertyKeyframeType();return"numeric"===b?C3.PropertyTrack.NumericTypeAdapter.Interpolate:"angle"===b?C3.PropertyTrack.AngleTypeAdapter.Interpolate:"boolean"===b?C3.PropertyTrack.BooleanTypeAdapter.Interpolate:"color"===b?C3.PropertyTrack.ColorTypeAdapter.Interpolate:"text"===b?C3.PropertyTrack.TextTypeAdapter.Interpolate:void 0}static GetWillChangeFunc(a){const b=a.GetPropertyKeyframeType();return"numeric"===b?C3.PropertyTrack.NumericTypeAdapter.WillChange:"angle"===b?C3.PropertyTrack.AngleTypeAdapter.WillChange:"boolean"===b?C3.PropertyTrack.BooleanTypeAdapter.WillChange:"color"===b?C3.PropertyTrack.ColorTypeAdapter.WillChange:"text"===b?C3.PropertyTrack.TextTypeAdapter.WillChange:void 0}};
// c3/timelines/propertySourceAdapters/behaviorSourceAdapter.js
"use strict";{class a{constructor(a,b){this._propertyTrack=a,this._track=a.GetTrack(),this._sid=b[1],this._index=b[2],this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null),this._propertyTrack=null,this._track=null}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){if(this._propertyAdapter)return this._propertyAdapter;const b=this._GetSdkBehaviourInstance(),c=this._index,d=this._propertyTrack;let e=this._propertyTrack.GetPropertyKeyframeType();return"numeric"===e&&"combo"===d.GetPropertyType()&&(e="combo"),"combo"===e||"boolean"===e||"text"===e?this._propertyAdapter=C3.New(a.NoInterpolationPropertyAdapter,d,b,c):"numeric"===e?this._propertyAdapter=C3.New(a.NumericPropertyAdapter,d,b,c):"color"===e?this._propertyAdapter=C3.New(a.ColorPropertyAdapter,d,b,c):void 0,this._propertyAdapter}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}Interpolate(a,b,c){const d=C3.PropertyTrack.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack),e=d(a,b,c,this._propertyTrack);return this.GetPropertyAdapter().ChangeProperty(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 C3.PropertyTrack.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_GetSdkBehaviourInstance(){const a=this._track.GetInstance(),b=a.GetBehaviorIndexBySID(this._sid),c=a.GetBehaviorInstances()[b];return c.GetSdkInstance()}}C3.PropertyTrack.BehaviorSourceAdapter=a}
// c3/timelines/propertySourceAdapters/effectSourceAdapter.js
"use strict";{class a{constructor(a,b){this._propertyTrack=a,this._track=a.GetTrack(),this._name=b[1],this._index=b[2],this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null),this._propertyTrack=null,this._track=null}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){if(this._propertyAdapter)return this._propertyAdapter;const b=this._GetEffectParameters(),c=this._index,d=this._propertyTrack;let e=this._propertyTrack.GetPropertyKeyframeType();return"numeric"===e&&"combo"===d.GetPropertyType()&&(e="combo"),"combo"===e||"boolean"===e||"text"===e?this._propertyAdapter=C3.New(a.NoInterpolationPropertyAdapter,d,b,c):"numeric"===e?this._propertyAdapter=C3.New(a.NumericPropertyAdapter,d,b,c):"color"===e?this._propertyAdapter=C3.New(a.ColorPropertyAdapter,d,b,c):void 0,this._propertyAdapter}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}Interpolate(a,b,c){if(this._GetEffectParameters()){const d=C3.PropertyTrack.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack),e=d(a,b,c,this._propertyTrack);return this.GetPropertyAdapter().ChangeProperty(e)}}GetValueAtTime(){return C3.PropertyTrack.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_GetEffectParameters(){if(this._effectParams)return this._effectParams;const a=this._track.GetWorldInfo(),b=a.GetInstanceEffectList(),c=b.GetEffectList(),d=c.GetEffectTypeByName(this._name),e=d.GetIndex();return this._effectParams=b.IsEffectIndexActive(e)?b.GetEffectParametersForIndex(e):null,this._effectParams}}C3.PropertyTrack.EffectSourceAdapter=a}
// c3/timelines/propertySourceAdapters/instanceVariableSourceAdapter.js
"use strict";{class a{constructor(a,b){this._propertyTrack=a,this._track=a.GetTrack(),this._index=b[1],this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null),this._propertyTrack=null,this._track=null}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){if(this._propertyAdapter)return this._propertyAdapter;const b=this._track.GetInstance(),c=this._index,d=this._propertyTrack;switch(d.GetPropertyType()){case"boolean":this._propertyAdapter=C3.New(a.NoInterpolationPropertyAdapter,d,b,c);break;case"string":this._propertyAdapter=C3.New(a.NoInterpolationPropertyAdapter,d,b,c);break;case"number":this._propertyAdapter=C3.New(a.NumericPropertyAdapter,d,b,c);}return this._propertyAdapter}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}Interpolate(a,b,c){const d=C3.PropertyTrack.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack),e=d(a,b,c,this._propertyTrack);return this.GetPropertyAdapter().ChangeProperty(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 C3.PropertyTrack.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}}C3.PropertyTrack.InstanceVariableSourceAdapter=a}
// c3/timelines/propertySourceAdapters/pluginSourceAdapter.js
"use strict";{class a{constructor(a,b){this._propertyTrack=a,this._track=this._propertyTrack.GetTrack(),this._index=b[1],this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null),this._propertyTrack=null,this._track=null}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){if(this._propertyAdapter)return this._propertyAdapter;const b=this._GetSdkPluginInstance(),c=this._index,d=this._propertyTrack;let e=d.GetPropertyKeyframeType();return"numeric"===e&&"combo"===d.GetPropertyType()&&(e="combo"),"combo"===e||"boolean"===e||"text"===e?this._propertyAdapter=C3.New(a.NoInterpolationPropertyAdapter,d,b,c):"numeric"===e?this._propertyAdapter=C3.New(a.NumericPropertyAdapter,d,b,c):"color"===e?this._propertyAdapter=C3.New(a.ColorPropertyAdapter,d,b,c):void 0,this._propertyAdapter}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}Interpolate(a,b,c){const d=C3.PropertyTrack.PropertySourceAdapter.GetInterpolateFunc(this._propertyTrack),e=d(a,b,c,this._propertyTrack);return this.GetPropertyAdapter().ChangeProperty(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 C3.PropertyTrack.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}_GetSdkPluginInstance(){return this._track.GetInstance().GetSdkInstance()}}C3.PropertyTrack.PluginSourceAdapter=a}
// c3/timelines/propertySourceAdapters/worldInstanceSourceAdapter.js
"use strict";{class a{constructor(a){this._propertyTrack=a,this._track=a.GetTrack(),this._propertyAdapter=null}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null),this._propertyTrack=null,this._track=null}CleanCaches(){this._propertyAdapter&&this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){if(this._propertyAdapter)return this._propertyAdapter;const b=this._propertyTrack.GetPropertyName();return this._propertyAdapter="offsetColor"===b?C3.New(a.ColorPropertyAdapter,this._propertyTrack):C3.New(a.NumericPropertyAdapter,this._propertyTrack),this._propertyAdapter}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}Interpolate(a,b,c){const d=C3.PropertyTrack.PropertySourceAdapter,e=d.GetInterpolateFunc(this._propertyTrack),f=e(a,b,c,this._propertyTrack);return this.GetPropertyAdapter().ChangeProperty(f)}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 C3.PropertyTrack.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}}C3.PropertyTrack.WorldInstanceSourceAdapter=a}
// c3/timelines/propertySourceAdapters/propertyAdapter.js
"use strict";C3.PropertyTrack.PropertyAdapter=class{constructor(a){this._propertyTrack=a,this._worldInfo=a.GetTrack().GetWorldInfo(),this._property=a.GetPropertyName(),this._firstAbsoluteUpdate=!1,this._saveState=null}Release(){this._worldInfo=null,this._propertyTrack=null,this._saveState=null}CleanCaches(){this._worldInfo=null,this._saveState=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(){}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}ChangeProperty(){}_FirstKeyframeGetter(){const a=this._PickTimelinePlaybackMode(()=>this._propertyTrack._GetFirstKeyframe(),()=>this._propertyTrack._GetLastKeyframe());return a.GetAbsoluteValue()}_CurrentKeyframeGetter(){const a=this._propertyTrack.GetTimeline(),b=a.GetTime(),c=this._PickTimelinePlaybackMode(()=>this._propertyTrack._GetFirstKeyFrameLowerOrEqualThan(b),()=>this._propertyTrack._GetFirstKeyFrameHigherOrEqualThan(b));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(){}};
// c3/timelines/propertySourceAdapters/behaviorSourceAdapterProperties/colorPropertyAdapter.js
"use strict";{const a=0;class b extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._sdkBehaviourInstance=b,this._propertyIndex=c,this._lastValueR=0,this._lastValueG=0,this._lastValueB=0}Release(){this._sdkBehaviourInstance=null,super.Release()}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()}}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._sdkBehaviourInstance.GetPropertyValueByIndex(this._propertyIndex)}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return!this._CompareColors(a,this._Getter())}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&!this._CompareColors(this._saveState,this._Getter())}ChangeProperty(c){const d=this._sdkBehaviourInstance,e=this._propertyIndex,f=c[a],h=c[1],g=c[2],b=this._lastValueR,i=this._lastValueG,j=this._lastValueB;this._PickFirstAbsoluteUpdate(()=>d.SetPropertyColorOffsetValueByIndex(e,-b,-i,-j),()=>d.SetPropertyColorOffsetValueByIndex(e,-b+f,-i+h,-j+g)),this._lastValueR=f,this._lastValueG=h,this._lastValueB=g}_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())}_Getter(){const a=this._sdkBehaviourInstance,b=this._propertyIndex,c=a.GetPropertyValueByIndex(b);return this._GetColorFromArray(c)}_GetColorFromArray(b){return C3.IsInstanceOf(b,C3.Color)?b:new C3.Color(b[a],b[1],b[2])}}C3.PropertyTrack.BehaviorSourceAdapter.ColorPropertyAdapter=b}
// c3/timelines/propertySourceAdapters/behaviorSourceAdapterProperties/noInterpolationPropertyAdapter.js
"use strict";{class a extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._sdkBehaviourInstance=b,this._propertyIndex=c}Release(){this._sdkBehaviourInstance=null,super.Release()}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._sdkBehaviourInstance.GetPropertyValueByIndex(this._propertyIndex)}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=C3.PropertyTrack.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);b(this._propertyIndex,this._sdkBehaviourInstance,a,"behavior")&&this._sdkBehaviourInstance.SetPropertyValueByIndex(this._propertyIndex,a)}}C3.PropertyTrack.BehaviorSourceAdapter.NoInterpolationPropertyAdapter=a}
// c3/timelines/propertySourceAdapters/behaviorSourceAdapterProperties/numericPropertyAdapter.js
"use strict";{class a extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._sdkBehaviourInstance=b,this._propertyIndex=c,this._lastValue=0}Release(){this._sdkBehaviourInstance=null,super.Release()}SetInitialState(){this._lastValue=this._PickResultMode(()=>this._PickTimelinePlaybackMode(()=>0,()=>C3.PropertyTrack.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())})}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._sdkBehaviourInstance.GetPropertyValueByIndex(this._propertyIndex)}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=this._lastValue,c=this._sdkBehaviourInstance,d=this._propertyIndex;this._PickResultMode(()=>c.SetPropertyOffsetValueByIndex(d,a-b),()=>{this._PickFirstAbsoluteUpdate(()=>c.SetPropertyOffsetValueByIndex(d,b),()=>c.SetPropertyOffsetValueByIndex(d,a-b))}),this._lastValue=a}_GetAbsoluteInitialValue(a){return a-this.GetCurrentState()}}C3.PropertyTrack.BehaviorSourceAdapter.NumericPropertyAdapter=a}
// c3/timelines/propertySourceAdapters/effectSourceAdapterProperties/colorPropertyAdapter.js
"use strict";{const a=0;class b extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._effectParameters=b,this._parameterIndex=c,this._lastValueR=0,this._lastValueG=0,this._lastValueB=0}Release(){this._effectParameters=null,super.Release()}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()}}SetSaveState(){this._saveState=this._Getter()}GetCurrentState(){return this._effectParameters[this._parameterIndex].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())}ChangeProperty(c){const d=c[a],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.Timeline.LAYOUT_RENDER_CHANGE}_Setter(a,c,d){this._effectParameters[this._parameterIndex].addRgb(a,c,d)}_Getter(){return this._effectParameters[this._parameterIndex].clone()}_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(b){return C3.IsInstanceOf(b,C3.Color)?b:new C3.Color(b[a],b[1],b[2])}}C3.PropertyTrack.EffectSourceAdapter.ColorPropertyAdapter=b}
// c3/timelines/propertySourceAdapters/effectSourceAdapterProperties/noInterpolationPropertyAdapter.js
"use strict";{class a extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._effectParameters=b,this._parameterIndex=c}Release(){this._effectParameters=null,super.Release()}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._effectParameters[this._parameterIndex]}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=C3.PropertyTrack.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);b(this._parameterIndex,this._effectParameters,a,"effect")&&(this._effectParameters[this._parameterIndex]=a)}}C3.PropertyTrack.EffectSourceAdapter.NoInterpolationPropertyAdapter=a}
// c3/timelines/propertySourceAdapters/effectSourceAdapterProperties/numericPropertyAdapter.js
"use strict";{class a extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._effectParameters=b,this._parameterIndex=c,this._lastValue=0}Release(){this._effectParameters=null,super.Release()}SetInitialState(){this._lastValue=this._PickResultMode(()=>this._PickTimelinePlaybackMode(()=>0,()=>C3.PropertyTrack.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())})}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._effectParameters[this._parameterIndex]}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=this._lastValue;return this._PickResultMode(()=>{this._effectParameters[this._parameterIndex]+=a-b},()=>{this._PickFirstAbsoluteUpdate(()=>{this._effectParameters[this._parameterIndex]+=b},()=>{this._effectParameters[this._parameterIndex]+=a-b})}),this._lastValue=a,C3.Timeline.LAYOUT_RENDER_CHANGE}_GetAbsoluteInitialValue(a){return a-this.GetCurrentState()}}C3.PropertyTrack.EffectSourceAdapter.NumericPropertyAdapter=a}
// c3/timelines/propertySourceAdapters/instanceVariableSourceAdapterProperties/noInterpolationPropertyAdapter.js
"use strict";{class a extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._instance=b,this._instanceVariableIndex=c}Release(){this._instance=null,super.Release()}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._instance.GetInstanceVariableValue(this._instanceVariableIndex)}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=C3.PropertyTrack.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);b(this._instanceVariableIndex,this._instance,a,"instance-variable")&&this._instance.SetInstanceVariableValue(this._instanceVariableIndex,a)}}C3.PropertyTrack.InstanceVariableSourceAdapter.NoInterpolationPropertyAdapter=a}
// c3/timelines/propertySourceAdapters/instanceVariableSourceAdapterProperties/numericPropertyAdapter.js
"use strict";{class a extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._instance=b,this._instanceVariableIndex=c,this._lastValue=0}Release(){this._instance=null,super.Release()}SetInitialState(){this._lastValue=this._PickResultMode(()=>this._PickTimelinePlaybackMode(()=>0,()=>C3.PropertyTrack.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())})}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._instance.GetInstanceVariableValue(this._instanceVariableIndex)}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=this._lastValue,c=this._instance,d=this._instanceVariableIndex;this._PickResultMode(()=>c.SetInstanceVariableOffset(d,a-b),()=>{this._PickFirstAbsoluteUpdate(()=>c.SetInstanceVariableOffset(d,b),()=>c.SetInstanceVariableOffset(d,a-b))}),this._lastValue=a}_GetAbsoluteInitialValue(a){return a-this.GetCurrentState()}}C3.PropertyTrack.InstanceVariableSourceAdapter.NumericPropertyAdapter=a}
// c3/timelines/propertySourceAdapters/pluginSourceAdapterProperties/colorPropertyAdapter.js
"use strict";{const a=0;class b extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._sdkInstance=b,this._propertyIndex=c,this._lastValueR=0,this._lastValueG=0,this._lastValueB=0}Release(){this._sdkInstance=null,super.Release()}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()}}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._sdkInstance.GetPropertyValueByIndex(this._propertyIndex)}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return!this._CompareColors(a,this._Getter())}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&!this._CompareColors(this._saveState,this._Getter())}ChangeProperty(c){const d=this._sdkInstance,e=this._propertyIndex,f=c[a],h=c[1],g=c[2],b=this._lastValueR,i=this._lastValueG,j=this._lastValueB;return this._PickFirstAbsoluteUpdate(()=>d.SetPropertyColorOffsetValueByIndex(e,-b,-i,-j),()=>d.SetPropertyColorOffsetValueByIndex(e,-b+f,-i+h,-j+g)),this._lastValueR=f,this._lastValueG=h,this._lastValueB=g,C3.Timeline.LAYOUT_RENDER_CHANGE}_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())}_Getter(){const a=this._sdkInstance,b=this._propertyIndex,c=a.GetPropertyValueByIndex(b);return this._GetColorFromArray(c)}_GetColorFromArray(b){return C3.IsInstanceOf(b,C3.Color)?b:new C3.Color(b[a],b[1],b[2])}}C3.PropertyTrack.PluginSourceAdapter.ColorPropertyAdapter=b}
// c3/timelines/propertySourceAdapters/pluginSourceAdapterProperties/noInterpolationPropertyAdapter.js
"use strict";{class a extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._sdkInstance=b,this._propertyIndex=c}Release(){this._sdkInstance=null,super.Release()}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._sdkInstance.GetPropertyValueByIndex(this._propertyIndex)}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=C3.PropertyTrack.PropertySourceAdapter.GetWillChangeFunc(this._propertyTrack);if(b(this._propertyIndex,this._sdkInstance,a,"plugin"))return this._sdkInstance.SetPropertyValueByIndex(this._propertyIndex,a),C3.Timeline.LAYOUT_RENDER_CHANGE}}C3.PropertyTrack.PluginSourceAdapter.NoInterpolationPropertyAdapter=a}
// c3/timelines/propertySourceAdapters/pluginSourceAdapterProperties/numericPropertyAdapter.js
"use strict";{class a extends C3.PropertyTrack.PropertyAdapter{constructor(a,b,c){super(a),this._sdkInstance=b,this._propertyIndex=c,this._lastValue=0}Release(){this._sdkInstance=null,super.Release()}SetInitialState(){this._lastValue=this._PickResultMode(()=>this._PickTimelinePlaybackMode(()=>0,()=>C3.PropertyTrack.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())})}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._sdkInstance.GetPropertyValueByIndex(this._propertyIndex)}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=this._lastValue,c=this._sdkInstance,d=this._propertyIndex;return this._PickResultMode(()=>c.SetPropertyOffsetValueByIndex(d,a-b),()=>{this._PickFirstAbsoluteUpdate(()=>c.SetPropertyOffsetValueByIndex(d,b),()=>c.SetPropertyOffsetValueByIndex(d,a-b))}),this._lastValue=a,C3.Timeline.LAYOUT_RENDER_CHANGE}_GetAbsoluteInitialValue(a){return a-this.GetCurrentState()}}C3.PropertyTrack.PluginSourceAdapter.NumericPropertyAdapter=a}
// c3/timelines/propertySourceAdapters/worldInstanceSourceAdapterProperties/colorPropertyAdapter.js
"use strict";{const a=0;class b extends C3.PropertyTrack.PropertyAdapter{constructor(a){super(a),this._lastValueR=0,this._lastValueG=0,this._lastValueB=0}Release(){super.Release()}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()}}SetSaveState(){this._saveState=this._Getter()}GetCurrentState(){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())}ChangeProperty(c){const d=c[a],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.Timeline.LAYOUT_RENDER_CHANGE}_Getter(){return this.GetWorldInfo().GetUnpremultipliedColor().clone()}_Setter(a,c,d){this.GetWorldInfo().OffsetUnpremultipliedColorRGB(a,c,d)}_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(b){return C3.IsInstanceOf(b,C3.Color)?b:new C3.Color(b[a],b[1],b[2])}}C3.PropertyTrack.WorldInstanceSourceAdapter.ColorPropertyAdapter=b}
// c3/timelines/propertySourceAdapters/worldInstanceSourceAdapterProperties/numericPropertyAdapter.js
"use strict";{const a=new Map,b=(b,c,d)=>a.set(b,{setter:c,getter:d});b("offsetX",(a,b)=>a.OffsetX(b),(a)=>a.GetX()),b("offsetY",(a,b)=>a.OffsetY(b),(a)=>a.GetY()),b("offsetWidth",(a,b)=>a.OffsetWidth(b),(a)=>a.GetWidth()),b("offsetHeight",(a,b)=>a.OffsetHeight(b),(a)=>a.GetHeight()),b("offsetAngle",(a,b)=>a.OffsetAngle(b),(a)=>a.GetAngle()),b("offsetOpacity",(a,b)=>a.OffsetOpacity(b),(a)=>a.GetOpacity()),b("offsetOriginX",(a,b)=>a.OffsetOriginX(b),(a)=>a.GetOriginX()),b("offsetOriginY",(a,b)=>a.OffsetOriginY(b),(a)=>a.GetOriginY());class c extends C3.PropertyTrack.PropertyAdapter{constructor(b){super(b);const c=b.GetPropertyName();this._getter=a.get(c).getter,this._setter=a.get(c).setter,this._lastValue=0}Release(){super.Release(),this._getter=null,this._setter=null}SetInitialState(){this._lastValue=this._PickResultMode(()=>this._PickTimelinePlaybackMode(()=>0,()=>C3.PropertyTrack.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())})}SetSaveState(){this._saveState=this.GetCurrentState()}GetCurrentState(){return this._getter(this.GetWorldInfo())}CompareInitialStateWithCurrent(){const a=this._FirstKeyframeGetter();return a!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return!C3.IsNullOrUndefined(this._saveState)&&this._saveState!==this.GetCurrentState()}ChangeProperty(a){const b=this._lastValue,c=this.GetWorldInfo();return this._PickResultMode(()=>this._setter(c,a-b),()=>{this._PickFirstAbsoluteUpdate(()=>this._setter(c,b),()=>this._setter(c,a-b))}),this._lastValue=a,C3.Timeline.WORLD_INSTANCE_BOX_CHANGE}_GetAbsoluteInitialValue(a){return a-this.GetCurrentState()}}C3.PropertyTrack.WorldInstanceSourceAdapter.NumericPropertyAdapter=c}
// c3/timelines/propertySourceAdapters/valueSourceAdapter.js
"use strict";C3.PropertyTrack.ValueSourceAdapter=class{constructor(a){this._propertyTrack=a,this._track=a.GetTrack(),this._value=0}Release(){this._propertyTrack=null,this._track=null}SetInitialState(){this._value=this._propertyTrack._GetFirstKeyframe().GetValueWithResultMode()}SetResumeState(){}GetValue(){return this._value}Interpolate(a,b,c){const d=C3.PropertyTrack.NumericTypeAdapter.Interpolate;this._value=d(a,b,c,this._propertyTrack)}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}GetValueAtTime(){return C3.PropertyTrack.PropertySourceAdapter.GetValueAtTime(this._propertyTrack)}};
// c3/timelines/propertyTypeAdapters/numericTypeAdapter.js
"use strict";C3.PropertyTrack.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)return d._GetLastKeyframe().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=1/d.GetTimeline().GetStep();a=f(a*b)/b}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(),e=Ease.GetEase(m)((i-h)*l,j,k-j,i-h);return"integer"===d.GetPropertyType()?f(e):e}}};
// c3/timelines/propertyTypeAdapters/angleTypeAdapter.js
"use strict";C3.PropertyTrack.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)return d._GetLastKeyframe().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=1/d.GetTimeline().GetStep();a=Math.floor(a*b)/b}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/propertyTypeAdapters/booleanTypeAdapter.js
"use strict";C3.PropertyTrack.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){return c?b.GetValueWithResultMode()?1:0:d._GetLastKeyframe().GetValueWithResultMode()?1:0}};
// c3/timelines/propertyTypeAdapters/colorTypeAdapter.js
"use strict";{const a=[0,0,0],b=[0,0,0];C3.PropertyTrack.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){const b=d._GetLastKeyframe().GetValueWithResultMode();return a[0]=b[0],a[1]=b[1],a[2]=b[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=1/d.GetTimeline().GetStep();b=Math.floor(b*a)/a}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/propertyTypeAdapters/textTypeAdapter.js
"use strict";C3.PropertyTrack.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){return c?b.GetValueWithResultMode():d._GetLastKeyframe().GetValueWithResultMode()}};
// c3/timelines/tweens/tween.js
"use strict";{C3.Tween=class a extends C3.Timeline{constructor(a,b){super(a,b),this._tags=[""],this._stringTags="",this._tagsChanged=!1,this._id="",this._destroyInstanceOnComplete=!1,this._initialValueMode="start-value",this.SetStep(0),this.SetInterpolationMode("default"),this.SetStartedTriggers(null),this.SetFinishedTriggers(null)}Release(){C3.clearArray(this._tags),this._tags=null,super.Release()}GetInstance(){const a=this.GetTracks();if(a&&a.length){const b=a[0];if(b){const a=b.GetInstance();return b.IsInstanceValid()?a:null}}}SetStartValue(a,b){for(const c of this._tracks)for(const d of c._propertyTracks){if(d.GetPropertyName()!==b)continue;const c=d._GetFirstKeyframe();c.SetValue(a),c.SetAbsoluteValue(a)}}SetEndValue(a,b){for(const c of this._tracks)for(const d of c._propertyTracks){if(d.GetPropertyName()!==b)continue;const c=d._GetLastKeyframe();c.SetValue(a),c.SetAbsoluteValue(a),(this.IsPlaying()||!this.IsComplete())&&d.AddPropertyKeyframeAtCurrentTime()}}HasTags(b){if(!this._tags)return!1;if(!this._tags.length)return!1;const c=a._GetTagArray(b);return!!c&&!!c.length&&c.every(a._HasTag,this)}SetId(a){this._id=a}GetId(){return this._id}SetTags(b){this._tags=a._GetTagArray(b),this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){return this._tagsChanged&&(this._stringTags=this._tags.join(" ")),this._tagsChanged=!1,this._stringTags}SetInitialValueMode(a){this._initialValueMode=a}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(a){this._destroyInstanceOnComplete=a}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(super.OnStarted(),!this.IsComplete())for(const a of this._tracks)a.CompareSaveStateWithCurrent()}SetTime(a){this._DeleteIntermediateKeyframes(),super.SetTime(a)}SetInitialState(){if(!this.InitialStateSet()&&this.GetInitialValueMode()==="current-state")for(const a of this._tracks)a.CompareInitialStateWithCurrent();super.SetInitialState()}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)}}Tick(){const a=this.GetInstance(),b=this.GetRuntime().GetDt(a);super.Tick(b,1)}static IsPlaying(a){return a.IsPlaying()}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}static Build(a){const b=C3.Timeline.GetDefaultInitData(),c=a.runtime.GetTimelineManager(),d=C3.New(C3.Tween,b,c);C3.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]),d.SetId(a.id),d.SetTags(a.tags),d.SetInitialValueMode(a.initialValueMode),d.SetTotalTime(a.time),d.SetResultMode(a.propertyTracksConfig[0].resultMode),d.SetDestroyInstanceOnComplete(a.releaseOnComplete);const e=d.AddTrack();e.SetInstanceUID(a.instance.GetUID()),e.SetInterpolationMode("default"),e.SetResultMode(a.propertyTracksConfig[0].resultMode),e.SetEnable(!0);const f=e.AddKeyframe();f.SetTime(0),f.SetEase("noease"),f.SetEnable(!0);const g=e.AddKeyframe();g.SetTime(a.time),g.SetEase("noease"),g.SetEnable(!0);for(const b of a.propertyTracksConfig){const c=e.AddPropertyTrack(b.sourceId,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.SetValue(b.startValue),d.SetAbsoluteValue(b.startValue),d.SetType(b.valueType),d.SetTime(0),d.SetEase(b.ease),d.SetEnable(!0);const f=c.AddPropertyKeyframe();f.SetValue(b.endValue),f.SetAbsoluteValue(b.endValue),f.SetType(b.valueType),f.SetTime(a.time),f.SetEase(b.ease),f.SetEnable(!0)}return d}}}
// 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}Release(){for(const a of this._stack)a.Release();C3.clearArray(this._stack),this._objectClass=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._stack[this._index]}Clear(){this.GetCurrentSol().Clear()}PushClean(){const a=this._stack,b=++this._index;b===a.length?a.push(C3.New(C3.Sol,this)):a[b].Reset()}PushCopy(){const a=this._stack,b=++this._index;b===a.length&&a.push(C3.New(C3.Sol,this)),a[b].Copy(a[b-1])}Pop(){--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}Release(){for(const a of this._stack)a.Release();C3.clearArray(this._stack),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}};
// 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}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}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=0}Release(){C3.clearArray(this._stack),this._eventSheetManager=null,this._runtime=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._stack[this._index]}Push(){++this._index,this._index===this._stack.length&&this._stack.push([])}Pop(){--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._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=[]}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._allSheets)a._PostInit();for(const a of this._allSheets)a._UpdateDeepIncludes();for(const a of this._triggersToPostInit)a._PostInit(!1);C3.clearArray(this._triggersToPostInit)}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)}_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(){return 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;){for(const c of b.GetSubEvents())if(c instanceof C3.EventVariable&&C3.equalsNoCase(a,c.GetName()))return c;b=b.GetParent()}for(const c of this._allGlobalVars)if(C3.equalsNoCase(a,c.GetName()))return c;return null}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}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){let d=!1;if(!a.GetMainRunningLayout())return this.QueueTrigger(b,c);this._executingTriggerDepth++;for(const e of a.runningLayouts()){const a=e.GetEventSheet();if(!a)continue;this._runtime.PushCurrentLayout(e);for(const e of a.deepIncludes()){const a=e._Trigger(b,c);d=d||a}const f=a._Trigger(b,c);d=d||f,this._runtime.PopCurrentLayout()}return this._executingTriggerDepth--,d}*_DebugTrigger(a,b,c){let d=!1;if(!a.GetMainRunningLayout())return this.QueueTrigger(b,c);this._executingTriggerDepth++;for(const e of a.runningLayouts()){const a=e.GetEventSheet();if(!a)continue;this._runtime.PushCurrentLayout(e);for(const e of a.deepIncludes()){const a=yield*e._DebugTrigger(b,c);d=d||a}const f=yield*a._DebugTrigger(b,c);d=d||f,this._runtime.PopCurrentLayout()}return this._executingTriggerDepth--,d}QueueTrigger(a,b){return this._queuedTriggers.push([a,b]),!1}QueueDebugTrigger(a,b){let c=null;const d=new Promise((a)=>c=a);return this._queuedDebugTriggers.push([a,b,c]),d}*_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]=this._queuedDebugTriggers.shift(),e=yield*this._DebugTrigger(a,b,c);d(e)}}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()}IsRunningEvents(){return 0<this._runningEventsDepth}_RunQueuedTriggers(a){for(const[b,c]of this._queuedTriggers)this._Trigger(a,b,c);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)}_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.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())}}}
// 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:this._CreateEventBlock(a,b,c);break;case 1:this._CreateEventVariable(a,b,c);break;case 2:this._CreateInclude(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)}_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)}_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 c=this._triggers.get(e);c||(c=new Map,this._triggers.set(e,c));let f=c.get(d);f||(f=[],c.set(d,f)),f.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.IsCPUProfiling(),b=a?performance.now():0;this._hasRun=!0;const c=this.GetEventSheetManager();for(const a of this._events)a.Run(),c.ClearSol(a.GetSolModifiers()),this._runtime.FlushPendingInstances();c.GetCurrentEventStackFrame().Reset(null),a&&(this._perfRecord.totalTimeCounter+=performance.now()-b)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;const a=this.GetEventSheetManager();for(const b of this._events)yield*b.DebugRun(),a.ClearSol(b.GetSolModifiers()),this._runtime.FlushPendingInstances();a.GetCurrentEventStackFrame().Reset(null)}}_Trigger(a,b){if(b){const c=b.GetObjectClass();let d=!1,e=this._TriggerForObjectClass(a,b,c);d=d||e;for(const f of c.GetFamilies())e=this._TriggerForObjectClass(a,b,f),d=d||e}else return this._TriggerForObjectClass(a,b,null)}_TriggerForObjectClass(a,b,c){const d=this._triggers.get(c);if(!d)return!1;const e=d.get(a);if(!e)return!1;let f=!1;for(const[d,g]of e){const a=this._ExecuteTrigger(b,c,d,g);f=f||a}return f}*_DebugTrigger(a,b){if(b){const c=b.GetObjectClass();let d=!1,e=yield*this._DebugTriggerForObjectClass(a,b,c);d=d||e;for(const f of c.GetFamilies())e=yield*this._DebugTriggerForObjectClass(a,b,f),d=d||e}else return yield*this._DebugTriggerForObjectClass(a,b,null)}*_DebugTriggerForObjectClass(a,b,c){const d=this._triggers.get(c);if(!d)return!1;const e=d.get(a);if(!e)return!1;let f=!1;for(const[d,g]of e){let a;a=d.DebugCanRunFast()?this._ExecuteTrigger(b,c,d,g):yield*this._DebugExecuteTrigger(b,c,d,g),f=f||a}return f}_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,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,null,b,c):yield*this._DebugExecuteTrigger(null,null,b,c),h=h||e}return h}_ExecuteTrigger(a,b,c,d){const e=this._runtime,f=this._eventSheetManager,g=f.GetCurrentEvent(),h=f.GetEventStack(),i=f.GetTriggerDepth();let j=!1;g&&f.PushCleanSol(g.GetSolModifiersIncludingParents()),f.PushCleanSol(c.GetSolModifiersIncludingParents());const k=1<i;k&&f.GetLocalVarStack().Push();const l=h.Push(c);if(a){const c=b.GetCurrentSol();c.SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked()}let m=!0;if(c.GetParent()){const a=c.GetTriggerParents();for(let b=0,c=a.length;b<c;++b)if(!a[b].RunPreTrigger()){m=!1;break}}return m&&(e.IncrementExecCount(),c.IsOrBlock()?c.RunOrBlockTrigger(d):c.Run(),j=l.GetLastEventTrue()),h.Pop(),k&&f.GetLocalVarStack().Pop(),f.PopSol(c.GetSolModifiersIncludingParents()),g&&f.PopSol(g.GetSolModifiersIncludingParents()),g||1!==i||f.IsFlushingBlocked()||e.FlushPendingInstances(),j}*_DebugExecuteTrigger(a,b,c,d){const e=this._runtime,f=this._eventSheetManager,g=f.GetCurrentEvent(),h=f.GetEventStack(),i=f.GetTriggerDepth();let j=!1;g&&f.PushCleanSol(g.GetSolModifiersIncludingParents()),f.PushCleanSol(c.GetSolModifiersIncludingParents());const k=1<i;k&&f.GetLocalVarStack().Push();const l=h.Push(c);if(a){const c=b.GetCurrentSol();c.SetSinglePicked(a),a.IsInContainer()&&a.SetSiblingsSinglePicked()}let m=!0;if(c.GetParent()){const a=c.GetTriggerParents();for(let b=0,c=a.length;b<c;++b)if(!(yield*a[b].DebugRunPreTrigger())){m=!1;break}}return m&&(e.IncrementExecCount(),c.IsOrBlock()?yield*c.DebugRunOrBlockTrigger(d):yield*c.DebugRun(),j=l.GetLastEventTrue()),h.Pop(),k&&f.GetLocalVarStack().Pop(),f.PopSol(c.GetSolModifiersIncludingParents()),g&&f.PopSol(g.GetSolModifiersIncludingParents()),g||1!==i||f.IsFlushingBlocked()||e.FlushPendingInstances(),j}_GetPerfRecord(){return this._perfRecord}};
// c3/events/eventBlock.js
"use strict";C3.EventBlock=class extends C3.DefendedBase{constructor(a,b,c){super(),this._eventSheet=a,this._runtime=a.GetRuntime(),this._parent=b,this._eventStack=this._runtime.GetEventSheetManager().GetEventStack(),this._solModifiers=[],this._solModifiersIncludingParents=[],this._isSolWriterAfterCnds=!1,this._isTopLevelEvent=!1,this._isTopLevelGroup=!1,this._hasElseBlock=!1,this._isOrBlock=!!c[2],this._isElseBlock=!1,this._triggerParents=null,this._conditions=[],this._actions=[],this._subEvents=[],this._subGroups=[],this._isGroup=!1,this._isInitiallyActive=!1,this._groupName="",this._isGroupActive=!1,this._containedIncludes=null,this._perfRecord=null,this._sid=c[4],this._displayNumber=c[5],this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber),this._debugData=this._runtime.IsDebug()?{isBreakpoint:c[3][0],isBreakable:c[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null,c[1]?this._InitGroup(c[1]):this.GetEventSheetManager()._RegisterEventBlock(this);let d=0;for(const e of c[6]){const a=C3.Condition.Create(this,e,d++);this._conditions.push(a),this._AddSolModifier(a.GetObjectClass())}d=0;for(const e of c[7]){const a=C3.Action.Create(this,e,d++);this._actions.push(a)}if(9===c.length){const a=c[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)}static Create(a,b,c){return C3.New(C3.EventBlock,a,b,c)}Release(){}_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._IdentifySolModifiersIncludingParents(),this._IdentifyTriggerParents();const b=this.GetParent();this._isTopLevelEvent=!this.IsTrigger()&&(!b||b.IsTopLevelGroup());for(const b of this._conditions)b._PostInit();for(const b of this._actions)b._PostInit();const c=this._subEvents;for(let b=0,d=c.length;b<d;++b){const a=b<d-1&&c[b+1].IsElseBlock();c[b]._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._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}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()}HasAnyTriggeredCondition(){return 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]}IsFirstConditionOfType(a){let b=a.GetIndex();if(0===b)return!0;for(;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]}_HasActionIndex(a){return a=Math.floor(a),0<=a&&a<this._actions.length}GetSubEvents(){return this._subEvents}_MaybeFlushPendingInstances(){this._isTopLevelEvent&&this._runtime.FlushPendingInstances()}RunPreTrigger(){const a=this._eventStack.GetCurrentStackFrame();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){const b=this._eventStack.GetCurrentStackFrame();b.SetCurrentEvent(this),this._conditions[a].Run()&&(this._RunActionsAndSubEvents(b),b.SetLastEventTrue(!0))}*DebugRunPreTrigger(){const a=this._eventStack.GetCurrentStackFrame();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){const b=this._eventStack.GetCurrentStackFrame();b.SetCurrentEvent(this);const d=this._conditions[a];let c;if(c=d.DebugCanRunFast()?d.Run():yield*d.DebugRun(),c){let a;a=this.DebugCanRunActionsFast()?this._RunActions(b):yield*this._DebugRunActions(b),a&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),b.SetLastEventTrue(!0)}}Run(){const a=this._eventStack.GetCurrentStackFrame();a.SetCurrentEvent(this),this._isElseBlock||a.SetElseBranchRan(!1),this._isOrBlock?this._RunOrBlock(a):this._RunAndBlock(a)}*DebugRun(){(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())&&(yield this);const a=this._eventStack.GetCurrentStackFrame();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._RunActionsAndSubEvents(a),this._hasElseBlock&&a.SetElseBranchRan(!0)),this._MaybeFlushPendingInstances()}*_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):yield*this._DebugRunActions(a),b&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&a.SetElseBranchRan(!0)}this._MaybeFlushPendingInstances()}_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 a.SetLastEventTrue(!1),void this._MaybeFlushPendingInstances()}a.SetLastEventTrue(!0),this._RunActionsAndSubEvents(a),a.GetLastEventTrue()&&this._hasElseBlock&&a.SetElseBranchRan(!0),this._MaybeFlushPendingInstances()}*_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 a.SetLastEventTrue(!1),void this._MaybeFlushPendingInstances()}a.SetLastEventTrue(!0);let c;c=this.DebugCanRunActionsFast()?this._RunActions(a):yield*this._DebugRunActions(a),c&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents()),a.GetLastEventTrue()&&this._hasElseBlock&&a.SetElseBranchRan(!0),this._MaybeFlushPendingInstances()}_RunActions(b){const c=this._actions;for(let d=0,a=c.length;d<a;++d){const e=c[d];if(b.SetActionIndex(d),!0===e.Run())return!1}return!0}*_DebugRunActions(b){const c=this._actions;for(let d=0,a=c.length;d<a;++d){const e=c[d];b.SetActionIndex(d);let a;if(a=e.DebugCanRunFast()?e.Run():yield*e.DebugRun(),!0===a)return!1}return!0}_RunActionsAndSubEvents(b){const c=this._actions;for(let d=0,a=c.length;d<a;++d){const e=c[d];if(b.SetActionIndex(d),!0===e.Run())return}this._RunSubEvents()}_ResumeActionsAndSubEvents(b){const c=this._actions;for(let d=b.GetActionIndex(),a=c.length;d<a;++d){const e=c[d];if(b.SetActionIndex(d),!0===e.Run())return}this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(b){const c=this._actions;for(let d=b.GetActionIndex(),a=c.length;d<a;++d){const e=c[d];b.SetActionIndex(d);let a;if(a=e.DebugCanRunFast()?e.Run():yield*e.DebugRun(),!0===a)return}yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){const a=this.IsGroup()&&this._runtime.IsCPUProfiling(),b=a?performance.now():0,c=this._eventStack;c.Push(this),this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds():this._RunSubEvents_Fast(),c.Pop(),a&&(this._perfRecord.totalTimeCounter+=performance.now()-b)}}_RunSubEvents_SolWriterAfterCnds(){const a=this._isGroup,b=this._isTopLevelGroup,c=this._eventSheet.GetEventSheetManager(),d=this._subEvents;for(let f=0,g=d.length;f<g;++f){const h=d[f],e=h.GetSolModifiers(),i=!b||!a&&f<g-1;i&&c.PushCopySol(e),h.Run(),i?c.PopSol(e):c.ClearSol(e)}}_RunSubEvents_Fast(){const a=this._subEvents;for(let b=0,c=a.length;b<c;++b)a[b].Run()}*_DebugRunSubEvents(){if(this._subEvents.length){const a=this._eventStack;a.Push(this),this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds():yield*this._DebugRunSubEvents_Fast(),a.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(){const a=this._isGroup,b=this._isTopLevelGroup,c=this._eventSheet.GetEventSheetManager(),d=this._subEvents;for(let f=0,g=d.length;f<g;++f){const h=d[f],e=h.GetSolModifiers(),i=!b||!a&&f<g-1;i&&c.PushCopySol(e),yield*h.DebugRun(),i?c.PopSol(e):c.ClearSol(e)}}*_DebugRunSubEvents_Fast(){const a=this._subEvents;for(let b=0,c=a.length;b<c;++b)yield*a[b].DebugRun()}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._RunActionsAndSubEvents(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):yield*this._DebugRunActions(b),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}};
// 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._sid=c[6],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()),d._RegisterEventVariable(this)}static Create(a,b,c){return C3.New(C3.EventVariable,a,b,c)}Release(){}_PostInit(){}GetName(){return this._name}GetParent(){return this._parent}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}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(){this.Run()}SetValue(a){if(this.IsNumber()?"number"!=typeof a&&(a=parseFloat(a)):this.IsString()?"string"!=typeof a&&(a=a.toString()):this.IsBoolean()&&(a=a?1:0),this._hasSingleValue)return void(this._value=a);const b=this._localVarStack.GetCurrent(),c=this._localIndex;C3.extendArray(b,c+1,0),b[c]=a}GetValue(){if(this._hasSingleValue)return this._value;const a=this._localVarStack.GetCurrent(),b=this._localIndex;return b>=a.length?this._initialValue:a[b]}GetTypedValue(){let a=this.GetValue();return this.IsBoolean()&&(a=!!a),a}ResetToInitialValue(){this._value=this._initialValue}}}
// 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)}Release(){}_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,g){const h=g[0];return C3.New([e,c,d,f,b][h],a,g)}};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._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 d 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 e 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 f 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().GetParent());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,m,n){const o=m[0];return C3.New([b,c,i,e,f,d,g,b,e,e,j,k,i,l,c,h][o],a,o,n,m)}_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._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 g 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 h 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 i 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 j 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 k 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().GetParent());this._eventVarName=null}GetEventVariable(){return this._eventVar}}class l 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}}}
// 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)}C3.Condition=class extends C3.DefendedBase{constructor(a,b,c){if(super(),this._eventBlock=a,this._runtime=a.GetRuntime(),this._index=c,this._func=this._runtime.GetObjectReference(b[1]),this._isTrigger=0<b[3],this._isFastTrigger=2===b[3],this._isLooping=!!b[4],this._isInverted=!!b[5],this._isStatic=!!b[6],this._sid=b[7],this._isInOrBlock=this._eventBlock.IsOrBlock(),this._objectClass=null,this._behaviorType=null,this._behaviorIndex=-1,this._systemPlugin=null,this.Run=null,this.DebugRun=null,this._parameters=[],this._results=[],this._anyParamVariesPerInstance=!1,this._savedData=null,this._unsavedData=null,this._debugData=this._runtime.IsDebug()?{isBreakpoint:b[8][0],canDebug:b[8][1]}:null,(-1===b[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(b[0]),b[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(b[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(b[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds()),10===b.length)){let a=b[9];for(let b of a)this._parameters.push(C3.Parameter.Create(this,b,this._parameters.length)),this._results.push(0)}this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(a,b,c){return C3.New(C3.Condition,a,b,c)}Release(){}_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}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}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)}C3.Action=class extends C3.DefendedBase{constructor(a,b,c){if(super(),this._eventBlock=a,this._runtime=a.GetRuntime(),this._index=c,this._sid=b[3],this._func=this._runtime.GetObjectReference(b[1]),this._objectClass=null,this._behaviorType=null,this._behaviorIndex=-1,this._systemPlugin=null,this.Run=null,this.DebugRun=null,this._parameters=[],this._results=[],this._anyParamVariesPerInstance=!1,this._savedData=null,this._unsavedData=null,this._debugData=this._runtime.IsDebug()?{isBreakpoint:b[4][0],canDebug:b[4][1]}:null,(-1===b[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(b[0]),b[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(b[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(b[2]))),6===b.length)){const a=b[5];for(const b of a)this._parameters.push(C3.Parameter.Create(this,b,this._parameters.length)),this._results.push(0)}this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(a,b,c){return C3.New(C3.Action,a,b,c)}Release(){}_PostInit(){for(const a of this._parameters)a._PostInit(),a.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);this._systemPlugin?(this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem):this._behaviorType?(this.Run=this._RunBehavior,this.DebugRun=this._DebugRunBehavior):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):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)}_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}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}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()}_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);return!1}*_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);return!1}return 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);return!1}*_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);return!1}return 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)}return!1}*_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)}return!1}return 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)}return!1}*_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)}return!1}return 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)}return!1}*_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)}return!1}return this._RunBehavior()}_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){xa.setFromRgbValue(a);const b=this.GetWorldInfo();b.GetUnpremultipliedColor().equalsIgnoringAlpha(xa)||(b.SetUnpremultipliedColor(xa),this._runtime.UpdateRender())}function O(){return C3.round6dp(100*this.GetWorldInfo().GetOpacity())}function P(a){return!!a&&this.GetWorldInfo().GetLayer()===a}function Q(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 R(a,b,c){const d=this.GetWorldInfo(),e=0===a?d.GetZElevation():d.GetTotalZElevation();return C3.compare(e,b,c)}function S(){const a=this.GetInstance(),b=this.GetWorldInfo().GetLayer(),c=b._GetInstances();c.length&&c[c.length-1]===a||(b._RemoveInstance(a,!1),b._AddInstance(a,!1),this._runtime.UpdateRender())}function T(){const a=this.GetInstance(),b=this.GetWorldInfo().GetLayer(),c=b._GetInstances();c.length&&c[0]===a||(b._RemoveInstance(a,!1),b._PrependInstance(a,!1),this._runtime.UpdateRender())}function U(a){const b=this.GetInstance(),c=this.GetWorldInfo();a&&a!==c.GetLayer()&&(c.GetLayer()._RemoveInstance(b,!0),c._SetLayer(a),a._AddInstance(b,!0),this._runtime.UpdateRender())}function V(a,b){const c=this.GetInstance();if(b){const d=b.GetFirstPicked(c);if(d&&d.GetUID()!==c.GetUID()){const b=c.GetWorldInfo(),e=d.GetWorldInfo();b.GetLayer().GetIndex()!==e.GetLayer().GetIndex()&&(b.GetLayer()._RemoveInstance(c,!0),b._SetLayer(e.GetLayer()),e.GetLayer()._AddInstance(c,!0)),b.GetLayer().MoveInstanceAdjacent(c,d,0===a),this._runtime.UpdateRender()}}}function W(a){const b=this.GetWorldInfo();b.GetZElevation()===a||(b.SetZElevation(a),this._runtime.UpdateRender())}function X(){return this.GetWorldInfo().GetLayer().GetIndex()}function Y(){return this.GetWorldInfo().GetLayer().GetName()}function Z(){return this.GetWorldInfo().GetZIndex()}function $(){return this.GetWorldInfo().GetZElevation()}function _(){return this.GetWorldInfo().GetTotalZElevation()}function aa(a,b){const c=this.GetObjectClass().GetEffectList().GetEffectTypeByName(b);if(c){const b=c.GetIndex(),d=1===a,e=this.GetWorldInfo().GetInstanceEffectList();e.IsEffectIndexActive()===d||(e.SetEffectIndexActive(b,d),e.UpdateActiveEffects(),this._runtime.UpdateRender())}}function ba(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){xa.setFromRgbValue(c);const a=f[b];if(xa.equalsIgnoringAlpha(a))return;a.copyRgb(xa)}else{if("percent"===g&&(c/=100),f[b]===c)return;f[b]=c}e.IsEffectIndexActive(a)&&this._runtime.UpdateRender()}}}function ca(a,b,c){return C3.compare(this.GetInstance().GetInstanceVariableValue(a),b,c)}function da(a){return!!this.GetInstance().GetInstanceVariableValue(a)}function ea(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 fa(a){return this._runtime.GetCurrentCondition().IsInverted()?ha(this,a):ga(this,a)}function ga(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 ha(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 ia(){this._runtime.DestroyInstance(this._inst)}function ja(){return!0}function ka(){return!0}function la(a,b){this.GetInstance().SetInstanceVariableValue(a,b)}function ma(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 na(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 oa(a,b){this.GetInstance().SetInstanceVariableValue(a,b?1:0)}function pa(a){const b=this.GetInstance();b.SetInstanceVariableValue(a,0===b.GetInstanceVariableValue(a)?1:0)}function qa(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,!0)}function ra(){return JSON.stringify(this.GetInstance().SaveToJson(!0))}function sa(){return this.GetInstance().GetObjectClass().GetName()}function ta(){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 ua(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}function va(){return this._inst.GetIID()}function wa(){return this._inst.GetUID()}const xa=new C3.Color;C3.AddCommonACEs=function(ga,ha){const xa=ga[1],ya=ga[3],za=ga[4],Aa=ga[5],Ba=ga[6],Ca=ga[7],Da=ga[8],Ea=ha.Cnds,Fa=ha.Acts,Ga=ha.Exps;ya&&(Ea.CompareX=a,Ea.CompareY=b,Ea.IsOnScreen=c,Ea.IsOutsideLayout=d,Ea.PickDistance=e,Fa.SetX=f,Fa.SetY=g,Fa.SetPos=h,Fa.SetPosToObject=i,Fa.MoveForward=j,Fa.MoveAtAngle=k,Ga.X=l,Ga.Y=m,Ga.dt=n),za&&(Ea.CompareWidth=o,Ea.CompareHeight=p,Fa.SetWidth=q,Fa.SetHeight=r,Fa.SetSize=s,Ga.Width=t,Ga.Height=u,Ga.BBoxLeft=v,Ga.BBoxTop=w,Ga.BBoxRight=x,Ga.BBoxBottom=y),Aa&&(Ea.AngleWithin=z,Ea.IsClockwiseFrom=A,Ea.IsBetweenAngles=B,Fa.SetAngle=C,Fa.RotateClockwise=D,Fa.RotateCounterclockwise=E,Fa.RotateTowardAngle=F,Fa.RotateTowardPosition=G,Fa.SetTowardPosition=H,Ga.Angle=I),Ba&&(Ea.IsVisible=K,Ea.CompareOpacity=J,Fa.SetVisible=L,Fa.SetOpacity=M,Fa.SetDefaultColor=N,Ga.Opacity=O),Ca&&(Ea.IsOnLayer=P,Ea.PickTopBottom=Q,Ea.CompareZElevation=R,Fa.MoveToTop=S,Fa.MoveToBottom=T,Fa.MoveToLayer=U,Fa.ZMoveToObject=V,Fa.SetZElevation=W,Ga.LayerNumber=X,Ga.LayerName=Y,Ga.ZIndex=Z,Ga.ZElevation=$,Ga.TotalZElevation=_),Da&&(Fa.SetEffectEnabled=aa,Fa.SetEffectParam=ba),xa||(Ea.CompareInstanceVar=ca,Ea.IsBoolInstanceVarSet=da,Ea.PickInstVarHiLow=ea,Ea.PickByUID=fa,Fa.SetInstanceVar=la,Fa.AddInstanceVar=ma,Fa.SubInstanceVar=na,Fa.SetBoolInstanceVar=oa,Fa.ToggleBoolInstanceVar=pa,Ea.OnCreated=ja,Ea.OnDestroyed=ka,Fa.Destroy=ia,!Fa.LoadFromJsonString&&(Fa.LoadFromJsonString=qa),!Ga.AsJSON&&(Ga.AsJSON=ra),Ga.Count=ta,Ga.PickedCount=ua,Ga.IID=va,Ga.UID=wa,Ga.ObjectTypeName=sa)}}
// c3/events/scheduledWait.js
"use strict";C3.ScheduledWait=class extends C3.DefendedBase{constructor(a){super(),this._eventSheetManager=a,this._time=-1,this._signalTag="",this._isSignalled=!1,this._event=null,this._actIndex=0,this._solModifiers=[],this._sols=new Map,this._shouldRelease=!1}Release(){this._time=-1,this._signalTag="",this._event=null,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;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._Init(),this._time=this._eventSheetManager.GetRuntime().GetGameTime()+a}InitSignal(a){this._Init(),this._signalTag=a.toLowerCase()}IsTimer(){return-1<this._time}IsSignal(){return-1===this._time}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=!0}_ShouldRun(){if(this.IsSignal()){if(!this.IsSignalled())return!1;}else if(this._time>this._eventSheetManager.GetRuntime().GetGameTime())return!1;return!0}_Run(a){a._Restore(this._event,this._actIndex);for(const[b,c]of this._sols.entries()){const a=b.GetCurrentSol();c._Restore(a)}this._event._ResumeActionsAndSubEvents(a),this._eventSheetManager.ClearSol(this._solModifiers),this._shouldRelease=!0}async _DebugRun(a){a._Restore(this._event,this._actIndex);for(const[b,c]of this._sols.entries()){const a=b.GetCurrentSol();c._Restore(a)}for(const b of this._event._DebugResumeActionsAndSubEvents(a))await this._eventSheetManager.GetRuntime().DebugBreak(b);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._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(){}LoadTilePolyData(){}};
// 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}Trigger(a){return this._runtime.Trigger(a,this._inst)}DebugTrigger(a){return this._runtime.DebugTrigger(a,this._inst)}TriggerAsync(a){return this._runtime.TriggerAsync(a,this._inst)}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(){}SetPropertyOffsetValueByIndex(){}SetPropertyColorOffsetValueByIndex(){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}};
// 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)}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)}_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()||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)}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()}};
// 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)}DebugTrigger(a){return this._runtime.DebugTrigger(a,this._inst)}TriggerAsync(a){return this._runtime.TriggerAsync(a,this._inst)}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(){}SetPropertyOffsetValueByIndex(){}SetPropertyColorOffsetValueByIndex(){}CallAction(a,...b){a.call(this,...b)}CallExpression(a,...b){return a.call(this,...b)}};
// 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)}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._isGlobal=!!c[9],this._isFamily=!!c[2],this._isOnLoaderLayout=!!c[10],this._instVarSids=c[3].map((a)=>a[0]),this._instVarTypes=c[3].map((a)=>a[1]),this._instVarNames=null,a.IsPreview()&&(this._instVarNames=c[3].map((a)=>a[2])),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),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[14],[]),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()}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}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._instVarSids.length}GetInstanceVariableSIDs(){return this._instVarSids}GetInstanceVariableIndexBySID(a){return this._instVarSids.indexOf(a)}_GetAllInstanceVariableNames(){return this._instVarNames}GetInstanceVariableType(a){if(a=Math.floor(a),0>a||a>=this._instVarTypes.length)throw new RangeError("invalid instance variable index");return this._instVarTypes[a]}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()}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}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,c,!1,0,0,!0);e.LoadFromJson(a)}this._SetIIDsStale()}};
// 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";{let a=0;C3.Instance=class extends C3.DefendedBase{constructor(b){if(super(),this._runtime=b.runtime,this._objectType=b.objectType,this._plugin=this._objectType.GetPlugin(),this._mustPreDraw=this._plugin.MustPreDraw(),this._iid=0,this._uid=b.uid,this._puid=0,this._sequenceId=a++,this._isDestroyed=!1,this._instVarValues=[],this._behaviorInstances=this._objectType.GetBehaviorTypesIncludingInherited().map((a,b)=>C3.New(C3.BehaviorInstance,{runtime:this._runtime,behaviorType:a,instance:this,index:b})),this._worldInfo=null,this._timeScale=-1,this._sdkInst=null,this._savedData=null,this._unsavedData=null,this._hasTilemap=!1,this._isInContainer=this._objectType.IsInContainer(),this._siblings=this._isInContainer?[]:null,this._dispatcher=null,this._plugin.IsWorldType())if(this._worldInfo=C3.New(C3.WorldInfo,this,b.layer),b.worldData)this._worldInfo.Init(b.worldData);else{const[a,b]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(a,b),this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}b.instVarData?this._LoadInstanceVariableData(b.instVarData):this._LoadDefaultInstanceVariables()}Release(){for(const a of this._behaviorInstances)a.Release();C3.clearArray(this._behaviorInstances),this._sdkInst.Release(),this._sdkInst=null,this._savedData&&this._savedData.clear(),this._unsavedData&&this._unsavedData.clear(),this._siblings&&C3.clearArray(this._siblings),this._dispatcher&&(this._dispatcher.Release(),this._dispatcher=null),this._runtime=null,this._objectType=null,this._plugin=null,C3.clearArray(this._instVarValues),this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(a){C3.shallowAssignArray(this._instVarValues,a)}_LoadDefaultInstanceVariables(){const a=[0,0,""];for(let b=0,c=this._objectType.GetInstanceVariablesCount();b<c;++b)this._instVarValues.push(a[this._objectType.GetInstanceVariableType(b)])}_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)}this._sdkInst=C3.New(this._objectType.GetInstanceSdkCtor(),this,a);for(let c=0,d=this._behaviorInstances.length;c<d;++c)this._behaviorInstances[c].PostCreate()}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}MustPreDraw(){return this._mustPreDraw}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._hasTilemap=!0}HasTilemap(){return this._hasTilemap}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 this._isInContainer}_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._plugin}_SetIID(a){this._iid=a}GetIID(){return this._objectType._UpdateIIDs(),this._iid}GetUID(){return this._uid}_GetSequenceID(){return this._sequenceId}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(){return this._savedData||(this._savedData=new Map),this._savedData}GetUnsavedDataMap(){return this._unsavedData||(this._unsavedData=new Map),this._unsavedData}_TriggerOnCreated(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this)}_MarkDestroyed(){this._isDestroyed=!0}IsDestroyed(){return this._isDestroyed}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(a){const b={};if(a?b["c3"]=!0:b["uid"]=this.GetUID(),this._savedData&&this._savedData.size&&(b["ex"]=C3.ToSuperJSON(this._savedData)),-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 c=this._sdkInst.SaveToJson();return c&&(b["data"]=c),b}LoadFromJson(a,b){if(!b)this._uid=a["uid"];else if(!a["c3"])return;this._savedData&&(this._savedData.clear(),this._savedData=null);const c=a["ex"];c&&(this._savedData=C3.FromSuperJSON(c)),this._timeScale=a.hasOwnProperty("mts")?a["mts"]:-1;const d=a["ivs"];if(d)for(const[a,b]of Object.entries(d)){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._plugin.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()):!b&&this._runtime.DestroyInstance(this)}this._worldInfo._LoadFromJson(c)}const e=a["behs"];if(e)for(const[a,b]of Object.entries(e)){const c=parseInt(a,10),d=this.GetBehaviorIndexBySID(c);0>d||d>=this._behaviorInstances.length||this._behaviorInstances[d].LoadFromJson(b)}const f=a["data"];f&&this._sdkInst.LoadFromJson(f)}}}
// c3/objects/worldInfo.js
"use strict";{const a=C3.New(C3.Rect),b=C3.New(C3.Rect),c=C3.New(C3.Event,"bboxchange",!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._isVisible=!0,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._bboxChanged=!0,this._boundingBox=new C3.Rect,this._boundingQuad=new C3.Quad,this._enableBboxChangeEvent=!1,this._isCollisionEnabled=!0,this._isCollisionCellChanged=!0,this._collisionCells=C3.New(C3.Rect,0,0,-1,-1),this._renderCells=C3.New(C3.Rect,0,0,-1,-1),this._sourceCollisionPoly=null,this._transformedCollisionPoly=C3.New(C3.CollisionPoly),this._polyWidth=-1,this._polyHeight=-1,this._polyAngle=0,this._solidFilterInclusive=!1,this._solidFilterTags=null,this._color=C3.New(C3.Color,1,1,1,1),this._colorPremultiplied=C3.New(C3.Color,1,1,1,1),this._hasDefaultColor=!0,this._blendMode=-1,this._srcBlend=0,this._destBlend=0,this._stateGroup=null,this._instanceEffectList=null,this._hasAnyActiveEffect=!1,this._inst.GetObjectClass().HasEffects()&&(this._instanceEffectList=C3.New(C3.InstanceEffectList,this._inst,this)),this.SetBlendMode(0)}Release(){this._stateGroup&&(this._runtime.GetWebGLRenderer().ReleaseStateGroup(this._stateGroup),this._stateGroup=null),this._sourceCollisionPoly=null,this._transformedCollisionPoly.Release(),this._transformedCollisionPoly=null,this._solidFilterTags&&(this._solidFilterTags.clear(),this._solidFilterTags=null),this._inst=null,this._objectClass=null,this._runtime=null,this._layer=null}Init(a){this.SetX(a[0]),this.SetY(a[1]),this.SetZElevation(a[2]),this.SetWidth(a[3]),this.SetHeight(a[4]),this.SetAngle(a[6]),this._color.setFromJSON(a[7]),this.SetOriginX(a[8]),this.SetOriginY(a[9]),this.SetBlendMode(a[10]),this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(a[12]),this._UpdatePremultipliedColor(),this._UpdateWebGLStateGroup()}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()}}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.SetAngle(this._a+b)}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}SetOpacity(a){a=C3.clamp(a,0,1);this._color.a===a||(this._color.a=a,this._UpdatePremultipliedColor(),this._UpdateWebGLStateGroup())}OffsetOpacity(a){if(0!==a){const b=this._color.a;this._color.a+=a,this._color.a===b||(this._UpdatePremultipliedColor(),this._UpdateWebGLStateGroup())}}GetOpacity(){return this._color.a}SetUnpremultipliedColor(a){this._color.equalsIgnoringAlpha(a)||(this._color.copyRgb(a),this._UpdatePremultipliedColor(),this._UpdateWebGLStateGroup())}SetUnpremultipliedColorRGB(a,c,d){const b=this._color;b.r===a&&b.g===c&&b.b===d||(b.r=a,b.g=c,b.b=d,this._UpdatePremultipliedColor(),this._UpdateWebGLStateGroup())}OffsetUnpremultipliedColorRGB(a,c,d){if(0!==a||0!==c||0!==d){const b=this._color,e=b.r,f=b.g,g=b.b;b.r+=a,b.g+=c,b.b+=d,b.r===e&&b.g===f&&b.b===g||(this._UpdatePremultipliedColor(),this._UpdateWebGLStateGroup())}}GetUnpremultipliedColor(){return this._color}_UpdatePremultipliedColor(){const a=this._color,b=this._colorPremultiplied;this._hasDefaultColor=a.equalsRgba(1,1,1,1),b.set(a),b.premultiply()}GetPremultipliedColor(){return this._colorPremultiplied}_UpdateWebGLStateGroup(){const a=this._runtime.GetWebGLRenderer();this._stateGroup&&a.ReleaseStateGroup(this._stateGroup),this._stateGroup=a.AcquireStateGroup(a.GetTextureFillShaderProgram()||"<default>",this._srcBlend,this._destBlend,this._colorPremultiplied,this._zElevation)}GetWebGLStateGroup(){return this._stateGroup}HasDefaultColor(){return this._hasDefaultColor}SetBlendMode(a){if(this._blendMode!==a){this._blendMode=a;const b=this._runtime.GetWebGLRenderer();if(b){const c=b.GetBlendByIndex(a);this._srcBlend=c.srcBlend,this._destBlend=c.destBlend}this._UpdateWebGLStateGroup()}}GetBlendMode(){return this._blendMode}GetSrcBlend(){return this._srcBlend}GetDestBlend(){return this._destBlend}_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}IsVisible(){return this._isVisible}SetVisible(a){this._isVisible=!!a}IsCollisionEnabled(){return this._isCollisionEnabled}SetCollisionEnabled(a){a=!!a;this._isCollisionEnabled===a||(this._isCollisionEnabled=a,a?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(a,b){if(this._solidFilterInclusive=!!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=this._solidFilterInclusive,c=this._solidFilterTags;if(!a||!c)return!b;for(const d of c)if(a.has(d))return b;return!b}SetBboxChanged(){this._bboxChanged=!0,this._isCollisionCellChanged=!0,this._objectClass._SetAnyCollisionCellChanged(!0),this._runtime.UpdateRender(),this._layer.UsesRenderCells()&&(this._CalculateBbox(),this._UpdateRenderCell()),this._enableBboxChangeEvent&&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._bboxChanged=!1}_UpdateBbox(){this._bboxChanged&&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._bboxChanged=!1,this._UpdateCollisionCell(),this._UpdateRenderCell()}SetBboxChangeEventEnabled(a){this._enableBboxChangeEvent=!!a}IsBboxChangeEventEnabled(){return this._enableBboxChangeEvent}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,this._polyWidth=-1,this._polyHeight=-1,this._polyAngle=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){return this._polyWidth===b&&this._polyHeight===c&&this._polyAngle===d?this._transformedCollisionPoly:(this._sourceCollisionPoly?(this._transformedCollisionPoly.copy(this._sourceCollisionPoly),this._transformedCollisionPoly.transformPrecalc(b,c,a,e)):this._transformedCollisionPoly.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY()),this._polyWidth=b,this._polyHeight=c,this._polyAngle=d,this._transformedCollisionPoly)}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()))}_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.getRight()<d.getLeft()?c.Update(b,null,a):c.Update(b,d,a),d.copy(a),this._isCollisionCellChanged=!1}}}_RemoveFromCollisionCells(){const a=this._collisionCells;a.getRight()<a.getLeft()||(this._objectClass._GetCollisionCellGrid().Update(this._inst,a,null),a.set(0,0,-1,-1))}GetCollisionCellRange(){return this._collisionCells}_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.getRight()<e.getLeft()?c.Update(d,null,a):c.Update(d,e,a),e.copy(a),b.SetRenderListStale()}}}_RemoveFromRenderCells(){const a=this._renderCells;a.getRight()<a.getLeft()||(this.GetLayer().GetRenderGrid().Update(this._inst,a,null),a.set(0,0,-1,-1))}IsInRenderCells(){return this._renderCells.getRight()>=this._renderCells.getLeft()}GetRenderCellRange(){return this._renderCells}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(a){this._hasAnyActiveEffect=!!a}HasAnyActiveEffect(){return this._hasAnyActiveEffect}SaveGeometryState(){this._UpdateBbox();const a=this._boundingBox,b=this._boundingQuad;return[this._x,this._y,this._w,this._h,this._a,this._ox,this._oy,a.getLeft(),a.getTop(),a.getRight(),a.getBottom(),b.getTlx(),b.getTly(),b.getTrx(),b.getTry(),b.getBrx(),b.getBry(),b.getBlx(),b.getBly()]}RestoreGeometryState(a){this._x=a[0],this._y=a[1],this._w=a[2],this._h=a[3],this.SetAngle(a[4]),this._ox=a[5],this._oy=a[6],this._boundingBox.set(a[7],a[8],a[9],a[10]),this._boundingQuad.set(a[11],a[12],a[13],a[14],a[15],a[16],a[17],a[18]),this._bboxChanged=!1}_SaveToJson(){const a={"x":this.GetX(),"y":this.GetY(),"w":this.GetWidth(),"h":this.GetHeight(),"l":this.GetLayer().GetSID(),"zi":this.GetZIndex()};return 0!==this.GetZElevation()&&(a["ze"]=this.GetZElevation()),0!==this.GetAngle()&&(a["a"]=this.GetAngle()),1!==this.GetOpacity()&&(a["o"]=this.GetOpacity()),.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()),this._solidFilterInclusive&&(a["sfi"]=this._solidFilterInclusive),this._solidFilterTags&&(a["sft"]=[...this._solidFilterTags].join(" ")),a}_LoadFromJson(a){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),this.SetOpacity(a.hasOwnProperty("o")?a["o"]:1),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()}}}
// 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._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}};
// 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._behavior._AddInstance(this._inst)}Release(){this._behavior._RemoveInstance(this._inst),this._sdkInst.Release(),this._sdkInst=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)}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._GetSequenceID(),h=d._GetSequenceID();return g===h?c.GetBehaviorInstance()._GetIndex()-a.GetBehaviorInstance()._GetIndex():g-h}};
// 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}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}}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){const c=a.GetSavedDataMap();return c.get("solidEnabled")&&(!b||b.GetWorldInfo().IsSolidCollisionAllowed(c.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.GetSavedDataMap().get("jumpthruEnabled")&&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;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}return e.SetXY(f,g),e.SetBboxChanged(),!1}PushInFractional(a,b,c,d,e){let f=2,g=!1,h=!1;const i=a.GetWorldInfo();let j=i.GetX(),k=i.GetY();for(;f<=e;){const e=1/f;f*=2,i.OffsetXY(b*e*(g?1:-1),c*e*(g?1:-1)),i.SetBboxChanged(),this.TestOverlap(a,d)?(g=!0,h=!0):(g=!1,h=!1,j=i.GetX(),k=i.GetY())}h&&(i.SetXY(j,k),i.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}}}
// 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/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)),this._webglRenderer=C3.New(C3.Gfx.WebGLRenderer,this._canvas,{maxWebGLVersion:a["maxWebGLVersion"],powerPreference:this._gpuPreference,enableGpuProfiling:!0,alpha:!0}),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=a["shaders"]||self["C3_Shaders"],await this._LoadShaderPrograms();let b=!1;for(const c of this._runtime._GetAllEffectLists()){for(const a of c.GetAllEffectTypes())a._InitRenderer(this._webglRenderer),a.GetShaderProgram().UsesDest()&&(b=!0);c.UpdateActiveEffects()}this._runtime._SetUsesAnyBackgroundBlending(b),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){this._runtime.IsInWorker()&&(self.devicePixelRatio=a["devicePixelRatio"]),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=self.devicePixelRatio,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=self.devicePixelRatio;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=self.devicePixelRatio;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=self.devicePixelRatio;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/self.devicePixelRatio: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*self.devicePixelRatio),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("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHdpZHRoPSIxNzAwLjc5MDA0cHgiIGhlaWdodD0iMTcwMC43OTAwNHB4IiB2aWV3Qm94PSIyODcgMzE3IDExMjUgMTEyNSINCgkgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTcwMC43OTAwNCAxNzAwLjc5MDA0IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnIGlkPSJsb2dvIj4NCgk8Zz4NCgkJPGc+DQoJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0ZGRkZGRiIgZD0iTTM1NC45Nzc1NCwxMTk1LjYyMzA1DQoJCQkJYzExLjM4NDc3LDAsMjIuMDEyNywzLjIzNzMsMzEuMDE3NTgsOC44Mzc4OWMxLjk0NjI5LDEuMjEwOTQsMi41ODQ5NiwzLjc0OTAyLDEuNDM4NDgsNS43MzQzOGwtNC45MzI2Miw4LjU0MTk5DQoJCQkJYy0zLjI3ODMyLDUuNjc5NjktMTAuMDMzMiw4LjM3Njk1LTE2LjMxNzM4LDYuNTAwOThjLTIuNzY0NjUtMC44MjUyLTUuNjkzMzYtMS4yNjg1NS04LjcyNjU2LTEuMjY4NTUNCgkJCQljLTE2LjgyOTEsMC0zMC40NzI2NiwxMy42NDM1NS0zMC40NzI2NiwzMC40NzI2NmMwLDE2LjgyODEzLDEzLjY0MzU1LDMwLjQ3MjY2LDMwLjQ3MjY2LDMwLjQ3MjY2DQoJCQkJYzMuMDMzMiwwLDUuOTYxOTEtMC40NDMzNiw4LjcyNjU2LTEuMjY4NTVjNi4yOTQ5Mi0xLjg3OTg4LDEzLjAzMzIsMC44MTE1MiwxNi4zMTczOCw2LjUwMDk4bDQuOTMxNjQsOC41NDE5OQ0KCQkJCWMxLjE0NzQ2LDEuOTg4MjgsMC41MTA3NCw0LjUyMzQ0LTEuNDM4NDgsNS43MzQzOGMtOS4wMDM5MSw1LjYwMTU2LTE5LjYzMTg0LDguODM3ODktMzEuMDE2Niw4LjgzNzg5DQoJCQkJYy0zMi40ODUzNSwwLTU4LjgxOTM0LTI2LjMzNDk2LTU4LjgxOTM0LTU4LjgxOTM0QzI5Ni4xNTgyLDEyMjEuOTU3MDMsMzIyLjQ5MjE5LDExOTUuNjIzMDUsMzU0Ljk3NzU0LDExOTUuNjIzMDUNCgkJCQlMMzU0Ljk3NzU0LDExOTUuNjIzMDV6IE03MDMuMjE0ODQsMTI1OS4xNzU3OGMtMTQuNTU5NTctOS44MTczOC0yMC4yMDMxMy0yMC4wMzIyMy0yMC4yMDMxMy0zMy4wODAwOA0KCQkJCWMwLTE4LjQ4OTI2LDE1LjcxNDg0LTI5Ljc2MzY3LDM4LjI2NjYtMjkuNzYzNjdjOS42NTcyMywwLDE4LjcyMTY4LDIuNTQyOTcsMjYuNTU5NTcsNi45OTQxNA0KCQkJCWMyLjA0OTgsMS4xNjQwNiwyLjc2MTcyLDMuNzgzMiwxLjU4MzAxLDUuODI0MjJsLTMuNDE3OTcsNS45MTk5MmMtMy4yNDcwNyw1LjYyNDAyLTkuOTA4Miw4LjMzMTA1LTE2LjE1MzMyLDYuNTQ4ODMNCgkJCQljLTIuNzIzNjMtMC43NzYzNy01LjU5ODYzLTEuMTkyMzgtOC41NzEyOS0xLjE5MjM4Yy0xMC40OTAyMywwLTExLjU5ODYzLDkuNTc2MTctNC44NTc0MiwxNC4xMjMwNWwyMy42ODY1MiwxNS45NzY1Ng0KCQkJCWM5Ljk5MDIzLDYuNzM4MjgsMTUuODk1NTEsMTcuMDY2NDEsMTUuODk1NTEsMjguNzE4NzVjMCwxOC43ODYxMy0xNS4wMDY4NCwzMy4zMDc2Mi0zOC4yNjc1OCwzMy4zMDc2Mg0KCQkJCWMtOS41MjI0NiwwLTE4LjU4Nzg5LTEuOTU3MDMtMjYuODE1NDMtNS40OTAyM2MtNy43ODEyNS0zLjMzOTg0LTEwLjkzMzU5LTEyLjc4MjIzLTYuNjk3MjctMjAuMTE4MTZsMy40ODczLTYuMDQxOTkNCgkJCQljMS4yMTM4Ny0yLjA5OTYxLDMuOTMxNjQtMi43NTk3Nyw1Ljk3NDYxLTEuNDU2MDVjNi44NTkzOCw0LjM4MjgxLDE2LjQ5MDIzLDcuNTk0NzMsMjQuNzU4NzksNy41OTQ3Mw0KCQkJCWMxMC41NDU5LDAsMTEuMzI4MTMtOS45NTg5OCwzLjc2NzU4LTE1LjA1NzYyTDcwMy4yMTQ4NCwxMjU5LjE3NTc4TDcwMy4yMTQ4NCwxMjU5LjE3NTc4eiBNOTg0LjYzMDg2LDEyMDIuMDAwOTgNCgkJCQljMC0yLjM0NzY2LDEuOTAzMzItNC4yNTE5NSw0LjI1MTk1LTQuMjUxOTVoOS45MjE4OGM3LjgyNzE1LDAsMTQuMTcyODUsNi4zNDU3LDE0LjE3Mjg1LDE0LjE3MzgzdjU3LjQwMTM3DQoJCQkJYzAsOC42MTAzNSw2Ljk4MDQ3LDE1LjU5MDgyLDE1LjU5MDgyLDE1LjU5MDgyczE1LjU5MDgyLTYuOTgwNDcsMTUuNTkwODItMTUuNTkwODJ2LTU3LjQwMTM3DQoJCQkJYzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTcyODUtMTQuMTczODNoOS45MjA5YzIuMzQ4NjMsMCw0LjI1MTk1LDEuOTA0Myw0LjI1MTk1LDQuMjUxOTV2NjcuMzIzMjQNCgkJCQljMCwyNC4yNjU2My0xOS42NzA5LDQzLjkzNzUtNDMuOTM2NTIsNDMuOTM3NXMtNDMuOTM3NS0xOS42NzE4OC00My45Mzc1LTQzLjkzNzVWMTIwMi4wMDA5OEw5ODQuNjMwODYsMTIwMi4wMDA5OHoNCgkJCQkgTTQ2Ni44NjkxNCwxMTk1LjYyMzA1YzMyLjQ4NDM4LDAsNTguODE4MzYsMjYuMzMzOTgsNTguODE4MzYsNTguODE5MzRjMCwzMi40ODQzOC0yNi4zMzM5OCw1OC44MTkzNC01OC44MTgzNiw1OC44MTkzNA0KCQkJCWMtMzIuNDg2MzMsMC01OC44MTkzNC0yNi4zMzQ5Ni01OC44MTkzNC01OC44MTkzNEM0MDguMDQ5OCwxMjIxLjk1NzAzLDQzNC4zODI4MSwxMTk1LjYyMzA1LDQ2Ni44NjkxNCwxMTk1LjYyMzA1DQoJCQkJTDQ2Ni44NjkxNCwxMTk1LjYyMzA1eiBNNDY2Ljg2OTE0LDEyMjUuMDMzMmMtMTYuMjQzMTYsMC0yOS40MTAxNiwxMy4xNjY5OS0yOS40MTAxNiwyOS40MDkxOA0KCQkJCXMxMy4xNjY5OSwyOS40MDgyLDI5LjQxMDE2LDI5LjQwODJjMTYuMjQxMjEsMCwyOS40MDgyLTEzLjE2NjAyLDI5LjQwODItMjkuNDA4MlM0ODMuMTEwMzUsMTIyNS4wMzMyLDQ2Ni44NjkxNCwxMjI1LjAzMzINCgkJCQlMNDY2Ljg2OTE0LDEyMjUuMDMzMnogTTU1Ni43MzI0MiwxMzExLjEzNDc3Yy0yLjM0NzY2LDAtNC4yNTE5NS0xLjkwMjM0LTQuMjUxOTUtNC4yNXYtOTQuOTYxOTENCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzM4My0xNC4xNzM4M2gzLjk1ODk4YzQuNjI1LDAsOC45NTg5OCwyLjI1Njg0LDExLjYxMTMzLDYuMDQ1OWw0MS4xMjIwNyw1OC43NDcwN3YtNTAuNjE5MTQNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2g5LjkyMTg4YzIuMzQ3NjYsMCw0LjI1MTk1LDEuOTA0Myw0LjI1MTk1LDQuMjUxOTV2OTQuOTYwOTQNCgkJCQljMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3MzgzLDE0LjE3Mjg1aC0zLjk1ODk4Yy00LjYyNSwwLTguOTU4OTgtMi4yNTU4Ni0xMS42MTEzMy02LjA0NDkybC00MS4xMjIwNy01OC43NDYwOXY1MC42MTgxNg0KCQkJCWMwLDcuODI5MS02LjM0NTcsMTQuMTcyODUtMTQuMTcyODUsMTQuMTcyODVINTU2LjczMjQyTDU1Ni43MzI0MiwxMzExLjEzNDc3eiBNMTIxNS4wMjA1MSwxMjExLjkyMjg1DQoJCQkJYzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTcyODUtMTQuMTczODNoNTAuMzE1NDNjMi4zNDg2MywwLDQuMjUxOTUsMS45MDQzLDQuMjUxOTUsNC4yNTE5NXY1LjY2OTkyDQoJCQkJYzAsNy44MjcxNS02LjM0NTcsMTQuMTcyODUtMTQuMTcyODUsMTQuMTcyODVoLTYuMDI0NDF2NzUuMTE4MTZjMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3Mjg1LDE0LjE3Mjg1aC05LjkyMTg4DQoJCQkJYy0yLjM0ODYzLDAtNC4yNTE5NS0xLjkwMjM0LTQuMjUxOTUtNC4yNXYtODUuMDQxMDJoLTE1Ljk0NDM0Yy0yLjM0ODYzLDAtNC4yNTE5NS0xLjkwMzMyLTQuMjUxOTUtNC4yNTE5NVYxMjExLjkyMjg1DQoJCQkJTDEyMTUuMDIwNTEsMTIxMS45MjI4NXogTTc3Ni40NDkyMiwxMjExLjkyMjg1YzAtNy44MjgxMyw2LjM0NTctMTQuMTczODMsMTQuMTczODMtMTQuMTczODNoNTAuMzE0NDUNCgkJCQljMi4zNDk2MSwwLDQuMjUxOTUsMS45MDQzLDQuMjUxOTUsNC4yNTE5NXY1LjY2OTkyYzAsNy44MjcxNS02LjM0NTcsMTQuMTcyODUtMTQuMTcxODgsMTQuMTcyODVoLTYuMDI1Mzl2NzUuMTE4MTYNCgkJCQljMCw3LjgyOTEtNi4zNDU3LDE0LjE3Mjg1LTE0LjE3Mjg1LDE0LjE3Mjg1aC05LjkyMDljLTIuMzQ5NjEsMC00LjI1MTk1LTEuOTAyMzQtNC4yNTE5NS00LjI1di04NS4wNDEwMmgtMTUuOTQ1MzENCgkJCQljLTIuMzQ3NjYsMC00LjI1MTk1LTEuOTAzMzItNC4yNTE5NS00LjI1MTk1VjEyMTEuOTIyODVMNzc2LjQ0OTIyLDEyMTEuOTIyODV6IE05MjkuNjA0NDksMTI3Mi4wMjI0NmwyNi45NTgwMSwzMi4xMjc5Mw0KCQkJCWMyLjMxNDQ1LDIuNzU3ODEsMC4zNDM3NSw2Ljk4NDM4LTMuMjU2ODQsNi45ODQzOGgtMTkuNzA1MDhjLTQuMTg5NDUsMC04LjE2NTA0LTEuODUxNTYtMTAuODU3NDItNS4wNjA1NWwtMjIuNjgxNjQtMjcuMDMxMjUNCgkJCQl2MjcuODQxOGMwLDIuMzQ3NjYtMS45MDMzMiw0LjI1LTQuMjUxOTUsNC4yNWgtOS45MjA5Yy03LjgyNzE1LDAtMTQuMTcyODUtNi4zNDM3NS0xNC4xNzI4NS0xNC4xNzI4NXYtODUuMDM5MDYNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2gyOS43NjM2N2MyMi43MDAyLDAsNDEuMTAyNTQsMTcuMTMzNzksNDEuMTAyNTQsMzguMjY4NTUNCgkJCQlDOTU2Ljc1NDg4LDEyNTIuNTkwODIsOTQ1LjQzNjUyLDEyNjYuNzAyMTUsOTI5LjYwNDQ5LDEyNzIuMDIyNDZMOTI5LjYwNDQ5LDEyNzIuMDIyNDZ6IE05MDAuMDYxNTIsMTIyMS44NDM3NXYzMi41OTg2M2g4LjUwMzkxDQoJCQkJYzEwLjk1ODk4LDAsMTkuODQyNzctNy4yOTc4NSwxOS44NDI3Ny0xNi4yOTg4M2MwLTkuMDAxOTUtOC44ODM3OS0xNi4yOTk4LTE5Ljg0Mjc3LTE2LjI5OThIOTAwLjA2MTUyTDkwMC4wNjE1MiwxMjIxLjg0Mzc1eg0KCQkJCSBNMTE1OC4zNTkzOCwxMTk1LjYyMzA1YzExLjM4NDc3LDAsMjIuMDEyNywzLjIzNzMsMzEuMDE3NTgsOC44Mzc4OWMxLjk0NzI3LDEuMjEwOTQsMi41ODQ5NiwzLjc0OTAyLDEuNDM4NDgsNS43MzQzOA0KCQkJCWwtNC45MzI2Miw4LjU0MTk5Yy0zLjI3ODMyLDUuNjc5NjktMTAuMDMzMiw4LjM3Njk1LTE2LjMxNzM4LDYuNTAwOThjLTIuNzY0NjUtMC44MjUyLTUuNjkzMzYtMS4yNjg1NS04LjcyNTU5LTEuMjY4NTUNCgkJCQljLTE2LjgyOTEsMC0zMC40NzI2NiwxMy42NDM1NS0zMC40NzI2NiwzMC40NzI2NmMwLDE2LjgyODEzLDEzLjY0MzU1LDMwLjQ3MjY2LDMwLjQ3MjY2LDMwLjQ3MjY2DQoJCQkJYzMuMDMyMjMsMCw1Ljk2MDk0LTAuNDQzMzYsOC43MjU1OS0xLjI2ODU1YzYuMjk1OS0xLjg3OTg4LDEzLjAzMzIsMC44MTE1MiwxNi4zMTgzNiw2LjUwMDk4bDQuOTMwNjYsOC41NDE5OQ0KCQkJCWMxLjE0NzQ2LDEuOTg4MjgsMC41MTA3NCw0LjUyMzQ0LTEuNDM3NSw1LjczNDM4Yy05LjAwNDg4LDUuNjAxNTYtMTkuNjMyODEsOC44Mzc4OS0zMS4wMTc1OCw4LjgzNzg5DQoJCQkJYy0zMi40ODUzNSwwLTU4LjgxOTM0LTI2LjMzNDk2LTU4LjgxOTM0LTU4LjgxOTM0QzEwOTkuNTQwMDQsMTIyMS45NTcwMywxMTI1Ljg3NDAyLDExOTUuNjIzMDUsMTE1OC4zNTkzOCwxMTk1LjYyMzA1eiIvPg0KCQkJPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiMwMEZGREEiIGQ9Ik0xMzE4LjE5NzI3LDEyMDYuMDMyMjMNCgkJCQljMC03LjgyODEzLDYuMzQ1Ny0xNC4xNzM4MywxNC4xNzI4NS0xNC4xNzM4M2MyMC42NTYyNSwwLDQxLjMxMjUsMCw2MS45Njg3NSwwYzMuNDI5NjksMCw1LjQ1MDIsMy44ODA4NiwzLjQ4MzQsNi42OTA0Mw0KCQkJCWwtMTkuMjk2ODgsMjcuNTY3MzhjMTUuNTQyOTcsOC4zNzU5OCwyNi4xMDY0NSwyNC44MDA3OCwyNi4xMDY0NSw0My42OTUzMWMwLDI3LjM5NzQ2LTIyLjIwODk4LDQ5LjYwNjQ1LTQ5LjYwNjQ1LDQ5LjYwNjQ1DQoJCQkJYy0xNi42ODg0OCwwLTMxLjQ1MTE3LTguMjQwMjMtNDAuNDQzMzYtMjAuODc1OThjLTEuNDUwMi0yLjAzOTA2LTAuODMxMDUtNC44OTk0MSwxLjMzNTk0LTYuMTUyMzRsMTAuOTc3NTQtNi4zMzc4OQ0KCQkJCWM0Ljg4MTg0LTIuODE4MzYsMTAuOTc5NDktMi40NzU1OSwxNS41MTQ2NSwwLjg3MzA1YzMuNTI4MzIsMi42MDU0Nyw3Ljg5MTYsNC4xNDY0OCwxMi42MTUyMyw0LjE0NjQ4DQoJCQkJYzExLjc0MjE5LDAsMjEuMjU5NzctOS41MTg1NSwyMS4yNTk3Ny0yMS4yNTk3N3MtOS41MTc1OC0yMS4yNTk3Ny0yMS4yNTk3Ny0yMS4yNTk3N2gtMTUuMjE3NzcNCgkJCQljLTMuNDI5NjksMC01LjQ1MDItMy44ODA4Ni0zLjQ4NDM4LTYuNjkwNDNsMTguMTM1NzQtMjUuOTA4MmgtMzIuMDA5NzdjLTIuMzQ4NjMsMC00LjI1MTk1LTEuOTAzMzItNC4yNTE5NS00LjI1MTk1VjEyMDYuMDMyMjN6DQoJCQkJIi8+DQoJCTwvZz4NCgkJPGc+DQoJCQk8Zz4NCgkJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0RBRThGNyIgZD0iTTg1MC4zOTU1MSw4NTcuNTkxOA0KCQkJCQljLTUwLjM1NjQ1LDAtOTQuMzI1Mi0yNy4zNTY0NS0xMTcuODUyNTQtNjguMDIwNTFsLTgwLjAzMDI3LDQ2LjIwNDFjLTQuNjU1MjcsMi42ODk0NS02LjEzMTg0LDguNzE4NzUtMy4yNDkwMiwxMy4yNTU4Ng0KCQkJCQljNDIuMjM3Myw2Ni40ODYzMywxMTYuNTMzMiwxMTAuNjA3NDIsMjAxLjEzMTg0LDExMC42MDc0MmM4OC4xMjU5OCwwLDE2NS4wNzEyOS00Ny44NzUsMjA2LjI0MzE2LTExOS4wMzYxM2wtODAuNDg3My00Ni40Njk3Mw0KCQkJCQljLTQuMzEzNDgtMi40OTAyMy05LjgwMTc2LTEuMjA1MDgtMTIuNTcwMzEsMi45MzU1NUM5MzkuMTc1NzgsODMzLjU2MjUsODk3LjU5MTgsODU3LjU5MTgsODUwLjM5NTUxLDg1Ny41OTE4DQoJCQkJCUw4NTAuMzk1NTEsODU3LjU5MTh6IE0xMTM2LjcyMTY4LDU1Ni4yMTc3N2M0LjYxNDI2LTIuNjYzMDksNi4xMTAzNS04LjYxOTE0LDMuMzEyNS0xMy4xNTEzNw0KCQkJCQljLTU5LjkxNTA0LTk3LjAzMDI3LTE2Ny4yMjQ2MS0xNjEuNjk0MzQtMjg5LjYzODY3LTE2MS42OTQzNGMtMTI1Ljg5MzU1LDAtMjM1LjgxMzQ4LDY4LjM5MjU4LTI5NC42MzM3OSwxNzAuMDQ5OA0KCQkJCQlsODAuMzc2OTUsNDYuNDA2MjVjNC4zOTc0NiwyLjUzOTA2LDEwLjAwMTk1LDEuMTQ5NDEsMTIuNzEwOTQtMy4xNDU1MQ0KCQkJCQljNDIuMTY0MDYtNjYuODUxNTYsMTE2LjY2ODk1LTExMS4yNjM2NywyMDEuNTQ1OS0xMTEuMjYzNjdjODguMTI1OTgsMCwxNjUuMDcxMjksNDcuODc1OTgsMjA2LjI0MzE2LDExOS4wMzYxMw0KCQkJCQlMMTEzNi43MjE2OCw1NTYuMjE3Nzd6Ii8+DQoJCQkJPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNBNUJBQzgiIGQ9Ik04NTAuMzk1NTEsOTU5LjYzODY3DQoJCQkJCWMtODQuNTk4NjMsMC0xNTguODk0NTMtNDQuMTIxMDktMjAxLjEzMTg0LTExMC42MDc0MmMtMi44NzY5NS00LjUzMDI3LTEuMzk5NDEtMTAuNTcwMzEsMy4yNDkwMi0xMy4yNTU4Nmw4MC4wMzAyNy00Ni4yMDQxDQoJCQkJCWMtMTEuNTgxMDUtMjAuMDE2Ni0xOC4yMDk5Ni00My4yNTQ4OC0xOC4yMDk5Ni02OC4wNDE5OWMwLTc0Ljc4NTE2LDYwLjU1NzYyLTEzNi4wNjI1LDEzNi4wNjI1LTEzNi4wNjI1DQoJCQkJCWM0Ny4xOTYyOSwwLDg4Ljc4MDI3LDI0LjAyOTMsMTEzLjE4NTU1LDYwLjUyMjQ2YzIuNzY0NjUsNC4xMzM3OSw4LjI2MzY3LDUuNDIxODgsMTIuNTcwMzEsMi45MzU1NWw4MC40ODczLTQ2LjQ2OTczDQoJCQkJCWMtNDEuMTcxODgtNzEuMTYwMTYtMTE4LjExNzE5LTExOS4wMzYxMy0yMDYuMjQzMTYtMTE5LjAzNjEzYy04NC44NzY5NSwwLTE1OS4zODE4NCw0NC40MTIxMS0yMDEuNTQ1OSwxMTEuMjYzNjcNCgkJCQkJYy0yLjcwNjA1LDQuMjkxMDItOC4zMTgzNiw1LjY4MTY0LTEyLjcxMDk0LDMuMTQ1NTFsLTgwLjM3Njk1LTQ2LjQwNjI1DQoJCQkJCWMtMjguOTUyMTUsNTAuMDQwMDQtNDUuNTIzNDQsMTA4LjEzOTY1LTQ1LjUyMzQ0LDE3MC4xMDc0MmMwLDE4Ni45NjM4NywxNTEuMzk0NTMsMzQwLjE1NzIzLDM0MC4xNTcyMywzNDAuMTU3MjMNCgkJCQkJYzEyMi40MTQwNiwwLDIyOS43MjM2My02NC42NjQwNiwyODkuNjM4NjctMTYxLjY5NTMxYzIuNzk0OTItNC41MjYzNywxLjI5NDkyLTEwLjQ5MDIzLTMuMzEyNS0xMy4xNTEzN2wtODAuMDgzMDEtNDYuMjM3Mw0KCQkJCQlDMTAxNS40NjY4LDkxMS43NjM2Nyw5MzguNTIxNDgsOTU5LjYzODY3LDg1MC4zOTU1MSw5NTkuNjM4Njd6Ii8+DQoJCQk8L2c+DQoJCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzAwRkZEQSIgZD0iTTExMzcuMTg1NTUsNzU4LjExMzI4di03My4xNjc5N2wtNjMuMzY1MjMsMzYuNTgzOTgNCgkJCQlMMTEzNy4xODU1NSw3NTguMTEzMjhMMTEzNy4xODU1NSw3NTguMTEzMjh6IE0xMDI2LjU3NjE3LDcwNS4xNjQwNmwxMjAuMDU4NTktNjkuMzE2NDENCgkJCQljMTIuNTY4MzYtNy4yNTU4NiwyOC4zNDQ3MywxLjg1MjU0LDI4LjM0NTcsMTYuMzY2MjF2MTM4LjYzMDg2Yy0wLjAwMDk4LDE0LjUxMjctMTUuNzc3MzQsMjMuNjIyMDctMjguMzQ1NywxNi4zNjYyMQ0KCQkJCWwtMTIwLjA1ODU5LTY5LjMxNjQxQzEwMTQuMDI4MzIsNzMwLjY0OTQxLDEwMTQuMDI4MzIsNzEyLjQwOTE4LDEwMjYuNTc2MTcsNzA1LjE2NDA2eiIvPg0KCQk8L2c+DQoJPC9nPg0KPC9nPg0KPC9zdmc+DQo=").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("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABABAMAAACekdKMAAAAMFBMVEUAAAByfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYYgo7vbAAAAD3RSTlMAmd137hFVqjO7zCKIRGZ881JRAAAFY0lEQVR42u2aPW/bVhSGn1iiPizZ8D+QgSJBNglFmiboQA0NUKAD1XotYA0BOspAkZnqx24vnTrIQNCpg4QkQMcYKDoW9j9w5y6qLNqWFDlvh3tJUa6ddHBhAuS7SKBIQffhuee851CQKVOmTJkyZcqUKXmqa8O+uyNlABKsFRmdP0o5AOle2gHoWdoBzFrpBHACwPeetJNmAFSlt6kGwGH0LqUAVqRuqgHkpEaqAVRkfvOWr+Dh9Rc4j6VvwnrhPNAbgK2ezj+yx7Z6GjUuASi4Ch4lHQAGwBeRK1rROQAdUx5K0hE4NUkaAdS02ZEuoms2wkCSgvYSgFJfkn6CobkSPG0mEcAOrHnGFOxAToHNjk/MygLgO/PxL0BN9yRdQKlufMQAoCdJGi8BOJYknXTJ269cu9HtdqNb4Ni6oimUbFb0dAZQ1DmULJ+TFtT0qQHwg73mLlCMfFUMQPR5VWrbmttNHICC1KDiSZ+w3pMOwFPDhP4IYFtv4ZX0nIorbUBNmjWAiqdZg5fmNFd6jvPhJQDjAV9LI0r28IpmycsBZalNWfoRWJcuoKY9c7cCkwpOwdcIqNT1BmrSgQkNbQAvpAGOF+aHOIBpCxhKR/TVBNjVOHkAOgrg2N6aoU7sklmVidtD7bNm/fIrjaBmk+Sxea142iBnTyguAfjZZscNXLOdXFM8EgVgXRpDz/6yonTEts6AXdV1APTVoKigFSXEmj3XN0kSV01WFQwAHC8O4Mhagye8NgHS137SALzsS3dxwhtXkQ4oaw64eqomOFKXbc2xJbFLTX8DOHYnsKsJu2Gdu8IIuTqjrMB8eyM5ACIFXQo2S5t7lNMM6AdFTaCgADqahHW8EQIohBk9rzEdE+JXAtjVmHWpDTmplUAA96Ea/bJDnVKSWjgaFTSHqubgmjVDXQchgFy4wBXNcXV6LYC8RjbEypomcCAyBopRShxqAn21yenM8WawqjOoKVbmLYBFndeImsnyVwJY1RR8NW1FTRiA6UNTCsP6fKwLONQBZTXx1WVbT0KbtwygvAxg81oAZU0xe2QYxkmyrDDx2DzWBXTUZFs7dNQwHUEMwN4VAKb47wOQ1wj8Gx0+/Y8A8powVJtt7XOoxn8A8N4IqCrA8cJUmzgAl3JAUWN8tSjqDX0NwI/XbwugGLe178oBK7bBaBesm0gggOUqwLrOHe8c1jV2NAMOw/XFAFRth2dr/burANS1cSc0C8kDsB7zAZvgKCjoLTiaFqwpmvwLQC7e2b3PB4CrZj48KXkAKktOEPr6VqeAr680udzEWACluK0LreJ1ThBe6+w4HkfJAhD1AtbAu3qgPcDVX2oCK9bqxwFQ1+fRsVW7va/uBZpAWaND652TCGBoM1rHHN6VmQlsq6cdE+4mC75oLAC49prKB1zTDd6NukHIKahbIkkEsGrmAQWZbZqXNLClrg04dTP4KnjnCwBfmgkZT7WD45k94C8BmA3MPGBgeqcbfQBxwwDsRMi3N7Iqc3dzsuVhV5ofkevpJOoGKUn6Ax5L92F49USoayZCls08uQDiM0ETCWPb8k7DMmH02SICGC7ayVhnsABwEpsZQkfxUpI4ALGpsFn4xCbHcVjnwgnvAkBh0U6CbzqrXgzA1E6FB9YOJGcacgUAfl36t0Ro/SIDUDEL/D1WBcJr5q0oRoJ2LQZgZJ4LPIu2RCPJAJafDLm2Yr2OHmQ4H0vzBksA2PKl38L3fY0aLAFYejK0ZpJhelVKzkj8dlRNzkj8dpRP0DTkVjTUXroB9PVnqtefS9I05BZU8NOdAyUl5q8RtwUg6KYcwP1Up8CanpMpU6ZMmTLdgP4BRYsi23xEdOAAAAAASUVORK5CYII=").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("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABABAMAAACekdKMAAAAMFBMVEUAAAByfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYZyfYYgo7vbAAAAD3RSTlMAdxHdu4hmVZnuRMwzqiLYE4y2AAAF2klEQVR42u2Yv28jaRnHP/bG8SVxvA4ncRw6sCVoVlc4R8FJCOHlGkq7olrJy18QFzRUWSqkE1KibZAQOkc6Ua+5htJGW12BEihpHAqKE0XWcZzEcXIfinf8a8zunsTNoZPmW80zfsbvzGfmfX5BqlSpUqVKlSpVqlSpUqVKlSrV/1EHPv4SfN7wMgWQAkgBpABSAF+2HngOsG8PyDpsWwHy3gJU/UHM3o0uyxw4/G44zJf1LQC8INP3ugXAejOcrqn6EIf80puiQwDqHgF8S987nfsAcN+HfEd/M/v34TtwT9WLBABsewXQtAHkHfVtATlHAUsjboer1lX9O8BmV/V9AIf5tnpRATZrqj9aBLBmHMCe6l0lDmD3V6ofABS6YaHkAOTDo7XtADmvwjNuOAlYWnE7XNVXdXgKlFW1BDjcU7UzP/14AUA/DmA7+PwkDuCHqmHFvWih5ABknQAFvQW2fFq1AxxrD+iOK3E72o8+ItP2E8joz8jXHQDqnyj0vYRN/ZBMzdvZ/lYfwRKAA0c93nZSWYoB93VS4q/6GPL6WzJtOwkGwboVyOkAqHqy5jnQ1BJkvSNuE7bC74F/O4BjB0BGj0DvgJwTWHMAvOvFAoAblgHkHR9BsWspDuAEaNqBz7wB3nWQIICyLdiyPQH2LWW8ArpjO5B3QNwGoGYLKDquUA9hoekuhDvPaoWqh0BRK3MApRiAeyH8nPk0BuAuBNxzOIgWGiYI4NgGHLtnBZqeFhxBwUvPIefnxO0QNy6i3NUqGHbFPW9ATwG69jgL+aIbvvQAgBiA/bDr3/AqBuBzgC1vKUYL9e0lB+CeHShPNixBdwK1CWTstAewZWfVBnLRl7BvKUoPZBxNn5G6R+H9wS92Tl8OoGkp4BzEALwAWPOGTLRQ2VJyAHLeQnew7UOyjqBpjy1L/Quo2li1o5cD8M+d1lb4jCk4WQKw5qS3XOSsAujaAyjuvPUyANvRQs98khyAvAOK3uY9D+XOviXO7O1bCdVR3AY2wusNh2FXoEsACjr59msAhBprpRJcABCSn+pJcgCy7TsydrLtS3IewgNPKE944GOaY1bt+S0uHdY8XQTAx+rwnVcCiNxfAeD+DMDDBHuB/pg1G/Tv2PIEtj2kPmLbE7p3rNpfEABvq/756wCgbK9qj71xpWoLMt5mvWXdp1mvWLW/KAD+0jfkxf8FwIuvoBs8s7Q3hKqtfStQdLDuLlmv8p6zagMb8/uahYNYDAhBsub1K2PA6wAsBJsEAWx50h/Btk+aE4Du3bYN6F/nQtaL2/MsAGx5E2WB4SoAMtp7bRZ4BYBpjkkWQM6P2jew7mF7ANAcf+YR7I03Qp6O2/M64JmNeR1wvQRgZyc6LC0DyK7WAZuOXgYg5/VXAKDgtYeQdRBe7LEHY6BqObyhuD2vBMuW5pXg1RKAWvAtxwFMc99CJZh5eSGUj2rLhCdCbX0C1MehfN3Qa2DN9pD/Zs96gWzNWS9QDr3ADMCBT0KLUILmIoCurdB9znqB73k+9YkDoBYx+gByyQHoayt08I0wIomif/R1L9vPhz3Y9w/A9x1Nu8H1qBucATj2Eii07UHZxhxA2Q7wqaEb7EG2bmPq83zYWwawHxqj5rAXiu1ktB8+42rgQF6fhqbuilW7HnpzH5Gp2ZnOA/qOWAKQ039QLHsHPPN3VKY/nnlxxB91Ng9408nMp25nGUBO3yO4bDpuZZMBUA2Y16LtnA3Zm7pPWbVrvphNhCaV+einsQyAg3D6E8I8b3f6Yyac7y5MhOY+NV8sA6A5d6npMKk8eBluLSr0umE/lsNzx+y6u7OZYIPZ8O99YgDW2xptokJ7AUAA9uOD+UxwwafubgxAvjZz+TQxAJlQbhSn445yCNRn06y3ZD8fHkVT4YtvzKfC3yQOgExT/xa6nX9pYwag+Kb+nOZsKvzTBZ/nw6MYAPJl/XW4sJlcFEiVKlWqVKlSpUqVKlWqVKlSpUqV6uuu/wDv59f7eYDABQAAAABJRU5ErkJggg==").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._isWKWebView=!!n["isWKWebView"],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._originalViewportWidth=0,this._originalViewportHeight=0,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;this._assetManager=C3.New(C3.AssetManager,this,{defaultLoadPolicy:r?"remote":"local",localUrlBlobs:t,isCordova:"cordova"===this._exportType,isWKWebView:this._isWKWebView,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._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._canvasManager=null,this._sampling="trilinear",this._isPixelRoundingEnabled=!1,this._needRender=!0,this._pauseOnBlur=!1,this._isPausedOnBlur=!1,this._tickCallback=(e)=>this.Tick(e),this._rafId=-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._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._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._dispatcher.addEventListener("window-blur",(a)=>this._OnWindowBlur(a)),this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus()),this._timelineManager.AddRuntimeListeners()}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._canvasManager&&(this._canvasManager.Release(),this._canvasManager=null),this._dispatcher.Release(),this._dispatcher=null,this._tickEvent=null,this._tickCallback=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["dispatchRuntimeEvent"],i=a["responseId"];if("runtime"===e&&s){const e=new C3.Event(n);e.data=t,this._dispatcher.dispatchEventAndWaitAsyncSequential(e)}const r=this._domEventHandlers.get(e);if(!r)return void(s||console.warn(`[Runtime] No DOM event handlers for component '${e}'`));const o=r.get(n);if(!o)return void(s||console.warn(`[Runtime] No DOM handler '${n}' for component '${e}'`));let d=null;try{d=o(t)}catch(a){return console.error(`Exception in '${e}' handler '${n}':`,a),void(null!==i&&this._PostResultToDOM(i,!1,a.toString()))}null!==i&&(d&&d.then?d.then((e)=>this._PostResultToDOM(i,!0,e)).catch((a)=>{console.error(`Rejection from '${e}' handler '${n}':`,a),this._PostResultToDOM(i,!1,a.toString())}):this._PostResultToDOM(i,!0,d))}_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));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.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);if(C3.clearArray(this._waitingToHandleEvents),this._canvasManager&&this._canvasManager.StartLoadingScreen(),await Promise.all([this._assetManager.WaitForAllToLoad(),...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}_LoadDataJson(e){const a=e["project"];this._projectName=a[0],this._projectVersion=a[16],this._projectUniqueId=a[31],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._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();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[6])this._eventSheetManager.Create(n);this._eventSheetManager._PostInit(),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.IsWKWebView()?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),this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(e){if(e=Math.floor(e),0>e||e>=this._objectReferenceTable.length)throw new Error("invalid object reference");return this._objectReferenceTable[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}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}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()}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}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,u=C3.New(C3.Instance,{runtime:this,objectType:o,layer:a,worldData:g,instVarData:r?r[3]:null,uid:l});this._instancesByUid.set(l,u);let c=null;if(d&&(c=u.GetWorldInfo(),"undefined"!=typeof t&&"undefined"!=typeof s&&(c.SetX(t),c.SetY(s)),o._SetAnyCollisionCellChanged(!0)),a&&(a._AddInstance(u,!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,c?c.GetX():t,c?c.GetY():s,!0);u._AddSibling(a)}for(const e of u.siblings()){e._AddSibling(u);for(const a of u.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(u._CreateSdkInstance(m,p),d&&g&&14===g.length){const e=g[13];u._SetHasTilemap(),u.GetSdkInstance().LoadTilemapData(e[2],e[0],e[1])}return this._instancesPendingCreate.push(u),this._hasPendingInstances=!0,this.IsDebug()&&C3Debugger.InstanceCreated(u),u}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)}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"),-1!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=-1),this._dispatcher.dispatchEvent(C3.New(C3.Event,"suspend")),this.Trigger(C3.Plugins.System.Cnds.OnSuspend,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),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(){for(const e of this._behInstsToTick)e.Tick()}_BehaviorPostTick(){for(const e of this._behInstsToPostTick)e.PostTick()}_BehaviorTick2(){for(const e of this._behInstsToTick2)e.Tick2()}*_DebugBehaviorTick(){for(const e of this._behInstsToTick){const a=e.Tick();C3.IsIterator(a)&&(yield*a)}}*_DebugBehaviorPostTick(){for(const e of this._behInstsToPostTick){const a=e.PostTick();C3.IsIterator(a)&&(yield*a)}}*_DebugBehaviorTick2(){for(const e of this._behInstsToTick2){const a=e.Tick2();C3.IsIterator(a)&&(yield*a)}}async Tick(e,a){if(this._rafId=-1,this._hasStartedTicking=!0,this._hasStarted&&(!this.IsSuspended()||a)){const a=performance.now();this._isInTick=!0,e||(e=a),await this.Step(e),this.Render(),this.IsSuspended()||-1!==this._rafId||(this._rafId=self.requestAnimationFrame(this._tickCallback)),this._tickCount++,this._tickCountNoSave++,this._execCount++,this._isInTick=!1,this._mainThreadTimeCounter+=performance.now()-a}}async Step(e){const a=this._eventSheetManager,n=this._dispatcher,t=this._eventObjects,s=this.IsDebug(),i=this.IsDebugging();if(this._MeasureDt(e),this.FlushPendingInstances(),a.BlockFlushingInstances(!0),this.PushCurrentLayout(this.GetMainRunningLayout()),s&&C3Debugger.StartMeasuringTime(),i?await a.DebugRunScheduledWaits():a.RunScheduledWaits(),s&&C3Debugger.AddEventsTime(),this.PopCurrentLayout(),a.BlockFlushingInstances(!1),this.FlushPendingInstances(),a.BlockFlushingInstances(!0),await n.dispatchEventAndWaitAsync(t["pretick"]),s&&C3Debugger.StartMeasuringTime(),i?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick(),i?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):this._BehaviorPostTick(),s&&C3Debugger.AddBehaviorTickTime(),s&&C3Debugger.StartMeasuringTime(),i?await this.DebugFireGeneratorEventAndBreak(t["tick"]):n.dispatchEvent(t["tick"]),s&&C3Debugger.AddPluginTickTime(),a.BlockFlushingInstances(!1),this._NeedsHandleSaveOrLoad()&&(await this._HandleSaveOrLoad()),this.GetLayoutManager().IsPendingChangeMainLayout()&&(await this._MaybeChangeLayout()),s&&C3Debugger.StartMeasuringTime(),i?await a.DebugRunEvents(this._layoutManager):a.RunEvents(this._layoutManager),s&&C3Debugger.AddEventsTime(),this._collisionEngine.ClearRegisteredCollisions(),0<this._instancesToReleaseAtEndOfTick.size){this._dispatcher.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(),this._dispatcher.SetDelayRemoveEventsEnabled(!1)}this._isLayoutFirstTick=!1,a.BlockFlushingInstances(!0),s&&C3Debugger.StartMeasuringTime(),i?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2(),s&&C3Debugger.AddBehaviorTickTime(),s&&C3Debugger.StartMeasuringTime(),i?await this.DebugFireGeneratorEventAndBreak(t["tick2"]):n.dispatchEvent(t["tick2"]),s&&C3Debugger.AddPluginTickTime(),a.BlockFlushingInstances(!1),i&&(await a.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"]),await e._Load(t,this.GetWebGLRenderer()),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){if(!this._hasStarted)return!1;const n=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let t=0;n&&(t=performance.now());const s=this.IsDebug();s&&this.SetDebuggingEnabled(!1);const i=this._eventSheetManager._Trigger(this._layoutManager,e,a);if(n){const e=performance.now()-t;this._mainThreadTimeCounter+=e,s&&C3Debugger.AddTriggersTime(e)}return s&&this.SetDebuggingEnabled(!0),i}DebugTrigger(e,a){if(!this.IsDebug())return this.Trigger(e,a);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)}async TriggerAsync(e,a){if(!this.IsDebugging())return this.Trigger(e,a);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(e,a);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(e,a);const n=performance.now(),t=this._eventSheetManager._DebugTrigger(this._layoutManager,e,a);let s=t.next();for(;!s.done;)await this.DebugBreak(s.value),s=t.next();return this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),this._hasStartedTicking&&-1===this._rafId&&!this._isInTick&&(this._rafId=self.requestAnimationFrame(this._tickCallback))),this._mainThreadTimeCounter+=performance.now()-n,s.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(){if(!this._currentLayoutStack.length)throw new Error("no current layout");return this._currentLayoutStack[this._currentLayoutStack.length-1]}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}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}IsWKWebView(){return this._isWKWebView}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}_GetSavegamesStorage(){return this._savegamesStorage||(this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+this.GetProjectUniqueId(),description:this.GetProjectName()})),this._savegamesStorage}async _DoSaveToSlot(e){const a=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)}}_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()};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();return 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._dispatcher.dispatchEvent(C3.New(C3.Event,"afterload")),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){if(this.IsInWorker())return await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{"blob":e,"width":a,"height":n});else{const t=await C3.BlobToImage(e);return await self["C3_RasterSvgImage"](t,a,n)}}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))}},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"] = {};
"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._imagesLoadingTotal=0,this._imagesLoadingComplete=0}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(a){this._runtime.Trigger(a,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),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}}}
"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},Signal(a){const b=a.toLowerCase();for(const c of this._runtime.GetEventSheetManager().scheduledWaits())c.IsSignal()&&c.GetSignalTag()===b&&c.SetSignalled()},SnapshotCanvas(a,b){const c=this._runtime.GetCanvasManager();c&&(c.SnapshotCanvas(0===a?"image/png":"image/jpeg",b/100).then(()=>this._runtime.TriggerAsync(C3.Plugins.System.Cnds.OnCanvasSnapshot,null)),this.UpdateRender())},SetCanvasSize(a,b){if(!(0>=a||0>=b)){this._runtime.SetViewportSize(a,b);const c=this._runtime.GetCanvasManager();c&&("off"===c.GetCurrentFullscreenMode()?c.SetSize(c.GetLastWidth(),c.GetLastHeight(),!0):(this._runtime.SetOriginalViewportSize(a,b),c.SetSize(c.GetLastWidth(),c.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){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){j.sort(a),k.sort(b);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())}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())}}}},LoadObjectTextures(a){const b=this._runtime.GetMainRunningLayout();if(b&&a&&!this._runtime.IsLoading()){const c=a.IsFamily()?a.GetFamilyMembers():[a];this._LoadTexturesForObjectClasses(b,c)}},LoadObjectTexturesByName(a){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)}},LoadLayoutTextures(a){const b=this._runtime.GetMainRunningLayout();a&&b&&!this._runtime.IsLoading()&&this._LoadTexturesForObjectClasses(b,a._GetInitialObjectClasses())},LoadLayoutTexturesByName(a){const b=this._runtime.GetMainRunningLayout(),c=this._runtime.GetLayoutManager().GetLayoutByName(a);c&&b&&!this._runtime.IsLoading()&&this._LoadTexturesForObjectClasses(b,c._GetInitialObjectClasses())}}}
"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?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()},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.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.GetInstances())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(),this._isPlayingForwards=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._isAnimationPlaying=!0,this._animationRepeats=0,this._animTriggerName="",this._isInAnimTrigger=!1,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()}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._isPlayingForwards=!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._isPlayingForwards=!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._isAnimationPlaying=!1,this._animTriggerName=this._currentAnimation.GetName(),this._isInAnimTrigger=!0,this.Trigger(C3.Plugins.Sprite.Cnds.OnAnyAnimFinished),this.Trigger(C3.Plugins.Sprite.Cnds.OnAnimFinished),this._isInAnimTrigger=!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()}_DoChangeAnimation(){const a=this._currentAnimationFrame,b=this._objectClass.GetAnimationByName(this._changeAnimationName);if((this._changeAnimationName="",!!b)&&!(b===this._currentAnimation&&this._isAnimationPlaying)){this._currentAnimation=b,this._isPlayingForwards=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._isAnimationPlaying=!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._isAnimationPlaying=!a.hasOwnProperty("ap")||!!a["ap"],this._isPlayingForwards=!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}}}
"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=m.IsOrBlock(),p=i.GetCurrentCondition(),q=p.GetObjectClass(),r=p.GetSavedDataMap(),s=p.GetUnsavedDataMap();let t=r.get("collmemory");t||(t=C3.New(C3.PairMap),r.set("collmemory",t)),s.get("spriteCreatedDestroyCallback")||(s.set("spriteCreatedDestroyCallback",!0),f.Dispatcher().addEventListener("instancedestroy",(a)=>c(t,a.instance)));const u=q.GetCurrentSol(),v=e.GetCurrentSol(),w=u.GetInstances();let x=null;for(let c=0;c<w.length;++c){const f=w[c];v.IsSelectAll()?(g.GetCollisionCandidates(f.GetWorldInfo().GetLayer(),e,f.GetWorldInfo().GetBoundingBox(),h),x=h,g.AddRegisteredCollisionCandidates(f,e,x)):x=v.GetInstances();for(let c=0;c<x.length;++c){const h=x[c];if(g.TestOverlap(f,h)||g.CheckRegisteredCollision(f,h)){const b=d(t,f,h);let c=!1,g=-2;"number"==typeof b&&(c=!0,g=b);const j=!c||g<l-1;if(a(t,f,h,l),j){const a=m.GetSolModifiers();i.PushCopySol(a);const b=q.GetCurrentSol(),c=e.GetCurrentSol();if(b._SetSelectAll(!1),c._SetSelectAll(!1),q===e){const a=b._GetOwnInstances();C3.clearArray(a),a.push(f),a.push(h),q.ApplySolToContainer()}else{const a=b._GetOwnInstances(),d=c._GetOwnInstances();C3.clearArray(a),C3.clearArray(d),a.push(f),d.push(h),q.ApplySolToContainer(),e.ApplySolToContainer()}yield*m.DebugRetrigger(k,n),i.PopSol(a)}}else b(t,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 this._changeAnimationName?C3.equalsNoCase(this._changeAnimationName,a):C3.equalsNoCase(this._currentAnimation.GetName(),a)},CompareFrame(a,b){return C3.compare(this._currentFrameIndex,a,b)},CompareAnimSpeed(a,b){const c=this._isPlayingForwards?this._currentAnimationSpeed:-this._currentAnimationSpeed;return C3.compare(c,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},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._isAnimationPlaying=!1},StartAnim(a){this._isAnimationPlaying=!0,this._frameStartTime=this.GetAnimationTime(),1===a&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,!this._isInAnimTrigger&&this._DoChangeAnimFrame()),this._StartTicking()},SetAnim(a,b){this._changeAnimationName=a,this._changeAnimationFrom=b,this._StartTicking(),this._isInAnimTrigger||this._DoChangeAnimation()},SetAnimFrame(a){isFinite(a)&&(this._changeAnimFrameIndex=a,!this._isInAnimTrigger&&this._DoChangeAnimFrame())},SetAnimSpeed(a){this._currentAnimationSpeed=Math.abs(a),this._isPlayingForwards=0<=a,0<this._currentAnimationSpeed&&this._StartTicking()},SetAnimRepeatToFrame(a){a=C3.clamp(Math.floor(a),0,this._currentAnimation.GetFrameCount()-1),this._currentAnimationRepeatTo=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())},LoadURL(a,b){const c=this._currentAnimationFrame,d=c.GetImageInfo(),e=this.GetWorldInfo(),f=this._runtime;return d.GetURL()===a?(0===b&&(e.SetSize(d.GetWidth(),d.GetHeight()),e.SetBboxChanged()),void this.Trigger(C3.Plugins.Sprite.Cnds.OnURLLoaded)):void(async()=>{const c=C3.New(C3.ImageInfo);await c.LoadDynamicAsset(f,a),await c.LoadStaticTexture(f.GetWebGLRenderer(),{sampling:this._runtime.GetSampling()}),d.ReplaceWith(c),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))})()},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._isPlayingForwards?this._currentAnimationSpeed:-this._currentAnimationSpeed},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.Keyboard=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Keyboard.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";C3.Plugins.Keyboard.Instance=class extends C3.SDKInstanceBase{constructor(a){super(a),this._keyMap=Array(256),this._typedKeyMap=Array(256),this._triggerKey=0;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()}async _OnKeyDown(a){const b=a["which"];this._keyMap[b]||(this._keyMap[b]=!0,this._typedKeyMap[b]=a["key"],this._triggerKey=b,await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnAnyKey),await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnKey),await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnKeyCode))}async _OnKeyUp(a){const b=a["which"];this._keyMap[b]=!1,this._typedKeyMap[b]=a["key"],this._triggerKey=b,await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased),await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnKeyReleased),await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased)}async _OnWindowBlur(){for(let a=0,b=this._keyMap.length;a<b;++a)this._keyMap[a]&&(this._keyMap[a]=!1,this._triggerKey=a,await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnAnyKeyReleased),await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnKeyReleased),await this.TriggerAsync(C3.Plugins.Keyboard.Cnds.OnKeyCodeReleased))}SaveToJson(){return{"tk":this._triggerKey}}LoadFromJson(a){this._triggerKey=a["tk"]}GetDebuggerProperties(){return[{title:"plugins.keyboard.name",properties:[{name:"plugins.keyboard.debugger.last-key-code",value:this._triggerKey},{name:"plugins.keyboard.debugger.last-key-string",value:C3.Plugins.Keyboard.Exps.StringFromKeyCode(this._triggerKey)},{name:"plugins.keyboard.debugger.last-typed-key",value:this._typedKeyMap[this._triggerKey]||""}]}]}};
"use strict";C3.Plugins.Keyboard.Cnds={IsKeyDown(a){return!!this._keyMap[a]},OnKey(a){return this._triggerKey===a},OnAnyKey(){return!0},OnAnyKeyReleased(){return!0},OnKeyReleased(a){return this._triggerKey===a},IsKeyCodeDown(a){return a=Math.floor(a),!(0>a||a>=this._keyMap.length)&&!!this._keyMap[a]},OnKeyCode(a){return this._triggerKey===a},OnKeyCodeReleased(a){return this._triggerKey===a}};
"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._triggerKey},StringFromKeyCode(b){return a(b)},TypedKey(){return this._typedKeyMap[this._triggerKey]||""}}}
"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();}}SetPropertyOffsetValueByIndex(a,b){0!==b&&(3===a?(this._ptSize+=b,this._UpdateTextSettings()):4===a?(this._lineHeightOffset+=b,this._UpdateTextSettings()):void 0)}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())}_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()}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)}]}]}}}
"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;if(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)return!1;this._faceName=a,this._isBold=c,this._isItalic=d;const e=this._webglText;e.SetFontName(this._faceName),e.SetBold(this._isBold),e.SetItalic(this._isItalic),this._runtime.UpdateRender()},SetFontSize(a){this._ptSize===a||(this._ptSize=a,this._webglText.SetFontSize(this._ptSize),this._runtime.UpdateRender())},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(){-1===this._typewriterEndTime||(this._CancelTypewriter(),this.Trigger(C3.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}}}
"use strict";C3.Plugins.Text.Exps={Text(){return this._text},PlainText(){return C3.BBString.StripAnyTags(this._text)},FaceName(){return this._faceName},FaceSize(){return this._ptSize},TextWidth(){return this._UpdateTextSize(),this._webglText.GetTextWidth()},TextHeight(){return this._UpdateTextSize(),this._webglText.GetTextHeight()}};
"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"];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})}Release(){super.Release()}GetElementState(){return{"text":this._text,"placeholder":this._placeholder,"title":this._title,"isEnabled":this._isEnabled,"isReadOnly":this._isReadOnly,"spellCheck":this._spellCheck,"id":this._id}}async _OnClick(){await this.TriggerAsync(C3.Plugins.TextBox.Cnds.OnClicked)}async _OnDoubleClick(){await this.TriggerAsync(C3.Plugins.TextBox.Cnds.OnDoubleClicked)}async _OnChange(a){this._text=a["text"],await this.TriggerAsync(C3.Plugins.TextBox.Cnds.OnTextChanged)}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)}]}]}}}
"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._text===a||(this._text=a,this.UpdateElementState())},SetPlaceholder(a){this._placeholder===a||(this._placeholder=a,this.UpdateElementState())},SetTooltip(a){this._title===a||(this._title=a,this.UpdateElementState())},SetVisible(a){const b=this.GetWorldInfo();a=0!==a;b.IsVisible()===a||b.SetVisible(a)},SetEnabled(a){a=0!==a;this._isEnabled===a||(this._isEnabled=a,this.UpdateElementState())},SetReadOnly(a){a=0===a;this._isReadOnly===a||(this._isReadOnly=a,this.UpdateElementState())},SetFocus(){this.FocusElement()},SetBlur(){this.BlurElement()},SetCSSStyle(a,b){this.SetElementCSSStyle(a,b)},ScrollToBottom(){this.PostToDOMElement("scroll-to-bottom")}};
"use strict";C3.Plugins.TextBox.Exps={Text(){return this._text}};
"use strict";C3.Plugins.Mouse=class extends C3.SDKPluginBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Plugins.Mouse.Type=class extends C3.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"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,"mousemove",(a)=>this._OnMouseMove(a.data)),C3.Disposable.From(b,"mousedown",(a)=>this._OnMouseDown(a.data)),C3.Disposable.From(b,"mouseup",(a)=>this._OnMouseUp(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()}_OnMouseMove(a){this._mouseXcanvas=a["clientX"]-this._runtime.GetCanvasClientX(),this._mouseYcanvas=a["clientY"]-this._runtime.GetCanvasClientY()}async _OnMouseDown(a){const b=a["button"];this._buttonMap[b]=!0,await this.TriggerAsync(C3.Plugins.Mouse.Cnds.OnAnyClick),this._triggerButton=b,this._triggerType=0,await this.TriggerAsync(C3.Plugins.Mouse.Cnds.OnClick),await this.TriggerAsync(C3.Plugins.Mouse.Cnds.OnObjectClicked)}async _OnMouseUp(a){const b=a["button"];this._buttonMap[b]&&(this._buttonMap[b]=!1,this._triggerButton=b,await this.TriggerAsync(C3.Plugins.Mouse.Cnds.OnRelease))}async _OnDoubleClick(a){this._triggerButton=a["button"],this._triggerType=1,await this.TriggerAsync(C3.Plugins.Mouse.Cnds.OnClick),await this.TriggerAsync(C3.Plugins.Mouse.Cnds.OnObjectClicked)}async _OnMouseWheel(a){this._triggerDir=0>a["deltaY"]?1:0,await this.TriggerAsync(C3.Plugins.Mouse.Cnds.OnWheel)}async _OnWindowBlur(){for(let a=0,b=this._buttonMap.length;a<b;++a){if(!this._buttonMap[a])return;this._buttonMap[a]=!1,this._triggerButton=a,await this.TriggerAsync(C3.Plugins.Mouse.Cnds.OnRelease)}}_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";{function a(a,b,c,d,e){if("undefined"==typeof b){const b=a.GetLayerByIndex(0);return b.CanvasCssToLayer_DefaultTransform(c,d)[e?0:1]}else{const f=a.GetLayer(b);return f?f.CanvasCssToLayer(c,d)[e?0:1]:0}}C3.Plugins.Mouse.Exps={X(b){return a(this._runtime.GetCurrentLayout(),b,this._mouseXcanvas,this._mouseYcanvas,!0)},Y(b){return a(this._runtime.GetCurrentLayout(),b,this._mouseXcanvas,this._mouseYcanvas,!1)},AbsoluteX(){return this._mouseXcanvas},AbsoluteY(){return this._mouseYcanvas}}}
"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.GetSavedDataMap().set("solidEnabled",!!a)}IsEnabled(){return this._inst.GetSavedDataMap().get("solidEnabled")}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)}};
"use strict";C3.Behaviors.solid.Exps={};
"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)}const b=0;C3.Behaviors.Platform.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a,c){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,c&&(this._maxSpeed=c[b],this._acc=c[1],this._dec=c[2],this._jumpStrength=c[3],this._g=c[4],this._maxFall=c[5],this._enableDoubleJump=!!c[6],this._jumpSustain=c[7]/1e3,this._defaultControls=!!c[8],this._isEnabled=!!c[9]);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._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=this._MaybePushOutSolid();if(j)return;this._TrackFloor(i,h,f,d),e=this._HandleJump(i,e,d),i||this._ApplyJumpGravity(e,d,a),this._wasOnFloor=!!i;const k=this._ApplyHorizontalAcceleration(b,c,a);let m=!1;if(0!==this._dx&&(m=this._HandleHorizontalMovement(a,k,i,e)),0!==this._dy){const b=this._HandleVerticalMovement(a,i);m=m||b}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(){const a=this._inst,b=a.GetWorldInfo(),c=this._runtime.GetCollisionEngine(),d=c.TestOverlapSolid(a);return!!d&&(a.GetSavedDataMap().get("inputPredicted")?(c.PushOutSolid(a,-this._downX,-this._downY,10,!1),!1):c.PushOutSolidAxis(a,-this._downX,-this._downY,b.GetHeight()/8)?(c.RegisterCollision(a,d),!1):c.PushOutSolidAxis(a,this._rightX,this._rightY,b.GetWidth()/2)?(c.RegisterCollision(a,d),!1):c.PushOutSolidAxis(a,this._downX,this._downY,b.GetHeight()/2)?(c.RegisterCollision(a,d),!1):!c.PushOutSolidNearest(a,Math.max(b.GetWidth(),b.GetHeight())/2)||(c.RegisterCollision(a,d),!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,s=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 t=!1;const u=i.TestOverlapSolid(g);h.SetXY(p+r,q+s),h.SetBboxChanged();let v=i.TestOverlapSolid(g);if(!v&&d&&(v=i.TestOverlapJumpthru(g),v&&(h.SetXY(p,q),h.SetBboxChanged(),i.TestOverlap(g,v)?(v=null,t=!1):t=!0,h.SetXY(p+r,q+s),h.SetBboxChanged())),v){let a=f(this._dx*b)+2;u||!i.PushOutSolid(g,-j,-k,a,t,v)?(i.RegisterCollision(g,v),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&&!t&&!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()),!t&&(this._dx=0)):!u&&!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){var d=Math.abs;const e=this._inst,f=e.GetWorldInfo(),g=this._runtime.GetCollisionEngine(),h=this._downX,i=this._downY;let j=!1,k=f.GetX(),l=f.GetY();f.OffsetXY(a(this._dy,-Infinity,this._maxFall,this._g,b)*h,a(this._dy,-Infinity,this._maxFall,this._g,b)*i);const m=f.GetX(),n=f.GetY();f.SetBboxChanged();let o=g.TestOverlapSolid(e),p=!1;if(!o&&0<this._dy&&!c){const a=0<this._fallThrough?null:g.TestOverlapJumpthru(e,!0);if(a&&a.length){if(this._wasOverJumpthru){f.SetXY(k,l),f.SetBboxChanged();let b=0;for(let c=0,d=a.length;c<d;++c)a[b]=a[c],g.TestOverlap(e,a[c])||++b;C3.truncateArray(a,b),f.SetXY(m,n),f.SetBboxChanged()}1<=a.length&&(o=a[0])}p=!!o}if(o){g.RegisterCollision(e,o),this._sustainTime=0;const a=p?d(2.5*(this._dy*b)+10):Math.max(d(2.5*(this._dy*b)+10),30);if(!g.PushOutSolid(e,h*(0>this._dy?1:-1),i*(0>this._dy?1:-1),a,p,o))f.SetXY(k,l),f.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&&(j=!0),(0<this._dy||0===this._ceilingCollisionMode)&&(this._dy=0),0>this._dy&&1===this._ceilingCollisionMode&&g.PushInFractional(e,h,i,o,32)}}return 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")))}GetPropertyValueByIndex(a){return a===0?this._maxSpeed:1===a?this._acc:2===a?this._dec:3===a?this._jumpStrength:4===a?this._g:5===a?this._maxFall:6===a?this._enableDoubleJump:7===a?1e3*this._jumpSustain:8===a?this._defaultControls:9===a?this._isEnabled:void 0}SetPropertyValueByIndex(a,c){switch(a){case b:this._maxSpeed=c;break;case 1:this._acc=c;break;case 2:this._dec=c;break;case 3:this._jumpStrength=c;break;case 4:if(this._g===c)return;this._g=c,this._UpdateGravity();break;case 5:this._maxFall=c;break;case 6:this._enableDoubleJump=!!c;break;case 7:this._jumpSustain=c/1e3;break;case 8:this._defaultControls=!!c,this._defaultControls?this._BindEvents():this._UnBindEvents();break;case 9:this._SetEnabled(c);}}SetPropertyOffsetValueByIndex(a,b){0!==b&&(0===a?this._maxSpeed+=b:1===a?this._acc+=b:2===a?this._dec+=b:3===a?this._jumpStrength+=b:4===a?(this._g+=b,this._UpdateGravity()):5===a?this._maxFall+=b:7===a?this._jumpSustain+=b/1e3:void 0)}_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))}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.platform.debugger.vector-x",value:this._dx,onedit:(a)=>this._dx=a},{name:"behaviors.platform.debugger.vector-y",value:this._dy,onedit:(a)=>this._dy=a},{name:"behaviors.platform.properties.max-speed.name",value:this._maxSpeed,onedit:(a)=>this._maxSpeed=a},{name:"behaviors.platform.properties.acceleration.name",value:this._acc,onedit:(a)=>this._acc=a},{name:"behaviors.platform.properties.deceleration.name",value:this._dec,onedit:(a)=>this._dec=a},{name:"behaviors.platform.properties.jump-strength.name",value:this._jumpStrength,onedit:(a)=>this._jumpStrength=a},{name:"behaviors.platform.properties.gravity.name",value:this._g,onedit:(a)=>this._g=a},{name:"behaviors.platform.debugger.gravity-angle",value:C3.toDegrees(this._ga),onedit:(a)=>this._ga=C3.toRadians(a)},{name:"behaviors.platform.properties.max-fall-speed.name",value:this._maxFall,onedit:(a)=>this._maxFall=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)}]}]}}}
"use strict";C3.Behaviors.Platform.Cnds={IsMoving(){return 0!==this._dx||0!==this._dy},CompareSpeed(a,b){return C3.compare(Math.hypot(this._dx,this._dy),a,b)},IsOnFloor(){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},IsJumping(){return 0>this._dy},IsFalling(){return 0<this._dy},IsDoubleJumpEnabled(){return this._enableDoubleJump},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={SetIgnoreInput(a){this._ignoreInput=!!a},SetMaxSpeed(a){this._maxSpeed=Math.max(a,0)},SetAcceleration(a){this._acc=Math.max(a,0)},SetDeceleration(a){this._dec=Math.max(a,0)},SetJumpStrength(a){this._jumpStrength=Math.max(a,0)},SetMaxFallSpeed(a){this._maxFall=Math.max(a,0)},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}},SimulateControl(a){this._isEnabled&&(0===a?this._simLeft=!0:1===a?this._simRight=!0:2===a?this._simJump=!0:void 0)},SetVectorX(a){this._dx=a},SetVectorY(a){this._dy=a},SetGravityAngle(b){b=C3.clampAngle(C3.toRadians(b));this._ga===b||(this._ga=b,this._UpdateGravity(),this._lastFloorObject=null)},SetEnabled(a){this._SetEnabled(0!==a)},FallThrough(){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)},SetDoubleJumpEnabled(a){this._enableDoubleJump=0!==a},SetJumpSustain(a){this._jumpSustain=a/1e3},SetCeilingCollision(a){this._ceilingCollisionMode=a}};
"use strict";C3.Behaviors.Platform.Exps={Speed(){return Math.hypot(this._dx,this._dy)},MaxSpeed(){return this._maxSpeed},Acceleration(){return this._acc},Deceleration(){return this._dec},JumpStrength(){return this._jumpStrength},Gravity(){return this._g},GravityAngle(){return C3.toDegrees(this._ga)},MaxFallSpeed(){return this._maxFall},MovingAngle(){return C3.toDegrees(Math.atan2(this._dy,this._dx))},VectorX(){return this._dx},VectorY(){return this._dy},JumpSustain(){return 1e3*this._jumpSustain}};
"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={};
"use strict";C3.Behaviors.Flash=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.Flash.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";C3.Behaviors.Flash.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a){super(a),this._onTime=0,this._offTime=0,this._stage=0,this._stageTimeLeft=0,this._timeLeft=0,this._StartTicking()}Release(){super.Release()}SaveToJson(){return{"on":this._onTime,"off":this._offTime,"s":this._stage,"stl":this._stageTimeLeft,"tl":this._timeLeft}}LoadFromJson(a){this._onTime=a["on"],this._offTime=a["off"],this._stage=a["s"],this._stageTimeLeft=a["stl"],this._timeLeft=null===a["tl"]?1/0:a["tl"]}Tick(){if(!(0>=this._timeLeft)){const a=this._runtime.GetDt(this._inst);return this._timeLeft-=a,0>=this._timeLeft?(this._timeLeft=0,this._inst.GetWorldInfo().SetVisible(!0),this._runtime.UpdateRender(),this.DebugTrigger(C3.Behaviors.Flash.Cnds.OnFlashEnded)):void(this._stageTimeLeft-=a,0>=this._stageTimeLeft&&(0===this._stage?(this._inst.GetWorldInfo().SetVisible(!1),this._stage=1,this._stageTimeLeft+=this._offTime):(this._inst.GetWorldInfo().SetVisible(!0),this._stage=0,this._stageTimeLeft+=this._onTime),this._runtime.UpdateRender()))}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.flash.debugger.on-time",value:this._onTime,onedit:(a)=>this._onTime=a},{name:"behaviors.flash.debugger.off-time",value:this._offTime,onedit:(a)=>this._offTime=a},{name:"behaviors.flash.debugger.is-flashing",value:0<this._timeLeft},{name:"behaviors.flash.debugger.time-left",value:this._timeLeft}]}]}};
"use strict";C3.Behaviors.Flash.Cnds={IsFlashing(){return 0<this._timeLeft},OnFlashEnded(){return!0}};
"use strict";C3.Behaviors.Flash.Acts={Flash(a,b,c){this._onTime=a,this._offTime=b,this._stage=1,this._stageTimeLeft=b,this._timeLeft=c,this._inst.GetWorldInfo().SetVisible(!1),this._runtime.UpdateRender()},StopFlashing(){this._timeLeft=0,this._inst.GetWorldInfo().SetVisible(!0),this._runtime.UpdateRender()}};
"use strict";C3.Behaviors.Flash.Exps={};
"use strict";C3.Behaviors.EightDir=class extends C3.SDKBehaviorBase{constructor(a){super(a)}Release(){super.Release()}};
"use strict";C3.Behaviors.EightDir.Type=class extends C3.SDKBehaviorTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}};
"use strict";{C3.Behaviors.EightDir.Instance=class extends C3.SDKBehaviorInstanceBase{constructor(a,b){super(a),this._upKey=!1,this._downKey=!1,this._leftKey=!1,this._rightKey=!1,this._ignoreInput=!1,this._simUp=!1,this._simDown=!1,this._simLeft=!1,this._simRight=!1,this._dx=0,this._dy=0,this._maxSpeed=200,this._acc=600,this._dec=500,this._directions=3,this._angleMode=3,this._defaultControls=!0,this._isEnabled=!0,b&&(this._maxSpeed=b[0],this._acc=b[1],this._dec=b[2],this._directions=b[3],this._angleMode=b[4],this._defaultControls=!!b[5],this._isEnabled=!!b[6]),this._isEnabled&&this._StartTicking(),this._defaultControls&&this._BindEvents()}_BindEvents(){if(!this._disposables){const a=this._runtime.Dispatcher();this._disposables=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._disposables&&(this._disposables.Release(),this._disposables=null)}Release(){super.Release()}SaveToJson(){return{"dx":this._dx,"dy":this._dy,"e":this._isEnabled,"ms":this._maxSpeed,"acc":this._acc,"dec":this._dec,"d":this._directions,"am":this._angleMode,"dc":this._defaultControls,"ii":this._ignoreInput}}LoadFromJson(a){this._dx=a["dx"],this._dy=a["dy"],this._SetEnabled(a["e"]),this._maxSpeed=a["ms"],this._acc=a["acc"],this._dec=a["dec"],this._directions=a["d"],this._angleMode=a["am"],this._defaultControls=a["dc"],this._ignoreInput=a["ii"],this._upKey=!1,this._downKey=!1,this._leftKey=!1,this._rightKey=!1,this._simUp=!1,this._simDown=!1,this._simLeft=!1,this._simRight=!1,this._defaultControls?this._BindEvents():this._UnBindEvents()}_OnKeyDown(a){switch(a["key"]){case"ArrowLeft":this._leftKey=!0;break;case"ArrowUp":this._upKey=!0;break;case"ArrowRight":this._rightKey=!0;break;case"ArrowDown":this._downKey=!0;}}_OnKeyUp(a){switch(a["key"]){case"ArrowLeft":this._leftKey=!1;break;case"ArrowUp":this._upKey=!1;break;case"ArrowRight":this._rightKey=!1;break;case"ArrowDown":this._downKey=!1;}}_OnWindowBlur(){this._upKey=!1,this._downKey=!1,this._leftKey=!1,this._rightKey=!1}Tick(){var b=Math.round,c=Math.floor,d=Math.abs,e=Math.atan2,a=Math.max,f=Math.min;const g=this._runtime.GetDt(this._inst),h=this._runtime.GetCollisionEngine();let i=this._leftKey||this._simLeft,j=this._rightKey||this._simRight,k=this._upKey||this._simUp,l=this._downKey||this._simDown;if(this._simLeft=!1,this._simRight=!1,this._simUp=!1,this._simDown=!1,!this._isEnabled)return;let m=h.TestOverlapSolid(this._inst);if(m&&(h.RegisterCollision(this._inst,m),!h.PushOutSolidNearest(this._inst)))return;this._ignoreInput&&(i=j=k=l=!1),0===this._directions?i=j=!1:1===this._directions&&(k=l=!1),2===this._directions&&(k||l)&&(i=j=!1),i===j&&(0>this._dx?this._dx=f(this._dx+this._dec*g,0):0<this._dx&&(this._dx=a(this._dx-this._dec*g,0))),k===l&&(0>this._dy?this._dy=f(this._dy+this._dec*g,0):0<this._dy&&(this._dy=a(this._dy-this._dec*g,0)));let n=0,o=0;if(i&&!j&&(0<this._dx?n=-(this._acc+this._dec):n=-this._acc),j&&!i&&(0>this._dx?n=this._acc+this._dec:n=this._acc),k&&!l&&(0<this._dy?o=-(this._acc+this._dec):o=-this._acc),l&&!k&&(0>this._dy?o=this._acc+this._dec:o=this._acc),this._dx+=n*g,this._dy+=o*g,0!==this._dx||0!==this._dy){const f=Math.sqrt(this._dx*this._dx+this._dy*this._dy),i=e(this._dy,this._dx),a=this._maxSpeed*Math.cos(i),j=this._maxSpeed*Math.sin(i);f>this._maxSpeed&&(this._dx=a,this._dy=j);const k=d(a)*g,l=d(j)*g,p=this._inst.GetWorldInfo(),q=p.GetX(),r=p.GetY(),s=p.GetAngle(),t=C3.clamp(this._dx*g+.5*n*g*g,-k,k);p.OffsetX(t),p.SetBboxChanged(),m=h.TestOverlapSolid(this._inst),m&&(!h.PushOutSolid(this._inst,0>this._dx?1:-1,0,d(c(t)))&&(p.SetX(q),p.SetBboxChanged()),this._dx=0,h.RegisterCollision(this._inst,m));const u=C3.clamp(this._dy*g+.5*o*g*g,-l,l);p.OffsetY(u),p.SetBboxChanged(),m=h.TestOverlapSolid(this._inst),m&&(!h.PushOutSolid(this._inst,0,0>this._dy?1:-1,d(c(u)))&&(p.SetY(r),p.SetBboxChanged()),this._dy=0,h.RegisterCollision(this._inst,m));const v=C3.round6dp(this._dx),w=C3.round6dp(this._dy);(0!==v||0!==w)&&this._inst.GetPlugin().IsRotatable()&&(1===this._angleMode?p.SetAngle(C3.toRadians(90*b(C3.toDegrees(e(w,v))/90))):2===this._angleMode?p.SetAngle(C3.toRadians(45*b(C3.toDegrees(e(w,v))/45))):3===this._angleMode&&p.SetAngle(e(w,v))),p.SetBboxChanged(),p.GetAngle()!=s&&(m=h.TestOverlapSolid(this._inst),m&&(p.SetAngle(s),p.SetBboxChanged(),h.RegisterCollision(this._inst,m)))}}GetPropertyValueByIndex(a){return a===0?this._maxSpeed:1===a?this._acc:2===a?this._dec:3===a?this._directions:4===a?this._angleMode:5===a?this._defaultControls:6===a?this._isEnabled:void 0}SetPropertyValueByIndex(a,b){a===0?this._maxSpeed=b:1===a?this._acc=b:2===a?this._dec=b:3===a?this._directions=b:4===a?this._angleMode=b:5===a?(this._defaultControls=!!b,this._defaultControls?this._BindEvents():this._UnBindEvents()):6===a?this._SetEnabled(b):void 0}SetPropertyOffsetValueByIndex(a,b){0!==b&&(0===a?this._maxSpeed+=b:1===a?this._acc+=b:2===a?this._dec+=b:void 0)}_SetSpeed(b){b=C3.clamp(b,0,this._maxSpeed);const c=Math.atan2(this._dy,this._dx);this._dx=b*Math.cos(c),this._dy=b*Math.sin(c)}_SetEnabled(a){this._isEnabled=!!a,this._isEnabled?this._StartTicking():(this._simLeft=!1,this._simRight=!1,this._simUp=!1,this._simDown=!1,this._StopTicking())}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.eightdir.debugger.vector-x",value:this._dx,onedit:(a)=>this._dx=a},{name:"behaviors.eightdir.debugger.vector-y",value:this._dy,onedit:(a)=>this._dy=a},{name:"behaviors.eightdir.debugger.speed",value:Math.hypot(this._dx,this._dy),onedit:(a)=>this._SetSpeed(a)},{name:"behaviors.eightdir.debugger.angle-of-motion",value:C3.toDegrees(Math.atan2(this._dy,this._dx))},{name:"behaviors.eightdir.properties.max-speed.name",value:this._maxSpeed,onedit:(a)=>this._maxSpeed=a},{name:"behaviors.eightdir.properties.acceleration.name",value:this._acc,onedit:(a)=>this._acc=a},{name:"behaviors.eightdir.properties.deceleration.name",value:this._dec,onedit:(a)=>this._dec=a},{name:"behaviors.eightdir.properties.enabled.name",value:this._isEnabled,onedit:(a)=>this._SetEnabled(a)}]}]}}}
"use strict";C3.Behaviors.EightDir.Cnds={IsMoving(){const a=Math.sqrt(this._dx*this._dx+this._dy*this._dy);return 1e-10<a},CompareSpeed(a,b){const c=Math.sqrt(this._dx*this._dx+this._dy*this._dy);return C3.compare(c,a,b)},IsEnabled(){return this._isEnabled}};
"use strict";C3.Behaviors.EightDir.Acts={Stop(){this._dx=0,this._dy=0},Reverse(){this._dx*=-1,this._dy*=-1},SetIgnoreInput(a){this._ignoreInput=!!a},SetSpeed(a){this._SetSpeed(a)},SetMaxSpeed(a){this._maxSpeed=Math.max(a,0)},SetAcceleration(a){this._acc=Math.max(a,0)},SetDeceleration(a){this._dec=Math.max(a,0)},SimulateControl(a){this._isEnabled&&(0===a?this._simLeft=!0:1===a?this._simRight=!0:2===a?this._simUp=!0:3===a?this._simDown=!0:void 0)},SetEnabled(a){this._SetEnabled(a)},SetVectorX(a){this._dx=a},SetVectorY(a){this._dy=a}};
"use strict";C3.Behaviors.EightDir.Exps={Speed(){return Math.hypot(this._dx,this._dy)},MaxSpeed(){return this._maxSpeed},Acceleration(){return this._acc},Deceleration(){return this._dec},MovingAngle(){return C3.toDegrees(Math.atan2(this._dy,this._dx))},VectorX(){return this._dx},VectorY(){return this._dy}};
"use strict"
self.C3_GetObjectRefTable = function () {
return [
C3.Plugins.Sprite,
C3.Behaviors.solid,
C3.Behaviors.Platform,
C3.Behaviors.scrollto,
C3.Behaviors.Flash,
C3.Plugins.Keyboard,
C3.Plugins.Text,
C3.Behaviors.EightDir,
C3.Plugins.TextBox,
C3.Plugins.Mouse,
C3.Plugins.System.Cnds.IsGroupActive,
C3.Behaviors.Platform.Cnds.IsMoving,
C3.Behaviors.Platform.Cnds.IsOnFloor,
C3.Plugins.Sprite.Acts.SetInstanceVar,
C3.Plugins.Sprite.Cnds.CompareInstanceVar,
C3.Plugins.Sprite.Acts.SetAnim,
C3.Plugins.Sprite.Acts.SetMirrored,
C3.Behaviors.Platform.Cnds.IsJumping,
C3.Plugins.Sprite.Cnds.OnCollision,
C3.Plugins.System.Acts.SubVar,
C3.Plugins.System.Acts.SetVar,
C3.Plugins.System.Cnds.OnLayoutStart,
C3.Plugins.System.Cnds.EveryTick,
C3.Plugins.Sprite.Acts.SetPos,
C3.Plugins.Sprite.Exps.X,
C3.Plugins.Sprite.Exps.Y,
C3.Plugins.Keyboard.Cnds.OnKey,
C3.Plugins.System.Exps.dt,
C3.Plugins.System.Cnds.CompareVar,
C3.Plugins.Sprite.Acts.SetBoolInstanceVar,
C3.Plugins.Sprite.Cnds.IsBoolInstanceVarSet,
C3.Behaviors.Platform.Acts.SetGravity,
C3.Behaviors.Platform.Acts.SetIgnoreInput,
C3.Plugins.System.Acts.Wait,
C3.Plugins.System.Acts.RestartLayout,
C3.Behaviors.Platform.Cnds.IsByWall,
C3.Behaviors.Platform.Acts.SetMaxFallSpeed,
C3.Behaviors.Platform.Acts.SetVectorX,
C3.Behaviors.Platform.Acts.SetVectorY,
C3.Plugins.System.Acts.AddVar,
C3.Behaviors.Platform.Acts.SetMaxSpeed,
C3.Behaviors.EightDir.Acts.SimulateControl,
C3.Plugins.Sprite.Cnds.IsOverlapping,
C3.Plugins.System.Cnds.Compare,
C3.Plugins.System.Exps.layoutname,
C3.Plugins.System.Acts.GoToLayout,
C3.Plugins.Sprite.Acts.Destroy,
C3.Plugins.Sprite.Acts.SetVisible,
C3.Plugins.Text.Acts.SetText,
C3.Plugins.Text.Acts.SetVisible,
C3.Plugins.Text.Cnds.IsVisible,
C3.Plugins.Text.Acts.SetInstanceVar,
C3.Plugins.Text.Acts.AddInstanceVar,
C3.Plugins.Text.Cnds.CompareInstanceVar,
C3.Plugins.TextBox.Cnds.OnTextChanged,
C3.Plugins.TextBox.Exps.Text,
C3.Plugins.TextBox.Cnds.CompareText,
C3.Plugins.Mouse.Cnds.IsOverObject,
C3.Plugins.Text.Acts.SetFontColor,
C3.Plugins.Text.Acts.SetFontSize,
C3.Plugins.Mouse.Cnds.OnObjectClicked,
C3.Plugins.System.Acts.ScrollX,
C3.Plugins.Keyboard.Cnds.OnKeyReleased
];
};
"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",
() => "walk",
() => "idle",
() => "right",
() => "left",
() => "jump",
() => 1,
() => 0,
() => "System",
p => {
const n0 = p._GetNode(0);
return () => n0.ExpObject();
},
() => 100,
p => {
const f0 = p._GetNode(0).GetBoundMethod();
return () => f0();
},
() => 350,
() => "Wall Jump",
() => 50,
() => "wall",
() => -500,
() => 500,
() => 1000,
() => "ground",
() => "Air Dash",
() => 1500,
() => 0.07,
() => 400,
() => -1500,
() => "Spotlight_UH_Moonlight_UH",
() => "up",
() => "down",
() => "Layout Changing",
() => "Level 1",
() => "Level 2",
() => "Ghost2",
() => "Coffee",
() => "idleCoffee",
() => "walkCoffee",
() => "Thanks!",
() => "Talking to Customers",
p => {
const v0 = p._GetNode(0).GetVar();
return () => (("Hey " + v0.GetValue()) + ", I'll have a coffee please.");
},
() => "Have you heard from Joe lately? I haven't seen him in a few weeks. Last time I saw him he was having some crazy nightmares.",
() => 2,
() => "Leaving the Room",
() => "StartScreen",
() => "",
() => "hover",
() => -512113514266623,
() => 14,
() => -697957270212607,
() => 12
];
}