text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.meshjs=e():t.meshjs=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/js/",r(r.s=47)}([function(t,e,r){"use strict";r.r(e),r.d(e,"glMatrix",(function(){return n})),r.d(e,"mat2",(function(){return i})),r.d(e,"mat2d",(function(){return o})),r.d(e,"mat3",(function(){return a})),r.d(e,"mat4",(function(){return u})),r.d(e,"quat",(function(){return c})),r.d(e,"quat2",(function(){return f})),r.d(e,"vec2",(function(){return h})),r.d(e,"vec3",(function(){return s})),r.d(e,"vec4",(function(){return l}));var n={};r.r(n),r.d(n,"EPSILON",(function(){return d})),r.d(n,"ARRAY_TYPE",(function(){return v})),r.d(n,"RANDOM",(function(){return g})),r.d(n,"setMatrixArrayType",(function(){return p})),r.d(n,"toRadian",(function(){return x})),r.d(n,"equals",(function(){return y}));var i={};r.r(i),r.d(i,"create",(function(){return b})),r.d(i,"clone",(function(){return M})),r.d(i,"copy",(function(){return _})),r.d(i,"identity",(function(){return S})),r.d(i,"fromValues",(function(){return w})),r.d(i,"set",(function(){return E})),r.d(i,"transpose",(function(){return C})),r.d(i,"invert",(function(){return O})),r.d(i,"adjoint",(function(){return k})),r.d(i,"determinant",(function(){return A})),r.d(i,"multiply",(function(){return R})),r.d(i,"rotate",(function(){return T})),r.d(i,"scale",(function(){return L})),r.d(i,"fromRotation",(function(){return D})),r.d(i,"fromScaling",(function(){return I})),r.d(i,"str",(function(){return F})),r.d(i,"frob",(function(){return U})),r.d(i,"LDU",(function(){return P})),r.d(i,"add",(function(){return B})),r.d(i,"subtract",(function(){return N})),r.d(i,"exactEquals",(function(){return G})),r.d(i,"equals",(function(){return q})),r.d(i,"multiplyScalar",(function(){return j})),r.d(i,"multiplyScalarAndAdd",(function(){return V})),r.d(i,"mul",(function(){return H})),r.d(i,"sub",(function(){return z}));var o={};r.r(o),r.d(o,"create",(function(){return W})),r.d(o,"clone",(function(){return Y})),r.d(o,"copy",(function(){return X})),r.d(o,"identity",(function(){return Q})),r.d(o,"fromValues",(function(){return Z})),r.d(o,"set",(function(){return J})),r.d(o,"invert",(function(){return $})),r.d(o,"determinant",(function(){return K})),r.d(o,"multiply",(function(){return tt})),r.d(o,"rotate",(function(){return et})),r.d(o,"scale",(function(){return rt})),r.d(o,"translate",(function(){return nt})),r.d(o,"fromRotation",(function(){return it})),r.d(o,"fromScaling",(function(){return ot})),r.d(o,"fromTranslation",(function(){return at})),r.d(o,"str",(function(){return ut})),r.d(o,"frob",(function(){return st})),r.d(o,"add",(function(){return lt})),r.d(o,"subtract",(function(){return ct})),r.d(o,"multiplyScalar",(function(){return ft})),r.d(o,"multiplyScalarAndAdd",(function(){return ht})),r.d(o,"exactEquals",(function(){return dt})),r.d(o,"equals",(function(){return vt})),r.d(o,"mul",(function(){return gt})),r.d(o,"sub",(function(){return pt}));var a={};r.r(a),r.d(a,"create",(function(){return mt})),r.d(a,"fromMat4",(function(){return xt})),r.d(a,"clone",(function(){return yt})),r.d(a,"copy",(function(){return bt})),r.d(a,"fromValues",(function(){return Mt})),r.d(a,"set",(function(){return _t})),r.d(a,"identity",(function(){return St})),r.d(a,"transpose",(function(){return wt})),r.d(a,"invert",(function(){return Et})),r.d(a,"adjoint",(function(){return Ct})),r.d(a,"determinant",(function(){return Ot})),r.d(a,"multiply",(function(){return kt})),r.d(a,"translate",(function(){return At})),r.d(a,"rotate",(function(){return Rt})),r.d(a,"scale",(function(){return Tt})),r.d(a,"fromTranslation",(function(){return Lt})),r.d(a,"fromRotation",(function(){return Dt})),r.d(a,"fromScaling",(function(){return It})),r.d(a,"fromMat2d",(function(){return Ft})),r.d(a,"fromQuat",(function(){return Ut})),r.d(a,"normalFromMat4",(function(){return Pt})),r.d(a,"projection",(function(){return Bt})),r.d(a,"str",(function(){return Nt})),r.d(a,"frob",(function(){return Gt})),r.d(a,"add",(function(){return qt})),r.d(a,"subtract",(function(){return jt})),r.d(a,"multiplyScalar",(function(){return Vt})),r.d(a,"multiplyScalarAndAdd",(function(){return Ht})),r.d(a,"exactEquals",(function(){return zt})),r.d(a,"equals",(function(){return Wt})),r.d(a,"mul",(function(){return Yt})),r.d(a,"sub",(function(){return Xt}));var u={};r.r(u),r.d(u,"create",(function(){return Qt})),r.d(u,"clone",(function(){return Zt})),r.d(u,"copy",(function(){return Jt})),r.d(u,"fromValues",(function(){return $t})),r.d(u,"set",(function(){return Kt})),r.d(u,"identity",(function(){return te})),r.d(u,"transpose",(function(){return ee})),r.d(u,"invert",(function(){return re})),r.d(u,"adjoint",(function(){return ne})),r.d(u,"determinant",(function(){return ie})),r.d(u,"multiply",(function(){return oe})),r.d(u,"translate",(function(){return ae})),r.d(u,"scale",(function(){return ue})),r.d(u,"rotate",(function(){return se})),r.d(u,"rotateX",(function(){return le})),r.d(u,"rotateY",(function(){return ce})),r.d(u,"rotateZ",(function(){return fe})),r.d(u,"fromTranslation",(function(){return he})),r.d(u,"fromScaling",(function(){return de})),r.d(u,"fromRotation",(function(){return ve})),r.d(u,"fromXRotation",(function(){return ge})),r.d(u,"fromYRotation",(function(){return pe})),r.d(u,"fromZRotation",(function(){return me})),r.d(u,"fromRotationTranslation",(function(){return xe})),r.d(u,"fromQuat2",(function(){return ye})),r.d(u,"getTranslation",(function(){return be})),r.d(u,"getScaling",(function(){return Me})),r.d(u,"getRotation",(function(){return _e})),r.d(u,"fromRotationTranslationScale",(function(){return Se})),r.d(u,"fromRotationTranslationScaleOrigin",(function(){return we})),r.d(u,"fromQuat",(function(){return Ee})),r.d(u,"frustum",(function(){return Ce})),r.d(u,"perspective",(function(){return Oe})),r.d(u,"perspectiveFromFieldOfView",(function(){return ke})),r.d(u,"ortho",(function(){return Ae})),r.d(u,"lookAt",(function(){return Re})),r.d(u,"targetTo",(function(){return Te})),r.d(u,"str",(function(){return Le})),r.d(u,"frob",(function(){return De})),r.d(u,"add",(function(){return Ie})),r.d(u,"subtract",(function(){return Fe})),r.d(u,"multiplyScalar",(function(){return Ue})),r.d(u,"multiplyScalarAndAdd",(function(){return Pe})),r.d(u,"exactEquals",(function(){return Be})),r.d(u,"equals",(function(){return Ne})),r.d(u,"mul",(function(){return Ge})),r.d(u,"sub",(function(){return qe}));var s={};r.r(s),r.d(s,"create",(function(){return je})),r.d(s,"clone",(function(){return Ve})),r.d(s,"length",(function(){return He})),r.d(s,"fromValues",(function(){return ze})),r.d(s,"copy",(function(){return We})),r.d(s,"set",(function(){return Ye})),r.d(s,"add",(function(){return Xe})),r.d(s,"subtract",(function(){return Qe})),r.d(s,"multiply",(function(){return Ze})),r.d(s,"divide",(function(){return Je})),r.d(s,"ceil",(function(){return $e})),r.d(s,"floor",(function(){return Ke})),r.d(s,"min",(function(){return tr})),r.d(s,"max",(function(){return er})),r.d(s,"round",(function(){return rr})),r.d(s,"scale",(function(){return nr})),r.d(s,"scaleAndAdd",(function(){return ir})),r.d(s,"distance",(function(){return or})),r.d(s,"squaredDistance",(function(){return ar})),r.d(s,"squaredLength",(function(){return ur})),r.d(s,"negate",(function(){return sr})),r.d(s,"inverse",(function(){return lr})),r.d(s,"normalize",(function(){return cr})),r.d(s,"dot",(function(){return fr})),r.d(s,"cross",(function(){return hr})),r.d(s,"lerp",(function(){return dr})),r.d(s,"hermite",(function(){return vr})),r.d(s,"bezier",(function(){return gr})),r.d(s,"random",(function(){return pr})),r.d(s,"transformMat4",(function(){return mr})),r.d(s,"transformMat3",(function(){return xr})),r.d(s,"transformQuat",(function(){return yr})),r.d(s,"rotateX",(function(){return br})),r.d(s,"rotateY",(function(){return Mr})),r.d(s,"rotateZ",(function(){return _r})),r.d(s,"angle",(function(){return Sr})),r.d(s,"zero",(function(){return wr})),r.d(s,"str",(function(){return Er})),r.d(s,"exactEquals",(function(){return Cr})),r.d(s,"equals",(function(){return Or})),r.d(s,"sub",(function(){return Ar})),r.d(s,"mul",(function(){return Rr})),r.d(s,"div",(function(){return Tr})),r.d(s,"dist",(function(){return Lr})),r.d(s,"sqrDist",(function(){return Dr})),r.d(s,"len",(function(){return Ir})),r.d(s,"sqrLen",(function(){return Fr})),r.d(s,"forEach",(function(){return Ur}));var l={};r.r(l),r.d(l,"create",(function(){return Pr})),r.d(l,"clone",(function(){return Br})),r.d(l,"fromValues",(function(){return Nr})),r.d(l,"copy",(function(){return Gr})),r.d(l,"set",(function(){return qr})),r.d(l,"add",(function(){return jr})),r.d(l,"subtract",(function(){return Vr})),r.d(l,"multiply",(function(){return Hr})),r.d(l,"divide",(function(){return zr})),r.d(l,"ceil",(function(){return Wr})),r.d(l,"floor",(function(){return Yr})),r.d(l,"min",(function(){return Xr})),r.d(l,"max",(function(){return Qr})),r.d(l,"round",(function(){return Zr})),r.d(l,"scale",(function(){return Jr})),r.d(l,"scaleAndAdd",(function(){return $r})),r.d(l,"distance",(function(){return Kr})),r.d(l,"squaredDistance",(function(){return tn})),r.d(l,"length",(function(){return en})),r.d(l,"squaredLength",(function(){return rn})),r.d(l,"negate",(function(){return nn})),r.d(l,"inverse",(function(){return on})),r.d(l,"normalize",(function(){return an})),r.d(l,"dot",(function(){return un})),r.d(l,"cross",(function(){return sn})),r.d(l,"lerp",(function(){return ln})),r.d(l,"random",(function(){return cn})),r.d(l,"transformMat4",(function(){return fn})),r.d(l,"transformQuat",(function(){return hn})),r.d(l,"zero",(function(){return dn})),r.d(l,"str",(function(){return vn})),r.d(l,"exactEquals",(function(){return gn})),r.d(l,"equals",(function(){return pn})),r.d(l,"sub",(function(){return mn})),r.d(l,"mul",(function(){return xn})),r.d(l,"div",(function(){return yn})),r.d(l,"dist",(function(){return bn})),r.d(l,"sqrDist",(function(){return Mn})),r.d(l,"len",(function(){return _n})),r.d(l,"sqrLen",(function(){return Sn})),r.d(l,"forEach",(function(){return wn}));var c={};r.r(c),r.d(c,"create",(function(){return En})),r.d(c,"identity",(function(){return Cn})),r.d(c,"setAxisAngle",(function(){return On})),r.d(c,"getAxisAngle",(function(){return kn})),r.d(c,"getAngle",(function(){return An})),r.d(c,"multiply",(function(){return Rn})),r.d(c,"rotateX",(function(){return Tn})),r.d(c,"rotateY",(function(){return Ln})),r.d(c,"rotateZ",(function(){return Dn})),r.d(c,"calculateW",(function(){return In})),r.d(c,"exp",(function(){return Fn})),r.d(c,"ln",(function(){return Un})),r.d(c,"pow",(function(){return Pn})),r.d(c,"slerp",(function(){return Bn})),r.d(c,"random",(function(){return Nn})),r.d(c,"invert",(function(){return Gn})),r.d(c,"conjugate",(function(){return qn})),r.d(c,"fromMat3",(function(){return jn})),r.d(c,"fromEuler",(function(){return Vn})),r.d(c,"str",(function(){return Hn})),r.d(c,"clone",(function(){return Jn})),r.d(c,"fromValues",(function(){return $n})),r.d(c,"copy",(function(){return Kn})),r.d(c,"set",(function(){return ti})),r.d(c,"add",(function(){return ei})),r.d(c,"mul",(function(){return ri})),r.d(c,"scale",(function(){return ni})),r.d(c,"dot",(function(){return ii})),r.d(c,"lerp",(function(){return oi})),r.d(c,"length",(function(){return ai})),r.d(c,"len",(function(){return ui})),r.d(c,"squaredLength",(function(){return si})),r.d(c,"sqrLen",(function(){return li})),r.d(c,"normalize",(function(){return ci})),r.d(c,"exactEquals",(function(){return fi})),r.d(c,"equals",(function(){return hi})),r.d(c,"rotationTo",(function(){return di})),r.d(c,"sqlerp",(function(){return vi})),r.d(c,"setAxes",(function(){return gi}));var f={};r.r(f),r.d(f,"create",(function(){return pi})),r.d(f,"clone",(function(){return mi})),r.d(f,"fromValues",(function(){return xi})),r.d(f,"fromRotationTranslationValues",(function(){return yi})),r.d(f,"fromRotationTranslation",(function(){return bi})),r.d(f,"fromTranslation",(function(){return Mi})),r.d(f,"fromRotation",(function(){return _i})),r.d(f,"fromMat4",(function(){return Si})),r.d(f,"copy",(function(){return wi})),r.d(f,"identity",(function(){return Ei})),r.d(f,"set",(function(){return Ci})),r.d(f,"getReal",(function(){return Oi})),r.d(f,"getDual",(function(){return ki})),r.d(f,"setReal",(function(){return Ai})),r.d(f,"setDual",(function(){return Ri})),r.d(f,"getTranslation",(function(){return Ti})),r.d(f,"translate",(function(){return Li})),r.d(f,"rotateX",(function(){return Di})),r.d(f,"rotateY",(function(){return Ii})),r.d(f,"rotateZ",(function(){return Fi})),r.d(f,"rotateByQuatAppend",(function(){return Ui})),r.d(f,"rotateByQuatPrepend",(function(){return Pi})),r.d(f,"rotateAroundAxis",(function(){return Bi})),r.d(f,"add",(function(){return Ni})),r.d(f,"multiply",(function(){return Gi})),r.d(f,"mul",(function(){return qi})),r.d(f,"scale",(function(){return ji})),r.d(f,"dot",(function(){return Vi})),r.d(f,"lerp",(function(){return Hi})),r.d(f,"invert",(function(){return zi})),r.d(f,"conjugate",(function(){return Wi})),r.d(f,"length",(function(){return Yi})),r.d(f,"len",(function(){return Xi})),r.d(f,"squaredLength",(function(){return Qi})),r.d(f,"sqrLen",(function(){return Zi})),r.d(f,"normalize",(function(){return Ji})),r.d(f,"str",(function(){return $i})),r.d(f,"exactEquals",(function(){return Ki})),r.d(f,"equals",(function(){return to}));var h={};r.r(h),r.d(h,"create",(function(){return eo})),r.d(h,"clone",(function(){return ro})),r.d(h,"fromValues",(function(){return no})),r.d(h,"copy",(function(){return io})),r.d(h,"set",(function(){return oo})),r.d(h,"add",(function(){return ao})),r.d(h,"subtract",(function(){return uo})),r.d(h,"multiply",(function(){return so})),r.d(h,"divide",(function(){return lo})),r.d(h,"ceil",(function(){return co})),r.d(h,"floor",(function(){return fo})),r.d(h,"min",(function(){return ho})),r.d(h,"max",(function(){return vo})),r.d(h,"round",(function(){return go})),r.d(h,"scale",(function(){return po})),r.d(h,"scaleAndAdd",(function(){return mo})),r.d(h,"distance",(function(){return xo})),r.d(h,"squaredDistance",(function(){return yo})),r.d(h,"length",(function(){return bo})),r.d(h,"squaredLength",(function(){return Mo})),r.d(h,"negate",(function(){return _o})),r.d(h,"inverse",(function(){return So})),r.d(h,"normalize",(function(){return wo})),r.d(h,"dot",(function(){return Eo})),r.d(h,"cross",(function(){return Co})),r.d(h,"lerp",(function(){return Oo})),r.d(h,"random",(function(){return ko})),r.d(h,"transformMat2",(function(){return Ao})),r.d(h,"transformMat2d",(function(){return Ro})),r.d(h,"transformMat3",(function(){return To})),r.d(h,"transformMat4",(function(){return Lo})),r.d(h,"rotate",(function(){return Do})),r.d(h,"angle",(function(){return Io})),r.d(h,"zero",(function(){return Fo})),r.d(h,"str",(function(){return Uo})),r.d(h,"exactEquals",(function(){return Po})),r.d(h,"equals",(function(){return Bo})),r.d(h,"len",(function(){return No})),r.d(h,"sub",(function(){return Go})),r.d(h,"mul",(function(){return qo})),r.d(h,"div",(function(){return jo})),r.d(h,"dist",(function(){return Vo})),r.d(h,"sqrDist",(function(){return Ho})),r.d(h,"sqrLen",(function(){return zo})),r.d(h,"forEach",(function(){return Wo}));var d=1e-6,v="undefined"!=typeof Float32Array?Float32Array:Array,g=Math.random;function p(t){v=t}var m=Math.PI/180;function x(t){return t*m}function y(t,e){return Math.abs(t-e)<=d*Math.max(1,Math.abs(t),Math.abs(e))}function b(){var t=new v(4);return v!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function M(t){var e=new v(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function _(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function S(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function w(t,e,r,n){var i=new v(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function E(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function C(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function O(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null}function k(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function A(t){return t[0]*t[3]-t[2]*t[1]}function R(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=r[0],s=r[1],l=r[2],c=r[3];return t[0]=n*u+o*s,t[1]=i*u+a*s,t[2]=n*l+o*c,t[3]=i*l+a*c,t}function T(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=Math.sin(r),s=Math.cos(r);return t[0]=n*s+o*u,t[1]=i*s+a*u,t[2]=n*-u+o*s,t[3]=i*-u+a*s,t}function L(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=r[0],s=r[1];return t[0]=n*u,t[1]=i*u,t[2]=o*s,t[3]=a*s,t}function D(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t}function I(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function F(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function U(t){return Math.hypot(t[0],t[1],t[2],t[3])}function P(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]}function B(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function N(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function G(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function q(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],u=e[1],s=e[2],l=e[3];return Math.abs(r-a)<=d*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-u)<=d*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(i-s)<=d*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-l)<=d*Math.max(1,Math.abs(o),Math.abs(l))}function j(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function V(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var H=R,z=N;function W(){var t=new v(6);return v!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function Y(t){var e=new v(6);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}function X(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}function Q(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Z(t,e,r,n,i,o){var a=new v(6);return a[0]=t,a[1]=e,a[2]=r,a[3]=n,a[4]=i,a[5]=o,a}function J(t,e,r,n,i,o,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t}function $(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=r*o-n*i;return s?(s=1/s,t[0]=o*s,t[1]=-n*s,t[2]=-i*s,t[3]=r*s,t[4]=(i*u-o*a)*s,t[5]=(n*a-r*u)*s,t):null}function K(t){return t[0]*t[3]-t[1]*t[2]}function tt(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=r[0],c=r[1],f=r[2],h=r[3],d=r[4],v=r[5];return t[0]=n*l+o*c,t[1]=i*l+a*c,t[2]=n*f+o*h,t[3]=i*f+a*h,t[4]=n*d+o*v+u,t[5]=i*d+a*v+s,t}function et(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=Math.sin(r),c=Math.cos(r);return t[0]=n*c+o*l,t[1]=i*c+a*l,t[2]=n*-l+o*c,t[3]=i*-l+a*c,t[4]=u,t[5]=s,t}function rt(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=r[0],c=r[1];return t[0]=n*l,t[1]=i*l,t[2]=o*c,t[3]=a*c,t[4]=u,t[5]=s,t}function nt(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=r[0],c=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=n*l+o*c+u,t[5]=i*l+a*c+s,t}function it(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t}function ot(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function at(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function ut(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function st(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)}function lt(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t}function ct(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t}function ft(t,e,r){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]*r,t[5]=e[5]*r,t}function ht(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t}function dt(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]}function vt(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=e[0],l=e[1],c=e[2],f=e[3],h=e[4],v=e[5];return Math.abs(r-s)<=d*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=d*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(i-c)<=d*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-f)<=d*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(a-h)<=d*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(u-v)<=d*Math.max(1,Math.abs(u),Math.abs(v))}var gt=tt,pt=ct;function mt(){var t=new v(9);return v!=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 xt(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 yt(t){var e=new v(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 bt(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 Mt(t,e,r,n,i,o,a,u,s){var l=new v(9);return l[0]=t,l[1]=e,l[2]=r,l[3]=n,l[4]=i,l[5]=o,l[6]=a,l[7]=u,l[8]=s,l}function _t(t,e,r,n,i,o,a,u,s,l){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=u,t[7]=s,t[8]=l,t}function St(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 wt(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,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 Et(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],l=e[7],c=e[8],f=c*a-u*l,h=-c*o+u*s,d=l*o-a*s,v=r*f+n*h+i*d;return v?(v=1/v,t[0]=f*v,t[1]=(-c*n+i*l)*v,t[2]=(u*n-i*a)*v,t[3]=h*v,t[4]=(c*r-i*s)*v,t[5]=(-u*r+i*o)*v,t[6]=d*v,t[7]=(-l*r+n*s)*v,t[8]=(a*r-n*o)*v,t):null}function Ct(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],l=e[7],c=e[8];return t[0]=a*c-u*l,t[1]=i*l-n*c,t[2]=n*u-i*a,t[3]=u*s-o*c,t[4]=r*c-i*s,t[5]=i*o-r*u,t[6]=o*l-a*s,t[7]=n*s-r*l,t[8]=r*a-n*o,t}function Ot(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],u=t[6],s=t[7],l=t[8];return e*(l*o-a*s)+r*(-l*i+a*u)+n*(s*i-o*u)}function kt(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=e[8],h=r[0],d=r[1],v=r[2],g=r[3],p=r[4],m=r[5],x=r[6],y=r[7],b=r[8];return t[0]=h*n+d*a+v*l,t[1]=h*i+d*u+v*c,t[2]=h*o+d*s+v*f,t[3]=g*n+p*a+m*l,t[4]=g*i+p*u+m*c,t[5]=g*o+p*s+m*f,t[6]=x*n+y*a+b*l,t[7]=x*i+y*u+b*c,t[8]=x*o+y*s+b*f,t}function At(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=e[8],h=r[0],d=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=s,t[6]=h*n+d*a+l,t[7]=h*i+d*u+c,t[8]=h*o+d*s+f,t}function Rt(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=e[8],h=Math.sin(r),d=Math.cos(r);return t[0]=d*n+h*a,t[1]=d*i+h*u,t[2]=d*o+h*s,t[3]=d*a-h*n,t[4]=d*u-h*i,t[5]=d*s-h*o,t[6]=l,t[7]=c,t[8]=f,t}function Tt(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*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 Lt(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 Dt(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function It(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 Ft(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 Ut(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,u=n+n,s=i+i,l=r*a,c=n*a,f=n*u,h=i*a,d=i*u,v=i*s,g=o*a,p=o*u,m=o*s;return t[0]=1-f-v,t[3]=c-m,t[6]=h+p,t[1]=c+m,t[4]=1-l-v,t[7]=d-g,t[2]=h-p,t[5]=d+g,t[8]=1-l-f,t}function Pt(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],l=e[7],c=e[8],f=e[9],h=e[10],d=e[11],v=e[12],g=e[13],p=e[14],m=e[15],x=r*u-n*a,y=r*s-i*a,b=r*l-o*a,M=n*s-i*u,_=n*l-o*u,S=i*l-o*s,w=c*g-f*v,E=c*p-h*v,C=c*m-d*v,O=f*p-h*g,k=f*m-d*g,A=h*m-d*p,R=x*A-y*k+b*O+M*C-_*E+S*w;return R?(R=1/R,t[0]=(u*A-s*k+l*O)*R,t[1]=(s*C-a*A-l*E)*R,t[2]=(a*k-u*C+l*w)*R,t[3]=(i*k-n*A-o*O)*R,t[4]=(r*A-i*C+o*E)*R,t[5]=(n*C-r*k-o*w)*R,t[6]=(g*S-p*_+m*M)*R,t[7]=(p*b-v*S-m*y)*R,t[8]=(v*_-g*b+m*x)*R,t):null}function Bt(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function Nt(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function Gt(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function qt(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t}function jt(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t}function Vt(t,e,r){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]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t}function Ht(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t}function zt(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 Wt(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=t[6],l=t[7],c=t[8],f=e[0],h=e[1],v=e[2],g=e[3],p=e[4],m=e[5],x=e[6],y=e[7],b=e[8];return Math.abs(r-f)<=d*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(n-h)<=d*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-v)<=d*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-g)<=d*Math.max(1,Math.abs(o),Math.abs(g))&&Math.abs(a-p)<=d*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(u-m)<=d*Math.max(1,Math.abs(u),Math.abs(m))&&Math.abs(s-x)<=d*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(l-y)<=d*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(c-b)<=d*Math.max(1,Math.abs(c),Math.abs(b))}var Yt=kt,Xt=jt;function Qt(){var t=new v(16);return v!=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 Zt(t){var e=new v(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 Jt(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 $t(t,e,r,n,i,o,a,u,s,l,c,f,h,d,g,p){var m=new v(16);return m[0]=t,m[1]=e,m[2]=r,m[3]=n,m[4]=i,m[5]=o,m[6]=a,m[7]=u,m[8]=s,m[9]=l,m[10]=c,m[11]=f,m[12]=h,m[13]=d,m[14]=g,m[15]=p,m}function Kt(t,e,r,n,i,o,a,u,s,l,c,f,h,d,v,g,p){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=u,t[7]=s,t[8]=l,t[9]=c,t[10]=f,t[11]=h,t[12]=d,t[13]=v,t[14]=g,t[15]=p,t}function te(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 ee(t,e){if(t===e){var r=e[1],n=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]=r,t[6]=e[9],t[7]=e[13],t[8]=n,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 re(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],l=e[7],c=e[8],f=e[9],h=e[10],d=e[11],v=e[12],g=e[13],p=e[14],m=e[15],x=r*u-n*a,y=r*s-i*a,b=r*l-o*a,M=n*s-i*u,_=n*l-o*u,S=i*l-o*s,w=c*g-f*v,E=c*p-h*v,C=c*m-d*v,O=f*p-h*g,k=f*m-d*g,A=h*m-d*p,R=x*A-y*k+b*O+M*C-_*E+S*w;return R?(R=1/R,t[0]=(u*A-s*k+l*O)*R,t[1]=(i*k-n*A-o*O)*R,t[2]=(g*S-p*_+m*M)*R,t[3]=(h*_-f*S-d*M)*R,t[4]=(s*C-a*A-l*E)*R,t[5]=(r*A-i*C+o*E)*R,t[6]=(p*b-v*S-m*y)*R,t[7]=(c*S-h*b+d*y)*R,t[8]=(a*k-u*C+l*w)*R,t[9]=(n*C-r*k-o*w)*R,t[10]=(v*_-g*b+m*x)*R,t[11]=(f*b-c*_-d*x)*R,t[12]=(u*E-a*O-s*w)*R,t[13]=(r*O-n*E+i*w)*R,t[14]=(g*y-v*M-p*x)*R,t[15]=(c*M-f*y+h*x)*R,t):null}function ne(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],l=e[7],c=e[8],f=e[9],h=e[10],d=e[11],v=e[12],g=e[13],p=e[14],m=e[15];return t[0]=u*(h*m-d*p)-f*(s*m-l*p)+g*(s*d-l*h),t[1]=-(n*(h*m-d*p)-f*(i*m-o*p)+g*(i*d-o*h)),t[2]=n*(s*m-l*p)-u*(i*m-o*p)+g*(i*l-o*s),t[3]=-(n*(s*d-l*h)-u*(i*d-o*h)+f*(i*l-o*s)),t[4]=-(a*(h*m-d*p)-c*(s*m-l*p)+v*(s*d-l*h)),t[5]=r*(h*m-d*p)-c*(i*m-o*p)+v*(i*d-o*h),t[6]=-(r*(s*m-l*p)-a*(i*m-o*p)+v*(i*l-o*s)),t[7]=r*(s*d-l*h)-a*(i*d-o*h)+c*(i*l-o*s),t[8]=a*(f*m-d*g)-c*(u*m-l*g)+v*(u*d-l*f),t[9]=-(r*(f*m-d*g)-c*(n*m-o*g)+v*(n*d-o*f)),t[10]=r*(u*m-l*g)-a*(n*m-o*g)+v*(n*l-o*u),t[11]=-(r*(u*d-l*f)-a*(n*d-o*f)+c*(n*l-o*u)),t[12]=-(a*(f*p-h*g)-c*(u*p-s*g)+v*(u*h-s*f)),t[13]=r*(f*p-h*g)-c*(n*p-i*g)+v*(n*h-i*f),t[14]=-(r*(u*p-s*g)-a*(n*p-i*g)+v*(n*s-i*u)),t[15]=r*(u*h-s*f)-a*(n*h-i*f)+c*(n*s-i*u),t}function ie(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],u=t[6],s=t[7],l=t[8],c=t[9],f=t[10],h=t[11],d=t[12],v=t[13],g=t[14],p=t[15];return(e*a-r*o)*(f*p-h*g)-(e*u-n*o)*(c*p-h*v)+(e*s-i*o)*(c*g-f*v)+(r*u-n*a)*(l*p-h*d)-(r*s-i*a)*(l*g-f*d)+(n*s-i*u)*(l*v-c*d)}function oe(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=e[8],h=e[9],d=e[10],v=e[11],g=e[12],p=e[13],m=e[14],x=e[15],y=r[0],b=r[1],M=r[2],_=r[3];return t[0]=y*n+b*u+M*f+_*g,t[1]=y*i+b*s+M*h+_*p,t[2]=y*o+b*l+M*d+_*m,t[3]=y*a+b*c+M*v+_*x,y=r[4],b=r[5],M=r[6],_=r[7],t[4]=y*n+b*u+M*f+_*g,t[5]=y*i+b*s+M*h+_*p,t[6]=y*o+b*l+M*d+_*m,t[7]=y*a+b*c+M*v+_*x,y=r[8],b=r[9],M=r[10],_=r[11],t[8]=y*n+b*u+M*f+_*g,t[9]=y*i+b*s+M*h+_*p,t[10]=y*o+b*l+M*d+_*m,t[11]=y*a+b*c+M*v+_*x,y=r[12],b=r[13],M=r[14],_=r[15],t[12]=y*n+b*u+M*f+_*g,t[13]=y*i+b*s+M*h+_*p,t[14]=y*o+b*l+M*d+_*m,t[15]=y*a+b*c+M*v+_*x,t}function ae(t,e,r){var n,i,o,a,u,s,l,c,f,h,d,v,g=r[0],p=r[1],m=r[2];return e===t?(t[12]=e[0]*g+e[4]*p+e[8]*m+e[12],t[13]=e[1]*g+e[5]*p+e[9]*m+e[13],t[14]=e[2]*g+e[6]*p+e[10]*m+e[14],t[15]=e[3]*g+e[7]*p+e[11]*m+e[15]):(n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=e[8],h=e[9],d=e[10],v=e[11],t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=s,t[6]=l,t[7]=c,t[8]=f,t[9]=h,t[10]=d,t[11]=v,t[12]=n*g+u*p+f*m+e[12],t[13]=i*g+s*p+h*m+e[13],t[14]=o*g+l*p+d*m+e[14],t[15]=a*g+c*p+v*m+e[15]),t}function ue(t,e,r){var n=r[0],i=r[1],o=r[2];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]*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 se(t,e,r,n){var i,o,a,u,s,l,c,f,h,v,g,p,m,x,y,b,M,_,S,w,E,C,O,k,A=n[0],R=n[1],T=n[2],L=Math.hypot(A,R,T);return L<d?null:(A*=L=1/L,R*=L,T*=L,i=Math.sin(r),a=1-(o=Math.cos(r)),u=e[0],s=e[1],l=e[2],c=e[3],f=e[4],h=e[5],v=e[6],g=e[7],p=e[8],m=e[9],x=e[10],y=e[11],b=A*A*a+o,M=R*A*a+T*i,_=T*A*a-R*i,S=A*R*a-T*i,w=R*R*a+o,E=T*R*a+A*i,C=A*T*a+R*i,O=R*T*a-A*i,k=T*T*a+o,t[0]=u*b+f*M+p*_,t[1]=s*b+h*M+m*_,t[2]=l*b+v*M+x*_,t[3]=c*b+g*M+y*_,t[4]=u*S+f*w+p*E,t[5]=s*S+h*w+m*E,t[6]=l*S+v*w+x*E,t[7]=c*S+g*w+y*E,t[8]=u*C+f*O+p*k,t[9]=s*C+h*O+m*k,t[10]=l*C+v*O+x*k,t[11]=c*C+g*O+y*k,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function le(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],u=e[6],s=e[7],l=e[8],c=e[9],f=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+l*n,t[5]=a*i+c*n,t[6]=u*i+f*n,t[7]=s*i+h*n,t[8]=l*i-o*n,t[9]=c*i-a*n,t[10]=f*i-u*n,t[11]=h*i-s*n,t}function ce(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],u=e[2],s=e[3],l=e[8],c=e[9],f=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-l*n,t[1]=a*i-c*n,t[2]=u*i-f*n,t[3]=s*i-h*n,t[8]=o*n+l*i,t[9]=a*n+c*i,t[10]=u*n+f*i,t[11]=s*n+h*i,t}function fe(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],u=e[2],s=e[3],l=e[4],c=e[5],f=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+l*n,t[1]=a*i+c*n,t[2]=u*i+f*n,t[3]=s*i+h*n,t[4]=l*i-o*n,t[5]=c*i-a*n,t[6]=f*i-u*n,t[7]=h*i-s*n,t}function he(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 de(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 ve(t,e,r){var n,i,o,a=r[0],u=r[1],s=r[2],l=Math.hypot(a,u,s);return l<d?null:(a*=l=1/l,u*=l,s*=l,n=Math.sin(e),o=1-(i=Math.cos(e)),t[0]=a*a*o+i,t[1]=u*a*o+s*n,t[2]=s*a*o-u*n,t[3]=0,t[4]=a*u*o-s*n,t[5]=u*u*o+i,t[6]=s*u*o+a*n,t[7]=0,t[8]=a*s*o+u*n,t[9]=u*s*o-a*n,t[10]=s*s*o+i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function ge(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function pe(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function me(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,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 xe(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=n+n,s=i+i,l=o+o,c=n*u,f=n*s,h=n*l,d=i*s,v=i*l,g=o*l,p=a*u,m=a*s,x=a*l;return t[0]=1-(d+g),t[1]=f+x,t[2]=h-m,t[3]=0,t[4]=f-x,t[5]=1-(c+g),t[6]=v+p,t[7]=0,t[8]=h+m,t[9]=v-p,t[10]=1-(c+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function ye(t,e){var r=new v(3),n=-e[0],i=-e[1],o=-e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=n*n+i*i+o*o+a*a;return f>0?(r[0]=2*(u*a+c*n+s*o-l*i)/f,r[1]=2*(s*a+c*i+l*n-u*o)/f,r[2]=2*(l*a+c*o+u*i-s*n)/f):(r[0]=2*(u*a+c*n+s*o-l*i),r[1]=2*(s*a+c*i+l*n-u*o),r[2]=2*(l*a+c*o+u*i-s*n)),xe(t,e,r),t}function be(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Me(t,e){var r=e[0],n=e[1],i=e[2],o=e[4],a=e[5],u=e[6],s=e[8],l=e[9],c=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(o,a,u),t[2]=Math.hypot(s,l,c),t}function _e(t,e){var r=new v(3);Me(r,e);var n=1/r[0],i=1/r[1],o=1/r[2],a=e[0]*n,u=e[1]*i,s=e[2]*o,l=e[4]*n,c=e[5]*i,f=e[6]*o,h=e[8]*n,d=e[9]*i,g=e[10]*o,p=a+c+g,m=0;return p>0?(m=2*Math.sqrt(p+1),t[3]=.25*m,t[0]=(f-d)/m,t[1]=(h-s)/m,t[2]=(u-l)/m):a>c&&a>g?(m=2*Math.sqrt(1+a-c-g),t[3]=(f-d)/m,t[0]=.25*m,t[1]=(u+l)/m,t[2]=(h+s)/m):c>g?(m=2*Math.sqrt(1+c-a-g),t[3]=(h-s)/m,t[0]=(u+l)/m,t[1]=.25*m,t[2]=(f+d)/m):(m=2*Math.sqrt(1+g-a-c),t[3]=(u-l)/m,t[0]=(h+s)/m,t[1]=(f+d)/m,t[2]=.25*m),t}function Se(t,e,r,n){var i=e[0],o=e[1],a=e[2],u=e[3],s=i+i,l=o+o,c=a+a,f=i*s,h=i*l,d=i*c,v=o*l,g=o*c,p=a*c,m=u*s,x=u*l,y=u*c,b=n[0],M=n[1],_=n[2];return t[0]=(1-(v+p))*b,t[1]=(h+y)*b,t[2]=(d-x)*b,t[3]=0,t[4]=(h-y)*M,t[5]=(1-(f+p))*M,t[6]=(g+m)*M,t[7]=0,t[8]=(d+x)*_,t[9]=(g-m)*_,t[10]=(1-(f+v))*_,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function we(t,e,r,n,i){var o=e[0],a=e[1],u=e[2],s=e[3],l=o+o,c=a+a,f=u+u,h=o*l,d=o*c,v=o*f,g=a*c,p=a*f,m=u*f,x=s*l,y=s*c,b=s*f,M=n[0],_=n[1],S=n[2],w=i[0],E=i[1],C=i[2],O=(1-(g+m))*M,k=(d+b)*M,A=(v-y)*M,R=(d-b)*_,T=(1-(h+m))*_,L=(p+x)*_,D=(v+y)*S,I=(p-x)*S,F=(1-(h+g))*S;return t[0]=O,t[1]=k,t[2]=A,t[3]=0,t[4]=R,t[5]=T,t[6]=L,t[7]=0,t[8]=D,t[9]=I,t[10]=F,t[11]=0,t[12]=r[0]+w-(O*w+R*E+D*C),t[13]=r[1]+E-(k*w+T*E+I*C),t[14]=r[2]+C-(A*w+L*E+F*C),t[15]=1,t}function Ee(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,u=n+n,s=i+i,l=r*a,c=n*a,f=n*u,h=i*a,d=i*u,v=i*s,g=o*a,p=o*u,m=o*s;return t[0]=1-f-v,t[1]=c+m,t[2]=h-p,t[3]=0,t[4]=c-m,t[5]=1-l-v,t[6]=d+g,t[7]=0,t[8]=h+p,t[9]=d-g,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ce(t,e,r,n,i,o,a){var u=1/(r-e),s=1/(i-n),l=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]=(r+e)*u,t[9]=(i+n)*s,t[10]=(a+o)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*l,t[15]=0,t}function Oe(t,e,r,n,i){var o,a=1/Math.tan(e/2);return t[0]=a/r,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/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n),t}function ke(t,e,r,n){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),l=2/(i+o);return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-(a-u)*s*.5,t[9]=(i-o)*l*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function Ae(t,e,r,n,i,o,a){var u=1/(e-r),s=1/(n-i),l=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*l,t[11]=0,t[12]=(e+r)*u,t[13]=(i+n)*s,t[14]=(a+o)*l,t[15]=1,t}function Re(t,e,r,n){var i,o,a,u,s,l,c,f,h,v,g=e[0],p=e[1],m=e[2],x=n[0],y=n[1],b=n[2],M=r[0],_=r[1],S=r[2];return Math.abs(g-M)<d&&Math.abs(p-_)<d&&Math.abs(m-S)<d?te(t):(c=g-M,f=p-_,h=m-S,i=y*(h*=v=1/Math.hypot(c,f,h))-b*(f*=v),o=b*(c*=v)-x*h,a=x*f-y*c,(v=Math.hypot(i,o,a))?(i*=v=1/v,o*=v,a*=v):(i=0,o=0,a=0),u=f*a-h*o,s=h*i-c*a,l=c*o-f*i,(v=Math.hypot(u,s,l))?(u*=v=1/v,s*=v,l*=v):(u=0,s=0,l=0),t[0]=i,t[1]=u,t[2]=c,t[3]=0,t[4]=o,t[5]=s,t[6]=f,t[7]=0,t[8]=a,t[9]=l,t[10]=h,t[11]=0,t[12]=-(i*g+o*p+a*m),t[13]=-(u*g+s*p+l*m),t[14]=-(c*g+f*p+h*m),t[15]=1,t)}function Te(t,e,r,n){var i=e[0],o=e[1],a=e[2],u=n[0],s=n[1],l=n[2],c=i-r[0],f=o-r[1],h=a-r[2],d=c*c+f*f+h*h;d>0&&(c*=d=1/Math.sqrt(d),f*=d,h*=d);var v=s*h-l*f,g=l*c-u*h,p=u*f-s*c;return(d=v*v+g*g+p*p)>0&&(v*=d=1/Math.sqrt(d),g*=d,p*=d),t[0]=v,t[1]=g,t[2]=p,t[3]=0,t[4]=f*p-h*g,t[5]=h*v-c*p,t[6]=c*g-f*v,t[7]=0,t[8]=c,t[9]=f,t[10]=h,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t}function Le(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 De(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 Ie(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function Fe(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function Ue(t,e,r){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]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function Pe(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function Be(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 Ne(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=t[6],l=t[7],c=t[8],f=t[9],h=t[10],v=t[11],g=t[12],p=t[13],m=t[14],x=t[15],y=e[0],b=e[1],M=e[2],_=e[3],S=e[4],w=e[5],E=e[6],C=e[7],O=e[8],k=e[9],A=e[10],R=e[11],T=e[12],L=e[13],D=e[14],I=e[15];return Math.abs(r-y)<=d*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(n-b)<=d*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-M)<=d*Math.max(1,Math.abs(i),Math.abs(M))&&Math.abs(o-_)<=d*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(a-S)<=d*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(u-w)<=d*Math.max(1,Math.abs(u),Math.abs(w))&&Math.abs(s-E)<=d*Math.max(1,Math.abs(s),Math.abs(E))&&Math.abs(l-C)<=d*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(c-O)<=d*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(f-k)<=d*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(h-A)<=d*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(v-R)<=d*Math.max(1,Math.abs(v),Math.abs(R))&&Math.abs(g-T)<=d*Math.max(1,Math.abs(g),Math.abs(T))&&Math.abs(p-L)<=d*Math.max(1,Math.abs(p),Math.abs(L))&&Math.abs(m-D)<=d*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(x-I)<=d*Math.max(1,Math.abs(x),Math.abs(I))}var Ge=oe,qe=Fe;function je(){var t=new v(3);return v!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Ve(t){var e=new v(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function He(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function ze(t,e,r){var n=new v(3);return n[0]=t,n[1]=e,n[2]=r,n}function We(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ye(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function Xe(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function Qe(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function Ze(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function Je(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function $e(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function Ke(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function tr(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function er(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function rr(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function nr(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function ir(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function or(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.hypot(r,n,i)}function ar(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}function ur(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function sr(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function lr(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function cr(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+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 fr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function hr(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],u=r[1],s=r[2];return t[0]=i*s-o*u,t[1]=o*a-n*s,t[2]=n*u-i*a,t}function dr(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t}function vr(t,e,r,n,i,o){var a=o*o,u=a*(2*o-3)+1,s=a*(o-2)+o,l=a*(o-1),c=a*(3-2*o);return t[0]=e[0]*u+r[0]*s+n[0]*l+i[0]*c,t[1]=e[1]*u+r[1]*s+n[1]*l+i[1]*c,t[2]=e[2]*u+r[2]*s+n[2]*l+i[2]*c,t}function gr(t,e,r,n,i,o){var a=1-o,u=a*a,s=o*o,l=u*a,c=3*o*u,f=3*s*a,h=s*o;return t[0]=e[0]*l+r[0]*c+n[0]*f+i[0]*h,t[1]=e[1]*l+r[1]*c+n[1]*f+i[1]*h,t[2]=e[2]*l+r[2]*c+n[2]*f+i[2]*h,t}function pr(t,e){e=e||1;var r=2*g()*Math.PI,n=2*g()-1,i=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=n*e,t}function mr(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t}function xr(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t}function yr(t,e,r){var n=r[0],i=r[1],o=r[2],a=r[3],u=e[0],s=e[1],l=e[2],c=i*l-o*s,f=o*u-n*l,h=n*s-i*u,d=i*h-o*f,v=o*c-n*h,g=n*f-i*c,p=2*a;return c*=p,f*=p,h*=p,d*=2,v*=2,g*=2,t[0]=u+c+d,t[1]=s+f+v,t[2]=l+h+g,t}function br(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function Mr(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function _r(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function Sr(t,e){var r=t[0],n=t[1],i=t[2],o=e[0],a=e[1],u=e[2],s=Math.sqrt(r*r+n*n+i*i)*Math.sqrt(o*o+a*a+u*u),l=s&&fr(t,e)/s;return Math.acos(Math.min(Math.max(l,-1),1))}function wr(t){return t[0]=0,t[1]=0,t[2]=0,t}function Er(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function Cr(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function Or(t,e){var r=t[0],n=t[1],i=t[2],o=e[0],a=e[1],u=e[2];return Math.abs(r-o)<=d*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-a)<=d*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-u)<=d*Math.max(1,Math.abs(i),Math.abs(u))}var kr,Ar=Qe,Rr=Ze,Tr=Je,Lr=or,Dr=ar,Ir=He,Fr=ur,Ur=(kr=je(),function(t,e,r,n,i,o){var a,u;for(e||(e=3),r||(r=0),u=n?Math.min(n*e+r,t.length):t.length,a=r;a<u;a+=e)kr[0]=t[a],kr[1]=t[a+1],kr[2]=t[a+2],i(kr,kr,o),t[a]=kr[0],t[a+1]=kr[1],t[a+2]=kr[2];return t});function Pr(){var t=new v(4);return v!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Br(t){var e=new v(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Nr(t,e,r,n){var i=new v(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Gr(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function qr(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function jr(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function Vr(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function Hr(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function zr(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function Wr(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 Yr(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 Xr(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function Qr(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function Zr(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 Jr(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function $r(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}function Kr(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(r,n,i,o)}function tn(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function en(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function rn(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function nn(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function on(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 an(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a,t}function un(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function sn(t,e,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],u=r[1]*n[2]-r[2]*n[1],s=r[1]*n[3]-r[3]*n[1],l=r[2]*n[3]-r[3]*n[2],c=e[0],f=e[1],h=e[2],d=e[3];return t[0]=f*l-h*s+d*u,t[1]=-c*l+h*a-d*o,t[2]=c*s-f*a+d*i,t[3]=-c*u+f*o-h*i,t}function ln(t,e,r,n){var i=e[0],o=e[1],a=e[2],u=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=u+n*(r[3]-u),t}function cn(t,e){var r,n,i,o,a,u;e=e||1;do{a=(r=2*g()-1)*r+(n=2*g()-1)*n}while(a>=1);do{u=(i=2*g()-1)*i+(o=2*g()-1)*o}while(u>=1);var s=Math.sqrt((1-a)/u);return t[0]=e*r,t[1]=e*n,t[2]=e*i*s,t[3]=e*o*s,t}function fn(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function hn(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],u=r[1],s=r[2],l=r[3],c=l*n+u*o-s*i,f=l*i+s*n-a*o,h=l*o+a*i-u*n,d=-a*n-u*i-s*o;return t[0]=c*l+d*-a+f*-s-h*-u,t[1]=f*l+d*-u+h*-a-c*-s,t[2]=h*l+d*-s+c*-u-f*-a,t[3]=e[3],t}function dn(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function vn(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function gn(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function pn(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],u=e[1],s=e[2],l=e[3];return Math.abs(r-a)<=d*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-u)<=d*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(i-s)<=d*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(o-l)<=d*Math.max(1,Math.abs(o),Math.abs(l))}var mn=Vr,xn=Hr,yn=zr,bn=Kr,Mn=tn,_n=en,Sn=rn,wn=function(){var t=Pr();return function(e,r,n,i,o,a){var u,s;for(r||(r=4),n||(n=0),s=i?Math.min(i*r+n,e.length):e.length,u=n;u<s;u+=r)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 En(){var t=new v(4);return v!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Cn(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function On(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function kn(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return n>d?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r}function An(t,e){var r=ii(t,e);return Math.acos(2*r*r-1)}function Rn(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=r[0],s=r[1],l=r[2],c=r[3];return t[0]=n*c+a*u+i*l-o*s,t[1]=i*c+a*s+o*u-n*l,t[2]=o*c+a*l+n*s-i*u,t[3]=a*c-n*u-i*s-o*l,t}function Tn(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],u=Math.sin(r),s=Math.cos(r);return t[0]=n*s+a*u,t[1]=i*s+o*u,t[2]=o*s-i*u,t[3]=a*s-n*u,t}function Ln(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],u=Math.sin(r),s=Math.cos(r);return t[0]=n*s-o*u,t[1]=i*s+a*u,t[2]=o*s+n*u,t[3]=a*s-i*u,t}function Dn(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],u=Math.sin(r),s=Math.cos(r);return t[0]=n*s+i*u,t[1]=i*s-n*u,t[2]=o*s+a*u,t[3]=a*s-o*u,t}function In(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t}function Fn(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=Math.sqrt(r*r+n*n+i*i),u=Math.exp(o),s=a>0?u*Math.sin(a)/a:0;return t[0]=r*s,t[1]=n*s,t[2]=i*s,t[3]=u*Math.cos(a),t}function Un(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=Math.sqrt(r*r+n*n+i*i),u=a>0?Math.atan2(a,o)/a:0;return t[0]=r*u,t[1]=n*u,t[2]=i*u,t[3]=.5*Math.log(r*r+n*n+i*i+o*o),t}function Pn(t,e,r){return Un(t,e),ni(t,t,r),Fn(t,t),t}function Bn(t,e,r,n){var i,o,a,u,s,l=e[0],c=e[1],f=e[2],h=e[3],v=r[0],g=r[1],p=r[2],m=r[3];return(o=l*v+c*g+f*p+h*m)<0&&(o=-o,v=-v,g=-g,p=-p,m=-m),1-o>d?(i=Math.acos(o),a=Math.sin(i),u=Math.sin((1-n)*i)/a,s=Math.sin(n*i)/a):(u=1-n,s=n),t[0]=u*l+s*v,t[1]=u*c+s*g,t[2]=u*f+s*p,t[3]=u*h+s*m,t}function Nn(t){var e=g(),r=g(),n=g(),i=Math.sqrt(1-e),o=Math.sqrt(e);return t[0]=i*Math.sin(2*Math.PI*r),t[1]=i*Math.cos(2*Math.PI*r),t[2]=o*Math.sin(2*Math.PI*n),t[3]=o*Math.cos(2*Math.PI*n),t}function Gn(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o,u=a?1/a:0;return t[0]=-r*u,t[1]=-n*u,t[2]=-i*u,t[3]=o*u,t}function qn(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function jn(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;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;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+a]-e[3*a+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[a]=(e[3*a+i]+e[3*i+a])*r}return t}function Vn(t,e,r,n){var i=.5*Math.PI/180;e*=i,r*=i,n*=i;var o=Math.sin(e),a=Math.cos(e),u=Math.sin(r),s=Math.cos(r),l=Math.sin(n),c=Math.cos(n);return t[0]=o*s*c-a*u*l,t[1]=a*u*c+o*s*l,t[2]=a*s*l-o*u*c,t[3]=a*s*c+o*u*l,t}function Hn(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var zn,Wn,Yn,Xn,Qn,Zn,Jn=Br,$n=Nr,Kn=Gr,ti=qr,ei=jr,ri=Rn,ni=Jr,ii=un,oi=ln,ai=en,ui=ai,si=rn,li=si,ci=an,fi=gn,hi=pn,di=(zn=je(),Wn=ze(1,0,0),Yn=ze(0,1,0),function(t,e,r){var n=fr(e,r);return n<-.999999?(hr(zn,Wn,e),Ir(zn)<1e-6&&hr(zn,Yn,e),cr(zn,zn),On(t,zn,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(hr(zn,e,r),t[0]=zn[0],t[1]=zn[1],t[2]=zn[2],t[3]=1+n,ci(t,t))}),vi=(Xn=En(),Qn=En(),function(t,e,r,n,i,o){return Bn(Xn,e,i,o),Bn(Qn,r,n,o),Bn(t,Xn,Qn,2*o*(1-o)),t}),gi=(Zn=mt(),function(t,e,r,n){return Zn[0]=r[0],Zn[3]=r[1],Zn[6]=r[2],Zn[1]=n[0],Zn[4]=n[1],Zn[7]=n[2],Zn[2]=-e[0],Zn[5]=-e[1],Zn[8]=-e[2],ci(t,jn(t,Zn))});function pi(){var t=new v(8);return v!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function mi(t){var e=new v(8);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}function xi(t,e,r,n,i,o,a,u){var s=new v(8);return s[0]=t,s[1]=e,s[2]=r,s[3]=n,s[4]=i,s[5]=o,s[6]=a,s[7]=u,s}function yi(t,e,r,n,i,o,a){var u=new v(8);u[0]=t,u[1]=e,u[2]=r,u[3]=n;var s=.5*i,l=.5*o,c=.5*a;return u[4]=s*n+l*r-c*e,u[5]=l*n+c*t-s*r,u[6]=c*n+s*e-l*t,u[7]=-s*t-l*e-c*r,u}function bi(t,e,r){var n=.5*r[0],i=.5*r[1],o=.5*r[2],a=e[0],u=e[1],s=e[2],l=e[3];return t[0]=a,t[1]=u,t[2]=s,t[3]=l,t[4]=n*l+i*s-o*u,t[5]=i*l+o*a-n*s,t[6]=o*l+n*u-i*a,t[7]=-n*a-i*u-o*s,t}function Mi(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t}function _i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Si(t,e){var r=En();_e(r,e);var n=new v(3);return be(n,e),bi(t,r,n),t}function wi(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}function Ei(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Ci(t,e,r,n,i,o,a,u,s){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=u,t[7]=s,t}var Oi=Kn;function ki(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var Ai=Kn;function Ri(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function Ti(t,e){var r=e[4],n=e[5],i=e[6],o=e[7],a=-e[0],u=-e[1],s=-e[2],l=e[3];return t[0]=2*(r*l+o*a+n*s-i*u),t[1]=2*(n*l+o*u+i*a-r*s),t[2]=2*(i*l+o*s+r*u-n*a),t}function Li(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=.5*r[0],s=.5*r[1],l=.5*r[2],c=e[4],f=e[5],h=e[6],d=e[7];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=a*u+i*l-o*s+c,t[5]=a*s+o*u-n*l+f,t[6]=a*l+n*s-i*u+h,t[7]=-n*u-i*s-o*l+d,t}function Di(t,e,r){var n=-e[0],i=-e[1],o=-e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=u*a+c*n+s*o-l*i,h=s*a+c*i+l*n-u*o,d=l*a+c*o+u*i-s*n,v=c*a-u*n-s*i-l*o;return Tn(t,e,r),n=t[0],i=t[1],o=t[2],a=t[3],t[4]=f*a+v*n+h*o-d*i,t[5]=h*a+v*i+d*n-f*o,t[6]=d*a+v*o+f*i-h*n,t[7]=v*a-f*n-h*i-d*o,t}function Ii(t,e,r){var n=-e[0],i=-e[1],o=-e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=u*a+c*n+s*o-l*i,h=s*a+c*i+l*n-u*o,d=l*a+c*o+u*i-s*n,v=c*a-u*n-s*i-l*o;return Ln(t,e,r),n=t[0],i=t[1],o=t[2],a=t[3],t[4]=f*a+v*n+h*o-d*i,t[5]=h*a+v*i+d*n-f*o,t[6]=d*a+v*o+f*i-h*n,t[7]=v*a-f*n-h*i-d*o,t}function Fi(t,e,r){var n=-e[0],i=-e[1],o=-e[2],a=e[3],u=e[4],s=e[5],l=e[6],c=e[7],f=u*a+c*n+s*o-l*i,h=s*a+c*i+l*n-u*o,d=l*a+c*o+u*i-s*n,v=c*a-u*n-s*i-l*o;return Dn(t,e,r),n=t[0],i=t[1],o=t[2],a=t[3],t[4]=f*a+v*n+h*o-d*i,t[5]=h*a+v*i+d*n-f*o,t[6]=d*a+v*o+f*i-h*n,t[7]=v*a-f*n-h*i-d*o,t}function Ui(t,e,r){var n=r[0],i=r[1],o=r[2],a=r[3],u=e[0],s=e[1],l=e[2],c=e[3];return t[0]=u*a+c*n+s*o-l*i,t[1]=s*a+c*i+l*n-u*o,t[2]=l*a+c*o+u*i-s*n,t[3]=c*a-u*n-s*i-l*o,u=e[4],s=e[5],l=e[6],c=e[7],t[4]=u*a+c*n+s*o-l*i,t[5]=s*a+c*i+l*n-u*o,t[6]=l*a+c*o+u*i-s*n,t[7]=c*a-u*n-s*i-l*o,t}function Pi(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=r[0],s=r[1],l=r[2],c=r[3];return t[0]=n*c+a*u+i*l-o*s,t[1]=i*c+a*s+o*u-n*l,t[2]=o*c+a*l+n*s-i*u,t[3]=a*c-n*u-i*s-o*l,u=r[4],s=r[5],l=r[6],c=r[7],t[4]=n*c+a*u+i*l-o*s,t[5]=i*c+a*s+o*u-n*l,t[6]=o*c+a*l+n*s-i*u,t[7]=a*c-n*u-i*s-o*l,t}function Bi(t,e,r,n){if(Math.abs(n)<d)return wi(t,e);var i=Math.hypot(r[0],r[1],r[2]);n*=.5;var o=Math.sin(n),a=o*r[0]/i,u=o*r[1]/i,s=o*r[2]/i,l=Math.cos(n),c=e[0],f=e[1],h=e[2],v=e[3];t[0]=c*l+v*a+f*s-h*u,t[1]=f*l+v*u+h*a-c*s,t[2]=h*l+v*s+c*u-f*a,t[3]=v*l-c*a-f*u-h*s;var g=e[4],p=e[5],m=e[6],x=e[7];return t[4]=g*l+x*a+p*s-m*u,t[5]=p*l+x*u+m*a-g*s,t[6]=m*l+x*s+g*u-p*a,t[7]=x*l-g*a-p*u-m*s,t}function Ni(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t}function Gi(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],u=r[4],s=r[5],l=r[6],c=r[7],f=e[4],h=e[5],d=e[6],v=e[7],g=r[0],p=r[1],m=r[2],x=r[3];return t[0]=n*x+a*g+i*m-o*p,t[1]=i*x+a*p+o*g-n*m,t[2]=o*x+a*m+n*p-i*g,t[3]=a*x-n*g-i*p-o*m,t[4]=n*c+a*u+i*l-o*s+f*x+v*g+h*m-d*p,t[5]=i*c+a*s+o*u-n*l+h*x+v*p+d*g-f*m,t[6]=o*c+a*l+n*s-i*u+d*x+v*m+f*p-h*g,t[7]=a*c-n*u-i*s-o*l+v*x-f*g-h*p-d*m,t}var qi=Gi;function ji(t,e,r){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]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t}var Vi=ii;function Hi(t,e,r,n){var i=1-n;return Vi(e,r)<0&&(n=-n),t[0]=e[0]*i+r[0]*n,t[1]=e[1]*i+r[1]*n,t[2]=e[2]*i+r[2]*n,t[3]=e[3]*i+r[3]*n,t[4]=e[4]*i+r[4]*n,t[5]=e[5]*i+r[5]*n,t[6]=e[6]*i+r[6]*n,t[7]=e[7]*i+r[7]*n,t}function zi(t,e){var r=Qi(e);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]/r,t[5]=-e[5]/r,t[6]=-e[6]/r,t[7]=e[7]/r,t}function Wi(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}var Yi=ai,Xi=Yi,Qi=si,Zi=Qi;function Ji(t,e){var r=Qi(e);if(r>0){r=Math.sqrt(r);var n=e[0]/r,i=e[1]/r,o=e[2]/r,a=e[3]/r,u=e[4],s=e[5],l=e[6],c=e[7],f=n*u+i*s+o*l+a*c;t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=(u-n*f)/r,t[5]=(s-i*f)/r,t[6]=(l-o*f)/r,t[7]=(c-a*f)/r}return t}function $i(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function Ki(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]}function to(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=t[6],l=t[7],c=e[0],f=e[1],h=e[2],v=e[3],g=e[4],p=e[5],m=e[6],x=e[7];return Math.abs(r-c)<=d*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(n-f)<=d*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-h)<=d*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(o-v)<=d*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(a-g)<=d*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(u-p)<=d*Math.max(1,Math.abs(u),Math.abs(p))&&Math.abs(s-m)<=d*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-x)<=d*Math.max(1,Math.abs(l),Math.abs(x))}function eo(){var t=new v(2);return v!=Float32Array&&(t[0]=0,t[1]=0),t}function ro(t){var e=new v(2);return e[0]=t[0],e[1]=t[1],e}function no(t,e){var r=new v(2);return r[0]=t,r[1]=e,r}function io(t,e){return t[0]=e[0],t[1]=e[1],t}function oo(t,e,r){return t[0]=e,t[1]=r,t}function ao(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function uo(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function so(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function lo(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function co(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function fo(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function ho(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function vo(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function go(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function po(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function mo(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t}function xo(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.hypot(r,n)}function yo(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function bo(t){var e=t[0],r=t[1];return Math.hypot(e,r)}function Mo(t){var e=t[0],r=t[1];return e*e+r*r}function _o(t,e){return t[0]=-e[0],t[1]=-e[1],t}function So(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function wo(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function Eo(t,e){return t[0]*e[0]+t[1]*e[1]}function Co(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t}function Oo(t,e,r,n){var i=e[0],o=e[1];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t}function ko(t,e){e=e||1;var r=2*g()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function Ao(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t}function Ro(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t}function To(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t}function Lo(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}function Do(t,e,r,n){var i=e[0]-r[0],o=e[1]-r[1],a=Math.sin(n),u=Math.cos(n);return t[0]=i*u-o*a+r[0],t[1]=i*a+o*u+r[1],t}function Io(t,e){var r=t[0],n=t[1],i=e[0],o=e[1],a=Math.sqrt(r*r+n*n)*Math.sqrt(i*i+o*o),u=a&&(r*i+n*o)/a;return Math.acos(Math.min(Math.max(u,-1),1))}function Fo(t){return t[0]=0,t[1]=0,t}function Uo(t){return"vec2("+t[0]+", "+t[1]+")"}function Po(t,e){return t[0]===e[0]&&t[1]===e[1]}function Bo(t,e){var r=t[0],n=t[1],i=e[0],o=e[1];return Math.abs(r-i)<=d*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=d*Math.max(1,Math.abs(n),Math.abs(o))}var No=bo,Go=uo,qo=so,jo=lo,Vo=xo,Ho=yo,zo=Mo,Wo=function(){var t=eo();return function(e,r,n,i,o,a){var u,s;for(r||(r=2),n||(n=0),s=i?Math.min(i*r+n,e.length):e.length,u=n;u<s;u+=r)t[0]=e[u],t[1]=e[u+1],o(t,t,a),e[u]=t[0],e[u+1]=t[1];return e}}()},function(t,e,r){var n=r(29),i=r(23),o=r(16),a=r(30);t.exports=function(t){return n(t)||i(t)||o(t)||a()}},function(t,e,r){var n=r(20),i=r(28),o=r(16),a=r(22);t.exports=function(t,e){return n(t)||i(t,e)||o(t,e)||a()}},function(t,e,r){"use strict";r.r(e),r.d(e,"create",(function(){return o})),r.d(e,"clone",(function(){return i})),r.d(e,"copy",(function(){return a})),r.d(e,"scaleAndAdd",(function(){return u})),r.d(e,"dot",(function(){return s})),r.d(e,"rotate",(function(){return l})),r.d(e,"cross",(function(){return c})),r.d(e,"sub",(function(){return f})),r.d(e,"add",(function(){return h})),r.d(e,"computeMiter",(function(){return p})),r.d(e,"normal",(function(){return m})),r.d(e,"direction",(function(){return x}));var n=r(0);function i(t){return[t[0],t[1]]}function o(){return[0,0]}r(0).glMatrix.setMatrixArrayType(Array);var a=n.vec2.copy,u=n.vec2.scaleAndAdd,s=n.vec2.dot,l=n.vec2.rotate,c=n.vec2.cross,f=n.vec2.sub,h=n.vec2.add,d=n.vec2.normalize,v=n.vec2.set,g=[0,0];function p(t,e,r,n,i){return h(t,r,n),d(t,t),v(e,-t[1],t[0]),v(g,-r[1],r[0]),i/s(e,g)}function m(t,e){return v(t,-e[1],e[0]),t}function x(t,e,r){return f(t,e,r),d(t,t),t}},function(t,e,r){t.exports=r(31)},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,r){"use strict";function n(t){return"rgba(".concat(t.map((function(t,e){return e<3?Math.round(255*t):t})).join(),")")}r.d(e,"a",(function(){return n})),r(0).glMatrix.setMatrixArrayType(Array)},function(t,e,r){"use strict";(function(t){var n=r(13),i=r.n(n),o=r(1),a=r.n(o),u=r(15),s=r(11),l=r(7);r(0).glMatrix.setMatrixArrayType(Array);var c={};var f=!1;if("object"===("undefined"==typeof navigator?"undefined":i()(navigator))&&"string"==typeof navigator.userAgent){var h=navigator.userAgent.toLowerCase().match(/chrome\/(\d+)/);h&&(f=Number(h[1])<70)}function d(e,r){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.offscreen||!f&&!1!==i.offscreen;return"function"==typeof t.createCanvas?n=t.createCanvas(e,r,i):o&&"function"==typeof OffscreenCanvas?n=new OffscreenCanvas(e,r):((n=document.createElement("canvas")).width=e,n.height=r),n}var v={createCanvas:d,createText:function(t,e){var r,n=e.font,i=e.fillColor,o=e.strokeColor,u=e.strokeWidth,f=e.ratio,h=void 0===f?1:f,v=e.textCanvas,g=e.cachable,p=void 0!==g&&g;if(p){r=[t,n,String(i),String(o),String(u)].join("###");var m=c[r];if(m)return m}v||(v=d(1,1));var x=v.getContext("2d");x.save(),x.font=n;var y=x.measureText(t).width;x.restore();var b=Object(s.a)(n),M=Math.max(b.pxLineHeight,1.13*b.pxHeight);/italic|oblique/.test(n)&&(y+=M*Math.tan(15*Math.PI/180)),i||o||(i="#000");var _=x.canvas,S=Math.ceil(y),w=Math.ceil(M);_.width=Math.round(S*h),_.height=Math.round(w*h),x.save(),x.font=function(t,e){var r=t.style,n=t.variant,i=t.weight,o=t.stretch,a=t.size,u=t.pxLineHeight,s=t.family;return"normal"===o?"".concat(r," ").concat(n," ").concat(i," ").concat(a*e,"px/").concat(u*e,"px ").concat(s):"".concat(r," ").concat(n," ").concat(i," ").concat(o," ").concat(a*e,"px/").concat(u*e,"px ").concat(s)}(b,h),x.textAlign="center",x.textBaseline="middle";var E=.5*_.height+.05*b.pxHeight*h,C=.5*_.width;if(i){if(Array.isArray(i))i=Object(l.a)(i);else if(i.vector){var O,k=i,A=k.vector,R=k.colors;O=6===A.length?x.createRadialGradient.apply(x,a()(A)):x.createLinearGradient.apply(x,a()(A)),R.forEach((function(t){var e=t.offset,r=t.color;O.addColorStop(e,r)})),i=O}x.fillStyle=i,x.fillText(t,C,E)}if(o){if(x.lineWidth=u*h,Array.isArray(o))o=Object(l.a)(o);else if(o.vector){var T,L=o,D=L.vector,I=L.colors;T=6===D.length?x.createRadialGradient.apply(x,a()(D)):x.createLinearGradient.apply(x,a()(D)),I.forEach((function(t){var e=t.offset,r=t.color;T.addColorStop(e,r)})),o=T}x.strokeStyle=o,x.strokeText(t,C,E)}x.restore();var F={image:v,rect:[0,0,S,w]};return p&&(c[r]=F),F},loadImage:u.a.loadImage};e.a=v}).call(this,r(24))},function(t,e){function r(t,e,r,n,i,o,a){try{var u=t[o](a),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,o){var a=t.apply(e,n);function u(t){r(a,i,o,u,s,"next",t)}function s(t){r(a,i,o,u,s,"throw",t)}u(void 0)}))}}},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e,r){"use strict";function n(t,e){if("string"==typeof t){var r=t.trim().match(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%)$/);t=r?{size:parseFloat(r[1]),unit:r[2]}:{size:parseInt(t,10),unit:"px"}}var i=t,o=i.size,a=i.unit;if("pt"===a)o/=.75;else if("pc"===a)o*=16;else if("in"===a)o*=96;else if("cm"===a)o*=96/2.54;else if("mm"===a)o*=96/25.4;else if("em"===a||"rem"===a||"ex"===a){if(!e&&"function"==typeof getComputedStyle&&"undefined"!=typeof document)e=n(getComputedStyle(document.documentElement).fontSize,16);o*=e,"ex"===a&&(o/=2)}else if("q"===a)o*=96/25.4/4;else if("vw"===a||"vh"===a){if("undefined"!=typeof document)o*=("vw"===a?document.documentElement.clientWidth:document.documentElement.clientHeight)/100}else if(("vmax"===a||"vmin"===a)&&"undefined"!=typeof document){var u=document.documentElement.clientWidth,s=document.documentElement.clientHeight;o*="vmax"===a?Math.max(u,s)/100:Math.min(u,s)/100}return o}r.d(e,"a",(function(){return f})),r(0).glMatrix.setMatrixArrayType(Array);var i="px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin|%",o="'([^']+)'|\"([^\"]+)\"|([\\w-]|[一-龥])+",a=new RegExp("(".concat("bold|bolder|lighter|[1-9]00",") +"),"i"),u=new RegExp("(".concat("italic|oblique",") +"),"i"),s=new RegExp("(".concat("small-caps",") +"),"i"),l=new RegExp("(".concat("ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",") +"),"i"),c=new RegExp("([\\d\\.]+)("+i+")(?:\\/([\\d\\.]+)("+i+"))? *((?:"+o+")( *, *(?:"+o+"))*)");function f(t,e){var r=c.exec(t);if(r){var i=parseFloat(r[3]),o={weight:"normal",style:"normal",stretch:"normal",variant:"normal",size:parseFloat(r[1]),unit:r[2],lineHeight:Number.isFinite(i)?i:void 0,lineHeightUnit:r[4],family:r[5].replace(/ *, */g,",")},f=t.substring(0,r.index),h=a.exec(f),d=u.exec(f),v=s.exec(f),g=l.exec(f);return h&&(o.weight=h[1]),d&&(o.style=d[1]),v&&(o.variant=v[1]),g&&(o.stretch=g[1]),o.pxHeight=n({size:o.size,unit:o.unit},e),o.pxLineHeight=n({size:o.lineHeight||o.size,unit:o.lineHeightUnit||o.unit},e),o}}},function(t,e,r){"use strict";t.exports=function(t){var e=t.length;if(0===e)return[[],[]];for(var r=t[0].length,n=t[0].slice(),i=t[0].slice(),o=1;o<e;++o)for(var a=t[o],u=0;u<r;++u){var s=a[u];n[u]=Math.min(n[u],s),i[u]=Math.max(i[u],s)}return[n,i]}},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r},function(t,e,r){r(0).glMatrix.setMatrixArrayType(Array);var n=r(39),i=r(3).copy,o=r(41);function a(t,e,r){return t[0]=e,t[1]=r,t}var u=[0,0],s=[0,0],l=[0,0];t.exports=function(t,e,r){var c=[],f=[],h=[0,0];return t.forEach((function(t,r,o){if("M"===t[0])i(h,t.slice(1)),f.length>0&&(c.push(f),f=[]);else{if("C"!==t[0])throw new Error("illegal type in SVG: "+t[0]);!function(t,e,r,i){n(r,a(u,i[1],i[2]),a(s,i[3],i[4]),a(l,i[5],i[6]),e,t)}(f,e,h,t),a(h,t[5],t[6])}})),f.length>0&&c.push(f),c.map((function(t){return o(t,r||0)}))}},function(t,e,r){"use strict";var n=r(4),i=r.n(n),o=r(9),a=r.n(o),u=r(2),s=r.n(u),l=r(1),c=r.n(l),f=r(6),h=r.n(f),d=r(5),v=r.n(d),g=r(10),p=r.n(g),m=r(13),x=r.n(m);function y(t,e){var r=function(t,e){for(var r=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=null,i=0;i<r.length;++i){try{n=t.getContext(r[i],e)}catch(t){}if(n)break}return n}(t,e);if(!r)throw new Error("Sorry, your browser doesn't support WebGL.");return r}function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Float32Array,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(r&&!(r instanceof e))throw new TypeError("Wrong buffer type.");if(null==t)return t;if(t instanceof e)return t;if(null==t[0]||null==t[0].length)return r?(r.set(t,0),r):new e(t);var n=t[0].length,i=t.length;r||(r=new e(n*i));for(var o=0,a=0;a<i;a++)for(var u=0;u<n;u++)r[o++]=t[a][u];return r}r(0).glMatrix.setMatrixArrayType(Array);var M={};var _={};function S(){return(S=a()(i.a.mark((function t(e){var r,n;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!_[e]){t.next=2;break}return t.abrupt("return",_[e]);case 2:return t.next=4,fetch(e);case 4:if(!((r=t.sent).status>=200&&r.status<300)){t.next=11;break}return t.next=8,r.text();case 8:return n=t.sent,_[e]=n,t.abrupt("return",n);case 11:throw new Error("Shader loaded error.");case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var w="#ifdef GL_ES\nprecision mediump float;\n#endif\n\nvoid main() {\n  gl_FragColor = vec4(0.0, 0.0, 0.0, 0.1);\n}";r(0).glMatrix.setMatrixArrayType(Array);var E={};function C(t,e,r){return t.activeTexture(t.TEXTURE0+r),Array.isArray(e._img)?t.bindTexture(t.TEXTURE_CUBE_MAP,e):t.bindTexture(t.TEXTURE_2D,e),e}var O={int:"1i",ivec2:"2i",ivec3:"3i",ivec4:"4i",float:"1f",vec2:"2f",vec3:"3f",vec4:"4f",mat2:"Matrix2fv",mat3:"Matrix3fv",mat4:"Matrix4fv",sampler1D:"sampler1D",sampler2D:"sampler2D",sampler3D:"sampler3D",samplerCube:"samplerCube",sampler1DShadow:"sampler1DShadow",sampler2DShadow:"sampler2DShadow",sampler2DRect:"sampler2DRect",sampler2DRectShadow:"sampler2DRectShadow"},k=function(){function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h()(this,t),this.options=Object.assign({},t.defaultOptions,n),this.canvas=e,this.options.webgl2&&(r=e.getContext("webgl2",this.options)),null==r&&(r=y(e,this.options),this.aia_ext=r.getExtension("ANGLE_instanced_arrays")),this.gl=r,r.viewport(0,0,e.width,e.height),r.clearColor(0,0,0,0),r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),this.programs=[],this._events={}}var e,r,n;return v()(t,null,[{key:"addLibs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(E,t)}},{key:"FLOAT",value:function(t,e){return b(t,Float32Array,e)}},{key:"UNSIGNED_BYTE",value:function(t,e){return b(t,Uint8Array,e)}},{key:"UNSIGNED_SHORT",value:function(t,e){return b(t,Uint16Array,e)}},{key:"BYTE",value:function(t,e){return b(t,Int8Array,e)}},{key:"SHORT",value:function(t,e){return b(t,Int16Array,e)}}]),v()(t,[{key:"_declareUniform",value:function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"1f",i=this.gl,o=i.getUniformLocation(t,e),a=this;if(/^sampler/.test(n)){var u=t._samplerMap,s=t._bindTextures;Object.defineProperty(t.uniforms,e,{get:function(){return r},set:function(t){r=t;var n=null!=u[e]?u[e]:s.length;s[n]=t,C(i,t,n),u[e]||(u[e]=n,i.uniform1i(o,n)),a.options.autoUpdate&&a.update()},configurable:!1,enumerable:!0})}else{var l=0===n.indexOf("Matrix"),f=!l&&/v$/.test(n),h=i["uniform".concat(n)].bind(i);Object.defineProperty(t.uniforms,e,{get:function(){return r},set:function(t){r=t,"number"==typeof t&&(t=[t]),l?h(o,!1,t):f?h(o,t):h.apply(void 0,[o].concat(c()(t))),a.options.autoUpdate&&a.update()},configurable:!1,enumerable:!0})}}},{key:"_draw",value:function(){var e=this,r=this.program;r.meshData.forEach((function(n,i){var o=n.positions,a=n.cells,u=n.instanceCount,l=n.cellsCount,c=n.attributes,f=n.uniforms,h=n.textureCoord,d=n.enableBlend,v=e.gl,g=null!=n.mode?n.mode:v.TRIANGLES;"string"==typeof g&&(g=v[g]),d?v.enable(v.BLEND):v.disable(v.BLEND),v.bindBuffer(v.ARRAY_BUFFER,r._buffers.verticesBuffer),v.bufferData(v.ARRAY_BUFFER,o,v.STATIC_DRAW),a&&(v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,r._buffers.cellsBuffer),v.bufferData(v.ELEMENT_ARRAY_BUFFER,a,v.STATIC_DRAW));var p,m=[];if(c&&Object.values(c).forEach((function(t){var n=t.name,i=t.data,o=t.divisor;if(v.bindBuffer(v.ARRAY_BUFFER,r._buffers[n]),v.bufferData(v.ARRAY_BUFFER,i,v.STATIC_DRAW),null!=o){var a=v.getAttribLocation(r,n);a>=0&&(v.enableVertexAttribArray(a),m.push(a),v.vertexAttribDivisor?v.vertexAttribDivisor(a,o):e.aia_ext&&e.aia_ext.vertexAttribDivisorANGLE(a,o))}})),f&&Object.entries(f).forEach((function(t){var r=s()(t,2),n=r[0],i=r[1];e.uniforms[n]=i})),!a){var x=r._dimension;p=o.length/x}if(r._enableTextures&&r._buffers.texCoordBuffer){var y=h||function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=[],n=t.length,i=0;i<n;i++)i%e<2&&r.push(.5*(t[i]+1));return r}(o,r._dimension);v.bindBuffer(v.ARRAY_BUFFER,r._buffers.texCoordBuffer),v.bufferData(v.ARRAY_BUFFER,t.FLOAT(y),v.STATIC_DRAW)}null!=u?(a?v.drawElementsInstanced?v.drawElementsInstanced(g,l,v.UNSIGNED_SHORT,0,u):e.aia_ext&&e.aia_ext.drawElementsInstancedANGLE(g,l,v.UNSIGNED_SHORT,0,u):v.drawArraysInstanced?v.drawArraysInstanced(g,0,p,u):e.aia_ext.drawArraysInstancedANGLE(g,0,p,u),m.forEach((function(t){v.vertexAttribDivisor?v.vertexAttribDivisor(t,null):e.aia_ext&&e.aia_ext.vertexAttribDivisorANGLE(t,null)}))):a?v.drawElements(g,l,v.UNSIGNED_SHORT,0):v.drawArrays(g,0,p)}))}},{key:"deleteProgram",value:function(t){var e=this.gl;this.program===t&&(this.startRender=!1,this._renderFrameID&&(cancelAnimationFrame(this._renderFrameID),delete this._renderFrameID),e.useProgram(null));var r=this.programs.indexOf(t);r>=0&&this.programs.splice(r,1),function(t,e){var r=e._buffers;Object.values(r).forEach((function(e){t.deleteBuffer(e)})),e._buffers={}}(e,t),e.deleteProgram(t)}},{key:"setMeshData",value:function(e){var r=this;Array.isArray(e)||(e=[e]);var n=this.program;n.meshData=e.map((function(e){var i=e.mode,o=e.positions,a=e.instanceCount,u=e.cells,l=e.cellsCount,c=e.attributes,f=e.uniforms,h=e.textureCoord,d=e.enableBlend,v={positions:t.FLOAT(o),uniforms:f,enableBlend:!!d,textureCoord:t.FLOAT(h)};if(u&&(v.cells=t.USHORT(u),v.cellsCount=l||v.cells.length),null!=i&&(v.mode=i),null!=a){if(!r.isWebGL2&&!r.aia_ext)throw new Error("Cannot use instanceCount in this rendering context, use webgl2 context instead.");v.instanceCount=a}if(c){var g={};Object.entries(c).forEach((function(e){var i=s()(e,2),o=i[0],a=i[1];if(n._attribute[o]){if("ignored"!==n._attribute[o]){var u=n._attribute[o],l=u.name,c=u.type,f=a.data||a;if(Array.isArray(f)&&(f=t[c](f)),g[o]={name:l,data:f},null!=a.divisor){if(!r.isWebGL2&&!r.aia_ext)throw new Error("Cannot use divisor in this rendering context, use webgl2 context instead.");g[o].divisor=a.divisor}}}else n._attribute[o]="ignored"})),v.attributes=g}return v})),this.options.autoUpdate&&this.update()}},{key:"createProgram",value:function(t,e){var r=this,n=/^\s*uniform\s+sampler/gm.test(t);null==t&&(t=w),null==e&&(e=n?"attribute vec4 a_vertexPosition;\nattribute vec2 a_vertexTextureCoord;\nvarying vec2 vTextureCoord;\n\nvoid main() {\n  gl_PointSize = 1.0;\n  gl_Position = a_vertexPosition;\n  vTextureCoord = a_vertexTextureCoord;\n}":"attribute vec3 a_vertexPosition;\n\nvoid main() {\n  gl_PointSize = 1.0;\n  gl_Position = vec4(a_vertexPosition, 1);\n}");var i=this.gl,o=function(t,e,r){var n=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i="Vertex shader failed to compile.  The error log is:".concat(t.getShaderInfoLog(n));throw new Error(i)}var o=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(o,r),t.compileShader(o),!t.getShaderParameter(o,t.COMPILE_STATUS)){var a="Fragment shader failed to compile.  The error log is:".concat(t.getShaderInfoLog(o));throw new Error(a)}var u=t.createProgram();if(t.attachShader(u,n),t.attachShader(u,o),t.linkProgram(u),!t.getProgramParameter(u,t.LINK_STATUS)){var s="Shader program failed to link.  The error log is:".concat(t.getProgramInfoLog(u));throw new Error(s)}return t.deleteShader(n),t.deleteShader(o),u}(i,e,t);o.shaderText={vertexShader:e,fragmentShader:t},o._buffers={},o._attribute={},o.uniforms={},o._samplerMap={},o._bindTextures=[];var a=new RegExp("(?:attribute|in) vec(\\d) ".concat(this.options.vertexPosition),"im"),u=e.match(a);u&&(o._dimension=Number(u[1]));var l=new RegExp("(?:attribute|in) vec(\\d) ".concat(this.options.vertexTextureCoord),"im");(u=e.match(l))&&(o._texCoordSize=Number(u[1]));if(u=e.match(/^\s*(?:attribute|in) (\w+?)(\d*) (\w+)/gim))for(var c=0;c<u.length;c++){var f=u[c].match(/^\s*(?:attribute|in) (\w+?)(\d*) (\w+)/im);if(f&&f[3]!==this.options.vertexPosition&&f[3]!==this.options.vertexTextureCoord){var h=s()(f,4),d=h[1],v=h[2],g=h[3];"mat"===d&&(v=Math.pow(v,2)),o._buffers[g]=i.createBuffer(),o._attribute[g]={name:g,type:d,size:Number(v)||1}}}var p=/^\s*uniform\s+(\w+)\s+(\w+)(\[\d+\])?/gm;(u=(u=e.match(p)||[]).concat(t.match(p)||[])).forEach((function(t){var e=t.match(/^\s*uniform\s+(\w+)\s+(\w+)(\[\d+\])?/).slice(1),n=s()(e,3),i=n[0],a=n[1],u=n[2];u=!!u,0!==(i=O[i]).indexOf("Matrix")&&u&&(i+="v"),r._declareUniform(o,a,i)})),o._buffers.verticesBuffer=i.createBuffer(),o._buffers.cellsBuffer=i.createBuffer();var m=i.getAttribLocation(o,this.options.vertexTextureCoord);return o._enableTextures=m>=0,o._enableTextures&&(o._buffers.texCoordBuffer=i.createBuffer()),this.programs.push(o),o}},{key:"useProgram",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.startRender=!1,this._renderFrameID&&(cancelAnimationFrame(this._renderFrameID),delete this._renderFrameID);var r=this.gl;r.useProgram(t);var n=t._dimension;r.bindBuffer(r.ARRAY_BUFFER,t._buffers.verticesBuffer);var i=r.getAttribLocation(t,this.options.vertexPosition);if(r.vertexAttribPointer(i,n,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i),t._enableTextures){r.bindBuffer(r.ARRAY_BUFFER,t._buffers.texCoordBuffer);var o=r.getAttribLocation(t,this.options.vertexTextureCoord);r.vertexAttribPointer(o,t._texCoordSize||2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(o)}if(Object.entries(t._attribute).forEach((function(n){var i=s()(n,2),o=i[0],a=i[1];if("ignored"!==a){var u=a.size,l=e[o]||{},c=!!l.normalize,f=l.type||"FLOAT",h=l.key||o;"UBYTE"===f&&(f="UNSIGNED_BYTE"),"USHORT"===f&&(f="UNSIGNED_SHORT"),a.type=f,h&&h!==o&&(t._attribute[h]=a),r.bindBuffer(r.ARRAY_BUFFER,t._buffers[o]);var d=r.getAttribLocation(t,o);d>=0&&(r.vertexAttribPointer(d,u,r[f],c,0,0),r.enableVertexAttribArray(d))}})),!t.meshData){var a=[[-1,-1,0,1].slice(0,n),[1,-1,0,1].slice(0,n),[1,1,0,1].slice(0,n),[-1,1,0,1].slice(0,n)],u=[[0,1,3],[3,1,2]];this.setMeshData({positions:a,cells:u})}return t}},{key:"compileSync",value:function(t,e){var r={};function n(t){var e=[],i=(t=t.replace(/^\s*/gm,"")).match(/^#pragma\s+include\s+.*/gm);if(i){for(var o=0;o<i.length;o++){var a=i[o].match(/(?:<|")(.*)(?:>|")/);if(a){var u=0===a[0].indexOf("<")?"lib":"link",s=a[1];if("graph"===s&&(s="graphics"),r[s])e.push("/* included ".concat(s," */"));else if(r[s]=!0,"lib"===u){var l=n(E[s]);e.push(l)}else if("link"===u)throw new Error("Cannot load external links synchronously. Use compile instead of compileSync.")}}e.forEach((function(e){t=t.replace(/^#pragma\s+include\s+.*/m,e)}))}return t}var i=n(t=t||w),o=e?n(e):null;return this.createProgram(i,o)}},{key:"compile",value:(n=a()(i.a.mark((function e(r,n){var o,u,s,l,c,f;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=function(){return(s=a()(i.a.mark((function e(r){var n,a,s,l,c,f,h,d,v;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=r.replace(/^\s*/gm,""),n=[],!(a=r.match(/^#pragma\s+include\s+.*/gm))){e.next=36;break}s=0;case 5:if(!(s<a.length)){e.next=35;break}if(l=a[s],!(c=l.match(/(?:<|")(.*)(?:>|")/))){e.next=32;break}if(f=0===c[0].indexOf("<")?"lib":"link","graph"===(h=c[1])&&(h="graphics"),o[h]){e.next=31;break}if(o[h]=!0,"lib"!==f){e.next=21;break}return e.next=17,u(E[h]);case 17:d=e.sent,n.push(d),e.next=29;break;case 21:if("link"!==f){e.next=29;break}return e.next=24,t.fetchShader(h);case 24:return v=e.sent,e.next=27,u(v);case 27:v=e.sent,n.push(v);case 29:e.next=32;break;case 31:n.push("/* included ".concat(h," */"));case 32:s++,e.next=5;break;case 35:n.forEach((function(t){r=r.replace(/^#pragma\s+include\s+.*/m,t)}));case 36:return e.abrupt("return",r);case 37:case"end":return e.stop()}}),e)})))).apply(this,arguments)},u=function(t){return s.apply(this,arguments)},r=r||w,o={},e.next=6,u(r);case 6:if(l=e.sent,!n){e.next=13;break}return e.next=10,u(n);case 10:e.t0=e.sent,e.next=14;break;case 13:e.t0=null;case 14:return c=e.t0,f=this.createProgram(l,c),e.abrupt("return",f);case 17:case"end":return e.stop()}}),e,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"load",value:(r=a()(i.a.mark((function e(r){var n,o=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:null,e.next=3,t.fetchShader(r);case 3:if(r=e.sent,!n){e.next=8;break}return e.next=7,t.fetchShader(n);case 7:n=e.sent;case 8:return e.abrupt("return",this.compile(r,n));case 9:case"end":return e.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"createTexture",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.wrapS,i=void 0===n?this.gl.CLAMP_TO_EDGE:n,o=r.wrapT,a=void 0===o?this.gl.CLAMP_TO_EDGE:o,u=r.minFilter,s=void 0===u?this.gl.LINEAR:u,l=r.magFilter,c=void 0===l?this.gl.LINEAR:l,f=this.gl,h=Array.isArray(e)?f.TEXTURE_CUBE_MAP:f.TEXTURE_2D;this._max_texture_image_units=this._max_texture_image_units||f.getParameter(f.MAX_COMBINED_TEXTURE_IMAGE_UNITS),f.activeTexture(f.TEXTURE0+this._max_texture_image_units-1);var d=f.createTexture();f.bindTexture(h,d),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,!0);var v=this.canvas,g=v.width,p=v.height;if(e)if(h===f.TEXTURE_CUBE_MAP)for(var m=0;m<6;m++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,e[m]);else f.texImage2D(h,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,e);else if(h===f.TEXTURE_CUBE_MAP)for(var x=0;x<6;x++)this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,f.RGBA,g,p,0,f.RGBA,f.UNSIGNED_BYTE,null);else f.texImage2D(h,0,f.RGBA,g,p,0,f.RGBA,f.UNSIGNED_BYTE,null);return f.texParameteri(h,f.TEXTURE_MIN_FILTER,s),f.texParameteri(h,f.TEXTURE_MAG_FILTER,c),f.texParameteri(h,f.TEXTURE_WRAP_S,i),f.texParameteri(h,f.TEXTURE_WRAP_T,a),h===f.TEXTURE_CUBE_MAP&&(e.width=e[0].width,e.height=e[0].height),f.bindTexture(h,null),d._img=e||{width:g,height:p},d.delete=function(){t.deleteTexture(d)},d}},{key:"deleteTexture",value:function(t){var e=t._img;this.gl.deleteTexture(t),"function"==typeof e.close&&e.close()}},{key:"loadTexture",value:(e=a()(i.a.mark((function e(r){var n,o,a,u,s=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},o=n.useImageBitmap,a=void 0===o||o,e.next=3,t.loadImage(r,{useImageBitmap:a});case 3:return u=e.sent,e.abrupt("return",this.createTexture(u));case 5:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"createFBO",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.color,r=void 0===e?1:e,n=t.blend,i=void 0!==n&&n,o=t.depth,a=void 0===o?!1!==this.options.depth:o,u=t.stencil,s=void 0===u?!!this.options.stencil:u,l=this.gl,c=l.createFramebuffer();l.bindFramebuffer(l.FRAMEBUFFER,c);for(var f=[],h=0;h<r;h++){var d=this.createTexture();l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0+h,l.TEXTURE_2D,d,0),f.push(d)}c.textures=f,c.texture=f[0],c.blend=i;var v=this.canvas,g=v.width,p=v.height;return a&&!s&&(c.depthBuffer=l.createRenderbuffer(),l.bindRenderbuffer(l.RENDERBUFFER,c.depthBuffer),l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,g,p),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,c.depthBuffer)),s&&!a&&(c.stencilBuffer=l.createRenderbuffer(),l.bindRenderbuffer(l.RENDERBUFFER,c.stencilBuffer),l.renderbufferStorage(l.RENDERBUFFER,l.STENCIL_INDEX8,g,p),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.STENCIL_ATTACHMENT,l.RENDERBUFFER,c.stencilBuffer)),a&&s&&(c.depthStencilBuffer=l.createRenderbuffer(),l.bindRenderbuffer(l.RENDERBUFFER,c.depthStencilBuffer),l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,g,p),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,c.depthStencilBuffer)),l.bindFramebuffer(l.FRAMEBUFFER,null),c}},{key:"bindFBO",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.fbo=t}},{key:"render",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.clearBuffer;this.startRender=!0;var e=this.gl,r=this.program;r||(r=this.createProgram(),this.useProgram(r)),this.fbo&&e.bindFramebuffer(e.FRAMEBUFFER,this.fbo);var n=this.options.depth;n&&e.enable(e.DEPTH_TEST),this.gl.clear(this.gl.COLOR_BUFFER_BIT|(n?this.gl.DEPTH_BUFFER_BIT:0)|(this.options.stencil?this.gl.STENCIL_BUFFER_BIT:0));var i=this._renderFrameID;this._draw(),this.fbo&&e.bindFramebuffer(e.FRAMEBUFFER,null),this._renderFrameID===i&&(this._renderFrameID=null)}},{key:"update",value:function(){this.startRender&&null==this._renderFrameID&&(this._renderFrameID=requestAnimationFrame(this.render.bind(this)))}},{key:"program",get:function(){var t=this.gl;return t.getParameter(t.CURRENT_PROGRAM)}},{key:"isWebGL2",get:function(){return"undefined"!=typeof WebGL2RenderingContext&&this.gl instanceof WebGL2RenderingContext}},{key:"enableTextures",get:function(){return this.program&&this.program._enableTextures}},{key:"uniforms",get:function(){var t=this.program;if(!t||!t.uniforms)throw Error("No avaliable program.");return t.uniforms}}]),t}();p()(k,"defaultOptions",{preserveDrawingBuffer:!0,autoUpdate:!0,vertexPosition:"a_vertexPosition",vertexTextureCoord:"a_vertexTextureCoord",webgl2:!1}),p()(k,"UBYTE",k.UNSIGNED_BYTE),p()(k,"USHORT",k.UNSIGNED_SHORT),p()(k,"fetchShader",(function(t){return S.apply(this,arguments)})),p()(k,"loadImage",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.useImageBitmap,n=void 0===r||r,i=e.alias,o=void 0===i?null:i;if(!M[t])if("function"==typeof Image){var a=new Image;"string"!=typeof t||"object"===("undefined"==typeof location?"undefined":x()(location))&&/^file:/.test(location.href)||/^data:/.test(t)||(a.crossOrigin="anonymous"),M[t]=new Promise((function(e){a.onload=function(){n&&"function"==typeof createImageBitmap?createImageBitmap(a,{imageOrientation:"flipY"}).then((function(r){M[t]=r,o&&(M[o]=r),e(r)})):(M[t]=a,o&&(M[o]=a),e(a))},a.src=t})),o&&(M[o]=M[t])}else if("function"==typeof fetch)return fetch(t,{method:"GET",mode:"cors",cache:"default"}).then((function(t){return t.blob()})).then((function(e){return createImageBitmap(e,{imageOrientation:"flipY"}).then((function(e){return M[t]=e,o&&(M[o]=e),e}))}));return M[t]})),r(0).glMatrix.setMatrixArrayType(Array);e.a=k},function(t,e,r){var n=r(21);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},function(t,e){t.exports=function(t){var e=[];return t.replace(n,(function(t,n,o){var a=n.toLowerCase();for(o=function(t){var e=t.match(i);return e?e.map(Number):[]}(o),"m"==a&&o.length>2&&(e.push([n].concat(o.splice(0,2))),a="l",n="m"==n?"l":"L");;){if(o.length==r[a])return o.unshift(n),e.push(o);if(o.length<r[a])throw new Error("malformed path data");e.push([n].concat(o.splice(0,r[a])))}})),e};var r={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var i=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi},function(t,e){t.exports=function(t){var e=0,r=0,n=0,i=0;return t.map((function(t){var o=(t=t.slice())[0],a=o.toUpperCase();if(o!=a)switch(t[0]=a,o){case"a":t[6]+=n,t[7]+=i;break;case"v":t[1]+=i;break;case"h":t[1]+=n;break;default:for(var u=1;u<t.length;)t[u++]+=n,t[u++]+=i}switch(a){case"Z":n=e,i=r;break;case"H":n=t[1];break;case"V":i=t[1];break;case"M":n=e=t[1],i=r=t[2];break;default:n=t[t.length-2],i=t[t.length-1]}return t}))}},function(t,e,r){r(0).glMatrix.setMatrixArrayType(Array);var n=r(45),i=r(46);t.exports=function(t,e){if(e=e||{},0===(t=t.filter((function(t){return t.length>2}))).length)return{positions:[],cells:[]};"number"!=typeof e.vertexSize&&(e.vertexSize=t[0][0].length),t=t.map((function(t){return t.reduce((function(t,e){return t.concat(e)}))}));for(var r="evenodd"===e.rule?n.WINDING_ODD:n.WINDING_NONZERO,o=n.tesselate(i({contours:t,windingRule:r,elementType:n.POLYGONS,polySize:3,vertexSize:2},e)),a=[],u=0;u<o.vertices.length;u+=e.vertexSize){var s=o.vertices.slice(u,u+e.vertexSize);a.push(s)}var l=[];for(u=0;u<o.elements.length;u+=3){var c=o.elements[u],f=o.elements[u+1],h=o.elements[u+2];l.push([c,f,h])}return{positions:a,cells:l}}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},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.")}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=r(32),i=r(36),o=r(38);t.exports=function(t){var e,r=n(t);return r.space?((e=Array(3))[0]=o(r.values[0],0,255),e[1]=o(r.values[1],0,255),e[2]=o(r.values[2],0,255),"h"===r.space[0]&&(e=i.rgb(e)),e.push(o(r.alpha,0,1)),e):[]}},function(t,e,r){var n=r(20),i=r(23),o=r(16),a=r(22);t.exports=function(t){return n(t)||i(t)||o(t)||a()}},function(t,e,r){var n=r(44);t.exports=function(t,e){if(null==t)return{};var r,i,o=n(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)r=a[i],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}}},function(t,e,r){var n=r(21);t.exports=function(t){if(Array.isArray(t))return n(t)}},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.")}},function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof f?e:f,o=Object.create(i.prototype),a=new S(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return E()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var u=b(a,r);if(u){if(u===c)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===c)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,a),o}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var c={};function f(){}function h(){}function d(){}var v={};v[i]=function(){return this};var g=Object.getPrototypeOf,p=g&&g(g(w([])));p&&p!==e&&r.call(p,i)&&(v=p);var m=d.prototype=f.prototype=Object.create(v);function x(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function y(t,e){var n;this._invoke=function(i,o){function a(){return new e((function(n,a){!function n(i,o,a,u){var s=l(t[i],t,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,u)}))}u(s.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var i=n.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,c):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function M(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 _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function w(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 n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=m.constructor=d,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(m),t},t.awrap=function(t){return{__await:t}},x(y.prototype),y.prototype[o]=function(){return this},t.AsyncIterator=y,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new y(s(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(m),u(m,a,"Generator"),m[i]=function(){return this},m.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=w,S.prototype={constructor:S,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(_),!t)for(var e in this)"t"===e.charAt(0)&&r.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 n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.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,c):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),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;_(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){"use strict";(function(e){var n=r(33),i=r(34),o=r(35);t.exports=function(t){var r,u,s=[],l=1;if("string"==typeof t)if(n[t])s=n[t].slice(),u="rgb";else if("transparent"===t)l=0,u="rgb",s=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var c=(d=t.slice(1)).length;l=1,c<=4?(s=[parseInt(d[0]+d[0],16),parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16)],4===c&&(l=parseInt(d[3]+d[3],16)/255)):(s=[parseInt(d[0]+d[1],16),parseInt(d[2]+d[3],16),parseInt(d[4]+d[5],16)],8===c&&(l=parseInt(d[6]+d[7],16)/255)),s[0]||(s[0]=0),s[1]||(s[1]=0),s[2]||(s[2]=0),u="rgb"}else if(r=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var f=r[1],h="rgb"===f,d=f.replace(/a$/,"");u=d;c="cmyk"===d?4:"gray"===d?1:3;s=r[2].trim().split(/\s*,\s*/).map((function(t,e){if(/%$/.test(t))return e===c?parseFloat(t)/100:"rgb"===d?255*parseFloat(t)/100:parseFloat(t);if("h"===d[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==a[t])return a[t]}return parseFloat(t)})),f===d&&s.push(1),l=h||void 0===s[c]?1:s[c],s=s.slice(0,c)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(s=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),u=t.match(/([a-z])/gi).join("").toLowerCase());else if(isNaN(t))if(i(t)){var v=o(t.r,t.red,t.R,null);null!==v?(u="rgb",s=[v,o(t.g,t.green,t.G),o(t.b,t.blue,t.B)]):(u="hsl",s=[o(t.h,t.hue,t.H),o(t.s,t.saturation,t.S),o(t.l,t.lightness,t.L,t.b,t.brightness)]),l=o(t.a,t.alpha,t.opacity,1),null!=t.opacity&&(l/=100)}else(Array.isArray(t)||e.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(s=[t[0],t[1],t[2]],u="rgb",l=4===t.length?t[3]:1);else u="rgb",s=[t>>>16,(65280&t)>>>8,255&t];return{space:u,values:s,alpha:l}};var a={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,r(24))},function(t,e,r){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},function(t,e,r){"use strict";var n=Object.prototype.toString;t.exports=function(t){var e;return"[object Object]"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},function(t,e){t.exports=function(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]}},function(t,e,r){"use strict";var n=r(37);t.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,r,n,i,o,a=t[0]/360,u=t[1]/100,s=t[2]/100;if(0===u)return[o=255*s,o,o];e=2*s-(r=s<.5?s*(1+u):s+u-s*u),i=[0,0,0];for(var l=0;l<3;l++)(n=a+1/3*-(l-1))<0?n++:n>1&&n--,o=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[l]=255*o;return i}},n.hsl=function(t){var e,r,n=t[0]/255,i=t[1]/255,o=t[2]/255,a=Math.min(n,i,o),u=Math.max(n,i,o),s=u-a;return u===a?e=0:n===u?e=(i-o)/s:i===u?e=2+(o-n)/s:o===u&&(e=4+(n-i)/s),(e=Math.min(60*e,360))<0&&(e+=360),r=(a+u)/2,[e,100*(u===a?0:r<=.5?s/(u+a):s/(2-u-a)),100*r]}},function(t,e,r){"use strict";t.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},function(t,e){t.exports=function(t,e,r){return e<r?t<e?e:t>r?r:t:t<r?r:t>e?e:t}},function(t,e,r){t.exports=r(40)()},function(t,e){function r(t){return[t[0],t[1]]}function n(t,e){return[t,e]}t.exports=function(t){var e="number"==typeof(t=t||{}).recursion?t.recursion:8,i="number"==typeof t.epsilon?t.epsilon:1.1920929e-7,o="number"==typeof t.pathEpsilon?t.pathEpsilon:1,a="number"==typeof t.angleEpsilon?t.angleEpsilon:.01,u=t.angleTolerance||0,s=t.cuspLimit||0;return function(t,l,c,f,h,d){d||(d=[]);var v=o/(h="number"==typeof h?h:1);return function(t,o,l,c,f,h){f.push(r(t));var d=t[0],v=t[1],g=o[0],p=o[1],m=l[0],x=l[1],y=c[0],b=c[1];(function t(r,o,l,c,f,h,d,v,g,p,m){if(m>e)return;var x=Math.PI,y=(r+l)/2,b=(o+c)/2,M=(l+f)/2,_=(c+h)/2,S=(f+d)/2,w=(h+v)/2,E=(y+M)/2,C=(b+_)/2,O=(M+S)/2,k=(_+w)/2,A=(E+O)/2,R=(C+k)/2;if(m>0){var T,L,D=d-r,I=v-o,F=Math.abs((l-d)*I-(c-v)*D),U=Math.abs((f-d)*I-(h-v)*D);if(F>i&&U>i){if((F+U)*(F+U)<=p*(D*D+I*I)){if(u<a)return void g.push(n(A,R));var P=Math.atan2(h-c,f-l);if(T=Math.abs(P-Math.atan2(c-o,l-r)),L=Math.abs(Math.atan2(v-h,d-f)-P),T>=x&&(T=2*x-T),L>=x&&(L=2*x-L),T+L<u)return void g.push(n(A,R));if(0!==s){if(T>s)return void g.push(n(l,c));if(L>s)return void g.push(n(f,h))}}}else if(F>i){if(F*F<=p*(D*D+I*I)){if(u<a)return void g.push(n(A,R));if((T=Math.abs(Math.atan2(h-c,f-l)-Math.atan2(c-o,l-r)))>=x&&(T=2*x-T),T<u)return g.push(n(l,c)),void g.push(n(f,h));if(0!==s&&T>s)return void g.push(n(l,c))}}else if(U>i){if(U*U<=p*(D*D+I*I)){if(u<a)return void g.push(n(A,R));if((T=Math.abs(Math.atan2(v-h,d-f)-Math.atan2(h-c,f-l)))>=x&&(T=2*x-T),T<u)return g.push(n(l,c)),void g.push(n(f,h));if(0!==s&&T>s)return void g.push(n(f,h))}}else if((D=A-(r+d)/2)*D+(I=R-(o+v)/2)*I<=p)return void g.push(n(A,R))}t(r,o,y,b,E,C,A,R,g,p,m+1),t(A,R,O,k,S,w,d,v,g,p,m+1)})(d,v,g,p,m,x,y,b,f,h,0),f.push(r(c))}(t,l,c,f,d,v*=v),d}}},function(t,e,r){var n=r(42),i=r(43);t.exports=function(t,e){return t=n(t,e),t=i(t,e)},t.exports.radialDistance=n,t.exports.douglasPeucker=i},function(t,e){t.exports=function(t,e){if(t.length<=1)return t;for(var r,n,i,o,a,u=(e="number"==typeof e?e:1)*e,s=t[0],l=[s],c=1,f=t.length;c<f;c++)r=t[c],i=s,o=void 0,a=void 0,o=(n=r)[0]-i[0],a=n[1]-i[1],o*o+a*a>u&&(l.push(r),s=r);return s!==r&&l.push(r),l}},function(t,e){function r(t,e,r){var n=e[0],i=e[1],o=r[0]-n,a=r[1]-i;if(0!==o||0!==a){var u=((t[0]-n)*o+(t[1]-i)*a)/(o*o+a*a);u>1?(n=r[0],i=r[1]):u>0&&(n+=o*u,i+=a*u)}return(o=t[0]-n)*o+(a=t[1]-i)*a}t.exports=function(t,e){if(t.length<=1)return t;var n=(e="number"==typeof e?e:1)*e,i=t.length-1,o=[t[0]];return function t(e,n,i,o,a){for(var u,s=o,l=n+1;l<i;l++){var c=r(e[l],e[n],e[i]);c>s&&(u=l,s=c)}s>o&&(u-n>1&&t(e,n,u,o,a),a.push(e[u]),i-u>1&&t(e,u,i,o,a))}(t,0,i,n,o),o.push(t[i]),o}},function(t,e){t.exports=function(t,e){if(null==t)return{};var r,n,i={},o=Object.keys(t);for(n=0;n<o.length;n++)r=o[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}},function(t,e,r){"use strict";r(0).glMatrix.setMatrixArrayType(Array);var n={},i={};t.exports=n,n.WINDING_ODD=0,n.WINDING_NONZERO=1,n.WINDING_POSITIVE=2,n.WINDING_NEGATIVE=3,n.WINDING_ABS_GEQ_TWO=4,n.POLYGONS=0,n.CONNECTED_POLYGONS=1,n.BOUNDARY_CONTOURS=2,n.tesselate=function(t){for(var e=t.debug||!1,r=new m,i=0;i<t.contours.length;i++)r.addContour(t.vertexSize||2,t.contours[i]);return r.tesselate(t.windingRule||n.WINDING_ODD,t.elementType||n.POLYGONS,t.polySize||3,t.vertexSize||2,t.normal||[0,0,1]),{vertices:r.vertices,vertexIndices:r.vertexIndices,vertexCount:r.vertexCount,elements:r.elements,elementCount:r.elementCount,mesh:e?r.mesh:void 0}};var o=function(t){if(!t)throw"Assertion Failed!"};function a(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}function u(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}function s(t){this.next=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Org=null,this.Lface=null,this.activeRegion=null,this.winding=0,this.side=t}function l(){var t=new a,e=new u,r=new s(0),n=new s(1);t.next=t.prev=t,t.anEdge=null,e.next=e.prev=e,e.anEdge=null,e.trail=null,e.marked=!1,e.inside=!1,r.next=r,r.Sym=n,r.Onext=null,r.Lnext=null,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n.next=n,n.Sym=r,n.Onext=null,n.Lnext=null,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,this.vHead=t,this.fHead=e,this.eHead=r,this.eHeadSym=n}function c(){this.key=null,this.next=null,this.prev=null}function f(t,e){this.head=new c,this.head.next=this.head,this.head.prev=this.head,this.frame=t,this.leq=e}function h(){this.handle=null}function d(){this.key=null,this.node=null}function v(t,e){var r;for(this.size=0,this.max=t,this.nodes=[],this.nodes.length=t+1,r=0;r<this.nodes.length;r++)this.nodes[r]=new h;for(this.handles=[],this.handles.length=t+1,r=0;r<this.handles.length;r++)this.handles[r]=new d;this.initialized=!1,this.freeList=0,this.leq=e,this.nodes[1].handle=1,this.handles[1].key=null}function g(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}s.prototype={get Rface(){return this.Sym.Lface},set Rface(t){this.Sym.Lface=t},get Dst(){return this.Sym.Org},set Dst(t){this.Sym.Org=t},get Oprev(){return this.Sym.Lnext},set Oprev(t){this.Sym.Lnext=t},get Lprev(){return this.Onext.Sym},set Lprev(t){this.Onext.Sym=t},get Dprev(){return this.Lnext.Sym},set Dprev(t){this.Lnext.Sym=t},get Rprev(){return this.Sym.Onext},set Rprev(t){this.Sym.Onext=t},get Dnext(){return this.Sym.Onext.Sym},set Dnext(t){this.Sym.Onext.Sym=t},get Rnext(){return this.Sym.Lnext.Sym},set Rnext(t){this.Sym.Lnext.Sym=t}},l.prototype={makeEdge_:function(t){var e=new s(0),r=new s(1);t.Sym.side<t.side&&(t=t.Sym);var n=t.Sym.next;return r.next=n,n.Sym.next=e,e.next=t,t.Sym.next=r,e.Sym=r,e.Onext=e,e.Lnext=r,e.Org=null,e.Lface=null,e.winding=0,e.activeRegion=null,r.Sym=e,r.Onext=r,r.Lnext=e,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,e},splice_:function(t,e){var r=t.Onext,n=e.Onext;r.Sym.Lnext=e,n.Sym.Lnext=t,t.Onext=n,e.Onext=r},makeVertex_:function(t,e,r){var n=t;o(null!==n);var i=r.prev;n.prev=i,i.next=n,n.next=r,r.prev=n,n.anEdge=e;var a=e;do{a.Org=n,a=a.Onext}while(a!==e)},makeFace_:function(t,e,r){var n=t;o(null!==n);var i=r.prev;n.prev=i,i.next=n,n.next=r,r.prev=n,n.anEdge=e,n.trail=null,n.marked=!1,n.inside=r.inside;var a=e;do{a.Lface=n,a=a.Lnext}while(a!==e)},killEdge_:function(t){t.Sym.side<t.side&&(t=t.Sym);var e=t.next,r=t.Sym.next;e.Sym.next=r,r.Sym.next=e},killVertex_:function(t,e){var r=t.anEdge,n=r;do{n.Org=e,n=n.Onext}while(n!==r);var i=t.prev,o=t.next;o.prev=i,i.next=o},killFace_:function(t,e){var r=t.anEdge,n=r;do{n.Lface=e,n=n.Lnext}while(n!==r);var i=t.prev,o=t.next;o.prev=i,i.next=o},makeEdge:function(){var t=new a,e=new a,r=new u,n=this.makeEdge_(this.eHead);return this.makeVertex_(t,n,this.vHead),this.makeVertex_(e,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},splice:function(t,e){var r=!1,n=!1;if(t!==e){if(e.Org!==t.Org&&(n=!0,this.killVertex_(e.Org,t.Org)),e.Lface!==t.Lface&&(r=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(e,t),!n){var i=new a;this.makeVertex_(i,e,t.Org),t.Org.anEdge=t}if(!r){var o=new u;this.makeFace_(o,e,t.Lface),t.Lface.anEdge=t}}},delete:function(t){var e=t.Sym,r=!1;if(t.Lface!==t.Rface&&(r=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t)this.killVertex_(t.Org,null);else if(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),!r){var n=new u;this.makeFace_(n,t,t.Lface)}e.Onext===e?(this.killVertex_(e.Org,null),this.killFace_(e.Lface,null)):(t.Lface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev)),this.killEdge_(t)},addEdgeVertex:function(t){var e=this.makeEdge_(t),r=e.Sym;this.splice_(e,t.Lnext),e.Org=t.Dst;var n=new a;return this.makeVertex_(n,r,e.Org),e.Lface=r.Lface=t.Lface,e},splitEdge:function(t,e){var r=this.addEdgeVertex(t).Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,r),t.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=t.Rface,r.winding=t.winding,r.Sym.winding=t.Sym.winding,r},connect:function(t,e){var r=!1,n=this.makeEdge_(t),i=n.Sym;if(e.Lface!==t.Lface&&(r=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(n,t.Lnext),this.splice_(i,e),n.Org=t.Dst,i.Org=e.Org,n.Lface=i.Lface=t.Lface,t.Lface.anEdge=i,!r){var o=new u;this.makeFace_(o,n,t.Lface)}return n},zapFace:function(t){var e,r,n,i,o,a=t.anEdge;r=a.Lnext;do{r=(e=r).Lnext,e.Lface=null,null===e.Rface&&(e.Onext===e?this.killVertex_(e.Org,null):(e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev)),(n=e.Sym).Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(e))}while(e!=a);i=t.prev,(o=t.next).prev=i,i.next=o},countFaceVerts_:function(t){var e=t.anEdge,r=0;do{r++,e=e.Lnext}while(e!==t.anEdge);return r},mergeConvexFaces:function(t){var e,r,n,o,a;for(e=this.fHead.next;e!==this.fHead;e=e.next)if(e.inside)for(a=(r=e.anEdge).Org;n=r.Lnext,(o=r.Sym)&&o.Lface&&o.Lface.inside&&this.countFaceVerts_(e)+this.countFaceVerts_(o.Lface)-2<=t&&i.vertCCW(r.Lprev.Org,r.Org,o.Lnext.Lnext.Org)&&i.vertCCW(o.Lprev.Org,o.Org,r.Lnext.Lnext.Org)&&(n=o.Lnext,this.delete(o),r=null,o=null),!r||r.Lnext.Org!==a;)r=n;return!0},check:function(){var t,e,r,n,i,a,u=this.fHead,s=this.vHead,l=this.eHead;for(e=u,e=u;(t=e.next)!==u;e=t){o(t.prev===e),i=t.anEdge;do{o(i.Sym!==i),o(i.Sym.Sym===i),o(i.Lnext.Onext.Sym===i),o(i.Onext.Sym.Lnext===i),o(i.Lface===t),i=i.Lnext}while(i!==t.anEdge)}for(o(t.prev===e&&null===t.anEdge),n=s,n=s;(r=n.next)!==s;n=r){o(r.prev===n),i=r.anEdge;do{o(i.Sym!==i),o(i.Sym.Sym===i),o(i.Lnext.Onext.Sym===i),o(i.Onext.Sym.Lnext===i),o(i.Org===r),i=i.Onext}while(i!==r.anEdge)}for(o(r.prev===n&&null===r.anEdge),a=l,a=l;(i=a.next)!==l;a=i)o(i.Sym.next===a.Sym),o(i.Sym!==i),o(i.Sym.Sym===i),o(null!==i.Org),o(null!==i.Dst),o(i.Lnext.Onext.Sym===i),o(i.Onext.Sym.Lnext===i);o(i.Sym.next===a.Sym&&i.Sym===this.eHeadSym&&i.Sym.Sym===i&&null===i.Org&&null===i.Dst&&null===i.Lface&&null===i.Rface)}},i.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},i.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},i.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},i.edgeGoesLeft=function(t){return i.vertLeq(t.Dst,t.Org)},i.edgeGoesRight=function(t){return i.vertLeq(t.Org,t.Dst)},i.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},i.edgeEval=function(t,e,r){o(i.vertLeq(t,e)&&i.vertLeq(e,r));var n=e.s-t.s,a=r.s-e.s;return n+a>0?n<a?e.t-t.t+(t.t-r.t)*(n/(n+a)):e.t-r.t+(r.t-t.t)*(a/(n+a)):0},i.edgeSign=function(t,e,r){o(i.vertLeq(t,e)&&i.vertLeq(e,r));var n=e.s-t.s,a=r.s-e.s;return n+a>0?(e.t-r.t)*n+(e.t-t.t)*a:0},i.transEval=function(t,e,r){o(i.transLeq(t,e)&&i.transLeq(e,r));var n=e.t-t.t,a=r.t-e.t;return n+a>0?n<a?e.s-t.s+(t.s-r.s)*(n/(n+a)):e.s-r.s+(r.s-t.s)*(a/(n+a)):0},i.transSign=function(t,e,r){o(i.transLeq(t,e)&&i.transLeq(e,r));var n=e.t-t.t,a=r.t-e.t;return n+a>0?(e.s-r.s)*n+(e.s-t.s)*a:0},i.vertCCW=function(t,e,r){return t.s*(e.t-r.t)+e.s*(r.t-t.t)+r.s*(t.t-e.t)>=0},i.interpolate=function(t,e,r,n){return(t=t<0?0:t)<=(r=r<0?0:r)?0===r?(e+n)/2:e+t/(t+r)*(n-e):n+r/(t+r)*(e-n)},i.intersect=function(t,e,r,n,o){var a,u,s;i.vertLeq(t,e)||(s=t,t=e,e=s),i.vertLeq(r,n)||(s=r,r=n,n=s),i.vertLeq(t,r)||(s=t,t=r,r=s,s=e,e=n,n=s),i.vertLeq(r,e)?i.vertLeq(e,n)?((a=i.edgeEval(t,r,e))+(u=i.edgeEval(r,e,n))<0&&(a=-a,u=-u),o.s=i.interpolate(a,r.s,u,e.s)):((a=i.edgeSign(t,r,e))+(u=-i.edgeSign(t,n,e))<0&&(a=-a,u=-u),o.s=i.interpolate(a,r.s,u,n.s)):o.s=(r.s+e.s)/2,i.transLeq(t,e)||(s=t,t=e,e=s),i.transLeq(r,n)||(s=r,r=n,n=s),i.transLeq(t,r)||(s=t,t=r,r=s,s=e,e=n,n=s),i.transLeq(r,e)?i.transLeq(e,n)?((a=i.transEval(t,r,e))+(u=i.transEval(r,e,n))<0&&(a=-a,u=-u),o.t=i.interpolate(a,r.t,u,e.t)):((a=i.transSign(t,r,e))+(u=-i.transSign(t,n,e))<0&&(a=-a,u=-u),o.t=i.interpolate(a,r.t,u,n.t)):o.t=(r.t+e.t)/2},f.prototype={min:function(){return this.head.next},max:function(){return this.head.prev},insert:function(t){return this.insertBefore(this.head,t)},search:function(t){var e=this.head;do{e=e.next}while(null!==e.key&&!this.leq(this.frame,t,e.key));return e},insertBefore:function(t,e){do{t=t.prev}while(null!==t.key&&!this.leq(this.frame,t.key,e));var r=new c;return r.key=e,r.next=t.next,t.next.prev=r,r.prev=t,t.next=r,r},delete:function(t){t.next.prev=t.prev,t.prev.next=t.next}},v.prototype={floatDown_:function(t){var e,r,n,i=this.nodes,a=this.handles;for(e=i[t].handle;;){if((n=t<<1)<this.size&&this.leq(a[i[n+1].handle].key,a[i[n].handle].key)&&++n,o(n<=this.max),r=i[n].handle,n>this.size||this.leq(a[e].key,a[r].key)){i[t].handle=e,a[e].node=t;break}i[t].handle=r,a[r].node=t,t=n}},floatUp_:function(t){var e,r,n,i=this.nodes,o=this.handles;for(e=i[t].handle;;){if(r=i[n=t>>1].handle,0===n||this.leq(o[r].key,o[e].key)){i[t].handle=e,o[e].node=t;break}i[t].handle=r,o[r].node=t,t=n}},init:function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},min:function(){return this.handles[this.nodes[1].handle].key},insert:function(t){var e,r;if(2*(e=++this.size)>this.max){var n,i;for(this.max*=2,i=this.nodes.length,this.nodes.length=this.max+1,n=i;n<this.nodes.length;n++)this.nodes[n]=new h;for(i=this.handles.length,this.handles.length=this.max+1,n=i;n<this.handles.length;n++)this.handles[n]=new d}return 0===this.freeList?r=e:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[e].handle=r,this.handles[r].node=e,this.handles[r].key=t,this.initialized&&this.floatUp_(e),r},extractMin:function(){var t=this.nodes,e=this.handles,r=t[1].handle,n=e[r].key;return this.size>0&&(t[1].handle=t[this.size].handle,e[t[1].handle].node=1,e[r].key=null,e[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),n},delete:function(t){var e,r=this.nodes,n=this.handles;o(t>=1&&t<=this.max&&null!==n[t].key),r[e=n[t].node].handle=r[this.size].handle,n[r[e].handle].node=e,--this.size,e<=this.size&&(e<=1||this.leq(n[r[e>>1].handle].key,n[r[e].handle].key)?this.floatDown_(e):this.floatUp_(e)),n[t].key=null,n[t].node=this.freeList,this.freeList=t}};var p={};function m(){this.mesh=null,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=n.WINDING_ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}p.regionBelow=function(t){return t.nodeUp.prev.key},p.regionAbove=function(t){return t.nodeUp.next.key},p.debugEvent=function(t){},p.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},p.edgeLeq=function(t,e,r){var n=t.event,o=e.eUp,a=r.eUp;return o.Dst===n?a.Dst===n?i.vertLeq(o.Org,a.Org)?i.edgeSign(a.Dst,o.Org,a.Org)<=0:i.edgeSign(o.Dst,a.Org,o.Org)>=0:i.edgeSign(a.Dst,n,a.Org)<=0:a.Dst===n?i.edgeSign(o.Dst,n,o.Org)>=0:i.edgeEval(o.Dst,n,o.Org)>=i.edgeEval(a.Dst,n,a.Org)},p.deleteRegion=function(t,e){e.fixUpperEdge&&o(0===e.eUp.winding),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},p.fixUpperEdge=function(t,e,r){o(e.fixUpperEdge),t.mesh.delete(e.eUp),e.fixUpperEdge=!1,e.eUp=r,r.activeRegion=e},p.topLeftRegion=function(t,e){var r,n=e.eUp.Org;do{e=p.regionAbove(e)}while(e.eUp.Org===n);if(e.fixUpperEdge){if(null===(r=t.mesh.connect(p.regionBelow(e).eUp.Sym,e.eUp.Lnext)))return null;p.fixUpperEdge(t,e,r),e=p.regionAbove(e)}return e},p.topRightRegion=function(t){var e=t.eUp.Dst;do{t=p.regionAbove(t)}while(t.eUp.Dst===e);return t},p.addRegionBelow=function(t,e,r){var n=new g;return n.eUp=r,n.nodeUp=t.dict.insertBefore(e.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},p.isWindingInside=function(t,e){switch(t.windingRule){case n.WINDING_ODD:return 0!=(1&e);case n.WINDING_NONZERO:return 0!==e;case n.WINDING_POSITIVE:return e>0;case n.WINDING_NEGATIVE:return e<0;case n.WINDING_ABS_GEQ_TWO:return e>=2||e<=-2}return o(!1),!1},p.computeWinding=function(t,e){e.windingNumber=p.regionAbove(e).windingNumber+e.eUp.winding,e.inside=p.isWindingInside(t,e.windingNumber)},p.finishRegion=function(t,e){var r=e.eUp,n=r.Lface;n.inside=e.inside,n.anEdge=r,p.deleteRegion(t,e)},p.finishLeftRegions=function(t,e,r){for(var n,i=null,o=e,a=e.eUp;o!==r;){if(o.fixUpperEdge=!1,(n=(i=p.regionBelow(o)).eUp).Org!=a.Org){if(!i.fixUpperEdge){p.finishRegion(t,o);break}n=t.mesh.connect(a.Lprev,n.Sym),p.fixUpperEdge(t,i,n)}a.Onext!==n&&(t.mesh.splice(n.Oprev,n),t.mesh.splice(a,n)),p.finishRegion(t,o),a=i.eUp,o=i}return a},p.addRightEdges=function(t,e,r,n,a,u){var s,l,c,f,h=!0;c=r;do{o(i.vertLeq(c.Org,c.Dst)),p.addRegionBelow(t,e,c.Sym),c=c.Onext}while(c!==n);for(null===a&&(a=p.regionBelow(e).eUp.Rprev),l=e,f=a;(c=(s=p.regionBelow(l)).eUp.Sym).Org===f.Org;)c.Onext!==f&&(t.mesh.splice(c.Oprev,c),t.mesh.splice(f.Oprev,c)),s.windingNumber=l.windingNumber-c.winding,s.inside=p.isWindingInside(t,s.windingNumber),l.dirty=!0,!h&&p.checkForRightSplice(t,l)&&(p.addWinding(c,f),p.deleteRegion(t,l),t.mesh.delete(f)),h=!1,l=s,f=c;l.dirty=!0,o(l.windingNumber-c.winding===s.windingNumber),u&&p.walkDirtyRegions(t,l)},p.spliceMergeVertices=function(t,e,r){t.mesh.splice(e,r)},p.vertexWeights=function(t,e,r){var n=i.vertL1dist(e,t),o=i.vertL1dist(r,t),a=.5*o/(n+o),u=.5*n/(n+o);t.coords[0]+=a*e.coords[0]+u*r.coords[0],t.coords[1]+=a*e.coords[1]+u*r.coords[1],t.coords[2]+=a*e.coords[2]+u*r.coords[2]},p.getIntersectData=function(t,e,r,n,i,o){e.coords[0]=e.coords[1]=e.coords[2]=0,e.idx=-1,p.vertexWeights(e,r,n),p.vertexWeights(e,i,o)},p.checkForRightSplice=function(t,e){var r=p.regionBelow(e),n=e.eUp,o=r.eUp;if(i.vertLeq(n.Org,o.Org)){if(i.edgeSign(o.Dst,n.Org,o.Org)>0)return!1;i.vertEq(n.Org,o.Org)?n.Org!==o.Org&&(t.pq.delete(n.Org.pqHandle),p.spliceMergeVertices(t,o.Oprev,n)):(t.mesh.splitEdge(o.Sym),t.mesh.splice(n,o.Oprev),e.dirty=r.dirty=!0)}else{if(i.edgeSign(n.Dst,o.Org,n.Org)<0)return!1;p.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(n.Sym),t.mesh.splice(o.Oprev,n)}return!0},p.checkForLeftSplice=function(t,e){var r,n=p.regionBelow(e),a=e.eUp,u=n.eUp;if(o(!i.vertEq(a.Dst,u.Dst)),i.vertLeq(a.Dst,u.Dst)){if(i.edgeSign(a.Dst,u.Dst,a.Org)<0)return!1;p.regionAbove(e).dirty=e.dirty=!0,r=t.mesh.splitEdge(a),t.mesh.splice(u.Sym,r),r.Lface.inside=e.inside}else{if(i.edgeSign(u.Dst,a.Dst,u.Org)>0)return!1;e.dirty=n.dirty=!0,r=t.mesh.splitEdge(u),t.mesh.splice(a.Lnext,u.Sym),r.Rface.inside=e.inside}return!0},p.checkForIntersect=function(t,e){var r,n,u=p.regionBelow(e),s=e.eUp,l=u.eUp,c=s.Org,f=l.Org,h=s.Dst,d=l.Dst,v=new a;if(o(!i.vertEq(d,h)),o(i.edgeSign(h,t.event,c)<=0),o(i.edgeSign(d,t.event,f)>=0),o(c!==t.event&&f!==t.event),o(!e.fixUpperEdge&&!u.fixUpperEdge),c===f)return!1;if(Math.min(c.t,h.t)>Math.max(f.t,d.t))return!1;if(i.vertLeq(c,f)){if(i.edgeSign(d,c,f)>0)return!1}else if(i.edgeSign(h,f,c)<0)return!1;return p.debugEvent(t),i.intersect(h,c,d,f,v),o(Math.min(c.t,h.t)<=v.t),o(v.t<=Math.max(f.t,d.t)),o(Math.min(d.s,h.s)<=v.s),o(v.s<=Math.max(f.s,c.s)),i.vertLeq(v,t.event)&&(v.s=t.event.s,v.t=t.event.t),r=i.vertLeq(c,f)?c:f,i.vertLeq(r,v)&&(v.s=r.s,v.t=r.t),i.vertEq(v,c)||i.vertEq(v,f)?(p.checkForRightSplice(t,e),!1):!i.vertEq(h,t.event)&&i.edgeSign(h,t.event,v)>=0||!i.vertEq(d,t.event)&&i.edgeSign(d,t.event,v)<=0?d===t.event?(t.mesh.splitEdge(s.Sym),t.mesh.splice(l.Sym,s),e=p.topLeftRegion(t,e),s=p.regionBelow(e).eUp,p.finishLeftRegions(t,p.regionBelow(e),u),p.addRightEdges(t,e,s.Oprev,s,s,!0),!0):h===t.event?(t.mesh.splitEdge(l.Sym),t.mesh.splice(s.Lnext,l.Oprev),u=e,e=p.topRightRegion(e),n=p.regionBelow(e).eUp.Rprev,u.eUp=l.Oprev,l=p.finishLeftRegions(t,u,null),p.addRightEdges(t,e,l.Onext,s.Rprev,n,!0),!0):(i.edgeSign(h,t.event,v)>=0&&(p.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(s.Sym),s.Org.s=t.event.s,s.Org.t=t.event.t),i.edgeSign(d,t.event,v)<=0&&(e.dirty=u.dirty=!0,t.mesh.splitEdge(l.Sym),l.Org.s=t.event.s,l.Org.t=t.event.t),!1):(t.mesh.splitEdge(s.Sym),t.mesh.splitEdge(l.Sym),t.mesh.splice(l.Oprev,s),s.Org.s=v.s,s.Org.t=v.t,s.Org.pqHandle=t.pq.insert(s.Org),p.getIntersectData(t,s.Org,c,h,f,d),p.regionAbove(e).dirty=e.dirty=u.dirty=!0,!1)},p.walkDirtyRegions=function(t,e){for(var r,n,i=p.regionBelow(e);;){for(;i.dirty;)e=i,i=p.regionBelow(i);if(!e.dirty&&(i=e,null===(e=p.regionAbove(e))||!e.dirty))return;if(e.dirty=!1,r=e.eUp,n=i.eUp,r.Dst!==n.Dst&&p.checkForLeftSplice(t,e)&&(i.fixUpperEdge?(p.deleteRegion(t,i),t.mesh.delete(n),n=(i=p.regionBelow(e)).eUp):e.fixUpperEdge&&(p.deleteRegion(t,e),t.mesh.delete(r),r=(e=p.regionAbove(i)).eUp)),r.Org!==n.Org)if(r.Dst===n.Dst||e.fixUpperEdge||i.fixUpperEdge||r.Dst!==t.event&&n.Dst!==t.event)p.checkForRightSplice(t,e);else if(p.checkForIntersect(t,e))return;r.Org===n.Org&&r.Dst===n.Dst&&(p.addWinding(n,r),p.deleteRegion(t,e),t.mesh.delete(r),e=p.regionAbove(i))}},p.connectRightVertex=function(t,e,r){var n,o=r.Onext,a=p.regionBelow(e),u=e.eUp,s=a.eUp,l=!1;u.Dst!==s.Dst&&p.checkForIntersect(t,e),i.vertEq(u.Org,t.event)&&(t.mesh.splice(o.Oprev,u),e=p.topLeftRegion(t,e),o=p.regionBelow(e).eUp,p.finishLeftRegions(t,p.regionBelow(e),a),l=!0),i.vertEq(s.Org,t.event)&&(t.mesh.splice(r,s.Oprev),r=p.finishLeftRegions(t,a,null),l=!0),l?p.addRightEdges(t,e,r.Onext,o,o,!0):(n=i.vertLeq(s.Org,u.Org)?s.Oprev:u,n=t.mesh.connect(r.Lprev,n),p.addRightEdges(t,e,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,p.walkDirtyRegions(t,e))},p.connectLeftDegenerate=function(t,e,r){var n,a,u,s,l;return n=e.eUp,i.vertEq(n.Org,r)?(o(!1),void p.spliceMergeVertices(t,n,r.anEdge)):i.vertEq(n.Dst,r)?(o(!1),e=p.topRightRegion(e),a=s=(u=(l=p.regionBelow(e)).eUp.Sym).Onext,l.fixUpperEdge&&(o(a!==u),p.deleteRegion(t,l),t.mesh.delete(u),u=a.Oprev),t.mesh.splice(r.anEdge,u),i.edgeGoesLeft(a)||(a=null),void p.addRightEdges(t,e,u.Onext,s,a,!0)):(t.mesh.splitEdge(n.Sym),e.fixUpperEdge&&(t.mesh.delete(n.Onext),e.fixUpperEdge=!1),t.mesh.splice(r.anEdge,n),void p.sweepEvent(t,r))},p.connectLeftVertex=function(t,e){var r,n,o,a,u,s,l=new g;if(l.eUp=e.anEdge.Sym,r=t.dict.search(l).key,n=p.regionBelow(r))if(a=r.eUp,u=n.eUp,0!==i.edgeSign(a.Dst,e,a.Org))if(o=i.vertLeq(u.Dst,a.Dst)?r:n,r.inside||o.fixUpperEdge){if(o===r)s=t.mesh.connect(e.anEdge.Sym,a.Lnext);else s=t.mesh.connect(u.Dnext,e.anEdge).Sym;o.fixUpperEdge?p.fixUpperEdge(t,o,s):p.computeWinding(t,p.addRegionBelow(t,r,s)),p.sweepEvent(t,e)}else p.addRightEdges(t,r,e.anEdge,e.anEdge,null,!0);else p.connectLeftDegenerate(t,r,e)},p.sweepEvent=function(t,e){t.event=e,p.debugEvent(t);for(var r=e.anEdge;null===r.activeRegion;)if((r=r.Onext)===e.anEdge)return void p.connectLeftVertex(t,e);var n=p.topLeftRegion(t,r.activeRegion);o(null!==n);var i=p.regionBelow(n),a=i.eUp,u=p.finishLeftRegions(t,i,null);u.Onext===a?p.connectRightVertex(t,n,u):p.addRightEdges(t,n,u.Onext,a,a,!0)},p.addSentinel=function(t,e,r,n){var i=new g,o=t.mesh.makeEdge();o.Org.s=r,o.Org.t=n,o.Dst.s=e,o.Dst.t=n,t.event=o.Dst,i.eUp=o,i.windingNumber=0,i.inside=!1,i.fixUpperEdge=!1,i.sentinel=!0,i.dirty=!1,i.nodeUp=t.dict.insert(i)},p.initEdgeDict=function(t){t.dict=new f(t,p.edgeLeq);var e=t.bmax[0]-t.bmin[0],r=t.bmax[1]-t.bmin[1],n=t.bmin[0]-e,i=t.bmax[0]+e,o=t.bmin[1]-r,a=t.bmax[1]+r;p.addSentinel(t,n,i,o),p.addSentinel(t,n,i,a)},p.doneEdgeDict=function(t){for(var e,r=0;null!==(e=t.dict.min().key);)e.sentinel||(o(e.fixUpperEdge),o(1==++r)),o(0===e.windingNumber),p.deleteRegion(t,e)},p.removeDegenerateEdges=function(t){var e,r,n,o=t.mesh.eHead;for(e=o.next;e!==o;e=r)r=e.next,n=e.Lnext,i.vertEq(e.Org,e.Dst)&&e.Lnext.Lnext!==e&&(p.spliceMergeVertices(t,n,e),t.mesh.delete(e),n=(e=n).Lnext),n.Lnext===e&&(n!==e&&(n!==r&&n!==r.Sym||(r=r.next),t.mesh.delete(n)),e!==r&&e!==r.Sym||(r=r.next),t.mesh.delete(e))},p.initPriorityQ=function(t){var e,r,n,o=0;for(r=(n=t.mesh.vHead).next;r!==n;r=r.next)o++;for(o+=8,e=t.pq=new v(o,i.vertLeq),r=(n=t.mesh.vHead).next;r!==n;r=r.next)r.pqHandle=e.insert(r);return r===n&&(e.init(),!0)},p.donePriorityQ=function(t){t.pq=null},p.removeDegenerateFaces=function(t,e){var r,n,i;for(r=e.fHead.next;r!==e.fHead;r=n)n=r.next,i=r.anEdge,o(i.Lnext!==i),i.Lnext.Lnext===i&&(p.addWinding(i.Onext,i),t.mesh.delete(i));return!0},p.computeInterior=function(t){var e,r;if(p.removeDegenerateEdges(t),!p.initPriorityQ(t))return!1;for(p.initEdgeDict(t);null!==(e=t.pq.extractMin());){for(;null!==(r=t.pq.min())&&i.vertEq(r,e);)r=t.pq.extractMin(),p.spliceMergeVertices(t,e.anEdge,r.anEdge);p.sweepEvent(t,e)}return t.event=t.dict.min().key.eUp.Org,p.debugEvent(t),p.doneEdgeDict(t),p.donePriorityQ(t),!!p.removeDegenerateFaces(t,t.mesh)&&(t.mesh.check(),!0)},m.prototype={dot_:function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},normalize_:function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];o(e>0),e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},longAxis_:function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},computeNormal_:function(t){var e,r,n,i,o,a,u,s=[0,0,0],l=[0,0,0],c=[0,0,0],f=[0,0,0],h=[0,0,0],d=[null,null,null],v=[null,null,null],g=this.mesh.vHead;for(e=g.next,u=0;u<3;++u)i=e.coords[u],l[u]=i,v[u]=e,s[u]=i,d[u]=e;for(e=g.next;e!==g;e=e.next)for(u=0;u<3;++u)(i=e.coords[u])<l[u]&&(l[u]=i,v[u]=e),i>s[u]&&(s[u]=i,d[u]=e);if(u=0,s[1]-l[1]>s[0]-l[0]&&(u=1),s[2]-l[2]>s[u]-l[u]&&(u=2),l[u]>=s[u])return t[0]=0,t[1]=0,void(t[2]=1);for(a=0,r=v[u],n=d[u],c[0]=r.coords[0]-n.coords[0],c[1]=r.coords[1]-n.coords[1],c[2]=r.coords[2]-n.coords[2],e=g.next;e!==g;e=e.next)f[0]=e.coords[0]-n.coords[0],f[1]=e.coords[1]-n.coords[1],f[2]=e.coords[2]-n.coords[2],h[0]=c[1]*f[2]-c[2]*f[1],h[1]=c[2]*f[0]-c[0]*f[2],h[2]=c[0]*f[1]-c[1]*f[0],(o=h[0]*h[0]+h[1]*h[1]+h[2]*h[2])>a&&(a=o,t[0]=h[0],t[1]=h[1],t[2]=h[2]);a<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(c)]=1)},checkOrientation_:function(){var t,e,r,n,i=this.mesh.fHead,o=this.mesh.vHead;for(t=0,e=i.next;e!==i;e=e.next)if(!((n=e.anEdge).winding<=0))do{t+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext}while(n!==e.anEdge);if(t<0){for(r=o.next;r!==o;r=r.next)r.t=-r.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},projectPolygon_:function(){var t,e,r,n,i,o=this.mesh.vHead,a=[0,0,0],u=!1;for(a[0]=this.normal[0],a[1]=this.normal[1],a[2]=this.normal[2],0===a[0]&&0===a[1]&&0===a[2]&&(this.computeNormal_(a),u=!0),e=this.sUnit,r=this.tUnit,e[n=this.longAxis_(a)]=0,e[(n+1)%3]=1,e[(n+2)%3]=0,r[n]=0,r[(n+1)%3]=0,r[(n+2)%3]=a[n]>0?1:-1,t=o.next;t!==o;t=t.next)t.s=this.dot_(t.coords,e),t.t=this.dot_(t.coords,r);for(u&&this.checkOrientation_(),i=!0,t=o.next;t!==o;t=t.next)i?(this.bmin[0]=this.bmax[0]=t.s,this.bmin[1]=this.bmax[1]=t.t,i=!1):(t.s<this.bmin[0]&&(this.bmin[0]=t.s),t.s>this.bmax[0]&&(this.bmax[0]=t.s),t.t<this.bmin[1]&&(this.bmin[1]=t.t),t.t>this.bmax[1]&&(this.bmax[1]=t.t))},addWinding_:function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},tessellateMonoRegion_:function(t,e){var r,n;for(r=e.anEdge,o(r.Lnext!==r&&r.Lnext.Lnext!==r);i.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;i.vertLeq(r.Org,r.Dst);r=r.Lnext);for(n=r.Lprev;r.Lnext!==n;)if(i.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(i.edgeGoesLeft(n.Lnext)||i.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);){n=t.connect(n.Lnext,n).Sym}n=n.Lprev}else{for(;n.Lnext!==r&&(i.edgeGoesRight(r.Lprev)||i.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);){r=t.connect(r,r.Lprev).Sym}r=r.Lnext}for(o(n.Lnext!==r);n.Lnext.Lnext!==r;){n=t.connect(n.Lnext,n).Sym}return!0},tessellateInterior_:function(t){var e,r;for(e=t.fHead.next;e!==t.fHead;e=r)if(r=e.next,e.inside&&!this.tessellateMonoRegion_(t,e))return!1;return!0},discardExterior_:function(t){var e,r;for(e=t.fHead.next;e!==t.fHead;e=r)r=e.next,e.inside||t.zapFace(e)},setWindingNumber_:function(t,e,r){var n,i;for(n=t.eHead.next;n!==t.eHead;n=i)i=n.next,n.Rface.inside!==n.Lface.inside?n.winding=n.Lface.inside?e:-e:r?t.delete(n):n.winding=0},getNeighbourFace_:function(t){return t.Rface&&t.Rface.inside?t.Rface.n:-1},outputPolymesh_:function(t,e,r,i){var a,u,s,l,c,f=0,h=0;for(r>3&&t.mergeConvexFaces(r),a=t.vHead.next;a!==t.vHead;a=a.next)a.n=-1;for(u=t.fHead.next;u!==t.fHead;u=u.next)if(u.n=-1,u.inside){s=u.anEdge,l=0;do{-1===(a=s.Org).n&&(a.n=h,h++),l++,s=s.Lnext}while(s!==u.anEdge);o(l<=r),u.n=f,++f}for(this.elementCount=f,e===n.CONNECTED_POLYGONS&&(f*=2),this.elements=[],this.elements.length=f*r,this.vertexCount=h,this.vertices=[],this.vertices.length=h*i,this.vertexIndices=[],this.vertexIndices.length=h,a=t.vHead.next;a!==t.vHead;a=a.next)if(-1!==a.n){var d=a.n*i;this.vertices[d+0]=a.coords[0],this.vertices[d+1]=a.coords[1],i>2&&(this.vertices[d+2]=a.coords[2]),this.vertexIndices[a.n]=a.idx}var v=0;for(u=t.fHead.next;u!==t.fHead;u=u.next)if(u.inside){s=u.anEdge,l=0;do{a=s.Org,this.elements[v++]=a.n,l++,s=s.Lnext}while(s!==u.anEdge);for(c=l;c<r;++c)this.elements[v++]=-1;if(e===n.CONNECTED_POLYGONS){s=u.anEdge;do{this.elements[v++]=this.getNeighbourFace_(s),s=s.Lnext}while(s!==u.anEdge);for(c=l;c<r;++c)this.elements[v++]=-1}}},outputContours_:function(t,e){var r,n,i,o=0,a=0;for(this.vertexCount=0,this.elementCount=0,r=t.fHead.next;r!==t.fHead;r=r.next)if(r.inside){i=n=r.anEdge;do{this.vertexCount++,n=n.Lnext}while(n!==i);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*e,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var u=0,s=0,l=0;for(o=0,r=t.fHead.next;r!==t.fHead;r=r.next)if(r.inside){a=0,i=n=r.anEdge;do{this.vertices[u++]=n.Org.coords[0],this.vertices[u++]=n.Org.coords[1],e>2&&(this.vertices[u++]=n.Org.coords[2]),this.vertexIndices[s++]=n.Org.idx,a++,n=n.Lnext}while(n!==i);this.elements[l++]=o,this.elements[l++]=a,o+=a}},addContour:function(t,e){var r,n;for(null===this.mesh&&(this.mesh=new l),t<2&&(t=2),t>3&&(t=3),r=null,n=0;n<e.length;n+=t)null===r?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=e[n+0],r.Org.coords[1]=e[n+1],r.Org.coords[2]=t>2?e[n+2]:0,r.Org.idx=this.vertexIndexCounter++,r.winding=1,r.Sym.winding=-1},tesselate:function(t,e,r,i,o){if(this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,o&&(this.normal[0]=o[0],this.normal[1]=o[1],this.normal[2]=o[2]),this.windingRule=t,i<2&&(i=2),i>3&&(i=3),!this.mesh)return!1;this.projectPolygon_(),p.computeInterior(this);var a=this.mesh;return e===n.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),a.check(),e===n.BOUNDARY_CONTOURS?this.outputContours_(a,i):this.outputPolymesh_(a,e,r,i),!0}}},function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var i in n)r.call(n,i)&&(t[i]=n[i])}return t};var r=Object.prototype.hasOwnProperty},function(t,e,r){"use strict";r.r(e),r.d(e,"Renderer",(function(){return je})),r.d(e,"Figure2D",(function(){return Ft})),r.d(e,"Mesh2D",(function(){return _e})),r.d(e,"MeshCloud",(function(){return et})),r.d(e,"parseFont",(function(){return y.a})),r.d(e,"parseColor",(function(){return j})),r.d(e,"ENV",(function(){return m.a}));var n=r(2),i=r.n(n),o=r(1),a=r.n(o),u=r(6),s=r.n(u),l=r(5),c=r.n(l),f=r(15),h=r(0),d=r(4),v=r.n(d),g=r(9),p=r.n(g),m=r(8),x=r(7),y=r(11);function b(t,e,r){return t*(1-r)+e*r}function M(t,e){var r=i()(t,2),n=r[0],o=r[1];return[n*e[0]+o*e[2]+e[4],n*e[1]+o*e[3]+e[5]]}function _(t,e){var r=t.canvas;t.save(),t.filter=e,t.drawImage(r,0,0,r.width,r.height),t.restore()}function S(t,e){var r=/rgba\((\d+),(\d+),(\d+),(\d+)\)/;t=t.match(r).slice(1,5).map(Number);for(var n=[],i=(e=e.match(r).slice(1,5).map(Number))[3],o=0;o<4;o++)n[o]=b(t[o],e[o],i);return"rgba(".concat(n.join(),")")}function w(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;e.save();var s=!1,l=!1;if(e.globalAlpha=t.getOpacity(),t._updateMatrix){var c=t.transformScale/t.contours.scale;c>1.5&&t.accurate(t.transformScale)}if(t.lineWidth){var f=t.gradient&&t.gradient.stroke;if(f){var d=f,v=d.vector,g=d.colors;if(6===v.length)f=e.createRadialGradient.apply(e,a()(v));else if(4===v.length)f=e.createLinearGradient.apply(e,a()(v));else{if(3!==v.length)throw new TypeError("Invalid vector dimension.");f=e.createCircularGradient.apply(e,a()(v))}g.forEach((function(t){var e=t.offset,r=t.color,n=Object(x.a)(r);i&&(n=S(n,i)),f.addColorStop(e,n)})),e.strokeStyle=f,s=!0}else t.strokeStyle&&(e.strokeStyle=i?S(t.strokeStyle,i):t.strokeStyle,s=!0)}s&&(e.lineWidth=t.lineWidth,e.lineJoin=t.lineJoin,e.lineCap=t.lineCap,e.miterLimit=t.miterLimit,t.lineDash&&(e.setLineDash(t.lineDash),t.lineDashOffset&&(e.lineDashOffset=t.lineDashOffset)));var p=t.gradient&&t.gradient.fill;if(p){var m=p,b=m.vector,M=m.colors;if(6===b.length)p=e.createRadialGradient.apply(e,a()(b));else if(4===b.length)p=e.createLinearGradient.apply(e,a()(b));else{if(3!==b.length)throw new TypeError("Invalid vector dimension.");p=e.createCircularGradient.apply(e,a()(b))}M.forEach((function(t){var e=t.offset,r=t.color,n=Object(x.a)(r);i&&(n=S(n,i)),p.addColorStop(e,n)})),e.fillStyle=p,l=!0}else t.fillStyle&&(e.fillStyle=n?S(t.fillStyle,n):t.fillStyle,l=!0);if(u&&e.transform.apply(e,a()(u)),e.transform.apply(e,a()(t.transformMatrix)),t.clipPath){var w=t.clipPath,E=new Path2D(w);e.clip(E)}var C=t.contours.length;if(t.contours.forEach((function(r,n){var i=r.length,u=i>1&&h.vec2.equals(r[0],r[i-1]),c=n===C-1&&t.texture;if(r&&i>0){if(l||s||c){e.beginPath(),e.moveTo.apply(e,a()(r[0]));for(var f=1;f<i;f++)f===i-1&&u?e.closePath():e.lineTo.apply(e,a()(r[f]))}if(l&&e.fill(t.fillRule),c){e.save(),e.clip();var d=t.texture,v=d.image,g=d.options;if(o&&(v=o),g.repeat&&console.warn("Context 2D not supported image repeat yet."),v.font){g.scale&&console.warn("Context 2D not supported text scale yet."),g.srcRect&&console.warn("Context 2D not supported text srcRect yet.");var p=v,m=p.font,b=p.fillColor,M=p.strokeColor,_=p.strokeWidth,S=p.text;b||M||(b="#000"),Array.isArray(b)&&(b=Object(x.a)(b)),Array.isArray(M)&&(M=Object(x.a)(M)),e.font=m;var w=e.measureText(S).width,E=Object(y.a)(m),O=Math.max(E.pxLineHeight,1.13*E.pxHeight);e.textAlign="center",e.textBaseline="middle";var k=g.rect,A=k[0]+.5*O+.06*E.pxHeight,R=k[1]+.5*w;null!=k[2]&&e.scale(k[2]/w,k[3]/O),b&&(e.fillStyle=b,e.fillText(S,R,A)),M&&(e.lineWidth=_,e.strokeStyle=M,e.strokeText(S,R,A))}else{var T=g.rect,L=g.srcRect;g.scale&&(T=[0,0,e.canvas.width,e.canvas.height]),g.rotated&&T&&(T=[-T[1],T[0],T[3],T[2]]),L&&(T=T||[0,0,L[2],L[3]]),g.rotated&&(e.translate(0,T?T[2]:v.width),e.rotate(-.5*Math.PI)),L?e.drawImage.apply(e,[v].concat(a()(L),a()(T))):T?e.drawImage.apply(e,[v].concat(a()(T))):e.drawImage(v,0,0)}e.restore()}s&&e.stroke()}})),e.restore(),r){var O=t.filter;O&&_(e,O)}}r(0).glMatrix.setMatrixArrayType(Array),r(0).glMatrix.setMatrixArrayType(Array),r(0).glMatrix.setMatrixArrayType(Array);var E=Symbol("transform"),C=function(){function t(e,r){s()(this,t),this.context=e.getContext("2d"),this.options=r,this[E]=[1,0,0,1,0,0]}var e;return c()(t,[{key:"createTexture",value:function(t){return{_img:t}}},{key:"loadTexture",value:(e=p()(v.a.mark((function t(e){var r;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m.a.loadImage(e,{useImageBitmap:!1});case 2:return r=t.sent,t.abrupt("return",this.createTexture(r));case 4:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"deleteTexture",value:function(t){return t}},{key:"clear",value:function(t,e,r,n){var i=this.context;t=t||0,e=e||0,r=r||i.canvas.width-t,n=n||i.canvas.height-e,i.clearRect(t,e,r,n)}},{key:"drawMeshCloud",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.clear,n=void 0!==r&&r,i=[],o=0;o<t.amount;o++){var a=t.getTransform(o),u=t.getTextureFrame(o);u&&(u=u._img);var s=t.getFilter(o),l=t.getCloudRGBA(o),c=l.fill,f=l.stroke;i.push({mesh:t.mesh,_cloudOptions:[c,f,u,a,s]})}t.beforeRender&&t.beforeRender(this.context,t),this.drawMeshes(i,{clear:n,hook:!1}),t.afterRender&&t.afterRender(this.context,t)}},{key:"drawMeshes",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.clear,o=void 0!==n&&n,u=r.hook,s=void 0===u||u,l=this.context;o&&l.clearRect(0,0,l.canvas.width,l.canvas.height);var c=null,f=l.canvas,h=f.width,d=f.height,v=t.length;t.forEach((function(t,r){var n,o,u,f,g;if(s&&t.beforeRender&&t.beforeRender(l,t),t._cloudOptions){var p=i()(t._cloudOptions,5);n=p[0],o=p[1],u=p[2],f=p[3],g=p[4],t=t.mesh}var x,y=t.filter;if(g&&(y=y?"".concat(y," ").concat(g):g),y&&!e.filterBuffer&&!1!==e.filterBuffer){var b=m.a.createCanvas(h,d);e.filterBuffer=!!b&&b.getContext("2d")}(c&&c!==y&&(_(e.filterBuffer,c),l.drawImage(e.filterBuffer.canvas,0,0,h,d),e.filterBuffer.clearRect(0,0,h,d),c=null),y&&e.filterBuffer)?(e.filterBuffer.save(),(x=e.filterBuffer).transform.apply(x,a()(e[E])),w(t,e.filterBuffer,!1,n,o,u,f),e.filterBuffer.restore(),r===v-1?(_(e.filterBuffer,y),l.drawImage(e.filterBuffer.canvas,0,0,h,d),e.filterBuffer.clearRect(0,0,h,d)):c=y):(l.save(),l.transform.apply(l,a()(e[E])),w(t,l,!1,n,o,u,f),l.restore());s&&t.afterRender&&t.afterRender(l,t)}))}},{key:"setTransform",value:function(t){this[E]=t}}]),t}();r(0).glMatrix.setMatrixArrayType(Array);var O={UNSIGNED_BYTE:Uint8Array,UNSIGNED_SHORT:Uint16Array,BYTE:Int8Array,SHORT:Int16Array,FLOAT:Float32Array};function k(t,e){var r=[],n=[],o=[],u=[],s=[],l=[],c=0,f=0,h=t[0]&&t[0].uniforms||{},d=t[0]?t[0].program:null;e&&(!function(t,e){for(var r=0,n=0,o=0,a=0,u=0,s=0,l=0,c=t[0].program,f=0;f<t.length;f++){var h=t[f].meshData;if(h){l+=h.positions.length;var d=h.positions[0].length;r+=h.positions.length*d,n+=3*h.cells.length,s+=4*h.attributes.a_color.length;var v=h.textureCoord;v&&(o+=v.length*v[0].length);var g=h.attributes.a_sourceRect;g&&(a+=4*g.length);var p=h.attributes.a_clipUV;p&&(u+=2*p.length)}}if((!e.positions||e.positions.length<r)&&(e.positions=new Float32Array(r)),(!e.cells||e.cells.length<n)&&(e.cells=new Uint16Array(n)),o&&(!e.textureCoord||e.textureCoord.length<o)&&(e.textureCoord=new Float32Array(o)),(!e.a_color||e.a_color.length<s)&&(e.a_color=new Uint8Array(s)),a&&(!e.a_sourceRect||e.a_sourceRect.length<a)&&(e.a_sourceRect=new Float32Array(a)),u&&(!e.a_clipUV||e.a_clipUV.length<u)&&(e.a_clipUV=new Float32Array(u)),c)for(var m=Object.entries(c._attribute),x=c._attribOpts||{},y=0;y<m.length;y++){var b=i()(m[y],2),M=b[0],_=b[1];if("a_color"!==M&&"a_sourceRect"!==M&&"ignored"!==_){var S=x[M]?x[M].type:"FLOAT",w=O[S],E=_.size*l;(!e[M]||e[M].length<E)&&(e[M]=new w(E))}}}(t,e),n=e.cells,r=e.positions,o=e.textureCoord,u=e.a_color,s=e.a_sourceRect,l=e.a_clipUV);for(var v=!1,g=!1,p={},m=0;m<t.length;m++){var x=t[m];if(x){var y;if(x.meshData&&(x=x.meshData),e)for(var b=x.positions,M=0;M<b.length;M++)for(var _=b[M],S=3*(c+M),w=0;w<_.length;w++)r[S+w]=_[w];else(y=r).push.apply(y,a()(x.positions));for(var E,C,k,A,R=x.cells,T=0;T<R.length;T++){var L=R[T];if(e){var D=3*(f+T);n[D]=L[0]+c,n[D+1]=L[1]+c,n[D+2]=L[2]+c}else n.push([L[0]+c,L[1]+c,L[2]+c])}if(e)for(var I=x.attributes.a_color,F=0;F<I.length;F++){var U=I[F],P=4*(c+F);u[P]=U[0],u[P+1]=U[1],u[P+2]=U[2],u[P+3]=U[3]}else(E=u).push.apply(E,a()(x.attributes.a_color));if(x.attributes.a_sourceRect)if(v=!0,e)for(var B=x.attributes.a_sourceRect,N=0;N<B.length;N++){var G=B[N],q=4*(c+N);s[q]=G[0],s[q+1]=G[1],s[q+2]=G[2],s[q+3]=G[3]}else(C=s).push.apply(C,a()(x.attributes.a_sourceRect));if(x.attributes.a_clipUV)if(g=!0,e)for(var j=x.attributes.a_clipUV,V=0;V<j.length;V++){var H=j[V],z=2*(c+V);l[z]=H[0],l[z+1]=H[1]}else(k=l).push.apply(k,a()(x.attributes.a_clipUV));if(x.textureCoord)if(e)for(var W=x.textureCoord,Y=0;Y<W.length;Y++)for(var X=W[Y],Q=3*(c+Y),Z=0;Z<X.length;Z++)o[Q+Z]=X[Z];else(A=o).push.apply(A,a()(x.textureCoord));if(d)for(var J=Object.entries(d._attribute),$=0;$<J.length;$++){var K=i()(J[$],2),tt=K[0],et=K[1];if("a_color"!==tt&&"a_sourceRect"!==tt&&"ignored"!==et)if(p[tt]=[],e){p[tt]=e[tt];for(var rt=x.attributes[tt],nt=rt[0].length,it=0;it<rt.length;it++)for(var ot=rt[it],at=nt*(c+it),ut=0;ut<ot.length;ut++)p[tt][at+ut]=ot[ut]}else{var st;(st=p[tt]).push.apply(st,a()(x.attributes[tt]))}}c+=x.positions.length,f+=x.cells.length}}p.a_color=u,v&&s&&s.length>0&&(p.a_sourceRect=s);var lt={positions:r,cells:n,attributes:p,uniforms:h,cellsCount:3*f,program:d};return o&&o.length&&(lt.textureCoord=o),g&&l.length>0&&(p.a_clipUV=l),lt}var A=r(10),R=r.n(A);function T(t,e){var r=[],n=t[0],i=t[1],o=t[2],a=t[3],u=t[4],s=t[5],l=t[6],c=t[7],f=t[8],h=t[9],d=t[10],v=t[11],g=t[12],p=t[13],m=t[14],x=t[15],y=t[16],b=t[17],M=t[18],_=t[19],S=e[0],w=e[1],E=e[2],C=e[3],O=e[4];return r[0]=S*n+w*s+E*d+C*x,r[1]=S*i+w*l+E*v+C*y,r[2]=S*o+w*c+E*g+C*b,r[3]=S*a+w*f+E*p+C*M,r[4]=S*u+w*h+E*m+C*_+O,S=e[5],w=e[6],E=e[7],C=e[8],O=e[9],r[5]=S*n+w*s+E*d+C*x,r[6]=S*i+w*l+E*v+C*y,r[7]=S*o+w*c+E*g+C*b,r[8]=S*a+w*f+E*p+C*M,r[9]=S*u+w*h+E*m+C*_+O,S=e[10],w=e[11],E=e[12],C=e[13],O=e[14],r[10]=S*n+w*s+E*d+C*x,r[11]=S*i+w*l+E*v+C*y,r[12]=S*o+w*c+E*g+C*b,r[13]=S*a+w*f+E*p+C*M,r[14]=S*u+w*h+E*m+C*_+O,S=e[15],w=e[16],E=e[17],C=e[18],O=e[19],r[15]=S*n+w*s+E*d+C*x,r[16]=S*i+w*l+E*v+C*y,r[17]=S*o+w*c+E*g+C*b,r[18]=S*a+w*f+E*p+C*M,r[19]=S*u+w*h+E*m+C*_+O,r}function L(t){var e=.2126*(t=function(t,e,r){if(e>r){var n=[r,e];e=n[0],r=n[1]}return t<e?e:t>r?r:t}(0,1,t)),r=.7152*t,n=.0722*t;return[e+1-t,r,n,0,0,e,r+1-t,n,0,0,e,r,n+1-t,0,0,0,0,0,1,0]}function D(t){return[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0]}function I(t){var e=.2126*(1-t),r=.7152*(1-t),n=.0722*(1-t);return[e+t,r,n,0,0,e,r+t,n,0,0,e,r,n+t,0,0,0,0,0,1,0]}function F(t){var e=.5*(1-t);return[t,0,0,0,e,0,t,0,0,e,0,0,t,0,e,0,0,0,1,0]}function U(t){var e=1-2*t;return[e,0,0,0,t,0,e,0,0,t,0,0,e,0,t,0,0,0,1,0]}function P(t){return[1-.607*t,.769*t,.189*t,0,0,.349*t,1-.314*t,.168*t,0,0,.272*t,.534*t,1-.869*t,0,0,0,0,0,1,0]}function B(t){return[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,t,0]}function N(t){var e=t/180*Math.PI,r=Math.cos(e),n=Math.sin(e),i=.2126,o=.7152,a=.0722;return[i+r*(1-i)+n*-i,o+r*-o+n*-o,a+r*-a+n*(1-a),0,0,i+r*-i+.143*n,o+r*(1-o)+.14*n,a+r*-a+-.283*n,0,0,i+r*-i+-.7874*n,o+r*-o+n*o,a+r*(1-a)+n*a,0,0,0,0,0,1,0]}r(0).glMatrix.setMatrixArrayType(Array);var G=r(25),q=r.n(G);function j(t){var e=q()(t);if(!e||!e.length)throw new TypeError("Invalid color value.");return[e[0]/255,e[1]/255,e[2]/255,e[3]]}function V(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function H(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?V(Object(r),!0).forEach((function(e){R()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}r(0).glMatrix.setMatrixArrayType(Array),r(0).glMatrix.setMatrixArrayType(Array);var z=Symbol("mesh"),W=Symbol("count"),Y=Symbol("blend"),X=Symbol("filter"),Q=Symbol("textures"),Z=Symbol("textureOptions"),J=Symbol("cloudColor"),$=Symbol("cloudFilter"),K=Symbol("buffer");function tt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=new Float32Array(3*t),n=new Float32Array(3*t),i=new Float32Array(4*t),o=new Float32Array(4*t),a=new Float32Array(4*t),u=new Float32Array(4*t),s=new Float32Array(4*t),l=new Uint8Array(t),c=new Uint8Array(4*t),f=new Uint8Array(4*t);return e&&(r.set(e.transform0,0),n.set(e.transform1,0),i.set(e.color0,0),o.set(e.color1,0),a.set(e.color2,0),u.set(e.color3,0),s.set(e.color4,0),l.set(e.frameIndex,0),c.set(e.fillColor,0),f.set(e.strokeColor,0)),{bufferSize:t,transform0:r,transform1:n,color0:i,color1:o,color2:a,color3:u,color4:s,frameIndex:l,fillColor:c,strokeColor:f}}var et=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.buffer,o=void 0===i?1e3:i;s()(this,t),o=Math.max(o,r),this[W]=r,this[z]=e,this[K]=tt(o),this[Q]=[],this[X]=[],this[J]=!1,this[$]=!1,this[Y]=!1,this.initBuffer()}return c()(t,[{key:"initBuffer",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this[W],r=t;r<e;r++)this[K].transform0.set([1,0,0],3*r),this[K].transform1.set([0,1,0],3*r),this[K].frameIndex.set([-1],r),this[K].fillColor.set([0,0,0,0],4*r),this[K].strokeColor.set([0,0,0,0],4*r),this.setColorTransform(r,null)}},{key:"_getFilter",value:function(t){return this[X][t]=this[X][t]||[],this[X][t]}},{key:"getFilter",value:function(t){return this._getFilter(t).join(" ")}},{key:"canIgnore",value:function(){return this[z].canIgnore()}},{key:"delete",value:function(t){if(t>=this[W]||t<0)throw new Error("Out of range.");var e=this[K],r=e.transform0,n=e.transform1,i=e.color0,o=e.color1,a=e.color2,u=e.color3,s=e.color4,l=e.frameIndex,c=e.fillColor,f=e.strokeColor;for(var h in r.set(r.subarray(3*(t+1)),3*t),n.set(n.subarray(3*(t+1)),3*t),i.set(i.subarray(4*(t+1)),4*t),o.set(o.subarray(4*(t+1)),4*t),a.set(a.subarray(4*(t+1)),4*t),u.set(u.subarray(4*(t+1)),4*t),s.set(s.subarray(4*(t+1)),4*t),l.set(l.subarray(t+1),t),c.set(c.subarray(4*(t+1)),4*t),f.set(f.subarray(4*(t+1)),4*t),this[X])h===t?delete this[X][h]:h>t&&(this[X][h-1]=this[X][h],delete this[X][h]);this[W]--}},{key:"setColorTransform",value:function(t,e){if(t>=this[W]||t<0)throw new Error("Out of range.");t*=4;var r=this[K],n=r.color0,i=r.color1,o=r.color2,a=r.color3,u=r.color4;return null!=e?(n.set([e[0],e[5],e[10],e[15]],t),i.set([e[1],e[6],e[11],e[16]],t),o.set([e[2],e[7],e[12],e[17]],t),a.set([e[3],e[8],e[13],e[18]],t),u.set([e[4],e[9],e[14],e[19]],t),this[Y]=this[Y]||e[18]<1,this[$]=!0):(n.set([1,0,0,0],t),i.set([0,1,0,0],t),o.set([0,0,1,0],t),a.set([0,0,0,1],t),u.set([0,0,0,0],t)),this}},{key:"getColorTransform",value:function(t){if(t>=this[W]||t<0)throw new Error("Out of range.");t*=4;var e=this[K],r=e.color0,n=e.color1,i=e.color2,o=e.color3,a=e.color4;return[r[t],n[t],i[t],o[t],a[t],r[t+1],n[t+1],i[t+1],o[t+1],a[t+1],r[t+2],n[t+2],i[t+2],o[t+2],a[t+2],r[t+3],n[t+3],i[t+3],o[t+3],a[t+3]]}},{key:"transformColor",value:function(t,e){var r=this.getColorTransform(t);return r=T(r,e),this.setColorTransform(t,r),this}},{key:"setFillColor",value:function(t,e){if(t>=this[W]||t<0)throw new Error("Out of range.");"string"==typeof e&&(e=j(e)),e[3]>0&&(this[J]=!0),this[K].fillColor.set(e.map((function(t){return Math.round(255*t)})),4*t)}},{key:"setStrokeColor",value:function(t,e){if(t>=this[W]||t<0)throw new Error("Out of range.");"string"==typeof e&&(e=j(e)),e[3]>0&&(this[J]=!0),this[K].strokeColor.set(e.map((function(t){return Math.round(255*t)})),4*t)}},{key:"getCloudRGBA",value:function(t){if(t>=this[W]||t<0)throw new Error("Out of range.");t*=4;var e=this[K],r=e.fillColor,n=e.strokeColor,i=[r[t],r[t+1],r[t+2],r[t+3]],o=[n[t],n[t+1],n[t+2],n[t+3]];return i[3]/=255,o[3]/=255,{fill:"rgba(".concat(i.join(),")"),stroke:"rgba(".concat(o.join(),")")}}},{key:"grayscale",value:function(t,e){this.transformColor(t,L(e)),this._getFilter(t).push("grayscale(".concat(100*e,"%)"))}},{key:"brightness",value:function(t,e){this.transformColor(t,D(e)),this._getFilter(t).push("brightness(".concat(100*e,"%)"))}},{key:"saturate",value:function(t,e){this.transformColor(t,I(e)),this._getFilter(t).push("saturate(".concat(100*e,"%)"))}},{key:"contrast",value:function(t,e){this.transformColor(t,F(e)),this._getFilter(t).push("contrast(".concat(100*e,"%)"))}},{key:"invert",value:function(t,e){this.transformColor(t,U(e)),this._getFilter(t).push("invert(".concat(100*e,"%)"))}},{key:"sepia",value:function(t,e){this.transformColor(t,P(e)),this._getFilter(t).push("sepia(".concat(100*e,"%)"))}},{key:"opacity",value:function(t,e){this.transformColor(t,B(e)),this._getFilter(t).push("opacity(".concat(100*e,"%)"))}},{key:"hueRotate",value:function(t,e){this.transformColor(t,N(e)),this._getFilter(t).push("hue-rotate(".concat(e,"deg)"))}},{key:"setTransform",value:function(t,e){if(t>=this[W]||t<0)throw new Error("Out of range.");t*=3,null==e&&(e=[1,0,0,1,0,0]);var r=this[K],n=r.transform0,i=r.transform1;return n.set([e[0],e[2],e[4]],t),i.set([e[1],e[3],e[5]],t),this}},{key:"getTransform",value:function(t){if(t>=this[W]||t<0)throw new Error("Out of range.");t*=3;var e=this[K],r=e.transform0,n=e.transform1;return[r[t],n[t],r[t+1],n[t+1],r[t+2],n[t+2]]}},{key:"getTextureFrame",value:function(t){return this[Q][this[K].frameIndex[t]]}},{key:"setTextureFrames",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.length>12)throw new Error("Max frames exceed. Allow 12 frames.");if(t.length){var r=this[z];r.setTexture(t[0],e)}this[Q]=t,this[Z]=e}},{key:"setFrameIndex",value:function(t,e){if(t>=this[W]||t<0)throw new Error("Out of range.");var r=this[Q].length;if(r<=0)throw new Error("No frames");this[K].frameIndex[t]=e%r}},{key:"setProgram",value:function(t){this[z].setProgram(t)}},{key:"transform",value:function(t,e){var r=this.getTransform(t);return e=h.mat2d.multiply(Array.of(0,0,0,0,0,0),r,e),this.setTransform(t,e),this}},{key:"translate",value:function(t,e){var r=i()(e,2),n=r[0],o=r[1],a=h.mat2d.create();return a=h.mat2d.translate(Array.of(0,0,0,0,0,0),a,[n,o]),this.transform(t,a)}},{key:"rotate",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0],n=i()(r,2),o=n[0],a=n[1],u=h.mat2d.create();return u=h.mat2d.translate(Array.of(0,0,0,0,0,0),u,[o,a]),u=h.mat2d.rotate(Array.of(0,0,0,0,0,0),u,e),u=h.mat2d.translate(Array.of(0,0,0,0,0,0),u,[-o,-a]),this.transform(t,u)}},{key:"scale",value:function(t,e){var r=i()(e,2),n=r[0],o=r[1],a=void 0===o?n:o,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0],s=i()(u,2),l=s[0],c=s[1],f=h.mat2d.create();return f=h.mat2d.translate(Array.of(0,0,0,0,0,0),f,[l,c]),f=h.mat2d.scale(Array.of(0,0,0,0,0,0),f,[n,a]),f=h.mat2d.translate(Array.of(0,0,0,0,0,0),f,[-l,-c]),this.transform(t,f)}},{key:"skew",value:function(t,e){var r=i()(e,2),n=r[0],o=r[1],a=void 0===o?n:o,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0],s=i()(u,2),l=s[0],c=s[1],f=h.mat2d.create();return f=h.mat2d.translate(Array.of(0,0,0,0,0,0),f,[l,c]),f=h.mat2d.multiply(Array.of(0,0,0,0,0,0),f,h.mat2d.fromValues(1,Math.tan(a),Math.tan(n),1,0,0)),f=h.mat2d.translate(Array.of(0,0,0,0,0,0),f,[-l,-c]),this.transform(t,f)}},{key:"isPointCollision",value:function(t,e){var r,n=i()(e,2),o=n[0],u=n[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"both",l=this.getTransform(t),c=M([o,u],h.mat2d.invert(Array.of(0,0,0,0,0,0),l));return(r=this[z]).isPointCollision.apply(r,a()(c).concat([s]))}},{key:"isPointInFill",value:function(t,e){var r=i()(e,2),n=r[0],o=r[1];return this.isPointCollision(t,[n,o],"fill")}},{key:"isPointInStroke",value:function(t,e){var r=i()(e,2),n=r[0],o=r[1];return this.isPointCollision(t,[n,o],"stroke")}},{key:"bufferSize",get:function(){return this[K].bufferSize}},{key:"mesh",get:function(){return this[z]},set:function(t){this[z]=t,this[Q]&&this.setTextureFrames(this[Q],this[Z])}},{key:"hasCloudColor",get:function(){return this[J]}},{key:"hasCloudFilter",get:function(){return this[$]}},{key:"enableBlend",get:function(){return this[z].enableBlend||this[Y]}},{key:"amount",get:function(){return this[W]},set:function(t){var e=this[W];t!==e&&(t>this[K].bufferSize&&(this[K]=tt(Math.max(t,this[K].bufferSize+1e3),this[K])),this[W]=t,t>e&&this.initBuffer(e))}},{key:"meshData",get:function(){var t=this[z].meshData,e=t.attributes,r=t.cells,n=t.positions,i=t.textureCoord,o=t.uniforms,a=this[Q],u={attributes:H({},e),cells:r,positions:n,textureCoord:i,uniforms:H({},o),instanceCount:this[W],enableBlend:this.enableBlend};a.length&&a.forEach((function(t,e){u.uniforms["u_texFrame".concat(e)]=t}));var s=this[K],l=s.transform0,c=s.transform1,f=s.color0,h=s.color1,d=s.color2,v=s.color3,g=s.color4,p=s.fillColor,m=s.strokeColor,x=s.frameIndex;return this[z].uniforms.u_texSampler&&(u.attributes.a_frameIndex={data:x,divisor:1}),u.attributes.a_transform0={data:l,divisor:1},u.attributes.a_transform1={data:c,divisor:1},u.attributes.a_colorCloud0={data:f,divisor:1},u.attributes.a_colorCloud1={data:h,divisor:1},u.attributes.a_colorCloud2={data:d,divisor:1},u.attributes.a_colorCloud3={data:v,divisor:1},u.attributes.a_colorCloud4={data:g,divisor:1},this.hasCloudColor&&(u.attributes.a_fillCloudColor={data:p,divisor:1},u.attributes.a_strokeCloudColor={data:m,divisor:1}),u}},{key:"program",get:function(){return this[z].program}}]),t}();r(0).glMatrix.setMatrixArrayType(Array);var rt=v.a.mark(at);function nt(t,e,r){var n=t.uniforms||{},i=e.uniforms||{};if(n.u_texSampler&&i.u_texSampler&&n.u_texSampler!==i.u_texSampler)return!1;var o=Object.keys(n),a=Object.keys(i),u=o.indexOf("u_texSampler"),s=a.indexOf("u_texSampler");if(u>=0&&o.splice(u,1),s>=0&&a.splice(s,1),o.length!==a.length)return!1;var l=o.every((function(t){var e=n[t],r=i[t];if(e===r)return!0;if(e.length&&r.length&&e.length===r.length){for(var o=0;o<e.length;o++)if(e[o]!==r[o])return!1;return!0}return!1}));if(l)if(n.u_texSampler&&!i.u_texSampler)e.setTexture(n.u_texSampler,{hidden:!0});else if(!n.u_texSampler&&i.u_texSampler)for(var c=0;c<r.length;c++)r[c].setTexture(i.u_texSampler,{hidden:!0});return l}var it={};function ot(t,e){if(t.length){var r=k(t,it);return r.enableBlend=e,t[0].filterCanvas&&(r.filterCanvas=!0),r.packIndex=t[0].packIndex,r.packLength=t.length,r.beforeRender=t[0].beforeRender,r.pass=t[0].pass,r.afterRender=t[t.length-1].afterRender,t.length=0,r}}function at(t,e){var r,n,i,o,a,u,s,l,c,f,h,d,g=arguments;return v.a.wrap((function(v){for(;;)switch(v.prev=v.next){case 0:r=g.length>2&&void 0!==g[2]&&g[2],n=[],i=t.options.bufferSize,o=0,a=!1,u=0;case 6:if(!(u<e.length)){v.next=50;break}if(!((s=e[u])instanceof et)){v.next=18;break}if(!n.length){v.next=12;break}return v.next=12,ot(n,a);case 12:return o=0,a=!1,v.next=16,s;case 16:v.next=47;break;case 18:if((l=s.meshData).clipPath&&!l.uniforms.u_clipSampler&&(c=t.createTexture(l.clipPath),l.uniforms.u_clipSampler=c),f=0,r&&s.canIgnore()||!l||!l.positions.length){v.next=43;break}if(s.packIndex=u,h=s.filterCanvas,f=l.positions.length,!(h||o+f>i)){v.next=33;break}if(!n.length){v.next=29;break}return v.next=29,ot(n,a);case 29:o=0,a=!1,v.next=40;break;case 33:if(!o){v.next=40;break}if(!(d=n[n.length-1])||!(d.filterCanvas||d.afterRender||s.beforeRender||d.pass.length||s.pass.length||d.program!==s.program)&&nt(d,s,n)){v.next=40;break}return v.next=38,ot(n,a);case 38:o=0,a=!1;case 40:n.push(s),a=a||s.enableBlend,o+=f;case 43:if(u!==e.length-1){v.next=47;break}if(!n.length){v.next=47;break}return v.next=47,ot(n,a);case 47:u++,v.next=6;break;case 50:case"end":return v.stop()}}),rt)}var ut=r(26),st=r.n(ut),lt=r(17),ct=r.n(lt),ft=r(12),ht=r.n(ft),dt=r(18),vt=r.n(dt);r(0).glMatrix.setMatrixArrayType(Array);var gt=2*Math.PI;function pt(t,e,r,n){var i=t*r+e*n;return i>1&&(i=1),i<-1&&(i=-1),(t*n-e*r<0?-1:1)*Math.acos(i)}function mt(t,e){var r=4/3*Math.tan(e/4),n=Math.cos(t),i=Math.sin(t),o=Math.cos(t+e),a=Math.sin(t+e);return[n,i,n-i*r,i+n*r,o+a*r,a-o*r,o,a]}function xt(t,e,r,n,i,o,a,u,s){var l=Math.sin(s*gt/360),c=Math.cos(s*gt/360),f=c*(t-r)/2+l*(e-n)/2,h=-l*(t-r)/2+c*(e-n)/2;if(0===f&&0===h)return[];if(0===a||0===u)return[];a=Math.abs(a),u=Math.abs(u);var d=f*f/(a*a)+h*h/(u*u);d>1&&(a*=Math.sqrt(d),u*=Math.sqrt(d));var v=function(t,e,r,n,i,o,a,u,s,l){var c=l*(t-r)/2+s*(e-n)/2,f=-s*(t-r)/2+l*(e-n)/2,h=a*a,d=u*u,v=c*c,g=f*f,p=h*d-h*g-d*v;p<0&&(p=0),p/=h*g+d*v;var m=(p=Math.sqrt(p)*(i===o?-1:1))*a/u*f,x=p*-u/a*c,y=l*m-s*x+(t+r)/2,b=s*m+l*x+(e+n)/2,M=(c-m)/a,_=(f-x)/u,S=(-c-m)/a,w=(-f-x)/u,E=pt(1,0,M,_),C=pt(M,_,S,w);return 0===o&&C>0&&(C-=gt),1===o&&C<0&&(C+=gt),[y,b,E,C]}(t,e,r,n,i,o,a,u,l,c),g=[],p=v[2],m=v[3],x=Math.max(Math.ceil(Math.abs(m)/(gt/4)),1);m/=x;for(var y=0;y<x;y++)g.push(mt(p,m)),p+=m;return g.map((function(t){for(var e=0;e<t.length;e+=2){var r=t[e+0],n=t[e+1],i=c*(r*=a)-l*(n*=u),o=l*r+c*n;t[e+0]=i+v[0],t[e+1]=o+v[1]}return t}))}function yt(t){for(var e,r=[],n=0,o=0,a=0,u=0,s=null,l=null,c=0,f=0,h=0,d=t.length;h<d;h++){var v=t[h],g=v[0];switch(g){case"M":a=v[1],u=v[2];break;case"A":var p=xt(c,f,v[6],v[7],v[4],v[5],v[1],v[2],v[3]);if(!p.length)continue;p=p.map((function(t){var e=i()(t,8);e[0],e[1];return{x1:e[2],y1:e[3],x2:e[4],y2:e[5],x:e[6],y:e[7]}}));for(var m,x=0;x<p.length;x++)v=["C",(m=p[x]).x1,m.y1,m.x2,m.y2,m.x,m.y],x<p.length-1&&r.push(v);break;case"S":var y=c,b=f;"C"!=e&&"S"!=e||(y+=y-n,b+=b-o),v=["C",y,b,v[1],v[2],v[3],v[4]];break;case"T":"Q"==e||"T"==e?(s=2*c-s,l=2*f-l):(s=c,l=f),v=Mt(c,f,s,l,v[1],v[2]);break;case"Q":s=v[1],l=v[2],v=Mt(c,f,v[1],v[2],v[3],v[4]);break;case"L":v=bt(c,f,v[1],v[2]);break;case"H":v=bt(c,f,v[1],f);break;case"V":v=bt(c,f,c,v[1]);break;case"Z":v=bt(c,f,a,u)}e=g,c=v[v.length-2],f=v[v.length-1],v.length>4?(n=v[v.length-4],o=v[v.length-3]):(n=c,o=f),r.push(v)}return r}function bt(t,e,r,n){return["C",t,e,r,n,r,n]}function Mt(t,e,r,n,i,o){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,o/3+2/3*n,i,o]}r(0).glMatrix.setMatrixArrayType(Array);var _t=r(14),St=r.n(_t);function wt(t,e){var r=i()(t,3),n=r[0],o=r[1],a=r[2],u=void 0===a?0:a,s=i()(e,3),l=s[0],c=s[1],f=s[2],h=void 0===f?0:f;return Math.hypot(l-n,c-o,h-u)}function Et(t){if(null!=t.totalLength)return t.totalLength;var e=0;return t.forEach((function(t){for(var r=t[0],n=1;n<t.length;n++){var i=t[n];e+=wt(r,i),r=i}})),t.totalLength=e,e}function Ct(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e=Number(e),!Number.isFinite(e))throw new TypeError("Failed to execute 'getPointAtLength' on figure: The provided float value is non-finite.");if(e<=0)throw new TypeError("Length must > 0");var n=Et(t);if(e>=n){var i=t[t.length-1],o=i[i.length-2],u=i[i.length-1],s=Math.atan2(u[1]-o[1],u[0]-o[0]);return{current:t.map((function(t){return a()(t)})),point:{x:u[0],y:u[1],angle:s}}}for(var l=[],c=0;c<t.length;c++){l[c]=[];for(var f=t[c],h=f[0],d=1;d<f.length;d++){var v=f[d],g=wt(h,v);if(e<g){var p=e/g,m=Math.atan2(v[1]-h[1],v[0]-h[0]),x={x:h[0]*(1-p)+v[0]*p,y:h[1]*(1-p)+v[1]*p,angle:m};if(l[c].push(h),e>0&&l[c].push([x.x,x.y]),!r)return{current:l,point:x};for(var y=[],b=c;c<t.length;c++){for(y[c-b]=[],c===b&&y[0].push([x.x,x.y]);d<f.length;d++)y[c-b].push(f[d]);d=0}return{current:l,point:x,rest:y}}e-=g,l[c].push(h),h=v}}}function Ot(t,e){if(e=Number(e),!Number.isFinite(e))throw new TypeError("Failed to execute 'getPointAtLength' on figure: The provided float value is non-finite.");if(t.length<=0)return{x:0,y:0,angle:0};if(e<=0){var r=t[0][0],n=t[0][1],i=Math.atan2(n[1]-r[1],n[0]-r[0]);return{x:r[0],y:r[1],angle:i}}return Ct(t,e,!1).point}r(0).glMatrix.setMatrixArrayType(Array),r(0).glMatrix.setMatrixArrayType(Array),r(0).glMatrix.setMatrixArrayType(Array);var kt=2*Math.PI;function At(t,e,r,n,i){(i%=kt)<0&&(i+=kt);var o=Math.tan(i);if(Math.abs(o)<1e5){var a=e-o*t,u=1/Math.pow(r,2)+Math.pow(o,2)/Math.pow(n,2),s=-1;(i<=Math.PI/2||i>3*Math.PI/2)&&(s=1);var l=s*Math.sqrt(1/u)+t;return[l,o*l+a]}return i<Math.PI?[t,e+n]:[t,e-n]}r(0).glMatrix.setMatrixArrayType(Array);var Rt=Symbol("contours"),Tt=Symbol("path"),Lt=Symbol("simplify"),Dt=Symbol("scale"),It=2*Math.PI,Ft=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s()(this,t),"string"==typeof e&&(e={path:e}),e.path?this[Tt]=ct()(e.path):this[Tt]=[],this[Rt]=null,this[Lt]=null!=e.simplify?e.simplify:0,this[Dt]=null!=e.scale?e.scale:2}return c()(t,[{key:"normalize",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=yt(vt()(this[Tt])).map((function(t){for(var n=st()(t),i=n[0],o=n.slice(1),a=[i],u=0;u<o.length;u+=2){var s=o[u]-e,l=o[u+1]-r;a.push(s,l)}return a}));return this.beginPath(),(t=this[Tt]).push.apply(t,a()(n)),this}},{key:"getPointAtLength",value:function(t){return this.contours?Ot(this[Rt],t):null}},{key:"getTotalLength",value:function(){return this.contours?Et(this[Rt]):0}},{key:"addPath",value:function(t){var e;this[Rt]=null,"string"==typeof t&&(t=ct()(t)),(e=this[Tt]).push.apply(e,a()(t))}},{key:"beginPath",value:function(){this[Tt]=[],this[Rt]=null}},{key:"clear",value:function(){this.beginPath()}},{key:"ellipse",value:function(t,e,r,n,i,o,a){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;if(o+=i,a+=i,!(r<=0||n<=0||a===o)){a<o&&(a=o+It+(a-o)%It),a-o>It&&(a=o+It);var s=a-o;s>=It&&(a-=.001);var l=this[Tt].length>0&&s<It?"L":"M",c=At(t,e,r,n,o),f=At(t,e,r,n,a),h=Number(!u),d=s>Math.PI?1:0;u&&(d=1-d),l+=c.join(" "),l+="A".concat(r," ").concat(n," 0 ").concat(d," ").concat(h," ").concat(f.join(" ")),s>=It&&(l+="Z"),this.addPath(l)}}},{key:"arc",value:function(t,e,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return this.ellipse(t,e,r,r,0,n,i,o)}},{key:"arcTo",value:function(t,e,r,n,i,o,a){this[Rt]=null,this[Tt].push(["A",t,e,r,n,i,o,a])}},{key:"moveTo",value:function(t,e){this[Rt]=null,this[Tt].push(["M",t,e])}},{key:"lineTo",value:function(t,e){this[Rt]=null,this[Tt].push(["L",t,e])}},{key:"bezierCurveTo",value:function(t,e,r,n,i,o){this[Rt]=null,this[Tt].push(["C",t,e,r,n,i,o])}},{key:"quadraticCurveTo",value:function(t,e,r,n){this[Rt]=null,this[Tt].push(["Q",t,e,r,n])}},{key:"rect",value:function(t,e,r,n){var i="M".concat(t," ").concat(e,"L").concat(t+r," ").concat(e,"L").concat(t+r," ").concat(e+n,"L").concat(t," ").concat(e+n,"Z");this.addPath(i)}},{key:"closePath",value:function(){this[Rt]=null;var t=[],e=this[Tt].length;e>0&&(t=this[Tt][e-1]),"Z"!==t[0]&&"z"!==t[0]&&this[Tt].push(["Z"])}},{key:"contours",get:function(){var t=null;if(!this[Rt]&&this[Tt]){var e=yt(vt()(this[Tt]));this[Rt]=St()(e,this[Dt],this[Lt]),this[Rt].path=e,this[Rt].simplify=this[Lt],this[Rt].scale=this[Dt]}return this[Rt]&&((t=this[Rt].map((function(t){return a()(t)}))).path=this[Rt].path,t.simplify=this[Rt].simplify,t.scale=this[Rt].scale),t}},{key:"path",get:function(){return this[Tt]}},{key:"simplify",get:function(){return this[Lt]}},{key:"boundingBox",get:function(){var t=this.contours;if(t&&t.length){var e=t.reduce((function(t,e){return[].concat(a()(t),a()(e))}));return ht()(e)}return[[0,0],[0,0]]}},{key:"boundingCenter",get:function(){var t=this.boundingBox;return t?[.5*(t[0][0]+t[1][0]),.5*(t[0][1]+t[1][1])]:[0,0]}}]),t}(),Ut=r(27),Pt=r.n(Ut),Bt=r(3);r(0).glMatrix.setMatrixArrayType(Array);var Nt=Object(Bt.create)(),Gt=Object(Bt.create)(),qt=Object(Bt.create)(),jt=Object(Bt.create)(),Vt=Object(Bt.create)(),Ht=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.lineWidth,n=void 0===r?1:r,i=e.lineJoin,o=void 0===i?"miter":i,a=e.miterLimit,u=void 0===a?10:a,l=e.lineCap,c=void 0===l?"butt":l,f=e.roundSegments,h=void 0===f?20:f;s()(this,t),this.lineWidth=n,this.lineJoin=o,this.miterLimit=u,this.lineCap=c,this.roundSegments=h,this._normal=null}return c()(t,[{key:"build",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.length;if(t=a()(t),r<2)return t;e&&(t[0][0]===t[r-1][0]&&t[0][1]===t[r-1][1]||t.push(a()(t[0])),t.push(a()(t[1]))),r=t.length,this._normal=null;var n={left:[],right:[]},i=this.lineWidth/2,o=this.lineCap;if(!e&&"square"===o){Object(Bt.direction)(Gt,t[0],t[1]),Object(Bt.scaleAndAdd)(t[0],t[0],Gt,i);var u=t.length-1;Object(Bt.direction)(Gt,t[u],t[u-1]),Object(Bt.scaleAndAdd)(t[u],t[u],Gt,i)}for(var s=1;s<r;s++){var l=t[s-1],c=t[s],f=t[s+1];this._seg(n,l,c,f,i,e)}e||"round"!==o||Yt(n,this.roundSegments);var h=[].concat(a()(n.left),a()(n.right.reverse()));return h}},{key:"_seg",value:function(t,e,r,n,i,o){var a="bevel"===this.lineJoin,u="round"===this.lineJoin;if(Object(Bt.direction)(Gt,r,e),this._normal||(this._normal=Object(Bt.create)(),Object(Bt.normal)(this._normal,Gt)),t.left.length||Wt(t,e,this._normal,i),n){Object(Bt.direction)(qt,n,r);var s=Object(Bt.computeMiter)(jt,Vt,Gt,qt,i);s=Math.min(s,1e20);var l=Object(Bt.dot)(jt,this._normal)<0?-1:1,c=a||u;if(!c&&"miter"===this.lineJoin)s/i>this.miterLimit&&(c=!0);if(c){Object(Bt.scaleAndAdd)(Nt,r,this._normal,-i*l),zt(t,Nt,l);var f=1/0;e&&(f=Math.min(f,Math.hypot(r[0]-e[0],r[1]-e[1]))),n&&(f=Math.min(f,Math.hypot(n[0]-r[0],n[1]-r[1])));var h=Math.max(i,Math.min(s,f));if(Object(Bt.scaleAndAdd)(Nt,r,Vt,h*l),zt(t,Nt,-l),n)if(Object(Bt.normal)(Nt,qt),Object(Bt.copy)(this._normal,Nt),Object(Bt.scaleAndAdd)(Nt,r,Nt,-i*l),u){for(var d=Object(Bt.clone)(Nt),v=l>0?t.left[t.left.length-1]:t.right[t.right.length-1],g=Object(Bt.clone)(r),p=Object(Bt.sub)(Object(Bt.create)(),v,g),m=Object(Bt.sub)(Object(Bt.create)(),d,g),x=Math.PI/this.roundSegments,y=0;y<this.roundSegments&&(Object(Bt.rotate)(p,p,[0,0],l*x),Math.sign(Object(Bt.cross)(Nt,p,m)[2])===l);y++)Object(Bt.add)(Nt,p,g),zt(t,Nt,l);zt(t,d,l)}else zt(t,Nt,l)}else Wt(t,r,Vt,s),Object(Bt.copy)(this._normal,Vt)}else Object(Bt.normal)(this._normal,Gt),Wt(t,o?e:r,this._normal,i)}}]),t}();function zt(t,e,r){r>0?t.left.push(Object(Bt.clone)(e)):t.right.push(Object(Bt.clone)(e))}function Wt(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;Object(Bt.scaleAndAdd)(Nt,e,r,-n),zt(t,Nt,-i),Object(Bt.scaleAndAdd)(Nt,e,r,n),zt(t,Nt,i)}function Yt(t,e){var r=t.left,n=t.right,i=Object(Bt.create)(),o=Object(Bt.create)(),a=r[0],u=n[0],s=[.5*(a[0]+u[0]),.5*(a[1]+u[1])];Object(Bt.sub)(o,a,s);for(var l=1;l<=e;l++){var c=-1*Math.PI*l/e;Object(Bt.rotate)(i,o,[0,0],c),Object(Bt.add)(Nt,s,i),r.unshift(Object(Bt.clone)(Nt))}a=n[n.length-1],u=r[r.length-1],s=[.5*(a[0]+u[0]),.5*(a[1]+u[1])],Object(Bt.sub)(o,a,s);for(var f=1;f<=e;f++){var h=-1*Math.PI*f/e;Object(Bt.rotate)(i,o,[0,0],h),Object(Bt.add)(Nt,s,i),n.push(Object(Bt.clone)(Nt))}}r(0).glMatrix.setMatrixArrayType(Array);var Xt=Ht;function Qt(t){return 1===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&0===t[4]&&0===t[5]}r(0).glMatrix.setMatrixArrayType(Array);var Zt=r(19),Jt=r.n(Zt);r(0).glMatrix.setMatrixArrayType(Array);var $t=Symbol("mesh"),Kt=Symbol("contours"),te=Symbol("stroke"),ee=Symbol("fill"),re=Symbol("strokeColor"),ne=Symbol("fillColor"),ie=Symbol("transform"),oe=Symbol("invertTransform"),ae=Symbol("uniforms"),ue=Symbol("texOptions"),se=Symbol("blend"),le=Symbol("applyTexture"),ce=Symbol("applyTransform"),fe=Symbol("applyGradientTransform"),he=Symbol("applyProgram"),de=Symbol("gradient"),ve=Symbol("filter"),ge=Symbol("opacity"),pe=Symbol("program"),me=Symbol("attributes"),xe=Symbol("pass"),ye=Symbol("clipContext"),be=Symbol("applyClipPath");function Me(t,e){for(var r=t[1][0]-t[0][0],n=t[1][1]-t[0][1],i=[],o=0;o<e.length;o++){var a=e[o],u=[(a[0]-t[0][0])/r,1-(a[1]-t[0][1])/n];i.push(u)}return i}var _e=function(){function t(e){s()(this,t),this[te]=null,this[ee]=null,this[ie]=[1,0,0,1,0,0],this[ge]=1,this[ae]={},this[ve]=[],this[se]=null,this[ue]={},this.contours=e.contours,this[pe]=null,this[me]={},this[xe]=[]}return c()(t,[{key:"setProgram",value:function(t){this[pe]=t,this[$t]&&this[he](t)}},{key:"setAttribute",value:function(t,e){null==e?delete this[me][t]:this[me][t]=e}},{key:"getOpacity",value:function(){return this[ge]}},{key:"setOpacity",value:function(t){if(t<0||t>1)throw new TypeError("Invalid opacity value.");this[$t]&&this[$t].positions.forEach((function(e){e[2]=1/e[2]>0?t:-t})),this[ge]=t}},{key:"setClipPath",value:function(t){this.clipPath=t,this[ae].u_clipSampler&&this[ae].u_clipSampler.delete(),this.setUniforms({u_clipSampler:null}),this[$t]&&delete this[$t].attributes.a_clipUV,t&&this[$t]&&this[be]()}},{key:be,value:function(){if(this.clipPath){this[ye]||(this[ye]=m.a.createCanvas(1,1));var t=i()(this.boundingBox,2),e=i()(t[0],2),r=e[0],n=e[1],o=i()(t[1],2),a=o[0],u=o[1];a&&u&&(this[ye].width=a-r,this[ye].height=u-n);var s=this[ye].getContext("2d"),l=new Path2D(this.clipPath);s.clearRect(0,0,this[ye].width,this[ye].height),s.save(),s.translate(-r,-n),s.fillStyle="white",s.fill(l),s.restore(),this[$t].clipPath=this[ye];var c=Me(this.boundingBox,this[$t].position0);this[$t].attributes.a_clipUV=c}}},{key:"getPointAtLength",value:function(t){return Ot(this[Kt],t)}},{key:"getTotalLength",value:function(){return Et(this[Kt])}},{key:he,value:function(t){for(var e=this[me],r=this[$t].position0,n=Object.entries(t._attribute),o=0;o<n.length;o++){var a=i()(n[o],2),u=a[0],s=a[1];if("a_color"!==u&&"a_sourceRect"!==u&&"ignored"!==s){var l=e[u];if("uv"!==u||l){this[$t].attributes[u]=[];for(var c=0;c<r.length;c++){var f=r[c];this[$t].attributes[u].push(l?l(f,o,r):Array(s.size).fill(0))}}else{var h=this[$t].boundingBox||ht()(r);this[$t].attributes[u]=Me(h,r)}}}}},{key:ce,value:function(t,e){for(var r=t.positions,n=t.position0,o=0;o<r.length;o++){var a=i()(n[o],2),u=a[0],s=a[1],l=r[o];l[0]=u*e[0]+s*e[2]+e[4],l[1]=u*e[1]+s*e[3]+e[5]}this._updateMatrix=!1}},{key:fe,value:function(){var t=this[ie],e=a()(this._radialGradientVector);if(e){var r=i()(e,5),n=r[0],o=r[1],u=r[3],s=r[4];e[0]=n*t[0]+o*t[2]+t[4],e[1]=n*t[1]+o*t[3]+t[5],e[3]=u*t[0]+s*t[2]+t[4],e[4]=u*t[1]+s*t[3]+t[5],this[ae].u_radialGradientVector=e}}},{key:le,value:function(t,e){var r=this[ae].u_texSampler;if(r){var n,o,a=r._img,u=a.width,s=a.height,l=e.srcRect,c=e.rect||[0,0];if(e.rotated&&(c=[-c[1],c[0],c[3],c[2]]),null==c[2]&&(c[2]=l?l[2]:u),null==c[3]&&(c[3]=l?l[3]:s),e.hidden)t.textureCoord=t.positions.map((function(){return[-1,-1,-1]}));else if(!(t.textureCoord&&(n=this[ue].rect,o=e.rect,null==n&&null==o||null!=n&&null!=o&&n[0]===o[0]&&n[1]===o[1]&&n[2]===o[2]&&n[3]===o[3])&&this[ue].hidden===e.hidden&&this[ue].rotated===e.rotated)){var f=null;e.rotated&&(f=h.mat2d.rotate(Array.of(0,0,0,0,0,0),h.mat2d.fromValues(1,0,0,1,0,0),.5*Math.PI),f=h.mat2d.translate(Array.of(0,0,0,0,0,0),f,[0,-c[2]])),t.textureCoord=t.position0.map((function(t){var r=i()(t,3),n=r[0],o=r[1];if(1/r[2]>0){if(e.rotated){var a=n*f[0]+o*f[2]+f[4],u=n*f[1]+o*f[3]+f[5];n=a,o=u}var s=function(t,e,r){var n=i()(t,2),o=n[0],a=n[1],u=i()(e,4),s=u[0],l=u[1],c=u[2],f=u[3];return r.scale||(o/=c,a=1-a/f,o-=s,a+=l),[o,a,0]}([n,o],[c[0]/c[2],c[1]/c[3],c[2],c[3]],e);return e.repeat&&(s[2]=1),s}return[-1,-1,-1]}))}if(l){var d=[l[0]/u,l[1]/s,l[2]/u,l[3]/s];t.attributes.a_sourceRect=t.positions.map((function(){return[].concat(d)}))}else t.attributes.a_sourceRect=t.positions.map((function(){return[0,0,0,0]}))}}},{key:"accurate",value:function(t){if(this.contours&&this.contours.path){var e=this.contours.simplify,r=function(t,e,r){var n=St()(t,e,r);return n.path=t,n.simplify=r,n.scale=e,n}(this.contours.path,2*t,e);this[$t]=null,this[Kt]=r}}},{key:"canIgnore",value:function(){var t=null==this[te]||0===this[te].lineWidth||0===this[re][3],e=null==this[ee]||0===this[ne][3],r=null==this[ae].u_radialGradientVector,n=null==this[ae].u_texSampler;return 0===this[ge]||null==this[pe]&&t&&e&&r&&n&&!this.beforeRender&&!this.afterRender}},{key:"setStroke",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.thickness,r=void 0===e?1:e,n=t.cap,i=void 0===n?"butt":n,o=t.join,a=void 0===o?"miter":o,u=t.miterLimit,s=void 0===u?10:u,l=t.color,c=void 0===l?[0,0,0,0]:l,f=t.lineDash,h=void 0===f?null:f,d=t.lineDashOffset,v=void 0===d?0:d,g=t.roundSegments,p=void 0===g?20:g;return this[$t]=null,this[te]=new Xt({lineWidth:r,lineCap:i,lineJoin:a,miterLimit:s,roundSegments:p}),"string"==typeof c&&(c=j(c)),this[re]=c,this[te].lineDash=h,this[te].lineDashOffset=v,this}},{key:"setFill",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.rule,r=void 0===e?this.fillRule:e,n=t.color,i=void 0===n?[0,0,0,0]:n;return this[$t]=null,this[ee]={rule:r},"string"==typeof i&&(i=j(i)),this[ne]=i,this}},{key:"setTexture",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t&&t.image){var r=t,n=r.image,i=r.rect;if(t=n,e.rect)for(var o=0;o<e.rect.length;o++)i[o]=e.rect[o];e.rect=i}return this[ee]||this.setFill(),this.setUniforms({u_texSampler:t}),this[$t]&&this[le](this[$t],e),this[ue]=e,this}},{key:"setCircularGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.vector,r=t.colors,n=t.type,i=void 0===n?"fill":n;if(3!==e.length)throw new TypeError("Invalid linearGradient.");this.setGradient({vector:e,colors:r,type:i})}},{key:"setLinearGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.vector,r=t.colors,n=t.type,i=void 0===n?"fill":n;if(4!==e.length)throw new TypeError("Invalid linearGradient.");this.setGradient({vector:e,colors:r,type:i})}},{key:"setRadialGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.vector,r=t.colors,n=t.type,i=void 0===n?"fill":n;if(6!==e.length)throw new TypeError("Invalid radialGradient.");this.setGradient({vector:e,colors:r,type:i})}},{key:"setGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.vector,r=t.colors,n=t.type,i=void 0===n?"fill":n;r=r.map((function(t){var e=t.offset,r=t.color;return"string"==typeof r&&(r=j(r)),{offset:e,color:r}})),this[de]=this[de]||{},this[de][i]={vector:e,colors:r},r.sort((function(t,e){return t.offset-e.offset}));var o,u=[];if(r.forEach((function(t){var e=t.offset,r=t.color;u.push.apply(u,[e].concat(a()(r)))})),o=4===e.length?[e[0],e[1],0,e[2],e[3],0]:a()(e),u.length<40&&u.push(-1),u.length>40)throw new Error("Too many colors, should be less than 8 colors");return this._radialGradientVector=o,this[ae].u_colorSteps=u,this[ae].u_gradientType="fill"===i?1:0,this[fe](),this}},{key:"setUniforms",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(this[ae],t),this}},{key:"setTransform",value:function(){for(var t=this[ie],e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return h.mat2d.equals(r,t)||(this[ie]=r,delete this[oe],this._updateMatrix=!0),this}},{key:"transform",value:function(){for(var t=this[ie],e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return this[ie]=h.mat2d.multiply(Array.of(0,0,0,0,0,0),t,r),delete this[oe],this._updateMatrix=!0,this}},{key:"translate",value:function(t,e){var r=h.mat2d.create();return r=h.mat2d.translate(Array.of(0,0,0,0,0,0),r,[t,e]),this.transform.apply(this,a()(r))}},{key:"rotate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0],r=i()(e,2),n=r[0],o=r[1],u=h.mat2d.create();return u=h.mat2d.translate(Array.of(0,0,0,0,0,0),u,[n,o]),u=h.mat2d.rotate(Array.of(0,0,0,0,0,0),u,t),u=h.mat2d.translate(Array.of(0,0,0,0,0,0),u,[-n,-o]),this.transform.apply(this,a()(u))}},{key:"scale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0],n=i()(r,2),o=n[0],u=n[1],s=h.mat2d.create();return s=h.mat2d.translate(Array.of(0,0,0,0,0,0),s,[o,u]),s=h.mat2d.scale(Array.of(0,0,0,0,0,0),s,[t,e]),s=h.mat2d.translate(Array.of(0,0,0,0,0,0),s,[-o,-u]),this.transform.apply(this,a()(s))}},{key:"skew",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0],n=i()(r,2),o=n[0],u=n[1],s=h.mat2d.create();return s=h.mat2d.translate(Array.of(0,0,0,0,0,0),s,[o,u]),s=h.mat2d.multiply(Array.of(0,0,0,0,0,0),s,h.mat2d.fromValues(1,Math.tan(e),Math.tan(t),1,0,0)),s=h.mat2d.translate(Array.of(0,0,0,0,0,0),s,[-o,-u]),this.transform.apply(this,a()(s))}},{key:"clearFilter",value:function(){return this.setColorTransform(null),this[ve].length=0,this}},{key:"setColorTransform",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return null===e[0]?this.setUniforms({u_filterFlag:0,u_colorMatrix:0}):this.setUniforms({u_filterFlag:1,u_colorMatrix:e}),this}},{key:"transformColor",value:function(){for(var t=this.uniforms.u_colorMatrix,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t=t?T(t,r):r,this.setColorTransform.apply(this,a()(t)),this}},{key:"blur",value:function(t){return this[ve].push("blur(".concat(t,"px)")),this}},{key:"brightness",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this[ve].push("brightness(".concat(100*t,"%)")),this.transformColor.apply(this,a()(D(t)))}},{key:"contrast",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this[ve].push("contrast(".concat(100*t,"%)")),this.transformColor.apply(this,a()(F(t)))}},{key:"dropShadow",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,0,0,1];return Array.isArray(n)&&(n=Object(x.a)(n)),this[ve].push("drop-shadow(".concat(t,"px ").concat(e,"px ").concat(r,"px ").concat(n,")")),this}},{key:"grayscale",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this[ve].push("grayscale(".concat(100*t,"%)")),this.transformColor.apply(this,a()(L(t)))}},{key:"hueRotate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this[ve].push("hue-rotate(".concat(t,"deg)")),this.transformColor.apply(this,a()(N(t)))}},{key:"invert",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this[ve].push("invert(".concat(100*t,"%)")),this.transformColor.apply(this,a()(U(t)))}},{key:"opacity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this[ve].push("opacity(".concat(100*t,"%)")),this.transformColor.apply(this,a()(B(t)))}},{key:"saturate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this[ve].push("saturate(".concat(100*t,"%)")),this.transformColor.apply(this,a()(I(t)))}},{key:"sepia",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this[ve].push("sepia(".concat(100*t,"%)")),this.transformColor.apply(this,a()(P(t)))}},{key:"url",value:function(t){return this[ve].push("url(".concat(t,")")),this}},{key:"isPointCollision",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"both",n=this.meshData,o=n.positions,a=n.cells,u=this.invertMatrix,s=u[0]*t+u[2]*e+u[4],l=u[1]*t+u[3]*e+u[5],c=this.boundingBox;if(s<c[0][0]||s>c[1][0]||l<c[0][1]||l>c[1][1])return!1;function f(t,e,r){var n=i()(t,2),o=n[0],a=n[1],u=i()(e,2),s=u[0],l=u[1],c=i()(r,2),f=c[0]-s,h=c[1]-l,d=((o-s)*f+(a-l)*h)/(Math.pow(f,2)+Math.pow(h,2));return d>=0&&d<=1}for(var h=0;h<a.length;h++){var d=a[h];if("fill"===r&&d[0]>=n.fillPointCount)break;if(!("stroke"===r&&d[0]<n.fillPointCount)){var v=d.map((function(t){return o[t]})),g=i()(v,3),p=i()(g[0],2),m=p[0],x=p[1],y=i()(g[1],2),b=y[0],M=y[1],_=i()(g[2],2),S=_[0],w=_[1],E=Math.sign((t-m)*(M-x)-(b-m)*(e-x));if(0===E&&f([t,e],[m,x],[b,M]))return!0;var C=Math.sign((t-b)*(w-M)-(S-b)*(e-M));if(0===C&&f([t,e],[b,M],[S,w]))return!0;var O=Math.sign((t-S)*(x-w)-(m-S)*(e-w));if(0===O&&f([t,e],[S,w],[m,x]))return!0;if(1===E&&1===C&&1===O||-1===E&&-1===C&&-1===O)return!0}}return!1}},{key:"isPointInFill",value:function(t,e){return this.isPointCollision(t,e,"fill")}},{key:"isPointInStroke",value:function(t,e){return this.isPointCollision(t,e,"stroke")}},{key:"addPass",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.width,i=r.height,o=Pt()(r,["width","height"]),a=new Ft;a.rect(0,0,n,i);var u=new t(a,{width:n,height:i});u.setUniforms(o),u.setProgram(e),this[xe].push(u)}},{key:"contours",get:function(){return this[Kt]},set:function(t){this[$t]=null,this[Kt]=t;var e=t.scale;this.transformScale/e>1.5&&this.accurate(this.transformScale)}},{key:"program",get:function(){return this[pe]}},{key:"blend",get:function(){return null==this[se]?"auto":this[se]},set:function(t){this[se]=t,this[$t]&&(this[$t].enableBlend=this.enableBlend)}},{key:"boundingBox",get:function(){if(this[$t]&&this[$t].boundingBox)return this[$t].boundingBox;var t=this.meshData;if(t){var e=t.position0;return e.length?(t.boundingBox=ht()(e),t.boundingBox):[[0,0],[0,0]]}return[[0,0],[0,0]]}},{key:"boundingCenter",get:function(){var t=this.boundingBox;return t?[.5*(t[0][0]+t[1][0]),.5*(t[0][1]+t[1][1])]:[0,0]}},{key:"fillRule",get:function(){return this[ee]?this[ee].rule:"nonzero"}},{key:"lineWidth",get:function(){return this[te]?this[te].lineWidth:0}},{key:"lineCap",get:function(){return this[te]?this[te].lineCap:""}},{key:"lineJoin",get:function(){return this[te]?this[te].lineJoin:""}},{key:"miterLimit",get:function(){return this[te]?this[te].miterLimit:0}},{key:"strokeStyle",get:function(){return this[re]&&0!==this[re][3]?Object(x.a)(this[re]):""}},{key:"lineDash",get:function(){return this[te]?this[te].lineDash:null}},{key:"lineDashOffset",get:function(){return this[te]?this[te].lineDashOffset:0}},{key:"fillStyle",get:function(){return this[ne]&&0!==this[ne][3]?Object(x.a)(this[ne]):""}},{key:"gradient",get:function(){return this[de]}},{key:"texture",get:function(){return this[ae].u_texSampler?{image:this[ae].u_texSampler._img,options:this[ue]}:null}},{key:"enableBlend",get:function(){return!0===this[se]||!1===this[se]?this[se]:this[ge]<1||null!=this[re]&&this[re][3]<1||null!=this[ne]&&this[ne][3]<1||null!=this[ae].u_colorMatrix&&this[ae].u_colorMatrix[18]<1||null!=this[ae].u_radialGradientVector||this.beforeRender||this.afterRender}},{key:"filterCanvas",get:function(){return/blur|drop-shadow|url/.test(this.filter)}},{key:"filter",get:function(){return this[ve].join(" ")}},{key:"transformMatrix",get:function(){return this[ie]}},{key:"invertMatrix",get:function(){if(!this[oe]){var t=h.mat2d.invert(Array.of(0,0,0,0,0,0),this[ie]);this[oe]=t}return this[oe]}},{key:"transformScale",get:function(){var t=this[ie];return Math.max(Math.hypot(t[0],t[1]),Math.hypot(t[2],t[3]))}},{key:"uniforms",get:function(){return this[ae]}},{key:"pass",get:function(){return this[xe]}},{key:"meshData",get:function(){var t=this;this._updateMatrix&&(this.transformScale/this.contours.scale>1.5&&this.accurate(this.transformScale));if(!this[$t]){this[ee]||this[te]||this.setFill();var e=this[Kt],r={};if(e&&e.length){if(this[ee])try{var n=Jt()(e,this[ee]);n.positions=n.positions.map((function(e){return e.push(t[ge]),e})),n.attributes={a_color:Array.from({length:n.positions.length}).map((function(){return t[ne].map((function(t){return Math.round(255*t)}))}))},r.fill=n}catch(t){}if(this[te]){var o=this[te].lineDash,u=e;if(o)u=function(t,e,r){var n=0,i=e[0],o=t,u=[],s=e.length;if(r>0){do{r-=e[n%s],n++}while(r>0);r<0&&(i=-r,n--)}else if(r<0){n=-1;do{r+=e[n%s+s-1],n--}while(r<0);r>=0&&(i=e[++n%s+s-1]-r)}do{var l=Ct(o,i);o=l.rest,++n%2&&u.push.apply(u,a()(l.current));var c=n%s;c<0&&(c+=s),i=e[c]}while(o);return u}(e,o,this[te].lineDashOffset);var s=u.map((function(e,r){var n=e.length>1&&h.vec2.equals(e[0],e[e.length-1]),i=t[te].build(e,n);return Jt()([i])}));s.forEach((function(e){e.positions=e.positions.map((function(e){return e.push(-t[ge]),e})),e.attributes={a_color:Array.from({length:e.positions.length}).map((function(){return t[re].map((function(t){return Math.round(255*t)}))}))}})),r.stroke=k(s)}}var l=k([r.fill,r.stroke]);l.fillPointCount=r.fill?r.fill.positions.length:0,l.enableBlend=this.enableBlend,l.position0=l.positions.map((function(t){var e=i()(t,3);return[e[0],e[1],e[2]]})),l.uniforms=this[ae],this[$t]=l,this[ae].u_texSampler&&this[le](l,this[ue]);var c=this[ie];Qt(c)||(this[ce](l,c),this[ae].u_radialGradientVector&&this[fe]()),this.clipPath&&this[be](),this[pe]&&this[he](this[pe])}return this._updateMatrix&&(this[$t].matrix=this[ie],this[ce](this[$t],this[ie]),this[ae].u_radialGradientVector&&this[fe]()),this[$t]}}]),t}();r(0).glMatrix.setMatrixArrayType(Array);var Se=Symbol("shaders");function we(t){t[Se]=[];for(var e=0;e<16;e++){var r=[],n=!!(1&e),i=!!(2&e),o=!!(4&e),a=!!(8&e);n&&r.push("#define TEXTURE 1"),i&&r.push("#define FILTER 1"),o&&r.push("#define GRADIENT 1"),a&&r.push("#define CLIPPATH 1");var u="".concat(r.join("\n"),"\n"),s=[];n&&s.push("uniform sampler2D u_texSampler;"),a&&s.push("uniform sampler2D u_clipSampler;"),t[Se][e]=[u+s.join("\n")+"precision mediump float;\n\nvarying vec4 vColor;\nvarying float flagBackground;\n\n#ifdef TEXTURE\nvarying vec3 vTextureCoord;\nvarying vec4 vSourceRect;\n#endif\n\n#ifdef CLIPPATH\nvarying vec2 vClipUV;\n#endif\n\n#ifdef FILTER\nuniform int u_filterFlag;\nuniform float u_colorMatrix[20];\n#endif\n\n#ifdef GRADIENT\nvarying vec3 vGradientVector1;\nvarying vec3 vGradientVector2;\nuniform float u_colorSteps[40];\nuniform int u_gradientType;\n// uniform float u_radialGradientVector[6];\n\nvoid gradient(inout vec4 color, vec3 gv1, vec3 gv2, float colorSteps[40]) {\n  float t;\n  // center circle radius\n  float cr = gv1.z;\n  // focal circle radius\n  float fr = gv2.z;\n\n  if(cr > 0.0 || fr > 0.0) {\n    // radial gradient\n    vec2 center = gv1.xy;\n    vec2 focal = gv2.xy;\n    float x = focal.x - gl_FragCoord.x;\n    float y = focal.y - gl_FragCoord.y;\n    float dx = focal.x - center.x;\n    float dy = focal.y - center.y;\n    float dr = cr - fr;\n    float a = dx * dx + dy * dy - dr * dr;\n    float b = -2.0 * (y * dy + x * dx + fr * dr);\n    float c = x * x + y * y - fr * fr;\n    t = 1.0 - 0.5 * (1.0 / a) * (-b + sqrt(b * b - 4.0 * a * c));\n  } else {\n    // linear gradient\n    vec2 v1 = gl_FragCoord.xy - gv1.xy;\n    vec2 v2 = gv2.xy - gv1.xy;\n    t = (v1.x * v2.x + v1.y * v2.y) / (v2.x * v2.x + v2.y * v2.y);\n  }\n\n  vec4 colors[8];\n  colors[0] = vec4(colorSteps[1], colorSteps[2], colorSteps[3], colorSteps[4]);\n  colors[1] = vec4(colorSteps[6], colorSteps[7], colorSteps[8], colorSteps[9]);\n  colors[2] = vec4(colorSteps[11], colorSteps[12], colorSteps[13], colorSteps[14]);\n  colors[3] = vec4(colorSteps[16], colorSteps[17], colorSteps[18], colorSteps[19]);\n  colors[4] = vec4(colorSteps[21], colorSteps[22], colorSteps[23], colorSteps[24]);\n  colors[5] = vec4(colorSteps[26], colorSteps[27], colorSteps[28], colorSteps[29]);\n  colors[6] = vec4(colorSteps[31], colorSteps[32], colorSteps[33], colorSteps[34]);\n  colors[7] = vec4(colorSteps[36], colorSteps[37], colorSteps[38], colorSteps[39]);\n  \n  float steps[8];\n  steps[0] = colorSteps[0];\n  steps[1] = colorSteps[5];\n  steps[2] = colorSteps[10];\n  steps[3] = colorSteps[15];\n  steps[4] = colorSteps[20];\n  steps[5] = colorSteps[25];\n  steps[6] = colorSteps[30];\n  steps[7] = colorSteps[35];\n\n  color = colors[0];\n  for (int i = 1; i < 8; i++) {\n    if (steps[i] < 0.0 || steps[i] > 1.0) {\n      break;\n    }\n    if(steps[i] == steps[i - 1]) {\n      color = colors[i];\n    } else {\n      color = mix(color, colors[i], clamp((t - steps[i - 1]) / (steps[i] - steps[i - 1]), 0.0, 1.0));\n    }\n    if (steps[i] >= t) {\n      break;\n    }\n  }\n}\n#endif\n\n#ifdef FILTER\nvoid transformColor(inout vec4 color, in float colorMatrix[20]) {\n  float r = color.r, g = color.g, b = color.b, a = color.a;\n  color[0] = colorMatrix[0] * r + colorMatrix[1] * g + colorMatrix[2] * b + colorMatrix[3] * a + colorMatrix[4];\n  color[1] = colorMatrix[5] * r + colorMatrix[6] * g + colorMatrix[7] * b + colorMatrix[8] * a + colorMatrix[9];\n  color[2] = colorMatrix[10] * r + colorMatrix[11] * g + colorMatrix[12] * b + colorMatrix[13] * a + colorMatrix[14];\n  color[3] = colorMatrix[15] * r + colorMatrix[16] * g + colorMatrix[17] * b + colorMatrix[18] * a + colorMatrix[19];\n}\n#endif\n\nvoid main() {\n  vec4 color = vColor;\n  float opacity = abs(flagBackground);\n\n#ifdef GRADIENT\n  if(u_gradientType > 0 && flagBackground > 0.0 || u_gradientType == 0 && flagBackground <= 0.0) {\n    gradient(color, vGradientVector1, vGradientVector2, u_colorSteps);\n  }\n#endif\n\n  if(opacity < 1.0) {\n    color.a *= opacity;\n  }\n\n#ifdef TEXTURE\n  if(flagBackground > 0.0) {\n    vec3 texCoord = vTextureCoord;\n\n    if(texCoord.z == 1.0) {\n      texCoord = fract(texCoord);\n    }\n\n    if(texCoord.x <= 1.0 && texCoord.x >= 0.0\n      && texCoord.y <= 1.0 && texCoord.y >= 0.0) {\n      if(vSourceRect.z > 0.0) {\n        texCoord.x = vSourceRect.x + texCoord.x * vSourceRect.z;\n        texCoord.y = 1.0 - (vSourceRect.y + (1.0 - texCoord.y) * vSourceRect.w);\n      }\n      vec4 texColor = texture2D(u_texSampler, texCoord.xy);\n      float alpha = texColor.a;\n      if(opacity < 1.0) {\n        texColor.a *= opacity;\n        alpha *= mix(0.465, 1.0, opacity);\n      }\n      // color = mix(color, texColor, texColor.a);\n      color.rgb = mix(color.rgb, texColor.rgb, alpha);\n      // color.rgb = mix(texColor.rgb, color.rgb, color.a);\n      color.rgb = mix(texColor.rgb, color.rgb, clamp(color.a / max(0.0001, texColor.a), 0.0, 1.0));\n      color.a = texColor.a + (1.0 - texColor.a) * color.a;\n    }\n  }\n#endif\n\n#ifdef FILTER\n  if(u_filterFlag > 0) {\n    transformColor(color, u_colorMatrix);\n  }\n#endif\n\n#ifdef CLIPPATH\n  float clip = texture2D(u_clipSampler, vClipUV).r;\n  color *= clip;\n#endif\n\n  gl_FragColor = color;\n}",u+"attribute vec3 a_vertexPosition;\nattribute vec4 a_color;\nvarying vec4 vColor;\nvarying float flagBackground;\nuniform vec2 u_resolution;\nuniform mat3 viewMatrix;\nuniform mat3 projectionMatrix;\n\n#ifdef TEXTURE\nattribute vec3 a_vertexTextureCoord;\nvarying vec3 vTextureCoord;\nattribute vec4 a_sourceRect;\nvarying vec4 vSourceRect;\n#endif\n\n#ifdef CLIPPATH\nattribute vec2 a_clipUV;\nvarying vec2 vClipUV;\n#endif\n\n#ifdef GRADIENT\nuniform float u_radialGradientVector[6];\nvarying vec3 vGradientVector1;\nvarying vec3 vGradientVector2;\n#endif\n\nvoid main() {\n  gl_PointSize = 1.0;\n\n  vec3 pos = projectionMatrix * viewMatrix * vec3(a_vertexPosition.xy, 1.0);\n  gl_Position = vec4(pos.xy, 1.0, 1.0);\n\n#ifdef GRADIENT\n  vec3 vg1 = viewMatrix * vec3(u_radialGradientVector[0], u_radialGradientVector[1], 1.0);\n  vec3 vg2 = viewMatrix * vec3(u_radialGradientVector[3], u_radialGradientVector[4], 1.0);\n  float h = u_resolution.y;\n  vg1.y = h - vg1.y;\n  vg2.y = h - vg2.y;\n  vGradientVector1 = vec3(vg1.xy, u_radialGradientVector[2]);\n  vGradientVector2 = vec3(vg2.xy, u_radialGradientVector[5]);\n#endif\n  \n  flagBackground = a_vertexPosition.z;\n  vColor = a_color;\n\n#ifdef TEXTURE\n  vTextureCoord = a_vertexTextureCoord;\n  vSourceRect = a_sourceRect;\n#endif\n\n#ifdef CLIPPATH\n  vClipUV = a_clipUV;\n#endif\n}"]}}function Ee(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.hasTexture,n=void 0!==r&&r,i=e.hasFilter,o=void 0!==i&&i,u=e.hasGradient,s=void 0!==u&&u,l=e.hasClipPath,c=void 0!==l&&l,f=n|o<<1|s<<2|c<<3,h=t[Se][f];Array.isArray(h)&&(h=t.createProgram.apply(t,a()(h)),t[Se][f]=h),t.program!==h&&t.useProgram(h,{a_color:{type:"UNSIGNED_BYTE",normalize:!0}})}var Ce=[];function Oe(t){for(var e=0;e<64;e++){var r=[],n=!!(1&e),i=!!(2&e),o=!!(4&e),a=!!(8&e),u=!!(16&e),s=!!(32&e);n&&r.push("#define TEXTURE 1"),i&&r.push("#define FILTER 1"),o&&r.push("#define GRADIENT 1"),a&&r.push("#define CLOUDCOLOR 1"),u&&r.push("#define CLOUDFILTER 1"),s&&r.push("#define CLIPPATH 1");var l="".concat(r.join("\n"),"\n"),c=[];if(n){c.push("uniform sampler2D u_texSampler;");for(var f=0;f<12;f++)c.push("uniform sampler2D u_texFrame".concat(f,";"))}s&&c.push("uniform sampler2D u_clipSampler;"),Ce[e]=[l+c.join("\n")+"precision mediump float;\n\nvarying vec4 vColor;\nvarying float flagBackground;\n\n#ifdef TEXTURE\nvarying float frameIndex;\nvarying vec3 vTextureCoord;\nvarying vec4 vSourceRect;\n#endif\n\n#ifdef CLIPPATH\nvarying vec2 vClipUV;\n#endif\n\n#ifdef FILTER\nuniform int u_filterFlag;\nuniform float u_colorMatrix[20];\n#endif\n\n#ifdef CLOUDFILTER\nvarying vec4 colorCloud0;\nvarying vec4 colorCloud1;\nvarying vec4 colorCloud2;\nvarying vec4 colorCloud3;\nvarying vec4 colorCloud4;\n#endif\n\n#ifdef GRADIENT\nvarying vec3 vGradientVector1;\nvarying vec3 vGradientVector2;\nuniform float u_colorSteps[40];\nuniform int u_gradientType;\n\nvoid gradient(inout vec4 color, vec3 gv1, vec3 gv2, float colorSteps[40]) {\n  float t;\n  // center circle radius\n  float cr = gv1.z;\n  // focal circle radius\n  float fr = gv2.z;\n\n  if(cr > 0.0 || fr > 0.0) {\n    // radial gradient\n    vec2 center = gv1.xy;\n    vec2 focal = gv2.xy;\n    float x = focal.x - gl_FragCoord.x;\n    float y = focal.y - gl_FragCoord.y;\n    float dx = focal.x - center.x;\n    float dy = focal.y - center.y;\n    float dr = cr - fr;\n    float a = dx * dx + dy * dy - dr * dr;\n    float b = -2.0 * (y * dy + x * dx + fr * dr);\n    float c = x * x + y * y - fr * fr;\n    t = 1.0 - 0.5 * (1.0 / a) * (-b + sqrt(b * b - 4.0 * a * c));\n  } else {\n    // linear gradient\n    vec2 v1 = gl_FragCoord.xy - gv1.xy;\n    vec2 v2 = gv2.xy - gv1.xy;\n    t = (v1.x * v2.x + v1.y * v2.y) / (v2.x * v2.x + v2.y * v2.y);\n  }\n\n  vec4 colors[8];\n  colors[0] = vec4(colorSteps[1], colorSteps[2], colorSteps[3], colorSteps[4]);\n  colors[1] = vec4(colorSteps[6], colorSteps[7], colorSteps[8], colorSteps[9]);\n  colors[2] = vec4(colorSteps[11], colorSteps[12], colorSteps[13], colorSteps[14]);\n  colors[3] = vec4(colorSteps[16], colorSteps[17], colorSteps[18], colorSteps[19]);\n  colors[4] = vec4(colorSteps[21], colorSteps[22], colorSteps[23], colorSteps[24]);\n  colors[5] = vec4(colorSteps[26], colorSteps[27], colorSteps[28], colorSteps[29]);\n  colors[6] = vec4(colorSteps[31], colorSteps[32], colorSteps[33], colorSteps[34]);\n  colors[7] = vec4(colorSteps[36], colorSteps[37], colorSteps[38], colorSteps[39]);\n  \n  float steps[8];\n  steps[0] = colorSteps[0];\n  steps[1] = colorSteps[5];\n  steps[2] = colorSteps[10];\n  steps[3] = colorSteps[15];\n  steps[4] = colorSteps[20];\n  steps[5] = colorSteps[25];\n  steps[6] = colorSteps[30];\n  steps[7] = colorSteps[35];\n\n  color = colors[0];\n  for (int i = 1; i < 8; i++) {\n    if (steps[i] < 0.0 || steps[i] > 1.0) {\n      break;\n    }\n    if(steps[i] == steps[i - 1]) {\n      color = colors[i];\n    } else {\n      color = mix(color, colors[i], clamp((t - steps[i - 1]) / (steps[i] - steps[i - 1]), 0.0, 1.0));\n    }\n    if (steps[i] >= t) {\n      break;\n    }\n  }\n}\n#endif\n\nvoid transformColor(inout vec4 color, in float colorMatrix[20]) {\n  float r = color.r, g = color.g, b = color.b, a = color.a;\n  color[0] = colorMatrix[0] * r + colorMatrix[1] * g + colorMatrix[2] * b + colorMatrix[3] * a + colorMatrix[4];\n  color[1] = colorMatrix[5] * r + colorMatrix[6] * g + colorMatrix[7] * b + colorMatrix[8] * a + colorMatrix[9];\n  color[2] = colorMatrix[10] * r + colorMatrix[11] * g + colorMatrix[12] * b + colorMatrix[13] * a + colorMatrix[14];\n  color[3] = colorMatrix[15] * r + colorMatrix[16] * g + colorMatrix[17] * b + colorMatrix[18] * a + colorMatrix[19];\n}\n\n#ifdef CLOUDFILTER\nvoid buildCloudColor(inout float colorCloudMatrix[20]) {\n  colorCloudMatrix[0] = colorCloud0[0];\n  colorCloudMatrix[1] = colorCloud1[0];\n  colorCloudMatrix[2] = colorCloud2[0];\n  colorCloudMatrix[3] = colorCloud3[0];\n  colorCloudMatrix[4] = colorCloud4[0];\n\n  colorCloudMatrix[5] = colorCloud0[1];\n  colorCloudMatrix[6] = colorCloud1[1];\n  colorCloudMatrix[7] = colorCloud2[1];\n  colorCloudMatrix[8] = colorCloud3[1];\n  colorCloudMatrix[9] = colorCloud4[1];\n\n  colorCloudMatrix[10] = colorCloud0[2];\n  colorCloudMatrix[11] = colorCloud1[2];\n  colorCloudMatrix[12] = colorCloud2[2];\n  colorCloudMatrix[13] = colorCloud3[2];\n  colorCloudMatrix[14] = colorCloud4[2];\n\n  colorCloudMatrix[15] = colorCloud0[3];\n  colorCloudMatrix[16] = colorCloud1[3];\n  colorCloudMatrix[17] = colorCloud2[3];\n  colorCloudMatrix[18] = colorCloud3[3];\n  colorCloudMatrix[19] = colorCloud4[3];\n}\n#endif\n\nvoid main() {\n  vec4 color = vColor;\n  float opacity = abs(flagBackground);\n\n#ifdef GRADIENT\n  if(u_gradientType > 0 && flagBackground > 0.0 || u_gradientType == 0 && flagBackground <= 0.0) {\n    gradient(color, vGradientVector1, vGradientVector2, u_colorSteps);\n  }\n#endif\n\n  if(opacity < 1.0) {\n    color.a *= opacity;\n  }\n\n#ifdef TEXTURE\n  if(flagBackground > 0.0) {\n    vec3 texCoord = vTextureCoord;\n\n    if(texCoord.z == 1.0) {\n      texCoord = fract(texCoord);\n    }\n\n    if(texCoord.x <= 1.0 && texCoord.x >= 0.0\n      && texCoord.y <= 1.0 && texCoord.y >= 0.0) {\n      if(vSourceRect.z > 0.0) {\n        texCoord.x = vSourceRect.x + texCoord.x * vSourceRect.z;\n        texCoord.y = 1.0 - (vSourceRect.y + (1.0 - texCoord.y) * vSourceRect.w);\n      }\n      if(frameIndex < 0.0) {\n        vec4 texColor = texture2D(u_texSampler, texCoord.xy);\n        color = mix(color, texColor, texColor.a);\n      } else {\n        int index = int(floor(clamp(0.0, 11.0, frameIndex)));\n        vec4 texColor;\n        if(index == 0) texColor = texture2D(u_texFrame0, texCoord.xy);\n        else if(index == 1) texColor = texture2D(u_texFrame1, texCoord.xy);\n        else if(index == 2) texColor = texture2D(u_texFrame2, texCoord.xy);\n        else if(index == 3) texColor = texture2D(u_texFrame3, texCoord.xy);\n        else if(index == 4) texColor = texture2D(u_texFrame4, texCoord.xy);\n        else if(index == 5) texColor = texture2D(u_texFrame5, texCoord.xy);\n        else if(index == 6) texColor = texture2D(u_texFrame6, texCoord.xy);\n        else if(index == 7) texColor = texture2D(u_texFrame7, texCoord.xy);\n        else if(index == 8) texColor = texture2D(u_texFrame8, texCoord.xy);\n        else if(index == 9) texColor = texture2D(u_texFrame9, texCoord.xy);\n        else if(index == 10) texColor = texture2D(u_texFrame10, texCoord.xy);\n        else texColor = texture2D(u_texFrame11, texCoord.xy);\n        float alpha = texColor.a;\n        if(opacity < 1.0) {\n          texColor.a *= opacity;\n          alpha *= mix(0.465, 1.0, opacity);\n        }\n        // color = mix(color, texColor, texColor.a);\n        color.rgb = mix(color.rgb, texColor.rgb, alpha);\n        // color.rgb = mix(texColor.rgb, color.rgb, color.a);\n        color.rgb = mix(texColor.rgb, color.rgb, clamp(color.a / max(0.0001, texColor.a), 0.0, 1.0));\n        color.a = texColor.a + (1.0 - texColor.a) * color.a;\n      }\n    }\n  }\n#endif\n\n#ifdef FILTER\n  if(u_filterFlag > 0) {\n    transformColor(color, u_colorMatrix);\n  }\n#endif\n\n#ifdef CLOUDFILTER\n  float colorCloudMatrix[20];\n  buildCloudColor(colorCloudMatrix);\n  transformColor(color, colorCloudMatrix);\n#endif\n\n#ifdef CLIPPATH\n  float clip = texture2D(u_clipSampler, vClipUV).r;\n  color *= clip;\n#endif\n\n  gl_FragColor = color;\n}",l+"attribute vec3 a_vertexPosition;\nattribute vec4 a_color;\nvarying vec4 vColor;\nvarying float flagBackground;\nattribute vec3 a_transform0;\nattribute vec3 a_transform1;\nuniform vec2 u_resolution;\nuniform mat3 viewMatrix;\nuniform mat3 projectionMatrix;\n\n#ifdef TEXTURE\nattribute vec3 a_vertexTextureCoord;\nvarying vec3 vTextureCoord;\nattribute float a_frameIndex;\nvarying float frameIndex;\nattribute vec4 a_sourceRect;\nvarying vec4 vSourceRect;\n#endif\n\n#ifdef CLIPPATH\nattribute vec2 a_clipUV;\nvarying vec2 vClipUV;\n#endif\n\n#ifdef CLOUDFILTER\nattribute vec4 a_colorCloud0;\nattribute vec4 a_colorCloud1;\nattribute vec4 a_colorCloud2;\nattribute vec4 a_colorCloud3;\nattribute vec4 a_colorCloud4;\nvarying vec4 colorCloud0;\nvarying vec4 colorCloud1;\nvarying vec4 colorCloud2;\nvarying vec4 colorCloud3;\nvarying vec4 colorCloud4;\n#endif\n\n#ifdef CLOUDCOLOR\nattribute vec4 a_fillCloudColor;\nattribute vec4 a_strokeCloudColor;\n#endif\n\n#ifdef GRADIENT\nuniform float u_radialGradientVector[6];\nvarying vec3 vGradientVector1;\nvarying vec3 vGradientVector2;\n#endif\n\nvoid main() {\n  gl_PointSize = 1.0;\n\n  mat3 modelMatrix = mat3(\n    a_transform0.x, a_transform1.x, 0, \n    a_transform0.y, a_transform1.y, 0,\n    a_transform0.z, a_transform1.z, 1\n  );\n\n  vec3 pos = projectionMatrix * viewMatrix * modelMatrix * vec3(a_vertexPosition.xy, 1.0);\n  gl_Position = vec4(pos.xy, 1.0, 1.0);\n\n#ifdef GRADIENT\n  vec3 vg1 = viewMatrix * vec3(u_radialGradientVector[0], u_radialGradientVector[1], 1.0);\n  vec3 vg2 = viewMatrix * vec3(u_radialGradientVector[3], u_radialGradientVector[4], 1.0);\n  float h = u_resolution.y;\n  vg1.y = h - vg1.y;\n  vg2.y = h - vg2.y;\n  vGradientVector1 = vec3(vg1.xy, u_radialGradientVector[2]);\n  vGradientVector2 = vec3(vg2.xy, u_radialGradientVector[5]);\n#endif\n  \n  flagBackground = a_vertexPosition.z;\n\n#ifdef CLOUDCOLOR\n  if(flagBackground > 0.0) {\n    vColor = mix(a_color, a_fillCloudColor, a_fillCloudColor.a);\n  } else {\n    vColor = mix(a_color, a_strokeCloudColor, a_strokeCloudColor.a);\n  }\n#else\n  vColor = a_color;\n#endif\n\n#ifdef TEXTURE\n  vTextureCoord = a_vertexTextureCoord;\n  frameIndex = a_frameIndex;\n  vSourceRect = a_sourceRect;\n#endif\n\n#ifdef CLIPPATH\n  vClipUV = a_clipUV;\n#endif\n\n#ifdef CLOUDFILTER\n  colorCloud0 = a_colorCloud0;\n  colorCloud1 = a_colorCloud1;\n  colorCloud2 = a_colorCloud2;\n  colorCloud3 = a_colorCloud3;\n  colorCloud4 = a_colorCloud4;\n#endif\n}"]}}function ke(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.hasTexture,n=void 0!==r&&r,i=e.hasFilter,o=void 0!==i&&i,u=e.hasGradient,s=void 0!==u&&u,l=e.hasCloudColor,c=void 0!==l&&l,f=e.hasCloudFilter,h=void 0!==f&&f,d=e.hasClipPath,v=void 0!==d&&d,g=n|o<<1|s<<2|c<<3|h<<4|v<<5,p=Ce[g];Array.isArray(p)&&(p=t.createProgram.apply(t,a()(p)),Ce[g]=p),t.program!==p&&t.useProgram(p,{a_color:{type:"UNSIGNED_BYTE",normalize:!0},a_fillCloudColor:{type:"UNSIGNED_BYTE",normalize:!0},a_strokeCloudColor:{type:"UNSIGNED_BYTE",normalize:!0},a_frameIndex:{type:"UNSIGNED_BYTE",normalize:!1}})}function Ae(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Re(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Re(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},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(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function Re(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}r(0).glMatrix.setMatrixArrayType(Array);var Te={autoUpdate:!1,preserveDrawingBuffer:!1,bufferSize:1500},Le="attribute vec3 a_vertexPosition;\nattribute vec3 a_vertexTextureCoord;\nvarying vec3 vTextureCoord;\nuniform mat3 viewMatrix;\nuniform mat3 projectionMatrix;\n\nvoid main() {\n  gl_PointSize = 1.0;\n  vec3 pos = projectionMatrix * viewMatrix * vec3(a_vertexPosition.xy, 1.0);\n  gl_Position = vec4(pos.xy, 1.0, 1.0);    \n  vTextureCoord = a_vertexTextureCoord;              \n}\n",De="precision mediump float;\nvarying vec3 vTextureCoord;\nuniform sampler2D u_texSampler;\nvoid main() {\n  gl_FragColor = texture2D(u_texSampler, vTextureCoord.xy);\n}\n",Ie=Symbol("glRenderer"),Fe=Symbol("canvasRenderer"),Ue=Symbol("options"),Pe=Symbol("globalTransform"),Be=Symbol("applyGlobalTransform"),Ne=Symbol("canvas");function Ge(t){var e=t.gl,r=t.fbo;r&&e.bindFramebuffer(e.FRAMEBUFFER,r),t._draw(),r&&e.bindFramebuffer(e.FRAMEBUFFER,null)}function qe(t,e,r,n){var i=t.createTexture(e.canvas),o=[[[0,0],[r,0],[r,n],[0,n],[0,0]]];o.closed=!0;var a=new _e({contours:o});a.setTexture(i),t.setMeshData([a.meshData]),Ge(t),i.delete(),e.clearRect(0,0,r,n),delete e._filter}var je=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s()(this,t);var n=r.contextType;if(n||(n="function"==typeof WebGL2RenderingContext?"webgl2":"function"==typeof WebGLRenderingContext?"webgl":"2d"),!e.getContext){var i=e;e={getContext:function(){return i},width:r.width,height:r.height},i.canvas=e,n="2d"}if(this[Ne]=e,"webgl"!==n&&"webgl2"!==n&&"2d"!==n)throw new Error("Unknown context type ".concat(n));if(r.contextType=n,this[Ue]=Object.assign({},Te,r),"webgl"===n||"webgl2"===n){"webgl2"===n&&(this[Ue].webgl2=!0);var o=new f.a(e,this[Ue]);"webgl2"!==n||o.isWebGL2||(r.contextType="webgl"),we(o),Ee(o),Oe();var a=o.gl;a.clearColor(0,0,0,0),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA),this[Ie]=o}else this[Fe]=new C(e,this[Ue]);this[Pe]=[1,0,0,0,1,0,0,0,1],this.updateResolution()}return c()(t,[{key:Be,value:function(){var t=this[Ie]||this[Fe];if(this[Ie]){var e=this.canvas,r=e.width,n=e.height;t.uniforms.viewMatrix=this.viewMatrix,t.uniforms.projectionMatrix=this.projectionMatrix,t.uniforms.u_resolution=[r,n]}}},{key:"updateResolution",value:function(){var t=this.canvas,e=t.width,r=t.height,n=[1,0,0,0,1,0,-e/2,-r/2,1],i=[2/e,0,0,0,-2/r,0,0,0,1],o=h.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),i,n);this.projectionMatrix=o,this[Ie]&&this[Ie].gl.viewport(0,0,e,r)}},{key:"createTexture",value:function(t,e){return(this[Ie]||this[Fe]).createTexture(t,e)}},{key:"loadTexture",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.useImageBitmap,n=void 0!==r&&r,i=this[Ie]||this[Fe];return i.loadTexture(t,{useImageBitmap:n})}},{key:"createText",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.font,n=void 0===r?"16px arial":r,i=e.fillColor,o=void 0===i?null:i,a=e.strokeColor,u=void 0===a?null:a,s=e.strokeWidth,l=void 0===s?1:s;if(this[Ie]){var c=m.a.createText(t,{font:n,fillColor:o,strokeColor:u,strokeWidth:l});return{image:this.createTexture(c.image),rect:c.rect}}return{_img:{font:n,fillColor:o,strokeColor:u,strokeWidth:l,text:t}}}},{key:"createProgram",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.vertex,r=t.fragment,n=t.options;if(this[Ie]){var i=this[Ie].compileSync(r,e);return i._attribOpts=n,i}throw new Error("Context 2D cannot create webgl program.")}},{key:"createPassProgram",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.vertex,r=void 0===e?Le:e,n=t.fragment,i=void 0===n?De:n,o=t.options;return this.createProgram({vertex:r,fragment:i,options:o})}},{key:"useProgram",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this[Ie]){var r=Object.assign({},t._attribOpts,e);return this[Ie].useProgram(t,r)}throw new Error("Context 2D cannot use webgl program.")}},{key:"deleteTexture",value:function(t){return(this[Ie]||this[Fe]).deleteTexture(t)}},{key:"clear",value:function(){if(this[Ie]){var t=this[Ie].gl;t.clear(t.COLOR_BUFFER_BIT)}else{var e;(e=this[Fe]).clear.apply(e,arguments)}}},{key:"drawMeshCloud",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.clear,n=void 0!==r&&r,i=e.program,o=void 0===i?null:i,a=this[Ie]||this[Fe],u=o||t.program;if(this[Ie]){var s=a.gl;if(n&&s.clear(s.COLOR_BUFFER_BIT),u)a.program!==u&&this.useProgram(u,{a_color:{type:"UNSIGNED_BYTE",normalize:!0},a_fillCloudColor:{type:"UNSIGNED_BYTE",normalize:!0},a_strokeCloudColor:{type:"UNSIGNED_BYTE",normalize:!0},a_frameIndex:{type:"UNSIGNED_BYTE",normalize:!1}});else{var l=t.mesh.meshData,c=!!l.uniforms.u_texSampler,f=!!l.uniforms.u_filterFlag,h=!!l.uniforms.u_radialGradientVector,d=t.hasCloudColor,v=t.hasCloudFilter,g=!!l.uniforms.u_clipSampler;ke(a,{hasTexture:c,hasFilter:f,hasGradient:h,hasCloudColor:d,hasCloudFilter:v,hasClipPath:g})}this[Be](),a.setMeshData([t.meshData]),t.beforeRender&&t.beforeRender(s,t),Ge(a),t.afterRender&&t.afterRender(s,t)}else a.setTransform(this.globalTransformMatrix),a.drawMeshCloud(t,{clear:n,hook:!1})}},{key:"drawMeshes",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.clear,i=void 0!==n&&n,o=r.program,a=void 0===o?null:o,u=this[Ie]||this[Fe];this[Ie]?function(){var r=u.fbo,n=at(e,t,null==a),o=u.gl;i&&o.clear(o.COLOR_BUFFER_BIT);var s=!Qt(e.globalTransformMatrix);e._drawCalls=0;var l,c=Ae(n);try{var f=function(){var n=l.value;e._drawCalls++;var c=a||n.program;if(n instanceof et)e.drawMeshCloud(n,{clear:i,program:c});else{var f=e.canvas,h=f.width,d=f.height;if(n.beforeRender&&n.beforeRender(o,n),n.pass.length&&(e.fbo&&e.fbo.width===h&&e.fbo.height===d||(e.fbo={width:h,height:d,target:u.createFBO(),buffer:u.createFBO(),swap:function(){var t=[this.buffer,this.target];this.target=t[0],this.buffer=t[1]}}),u.bindFBO(e.fbo.target)),!c&&n.filterCanvas){Ee(u,{hasTexture:!0});var v=e.filterContext;if(!v)v=m.a.createCanvas(h,d).getContext("2d"),e.filterContext=v;var g=t[n.packIndex],p=g.filter,x=t[n.packIndex+1],y=t[n.packIndex-1];y&&y.filterCanvas&&y.filter===p||x&&x.filterCanvas&&x.filter===p?(s&&v.save(),w(g,v,!1),s&&v.restore(),x&&x.filterCanvas&&g.filter===x.filter||(_(v,p),e[Be](),qe(u,v,h,d))):(s?(v.save(),w(g,v,!1),v.restore(),_(v,p)):w(g,v,!0),e[Be](),qe(u,v,h,d))}else{if(c)u.program!==c&&e.useProgram(c,{a_color:{type:"UNSIGNED_BYTE",normalize:!0}});else{var b=!!n.uniforms.u_texSampler,M=!!n.uniforms.u_filterFlag,S=!!n.uniforms.u_radialGradientVector,E=!!n.uniforms.u_clipSampler;Ee(u,{hasTexture:b,hasFilter:M,hasGradient:S,hasClipPath:E})}n.filterCanvas&&console.warn("User program ignored some filter effects."),e[Be](),u.setMeshData([n]),Ge(u)}if(n.pass.length){var C=n.pass.length;n.pass.forEach((function(t,i){t.blend=n.enableBlend,t.setTexture(u.fbo.texture),i===C-1?u.bindFBO(r):(e.fbo.swap(),u.bindFBO(e.fbo.target)),t.program?u.useProgram(t.program):(e.defaultPassProgram=e.defaultPassProgram||e.createPassProgram(),u.useProgram(e.defaultPassProgram)),u.setMeshData([t.meshData]),o.clear(o.COLOR_BUFFER_BIT),Ge(u)}))}n.afterRender&&n.afterRender(o,n)}};for(c.s();!(l=c.n()).done;)f()}catch(t){c.e(t)}finally{c.f()}}():(u.setTransform(this.globalTransformMatrix),u.drawMeshes(t,{clear:i}))}},{key:"drawImage",value:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var i=r.length;if(i<2)throw new TypeError("Failed to execute 'drawImage' on 'Renderer': 3 arguments required, but only ".concat(r.length+1," present."));if(2!==i&&4!==i&&8!==i)throw new TypeError("Failed to execute 'drawImage' on 'Renderer': Valid arities are: [3, 5, 9], but ".concat(r.length+1," arguments provided."));var o=null,a=null;2===i?o=[r[0],r[1],t.width,t.height]:4===i?o=r:8===i&&(a=r.slice(0,4),o=r.slice(4));var u=this.createTexture(t),s=this.canvas,l=s.width,c=s.height,f=new Ft;f.rect(o[0],o[1],l,c);var h=new _e(f,{width:l,height:c});h.setTexture(u,{rect:o,srcRect:a}),this.drawMeshes([h]),this.deleteTexture(u)}},{key:"setGlobalTransform",value:function(){return this[Pe]=[arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],0,arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3],0,arguments.length<=4?void 0:arguments[4],arguments.length<=5?void 0:arguments[5],1],this}},{key:"globalTransform",value:function(){for(var t=this[Pe],e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return this[Pe]=h.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),t,r),this}},{key:"globalTranslate",value:function(t,e){var r=h.mat3.create();return r=h.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),r,[t,e]),this.globalTransform.apply(this,a()(r))}},{key:"globalRotate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0],r=i()(e,2),n=r[0],o=r[1],u=h.mat3.create();return u=h.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),u,[n,o]),u=h.mat3.rotate(Array.of(0,0,0,0,0,0,0,0,0),u,t),u=h.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),u,[-n,-o]),this.globalTransform.apply(this,a()(u))}},{key:"globalScale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0],n=i()(r,2),o=n[0],u=n[1],s=h.mat3.create();return s=h.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),s,[o,u]),s=h.mat3.scale(Array.of(0,0,0,0,0,0,0,0,0),s,[t,e]),s=h.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),s,[-o,-u]),this.globalTransform.apply(this,a()(s))}},{key:"globalSkew",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0],n=i()(r,2),o=n[0],u=n[1],s=h.mat3.create();return s=h.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),s,[o,u]),s=h.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),s,h.mat3.fromValues(1,Math.tan(e),Math.tan(t),1,0,0)),s=h.mat3.translate(Array.of(0,0,0,0,0,0,0,0,0),s,[-o,-u]),this.globalTransform.apply(this,a()(s))}},{key:"transformPoint",value:function(t,e,r){var n=this.globalTransformMatrix;return r&&(n=h.mat3.multiply(Array.of(0,0,0,0,0,0,0,0,0),n,r)),[t*n[0]+e*n[2]+n[4],t*n[1]+e*n[3]+n[5]]}},{key:"canvas",get:function(){return this[Ne]}},{key:"canvasRenderer",get:function(){return this[Fe]}},{key:"glRenderer",get:function(){return this[Ie]}},{key:"isWebGL2",get:function(){return this[Ie]&&this[Ie].isWebGL2}},{key:"options",get:function(){return this[Ue]}},{key:"globalTransformMatrix",get:function(){var t=this[Pe];return[t[0],t[1],t[3],t[4],t[6],t[7]]}},{key:"viewMatrix",get:function(){return this[Pe]}}]),t}();r(0).glMatrix.setMatrixArrayType(Array)}])}));