@logicflow/layout 1.2.0-alpha.16 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +23 -0
- package/CHANGELOG.md +925 -0
- package/LICENSE +206 -0
- package/README.md +65 -2
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/es/dagre.d.ts +67 -19
- package/es/dagre.js +268 -105
- package/es/dagre.js.map +1 -0
- package/es/index.js +1 -0
- package/es/index.js.map +1 -0
- package/lib/dagre.d.ts +73 -0
- package/lib/dagre.js +406 -23
- package/lib/dagre.js.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/package.json +31 -68
- package/rollup.config.js +3 -0
- package/src/dagre.ts +443 -0
- package/src/index.ts +1 -0
- package/stats.html +4842 -0
- package/tsconfig.json +20 -0
- package/cjs/dagre.js +0 -221
- package/cjs/index.js +0 -13
- package/types/dagre.d.ts +0 -25
- /package/{types → lib}/index.d.ts +0 -0
package/lib/dagre.js
CHANGED
|
@@ -1,24 +1,407 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=309)}([function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return o})),n.d(e,"e",(function(){return a}));var r={};n.r(r),n.d(r,"create",(function(){return l})),n.d(r,"fromMat4",(function(){return h})),n.d(r,"clone",(function(){return d})),n.d(r,"copy",(function(){return p})),n.d(r,"fromValues",(function(){return m})),n.d(r,"set",(function(){return v})),n.d(r,"identity",(function(){return g})),n.d(r,"transpose",(function(){return y})),n.d(r,"invert",(function(){return b})),n.d(r,"adjoint",(function(){return _})),n.d(r,"determinant",(function(){return E})),n.d(r,"multiply",(function(){return w})),n.d(r,"translate",(function(){return x})),n.d(r,"rotate",(function(){return T})),n.d(r,"scale",(function(){return A})),n.d(r,"fromTranslation",(function(){return S})),n.d(r,"fromRotation",(function(){return R})),n.d(r,"fromScaling",(function(){return O})),n.d(r,"fromMat2d",(function(){return C})),n.d(r,"fromQuat",(function(){return M})),n.d(r,"normalFromMat4",(function(){return I})),n.d(r,"projection",(function(){return N})),n.d(r,"str",(function(){return P})),n.d(r,"frob",(function(){return k})),n.d(r,"add",(function(){return D})),n.d(r,"subtract",(function(){return L})),n.d(r,"multiplyScalar",(function(){return j})),n.d(r,"multiplyScalarAndAdd",(function(){return F})),n.d(r,"exactEquals",(function(){return B})),n.d(r,"equals",(function(){return U})),n.d(r,"mul",(function(){return G})),n.d(r,"sub",(function(){return V}));var i={};n.r(i),n.d(i,"create",(function(){return z})),n.d(i,"clone",(function(){return W})),n.d(i,"copy",(function(){return H})),n.d(i,"fromValues",(function(){return q})),n.d(i,"set",(function(){return X})),n.d(i,"identity",(function(){return Y})),n.d(i,"transpose",(function(){return K})),n.d(i,"invert",(function(){return Q})),n.d(i,"adjoint",(function(){return $})),n.d(i,"determinant",(function(){return Z})),n.d(i,"multiply",(function(){return J})),n.d(i,"translate",(function(){return tt})),n.d(i,"scale",(function(){return et})),n.d(i,"rotate",(function(){return nt})),n.d(i,"rotateX",(function(){return rt})),n.d(i,"rotateY",(function(){return it})),n.d(i,"rotateZ",(function(){return ot})),n.d(i,"fromTranslation",(function(){return at})),n.d(i,"fromScaling",(function(){return ut})),n.d(i,"fromRotation",(function(){return st})),n.d(i,"fromXRotation",(function(){return ct})),n.d(i,"fromYRotation",(function(){return ft})),n.d(i,"fromZRotation",(function(){return lt})),n.d(i,"fromRotationTranslation",(function(){return ht})),n.d(i,"fromQuat2",(function(){return dt})),n.d(i,"getTranslation",(function(){return pt})),n.d(i,"getScaling",(function(){return mt})),n.d(i,"getRotation",(function(){return vt})),n.d(i,"fromRotationTranslationScale",(function(){return gt})),n.d(i,"fromRotationTranslationScaleOrigin",(function(){return yt})),n.d(i,"fromQuat",(function(){return bt})),n.d(i,"frustum",(function(){return _t})),n.d(i,"perspectiveNO",(function(){return Et})),n.d(i,"perspective",(function(){return wt})),n.d(i,"perspectiveZO",(function(){return xt})),n.d(i,"perspectiveFromFieldOfView",(function(){return Tt})),n.d(i,"orthoNO",(function(){return At})),n.d(i,"ortho",(function(){return St})),n.d(i,"orthoZO",(function(){return Rt})),n.d(i,"lookAt",(function(){return Ot})),n.d(i,"targetTo",(function(){return Ct})),n.d(i,"str",(function(){return Mt})),n.d(i,"frob",(function(){return It})),n.d(i,"add",(function(){return Nt})),n.d(i,"subtract",(function(){return Pt})),n.d(i,"multiplyScalar",(function(){return kt})),n.d(i,"multiplyScalarAndAdd",(function(){return Dt})),n.d(i,"exactEquals",(function(){return Lt})),n.d(i,"equals",(function(){return jt})),n.d(i,"mul",(function(){return Ft})),n.d(i,"sub",(function(){return Bt}));var o={};n.r(o),n.d(o,"create",(function(){return Ut})),n.d(o,"clone",(function(){return Gt})),n.d(o,"length",(function(){return Vt})),n.d(o,"fromValues",(function(){return zt})),n.d(o,"copy",(function(){return Wt})),n.d(o,"set",(function(){return Ht})),n.d(o,"add",(function(){return qt})),n.d(o,"subtract",(function(){return Xt})),n.d(o,"multiply",(function(){return Yt})),n.d(o,"divide",(function(){return Kt})),n.d(o,"ceil",(function(){return Qt})),n.d(o,"floor",(function(){return $t})),n.d(o,"min",(function(){return Zt})),n.d(o,"max",(function(){return Jt})),n.d(o,"round",(function(){return te})),n.d(o,"scale",(function(){return ee})),n.d(o,"scaleAndAdd",(function(){return ne})),n.d(o,"distance",(function(){return re})),n.d(o,"squaredDistance",(function(){return ie})),n.d(o,"squaredLength",(function(){return oe})),n.d(o,"negate",(function(){return ae})),n.d(o,"inverse",(function(){return ue})),n.d(o,"normalize",(function(){return se})),n.d(o,"dot",(function(){return ce})),n.d(o,"cross",(function(){return fe})),n.d(o,"lerp",(function(){return le})),n.d(o,"hermite",(function(){return he})),n.d(o,"bezier",(function(){return de})),n.d(o,"random",(function(){return pe})),n.d(o,"transformMat4",(function(){return me})),n.d(o,"transformMat3",(function(){return ve})),n.d(o,"transformQuat",(function(){return ge})),n.d(o,"rotateX",(function(){return ye})),n.d(o,"rotateY",(function(){return be})),n.d(o,"rotateZ",(function(){return _e})),n.d(o,"angle",(function(){return Ee})),n.d(o,"zero",(function(){return we})),n.d(o,"str",(function(){return xe})),n.d(o,"exactEquals",(function(){return Te})),n.d(o,"equals",(function(){return Ae})),n.d(o,"sub",(function(){return Re})),n.d(o,"mul",(function(){return Oe})),n.d(o,"div",(function(){return Ce})),n.d(o,"dist",(function(){return Me})),n.d(o,"sqrDist",(function(){return Ie})),n.d(o,"len",(function(){return Ne})),n.d(o,"sqrLen",(function(){return Pe})),n.d(o,"forEach",(function(){return ke}));var a={};n.r(a),n.d(a,"create",(function(){return De})),n.d(a,"clone",(function(){return Le})),n.d(a,"fromValues",(function(){return je})),n.d(a,"copy",(function(){return Fe})),n.d(a,"set",(function(){return Be})),n.d(a,"add",(function(){return Ue})),n.d(a,"subtract",(function(){return Ge})),n.d(a,"multiply",(function(){return Ve})),n.d(a,"divide",(function(){return ze})),n.d(a,"ceil",(function(){return We})),n.d(a,"floor",(function(){return He})),n.d(a,"min",(function(){return qe})),n.d(a,"max",(function(){return Xe})),n.d(a,"round",(function(){return Ye})),n.d(a,"scale",(function(){return Ke})),n.d(a,"scaleAndAdd",(function(){return Qe})),n.d(a,"distance",(function(){return $e})),n.d(a,"squaredDistance",(function(){return Ze})),n.d(a,"length",(function(){return Je})),n.d(a,"squaredLength",(function(){return tn})),n.d(a,"negate",(function(){return en})),n.d(a,"inverse",(function(){return nn})),n.d(a,"normalize",(function(){return rn})),n.d(a,"dot",(function(){return on})),n.d(a,"cross",(function(){return an})),n.d(a,"lerp",(function(){return un})),n.d(a,"random",(function(){return sn})),n.d(a,"transformMat4",(function(){return cn})),n.d(a,"transformQuat",(function(){return fn})),n.d(a,"zero",(function(){return ln})),n.d(a,"str",(function(){return hn})),n.d(a,"exactEquals",(function(){return dn})),n.d(a,"equals",(function(){return pn})),n.d(a,"sub",(function(){return mn})),n.d(a,"mul",(function(){return vn})),n.d(a,"div",(function(){return gn})),n.d(a,"dist",(function(){return yn})),n.d(a,"sqrDist",(function(){return bn})),n.d(a,"len",(function(){return _n})),n.d(a,"sqrLen",(function(){return En})),n.d(a,"forEach",(function(){return wn}));var u={};n.r(u),n.d(u,"create",(function(){return xn})),n.d(u,"identity",(function(){return Tn})),n.d(u,"setAxisAngle",(function(){return An})),n.d(u,"getAxisAngle",(function(){return Sn})),n.d(u,"getAngle",(function(){return Rn})),n.d(u,"multiply",(function(){return On})),n.d(u,"rotateX",(function(){return Cn})),n.d(u,"rotateY",(function(){return Mn})),n.d(u,"rotateZ",(function(){return In})),n.d(u,"calculateW",(function(){return Nn})),n.d(u,"exp",(function(){return Pn})),n.d(u,"ln",(function(){return kn})),n.d(u,"pow",(function(){return Dn})),n.d(u,"slerp",(function(){return Ln})),n.d(u,"random",(function(){return jn})),n.d(u,"invert",(function(){return Fn})),n.d(u,"conjugate",(function(){return Bn})),n.d(u,"fromMat3",(function(){return Un})),n.d(u,"fromEuler",(function(){return Gn})),n.d(u,"str",(function(){return Vn})),n.d(u,"clone",(function(){return Kn})),n.d(u,"fromValues",(function(){return Qn})),n.d(u,"copy",(function(){return $n})),n.d(u,"set",(function(){return Zn})),n.d(u,"add",(function(){return Jn})),n.d(u,"mul",(function(){return tr})),n.d(u,"scale",(function(){return er})),n.d(u,"dot",(function(){return nr})),n.d(u,"lerp",(function(){return rr})),n.d(u,"length",(function(){return ir})),n.d(u,"len",(function(){return or})),n.d(u,"squaredLength",(function(){return ar})),n.d(u,"sqrLen",(function(){return ur})),n.d(u,"normalize",(function(){return sr})),n.d(u,"exactEquals",(function(){return cr})),n.d(u,"equals",(function(){return fr})),n.d(u,"rotationTo",(function(){return lr})),n.d(u,"sqlerp",(function(){return hr})),n.d(u,"setAxes",(function(){return dr}));var s=1e-6,c="undefined"!=typeof Float32Array?Float32Array:Array,f=Math.random;Math.PI;function l(){var t=new c(9);return c!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function h(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function d(t){var e=new c(9);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}function p(t,e){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}function m(t,e,n,r,i,o,a,u,s){var f=new c(9);return f[0]=t,f[1]=e,f[2]=n,f[3]=r,f[4]=i,f[5]=o,f[6]=a,f[7]=u,f[8]=s,f}function v(t,e,n,r,i,o,a,u,s,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=a,t[6]=u,t[7]=s,t[8]=c,t}function g(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function y(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function b(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8],l=f*a-u*c,h=-f*o+u*s,d=c*o-a*s,p=n*l+r*h+i*d;return p?(p=1/p,t[0]=l*p,t[1]=(-f*r+i*c)*p,t[2]=(u*r-i*a)*p,t[3]=h*p,t[4]=(f*n-i*s)*p,t[5]=(-u*n+i*o)*p,t[6]=d*p,t[7]=(-c*n+r*s)*p,t[8]=(a*n-r*o)*p,t):null}function _(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8];return t[0]=a*f-u*c,t[1]=i*c-r*f,t[2]=r*u-i*a,t[3]=u*s-o*f,t[4]=n*f-i*s,t[5]=i*o-n*u,t[6]=o*c-a*s,t[7]=r*s-n*c,t[8]=n*a-r*o,t}function E(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],u=t[6],s=t[7],c=t[8];return e*(c*o-a*s)+n*(-c*i+a*u)+r*(s*i-o*u)}function w(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],h=n[0],d=n[1],p=n[2],m=n[3],v=n[4],g=n[5],y=n[6],b=n[7],_=n[8];return t[0]=h*r+d*a+p*c,t[1]=h*i+d*u+p*f,t[2]=h*o+d*s+p*l,t[3]=m*r+v*a+g*c,t[4]=m*i+v*u+g*f,t[5]=m*o+v*s+g*l,t[6]=y*r+b*a+_*c,t[7]=y*i+b*u+_*f,t[8]=y*o+b*s+_*l,t}function x(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],h=n[0],d=n[1];return t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=s,t[6]=h*r+d*a+c,t[7]=h*i+d*u+f,t[8]=h*o+d*s+l,t}function T(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],h=Math.sin(n),d=Math.cos(n);return t[0]=d*r+h*a,t[1]=d*i+h*u,t[2]=d*o+h*s,t[3]=d*a-h*r,t[4]=d*u-h*i,t[5]=d*s-h*o,t[6]=c,t[7]=f,t[8]=l,t}function A(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function S(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function R(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function O(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function C(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function M(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,u=r+r,s=i+i,c=n*a,f=r*a,l=r*u,h=i*a,d=i*u,p=i*s,m=o*a,v=o*u,g=o*s;return t[0]=1-l-p,t[3]=f-g,t[6]=h+v,t[1]=f+g,t[4]=1-c-p,t[7]=d-m,t[2]=h-v,t[5]=d+m,t[8]=1-c-l,t}function I(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8],l=e[9],h=e[10],d=e[11],p=e[12],m=e[13],v=e[14],g=e[15],y=n*u-r*a,b=n*s-i*a,_=n*c-o*a,E=r*s-i*u,w=r*c-o*u,x=i*c-o*s,T=f*m-l*p,A=f*v-h*p,S=f*g-d*p,R=l*v-h*m,O=l*g-d*m,C=h*g-d*v,M=y*C-b*O+_*R+E*S-w*A+x*T;return M?(M=1/M,t[0]=(u*C-s*O+c*R)*M,t[1]=(s*S-a*C-c*A)*M,t[2]=(a*O-u*S+c*T)*M,t[3]=(i*O-r*C-o*R)*M,t[4]=(n*C-i*S+o*A)*M,t[5]=(r*S-n*O-o*T)*M,t[6]=(m*x-v*w+g*E)*M,t[7]=(v*_-p*x-g*b)*M,t[8]=(p*w-m*_+g*y)*M,t):null}function N(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function P(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function k(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function D(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t}function L(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}function j(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t}function F(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t}function B(t,e){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]}function U(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],u=t[5],c=t[6],f=t[7],l=t[8],h=e[0],d=e[1],p=e[2],m=e[3],v=e[4],g=e[5],y=e[6],b=e[7],_=e[8];return Math.abs(n-h)<=s*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(r-d)<=s*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(i-p)<=s*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(o-m)<=s*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(a-v)<=s*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(u-g)<=s*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-y)<=s*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(f-b)<=s*Math.max(1,Math.abs(f),Math.abs(b))&&Math.abs(l-_)<=s*Math.max(1,Math.abs(l),Math.abs(_))}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var G=w,V=L;function z(){var t=new c(16);return c!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function W(t){var e=new c(16);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}function H(t,e){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}function q(t,e,n,r,i,o,a,u,s,f,l,h,d,p,m,v){var g=new c(16);return g[0]=t,g[1]=e,g[2]=n,g[3]=r,g[4]=i,g[5]=o,g[6]=a,g[7]=u,g[8]=s,g[9]=f,g[10]=l,g[11]=h,g[12]=d,g[13]=p,g[14]=m,g[15]=v,g}function X(t,e,n,r,i,o,a,u,s,c,f,l,h,d,p,m,v){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=a,t[6]=u,t[7]=s,t[8]=c,t[9]=f,t[10]=l,t[11]=h,t[12]=d,t[13]=p,t[14]=m,t[15]=v,t}function Y(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function K(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],o=e[6],a=e[7],u=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=u}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Q(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8],l=e[9],h=e[10],d=e[11],p=e[12],m=e[13],v=e[14],g=e[15],y=n*u-r*a,b=n*s-i*a,_=n*c-o*a,E=r*s-i*u,w=r*c-o*u,x=i*c-o*s,T=f*m-l*p,A=f*v-h*p,S=f*g-d*p,R=l*v-h*m,O=l*g-d*m,C=h*g-d*v,M=y*C-b*O+_*R+E*S-w*A+x*T;return M?(M=1/M,t[0]=(u*C-s*O+c*R)*M,t[1]=(i*O-r*C-o*R)*M,t[2]=(m*x-v*w+g*E)*M,t[3]=(h*w-l*x-d*E)*M,t[4]=(s*S-a*C-c*A)*M,t[5]=(n*C-i*S+o*A)*M,t[6]=(v*_-p*x-g*b)*M,t[7]=(f*x-h*_+d*b)*M,t[8]=(a*O-u*S+c*T)*M,t[9]=(r*S-n*O-o*T)*M,t[10]=(p*w-m*_+g*y)*M,t[11]=(l*_-f*w-d*y)*M,t[12]=(u*A-a*R-s*T)*M,t[13]=(n*R-r*A+i*T)*M,t[14]=(m*b-p*E-v*y)*M,t[15]=(f*E-l*b+h*y)*M,t):null}function $(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],c=e[7],f=e[8],l=e[9],h=e[10],d=e[11],p=e[12],m=e[13],v=e[14],g=e[15];return t[0]=u*(h*g-d*v)-l*(s*g-c*v)+m*(s*d-c*h),t[1]=-(r*(h*g-d*v)-l*(i*g-o*v)+m*(i*d-o*h)),t[2]=r*(s*g-c*v)-u*(i*g-o*v)+m*(i*c-o*s),t[3]=-(r*(s*d-c*h)-u*(i*d-o*h)+l*(i*c-o*s)),t[4]=-(a*(h*g-d*v)-f*(s*g-c*v)+p*(s*d-c*h)),t[5]=n*(h*g-d*v)-f*(i*g-o*v)+p*(i*d-o*h),t[6]=-(n*(s*g-c*v)-a*(i*g-o*v)+p*(i*c-o*s)),t[7]=n*(s*d-c*h)-a*(i*d-o*h)+f*(i*c-o*s),t[8]=a*(l*g-d*m)-f*(u*g-c*m)+p*(u*d-c*l),t[9]=-(n*(l*g-d*m)-f*(r*g-o*m)+p*(r*d-o*l)),t[10]=n*(u*g-c*m)-a*(r*g-o*m)+p*(r*c-o*u),t[11]=-(n*(u*d-c*l)-a*(r*d-o*l)+f*(r*c-o*u)),t[12]=-(a*(l*v-h*m)-f*(u*v-s*m)+p*(u*h-s*l)),t[13]=n*(l*v-h*m)-f*(r*v-i*m)+p*(r*h-i*l),t[14]=-(n*(u*v-s*m)-a*(r*v-i*m)+p*(r*s-i*u)),t[15]=n*(u*h-s*l)-a*(r*h-i*l)+f*(r*s-i*u),t}function Z(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],u=t[6],s=t[7],c=t[8],f=t[9],l=t[10],h=t[11],d=t[12],p=t[13],m=t[14],v=t[15];return(e*a-n*o)*(l*v-h*m)-(e*u-r*o)*(f*v-h*p)+(e*s-i*o)*(f*m-l*p)+(n*u-r*a)*(c*v-h*d)-(n*s-i*a)*(c*m-l*d)+(r*s-i*u)*(c*p-f*d)}function J(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],h=e[9],d=e[10],p=e[11],m=e[12],v=e[13],g=e[14],y=e[15],b=n[0],_=n[1],E=n[2],w=n[3];return t[0]=b*r+_*u+E*l+w*m,t[1]=b*i+_*s+E*h+w*v,t[2]=b*o+_*c+E*d+w*g,t[3]=b*a+_*f+E*p+w*y,b=n[4],_=n[5],E=n[6],w=n[7],t[4]=b*r+_*u+E*l+w*m,t[5]=b*i+_*s+E*h+w*v,t[6]=b*o+_*c+E*d+w*g,t[7]=b*a+_*f+E*p+w*y,b=n[8],_=n[9],E=n[10],w=n[11],t[8]=b*r+_*u+E*l+w*m,t[9]=b*i+_*s+E*h+w*v,t[10]=b*o+_*c+E*d+w*g,t[11]=b*a+_*f+E*p+w*y,b=n[12],_=n[13],E=n[14],w=n[15],t[12]=b*r+_*u+E*l+w*m,t[13]=b*i+_*s+E*h+w*v,t[14]=b*o+_*c+E*d+w*g,t[15]=b*a+_*f+E*p+w*y,t}function tt(t,e,n){var r,i,o,a,u,s,c,f,l,h,d,p,m=n[0],v=n[1],g=n[2];return e===t?(t[12]=e[0]*m+e[4]*v+e[8]*g+e[12],t[13]=e[1]*m+e[5]*v+e[9]*g+e[13],t[14]=e[2]*m+e[6]*v+e[10]*g+e[14],t[15]=e[3]*m+e[7]*v+e[11]*g+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],c=e[6],f=e[7],l=e[8],h=e[9],d=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=s,t[6]=c,t[7]=f,t[8]=l,t[9]=h,t[10]=d,t[11]=p,t[12]=r*m+u*v+l*g+e[12],t[13]=i*m+s*v+h*g+e[13],t[14]=o*m+c*v+d*g+e[14],t[15]=a*m+f*v+p*g+e[15]),t}function et(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function nt(t,e,n,r){var i,o,a,u,c,f,l,h,d,p,m,v,g,y,b,_,E,w,x,T,A,S,R,O,C=r[0],M=r[1],I=r[2],N=Math.hypot(C,M,I);return N<s?null:(C*=N=1/N,M*=N,I*=N,i=Math.sin(n),a=1-(o=Math.cos(n)),u=e[0],c=e[1],f=e[2],l=e[3],h=e[4],d=e[5],p=e[6],m=e[7],v=e[8],g=e[9],y=e[10],b=e[11],_=C*C*a+o,E=M*C*a+I*i,w=I*C*a-M*i,x=C*M*a-I*i,T=M*M*a+o,A=I*M*a+C*i,S=C*I*a+M*i,R=M*I*a-C*i,O=I*I*a+o,t[0]=u*_+h*E+v*w,t[1]=c*_+d*E+g*w,t[2]=f*_+p*E+y*w,t[3]=l*_+m*E+b*w,t[4]=u*x+h*T+v*A,t[5]=c*x+d*T+g*A,t[6]=f*x+p*T+y*A,t[7]=l*x+m*T+b*A,t[8]=u*S+h*R+v*O,t[9]=c*S+d*R+g*O,t[10]=f*S+p*R+y*O,t[11]=l*S+m*R+b*O,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function rt(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],a=e[5],u=e[6],s=e[7],c=e[8],f=e[9],l=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*r,t[5]=a*i+f*r,t[6]=u*i+l*r,t[7]=s*i+h*r,t[8]=c*i-o*r,t[9]=f*i-a*r,t[10]=l*i-u*r,t[11]=h*i-s*r,t}function it(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],u=e[2],s=e[3],c=e[8],f=e[9],l=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-c*r,t[1]=a*i-f*r,t[2]=u*i-l*r,t[3]=s*i-h*r,t[8]=o*r+c*i,t[9]=a*r+f*i,t[10]=u*r+l*i,t[11]=s*r+h*i,t}function ot(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],u=e[2],s=e[3],c=e[4],f=e[5],l=e[6],h=e[7];return e!==t&&(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[0]=o*i+c*r,t[1]=a*i+f*r,t[2]=u*i+l*r,t[3]=s*i+h*r,t[4]=c*i-o*r,t[5]=f*i-a*r,t[6]=l*i-u*r,t[7]=h*i-s*r,t}function at(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function ut(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function st(t,e,n){var r,i,o,a=n[0],u=n[1],c=n[2],f=Math.hypot(a,u,c);return f<s?null:(a*=f=1/f,u*=f,c*=f,r=Math.sin(e),o=1-(i=Math.cos(e)),t[0]=a*a*o+i,t[1]=u*a*o+c*r,t[2]=c*a*o-u*r,t[3]=0,t[4]=a*u*o-c*r,t[5]=u*u*o+i,t[6]=c*u*o+a*r,t[7]=0,t[8]=a*c*o+u*r,t[9]=u*c*o-a*r,t[10]=c*c*o+i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function ct(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ft(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lt(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ht(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=r+r,s=i+i,c=o+o,f=r*u,l=r*s,h=r*c,d=i*s,p=i*c,m=o*c,v=a*u,g=a*s,y=a*c;return t[0]=1-(d+m),t[1]=l+y,t[2]=h-g,t[3]=0,t[4]=l-y,t[5]=1-(f+m),t[6]=p+v,t[7]=0,t[8]=h+g,t[9]=p-v,t[10]=1-(f+d),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function dt(t,e){var n=new c(3),r=-e[0],i=-e[1],o=-e[2],a=e[3],u=e[4],s=e[5],f=e[6],l=e[7],h=r*r+i*i+o*o+a*a;return h>0?(n[0]=2*(u*a+l*r+s*o-f*i)/h,n[1]=2*(s*a+l*i+f*r-u*o)/h,n[2]=2*(f*a+l*o+u*i-s*r)/h):(n[0]=2*(u*a+l*r+s*o-f*i),n[1]=2*(s*a+l*i+f*r-u*o),n[2]=2*(f*a+l*o+u*i-s*r)),ht(t,e,n),t}function pt(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function mt(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],u=e[6],s=e[8],c=e[9],f=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(o,a,u),t[2]=Math.hypot(s,c,f),t}function vt(t,e){var n=new c(3);mt(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,u=e[1]*i,s=e[2]*o,f=e[4]*r,l=e[5]*i,h=e[6]*o,d=e[8]*r,p=e[9]*i,m=e[10]*o,v=a+l+m,g=0;return v>0?(g=2*Math.sqrt(v+1),t[3]=.25*g,t[0]=(h-p)/g,t[1]=(d-s)/g,t[2]=(u-f)/g):a>l&&a>m?(g=2*Math.sqrt(1+a-l-m),t[3]=(h-p)/g,t[0]=.25*g,t[1]=(u+f)/g,t[2]=(d+s)/g):l>m?(g=2*Math.sqrt(1+l-a-m),t[3]=(d-s)/g,t[0]=(u+f)/g,t[1]=.25*g,t[2]=(h+p)/g):(g=2*Math.sqrt(1+m-a-l),t[3]=(u-f)/g,t[0]=(d+s)/g,t[1]=(h+p)/g,t[2]=.25*g),t}function gt(t,e,n,r){var i=e[0],o=e[1],a=e[2],u=e[3],s=i+i,c=o+o,f=a+a,l=i*s,h=i*c,d=i*f,p=o*c,m=o*f,v=a*f,g=u*s,y=u*c,b=u*f,_=r[0],E=r[1],w=r[2];return t[0]=(1-(p+v))*_,t[1]=(h+b)*_,t[2]=(d-y)*_,t[3]=0,t[4]=(h-b)*E,t[5]=(1-(l+v))*E,t[6]=(m+g)*E,t[7]=0,t[8]=(d+y)*w,t[9]=(m-g)*w,t[10]=(1-(l+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function yt(t,e,n,r,i){var o=e[0],a=e[1],u=e[2],s=e[3],c=o+o,f=a+a,l=u+u,h=o*c,d=o*f,p=o*l,m=a*f,v=a*l,g=u*l,y=s*c,b=s*f,_=s*l,E=r[0],w=r[1],x=r[2],T=i[0],A=i[1],S=i[2],R=(1-(m+g))*E,O=(d+_)*E,C=(p-b)*E,M=(d-_)*w,I=(1-(h+g))*w,N=(v+y)*w,P=(p+b)*x,k=(v-y)*x,D=(1-(h+m))*x;return t[0]=R,t[1]=O,t[2]=C,t[3]=0,t[4]=M,t[5]=I,t[6]=N,t[7]=0,t[8]=P,t[9]=k,t[10]=D,t[11]=0,t[12]=n[0]+T-(R*T+M*A+P*S),t[13]=n[1]+A-(O*T+I*A+k*S),t[14]=n[2]+S-(C*T+N*A+D*S),t[15]=1,t}function bt(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,u=r+r,s=i+i,c=n*a,f=r*a,l=r*u,h=i*a,d=i*u,p=i*s,m=o*a,v=o*u,g=o*s;return t[0]=1-l-p,t[1]=f+g,t[2]=h-v,t[3]=0,t[4]=f-g,t[5]=1-c-p,t[6]=d+m,t[7]=0,t[8]=h+v,t[9]=d-m,t[10]=1-c-l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function _t(t,e,n,r,i,o,a){var u=1/(n-e),s=1/(i-r),c=1/(o-a);return t[0]=2*o*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*s,t[6]=0,t[7]=0,t[8]=(n+e)*u,t[9]=(i+r)*s,t[10]=(a+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*c,t[15]=0,t}function Et(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t}var wt=Et;function xt(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=i*o,t[14]=i*r*o):(t[10]=-1,t[14]=-r),t}function Tt(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),u=Math.tan(e.rightDegrees*Math.PI/180),s=2/(a+u),c=2/(i+o);return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(a-u)*s*.5,t[9]=(i-o)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t}function At(t,e,n,r,i,o,a){var u=1/(e-n),s=1/(r-i),c=1/(o-a);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*u,t[13]=(i+r)*s,t[14]=(a+o)*c,t[15]=1,t}var St=At;function Rt(t,e,n,r,i,o,a){var u=1/(e-n),s=1/(r-i),c=1/(o-a);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(e+n)*u,t[13]=(i+r)*s,t[14]=o*c,t[15]=1,t}function Ot(t,e,n,r){var i,o,a,u,c,f,l,h,d,p,m=e[0],v=e[1],g=e[2],y=r[0],b=r[1],_=r[2],E=n[0],w=n[1],x=n[2];return Math.abs(m-E)<s&&Math.abs(v-w)<s&&Math.abs(g-x)<s?Y(t):(l=m-E,h=v-w,d=g-x,i=b*(d*=p=1/Math.hypot(l,h,d))-_*(h*=p),o=_*(l*=p)-y*d,a=y*h-b*l,(p=Math.hypot(i,o,a))?(i*=p=1/p,o*=p,a*=p):(i=0,o=0,a=0),u=h*a-d*o,c=d*i-l*a,f=l*o-h*i,(p=Math.hypot(u,c,f))?(u*=p=1/p,c*=p,f*=p):(u=0,c=0,f=0),t[0]=i,t[1]=u,t[2]=l,t[3]=0,t[4]=o,t[5]=c,t[6]=h,t[7]=0,t[8]=a,t[9]=f,t[10]=d,t[11]=0,t[12]=-(i*m+o*v+a*g),t[13]=-(u*m+c*v+f*g),t[14]=-(l*m+h*v+d*g),t[15]=1,t)}function Ct(t,e,n,r){var i=e[0],o=e[1],a=e[2],u=r[0],s=r[1],c=r[2],f=i-n[0],l=o-n[1],h=a-n[2],d=f*f+l*l+h*h;d>0&&(f*=d=1/Math.sqrt(d),l*=d,h*=d);var p=s*h-c*l,m=c*f-u*h,v=u*l-s*f;return(d=p*p+m*m+v*v)>0&&(p*=d=1/Math.sqrt(d),m*=d,v*=d),t[0]=p,t[1]=m,t[2]=v,t[3]=0,t[4]=l*v-h*m,t[5]=h*p-f*v,t[6]=f*m-l*p,t[7]=0,t[8]=f,t[9]=l,t[10]=h,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t}function Mt(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function It(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function Nt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t}function Pt(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function kt(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t}function Dt(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t}function Lt(t,e){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]}function jt(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],u=t[5],c=t[6],f=t[7],l=t[8],h=t[9],d=t[10],p=t[11],m=t[12],v=t[13],g=t[14],y=t[15],b=e[0],_=e[1],E=e[2],w=e[3],x=e[4],T=e[5],A=e[6],S=e[7],R=e[8],O=e[9],C=e[10],M=e[11],I=e[12],N=e[13],P=e[14],k=e[15];return Math.abs(n-b)<=s*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-_)<=s*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(i-E)<=s*Math.max(1,Math.abs(i),Math.abs(E))&&Math.abs(o-w)<=s*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-x)<=s*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(u-T)<=s*Math.max(1,Math.abs(u),Math.abs(T))&&Math.abs(c-A)<=s*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(f-S)<=s*Math.max(1,Math.abs(f),Math.abs(S))&&Math.abs(l-R)<=s*Math.max(1,Math.abs(l),Math.abs(R))&&Math.abs(h-O)<=s*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(d-C)<=s*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(p-M)<=s*Math.max(1,Math.abs(p),Math.abs(M))&&Math.abs(m-I)<=s*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(v-N)<=s*Math.max(1,Math.abs(v),Math.abs(N))&&Math.abs(g-P)<=s*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(y-k)<=s*Math.max(1,Math.abs(y),Math.abs(k))}var Ft=J,Bt=Pt;function Ut(){var t=new c(3);return c!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Gt(t){var e=new c(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Vt(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function zt(t,e,n){var r=new c(3);return r[0]=t,r[1]=e,r[2]=n,r}function Wt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ht(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function qt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function Xt(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Yt(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function Kt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function Qt(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function $t(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function Zt(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}function Jt(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}function te(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function ee(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function ne(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function re(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.hypot(n,r,i)}function ie(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function oe(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function ae(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function ue(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function se(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function ce(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function fe(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],u=n[1],s=n[2];return t[0]=i*s-o*u,t[1]=o*a-r*s,t[2]=r*u-i*a,t}function le(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t}function he(t,e,n,r,i,o){var a=o*o,u=a*(2*o-3)+1,s=a*(o-2)+o,c=a*(o-1),f=a*(3-2*o);return t[0]=e[0]*u+n[0]*s+r[0]*c+i[0]*f,t[1]=e[1]*u+n[1]*s+r[1]*c+i[1]*f,t[2]=e[2]*u+n[2]*s+r[2]*c+i[2]*f,t}function de(t,e,n,r,i,o){var a=1-o,u=a*a,s=o*o,c=u*a,f=3*o*u,l=3*s*a,h=s*o;return t[0]=e[0]*c+n[0]*f+r[0]*l+i[0]*h,t[1]=e[1]*c+n[1]*f+r[1]*l+i[1]*h,t[2]=e[2]*c+n[2]*f+r[2]*l+i[2]*h,t}function pe(t,e){e=e||1;var n=2*f()*Math.PI,r=2*f()-1,i=Math.sqrt(1-r*r)*e;return t[0]=Math.cos(n)*i,t[1]=Math.sin(n)*i,t[2]=r*e,t}function me(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/a,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}function ve(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t}function ge(t,e,n){var r=n[0],i=n[1],o=n[2],a=n[3],u=e[0],s=e[1],c=e[2],f=i*c-o*s,l=o*u-r*c,h=r*s-i*u,d=i*h-o*l,p=o*f-r*h,m=r*l-i*f,v=2*a;return f*=v,l*=v,h*=v,d*=2,p*=2,m*=2,t[0]=u+f+d,t[1]=s+l+p,t[2]=c+h+m,t}function ye(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0],o[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),o[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function be(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),o[1]=i[1],o[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function _e(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),o[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),o[2]=i[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t}function Ee(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],u=e[2],s=Math.sqrt(n*n+r*r+i*i)*Math.sqrt(o*o+a*a+u*u),c=s&&ce(t,e)/s;return Math.acos(Math.min(Math.max(c,-1),1))}function we(t){return t[0]=0,t[1]=0,t[2]=0,t}function xe(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function Te(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function Ae(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],u=e[2];return Math.abs(n-o)<=s*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=s*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-u)<=s*Math.max(1,Math.abs(i),Math.abs(u))}var Se,Re=Xt,Oe=Yt,Ce=Kt,Me=re,Ie=ie,Ne=Vt,Pe=oe,ke=(Se=Ut(),function(t,e,n,r,i,o){var a,u;for(e||(e=3),n||(n=0),u=r?Math.min(r*e+n,t.length):t.length,a=n;a<u;a+=e)Se[0]=t[a],Se[1]=t[a+1],Se[2]=t[a+2],i(Se,Se,o),t[a]=Se[0],t[a+1]=Se[1],t[a+2]=Se[2];return t});function De(){var t=new c(4);return c!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Le(t){var e=new c(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function je(t,e,n,r){var i=new c(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function Fe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Be(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function Ue(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function Ge(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function Ve(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function ze(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function We(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function He(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function qe(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t}function Xe(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function Ye(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function Ke(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function Qe(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t}function $e(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(n,r,i,o)}function Ze(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return n*n+r*r+i*i+o*o}function Je(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.hypot(e,n,r,i)}function tn(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}function en(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function nn(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function rn(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t}function on(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function an(t,e,n,r){var i=n[0]*r[1]-n[1]*r[0],o=n[0]*r[2]-n[2]*r[0],a=n[0]*r[3]-n[3]*r[0],u=n[1]*r[2]-n[2]*r[1],s=n[1]*r[3]-n[3]*r[1],c=n[2]*r[3]-n[3]*r[2],f=e[0],l=e[1],h=e[2],d=e[3];return t[0]=l*c-h*s+d*u,t[1]=-f*c+h*a-d*o,t[2]=f*s-l*a+d*i,t[3]=-f*u+l*o-h*i,t}function un(t,e,n,r){var i=e[0],o=e[1],a=e[2],u=e[3];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t[3]=u+r*(n[3]-u),t}function sn(t,e){var n,r,i,o,a,u;e=e||1;do{a=(n=2*f()-1)*n+(r=2*f()-1)*r}while(a>=1);do{u=(i=2*f()-1)*i+(o=2*f()-1)*o}while(u>=1);var s=Math.sqrt((1-a)/u);return t[0]=e*n,t[1]=e*r,t[2]=e*i*s,t[3]=e*o*s,t}function cn(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}function fn(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],u=n[1],s=n[2],c=n[3],f=c*r+u*o-s*i,l=c*i+s*r-a*o,h=c*o+a*i-u*r,d=-a*r-u*i-s*o;return t[0]=f*c+d*-a+l*-s-h*-u,t[1]=l*c+d*-u+h*-a-f*-s,t[2]=h*c+d*-s+f*-u-l*-a,t[3]=e[3],t}function ln(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function hn(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function dn(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function pn(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=e[0],u=e[1],c=e[2],f=e[3];return Math.abs(n-a)<=s*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-u)<=s*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(i-c)<=s*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-f)<=s*Math.max(1,Math.abs(o),Math.abs(f))}var mn=Ge,vn=Ve,gn=ze,yn=$e,bn=Ze,_n=Je,En=tn,wn=function(){var t=De();return function(e,n,r,i,o,a){var u,s;for(n||(n=4),r||(r=0),s=i?Math.min(i*n+r,e.length):e.length,u=r;u<s;u+=n)t[0]=e[u],t[1]=e[u+1],t[2]=e[u+2],t[3]=e[u+3],o(t,t,a),e[u]=t[0],e[u+1]=t[1],e[u+2]=t[2],e[u+3]=t[3];return e}}();function xn(){var t=new c(4);return c!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Tn(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function An(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function Sn(t,e){var n=2*Math.acos(e[3]),r=Math.sin(n/2);return r>s?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),n}function Rn(t,e){var n=nr(t,e);return Math.acos(2*n*n-1)}function On(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],u=n[0],s=n[1],c=n[2],f=n[3];return t[0]=r*f+a*u+i*c-o*s,t[1]=i*f+a*s+o*u-r*c,t[2]=o*f+a*c+r*s-i*u,t[3]=a*f-r*u-i*s-o*c,t}function Cn(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],u=Math.sin(n),s=Math.cos(n);return t[0]=r*s+a*u,t[1]=i*s+o*u,t[2]=o*s-i*u,t[3]=a*s-r*u,t}function Mn(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],u=Math.sin(n),s=Math.cos(n);return t[0]=r*s-o*u,t[1]=i*s+a*u,t[2]=o*s+r*u,t[3]=a*s-i*u,t}function In(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],a=e[3],u=Math.sin(n),s=Math.cos(n);return t[0]=r*s+i*u,t[1]=i*s-r*u,t[2]=o*s+a*u,t[3]=a*s-o*u,t}function Nn(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t}function Pn(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=Math.sqrt(n*n+r*r+i*i),u=Math.exp(o),s=a>0?u*Math.sin(a)/a:0;return t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=u*Math.cos(a),t}function kn(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=Math.sqrt(n*n+r*r+i*i),u=a>0?Math.atan2(a,o)/a:0;return t[0]=n*u,t[1]=r*u,t[2]=i*u,t[3]=.5*Math.log(n*n+r*r+i*i+o*o),t}function Dn(t,e,n){return kn(t,e),er(t,t,n),Pn(t,t),t}function Ln(t,e,n,r){var i,o,a,u,c,f=e[0],l=e[1],h=e[2],d=e[3],p=n[0],m=n[1],v=n[2],g=n[3];return(o=f*p+l*m+h*v+d*g)<0&&(o=-o,p=-p,m=-m,v=-v,g=-g),1-o>s?(i=Math.acos(o),a=Math.sin(i),u=Math.sin((1-r)*i)/a,c=Math.sin(r*i)/a):(u=1-r,c=r),t[0]=u*f+c*p,t[1]=u*l+c*m,t[2]=u*h+c*v,t[3]=u*d+c*g,t}function jn(t){var e=f(),n=f(),r=f(),i=Math.sqrt(1-e),o=Math.sqrt(e);return t[0]=i*Math.sin(2*Math.PI*n),t[1]=i*Math.cos(2*Math.PI*n),t[2]=o*Math.sin(2*Math.PI*r),t[3]=o*Math.cos(2*Math.PI*r),t}function Fn(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,u=a?1/a:0;return t[0]=-n*u,t[1]=-r*u,t[2]=-i*u,t[3]=o*u,t}function Bn(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function Un(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*o+a]-e[3*a+o])*n,t[o]=(e[3*o+i]+e[3*i+o])*n,t[a]=(e[3*a+i]+e[3*i+a])*n}return t}function Gn(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var o=Math.sin(e),a=Math.cos(e),u=Math.sin(n),s=Math.cos(n),c=Math.sin(r),f=Math.cos(r);return t[0]=o*s*f-a*u*c,t[1]=a*u*f+o*s*c,t[2]=a*s*c-o*u*f,t[3]=a*s*f+o*u*c,t}function Vn(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var zn,Wn,Hn,qn,Xn,Yn,Kn=Le,Qn=je,$n=Fe,Zn=Be,Jn=Ue,tr=On,er=Ke,nr=on,rr=un,ir=Je,or=ir,ar=tn,ur=ar,sr=rn,cr=dn,fr=pn,lr=(zn=Ut(),Wn=zt(1,0,0),Hn=zt(0,1,0),function(t,e,n){var r=ce(e,n);return r<-.999999?(fe(zn,Wn,e),Ne(zn)<1e-6&&fe(zn,Hn,e),se(zn,zn),An(t,zn,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(fe(zn,e,n),t[0]=zn[0],t[1]=zn[1],t[2]=zn[2],t[3]=1+r,sr(t,t))}),hr=(qn=xn(),Xn=xn(),function(t,e,n,r,i,o){return Ln(qn,e,i,o),Ln(Xn,n,r,o),Ln(t,qn,Xn,2*o*(1-o)),t}),dr=(Yn=l(),function(t,e,n,r){return Yn[0]=n[0],Yn[3]=n[1],Yn[6]=n[2],Yn[1]=r[0],Yn[4]=r[1],Yn[7]=r[2],Yn[2]=-e[0],Yn[5]=-e[1],Yn[8]=-e[2],sr(t,Un(t,Yn))})},function(t,e,n){"use strict";n.d(e,"AST_TOKEN_TYPES",(function(){return l})),n.d(e,"STORAGE_CLASS",(function(){return d})),n.d(e,"Target",(function(){return p})),n.d(e,"DefineValuePlaceholder",(function(){return v}));n(134),n(17),n(81),n(83),n(68),n(69),n(70),n(71),n(72),n(73),n(45),n(75),n(76),n(77),n(78);var r=n(67);n.d(e,"createEntity",(function(){return r.b}));var i=n(10);n.d(e,"IDENTIFIER",(function(){return i.a}));var o=n(55);n.d(e,"createWorldContainer",(function(){return o.a}));var a=n(143);n.d(e,"generateAABBFromVertices",(function(){return a.a}));var u=n(144);n.d(e,"isSafari",(function(){return u.a}));n(170);var s=n(171);n.d(e,"AABB",(function(){return s.a})),n.d(e,"Frustum",(function(){return s.b}));var c=n(66);n.o(c,"gl")&&n.d(e,"gl",(function(){return c.gl}));var f=n(156);n.o(f,"gl")&&n.d(e,"gl",(function(){return f.gl}));var l,h,d,p,m=n(157);n.o(m,"gl")&&n.d(e,"gl",(function(){return m.gl})),n.o(c,"gl")&&n.d(e,"gl",(function(){return c.gl})),function(t){t.Void="Void",t.Boolean="Boolean",t.Float="Float",t.Uint32="Uint32",t.Int32="Int32",t.Vector="Vector",t.Vector2Float="vec2<f32>",t.Vector3Float="vec3<f32>",t.Vector4Float="vec4<f32>",t.Vector2Boolean="vec2<bool>",t.Vector3Boolean="vec3<bool>",t.Vector4Boolean="vec4<bool>",t.Vector2Uint="vec2<u32>",t.Vector3Uint="vec3<u32>",t.Vector4Uint="vec4<u32>",t.Vector2Int="vec2<i32>",t.Vector3Int="vec3<i32>",t.Vector4Int="vec4<i32>",t.Matrix="Matrix",t.Matrix3x3Float="mat3x3<f32>",t.Matrix4x4Float="mat4x4<i32>",t.Struct="Struct",t.FloatArray="Float[]",t.Vector4FloatArray="vec4<f32>[]"}(l||(l={})),function(t){t.Program="Program",t.Identifier="Identifier",t.VariableDeclaration="VariableDeclaration",t.BlockStatement="BlockStatement",t.ReturnStatement="ReturnStatement",t.FunctionDeclaration="FunctionDeclaration",t.VariableDeclarator="VariableDeclarator",t.AssignmentExpression="AssignmentExpression",t.LogicalExpression="LogicalExpression",t.BinaryExpression="BinaryExpression",t.ArrayExpression="ArrayExpression",t.UnaryExpression="UnaryExpression",t.UpdateExpression="UpdateExpression",t.FunctionExpression="FunctionExpression",t.MemberExpression="MemberExpression",t.ConditionalExpression="ConditionalExpression",t.ExpressionStatement="ExpressionStatement",t.CallExpression="CallExpression",t.NumThreadStatement="NumThreadStatement",t.StorageStatement="StorageStatement",t.DoWhileStatement="DoWhileStatement",t.WhileStatement="WhileStatement",t.ForStatement="ForStatement",t.BreakStatement="BreakStatement",t.ContinueStatement="ContinueStatement",t.IfStatement="IfStatement",t.ImportedFunctionStatement="ImportedFunctionStatement"}(h||(h={})),function(t){t.Input="Input",t.Output="Output",t.Uniform="Uniform",t.Workgroup="Workgroup",t.UniformConstant="UniformConstant",t.Image="Image",t.StorageBuffer="StorageBuffer",t.Private="Private",t.Function="Function"}(d||(d={})),function(t){t.GLSL100="GLSL100",t.GLSL450="GLSL450",t.WGSL="WGSL"}(p||(p={}));var v="__DefineValuePlaceholder__"},function(t,e){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiBindToService=e.getServiceIdentifierAsString=e.typeConstraint=e.namedConstraint=e.taggedConstraint=e.traverseAncerstors=e.decorate=e.id=e.MetadataReader=e.postConstruct=e.targetName=e.multiInject=e.unmanaged=e.optional=e.LazyServiceIdentifer=e.inject=e.named=e.tagged=e.injectable=e.ContainerModule=e.AsyncContainerModule=e.TargetTypeEnum=e.BindingTypeEnum=e.BindingScopeEnum=e.Container=e.METADATA_KEY=void 0;var r=n(20);e.METADATA_KEY=r;var i=n(247);Object.defineProperty(e,"Container",{enumerable:!0,get:function(){return i.Container}});var o=n(35);Object.defineProperty(e,"BindingScopeEnum",{enumerable:!0,get:function(){return o.BindingScopeEnum}}),Object.defineProperty(e,"BindingTypeEnum",{enumerable:!0,get:function(){return o.BindingTypeEnum}}),Object.defineProperty(e,"TargetTypeEnum",{enumerable:!0,get:function(){return o.TargetTypeEnum}});var a=n(263);Object.defineProperty(e,"AsyncContainerModule",{enumerable:!0,get:function(){return a.AsyncContainerModule}}),Object.defineProperty(e,"ContainerModule",{enumerable:!0,get:function(){return a.ContainerModule}});var u=n(264);Object.defineProperty(e,"injectable",{enumerable:!0,get:function(){return u.injectable}});var s=n(265);Object.defineProperty(e,"tagged",{enumerable:!0,get:function(){return s.tagged}});var c=n(266);Object.defineProperty(e,"named",{enumerable:!0,get:function(){return c.named}});var f=n(139);Object.defineProperty(e,"inject",{enumerable:!0,get:function(){return f.inject}}),Object.defineProperty(e,"LazyServiceIdentifer",{enumerable:!0,get:function(){return f.LazyServiceIdentifer}});var l=n(267);Object.defineProperty(e,"optional",{enumerable:!0,get:function(){return l.optional}});var h=n(268);Object.defineProperty(e,"unmanaged",{enumerable:!0,get:function(){return h.unmanaged}});var d=n(269);Object.defineProperty(e,"multiInject",{enumerable:!0,get:function(){return d.multiInject}});var p=n(270);Object.defineProperty(e,"targetName",{enumerable:!0,get:function(){return p.targetName}});var m=n(271);Object.defineProperty(e,"postConstruct",{enumerable:!0,get:function(){return m.postConstruct}});var v=n(137);Object.defineProperty(e,"MetadataReader",{enumerable:!0,get:function(){return v.MetadataReader}});var g=n(44);Object.defineProperty(e,"id",{enumerable:!0,get:function(){return g.id}});var y=n(39);Object.defineProperty(e,"decorate",{enumerable:!0,get:function(){return y.decorate}});var b=n(142);Object.defineProperty(e,"traverseAncerstors",{enumerable:!0,get:function(){return b.traverseAncerstors}}),Object.defineProperty(e,"taggedConstraint",{enumerable:!0,get:function(){return b.taggedConstraint}}),Object.defineProperty(e,"namedConstraint",{enumerable:!0,get:function(){return b.namedConstraint}}),Object.defineProperty(e,"typeConstraint",{enumerable:!0,get:function(){return b.typeConstraint}});var _=n(54);Object.defineProperty(e,"getServiceIdentifierAsString",{enumerable:!0,get:function(){return _.getServiceIdentifierAsString}});var E=n(272);Object.defineProperty(e,"multiBindToService",{enumerable:!0,get:function(){return E.multiBindToService}})},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.TextureCompressionBC="texture-compression-bc"}(e.ExtensionName||(e.ExtensionName={})),function(t){t.ClampToEdge="clamp-to-edge",t.Repeat="repeat",t.MirrorRepeat="mirror-repeat"}(e.AddressMode||(e.AddressMode={})),function(t){t.UniformBuffer="uniform-buffer",t.StorageBuffer="storage-buffer",t.ReadonlyStorageBuffer="readonly-storage-buffer",t.Sampler="sampler",t.ComparisonSampler="comparison-sampler",t.SampledTexture="sampled-texture",t.ReadonlyStorageTexture="readonly-storage-texture",t.WriteonlyStorageTexture="writeonly-storage-texture"}(e.BindingType||(e.BindingType={})),function(t){t.Zero="zero",t.One="one",t.SrcColor="src-color",t.OneMinusSrcColor="one-minus-src-color",t.SrcAlpha="src-alpha",t.OneMinusSrcAlpha="one-minus-src-alpha",t.DstColor="dst-color",t.OneMinusDstColor="one-minus-dst-color",t.DstAlpha="dst-alpha",t.OneMinusDstAlpha="one-minus-dst-alpha",t.SrcAlphaSaturated="src-alpha-saturated",t.BlendColor="blend-color",t.OneMinusBlendColor="one-minus-blend-color"}(e.BlendFactor||(e.BlendFactor={})),function(t){t.Add="add",t.Subtract="subtract",t.ReverseSubtract="reverse-subtract",t.Min="min",t.Max="max"}(e.BlendOperation||(e.BlendOperation={})),function(t){t.Never="never",t.Less="less",t.Equal="equal",t.LessEqual="less-equal",t.Greater="greater",t.NotEqual="not-equal",t.GreaterEqual="greater-equal",t.Always="always"}(e.CompareFunction||(e.CompareFunction={})),function(t){t.None="none",t.Front="front",t.Back="back"}(e.CullMode||(e.CullMode={})),function(t){t.Nearest="nearest",t.Linear="linear"}(e.FilterMode||(e.FilterMode={})),function(t){t.CCW="ccw",t.CW="cw"}(e.FrontFace||(e.FrontFace={})),function(t){t.Uint16="uint16",t.Uint32="uint32"}(e.IndexFormat||(e.IndexFormat={})),function(t){t.Vertex="vertex",t.Instance="instance"}(e.InputStepMode||(e.InputStepMode={})),function(t){t.Load="load"}(e.LoadOp||(e.LoadOp={})),function(t){t.PointList="point-list",t.LineList="line-list",t.LineStrip="line-strip",t.TriangleList="triangle-list",t.TriangleStrip="triangle-strip"}(e.PrimitiveTopology||(e.PrimitiveTopology={})),function(t){t.Keep="keep",t.Zero="zero",t.Replace="replace",t.Invert="invert",t.IncrementClamp="increment-clamp",t.DecrementClamp="decrement-clamp",t.IncrementWrap="increment-wrap",t.DecrementWrap="decrement-wrap"}(e.StencilOperation||(e.StencilOperation={})),function(t){t.Store="store",t.Clear="clear"}(e.StoreOp||(e.StoreOp={})),function(t){t.E1d="1d",t.E2d="2d",t.E3d="3d"}(e.TextureDimension||(e.TextureDimension={})),function(t){t.R8Unorm="r8unorm",t.R8Snorm="r8snorm",t.R8Uint="r8uint",t.R8Sint="r8sint",t.R16Uint="r16uint",t.R16Sint="r16sint",t.R16Float="r16float",t.RG8Unorm="rg8unorm",t.RG8Snorm="rg8snorm",t.RG8Uint="rg8uint",t.RG8Sint="rg8sint",t.R32Uint="r32uint",t.R32Sint="r32sint",t.R32Float="r32float",t.RG16Uint="rg16uint",t.RG16Sint="rg16sint",t.RG16Float="rg16float",t.RGBA8Unorm="rgba8unorm",t.RGBA8UnormSRGB="rgba8unorm-srgb",t.RGBA8Snorm="rgba8snorm",t.RGBA8Uint="rgba8uint",t.RGBA8Sint="rgba8sint",t.BGRA8Unorm="bgra8unorm",t.BGRA8UnormSRGB="bgra8unorm-srgb",t.RGB10A2Unorm="rgb10a2unorm",t.RG11B10Float="rg11b10float",t.RG32Uint="rg32uint",t.RG32Sint="rg32sint",t.RG32Float="rg32float",t.RGBA16Uint="rgba16uint",t.RGBA16Sint="rgba16sint",t.RGBA16Float="rgba16float",t.RGBA32Uint="rgba32uint",t.RGBA32Sint="rgba32sint",t.RGBA32Float="rgba32float",t.Depth32Float="depth32float",t.Depth24Plus="depth24plus",t.Depth24PlusStencil8="depth24plus-stencil8"}(e.TextureFormat||(e.TextureFormat={})),function(t){t.Float="float",t.Sint="sint",t.Uint="uint"}(e.TextureComponentType||(e.TextureComponentType={})),function(t){t.E1d="1d",t.E2d="2d",t.E2dArray="2d-array",t.Cube="cube",t.CubeArray="cube-array",t.E3d="3d"}(e.TextureViewDimension||(e.TextureViewDimension={})),function(t){t.Uchar2="uchar2",t.Uchar4="uchar4",t.Char2="char2",t.Char4="char4",t.Uchar2Norm="uchar2norm",t.Uchar4Norm="uchar4norm",t.Char2Norm="char2norm",t.Char4Norm="char4norm",t.Ushort2="ushort2",t.Ushort4="ushort4",t.Short2="short2",t.Short4="short4",t.Ushort2Norm="ushort2norm",t.Ushort4Norm="ushort4norm",t.Short2Norm="short2norm",t.Short4Norm="short4norm",t.Half2="half2",t.Half4="half4",t.Float="float",t.Float2="float2",t.Float3="float3",t.Float4="float4",t.Uint="uint",t.Uint2="uint2",t.Uint3="uint3",t.Uint4="uint4",t.Int="int",t.Int2="int2",t.Int3="int3",t.Int4="int4"}(e.VertexFormat||(e.VertexFormat={})),function(t){t.All="all",t.StencilOnly="stencil-only",t.DepthOnly="depth-only"}(e.TextureAspect||(e.TextureAspect={})),function(t){t.Error="error",t.Warning="warning",t.Info="info"}(e.CompilationMessageType||(e.CompilationMessageType={})),function(t){t.Occlusion="occlusion"}(e.QueryType||(e.QueryType={})),function(t){t[t.MapRead=1]="MapRead",t[t.MapWrite=2]="MapWrite",t[t.CopySrc=4]="CopySrc",t[t.CopyDst=8]="CopyDst",t[t.Index=16]="Index",t[t.Vertex=32]="Vertex",t[t.Uniform=64]="Uniform",t[t.Storage=128]="Storage",t[t.Indirect=256]="Indirect",t[t.QueryResolve=512]="QueryResolve"}(e.BufferUsage||(e.BufferUsage={})),function(t){t[t.Red=1]="Red",t[t.Green=2]="Green",t[t.Blue=4]="Blue",t[t.Alpha=8]="Alpha",t[t.All=15]="All"}(e.ColorWrite||(e.ColorWrite={})),function(t){t[t.Vertex=1]="Vertex",t[t.Fragment=2]="Fragment",t[t.Compute=4]="Compute"}(e.ShaderStage||(e.ShaderStage={})),function(t){t[t.CopySrc=1]="CopySrc",t[t.CopyDst=2]="CopyDst",t[t.Sampled=4]="Sampled",t[t.Storage=8]="Storage",t[t.OutputAttachment=16]="OutputAttachment"}(e.TextureUsage||(e.TextureUsage={})),function(t){t[t.Read=1]="Read",t[t.Write=2]="Write"}(e.MapMode||(e.MapMode={}))},function(t,e,n){t.exports=n(243)},function(t,e){t.exports=function(t,e,n,r){n&&Object.defineProperty(t,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(r):void 0})},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e,n,r,i){var o={};return Object.keys(r).forEach((function(t){o[t]=r[t]})),o.enumerable=!!o.enumerable,o.configurable=!!o.configurable,("value"in o||o.initializer)&&(o.writable=!0),o=n.slice().reverse().reduce((function(n,r){return r(t,e,n)||n}),o),i&&void 0!==o.initializer&&(o.value=o.initializer?o.initializer.call(i):void 0,o.initializer=void 0),void 0===o.initializer&&(Object.defineProperty(t,e,o),o=null),o},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r={HierarchyComponentManager:Symbol("HierarchyComponentManager"),TransformComponentManager:Symbol("TransformComponentManager"),NameComponentManager:Symbol("NameComponentManager"),SceneGraphSystem:Symbol("SceneGraphSystem"),FrameGraphSystem:Symbol("FrameGraphSystem"),ResourcePool:Symbol("ResourcePool"),ResourceHandleComponentManager:Symbol("ResourceHandleComponentManager"),PassNodeComponentManager:Symbol("PassNodeComponentManager"),RendererSystem:Symbol("RendererSystem"),RenderPass:Symbol("RenderPass"),RenderPassFactory:Symbol("Factory<IRenderPass>"),Renderable:Symbol("Factory<IRenderPass>"),MeshSystem:Symbol("MeshSystem"),MeshComponentManager:Symbol("MeshComponentManager"),CullableComponentManager:Symbol("CullableComponentManager"),Geometry:Symbol("Geometry"),GeometrySystem:Symbol("GeometrySystem"),GeometryComponentManager:Symbol("GeometryComponentManager"),Material:Symbol("Material"),MaterialSystem:Symbol("MaterialSystem"),MaterialComponentManager:Symbol("MaterialComponentManager"),ForwardRenderPath:Symbol("ForwardRenderPath"),ComputeSystem:Symbol("ComputeSystem"),ComputeComponentManager:Symbol("ComputeComponentManager"),ComputeStrategy:Symbol("ComputeStrategy"),Systems:Symbol("Systems"),World:Symbol("World"),RenderEngine:Symbol("RenderEngine"),WebGPUEngine:Symbol("WebGPUEngine"),WebGLEngine:Symbol("WebGLEngine"),ShaderModuleService:Symbol("ShaderModuleService"),ConfigService:Symbol("ConfigService"),InteractorService:Symbol("InteractorService"),IEventEmitter:Symbol("IEventEmitter"),Light:Symbol("Light")}},function(t,e){function n(t,e,n,r,i,o,a){try{var u=t[o](a),s=u.value}catch(t){return void n(t)}u.done?e(s):Promise.resolve(s).then(r,i)}t.exports=function(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var a=t.apply(e,r);function u(t){n(a,i,o,u,s,"next",t)}function s(t){n(a,i,o,u,s,"throw",t)}u(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.default=t.exports,t.exports.__esModule=!0,n(e)}t.exports=n,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){(function(e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")()}).call(this,n(85))},function(t,e,n){var r=n(273);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(26).default,i=n(13);t.exports=function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return i(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";n.d(e,"a",(function(){return h})),n.d(e,"b",(function(){return d}));var r=n(7),i=n.n(r),o=n(11),a=n.n(o),u=n(5),s=n.n(u),c=n(4),f=n.n(c),l=n(67),h=function t(e){f()(this,t)},d=function(){function t(e){f()(this,t),this.clazz=void 0,this.components=[],this.entities=[],this.lookup={},this.clazz=e}var e;return s()(t,[{key:"clear",value:function(){this.components=[],this.entities=[],this.lookup={}}},{key:"contains",value:function(t){return this.lookup[t]>-1}},{key:"create",value:function(t,e){this.lookup[t]=this.components.length;var n=new this.clazz(e||{});return this.components.push(n),this.entities.push(t),n}},{key:"remove",value:function(t){var e=this.lookup[t];e>-1&&e<this.components.length-1&&(this.components[e]=this.components[this.components.length-1],this.entities[e]=this.entities[this.entities.length-1],this.lookup[this.entities[e]]=e),this.components.pop(),this.entities.pop(),delete this.lookup[t]}},{key:"removeKeepSorted",value:function(t){var e=this.lookup[t];if(e>-1){var n=this.entities[e];if(e<this.components.length-1){for(var r=e+1;r<this.components.length;++r)this.components[r-1]=this.components[r];for(var i=e+1;i<this.entities.length;++i)this.entities[i-1]=this.entities[i],this.lookup[this.entities[i-1]]=i-1}this.components.pop(),this.entities.pop(),delete this.lookup[n]}}},{key:"moveItem",value:function(t,e){if(t!==e){for(var n=this.components[t],r=this.entities[t],i=t<e?1:-1,o=t;o!==e;o+=i){var a=o+i;this.components[o]=this.components[a],this.entities[o]=this.entities[a],this.lookup[this.entities[o]]=o}this.components[e]=n,this.entities[e]=r,this.lookup[r]=e}}},{key:"getEntity",value:function(t){return this.entities[t]}},{key:"getComponent",value:function(t){return this.components[t]}},{key:"getComponentByEntity",value:function(t){var e=this.lookup[t];return e>-1?this.components[e]:null}},{key:"getCount",value:function(){return this.components.length}},{key:"getEntityByComponentIndex",value:function(t){for(var e=0,n=Object.keys(this.lookup);e<n.length;e++){var r=n[e],i=Number(r);if(this.lookup[i]===t)return i}return l.a}},{key:"find",value:function(t){for(var e=0;e<this.getCount();e++){var n=this.getComponent(e);if(t(n,e))return n}return null}},{key:"findIndex",value:function(t){for(var e=0;e<this.getCount();e++){if(t(this.getComponent(e),e))return e}return-1}},{key:"forEach",value:function(t){for(var e=0,n=Object.keys(this.lookup);e<n.length;e++){var r=n[e],i=Number(r),o=this.lookup[i];t(i,this.getComponent(o))}}},{key:"forEachAsync",value:(e=a()(i.a.mark((function t(e){var n,r,o,a,u;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,r=Object.keys(this.lookup);case 1:if(!(n<r.length)){t.next=10;break}return o=r[n],a=Number(o),u=this.lookup[a],t.next=7,e(a,this.getComponent(u));case 7:n++,t.next=1;break;case 10:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"map",value:function(t){for(var e=[],n=0,r=Object.keys(this.lookup);n<r.length;n++){var i=r[n],o=Number(i),a=this.lookup[o];e.push(t(o,this.getComponent(a)))}return e}}]),t}()},function(t,e,n){var r=n(275),i=n(276),o=n(135),a=n(277);t.exports=function(t){return r(t)||i(t)||o(t)||a()},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e){throw new Error("Decorating class property failed. Please ensure that proposal-class-properties is enabled and runs after the decorators transform.")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NON_CUSTOM_TAG_KEYS=e.POST_CONSTRUCT=e.DESIGN_PARAM_TYPES=e.PARAM_TYPES=e.TAGGED_PROP=e.TAGGED=e.MULTI_INJECT_TAG=e.INJECT_TAG=e.OPTIONAL_TAG=e.UNMANAGED_TAG=e.NAME_TAG=e.NAMED_TAG=void 0,e.NAMED_TAG="named",e.NAME_TAG="name",e.UNMANAGED_TAG="unmanaged",e.OPTIONAL_TAG="optional",e.INJECT_TAG="inject",e.MULTI_INJECT_TAG="multi_inject",e.TAGGED="inversify:tagged",e.TAGGED_PROP="inversify:tagged_props",e.PARAM_TYPES="inversify:paramtypes",e.DESIGN_PARAM_TYPES="design:paramtypes",e.POST_CONSTRUCT="post_construct",e.NON_CUSTOM_TAG_KEYS=[e.INJECT_TAG,e.MULTI_INJECT_TAG,e.NAME_TAG,e.UNMANAGED_TAG,e.NAMED_TAG,e.OPTIONAL_TAG]},function(t,e){var n=Function.prototype,r=n.bind,i=n.call,o=r&&r.bind(i);t.exports=r?function(t){return t&&o(i,t)}:function(t){return t&&function(){return i.apply(t,arguments)}}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){"use strict";var r;n.d(e,"a",(function(){return r})),function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.MAX_EXT=32776]="MAX_EXT",t[t.MIN_EXT=32775]="MIN_EXT",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.CULL_FACE=2884]="CULL_FACE",t[t.BLEND=3042]="BLEND",t[t.DITHER=3024]="DITHER",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.TEXTURE1=33985]="TEXTURE1",t[t.TEXTURE2=33986]="TEXTURE2",t[t.TEXTURE3=33987]="TEXTURE3",t[t.TEXTURE4=33988]="TEXTURE4",t[t.TEXTURE5=33989]="TEXTURE5",t[t.TEXTURE6=33990]="TEXTURE6",t[t.TEXTURE7=33991]="TEXTURE7",t[t.TEXTURE8=33992]="TEXTURE8",t[t.TEXTURE9=33993]="TEXTURE9",t[t.TEXTURE10=33994]="TEXTURE10",t[t.TEXTURE11=33995]="TEXTURE11",t[t.TEXTURE12=33996]="TEXTURE12",t[t.TEXTURE13=33997]="TEXTURE13",t[t.TEXTURE14=33998]="TEXTURE14",t[t.TEXTURE15=33999]="TEXTURE15",t[t.TEXTURE16=34e3]="TEXTURE16",t[t.TEXTURE17=34001]="TEXTURE17",t[t.TEXTURE18=34002]="TEXTURE18",t[t.TEXTURE19=34003]="TEXTURE19",t[t.TEXTURE20=34004]="TEXTURE20",t[t.TEXTURE21=34005]="TEXTURE21",t[t.TEXTURE22=34006]="TEXTURE22",t[t.TEXTURE23=34007]="TEXTURE23",t[t.TEXTURE24=34008]="TEXTURE24",t[t.TEXTURE25=34009]="TEXTURE25",t[t.TEXTURE26=34010]="TEXTURE26",t[t.TEXTURE27=34011]="TEXTURE27",t[t.TEXTURE28=34012]="TEXTURE28",t[t.TEXTURE29=34013]="TEXTURE29",t[t.TEXTURE30=34014]="TEXTURE30",t[t.TEXTURE31=34015]="TEXTURE31",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.COPY_SRC=1]="COPY_SRC",t[t.COPY_DST=2]="COPY_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"}(r||(r={}))},function(t,e){t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.STACK_OVERFLOW=e.CIRCULAR_DEPENDENCY_IN_FACTORY=e.POST_CONSTRUCT_ERROR=e.MULTIPLE_POST_CONSTRUCT_METHODS=e.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK=e.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE=e.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE=e.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT=e.ARGUMENTS_LENGTH_MISMATCH=e.INVALID_DECORATOR_OPERATION=e.INVALID_TO_SELF_VALUE=e.INVALID_FUNCTION_BINDING=e.INVALID_MIDDLEWARE_RETURN=e.NO_MORE_SNAPSHOTS_AVAILABLE=e.INVALID_BINDING_TYPE=e.NOT_IMPLEMENTED=e.CIRCULAR_DEPENDENCY=e.UNDEFINED_INJECT_ANNOTATION=e.MISSING_INJECT_ANNOTATION=e.MISSING_INJECTABLE_ANNOTATION=e.NOT_REGISTERED=e.CANNOT_UNBIND=e.AMBIGUOUS_MATCH=e.KEY_NOT_FOUND=e.NULL_ARGUMENT=e.DUPLICATED_METADATA=e.DUPLICATED_INJECTABLE_DECORATOR=void 0,e.DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.",e.DUPLICATED_METADATA="Metadata key was used more than once in a parameter:",e.NULL_ARGUMENT="NULL argument",e.KEY_NOT_FOUND="Key Not Found",e.AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:",e.CANNOT_UNBIND="Could not unbind serviceIdentifier:",e.NOT_REGISTERED="No matching bindings found for serviceIdentifier:",e.MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:",e.MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:";e.UNDEFINED_INJECT_ANNOTATION=function(t){return"@inject called with undefined this could mean that the class "+t+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."},e.CIRCULAR_DEPENDENCY="Circular dependency found:",e.NOT_IMPLEMENTED="Sorry, this feature is not fully implemented yet.",e.INVALID_BINDING_TYPE="Invalid binding type:",e.NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.",e.INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!",e.INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!",e.INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier",e.INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.";e.ARGUMENTS_LENGTH_MISMATCH=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."},e.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.",e.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",e.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean",e.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean",e.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class";e.POST_CONSTRUCT_ERROR=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"@postConstruct error in class "+t[0]+": "+t[1]};e.CIRCULAR_DEPENDENCY_IN_FACTORY=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"It looks like there is a circular dependency in one of the '"+t[0]+"' bindings. Please investigate bindings withservice identifier '"+t[1]+"'."},e.STACK_OVERFLOW="Maximum call stack size exceeded"},function(t,e){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=n=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),n(e)}t.exports=n,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(14),i=n(49).f,o=n(52),a=n(61),u=n(89),s=n(187),c=n(189);t.exports=function(t,e){var n,f,l,h,d,p=t.target,m=t.global,v=t.stat;if(n=m?r:v?r[p]||u(p,{}):(r[p]||{}).prototype)for(f in e){if(h=e[f],l=t.noTargetGet?(d=i(n,f))&&d.value:n[f],!c(m?f:p+(v?".":"#")+f,t.forced)&&void 0!==l){if(typeof h==typeof l)continue;s(h,l)}(t.sham||l&&l.sham)&&o(h,"sham",!0),a(n,f,h,t)}}},function(t,e,n){var r;try{r=n(229)}catch(t){}r||(r=window._),t.exports=r},function(t,e,n){var r=n(22);t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var r=n(20),i=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===r.NAMED_TAG?"named: "+this.value.toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+this.value+" }"},t}();e.Metadata=i},function(t,e,n){var r=n(14),i=n(60),o=n(32),a=n(90),u=n(87),s=n(114),c=i("wks"),f=r.Symbol,l=f&&f.for,h=s?f:f&&f.withoutSetter||a;t.exports=function(t){if(!o(c,t)||!u&&"string"!=typeof c[t]){var e="Symbol."+t;u&&o(f,t)?c[t]=f[t]:c[t]=s&&l?l(e):h(e)}return c[t]}},function(t,e,n){var r=n(21),i=n(51),o=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(i(t),e)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return H}));var r,i,o,a,u,s,c,f,l,h,d,p,m,v,g,y,b,_,E,w,x,T,A,S,R=n(7),O=n.n(R),C=n(11),M=n.n(C),I=n(8),N=n.n(I),P=n(4),k=n.n(P),D=n(5),L=n.n(D),j=n(9),F=n.n(j),B=(n(19),n(0)),U=n(3),G=n(10),V=n(23);function z(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return W(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return W(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function W(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var H=(r=Object(U.injectable)(),i=Object(U.inject)(G.a.MeshComponentManager),o=Object(U.inject)(G.a.GeometryComponentManager),a=Object(U.inject)(G.a.MaterialComponentManager),u=Object(U.inject)(G.a.CullableComponentManager),s=Object(U.inject)(G.a.TransformComponentManager),c=Object(U.inject)(G.a.HierarchyComponentManager),f=Object(U.inject)(G.a.Systems),l=Object(U.named)(G.a.FrameGraphSystem),h=Object(U.inject)(G.a.RenderEngine),d=Object(U.inject)(G.a.ResourcePool),r((S=A=function(){function t(){var e=this;k()(this,t),N()(this,"mesh",v,this),N()(this,"geometry",g,this),N()(this,"material",y,this),N()(this,"cullable",b,this),N()(this,"transform",_,this),N()(this,"hierarchy",E,this),N()(this,"frameGraphSystem",w,this),N()(this,"engine",x,this),N()(this,"resourcePool",T,this),this.modelCache={},this.setup=function(t,e,n){var r=t.createRenderTarget(e,"color buffer",{width:1,height:1,usage:V.a.RENDER_ATTACHMENT|V.a.SAMPLED|V.a.COPY_SRC});n.data={output:e.write(t,r)}},this.execute=function(){var t=M()(O.a.mark((function t(n,r,i){var o,a,u,s,c,f;return O.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=n.getResourceNode(r.data.output),a=e.resourcePool.getOrCreateResource(o.resource),u=z(i),t.prev=3,u.s();case 5:if((s=u.n()).done){t.next=11;break}return c=s.value,t.next=9,e.initView(c);case 9:t.next=5;break;case 11:t.next=16;break;case 13:t.prev=13,t.t0=t.catch(3),u.e(t.t0);case 16:return t.prev=16,u.f(),t.finish(16);case 19:f=e.engine.getCanvas(),a.resize({width:f.width,height:f.height}),e.engine.setScissor({enable:!1}),e.engine.clear({framebuffer:a,color:i[0].getClearColor(),depth:1}),e.engine.useFramebuffer(a,(function(){var t,n=z(i);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.renderView(r)}}catch(t){n.e(t)}finally{n.f()}}));case 24:case"end":return t.stop()}}),t,null,[[3,13,16,19]])})));return function(e,n,r){return t.apply(this,arguments)}}()}var e,n;return L()(t,[{key:"renderView",value:function(t){var e=t.getScene(),n=t.getCamera(),r=n.getViewTransform(),i=B.b.multiply(B.b.create(),n.getPerspective(),r);n.getFrustum().extractFromVPMatrix(i);var o=t.getViewport(),a=o.x,u=o.y,s=o.width,c=o.height;this.engine.viewport({x:a,y:u,width:s,height:c});var f,l=z(e.getEntities());try{for(l.s();!(f=l.n()).done;){var h=f.value;this.renderMesh(h,{camera:n,view:t,viewMatrix:r})}}catch(t){l.e(t)}finally{l.f()}}},{key:"renderMesh",value:function(t,e){var n=e.camera,r=e.view,i=e.viewMatrix,o=this.mesh.getComponentByEntity(t);if(o&&o.visible){var a=o.material,u=o.geometry;if(u&&!u.dirty&&a){var s=this.transform.getComponentByEntity(t),c=B.b.multiply(B.b.create(),i,s.worldTransform),f=r.getViewport(),l=f.width,h=f.height;a.setUniform({projectionMatrix:n.getPerspective(),modelViewMatrix:c,modelMatrix:s.worldTransform,viewMatrix:i,cameraPosition:n.getPosition(),u_viewport:[l,h]}),o.model&&(o.model.draw({uniforms:a.uniforms.reduce((function(t,e){return t[e.name]=e.data,t}),{})}),a.uniforms.forEach((function(t){t.dirty=!1})),a.dirty=!1)}}}},{key:"initMesh",value:(n=M()(O.a.mark((function t(e,n){var r,i,o,a,u,s,c,f;return O.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.mesh.getComponentByEntity(e)){t.next=3;break}return t.abrupt("return");case 3:if(i=r.material,(o=r.geometry)&&!o.dirty&&i){t.next=7;break}return t.abrupt("return");case 7:if(r.model){t.next=24;break}if(a="m-".concat(i.entity,"-g-").concat(o.entity),!this.modelCache[a]){t.next=12;break}return r.model=this.modelCache[a],t.abrupt("return");case 12:return i.setUniform({projectionMatrix:1,modelViewMatrix:1,modelMatrix:1,viewMatrix:1,cameraPosition:1,u_viewport:1}),u=this.engine,s=u.createModel,c=u.createAttribute,f={vs:i.vertexShaderGLSL,fs:i.fragmentShaderGLSL,defines:i.defines,attributes:o.attributes.reduce((function(t,e){return e.data&&e.buffer&&(t[e.name]=c({buffer:e.buffer,attributes:e.attributes,arrayStride:e.arrayStride,stepMode:e.stepMode,divisor:"vertex"===e.stepMode?0:1})),t}),{}),uniforms:i.uniforms.reduce((function(t,e){return t[e.name]=e.data,t}),{}),scissor:{enable:!0,box:function(){return n.getViewport()}}},i.cull&&(f.cull=i.cull),i.depth&&(f.depth=i.depth),i.blend&&(f.blend=i.blend),o.indicesBuffer&&(f.elements=o.indicesBuffer),o.maxInstancedCount&&(f.instances=o.maxInstancedCount,f.count=o.vertexCount||3),t.next=22,s(f);case 22:r.model=t.sent,this.modelCache[a]=r.model;case 24:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"initView",value:(e=M()(O.a.mark((function t(e){var n,r,i,o;return O.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.getScene(),r=z(n.getEntities()),t.prev=2,r.s();case 4:if((i=r.n()).done){t.next=10;break}return o=i.value,t.next=8,this.initMesh(o,e);case 8:t.next=4;break;case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(2),r.e(t.t0);case 15:return t.prev=15,r.f(),t.finish(15);case 18:case"end":return t.stop()}}),t,this,[[2,12,15,18]])}))),function(t){return e.apply(this,arguments)})}]),t}(),A.IDENTIFIER="Render Pass",m=S,v=F()(m.prototype,"mesh",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),g=F()(m.prototype,"geometry",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),y=F()(m.prototype,"material",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),b=F()(m.prototype,"cullable",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_=F()(m.prototype,"transform",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),E=F()(m.prototype,"hierarchy",[c],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),w=F()(m.prototype,"frameGraphSystem",[f,l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),x=F()(m.prototype,"engine",[h],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),T=F()(m.prototype,"resourcePool",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),p=m))||p)},function(t,e,n){var r=n(14),i=n(29),o=n(119),a=n(38),u=n(59),s=r.TypeError,c=Object.defineProperty;e.f=i?c:function(t,e,n){if(a(t),e=u(e),a(n),o)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw s("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TargetTypeEnum=e.BindingTypeEnum=e.BindingScopeEnum=void 0;e.BindingScopeEnum={Request:"Request",Singleton:"Singleton",Transient:"Transient"};e.BindingTypeEnum={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};e.TargetTypeEnum={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"}},function(t,e,n){"use strict";n.d(e,"b",(function(){return r})),n.d(e,"a",(function(){return h}));var r,i=n(40),o=n.n(i),a=n(4),u=n.n(a),s=n(5),c=n.n(s),f=n(0),l=n(74);!function(t){t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE"}(r||(r={}));var h=function(){function t(e){if(u()(this,t),this.planes=[],e)this.planes=e;else for(var n=0;n<6;n++)this.planes.push(new l.a)}return c()(t,[{key:"extractFromVPMatrix",value:function(t){var e=o()(t,16),n=e[0],r=e[1],i=e[2],a=e[3],u=e[4],s=e[5],c=e[6],l=e[7],h=e[8],d=e[9],p=e[10],m=e[11],v=e[12],g=e[13],y=e[14],b=e[15];f.d.set(this.planes[0].normal,a-n,l-u,m-h),this.planes[0].distance=-(b-v),f.d.set(this.planes[1].normal,a+n,l+u,m+h),this.planes[1].distance=-(b+v),f.d.set(this.planes[2].normal,a+r,l+s,m+d),this.planes[2].distance=-(b+g),f.d.set(this.planes[3].normal,a-r,l-s,m-d),this.planes[3].distance=-(b-g),f.d.set(this.planes[4].normal,a-i,l-c,m-p),this.planes[4].distance=-(b-y),f.d.set(this.planes[5].normal,a+i,l+c,m+p),this.planes[5].distance=-(b+y),this.planes.forEach((function(t){t.normalize(),t.updatePNVertexFlag()}))}}]),t}()},function(t,e,n){var r=n(112),i=n(58);t.exports=function(t){return r(i(t))}},function(t,e,n){var r=n(14),i=n(43),o=r.String,a=r.TypeError;t.exports=function(t){if(i(t))return t;throw a(o(t)+" is not an object")}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagProperty=e.tagParameter=e.decorate=void 0;var r=n(25),i=n(20);function o(t,e,n,i,o){var a={},u="number"==typeof o,s=void 0!==o&&u?o.toString():n;if(u&&void 0!==n)throw new Error(r.INVALID_DECORATOR_OPERATION);Reflect.hasOwnMetadata(t,e)&&(a=Reflect.getMetadata(t,e));var c=a[s];if(Array.isArray(c))for(var f=0,l=c;f<l.length;f++){var h=l[f];if(h.key===i.key)throw new Error(r.DUPLICATED_METADATA+" "+h.key.toString())}else c=[];c.push(i),a[s]=c,Reflect.defineMetadata(t,a,e)}function a(t,e){Reflect.decorate(t,e)}function u(t,e){return function(n,r){e(n,r,t)}}e.tagParameter=function(t,e,n,r){o(i.TAGGED,t,e,r,n)},e.tagProperty=function(t,e,n){o(i.TAGGED_PROP,t.constructor,e,n)},e.decorate=function(t,e,n){"number"==typeof n?a([u(n,t)],e):"string"==typeof n?Reflect.decorate([t],e,n):a([t],e)}},function(t,e,n){var r=n(244),i=n(245),o=n(135),a=n(246);t.exports=function(t,e){return r(t)||i(t,e)||o(t,e)||a()},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){var r=n(161),i=n(160),o=n(168),a=n(108),u=n(169),s=[0,0];t.exports.computeMiter=function(t,e,n,a,c){return r(t,n,a),o(t,t),i(e,-t[1],t[0]),i(s,-n[1],n[0]),c/u(e,s)},t.exports.normal=function(t,e){return i(t,-e[1],e[0]),t},t.exports.direction=function(t,e,n){return a(t,e,n),o(t,t),t}},function(t,e){var n=Function.prototype.call;t.exports=n.bind?n.bind(n):function(){return n.apply(n,arguments)}},function(t,e,n){var r=n(24);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id=void 0;var r=0;e.id=function(){return r++}},function(t,e,n){"use strict";n.d(e,"a",(function(){return L}));var r,i,o,a,u,s,c,f,l,h,d,p,m,v=n(7),g=n.n(v),y=n(11),b=n.n(y),_=n(8),E=n.n(_),w=n(4),x=n.n(w),T=n(5),A=n.n(T),S=n(9),R=n.n(S),O=(n(19),n(3)),C=n(10),M=n(84),I=n(33);function N(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return P(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var k=1,D=2,L=(r=Object(O.injectable)(),i=Object(O.inject)(C.a.RenderEngine),o=Object(O.inject)(C.a.ResourcePool),a=Object(O.inject)(C.a.RenderPassFactory),u=Object(O.inject)(C.a.MeshComponentManager),r((m=p=function(){function t(){var e=this;x()(this,t),E()(this,"engine",f,this),E()(this,"resourcePool",l,this),E()(this,"renderPassFactory",h,this),E()(this,"mesh",d,this),this.pickingFBO=void 0,this.views=void 0,this.highlightEnabled=!0,this.highlightColor=[255,0,0,255],this.alreadyInRendering=!1,this.setup=function(t,e,n){var r=t.createRenderTarget(e,"picking fbo",{width:1,height:1});n.data={output:e.write(t,r)},e.hasSideEffect=!0},this.execute=function(){var t=b()(g.a.mark((function t(n,r,i){var o,a,u;return g.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.views=i,!e.alreadyInRendering){t.next=3;break}return t.abrupt("return");case 3:o=N(i);try{for(u=function(){var t=a.value,i=t.getViewport(),o=i.width,u=i.height;e.alreadyInRendering=!0;var s=n.getResourceNode(r.data.output);e.pickingFBO=e.resourcePool.getOrCreateResource(s.resource),e.pickingFBO.resize({width:o,height:u}),e.engine.useFramebuffer(e.pickingFBO,(function(){e.engine.clear({framebuffer:e.pickingFBO,color:[0,0,0,0],stencil:0,depth:1});var n,r=e.renderPassFactory(I.a.IDENTIFIER),i=[],o=N(t.getScene().getEntities());try{for(o.s();!(n=o.n()).done;){var a=n.value,u=e.mesh.getComponentByEntity(a);u.material.setUniform("u_PickingStage",k),i.push(u)}}catch(t){o.e(t)}finally{o.f()}r.renderView(t),i.forEach((function(t){t.material.setUniform("u_PickingStage",D)})),e.alreadyInRendering=!1}))},o.s();!(a=o.n()).done;)u()}catch(t){o.e(t)}finally{o.f()}case 5:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}(),this.pick=function(t,n){var r,i,o=t.x,a=t.y,u=e.engine,s=u.readPixels,c=u.useFramebuffer,f=n.getViewport(),l=f.width,h=f.height,d=o*window.devicePixelRatio,p=a*window.devicePixelRatio;if(!(d>l||d<0||p>h||p<0))return c(e.pickingFBO,(function(){0===(r=s({x:Math.round(d),y:Math.round(h-(a+1)*window.devicePixelRatio),width:1,height:1,data:new Uint8Array(4),framebuffer:e.pickingFBO}))[0]&&0===r[1]&&0===r[2]||(i=Object(M.a)(r),e.highlightEnabled&&e.highlightPickedFeature(r,n))})),i}}return A()(t,[{key:"enableHighlight",value:function(t){this.highlightEnabled=t}},{key:"setHighlightColor",value:function(t){this.highlightColor=t}},{key:"highlightPickedFeature",value:function(t,e){if(t){var n,r=N(e.getScene().getEntities());try{for(r.s();!(n=r.n()).done;){var i=n.value,o=this.mesh.getComponentByEntity(i).material;o.setUniform("u_PickingStage",D),o.setUniform("u_PickingColor",[t[0],t[1],t[2]]),o.setUniform("u_HighlightColor",this.highlightColor)}}catch(t){r.e(t)}finally{r.f()}}}}]),t}(),p.IDENTIFIER="PixelPicking Pass",c=m,f=R()(c.prototype,"engine",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),l=R()(c.prototype,"resourcePool",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),h=R()(c.prototype,"renderPassFactory",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),d=R()(c.prototype,"mesh",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),s=c))||s)},function(t,e,n){var r=n(14),i=n(24),o=function(t){return i(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?o(r[t]):r[t]&&r[t][e]}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(4),i=n.n(r),o=n(5),a=n.n(o),u=n(0),s=function(){function t(e,n){i()(this,t),this.center=void 0,this.halfExtents=void 0,this.min=u.d.create(),this.max=u.d.create(),this.update(e,n)}return a()(t,[{key:"update",value:function(t,e){this.center=t||u.d.create(),this.halfExtents=e||u.d.fromValues(.5,.5,.5),this.min=u.d.sub(this.min,this.center,this.halfExtents),this.max=u.d.add(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(t,e){u.d.add(this.center,e,t),u.d.scale(this.center,this.center,.5),u.d.sub(this.halfExtents,e,t),u.d.scale(this.halfExtents,this.halfExtents,.5),u.d.copy(this.min,t),u.d.copy(this.max,e)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(t){var e=this.center,n=e[0],r=e[1],i=e[2],o=this.halfExtents,a=o[0],u=o[1],s=o[2],c=n-a,f=n+a,l=r-u,h=r+u,d=i-s,p=i+s,m=t.center,v=m[0],g=m[1],y=m[2],b=t.halfExtents,_=b[0],E=b[1],w=b[2],x=v-_,T=v+_,A=g-E,S=g+E,R=y-w,O=y+w;x<c&&(c=x),T>f&&(f=T),A<l&&(l=A),S>h&&(h=S),R<d&&(d=R),O>p&&(p=O),e[0]=.5*(c+f),e[1]=.5*(l+h),e[2]=.5*(d+p),o[0]=.5*(f-c),o[1]=.5*(h-l),o[2]=.5*(p-d),this.min[0]=c,this.min[1]=l,this.min[2]=d,this.max[0]=f,this.max[1]=h,this.max[2]=p}},{key:"intersects",value:function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),i=t.getMin();return n[0]<=r[0]&&e[0]>=i[0]&&n[1]<=r[1]&&e[1]>=i[1]&&n[2]<=r[2]&&e[2]>=i[2]}},{key:"containsPoint",value:function(t){var e=this.getMin(),n=this.getMax();return!(t[0]<e[0]||t[0]>n[0]||t[1]<e[1]||t[1]>n[1]||t[2]<e[2]||t[2]>n[2])}},{key:"getNegativeFarPoint",value:function(t){return 273===t.pnVertexFlag?u.d.copy(u.d.create(),this.min):272===t.pnVertexFlag?u.d.fromValues(this.min[0],this.min[1],this.max[2]):257===t.pnVertexFlag?u.d.fromValues(this.min[0],this.max[1],this.min[2]):256===t.pnVertexFlag?u.d.fromValues(this.min[0],this.max[1],this.max[2]):17===t.pnVertexFlag?u.d.fromValues(this.max[0],this.min[1],this.min[2]):16===t.pnVertexFlag?u.d.fromValues(this.max[0],this.min[1],this.max[2]):1===t.pnVertexFlag?u.d.fromValues(this.max[0],this.max[1],this.min[2]):u.d.fromValues(this.max[0],this.max[1],this.max[2])}},{key:"getPositiveFarPoint",value:function(t){return 273===t.pnVertexFlag?u.d.copy(u.d.create(),this.max):272===t.pnVertexFlag?u.d.fromValues(this.max[0],this.max[1],this.min[2]):257===t.pnVertexFlag?u.d.fromValues(this.max[0],this.min[1],this.max[2]):256===t.pnVertexFlag?u.d.fromValues(this.max[0],this.min[1],this.min[2]):17===t.pnVertexFlag?u.d.fromValues(this.min[0],this.max[1],this.max[2]):16===t.pnVertexFlag?u.d.fromValues(this.min[0],this.max[1],this.min[2]):1===t.pnVertexFlag?u.d.fromValues(this.min[0],this.min[1],this.max[2]):u.d.fromValues(this.min[0],this.min[1],this.min[2])}}]),t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return S}));var r,i,o,a,u,s,c,f,l,h=n(7),d=n.n(h),p=n(11),m=n.n(p),v=n(8),g=n.n(v),y=n(4),b=n.n(y),_=n(9),E=n.n(_),w=(n(19),n(3)),x=n(10),T=n(23),A=n(33),S=(r=Object(w.injectable)(),i=Object(w.inject)(x.a.RenderEngine),o=Object(w.inject)(x.a.ResourcePool),r((l=f=function t(){var e=this;b()(this,t),g()(this,"engine",s,this),g()(this,"resourcePool",c,this),this.model=void 0,this.setup=function(t,e,n){var r=t.getPass(A.a.IDENTIFIER);if(r){var i=t.createRenderTarget(e,"render to screen",{width:1,height:1});n.data={input:e.read(r.data.output),output:e.write(t,i)}}},this.execute=function(){var t=m()(d.a.mark((function t(n,r){var i,o,a,u,s,c,f;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=e.engine,o=i.createModel,a=i.createAttribute,u=i.createBuffer,e.model){t.next=6;break}return t.next=4,o({vs:e.engine.supportWebGPU?"layout(location = 0) in vec2 a_Position;\nlayout(location = 0) out vec2 v_UV;\n\nvoid main() {\n v_UV = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n}":"attribute vec2 a_Position;\n\nvarying vec2 v_UV;\n\nvoid main() {\n v_UV = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n}",fs:e.engine.supportWebGPU?"layout(set = 0, binding = 0) uniform sampler u_TextureSampler;\nlayout(set = 0, binding = 1) uniform texture2D u_Texture;\n\nlayout(location = 0) in vec2 v_UV;\nlayout(location = 0) out vec4 outColor;\n\nvoid main() {\n outColor = texture(sampler2D(u_Texture, u_TextureSampler), v_UV);\n}":"varying vec2 v_UV;\n\nuniform sampler2D u_Texture;\n\nvoid main() {\n gl_FragColor = vec4(texture2D(u_Texture, v_UV));\n}",attributes:{a_Position:a({buffer:u({data:[-4,-4,4,-4,0,4],type:T.a.FLOAT}),size:2,arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})},uniforms:{u_Texture:null},depth:{enable:!1},count:3,blend:{enable:!0}});case 4:s=t.sent,e.model=s;case 6:c=n.getResourceNode(r.data.input),f=e.resourcePool.getOrCreateResource(c.resource),e.engine.useFramebuffer(null,(function(){e.engine.clear({framebuffer:null,color:[0,0,0,0],depth:1,stencil:0}),e.model.draw({uniforms:{u_Texture:f}})}));case 9:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),this.tearDown=function(){e.model=void 0}},f.IDENTIFIER="Copy Pass",u=l,s=E()(u.prototype,"engine",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),c=E()(u.prototype,"resourcePool",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),a=u))||a)},function(t,e,n){var r=n(29),i=n(42),o=n(111),a=n(57),u=n(37),s=n(59),c=n(32),f=n(119),l=Object.getOwnPropertyDescriptor;e.f=r?l:function(t,e){if(t=u(t),e=s(e),f)try{return l(t,e)}catch(t){}if(c(t,e))return a(!i(o.f,t,e),t[e])}},function(t,e,n){var r=n(21),i=r({}.toString),o=r("".slice);t.exports=function(t){return o(i(t),8,-1)}},function(t,e,n){var r=n(14),i=n(58),o=r.Object;t.exports=function(t){return o(i(t))}},function(t,e,n){var r=n(29),i=n(34),o=n(57);t.exports=r?function(t,e,n){return i.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(201),i=n(21),o=n(112),a=n(51),u=n(64),s=n(125),c=i([].push),f=function(t){var e=1==t,n=2==t,i=3==t,f=4==t,l=6==t,h=7==t,d=5==t||l;return function(p,m,v,g){for(var y,b,_=a(p),E=o(_),w=r(m,v),x=u(E),T=0,A=g||s,S=e?A(p,x):n||h?A(p,0):void 0;x>T;T++)if((d||T in E)&&(b=w(y=E[T],T,_),t))if(e)S[T]=b;else if(b)switch(t){case 3:return!0;case 5:return y;case 6:return T;case 2:c(S,y)}else switch(t){case 4:return!1;case 7:c(S,y)}return l?-1:i||f?f:S}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterReject:f(7)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.circularDependencyToException=e.listMetadataForTarget=e.listRegisteredBindingsForServiceIdentifier=e.getServiceIdentifierAsString=e.getFunctionName=void 0;var r=n(25);function i(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function o(t){if(t.name)return t.name;var e=t.toString(),n=e.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+e}e.getServiceIdentifierAsString=i,e.listRegisteredBindingsForServiceIdentifier=function(t,e,n){var r="",i=n(t,e);return 0!==i.length&&(r="\nRegistered bindings:",i.forEach((function(t){var e="Object";null!==t.implementationType&&(e=o(t.implementationType)),r=r+"\n "+e,t.constraint.metaData&&(r=r+" - "+t.constraint.metaData)}))),r},e.circularDependencyToException=function t(e){e.childRequests.forEach((function(e){if(function t(e,n){return null!==e.parentRequest&&(e.parentRequest.serviceIdentifier===n||t(e.parentRequest,n))}(e,e.serviceIdentifier)){var n=function(t){return function t(e,n){void 0===n&&(n=[]);var r=i(e.serviceIdentifier);return n.push(r),null!==e.parentRequest?t(e.parentRequest,n):n}(t).reverse().join(" --\x3e ")}(e);throw new Error(r.CIRCULAR_DEPENDENCY+" "+n)}t(e)}))},e.listMetadataForTarget=function(t,e){if(e.isTagged()||e.isNamed()){var n="",r=e.getNamedTag(),i=e.getCustomTags();return null!==r&&(n+=r.toString()+"\n"),null!==i&&i.forEach((function(t){n+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+n}return" "+t},e.getFunctionName=o},function(t,e,n){"use strict";n.d(e,"a",(function(){return Q}));n(134);var r,i,o,a,u,s=n(3),c=n(173),f=n.n(c),l=n(17),h=n(8),d=n.n(h),p=n(4),m=n.n(p),v=n(5),g=n.n(v),y=n(9),b=n.n(y),_=(n(19),n(10)),E=n(23),w=(r=Object(s.injectable)(),i=Object(s.inject)(_.a.RenderEngine),r((a=function(){function t(){m()(this,t),d()(this,"engine",u,this),this.resourcePool={}}return g()(t,[{key:"getOrCreateResource",value:function(t){if(!this.resourcePool[t.name]){var e=t.descriptor,n=e.width,r=e.height,i=e.usage;this.resourcePool[t.name]=this.engine.createFramebuffer({color:this.engine.createTexture2D({width:n,height:r,wrapS:E.a.CLAMP_TO_EDGE,wrapT:E.a.CLAMP_TO_EDGE,usage:i})})}return this.resourcePool[t.name]}},{key:"clean",value:function(){this.resourcePool={}}}]),t}(),u=b()(a.prototype,"engine",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),o=a))||o),x=n(81),T=n(83),A=n(68),S=n(69),R=n(70),O=n(71),C=n(72),M=n(73),I=n(48),N=n(45),P=n(33),k=n(75),D=n(76),L=n(15),j=n.n(L),F=n(16),B=n.n(F),U=n(12),G=n.n(U);function V(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=G()(t);if(e){var i=G()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return B()(this,n)}}var z=function(t){j()(n,t);var e=V(n);function n(t){var r;return m()(this,n),(r=e.call(this,t)).name=void 0,r.name=t.name||"",r}return n}(l.a),W=n(77),H=n(78),q=n(79),X=n(80),Y=n(82),K=new s.Container;f()(K,!1);function Q(){var t=new s.Container;return t.parent=K,t.bind(_.a.Systems).to(W.a).inSingletonScope().whenTargetNamed(_.a.SceneGraphSystem),t.bind(_.a.Systems).to(x.a).inSingletonScope().whenTargetNamed(_.a.FrameGraphSystem),t.bind(_.a.Systems).to(M.a).inSingletonScope().whenTargetNamed(_.a.MeshSystem),t.bind(_.a.Systems).to(A.a).inSingletonScope().whenTargetNamed(_.a.GeometrySystem),t.bind(_.a.Systems).to(R.a).inSingletonScope().whenTargetNamed(_.a.MaterialSystem),t.bind(_.a.Systems).to(k.a).inSingletonScope().whenTargetNamed(_.a.RendererSystem),t.bind(_.a.ResourcePool).to(w).inSingletonScope(),t.bind(_.a.ConfigService).to(q.a).inSingletonScope(),t.bind(_.a.InteractorService).to(X.a).inSingletonScope(),t.bind(_.a.RenderPass).to(P.a).inSingletonScope().whenTargetNamed(P.a.IDENTIFIER),t.bind(_.a.RenderPass).to(I.a).inSingletonScope().whenTargetNamed(I.a.IDENTIFIER),t.bind(_.a.RenderPass).to(N.a).inSingletonScope().whenTargetNamed(N.a.IDENTIFIER),t.bind(_.a.RenderPassFactory).toFactory((function(t){return function(e){return t.container.getNamed(_.a.RenderPass,e)}})),t}K.bind(_.a.ShaderModuleService).to(Y.a).inSingletonScope(),K.bind(_.a.NameComponentManager).toConstantValue(new l.b(z)),K.bind(_.a.HierarchyComponentManager).toConstantValue(new l.b(D.a)),K.bind(_.a.TransformComponentManager).toConstantValue(new l.b(H.a)),K.bind(_.a.MeshComponentManager).toConstantValue(new l.b(C.a)),K.bind(_.a.CullableComponentManager).toConstantValue(new l.b(O.a)),K.bind(_.a.GeometryComponentManager).toConstantValue(new l.b(T.a)),K.bind(_.a.MaterialComponentManager).toConstantValue(new l.b(S.a))},function(t,e,n){t.exports={EPSILON:n(158),create:n(159),clone:n(278),fromValues:n(279),copy:n(280),set:n(160),equals:n(281),exactEquals:n(282),add:n(161),subtract:n(108),sub:n(283),multiply:n(162),mul:n(284),divide:n(163),div:n(285),inverse:n(286),min:n(287),max:n(288),rotate:n(289),floor:n(290),ceil:n(291),round:n(292),scale:n(293),scaleAndAdd:n(294),distance:n(164),dist:n(295),squaredDistance:n(165),sqrDist:n(296),length:n(166),len:n(297),squaredLength:n(167),sqrLen:n(298),negate:n(299),normalize:n(168),dot:n(169),cross:n(300),lerp:n(301),random:n(302),transformMat2:n(303),transformMat2d:n(304),transformMat3:n(305),transformMat4:n(306),forEach:n(307),limit:n(308)}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){var r=n(14).TypeError;t.exports=function(t){if(null==t)throw r("Can't call method on "+t);return t}},function(t,e,n){var r=n(181),i=n(86);t.exports=function(t){var e=r(t,"string");return i(e)?e:e+""}},function(t,e,n){var r=n(118),i=n(88);(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.19.3",mode:r?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},function(t,e,n){var r=n(14),i=n(24),o=n(32),a=n(52),u=n(89),s=n(92),c=n(93),f=n(186).CONFIGURABLE,l=c.get,h=c.enforce,d=String(String).split("String");(t.exports=function(t,e,n,s){var c,l=!!s&&!!s.unsafe,p=!!s&&!!s.enumerable,m=!!s&&!!s.noTargetGet,v=s&&void 0!==s.name?s.name:e;i(n)&&("Symbol("===String(v).slice(0,7)&&(v="["+String(v).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!o(n,"name")||f&&n.name!==v)&&a(n,"name",v),(c=h(n)).source||(c.source=d.join("string"==typeof v?v:""))),t!==r?(l?!m&&t[e]&&(p=!0):delete t[e],p?t[e]=n:a(t,e,n)):p?t[e]=n:u(e,n)})(Function.prototype,"toString",(function(){return i(this)&&l(this).source||s(this)}))},function(t,e){t.exports={}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){var e=+t;return e!=e||0===e?0:(e>0?r:n)(e)}},function(t,e,n){var r=n(122);t.exports=function(t){return r(t.length)}},function(t,e,n){var r=n(14),i=n(99),o=r.String;t.exports=function(t){if("Symbol"===i(t))throw TypeError("Cannot convert a Symbol value to a string");return o(t)}},function(t,e,n){"use strict";var r=n(23);n.d(e,"gl",(function(){return r.a}));n(145),n(146),n(147),n(148),n(149),n(150),n(151),n(152),n(153),n(154),n(155)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return o}));var r=-1,i=1;function o(){return i++}},function(t,e,n){"use strict";n.d(e,"a",(function(){return S}));var r,i,o,a,u,s,c,f=n(7),l=n.n(f),h=n(11),d=n.n(h),p=n(8),m=n.n(p),v=n(4),g=n.n(v),y=n(5),b=n.n(y),_=n(9),E=n.n(_),w=(n(19),n(3)),x=n(1),T=n(10),A=n(23),S=(r=Object(w.injectable)(),i=Object(w.inject)(T.a.GeometryComponentManager),o=Object(w.inject)(T.a.RenderEngine),r((u=function(){function t(){g()(this,t),m()(this,"geometry",s,this),m()(this,"engine",c,this)}var e;return b()(t,[{key:"execute",value:(e=d()(l.a.mark((function t(){var e=this;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.geometry.forEach((function(t,n){n.dirty&&(n.attributes.forEach((function(t){var n;t.dirty&&t.data&&(t.buffer?null===(n=t.buffer)||void 0===n||n.subData({data:t.data,offset:0}):t.buffer=e.engine.createBuffer({data:t.data,type:A.a.FLOAT}),t.dirty=!1)})),n.indices&&(n.indicesBuffer?n.indicesBuffer.subData({data:n.indices,offset:0}):n.indicesBuffer=e.engine.createElements({data:n.indices,count:n.indices.length,type:A.a.UNSIGNED_INT,usage:A.a.STATIC_DRAW})),n.dirty=!1)}));case 1:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.geometry.forEach((function(t,e){e.indicesBuffer&&e.indicesBuffer.destroy(),e.attributes.forEach((function(t){t.buffer&&t.buffer.destroy()}))})),this.geometry.clear()}},{key:"createBufferGeometry",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{vertexCount:3},e=t.vertexCount,n=Object(x.createEntity)();return this.geometry.create(n,{vertexCount:e})}},{key:"createInstancedBufferGeometry",value:function(t){var e=t.maxInstancedCount,n=t.vertexCount,r=Object(x.createEntity)();return this.geometry.create(r,{maxInstancedCount:e,vertexCount:n})}}]),t}(),s=E()(u.prototype,"geometry",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),c=E()(u.prototype,"engine",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),a=u))||a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return E}));var r=n(2),i=n.n(r),o=n(4),a=n.n(o),u=n(5),s=n.n(u),c=n(13),f=n.n(c),l=n(15),h=n.n(l),d=n(16),p=n.n(d),m=n(12),v=n.n(m),g=n(1);function y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function b(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?y(Object(n),!0).forEach((function(e){i()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function _(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=v()(t);if(e){var i=v()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}var E=function(t){h()(n,t);var e=_(n);function n(t){var r;return a()(this,n),(r=e.call(this,t)).vertexShaderGLSL=void 0,r.fragmentShaderGLSL=void 0,r.defines={},r.dirty=!0,r.uniforms=[],r.cull={enable:!0,face:g.gl.BACK},r.depth={enable:!0},r.blend=void 0,r.entity=void 0,r.type=void 0,Object.assign(f()(r),t),r}return s()(n,[{key:"setDefines",value:function(t){return this.defines=b(b({},this.defines),t),this}},{key:"setCull",value:function(t){return this.cull=t,this}},{key:"setDepth",value:function(t){return this.depth=t,this}},{key:"setBlend",value:function(t){return this.blend=t,this}},{key:"setUniform",value:function(t,e){var n=this;if("string"!=typeof t)return Object.keys(t).forEach((function(e){return n.setUniform(e,t[e])})),this;var r=this.uniforms.find((function(e){return e.name===t}));return r?(r.dirty=!0,r.data=e):this.uniforms.push({name:t,dirty:!0,data:e}),this.dirty=!0,this}}]),n}(n(17).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return I}));var r,i,o,a,u,s,c,f,l,h=n(2),d=n.n(h),p=n(7),m=n.n(p),v=n(11),g=n.n(v),y=n(8),b=n.n(y),_=n(4),E=n.n(_),w=n(5),x=n.n(w),T=n(9),A=n.n(T),S=(n(19),n(3)),R=n(1),O=n(10);function C(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function M(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?C(Object(n),!0).forEach((function(e){d()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var I=(r=Object(S.injectable)(),i=Object(S.inject)(O.a.MaterialComponentManager),o=Object(S.inject)(O.a.RenderEngine),a=Object(S.inject)(O.a.ShaderModuleService),r((s=function(){function t(){E()(this,t),b()(this,"material",c,this),b()(this,"engine",f,this),b()(this,"shaderModule",l,this)}var e;return x()(t,[{key:"execute",value:(e=g()(m.a.mark((function t(){return m.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.material.clear()}},{key:"createShaderMaterial",value:function(t){var e=Object(R.createEntity)(),n=t.vertexShader,r=t.fragmentShader,i=[];if(!this.engine.supportWebGPU){var o="material-".concat(e);this.shaderModule.registerModule(o,{vs:t.vertexShader,fs:t.fragmentShader});var a=this.shaderModule.getModule(o);n=a.vs,r=a.fs,a.uniforms&&(i=Object.keys(a.uniforms).map((function(t){return{dirty:!0,name:t,data:a.uniforms[t]}})))}return this.material.create(e,M(M({vertexShaderGLSL:n,fragmentShaderGLSL:r},t),{},{uniforms:i}))}}]),t}(),c=A()(s.prototype,"material",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),f=A()(s.prototype,"engine",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),l=A()(s.prototype,"shaderModule",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),u=s))||u)},function(t,e,n){"use strict";n.d(e,"a",(function(){return v}));var r,i=n(4),o=n.n(i),a=n(13),u=n.n(a),s=n(15),c=n.n(s),f=n(16),l=n.n(f),h=n(12),d=n.n(h),p=n(17);function m(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=d()(t);if(e){var i=d()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l()(this,n)}}!function(t){t[t.Standard=0]="Standard"}(r||(r={}));var v=function(t){c()(n,t);var e=m(n);function n(t){var i;return o()(this,n),(i=e.call(this,t)).strategy=r.Standard,i.visibilityPlaneMask=0,i.visible=!1,Object.assign(u()(i),t),i}return n}(p.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return v}));var r=n(4),i=n.n(r),o=n(13),a=n.n(o),u=n(15),s=n.n(u),c=n(16),f=n.n(c),l=n(12),h=n.n(l),d=n(17),p=n(47);function m(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=h()(t);if(e){var i=h()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return f()(this,n)}}var v=function(t){s()(n,t);var e=m(n);function n(t){var r;return i()(this,n),(r=e.call(this,t)).material=void 0,r.geometry=void 0,r.aabb=new p.a,r.aabbDirty=!0,r.model=void 0,r.visible=!0,r.children=[],Object.assign(a()(r),t),r}return n}(d.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return D}));var r,i,o,a,u,s,c,f,l,h,d,p,m,v=n(7),g=n.n(v),y=n(11),b=n.n(y),_=n(8),E=n.n(_),w=n(4),x=n.n(w),T=n(5),A=n.n(T),S=n(9),R=n.n(S),O=(n(19),n(0)),C=n(3),M=n(10),I=n(36),N=n(84);function P(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return k(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var D=(r=Object(C.injectable)(),i=Object(C.inject)(M.a.MeshComponentManager),o=Object(C.inject)(M.a.CullableComponentManager),a=Object(C.inject)(M.a.GeometryComponentManager),u=Object(C.inject)(M.a.HierarchyComponentManager),s=Object(C.inject)(M.a.TransformComponentManager),r((f=function(){function t(){x()(this,t),E()(this,"mesh",l,this),E()(this,"cullable",h,this),E()(this,"geometry",d,this),E()(this,"hierarchy",p,this),E()(this,"transform",m,this),this.planes=void 0}var e;return A()(t,[{key:"setFrustumPlanes",value:function(t){this.planes=t}},{key:"execute",value:(e=b()(g.a.mark((function t(e){var n,r,i,o,a,u,s,c,f,l,h,d,p,m,v,y,b,_,E,w,x;return g.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=P(e);try{for(n.s();!(r=n.n()).done;){i=r.value,o=i.getScene(),a=i.getCamera(),u=P(o.getEntities());try{for(u.s();!(s=u.n()).done;)c=s.value,(f=this.mesh.getComponentByEntity(c))&&(l=this.hierarchy.getComponentByEntity(c),h=this.cullable.getComponentByEntity(c),d=f.geometry,p=this.transform.getComponentByEntity(c),d&&d.aabb&&p&&f.aabbDirty&&(m=p.worldTransform,v=d.aabb,y=v.center,b=v.halfExtents,_=O.d.transformMat4(O.d.create(),y,m),E=Object(N.b)(m,O.a.create()),w=O.d.transformMat3(O.d.create(),b,E),f.aabb.update(_,w),f.aabbDirty=!1),h&&d&&(x=this.cullable.getComponentByEntity((null==l?void 0:l.parentID)||-1),h.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(f.aabb,(null==x?void 0:x.visibilityPlaneMask)||I.b.INDETERMINATE,this.planes||a.getFrustum().planes),h.visible=h.visibilityPlaneMask!==I.b.OUTSIDE))}catch(t){u.e(t)}finally{u.f()}}}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.cullable.clear(),this.mesh.clear()}},{key:"computeVisibilityWithPlaneMask",value:function(t,e,n){if(e===I.b.OUTSIDE||e===I.b.INSIDE)return e;for(var r=I.b.INSIDE,i=0,o=n.length;i<o;++i){var a=i<31?1<<i:0;if(!(i<31&&0==(e&a))){var u=n[i],s=u.normal,c=u.distance;if(O.d.dot(s,t.getNegativeFarPoint(n[i]))+c>0)return I.b.OUTSIDE;O.d.dot(s,t.getPositiveFarPoint(n[i]))+c>0&&(r|=a)}}return r}}]),t}(),l=R()(f.prototype,"mesh",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),h=R()(f.prototype,"cullable",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),d=R()(f.prototype,"geometry",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),p=R()(f.prototype,"hierarchy",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),m=R()(f.prototype,"transform",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),c=f))||c)},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(4),i=n.n(r),o=n(5),a=n.n(o),u=n(0),s=function(){function t(e,n){i()(this,t),this.distance=void 0,this.normal=void 0,this.pnVertexFlag=void 0,this.distance=e||0,this.normal=n||u.d.fromValues(0,1,0),this.updatePNVertexFlag()}return a()(t,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(t){return u.d.dot(t,this.normal)-this.distance}},{key:"normalize",value:function(){var t=1/u.d.len(this.normal);u.d.scale(this.normal,this.normal,t),this.distance*=t}},{key:"intersectsLine",value:function(t,e,n){var r=this.distanceToPoint(t),i=r/(r-this.distanceToPoint(e)),o=i>=0&&i<=1;return o&&n&&u.d.lerp(n,t,e,i),o}}]),t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return N}));var r,i,o,a,u,s,c,f,l,h,d,p,m=n(7),v=n.n(m),g=n(11),y=n.n(g),b=n(8),_=n.n(b),E=n(4),w=n.n(E),x=n(5),T=n.n(x),A=n(9),S=n.n(A),R=(n(19),n(3)),O=n(10),C=n(48),M=n(45),I=n(33),N=(r=Object(R.injectable)(),i=Object(R.inject)(O.a.Systems),o=Object(R.named)(O.a.FrameGraphSystem),a=Object(R.inject)(O.a.RenderPassFactory),u=Object(R.inject)(O.a.ConfigService),s=Object(R.inject)(O.a.ResourcePool),r((f=function(){function t(){w()(this,t),_()(this,"frameGraphSystem",l,this),_()(this,"renderPassFactory",h,this),_()(this,"configService",d,this),_()(this,"resourcePool",p,this)}var e;return T()(t,[{key:"execute",value:(e=y()(v.a.mark((function t(e){var n,r,i,o,a,u,s,c;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this.renderPassFactory(I.a.IDENTIFIER),r=n.setup,i=n.execute,this.frameGraphSystem.addPass(I.a.IDENTIFIER,r,i),o=this.renderPassFactory(C.a.IDENTIFIER),a=o.setup,u=o.execute,s=o.tearDown,c=this.frameGraphSystem.addPass(C.a.IDENTIFIER,a,u,s),this.frameGraphSystem.present(c.data.output);case 5:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.resourcePool.clean()}},{key:"pick",value:function(t,e){return this.renderPassFactory(M.a.IDENTIFIER).pick(t,e)}}]),t}(),l=S()(f.prototype,"frameGraphSystem",[i,o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),h=S()(f.prototype,"renderPassFactory",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),d=S()(f.prototype,"configService",[u],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),p=S()(f.prototype,"resourcePool",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),c=f))||c)},function(t,e,n){"use strict";n.d(e,"a",(function(){return p}));var r=n(4),i=n.n(r),o=n(13),a=n.n(o),u=n(15),s=n.n(u),c=n(16),f=n.n(c),l=n(12),h=n.n(l);function d(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=h()(t);if(e){var i=h()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return f()(this,n)}}var p=function(t){s()(n,t);var e=d(n);function n(t){var r;return i()(this,n),(r=e.call(this,t)).parentID=void 0,Object.assign(a()(r),t),r}return n}(n(17).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return R}));var r,i,o,a,u,s,c,f,l,h=n(7),d=n.n(h),p=n(11),m=n.n(p),v=n(8),g=n.n(v),y=n(4),b=n.n(y),_=n(5),E=n.n(_),w=n(9),x=n.n(w),T=(n(19),n(0)),A=n(3),S=n(10),R=(r=Object(A.injectable)(),i=Object(A.inject)(S.a.HierarchyComponentManager),o=Object(A.inject)(S.a.TransformComponentManager),a=Object(A.inject)(S.a.MeshComponentManager),r((s=function(){function t(){b()(this,t),g()(this,"hierarchy",c,this),g()(this,"transform",f,this),g()(this,"mesh",l,this)}var e;return E()(t,[{key:"execute",value:(e=m()(d.a.mark((function t(){return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.runTransformUpdateSystem(),this.runHierarchyUpdateSystem();case 2:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"tearDown",value:function(){this.hierarchy.clear(),this.transform.clear()}},{key:"getHierarchyComponentManager",value:function(){return this.hierarchy}},{key:"getTransformComponentManager",value:function(){return this.transform}},{key:"runTransformUpdateSystem",value:function(){var t=this;this.transform.forEach((function(e,n){(n.isDirty()||n.isLocalDirty())&&(t.setMeshAABBDirty(t.mesh.getComponentByEntity(e)),n.updateTransform())}))}},{key:"runHierarchyUpdateSystem",value:function(){var t=this;this.hierarchy.forEach((function(e,n){var r=t.transform.getComponentByEntity(e),i=t.transform.getComponentByEntity(n.parentID);null!==r&&null!==i&&r.updateTransformWithParent(i)}))}},{key:"attach",value:function(t,e,n){this.hierarchy.contains(t)&&this.detach(t),this.hierarchy.create(t,{parentID:e});var r=this.mesh.getComponentByEntity(e);if(this.setMeshAABBDirty(r),r&&-1===r.children.indexOf(t)&&r.children.push(t),this.hierarchy.getCount()>1)for(var i=this.hierarchy.getCount()-1;i>0;--i)for(var o=this.hierarchy.getEntity(i),a=0;a<i;++a){if(this.hierarchy.getComponent(a).parentID===o){this.hierarchy.moveItem(i,a),++i;break}}this.hierarchy.getComponentByEntity(t);var u=this.transform.getComponentByEntity(e);null===u&&(u=this.transform.create(e));var s=this.transform.getComponentByEntity(t);null===s&&(s=this.transform.create(t),u=this.transform.getComponentByEntity(e)),s.parent=u,!n&&u&&(s.matrixTransform(T.b.invert(T.b.create(),u.worldTransform)),s.updateTransform()),u&&s.updateTransformWithParent(u)}},{key:"detach",value:function(t){var e=this.hierarchy.getComponentByEntity(t);if(null!==e){var n=this.transform.getComponentByEntity(t);null!==n&&(n.parent=null,n.applyTransform()),this.hierarchy.removeKeepSorted(t);var r=this.mesh.getComponentByEntity(e.parentID);if(r){var i=r.children.indexOf(t);r.children.splice(i,1)}this.setMeshAABBDirty(r)}}},{key:"detachChildren",value:function(t){var e=this.mesh.getComponentByEntity(t);e&&(e.children=[]);for(var n=0;n<this.hierarchy.getCount();){var r;if((null===(r=this.hierarchy.getComponent(n))||void 0===r?void 0:r.parentID)===t){var i=this.hierarchy.getEntity(n);this.detach(i)}else++n}}},{key:"setMeshAABBDirty",value:function(t){t&&(t.aabbDirty=!0)}}]),t}(),c=x()(s.prototype,"hierarchy",[i],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),f=x()(s.prototype,"transform",[o],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),l=x()(s.prototype,"mesh",[a],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),u=s))||u)},function(t,e,n){"use strict";n.d(e,"a",(function(){return g}));var r=n(4),i=n.n(r),o=n(5),a=n.n(o),u=n(13),s=n.n(u),c=n(15),f=n.n(c),l=n(16),h=n.n(l),d=n(12),p=n.n(d),m=n(0);function v(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=p()(t);if(e){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var g=function(t){f()(n,t);var e=v(n);function n(t){var r,o,a,u,c,f,l,h,d,p,v,g,y,b,_;return i()(this,n),(r=e.call(this,t)).dirtyFlag=void 0,r.localDirtyFlag=void 0,r.parent=null,r.localPosition=m.d.fromValues(0,0,0),r.localRotation=m.c.fromValues(0,0,0,1),r.localScale=m.d.fromValues(1,1,1),r.localTransform=m.b.create(),r.position=m.d.fromValues(0,0,0),r.rotation=m.c.fromValues(0,0,0,1),r.scaling=m.d.fromValues(1,1,1),r.worldTransform=m.b.create(),r.matrixTransform=(o=m.b.create(),function(t){m.b.multiply(o,r.getLocalTransform(),t),m.b.getScaling(r.localScale,o),m.b.getTranslation(r.localPosition,o),m.b.getRotation(r.localRotation,o)}),r.rotateRollPitchYaw=(a=m.c.create(),u=m.c.create(),c=m.c.create(),function(t,e,n){r.setDirty(),m.c.fromEuler(a,t,0,0),m.c.fromEuler(u,0,e,0),m.c.fromEuler(c,0,0,n),m.c.multiply(r.localRotation,a,r.localRotation),m.c.multiply(r.localRotation,r.localRotation,u),m.c.multiply(r.localRotation,c,r.localRotation),m.c.normalize(r.localRotation,r.localRotation)}),r.lerp=(f=m.d.create(),l=m.c.create(),h=m.d.create(),d=m.d.create(),p=m.c.create(),v=m.d.create(),function(t,e,n){r.setDirty(),m.b.getScaling(f,t.worldTransform),m.b.getTranslation(h,t.worldTransform),m.b.getRotation(l,t.worldTransform),m.b.getScaling(d,e.worldTransform),m.b.getTranslation(v,e.worldTransform),m.b.getRotation(p,e.worldTransform),m.d.lerp(r.localScale,f,d,n),m.c.slerp(r.localRotation,l,p,n),m.d.lerp(r.localPosition,h,v,n)}),r.translate=(g=m.d.create(),function(t){return m.d.add(g,r.getPosition(),t),r.setPosition(g),r.setDirty(!0),s()(r)}),r.translateLocal=function(t){return m.d.transformQuat(t,t,r.localRotation),m.d.add(r.localPosition,r.localPosition,t),r.setLocalDirty(!0),s()(r)},r.setPosition=(y=m.b.create(),function(t){return r.position=t,r.setLocalDirty(!0),null===r.parent?m.d.copy(r.localPosition,t):(m.b.copy(y,r.parent.worldTransform),m.b.invert(y,y),m.d.transformMat4(r.localPosition,t,y)),s()(r)}),r.rotate=(b=m.c.create(),function(t){if(null===r.parent)m.c.multiply(r.localRotation,r.localRotation,t),m.c.normalize(r.localRotation,r.localRotation);else{var e=r.getRotation(),n=r.parent.getRotation();m.c.copy(b,n),m.c.invert(b,b),m.c.multiply(b,b,t),m.c.multiply(r.localRotation,t,e),m.c.normalize(r.localRotation,r.localRotation)}return r.setLocalDirty(),s()(r)}),r.rotateLocal=function(t){return m.c.multiply(r.localRotation,r.localRotation,t),m.c.normalize(r.localRotation,r.localRotation),r.setLocalDirty(!0),s()(r)},r.setRotation=(_=m.c.create(),function(t){return null===r.parent?m.c.copy(r.localRotation,t):(m.c.copy(_,r.parent.getRotation()),m.c.invert(_,_),m.c.copy(r.localRotation,_),m.c.mul(r.localRotation,r.localRotation,t)),r.setLocalDirty(!0),s()(r)}),r}return a()(n,[{key:"setLocalPosition",value:function(t){m.d.copy(this.localPosition,t),this.setLocalDirty(!0)}},{key:"setLocalScale",value:function(t){m.d.copy(this.localScale,t),this.setLocalDirty(!0)}},{key:"setLocalRotation",value:function(t){return m.c.copy(this.localRotation,t),this.setLocalDirty(!0),this}},{key:"isDirty",value:function(){return this.dirtyFlag}},{key:"setDirty",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t?this.dirtyFlag|=n.DIRTY:this.dirtyFlag&=~n.DIRTY}},{key:"isLocalDirty",value:function(){return this.localDirtyFlag}},{key:"setLocalDirty",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t?(this.localDirtyFlag|=n.DIRTY,this.setDirty(!0)):this.localDirtyFlag&=~n.DIRTY}},{key:"updateTransform",value:function(){this.isLocalDirty()&&this.getLocalTransform(),this.isDirty()&&null===this.parent&&(m.b.copy(this.worldTransform,this.getLocalTransform()),this.setDirty(!1))}},{key:"updateTransformWithParent",value:function(t){m.b.multiply(this.worldTransform,t.worldTransform,this.getLocalTransform())}},{key:"applyTransform",value:function(){this.setDirty(),m.b.getScaling(this.localScale,this.worldTransform),m.b.getTranslation(this.localPosition,this.worldTransform),m.b.getRotation(this.localRotation,this.worldTransform)}},{key:"clearTransform",value:function(){this.setDirty(),this.localPosition=m.d.fromValues(0,0,0),this.localRotation=m.c.fromValues(0,0,0,1),this.localScale=m.d.fromValues(1,1,1)}},{key:"scaleLocal",value:function(t){return this.setLocalDirty(),m.d.multiply(this.localScale,this.localScale,t),this}},{key:"getLocalPosition",value:function(){return this.localPosition}},{key:"getLocalRotation",value:function(){return this.localRotation}},{key:"getLocalScale",value:function(){return this.localScale}},{key:"getLocalTransform",value:function(){return this.localDirtyFlag&&(m.b.fromRotationTranslationScale(this.localTransform,this.localRotation,this.localPosition,this.localScale),this.setLocalDirty(!1)),this.localTransform}},{key:"getWorldTransform",value:function(){return this.isLocalDirty()||this.isDirty()?(this.parent&&this.parent.getWorldTransform(),this.updateTransform(),this.worldTransform):this.worldTransform}},{key:"getPosition",value:function(){return m.b.getTranslation(this.position,this.worldTransform),this.position}},{key:"getRotation",value:function(){return m.b.getRotation(this.rotation,this.worldTransform),this.rotation}},{key:"getScale",value:function(){return m.b.getScaling(this.scaling,this.worldTransform),this.scaling}}]),n}(n(17).a);g.DIRTY=1},function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r,i=n(4),o=n.n(i),a=n(5),u=n.n(a),s=n(3),c=Object(s.injectable)()(r=function(){function t(){o()(this,t),this.config=void 0}return u()(t,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),t}())||r},function(t,e,n){"use strict";n.d(e,"a",(function(){return f}));var r,i,o=n(4),a=n.n(o),u=n(5),s=n.n(u),c=n(3);!function(t){t.PANSTART="PANSTART",t.PANEND="PANEND",t.PANMOVE="PANMOVE",t.PINCH="PINCH",t.KEYDOWN="KEYDOWN",t.KEYUP="KEYUP",t.HOVER="HOVER"}(i||(i={}));var f=Object(c.injectable)()(r=function(){function t(){a()(this,t)}return s()(t,[{key:"listen",value:function(t){}},{key:"on",value:function(t,e){}},{key:"connect",value:function(){}},{key:"disconnect",value:function(){}},{key:"destroy",value:function(){}}]),t}())||r},function(t,e,n){"use strict";n.d(e,"a",(function(){return F}));var r=n(40),i=n.n(r),o=n(7),a=n.n(o),u=n(11),s=n.n(u),c=n(8),f=n.n(c),l=n(4),h=n.n(l),d=n(5),p=n.n(d),m=n(9),v=n.n(m),g=(n(19),n(3)),y=n(10),b=function t(){h()(this,t),this.index=void 0},_=function t(){h()(this,t),this.name=void 0,this.data=void 0,this.execute=void 0,this.tearDown=void 0},E=function(){function t(){h()(this,t),this.name=void 0,this.refCount=0,this.hasSideEffect=!1,this.devirtualize=[],this.destroy=[],this.reads=[],this.writes=[]}return p()(t,[{key:"read",value:function(t){return this.reads.find((function(e){return e.index===t.index}))||this.reads.push(t),t}},{key:"sample",value:function(t){return this.read(t),t}},{key:"write",value:function(t,e){if(this.writes.find((function(t){return t.index===e.index})))return e;var n=t.getResourceNode(e);n.resource.version++,n.resource.imported&&(this.hasSideEffect=!0);var r=t.createResourceNode(n.resource);return t.getResourceNode(r).writer=this,this.writes.push(r),r}}]),t}(),w=n(15),x=n.n(w),T=n(16),A=n.n(T),S=n(12),R=n.n(S);function O(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=R()(t);if(e){var i=R()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return A()(this,n)}}var C,M,I,N,P,k=function(t){x()(n,t);var e=O(n);function n(){var t;h()(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).version=0,t.refs=0,t.name=void 0,t.imported=void 0,t.priority=void 0,t.discardStart=!0,t.discardEnd=!1,t.descriptor=void 0,t.resource=void 0,t}return p()(n,[{key:"preExecuteDestroy",value:function(){this.discardEnd=!0}},{key:"postExecuteDestroy",value:function(){this.imported}},{key:"postExecuteDevirtualize",value:function(){this.discardStart=!1}},{key:"preExecuteDevirtualize",value:function(){this.imported}}]),n}((function t(){h()(this,t),this.first=void 0,this.last=void 0})),D=function t(){h()(this,t),this.resource=void 0,this.writer=void 0,this.readerCount=0,this.version=void 0};function L(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return j(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var F=(C=Object(g.injectable)(),M=Object(g.inject)(y.a.RenderEngine),C((N=function(){function t(){h()(this,t),this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[],f()(this,"engine",P,this)}var e,n;return p()(t,[{key:"execute",value:(n=s()(a.a.mark((function t(e){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.compile(),t.next=3,this.executePassNodes(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"tearDown",value:function(){this.frameGraphPasses.forEach((function(t){t.tearDown&&t.tearDown()})),this.reset()}},{key:"addPass",value:function(t,e,n,r){var i=new _;i.execute=n,r&&(i.tearDown=r),i.name=t;var o=new E;return o.name=t,this.passNodes.push(o),this.frameGraphPasses.push(i),e(this,o,i),i}},{key:"getPass",value:function(t){return this.frameGraphPasses.find((function(e){return e.name===t}))}},{key:"compile",value:function(){var t,e=this,n=L(this.passNodes);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.refCount=r.writes.length+(r.hasSideEffect?1:0),r.reads.forEach((function(t){e.resourceNodes[t.index].readerCount++}))}}catch(t){n.e(t)}finally{n.f()}var i,o=[],a=L(this.resourceNodes);try{for(a.s();!(i=a.n()).done;){var u=i.value;0===u.readerCount&&o.push(u)}}catch(t){a.e(t)}finally{a.f()}for(;o.length;){var s=o.pop(),c=s&&s.writer;if(c&&0==--c.refCount){var f,l=L(c.reads);try{for(l.s();!(f=l.n()).done;){var h=f.value,d=this.resourceNodes[h.index];0==--d.readerCount&&o.push(d)}}catch(t){l.e(t)}finally{l.f()}}}this.resourceNodes.forEach((function(t){t.resource.refs+=t.readerCount}));var p,m=L(this.passNodes);try{for(m.s();!(p=m.n()).done;){var v=p.value;if(v.refCount){var g,y=L(v.reads);try{for(y.s();!(g=y.n()).done;){var b=g.value,_=this.resourceNodes[b.index].resource;_.first=_.first?_.first:v,_.last=v}}catch(t){y.e(t)}finally{y.f()}var E,w=L(v.writes);try{for(w.s();!(E=w.n()).done;){var x=E.value,T=this.resourceNodes[x.index].resource;T.first=T.first?T.first:v,T.last=v}}catch(t){w.e(t)}finally{w.f()}}}}catch(t){m.e(t)}finally{m.f()}for(var A=0;A<2;A++){var S,R=L(this.resourceNodes);try{for(R.s();!(S=R.n()).done;){var O=S.value.resource;if(O.priority===A&&O.refs){var C=O.first,M=O.last;C&&M&&(C.devirtualize.push(O),M.destroy.push(O))}}}catch(t){R.e(t)}finally{R.f()}}}},{key:"executePassNodes",value:(e=s()(a.a.mark((function t(e){var n,r,o,u,s,c,f,l,h,d,p,m,v;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=L(this.passNodes.entries()),t.prev=1,n.s();case 3:if((r=n.n()).done){t.next=18;break}if(o=i()(r.value,2),u=o[0],!(s=o[1]).refCount){t.next=16;break}c=L(s.devirtualize);try{for(c.s();!(f=c.n()).done;)f.value.preExecuteDevirtualize(this.engine)}catch(t){c.e(t)}finally{c.f()}l=L(s.destroy);try{for(l.s();!(h=l.n()).done;)h.value.preExecuteDestroy(this.engine)}catch(t){l.e(t)}finally{l.f()}return t.next=12,this.frameGraphPasses[u].execute(this,this.frameGraphPasses[u],e);case 12:d=L(s.devirtualize);try{for(d.s();!(p=d.n()).done;)p.value.postExecuteDevirtualize(this.engine)}catch(t){d.e(t)}finally{d.f()}m=L(s.destroy);try{for(m.s();!(v=m.n()).done;)v.value.postExecuteDestroy(this.engine)}catch(t){m.e(t)}finally{m.f()}case 16:t.next=3;break;case 18:t.next=23;break;case 20:t.prev=20,t.t0=t.catch(1),n.e(t.t0);case 23:return t.prev=23,n.f(),t.finish(23);case 26:this.reset();case 27:case"end":return t.stop()}}),t,this,[[1,20,23,26]])}))),function(t){return e.apply(this,arguments)})},{key:"reset",value:function(){this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[]}},{key:"getResourceNode",value:function(t){return this.resourceNodes[t.index]}},{key:"createResourceNode",value:function(t){var e=new D;e.resource=t,e.version=t.version,this.resourceNodes.push(e);var n=new b;return n.index=this.resourceNodes.length-1,n}},{key:"createTexture",value:function(t,e,n){var r=new k;return r.name=e,r.descriptor=n,this.createResourceNode(r)}},{key:"createRenderTarget",value:function(t,e,n){var r=new k;return r.name=e,r.descriptor=n,this.createResourceNode(r)}},{key:"present",value:function(t){this.addPass("Present",(function(e,n){n.read(t),n.hasSideEffect=!0}),s()(a.a.mark((function t(){return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))))}}]),t}(),P=v()(N.prototype,"engine",[M],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),I=N))||I)},function(t,e,n){"use strict";n.d(e,"a",(function(){return g}));var r=n(2),i=n.n(r),o=n(4),a=n.n(o),u=n(5),s=n.n(u),c=n(3);var f,l=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;function h(t){var e={};return{content:t=t.replace(l,(function(t,n,r){var i=r.split(":"),o=i[0].trim(),a="";switch(i.length>1&&(a=i[1].trim()),n){case"bool":a="true"===a;break;case"float":case"int":a=Number(a);break;case"vec2":case"vec3":case"vec4":case"ivec2":case"ivec3":case"ivec4":case"mat2":case"mat3":case"mat4":a=a?a.replace("[","").replace("]","").split(",").reduce((function(t,e){return t.push(Number(e.trim())),t}),[]):new Array(function(t){var e=0;switch(t){case"vec2":case"ivec2":e=2;break;case"vec3":case"ivec3":e=3;break;case"vec4":case"ivec4":case"mat2":e=4;break;case"mat3":e=9;break;case"mat4":e=16}return e}(n)).fill(0)}return e[o]=a,"uniform ".concat(n," ").concat(o,";\n")})),uniforms:e}}function d(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?d(Object(n),!0).forEach((function(e){i()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var m=/precision\s+(high|low|medium)p\s+float/,v=/#pragma include (["^+"]?["\ "[a-zA-Z_0-9](.*)"]*?)/g,g=Object(c.injectable)()(f=function(){function t(){a()(this,t),this.moduleCache={},this.rawContentCache={}}return s()(t,[{key:"registerBuiltinModules",value:function(){this.destroy(),this.registerModule("picking",{vs:"attribute vec3 a_PickingColor;\nvarying vec4 v_PickingResult;\n\nuniform vec3 u_PickingColor : [0, 0, 0];\nuniform vec4 u_HighlightColor : [0, 0, 0, 0];\nuniform float u_PickingStage : 0.0;\nuniform float u_PickingThreshold : 1.0;\nuniform float u_PickingBuffer: 0.0;\n\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n abs(vertexColor.r - u_PickingColor.r) < u_PickingThreshold &&\n abs(vertexColor.g - u_PickingColor.g) < u_PickingThreshold &&\n abs(vertexColor.b - u_PickingColor.b) < u_PickingThreshold;\n}\n\nvoid setPickingColor(vec3 pickingColor) {\n // compares only in highlight stage\n v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\n\nfloat setPickingSize(float x) {\n return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;\n}",fs:"varying vec4 v_PickingResult;\nuniform vec4 u_HighlightColor : [0, 0, 0, 0];\nuniform float u_PickingStage : 0.0;\n\n#define PICKING_ENCODE 1.0\n#define PICKING_HIGHLIGHT 2.0\n#define COLOR_SCALE 1. / 255.\n\n/*\n * Returns highlight color if this item is selected.\n */\nvec4 filterHighlightColor(vec4 color) {\n bool selected = bool(v_PickingResult.a);\n\n if (selected) {\n vec4 highLightColor = u_HighlightColor * COLOR_SCALE;\n\n float highLightAlpha = highLightColor.a;\n float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));\n\n vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);\n return vec4(resultRGB, color.a);\n } else {\n return color;\n }\n}\n\n/*\n * Returns picking color if picking enabled else unmodified argument.\n */\nvec4 filterPickingColor(vec4 color) {\n vec3 pickingColor = v_PickingResult.rgb;\n if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {\n discard;\n }\n return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;\n}\n\n/*\n * Returns picking color if picking is enabled if not\n * highlight color if this item is selected, otherwise unmodified argument.\n */\nvec4 filterColor(vec4 color) {\n return filterPickingColor(filterHighlightColor(color));\n}\n"}),this.registerModule("sdf2d",{vs:"",fs:"/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat sdEquilateralTriangle(vec2 p) {\n float k = sqrt(3.0);\n p.x = abs(p.x) - 1.0;\n p.y = p.y + 1.0/k;\n if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;\n p.x -= clamp( p.x, -2.0, 0.0 );\n return -length(p)*sign(p.y);\n}\n\nfloat sdBox(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);\n}\n\nfloat sdPentagon(vec2 p, float r) {\n vec3 k = vec3(0.809016994,0.587785252,0.726542528);\n p.x = abs(p.x);\n p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);\n p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);\n p -= vec2(clamp(p.x,-r*k.z,r*k.z),r);\n return length(p)*sign(p.y);\n}\n\nfloat sdHexagon(vec2 p, float r) {\n vec3 k = vec3(-0.866025404,0.5,0.577350269);\n p = abs(p);\n p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;\n p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);\n return length(p)*sign(p.y);\n}\n\nfloat sdOctogon(vec2 p, float r) {\n vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );\n p = abs(p);\n p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);\n p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);\n p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);\n return length(p)*sign(p.y);\n}\n\nfloat sdHexagram(vec2 p, float r) {\n vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);\n p = abs(p);\n p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;\n p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;\n p -= vec2(clamp(p.x,r*k.z,r*k.w),r);\n return length(p)*sign(p.y);\n}\n\nfloat sdRhombus(vec2 p, vec2 b) {\n vec2 q = abs(p);\n float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);\n float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );\n return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );\n}\n\nfloat sdVesica(vec2 p, float r, float d) {\n p = abs(p);\n float b = sqrt(r*r-d*d); // can delay this sqrt\n return ((p.y-b)*d>p.x*b)\n ? length(p-vec2(0.0,b))\n : length(p-vec2(-d,0.0))-r;\n}"})}},{key:"registerModule",value:function(t,e){if(!this.rawContentCache[t]){var n=e.vs,r=void 0===n?"":n,i=e.fs,o=void 0===i?"":i,a=e.uniforms,u=h(r),s=u.content,c=u.uniforms,f=h(o),l=f.content,d=f.uniforms;this.rawContentCache[t]={fs:l,uniforms:p(p(p({},c),d),a),vs:s}}}},{key:"destroy",value:function(){this.moduleCache={},this.rawContentCache={}}},{key:"getModule",value:function(t){var e=this;if(this.moduleCache[t])return this.moduleCache[t];var n,r=this.rawContentCache[t].vs||"",i=this.rawContentCache[t].fs||"",o=this.processModule(r,[],"vs"),a=o.content,u=o.includeList,s=this.processModule(i,[],"fs"),c=s.content,f=s.includeList,l=c,h=(n=u.concat(f).concat(t),n.filter((function(t,e,n){return n.indexOf(t)===e}))).reduce((function(t,n){return p(p({},t),e.rawContentCache[n].uniforms)}),{});return m.test(c)||(l="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n#endif\n"+c),this.moduleCache[t]={fs:l.trim(),uniforms:h,vs:a.trim()},this.moduleCache[t]}},{key:"processModule",value:function(t,e,n){var r=this;return{content:t.replace(v,(function(t,i){var o=i.split(" ")[0].replace(/"/g,"");if(e.indexOf(o)>-1)return"";var a=r.rawContentCache[o][n];return e.push(o),r.processModule(a||"",e,n).content})),includeList:e}}}]),t}())||f},function(t,e,n){"use strict";n.d(e,"a",(function(){return R}));var r=n(2),i=n.n(r),o=n(4),a=n.n(o),u=n(5),s=n.n(u),c=n(13),f=n.n(c),l=n(15),h=n.n(l),d=n(16),p=n.n(d),m=n(12),v=n.n(m),g=n(0),y=n(17),b=n(26),_=n.n(b),E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E["[object Arguments]"]=E["[object Array]"]=E["[object ArrayBuffer]"]=E["[object Boolean]"]=E["[object DataView]"]=E["[object Date]"]=E["[object Error]"]=E["[object Function]"]=E["[object Map]"]=E["[object Number]"]=E["[object Object]"]=E["[object RegExp]"]=E["[object Set]"]=E["[object String]"]=E["[object WeakMap]"]=!1;var w=Object.prototype.toString;var x=function(t){return function(t){return!!t&&"object"===_()(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!!E[w.call(t)]};function T(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function A(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?T(Object(n),!0).forEach((function(e){i()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function S(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=v()(t);if(e){var i=v()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return p()(this,n)}}var R=function(t){h()(n,t);var e=S(n);function n(t){var r;return a()(this,n),(r=e.call(this,t)).dirty=!0,r.attributes=[],r.indices=void 0,r.indicesBuffer=void 0,r.vertexCount=0,r.maxInstancedCount=void 0,r.aabb=void 0,r.entity=void 0,Object.assign(f()(r),t),r}return s()(n,[{key:"setAttribute",value:function(t,e,n,r){var i=this.attributes.find((function(e){return e.name===t}));return i?(i.data=e,i.dirty=!0):this.attributes.push(A(A({dirty:!0,name:t,data:e},n),{},{bufferGetter:r})),this.dirty=!0,this}},{key:"setIndex",value:function(t){return this.indices=new Uint32Array(t.buffer?t.buffer:t),this.dirty=!0,this}},{key:"applyMatrix",value:function(t){var e=this.attributes.find((function(t){return"position"===t.name})),n=this.attributes.find((function(t){return"normal"===t.name}));if(e&&(e.dirty=!0,e.data&&e.data.length))for(var r=0;r<e.data.length;r+=3){var i=g.e.fromValues(e.data[r],e.data[r+1],e.data[r+2],1);g.e.transformMat4(i,i,t),x(e.data)?e.data.set([i[0],i[1],i[2]],r):(e.data[r]=i[0],e.data[r+1]=i[1],e.data[r+2]=i[2])}if(n){var o=g.a.normalFromMat4(g.a.create(),t);if(n.data&&n.data.length)for(var a=0;a<n.data.length;a+=3){var u=g.d.fromValues(n.data[a],n.data[a+1],n.data[a+2]);g.d.transformMat3(u,u,o),g.d.normalize(u,u),x(n.data)?n.data.set([u[0],u[1],u[2]],a):(n.data[a]=u[0],n.data[a+1]=u[1],n.data[a+2]=u[2])}}}}]),n}(y.a)},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return a}));var r=n(40),i=n.n(r);n(0);function o(t,e){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}function a(t){var e=i()(t,3);return e[0]+256*e[1]+65536*e[2]-1}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(14),i=n(46),o=n(24),a=n(113),u=n(114),s=r.Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var e=i("Symbol");return o(e)&&a(e.prototype,s(t))}},function(t,e,n){var r=n(115),i=n(22);t.exports=!!Object.getOwnPropertySymbols&&!i((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},function(t,e,n){var r=n(14),i=n(89),o=r["__core-js_shared__"]||i("__core-js_shared__",{});t.exports=o},function(t,e,n){var r=n(14),i=Object.defineProperty;t.exports=function(t,e){try{i(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},function(t,e,n){var r=n(21),i=0,o=Math.random(),a=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++i+o,36)}},function(t,e,n){var r=n(14),i=n(43),o=r.document,a=i(o)&&i(o.createElement);t.exports=function(t){return a?o.createElement(t):{}}},function(t,e,n){var r=n(21),i=n(24),o=n(88),a=r(Function.toString);i(o.inspectSource)||(o.inspectSource=function(t){return a(t)}),t.exports=o.inspectSource},function(t,e,n){var r,i,o,a=n(185),u=n(14),s=n(21),c=n(43),f=n(52),l=n(32),h=n(88),d=n(94),p=n(62),m=u.TypeError,v=u.WeakMap;if(a||h.state){var g=h.state||(h.state=new v),y=s(g.get),b=s(g.has),_=s(g.set);r=function(t,e){if(b(g,t))throw new m("Object already initialized");return e.facade=t,_(g,t,e),e},i=function(t){return y(g,t)||{}},o=function(t){return b(g,t)}}else{var E=d("state");p[E]=!0,r=function(t,e){if(l(t,E))throw new m("Object already initialized");return e.facade=t,f(t,E,e),e},i=function(t){return l(t,E)?t[E]:{}},o=function(t){return l(t,E)}}t.exports={set:r,get:i,has:o,enforce:function(t){return o(t)?i(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!c(e)||(n=i(e)).type!==t)throw m("Incompatible receiver, "+t+" required");return n}}}},function(t,e,n){var r=n(60),i=n(90),o=r("keys");t.exports=function(t){return o[t]||(o[t]=i(t))}},function(t,e,n){var r=n(121),i=n(97).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},function(t,e,n){var r=n(63),i=Math.max,o=Math.min;t.exports=function(t,e){var n=r(t);return n<0?i(n+e,0):o(n,e)}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e,n){"use strict";var r,i,o=n(42),a=n(21),u=n(65),s=n(190),c=n(191),f=n(60),l=n(101),h=n(93).get,d=n(193),p=n(194),m=f("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,g=v,y=a("".charAt),b=a("".indexOf),_=a("".replace),E=a("".slice),w=(i=/b*/g,o(v,r=/a/,"a"),o(v,i,"a"),0!==r.lastIndex||0!==i.lastIndex),x=c.BROKEN_CARET,T=void 0!==/()??/.exec("")[1];(w||T||x||d||p)&&(g=function(t){var e,n,r,i,a,c,f,d=this,p=h(d),A=u(t),S=p.raw;if(S)return S.lastIndex=d.lastIndex,e=o(g,S,A),d.lastIndex=S.lastIndex,e;var R=p.groups,O=x&&d.sticky,C=o(s,d),M=d.source,I=0,N=A;if(O&&(C=_(C,"y",""),-1===b(C,"g")&&(C+="g"),N=E(A,d.lastIndex),d.lastIndex>0&&(!d.multiline||d.multiline&&"\n"!==y(A,d.lastIndex-1))&&(M="(?: "+M+")",N=" "+N,I++),n=new RegExp("^(?:"+M+")",C)),T&&(n=new RegExp("^"+M+"$(?!\\s)",C)),w&&(r=d.lastIndex),i=o(v,O?n:d,N),O?i?(i.input=E(i.input,I),i[0]=E(i[0],I),i.index=d.lastIndex,d.lastIndex+=i[0].length):d.lastIndex=0:w&&i&&(d.lastIndex=d.global?i.index+i[0].length:r),T&&i&&i.length>1&&o(m,i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&R)for(i.groups=c=l(null),a=0;a<R.length;a++)c[(f=R[a])[0]]=i[f[1]];return i}),t.exports=g},function(t,e,n){var r=n(14),i=n(100),o=n(24),a=n(50),u=n(31)("toStringTag"),s=r.Object,c="Arguments"==a(function(){return arguments}());t.exports=i?a:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=s(t),u))?n:c?a(e):"Object"==(r=a(e))&&o(e.callee)?"Arguments":r}},function(t,e,n){var r={};r[n(31)("toStringTag")]="z",t.exports="[object z]"===String(r)},function(t,e,n){var r,i=n(38),o=n(124),a=n(97),u=n(62),s=n(192),c=n(91),f=n(94),l=f("IE_PROTO"),h=function(){},d=function(t){return"<script>"+t+"<\/script>"},p=function(t){t.write(d("")),t.close();var e=t.parentWindow.Object;return t=null,e},m=function(){try{r=new ActiveXObject("htmlfile")}catch(t){}var t,e;m="undefined"!=typeof document?document.domain&&r?p(r):((e=c("iframe")).style.display="none",s.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(d("document.F=Object")),t.close(),t.F):p(r);for(var n=a.length;n--;)delete m.prototype[a[n]];return m()};u[l]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(h.prototype=i(t),n=new h,h.prototype=null,n[l]=t):n=m(),void 0===e?n:o(n,e)}},function(t,e,n){var r=n(121),i=n(97);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e,n){var r=n(22),i=n(31),o=n(115),a=i("species");t.exports=function(t){return o>=51||!r((function(){var e=[];return(e.constructor={})[a]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},function(t,e,n){"use strict";var r=n(59),i=n(34),o=n(57);t.exports=function(t,e,n){var a=r(e);a in t?i.f(t,a,o(0,n)):t[a]=n}},function(t,e,n){"use strict";var r=n(28);t.exports=i;function i(t){this._isDirected=!r.has(t,"directed")||t.directed,this._isMultigraph=!!r.has(t,"multigraph")&&t.multigraph,this._isCompound=!!r.has(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function o(t,e){t[e]?t[e]++:t[e]=1}function a(t,e){--t[e]||delete t[e]}function u(t,e,n,i){var o=""+e,a=""+n;if(!t&&o>a){var u=o;o=a,a=u}return o+""+a+""+(r.isUndefined(i)?"\0":i)}function s(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var u={v:i,w:o};return r&&(u.name=r),u}function c(t,e){return u(t,e.v,e.w,e.name)}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(t){return this._label=t,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(t){return r.isFunction(t)||(t=r.constant(t)),this._defaultNodeLabelFn=t,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){return r.filter(this.nodes(),r.bind((function(t){return r.isEmpty(this._in[t])}),this))},i.prototype.sinks=function(){return r.filter(this.nodes(),r.bind((function(t){return r.isEmpty(this._out[t])}),this))},i.prototype.setNodes=function(t,e){var n=arguments;return r.each(t,r.bind((function(t){n.length>1?this.setNode(t,e):this.setNode(t)}),this)),this},i.prototype.setNode=function(t,e){return r.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},i.prototype.node=function(t){return this._nodes[t]},i.prototype.hasNode=function(t){return r.has(this._nodes,t)},i.prototype.removeNode=function(t){var e=this;if(r.has(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],r.each(this.children(t),r.bind((function(t){this.setParent(t)}),this)),delete this._children[t]),r.each(r.keys(this._in[t]),n),delete this._in[t],delete this._preds[t],r.each(r.keys(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},i.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(e))e="\0";else{for(var n=e+="";!r.isUndefined(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},i.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},i.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if("\0"!==e)return e}},i.prototype.children=function(t){if(r.isUndefined(t)&&(t="\0"),this._isCompound){var e=this._children[t];if(e)return r.keys(e)}else{if("\0"===t)return this.nodes();if(this.hasNode(t))return[]}},i.prototype.predecessors=function(t){var e=this._preds[t];if(e)return r.keys(e)},i.prototype.successors=function(t){var e=this._sucs[t];if(e)return r.keys(e)},i.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return r.union(e,this.successors(t))},i.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},i.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),r.each(this._nodes,r.bind((function(n,r){t(r)&&e.setNode(r,n)}),this)),r.each(this._edgeObjs,r.bind((function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,this.edge(t))}),this));var n=this,i={};return this._isCompound&&r.each(e.nodes(),(function(t){e.setParent(t,function t(r){var o=n.parent(r);return void 0===o||e.hasNode(o)?(i[r]=o,o):o in i?i[o]:t(o)}(t))})),e},i.prototype.setDefaultEdgeLabel=function(t){return r.isFunction(t)||(t=r.constant(t)),this._defaultEdgeLabelFn=t,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(t,e){var n=this,i=arguments;return r.reduce(t,(function(t,r){return i.length>1?n.setEdge(t,r,e):n.setEdge(t,r),r})),this},i.prototype.setEdge=function(){var t,e,n,i,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(t=c.v,e=c.w,n=c.name,2===arguments.length&&(i=arguments[1],a=!0)):(t=c,e=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),t=""+t,e=""+e,r.isUndefined(n)||(n=""+n);var f=u(this._isDirected,t,e,n);if(r.has(this._edgeLabels,f))return a&&(this._edgeLabels[f]=i),this;if(!r.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[f]=a?i:this._defaultEdgeLabelFn(t,e,n);var l=s(this._isDirected,t,e,n);return t=l.v,e=l.w,Object.freeze(l),this._edgeObjs[f]=l,o(this._preds[e],t),o(this._sucs[t],e),this._in[e][f]=l,this._out[t][f]=l,this._edgeCount++,this},i.prototype.edge=function(t,e,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,t,e,n);return this._edgeLabels[r]},i.prototype.hasEdge=function(t,e,n){var i=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,t,e,n);return r.has(this._edgeLabels,i)},i.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[e],t),a(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},i.prototype.inEdges=function(t,e){var n=this._in[t];if(n){var i=r.values(n);return e?r.filter(i,(function(t){return t.v===e})):i}},i.prototype.outEdges=function(t,e){var n=this._out[t];if(n){var i=r.values(n);return e?r.filter(i,(function(t){return t.w===e})):i}},i.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingOnSyntax=void 0;var r=n(107),i=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new r.BindingWhenSyntax(this._binding)},t}();e.BindingOnSyntax=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingWhenSyntax=void 0;var r=n(106),i=n(142),o=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=i.namedConstraint(t),new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t.target&&!t.target.isNamed()&&!t.target.isTagged()},new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=i.taggedConstraint(t)(e),new r.BindingOnSyntax(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return i.typeConstraint(t)(e.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return i.namedConstraint(t)(e.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(n){return i.taggedConstraint(t)(e)(n.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,i.typeConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,i.typeConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,i.namedConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,i.namedConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(n){return i.traverseAncerstors(n,i.taggedConstraint(t)(e))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(n){return!i.traverseAncerstors(n,i.taggedConstraint(t)(e))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,t)},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,t)},new r.BindingOnSyntax(this._binding)},t}();e.BindingWhenSyntax=o},function(t,e){t.exports=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}},,function(t,e,n){"use strict";var r=n(27),i=n(98);r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},function(t,e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,o=i&&!r.call({1:2},1);e.f=o?function(t){var e=i(this,t);return!!e&&e.enumerable}:r},function(t,e,n){var r=n(14),i=n(21),o=n(22),a=n(50),u=r.Object,s=i("".split);t.exports=o((function(){return!u("z").propertyIsEnumerable(0)}))?function(t){return"String"==a(t)?s(t,""):u(t)}:u},function(t,e,n){var r=n(21);t.exports=r({}.isPrototypeOf)},function(t,e,n){var r=n(87);t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,e,n){var r,i,o=n(14),a=n(182),u=o.process,s=o.Deno,c=u&&u.versions||s&&s.version,f=c&&c.v8;f&&(i=(r=f.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(i=+r[1]),t.exports=i},function(t,e,n){var r=n(117);t.exports=function(t,e){var n=t[e];return null==n?void 0:r(n)}},function(t,e,n){var r=n(14),i=n(24),o=n(183),a=r.TypeError;t.exports=function(t){if(i(t))return t;throw a(o(t)+" is not a function")}},function(t,e){t.exports=!1},function(t,e,n){var r=n(29),i=n(22),o=n(91);t.exports=!r&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var r=n(46),i=n(21),o=n(95),a=n(123),u=n(38),s=i([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=o.f(u(t)),n=a.f;return n?s(e,n(t)):e}},function(t,e,n){var r=n(21),i=n(32),o=n(37),a=n(188).indexOf,u=n(62),s=r([].push);t.exports=function(t,e){var n,r=o(t),c=0,f=[];for(n in r)!i(u,n)&&i(r,n)&&s(f,n);for(;e.length>c;)i(r,n=e[c++])&&(~a(f,n)||s(f,n));return f}},function(t,e,n){var r=n(63),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){var r=n(29),i=n(34),o=n(38),a=n(37),u=n(102);t.exports=r?Object.defineProperties:function(t,e){o(t);for(var n,r=a(e),s=u(e),c=s.length,f=0;c>f;)i.f(t,n=s[f++],r[n]);return t}},function(t,e,n){var r=n(202);t.exports=function(t,e){return new(r(t))(0===e?0:e)}},function(t,e,n){var r=n(50);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){"use strict";var r=n(53).forEach,i=n(205)("forEach");t.exports=i?[].forEach:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,e,n){var r=n(31);e.f=r},function(t,e,n){var r=n(28),i=n(130);t.exports=function(t,e,n,r){return function(t,e,n,r){var o,a,u={},s=new i,c=function(t){var e=t.v!==o?t.v:t.w,r=u[e],i=n(t),c=a.distance+i;if(i<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+i);c<r.distance&&(r.distance=c,r.predecessor=o,s.decrease(e,c))};t.nodes().forEach((function(t){var n=t===e?0:Number.POSITIVE_INFINITY;u[t]={distance:n},s.add(t,n)}));for(;s.size()>0&&(o=s.removeMin(),(a=u[o]).distance!==Number.POSITIVE_INFINITY);)r(o).forEach(c);return u}(t,String(e),n||o,r||function(e){return t.outEdges(e)})};var o=r.constant(1)},function(t,e,n){var r=n(28);function i(){this._arr=[],this._keyIndices={}}t.exports=i,i.prototype.size=function(){return this._arr.length},i.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},i.prototype.has=function(t){return r.has(this._keyIndices,t)},i.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},i.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},i.prototype.add=function(t,e){var n=this._keyIndices;if(t=String(t),!r.has(n,t)){var i=this._arr,o=i.length;return n[t]=o,i.push({key:t,priority:e}),this._decrease(o),!0}return!1},i.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},i.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},i.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))},i.prototype._decrease=function(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e},i.prototype._swap=function(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e}},function(t,e,n){var r=n(28);t.exports=function(t){var e=0,n=[],i={},o=[];return t.nodes().forEach((function(a){r.has(i,a)||function a(u){var s=i[u]={onStack:!0,lowlink:e,index:e++};if(n.push(u),t.successors(u).forEach((function(t){r.has(i,t)?i[t].onStack&&(s.lowlink=Math.min(s.lowlink,i[t].index)):(a(t),s.lowlink=Math.min(s.lowlink,i[t].lowlink))})),s.lowlink===s.index){var c,f=[];do{c=n.pop(),i[c].onStack=!1,f.push(c)}while(u!==c);o.push(f)}}(a)})),o}},function(t,e,n){var r=n(28);function i(t){var e={},n={},i=[];if(r.each(t.sinks(),(function a(u){if(r.has(n,u))throw new o;r.has(e,u)||(n[u]=!0,e[u]=!0,r.each(t.predecessors(u),a),delete n[u],i.push(u))})),r.size(e)!==t.nodeCount())throw new o;return i}function o(){}t.exports=i,i.CycleException=o},function(t,e,n){var r=n(28);t.exports=function(t,e,n){r.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),o=[],a={};return r.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);!function t(e,n,i,o,a,u){r.has(o,n)||(o[n]=!0,i||u.push(n),r.each(a(n),(function(n){t(e,n,i,o,a,u)})),i&&u.push(n))}(t,e,"post"===n,a,i,o)})),o}},function(t,e,n){(function(t,e){
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var n;!function(n){!function(r){var i="object"==typeof e?e:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),o=a(n);function a(t,e){return function(n,r){"function"!=typeof t[n]&&Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0===i.Reflect?i.Reflect=n:o=a(i.Reflect,o),function(e){var n=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,i=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",a="function"==typeof Object.create,u={__proto__:[]}instanceof Array,s=!a&&!u,c={create:a?function(){return P(Object.create(null))}:u?function(){return P({__proto__:null})}:function(){return P({})},has:s?function(t,e){return n.call(t,e)}:function(t,e){return e in t},get:s?function(t,e){return n.call(t,e)?t[e]:void 0}:function(t,e){return t[e]}},f=Object.getPrototypeOf(Function),l="object"==typeof t&&t.env&&"true"===t.env.REFLECT_METADATA_USE_MAP_POLYFILL,h=l||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[o]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var n=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i<r;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,r)},e.prototype.values=function(){return new n(this._keys,this._values,i)},e.prototype.entries=function(){return new n(this._keys,this._values,a)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[o]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function i(t,e){return e}function a(t,e){return[t,e]}}():Map,d=l||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){function t(){this._map=new h}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[o]=function(){return this.keys()},t}():Set,p=new(l||"function"!=typeof WeakMap?function(){var t=c.create(),e=r();return function(){function t(){this._key=r()}return t.prototype.has=function(t){var e=i(t,!1);return void 0!==e&&c.has(e,this._key)},t.prototype.get=function(t){var e=i(t,!1);return void 0!==e?c.get(e,this._key):void 0},t.prototype.set=function(t,e){return i(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=i(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=r()},t}();function r(){var e;do{e="@@WeakMap@@"+a()}while(c.has(t,e));return t[e]=!0,e}function i(t,r){if(!n.call(t,e)){if(!r)return;Object.defineProperty(t,e,{value:c.create()})}return t[e]}function o(t,e){for(var n=0;n<e;++n)t[n]=255*Math.random()|0;return t}function a(){var t,e=(t=16,"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):o(new Uint8Array(t),t):o(new Array(t),t));e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<16;++r){var i=e[r];4!==r&&6!==r&&8!==r||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}():WeakMap);function m(t,e,n){var r=p.get(t);if(E(r)){if(!n)return;r=new h,p.set(t,r)}var i=r.get(e);if(E(i)){if(!n)return;i=new h,r.set(e,i)}return i}function v(t,e,n){var r=m(e,n,!1);return!E(r)&&!!r.has(t)}function g(t,e,n){var r=m(e,n,!1);if(!E(r))return r.get(t)}function y(t,e,n,r){m(n,r,!0).set(t,e)}function b(t,e){var n=[],r=m(t,e,!1);if(E(r))return n;for(var i=function(t){var e=C(t,o);if(!R(e))throw new TypeError;var n=e.call(t);if(!x(n))throw new TypeError;return n}(r.keys()),a=0;;){var u=M(i);if(!u)return n.length=a,n;var s=u.value;try{n[a]=s}catch(t){try{I(i)}finally{throw t}}a++}}function _(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function E(t){return void 0===t}function w(t){return null===t}function x(t){return"object"==typeof t?null!==t:"function"==typeof t}function T(t,e){switch(_(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n=3===e?"string":5===e?"number":"default",r=C(t,i);if(void 0!==r){var o=r.call(t,n);if(x(o))throw new TypeError;return o}return function(t,e){if("string"===e){var n=t.toString;if(R(n))if(!x(i=n.call(t)))return i;if(R(r=t.valueOf))if(!x(i=r.call(t)))return i}else{var r;if(R(r=t.valueOf))if(!x(i=r.call(t)))return i;var i,o=t.toString;if(R(o))if(!x(i=o.call(t)))return i}throw new TypeError}(t,"default"===n?"number":n)}function A(t){var e=T(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function S(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function R(t){return"function"==typeof t}function O(t){return"function"==typeof t}function C(t,e){var n=t[e];if(null!=n){if(!R(n))throw new TypeError;return n}}function M(t){var e=t.next();return!e.done&&e}function I(t){var e=t.return;e&&e.call(t)}function N(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===f)return e;if(e!==f)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var i=r.constructor;return"function"!=typeof i||i===t?e:i}function P(t){return t.__=void 0,delete t.__,t}e("decorate",(function(t,e,n,r){if(E(n)){if(!S(t))throw new TypeError;if(!O(e))throw new TypeError;return function(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!E(r)&&!w(r)){if(!O(r))throw new TypeError;e=r}}return e}(t,e)}if(!S(t))throw new TypeError;if(!x(e))throw new TypeError;if(!x(r)&&!E(r)&&!w(r))throw new TypeError;return w(r)&&(r=void 0),function(t,e,n,r){for(var i=t.length-1;i>=0;--i){var o=(0,t[i])(e,n,r);if(!E(o)&&!w(o)){if(!x(o))throw new TypeError;r=o}}return r}(t,e,n=A(n),r)})),e("metadata",(function(t,e){return function(n,r){if(!x(n))throw new TypeError;if(!E(r)&&!function(t){switch(_(t)){case 3:case 4:return!0;default:return!1}}(r))throw new TypeError;y(t,e,n,r)}})),e("defineMetadata",(function(t,e,n,r){if(!x(n))throw new TypeError;return E(r)||(r=A(r)),y(t,e,n,r)})),e("hasMetadata",(function(t,e,n){if(!x(e))throw new TypeError;return E(n)||(n=A(n)),function t(e,n,r){if(v(e,n,r))return!0;var i=N(n);return!w(i)&&t(e,i,r)}(t,e,n)})),e("hasOwnMetadata",(function(t,e,n){if(!x(e))throw new TypeError;return E(n)||(n=A(n)),v(t,e,n)})),e("getMetadata",(function(t,e,n){if(!x(e))throw new TypeError;return E(n)||(n=A(n)),function t(e,n,r){if(v(e,n,r))return g(e,n,r);var i=N(n);return w(i)?void 0:t(e,i,r)}(t,e,n)})),e("getOwnMetadata",(function(t,e,n){if(!x(e))throw new TypeError;return E(n)||(n=A(n)),g(t,e,n)})),e("getMetadataKeys",(function(t,e){if(!x(t))throw new TypeError;return E(e)||(e=A(e)),function t(e,n){var r=b(e,n),i=N(e);if(null===i)return r;var o=t(i,n);if(o.length<=0)return r;if(r.length<=0)return o;for(var a=new d,u=[],s=0,c=r;s<c.length;s++){var f=c[s];a.has(f)||(a.add(f),u.push(f))}for(var l=0,h=o;l<h.length;l++){f=h[l];a.has(f)||(a.add(f),u.push(f))}return u}(t,e)})),e("getOwnMetadataKeys",(function(t,e){if(!x(t))throw new TypeError;return E(e)||(e=A(e)),b(t,e)})),e("deleteMetadata",(function(t,e,n){if(!x(e))throw new TypeError;E(n)||(n=A(n));var r=m(e,n,!1);if(E(r))return!1;if(!r.delete(t))return!1;if(r.size>0)return!0;var i=p.get(e);return i.delete(n),i.size>0||p.delete(e),!0}))}(o)}()}(n||(n={}))}).call(this,n(242),n(85))},function(t,e,n){var r=n(136);t.exports=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetadataReader=void 0;var r=n(20),i=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(r.PARAM_TYPES,t),userGeneratedMetadata:Reflect.getMetadata(r.TAGGED,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(r.TAGGED_PROP,t)||[]},t}();e.MetadataReader=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isStackOverflowExeption=void 0;var r=n(25);e.isStackOverflowExeption=function(t){return t instanceof RangeError||t.message===r.STACK_OVERFLOW}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.inject=e.LazyServiceIdentifer=void 0;var r=n(25),i=n(20),o=n(30),a=n(39),u=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}();e.LazyServiceIdentifer=u,e.inject=function(t){return function(e,n,u){if(void 0===t)throw new Error(r.UNDEFINED_INJECT_ANNOTATION(e.name));var s=new o.Metadata(i.INJECT_TAG,t);"number"==typeof u?a.tagParameter(e,n,u,s):a.tagProperty(e,n,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Target=void 0;var r=n(20),i=n(44),o=n(30),a=n(254),u=function(){function t(t,e,n,u){this.id=i.id(),this.type=t,this.serviceIdentifier=n,this.name=new a.QueryableString(e||""),this.metadata=new Array;var s=null;"string"==typeof u?s=new o.Metadata(r.NAMED_TAG,u):u instanceof o.Metadata&&(s=u),null!==s&&this.metadata.push(s)}return t.prototype.hasTag=function(t){for(var e=0,n=this.metadata;e<n.length;e++){if(n[e].key===t)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(r.MULTI_INJECT_TAG)},t.prototype.matchesArray=function(t){return this.matchesTag(r.MULTI_INJECT_TAG)(t)},t.prototype.isNamed=function(){return this.hasTag(r.NAMED_TAG)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return r.NON_CUSTOM_TAG_KEYS.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(r.OPTIONAL_TAG)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===r.NAMED_TAG}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return r.NON_CUSTOM_TAG_KEYS.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(r.NAMED_TAG)(t)},t.prototype.matchesTag=function(t){var e=this;return function(n){for(var r=0,i=e.metadata;r<i.length;r++){var o=i[r];if(o.key===t&&o.value===n)return!0}return!1}},t}();e.Target=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingWhenOnSyntax=void 0;var r=n(106),i=n(107),o=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new i.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new r.BindingOnSyntax(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingWhenOnSyntax=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.typeConstraint=e.namedConstraint=e.taggedConstraint=e.traverseAncerstors=void 0;var r=n(20),i=n(30),o=function(t,e){var n=t.parentRequest;return null!==n&&(!!e(n)||o(n,e))};e.traverseAncerstors=o;var a=function(t){return function(e){var n=function(n){return null!==n&&null!==n.target&&n.target.matchesTag(t)(e)};return n.metaData=new i.Metadata(t,e),n}};e.taggedConstraint=a;var u=a(r.NAMED_TAG);e.namedConstraint=u;e.typeConstraint=function(t){return function(e){var n=null;if(null!==e){if(n=e.bindings[0],"string"==typeof t)return n.serviceIdentifier===t;var r=e.bindings[0].implementationType;return t===r}return!1}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(47);function o(t){for(var e=new i.a,n=r.d.fromValues(t[0],t[1],t[2]),o=r.d.fromValues(t[0],t[1],t[2]),a=3;a<t.length;){var u=t[a++],s=t[a++],c=t[a++];u<n[0]&&(n[0]=u),s<n[1]&&(n[1]=s),c<n[2]&&(n[2]=c),u>o[0]&&(o[0]=u),s>o[1]&&(o[1]=s),c>o[2]&&(o[2]=c)}return e.setMinMax(n,o),e}},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r="undefined"!=typeof navigator&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent)},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){"use strict";var r;!function(t){t.Normal="normal",t.PostProcessing="post-processing"}(r||(r={}))},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){t.exports=1e-6},function(t,e){t.exports=function(){var t=new Float32Array(2);return t[0]=0,t[1]=0,t}},function(t,e){t.exports=function(t,e,n){return t[0]=e,t[1]=n,t}},function(t,e){t.exports=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}},function(t,e){t.exports=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}},function(t,e){t.exports=function(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}},function(t,e){t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}},function(t,e){t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}},function(t,e){t.exports=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}},function(t,e){t.exports=function(t){var e=t[0],n=t[1];return e*e+n*n}},function(t,e){t.exports=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i);return t}},function(t,e){t.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]}},function(t,e,n){"use strict";n(79),n(80),n(82)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r.a})),n.d(e,"b",(function(){return o.a}));var r=n(47),i=(n(4),n(5),n(0)),o=(i.d.create(),n(36));n(74),i.d.create(),i.d.create(),i.d.create(),i.d.create(),i.d.create()},function(t,e,n){var r=n(228);t.exports={Graph:r.Graph,json:n(232),alg:n(233),version:r.version}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(274);e.default=function(t,e){return void 0===e&&(e=!0),{lazyInject:r.makePropertyInjectDecorator(t,e),lazyInjectNamed:r.makePropertyInjectNamedDecorator(t,e),lazyInjectTagged:r.makePropertyInjectTaggedDecorator(t,e),lazyMultiInject:r.makePropertyMultiInjectDecorator(t,e)}}},function(t,e,n){t.exports=function(){"use strict";var t=function(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array||t instanceof Uint8ClampedArray},e=function(t,e){for(var n=Object.keys(e),r=0;r<n.length;++r)t[n[r]]=e[n[r]];return t};function n(t){var e=new Error("(regl) "+t);throw console.error(e),e}function r(t,e){t||n(e)}function i(t){return t?": "+t:""}function o(t,e){switch(e){case"number":return"number"==typeof t;case"object":return"object"==typeof t;case"string":return"string"==typeof t;case"boolean":return"boolean"==typeof t;case"function":return"function"==typeof t;case"undefined":return void 0===t;case"symbol":return"symbol"==typeof t}}function a(t,e,r){e.indexOf(t)<0&&n("invalid value"+i(r)+". must be one of: "+e)}var u=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function s(t,e){for(t+="";t.length<e;)t=" "+t;return t}function c(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function f(t,e){this.number=t,this.line=e,this.errors=[]}function l(t,e,n){this.file=t,this.line=e,this.message=n}function h(){var t=new Error,e=(t.stack||t).toString(),n=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(e);if(n)return n[1];var r=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(e);return r?r[1]:"unknown"}function d(){var t=new Error,e=(t.stack||t).toString(),n=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(e);if(n)return n[1];var r=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(e);return r?r[1]:"unknown"}function p(t,e){var n,r=t.split("\n"),i=1,o=0,a={unknown:new c,0:new c};a.unknown.name=a[0].name=e||h(),a.unknown.lines.push(new f(0,""));for(var u=0;u<r.length;++u){var s=r[u],l=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(s);if(l)switch(l[1]){case"line":var d=/(\d+)(\s+\d+)?/.exec(l[2]);d&&(i=0|d[1],d[2]&&((o=0|d[2])in a||(a[o]=new c)));break;case"define":var p=/SHADER_NAME(_B64)?\s+(.*)$/.exec(l[2]);p&&(a[o].name=p[1]?(n=p[2],"undefined"!=typeof atob?atob(n):"base64:"+n):p[2])}a[o].lines.push(new f(i++,s))}return Object.keys(a).forEach((function(t){var e=a[t];e.lines.forEach((function(t){e.index[t.number]=t}))})),a}function m(t){t._commandRef=h()}function v(t,e){var r=d();n(t+" in command "+(e||h())+("unknown"===r?"":" called from "+r))}function g(t,e,n,r){o(t,e)||v("invalid parameter type"+i(n)+". expected "+e+", got "+typeof t,r||h())}var y={};function b(t,e){return 32820===t||32819===t||33635===t?2:34042===t?4:y[t]*e}function _(t){return!(t&t-1||!t)}y[5120]=y[5121]=1,y[5122]=y[5123]=y[36193]=y[33635]=y[32819]=y[32820]=2,y[5124]=y[5125]=y[5126]=y[34042]=4;var E=e(r,{optional:function(t){t()},raise:n,commandRaise:v,command:function(t,e,n){t||v(e,n||h())},parameter:function(t,e,r){t in e||n("unknown parameter ("+t+")"+i(r)+". possible values: "+Object.keys(e).join())},commandParameter:function(t,e,n,r){t in e||v("unknown parameter ("+t+")"+i(n)+". possible values: "+Object.keys(e).join(),r||h())},constructor:function(t){Object.keys(t).forEach((function(t){u.indexOf(t)<0&&n('invalid regl constructor argument "'+t+'". must be one of '+u)}))},type:function(t,e,r){o(t,e)||n("invalid parameter type"+i(r)+". expected "+e+", got "+typeof t)},commandType:g,isTypedArray:function(e,r){t(e)||n("invalid parameter type"+i(r)+". must be a typed array")},nni:function(t,e){t>=0&&(0|t)===t||n("invalid parameter type, ("+t+")"+i(e)+". must be a nonnegative integer")},oneOf:a,shaderError:function(t,e,n,i,o){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var a=t.getShaderInfoLog(e),u=i===t.FRAGMENT_SHADER?"fragment":"vertex";g(n,"string",u+" shader source must be a string",o);var c=p(n,o),f=function(t){var e=[];return t.split("\n").forEach((function(t){if(!(t.length<5)){var n=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(t);n?e.push(new l(0|n[1],0|n[2],n[3].trim())):t.length>0&&e.push(new l("unknown",0,t))}})),e}(a);!function(t,e){e.forEach((function(e){var n=t[e.file];if(n){var r=n.index[e.line];if(r)return r.errors.push(e),void(n.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)}))}(c,f),Object.keys(c).forEach((function(t){var e=c[t];if(e.hasErrors){var n=[""],r=[""];i("file number "+t+": "+e.name+"\n","color:red;text-decoration:underline;font-weight:bold"),e.lines.forEach((function(t){if(t.errors.length>0){i(s(t.number,4)+"| ","background-color:yellow; font-weight:bold"),i(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var e=0;t.errors.forEach((function(n){var r=n.message,o=/^\s*'(.*)'\s*:\s*(.*)$/.exec(r);if(o){var a=o[1];switch(r=o[2],a){case"assign":a="="}e=Math.max(t.line.indexOf(a,e),0)}else e=0;i(s("| ",6)),i(s("^^^",e+3)+"\n","font-weight:bold"),i(s("| ",6)),i(r+"\n","font-weight:bold")})),i(s("| ",6)+"\n")}else i(s(t.number,4)+"| "),i(t.line+"\n","color:red")})),"undefined"==typeof document||window.chrome?console.log(n.join("")):(r[0]=n.join("%c"),console.log.apply(console,r))}function i(t,e){n.push(t),r.push(e||"")}})),r.raise("Error compiling "+u+" shader, "+c[0].name)}},linkError:function(t,e,n,i,o){if(!t.getProgramParameter(e,t.LINK_STATUS)){var a=t.getProgramInfoLog(e),u=p(n,o),s='Error linking program with vertex shader, "'+p(i,o)[0].name+'", and fragment shader "'+u[0].name+'"';"undefined"!=typeof document?console.log("%c"+s+"\n%c"+a,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(s+"\n"+a),r.raise(s)}},callSite:d,saveCommandRef:m,saveDrawInfo:function(t,e,n,r){function i(t){return t?r.id(t):0}function o(t,e){Object.keys(e).forEach((function(e){t[r.id(e)]=!0}))}m(t),t._fragId=i(t.static.frag),t._vertId=i(t.static.vert);var a=t._uniformSet={};o(a,e.static),o(a,e.dynamic);var u=t._attributeSet={};o(u,n.static),o(u,n.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic},framebufferFormat:function(t,e,n){t.texture?a(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):a(t.renderbuffer._renderbuffer.format,n,"unsupported renderbuffer format for attachment")},guessCommand:h,texture2D:function(t,e,n){var i,o=e.width,a=e.height,u=e.channels;r(o>0&&o<=n.maxTextureSize&&a>0&&a<=n.maxTextureSize,"invalid texture shape"),33071===t.wrapS&&33071===t.wrapT||r(_(o)&&_(a),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==o&&1!==a&&r(9984!==t.minFilter&&9986!==t.minFilter&&9985!==t.minFilter&&9987!==t.minFilter,"min filter requires mipmap"):(r(_(o)&&_(a),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(o<<1)-1,"missing or incomplete mipmap data")),5126===e.type&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(9728===t.minFilter&&9728===t.magFilter,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var s=e.images;for(i=0;i<16;++i)if(s[i]){var c=o>>i,f=a>>i;r(e.mipmask&1<<i,"missing mipmap data");var l=s[i];if(r(l.width===c&&l.height===f,"invalid shape for mip images"),r(l.format===e.format&&l.internalformat===e.internalformat&&l.type===e.type,"incompatible type for mip image"),l.compressed);else if(l.data){var h=Math.ceil(b(l.type,u)*c/l.unpackAlignment)*l.unpackAlignment;r(l.data.byteLength===h*f,"invalid data for image, buffer size is inconsistent with image format")}else l.element||l.copy}else t.genMipmaps||r(0==(e.mipmask&1<<i),"extra mipmap data");e.compressed&&r(!t.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(t,e,n,i){var o=t.width,a=t.height,u=t.channels;r(o>0&&o<=i.maxTextureSize&&a>0&&a<=i.maxTextureSize,"invalid texture shape"),r(o===a,"cube map must be square"),r(33071===e.wrapS&&33071===e.wrapT,"wrap mode not supported by cube map");for(var s=0;s<n.length;++s){var c=n[s];r(c.width===o&&c.height===a,"inconsistent cube map face shape"),e.genMipmaps&&(r(!c.compressed,"can not generate mipmap for compressed textures"),r(1===c.mipmask,"can not specify mipmaps and generate mipmaps"));for(var f=c.images,l=0;l<16;++l){var h=f[l];if(h){var d=o>>l,p=a>>l;r(c.mipmask&1<<l,"missing mipmap data"),r(h.width===d&&h.height===p,"invalid shape for mip images"),r(h.format===t.format&&h.internalformat===t.internalformat&&h.type===t.type,"incompatible type for mip image"),h.compressed||(h.data?r(h.data.byteLength===d*p*Math.max(b(h.type,u),h.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):h.element||h.copy)}}}}}),w=0;function x(t,e){this.id=w++,this.type=t,this.data=e}function T(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function A(t){return"["+function t(e){if(0===e.length)return[];var n=e.charAt(0),r=e.charAt(e.length-1);if(e.length>1&&n===r&&('"'===n||"'"===n))return['"'+T(e.substr(1,e.length-2))+'"'];var i=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(i)return t(e.substr(0,i.index)).concat(t(i[1])).concat(t(e.substr(i.index+i[0].length)));var o=e.split(".");if(1===o.length)return['"'+T(e)+'"'];for(var a=[],u=0;u<o.length;++u)a=a.concat(t(o[u]));return a}(t).join("][")+"]"}var S={DynamicVariable:x,define:function(t,e){return new x(t,A(e+""))},isDynamic:function(t){return"function"==typeof t&&!t._reglType||t instanceof x},unbox:function t(e,n){return"function"==typeof e?new x(0,e):"number"==typeof e||"boolean"==typeof e?new x(5,e):Array.isArray(e)?new x(6,e.map((e,r)=>t(e,n+"["+r+"]"))):e instanceof x?e:void E(!1,"invalid option type in uniform "+n)},accessor:A},R={next:"function"==typeof requestAnimationFrame?function(t){return requestAnimationFrame(t)}:function(t){return setTimeout(t,16)},cancel:"function"==typeof cancelAnimationFrame?function(t){return cancelAnimationFrame(t)}:clearTimeout},O="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date};function C(t){return"string"==typeof t?t.split():(E(Array.isArray(t),"invalid extension array"),t)}function M(t){return"string"==typeof t?(E("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(t)):t}function I(t){var n,r,i,o,a,u=t||{},s={},c=[],f=[],l="undefined"==typeof window?1:window.devicePixelRatio,h=!1,d=function(t){t&&E.raise(t)},p=function(){};if("string"==typeof u?(E("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),n=document.querySelector(u),E(n,"invalid query string for element")):"object"==typeof u?"string"==typeof(a=u).nodeName&&"function"==typeof a.appendChild&&"function"==typeof a.getBoundingClientRect?n=u:function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(u)?i=(o=u).canvas:(E.constructor(u),"gl"in u?o=u.gl:"canvas"in u?i=M(u.canvas):"container"in u&&(r=M(u.container)),"attributes"in u&&(s=u.attributes,E.type(s,"object","invalid context attributes")),"extensions"in u&&(c=C(u.extensions)),"optionalExtensions"in u&&(f=C(u.optionalExtensions)),"onDone"in u&&(E.type(u.onDone,"function","invalid or missing onDone callback"),d=u.onDone),"profile"in u&&(h=!!u.profile),"pixelRatio"in u&&(l=+u.pixelRatio,E(l>0,"invalid pixel ratio"))):E.raise("invalid arguments to regl"),n&&("canvas"===n.nodeName.toLowerCase()?i=n:r=n),!o){if(!i){E("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var m=function(t,n,r){var i,o=document.createElement("canvas");function a(){var n=window.innerWidth,i=window.innerHeight;if(t!==document.body){var a=t.getBoundingClientRect();n=a.right-a.left,i=a.bottom-a.top}o.width=r*n,o.height=r*i,e(o.style,{width:n+"px",height:i+"px"})}return e(o.style,{border:0,margin:0,padding:0,top:0,left:0}),t.appendChild(o),t===document.body&&(o.style.position="absolute",e(t.style,{margin:0,padding:0})),t!==document.body&&"function"==typeof ResizeObserver?(i=new ResizeObserver((function(){setTimeout(a)}))).observe(t):window.addEventListener("resize",a,!1),a(),{canvas:o,onDestroy:function(){i?i.disconnect():window.removeEventListener("resize",a),t.removeChild(o)}}}(r||document.body,0,l);if(!m)return null;i=m.canvas,p=m.onDestroy}void 0===s.premultipliedAlpha&&(s.premultipliedAlpha=!0),o=function(t,e){function n(n){try{return t.getContext(n,e)}catch(t){return null}}return n("webgl")||n("experimental-webgl")||n("webgl-experimental")}(i,s)}return o?{gl:o,canvas:i,container:r,extensions:c,optionalExtensions:f,pixelRatio:l,profile:h,onDone:d,onDestroy:p}:(p(),d("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function N(t,e){for(var n=Array(t),r=0;r<t;++r)n[r]=e(r);return n}function P(t){var e,n;return e=(t>65535)<<4,e|=n=((t>>>=e)>255)<<3,e|=n=((t>>>=n)>15)<<2,(e|=n=((t>>>=n)>3)<<1)|(t>>>=n)>>1}function k(){var t=N(8,(function(){return[]}));function e(e){var n=function(t){for(var e=16;e<=1<<28;e*=16)if(t<=e)return e;return 0}(e),r=t[P(n)>>2];return r.length>0?r.pop():new ArrayBuffer(n)}function n(e){t[P(e.byteLength)>>2].push(e)}return{alloc:e,free:n,allocType:function(t,n){var r=null;switch(t){case 5120:r=new Int8Array(e(n),0,n);break;case 5121:r=new Uint8Array(e(n),0,n);break;case 5122:r=new Int16Array(e(2*n),0,n);break;case 5123:r=new Uint16Array(e(2*n),0,n);break;case 5124:r=new Int32Array(e(4*n),0,n);break;case 5125:r=new Uint32Array(e(4*n),0,n);break;case 5126:r=new Float32Array(e(4*n),0,n);break;default:return null}return r.length!==n?r.subarray(0,n):r},freeType:function(t){n(t.buffer)}}}var D=k();function L(e){return!!e&&"object"==typeof e&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||t(e.data))}D.zero=k();var j=function(t){return Object.keys(t).map((function(e){return t[e]}))},F={shape:function(t){for(var e=[],n=t;n.length;n=n[0])e.push(n.length);return e},flatten:function(t,e,n,r){var i=1;if(e.length)for(var o=0;o<e.length;++o)i*=e[o];else i=0;var a=r||D.allocType(n,i);switch(e.length){case 0:break;case 1:!function(t,e,n){for(var r=0;r<e;++r)n[r]=t[r]}(t,e[0],a);break;case 2:!function(t,e,n,r){for(var i=0,o=0;o<e;++o)for(var a=t[o],u=0;u<n;++u)r[i++]=a[u]}(t,e[0],e[1],a);break;case 3:B(t,e[0],e[1],e[2],a,0);break;default:!function t(e,n,r,i,o){for(var a=1,u=r+1;u<n.length;++u)a*=n[u];var s=n[r];if(n.length-r==4){var c=n[r+1],f=n[r+2],l=n[r+3];for(u=0;u<s;++u)B(e[u],c,f,l,i,o),o+=a}else for(u=0;u<s;++u)t(e[u],n,r+1,i,o),o+=a}(t,e,0,a,0)}return a}};function B(t,e,n,r,i,o){for(var a=o,u=0;u<e;++u)for(var s=t[u],c=0;c<n;++c)for(var f=s[c],l=0;l<r;++l)i[a++]=f[l]}var U={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},G={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},V={dynamic:35048,stream:35040,static:35044},z=F.flatten,W=F.shape,H=[];function q(t){return 0|U[Object.prototype.toString.call(t)]}function X(t,e){for(var n=0;n<e.length;++n)t[n]=e[n]}function Y(t,e,n,r,i,o,a){for(var u=0,s=0;s<n;++s)for(var c=0;c<r;++c)t[u++]=e[i*s+o*c+a]}H[5120]=1,H[5122]=2,H[5124]=4,H[5121]=1,H[5123]=2,H[5125]=4,H[5126]=4;var K={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Q=new Float32Array(1),$=new Uint32Array(Q.buffer);function Z(t){for(var e=D.allocType(5123,t.length),n=0;n<t.length;++n)if(isNaN(t[n]))e[n]=65535;else if(t[n]===1/0)e[n]=31744;else if(t[n]===-1/0)e[n]=64512;else{Q[0]=t[n];var r=$[0],i=r>>>31<<15,o=(r<<1>>>24)-127,a=r>>13&1023;if(o<-24)e[n]=i;else if(o<-14){var u=-14-o;e[n]=i+(a+1024>>u)}else e[n]=o>15?i+31744:i+(o+15<<10)+a}return e}function J(e){return Array.isArray(e)||t(e)}var tt=function(t){return!(t&t-1||!t)},et=[9984,9986,9985,9987],nt=[0,6409,6410,6407,6408],rt={};function it(t){return"[object "+t+"]"}rt[6409]=rt[6406]=rt[6402]=1,rt[34041]=rt[6410]=2,rt[6407]=rt[35904]=3,rt[6408]=rt[35906]=4;var ot=it("HTMLCanvasElement"),at=it("OffscreenCanvas"),ut=it("CanvasRenderingContext2D"),st=it("ImageBitmap"),ct=it("HTMLImageElement"),ft=it("HTMLVideoElement"),lt=Object.keys(U).concat([ot,at,ut,st,ct,ft]),ht=[];ht[5121]=1,ht[5126]=4,ht[36193]=2,ht[5123]=2,ht[5125]=4;var dt=[];function pt(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function mt(t){return!!Array.isArray(t)&&!(0===t.length||!J(t[0]))}function vt(t){return Object.prototype.toString.call(t)}function gt(t){return vt(t)===ot}function yt(t){return vt(t)===at}function bt(t){if(!t)return!1;var e=vt(t);return lt.indexOf(e)>=0||pt(t)||mt(t)||L(t)}function _t(t){return 0|U[Object.prototype.toString.call(t)]}function Et(t,e){return D.allocType(36193===t.type?5126:t.type,e)}function wt(t,e){36193===t.type?(t.data=Z(e),D.freeType(e)):t.data=e}function xt(t,e,n,r,i,o){var a;if(a=void 0!==dt[t]?dt[t]:rt[t]*ht[e],o&&(a*=6),i){for(var u=0,s=n;s>=1;)u+=a*s*s,s/=2;return u}return a*n*r}function Tt(n,r,i,o,a,u,s){var c={"don't care":4352,"dont care":4352,nice:4354,fast:4353},f={repeat:10497,clamp:33071,mirror:33648},l={nearest:9728,linear:9729},h=e({mipmap:9987,"nearest mipmap nearest":9984,"linear mipmap nearest":9985,"nearest mipmap linear":9986,"linear mipmap linear":9987},l),d={none:0,browser:37444},p={uint8:5121,rgba4:32819,rgb565:33635,"rgb5 a1":32820},m={alpha:6406,luminance:6409,"luminance alpha":6410,rgb:6407,rgba:6408,rgba4:32854,"rgb5 a1":32855,rgb565:36194},v={};r.ext_srgb&&(m.srgb=35904,m.srgba=35906),r.oes_texture_float&&(p.float32=p.float=5126),r.oes_texture_half_float&&(p.float16=p["half float"]=36193),r.webgl_depth_texture&&(e(m,{depth:6402,"depth stencil":34041}),e(p,{uint16:5123,uint32:5125,"depth stencil":34042})),r.webgl_compressed_texture_s3tc&&e(v,{"rgb s3tc dxt1":33776,"rgba s3tc dxt1":33777,"rgba s3tc dxt3":33778,"rgba s3tc dxt5":33779}),r.webgl_compressed_texture_atc&&e(v,{"rgb atc":35986,"rgba atc explicit alpha":35987,"rgba atc interpolated alpha":34798}),r.webgl_compressed_texture_pvrtc&&e(v,{"rgb pvrtc 4bppv1":35840,"rgb pvrtc 2bppv1":35841,"rgba pvrtc 4bppv1":35842,"rgba pvrtc 2bppv1":35843}),r.webgl_compressed_texture_etc1&&(v["rgb etc1"]=36196);var g=Array.prototype.slice.call(n.getParameter(34467));Object.keys(v).forEach((function(t){var e=v[t];g.indexOf(e)>=0&&(m[t]=e)}));var y=Object.keys(m);i.textureFormats=y;var b=[];Object.keys(m).forEach((function(t){var e=m[t];b[e]=t}));var _=[];Object.keys(p).forEach((function(t){var e=p[t];_[e]=t}));var w=[];Object.keys(l).forEach((function(t){w[l[t]]=t}));var x=[];Object.keys(h).forEach((function(t){var e=h[t];x[e]=t}));var T=[];Object.keys(f).forEach((function(t){T[f[t]]=t}));var A=y.reduce((function(t,e){var n=m[e];return 6409===n||6406===n||6409===n||6410===n||6402===n||34041===n||r.ext_srgb&&(35904===n||35906===n)?t[n]=n:32855===n||e.indexOf("rgba")>=0?t[n]=6408:t[n]=6407,t}),{});function S(){this.internalformat=6408,this.format=6408,this.type=5121,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=37444,this.width=0,this.height=0,this.channels=0}function R(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function O(t,e){if("object"==typeof e&&e){if("premultiplyAlpha"in e&&(E.type(e.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=e.premultiplyAlpha),"flipY"in e&&(E.type(e.flipY,"boolean","invalid texture flip"),t.flipY=e.flipY),"alignment"in e&&(E.oneOf(e.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=e.alignment),"colorSpace"in e&&(E.parameter(e.colorSpace,d,"invalid colorSpace"),t.colorSpace=d[e.colorSpace]),"type"in e){var n=e.type;E(r.oes_texture_float||!("float"===n||"float32"===n),"you must enable the OES_texture_float extension in order to use floating point textures."),E(r.oes_texture_half_float||!("half float"===n||"float16"===n),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),E(r.webgl_depth_texture||!("uint16"===n||"uint32"===n||"depth stencil"===n),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),E.parameter(n,p,"invalid texture type"),t.type=p[n]}var o=t.width,a=t.height,u=t.channels,s=!1;"shape"in e?(E(Array.isArray(e.shape)&&e.shape.length>=2,"shape must be an array"),o=e.shape[0],a=e.shape[1],3===e.shape.length&&(u=e.shape[2],E(u>0&&u<=4,"invalid number of channels"),s=!0),E(o>=0&&o<=i.maxTextureSize,"invalid width"),E(a>=0&&a<=i.maxTextureSize,"invalid height")):("radius"in e&&(o=a=e.radius,E(o>=0&&o<=i.maxTextureSize,"invalid radius")),"width"in e&&(o=e.width,E(o>=0&&o<=i.maxTextureSize,"invalid width")),"height"in e&&(a=e.height,E(a>=0&&a<=i.maxTextureSize,"invalid height")),"channels"in e&&(u=e.channels,E(u>0&&u<=4,"invalid number of channels"),s=!0)),t.width=0|o,t.height=0|a,t.channels=0|u;var c=!1;if("format"in e){var f=e.format;E(r.webgl_depth_texture||!("depth"===f||"depth stencil"===f),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),E.parameter(f,m,"invalid texture format");var l=t.internalformat=m[f];t.format=A[l],f in p&&("type"in e||(t.type=p[f])),f in v&&(t.compressed=!0),c=!0}!s&&c?t.channels=rt[t.format]:s&&!c?t.channels!==nt[t.format]&&(t.format=t.internalformat=nt[t.channels]):c&&s&&E(t.channels===rt[t.format],"number of channels inconsistent with specified format")}}function C(t){n.pixelStorei(37440,t.flipY),n.pixelStorei(37441,t.premultiplyAlpha),n.pixelStorei(37443,t.colorSpace),n.pixelStorei(3317,t.unpackAlignment)}function M(){S.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function I(e,n){var r=null;if(bt(n)?r=n:n&&(E.type(n,"object","invalid pixel data type"),O(e,n),"x"in n&&(e.xOffset=0|n.x),"y"in n&&(e.yOffset=0|n.y),bt(n.data)&&(r=n.data)),E(!e.compressed||r instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),n.copy){E(!r,"can not specify copy and data field for the same texture");var o=a.viewportWidth,u=a.viewportHeight;e.width=e.width||o-e.xOffset,e.height=e.height||u-e.yOffset,e.needsCopy=!0,E(e.xOffset>=0&&e.xOffset<o&&e.yOffset>=0&&e.yOffset<u&&e.width>0&&e.width<=o&&e.height>0&&e.height<=u,"copy texture read out of bounds")}else if(r){if(t(r))e.channels=e.channels||4,e.data=r,"type"in n||5121!==e.type||(e.type=_t(r));else if(pt(r))e.channels=e.channels||4,function(t,e){var n=e.length;switch(t.type){case 5121:case 5123:case 5125:case 5126:var r=D.allocType(t.type,n);r.set(e),t.data=r;break;case 36193:t.data=Z(e);break;default:E.raise("unsupported texture type, must specify a typed array")}}(e,r),e.alignment=1,e.needsFree=!0;else if(L(r)){var s=r.data;Array.isArray(s)||5121!==e.type||(e.type=_t(s));var c,f,l,h,d,p,m=r.shape,v=r.stride;3===m.length?(l=m[2],p=v[2]):(E(2===m.length,"invalid ndarray pixel data, must be 2 or 3D"),l=1,p=1),c=m[0],f=m[1],h=v[0],d=v[1],e.alignment=1,e.width=c,e.height=f,e.channels=l,e.format=e.internalformat=nt[l],e.needsFree=!0,function(t,e,n,r,i,o){for(var a=t.width,u=t.height,s=t.channels,c=Et(t,a*u*s),f=0,l=0;l<u;++l)for(var h=0;h<a;++h)for(var d=0;d<s;++d)c[f++]=e[n*h+r*l+i*d+o];wt(t,c)}(e,s,h,d,p,r.offset)}else if(gt(r)||yt(r)||vt(r)===ut)gt(r)||yt(r)?e.element=r:e.element=r.canvas,e.width=e.element.width,e.height=e.element.height,e.channels=4;else if(function(t){return vt(t)===st}(r))e.element=r,e.width=r.width,e.height=r.height,e.channels=4;else if(function(t){return vt(t)===ct}(r))e.element=r,e.width=r.naturalWidth,e.height=r.naturalHeight,e.channels=4;else if(function(t){return vt(t)===ft}(r))e.element=r,e.width=r.videoWidth,e.height=r.videoHeight,e.channels=4;else if(mt(r)){var g=e.width||r[0].length,y=e.height||r.length,b=e.channels;b=J(r[0][0])?b||r[0][0].length:b||1;for(var _=F.shape(r),w=1,x=0;x<_.length;++x)w*=_[x];var T=Et(e,w);F.flatten(r,_,"",T),wt(e,T),e.alignment=1,e.width=g,e.height=y,e.channels=b,e.format=e.internalformat=nt[b],e.needsFree=!0}}else e.width=e.width||1,e.height=e.height||1,e.channels=e.channels||4;5126===e.type?E(i.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):36193===e.type&&E(i.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function N(t,e,r){var i=t.element,a=t.data,u=t.internalformat,s=t.format,c=t.type,f=t.width,l=t.height;C(t),i?n.texImage2D(e,r,s,s,c,i):t.compressed?n.compressedTexImage2D(e,r,u,f,l,0,a):t.needsCopy?(o(),n.copyTexImage2D(e,r,s,t.xOffset,t.yOffset,f,l,0)):n.texImage2D(e,r,s,f,l,0,s,c,a||null)}function P(t,e,r,i,a){var u=t.element,s=t.data,c=t.internalformat,f=t.format,l=t.type,h=t.width,d=t.height;C(t),u?n.texSubImage2D(e,a,r,i,f,l,u):t.compressed?n.compressedTexSubImage2D(e,a,r,i,c,h,d,s):t.needsCopy?(o(),n.copyTexSubImage2D(e,a,r,i,t.xOffset,t.yOffset,h,d)):n.texSubImage2D(e,a,r,i,h,d,f,l,s)}var k=[];function B(){return k.pop()||new M}function U(t){t.needsFree&&D.freeType(t.data),M.call(t),k.push(t)}function G(){S.call(this),this.genMipmaps=!1,this.mipmapHint=4352,this.mipmask=0,this.images=Array(16)}function V(t,e,n){var r=t.images[0]=B();t.mipmask=1,r.width=t.width=e,r.height=t.height=n,r.channels=t.channels=4}function z(t,e){var n=null;if(bt(e))R(n=t.images[0]=B(),t),I(n,e),t.mipmask=1;else if(O(t,e),Array.isArray(e.mipmap))for(var r=e.mipmap,i=0;i<r.length;++i)R(n=t.images[i]=B(),t),n.width>>=i,n.height>>=i,I(n,r[i]),t.mipmask|=1<<i;else R(n=t.images[0]=B(),t),I(n,e),t.mipmask=1;R(t,t.images[0]),!t.compressed||33776!==t.internalformat&&33777!==t.internalformat&&33778!==t.internalformat&&33779!==t.internalformat||E(t.width%4==0&&t.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function W(t,e){for(var n=t.images,r=0;r<n.length;++r){if(!n[r])return;N(n[r],e,r)}}var H=[];function q(){var t=H.pop()||new G;S.call(t),t.mipmask=0;for(var e=0;e<16;++e)t.images[e]=null;return t}function X(t){for(var e=t.images,n=0;n<e.length;++n)e[n]&&U(e[n]),e[n]=null;H.push(t)}function Y(){this.minFilter=9728,this.magFilter=9728,this.wrapS=33071,this.wrapT=33071,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=4352}function K(t,e){if("min"in e){var n=e.min;E.parameter(n,h),t.minFilter=h[n],et.indexOf(t.minFilter)>=0&&!("faces"in e)&&(t.genMipmaps=!0)}if("mag"in e){var r=e.mag;E.parameter(r,l),t.magFilter=l[r]}var o=t.wrapS,a=t.wrapT;if("wrap"in e){var u=e.wrap;"string"==typeof u?(E.parameter(u,f),o=a=f[u]):Array.isArray(u)&&(E.parameter(u[0],f),E.parameter(u[1],f),o=f[u[0]],a=f[u[1]])}else{if("wrapS"in e){var s=e.wrapS;E.parameter(s,f),o=f[s]}if("wrapT"in e){var d=e.wrapT;E.parameter(d,f),a=f[d]}}if(t.wrapS=o,t.wrapT=a,"anisotropic"in e){var p=e.anisotropic;E("number"==typeof p&&p>=1&&p<=i.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var m=!1;switch(typeof e.mipmap){case"string":E.parameter(e.mipmap,c,"invalid mipmap hint"),t.mipmapHint=c[e.mipmap],t.genMipmaps=!0,m=!0;break;case"boolean":m=t.genMipmaps=e.mipmap;break;case"object":E(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,m=!0;break;default:E.raise("invalid mipmap type")}m&&!("min"in e)&&(t.minFilter=9984)}}function Q(t,e){n.texParameteri(e,10241,t.minFilter),n.texParameteri(e,10240,t.magFilter),n.texParameteri(e,10242,t.wrapS),n.texParameteri(e,10243,t.wrapT),r.ext_texture_filter_anisotropic&&n.texParameteri(e,34046,t.anisotropic),t.genMipmaps&&(n.hint(33170,t.mipmapHint),n.generateMipmap(e))}var $=0,it={},ot=i.maxTextureUnits,at=Array(ot).map((function(){return null}));function lt(t){S.call(this),this.mipmask=0,this.internalformat=6408,this.id=$++,this.refCount=1,this.target=t,this.texture=n.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Y,s.profile&&(this.stats={size:0})}function ht(t){n.activeTexture(33984),n.bindTexture(t.target,t.texture)}function dt(){var t=at[0];t?n.bindTexture(t.target,t.texture):n.bindTexture(3553,null)}function Tt(t){var e=t.texture;E(e,"must not double destroy texture");var r=t.unit,i=t.target;r>=0&&(n.activeTexture(33984+r),n.bindTexture(i,null),at[r]=null),n.deleteTexture(e),t.texture=null,t.params=null,t.pixels=null,t.refCount=0,delete it[t.id],u.textureCount--}return e(lt.prototype,{bind:function(){this.bindCount+=1;var t=this.unit;if(t<0){for(var e=0;e<ot;++e){var r=at[e];if(r){if(r.bindCount>0)continue;r.unit=-1}at[e]=this,t=e;break}t>=ot&&E.raise("insufficient number of texture units"),s.profile&&u.maxTextureUnits<t+1&&(u.maxTextureUnits=t+1),this.unit=t,n.activeTexture(33984+t),n.bindTexture(this.target,this.texture)}return t},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Tt(this)}}),s.profile&&(u.getTotalTextureSize=function(){var t=0;return Object.keys(it).forEach((function(e){t+=it[e].stats.size})),t}),{create2D:function(t,e){var r=new lt(3553);function o(t,e){var n=r.texInfo;Y.call(n);var a=q();return"number"==typeof t?V(a,0|t,"number"==typeof e?0|e:0|t):t?(E.type(t,"object","invalid arguments to regl.texture"),K(n,t),z(a,t)):V(a,1,1),n.genMipmaps&&(a.mipmask=(a.width<<1)-1),r.mipmask=a.mipmask,R(r,a),E.texture2D(n,a,i),r.internalformat=a.internalformat,o.width=a.width,o.height=a.height,ht(r),W(a,3553),Q(n,3553),dt(),X(a),s.profile&&(r.stats.size=xt(r.internalformat,r.type,a.width,a.height,n.genMipmaps,!1)),o.format=b[r.internalformat],o.type=_[r.type],o.mag=w[n.magFilter],o.min=x[n.minFilter],o.wrapS=T[n.wrapS],o.wrapT=T[n.wrapT],o}return it[r.id]=r,u.textureCount++,o(t,e),o.subimage=function(t,e,n,i){E(!!t,"must specify image data");var a=0|e,u=0|n,s=0|i,c=B();return R(c,r),c.width=0,c.height=0,I(c,t),c.width=c.width||(r.width>>s)-a,c.height=c.height||(r.height>>s)-u,E(r.type===c.type&&r.format===c.format&&r.internalformat===c.internalformat,"incompatible format for texture.subimage"),E(a>=0&&u>=0&&a+c.width<=r.width&&u+c.height<=r.height,"texture.subimage write out of bounds"),E(r.mipmask&1<<s,"missing mipmap data"),E(c.data||c.element||c.needsCopy,"missing image data"),ht(r),P(c,3553,a,u,s),dt(),U(c),o},o.resize=function(t,e){var i=0|t,a=0|e||i;if(i===r.width&&a===r.height)return o;o.width=r.width=i,o.height=r.height=a,ht(r);for(var u=0;r.mipmask>>u;++u){var c=i>>u,f=a>>u;if(!c||!f)break;n.texImage2D(3553,u,r.format,c,f,0,r.format,r.type,null)}return dt(),s.profile&&(r.stats.size=xt(r.internalformat,r.type,i,a,!1,!1)),o},o._reglType="texture2d",o._texture=r,s.profile&&(o.stats=r.stats),o.destroy=function(){r.decRef()},o},createCube:function(t,e,r,o,a,c){var f=new lt(34067);it[f.id]=f,u.cubeCount++;var l=new Array(6);function h(t,e,n,r,o,a){var u,c=f.texInfo;for(Y.call(c),u=0;u<6;++u)l[u]=q();if("number"!=typeof t&&t)if("object"==typeof t)if(e)z(l[0],t),z(l[1],e),z(l[2],n),z(l[3],r),z(l[4],o),z(l[5],a);else if(K(c,t),O(f,t),"faces"in t){var d=t.faces;for(E(Array.isArray(d)&&6===d.length,"cube faces must be a length 6 array"),u=0;u<6;++u)E("object"==typeof d[u]&&!!d[u],"invalid input for cube map face"),R(l[u],f),z(l[u],d[u])}else for(u=0;u<6;++u)z(l[u],t);else E.raise("invalid arguments to cube map");else{var p=0|t||1;for(u=0;u<6;++u)V(l[u],p,p)}for(R(f,l[0]),i.npotTextureCube||E(tt(f.width)&&tt(f.height),"your browser does not support non power or two texture dimensions"),c.genMipmaps?f.mipmask=(l[0].width<<1)-1:f.mipmask=l[0].mipmask,E.textureCube(f,c,l,i),f.internalformat=l[0].internalformat,h.width=l[0].width,h.height=l[0].height,ht(f),u=0;u<6;++u)W(l[u],34069+u);for(Q(c,34067),dt(),s.profile&&(f.stats.size=xt(f.internalformat,f.type,h.width,h.height,c.genMipmaps,!0)),h.format=b[f.internalformat],h.type=_[f.type],h.mag=w[c.magFilter],h.min=x[c.minFilter],h.wrapS=T[c.wrapS],h.wrapT=T[c.wrapT],u=0;u<6;++u)X(l[u]);return h}return h(t,e,r,o,a,c),h.subimage=function(t,e,n,r,i){E(!!e,"must specify image data"),E("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var o=0|n,a=0|r,u=0|i,s=B();return R(s,f),s.width=0,s.height=0,I(s,e),s.width=s.width||(f.width>>u)-o,s.height=s.height||(f.height>>u)-a,E(f.type===s.type&&f.format===s.format&&f.internalformat===s.internalformat,"incompatible format for texture.subimage"),E(o>=0&&a>=0&&o+s.width<=f.width&&a+s.height<=f.height,"texture.subimage write out of bounds"),E(f.mipmask&1<<u,"missing mipmap data"),E(s.data||s.element||s.needsCopy,"missing image data"),ht(f),P(s,34069+t,o,a,u),dt(),U(s),h},h.resize=function(t){var e=0|t;if(e!==f.width){h.width=f.width=e,h.height=f.height=e,ht(f);for(var r=0;r<6;++r)for(var i=0;f.mipmask>>i;++i)n.texImage2D(34069+r,i,f.format,e>>i,e>>i,0,f.format,f.type,null);return dt(),s.profile&&(f.stats.size=xt(f.internalformat,f.type,h.width,h.height,!1,!0)),h}},h._reglType="textureCube",h._texture=f,s.profile&&(h.stats=f.stats),h.destroy=function(){f.decRef()},h},clear:function(){for(var t=0;t<ot;++t)n.activeTexture(33984+t),n.bindTexture(3553,null),at[t]=null;j(it).forEach(Tt),u.cubeCount=0,u.textureCount=0},getTexture:function(t){return null},restore:function(){for(var t=0;t<ot;++t){var e=at[t];e&&(e.bindCount=0,e.unit=-1,at[t]=null)}j(it).forEach((function(t){t.texture=n.createTexture(),n.bindTexture(t.target,t.texture);for(var e=0;e<32;++e)if(0!=(t.mipmask&1<<e))if(3553===t.target)n.texImage2D(3553,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);else for(var r=0;r<6;++r)n.texImage2D(34069+r,e,t.internalformat,t.width>>e,t.height>>e,0,t.internalformat,t.type,null);Q(t.texInfo,t.target)}))},refresh:function(){for(var t=0;t<ot;++t){var e=at[t];e&&(e.bindCount=0,e.unit=-1,at[t]=null),n.activeTexture(33984+t),n.bindTexture(3553,null),n.bindTexture(34067,null)}}}}dt[32854]=2,dt[32855]=2,dt[36194]=2,dt[34041]=4,dt[33776]=.5,dt[33777]=.5,dt[33778]=1,dt[33779]=1,dt[35986]=.5,dt[35987]=1,dt[34798]=1,dt[35840]=.5,dt[35841]=.25,dt[35842]=.5,dt[35843]=.25,dt[36196]=.5;var At=[];function St(t,e,n){return At[t]*e*n}At[32854]=2,At[32855]=2,At[36194]=2,At[33189]=2,At[36168]=1,At[34041]=4,At[35907]=4,At[34836]=16,At[34842]=8,At[34843]=6;var Rt=[6407,6408],Ot=[];Ot[6408]=4,Ot[6407]=3;var Ct=[];Ct[5121]=1,Ct[5126]=4,Ct[36193]=2;var Mt=[32854,32855,36194,35907,34842,34843,34836],It={};function Nt(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.offset=0,this.stride=0,this.divisor=0}function Pt(e,n,r,i,o,a,u){function s(s){var c;null===n.next?(E(o.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),c=5121):(E(null!==n.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),c=n.next.colorAttachments[0].texture._texture.type,a.oes_texture_float?(E(5121===c||5126===c,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),5126===c&&E(u.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):E(5121===c,"Reading from a framebuffer is only allowed for the type 'uint8'"));var f=0,l=0,h=i.framebufferWidth,d=i.framebufferHeight,p=null;t(s)?p=s:s&&(E.type(s,"object","invalid arguments to regl.read()"),f=0|s.x,l=0|s.y,E(f>=0&&f<i.framebufferWidth,"invalid x offset for regl.read"),E(l>=0&&l<i.framebufferHeight,"invalid y offset for regl.read"),h=0|(s.width||i.framebufferWidth-f),d=0|(s.height||i.framebufferHeight-l),p=s.data||null),p&&(5121===c?E(p instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):5126===c&&E(p instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),E(h>0&&h+f<=i.framebufferWidth,"invalid width for read pixels"),E(d>0&&d+l<=i.framebufferHeight,"invalid height for read pixels"),r();var m=h*d*4;return p||(5121===c?p=new Uint8Array(m):5126===c&&(p=p||new Float32Array(m))),E.isTypedArray(p,"data buffer for regl.read() must be a typedarray"),E(p.byteLength>=m,"data buffer for regl.read() too small"),e.pixelStorei(3333,4),e.readPixels(f,l,h,d,6408,c,p),p}return function(t){return t&&"framebuffer"in t?function(t){var e;return n.setFBO({framebuffer:t.framebuffer},(function(){e=s(t)})),e}(t):s(t)}}function kt(t){return Array.prototype.slice.call(t)}function Dt(t){return kt(t).join("")}It[36053]="complete",It[36054]="incomplete attachment",It[36057]="incomplete dimensions",It[36055]="incomplete, missing attachment",It[36061]="unsupported";var Lt="xyzw".split(""),jt="profile",Ft="framebuffer",Bt="vert",Ut="frag",Gt="elements",Vt="primitive",zt="count",Wt="offset",Ht="instances",qt="vao",Xt=Ft+"Width",Yt=Ft+"Height",Kt=["blend.func","blend.equation","stencil.func","stencil.opFront","stencil.opBack","sample.coverage","viewport","scissor.box","polygonOffset.offset"],Qt={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},$t=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Zt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Jt={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},te={frag:35632,vert:35633},ee={cw:2304,ccw:2305};function ne(e){return Array.isArray(e)||t(e)||L(e)}function re(t){return t.sort((function(t,e){return"viewport"===t?-1:"viewport"===e?1:t<e?-1:1}))}function ie(t,e,n,r){this.thisDep=t,this.contextDep=e,this.propDep=n,this.append=r}function oe(t){return t&&!(t.thisDep||t.contextDep||t.propDep)}function ae(t){return new ie(!1,!1,!1,t)}function ue(t,e){var n=t.type;if(0===n){var r=t.data.length;return new ie(!0,r>=1,r>=2,e)}if(4===n){var i=t.data;return new ie(i.thisDep,i.contextDep,i.propDep,e)}if(5===n)return new ie(!1,!1,!1,e);if(6===n){for(var o=!1,a=!1,u=!1,s=0;s<t.data.length;++s){var c=t.data[s];if(1===c.type)u=!0;else if(2===c.type)a=!0;else if(3===c.type)o=!0;else if(0===c.type){o=!0;var f=c.data;f>=1&&(a=!0),f>=2&&(u=!0)}else 4===c.type&&(o=o||c.data.thisDep,a=a||c.data.contextDep,u=u||c.data.propDep)}return new ie(o,a,u,e)}return new ie(3===n,2===n,1===n,e)}var se=new ie(!1,!1,!1,(function(){}));function ce(t,n,r,i,o,a,u,s,c,f,l,h,d,p,m){var v=f.Record,g={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(g.min=32775,g.max=32776);var y=r.angle_instanced_arrays,b=r.webgl_draw_buffers,_={dirty:!0,profile:m.profile},w={},x=[],T={},A={};function R(t){return t.replace(".","_")}function O(t,e,n){var r=R(t);x.push(t),w[r]=_[r]=!!n,T[r]=e}function C(t,e,n){var r=R(t);x.push(t),Array.isArray(n)?(_[r]=n.slice(),w[r]=n.slice()):_[r]=w[r]=n,A[r]=e}O("dither",3024),O("blend.enable",3042),C("blend.color","blendColor",[0,0,0,0]),C("blend.equation","blendEquationSeparate",[32774,32774]),C("blend.func","blendFuncSeparate",[1,0,1,0]),O("depth.enable",2929,!0),C("depth.func","depthFunc",513),C("depth.range","depthRange",[0,1]),C("depth.mask","depthMask",!0),C("colorMask","colorMask",[!0,!0,!0,!0]),O("cull.enable",2884),C("cull.face","cullFace",1029),C("frontFace","frontFace",2305),C("lineWidth","lineWidth",1),O("polygonOffset.enable",32823),C("polygonOffset.offset","polygonOffset",[0,0]),O("sample.alpha",32926),O("sample.enable",32928),C("sample.coverage","sampleCoverage",[1,!1]),O("stencil.enable",2960),C("stencil.mask","stencilMask",-1),C("stencil.func","stencilFunc",[519,0,-1]),C("stencil.opFront","stencilOpSeparate",[1028,7680,7680,7680]),C("stencil.opBack","stencilOpSeparate",[1029,7680,7680,7680]),O("scissor.enable",3089),C("scissor.box","scissor",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]),C("viewport","viewport",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]);var M={gl:t,context:d,strings:n,next:w,current:_,draw:h,elements:a,buffer:o,shader:l,attributes:f.state,vao:f,uniforms:c,framebuffer:s,extensions:r,timer:p,isBufferArgs:ne},I={primTypes:K,compareFuncs:Zt,blendFuncs:Qt,blendEquations:g,stencilOps:Jt,glTypes:G,orientationType:ee};E.optional((function(){M.isArrayLike=J})),b&&(I.backBuffer=[1029],I.drawBuffer=N(i.maxDrawbuffers,(function(t){return 0===t?[0]:N(t,(function(t){return 36064+t}))})));var P=0;function k(){var t=function(){var t=0,n=[],r=[];function i(){var n=[],r=[];return e((function(){n.push.apply(n,kt(arguments))}),{def:function(){var e="v"+t++;return r.push(e),arguments.length>0&&(n.push(e,"="),n.push.apply(n,kt(arguments)),n.push(";")),e},toString:function(){return Dt([r.length>0?"var "+r.join(",")+";":"",Dt(n)])}})}function o(){var t=i(),n=i(),r=t.toString,o=n.toString;function a(e,r){n(e,r,"=",t.def(e,r),";")}return e((function(){t.apply(t,kt(arguments))}),{def:t.def,entry:t,exit:n,save:a,set:function(e,n,r){a(e,n),t(e,n,"=",r,";")},toString:function(){return r()+o()}})}var a=i(),u={};return{global:a,link:function(e){for(var i=0;i<r.length;++i)if(r[i]===e)return n[i];var o="g"+t++;return n.push(o),r.push(e),o},block:i,proc:function(t,n){var r=[];function i(){var t="a"+r.length;return r.push(t),t}n=n||0;for(var a=0;a<n;++a)i();var s=o(),c=s.toString;return u[t]=e(s,{arg:i,toString:function(){return Dt(["function(",r.join(),"){",c(),"}"])}})},scope:o,cond:function(){var t=Dt(arguments),n=o(),r=o(),i=n.toString,a=r.toString;return e(n,{then:function(){return n.apply(n,kt(arguments)),this},else:function(){return r.apply(r,kt(arguments)),this},toString:function(){var e=a();return e&&(e="else{"+e+"}"),Dt(["if(",t,"){",i(),"}",e])}})},compile:function(){var t=['"use strict";',a,"return {"];Object.keys(u).forEach((function(e){t.push('"',e,'":',u[e].toString(),",")})),t.push("}");var e=Dt(t).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,n.concat(e)).apply(null,r)}}}(),r=t.link,i=t.global;t.id=P++,t.batchId="0";var o=r(M),a=t.shared={props:"a0"};Object.keys(M).forEach((function(t){a[t]=i.def(o,".",t)})),E.optional((function(){t.CHECK=r(E),t.commandStr=E.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},I.invalidBlendCombinations=$t}));var u=t.next={},s=t.current={};Object.keys(A).forEach((function(t){Array.isArray(_[t])&&(u[t]=i.def(a.next,".",t),s[t]=i.def(a.current,".",t))}));var c=t.constants={};Object.keys(I).forEach((function(t){c[t]=i.def(JSON.stringify(I[t]))})),t.invoke=function(e,n){switch(n.type){case 0:var i=["this",a.context,a.props,t.batchId];return e.def(r(n.data),".call(",i.slice(0,Math.max(n.data.length+1,4)),")");case 1:return e.def(a.props,n.data);case 2:return e.def(a.context,n.data);case 3:return e.def("this",n.data);case 4:return n.data.append(t,e),n.data.ref;case 5:return n.data.toString();case 6:return n.data.map((function(n){return t.invoke(e,n)}))}},t.attribCache={};var l={};return t.scopeAttrib=function(t){var e=n.id(t);if(e in l)return l[e];var i=f.scope[e];return i||(i=f.scope[e]=new v),l[e]=r(i)},t}function D(t,e,u,c,h){var d=t.static,p=t.dynamic;E.optional((function(){var t=[Ft,Bt,Ut,Gt,Vt,Wt,zt,Ht,jt,qt].concat(x);function e(e){Object.keys(e).forEach((function(e){E.command(t.indexOf(e)>=0,'unknown parameter "'+e+'"',h.commandStr)}))}e(d),e(p)}));var m=function(t,e){var n=t.static;if("string"==typeof n[Ut]&&"string"==typeof n[Bt]){if(Object.keys(e.dynamic).length>0)return null;var r=e.static,i=Object.keys(r);if(i.length>0&&"number"==typeof r[i[0]]){for(var o=[],a=0;a<i.length;++a)E("number"==typeof r[i[a]],"must specify all vertex attribute locations when using vaos"),o.push([0|r[i[a]],i[a]]);return o}}return null}(t,e),b=function(t,e){var n=t.static,r=t.dynamic;if(Ft in n){var i=n[Ft];return i?(i=s.getFramebuffer(i),E.command(i,"invalid framebuffer object"),ae((function(t,e){var n=t.link(i),r=t.shared;e.set(r.framebuffer,".next",n);var o=r.context;return e.set(o,"."+Xt,n+".width"),e.set(o,"."+Yt,n+".height"),n}))):ae((function(t,e){var n=t.shared;e.set(n.framebuffer,".next","null");var r=n.context;return e.set(r,"."+Xt,r+".drawingBufferWidth"),e.set(r,"."+Yt,r+".drawingBufferHeight"),"null"}))}if(Ft in r){var o=r[Ft];return ue(o,(function(t,e){var n=t.invoke(e,o),r=t.shared,i=r.framebuffer,a=e.def(i,".getFramebuffer(",n,")");E.optional((function(){t.assert(e,"!"+n+"||"+a,"invalid framebuffer object")})),e.set(i,".next",a);var u=r.context;return e.set(u,"."+Xt,a+"?"+a+".width:"+u+".drawingBufferWidth"),e.set(u,"."+Yt,a+"?"+a+".height:"+u+".drawingBufferHeight"),a}))}return null}(t),_=function(t,e,n){var r=t.static,i=t.dynamic;function o(t){if(t in r){var o=r[t];E.commandType(o,"object","invalid "+t,n.commandStr);var a,u,s=!0,c=0|o.x,f=0|o.y;return"width"in o?(a=0|o.width,E.command(a>=0,"invalid "+t,n.commandStr)):s=!1,"height"in o?(u=0|o.height,E.command(u>=0,"invalid "+t,n.commandStr)):s=!1,new ie(!s&&e&&e.thisDep,!s&&e&&e.contextDep,!s&&e&&e.propDep,(function(t,e){var n=t.shared.context,r=a;"width"in o||(r=e.def(n,".",Xt,"-",c));var i=u;return"height"in o||(i=e.def(n,".",Yt,"-",f)),[c,f,r,i]}))}if(t in i){var l=i[t],h=ue(l,(function(e,n){var r=e.invoke(n,l);E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)}));var i=e.shared.context,o=n.def(r,".x|0"),a=n.def(r,".y|0"),u=n.def('"width" in ',r,"?",r,".width|0:","(",i,".",Xt,"-",o,")"),s=n.def('"height" in ',r,"?",r,".height|0:","(",i,".",Yt,"-",a,")");return E.optional((function(){e.assert(n,u+">=0&&"+s+">=0","invalid "+t)})),[o,a,u,s]}));return e&&(h.thisDep=h.thisDep||e.thisDep,h.contextDep=h.contextDep||e.contextDep,h.propDep=h.propDep||e.propDep),h}return e?new ie(e.thisDep,e.contextDep,e.propDep,(function(t,e){var n=t.shared.context;return[0,0,e.def(n,".",Xt),e.def(n,".",Yt)]})):null}var a=o("viewport");if(a){var u=a;a=new ie(a.thisDep,a.contextDep,a.propDep,(function(t,e){var n=u.append(t,e),r=t.shared.context;return e.set(r,".viewportWidth",n[2]),e.set(r,".viewportHeight",n[3]),n}))}return{viewport:a,scissor_box:o("scissor.box")}}(t,b,h),w=function(t,e){var n=t.static,r=t.dynamic,i=function(){if(Gt in n){var t=n[Gt];ne(t)?t=a.getElements(a.create(t,!0)):t&&(t=a.getElements(t),E.command(t,"invalid elements",e.commandStr));var i=ae((function(e,n){if(t){var r=e.link(t);return e.ELEMENTS=r,r}return e.ELEMENTS=null,null}));return i.value=t,i}if(Gt in r){var o=r[Gt];return ue(o,(function(t,e){var n=t.shared,r=n.isBufferArgs,i=n.elements,a=t.invoke(e,o),u=e.def("null"),s=e.def(r,"(",a,")"),c=t.cond(s).then(u,"=",i,".createStream(",a,");").else(u,"=",i,".getElements(",a,");");return E.optional((function(){t.assert(c.else,"!"+a+"||"+u,"invalid elements")})),e.entry(c),e.exit(t.cond(s).then(i,".destroyStream(",u,");")),t.ELEMENTS=u,u}))}return null}();function o(t,o){if(t in n){var a=0|n[t];return E.command(!o||a>=0,"invalid "+t,e.commandStr),ae((function(t,e){return o&&(t.OFFSET=a),a}))}if(t in r){var u=r[t];return ue(u,(function(e,n){var r=e.invoke(n,u);return o&&(e.OFFSET=r,E.optional((function(){e.assert(n,r+">=0","invalid "+t)}))),r}))}return o&&i?ae((function(t,e){return t.OFFSET="0",0})):null}var u=o(Wt,!0);return{elements:i,primitive:function(){if(Vt in n){var t=n[Vt];return E.commandParameter(t,K,"invalid primitve",e.commandStr),ae((function(e,n){return K[t]}))}if(Vt in r){var o=r[Vt];return ue(o,(function(t,e){var n=t.constants.primTypes,r=t.invoke(e,o);return E.optional((function(){t.assert(e,r+" in "+n,"invalid primitive, must be one of "+Object.keys(K))})),e.def(n,"[",r,"]")}))}return i?oe(i)?i.value?ae((function(t,e){return e.def(t.ELEMENTS,".primType")})):ae((function(){return 4})):new ie(i.thisDep,i.contextDep,i.propDep,(function(t,e){var n=t.ELEMENTS;return e.def(n,"?",n,".primType:",4)})):null}(),count:function(){if(zt in n){var t=0|n[zt];return E.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),ae((function(){return t}))}if(zt in r){var o=r[zt];return ue(o,(function(t,e){var n=t.invoke(e,o);return E.optional((function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")})),n}))}if(i){if(oe(i)){if(i)return u?new ie(u.thisDep,u.contextDep,u.propDep,(function(t,e){var n=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return E.optional((function(){t.assert(e,n+">=0","invalid vertex offset/element buffer too small")})),n})):ae((function(t,e){return e.def(t.ELEMENTS,".vertCount")}));var a=ae((function(){return-1}));return E.optional((function(){a.MISSING=!0})),a}var s=new ie(i.thisDep||u.thisDep,i.contextDep||u.contextDep,i.propDep||u.propDep,(function(t,e){var n=t.ELEMENTS;return t.OFFSET?e.def(n,"?",n,".vertCount-",t.OFFSET,":-1"):e.def(n,"?",n,".vertCount:-1")}));return E.optional((function(){s.DYNAMIC=!0})),s}return null}(),instances:o(Ht,!1),offset:u}}(t,h),T=function(t,e){var n=t.static,r=t.dynamic,o={};return x.forEach((function(t){var a=R(t);function u(e,i){if(t in n){var u=e(n[t]);o[a]=ae((function(){return u}))}else if(t in r){var s=r[t];o[a]=ue(s,(function(t,e){return i(t,e,t.invoke(e,s))}))}}switch(t){case"cull.enable":case"blend.enable":case"dither":case"stencil.enable":case"depth.enable":case"scissor.enable":case"polygonOffset.enable":case"sample.alpha":case"sample.enable":case"depth.mask":return u((function(n){return E.commandType(n,"boolean",t,e.commandStr),n}),(function(e,n,r){return E.optional((function(){e.assert(n,"typeof "+r+'==="boolean"',"invalid flag "+t,e.commandStr)})),r}));case"depth.func":return u((function(n){return E.commandParameter(n,Zt,"invalid "+t,e.commandStr),Zt[n]}),(function(e,n,r){var i=e.constants.compareFuncs;return E.optional((function(){e.assert(n,r+" in "+i,"invalid "+t+", must be one of "+Object.keys(Zt))})),n.def(i,"[",r,"]")}));case"depth.range":return u((function(t){return E.command(J(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===2&&typeof "+n+'[0]==="number"&&typeof '+n+'[1]==="number"&&'+n+"[0]<="+n+"[1]","depth range must be a 2d array")})),[e.def("+",n,"[0]"),e.def("+",n,"[1]")]}));case"blend.func":return u((function(t){E.commandType(t,"object","blend.func",e.commandStr);var n="srcRGB"in t?t.srcRGB:t.src,r="srcAlpha"in t?t.srcAlpha:t.src,i="dstRGB"in t?t.dstRGB:t.dst,o="dstAlpha"in t?t.dstAlpha:t.dst;return E.commandParameter(n,Qt,a+".srcRGB",e.commandStr),E.commandParameter(r,Qt,a+".srcAlpha",e.commandStr),E.commandParameter(i,Qt,a+".dstRGB",e.commandStr),E.commandParameter(o,Qt,a+".dstAlpha",e.commandStr),E.command(-1===$t.indexOf(n+", "+i),"unallowed blending combination (srcRGB, dstRGB) = ("+n+", "+i+")",e.commandStr),[Qt[n],Qt[i],Qt[r],Qt[o]]}),(function(e,n,r){var i=e.constants.blendFuncs;function o(o,a){var u=n.def('"',o,a,'" in ',r,"?",r,".",o,a,":",r,".",o);return E.optional((function(){e.assert(n,u+" in "+i,"invalid "+t+"."+o+a+", must be one of "+Object.keys(Qt))})),u}E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid blend func, must be an object")}));var a=o("src","RGB"),u=o("dst","RGB");E.optional((function(){var t=e.constants.invalidBlendCombinations;e.assert(n,t+".indexOf("+a+'+", "+'+u+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")}));var s=n.def(i,"[",a,"]"),c=n.def(i,"[",o("src","Alpha"),"]");return[s,n.def(i,"[",u,"]"),c,n.def(i,"[",o("dst","Alpha"),"]")]}));case"blend.equation":return u((function(n){return"string"==typeof n?(E.commandParameter(n,g,"invalid "+t,e.commandStr),[g[n],g[n]]):"object"==typeof n?(E.commandParameter(n.rgb,g,t+".rgb",e.commandStr),E.commandParameter(n.alpha,g,t+".alpha",e.commandStr),[g[n.rgb],g[n.alpha]]):void E.commandRaise("invalid blend.equation",e.commandStr)}),(function(e,n,r){var i=e.constants.blendEquations,o=n.def(),a=n.def(),u=e.cond("typeof ",r,'==="string"');return E.optional((function(){function n(t,n,r){e.assert(t,r+" in "+i,"invalid "+n+", must be one of "+Object.keys(g))}n(u.then,t,r),e.assert(u.else,r+"&&typeof "+r+'==="object"',"invalid "+t),n(u.else,t+".rgb",r+".rgb"),n(u.else,t+".alpha",r+".alpha")})),u.then(o,"=",a,"=",i,"[",r,"];"),u.else(o,"=",i,"[",r,".rgb];",a,"=",i,"[",r,".alpha];"),n(u),[o,a]}));case"blend.color":return u((function(t){return E.command(J(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),N(4,(function(e){return+t[e]}))}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===4","blend.color must be a 4d array")})),N(4,(function(t){return e.def("+",n,"[",t,"]")}))}));case"stencil.mask":return u((function(t){return E.commandType(t,"number",a,e.commandStr),0|t}),(function(t,e,n){return E.optional((function(){t.assert(e,"typeof "+n+'==="number"',"invalid stencil.mask")})),e.def(n,"|0")}));case"stencil.func":return u((function(n){E.commandType(n,"object",a,e.commandStr);var r=n.cmp||"keep",i=n.ref||0,o="mask"in n?n.mask:-1;return E.commandParameter(r,Zt,t+".cmp",e.commandStr),E.commandType(i,"number",t+".ref",e.commandStr),E.commandType(o,"number",t+".mask",e.commandStr),[Zt[r],i,o]}),(function(t,e,n){var r=t.constants.compareFuncs;return E.optional((function(){function i(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}i(n+"&&typeof ",n,'==="object"'),i('!("cmp" in ',n,")||(",n,".cmp in ",r,")")})),[e.def('"cmp" in ',n,"?",r,"[",n,".cmp]",":",7680),e.def(n,".ref|0"),e.def('"mask" in ',n,"?",n,".mask|0:-1")]}));case"stencil.opFront":case"stencil.opBack":return u((function(n){E.commandType(n,"object",a,e.commandStr);var r=n.fail||"keep",i=n.zfail||"keep",o=n.zpass||"keep";return E.commandParameter(r,Jt,t+".fail",e.commandStr),E.commandParameter(i,Jt,t+".zfail",e.commandStr),E.commandParameter(o,Jt,t+".zpass",e.commandStr),["stencil.opBack"===t?1029:1028,Jt[r],Jt[i],Jt[o]]}),(function(e,n,r){var i=e.constants.stencilOps;function o(o){return E.optional((function(){e.assert(n,'!("'+o+'" in '+r+")||("+r+"."+o+" in "+i+")","invalid "+t+"."+o+", must be one of "+Object.keys(Jt))})),n.def('"',o,'" in ',r,"?",i,"[",r,".",o,"]:",7680)}return E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)})),["stencil.opBack"===t?1029:1028,o("fail"),o("zfail"),o("zpass")]}));case"polygonOffset.offset":return u((function(t){E.commandType(t,"object",a,e.commandStr);var n=0|t.factor,r=0|t.units;return E.commandType(n,"number",a+".factor",e.commandStr),E.commandType(r,"number",a+".units",e.commandStr),[n,r]}),(function(e,n,r){return E.optional((function(){e.assert(n,r+"&&typeof "+r+'==="object"',"invalid "+t)})),[n.def(r,".factor|0"),n.def(r,".units|0")]}));case"cull.face":return u((function(t){var n=0;return"front"===t?n=1028:"back"===t&&(n=1029),E.command(!!n,a,e.commandStr),n}),(function(t,e,n){return E.optional((function(){t.assert(e,n+'==="front"||'+n+'==="back"',"invalid cull.face")})),e.def(n,'==="front"?',1028,":",1029)}));case"lineWidth":return u((function(t){return E.command("number"==typeof t&&t>=i.lineWidthDims[0]&&t<=i.lineWidthDims[1],"invalid line width, must be a positive number between "+i.lineWidthDims[0]+" and "+i.lineWidthDims[1],e.commandStr),t}),(function(t,e,n){return E.optional((function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">="+i.lineWidthDims[0]+"&&"+n+"<="+i.lineWidthDims[1],"invalid line width")})),n}));case"frontFace":return u((function(t){return E.commandParameter(t,ee,a,e.commandStr),ee[t]}),(function(t,e,n){return E.optional((function(){t.assert(e,n+'==="cw"||'+n+'==="ccw"',"invalid frontFace, must be one of cw,ccw")})),e.def(n+'==="cw"?2304:2305')}));case"colorMask":return u((function(t){return E.command(J(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map((function(t){return!!t}))}),(function(t,e,n){return E.optional((function(){t.assert(e,t.shared.isArrayLike+"("+n+")&&"+n+".length===4","invalid color.mask")})),N(4,(function(t){return"!!"+n+"["+t+"]"}))}));case"sample.coverage":return u((function(t){E.command("object"==typeof t&&t,a,e.commandStr);var n="value"in t?t.value:1,r=!!t.invert;return E.command("number"==typeof n&&n>=0&&n<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[n,r]}),(function(t,e,n){return E.optional((function(){t.assert(e,n+"&&typeof "+n+'==="object"',"invalid sample.coverage")})),[e.def('"value" in ',n,"?+",n,".value:1"),e.def("!!",n,".invert")]}))}})),o}(t,h),A=function(t,e,r){var i=t.static,o=t.dynamic;function a(t){if(t in i){var e=n.id(i[t]);E.optional((function(){l.shader(te[t],e,E.guessCommand())}));var r=ae((function(){return e}));return r.id=e,r}if(t in o){var a=o[t];return ue(a,(function(e,n){var r=e.invoke(n,a),i=n.def(e.shared.strings,".id(",r,")");return E.optional((function(){n(e.shared.shader,".shader(",te[t],",",i,",",e.command,");")})),i}))}return null}var u,s=a(Ut),c=a(Bt),f=null;return oe(s)&&oe(c)?(f=l.program(c.id,s.id,null,r),u=ae((function(t,e){return t.link(f)}))):u=new ie(s&&s.thisDep||c&&c.thisDep,s&&s.contextDep||c&&c.contextDep,s&&s.propDep||c&&c.propDep,(function(t,e){var n,r=t.shared.shader;n=s?s.append(t,e):e.def(r,".",Ut);var i=r+".program("+(c?c.append(t,e):e.def(r,".",Bt))+","+n;return E.optional((function(){i+=","+t.command})),e.def(i+")")})),{frag:s,vert:c,progVar:u,program:f}}(t,0,m);function S(t){var e=_[t];e&&(T[t]=e)}S("viewport"),S(R("scissor.box"));var O=Object.keys(T).length>0,C={framebuffer:b,draw:w,shader:A,state:T,dirty:O,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(C.profile=function(t){var e,n=t.static,r=t.dynamic;if(jt in n){var i=!!n[jt];(e=ae((function(t,e){return i}))).enable=i}else if(jt in r){var o=r[jt];e=ue(o,(function(t,e){return t.invoke(e,o)}))}return e}(t),C.uniforms=function(t,e){var n=t.static,r=t.dynamic,i={};return Object.keys(n).forEach((function(t){var r,o=n[t];if("number"==typeof o||"boolean"==typeof o)r=ae((function(){return o}));else if("function"==typeof o){var a=o._reglType;"texture2d"===a||"textureCube"===a?r=ae((function(t){return t.link(o)})):"framebuffer"===a||"framebufferCube"===a?(E.command(o.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),r=ae((function(t){return t.link(o.color[0])}))):E.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else J(o)?r=ae((function(e){return e.global.def("[",N(o.length,(function(n){return E.command("number"==typeof o[n]||"boolean"==typeof o[n],"invalid uniform "+t,e.commandStr),o[n]})),"]")})):E.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);r.value=o,i[t]=r})),Object.keys(r).forEach((function(t){var e=r[t];i[t]=ue(e,(function(t,n){return t.invoke(n,e)}))})),i}(u,h),C.drawVAO=C.scopeVAO=function(t,e){var n=t.static,r=t.dynamic;if(qt in n){var i=n[qt];return null!==i&&null===f.getVAO(i)&&(i=f.createVAO(i)),ae((function(t){return t.link(f.getVAO(i))}))}if(qt in r){var o=r[qt];return ue(o,(function(t,e){var n=t.invoke(e,o);return e.def(t.shared.vao+".getVAO("+n+")")}))}return null}(t),!C.drawVAO&&A.program&&!m&&r.angle_instanced_arrays){var M=!0,I=A.program.attributes.map((function(t){var n=e.static[t];return M=M&&!!n,n}));if(M&&I.length>0){var P=f.getVAO(f.createVAO(I));C.drawVAO=new ie(null,null,null,(function(t,e){return t.link(P)})),C.useVAO=!0}}return m?C.useVAO=!0:C.attributes=function(t,e){var r=t.static,i=t.dynamic,a={};return Object.keys(r).forEach((function(t){var i=r[t],u=n.id(t),s=new v;if(ne(i))s.state=1,s.buffer=o.getBuffer(o.create(i,34962,!1,!0)),s.type=0;else{var c=o.getBuffer(i);if(c)s.state=1,s.buffer=c,s.type=0;else if(E.command("object"==typeof i&&i,"invalid data for attribute "+t,e.commandStr),"constant"in i){var f=i.constant;s.buffer="null",s.state=2,"number"==typeof f?s.x=f:(E.command(J(f)&&f.length>0&&f.length<=4,"invalid constant for attribute "+t,e.commandStr),Lt.forEach((function(t,e){e<f.length&&(s[t]=f[e])})))}else{c=ne(i.buffer)?o.getBuffer(o.create(i.buffer,34962,!1,!0)):o.getBuffer(i.buffer),E.command(!!c,'missing buffer for attribute "'+t+'"',e.commandStr);var l=0|i.offset;E.command(l>=0,'invalid offset for attribute "'+t+'"',e.commandStr);var h=0|i.stride;E.command(h>=0&&h<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',e.commandStr);var d=0|i.size;E.command(!("size"in i)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',e.commandStr);var p=!!i.normalized,m=0;"type"in i&&(E.commandParameter(i.type,G,"invalid type for attribute "+t,e.commandStr),m=G[i.type]);var g=0|i.divisor;"divisor"in i&&(E.command(0===g||y,'cannot specify divisor for attribute "'+t+'", instancing not supported',e.commandStr),E.command(g>=0,'invalid divisor for attribute "'+t+'"',e.commandStr)),E.optional((function(){var n=e.commandStr,r=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach((function(e){E.command(r.indexOf(e)>=0,'unknown parameter "'+e+'" for attribute pointer "'+t+'" (valid parameters are '+r+")",n)}))})),s.buffer=c,s.state=1,s.size=d,s.normalized=p,s.type=m||c.dtype,s.offset=l,s.stride=h,s.divisor=g}}a[t]=ae((function(t,e){var n=t.attribCache;if(u in n)return n[u];var r={isStream:!1};return Object.keys(s).forEach((function(t){r[t]=s[t]})),s.buffer&&(r.buffer=t.link(s.buffer),r.type=r.type||r.buffer+".dtype"),n[u]=r,r}))})),Object.keys(i).forEach((function(t){var e=i[t];a[t]=ue(e,(function(n,r){var i=n.invoke(r,e),o=n.shared,a=n.constants,u=o.isBufferArgs,s=o.buffer;E.optional((function(){n.assert(r,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+u+"("+i+")||"+s+".getBuffer("+i+")||"+s+".getBuffer("+i+".buffer)||"+u+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')}));var c={isStream:r.def(!1)},f=new v;f.state=1,Object.keys(f).forEach((function(t){c[t]=r.def(""+f[t])}));var l=c.buffer,h=c.type;function d(t){r(c[t],"=",i,".",t,"|0;")}return r("if(",u,"(",i,")){",c.isStream,"=true;",l,"=",s,".createStream(",34962,",",i,");",h,"=",l,".dtype;","}else{",l,"=",s,".getBuffer(",i,");","if(",l,"){",h,"=",l,".dtype;",'}else if("constant" in ',i,"){",c.state,"=",2,";","if(typeof "+i+'.constant === "number"){',c[Lt[0]],"=",i,".constant;",Lt.slice(1).map((function(t){return c[t]})).join("="),"=0;","}else{",Lt.map((function(t,e){return c[t]+"="+i+".constant.length>"+e+"?"+i+".constant["+e+"]:0;"})).join(""),"}}else{","if(",u,"(",i,".buffer)){",l,"=",s,".createStream(",34962,",",i,".buffer);","}else{",l,"=",s,".getBuffer(",i,".buffer);","}",h,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",l,".dtype;",c.normalized,"=!!",i,".normalized;"),d("size"),d("offset"),d("stride"),d("divisor"),r("}}"),r.exit("if(",c.isStream,"){",s,".destroyStream(",l,");","}"),c}))})),a}(e,h),C.context=function(t){var e=t.static,n=t.dynamic,r={};return Object.keys(e).forEach((function(t){var n=e[t];r[t]=ae((function(t,e){return"number"==typeof n||"boolean"==typeof n?""+n:t.link(n)}))})),Object.keys(n).forEach((function(t){var e=n[t];r[t]=ue(e,(function(t,n){return t.invoke(n,e)}))})),r}(c),C}function L(t,e,n){var r=t.shared.context,i=t.scope();Object.keys(n).forEach((function(o){e.save(r,"."+o);var a=n[o].append(t,e);Array.isArray(a)?i(r,".",o,"=[",a.join(),"];"):i(r,".",o,"=",a,";")})),e(i)}function j(t,e,n,r){var i,o=t.shared,a=o.gl,u=o.framebuffer;b&&(i=e.def(o.extensions,".webgl_draw_buffers"));var s,c=t.constants,f=c.drawBuffer,l=c.backBuffer;s=n?n.append(t,e):e.def(u,".next"),r||e("if(",s,"!==",u,".cur){"),e("if(",s,"){",a,".bindFramebuffer(",36160,",",s,".framebuffer);"),b&&e(i,".drawBuffersWEBGL(",f,"[",s,".colorAttachments.length]);"),e("}else{",a,".bindFramebuffer(",36160,",null);"),b&&e(i,".drawBuffersWEBGL(",l,");"),e("}",u,".cur=",s,";"),r||e("}")}function F(t,e,n){var r=t.shared,i=r.gl,o=t.current,a=t.next,u=r.current,s=r.next,c=t.cond(u,".dirty");x.forEach((function(e){var r,f,l=R(e);if(!(l in n.state))if(l in a){r=a[l],f=o[l];var h=N(_[l].length,(function(t){return c.def(r,"[",t,"]")}));c(t.cond(h.map((function(t,e){return t+"!=="+f+"["+e+"]"})).join("||")).then(i,".",A[l],"(",h,");",h.map((function(t,e){return f+"["+e+"]="+t})).join(";"),";"))}else{r=c.def(s,".",l);var d=t.cond(r,"!==",u,".",l);c(d),l in T?d(t.cond(r).then(i,".enable(",T[l],");").else(i,".disable(",T[l],");"),u,".",l,"=",r,";"):d(i,".",A[l],"(",r,");",u,".",l,"=",r,";")}})),0===Object.keys(n.state).length&&c(u,".dirty=false;"),e(c)}function B(t,e,n,r){var i=t.shared,o=t.current,a=i.current,u=i.gl;re(Object.keys(n)).forEach((function(i){var s=n[i];if(!r||r(s)){var c=s.append(t,e);if(T[i]){var f=T[i];oe(s)?e(u,c?".enable(":".disable(",f,");"):e(t.cond(c).then(u,".enable(",f,");").else(u,".disable(",f,");")),e(a,".",i,"=",c,";")}else if(J(c)){var l=o[i];e(u,".",A[i],"(",c,");",c.map((function(t,e){return l+"["+e+"]="+t})).join(";"),";")}else e(u,".",A[i],"(",c,");",a,".",i,"=",c,";")}}))}function U(t,e){y&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function V(t,e,n,r,i){var o,a,u,s=t.shared,c=t.stats,f=s.current,l=s.timer,h=n.profile;function d(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function m(t){t(o=e.def(),"=",d(),";"),"string"==typeof i?t(c,".count+=",i,";"):t(c,".count++;"),p&&(r?t(a=e.def(),"=",l,".getNumPendingQueries();"):t(l,".beginQuery(",c,");"))}function v(t){t(c,".cpuTime+=",d(),"-",o,";"),p&&(r?t(l,".pushScopeStats(",a,",",l,".getNumPendingQueries(),",c,");"):t(l,".endQuery();"))}function g(t){var n=e.def(f,".profile");e(f,".profile=",t,";"),e.exit(f,".profile=",n,";")}if(h){if(oe(h))return void(h.enable?(m(e),v(e.exit),g("true")):g("false"));g(u=h.append(t,e))}else u=e.def(f,".profile");var y=t.block();m(y),e("if(",u,"){",y,"}");var b=t.block();v(b),e.exit("if(",u,"){",b,"}")}function z(t,e,n,r,i){var o=t.shared;r.forEach((function(r){var a,u=r.name,s=n.attributes[u];if(s){if(!i(s))return;a=s.append(t,e)}else{if(!i(se))return;var c=t.scopeAttrib(u);E.optional((function(){t.assert(e,c+".state","missing attribute "+u)})),a={},Object.keys(new v).forEach((function(t){a[t]=e.def(c,".",t)}))}!function(n,r,i){var a=o.gl,u=e.def(n,".location"),s=e.def(o.attributes,"[",u,"]"),c=i.state,f=i.buffer,l=[i.x,i.y,i.z,i.w],h=["buffer","normalized","offset","stride"];function d(){e("if(!",s,".buffer){",a,".enableVertexAttribArray(",u,");}");var n,o=i.type;if(n=i.size?e.def(i.size,"||",r):r,e("if(",s,".type!==",o,"||",s,".size!==",n,"||",h.map((function(t){return s+"."+t+"!=="+i[t]})).join("||"),"){",a,".bindBuffer(",34962,",",f,".buffer);",a,".vertexAttribPointer(",[u,n,o,i.normalized,i.stride,i.offset],");",s,".type=",o,";",s,".size=",n,";",h.map((function(t){return s+"."+t+"="+i[t]+";"})).join(""),"}"),y){var c=i.divisor;e("if(",s,".divisor!==",c,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,c],");",s,".divisor=",c,";}")}}function p(){e("if(",s,".buffer){",a,".disableVertexAttribArray(",u,");",s,".buffer=null;","}if(",Lt.map((function(t,e){return s+"."+t+"!=="+l[e]})).join("||"),"){",a,".vertexAttrib4f(",u,",",l,");",Lt.map((function(t,e){return s+"."+t+"="+l[e]+";"})).join(""),"}")}1===c?d():2===c?p():(e("if(",c,"===",1,"){"),d(),e("}else{"),p(),e("}"))}(t.link(r),function(t){switch(t){case 35664:case 35667:case 35671:return 2;case 35665:case 35668:case 35672:return 3;case 35666:case 35669:case 35673:return 4;default:return 1}}(r.info.type),a)}))}function W(t,e,r,i,o){for(var a,u=t.shared,s=u.gl,c=0;c<i.length;++c){var f,l=i[c],h=l.name,d=l.info.type,p=r.uniforms[h],m=t.link(l)+".location";if(p){if(!o(p))continue;if(oe(p)){var v=p.value;if(E.command(null!=v,'missing uniform "'+h+'"',t.commandStr),35678===d||35680===d){E.command("function"==typeof v&&(35678===d&&("texture2d"===v._reglType||"framebuffer"===v._reglType)||35680===d&&("textureCube"===v._reglType||"framebufferCube"===v._reglType)),"invalid texture for uniform "+h,t.commandStr);var g=t.link(v._texture||v.color[0]._texture);e(s,".uniform1i(",m,",",g+".bind());"),e.exit(g,".unbind();")}else if(35674===d||35675===d||35676===d){E.optional((function(){E.command(J(v),"invalid matrix for uniform "+h,t.commandStr),E.command(35674===d&&4===v.length||35675===d&&9===v.length||35676===d&&16===v.length,"invalid length for matrix uniform "+h,t.commandStr)}));var y=t.global.def("new Float32Array(["+Array.prototype.slice.call(v)+"])"),b=2;35675===d?b=3:35676===d&&(b=4),e(s,".uniformMatrix",b,"fv(",m,",false,",y,");")}else{switch(d){case 5126:E.commandType(v,"number","uniform "+h,t.commandStr),a="1f";break;case 35664:E.command(J(v)&&2===v.length,"uniform "+h,t.commandStr),a="2f";break;case 35665:E.command(J(v)&&3===v.length,"uniform "+h,t.commandStr),a="3f";break;case 35666:E.command(J(v)&&4===v.length,"uniform "+h,t.commandStr),a="4f";break;case 35670:E.commandType(v,"boolean","uniform "+h,t.commandStr),a="1i";break;case 5124:E.commandType(v,"number","uniform "+h,t.commandStr),a="1i";break;case 35671:case 35667:E.command(J(v)&&2===v.length,"uniform "+h,t.commandStr),a="2i";break;case 35672:case 35668:E.command(J(v)&&3===v.length,"uniform "+h,t.commandStr),a="3i";break;case 35673:case 35669:E.command(J(v)&&4===v.length,"uniform "+h,t.commandStr),a="4i"}e(s,".uniform",a,"(",m,",",J(v)?Array.prototype.slice.call(v):v,");")}continue}f=p.append(t,e)}else{if(!o(se))continue;f=e.def(u.uniforms,"[",n.id(h),"]")}35678===d?(E(!Array.isArray(f),"must specify a scalar prop for textures"),e("if(",f,"&&",f,'._reglType==="framebuffer"){',f,"=",f,".color[0];","}")):35680===d&&(E(!Array.isArray(f),"must specify a scalar prop for cube maps"),e("if(",f,"&&",f,'._reglType==="framebufferCube"){',f,"=",f,".color[0];","}")),E.optional((function(){function n(n,r){t.assert(e,n,'bad data or missing for uniform "'+h+'". '+r)}function r(t){E(!Array.isArray(f),"must not specify an array type for uniform"),n("typeof "+f+'==="'+t+'"',"invalid type, expected "+t)}function i(e,r){Array.isArray(f)?E(f.length===e,"must have length "+e):n(u.isArrayLike+"("+f+")&&"+f+".length==="+e,"invalid vector, should have length "+e,t.commandStr)}function o(e){E(!Array.isArray(f),"must not specify a value type"),n("typeof "+f+'==="function"&&'+f+'._reglType==="texture'+(3553===e?"2d":"Cube")+'"',"invalid texture type",t.commandStr)}switch(d){case 5124:r("number");break;case 35667:i(2);break;case 35668:i(3);break;case 35669:i(4);break;case 5126:r("number");break;case 35664:i(2);break;case 35665:i(3);break;case 35666:i(4);break;case 35670:r("boolean");break;case 35671:i(2);break;case 35672:i(3);break;case 35673:case 35674:i(4);break;case 35675:i(9);break;case 35676:i(16);break;case 35678:o(3553);break;case 35680:o(34067)}}));var _=1;switch(d){case 35678:case 35680:var w=e.def(f,"._texture");e(s,".uniform1i(",m,",",w,".bind());"),e.exit(w,".unbind();");continue;case 5124:case 35670:a="1i";break;case 35667:case 35671:a="2i",_=2;break;case 35668:case 35672:a="3i",_=3;break;case 35669:case 35673:a="4i",_=4;break;case 5126:a="1f";break;case 35664:a="2f",_=2;break;case 35665:a="3f",_=3;break;case 35666:a="4f",_=4;break;case 35674:a="Matrix2fv";break;case 35675:a="Matrix3fv";break;case 35676:a="Matrix4fv"}if(e(s,".uniform",a,"(",m,","),"M"===a.charAt(0)){var x=Math.pow(d-35674+2,2),T=t.global.def("new Float32Array(",x,")");Array.isArray(f)?e("false,(",N(x,(function(t){return T+"["+t+"]="+f[t]})),",",T,")"):e("false,(Array.isArray(",f,")||",f," instanceof Float32Array)?",f,":(",N(x,(function(t){return T+"["+t+"]="+f+"["+t+"]"})),",",T,")")}else _>1?e(N(_,(function(t){return Array.isArray(f)?f[t]:f+"["+t+"]"}))):(E(!Array.isArray(f),"uniform value must not be an array"),e(f));e(");")}}function H(t,e,n,r){var i=t.shared,o=i.gl,a=i.draw,u=r.draw,s=function(){var i,s=u.elements,c=e;return s?((s.contextDep&&r.contextDynamic||s.propDep)&&(c=n),i=s.append(t,c)):i=c.def(a,".",Gt),i&&c("if("+i+")"+o+".bindBuffer(34963,"+i+".buffer.buffer);"),i}();function c(i){var o=u[i];return o?o.contextDep&&r.contextDynamic||o.propDep?o.append(t,n):o.append(t,e):e.def(a,".",i)}var f,l,h=c(Vt),d=c(Wt),p=function(){var i,o=u.count,s=e;return o?((o.contextDep&&r.contextDynamic||o.propDep)&&(s=n),i=o.append(t,s),E.optional((function(){o.MISSING&&t.assert(e,"false","missing vertex count"),o.DYNAMIC&&t.assert(s,i+">=0","missing vertex count")}))):(i=s.def(a,".",zt),E.optional((function(){t.assert(s,i+">=0","missing vertex count")}))),i}();if("number"==typeof p){if(0===p)return}else n("if(",p,"){"),n.exit("}");y&&(f=c(Ht),l=t.instancing);var m=s+".type",v=u.elements&&oe(u.elements);function g(){function t(){n(l,".drawElementsInstancedANGLE(",[h,p,m,d+"<<(("+m+"-5121)>>1)",f],");")}function e(){n(l,".drawArraysInstancedANGLE(",[h,d,p,f],");")}s?v?t():(n("if(",s,"){"),t(),n("}else{"),e(),n("}")):e()}function b(){function t(){n(o+".drawElements("+[h,p,m,d+"<<(("+m+"-5121)>>1)"]+");")}function e(){n(o+".drawArrays("+[h,d,p]+");")}s?v?t():(n("if(",s,"){"),t(),n("}else{"),e(),n("}")):e()}y&&("number"!=typeof f||f>=0)?"string"==typeof f?(n("if(",f,">0){"),g(),n("}else if(",f,"<0){"),b(),n("}")):g():b()}function q(t,e,n,r,i){var o=k(),a=o.proc("body",i);return E.optional((function(){o.commandStr=e.commandStr,o.command=o.link(e.commandStr)})),y&&(o.instancing=a.def(o.shared.extensions,".angle_instanced_arrays")),t(o,a,n,r),o.compile().body}function X(t,e,n,r){U(t,e),n.useVAO?n.drawVAO?e(t.shared.vao,".setVAO(",n.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),z(t,e,n,r.attributes,(function(){return!0}))),W(t,e,n,r.uniforms,(function(){return!0})),H(t,e,e,n)}function Y(t,e,n,r){function i(){return!0}t.batchId="a1",U(t,e),z(t,e,n,r.attributes,i),W(t,e,n,r.uniforms,i),H(t,e,e,n)}function Q(t,e,n,r){U(t,e);var i=n.contextDep,o=e.def(),a=e.def();t.shared.props=a,t.batchId=o;var u=t.scope(),s=t.scope();function c(t){return t.contextDep&&i||t.propDep}function f(t){return!c(t)}if(e(u.entry,"for(",o,"=0;",o,"<","a1",";++",o,"){",a,"=","a0","[",o,"];",s,"}",u.exit),n.needsContext&&L(t,s,n.context),n.needsFramebuffer&&j(t,s,n.framebuffer),B(t,s,n.state,c),n.profile&&c(n.profile)&&V(t,s,n,!1,!0),r)n.useVAO?n.drawVAO?c(n.drawVAO)?s(t.shared.vao,".setVAO(",n.drawVAO.append(t,s),");"):u(t.shared.vao,".setVAO(",n.drawVAO.append(t,u),");"):u(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(u(t.shared.vao,".setVAO(null);"),z(t,u,n,r.attributes,f),z(t,s,n,r.attributes,c)),W(t,u,n,r.uniforms,f),W(t,s,n,r.uniforms,c),H(t,u,s,n);else{var l=t.global.def("{}"),h=n.shader.progVar.append(t,s),d=s.def(h,".id"),p=s.def(l,"[",d,"]");s(t.shared.gl,".useProgram(",h,".program);","if(!",p,"){",p,"=",l,"[",d,"]=",t.link((function(e){return q(Y,t,n,e,2)})),"(",h,");}",p,".call(this,a0[",o,"],",o,");")}}function $(t,e,n){var r=e.static[n];if(r&&function(t){if("object"==typeof t&&!J(t)){for(var e=Object.keys(t),n=0;n<e.length;++n)if(S.isDynamic(t[e[n]]))return!0;return!1}}(r)){var i=t.global,o=Object.keys(r),a=!1,u=!1,s=!1,c=t.global.def("{}");o.forEach((function(e){var n=r[e];if(S.isDynamic(n)){"function"==typeof n&&(n=r[e]=S.unbox(n));var o=ue(n,null);a=a||o.thisDep,s=s||o.propDep,u=u||o.contextDep}else{switch(i(c,".",e,"="),typeof n){case"number":i(n);break;case"string":i('"',n,'"');break;case"object":Array.isArray(n)&&i("[",n.join(),"]");break;default:i(t.link(n))}i(";")}})),e.dynamic[n]=new S.DynamicVariable(4,{thisDep:a,contextDep:u,propDep:s,ref:c,append:function(t,e){o.forEach((function(n){var i=r[n];if(S.isDynamic(i)){var o=t.invoke(e,i);e(c,".",n,"=",o,";")}}))}}),delete e.static[n]}}return{next:w,current:_,procs:function(){var t=k(),e=t.proc("poll"),n=t.proc("refresh"),o=t.block();e(o),n(o);var a,u=t.shared,s=u.gl,c=u.next,f=u.current;o(f,".dirty=false;"),j(t,e),j(t,n,null,!0),y&&(a=t.link(y)),r.oes_vertex_array_object&&n(t.link(r.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var l=0;l<i.maxAttributes;++l){var h=n.def(u.attributes,"[",l,"]"),d=t.cond(h,".buffer");d.then(s,".enableVertexAttribArray(",l,");",s,".bindBuffer(",34962,",",h,".buffer.buffer);",s,".vertexAttribPointer(",l,",",h,".size,",h,".type,",h,".normalized,",h,".stride,",h,".offset);").else(s,".disableVertexAttribArray(",l,");",s,".vertexAttrib4f(",l,",",h,".x,",h,".y,",h,".z,",h,".w);",h,".buffer=null;"),n(d),y&&n(a,".vertexAttribDivisorANGLE(",l,",",h,".divisor);")}return n(t.shared.vao,".currentVAO=null;",t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"),Object.keys(T).forEach((function(r){var i=T[r],a=o.def(c,".",r),u=t.block();u("if(",a,"){",s,".enable(",i,")}else{",s,".disable(",i,")}",f,".",r,"=",a,";"),n(u),e("if(",a,"!==",f,".",r,"){",u,"}")})),Object.keys(A).forEach((function(r){var i,a,u=A[r],l=_[r],h=t.block();if(h(s,".",u,"("),J(l)){var d=l.length;i=t.global.def(c,".",r),a=t.global.def(f,".",r),h(N(d,(function(t){return i+"["+t+"]"})),");",N(d,(function(t){return a+"["+t+"]="+i+"["+t+"];"})).join("")),e("if(",N(d,(function(t){return i+"["+t+"]!=="+a+"["+t+"]"})).join("||"),"){",h,"}")}else i=o.def(c,".",r),a=o.def(f,".",r),h(i,");",f,".",r,"=",i,";"),e("if(",i,"!==",a,"){",h,"}");n(h)})),t.compile()}(),compile:function(t,r,i,o,a){var u=k();u.stats=u.link(a),Object.keys(r.static).forEach((function(t){$(u,r,t)})),Kt.forEach((function(e){$(u,t,e)}));var s=D(t,r,i,o,u);return function(t,e){var n=t.proc("draw",1);U(t,n),L(t,n,e.context),j(t,n,e.framebuffer),F(t,n,e),B(t,n,e.state),V(t,n,e,!1,!0);var r=e.shader.progVar.append(t,n);if(n(t.shared.gl,".useProgram(",r,".program);"),e.shader.program)X(t,n,e,e.shader.program);else{n(t.shared.vao,".setVAO(null);");var i=t.global.def("{}"),o=n.def(r,".id"),a=n.def(i,"[",o,"]");n(t.cond(a).then(a,".call(this,a0);").else(a,"=",i,"[",o,"]=",t.link((function(n){return q(X,t,e,n,1)})),"(",r,");",a,".call(this,a0);"))}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}(u,s),function(t,e){var r=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;function a(n){var o=e.shader[n];o&&r.set(i.shader,"."+n,o.append(t,r))}L(t,r,e.context),e.framebuffer&&e.framebuffer.append(t,r),re(Object.keys(e.state)).forEach((function(n){var o=e.state[n].append(t,r);J(o)?o.forEach((function(e,i){r.set(t.next[n],"["+i+"]",e)})):r.set(i.next,"."+n,o)})),V(t,r,e,!0,!0),[Gt,Wt,zt,Ht,Vt].forEach((function(n){var o=e.draw[n];o&&r.set(i.draw,"."+n,""+o.append(t,r))})),Object.keys(e.uniforms).forEach((function(o){var a=e.uniforms[o].append(t,r);Array.isArray(a)&&(a="["+a.join()+"]"),r.set(i.uniforms,"["+n.id(o)+"]",a)})),Object.keys(e.attributes).forEach((function(n){var i=e.attributes[n].append(t,r),o=t.scopeAttrib(n);Object.keys(new v).forEach((function(t){r.set(o,"."+t,i[t])}))})),e.scopeVAO&&r.set(i.vao,".targetVAO",e.scopeVAO.append(t,r)),a(Bt),a(Ut),Object.keys(e.state).length>0&&(r(o,".dirty=true;"),r.exit(o,".dirty=true;")),r("a1(",t.shared.context,",a0,",t.batchId,");")}(u,s),function(t,e){var n=t.proc("batch",2);t.batchId="0",U(t,n);var r=!1,i=!0;Object.keys(e.context).forEach((function(t){r=r||e.context[t].propDep})),r||(L(t,n,e.context),i=!1);var o=e.framebuffer,a=!1;function u(t){return t.contextDep&&r||t.propDep}o?(o.propDep?r=a=!0:o.contextDep&&r&&(a=!0),a||j(t,n,o)):j(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(r=!0),F(t,n,e),B(t,n,e.state,(function(t){return!u(t)})),e.profile&&u(e.profile)||V(t,n,e,!1,"a1"),e.contextDep=r,e.needsContext=i,e.needsFramebuffer=a;var s=e.shader.progVar;if(s.contextDep&&r||s.propDep)Q(t,n,e,null);else{var c=s.append(t,n);if(n(t.shared.gl,".useProgram(",c,".program);"),e.shader.program)Q(t,n,e,e.shader.program);else{n(t.shared.vao,".setVAO(null);");var f=t.global.def("{}"),l=n.def(c,".id"),h=n.def(f,"[",l,"]");n(t.cond(h).then(h,".call(this,a0,a1);").else(h,"=",f,"[",l,"]=",t.link((function(n){return q(Q,t,e,n,2)})),"(",c,");",h,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}(u,s),e(u.compile(),{destroy:function(){s.shader.program.destroy()}})}}}var fe=function(t,e){if(!e.ext_disjoint_timer_query)return null;var n=[];function r(t){n.push(t)}var i=[];function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var a=[];function u(t){a.push(t)}var s=[];function c(t,e,n){var r=a.pop()||new o;r.startQueryIndex=t,r.endQueryIndex=e,r.sum=0,r.stats=n,s.push(r)}var f=[],l=[];return{beginQuery:function(t){var r=n.pop()||e.ext_disjoint_timer_query.createQueryEXT();e.ext_disjoint_timer_query.beginQueryEXT(35007,r),i.push(r),c(i.length-1,i.length,t)},endQuery:function(){e.ext_disjoint_timer_query.endQueryEXT(35007)},pushScopeStats:c,update:function(){var t,n,o=i.length;if(0!==o){l.length=Math.max(l.length,o+1),f.length=Math.max(f.length,o+1),f[0]=0,l[0]=0;var a=0;for(t=0,n=0;n<i.length;++n){var c=i[n];e.ext_disjoint_timer_query.getQueryObjectEXT(c,34919)?(a+=e.ext_disjoint_timer_query.getQueryObjectEXT(c,34918),r(c)):i[t++]=c,f[n+1]=a,l[n+1]=t}for(i.length=t,t=0,n=0;n<s.length;++n){var h=s[n],d=h.startQueryIndex,p=h.endQueryIndex;h.sum+=f[p]-f[d];var m=l[d],v=l[p];v===m?(h.stats.gpuTime+=h.sum/1e6,u(h)):(h.startQueryIndex=m,h.endQueryIndex=v,s[t++]=h)}s.length=t}},getNumPendingQueries:function(){return i.length},clear:function(){n.push.apply(n,i);for(var t=0;t<n.length;t++)e.ext_disjoint_timer_query.deleteQueryEXT(n[t]);i.length=0,n.length=0},restore:function(){i.length=0,n.length=0}}};function le(t,e){for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}return function(n){var r=I(n);if(!r)return null;var i=r.gl,o=i.getContextAttributes(),a=i.isContextLost(),u=function(t,e){var n={};function r(e){E.type(e,"string","extension name must be string");var r,i=e.toLowerCase();try{r=n[i]=t.getExtension(i)}catch(t){}return!!r}for(var i=0;i<e.extensions.length;++i){var o=e.extensions[i];if(!r(o))return e.onDestroy(),e.onDone('"'+o+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return e.optionalExtensions.forEach(r),{extensions:n,restore:function(){Object.keys(n).forEach((function(t){if(n[t]&&!r(t))throw new Error("(regl): error restoring extension "+t)}))}}}(i,r);if(!u)return null;var s,c,f=(s={"":0},c=[""],{id:function(t){var e=s[t];return e||(e=s[t]=c.length,c.push(t),e)},str:function(t){return c[t]}}),l={vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},h=u.extensions,d=fe(0,h),p=O(),m=i.drawingBufferWidth,v=i.drawingBufferHeight,g={tick:0,time:0,viewportWidth:m,viewportHeight:v,framebufferWidth:m,framebufferHeight:v,drawingBufferWidth:m,drawingBufferHeight:v,pixelRatio:r.pixelRatio},y=function(t,e){var n=1;e.ext_texture_filter_anisotropic&&(n=t.getParameter(34047));var r=1,i=1;e.webgl_draw_buffers&&(r=t.getParameter(34852),i=t.getParameter(36063));var o=!!e.oes_texture_float;if(o){var a=t.createTexture();t.bindTexture(3553,a),t.texImage2D(3553,0,6408,1,1,0,6408,5126,null);var u=t.createFramebuffer();if(t.bindFramebuffer(36160,u),t.framebufferTexture2D(36160,36064,3553,a,0),t.bindTexture(3553,null),36053!==t.checkFramebufferStatus(36160))o=!1;else{t.viewport(0,0,1,1),t.clearColor(1,0,0,1),t.clear(16384);var s=D.allocType(5126,4);t.readPixels(0,0,1,1,6408,5126,s),t.getError()?o=!1:(t.deleteFramebuffer(u),t.deleteTexture(a),o=1===s[0]),D.freeType(s)}}var c=!0;if("undefined"==typeof navigator||!(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent))){var f=t.createTexture(),l=D.allocType(5121,36);t.activeTexture(33984),t.bindTexture(34067,f),t.texImage2D(34069,0,6408,3,3,0,6408,5121,l),D.freeType(l),t.bindTexture(34067,null),t.deleteTexture(f),c=!t.getError()}return{colorBits:[t.getParameter(3410),t.getParameter(3411),t.getParameter(3412),t.getParameter(3413)],depthBits:t.getParameter(3414),stencilBits:t.getParameter(3415),subpixelBits:t.getParameter(3408),extensions:Object.keys(e).filter((function(t){return!!e[t]})),maxAnisotropic:n,maxDrawbuffers:r,maxColorAttachments:i,pointSizeDims:t.getParameter(33901),lineWidthDims:t.getParameter(33902),maxViewportDims:t.getParameter(3386),maxCombinedTextureUnits:t.getParameter(35661),maxCubeMapSize:t.getParameter(34076),maxRenderbufferSize:t.getParameter(34024),maxTextureUnits:t.getParameter(34930),maxTextureSize:t.getParameter(3379),maxAttributes:t.getParameter(34921),maxVertexUniforms:t.getParameter(36347),maxVertexTextureUnits:t.getParameter(35660),maxVaryingVectors:t.getParameter(36348),maxFragmentUniforms:t.getParameter(36349),glsl:t.getParameter(35724),renderer:t.getParameter(7937),vendor:t.getParameter(7936),version:t.getParameter(7938),readFloat:o,npotTextureCube:c}}(i,h),b=function(e,n,r,i){var o=0,a={};function u(t){this.id=o++,this.buffer=e.createBuffer(),this.type=t,this.usage=35044,this.byteLength=0,this.dimension=1,this.dtype=5121,this.persistentData=null,r.profile&&(this.stats={size:0})}u.prototype.bind=function(){e.bindBuffer(this.type,this.buffer)},u.prototype.destroy=function(){l(this)};var s=[];function c(t,n,r){t.byteLength=n.byteLength,e.bufferData(t.type,n,r)}function f(e,n,r,i,o,a){var u,s;if(e.usage=r,Array.isArray(n)){if(e.dtype=i||5126,n.length>0)if(Array.isArray(n[0])){u=W(n);for(var f=1,l=1;l<u.length;++l)f*=u[l];e.dimension=f,c(e,s=z(n,u,e.dtype),r),a?e.persistentData=s:D.freeType(s)}else if("number"==typeof n[0]){e.dimension=o;var h=D.allocType(e.dtype,n.length);X(h,n),c(e,h,r),a?e.persistentData=h:D.freeType(h)}else t(n[0])?(e.dimension=n[0].length,e.dtype=i||q(n[0])||5126,c(e,s=z(n,[n.length,n[0].length],e.dtype),r),a?e.persistentData=s:D.freeType(s)):E.raise("invalid buffer data")}else if(t(n))e.dtype=i||q(n),e.dimension=o,c(e,n,r),a&&(e.persistentData=new Uint8Array(new Uint8Array(n.buffer)));else if(L(n)){u=n.shape;var d=n.stride,p=n.offset,m=0,v=0,g=0,y=0;1===u.length?(m=u[0],v=1,g=d[0],y=0):2===u.length?(m=u[0],v=u[1],g=d[0],y=d[1]):E.raise("invalid shape"),e.dtype=i||q(n.data)||5126,e.dimension=v;var b=D.allocType(e.dtype,m*v);Y(b,n.data,m,v,g,y,p),c(e,b,r),a?e.persistentData=b:D.freeType(b)}else n instanceof ArrayBuffer?(e.dtype=5121,e.dimension=o,c(e,n,r),a&&(e.persistentData=new Uint8Array(new Uint8Array(n)))):E.raise("invalid buffer data")}function l(t){n.bufferCount--,i(t);var r=t.buffer;E(r,"buffer must not be deleted already"),e.deleteBuffer(r),t.buffer=null,delete a[t.id]}return r.profile&&(n.getTotalBufferSize=function(){var t=0;return Object.keys(a).forEach((function(e){t+=a[e].stats.size})),t}),{create:function(i,o,s,c){n.bufferCount++;var h=new u(o);function d(n){var i=35044,o=null,a=0,u=0,s=1;return Array.isArray(n)||t(n)||L(n)||n instanceof ArrayBuffer?o=n:"number"==typeof n?a=0|n:n&&(E.type(n,"object","buffer arguments must be an object, a number or an array"),"data"in n&&(E(null===o||Array.isArray(o)||t(o)||L(o),"invalid data for buffer"),o=n.data),"usage"in n&&(E.parameter(n.usage,V,"invalid buffer usage"),i=V[n.usage]),"type"in n&&(E.parameter(n.type,G,"invalid buffer type"),u=G[n.type]),"dimension"in n&&(E.type(n.dimension,"number","invalid dimension"),s=0|n.dimension),"length"in n&&(E.nni(a,"buffer length must be a nonnegative integer"),a=0|n.length)),h.bind(),o?f(h,o,i,u,s,c):(a&&e.bufferData(h.type,a,i),h.dtype=u||5121,h.usage=i,h.dimension=s,h.byteLength=a),r.profile&&(h.stats.size=h.byteLength*H[h.dtype]),d}function p(t,n){E(n+t.byteLength<=h.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+t.byteLength+" starting from offset "+n+" to a buffer of size "+h.byteLength),e.bufferSubData(h.type,n,t)}return a[h.id]=h,s||d(i),d._reglType="buffer",d._buffer=h,d.subdata=function(e,n){var r,i=0|(n||0);if(h.bind(),t(e)||e instanceof ArrayBuffer)p(e,i);else if(Array.isArray(e)){if(e.length>0)if("number"==typeof e[0]){var o=D.allocType(h.dtype,e.length);X(o,e),p(o,i),D.freeType(o)}else if(Array.isArray(e[0])||t(e[0])){r=W(e);var a=z(e,r,h.dtype);p(a,i),D.freeType(a)}else E.raise("invalid buffer data")}else if(L(e)){r=e.shape;var u=e.stride,s=0,c=0,f=0,l=0;1===r.length?(s=r[0],c=1,f=u[0],l=0):2===r.length?(s=r[0],c=r[1],f=u[0],l=u[1]):E.raise("invalid shape");var m=Array.isArray(e.data)?h.dtype:q(e.data),v=D.allocType(m,s*c);Y(v,e.data,s,c,f,l,e.offset),p(v,i),D.freeType(v)}else E.raise("invalid data for buffer subdata");return d},r.profile&&(d.stats=h.stats),d.destroy=function(){l(h)},d},createStream:function(t,e){var n=s.pop();return n||(n=new u(t)),n.bind(),f(n,e,35040,0,1,!1),n},destroyStream:function(t){s.push(t)},clear:function(){j(a).forEach(l),s.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof u?t._buffer:null},restore:function(){j(a).forEach((function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)}))},_initBuffer:f}}(i,l,r,(function(t){return _.destroyBuffer(t)})),_=function(e,n,r,i,o){for(var a=r.maxAttributes,u=new Array(a),s=0;s<a;++s)u[s]=new Nt;var c=0,f={},l={Record:Nt,scope:{},state:u,currentVAO:null,targetVAO:null,restore:h()?function(){h()&&j(f).forEach((function(t){t.refresh()}))}:function(){},createVAO:function(e){var r=new p;function u(e){E(Array.isArray(e),"arguments to vertex array constructor must be an array"),E(e.length<a,"too many attributes"),E(e.length>0,"must specify at least one attribute");var i={},s=r.attributes;s.length=e.length;for(var c=0;c<e.length;++c){var f,l=e[c],h=s[c]=new Nt,d=l.data||l;Array.isArray(d)||t(d)||L(d)?(r.buffers[c]&&(f=r.buffers[c],t(d)&&f._buffer.byteLength>=d.byteLength?f.subdata(d):(f.destroy(),r.buffers[c]=null)),r.buffers[c]||(f=r.buffers[c]=o.create(l,34962,!1,!0)),h.buffer=o.getBuffer(f),h.size=0|h.buffer.dimension,h.normalized=!1,h.type=h.buffer.dtype,h.offset=0,h.stride=0,h.divisor=0,h.state=1,i[c]=1):o.getBuffer(l)?(h.buffer=o.getBuffer(l),h.size=0|h.buffer.dimension,h.normalized=!1,h.type=h.buffer.dtype,h.offset=0,h.stride=0,h.divisor=0,h.state=1):o.getBuffer(l.buffer)?(h.buffer=o.getBuffer(l.buffer),h.size=0|(+l.size||h.buffer.dimension),h.normalized=!!l.normalized||!1,"type"in l?(E.parameter(l.type,G,"invalid buffer type"),h.type=G[l.type]):h.type=h.buffer.dtype,h.offset=0|(l.offset||0),h.stride=0|(l.stride||0),h.divisor=0|(l.divisor||0),h.state=1,E(h.size>=1&&h.size<=4,"size must be between 1 and 4"),E(h.offset>=0,"invalid offset"),E(h.stride>=0&&h.stride<=255,"stride must be between 0 and 255"),E(h.divisor>=0,"divisor must be positive"),E(!h.divisor||!!n.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in l?(E(c>0,"first attribute must not be a constant"),h.x=+l.x||0,h.y=+l.y||0,h.z=+l.z||0,h.w=+l.w||0,h.state=2):E(!1,"invalid attribute spec for location "+c)}for(var p=0;p<r.buffers.length;++p)!i[p]&&r.buffers[p]&&(r.buffers[p].destroy(),r.buffers[p]=null);return r.refresh(),u}return i.vaoCount+=1,u.destroy=function(){for(var t=0;t<r.buffers.length;++t)r.buffers[t]&&r.buffers[t].destroy();r.buffers.length=0,r.destroy()},u._vao=r,u._reglType="vao",u(e)},getVAO:function(t){return"function"==typeof t&&t._vao?t._vao:null},destroyBuffer:function(t){for(var n=0;n<u.length;++n){var r=u[n];r.buffer===t&&(e.disableVertexAttribArray(n),r.buffer=null)}},setVAO:h()?function(t){if(t!==l.currentVAO){var e=h();t?e.bindVertexArrayOES(t.vao):e.bindVertexArrayOES(null),l.currentVAO=t}}:function(t){if(t!==l.currentVAO){if(t)t.bindAttrs();else for(var n=d(),r=0;r<u.length;++r){var i=u[r];i.buffer?(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,i.size,i.type,i.normalized,i.stride,i.offfset),n&&i.divisor&&n.vertexAttribDivisorANGLE(r,i.divisor)):(e.disableVertexAttribArray(r),e.vertexAttrib4f(r,i.x,i.y,i.z,i.w))}l.currentVAO=t}},clear:h()?function(){j(f).forEach((function(t){t.destroy()}))}:function(){}};function h(){return n.oes_vertex_array_object}function d(){return n.angle_instanced_arrays}function p(){this.id=++c,this.attributes=[];var t=h();this.vao=t?t.createVertexArrayOES():null,f[this.id]=this,this.buffers=[]}return p.prototype.bindAttrs=function(){for(var t=d(),n=this.attributes,r=0;r<n.length;++r){var i=n[r];i.buffer?(e.enableVertexAttribArray(r),e.bindBuffer(34962,i.buffer.buffer),e.vertexAttribPointer(r,i.size,i.type,i.normalized,i.stride,i.offset),t&&i.divisor&&t.vertexAttribDivisorANGLE(r,i.divisor)):(e.disableVertexAttribArray(r),e.vertexAttrib4f(r,i.x,i.y,i.z,i.w))}for(var o=n.length;o<a;++o)e.disableVertexAttribArray(o)},p.prototype.refresh=function(){var t=h();t&&(t.bindVertexArrayOES(this.vao),this.bindAttrs(),l.currentVAO=this)},p.prototype.destroy=function(){if(this.vao){var t=h();this===l.currentVAO&&(l.currentVAO=null,t.bindVertexArrayOES(null)),t.deleteVertexArrayOES(this.vao),this.vao=null}f[this.id]&&(delete f[this.id],i.vaoCount-=1)},l}(i,h,y,l,b),w=function(e,n,r,i){var o={},a=0,u={uint8:5121,uint16:5123};function s(t){this.id=a++,o[this.id]=this,this.buffer=t,this.primType=4,this.vertCount=0,this.type=0}n.oes_element_index_uint&&(u.uint32=5125),s.prototype.bind=function(){this.buffer.bind()};var c=[];function f(i,o,a,u,s,c,f){var l;if(i.buffer.bind(),o){var h=f;f||t(o)&&(!L(o)||t(o.data))||(h=n.oes_element_index_uint?5125:5123),r._initBuffer(i.buffer,o,a,h,3)}else e.bufferData(34963,c,a),i.buffer.dtype=l||5121,i.buffer.usage=a,i.buffer.dimension=3,i.buffer.byteLength=c;if(l=f,!f){switch(i.buffer.dtype){case 5121:case 5120:l=5121;break;case 5123:case 5122:l=5123;break;case 5125:case 5124:l=5125;break;default:E.raise("unsupported type for element array")}i.buffer.dtype=l}i.type=l,E(5125!==l||!!n.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var d=s;d<0&&(d=i.buffer.byteLength,5123===l?d>>=1:5125===l&&(d>>=2)),i.vertCount=d;var p=u;if(u<0){p=4;var m=i.buffer.dimension;1===m&&(p=0),2===m&&(p=1),3===m&&(p=4)}i.primType=p}function l(t){i.elementsCount--,E(null!==t.buffer,"must not double destroy elements"),delete o[t.id],t.buffer.destroy(),t.buffer=null}return{create:function(e,n){var o=r.create(null,34963,!0),a=new s(o._buffer);function c(e){if(e)if("number"==typeof e)o(e),a.primType=4,a.vertCount=0|e,a.type=5121;else{var n=null,r=35044,i=-1,s=-1,l=0,h=0;Array.isArray(e)||t(e)||L(e)?n=e:(E.type(e,"object","invalid arguments for elements"),"data"in e&&(n=e.data,E(Array.isArray(n)||t(n)||L(n),"invalid data for element buffer")),"usage"in e&&(E.parameter(e.usage,V,"invalid element buffer usage"),r=V[e.usage]),"primitive"in e&&(E.parameter(e.primitive,K,"invalid element buffer primitive"),i=K[e.primitive]),"count"in e&&(E("number"==typeof e.count&&e.count>=0,"invalid vertex count for elements"),s=0|e.count),"type"in e&&(E.parameter(e.type,u,"invalid buffer type"),h=u[e.type]),"length"in e?l=0|e.length:(l=s,5123===h||5122===h?l*=2:5125!==h&&5124!==h||(l*=4))),f(a,n,r,i,s,l,h)}else o(),a.primType=4,a.vertCount=0,a.type=5121;return c}return i.elementsCount++,c(e),c._reglType="elements",c._elements=a,c.subdata=function(t,e){return o.subdata(t,e),c},c.destroy=function(){l(a)},c},createStream:function(t){var e=c.pop();return e||(e=new s(r.create(null,34963,!0,!1)._buffer)),f(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){c.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof s?t._elements:null},clear:function(){j(o).forEach(l)}}}(i,h,b,l),x=function(t,n,r,i){var o={},a={};function u(t,e,n,r){this.name=t,this.id=e,this.location=n,this.info=r}function s(t,e){for(var n=0;n<t.length;++n)if(t[n].id===e.id)return void(t[n].location=e.location);t.push(e)}function c(e,r,i){var u=35632===e?o:a,s=u[r];if(!s){var c=n.str(r);s=t.createShader(e),t.shaderSource(s,c),t.compileShader(s),E.shaderError(t,s,c,e,i),u[r]=s}return s}var f={},l=[],h=0;function d(t,e){this.id=h++,this.fragId=t,this.vertId=e,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,i.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function p(e,r,o){var a,f,l=c(35632,e.fragId),h=c(35633,e.vertId),d=e.program=t.createProgram();if(t.attachShader(d,l),t.attachShader(d,h),o)for(a=0;a<o.length;++a){var p=o[a];t.bindAttribLocation(d,p[0],p[1])}t.linkProgram(d),E.linkError(t,d,n.str(e.fragId),n.str(e.vertId),r);var m=t.getProgramParameter(d,35718);i.profile&&(e.stats.uniformsCount=m);var v=e.uniforms;for(a=0;a<m;++a)if(f=t.getActiveUniform(d,a))if(f.size>1)for(var g=0;g<f.size;++g){var y=f.name.replace("[0]","["+g+"]");s(v,new u(y,n.id(y),t.getUniformLocation(d,y),f))}else s(v,new u(f.name,n.id(f.name),t.getUniformLocation(d,f.name),f));var b=t.getProgramParameter(d,35721);i.profile&&(e.stats.attributesCount=b);var _=e.attributes;for(a=0;a<b;++a)(f=t.getActiveAttrib(d,a))&&s(_,new u(f.name,n.id(f.name),t.getAttribLocation(d,f.name),f))}return i.profile&&(r.getMaxUniformsCount=function(){var t=0;return l.forEach((function(e){e.stats.uniformsCount>t&&(t=e.stats.uniformsCount)})),t},r.getMaxAttributesCount=function(){var t=0;return l.forEach((function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)})),t}),{clear:function(){var e=t.deleteShader.bind(t);j(o).forEach(e),o={},j(a).forEach(e),a={},l.forEach((function(e){t.deleteProgram(e.program)})),l.length=0,f={},r.shaderCount=0},program:function(n,i,u,s){E.command(n>=0,"missing vertex shader",u),E.command(i>=0,"missing fragment shader",u);var c=f[i];c||(c=f[i]={});var h=c[n];if(h&&(h.refCount++,!s))return h;var m=new d(i,n);return r.shaderCount++,p(m,u,s),h||(c[n]=m),l.push(m),e(m,{destroy:function(){if(m.refCount--,m.refCount<=0){t.deleteProgram(m.program);var e=l.indexOf(m);l.splice(e,1),r.shaderCount--}c[m.vertId].refCount<=0&&(t.deleteShader(a[m.vertId]),delete a[m.vertId],delete f[m.fragId][m.vertId]),Object.keys(f[m.fragId]).length||(t.deleteShader(o[m.fragId]),delete o[m.fragId],delete f[m.fragId])}})},restore:function(){o={},a={};for(var t=0;t<l.length;++t)p(l[t],null,l[t].attributes.map((function(t){return[t.location,t.name]})))},shader:c,frag:-1,vert:-1}}(i,f,l,r),T=Tt(i,h,y,(function(){M.procs.poll()}),g,l,r),A=function(t,e,n,r,i){var o={rgba4:32854,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(o.srgba=35907),e.ext_color_buffer_half_float&&(o.rgba16f=34842,o.rgb16f=34843),e.webgl_color_buffer_float&&(o.rgba32f=34836);var a=[];Object.keys(o).forEach((function(t){var e=o[t];a[e]=t}));var u=0,s={};function c(t){this.id=u++,this.refCount=1,this.renderbuffer=t,this.format=32854,this.width=0,this.height=0,i.profile&&(this.stats={size:0})}function f(e){var n=e.renderbuffer;E(n,"must not double destroy renderbuffer"),t.bindRenderbuffer(36161,null),t.deleteRenderbuffer(n),e.renderbuffer=null,e.refCount=0,delete s[e.id],r.renderbufferCount--}return c.prototype.decRef=function(){--this.refCount<=0&&f(this)},i.profile&&(r.getTotalRenderbufferSize=function(){var t=0;return Object.keys(s).forEach((function(e){t+=s[e].stats.size})),t}),{create:function(e,u){var f=new c(t.createRenderbuffer());function l(e,r){var u=0,s=0,c=32854;if("object"==typeof e&&e){var h=e;if("shape"in h){var d=h.shape;E(Array.isArray(d)&&d.length>=2,"invalid renderbuffer shape"),u=0|d[0],s=0|d[1]}else"radius"in h&&(u=s=0|h.radius),"width"in h&&(u=0|h.width),"height"in h&&(s=0|h.height);"format"in h&&(E.parameter(h.format,o,"invalid renderbuffer format"),c=o[h.format])}else"number"==typeof e?(u=0|e,s="number"==typeof r?0|r:u):e?E.raise("invalid arguments to renderbuffer constructor"):u=s=1;if(E(u>0&&s>0&&u<=n.maxRenderbufferSize&&s<=n.maxRenderbufferSize,"invalid renderbuffer size"),u!==f.width||s!==f.height||c!==f.format)return l.width=f.width=u,l.height=f.height=s,f.format=c,t.bindRenderbuffer(36161,f.renderbuffer),t.renderbufferStorage(36161,c,u,s),E(0===t.getError(),"invalid render buffer format"),i.profile&&(f.stats.size=St(f.format,f.width,f.height)),l.format=a[f.format],l}return s[f.id]=f,r.renderbufferCount++,l(e,u),l.resize=function(e,r){var o=0|e,a=0|r||o;return o===f.width&&a===f.height||(E(o>0&&a>0&&o<=n.maxRenderbufferSize&&a<=n.maxRenderbufferSize,"invalid renderbuffer size"),l.width=f.width=o,l.height=f.height=a,t.bindRenderbuffer(36161,f.renderbuffer),t.renderbufferStorage(36161,f.format,o,a),E(0===t.getError(),"invalid render buffer format"),i.profile&&(f.stats.size=St(f.format,f.width,f.height))),l},l._reglType="renderbuffer",l._renderbuffer=f,i.profile&&(l.stats=f.stats),l.destroy=function(){f.decRef()},l},clear:function(){j(s).forEach(f)},restore:function(){j(s).forEach((function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)})),t.bindRenderbuffer(36161,null)}}}(i,h,y,l,r),C=function(t,n,r,i,o,a){var u={cur:null,next:null,dirty:!1,setFBO:null},s=["rgba"],c=["rgba4","rgb565","rgb5 a1"];n.ext_srgb&&c.push("srgba"),n.ext_color_buffer_half_float&&c.push("rgba16f","rgb16f"),n.webgl_color_buffer_float&&c.push("rgba32f");var f=["uint8"];function l(t,e,n){this.target=t,this.texture=e,this.renderbuffer=n;var r=0,i=0;e?(r=e.width,i=e.height):n&&(r=n.width,i=n.height),this.width=r,this.height=i}function h(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function d(t,e,n){if(t)if(t.texture){var r=t.texture._texture,i=Math.max(1,r.width),o=Math.max(1,r.height);E(i===e&&o===n,"inconsistent width/height for supplied texture"),r.refCount+=1}else{var a=t.renderbuffer._renderbuffer;E(a.width===e&&a.height===n,"inconsistent width/height for renderbuffer"),a.refCount+=1}}function p(e,n){n&&(n.texture?t.framebufferTexture2D(36160,e,n.target,n.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,n.renderbuffer._renderbuffer.renderbuffer))}function m(t){var e=3553,n=null,r=null,i=t;"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),E.type(i,"function","invalid attachment data");var o=i._reglType;return"texture2d"===o?(n=i,E(3553===e)):"textureCube"===o?(n=i,E(e>=34069&&e<34075,"invalid cube map target")):"renderbuffer"===o?(r=i,e=36161):E.raise("invalid regl object for attachment"),new l(e,n,r)}function v(t,e,n,r,a){if(n){var u=i.create2D({width:t,height:e,format:r,type:a});return u._texture.refCount=0,new l(3553,u,null)}var s=o.create({width:t,height:e,format:r});return s._renderbuffer.refCount=0,new l(36161,null,s)}function g(t){return t&&(t.texture||t.renderbuffer)}function y(t,e,n){t&&(t.texture?t.texture.resize(e,n):t.renderbuffer&&t.renderbuffer.resize(e,n),t.width=e,t.height=n)}n.oes_texture_half_float&&f.push("half float","float16"),n.oes_texture_float&&f.push("float","float32");var b=0,_={};function w(){this.id=b++,_[this.id]=this,this.framebuffer=t.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function x(t){t.colorAttachments.forEach(h),h(t.depthAttachment),h(t.stencilAttachment),h(t.depthStencilAttachment)}function T(e){var n=e.framebuffer;E(n,"must not double destroy framebuffer"),t.deleteFramebuffer(n),e.framebuffer=null,a.framebufferCount--,delete _[e.id]}function A(e){var n;t.bindFramebuffer(36160,e.framebuffer);var i=e.colorAttachments;for(n=0;n<i.length;++n)p(36064+n,i[n]);for(n=i.length;n<r.maxColorAttachments;++n)t.framebufferTexture2D(36160,36064+n,3553,null,0);t.framebufferTexture2D(36160,33306,3553,null,0),t.framebufferTexture2D(36160,36096,3553,null,0),t.framebufferTexture2D(36160,36128,3553,null,0),p(36096,e.depthAttachment),p(36128,e.stencilAttachment),p(33306,e.depthStencilAttachment);var o=t.checkFramebufferStatus(36160);t.isContextLost()||36053===o||E.raise("framebuffer configuration not supported, status = "+It[o]),t.bindFramebuffer(36160,u.next?u.next.framebuffer:null),u.cur=u.next,t.getError()}function S(t,i){var o=new w;function l(t,e){var i;E(u.next!==o,"can not update framebuffer which is currently in use");var a=0,h=0,p=!0,y=!0,b=null,_=!0,w="rgba",T="uint8",S=1,R=null,O=null,C=null,M=!1;if("number"==typeof t)a=0|t,h=0|e||a;else if(t){E.type(t,"object","invalid arguments for framebuffer");var I=t;if("shape"in I){var N=I.shape;E(Array.isArray(N)&&N.length>=2,"invalid shape for framebuffer"),a=N[0],h=N[1]}else"radius"in I&&(a=h=I.radius),"width"in I&&(a=I.width),"height"in I&&(h=I.height);("color"in I||"colors"in I)&&(b=I.color||I.colors,Array.isArray(b)&&E(1===b.length||n.webgl_draw_buffers,"multiple render targets not supported")),b||("colorCount"in I&&(S=0|I.colorCount,E(S>0,"invalid color buffer count")),"colorTexture"in I&&(_=!!I.colorTexture,w="rgba4"),"colorType"in I&&(T=I.colorType,_?(E(n.oes_texture_float||!("float"===T||"float32"===T),"you must enable OES_texture_float in order to use floating point framebuffer objects"),E(n.oes_texture_half_float||!("half float"===T||"float16"===T),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===T||"float16"===T?(E(n.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),w="rgba16f"):"float"!==T&&"float32"!==T||(E(n.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),w="rgba32f"),E.oneOf(T,f,"invalid color type")),"colorFormat"in I&&(w=I.colorFormat,s.indexOf(w)>=0?_=!0:c.indexOf(w)>=0?_=!1:_?E.oneOf(I.colorFormat,s,"invalid color format for texture"):E.oneOf(I.colorFormat,c,"invalid color format for renderbuffer"))),("depthTexture"in I||"depthStencilTexture"in I)&&(M=!(!I.depthTexture&&!I.depthStencilTexture),E(!M||n.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in I&&("boolean"==typeof I.depth?p=I.depth:(R=I.depth,y=!1)),"stencil"in I&&("boolean"==typeof I.stencil?y=I.stencil:(O=I.stencil,p=!1)),"depthStencil"in I&&("boolean"==typeof I.depthStencil?p=y=I.depthStencil:(C=I.depthStencil,p=!1,y=!1))}else a=h=1;var P=null,k=null,D=null,L=null;if(Array.isArray(b))P=b.map(m);else if(b)P=[m(b)];else for(P=new Array(S),i=0;i<S;++i)P[i]=v(a,h,_,w,T);E(n.webgl_draw_buffers||P.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),E(P.length<=r.maxColorAttachments,"too many color attachments, not supported"),a=a||P[0].width,h=h||P[0].height,R?k=m(R):p&&!y&&(k=v(a,h,M,"depth","uint32")),O?D=m(O):y&&!p&&(D=v(a,h,!1,"stencil","uint8")),C?L=m(C):!R&&!O&&y&&p&&(L=v(a,h,M,"depth stencil","depth stencil")),E(!!R+!!O+!!C<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var j=null;for(i=0;i<P.length;++i)if(d(P[i],a,h),E(!P[i]||P[i].texture&&Rt.indexOf(P[i].texture._texture.format)>=0||P[i].renderbuffer&&Mt.indexOf(P[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),P[i]&&P[i].texture){var F=Ot[P[i].texture._texture.format]*Ct[P[i].texture._texture.type];null===j?j=F:E(j===F,"all color attachments much have the same number of bits per pixel.")}return d(k,a,h),E(!k||k.texture&&6402===k.texture._texture.format||k.renderbuffer&&33189===k.renderbuffer._renderbuffer.format,"invalid depth attachment for framebuffer object"),d(D,a,h),E(!D||D.renderbuffer&&36168===D.renderbuffer._renderbuffer.format,"invalid stencil attachment for framebuffer object"),d(L,a,h),E(!L||L.texture&&34041===L.texture._texture.format||L.renderbuffer&&34041===L.renderbuffer._renderbuffer.format,"invalid depth-stencil attachment for framebuffer object"),x(o),o.width=a,o.height=h,o.colorAttachments=P,o.depthAttachment=k,o.stencilAttachment=D,o.depthStencilAttachment=L,l.color=P.map(g),l.depth=g(k),l.stencil=g(D),l.depthStencil=g(L),l.width=o.width,l.height=o.height,A(o),l}return a.framebufferCount++,l(t,i),e(l,{resize:function(t,e){E(u.next!==o,"can not resize a framebuffer which is currently in use");var n=Math.max(0|t,1),r=Math.max(0|e||n,1);if(n===o.width&&r===o.height)return l;for(var i=o.colorAttachments,a=0;a<i.length;++a)y(i[a],n,r);return y(o.depthAttachment,n,r),y(o.stencilAttachment,n,r),y(o.depthStencilAttachment,n,r),o.width=l.width=n,o.height=l.height=r,A(o),l},_reglType:"framebuffer",_framebuffer:o,destroy:function(){T(o),x(o)},use:function(t){u.setFBO({framebuffer:l},t)}})}return e(u,{getFramebuffer:function(t){if("function"==typeof t&&"framebuffer"===t._reglType){var e=t._framebuffer;if(e instanceof w)return e}return null},create:S,createCube:function(t){var o=Array(6);function a(t){var r;E(o.indexOf(u.next)<0,"can not update framebuffer which is currently in use");var c,l={color:null},h=0,d=null,p="rgba",m="uint8",v=1;if("number"==typeof t)h=0|t;else if(t){E.type(t,"object","invalid arguments for framebuffer");var g=t;if("shape"in g){var y=g.shape;E(Array.isArray(y)&&y.length>=2,"invalid shape for framebuffer"),E(y[0]===y[1],"cube framebuffer must be square"),h=y[0]}else"radius"in g&&(h=0|g.radius),"width"in g?(h=0|g.width,"height"in g&&E(g.height===h,"must be square")):"height"in g&&(h=0|g.height);("color"in g||"colors"in g)&&(d=g.color||g.colors,Array.isArray(d)&&E(1===d.length||n.webgl_draw_buffers,"multiple render targets not supported")),d||("colorCount"in g&&(v=0|g.colorCount,E(v>0,"invalid color buffer count")),"colorType"in g&&(E.oneOf(g.colorType,f,"invalid color type"),m=g.colorType),"colorFormat"in g&&(p=g.colorFormat,E.oneOf(g.colorFormat,s,"invalid color format for texture"))),"depth"in g&&(l.depth=g.depth),"stencil"in g&&(l.stencil=g.stencil),"depthStencil"in g&&(l.depthStencil=g.depthStencil)}else h=1;if(d)if(Array.isArray(d))for(c=[],r=0;r<d.length;++r)c[r]=d[r];else c=[d];else{c=Array(v);var b={radius:h,format:p,type:m};for(r=0;r<v;++r)c[r]=i.createCube(b)}for(l.color=Array(c.length),r=0;r<c.length;++r){var _=c[r];E("function"==typeof _&&"textureCube"===_._reglType,"invalid cube map"),h=h||_.width,E(_.width===h&&_.height===h,"invalid cube map shape"),l.color[r]={target:34069,data:c[r]}}for(r=0;r<6;++r){for(var w=0;w<c.length;++w)l.color[w].target=34069+r;r>0&&(l.depth=o[0].depth,l.stencil=o[0].stencil,l.depthStencil=o[0].depthStencil),o[r]?o[r](l):o[r]=S(l)}return e(a,{width:h,height:h,color:c})}return a(t),e(a,{faces:o,resize:function(t){var e,n=0|t;if(E(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var i=a.color;for(e=0;e<i.length;++e)i[e].resize(n);for(e=0;e<6;++e)o[e].resize(n);return a.width=a.height=n,a},_reglType:"framebufferCube",destroy:function(){o.forEach((function(t){t.destroy()}))}})},clear:function(){j(_).forEach(T)},restore:function(){u.cur=null,u.next=null,u.dirty=!0,j(_).forEach((function(e){e.framebuffer=t.createFramebuffer(),A(e)}))}})}(i,h,y,T,A,l),M=ce(i,f,h,y,b,w,0,C,{},_,x,{elements:null,primitive:4,count:-1,offset:0,instances:-1},g,d,r),N=Pt(i,C,M.procs.poll,g,o,h,y),P=M.next,k=i.canvas,F=[],B=[],U=[],Q=[r.onDestroy],$=null;function Z(){if(0===F.length)return d&&d.update(),void($=null);$=R.next(Z),st();for(var t=F.length-1;t>=0;--t){var e=F[t];e&&e(g,null,0)}i.flush(),d&&d.update()}function J(){!$&&F.length>0&&($=R.next(Z))}function tt(){$&&(R.cancel(Z),$=null)}function et(t){t.preventDefault(),a=!0,tt(),B.forEach((function(t){t()}))}function nt(t){i.getError(),a=!1,u.restore(),x.restore(),b.restore(),T.restore(),A.restore(),C.restore(),_.restore(),d&&d.restore(),M.procs.refresh(),J(),U.forEach((function(t){t()}))}function rt(t){function n(t,e){var n={},r={};return Object.keys(t).forEach((function(i){var o=t[i];if(S.isDynamic(o))r[i]=S.unbox(o,i);else{if(e&&Array.isArray(o))for(var a=0;a<o.length;++a)if(S.isDynamic(o[a]))return void(r[i]=S.unbox(o,i));n[i]=o}})),{dynamic:r,static:n}}E(!!t,"invalid args to regl({...})"),E.type(t,"object","invalid args to regl({...})");var r=n(t.context||{},!0),i=n(t.uniforms||{},!0),o=n(t.attributes||{},!1),u=n(function(t){var n=e({},t);function r(t){if(t in n){var e=n[t];delete n[t],Object.keys(e).forEach((function(r){n[t+"."+r]=e[r]}))}}return delete n.uniforms,delete n.attributes,delete n.context,delete n.vao,"stencil"in n&&n.stencil.op&&(n.stencil.opBack=n.stencil.opFront=n.stencil.op,delete n.stencil.op),r("blend"),r("depth"),r("cull"),r("stencil"),r("polygonOffset"),r("scissor"),r("sample"),"vao"in t&&(n.vao=t.vao),n}(t),!1),s={gpuTime:0,cpuTime:0,count:0},c=M.compile(u,o,i,r,s),f=c.draw,l=c.batch,h=c.scope,d=[];return e((function(t,e){var n;if(a&&E.raise("context lost"),"function"==typeof t)return h.call(this,null,t,0);if("function"==typeof e)if("number"==typeof t)for(n=0;n<t;++n)h.call(this,null,e,n);else{if(!Array.isArray(t))return h.call(this,t,e,0);for(n=0;n<t.length;++n)h.call(this,t[n],e,n)}else if("number"==typeof t){if(t>0)return l.call(this,function(t){for(;d.length<t;)d.push(null);return d}(0|t),0|t)}else{if(!Array.isArray(t))return f.call(this,t);if(t.length)return l.call(this,t,t.length)}}),{stats:s,destroy:function(){c.destroy()}})}k&&(k.addEventListener("webglcontextlost",et,!1),k.addEventListener("webglcontextrestored",nt,!1));var it=C.setFBO=rt({framebuffer:S.define.call(null,1,"framebuffer")});function ot(t,e){var n=0;M.procs.poll();var r=e.color;r&&(i.clearColor(+r[0]||0,+r[1]||0,+r[2]||0,+r[3]||0),n|=16384),"depth"in e&&(i.clearDepth(+e.depth),n|=256),"stencil"in e&&(i.clearStencil(0|e.stencil),n|=1024),E(!!n,"called regl.clear with no buffer specified"),i.clear(n)}function at(t){return E.type(t,"function","regl.frame() callback must be a function"),F.push(t),J(),{cancel:function(){var e=le(F,t);E(e>=0,"cannot cancel a frame twice"),F[e]=function t(){var e=le(F,t);F[e]=F[F.length-1],F.length-=1,F.length<=0&&tt()}}}}function ut(){var t=P.viewport,e=P.scissor_box;t[0]=t[1]=e[0]=e[1]=0,g.viewportWidth=g.framebufferWidth=g.drawingBufferWidth=t[2]=e[2]=i.drawingBufferWidth,g.viewportHeight=g.framebufferHeight=g.drawingBufferHeight=t[3]=e[3]=i.drawingBufferHeight}function st(){g.tick+=1,g.time=ft(),ut(),M.procs.poll()}function ct(){T.refresh(),ut(),M.procs.refresh(),d&&d.update()}function ft(){return(O()-p)/1e3}ct();var lt=e(rt,{clear:function(t){if(E("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var n=0;n<6;++n)it(e({framebuffer:t.framebuffer.faces[n]},t),ot);else it(t,ot);else ot(0,t)},prop:S.define.bind(null,1),context:S.define.bind(null,2),this:S.define.bind(null,3),draw:rt({}),buffer:function(t){return b.create(t,34962,!1,!1)},elements:function(t){return w.create(t,!1)},texture:T.create2D,cube:T.createCube,renderbuffer:A.create,framebuffer:C.create,framebufferCube:C.createCube,vao:_.createVAO,attributes:o,frame:at,on:function(t,e){var n;switch(E.type(e,"function","listener callback must be a function"),t){case"frame":return at(e);case"lost":n=B;break;case"restore":n=U;break;case"destroy":n=Q;break;default:E.raise("invalid event, must be one of frame,lost,restore,destroy")}return n.push(e),{cancel:function(){for(var t=0;t<n.length;++t)if(n[t]===e)return n[t]=n[n.length-1],void n.pop()}}},limits:y,hasExtension:function(t){return y.extensions.indexOf(t.toLowerCase())>=0},read:N,destroy:function(){F.length=0,tt(),k&&(k.removeEventListener("webglcontextlost",et),k.removeEventListener("webglcontextrestored",nt)),x.clear(),C.clear(),A.clear(),T.clear(),w.clear(),b.clear(),_.clear(),d&&d.clear(),Q.forEach((function(t){t()}))},_gl:i,_refresh:ct,poll:function(){st(),d&&d.update()},now:ft,stats:l});return r.onDone(null,lt),lt}}()},,,,,,,function(t,e,n){var r=n(14),i=n(42),o=n(43),a=n(86),u=n(116),s=n(184),c=n(31),f=r.TypeError,l=c("toPrimitive");t.exports=function(t,e){if(!o(t)||a(t))return t;var n,r=u(t,l);if(r){if(void 0===e&&(e="default"),n=i(r,t,e),!o(n)||a(n))return n;throw f("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},function(t,e,n){var r=n(46);t.exports=r("navigator","userAgent")||""},function(t,e,n){var r=n(14).String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},function(t,e,n){var r=n(14),i=n(42),o=n(24),a=n(43),u=r.TypeError;t.exports=function(t,e){var n,r;if("string"===e&&o(n=t.toString)&&!a(r=i(n,t)))return r;if(o(n=t.valueOf)&&!a(r=i(n,t)))return r;if("string"!==e&&o(n=t.toString)&&!a(r=i(n,t)))return r;throw u("Can't convert object to primitive value")}},function(t,e,n){var r=n(14),i=n(24),o=n(92),a=r.WeakMap;t.exports=i(a)&&/native code/.test(o(a))},function(t,e,n){var r=n(29),i=n(32),o=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,u=i(o,"name"),s=u&&"something"===function(){}.name,c=u&&(!r||r&&a(o,"name").configurable);t.exports={EXISTS:u,PROPER:s,CONFIGURABLE:c}},function(t,e,n){var r=n(32),i=n(120),o=n(49),a=n(34);t.exports=function(t,e){for(var n=i(e),u=a.f,s=o.f,c=0;c<n.length;c++){var f=n[c];r(t,f)||u(t,f,s(e,f))}}},function(t,e,n){var r=n(37),i=n(96),o=n(64),a=function(t){return function(e,n,a){var u,s=r(e),c=o(s),f=i(a,c);if(t&&n!=n){for(;c>f;)if((u=s[f++])!=u)return!0}else for(;c>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},function(t,e,n){var r=n(22),i=n(24),o=/#|\.prototype\./,a=function(t,e){var n=s[u(t)];return n==f||n!=c&&(i(e)?r(e):!!e)},u=a.normalize=function(t){return String(t).replace(o,".").toLowerCase()},s=a.data={},c=a.NATIVE="N",f=a.POLYFILL="P";t.exports=a},function(t,e,n){"use strict";var r=n(38);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,n){var r=n(22),i=n(14).RegExp,o=r((function(){var t=i("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),a=o||r((function(){return!i("a","y").sticky})),u=o||r((function(){var t=i("^r","gy");return t.lastIndex=2,null!=t.exec("str")}));t.exports={BROKEN_CARET:u,MISSED_STICKY:a,UNSUPPORTED_Y:o}},function(t,e,n){var r=n(46);t.exports=r("document","documentElement")},function(t,e,n){var r=n(22),i=n(14).RegExp;t.exports=r((function(){var t=i(".","s");return!(t.dotAll&&t.exec("\n")&&"s"===t.flags)}))},function(t,e,n){var r=n(22),i=n(14).RegExp;t.exports=r((function(){var t=i("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}))},function(t,e,n){"use strict";var r=n(42),i=n(196),o=n(38),a=n(122),u=n(65),s=n(58),c=n(116),f=n(197),l=n(199);i("match",(function(t,e,n){return[function(e){var n=s(this),i=null==e?void 0:c(e,t);return i?r(i,e,n):new RegExp(e)[t](u(n))},function(t){var r=o(this),i=u(t),s=n(e,r,i);if(s.done)return s.value;if(!r.global)return l(r,i);var c=r.unicode;r.lastIndex=0;for(var h,d=[],p=0;null!==(h=l(r,i));){var m=u(h[0]);d[p]=m,""===m&&(r.lastIndex=f(i,a(r.lastIndex),c)),p++}return 0===p?null:d}]}))},function(t,e,n){"use strict";n(110);var r=n(21),i=n(61),o=n(98),a=n(22),u=n(31),s=n(52),c=u("species"),f=RegExp.prototype;t.exports=function(t,e,n,l){var h=u(t),d=!a((function(){var e={};return e[h]=function(){return 7},7!=""[t](e)})),p=d&&!a((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return e=!0,null},n[h](""),!e}));if(!d||!p||n){var m=r(/./[h]),v=e(h,""[t],(function(t,e,n,i,a){var u=r(t),s=e.exec;return s===o||s===f.exec?d&&!a?{done:!0,value:m(e,n,i)}:{done:!0,value:u(n,e,i)}:{done:!1}}));i(String.prototype,t,v[0]),i(f,h,v[1])}l&&s(f[h],"sham",!0)}},function(t,e,n){"use strict";var r=n(198).charAt;t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},function(t,e,n){var r=n(21),i=n(63),o=n(65),a=n(58),u=r("".charAt),s=r("".charCodeAt),c=r("".slice),f=function(t){return function(e,n){var r,f,l=o(a(e)),h=i(n),d=l.length;return h<0||h>=d?t?"":void 0:(r=s(l,h))<55296||r>56319||h+1===d||(f=s(l,h+1))<56320||f>57343?t?u(l,h):r:t?c(l,h,h+2):f-56320+(r-55296<<10)+65536}};t.exports={codeAt:f(!1),charAt:f(!0)}},function(t,e,n){var r=n(14),i=n(42),o=n(38),a=n(24),u=n(50),s=n(98),c=r.TypeError;t.exports=function(t,e){var n=t.exec;if(a(n)){var r=i(n,t,e);return null!==r&&o(r),r}if("RegExp"===u(t))return i(s,t,e);throw c("RegExp#exec called on incompatible receiver")}},function(t,e,n){"use strict";var r=n(27),i=n(53).map;r({target:"Array",proto:!0,forced:!n(103)("map")},{map:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(21),i=n(117),o=r(r.bind);t.exports=function(t,e){return i(t),void 0===e?t:o?o(t,e):function(){return t.apply(e,arguments)}}},function(t,e,n){var r=n(14),i=n(126),o=n(203),a=n(43),u=n(31)("species"),s=r.Array;t.exports=function(t){var e;return i(t)&&(e=t.constructor,(o(e)&&(e===s||i(e.prototype))||a(e)&&null===(e=e[u]))&&(e=void 0)),void 0===e?s:e}},function(t,e,n){var r=n(21),i=n(22),o=n(24),a=n(99),u=n(46),s=n(92),c=function(){},f=[],l=u("Reflect","construct"),h=/^\s*(?:class|function)\b/,d=r(h.exec),p=!h.exec(c),m=function(t){if(!o(t))return!1;try{return l(c,f,t),!0}catch(t){return!1}};t.exports=!l||i((function(){var t;return m(m.call)||!m(Object)||!m((function(){t=!0}))||t}))?function(t){if(!o(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}return p||!!d(h,s(t))}:m},function(t,e,n){"use strict";var r=n(27),i=n(127);r({target:"Array",proto:!0,forced:[].forEach!=i},{forEach:i})},function(t,e,n){"use strict";var r=n(22);t.exports=function(t,e){var n=[][t];return!!n&&r((function(){n.call(null,e||function(){throw 1},1)}))}},function(t,e,n){var r=n(100),i=n(61),o=n(207);r||i(Object.prototype,"toString",o,{unsafe:!0})},function(t,e,n){"use strict";var r=n(100),i=n(99);t.exports=r?{}.toString:function(){return"[object "+i(this)+"]"}},function(t,e,n){var r=n(14),i=n(209),o=n(210),a=n(127),u=n(52),s=function(t){if(t&&t.forEach!==a)try{u(t,"forEach",a)}catch(e){t.forEach=a}};for(var c in i)i[c]&&s(r[c]&&r[c].prototype);s(o)},function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,n){var r=n(91)("span").classList,i=r&&r.constructor&&r.constructor.prototype;t.exports=i===Object.prototype?void 0:i},function(t,e,n){"use strict";var r=n(27),i=n(14),o=n(96),a=n(63),u=n(64),s=n(51),c=n(125),f=n(104),l=n(103)("splice"),h=i.TypeError,d=Math.max,p=Math.min;r({target:"Array",proto:!0,forced:!l},{splice:function(t,e){var n,r,i,l,m,v,g=s(this),y=u(g),b=o(t,y),_=arguments.length;if(0===_?n=r=0:1===_?(n=0,r=y-b):(n=_-2,r=p(d(a(e),0),y-b)),y+n-r>9007199254740991)throw h("Maximum allowed length exceeded");for(i=c(g,r),l=0;l<r;l++)(m=b+l)in g&&f(i,l,g[m]);if(i.length=r,n<r){for(l=b;l<y-r;l++)v=l+n,(m=l+r)in g?g[v]=g[m]:delete g[v];for(l=y;l>y-r+n;l--)delete g[l-1]}else if(n>r)for(l=y-r;l>b;l--)v=l+n-1,(m=l+r-1)in g?g[v]=g[m]:delete g[v];for(l=0;l<n;l++)g[l+b]=arguments[l+2];return g.length=y-r+n,i}})},function(t,e,n){"use strict";var r=n(27),i=n(53).find,o=n(213),a=!0;"find"in[]&&Array(1).find((function(){a=!1})),r({target:"Array",proto:!0,forced:a},{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),o("find")},function(t,e,n){var r=n(31),i=n(101),o=n(34),a=r("unscopables"),u=Array.prototype;null==u[a]&&o.f(u,a,{configurable:!0,value:i(null)}),t.exports=function(t){u[a][t]=!0}},function(t,e,n){var r=n(27),i=n(29);r({target:"Object",stat:!0,forced:!i,sham:!i},{defineProperty:n(34).f})},function(t,e,n){var r=n(27),i=n(51),o=n(102);r({target:"Object",stat:!0,forced:n(22)((function(){o(1)}))},{keys:function(t){return o(i(t))}})},function(t,e,n){"use strict";var r=n(27),i=n(14),o=n(46),a=n(217),u=n(42),s=n(21),c=n(118),f=n(29),l=n(87),h=n(22),d=n(32),p=n(126),m=n(24),v=n(43),g=n(113),y=n(86),b=n(38),_=n(51),E=n(37),w=n(59),x=n(65),T=n(57),A=n(101),S=n(102),R=n(95),O=n(218),C=n(123),M=n(49),I=n(34),N=n(111),P=n(220),k=n(61),D=n(60),L=n(94),j=n(62),F=n(90),B=n(31),U=n(128),G=n(221),V=n(223),z=n(93),W=n(53).forEach,H=L("hidden"),q=B("toPrimitive"),X=z.set,Y=z.getterFor("Symbol"),K=Object.prototype,Q=i.Symbol,$=Q&&Q.prototype,Z=i.TypeError,J=i.QObject,tt=o("JSON","stringify"),et=M.f,nt=I.f,rt=O.f,it=N.f,ot=s([].push),at=D("symbols"),ut=D("op-symbols"),st=D("string-to-symbol-registry"),ct=D("symbol-to-string-registry"),ft=D("wks"),lt=!J||!J.prototype||!J.prototype.findChild,ht=f&&h((function(){return 7!=A(nt({},"a",{get:function(){return nt(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=et(K,e);r&&delete K[e],nt(t,e,n),r&&t!==K&&nt(K,e,r)}:nt,dt=function(t,e){var n=at[t]=A($);return X(n,{type:"Symbol",tag:t,description:e}),f||(n.description=e),n},pt=function(t,e,n){t===K&&pt(ut,e,n),b(t);var r=w(e);return b(n),d(at,r)?(n.enumerable?(d(t,H)&&t[H][r]&&(t[H][r]=!1),n=A(n,{enumerable:T(0,!1)})):(d(t,H)||nt(t,H,T(1,{})),t[H][r]=!0),ht(t,r,n)):nt(t,r,n)},mt=function(t,e){b(t);var n=E(e),r=S(n).concat(bt(n));return W(r,(function(e){f&&!u(vt,n,e)||pt(t,e,n[e])})),t},vt=function(t){var e=w(t),n=u(it,this,e);return!(this===K&&d(at,e)&&!d(ut,e))&&(!(n||!d(this,e)||!d(at,e)||d(this,H)&&this[H][e])||n)},gt=function(t,e){var n=E(t),r=w(e);if(n!==K||!d(at,r)||d(ut,r)){var i=et(n,r);return!i||!d(at,r)||d(n,H)&&n[H][r]||(i.enumerable=!0),i}},yt=function(t){var e=rt(E(t)),n=[];return W(e,(function(t){d(at,t)||d(j,t)||ot(n,t)})),n},bt=function(t){var e=t===K,n=rt(e?ut:E(t)),r=[];return W(n,(function(t){!d(at,t)||e&&!d(K,t)||ot(r,at[t])})),r};(l||(k($=(Q=function(){if(g($,this))throw Z("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?x(arguments[0]):void 0,e=F(t),n=function(t){this===K&&u(n,ut,t),d(this,H)&&d(this[H],e)&&(this[H][e]=!1),ht(this,e,T(1,t))};return f&<&&ht(K,e,{configurable:!0,set:n}),dt(e,t)}).prototype,"toString",(function(){return Y(this).tag})),k(Q,"withoutSetter",(function(t){return dt(F(t),t)})),N.f=vt,I.f=pt,M.f=gt,R.f=O.f=yt,C.f=bt,U.f=function(t){return dt(B(t),t)},f&&(nt($,"description",{configurable:!0,get:function(){return Y(this).description}}),c||k(K,"propertyIsEnumerable",vt,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:Q}),W(S(ft),(function(t){G(t)})),r({target:"Symbol",stat:!0,forced:!l},{for:function(t){var e=x(t);if(d(st,e))return st[e];var n=Q(e);return st[e]=n,ct[n]=e,n},keyFor:function(t){if(!y(t))throw Z(t+" is not a symbol");if(d(ct,t))return ct[t]},useSetter:function(){lt=!0},useSimple:function(){lt=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!f},{create:function(t,e){return void 0===e?A(t):mt(A(t),e)},defineProperty:pt,defineProperties:mt,getOwnPropertyDescriptor:gt}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:yt,getOwnPropertySymbols:bt}),r({target:"Object",stat:!0,forced:h((function(){C.f(1)}))},{getOwnPropertySymbols:function(t){return C.f(_(t))}}),tt)&&r({target:"JSON",stat:!0,forced:!l||h((function(){var t=Q();return"[null]"!=tt([t])||"{}"!=tt({a:t})||"{}"!=tt(Object(t))}))},{stringify:function(t,e,n){var r=P(arguments),i=e;if((v(e)||void 0!==t)&&!y(t))return p(e)||(e=function(t,e){if(m(i)&&(e=u(i,this,t,e)),!y(e))return e}),r[1]=e,a(tt,null,r)}});if(!$[q]){var _t=$.valueOf;k($,q,(function(t){return u(_t,this)}))}V(Q,"Symbol"),j[H]=!0},function(t,e){var n=Function.prototype,r=n.apply,i=n.bind,o=n.call;t.exports="object"==typeof Reflect&&Reflect.apply||(i?o.bind(r):function(){return o.apply(r,arguments)})},function(t,e,n){var r=n(50),i=n(37),o=n(95).f,a=n(219),u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"Window"==r(t)?function(t){try{return o(t)}catch(t){return a(u)}}(t):o(i(t))}},function(t,e,n){var r=n(14),i=n(96),o=n(64),a=n(104),u=r.Array,s=Math.max;t.exports=function(t,e,n){for(var r=o(t),c=i(e,r),f=i(void 0===n?r:n,r),l=u(s(f-c,0)),h=0;c<f;c++,h++)a(l,h,t[c]);return l.length=h,l}},function(t,e,n){var r=n(21);t.exports=r([].slice)},function(t,e,n){var r=n(222),i=n(32),o=n(128),a=n(34).f;t.exports=function(t){var e=r.Symbol||(r.Symbol={});i(e,t)||a(e,t,{value:o.f(t)})}},function(t,e,n){var r=n(14);t.exports=r},function(t,e,n){var r=n(34).f,i=n(32),o=n(31)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){"use strict";var r=n(27),i=n(53).filter;r({target:"Array",proto:!0,forced:!n(103)("filter")},{filter:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,e,n){var r=n(27),i=n(22),o=n(37),a=n(49).f,u=n(29),s=i((function(){a(1)}));r({target:"Object",stat:!0,forced:!u||s,sham:!u},{getOwnPropertyDescriptor:function(t,e){return a(o(t),e)}})},function(t,e,n){var r=n(27),i=n(29),o=n(120),a=n(37),u=n(49),s=n(104);r({target:"Object",stat:!0,sham:!i},{getOwnPropertyDescriptors:function(t){for(var e,n,r=a(t),i=u.f,c=o(r),f={},l=0;c.length>l;)void 0!==(n=i(r,e=c[l++]))&&s(f,e,n);return f}})},function(t,e,n){var r=n(27),i=n(29);r({target:"Object",stat:!0,forced:!i,sham:!i},{defineProperties:n(124)})},function(t,e,n){t.exports={Graph:n(105),version:n(231)}},function(t,e,n){(function(t,r){var i;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
37
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
38
|
+
if (ar || !(i in from)) {
|
|
39
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
40
|
+
ar[i] = from[i];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.Dagre = void 0;
|
|
47
|
+
var dagre_1 = __importStar(require("dagre"));
|
|
17
48
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*/(function(){var o="Expected a function",a="__lodash_placeholder__",u=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],s="[object Arguments]",c="[object Array]",f="[object Boolean]",l="[object Date]",h="[object Error]",d="[object Function]",p="[object GeneratorFunction]",m="[object Map]",v="[object Number]",g="[object Object]",y="[object RegExp]",b="[object Set]",_="[object String]",E="[object Symbol]",w="[object WeakMap]",x="[object ArrayBuffer]",T="[object DataView]",A="[object Float32Array]",S="[object Float64Array]",R="[object Int8Array]",O="[object Int16Array]",C="[object Int32Array]",M="[object Uint8Array]",I="[object Uint16Array]",N="[object Uint32Array]",P=/\b__p \+= '';/g,k=/\b(__p \+=) '' \+/g,D=/(__e\(.*?\)|\b__t\)) \+\n'';/g,L=/&(?:amp|lt|gt|quot|#39);/g,j=/[&<>"']/g,F=RegExp(L.source),B=RegExp(j.source),U=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,V=/<%=([\s\S]+?)%>/g,z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,H=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q=/[\\^$.*+?()[\]{}|]/g,X=RegExp(q.source),Y=/^\s+/,K=/\s/,Q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,$=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,J=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,tt=/[()=,{}\[\]\/\s]/,et=/\\(\\)?/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rt=/\w*$/,it=/^[-+]0x[0-9a-f]+$/i,ot=/^0b[01]+$/i,at=/^\[object .+?Constructor\]$/,ut=/^0o[0-7]+$/i,st=/^(?:0|[1-9]\d*)$/,ct=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ft=/($^)/,lt=/['\n\r\u2028\u2029\\]/g,ht="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",dt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pt="[\\ud800-\\udfff]",mt="["+dt+"]",vt="["+ht+"]",gt="\\d+",yt="[\\u2700-\\u27bf]",bt="[a-z\\xdf-\\xf6\\xf8-\\xff]",_t="[^\\ud800-\\udfff"+dt+gt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",Et="\\ud83c[\\udffb-\\udfff]",wt="[^\\ud800-\\udfff]",xt="(?:\\ud83c[\\udde6-\\uddff]){2}",Tt="[\\ud800-\\udbff][\\udc00-\\udfff]",At="[A-Z\\xc0-\\xd6\\xd8-\\xde]",St="(?:"+bt+"|"+_t+")",Rt="(?:"+At+"|"+_t+")",Ot="(?:"+vt+"|"+Et+")"+"?",Ct="[\\ufe0e\\ufe0f]?"+Ot+("(?:\\u200d(?:"+[wt,xt,Tt].join("|")+")[\\ufe0e\\ufe0f]?"+Ot+")*"),Mt="(?:"+[yt,xt,Tt].join("|")+")"+Ct,It="(?:"+[wt+vt+"?",vt,xt,Tt,pt].join("|")+")",Nt=RegExp("['’]","g"),Pt=RegExp(vt,"g"),kt=RegExp(Et+"(?="+Et+")|"+It+Ct,"g"),Dt=RegExp([At+"?"+bt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[mt,At,"$"].join("|")+")",Rt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[mt,At+St,"$"].join("|")+")",At+"?"+St+"+(?:['’](?:d|ll|m|re|s|t|ve))?",At+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",gt,Mt].join("|"),"g"),Lt=RegExp("[\\u200d\\ud800-\\udfff"+ht+"\\ufe0e\\ufe0f]"),jt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ft=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Bt=-1,Ut={};Ut[A]=Ut[S]=Ut[R]=Ut[O]=Ut[C]=Ut[M]=Ut["[object Uint8ClampedArray]"]=Ut[I]=Ut[N]=!0,Ut[s]=Ut[c]=Ut[x]=Ut[f]=Ut[T]=Ut[l]=Ut[h]=Ut[d]=Ut[m]=Ut[v]=Ut[g]=Ut[y]=Ut[b]=Ut[_]=Ut[w]=!1;var Gt={};Gt[s]=Gt[c]=Gt[x]=Gt[T]=Gt[f]=Gt[l]=Gt[A]=Gt[S]=Gt[R]=Gt[O]=Gt[C]=Gt[m]=Gt[v]=Gt[g]=Gt[y]=Gt[b]=Gt[_]=Gt[E]=Gt[M]=Gt["[object Uint8ClampedArray]"]=Gt[I]=Gt[N]=!0,Gt[h]=Gt[d]=Gt[w]=!1;var Vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zt=parseFloat,Wt=parseInt,Ht="object"==typeof t&&t&&t.Object===Object&&t,qt="object"==typeof self&&self&&self.Object===Object&&self,Xt=Ht||qt||Function("return this")(),Yt=e&&!e.nodeType&&e,Kt=Yt&&"object"==typeof r&&r&&!r.nodeType&&r,Qt=Kt&&Kt.exports===Yt,$t=Qt&&Ht.process,Zt=function(){try{var t=Kt&&Kt.require&&Kt.require("util").types;return t||$t&&$t.binding&&$t.binding("util")}catch(t){}}(),Jt=Zt&&Zt.isArrayBuffer,te=Zt&&Zt.isDate,ee=Zt&&Zt.isMap,ne=Zt&&Zt.isRegExp,re=Zt&&Zt.isSet,ie=Zt&&Zt.isTypedArray;function oe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function ae(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function ue(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function se(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function ce(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function fe(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function le(t,e){return!!(null==t?0:t.length)&&Ee(t,e,0)>-1}function he(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function de(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function pe(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function me(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ve(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function ge(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var ye=Ae("length");function be(t,e,n){var r;return n(t,(function(t,n,i){if(e(t,n,i))return r=n,!1})),r}function _e(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Ee(t,e,n){return e==e?function(t,e,n){var r=n-1,i=t.length;for(;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):_e(t,xe,n)}function we(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function xe(t){return t!=t}function Te(t,e){var n=null==t?0:t.length;return n?Oe(t,e)/n:NaN}function Ae(t){return function(e){return null==e?void 0:e[t]}}function Se(t){return function(e){return null==t?void 0:t[e]}}function Re(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}function Oe(t,e){for(var n,r=-1,i=t.length;++r<i;){var o=e(t[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Ce(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Me(t){return t?t.slice(0,Ye(t)+1).replace(Y,""):t}function Ie(t){return function(e){return t(e)}}function Ne(t,e){return de(e,(function(e){return t[e]}))}function Pe(t,e){return t.has(e)}function ke(t,e){for(var n=-1,r=t.length;++n<r&&Ee(e,t[n],0)>-1;);return n}function De(t,e){for(var n=t.length;n--&&Ee(e,t[n],0)>-1;);return n}function Le(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}var je=Se({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Fe=Se({"&":"&","<":"<",">":">",'"':""","'":"'"});function Be(t){return"\\"+Vt[t]}function Ue(t){return Lt.test(t)}function Ge(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function Ve(t,e){return function(n){return t(e(n))}}function ze(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var u=t[n];u!==e&&u!==a||(t[n]=a,o[i++]=n)}return o}function We(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function He(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function qe(t){return Ue(t)?function(t){var e=kt.lastIndex=0;for(;kt.test(t);)++e;return e}(t):ye(t)}function Xe(t){return Ue(t)?function(t){return t.match(kt)||[]}(t):function(t){return t.split("")}(t)}function Ye(t){for(var e=t.length;e--&&K.test(t.charAt(e)););return e}var Ke=Se({"&":"&","<":"<",">":">",""":'"',"'":"'"});var Qe=function t(e){var n,r=(e=null==e?Xt:Qe.defaults(Xt.Object(),e,Qe.pick(Xt,Ft))).Array,i=e.Date,K=e.Error,ht=e.Function,dt=e.Math,pt=e.Object,mt=e.RegExp,vt=e.String,gt=e.TypeError,yt=r.prototype,bt=ht.prototype,_t=pt.prototype,Et=e["__core-js_shared__"],wt=bt.toString,xt=_t.hasOwnProperty,Tt=0,At=(n=/[^.]+$/.exec(Et&&Et.keys&&Et.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",St=_t.toString,Rt=wt.call(pt),Ot=Xt._,Ct=mt("^"+wt.call(xt).replace(q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=Qt?e.Buffer:void 0,It=e.Symbol,kt=e.Uint8Array,Lt=Mt?Mt.allocUnsafe:void 0,Vt=Ve(pt.getPrototypeOf,pt),Ht=pt.create,qt=_t.propertyIsEnumerable,Yt=yt.splice,Kt=It?It.isConcatSpreadable:void 0,$t=It?It.iterator:void 0,Zt=It?It.toStringTag:void 0,ye=function(){try{var t=to(pt,"defineProperty");return t({},"",{}),t}catch(t){}}(),Se=e.clearTimeout!==Xt.clearTimeout&&e.clearTimeout,$e=i&&i.now!==Xt.Date.now&&i.now,Ze=e.setTimeout!==Xt.setTimeout&&e.setTimeout,Je=dt.ceil,tn=dt.floor,en=pt.getOwnPropertySymbols,nn=Mt?Mt.isBuffer:void 0,rn=e.isFinite,on=yt.join,an=Ve(pt.keys,pt),un=dt.max,sn=dt.min,cn=i.now,fn=e.parseInt,ln=dt.random,hn=yt.reverse,dn=to(e,"DataView"),pn=to(e,"Map"),mn=to(e,"Promise"),vn=to(e,"Set"),gn=to(e,"WeakMap"),yn=to(pt,"create"),bn=gn&&new gn,_n={},En=Oo(dn),wn=Oo(pn),xn=Oo(mn),Tn=Oo(vn),An=Oo(gn),Sn=It?It.prototype:void 0,Rn=Sn?Sn.valueOf:void 0,On=Sn?Sn.toString:void 0;function Cn(t){if(Ha(t)&&!ka(t)&&!(t instanceof Pn)){if(t instanceof Nn)return t;if(xt.call(t,"__wrapped__"))return Co(t)}return new Nn(t)}var Mn=function(){function t(){}return function(e){if(!Wa(e))return{};if(Ht)return Ht(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function In(){}function Nn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}function Pn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function kn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Dn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ln(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function jn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Ln;++e<n;)this.add(t[e])}function Fn(t){var e=this.__data__=new Dn(t);this.size=e.size}function Bn(t,e){var n=ka(t),r=!n&&Pa(t),i=!n&&!r&&Fa(t),o=!n&&!r&&!i&&Ja(t),a=n||r||i||o,u=a?Ce(t.length,vt):[],s=u.length;for(var c in t)!e&&!xt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||uo(c,s))||u.push(c);return u}function Un(t){var e=t.length;return e?t[jr(0,e-1)]:void 0}function Gn(t,e){return Ao(yi(t),Qn(e,0,t.length))}function Vn(t){return Ao(yi(t))}function zn(t,e,n){(void 0!==n&&!Ma(t[e],n)||void 0===n&&!(e in t))&&Yn(t,e,n)}function Wn(t,e,n){var r=t[e];xt.call(t,e)&&Ma(r,n)&&(void 0!==n||e in t)||Yn(t,e,n)}function Hn(t,e){for(var n=t.length;n--;)if(Ma(t[n][0],e))return n;return-1}function qn(t,e,n,r){return er(t,(function(t,i,o){e(r,t,n(t),o)})),r}function Xn(t,e){return t&&bi(e,Eu(e),t)}function Yn(t,e,n){"__proto__"==e&&ye?ye(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Kn(t,e){for(var n=-1,i=e.length,o=r(i),a=null==t;++n<i;)o[n]=a?void 0:vu(t,e[n]);return o}function Qn(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}function $n(t,e,n,r,i,o){var a,u=1&e,c=2&e,h=4&e;if(n&&(a=i?n(t,r,i,o):n(t)),void 0!==a)return a;if(!Wa(t))return t;var w=ka(t);if(w){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&xt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!u)return yi(t,a)}else{var P=ro(t),k=P==d||P==p;if(Fa(t))return hi(t,u);if(P==g||P==s||k&&!i){if(a=c||k?{}:oo(t),!u)return c?function(t,e){return bi(t,no(t),e)}(t,function(t,e){return t&&bi(e,wu(e),t)}(a,t)):function(t,e){return bi(t,eo(t),e)}(t,Xn(a,t))}else{if(!Gt[P])return i?t:{};a=function(t,e,n){var r=t.constructor;switch(e){case x:return di(t);case f:case l:return new r(+t);case T:return function(t,e){var n=e?di(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case A:case S:case R:case O:case C:case M:case"[object Uint8ClampedArray]":case I:case N:return pi(t,n);case m:return new r;case v:case _:return new r(t);case y:return function(t){var e=new t.constructor(t.source,rt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case b:return new r;case E:return i=t,Rn?pt(Rn.call(i)):{}}var i}(t,P,u)}}o||(o=new Fn);var D=o.get(t);if(D)return D;o.set(t,a),Qa(t)?t.forEach((function(r){a.add($n(r,e,n,r,t,o))})):qa(t)&&t.forEach((function(r,i){a.set(i,$n(r,e,n,i,t,o))}));var L=w?void 0:(h?c?Xi:qi:c?wu:Eu)(t);return ue(L||t,(function(r,i){L&&(r=t[i=r]),Wn(a,i,$n(r,e,n,i,t,o))})),a}function Zn(t,e,n){var r=n.length;if(null==t)return!r;for(t=pt(t);r--;){var i=n[r],o=e[i],a=t[i];if(void 0===a&&!(i in t)||!o(a))return!1}return!0}function Jn(t,e,n){if("function"!=typeof t)throw new gt(o);return Eo((function(){t.apply(void 0,n)}),e)}function tr(t,e,n,r){var i=-1,o=le,a=!0,u=t.length,s=[],c=e.length;if(!u)return s;n&&(e=de(e,Ie(n))),r?(o=he,a=!1):e.length>=200&&(o=Pe,a=!1,e=new jn(e));t:for(;++i<u;){var f=t[i],l=null==n?f:n(f);if(f=r||0!==f?f:0,a&&l==l){for(var h=c;h--;)if(e[h]===l)continue t;s.push(f)}else o(e,l,r)||s.push(f)}return s}Cn.templateSettings={escape:U,evaluate:G,interpolate:V,variable:"",imports:{_:Cn}},Cn.prototype=In.prototype,Cn.prototype.constructor=Cn,Nn.prototype=Mn(In.prototype),Nn.prototype.constructor=Nn,Pn.prototype=Mn(In.prototype),Pn.prototype.constructor=Pn,kn.prototype.clear=function(){this.__data__=yn?yn(null):{},this.size=0},kn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},kn.prototype.get=function(t){var e=this.__data__;if(yn){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return xt.call(e,t)?e[t]:void 0},kn.prototype.has=function(t){var e=this.__data__;return yn?void 0!==e[t]:xt.call(e,t)},kn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=yn&&void 0===e?"__lodash_hash_undefined__":e,this},Dn.prototype.clear=function(){this.__data__=[],this.size=0},Dn.prototype.delete=function(t){var e=this.__data__,n=Hn(e,t);return!(n<0)&&(n==e.length-1?e.pop():Yt.call(e,n,1),--this.size,!0)},Dn.prototype.get=function(t){var e=this.__data__,n=Hn(e,t);return n<0?void 0:e[n][1]},Dn.prototype.has=function(t){return Hn(this.__data__,t)>-1},Dn.prototype.set=function(t,e){var n=this.__data__,r=Hn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Ln.prototype.clear=function(){this.size=0,this.__data__={hash:new kn,map:new(pn||Dn),string:new kn}},Ln.prototype.delete=function(t){var e=Zi(this,t).delete(t);return this.size-=e?1:0,e},Ln.prototype.get=function(t){return Zi(this,t).get(t)},Ln.prototype.has=function(t){return Zi(this,t).has(t)},Ln.prototype.set=function(t,e){var n=Zi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},jn.prototype.add=jn.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},jn.prototype.has=function(t){return this.__data__.has(t)},Fn.prototype.clear=function(){this.__data__=new Dn,this.size=0},Fn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Fn.prototype.get=function(t){return this.__data__.get(t)},Fn.prototype.has=function(t){return this.__data__.has(t)},Fn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Dn){var r=n.__data__;if(!pn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ln(r)}return n.set(t,e),this.size=n.size,this};var er=wi(cr),nr=wi(fr,!0);function rr(t,e){var n=!0;return er(t,(function(t,r,i){return n=!!e(t,r,i)})),n}function ir(t,e,n){for(var r=-1,i=t.length;++r<i;){var o=t[r],a=e(o);if(null!=a&&(void 0===u?a==a&&!Za(a):n(a,u)))var u=a,s=o}return s}function or(t,e){var n=[];return er(t,(function(t,r,i){e(t,r,i)&&n.push(t)})),n}function ar(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=ao),i||(i=[]);++o<a;){var u=t[o];e>0&&n(u)?e>1?ar(u,e-1,n,r,i):pe(i,u):r||(i[i.length]=u)}return i}var ur=xi(),sr=xi(!0);function cr(t,e){return t&&ur(t,e,Eu)}function fr(t,e){return t&&sr(t,e,Eu)}function lr(t,e){return fe(e,(function(e){return Ga(t[e])}))}function hr(t,e){for(var n=0,r=(e=si(e,t)).length;null!=t&&n<r;)t=t[Ro(e[n++])];return n&&n==r?t:void 0}function dr(t,e,n){var r=e(t);return ka(t)?r:pe(r,n(t))}function pr(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Zt&&Zt in pt(t)?function(t){var e=xt.call(t,Zt),n=t[Zt];try{t[Zt]=void 0;var r=!0}catch(t){}var i=St.call(t);r&&(e?t[Zt]=n:delete t[Zt]);return i}(t):function(t){return St.call(t)}(t)}function mr(t,e){return t>e}function vr(t,e){return null!=t&&xt.call(t,e)}function gr(t,e){return null!=t&&e in pt(t)}function yr(t,e,n){for(var i=n?he:le,o=t[0].length,a=t.length,u=a,s=r(a),c=1/0,f=[];u--;){var l=t[u];u&&e&&(l=de(l,Ie(e))),c=sn(l.length,c),s[u]=!n&&(e||o>=120&&l.length>=120)?new jn(u&&l):void 0}l=t[0];var h=-1,d=s[0];t:for(;++h<o&&f.length<c;){var p=l[h],m=e?e(p):p;if(p=n||0!==p?p:0,!(d?Pe(d,m):i(f,m,n))){for(u=a;--u;){var v=s[u];if(!(v?Pe(v,m):i(t[u],m,n)))continue t}d&&d.push(m),f.push(p)}}return f}function br(t,e,n){var r=null==(t=go(t,e=si(e,t)))?t:t[Ro(Uo(e))];return null==r?void 0:oe(r,t,n)}function _r(t){return Ha(t)&&pr(t)==s}function Er(t,e,n,r,i){return t===e||(null==t||null==e||!Ha(t)&&!Ha(e)?t!=t&&e!=e:function(t,e,n,r,i,o){var a=ka(t),u=ka(e),d=a?c:ro(t),p=u?c:ro(e),w=(d=d==s?g:d)==g,A=(p=p==s?g:p)==g,S=d==p;if(S&&Fa(t)){if(!Fa(e))return!1;a=!0,w=!1}if(S&&!w)return o||(o=new Fn),a||Ja(t)?Wi(t,e,n,r,i,o):function(t,e,n,r,i,o,a){switch(n){case T:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case x:return!(t.byteLength!=e.byteLength||!o(new kt(t),new kt(e)));case f:case l:case v:return Ma(+t,+e);case h:return t.name==e.name&&t.message==e.message;case y:case _:return t==e+"";case m:var u=Ge;case b:var s=1&r;if(u||(u=We),t.size!=e.size&&!s)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var d=Wi(u(t),u(e),r,i,o,a);return a.delete(t),d;case E:if(Rn)return Rn.call(t)==Rn.call(e)}return!1}(t,e,d,n,r,i,o);if(!(1&n)){var R=w&&xt.call(t,"__wrapped__"),O=A&&xt.call(e,"__wrapped__");if(R||O){var C=R?t.value():t,M=O?e.value():e;return o||(o=new Fn),i(C,M,n,r,o)}}if(!S)return!1;return o||(o=new Fn),function(t,e,n,r,i,o){var a=1&n,u=qi(t),s=u.length,c=qi(e).length;if(s!=c&&!a)return!1;var f=s;for(;f--;){var l=u[f];if(!(a?l in e:xt.call(e,l)))return!1}var h=o.get(t),d=o.get(e);if(h&&d)return h==e&&d==t;var p=!0;o.set(t,e),o.set(e,t);var m=a;for(;++f<s;){l=u[f];var v=t[l],g=e[l];if(r)var y=a?r(g,v,l,e,t,o):r(v,g,l,t,e,o);if(!(void 0===y?v===g||i(v,g,n,r,o):y)){p=!1;break}m||(m="constructor"==l)}if(p&&!m){var b=t.constructor,_=e.constructor;b==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,n,r,i,o)}(t,e,n,r,Er,i))}function wr(t,e,n,r){var i=n.length,o=i,a=!r;if(null==t)return!o;for(t=pt(t);i--;){var u=n[i];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++i<o;){var s=(u=n[i])[0],c=t[s],f=u[1];if(a&&u[2]){if(void 0===c&&!(s in t))return!1}else{var l=new Fn;if(r)var h=r(c,f,s,t,e,l);if(!(void 0===h?Er(f,c,3,r,l):h))return!1}}return!0}function xr(t){return!(!Wa(t)||(e=t,At&&At in e))&&(Ga(t)?Ct:at).test(Oo(t));var e}function Tr(t){return"function"==typeof t?t:null==t?Xu:"object"==typeof t?ka(t)?Mr(t[0],t[1]):Cr(t):ns(t)}function Ar(t){if(!ho(t))return an(t);var e=[];for(var n in pt(t))xt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Sr(t){if(!Wa(t))return function(t){var e=[];if(null!=t)for(var n in pt(t))e.push(n);return e}(t);var e=ho(t),n=[];for(var r in t)("constructor"!=r||!e&&xt.call(t,r))&&n.push(r);return n}function Rr(t,e){return t<e}function Or(t,e){var n=-1,i=La(t)?r(t.length):[];return er(t,(function(t,r,o){i[++n]=e(t,r,o)})),i}function Cr(t){var e=Ji(t);return 1==e.length&&e[0][2]?mo(e[0][0],e[0][1]):function(n){return n===t||wr(n,t,e)}}function Mr(t,e){return co(t)&&po(e)?mo(Ro(t),e):function(n){var r=vu(n,t);return void 0===r&&r===e?gu(n,t):Er(e,r,3)}}function Ir(t,e,n,r,i){t!==e&&ur(e,(function(o,a){if(i||(i=new Fn),Wa(o))!function(t,e,n,r,i,o,a){var u=bo(t,n),s=bo(e,n),c=a.get(s);if(c)return void zn(t,n,c);var f=o?o(u,s,n+"",t,e,a):void 0,l=void 0===f;if(l){var h=ka(s),d=!h&&Fa(s),p=!h&&!d&&Ja(s);f=s,h||d||p?ka(u)?f=u:ja(u)?f=yi(u):d?(l=!1,f=hi(s,!0)):p?(l=!1,f=pi(s,!0)):f=[]:Ya(s)||Pa(s)?(f=u,Pa(u)?f=uu(u):Wa(u)&&!Ga(u)||(f=oo(s))):l=!1}l&&(a.set(s,f),i(f,s,r,o,a),a.delete(s));zn(t,n,f)}(t,e,a,n,Ir,r,i);else{var u=r?r(bo(t,a),o,a+"",t,e,i):void 0;void 0===u&&(u=o),zn(t,a,u)}}),wu)}function Nr(t,e){var n=t.length;if(n)return uo(e+=e<0?n:0,n)?t[e]:void 0}function Pr(t,e,n){e=e.length?de(e,(function(t){return ka(t)?function(e){return hr(e,1===t.length?t[0]:t)}:t})):[Xu];var r=-1;return e=de(e,Ie($i())),function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(Or(t,(function(t,n,i){return{criteria:de(e,(function(e){return e(t)})),index:++r,value:t}})),(function(t,e){return function(t,e,n){var r=-1,i=t.criteria,o=e.criteria,a=i.length,u=n.length;for(;++r<a;){var s=mi(i[r],o[r]);if(s){if(r>=u)return s;var c=n[r];return s*("desc"==c?-1:1)}}return t.index-e.index}(t,e,n)}))}function kr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],u=hr(t,a);n(u,a)&&Vr(o,si(a,t),u)}return o}function Dr(t,e,n,r){var i=r?we:Ee,o=-1,a=e.length,u=t;for(t===e&&(e=yi(e)),n&&(u=de(t,Ie(n)));++o<a;)for(var s=0,c=e[o],f=n?n(c):c;(s=i(u,f,s,r))>-1;)u!==t&&Yt.call(u,s,1),Yt.call(t,s,1);return t}function Lr(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;uo(i)?Yt.call(t,i,1):ti(t,i)}}return t}function jr(t,e){return t+tn(ln()*(e-t+1))}function Fr(t,e){var n="";if(!t||e<1||e>9007199254740991)return n;do{e%2&&(n+=t),(e=tn(e/2))&&(t+=t)}while(e);return n}function Br(t,e){return wo(vo(t,e,Xu),t+"")}function Ur(t){return Un(Mu(t))}function Gr(t,e){var n=Mu(t);return Ao(n,Qn(e,0,n.length))}function Vr(t,e,n,r){if(!Wa(t))return t;for(var i=-1,o=(e=si(e,t)).length,a=o-1,u=t;null!=u&&++i<o;){var s=Ro(e[i]),c=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return t;if(i!=a){var f=u[s];void 0===(c=r?r(f,s,u):void 0)&&(c=Wa(f)?f:uo(e[i+1])?[]:{})}Wn(u,s,c),u=u[s]}return t}var zr=bn?function(t,e){return bn.set(t,e),t}:Xu,Wr=ye?function(t,e){return ye(t,"toString",{configurable:!0,enumerable:!1,value:Wu(e),writable:!0})}:Xu;function Hr(t){return Ao(Mu(t))}function qr(t,e,n){var i=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var a=r(o);++i<o;)a[i]=t[i+e];return a}function Xr(t,e){var n;return er(t,(function(t,r,i){return!(n=e(t,r,i))})),!!n}function Yr(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!Za(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return Kr(t,e,Xu,n)}function Kr(t,e,n,r){var i=0,o=null==t?0:t.length;if(0===o)return 0;for(var a=(e=n(e))!=e,u=null===e,s=Za(e),c=void 0===e;i<o;){var f=tn((i+o)/2),l=n(t[f]),h=void 0!==l,d=null===l,p=l==l,m=Za(l);if(a)var v=r||p;else v=c?p&&(r||h):u?p&&h&&(r||!d):s?p&&h&&!d&&(r||!m):!d&&!m&&(r?l<=e:l<e);v?i=f+1:o=f}return sn(o,4294967294)}function Qr(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],u=e?e(a):a;if(!n||!Ma(u,s)){var s=u;o[i++]=0===a?0:a}}return o}function $r(t){return"number"==typeof t?t:Za(t)?NaN:+t}function Zr(t){if("string"==typeof t)return t;if(ka(t))return de(t,Zr)+"";if(Za(t))return On?On.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Jr(t,e,n){var r=-1,i=le,o=t.length,a=!0,u=[],s=u;if(n)a=!1,i=he;else if(o>=200){var c=e?null:Fi(t);if(c)return We(c);a=!1,i=Pe,s=new jn}else s=e?[]:u;t:for(;++r<o;){var f=t[r],l=e?e(f):f;if(f=n||0!==f?f:0,a&&l==l){for(var h=s.length;h--;)if(s[h]===l)continue t;e&&s.push(l),u.push(f)}else i(s,l,n)||(s!==u&&s.push(l),u.push(f))}return u}function ti(t,e){return null==(t=go(t,e=si(e,t)))||delete t[Ro(Uo(e))]}function ei(t,e,n,r){return Vr(t,e,n(hr(t,e)),r)}function ni(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?qr(t,r?0:o,r?o+1:i):qr(t,r?o+1:0,r?i:o)}function ri(t,e){var n=t;return n instanceof Pn&&(n=n.value()),me(e,(function(t,e){return e.func.apply(e.thisArg,pe([t],e.args))}),n)}function ii(t,e,n){var i=t.length;if(i<2)return i?Jr(t[0]):[];for(var o=-1,a=r(i);++o<i;)for(var u=t[o],s=-1;++s<i;)s!=o&&(a[o]=tr(a[o]||u,t[s],e,n));return Jr(ar(a,1),e,n)}function oi(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var u=r<o?e[r]:void 0;n(a,t[r],u)}return a}function ai(t){return ja(t)?t:[]}function ui(t){return"function"==typeof t?t:Xu}function si(t,e){return ka(t)?t:co(t,e)?[t]:So(su(t))}var ci=Br;function fi(t,e,n){var r=t.length;return n=void 0===n?r:n,!e&&n>=r?t:qr(t,e,n)}var li=Se||function(t){return Xt.clearTimeout(t)};function hi(t,e){if(e)return t.slice();var n=t.length,r=Lt?Lt(n):new t.constructor(n);return t.copy(r),r}function di(t){var e=new t.constructor(t.byteLength);return new kt(e).set(new kt(t)),e}function pi(t,e){var n=e?di(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function mi(t,e){if(t!==e){var n=void 0!==t,r=null===t,i=t==t,o=Za(t),a=void 0!==e,u=null===e,s=e==e,c=Za(e);if(!u&&!c&&!o&&t>e||o&&a&&s&&!u&&!c||r&&a&&s||!n&&s||!i)return 1;if(!r&&!o&&!c&&t<e||c&&n&&i&&!r&&!o||u&&n&&i||!a&&i||!s)return-1}return 0}function vi(t,e,n,i){for(var o=-1,a=t.length,u=n.length,s=-1,c=e.length,f=un(a-u,0),l=r(c+f),h=!i;++s<c;)l[s]=e[s];for(;++o<u;)(h||o<a)&&(l[n[o]]=t[o]);for(;f--;)l[s++]=t[o++];return l}function gi(t,e,n,i){for(var o=-1,a=t.length,u=-1,s=n.length,c=-1,f=e.length,l=un(a-s,0),h=r(l+f),d=!i;++o<l;)h[o]=t[o];for(var p=o;++c<f;)h[p+c]=e[c];for(;++u<s;)(d||o<a)&&(h[p+n[u]]=t[o++]);return h}function yi(t,e){var n=-1,i=t.length;for(e||(e=r(i));++n<i;)e[n]=t[n];return e}function bi(t,e,n,r){var i=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var u=e[o],s=r?r(n[u],t[u],u,n,t):void 0;void 0===s&&(s=t[u]),i?Yn(n,u,s):Wn(n,u,s)}return n}function _i(t,e){return function(n,r){var i=ka(n)?ae:qn,o=e?e():{};return i(n,t,$i(r,2),o)}}function Ei(t){return Br((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&so(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=pt(e);++r<i;){var u=n[r];u&&t(e,u,r,o)}return e}))}function wi(t,e){return function(n,r){if(null==n)return n;if(!La(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=pt(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function xi(t){return function(e,n,r){for(var i=-1,o=pt(e),a=r(e),u=a.length;u--;){var s=a[t?u:++i];if(!1===n(o[s],s,o))break}return e}}function Ti(t){return function(e){var n=Ue(e=su(e))?Xe(e):void 0,r=n?n[0]:e.charAt(0),i=n?fi(n,1).join(""):e.slice(1);return r[t]()+i}}function Ai(t){return function(e){return me(Gu(Pu(e).replace(Nt,"")),t,"")}}function Si(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Mn(t.prototype),r=t.apply(n,e);return Wa(r)?r:n}}function Ri(t){return function(e,n,r){var i=pt(e);if(!La(e)){var o=$i(n,3);e=Eu(e),n=function(t){return o(i[t],t,i)}}var a=t(e,n,r);return a>-1?i[o?e[a]:a]:void 0}}function Oi(t){return Hi((function(e){var n=e.length,r=n,i=Nn.prototype.thru;for(t&&e.reverse();r--;){var a=e[r];if("function"!=typeof a)throw new gt(o);if(i&&!u&&"wrapper"==Ki(a))var u=new Nn([],!0)}for(r=u?r:n;++r<n;){var s=Ki(a=e[r]),c="wrapper"==s?Yi(a):void 0;u=c&&fo(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?u[Ki(c[0])].apply(u,c[3]):1==a.length&&fo(a)?u[s]():u.thru(a)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&ka(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}}))}function Ci(t,e,n,i,o,a,u,s,c,f){var l=128&e,h=1&e,d=2&e,p=24&e,m=512&e,v=d?void 0:Si(t);return function g(){for(var y=arguments.length,b=r(y),_=y;_--;)b[_]=arguments[_];if(p)var E=Qi(g),w=Le(b,E);if(i&&(b=vi(b,i,o,p)),a&&(b=gi(b,a,u,p)),y-=w,p&&y<f){var x=ze(b,E);return Li(t,e,Ci,g.placeholder,n,b,x,s,c,f-y)}var T=h?n:this,A=d?T[t]:t;return y=b.length,s?b=yo(b,s):m&&y>1&&b.reverse(),l&&c<y&&(b.length=c),this&&this!==Xt&&this instanceof g&&(A=v||Si(A)),A.apply(T,b)}}function Mi(t,e){return function(n,r){return function(t,e,n,r){return cr(t,(function(t,i,o){e(r,n(t),i,o)})),r}(n,t,e(r),{})}}function Ii(t,e){return function(n,r){var i;if(void 0===n&&void 0===r)return e;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Zr(n),r=Zr(r)):(n=$r(n),r=$r(r)),i=t(n,r)}return i}}function Ni(t){return Hi((function(e){return e=de(e,Ie($i())),Br((function(n){var r=this;return t(e,(function(t){return oe(t,r,n)}))}))}))}function Pi(t,e){var n=(e=void 0===e?" ":Zr(e)).length;if(n<2)return n?Fr(e,t):e;var r=Fr(e,Je(t/qe(e)));return Ue(e)?fi(Xe(r),0,t).join(""):r.slice(0,t)}function ki(t){return function(e,n,i){return i&&"number"!=typeof i&&so(e,n,i)&&(n=i=void 0),e=ru(e),void 0===n?(n=e,e=0):n=ru(n),function(t,e,n,i){for(var o=-1,a=un(Je((e-t)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=t,t+=n;return u}(e,n,i=void 0===i?e<n?1:-1:ru(i),t)}}function Di(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=au(e),n=au(n)),t(e,n)}}function Li(t,e,n,r,i,o,a,u,s,c){var f=8&e;e|=f?32:64,4&(e&=~(f?64:32))||(e&=-4);var l=[t,e,i,f?o:void 0,f?a:void 0,f?void 0:o,f?void 0:a,u,s,c],h=n.apply(void 0,l);return fo(t)&&_o(h,l),h.placeholder=r,xo(h,t,e)}function ji(t){var e=dt[t];return function(t,n){if(t=au(t),(n=null==n?0:sn(iu(n),292))&&rn(t)){var r=(su(t)+"e").split("e");return+((r=(su(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Fi=vn&&1/We(new vn([,-0]))[1]==1/0?function(t){return new vn(t)}:Zu;function Bi(t){return function(e){var n=ro(e);return n==m?Ge(e):n==b?He(e):function(t,e){return de(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Ui(t,e,n,i,u,s,c,f){var l=2&e;if(!l&&"function"!=typeof t)throw new gt(o);var h=i?i.length:0;if(h||(e&=-97,i=u=void 0),c=void 0===c?c:un(iu(c),0),f=void 0===f?f:iu(f),h-=u?u.length:0,64&e){var d=i,p=u;i=u=void 0}var m=l?void 0:Yi(t),v=[t,e,n,i,u,d,p,s,c,f];if(m&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,u=128==r&&8==n||128==r&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!u)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var s=e[3];if(s){var c=t[3];t[3]=c?vi(c,s,e[4]):s,t[4]=c?ze(t[3],a):e[4]}(s=e[5])&&(c=t[5],t[5]=c?gi(c,s,e[6]):s,t[6]=c?ze(t[5],a):e[6]);(s=e[7])&&(t[7]=s);128&r&&(t[8]=null==t[8]?e[8]:sn(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(v,m),t=v[0],e=v[1],n=v[2],i=v[3],u=v[4],!(f=v[9]=void 0===v[9]?l?0:t.length:un(v[9]-h,0))&&24&e&&(e&=-25),e&&1!=e)g=8==e||16==e?function(t,e,n){var i=Si(t);return function o(){for(var a=arguments.length,u=r(a),s=a,c=Qi(o);s--;)u[s]=arguments[s];var f=a<3&&u[0]!==c&&u[a-1]!==c?[]:ze(u,c);if((a-=f.length)<n)return Li(t,e,Ci,o.placeholder,void 0,u,f,void 0,void 0,n-a);var l=this&&this!==Xt&&this instanceof o?i:t;return oe(l,this,u)}}(t,e,f):32!=e&&33!=e||u.length?Ci.apply(void 0,v):function(t,e,n,i){var o=1&e,a=Si(t);return function e(){for(var u=-1,s=arguments.length,c=-1,f=i.length,l=r(f+s),h=this&&this!==Xt&&this instanceof e?a:t;++c<f;)l[c]=i[c];for(;s--;)l[c++]=arguments[++u];return oe(h,o?n:this,l)}}(t,e,n,i);else var g=function(t,e,n){var r=1&e,i=Si(t);return function e(){var o=this&&this!==Xt&&this instanceof e?i:t;return o.apply(r?n:this,arguments)}}(t,e,n);return xo((m?zr:_o)(g,v),t,e)}function Gi(t,e,n,r){return void 0===t||Ma(t,_t[n])&&!xt.call(r,n)?e:t}function Vi(t,e,n,r,i,o){return Wa(t)&&Wa(e)&&(o.set(e,t),Ir(t,e,void 0,Vi,o),o.delete(e)),t}function zi(t){return Ya(t)?void 0:t}function Wi(t,e,n,r,i,o){var a=1&n,u=t.length,s=e.length;if(u!=s&&!(a&&s>u))return!1;var c=o.get(t),f=o.get(e);if(c&&f)return c==e&&f==t;var l=-1,h=!0,d=2&n?new jn:void 0;for(o.set(t,e),o.set(e,t);++l<u;){var p=t[l],m=e[l];if(r)var v=a?r(m,p,l,e,t,o):r(p,m,l,t,e,o);if(void 0!==v){if(v)continue;h=!1;break}if(d){if(!ge(e,(function(t,e){if(!Pe(d,e)&&(p===t||i(p,t,n,r,o)))return d.push(e)}))){h=!1;break}}else if(p!==m&&!i(p,m,n,r,o)){h=!1;break}}return o.delete(t),o.delete(e),h}function Hi(t){return wo(vo(t,void 0,Do),t+"")}function qi(t){return dr(t,Eu,eo)}function Xi(t){return dr(t,wu,no)}var Yi=bn?function(t){return bn.get(t)}:Zu;function Ki(t){for(var e=t.name+"",n=_n[e],r=xt.call(_n,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function Qi(t){return(xt.call(Cn,"placeholder")?Cn:t).placeholder}function $i(){var t=Cn.iteratee||Yu;return t=t===Yu?Tr:t,arguments.length?t(arguments[0],arguments[1]):t}function Zi(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function Ji(t){for(var e=Eu(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,po(i)]}return e}function to(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return xr(n)?n:void 0}var eo=en?function(t){return null==t?[]:(t=pt(t),fe(en(t),(function(e){return qt.call(t,e)})))}:os,no=en?function(t){for(var e=[];t;)pe(e,eo(t)),t=Vt(t);return e}:os,ro=pr;function io(t,e,n){for(var r=-1,i=(e=si(e,t)).length,o=!1;++r<i;){var a=Ro(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&za(i)&&uo(a,i)&&(ka(t)||Pa(t))}function oo(t){return"function"!=typeof t.constructor||ho(t)?{}:Mn(Vt(t))}function ao(t){return ka(t)||Pa(t)||!!(Kt&&t&&t[Kt])}function uo(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&st.test(t))&&t>-1&&t%1==0&&t<e}function so(t,e,n){if(!Wa(n))return!1;var r=typeof e;return!!("number"==r?La(n)&&uo(e,n.length):"string"==r&&e in n)&&Ma(n[e],t)}function co(t,e){if(ka(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Za(t))||(W.test(t)||!z.test(t)||null!=e&&t in pt(e))}function fo(t){var e=Ki(t),n=Cn[e];if("function"!=typeof n||!(e in Pn.prototype))return!1;if(t===n)return!0;var r=Yi(n);return!!r&&t===r[0]}(dn&&ro(new dn(new ArrayBuffer(1)))!=T||pn&&ro(new pn)!=m||mn&&"[object Promise]"!=ro(mn.resolve())||vn&&ro(new vn)!=b||gn&&ro(new gn)!=w)&&(ro=function(t){var e=pr(t),n=e==g?t.constructor:void 0,r=n?Oo(n):"";if(r)switch(r){case En:return T;case wn:return m;case xn:return"[object Promise]";case Tn:return b;case An:return w}return e});var lo=Et?Ga:as;function ho(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_t)}function po(t){return t==t&&!Wa(t)}function mo(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in pt(n)))}}function vo(t,e,n){return e=un(void 0===e?t.length-1:e,0),function(){for(var i=arguments,o=-1,a=un(i.length-e,0),u=r(a);++o<a;)u[o]=i[e+o];o=-1;for(var s=r(e+1);++o<e;)s[o]=i[o];return s[e]=n(u),oe(t,this,s)}}function go(t,e){return e.length<2?t:hr(t,qr(e,0,-1))}function yo(t,e){for(var n=t.length,r=sn(e.length,n),i=yi(t);r--;){var o=e[r];t[r]=uo(o,n)?i[o]:void 0}return t}function bo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var _o=To(zr),Eo=Ze||function(t,e){return Xt.setTimeout(t,e)},wo=To(Wr);function xo(t,e,n){var r=e+"";return wo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(Q,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return ue(u,(function(n){var r="_."+n[0];e&n[1]&&!le(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match($);return e?e[1].split(Z):[]}(r),n)))}function To(t){var e=0,n=0;return function(){var r=cn(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Ao(t,e){var n=-1,r=t.length,i=r-1;for(e=void 0===e?r:e;++n<e;){var o=jr(n,i),a=t[o];t[o]=t[n],t[n]=a}return t.length=e,t}var So=function(t){var e=Ta(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(H,(function(t,n,r,i){e.push(r?i.replace(et,"$1"):n||t)})),e}));function Ro(t){if("string"==typeof t||Za(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Oo(t){if(null!=t){try{return wt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Co(t){if(t instanceof Pn)return t.clone();var e=new Nn(t.__wrapped__,t.__chain__);return e.__actions__=yi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Mo=Br((function(t,e){return ja(t)?tr(t,ar(e,1,ja,!0)):[]})),Io=Br((function(t,e){var n=Uo(e);return ja(n)&&(n=void 0),ja(t)?tr(t,ar(e,1,ja,!0),$i(n,2)):[]})),No=Br((function(t,e){var n=Uo(e);return ja(n)&&(n=void 0),ja(t)?tr(t,ar(e,1,ja,!0),void 0,n):[]}));function Po(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:iu(n);return i<0&&(i=un(r+i,0)),_e(t,$i(e,3),i)}function ko(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=iu(n),i=n<0?un(r+i,0):sn(i,r-1)),_e(t,$i(e,3),i,!0)}function Do(t){return(null==t?0:t.length)?ar(t,1):[]}function Lo(t){return t&&t.length?t[0]:void 0}var jo=Br((function(t){var e=de(t,ai);return e.length&&e[0]===t[0]?yr(e):[]})),Fo=Br((function(t){var e=Uo(t),n=de(t,ai);return e===Uo(n)?e=void 0:n.pop(),n.length&&n[0]===t[0]?yr(n,$i(e,2)):[]})),Bo=Br((function(t){var e=Uo(t),n=de(t,ai);return(e="function"==typeof e?e:void 0)&&n.pop(),n.length&&n[0]===t[0]?yr(n,void 0,e):[]}));function Uo(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}var Go=Br(Vo);function Vo(t,e){return t&&t.length&&e&&e.length?Dr(t,e):t}var zo=Hi((function(t,e){var n=null==t?0:t.length,r=Kn(t,e);return Lr(t,de(e,(function(t){return uo(t,n)?+t:t})).sort(mi)),r}));function Wo(t){return null==t?t:hn.call(t)}var Ho=Br((function(t){return Jr(ar(t,1,ja,!0))})),qo=Br((function(t){var e=Uo(t);return ja(e)&&(e=void 0),Jr(ar(t,1,ja,!0),$i(e,2))})),Xo=Br((function(t){var e=Uo(t);return e="function"==typeof e?e:void 0,Jr(ar(t,1,ja,!0),void 0,e)}));function Yo(t){if(!t||!t.length)return[];var e=0;return t=fe(t,(function(t){if(ja(t))return e=un(t.length,e),!0})),Ce(e,(function(e){return de(t,Ae(e))}))}function Ko(t,e){if(!t||!t.length)return[];var n=Yo(t);return null==e?n:de(n,(function(t){return oe(e,void 0,t)}))}var Qo=Br((function(t,e){return ja(t)?tr(t,e):[]})),$o=Br((function(t){return ii(fe(t,ja))})),Zo=Br((function(t){var e=Uo(t);return ja(e)&&(e=void 0),ii(fe(t,ja),$i(e,2))})),Jo=Br((function(t){var e=Uo(t);return e="function"==typeof e?e:void 0,ii(fe(t,ja),void 0,e)})),ta=Br(Yo);var ea=Br((function(t){var e=t.length,n=e>1?t[e-1]:void 0;return n="function"==typeof n?(t.pop(),n):void 0,Ko(t,n)}));function na(t){var e=Cn(t);return e.__chain__=!0,e}function ra(t,e){return e(t)}var ia=Hi((function(t){var e=t.length,n=e?t[0]:0,r=this.__wrapped__,i=function(e){return Kn(e,t)};return!(e>1||this.__actions__.length)&&r instanceof Pn&&uo(n)?((r=r.slice(n,+n+(e?1:0))).__actions__.push({func:ra,args:[i],thisArg:void 0}),new Nn(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(void 0),t}))):this.thru(i)}));var oa=_i((function(t,e,n){xt.call(t,n)?++t[n]:Yn(t,n,1)}));var aa=Ri(Po),ua=Ri(ko);function sa(t,e){return(ka(t)?ue:er)(t,$i(e,3))}function ca(t,e){return(ka(t)?se:nr)(t,$i(e,3))}var fa=_i((function(t,e,n){xt.call(t,n)?t[n].push(e):Yn(t,n,[e])}));var la=Br((function(t,e,n){var i=-1,o="function"==typeof e,a=La(t)?r(t.length):[];return er(t,(function(t){a[++i]=o?oe(e,t,n):br(t,e,n)})),a})),ha=_i((function(t,e,n){Yn(t,n,e)}));function da(t,e){return(ka(t)?de:Or)(t,$i(e,3))}var pa=_i((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var ma=Br((function(t,e){if(null==t)return[];var n=e.length;return n>1&&so(t,e[0],e[1])?e=[]:n>2&&so(e[0],e[1],e[2])&&(e=[e[0]]),Pr(t,ar(e,1),[])})),va=$e||function(){return Xt.Date.now()};function ga(t,e,n){return e=n?void 0:e,Ui(t,128,void 0,void 0,void 0,void 0,e=t&&null==e?t.length:e)}function ya(t,e){var n;if("function"!=typeof e)throw new gt(o);return t=iu(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}var ba=Br((function(t,e,n){var r=1;if(n.length){var i=ze(n,Qi(ba));r|=32}return Ui(t,r,e,n,i)})),_a=Br((function(t,e,n){var r=3;if(n.length){var i=ze(n,Qi(_a));r|=32}return Ui(e,r,t,n,i)}));function Ea(t,e,n){var r,i,a,u,s,c,f=0,l=!1,h=!1,d=!0;if("function"!=typeof t)throw new gt(o);function p(e){var n=r,o=i;return r=i=void 0,f=e,u=t.apply(o,n)}function m(t){return f=t,s=Eo(g,e),l?p(t):u}function v(t){var n=t-c;return void 0===c||n>=e||n<0||h&&t-f>=a}function g(){var t=va();if(v(t))return y(t);s=Eo(g,function(t){var n=e-(t-c);return h?sn(n,a-(t-f)):n}(t))}function y(t){return s=void 0,d&&r?p(t):(r=i=void 0,u)}function b(){var t=va(),n=v(t);if(r=arguments,i=this,c=t,n){if(void 0===s)return m(c);if(h)return li(s),s=Eo(g,e),p(c)}return void 0===s&&(s=Eo(g,e)),u}return e=au(e)||0,Wa(n)&&(l=!!n.leading,a=(h="maxWait"in n)?un(au(n.maxWait)||0,e):a,d="trailing"in n?!!n.trailing:d),b.cancel=function(){void 0!==s&&li(s),f=0,r=c=i=s=void 0},b.flush=function(){return void 0===s?u:y(va())},b}var wa=Br((function(t,e){return Jn(t,1,e)})),xa=Br((function(t,e,n){return Jn(t,au(e)||0,n)}));function Ta(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new gt(o);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Ta.Cache||Ln),n}function Aa(t){if("function"!=typeof t)throw new gt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ta.Cache=Ln;var Sa=ci((function(t,e){var n=(e=1==e.length&&ka(e[0])?de(e[0],Ie($i())):de(ar(e,1),Ie($i()))).length;return Br((function(r){for(var i=-1,o=sn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return oe(t,this,r)}))})),Ra=Br((function(t,e){return Ui(t,32,void 0,e,ze(e,Qi(Ra)))})),Oa=Br((function(t,e){return Ui(t,64,void 0,e,ze(e,Qi(Oa)))})),Ca=Hi((function(t,e){return Ui(t,256,void 0,void 0,void 0,e)}));function Ma(t,e){return t===e||t!=t&&e!=e}var Ia=Di(mr),Na=Di((function(t,e){return t>=e})),Pa=_r(function(){return arguments}())?_r:function(t){return Ha(t)&&xt.call(t,"callee")&&!qt.call(t,"callee")},ka=r.isArray,Da=Jt?Ie(Jt):function(t){return Ha(t)&&pr(t)==x};function La(t){return null!=t&&za(t.length)&&!Ga(t)}function ja(t){return Ha(t)&&La(t)}var Fa=nn||as,Ba=te?Ie(te):function(t){return Ha(t)&&pr(t)==l};function Ua(t){if(!Ha(t))return!1;var e=pr(t);return e==h||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ya(t)}function Ga(t){if(!Wa(t))return!1;var e=pr(t);return e==d||e==p||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Va(t){return"number"==typeof t&&t==iu(t)}function za(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Wa(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ha(t){return null!=t&&"object"==typeof t}var qa=ee?Ie(ee):function(t){return Ha(t)&&ro(t)==m};function Xa(t){return"number"==typeof t||Ha(t)&&pr(t)==v}function Ya(t){if(!Ha(t)||pr(t)!=g)return!1;var e=Vt(t);if(null===e)return!0;var n=xt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&wt.call(n)==Rt}var Ka=ne?Ie(ne):function(t){return Ha(t)&&pr(t)==y};var Qa=re?Ie(re):function(t){return Ha(t)&&ro(t)==b};function $a(t){return"string"==typeof t||!ka(t)&&Ha(t)&&pr(t)==_}function Za(t){return"symbol"==typeof t||Ha(t)&&pr(t)==E}var Ja=ie?Ie(ie):function(t){return Ha(t)&&za(t.length)&&!!Ut[pr(t)]};var tu=Di(Rr),eu=Di((function(t,e){return t<=e}));function nu(t){if(!t)return[];if(La(t))return $a(t)?Xe(t):yi(t);if($t&&t[$t])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[$t]());var e=ro(t);return(e==m?Ge:e==b?We:Mu)(t)}function ru(t){return t?(t=au(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function iu(t){var e=ru(t),n=e%1;return e==e?n?e-n:e:0}function ou(t){return t?Qn(iu(t),0,4294967295):0}function au(t){if("number"==typeof t)return t;if(Za(t))return NaN;if(Wa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Wa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Me(t);var n=ot.test(t);return n||ut.test(t)?Wt(t.slice(2),n?2:8):it.test(t)?NaN:+t}function uu(t){return bi(t,wu(t))}function su(t){return null==t?"":Zr(t)}var cu=Ei((function(t,e){if(ho(e)||La(e))bi(e,Eu(e),t);else for(var n in e)xt.call(e,n)&&Wn(t,n,e[n])})),fu=Ei((function(t,e){bi(e,wu(e),t)})),lu=Ei((function(t,e,n,r){bi(e,wu(e),t,r)})),hu=Ei((function(t,e,n,r){bi(e,Eu(e),t,r)})),du=Hi(Kn);var pu=Br((function(t,e){t=pt(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&so(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],a=wu(o),u=-1,s=a.length;++u<s;){var c=a[u],f=t[c];(void 0===f||Ma(f,_t[c])&&!xt.call(t,c))&&(t[c]=o[c])}return t})),mu=Br((function(t){return t.push(void 0,Vi),oe(Tu,void 0,t)}));function vu(t,e,n){var r=null==t?void 0:hr(t,e);return void 0===r?n:r}function gu(t,e){return null!=t&&io(t,e,gr)}var yu=Mi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=St.call(e)),t[e]=n}),Wu(Xu)),bu=Mi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=St.call(e)),xt.call(t,e)?t[e].push(n):t[e]=[n]}),$i),_u=Br(br);function Eu(t){return La(t)?Bn(t):Ar(t)}function wu(t){return La(t)?Bn(t,!0):Sr(t)}var xu=Ei((function(t,e,n){Ir(t,e,n)})),Tu=Ei((function(t,e,n,r){Ir(t,e,n,r)})),Au=Hi((function(t,e){var n={};if(null==t)return n;var r=!1;e=de(e,(function(e){return e=si(e,t),r||(r=e.length>1),e})),bi(t,Xi(t),n),r&&(n=$n(n,7,zi));for(var i=e.length;i--;)ti(n,e[i]);return n}));var Su=Hi((function(t,e){return null==t?{}:function(t,e){return kr(t,e,(function(e,n){return gu(t,n)}))}(t,e)}));function Ru(t,e){if(null==t)return{};var n=de(Xi(t),(function(t){return[t]}));return e=$i(e),kr(t,n,(function(t,n){return e(t,n[0])}))}var Ou=Bi(Eu),Cu=Bi(wu);function Mu(t){return null==t?[]:Ne(t,Eu(t))}var Iu=Ai((function(t,e,n){return e=e.toLowerCase(),t+(n?Nu(e):e)}));function Nu(t){return Uu(su(t).toLowerCase())}function Pu(t){return(t=su(t))&&t.replace(ct,je).replace(Pt,"")}var ku=Ai((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Du=Ai((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Lu=Ti("toLowerCase");var ju=Ai((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Fu=Ai((function(t,e,n){return t+(n?" ":"")+Uu(e)}));var Bu=Ai((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Uu=Ti("toUpperCase");function Gu(t,e,n){return t=su(t),void 0===(e=n?void 0:e)?function(t){return jt.test(t)}(t)?function(t){return t.match(Dt)||[]}(t):function(t){return t.match(J)||[]}(t):t.match(e)||[]}var Vu=Br((function(t,e){try{return oe(t,void 0,e)}catch(t){return Ua(t)?t:new K(t)}})),zu=Hi((function(t,e){return ue(e,(function(e){e=Ro(e),Yn(t,e,ba(t[e],t))})),t}));function Wu(t){return function(){return t}}var Hu=Oi(),qu=Oi(!0);function Xu(t){return t}function Yu(t){return Tr("function"==typeof t?t:$n(t,1))}var Ku=Br((function(t,e){return function(n){return br(n,t,e)}})),Qu=Br((function(t,e){return function(n){return br(t,n,e)}}));function $u(t,e,n){var r=Eu(e),i=lr(e,r);null!=n||Wa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=lr(e,Eu(e)));var o=!(Wa(n)&&"chain"in n&&!n.chain),a=Ga(t);return ue(i,(function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__),i=n.__actions__=yi(this.__actions__);return i.push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,pe([this.value()],arguments))})})),t}function Zu(){}var Ju=Ni(de),ts=Ni(ce),es=Ni(ge);function ns(t){return co(t)?Ae(Ro(t)):function(t){return function(e){return hr(e,t)}}(t)}var rs=ki(),is=ki(!0);function os(){return[]}function as(){return!1}var us=Ii((function(t,e){return t+e}),0),ss=ji("ceil"),cs=Ii((function(t,e){return t/e}),1),fs=ji("floor");var ls,hs=Ii((function(t,e){return t*e}),1),ds=ji("round"),ps=Ii((function(t,e){return t-e}),0);return Cn.after=function(t,e){if("function"!=typeof e)throw new gt(o);return t=iu(t),function(){if(--t<1)return e.apply(this,arguments)}},Cn.ary=ga,Cn.assign=cu,Cn.assignIn=fu,Cn.assignInWith=lu,Cn.assignWith=hu,Cn.at=du,Cn.before=ya,Cn.bind=ba,Cn.bindAll=zu,Cn.bindKey=_a,Cn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return ka(t)?t:[t]},Cn.chain=na,Cn.chunk=function(t,e,n){e=(n?so(t,e,n):void 0===e)?1:un(iu(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,u=r(Je(i/e));o<i;)u[a++]=qr(t,o,o+=e);return u},Cn.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Cn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=r(t-1),n=arguments[0],i=t;i--;)e[i-1]=arguments[i];return pe(ka(n)?yi(n):[n],ar(e,1))},Cn.cond=function(t){var e=null==t?0:t.length,n=$i();return t=e?de(t,(function(t){if("function"!=typeof t[1])throw new gt(o);return[n(t[0]),t[1]]})):[],Br((function(n){for(var r=-1;++r<e;){var i=t[r];if(oe(i[0],this,n))return oe(i[1],this,n)}}))},Cn.conforms=function(t){return function(t){var e=Eu(t);return function(n){return Zn(n,t,e)}}($n(t,1))},Cn.constant=Wu,Cn.countBy=oa,Cn.create=function(t,e){var n=Mn(t);return null==e?n:Xn(n,e)},Cn.curry=function t(e,n,r){var i=Ui(e,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},Cn.curryRight=function t(e,n,r){var i=Ui(e,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=t.placeholder,i},Cn.debounce=Ea,Cn.defaults=pu,Cn.defaultsDeep=mu,Cn.defer=wa,Cn.delay=xa,Cn.difference=Mo,Cn.differenceBy=Io,Cn.differenceWith=No,Cn.drop=function(t,e,n){var r=null==t?0:t.length;return r?qr(t,(e=n||void 0===e?1:iu(e))<0?0:e,r):[]},Cn.dropRight=function(t,e,n){var r=null==t?0:t.length;return r?qr(t,0,(e=r-(e=n||void 0===e?1:iu(e)))<0?0:e):[]},Cn.dropRightWhile=function(t,e){return t&&t.length?ni(t,$i(e,3),!0,!0):[]},Cn.dropWhile=function(t,e){return t&&t.length?ni(t,$i(e,3),!0):[]},Cn.fill=function(t,e,n,r){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&so(t,e,n)&&(n=0,r=i),function(t,e,n,r){var i=t.length;for((n=iu(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:iu(r))<0&&(r+=i),r=n>r?0:ou(r);n<r;)t[n++]=e;return t}(t,e,n,r)):[]},Cn.filter=function(t,e){return(ka(t)?fe:or)(t,$i(e,3))},Cn.flatMap=function(t,e){return ar(da(t,e),1)},Cn.flatMapDeep=function(t,e){return ar(da(t,e),1/0)},Cn.flatMapDepth=function(t,e,n){return n=void 0===n?1:iu(n),ar(da(t,e),n)},Cn.flatten=Do,Cn.flattenDeep=function(t){return(null==t?0:t.length)?ar(t,1/0):[]},Cn.flattenDepth=function(t,e){return(null==t?0:t.length)?ar(t,e=void 0===e?1:iu(e)):[]},Cn.flip=function(t){return Ui(t,512)},Cn.flow=Hu,Cn.flowRight=qu,Cn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Cn.functions=function(t){return null==t?[]:lr(t,Eu(t))},Cn.functionsIn=function(t){return null==t?[]:lr(t,wu(t))},Cn.groupBy=fa,Cn.initial=function(t){return(null==t?0:t.length)?qr(t,0,-1):[]},Cn.intersection=jo,Cn.intersectionBy=Fo,Cn.intersectionWith=Bo,Cn.invert=yu,Cn.invertBy=bu,Cn.invokeMap=la,Cn.iteratee=Yu,Cn.keyBy=ha,Cn.keys=Eu,Cn.keysIn=wu,Cn.map=da,Cn.mapKeys=function(t,e){var n={};return e=$i(e,3),cr(t,(function(t,r,i){Yn(n,e(t,r,i),t)})),n},Cn.mapValues=function(t,e){var n={};return e=$i(e,3),cr(t,(function(t,r,i){Yn(n,r,e(t,r,i))})),n},Cn.matches=function(t){return Cr($n(t,1))},Cn.matchesProperty=function(t,e){return Mr(t,$n(e,1))},Cn.memoize=Ta,Cn.merge=xu,Cn.mergeWith=Tu,Cn.method=Ku,Cn.methodOf=Qu,Cn.mixin=$u,Cn.negate=Aa,Cn.nthArg=function(t){return t=iu(t),Br((function(e){return Nr(e,t)}))},Cn.omit=Au,Cn.omitBy=function(t,e){return Ru(t,Aa($i(e)))},Cn.once=function(t){return ya(2,t)},Cn.orderBy=function(t,e,n,r){return null==t?[]:(ka(e)||(e=null==e?[]:[e]),ka(n=r?void 0:n)||(n=null==n?[]:[n]),Pr(t,e,n))},Cn.over=Ju,Cn.overArgs=Sa,Cn.overEvery=ts,Cn.overSome=es,Cn.partial=Ra,Cn.partialRight=Oa,Cn.partition=pa,Cn.pick=Su,Cn.pickBy=Ru,Cn.property=ns,Cn.propertyOf=function(t){return function(e){return null==t?void 0:hr(t,e)}},Cn.pull=Go,Cn.pullAll=Vo,Cn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Dr(t,e,$i(n,2)):t},Cn.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Dr(t,e,void 0,n):t},Cn.pullAt=zo,Cn.range=rs,Cn.rangeRight=is,Cn.rearg=Ca,Cn.reject=function(t,e){return(ka(t)?fe:or)(t,Aa($i(e,3)))},Cn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=$i(e,3);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return Lr(t,i),n},Cn.rest=function(t,e){if("function"!=typeof t)throw new gt(o);return Br(t,e=void 0===e?e:iu(e))},Cn.reverse=Wo,Cn.sampleSize=function(t,e,n){return e=(n?so(t,e,n):void 0===e)?1:iu(e),(ka(t)?Gn:Gr)(t,e)},Cn.set=function(t,e,n){return null==t?t:Vr(t,e,n)},Cn.setWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:Vr(t,e,n,r)},Cn.shuffle=function(t){return(ka(t)?Vn:Hr)(t)},Cn.slice=function(t,e,n){var r=null==t?0:t.length;return r?(n&&"number"!=typeof n&&so(t,e,n)?(e=0,n=r):(e=null==e?0:iu(e),n=void 0===n?r:iu(n)),qr(t,e,n)):[]},Cn.sortBy=ma,Cn.sortedUniq=function(t){return t&&t.length?Qr(t):[]},Cn.sortedUniqBy=function(t,e){return t&&t.length?Qr(t,$i(e,2)):[]},Cn.split=function(t,e,n){return n&&"number"!=typeof n&&so(t,e,n)&&(e=n=void 0),(n=void 0===n?4294967295:n>>>0)?(t=su(t))&&("string"==typeof e||null!=e&&!Ka(e))&&!(e=Zr(e))&&Ue(t)?fi(Xe(t),0,n):t.split(e,n):[]},Cn.spread=function(t,e){if("function"!=typeof t)throw new gt(o);return e=null==e?0:un(iu(e),0),Br((function(n){var r=n[e],i=fi(n,0,e);return r&&pe(i,r),oe(t,this,i)}))},Cn.tail=function(t){var e=null==t?0:t.length;return e?qr(t,1,e):[]},Cn.take=function(t,e,n){return t&&t.length?qr(t,0,(e=n||void 0===e?1:iu(e))<0?0:e):[]},Cn.takeRight=function(t,e,n){var r=null==t?0:t.length;return r?qr(t,(e=r-(e=n||void 0===e?1:iu(e)))<0?0:e,r):[]},Cn.takeRightWhile=function(t,e){return t&&t.length?ni(t,$i(e,3),!1,!0):[]},Cn.takeWhile=function(t,e){return t&&t.length?ni(t,$i(e,3)):[]},Cn.tap=function(t,e){return e(t),t},Cn.throttle=function(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new gt(o);return Wa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ea(t,e,{leading:r,maxWait:e,trailing:i})},Cn.thru=ra,Cn.toArray=nu,Cn.toPairs=Ou,Cn.toPairsIn=Cu,Cn.toPath=function(t){return ka(t)?de(t,Ro):Za(t)?[t]:yi(So(su(t)))},Cn.toPlainObject=uu,Cn.transform=function(t,e,n){var r=ka(t),i=r||Fa(t)||Ja(t);if(e=$i(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Wa(t)&&Ga(o)?Mn(Vt(t)):{}}return(i?ue:cr)(t,(function(t,r,i){return e(n,t,r,i)})),n},Cn.unary=function(t){return ga(t,1)},Cn.union=Ho,Cn.unionBy=qo,Cn.unionWith=Xo,Cn.uniq=function(t){return t&&t.length?Jr(t):[]},Cn.uniqBy=function(t,e){return t&&t.length?Jr(t,$i(e,2)):[]},Cn.uniqWith=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?Jr(t,void 0,e):[]},Cn.unset=function(t,e){return null==t||ti(t,e)},Cn.unzip=Yo,Cn.unzipWith=Ko,Cn.update=function(t,e,n){return null==t?t:ei(t,e,ui(n))},Cn.updateWith=function(t,e,n,r){return r="function"==typeof r?r:void 0,null==t?t:ei(t,e,ui(n),r)},Cn.values=Mu,Cn.valuesIn=function(t){return null==t?[]:Ne(t,wu(t))},Cn.without=Qo,Cn.words=Gu,Cn.wrap=function(t,e){return Ra(ui(e),t)},Cn.xor=$o,Cn.xorBy=Zo,Cn.xorWith=Jo,Cn.zip=ta,Cn.zipObject=function(t,e){return oi(t||[],e||[],Wn)},Cn.zipObjectDeep=function(t,e){return oi(t||[],e||[],Vr)},Cn.zipWith=ea,Cn.entries=Ou,Cn.entriesIn=Cu,Cn.extend=fu,Cn.extendWith=lu,$u(Cn,Cn),Cn.add=us,Cn.attempt=Vu,Cn.camelCase=Iu,Cn.capitalize=Nu,Cn.ceil=ss,Cn.clamp=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=au(n))==n?n:0),void 0!==e&&(e=(e=au(e))==e?e:0),Qn(au(t),e,n)},Cn.clone=function(t){return $n(t,4)},Cn.cloneDeep=function(t){return $n(t,5)},Cn.cloneDeepWith=function(t,e){return $n(t,5,e="function"==typeof e?e:void 0)},Cn.cloneWith=function(t,e){return $n(t,4,e="function"==typeof e?e:void 0)},Cn.conformsTo=function(t,e){return null==e||Zn(t,e,Eu(e))},Cn.deburr=Pu,Cn.defaultTo=function(t,e){return null==t||t!=t?e:t},Cn.divide=cs,Cn.endsWith=function(t,e,n){t=su(t),e=Zr(e);var r=t.length,i=n=void 0===n?r:Qn(iu(n),0,r);return(n-=e.length)>=0&&t.slice(n,i)==e},Cn.eq=Ma,Cn.escape=function(t){return(t=su(t))&&B.test(t)?t.replace(j,Fe):t},Cn.escapeRegExp=function(t){return(t=su(t))&&X.test(t)?t.replace(q,"\\$&"):t},Cn.every=function(t,e,n){var r=ka(t)?ce:rr;return n&&so(t,e,n)&&(e=void 0),r(t,$i(e,3))},Cn.find=aa,Cn.findIndex=Po,Cn.findKey=function(t,e){return be(t,$i(e,3),cr)},Cn.findLast=ua,Cn.findLastIndex=ko,Cn.findLastKey=function(t,e){return be(t,$i(e,3),fr)},Cn.floor=fs,Cn.forEach=sa,Cn.forEachRight=ca,Cn.forIn=function(t,e){return null==t?t:ur(t,$i(e,3),wu)},Cn.forInRight=function(t,e){return null==t?t:sr(t,$i(e,3),wu)},Cn.forOwn=function(t,e){return t&&cr(t,$i(e,3))},Cn.forOwnRight=function(t,e){return t&&fr(t,$i(e,3))},Cn.get=vu,Cn.gt=Ia,Cn.gte=Na,Cn.has=function(t,e){return null!=t&&io(t,e,vr)},Cn.hasIn=gu,Cn.head=Lo,Cn.identity=Xu,Cn.includes=function(t,e,n,r){t=La(t)?t:Mu(t),n=n&&!r?iu(n):0;var i=t.length;return n<0&&(n=un(i+n,0)),$a(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ee(t,e,n)>-1},Cn.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:iu(n);return i<0&&(i=un(r+i,0)),Ee(t,e,i)},Cn.inRange=function(t,e,n){return e=ru(e),void 0===n?(n=e,e=0):n=ru(n),function(t,e,n){return t>=sn(e,n)&&t<un(e,n)}(t=au(t),e,n)},Cn.invoke=_u,Cn.isArguments=Pa,Cn.isArray=ka,Cn.isArrayBuffer=Da,Cn.isArrayLike=La,Cn.isArrayLikeObject=ja,Cn.isBoolean=function(t){return!0===t||!1===t||Ha(t)&&pr(t)==f},Cn.isBuffer=Fa,Cn.isDate=Ba,Cn.isElement=function(t){return Ha(t)&&1===t.nodeType&&!Ya(t)},Cn.isEmpty=function(t){if(null==t)return!0;if(La(t)&&(ka(t)||"string"==typeof t||"function"==typeof t.splice||Fa(t)||Ja(t)||Pa(t)))return!t.length;var e=ro(t);if(e==m||e==b)return!t.size;if(ho(t))return!Ar(t).length;for(var n in t)if(xt.call(t,n))return!1;return!0},Cn.isEqual=function(t,e){return Er(t,e)},Cn.isEqualWith=function(t,e,n){var r=(n="function"==typeof n?n:void 0)?n(t,e):void 0;return void 0===r?Er(t,e,void 0,n):!!r},Cn.isError=Ua,Cn.isFinite=function(t){return"number"==typeof t&&rn(t)},Cn.isFunction=Ga,Cn.isInteger=Va,Cn.isLength=za,Cn.isMap=qa,Cn.isMatch=function(t,e){return t===e||wr(t,e,Ji(e))},Cn.isMatchWith=function(t,e,n){return n="function"==typeof n?n:void 0,wr(t,e,Ji(e),n)},Cn.isNaN=function(t){return Xa(t)&&t!=+t},Cn.isNative=function(t){if(lo(t))throw new K("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return xr(t)},Cn.isNil=function(t){return null==t},Cn.isNull=function(t){return null===t},Cn.isNumber=Xa,Cn.isObject=Wa,Cn.isObjectLike=Ha,Cn.isPlainObject=Ya,Cn.isRegExp=Ka,Cn.isSafeInteger=function(t){return Va(t)&&t>=-9007199254740991&&t<=9007199254740991},Cn.isSet=Qa,Cn.isString=$a,Cn.isSymbol=Za,Cn.isTypedArray=Ja,Cn.isUndefined=function(t){return void 0===t},Cn.isWeakMap=function(t){return Ha(t)&&ro(t)==w},Cn.isWeakSet=function(t){return Ha(t)&&"[object WeakSet]"==pr(t)},Cn.join=function(t,e){return null==t?"":on.call(t,e)},Cn.kebabCase=ku,Cn.last=Uo,Cn.lastIndexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=iu(n))<0?un(r+i,0):sn(i,r-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,i):_e(t,xe,i,!0)},Cn.lowerCase=Du,Cn.lowerFirst=Lu,Cn.lt=tu,Cn.lte=eu,Cn.max=function(t){return t&&t.length?ir(t,Xu,mr):void 0},Cn.maxBy=function(t,e){return t&&t.length?ir(t,$i(e,2),mr):void 0},Cn.mean=function(t){return Te(t,Xu)},Cn.meanBy=function(t,e){return Te(t,$i(e,2))},Cn.min=function(t){return t&&t.length?ir(t,Xu,Rr):void 0},Cn.minBy=function(t,e){return t&&t.length?ir(t,$i(e,2),Rr):void 0},Cn.stubArray=os,Cn.stubFalse=as,Cn.stubObject=function(){return{}},Cn.stubString=function(){return""},Cn.stubTrue=function(){return!0},Cn.multiply=hs,Cn.nth=function(t,e){return t&&t.length?Nr(t,iu(e)):void 0},Cn.noConflict=function(){return Xt._===this&&(Xt._=Ot),this},Cn.noop=Zu,Cn.now=va,Cn.pad=function(t,e,n){t=su(t);var r=(e=iu(e))?qe(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Pi(tn(i),n)+t+Pi(Je(i),n)},Cn.padEnd=function(t,e,n){t=su(t);var r=(e=iu(e))?qe(t):0;return e&&r<e?t+Pi(e-r,n):t},Cn.padStart=function(t,e,n){t=su(t);var r=(e=iu(e))?qe(t):0;return e&&r<e?Pi(e-r,n)+t:t},Cn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),fn(su(t).replace(Y,""),e||0)},Cn.random=function(t,e,n){if(n&&"boolean"!=typeof n&&so(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=ru(t),void 0===e?(e=t,t=0):e=ru(e)),t>e){var r=t;t=e,e=r}if(n||t%1||e%1){var i=ln();return sn(t+i*(e-t+zt("1e-"+((i+"").length-1))),e)}return jr(t,e)},Cn.reduce=function(t,e,n){var r=ka(t)?me:Re,i=arguments.length<3;return r(t,$i(e,4),n,i,er)},Cn.reduceRight=function(t,e,n){var r=ka(t)?ve:Re,i=arguments.length<3;return r(t,$i(e,4),n,i,nr)},Cn.repeat=function(t,e,n){return e=(n?so(t,e,n):void 0===e)?1:iu(e),Fr(su(t),e)},Cn.replace=function(){var t=arguments,e=su(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Cn.result=function(t,e,n){var r=-1,i=(e=si(e,t)).length;for(i||(i=1,t=void 0);++r<i;){var o=null==t?void 0:t[Ro(e[r])];void 0===o&&(r=i,o=n),t=Ga(o)?o.call(t):o}return t},Cn.round=ds,Cn.runInContext=t,Cn.sample=function(t){return(ka(t)?Un:Ur)(t)},Cn.size=function(t){if(null==t)return 0;if(La(t))return $a(t)?qe(t):t.length;var e=ro(t);return e==m||e==b?t.size:Ar(t).length},Cn.snakeCase=ju,Cn.some=function(t,e,n){var r=ka(t)?ge:Xr;return n&&so(t,e,n)&&(e=void 0),r(t,$i(e,3))},Cn.sortedIndex=function(t,e){return Yr(t,e)},Cn.sortedIndexBy=function(t,e,n){return Kr(t,e,$i(n,2))},Cn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=Yr(t,e);if(r<n&&Ma(t[r],e))return r}return-1},Cn.sortedLastIndex=function(t,e){return Yr(t,e,!0)},Cn.sortedLastIndexBy=function(t,e,n){return Kr(t,e,$i(n,2),!0)},Cn.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var n=Yr(t,e,!0)-1;if(Ma(t[n],e))return n}return-1},Cn.startCase=Fu,Cn.startsWith=function(t,e,n){return t=su(t),n=null==n?0:Qn(iu(n),0,t.length),e=Zr(e),t.slice(n,n+e.length)==e},Cn.subtract=ps,Cn.sum=function(t){return t&&t.length?Oe(t,Xu):0},Cn.sumBy=function(t,e){return t&&t.length?Oe(t,$i(e,2)):0},Cn.template=function(t,e,n){var r=Cn.templateSettings;n&&so(t,e,n)&&(e=void 0),t=su(t),e=lu({},e,r,Gi);var i,o,a=lu({},e.imports,r.imports,Gi),u=Eu(a),s=Ne(a,u),c=0,f=e.interpolate||ft,l="__p += '",h=mt((e.escape||ft).source+"|"+f.source+"|"+(f===V?nt:ft).source+"|"+(e.evaluate||ft).source+"|$","g"),d="//# sourceURL="+(xt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Bt+"]")+"\n";t.replace(h,(function(e,n,r,a,u,s){return r||(r=a),l+=t.slice(c,s).replace(lt,Be),n&&(i=!0,l+="' +\n__e("+n+") +\n'"),u&&(o=!0,l+="';\n"+u+";\n__p += '"),r&&(l+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=s+e.length,e})),l+="';\n";var p=xt.call(e,"variable")&&e.variable;if(p){if(tt.test(p))throw new K("Invalid `variable` option passed into `_.template`")}else l="with (obj) {\n"+l+"\n}\n";l=(o?l.replace(P,""):l).replace(k,"$1").replace(D,"$1;"),l="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var m=Vu((function(){return ht(u,d+"return "+l).apply(void 0,s)}));if(m.source=l,Ua(m))throw m;return m},Cn.times=function(t,e){if((t=iu(t))<1||t>9007199254740991)return[];var n=4294967295,r=sn(t,4294967295);t-=4294967295;for(var i=Ce(r,e=$i(e));++n<t;)e(n);return i},Cn.toFinite=ru,Cn.toInteger=iu,Cn.toLength=ou,Cn.toLower=function(t){return su(t).toLowerCase()},Cn.toNumber=au,Cn.toSafeInteger=function(t){return t?Qn(iu(t),-9007199254740991,9007199254740991):0===t?t:0},Cn.toString=su,Cn.toUpper=function(t){return su(t).toUpperCase()},Cn.trim=function(t,e,n){if((t=su(t))&&(n||void 0===e))return Me(t);if(!t||!(e=Zr(e)))return t;var r=Xe(t),i=Xe(e);return fi(r,ke(r,i),De(r,i)+1).join("")},Cn.trimEnd=function(t,e,n){if((t=su(t))&&(n||void 0===e))return t.slice(0,Ye(t)+1);if(!t||!(e=Zr(e)))return t;var r=Xe(t);return fi(r,0,De(r,Xe(e))+1).join("")},Cn.trimStart=function(t,e,n){if((t=su(t))&&(n||void 0===e))return t.replace(Y,"");if(!t||!(e=Zr(e)))return t;var r=Xe(t);return fi(r,ke(r,Xe(e))).join("")},Cn.truncate=function(t,e){var n=30,r="...";if(Wa(e)){var i="separator"in e?e.separator:i;n="length"in e?iu(e.length):n,r="omission"in e?Zr(e.omission):r}var o=(t=su(t)).length;if(Ue(t)){var a=Xe(t);o=a.length}if(n>=o)return t;var u=n-qe(r);if(u<1)return r;var s=a?fi(a,0,u).join(""):t.slice(0,u);if(void 0===i)return s+r;if(a&&(u+=s.length-u),Ka(i)){if(t.slice(u).search(i)){var c,f=s;for(i.global||(i=mt(i.source,su(rt.exec(i))+"g")),i.lastIndex=0;c=i.exec(f);)var l=c.index;s=s.slice(0,void 0===l?u:l)}}else if(t.indexOf(Zr(i),u)!=u){var h=s.lastIndexOf(i);h>-1&&(s=s.slice(0,h))}return s+r},Cn.unescape=function(t){return(t=su(t))&&F.test(t)?t.replace(L,Ke):t},Cn.uniqueId=function(t){var e=++Tt;return su(t)+e},Cn.upperCase=Bu,Cn.upperFirst=Uu,Cn.each=sa,Cn.eachRight=ca,Cn.first=Lo,$u(Cn,(ls={},cr(Cn,(function(t,e){xt.call(Cn.prototype,e)||(ls[e]=t)})),ls),{chain:!1}),Cn.VERSION="4.17.21",ue(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Cn[t].placeholder=Cn})),ue(["drop","take"],(function(t,e){Pn.prototype[t]=function(n){n=void 0===n?1:un(iu(n),0);var r=this.__filtered__&&!e?new Pn(this):this.clone();return r.__filtered__?r.__takeCount__=sn(n,r.__takeCount__):r.__views__.push({size:sn(n,4294967295),type:t+(r.__dir__<0?"Right":"")}),r},Pn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),ue(["filter","map","takeWhile"],(function(t,e){var n=e+1,r=1==n||3==n;Pn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:$i(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}})),ue(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Pn.prototype[t]=function(){return this[n](1).value()[0]}})),ue(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Pn.prototype[t]=function(){return this.__filtered__?new Pn(this):this[n](1)}})),Pn.prototype.compact=function(){return this.filter(Xu)},Pn.prototype.find=function(t){return this.filter(t).head()},Pn.prototype.findLast=function(t){return this.reverse().find(t)},Pn.prototype.invokeMap=Br((function(t,e){return"function"==typeof t?new Pn(this):this.map((function(n){return br(n,t,e)}))})),Pn.prototype.reject=function(t){return this.filter(Aa($i(t)))},Pn.prototype.slice=function(t,e){t=iu(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Pn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),void 0!==e&&(n=(e=iu(e))<0?n.dropRight(-e):n.take(e-t)),n)},Pn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Pn.prototype.toArray=function(){return this.take(4294967295)},cr(Pn.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),i=Cn[r?"take"+("last"==e?"Right":""):e],o=r||/^find/.test(e);i&&(Cn.prototype[e]=function(){var e=this.__wrapped__,a=r?[1]:arguments,u=e instanceof Pn,s=a[0],c=u||ka(e),f=function(t){var e=i.apply(Cn,pe([t],a));return r&&l?e[0]:e};c&&n&&"function"==typeof s&&1!=s.length&&(u=c=!1);var l=this.__chain__,h=!!this.__actions__.length,d=o&&!l,p=u&&!h;if(!o&&c){e=p?e:new Pn(this);var m=t.apply(e,a);return m.__actions__.push({func:ra,args:[f],thisArg:void 0}),new Nn(m,l)}return d&&p?t.apply(this,a):(m=this.thru(f),d?r?m.value()[0]:m.value():m)})})),ue(["pop","push","shift","sort","splice","unshift"],(function(t){var e=yt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Cn.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(ka(i)?i:[],t)}return this[n]((function(n){return e.apply(ka(n)?n:[],t)}))}})),cr(Pn.prototype,(function(t,e){var n=Cn[e];if(n){var r=n.name+"";xt.call(_n,r)||(_n[r]=[]),_n[r].push({name:e,func:n})}})),_n[Ci(void 0,2).name]=[{name:"wrapper",func:void 0}],Pn.prototype.clone=function(){var t=new Pn(this.__wrapped__);return t.__actions__=yi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=yi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=yi(this.__views__),t},Pn.prototype.reverse=function(){if(this.__filtered__){var t=new Pn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Pn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=ka(t),r=e<0,i=n?t.length:0,o=function(t,e,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=sn(e,t+a);break;case"takeRight":t=un(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,u=o.end,s=u-a,c=r?u:a-1,f=this.__iteratees__,l=f.length,h=0,d=sn(s,this.__takeCount__);if(!n||!r&&i==s&&d==s)return ri(t,this.__actions__);var p=[];t:for(;s--&&h<d;){for(var m=-1,v=t[c+=e];++m<l;){var g=f[m],y=g.iteratee,b=g.type,_=y(v);if(2==b)v=_;else if(!_){if(1==b)continue t;break t}}p[h++]=v}return p},Cn.prototype.at=ia,Cn.prototype.chain=function(){return na(this)},Cn.prototype.commit=function(){return new Nn(this.value(),this.__chain__)},Cn.prototype.next=function(){void 0===this.__values__&&(this.__values__=nu(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?void 0:this.__values__[this.__index__++]}},Cn.prototype.plant=function(t){for(var e,n=this;n instanceof In;){var r=Co(n);r.__index__=0,r.__values__=void 0,e?i.__wrapped__=r:e=r;var i=r;n=n.__wrapped__}return i.__wrapped__=t,e},Cn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Pn){var e=t;return this.__actions__.length&&(e=new Pn(this)),(e=e.reverse()).__actions__.push({func:ra,args:[Wo],thisArg:void 0}),new Nn(e,this.__chain__)}return this.thru(Wo)},Cn.prototype.toJSON=Cn.prototype.valueOf=Cn.prototype.value=function(){return ri(this.__wrapped__,this.__actions__)},Cn.prototype.first=Cn.prototype.head,$t&&(Cn.prototype[$t]=function(){return this}),Cn}();Xt._=Qe,void 0===(i=function(){return Qe}.call(e,n,e,r))||(r.exports=i)}).call(this)}).call(this,n(85),n(230)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports="2.1.4"},function(t,e,n){var r=n(28),i=n(105);function o(t){return r.map(t.nodes(),(function(e){var n=t.node(e),i=t.parent(e),o={v:e};return r.isUndefined(n)||(o.value=n),r.isUndefined(i)||(o.parent=i),o}))}function a(t){return r.map(t.edges(),(function(e){var n=t.edge(e),i={v:e.v,w:e.w};return r.isUndefined(e.name)||(i.name=e.name),r.isUndefined(n)||(i.value=n),i}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:o(t),edges:a(t)};r.isUndefined(t.graph())||(e.value=r.clone(t.graph()));return e},read:function(t){var e=new i(t.options).setGraph(t.value);return r.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),r.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},function(t,e,n){t.exports={components:n(234),dijkstra:n(129),dijkstraAll:n(235),findCycles:n(236),floydWarshall:n(237),isAcyclic:n(238),postorder:n(239),preorder:n(240),prim:n(241),tarjan:n(131),topsort:n(132)}},function(t,e,n){var r=n(28);t.exports=function(t){var e,n={},i=[];function o(i){r.has(n,i)||(n[i]=!0,e.push(i),r.each(t.successors(i),o),r.each(t.predecessors(i),o))}return r.each(t.nodes(),(function(t){e=[],o(t),e.length&&i.push(e)})),i}},function(t,e,n){var r=n(129),i=n(28);t.exports=function(t,e,n){return i.transform(t.nodes(),(function(i,o){i[o]=r(t,o,e,n)}),{})}},function(t,e,n){var r=n(28),i=n(131);t.exports=function(t){return r.filter(i(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},function(t,e,n){var r=n(28);t.exports=function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})})),n(t).forEach((function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var e=r[t];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[t],i=e[n],a=o[n],u=r.distance+i.distance;u<a.distance&&(a.distance=u,a.predecessor=i.predecessor)}))}))})),r}(t,e||i,n||function(e){return t.outEdges(e)})};var i=r.constant(1)},function(t,e,n){var r=n(132);t.exports=function(t){try{r(t)}catch(t){if(t instanceof r.CycleException)return!1;throw t}return!0}},function(t,e,n){var r=n(133);t.exports=function(t,e){return r(t,e,"post")}},function(t,e,n){var r=n(133);t.exports=function(t,e){return r(t,e,"pre")}},function(t,e,n){var r=n(28),i=n(105),o=n(130);t.exports=function(t,e){var n,a=new i,u={},s=new o;function c(t){var r=t.v===n?t.w:t.v,i=s.priority(r);if(void 0!==i){var o=e(t);o<i&&(u[r]=n,s.decrease(r,o))}}if(0===t.nodeCount())return a;r.each(t.nodes(),(function(t){s.add(t,Number.POSITIVE_INFINITY),a.setNode(t)})),s.decrease(t.nodes()[0],0);var f=!1;for(;s.size()>0;){if(n=s.removeMin(),r.has(u,n))a.setEdge(n,u[n]);else{if(f)throw new Error("Input graph is not connected: "+t);f=!0}t.nodeEdges(n).forEach(c)}return a}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var s,c=[],f=!1,l=-1;function h(){f&&s&&(f=!1,s.length?c=s.concat(c):l=-1,c.length&&d())}function d(){if(!f){var t=u(h);f=!0;for(var e=c.length;e;){for(s=c,c=[];++l<e;)s&&s[l].run();l=-1,e=c.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||f||u(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){var r=function(t){"use strict";var e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof l?e:l,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return A()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=_(a,n);if(u){if(u===f)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var f={};function l(){}function h(){}function d(){}var p={};u(p,i,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(T([])));v&&v!==e&&n.call(v,i)&&(p=v);var g=d.prototype=l.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var r;this._invoke=function(i,o){function a(){return new e((function(r,a){!function r(i,o,a,u){var s=c(t[i],t,o);if("throw"!==s.type){var f=s.arg,l=f.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(l).then((function(t){f.value=t,a(f)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function _(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function T(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,u(g,"constructor",d),u(d,"constructor",h),h.displayName=u(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},y(b.prototype),u(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new b(s(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},y(g),u(g,a,"Generator"),u(g,i,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=T,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),w(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=r}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){u=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},o=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Container=void 0;var a=n(248),u=n(25),s=n(35),c=n(20),f=n(137),l=n(249),h=n(256),d=n(258),p=n(44),m=n(54),v=n(261),g=n(262),y=function(){function t(t){this._appliedMiddleware=[];var e=t||{};if("object"!=typeof e)throw new Error(""+u.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(void 0===e.defaultScope)e.defaultScope=s.BindingScopeEnum.Transient;else if(e.defaultScope!==s.BindingScopeEnum.Singleton&&e.defaultScope!==s.BindingScopeEnum.Transient&&e.defaultScope!==s.BindingScopeEnum.Request)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error(""+u.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=p.id(),this._bindingDictionary=new g.Lookup,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new f.MetadataReader}return t.merge=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var a=new t,u=o([e,n],r).map((function(t){return l.getBindingDictionary(t)})),s=l.getBindingDictionary(a);function c(t,e){t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))}return u.forEach((function(t){c(t,s)})),a},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;r<i.length;r++){var o=i[r],a=n(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r(this,void 0,void 0,(function(){var e,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,i.label=1;case 1:return n<r.length?(o=r[n],a=e(o.id),[4,o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)]):[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=function(t){return function(e){return e.moduleId===t}};e.forEach((function(e){var n=r(e.id);t._bindingDictionary.removeByCondition(n)}))},t.prototype.bind=function(t){var e=this.options.defaultScope||s.BindingScopeEnum.Transient,n=new a.Binding(t,e);return this._bindingDictionary.add(t,n),new d.BindingToSyntax(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error(u.CANNOT_UNBIND+" "+m.getServiceIdentifierAsString(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new g.Lookup},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,c.NAMED_TAG,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=l.createMockRequest(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(v.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error(u.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._appliedMiddleware=this._appliedMiddleware.concat(t);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,s.TargetTypeEnum.Variable,t)},t.prototype.getTagged=function(t,e,n){return this._get(!1,!1,s.TargetTypeEnum.Variable,t,e,n)},t.prototype.getNamed=function(t,e){return this.getTagged(t,c.NAMED_TAG,e)},t.prototype.getAll=function(t){return this._get(!0,!0,s.TargetTypeEnum.Variable,t)},t.prototype.getAllTagged=function(t,e,n){return this._get(!1,!0,s.TargetTypeEnum.Variable,t,e,n)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,c.NAMED_TAG,e)},t.prototype.resolve=function(t){var e=this.createChild();return e.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){e.applyMiddleware(t)})),e.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind.bind(t)(r);return e(i,n),i}};return function(r){return{bindFunction:(i=r,function(n){var r=t.bind.bind(t)(n);return e(r,i),r}),isboundFunction:function(e){return t.isBound.bind(t)(e)},rebindFunction:n(r),unbindFunction:function(e){t.unbind.bind(t)(e)}};var i}},t.prototype._get=function(t,e,n,r,i,o){var a=null,s={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:e,key:i,serviceIdentifier:r,targetType:n,value:o};if(this._middleware){if(null==(a=this._middleware(s)))throw new Error(u.INVALID_MIDDLEWARE_RETURN)}else a=this._planAndResolve()(s);return a},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=l.plan(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return n=e.contextInterceptor(n),h.resolve(n)}},t}();e.Container=y},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Binding=void 0;var r=n(35),i=n(44),o=function(){function t(t,e){this.id=i.id(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=r.BindingTypeEnum.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===r.BindingScopeEnum.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.cache=this.cache,e},t}();e.Binding=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBindingDictionary=e.createMockRequest=e.plan=void 0;var r=n(250),i=n(25),o=n(35),a=n(20),u=n(138),s=n(54),c=n(251),f=n(30),l=n(252),h=n(253),d=n(255),p=n(140);function m(t){return t._bindingDictionary}function v(t,e,n,o,a){var u=g(n.container,a.serviceIdentifier),c=[];return u.length===r.BindingCount.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof a.serviceIdentifier&&t.getConstructorMetadata(a.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(a.serviceIdentifier).toSelf(),u=g(n.container,a.serviceIdentifier)),c=e?u:u.filter((function(t){var e=new d.Request(t.serviceIdentifier,n,o,t,a);return t.constraint(e)})),function(t,e,n,o){switch(e.length){case r.BindingCount.NoBindingsAvailable:if(n.isOptional())return e;var a=s.getServiceIdentifierAsString(t),u=i.NOT_REGISTERED;throw u+=s.listMetadataForTarget(a,n),u+=s.listRegisteredBindingsForServiceIdentifier(o,a,g),new Error(u);case r.BindingCount.OnlyOneBindingAvailable:if(!n.isArray())return e;case r.BindingCount.MultipleBindingsAvailable:default:if(n.isArray())return e;a=s.getServiceIdentifierAsString(t),u=i.AMBIGUOUS_MATCH+" "+a;throw u+=s.listRegisteredBindingsForServiceIdentifier(o,a,g),new Error(u)}}(a.serviceIdentifier,c,a,n.container),c}function g(t,e){var n=[],r=m(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=g(t.parent,e)),n}e.getBindingDictionary=m,e.plan=function(t,e,n,r,m,g,y,b){void 0===b&&(b=!1);var _=new c.Context(e),E=function(t,e,n,r,i,o){var u=t?a.MULTI_INJECT_TAG:a.INJECT_TAG,s=new f.Metadata(u,n),c=new p.Target(e,r,n,s);if(void 0!==i){var l=new f.Metadata(i,o);c.metadata.push(l)}return c}(n,r,m,"",g,y);try{return function t(e,n,r,a,u,s){var c,f;if(null===u){c=v(e,n,a,null,s),f=new d.Request(r,a,null,c,s);var p=new l.Plan(a,f);a.addPlan(p)}else c=v(e,n,a,u,s),f=u.addChildRequest(s.serviceIdentifier,c,s);c.forEach((function(n){var r=null;if(s.isArray())r=f.addChildRequest(n.serviceIdentifier,n,s);else{if(n.cache)return;r=f}if(n.type===o.BindingTypeEnum.Instance&&null!==n.implementationType){var u=h.getDependencies(e,n.implementationType);if(!a.container.options.skipBaseClassChecks){var c=h.getBaseClassDependencyCount(e,n.implementationType);if(u.length<c){var l=i.ARGUMENTS_LENGTH_MISMATCH(h.getFunctionName(n.implementationType));throw new Error(l)}}u.forEach((function(n){t(e,!1,n.serviceIdentifier,a,r,n)}))}}))}(t,b,m,_,null,E),_}catch(t){throw u.isStackOverflowExeption(t)&&_.plan&&s.circularDependencyToException(_.plan.rootRequest),t}},e.createMockRequest=function(t,e,n,r){var i=new p.Target(o.TargetTypeEnum.Variable,"",e,new f.Metadata(n,r)),a=new c.Context(t);return new d.Request(e,a,null,[],i)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingCount=void 0;e.BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Context=void 0;var r=n(44),i=function(){function t(t){this.id=r.id(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}();e.Context=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=void 0;var r=function(t,e){this.parentContext=t,this.rootRequest=e};e.Plan=r},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.getFunctionName=e.getBaseClassDependencyCount=e.getDependencies=void 0;var i=n(139),o=n(25),a=n(35),u=n(20),s=n(54);Object.defineProperty(e,"getFunctionName",{enumerable:!0,get:function(){return s.getFunctionName}});var c=n(140);function f(t,e,n,i){var u=t.getConstructorMetadata(n),s=u.compilerGeneratedMetadata;if(void 0===s){var f=o.MISSING_INJECTABLE_ANNOTATION+" "+e+".";throw new Error(f)}var d=u.userGeneratedMetadata,p=Object.keys(d),m=0===n.length&&p.length>0,v=p.length>n.length,g=function(t,e,n,r,i){for(var o=[],a=0;a<i;a++){var u=l(a,t,e,n,r);null!==u&&o.push(u)}return o}(i,e,s,d,m||v?p.length:n.length),y=function t(e,n){for(var i=e.getPropertiesMetadata(n),o=[],u=Object.keys(i),s=0,f=u;s<f.length;s++){var l=f[s],d=i[l],p=h(i[l]),m=p.targetName||l,v=p.inject||p.multiInject,g=new c.Target(a.TargetTypeEnum.ClassProperty,m,v);g.metadata=d,o.push(g)}var y=Object.getPrototypeOf(n.prototype).constructor;if(y!==Object){var b=t(e,y);o=r(r([],o),b)}return o}(t,n);return r(r([],g),y)}function l(t,e,n,r,u){var s=u[t.toString()]||[],f=h(s),l=!0!==f.unmanaged,d=r[t],p=f.inject||f.multiInject;if((d=p||d)instanceof i.LazyServiceIdentifer&&(d=d.unwrap()),l){if(!e&&(d===Object||d===Function||void 0===d)){var m=o.MISSING_INJECT_ANNOTATION+" argument "+t+" in class "+n+".";throw new Error(m)}var v=new c.Target(a.TargetTypeEnum.ConstructorArgument,f.targetName,d);return v.metadata=s,v}return null}function h(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[u.INJECT_TAG],multiInject:e[u.MULTI_INJECT_TAG],targetName:e[u.NAME_TAG],unmanaged:e[u.UNMANAGED_TAG]}}e.getDependencies=function(t,e){return f(t,s.getFunctionName(e),e,!1)},e.getBaseClassDependencyCount=function t(e,n){var r=Object.getPrototypeOf(n.prototype).constructor;if(r!==Object){var i=f(e,s.getFunctionName(r),r,!0),o=i.map((function(t){return t.metadata.filter((function(t){return t.key===u.UNMANAGED_TAG}))})),a=[].concat.apply([],o).length,c=i.length-a;return c>0?c:t(e,r)}return 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QueryableString=void 0;var r=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}();e.QueryableString=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Request=void 0;var r=n(44),i=function(){function t(t,e,n,i,o){this.id=r.id(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();e.Request=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolve=void 0;var r=n(25),i=n(35),o=n(138),a=n(54),u=n(257),s=function(t,e,n){try{return n()}catch(n){throw o.isStackOverflowExeption(n)?new Error(r.CIRCULAR_DEPENDENCY_IN_FACTORY(t,e.toString())):n}},c=function(t){return function(e){e.parentContext.setCurrentRequest(e);var n=e.bindings,o=e.childRequests,f=e.target&&e.target.isArray(),l=!(e.parentRequest&&e.parentRequest.target&&e.target&&e.parentRequest.target.matchesArray(e.target.serviceIdentifier));if(f&&l)return o.map((function(e){return c(t)(e)}));var h=null;if(!e.target.isOptional()||0!==n.length){var d=n[0],p=d.scope===i.BindingScopeEnum.Singleton,m=d.scope===i.BindingScopeEnum.Request;if(p&&d.activated)return d.cache;if(m&&null!==t&&t.has(d.id))return t.get(d.id);if(d.type===i.BindingTypeEnum.ConstantValue)h=d.cache,d.activated=!0;else if(d.type===i.BindingTypeEnum.Function)h=d.cache,d.activated=!0;else if(d.type===i.BindingTypeEnum.Constructor)h=d.implementationType;else if(d.type===i.BindingTypeEnum.DynamicValue&&null!==d.dynamicValue)h=s("toDynamicValue",d.serviceIdentifier,(function(){return d.dynamicValue(e.parentContext)}));else if(d.type===i.BindingTypeEnum.Factory&&null!==d.factory)h=s("toFactory",d.serviceIdentifier,(function(){return d.factory(e.parentContext)}));else if(d.type===i.BindingTypeEnum.Provider&&null!==d.provider)h=s("toProvider",d.serviceIdentifier,(function(){return d.provider(e.parentContext)}));else{if(d.type!==i.BindingTypeEnum.Instance||null===d.implementationType){var v=a.getServiceIdentifierAsString(e.serviceIdentifier);throw new Error(r.INVALID_BINDING_TYPE+" "+v)}h=u.resolveInstance(d.implementationType,o,c(t))}return"function"==typeof d.onActivation&&(h=d.onActivation(e.parentContext,h)),p&&(d.cache=h,d.activated=!0),m&&null!==t&&!t.has(d.id)&&t.set(d.id,h),h}}};e.resolve=function(t){return c(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveInstance=void 0;var i=n(25),o=n(35),a=n(20);e.resolveInstance=function(t,e,n){var u,s,c=null;if(e.length>0){var f=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ConstructorArgument})).map(n);s=f,c=function(t,e,n){var r=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ClassProperty})),i=r.map(n);return r.forEach((function(e,n){var r;r=e.target.name.value();var o=i[n];t[r]=o})),t}(c=new((u=t).bind.apply(u,r([void 0],s))),e,n)}else c=new t;return function(t,e){if(Reflect.hasMetadata(a.POST_CONSTRUCT,t)){var n=Reflect.getMetadata(a.POST_CONSTRUCT,t);try{e[n.value]()}catch(e){throw new Error(i.POST_CONSTRUCT_ERROR(t.name,e.message))}}}(t,c),c}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingToSyntax=void 0;var r=n(25),i=n(35),o=n(259),a=n(141),u=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=i.BindingTypeEnum.Instance,this._binding.implementationType=t,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+r.INVALID_TO_SELF_VALUE);var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=i.BindingTypeEnum.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=i.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=i.BindingTypeEnum.Constructor,this._binding.implementationType=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error(r.INVALID_FUNCTION_BINDING);var e=this.toConstantValue(t);return this._binding.type=i.BindingTypeEnum.Function,this._binding.scope=i.BindingScopeEnum.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=i.BindingTypeEnum.Provider,this._binding.provider=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}();e.BindingToSyntax=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInWhenOnSyntax=void 0;var r=n(260),i=n(106),o=n(107),a=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new o.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new i.BindingOnSyntax(this._binding),this._bindingInSyntax=new r.BindingInSyntax(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingInWhenOnSyntax=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInSyntax=void 0;var r=n(35),i=n(141),o=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=r.BindingScopeEnum.Request,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=r.BindingScopeEnum.Singleton,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=r.BindingScopeEnum.Transient,new i.BindingWhenOnSyntax(this._binding)},t}();e.BindingInSyntax=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContainerSnapshot=void 0;var r=function(){function t(){}return t.of=function(e,n){var r=new t;return r.bindings=e,r.middleware=n,r},t}();e.ContainerSnapshot=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Lookup=void 0;var r=n(25),i=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(r.NULL_ARGUMENT);if(null==e)throw new Error(r.NULL_ARGUMENT);var n=this._map.get(t);void 0!==n?(n.push(e),this._map.set(t,n)):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(r.KEY_NOT_FOUND)},t.prototype.remove=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);if(!this._map.delete(t))throw new Error(r.KEY_NOT_FOUND)},t.prototype.removeByCondition=function(t){var e=this;this._map.forEach((function(n,r){var i=n.filter((function(e){return!t(e)}));i.length>0?e._map.set(r,i):e._map.delete(r)}))},t.prototype.hasKey=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,t.clone())}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t}();e.Lookup=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncContainerModule=e.ContainerModule=void 0;var r=n(44),i=function(t){this.id=r.id(),this.registry=t};e.ContainerModule=i;var o=function(t){this.id=r.id(),this.registry=t};e.AsyncContainerModule=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.injectable=void 0;var r=n(25),i=n(20);e.injectable=function(){return function(t){if(Reflect.hasOwnMetadata(i.PARAM_TYPES,t))throw new Error(r.DUPLICATED_INJECTABLE_DECORATOR);var e=Reflect.getMetadata(i.DESIGN_PARAM_TYPES,t)||[];return Reflect.defineMetadata(i.PARAM_TYPES,e,t),t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagged=void 0;var r=n(30),i=n(39);e.tagged=function(t,e){return function(n,o,a){var u=new r.Metadata(t,e);"number"==typeof a?i.tagParameter(n,o,a,u):i.tagProperty(n,o,u)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.named=void 0;var r=n(20),i=n(30),o=n(39);e.named=function(t){return function(e,n,a){var u=new i.Metadata(r.NAMED_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,u):o.tagProperty(e,n,u)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.optional=void 0;var r=n(20),i=n(30),o=n(39);e.optional=function(){return function(t,e,n){var a=new i.Metadata(r.OPTIONAL_TAG,!0);"number"==typeof n?o.tagParameter(t,e,n,a):o.tagProperty(t,e,a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unmanaged=void 0;var r=n(20),i=n(30),o=n(39);e.unmanaged=function(){return function(t,e,n){var a=new i.Metadata(r.UNMANAGED_TAG,!0);o.tagParameter(t,e,n,a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiInject=void 0;var r=n(20),i=n(30),o=n(39);e.multiInject=function(t){return function(e,n,a){var u=new i.Metadata(r.MULTI_INJECT_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,u):o.tagProperty(e,n,u)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.targetName=void 0;var r=n(20),i=n(30),o=n(39);e.targetName=function(t){return function(e,n,a){var u=new i.Metadata(r.NAME_TAG,t);o.tagParameter(e,n,a,u)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.postConstruct=void 0;var r=n(25),i=n(20),o=n(30);e.postConstruct=function(){return function(t,e,n){var a=new o.Metadata(i.POST_CONSTRUCT,e);if(Reflect.hasOwnMetadata(i.POST_CONSTRUCT,t.constructor))throw new Error(r.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(i.POST_CONSTRUCT,a,t.constructor)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiBindToService=void 0;e.multiBindToService=function(t){return function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return n.forEach((function(n){return t.bind(n).toService(e)}))}}}},function(t,e){function n(e,r){return t.exports=n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.default=t.exports,t.exports.__esModule=!0,n(e,r)}t.exports=n,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Symbol.for("INJECTION");function i(t,e,n,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i&&!Reflect.hasMetadata(r,this,e)&&Reflect.defineMetadata(r,n(),this,e),Reflect.hasMetadata(r,this,e)?Reflect.getMetadata(r,this,e):n()},set:function(t){Reflect.defineMetadata(r,t,this,e)}})}e.makePropertyInjectDecorator=function(t,e){return function(n){return function(r,o){i(r,o,(function(){return t.get(n)}),e)}}},e.makePropertyInjectNamedDecorator=function(t,e){return function(n,r){return function(o,a){i(o,a,(function(){return t.getNamed(n,r)}),e)}}},e.makePropertyInjectTaggedDecorator=function(t,e){return function(n,r,o){return function(a,u){i(a,u,(function(){return t.getTagged(n,r,o)}),e)}}},e.makePropertyMultiInjectDecorator=function(t,e){return function(n){return function(r,o){i(r,o,(function(){return t.getAll(n)}),e)}}}},function(t,e,n){var r=n(136);t.exports=function(t){if(Array.isArray(t))return r(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){var e=new Float32Array(2);return e[0]=t[0],e[1]=t[1],e}},function(t,e){t.exports=function(t,e){var n=new Float32Array(2);return n[0]=t,n[1]=e,n}},function(t,e){t.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}},function(t,e,n){t.exports=function(t,e){var n=t[0],i=t[1],o=e[0],a=e[1];return Math.abs(n-o)<=r*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r*Math.max(1,Math.abs(i),Math.abs(a))};var r=n(158)},function(t,e){t.exports=function(t,e){return t[0]===e[0]&&t[1]===e[1]}},function(t,e,n){t.exports=n(108)},function(t,e,n){t.exports=n(162)},function(t,e,n){t.exports=n(163)},function(t,e){t.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}},function(t,e){t.exports=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}},function(t,e){t.exports=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}},function(t,e){t.exports=function(t,e,n){var r=Math.cos(n),i=Math.sin(n),o=e[0],a=e[1];return t[0]=o*r-a*i,t[1]=o*i+a*r,t}},function(t,e){t.exports=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}},function(t,e){t.exports=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}},function(t,e){t.exports=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}},function(t,e){t.exports=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}},function(t,e){t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t}},function(t,e,n){t.exports=n(164)},function(t,e,n){t.exports=n(165)},function(t,e,n){t.exports=n(166)},function(t,e,n){t.exports=n(167)},function(t,e){t.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t}},function(t,e){t.exports=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t}},function(t,e){t.exports=function(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t}},function(t,e){t.exports=function(t,e){e=e||1;var n=2*Math.random()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t}},function(t,e,n){t.exports=function(t,e,n,i,o,a){var u,s;e||(e=2);n||(n=0);s=i?Math.min(i*e+n,t.length):t.length;for(u=n;u<s;u+=e)r[0]=t[u],r[1]=t[u+1],o(r,r,a),t[u]=r[0],t[u+1]=r[1];return t};var r=n(159)()},function(t,e){t.exports=function(t,e,n){var r=e[0]*e[0]+e[1]*e[1];if(r>n*n){var i=Math.sqrt(r);t[0]=e[0]/i*n,t[1]=e[1]/i*n}else t[0]=e[0],t[1]=e[1];return t}},function(t,e,n){"use strict";n.r(e),n.d(e,"Dagre",(function(){return gs}));n(110),n(195),n(200),n(204),n(206),n(208),n(211),n(212),n(214),n(215),n(216),n(224),n(225),n(226),n(227);class r{constructor(){this.nodes=[],this.edges=[],this.combos=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=()=>{}}layout(t){return this.init(t),this.execute(!0)}init(t){this.nodes=t.nodes||[],this.edges=t.edges||[],this.combos=t.combos||[]}execute(t){}executeWithWorker(){}getDefaultCfg(){return{}}updateCfg(t){t&&Object.assign(this,t)}getType(){return"base"}destroy(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0}}const i=/-(\w)/g,o=((t=>{const e=Object.create(null)})(t=>t.replace(i,(t,e)=>e?e.toUpperCase():"")),Array.isArray),a=t=>"number"==typeof t,u=t=>null!==t&&"object"==typeof t,s=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach(t=>{e.push(t)}),e.map(t=>s(t))}if("object"==typeof t&&t!=={}){const e=Object.assign({},t);return Object.keys(e).forEach(t=>{e[t]=s(e[t])}),e}return t},c=(t,e)=>{const n=t[e];return u(n)?n.cell:n};new Map;function f(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,u,s,c,f,l,h,d=t._root,p={data:r},m=t._x0,v=t._y0,g=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(o=(m+g)/2))?m=o:g=o,(f=n>=(a=(v+y)/2))?v=a:y=a,i=d,!(d=d[l=f<<1|c]))return i[l]=p,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),e===u&&n===s)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=e>=(o=(m+g)/2))?m=o:g=o,(f=n>=(a=(v+y)/2))?v=a:y=a}while((l=f<<1|c)==(h=(s>=a)<<1|u>=o));return i[h]=d,i[l]=p,t}var l=function(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i};function h(t){return t[0]}function d(t){return t[1]}function p(t,e,n){var r=new m(null==e?h:e,null==n?d:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function m(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function v(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var g=p.prototype=m.prototype;g.copy=function(){var t,e,n=new m(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=v(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=v(e));return n},g.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return f(this.cover(e,n),e,n,t)},g.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,c=1/0,l=-1/0,h=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,u[n]=i,r<s&&(s=r),r>l&&(l=r),i<c&&(c=i),i>h&&(h=i));if(s>l||c>h)return this;for(this.cover(s,c).cover(l,h),n=0;n<o;++n)f(this,a[n],u[n],t[n]);return this},g.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,u,s=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(u=(e<r)<<1|t<n,(a=new Array(4))[u]=c,c=a,s*=2,u){case 0:i=n+s,o=r+s;break;case 1:n=i-s,o=r+s;break;case 2:i=n+s,r=o-s;break;case 3:n=i-s,r=o-s}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},g.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},g.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},g.find=function(t,e,n){var r,i,o,a,u,s,c,f=this._x0,h=this._y0,d=this._x1,p=this._y1,m=[],v=this._root;for(v&&m.push(new l(v,f,h,d,p)),null==n?n=1/0:(f=t-n,h=e-n,d=t+n,p=e+n,n*=n);s=m.pop();)if(!(!(v=s.node)||(i=s.x0)>d||(o=s.y0)>p||(a=s.x1)<f||(u=s.y1)<h))if(v.length){var g=(i+a)/2,y=(o+u)/2;m.push(new l(v[3],g,y,a,u),new l(v[2],i,y,g,u),new l(v[1],g,o,a,y),new l(v[0],i,o,g,y)),(c=(e>=y)<<1|t>=g)&&(s=m[m.length-1],m[m.length-1]=m[m.length-1-c],m[m.length-1-c]=s)}else{var b=t-+this._x.call(null,v.data),_=e-+this._y.call(null,v.data),E=b*b+_*_;if(E<n){var w=Math.sqrt(n=E);f=t-w,h=e-w,d=t+w,p=e+w,r=v.data}}return r},g.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,u,s,c,f,l,h,d=this._root,p=this._x0,m=this._y0,v=this._x1,g=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(u=(p+v)/2))?p=u:v=u,(f=a>=(s=(m+g)/2))?m=s:g=s,e=d,!(d=d[l=f<<1|c]))return this;if(!d.length)break;(e[l+1&3]||e[l+2&3]||e[l+3&3])&&(n=e,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[l]=i:delete e[l],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},g.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},g.root=function(){return this._root},g.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},g.visit=function(t){var e,n,r,i,o,a,u=[],s=this._root;for(s&&u.push(new l(s,this._x0,this._y0,this._x1,this._y1));e=u.pop();)if(!t(s=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&s.length){var c=(r+o)/2,f=(i+a)/2;(n=s[3])&&u.push(new l(n,c,f,o,a)),(n=s[2])&&u.push(new l(n,r,f,c,a)),(n=s[1])&&u.push(new l(n,c,i,o,f)),(n=s[0])&&u.push(new l(n,r,i,c,f))}return this},g.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new l(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,u=e.y0,s=e.x1,c=e.y1,f=(a+s)/2,h=(u+c)/2;(o=i[0])&&n.push(new l(o,a,u,f,h)),(o=i[1])&&n.push(new l(o,f,u,s,h)),(o=i[2])&&n.push(new l(o,a,h,f,c)),(o=i[3])&&n.push(new l(o,f,h,s,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},g.x=function(t){return arguments.length?(this._x=t,this):this._x},g.y=function(t){return arguments.length?(this._y=t,this):this._y};var y={value:()=>{}};function b(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new _(r)}function _(t){this._=t}function E(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function w(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function x(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=y,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}_.prototype=b.prototype={constructor:_,on:function(t,e){var n,r=this._,i=E(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=x(r[n],t.name,e);else if(null==e)for(n in r)r[n]=x(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=w(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new _(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var T,A,S=0,R=0,O=0,C=0,M=0,I=0,N="object"==typeof performance&&performance.now?performance:Date,P="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function k(){return M||(P(D),M=N.now()+I)}function D(){M=0}function L(){this._call=this._time=this._next=null}function j(t,e,n){var r=new L;return r.restart(t,e,n),r}function F(){M=(C=N.now())+I,S=R=0;try{!function(){k(),++S;for(var t,e=T;e;)(t=M-e._time)>=0&&e._call.call(null,t),e=e._next;--S}()}finally{S=0,function(){var t,e,n=T,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:T=e);A=t,U(r)}(),M=0}}function B(){var t=N.now(),e=t-C;e>1e3&&(I-=e,C=t)}function U(t){S||(R&&(R=clearTimeout(R)),t-M>24?(t<1/0&&(R=setTimeout(F,t-N.now()-I)),O&&(O=clearInterval(O))):(O||(C=N.now(),O=setInterval(B,1e3)),S=1,P(F)))}L.prototype=j.prototype={constructor:L,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?k():+n)+(null==e?0:+e),this._next||A===this||(A?A._next=this:T=this,A=this),this._call=t,this._time=n,U()},stop:function(){this._call&&(this._call=null,this._time=1/0,U())}};Math.PI,Math.sqrt(5);var G=n(172);let V=n.n(G).a;V||"undefined"==typeof window||(V=window.graphlib),Array.prototype.flat||(Array.prototype.flat=function(t){let e=t||1;if(!isFinite(e))return;const n=this.length;let r=[];if(0===this.length)return this;for(;e--;){const t=[];let i=!1;if(0===r.length){i=!0;for(let t=0;t<n;t++)this[t]instanceof Array?r.push(...this[t]):r.push(this[t])}else{for(let e=0;e<r.length;e++)r[e]instanceof Array?(i=!0,t.push(...r[e])):t.push(r[e]);r=t}if(!i&&e===1/0)break}return r});var z=V;const W=t=>{t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev},H=(t,e)=>{if("_next"!==t&&"_prev"!==t)return e};var q=class{constructor(){const t={};t._next=t._prev=t,this.isentinel=t}dequeue(){const t=this.isentinel,e=t._prev;if(e!==t)return W(e),e}enqueue(){const t=this.isentinel,e=t._prev;if(e!==t)return W(e),e}toString(){const t=[],e=this.isentinel;let n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,H)),n=n._prev;return`[${t.join(", ")}]`}};const X=z.Graph,Y=()=>1,K=(t,e,n)=>{let r=[];const i=e[e.length-1],o=e[0];let a;for(;t.nodeCount();){for(;a=o.dequeue();)Q(t,e,n,a);for(;a=i.dequeue();)Q(t,e,n,a);if(t.nodeCount())for(let i=e.length-2;i>0;--i)if(a=e[i].dequeue(),a){r=r.concat(Q(t,e,n,a,!0));break}}return r},Q=(t,e,n,r,i)=>{var o,a;const u=i?[]:void 0;return null===(o=t.inEdges(r.v))||void 0===o||o.forEach(r=>{const o=t.edge(r),a=t.node(r.v);i&&u.push({v:r.v,w:r.w}),void 0===a.out&&(a.out=0),a.out-=o,Z(e,n,a)}),null===(a=t.outEdges(r.v))||void 0===a||a.forEach(r=>{const i=t.edge(r),o=r.w,a=t.node(o);void 0===a.in&&(a.in=0),a.in-=i,Z(e,n,a)}),t.removeNode(r.v),u},$=(t,e)=>{const n=new X;let r=0,i=0;t.nodes().forEach(t=>{n.setNode(t,{v:t,in:0,out:0})}),t.edges().forEach(t=>{const o=n.edge(t.v,t.w)||0,a=null==e?void 0:e(t),u=o+a;n.setEdge(t.v,t.w,u),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)});const o=[],a=i+r+3;for(let t=0;t<a;t++)o.push(new q);const u=r+1;return n.nodes().forEach(t=>{Z(o,u,n.node(t))}),{buckets:o,zeroIdx:u,graph:n}},Z=(t,e,n)=>{n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)};var J=(t,e)=>{var n;if(t.nodeCount()<=1)return[];const r=$(t,e||Y);return null===(n=K(r.graph,r.buckets,r.zeroIdx).map(e=>t.outEdges(e.v,e.w)))||void 0===n?void 0:n.flat()};const tt=t=>{const e=[],n={},r={},i=o=>{var a;r.hasOwnProperty(o)||(r[o]=!0,n[o]=!0,null===(a=t.outEdges(o))||void 0===a||a.forEach(t=>{n.hasOwnProperty(t.w)?e.push(t):i(t.w)}),delete n[o])};return t.nodes().forEach(i),e};var et=t=>{const e="greedy"===t.graph().acyclicer?J(t,(t=>e=>t.edge(e).weight)(t)):tt(t);null==e||e.forEach(e=>{const n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,"rev-"+Math.random())})},nt=t=>{t.edges().forEach(e=>{const n=t.edge(e);if(n.reversed){t.removeEdge(e);const r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})};const rt=z.Graph,it=(t,e,n,r)=>{let i;do{i=`${r}${Math.random()}`}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i},ot=t=>{const e=(new rt).setGraph(t.graph());return t.nodes().forEach(n=>{e.setNode(n,t.node(n))}),t.edges().forEach(n=>{const r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e},at=(t,e)=>{const n={};return null==t||t.forEach((t,r)=>{n[t]=e[r]}),n},ut=t=>{const e=t.nodes().filter(e=>void 0!==t.node(e).rank).map(e=>t.node(e).rank),n=Math.min(...e);t.nodes().forEach(e=>{const r=t.node(e);r.hasOwnProperty("rank")&&(r.rank||(r.rank=0),r.rank-=n)})},st=t=>{const e=t.nodes().filter(e=>void 0!==t.node(e).rank).map(e=>t.node(e).rank),n=Math.min(...e),r=[];t.nodes().forEach(e=>{var i;const o=((null===(i=t.node(e))||void 0===i?void 0:i.rank)||0)-n;r[o]||(r[o]=[]),r[o].push(e)});let i=0;const o=t.graph().nodeRankFactor||0;for(let e=0;e<r.length;e++){const n=r[e];void 0===n&&e%o!=0?--i:i&&(null==n||n.forEach(e=>{t.node(e).rank||(t.node(e).rank=0),t.node(e).rank+=i}))}},ct=t=>{const e=t.nodes().map(e=>{const n=t.node(e).rank;return void 0!==n?n:-1/0});return Math.max(...e)},ft=(t,e)=>{const n=Date.now();try{return e()}finally{console.log(`${t} time: ${Date.now()-n}ms`)}},lt=(t,e)=>e(),ht=(t,e)=>{let n,r=1/0;return null==t||t.forEach(t=>{const i=e(t);r>i&&(r=i,n=t)}),n};var dt={addDummyNode:it,simplify:ot,asNonCompoundGraph:t=>{const e=new rt({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{var r;(null===(r=t.children(n))||void 0===r?void 0:r.length)||e.setNode(n,t.node(n))}),t.edges().forEach(n=>e.setEdge(n,t.edge(n))),e},successorWeights:t=>{const e=t.nodes().map(e=>{var n;const r={};return null===(n=t.outEdges(e))||void 0===n||n.forEach(e=>{r[e.w]=(r[e.w]||0)+t.edge(e).weight}),r});return at(t.nodes(),e)},predecessorWeights:t=>{const e=t.nodes().map(e=>{var n;const r={};return null===(n=t.inEdges(e))||void 0===n||n.forEach(e=>{r[e.v]=(r[e.v]||0)+t.edge(e).weight}),r});return at(t.nodes(),e)},intersectRect:(t,e)=>{const n=t.x,r=t.y,i=e.x-n,o=e.y-r;let a,u,s=t.width/2,c=t.height/2;return i||o?(Math.abs(o)*s>Math.abs(i)*c?(o<0&&(c=-c),a=c*i/o,u=c):(i<0&&(s=-s),a=s,u=s*o/i),{x:n+a,y:r+u}):{x:0,y:0}},buildLayerMatrix:t=>{const e=[],n=[],r=ct(t)+1;for(let t=0;t<r;t++)e.push([]),n.push([]);return t.nodes().forEach(r=>{const i=t.node(r).rank;void 0!==i&&e[i]&&n[i].push(r)}),null==n||n.forEach((n,r)=>{null==n||n.sort((e,n)=>{var r,i;return(null===(r=t.node(e))||void 0===r?void 0:r.order)-(null===(i=t.node(n))||void 0===i?void 0:i.order)}),n.forEach(t=>{e[r].push(t)})}),e},normalizeRanks:ut,removeEmptyRanks:st,addBorderNode:(t,e,n,r)=>{const i={width:0,height:0};return a(n)&&a(r)&&(i.rank=n,i.order=r),it(t,"border",i,e)},maxRank:ct,partition:(t,e)=>{const n={lhs:[],rhs:[]};return null==t||t.forEach(t=>{e(t)?n.lhs.push(t):n.rhs.push(t)}),n},time:ft,notime:lt,zipObject:at,minBy:ht};const pt=(t,e)=>{var n,r;let i=e.v,o=t.node(i).rank;const a=e.w,u=t.node(a).rank,s=e.name,c=t.edge(e),f=c.labelRank;if(u===o+1)return;let l,h,d;for(t.removeEdge(e),d=0,++o;o<u;++d,++o)c.points=[],h={edgeLabel:c,width:0,height:0,edgeObj:e,rank:o},l=dt.addDummyNode(t,"edge",h,"_d"),o===f&&(h.width=c.width,h.height=c.height,h.dummy="edge-label",h.labelpos=c.labelpos),t.setEdge(i,l,{weight:c.weight},s),0===d&&(t.graph().dummyChains||(t.graph().dummyChains=[]),null===(r=null===(n=t.graph())||void 0===n?void 0:n.dummyChains)||void 0===r||r.push(l)),i=l;t.setEdge(i,a,{weight:c.weight},s)};var mt=t=>{t.graph().dummyChains=[],t.edges().forEach(e=>pt(t,e))},vt=t=>{var e;null===(e=t.graph().dummyChains)||void 0===e||e.forEach(e=>{var n;let r=t.node(e);const i=r.edgeLabel;let o;r.edgeObj&&t.setEdge(r.edgeObj,i);let a=e;for(;r.dummy;)o=null===(n=t.successors(a))||void 0===n?void 0:n[0],t.removeNode(a),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),a=o,r=t.node(a)})};const gt=t=>{var e;const n={},r=e=>{var i;const o=t.node(e);if(n.hasOwnProperty(e))return o.rank;n[e]=!0;const a=null===(i=t.outEdges(e))||void 0===i?void 0:i.map(e=>r(e.w)-t.edge(e).minlen||1/0);let u=Math.min(...a);return u!==Number.POSITIVE_INFINITY&&null!=u||(u=0),o.rank=u,u};null===(e=t.sources())||void 0===e||e.forEach(t=>r(t))},yt=t=>{var e;const n={};let r=0;const i=e=>{var o;const a=t.node(e);if(n.hasOwnProperty(e))return a.rank;n[e]=!0;const u=null===(o=t.outEdges(e))||void 0===o?void 0:o.map(e=>i(e.w)-t.edge(e).minlen||1/0);let s=Math.min(...u);return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),a.rank=s,r=Math.min(a.rank,r),a.rank};null===(e=t.sources())||void 0===e||e.forEach(t=>i(t)),r+=1;const o=(e,n)=>{var r;const i=t.node(e),a=isNaN(i.layer)?n:i.layer;(void 0===i.rank||i.rank<a)&&(i.rank=a),null===(r=t.outEdges(e))||void 0===r||r.map(e=>{o(e.w,a+t.edge(e).minlen)})};t.nodes().forEach(e=>{const n=t.node(e);isNaN(n.layer)?n.rank-=r:o(e,n.layer)})},bt=(t,e)=>t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen;const _t=z.Graph,Et=t=>{const e=new _t({directed:!1}),n=t.nodes()[0],r=t.nodeCount();let i,o;for(e.setNode(n,{});wt(e,t)<r;)i=At(e,t),o=e.hasNode(i.v)?bt(t,i):-bt(t,i),St(e,t,o);return e},wt=(t,e)=>{const n=r=>{e.nodeEdges(r).forEach(i=>{const o=i.v,a=r===o?i.w:o;t.hasNode(a)||bt(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))})};return t.nodes().forEach(n),t.nodeCount()},xt=t=>{const e=new _t({directed:!1}),n=t.nodes()[0],r=t.nodeCount();let i,o;for(e.setNode(n,{});Tt(e,t)<r;)i=At(e,t),o=e.hasNode(i.v)?bt(t,i):-bt(t,i),St(e,t,o);return e},Tt=(t,e)=>{const n=r=>{var i;null===(i=e.nodeEdges(r))||void 0===i||i.forEach(i=>{const o=i.v,a=r===o?i.w:o;t.hasNode(a)||void 0===e.node(a).layer&&bt(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))})};return t.nodes().forEach(n),t.nodeCount()},At=(t,e)=>ht(e.edges(),n=>t.hasNode(n.v)!==t.hasNode(n.w)?bt(e,n):1/0),St=(t,e,n)=>{t.nodes().forEach(t=>{e.node(t).rank||(e.node(t).rank=0),e.node(t).rank+=n})};const Rt=z.alg,{preorder:Ot,postorder:Ct}=Rt,Mt=t=>{t=ot(t),gt(t);const e=Et(t);let n,r;for(kt(e),It(e,t);n=Lt(e);)r=jt(e,t,n),Ft(e,t,n,r)},It=(t,e)=>{let n=Ct(t,t.nodes());n=null==n?void 0:n.slice(0,(null==n?void 0:n.length)-1),null==n||n.forEach(n=>{Nt(t,e,n)})},Nt=(t,e,n)=>{const r=t.node(n).parent;t.edge(n,r).cutvalue=Pt(t,e,n)},Pt=(t,e,n)=>{var r;const i=t.node(n).parent;let o=!0,a=e.edge(n,i),u=0;return a||(o=!1,a=e.edge(i,n)),u=a.weight,null===(r=e.nodeEdges(n))||void 0===r||r.forEach(r=>{const a=r.v===n,s=a?r.w:r.v;if(s!==i){const i=a===o,c=e.edge(r).weight;if(u+=i?c:-c,Ut(t,n,s)){const e=t.edge(n,s).cutvalue;u+=i?-e:e}}}),u},kt=(t,e)=>{void 0!==e&&(e=t.nodes()[0]),Dt(t,{},1,e)},Dt=(t,e,n,r,i)=>{var o;const a=n;let u=n;const s=t.node(r);return e[r]=!0,null===(o=t.neighbors(r))||void 0===o||o.forEach(n=>{e.hasOwnProperty(n)||(u=Dt(t,e,u,n,r))}),s.low=a,s.lim=u++,i?s.parent=i:delete s.parent,u},Lt=t=>t.edges().find(e=>t.edge(e).cutvalue<0),jt=(t,e,n)=>{let r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);const o=t.node(r),a=t.node(i);let u=o,s=!1;o.lim>a.lim&&(u=a,s=!0);const c=e.edges().filter(e=>s===Gt(t,t.node(e.v),u)&&s!==Gt(t,t.node(e.w),u));return ht(c,t=>bt(e,t))},Ft=(t,e,n,r)=>{const i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),kt(t),It(t,e),Bt(t,e)},Bt=(t,e)=>{const n=t.nodes().find(t=>!e.node(t).parent);let r=Ot(t,n);r=null==r?void 0:r.slice(1),null==r||r.forEach(n=>{const r=t.node(n).parent;let i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)})},Ut=(t,e,n)=>t.hasEdge(e,n),Gt=(t,e,n)=>n.low<=e.lim&&e.lim<=n.lim;Mt.initLowLimValues=kt,Mt.initCutValues=It,Mt.calcCutValue=Pt,Mt.leaveEdge=Lt,Mt.enterEdge=jt,Mt.exchangeEdges=Ft;var Vt=Mt;const zt=gt,Wt=t=>{yt(t),xt(t)},Ht=t=>{Vt(t)};var qt=t=>{switch(t.graph().ranker){case"network-simplex":Ht(t);break;case"tight-tree":Wt(t);break;case"longest-path":zt(t);break;default:Wt(t)}};const Xt=(t,e,n,r)=>{const i=[],o=[],a=Math.min(e[n].low,e[r].low),u=Math.max(e[n].lim,e[r].lim);let s,c;s=n;do{s=t.parent(s),i.push(s)}while(s&&(e[s].low>a||u>e[s].lim));for(c=s,s=r;(s=t.parent(s))!==c;)o.push(s);return{lca:c,path:i.concat(o.reverse())}},Yt=t=>{var e;const n={};let r=0;const i=e=>{var o;const a=r;null===(o=t.children(e))||void 0===o||o.forEach(i),n[e]={low:a,lim:r++}};return null===(e=t.children())||void 0===e||e.forEach(i),n};var Kt=t=>{var e;const n=Yt(t);null===(e=t.graph().dummyChains)||void 0===e||e.forEach(e=>{var r,i;let o=t.node(e);const a=o.edgeObj;if(!a)return;const u=Xt(t,n,a.v,a.w),s=u.path,c=u.lca;let f=0,l=s[f],h=!0;for(;e!==a.w;){if(o=t.node(e),h){for(;(l=s[f])!==c&&t.node(l).maxRank<o.rank;)f++;l===c&&(h=!1)}if(!h){for(;f<s.length-1&&(null===(r=t.node(l=s[f+1]))||void 0===r?void 0:r.minRank)<=o.rank;)f++;l=s[f]}t.setParent(e,l),e=null===(i=t.successors(e))||void 0===i?void 0:i[0]}})};const Qt=(t,e,n,r,i,o,a)=>{const u=t.children(a);if(!(null==u?void 0:u.length))return void(a!==e&&t.setEdge(e,a,{weight:0,minlen:n}));const s=dt.addBorderNode(t,"_bt"),c=dt.addBorderNode(t,"_bb"),f=t.node(a);t.setParent(s,a),f.borderTop=s,t.setParent(c,a),f.borderBottom=c,null==u||u.forEach(u=>{Qt(t,e,n,r,i,o,u);const f=t.node(u),l=f.borderTop?f.borderTop:u,h=f.borderBottom?f.borderBottom:u,d=f.borderTop?r:2*r,p=l!==h?1:i-o[a]+1;t.setEdge(s,l,{minlen:p,weight:d,nestingEdge:!0}),t.setEdge(h,c,{minlen:p,weight:d,nestingEdge:!0})}),t.parent(a)||t.setEdge(e,s,{weight:0,minlen:i+o[a]})},$t=t=>{var e;const n={},r=(e,i)=>{const o=t.children(e);null==o||o.forEach(t=>r(t,i+1)),n[e]=i};return null===(e=t.children())||void 0===e||e.forEach(t=>r(t,1)),n},Zt=t=>{let e=0;return t.edges().forEach(n=>{e+=t.edge(n).weight}),e};var Jt=t=>{var e;const n=dt.addDummyNode(t,"root",{},"_root"),r=$t(t),i=Math.max(...Object.values(r))-1,o=2*i+1;t.graph().nestingRoot=n,t.edges().forEach(e=>{t.edge(e).minlen*=o});const a=Zt(t)+1;null===(e=t.children())||void 0===e||e.forEach(e=>{Qt(t,n,o,a,i,r,e)}),t.graph().nodeRankFactor=o},te=t=>{const e=t.graph();e.nestingRoot&&t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(e=>{t.edge(e).nestingEdge&&t.removeEdge(e)})};const ee=(t,e,n,r,i,o)=>{const a={rank:o,width:0,height:0,borderType:e},u=i[e][o-1],s=dt.addDummyNode(t,"border",a,n);i[e][o]=s,t.setParent(s,r),u&&t.setEdge(u,s,{weight:1})};var ne=t=>{var e;const n=e=>{const r=t.children(e),i=t.node(e);if((null==r?void 0:r.length)&&r.forEach(t=>n(t)),i.hasOwnProperty("minRank")){i.borderLeft=[],i.borderRight=[];for(let n=i.minRank,r=i.maxRank+1;n<r;++n)ee(t,"borderLeft","_bl",e,i,n),ee(t,"borderRight","_br",e,i,n)}};null===(e=t.children())||void 0===e||e.forEach(t=>n(t))};const re=t=>{t.nodes().forEach(e=>{ie(t.node(e))}),t.edges().forEach(e=>{ie(t.edge(e))})},ie=t=>{const e=t.width;t.width=t.height,t.height=e},oe=t=>{t.nodes().forEach(e=>{ae(t.node(e))}),t.edges().forEach(e=>{var n;const r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach(t=>ae(t)),r.hasOwnProperty("y")&&ae(r)})},ae=t=>{t.y=-t.y},ue=t=>{t.nodes().forEach(e=>{se(t.node(e))}),t.edges().forEach(e=>{var n;const r=t.edge(e);null===(n=r.points)||void 0===n||n.forEach(t=>se(t)),r.hasOwnProperty("x")&&se(r)})},se=t=>{const e=t.x;t.x=t.y,t.y=e};var ce=t=>{var e;const n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"lr"!==n&&"rl"!==n||re(t)},fe=t=>{var e;const n=null===(e=t.graph().rankdir)||void 0===e?void 0:e.toLowerCase();"bt"!==n&&"rl"!==n||oe(t),"lr"!==n&&"rl"!==n||(ue(t),re(t))};var le=t=>{const e={},n=t.nodes().filter(e=>{var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)}),r=n.map(e=>t.node(e).rank),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o.push([]);const a=n=>{var r;if(e.hasOwnProperty(n))return;e[n]=!0;const i=t.node(n);isNaN(i.rank)||o[i.rank].push(n),null===(r=t.successors(n))||void 0===r||r.forEach(t=>a(t))},u=n.sort((e,n)=>t.node(e).rank-t.node(n).rank),s=u.filter(e=>void 0!==t.node(e).fixorder).sort((e,n)=>t.node(e).fixorder-t.node(n).fixorder);return null==s||s.forEach(n=>{isNaN(t.node(n).rank)||o[t.node(n).rank].push(n),e[n]=!0}),null==u||u.forEach(a),o};const he=(t,e,n)=>{const r=at(n,n.map((t,e)=>e)),i=e.map(e=>{var n;const i=null===(n=t.outEdges(e))||void 0===n?void 0:n.map(e=>({pos:r[e.w]||0,weight:t.edge(e).weight}));return null==i?void 0:i.sort((t,e)=>t.pos-e.pos)}).flat().filter(t=>void 0!==t);let o=1;for(;o<n.length;)o<<=1;const a=2*o-1;o-=1;const u=Array(a).fill(0,0,a);let s=0;return null==i||i.forEach(t=>{let e=t.pos+o;u[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=u[e+1]),e=e-1>>1,u[e]+=t.weight;s+=t.weight*n}),s};var de=(t,e)=>{let n=0;for(let r=1;r<(null==e?void 0:e.length);++r)n+=he(t,e[r-1],e[r]);return n};const pe=z.Graph,me=t=>{let e;for(;t.hasNode(e="_root"+Math.random()););return e};var ve=(t,e,n)=>{const r=me(t),i=new pe({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(e=>t.node(e));return t.nodes().forEach(o=>{const a=t.node(o),u=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||r),t[n](o).forEach(e=>{const n=e.v===o?e.w:e.v,r=i.edge(n,o),a=void 0!==r?r.weight:0;i.setEdge(n,o,{weight:t.edge(e).weight+a})}),a.hasOwnProperty("minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),i};var ge=(t,e,n)=>{const r={};let i;null==n||n.forEach(n=>{let o,a,u=t.parent(n);for(;u;){if(o=t.parent(u),o?(a=r[o],r[o]=u):(a=i,i=u),a&&a!==u)return void e.setEdge(a,u);u=o}})};var ye=(t,e)=>e.map(e=>{const n=t.inEdges(e);if(!(null==n?void 0:n.length))return{v:e};{const r={sum:0,weight:0};return null==n||n.forEach(e=>{const n=t.edge(e),i=t.node(e.v);r.sum+=n.weight*i.order,r.weight+=n.weight}),{v:e,barycenter:r.sum/r.weight,weight:r.weight}}});const be=t=>{var e,n;const r=[];for(;null==t?void 0:t.length;){const i=t.pop();r.push(i),null===(e=i.in.reverse())||void 0===e||e.forEach(t=>{return(e=i,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&_e(e,t)})(t);var e}),null===(n=i.out)||void 0===n||n.forEach(e=>{return(n=i,e=>{e.in.push(n),0==--e.indegree&&t.push(e)})(e);var n})}const i=r.filter(t=>!t.merged),o=["vs","i","barycenter","weight"];return i.map(t=>{const e={};return null==o||o.forEach(n=>{void 0!==t[n]&&(e[n]=t[n])}),e})},_e=(t,e)=>{var n;let r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null===(n=e.vs)||void 0===n?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0};var Ee=(t,e)=>{var n,r,i;const o={};null==t||t.forEach((t,e)=>{const n=o[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)}),null===(n=e.edges())||void 0===n||n.forEach(t=>{const e=o[t.v],n=o[t.w];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(o[t.w]))});const a=null===(i=(r=Object.values(o)).filter)||void 0===i?void 0:i.call(r,t=>!t.indegree);return be(a)};const we=(t,e,n)=>{let r,i=n;for(;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null==t||t.push(r.vs),i++;return i},xe=(t,e)=>(n,r)=>{if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i};var Te=(t,e,n)=>{const r=dt.partition(t,t=>t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder)||t.hasOwnProperty("barycenter")),i=r.lhs,o=r.rhs.sort((t,e)=>-t.i- -e.i),a=[];let u=0,s=0,c=0;null==i||i.sort(xe(!!e,!!n)),c=we(a,o,c),null==i||i.forEach(t=>{var e;c+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,s+=t.weight,c=we(a,o,c)});const f={vs:a.flat()};return s&&(f.barycenter=u/s,f.weight=s),f};const Ae=(t,e,n,r,i)=>{var o,a,u,s;let c=t.children(e);const f=t.node(e),l=f?f.borderLeft:void 0,h=f?f.borderRight:void 0,d={};l&&(c=null==c?void 0:c.filter(t=>t!==l&&t!==h));const p=ye(t,c||[]);null==p||p.forEach(e=>{var i;if(null===(i=t.children(e.v))||void 0===i?void 0:i.length){const i=Ae(t,e.v,n,r);d[e.v]=i,i.hasOwnProperty("barycenter")&&Re(e,i)}});const m=Ee(p,n);Se(m,d),null===(o=m.filter(t=>{var e;return!!t.vs||(null===(e=t.vs)||void 0===e?void 0:e.length)>0}))||void 0===o||o.forEach(e=>{const n=t.node(e.vs[0]);e.fixorder=n.fixorder,e.order=n.order});const v=Te(m,r,i);if(l&&(v.vs=[l,v.vs,h].flat(),null===(a=t.predecessors(l))||void 0===a?void 0:a.length)){const e=t.node((null===(u=t.predecessors(l))||void 0===u?void 0:u[0])||{}),n=t.node((null===(s=t.predecessors(h))||void 0===s?void 0:s[0])||{});v.hasOwnProperty("barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+e.order+n.order)/(v.weight+2),v.weight+=2}return v},Se=(t,e)=>{null==t||t.forEach(t=>{var n;const r=null===(n=t.vs)||void 0===n?void 0:n.map(t=>e[t]?e[t].vs:t);t.vs=r.flat()})},Re=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)};var Oe=Ae;const Ce=z.Graph,Me=(t,e,n)=>e.map(e=>ve(t,e,n)),Ie=(t,e,n)=>{const r=new Ce;null==t||t.forEach(t=>{var i;const o=t.graph().root,a=Oe(t,o,r,e,n);for(let e=0;e<(null===(i=a.vs)||void 0===i?void 0:i.length);e++)t.node(a.vs[e]).order=e;ge(t,r,a.vs)})},Ne=(t,e)=>{null==e||e.forEach(e=>{null==e||e.forEach((e,n)=>{t.node(e).order=n})})};var Pe=t=>{const e=dt.maxRank(t),n=[],r=[];for(let t=1;t<e+1;t++)n.push(t);for(let t=e-1;t>-1;t--)r.push(t);const i=Me(t,n,"inEdges"),o=Me(t,r,"outEdges");let a=le(t);Ne(t,a);let u,c=Number.POSITIVE_INFINITY;for(let e=0,n=0;n<4;++e,++n){Ie(e%2?i:o,e%4>=2),a=dt.buildLayerMatrix(t);const r=de(t,a);r<c&&(n=0,u=s(a),c=r)}a=le(t),Ne(t,a);for(let e=0,n=0;n<4;++e,++n){Ie(e%2?i:o,e%4>=2,!0),a=dt.buildLayerMatrix(t);const r=de(t,a);r<c&&(n=0,u=s(a),c=r)}Ne(t,u)};const ke=z.Graph,De=(t,e)=>{const n={},r=(e,r)=>{let i=0,o=0;const a=e.length,u=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach((e,s)=>{var c;const f=je(t,e),l=f?t.node(f).order:a;(f||e===u)&&(null===(c=r.slice(o,s+1))||void 0===c||c.forEach(e=>{var r;null===(r=t.predecessors(e))||void 0===r||r.forEach(r=>{const o=t.node(r),a=o.order;!(a<i||l<a)||o.dummy&&t.node(e).dummy||Fe(n,r,e)})}),o=s+1,i=l)}),r};return(null==e?void 0:e.length)&&e.reduce(r),n},Le=(t,e)=>{const n={},r=(e,r,i,o,a)=>{let u;const s=[];for(let t=r;t<i;t++)s.push(t);s.forEach(r=>{var i;u=e[r],t.node(u).dummy&&(null===(i=t.predecessors(u))||void 0===i||i.forEach(e=>{const r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&Fe(n,e,u)}))})},i=(e,n)=>{let i,o=-1,a=0;return null==n||n.forEach((u,s)=>{if("border"===t.node(u).dummy){const e=t.predecessors(u)||[];e.length&&(i=t.node(e[0]).order,r(n,a,s,o,i),a=s,o=i)}r(n,a,n.length,i,e.length)}),n};return(null==e?void 0:e.length)&&e.reduce(i),n},je=(t,e)=>{var n;if(t.node(e).dummy)return null===(n=t.predecessors(e))||void 0===n?void 0:n.find(e=>t.node(e).dummy)},Fe=(t,e,n)=>{let r=e,i=n;if(r>i){const t=r;r=i,i=t}let o=t[r];o||(t[r]=o={}),o[i]=!0},Be=(t,e,n)=>{let r=e,i=n;if(r>i){r=i,i=e}return t[r]&&t[r].hasOwnProperty(i)},Ue=(t,e,n,r)=>{const i={},o={},a={};return null==e||e.forEach(t=>{null==t||t.forEach((t,e)=>{i[t]=t,o[t]=t,a[t]=e})}),null==e||e.forEach(t=>{let e=-1;null==t||t.forEach(t=>{let u=r(t);if(u.length){u=u.sort((t,e)=>a[t]-a[e]);const r=(u.length-1)/2;for(let s=Math.floor(r),c=Math.ceil(r);s<=c;++s){const r=u[s];o[t]===t&&e<a[r]&&!Be(n,t,r)&&(o[r]=t,o[t]=i[t]=i[r],e=a[r])}}})}),{root:i,align:o}},Ge=(t,e,n,r,i)=>{var o;const a={},u=Ve(t,e,n,i),s=i?"borderLeft":"borderRight",c=(t,e)=>{let n=u.nodes(),r=n.pop();const i={};for(;r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()};return c(t=>{a[t]=(u.inEdges(t)||[]).reduce((t,e)=>Math.max(t,(a[e.v]||0)+u.edge(e)),0)},u.predecessors.bind(u)),c(e=>{const n=(u.outEdges(e)||[]).reduce((t,e)=>Math.min(t,(a[e.w]||0)-u.edge(e)),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(a[e]=Math.max(a[e],n))},u.successors.bind(u)),null===(o=Object.values(r))||void 0===o||o.forEach(t=>{a[t]=a[n[t]]}),a},Ve=(t,e,n,r)=>{const i=new ke,o=t.graph(),a=qe(o.nodesep,o.edgesep,r);return null==e||e.forEach(e=>{let r;null==e||e.forEach(e=>{const o=n[e];if(i.setNode(o),r){const u=n[r],s=i.edge(u,o);i.setEdge(u,o,Math.max(a(t,e,r),s||0))}r=e})}),i},ze=(t,e)=>dt.minBy(Object.values(e),e=>{var n;let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach(n=>{const o=e[n],a=Xe(t,n)/2;r=Math.max(o+a,r),i=Math.min(o-a,i)}),r-i});function We(t,e){const n=Object.values(e),r=Math.min(...n),i=Math.max(...n);["u","d"].forEach(n=>{["l","r"].forEach(o=>{const a=n+o,u=t[a];let s;if(u===e)return;const c=Object.values(u);s="l"===o?r-Math.min(...c):i-Math.max(...c),s&&(t[a]={},Object.keys(u).forEach(e=>{t[a][e]=u[e]+s}))})})}const He=(t,e)=>{const n={};return Object.keys(t.ul).forEach(r=>{if(e)n[r]=t[e.toLowerCase()][r];else{const e=Object.values(t).map(t=>t[r]).sort((t,e)=>t-e);n[r]=(e[1]+e[2])/2}}),n},qe=(t,e,n)=>(r,i,o)=>{const a=r.node(i),u=r.node(o);let s,c=0;if(c+=a.width/2,a.hasOwnProperty("labelpos"))switch((a.labelpos||"").toLowerCase()){case"l":s=-a.width/2;break;case"r":s=a.width/2}if(s&&(c+=n?s:-s),s=0,c+=(a.dummy?e:t)/2,c+=(u.dummy?e:t)/2,c+=u.width/2,u.hasOwnProperty("labelpos"))switch((u.labelpos||"").toLowerCase()){case"l":s=u.width/2;break;case"r":s=-u.width/2}return s&&(c+=n?s:-s),s=0,c},Xe=(t,e)=>{var n;return(null===(n=t.node(e))||void 0===n?void 0:n.width)||0};var Ye=t=>{var e;(t=>{const e=dt.buildLayerMatrix(t),n=t.graph().ranksep;let r=0;null==e||e.forEach(e=>{const i=e.map(e=>t.node(e).height),o=Math.max(...i);null==e||e.forEach(e=>{t.node(e).y=r+o/2}),r+=o+n})})(t=dt.asNonCompoundGraph(t));const n=(t=>{const e=dt.buildLayerMatrix(t),n=Object.assign(De(t,e),Le(t,e)),r={};let i;["u","d"].forEach(o=>{i="u"===o?e:Object.values(e).reverse(),["l","r"].forEach(e=>{"r"===e&&(i=i.map(t=>Object.values(t).reverse()));const a=("u"===o?t.predecessors:t.successors).bind(t),u=Ue(0,i,n,a),s=Ge(t,i,u.root,u.align,"r"===e);"r"===e&&Object.keys(s).forEach(t=>s[t]=-s[t]),r[o+e]=s})});const o=ze(t,r);return o&&We(r,o),He(r,t.graph().align)})(t);null===(e=Object.keys(n))||void 0===e||e.forEach(e=>{t.node(e).x=n[e]})};var Ke=(t,e)=>{const n=t.nodes().filter(e=>{var n;return!(null===(n=t.children(e))||void 0===n?void 0:n.length)}).map(e=>t.node(e).rank),r=Math.max(...n),i=[];for(let t=0;t<r+1;t++)i.push([]);null==e||e.forEach(e=>{const n=t.node(e);n&&!n.dummy&&(isNaN(n.rank)||(n.fixorder=i[n.rank].length,i[n.rank].push(e)))})};const Qe=z.Graph,$e=(t,e,n)=>{e(" removeSelfEdges",()=>{bn(t)}),e(" acyclic",()=>{et(t)}),e(" nestingGraph.run",()=>{Jt(t)}),e(" rank",()=>{qt(dt.asNonCompoundGraph(t))}),e(" injectEdgeLabelProxies",()=>{ln(t)}),e(" removeEmptyRanks",()=>{st(t)}),e(" nestingGraph.cleanup",()=>{te(t)}),e(" normalizeRanks",()=>{ut(t)}),e(" assignRankMinMax",()=>{hn(t)}),e(" removeEdgeLabelProxies",()=>{dn(t)}),e(" normalize.run",()=>{mt(t)}),e(" parentDummyChains",()=>{Kt(t)}),e(" addBorderSegments",()=>{ne(t)}),n&&n.keepNodeOrder&&e(" initDataOrder",()=>{Ke(t,n.nodeOrder)}),e(" order",()=>{Pe(t)}),e(" insertSelfEdges",()=>{_n(t)}),e(" adjustCoordinateSystem",()=>{ce(t)}),e(" position",()=>{Ye(t)}),e(" positionSelfEdges",()=>{En(t)}),e(" removeBorderNodes",()=>{yn(t)}),e(" normalize.undo",()=>{vt(t)}),e(" fixupEdgeLabelCoords",()=>{vn(t)}),e(" undoCoordinateSystem",()=>{fe(t)}),e(" translateGraph",()=>{pn(t)}),e(" assignNodeIntersects",()=>{mn(t)}),e(" reversePoints",()=>{gn(t)}),e(" acyclic.undo",()=>{nt(t)})},Ze=(t,e)=>{const n=e._nodes||{};t.nodes().forEach(e=>{const r=t.node(e);void 0!==n[e]?(r.fixorder=n[e]._order,delete n[e]._order):delete r.fixorder})},Je=(t,e)=>{t.nodes().forEach(n=>{var r;const i=t.node(n),o=e.node(n);i&&(i.x=o.x,i.y=o.y,i._order=o.order,i._rank=o.rank,(null===(r=e.children(n))||void 0===r?void 0:r.length)&&(i.width=o.width,i.height=o.height))}),t.edges().forEach(n=>{const r=t.edge(n),i=e.edge(n);r.points=i.points,i.hasOwnProperty("x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height},tn=["nodesep","edgesep","ranksep","marginx","marginy"],en={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},nn=["acyclicer","ranker","rankdir","align"],rn=["width","height","layer","fixorder"],on={width:0,height:0},an=["minlen","weight","width","height","labeloffset"],un={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},sn=["labelpos"],cn=t=>{const e=new Qe({multigraph:!0,compound:!0}),n=xn(t.graph()),r={};return null==nn||nn.forEach(t=>{void 0!==n[t]&&(r[t]=n[t])}),e.setGraph(Object.assign({},en,wn(n,tn),r)),t.nodes().forEach(n=>{const r=xn(t.node(n)),i=wn(r,rn);Object.keys(on).forEach(t=>{void 0===i[t]&&(i[t]=on[t])}),e.setNode(n,i),e.setParent(n,t.parent(n))}),t.edges().forEach(n=>{const r=xn(t.edge(n)),i={};null==sn||sn.forEach(t=>{void 0!==r[t]&&(i[t]=r[t])}),e.setEdge(n,Object.assign({},un,wn(r,an),i))}),e},fn=t=>{const e=t.graph();e.ranksep||(e.ranksep=0),e.ranksep/=2,t.nodes().forEach(e=>{const n=t.node(e);isNaN(n.layer)||(n.layer?n.layer*=2:n.layer=0)}),t.edges().forEach(n=>{var r;const i=t.edge(n);i.minlen*=2,"c"!==(null===(r=i.labelpos)||void 0===r?void 0:r.toLowerCase())&&("TB"===e.rankdir||"BT"===e.rankdir?i.width+=i.labeloffset:i.height+=i.labeloffset)})},ln=t=>{t.edges().forEach(e=>{const n=t.edge(e);if(n.width&&n.height){const n=t.node(e.v),r={e:e,rank:(t.node(e.w).rank-n.rank)/2+n.rank};dt.addDummyNode(t,"edge-proxy",r,"_ep")}})},hn=t=>{let e=0;t.nodes().forEach(n=>{const r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank||-1/0))}),t.graph().maxRank=e},dn=t=>{t.nodes().forEach(e=>{const n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})},pn=t=>{let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0;const o=t.graph(),a=o.marginx||0,u=o.marginy||0,s=t=>{if(!t)return;const o=t.x,a=t.y,u=t.width,s=t.height;isNaN(o)||isNaN(u)||(e=Math.min(e,o-u/2),n=Math.max(n,o+u/2)),isNaN(a)||isNaN(s)||(r=Math.min(r,a-s/2),i=Math.max(i,a+s/2))};t.nodes().forEach(e=>{s(t.node(e))}),t.edges().forEach(e=>{const n=t.edge(e);n.hasOwnProperty("x")&&s(n)}),e-=a,r-=u,t.nodes().forEach(n=>{const i=t.node(n);i.x-=e,i.y-=r}),t.edges().forEach(n=>{var i;const o=t.edge(n);null===(i=o.points)||void 0===i||i.forEach(t=>{t.x-=e,t.y-=r}),o.hasOwnProperty("x")&&(o.x-=e),o.hasOwnProperty("y")&&(o.y-=r)}),o.width=n-e+a,o.height=i-r+u},mn=t=>{t.edges().forEach(e=>{const n=t.edge(e),r=t.node(e.v),i=t.node(e.w);let o,a;n.points?(o=n.points[0],a=n.points[n.points.length-1]):(n.points=[],o=i,a=r),n.points.unshift(dt.intersectRect(r,o)),n.points.push(dt.intersectRect(i,a))})},vn=t=>{t.edges().forEach(e=>{const n=t.edge(e);if(n.hasOwnProperty("x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})},gn=t=>{t.edges().forEach(e=>{const n=t.edge(e);n.reversed&&n.points.reverse()})},yn=t=>{t.nodes().forEach(e=>{var n,r,i;if(null===(n=t.children(e))||void 0===n?void 0:n.length){const n=t.node(e),o=t.node(n.borderTop),a=t.node(n.borderBottom),u=t.node(n.borderLeft[(null===(r=n.borderLeft)||void 0===r?void 0:r.length)-1]),s=t.node(n.borderRight[(null===(i=n.borderRight)||void 0===i?void 0:i.length)-1]);n.width=Math.abs((null==s?void 0:s.x)-(null==u?void 0:u.x))||10,n.height=Math.abs((null==a?void 0:a.y)-(null==o?void 0:o.y))||10,n.x=((null==u?void 0:u.x)||0)+n.width/2,n.y=((null==o?void 0:o.y)||0)+n.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})},bn=t=>{t.edges().forEach(e=>{if(e.v===e.w){const n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})},_n=t=>{const e=dt.buildLayerMatrix(t);null==e||e.forEach(e=>{let n=0;null==e||e.forEach((e,r)=>{var i;const o=t.node(e);o.order=r+n,null===(i=o.selfEdges)||void 0===i||i.forEach(e=>{dt.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})},En=t=>{t.nodes().forEach(e=>{const n=t.node(e);if("selfedge"===n.dummy){const r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,u=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{y:o,x:i+a},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],n.label.x=n.x,n.label.y=n.y}})},wn=(t,e)=>{const n={};return null==e||e.forEach(e=>{void 0!==t[e]&&(n[e]=+t[e])}),n},xn=t=>{const e={};return Object.keys(t).forEach(n=>{const r=t[n];e[n.toLowerCase()]=r}),e};var Tn={graphlib:z,layout:(t,e)=>{const n=e&&e.debugTiming?dt.time:dt.notime;n("layout",()=>{e&&!e.keepNodeOrder&&e.prevGraph&&n(" inheritOrder",()=>{Ze(t,e.prevGraph)});const r=n(" buildLayoutGraph",()=>cn(t));e&&!1===e.edgeLabelSpace||n(" makeSpaceForEdgeLabels",()=>{fn(r)});try{n(" runLayout",()=>{$e(r,n,e)})}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}n(" updateInputGraph",()=>{Je(t,r)})})},util:{time:ft,notime:lt}};class An extends r{constructor(t){super(),this.rankdir="TB",this.nodesep=50,this.ranksep=50,this.controlPoints=!1,this.sortByCombo=!1,this.edgeLabelSpace=!0,this.nodes=[],this.edges=[],this.onLayoutEnd=()=>{},this.layoutNode=t=>{const{nodes:e}=this,n=e.find(e=>e.id===t);if(n){return!1!==n.layout}return!0},this.updateCfg(t)}getDefaultCfg(){return{rankdir:"TB",align:void 0,nodeSize:void 0,nodesepFunc:void 0,ranksepFunc:void 0,nodesep:50,ranksep:50,controlPoints:!1}}execute(){const t=this,{nodes:e,nodeSize:n,rankdir:r,combos:i,begin:s}=t;if(!e)return;const f=t.edges||[],l=new Tn.graphlib.Graph({multigraph:!0,compound:!0});let h;h=n?o(n)?()=>n:()=>[n,n]:t=>t.size?o(t.size)?t.size:u(t.size)?[t.size.width||40,t.size.height||40]:[t.size,t.size]:[40,40];let d=Sn(t.nodesepFunc,t.nodesep,50),p=Sn(t.ranksepFunc,t.ranksep,50);"LR"!==r&&"RL"!==r||(d=Sn(t.ranksepFunc,t.ranksep,50),p=Sn(t.nodesepFunc,t.nodesep,50)),l.setDefaultEdgeLabel(()=>({})),l.setGraph(t);const m={};e.filter(t=>!1!==t.layout).forEach(t=>{const e=h(t),n=p(t),r=d(t),i=e[0]+2*r,o=e[1]+2*n,u=t.layer;a(u)?l.setNode(t.id,{width:i,height:o,layer:u}):l.setNode(t.id,{width:i,height:o}),this.sortByCombo&&t.comboId&&(m[t.comboId]||(m[t.comboId]=!0,l.setNode(t.comboId,{})),l.setParent(t.id,t.comboId))}),this.sortByCombo&&i&&i.forEach(t=>{t.parentId&&(m[t.parentId]||(m[t.parentId]=!0,l.setNode(t.parentId,{})),l.setParent(t.id,t.parentId))}),f.forEach(t=>{const e=c(t,"source"),n=c(t,"target");this.layoutNode(e)&&this.layoutNode(n)&&l.setEdge(e,n,{weight:t.weight||1})});let v=void 0;t.preset&&(v=new Tn.graphlib.Graph({multigraph:!0,compound:!0}),t.preset.nodes.forEach(t=>{null==v||v.setNode(t.id,t)})),Tn.layout(l,{prevGraph:v,edgeLabelSpace:t.edgeLabelSpace,keepNodeOrder:Boolean(!!t.nodeOrder),nodeOrder:t.nodeOrder});const g=[0,0];if(s){let t=1/0,e=1/0;l.nodes().forEach(n=>{const r=l.node(n);t>r.x&&(t=r.x),e>r.y&&(e=r.y)}),l.edges().forEach(n=>{l.edge(n).points.forEach(n=>{t>n.x&&(t=n.x),e>n.y&&(e=n.y)})}),g[0]=s[0]-t,g[1]=s[1]-e}return l.nodes().forEach(t=>{const n=l.node(t),r=e.findIndex(e=>e.id===t);e[r]&&(e[r].x=n.x+g[0],e[r].y=n.y+g[1],e[r]._order=n._order)}),l.edges().forEach(e=>{const n=l.edge(e),r=f.findIndex(t=>{const n=c(t,"source"),r=c(t,"target");return n===e.v&&r===e.w});t.edgeLabelSpace&&t.controlPoints&&"loop"!==f[r].type&&(f[r].controlPoints=n.points.slice(1,n.points.length-1),f[r].controlPoints.forEach(t=>{t.x+=g[0],t.y+=g[1]}))}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:e,edges:f}}getType(){return"dagre"}}function Sn(t,e,n){let r;return r=t||(a(e)?()=>e:()=>n),r}const Rn=Object.prototype.toString;function On(t){return Rn.call(t).endsWith("Array]")}function Cn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!On(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],u=r+1;u<o;u++)t[u]>a&&(a=t[u]);return a}function Mn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!On(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],u=r+1;u<o;u++)t[u]<a&&(a=t[u]);return a}function In(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!On(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!On(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var r=Mn(t),i=Cn(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,a=void 0===o?n.autoMinMax?r:0:o,u=n.max,s=void 0===u?n.autoMinMax?i:1:u;if(a>=s)throw new RangeError("min option must be smaller than max option");for(var c=(s-a)/(i-r),f=0;f<t.length;f++)e[f]=(t[f]-r)*c+a;return e}const Nn=" ".repeat(2),Pn=" ".repeat(4);function kn(t,e={}){const{maxRows:n=15,maxColumns:r=10,maxNumSize:i=8}=e;return`${t.constructor.name} {\n${Nn}[\n${Pn}${function(t,e,n,r){const{rows:i,columns:o}=t,a=Math.min(i,e),u=Math.min(o,n),s=[];for(let e=0;e<a;e++){let n=[];for(let i=0;i<u;i++)n.push(Dn(t.get(e,i),r));s.push(""+n.join(" "))}u!==o&&(s[s.length-1]+=` ... ${o-n} more columns`);a!==i&&s.push(`... ${i-e} more rows`);return s.join("\n"+Pn)}(t,n,r,i)}\n${Nn}]\n${Nn}rows: ${t.rows}\n${Nn}columns: ${t.columns}\n}`}function Dn(t,e){const n=String(t);if(n.length<=e)return n.padEnd(e," ");const r=t.toPrecision(e-2);if(r.length<=e)return r;const i=t.toExponential(e-2),o=i.indexOf("e"),a=i.slice(o);return i.slice(0,e-a.length)+a}function Ln(t,e,n){let r=n?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function jn(t,e,n){let r=n?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function Fn(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Bn(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function Un(t,e){if("object"!=typeof e)throw new TypeError("unexpected type for row indices");if(e.some(e=>e<0||e>=t.rows))throw new RangeError("row indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function Gn(t,e){if("object"!=typeof e)throw new TypeError("unexpected type for column indices");if(e.some(e=>e<0||e>=t.columns))throw new RangeError("column indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function Vn(t,e,n,r,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(Wn("startRow",e),Wn("endRow",n),Wn("startColumn",r),Wn("endColumn",i),e>n||r>i||e<0||e>=t.rows||n<0||n>=t.rows||r<0||r>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function zn(t,e=0){let n=[];for(let r=0;r<t;r++)n.push(e);return n}function Wn(t,e){if("number"!=typeof e)throw new TypeError(t+" must be a number")}function Hn(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class qn{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let r=new Yn(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.set(i,t,n[i*e+t]);return r}static rowVector(t){let e=new Yn(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new Yn(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new Yn(t,e)}static ones(t,e){return new Yn(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:r=Math.random}=n;let i=new Yn(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.set(n,t,r());return i}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:r=0,max:i=1e3,random:o=Math.random}=n;if(!Number.isInteger(r))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(r>=i)throw new RangeError("min must be smaller than max");let a=i-r,u=new Yn(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=r+Math.round(o()*a);u.set(n,t,e)}return u}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let r=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<r;t++)i.set(t,t,n);return i}static diag(t,e,n){let r=t.length;void 0===e&&(e=r),void 0===n&&(n=e);let i=Math.min(r,e,n),o=this.zeros(e,n);for(let e=0;e<i;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new Yn(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.min(t.get(o,n),e.get(o,n)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new this(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.max(t.get(o,n),e.get(o,n)));return i}static checkMatrix(t){return qn.isMatrix(t)?t:new Yn(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);t++}return r}isReducedEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(r=!1);t++}return r}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let r=e;for(let i=e;i<t.rows;i++)t.get(i,n)>t.get(r,n)&&(r=i);if(0===t.get(r,n))n++;else{t.swapRows(e,r);let i=t.get(e,n);for(let r=n;r<t.columns;r++)t.set(e,r,t.get(e,r)/i);for(let r=e+1;r<t.rows;r++){let i=t.get(r,n)/t.get(e,n);t.set(r,n,0);for(let o=n+1;o<t.columns;o++)t.set(r,o,t.get(r,o)-t.get(e,o)*i)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,r=n-1;for(;r>=0;)if(0===t.maxRow(r))r--;else{let i=0,o=!1;for(;i<n&&!1===o;)1===t.get(r,i)?o=!0:i++;for(let n=0;n<r;n++){let o=t.get(n,i);for(let a=i;a<e;a++){let e=t.get(n,a)-o*t.get(r,a);t.set(n,a,e)}}r--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let r=new Yn(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)r.setSubMatrix(this,this.rows*t,this.columns*e);return r}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){Ln(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return Yn.rowVector(this.getRow(t))}setRow(t,e){Ln(this,t),e=Fn(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){Ln(this,t),Ln(this,e);for(let n=0;n<this.columns;n++){let r=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,r)}return this}getColumn(t){jn(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return Yn.columnVector(this.getColumn(t))}setColumn(t,e){jn(this,t),e=Bn(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){jn(this,t),jn(this,e);for(let n=0;n<this.rows;n++){let r=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,r)}return this}addRowVector(t){t=Fn(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=Fn(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=Fn(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=Fn(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=Bn(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=Bn(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=Bn(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=Bn(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){Ln(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){jn(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(){if(this.isEmpty())return NaN;let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}maxIndex(){Hn(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)>t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}min(){if(this.isEmpty())return NaN;let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}minIndex(){Hn(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)<t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}maxRow(t){if(Ln(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){Ln(this,t),Hn(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r),n[1]=r);return n}minRow(t){if(Ln(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){Ln(this,t),Hn(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r),n[1]=r);return n}maxColumn(t){if(jn(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){jn(this,t),Hn(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t),n[0]=r);return n}minColumn(t){if(jn(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){jn(this,t),Hn(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t),n[0]=r);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n)*this.get(t,n);return Math.sqrt(e)}throw new RangeError("unknown norm type: "+t)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){qn.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}mmul(t){t=Yn.checkMatrix(t);let e=this.rows,n=this.columns,r=t.columns,i=new Yn(e,r),o=new Float64Array(n);for(let a=0;a<r;a++){for(let e=0;e<n;e++)o[e]=t.get(e,a);for(let t=0;t<e;t++){let e=0;for(let r=0;r<n;r++)e+=this.get(t,r)*o[r];i.set(t,a,e)}}return i}strassen2x2(t){t=Yn.checkMatrix(t);let e=new Yn(2,2);const n=this.get(0,0),r=t.get(0,0),i=this.get(0,1),o=t.get(0,1),a=this.get(1,0),u=t.get(1,0),s=this.get(1,1),c=t.get(1,1),f=(n+s)*(r+c),l=(a+s)*r,h=n*(o-c),d=s*(u-r),p=(n+i)*c,m=f+d-p+(i-s)*(u+c),v=h+p,g=l+d,y=f-l+h+(a-n)*(r+o);return e.set(0,0,m),e.set(0,1,v),e.set(1,0,g),e.set(1,1,y),e}strassen3x3(t){t=Yn.checkMatrix(t);let e=new Yn(3,3);const n=this.get(0,0),r=this.get(0,1),i=this.get(0,2),o=this.get(1,0),a=this.get(1,1),u=this.get(1,2),s=this.get(2,0),c=this.get(2,1),f=this.get(2,2),l=t.get(0,0),h=t.get(0,1),d=t.get(0,2),p=t.get(1,0),m=t.get(1,1),v=t.get(1,2),g=t.get(2,0),y=t.get(2,1),b=t.get(2,2),_=(n-o)*(-h+m),E=(-n+o+a)*(l-h+m),w=(o+a)*(-l+h),x=n*l,T=(-n+s+c)*(l-d+v),A=(-n+s)*(d-v),S=(s+c)*(-l+d),R=(-i+c+f)*(m+g-y),O=(i-f)*(m-y),C=i*g,M=(c+f)*(-g+y),I=(-i+a+u)*(v+g-b),N=(i-u)*(v-b),P=(a+u)*(-g+b),k=x+C+r*p,D=(n+r+i-o-a-c-f)*m+E+w+x+R+C+M,L=x+T+S+(n+r+i-a-u-s-c)*v+C+I+P,j=_+a*(-l+h+p-m-v-g+b)+E+x+C+I+N,F=_+E+w+x+u*y,B=C+I+N+P+o*d,U=x+T+A+c*(-l+d+p-m-v-g+y)+R+O+C,G=R+O+C+M+s*h,V=x+T+A+S+f*b;return e.set(0,0,k),e.set(0,1,D),e.set(0,2,L),e.set(1,0,j),e.set(1,1,F),e.set(1,2,B),e.set(2,0,U),e.set(2,1,G),e.set(2,2,V),e}mmulStrassen(t){t=Yn.checkMatrix(t);let e=this.clone(),n=e.rows,r=e.columns,i=t.rows,o=t.columns;function a(t,e,n){let r=t.rows,i=t.columns;if(r===e&&i===n)return t;{let r=qn.zeros(e,n);return r=r.setSubMatrix(t,0,0),r}}r!==i&&console.warn(`Multiplying ${n} x ${r} and ${i} x ${o} matrix: dimensions do not match.`);let u=Math.max(n,i),s=Math.max(r,o);return e=a(e,u,s),function t(e,n,r,i){if(r<=512||i<=512)return e.mmul(n);r%2==1&&i%2==1?(e=a(e,r+1,i+1),n=a(n,r+1,i+1)):r%2==1?(e=a(e,r+1,i),n=a(n,r+1,i)):i%2==1&&(e=a(e,r,i+1),n=a(n,r,i+1));let o=parseInt(e.rows/2,10),u=parseInt(e.columns/2,10),s=e.subMatrix(0,o-1,0,u-1),c=n.subMatrix(0,o-1,0,u-1),f=e.subMatrix(0,o-1,u,e.columns-1),l=n.subMatrix(0,o-1,u,n.columns-1),h=e.subMatrix(o,e.rows-1,0,u-1),d=n.subMatrix(o,n.rows-1,0,u-1),p=e.subMatrix(o,e.rows-1,u,e.columns-1),m=n.subMatrix(o,n.rows-1,u,n.columns-1),v=t(qn.add(s,p),qn.add(c,m),o,u),g=t(qn.add(h,p),c,o,u),y=t(s,qn.sub(l,m),o,u),b=t(p,qn.sub(d,c),o,u),_=t(qn.add(s,f),m,o,u),E=t(qn.sub(h,s),qn.add(c,l),o,u),w=t(qn.sub(f,p),qn.add(d,m),o,u),x=qn.add(v,b);x.sub(_),x.add(w);let T=qn.add(y,_),A=qn.add(g,b),S=qn.sub(v,g);S.add(y),S.add(E);let R=qn.zeros(2*x.rows,2*x.columns);return R=R.setSubMatrix(x,0,0),R=R.setSubMatrix(T,x.rows,0),R=R.setSubMatrix(A,0,x.columns),R=R.setSubMatrix(S,x.rows,x.columns),R.subMatrix(0,r-1,0,i-1)}(e,t=a(t,u,s),u,s)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Yn(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&In(i,{min:e,max:n,output:i}),r.setRow(t,i)}return r}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Yn(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&In(i,{min:e,max:n,output:i}),r.setColumn(t,i)}return r}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),r=this.get(e,this.columns-1-n);this.set(e,n,r),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),r=this.get(this.rows-1-n,e);this.set(n,e,r),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=Yn.checkMatrix(t);let e=this.rows,n=this.columns,r=t.rows,i=t.columns,o=new Yn(e*r,n*i);for(let a=0;a<e;a++)for(let e=0;e<n;e++)for(let n=0;n<r;n++)for(let u=0;u<i;u++)o.set(r*a+n,i*e+u,this.get(a,e)*t.get(n,u));return o}kroneckerSum(t){if(t=Yn.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,r=this.kroneckerProduct(Yn.eye(n,n)),i=Yn.eye(e,e).kroneckerProduct(t);return r.add(i)}transpose(){let t=new Yn(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=Xn){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=Xn){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,r){Vn(this,t,e,n,r);let i=new Yn(e-t+1,r-n+1);for(let o=t;o<=e;o++)for(let e=n;e<=r;e++)i.set(o-t,e-n,this.get(o,e));return i}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let r=new Yn(t.length,n-e+1);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.rows)throw new RangeError("Row index out of range: "+t[i]);r.set(i,o-e,this.get(t[i],o))}return r}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let r=new Yn(n-e+1,t.length);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.columns)throw new RangeError("Column index out of range: "+t[i]);r.set(o-e,i,this.get(o,t[i]))}return r}setSubMatrix(t,e,n){if((t=Yn.checkMatrix(t)).isEmpty())return this;Vn(this,e,e+t.rows-1,n,n+t.columns-1);for(let r=0;r<t.rows;r++)for(let i=0;i<t.columns;i++)this.set(e+r,n+i,t.get(r,i));return this}selection(t,e){let n=function(t,e,n){return{row:Un(t,e),column:Gn(t,n)}}(this,t,e),r=new Yn(t.length,e.length);for(let t=0;t<n.row.length;t++){let e=n.row[t];for(let i=0;i<n.column.length;i++){let o=n.column[i];r.set(t,i,this.get(e,o))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){let t=new Yn(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(e,n,this.get(e,n));return t}sum(t){switch(t){case"row":return function(t){let e=zn(t.rows);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]+=t.get(n,r);return e}(this);case"column":return function(t){let e=zn(t.columns);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]+=t.get(n,r);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e+=t.get(n,r);return e}(this);default:throw new Error("invalid option: "+t)}}product(t){switch(t){case"row":return function(t){let e=zn(t.rows,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]*=t.get(n,r);return e}(this);case"column":return function(t){let e=zn(t.columns,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]*=t.get(n,r);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e*=t.get(n,r);return e}(this);default:throw new Error("invalid option: "+t)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error("invalid option: "+t)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:r=this.mean(t)}=e;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Array.isArray(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<r;a++){let r=0,u=0,s=0;for(let e=0;e<i;e++)s=t.get(a,e)-n[a],r+=s,u+=s*s;e?o.push((u-r*r/i)/(i-1)):o.push((u-r*r/i)/i)}return o}(this,n,r);case"column":if(!Array.isArray(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<i;a++){let i=0,u=0,s=0;for(let e=0;e<r;e++)s=t.get(e,a)-n[a],i+=s,u+=s*s;e?o.push((u-i*i/r)/(r-1)):o.push((u-i*i/r)/r)}return o}(this,n,r);case void 0:if("number"!=typeof r)throw new TypeError("mean must be a number");return function(t,e,n){const r=t.rows,i=t.columns,o=r*i;let a=0,u=0,s=0;for(let e=0;e<r;e++)for(let r=0;r<i;r++)s=t.get(e,r)-n,a+=s,u+=s*s;return e?(u-a*a/o)/(o-1):(u-a*a/o)/o}(this,n,r);default:throw new Error("invalid option: "+t)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":if(!Array.isArray(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[n])}(this,n),this;case"column":if(!Array.isArray(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[r])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e)}(this,n),this;default:throw new Error("invalid option: "+t)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.rows;n++){let r=0;for(let e=0;e<t.columns;e++)r+=Math.pow(t.get(n,e),2)/(t.columns-1);e.push(Math.sqrt(r))}return e}(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[n])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.columns;n++){let r=0;for(let e=0;e<t.rows;e++)r+=Math.pow(t.get(e,n),2)/(t.rows-1);e.push(Math.sqrt(r))}return e}(this);else if(!Array.isArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[r])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let n=0;for(let r=0;r<t.columns;r++)for(let i=0;i<t.rows;i++)n+=Math.pow(t.get(i,r),2)/e;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e)}(this,n),this;default:throw new Error("invalid option: "+t)}}toString(t){return kn(this,t)}}function Xn(t,e){return t-e}qn.prototype.klass="Matrix","undefined"!=typeof Symbol&&(qn.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return kn(this)}),qn.random=qn.rand,qn.randomInt=qn.randInt,qn.diagonal=qn.diag,qn.prototype.diagonal=qn.prototype.diag,qn.identity=qn.eye,qn.prototype.negate=qn.prototype.neg,qn.prototype.tensorProduct=qn.prototype.kroneckerProduct;class Yn extends qn{constructor(t,e){if(super(),Yn.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e))}else{if(!Array.isArray(t))throw new TypeError("First argument must be a positive number or an array");{const n=t;if("number"!=typeof(e=(t=n.length)?n[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let r=0;r<t;r++){if(n[r].length!==e)throw new RangeError("Inconsistent array dimensions");this.data.push(Float64Array.from(n[r]))}}}this.rows=t,this.columns=e}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return Ln(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),Ln(this,t,!0),e=Float64Array.from(Fn(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){jn(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let r=0;r<t;r++)n[r]=this.data[e][r];for(let r=t+1;r<this.columns;r++)n[r-1]=this.data[e][r];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),jn(this,t,!0),e=Bn(this,e);for(let n=0;n<this.rows;n++){const r=new Float64Array(this.columns+1);let i=0;for(;i<t;i++)r[i]=this.data[n][i];for(r[i++]=e[n];i<this.columns+1;i++)r[i]=this.data[n][i-1];this.data[n]=r}return this.columns+=1,this}}var Kn,Qn;Qn=Yn,(Kn=qn).prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},Kn.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},Kn.prototype.addM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},Kn.add=function(t,e){return new Qn(t).add(e)},Kn.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},Kn.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},Kn.prototype.subM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},Kn.sub=function(t,e){return new Qn(t).sub(e)},Kn.prototype.subtract=Kn.prototype.sub,Kn.prototype.subtractS=Kn.prototype.subS,Kn.prototype.subtractM=Kn.prototype.subM,Kn.subtract=Kn.sub,Kn.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},Kn.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},Kn.prototype.mulM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},Kn.mul=function(t,e){return new Qn(t).mul(e)},Kn.prototype.multiply=Kn.prototype.mul,Kn.prototype.multiplyS=Kn.prototype.mulS,Kn.prototype.multiplyM=Kn.prototype.mulM,Kn.multiply=Kn.mul,Kn.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},Kn.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},Kn.prototype.divM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},Kn.div=function(t,e){return new Qn(t).div(e)},Kn.prototype.divide=Kn.prototype.div,Kn.prototype.divideS=Kn.prototype.divS,Kn.prototype.divideM=Kn.prototype.divM,Kn.divide=Kn.div,Kn.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},Kn.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},Kn.prototype.modM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},Kn.mod=function(t,e){return new Qn(t).mod(e)},Kn.prototype.modulus=Kn.prototype.mod,Kn.prototype.modulusS=Kn.prototype.modS,Kn.prototype.modulusM=Kn.prototype.modM,Kn.modulus=Kn.mod,Kn.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},Kn.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},Kn.prototype.andM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},Kn.and=function(t,e){return new Qn(t).and(e)},Kn.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},Kn.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},Kn.prototype.orM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},Kn.or=function(t,e){return new Qn(t).or(e)},Kn.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},Kn.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},Kn.prototype.xorM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},Kn.xor=function(t,e){return new Qn(t).xor(e)},Kn.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},Kn.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},Kn.prototype.leftShiftM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},Kn.leftShift=function(t,e){return new Qn(t).leftShift(e)},Kn.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},Kn.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},Kn.prototype.signPropagatingRightShiftM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},Kn.signPropagatingRightShift=function(t,e){return new Qn(t).signPropagatingRightShift(e)},Kn.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},Kn.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},Kn.prototype.rightShiftM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},Kn.rightShift=function(t,e){return new Qn(t).rightShift(e)},Kn.prototype.zeroFillRightShift=Kn.prototype.rightShift,Kn.prototype.zeroFillRightShiftS=Kn.prototype.rightShiftS,Kn.prototype.zeroFillRightShiftM=Kn.prototype.rightShiftM,Kn.zeroFillRightShift=Kn.rightShift,Kn.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},Kn.not=function(t){return new Qn(t).not()},Kn.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},Kn.abs=function(t){return new Qn(t).abs()},Kn.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},Kn.acos=function(t){return new Qn(t).acos()},Kn.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},Kn.acosh=function(t){return new Qn(t).acosh()},Kn.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},Kn.asin=function(t){return new Qn(t).asin()},Kn.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},Kn.asinh=function(t){return new Qn(t).asinh()},Kn.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},Kn.atan=function(t){return new Qn(t).atan()},Kn.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},Kn.atanh=function(t){return new Qn(t).atanh()},Kn.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},Kn.cbrt=function(t){return new Qn(t).cbrt()},Kn.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},Kn.ceil=function(t){return new Qn(t).ceil()},Kn.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},Kn.clz32=function(t){return new Qn(t).clz32()},Kn.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},Kn.cos=function(t){return new Qn(t).cos()},Kn.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},Kn.cosh=function(t){return new Qn(t).cosh()},Kn.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},Kn.exp=function(t){return new Qn(t).exp()},Kn.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},Kn.expm1=function(t){return new Qn(t).expm1()},Kn.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},Kn.floor=function(t){return new Qn(t).floor()},Kn.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},Kn.fround=function(t){return new Qn(t).fround()},Kn.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},Kn.log=function(t){return new Qn(t).log()},Kn.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},Kn.log1p=function(t){return new Qn(t).log1p()},Kn.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},Kn.log10=function(t){return new Qn(t).log10()},Kn.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},Kn.log2=function(t){return new Qn(t).log2()},Kn.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},Kn.round=function(t){return new Qn(t).round()},Kn.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},Kn.sign=function(t){return new Qn(t).sign()},Kn.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},Kn.sin=function(t){return new Qn(t).sin()},Kn.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},Kn.sinh=function(t){return new Qn(t).sinh()},Kn.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},Kn.sqrt=function(t){return new Qn(t).sqrt()},Kn.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},Kn.tan=function(t){return new Qn(t).tan()},Kn.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},Kn.tanh=function(t){return new Qn(t).tanh()},Kn.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},Kn.trunc=function(t){return new Qn(t).trunc()},Kn.pow=function(t,e){return new Qn(t).pow(e)},Kn.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},Kn.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t));return this},Kn.prototype.powM=function(t){if(t=Qn.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t.get(e,n)));return this};var $n=n(8),Zn=n.n($n),Jn=n(4),tr=n.n(Jn),er=n(5),nr=n.n(er),rr=n(9),ir=n.n(rr),or=(n(19),n(1)),ar=n(0),ur=n(3);function sr(t){return"number"==typeof t}function cr(t){return void 0===t?0:t>360||t<-360?t%360:t}function fr(t,e,n){return sr(t)?ar.d.fromValues(t,e,n):3===t.length?ar.d.clone(t):ar.d.fromValues(t[0],t[1],t[2])}var lr,hr,dr,pr,mr,vr,gr,yr,br,_r,Er=function(){function t(e,n){tr()(this,t),this.name=void 0,this.matrix=void 0,this.right=void 0,this.up=void 0,this.forward=void 0,this.position=void 0,this.focalPoint=void 0,this.distanceVector=void 0,this.distance=void 0,this.dollyingStep=void 0,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.name=e,this.matrix=ar.b.clone(n.matrix),this.right=ar.d.clone(n.right),this.up=ar.d.clone(n.up),this.forward=ar.d.clone(n.forward),this.position=ar.d.clone(n.position),this.focalPoint=ar.d.clone(n.focalPoint),this.distanceVector=ar.d.clone(n.distanceVector),this.azimuth=n.azimuth,this.elevation=n.elevation,this.roll=n.roll,this.relAzimuth=n.relAzimuth,this.relElevation=n.relElevation,this.relRoll=n.relRoll,this.dollyingStep=n.dollyingStep,this.distance=n.distance}return nr()(t,[{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getRoll",value:function(){return this.roll}},{key:"retrieve",value:function(t){t.matrix=ar.b.copy(t.matrix,this.matrix),t.right=ar.d.copy(t.right,this.right),t.up=ar.d.copy(t.up,this.up),t.forward=ar.d.copy(t.forward,this.forward),t.position=ar.d.copy(t.position,this.position),t.focalPoint=ar.d.copy(t.focalPoint,this.focalPoint),t.distanceVector=ar.d.copy(t.distanceVector,this.distanceVector),t.azimuth=this.azimuth,t.elevation=this.elevation,t.roll=this.roll,t.relAzimuth=this.relAzimuth,t.relElevation=this.relElevation,t.relRoll=this.relRoll,t.dollyingStep=this.dollyingStep,t.distance=this.distance}}]),t}();!function(t){t.ORBITING="ORBITING",t.EXPLORING="EXPLORING",t.TRACKING="TRACKING"}(yr||(yr={})),function(t){t.DEFAULT="DEFAULT",t.ROTATIONAL="ROTATIONAL",t.TRANSLATIONAL="TRANSLATIONAL",t.CINEMATIC="CINEMATIC"}(br||(br={})),function(t){t.ORTHOGRAPHIC="ORTHOGRAPHIC",t.PERSPECTIVE="PERSPECTIVE"}(_r||(_r={}));var wr,xr,Tr,Ar,Sr,Rr,Or,Cr=Math.PI/180,Mr=180/Math.PI,Ir=(lr=Object(ur.injectable)(),hr=Object(ur.inject)(or.IDENTIFIER.InteractorService),lr((gr=vr=function(){function t(){tr()(this,t),this.matrix=ar.b.create(),this.right=ar.d.fromValues(1,0,0),this.up=ar.d.fromValues(0,1,0),this.forward=ar.d.fromValues(0,0,1),this.position=ar.d.fromValues(0,0,1),this.focalPoint=ar.d.fromValues(0,0,0),this.distanceVector=ar.d.fromValues(0,0,0),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.rotateWorld=!1,Zn()(this,"interactor",mr,this),this.fov=30,this.near=.1,this.far=1e4,this.aspect=1,this.left=void 0,this.rright=void 0,this.top=void 0,this.bottom=void 0,this.zoom=1,this.perspective=ar.b.create(),this.view=void 0,this.following=void 0,this.type=yr.EXPLORING,this.trackingMode=br.DEFAULT,this.projectionMode=_r.PERSPECTIVE,this.frustum=new or.Frustum,this.landmarks=[],this.landmarkAnimationID=void 0}return nr()(t,[{key:"clone",value:function(){var e=new t;return e.setType(this.type,void 0),e.interactor=this.interactor,e}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.perspective}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"setType",value:function(t,e){return this.type=t,this.type===yr.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===yr.TRACKING&&void 0!==e&&this.setTrackingMode(e),this}},{key:"setProjectionMode",value:function(t){return this.projectionMode=t,this}},{key:"setTrackingMode",value:function(t){if(this.type!==yr.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this}},{key:"setWorldRotation",value:function(t){this.rotateWorld=t,this._getAngles()}},{key:"getViewTransform",value:function(){return ar.b.invert(ar.b.create(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"setMatrix",value:function(t){return this.matrix=t,this._update(),this}},{key:"setAspect",value:function(t){return this.setPerspective(this.near,this.far,this.fov,t),this}},{key:"setViewOffset",value:function(t,e,n,r,i,o){return this.aspect=t/e,void 0===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.projectionMode===_r.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===_r.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setPerspective",value:function(t,e,n,r){return this.projectionMode=_r.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r,ar.b.perspective(this.perspective,this.fov*Cr,this.aspect,this.near,this.far),this}},{key:"setOrthographic",value:function(t,e,n,r,i,o){this.projectionMode=_r.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var a=(this.rright-this.left)/(2*this.zoom),u=(this.top-this.bottom)/(2*this.zoom),s=(this.rright+this.left)/2,c=(this.top+this.bottom)/2,f=s-a,l=s+a,h=c+u,d=c-u;if(void 0!==this.view&&this.view.enabled){var p=(this.rright-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l=(f+=p*this.view.offsetX)+p*this.view.width,d=(h-=m*this.view.offsetY)-m*this.view.height}return ar.b.ortho(this.perspective,f,l,h,d,i,o),this}},{key:"setPosition",value:function(t,e,n){return this._setPosition(t,e,n),this.setFocalPoint(this.focalPoint),this}},{key:"setFocalPoint",value:function(t,e,n){var r=ar.d.fromValues(0,1,0);if(this.focalPoint=fr(t,e,n),this.trackingMode===br.CINEMATIC){var i=ar.d.subtract(ar.d.create(),this.focalPoint,this.position);t=i[0],e=i[1],n=i[2];var o=ar.d.length(i),a=Math.asin(e/o)*Mr,u=90+Math.atan2(n,t)*Mr,s=ar.b.create();ar.b.rotateY(s,s,u*Cr),ar.b.rotateX(s,s,a*Cr),r=ar.d.transformMat4(ar.d.create(),[0,1,0],s)}return ar.b.invert(this.matrix,ar.b.lookAt(ar.b.create(),this.position,this.focalPoint,r)),this._getAxes(),this._getDistance(),this._getAngles(),this}},{key:"setDistance",value:function(t){if(!(this.distance===t||t<0)){this.distance=t,this.distance<2e-4&&(this.distance=2e-4),this.dollyingStep=this.distance/100;var e=ar.d.create();t=this.distance;var n=this.forward,r=this.focalPoint;return e[0]=t*n[0]+r[0],e[1]=t*n[1]+r[1],e[2]=t*n[2]+r[2],this._setPosition(e),this}}},{key:"setMaxDistance",value:function(t){return this.maxDistance=t,this}},{key:"setMinDistance",value:function(t){return this.minDistance=t,this}},{key:"changeAzimuth",value:function(t){return this.setAzimuth(this.azimuth+t),this}},{key:"changeElevation",value:function(t){return this.setElevation(this.elevation+t),this}},{key:"changeRoll",value:function(t){return this.setRoll(this.roll+t),this}},{key:"setAzimuth",value:function(t){return this.azimuth=cr(t),this.computeMatrix(),this._getAxes(),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getPosition():this.type===yr.TRACKING&&this._getFocalPoint(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=cr(t),this.computeMatrix(),this._getAxes(),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getPosition():this.type===yr.TRACKING&&this._getFocalPoint(),this}},{key:"setRoll",value:function(t){return this.roll=cr(t),this.computeMatrix(),this._getAxes(),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getPosition():this.type===yr.TRACKING&&this._getFocalPoint(),this}},{key:"rotate",value:function(t,e,n){if(this.type===yr.EXPLORING){t=cr(t),e=cr(e),n=cr(n);var r=ar.c.setAxisAngle(ar.c.create(),[1,0,0],(this.rotateWorld?1:-1)*e*Cr),i=ar.c.setAxisAngle(ar.c.create(),[0,1,0],(this.rotateWorld?1:-1)*t*Cr),o=ar.c.setAxisAngle(ar.c.create(),[0,0,1],n*Cr),a=ar.c.multiply(ar.c.create(),i,r);a=ar.c.multiply(ar.c.create(),a,o);var u=ar.b.fromQuat(ar.b.create(),a);ar.b.translate(this.matrix,this.matrix,[0,0,-this.distance]),ar.b.multiply(this.matrix,this.matrix,u),ar.b.translate(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation+e)>90)return;this.relElevation=cr(e),this.relAzimuth=cr(t),this.relRoll=cr(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.computeMatrix()}return this._getAxes(),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getPosition():this.type===yr.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(t,e){var n=fr(t,e,0),r=ar.d.clone(this.position);return ar.d.add(r,r,ar.d.scale(ar.d.create(),this.right,n[0])),ar.d.add(r,r,ar.d.scale(ar.d.create(),this.up,n[1])),this._setPosition(r),this}},{key:"dolly",value:function(t){var e=this.forward,n=ar.d.clone(this.position),r=this.dollyingStep,i=this.distance+t*this.dollyingStep;return r=Math.max(Math.min(i,this.maxDistance),this.minDistance)-this.distance,n[0]+=r*e[0],n[1]+=r*e[1],n[2]+=r*e[2],this._setPosition(n),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getDistance():this.type===yr.TRACKING&&ar.d.add(this.focalPoint,n,this.distanceVector),this}},{key:"createLandmark",value:function(t,e){var n=this.clone();n.setPosition(e.position),n.setFocalPoint(e.focalPoint),void 0!==e.roll&&n.setRoll(e.roll);var r=new Er(t,n);return this.landmarks.push(r),r}},{key:"setLandmark",value:function(t){var e=new Er(t,this);return this.landmarks.push(e),this}},{key:"gotoLandmark",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,r=this.landmarks.find((function(e){return e.name===t}));if(r){if(0===n)return void r.retrieve(this);void 0!==this.landmarkAnimationID&&window.cancelAnimationFrame(this.landmarkAnimationID),this.interactor.disconnect();var i,o=r.getPosition(),a=r.getFocalPoint(),u=r.getRoll(),s=function t(r){void 0===i&&(i=r);var s,c=r-i,f=(1-Math.cos(c/n*Math.PI))/2,l=ar.d.create(),h=ar.d.create();if(ar.d.lerp(l,e.focalPoint,a,f),ar.d.lerp(h,e.position,o,f),s=e.roll*(1-f)+u*f,e.setFocalPoint(l),e.setPosition(h),e.setRoll(s),e.computeMatrix(),!(ar.d.dist(l,a)+ar.d.dist(h,o)>.01))return e.setFocalPoint(l),e.setPosition(h),e.setRoll(s),e.computeMatrix(),void e.interactor.connect();c<n&&(e.landmarkAnimationID=window.requestAnimationFrame(t))};window.requestAnimationFrame(s)}}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles()}},{key:"computeMatrix",value:function(){var t,e,n=ar.c.setAxisAngle(ar.c.create(),[0,0,1],this.roll*Cr);ar.b.identity(this.matrix),t=ar.c.setAxisAngle(ar.c.create(),[1,0,0],(this.rotateWorld&&this.type!==yr.TRACKING||this.type===yr.TRACKING?1:-1)*this.elevation*Cr),e=ar.c.setAxisAngle(ar.c.create(),[0,1,0],(this.rotateWorld&&this.type!==yr.TRACKING||this.type===yr.TRACKING?1:-1)*this.azimuth*Cr);var r=ar.c.multiply(ar.c.create(),e,t);r=ar.c.multiply(ar.c.create(),r,n);var i=ar.b.fromQuat(ar.b.create(),r);this.type===yr.ORBITING||this.type===yr.EXPLORING?(ar.b.translate(this.matrix,this.matrix,this.focalPoint),ar.b.multiply(this.matrix,this.matrix,i),ar.b.translate(this.matrix,this.matrix,[0,0,this.distance])):this.type===yr.TRACKING&&(ar.b.translate(this.matrix,this.matrix,this.position),ar.b.multiply(this.matrix,this.matrix,i))}},{key:"_setPosition",value:function(t,e,n){this.position=fr(t,e,n);var r=this.matrix;r[12]=this.position[0],r[13]=this.position[1],r[14]=this.position[2],r[15]=1}},{key:"_getAxes",value:function(){ar.d.copy(this.right,fr(ar.e.transformMat4(ar.e.create(),[1,0,0,0],this.matrix))),ar.d.copy(this.up,fr(ar.e.transformMat4(ar.e.create(),[0,1,0,0],this.matrix))),ar.d.copy(this.forward,fr(ar.e.transformMat4(ar.e.create(),[0,0,1,0],this.matrix))),ar.d.normalize(this.right,this.right),ar.d.normalize(this.up,this.up),ar.d.normalize(this.forward,this.forward)}},{key:"_getAngles",value:function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=ar.d.length(this.distanceVector);if(0===r)return this.elevation=0,void(this.azimuth=0);this.type===yr.TRACKING||this.rotateWorld?(this.elevation=Math.asin(e/r)*Mr,this.azimuth=Math.atan2(-t,-n)*Mr):(this.elevation=-Math.asin(e/r)*Mr,this.azimuth=-Math.atan2(-t,-n)*Mr)}},{key:"_getPosition",value:function(){ar.d.copy(this.position,fr(ar.e.transformMat4(ar.e.create(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){ar.d.transformMat3(this.distanceVector,[0,0,-this.distance],ar.a.fromMat4(ar.a.create(),this.matrix)),ar.d.add(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=ar.d.subtract(ar.d.create(),this.focalPoint,this.position),this.distance=ar.d.length(this.distanceVector),this.dollyingStep=this.distance/100}}]),t}(),vr.ProjectionMode={ORTHOGRAPHIC:"ORTHOGRAPHIC",PERSPECTIVE:"PERSPECTIVE"},pr=gr,mr=ir()(pr.prototype,"interactor",[hr],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),dr=pr))||dr),Nr=(wr=Object(ur.injectable)(),xr=Object(ur.inject)(or.IDENTIFIER.GeometryComponentManager),wr((Or=Rr=function(){function t(){tr()(this,t),this.config=void 0,Zn()(this,"geometry",Sr,this),this.entity=void 0,this.component=void 0}return nr()(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t){this.entity=t,this.component=this.geometry.create(t),this.component.entity=t,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),t}(),Rr.BOX="box",Rr.SPHERE="sphere",Rr.PLANE="plane",Rr.MERGED="merged",Ar=Or,Sr=ir()(Ar.prototype,"geometry",[xr],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Tr=Ar))||Tr),Pr=n(7),kr=n.n(Pr),Dr=n(11),Lr=n.n(Dr),jr=n(2),Fr=n.n(jr),Br=n(6);function Ur(){if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}var Gr={}.toString,Vr=function(t,e){return Gr.call(t)==="[object "+e+"]"},zr=n(26),Wr=n.n(zr),Hr={};Hr["[object Float32Array]"]=Hr["[object Float64Array]"]=Hr["[object Int8Array]"]=Hr["[object Int16Array]"]=Hr["[object Int32Array]"]=Hr["[object Uint8Array]"]=Hr["[object Uint8ClampedArray]"]=Hr["[object Uint16Array]"]=Hr["[object Uint32Array]"]=!0,Hr["[object Arguments]"]=Hr["[object Array]"]=Hr["[object ArrayBuffer]"]=Hr["[object Boolean]"]=Hr["[object DataView]"]=Hr["[object Date]"]=Hr["[object Error]"]=Hr["[object Function]"]=Hr["[object Map]"]=Hr["[object Number]"]=Hr["[object Object]"]=Hr["[object RegExp]"]=Hr["[object Set]"]=Hr["[object String]"]=Hr["[object WeakMap]"]=!1;var qr=Object.prototype.toString;var Xr,Yr,Kr,Qr,$r,Zr,Jr,ti=function(t){return function(t){return!!t&&"object"===Wr()(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!!Hr[qr.call(t)]};function ei(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ni(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ei(Object(n),!0).forEach((function(e){Fr()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ei(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var ri,ii,oi,ai,ui,si,ci,fi,li,hi,di,pi,mi,vi,gi,yi,bi,_i,Ei,wi,xi,Ti,Ai,Si,Ri,Oi,Ci,Mi,Ii,Ni,Pi,ki,Di,Li,ji,Fi=(Xr=Object(ur.injectable)(),Yr=Object(ur.inject)(or.IDENTIFIER.RenderEngine),Kr=Object(ur.inject)(or.IDENTIFIER.ConfigService),Xr(($r=function(){function t(){tr()(this,t),Zn()(this,"engine",Zr,this),Zn()(this,"configService",Jr,this),this.entity=Object(or.createEntity)(),this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}var e,n,r;return nr()(t,[{key:"init",value:function(){var t=this.configService.get(),e=t.canvas,n=t.engineOptions;this.initPromise=this.engine.init(ni({canvas:e||Ur(),swapChainFormat:Br.TextureFormat.BGRA8Unorm,antialiasing:!1},n))}},{key:"setBundle",value:function(t){this.compiledBundle=JSON.parse(JSON.stringify(t))}},{key:"setDispatch",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=t),this}},{key:"setMaxIteration",value:function(t){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=t),this}},{key:"setBinding",value:function(t,e){var n,r=this;if("string"==typeof t){var i=sr(e)||ti(e)||(n=e,Array.isArray?Array.isArray(n):Vr(n,"Array"));if(this.compiledBundle&&this.compiledBundle.context){var o=this.compiledBundle.context.defines.find((function(e){return e.name===t}));if(o)return o.value=e,this;var a=this.compiledBundle.context.uniforms.find((function(e){return e.name===t}));a&&(i?(a.data=e,a.isReferer=!1,a.storageClass===or.STORAGE_CLASS.Uniform?this.model&&this.model.updateUniform(t,e):this.model&&this.model.updateBuffer(t,e)):(a.isReferer=!0,a.data=e))}}else Object.keys(t).forEach((function(e){r.setBinding(e,t[e])}));return this}},{key:"execute",value:(r=Lr()(kr.a.mark((function t(){var e,n,r=this,i=arguments;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=i.length>0&&void 0!==i[0]?i[0]:1,!this.dirty){t.next=6;break}return this.compiledBundle.context&&(e>1?this.compiledBundle.context.maxIteration=e:this.compiledBundle.context.maxIteration++),t.next=5,this.compile();case 5:this.dirty=!1;case 6:for(this.engine.beginFrame(),this.engine.clear({}),this.compiledBundle.context&&this.compiledBundle.context.uniforms.filter((function(t){return t.isReferer})).forEach((function(t){var e=t.data,n=t.name;r.model.confirmInput(e.model,n)})),n=0;n<e;n++)this.model.run();return this.engine.endFrame(),t.abrupt("return",this);case 12:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"getOutput",value:(n=Lr()(kr.a.mark((function t(){return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.model.readData());case 1:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"compile",value:(e=Lr()(kr.a.mark((function t(){var e,n,r;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.initPromise;case 2:return e=ni({},this.compiledBundle.context),n=this.engine.supportWebGPU?this.engine.useWGSL?or.Target.WGSL:or.Target.GLSL450:or.Target.GLSL100,r=this.compiledBundle.shaders[n],e.defines.filter((function(t){return t.runtime})).forEach((function(t){var e="".concat(or.DefineValuePlaceholder).concat(t.name);r=r.replace(e,"".concat(t.value))})),e.shader=r,e.uniforms.forEach((function(t){if(!t.data&&t.storageClass===or.STORAGE_CLASS.StorageBuffer){var n=1;t.type===or.AST_TOKEN_TYPES.FloatArray?n=1:t.type===or.AST_TOKEN_TYPES.Vector4FloatArray&&(n=4),t.data=new Float32Array(e.output.length*n).fill(0)}})),this.compiledBundle.context=e,t.next=11,this.engine.createComputeModel(this.compiledBundle.context);case 11:this.model=t.sent;case 12:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),Zr=ir()($r.prototype,"engine",[Yr],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Jr=ir()($r.prototype,"configService",[Kr],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Qr=$r))||Qr),Bi=(ri=Object(ur.injectable)(),ii=Object(ur.inject)(or.IDENTIFIER.MaterialComponentManager),ri((ci=si=function(){function t(){tr()(this,t),this.config=void 0,Zn()(this,"material",ui,this),this.entity=void 0,this.component=void 0}return nr()(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t,e){this.entity=t,this.component=this.material.create(t),this.component.entity=t,this.component.type=e,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),t}(),si.BASIC="basic",ai=ci,ui=ir()(ai.prototype,"material",[ii],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),oi=ai))||oi),Ui=(fi=Object(ur.injectable)(),li=Object(ur.inject)(or.IDENTIFIER.MeshComponentManager),hi=Object(ur.inject)(or.IDENTIFIER.CullableComponentManager),di=Object(ur.inject)(or.IDENTIFIER.TransformComponentManager),pi=Object(ur.inject)(or.IDENTIFIER.Systems),mi=Object(ur.named)(or.IDENTIFIER.SceneGraphSystem),fi((xi=wi=function(){function t(){tr()(this,t),this.attributes={},this.config=void 0,Zn()(this,"mesh",yi,this),Zn()(this,"cullable",bi,this),Zn()(this,"transform",_i,this),Zn()(this,"sceneGraphSystem",Ei,this),this.meshComponent=void 0,this.transformComponent=void 0,this.entity=void 0}return nr()(t,[{key:"getEntity",value:function(){return this.entity}},{key:"getTransformComponent",value:function(){return this.transformComponent}},{key:"getMeshComponent",value:function(){return this.meshComponent}},{key:"setConfig",value:function(t){this.config=t}},{key:"setEntity",value:function(t){this.entity=t,this.cullable.create(t),this.meshComponent=this.mesh.create(t),this.transformComponent=this.transform.create(t),this.onEntityCreated()}},{key:"setMaterial",value:function(t){return this.meshComponent.material=t,this}},{key:"setGeometry",value:function(t){return this.meshComponent.geometry=t,this}},{key:"setAttributes",value:function(t){var e=this;Object.keys(t).forEach((function(n){void 0!==t[n]&&t[n]!==e.attributes[n]&&(e.onAttributeChanged({name:n,data:t[n]}),e.attributes[n]=t[n])}))}},{key:"setVisible",value:function(t){var e=this;return this.meshComponent.visible=t,this.meshComponent.children.forEach((function(n){var r=e.mesh.getComponentByEntity(n);r&&(r.visible=t)})),this}},{key:"isVisible",value:function(){return this.meshComponent.visible}},{key:"attach",value:function(t){return this.sceneGraphSystem.attach(this.entity,t.entity),this}},{key:"detach",value:function(){return this.sceneGraphSystem.detach(this.entity),this}},{key:"detachChildren",value:function(){return this.sceneGraphSystem.detachChildren(this.entity),this}},{key:"onEntityCreated",value:function(){}},{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data;this.meshComponent&&this.meshComponent.material&&this.meshComponent.material.setUniform(this.convertAttributeName2UniformName(e),n)}},{key:"convertAttributeName2UniformName",value:function(t){return t}}]),t}(),wi.POINT="point",wi.LINE="line",wi.GRID="grid",gi=xi,yi=ir()(gi.prototype,"mesh",[li],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),bi=ir()(gi.prototype,"cullable",[hi],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_i=ir()(gi.prototype,"transform",[di],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ei=ir()(gi.prototype,"sceneGraphSystem",[pi,mi],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vi=gi))||vi),Gi=n(174),Vi=n.n(Gi),zi=function(){function t(e,n){tr()(this,t),this.attribute=void 0,this.buffer=void 0;var r=n.buffer,i=n.offset,o=n.stride,a=n.normalized,u=n.size,s=n.divisor;this.buffer=r,this.attribute={buffer:r.get(),offset:i||0,stride:o||0,normalized:a||!1,divisor:s||0},u&&(this.attribute.size=u)}return nr()(t,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),Wi=(Ti={},Fr()(Ti,or.gl.POINTS,"points"),Fr()(Ti,or.gl.LINES,"lines"),Fr()(Ti,or.gl.LINE_LOOP,"line loop"),Fr()(Ti,or.gl.LINE_STRIP,"line strip"),Fr()(Ti,or.gl.TRIANGLES,"triangles"),Fr()(Ti,or.gl.TRIANGLE_FAN,"triangle fan"),Fr()(Ti,or.gl.TRIANGLE_STRIP,"triangle strip"),Ti),Hi=(Ai={},Fr()(Ai,or.gl.STATIC_DRAW,"static"),Fr()(Ai,or.gl.DYNAMIC_DRAW,"dynamic"),Fr()(Ai,or.gl.STREAM_DRAW,"stream"),Ai),qi=(Si={},Fr()(Si,or.gl.BYTE,"int8"),Fr()(Si,or.gl.UNSIGNED_INT,"int16"),Fr()(Si,or.gl.INT,"int32"),Fr()(Si,or.gl.UNSIGNED_BYTE,"uint8"),Fr()(Si,or.gl.UNSIGNED_SHORT,"uint16"),Fr()(Si,or.gl.UNSIGNED_INT,"uint32"),Fr()(Si,or.gl.FLOAT,"float"),Si),Xi=(Ri={},Fr()(Ri,or.gl.ALPHA,"alpha"),Fr()(Ri,or.gl.LUMINANCE,"luminance"),Fr()(Ri,or.gl.LUMINANCE_ALPHA,"luminance alpha"),Fr()(Ri,or.gl.RGB,"rgb"),Fr()(Ri,or.gl.RGBA,"rgba"),Fr()(Ri,or.gl.RGBA4,"rgba4"),Fr()(Ri,or.gl.RGB5_A1,"rgb5 a1"),Fr()(Ri,or.gl.RGB565,"rgb565"),Fr()(Ri,or.gl.DEPTH_COMPONENT,"depth"),Fr()(Ri,or.gl.DEPTH_STENCIL,"depth stencil"),Ri),Yi=(Oi={},Fr()(Oi,or.gl.DONT_CARE,"dont care"),Fr()(Oi,or.gl.NICEST,"nice"),Fr()(Oi,or.gl.FASTEST,"fast"),Oi),Ki=(Ci={},Fr()(Ci,or.gl.NEAREST,"nearest"),Fr()(Ci,or.gl.LINEAR,"linear"),Fr()(Ci,or.gl.LINEAR_MIPMAP_LINEAR,"mipmap"),Fr()(Ci,or.gl.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Fr()(Ci,or.gl.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Fr()(Ci,or.gl.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),Ci),Qi=(Mi={},Fr()(Mi,or.gl.REPEAT,"repeat"),Fr()(Mi,or.gl.CLAMP_TO_EDGE,"clamp"),Fr()(Mi,or.gl.MIRRORED_REPEAT,"mirror"),Mi),$i=(Ii={},Fr()(Ii,or.gl.NONE,"none"),Fr()(Ii,or.gl.BROWSER_DEFAULT_WEBGL,"browser"),Ii),Zi=(Ni={},Fr()(Ni,or.gl.NEVER,"never"),Fr()(Ni,or.gl.ALWAYS,"always"),Fr()(Ni,or.gl.LESS,"less"),Fr()(Ni,or.gl.LEQUAL,"lequal"),Fr()(Ni,or.gl.GREATER,"greater"),Fr()(Ni,or.gl.GEQUAL,"gequal"),Fr()(Ni,or.gl.EQUAL,"equal"),Fr()(Ni,or.gl.NOTEQUAL,"notequal"),Ni),Ji=(Pi={},Fr()(Pi,or.gl.FUNC_ADD,"add"),Fr()(Pi,or.gl.MIN_EXT,"min"),Fr()(Pi,or.gl.MAX_EXT,"max"),Fr()(Pi,or.gl.FUNC_SUBTRACT,"subtract"),Fr()(Pi,or.gl.FUNC_REVERSE_SUBTRACT,"reverse subtract"),Pi),to=(ki={},Fr()(ki,or.gl.ZERO,"zero"),Fr()(ki,or.gl.ONE,"one"),Fr()(ki,or.gl.SRC_COLOR,"src color"),Fr()(ki,or.gl.ONE_MINUS_SRC_COLOR,"one minus src color"),Fr()(ki,or.gl.SRC_ALPHA,"src alpha"),Fr()(ki,or.gl.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Fr()(ki,or.gl.DST_COLOR,"dst color"),Fr()(ki,or.gl.ONE_MINUS_DST_COLOR,"one minus dst color"),Fr()(ki,or.gl.DST_ALPHA,"dst alpha"),Fr()(ki,or.gl.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Fr()(ki,or.gl.CONSTANT_COLOR,"constant color"),Fr()(ki,or.gl.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Fr()(ki,or.gl.CONSTANT_ALPHA,"constant alpha"),Fr()(ki,or.gl.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Fr()(ki,or.gl.SRC_ALPHA_SATURATE,"src alpha saturate"),ki),eo=(Di={},Fr()(Di,or.gl.NEVER,"never"),Fr()(Di,or.gl.ALWAYS,"always"),Fr()(Di,or.gl.LESS,"less"),Fr()(Di,or.gl.LEQUAL,"lequal"),Fr()(Di,or.gl.GREATER,"greater"),Fr()(Di,or.gl.GEQUAL,"gequal"),Fr()(Di,or.gl.EQUAL,"equal"),Fr()(Di,or.gl.NOTEQUAL,"notequal"),Di),no=(Li={},Fr()(Li,or.gl.ZERO,"zero"),Fr()(Li,or.gl.KEEP,"keep"),Fr()(Li,or.gl.REPLACE,"replace"),Fr()(Li,or.gl.INVERT,"invert"),Fr()(Li,or.gl.INCR,"increment"),Fr()(Li,or.gl.DECR,"decrement"),Fr()(Li,or.gl.INCR_WRAP,"increment wrap"),Fr()(Li,or.gl.DECR_WRAP,"decrement wrap"),Li),ro=(ji={},Fr()(ji,or.gl.FRONT,"front"),Fr()(ji,or.gl.BACK,"back"),ji),io=function(){function t(e,n){tr()(this,t),this.buffer=void 0;var r=n.data,i=n.usage,o=n.type;this.buffer=e.buffer({data:r,usage:Hi[i||or.gl.STATIC_DRAW],type:qi[o||or.gl.UNSIGNED_BYTE]})}return nr()(t,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(t){var e=t.data,n=t.offset;this.buffer.subdata(e,n)}}]),t}(),oo=n(18),ao=n.n(oo),uo={};uo["[object Float32Array]"]=uo["[object Float64Array]"]=uo["[object Int8Array]"]=uo["[object Int16Array]"]=uo["[object Int32Array]"]=uo["[object Uint8Array]"]=uo["[object Uint8ClampedArray]"]=uo["[object Uint16Array]"]=uo["[object Uint32Array]"]=!0,uo["[object Arguments]"]=uo["[object Array]"]=uo["[object ArrayBuffer]"]=uo["[object Boolean]"]=uo["[object DataView]"]=uo["[object Date]"]=uo["[object Error]"]=uo["[object Function]"]=uo["[object Map]"]=uo["[object Number]"]=uo["[object Object]"]=uo["[object RegExp]"]=uo["[object Set]"]=uo["[object String]"]=uo["[object WeakMap]"]=!1;var so=Object.prototype.toString;var co=function(t){return function(t){return!!t&&"object"===Wr()(t)}(t)&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!!uo[so.call(t)]};function fo(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function lo(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?fo(Object(n),!0).forEach((function(e){Fr()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fo(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var ho=0,po=function(){function t(e,n){var r=this;tr()(this,t),this.reGl=e,this.context=n,this.entity=Object(or.createEntity)(),this.texFBO=void 0,this.computeCommand=void 0,this.textureCache={},this.outputTextureName=void 0,this.swapOutputTextureName=void 0,this.compiledPingpong=void 0,this.dynamicPingpong=void 0;var i={};this.context.uniforms.forEach((function(t){var e=t.name,n=t.type,o=t.data,a=t.isReferer,u=t.storageClass;if(u===or.STORAGE_CLASS.StorageBuffer){if(a)r.textureCache[e]={data:void 0},i["".concat(e,"Size")]=function(){return o.compiledBundle.context.output.textureSize};else{r.textureCache[e]=r.calcDataTexture(e,n,o);var s=r.textureCache[e],c=s.textureWidth,f=s.isOutput;i["".concat(e,"Size")]=[c,c],f&&(r.outputTextureName=e,r.context.needPingpong&&(r.outputTextureName="".concat(e,"Output"),r.textureCache[r.outputTextureName]=r.calcDataTexture(e,n,o)))}i[e]=function(){return r.textureCache[e].texture}}else if(u===or.STORAGE_CLASS.Uniform){if(o&&(Array.isArray(o)||co(o))&&o.length>16)throw new Error("invalid data type ".concat(n));i[e]=function(){return t.data}}}));var o=this.getOuputDataTexture(),a=o.textureWidth,u=o.texelCount;i.u_OutputTextureSize=[a,a],i.u_OutputTexelCount=u,this.context.output.textureSize=[a,a];var s={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(this.context.shader),uniforms:i,vert:"attribute vec3 a_Position;\nattribute vec2 a_TexCoord;\n\nvarying vec2 v_TexCoord;\n\nvoid main() {\n gl_Position = vec4(a_Position, 1.0);\n v_TexCoord = a_TexCoord;\n}",primitive:"triangle strip",count:4};this.computeCommand=this.reGl(s)}var e;return nr()(t,[{key:"run",value:function(){var t=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use((function(){t.computeCommand()}))}},{key:"readData",value:(e=Lr()(kr.a.mark((function t(){var e,n,r,i,o,a,u,s,c=this;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.reGl({framebuffer:this.texFBO})((function(){e=c.reGl.read()})),!e){t.next=6;break}if(n=this.getOuputDataTexture(),r=n.originalDataLength,i=n.elementsPerTexel,o=n.typedArrayConstructor,a=void 0===o?Float32Array:o,u=[],4!==i)for(s=0;s<e.length;s+=4)1===i?u.push(e[s]):2===i?u.push(e[s],e[s+1]):u.push(e[s],e[s+1],e[s+2]);else u=e;return t.abrupt("return",new a(u.slice(0,r)));case 6:return t.abrupt("return",new Float32Array);case 7:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"confirmInput",value:function(t,e){var n;this.entity===t.entity?(this.dynamicPingpong=!0,n=this):n=t,this.textureCache[e].id=n.getOuputDataTexture().id,this.textureCache[e].texture=n.getOuputDataTexture().texture}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(t,e){var n=this.context.uniforms.find((function(e){return e.name===t}));if(n){var r=this.calcDataTexture(t,n.type,e),i=r.texture,o=r.data;this.textureCache[t].data=o,this.textureCache[t].texture=i}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var t=this.context.output.name;this.textureCache[t].id=this.getOuputDataTexture().id,this.textureCache[t].texture=this.getOuputDataTexture().texture}var e=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=e}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var t=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=t}},{key:"cloneDataTexture",value:function(t){var e=t.data,n=t.textureWidth;return lo(lo({},t),{},{id:ho++,texture:this.reGl.texture({width:n,height:n,data:e,type:"float"})})}},{key:"calcDataTexture",value:function(t,e,n){var r=1;e===or.AST_TOKEN_TYPES.Vector4FloatArray&&(r=4);for(var i=[],o=0;o<n.length;o+=r)1===r?i.push(n[o],0,0,0):2===r?i.push(n[o],n[o+1],0,0):3===r?i.push(n[o],n[o+1],n[o+2],0):4===r&&i.push(n[o],n[o+1],n[o+2],n[o+3]);var a=n.length,u=Math.ceil(a/r),s=Math.ceil(Math.sqrt(u)),c=s*s;u<c&&i.push.apply(i,ao()(new Array(4*(c-u)).fill(0)));var f=this.reGl.texture({width:s,height:s,data:i,type:"float"});return{id:ho++,data:i,originalDataLength:a,typedArrayConstructor:co(n)?n.constructor:void 0,textureWidth:s,texture:f,texelCount:u,elementsPerTexel:r,isOutput:t===this.context.output.name}}}]),t}(),mo=function(){function t(e,n){tr()(this,t),this.elements=void 0;var r=n.data,i=n.usage,o=n.type,a=n.count;this.elements=e.elements({data:r,usage:Hi[i||or.gl.STATIC_DRAW],type:qi[o||or.gl.UNSIGNED_BYTE],count:a})}return nr()(t,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(t){var e=t.data;this.elements.subdata(e)}},{key:"destroy",value:function(){this.elements.destroy()}}]),t}(),vo=function(){function t(e,n){tr()(this,t),this.framebuffer=void 0;var r=n.width,i=n.height,o=n.color,a=n.colors,u=(n.depth,n.stencil,{width:r,height:i});Array.isArray(a)&&(u.colors=a.map((function(t){return t.get()}))),o&&"boolean"!=typeof o&&(u.color=o.get()),this.framebuffer=e.framebuffer(u)}return nr()(t,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(t){var e=t.width,n=t.height;this.framebuffer.resize(e,n)}}]),t}();function go(t){var e={};return Object.keys(t).forEach((function(n){!function t(e,n,r,i){if(null===n||"number"==typeof n||"boolean"==typeof n||Array.isArray(n)&&"number"==typeof n[0]||co(n)||""===n||void 0!==n.resize)return void(r["".concat(i&&i+".").concat(e)]=n);o=n,a=Wr()(o),null==o||"object"!==a&&"function"!==a||Object.keys(n).forEach((function(o){t(o,n[o],r,"".concat(i&&i+".").concat(e))}));var o,a;Array.isArray(n)&&n.forEach((function(n,o){Object.keys(n).forEach((function(a){t(a,n[a],r,"".concat(i&&i+".").concat(e,"[").concat(o,"]"))}))}))}(n,t[n],e,"")})),e}function yo(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function bo(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?yo(Object(n),!0).forEach((function(e){Fr()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yo(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var _o,Eo,wo=function(){function t(e,n){tr()(this,t),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=e;var r=n.vs,i=n.fs,o=n.defines,a=n.attributes,u=n.uniforms,s=n.primitive,c=n.count,f=n.elements,l=n.depth,h=n.blend,d=n.stencil,p=n.cull,m=n.instances,v=n.scissor,g=n.viewport,y={};u&&(this.uniforms=go(u),Object.keys(u).forEach((function(t){y[t]=e.prop(t)})));var b={};Object.keys(a).forEach((function(t){b[t]=a[t].get()}));var _=o&&this.generateDefines(o)||"",E={attributes:b,frag:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n#else\n precision mediump float;\n#endif\n".concat(_,"\n").concat(i),uniforms:y,vert:"\n".concat(_,"\n").concat(r),primitive:Wi[void 0===s?or.gl.TRIANGLES:s]};m&&(E.instances=m),c&&(E.count=c),f&&(E.elements=f.get()),v&&(E.scissor=v),g&&(E.viewport=g),this.initDepthDrawParams({depth:l},E),this.initBlendDrawParams({blend:h},E),this.initStencilDrawParams({stencil:d},E),this.initCullDrawParams({cull:p},E),this.drawCommand=e(E)}return nr()(t,[{key:"addUniforms",value:function(t){this.uniforms=bo(bo({},this.uniforms),go(t))}},{key:"draw",value:function(t){var e=bo(bo({},this.uniforms),go(t.uniforms||{})),n={};Object.keys(e).forEach((function(t){var r=Wr()(e[t]);"boolean"===r||"number"===r||Array.isArray(e[t])||e[t].BYTES_PER_ELEMENT?n[t]=e[t]:"string"===r||(n[t]=e[t].get())})),this.drawCommand(n)}},{key:"destroy",value:function(){}},{key:"initDepthDrawParams",value:function(t,e){var n=t.depth;n&&(e.depth={enable:void 0===n.enable||!!n.enable,mask:void 0===n.mask||!!n.mask,func:Zi[n.func||or.gl.LESS],range:n.range||[0,1]})}},{key:"initBlendDrawParams",value:function(t,e){var n=t.blend;if(n){var r=n.enable,i=n.func,o=n.equation,a=n.color,u=void 0===a?[0,0,0,0]:a;e.blend={enable:!!r,func:{srcRGB:to[i&&i.srcRGB||or.gl.SRC_ALPHA],srcAlpha:to[i&&i.srcAlpha||or.gl.SRC_ALPHA],dstRGB:to[i&&i.dstRGB||or.gl.ONE_MINUS_SRC_ALPHA],dstAlpha:to[i&&i.dstAlpha||or.gl.ONE_MINUS_SRC_ALPHA]},equation:{rgb:Ji[o&&o.rgb||or.gl.FUNC_ADD],alpha:Ji[o&&o.alpha||or.gl.FUNC_ADD]},color:u}}}},{key:"initStencilDrawParams",value:function(t,e){var n=t.stencil;if(n){var r=n.enable,i=n.mask,o=void 0===i?-1:i,a=n.func,u=void 0===a?{cmp:or.gl.ALWAYS,ref:0,mask:-1}:a,s=n.opFront,c=void 0===s?{fail:or.gl.KEEP,zfail:or.gl.KEEP,zpass:or.gl.KEEP}:s,f=n.opBack,l=void 0===f?{fail:or.gl.KEEP,zfail:or.gl.KEEP,zpass:or.gl.KEEP}:f;e.stencil={enable:!!r,mask:o,func:bo(bo({},u),{},{cmp:eo[u.cmp]}),opFront:{fail:no[c.fail],zfail:no[c.zfail],zpass:no[c.zpass]},opBack:{fail:no[l.fail],zfail:no[l.zfail],zpass:no[l.zpass]}}}}},{key:"initCullDrawParams",value:function(t,e){var n=t.cull;if(n){var r=n.enable,i=n.face,o=void 0===i?or.gl.BACK:i;e.cull={enable:!!r,face:ro[o]}}}},{key:"generateDefines",value:function(t){return Object.keys(t).map((function(e){return"#define ".concat(e," ").concat(Number(t[e]))})).join("\n")}}]),t}(),xo=function(){function t(e,n){tr()(this,t),this.texture=void 0,this.width=void 0,this.height=void 0;var r=n.data,i=n.type,o=void 0===i?or.gl.UNSIGNED_BYTE:i,a=n.width,u=n.height,s=n.flipY,c=void 0!==s&&s,f=n.format,l=void 0===f?or.gl.RGBA:f,h=n.mipmap,d=void 0!==h&&h,p=n.wrapS,m=void 0===p?or.gl.CLAMP_TO_EDGE:p,v=n.wrapT,g=void 0===v?or.gl.CLAMP_TO_EDGE:v,y=n.aniso,b=void 0===y?0:y,_=n.alignment,E=void 0===_?1:_,w=n.premultiplyAlpha,x=void 0!==w&&w,T=n.mag,A=void 0===T?or.gl.NEAREST:T,S=n.min,R=void 0===S?or.gl.NEAREST:S,O=n.colorSpace,C=void 0===O?or.gl.BROWSER_DEFAULT_WEBGL:O;this.width=a,this.height=u;var M={width:a,height:u,type:qi[o],format:Xi[l],wrapS:Qi[m],wrapT:Qi[g],mag:Ki[A],min:Ki[R],alignment:E,flipY:c,colorSpace:$i[C],premultiplyAlpha:x,aniso:b};r&&(M.data=r),"number"==typeof d?M.mipmap=Yi[d]:"boolean"==typeof d&&(M.mipmap=d),this.texture=e.texture(M)}return nr()(t,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(t){var e=t.width,n=t.height;this.texture.resize(e,n),this.width=e,this.height=n}},{key:"destroy",value:function(){this.texture.destroy()}}]),t}(),To=Object(ur.injectable)()(_o=function(){function t(){var e=this;tr()(this,t),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var t=Lr()(kr.a.mark((function t(n){return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n.uniforms){t.next=3;break}return t.next=3,Promise.all(Object.keys(n.uniforms).map(function(){var t=Lr()(kr.a.mark((function t(e){var r;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n.uniforms[e]||void 0===n.uniforms[e].load){t.next=5;break}return t.next=3,n.uniforms[e].load();case 3:r=t.sent,n.uniforms[e]=r;case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:return t.abrupt("return",new wo(e.gl,n));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new zi(e.gl,t)},this.createBuffer=function(t){return new io(e.gl,t)},this.createElements=function(t){return new mo(e.gl,t)},this.createTexture2D=function(t){return new xo(e.gl,t)},this.createFramebuffer=function(t){return new vo(e.gl,t)},this.useFramebuffer=function(t,n){e.gl({framebuffer:t?t.get():null})(n)},this.createComputeModel=function(){var t=Lr()(kr.a.mark((function t(n){return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new po(e.gl,n));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.clear=function(t){var n=t.color,r=t.depth,i=t.stencil,o=t.framebuffer,a=void 0===o?null:o,u={color:n,depth:r,stencil:i};u.framebuffer=null===a?a:a.get(),e.gl.clear(u)},this.setScissor=function(t){e.gl&&e.gl._gl&&(t.enable&&t.box?(e.gl._gl.enable(or.gl.SCISSOR_TEST),e.gl._gl.scissor(t.box.x,t.box.y,t.box.width,t.box.height)):e.gl._gl.disable(or.gl.SCISSOR_TEST),e.gl._refresh())},this.viewport=function(t){var n=t.x,r=t.y,i=t.width,o=t.height;e.gl&&e.gl._gl&&(e.gl._gl.viewport(n,r,i,o),e.gl._refresh())},this.readPixels=function(t){var n=t.framebuffer,r={x:t.x,y:t.y,width:t.width,height:t.height};return n&&(r.framebuffer=n.get()),e.gl.read(r)},this.getCanvas=function(){return e.$canvas},this.getGLContext=function(){return e.gl._gl},this.destroy=function(){e.gl&&(e.gl.destroy(),e.inited=!1)}}var e;return nr()(t,[{key:"init",value:(e=Lr()(kr.a.mark((function t(e){return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.inited){t.next=2;break}return t.abrupt("return");case 2:return this.$canvas=e.canvas,t.next=5,new Promise((function(t,n){Vi()({canvas:e.canvas,attributes:{alpha:!0,antialias:e.antialias,premultipliedAlpha:!0},pixelRatio:1,extensions:["OES_element_index_uint","OES_texture_float","OES_standard_derivatives","angle_instanced_arrays"],optionalExtensions:["EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture"],profile:!0,onDone:function(e,r){!e&&r||n(e),t(r)}})}));case 5:this.gl=t.sent,this.inited=!0;case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),t}())||_o;function Ao(t,e,n,r){if("undefined"!=typeof window){var i=document.getElementsByTagName("head")[0],o=document.createElement("script");o.setAttribute("type","text/javascript"),o.setAttribute("src",t),r&&(o.id=r),o.onload=function(){e&&e()},o.onerror=function(e){n&&n("Unable to load script '".concat(t,"'"),e)},i.appendChild(o)}}function So(t,e){return new Promise((function(e,n){Ao(t,(function(){e()}),(function(t,e){n(e)}))}))}var Ro=function(){return Oo.apply(this,arguments)};function Oo(){return(Oo=Lr()(kr.a.mark((function t(){return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!Eo){t.next=2;break}return t.abrupt("return",Eo);case 2:return t.next=4,So("https://preview.babylonjs.com/glslang/glslang.js");case 4:return Eo=window.glslang("https://preview.babylonjs.com/glslang/glslang.wasm"),t.abrupt("return",Eo);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Co=function(){function t(e,n){tr()(this,t),this.engine=e,this.options=n,this.attribute=void 0,this.buffer=void 0;var r=n,i=r.buffer,o=r.offset,a=r.stride,u=r.normalized,s=r.size,c=r.divisor,f=r.arrayStride,l=r.attributes,h=r.stepMode;this.buffer=i,this.attribute={buffer:i.get(),offset:o||0,stride:a||0,normalized:u||!1,divisor:c||0,arrayStride:f||0,attributes:l,stepMode:h||"vertex"},s&&(this.attribute.size=s)}return nr()(t,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),Mo=function(){function t(e,n){tr()(this,t),this.engine=e,this.options=n,this.buffer=void 0;var r=n,i=r.data,o=r.usage;r.type;this.buffer=this.createBuffer(i instanceof Array?new Float32Array(i):i,o||Br.BufferUsage.Vertex|Br.BufferUsage.CopyDst)}return nr()(t,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){this.buffer.destroy()}},{key:"subData",value:function(t){var e=t.data,n=t.offset;this.setSubData(this.buffer,n,e instanceof Array?new Float32Array(e):e)}},{key:"createBuffer",value:function(t,e){var n=t.byteLength%4,r={size:t.byteLength+n,usage:e},i=this.engine.device.createBuffer(r);return this.setSubData(i,0,t),i}},{key:"setSubData",value:function(t,e,n){(or.isSafari?this.engine.device.getQueue():this.engine.device.defaultQueue).writeBuffer(t,e,n)}}]),t}();var Io,No,Po,ko,Do,Lo,jo,Fo=function(){function t(e,n){tr()(this,t),this.engine=e,this.context=n,this.entity=Object(or.createEntity)(),this.uniformGPUBufferLayout=[],this.uniformBuffer=void 0,this.vertexBuffers={},this.outputBuffer=void 0,this.bindGroupEntries=void 0,this.bindGroup=void 0,this.computePipeline=void 0}var e,n,r;return nr()(t,[{key:"init",value:(r=Lr()(kr.a.mark((function t(){var e,n,r,i,o,a,u,s=this;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.compileComputePipelineStageDescriptor(this.context.shader);case 2:e=t.sent,n=e.computeStage,r=this.context.uniforms.filter((function(t){return t.storageClass===or.STORAGE_CLASS.StorageBuffer})),i=this.context.uniforms.filter((function(t){return t.storageClass===or.STORAGE_CLASS.Uniform})),o=i.length?1:0,this.bindGroupEntries=[],o&&(a=0,u=[],i.forEach((function(t){if("number"==typeof t.data)s.uniformGPUBufferLayout.push({name:t.name,offset:a}),a+=4,u.push(t.data);else{var e,n=(null===(e=t.data)||void 0===e?void 0:e.length)||1;3===n&&(n=4,t.data.push(0));var r=a/4%4;if(r>0){var i=4-r;if(n>1&&n<=i)2===n&&(3===i&&(a+=4,u.push(0)),u.push.apply(u,ao()(t.data)),s.uniformGPUBufferLayout.push({name:t.name,offset:a}));else{for(var o=0;o<i;o++)a+=4,u.push(0);u.push.apply(u,ao()(t.data)),s.uniformGPUBufferLayout.push({name:t.name,offset:a})}}a+=4*n}})),this.uniformBuffer=new Mo(this.engine,{data:u instanceof Array?new Float32Array(u):u,usage:Br.BufferUsage.Uniform|Br.BufferUsage.CopyDst}),this.bindGroupEntries.push({binding:0,resource:{buffer:this.uniformBuffer.get()}})),r.forEach((function(t){var e;null!==t.data&&(t.type!==or.AST_TOKEN_TYPES.Vector4FloatArray&&t.type!==or.AST_TOKEN_TYPES.FloatArray||(t.name===s.context.output.name?(e=new Mo(s.engine,{data:isFinite(Number(t.data))?[t.data]:t.data,usage:Br.BufferUsage.Storage|Br.BufferUsage.CopyDst|Br.BufferUsage.CopySrc}),s.outputBuffer=e,s.context.output={name:t.name,length:isFinite(Number(t.data))?1:t.data.length,typedArrayConstructor:Float32Array,gpuBuffer:e.get()}):t.isReferer?t.data.model&&t.data.model.outputBuffer&&(e=t.data.model.outputBuffer):e=new Mo(s.engine,{data:isFinite(Number(t.data))?[t.data]:t.data,usage:Br.BufferUsage.Storage|Br.BufferUsage.CopyDst|Br.BufferUsage.CopySrc}),s.vertexBuffers[t.name]=e,s.bindGroupEntries.push({binding:o,resource:{name:t.name,refer:e?void 0:t.data,buffer:e?e.get():void 0}}),o++))})),this.computePipeline=this.engine.device.createComputePipeline({computeStage:n}),console.log(this.bindGroupEntries),this.bindGroup=this.engine.device.createBindGroup({layout:this.computePipeline.getBindGroupLayout(0),entries:this.bindGroupEntries});case 13:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"destroy",value:function(){var t=this;this.uniformBuffer&&this.uniformBuffer.destroy(),Object.keys(this.vertexBuffers).forEach((function(e){return t.vertexBuffers[e].destroy()}))}},{key:"readData",value:(n=Lr()(kr.a.mark((function t(){var e,n,r,i,o,a,u,s,c;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=this.context.output)){t.next=16;break}if(n=e.length,r=e.typedArrayConstructor,!(i=e.gpuBuffer)){t.next=16;break}return o=n*r.BYTES_PER_ELEMENT,a=this.engine.device.createBuffer({size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),(u=this.engine.device.createCommandEncoder()).copyBufferToBuffer(i,0,a,0,o),(or.isSafari?this.engine.device.getQueue():this.engine.device.defaultQueue).submit([u.finish()]),t.next=12,a.mapAsync(Br.MapMode.Read);case 12:return s=a.getMappedRange(),c=new r(s.slice(0)),a.unmap(),t.abrupt("return",c);case 16:return t.abrupt("return",new Float32Array);case 17:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"run",value:function(){var t;this.engine.currentComputePass&&(this.engine.currentComputePass.setPipeline(this.computePipeline),this.engine.currentComputePass.setBindGroup(0,this.bindGroup),(t=this.engine.currentComputePass).dispatch.apply(t,ao()(this.context.dispatch)))}},{key:"updateBuffer",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.vertexBuffers[t];r&&r.subData({data:e,offset:n})}},{key:"updateUniform",value:function(t,e){var n=this.uniformGPUBufferLayout.find((function(e){return e.name===t}));n&&this.uniformBuffer.subData({data:Number.isFinite(e)?new Float32Array([e]):new Float32Array(e),offset:n.offset})}},{key:"confirmInput",value:function(t,e){var n=this.vertexBuffers[e],r=t.outputBuffer;if(n&&r&&n!==r){var i=this.engine.device.createCommandEncoder(),o=t.context.output,a=o.length*o.typedArrayConstructor.BYTES_PER_ELEMENT;i.copyBufferToBuffer(r.get(),0,n.get(),0,a),(or.isSafari?this.engine.device.getQueue():this.engine.device.defaultQueue).submit([i.finish()])}}},{key:"compileShaderToSpirV",value:function(t,e,n){return this.compileRawShaderToSpirV(n+t,e)}},{key:"compileRawShaderToSpirV",value:function(t,e){return this.engine.glslang.compileGLSL(t,e)}},{key:"compileComputePipelineStageDescriptor",value:(e=Lr()(kr.a.mark((function t(e){var n;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e,this.engine.options.useWGSL){t.next=6;break}return t.next=5,this.compileShaderToSpirV(e,"compute","#version 450\n");case 5:n=t.sent;case 6:return t.abrupt("return",{computeStage:{module:this.engine.device.createShaderModule({code:n,isWHLSL:or.isSafari}),entryPoint:"main"}});case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),Bo=function(){function t(e,n){tr()(this,t),this.engine=e,this.options=n,this.indexCount=void 0,this.buffer=void 0;var r=n,i=r.data,o=(r.usage,r.type,r.count);this.indexCount=o||0,this.buffer=new Mo(e,{data:i instanceof Array?new Uint16Array(i):i,usage:Br.BufferUsage.Index|Br.BufferUsage.CopyDst})}return nr()(t,[{key:"get",value:function(){return this.buffer}},{key:"subData",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),Uo=function(){function t(e,n){tr()(this,t),this.engine=e,this.options=n,this.colorTexture=void 0,this.depthTexture=void 0,this.width=0,this.height=0;var r=n,i=(r.width,r.height,r.color),o=(r.colors,r.depth);r.stencil;i&&(this.colorTexture=i),o&&(this.depthTexture=o)}return nr()(t,[{key:"get",value:function(){var t,e;return{color:null===(t=this.colorTexture)||void 0===t?void 0:t.get(),depth:null===(e=this.depthTexture)||void 0===e?void 0:e.get()}}},{key:"destroy",value:function(){var t,e;null===(t=this.colorTexture)||void 0===t||t.destroy(),null===(e=this.depthTexture)||void 0===e||e.destroy()}},{key:"resize",value:function(t){var e,n,r=t.width,i=t.height;r===this.width&&i===this.height||(null===(e=this.colorTexture)||void 0===e||e.resize({width:r,height:i}),null===(n=this.depthTexture)||void 0===n||n.resize({width:r,height:i}));this.width=r,this.height=i}}]),t}(),Go=(Io={},Fr()(Io,or.gl.POINTS,Br.PrimitiveTopology.PointList),Fr()(Io,or.gl.LINES,Br.PrimitiveTopology.LineList),Fr()(Io,or.gl.LINE_LOOP,Br.PrimitiveTopology.LineList),Fr()(Io,or.gl.LINE_STRIP,Br.PrimitiveTopology.LineStrip),Fr()(Io,or.gl.TRIANGLES,Br.PrimitiveTopology.TriangleList),Fr()(Io,or.gl.TRIANGLE_FAN,Br.PrimitiveTopology.TriangleList),Fr()(Io,or.gl.TRIANGLE_STRIP,Br.PrimitiveTopology.TriangleStrip),Io),Vo=(No={},Fr()(No,or.gl.NEVER,Br.CompareFunction.Never),Fr()(No,or.gl.ALWAYS,Br.CompareFunction.Always),Fr()(No,or.gl.LESS,Br.CompareFunction.Less),Fr()(No,or.gl.LEQUAL,Br.CompareFunction.LessEqual),Fr()(No,or.gl.GREATER,Br.CompareFunction.Greater),Fr()(No,or.gl.GEQUAL,Br.CompareFunction.GreaterEqual),Fr()(No,or.gl.EQUAL,Br.CompareFunction.Equal),Fr()(No,or.gl.NOTEQUAL,Br.CompareFunction.NotEqual),No),zo=(Po={},Fr()(Po,or.gl.FUNC_ADD,Br.BlendOperation.Add),Fr()(Po,or.gl.MIN_EXT,Br.BlendOperation.Min),Fr()(Po,or.gl.MAX_EXT,Br.BlendOperation.Max),Fr()(Po,or.gl.FUNC_SUBTRACT,Br.BlendOperation.Subtract),Fr()(Po,or.gl.FUNC_REVERSE_SUBTRACT,Br.BlendOperation.ReverseSubtract),Po),Wo=(ko={},Fr()(ko,or.gl.ZERO,Br.BlendFactor.Zero),Fr()(ko,or.gl.ONE,Br.BlendFactor.One),Fr()(ko,or.gl.SRC_COLOR,Br.BlendFactor.SrcColor),Fr()(ko,or.gl.ONE_MINUS_SRC_COLOR,Br.BlendFactor.OneMinusSrcColor),Fr()(ko,or.gl.SRC_ALPHA,Br.BlendFactor.SrcAlpha),Fr()(ko,or.gl.ONE_MINUS_SRC_ALPHA,Br.BlendFactor.OneMinusSrcAlpha),Fr()(ko,or.gl.DST_COLOR,Br.BlendFactor.DstColor),Fr()(ko,or.gl.ONE_MINUS_DST_COLOR,Br.BlendFactor.OneMinusDstColor),Fr()(ko,or.gl.DST_ALPHA,Br.BlendFactor.DstAlpha),Fr()(ko,or.gl.ONE_MINUS_DST_ALPHA,Br.BlendFactor.OneMinusDstAlpha),Fr()(ko,or.gl.CONSTANT_COLOR,Br.BlendFactor.BlendColor),Fr()(ko,or.gl.ONE_MINUS_CONSTANT_COLOR,Br.BlendFactor.OneMinusBlendColor),Fr()(ko,or.gl.SRC_ALPHA_SATURATE,Br.BlendFactor.SrcAlphaSaturated),ko),Ho=(Do={},Fr()(Do,or.gl.ALPHA,"r8unorm"),Fr()(Do,or.gl.RGBA,"rgba8unorm"),Fr()(Do,or.gl.DEPTH_COMPONENT,"depth32float"),Fr()(Do,or.gl.DEPTH_STENCIL,"depth24plus-stencil8"),Do),qo=(Lo={},Fr()(Lo,or.gl.NEAREST,"nearest"),Fr()(Lo,or.gl.LINEAR,"linear"),Lo),Xo=(jo={},Fr()(jo,or.gl.REPEAT,"repeat"),Fr()(jo,or.gl.CLAMP_TO_EDGE,"clamp-to-edge"),Fr()(jo,or.gl.MIRRORED_REPEAT,"mirror-repeat"),jo);function Yo(t){var e=t.cull;return e&&e.enable?e.face?e.face===or.gl.FRONT?Br.CullMode.Front:Br.CullMode.Back:void 0:Br.CullMode.None}function Ko(t){var e=t.depth,n=(t.stencil,{compare:Br.CompareFunction.Always,depthFailOp:Br.StencilOperation.Keep,failOp:Br.StencilOperation.Keep,passOp:Br.StencilOperation.Keep});return{depthWriteEnabled:e&&e.enable,depthCompare:Vo[(null==e?void 0:e.func)||or.gl.ALWAYS],format:Br.TextureFormat.Depth24PlusStencil8,stencilFront:n,stencilBack:n,stencilReadMask:4294967295,stencilWriteMask:4294967295}}function Qo(t,e){var n=t.blend;return[{format:e,alphaBlend:{srcFactor:Wo[n&&n.func&&n.func.srcAlpha||or.gl.ONE],dstFactor:Wo[n&&n.func&&n.func.dstAlpha||or.gl.ZERO],operation:zo[n&&n.equation&&n.equation.alpha||or.gl.FUNC_ADD]},colorBlend:{srcFactor:Wo[n&&n.func&&n.func.srcRGB||or.gl.ONE],dstFactor:Wo[n&&n.func&&n.func.dstRGB||or.gl.ZERO],operation:zo[n&&n.equation&&n.equation.rgb||or.gl.FUNC_ADD]},writeMask:Br.ColorWrite.All}]}function $o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Zo(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?$o(Object(n),!0).forEach((function(e){Fr()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Jo(t){for(var e=0,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=0,a=r;o<a.length;o++){var u=a[o];e+=u.length}for(var s=new t(e),c=0,f=0,l=r;f<l.length;f++){var h=l[f];s.set(h,c),c+=h.length}return s}var ta,ea,na=function(){function t(e,n){tr()(this,t),this.engine=e,this.options=n,this.pipelineLayout=void 0,this.renderPipeline=void 0,this.uniformsBindGroupLayout=void 0,this.uniformBindGroup=void 0,this.uniformBuffer=void 0,this.uniforms={},this.uniformGPUBufferLayout=[],this.attributeCache={},this.indexBuffer=void 0,this.indexCount=void 0}var e,n;return nr()(t,[{key:"init",value:(n=Lr()(kr.a.mark((function t(){var e,n,r,i,o,a,u,s,c,f,l,h,d,p,m,v,g=this;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.options,n=e.vs,r=e.fs,i=e.attributes,o=e.uniforms,a=e.primitive,e.count,u=e.elements,s=e.depth,c=e.blend,f=e.stencil,l=e.cull,e.instances,t.next=3,this.compilePipelineStageDescriptor(n,r,null);case 3:h=t.sent,d=h.vertexStage,p=h.fragmentStage,o&&this.buildUniformBindGroup(o),u&&(this.indexBuffer=u.get(),this.indexCount=u.indexCount),m={vertexBuffers:Object.keys(i).map((function(t,e){var n=i[t],r=n.get(),o=r.arrayStride,a=r.stepMode,u=r.attributes;return g.attributeCache[t]=n,{arrayStride:o,stepMode:a,attributes:u}}))},v={sampleCount:this.engine.mainPassSampleCount,primitiveTopology:Go[a||or.gl.TRIANGLES],rasterizationState:Zo(Zo({},this.getDefaultRasterizationStateDescriptor()),{},{cullMode:Yo({cull:l})}),depthStencilState:Ko({depth:s,stencil:f}),colorStates:Qo({blend:c},this.engine.options.swapChainFormat),layout:this.pipelineLayout,vertexStage:d,fragmentStage:p,vertexState:m},this.renderPipeline=this.engine.device.createRenderPipeline(v);case 11:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"addUniforms",value:function(t){this.uniforms=Zo(Zo({},this.uniforms),go(t))}},{key:"draw",value:function(t){var e=this,n=this.engine.getCurrentRenderPass(),r=Zo(Zo({},this.uniforms),go(t.uniforms||{})),i=[];Object.keys(r).forEach((function(t){var n=Wr()(r[t]);if("boolean"===n||"number"===n||Array.isArray(r[t])||r[t].BYTES_PER_ELEMENT){var o,a=null===(o=e.uniformGPUBufferLayout.find((function(e){return e.name===t})))||void 0===o?void 0:o.offset;null!==a&&e.uniformBuffer.subData({data:r[t],offset:a})}else{var u,s=null===(u=e.uniformGPUBufferLayout.find((function(e){return e.name===t})))||void 0===u?void 0:u.offset;if(null!==s){var c=r[t].get(),f=c.color||c,l=f.texture,h=f.sampler;h&&(i.push({binding:s,resource:h}),s++),i.push({binding:s,resource:l.createView()})}}})),this.uniformBuffer&&(i[0]={binding:0,resource:{buffer:this.uniformBuffer.get()}}),this.uniformBindGroup=this.engine.device.createBindGroup({layout:this.uniformsBindGroupLayout,entries:i}),this.renderPipeline&&n.setPipeline(this.renderPipeline),n.setBindGroup(0,this.uniformBindGroup),this.indexBuffer&&n.setIndexBuffer(this.indexBuffer.get(),Br.IndexFormat.Uint32,0),Object.keys(this.attributeCache).forEach((function(t,r){n.setVertexBuffer(0+r,e.attributeCache[t].get().buffer,0)})),this.indexBuffer?n.drawIndexed(this.indexCount,this.options.instances||1,0,0,0):n.draw(this.options.count||0,this.options.instances||0,0,0)}},{key:"destroy",value:function(){throw new Error("Method not implemented.")}},{key:"compilePipelineStageDescriptor",value:(e=Lr()(kr.a.mark((function t(e,n,r){var i,o,a;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i="#version 450\n",o=e,a=n,this.engine.options.useWGSL){t.next=10;break}return t.next=6,this.compileShaderToSpirV(e,"vertex",i);case 6:return o=t.sent,t.next=9,this.compileShaderToSpirV(n,"fragment",i);case 9:a=t.sent;case 10:return t.abrupt("return",this.createPipelineStageDescriptor(o,a));case 11:case"end":return t.stop()}}),t,this)}))),function(t,n,r){return e.apply(this,arguments)})},{key:"compileShaderToSpirV",value:function(t,e,n){return this.compileRawShaderToSpirV(n+t,e)}},{key:"compileRawShaderToSpirV",value:function(t,e){return this.engine.glslang.compileGLSL(t,e)}},{key:"createPipelineStageDescriptor",value:function(t,e){return{vertexStage:{module:this.engine.device.createShaderModule({code:t,isWHLSL:or.isSafari}),entryPoint:"main"},fragmentStage:{module:this.engine.device.createShaderModule({code:e,isWHLSL:or.isSafari}),entryPoint:"main"}}}},{key:"getDefaultRasterizationStateDescriptor",value:function(){return{frontFace:Br.FrontFace.CCW,cullMode:Br.CullMode.None,depthBias:0,depthBiasSlopeScale:0,depthBiasClamp:0}}},{key:"buildUniformBindGroup",value:function(t){var e=this,n=0,r=Jo.apply(void 0,[Float32Array].concat(ao()(Object.keys(t).map((function(r){return t[r]?(e.uniformGPUBufferLayout.push({name:r,offset:n}),n+=4*(t[r].length||1),t[r]):[]}))))),i=[],o=!1;r.length&&(o=!0,i.push({binding:0,visibility:Br.ShaderStage.Fragment|Br.ShaderStage.Vertex,type:Br.BindingType.UniformBuffer})),Object.keys(t).filter((function(e){return null===t[e]})).forEach((function(t,n){e.uniformGPUBufferLayout.push({name:t,offset:2*n+(o?1:0)}),i.push({binding:2*n+(o?1:0),visibility:Br.ShaderStage.Fragment,type:Br.BindingType.Sampler},{binding:2*n+(o?1:0)+1,visibility:Br.ShaderStage.Fragment,type:Br.BindingType.SampledTexture})})),this.uniformsBindGroupLayout=this.engine.device.createBindGroupLayout({entries:i}),this.pipelineLayout=this.engine.device.createPipelineLayout({bindGroupLayouts:[this.uniformsBindGroupLayout]}),o&&(this.uniformBuffer=new Mo(this.engine,{data:r instanceof Array?new Float32Array(r):r,usage:Br.BufferUsage.Uniform|Br.BufferUsage.CopyDst}))}}]),t}(),ra=function(){function t(e,n){tr()(this,t),this.engine=e,this.options=n,this.texture=void 0,this.sampler=void 0,this.width=void 0,this.height=void 0,this.createTexture()}return nr()(t,[{key:"get",value:function(){return{texture:this.texture,sampler:this.sampler}}},{key:"update",value:function(){}},{key:"resize",value:function(t){var e=t.width,n=t.height;e===this.width&&n===this.height||(this.destroy(),this.createTexture()),this.width=e,this.height=n}},{key:"destroy",value:function(){this.texture&&this.texture.destroy()}},{key:"createTexture",value:function(){var t=this.options,e=(t.data,t.type),n=(void 0===e&&or.gl.UNSIGNED_BYTE,t.width),r=t.height,i=(t.flipY,t.format),o=void 0===i?or.gl.RGBA:i,a=(t.mipmap,t.wrapS),u=void 0===a?or.gl.CLAMP_TO_EDGE:a,s=t.wrapT,c=void 0===s?or.gl.CLAMP_TO_EDGE:s,f=t.aniso,l=void 0===f?0:f,h=(t.alignment,t.premultiplyAlpha,t.mag),d=void 0===h?or.gl.NEAREST:h,p=t.min,m=void 0===p?or.gl.NEAREST:p,v=t.colorSpace,g=(void 0===v&&or.gl.BROWSER_DEFAULT_WEBGL,t.usage);this.width=n,this.height=r,this.texture=this.engine.device.createTexture({size:[n,r,1],mipLevelCount:1,sampleCount:1,dimension:Br.TextureDimension.E2d,format:Ho[o],usage:g||Br.TextureUsage.Sampled|Br.TextureUsage.CopyDst}),(!g||g&Br.TextureUsage.Sampled)&&(this.sampler=this.engine.device.createSampler({addressModeU:Xo[u],addressModeV:Xo[c],addressModeW:Xo[u],magFilter:qo[d],minFilter:qo[m],maxAnisotropy:l}))}}]),t}(),ia=Object(ur.injectable)()(ta=function(){function t(){var e=this;tr()(this,t),this.supportWebGPU=!0,this.useWGSL=!1,this.options=void 0,this.canvas=void 0,this.context=void 0,this.glslang=void 0,this.adapter=void 0,this.device=void 0,this.swapChain=void 0,this.mainPassSampleCount=void 0,this.mainTexture=void 0,this.depthTexture=void 0,this.mainColorAttachments=void 0,this.mainTextureExtends=void 0,this.mainDepthAttachment=void 0,this.uploadEncoder=void 0,this.renderEncoder=void 0,this.computeEncoder=void 0,this.renderTargetEncoder=void 0,this.commandBuffers=new Array(4).fill(void 0),this.currentRenderPass=null,this.mainRenderPass=null,this.currentRenderTargetViewDescriptor=void 0,this.currentComputePass=null,this.bundleEncoder=void 0,this.tempBuffers=[],this.currentRenderTarget=null,this.uploadEncoderDescriptor={label:"upload"},this.renderEncoderDescriptor={label:"render"},this.renderTargetEncoderDescriptor={label:"renderTarget"},this.computeEncoderDescriptor={label:"compute"},this.pipelines={},this.computePipelines={},this.defaultSampleCount=4,this.clearDepthValue=1,this.clearStencilValue=0,this.transientViewport={x:1/0,y:0,width:0,height:0},this.cachedViewport={x:0,y:0,width:0,height:0},this.clear=function(t){t.framebuffer;var n=t.color,r=t.depth,i=t.stencil;e.options.supportCompute&&e.startComputePass(),e.currentRenderTarget?(e.currentRenderPass&&e.endRenderTargetRenderPass(),e.startRenderTargetRenderPass(e.currentRenderTarget,n||null,!!r,!!i)):(e.mainColorAttachments[0].loadValue=n||Br.LoadOp.Load,e.mainDepthAttachment.depthLoadValue=r||Br.LoadOp.Load,e.mainDepthAttachment.stencilLoadValue=i?e.clearStencilValue:Br.LoadOp.Load,e.mainRenderPass&&e.endMainRenderPass(),e.startMainRenderPass())},this.createModel=function(){var t=Lr()(kr.a.mark((function t(n){var r;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new na(e,n),t.next=3,r.init();case 3:return t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.createAttribute=function(t){return new Co(e,t)},this.createBuffer=function(t){return new Mo(e,t)},this.createElements=function(t){return new Bo(e,t)},this.createTexture2D=function(t){return new ra(e,t)},this.createFramebuffer=function(t){return new Uo(e,t)},this.useFramebuffer=function(t,n){e.currentRenderTarget&&e.unbindFramebuffer(e.currentRenderTarget),e.currentRenderTarget=t,e.currentRenderTargetViewDescriptor={dimension:Br.TextureViewDimension.E2d,arrayLayerCount:1,aspect:Br.TextureAspect.All},e.currentRenderPass=null,n()},this.createComputeModel=function(){var t=Lr()(kr.a.mark((function t(n){var r;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Fo(e,n),t.next=3,r.init();case 3:return t.abrupt("return",r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.getCanvas=function(){return e.canvas},this.getGLContext=function(){throw new Error("Method not implemented.")},this.viewport=function(t){var n=t.x,r=t.y,i=t.width,o=t.height;if(e.currentRenderPass){if(e.transientViewport.x!==1/0){e.getCurrentRenderPass().setViewport(e.transientViewport.x,e.transientViewport.y,e.transientViewport.width,e.transientViewport.height,0,1)}else if(n!==e.cachedViewport.x||r!==e.cachedViewport.y||i!==e.cachedViewport.width||o!==e.cachedViewport.height){e.cachedViewport={x:n,y:r,width:i,height:o},e.getCurrentRenderPass().setViewport(n,r,i,o,0,1)}}else e.transientViewport={x:n,y:r,width:i,height:o}},this.readPixels=function(t){throw new Error("Method not implemented.")}}var e,n;return nr()(t,[{key:"isFloatSupported",value:function(){return!0}},{key:"init",value:(n=Lr()(kr.a.mark((function t(e){return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.canvas=e.canvas,this.options=e,this.useWGSL=!!e.useWGSL,this.mainPassSampleCount=e.antialiasing?this.defaultSampleCount:1,t.next=6,this.initGlslang();case 6:this.initContextAndSwapChain(),this.initMainAttachments();case 8:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"setScissor",value:function(t){throw new Error("Method not implemented.")}},{key:"destroy",value:function(){this.mainTexture&&this.mainTexture.destroy(),this.depthTexture&&this.depthTexture.destroy(),this.tempBuffers.forEach((function(t){return t.destroy()})),this.tempBuffers=[]}},{key:"beginFrame",value:function(){this.uploadEncoder=this.device.createCommandEncoder(this.uploadEncoderDescriptor),this.renderEncoder=this.device.createCommandEncoder(this.renderEncoderDescriptor),this.renderTargetEncoder=this.device.createCommandEncoder(this.renderTargetEncoderDescriptor),this.options.supportCompute&&(this.computeEncoder=this.device.createCommandEncoder(this.computeEncoderDescriptor))}},{key:"endFrame",value:function(){this.options.supportCompute&&this.endComputePass(),this.endMainRenderPass(),this.commandBuffers[0]=this.uploadEncoder.finish(),this.commandBuffers[1]=this.renderEncoder.finish(),this.options.supportCompute&&(this.commandBuffers[2]=this.computeEncoder.finish()),this.commandBuffers[3]=this.renderTargetEncoder.finish(),or.isSafari?this.device.getQueue().submit(this.commandBuffers.filter((function(t){return t}))):this.device.defaultQueue.submit(this.commandBuffers.filter((function(t){return t})))}},{key:"getCurrentRenderPass",value:function(){return this.currentRenderTarget&&!this.currentRenderPass?this.startRenderTargetRenderPass(this.currentRenderTarget,null,!1,!1):this.currentRenderPass||this.startMainRenderPass(),this.currentRenderPass}},{key:"initGlslang",value:(e=Lr()(kr.a.mark((function t(){var e,n;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Ro();case 2:return this.glslang=t.sent,t.next=5,null===(e=navigator)||void 0===e||null===(n=e.gpu)||void 0===n?void 0:n.requestAdapter();case 5:return this.adapter=t.sent,t.next=8,this.adapter.requestDevice();case 8:this.device=t.sent;case 9:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"initContextAndSwapChain",value:function(){this.context=this.canvas.getContext(or.isSafari?"gpu":"gpupresent"),this.swapChain=this.context.configureSwapChain({device:this.device,format:this.options.swapChainFormat,usage:Br.TextureUsage.OutputAttachment|Br.TextureUsage.CopySrc})}},{key:"initMainAttachments",value:function(){if(this.mainTextureExtends={width:this.canvas.width,height:this.canvas.height,depth:1},this.options.antialiasing){var t={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:Br.TextureDimension.E2d,format:Br.TextureFormat.BGRA8Unorm,usage:Br.TextureUsage.OutputAttachment};this.mainTexture&&this.mainTexture.destroy(),this.mainTexture=this.device.createTexture(t),this.mainColorAttachments=[{attachment:or.isSafari?this.mainTexture.createDefaultView():this.mainTexture.createView(),loadValue:[0,0,0,1],storeOp:Br.StoreOp.Store}]}else this.mainColorAttachments=[{attachment:or.isSafari?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),loadValue:[0,0,0,1],storeOp:Br.StoreOp.Store}];var e={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:Br.TextureDimension.E2d,format:or.isSafari?"depth32float-stencil8":Br.TextureFormat.Depth24PlusStencil8,usage:Br.TextureUsage.OutputAttachment};this.depthTexture&&this.depthTexture.destroy(),this.depthTexture=this.device.createTexture(e),this.mainDepthAttachment={attachment:or.isSafari?this.depthTexture.createDefaultView():this.depthTexture.createView(),depthLoadValue:this.clearDepthValue,depthStoreOp:Br.StoreOp.Store,stencilLoadValue:this.clearStencilValue,stencilStoreOp:Br.StoreOp.Store}}},{key:"startComputePass",value:function(){this.currentComputePass&&this.endComputePass(),this.currentComputePass=this.computeEncoder.beginComputePass()}},{key:"startMainRenderPass",value:function(){this.currentRenderPass&&!this.currentRenderTarget&&this.endMainRenderPass(),this.options.antialiasing?this.mainColorAttachments[0].resolveTarget=or.isSafari?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView():this.mainColorAttachments[0].attachment=or.isSafari?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),this.currentRenderPass=this.renderEncoder.beginRenderPass({colorAttachments:this.mainColorAttachments,depthStencilAttachment:this.mainDepthAttachment}),this.mainRenderPass=this.currentRenderPass,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"startRenderTargetRenderPass",value:function(t,e,n){var r,i,o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=null===(r=t.get().color)||void 0===r?void 0:r.texture;u&&(o=u.createView(this.currentRenderTargetViewDescriptor));var s,c=null===(i=t.get().depth)||void 0===i?void 0:i.texture;c&&(s=c.createView());var f=this.renderTargetEncoder.beginRenderPass({colorAttachments:[{attachment:o,loadValue:null!==e?e:Br.LoadOp.Load,storeOp:Br.StoreOp.Store}],depthStencilAttachment:c&&s?{attachment:s,depthLoadValue:n?this.clearDepthValue:Br.LoadOp.Load,depthStoreOp:Br.StoreOp.Store,stencilLoadValue:a?this.clearStencilValue:Br.LoadOp.Load,stencilStoreOp:Br.StoreOp.Store}:void 0});this.currentRenderPass=f,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"endMainRenderPass",value:function(){this.currentRenderPass===this.mainRenderPass&&null!==this.currentRenderPass&&(this.currentRenderPass.endPass(),this.resetCachedViewport(),this.currentRenderPass=null,this.mainRenderPass=null)}},{key:"endComputePass",value:function(){this.currentComputePass&&(this.currentComputePass.endPass(),this.currentComputePass=null)}},{key:"endRenderTargetRenderPass",value:function(){this.currentRenderPass&&(this.currentRenderPass.endPass(),this.resetCachedViewport())}},{key:"resetCachedViewport",value:function(){this.cachedViewport={x:0,y:0,width:0,height:0}}},{key:"unbindFramebuffer",value:function(t){this.currentRenderPass&&this.currentRenderPass!==this.mainRenderPass&&this.endRenderTargetRenderPass(),this.transientViewport.x=1/0,this.currentRenderTarget=null,this.currentRenderPass=this.mainRenderPass}}]),t}())||ta,oa=n(40),aa=n.n(oa),ua=n(15),sa=n.n(ua),ca=n(16),fa=n.n(ca),la=n(12),ha=n.n(la);function da(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ha()(t);if(e){var i=ha()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fa()(this,n)}}var pa,ma=Object(ur.injectable)()(ea=function(t){sa()(n,t);var e=da(n);function n(){return tr()(this,n),e.apply(this,arguments)}return nr()(n,[{key:"onEntityCreated",value:function(){var t=this.config,e=t.widthSegments,n=void 0===e?1:e,r=t.heightSegments,i=void 0===r?1:r,o=t.depthSegments,a=void 0===o?1:o,u=t.halfExtents,s=void 0===u?ar.d.fromValues(.5,.5,.5):u,c=n,f=i,l=a,h=aa()(s,3),d=h[0],p=h[1],m=h[2],v=[ar.d.fromValues(-d,-p,m),ar.d.fromValues(d,-p,m),ar.d.fromValues(d,p,m),ar.d.fromValues(-d,p,m),ar.d.fromValues(d,-p,-m),ar.d.fromValues(-d,-p,-m),ar.d.fromValues(-d,p,-m),ar.d.fromValues(d,p,-m)],g=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],y=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],b=1,_=2,E=3,w=4,x=5,T=[],A=[],S=[],R=[],O=[],C=0,M=function(t,e,n){var r,i,o,a;for(o=0;o<=e;o++)for(a=0;a<=n;a++){var u=ar.d.create(),s=ar.d.create(),c=ar.d.create(),f=ar.d.create();ar.d.lerp(u,v[g[t][0]],v[g[t][1]],o/e),ar.d.lerp(s,v[g[t][0]],v[g[t][2]],a/n),ar.d.sub(c,s,v[g[t][0]]),ar.d.add(f,u,c),r=o/e,i=a/n,T.push(f[0],f[1],f[2]),A.push(y[t][0],y[t][1],y[t][2]),S.push(r,i),r=.875*(r/=3)+4/64,i=.875*(i/=3)+4/64,r+=t%3/3,i+=Math.floor(t/3)/3,R.push(r,i),o<e&&a<n&&(O.push(C+n+1,C+1,C),O.push(C+n+1,C+n+2,C+1)),C++}};M(0,c,f),M(b,c,f),M(_,c,l),M(E,c,l),M(w,l,f),M(x,l,f);var I=Object(or.generateAABBFromVertices)(T),N=this.getComponent();N.indices=Uint32Array.from(O),N.aabb=I,N.vertexCount=C,N.attributes=[{dirty:!0,name:"position",data:Float32Array.from(T),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(A),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(S),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),n}(Nr))||ea;function va(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ha()(t);if(e){var i=ha()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fa()(this,n)}}var ga,ya=Object(ur.injectable)()(pa=function(t){sa()(n,t);var e=va(n);function n(){return tr()(this,n),e.apply(this,arguments)}return nr()(n,[{key:"onEntityCreated",value:function(){var t=this.config.geometries,e=void 0===t?[]:t,n=this.getComponent();n.aabb=new or.AABB;var r=[],i=[],o=0;e.forEach((function(t){var e=t.aabb,a=t.indices,u=t.vertexCount,s=t.attributes;n.aabb.add(e),n.vertexCount+=u,a&&i.push.apply(i,ao()(a.map((function(t){return t+o})))),o+=u,s.forEach((function(t,e){r[e]?t.data&&(sr(t.data)?r[e].push(t.data):ti(t.data)?r[e].data=function(t,e){if(!t&&!e)throw new Error("Please specify valid arguments for parameters a and b.");if(!e||0===e.length)return t;if(!t||0===t.length)return e;if(Object.prototype.toString.call(t)!==Object.prototype.toString.call(e))throw new Error("The types of the two arguments passed for parameters a and b do not match.");var n=new t.constructor(t.length+e.length);return n.set(t),n.set(e,t.length),n}(r[e].data,t.data):r[e].data=r[e].data.concat(t.data)):(r[e]=t,r[e].dirty=!0)}))})),n.attributes=r,n.indices=Uint32Array.from(i),n.dirty=!0}}]),n}(Nr))||pa;function ba(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ha()(t);if(e){var i=ha()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fa()(this,n)}}var _a,Ea=Object(ur.injectable)()(ga=function(t){sa()(n,t);var e=ba(n);function n(){return tr()(this,n),e.apply(this,arguments)}return nr()(n,[{key:"onEntityCreated",value:function(){for(var t=this.config,e=t.halfExtents,n=void 0===e?[.5,.5]:e,r=t.widthSegments,i=void 0===r?5:r,o=t.lengthSegments,a=void 0===o?5:o,u=[],s=[],c=[],f=[],l=0,h=0;h<=i;h++)for(var d=0;d<=a;d++){var p=-n[0]+2*n[0]*h/i,m=-(-n[1]+2*n[1]*d/a),v=h/i,g=d/a;u.push(p,0,m),s.push(0,1,0),c.push(v,g),h<i&&d<a&&(f.push(l+a+1,l+1,l),f.push(l+a+1,l+a+2,l+1)),l++}var y=Object(or.generateAABBFromVertices)(u),b=this.getComponent();b.indices=Uint32Array.from(f),b.aabb=y,b.vertexCount=l,b.attributes=[{dirty:!0,name:"position",data:Float32Array.from(u),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(s),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(c),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),n}(Nr))||ga;function wa(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ha()(t);if(e){var i=ha()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fa()(this,n)}}var xa,Ta,Aa,Sa,Ra,Oa,Ca,Ma=Object(ur.injectable)()(_a=function(t){sa()(n,t);var e=wa(n);function n(){return tr()(this,n),e.apply(this,arguments)}return nr()(n,[{key:"onEntityCreated",value:function(){for(var t=this.config,e=t.radius,n=void 0===e?.5:e,r=t.latitudeBands,i=void 0===r?16:r,o=t.longitudeBands,a=void 0===o?16:o,u=[],s=[],c=[],f=[],l=0;l<=i;l++)for(var h=l*Math.PI/i,d=Math.sin(h),p=Math.cos(h),m=0;m<=a;m++){var v=2*m*Math.PI/a-Math.PI/2,g=Math.sin(v),y=Math.cos(v)*d,b=p,_=g*d,E=1-m/a,w=1-l/i;u.push(y*n,b*n,_*n),s.push(y,b,_),c.push(E,w)}for(var x=0;x<i;++x)for(var T=0;T<a;++T){var A=x*(a+1)+T,S=A+a+1;f.push(A+1,S,A),f.push(A+1,S+1,S)}var R=Object(or.generateAABBFromVertices)(u),O=this.getComponent();O.indices=Uint32Array.from(f),O.aabb=R,O.vertexCount=u.length/3,O.attributes=[{dirty:!0,name:"position",data:Float32Array.from(u),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(s),arrayStride:12,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(c),arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),n}(Nr))||_a,Ia=n(13),Na=n.n(Ia);function Pa(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ha()(t);if(e){var i=ha()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fa()(this,n)}}var ka,Da,La,ja,Fa,Ba,Ua,Ga,Va,za,Wa,Ha=(xa=Object(ur.injectable)(),Ta=Object(ur.inject)(or.IDENTIFIER.RenderEngine),Aa=Object(ur.inject)(or.IDENTIFIER.ShaderModuleService),xa((Ra=function(t){sa()(n,t);var e=Pa(n);function n(){var t;tr()(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return t=e.call.apply(e,[this].concat(i)),Zn()(t,"engine",Oa,Na()(t)),Zn()(t,"shaderModuleService",Ca,Na()(t)),t}return nr()(n,[{key:"onEntityCreated",value:function(){var t=this.getComponent(),e=this.engine.supportWebGPU?"layout(set = 0, binding = 0) uniform Uniforms {\n vec4 color;\n mat4 projectionMatrix;\n mat4 modelViewMatrix;\n} uniforms;\n\nlayout(location = 0) in vec3 position;\n// layout(location = 1) in vec3 barycentric;\n\nlayout(location = 0) out vec4 fragColor;\n// layout(location = 1) out vec3 v_Barycentric;\n\nvoid main() {\n gl_Position = uniforms.projectionMatrix * uniforms.modelViewMatrix * vec4(position, 1.0);\n fragColor = uniforms.color;\n // v_Barycentric = barycentric;\n}":'attribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform vec4 color;\n\nvarying vec4 fragColor;\n\n#pragma include "uv.vert.declaration"\n\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n fragColor = color;\n\n #pragma include "uv.vert.main"\n}',n=this.engine.supportWebGPU?"// layout(set = 0, binding = 1) uniform WireframeUniforms {\n// float lineWidth;\n// vec4 lineColor;\n// } wireframe;\n\nlayout(location = 0) in vec4 fragColor;\n// layout(location = 1) in vec3 v_Barycentric;\n\nlayout(location = 0) out vec4 outColor;\n\n// wireframe\n// float edgeFactor() {\n// vec3 d = fwidth(v_Barycentric);\n// vec3 a3 = smoothstep(vec3(0.0), d * wireframe.lineWidth, v_Barycentric);\n// return min(min(a3.x, a3.y), a3.z);\n// }\n\nvoid main() {\n // outColor = mix(fragColor, wireframe.lineColor, (1.0 - edgeFactor()));\n outColor = fragColor;\n}":'varying vec4 fragColor;\n\n#pragma include "uv.frag.declaration"\n#pragma include "map.frag.declaration"\n\nvoid main() {\n vec4 diffuseColor = fragColor;\n\n #pragma include "map.frag.main"\n\n gl_FragColor = diffuseColor;\n}';this.shaderModuleService.registerModule("material-basic",{vs:e,fs:n});var r=this.shaderModuleService.getModule("material-basic"),i=r.vs,o=r.fs,a=r.uniforms;t.vertexShaderGLSL=i,t.fragmentShaderGLSL=o,t.setUniform(a),this.config.map&&(t.setDefines({USE_UV:1,USE_MAP:1}),t.setUniform({map:this.config.map,uvTransform:ar.a.create()}))}}]),n}(Bi),Oa=ir()(Ra.prototype,"engine",[Ta],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ca=ir()(Ra.prototype,"shaderModuleService",[Aa],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sa=Ra))||Sa);function qa(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ha()(t);if(e){var i=ha()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fa()(this,n)}}var Xa=(ka=Object(ur.injectable)(),Da=Object(ur.inject)(or.IDENTIFIER.Systems),La=Object(ur.named)(or.IDENTIFIER.MaterialSystem),ja=Object(ur.inject)(or.IDENTIFIER.Systems),Fa=Object(ur.named)(or.IDENTIFIER.GeometrySystem),Ba=Object(ur.inject)(or.IDENTIFIER.ShaderModuleService),ka((Ga=function(t){sa()(n,t);var e=qa(n);function n(){var t;tr()(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return t=e.call.apply(e,[this].concat(i)),Zn()(t,"materialSystem",Va,Na()(t)),Zn()(t,"geometrySystem",za,Na()(t)),Zn()(t,"shaderModuleService",Wa,Na()(t)),t}return nr()(n,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();r&&r.material&&("gridColor"===e?(r.material.setUniform("u_GridColor",n),r.material.setUniform("u_GridColor2",n)):"gridSize"===e&&(r.material.setUniform("u_GridSize",n),r.material.setUniform("u_GridSize2",n)))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:"attribute vec3 a_Position;\n\nvarying vec3 v_Position;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvoid main() {\n v_Position = a_Position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(a_Position, 1.);\n}",fs:"// generate grid, borrow from clay.gl viewer\n// @see https://github.com/pissang/clay-viewer/blob/master/src/graphic/ground.glsl\n#extension GL_OES_standard_derivatives : enable\n\nvarying vec3 v_Position;\n// varying vec3 v_Normal;\n\nuniform float u_GridSize : 5;\nuniform float u_GridSize2 : .5;\nuniform vec4 u_GridColor : [0, 0, 0, 1];\nuniform vec4 u_GridColor2 : [0.3, 0.3, 0.3, 1];\nuniform bool u_GridEnabled : true;\n\n// uniform vec3 u_LightDirection;\n// uniform vec3 u_LightColor;\n// uniform vec3 u_Camera;\n\nvoid main() {\n // vec3 n = v_Normal;\n // vec3 l = normalize(u_LightDirection);\n // float NdotL = clamp(dot(n, l), 0.001, 1.0);\n\n gl_FragColor = vec4(1.);\n\n if (u_GridEnabled) {\n float wx = v_Position.x;\n float wz = v_Position.z;\n // float x0 = abs(fract(wx / u_GridSize - 0.5) - 0.5) / fwidth(wx) * u_GridSize / 2.0;\n // float z0 = abs(fract(wz / u_GridSize - 0.5) - 0.5) / fwidth(wz) * u_GridSize / 2.0;\n\n float x1 = abs(fract(wx / u_GridSize2 - 0.5) - 0.5) / fwidth(wx) * u_GridSize2;\n float z1 = abs(fract(wz / u_GridSize2 - 0.5) - 0.5) / fwidth(wz) * u_GridSize2;\n\n // float v0 = 1.0 - clamp(min(x0, z0), 0.0, 1.0);\n float v1 = 1.0 - clamp(min(x1, z1), 0.0, 1.0);\n // if (v0 > 0.1) {\n // gl_FragColor = mix(gl_FragColor, u_GridColor, v0);\n // }\n // else {\n gl_FragColor = mix(gl_FragColor, u_GridColor2, v1);\n // }\n }\n\n // float shadowFactor = calcShadow(u_ShadowMap, v_PositionFromLight, l, n);\n // vec3 diffuseColor = u_LightColor * NdotL * shadowFactor;\n\n // gl_FragColor.rgb *= diffuseColor;\n}"});var t=this.shaderModuleService.getModule("grid"),e=t.vs,n=t.fs,r=t.uniforms,i=this.materialSystem.createShaderMaterial({vertexShader:e,fragmentShader:n});this.setMaterial(i);var o=this.geometrySystem.createBufferGeometry({vertexCount:4});this.setGeometry(o),i.setCull({enable:!1,face:or.gl.BACK}).setDepth({enable:!0,func:or.gl.LESS}),i.setUniform(r),this.setAttributes({gridColor:this.config.gridColor,gridSize:this.config.gridSize}),o.setIndex([0,3,2,2,1,0]),o.setAttribute("a_Position",Float32Array.from([-4,-1,-4,4,-1,-4,4,-1,4,-4,-1,4]),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})}}]),n}(Ui),Va=ir()(Ga.prototype,"materialSystem",[Da,La],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),za=ir()(Ga.prototype,"geometrySystem",[ja,Fa],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Wa=ir()(Ga.prototype,"shaderModuleService",[Ba],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ua=Ga))||Ua),Ya=n(56),Ka=n(41);function Qa(t,e,n,r,i){$a(e,r,-i),$a(e,r,i),t.push(n),t.push(n)}function $a(t,e,n){t.push([[e[0],e[1]],n])}var Za,Ja,tu,eu,nu,ru,iu,ou,au,uu,su;function cu(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ha()(t);if(e){var i=ha()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fa()(this,n)}}var fu,lu,hu,du,pu,mu,vu,gu,yu,bu,_u,Eu=(Za=Object(ur.injectable)(),Ja=Object(ur.inject)(or.IDENTIFIER.Systems),tu=Object(ur.named)(or.IDENTIFIER.MaterialSystem),eu=Object(ur.inject)(or.IDENTIFIER.Systems),nu=Object(ur.named)(or.IDENTIFIER.GeometrySystem),ru=Object(ur.inject)(or.IDENTIFIER.ShaderModuleService),Za((ou=function(t){sa()(n,t);var e=cu(n);function n(){var t;tr()(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return t=e.call.apply(e,[this].concat(i)),Zn()(t,"materialSystem",au,Na()(t)),Zn()(t,"geometrySystem",uu,Na()(t)),Zn()(t,"shaderModuleService",su,Na()(t)),t.vertexCount=void 0,t}return nr()(n,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();if(r&&r.material)switch(e){case"dashArray":r.material.setUniform("u_dash_array",n);break;case"dashOffset":r.material.setUniform("u_dash_offset",n);break;case"dashRatio":r.material.setUniform("u_dash_ratio",n);break;case"thickness":r.material.setUniform("u_thickness",n);break;case"color":var i=new Array(this.vertexCount).fill(void 0).map((function(){return n})).reduce((function(t,e){return[].concat(ao()(t),ao()(e))}),[]);r.geometry.setAttribute("a_color",Float32Array.from(i),{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]})}}},{key:"onEntityCreated",value:function(){var t=this;this.shaderModuleService.registerModule("line",{vs:"attribute vec2 a_pos;\nattribute vec4 a_color;\nattribute float a_line_miter;\nattribute vec2 a_line_normal;\nattribute float a_counters;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform float u_thickness : 0.02;\nuniform vec2 u_viewport;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_counters;\n\nvoid main() {\n v_color = a_color;\n v_counters = a_counters;\n\n vec3 normal = normalize(vec3(a_line_normal, 0.0));\n\n vec4 offset = vec4(normal * u_thickness / 2.0 * a_line_miter, 0.0);\n\n v_normal = vec2(normal * sign(a_line_miter));\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4(a_pos, 0.0, 1.0) + offset;\n}\n",fs:"uniform float u_dash_array : 0.02;\nuniform float u_dash_offset : 0;\nuniform float u_dash_ratio : 0;\nuniform float u_thickness : 0.02;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_counters;\n\nvoid main() {\n float blur = 1. - smoothstep(0.98, 1., length(v_normal));\n\n gl_FragColor = v_color;\n gl_FragColor.a *= blur * ceil(mod(v_counters + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));\n}"});var e=this.shaderModuleService.getModule("line"),n=e.vs,r=e.fs,i=e.uniforms,o=this.materialSystem.createShaderMaterial({vertexShader:n,fragmentShader:r}),a=function(t,e,n){var r=[0,0],i=[0,0],o=[0,0],a=[0,0],u=-1,s=!1,c=null,f=Object(Ya.create)(),l=n||0,h=[],d=[],p=[],m=[0,0];e&&(t=t.slice()).push(t[0]);for(var v=t.length,g=1;g<v;g++){var y=l,b=t[g-1],_=t[g],E=g<t.length-1?t[g+1]:null;if(m.push(g/v,g/v),Object(Ka.direction)(r,_,b),c||(c=[0,0],Object(Ka.normal)(c,r)),s||(s=!0,Qa(d,h,b,c,1)),p.push([y+0,y+1,y+2]),E){Object(Ka.direction)(i,E,_);var w=Object(Ka.computeMiter)(o,a,r,i,1),x=Object(Ya.dot)(o,c)<0?-1:1,T=w>3;if(!isFinite(w)){Object(Ka.normal)(c,r),Qa(d,h,_,c,1),p.push(1===u?[y,y+2,y+3]:[y+2,y+1,y+3]),l+=2,u=x;continue}T?(w=3,m.push(g/v),$a(h,c,-x),d.push(_),$a(h,a,w*x),d.push(_),p.push(u!==-x?[y,y+2,y+3]:[y+2,y+1,y+3]),p.push([y+2,y+3,y+4]),Object(Ka.normal)(f,i),Object(Ya.copy)(c,f),$a(h,c,-x),d.push(_),l+=3):(Qa(d,h,_,a,w),p.push(1===u?[y,y+2,y+3]:[y+2,y+1,y+3]),x=-1,Object(Ya.copy)(c,a),l+=2),u=x}else Object(Ka.normal)(c,r),Qa(d,h,_,c,1),p.push(1===u?[y,y+2,y+3]:[y+2,y+1,y+3]),l+=2}return{normals:h,attrIndex:p,attrPos:d,attrCounters:m}}(this.config.points,!1),u=a.normals,s=a.attrIndex,c=a.attrPos,f=a.attrCounters,l=c.length;this.vertexCount=l;var h=this.geometrySystem.createBufferGeometry({vertexCount:l});this.setMaterial(o),this.setGeometry(h),o.setCull({enable:!1,face:or.gl.BACK}).setUniform(i),this.setAttributes({dashArray:this.config.dashArray,dashOffset:this.config.dashOffset,dashRatio:this.config.dashRatio,thickness:this.config.thickness});var d=[],p=[];u.forEach((function(t){var e=t[0],n=t[1];d.push([e[0],e[1]]),p.push(n)})),h.setIndex(s.reduce((function(t,e){return[].concat(ao()(t),ao()(e))}),[])),h.setAttribute("a_pos",Float32Array.from(c.reduce((function(t,e){return[].concat(ao()(t),ao()(e))}),[])),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]});var m=new Array(l).fill(void 0).map((function(){return ao()(t.config.color)})).reduce((function(t,e){return[].concat(ao()(t),ao()(e))}),[]);h.setAttribute("a_color",Float32Array.from(m),{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]}),h.setAttribute("a_line_miter",Float32Array.from(p),{arrayStride:4,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float"}]}),h.setAttribute("a_line_normal",Float32Array.from(d.reduce((function(t,e){return[].concat(ao()(t),ao()(e))}),[])),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:3,offset:0,format:"float2"}]}),h.setAttribute("a_counters",Float32Array.from(f),{arrayStride:4,stepMode:"vertex",attributes:[{shaderLocation:4,offset:0,format:"float"}]})}}]),n}(Ui),au=ir()(ou.prototype,"materialSystem",[Ja,tu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),uu=ir()(ou.prototype,"geometrySystem",[eu,nu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),su=ir()(ou.prototype,"shaderModuleService",[ru],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),iu=ou))||iu);function wu(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function xu(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ha()(t);if(e){var i=ha()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fa()(this,n)}}var Tu,Au,Su,Ru,Ou,Cu,Mu,Iu,Nu,Pu=["circle","triangle","square","pentagon","hexagon","octogon","hexagram","rhombus","vesica"],ku=(fu=Object(ur.injectable)(),lu=Object(ur.inject)(or.IDENTIFIER.Systems),hu=Object(ur.named)(or.IDENTIFIER.MaterialSystem),du=Object(ur.inject)(or.IDENTIFIER.Systems),pu=Object(ur.named)(or.IDENTIFIER.GeometrySystem),mu=Object(ur.inject)(or.IDENTIFIER.ShaderModuleService),fu((gu=function(t){sa()(n,t);var e=xu(n);function n(){var t;tr()(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return t=e.call.apply(e,[this].concat(i)),Zn()(t,"materialSystem",yu,Na()(t)),Zn()(t,"geometrySystem",bu,Na()(t)),Zn()(t,"shaderModuleService",_u,Na()(t)),t}return nr()(n,[{key:"onAttributeChanged",value:function(t){var e=t.name,n=t.data,r=this.getMeshComponent();r&&r.material&&("strokeWidth"===e?r.material.setUniform("u_stroke_width",n):"strokeColor"===e?r.material.setUniform("u_stroke_color",n):"strokeOpacity"===e?r.material.setUniform("u_stroke_opacity",n):"opacity"===e?r.material.setUniform("u_opacity",n):"blur"===e&&r.material.setUniform("u_blur",n))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:'attribute vec2 position;\nattribute vec4 color;\nattribute float shape;\nattribute vec2 offset;\nattribute float size;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nuniform float u_stroke_width : 0.01;\nuniform float u_device_pixel_ratio;\nuniform vec2 u_viewport;\n\nvarying vec4 v_color;\nvarying vec4 v_data;\nvarying float v_radius;\n\n#pragma include "picking"\n\nvoid main() {\n v_color = color;\n v_radius = size;\n\n lowp float antialiasblur = 1.0 / u_device_pixel_ratio * (size + u_stroke_width);\n\n // construct point coords\n v_data = vec4(position, antialiasblur, shape);\n\n gl_Position = projectionMatrix * modelViewMatrix\n * vec4(position * size + offset, 0.0, 1.0);\n\n setPickingColor(a_PickingColor);\n}',fs:"uniform float u_blur : 0.05;\nuniform float u_opacity : 0.7;\nuniform float u_stroke_width : 0.01;\nuniform vec4 u_stroke_color : [0, 0, 0, 0];\nuniform float u_stroke_opacity : 1;\n\nvarying vec4 v_color;\nvarying vec4 v_data;\nvarying float v_radius;\n\n#pragma include \"sdf2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n float antialiasblur = v_data.z;\n float antialiased_blur = -max(u_blur, antialiasblur);\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n // if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n // } else if (shape == 1) {\n // outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n // inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n // } else if (shape == 2) {\n // outer_df = sdBox(v_data.xy, vec2(1.));\n // inner_df = sdBox(v_data.xy, vec2(r));\n // } else if (shape == 3) {\n // outer_df = sdPentagon(v_data.xy, 0.8);\n // inner_df = sdPentagon(v_data.xy, r * 0.8);\n // } else if (shape == 4) {\n // outer_df = sdHexagon(v_data.xy, 0.8);\n // inner_df = sdHexagon(v_data.xy, r * 0.8);\n // } else if (shape == 5) {\n // outer_df = sdOctogon(v_data.xy, 1.0);\n // inner_df = sdOctogon(v_data.xy, r);\n // } else if (shape == 6) {\n // outer_df = sdHexagram(v_data.xy, 0.52);\n // inner_df = sdHexagram(v_data.xy, r * 0.52);\n // } else if (shape == 7) {\n // outer_df = sdRhombus(v_data.xy, vec2(1.0));\n // inner_df = sdRhombus(v_data.xy, vec2(r));\n // } else if (shape == 8) {\n // outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n // inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n // }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n vec4 strokeColor = u_stroke_color == vec4(0) ? v_color : u_stroke_color;\n\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);\n gl_FragColor.a = gl_FragColor.a * opacity_t;\n\n gl_FragColor = filterColor(gl_FragColor);\n}"});var t=this.shaderModuleService.getModule("grid"),e=t.vs,n=t.fs,r=t.uniforms,i=this.materialSystem.createShaderMaterial({vertexShader:e,fragmentShader:n,cull:{enable:!1},depth:{enable:!1},blend:{enable:!0,func:{srcRGB:or.gl.SRC_ALPHA,dstRGB:or.gl.ONE_MINUS_SRC_ALPHA,srcAlpha:1,dstAlpha:1}}});i.setUniform(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?wu(Object(n),!0).forEach((function(e){Fr()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({u_device_pixel_ratio:window.devicePixelRatio},r));var o=this.buildAttributes(),a=this.geometrySystem.createInstancedBufferGeometry({maxInstancedCount:o.instancedOffsets.length/2,vertexCount:6});a.setIndex([0,2,1,0,3,2]),a.setAttribute("position",Float32Array.from(o.positions),{arrayStride:8,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]}),a.setAttribute("offset",Float32Array.from(o.instancedOffsets),{arrayStride:8,stepMode:"instance",attributes:[{shaderLocation:1,offset:0,format:"float2"}]}),a.setAttribute("color",Float32Array.from(o.instancedColors),{arrayStride:16,stepMode:"instance",attributes:[{shaderLocation:2,offset:0,format:"float4"}]}),a.setAttribute("size",Float32Array.from(o.instancedSizes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:3,offset:0,format:"float"}]}),a.setAttribute("shape",Float32Array.from(o.instancedShapes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:4,offset:0,format:"float"}]}),a.setAttribute("a_PickingColor",Float32Array.from(o.instancedPickingColors),{arrayStride:12,stepMode:"instance",attributes:[{shaderLocation:6,offset:0,format:"float3"}]}),this.setMaterial(i),this.setGeometry(a)}},{key:"buildAttribute",value:function(t,e,n){var r,i,o,a,u;(r=e.instancedPickingColors).push.apply(r,ao()([(u=t.id||n)+1&255,u+1>>8&255,u+1>>8>>8&255])),e.instancedShapes.push(Pu.indexOf(t.shape||"circle")),(i=e.instancedColors).push.apply(i,ao()(t.color||[1,0,0,1])),(o=e.instancedOffsets).push.apply(o,ao()(t.position||[0,0])),(a=e.instancedSizes).push.apply(a,ao()(t.size||[.2,.2]))}},{key:"buildAttributes",value:function(){var t=this,e={positions:[1,1,1,-1,-1,-1,-1,1],instancedOffsets:[],instancedColors:[],instancedSizes:[],instancedShapes:[],instancedPickingColors:[]};return Array.isArray(this.config)?this.config.forEach((function(n,r){t.buildAttribute(n,e,r)})):this.buildAttribute(this.config,e,0),e}}]),n}(Ui),yu=ir()(gu.prototype,"materialSystem",[lu,hu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),bu=ir()(gu.prototype,"geometrySystem",[du,pu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_u=ir()(gu.prototype,"shaderModuleService",[mu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vu=gu))||vu);function Du(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return Lu(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lu(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function Lu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var ju,Fu,Bu,Uu,Gu,Vu,zu,Wu,Hu,qu=(Tu=Object(ur.injectable)(),Au=Object(ur.inject)(or.IDENTIFIER.RenderEngine),Su=Object(ur.inject)(or.IDENTIFIER.ShaderModuleService),Ru=Object(ur.inject)(or.IDENTIFIER.ConfigService),Tu((Cu=function(){function t(){tr()(this,t),this.container=void 0,Zn()(this,"engine",Mu,this),Zn()(this,"shaderModule",Iu,this),Zn()(this,"configService",Nu,this),this.inited=!1,this.rendering=!1,this.pendings=[],this.views=[],this.size=void 0}var e,n;return nr()(t,[{key:"init",value:(n=Lr()(kr.a.mark((function t(){var e,n,r,i,o;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.shaderModule.registerBuiltinModules(),this.shaderModule.registerModule("uv.vert.declaration",{vs:"#ifdef USE_UV\n attribute vec2 uv;\n\t#ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif"}),this.shaderModule.registerModule("uv.vert.main",{vs:"#ifdef USE_UV\n vUv = (uvTransform * vec3(uv, 1)).xy;\n#endif"}),this.shaderModule.registerModule("uv.frag.declaration",{fs:"#if (defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ))\n varying vec2 vUv;\n#endif"}),this.shaderModule.registerModule("map.frag.declaration",{fs:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif"}),this.shaderModule.registerModule("map.frag.main",{fs:"#ifdef USE_MAP\n vec4 texelColor = texture2D(map, vUv);\n // texelColor = mapTexelToLinear(texelColor);\n diffuseColor *= texelColor;\n#endif"}),e=this.container.getAll(or.IDENTIFIER.Systems),!(n=this.configService.get()).canvas){t.next=30;break}return t.next=11,this.engine.init({canvas:n.canvas,swapChainFormat:Br.TextureFormat.BGRA8Unorm,antialiasing:!1});case 11:r=Du(e),t.prev=12,r.s();case 14:if((i=r.n()).done){t.next=21;break}if(!(o=i.value).initialize){t.next=19;break}return t.next=19,o.initialize();case 19:t.next=14;break;case 21:t.next=26;break;case 23:t.prev=23,t.t0=t.catch(12),r.e(t.t0);case 26:return t.prev=26,r.f(),t.finish(26);case 29:this.inited=!0;case 30:case"end":return t.stop()}}),t,this,[[12,23,26,29]])}))),function(){return n.apply(this,arguments)})},{key:"render",value:(e=Lr()(kr.a.mark((function t(){var e,n,r,i,o,a,u,s=arguments;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.inited&&!this.rendering){t.next=2;break}return t.abrupt("return");case 2:for(this.pendings.length&&this.pendings.forEach((function(t){t()})),this.rendering=!0,this.engine.beginFrame(),e=this.container.getAll(or.IDENTIFIER.Systems),n=s.length,r=new Array(n),i=0;i<n;i++)r[i]=s[i];o=Du(e),t.prev=8,o.s();case 10:if((a=o.n()).done){t.next=17;break}if(!(u=a.value).execute){t.next=15;break}return t.next=15,u.execute(r);case 15:t.next=10;break;case 17:t.next=22;break;case 19:t.prev=19,t.t0=t.catch(8),o.e(t.t0);case 22:return t.prev=22,o.f(),t.finish(22);case 25:this.engine.endFrame(),this.rendering=!1;case 27:case"end":return t.stop()}}),t,this,[[8,19,22,25]])}))),function(){return e.apply(this,arguments)})},{key:"clear",value:function(t){var e=this;return this.inited?this.engine.clear(t):this.pendings.unshift((function(){e.engine.clear(t),e.pendings.shift()})),this}},{key:"setSize",value:function(t){var e=t.width,n=t.height,r=this.engine.getCanvas();return this.size={width:e,height:n},r.width=e,r.height=n,this}},{key:"getSize",value:function(){return this.size}}]),t}(),Mu=ir()(Cu.prototype,"engine",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Iu=ir()(Cu.prototype,"shaderModule",[Su],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Nu=ir()(Cu.prototype,"configService",[Ru],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ou=Cu))||Ou),Xu=Object(ur.injectable)()(ju=function(){function t(){tr()(this,t),this.entities=[]}return nr()(t,[{key:"getEntities",value:function(){return this.entities}},{key:"addRenderable",value:function(t){return this.addEntity(t.getEntity()),this}},{key:"removeRenderable",value:function(t){return this.removeEntity(t.getEntity()),this}},{key:"addLight",value:function(){}},{key:"addEntity",value:function(t){return-1===this.entities.indexOf(t)&&this.entities.push(t),this}},{key:"removeEntity",value:function(t){var e=this.entities.indexOf(t);return this.entities.splice(e,1),this}}]),t}())||ju,Yu=Object(ur.injectable)()(Fu=function(){function t(){tr()(this,t),this.cache={}}return nr()(t,[{key:"get",value:function(t){return this.cache[t]}},{key:"set",value:function(t,e){this.cache[t]=e}}]),t}())||Fu;function Ku(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Qu(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ku(Object(n),!0).forEach((function(e){Fr()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ku(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var $u,Zu,Ju,ts,es,ns,rs,is,os,as,us,ss=(Bu=Object(ur.injectable)(),Uu=Object(ur.inject)(Yu),Gu=Object(ur.inject)(or.IDENTIFIER.RenderEngine),Bu((zu=function(){function t(){tr()(this,t),Zn()(this,"textureCache",Wu,this),Zn()(this,"engine",Hu,this),this.config=void 0,this.loaded=!1,this.texture=void 0}var e;return nr()(t,[{key:"setConfig",value:function(t){this.config=t}},{key:"isLoaded",value:function(){return this.loaded}},{key:"load",value:(e=Lr()(kr.a.mark((function t(){var e=this;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.config.url){t.next=4;break}return t.abrupt("return",new Promise((function(t,n){var r=e.textureCache.get(e.config.url);if(r)t(r);else{var i=new Image;i.crossOrigin="Anonymous",i.src=e.config.url,i.onload=function(){var n=e.engine.createTexture2D(Qu(Qu({},e.config),{},{data:i,width:i.width,height:i.height,flipY:!0}));e.textureCache.set(e.config.url,n),e.texture=n,e.loaded=!0,t(n)},i.onerror=function(){n()}}})));case 4:return this.loaded=!0,this.texture=this.engine.createTexture2D(this.config),t.abrupt("return",this.texture);case 7:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),Wu=ir()(zu.prototype,"textureCache",[Uu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Hu=ir()(zu.prototype,"engine",[Gu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Vu=zu))||Vu),cs=($u=Object(ur.injectable)(),Zu=Object(ur.inject)(or.IDENTIFIER.Systems),Ju=Object(ur.named)(or.IDENTIFIER.RendererSystem),$u((es=function(){function t(){tr()(this,t),Zn()(this,"rendererSystem",ns,this),this.camera=void 0,this.scene=void 0,this.viewport={x:0,y:0,width:0,height:0},this.clearColor=[1,1,1,1]}return nr()(t,[{key:"getCamera",value:function(){return this.camera}},{key:"getScene",value:function(){return this.scene}},{key:"getViewport",value:function(){return this.viewport}},{key:"getClearColor",value:function(){return this.clearColor}},{key:"setCamera",value:function(t){return this.camera=t,this}},{key:"setScene",value:function(t){return this.scene=t,this}},{key:"setViewport",value:function(t){return this.viewport=t,this}},{key:"setClearColor",value:function(t){return this.clearColor=t,this}},{key:"pick",value:function(t){return this.rendererSystem.pick(t,this)}}]),t}(),ns=ir()(es.prototype,"rendererSystem",[Zu,Ju],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ts=es))||ts);function fs(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ls(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?fs(Object(n),!0).forEach((function(e){Fr()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fs(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}rs=Object(ur.injectable)(),is=Object(ur.inject)(or.IDENTIFIER.ConfigService),rs((as=function(){function t(){tr()(this,t),Zn()(this,"configService",us,this),this.container=void 0}var e;return nr()(t,[{key:"getEngine",value:(e=Lr()(kr.a.mark((function t(){var e,n,r,i;return kr.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.container.get(or.IDENTIFIER.RenderEngine),n=this.configService.get(),r=n.canvas,i=n.engineOptions,t.next=4,e.init(ls({canvas:r||Ur(),swapChainFormat:Br.TextureFormat.BGRA8Unorm,antialiasing:!1},i));case 4:return t.abrupt("return",e);case 5:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"getTransformComponent",value:function(t){return this.container.get(or.IDENTIFIER.TransformComponentManager).getComponentByEntity(t)}},{key:"getMeshComponent",value:function(t){return this.container.get(or.IDENTIFIER.MeshComponentManager).getComponentByEntity(t)}},{key:"setConfig",value:function(t){this.configService.set(t)}},{key:"setContainer",value:function(t){this.container=t}},{key:"getContainer",value:function(){return this.container}},{key:"createEntity",value:function(){return Object(or.createEntity)()}},{key:"createScene",value:function(){return this.container.get(Xu)}},{key:"createCamera",value:function(){return this.container.get(Ir)}},{key:"createView",value:function(){return this.container.get(cs)}},{key:"createRenderable",value:function(t,e){var n=t?this.container.getNamed(or.IDENTIFIER.Renderable,t):this.container.get(Ui),r=Object(or.createEntity)();return n.setConfig(e||{}),n.setEntity(r),n}},{key:"createGeometry",value:function(t,e){var n=this.container.getNamed(or.IDENTIFIER.Geometry,t),r=Object(or.createEntity)();return n.setConfig(e||{}),n.setEntity(r),n.getComponent()}},{key:"createMaterial",value:function(t,e){var n=this.container.getNamed(or.IDENTIFIER.Material,t),r=Object(or.createEntity)();return n.setConfig(e||{}),n.setEntity(r,t),n.getComponent()}},{key:"createTexture2D",value:function(t){var e=this.container.get(ss);return e.setConfig(t),e}},{key:"createBufferGeometry",value:function(t){return this.container.getNamed(or.IDENTIFIER.Systems,or.IDENTIFIER.GeometrySystem).createBufferGeometry(t)}},{key:"createInstancedBufferGeometry",value:function(t){return this.container.getNamed(or.IDENTIFIER.Systems,or.IDENTIFIER.GeometrySystem).createInstancedBufferGeometry(t)}},{key:"createShaderMaterial",value:function(t){return this.container.getNamed(or.IDENTIFIER.Systems,or.IDENTIFIER.MaterialSystem).createShaderMaterial(t)}},{key:"createKernel",value:function(t){var e=this.container.get(Fi);return"string"==typeof t?e.setBundle(JSON.parse(t)):e.setBundle(t),e.init(),e}},{key:"createRenderer",value:function(){var t=this.container.get(qu);return t.container=this.container,t.init(),t}},{key:"destroy",value:function(){this.container.getAll(or.IDENTIFIER.Systems).forEach((function(t){t.tearDown&&t.tearDown()})),this.container.get(or.IDENTIFIER.RenderEngine).destroy(),this.container.get(or.IDENTIFIER.InteractorService).destroy()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object(or.createWorldContainer)(),r=navigator.gpu?ia:To;n.isBound(or.IDENTIFIER.RenderEngine)||n.bind(or.IDENTIFIER.RenderEngine).to(r).inSingletonScope(),n.bind(qu).toSelf(),n.bind(Fi).toSelf(),n.bind(Ui).toSelf(),n.bind(cs).toSelf(),n.bind(Ir).toSelf(),n.bind(Xu).toSelf(),n.bind(t).toSelf(),n.bind(Yu).toSelf(),n.bind(ss).toSelf(),n.bind(or.IDENTIFIER.Geometry).to(ma).whenTargetNamed(Nr.BOX),n.bind(or.IDENTIFIER.Geometry).to(Ma).whenTargetNamed(Nr.SPHERE),n.bind(or.IDENTIFIER.Geometry).to(Ea).whenTargetNamed(Nr.PLANE),n.bind(or.IDENTIFIER.Geometry).to(ya).whenTargetNamed(Nr.MERGED),n.bind(or.IDENTIFIER.Material).to(Ha).whenTargetNamed(Bi.BASIC),n.bind(or.IDENTIFIER.Renderable).to(ku).whenTargetNamed(Ui.POINT),n.bind(or.IDENTIFIER.Renderable).to(Eu).whenTargetNamed(Ui.LINE),n.bind(or.IDENTIFIER.Renderable).to(Xa).whenTargetNamed(Ui.GRID);var i=n.get(t);return i.setContainer(n),i.setConfig(e),i}}]),t}(),us=ir()(as.prototype,"configService",[is],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),os=as));class hs{constructor(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}init(t,e,n){this.cells=[],this.CELL_W=n.CELL_W||hs.DEFAULT_CELL_W,this.CELL_H=n.CELL_H||hs.DEFAULT_CELL_H,this.columnNum=Math.ceil(t/this.CELL_W),this.rowNum=Math.ceil(e/this.CELL_H),hs.MIN_DIST=Math.pow(t,2)+Math.pow(e,2);for(let t=0;t<this.columnNum;t++){const e=[];for(let n=0;n<this.rowNum;n++){const r={dx:t,dy:n,x:t*this.CELL_W,y:n*this.CELL_H,occupied:!1};e.push(r)}this.cells.push(e)}}findGridByNodeId(t){var e,n;for(let r=0;r<this.columnNum;r++)for(let i=0;i<this.rowNum;i++)if(this.cells[r][i].node&&(null===(n=null===(e=this.cells[r][i])||void 0===e?void 0:e.node)||void 0===n?void 0:n.id)===t)return{column:r,row:i};return null}sqdist(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}occupyNearest(t){let e,n=hs.MIN_DIST,r=null;for(let i=0;i<this.columnNum;i++)for(let o=0;o<this.rowNum;o++)!this.cells[i][o].occupied&&(e=this.sqdist(t,this.cells[i][o]))<n&&(n=e,r=this.cells[i][o]);return r&&(r.occupied=!0),r}insertColumn(t,e){if(!(e<=0)){for(let t=0;t<e;t++){this.cells[t+this.columnNum]=[];for(let e=0;e<this.rowNum;e++)this.cells[t+this.columnNum][e]={dx:t,dy:e,x:t*this.CELL_W,y:e*this.CELL_H,occupied:!1,node:null}}for(let n=this.columnNum-1;n>t;n--)for(let t=0;t<this.rowNum;t++)this.cells[n+e][t]=Object.assign(Object.assign({},this.cells[n][t]),{x:(n+e)*this.CELL_W,y:t*this.CELL_H}),this.cells[n][t]={x:n*this.CELL_W,y:t*this.CELL_H,occupied:!0,node:null};for(let n=0;n<this.additionColumn.length;n++)this.additionColumn[n]>=t&&(this.additionColumn[n]+=e);for(let n=0;n<e;n++)this.additionColumn.push(t+n+1);this.columnNum+=e}}insertRow(t,e){if(!(e<=0)){for(let t=0;t<e;t++)for(let e=0;e<this.columnNum;e++)this.cells[e][t+this.rowNum]={dx:e,dy:t,x:e*this.CELL_W,y:t*this.CELL_H,occupied:!1,node:null};for(let n=0;n<this.columnNum;n++)for(let r=this.rowNum-1;r>t;r--)this.cells[n][r+e]=Object.assign(Object.assign({},this.cells[n][r]),{dx:n,dy:r+e,x:n*this.CELL_W,y:(r+e)*this.CELL_H}),this.cells[n][r]={dx:n,dy:r,x:n*this.CELL_W,y:r*this.CELL_H,occupied:!1,node:null};for(let n=0;n<this.additionRow.length;n++)this.additionRow[n]>=t&&(this.additionRow[n]+=e);for(let n=0;n<e;n++)this.additionRow.push(t+n+1);this.rowNum+=e}}getNodes(){const t=[];for(let e=0;e<this.columnNum;e++)for(let n=0;n<this.rowNum;n++)this.cells[e][n].node&&t.push(this.cells[e][n]);return t}}hs.MIN_DIST=50,hs.DEFAULT_CELL_W=80,hs.DEFAULT_CELL_H=80;new Map;function ds(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ps(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ds(Object(n),!0).forEach((function(e){vs(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ds(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function ms(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function vs(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var gs=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,(n=[{key:"render",value:function(t){this.lf=t}},{key:"getBytesLength",value:function(t){if(!t)return 0;for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);t.match(/[A-Z]/)?e+=1.5:e+=r>=1&&r<=126||r>=65376&&r<=65439?1:2}return e}},{key:"layout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.lf.graphModel,r=n.nodes,i=n.edges,o=n.gridSize,a=40,u=40;o>20&&(a=2*o,u=2*o),this.option=ps({type:"dagre",rankdir:"LR",align:"DR",nodesep:a,ranksep:u,begin:[120,120]},e);var s=new An(this.option),c=s.layout({nodes:r.map((function(t){return{id:t.id,size:{width:t.width,height:t.height},model:t}})),edges:i.map((function(t){return{source:t.sourceNodeId,target:t.targetNodeId,model:t}}))}),f={nodes:[],edges:[]};c.nodes.forEach((function(t){var e=t.model.getData();e.x=t.x,e.y=t.y,f.nodes.push(e)})),c.edges.forEach((function(e){var n=e.model,r=n.getData();if(r.pointsList=t.calcPointsList(n,f.nodes),r.pointsList){var i=r.pointsList[0],o=r.pointsList[r.pointsList.length-1];r.startPoint={x:i.x,y:i.y},r.endPoint={x:o.x,y:o.y},r.text&&r.text.value&&(r.text={x:o.x-6*t.getBytesLength(r.text.value)-10,y:o.y,value:r.text.value})}else r.startPoint=void 0,r.endPoint=void 0,r.text&&r.text.value&&(r.text=r.text.value);f.edges.push(r)})),this.lf.render(f)}},{key:"pointFilter",value:function(t){for(var e=t,n=1;n<e.length-1;){var r=e[n-1],i=e[n],o=e[n+1];r.x===i.x&&i.x===o.x||r.y===i.y&&i.y===o.y?e.splice(n,1):n++}return e}},{key:"calcPointsList",value:function(t,e){var n=[];if("LR"===this.option.rankdir&&"polyline-edge"===t.modelType){var r=this.lf.getNodeModelById(t.sourceNodeId),i=this.lf.getNodeModelById(t.targetNodeId),o=e.find((function(e){return e.id===t.sourceNodeId})),a=e.find((function(e){return e.id===t.targetNodeId}));if(o.x<a.x)return n.push({x:o.x+r.width/2,y:o.y}),n.push({x:o.x+r.width/2+(t.offset||50),y:o.y}),n.push({x:o.x+r.width/2+(t.offset||50),y:a.y}),n.push({x:a.x-i.width/2,y:a.y}),this.pointFilter(n);if(o.x>a.x)return o.y>=a.y?(n.push({x:o.x,y:o.y+r.height/2}),n.push({x:o.x,y:o.y+r.height/2+(t.offset||50)}),n.push({x:a.x,y:o.y+r.height/2+(t.offset||50)}),n.push({x:a.x,y:a.y+i.height/2})):(n.push({x:o.x,y:o.y-r.height/2}),n.push({x:o.x,y:o.y-r.height/2-(t.offset||50)}),n.push({x:a.x,y:o.y-r.height/2-(t.offset||50)}),n.push({x:a.x,y:a.y-i.height/2})),this.pointFilter(n)}}}])&&ms(e.prototype,n),r&&ms(e,r),t}();vs(gs,"pluginName","dagre")}])}));
|
|
49
|
+
* Dagre布局类 - LogicFlow自动布局插件
|
|
50
|
+
* 基于dagre.js提供图的自动布局能力
|
|
51
|
+
*/
|
|
52
|
+
var Dagre = /** @class */ (function () {
|
|
53
|
+
function Dagre() {
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 插件初始化方法,由LogicFlow自动调用
|
|
57
|
+
* @param lf - LogicFlow实例
|
|
58
|
+
*/
|
|
59
|
+
Dagre.prototype.render = function (lf) {
|
|
60
|
+
this.lf = lf;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* 执行布局算法,重新排列图中的节点和边
|
|
64
|
+
* @param option - 布局配置选项
|
|
65
|
+
*/
|
|
66
|
+
Dagre.prototype.layout = function (option) {
|
|
67
|
+
var _this = this;
|
|
68
|
+
if (option === void 0) { option = {}; }
|
|
69
|
+
var _a = this.lf.graphModel, nodes = _a.nodes, edges = _a.edges, gridSize = _a.gridSize;
|
|
70
|
+
// 根据网格大小调整节点间距
|
|
71
|
+
var nodesep = 100;
|
|
72
|
+
var ranksep = 150;
|
|
73
|
+
if (gridSize > 20) {
|
|
74
|
+
nodesep = gridSize * 2;
|
|
75
|
+
ranksep = gridSize * 2;
|
|
76
|
+
}
|
|
77
|
+
// 合并默认配置和用户配置
|
|
78
|
+
this.option = __assign({
|
|
79
|
+
// 默认从左到右布局
|
|
80
|
+
rankdir: 'LR',
|
|
81
|
+
// 默认右下角对齐
|
|
82
|
+
align: 'UL',
|
|
83
|
+
// 紧凑树形排名算法
|
|
84
|
+
ranker: 'tight-tree',
|
|
85
|
+
// 层级间距
|
|
86
|
+
ranksep: ranksep,
|
|
87
|
+
// 同层节点间距
|
|
88
|
+
nodesep: nodesep,
|
|
89
|
+
// 图的水平边距
|
|
90
|
+
marginx: 120,
|
|
91
|
+
// 图的垂直边距
|
|
92
|
+
marginy: 120 }, option);
|
|
93
|
+
// 创建dagre图实例
|
|
94
|
+
var g = new dagre_1.graphlib.Graph();
|
|
95
|
+
g.setGraph(this.option);
|
|
96
|
+
g.setDefaultEdgeLabel(function () { return ({}); });
|
|
97
|
+
// 将LogicFlow节点添加到dagre图中
|
|
98
|
+
nodes.forEach(function (node) {
|
|
99
|
+
g.setNode(node.id, {
|
|
100
|
+
width: node.width || 150,
|
|
101
|
+
height: node.height || 50,
|
|
102
|
+
id: node.id,
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
// 将LogicFlow边添加到dagre图中
|
|
106
|
+
edges.forEach(function (edge) {
|
|
107
|
+
g.setEdge(edge.sourceNodeId, edge.targetNodeId, {
|
|
108
|
+
id: edge.id,
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
// 执行dagre布局算法
|
|
112
|
+
dagre_1.default.layout(g);
|
|
113
|
+
// 存储新的节点和边数据
|
|
114
|
+
var newNodes = [];
|
|
115
|
+
var newEdges = [];
|
|
116
|
+
// 更新节点位置
|
|
117
|
+
nodes.forEach(function (node) {
|
|
118
|
+
var _a;
|
|
119
|
+
var _b = g.node(node.id), x = _b.x, y = _b.y;
|
|
120
|
+
var lfNode = node.getData();
|
|
121
|
+
if (!lfNode) {
|
|
122
|
+
throw new Error("\u5E03\u5C40\u9519\u8BEF\uFF1A\u627E\u4E0D\u5230ID\u4E3A ".concat(node.id, " \u7684\u8282\u70B9"));
|
|
123
|
+
}
|
|
124
|
+
// 更新节点坐标
|
|
125
|
+
lfNode.x = x;
|
|
126
|
+
lfNode.y = y;
|
|
127
|
+
// 更新节点文本位置
|
|
128
|
+
if ((_a = lfNode === null || lfNode === void 0 ? void 0 : lfNode.text) === null || _a === void 0 ? void 0 : _a.x) {
|
|
129
|
+
lfNode.text.x = x;
|
|
130
|
+
lfNode.text.y = y;
|
|
131
|
+
}
|
|
132
|
+
newNodes.push(lfNode);
|
|
133
|
+
});
|
|
134
|
+
// 处理边的路径和锚点
|
|
135
|
+
edges.forEach(function (edge) {
|
|
136
|
+
var lfEdge = edge.getData();
|
|
137
|
+
if (!lfEdge) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (!option.isDefaultAnchor) {
|
|
141
|
+
// 自定义锚点,不调整边的关联锚点,只清除路径相关数据,让LogicFlow自动计算
|
|
142
|
+
delete lfEdge.pointsList;
|
|
143
|
+
delete lfEdge.startPoint;
|
|
144
|
+
delete lfEdge.endPoint;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// 默认锚点,重新计算路径以及边的起点和终点(节点默认锚点为上下左右)
|
|
148
|
+
delete lfEdge.pointsList;
|
|
149
|
+
delete lfEdge.startPoint;
|
|
150
|
+
delete lfEdge.endPoint;
|
|
151
|
+
delete lfEdge.sourceAnchorId;
|
|
152
|
+
delete lfEdge.targetAnchorId;
|
|
153
|
+
var model = _this.lf.getEdgeModelById(edge.id);
|
|
154
|
+
if (model) {
|
|
155
|
+
// 计算自定义折线路径
|
|
156
|
+
lfEdge.pointsList = _this.calcPointsList(model, newNodes);
|
|
157
|
+
}
|
|
158
|
+
if (lfEdge.pointsList) {
|
|
159
|
+
// 设置边的起点和终点
|
|
160
|
+
var first = lfEdge.pointsList[0];
|
|
161
|
+
var last = lfEdge.pointsList[lfEdge.pointsList.length - 1];
|
|
162
|
+
lfEdge.startPoint = { x: first.x, y: first.y };
|
|
163
|
+
lfEdge.endPoint = { x: last.x, y: last.y };
|
|
164
|
+
// 调整边标签位置
|
|
165
|
+
if (lfEdge.text && lfEdge.text.value) {
|
|
166
|
+
lfEdge.text = {
|
|
167
|
+
x: last.x - _this.getBytesLength(lfEdge.text.value) * 6 - 10,
|
|
168
|
+
y: last.y,
|
|
169
|
+
value: lfEdge.text.value,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else if (lfEdge.text && lfEdge.text.value) {
|
|
174
|
+
// 没有自定义路径时保留文本内容
|
|
175
|
+
lfEdge.text = lfEdge.text.value;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
newEdges.push(lfEdge);
|
|
179
|
+
});
|
|
180
|
+
// 将计算好的布局数据应用到画布
|
|
181
|
+
this.lf.renderRawData({
|
|
182
|
+
nodes: newNodes,
|
|
183
|
+
edges: newEdges,
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* 计算字符串显示宽度(用于文本定位)
|
|
188
|
+
* @param word - 要计算的文本
|
|
189
|
+
* @returns 估算的文本像素宽度
|
|
190
|
+
*/
|
|
191
|
+
Dagre.prototype.getBytesLength = function (word) {
|
|
192
|
+
if (!word) {
|
|
193
|
+
return 0;
|
|
194
|
+
}
|
|
195
|
+
var totalLength = 0;
|
|
196
|
+
for (var i = 0; i < word.length; i++) {
|
|
197
|
+
var c = word.charCodeAt(i);
|
|
198
|
+
// 大写字母宽度加权
|
|
199
|
+
if (word.match(/[A-Z]/)) {
|
|
200
|
+
totalLength += 1.5;
|
|
201
|
+
}
|
|
202
|
+
// ASCII字符和半角字符
|
|
203
|
+
else if ((c >= 0x0001 && c <= 0x007e) || (c >= 0xff60 && c <= 0xff9f)) {
|
|
204
|
+
totalLength += 1;
|
|
205
|
+
}
|
|
206
|
+
// 其他字符(如中文)
|
|
207
|
+
else {
|
|
208
|
+
totalLength += 2;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return totalLength;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* 优化折线路径点,移除冗余点
|
|
215
|
+
* @param points - 原始路径点数组
|
|
216
|
+
* @returns 优化后的路径点数组
|
|
217
|
+
*/
|
|
218
|
+
Dagre.prototype.pointFilter = function (points) {
|
|
219
|
+
var allPoints = __spreadArray([], points, true); // 创建副本避免修改原始数据
|
|
220
|
+
var i = 1;
|
|
221
|
+
// 删除直线上的中间点(保持路径简洁)
|
|
222
|
+
while (i < allPoints.length - 1) {
|
|
223
|
+
var pre = allPoints[i - 1];
|
|
224
|
+
var current = allPoints[i];
|
|
225
|
+
var next = allPoints[i + 1];
|
|
226
|
+
// 如果三点共线,移除中间点
|
|
227
|
+
if ((pre.x === current.x && current.x === next.x) || // 垂直线上的点
|
|
228
|
+
(pre.y === current.y && current.y === next.y)) {
|
|
229
|
+
// 水平线上的点
|
|
230
|
+
allPoints.splice(i, 1);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
i++;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return allPoints;
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* 计算边的折线路径点
|
|
240
|
+
* @param model - 边模型
|
|
241
|
+
* @param nodes - 节点数据数组
|
|
242
|
+
* @returns 计算后的路径点数组,如果无法计算则返回undefined
|
|
243
|
+
*/
|
|
244
|
+
Dagre.prototype.calcPointsList = function (model, nodes) {
|
|
245
|
+
var pointsList = [];
|
|
246
|
+
// 获取源节点和目标节点的模型与布局数据
|
|
247
|
+
var sourceNodeModel = this.lf.getNodeModelById(model.sourceNodeId);
|
|
248
|
+
var targetNodeModel = this.lf.getNodeModelById(model.targetNodeId);
|
|
249
|
+
var newSourceNodeData = nodes.find(function (node) { return node.id === model.sourceNodeId; });
|
|
250
|
+
var newTargetNodeData = nodes.find(function (node) { return node.id === model.targetNodeId; });
|
|
251
|
+
// 数据验证
|
|
252
|
+
if (!sourceNodeModel ||
|
|
253
|
+
!targetNodeModel ||
|
|
254
|
+
!newSourceNodeData ||
|
|
255
|
+
!newTargetNodeData) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
// 折线偏移量(用于创建合适的转折点)
|
|
259
|
+
var offset = Number(model.offset) || 50;
|
|
260
|
+
// 处理从左到右(LR)布局的边路径
|
|
261
|
+
if (this.option.rankdir === 'LR' && model.modelType === 'polyline-edge') {
|
|
262
|
+
// 正向连线:源节点在目标节点左侧
|
|
263
|
+
if (newSourceNodeData.x < newTargetNodeData.x) {
|
|
264
|
+
// 从源节点右侧中心出发
|
|
265
|
+
pointsList.push({
|
|
266
|
+
x: newSourceNodeData.x + sourceNodeModel.width / 2,
|
|
267
|
+
y: newSourceNodeData.y,
|
|
268
|
+
});
|
|
269
|
+
// 向右延伸一段距离
|
|
270
|
+
pointsList.push({
|
|
271
|
+
x: newSourceNodeData.x + sourceNodeModel.width / 2 + offset,
|
|
272
|
+
y: newSourceNodeData.y,
|
|
273
|
+
});
|
|
274
|
+
// 垂直移动到目标节点的高度
|
|
275
|
+
pointsList.push({
|
|
276
|
+
x: newSourceNodeData.x + sourceNodeModel.width / 2 + offset,
|
|
277
|
+
y: newTargetNodeData.y,
|
|
278
|
+
});
|
|
279
|
+
// 连接到目标节点左侧中心
|
|
280
|
+
pointsList.push({
|
|
281
|
+
x: newTargetNodeData.x - targetNodeModel.width / 2,
|
|
282
|
+
y: newTargetNodeData.y,
|
|
283
|
+
});
|
|
284
|
+
return this.pointFilter(pointsList);
|
|
285
|
+
}
|
|
286
|
+
// 反向连线:源节点在目标节点右侧
|
|
287
|
+
if (newSourceNodeData.x > newTargetNodeData.x) {
|
|
288
|
+
// 根据节点相对Y轴位置选择不同路径
|
|
289
|
+
if (newSourceNodeData.y >= newTargetNodeData.y) {
|
|
290
|
+
// 源节点在目标节点的右下方,从源节点上方出发
|
|
291
|
+
pointsList.push({
|
|
292
|
+
x: newSourceNodeData.x,
|
|
293
|
+
y: newSourceNodeData.y + sourceNodeModel.height / 2,
|
|
294
|
+
});
|
|
295
|
+
pointsList.push({
|
|
296
|
+
x: newSourceNodeData.x,
|
|
297
|
+
y: newSourceNodeData.y + sourceNodeModel.height / 2 + offset,
|
|
298
|
+
});
|
|
299
|
+
pointsList.push({
|
|
300
|
+
x: newTargetNodeData.x,
|
|
301
|
+
y: newSourceNodeData.y + sourceNodeModel.height / 2 + offset,
|
|
302
|
+
});
|
|
303
|
+
pointsList.push({
|
|
304
|
+
x: newTargetNodeData.x,
|
|
305
|
+
y: newTargetNodeData.y + targetNodeModel.height / 2,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
// 源节点在目标节点的右上方,从源节点下方出发
|
|
310
|
+
pointsList.push({
|
|
311
|
+
x: newSourceNodeData.x,
|
|
312
|
+
y: newSourceNodeData.y - sourceNodeModel.height / 2,
|
|
313
|
+
});
|
|
314
|
+
pointsList.push({
|
|
315
|
+
x: newSourceNodeData.x,
|
|
316
|
+
y: newSourceNodeData.y - sourceNodeModel.height / 2 - offset,
|
|
317
|
+
});
|
|
318
|
+
pointsList.push({
|
|
319
|
+
x: newTargetNodeData.x,
|
|
320
|
+
y: newSourceNodeData.y - sourceNodeModel.height / 2 - offset,
|
|
321
|
+
});
|
|
322
|
+
pointsList.push({
|
|
323
|
+
x: newTargetNodeData.x,
|
|
324
|
+
y: newTargetNodeData.y - targetNodeModel.height / 2,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return this.pointFilter(pointsList);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// 处理从上到下(TB)布局的边路径
|
|
331
|
+
if (this.option.rankdir === 'TB' && model.modelType === 'polyline-edge') {
|
|
332
|
+
// 正向连线:源节点在目标节点上方
|
|
333
|
+
if (newSourceNodeData.y < newTargetNodeData.y) {
|
|
334
|
+
// 从源节点底部中心出发
|
|
335
|
+
pointsList.push({
|
|
336
|
+
x: newSourceNodeData.x,
|
|
337
|
+
y: newSourceNodeData.y + sourceNodeModel.height / 2,
|
|
338
|
+
});
|
|
339
|
+
// 向下延伸一段距离
|
|
340
|
+
pointsList.push({
|
|
341
|
+
x: newSourceNodeData.x,
|
|
342
|
+
y: newSourceNodeData.y + sourceNodeModel.height / 2 + offset,
|
|
343
|
+
});
|
|
344
|
+
// 水平移动到目标节点的位置
|
|
345
|
+
pointsList.push({
|
|
346
|
+
x: newTargetNodeData.x,
|
|
347
|
+
y: newSourceNodeData.y + sourceNodeModel.height / 2 + offset,
|
|
348
|
+
});
|
|
349
|
+
// 连接到目标节点顶部中心
|
|
350
|
+
pointsList.push({
|
|
351
|
+
x: newTargetNodeData.x,
|
|
352
|
+
y: newTargetNodeData.y - targetNodeModel.height / 2,
|
|
353
|
+
});
|
|
354
|
+
return this.pointFilter(pointsList);
|
|
355
|
+
}
|
|
356
|
+
// 反向连线:源节点在目标节点下方
|
|
357
|
+
if (newSourceNodeData.y > newTargetNodeData.y) {
|
|
358
|
+
if (newSourceNodeData.x >= newTargetNodeData.x) {
|
|
359
|
+
// 源节点在目标节点右下方,从源节点右侧出发
|
|
360
|
+
pointsList.push({
|
|
361
|
+
x: newSourceNodeData.x + sourceNodeModel.width / 2,
|
|
362
|
+
y: newSourceNodeData.y,
|
|
363
|
+
});
|
|
364
|
+
pointsList.push({
|
|
365
|
+
x: newSourceNodeData.x + sourceNodeModel.width / 2 + offset,
|
|
366
|
+
y: newSourceNodeData.y,
|
|
367
|
+
});
|
|
368
|
+
pointsList.push({
|
|
369
|
+
x: newSourceNodeData.x + sourceNodeModel.width / 2 + offset,
|
|
370
|
+
y: newTargetNodeData.y,
|
|
371
|
+
});
|
|
372
|
+
pointsList.push({
|
|
373
|
+
x: newTargetNodeData.x + targetNodeModel.width / 2,
|
|
374
|
+
y: newTargetNodeData.y,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
// 源节点在目标节点左下方,从源节点左侧出发
|
|
379
|
+
pointsList.push({
|
|
380
|
+
x: newSourceNodeData.x - sourceNodeModel.width / 2,
|
|
381
|
+
y: newSourceNodeData.y,
|
|
382
|
+
});
|
|
383
|
+
pointsList.push({
|
|
384
|
+
x: newSourceNodeData.x - sourceNodeModel.width / 2 - offset,
|
|
385
|
+
y: newSourceNodeData.y,
|
|
386
|
+
});
|
|
387
|
+
pointsList.push({
|
|
388
|
+
x: newSourceNodeData.x - sourceNodeModel.width / 2 - offset,
|
|
389
|
+
y: newTargetNodeData.y,
|
|
390
|
+
});
|
|
391
|
+
pointsList.push({
|
|
392
|
+
x: newTargetNodeData.x - targetNodeModel.width / 2,
|
|
393
|
+
y: newTargetNodeData.y,
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
return this.pointFilter(pointsList);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
// 无法确定路径时返回undefined,让LogicFlow自行处理
|
|
400
|
+
return undefined;
|
|
401
|
+
};
|
|
402
|
+
/** 插件名称,用于在LogicFlow中注册 */
|
|
403
|
+
Dagre.pluginName = 'dagre';
|
|
404
|
+
return Dagre;
|
|
405
|
+
}());
|
|
406
|
+
exports.Dagre = Dagre;
|
|
407
|
+
//# sourceMappingURL=dagre.js.map
|